]> arthur.barton.de Git - ngircd-alex.git/blob - configure.in
Removed outdated Mac OS X ProjectBuilder project files (will be re-added
[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.98 2003/12/27 13:01:12 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([SYSLOG], [Define if syslog should be used for logging])
30 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
31 AH_TEMPLATE([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 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
35
36 AH_TEMPLATE([TARGET_OS], [Target operating system name])
37 AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
38 AH_TEMPLATE([TARGET_CPU], [Target CPU name])
39
40 # -- C Compiler --
41
42 AC_PROG_CC
43
44 # -- Hilfsprogramme --
45
46 AC_PROG_AWK
47 AC_PROG_INSTALL
48 AC_PROG_LN_S
49 AC_PROG_MAKE_SET
50 AC_PROG_RANLIB
51
52 # -- Compiler Features --
53
54 AC_LANG_C
55
56 AM_C_PROTOTYPES
57 AC_C_CONST
58
59 # -- Defines --
60
61 os=`uname`
62
63 if test "$os" = "Linux" -o $os = "GNU"; then
64         # define _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE when compiling
65         # on Linux or Hurd (glibc-based systems):
66         AC_MSG_RESULT([detected ${os}, defining _POSIX_SOURCE, _GNU_SOURCE and _BSD_SOURCE])
67         add_DEFINES="-D_POSIX_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE $add_DEFINES"
68 fi
69
70 if test "$os" = "A/UX"; then
71         # define _POSIX_SOURCE when compiling on A/UX:
72         AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
73         add_DEFINES="-D_POSIX_SOURCE $add_DEFINES"
74 fi
75
76 if test "$os" = "HP-UX"; then
77         # define _XOPEN_SOURCE_EXTENDED when compiling on HP-UX (11.11):
78         AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
79         add_DEFINES="-D_XOPEN_SOURCE_EXTENDED $add_DEFINES"
80 fi
81
82 if test "$os" = "SunOS"; then
83         # define _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED=1 and __EXTENSIONS__
84         # when compiling on SunOS (tested with 5.6):
85         AC_MSG_RESULT([detected SunOS, defining _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED=1 and __EXTENSIONS__])
86         add_DEFINES="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__ $add_DEFINES"
87 fi
88
89 # -- Header --
90
91 AC_HEADER_STDC
92
93 AC_HEADER_TIME
94
95 AC_HEADER_SYS_WAIT
96
97 AC_CHECK_HEADERS([ \
98         ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
99         strings.h sys/socket.h sys/time.h unistd.h \
100         ],,AC_MSG_ERROR([required C header missing!]))
101
102 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h])
103
104 # -- Datentypen --
105
106 AC_MSG_CHECKING(whether socklen_t exists)
107 AC_TRY_COMPILE([
108         #include <sys/socket.h>
109         #include <sys/types.h>
110         ],[
111         socklen_t a, b;
112         a = 2; b = 4; a += b;
113         ],[
114         AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
115         ],[
116         AC_MSG_RESULT(no)
117 ])
118
119 AC_TYPE_SIGNAL
120
121 AC_TYPE_SIZE_T
122
123 # -- Libraries --
124
125 AC_CHECK_LIB(UTIL,memmove)
126 AC_CHECK_LIB(socket,bind)
127 AC_CHECK_LIB(nsl,gethostent)
128
129 # -- Funktionen --
130
131 AC_FUNC_MALLOC
132
133 AC_FUNC_FORK
134
135 AC_FUNC_STRFTIME
136
137 AC_CHECK_FUNCS([ \
138         bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
139         memset setsockopt socket strcasecmp strchr strerror strstr waitpid \
140         ],,AC_MSG_ERROR([required function missing!]))
141
142 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
143
144 AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
145         AC_MSG_ERROR([required function select() is missing!])
146 )
147
148 # -- Konfigurationsoptionen --
149
150 x_syslog_on=no
151 AC_ARG_WITH(syslog,
152         [  --without-syslog        disable syslog (autodetected by default)],
153         [       if test "$withval" = "yes"; then
154                         AC_CHECK_LIB(be, syslog)
155                         AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
156                                 AC_MSG_ERROR([Can't enable syslog!])
157                         )
158                 fi
159         ],
160         [
161                 AC_CHECK_LIB(be, syslog)
162                 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
163         ]
164 )
165 if test "$x_syslog_on" = "yes"; then
166         AC_DEFINE(SYSLOG, 1)
167         AC_CHECK_HEADERS(syslog.h)
168 fi
169
170 x_zlib_on=no
171 AC_ARG_WITH(zlib,
172         [  --without-zlib          disable zlib compression (autodetected by default)],
173         [       if test "$withval" = "yes"; then
174                         AC_CHECK_LIB(z, deflate)
175                         AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
176                                 AC_MSG_ERROR([Can't enable zlib!])
177                         )
178                 fi
179         ],
180         [       AC_CHECK_LIB(z, deflate)
181                 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
182         ]
183 )
184 if test "$x_zlib_on" = "yes"; then
185         AC_DEFINE(ZLIB, 1)
186         AC_CHECK_HEADERS(zlib.h)
187 fi
188
189 x_tcpwrap_on=no
190 AC_ARG_WITH(tcp-wrappers,
191         [  --with-tcp-wrappers     enable TCP wrappers support],
192         [       if test "$withval" = "yes"; then
193                         AC_CHECK_LIB(wrap, tcpd_warn)
194                         AC_MSG_CHECKING(for hosts_access)
195                         AC_TRY_LINK([
196                                 #include <tcpd.h>
197                                 ],[
198                                 void *ptr;
199                                 ptr = hosts_access;
200                                 ],[
201                                 AC_MSG_RESULT(yes)
202                                 AC_DEFINE(TCPWRAP, 1)
203                                 x_tcpwrap_on=yes
204                                 ],[
205                                 AC_MSG_RESULT(no)
206                                 AC_MSG_ERROR([Can't enable TCP wrappers!])
207                         ])
208                 fi
209         ]
210 )
211
212 x_rendezvous_on=no
213 AC_ARG_WITH(rendezvous,
214         [  --with-rendezvous       enable support for "Rendezvous"],
215         [       if test "$withval" = "yes"; then
216                         AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=yes,
217                                 AC_MSG_ERROR([Can't enable Rendezvous!])
218                         )
219                 fi
220         ]
221 )
222 if test "$x_rendezvous_on" = "yes"; then
223         AC_DEFINE(RENDEZVOUS, 1)
224         AC_CHECK_HEADERS(DNSServiceDiscovery/DNSServiceDiscovery.h mach/port.h)
225 fi
226
227 x_identauth_on=no
228 AC_ARG_WITH(ident,
229         [  --with-ident            enable "IDENT" ("AUTH") protocol support],
230         [       if test "$withval" = "yes"; then
231                         AC_CHECK_LIB(ident, ident_id)
232                         AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
233                                 AC_MSG_ERROR([Can't enable IDENT support!])
234                         )
235                 fi
236         ]
237 )
238 if test "$x_identauth_on" = "yes"; then
239         AC_DEFINE(IDENTAUTH, 1)
240         AC_CHECK_HEADERS(ident.h)
241 fi
242
243 x_ircplus_on=yes
244 AC_ARG_ENABLE(ircplus,
245         [  --disable-ircplus       disable IRC+ protocol],
246         if test "$enableval" = "no"; then x_ircplus_on=no; fi
247 )
248 if test "$x_ircplus_on" = "yes"; then
249         AC_DEFINE(IRCPLUS, 1)
250 fi
251
252 x_sniffer_on=no; x_debug_on=no
253 AC_ARG_ENABLE(sniffer,
254         [  --enable-sniffer        enable IRC traffic sniffer (enables debug mode)],
255         if test "$enableval" = "yes"; then
256                 AC_DEFINE(SNIFFER, 1)
257                 x_sniffer_on=yes; x_debug_on=yes
258         fi
259 )
260
261 AC_ARG_ENABLE(debug,
262         [  --enable-debug          show additional debug output],
263         if test "$enableval" = "yes"; then x_debug_on=yes; fi
264 )
265 if test "$x_debug_on" = "yes"; then
266         AC_DEFINE(DEBUG, 1)
267 fi
268
269 x_strict_rfc_on=no
270 AC_ARG_ENABLE(strict-rfc,
271         [  --enable-strict-rfc     strict RFC conformance -- may break clients!],
272         if test "$enableval" = "yes"; then
273                 AC_DEFINE(STRICT_RFC, 1)
274                 x_strict_rfc_on=yes
275         fi
276 )
277
278 # -- Definitionen --
279
280 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
281 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
282 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
283
284 # -- Variablen --
285
286 if test "$GCC" = "yes"; then
287         the_CFLAGS="-Wmissing-declarations -Wpointer-arith -Wstrict-prototypes"
288         ansi=" -ansi"
289         pedantic=" -pedantic"
290
291         $CC --version | grep 20020420 >/dev/null 2>&1
292         if test $? -eq 0; then
293                 # Mac OS X (and Darwin?) ship with a slightly broken
294                 # prerelease of GCC 3.1 which don't like -pedantic:
295                 AC_MSG_RESULT([detected broken GNU C compiler, disabling "-pedantic"])
296                 pedantic=""
297         fi
298
299         $CC --version | grep 20030304 >/dev/null 2>&1
300         if test $? -eq 0; then
301                 # Mac OS X 10.3 (and Darwin 7.0?) have a strange gcc (or
302                 # system header files?) which produces lots of errors when
303                 # using -ansi; so we don't =:-)
304                 AC_MSG_RESULT([detected broken GNU C compiler, disabling "-ansi"])
305                 ansi=""
306         fi
307
308         uname | grep "CYGWIN" >/dev/null 2>&1
309         if test $? -eq 0; then
310                 # The include files of Cygwin don't like -ansi,
311                 # so we disable it:
312                 AC_MSG_RESULT([detected Cygwin, disabling "-ansi"])
313                 ansi=""
314         fi
315
316         add_CFLAGS="-pipe -Wall -W${ansi}${pedantic} $CFLAGS $CFLAGS_ADD"
317 else
318         the_CFLAGS="$CFLAGS"
319         add_CFLAGS="$CFLAGS_ADD"
320 fi
321
322 CFLAGS="$the_CFLAGS $add_CFLAGS $add_DEFINES -DSYSCONFDIR='\"\$(sysconfdir)\"'"
323
324 # -- Ausgabe der Dateien --
325
326 AC_OUTPUT([ \
327         Makefile \
328         doc/Makefile \
329         MacOSX/Makefile \
330         MacOSX/ngircd.pbproj/Makefile \
331         src/Makefile \
332         src/portab/Makefile \
333         src/tool/Makefile \
334         src/ngircd/Makefile \
335         src/testsuite/Makefile \
336         man/Makefile \
337         contrib/Makefile \
338         debian/Makefile \
339 ])
340
341 # -- Result --
342
343 echo
344 echo "ngIRCd has been configured with the following options:"
345 echo
346
347 # Someone please show me a better way :)  [borrowed by OpenSSH]
348 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
349 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
350 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
351 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
352 D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
353
354 echo "               Host: ${host}"
355 echo "           Compiler: ${CC}"
356 echo "     Compiler flags: ${the_CFLAGS}"
357 test -n "$add_CFLAGS"   && echo "                     ${add_CFLAGS}"
358 test -n "$add_DEFINES"  && echo "                     ${add_DEFINES}"
359 test -n "$CPPFLAGS"     && echo " Preprocessor flags: ${CPPFLAGS}"
360 test -n "$LDFLAGS"      && echo "       Linker flags: ${LDFLAGS}"
361 test -n "$LIBS"         && echo "          Libraries: ${LIBS}"
362 echo
363 echo "    'ngircd' binary: $S"
364 echo " Configuration file: $C"
365 echo "       Manual pages: $M"
366 echo "      Documentation: $D"
367 echo
368
369 echo $ECHO_N "     Syslog support: $ECHO_C"
370 test "$x_syslog_on" = "yes" \
371         && echo $ECHO_N "yes $ECHO_C" \
372         || echo $ECHO_N "no  $ECHO_C"
373 echo $ECHO_N "  Enable debug code: $ECHO_C"
374 test "$x_debug_on" = "yes" \
375         && echo "yes" \
376         || echo "no"
377
378 echo $ECHO_N "   zlib compression: $ECHO_C"
379 test "$x_zlib_on" = "yes" \
380         && echo $ECHO_N "yes $ECHO_C" \
381         || echo $ECHO_N "no  $ECHO_C"
382 echo $ECHO_N "        IRC sniffer: $ECHO_C"
383 test "$x_sniffer_on" = "yes" \
384         && echo "yes" \
385         || echo "no"
386
387 echo $ECHO_N "   Use TCP Wrappers: $ECHO_C"
388 test "$x_tcpwrap_on" = "yes" \
389         && echo $ECHO_N "yes $ECHO_C" \
390         || echo $ECHO_N "no  $ECHO_C"
391 echo $ECHO_N "    Strict RFC mode: $ECHO_C"
392 test "$x_strict_rfc_on" = "yes" \
393         && echo "yes" \
394         || echo "no"
395
396 echo $ECHO_N " Rendezvous support: $ECHO_C"
397 test "$x_rendezvous_on" = "yes" \
398         && echo $ECHO_N "yes $ECHO_C" \
399         || echo $ECHO_N "no  $ECHO_C"
400 echo $ECHO_N "      IRC+ protocol: $ECHO_C"
401 test "$x_ircplus_on" = "yes" \
402         && echo "yes" \
403         || echo "no"
404
405 echo $ECHO_N "      IDENT support: $ECHO_C"
406 test "$x_identauth_on" = "yes" \
407         && echo $ECHO_N "yes $ECHO_C" \
408         || echo $ECHO_N "no  $ECHO_C"
409
410 echo; echo
411
412 # -eof-