Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / config / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl Copyright (c) 1997, by Carlo Wood <carlo@runaway.xs4all.nl>
4
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):
8 AC_INIT(config-sh.in)
9
10 dnl 'configure' must be run from within 'config/'.
11 AC_CONFIG_AUX_DIR(.)
12
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)
16
17 dnl Demand at least version 2.13 of autoconf
18 AC_PREREQ(2.13)
19
20 dnl This should be done early.
21 AC_PROG_CC
22
23 dnl UNIX Variants
24 dnl Allow the use of BSD functions on AIX.
25 dnl AC_AIX
26 dnl Allow the use of POSIX functions on several OS.
27 dnl AC_ISC_POSIX
28 dnl ANSIfy the C compiler whenever possible.
29 AM_PROG_CC_STDC
30 dnl Use -O3 instead of -O2.
31 if test "$CFLAGS" != "" ; then
32   CFLAGS=`echo "$CFLAGS" | sed -e 's/-O2/-O3/'`
33 fi
34 dnl Remove -pipe during configure
35 if test "$CFLAGS" != "" ; then
36   CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
37 fi
38
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"))
48 unet_CHECK_LIB_RESOLV
49
50 dnl Checks for header files.
51 AC_HEADER_STDC
52
53 dnl Checks for typedefs, structures, and compiler characteristics.
54 dnl AC_C_CONST
55 AC_C_BIGENDIAN
56 AC_TYPE_SIZE_T
57 AC_HEADER_TIME
58 AC_STRUCT_TM
59 AC_TYPE_UID_T
60 unet_CHECK_TYPE_SIZES
61
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
66
67 dnl Checks for library functions.
68 dnl AC_PROG_GCC_TRADITIONAL
69 dnl AC_FUNC_MEMCMP
70 dnl AC_FUNC_VPRINTF
71
72 dnl Do we have a system call poll?
73 unet_FUNC_POLL_SYSCALL
74
75 dnl Do we have restarting syscalls ?
76 AC_SYS_RESTARTABLE_SYSCALLS
77
78 dnl Check for required features for admins?
79 AC_MSG_CHECKING([for donuts])
80 AC_MSG_RESULT([yes])
81
82 dnl Test for programs
83 AC_PROG_AWK
84 AC_PROG_MAKE_SET
85 AC_PROG_INSTALL
86 AC_PROG_LN_S
87 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
88 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
89
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
96   unet_cv_sys_set_h=yes
97 else
98   unet_cv_sys_set_h=no
99 fi
100 $RMPROG -fr conftest*])
101 dnl Used in Configure.
102 AC_SUBST(unet_cv_sys_set_h)
103
104 unet_NONBLOCKING
105 unet_SIGNALS
106
107 dnl Add -pipe when possible
108 unet_PIPE_CFLAGS
109
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)
114
115 dnl Check OS for os_dep files.
116 uname=`uname`
117 AC_MSG_CHECKING(for OS type)
118 case "$uname" in
119   *inux*)
120     AC_MSG_RESULT($uname found.)
121     OSDEP_C="os_linux.c"
122   ;;
123   *olaris*)
124     AC_MSG_RESULT($uname found.)
125     OSDEP_C="os_solaris.c"
126   ;;
127   *SunOS*)
128     AC_MSG_RESULT($uname found.)
129     OSDEP_C="os_solaris.c"
130   ;;
131   *OpenBSD*)
132     AC_MSG_RESULT($uname found.)
133     OSDEP_C="os_openbsd.c"
134   ;;
135   *BSD*)
136     AC_MSG_RESULT($uname found.)
137     OSDEP_C="os_bsd.c"
138   ;;
139   *)
140     AC_MSG_RESULT(Unknown OS. Using generic routines.)
141     OSDEP_C="os_generic.c"
142   ;;
143 esac
144 AC_SUBST(OSDEP_C)
145
146 dnl Finally really generate all output files:
147 AC_OUTPUT(config-sh Configure ../Makefile ../ircd/Makefile ../doc/Makefile Makefile, [echo timestamp > stamp-h;],)