1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(include/cdk.h)
dnl
dnl This looks for a library in several 'standard' locations.
dnl
AC_DEFUN(CDK_FIND_LIB, [
eval "cdk_$2_lib=no"
for dir in /usr/local/lib/ /usr/lib/ /usr/5lib/ /usr/ccs/lib/ /opt/lib/; do
if test -f ${dir}/$1; then
LDFLAGS="$LDFLAGS -L$dir"
eval "cdk_$2_lib=no"
fi
done])
dnl
dnl This looks for the given type in the header file.
dnl
AC_DEFUN(CDK_FIND_TYPE, [
AC_MSG_CHECKING("for $2")
count=0
if test "$3" = ""; then
value=1
else
value=$3
fi
for dir in /usr/include /usr/local/include /opt/include; do
if test -f ${dir}/$1; then
count=`grep '$2;$' ${dir}/$1 | grep -c '^typedef'`
fi
done
if test $count -ne 0; then
AC_MSG_RESULT("yes")
eval "cdk_$2_type=yes"
CFLAGS="$CFLAGS -DHAVE_CHTYPE=$value"
else
AC_MSG_RESULT("no")
eval "cdk_$2_type=no"
fi])
dnl
dnl Checks for programs.
dnl
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
dnl
dnl Put -Wall on compile line if we are using gcc or g++
dnl
if test "$ac_cv_prog_CC" = "gcc"; then
CFLAGS="$CFLAGS -Wall"
fi
if test "$ac_cv_prog_CC" = "g++"; then
CFLAGS="$CFLAGS -Wall"
fi
dnl
dnl Checks for libraries. If we have start_color
dnl set the HAVE_COLOR define.
dnl
AC_CHECK_LIB(m,sin)
AC_CHECK_LIB(termcap,waddstr)
AC_CHECK_LIB(ncurses, start_color)
if test "$ac_cv_lib_ncurses_start_color" != yes; then
AC_CHECK_LIB(curses,initscr)
else
AC_DEFINE(HAVE_COLOR)
fi
dnl
dnl Checks for header files.
dnl
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h unistd.h)
dnl
dnl Checks for typedefs, structures, and compiler characteristics.
dnl
AC_TYPE_MODE_T
AC_STRUCT_TM
CDK_FIND_TYPE(curses.h, chtype)
dnl
dnl Checks for library functions.
dnl
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(getcwd mktime strdup strerror usleep)
dnl
dnl Set pre-processor compile time variables.
dnl
AC_CHECK_FUNC(XCursesExit, AC_DEFINE(HAVE_XCURSES))
dnl
dnl Set the LDPATH values depending where the
dnl library is installed. If we found ncurses,
dnl look for ncurses.
dnl
CDK_FIND_LIB(libncurses.a, cdk_ncurses_lib)
if test "$cdk_ncurses_lib" != "no"; then
LIBS="$LIBS -lncurses"
CFLAGS="$CFLAGS -DHAVE_LIBNCURSES=1"
else
LIBS="$LIBS -lcurses"
CFLAGS="$CFLAGS -DHAVE_LIBNCURSES=0"
fi
AC_OUTPUT(Makefile examples/Makefile demos/Makefile)
|