]> arthur.barton.de Git - ngircd-alex.git/blob - configure.in
Added support for TCP Wrappers.
[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.81 2003/02/25 14:07:26 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([IRCPLUS], [Define if IRC+ protocol should be used])
32 AH_TEMPLATE([RENDEZVOUS], [Define if Rendezvous support should be included])
33
34 AH_TEMPLATE([TARGET_OS], [Target operating system name])
35 AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
36 AH_TEMPLATE([TARGET_CPU], [Target CPU name])
37
38 # -- C Compiler --
39
40 AC_PROG_CC
41
42 # -- Hilfsprogramme --
43
44 AC_PROG_AWK
45 AC_PROG_INSTALL
46 AC_PROG_LN_S
47 AC_PROG_MAKE_SET
48 AC_PROG_RANLIB
49
50 # -- Compiler Features --
51
52 AC_LANG_C
53
54 AM_C_PROTOTYPES
55 AC_C_CONST
56
57 # -- Defines --
58
59 if test `uname` = "A/UX"; then
60         # unter A/UX sollte _POSIX_SOURCE definiert sein.
61         AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
62         CFLAGS="$CFLAGS -D_POSIX_SOURCE"
63 fi
64
65 if test `uname` = "HP-UX"; then
66         # unter HP-UX 11.11 muss _XOPEN_SOURCE_EXTENDED definiert sein.
67         AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
68         CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
69 fi
70
71 # -- Header --
72
73 AC_HEADER_STDC
74
75 AC_HEADER_TIME
76
77 AC_HEADER_SYS_WAIT
78
79 AC_CHECK_HEADERS([ \
80         ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
81         strings.h sys/socket.h sys/time.h unistd.h \
82         ],,AC_MSG_ERROR([required C header missing!]))
83
84 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h])
85
86 # -- Datentypen --
87
88 AC_MSG_CHECKING(whether socklen_t exists)
89 AC_TRY_COMPILE([
90         #include <sys/socket.h>
91         #include <sys/types.h>
92         ],[
93         socklen_t a, b;
94         a = 2; b = 4; a += b;
95         ],[
96         AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
97         ],[
98         AC_MSG_RESULT(no)
99 ])
100
101 AC_TYPE_SIGNAL
102
103 AC_TYPE_SIZE_T
104
105 # -- Libraries --
106
107 AC_CHECK_LIB(UTIL,memmove)
108 AC_CHECK_LIB(socket,bind)
109 AC_CHECK_LIB(nsl,gethostent)
110
111 # -- Funktionen --
112
113 AC_FUNC_MALLOC
114
115 AC_FUNC_FORK
116
117 AC_FUNC_STRFTIME
118
119 AC_CHECK_FUNCS([ \
120         bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
121         memset setsockopt socket strcasecmp strchr strerror strstr waitpid \
122         ],,AC_MSG_ERROR([required function missing!]))
123
124 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
125
126 AC_CHECK_FUNCS(poll,[AC_CHECK_HEADER(sys/poll.h)],
127         [AC_CHECK_FUNCS(select,[AC_CHECK_HEADER(sys/select.h)],
128                 AC_MSG_ERROR([neither poll() nor select() is available!]))
129         ]
130 )
131
132 # -- Konfigurationsoptionen --
133
134 x_syslog_on=no
135 AC_ARG_ENABLE(syslog,
136         [  --disable-syslog        disable syslog (autodetected by default)],
137         [       if test "$enableval" = "yes"; then
138                         AC_CHECK_HEADER(syslog.h, x_syslog_on=yes,
139                                 AC_MSG_ERROR([Can't enable syslog: syslog.h not found!])
140                         )
141                 fi
142         ],
143         [       AC_CHECK_HEADER(syslog.h, x_syslog_on=yes) ]
144 )
145 if test "$x_syslog_on" = "yes"; then
146         AC_DEFINE(USE_SYSLOG, 1)
147         AC_CHECK_LIB(be,syslog)
148 fi
149
150 x_zlib_on=no
151 AC_ARG_ENABLE(zlib,
152         [  --disable-zlib          disable zlib compression (autodetected by default)],
153         [       if test "$enableval" = "yes"; then
154                         AC_CHECK_HEADER(zlib.h, x_zlib_on=yes,
155                                 AC_MSG_ERROR([Can't enable zlib: zlib.h not found!])
156                         )
157                 fi
158         ],
159         [       AC_CHECK_HEADER(zlib.h, x_zlib_on=yes) ]
160 )
161 if test "$x_zlib_on" = "yes"; then
162         AC_DEFINE(USE_ZLIB, 1)
163         AC_CHECK_LIB(z,deflate)
164 fi
165
166 x_ircplus_on=yes
167 AC_ARG_ENABLE(ircplus,
168         [  --disable-ircplus       disable IRC+ protocol],
169         if test "$enableval" = "no"; then x_ircplus_on=no; fi
170 )
171 if test "$x_ircplus_on" = "yes"; then
172         AC_DEFINE(IRCPLUS, 1)
173 fi
174
175 x_rendezvous_on=no
176 AC_ARG_ENABLE(rendezvous,
177         [  --enable-rendezvous     enable Rendezvous on platforms that support it],
178         [       if test "$enableval" = "yes"; then
179                         AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=yes,
180                                 AC_MSG_ERROR([Can't enable Rendezvous: DNSServiceRegistrationCreate() not available!])
181                         )
182                 fi
183         ]
184 )
185 if test "$x_rendezvous_on" = "yes"; then
186         AC_DEFINE(RENDEZVOUS, 1)
187         AC_CHECK_HEADERS(DNSServiceDiscovery/DNSServiceDiscovery.h mach/port.h)
188 fi
189
190 x_sniffer_on=no; x_debug_on=no
191 AC_ARG_ENABLE(sniffer,
192         [  --enable-sniffer        enable IRC traffic sniffer (enables debug mode)],
193         if test "$enableval" = "yes"; then
194                 AC_DEFINE(SNIFFER, 1)
195                 x_sniffer_on=yes; x_debug_on=yes
196         fi
197 )
198
199 AC_ARG_ENABLE(debug,
200         [  --enable-debug          show additional debug output],
201         if test "$enableval" = "yes"; then x_debug_on=yes; fi
202 )
203 if test "$x_debug_on" = "yes"; then
204         AC_DEFINE(DEBUG, 1)
205 fi
206
207 x_strict_rfc_on=no
208 AC_ARG_ENABLE(strict-rfc,
209         [  --enable-strict-rfc     strict RFC conformance -- may break clients!],
210         if test "$enableval" = "yes"; then
211                 AC_DEFINE(STRICT_RFC, 1)
212                 x_strict_rfc_on=yes
213         fi
214 )
215
216 # -- Definitionen --
217
218 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
219 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
220 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
221
222 # -- Variablen --
223
224 if test "$GCC" = "yes"; then
225         the_CFLAGS="-Wall -Wtraditional -Wpointer-arith -Wstrict-prototypes"
226         add_CFLAGS="$CFLAGS $CFLAGS_ADD"
227 else
228         the_CFLAGS="$CFLAGS"
229         add_CFLAGS="$CFLAGS_ADD"
230 fi
231
232 CFLAGS="$the_CFLAGS $add_CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
233
234 # -- Ausgabe der Dateien --
235
236 AC_OUTPUT([ \
237         Makefile \
238         doc/Makefile \
239         doc/de/Makefile \
240         MacOSX/Makefile \
241         MacOSX/ngircd.pbproj/Makefile \
242         src/Makefile \
243         src/portab/Makefile \
244         src/tool/Makefile \
245         src/ngircd/Makefile \
246         src/testsuite/Makefile \
247         man/Makefile \
248         contrib/Makefile \
249 ])
250
251 # -- Ergebnis --
252
253 echo
254
255 # Someone please show me a better way :)  [borrowed by OpenSSH]
256 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
257 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
258 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
259 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
260
261 echo "                host: ${host}"
262 echo "            compiler: ${CC}"
263 echo "      compiler flags: ${the_CFLAGS}"
264 test -n "$add_CFLAGS" && echo "                      ${add_CFLAGS}"
265 echo "  preprocessor flags: ${CPPFLAGS}"
266 echo "        linker flags: ${LDFLAGS}"
267 echo "           libraries: ${LIBS}"
268 echo
269 echo "     'ngircd' binary: $S"
270 echo "  configuration file: $C"
271 echo "        manual pages: $M"
272 echo
273
274 echo $ECHO_N "      active options: $ECHO_C"
275 test "$x_syslog_on" = "yes"     && echo $ECHO_N "Syslog $ECHO_C"
276 test "$x_zlib_on" = "yes"       && echo $ECHO_N "zLib $ECHO_C"
277 test "$x_debug_on" = "yes"      && echo $ECHO_N "Debug $ECHO_C"
278 test "$x_sniffer_on" = "yes"    && echo $ECHO_N "Sniffer $ECHO_C"
279 test "$x_strict_rfc_on" = "yes" && echo $ECHO_N "Strict-RFC $ECHO_C"
280 test "$x_ircplus_on" = "yes"    && echo $ECHO_N "IRC+ $ECHO_C"
281 test "$x_rendezvous_on" = "yes" && echo $ECHO_N "Rendezvous $ECHO_C"
282 echo; echo
283
284 # -eof-