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_DBI/include"
332 DBI_LIBS="-L$WITH_DBI/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])
353 dnl Checks for libsasl2 library
354 AC_MSG_NOTICE([----------------------------------------])
355 AC_MSG_CHECKING([for LibSASL support])
357 [AC_HELP_STRING([--with-sasl@<:@=PATH@:>@],
358 [Include SASL support in PATH/include/sasl/sasl.h and PATH/lib]
360 [WITH_SASL=$withval],
363 AC_MSG_RESULT([$WITH_SASL])
368 if test "$WITH_SASL" != no; then
369 if test "$WITH_SASL" != yes; then
370 SASL_CFLAGS="-I$WITH_SASL/include"
371 SASL_LIBS="-L$WITH_SASL/lib -lsasl2"
373 AC_CHECK_HEADERS([sasl/sasl.h],
374 [AC_CHECK_LIB([sasl2], [sasl_server_init],
379 [AC_MSG_ERROR([libsasl2 not found])]
381 [AC_MSG_ERROR([SASL header not found])]
385 AC_DEFINE([HAVE_SASL], [1], [LibSASL support])
387 AM_CONDITIONAL([BUILD_WITH_SASL], [test "$WITH_SASL" != no])
389 AC_SUBST([SASL_LIBS])
390 AC_SUBST([SASL_CFLAGS])
394 AC_MSG_NOTICE([----------------------------------------])
395 AC_MSG_CHECKING([for LDAP support])
397 [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
398 [WITH_LDAP=$withval],
401 AC_MSG_RESULT([$WITH_LDAP])
403 if test "$WITH_LDAP" != no; then
404 AC_CHECK_LIB([ldap], [ldap_sasl_bind_s],
405 [AC_CHECK_HEADERS([ldap.h],
408 AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
409 AC_DEFINE([HAVE_LDAP_H], [1])
411 [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
413 [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
416 AC_CHECK_LIB([lber], [ber_printf],
417 [AC_CHECK_HEADERS([lber.h],
420 AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
421 AC_DEFINE([HAVE_LBER_H], [1])
423 [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
425 [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
429 AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
432 AC_MSG_NOTICE([----------------------------------------])
433 AC_MSG_CHECKING([for extended attributes support])
435 [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
436 [WITH_ATTR=$withval],
439 AC_MSG_RESULT([$WITH_ATTR])
441 if test "$WITH_ATTR" != no; then
443 # libattr (linux only?)
444 AC_CHECK_LIB([attr], [attr_get], [
445 AC_CHECK_HEADERS([attr/attributes.h], [
447 AC_DEFINE([HAVE_XATTR], [1], [libattr])
448 AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
455 AC_CHECK_FUNC([extattr_get_file], [
456 AC_CHECK_HEADERS([sys/extattr.h], [
457 AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
458 AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
463 if test "$have_xattr" = no; then
464 AC_MSG_ERROR([no backend found implementing extended attributes])
468 dnl Check for valgrind
469 AC_MSG_NOTICE([----------------------------------------])
470 AC_MSG_CHECKING([for valgrind])
471 AC_ARG_WITH([valgrind],
472 [AC_HELP_STRING([--with-valgrind],
473 [enable internal support for valgrind]
475 [WITH_VALGRIND=$withval],
478 AC_MSG_RESULT([$WITH_VALGRIND])
480 if test "$WITH_VALGRIND" != no; then
481 AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
482 AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
486 dnl Checking for libunwind
487 AC_MSG_NOTICE([----------------------------------------])
488 AC_MSG_CHECKING([for libunwind])
489 AC_ARG_WITH([libunwind],
490 [AC_HELP_STRING([--with-libunwind],
491 [Include libunwind support for backtraces on assert failures]
493 [WITH_LIBUNWIND=$withval],
496 AC_MSG_RESULT([$WITH_LIBUNWIND])
498 if test "$WITH_LIBUNWIND" != no; then
499 PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
500 AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
502 AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
505 dnl Checking for kerberos5
506 AC_MSG_NOTICE([----------------------------------------])
507 AC_MSG_CHECKING([for kerberos5])
509 [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
510 [WITH_KRB5=$withval],
513 AC_MSG_RESULT([$WITH_KRB5])
515 if test "$WITH_KRB5" != no; then
516 if test "$WITH_KRB5" != yes; then
517 krb5_append_CPPFLAGS=" -I$WITH_KRB5/include"
518 krb5_append_LDFLAGS=" -L$WITH_KRB5/lib"
522 AC_MSG_CHECKING([custom include directory for kerberos5])
523 AC_ARG_WITH([krb5-includes],
524 [AC_HELP_STRING([--with-krb5-includes=DIR], [Kerberos includes])],
526 if test "$WITH_KRB5" = no; then
527 AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
529 krb5_append_CPPFLAGS=" -I$withval"
530 AC_MSG_RESULT([$withval])
532 [AC_MSG_RESULT([no])]
535 AC_MSG_CHECKING([custom lib directory for kerberos5])
536 AC_ARG_WITH([krb5-libs],
537 [AC_HELP_STRING([--with-krb5-libs=DIR], [Kerberos libraries])],
539 if test "$WITH_KRB5" = no; then
540 AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
542 krb5_append_LDFLAGS=" -L$withval"
543 AC_MSG_RESULT([$withval])
545 [AC_MSG_RESULT([no])]
548 if test "$WITH_KRB5" != no; then
549 CPPFLAGS="${CPPFLAGS}${krb5_append_CPPFLAGS}"
550 LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
552 AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
553 [AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
555 KRB5_LIB="-lkrb5 -lgssapi_krb5"
556 AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
558 [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
560 [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
563 *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
568 AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
571 dnl Check for openssl
572 AC_MSG_NOTICE([----------------------------------------])
573 AC_MSG_CHECKING([for OpenSSL])
574 AC_ARG_WITH([openssl],
575 [AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],
576 [Include openssl support (default no)]
578 [WITH_OPENSSL=$withval],
581 AC_MSG_RESULT([$WITH_OPENSSL])
583 if test "$WITH_OPENSSL" != no; then
584 if test "$WITH_OPENSSL" != yes; then
585 openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
586 openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
590 AC_MSG_CHECKING([custom include directory for openssl])
591 AC_ARG_WITH([openssl-includes],
592 [AC_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
594 if test "$WITH_OPENSSL" = no; then
595 AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
597 openssl_append_CPPFLAGS=" -I$withval"
598 AC_MSG_RESULT([$withval])
600 [AC_MSG_RESULT([no])]
603 AC_MSG_CHECKING([custom lib directory for openssl])
604 AC_ARG_WITH([openssl-libs],
605 [AC_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
607 if test "$WITH_OPENSSL" = no; then
608 AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
610 openssl_append_LDFLAGS=" -L$withval"
611 AC_MSG_RESULT([$withval])
613 [AC_MSG_RESULT([no])]
616 AM_CONDITIONAL([BUILD_WITH_OPENSSL], [test "$WITH_OPENSSL" != no])
618 if test "$WITH_OPENSSL" != no; then
619 if test "$WITH_KRB5" != no; then
620 AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
623 CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
624 LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
626 AC_CHECK_HEADERS([openssl/ssl.h], [], [
627 AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
629 AC_CHECK_LIB([crypto], [BIO_f_base64],
630 [CRYPTO_LIB="-lcrypto"],
631 [AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
633 AC_CHECK_LIB([ssl], [SSL_new],
634 [SSL_LIB="-lssl -lcrypto"],
635 [AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
636 [ -lcrypto "$DL_LIB" ]
639 AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
641 AC_SUBST([CRYPTO_LIB])
645 AC_MSG_NOTICE([----------------------------------------])
646 AC_MSG_CHECKING([for perl regular expressions support])
648 [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
649 [WITH_PCRE=$withval],
652 AC_MSG_RESULT([$WITH_PCRE])
654 if test "$WITH_PCRE" != no; then
655 if test "$WITH_PCRE" != yes; then
656 PCRE_LIB="-L$WITH_PCRE/lib -lpcre"
657 CPPFLAGS="$CPPFLAGS -I$WITH_PCRE/include"
659 AC_PATH_PROG([PCRECONFIG], [pcre-config])
660 if test -n "$PCRECONFIG"; then
661 PCRE_LIB=`"$PCRECONFIG" --libs`
662 CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
666 if test -z "$PCRE_LIB"; then
667 AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
670 AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
671 AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
676 AC_MSG_NOTICE([----------------------------------------])
677 AC_MSG_CHECKING([for zlib support])
679 [AC_HELP_STRING([--with-zlib],
680 [Enable zlib support for mod_compress]
682 [WITH_ZLIB=$withval],
685 AC_MSG_RESULT([$WITH_ZLIB])
687 if test "$WITH_ZLIB" != no; then
688 if test "$WITH_ZLIB" != yes; then
689 Z_LIB="-L$WITH_ZLIB -lz"
690 CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
692 AC_CHECK_HEADERS([zlib.h], [],
693 [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
695 AC_CHECK_LIB([z], [deflate],
697 [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
701 AC_DEFINE([HAVE_LIBZ], [1], [libz])
702 AC_DEFINE([HAVE_ZLIB_H], [1])
707 AC_MSG_NOTICE([----------------------------------------])
708 AC_MSG_CHECKING([for bzip2 support])
710 [AC_HELP_STRING([--with-bzip2],
711 [Enable bzip2 support for mod_compress]
713 [WITH_BZIP2=$withval],
716 AC_MSG_RESULT([$WITH_BZIP2])
718 if test "$WITH_BZIP2" != no; then
719 if test "$WITH_BZIP2" != yes; then
720 BZ_LIB="-L$WITH_BZIP2 -lbz2"
721 CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
723 AC_CHECK_HEADERS([bzlib.h], [], [
724 AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
726 AC_CHECK_LIB([bz2], [BZ2_bzCompress],
728 [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
732 AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
733 AC_DEFINE([HAVE_BZLIB_H], [1])
737 dnl Check for fam/gamin
738 AC_MSG_NOTICE([----------------------------------------])
739 AC_MSG_CHECKING([for FAM])
741 [AC_HELP_STRING([--with-fam],
742 [fam/gamin for reducing number of stat() calls]
747 AC_MSG_RESULT([$WITH_FAM])
749 if test "$WITH_FAM" != no; then
750 if test "$WITH_FAM" != yes; then
751 FAM_LIBS="-L$WITH_FAM -lfam"
752 CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
754 AC_CHECK_LIB([fam], [FAMOpen2], [
755 AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
757 dnl fam has no pkg-config so far, so just search for gamin as fallback
758 if test -z "$FAM_LIBS"; then
759 PKG_CHECK_MODULES([FAM], [gamin >= 0.1.0])
763 if test -z "$FAM_LIBS"; then
764 AC_MSG_ERROR([fam/gamin headers and/or libs were not found, install them or build without --with-fam])
769 AC_CHECK_FUNCS([FAMNoExists])
772 AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
773 AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
778 dnl webdav props (xml2 and sqlite3)
779 AC_MSG_NOTICE([----------------------------------------])
780 AC_MSG_CHECKING([for properties in mod_webdav])
781 AC_ARG_WITH([webdav-props],
782 [AC_HELP_STRING([--with-webdav-props], [properties in mod_webdav])],
783 [WITH_WEBDAV_PROPS=$withval],
784 [WITH_WEBDAV_PROPS=no]
786 AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
788 if test "$WITH_WEBDAV_PROPS" != no; then
789 AC_MSG_CHECKING([for libxml2])
790 AC_ARG_WITH([libxml],
791 [AC_HELP_STRING([--with-libxml],
792 [libxml2 for properties in mod_webdav]
794 [WITH_LIBXML=$withval],
797 AC_MSG_RESULT([$WITH_LIBXML])
799 if test "$WITH_LIBXML" = no; then
800 AC_MSG_ERROR([--with-webdav-props requires libxml])
803 if test "$WITH_LIBXML" != yes; then
804 XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
805 XML_CFLAGS="-I$WITH_LIBXML/include"
807 PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
808 AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
812 AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
813 AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
815 AC_SUBST([XML_CFLAGS])
817 AC_MSG_CHECKING([for sqlite])
818 AC_ARG_WITH([sqlite],
819 [AC_HELP_STRING([--with-sqlite],
820 [sqlite for properties in mod_webdav]
822 [WITH_SQLITE=$withval],
825 AC_MSG_RESULT([$WITH_SQLITE])
827 if test "$WITH_SQLITE" = no; then
828 AC_MSG_ERROR([--with-webdav-props requires sqlite])
831 if test "$WITH_SQLITE" != yes; then
832 SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
833 SQLITE_CFLAGS="-I$WITH_SQLITE"
835 PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
836 AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
840 AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
841 AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
842 AC_SUBST([SQLITE_LIBS])
843 AC_SUBST([SQLITE_CFLAGS])
847 dnl webdav locks (uuid)
848 AC_MSG_NOTICE([----------------------------------------])
849 AC_MSG_CHECKING([for locks in mod_webdav])
850 AC_ARG_WITH([webdav-locks],
851 [AC_HELP_STRING([--with-webdav-locks],
852 [locks in mod_webdav (requires webdav properties)]
854 [WITH_WEBDAV_LOCKS=$withval],
855 [WITH_WEBDAV_LOCKS=no]
857 AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
859 if test "$WITH_WEBDAV_LOCKS" != no; then
860 if test "$WITH_WEBDAV_PROPS" = no; then
861 AC_MSG_ERROR([--with-webdav-locks requires --with-webdav-props])
864 AC_MSG_CHECKING([for libuuid])
866 [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
867 [WITH_UUID=$withval],
870 AC_MSG_RESULT([$WITH_UUID])
872 if test "$WITH_UUID" = no; then
873 AC_MSG_ERROR([--with-webdav-locks requires uuid])
876 if test "$WITH_UUID" != yes; then
877 UUID_LIBS="-L$WITH_UUID -luuid"
878 CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
880 AC_CHECK_LIB([uuid], [uuid_unparse],
882 [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
884 AC_CHECK_HEADERS([uuid/uuid.h], [],
885 [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
889 AC_DEFINE([HAVE_UUID], [1], [libuuid])
890 AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
891 AC_SUBST([UUID_LIBS])
895 AC_MSG_NOTICE([----------------------------------------])
896 AC_MSG_CHECKING([for gdbm])
898 [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
899 [WITH_GDBM=$withval],
902 AC_MSG_RESULT([$WITH_GDBM])
904 if test "$WITH_GDBM" != no; then
905 if test "$WITH_GDBM" != yes; then
906 GDBM_LIB="-L$WITH_GDBM -lgdbm"
907 CPPFLAGS="$CPPFLAGS -I$WITH_GDBM"
909 AC_CHECK_LIB([gdbm], [gdbm_open],
911 [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
913 AC_CHECK_HEADERS([gdbm.h], [],
914 [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
918 AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
919 AC_DEFINE([HAVE_GDBM_H], [1])
922 AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
925 AC_MSG_NOTICE([----------------------------------------])
926 AC_MSG_CHECKING([for GeoIP])
928 [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
929 [WITH_GEOIP=$withval],
932 AC_MSG_RESULT([$WITH_GEOIP])
934 if test "$WITH_GEOIP" != no; then
935 if test "$WITH_GEOIP" != yes; then
936 GEOIP_LIB="-L$WITH_GEOIP -lGeoIP"
937 CPPFLAGS="$CPPFLAGS -I$WITH_GEOIP"
939 AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
941 [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
943 AC_CHECK_HEADERS([GeoIP.h], [],
944 [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
948 AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
949 AC_DEFINE([HAVE_GEOIP_H], [1])
950 AC_SUBST([GEOIP_LIB])
952 AM_CONDITIONAL([BUILD_WITH_GEOIP], [test "$WITH_GEOIP" != no])
954 dnl Check for memcached
955 AC_MSG_NOTICE([----------------------------------------])
956 AC_MSG_CHECKING([for memcached])
957 AC_ARG_WITH([memcached],
958 [AC_HELP_STRING([--with-memcached],
959 [memcached storage for mod_trigger_b4_dl/mod_cml]
961 [WITH_MEMCACHED=$withval],
964 AC_MSG_RESULT([$WITH_MEMCACHED])
966 if test "$WITH_MEMCACHED" != no; then
967 if test "$WITH_MEMCACHED" != yes; then
968 MEMCACHED_LIB="-L$WITH_MEMCACHED -lMEMCACHED"
969 CPPFLAGS="$CPPFLAGS -I$WITH_MEMCACHED"
971 AC_CHECK_LIB([memcached], [memcached],
972 [ MEMCACHED_LIB=-lmemcached ],
973 [AC_MSG_ERROR([memcached lib not found, install it or build without --with-memcached])]
975 AC_CHECK_HEADERS([libmemcached/memcached.h], [],
976 [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
980 AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
981 AC_SUBST([MEMCACHED_LIB])
983 AM_CONDITIONAL([BUILD_WITH_MEMCACHED], [test "$WITH_MEMCACHED" != no])
985 BUILD_MOD_TRIGGER_B4_DL=no
986 if test "$WITH_MEMCACHED" != no || test "$WITH_GDBM" != no ; then
987 BUILD_MOD_TRIGGER_B4_DL=yes
990 AM_CONDITIONAL([BUILD_MOD_TRIGGER_B4_DL], [test "$BUILD_MOD_TRIGGER_B4_DL" != no])
993 AC_MSG_NOTICE([----------------------------------------])
994 AC_MSG_CHECKING([if lua-support is requested])
996 [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
1000 AC_MSG_RESULT([$WITH_LUA])
1002 if test "$WITH_LUA" != no; then
1004 if test "$WITH_LUA" != yes; then
1005 PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
1007 [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
1009 if test "$found_lua" = "0"; then
1010 LUA_LIBS="-L$WITH_LUA -llua"
1011 LUA_CFLAGS="-I$WITH_LUA"
1014 for luaname in lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua; do
1015 if test "$found_lua" = "0"; then
1016 PKG_CHECK_MODULES([LUA], [$luaname >= 5.1],
1018 [AC_MSG_NOTICE([Couldn\'t find $luaname])]
1022 if test "$found_lua" = "0"; then
1023 AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
1027 AC_DEFINE([HAVE_LUA], [1], [liblua])
1028 AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
1029 AC_SUBST([LUA_LIBS])
1030 AC_SUBST([LUA_CFLAGS])
1032 AM_CONDITIONAL([BUILD_WITH_LUA], [test "$WITH_LUA" != no])
1034 dnl "--with-FEATURE" blocks end
1035 AC_MSG_NOTICE([----------------------------------------])
1037 dnl search for crypt_r and (fallback) for crypt
1041 AC_SEARCH_LIBS([crypt_r], [crypt],
1043 AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
1044 AC_CHECK_HEADERS([crypt.h])
1048 [AC_SEARCH_LIBS([crypt], [crypt], [
1049 AC_DEFINE([HAVE_CRYPT], [1], [crypt])
1050 AC_CHECK_HEADERS([crypt.h])
1056 AC_SUBST([CRYPT_LIB])
1058 AC_MSG_CHECKING([crypt_r/crypt support])
1059 AC_MSG_RESULT([$found_crypt])
1061 dnl check whether sendfilev needs -lsendfile
1062 AC_MSG_NOTICE([----------------------------------------])
1066 AC_SEARCH_LIBS([sendfilev], [sendfile], [
1067 if test -z "$LIBS"; then
1070 have_sendfilev=$LIBS
1073 AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
1076 AC_SUBST([SENDFILE_LIB])
1078 AC_MSG_CHECKING([solaris sendfilev present])
1079 AC_MSG_RESULT([$have_sendfilev])
1081 AC_MSG_NOTICE([----------------------------------------])
1084 *mingw* ) LIBS="$LIBS -lwsock32" ;;
1122 AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
1123 AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
1125 AC_MSG_NOTICE([----------------------------------------])
1126 AC_MSG_CHECKING([if weak symbols are supported])
1129 __attribute__((weak)) void __dummy(void *x) { }
1130 void f(void *x) { __dummy(x); }
1133 AC_MSG_RESULT([yes])
1134 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
1136 [AC_MSG_RESULT([no])]
1139 AC_MSG_NOTICE([----------------------------------------])
1140 AC_MSG_CHECKING([for Large File System support])
1141 AC_ARG_ENABLE([lfs],
1142 [AC_HELP_STRING([--enable-lfs],
1143 [Turn on Large File System (default)]
1146 case "${enableval}" in
1147 yes) ENABLE_LFS=yes ;;
1148 no) ENABLE_LFS=no ;;
1149 *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
1154 AC_MSG_RESULT([$ENABLE_LFS])
1155 if test "$ENABLE_LFS" = yes; then
1156 CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
1159 dnl check if sendfile works
1160 if test "$ac_cv_func_sendfile" = yes; then
1161 AC_MSG_NOTICE([----------------------------------------])
1162 AC_MSG_CHECKING([if sendfile works])
1163 if test "$cross_compiling" = no; then
1166 #ifdef HAVE_SYS_SENDFILE_H
1167 #include <sys/sendfile.h>
1168 #endif /* HAVE_SYS_SENDFILE_H */
1172 if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
1176 [AC_MSG_RESULT([yes])],
1179 AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1185 dnl Check for IPv6 support
1186 AC_MSG_NOTICE([----------------------------------------])
1187 AC_ARG_ENABLE([ipv6],
1188 [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
1190 case "${enableval}" in
1193 *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1199 if test "$ipv6" = true; then
1200 AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
1203 #include <sys/types.h>
1204 #include <sys/socket.h>
1205 #include <netinet/in.h>
1208 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1210 [ac_cv_ipv6_support=yes],
1211 [ac_cv_ipv6_support=no]
1215 if test "$ac_cv_ipv6_support" = yes; then
1216 AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
1218 AC_MSG_ERROR([IPv6 seems broken. Fix it or build with --disable-ipv6])
1222 # disable mmap by default
1223 # lighttpd may always use mmap with files it owns (created tmp files)
1224 AC_MSG_NOTICE([----------------------------------------])
1225 AC_MSG_CHECKING([use mmap if available])
1226 AC_ARG_ENABLE([mmap],
1227 [AC_HELP_STRING([--enable-mmap],
1228 [use mmap if available]
1231 case "${enableval}" in
1234 *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
1239 AC_MSG_RESULT([$mmap])
1241 if test "$mmap" = true; then
1242 AC_DEFINE([ENABLE_MMAP], [1], [Use mmap if available])
1245 dnl check for fastcgi lib, for the tests only
1246 AC_MSG_NOTICE([----------------------------------------])
1248 AC_CHECK_LIB([fcgi], [FCGI_Accept], [
1249 AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
1254 AM_CONDITIONAL([CHECK_WITH_FASTCGI], [test "$fastcgi_found" = yes])
1257 AC_MSG_NOTICE([----------------------------------------])
1258 dnl check for extra compiler options (warning options)
1259 if test "${GCC}" = yes; then
1260 TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
1263 AC_ARG_ENABLE([extra-warnings],
1264 [AC_HELP_STRING([--enable-extra-warnings],
1265 [enable extra warnings (gcc specific)]
1268 case "${enableval}" in
1269 error) extrawarnings=error ;;
1270 yes) extrawarnings=true ;;
1271 no) extrawarnings=false ;;
1272 *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
1275 [extrawarnings=false]
1278 if test "$extrawarnings" = true || test "$extrawarnings" = error; then
1279 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])
1280 TRY_LDFLAGS([-Wl,--as-needed])
1281 if test "$extrawarnings" = error; then
1282 AS_VAR_APPEND([CFLAGS], [" -Werror"])
1283 AS_VAR_APPEND([LDFLAGS], [" -Wl,--fatal-warnings"])
1287 dnl build version-id
1288 LIGHTTPD_VERSION_ID=m4_format([0x%x%02x%02x], m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))
1289 AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
1293 doc/config/conf.d/Makefile \
1294 doc/config/Makefile \
1295 doc/config/vhosts.d/Makefile \
1297 doc/outdated/Makefile \
1298 doc/scripts/Makefile \
1299 doc/systemd/Makefile \
1302 tests/docroot/123/Makefile \
1303 tests/docroot/Makefile \
1304 tests/docroot/www/expire/Makefile \
1305 tests/docroot/www/go/Makefile \
1306 tests/docroot/www/indexfile/Makefile \
1307 tests/docroot/www/Makefile \
1346 lighty_track_feature() {
1348 enable_feature="$enable_feature $1"
1349 do_build="$do_build $2"
1351 disable_feature="$disable_feature $1"
1352 no_build="$no_build $2"
1356 lighty_track_feature "regex-conditionals" "" \
1357 'test "$WITH_PCRE" != no'
1359 lighty_track_feature "storage-gdbm" "" \
1360 'test "$WITH_GDBM" != no'
1362 lighty_track_feature "storage-memcached" "" \
1363 'test "$WITH_MEMCACHED" != no'
1365 lighty_track_feature "" "mod_trigger_b4_dl" \
1366 'test "$BUILD_MOD_TRIGGER_B4_DL" != no'
1368 lighty_track_feature "mysql" "mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql" \
1369 'test "$WITH_MYSQL" != no'
1371 lighty_track_feature "postgresql" "mod_vhostdb_pgsql" \
1372 'test "$WITH_PGSQL" != no'
1374 lighty_track_feature "dbi" "mod_vhostdb_dbi" \
1375 'test "$WITH_DBI" != no'
1377 lighty_track_feature "lua" "mod_cml mod_magnet" \
1378 'test "$WITH_LUA" != no'
1380 lighty_track_feature "geoip" "mod_geoip" \
1381 'test "$WITH_GEOIP" != no'
1383 lighty_track_feature "compress-gzip compress-deflate" "" \
1384 'test "$WITH_ZLIB" != no'
1386 lighty_track_feature "compress-bzip2" "" \
1387 'test "$WITH_BZIP2" != no'
1389 lighty_track_feature "kerberos" "mod_authn_gssapi" \
1390 'test "$WITH_KRB5" != no'
1392 lighty_track_feature "ldap" "mod_authn_ldap mod_vhostdb_ldap" \
1393 'test "$WITH_LDAP" != no'
1395 lighty_track_feature "network-openssl" "mod_openssl" \
1396 'test "$WITH_OPENSSL" != no'
1398 lighty_track_feature "auth-crypt" "" \
1399 'test "$found_crypt" != no'
1401 lighty_track_feature "network-ipv6" "" \
1402 'test "$ac_cv_ipv6_support" != no'
1404 lighty_track_feature "large-files" "" \
1405 'test "$ENABLE_LFS" = yes'
1407 lighty_track_feature "stat-cache-fam" "" \
1408 'test "$WITH_FAM" != no'
1410 lighty_track_feature "webdav-properties" "" \
1411 'test "$WITH_WEBDAV_PROPS" != no'
1413 lighty_track_feature "webdav-locks" "" \
1414 'test "$WITH_WEBDAV_LOCKS" != no'
1423 for p in $do_build; do
1428 for p in $no_build; do
1437 for p in $enable_feature; do
1442 for p in $disable_feature; do