]> arthur.barton.de Git - ngircd-alex.git/blob - configure.in
- Enhanced check for select() and poll().
[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.73 2002/12/28 15:17:46 alex Exp $
13 #
14
15 # -- Initialisierung --
16
17 AC_INIT
18 AC_PREREQ(2.50)
19 AC_CANONICAL_TARGET
20 AC_CONFIG_SRCDIR(src/config.h.in)
21 AM_INIT_AUTOMAKE(ngircd,CVSHEAD)
22 AM_CONFIG_HEADER(src/config.h)
23
24 # -- Templates fuer config.h --
25
26 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
27 AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
28 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
29 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
30 AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
31 AH_TEMPLATE([USE_ZLIB], [Define if zlib compression should be enabled])
32 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
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([ \
85         arpa/inet.h ctype.h malloc.h stdint.h sys/select.h sys/poll.h \
86         varargs.h])
87
88 # -- Datentypen --
89
90 AC_MSG_CHECKING(whether socklen_t exists)
91 AC_TRY_COMPILE([
92         #include <sys/socket.h>
93         #include <sys/types.h>
94         ],[
95         socklen_t a, b;
96         a = 2; b = 4; a += b;
97         ],[
98         AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
99         ],[
100         AC_MSG_RESULT(no)
101 ])
102
103 AC_TYPE_SIGNAL
104
105 AC_TYPE_SIZE_T
106
107 # -- Libraries --
108
109 AC_CHECK_LIB(UTIL,memmove)
110 AC_CHECK_LIB(socket,bind)
111 AC_CHECK_LIB(nsl,gethostent)
112
113 # -- Funktionen --
114
115 AC_FUNC_MALLOC
116
117 AC_FUNC_FORK
118
119 AC_FUNC_STRFTIME
120
121 AC_CHECK_FUNCS([ \
122         bind gethostbyaddr gethostbyname gethostname inet_ntoa memmove \
123         memset setsockopt socket strcasecmp strchr strerror strstr waitpid \
124         ],,AC_MSG_ERROR([required function missing!]))
125
126 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strlcpy strlcat)
127
128 AC_CHECK_FUNCS(poll,,
129         [AC_CHECK_FUNCS(select,,
130                 AC_MSG_ERROR([neither poll() nor select() is supported!]))
131         ]
132 )
133
134 # -- Konfigurationsoptionen --
135
136 x_syslog_on=no
137 AC_ARG_ENABLE(syslog,
138         [  --disable-syslog        disable syslog (autodetected by default)],
139         [       if test "$enableval" = "yes"; then
140                         AC_CHECK_HEADER(syslog.h, x_syslog_on=yes,
141                                 AC_MSG_ERROR([Can't enable syslog: syslog.h not found!])
142                         )
143                 fi
144         ],
145         [       AC_CHECK_HEADER(syslog.h, x_syslog_on=yes) ]
146 )
147 if test "$x_syslog_on" = "yes"; then
148         AC_DEFINE(USE_SYSLOG, 1)
149         AC_CHECK_LIB(be,syslog)
150 fi
151
152 x_zlib_on=no
153 AC_ARG_ENABLE(zlib,
154         [  --disable-zlib          disable zlib compression (autodetected by default)],
155         [       if test "$enableval" = "yes"; then
156                         AC_CHECK_HEADER(zlib.h, x_zlib_on=yes,
157                                 AC_MSG_ERROR([Can't enable zlib: zlib.h not found!])
158                         )
159                 fi
160         ],
161         [       AC_CHECK_HEADER(zlib.h, x_zlib_on=yes) ]
162 )
163 if test "$x_zlib_on" = "yes"; then
164         AC_DEFINE(USE_ZLIB, 1)
165         AC_CHECK_LIB(z,deflate)
166 fi
167
168 x_ircplus_on=yes
169 AC_ARG_ENABLE(ircplus,
170         [  --disable-ircplus       disable IRC+ protocol],
171         if test "$enableval" = "no"; then x_ircplus_on=no; fi
172 )
173 if test "$x_ircplus_on" = "yes"; then
174         AC_DEFINE(IRCPLUS, 1)
175 fi
176
177 AC_ARG_ENABLE(sniffer,
178         [  --enable-sniffer        enable IRC traffic sniffer (enables debug mode)],
179         if test "$enableval" = "yes"; then
180                 AC_DEFINE(SNIFFER, 1)
181                 x_sniffer_on=yes; x_debug_on=yes
182         fi
183 )
184
185 AC_ARG_ENABLE(debug,
186         [  --enable-debug          show additional debug output],
187         if test "$enableval" = "yes"; then x_debug_on=yes; fi
188 )
189 if test "$x_debug_on" = "yes"; then
190         AC_DEFINE(DEBUG, 1)
191 fi
192
193 AC_ARG_ENABLE(strict-rfc,
194         [  --enable-strict-rfc     strict RFC conformance -- may break clients!],
195         if test "$enableval" = "yes"; then
196                 AC_DEFINE(STRICT_RFC, 1)
197                 x_strict_rfc_on=yes
198         fi
199 )
200
201
202 # -- Definitionen --
203
204 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
205 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
206 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
207
208 # -- Variablen --
209
210 if test "$GCC" = "yes"; then
211         the_CFLAGS="-Wall -Wtraditional -Wpointer-arith -Wstrict-prototypes"
212         add_CFLAGS="$CFLAGS $CFLAGS_ADD"
213 else
214         the_CFLAGS="$CFLAGS"
215         add_CFLAGS="$CFLAGS_ADD"
216 fi
217
218 CFLAGS="$the_CFLAGS $add_CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
219
220 # -- Ausgabe der Dateien --
221
222 AC_OUTPUT([ \
223         Makefile \
224         doc/Makefile \
225         doc/en/Makefile \
226         MacOSX/Makefile \
227         MacOSX/ngircd.pbproj/Makefile \
228         src/Makefile \
229         src/portab/Makefile \
230         src/ngircd/Makefile \
231         src/testsuite/Makefile \
232         man/Makefile \
233         contrib/Makefile \
234 ])
235
236 # -- Ergebnis --
237
238 echo
239
240 # Someone please show me a better way :)  [borrowed by OpenSSH]
241 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
242 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
243 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
244 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
245
246 echo "                host: ${host}"
247 echo "            compiler: ${CC}"
248 echo "      compiler flags: ${the_CFLAGS}"
249 test -n "$add_CFLAGS" && echo "                      ${add_CFLAGS}"
250 echo "  preprocessor flags: ${CPPFLAGS}"
251 echo "        linker flags: ${LDFLAGS}"
252 echo "           libraries: ${LIBS}"
253 echo
254 echo "     'ngircd' binary: $S"
255 echo "  configuration file: $C"
256 echo "        manual pages: $M"
257 echo
258
259 echo $ECHO_N "      active options: $ECHO_C"
260 test "$x_syslog_on" = "yes"     && echo $ECHO_N "Syslog $ECHO_C"
261 test "$x_zlib_on" = "yes"       && echo $ECHO_N "zLib $ECHO_C"
262 test "$x_debug_on" = "yes"      && echo $ECHO_N "Debug $ECHO_C"
263 test "$x_sniffer_on" = "yes"    && echo $ECHO_N "Sniffer $ECHO_C"
264 test "$x_strict_rfc_on" = "yes" && echo $ECHO_N "Strict-RFC $ECHO_C"
265 test "$x_ircplus_on" = "yes"    && echo $ECHO_N "IRC+ $ECHO_C"
266 echo; echo
267
268 # -eof-