]> arthur.barton.de Git - ngircd-alex.git/blob - configure.in
Added some defines for Linux/glibc, reverted unused test for poll(), and
[ngircd-alex.git] / configure.in
1 #
2 # ngIRCd -- The Next Generation IRC Daemon
3 # Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 # Please read the file COPYING, README and AUTHORS for more information.
10 #
11 # $Id: configure.in,v 1.89 2003/04/21 10:51:44 alex Exp $
12 #
13
14 # -- Initialisierung --
15
16 AC_PREREQ(2.50)
17 AC_INIT(ngircd, CVSHEAD)
18 AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
19 AC_CANONICAL_TARGET
20 AM_INIT_AUTOMAKE(1.6)
21 AM_CONFIG_HEADER(src/config.h)
22
23 # -- Templates fuer config.h --
24
25 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
26 AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
27 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
28 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
29 AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
30 AH_TEMPLATE([USE_ZLIB], [Define if zlib compression should be enabled])
31 AH_TEMPLATE([USE_TCPWRAP], [Define if TCP wrappers should be used])
32 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
33 AH_TEMPLATE([RENDEZVOUS], [Define if Rendezvous support should be included])
34
35 AH_TEMPLATE([TARGET_OS], [Target operating system name])
36 AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
37 AH_TEMPLATE([TARGET_CPU], [Target CPU name])
38
39 # -- C Compiler --
40
41 AC_PROG_CC
42
43 # -- Hilfsprogramme --
44
45 AC_PROG_AWK
46 AC_PROG_INSTALL
47 AC_PROG_LN_S
48 AC_PROG_MAKE_SET
49 AC_PROG_RANLIB
50
51 # -- Compiler Features --
52
53 AC_LANG_C
54
55 AM_C_PROTOTYPES
56 AC_C_CONST
57
58 # -- Defines --
59
60 if test `uname` = "Linux"; then
61         # define _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE when compiling
62         # on Linux (glibc-based systems):
63         AC_MSG_RESULT([detected Linux, defining _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE])
64         add_DEFINES="-D_POSIX_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE $add_DEFINES"
65 fi
66
67 if test `uname` = "A/UX"; then
68         # define _POSIX_SOURCE when compiling on A/UX:
69         AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
70         add_DEFINES="-D_POSIX_SOURCE $add_DEFINES"
71 fi
72
73 if test `uname` = "HP-UX"; then
74         # define _XOPEN_SOURCE_EXTENDED when compiling on HP-UX (11.11):
75         AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
76         add_DEFINES="-D_XOPEN_SOURCE_EXTENDED $add_DEFINES"
77 fi
78
79 # -- Header --
80
81 AC_HEADER_STDC
82
83 AC_HEADER_TIME
84
85 AC_HEADER_SYS_WAIT
86
87 AC_CHECK_HEADERS([ \
88         ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
89         strings.h sys/socket.h sys/time.h unistd.h \
90         ],,AC_MSG_ERROR([required C header missing!]))
91
92 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h])
93
94 # -- Datentypen --
95
96 AC_MSG_CHECKING(whether socklen_t exists)
97 AC_TRY_COMPILE([
98         #include <sys/socket.h>
99         #include <sys/types.h>
100         ],[
101         socklen_t a, b;
102         a = 2; b = 4; a += b;
103         ],[
104         AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
105         ],[
106         AC_MSG_RESULT(no)
107 ])
108
109 AC_TYPE_SIGNAL
110
111 AC_TYPE_SIZE_T
112
113 # -- Libraries --
114
115 AC_CHECK_LIB(UTIL,memmove)
116 AC_CHECK_LIB(socket,bind)
117 AC_CHECK_LIB(nsl,gethostent)
118
119 # -- Funktionen --
120
121 AC_FUNC_MALLOC
122
123 AC_FUNC_FORK
124
125 AC_FUNC_STRFTIME
126
127 AC_CHECK_FUNCS([ \
128         bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
129         memset setsockopt socket strcasecmp strchr strerror strstr waitpid \
130         ],,AC_MSG_ERROR([required function missing!]))
131
132 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
133
134 AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
135         AC_MSG_ERROR([required function select() is missing!])
136 )
137
138 # -- Konfigurationsoptionen --
139
140 x_syslog_on=no
141 AC_ARG_WITH(syslog,
142         [  --without-syslog        disable syslog (autodetected by default)],
143         [       if test "$withval" = "yes"; then
144                         AC_CHECK_LIB(be, syslog)
145                         AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
146                                 AC_MSG_ERROR([Can't enable syslog!])
147                         )
148                 fi
149         ],
150         [
151                 AC_CHECK_LIB(be, syslog)
152                 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
153         ]
154 )
155 if test "$x_syslog_on" = "yes"; then
156         AC_DEFINE(USE_SYSLOG, 1)
157         AC_CHECK_HEADERS(syslog.h)
158 fi
159
160 x_zlib_on=no
161 AC_ARG_WITH(zlib,
162         [  --without-zlib          disable zlib compression (autodetected by default)],
163         [       if test "$withval" = "yes"; then
164                         AC_CHECK_LIB(z, deflate)
165                         AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
166                                 AC_MSG_ERROR([Can't enable zlib!])
167                         )
168                 fi
169         ],
170         [       AC_CHECK_LIB(z, deflate)
171                 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
172         ]
173 )
174 if test "$x_zlib_on" = "yes"; then
175         AC_DEFINE(USE_ZLIB, 1)
176         AC_CHECK_HEADERS(zlib.h)
177 fi
178
179 x_tcpwrap_on=no
180 AC_ARG_WITH(tcp-wrappers,
181         [  --with-tcp-wrappers     enable TCP wrappers support],
182         [       if test "$withval" = "yes"; then
183                         AC_CHECK_LIB(wrap, tcpd_warn)
184                         AC_MSG_CHECKING(for hosts_access)
185                         AC_TRY_LINK([
186                                 #include <tcpd.h>
187                                 ],[
188                                 void *ptr;
189                                 ptr = hosts_access;
190                                 ],[
191                                 AC_MSG_RESULT(yes)
192                                 AC_DEFINE(USE_TCPWRAP, 1)
193                                 x_tcpwrap_on=yes
194                                 ],[
195                                 AC_MSG_RESULT(no)
196                                 AC_MSG_ERROR([Can't enable TCP wrappers!])
197                         ])
198                 fi
199         ]
200 )
201
202 x_rendezvous_on=no
203 AC_ARG_WITH(rendezvous,
204         [  --with-rendezvous       enable support for "Rendezvous"],
205         [       if test "$withval" = "yes"; then
206                         AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=yes,
207                                 AC_MSG_ERROR([Can't enable Rendezvous!])
208                         )
209                 fi
210         ]
211 )
212 if test "$x_rendezvous_on" = "yes"; then
213         AC_DEFINE(RENDEZVOUS, 1)
214         AC_CHECK_HEADERS(DNSServiceDiscovery/DNSServiceDiscovery.h mach/port.h)
215 fi
216
217 x_ircplus_on=yes
218 AC_ARG_ENABLE(ircplus,
219         [  --disable-ircplus       disable IRC+ protocol],
220         if test "$enableval" = "no"; then x_ircplus_on=no; fi
221 )
222 if test "$x_ircplus_on" = "yes"; then
223         AC_DEFINE(IRCPLUS, 1)
224 fi
225
226 x_sniffer_on=no; x_debug_on=no
227 AC_ARG_ENABLE(sniffer,
228         [  --enable-sniffer        enable IRC traffic sniffer (enables debug mode)],
229         if test "$enableval" = "yes"; then
230                 AC_DEFINE(SNIFFER, 1)
231                 x_sniffer_on=yes; x_debug_on=yes
232         fi
233 )
234
235 AC_ARG_ENABLE(debug,
236         [  --enable-debug          show additional debug output],
237         if test "$enableval" = "yes"; then x_debug_on=yes; fi
238 )
239 if test "$x_debug_on" = "yes"; then
240         AC_DEFINE(DEBUG, 1)
241 fi
242
243 x_strict_rfc_on=no
244 AC_ARG_ENABLE(strict-rfc,
245         [  --enable-strict-rfc     strict RFC conformance -- may break clients!],
246         if test "$enableval" = "yes"; then
247                 AC_DEFINE(STRICT_RFC, 1)
248                 x_strict_rfc_on=yes
249         fi
250 )
251
252 # -- Definitionen --
253
254 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
255 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
256 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
257
258 # -- Variablen --
259
260 if test "$GCC" = "yes"; then
261         the_CFLAGS="-Wmissing-declarations -Wpointer-arith -Wstrict-prototypes"
262         add_CFLAGS="-Wall -W -ansi -pedantic $CFLAGS $CFLAGS_ADD"
263 else
264         the_CFLAGS="$CFLAGS"
265         add_CFLAGS="$CFLAGS_ADD"
266 fi
267
268 CFLAGS="$the_CFLAGS $add_CFLAGS $add_DEFINES -DSYSCONFDIR='\"\$(sysconfdir)\"'"
269
270 # -- Ausgabe der Dateien --
271
272 AC_OUTPUT([ \
273         Makefile \
274         doc/Makefile \
275         MacOSX/Makefile \
276         MacOSX/ngircd.pbproj/Makefile \
277         src/Makefile \
278         src/portab/Makefile \
279         src/tool/Makefile \
280         src/ngircd/Makefile \
281         src/testsuite/Makefile \
282         man/Makefile \
283         contrib/Makefile \
284 ])
285
286 # -- Result --
287
288 echo
289 echo "ngIRCd has been configured with the following options:"
290 echo
291
292 # Someone please show me a better way :)  [borrowed by OpenSSH]
293 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
294 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
295 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
296 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
297 D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
298
299 echo "               Host: ${host}"
300 echo "           Compiler: ${CC}"
301 echo "     Compiler flags: ${the_CFLAGS}"
302 test -n "$add_CFLAGS"   && echo "                     ${add_CFLAGS}"
303 test -n "$add_DEFINES"  && echo "                     ${add_DEFINES}"
304 test -n "$CPPFLAGS"     && echo " Preprocessor flags: ${CPPFLAGS}"
305 test -n "$LDFLAGS"      && echo "       Linker flags: ${LDFLAGS}"
306 test -n "$LIBS"         && echo "          Libraries: ${LIBS}"
307 echo
308 echo "    'ngircd' binary: $S"
309 echo " Configuration file: $C"
310 echo "       Manual pages: $M"
311 echo "      Documentation: $D"
312 echo
313
314 echo $ECHO_N "     Syslog support: $ECHO_C"
315 test "$x_syslog_on" = "yes" \
316         && echo $ECHO_N "yes $ECHO_C" \
317         || echo $ECHO_N "no  $ECHO_C"
318 echo $ECHO_N "  Enable debug code: $ECHO_C"
319 test "$x_debug_on" = "yes" \
320         && echo "yes" \
321         || echo "no"
322
323 echo $ECHO_N "   zlib compression: $ECHO_C"
324 test "$x_zlib_on" = "yes" \
325         && echo $ECHO_N "yes $ECHO_C" \
326         || echo $ECHO_N "no  $ECHO_C"
327 echo $ECHO_N "        IRC sniffer: $ECHO_C"
328 test "$x_sniffer_on" = "yes" \
329         && echo "yes" \
330         || echo "no"
331
332 echo $ECHO_N "   Use TCP Wrappers: $ECHO_C"
333 test "$x_tcpwrap_on" = "yes" \
334         && echo $ECHO_N "yes $ECHO_C" \
335         || echo $ECHO_N "no  $ECHO_C"
336 echo $ECHO_N "    Strict RFC mode: $ECHO_C"
337 test "$x_strict_rfc_on" = "yes" \
338         && echo "yes" \
339         || echo "no"
340
341 echo $ECHO_N " Rendezvous support: $ECHO_C"
342 test "$x_rendezvous_on" = "yes" \
343         && echo $ECHO_N "yes $ECHO_C" \
344         || echo $ECHO_N "no  $ECHO_C"
345 echo $ECHO_N "      IRC+ protocol: $ECHO_C"
346 test "$x_ircplus_on" = "yes" \
347         && echo "yes" \
348         || echo "no"
349 echo
350
351 # -eof-