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.
28 dnl ANSIfy the C compiler whenever possible.
30 dnl Use -O3 instead of -O2.
31 if test "$CFLAGS" != "" ; then
32 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O2/-O3/'`
34 dnl Remove -pipe during configure
35 if test "$CFLAGS" != "" ; then
36 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
39 dnl Checks for libraries.
40 AC_CHECK_LIB(c, crypt, [true],
41 AC_CHECK_LIB(descrypt, crypt, LIBS="-ldescrypt $LIBS",
42 AC_CHECK_LIB(crypt, crypt)))
43 AC_CHECK_LIB(c, gethostbyname, [true],
44 AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="-lnsl $LIBS"))
45 dnl IRIX has -lsocket, but doesn't need it.
46 AC_CHECK_LIB(c, socket, [true],
47 AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS"))
50 dnl Checks for header files.
53 dnl Checks for typedefs, structures, and compiler characteristics.
62 dnl Define SIZE_T_FMT and TIME_T_FMT to be the printf format for
63 dnl respectively size_t and time_t.
64 unet_DEFINE_SIZE_T_FMT
65 unet_DEFINE_TIME_T_FMT
67 dnl Checks for library functions.
68 dnl AC_PROG_GCC_TRADITIONAL
72 dnl Do we have a system call poll?
73 unet_FUNC_POLL_SYSCALL
75 dnl Do we have restarting syscalls ?
76 AC_SYS_RESTARTABLE_SYSCALLS
78 dnl Check for required features for admins?
79 AC_MSG_CHECKING([for donuts])
87 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
88 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
90 dnl Test if /bin/sh supports 'set -h'
91 AC_CACHE_CHECK([for set -h], unet_cv_sys_set_h,
92 [echo "set -h; exit $?" > conftest ;
93 $SHPROG ./conftest 2> conftest.out
94 ac_err=`grep -v '^ *+' conftest.out`
95 if test -z "$ac_err"; then
100 $RMPROG -fr conftest*])
101 dnl Used in Configure.
102 AC_SUBST(unet_cv_sys_set_h)
107 dnl Add -pipe when possible
110 dnl Used in config-sh.
111 AC_SUBST(ac_cv_header_poll_h)
112 AC_SUBST(ac_cv_header_syslog_h)
113 AC_SUBST(unet_cv_func_poll_syscall)
115 dnl Check OS for os_dep files.
117 AC_MSG_CHECKING(for OS type)
120 AC_MSG_RESULT($uname found.)
124 AC_MSG_RESULT($uname found.)
125 OSDEP_C="os_solaris.c"
128 AC_MSG_RESULT($uname found.)
129 OSDEP_C="os_solaris.c"
132 AC_MSG_RESULT($uname found.)
133 OSDEP_C="os_openbsd.c"
136 AC_MSG_RESULT($uname found.)
140 AC_MSG_RESULT(Unknown OS. Using generic routines.)
141 OSDEP_C="os_generic.c"
146 dnl Finally really generate all output files:
147 AC_OUTPUT(config-sh Configure ../Makefile ../ircd/Makefile ../doc/Makefile Makefile, [echo timestamp > stamp-h;],)