[autobuild] simple check for fork
[lighttpd.git] / configure.ac
blobf04ac69a12fa07bda7270ee152a38d06efe2dcf3
1 dnl                                               -*- Autoconf -*-
2 dnl Process this file with autoconf to produce a configure script.
3 dnl
4 dnl Indentation rules:
5 dnl - closing braces not at the beginning of a line must match opening
6 dnl   braces earlier on that line
7 dnl - closing braces at the beginning of a line:
8 dnl   - must not be followed by anything else apart from "," or comments
9 dnl   - must match opening braces from another line and indented the
10 dnl     same as that other line
11 dnl - if one argument was put on a new line, all following arguments
12 dnl   must be on their own line too
13 dnl - if an argument uses more than one line and is not a single
14 dnl   function call, the argument should be on different lines than the
15 dnl   wrapping braces
16 AC_PREREQ(2.60)
17 AC_INIT([lighttpd], [1.4.48], [contact@lighttpd.net])
18 AC_CONFIG_SRCDIR([src/server.c])
19 AC_CONFIG_HEADER([config.h])
20 AC_CONFIG_MACRO_DIR([m4])
22 AC_CANONICAL_HOST
24 AM_INIT_AUTOMAKE([1.14 -Wall -Wno-portability -Wno-override foreign dist-xz tar-ustar serial-tests silent-rules])
26 dnl @synopsis TRY_CFLAGS [compiler flags]
27 dnl @summary check whether compiler supports given flags and adds them to CFLAGS
28 AC_DEFUN([TRY_CFLAGS],
29 [dnl
30   AC_MSG_CHECKING([if $CC supports $1])
31   AC_LANG_PUSH([C])
32   ac_try_cflags_saved_cflags="${CFLAGS}"
33   CFLAGS="${CFLAGS} $1"
34   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
35     [AC_MSG_RESULT([yes])],
36     [
37       AC_MSG_ERROR([no])
38       CFLAGS="${ac_try_cflags_saved_cflags}"
39     ]
40   )
41   AC_LANG_POP([C])
44 dnl @synopsis TRY_LDFLAGS [linker flags]
45 dnl @summary check whether linker supports given flags and adds them to LDFLAGS
46 AC_DEFUN([TRY_LDFLAGS],
47 [dnl
48   AC_MSG_CHECKING([if $LD supports $1])
49   AC_LANG_PUSH([C])
50   ac_try_ldflags_saved_ldflags="${LDFLAGS}"
51   LDFLAGS="${LDFLAGS} $1"
52   AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
53     [AC_MSG_RESULT([yes])],
54     [
55       AC_MSG_ERROR([no])
56       LDFLAGS="${ac_try_ldflags_saved_cflags}"
57     ]
58   )
59   AC_LANG_POP([C])
62 dnl Checks for programs.
63 AC_PROG_CC
64 AC_PROG_CC_STDC
65 AX_PROG_CC_FOR_BUILD
66 AC_PROG_LD
67 AC_PROG_INSTALL
68 AC_PROG_AWK
69 AC_PROG_CPP
70 AC_PROG_MAKE_SET
72 AC_USE_SYSTEM_EXTENSIONS
73 AM_PROG_AR
75 dnl AC_CANONICAL_HOST
76 case "$host_os" in
77 *darwin*|*cygwin*|*aix*|*mingw*|*midipix* ) NO_RDYNAMIC=yes ;;
78 * ) NO_RDYNAMIC=no ;;
79 esac
80 AM_CONDITIONAL([NO_RDYNAMIC], [test "$NO_RDYNAMIC" = yes])
82 AM_CONDITIONAL([LIGHTTPD_STATIC], [test "$LIGHTTPD_STATIC" = yes])
84 AC_EXEEXT
86 dnl libtool
87 AC_DISABLE_STATIC
88 AC_ENABLE_SHARED
90 AC_LIBTOOL_DLOPEN
91 AC_PROG_LIBTOOL
93 dnl for solaris
94 CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
96 dnl Checks for header files.
98 dnl check for:
99 dnl   inttypes.h => HAVE_INTTYPES_H
100 dnl   stdint.h => HAVE_STDINT_H
101 dnl and maybe more (which shouldn't be relied on)
102 AC_HEADER_STDC
103 dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
104 AC_HEADER_SYS_WAIT
105 AC_CHECK_HEADERS([\
106   getopt.h \
107   poll.h \
108   port.h \
109   pwd.h \
110   stdlib.h \
111   strings.h \
112   sys/devpoll.h \
113   sys/epoll.h \
114   sys/event.h \
115   sys/filio.h \
116   sys/mman.h \
117   sys/poll.h \
118   sys/prctl.h \
119   sys/resource.h \
120   sys/select.h \
121   sys/sendfile.h \
122   sys/time.h \
123   sys/uio.h \
124   sys/un.h \
125   syslog.h \
126   uuid/uuid.h \
129 dnl Checks for typedefs, structures, and compiler characteristics.
130 AC_C_CONST
131 AC_C_INLINE
132 AC_TYPE_OFF_T
133 AC_TYPE_PID_T
134 AC_TYPE_SIZE_T
136 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
137   [AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
138   [],
139   [#include <time.h>]
141 AC_CHECK_TYPES([socklen_t],
142   [], dnl defines HAVE_SOCKLEN_T
143   [],
144   [
145     #include <sys/types.h>
146     #include <sys/socket.h>
147   ]
150 dnl openssl on solaris needs -lsocket -lnsl
151 AC_SEARCH_LIBS([socket], [socket])
152 AC_SEARCH_LIBS([gethostbyname], [nsl socket])
154 dnl On Haiku accept() and friends are in libnetwork
155 AC_SEARCH_LIBS([accept], [network])
157 dnl clock_gettime() needs -lrt with glibc < 2.17, and possibly other platforms
158 AC_SEARCH_LIBS([clock_gettime], [rt])
160 dnl need dlopen/-ldl to load plugins (when not on windows)
161 save_LIBS=$LIBS
162 LIBS=
163 AC_SEARCH_LIBS([dlopen], [dl], [
164   AC_CHECK_HEADERS([dlfcn.h], [
165     DL_LIB=$LIBS
166     AC_DEFINE([HAVE_LIBDL], [1], [libdl])
167     AC_DEFINE([HAVE_DLFCN_H], [1])
168   ])
170 LIBS=$save_LIBS
171 AC_SUBST([DL_LIB])
173 dnl prepare pkg-config usage below
174 if test -z "$PKG_CONFIG"; then
175   AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
177 PKG_PROG_PKG_CONFIG
179 dnl checking for libev
180 AC_MSG_NOTICE([----------------------------------------])
181 AC_MSG_CHECKING([for libev support])
182 AC_ARG_WITH([libev],
183   [AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
184     [Include libev support for fdevent handlers in PATH/include and PATH/lib]
185   )],
186   [WITH_LIBEV=$withval],
187   [WITH_LIBEV=no]
189 AC_MSG_RESULT([$WITH_LIBEV])
191 LIBEV_CFLAGS=
192 LIBEV_LIBS=
194 if test "$WITH_LIBEV" != no; then
195   PKG_CHECK_MODULES([LIBEV], [libev], [], [
196     dnl no pkg-config for libev, searching manually:
198     if test "$WITH_LIBEV" != yes; then
199       LIBEV_CFLAGS="-I$WITH_LIBEV/include"
200       LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
201     else
202       AC_CHECK_HEADERS([ev.h],
203         [AC_CHECK_LIB([ev], [ev_time],
204           [
205             LIBEV_CFLAGS=
206             LIBEV_LIBS="-lev"
207           ],
208           [AC_MSG_ERROR([libev not found])]
209         )],
210         [AC_MSG_ERROR([libev header not found])]
211       )
212     fi
213   ])
215   AC_DEFINE([HAVE_LIBEV], [1], [libev support])
218 AC_SUBST([LIBEV_CFLAGS])
219 AC_SUBST([LIBEV_LIBS])
221 dnl Checks for mysql
222 AC_MSG_NOTICE([----------------------------------------])
223 AC_MSG_CHECKING([for MySQL support])
224 AC_ARG_WITH([mysql],
225   [AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
226     [Include MySQL support. PATH is the path to 'mysql_config']
227   )],
228   [WITH_MYSQL=$withval],
229   [WITH_MYSQL=no]
231 AC_MSG_RESULT([$WITH_MYSQL])
233 MYSQL_INCLUDE=
234 MYSQL_LIBS=
236 if test "$WITH_MYSQL" != no; then
237   if test "$WITH_MYSQL" = yes; then
238     AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
239   else
240     MYSQL_CONFIG=$WITH_MYSQL
241   fi
243   if test -z "$MYSQL_CONFIG"; then
244     AC_MSG_ERROR([mysql_config is not found])
245   fi
246   if test ! -x "$MYSQL_CONFIG"; then
247     AC_MSG_ERROR([mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config])
248   fi
250   if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
251     MYSQL_INCLUDE=`"$MYSQL_CONFIG" --include | sed s/\'//g`
252   else
253     MYSQL_INCLUDE=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
254   fi
255   MYSQL_LIBS=`"$MYSQL_CONFIG" --libs | sed s/\'//g`
257   AC_MSG_CHECKING([for MySQL includes at])
258   AC_MSG_RESULT([$MYSQL_INCLUDE])
260   AC_MSG_CHECKING([for MySQL libraries at])
261   AC_MSG_RESULT([$MYSQL_LIBS])
263   AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
265 AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
267 AC_SUBST([MYSQL_LIBS])
268 AC_SUBST([MYSQL_INCLUDE])
270 dnl Checks for pgsql
271 AC_MSG_NOTICE([----------------------------------------])
272 AC_MSG_CHECKING([for PgSQL support])
273 AC_ARG_WITH([pgsql],
274   [AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
275     [Include PgSQL support. PATH is the path to 'pg_config']
276   )],
277   [WITH_PGSQL=$withval],
278   [WITH_PGSQL=no]
280 AC_MSG_RESULT([$WITH_PGSQL])
282 PGSQL_INCLUDE=
283 PGSQL_LIBS=
285 if test "$WITH_PGSQL" != no; then
286   if test "$WITH_PGSQL" = yes; then
287     AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
288   else
289     PGSQL_CONFIG=$WITH_PGSQL
290   fi
292   if test -z "$PGSQL_CONFIG"; then
293     AC_MSG_ERROR([pg_config is not found])
294   fi
295   if test ! -x "$PGSQL_CONFIG"; then
296     AC_MSG_ERROR([pg_config not exists or not executable, use --with-pgsql=path-to-pg_config])
297   fi
299   PGSQL_INCLUDE="-I`"$PGSQL_CONFIG" --includedir`"
300   PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
302   AC_MSG_CHECKING([for PgSQL includes at])
303   AC_MSG_RESULT([$PGSQL_INCLUDE])
305   AC_MSG_CHECKING([for PgSQL libraries at])
306   AC_MSG_RESULT([$PGSQL_LIBS])
308   AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
310 AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
312 AC_SUBST([PGSQL_LIBS])
313 AC_SUBST([PGSQL_INCLUDE])
315 dnl Checks for libdbi library
316 AC_MSG_NOTICE([----------------------------------------])
317 AC_MSG_CHECKING([for LibDBI support])
318 AC_ARG_WITH([dbi],
319   [AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
320     [Include DBI support in PATH/include/dbi.h and PATH/lib]
321   )],
322   [WITH_DBI=$withval],
323   [WITH_DBI=no]
325 AC_MSG_RESULT([$WITH_DBI])
327 DBI_INCLUDE=
328 DBI_LIBS=
330 if test "$WITH_DBI" != no; then
331   if test "$WITH_DBI" != yes; then
332     DBI_CFLAGS="-I$WITH_LIBDBI/include"
333     DBI_LIBS="-L$WITH_LIBDBI/lib -ldbi"
334   else
335     AC_CHECK_HEADERS([dbi/dbi.h],
336       [AC_CHECK_LIB([dbi], [dbi_version],
337         [
338           DBI_CFLAGS=
339           DBI_LIBS="-ldbi"
340         ],
341         [AC_MSG_ERROR([LibDBI not found])]
342       )],
343       [AC_MSG_ERROR([LibDBI header not found])]
344     )
345   fi
347   AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
349 AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
351 AC_SUBST([DBI_LIBS])
352 AC_SUBST([DBI_CFLAGS])
355 dnl Check for LDAP
356 AC_MSG_NOTICE([----------------------------------------])
357 AC_MSG_CHECKING([for LDAP support])
358 AC_ARG_WITH([ldap],
359   [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
360   [WITH_LDAP=$withval],
361   [WITH_LDAP=no]
363 AC_MSG_RESULT([$WITH_LDAP])
365 if test "$WITH_LDAP" != no; then
366   AC_CHECK_LIB([ldap], [ldap_bind],
367     [AC_CHECK_HEADERS([ldap.h],
368       [
369         LDAP_LIB=-lldap
370         AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
371         AC_DEFINE([HAVE_LDAP_H], [1])
372         AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
373       ],
374       [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
375     )],
376     [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
377   )
378   AC_SUBST([LDAP_LIB])
379   AC_CHECK_LIB([lber], [ber_printf],
380     [AC_CHECK_HEADERS([lber.h],
381       [
382         LBER_LIB=-llber
383         AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
384         AC_DEFINE([HAVE_LBER_H], [1])
385       ],
386       [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
387     )],
388     [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
389   )
390   AC_SUBST([LBER_LIB])
392 AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
394 dnl Check for xattr
395 AC_MSG_NOTICE([----------------------------------------])
396 AC_MSG_CHECKING([for extended attributes support])
397 AC_ARG_WITH([attr],
398   [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
399   [WITH_ATTR=$withval],
400   [WITH_ATTR=no]
402 AC_MSG_RESULT([$WITH_ATTR])
404 if test "$WITH_ATTR" != no; then
405   have_xattr=no
406   # libattr (linux only?)
407   AC_CHECK_LIB([attr], [attr_get], [
408     AC_CHECK_HEADERS([attr/attributes.h], [
409       ATTR_LIB=-lattr
410       AC_DEFINE([HAVE_XATTR], [1], [libattr])
411       AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
412       have_xattr=yes
413     ])
414   ])
415   AC_SUBST([ATTR_LIB])
417   # (Free)BSD extattr
418   AC_CHECK_FUNC([extattr_get_file], [
419     AC_CHECK_HEADERS([sys/extattr.h], [
420       AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
421       AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
422       have_xattr=yes
423     ])
424   ])
426   if test "$have_xattr" = no; then
427     AC_MSG_ERROR([no backend found implementing extended attributes])
428   fi
431 dnl Check for valgrind
432 AC_MSG_NOTICE([----------------------------------------])
433 AC_MSG_CHECKING([for valgrind])
434 AC_ARG_WITH([valgrind],
435   [AC_HELP_STRING([--with-valgrind],
436     [enable internal support for valgrind]
437   )],
438   [WITH_VALGRIND=$withval],
439   [WITH_VALGRIND=no]
441 AC_MSG_RESULT([$WITH_VALGRIND])
443 if test "$WITH_VALGRIND" != no; then
444   AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
445     AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
446   ])
449 dnl Checking for libunwind
450 AC_MSG_NOTICE([----------------------------------------])
451 AC_MSG_CHECKING([for libunwind])
452 AC_ARG_WITH([libunwind],
453   [AC_HELP_STRING([--with-libunwind],
454     [Include libunwind support for backtraces on assert failures]
455   )],
456   [WITH_LIBUNWIND=$withval],
457   [WITH_LIBUNWIND=no]
459 AC_MSG_RESULT([$WITH_LIBUNWIND])
461 if test "$WITH_LIBUNWIND" != no; then
462   PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
463     AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
464   ])
465   AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
468 dnl Checking for kerberos5
469 AC_MSG_NOTICE([----------------------------------------])
470 AC_MSG_CHECKING([for kerberos5])
471 AC_ARG_WITH([krb5],
472   [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
473   [WITH_KRB5=$withval],
474   [WITH_KRB5=no]
476 AC_MSG_RESULT([$WITH_KRB5])
478 if test "$WITH_KRB5" != no; then
479   if test "$WITH_KRB5" != yes; then
480     krb5_append_CPPFLAGS=" -I$WITH_KRB5/include"
481     krb5_append_LDFLAGS=" -L$WITH_KRB5/lib"
482   fi
485 AC_MSG_CHECKING([custom include directory for kerberos5])
486 AC_ARG_WITH([krb5-includes],
487   [AC_HELP_STRING([--with-krb5-includes=DIR], [Kerberos includes])],
488   [
489     if test "$WITH_KRB5" = no; then
490       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
491     fi
492     krb5_append_CPPFLAGS=" -I$withval"
493     AC_MSG_RESULT([$withval])
494   ],
495   [AC_MSG_RESULT([no])]
498 AC_MSG_CHECKING([custom lib directory for kerberos5])
499 AC_ARG_WITH([krb5-libs],
500   [AC_HELP_STRING([--with-krb5-libs=DIR], [Kerberos libraries])],
501   [
502     if test "$WITH_KRB5" = no; then
503       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
504     fi
505     krb5_append_LDFLAGS=" -L$withval"
506     AC_MSG_RESULT([$withval])
507   ],
508   [AC_MSG_RESULT([no])]
511 if test "$WITH_KRB5" != no; then
512   CPPFLAGS="${CPPFLAGS}${krb5_append_CPPFLAGS}"
513   LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
515   AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
516     [AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
517       [
518         KRB5_LIB="-lkrb5 -lgssapi_krb5"
519         AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
520       ],
521       [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
522     )],
523     [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
524   )
525   case "$host_os" in
526   *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
527   * ) ;;
528   esac
531 AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
532 AC_SUBST([KRB5_LIB])
534 dnl Check for openssl
535 AC_MSG_NOTICE([----------------------------------------])
536 AC_MSG_CHECKING([for OpenSSL])
537 AC_ARG_WITH([openssl],
538   [AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],
539     [Include openssl support (default no)]
540   )],
541   [WITH_OPENSSL=$withval],
542   [WITH_OPENSSL=no]
544 AC_MSG_RESULT([$WITH_OPENSSL])
546 if test "$WITH_OPENSSL" != no; then
547   if test "$WITH_OPENSSL" != yes; then
548     openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
549     openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
550   fi
553 AC_MSG_CHECKING([custom include directory for openssl])
554 AC_ARG_WITH([openssl-includes],
555   [AC_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
556   [
557     if test "$WITH_OPENSSL" = no; then
558       AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
559     fi
560     openssl_append_CPPFLAGS=" -I$withval"
561     AC_MSG_RESULT([$withval])
562   ],
563   [AC_MSG_RESULT([no])]
566 AC_MSG_CHECKING([custom lib directory for openssl])
567 AC_ARG_WITH([openssl-libs],
568   [AC_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
569   [
570     if test "$WITH_OPENSSL" = no; then
571       AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
572     fi
573     openssl_append_LDFLAGS=" -L$withval"
574     AC_MSG_RESULT([$withval])
575   ],
576   [AC_MSG_RESULT([no])]
579 AM_CONDITIONAL([BUILD_WITH_OPENSSL], [test "$WITH_OPENSSL" != no])
581 if test "$WITH_OPENSSL" != no; then
582   if test "$WITH_KRB5" != no; then
583     AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
584   fi
586   CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
587   LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
589   AC_CHECK_HEADERS([openssl/ssl.h], [], [
590     AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
591   ])
592   AC_CHECK_LIB([crypto], [BIO_f_base64],
593     [CRYPTO_LIB="-lcrypto"],
594     [AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
595   )
596   AC_CHECK_LIB([ssl], [SSL_new],
597     [SSL_LIB="-lssl -lcrypto"],
598     [AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
599     [ -lcrypto "$DL_LIB" ]
600   )
602   AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
603   AC_SUBST([SSL_LIB])
604   AC_SUBST([CRYPTO_LIB])
607 dnl pcre support
608 AC_MSG_NOTICE([----------------------------------------])
609 AC_MSG_CHECKING([for perl regular expressions support])
610 AC_ARG_WITH([pcre],
611   [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
612   [WITH_PCRE=$withval],
613   [WITH_PCRE=yes]
615 AC_MSG_RESULT([$WITH_PCRE])
617 if test "$WITH_PCRE" != no; then
618   if test "$WITH_PCRE" != yes; then
619     PCRE_LIB="-L$WITH_PCRE/lib -lpcre"
620     CPPFLAGS="$CPPFLAGS -I$WITH_PCRE/include"
621   else
622     AC_PATH_PROG([PCRECONFIG], [pcre-config])
623     if test -n "$PCRECONFIG"; then
624       PCRE_LIB=`"$PCRECONFIG" --libs`
625       CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
626     fi
627   fi
629   if test -z "$PCRE_LIB"; then
630     AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
631   fi
633   AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
634   AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
635   AC_SUBST([PCRE_LIB])
638 dnl zlib
639 AC_MSG_NOTICE([----------------------------------------])
640 AC_MSG_CHECKING([for zlib support])
641 AC_ARG_WITH([zlib],
642   [AC_HELP_STRING([--with-zlib],
643     [Enable zlib support for mod_compress]
644   )],
645   [WITH_ZLIB=$withval],
646   [WITH_ZLIB=yes]
648 AC_MSG_RESULT([$WITH_ZLIB])
650 if test "$WITH_ZLIB" != no; then
651   if test "$WITH_ZLIB" != yes; then
652     Z_LIB="-L$WITH_ZLIB -lz"
653     CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
654   else
655     AC_CHECK_HEADERS([zlib.h], [],
656       [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
657     )
658     AC_CHECK_LIB([z], [deflate],
659       [Z_LIB=-lz],
660       [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
661     )
662   fi
664   AC_DEFINE([HAVE_LIBZ], [1], [libz])
665   AC_DEFINE([HAVE_ZLIB_H], [1])
666   AC_SUBST([Z_LIB])
669 dnl bzip2
670 AC_MSG_NOTICE([----------------------------------------])
671 AC_MSG_CHECKING([for bzip2 support])
672 AC_ARG_WITH([bzip2],
673   [AC_HELP_STRING([--with-bzip2],
674     [Enable bzip2 support for mod_compress]
675   )],
676   [WITH_BZIP2=$withval],
677   [WITH_BZIP2=yes]
679 AC_MSG_RESULT([$WITH_BZIP2])
681 if test "$WITH_BZIP2" != no; then
682   if test "$WITH_BZIP2" != yes; then
683     BZ_LIB="-L$WITH_BZIP2 -lbz2"
684     CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
685   else
686     AC_CHECK_HEADERS([bzlib.h], [], [
687       AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
688     ])
689     AC_CHECK_LIB([bz2], [BZ2_bzCompress],
690       [BZ_LIB=-lbz2],
691       [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
692     )
693   fi
695   AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
696   AC_DEFINE([HAVE_BZLIB_H], [1])
697   AC_SUBST([BZ_LIB])
700 dnl Check for fam/gamin
701 AC_MSG_NOTICE([----------------------------------------])
702 AC_MSG_CHECKING([for FAM])
703 AC_ARG_WITH([fam],
704   [AC_HELP_STRING([--with-fam],
705     [fam/gamin for reducing number of stat() calls]
706   )],
707   [WITH_FAM=$withval],
708   [WITH_FAM=no]
710 AC_MSG_RESULT([$WITH_FAM])
712 if test "$WITH_FAM" != no; then
713   if test "$WITH_FAM" != yes; then
714     FAM_LIBS="-L$WITH_FAM -lfam"
715     CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
716   else
717     AC_CHECK_LIB([fam], [FAMOpen2], [
718       AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
719     ])
720     dnl fam has no pkg-config so far, so just search for gamin as fallback
721     if test -z "$FAM_LIBS"; then
722       PKG_CHECK_MODULES([FAM], [gamin >= 0.1.0])
723     fi
724   fi
726   if test -z "$FAM_LIBS"; then
727     AC_MSG_ERROR([fam/gamin headers and/or libs were not found, install them or build without --with-fam])
728   fi
730   OLD_LIBS=$LIBS
731   LIBS=$FAM_LIBS
732   AC_CHECK_FUNCS([FAMNoExists])
733   LIBS=$OLD_LIBS
735   AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
736   AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
737   AC_SUBST([FAM_LIBS])
741 dnl webdav props (xml2 and sqlite3)
742 AC_MSG_NOTICE([----------------------------------------])
743 AC_MSG_CHECKING([for properties in mod_webdav])
744 AC_ARG_WITH([webdav-props],
745   [AC_HELP_STRING([--with-webdav-props], [properties in mod_webdav])],
746   [WITH_WEBDAV_PROPS=$withval],
747   [WITH_WEBDAV_PROPS=no]
749 AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
751 if test "$WITH_WEBDAV_PROPS" != no; then
752   AC_MSG_CHECKING([for libxml2])
753   AC_ARG_WITH([libxml],
754     [AC_HELP_STRING([--with-libxml],
755       [libxml2 for properties in mod_webdav]
756     )],
757     [WITH_LIBXML=$withval],
758     [WITH_LIBXML=yes]
759   )
760   AC_MSG_RESULT([$WITH_LIBXML])
762   if test "$WITH_LIBXML" = no; then
763     AC_MSG_ERROR([--with-webdav-props requires libxml])
764   fi
766   if test "$WITH_LIBXML" != yes; then
767     XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
768     XML_CFLAGS="-I$WITH_LIBXML/include"
769   else
770     PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
771       AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
772     ])
773   fi
775   AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
776   AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
777   AC_SUBST([XML_LIBS])
778   AC_SUBST([XML_CFLAGS])
780   AC_MSG_CHECKING([for sqlite])
781   AC_ARG_WITH([sqlite],
782     [AC_HELP_STRING([--with-sqlite],
783       [sqlite for properties in mod_webdav]
784     )],
785     [WITH_SQLITE=$withval],
786     [WITH_SQLITE=yes]
787   )
788   AC_MSG_RESULT([$WITH_SQLITE])
790   if test "$WITH_SQLITE" = no; then
791     AC_MSG_ERROR([--with-webdav-props requires sqlite])
792   fi
794   if test "$WITH_SQLITE" != yes; then
795     SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
796     SQLITE_CFLAGS="-I$WITH_SQLITE"
797   else
798     PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
799       AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
800     ])
801   fi
803   AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
804   AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
805   AC_SUBST([SQLITE_LIBS])
806   AC_SUBST([SQLITE_CFLAGS])
810 dnl webdav locks (uuid)
811 AC_MSG_NOTICE([----------------------------------------])
812 AC_MSG_CHECKING([for locks in mod_webdav])
813 AC_ARG_WITH([webdav-locks],
814   [AC_HELP_STRING([--with-webdav-locks],
815     [locks in mod_webdav (requires webdav properties)]
816   )],
817   [WITH_WEBDAV_LOCKS=$withval],
818   [WITH_WEBDAV_LOCKS=no]
820 AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
822 if test "$WITH_WEBDAV_LOCKS" != no; then
823   if test "$WITH_WEBDAV_PROPS" = no; then
824     AC_MSG_ERROR([--with-webdav-locks requires --with-webdav-props])
825   fi
827   AC_MSG_CHECKING([for libuuid])
828   AC_ARG_WITH([uuid],
829     [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
830     [WITH_UUID=$withval],
831     [WITH_UUID=yes]
832   )
833   AC_MSG_RESULT([$WITH_UUID])
835   if test "$WITH_UUID" = no; then
836     AC_MSG_ERROR([--with-webdav-locks requires uuid])
837   fi
839   if test "$WITH_UUID" != yes; then
840     UUID_LIBS="-L$WITH_UUID -luuid"
841     CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
842   else
843     AC_CHECK_LIB([uuid], [uuid_unparse],
844       [UUID_LIBS=-luuid],
845       [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
846     )
847     AC_CHECK_HEADERS([uuid/uuid.h], [],
848       [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
849     )
850   fi
852   AC_DEFINE([HAVE_UUID], [1], [libuuid])
853   AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
854   AC_SUBST([UUID_LIBS])
857 dnl Check for gdbm
858 AC_MSG_NOTICE([----------------------------------------])
859 AC_MSG_CHECKING([for gdbm])
860 AC_ARG_WITH([gdbm],
861   [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
862   [WITH_GDBM=$withval],
863   [WITH_GDBM=no]
865 AC_MSG_RESULT([$WITH_GDBM])
867 if test "$WITH_GDBM" != no; then
868   if test "$WITH_GDBM" != yes; then
869     GDBM_LIB="-L$WITH_GDBM -lgdbm"
870     CPPFLAGS="$CPPFLAGS -I$WITH_GDBM"
871   else
872     AC_CHECK_LIB([gdbm], [gdbm_open],
873       [GDBM_LIB=-lgdbm],
874       [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
875     )
876     AC_CHECK_HEADERS([gdbm.h], [],
877       [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
878     )
879   fi
881   AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
882   AC_DEFINE([HAVE_GDBM_H], [1])
883   AC_SUBST([GDBM_LIB])
885 AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
887 dnl Check for GeoIP
888 AC_MSG_NOTICE([----------------------------------------])
889 AC_MSG_CHECKING([for GeoIP])
890 AC_ARG_WITH([geoip],
891   [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
892   [WITH_GEOIP=$withval],
893   [WITH_GEOIP=no]
895 AC_MSG_RESULT([$WITH_GEOIP])
897 if test "$WITH_GEOIP" != no; then
898   if test "$WITH_GEOIP" != yes; then
899     GEOIP_LIB="-L$WITH_GEOIP -lGeoIP"
900     CPPFLAGS="$CPPFLAGS -I$WITH_GEOIP"
901   else
902     AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
903       [GEOIP_LIB=-lGeoIP],
904       [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
905     )
906     AC_CHECK_HEADERS([GeoIP.h], [],
907       [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
908     )
909   fi
911   AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
912   AC_DEFINE([HAVE_GEOIP_H], [1])
913   AC_SUBST([GEOIP_LIB])
915 AM_CONDITIONAL([BUILD_WITH_GEOIP], [test "$WITH_GEOIP" != no])
917 dnl Check for memcached
918 AC_MSG_NOTICE([----------------------------------------])
919 AC_MSG_CHECKING([for memcached])
920 AC_ARG_WITH([memcached],
921   [AC_HELP_STRING([--with-memcached],
922     [memcached storage for mod_trigger_b4_dl/mod_cml]
923   )],
924   [WITH_MEMCACHED=$withval],
925   [WITH_MEMCACHED=no]
927 AC_MSG_RESULT([$WITH_MEMCACHED])
929 if test "$WITH_MEMCACHED" != no; then
930   if test "$WITH_MEMCACHED" != yes; then
931     MEMCACHED_LIB="-L$WITH_MEMCACHED -lMEMCACHED"
932     CPPFLAGS="$CPPFLAGS -I$WITH_MEMCACHED"
933   else
934     AC_CHECK_LIB([memcached], [memcached],
935       [ MEMCACHED_LIB=-lmemcached ],
936       [AC_MSG_ERROR([memcached lib not found, install it or build without --with-memcached])]
937     )
938     AC_CHECK_HEADERS([libmemcached/memcached.h], [],
939       [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
940     )
941   fi
943   AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
944   AC_SUBST([MEMCACHED_LIB])
946 AM_CONDITIONAL([BUILD_WITH_MEMCACHED], [test "$WITH_MEMCACHED" != no])
948 BUILD_MOD_TRIGGER_B4_DL=no
949 if test "$WITH_MEMCACHED" != no || test "$WITH_GDBM" != no ; then
950   BUILD_MOD_TRIGGER_B4_DL=yes
953 AM_CONDITIONAL([BUILD_MOD_TRIGGER_B4_DL], [test "$BUILD_MOD_TRIGGER_B4_DL" != no])
955 dnl Check for lua
956 AC_MSG_NOTICE([----------------------------------------])
957 AC_MSG_CHECKING([if lua-support is requested])
958 AC_ARG_WITH([lua],
959   [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
960   [WITH_LUA=$withval],
961   [WITH_LUA=no]
963 AC_MSG_RESULT([$WITH_LUA])
965 if test "$WITH_LUA" != no; then
966   found_lua=0
967   if test "$WITH_LUA" != yes; then
968     PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
969       [found_lua=1],
970       [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
971     )
972     if test "$found_lua" = "0"; then
973       LUA_LIBS="-L$WITH_LUA -llua"
974       LUA_CFLAGS="-I$WITH_LUA"
975     fi
976   else
977     for luaname in lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua; do
978       if test "$found_lua" = "0"; then
979         PKG_CHECK_MODULES([LUA], [$luaname >= 5.1],
980           [found_lua=1],
981           [AC_MSG_NOTICE([Couldn\'t find $luaname])]
982         )
983       fi
984     done
985     if test "$found_lua" = "0"; then
986       AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
987     fi
988   fi
990   AC_DEFINE([HAVE_LUA], [1], [liblua])
991   AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
992   AC_SUBST([LUA_LIBS])
993   AC_SUBST([LUA_CFLAGS])
995 AM_CONDITIONAL([BUILD_WITH_LUA], [test "$WITH_LUA" != no])
997 dnl "--with-FEATURE" blocks end
998 AC_MSG_NOTICE([----------------------------------------])
1000 dnl search for crypt_r and (fallback) for crypt
1001 save_LIBS=$LIBS
1002 LIBS=
1003 found_crypt=no
1004 AC_SEARCH_LIBS([crypt_r], [crypt],
1005   [
1006     AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
1007     AC_CHECK_HEADERS([crypt.h])
1008     CRYPT_LIB=$LIBS
1009     found_crypt=crypt_r
1010   ],
1011   [AC_SEARCH_LIBS([crypt], [crypt], [
1012     AC_DEFINE([HAVE_CRYPT], [1], [crypt])
1013     AC_CHECK_HEADERS([crypt.h])
1014     CRYPT_LIB=$LIBS
1015     found_crypt=crypt
1016   ])]
1018 LIBS=$save_LIBS
1019 AC_SUBST([CRYPT_LIB])
1021 AC_MSG_CHECKING([crypt_r/crypt support])
1022 AC_MSG_RESULT([$found_crypt])
1024 dnl check whether sendfilev needs -lsendfile
1025 AC_MSG_NOTICE([----------------------------------------])
1026 save_LIBS=$LIBS
1027 LIBS=
1028 have_sendfilev=no
1029 AC_SEARCH_LIBS([sendfilev], [sendfile], [
1030   if test -z "$LIBS"; then
1031     have_sendfilev=yes
1032   else
1033     have_sendfilev=$LIBS
1034   fi
1035   SENDFILE_LIB=$LIBS
1036   AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
1038 LIBS=$save_LIBS
1039 AC_SUBST([SENDFILE_LIB])
1041 AC_MSG_CHECKING([solaris sendfilev present])
1042 AC_MSG_RESULT([$have_sendfilev])
1044 AC_MSG_NOTICE([----------------------------------------])
1046 case "$host_os" in
1047 *mingw* ) LIBS="$LIBS -lwsock32" ;;
1048 * ) ;;
1049 esac
1051 AC_CHECK_FUNCS([\
1052   arc4random_buf \
1053   chroot \
1054   clock_gettime \
1055   epoll_ctl \
1056   explicit_bzero \
1057   fork \
1058   getloadavg \
1059   getrlimit \
1060   getuid \
1061   gmtime_r \
1062   inet_pton \
1063   issetugid \
1064   jrand48 \
1065   kqueue \
1066   localtime_r \
1067   lstat \
1068   madvise \
1069   memset \
1070   memset_s \
1071   mmap \
1072   pathconf \
1073   pipe2 \
1074   poll \
1075   port_create \
1076   select \
1077   send_file \
1078   sendfile \
1079   sendfile64 \
1080   sigaction \
1081   signal \
1082   srandom \
1083   writev \
1085 AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
1086 AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
1088 AC_MSG_NOTICE([----------------------------------------])
1089 AC_MSG_CHECKING([if weak symbols are supported])
1090 AC_LINK_IFELSE(
1091   [AC_LANG_PROGRAM([[
1092     __attribute__((weak)) void __dummy(void *x) { }
1093     void f(void *x) { __dummy(x); }
1094   ]])],
1095   [
1096     AC_MSG_RESULT([yes])
1097     AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
1098   ],
1099   [AC_MSG_RESULT([no])]
1102 AC_MSG_NOTICE([----------------------------------------])
1103 AC_MSG_CHECKING([for Large File System support])
1104 AC_ARG_ENABLE([lfs],
1105   [AC_HELP_STRING([--enable-lfs],
1106     [Turn on Large File System (default)]
1107   )],
1108   [
1109     case "${enableval}" in
1110     yes) ENABLE_LFS=yes ;;
1111     no) ENABLE_LFS=no ;;
1112     *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
1113     esac
1114   ],
1115   [ ENABLE_LFS=yes ]
1117 AC_MSG_RESULT([$ENABLE_LFS])
1118 if test "$ENABLE_LFS" = yes; then
1119   CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
1122 dnl check if sendfile works
1123 if test "$ac_cv_func_sendfile" = yes; then
1124   AC_MSG_NOTICE([----------------------------------------])
1125   AC_MSG_CHECKING([if sendfile works])
1126   if test "$cross_compiling" = no; then
1127     AC_TRY_RUN(
1128       [
1129         #ifdef HAVE_SYS_SENDFILE_H
1130         #include <sys/sendfile.h>
1131         #endif /* HAVE_SYS_SENDFILE_H */
1132         #include <errno.h>
1133         int main() {
1134           int o = 0;
1135           if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
1136           return 0;
1137         }
1138       ],
1139       [AC_MSG_RESULT([yes])],
1140       [
1141         AC_MSG_RESULT([no])
1142         AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1143       ]
1144     )
1145   else
1146     AC_MSG_RESULT([no, cross-compiling])
1147     AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1148   fi
1151 dnl Check for IPv6 support
1152 AC_MSG_NOTICE([----------------------------------------])
1153 AC_ARG_ENABLE([ipv6],
1154   [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
1155   [
1156     case "${enableval}" in
1157     yes) ipv6=true ;;
1158     no) ipv6=false ;;
1159     *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1160     esac
1161   ],
1162   [ipv6=true]
1165 if test "$ipv6" = true; then
1166   AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
1167     AC_TRY_LINK(
1168       [
1169         #include <sys/types.h>
1170         #include <sys/socket.h>
1171         #include <netinet/in.h>
1172       ],
1173       [
1174         struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1175       ],
1176       [ac_cv_ipv6_support=yes],
1177       [ac_cv_ipv6_support=no]
1178     )
1179   ])
1181   if test "$ac_cv_ipv6_support" = yes; then
1182     AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
1183   else
1184     AC_MSG_ERROR([IPv6 seems broken.  Fix it or build with --disable-ipv6])
1185   fi
1188 # disable mmap by default; if a mmapped file gets truncated, the process gets a SIGBUS signal
1189 # on reading the truncated area which we can't handle (yet).
1190 # lighttpd may always use mmap with files it owns (created tmp files)
1191 AC_MSG_NOTICE([----------------------------------------])
1192 AC_MSG_CHECKING([use mmap if available (dangerous)])
1193 AC_ARG_ENABLE([mmap],
1194   [AC_HELP_STRING([--enable-mmap],
1195     [use mmap if available (DANGEROUS, allows local users to trigger SIGBUS crashes)]
1196   )],
1197   [
1198     case "${enableval}" in
1199     yes) mmap=true ;;
1200     no) mmap=false ;;
1201     *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
1202     esac
1203   ],
1204   [mmap=false]
1206 AC_MSG_RESULT([$mmap])
1208 if test "$mmap" = true; then
1209   AC_DEFINE([ENABLE_MMAP], [1], [Use mmap if available])
1212 dnl check for fastcgi lib, for the tests only
1213 AC_MSG_NOTICE([----------------------------------------])
1214 fastcgi_found=no
1215 AC_CHECK_LIB([fcgi], [FCGI_Accept], [
1216   AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
1217     fastcgi_found=yes
1218   ])
1221 AM_CONDITIONAL([CHECK_WITH_FASTCGI], [test "$fastcgi_found" = yes])
1224 AC_MSG_NOTICE([----------------------------------------])
1225 dnl check for extra compiler options (warning options)
1226 if test "${GCC}" = yes; then
1227   TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
1230 AC_ARG_ENABLE([extra-warnings],
1231   [AC_HELP_STRING([--enable-extra-warnings],
1232     [enable extra warnings (gcc specific)]
1233   )],
1234   [
1235     case "${enableval}" in
1236     error) extrawarnings=error ;;
1237     yes) extrawarnings=true ;;
1238     no) extrawarnings=false ;;
1239     *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
1240     esac
1241   ],
1242   [extrawarnings=false]
1245 if test "$extrawarnings" = true || test "$extrawarnings" = error; then
1246   TRY_CFLAGS([-g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security])
1247   TRY_LDFLAGS([-Wl,--as-needed])
1248   if test "$extrawarnings" = error; then
1249     AS_VAR_APPEND([CFLAGS], [" -Werror"])
1250     AS_VAR_APPEND([LDFLAGS], [" -Wl,--fatal-warnings"])
1251   fi
1254 dnl build version-id
1255 LIGHTTPD_VERSION_ID=`echo "$PACKAGE_VERSION" | $AWK -F '.' '{print "(" $1 " << 16 | " $2 " << 8 | " $3 ")"}'`
1256 AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
1258 AC_CONFIG_FILES([\
1259   distribute.sh \
1260   doc/config/conf.d/Makefile \
1261   doc/config/Makefile \
1262   doc/config/vhosts.d/Makefile \
1263   doc/Makefile \
1264   doc/outdated/Makefile \
1265   doc/scripts/Makefile \
1266   doc/systemd/Makefile \
1267   Makefile \
1268   src/Makefile \
1269   tests/docroot/123/Makefile \
1270   tests/docroot/Makefile \
1271   tests/docroot/www/expire/Makefile \
1272   tests/docroot/www/go/Makefile \
1273   tests/docroot/www/indexfile/Makefile \
1274   tests/docroot/www/Makefile \
1275   tests/Makefile \
1277 AC_OUTPUT
1279 do_build="\
1280   mod_access \
1281   mod_accesslog \
1282   mod_alias \
1283   mod_auth \
1284   mod_authn_file \
1285   mod_cgi \
1286   mod_compress \
1287   mod_deflate \
1288   mod_dirlisting \
1289   mod_evhost \
1290   mod_expire \
1291   mod_extforward \
1292   mod_fastcgi \
1293   mod_flv_streaming \
1294   mod_indexfile \
1295   mod_proxy \
1296   mod_rrdtool \
1297   mod_scgi \
1298   mod_secdownload \
1299   mod_setenv \
1300   mod_simple_vhost \
1301   mod_ssi \
1302   mod_staticfile \
1303   mod_status \
1304   mod_userdir \
1305   mod_usertrack \
1306   mod_vhostdb \
1307   mod_webdav \
1308   mod_wstunnel \
1311 plugins="mod_rewrite mod_redirect"
1312 features="regex-conditionals"
1313 if test -n "$PCRE_LIB"; then
1314   do_build="$do_build $plugins"
1315   enable_feature="$features"
1316 else
1317   no_build="$no_build $plugins"
1318   disable_feature="$features"
1321 plugins="mod_trigger_b4_dl"
1322 if test -n "$PCRE_LIB"; then
1323   if test "$WITH_MEMCACHED" != no || test "$WITH_GDBM" != no; then
1324     do_build="$do_build $plugins"
1325   else
1326     no_build="$no_build $plugins"
1327   fi
1330 plugins="mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql"
1331 if test -n "$MYSQL_LIBS"; then
1332   do_build="$do_build $plugins"
1333 else
1334   no_build="$no_build $plugins"
1337 plugins="mod_vhostdb_pgsql"
1338 if test -n "$PGSQL_LIBS"; then
1339   do_build="$do_build $plugins"
1340 else
1341   no_build="$no_build $plugins"
1344 plugins="mod_vhostdb_dbi"
1345 if test -n "$DBI_LIBS"; then
1346   do_build="$do_build $plugins"
1347 else
1348   no_build="$no_build $plugins"
1351 plugins="mod_cml mod_magnet"
1352 if test -n "$LUA_LIBS"; then
1353   do_build="$do_build $plugins"
1354 else
1355   no_build="$no_build $plugins"
1358 plugins="mod_geoip"
1359 if test -n "$GEOIP_LIB"; then
1360   do_build="$do_build $plugins"
1361 else
1362   no_build="$no_build $plugins"
1365 features="storage-gdbm"
1366 if test -n "$GDBM_LIB"; then
1367   enable_feature="$enable_feature $features"
1368 else
1369   disable_feature="$disable_feature $features"
1372 features="storage-memcached"
1373 if test -n "$MEMCACHED_LIB"; then
1374   enable_feature="$enable_feature $features"
1375 else
1376   disable_feature="$disable_feature $features"
1379 features="compress-gzip compress-deflate"
1380 if test -n "$Z_LIB"; then
1381   enable_feature="$enable_feature $features"
1382 else
1383   disable_feature="$disable_feature $features"
1386 features="compress-bzip2"
1387 if test -n "$BZ_LIB"; then
1388   enable_feature="$enable_feature $features"
1389 else
1390   disable_feature="$disable_feature $features"
1393 plugins="mod_authn_gssapi"
1394 if test -n "$KRB5_LIB"; then
1395   do_build="$do_build $plugins"
1396 else
1397   no_build="$no_build $plugins"
1400 plugins="mod_authn_ldap mod_vhostdb_ldap"
1401 if test -n "$LDAP_LIB"; then
1402   do_build="$do_build $plugins"
1403 else
1404   no_build="$no_build $plugins"
1407 features="network-openssl"
1408 if test -n "$SSL_LIB"; then
1409   enable_feature="$enable_feature $features"
1410 else
1411   disable_feature="$disable_feature $features"
1414 dnl no crypt call
1415 features="auth-crypt"
1416 if test "$ac_cv_search_crypt" = no; then
1417   disable_feature="$disable_feature $features"
1418 else
1419   enable_feature="$enable_feature $features"
1422 features="network-ipv6"
1423 if test "$ac_cv_ipv6_support" = yes; then
1424   enable_feature="$enable_feature $features"
1425 else
1426   disable_feature="$disable_feature $features"
1429 features="large-files"
1430 if test "$enable_lfs" = yes; then
1431   enable_feature="$enable_feature $features"
1432 else
1433   disable_feature="$disable_feature $features"
1436 features="stat-cache-fam"
1437 if test -n "$FAM_LIBS"; then
1438   enable_feature="$enable_feature $features"
1439 else
1440   disable_feature="$disable_feature $features"
1443 features="webdav-properties"
1444 if test -n "$XML_LIBS" && test -n "$SQLITE_LIBS"; then
1445   enable_feature="$enable_feature $features"
1446 else
1447   disable_feature="$disable_feature $features"
1450 features="webdav-locks"
1451 if test -n "$UUID_LIBS"; then
1452   enable_feature="$enable_feature $features"
1453 else
1454   disable_feature="$disable_feature $features"
1458 dnl output
1460 $ECHO
1461 $ECHO "Plugins:"
1462 $ECHO
1464 $ECHO "enabled: "
1465 for p in $do_build; do
1466   $ECHO "  $p"
1467 done | sort
1469 $ECHO "disabled: "
1470 for p in $no_build; do
1471   $ECHO "  $p"
1472 done | sort
1474 $ECHO
1475 $ECHO "Features:"
1476 $ECHO
1478 $ECHO "enabled: "
1479 for p in $enable_feature; do
1480   $ECHO "  $p"
1481 done | sort
1483 $ECHO "disabled: "
1484 for p in $disable_feature; do
1485   $ECHO "  $p"
1486 done | sort
1488 $ECHO