2 dnl Process this file with autoconf to produce a configure script.
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
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])
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],
30 AC_MSG_CHECKING([if $CC supports $1])
32 ac_try_cflags_saved_cflags="${CFLAGS}"
34 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
35 [AC_MSG_RESULT([yes])],
38 CFLAGS="${ac_try_cflags_saved_cflags}"
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],
48 AC_MSG_CHECKING([if $LD supports $1])
50 ac_try_ldflags_saved_ldflags="${LDFLAGS}"
51 LDFLAGS="${LDFLAGS} $1"
52 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
53 [AC_MSG_RESULT([yes])],
56 LDFLAGS="${ac_try_ldflags_saved_cflags}"
62 dnl Checks for programs.
71 AC_USE_SYSTEM_EXTENSIONS
76 *darwin*|*cygwin*|*aix*|*mingw*|*midipix* ) NO_RDYNAMIC=yes ;;
79 AM_CONDITIONAL([NO_RDYNAMIC], [test "$NO_RDYNAMIC" = yes])
81 AM_CONDITIONAL([LIGHTTPD_STATIC], [test "$LIGHTTPD_STATIC" = yes])
93 CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
95 dnl Checks for header files.
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)
102 dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
128 dnl Checks for typedefs, structures, and compiler characteristics.
135 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
136 [AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
140 AC_CHECK_TYPES([socklen_t],
141 [], dnl defines HAVE_SOCKLEN_T
144 #include <sys/types.h>
145 #include <sys/socket.h>
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)
162 AC_SEARCH_LIBS([dlopen], [dl], [
163 AC_CHECK_HEADERS([dlfcn.h], [
165 AC_DEFINE([HAVE_LIBDL], [1], [libdl])
166 AC_DEFINE([HAVE_DLFCN_H], [1])
172 dnl prepare pkg-config usage below
173 if test -z "$PKG_CONFIG"; then
174 AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
178 dnl checking for libev
179 AC_MSG_NOTICE([----------------------------------------])
180 AC_MSG_CHECKING([for libev support])
182 [AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
183 [Include libev support for fdevent handlers in PATH/include and PATH/lib]
185 [WITH_LIBEV=$withval],
188 AC_MSG_RESULT([$WITH_LIBEV])
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"
201 AC_CHECK_HEADERS([ev.h],
202 [AC_CHECK_LIB([ev], [ev_time],
207 [AC_MSG_ERROR([libev not found])]
209 [AC_MSG_ERROR([libev header not found])]
214 AC_DEFINE([HAVE_LIBEV], [1], [libev support])
217 AC_SUBST([LIBEV_CFLAGS])
218 AC_SUBST([LIBEV_LIBS])
221 AC_MSG_NOTICE([----------------------------------------])
222 AC_MSG_CHECKING([for MySQL support])
224 [AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
225 [Include MySQL support. PATH is the path to 'mysql_config']
227 [WITH_MYSQL=$withval],
230 AC_MSG_RESULT([$WITH_MYSQL])
235 if test "$WITH_MYSQL" != no; then
236 if test "$WITH_MYSQL" = yes; then
237 AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
239 MYSQL_CONFIG=$WITH_MYSQL
242 if test -z "$MYSQL_CONFIG"; then
243 AC_MSG_ERROR([mysql_config is not found])
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])
249 if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
250 MYSQL_INCLUDE=`"$MYSQL_CONFIG" --include | sed s/\'//g`
252 MYSQL_INCLUDE=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
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])
270 AC_MSG_NOTICE([----------------------------------------])
271 AC_MSG_CHECKING([for PgSQL support])
273 [AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
274 [Include PgSQL support. PATH is the path to 'pg_config']
276 [WITH_PGSQL=$withval],
279 AC_MSG_RESULT([$WITH_PGSQL])
284 if test "$WITH_PGSQL" != no; then
285 if test "$WITH_PGSQL" = yes; then
286 AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
288 PGSQL_CONFIG=$WITH_PGSQL
291 if test -z "$PGSQL_CONFIG"; then
292 AC_MSG_ERROR([pg_config is not found])
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])
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])
318 [AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
319 [Include DBI support in PATH/include/dbi.h and PATH/lib]
324 AC_MSG_RESULT([$WITH_DBI])
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"
334 AC_CHECK_HEADERS([dbi/dbi.h],
335 [AC_CHECK_LIB([dbi], [dbi_version],
340 [AC_MSG_ERROR([LibDBI not found])]
342 [AC_MSG_ERROR([LibDBI header not found])]
346 AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
348 AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
351 AC_SUBST([DBI_CFLAGS])
355 AC_MSG_NOTICE([----------------------------------------])
356 AC_MSG_CHECKING([for LDAP support])
358 [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
359 [WITH_LDAP=$withval],
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],
369 AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
370 AC_DEFINE([HAVE_LDAP_H], [1])
371 AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
373 [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
375 [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
378 AC_CHECK_LIB([lber], [ber_printf],
379 [AC_CHECK_HEADERS([lber.h],
382 AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
383 AC_DEFINE([HAVE_LBER_H], [1])
385 [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
387 [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
391 AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
394 AC_MSG_NOTICE([----------------------------------------])
395 AC_MSG_CHECKING([for extended attributes support])
397 [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
398 [WITH_ATTR=$withval],
401 AC_MSG_RESULT([$WITH_ATTR])
403 if test "$WITH_ATTR" != no; then
405 # libattr (linux only?)
406 AC_CHECK_LIB([attr], [attr_get], [
407 AC_CHECK_HEADERS([attr/attributes.h], [
409 AC_DEFINE([HAVE_XATTR], [1], [libattr])
410 AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
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])
425 if test "$have_xattr" = no; then
426 AC_MSG_ERROR([no backend found implementing extended attributes])
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]
437 [WITH_VALGRIND=$withval],
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])
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]
455 [WITH_LIBUNWIND=$withval],
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])
464 AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
467 dnl Checking for kerberos5
468 AC_MSG_NOTICE([----------------------------------------])
469 AC_MSG_CHECKING([for kerberos5])
471 [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
472 [WITH_KRB5=$withval],
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"
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])],
488 if test "$WITH_KRB5" = no; then
489 AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
491 krb5_append_CPPFLAGS=" -I$withval"
492 AC_MSG_RESULT([$withval])
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])],
501 if test "$WITH_KRB5" = no; then
502 AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
504 krb5_append_LDFLAGS=" -L$withval"
505 AC_MSG_RESULT([$withval])
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],
517 KRB5_LIB="-lkrb5 -lgssapi_krb5"
518 AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
520 [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
522 [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
525 *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
530 AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
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)]
540 [WITH_OPENSSL=$withval],
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"
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])],
556 if test "$WITH_OPENSSL" = no; then
557 AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
559 openssl_append_CPPFLAGS=" -I$withval"
560 AC_MSG_RESULT([$withval])
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])],
569 if test "$WITH_OPENSSL" = no; then
570 AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
572 openssl_append_LDFLAGS=" -L$withval"
573 AC_MSG_RESULT([$withval])
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])
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])
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])]
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" ]
601 AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
603 AC_SUBST([CRYPTO_LIB])
607 AC_MSG_NOTICE([----------------------------------------])
608 AC_MSG_CHECKING([for perl regular expressions support])
610 [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
611 [WITH_PCRE=$withval],
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"
621 AC_PATH_PROG([PCRECONFIG], [pcre-config])
622 if test -n "$PCRECONFIG"; then
623 PCRE_LIB=`"$PCRECONFIG" --libs`
624 CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
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])
632 AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
633 AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
638 AC_MSG_NOTICE([----------------------------------------])
639 AC_MSG_CHECKING([for zlib support])
641 [AC_HELP_STRING([--with-zlib],
642 [Enable zlib support for mod_compress]
644 [WITH_ZLIB=$withval],
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"
654 AC_CHECK_HEADERS([zlib.h], [],
655 [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
657 AC_CHECK_LIB([z], [deflate],
659 [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
663 AC_DEFINE([HAVE_LIBZ], [1], [libz])
664 AC_DEFINE([HAVE_ZLIB_H], [1])
669 AC_MSG_NOTICE([----------------------------------------])
670 AC_MSG_CHECKING([for bzip2 support])
672 [AC_HELP_STRING([--with-bzip2],
673 [Enable bzip2 support for mod_compress]
675 [WITH_BZIP2=$withval],
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"
685 AC_CHECK_HEADERS([bzlib.h], [], [
686 AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
688 AC_CHECK_LIB([bz2], [BZ2_bzCompress],
690 [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
694 AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
695 AC_DEFINE([HAVE_BZLIB_H], [1])
699 dnl Check for fam/gamin
700 AC_MSG_NOTICE([----------------------------------------])
701 AC_MSG_CHECKING([for FAM])
703 [AC_HELP_STRING([--with-fam],
704 [fam/gamin for reducing number of stat() calls]
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"
716 AC_CHECK_LIB([fam], [FAMOpen2], [
717 AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
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])
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])
731 AC_CHECK_FUNCS([FAMNoExists])
734 AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
735 AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
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]
756 [WITH_LIBXML=$withval],
759 AC_MSG_RESULT([$WITH_LIBXML])
761 if test "$WITH_LIBXML" = no; then
762 AC_MSG_ERROR([--with-webdav-props requires libxml])
765 if test "$WITH_LIBXML" != yes; then
766 XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
767 XML_CFLAGS="-I$WITH_LIBXML/include"
769 PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
770 AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
774 AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
775 AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
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]
784 [WITH_SQLITE=$withval],
787 AC_MSG_RESULT([$WITH_SQLITE])
789 if test "$WITH_SQLITE" = no; then
790 AC_MSG_ERROR([--with-webdav-props requires sqlite])
793 if test "$WITH_SQLITE" != yes; then
794 SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
795 SQLITE_CFLAGS="-I$WITH_SQLITE"
797 PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
798 AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
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)]
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])
826 AC_MSG_CHECKING([for libuuid])
828 [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
829 [WITH_UUID=$withval],
832 AC_MSG_RESULT([$WITH_UUID])
834 if test "$WITH_UUID" = no; then
835 AC_MSG_ERROR([--with-webdav-locks requires uuid])
838 if test "$WITH_UUID" != yes; then
839 UUID_LIBS="-L$WITH_UUID -luuid"
840 CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
842 AC_CHECK_LIB([uuid], [uuid_unparse],
844 [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
846 AC_CHECK_HEADERS([uuid/uuid.h], [],
847 [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
851 AC_DEFINE([HAVE_UUID], [1], [libuuid])
852 AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
853 AC_SUBST([UUID_LIBS])
857 AC_MSG_NOTICE([----------------------------------------])
858 AC_MSG_CHECKING([for gdbm])
860 [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
861 [WITH_GDBM=$withval],
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"
871 AC_CHECK_LIB([gdbm], [gdbm_open],
873 [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
875 AC_CHECK_HEADERS([gdbm.h], [],
876 [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
880 AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
881 AC_DEFINE([HAVE_GDBM_H], [1])
884 AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
887 AC_MSG_NOTICE([----------------------------------------])
888 AC_MSG_CHECKING([for GeoIP])
890 [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
891 [WITH_GEOIP=$withval],
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"
901 AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
903 [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
905 AC_CHECK_HEADERS([GeoIP.h], [],
906 [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
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]
923 [WITH_MEMCACHED=$withval],
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"
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])]
937 AC_CHECK_HEADERS([libmemcached/memcached.h], [],
938 [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
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])
955 AC_MSG_NOTICE([----------------------------------------])
956 AC_MSG_CHECKING([if lua-support is requested])
958 [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
962 AC_MSG_RESULT([$WITH_LUA])
964 if test "$WITH_LUA" != no; then
966 if test "$WITH_LUA" != yes; then
967 PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
969 [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
971 if test "$found_lua" = "0"; then
972 LUA_LIBS="-L$WITH_LUA -llua"
973 LUA_CFLAGS="-I$WITH_LUA"
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],
980 [AC_MSG_NOTICE([Couldn\'t find $luaname])]
984 if test "$found_lua" = "0"; then
985 AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
989 AC_DEFINE([HAVE_LUA], [1], [liblua])
990 AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
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
1003 AC_SEARCH_LIBS([crypt_r], [crypt],
1005 AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
1006 AC_CHECK_HEADERS([crypt.h])
1010 [AC_SEARCH_LIBS([crypt], [crypt], [
1011 AC_DEFINE([HAVE_CRYPT], [1], [crypt])
1012 AC_CHECK_HEADERS([crypt.h])
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([----------------------------------------])
1028 AC_SEARCH_LIBS([sendfilev], [sendfile], [
1029 if test -z "$LIBS"; then
1032 have_sendfilev=$LIBS
1035 AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
1038 AC_SUBST([SENDFILE_LIB])
1040 AC_MSG_CHECKING([solaris sendfilev present])
1041 AC_MSG_RESULT([$have_sendfilev])
1043 AC_MSG_NOTICE([----------------------------------------])
1046 *mingw* ) LIBS="$LIBS -lwsock32" ;;
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])
1091 __attribute__((weak)) void __dummy(void *x) { }
1092 void f(void *x) { __dummy(x); }
1095 AC_MSG_RESULT([yes])
1096 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
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)]
1108 case "${enableval}" in
1109 yes) ENABLE_LFS=yes ;;
1110 no) ENABLE_LFS=no ;;
1111 *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
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
1128 #ifdef HAVE_SYS_SENDFILE_H
1129 #include <sys/sendfile.h>
1130 #endif /* HAVE_SYS_SENDFILE_H */
1134 if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
1138 [AC_MSG_RESULT([yes])],
1141 AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1147 dnl Check for IPv6 support
1148 AC_MSG_NOTICE([----------------------------------------])
1149 AC_ARG_ENABLE([ipv6],
1150 [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
1152 case "${enableval}" in
1155 *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1161 if test "$ipv6" = true; then
1162 AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
1165 #include <sys/types.h>
1166 #include <sys/socket.h>
1167 #include <netinet/in.h>
1170 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1172 [ac_cv_ipv6_support=yes],
1173 [ac_cv_ipv6_support=no]
1177 if test "$ac_cv_ipv6_support" = yes; then
1178 AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
1180 AC_MSG_ERROR([IPv6 seems broken. Fix it or build with --disable-ipv6])
1184 # disable mmap by default
1185 # lighttpd may always use mmap with files it owns (created tmp files)
1186 AC_MSG_NOTICE([----------------------------------------])
1187 AC_MSG_CHECKING([use mmap if available])
1188 AC_ARG_ENABLE([mmap],
1189 [AC_HELP_STRING([--enable-mmap],
1190 [use mmap if available]
1193 case "${enableval}" in
1196 *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
1201 AC_MSG_RESULT([$mmap])
1203 if test "$mmap" = true; then
1204 AC_DEFINE([ENABLE_MMAP], [1], [Use mmap if available])
1207 dnl check for fastcgi lib, for the tests only
1208 AC_MSG_NOTICE([----------------------------------------])
1210 AC_CHECK_LIB([fcgi], [FCGI_Accept], [
1211 AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
1216 AM_CONDITIONAL([CHECK_WITH_FASTCGI], [test "$fastcgi_found" = yes])
1219 AC_MSG_NOTICE([----------------------------------------])
1220 dnl check for extra compiler options (warning options)
1221 if test "${GCC}" = yes; then
1222 TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
1225 AC_ARG_ENABLE([extra-warnings],
1226 [AC_HELP_STRING([--enable-extra-warnings],
1227 [enable extra warnings (gcc specific)]
1230 case "${enableval}" in
1231 error) extrawarnings=error ;;
1232 yes) extrawarnings=true ;;
1233 no) extrawarnings=false ;;
1234 *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
1237 [extrawarnings=false]
1240 if test "$extrawarnings" = true || test "$extrawarnings" = error; then
1241 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])
1242 TRY_LDFLAGS([-Wl,--as-needed])
1243 if test "$extrawarnings" = error; then
1244 AS_VAR_APPEND([CFLAGS], [" -Werror"])
1245 AS_VAR_APPEND([LDFLAGS], [" -Wl,--fatal-warnings"])
1249 dnl build version-id
1250 LIGHTTPD_VERSION_ID=m4_format([0x%x%02x%02x], m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))
1251 AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
1255 doc/config/conf.d/Makefile \
1256 doc/config/Makefile \
1257 doc/config/vhosts.d/Makefile \
1259 doc/outdated/Makefile \
1260 doc/scripts/Makefile \
1261 doc/systemd/Makefile \
1264 tests/docroot/123/Makefile \
1265 tests/docroot/Makefile \
1266 tests/docroot/www/expire/Makefile \
1267 tests/docroot/www/go/Makefile \
1268 tests/docroot/www/indexfile/Makefile \
1269 tests/docroot/www/Makefile \
1308 lighty_track_feature() {
1310 enable_feature="$enable_feature $1"
1311 do_build="$do_build $2"
1313 disable_feature="$disable_feature $1"
1314 no_build="$no_build $2"
1318 lighty_track_feature "regex-conditionals" "" \
1319 'test "$WITH_PCRE" != no'
1321 lighty_track_feature "storage-gdbm" "" \
1322 'test "$WITH_GDBM" != no'
1324 lighty_track_feature "storage-memcached" "" \
1325 'test "$WITH_MEMCACHED" != no'
1327 lighty_track_feature "" "mod_trigger_b4_dl" \
1328 'test "$BUILD_MOD_TRIGGER_B4_DL" != no'
1330 lighty_track_feature "mysql" "mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql" \
1331 'test "$WITH_MYSQL" != no'
1333 lighty_track_feature "postgresql" "mod_vhostdb_pgsql" \
1334 'test "$WITH_PGSQL" != no'
1336 lighty_track_feature "dbi" "mod_vhostdb_dbi" \
1337 'test "$WITH_DBI" != no'
1339 lighty_track_feature "lua" "mod_cml mod_magnet" \
1340 'test "$WITH_LUA" != no'
1342 lighty_track_feature "geoip" "mod_geoip" \
1343 'test "$WITH_GEOIP" != no'
1345 lighty_track_feature "compress-gzip compress-deflate" "" \
1346 'test "$WITH_ZLIB" != no'
1348 lighty_track_feature "compress-bzip2" "" \
1349 'test "$WITH_BZIP2" != no'
1351 lighty_track_feature "kerberos" "mod_authn_gssapi" \
1352 'test "$WITH_KRB5" != no'
1354 lighty_track_feature "ldap" "mod_authn_ldap mod_vhostdb_ldap" \
1355 'test "$WITH_LDAP" != no'
1357 lighty_track_feature "network-openssl" "mod_openssl" \
1358 'test "$WITH_OPENSSL" != no'
1360 lighty_track_feature "auth-crypt" "" \
1361 'test "$found_crypt" != no'
1363 lighty_track_feature "network-ipv6" "" \
1364 'test "$ac_cv_ipv6_support" != no'
1366 lighty_track_feature "large-files" "" \
1367 'test "$ENABLE_LFS" = yes'
1369 lighty_track_feature "stat-cache-fam" "" \
1370 'test "$WITH_FAM" != no'
1372 lighty_track_feature "webdav-properties" "" \
1373 'test "$WITH_WEBDAV_PROPS" != no'
1375 lighty_track_feature "webdav-locks" "" \
1376 'test "$WITH_WEBDAV_LOCKS" != no'
1385 for p in $do_build; do
1390 for p in $no_build; do
1399 for p in $enable_feature; do
1404 for p in $disable_feature; do