dnl ****** configure.in for sic dnl ****** dnl ****** Copyright(c) 1997-2000 - All Rights Reserved dnl ****** See the COPYRIGHT file. dnl ****** AC_REVISION($Id: configure.in,v 1.33 2001/07/07 16:24:14 kalt Exp $) AC_INIT(config.h) AC_CONFIG_HEADER(setup.h) AC_MSG_CHECKING(home) AC_CACHE_VAL(sic_cv_hostname, [sic_cv_hostname="`hostname 2> /dev/null`"]) AC_MSG_RESULT($sic_cv_hostname) if test "$sic_cv_hostname" != "`hostname 2> /dev/null`"; then AC_MSG_WARN([ The cache was created on a different system! ]) sleep 2 fi AC_PREFIX_PROGRAM(sic) dnl ****** dnl ****** Checks for programs. dnl ****** AC_PROG_CC AC_PROG_INSTALL dnl ****** dnl ****** Checks for libraries. dnl ****** AC_SEARCH_LIBS(gethostbyname, nsl, , AC_MSG_WARN(I didn't find gethostbyname(). help me!)) AC_SEARCH_LIBS(inet_addr, nsl, , AC_MSG_WARN(I didn't find inet_addr(). help me!)) AC_SEARCH_LIBS(getaddrinfo, socket, AC_DEFINE(HAVE_GETADDRINFO), AC_MSG_WARN(no getaddrinfo(): IPv6 support not enabled.)) AC_SEARCH_LIBS(select, socket, , AC_MSG_WARN(I didn't find select(). help me!)) AC_SEARCH_LIBS(socket, socket xnet, , AC_MSG_WARN(I didn't find socket(). help me!)) AC_SEARCH_LIBS(tgetent, termcap curses ncurses, , AC_MSG_WARN(I didn't find tgetent(). help me!)) AC_CHECK_LIB(mapmalloc, malloc) AC_CACHE_SAVE AC_CHECK_LIB(pthread, pthread_create, , NOPT=1) if test "x$NOPT" = "x1"; then if test "`uname -s`" = "FreeBSD"; then dnl what's the deal with FleaBSD? CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" LDFLAGS="$LDFLAGS -pthread" AC_CHECK_FUNC(pthread_create, , AC_MSG_ERROR([POSIX threads not found -- help!])) else if test "`uname -s`" = "CYGWIN_NT-5.0"; then AC_CHECK_FUNC(pthread_create, , AC_MSG_ERROR([POSIX threads not found -- Upgrade to a newer version of Cygwin.])) else AC_MSG_ERROR([POSIX threads not found -- help!]) fi fi fi dnl ****** dnl ****** Checks for header files. dnl ****** AC_HEADER_STDC AC_CHECK_HEADERS(stdio.h stdlib.h unistd.h regex.h strings.h sys/time.h sys/filio.h sys/select.h termcap.h pth.h pthread.h) dnl ****** dnl ****** Checks for typedefs, structures, and compiler characteristics. dnl ****** AC_C_CONST AC_HEADER_TIME dnl AC_TYPE_SIGNAL dnl ****** dnl ****** Checks for library functions. dnl ****** AC_PROG_GCC_TRADITIONAL AC_FUNC_VPRINTF dnl AC_CHECK_FUNCS(select socket strdup strtoul strchr memcpy) AC_CHECK_FUNC(strdup,, AC_MSG_ERROR([no strdup()!])) AC_CHECK_FUNC(strtoul,, AC_MSG_ERROR([no strtoul()!])) AC_CHECK_FUNCS(strftime strerror) AC_CHECK_FUNC(pth_yield, AC_DEFINE(GNU_PTH) AC_MSG_WARN([Ugh -- detected GNU Pth library.])) dnl dnl ****** strerror() or sys_errlist[] ? dnl if test $ac_cv_func_strerror != yes; then AC_CACHE_CHECK([for sys_errlist declaration in stdio.h, errno.h or sys/errno.h], sic_cv_decl_sys_errlist, [AC_TRY_COMPILE([ #if HAVE_SYS_TYPES_H #include #endif #if HAVE_STDIO_H #include #endif #if HAVE_ERRNO_H #include #endif #if HAVE_SYS_ERRNO_H #include #endif], [char *msg = sys_errlist[0];], sic_cv_decl_sys_errlist=yes, sic_cv_decl_sys_errlist=no)]) if test $sic_cv_decl_sys_errlist = yes; then AC_DEFINE(SYS_ERRLIST_DECLARED) fi AC_CACHE_CHECK([for sys_nerr declaration in stdio.h, errno.h or sys/errno.h], sic_cv_decl_sys_nerr, [AC_TRY_COMPILE([ #if HAVE_SYS_TYPES_H #include #endif #if HAVE_STDIO_H #include #endif #if HAVE_ERRNO_H #include #endif #if HAVE_SYS_ERRNO_H #include #endif], [int num = sys_nerr;], sic_cv_decl_sys_nerr=yes, sic_cv_decl_sys_nerr=no)]) if test $sic_cv_decl_sys_nerr = yes; then AC_DEFINE(SYS_NERR_DECLARED) fi fi dnl ****** dnl ****** need to find a 32 bit integer... (for dcc stuff) dnl ****** AC_MSG_CHECKING(for a 32 bit integer) AC_CACHE_VAL(sic_cv_int32, AC_TRY_RUN([ main() { if (4 == sizeof(unsigned long)) exit(0); exit(1); } ], sic_cv_int32="long", AC_TRY_RUN([ main() { if (4 == sizeof(unsigned int)) exit(0); exit(1); } ], sic_cv_int32="int", sic_cv_int32="none"))) if test "$sic_cv_int32" = "long"; then AC_MSG_RESULT(unsigned long) AC_DEFINE(UNSIGNED_LONG32) else if test "$sic_cv_int32" = "int"; then AC_MSG_RESULT(unsigned int) AC_DEFINE(UNSIGNED_INT32) else AC_MSG_RESULT([none, using unsigned long]) AC_DEFINE(UNSIGNED_UNKNOWN32) fi fi dnl ****** dnl ****** are we unlucky and on SunOS 5.x where term.h is broken? dnl ****** AC_MSG_CHECKING([for SunOS 5.x]) AC_CACHE_VAL(sic_cv_sunos_5, [if test "x`(uname) 2>/dev/null`" = "xSunOS" && uname -r 2>/dev/null | grep "^5" >/dev/null; then sic_cv_sunos_5="`uname -r | sed -e \"s/^5/2/g\"`" else sic_cv_sunos_5=no fi ]) if test "$sic_cv_sunos_5" = "no"; then AC_MSG_RESULT(no) else AC_MSG_RESULT([yes, $sic_cv_sunos_5]) AC_DEFINE(SUNOS_5) fi dnl ****** dnl ****** GNU librx.a around? dnl ****** AC_ARG_WITH(rx, [ --with-rx[=PATH] checks for GNU librx ]) AC_ARG_WITH(rx, [ --without-rx do not use GNU librx ]) if test "x$with_rx" != xno; then AC_MSG_CHECKING(for GNU librx) AC_CACHE_VAL(sic_cv_path_GNUrx, [ sic_save_CPPFLAGS="$CPPFLAGS" AC_TRY_CPP([#include ], GNUrx_path=yes, [ if test -d "$with_rx/include"; then CPPFLAGS="$CPPFLAGS -I$with_rx/include"; fi AC_TRY_CPP([#include ], GNUrx_path="$with_rx", GNUrx_path=no) ]) CPPFLAGS="$sic_save_CPPFLAGS" ]) if test "x$GNUrx_path" != x && test "x$GNUrx_path" != xno; then dnl The include file was found but make sure we are able to link sic_save_LIBS="$LIBS" if test "$with_rx" = "$GNUrx_path"; then LIBS="-L$GNUrx_path/lib -lrx $LIBS" else LIBS="-lrx $LIBS" fi dnl AC_TRY_LINK( dnl changequote(<<, >>)dnl dnl <>, dnl changequote([, ])dnl dnl [printf("%s\n", rx_version_string);], , GNUrx_path=no) AC_TRY_RUN( changequote(<<, >>)dnl <1) {printf("%s\n", rx_version_string);} exit(0); }>>, changequote([, ])dnl sic_cv_GNUrx_version="`./conftest show | sed 's/version /v/'`", GNUrx_path=no) if test "x$GNUrx_path" = xno; then GNUrx_path=no fi LIBS="$sic_save_LIBS" fi if test "x$GNUrx_path" = xyes; then sic_cv_path_GNUrx= else if test "x$GNUrx_path" != x; then sic_cv_path_GNUrx=$GNUrx_path fi fi if test "x$sic_cv_path_GNUrx" = xno; then AC_MSG_RESULT(no) if test "x$ac_cv_header_sys_ioctl_h" = "no"; then AC_MSG_WARN([Some features will not be available.]) fi else AC_DEFINE(USE_GNU_RX) AC_DEFINE(HAVE_REGEXP) if test "x$sic_cv_path_GNUrx" = x; then AC_MSG_RESULT([yes ($sic_cv_GNUrx_version found by compiler & linker)]) LIBS="-lrx $LIBS" else AC_MSG_RESULT([yes ($sic_cv_GNUrx_version found in $sic_cv_path_GNUrx)]) LIBS="-L$sic_cv_path_GNUrx/lib -lrx $LIBS" CPPFLAGS="-I$sic_cv_path_GNUrx/include $CPPFLAGS" fi if test "x$ac_cv_header_regex_h" = "xyes"; then AC_MSG_WARN([Using the GNU librx on top of the system's function may result in compilation errors.]) fi fi fi dnl ****** dnl ****** Is emacs installed? Where is yow? dnl ****** AC_MSG_CHECKING(for yow) IFS="${IFS= }"; sic_save_ifs="$IFS"; IFS=":" sic_dummy="$PATH" for sic_dir in $sic_dummy; do test -z "$sic_dir" && sic_dir=. if test -x $sic_dir/emacs; then sic_path_emacs="$sic_dir/emacs" break fi done IFS="$sic_save_ifs" if test -n "$sic_path_emacs"; then rm -f conftest.el echo "(defun whereisyow () (princ (eval 'exec-directory)))" > conftest.el yow_path="`$sic_path_emacs -batch -l conftest.el -f whereisyow 2>&1`" if test -x "${yow_path}/yow"; then sic_cv_yow_path="${yow_path}/yow" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(YOW_PATH, "$sic_cv_yow_path") else AC_MSG_RESULT(no) fi rm -f conftest.el else AC_MSG_RESULT(no) fi dnl ****** dnl ****** Get the version number dnl ****** VERSION="`cat patchlevel.h | grep const | sed 's/^.* \"//' | sed 's/\".*$//'`" AC_SUBST(VERSION) dnl ****** dnl ****** That's all folks! dnl ****** AC_OUTPUT(Makefile)