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.
72 AC_USE_SYSTEM_EXTENSIONS
77 *darwin*|*cygwin*|*aix*|*mingw*|*midipix* ) NO_RDYNAMIC=yes ;;
80 AM_CONDITIONAL([NO_RDYNAMIC], [test "$NO_RDYNAMIC" = yes])
82 AM_CONDITIONAL([LIGHTTPD_STATIC], [test "$LIGHTTPD_STATIC" = yes])
94 CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
96 dnl Checks for header files.
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)
103 dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
129 dnl Checks for typedefs, structures, and compiler characteristics.
136 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
137 [AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
141 AC_CHECK_TYPES([socklen_t],
142 [], dnl defines HAVE_SOCKLEN_T
145 #include <sys/types.h>
146 #include <sys/socket.h>
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)
163 AC_SEARCH_LIBS([dlopen], [dl], [
164 AC_CHECK_HEADERS([dlfcn.h], [
166 AC_DEFINE([HAVE_LIBDL], [1], [libdl])
167 AC_DEFINE([HAVE_DLFCN_H], [1])
173 dnl prepare pkg-config usage below
174 if test -z "$PKG_CONFIG"; then
175 AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
179 dnl checking for libev
180 AC_MSG_NOTICE([----------------------------------------])
181 AC_MSG_CHECKING([for libev support])
183 [AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
184 [Include libev support for fdevent handlers in PATH/include and PATH/lib]
186 [WITH_LIBEV=$withval],
189 AC_MSG_RESULT([$WITH_LIBEV])
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"
202 AC_CHECK_HEADERS([ev.h],
203 [AC_CHECK_LIB([ev], [ev_time],
208 [AC_MSG_ERROR([libev not found])]
210 [AC_MSG_ERROR([libev header not found])]
215 AC_DEFINE([HAVE_LIBEV], [1], [libev support])
218 AC_SUBST([LIBEV_CFLAGS])
219 AC_SUBST([LIBEV_LIBS])
222 AC_MSG_NOTICE([----------------------------------------])
223 AC_MSG_CHECKING([for MySQL support])
225 [AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
226 [Include MySQL support. PATH is the path to 'mysql_config']
228 [WITH_MYSQL=$withval],
231 AC_MSG_RESULT([$WITH_MYSQL])
236 if test "$WITH_MYSQL" != no; then
237 if test "$WITH_MYSQL" = yes; then
238 AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
240 MYSQL_CONFIG=$WITH_MYSQL
243 if test -z "$MYSQL_CONFIG"; then
244 AC_MSG_ERROR([mysql_config is not found])
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])
250 if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
251 MYSQL_INCLUDE=`"$MYSQL_CONFIG" --include | sed s/\'//g`
253 MYSQL_INCLUDE=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
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])
271 AC_MSG_NOTICE([----------------------------------------])
272 AC_MSG_CHECKING([for PgSQL support])
274 [AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
275 [Include PgSQL support. PATH is the path to 'pg_config']
277 [WITH_PGSQL=$withval],
280 AC_MSG_RESULT([$WITH_PGSQL])
285 if test "$WITH_PGSQL" != no; then
286 if test "$WITH_PGSQL" = yes; then
287 AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
289 PGSQL_CONFIG=$WITH_PGSQL
292 if test -z "$PGSQL_CONFIG"; then
293 AC_MSG_ERROR([pg_config is not found])
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])
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])
319 [AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
320 [Include DBI support in PATH/include/dbi.h and PATH/lib]
325 AC_MSG_RESULT([$WITH_DBI])
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"
335 AC_CHECK_HEADERS([dbi/dbi.h],
336 [AC_CHECK_LIB([dbi], [dbi_version],
341 [AC_MSG_ERROR([LibDBI not found])]
343 [AC_MSG_ERROR([LibDBI header not found])]
347 AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
349 AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
352 AC_SUBST([DBI_CFLAGS])
356 AC_MSG_NOTICE([----------------------------------------])
357 AC_MSG_CHECKING([for LDAP support])
359 [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
360 [WITH_LDAP=$withval],
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],
370 AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
371 AC_DEFINE([HAVE_LDAP_H], [1])
372 AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
374 [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
376 [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
379 AC_CHECK_LIB([lber], [ber_printf],
380 [AC_CHECK_HEADERS([lber.h],
383 AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
384 AC_DEFINE([HAVE_LBER_H], [1])
386 [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
388 [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
392 AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
395 AC_MSG_NOTICE([----------------------------------------])
396 AC_MSG_CHECKING([for extended attributes support])
398 [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
399 [WITH_ATTR=$withval],
402 AC_MSG_RESULT([$WITH_ATTR])
404 if test "$WITH_ATTR" != no; then
406 # libattr (linux only?)
407 AC_CHECK_LIB([attr], [attr_get], [
408 AC_CHECK_HEADERS([attr/attributes.h], [
410 AC_DEFINE([HAVE_XATTR], [1], [libattr])
411 AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
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])
426 if test "$have_xattr" = no; then
427 AC_MSG_ERROR([no backend found implementing extended attributes])
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]
438 [WITH_VALGRIND=$withval],
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])
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]
456 [WITH_LIBUNWIND=$withval],
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])
465 AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
468 dnl Checking for kerberos5
469 AC_MSG_NOTICE([----------------------------------------])
470 AC_MSG_CHECKING([for kerberos5])
472 [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
473 [WITH_KRB5=$withval],
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"
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])],
489 if test "$WITH_KRB5" = no; then
490 AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
492 krb5_append_CPPFLAGS=" -I$withval"
493 AC_MSG_RESULT([$withval])
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])],
502 if test "$WITH_KRB5" = no; then
503 AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
505 krb5_append_LDFLAGS=" -L$withval"
506 AC_MSG_RESULT([$withval])
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],
518 KRB5_LIB="-lkrb5 -lgssapi_krb5"
519 AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
521 [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
523 [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
526 *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
531 AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
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)]
541 [WITH_OPENSSL=$withval],
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"
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])],
557 if test "$WITH_OPENSSL" = no; then
558 AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
560 openssl_append_CPPFLAGS=" -I$withval"
561 AC_MSG_RESULT([$withval])
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])],
570 if test "$WITH_OPENSSL" = no; then
571 AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
573 openssl_append_LDFLAGS=" -L$withval"
574 AC_MSG_RESULT([$withval])
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])
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])
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])]
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" ]
602 AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
604 AC_SUBST([CRYPTO_LIB])
608 AC_MSG_NOTICE([----------------------------------------])
609 AC_MSG_CHECKING([for perl regular expressions support])
611 [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
612 [WITH_PCRE=$withval],
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"
622 AC_PATH_PROG([PCRECONFIG], [pcre-config])
623 if test -n "$PCRECONFIG"; then
624 PCRE_LIB=`"$PCRECONFIG" --libs`
625 CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
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])
633 AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
634 AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
639 AC_MSG_NOTICE([----------------------------------------])
640 AC_MSG_CHECKING([for zlib support])
642 [AC_HELP_STRING([--with-zlib],
643 [Enable zlib support for mod_compress]
645 [WITH_ZLIB=$withval],
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"
655 AC_CHECK_HEADERS([zlib.h], [],
656 [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
658 AC_CHECK_LIB([z], [deflate],
660 [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
664 AC_DEFINE([HAVE_LIBZ], [1], [libz])
665 AC_DEFINE([HAVE_ZLIB_H], [1])
670 AC_MSG_NOTICE([----------------------------------------])
671 AC_MSG_CHECKING([for bzip2 support])
673 [AC_HELP_STRING([--with-bzip2],
674 [Enable bzip2 support for mod_compress]
676 [WITH_BZIP2=$withval],
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"
686 AC_CHECK_HEADERS([bzlib.h], [], [
687 AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
689 AC_CHECK_LIB([bz2], [BZ2_bzCompress],
691 [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
695 AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
696 AC_DEFINE([HAVE_BZLIB_H], [1])
700 dnl Check for fam/gamin
701 AC_MSG_NOTICE([----------------------------------------])
702 AC_MSG_CHECKING([for FAM])
704 [AC_HELP_STRING([--with-fam],
705 [fam/gamin for reducing number of stat() calls]
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"
717 AC_CHECK_LIB([fam], [FAMOpen2], [
718 AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
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])
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])
732 AC_CHECK_FUNCS([FAMNoExists])
735 AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
736 AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
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]
757 [WITH_LIBXML=$withval],
760 AC_MSG_RESULT([$WITH_LIBXML])
762 if test "$WITH_LIBXML" = no; then
763 AC_MSG_ERROR([--with-webdav-props requires libxml])
766 if test "$WITH_LIBXML" != yes; then
767 XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
768 XML_CFLAGS="-I$WITH_LIBXML/include"
770 PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
771 AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
775 AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
776 AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
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]
785 [WITH_SQLITE=$withval],
788 AC_MSG_RESULT([$WITH_SQLITE])
790 if test "$WITH_SQLITE" = no; then
791 AC_MSG_ERROR([--with-webdav-props requires sqlite])
794 if test "$WITH_SQLITE" != yes; then
795 SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
796 SQLITE_CFLAGS="-I$WITH_SQLITE"
798 PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
799 AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
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)]
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])
827 AC_MSG_CHECKING([for libuuid])
829 [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
830 [WITH_UUID=$withval],
833 AC_MSG_RESULT([$WITH_UUID])
835 if test "$WITH_UUID" = no; then
836 AC_MSG_ERROR([--with-webdav-locks requires uuid])
839 if test "$WITH_UUID" != yes; then
840 UUID_LIBS="-L$WITH_UUID -luuid"
841 CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
843 AC_CHECK_LIB([uuid], [uuid_unparse],
845 [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
847 AC_CHECK_HEADERS([uuid/uuid.h], [],
848 [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
852 AC_DEFINE([HAVE_UUID], [1], [libuuid])
853 AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
854 AC_SUBST([UUID_LIBS])
858 AC_MSG_NOTICE([----------------------------------------])
859 AC_MSG_CHECKING([for gdbm])
861 [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
862 [WITH_GDBM=$withval],
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"
872 AC_CHECK_LIB([gdbm], [gdbm_open],
874 [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
876 AC_CHECK_HEADERS([gdbm.h], [],
877 [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
881 AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
882 AC_DEFINE([HAVE_GDBM_H], [1])
885 AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
888 AC_MSG_NOTICE([----------------------------------------])
889 AC_MSG_CHECKING([for GeoIP])
891 [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
892 [WITH_GEOIP=$withval],
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"
902 AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
904 [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
906 AC_CHECK_HEADERS([GeoIP.h], [],
907 [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
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]
924 [WITH_MEMCACHED=$withval],
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"
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])]
938 AC_CHECK_HEADERS([libmemcached/memcached.h], [],
939 [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
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])
956 AC_MSG_NOTICE([----------------------------------------])
957 AC_MSG_CHECKING([if lua-support is requested])
959 [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
963 AC_MSG_RESULT([$WITH_LUA])
965 if test "$WITH_LUA" != no; then
967 if test "$WITH_LUA" != yes; then
968 PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
970 [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
972 if test "$found_lua" = "0"; then
973 LUA_LIBS="-L$WITH_LUA -llua"
974 LUA_CFLAGS="-I$WITH_LUA"
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],
981 [AC_MSG_NOTICE([Couldn\'t find $luaname])]
985 if test "$found_lua" = "0"; then
986 AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
990 AC_DEFINE([HAVE_LUA], [1], [liblua])
991 AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
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
1004 AC_SEARCH_LIBS([crypt_r], [crypt],
1006 AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
1007 AC_CHECK_HEADERS([crypt.h])
1011 [AC_SEARCH_LIBS([crypt], [crypt], [
1012 AC_DEFINE([HAVE_CRYPT], [1], [crypt])
1013 AC_CHECK_HEADERS([crypt.h])
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([----------------------------------------])
1029 AC_SEARCH_LIBS([sendfilev], [sendfile], [
1030 if test -z "$LIBS"; then
1033 have_sendfilev=$LIBS
1036 AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
1039 AC_SUBST([SENDFILE_LIB])
1041 AC_MSG_CHECKING([solaris sendfilev present])
1042 AC_MSG_RESULT([$have_sendfilev])
1044 AC_MSG_NOTICE([----------------------------------------])
1047 *mingw* ) LIBS="$LIBS -lwsock32" ;;
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])
1092 __attribute__((weak)) void __dummy(void *x) { }
1093 void f(void *x) { __dummy(x); }
1096 AC_MSG_RESULT([yes])
1097 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
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)]
1109 case "${enableval}" in
1110 yes) ENABLE_LFS=yes ;;
1111 no) ENABLE_LFS=no ;;
1112 *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
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
1129 #ifdef HAVE_SYS_SENDFILE_H
1130 #include <sys/sendfile.h>
1131 #endif /* HAVE_SYS_SENDFILE_H */
1135 if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
1139 [AC_MSG_RESULT([yes])],
1142 AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1146 AC_MSG_RESULT([no, cross-compiling])
1147 AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1151 dnl Check for IPv6 support
1152 AC_MSG_NOTICE([----------------------------------------])
1153 AC_ARG_ENABLE([ipv6],
1154 [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
1156 case "${enableval}" in
1159 *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1165 if test "$ipv6" = true; then
1166 AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
1169 #include <sys/types.h>
1170 #include <sys/socket.h>
1171 #include <netinet/in.h>
1174 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1176 [ac_cv_ipv6_support=yes],
1177 [ac_cv_ipv6_support=no]
1181 if test "$ac_cv_ipv6_support" = yes; then
1182 AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
1184 AC_MSG_ERROR([IPv6 seems broken. Fix it or build with --disable-ipv6])
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)]
1198 case "${enableval}" in
1201 *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
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([----------------------------------------])
1215 AC_CHECK_LIB([fcgi], [FCGI_Accept], [
1216 AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
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)]
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]) ;;
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"])
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])
1260 doc/config/conf.d/Makefile \
1261 doc/config/Makefile \
1262 doc/config/vhosts.d/Makefile \
1264 doc/outdated/Makefile \
1265 doc/scripts/Makefile \
1266 doc/systemd/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 \
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"
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"
1326 no_build="$no_build $plugins"
1330 plugins="mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql"
1331 if test -n "$MYSQL_LIBS"; then
1332 do_build="$do_build $plugins"
1334 no_build="$no_build $plugins"
1337 plugins="mod_vhostdb_pgsql"
1338 if test -n "$PGSQL_LIBS"; then
1339 do_build="$do_build $plugins"
1341 no_build="$no_build $plugins"
1344 plugins="mod_vhostdb_dbi"
1345 if test -n "$DBI_LIBS"; then
1346 do_build="$do_build $plugins"
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"
1355 no_build="$no_build $plugins"
1359 if test -n "$GEOIP_LIB"; then
1360 do_build="$do_build $plugins"
1362 no_build="$no_build $plugins"
1365 features="storage-gdbm"
1366 if test -n "$GDBM_LIB"; then
1367 enable_feature="$enable_feature $features"
1369 disable_feature="$disable_feature $features"
1372 features="storage-memcached"
1373 if test -n "$MEMCACHED_LIB"; then
1374 enable_feature="$enable_feature $features"
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"
1383 disable_feature="$disable_feature $features"
1386 features="compress-bzip2"
1387 if test -n "$BZ_LIB"; then
1388 enable_feature="$enable_feature $features"
1390 disable_feature="$disable_feature $features"
1393 plugins="mod_authn_gssapi"
1394 if test -n "$KRB5_LIB"; then
1395 do_build="$do_build $plugins"
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"
1404 no_build="$no_build $plugins"
1407 features="network-openssl"
1408 if test -n "$SSL_LIB"; then
1409 enable_feature="$enable_feature $features"
1411 disable_feature="$disable_feature $features"
1415 features="auth-crypt"
1416 if test "$ac_cv_search_crypt" = no; then
1417 disable_feature="$disable_feature $features"
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"
1426 disable_feature="$disable_feature $features"
1429 features="large-files"
1430 if test "$enable_lfs" = yes; then
1431 enable_feature="$enable_feature $features"
1433 disable_feature="$disable_feature $features"
1436 features="stat-cache-fam"
1437 if test -n "$FAM_LIBS"; then
1438 enable_feature="$enable_feature $features"
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"
1447 disable_feature="$disable_feature $features"
1450 features="webdav-locks"
1451 if test -n "$UUID_LIBS"; then
1452 enable_feature="$enable_feature $features"
1454 disable_feature="$disable_feature $features"
1465 for p in $do_build; do
1470 for p in $no_build; do
1479 for p in $enable_feature; do
1484 for p in $disable_feature; do