]> arthur.barton.de Git - ngircd-alex.git/blob - configure.in
New debian package ;-)
[ngircd-alex.git] / configure.in
1 #
2 # ngIRCd -- The Next Generation IRC Daemon
3 # Copyright (c)2001-2004 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.101 2004/03/11 22:21:20 alex Exp $
12 #
13
14 # -- Initialisation --
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 for 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 # -- Helper programs --
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 AM_C_PROTOTYPES
55 AC_C_CONST
56
57 # -- Hard coded system and compiler dependencies/features/options ... --
58
59 if test "$GCC" = "yes"; then
60         # We are using the GNU C compiler. Good!
61         CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
62 fi
63
64 # Add additional CFLAGS, eventually specified on the command line:
65 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
66
67 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
68
69 # -- Headers --
70
71 AC_HEADER_STDC
72 AC_HEADER_TIME
73 AC_HEADER_SYS_WAIT
74
75 AC_CHECK_HEADERS([ \
76         ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
77         strings.h sys/socket.h sys/time.h unistd.h \
78         ],,AC_MSG_ERROR([required C header missing!]))
79
80 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h])
81
82 # -- Datatypes --
83
84 AC_MSG_CHECKING(whether socklen_t exists)
85 AC_TRY_COMPILE([
86         #include <sys/socket.h>
87         #include <sys/types.h>
88         ],[
89         socklen_t a, b;
90         a = 2; b = 4; a += b;
91         ],[
92         AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
93         ],[
94         AC_MSG_RESULT(no)
95 ])
96
97 AC_TYPE_SIGNAL
98 AC_TYPE_SIZE_T
99
100 # -- Libraries --
101
102 AC_CHECK_LIB(UTIL,memmove)
103 AC_CHECK_LIB(socket,bind)
104 AC_CHECK_LIB(nsl,gethostent)
105
106 # -- Functions --
107
108 AC_FUNC_FORK
109 AC_FUNC_STRFTIME
110
111 AC_CHECK_FUNCS([ \
112         bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
113         memset realloc setsid setsockopt socket strcasecmp strchr strerror \
114         strstr waitpid],,AC_MSG_ERROR([required function missing!]))
115
116 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
117
118 AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
119         AC_MSG_ERROR([required function select() is missing!])
120 )
121
122 # -- Configuration options --
123
124 x_syslog_on=no
125 AC_ARG_WITH(syslog,
126         [  --without-syslog        disable syslog (autodetected by default)],
127         [       if test "$withval" = "yes"; then
128                         AC_CHECK_LIB(be, syslog)
129                         AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
130                                 AC_MSG_ERROR([Can't enable syslog!])
131                         )
132                 fi
133         ],
134         [
135                 AC_CHECK_LIB(be, syslog)
136                 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
137         ]
138 )
139 if test "$x_syslog_on" = "yes"; then
140         AC_DEFINE(SYSLOG, 1)
141         AC_CHECK_HEADERS(syslog.h)
142 fi
143
144 x_zlib_on=no
145 AC_ARG_WITH(zlib,
146         [  --without-zlib          disable zlib compression (autodetected by default)],
147         [       if test "$withval" = "yes"; then
148                         AC_CHECK_LIB(z, deflate)
149                         AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
150                                 AC_MSG_ERROR([Can't enable zlib!])
151                         )
152                 fi
153         ],
154         [       AC_CHECK_LIB(z, deflate)
155                 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
156         ]
157 )
158 if test "$x_zlib_on" = "yes"; then
159         AC_DEFINE(ZLIB, 1)
160         AC_CHECK_HEADERS(zlib.h)
161 fi
162
163 x_tcpwrap_on=no
164 AC_ARG_WITH(tcp-wrappers,
165         [  --with-tcp-wrappers     enable TCP wrappers support],
166         [       if test "$withval" = "yes"; then
167                         AC_CHECK_LIB(wrap, tcpd_warn)
168                         AC_MSG_CHECKING(for hosts_access)
169                         AC_TRY_LINK([
170                                 #include <tcpd.h>
171                                 ],[
172                                 void *ptr;
173                                 ptr = hosts_access;
174                                 ],[
175                                 AC_MSG_RESULT(yes)
176                                 AC_DEFINE(TCPWRAP, 1)
177                                 x_tcpwrap_on=yes
178                                 ],[
179                                 AC_MSG_RESULT(no)
180                                 AC_MSG_ERROR([Can't enable TCP wrappers!])
181                         ])
182                 fi
183         ]
184 )
185
186 x_rendezvous_on=no
187 AC_ARG_WITH(rendezvous,
188         [  --with-rendezvous       enable support for "Rendezvous"],
189         [       if test "$withval" = "yes"; then
190                         AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=yes,
191                                 AC_MSG_ERROR([Can't enable Rendezvous!])
192                         )
193                 fi
194         ]
195 )
196 if test "$x_rendezvous_on" = "yes"; then
197         AC_DEFINE(RENDEZVOUS, 1)
198         AC_CHECK_HEADERS(DNSServiceDiscovery/DNSServiceDiscovery.h mach/port.h)
199 fi
200
201 x_identauth_on=no
202 AC_ARG_WITH(ident,
203         [  --with-ident            enable "IDENT" ("AUTH") protocol support],
204         [       if test "$withval" = "yes"; then
205                         AC_CHECK_LIB(ident, ident_id)
206                         AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
207                                 AC_MSG_ERROR([Can't enable IDENT support!])
208                         )
209                 fi
210         ]
211 )
212 if test "$x_identauth_on" = "yes"; then
213         AC_DEFINE(IDENTAUTH, 1)
214         AC_CHECK_HEADERS(ident.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         test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
242 fi
243
244 x_strict_rfc_on=no
245 AC_ARG_ENABLE(strict-rfc,
246         [  --enable-strict-rfc     strict RFC conformance -- may break clients!],
247         if test "$enableval" = "yes"; then
248                 AC_DEFINE(STRICT_RFC, 1)
249                 x_strict_rfc_on=yes
250         fi
251 )
252
253 # -- Definitions --
254
255 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
256 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
257 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
258
259 # Add additional CFLAGS, eventually specified on the command line, but after
260 # running this configure script. Useful for "-Werror" for example.
261 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
262
263 # -- Generate files --
264
265 AC_OUTPUT([ \
266         Makefile \
267         doc/Makefile \
268         src/Makefile \
269         src/portab/Makefile \
270         src/tool/Makefile \
271         src/ngircd/Makefile \
272         src/testsuite/Makefile \
273         man/Makefile \
274         contrib/Makefile \
275         contrib/Debian/Makefile \
276         contrib/MacOSX/Makefile \
277 ])
278
279 type dpkg >/dev/null 2>&1
280 if test $? -eq 0; then
281         # Generate debian/ link if the dpkg command exists
282         # (read: if we are running on a debian compatible system)
283         echo "creating Debian-specific links ..."
284         test -f debian/rules || ln -s contrib/Debian debian
285 fi
286
287 # -- Result --
288
289 echo
290 echo "ngIRCd has been configured with the following options:"
291 echo
292
293 # Someone please show me a better way :)  [borrowed by OpenSSH]
294 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
295 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
296 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
297 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
298 D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
299
300 echo "               Host: ${host}"
301 echo "           Compiler: ${CC}"
302 test -n "$CFLAGS"       && echo "     Compiler flags: ${CFLAGS}"
303 test -n "$CPPFLAGS"     && echo " Preprocessor flags: ${CPPFLAGS}"
304 test -n "$LDFLAGS"      && echo "       Linker flags: ${LDFLAGS}"
305 test -n "$LIBS"         && echo "          Libraries: ${LIBS}"
306 echo
307 echo "    'ngircd' binary: $S"
308 echo " Configuration file: $C"
309 echo "       Manual pages: $M"
310 echo "      Documentation: $D"
311 echo
312
313 echo $ECHO_N "     Syslog support: $ECHO_C"
314 test "$x_syslog_on" = "yes" \
315         && echo $ECHO_N "yes $ECHO_C" \
316         || echo $ECHO_N "no  $ECHO_C"
317 echo $ECHO_N "  Enable debug code: $ECHO_C"
318 test "$x_debug_on" = "yes" \
319         && echo "yes" \
320         || echo "no"
321
322 echo $ECHO_N "   zlib compression: $ECHO_C"
323 test "$x_zlib_on" = "yes" \
324         && echo $ECHO_N "yes $ECHO_C" \
325         || echo $ECHO_N "no  $ECHO_C"
326 echo $ECHO_N "        IRC sniffer: $ECHO_C"
327 test "$x_sniffer_on" = "yes" \
328         && echo "yes" \
329         || echo "no"
330
331 echo $ECHO_N "   Use TCP Wrappers: $ECHO_C"
332 test "$x_tcpwrap_on" = "yes" \
333         && echo $ECHO_N "yes $ECHO_C" \
334         || echo $ECHO_N "no  $ECHO_C"
335 echo $ECHO_N "    Strict RFC mode: $ECHO_C"
336 test "$x_strict_rfc_on" = "yes" \
337         && echo "yes" \
338         || echo "no"
339
340 echo $ECHO_N " Rendezvous support: $ECHO_C"
341 test "$x_rendezvous_on" = "yes" \
342         && echo $ECHO_N "yes $ECHO_C" \
343         || echo $ECHO_N "no  $ECHO_C"
344 echo $ECHO_N "      IRC+ protocol: $ECHO_C"
345 test "$x_ircplus_on" = "yes" \
346         && echo "yes" \
347         || echo "no"
348
349 echo $ECHO_N "      IDENT support: $ECHO_C"
350 test "$x_identauth_on" = "yes" \
351         && echo $ECHO_N "yes $ECHO_C" \
352         || echo $ECHO_N "no  $ECHO_C"
353
354 echo; echo
355
356 # -eof-