]>
Commit | Line | Data |
---|---|---|
030272f3 | 1 | dnl $Id: configure.ac 26260 2008-12-10 04:08:39Z androsyn $ |
db137867 AC |
2 | dnl Process this file with autoconf to produce a configure script. |
3 | ||
4 | dnl TODO: clean up all the OpenSSL and shared module checking stuff; | |
5 | dnl the most major changes have already been made and it looks like | |
6 | dnl said functions need to be just about as complex as they already are. | |
7 | ||
030272f3 | 8 | AC_PREREQ(2.63) |
db137867 AC |
9 | AUTOMAKE_OPTIONS = 1.10 |
10 | dnl Sneaky way to get an Id tag into the configure script | |
030272f3 | 11 | AC_COPYRIGHT([$Id: configure.ac 26260 2008-12-10 04:08:39Z androsyn $]) |
db137867 AC |
12 | AC_INIT([libratbox],[devel]) |
13 | AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, -) | |
c52df125 | 14 | AM_SILENT_RULES([yes]) |
db137867 AC |
15 | |
16 | AM_CONFIG_HEADER(include/libratbox_config.h) | |
17 | ||
18 | AC_PREFIX_DEFAULT(/usr/local/libratbox) | |
19 | AC_GNU_SOURCE | |
20 | ||
21 | dnl Checks for programs. | |
22 | AC_PROG_CC_C99 | |
23 | ||
24 | if test x"$ac_cv_prog_cc_c99" = "xno"; then | |
25 | AC_ERROR([ircd-ratbox requires a C99 capable compiler]) | |
26 | fi | |
27 | ||
28 | ||
29 | AC_PROG_INSTALL | |
30 | AC_PROG_EGREP | |
31 | AC_PROG_SED | |
32 | ||
33 | F77=no | |
34 | CXX=no | |
35 | GCJ=no | |
36 | ||
37 | AM_DISABLE_STATIC | |
38 | AM_ENABLE_SHARED | |
39 | AM_MAINTAINER_MODE | |
40 | ||
41 | AC_ISC_POSIX | |
42 | AC_C_INLINE | |
43 | AC_C_CONST | |
f171dafb | 44 | AC_C_BIGENDIAN |
db137867 AC |
45 | AC_PROG_MAKE_SET |
46 | AC_PROG_INSTALL | |
47 | AC_PATH_PROG(AUTOMAKE, automake) | |
48 | AC_PATH_PROG(ACLOCAL, aclocal) | |
49 | AC_PATH_PROG(AUTOHEADER, autoheader) | |
50 | AC_PATH_PROG(AS, as) | |
51 | AC_PATH_PROG(RM, rm) | |
52 | AC_PATH_PROG(CP, cp) | |
53 | AC_PATH_PROG(MV, mv) | |
54 | AC_PATH_PROG(LN, ln) | |
db137867 AC |
55 | AC_PATH_PROG(TOUCH, touch) |
56 | AC_LANG(C) | |
57 | ||
58 | AC_PROG_LIBTOOL | |
59 | ||
60 | LIBTOOL="$LIBTOOL --silent" | |
61 | ||
db137867 AC |
62 | case "$host_os" in |
63 | *cygwin*) | |
64 | AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) | |
65 | AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) | |
66 | ;; | |
67 | *mingw*) | |
68 | AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) | |
69 | AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) | |
70 | AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])]) | |
71 | AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])]) | |
3202e249 VY |
72 | AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, [Have WINSOCK2_H]) |
73 | AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, [Have WINSOCK_H]) | |
db137867 AC |
74 | LIBS="$LIBS -lws2_32 -liphlpapi" |
75 | is_mingw="yes" | |
76 | ;; | |
77 | *interix*) | |
78 | CPPFLAGS="$CFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500" | |
79 | ;; | |
030272f3 VY |
80 | *solaris*) |
81 | CPPFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2" | |
db137867 AC |
82 | ;; |
83 | *) | |
84 | ;; | |
85 | esac | |
86 | ||
87 | AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) | |
88 | ||
89 | ||
90 | # backwards support for IRC_CFLAGS | |
3202e249 | 91 | CFLAGS="$IRC_CFLAGS $CFLAGS -Wall" |
db137867 AC |
92 | |
93 | dnl use directory structure of cached as default (hack) | |
94 | if test "$libexecdir" = '${exec_prefix}/libexec' && | |
95 | test "$localstatedir" = '${prefix}/var'; then | |
96 | libexecdir='${bindir}' | |
97 | localstatedir='${prefix}' | |
98 | fi | |
99 | ||
db137867 AC |
100 | AC_TYPE_PID_T |
101 | AC_TYPE_SIZE_T | |
102 | AC_TYPE_SSIZE_T | |
103 | AC_TYPE_UID_T | |
104 | ||
105 | ||
106 | dnl Checks for header files. | |
107 | AC_HEADER_STDC | |
108 | ||
77cb59b3 | 109 | AC_CHECK_HEADERS([crypt.h unistd.h sys/socket.h sys/stat.h sys/time.h time.h netinet/in.h arpa/inet.h errno.h sys/uio.h spawn.h sys/poll.h sys/epoll.h sys/select.h sys/devpoll.h sys/event.h port.h signal.h sys/signalfd.h sys/timerfd.h linux/tcp.h]) |
db137867 AC |
110 | AC_HEADER_TIME |
111 | ||
112 | dnl Networking Functions | |
113 | dnl ==================== | |
114 | ||
115 | AC_SEARCH_LIBS(socket, [socket],,) | |
116 | ||
117 | ||
118 | AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len' | |
119 | member.])],,[[ | |
120 | #ifdef HAVE_SYS_TYPES_H | |
121 | #include <sys/types.h> | |
122 | #endif | |
123 | #ifdef HAVE_SYS_SOCKET_H | |
124 | #include <sys/socket.h> | |
125 | #endif | |
126 | #ifdef HAVE_WINSOCK2_H | |
127 | #include <winsock2.h> | |
128 | #endif | |
129 | ]]) | |
130 | ||
030272f3 | 131 | AC_CHECK_TYPE([socklen_t], rb_cv_socklen_t=socklen_t,[ |
a9fb3ed0 | 132 | AC_MSG_CHECKING([for socklen_t equivalent]) |
030272f3 | 133 | AC_CACHE_VAL([rb_cv_socklen_t], |
a9fb3ed0 VY |
134 | [ |
135 | # Systems have either "struct sockaddr *" or | |
136 | # "void *" as the second argument to getpeername | |
030272f3 | 137 | rb_cv_socklen_t= |
a9fb3ed0 VY |
138 | for arg2 in "struct sockaddr" void; do |
139 | for t in int size_t unsigned long "unsigned long"; do | |
140 | AC_TRY_COMPILE([ | |
3202e249 | 141 | #ifdef HAVE_SYS_TYPES_H |
db137867 | 142 | #include <sys/types.h> |
3202e249 VY |
143 | #endif |
144 | #ifdef HAVE_SYS_SOCKET_H | |
db137867 | 145 | #include <sys/socket.h> |
3202e249 VY |
146 | #endif |
147 | #ifdef HAVE_WINSOCK2_H | |
148 | #include <winsock2.h> | |
149 | #endif | |
a9fb3ed0 VY |
150 | int getpeername (int, $arg2 *, $t *); |
151 | ],[ | |
152 | $t len; | |
153 | getpeername(0,0,&len); | |
154 | ],[ | |
030272f3 | 155 | rb_cv_socklen_t="$t" |
a9fb3ed0 | 156 | break |
db137867 | 157 | ]) |
a9fb3ed0 VY |
158 | done |
159 | done | |
160 | ||
030272f3 | 161 | if test "x$rb_cv_socklen_t" = x; then |
3202e249 | 162 | AC_MSG_WARN([Cannot find a type to use in place of socklen_t using int]) |
030272f3 | 163 | rb_cv_socklen_t=int |
a9fb3ed0 VY |
164 | fi |
165 | ]) | |
030272f3 | 166 | AC_MSG_RESULT($rb_cv_socklen_t)], |
a9fb3ed0 VY |
167 | [#include <sys/types.h> |
168 | #include <sys/socket.h>]) | |
169 | ||
030272f3 VY |
170 | rb_socklen_t=$rb_cv_socklen_t |
171 | ||
a9fb3ed0 VY |
172 | |
173 | ||
174 | ||
db137867 AC |
175 | |
176 | AC_ARG_ENABLE(ipv6,AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),[ipv6=$enableval],[ipv6=yes]) | |
177 | ||
178 | if test x$ipv6 != xyes; then | |
179 | have_v6="no" | |
180 | else | |
181 | ||
182 | have_v6=yes | |
183 | RB_PROTO_INET6([], [ | |
184 | AC_MSG_NOTICE([Disabling IPv6 support: PF_INET6 not found]) | |
185 | have_v6=no | |
186 | ]) | |
187 | ||
188 | if test "X$have_v6" = "Xyes"; then | |
189 | RB_TYPE_STRUCT_SOCKADDR_IN6([], [ | |
190 | AC_MSG_NOTICE([Disabling IPv6 support: struct sockaddr_in6 not found]) | |
191 | have_v6=no | |
192 | ]) | |
193 | fi | |
194 | ||
195 | fi | |
196 | ||
197 | AC_CHECK_TYPES([struct sockaddr_storage],[ | |
198 | rb_have_sockaddr_storage=yes | |
199 | ],[], [ | |
200 | #include <sys/types.h> | |
201 | #include <sys/socket.h> | |
202 | ]) | |
203 | ||
204 | ||
db137867 AC |
205 | dnl Check for stdarg.h - if we cant find it, halt configure |
206 | AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - libratbox will not compile without it **])]) | |
207 | ||
208 | AC_CHECK_TYPE([sa_family_t], [], | |
209 | [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], | |
210 | [[#include <sys/types.h> | |
211 | #include <sys/socket.h>]]) | |
212 | ||
213 | ||
214 | dnl check for various functions... | |
3202e249 | 215 | AC_CHECK_FUNCS([socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) |
db137867 AC |
216 | |
217 | AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) | |
218 | AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create])) | |
219 | RB_CHECK_TIMER_CREATE | |
3202e249 | 220 | RB_CHECK_TIMERFD_CREATE |
db137867 AC |
221 | |
222 | AC_FUNC_ALLOCA | |
223 | AC_FUNC_VFORK | |
224 | AC_FUNC_MMAP | |
225 | ||
226 | AC_MSG_CHECKING(for /dev/poll) | |
227 | if test -c "/dev/poll"; then | |
228 | AC_MSG_RESULT(yes) | |
229 | AC_DEFINE(HAVE_DEVPOLL, [1], [Define to 1 if you have devpoll]) | |
230 | else | |
231 | AC_MSG_RESULT(no) | |
232 | fi | |
233 | ||
234 | ||
235 | if test "$is_mingw" = "yes"; then | |
236 | AC_DEFINE(HAVE_WIN32, [1], [Define to 1 if you are on windows]) | |
237 | fi | |
238 | ||
239 | ||
240 | dnl OpenSSL support | |
241 | AC_MSG_CHECKING(for OpenSSL) | |
242 | AC_ARG_ENABLE(openssl, | |
243 | [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).]) | |
244 | AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])], | |
245 | [cf_enable_openssl=$enableval], | |
246 | [cf_enable_openssl="auto"]) | |
247 | ||
248 | if test "$cf_enable_openssl" != "no" ; then | |
249 | cf_openssl_basedir="" | |
250 | if test "$cf_enable_openssl" != "auto" && | |
251 | test "$cf_enable_openssl" != "yes" ; then | |
252 | dnl Support for --enable-openssl=/some/place | |
253 | cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`" | |
254 | else | |
255 | dnl Do the auto-probe here. Check some common directory paths. | |
256 | for dirs in /usr/local/ssl /usr/pkg /usr/local \ | |
257 | /usr/local/openssl ; do | |
258 | if test -f "${dirs}/include/openssl/opensslv.h" ; then | |
259 | cf_openssl_basedir="${dirs}" | |
260 | break | |
261 | fi | |
262 | done | |
263 | unset dirs | |
264 | fi | |
265 | dnl Now check cf_openssl_found to see if we found anything. | |
266 | if test ! -z "$cf_openssl_basedir"; then | |
267 | if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then | |
c2ac22cc | 268 | SSL_CFLAGS="-I${cf_openssl_basedir}/include" |
db137867 AC |
269 | SSL_LIBS="-L${cf_openssl_basedir}/lib" |
270 | else | |
271 | dnl OpenSSL wasn't found in the directory specified. Naughty | |
272 | dnl administrator... | |
273 | cf_openssl_basedir="" | |
274 | fi | |
275 | else | |
276 | dnl Check for stock FreeBSD 4.x and 5.x systems, since their files | |
277 | dnl are in /usr/include and /usr/lib. In this case, we don't want to | |
278 | dnl change INCLUDES or LIBS, but still want to enable OpenSSL. | |
279 | dnl We can't do this check above, because some people want two versions | |
280 | dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl) | |
281 | dnl and they want /usr/local/ssl to have preference. | |
282 | if test -f "/usr/include/openssl/opensslv.h" ; then | |
283 | cf_openssl_basedir="/usr" | |
284 | fi | |
285 | fi | |
286 | ||
287 | dnl If we have a basedir defined, then everything is okay. Otherwise, | |
288 | dnl we have a problem. | |
289 | if test ! -z "$cf_openssl_basedir"; then | |
290 | AC_MSG_RESULT($cf_openssl_basedir) | |
291 | cf_enable_openssl="yes" | |
292 | else | |
293 | AC_MSG_RESULT([not found. Specify a correct path?]) | |
294 | cf_enable_openssl="no" | |
295 | fi | |
296 | unset cf_openssl_basedir | |
297 | else | |
298 | dnl If --disable-openssl was specified | |
299 | AC_MSG_RESULT(disabled) | |
300 | fi | |
301 | ||
302 | save_CPPFLAGS="$CPPFLAGS" | |
c2ac22cc | 303 | CPPFLAGS="$CPPFLAGS $SSL_CFLAGS" |
db137867 AC |
304 | save_LIBS="$LIBS" |
305 | LIBS="$LIBS $SSL_LIBS" | |
306 | if test "$cf_enable_openssl" != no; then | |
307 | dnl Check OpenSSL version (must be 0.9.7 or above!) | |
308 | AC_MSG_CHECKING(for OpenSSL 0.9.7 or above) | |
309 | AC_RUN_IFELSE( | |
310 | AC_LANG_PROGRAM( | |
311 | [#include <openssl/opensslv.h> | |
312 | #include <stdlib.h>], | |
313 | [[if (OPENSSL_VERSION_NUMBER >= 0x00907000) | |
314 | exit(0); else exit(1);]]), | |
315 | cf_enable_openssl=yes, | |
316 | cf_enable_openssl=no, | |
317 | cf_enable_openssl=no) | |
318 | ||
319 | if test "$cf_enable_openssl" != no; then | |
320 | AC_MSG_RESULT(found) | |
321 | else | |
322 | AC_MSG_RESULT(no - OpenSSL support disabled) | |
323 | fi | |
324 | ||
325 | fi | |
326 | ||
327 | ||
328 | if test "$cf_enable_openssl" != no; then | |
329 | CPPFLAGS="$CPPFLAGS $SSL_LIBS" | |
330 | AC_CHECK_LIB(crypto, RAND_status, | |
331 | [cf_enable_openssl=yes], | |
332 | [cf_enable_openssl=no]) | |
333 | fi | |
334 | ||
db137867 AC |
335 | if test "$cf_enable_openssl" != no; then |
336 | CPPFLAGS="$CPPFLAGS $SSL_LIBS" | |
337 | AC_CHECK_LIB(ssl, SSL_read, | |
3202e249 | 338 | [SSL_LIBS="$SSL_LIBS -lssl -lcrypto"], |
db137867 AC |
339 | [cf_enable_openssl=no], [-lcrypto]) |
340 | fi | |
341 | ||
c2ac22cc | 342 | |
6f57a957 AC |
343 | dnl mbedTLS support |
344 | AC_ARG_ENABLE(mbedtls, | |
345 | [AC_HELP_STRING([--enable-mbedtls], [Enable mbedTLS support.]) | |
346 | AC_HELP_STRING([--disable-mbedtls], [Disable mbedTLS support.])], | |
347 | [cf_enable_mbedtls=$enableval], | |
348 | [cf_enable_mbedtls="auto"]) | |
349 | ||
350 | if test "$cf_enable_mbedtls" != no; then | |
351 | save_CPPFLAGS="$CPPFLAGS" | |
352 | save_LIBS="$LIBS" | |
353 | LIBS="$LIBS $MBEDTLS_LIBS" | |
354 | AC_CHECK_LIB(mbedtls, mbedtls_ssl_init, [ | |
355 | MBEDTLS_LIBS="$MBEDTLS_LIBS -lmbedtls -lmbedcrypto -lmbedx509" | |
356 | cf_enable_mbedtls=yes | |
357 | ], [cf_enable_mbedtls=no], [-lmbedcrypto -lmbedx509]) | |
358 | fi | |
c2ac22cc | 359 | |
2bd29df9 AB |
360 | dnl GnuTLS support |
361 | AC_MSG_CHECKING(for GnuTLS) | |
362 | AC_ARG_ENABLE(gnutls, | |
363 | [AC_HELP_STRING([--enable-gnutls],[Enable GnuTLS support.]) | |
364 | AC_HELP_STRING([--disable-gnutls],[Disable GnuTLS support.])], | |
365 | [cf_enable_gnutls=$enableval], | |
366 | [cf_enable_gnutls="auto"]) | |
367 | ||
368 | if test "$cf_enable_gnutls" != no; then | |
369 | PKG_CHECK_MODULES(GNUTLS, [gnutls], [ | |
370 | cf_enable_gnutls="yes" | |
371 | ], [cf_enable_gnutls="no"]) | |
372 | fi | |
373 | ||
6f57a957 AC |
374 | dnl mbed TLS is given highest preference when no specified TLS library is provided |
375 | if test "$cf_enable_openssl" = "auto" -a "$cf_enable_mbedtls" = "yes"; then | |
376 | cf_enable_openssl="no" | |
377 | fi | |
378 | ||
379 | if test "$cf_enable_gnutls" = "auto" -a "$cf_enable_openssl" = "yes" -a "$cf_enable_mbedtls" = "yes"; then | |
2bd29df9 AB |
380 | cf_enable_gnutls="no" |
381 | fi | |
382 | ||
c2ac22cc | 383 | if test x"$cf_enable_openssl" != xno; then |
db137867 | 384 | AC_DEFINE(HAVE_OPENSSL,1,[Has OpenSSL]) |
2bd29df9 AB |
385 | GNUTLS_CFLAGS="" |
386 | GNUTLS_LIBS="" | |
6f57a957 AC |
387 | MBEDTLS_LIBS="" |
388 | MBEDTLS_CFLAGS="" | |
c2ac22cc | 389 | SSL_TYPE="openssl" |
6f57a957 AC |
390 | elif test x"$cf_enable_mbedtls" != xno; then |
391 | AC_DEFINE(HAVE_MBEDTLS, 1, [Has mbedTLS]) | |
392 | SSL_LIBS="" | |
393 | SSL_CFLAGS="" | |
394 | GNUTLS_CFLAGS="" | |
395 | GNUTLS_LIBS="" | |
396 | SSL_TYPE="mbedtls" | |
2bd29df9 AB |
397 | elif test x"$cf_enable_gnutls" != xno; then |
398 | AC_DEFINE(HAVE_GNUTLS, 1, [Has GnuTLS]) | |
399 | SSL_LIBS="" | |
6f57a957 AC |
400 | SSL_CFLAGS="" |
401 | MBEDTLS_LIBS="" | |
402 | MBEDTLS_CFLAGS="" | |
2bd29df9 | 403 | SSL_TYPE="gnutls" |
db137867 AC |
404 | fi |
405 | ||
406 | ||
c2ac22cc VY |
407 | |
408 | ||
db137867 AC |
409 | CPPFLAGS="$save_CPPFLAGS" |
410 | LIBS="$save_LIBS" | |
411 | ||
412 | dnl End OpenSSL detection | |
413 | ||
414 | ||
415 | ||
416 | ||
417 | dnl Debug-related options | |
418 | dnl ===================== | |
419 | ||
420 | AC_ARG_ENABLE(assert, | |
421 | AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]), | |
422 | [assert=$enableval], [assert=no]) | |
423 | ||
424 | if test "$assert" = no; then | |
425 | AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) | |
426 | elif test "$assert" = soft; then | |
427 | AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.]) | |
428 | AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) | |
429 | elif test "$assert" = yes; then | |
430 | assert = "hard"; | |
431 | fi | |
432 | ||
433 | AC_MSG_CHECKING(if you want to do a profile build) | |
434 | AC_ARG_ENABLE(profile, | |
435 | AC_HELP_STRING([--enable-profile],[Enable profiling]), | |
436 | [profile=$enableval], [profile=no]) | |
437 | ||
438 | if test "$profile" = yes; then | |
439 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
440 | CFLAGS="$CFLAGS -pg -static" | |
441 | AC_MSG_RESULT([yes, adding -pg -static]) | |
442 | AC_DEFINE(RATBOX_PROFILE, 1, [Defined to mark profiling is enabled]) | |
443 | else | |
444 | AC_MSG_RESULT([no, profile builds only work with gcc]) | |
445 | fi | |
446 | else | |
447 | AC_MSG_RESULT(no) | |
448 | fi | |
449 | ||
450 | AC_ARG_ENABLE(balloc, | |
451 | AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]), | |
452 | [balloc=$enableval], [balloc=yes]) | |
453 | ||
454 | if test "$balloc" = no; then | |
455 | AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.]) | |
456 | fi | |
457 | ||
458 | AC_ARG_ENABLE(warnings, | |
459 | AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), | |
460 | [CFLAGS="$CFLAGS -Wall -Werror -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[]) | |
461 | ||
462 | AC_SUBST(LDFLAGS) | |
463 | AC_SUBST(PICFLAGS) | |
464 | AC_SUBST(CFLAGS) | |
465 | AC_SUBST(SEDOBJ) | |
c2ac22cc | 466 | AC_SUBST(SSL_CFLAGS) |
db137867 | 467 | AC_SUBST(SSL_LIBS) |
2bd29df9 AB |
468 | AC_SUBST(GNUTLS_CFLAGS) |
469 | AC_SUBST(GNUTLS_LIBS) | |
cd492e44 AC |
470 | AC_SUBST(MBEDTLS_CFLAGS) |
471 | AC_SUBST(MBEDTLS_LIBS) | |
db137867 AC |
472 | |
473 | if test "$prefix" = "NONE"; then | |
474 | AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where libratbox is installed.]) | |
475 | ||
476 | else | |
477 | ||
478 | dnl Don't get bitten by Cygwin's stupidity if the user specified | |
479 | dnl a custom prefix with a trailing slash | |
480 | ||
481 | prefix=`echo $prefix | sed 's/\/$//'` | |
482 | AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where libratbox is installed.]) | |
483 | ||
484 | fi | |
485 | ||
486 | AC_SUBST(RB_PREFIX) | |
487 | ||
db137867 AC |
488 | AC_CONFIG_COMMANDS([include/librb-config.h], |
489 | [ | |
490 | outfile=include/librb-config.h.tmp | |
491 | cat > $outfile <<\_______EOF | |
492 | /* | |
493 | * librb-config.h: libratbox config file. Please modify configure.ac | |
494 | */ | |
495 | ||
496 | #ifndef __LIBRB_CONFIG_H | |
497 | #define __LIBRB_CONFIG_H | |
498 | ||
499 | _______EOF | |
500 | ||
501 | if test "x$rb_have_ipv6" = "xyes"; then | |
502 | echo "#define RB_IPV6 1" >> $outfile | |
503 | fi | |
504 | ||
505 | if test "x$rb_windows_h" = "xyes"; then | |
506 | echo '#define WIN32_LEAN_AND_MEAN 1' >> $outfile | |
507 | echo '#include <windows.h>' >> $outfile | |
508 | echo '#include <winsock2.h>' >> $outfile | |
509 | echo '#include <iphlpapi.h>' >> $outfile | |
510 | fi | |
511 | ||
512 | if test "x$rb_alloca_h" = "xyes"; then | |
513 | echo '#define RB_HAVE_ALLOCA_H 1' >> $outfile | |
514 | fi | |
515 | ||
516 | if test "x$rb_header_stdc" = "xyes"; then | |
517 | echo '#include <stdlib.h>' >> $outfile | |
518 | echo '#include <stddef.h>' >> $outfile | |
519 | elif test "x$rb_header_stdlib" = "xyes"; then | |
520 | echo '#include <stdlib.h>' >> $outfile | |
521 | fi | |
522 | ||
523 | if test "x$rb_header_string_h" = "xyes"; then | |
524 | echo '#include <string.h>' >> $outfile | |
525 | fi | |
526 | ||
527 | if test "x$rb_stdint_h" = "xyes"; then | |
528 | echo '#include <stdint.h>' >> $outfile | |
529 | fi | |
530 | ||
531 | if test "x$rb_inttypes_h" = "xyes"; then | |
532 | echo '#include <inttypes.h>' >> $outfile | |
533 | fi | |
534 | ||
535 | if test "x$rb_sys_types_h" = "xyes"; then | |
536 | echo '#include <sys/types.h>' >> $outfile | |
537 | fi | |
538 | if test "x$rb_sys_time_h" = "xyes"; then | |
539 | echo '#include <sys/time.h>' >> $outfile | |
540 | fi | |
541 | if test "x$rb_sys_stat_h" = "xyes"; then | |
542 | echo '#include <sys/stat.h>' >> $outfile | |
543 | fi | |
544 | if test "x$rb_time_h" = "xyes"; then | |
545 | echo '#include <time.h>' >> $outfile | |
546 | fi | |
547 | ||
548 | if test "x$rb_sys_socket_h" = "xyes"; then | |
549 | echo '#include <sys/socket.h>' >> $outfile | |
550 | fi | |
551 | ||
552 | if test "x$rb_netinet_in_h" = "xyes"; then | |
553 | echo '#include <netinet/in.h>' >> $outfile | |
554 | fi | |
555 | ||
556 | if test "x$rb_arpa_inet_h" = "xyes"; then | |
557 | echo '#include <arpa/inet.h>' >> $outfile | |
558 | fi | |
559 | ||
560 | if test "x$rb_unistd_h" = "xyes"; then | |
561 | echo '#include <unistd.h>' >> $outfile | |
562 | fi | |
563 | ||
564 | if test "x$rb_crypt_h" = "xyes"; then | |
565 | echo '#include <crypt.h>' >> $outfile | |
566 | fi | |
567 | ||
568 | if test "x$rb_errno_h" = "xyes"; then | |
569 | echo '#include <errno.h>' >> $outfile | |
570 | fi | |
571 | ||
a9fb3ed0 VY |
572 | echo "typedef $rb_socklen_t rb_socklen_t;" >> $outfile |
573 | ||
574 | ||
db137867 AC |
575 | if test "x$rb_sockaddr_sa_len" = "xyes"; then |
576 | echo '#define RB_SOCKADDR_HAS_SA_LEN 1' >> $outfile | |
577 | fi | |
578 | ||
db137867 AC |
579 | if test "x$rb_sockaddr_storage" = "xyes"; then |
580 | echo '#define rb_sockaddr_storage sockaddr_storage' >> $outfile | |
581 | else | |
3202e249 | 582 | echo 'struct rb_sockaddr_storage { uint8_t _padding[[128]]; };' >> $outfile |
db137867 AC |
583 | fi |
584 | ||
585 | cat >> $outfile <<\_______EOF | |
586 | #endif /* __LIBRB_CONFIG_H */ | |
587 | _______EOF | |
588 | ||
589 | if cmp -s $outfile include/librb-config.h; then | |
590 | AC_MSG_NOTICE([include/librb-config.h is unchanged]) | |
591 | ${rb_rm} -f $outfile | |
592 | else | |
593 | ${rb_mv} $outfile include/librb-config.h | |
594 | fi | |
595 | ||
596 | ],[ | |
db137867 AC |
597 | if test x$ac_cv_header_stdc = xyes; then |
598 | rb_header_stdc=yes | |
599 | fi | |
600 | if test x$ac_cv_header_stdlib_h = xyes; then | |
601 | rb_header_stdlib_h=yes | |
602 | fi | |
603 | if test x$ac_cv_header_string_h = xyes; then | |
604 | rb_header_string_h=yes | |
605 | fi | |
606 | if test x$ac_cv_header_memory_h = xyes; then | |
607 | rb_header_memory_h=yes | |
608 | fi | |
609 | if test "x${ac_cv_working_alloca_h+set}" = xset ; then | |
610 | rb_alloca_h="$ac_cv_working_alloca_h" | |
611 | else | |
612 | rb_alloc_h="$ac_cv_header_alloca_h" | |
613 | fi | |
614 | if test x$ac_cv_member_struct_sockaddr_sa_len = xyes; then | |
615 | rb_sockaddr_sa_len=yes | |
616 | fi | |
617 | if test x$ac_cv_header_sys_socket_h = xyes; then | |
618 | rb_sys_socket_h=yes | |
619 | fi | |
620 | if test x$ac_cv_header_sys_types_h = xyes; then | |
621 | rb_sys_types_h=yes | |
622 | fi | |
623 | if test x$ac_cv_header_sys_stat_h = xyes; then | |
624 | rb_sys_stat_h=yes | |
625 | fi | |
626 | if test x$ac_cv_header_sys_time_h = xyes; then | |
627 | rb_sys_time_h=yes | |
628 | fi | |
629 | if test x$ac_cv_header_time = xyes; then | |
630 | rb_time_h=yes | |
631 | fi | |
632 | ||
633 | if test x$ac_cv_header_stdint_h = xyes; then | |
634 | rb_stdint_h=yes | |
635 | fi | |
636 | if test x$ac_cv_header_inttypes_h = xyes; then | |
637 | rb_inttypes_h=yes | |
638 | fi | |
639 | if test x$ac_cv_header_netinet_in_h = xyes; then | |
640 | rb_netinet_in_h=yes | |
641 | fi | |
642 | ||
643 | if test x$ac_cv_header_crypt_h = xyes; then | |
644 | rb_crypt_h=yes | |
645 | fi | |
646 | if test x$ac_cv_header_errno_h = xyes; then | |
647 | rb_errno_h=yes | |
648 | fi | |
649 | if test x$ac_cv_header_unistd_h = xyes; then | |
650 | rb_unistd_h=yes | |
651 | fi | |
652 | if test x$ac_cv_header_windows_h = xyes; then | |
653 | rb_windows_h=yes | |
654 | fi | |
655 | if test x$ac_cv_header_winsock2_h = xyes; then | |
656 | rb_winsock2_h=yes | |
657 | fi | |
a9fb3ed0 VY |
658 | |
659 | rb_socklen_t=$rb_socklen_t | |
660 | ||
db137867 AC |
661 | if test "x$rb_have_sockaddr_storage" = "xyes"; then |
662 | rb_sockaddr_storage="yes" | |
663 | else | |
664 | rb_sockaddr_storage="no" | |
665 | fi | |
666 | ||
667 | rb_have_ipv6="$have_v6" | |
668 | ||
669 | rb_mv="$MV" | |
670 | rb_rm="$RM" | |
671 | ||
672 | ] | |
673 | ||
674 | ||
675 | ) | |
676 | ||
c2ac22cc VY |
677 | |
678 | AC_CONFIG_FILES( \ | |
679 | src/Makefile \ | |
680 | Makefile \ | |
030272f3 | 681 | libratbox.pc |
c2ac22cc | 682 | ) |
db137867 AC |
683 | |
684 | AC_OUTPUT | |
685 | ||
686 | dnl Make it look sexay! | |
687 | ||
688 | echo | |
689 | echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION" | |
690 | echo | |
691 | ||
692 | echo "Installing into: $prefix" | |
693 | ||
694 | echo "IPv6 support ................... $have_v6" | |
695 | echo "Assert debugging ............... $assert" | |
696 | echo "Block allocator ................ $balloc" | |
c2ac22cc | 697 | echo "SSL Type........................ $SSL_TYPE" |
db137867 AC |
698 | echo |
699 |