dnl Process this file with autoconf to produce a configure script. AC_INIT(forwback.c) AC_CONFIG_HEADER(defines.h) dnl Checks for programs. AC_PROG_CC AC_GCC_TRADITIONAL AC_PROG_INSTALL dnl Checks for libraries. TERMLIBS= AC_HAVE_LIBRARY(curses, [TERMLIBS="$TERMLIBS -lcurses"]) AC_HAVE_LIBRARY(termcap, [TERMLIBS="$TERMLIBS -ltermcap"]) AC_HAVE_LIBRARY(termlib, [have_termlib=yes], [have_termlib=no]) dnl Regular expressions (regcmp) are in -lgen on Solaris 2, dnl and in -lintl on SCO Unix. AC_HAVE_LIBRARY(gen, [LIBS="$LIBS -lgen"]) AC_HAVE_LIBRARY(intl, [LIBS="$LIBS -lintl"]) dnl ??? AC_HAVE_LIBRARY(gnuregex, [LIBS="$LIBS -lgnuregex"]) dnl Solaris has curses & termcap, but they don't work without libucb dnl which is broken, so we use termlib. AC_CHECKING(termlib) SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" AC_COMPILE_CHECK(, , [tgetent(0); tgetflag(0); tgetnum(0); tgetstr(0);], [termok=yes], [termok=no]) if test $termok = no; then LIBS="$SAVE_LIBS" if test $have_termlib = yes; then LIBS="$LIBS -ltermlib" fi fi dnl Checks for header files. AC_STDC_HEADERS AC_HAVE_HEADERS(ctype.h errno.h fcntl.h stdio.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h) dnl Checks for identifiers. AC_OFF_T AC_COMPILE_CHECK(void, , [void *foo = 0;], [AC_DEFINE(HAVE_VOID)]) AC_COMPILE_CHECK(time_t, [#include ], [time_t t = 0;], [AC_DEFINE(HAVE_TIME_T)]) dnl Checks for functions and external variables. AC_RETSIGTYPE AC_HAVE_FUNCS(_setjmp system sigsetmask memcpy strchr) dnl Some systems have termios.h but not the corresponding functions. AC_FUNC_CHECK(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS)) AC_COMPILE_CHECK(strerror, [ #if HAVE_STDIO_H #include #endif #if HAVE_STRING_H #include #endif #if HAVE_ERRNO_H #include #endif], [static char *x; x = strerror(0);], [AC_DEFINE(HAVE_STRERROR)]) AC_COMPILE_CHECK(, , [extern int sys_errlist; static int x; x = sys_errlist;], [AC_DEFINE(HAVE_SYS_ERRLIST)]) AC_COMPILE_CHECK(, , [extern int errno; static int x; x = errno;], [AC_DEFINE(HAVE_ERRNO)]) AC_COMPILE_CHECK(locale, [#include #include ], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);], [AC_DEFINE(HAVE_LOCALE)]) AC_COMPILE_CHECK(ctype, [ #if HAVE_CTYPE_H #include #endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);], [AC_DEFINE(HAVE_UPPER_LOWER)]) have_ospeed=no AC_CHECKING(termcap for ospeed) AC_COMPILE_CHECK(, [ #include #if HAVE_TERMIOS_H #include #endif #if HAVE_TERMCAP_H #include #endif], [ospeed = 0;], [AC_DEFINE(HAVE_OSPEED) have_ospeed=yes]) if test $have_ospeed = no; then AC_COMPILE_CHECK(, , [extern short ospeed; ospeed = 0;], [AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)]) fi dnl Checks for regular expression functions. have_regex=no AC_CHECKING(for POSIX regex.h) AC_COMPILE_CHECK(, [#include #include ], [regex_t *r; regfree(r);], AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes) if test $have_regex = no; then AC_FUNC_CHECK(regcmp, AC_DEFINE(HAVE_REGCMP) have_regex=yes) fi if test $have_regex = no; then AC_COMPILE_CHECK(, [#include "regexp.h"], [regcomp("");], AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes) fi if test $have_regex = no && test -f ${srcdir}/regex.c; then AC_DEFINE(HAVE_POSIX_REGCOMP) REGEX_O='regex.$(O)' AC_SUBST(REGEX_O) have_regex=yes fi if test $have_regex = no && test -f ${srcdir}/regexp.c; then AC_DEFINE(HAVE_V8_REGCOMP) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes fi if test $have_regex = no; then AC_FUNC_CHECK(re_comp, AC_DEFINE(HAVE_RE_COMP) have_regex=yes) fi if test $have_regex = no; then AC_DEFINE(NO_REGEX) fi AC_OUTPUT(Makefile)