lighttpd 1.4.x https://www.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1446 lines
37 KiB

  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.49], [contact@lighttpd.net])
  18. AC_CONFIG_SRCDIR([src/server.c])
  19. AC_CONFIG_HEADER([config.h])
  20. AC_CONFIG_MACRO_DIR([m4])
  21. AC_CANONICAL_HOST
  22. AM_INIT_AUTOMAKE([1.13 -Wall -Wno-portability -Wno-override foreign dist-xz tar-ustar serial-tests silent-rules])
  23. dnl @synopsis TRY_CFLAGS [compiler flags]
  24. dnl @summary check whether compiler supports given flags and adds them to CFLAGS
  25. AC_DEFUN([TRY_CFLAGS],
  26. [dnl
  27. AC_MSG_CHECKING([if $CC supports $1])
  28. AC_LANG_PUSH([C])
  29. ac_try_cflags_saved_cflags="${CFLAGS}"
  30. CFLAGS="${CFLAGS} $1"
  31. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
  32. [AC_MSG_RESULT([yes])],
  33. [
  34. AC_MSG_ERROR([no])
  35. CFLAGS="${ac_try_cflags_saved_cflags}"
  36. ]
  37. )
  38. AC_LANG_POP([C])
  39. ])
  40. dnl @synopsis TRY_LDFLAGS [linker flags]
  41. dnl @summary check whether linker supports given flags and adds them to LDFLAGS
  42. AC_DEFUN([TRY_LDFLAGS],
  43. [dnl
  44. AC_MSG_CHECKING([if $LD supports $1])
  45. AC_LANG_PUSH([C])
  46. ac_try_ldflags_saved_ldflags="${LDFLAGS}"
  47. LDFLAGS="${LDFLAGS} $1"
  48. AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
  49. [AC_MSG_RESULT([yes])],
  50. [
  51. AC_MSG_ERROR([no])
  52. LDFLAGS="${ac_try_ldflags_saved_cflags}"
  53. ]
  54. )
  55. AC_LANG_POP([C])
  56. ])
  57. dnl Checks for programs.
  58. AC_PROG_CC
  59. AC_PROG_CC_STDC
  60. AX_PROG_CC_FOR_BUILD
  61. AC_PROG_LD
  62. AC_PROG_INSTALL
  63. AC_PROG_CPP
  64. AC_PROG_MAKE_SET
  65. AC_USE_SYSTEM_EXTENSIONS
  66. AM_PROG_AR
  67. dnl AC_CANONICAL_HOST
  68. case "$host_os" in
  69. *darwin*|*cygwin*|*aix*|*mingw*|*midipix* ) NO_RDYNAMIC=yes ;;
  70. * ) NO_RDYNAMIC=no ;;
  71. esac
  72. AM_CONDITIONAL([NO_RDYNAMIC], [test "$NO_RDYNAMIC" = yes])
  73. AM_CONDITIONAL([LIGHTTPD_STATIC], [test "$LIGHTTPD_STATIC" = yes])
  74. AC_EXEEXT
  75. dnl libtool
  76. AC_DISABLE_STATIC
  77. AC_ENABLE_SHARED
  78. AC_LIBTOOL_DLOPEN
  79. AC_PROG_LIBTOOL
  80. dnl for solaris
  81. CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
  82. dnl Checks for header files.
  83. dnl check for:
  84. dnl inttypes.h => HAVE_INTTYPES_H
  85. dnl stdint.h => HAVE_STDINT_H
  86. dnl and maybe more (which shouldn't be relied on)
  87. AC_HEADER_STDC
  88. dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
  89. AC_HEADER_SYS_WAIT
  90. AC_CHECK_HEADERS([\
  91. getopt.h \
  92. poll.h \
  93. port.h \
  94. pwd.h \
  95. stdlib.h \
  96. strings.h \
  97. sys/devpoll.h \
  98. sys/epoll.h \
  99. sys/event.h \
  100. sys/filio.h \
  101. sys/mman.h \
  102. sys/poll.h \
  103. sys/prctl.h \
  104. sys/resource.h \
  105. sys/select.h \
  106. sys/sendfile.h \
  107. sys/time.h \
  108. sys/uio.h \
  109. sys/un.h \
  110. syslog.h \
  111. uuid/uuid.h \
  112. ])
  113. dnl Checks for typedefs, structures, and compiler characteristics.
  114. AC_C_CONST
  115. AC_C_INLINE
  116. AC_TYPE_OFF_T
  117. AC_TYPE_PID_T
  118. AC_TYPE_SIZE_T
  119. AC_CHECK_MEMBER([struct tm.tm_gmtoff],
  120. [AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
  121. [],
  122. [#include <time.h>]
  123. )
  124. AC_CHECK_TYPES([socklen_t],
  125. [], dnl defines HAVE_SOCKLEN_T
  126. [],
  127. [
  128. #include <sys/types.h>
  129. #include <sys/socket.h>
  130. ]
  131. )
  132. dnl openssl on solaris needs -lsocket -lnsl
  133. AC_SEARCH_LIBS([socket], [socket])
  134. AC_SEARCH_LIBS([gethostbyname], [nsl socket])
  135. dnl On Haiku accept() and friends are in libnetwork
  136. AC_SEARCH_LIBS([accept], [network])
  137. dnl clock_gettime() needs -lrt with glibc < 2.17, and possibly other platforms
  138. AC_SEARCH_LIBS([clock_gettime], [rt])
  139. dnl need dlopen/-ldl to load plugins (when not on windows)
  140. save_LIBS=$LIBS
  141. LIBS=
  142. AC_SEARCH_LIBS([dlopen], [dl], [
  143. AC_CHECK_HEADERS([dlfcn.h], [
  144. DL_LIB=$LIBS
  145. AC_DEFINE([HAVE_LIBDL], [1], [libdl])
  146. AC_DEFINE([HAVE_DLFCN_H], [1])
  147. ])
  148. ])
  149. LIBS=$save_LIBS
  150. AC_SUBST([DL_LIB])
  151. dnl prepare pkg-config usage below
  152. if test -z "$PKG_CONFIG"; then
  153. AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
  154. fi
  155. PKG_PROG_PKG_CONFIG
  156. dnl checking for libev
  157. AC_MSG_NOTICE([----------------------------------------])
  158. AC_MSG_CHECKING([for libev support])
  159. AC_ARG_WITH([libev],
  160. [AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
  161. [Include libev support for fdevent handlers in PATH/include and PATH/lib]
  162. )],
  163. [WITH_LIBEV=$withval],
  164. [WITH_LIBEV=no]
  165. )
  166. AC_MSG_RESULT([$WITH_LIBEV])
  167. LIBEV_CFLAGS=
  168. LIBEV_LIBS=
  169. if test "$WITH_LIBEV" != no; then
  170. PKG_CHECK_MODULES([LIBEV], [libev], [], [
  171. dnl no pkg-config for libev, searching manually:
  172. if test "$WITH_LIBEV" != yes; then
  173. LIBEV_CFLAGS="-I$WITH_LIBEV/include"
  174. LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
  175. else
  176. AC_CHECK_HEADERS([ev.h],
  177. [AC_CHECK_LIB([ev], [ev_time],
  178. [
  179. LIBEV_CFLAGS=
  180. LIBEV_LIBS="-lev"
  181. ],
  182. [AC_MSG_ERROR([libev not found])]
  183. )],
  184. [AC_MSG_ERROR([libev header not found])]
  185. )
  186. fi
  187. ])
  188. AC_DEFINE([HAVE_LIBEV], [1], [libev support])
  189. fi
  190. AC_SUBST([LIBEV_CFLAGS])
  191. AC_SUBST([LIBEV_LIBS])
  192. dnl Checks for mysql
  193. AC_MSG_NOTICE([----------------------------------------])
  194. AC_MSG_CHECKING([for MySQL support])
  195. AC_ARG_WITH([mysql],
  196. [AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
  197. [Include MySQL support. PATH is the path to 'mysql_config']
  198. )],
  199. [WITH_MYSQL=$withval],
  200. [WITH_MYSQL=no]
  201. )
  202. AC_MSG_RESULT([$WITH_MYSQL])
  203. MYSQL_INCLUDE=
  204. MYSQL_LIBS=
  205. if test "$WITH_MYSQL" != no; then
  206. if test "$WITH_MYSQL" = yes; then
  207. AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
  208. else
  209. MYSQL_CONFIG=$WITH_MYSQL
  210. fi
  211. if test -z "$MYSQL_CONFIG"; then
  212. AC_MSG_ERROR([mysql_config is not found])
  213. fi
  214. if test ! -x "$MYSQL_CONFIG"; then
  215. AC_MSG_ERROR([mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config])
  216. fi
  217. if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
  218. MYSQL_INCLUDE=`"$MYSQL_CONFIG" --include | sed s/\'//g`
  219. else
  220. MYSQL_INCLUDE=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
  221. fi
  222. MYSQL_LIBS=`"$MYSQL_CONFIG" --libs | sed s/\'//g`
  223. AC_MSG_CHECKING([for MySQL includes at])
  224. AC_MSG_RESULT([$MYSQL_INCLUDE])
  225. AC_MSG_CHECKING([for MySQL libraries at])
  226. AC_MSG_RESULT([$MYSQL_LIBS])
  227. AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
  228. fi
  229. AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
  230. AC_SUBST([MYSQL_LIBS])
  231. AC_SUBST([MYSQL_INCLUDE])
  232. dnl Checks for pgsql
  233. AC_MSG_NOTICE([----------------------------------------])
  234. AC_MSG_CHECKING([for PgSQL support])
  235. AC_ARG_WITH([pgsql],
  236. [AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
  237. [Include PgSQL support. PATH is the path to 'pg_config']
  238. )],
  239. [WITH_PGSQL=$withval],
  240. [WITH_PGSQL=no]
  241. )
  242. AC_MSG_RESULT([$WITH_PGSQL])
  243. PGSQL_INCLUDE=
  244. PGSQL_LIBS=
  245. if test "$WITH_PGSQL" != no; then
  246. if test "$WITH_PGSQL" = yes; then
  247. AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
  248. else
  249. PGSQL_CONFIG=$WITH_PGSQL
  250. fi
  251. if test -z "$PGSQL_CONFIG"; then
  252. AC_MSG_ERROR([pg_config is not found])
  253. fi
  254. if test ! -x "$PGSQL_CONFIG"; then
  255. AC_MSG_ERROR([pg_config not exists or not executable, use --with-pgsql=path-to-pg_config])
  256. fi
  257. PGSQL_INCLUDE="-I`"$PGSQL_CONFIG" --includedir`"
  258. PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
  259. AC_MSG_CHECKING([for PgSQL includes at])
  260. AC_MSG_RESULT([$PGSQL_INCLUDE])
  261. AC_MSG_CHECKING([for PgSQL libraries at])
  262. AC_MSG_RESULT([$PGSQL_LIBS])
  263. AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
  264. fi
  265. AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
  266. AC_SUBST([PGSQL_LIBS])
  267. AC_SUBST([PGSQL_INCLUDE])
  268. dnl Checks for libdbi library
  269. AC_MSG_NOTICE([----------------------------------------])
  270. AC_MSG_CHECKING([for LibDBI support])
  271. AC_ARG_WITH([dbi],
  272. [AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
  273. [Include DBI support in PATH/include/dbi.h and PATH/lib]
  274. )],
  275. [WITH_DBI=$withval],
  276. [WITH_DBI=no]
  277. )
  278. AC_MSG_RESULT([$WITH_DBI])
  279. DBI_INCLUDE=
  280. DBI_LIBS=
  281. if test "$WITH_DBI" != no; then
  282. if test "$WITH_DBI" != yes; then
  283. DBI_CFLAGS="-I$WITH_DBI/include"
  284. DBI_LIBS="-L$WITH_DBI/lib -ldbi"
  285. else
  286. AC_CHECK_HEADERS([dbi/dbi.h],
  287. [AC_CHECK_LIB([dbi], [dbi_version],
  288. [
  289. DBI_CFLAGS=
  290. DBI_LIBS="-ldbi"
  291. ],
  292. [AC_MSG_ERROR([LibDBI not found])]
  293. )],
  294. [AC_MSG_ERROR([LibDBI header not found])]
  295. )
  296. fi
  297. AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
  298. fi
  299. AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
  300. AC_SUBST([DBI_LIBS])
  301. AC_SUBST([DBI_CFLAGS])
  302. dnl Checks for libsasl2 library
  303. AC_MSG_NOTICE([----------------------------------------])
  304. AC_MSG_CHECKING([for LibSASL support])
  305. AC_ARG_WITH([sasl],
  306. [AC_HELP_STRING([--with-sasl@<:@=PATH@:>@],
  307. [Include SASL support in PATH/include/sasl/sasl.h and PATH/lib]
  308. )],
  309. [WITH_SASL=$withval],
  310. [WITH_SASL=no]
  311. )
  312. AC_MSG_RESULT([$WITH_SASL])
  313. SASL_INCLUDE=
  314. SASL_LIBS=
  315. if test "$WITH_SASL" != no; then
  316. if test "$WITH_SASL" != yes; then
  317. SASL_CFLAGS="-I$WITH_SASL/include"
  318. SASL_LIBS="-L$WITH_SASL/lib -lsasl2"
  319. else
  320. AC_CHECK_HEADERS([sasl/sasl.h],
  321. [AC_CHECK_LIB([sasl2], [sasl_server_init],
  322. [
  323. SASL_CFLAGS=
  324. SASL_LIBS="-lsasl2"
  325. ],
  326. [AC_MSG_ERROR([libsasl2 not found])]
  327. )],
  328. [AC_MSG_ERROR([SASL header not found])]
  329. )
  330. fi
  331. AC_DEFINE([HAVE_SASL], [1], [LibSASL support])
  332. fi
  333. AM_CONDITIONAL([BUILD_WITH_SASL], [test "$WITH_SASL" != no])
  334. AC_SUBST([SASL_LIBS])
  335. AC_SUBST([SASL_CFLAGS])
  336. dnl Check for LDAP
  337. AC_MSG_NOTICE([----------------------------------------])
  338. AC_MSG_CHECKING([for LDAP support])
  339. AC_ARG_WITH([ldap],
  340. [AC_HELP_STRING([--with-ldap], [enable LDAP support])],
  341. [WITH_LDAP=$withval],
  342. [WITH_LDAP=no]
  343. )
  344. AC_MSG_RESULT([$WITH_LDAP])
  345. if test "$WITH_LDAP" != no; then
  346. AC_CHECK_LIB([ldap], [ldap_sasl_bind_s],
  347. [AC_CHECK_HEADERS([ldap.h],
  348. [
  349. LDAP_LIB=-lldap
  350. AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
  351. AC_DEFINE([HAVE_LDAP_H], [1])
  352. ],
  353. [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
  354. )],
  355. [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
  356. )
  357. AC_SUBST([LDAP_LIB])
  358. AC_CHECK_LIB([lber], [ber_printf],
  359. [AC_CHECK_HEADERS([lber.h],
  360. [
  361. LBER_LIB=-llber
  362. AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
  363. AC_DEFINE([HAVE_LBER_H], [1])
  364. ],
  365. [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
  366. )],
  367. [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
  368. )
  369. AC_SUBST([LBER_LIB])
  370. fi
  371. AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
  372. dnl Check for xattr
  373. AC_MSG_NOTICE([----------------------------------------])
  374. AC_MSG_CHECKING([for extended attributes support])
  375. AC_ARG_WITH([attr],
  376. [AC_HELP_STRING([--with-attr], [enable extended attribute support])],
  377. [WITH_ATTR=$withval],
  378. [WITH_ATTR=no]
  379. )
  380. AC_MSG_RESULT([$WITH_ATTR])
  381. if test "$WITH_ATTR" != no; then
  382. have_xattr=no
  383. # libattr (linux only?)
  384. AC_CHECK_LIB([attr], [attr_get], [
  385. AC_CHECK_HEADERS([attr/attributes.h], [
  386. ATTR_LIB=-lattr
  387. AC_DEFINE([HAVE_XATTR], [1], [libattr])
  388. AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
  389. have_xattr=yes
  390. ])
  391. ])
  392. AC_SUBST([ATTR_LIB])
  393. # (Free)BSD extattr
  394. AC_CHECK_FUNC([extattr_get_file], [
  395. AC_CHECK_HEADERS([sys/extattr.h], [
  396. AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
  397. AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
  398. have_xattr=yes
  399. ])
  400. ])
  401. if test "$have_xattr" = no; then
  402. AC_MSG_ERROR([no backend found implementing extended attributes])
  403. fi
  404. fi
  405. dnl Check for valgrind
  406. AC_MSG_NOTICE([----------------------------------------])
  407. AC_MSG_CHECKING([for valgrind])
  408. AC_ARG_WITH([valgrind],
  409. [AC_HELP_STRING([--with-valgrind],
  410. [enable internal support for valgrind]
  411. )],
  412. [WITH_VALGRIND=$withval],
  413. [WITH_VALGRIND=no]
  414. )
  415. AC_MSG_RESULT([$WITH_VALGRIND])
  416. if test "$WITH_VALGRIND" != no; then
  417. AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
  418. AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
  419. ])
  420. fi
  421. dnl Checking for libunwind
  422. AC_MSG_NOTICE([----------------------------------------])
  423. AC_MSG_CHECKING([for libunwind])
  424. AC_ARG_WITH([libunwind],
  425. [AC_HELP_STRING([--with-libunwind],
  426. [Include libunwind support for backtraces on assert failures]
  427. )],
  428. [WITH_LIBUNWIND=$withval],
  429. [WITH_LIBUNWIND=no]
  430. )
  431. AC_MSG_RESULT([$WITH_LIBUNWIND])
  432. if test "$WITH_LIBUNWIND" != no; then
  433. PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
  434. AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
  435. ])
  436. AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
  437. fi
  438. dnl Checking for kerberos5
  439. AC_MSG_NOTICE([----------------------------------------])
  440. AC_MSG_CHECKING([for kerberos5])
  441. AC_ARG_WITH([krb5],
  442. [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
  443. [WITH_KRB5=$withval],
  444. [WITH_KRB5=no]
  445. )
  446. AC_MSG_RESULT([$WITH_KRB5])
  447. if test "$WITH_KRB5" != no; then
  448. if test "$WITH_KRB5" != yes; then
  449. krb5_append_CPPFLAGS=" -I$WITH_KRB5/include"
  450. krb5_append_LDFLAGS=" -L$WITH_KRB5/lib"
  451. fi
  452. fi
  453. AC_MSG_CHECKING([custom include directory for kerberos5])
  454. AC_ARG_WITH([krb5-includes],
  455. [AC_HELP_STRING([--with-krb5-includes=DIR], [Kerberos includes])],
  456. [
  457. if test "$WITH_KRB5" = no; then
  458. AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
  459. fi
  460. krb5_append_CPPFLAGS=" -I$withval"
  461. AC_MSG_RESULT([$withval])
  462. ],
  463. [AC_MSG_RESULT([no])]
  464. )
  465. AC_MSG_CHECKING([custom lib directory for kerberos5])
  466. AC_ARG_WITH([krb5-libs],
  467. [AC_HELP_STRING([--with-krb5-libs=DIR], [Kerberos libraries])],
  468. [
  469. if test "$WITH_KRB5" = no; then
  470. AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
  471. fi
  472. krb5_append_LDFLAGS=" -L$withval"
  473. AC_MSG_RESULT([$withval])
  474. ],
  475. [AC_MSG_RESULT([no])]
  476. )
  477. if test "$WITH_KRB5" != no; then
  478. CPPFLAGS="${CPPFLAGS}${krb5_append_CPPFLAGS}"
  479. LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
  480. AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
  481. [AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
  482. [
  483. KRB5_LIB="-lkrb5 -lgssapi_krb5"
  484. AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
  485. ],
  486. [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
  487. )],
  488. [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
  489. )
  490. case "$host_os" in
  491. *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
  492. * ) ;;
  493. esac
  494. fi
  495. AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
  496. AC_SUBST([KRB5_LIB])
  497. dnl Check for openssl
  498. AC_MSG_NOTICE([----------------------------------------])
  499. AC_MSG_CHECKING([for OpenSSL])
  500. AC_ARG_WITH([openssl],
  501. [AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],
  502. [Include openssl support (default no)]
  503. )],
  504. [WITH_OPENSSL=$withval],
  505. [WITH_OPENSSL=no]
  506. )
  507. AC_MSG_RESULT([$WITH_OPENSSL])
  508. if test "$WITH_OPENSSL" != no; then
  509. if test "$WITH_OPENSSL" != yes; then
  510. openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
  511. openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
  512. fi
  513. fi
  514. AC_MSG_CHECKING([custom include directory for openssl])
  515. AC_ARG_WITH([openssl-includes],
  516. [AC_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
  517. [
  518. if test "$WITH_OPENSSL" = no; then
  519. AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
  520. fi
  521. openssl_append_CPPFLAGS=" -I$withval"
  522. AC_MSG_RESULT([$withval])
  523. ],
  524. [AC_MSG_RESULT([no])]
  525. )
  526. AC_MSG_CHECKING([custom lib directory for openssl])
  527. AC_ARG_WITH([openssl-libs],
  528. [AC_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
  529. [
  530. if test "$WITH_OPENSSL" = no; then
  531. AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
  532. fi
  533. openssl_append_LDFLAGS=" -L$withval"
  534. AC_MSG_RESULT([$withval])
  535. ],
  536. [AC_MSG_RESULT([no])]
  537. )
  538. AM_CONDITIONAL([BUILD_WITH_OPENSSL], [test "$WITH_OPENSSL" != no])
  539. if test "$WITH_OPENSSL" != no; then
  540. if test "$WITH_KRB5" != no; then
  541. AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
  542. fi
  543. CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
  544. LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
  545. AC_CHECK_HEADERS([openssl/ssl.h], [], [
  546. AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
  547. ])
  548. AC_CHECK_LIB([crypto], [BIO_f_base64],
  549. [CRYPTO_LIB="-lcrypto"],
  550. [AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
  551. )
  552. AC_CHECK_LIB([ssl], [SSL_new],
  553. [SSL_LIB="-lssl -lcrypto"],
  554. [AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
  555. [ -lcrypto "$DL_LIB" ]
  556. )
  557. AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
  558. AC_SUBST([SSL_LIB])
  559. AC_SUBST([CRYPTO_LIB])
  560. fi
  561. dnl pcre support
  562. AC_MSG_NOTICE([----------------------------------------])
  563. AC_MSG_CHECKING([for perl regular expressions support])
  564. AC_ARG_WITH([pcre],
  565. [AC_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
  566. [WITH_PCRE=$withval],
  567. [WITH_PCRE=yes]
  568. )
  569. AC_MSG_RESULT([$WITH_PCRE])
  570. if test "$WITH_PCRE" != no; then
  571. if test "$WITH_PCRE" != yes; then
  572. PCRE_LIB="-L$WITH_PCRE/lib -lpcre"
  573. CPPFLAGS="$CPPFLAGS -I$WITH_PCRE/include"
  574. else
  575. AC_PATH_PROG([PCRECONFIG], [pcre-config])
  576. if test -n "$PCRECONFIG"; then
  577. PCRE_LIB=`"$PCRECONFIG" --libs`
  578. CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
  579. fi
  580. fi
  581. if test -z "$PCRE_LIB"; then
  582. AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
  583. fi
  584. AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
  585. AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
  586. AC_SUBST([PCRE_LIB])
  587. fi
  588. dnl zlib
  589. AC_MSG_NOTICE([----------------------------------------])
  590. AC_MSG_CHECKING([for zlib support])
  591. AC_ARG_WITH([zlib],
  592. [AC_HELP_STRING([--with-zlib],
  593. [Enable zlib support for mod_compress]
  594. )],
  595. [WITH_ZLIB=$withval],
  596. [WITH_ZLIB=yes]
  597. )
  598. AC_MSG_RESULT([$WITH_ZLIB])
  599. if test "$WITH_ZLIB" != no; then
  600. if test "$WITH_ZLIB" != yes; then
  601. Z_LIB="-L$WITH_ZLIB -lz"
  602. CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
  603. else
  604. AC_CHECK_HEADERS([zlib.h], [],
  605. [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
  606. )
  607. AC_CHECK_LIB([z], [deflate],
  608. [Z_LIB=-lz],
  609. [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
  610. )
  611. fi
  612. AC_DEFINE([HAVE_LIBZ], [1], [libz])
  613. AC_DEFINE([HAVE_ZLIB_H], [1])
  614. AC_SUBST([Z_LIB])
  615. fi
  616. dnl bzip2
  617. AC_MSG_NOTICE([----------------------------------------])
  618. AC_MSG_CHECKING([for bzip2 support])
  619. AC_ARG_WITH([bzip2],
  620. [AC_HELP_STRING([--with-bzip2],
  621. [Enable bzip2 support for mod_compress]
  622. )],
  623. [WITH_BZIP2=$withval],
  624. [WITH_BZIP2=yes]
  625. )
  626. AC_MSG_RESULT([$WITH_BZIP2])
  627. if test "$WITH_BZIP2" != no; then
  628. if test "$WITH_BZIP2" != yes; then
  629. BZ_LIB="-L$WITH_BZIP2 -lbz2"
  630. CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
  631. else
  632. AC_CHECK_HEADERS([bzlib.h], [], [
  633. AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
  634. ])
  635. AC_CHECK_LIB([bz2], [BZ2_bzCompress],
  636. [BZ_LIB=-lbz2],
  637. [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
  638. )
  639. fi
  640. AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
  641. AC_DEFINE([HAVE_BZLIB_H], [1])
  642. AC_SUBST([BZ_LIB])
  643. fi
  644. dnl Check for fam/gamin
  645. AC_MSG_NOTICE([----------------------------------------])
  646. AC_MSG_CHECKING([for FAM])
  647. AC_ARG_WITH([fam],
  648. [AC_HELP_STRING([--with-fam],
  649. [fam/gamin for reducing number of stat() calls]
  650. )],
  651. [WITH_FAM=$withval],
  652. [WITH_FAM=no]
  653. )
  654. AC_MSG_RESULT([$WITH_FAM])
  655. if test "$WITH_FAM" != no; then
  656. if test "$WITH_FAM" != yes; then
  657. FAM_LIBS="-L$WITH_FAM -lfam"
  658. CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
  659. else
  660. AC_CHECK_LIB([fam], [FAMOpen2], [
  661. AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
  662. ])
  663. dnl fam has no pkg-config so far, so just search for gamin as fallback
  664. if test -z "$FAM_LIBS"; then
  665. PKG_CHECK_MODULES([FAM], [gamin >= 0.1.0])
  666. fi
  667. fi
  668. if test -z "$FAM_LIBS"; then
  669. AC_MSG_ERROR([fam/gamin headers and/or libs were not found, install them or build without --with-fam])
  670. fi
  671. OLD_LIBS=$LIBS
  672. LIBS=$FAM_LIBS
  673. AC_CHECK_FUNCS([FAMNoExists])
  674. LIBS=$OLD_LIBS
  675. AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
  676. AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
  677. AC_SUBST([FAM_LIBS])
  678. fi
  679. dnl webdav props (xml2 and sqlite3)
  680. AC_MSG_NOTICE([----------------------------------------])
  681. AC_MSG_CHECKING([for properties in mod_webdav])
  682. AC_ARG_WITH([webdav-props],
  683. [AC_HELP_STRING([--with-webdav-props], [properties in mod_webdav])],
  684. [WITH_WEBDAV_PROPS=$withval],
  685. [WITH_WEBDAV_PROPS=no]
  686. )
  687. AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
  688. if test "$WITH_WEBDAV_PROPS" != no; then
  689. AC_MSG_CHECKING([for libxml2])
  690. AC_ARG_WITH([libxml],
  691. [AC_HELP_STRING([--with-libxml],
  692. [libxml2 for properties in mod_webdav]
  693. )],
  694. [WITH_LIBXML=$withval],
  695. [WITH_LIBXML=yes]
  696. )
  697. AC_MSG_RESULT([$WITH_LIBXML])
  698. if test "$WITH_LIBXML" = no; then
  699. AC_MSG_ERROR([--with-webdav-props requires libxml])
  700. fi
  701. if test "$WITH_LIBXML" != yes; then
  702. XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
  703. XML_CFLAGS="-I$WITH_LIBXML/include"
  704. else
  705. PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
  706. AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
  707. ])
  708. fi
  709. AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
  710. AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
  711. AC_SUBST([XML_LIBS])
  712. AC_SUBST([XML_CFLAGS])
  713. AC_MSG_CHECKING([for sqlite])
  714. AC_ARG_WITH([sqlite],
  715. [AC_HELP_STRING([--with-sqlite],
  716. [sqlite for properties in mod_webdav]
  717. )],
  718. [WITH_SQLITE=$withval],
  719. [WITH_SQLITE=yes]
  720. )
  721. AC_MSG_RESULT([$WITH_SQLITE])
  722. if test "$WITH_SQLITE" = no; then
  723. AC_MSG_ERROR([--with-webdav-props requires sqlite])
  724. fi
  725. if test "$WITH_SQLITE" != yes; then
  726. SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
  727. SQLITE_CFLAGS="-I$WITH_SQLITE"
  728. else
  729. PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
  730. AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
  731. ])
  732. fi
  733. AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
  734. AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
  735. AC_SUBST([SQLITE_LIBS])
  736. AC_SUBST([SQLITE_CFLAGS])
  737. fi
  738. dnl webdav locks (uuid)
  739. AC_MSG_NOTICE([----------------------------------------])
  740. AC_MSG_CHECKING([for locks in mod_webdav])
  741. AC_ARG_WITH([webdav-locks],
  742. [AC_HELP_STRING([--with-webdav-locks],
  743. [locks in mod_webdav (requires webdav properties)]
  744. )],
  745. [WITH_WEBDAV_LOCKS=$withval],
  746. [WITH_WEBDAV_LOCKS=no]
  747. )
  748. AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
  749. if test "$WITH_WEBDAV_LOCKS" != no; then
  750. if test "$WITH_WEBDAV_PROPS" = no; then
  751. AC_MSG_ERROR([--with-webdav-locks requires --with-webdav-props])
  752. fi
  753. AC_MSG_CHECKING([for libuuid])
  754. AC_ARG_WITH([uuid],
  755. [AC_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
  756. [WITH_UUID=$withval],
  757. [WITH_UUID=yes]
  758. )
  759. AC_MSG_RESULT([$WITH_UUID])
  760. if test "$WITH_UUID" = no; then
  761. AC_MSG_ERROR([--with-webdav-locks requires uuid])
  762. fi
  763. if test "$WITH_UUID" != yes; then
  764. UUID_LIBS="-L$WITH_UUID -luuid"
  765. CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
  766. else
  767. AC_CHECK_LIB([uuid], [uuid_unparse],
  768. [UUID_LIBS=-luuid],
  769. [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
  770. )
  771. AC_CHECK_HEADERS([uuid/uuid.h], [],
  772. [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
  773. )
  774. fi
  775. AC_DEFINE([HAVE_UUID], [1], [libuuid])
  776. AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
  777. AC_SUBST([UUID_LIBS])
  778. fi
  779. dnl Check for gdbm
  780. AC_MSG_NOTICE([----------------------------------------])
  781. AC_MSG_CHECKING([for gdbm])
  782. AC_ARG_WITH([gdbm],
  783. [AC_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
  784. [WITH_GDBM=$withval],
  785. [WITH_GDBM=no]
  786. )
  787. AC_MSG_RESULT([$WITH_GDBM])
  788. if test "$WITH_GDBM" != no; then
  789. if test "$WITH_GDBM" != yes; then
  790. GDBM_LIB="-L$WITH_GDBM -lgdbm"
  791. CPPFLAGS="$CPPFLAGS -I$WITH_GDBM"
  792. else
  793. AC_CHECK_LIB([gdbm], [gdbm_open],
  794. [GDBM_LIB=-lgdbm],
  795. [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
  796. )
  797. AC_CHECK_HEADERS([gdbm.h], [],
  798. [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
  799. )
  800. fi
  801. AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
  802. AC_DEFINE([HAVE_GDBM_H], [1])
  803. AC_SUBST([GDBM_LIB])
  804. fi
  805. AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
  806. dnl Check for GeoIP
  807. AC_MSG_NOTICE([----------------------------------------])
  808. AC_MSG_CHECKING([for GeoIP])
  809. AC_ARG_WITH([geoip],
  810. [AC_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
  811. [WITH_GEOIP=$withval],
  812. [WITH_GEOIP=no]
  813. )
  814. AC_MSG_RESULT([$WITH_GEOIP])
  815. if test "$WITH_GEOIP" != no; then
  816. if test "$WITH_GEOIP" != yes; then
  817. GEOIP_LIB="-L$WITH_GEOIP -lGeoIP"
  818. CPPFLAGS="$CPPFLAGS -I$WITH_GEOIP"
  819. else
  820. AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
  821. [GEOIP_LIB=-lGeoIP],
  822. [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
  823. )
  824. AC_CHECK_HEADERS([GeoIP.h], [],
  825. [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
  826. )
  827. fi
  828. AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
  829. AC_DEFINE([HAVE_GEOIP_H], [1])
  830. AC_SUBST([GEOIP_LIB])
  831. fi
  832. AM_CONDITIONAL([BUILD_WITH_GEOIP], [test "$WITH_GEOIP" != no])
  833. dnl Check for memcached
  834. AC_MSG_NOTICE([----------------------------------------])
  835. AC_MSG_CHECKING([for memcached])
  836. AC_ARG_WITH([memcached],
  837. [AC_HELP_STRING([--with-memcached],
  838. [memcached storage for mod_trigger_b4_dl/mod_cml]
  839. )],
  840. [WITH_MEMCACHED=$withval],
  841. [WITH_MEMCACHED=no]
  842. )
  843. AC_MSG_RESULT([$WITH_MEMCACHED])
  844. if test "$WITH_MEMCACHED" != no; then
  845. if test "$WITH_MEMCACHED" != yes; then
  846. MEMCACHED_LIB="-L$WITH_MEMCACHED -lMEMCACHED"
  847. CPPFLAGS="$CPPFLAGS -I$WITH_MEMCACHED"
  848. else
  849. AC_CHECK_LIB([memcached], [memcached],
  850. [ MEMCACHED_LIB=-lmemcached ],
  851. [AC_MSG_ERROR([memcached lib not found, install it or build without --with-memcached])]
  852. )
  853. AC_CHECK_HEADERS([libmemcached/memcached.h], [],
  854. [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
  855. )
  856. fi
  857. AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
  858. AC_SUBST([MEMCACHED_LIB])
  859. fi
  860. AM_CONDITIONAL([BUILD_WITH_MEMCACHED], [test "$WITH_MEMCACHED" != no])
  861. BUILD_MOD_TRIGGER_B4_DL=no
  862. if test "$WITH_MEMCACHED" != no || test "$WITH_GDBM" != no ; then
  863. BUILD_MOD_TRIGGER_B4_DL=yes
  864. fi
  865. AM_CONDITIONAL([BUILD_MOD_TRIGGER_B4_DL], [test "$BUILD_MOD_TRIGGER_B4_DL" != no])
  866. dnl Check for lua
  867. AC_MSG_NOTICE([----------------------------------------])
  868. AC_MSG_CHECKING([if lua-support is requested])
  869. AC_ARG_WITH([lua],
  870. [AC_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
  871. [WITH_LUA=$withval],
  872. [WITH_LUA=no]
  873. )
  874. AC_MSG_RESULT([$WITH_LUA])
  875. if test "$WITH_LUA" != no; then
  876. found_lua=0
  877. if test "$WITH_LUA" != yes; then
  878. PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
  879. [found_lua=1],
  880. [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
  881. )
  882. if test "$found_lua" = "0"; then
  883. LUA_LIBS="-L$WITH_LUA -llua"
  884. LUA_CFLAGS="-I$WITH_LUA"
  885. fi
  886. else
  887. for luaname in lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua; do
  888. if test "$found_lua" = "0"; then
  889. PKG_CHECK_MODULES([LUA], [$luaname >= 5.1],
  890. [found_lua=1],
  891. [AC_MSG_NOTICE([Couldn\'t find $luaname])]
  892. )
  893. fi
  894. done
  895. if test "$found_lua" = "0"; then
  896. AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
  897. fi
  898. fi
  899. AC_DEFINE([HAVE_LUA], [1], [liblua])
  900. AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
  901. AC_SUBST([LUA_LIBS])
  902. AC_SUBST([LUA_CFLAGS])
  903. fi
  904. AM_CONDITIONAL([BUILD_WITH_LUA], [test "$WITH_LUA" != no])
  905. dnl "--with-FEATURE" blocks end
  906. AC_MSG_NOTICE([----------------------------------------])
  907. dnl search for crypt_r and (fallback) for crypt
  908. save_LIBS=$LIBS
  909. LIBS=
  910. found_crypt=no
  911. AC_SEARCH_LIBS([crypt_r], [crypt],
  912. [
  913. AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
  914. AC_CHECK_HEADERS([crypt.h])
  915. CRYPT_LIB=$LIBS
  916. found_crypt=crypt_r
  917. ],
  918. [AC_SEARCH_LIBS([crypt], [crypt], [
  919. AC_DEFINE([HAVE_CRYPT], [1], [crypt])
  920. AC_CHECK_HEADERS([crypt.h])
  921. CRYPT_LIB=$LIBS
  922. found_crypt=crypt
  923. ])]
  924. )
  925. LIBS=$save_LIBS
  926. AC_SUBST([CRYPT_LIB])
  927. AC_MSG_CHECKING([crypt_r/crypt support])
  928. AC_MSG_RESULT([$found_crypt])
  929. dnl check whether sendfilev needs -lsendfile
  930. AC_MSG_NOTICE([----------------------------------------])
  931. save_LIBS=$LIBS
  932. LIBS=
  933. have_sendfilev=no
  934. AC_SEARCH_LIBS([sendfilev], [sendfile], [
  935. if test -z "$LIBS"; then
  936. have_sendfilev=yes
  937. else
  938. have_sendfilev=$LIBS
  939. fi
  940. SENDFILE_LIB=$LIBS
  941. AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
  942. ])
  943. LIBS=$save_LIBS
  944. AC_SUBST([SENDFILE_LIB])
  945. AC_MSG_CHECKING([solaris sendfilev present])
  946. AC_MSG_RESULT([$have_sendfilev])
  947. AC_MSG_NOTICE([----------------------------------------])
  948. case "$host_os" in
  949. *mingw* ) LIBS="$LIBS -lwsock32" ;;
  950. * ) ;;
  951. esac
  952. AC_CHECK_FUNCS([\
  953. arc4random_buf \
  954. chroot \
  955. clock_gettime \
  956. epoll_ctl \
  957. explicit_bzero \
  958. fork \
  959. getloadavg \
  960. getrlimit \
  961. getuid \
  962. gmtime_r \
  963. inet_pton \
  964. issetugid \
  965. jrand48 \
  966. kqueue \
  967. localtime_r \
  968. lstat \
  969. madvise \
  970. memset \
  971. memset_s \
  972. mmap \
  973. pathconf \
  974. pipe2 \
  975. poll \
  976. port_create \
  977. select \
  978. send_file \
  979. sendfile \
  980. sendfile64 \
  981. sigaction \
  982. signal \
  983. srandom \
  984. writev \
  985. ])
  986. AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
  987. AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
  988. AC_MSG_NOTICE([----------------------------------------])
  989. AC_MSG_CHECKING([if weak symbols are supported])
  990. AC_LINK_IFELSE(
  991. [AC_LANG_PROGRAM([[
  992. __attribute__((weak)) void __dummy(void *x) { }
  993. void f(void *x) { __dummy(x); }
  994. ]])],
  995. [
  996. AC_MSG_RESULT([yes])
  997. AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
  998. ],
  999. [AC_MSG_RESULT([no])]
  1000. )
  1001. AC_MSG_NOTICE([----------------------------------------])
  1002. AC_MSG_CHECKING([for Large File System support])
  1003. AC_ARG_ENABLE([lfs],
  1004. [AC_HELP_STRING([--enable-lfs],
  1005. [Turn on Large File System (default)]
  1006. )],
  1007. [
  1008. case "${enableval}" in
  1009. yes) ENABLE_LFS=yes ;;
  1010. no) ENABLE_LFS=no ;;
  1011. *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
  1012. esac
  1013. ],
  1014. [ ENABLE_LFS=yes ]
  1015. )
  1016. AC_MSG_RESULT([$ENABLE_LFS])
  1017. if test "$ENABLE_LFS" = yes; then
  1018. CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
  1019. fi
  1020. dnl check if sendfile works
  1021. if test "$ac_cv_func_sendfile" = yes; then
  1022. AC_MSG_NOTICE([----------------------------------------])
  1023. AC_MSG_CHECKING([if sendfile works])
  1024. if test "$cross_compiling" = no; then
  1025. AC_TRY_RUN(
  1026. [
  1027. #ifdef HAVE_SYS_SENDFILE_H
  1028. #include <sys/sendfile.h>
  1029. #endif /* HAVE_SYS_SENDFILE_H */
  1030. #include <errno.h>
  1031. int main() {
  1032. int o = 0;
  1033. if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
  1034. return 0;
  1035. }
  1036. ],
  1037. [AC_MSG_RESULT([yes])],
  1038. [
  1039. AC_MSG_RESULT([no])
  1040. AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
  1041. ]
  1042. )
  1043. fi
  1044. fi
  1045. dnl Check for IPv6 support
  1046. AC_MSG_NOTICE([----------------------------------------])
  1047. AC_ARG_ENABLE([ipv6],
  1048. [AC_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
  1049. [
  1050. case "${enableval}" in
  1051. yes) ipv6=true ;;
  1052. no) ipv6=false ;;
  1053. *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
  1054. esac
  1055. ],
  1056. [ipv6=true]
  1057. )
  1058. if test "$ipv6" = true; then
  1059. AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
  1060. AC_TRY_LINK(
  1061. [
  1062. #include <sys/types.h>
  1063. #include <sys/socket.h>
  1064. #include <netinet/in.h>
  1065. ],
  1066. [
  1067. struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
  1068. ],
  1069. [ac_cv_ipv6_support=yes],
  1070. [ac_cv_ipv6_support=no]
  1071. )
  1072. ])
  1073. if test "$ac_cv_ipv6_support" = yes; then
  1074. AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
  1075. else
  1076. AC_MSG_ERROR([IPv6 seems broken. Fix it or build with --disable-ipv6])
  1077. fi
  1078. fi
  1079. # disable mmap by default
  1080. # lighttpd may always use mmap with files it owns (created tmp files)
  1081. AC_MSG_NOTICE([----------------------------------------])
  1082. AC_MSG_CHECKING([use mmap if available])
  1083. AC_ARG_ENABLE([mmap],
  1084. [AC_HELP_STRING([--enable-mmap],
  1085. [use mmap if available]
  1086. )],
  1087. [
  1088. case "${enableval}" in
  1089. yes) mmap=true ;;
  1090. no) mmap=false ;;
  1091. *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
  1092. esac
  1093. ],
  1094. [mmap=false]
  1095. )
  1096. AC_MSG_RESULT([$mmap])
  1097. if test "$mmap" = true; then
  1098. AC_DEFINE([ENABLE_MMAP], [1], [Use mmap if available])
  1099. fi
  1100. dnl check for fastcgi lib, for the tests only
  1101. AC_MSG_NOTICE([----------------------------------------])
  1102. fastcgi_found=no
  1103. AC_CHECK_LIB([fcgi], [FCGI_Accept], [
  1104. AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
  1105. fastcgi_found=yes
  1106. ])
  1107. ])
  1108. AM_CONDITIONAL([CHECK_WITH_FASTCGI], [test "$fastcgi_found" = yes])
  1109. AC_MSG_NOTICE([----------------------------------------])
  1110. dnl check for extra compiler options (warning options)
  1111. if test "${GCC}" = yes; then
  1112. TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
  1113. fi
  1114. AC_ARG_ENABLE([extra-warnings],
  1115. [AC_HELP_STRING([--enable-extra-warnings],
  1116. [enable extra warnings (gcc specific)]
  1117. )],
  1118. [
  1119. case "${enableval}" in
  1120. error) extrawarnings=error ;;
  1121. yes) extrawarnings=true ;;
  1122. no) extrawarnings=false ;;
  1123. *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
  1124. esac
  1125. ],
  1126. [extrawarnings=false]
  1127. )
  1128. if test "$extrawarnings" = true || test "$extrawarnings" = error; then
  1129. 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])
  1130. TRY_LDFLAGS([-Wl,--as-needed])
  1131. if test "$extrawarnings" = error; then
  1132. AS_VAR_APPEND([CFLAGS], [" -Werror"])
  1133. AS_VAR_APPEND([LDFLAGS], [" -Wl,--fatal-warnings"])
  1134. fi
  1135. fi
  1136. dnl build version-id
  1137. LIGHTTPD_VERSION_ID=m4_format([0x%x%02x%02x], m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))
  1138. AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
  1139. AC_CONFIG_FILES([\
  1140. distribute.sh \
  1141. doc/config/conf.d/Makefile \
  1142. doc/config/Makefile \
  1143. doc/config/vhosts.d/Makefile \
  1144. doc/Makefile \
  1145. doc/outdated/Makefile \
  1146. doc/scripts/Makefile \
  1147. doc/systemd/Makefile \
  1148. Makefile \
  1149. src/Makefile \
  1150. tests/docroot/123/Makefile \
  1151. tests/docroot/Makefile \
  1152. tests/docroot/www/expire/Makefile \
  1153. tests/docroot/www/go/Makefile \
  1154. tests/docroot/www/indexfile/Makefile \
  1155. tests/docroot/www/Makefile \
  1156. tests/Makefile \
  1157. ])
  1158. AC_OUTPUT
  1159. do_build="\
  1160. mod_access \
  1161. mod_accesslog \
  1162. mod_alias \
  1163. mod_auth \
  1164. mod_authn_file \
  1165. mod_cgi \
  1166. mod_compress \
  1167. mod_deflate \
  1168. mod_dirlisting \
  1169. mod_evhost \
  1170. mod_expire \
  1171. mod_extforward \
  1172. mod_fastcgi \
  1173. mod_flv_streaming \
  1174. mod_indexfile \
  1175. mod_proxy \
  1176. mod_redirect \
  1177. mod_rewrite \
  1178. mod_rrdtool \
  1179. mod_scgi \
  1180. mod_secdownload \
  1181. mod_setenv \
  1182. mod_simple_vhost \
  1183. mod_ssi \
  1184. mod_staticfile \
  1185. mod_status \
  1186. mod_userdir \
  1187. mod_usertrack \
  1188. mod_vhostdb \
  1189. mod_webdav \
  1190. mod_wstunnel \
  1191. "
  1192. lighty_track_feature() {
  1193. if eval "$3"; then
  1194. enable_feature="$enable_feature $1"
  1195. do_build="$do_build $2"
  1196. else
  1197. disable_feature="$disable_feature $1"
  1198. no_build="$no_build $2"
  1199. fi
  1200. }
  1201. lighty_track_feature "regex-conditionals" "" \
  1202. 'test "$WITH_PCRE" != no'
  1203. lighty_track_feature "storage-gdbm" "" \
  1204. 'test "$WITH_GDBM" != no'
  1205. lighty_track_feature "storage-memcached" "" \
  1206. 'test "$WITH_MEMCACHED" != no'
  1207. lighty_track_feature "" "mod_trigger_b4_dl" \
  1208. 'test "$BUILD_MOD_TRIGGER_B4_DL" != no'
  1209. lighty_track_feature "mysql" "mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql" \
  1210. 'test "$WITH_MYSQL" != no'
  1211. lighty_track_feature "postgresql" "mod_vhostdb_pgsql" \
  1212. 'test "$WITH_PGSQL" != no'
  1213. lighty_track_feature "dbi" "mod_vhostdb_dbi" \
  1214. 'test "$WITH_DBI" != no'
  1215. lighty_track_feature "lua" "mod_cml mod_magnet" \
  1216. 'test "$WITH_LUA" != no'
  1217. lighty_track_feature "geoip" "mod_geoip" \
  1218. 'test "$WITH_GEOIP" != no'
  1219. lighty_track_feature "compress-gzip compress-deflate" "" \
  1220. 'test "$WITH_ZLIB" != no'
  1221. lighty_track_feature "compress-bzip2" "" \
  1222. 'test "$WITH_BZIP2" != no'
  1223. lighty_track_feature "kerberos" "mod_authn_gssapi" \
  1224. 'test "$WITH_KRB5" != no'
  1225. lighty_track_feature "ldap" "mod_authn_ldap mod_vhostdb_ldap" \
  1226. 'test "$WITH_LDAP" != no'
  1227. lighty_track_feature "network-openssl" "mod_openssl" \
  1228. 'test "$WITH_OPENSSL" != no'
  1229. lighty_track_feature "auth-crypt" "" \
  1230. 'test "$found_crypt" != no'
  1231. lighty_track_feature "network-ipv6" "" \
  1232. 'test "$ac_cv_ipv6_support" != no'
  1233. lighty_track_feature "large-files" "" \
  1234. 'test "$ENABLE_LFS" = yes'
  1235. lighty_track_feature "stat-cache-fam" "" \
  1236. 'test "$WITH_FAM" != no'
  1237. lighty_track_feature "webdav-properties" "" \
  1238. 'test "$WITH_WEBDAV_PROPS" != no'
  1239. lighty_track_feature "webdav-locks" "" \
  1240. 'test "$WITH_WEBDAV_LOCKS" != no'
  1241. dnl output
  1242. $ECHO
  1243. $ECHO "Plugins:"
  1244. $ECHO
  1245. $ECHO "enabled: "
  1246. for p in $do_build; do
  1247. $ECHO " $p"
  1248. done | sort
  1249. $ECHO "disabled: "
  1250. for p in $no_build; do
  1251. $ECHO " $p"
  1252. done | sort
  1253. $ECHO
  1254. $ECHO "Features:"
  1255. $ECHO
  1256. $ECHO "enabled: "
  1257. for p in $enable_feature; do
  1258. $ECHO " $p"
  1259. done | sort
  1260. $ECHO "disabled: "
  1261. for p in $disable_feature; do
  1262. $ECHO " $p"
  1263. done | sort
  1264. $ECHO