[doc] NEWS
[lighttpd.git] / configure.ac
blob5383cec55c19c5b186a237f9464dc1d6314c30e1
1 dnl                                               -*- Autoconf -*-
2 dnl Process this file with autoconf to produce a configure script.
3 dnl
4 dnl Indentation rules:
5 dnl - closing braces not at the beginning of a line must match opening
6 dnl   braces earlier on that line
7 dnl - closing braces at the beginning of a line:
8 dnl   - must not be followed by anything else apart from "," or comments
9 dnl   - must match opening braces from another line and indented the
10 dnl     same as that other line
11 dnl - if one argument was put on a new line, all following arguments
12 dnl   must be on their own line too
13 dnl - if an argument uses more than one line and is not a single
14 dnl   function call, the argument should be on different lines than the
15 dnl   wrapping braces
16 AC_PREREQ(2.60)
17 AC_INIT([lighttpd], [1.4.48], [contact@lighttpd.net])
18 AC_CONFIG_SRCDIR([src/server.c])
19 AC_CONFIG_HEADER([config.h])
20 AC_CONFIG_MACRO_DIR([m4])
22 AC_CANONICAL_HOST
24 AM_INIT_AUTOMAKE([1.14 -Wall -Wno-portability -Wno-override foreign dist-xz tar-ustar serial-tests silent-rules])
26 dnl @synopsis TRY_CFLAGS [compiler flags]
27 dnl @summary check whether compiler supports given flags and adds them to CFLAGS
28 AC_DEFUN([TRY_CFLAGS],
29 [dnl
30   AC_MSG_CHECKING([if $CC supports $1])
31   AC_LANG_PUSH([C])
32   ac_try_cflags_saved_cflags="${CFLAGS}"
33   CFLAGS="${CFLAGS} $1"
34   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
35     [AC_MSG_RESULT([yes])],
36     [
37       AC_MSG_ERROR([no])
38       CFLAGS="${ac_try_cflags_saved_cflags}"
39     ]
40   )
41   AC_LANG_POP([C])
44 dnl @synopsis TRY_LDFLAGS [linker flags]
45 dnl @summary check whether linker supports given flags and adds them to LDFLAGS
46 AC_DEFUN([TRY_LDFLAGS],
47 [dnl
48   AC_MSG_CHECKING([if $LD supports $1])
49   AC_LANG_PUSH([C])
50   ac_try_ldflags_saved_ldflags="${LDFLAGS}"
51   LDFLAGS="${LDFLAGS} $1"
52   AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
53     [AC_MSG_RESULT([yes])],
54     [
55       AC_MSG_ERROR([no])
56       LDFLAGS="${ac_try_ldflags_saved_cflags}"
57     ]
58   )
59   AC_LANG_POP([C])
62 dnl Checks for programs.
63 AC_PROG_CC
64 AC_PROG_CC_STDC
65 AX_PROG_CC_FOR_BUILD
66 AC_PROG_LD
67 AC_PROG_INSTALL
68 AC_PROG_CPP
69 AC_PROG_MAKE_SET
71 AC_USE_SYSTEM_EXTENSIONS
72 AM_PROG_AR
74 dnl AC_CANONICAL_HOST
75 case "$host_os" in
76 *darwin*|*cygwin*|*aix*|*mingw*|*midipix* ) NO_RDYNAMIC=yes ;;
77 * ) NO_RDYNAMIC=no ;;
78 esac
79 AM_CONDITIONAL([NO_RDYNAMIC], [test "$NO_RDYNAMIC" = yes])
81 AM_CONDITIONAL([LIGHTTPD_STATIC], [test "$LIGHTTPD_STATIC" = yes])
83 AC_EXEEXT
85 dnl libtool
86 AC_DISABLE_STATIC
87 AC_ENABLE_SHARED
89 AC_LIBTOOL_DLOPEN
90 AC_PROG_LIBTOOL
92 dnl for solaris
93 CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
95 dnl Checks for header files.
97 dnl check for:
98 dnl   inttypes.h => HAVE_INTTYPES_H
99 dnl   stdint.h => HAVE_STDINT_H
100 dnl and maybe more (which shouldn't be relied on)
101 AC_HEADER_STDC
102 dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
103 AC_HEADER_SYS_WAIT
104 AC_CHECK_HEADERS([\
105   getopt.h \
106   poll.h \
107   port.h \
108   pwd.h \
109   stdlib.h \
110   strings.h \
111   sys/devpoll.h \
112   sys/epoll.h \
113   sys/event.h \
114   sys/filio.h \
115   sys/mman.h \
116   sys/poll.h \
117   sys/prctl.h \
118   sys/resource.h \
119   sys/select.h \
120   sys/sendfile.h \
121   sys/time.h \
122   sys/uio.h \
123   sys/un.h \
124   syslog.h \
125   uuid/uuid.h \
128 dnl Checks for typedefs, structures, and compiler characteristics.
129 AC_C_CONST
130 AC_C_INLINE
131 AC_TYPE_OFF_T
132 AC_TYPE_PID_T
133 AC_TYPE_SIZE_T
135 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
136   [AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
137   [],
138   [#include <time.h>]
140 AC_CHECK_TYPES([socklen_t],
141   [], dnl defines HAVE_SOCKLEN_T
142   [],
143   [
144     #include <sys/types.h>
145     #include <sys/socket.h>
146   ]
149 dnl openssl on solaris needs -lsocket -lnsl
150 AC_SEARCH_LIBS([socket], [socket])
151 AC_SEARCH_LIBS([gethostbyname], [nsl socket])
153 dnl On Haiku accept() and friends are in libnetwork
154 AC_SEARCH_LIBS([accept], [network])
156 dnl clock_gettime() needs -lrt with glibc < 2.17, and possibly other platforms
157 AC_SEARCH_LIBS([clock_gettime], [rt])
159 dnl need dlopen/-ldl to load plugins (when not on windows)
160 save_LIBS=$LIBS
161 LIBS=
162 AC_SEARCH_LIBS([dlopen], [dl], [
163   AC_CHECK_HEADERS([dlfcn.h], [
164     DL_LIB=$LIBS
165     AC_DEFINE([HAVE_LIBDL], [1], [libdl])
166     AC_DEFINE([HAVE_DLFCN_H], [1])
167   ])
169 LIBS=$save_LIBS
170 AC_SUBST([DL_LIB])
172 dnl prepare pkg-config usage below
173 if test -z "$PKG_CONFIG"; then
174   AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
176 PKG_PROG_PKG_CONFIG
178 dnl checking for libev
179 AC_MSG_NOTICE([----------------------------------------])
180 AC_MSG_CHECKING([for libev support])
181 AC_ARG_WITH([libev],
182   [AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
183     [Include libev support for fdevent handlers in PATH/include and PATH/lib]
184   )],
185   [WITH_LIBEV=$withval],
186   [WITH_LIBEV=no]
188 AC_MSG_RESULT([$WITH_LIBEV])
190 LIBEV_CFLAGS=
191 LIBEV_LIBS=
193 if test "$WITH_LIBEV" != no; then
194   PKG_CHECK_MODULES([LIBEV], [libev], [], [
195     dnl no pkg-config for libev, searching manually:
197     if test "$WITH_LIBEV" != yes; then
198       LIBEV_CFLAGS="-I$WITH_LIBEV/include"
199       LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
200     else
201       AC_CHECK_HEADERS([ev.h],
202         [AC_CHECK_LIB([ev], [ev_time],
203           [
204             LIBEV_CFLAGS=
205             LIBEV_LIBS="-lev"
206           ],
207           [AC_MSG_ERROR([libev not found])]
208         )],
209         [AC_MSG_ERROR([libev header not found])]
210       )
211     fi
212   ])
214   AC_DEFINE([HAVE_LIBEV], [1], [libev support])
217 AC_SUBST([LIBEV_CFLAGS])
218 AC_SUBST([LIBEV_LIBS])
220 dnl Checks for mysql
221 AC_MSG_NOTICE([----------------------------------------])
222 AC_MSG_CHECKING([for MySQL support])
223 AC_ARG_WITH([mysql],
224   [AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
225     [Include MySQL support. PATH is the path to 'mysql_config']
226   )],
227   [WITH_MYSQL=$withval],
228   [WITH_MYSQL=no]
230 AC_MSG_RESULT([$WITH_MYSQL])
232 MYSQL_INCLUDE=
233 MYSQL_LIBS=
235 if test "$WITH_MYSQL" != no; then
236   if test "$WITH_MYSQL" = yes; then
237     AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
238   else
239     MYSQL_CONFIG=$WITH_MYSQL
240   fi
242   if test -z "$MYSQL_CONFIG"; then
243     AC_MSG_ERROR([mysql_config is not found])
244   fi
245   if test ! -x "$MYSQL_CONFIG"; then
246     AC_MSG_ERROR([mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config])
247   fi
249   if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
250     MYSQL_INCLUDE=`"$MYSQL_CONFIG" --include | sed s/\'//g`
251   else
252     MYSQL_INCLUDE=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
253   fi
254   MYSQL_LIBS=`"$MYSQL_CONFIG" --libs | sed s/\'//g`
256   AC_MSG_CHECKING([for MySQL includes at])
257   AC_MSG_RESULT([$MYSQL_INCLUDE])
259   AC_MSG_CHECKING([for MySQL libraries at])
260   AC_MSG_RESULT([$MYSQL_LIBS])
262   AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
264 AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
266 AC_SUBST([MYSQL_LIBS])
267 AC_SUBST([MYSQL_INCLUDE])
269 dnl Checks for pgsql
270 AC_MSG_NOTICE([----------------------------------------])
271 AC_MSG_CHECKING([for PgSQL support])
272 AC_ARG_WITH([pgsql],
273   [AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
274     [Include PgSQL support. PATH is the path to 'pg_config']
275   )],
276   [WITH_PGSQL=$withval],
277   [WITH_PGSQL=no]
279 AC_MSG_RESULT([$WITH_PGSQL])
281 PGSQL_INCLUDE=
282 PGSQL_LIBS=
284 if test "$WITH_PGSQL" != no; then
285   if test "$WITH_PGSQL" = yes; then
286     AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
287   else
288     PGSQL_CONFIG=$WITH_PGSQL
289   fi
291   if test -z "$PGSQL_CONFIG"; then
292     AC_MSG_ERROR([pg_config is not found])
293   fi
294   if test ! -x "$PGSQL_CONFIG"; then
295     AC_MSG_ERROR([pg_config not exists or not executable, use --with-pgsql=path-to-pg_config])
296   fi
298   PGSQL_INCLUDE="-I`"$PGSQL_CONFIG" --includedir`"
299   PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
301   AC_MSG_CHECKING([for PgSQL includes at])
302   AC_MSG_RESULT([$PGSQL_INCLUDE])
304   AC_MSG_CHECKING([for PgSQL libraries at])
305   AC_MSG_RESULT([$PGSQL_LIBS])
307   AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
309 AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
311 AC_SUBST([PGSQL_LIBS])
312 AC_SUBST([PGSQL_INCLUDE])
314 dnl Checks for libdbi library
315 AC_MSG_NOTICE([----------------------------------------])
316 AC_MSG_CHECKING([for LibDBI support])
317 AC_ARG_WITH([dbi],
318   [AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
319     [Include DBI support in PATH/include/dbi.h and PATH/lib]
320   )],
321   [WITH_DBI=$withval],
322   [WITH_DBI=no]
324 AC_MSG_RESULT([$WITH_DBI])
326 DBI_INCLUDE=
327 DBI_LIBS=
329 if test "$WITH_DBI" != no; then
330   if test "$WITH_DBI" != yes; then
331     DBI_CFLAGS="-I$WITH_DBI/include"
332     DBI_LIBS="-L$WITH_DBI/lib -ldbi"
333   else
334     AC_CHECK_HEADERS([dbi/dbi.h],
335       [AC_CHECK_LIB([dbi], [dbi_version],
336         [
337           DBI_CFLAGS=
338           DBI_LIBS="-ldbi"
339         ],
340         [AC_MSG_ERROR([LibDBI not found])]
341       )],
342       [AC_MSG_ERROR([LibDBI header not found])]
343     )
344   fi
346   AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
348 AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
350 AC_SUBST([DBI_LIBS])
351 AC_SUBST([DBI_CFLAGS])
353 dnl Checks for libsasl2 library
354 AC_MSG_NOTICE([----------------------------------------])
355 AC_MSG_CHECKING([for LibSASL support])
356 AC_ARG_WITH([sasl],
357   [AC_HELP_STRING([--with-sasl@<:@=PATH@:>@],
358     [Include SASL support in PATH/include/sasl/sasl.h and PATH/lib]
359   )],
360   [WITH_SASL=$withval],
361   [WITH_SASL=no]
363 AC_MSG_RESULT([$WITH_SASL])
365 SASL_INCLUDE=
366 SASL_LIBS=
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"
372   else
373     AC_CHECK_HEADERS([sasl/sasl.h],
374       [AC_CHECK_LIB([sasl2], [sasl_server_init],
375         [
376           SASL_CFLAGS=
377           SASL_LIBS="-lsasl2"
378         ],
379         [AC_MSG_ERROR([libsasl2 not found])]
380       )],
381       [AC_MSG_ERROR([SASL header not found])]
382     )
383   fi
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])
393 dnl Check for LDAP
394 AC_MSG_NOTICE([----------------------------------------])
395 AC_MSG_CHECKING([for LDAP support])
396 AC_ARG_WITH([ldap],
397   [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
398   [WITH_LDAP=$withval],
399   [WITH_LDAP=no]
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],
406       [
407         LDAP_LIB=-lldap
408         AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
409         AC_DEFINE([HAVE_LDAP_H], [1])
410       ],
411       [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
412     )],
413     [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
414   )
415   AC_SUBST([LDAP_LIB])
416   AC_CHECK_LIB([lber], [ber_printf],
417     [AC_CHECK_HEADERS([lber.h],
418       [
419         LBER_LIB=-llber
420         AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
421         AC_DEFINE([HAVE_LBER_H], [1])
422       ],
423       [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
424     )],
425     [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
426   )
427   AC_SUBST([LBER_LIB])
429 AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
431 dnl Check for xattr
432 AC_MSG_NOTICE([----------------------------------------])
433 AC_MSG_CHECKING([for extended attributes support])
434 AC_ARG_WITH([attr],
435   [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
436   [WITH_ATTR=$withval],
437   [WITH_ATTR=no]
439 AC_MSG_RESULT([$WITH_ATTR])
441 if test "$WITH_ATTR" != no; then
442   have_xattr=no
443   # libattr (linux only?)
444   AC_CHECK_LIB([attr], [attr_get], [
445     AC_CHECK_HEADERS([attr/attributes.h], [
446       ATTR_LIB=-lattr
447       AC_DEFINE([HAVE_XATTR], [1], [libattr])
448       AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
449       have_xattr=yes
450     ])
451   ])
452   AC_SUBST([ATTR_LIB])
454   # (Free)BSD extattr
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])
459       have_xattr=yes
460     ])
461   ])
463   if test "$have_xattr" = no; then
464     AC_MSG_ERROR([no backend found implementing extended attributes])
465   fi
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]
474   )],
475   [WITH_VALGRIND=$withval],
476   [WITH_VALGRIND=no]
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])
483   ])
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]
492   )],
493   [WITH_LIBUNWIND=$withval],
494   [WITH_LIBUNWIND=no]
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])
501   ])
502   AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
505 dnl Checking for kerberos5
506 AC_MSG_NOTICE([----------------------------------------])
507 AC_MSG_CHECKING([for kerberos5])
508 AC_ARG_WITH([krb5],
509   [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
510   [WITH_KRB5=$withval],
511   [WITH_KRB5=no]
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"
519   fi
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])],
525   [
526     if test "$WITH_KRB5" = no; then
527       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
528     fi
529     krb5_append_CPPFLAGS=" -I$withval"
530     AC_MSG_RESULT([$withval])
531   ],
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])],
538   [
539     if test "$WITH_KRB5" = no; then
540       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
541     fi
542     krb5_append_LDFLAGS=" -L$withval"
543     AC_MSG_RESULT([$withval])
544   ],
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],
554       [
555         KRB5_LIB="-lkrb5 -lgssapi_krb5"
556         AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
557       ],
558       [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
559     )],
560     [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
561   )
562   case "$host_os" in
563   *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
564   * ) ;;
565   esac
568 AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
569 AC_SUBST([KRB5_LIB])
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)]
577   )],
578   [WITH_OPENSSL=$withval],
579   [WITH_OPENSSL=no]
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"
587   fi
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])],
593   [
594     if test "$WITH_OPENSSL" = no; then
595       AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
596     fi
597     openssl_append_CPPFLAGS=" -I$withval"
598     AC_MSG_RESULT([$withval])
599   ],
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])],
606   [
607     if test "$WITH_OPENSSL" = no; then
608       AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
609     fi
610     openssl_append_LDFLAGS=" -L$withval"
611     AC_MSG_RESULT([$withval])
612   ],
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])
621   fi
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])
628   ])
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])]
632   )
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" ]
637   )
639   AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
640   AC_SUBST([SSL_LIB])
641   AC_SUBST([CRYPTO_LIB])
644 dnl pcre support
645 AC_MSG_NOTICE([----------------------------------------])
646 AC_MSG_CHECKING([for perl regular expressions support])
647 AC_ARG_WITH([pcre],
648   [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
649   [WITH_PCRE=$withval],
650   [WITH_PCRE=yes]
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"
658   else
659     AC_PATH_PROG([PCRECONFIG], [pcre-config])
660     if test -n "$PCRECONFIG"; then
661       PCRE_LIB=`"$PCRECONFIG" --libs`
662       CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
663     fi
664   fi
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])
668   fi
670   AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
671   AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
672   AC_SUBST([PCRE_LIB])
675 dnl zlib
676 AC_MSG_NOTICE([----------------------------------------])
677 AC_MSG_CHECKING([for zlib support])
678 AC_ARG_WITH([zlib],
679   [AC_HELP_STRING([--with-zlib],
680     [Enable zlib support for mod_compress]
681   )],
682   [WITH_ZLIB=$withval],
683   [WITH_ZLIB=yes]
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"
691   else
692     AC_CHECK_HEADERS([zlib.h], [],
693       [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
694     )
695     AC_CHECK_LIB([z], [deflate],
696       [Z_LIB=-lz],
697       [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
698     )
699   fi
701   AC_DEFINE([HAVE_LIBZ], [1], [libz])
702   AC_DEFINE([HAVE_ZLIB_H], [1])
703   AC_SUBST([Z_LIB])
706 dnl bzip2
707 AC_MSG_NOTICE([----------------------------------------])
708 AC_MSG_CHECKING([for bzip2 support])
709 AC_ARG_WITH([bzip2],
710   [AC_HELP_STRING([--with-bzip2],
711     [Enable bzip2 support for mod_compress]
712   )],
713   [WITH_BZIP2=$withval],
714   [WITH_BZIP2=yes]
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"
722   else
723     AC_CHECK_HEADERS([bzlib.h], [], [
724       AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
725     ])
726     AC_CHECK_LIB([bz2], [BZ2_bzCompress],
727       [BZ_LIB=-lbz2],
728       [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
729     )
730   fi
732   AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
733   AC_DEFINE([HAVE_BZLIB_H], [1])
734   AC_SUBST([BZ_LIB])
737 dnl Check for fam/gamin
738 AC_MSG_NOTICE([----------------------------------------])
739 AC_MSG_CHECKING([for FAM])
740 AC_ARG_WITH([fam],
741   [AC_HELP_STRING([--with-fam],
742     [fam/gamin for reducing number of stat() calls]
743   )],
744   [WITH_FAM=$withval],
745   [WITH_FAM=no]
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"
753   else
754     AC_CHECK_LIB([fam], [FAMOpen2], [
755       AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
756     ])
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])
760     fi
761   fi
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])
765   fi
767   OLD_LIBS=$LIBS
768   LIBS=$FAM_LIBS
769   AC_CHECK_FUNCS([FAMNoExists])
770   LIBS=$OLD_LIBS
772   AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
773   AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
774   AC_SUBST([FAM_LIBS])
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]
793     )],
794     [WITH_LIBXML=$withval],
795     [WITH_LIBXML=yes]
796   )
797   AC_MSG_RESULT([$WITH_LIBXML])
799   if test "$WITH_LIBXML" = no; then
800     AC_MSG_ERROR([--with-webdav-props requires libxml])
801   fi
803   if test "$WITH_LIBXML" != yes; then
804     XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
805     XML_CFLAGS="-I$WITH_LIBXML/include"
806   else
807     PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
808       AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
809     ])
810   fi
812   AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
813   AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
814   AC_SUBST([XML_LIBS])
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]
821     )],
822     [WITH_SQLITE=$withval],
823     [WITH_SQLITE=yes]
824   )
825   AC_MSG_RESULT([$WITH_SQLITE])
827   if test "$WITH_SQLITE" = no; then
828     AC_MSG_ERROR([--with-webdav-props requires sqlite])
829   fi
831   if test "$WITH_SQLITE" != yes; then
832     SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
833     SQLITE_CFLAGS="-I$WITH_SQLITE"
834   else
835     PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
836       AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
837     ])
838   fi
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)]
853   )],
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])
862   fi
864   AC_MSG_CHECKING([for libuuid])
865   AC_ARG_WITH([uuid],
866     [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
867     [WITH_UUID=$withval],
868     [WITH_UUID=yes]
869   )
870   AC_MSG_RESULT([$WITH_UUID])
872   if test "$WITH_UUID" = no; then
873     AC_MSG_ERROR([--with-webdav-locks requires uuid])
874   fi
876   if test "$WITH_UUID" != yes; then
877     UUID_LIBS="-L$WITH_UUID -luuid"
878     CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
879   else
880     AC_CHECK_LIB([uuid], [uuid_unparse],
881       [UUID_LIBS=-luuid],
882       [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
883     )
884     AC_CHECK_HEADERS([uuid/uuid.h], [],
885       [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
886     )
887   fi
889   AC_DEFINE([HAVE_UUID], [1], [libuuid])
890   AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
891   AC_SUBST([UUID_LIBS])
894 dnl Check for gdbm
895 AC_MSG_NOTICE([----------------------------------------])
896 AC_MSG_CHECKING([for gdbm])
897 AC_ARG_WITH([gdbm],
898   [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
899   [WITH_GDBM=$withval],
900   [WITH_GDBM=no]
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"
908   else
909     AC_CHECK_LIB([gdbm], [gdbm_open],
910       [GDBM_LIB=-lgdbm],
911       [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
912     )
913     AC_CHECK_HEADERS([gdbm.h], [],
914       [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
915     )
916   fi
918   AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
919   AC_DEFINE([HAVE_GDBM_H], [1])
920   AC_SUBST([GDBM_LIB])
922 AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
924 dnl Check for GeoIP
925 AC_MSG_NOTICE([----------------------------------------])
926 AC_MSG_CHECKING([for GeoIP])
927 AC_ARG_WITH([geoip],
928   [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
929   [WITH_GEOIP=$withval],
930   [WITH_GEOIP=no]
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"
938   else
939     AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
940       [GEOIP_LIB=-lGeoIP],
941       [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
942     )
943     AC_CHECK_HEADERS([GeoIP.h], [],
944       [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
945     )
946   fi
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]
960   )],
961   [WITH_MEMCACHED=$withval],
962   [WITH_MEMCACHED=no]
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"
970   else
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])]
974     )
975     AC_CHECK_HEADERS([libmemcached/memcached.h], [],
976       [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
977     )
978   fi
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])
992 dnl Check for lua
993 AC_MSG_NOTICE([----------------------------------------])
994 AC_MSG_CHECKING([if lua-support is requested])
995 AC_ARG_WITH([lua],
996   [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
997   [WITH_LUA=$withval],
998   [WITH_LUA=no]
1000 AC_MSG_RESULT([$WITH_LUA])
1002 if test "$WITH_LUA" != no; then
1003   found_lua=0
1004   if test "$WITH_LUA" != yes; then
1005     PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
1006       [found_lua=1],
1007       [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
1008     )
1009     if test "$found_lua" = "0"; then
1010       LUA_LIBS="-L$WITH_LUA -llua"
1011       LUA_CFLAGS="-I$WITH_LUA"
1012     fi
1013   else
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],
1017           [found_lua=1],
1018           [AC_MSG_NOTICE([Couldn\'t find $luaname])]
1019         )
1020       fi
1021     done
1022     if test "$found_lua" = "0"; then
1023       AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
1024     fi
1025   fi
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
1038 save_LIBS=$LIBS
1039 LIBS=
1040 found_crypt=no
1041 AC_SEARCH_LIBS([crypt_r], [crypt],
1042   [
1043     AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
1044     AC_CHECK_HEADERS([crypt.h])
1045     CRYPT_LIB=$LIBS
1046     found_crypt=crypt_r
1047   ],
1048   [AC_SEARCH_LIBS([crypt], [crypt], [
1049     AC_DEFINE([HAVE_CRYPT], [1], [crypt])
1050     AC_CHECK_HEADERS([crypt.h])
1051     CRYPT_LIB=$LIBS
1052     found_crypt=crypt
1053   ])]
1055 LIBS=$save_LIBS
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([----------------------------------------])
1063 save_LIBS=$LIBS
1064 LIBS=
1065 have_sendfilev=no
1066 AC_SEARCH_LIBS([sendfilev], [sendfile], [
1067   if test -z "$LIBS"; then
1068     have_sendfilev=yes
1069   else
1070     have_sendfilev=$LIBS
1071   fi
1072   SENDFILE_LIB=$LIBS
1073   AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
1075 LIBS=$save_LIBS
1076 AC_SUBST([SENDFILE_LIB])
1078 AC_MSG_CHECKING([solaris sendfilev present])
1079 AC_MSG_RESULT([$have_sendfilev])
1081 AC_MSG_NOTICE([----------------------------------------])
1083 case "$host_os" in
1084 *mingw* ) LIBS="$LIBS -lwsock32" ;;
1085 * ) ;;
1086 esac
1088 AC_CHECK_FUNCS([\
1089   arc4random_buf \
1090   chroot \
1091   clock_gettime \
1092   epoll_ctl \
1093   explicit_bzero \
1094   fork \
1095   getloadavg \
1096   getrlimit \
1097   getuid \
1098   gmtime_r \
1099   inet_pton \
1100   issetugid \
1101   jrand48 \
1102   kqueue \
1103   localtime_r \
1104   lstat \
1105   madvise \
1106   memset \
1107   memset_s \
1108   mmap \
1109   pathconf \
1110   pipe2 \
1111   poll \
1112   port_create \
1113   select \
1114   send_file \
1115   sendfile \
1116   sendfile64 \
1117   sigaction \
1118   signal \
1119   srandom \
1120   writev \
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])
1127 AC_LINK_IFELSE(
1128   [AC_LANG_PROGRAM([[
1129     __attribute__((weak)) void __dummy(void *x) { }
1130     void f(void *x) { __dummy(x); }
1131   ]])],
1132   [
1133     AC_MSG_RESULT([yes])
1134     AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
1135   ],
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)]
1144   )],
1145   [
1146     case "${enableval}" in
1147     yes) ENABLE_LFS=yes ;;
1148     no) ENABLE_LFS=no ;;
1149     *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
1150     esac
1151   ],
1152   [ ENABLE_LFS=yes ]
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
1164     AC_TRY_RUN(
1165       [
1166         #ifdef HAVE_SYS_SENDFILE_H
1167         #include <sys/sendfile.h>
1168         #endif /* HAVE_SYS_SENDFILE_H */
1169         #include <errno.h>
1170         int main() {
1171           int o = 0;
1172           if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
1173           return 0;
1174         }
1175       ],
1176       [AC_MSG_RESULT([yes])],
1177       [
1178         AC_MSG_RESULT([no])
1179         AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1180       ]
1181     )
1182   fi
1185 dnl Check for IPv6 support
1186 AC_MSG_NOTICE([----------------------------------------])
1187 AC_ARG_ENABLE([ipv6],
1188   [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
1189   [
1190     case "${enableval}" in
1191     yes) ipv6=true ;;
1192     no) ipv6=false ;;
1193     *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1194     esac
1195   ],
1196   [ipv6=true]
1199 if test "$ipv6" = true; then
1200   AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
1201     AC_TRY_LINK(
1202       [
1203         #include <sys/types.h>
1204         #include <sys/socket.h>
1205         #include <netinet/in.h>
1206       ],
1207       [
1208         struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1209       ],
1210       [ac_cv_ipv6_support=yes],
1211       [ac_cv_ipv6_support=no]
1212     )
1213   ])
1215   if test "$ac_cv_ipv6_support" = yes; then
1216     AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
1217   else
1218     AC_MSG_ERROR([IPv6 seems broken.  Fix it or build with --disable-ipv6])
1219   fi
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]
1229   )],
1230   [
1231     case "${enableval}" in
1232     yes) mmap=true ;;
1233     no) mmap=false ;;
1234     *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
1235     esac
1236   ],
1237   [mmap=false]
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([----------------------------------------])
1247 fastcgi_found=no
1248 AC_CHECK_LIB([fcgi], [FCGI_Accept], [
1249   AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
1250     fastcgi_found=yes
1251   ])
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)]
1266   )],
1267   [
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]) ;;
1273     esac
1274   ],
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"])
1284   fi
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])
1291 AC_CONFIG_FILES([\
1292   distribute.sh \
1293   doc/config/conf.d/Makefile \
1294   doc/config/Makefile \
1295   doc/config/vhosts.d/Makefile \
1296   doc/Makefile \
1297   doc/outdated/Makefile \
1298   doc/scripts/Makefile \
1299   doc/systemd/Makefile \
1300   Makefile \
1301   src/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 \
1308   tests/Makefile \
1310 AC_OUTPUT
1312 do_build="\
1313   mod_access \
1314   mod_accesslog \
1315   mod_alias \
1316   mod_auth \
1317   mod_authn_file \
1318   mod_cgi \
1319   mod_compress \
1320   mod_deflate \
1321   mod_dirlisting \
1322   mod_evhost \
1323   mod_expire \
1324   mod_extforward \
1325   mod_fastcgi \
1326   mod_flv_streaming \
1327   mod_indexfile \
1328   mod_proxy \
1329   mod_redirect \
1330   mod_rewrite \
1331   mod_rrdtool \
1332   mod_scgi \
1333   mod_secdownload \
1334   mod_setenv \
1335   mod_simple_vhost \
1336   mod_ssi \
1337   mod_staticfile \
1338   mod_status \
1339   mod_userdir \
1340   mod_usertrack \
1341   mod_vhostdb \
1342   mod_webdav \
1343   mod_wstunnel \
1346 lighty_track_feature() {
1347   if eval "$3"; then
1348     enable_feature="$enable_feature $1"
1349     do_build="$do_build $2"
1350   else
1351     disable_feature="$disable_feature $1"
1352     no_build="$no_build $2"
1353   fi
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'
1416 dnl output
1418 $ECHO
1419 $ECHO "Plugins:"
1420 $ECHO
1422 $ECHO "enabled: "
1423 for p in $do_build; do
1424   $ECHO "  $p"
1425 done | sort
1427 $ECHO "disabled: "
1428 for p in $no_build; do
1429   $ECHO "  $p"
1430 done | sort
1432 $ECHO
1433 $ECHO "Features:"
1434 $ECHO
1436 $ECHO "enabled: "
1437 for p in $enable_feature; do
1438   $ECHO "  $p"
1439 done | sort
1441 $ECHO "disabled: "
1442 for p in $disable_feature; do
1443   $ECHO "  $p"
1444 done | sort
1446 $ECHO