]> arthur.barton.de Git - ngircd-alex.git/blob - configure.in
Updated Mac OS X project for Project Builder.
[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.84 2003/03/19 17:27:05 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
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` = "A/UX"; then
61         # unter A/UX sollte _POSIX_SOURCE definiert sein.
62         AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
63         CFLAGS="$CFLAGS -D_POSIX_SOURCE"
64 fi
65
66 if test `uname` = "HP-UX"; then
67         # unter HP-UX 11.11 muss _XOPEN_SOURCE_EXTENDED definiert sein.
68         AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
69         CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
70 fi
71
72 # -- Header --
73
74 AC_HEADER_STDC
75
76 AC_HEADER_TIME
77
78 AC_HEADER_SYS_WAIT
79
80 AC_CHECK_HEADERS([ \
81         ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
82         strings.h sys/socket.h sys/time.h unistd.h \
83         ],,AC_MSG_ERROR([required C header missing!]))
84
85 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h])
86
87 # -- Datentypen --
88
89 AC_MSG_CHECKING(whether socklen_t exists)
90 AC_TRY_COMPILE([
91         #include <sys/socket.h>
92         #include <sys/types.h>
93         ],[
94         socklen_t a, b;
95         a = 2; b = 4; a += b;
96         ],[
97         AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
98         ],[
99         AC_MSG_RESULT(no)
100 ])
101
102 AC_TYPE_SIGNAL
103
104 AC_TYPE_SIZE_T
105
106 # -- Libraries --
107
108 AC_CHECK_LIB(UTIL,memmove)
109 AC_CHECK_LIB(socket,bind)
110 AC_CHECK_LIB(nsl,gethostent)
111
112 # -- Funktionen --
113
114 AC_FUNC_MALLOC
115
116 AC_FUNC_FORK
117
118 AC_FUNC_STRFTIME
119
120 AC_CHECK_FUNCS([ \
121         bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
122         memset setsockopt socket strcasecmp strchr strerror strstr waitpid \
123         ],,AC_MSG_ERROR([required function missing!]))
124
125 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
126
127 AC_CHECK_FUNCS(poll,[AC_CHECK_HEADER(sys/poll.h)],
128         [AC_CHECK_FUNCS(select,[AC_CHECK_HEADER(sys/select.h)],
129                 AC_MSG_ERROR([neither poll() nor select() is available!]))
130         ]
131 )
132
133 # -- Konfigurationsoptionen --
134
135 x_syslog_on=no
136 AC_ARG_WITH(syslog,
137         [  --without-syslog        disable syslog (autodetected by default)],
138         [       if test "$withval" = "yes"; then
139                         AC_CHECK_LIB(be, syslog)
140                         AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
141                                 AC_MSG_ERROR([Can't enable syslog!])
142                         )
143                 fi
144         ],
145         [
146                 AC_CHECK_LIB(be, syslog)
147                 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
148         ]
149 )
150 if test "$x_syslog_on" = "yes"; then
151         AC_DEFINE(USE_SYSLOG, 1)
152         AC_CHECK_HEADERS(syslog.h)
153 fi
154
155 x_zlib_on=no
156 AC_ARG_WITH(zlib,
157         [  --without-zlib          disable zlib compression (autodetected by default)],
158         [       if test "$withval" = "yes"; then
159                         AC_CHECK_LIB(z, deflate)
160                         AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
161                                 AC_MSG_ERROR([Can't enable zlib!])
162                         )
163                 fi
164         ],
165         [       AC_CHECK_LIB(z, deflate)
166                 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
167         ]
168 )
169 if test "$x_zlib_on" = "yes"; then
170         AC_DEFINE(USE_ZLIB, 1)
171         AC_CHECK_HEADERS(zlib.h)
172 fi
173
174 x_tcpwrap_on=no
175 AC_ARG_WITH(tcp-wrappers,
176         [  --with-tcp-wrappers     enable TCP wrappers support],
177         [       if test "$withval" = "yes"; then
178                         AC_CHECK_LIB(wrap, tcpd_warn)
179                         AC_MSG_CHECKING(for hosts_access)
180                         AC_TRY_LINK([
181                                 #include <tcpd.h>
182                                 ],[
183                                 void *ptr;
184                                 ptr = hosts_access;
185                                 ],[
186                                 AC_MSG_RESULT(yes)
187                                 AC_DEFINE(USE_TCPWRAP, 1)
188                                 x_tcpwrap_on=yes
189                                 ],[
190                                 AC_MSG_RESULT(no)
191                                 AC_MSG_ERROR([Can't enable TCP wrappers!])
192                         ])
193                 fi
194         ]
195 )
196
197 x_rendezvous_on=no
198 AC_ARG_WITH(rendezvous,
199         [  --with-rendezvous       enable support for "Rendezvous"],
200         [       if test "$withval" = "yes"; then
201                         AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=yes,
202                                 AC_MSG_ERROR([Can't enable Rendezvous!])
203                         )
204                 fi
205         ]
206 )
207 if test "$x_rendezvous_on" = "yes"; then
208         AC_DEFINE(RENDEZVOUS, 1)
209         AC_CHECK_HEADERS(DNSServiceDiscovery/DNSServiceDiscovery.h mach/port.h)
210 fi
211
212 x_ircplus_on=yes
213 AC_ARG_ENABLE(ircplus,
214         [  --disable-ircplus       disable IRC+ protocol],
215         if test "$enableval" = "no"; then x_ircplus_on=no; fi
216 )
217 if test "$x_ircplus_on" = "yes"; then
218         AC_DEFINE(IRCPLUS, 1)
219 fi
220
221 x_sniffer_on=no; x_debug_on=no
222 AC_ARG_ENABLE(sniffer,
223         [  --enable-sniffer        enable IRC traffic sniffer (enables debug mode)],
224         if test "$enableval" = "yes"; then
225                 AC_DEFINE(SNIFFER, 1)
226                 x_sniffer_on=yes; x_debug_on=yes
227         fi
228 )
229
230 AC_ARG_ENABLE(debug,
231         [  --enable-debug          show additional debug output],
232         if test "$enableval" = "yes"; then x_debug_on=yes; fi
233 )
234 if test "$x_debug_on" = "yes"; then
235         AC_DEFINE(DEBUG, 1)
236 fi
237
238 x_strict_rfc_on=no
239 AC_ARG_ENABLE(strict-rfc,
240         [  --enable-strict-rfc     strict RFC conformance -- may break clients!],
241         if test "$enableval" = "yes"; then
242                 AC_DEFINE(STRICT_RFC, 1)
243                 x_strict_rfc_on=yes
244         fi
245 )
246
247 # -- Definitionen --
248
249 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
250 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
251 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
252
253 # -- Variablen --
254
255 if test "$GCC" = "yes"; then
256         the_CFLAGS="-Wall -Wtraditional -Wpointer-arith -Wstrict-prototypes"
257         add_CFLAGS="$CFLAGS $CFLAGS_ADD"
258 else
259         the_CFLAGS="$CFLAGS"
260         add_CFLAGS="$CFLAGS_ADD"
261 fi
262
263 CFLAGS="$the_CFLAGS $add_CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
264
265 # -- Ausgabe der Dateien --
266
267 AC_OUTPUT([ \
268         Makefile \
269         doc/Makefile \
270         MacOSX/Makefile \
271         MacOSX/ngircd.pbproj/Makefile \
272         src/Makefile \
273         src/portab/Makefile \
274         src/tool/Makefile \
275         src/ngircd/Makefile \
276         src/testsuite/Makefile \
277         man/Makefile \
278         contrib/Makefile \
279 ])
280
281 # -- Result --
282
283 echo
284 echo "ngIRCd has been configured with the following options:"
285 echo
286
287 # Someone please show me a better way :)  [borrowed by OpenSSH]
288 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
289 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
290 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
291 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
292
293 echo "               Host: ${host}"
294 echo "           Compiler: ${CC}"
295 echo "     Compiler flags: ${the_CFLAGS}"
296 test -n "$add_CFLAGS" && echo "                     ${add_CFLAGS}"
297 echo " Preprocessor flags: ${CPPFLAGS}"
298 echo "       Linker flags: ${LDFLAGS}"
299 echo "          Libraries: ${LIBS}"
300 echo
301 echo "    'ngircd' binary: $S"
302 echo " Configuration file: $C"
303 echo "       Manual pages: $M"
304 echo
305
306 echo $ECHO_N "     Syslog support: $ECHO_C"
307 test "$x_syslog_on" = "yes" && echo "yes" || echo "no"
308 echo $ECHO_N "   zlib compression: $ECHO_C"
309 test "$x_zlib_on" = "yes" && echo "yes" || echo "no"
310 echo $ECHO_N "   Use TCP Wrappers: $ECHO_C"
311 test "$x_tcpwrap_on" = "yes" && echo "yes" || echo "no"
312 echo $ECHO_N " Rendezvous support: $ECHO_C"
313 test "$x_rendezvous_on" = "yes" && echo "yes" || echo "no"
314 echo $ECHO_N "  Enable debug code: $ECHO_C"
315 test "$x_debug_on" = "yes" && echo "yes" || echo "no"
316 echo $ECHO_N "        IRC sniffer: $ECHO_C"
317 test "$x_sniffer_on" = "yes" && echo "yes" || echo "no"
318 echo $ECHO_N "    Strict RFC mode: $ECHO_C"
319 test "$x_strict_rfc_on" = "yes" && echo "yes" || echo "no"
320 echo $ECHO_N "      IRC+ protocol: $ECHO_C"
321 test "$x_ircplus_on" = "yes" && echo "yes" || echo "no"
322 echo
323
324 # -eof-