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