[mod_auth] HTTP Auth Digest algorithm=SHA-256
[lighttpd.git] / configure.ac
blob7262d3fb4fc280edde40adff50930b74a0bb4f1f
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.54], [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.13 -Wall -Wno-portability -Wno-override foreign dist-xz tar-ustar serial-tests silent-rules subdir-objects])
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 PKG_PROG_PKG_CONFIG
175 dnl checking for libev
176 AC_MSG_NOTICE([----------------------------------------])
177 AC_MSG_CHECKING([for libev support])
178 AC_ARG_WITH([libev],
179   [AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
180     [Include libev support for fdevent handlers in PATH/include and PATH/lib]
181   )],
182   [WITH_LIBEV=$withval],
183   [WITH_LIBEV=no]
185 AC_MSG_RESULT([$WITH_LIBEV])
187 LIBEV_CFLAGS=
188 LIBEV_LIBS=
190 if test "$WITH_LIBEV" != no; then
191   PKG_CHECK_MODULES([LIBEV], [libev], [], [
192     dnl no pkg-config for libev, searching manually:
194     if test "$WITH_LIBEV" != yes; then
195       LIBEV_CFLAGS="-I$WITH_LIBEV/include"
196       LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
197     else
198       AC_CHECK_HEADERS([ev.h],
199         [AC_CHECK_LIB([ev], [ev_time],
200           [
201             LIBEV_CFLAGS=
202             LIBEV_LIBS="-lev"
203           ],
204           [AC_MSG_ERROR([libev not found])]
205         )],
206         [AC_MSG_ERROR([libev header not found])]
207       )
208     fi
209   ])
211   AC_DEFINE([HAVE_LIBEV], [1], [libev support])
214 AC_SUBST([LIBEV_CFLAGS])
215 AC_SUBST([LIBEV_LIBS])
217 dnl Checks for mysql
218 AC_MSG_NOTICE([----------------------------------------])
219 AC_MSG_CHECKING([for MySQL support])
220 AC_ARG_WITH([mysql],
221   [AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
222     [Include MySQL support. PATH is the path to 'mysql_config']
223   )],
224   [WITH_MYSQL=$withval],
225   [WITH_MYSQL=no]
227 AC_MSG_RESULT([$WITH_MYSQL])
229 MYSQL_CFLAGS=
230 MYSQL_LIBS=
232 if test "$WITH_MYSQL" != no; then
233   if test "$WITH_MYSQL" = yes; then
234     PKG_CHECK_MODULES([MYSQL],[mariadb],[
235       MYSQL_CONFIG=$PKG_CONFIG
236     ],[
237       PKG_CHECK_MODULES([MYSQL],[mysqlclient],[
238         MYSQL_CONFIG=$PKG_CONFIG
239       ],[
240         AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
241       ])
242     ])
243   else
244     MYSQL_CONFIG=$WITH_MYSQL
245   fi
247   if test "$MYSQL_CONFIG" != "$PKG_CONFIG"; then
248     if test -z "$MYSQL_CONFIG"; then
249       AC_MSG_ERROR([mysql_config is not found])
250     fi
251     if test ! -x "$MYSQL_CONFIG"; then
252       AC_MSG_ERROR([mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config])
253     fi
255     if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
256       MYSQL_CFLAGS=`"$MYSQL_CONFIG" --include | sed s/\'//g`
257     else
258       MYSQL_CFLAGS=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
259     fi
260     MYSQL_LIBS=`"$MYSQL_CONFIG" --libs | sed s/\'//g`
261   fi
263   AC_MSG_CHECKING([for MySQL includes at])
264   AC_MSG_RESULT([$MYSQL_CFLAGS])
266   AC_MSG_CHECKING([for MySQL libraries at])
267   AC_MSG_RESULT([$MYSQL_LIBS])
269   AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
271 AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
273 AC_SUBST([MYSQL_LIBS])
274 AC_SUBST([MYSQL_CFLAGS])
276 dnl Checks for pgsql
277 AC_MSG_NOTICE([----------------------------------------])
278 AC_MSG_CHECKING([for PgSQL support])
279 AC_ARG_WITH([pgsql],
280   [AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
281     [Include PgSQL support. PATH is the path to 'pg_config']
282   )],
283   [WITH_PGSQL=$withval],
284   [WITH_PGSQL=no]
286 AC_MSG_RESULT([$WITH_PGSQL])
288 PGSQL_INCLUDE=
289 PGSQL_LIBS=
291 if test "$WITH_PGSQL" != no; then
292   if test "$WITH_PGSQL" = yes; then
293     AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
294   else
295     PGSQL_CONFIG=$WITH_PGSQL
296   fi
298   if test -z "$PGSQL_CONFIG"; then
299     AC_MSG_ERROR([pg_config is not found])
300   fi
301   if test ! -x "$PGSQL_CONFIG"; then
302     AC_MSG_ERROR([pg_config not exists or not executable, use --with-pgsql=path-to-pg_config])
303   fi
305   PGSQL_INCLUDE="-I`"$PGSQL_CONFIG" --includedir`"
306   PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
308   AC_MSG_CHECKING([for PgSQL includes at])
309   AC_MSG_RESULT([$PGSQL_INCLUDE])
311   AC_MSG_CHECKING([for PgSQL libraries at])
312   AC_MSG_RESULT([$PGSQL_LIBS])
314   AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
316 AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
318 AC_SUBST([PGSQL_LIBS])
319 AC_SUBST([PGSQL_INCLUDE])
321 dnl Checks for libdbi library
322 AC_MSG_NOTICE([----------------------------------------])
323 AC_MSG_CHECKING([for LibDBI support])
324 AC_ARG_WITH([dbi],
325   [AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
326     [Include DBI support in PATH/include/dbi.h and PATH/lib]
327   )],
328   [WITH_DBI=$withval],
329   [WITH_DBI=no]
331 AC_MSG_RESULT([$WITH_DBI])
333 DBI_INCLUDE=
334 DBI_LIBS=
336 if test "$WITH_DBI" != no; then
337   if test "$WITH_DBI" != yes; then
338     DBI_CFLAGS="-I$WITH_DBI/include"
339     DBI_LIBS="-L$WITH_DBI/lib -ldbi"
340   else
341     AC_CHECK_HEADERS([dbi/dbi.h],
342       [AC_CHECK_LIB([dbi], [dbi_version],
343         [
344           DBI_CFLAGS=
345           DBI_LIBS="-ldbi"
346         ],
347         [AC_MSG_ERROR([LibDBI not found])]
348       )],
349       [AC_MSG_ERROR([LibDBI header not found])]
350     )
351   fi
353   AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
355 AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
357 AC_SUBST([DBI_LIBS])
358 AC_SUBST([DBI_CFLAGS])
360 dnl Checks for libsasl2 library
361 AC_MSG_NOTICE([----------------------------------------])
362 AC_MSG_CHECKING([for LibSASL support])
363 AC_ARG_WITH([sasl],
364   [AC_HELP_STRING([--with-sasl@<:@=PATH@:>@],
365     [Include SASL support in PATH/include/sasl/sasl.h and PATH/lib]
366   )],
367   [WITH_SASL=$withval],
368   [WITH_SASL=no]
370 AC_MSG_RESULT([$WITH_SASL])
372 SASL_INCLUDE=
373 SASL_LIBS=
375 if test "$WITH_SASL" != no; then
376   if test "$WITH_SASL" != yes; then
377     SASL_CFLAGS="-I$WITH_SASL/include"
378     SASL_LIBS="-L$WITH_SASL/lib -lsasl2"
379   else
380     AC_CHECK_HEADERS([sasl/sasl.h],
381       [AC_CHECK_LIB([sasl2], [sasl_server_init],
382         [
383           SASL_CFLAGS=
384           SASL_LIBS="-lsasl2"
385         ],
386         [AC_MSG_ERROR([libsasl2 not found])]
387       )],
388       [AC_MSG_ERROR([SASL header not found])]
389     )
390   fi
392   AC_DEFINE([HAVE_SASL], [1], [LibSASL support])
394 AM_CONDITIONAL([BUILD_WITH_SASL], [test "$WITH_SASL" != no])
396 AC_SUBST([SASL_LIBS])
397 AC_SUBST([SASL_CFLAGS])
400 dnl Check for LDAP
401 AC_MSG_NOTICE([----------------------------------------])
402 AC_MSG_CHECKING([for LDAP support])
403 AC_ARG_WITH([ldap],
404   [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
405   [WITH_LDAP=$withval],
406   [WITH_LDAP=no]
408 AC_MSG_RESULT([$WITH_LDAP])
410 if test "$WITH_LDAP" != no; then
411   AC_CHECK_LIB([ldap], [ldap_sasl_bind_s],
412     [AC_CHECK_HEADERS([ldap.h],
413       [
414         LDAP_LIB=-lldap
415         AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
416         AC_DEFINE([HAVE_LDAP_H], [1])
417       ],
418       [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
419     )],
420     [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
421   )
422   AC_SUBST([LDAP_LIB])
423   AC_CHECK_LIB([lber], [ber_printf],
424     [AC_CHECK_HEADERS([lber.h],
425       [
426         LBER_LIB=-llber
427         AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
428         AC_DEFINE([HAVE_LBER_H], [1])
429       ],
430       [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
431     )],
432     [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
433   )
434   AC_SUBST([LBER_LIB])
436 AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
438 dnl Check for PAM
439 AC_MSG_NOTICE([----------------------------------------])
440 AC_MSG_CHECKING(for PAM support)
441 AC_ARG_WITH([pam],
442   [AC_HELP_STRING([--with-pam],[enable PAM support])],
443   [WITH_PAM=$withval],
444   [WITH_PAM=no]
446 AC_MSG_RESULT([$withval])
448 if test "$WITH_PAM" != "no"; then
449   AC_CHECK_LIB([pam], [pam_start],
450     [AC_CHECK_HEADERS([security/pam_appl.h],[
451       PAM_LIB=-lpam
452       AC_DEFINE([HAVE_PAM], [1], [libpam])
453       AC_DEFINE([HAVE_SECURITY_PAM_APPL_H], [1])
454       ],
455       [AC_MSG_ERROR([pam headers not found, install them or build without --with-pam])]
456     )],
457     [AC_MSG_ERROR([pam library not found, install it or build without --with-pam])]
458   )
459   AC_SUBST(PAM_LIB)
461 AM_CONDITIONAL([BUILD_WITH_PAM], [test "$WITH_PAM" != no])
463 dnl Check for xattr
464 AC_MSG_NOTICE([----------------------------------------])
465 AC_MSG_CHECKING([for extended attributes support])
466 AC_ARG_WITH([attr],
467   [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
468   [WITH_ATTR=$withval],
469   [WITH_ATTR=no]
471 AC_MSG_RESULT([$WITH_ATTR])
473 if test "$WITH_ATTR" != no; then
474   have_xattr=no
475   # libattr (linux only?)
476   AC_CHECK_LIB([attr], [attr_get], [
477     AC_CHECK_HEADERS([attr/attributes.h], [
478       ATTR_LIB=-lattr
479       AC_DEFINE([HAVE_XATTR], [1], [libattr])
480       AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
481       have_xattr=yes
482     ])
483   ])
484   AC_SUBST([ATTR_LIB])
486   # (Free)BSD extattr
487   AC_CHECK_FUNC([extattr_get_file], [
488     AC_CHECK_HEADERS([sys/extattr.h], [
489       AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
490       AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
491       have_xattr=yes
492     ])
493   ])
495   if test "$have_xattr" = no; then
496     AC_MSG_ERROR([no backend found implementing extended attributes])
497   fi
500 dnl Check for valgrind
501 AC_MSG_NOTICE([----------------------------------------])
502 AC_MSG_CHECKING([for valgrind])
503 AC_ARG_WITH([valgrind],
504   [AC_HELP_STRING([--with-valgrind],
505     [enable internal support for valgrind]
506   )],
507   [WITH_VALGRIND=$withval],
508   [WITH_VALGRIND=no]
510 AC_MSG_RESULT([$WITH_VALGRIND])
512 if test "$WITH_VALGRIND" != no; then
513   AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
514     AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
515   ])
518 dnl Checking for libunwind
519 AC_MSG_NOTICE([----------------------------------------])
520 AC_MSG_CHECKING([for libunwind])
521 AC_ARG_WITH([libunwind],
522   [AC_HELP_STRING([--with-libunwind],
523     [Include libunwind support for backtraces on assert failures]
524   )],
525   [WITH_LIBUNWIND=$withval],
526   [WITH_LIBUNWIND=no]
528 AC_MSG_RESULT([$WITH_LIBUNWIND])
530 if test "$WITH_LIBUNWIND" != no; then
531   PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
532     AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
533   ])
534   AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
537 dnl Checking for kerberos5
538 AC_MSG_NOTICE([----------------------------------------])
539 AC_MSG_CHECKING([for kerberos5])
540 AC_ARG_WITH([krb5],
541   [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
542   [WITH_KRB5=$withval],
543   [WITH_KRB5=no]
545 AC_MSG_RESULT([$WITH_KRB5])
547 if test "$WITH_KRB5" != no; then
548   if test "$WITH_KRB5" != yes; then
549     krb5_append_CPPFLAGS=" -I$WITH_KRB5/include"
550     krb5_append_LDFLAGS=" -L$WITH_KRB5/lib"
551   fi
554 AC_MSG_CHECKING([custom include directory for kerberos5])
555 AC_ARG_WITH([krb5-includes],
556   [AC_HELP_STRING([--with-krb5-includes=DIR], [Kerberos includes])],
557   [
558     if test "$WITH_KRB5" = no; then
559       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
560     fi
561     krb5_append_CPPFLAGS=" -I$withval"
562     AC_MSG_RESULT([$withval])
563   ],
564   [AC_MSG_RESULT([no])]
567 AC_MSG_CHECKING([custom lib directory for kerberos5])
568 AC_ARG_WITH([krb5-libs],
569   [AC_HELP_STRING([--with-krb5-libs=DIR], [Kerberos libraries])],
570   [
571     if test "$WITH_KRB5" = no; then
572       AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
573     fi
574     krb5_append_LDFLAGS=" -L$withval"
575     AC_MSG_RESULT([$withval])
576   ],
577   [AC_MSG_RESULT([no])]
580 if test "$WITH_KRB5" != no; then
581   CPPFLAGS="${CPPFLAGS}${krb5_append_CPPFLAGS}"
582   LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
584   AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
585     [AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
586       [
587         KRB5_LIB="-lkrb5 -lgssapi_krb5"
588         AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
589       ],
590       [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
591     )],
592     [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
593   )
594   case "$host_os" in
595   *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
596   * ) ;;
597   esac
600 AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
601 AC_SUBST([KRB5_LIB])
603 dnl Check for openssl
604 AC_MSG_NOTICE([----------------------------------------])
605 AC_MSG_CHECKING([for OpenSSL])
606 AC_ARG_WITH([openssl],
607   [AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],
608     [Include openssl support (default no)]
609   )],
610   [WITH_OPENSSL=$withval],
611   [WITH_OPENSSL=no]
613 AC_MSG_RESULT([$WITH_OPENSSL])
615 if test "$WITH_OPENSSL" != no; then
616   if test "$WITH_OPENSSL" != yes; then
617     openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
618     openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
619   fi
622 AC_MSG_CHECKING([custom include directory for openssl])
623 AC_ARG_WITH([openssl-includes],
624   [AC_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
625   [
626     if test "$WITH_OPENSSL" = no; then
627       AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
628     fi
629     openssl_append_CPPFLAGS=" -I$withval"
630     AC_MSG_RESULT([$withval])
631   ],
632   [AC_MSG_RESULT([no])]
635 AC_MSG_CHECKING([custom lib directory for openssl])
636 AC_ARG_WITH([openssl-libs],
637   [AC_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
638   [
639     if test "$WITH_OPENSSL" = no; then
640       AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
641     fi
642     openssl_append_LDFLAGS=" -L$withval"
643     AC_MSG_RESULT([$withval])
644   ],
645   [AC_MSG_RESULT([no])]
648 if test "$WITH_OPENSSL" != no; then
649   if test "$WITH_KRB5" != no; then
650     AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
651   fi
653   CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
654   LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
656   AC_CHECK_HEADERS([openssl/ssl.h], [], [
657     AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
658   ])
659   AC_CHECK_LIB([crypto], [BIO_f_base64],
660     [CRYPTO_LIB="-lcrypto"],
661     [AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
662   )
663   AC_CHECK_LIB([ssl], [SSL_new],
664     [SSL_LIB="-lssl -lcrypto"],
665     [AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
666     [ -lcrypto "$DL_LIB" ]
667   )
669   AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
670   AC_SUBST([SSL_LIB])
671   AC_SUBST([CRYPTO_LIB])
674 dnl Check for wolfSSL
675 AC_MSG_NOTICE([----------------------------------------])
676 AC_MSG_CHECKING([for wolfSSL])
677 AC_ARG_WITH([wolfssl],
678   [AC_HELP_STRING([--with-wolfssl@<:@=DIR@:>@],
679     [Include openssl support (default no)]
680   )],
681   [WITH_WOLFSSL=$withval],
682   [WITH_WOLFSSL=no]
684 AC_MSG_RESULT([$WITH_WOLFSSL])
686 if test "$WITH_WOLFSSL" != no; then
687   if test "$WITH_WOLFSSL" = yes; then
688     WITH_WOLFSSL="/usr/local"
689   fi
691   CPPFLAGS="${CPPFLAGS} -I$WITH_WOLFSSL/include -I$WITH_WOLFSSL/include/wolfssl"
692   LDFLAGS="${LDFLAGS} -L$WITH_WOLFSSL/lib"
694   AC_CHECK_HEADERS([wolfssl/ssl.h], [], [
695     AC_MSG_ERROR([wolfssl headers not found. install them or build without --with-wolfssl])
696   ])
697   AC_CHECK_LIB([wolfssl], [wolfSSL_Init],
698     [CRYPTO_LIB="-lwolfssl"],
699     [AC_MSG_ERROR([wolfssl crypto library not found. install it or build without --with-wolfssl])]
700   )
701   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
702     #include <wolfssl/options.h>
703     #if !defined(HAVE_LIGHTY) && !defined(OPENSSL_ALL)
704     #error HAVE_LIGHTY macro not defined
705     #endif
706   ]])], [], [AC_MSG_ERROR([wolfssl must be built with ./configure --enable-lighty])])
707   SSL_LIB="-lwolfssl"
709   AC_SUBST([SSL_LIB])
710   AC_SUBST([CRYPTO_LIB])
713 AM_CONDITIONAL([BUILD_WITH_OPENSSL],
714                [test "$WITH_OPENSSL" != no || test "$WITH_WOLFSSL" != no])
716 if test "$WITH_OPENSSL" != no && test "$WITH_WOLFSSL" != no; then
717   AC_MSG_ERROR([lighttpd should not be built with both --with-openssl and --with-wolfssl])
721 dnl pcre support
722 AC_MSG_NOTICE([----------------------------------------])
723 AC_MSG_CHECKING([for perl regular expressions support])
724 AC_ARG_WITH([pcre],
725   [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
726   [WITH_PCRE=$withval],
727   [WITH_PCRE=yes]
729 AC_MSG_RESULT([$WITH_PCRE])
731 if test "$WITH_PCRE" != no; then
732   if test "$WITH_PCRE" != yes; then
733     PCRE_LIB="-L$WITH_PCRE/lib -lpcre"
734     CPPFLAGS="$CPPFLAGS -I$WITH_PCRE/include"
735   else
736     AC_PATH_PROG([PCRECONFIG], [pcre-config])
737     if test -n "$PCRECONFIG"; then
738       PCRE_LIB=`"$PCRECONFIG" --libs`
739       CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
740     fi
741   fi
743   if test -z "$PCRE_LIB"; then
744     AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
745   fi
747   AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
748   AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
749   AC_SUBST([PCRE_LIB])
752 dnl zlib
753 AC_MSG_NOTICE([----------------------------------------])
754 AC_MSG_CHECKING([for zlib support])
755 AC_ARG_WITH([zlib],
756   [AC_HELP_STRING([--with-zlib],
757     [Enable zlib support for mod_compress]
758   )],
759   [WITH_ZLIB=$withval],
760   [WITH_ZLIB=yes]
762 AC_MSG_RESULT([$WITH_ZLIB])
764 if test "$WITH_ZLIB" != no; then
765   if test "$WITH_ZLIB" != yes; then
766     Z_LIB="-L$WITH_ZLIB -lz"
767     CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
768   else
769     AC_CHECK_HEADERS([zlib.h], [],
770       [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
771     )
772     AC_CHECK_LIB([z], [deflate],
773       [Z_LIB=-lz],
774       [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
775     )
776   fi
778   AC_DEFINE([HAVE_LIBZ], [1], [libz])
779   AC_DEFINE([HAVE_ZLIB_H], [1])
780   AC_SUBST([Z_LIB])
783 dnl bzip2
784 AC_MSG_NOTICE([----------------------------------------])
785 AC_MSG_CHECKING([for bzip2 support])
786 AC_ARG_WITH([bzip2],
787   [AC_HELP_STRING([--with-bzip2],
788     [Enable bzip2 support for mod_compress]
789   )],
790   [WITH_BZIP2=$withval],
791   [WITH_BZIP2=yes]
793 AC_MSG_RESULT([$WITH_BZIP2])
795 if test "$WITH_BZIP2" != no; then
796   if test "$WITH_BZIP2" != yes; then
797     BZ_LIB="-L$WITH_BZIP2 -lbz2"
798     CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
799   else
800     AC_CHECK_HEADERS([bzlib.h], [], [
801       AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
802     ])
803     AC_CHECK_LIB([bz2], [BZ2_bzCompress],
804       [BZ_LIB=-lbz2],
805       [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
806     )
807   fi
809   AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
810   AC_DEFINE([HAVE_BZLIB_H], [1])
811   AC_SUBST([BZ_LIB])
814 dnl Check for fam/gamin
815 AC_MSG_NOTICE([----------------------------------------])
816 AC_MSG_CHECKING([for FAM])
817 AC_ARG_WITH([fam],
818   [AC_HELP_STRING([--with-fam],
819     [fam/gamin for reducing number of stat() calls]
820   )],
821   [WITH_FAM=$withval],
822   [WITH_FAM=no]
824 AC_MSG_RESULT([$WITH_FAM])
826 if test "$WITH_FAM" != no; then
827   if test "$WITH_FAM" != yes; then
828     FAM_LIBS="-L$WITH_FAM -lfam"
829     CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
830   else
831     AC_CHECK_LIB([fam], [FAMOpen2], [
832       AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
833     ])
834     dnl fam has no pkg-config so far, so just search for gamin as fallback
835     if test -z "$FAM_LIBS"; then
836       PKG_CHECK_MODULES([FAM], [gamin >= 0.1.0])
837     fi
838   fi
840   if test -z "$FAM_LIBS"; then
841     AC_MSG_ERROR([fam/gamin headers and/or libs were not found, install them or build without --with-fam])
842   fi
844   OLD_LIBS=$LIBS
845   LIBS=$FAM_LIBS
846   AC_CHECK_FUNCS([FAMNoExists])
847   LIBS=$OLD_LIBS
849   AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
850   AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
851   AC_SUBST([FAM_LIBS])
855 dnl webdav props (xml2 and sqlite3)
856 AC_MSG_NOTICE([----------------------------------------])
857 AC_MSG_CHECKING([for properties in mod_webdav])
858 AC_ARG_WITH([webdav-props],
859   [AC_HELP_STRING([--with-webdav-props], [properties in mod_webdav])],
860   [WITH_WEBDAV_PROPS=$withval],
861   [WITH_WEBDAV_PROPS=no]
863 AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
865 if test "$WITH_WEBDAV_PROPS" != no; then
866   AC_MSG_CHECKING([for libxml2])
867   AC_ARG_WITH([libxml],
868     [AC_HELP_STRING([--with-libxml],
869       [libxml2 for properties in mod_webdav]
870     )],
871     [WITH_LIBXML=$withval],
872     [WITH_LIBXML=yes]
873   )
874   AC_MSG_RESULT([$WITH_LIBXML])
876   if test "$WITH_LIBXML" = no; then
877     AC_MSG_ERROR([--with-webdav-props requires libxml])
878   fi
880   if test "$WITH_LIBXML" != yes; then
881     XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
882     XML_CFLAGS="-I$WITH_LIBXML/include"
883   else
884     PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
885       AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
886     ])
887   fi
889   AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
890   AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
891   AC_SUBST([XML_LIBS])
892   AC_SUBST([XML_CFLAGS])
894   AC_MSG_CHECKING([for sqlite])
895   AC_ARG_WITH([sqlite],
896     [AC_HELP_STRING([--with-sqlite],
897       [sqlite for properties in mod_webdav]
898     )],
899     [WITH_SQLITE=$withval],
900     [WITH_SQLITE=yes]
901   )
902   AC_MSG_RESULT([$WITH_SQLITE])
904   if test "$WITH_SQLITE" = no; then
905     AC_MSG_ERROR([--with-webdav-props requires sqlite])
906   fi
908   if test "$WITH_SQLITE" != yes; then
909     SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
910     SQLITE_CFLAGS="-I$WITH_SQLITE"
911   else
912     PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
913       AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
914     ])
915   fi
917   AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
918   AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
919   AC_SUBST([SQLITE_LIBS])
920   AC_SUBST([SQLITE_CFLAGS])
924 dnl webdav locks (uuid)
925 AC_MSG_NOTICE([----------------------------------------])
926 AC_MSG_CHECKING([for locks in mod_webdav])
927 AC_ARG_WITH([webdav-locks],
928   [AC_HELP_STRING([--with-webdav-locks],
929     [locks in mod_webdav (requires webdav properties)]
930   )],
931   [WITH_WEBDAV_LOCKS=$withval],
932   [WITH_WEBDAV_LOCKS=no]
934 AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
936 if test "$WITH_WEBDAV_LOCKS" != no; then
937   if test "$WITH_WEBDAV_PROPS" = no; then
938     AC_MSG_ERROR([--with-webdav-locks requires --with-webdav-props])
939   fi
941   AC_MSG_CHECKING([for libuuid])
942   AC_ARG_WITH([uuid],
943     [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
944     [WITH_UUID=$withval],
945     [WITH_UUID=yes]
946   )
947   AC_MSG_RESULT([$WITH_UUID])
949   if test "$WITH_UUID" = no; then
950     AC_MSG_ERROR([--with-webdav-locks requires uuid])
951   fi
953   if test "$WITH_UUID" != yes; then
954     UUID_LIBS="-L$WITH_UUID -luuid"
955     CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
956   else
957     AC_CHECK_LIB([uuid], [uuid_unparse],
958       [UUID_LIBS=-luuid],
959       [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
960     )
961     AC_CHECK_HEADERS([uuid/uuid.h], [],
962       [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
963     )
964   fi
966   AC_DEFINE([HAVE_UUID], [1], [libuuid])
967   AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
968   AC_SUBST([UUID_LIBS])
971 dnl Check for gdbm
972 AC_MSG_NOTICE([----------------------------------------])
973 AC_MSG_CHECKING([for gdbm])
974 AC_ARG_WITH([gdbm],
975   [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
976   [WITH_GDBM=$withval],
977   [WITH_GDBM=no]
979 AC_MSG_RESULT([$WITH_GDBM])
981 if test "$WITH_GDBM" != no; then
982   if test "$WITH_GDBM" != yes; then
983     GDBM_LIB="-L$WITH_GDBM -lgdbm"
984     CPPFLAGS="$CPPFLAGS -I$WITH_GDBM"
985   else
986     AC_CHECK_LIB([gdbm], [gdbm_open],
987       [GDBM_LIB=-lgdbm],
988       [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
989     )
990     AC_CHECK_HEADERS([gdbm.h], [],
991       [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
992     )
993   fi
995   AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
996   AC_DEFINE([HAVE_GDBM_H], [1])
997   AC_SUBST([GDBM_LIB])
999 AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
1001 dnl Check for GeoIP
1002 AC_MSG_NOTICE([----------------------------------------])
1003 AC_MSG_CHECKING([for GeoIP])
1004 AC_ARG_WITH([geoip],
1005   [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
1006   [WITH_GEOIP=$withval],
1007   [WITH_GEOIP=no]
1009 AC_MSG_RESULT([$WITH_GEOIP])
1011 if test "$WITH_GEOIP" != no; then
1012   if test "$WITH_GEOIP" != yes; then
1013     GEOIP_LIB="-L$WITH_GEOIP -lGeoIP"
1014     CPPFLAGS="$CPPFLAGS -I$WITH_GEOIP"
1015   else
1016     AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
1017       [GEOIP_LIB=-lGeoIP],
1018       [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
1019     )
1020     AC_CHECK_HEADERS([GeoIP.h], [],
1021       [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
1022     )
1023   fi
1025   AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
1026   AC_DEFINE([HAVE_GEOIP_H], [1])
1027   AC_SUBST([GEOIP_LIB])
1029 AM_CONDITIONAL([BUILD_WITH_GEOIP], [test "$WITH_GEOIP" != no])
1031 dnl Check for memcached
1032 AC_MSG_NOTICE([----------------------------------------])
1033 AC_MSG_CHECKING([for memcached])
1034 AC_ARG_WITH([memcached],
1035   [AC_HELP_STRING([--with-memcached],
1036     [memcached storage for mod_trigger_b4_dl/mod_cml]
1037   )],
1038   [WITH_MEMCACHED=$withval],
1039   [WITH_MEMCACHED=no]
1041 AC_MSG_RESULT([$WITH_MEMCACHED])
1043 if test "$WITH_MEMCACHED" != no; then
1044   if test "$WITH_MEMCACHED" != yes; then
1045     MEMCACHED_LIB="-L$WITH_MEMCACHED -lMEMCACHED"
1046     CPPFLAGS="$CPPFLAGS -I$WITH_MEMCACHED"
1047   else
1048     AC_CHECK_LIB([memcached], [memcached],
1049       [ MEMCACHED_LIB=-lmemcached ],
1050       [AC_MSG_ERROR([memcached lib not found, install it or build without --with-memcached])]
1051     )
1052     AC_CHECK_HEADERS([libmemcached/memcached.h], [],
1053       [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
1054     )
1055   fi
1057   AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
1058   AC_SUBST([MEMCACHED_LIB])
1060 AM_CONDITIONAL([BUILD_WITH_MEMCACHED], [test "$WITH_MEMCACHED" != no])
1062 BUILD_MOD_TRIGGER_B4_DL=no
1063 if test "$WITH_MEMCACHED" != no || test "$WITH_GDBM" != no ; then
1064   BUILD_MOD_TRIGGER_B4_DL=yes
1067 AM_CONDITIONAL([BUILD_MOD_TRIGGER_B4_DL], [test "$BUILD_MOD_TRIGGER_B4_DL" != no])
1069 dnl Check for lua
1070 AC_MSG_NOTICE([----------------------------------------])
1071 AC_MSG_CHECKING([if lua-support is requested])
1072 AC_ARG_WITH([lua],
1073   [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
1074   [WITH_LUA=$withval],
1075   [WITH_LUA=no]
1077 AC_MSG_RESULT([$WITH_LUA])
1079 if test "$WITH_LUA" != no; then
1080   found_lua=0
1081   if test "$WITH_LUA" != yes; then
1082     PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
1083       [found_lua=1],
1084       [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
1085     )
1086     if test "$found_lua" = "0"; then
1087       LUA_LIBS="-L$WITH_LUA -llua"
1088       LUA_CFLAGS="-I$WITH_LUA"
1089     fi
1090   else
1091     for luaname in lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua; do
1092       if test "$found_lua" = "0"; then
1093         PKG_CHECK_MODULES([LUA], [$luaname >= 5.1],
1094           [found_lua=1],
1095           [AC_MSG_NOTICE([Couldn\'t find $luaname])]
1096         )
1097       fi
1098     done
1099     if test "$found_lua" = "0"; then
1100       AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
1101     fi
1102   fi
1104   AC_DEFINE([HAVE_LUA], [1], [liblua])
1105   AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
1106   AC_SUBST([LUA_LIBS])
1107   AC_SUBST([LUA_CFLAGS])
1109 AM_CONDITIONAL([BUILD_WITH_LUA], [test "$WITH_LUA" != no])
1111 dnl "--with-FEATURE" blocks end
1112 AC_MSG_NOTICE([----------------------------------------])
1114 dnl search for crypt_r and (fallback) for crypt
1115 save_LIBS=$LIBS
1116 LIBS=
1117 found_crypt=no
1118 AC_SEARCH_LIBS([crypt_r], [crypt],
1119   [
1120     AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
1121     AC_CHECK_HEADERS([crypt.h])
1122     CRYPT_LIB=$LIBS
1123     found_crypt=crypt_r
1124   ],
1125   [AC_SEARCH_LIBS([crypt], [crypt], [
1126     AC_DEFINE([HAVE_CRYPT], [1], [crypt])
1127     AC_CHECK_HEADERS([crypt.h])
1128     CRYPT_LIB=$LIBS
1129     found_crypt=crypt
1130   ])]
1132 LIBS=$save_LIBS
1133 AC_SUBST([CRYPT_LIB])
1135 AC_MSG_CHECKING([crypt_r/crypt support])
1136 AC_MSG_RESULT([$found_crypt])
1138 dnl check whether sendfilev needs -lsendfile
1139 AC_MSG_NOTICE([----------------------------------------])
1140 save_LIBS=$LIBS
1141 LIBS=
1142 have_sendfilev=no
1143 AC_SEARCH_LIBS([sendfilev], [sendfile], [
1144   if test -z "$LIBS"; then
1145     have_sendfilev=yes
1146   else
1147     have_sendfilev=$LIBS
1148   fi
1149   SENDFILE_LIB=$LIBS
1150   AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
1152 LIBS=$save_LIBS
1153 AC_SUBST([SENDFILE_LIB])
1155 AC_MSG_CHECKING([solaris sendfilev present])
1156 AC_MSG_RESULT([$have_sendfilev])
1158 AC_MSG_NOTICE([----------------------------------------])
1160 case "$host_os" in
1161 *mingw* ) LIBS="$LIBS -lwsock32" ;;
1162 * ) ;;
1163 esac
1165 AC_CHECK_FUNCS([\
1166   arc4random_buf \
1167   chroot \
1168   clock_gettime \
1169   epoll_ctl \
1170   explicit_bzero \
1171   fork \
1172   getloadavg \
1173   getrlimit \
1174   getuid \
1175   gmtime_r \
1176   inet_pton \
1177   issetugid \
1178   jrand48 \
1179   kqueue \
1180   localtime_r \
1181   lstat \
1182   madvise \
1183   memset \
1184   memset_s \
1185   mmap \
1186   pathconf \
1187   pipe2 \
1188   poll \
1189   port_create \
1190   select \
1191   send_file \
1192   sendfile \
1193   sendfile64 \
1194   sigaction \
1195   signal \
1196   srandom \
1197   writev \
1199 AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
1200 AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
1202 AC_MSG_NOTICE([----------------------------------------])
1203 AC_MSG_CHECKING([if weak symbols are supported])
1204 AC_LINK_IFELSE(
1205   [AC_LANG_PROGRAM([[
1206     __attribute__((weak)) void __dummy(void *x) { }
1207     void f(void *x) { __dummy(x); }
1208   ]])],
1209   [
1210     AC_MSG_RESULT([yes])
1211     AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
1212   ],
1213   [AC_MSG_RESULT([no])]
1216 AC_MSG_NOTICE([----------------------------------------])
1217 AC_MSG_CHECKING([for Large File System support])
1218 AC_ARG_ENABLE([lfs],
1219   [AC_HELP_STRING([--enable-lfs],
1220     [Turn on Large File System (default)]
1221   )],
1222   [
1223     case "${enableval}" in
1224     yes) ENABLE_LFS=yes ;;
1225     no) ENABLE_LFS=no ;;
1226     *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
1227     esac
1228   ],
1229   [ ENABLE_LFS=yes ]
1231 AC_MSG_RESULT([$ENABLE_LFS])
1232 if test "$ENABLE_LFS" = yes; then
1233   CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
1236 dnl check if sendfile works
1237 if test "$ac_cv_func_sendfile" = yes; then
1238   AC_MSG_NOTICE([----------------------------------------])
1239   AC_MSG_CHECKING([if sendfile works])
1240   if test "$cross_compiling" = no; then
1241     AC_TRY_RUN(
1242       [
1243         #ifdef HAVE_SYS_SENDFILE_H
1244         #include <sys/sendfile.h>
1245         #endif /* HAVE_SYS_SENDFILE_H */
1246         #include <errno.h>
1247         int main() {
1248           int o = 0;
1249           if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
1250           return 0;
1251         }
1252       ],
1253       [AC_MSG_RESULT([yes])],
1254       [
1255         AC_MSG_RESULT([no])
1256         AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
1257       ]
1258     )
1259   fi
1262 dnl Check for IPv6 support
1263 AC_MSG_NOTICE([----------------------------------------])
1264 AC_ARG_ENABLE([ipv6],
1265   [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
1266   [
1267     case "${enableval}" in
1268     yes) ipv6=true ;;
1269     no) ipv6=false ;;
1270     *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
1271     esac
1272   ],
1273   [ipv6=true]
1276 if test "$ipv6" = true; then
1277   AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
1278     AC_TRY_LINK(
1279       [
1280         #include <sys/types.h>
1281         #include <sys/socket.h>
1282         #include <netinet/in.h>
1283       ],
1284       [
1285         struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1286       ],
1287       [ac_cv_ipv6_support=yes],
1288       [ac_cv_ipv6_support=no]
1289     )
1290   ])
1292   if test "$ac_cv_ipv6_support" = yes; then
1293     AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
1294   else
1295     AC_MSG_ERROR([IPv6 seems broken.  Fix it or build with --disable-ipv6])
1296   fi
1299 # disable mmap by default
1300 # lighttpd may always use mmap with files it owns (created tmp files)
1301 AC_MSG_NOTICE([----------------------------------------])
1302 AC_MSG_CHECKING([use mmap if available])
1303 AC_ARG_ENABLE([mmap],
1304   [AC_HELP_STRING([--enable-mmap],
1305     [use mmap if available]
1306   )],
1307   [
1308     case "${enableval}" in
1309     yes) mmap=true ;;
1310     no) mmap=false ;;
1311     *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
1312     esac
1313   ],
1314   [mmap=false]
1316 AC_MSG_RESULT([$mmap])
1318 if test "$mmap" = true; then
1319   AC_DEFINE([ENABLE_MMAP], [1], [Use mmap if available])
1322 dnl check for fastcgi lib, for the tests only
1323 AC_MSG_NOTICE([----------------------------------------])
1324 fastcgi_found=no
1325 AC_CHECK_LIB([fcgi], [FCGI_Accept], [
1326   AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
1327     fastcgi_found=yes
1328   ])
1331 AM_CONDITIONAL([CHECK_WITH_FASTCGI], [test "$fastcgi_found" = yes])
1334 AC_MSG_NOTICE([----------------------------------------])
1335 dnl check for extra compiler options (warning options)
1336 if test "${GCC}" = yes; then
1337   TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
1340 AC_ARG_ENABLE([extra-warnings],
1341   [AC_HELP_STRING([--enable-extra-warnings],
1342     [enable extra warnings (gcc specific)]
1343   )],
1344   [
1345     case "${enableval}" in
1346     error) extrawarnings=error ;;
1347     yes) extrawarnings=true ;;
1348     no) extrawarnings=false ;;
1349     *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
1350     esac
1351   ],
1352   [extrawarnings=false]
1355 if test "$extrawarnings" = true || test "$extrawarnings" = error; then
1356   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])
1357   TRY_LDFLAGS([-Wl,--as-needed])
1358   if test "$extrawarnings" = error; then
1359     AS_VAR_APPEND([CFLAGS], [" -Werror"])
1360     AS_VAR_APPEND([LDFLAGS], [" -Wl,--fatal-warnings"])
1361   fi
1364 dnl build version-id
1365 LIGHTTPD_VERSION_ID=m4_format([0x%x%02x%02x], m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))
1366 AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
1368 AC_CONFIG_FILES([\
1369   distribute.sh \
1370   doc/config/conf.d/Makefile \
1371   doc/config/Makefile \
1372   doc/config/vhosts.d/Makefile \
1373   doc/Makefile \
1374   doc/outdated/Makefile \
1375   doc/scripts/Makefile \
1376   doc/systemd/Makefile \
1377   Makefile \
1378   src/Makefile \
1379   tests/docroot/123/Makefile \
1380   tests/docroot/Makefile \
1381   tests/docroot/www/expire/Makefile \
1382   tests/docroot/www/go/Makefile \
1383   tests/docroot/www/indexfile/Makefile \
1384   tests/docroot/www/Makefile \
1385   tests/Makefile \
1387 AC_OUTPUT
1389 do_build="\
1390   mod_access \
1391   mod_accesslog \
1392   mod_alias \
1393   mod_auth \
1394   mod_authn_file \
1395   mod_cgi \
1396   mod_compress \
1397   mod_deflate \
1398   mod_dirlisting \
1399   mod_evhost \
1400   mod_expire \
1401   mod_extforward \
1402   mod_fastcgi \
1403   mod_flv_streaming \
1404   mod_indexfile \
1405   mod_proxy \
1406   mod_redirect \
1407   mod_rewrite \
1408   mod_rrdtool \
1409   mod_scgi \
1410   mod_secdownload \
1411   mod_setenv \
1412   mod_simple_vhost \
1413   mod_sockproxy \
1414   mod_ssi \
1415   mod_staticfile \
1416   mod_status \
1417   mod_userdir \
1418   mod_usertrack \
1419   mod_vhostdb \
1420   mod_webdav \
1421   mod_wstunnel \
1424 lighty_track_feature() {
1425   if eval "$3"; then
1426     enable_feature="$enable_feature $1"
1427     do_build="$do_build $2"
1428   else
1429     disable_feature="$disable_feature $1"
1430     no_build="$no_build $2"
1431   fi
1434 lighty_track_feature "regex-conditionals" "" \
1435   'test "$WITH_PCRE" != no'
1437 lighty_track_feature "storage-gdbm" "" \
1438   'test "$WITH_GDBM" != no'
1440 lighty_track_feature "storage-memcached" "" \
1441   'test "$WITH_MEMCACHED" != no'
1443 lighty_track_feature "" "mod_trigger_b4_dl" \
1444   'test "$BUILD_MOD_TRIGGER_B4_DL" != no'
1446 lighty_track_feature "mysql" "mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql" \
1447   'test "$WITH_MYSQL" != no'
1449 lighty_track_feature "postgresql" "mod_vhostdb_pgsql" \
1450   'test "$WITH_PGSQL" != no'
1452 lighty_track_feature "dbi" "mod_vhostdb_dbi" \
1453   'test "$WITH_DBI" != no'
1455 lighty_track_feature "lua" "mod_cml mod_magnet" \
1456   'test "$WITH_LUA" != no'
1458 lighty_track_feature "geoip" "mod_geoip" \
1459   'test "$WITH_GEOIP" != no'
1461 lighty_track_feature "compress-gzip compress-deflate" "" \
1462   'test "$WITH_ZLIB" != no'
1464 lighty_track_feature "compress-bzip2" "" \
1465   'test "$WITH_BZIP2" != no'
1467 lighty_track_feature "kerberos" "mod_authn_gssapi" \
1468   'test "$WITH_KRB5" != no'
1470 lighty_track_feature "ldap" "mod_authn_ldap mod_vhostdb_ldap" \
1471   'test "$WITH_LDAP" != no'
1473 lighty_track_feature "pam" "mod_authn_pam" \
1474   'test "$WITH_PAM" != no'
1476 lighty_track_feature "network-openssl" "mod_openssl" \
1477   'test "$WITH_OPENSSL" != no || test "$WITH_WOLFSSL" != no'
1479 lighty_track_feature "auth-crypt" "" \
1480   'test "$found_crypt" != no'
1482 lighty_track_feature "network-ipv6" "" \
1483   'test "$ac_cv_ipv6_support" != no'
1485 lighty_track_feature "large-files" "" \
1486   'test "$ENABLE_LFS" = yes'
1488 lighty_track_feature "stat-cache-fam" "" \
1489   'test "$WITH_FAM" != no'
1491 lighty_track_feature "webdav-properties" "" \
1492   'test "$WITH_WEBDAV_PROPS" != no'
1494 lighty_track_feature "webdav-locks" "" \
1495   'test "$WITH_WEBDAV_LOCKS" != no'
1497 dnl output
1499 $ECHO
1500 $ECHO "Plugins:"
1501 $ECHO
1503 $ECHO "enabled: "
1504 for p in $do_build; do
1505   $ECHO "  $p"
1506 done | sort
1508 $ECHO "disabled: "
1509 for p in $no_build; do
1510   $ECHO "  $p"
1511 done | sort
1513 $ECHO
1514 $ECHO "Features:"
1515 $ECHO
1517 $ECHO "enabled: "
1518 for p in $enable_feature; do
1519   $ECHO "  $p"
1520 done | sort
1522 $ECHO "disabled: "
1523 for p in $disable_feature; do
1524   $ECHO "  $p"
1525 done | sort
1527 $ECHO