dnl acinclude.m4 -- Extra macros needed for GNU make. dnl dnl Automake will incorporate this into its generated aclocal.m4. dnl --------------------------------------------------------------------------- dnl Got this from the lynx 2.8 distribution. dnl by T.E.Dickey dnl and Jim Spath dnl and Philippe De Muyter dnl dnl Created: 1997/1/28 dnl Updated: 1997/12/23 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],[ cf_test_netlibs=no AC_MSG_CHECKING(for network libraries) AC_CACHE_VAL(cf_cv_netlibs,[ AC_MSG_RESULT(working...) cf_cv_netlibs="" cf_test_netlibs=yes AC_CHECK_FUNCS(gethostname,,[ CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[ CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])]) # # FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but # I don't know the entrypoints - 97/7/22 TD AC_CHECK_LIB(inet,main,cf_cv_netlibs="-linet $cf_cv_netlibs") # if test "$ac_cv_func_lsocket" != no ; then AC_CHECK_FUNCS(socket,,[ CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[ CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])]) fi # AC_CHECK_FUNCS(gethostbyname,,[ CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)]) # AC_CHECK_FUNCS(strcasecmp,,[ CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)]) ]) LIBS="$LIBS $cf_cv_netlibs" test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG ])dnl dnl --------------------------------------------------------------------------- dnl Re-check on a function to see if we can pick it up by adding a library. dnl $1 = function to check dnl $2 = library to check in dnl $3 = environment to update (e.g., $LIBS) dnl $4 = what to do if this fails dnl dnl This uses 'unset' if the shell happens to support it, but leaves the dnl configuration variable set to 'unknown' if not. This is a little better dnl than the normal autoconf test, which gives misleading results if a test dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is dnl used (autoconf does not distinguish between a null token and one that is dnl set to 'no'). AC_DEFUN([CF_RECHECK_FUNC],[ AC_CHECK_LIB($2,$1,[ CF_UPPER(cf_tr_func,$1) AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func) ac_cv_func_$1=yes $3="-l$2 [$]$3"],[ ac_cv_func_$1=unknown unset ac_cv_func_$1 2>/dev/null $4], [[$]$3]) ])dnl 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 --------------------------------------------------------------------------- dnl Got this from the GNU tar 1.13.11 distribution dnl by Paul Eggert dnl --------------------------------------------------------------------------- dnl By default, many hosts won't let programs access large files; dnl one must use special compiler options to get large-file access to work. dnl For more details about this brain damage please see: dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html dnl Written by Paul Eggert . dnl Internal subroutine of AC_SYS_LARGEFILE. dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME) AC_DEFUN(AC_SYS_LARGEFILE_FLAGS, [AC_CACHE_CHECK([for $1 value to request large file support], ac_cv_sys_largefile_$1, [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2 then ac_cv_sys_largefile_$1=`cat conftest.1` else ac_cv_sys_largefile_$1=no ifelse($1, CFLAGS, [case "$host_os" in # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1. changequote(, )dnl hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) changequote([, ])dnl if test "$GCC" = yes; then ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ fi ;; # IRIX 6.2 and later require cc -n32. changequote(, )dnl irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) changequote([, ])dnl if test "$GCC" != yes; then ac_cv_sys_largefile_CFLAGS=-n32 fi esac if test "$ac_cv_sys_largefile_CFLAGS" != no; then ac_save_CC="$CC" CC="$CC $ac_cv_sys_largefile_CFLAGS" AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) CC="$ac_save_CC" fi]) fi rm -f conftest*])]) dnl Internal subroutine of AC_SYS_LARGEFILE. dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL) AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND, [case $2 in no) ;; ?*) case "[$]$1" in '') $1=$2 ;; *) $1=[$]$1' '$2 ;; esac ;; esac]) dnl Internal subroutine of AC_SYS_LARGEFILE. dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, [AC_CACHE_CHECK([for $1], $2, [$2=no changequote(, )dnl $4 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do case "$ac_flag" in -D$1) $2=1 ;; -D$1=*) $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; esac done changequote([, ])dnl ]) if test "[$]$2" != no; then AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) fi]) AC_DEFUN(AC_SYS_LARGEFILE, [AC_REQUIRE([AC_CANONICAL_HOST]) AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) if test "$enable_largefile" != no; then AC_CHECK_TOOL(GETCONF, getconf) AC_SYS_LARGEFILE_FLAGS(CFLAGS) AC_SYS_LARGEFILE_FLAGS(LDFLAGS) AC_SYS_LARGEFILE_FLAGS(LIBS) for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do case "$ac_flag" in no) ;; -D_FILE_OFFSET_BITS=*) ;; -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; -D_LARGE_FILES | -D_LARGE_FILES=*) ;; -D?* | -I?*) AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; *) AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; esac done AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, ac_cv_sys_file_offset_bits, [Number of bits in a file offset, on hosts where this is settable.], [case "$host_os" in # HP-UX 10.20 and later hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) ac_cv_sys_file_offset_bits=64 ;; esac]) AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, ac_cv_sys_largefile_source, [Define to make fseeko etc. visible, on some hosts.], [case "$host_os" in # HP-UX 10.20 and later hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) ac_cv_sys_largefile_source=1 ;; esac]) AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, ac_cv_sys_large_files, [Define for large files, on AIX-style hosts.], [case "$host_os" in # AIX 4.2 and later aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) ac_cv_sys_large_files=1 ;; esac]) fi ]) dnl --------------------------------------------------------------------------- dnl From Paul Eggert dnl Define HAVE_INTTYPES_H if exists, dnl doesn't clash with , and declares uintmax_t. AC_DEFUN(jm_AC_HEADER_INTTYPES_H, [ if test x = y; then dnl This code is deliberately never run via ./configure. dnl FIXME: this is a gross hack to make autoheader put an entry dnl for `HAVE_INTTYPES_H' in config.h.in. AC_CHECK_FUNCS(INTTYPES_H) fi AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, [AC_TRY_COMPILE( [#include #include ], [uintmax_t i = (uintmax_t) -1;], jm_ac_cv_header_inttypes_h=yes, jm_ac_cv_header_inttypes_h=no)]) if test $jm_ac_cv_header_inttypes_h = yes; then ac_kludge=HAVE_INTTYPES_H AC_DEFINE_UNQUOTED($ac_kludge) fi ]) dnl --------------------------------------------------------------------------- dnl From Paul Eggert AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC, [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim], ac_cv_struct_st_mtim_nsec, [ac_save_CPPFLAGS="$CPPFLAGS" ac_cv_struct_st_mtim_nsec=no # tv_nsec -- the usual case # _tv_nsec -- Solaris 2.6, if # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1 # && !defined __EXTENSIONS__) # st__tim.tv_nsec -- UnixWare 2.1.2 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val" AC_TRY_COMPILE([#include #include ], [struct stat s; s.st_mtim.ST_MTIM_NSEC;], [ac_cv_struct_st_mtim_nsec=$ac_val; break]) done CPPFLAGS="$ac_save_CPPFLAGS"]) if test $ac_cv_struct_st_mtim_nsec != no; then AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec) fi ] ) dnl --------------------------------------------------------------------------- dnl From Paul Eggert dnl Define uintmax_t to `unsigned long' or `unsigned long long' dnl if does not exist. AC_DEFUN(jm_AC_TYPE_UINTMAX_T, [ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) if test $jm_ac_cv_header_inttypes_h = no; then AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], [unsigned long long ullmax = (unsigned long long) -1; return ull << i | ull >> i | ullmax / ull | ullmax % ull;], ac_cv_type_unsigned_long_long=yes, ac_cv_type_unsigned_long_long=no)]) if test $ac_cv_type_unsigned_long_long = yes; then AC_DEFINE(uintmax_t, unsigned long long) else AC_DEFINE(uintmax_t, unsigned long) fi fi ]) dnl --------------------------------------------------------------------------- dnl From Steve Robbins dnl From a proposed change made on the autoconf list on 2 Feb 1999 dnl http://sourceware.cygnus.com/ml/autoconf/1999-02/msg00001.html dnl Patch for AIX 3.2 by Lars Hecking on 17 May 1999 AC_DEFUN(AC_FUNC_SELECT, [AC_CHECK_FUNCS(select) if test "$ac_cv_func_select" = yes; then AC_CHECK_HEADERS(unistd.h sys/types.h sys/time.h sys/select.h sys/socket.h) AC_MSG_CHECKING([argument types of select()]) AC_CACHE_VAL(ac_cv_type_fd_set_size_t,dnl [AC_CACHE_VAL(ac_cv_type_fd_set,dnl [for ac_cv_type_fd_set in 'fd_set' 'int' 'void'; do for ac_cv_type_fd_set_size_t in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_type_timeval in 'struct timeval' 'const struct timeval'; do AC_TRY_COMPILE(dnl [#ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif], [#ifdef __STDC__ extern select ($ac_cv_type_fd_set_size_t, $ac_cv_type_fd_set *, $ac_cv_type_fd_set *, $ac_cv_type_fd_set *, $ac_type_timeval *); #else extern select (); $ac_cv_type_fd_set_size_t s; $ac_cv_type_fd_set *p; $ac_type_timeval *t; #endif], [ac_found=yes ; break 3],ac_found=no) done done done ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL if test "$ac_found" = no; then AC_MSG_ERROR([can't determine argument types]) fi AC_MSG_RESULT([select($ac_cv_type_fd_set_size_t,$ac_cv_type_fd_set *,...)]) AC_DEFINE_UNQUOTED(fd_set_size_t, $ac_cv_type_fd_set_size_t) ac_cast= if test "$ac_cv_type_fd_set" != fd_set; then # Arguments 2-4 are not fd_set. Some weirdo systems use fd_set type for # FD_SET macros, but insist that you cast the argument to select. I don't # understand why that might be, but it means we cannot define fd_set. AC_EGREP_CPP(dnl changequote(<<,>>)dnl <<(^|[^a-zA-Z_0-9])fd_set[^a-zA-Z_0-9]>>dnl changequote([,]),dnl [#ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif],dnl # We found fd_set type in a header, need special cast ac_cast="($ac_cv_type_fd_set *)",dnl # No fd_set type; it is safe to define it AC_DEFINE_UNQUOTED(fd_set,$ac_cv_type_fd_set)) fi AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast) fi ]) # The following is taken from automake 1.4, # except that it prefers the compiler option -Ae to "-Aa -D_HPUX_SOURCE" # because only the former supports 64-bit integral types on HP-UX 10.20. ## ----------------------------------------- ## ## ANSIfy the C compiler whenever possible. ## ## From Franc,ois Pinard ## ## ----------------------------------------- ## # serial 2 # @defmac AC_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC # If the C compiler in not in ANSI C mode by default, try to add an option # to output variable @code{CC} to make it so. This macro tries various # options that select ANSI C on some system or another. It considers the # compiler to be in ANSI C mode if it handles function prototypes correctly. # # If you use this macro, you should check after calling it whether the C # compiler has been set to accept ANSI C; if not, the shell variable # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source # code in ANSI C, you can make an un-ANSIfied copy of it by using the # program @code{ansi2knr}, which comes with Ghostscript. # @end defmac AC_DEFUN(AM_PROG_CC_STDC, [AC_REQUIRE([AC_PROG_CC]) AC_BEFORE([$0], [AC_C_INLINE]) AC_BEFORE([$0], [AC_C_CONST]) dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require dnl a magic option to avoid problems with ANSI preprocessor commands dnl like #elif. dnl FIXME: can't do this because then AC_AIX won't work due to a dnl circular dependency. dnl AC_BEFORE([$0], [AC_PROG_CPP]) AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) AC_CACHE_VAL(am_cv_prog_cc_stdc, [am_cv_prog_cc_stdc=no ac_save_CC="$CC" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" AC_TRY_COMPILE( [#include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; ], [ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ], [am_cv_prog_cc_stdc="$ac_arg"; break]) done CC="$ac_save_CC" ]) if test -z "$am_cv_prog_cc_stdc"; then AC_MSG_RESULT([none needed]) else AC_MSG_RESULT($am_cv_prog_cc_stdc) fi case "x$am_cv_prog_cc_stdc" in x|xno) ;; *) CC="$CC $am_cv_prog_cc_stdc" ;; esac ]) dnl --------------------------------------------------------------------------- dnl Enable internationalization support for GNU make. dnl Obtained from the libit 0.7 distribution dnl AC_DEFUN(fp_WITH_GETTEXT, [ AC_MSG_CHECKING(whether NLS is wanted) AC_ARG_ENABLE(nls, [ --disable-nls disallow Native Language Support], enable_nls=$enableval, enable_nls=yes) AC_MSG_RESULT($enable_nls) use_nls=$enable_nls AM_CONDITIONAL(USE_NLS, test $use_nls = yes) if test $enable_nls = yes; then AC_DEFINE(ENABLE_NLS) AC_ARG_WITH(catgets, [ --with-catgets say that catgets is not supported], [AC_MSG_WARN([catgets not supported, --with-catgets ignored])]) AC_CHECK_FUNCS(gettext) AC_CHECK_LIB(intl, gettext, :) if test $ac_cv_lib_intl_gettext$ac_cv_func_gettext != nono; then AC_MSG_CHECKING(whether the included gettext is preferred) AC_ARG_WITH(included-gettext, [ --without-included-gettext avoid our provided version of gettext], with_included_gettext=$withval, with_included_gettext=yes) AC_MSG_RESULT($with_included_gettext) if test $with_included_gettext$ac_cv_func_gettext = nono; then LIBS="$LIBS -lintl" fi else with_included_gettext=yes fi if test $with_included_gettext = yes; then LIBOBJS="$LIBOBJS gettext.o" AC_DEFINE(HAVE_GETTEXT) AC_DEFINE(HAVE_DCGETTEXT) else AC_CHECK_HEADERS(libintl.h) AC_CHECK_FUNCS(dcgettext gettext) fi AC_CHECK_HEADERS(locale.h) AC_CHECK_FUNCS(getcwd setlocale stpcpy) AM_LC_MESSAGES if test -z "$ALL_LINGUAS"; then AC_MSG_WARN(This package does not install translations yet.) else ac_items="$ALL_LINGUAS" for ac_item in $ac_items; do ALL_POFILES="$ALL_POFILES $ac_item.po" ALL_MOFILES="$ALL_MOFILES $ac_item.mo" done fi AC_SUBST(ALL_LINGUAS) AC_SUBST(ALL_POFILES) AC_SUBST(ALL_MOFILES) AC_MSG_CHECKING(which translations to install) if test -z "$LINGUAS"; then ac_print="$ALL_LINGUAS" MOFILES="$ALL_MOFILES" else ac_items="$LINGUAS" for ac_item in $ac_items; do case "$ALL_LINGUAS" in *$ac_item*) ac_print="$ac_print $ac_item" MOFILES="$MOFILES $ac_item.mo" ;; esac done fi AC_SUBST(MOFILES) if test -z "$ac_print"; then AC_MSG_RESULT(none) else AC_MSG_RESULT($ac_print) fi if test "x$prefix" = xNONE; then AC_DEFINE_UNQUOTED(LOCALEDIR, "$ac_default_prefix/share/locale") else AC_DEFINE_UNQUOTED(LOCALEDIR, "$prefix/share/locale") fi fi])