This commit was generated by cvs2svn to compensate for changes in r2,
[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 AC_AIX
26 dnl Allow the use of POSIX functions on several OS.
27 AC_ISC_POSIX
28 AC_MINIX
29 dnl ANSIfy the C compiler whenever possible.
30 AM_PROG_CC_STDC
31 dnl Use -O3 instead of -O2.
32 if test "$CFLAGS" != "" ; then
33   CFLAGS=`echo "$CFLAGS" | sed -e 's/-O2/-O3/'`
34 fi
35 dnl Remove -pipe during configure
36 if test "$CFLAGS" != "" ; then
37   CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
38 fi
39
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"))
49 unet_CHECK_LIB_RESOLV
50
51 dnl Checks for header files.
52 AC_HEADER_STDC
53 AC_HEADER_SYS_WAIT
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)
55
56 dnl Checks for typedefs, structures, and compiler characteristics.
57 AC_C_CONST
58 AC_C_BIGENDIAN
59 AC_TYPE_SIZE_T
60 AC_HEADER_TIME
61 AC_STRUCT_TM
62 AC_TYPE_UID_T
63 unet_CHECK_TYPE_SIZES
64
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
69
70 dnl Checks for library functions.
71 AC_PROG_GCC_TRADITIONAL
72 AC_FUNC_MEMCMP
73 AC_FUNC_SETVBUF_REVERSED
74 AC_TYPE_SIGNAL
75 AC_FUNC_VPRINTF
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)
80
81 dnl Do we have a system call poll?
82 unet_FUNC_POLL_SYSCALL
83
84 dnl Do we have restarting syscalls ?
85 AC_SYS_RESTARTABLE_SYSCALLS
86
87 dnl Test for programs
88 AC_PROG_AWK
89 AC_PROG_MAKE_SET
90 AC_PROG_INSTALL
91 AC_PROG_LN_S
92 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
93 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
94
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
102 else
103   unet_cv_sys_set_h=no
104 fi
105 $RMPROG -fr conftest*])
106 dnl Used in Configure.
107 AC_SUBST(unet_cv_sys_set_h)
108
109 unet_NONBLOCKING
110 unet_SIGNALS
111
112 dnl Add -pipe when possible
113 unet_PIPE_CFLAGS
114
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)
119
120 dnl Finally really generate all output files:
121 AC_OUTPUT(config-sh Configure ../Makefile ../ircd/Makefile ../doc/Makefile Makefile, [echo timestamp > stamp-h;],)