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
83 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
84 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
86 dnl Test if /bin/sh supports 'set -h'
87 AC_CACHE_CHECK([for set -h], unet_cv_sys_set_h,
88 [echo "set -h; exit $?" > conftest ;
89 $SHPROG ./conftest 2> conftest.out
90 ac_err=`grep -v '^ *+' conftest.out`
91 if test -z "$ac_err"; then
96 $RMPROG -fr conftest*])
97 dnl Used in Configure.
98 AC_SUBST(unet_cv_sys_set_h)
103 dnl Add -pipe when possible
106 dnl Used in config-sh.
107 AC_SUBST(ac_cv_header_poll_h)
108 AC_SUBST(ac_cv_header_syslog_h)
109 AC_SUBST(unet_cv_func_poll_syscall)
111 dnl Check OS for os_dep files.
113 AC_MSG_CHECKING(for OS type)
116 AC_MSG_RESULT($uname found.)
120 AC_MSG_RESULT($uname found.)
121 OSDEP_C="os_solaris.c"
124 AC_MSG_RESULT($uname found.)
125 OSDEP_C="os_solaris.c"
128 AC_MSG_RESULT($uname found.)
132 AC_MSG_RESULT(Unknown OS. Using generic routines.)
133 OSDEP_C="os_generic.c"
138 dnl Finally really generate all output files:
139 AC_OUTPUT(config-sh Configure ../Makefile ../ircd/Makefile ../doc/Makefile Makefile, [echo timestamp > stamp-h;],)