[core] consolidate backend network write handlers
[lighttpd.git] / configure.ac
blobf49f7b3479f5676dbf9ee1f5398e5f7838d0f510
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_CPP
69 AC_PROG_MAKE_SET
71 AC_USE_SYSTEM_EXTENSIONS
72 AM_PROG_AR
74 dnl AC_CANONICAL_HOST
75 case "$host_os" in
76 *darwin*|*cygwin*|*aix*|*mingw*|*midipix* ) NO_RDYNAMIC=yes ;;
77 * ) NO_RDYNAMIC=no ;;
78 esac
79 AM_CONDITIONAL([NO_RDYNAMIC], [test "$NO_RDYNAMIC" = yes])
81 AM_CONDITIONAL([LIGHTTPD_STATIC], [test "$LIGHTTPD_STATIC" = yes])
83 AC_EXEEXT
85 dnl libtool
86 AC_DISABLE_STATIC
87 AC_ENABLE_SHARED
89 AC_LIBTOOL_DLOPEN
90 AC_PROG_LIBTOOL
92 dnl for solaris
93 CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
95 dnl Checks for header files.
97 dnl check for:
98 dnl   inttypes.h => HAVE_INTTYPES_H
99 dnl   stdint.h => HAVE_STDINT_H
100 dnl and maybe more (which shouldn't be relied on)
101 AC_HEADER_STDC
102 dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
103 AC_HEADER_SYS_WAIT
104 AC_CHECK_HEADERS([\
105   getopt.h \
106   poll.h \
107   port.h \
108   pwd.h \
109   stdlib.h \
110   strings.h \
111   sys/devpoll.h \
112   sys/epoll.h \
113   sys/event.h \
114   sys/filio.h \
115   sys/mman.h \
116   sys/poll.h \
117   sys/prctl.h \
118   sys/resource.h \
119   sys/select.h \
120   sys/sendfile.h \
121   sys/time.h \
122   sys/uio.h \
123   sys/un.h \
124   syslog.h \
125   uuid/uuid.h \
128 dnl Checks for typedefs, structures, and compiler characteristics.
129 AC_C_CONST
130 AC_C_INLINE
131 AC_TYPE_OFF_T
132 AC_TYPE_PID_T
133 AC_TYPE_SIZE_T
135 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
136   [AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
137   [],
138   [#include <time.h>]
140 AC_CHECK_TYPES([socklen_t],
141   [], dnl defines HAVE_SOCKLEN_T
142   [],
143   [
144     #include <sys/types.h>
145     #include <sys/socket.h>
146   ]
149 dnl openssl on solaris needs -lsocket -lnsl
150 AC_SEARCH_LIBS([socket], [socket])
151 AC_SEARCH_LIBS([gethostbyname], [nsl socket])
153 dnl On Haiku accept() and friends are in libnetwork
154 AC_SEARCH_LIBS([accept], [network])
156 dnl clock_gettime() needs -lrt with glibc < 2.17, and possibly other platforms
157 AC_SEARCH_LIBS([clock_gettime], [rt])
159 dnl need dlopen/-ldl to load plugins (when not on windows)
160 save_LIBS=$LIBS
161 LIBS=
162 AC_SEARCH_LIBS([dlopen], [dl], [
163   AC_CHECK_HEADERS([dlfcn.h], [
164     DL_LIB=$LIBS
165     AC_DEFINE([HAVE_LIBDL], [1], [libdl])
166     AC_DEFINE([HAVE_DLFCN_H], [1])
167   ])
169 LIBS=$save_LIBS
170 AC_SUBST([DL_LIB])
172 dnl prepare pkg-config usage below
173 if test -z "$PKG_CONFIG"; then
174   AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
176 PKG_PROG_PKG_CONFIG
178 dnl checking for libev
179 AC_MSG_NOTICE([----------------------------------------])
180 AC_MSG_CHECKING([for libev support])
181 AC_ARG_WITH([libev],
182   [AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
183     [Include libev support for fdevent handlers in PATH/include and PATH/lib]
184   )],
185   [WITH_LIBEV=$withval],
186   [WITH_LIBEV=no]
188 AC_MSG_RESULT([$WITH_LIBEV])
190 LIBEV_CFLAGS=
191 LIBEV_LIBS=
193 if test "$WITH_LIBEV" != no; then
194   PKG_CHECK_MODULES([LIBEV], [libev], [], [
195     dnl no pkg-config for libev, searching manually:
197     if test "$WITH_LIBEV" != yes; then
198       LIBEV_CFLAGS="-I$WITH_LIBEV/include"
199       LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
200     else
201       AC_CHECK_HEADERS([ev.h],
202         [AC_CHECK_LIB([ev], [ev_time],
203           [
204             LIBEV_CFLAGS=
205             LIBEV_LIBS="-lev"
206           ],
207           [AC_MSG_ERROR([libev not found])]
208         )],
209         [AC_MSG_ERROR([libev header not found])]
210       )
211     fi
212   ])
214   AC_DEFINE([HAVE_LIBEV], [1], [libev support])
217 AC_SUBST([LIBEV_CFLAGS])
218 AC_SUBST([LIBEV_LIBS])
220 dnl Checks for mysql
221 AC_MSG_NOTICE([----------------------------------------])
222 AC_MSG_CHECKING([for MySQL support])
223 AC_ARG_WITH([mysql],
224   [AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
225     [Include MySQL support. PATH is the path to 'mysql_config']
226   )],
227   [WITH_MYSQL=$withval],
228   [WITH_MYSQL=no]
230 AC_MSG_RESULT([$WITH_MYSQL])
232 MYSQL_INCLUDE=
233 MYSQL_LIBS=
235 if test "$WITH_MYSQL" != no; then
236   if test "$WITH_MYSQL" = yes; then
237     AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
238   else
239     MYSQL_CONFIG=$WITH_MYSQL
240   fi
242   if test -z "$MYSQL_CONFIG"; then
243     AC_MSG_ERROR([mysql_config is not found])
244   fi
245   if test ! -x "$MYSQL_CONFIG"; then
246     AC_MSG_ERROR([mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config])
247   fi
249   if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
250     MYSQL_INCLUDE=`"$MYSQL_CONFIG" --include | sed s/\'//g`
251   else
252     MYSQL_INCLUDE=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
253   fi
254   MYSQL_LIBS=`"$MYSQL_CONFIG" --libs | sed s/\'//g`
256   AC_MSG_CHECKING([for MySQL includes at])
257   AC_MSG_RESULT([$MYSQL_INCLUDE])
259   AC_MSG_CHECKING([for MySQL libraries at])
260   AC_MSG_RESULT([$MYSQL_LIBS])
262   AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
264 AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
266 AC_SUBST([MYSQL_LIBS])
267 AC_SUBST([MYSQL_INCLUDE])
269 dnl Checks for pgsql
270 AC_MSG_NOTICE([----------------------------------------])
271 AC_MSG_CHECKING([for PgSQL support])
272 AC_ARG_WITH([pgsql],
273   [AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
274     [Include PgSQL support. PATH is the path to 'pg_config']
275   )],
276   [WITH_PGSQL=$withval],
277   [WITH_PGSQL=no]
279 AC_MSG_RESULT([$WITH_PGSQL])
281 PGSQL_INCLUDE=
282 PGSQL_LIBS=
284 if test "$WITH_PGSQL" != no; then
285   if test "$WITH_PGSQL" = yes; then
286     AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
287   else
288     PGSQL_CONFIG=$WITH_PGSQL
289   fi
291   if test -z "$PGSQL_CONFIG"; then
292     AC_MSG_ERROR([pg_config is not found])
293   fi
294   if test ! -x "$PGSQL_CONFIG"; then
295     AC_MSG_ERROR([pg_config not exists or not executable, use --with-pgsql=path-to-pg_config])
296   fi
298   PGSQL_INCLUDE="-I`"$PGSQL_CONFIG" --includedir`"
299   PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
301   AC_MSG_CHECKING([for PgSQL includes at])
302   AC_MSG_RESULT([$PGSQL_INCLUDE])
304   AC_MSG_CHECKING([for PgSQL libraries at])
305   AC_MSG_RESULT([$PGSQL_LIBS])
307   AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
309 AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
311 AC_SUBST([PGSQL_LIBS])
312 AC_SUBST([PGSQL_INCLUDE])
314 dnl Checks for libdbi library
315 AC_MSG_NOTICE([----------------------------------------])
316 AC_MSG_CHECKING([for LibDBI support])
317 AC_ARG_WITH([dbi],
318   [AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
319     [Include DBI support in PATH/include/dbi.h and PATH/lib]
320   )],
321   [WITH_DBI=$withval],
322   [WITH_DBI=no]
324 AC_MSG_RESULT([$WITH_DBI])
326 DBI_INCLUDE=
327 DBI_LIBS=
329 if test "$WITH_DBI" != no; then
330   if test "$WITH_DBI" != yes; then
331     DBI_CFLAGS="-I$WITH_LIBDBI/include"
332     DBI_LIBS="-L$WITH_LIBDBI/lib -ldbi"
333   else
334     AC_CHECK_HEADERS([dbi/dbi.h],
335       [AC_CHECK_LIB([dbi], [dbi_version],
336         [
337           DBI_CFLAGS=
338           DBI_LIBS="-ldbi"
339         ],
340         [AC_MSG_ERROR([LibDBI not found])]
341       )],
342       [AC_MSG_ERROR([LibDBI header not found])]
343     )
344   fi
346   AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
348 AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
350 AC_SUBST([DBI_LIBS])
351 AC_SUBST([DBI_CFLAGS])
354 dnl Check for LDAP
355 AC_MSG_NOTICE([----------------------------------------])
356 AC_MSG_CHECKING([for LDAP support])
357 AC_ARG_WITH([ldap],
358   [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
359   [WITH_LDAP=$withval],
360   [WITH_LDAP=no]
362 AC_MSG_RESULT([$WITH_LDAP])
364 if test "$WITH_LDAP" != no; then
365   AC_CHECK_LIB([ldap], [ldap_bind],
366     [AC_CHECK_HEADERS([ldap.h],
367       [
368         LDAP_LIB=-lldap
369         AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
370         AC_DEFINE([HAVE_LDAP_H], [1])
371         AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
372       ],
373       [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
374     )],
375     [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
376   )
377   AC_SUBST([LDAP_LIB])
378   AC_CHECK_LIB([lber], [ber_printf],
379     [AC_CHECK_HEADERS([lber.h],
380       [
381         LBER_LIB=-llber
382         AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
383         AC_DEFINE([HAVE_LBER_H], [1])
384       ],
385       [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
386     )],
387     [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
388   )
389   AC_SUBST([LBER_LIB])
391 AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
393 dnl Check for xattr
394 AC_MSG_NOTICE([----------------------------------------])
395 AC_MSG_CHECKING([for extended attributes support])
396 AC_ARG_WITH([attr],
397   [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
398   [WITH_ATTR=$withval],
399   [WITH_ATTR=no]
401 AC_MSG_RESULT([$WITH_ATTR])
403 if test "$WITH_ATTR" != no; then
404   have_xattr=no
405   # libattr (linux only?)
406   AC_CHECK_LIB([attr], [attr_get], [
407     AC_CHECK_HEADERS([attr/attributes.h], [
408       ATTR_LIB=-lattr
409       AC_DEFINE([HAVE_XATTR], [1], [libattr])
410       AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
411       have_xattr=yes
412     ])
413   ])
414   AC_SUBST([ATTR_LIB])
416   # (Free)BSD extattr
417   AC_CHECK_FUNC([extattr_get_file], [
418     AC_CHECK_HEADERS([sys/extattr.h], [
419       AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
420       AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
421       have_xattr=yes
422     ])
423   ])
425   if test "$have_xattr" = no; then
426     AC_MSG_ERROR([no backend found implementing extended attributes])
427   fi
430 dnl Check for valgrind
431 AC_MSG_NOTICE([----------------------------------------])
432 AC_MSG_CHECKING([for valgrind])
433 AC_ARG_WITH([valgrind],
434   [AC_HELP_STRING([--with-valgrind],
435     [enable internal support for valgrind]
436   )],
437   [WITH_VALGRIND=$withval],
438   [WITH_VALGRIND=no]
440 AC_MSG_RESULT([$WITH_VALGRIND])
442 if test "$WITH_VALGRIND" != no; then
443   AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
444     AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
445   ])
448 dnl Checking for libunwind
449 AC_MSG_NOTICE([----------------------------------------])
450 AC_MSG_CHECKING([for libunwind])
451 AC_ARG_WITH([libunwind],
452   [AC_HELP_STRING([--with-libunwind],
453     [Include libunwind support for backtraces on assert failures]
454   )],
455   [WITH_LIBUNWIND=$withval],
456   [WITH_LIBUNWIND=no]
458 AC_MSG_RESULT([$WITH_LIBUNWIND])
460 if test "$WITH_LIBUNWIND" != no; then
461   PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
462     AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
463   ])
464   AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
467 dnl Checking for kerberos5
468 AC_MSG_NOTICE([----------------------------------------])
469 AC_MSG_CHECKING([for kerberos5])
470 AC_ARG_WITH([krb5],
471   [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
472   [WITH_KRB5=$withval],
473   [WITH_KRB5=no]
475 AC_MSG_RESULT([$WITH_KRB5])
477 if test "$WITH_KRB5" != no; then
478   if test "$WITH_KRB5" != yes; then
479     krb5_append_CPPFLAGS=" -I$WITH_KRB5/include"
480     krb5_append_LDFLAGS=" -L$WITH_KRB5/lib"
481   fi
484 AC_MSG_CHECKING([custom include directory for kerberos5])
485 AC_ARG_WITH([krb5-includes],
486   [AC_HELP_STRING([--with-krb5-includes=DIR], [Kerberos includes])],
487   [
488     if test "$WITH_KRB5" = no; then
489       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
490     fi
491     krb5_append_CPPFLAGS=" -I$withval"
492     AC_MSG_RESULT([$withval])
493   ],
494   [AC_MSG_RESULT([no])]
497 AC_MSG_CHECKING([custom lib directory for kerberos5])
498 AC_ARG_WITH([krb5-libs],
499   [AC_HELP_STRING([--with-krb5-libs=DIR], [Kerberos libraries])],
500   [
501     if test "$WITH_KRB5" = no; then
502       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
503     fi
504     krb5_append_LDFLAGS=" -L$withval"
505     AC_MSG_RESULT([$withval])
506   ],
507   [AC_MSG_RESULT([no])]
510 if test "$WITH_KRB5" != no; then
511   CPPFLAGS="${CPPFLAGS}${krb5_append_CPPFLAGS}"
512   LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
514   AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
515     [AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
516       [
517         KRB5_LIB="-lkrb5 -lgssapi_krb5"
518         AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
519       ],
520       [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
521     )],
522     [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
523   )
524   case "$host_os" in
525   *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
526   * ) ;;
527   esac
530 AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
531 AC_SUBST([KRB5_LIB])
533 dnl Check for openssl
534 AC_MSG_NOTICE([----------------------------------------])
535 AC_MSG_CHECKING([for OpenSSL])
536 AC_ARG_WITH([openssl],
537   [AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],
538     [Include openssl support (default no)]
539   )],
540   [WITH_OPENSSL=$withval],
541   [WITH_OPENSSL=no]
543 AC_MSG_RESULT([$WITH_OPENSSL])
545 if test "$WITH_OPENSSL" != no; then
546   if test "$WITH_OPENSSL" != yes; then
547     openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
548     openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
549   fi
552 AC_MSG_CHECKING([custom include directory for openssl])
553 AC_ARG_WITH([openssl-includes],
554   [AC_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
555   [
556     if test "$WITH_OPENSSL" = no; then
557       AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
558     fi
559     openssl_append_CPPFLAGS=" -I$withval"
560     AC_MSG_RESULT([$withval])
561   ],
562   [AC_MSG_RESULT([no])]
565 AC_MSG_CHECKING([custom lib directory for openssl])
566 AC_ARG_WITH([openssl-libs],
567   [AC_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
568   [
569     if test "$WITH_OPENSSL" = no; then
570       AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
571     fi
572     openssl_append_LDFLAGS=" -L$withval"
573     AC_MSG_RESULT([$withval])
574   ],
575   [AC_MSG_RESULT([no])]
578 AM_CONDITIONAL([BUILD_WITH_OPENSSL], [test "$WITH_OPENSSL" != no])
580 if test "$WITH_OPENSSL" != no; then
581   if test "$WITH_KRB5" != no; then
582     AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
583   fi
585   CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
586   LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
588   AC_CHECK_HEADERS([openssl/ssl.h], [], [
589     AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
590   ])
591   AC_CHECK_LIB([crypto], [BIO_f_base64],
592     [CRYPTO_LIB="-lcrypto"],
593     [AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
594   )
595   AC_CHECK_LIB([ssl], [SSL_new],
596     [SSL_LIB="-lssl -lcrypto"],
597     [AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
598     [ -lcrypto "$DL_LIB" ]
599   )
601   AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
602   AC_SUBST([SSL_LIB])
603   AC_SUBST([CRYPTO_LIB])
606 dnl pcre support
607 AC_MSG_NOTICE([----------------------------------------])
608 AC_MSG_CHECKING([for perl regular expressions support])
609 AC_ARG_WITH([pcre],
610   [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
611   [WITH_PCRE=$withval],
612   [WITH_PCRE=yes]
614 AC_MSG_RESULT([$WITH_PCRE])
616 if test "$WITH_PCRE" != no; then
617   if test "$WITH_PCRE" != yes; then
618     PCRE_LIB="-L$WITH_PCRE/lib -lpcre"
619     CPPFLAGS="$CPPFLAGS -I$WITH_PCRE/include"
620   else
621     AC_PATH_PROG([PCRECONFIG], [pcre-config])
622     if test -n "$PCRECONFIG"; then
623       PCRE_LIB=`"$PCRECONFIG" --libs`
624       CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
625     fi
626   fi
628   if test -z "$PCRE_LIB"; then
629     AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
630   fi
632   AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
633   AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
634   AC_SUBST([PCRE_LIB])
637 dnl zlib
638 AC_MSG_NOTICE([----------------------------------------])
639 AC_MSG_CHECKING([for zlib support])
640 AC_ARG_WITH([zlib],
641   [AC_HELP_STRING([--with-zlib],
642     [Enable zlib support for mod_compress]
643   )],
644   [WITH_ZLIB=$withval],
645   [WITH_ZLIB=yes]
647 AC_MSG_RESULT([$WITH_ZLIB])
649 if test "$WITH_ZLIB" != no; then
650   if test "$WITH_ZLIB" != yes; then
651     Z_LIB="-L$WITH_ZLIB -lz"
652     CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
653   else
654     AC_CHECK_HEADERS([zlib.h], [],
655       [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
656     )
657     AC_CHECK_LIB([z], [deflate],
658       [Z_LIB=-lz],
659       [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
660     )
661   fi
663   AC_DEFINE([HAVE_LIBZ], [1], [libz])
664   AC_DEFINE([HAVE_ZLIB_H], [1])
665   AC_SUBST([Z_LIB])
668 dnl bzip2
669 AC_MSG_NOTICE([----------------------------------------])
670 AC_MSG_CHECKING([for bzip2 support])
671 AC_ARG_WITH([bzip2],
672   [AC_HELP_STRING([--with-bzip2],
673     [Enable bzip2 support for mod_compress]
674   )],
675   [WITH_BZIP2=$withval],
676   [WITH_BZIP2=yes]
678 AC_MSG_RESULT([$WITH_BZIP2])
680 if test "$WITH_BZIP2" != no; then
681   if test "$WITH_BZIP2" != yes; then
682     BZ_LIB="-L$WITH_BZIP2 -lbz2"
683     CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
684   else
685     AC_CHECK_HEADERS([bzlib.h], [], [
686       AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
687     ])
688     AC_CHECK_LIB([bz2], [BZ2_bzCompress],
689       [BZ_LIB=-lbz2],
690       [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
691     )
692   fi
694   AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
695   AC_DEFINE([HAVE_BZLIB_H], [1])
696   AC_SUBST([BZ_LIB])
699 dnl Check for fam/gamin
700 AC_MSG_NOTICE([----------------------------------------])
701 AC_MSG_CHECKING([for FAM])
702 AC_ARG_WITH([fam],
703   [AC_HELP_STRING([--with-fam],
704     [fam/gamin for reducing number of stat() calls]
705   )],
706   [WITH_FAM=$withval],
707   [WITH_FAM=no]
709 AC_MSG_RESULT([$WITH_FAM])
711 if test "$WITH_FAM" != no; then
712   if test "$WITH_FAM" != yes; then
713     FAM_LIBS="-L$WITH_FAM -lfam"
714     CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
715   else
716     AC_CHECK_LIB([fam], [FAMOpen2], [
717       AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
718     ])
719     dnl fam has no pkg-config so far, so just search for gamin as fallback
720     if test -z "$FAM_LIBS"; then
721       PKG_CHECK_MODULES([FAM], [gamin >= 0.1.0])
722     fi
723   fi
725   if test -z "$FAM_LIBS"; then
726     AC_MSG_ERROR([fam/gamin headers and/or libs were not found, install them or build without --with-fam])
727   fi
729   OLD_LIBS=$LIBS
730   LIBS=$FAM_LIBS
731   AC_CHECK_FUNCS([FAMNoExists])
732   LIBS=$OLD_LIBS
734   AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
735   AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
736   AC_SUBST([FAM_LIBS])
740 dnl webdav props (xml2 and sqlite3)
741 AC_MSG_NOTICE([----------------------------------------])
742 AC_MSG_CHECKING([for properties in mod_webdav])
743 AC_ARG_WITH([webdav-props],
744   [AC_HELP_STRING([--with-webdav-props], [properties in mod_webdav])],
745   [WITH_WEBDAV_PROPS=$withval],
746   [WITH_WEBDAV_PROPS=no]
748 AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
750 if test "$WITH_WEBDAV_PROPS" != no; then
751   AC_MSG_CHECKING([for libxml2])
752   AC_ARG_WITH([libxml],
753     [AC_HELP_STRING([--with-libxml],
754       [libxml2 for properties in mod_webdav]
755     )],
756     [WITH_LIBXML=$withval],
757     [WITH_LIBXML=yes]
758   )
759   AC_MSG_RESULT([$WITH_LIBXML])
761   if test "$WITH_LIBXML" = no; then
762     AC_MSG_ERROR([--with-webdav-props requires libxml])
763   fi
765   if test "$WITH_LIBXML" != yes; then
766     XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
767     XML_CFLAGS="-I$WITH_LIBXML/include"
768   else
769     PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
770       AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
771     ])
772   fi
774   AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
775   AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
776   AC_SUBST([XML_LIBS])
777   AC_SUBST([XML_CFLAGS])
779   AC_MSG_CHECKING([for sqlite])
780   AC_ARG_WITH([sqlite],
781     [AC_HELP_STRING([--with-sqlite],
782       [sqlite for properties in mod_webdav]
783     )],
784     [WITH_SQLITE=$withval],
785     [WITH_SQLITE=yes]
786   )
787   AC_MSG_RESULT([$WITH_SQLITE])
789   if test "$WITH_SQLITE" = no; then
790     AC_MSG_ERROR([--with-webdav-props requires sqlite])
791   fi
793   if test "$WITH_SQLITE" != yes; then
794     SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
795     SQLITE_CFLAGS="-I$WITH_SQLITE"
796   else
797     PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
798       AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
799     ])
800   fi
802   AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
803   AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
804   AC_SUBST([SQLITE_LIBS])
805   AC_SUBST([SQLITE_CFLAGS])
809 dnl webdav locks (uuid)
810 AC_MSG_NOTICE([----------------------------------------])
811 AC_MSG_CHECKING([for locks in mod_webdav])
812 AC_ARG_WITH([webdav-locks],
813   [AC_HELP_STRING([--with-webdav-locks],
814     [locks in mod_webdav (requires webdav properties)]
815   )],
816   [WITH_WEBDAV_LOCKS=$withval],
817   [WITH_WEBDAV_LOCKS=no]
819 AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
821 if test "$WITH_WEBDAV_LOCKS" != no; then
822   if test "$WITH_WEBDAV_PROPS" = no; then
823     AC_MSG_ERROR([--with-webdav-locks requires --with-webdav-props])
824   fi
826   AC_MSG_CHECKING([for libuuid])
827   AC_ARG_WITH([uuid],
828     [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
829     [WITH_UUID=$withval],
830     [WITH_UUID=yes]
831   )
832   AC_MSG_RESULT([$WITH_UUID])
834   if test "$WITH_UUID" = no; then
835     AC_MSG_ERROR([--with-webdav-locks requires uuid])
836   fi
838   if test "$WITH_UUID" != yes; then
839     UUID_LIBS="-L$WITH_UUID -luuid"
840     CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
841   else
842     AC_CHECK_LIB([uuid], [uuid_unparse],
843       [UUID_LIBS=-luuid],
844       [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
845     )
846     AC_CHECK_HEADERS([uuid/uuid.h], [],
847       [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
848     )
849   fi
851   AC_DEFINE([HAVE_UUID], [1], [libuuid])
852   AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
853   AC_SUBST([UUID_LIBS])
856 dnl Check for gdbm
857 AC_MSG_NOTICE([----------------------------------------])
858 AC_MSG_CHECKING([for gdbm])
859 AC_ARG_WITH([gdbm],
860   [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
861   [WITH_GDBM=$withval],
862   [WITH_GDBM=no]
864 AC_MSG_RESULT([$WITH_GDBM])
866 if test "$WITH_GDBM" != no; then
867   if test "$WITH_GDBM" != yes; then
868     GDBM_LIB="-L$WITH_GDBM -lgdbm"
869     CPPFLAGS="$CPPFLAGS -I$WITH_GDBM"
870   else
871     AC_CHECK_LIB([gdbm], [gdbm_open],
872       [GDBM_LIB=-lgdbm],
873       [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
874     )
875     AC_CHECK_HEADERS([gdbm.h], [],
876       [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
877     )
878   fi
880   AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
881   AC_DEFINE([HAVE_GDBM_H], [1])
882   AC_SUBST([GDBM_LIB])
884 AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
886 dnl Check for GeoIP
887 AC_MSG_NOTICE([----------------------------------------])
888 AC_MSG_CHECKING([for GeoIP])
889 AC_ARG_WITH([geoip],
890   [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
891   [WITH_GEOIP=$withval],
892   [WITH_GEOIP=no]
894 AC_MSG_RESULT([$WITH_GEOIP])
896 if test "$WITH_GEOIP" != no; then
897   if test "$WITH_GEOIP" != yes; then
898     GEOIP_LIB="-L$WITH_GEOIP -lGeoIP"
899     CPPFLAGS="$CPPFLAGS -I$WITH_GEOIP"
900   else
901     AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
902       [GEOIP_LIB=-lGeoIP],
903       [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
904     )
905     AC_CHECK_HEADERS([GeoIP.h], [],
906       [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
907     )
908   fi
910   AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
911   AC_DEFINE([HAVE_GEOIP_H], [1])
912   AC_SUBST([GEOIP_LIB])
914 AM_CONDITIONAL([BUILD_WITH_GEOIP], [test "$WITH_GEOIP" != no])
916 dnl Check for memcached
917 AC_MSG_NOTICE([----------------------------------------])
918 AC_MSG_CHECKING([for memcached])
919 AC_ARG_WITH([memcached],
920   [AC_HELP_STRING([--with-memcached],
921     [memcached storage for mod_trigger_b4_dl/mod_cml]
922   )],
923   [WITH_MEMCACHED=$withval],
924   [WITH_MEMCACHED=no]
926 AC_MSG_RESULT([$WITH_MEMCACHED])
928 if test "$WITH_MEMCACHED" != no; then
929   if test "$WITH_MEMCACHED" != yes; then
930     MEMCACHED_LIB="-L$WITH_MEMCACHED -lMEMCACHED"
931     CPPFLAGS="$CPPFLAGS -I$WITH_MEMCACHED"
932   else
933     AC_CHECK_LIB([memcached], [memcached],
934       [ MEMCACHED_LIB=-lmemcached ],
935       [AC_MSG_ERROR([memcached lib not found, install it or build without --with-memcached])]
936     )
937     AC_CHECK_HEADERS([libmemcached/memcached.h], [],
938       [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
939     )
940   fi
942   AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
943   AC_SUBST([MEMCACHED_LIB])
945 AM_CONDITIONAL([BUILD_WITH_MEMCACHED], [test "$WITH_MEMCACHED" != no])
947 BUILD_MOD_TRIGGER_B4_DL=no
948 if test "$WITH_MEMCACHED" != no || test "$WITH_GDBM" != no ; then
949   BUILD_MOD_TRIGGER_B4_DL=yes
952 AM_CONDITIONAL([BUILD_MOD_TRIGGER_B4_DL], [test "$BUILD_MOD_TRIGGER_B4_DL" != no])
954 dnl Check for lua
955 AC_MSG_NOTICE([----------------------------------------])
956 AC_MSG_CHECKING([if lua-support is requested])
957 AC_ARG_WITH([lua],
958   [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
959   [WITH_LUA=$withval],
960   [WITH_LUA=no]
962 AC_MSG_RESULT([$WITH_LUA])
964 if test "$WITH_LUA" != no; then
965   found_lua=0
966   if test "$WITH_LUA" != yes; then
967     PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
968       [found_lua=1],
969       [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
970     )
971     if test "$found_lua" = "0"; then
972       LUA_LIBS="-L$WITH_LUA -llua"
973       LUA_CFLAGS="-I$WITH_LUA"
974     fi
975   else
976     for luaname in lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua; do
977       if test "$found_lua" = "0"; then
978         PKG_CHECK_MODULES([LUA], [$luaname >= 5.1],
979           [found_lua=1],
980           [AC_MSG_NOTICE([Couldn\'t find $luaname])]
981         )
982       fi
983     done
984     if test "$found_lua" = "0"; then
985       AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
986     fi
987   fi
989   AC_DEFINE([HAVE_LUA], [1], [liblua])
990   AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
991   AC_SUBST([LUA_LIBS])
992   AC_SUBST([LUA_CFLAGS])
994 AM_CONDITIONAL([BUILD_WITH_LUA], [test "$WITH_LUA" != no])
996 dnl "--with-FEATURE" blocks end
997 AC_MSG_NOTICE([----------------------------------------])
999 dnl search for crypt_r and (fallback) for crypt
1000 save_LIBS=$LIBS
1001 LIBS=
1002 found_crypt=no
1003 AC_SEARCH_LIBS([crypt_r], [crypt],
1004   [
1005     AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
1006     AC_CHECK_HEADERS([crypt.h])
1007     CRYPT_LIB=$LIBS
1008     found_crypt=crypt_r
1009   ],
1010   [AC_SEARCH_LIBS([crypt], [crypt], [
1011     AC_DEFINE([HAVE_CRYPT], [1], [crypt])
1012     AC_CHECK_HEADERS([crypt.h])
1013     CRYPT_LIB=$LIBS
1014     found_crypt=crypt
1015   ])]
1017 LIBS=$save_LIBS
1018 AC_SUBST([CRYPT_LIB])
1020 AC_MSG_CHECKING([crypt_r/crypt support])
1021 AC_MSG_RESULT([$found_crypt])
1023 dnl check whether sendfilev needs -lsendfile
1024 AC_MSG_NOTICE([----------------------------------------])
1025 save_LIBS=$LIBS
1026 LIBS=
1027 have_sendfilev=no
1028 AC_SEARCH_LIBS([sendfilev], [sendfile], [
1029   if test -z "$LIBS"; then
1030     have_sendfilev=yes
1031   else
1032     have_sendfilev=$LIBS
1033   fi
1034   SENDFILE_LIB=$LIBS
1035   AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
1037 LIBS=$save_LIBS
1038 AC_SUBST([SENDFILE_LIB])
1040 AC_MSG_CHECKING([solaris sendfilev present])
1041 AC_MSG_RESULT([$have_sendfilev])
1043 AC_MSG_NOTICE([----------------------------------------])
1045 case "$host_os" in
1046 *mingw* ) LIBS="$LIBS -lwsock32" ;;
1047 * ) ;;
1048 esac
1050 AC_CHECK_FUNCS([\
1051   arc4random_buf \
1052   chroot \
1053   clock_gettime \
1054   epoll_ctl \
1055   explicit_bzero \
1056   fork \
1057   getloadavg \
1058   getrlimit \
1059   getuid \
1060   gmtime_r \
1061   inet_pton \
1062   issetugid \
1063   jrand48 \
1064   kqueue \
1065   localtime_r \
1066   lstat \
1067   madvise \
1068   memset \
1069   memset_s \
1070   mmap \
1071   pathconf \
1072   pipe2 \
1073   poll \
1074   port_create \
1075   select \
1076   send_file \
1077   sendfile \
1078   sendfile64 \
1079   sigaction \
1080   signal \
1081   srandom \
1082   writev \
1084 AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
1085 AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
1087 AC_MSG_NOTICE([----------------------------------------])
1088 AC_MSG_CHECKING([if weak symbols are supported])
1089 AC_LINK_IFELSE(
1090   [AC_LANG_PROGRAM([[
1091     __attribute__((weak)) void __dummy(void *x) { }
1092     void f(void *x) { __dummy(x); }
1093   ]])],
1094   [
1095     AC_MSG_RESULT([yes])
1096     AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
1097   ],
1098   [AC_MSG_RESULT([no])]
1101 AC_MSG_NOTICE([----------------------------------------])
1102 AC_MSG_CHECKING([for Large File System support])
1103 AC_ARG_ENABLE([lfs],
1104   [AC_HELP_STRING([--enable-lfs],
1105     [Turn on Large File System (default)]
1106   )],
1107   [
1108     case "${enableval}" in
1109     yes) ENABLE_LFS=yes ;;
1110     no) ENABLE_LFS=no ;;
1111     *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
1112     esac
1113   ],
1114   [ ENABLE_LFS=yes ]
1116 AC_MSG_RESULT([$ENABLE_LFS])
1117 if test "$ENABLE_LFS" = yes; then
1118   CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
1121 dnl check if sendfile works
1122 if test "$ac_cv_func_sendfile" = yes; then
1123   AC_MSG_NOTICE([----------------------------------------])
1124   AC_MSG_CHECKING([if sendfile works])
1125   if test "$cross_compiling" = no; then
1126     AC_TRY_RUN(
1127       [
1128         #ifdef HAVE_SYS_SENDFILE_H
1129         #include <sys/sendfile.h>
1130         #endif /* HAVE_SYS_SENDFILE_H */
1131         #include <errno.h>
1132         int main() {
1133           int o = 0;
1134           if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
1135           return 0;
1136         }
1137       ],
1138       [AC_MSG_RESULT([yes])],
1139       [
1140         AC_MSG_RESULT([no])
1141         AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1142       ]
1143     )
1144   else
1145     AC_MSG_RESULT([no, cross-compiling])
1146     AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1147   fi
1150 dnl Check for IPv6 support
1151 AC_MSG_NOTICE([----------------------------------------])
1152 AC_ARG_ENABLE([ipv6],
1153   [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
1154   [
1155     case "${enableval}" in
1156     yes) ipv6=true ;;
1157     no) ipv6=false ;;
1158     *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1159     esac
1160   ],
1161   [ipv6=true]
1164 if test "$ipv6" = true; then
1165   AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
1166     AC_TRY_LINK(
1167       [
1168         #include <sys/types.h>
1169         #include <sys/socket.h>
1170         #include <netinet/in.h>
1171       ],
1172       [
1173         struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1174       ],
1175       [ac_cv_ipv6_support=yes],
1176       [ac_cv_ipv6_support=no]
1177     )
1178   ])
1180   if test "$ac_cv_ipv6_support" = yes; then
1181     AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
1182   else
1183     AC_MSG_ERROR([IPv6 seems broken.  Fix it or build with --disable-ipv6])
1184   fi
1187 # disable mmap by default
1188 # lighttpd may always use mmap with files it owns (created tmp files)
1189 AC_MSG_NOTICE([----------------------------------------])
1190 AC_MSG_CHECKING([use mmap if available])
1191 AC_ARG_ENABLE([mmap],
1192   [AC_HELP_STRING([--enable-mmap],
1193     [use mmap if available]
1194   )],
1195   [
1196     case "${enableval}" in
1197     yes) mmap=true ;;
1198     no) mmap=false ;;
1199     *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
1200     esac
1201   ],
1202   [mmap=false]
1204 AC_MSG_RESULT([$mmap])
1206 if test "$mmap" = true; then
1207   AC_DEFINE([ENABLE_MMAP], [1], [Use mmap if available])
1210 dnl check for fastcgi lib, for the tests only
1211 AC_MSG_NOTICE([----------------------------------------])
1212 fastcgi_found=no
1213 AC_CHECK_LIB([fcgi], [FCGI_Accept], [
1214   AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
1215     fastcgi_found=yes
1216   ])
1219 AM_CONDITIONAL([CHECK_WITH_FASTCGI], [test "$fastcgi_found" = yes])
1222 AC_MSG_NOTICE([----------------------------------------])
1223 dnl check for extra compiler options (warning options)
1224 if test "${GCC}" = yes; then
1225   TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
1228 AC_ARG_ENABLE([extra-warnings],
1229   [AC_HELP_STRING([--enable-extra-warnings],
1230     [enable extra warnings (gcc specific)]
1231   )],
1232   [
1233     case "${enableval}" in
1234     error) extrawarnings=error ;;
1235     yes) extrawarnings=true ;;
1236     no) extrawarnings=false ;;
1237     *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
1238     esac
1239   ],
1240   [extrawarnings=false]
1243 if test "$extrawarnings" = true || test "$extrawarnings" = error; then
1244   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])
1245   TRY_LDFLAGS([-Wl,--as-needed])
1246   if test "$extrawarnings" = error; then
1247     AS_VAR_APPEND([CFLAGS], [" -Werror"])
1248     AS_VAR_APPEND([LDFLAGS], [" -Wl,--fatal-warnings"])
1249   fi
1252 dnl build version-id
1253 LIGHTTPD_VERSION_ID=m4_format([0x%x%02x%02x], m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))
1254 AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
1256 AC_CONFIG_FILES([\
1257   distribute.sh \
1258   doc/config/conf.d/Makefile \
1259   doc/config/Makefile \
1260   doc/config/vhosts.d/Makefile \
1261   doc/Makefile \
1262   doc/outdated/Makefile \
1263   doc/scripts/Makefile \
1264   doc/systemd/Makefile \
1265   Makefile \
1266   src/Makefile \
1267   tests/docroot/123/Makefile \
1268   tests/docroot/Makefile \
1269   tests/docroot/www/expire/Makefile \
1270   tests/docroot/www/go/Makefile \
1271   tests/docroot/www/indexfile/Makefile \
1272   tests/docroot/www/Makefile \
1273   tests/Makefile \
1275 AC_OUTPUT
1277 do_build="\
1278   mod_access \
1279   mod_accesslog \
1280   mod_alias \
1281   mod_auth \
1282   mod_authn_file \
1283   mod_cgi \
1284   mod_compress \
1285   mod_deflate \
1286   mod_dirlisting \
1287   mod_evhost \
1288   mod_expire \
1289   mod_extforward \
1290   mod_fastcgi \
1291   mod_flv_streaming \
1292   mod_indexfile \
1293   mod_proxy \
1294   mod_redirect \
1295   mod_rewrite \
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 lighty_track_feature() {
1312   if eval "$3"; then
1313     enable_feature="$enable_feature $1"
1314     do_build="$do_build $2"
1315   else
1316     disable_feature="$disable_feature $1"
1317     no_build="$no_build $2"
1318   fi
1321 lighty_track_feature "regex-conditionals" "" \
1322   'test "$WITH_PCRE" != no'
1324 lighty_track_feature "storage-gdbm" "" \
1325   'test "$WITH_GDBM" != no'
1327 lighty_track_feature "storage-memcached" "" \
1328   'test "$WITH_MEMCACHED" != no'
1330 lighty_track_feature "" "mod_trigger_b4_dl" \
1331   'test "$BUILD_MOD_TRIGGER_B4_DL" != no'
1333 lighty_track_feature "mysql" "mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql" \
1334   'test "$WITH_MYSQL" != no'
1336 lighty_track_feature "postgresql" "mod_vhostdb_pgsql" \
1337   'test "$WITH_PGSQL" != no'
1339 lighty_track_feature "dbi" "mod_vhostdb_dbi" \
1340   'test "$WITH_DBI" != no'
1342 lighty_track_feature "lua" "mod_cml mod_magnet" \
1343   'test "$WITH_LUA" != no'
1345 lighty_track_feature "geoip" "mod_geoip" \
1346   'test "$WITH_GEOIP" != no'
1348 lighty_track_feature "compress-gzip compress-deflate" "" \
1349   'test "$WITH_ZLIB" != no'
1351 lighty_track_feature "compress-bzip2" "" \
1352   'test "$WITH_BZIP2" != no'
1354 lighty_track_feature "kerberos" "mod_authn_gssapi" \
1355   'test "$WITH_KRB5" != no'
1357 lighty_track_feature "ldap" "mod_authn_ldap mod_vhostdb_ldap" \
1358   'test "$WITH_LDAP" != no'
1360 lighty_track_feature "network-openssl" "mod_openssl" \
1361   'test "$WITH_OPENSSL" != no'
1363 lighty_track_feature "auth-crypt" "" \
1364   'test "$found_crypt" != no'
1366 lighty_track_feature "network-ipv6" "" \
1367   'test "$ac_cv_ipv6_support" != no'
1369 lighty_track_feature "large-files" "" \
1370   'test "$ENABLE_LFS" = yes'
1372 lighty_track_feature "stat-cache-fam" "" \
1373   'test "$WITH_FAM" != no'
1375 lighty_track_feature "webdav-properties" "" \
1376   'test "$WITH_WEBDAV_PROPS" != no'
1378 lighty_track_feature "webdav-locks" "" \
1379   'test "$WITH_WEBDAV_LOCKS" != no'
1381 dnl output
1383 $ECHO
1384 $ECHO "Plugins:"
1385 $ECHO
1387 $ECHO "enabled: "
1388 for p in $do_build; do
1389   $ECHO "  $p"
1390 done | sort
1392 $ECHO "disabled: "
1393 for p in $no_build; do
1394   $ECHO "  $p"
1395 done | sort
1397 $ECHO
1398 $ECHO "Features:"
1399 $ECHO
1401 $ECHO "enabled: "
1402 for p in $enable_feature; do
1403   $ECHO "  $p"
1404 done | sort
1406 $ECHO "disabled: "
1407 for p in $disable_feature; do
1408   $ECHO "  $p"
1409 done | sort
1411 $ECHO