diff options
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 737 |
1 files changed, 737 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..a53e46b5 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,737 @@ +dnl Macros for auto-configure script. +dnl written feb/1997 +dnl by T.E.Dickey <dickey@clark.net> +dnl and Jim Spath <jspath@mail.bcpl.lib.md.us> + +dnl --------------------------------------------------------------------------- +dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's +dnl redundant. Also, don't add /usr/local/include if we're using gcc. +AC_DEFUN([CF_ADD_INCDIR], +[ +for cf_add_incdir in $1 +do + while true + do + case $cf_add_incdir in + /usr/include) # (vi + ;; + /usr/local/include) # (vi + test -z "$GCC" && CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + ;; + *) # (vi + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + ;; + esac + cf_top_incdir=`echo $cf_add_incdir | sed -e 's:/include/.*$:/include:'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + done +done +]) +dnl --------------------------------------------------------------------------- +dnl Check for existence of alternate-character-set support in curses, so we +dnl can decide to use it for box characters. +dnl +AC_DEFUN([CF_ALT_CHAR_SET], +[ +AC_MSG_CHECKING([if curses supports alternate-character set]) +AC_CACHE_VAL(cf_cv_alt_char_set,[ + AC_TRY_LINK([ +#include <curses.h> + ],[ + chtype x = acs_map['l'] + ], + [cf_cv_alt_char_set=yes], + [cf_cv_alt_char_set=no])]) +AC_MSG_RESULT($cf_cv_alt_char_set) +test $cf_cv_alt_char_set = yes && AC_DEFINE(ALT_CHAR_SET) +])dnl +dnl --------------------------------------------------------------------------- +dnl Allow user to disable a normally-on option. +AC_DEFUN([CF_ARG_DISABLE], +[CF_ARG_OPTION($1,[$2 (default: on)],[$3],[$4],yes)])dnl +dnl --------------------------------------------------------------------------- +dnl Allow user to enable a normally-off option. +AC_DEFUN([CF_ARG_ENABLE], +[CF_ARG_OPTION($1,[$2 (default: off)],[$3],[$4],no)])dnl +dnl --------------------------------------------------------------------------- +dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus +dnl values. +dnl +dnl Parameters: +dnl $1 = option name +dnl $2 = help-string +dnl $3 = action to perform if option is not default +dnl $4 = action if perform if option is default +dnl $5 = default option value (either 'yes' or 'no') +AC_DEFUN([CF_ARG_OPTION], +[AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes) + if test "$enableval" != "$5" ; then +ifelse($3,,[ :]dnl +,[ $3]) ifelse($4,,,[ + else + $4]) + fi],[enableval=$5 ifelse($4,,,[ + $4 +])dnl + ])])dnl +dnl --------------------------------------------------------------------------- +dnl Check if curses supports color. (Note that while SVr3 curses supports +dnl color, it does this differently from SVr4 curses; more work would be needed +dnl to accommodate SVr3). +dnl +AC_DEFUN([CF_COLOR_CURSES], +[ +AC_MSG_CHECKING(if curses supports color attributes) +AC_CACHE_VAL(cf_cv_color_curses,[ + AC_TRY_LINK([ +#include <curses.h> +], + [has_colors(); + start_color(); + wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */ + ], + [cf_cv_color_curses=yes], + [cf_cv_color_curses=no]) + ]) +AC_MSG_RESULT($cf_cv_color_curses) +test $cf_cv_color_curses = yes && AC_DEFINE(COLOR_CURSES) +]) +dnl --------------------------------------------------------------------------- +dnl Look for the curses libraries. Older curses implementations may require +dnl termcap/termlib to be linked as well. +AC_DEFUN([CF_CURSES_LIBS],[ +AC_CHECK_FUNC(initscr,,[ +if test -d /usr/5lib ; then + # SunOS 3.x or 4.x + CPPFLAGS="$CPPFLAGS -I/usr/5include" + LIBS="$LIBS -L/usr/5lib" +# elif test -d /usr/ccs/lib ; then +# # Solaris 5.x +# LIBS="$LIBS -L/usr/ccs/lib -R/usr/ccs/lib" +fi +cf_save_LIBS="$LIBS" +AC_CHECK_LIB(termcap, tgoto,[ + LIBS="-ltermcap $cf_save_LIBS" + AC_CHECK_LIB(curses,initscr,,[ + AC_CHECK_LIB(cursesX,initscr,,[ + AC_CHECK_LIB(jcurses,initscr,,[ + AC_ERROR(cannot link curses)])])]) + ],[ + AC_CHECK_LIB(curses,initscr,,[ + AC_ERROR(cannot link curses)])]) +])]) +dnl --------------------------------------------------------------------------- +dnl Solaris 2.x curses provides a "performance" tradeoff according to whether +dnl CURS_PERFORMANCE is defined. If defined, the implementation defines macros +dnl that access the WINDOW structure. Otherwise, function calls are used. +AC_DEFUN([CF_CURS_PERFORMANCE], +[ +AC_MSG_CHECKING([for curses performance tradeoff]) +AC_CACHE_VAL(cf_cv_curs_performance,[ + cf_cv_curs_performance=no + AC_TRY_COMPILE([ +#include <curses.h>],[ +#if defined(wbkgdset) && defined(clearok) && defined(getbkgd) + int x = ERR; +#else + int x = ; /* force an error */ +#endif + ],[ + AC_TRY_COMPILE([ +#define CURS_PERFORMANCE +#include <curses.h>],[ +#if defined(wbkgdset) && defined(clearok) && defined(getbkgd) + int x = ; /* force an error */ +#else + int x = ERR; +#endif + ],[cf_cv_curs_performance=yes])])]) +AC_MSG_RESULT($cf_cv_curs_performance) +test $cf_cv_curs_performance = yes && AC_DEFINE(CURS_PERFORMANCE) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for a program in the given list $3, defining the corresponding +dnl program variable $2. +dnl +AC_DEFUN([CF_DEFINE_PROG],[ +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(cf_cv_$2,[ + cf_cv_$2=unknown + for cv_path in $3 + do + if test -f $cv_path ; then + cf_cv_$2=$cv_path + break + fi + done + ]) +AC_MSG_RESULT($cf_cv_$2) +AC_DEFINE_UNQUOTED($2,"$cf_cv_$2") +]) +dnl --------------------------------------------------------------------------- +dnl +AC_DEFUN([CF_ERRNO], +[ +AC_MSG_CHECKING([for errno external decl]) +AC_CACHE_VAL(cf_cv_extern_errno,[ + AC_TRY_COMPILE([ +#include <errno.h>], + [int x = errno], + [cf_cv_extern_errno=yes], + [cf_cv_extern_errno=no])]) +AC_MSG_RESULT($cf_cv_extern_errno) +test $cf_cv_extern_errno = no && AC_DEFINE(DECL_ERRNO) +])dnl +dnl --------------------------------------------------------------------------- +AC_DEFUN([CF_FANCY_CURSES], +[ +AC_MSG_CHECKING(if curses supports fancy attributes) +AC_CACHE_VAL(cf_cv_fancy_curses,[ + AC_TRY_LINK([ +#include <curses.h> +], + [attrset(A_UNDERLINE|A_BOLD|A_REVERSE); + wattrset(stdscr, A_BLINK|A_DIM); + attroff(A_BOLD); + keypad(stdscr,TRUE); + ], + [cf_cv_fancy_curses=yes], + [cf_cv_fancy_curses=no]) + ]) +AC_MSG_RESULT($cf_cv_fancy_curses) +test $cf_cv_fancy_curses = yes && AC_DEFINE(FANCY_CURSES) +]) +dnl --------------------------------------------------------------------------- +dnl Check if the compiler supports useful warning options. There's a few that +dnl we don't use, simply because they're too noisy: +dnl +dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) +dnl -Wredundant-decls (system headers make this too noisy) +dnl -Wtraditional (combines too many unrelated messages, only a few useful) +dnl -pedantic +dnl +dnl FIXME: the following are useful, but Lynx's not there yet +dnl -Wcast-qual +dnl -Wwrite-strings +dnl +AC_DEFUN([CF_GCC_WARNINGS], +[EXTRA_CFLAGS="" +if test -n "$GCC" +then + changequote(,)dnl + cat > conftest.$ac_ext <<EOF +#line __oline__ "configure" +int main(int argc, char *argv[]) { return argv[argc-1] == 0; } +EOF + changequote([,])dnl + AC_CHECKING([for gcc warning options]) + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-W -Wall" + for cf_opt in \ + Wbad-function-cast \ + Wcast-align \ + Winline \ + Wmissing-declarations \ + Wmissing-prototypes \ + Wnested-externs \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if AC_TRY_EVAL(ac_compile); then + test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + rm -f conftest* + CFLAGS="$cf_save_CFLAGS" +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Construct a search-list for a nonstandard header-file +AC_DEFUN([CF_HEADER_PATH], +[$1="" +test "$prefix" != NONE && $1="$prefix/include $prefix/include/$2" +test "$prefix" != /usr/local && $1="[$]$1 /usr/local/include /usr/local/include/$2" +test "$prefix" != /usr && $1="[$]$1 /usr/include /usr/include/$2" +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if we've got setlocale() and its header, <locale.h> +AC_DEFUN([CF_LOCALE], +[ +AC_MSG_CHECKING(for setlocale()) +AC_CACHE_VAL(cf_cv_locale,[ +AC_TRY_LINK([#include <locale.h>], + [setlocale(LC_ALL, "")], + [cf_cv_locale=yes], + [cf_cv_locale=no]) + ]) +AC_MSG_RESULT($cf_cv_locale) +test $cf_cv_locale = yes && AC_DEFINE(LOCALE) +]) +dnl --------------------------------------------------------------------------- +dnl Check for the use of 'include' in 'make' (BSDI is a special case) +dnl The symbol $ac_make is set in AC_MAKE_SET, as a side-effect. +AC_DEFUN([CF_MAKE_INCLUDE], +[ +AC_MSG_CHECKING(for style of include in makefiles) +make_include_left="" +make_include_right="" +make_include_quote="" +for cf_include in "include" ".include" "!include" +do + for cf_quote in ' ' '"' + do + cat >WWW/Library/unix/makefile <<CF_EOF +${cf_include} ${cf_quote}../../Library/Implementation/Version.make${cf_quote} +all : + @echo 'cf_make_include=OK' +CF_EOF + cf_make_include="" + eval `cd WWW/Library/unix && ${MAKE-make} 2>/dev/null | grep cf_make_include=OK` + if test -n "$cf_make_include"; then + make_include_left="$cf_include" + make_include_quote="$cf_quote" + break + fi + done + test -n "$cf_make_include" && break +done + +if test -z "$make_include_left" ; then + AC_ERROR(Your $ac_make program does not support includes) +fi +if test -n "$make_include_quote" ; then + make_include_left="$make_include_left $make_include_quote" + make_include_right="$make_include_quote" +fi +AC_MSG_RESULT(${make_include_left}file${make_include_right}) +AC_SUBST(make_include_left) +AC_SUBST(make_include_right) +]) +dnl --------------------------------------------------------------------------- +dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting +dnl the CPPFLAGS variable. +dnl +dnl The header files may be installed as either curses.h, or ncurses.h +dnl (obsolete). If not installed for overwrite, the curses.h file would be +dnl in an ncurses subdirectory (e.g., /usr/include/ncurses), but someone may +dnl have installed overwriting the vendor's curses. Only very old versions +dnl (pre-1.9.2d, the first autoconf'd version) of ncurses don't define +dnl either __NCURSES_H or NCURSES_VERSION in the header. +dnl +dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header +dnl is already in the include-path, don't even bother with this, since we cannot +dnl easily determine which file it is. In this case, it has to be <curses.h>. +dnl +AC_DEFUN([CF_NCURSES_CPPFLAGS], +[ +AC_MSG_CHECKING(for ncurses header file) +AC_CACHE_VAL(cf_cv_ncurses_header,[ + AC_TRY_COMPILE([#include <curses.h>], + [printf("%s\n", NCURSES_VERSION)], + [cf_cv_ncurses_header=predefined],[ + CF_HEADER_PATH(cf_search,ncurses) + test -n "$verbose" && echo + for cf_incdir in $cf_search + do + for cf_header in \ + curses.h \ + ncurses.h + do + if egrep "NCURSES" $cf_incdir/$cf_header >/dev/null 2>&1; then + cf_cv_ncurses_header=$cf_incdir/$cf_header + test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 + break + fi + test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 + done + test -n "$cf_cv_ncurses_header" && break + done + test -z "$cf_cv_ncurses_header" && AC_ERROR(not found) + ])]) +AC_MSG_RESULT($cf_cv_ncurses_header) +AC_DEFINE(NCURSES) + +changequote(,)dnl +cf_incdir=`echo $cf_cv_ncurses_header | sed -e 's:/[^/]*$::'` +changequote([,])dnl + +case $cf_cv_ncurses_header in # (vi +*/ncurses.h) + AC_DEFINE(NCURSESHEADER) + ;; +esac + +case $cf_cv_ncurses_header in # (vi +predefined) # (vi + ;; +*) + CF_ADD_INCDIR($cf_incdir) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Look for the ncurses library. This is a little complicated on Linux, +dnl because it may be linked with the gpm (general purpose mouse) library. +dnl Some distributions have gpm linked with (bsd) curses, which makes it +dnl unusable with ncurses. +AC_DEFUN([CF_NCURSES_LIBS], +[AC_CHECK_FUNC(initscr,,[ +AC_REQUIRE([CF_NCURSES_CPPFLAGS]) +cf_save_LIBS="$LIBS" +case $cf_cv_ncurses_header in +*/ncurses.h) # (vi + cf_header=ncurses.h + ;; +*) # (vi + cf_header=curses.h + ;; +esac +AC_CHECK_LIB(gpm,Gpm_Open,[ + AC_CHECK_LIB(gpm,initscr,[ + # don't try to link with gpm, since it contains curses + AC_CHECK_LIB(ncurses,initscr) + ],[ + AC_MSG_CHECKING(if ncurses needs -lgpm to link) + LIBS="-lncurses $cf_save_LIBS" + AC_TRY_LINK([#include <$cf_header>], + [initscr()], + [cf_need_gpm=no], + [LIBS="-lncurses -lgpm $cf_save_LIBS" + AC_TRY_LINK([#include <$cf_header>], + [initscr()], + [cf_need_gpm=yes], + [AC_ERROR(cannot link -lncurses)])]) + AC_MSG_RESULT($cf_need_gpm) + ])], + [AC_CHECK_LIB(ncurses,initscr)]) +])]) +dnl --------------------------------------------------------------------------- +dnl After checking for functions in the default $LIBS, make a further check +dnl for the functions that are netlib-related (these aren't always in the +dnl libc, etc., and have to be handled specially because there are conflicting +dnl and broken implementations. +dnl Common library requirements (in order): +dnl -lresolv -lsocket -lnsl +dnl -lnsl -lsocket +dnl -lsocket +dnl -lbsd +AC_DEFUN([CF_NETLIBS],[ +NETLIBS="" +AC_CHECK_FUNC(gethostname,[AC_DEFINE(HAVE_GETHOSTNAME)],[ + AC_CHECK_LIB(nsl,gethostname, + [AC_DEFINE(HAVE_GETHOSTNAME) + NETLIBS="-lnsl $NETLIBS"], + AC_CHECK_LIB(socket,gethostname, + [AC_DEFINE(HAVE_GETHOSTNAME) + NETLIBS="-lsocket $NETLIBS"]), + [$NETLIBS])]) +AC_CHECK_FUNC(socket,[AC_DEFINE(HAVE_SOCKET)],[ + AC_CHECK_LIB(socket,socket, + [AC_DEFINE(HAVE_SOCKET) + NETLIBS="-lsocket $NETLIBS"], + AC_CHECK_LIB(bsd,socket, + [AC_DEFINE(HAVE_SOCKET) + NETLIBS="-lbsd $NETLIBS"]), + [$NETLIBS])]) +AC_CHECK_FUNC(gethostbyname,[AC_DEFINE(HAVE_GETHOSTBYNAME)],[ + AC_CHECK_LIB(nsl,gethostbyname, + [AC_DEFINE(HAVE_GETHOSTBYNAME) + NETLIBS="-lnsl $NETLIBS"],, + [$NETLIBS])]) +AC_CHECK_FUNC(strcasecmp,[AC_DEFINE(HAVE_STRCASECMP)],[ + AC_CHECK_LIB(resolv,strcasecmp, + [AC_DEFINE(HAVE_STRCASECMP) + NETLIBS="-lresolv $NETLIBS"],, + [$NETLIBS])]) +LIBS="$LIBS $NETLIBS" +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for a given program, defining corresponding symbol. +dnl $1 = environment variable, which is suffixed by "_PATH" in the #define. +dnl $2 = program name to find. +dnl +dnl If there is more than one token in the result, #define the remaining tokens +dnl to $1_ARGS. We need this for 'install' in particular. +dnl +dnl FIXME: we should allow this to be overridden by environment variables +dnl +AC_DEFUN([CF_PATH_PROG],[ +test -z "[$]$1" && $1=$2 +if test "$with_full_paths" = yes ; then + AC_PATH_PROG($1,$2,[$]$1) +else + AC_MSG_CHECKING(for $2) + AC_MSG_RESULT([$]$1) +fi + +cf_path_prog="" +cf_path_args="" +IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}:" +for cf_temp in $ac_cv_path_$1 +do + if test -z "$cf_path_prog" ; then + cf_path_prog="$cf_temp" + elif test -z "$cf_path_args" ; then + cf_path_args="$cf_temp" + else + cf_path_args="$cf_path_args $cf_temp" + fi +done +IFS="$cf_save_ifs" + +AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog") +test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args") +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for broken definition of 'remove()'. This is (in particular) broken +dnl on the older version of SCO (I'd cite version if I knew where to look) by +dnl having <stdio.h> #define remove to __unlink, which appears in no library. +dnl +dnl Fortuitously, we can combine this with a more general test: do we have +dnl 'unlink()' but no 'remove()'. Note, however, that we cannot simply #define +dnl remove to unlink, but have to make a fallback function. +dnl +AC_DEFUN([CF_REMOVE_BROKEN], +[ +AC_MSG_CHECKING(for broken/missing definition of remove) +AC_CACHE_VAL(cf_cv_baddef_remove,[ +AC_TRY_LINK( + [#include <stdio.h>], + [remove("dummy")], + [cf_cv_baddef_remove=no], + [AC_TRY_LINK( + [#include <stdio.h> + int __unlink(name) { return unlink(name); } ], + [remove("dummy")], + [cf_cv_baddef_remove=yes], + [cf_cv_baddef_remove=unknown]) + ]) +]) +AC_MSG_RESULT($cf_cv_baddef_remove) +test "$cf_cv_baddef_remove" = yes && AC_DEFINE(NEED_REMOVE) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for definitions & structures needed for window size-changing +dnl FIXME: check that this works with "snake" (HP-UX 10.x) +AC_DEFUN([CF_SIZECHANGE], +[ +AC_MSG_CHECKING([declaration of size-change]) +AC_CACHE_VAL(cf_cv_sizechange,[ + cf_cv_sizechange=unknown + cf_save_CFLAGS="$CFLAGS" + +for cf_opts in "" "NEED_PTEM_H" +do + + CFLAGS="$cf_save_CFLAGS" + test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" + AC_TRY_COMPILE([#include <sys/types.h> +#if HAVE_TERMIOS_H +#include <termios.h> +#endif +#if NEED_PTEM_H +/* This is a workaround for SCO: they neglected to define struct winsize in + * termios.h -- it's only in termio.h and ptem.h + */ +#include <sys/stream.h> +#include <sys/ptem.h> +#endif +#if !defined(sun) || !defined(HAVE_TERMIOS_H) +#include <sys/ioctl.h> +#endif +],[ +#ifdef TIOCGSIZE + struct ttysize win; /* FIXME: what system is this? */ + int y = win.ts_lines; + int x = win.ts_cols; +#else +#ifdef TIOCGWINSZ + struct winsize win; + int y = win.ws_row; + int x = win.ws_col; +#else + no TIOCGSIZE or TIOCGWINSZ +#endif /* TIOCGWINSZ */ +#endif /* TIOCGSIZE */ + ], + [cf_cv_sizechange=yes], + [cf_cv_sizechange=no]) + + CFLAGS="$cf_save_CFLAGS" + if test "$cf_cv_sizechange" = yes ; then + test -n "$cf_opts" && AC_DEFINE($cf_opts) + break + fi +done + ]) +AC_MSG_RESULT($cf_cv_sizechange) +test $cf_cv_sizechange = no && AC_DEFINE(HAVE_SIZECHANGE) +])dnl +dnl --------------------------------------------------------------------------- +dnl Look for the slang header files in the standard places, adjusting the +dnl CPPFLAGS variable. +dnl +AC_DEFUN([CF_SLANG_CPPFLAGS], +[ +AC_MSG_CHECKING(for slang header file) +AC_CACHE_VAL(cf_cv_slang_header,[ + CF_HEADER_PATH(cf_search,slang) + for cf_incdir in $cf_search + do + for cf_header in \ + slang.h + do + if egrep "SLANG_VERSION" $cf_incdir/$cf_header >/dev/null 2>&1; then + cf_cv_slang_header=$cf_incdir/$cf_header + break + fi + done + test -n "$cf_cv_slang_header" && break + done + test -z "$cf_cv_slang_header" && AC_ERROR(not found) + ]) +AC_MSG_RESULT($cf_cv_slang_header) +AC_DEFINE(USE_SLANG) +changequote(,)dnl +cf_incdir=`echo $cf_cv_slang_header | sed -e 's:/[^/]*$::'` +changequote([,])dnl +CF_ADD_INCDIR($cf_incdir) +])dnl +dnl --------------------------------------------------------------------------- +dnl Look for the slang library (it needs the math-library because it uses +dnl trig functions). +AC_DEFUN([CF_SLANG_LIBS], +[ + AC_CHECK_FUNC(SLtt_get_screen_size,,[ + AC_CHECK_LIB(slang,SLtt_get_screen_size, + [LIBS="-lslang $LIBS"], + [AC_CHECK_LIB(slang,SLtt_get_screen_size, + [LIBS="-lslang -lm $LIBS"], + AC_ERROR(cannot link -lslang),"-lm")])]) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for declaration of sys_errlist in one of stdio.h and errno.h. +dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration. +dnl Reported by Keith Bostic. +AC_DEFUN([CF_SYS_ERRLIST], +[ +AC_MSG_CHECKING([declaration of sys_errlist]) +AC_CACHE_VAL(cf_cv_dcl_sys_errlist,[ + AC_TRY_COMPILE([ +#include <stdio.h> +#include <sys/types.h> +#include <errno.h> ], + [char *c = (char *) *sys_errlist], + [cf_cv_dcl_sys_errlist=yes], + [cf_cv_dcl_sys_errlist=no])]) +AC_MSG_RESULT($cf_cv_dcl_sys_errlist) +test $cf_cv_dcl_sys_errlist = no && AC_DEFINE(DECL_SYS_ERRLIST) +])dnl +dnl --------------------------------------------------------------------------- +AC_DEFUN([CF_SYSTEM_MAIL_FLAGS], +[ +AC_MSG_CHECKING([system mail flags]) +AC_CACHE_VAL(cf_cv_system_mail_flags,[ + case $cf_cv_SYSTEM_MAIL in + */mmdf/*) + [cf_cv_system_mail_flags="-mlruxto,cc\\\\*"] + ;; + *) + [cf_cv_system_mail_flags="-t -oi"] + esac + ]) +AC_MSG_RESULT($cf_cv_system_mail_flags) +AC_DEFINE_UNQUOTED(SYSTEM_MAIL_FLAGS, "$cf_cv_system_mail_flags") +])dnl +dnl --------------------------------------------------------------------------- +dnl Look for termcap libraries, needed by some versions of slang. +AC_DEFUN([CF_TERMCAP_LIBS], +[ +AC_CACHE_VAL(cf_cv_lib_termcap,[ +cf_cv_lib_termcap=none +# HP-UX 9.x terminfo has setupterm, but no tigetstr. +if test "$termlib" = none; then + AC_CHECK_LIB(termlib, tigetstr, [LIBS="$LIBS -ltermlib" cf_cv_lib_termcap=terminfo]) +fi +if test "$cf_cv_lib_termcap" = none; then + AC_CHECK_LIB(termlib, tgoto, [LIBS="$LIBS -ltermlib" cf_cv_lib_termcap=termcap]) +fi +if test "$cf_cv_lib_termcap" = none; then + # allow curses library for broken AIX system. + AC_CHECK_LIB(curses, initscr, [LIBS="$LIBS -lcurses" cf_cv_lib_termcap=termcap]) + AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" cf_cv_lib_termcap=termcap]) +fi +if test "$cf_cv_lib_termcap" = none; then + AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" cf_cv_lib_termcap=termcap]) +fi +if test "$cf_cv_lib_termcap" = none; then + AC_CHECK_LIB(ncurses, tgoto, [LIBS="$LIBS -lncurses" cf_cv_lib_termcap=ncurses]) +fi +]) +if test "$cf_cv_lib_termcap" = none; then + AC_ERROR([Can't find -ltermlib, -lcurses, or -ltermcap]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if including both termio.h and termios.h die like on DG.UX +AC_DEFUN([CF_TERMIO_AND_TERMIOS], +[ +AC_MSG_CHECKING([termio.h and termios.h]) +AC_CACHE_VAL(cf_cv_termio_and_termios,[ + AC_TRY_COMPILE([ +#if HAVE_TERMIO_H +#include <termio.h> +#endif +#if HAVE_TERMIOS_H +#include <termios.h> +#endif ], + [putchar (0x0a)], + [cf_cv_termio_and_termios=yes], + [cf_cv_termio_and_termios=no])]) +AC_MSG_RESULT($cf_cv_termio_and_termios) +test $cf_cv_termio_and_termios = no && AC_DEFINE(TERMIO_AND_TERMIOS) +])dnl +dnl --------------------------------------------------------------------------- +AC_DEFUN([CF_TTYTYPE], +[ +AC_MSG_CHECKING(if ttytype is declared in curses library) +AC_CACHE_VAL(cf_cv_have_ttytype,[ + AC_TRY_LINK([#include <curses.h>], + [char *x = &ttytype[1]], + [cf_cv_have_ttytype=yes], + [cf_cv_have_ttytype=no]) + ]) +AC_MSG_RESULT($cf_cv_have_ttytype) +test $cf_cv_have_ttytype = yes && AC_DEFINE(HAVE_TTYTYPE) +]) +dnl --------------------------------------------------------------------------- +dnl Make an uppercase version of a variable +dnl $1=uppercase($2) +AC_DEFUN([CF_UPPER], +[ +changequote(,)dnl +$1=`echo $2 | tr '[a-z]' '[A-Z]'` +changequote([,])dnl +])dnl +dnl --------------------------------------------------------------------------- +AC_DEFUN([CF_UTMP], +[ +AC_MSG_CHECKING(if struct utmp is declared) +AC_CACHE_VAL(cf_cv_have_utmp,[ + AC_TRY_COMPILE([#include <utmp.h>], + [struct utmp x; char *y = &x.ut_host[0]], + [cf_cv_have_utmp=yes], + [AC_TRY_COMPILE([#include <utmpx.h>], + [struct utmpx x; char *y = &x.ut_host[0]], + [cf_cv_have_utmp=utmpx], + [cf_cv_have_utmp=no]) + ]) + ]) +AC_MSG_RESULT($cf_cv_have_utmp) +test $cf_cv_have_utmp != no && AC_DEFINE(HAVE_UTMP) +test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP) +]) |