1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (c) 1997, by Carlo Wood <carlo@runaway.xs4all.nl>
5 dnl Make sure we are in the correct directory (someone could have run
6 dnl 'configure' with a wrong '--srcdir'); Note that a bug in autoconf
7 dnl forces us to have srcdir == dir where configure resides (config):
10 dnl 'configure' must be run from within 'config/'.
13 dnl Define the input and output configuration header file,
14 dnl (Generate config/setup.h from config/setup.h.in):
15 AC_CONFIG_HEADER(setup.h)
17 dnl Demand at least version 2.13 of autoconf
20 dnl This should be done early.
24 dnl Allow the use of BSD functions on AIX.
26 dnl Allow the use of POSIX functions on several OS.
29 dnl ANSIfy the C compiler whenever possible.
31 dnl Use -O3 instead of -O2.
32 if test "$CFLAGS" != "" ; then
33 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O2/-O3/'`
35 dnl Remove -pipe during configure
36 if test "$CFLAGS" != "" ; then
37 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
40 dnl Checks for libraries.
41 AC_CHECK_LIB(c, crypt, [true],
42 AC_CHECK_LIB(descrypt, crypt, LIBS="-ldescrypt $LIBS",
43 AC_CHECK_LIB(crypt, crypt)))
44 AC_CHECK_LIB(c, gethostbyname, [true],
45 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="-lnsl $LIBS"))
46 dnl IRIX has -lsocket, but doesn't need it.
47 AC_CHECK_LIB(c, socket, [true],
48 AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS"))
51 dnl Checks for header files.
54 AC_CHECK_HEADERS(malloc.h sys/malloc.h fcntl.h string.h strings.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h memory.h errno.h net/errno.h sys/cdefs.h)
56 dnl Checks for typedefs, structures, and compiler characteristics.
65 dnl Define SIZE_T_FMT and TIME_T_FMT to be the printf format for
66 dnl respectively size_t and time_t.
67 unet_DEFINE_SIZE_T_FMT
68 unet_DEFINE_TIME_T_FMT
70 dnl Checks for library functions.
71 AC_PROG_GCC_TRADITIONAL
73 AC_FUNC_SETVBUF_REVERSED
76 AC_CHECK_FUNCS(strchr memcpy memmove)
77 AC_CHECK_FUNCS(gethostname gettimeofday mkdir strerror strtoken)
78 AC_CHECK_FUNCS(select socket uname)
79 AC_CHECK_FUNCS(setrlimit inet_netof getrusage times res_init)
81 dnl Do we have a system call poll?
82 unet_FUNC_POLL_SYSCALL
84 dnl Do we have restarting syscalls ?
85 AC_SYS_RESTARTABLE_SYSCALLS
92 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
93 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
95 dnl Test if /bin/sh supports 'set -h'
96 AC_CACHE_CHECK([for set -h], unet_cv_sys_set_h,
97 [echo "set -h; exit $?" > conftest ;
98 $SHPROG ./conftest 2> conftest.out
99 ac_err=`grep -v '^ *+' conftest.out`
100 if test -z "$ac_err"; then
101 unet_cv_sys_set_h=yes
105 $RMPROG -fr conftest*])
106 dnl Used in Configure.
107 AC_SUBST(unet_cv_sys_set_h)
112 dnl Add -pipe when possible
115 dnl Used in config-sh.
116 AC_SUBST(ac_cv_header_poll_h)
117 AC_SUBST(ac_cv_header_syslog_h)
118 AC_SUBST(unet_cv_func_poll_syscall)
120 dnl Finally really generate all output files:
121 AC_OUTPUT(config-sh Configure ../Makefile ../ircd/Makefile ../doc/Makefile Makefile, [echo timestamp > stamp-h;],)