2 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([lighttpd], [1.4.43], [contact@lighttpd.net])
5 AC_CONFIG_SRCDIR([src/server.c])
6 AC_CONFIG_HEADER([config.h])
7 AC_CONFIG_MACRO_DIR([m4])
11 dnl HOW FUCKING BROKEN IS AUTOMAKE...
12 dnl serial-tests is not recognized before 1.12, and required for serial tests with 1.13, sane version checks "impossible"
13 dnl if you don't use the default (symlinked) automake on your box, set AUTOMAKE to the path you're using
14 m4_define([serial_tests], [
15 m4_esyscmd([case `${AUTOMAKE:-automake} --version | head -n 1` in
16 *1.11.*|*1.10.*|*1.9.*);;
17 *) echo serial-tests;;
21 AM_INIT_AUTOMAKE([-Wall -Wno-portability -Wno-override foreign dist-xz tar-ustar] serial_tests)
23 dnl enable with --enable-silent-rules or make V=0 (needs automake >= 1.11)
24 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
27 dnl @synopsis TRY_CFLAGS [compiler flags]
28 dnl @summary check whether compiler supports given flags and adds them to CFLAGS
29 AC_DEFUN([TRY_CFLAGS],
31 AC_MSG_CHECKING([if $CC supports $1])
33 ac_try_cflags_saved_cflags="${CFLAGS}"
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
36 [AC_MSG_RESULT([yes])],
39 CFLAGS="${ac_try_cflags_saved_cflags}"
45 dnl @synopsis TRY_LDFLAGS [linker flags]
46 dnl @summary check whether linker supports given flags and adds them to LDFLAGS
47 AC_DEFUN([TRY_LDFLAGS],
49 AC_MSG_CHECKING([if $LD supports $1])
51 ac_try_ldflags_saved_ldflags="${LDFLAGS}"
52 LDFLAGS="${LDFLAGS} $1"
53 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
54 [AC_MSG_RESULT([yes])],
57 LDFLAGS="${ac_try_ldflags_saved_cflags}"
63 dnl Checks for programs.
74 dnl AM_PROG_AR is needed for some linker stuff
75 dnl AC_USE_SYSTEM_EXTENSIONS requires autoconf 2.60
76 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_USE_SYSTEM_EXTENSIONS])
77 dnl AM_PROG_AR requires automake 1.11 (and uses AC_COMPILE_IFELSE which wants AC_USE_SYSTEM_EXTENSIONS)
78 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
87 *darwin*|*cygwin*|*aix*|*mingw* ) NO_RDYNAMIC=yes;;
90 AM_CONDITIONAL(NO_RDYNAMIC, test x$NO_RDYNAMIC = xyes)
92 if test -z "$LIGHTTPD_STATIC"; then
95 AM_CONDITIONAL(LIGHTTPD_STATIC, test x$LIGHTTPD_STATIC = xyes)
107 CPPFLAGS="${CPPFLAGS} -D_REENTRANT -D__EXTENSIONS__"
109 dnl Checks for header files.
112 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h \
113 sys/socket.h sys/time.h unistd.h sys/sendfile.h sys/uio.h \
114 getopt.h sys/epoll.h sys/select.h poll.h sys/poll.h sys/devpoll.h sys/filio.h \
115 sys/mman.h sys/event.h port.h pwd.h \
116 sys/resource.h sys/un.h syslog.h sys/prctl.h uuid/uuid.h])
118 dnl Checks for typedefs, structures, and compiler characteristics.
126 AC_CHECK_MEMBER(struct tm.tm_gmtoff,[AC_DEFINE([HAVE_STRUCT_TM_GMTOFF],[1],[gmtoff in struct tm])],,[#include <time.h>])
127 AC_CHECK_TYPES(struct sockaddr_storage,,,[#include <sys/socket.h>])
128 AC_CHECK_TYPES(socklen_t,,,[#include <sys/types.h>
129 #include <sys/socket.h>])
131 dnl Checks for library functions.
140 if test -z "$PKG_CONFIG"; then
141 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
144 dnl checking for libev
145 AC_MSG_CHECKING(for libev support)
147 AC_HELP_STRING([--with-libev@<:@=PATH@:>@],[Include libev support for fdevent handlers in PATH/include and PATH/lib]),
148 [WITH_LIBEV=$withval],[WITH_LIBEV=no])
153 if test "$WITH_LIBEV" != "no"; then
154 PKG_CHECK_MODULES(LIBEV, libev, [], [
155 dnl no pkg-config for libev, searching manually:
157 if test "$WITH_LIBEV" != "yes"; then
158 LIBEV_CFLAGS="-I$WITH_LIBEV/include"
159 LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
161 AC_CHECK_HEADERS([ev.h],[
162 AC_CHECK_LIB([ev], [ev_time], [
166 AC_MSG_ERROR([libev not found])
169 AC_MSG_ERROR([libev not found])
175 AC_DEFINE([HAVE_LIBEV], [1], [libev support])
178 AC_SUBST(LIBEV_CFLAGS)
181 dnl Checks for database.
185 AC_MSG_CHECKING(for MySQL support)
187 AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],[Include MySQL support. PATH is the path to 'mysql_config']),
188 [WITH_MYSQL=$withval],[WITH_MYSQL=no])
190 if test "$WITH_MYSQL" != "no"; then
192 if test "$WITH_MYSQL" = "yes"; then
193 AC_PATH_PROG(MYSQL_CONFIG, mysql_config)
195 MYSQL_CONFIG=$WITH_MYSQL
198 if test "$MYSQL_CONFIG" = ""; then
199 AC_MSG_ERROR(mysql_config is not found)
201 if test \! -x $MYSQL_CONFIG; then
202 AC_MSG_ERROR(mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config)
205 if $MYSQL_CONFIG | grep -- '--include' > /dev/null ; then
206 MYSQL_INCLUDE="`$MYSQL_CONFIG --include | sed s/\'//g`"
208 MYSQL_INCLUDE="`$MYSQL_CONFIG --cflags | sed s/\'//g`"
210 MYSQL_LIBS="`$MYSQL_CONFIG --libs | sed s/\'//g`"
212 AC_MSG_CHECKING(for MySQL includes at)
213 AC_MSG_RESULT($MYSQL_INCLUDE)
215 AC_MSG_CHECKING(for MySQL libraries at)
216 AC_MSG_RESULT($MYSQL_LIBS)
217 dnl check for errmsg.h, which isn't installed by some versions of 3.21
218 old_CPPFLAGS="$CPPFLAGS"
219 CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
220 AC_CHECK_HEADERS(errmsg.h mysql.h)
221 CPPFLAGS="$old_CPPFLAGS"
223 AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
229 AC_SUBST(MYSQL_INCLUDE)
232 AC_MSG_CHECKING(for LDAP support)
233 AC_ARG_WITH(ldap, AC_HELP_STRING([--with-ldap],[enable LDAP support]),
234 [WITH_LDAP=$withval], [WITH_LDAP=no])
235 AC_MSG_RESULT([$withval])
236 if test "$WITH_LDAP" != "no"; then
237 AC_CHECK_LIB(ldap, ldap_bind, [
238 AC_CHECK_HEADERS([ldap.h],[
240 AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
241 AC_DEFINE([HAVE_LDAP_H], [1])
242 AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
246 AC_CHECK_LIB(lber, ber_printf, [
247 AC_CHECK_HEADERS([lber.h],[
249 AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
250 AC_DEFINE([HAVE_LBER_H], [1])
257 AC_MSG_CHECKING(for extended attributes support)
258 AC_ARG_WITH(attr, AC_HELP_STRING([--with-attr],[enable extended attribute support]),
259 [WITH_ATTR=$withval],[WITH_ATTR=no])
260 AC_MSG_RESULT($withval)
261 if test "$WITH_ATTR" != "no"; then
262 # libattr (linux only?)
263 AC_CHECK_LIB(attr, attr_get, [
264 AC_CHECK_HEADERS([attr/attributes.h],[
266 AC_DEFINE([HAVE_XATTR], [1], [libattr])
267 AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
273 AC_CHECK_FUNC([extattr_get_file], [
274 AC_CHECK_HEADERS([sys/extattr.h],[
275 AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
276 AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
281 dnl openssl on solaris needs -lsocket -lnsl
282 AC_SEARCH_LIBS(socket,socket)
283 AC_SEARCH_LIBS(gethostbyname,nsl socket)
285 dnl On Haiku accept() and friends are in libnetwork
286 AC_SEARCH_LIBS(accept,network)
288 dnl clock_gettime() needs -lrt with glibc < 2.17, and possibly other platforms
289 AC_SEARCH_LIBS([clock_gettime],[rt])
292 AC_SEARCH_LIBS(dlopen,dl,[
293 AC_CHECK_HEADERS([dlfcn.h],[
294 if test "$ac_cv_search_dlopen" != no; then
295 test "$ac_cv_search_dlopen" = "none required" || DL_LIB="$ac_cv_search_dlopen"
298 AC_DEFINE([HAVE_LIBDL], [1], [libdl])
299 AC_DEFINE([HAVE_DLFCN_H], [1])
305 dnl Check for valgrind
306 AC_MSG_CHECKING(for valgrind)
307 AC_ARG_WITH(valgrind, AC_HELP_STRING([--with-valgrind],[enable internal support for valgrind]),
308 [WITH_VALGRIND=$withval],[WITH_VALGRIND=no])
309 AC_MSG_RESULT([$WITH_VALGRIND])
310 if test "$WITH_VALGRIND" != "no"; then
311 AC_CHECK_HEADERS([valgrind/valgrind.h])
314 dnl Checking for libunwind
315 AC_MSG_CHECKING(for libunwind)
316 AC_ARG_WITH(libunwind,
317 AC_HELP_STRING([--with-libunwind],[Include libunwind support for backtraces on assert failures]),
318 [WITH_LIBUNWIND=$withval],[WITH_LIBUNWIND=no])
320 if test "$WITH_LIBUNWIND" != "no"; then
321 PKG_CHECK_MODULES(LIBUNWIND, libunwind)
322 AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
324 AC_MSG_RESULT([$WITH_LIBUNWIND])
326 dnl Checking for kerberos5
327 AC_MSG_CHECKING(for kerberos5)
329 AC_HELP_STRING([--with-krb5@<:@=DIR@:>@],[Use Kerberos 5]),
330 [WITH_KRB5=$withval],[WITH_KRB5=no])
331 if test "$WITH_KRB5" != "no"; then
333 if test "x$WITH_KRB5" != "xyes"; then
334 CPPFLAGS="$CPPFLAGS -I$WITH_KRB5/include"
335 LDFLAGS="$LDFLAGS -L$WITH_KRB5/lib"
340 AC_MSG_RESULT([$use_krb5])
342 AC_ARG_WITH(krb5-includes,
343 AC_HELP_STRING([--with-krb5-includes=DIR],[Kerberos includes]),
344 [ use_krb5=yes CPPFLAGS="$CPPFLAGS -I$withval" ]
347 AC_ARG_WITH(krb5-libs,
348 AC_HELP_STRING([--with-krb5-libs=DIR],[Kerberos libraries]),
349 [ use_krb5=yes LDFLAGS="$LDFLAGS -L$withval" ]
352 if test "x$use_krb5" = "xyes"; then
353 AC_CHECK_LIB(gssapi_krb5, gss_acquire_cred, [
354 AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],[
355 KRB5_LIB="-lkrb5 -lgssapi_krb5"
356 AC_DEFINE(HAVE_KRB5, [1], [libgssapi_krb5])
359 if test "x$KRB5_LIB" = x; then
360 AC_MSG_ERROR([gssapi_krb5 headers and/or libs where not found, install them or build with --without-krb5])
365 dnl Check for openssl
366 AC_MSG_CHECKING(for OpenSSL)
368 AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],[Include openssl support (default no)]),
369 [WITH_OPENSSL=$withval],[WITH_OPENSSL=no])
371 if test "$WITH_OPENSSL" != "no"; then
373 if test "$WITH_OPENSSL" != "yes"; then
374 CPPFLAGS="$CPPFLAGS -I$WITH_OPENSSL/include"
375 LDFLAGS="$LDFLAGS -L$WITH_OPENSSL/lib"
380 AC_MSG_RESULT([$use_openssl])
382 AC_ARG_WITH(openssl-includes,
383 AC_HELP_STRING([--with-openssl-includes=DIR],[OpenSSL includes]),
384 [ use_openssl=yes CPPFLAGS="$CPPFLAGS -I$withval" ]
387 AC_ARG_WITH(openssl-libs,
388 AC_HELP_STRING([--with-openssl-libs=DIR],[OpenSSL libraries]),
389 [ use_openssl=yes LDFLAGS="$LDFLAGS -L$withval" ]
392 if test "x$use_openssl" = "xyes"; then
393 if test "x$use_krb5" = "xyes"; then
394 AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
397 AC_CHECK_HEADERS([openssl/ssl.h])
399 AC_CHECK_LIB(crypto, BIO_f_base64, [
400 AC_CHECK_LIB(ssl, SSL_new, [ SSL_LIB="-lssl -lcrypto"
401 AC_DEFINE(HAVE_LIBSSL, [], [Have libssl]) ], [], [ -lcrypto "$DL_LIB" ])
407 AC_MSG_CHECKING(for perl regular expressions support)
408 AC_ARG_WITH(pcre, AC_HELP_STRING([--with-pcre],[Enable pcre support (default yes)]),
409 [WITH_PCRE=$withval],[WITH_PCRE=yes])
410 AC_MSG_RESULT([$WITH_PCRE])
412 if test "$WITH_PCRE" != "no"; then
413 if test "$WITH_PCRE" != "yes"; then
414 PCRE_LIB="-L$WITH_PCRE/lib -lpcre"
415 CPPFLAGS="$CPPFLAGS -I$WITH_PCRE/include"
417 AC_PATH_PROG(PCRECONFIG, pcre-config)
418 if test x"$PCRECONFIG" != x; then
419 PCRE_LIB=`$PCRECONFIG --libs`
420 CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`"
424 if test x"$PCRE_LIB" != x; then
425 AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
426 AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
429 AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
433 AC_MSG_CHECKING(for zlib support)
434 AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib],[Enable zlib support for mod_compress]),
435 [WITH_ZLIB=$withval],[WITH_ZLIB=yes])
436 AC_MSG_RESULT([$WITH_ZLIB])
438 if test "$WITH_ZLIB" != "no"; then
439 if test "$WITH_ZLIB" != "yes"; then
440 Z_LIB="-L$WITH_ZLIB -lz"
441 CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
443 AC_CHECK_LIB(z, deflate, [
444 AC_CHECK_HEADERS([zlib.h],[Z_LIB=-lz])
448 if test x"$Z_LIB" != x; then
449 AC_DEFINE([HAVE_LIBZ], [1], [libz])
450 AC_DEFINE([HAVE_ZLIB_H], [1])
453 AC_MSG_ERROR([zlib-headers and/or libs were not found, install them or build with --without-zlib])
457 AC_MSG_CHECKING(for bzip2 support)
458 AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2],[Enable bzip2 support for mod_compress]),
459 [WITH_BZIP2=$withval],[WITH_BZIP2=yes])
460 AC_MSG_RESULT([$WITH_BZIP2])
462 if test "$WITH_BZIP2" != "no"; then
463 if test "$WITH_BZIP2" != "yes"; then
464 BZ_LIB="-L$WITH_BZIP2 -lbz2"
465 CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
467 AC_CHECK_LIB(bz2, BZ2_bzCompress, [
468 AC_CHECK_HEADERS([bzlib.h],[BZ_LIB=-lbz2])
472 if test x"$BZ_LIB" != x; then
473 AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
474 AC_DEFINE([HAVE_BZLIB_H], [1])
477 AC_MSG_ERROR([bzip2-headers and/or libs were not found, install them or build with --without-bzip2])
482 AC_MSG_CHECKING(for FAM)
483 AC_ARG_WITH(fam, AC_HELP_STRING([--with-fam],[fam/gamin for reducing number of stat() calls]),
484 [WITH_FAM=$withval],[WITH_FAM=no])
485 AC_MSG_RESULT([$WITH_FAM])
487 if test "$WITH_FAM" != "no"; then
488 if test "$WITH_FAM" != "yes"; then
489 FAM_LIBS="-L$WITH_FAM -lfam"
490 CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
492 AC_CHECK_LIB(fam, FAMOpen2, [
493 AC_CHECK_HEADERS([fam.h],[FAM_LIBS=-lfam])
495 if test "x$FAM_LIBS" = x; then
496 PKG_CHECK_MODULES(FAM, gamin >= 0.1.0)
500 if test x"$FAM_LIBS" != x; then
503 AC_CHECK_FUNCS([FAMNoExists])
506 AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
507 AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
510 AC_MSG_ERROR([fam/gamin-headers and/or libs were not found, install them or build with --without-fam])
514 AC_MSG_CHECKING(for properties in mod_webdav)
515 AC_ARG_WITH(webdav-props, AC_HELP_STRING([--with-webdav-props],[properties in mod_webdav]),
516 [WITH_WEBDAV_PROPS=$withval],[WITH_WEBDAV_PROPS=no])
517 AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
519 if test "$WITH_WEBDAV_PROPS" != "no"; then
521 AC_MSG_CHECKING(for libxml2)
522 AC_ARG_WITH(libxml, AC_HELP_STRING([--with-libxml],[libxml2 for properties in mod_webdav]),
523 [WITH_LIBXML=$withval],[WITH_LIBXML=yes])
524 AC_MSG_RESULT([$WITH_LIBXML])
526 if test "$WITH_LIBXML" != "no"; then
527 if test "$WITH_LIBXML" != "yes"; then
528 XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
529 XML_CFLAGS="-I$WITH_LIBXML/include"
531 PKG_CHECK_MODULES(XML, libxml-2.0)
534 if test x"$XML_LIBS" != x; then
535 AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
536 AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
540 AC_MSG_ERROR([libxml2-headers and/or libs were not found, install them or build with --without-webdav-props])
544 AC_MSG_CHECKING(for sqlite)
545 AC_ARG_WITH(sqlite, AC_HELP_STRING([--with-sqlite],[sqlite for properties in mod_webdav]),
546 [WITH_SQLITE=$withval],[WITH_SQLITE=yes])
547 AC_MSG_RESULT([$WITH_SQLITE])
549 if test "$WITH_SQLITE" != "no"; then
550 if test "$WITH_SQLITE" != "yes"; then
551 SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
552 SQLITE_CFLAGS="-I$WITH_SQLITE"
554 PKG_CHECK_MODULES(SQLITE, sqlite3)
557 if test x"$SQLITE_LIBS" != x; then
558 AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
559 AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
560 AC_SUBST(SQLITE_LIBS)
561 AC_SUBST(SQLITE_CFLAGS)
563 AC_MSG_ERROR([sqlite-headers and/or libs were not found, install them or build with --without-webdav-props])
567 AC_MSG_CHECKING(for locks in mod_webdav)
568 AC_ARG_WITH(webdav-locks, AC_HELP_STRING([--with-webdav-locks],[locks in mod_webdav]),
569 [WITH_WEBDAV_LOCKS=$withval],[WITH_WEBDAV_LOCKS=no])
570 AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
572 if test "$WITH_WEBDAV_LOCKS" != "no"; then
574 AC_MSG_CHECKING(for libuuid)
575 AC_ARG_WITH(uuid, AC_HELP_STRING([--with-uuid],[uuid for locks in mod_webdav]),
576 [WITH_UUID=$withval],[WITH_UUID=yes])
577 AC_MSG_RESULT([$WITH_UUID])
579 if test "$WITH_UUID" != "no"; then
580 if test "$WITH_UUID" != "yes"; then
581 UUID_LIBS="-L$WITH_UUID -luuid"
582 CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
584 AC_CHECK_LIB(uuid, uuid_unparse, [
585 AC_CHECK_HEADERS([uuid/uuid.h],[UUID_LIBS=-luuid])
589 if test x"$UUID_LIBS" != x; then
590 AC_DEFINE([HAVE_UUID], [1], [libuuid])
591 AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
594 AC_MSG_ERROR([uuid-headers and/or libs were not found, install them or build with --without-webdav-locks])
603 AC_MSG_CHECKING(for gdbm)
604 AC_ARG_WITH(gdbm, AC_HELP_STRING([--with-gdbm],[gdbm storage for mod_trigger_b4_dl]),
605 [WITH_GDBM=$withval],[WITH_GDBM=no])
606 AC_MSG_RESULT([$WITH_GDBM])
608 if test "$WITH_GDBM" != "no"; then
609 if test "$WITH_GDBM" != "yes"; then
610 GDBM_LIB="-L$WITH_GDBM -lgdbm"
611 CPPFLAGS="$CPPFLAGS -I$WITH_GDBM"
613 AC_CHECK_LIB(gdbm, gdbm_open, [
614 AC_CHECK_HEADERS([gdbm.h],[GDBM_LIB=-lgdbm])
618 if test x"$GDBM_LIB" != x; then
619 AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
620 AC_DEFINE([HAVE_GDBM_H], [1])
623 AC_MSG_ERROR([gdbm headers and/or libs were not found, install them or build with --without-gdbm])
628 AC_MSG_CHECKING(for GeoIP)
629 AC_ARG_WITH(geoip, AC_HELP_STRING([--with-geoip],[IP-based geolocation lookup]),
630 [WITH_GEOIP=$withval],[WITH_GEOIP=no])
631 AC_MSG_RESULT([$WITH_GEOIP])
633 if test "$WITH_GEOIP" != "no"; then
634 if test "$WITH_GEOIP" != "yes"; then
635 GEOIP_LIB="-L$WITH_GEOIP -lGeoIP"
636 CPPFLAGS="$CPPFLAGS -I$WITH_GEOIP"
638 AC_CHECK_LIB(GeoIP, GeoIP_country_name_by_addr, [
639 AC_CHECK_HEADERS([GeoIP.h],[GEOIP_LIB=-lGeoIP])
643 if test x"$GEOIP_LIB" != x; then
644 AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
645 AC_DEFINE([HAVE_GEOIP_H], [1])
648 AC_MSG_ERROR([GeoIP headers and/or libs were not found, install them or build with --without-geoip])
652 dnl Check for memcached
653 AC_MSG_CHECKING(for memcached)
654 AC_ARG_WITH(memcached, AC_HELP_STRING([--with-memcached],[memcached storage for mod_trigger_b4_dl]),
655 [WITH_MEMCACHED=$withval],[WITH_MEMCACHED=no])
656 AC_MSG_RESULT([$WITH_MEMCACHED])
658 if test "$WITH_MEMCACHED" != "no"; then
659 if test "$WITH_MEMCACHED" != "yes"; then
660 MEMCACHED_LIB="-L$WITH_MEMCACHED -lMEMCACHED"
661 CPPFLAGS="$CPPFLAGS -I$WITH_MEMCACHED"
663 AC_CHECK_LIB(memcached, memcached, [
664 AC_CHECK_HEADERS([libmemcached/memcached.h],[
665 MEMCACHED_LIB=-lmemcached
670 if test x"$MEMCACHED_LIB" != x; then
671 AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
672 AC_SUBST(MEMCACHED_LIB)
674 AC_MSG_ERROR([memcached headers and/or libs were not found, install them or build with --without-memcached])
679 AC_MSG_CHECKING(if lua-support is requested)
680 AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua engine for mod_cml]),
681 [WITH_LUA=$withval],[WITH_LUA=no])
683 AC_MSG_RESULT($WITH_LUA)
684 if test "$WITH_LUA" != "no"; then
686 if test "$WITH_LUA" != "yes"; then
687 PKG_CHECK_MODULES(LUA, $WITH_LUA >= 5.1, [
690 AC_MSG_NOTICE([Couldn't find requested lua pkg-config module $WITH_LUA])
692 if test "$found_lua" = "0"; then
693 LUA_LIBS="-L$WITH_LUA -llua"
694 LUA_CFLAGS="-I$WITH_LUA"
697 for luaname in lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua; do
698 if test "$found_lua" = "0"; then
699 PKG_CHECK_MODULES(LUA, $luaname >= 5.1, [
702 AC_MSG_NOTICE([Couldn't find $luaname])
706 if test "$found_lua" = "0"; then
707 AC_MSG_ERROR([Couldn't find any lua pkg-config module])
711 if test x"$LUA_LIBS" != x; then
712 AC_DEFINE([HAVE_LUA], [1], [liblua])
713 AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
717 AC_MSG_ERROR([lua headers and/or libs were not found, install them or build with --without-lua])
721 dnl search for crypt_r and (fallback) for crypt
724 AC_SEARCH_LIBS([crypt_r],[crypt],[
725 AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
726 AC_CHECK_HEADERS([crypt.h],[
727 AC_DEFINE([HAVE_CRYPT_H], [1], [crypt.h])
732 AC_SEARCH_LIBS([crypt],[crypt],[
733 AC_DEFINE([HAVE_CRYPT], [1], [crypt])
734 AC_CHECK_HEADERS([crypt.h],[
735 AC_DEFINE([HAVE_CRYPT_H], [1], [crypt.h])
742 AC_SUBST([CRYPT_LIB])
745 AC_SEARCH_LIBS(sendfilev,sendfile,[
746 if test "$ac_cv_search_sendfilev" != no; then
747 test "$ac_cv_search_sendfilev" = "none required" || SENDFILE_LIB="$ac_cv_search_sendfilev"
748 AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
752 AC_SUBST(SENDFILE_LIB)
755 *mingw* ) LIBS="$LIBS -lwsock32";;
759 AC_CHECK_FUNCS([dup2 getcwd inet_ntoa inet_ntop inet_pton issetugid memset mmap munmap strchr \
760 strdup strerror strstr strtol sendfile getopt socket lstat \
761 gethostbyname poll epoll_ctl getrlimit chroot \
762 getuid select signal pathconf madvise posix_fadvise posix_madvise \
763 writev sigaction sendfile64 send_file kqueue port_create localtime_r gmtime_r \
764 memset_s explicit_bzero clock_gettime \
765 getentropy arc4random jrand48 srandom])
766 AC_CHECK_HEADERS([linux/random.h],[
767 AC_CHECK_FUNC([getrandom], AC_DEFINE([HAVE_GETRANDOM], [1], [getrandom]))
770 AC_MSG_CHECKING(if weak symbols are supported)
771 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
772 __attribute__((weak)) void __dummy(void *x) { }
773 void f(void *x) { __dummy(x); }
777 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
778 ],[AC_MSG_RESULT(no)])
780 AC_MSG_CHECKING(for Large File System support)
782 AC_HELP_STRING([--enable-lfs],[Turn on Large File System (default)]),
783 [case "${enableval}" in
784 yes) CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES" ;;
786 *) AC_MSG_ERROR(bad value ${enableval} for --enable-lfs) ;;
787 esac],[CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
789 AC_MSG_RESULT($enableval)
791 AC_CHECK_SIZEOF(long)
792 AC_CHECK_SIZEOF(off_t)
794 if test "x$ac_cv_func_sendfile" = xyes; then
795 dnl check if sendfile works
796 AC_MSG_CHECKING(if sendfile works)
797 if test "x$cross_compiling" = xno; then
799 #ifdef HAVE_SYS_SENDFILE_H
800 #include <sys/sendfile.h>
801 #endif /* HAVE_SYS_SENDFILE_H */
805 if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
810 AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile]) ] )
812 AC_MSG_RESULT(no, cross-compiling)
813 AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
817 dnl Check for IPv6 support
820 AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
821 [case "${enableval}" in
824 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
827 if test x$ipv6 = xtrue; then
828 AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
829 [AC_TRY_LINK([ #include <sys/types.h>
830 #include <sys/socket.h>
831 #include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; ],
832 [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
834 if test "$ac_cv_ipv6_support" = yes; then
835 AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
839 # disable mmap by default; if a mmapped file gets truncated, the process gets a SIGBUS signal
840 # on reading the truncated area which we can't handle (yet).
841 # lighttpd may always use mmap with files it owns (created tmp files)
843 AC_HELP_STRING([--enable-mmap],[use mmap if available (DANGEROUS, allows local users to trigger SIGBUS crashes)]),
844 [case "${enableval}" in
847 *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmap) ;;
850 if test x$mmap = xtrue; then
851 AC_DEFINE(ENABLE_MMAP, [1], [Use mmap if available])
855 AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
857 dnl check for fastcgi lib, for the tests only
859 AC_CHECK_LIB(fcgi, FCGI_Accept, [
860 AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h],[
865 AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_found" = xyes)
868 dnl check for extra compiler options (warning options)
869 if test "${GCC}" = "yes"; then
870 TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
871 TRY_CFLAGS([-std=gnu99])
874 AC_ARG_ENABLE(extra-warnings,
875 AC_HELP_STRING([--enable-extra-warnings],[enable extra warnings (gcc specific)]),
876 [case "${enableval}" in
877 yes) extrawarnings=true ;;
878 no) extrawarnings=false ;;
879 *) AC_MSG_ERROR(bad value ${enableval} for --enable-extra-warnings) ;;
880 esac],[extrawarnings=false])
882 if test x$extrawarnings = xtrue; then
883 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])
884 TRY_LDFLAGS([-Wl,--as-needed])
888 LIGHTTPD_VERSION_ID=`echo $PACKAGE_VERSION | $AWK -F '.' '{print "(" $1 " << 16 | " $2 " << 8 | " $3 ")"}'`
889 AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
891 AC_CONFIG_FILES([Makefile src/Makefile
892 doc/config/conf.d/Makefile \
893 doc/config/vhosts.d/Makefile \
894 doc/config/Makefile \
895 doc/scripts/Makefile \
896 doc/initscripts/Makefile \
897 doc/systemd/Makefile \
898 doc/outdated/Makefile \
901 tests/docroot/Makefile \
902 tests/docroot/123/Makefile \
903 tests/docroot/www/Makefile \
904 tests/docroot/www/go/Makefile \
905 tests/docroot/www/indexfile/Makefile \
906 tests/docroot/www/expire/Makefile \
911 do_build="mod_cgi mod_fastcgi mod_extforward mod_proxy mod_evhost mod_simple_vhost mod_access mod_alias mod_setenv mod_usertrack mod_auth mod_authn_file mod_authn_ldap mod_authn_mysql mod_status mod_accesslog"
912 do_build="$do_build mod_rrdtool mod_secdownload mod_expire mod_compress mod_dirlisting mod_indexfile mod_userdir mod_webdav mod_staticfile mod_scgi mod_flv_streaming mod_ssi mod_deflate"
914 plugins="mod_rewrite mod_redirect mod_trigger_b4_dl"
915 features="regex-conditionals"
916 if test ! "x$PCRE_LIB" = x; then
917 do_build="$do_build $plugins"
918 enable_feature="$features"
920 no_build="$no_build $plugins"
921 disable_feature="$features"
924 features="auth-mysql"
925 plugins="mod_mysql_vhost"
926 if test ! "x$MYSQL_LIBS" = x; then
927 do_build="$do_build $plugins"
928 enable_feature="$enable_feature $features"
930 no_build="$no_build $plugins"
931 disable_feature="$disable_feature $features"
934 plugins="mod_cml mod_magnet"
935 if test ! "x$LUA_LIBS" = x; then
936 do_build="$do_build $plugins"
938 no_build="$no_build $plugins"
941 features="storage-gdbm"
942 if test ! "x$GDBM_LIB" = x; then
943 enable_feature="$enable_feature $features"
945 disable_feature="$disable_feature $features"
948 features="storage-memcached"
949 if test ! "x$MEMCACHED_LIB" = x; then
950 enable_feature="$enable_feature $features"
952 disable_feature="$disable_feature $features"
955 features="compress-gzip compress-deflate"
956 if test ! "x$Z_LIB" = x; then
957 enable_feature="$enable_feature $features"
959 disable_feature="$disable_feature $features"
962 features="compress-bzip2"
963 if test ! "x$BZ_LIB" = x; then
964 enable_feature="$enable_feature $features"
966 disable_feature="$disable_feature $features"
970 plugins="mod_authn_gssapi"
971 if test ! "x$KRB5_LIB" = x; then
972 do_build="$do_build $plugins"
973 enable_feature="$enable_feature $features"
975 no_build="$no_build $plugins"
976 disable_feature="$disable_feature $features"
980 if test ! "x$LDAP_LIB" = x; then
981 enable_feature="$enable_feature $features"
983 disable_feature="$disable_feature $features"
986 features="network-openssl"
987 if test ! "x$SSL_LIB" = x; then
988 enable_feature="$enable_feature $features"
990 disable_feature="$disable_feature $features"
994 features="auth-crypt"
995 if test "$ac_cv_search_crypt" = no; then
996 disable_feature="$disable_feature $features"
998 enable_feature="$enable_feature $features"
1001 features="network-ipv6"
1002 if test "$ac_cv_ipv6_support" = yes; then
1003 enable_feature="$enable_feature $features"
1005 disable_feature="$disable_feature $features"
1008 features="large-files"
1009 if test "$enable_lfs" = yes; then
1010 enable_feature="$enable_feature $features"
1012 disable_feature="$disable_feature $features"
1015 features="stat-cache-fam"
1016 if test ! "x$FAM_LIBS" = x; then
1017 enable_feature="$enable_feature $features"
1019 disable_feature="$disable_feature $features"
1022 features="webdav-properties"
1023 if test "x$XML_LIBS" \!= x -a "x$SQLITE_LIBS" \!= x; then
1024 enable_feature="$enable_feature $features"
1026 disable_feature="$disable_feature $features"
1029 features="webdav-locks"
1030 if test "x$UUID_LIBS" \!= x; then
1031 enable_feature="$enable_feature $features"
1033 disable_feature="$disable_feature $features"
1044 for p in $do_build; do
1049 for p in $no_build; do
1058 for p in $enable_feature; do
1063 for p in $disable_feature; do