dnl process this file with GNU autoconf to produce a configure script.
dnl
dnl jmason 23 dec 94 -- fixed union wait and sys_errlist checks
dnl Patrick Powell Fri Jul 7 21:08:48 PDT 1995
dnl $Id: configure.in,v 2.2 1997/02/05 22:35:25 papowell Exp $
dnl Original version from PLP4.0 Release
dnl use old-style shared libs if we have 'em.
AC_CHECK_LIB(socket_s, socket, [LIBS="$LIBS -lsocket_s"; have_socket=1], ,-lnsl)
if test -z "$have_socket"; then
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"], , -lnsl)
fi
AC_CHECK_LIB(nsl_s, gethostbyaddr, [LIBS="$LIBS -lnsl_s"; have_nsl=1])
if test -z "$have_nsl"; then
AC_CHECK_LIB(nsl, gethostbyaddr, [LIBS="$LIBS -lnsl"])
fi
AC_CHECK_LIB(net_s, gethostbyaddr, [LIBS="$LIBS -lnet_s"; have_net=1])
if test -z "$have_net"; then
AC_CHECK_LIB(net, gethostbyaddr, [LIBS="$LIBS -lnet"])
fi
dnl this should solve problems of missing termlib, termcap
dnl libraries. Note that there may be some conflicts if both
dnl termcap and termlib are both included, but this is not
dnl supposed to be the case - only one will get resolved
TERMLIB=
AC_CHECK_LIB(termlib, tgetent, [LIBS="$LIBS -ltermlib"; TERMLIB=yes])
if test -z "$TERMLIB" ; then
AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap"; TERMLIB=yes])
fi;
if test -z "$TERMLIB" ; then
AC_CHECK_LIB(curses, tgetent, [LIBS="$LIBS -lcurses"; TERMLIB=yes])
fi;
fi
dnl **** end library checks
if test ! "$ac_cv_func_setreuid" = yes -a ! "$ac_cv_func_seteuid" = yes -a ! "$ac_cv_func_setresuid" = yes; then
echo "WARNING: missing setreuid(), seteuid(), and setresuid()"
fi
AC_MSG_CHECKING(how to manipulate tty attributes)
AC_CACHE_VAL(ac_cv_struct_term,
[
if test "$ac_cv_header_termios_h" = yes; then
ac_cv_struct_term=termios
fi
if test "$ac_cv_header_sys_termios_h" = yes; then
ac_cv_struct_term=termios
fi
dnl test to see if we need to compile
if test -z "$ac_cv_struct_term" ; then
AC_TRY_COMPILE([
#ifdef HAVE_TERMIO_H
#include <termio.h>
#endif
#ifdef HAVE_SYS_TERMIO_H
#include <sys/termio.h>
#endif],[struct termio t;t.c_iflag = 0],
ac_cv_struct_term=termio)
fi
dnl now you have determined if you have termio
if test -z "$ac_cv_struct_term" ; then
AC_TRY_COMPILE([#include <sgtty.h>],[
struct sgttyb s;s.sg_flags = 0],
ac_cv_struct_term=sgttyb)
fi
if test -z "$ac_cv_struct_term" ; then
ac_cv_struct_term=UNDEFINED
fi
])
AC_MSG_RESULT(using $ac_cv_struct_term)
if test "$ac_cv_struct_term" = "sgttyb"; then
AC_DEFINE(USE_SGTTYB)
AC_DEFINE(USE_STTY,SGTTYB)
fi
if test "$ac_cv_struct_term" = "termio"; then
AC_DEFINE(USE_TERMIO)
AC_DEFINE(USE_STTY,TERMIO)
fi
if test "$ac_cv_struct_term" = "termios"; then
AC_DEFINE(USE_TERMIOS)
AC_DEFINE(USE_STTY,TERMIOS)
fi
AC_MSG_CHECKING(checking for struct exec)
AC_CACHE_VAL(ac_cv_struct_exec,
[
ac_cv_struct_exec=no
if test "$ac_cv_header_a_out_h" != no ; then
AC_TRY_COMPILE([
#include <sys/types.h>
#include <a.out.h>],[struct exec b; b.a_text = 0],
ac_cv_struct_exec=yes, ac_cv_struct_exec=no )
fi
])
AC_MSG_RESULT($ac_cv_struct_exec)
if test $ac_cv_struct_exec = yes; then
AC_DEFINE(HAVE_STRUCT_EXEC)
fi
dnl do this check if statvfs is a valid function
if test "$ac_cv_func_statvfs" != no ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
# include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif],[struct statvfs s; statvfs ("/", &s); return(s.f_bavail+s.f_bsize)],
fstype=statvfs)
fi #}
dnl do these checks if statfs is a valid function
if test "$ac_cv_func_statfs" != no ; then #{
if test -z "$fstype" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
# include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif],[struct fs_data s; return(s.fd_bfree+s.fd_bsize)],
fstype=Ultrix-statfs)
fi #}
if test -z "$fstype" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif],[struct statfs s; return(s.f_bavail+s.f_bsize)],
fstype=statfs)
fi # }
if test -z "$fstype" ; then # {
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif],[struct statfs s; return(s.f_bfree+s.f_bsize)],
fstype=SVR3-statfs)
fi # }
fi # }
if test -z "$fstype" ; then
echo "cannot find a valid statfs-like structure!"
fstype=UNKNOWN
fi
ac_cv_struct_fstype=$fstype
])
AC_MSG_RESULT(using $ac_cv_struct_fstype)
if test "$ac_cv_struct_fstype" = SVR3-statfs; then
AC_DEFINE(USE_STATFS_TYPE,SVR3_STATFS)
fi
if test "$ac_cv_struct_fstype" = Ultrix-statfs; then
AC_DEFINE(USE_STATFS_TYPE,ULTRIX_STATFS)
fi
if test "$ac_cv_struct_fstype" = statfs; then
AC_DEFINE(USE_STATFS_TYPE,STATFS)
fi
if test "$ac_cv_struct_fstype" = statvfs; then
AC_DEFINE(USE_STATFS_TYPE,STATVFS)
fi
dnl ----------------------------------------------------------------------------
dnl
AC_MSG_CHECKING(for errno declaration)
AC_CACHE_VAL(ac_cv_decl_errno,
[AC_TRY_COMPILE([#include <errno.h>
#include <stdio.h>],[printf("%d",errno);],
ac_cv_decl_errno=yes, ac_cv_decl_errno=no)
])
AC_MSG_RESULT($ac_cv_decl_errno)
if test $ac_cv_decl_errno = yes; then
AC_DEFINE(HAVE_ERRNO_DECL)
fi;
AC_MSG_CHECKING(for sys_nerr)
AC_CACHE_VAL(ac_cv_decl_sys_nerr,
[AC_TRY_LINK(,[extern int sys_nerr; return (sys_nerr);],
ac_cv_decl_sys_nerr=yes, ac_cv_decl_sys_nerr=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_nerr)
if test $ac_cv_decl_sys_nerr = yes; then
AC_DEFINE(HAVE_SYS_NERR)
fi;
AC_MSG_CHECKING(for sys_nerr declaration)
AC_CACHE_VAL(ac_cv_decl_sys_nerr_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%d",sys_nerr);],
ac_cv_decl_sys_nerr_def=yes, ac_cv_decl_sys_nerr_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_nerr_def)
if test $ac_cv_decl_sys_nerr_def = yes; then
AC_DEFINE(HAVE_SYS_NERR_DEF)
fi
AC_MSG_CHECKING(for sys_errlist array)
AC_CACHE_VAL(ac_cv_decl_sys_errlist,
[AC_TRY_LINK(,[extern char *sys_errlist[];
sys_errlist[0];],
ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_errlist)
if test $ac_cv_decl_sys_errlist = yes; then
AC_DEFINE(HAVE_SYS_ERRLIST)
fi
AC_MSG_CHECKING(for sys_errlist declaration)
AC_CACHE_VAL(ac_cv_decl_sys_errlist_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%s",sys_errlist[0]);],
ac_cv_decl_sys_errlist_def=yes, ac_cv_decl_sys_errlist_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_errlist_def)
if test $ac_cv_decl_sys_errlist_def = yes; then
AC_DEFINE(HAVE_SYS_ERRLIST_DEF)
fi
AC_MSG_CHECKING(for setproctitle declaration)
AC_CACHE_VAL(ac_cv_decl_setproctitle_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%s",setproctitle);],
ac_cv_decl_setproctitle_def=yes, ac_cv_decl_setproctitle_def=no)
])
AC_MSG_RESULT($ac_cv_decl_setproctitle_def)
if test $ac_cv_decl_setproctitle_def = yes; then
AC_DEFINE(HAVE_SETPROCTITLE_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl sys_siglist array (list of signals)
AC_MSG_CHECKING(for sys_siglist array)
AC_CACHE_VAL(ac_cv_decl_sys_siglist,
[AC_TRY_LINK(,[extern char *sys_siglist[]; printf("%s",sys_siglist[0]);],
ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_siglist)
if test $ac_cv_decl_sys_siglist = yes; then
AC_DEFINE(HAVE_SYS_SIGLIST)
fi
AC_MSG_CHECKING(for sys_siglist declaration)
AC_CACHE_VAL(ac_cv_decl_sys_siglist_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>],[printf("%s",sys_siglist[0]);],
ac_cv_decl_sys_siglist_def=yes, ac_cv_decl_sys_siglist_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_siglist_def)
if test $ac_cv_decl_sys_siglist_def = yes; then
AC_DEFINE(HAVE_SYS_SIGLIST_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl check to see if you have getpgrp(0) or getpgrp()
dnl
dnl POSIX `getpgrp(void)' define HAVE_GETPGRP_0
dnl BSD `getpgrp(int)' - takes 0 as argument
dnl define HAVE_GETPGRP_0 0
dnl check to see if you have getpgrp(0) or getpgrp()
AC_MSG_CHECKING(for getprgp() or getpgrp(0) form)
AC_CACHE_VAL(ac_cv_func_getpgrp_0,
[AC_TRY_COMPILE([
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif],[getpgrp(0);],
ac_cv_func_getpgrp_0=getpgrp_0, ac_cv_func_getpgrp_0=getpgrp)
])
AC_MSG_RESULT($ac_cv_func_getpgrp_0)
if test "$ac_cv_func_getpgrp_0" = getpgrp_0; then
AC_DEFINE(HAVE_GETPGRP_0,0)
else
AC_DEFINE(HAVE_GETPGRP_0,)
fi
dnl ----------------------------------------------------------------------------
dnl check to see if you have setpgrp(n,m) or setpgrp()
AC_MSG_CHECKING(for setprgp form)
AC_CACHE_VAL(ac_cv_func_setpgrp_0,
[AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
],[setpgrp(0,0);],
ac_cv_func_setpgrp_0=setpgrp_0, ac_cv_func_setpgrp_0=setpgrp)
])
AC_MSG_RESULT($ac_cv_func_setpgrp_0)
if test $ac_cv_func_setpgrp_0 = setpgrp_0; then
AC_DEFINE(HAVE_SETPGRP_0)
fi
dnl ----------------------------------------------------------------------------
dnl just for (really) backwards compatibility
dnl we really try not to use union wait -- it's heinously unportable.
dnl nicked this check from Tcl as well. ;)
dnl
dnl The check below checks whether <sys/wait.h> defines the type
dnl "union wait" correctly. It's needed because of weirdness in
dnl HP-UX where "union wait" is defined in both the BSD and SYS-V
dnl environments. Checking the usability of WIFEXITED seems to do
dnl the trick.
AC_MSG_CHECKING(for obsolete union wait compatibility)
AC_CACHE_VAL(ac_cv_unionwait,
[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/wait.h>], [union wait x;WIFEXITED(x);],
ac_cv_unionwait=yes, ac_cv_unionwait=no)
])
AC_MSG_RESULT($ac_cv_unionwait)
if test $ac_cv_unionwait = yes; then
AC_DEFINE(HAVE_UNION_WAIT)
fi
dnl ----------------------------------------------------------------------------
dnl Would you believe the gethostname declarations are broken on some machines
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for gethostname declaration)
AC_CACHE_VAL(ac_cv_decl_gethostname_def,
[AC_TRY_COMPILE([
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%d",gethostname);],
ac_cv_decl_gethostname_def=yes, ac_cv_decl_gethostname_def=no)
])
AC_MSG_RESULT($ac_cv_decl_gethostname_def)
if test $ac_cv_decl_gethostname_def = yes; then
AC_DEFINE(HAVE_GETHOSTNAME_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl tgetstr definitions are missing
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for tgetstr declaration)
AC_CACHE_VAL(ac_cv_decl_tgetstr_def,
[AC_TRY_COMPILE([
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_TERM_H
#include <term.h>
#endif],[printf("%d",tgetstr);],
ac_cv_decl_tgetstr_def=yes, ac_cv_decl_tgetstr_def=no)
if test $ac_cv_decl_tgetstr_def != yes; then
AC_TRY_COMPILE([
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_CURSES_H
#include <curses.h>
#endif],[printf("%d",tgetstr);],
ac_cv_decl_tgetstr_def=yes, ac_cv_decl_tgetstr_def=no)
fi
])
AC_MSG_RESULT($ac_cv_decl_tgetstr_def)
if test $ac_cv_decl_tgetstr_def = yes; then
AC_DEFINE(HAVE_TGETSTR_DEF)
fi
AC_MSG_CHECKING(for struct in6_addr declaration)
AC_CACHE_VAL(ac_cv_decl_in6_addr_def,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[struct in6_addr v;],
ac_cv_decl_in6_addr_def=yes, ac_cv_decl_in6_addr_def=no)
])
AC_MSG_RESULT($ac_cv_decl_in6_addr_def)
if test $ac_cv_decl_in6_addr_def = yes; then
AC_DEFINE(IN6_ADDR)
fi
AC_MSG_CHECKING(for struct in_addr6 declaration (LINUX))
AC_CACHE_VAL(ac_cv_decl_in_addr6_def,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[struct in_addr6 v;],
ac_cv_decl_in_addr6_def=yes, ac_cv_decl_in_addr6_def=no)
])
AC_MSG_RESULT($ac_cv_decl_in_addr6_def)
if test "$ac_cv_decl_in_addr6_def" = yes; then
AC_DEFINE(IN_ADDR6)
fi
dnl ----------------------------------------------------------------------------
dnl struct stat can have a st_mtime_nsec field
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for struct stat has mtimespec.ts_nsec or mtimespec.ts_nsec)
AC_CACHE_VAL(ac_cv_decl_st_mtime_nsec_def,
[AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtimespec.ts_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtimespec.ts_nsec)
])
if test -z "$ac_cv_decl_st_mtime_nsec_def" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtime_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtime_nsec )
fi #}
if test -z "$ac_cv_decl_st_mtime_nsec_def" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtim.tv_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtim.tv_nsec )
fi #}
if test -z "$ac_cv_decl_st_mtime_nsec_def"; then
ac_cv_decl_st_mtime_nsec_def=no
fi
AC_MSG_RESULT($ac_cv_decl_st_mtime_nsec_def)
if test ! "$ac_cv_decl_st_mtime_nsec_def" = no; then
AC_DEFINE_UNQUOTED(ST_MTIME_NSEC,$ac_cv_decl_st_mtime_nsec_def)
fi
dnl ----------------------------------------------------------------------------
dnl make stuff:
dnl ----------------- force this to be Bourne Shell for now ---------------
AC_MSG_CHECKING(for shell)
SHELL=/bin/sh
AC_MSG_RESULT(using $SHELL (FORCED))