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.

1876 lines
49 KiB

6 months ago
  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.60], [https://redmine.lighttpd.net/projects/lighttpd/boards/2], [lighttpd], [https://www.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 subdir-objects])
  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. LT_PATH_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. LT_INIT([dlopen disable-static shared])
  77. dnl for solaris
  78. CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
  79. dnl Checks for header files.
  80. dnl check for:
  81. dnl inttypes.h => HAVE_INTTYPES_H
  82. dnl stdint.h => HAVE_STDINT_H
  83. dnl and maybe more (which shouldn't be relied on)
  84. AC_HEADER_STDC
  85. dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
  86. AC_HEADER_SYS_WAIT
  87. AC_CHECK_HEADERS([\
  88. getopt.h \
  89. poll.h \
  90. port.h \
  91. pwd.h \
  92. stdlib.h \
  93. strings.h \
  94. sys/devpoll.h \
  95. sys/epoll.h \
  96. sys/event.h \
  97. sys/filio.h \
  98. sys/inotify.h \
  99. sys/loadavg.h \
  100. sys/mman.h \
  101. sys/poll.h \
  102. sys/prctl.h \
  103. sys/resource.h \
  104. sys/select.h \
  105. sys/sendfile.h \
  106. sys/time.h \
  107. sys/uio.h \
  108. sys/un.h \
  109. syslog.h \
  110. uuid/uuid.h \
  111. ])
  112. dnl Checks for typedefs, structures, and compiler characteristics.
  113. AC_C_CONST
  114. AC_C_INLINE
  115. AC_TYPE_OFF_T
  116. AC_TYPE_PID_T
  117. AC_TYPE_SIZE_T
  118. AC_CHECK_MEMBER([struct tm.tm_gmtoff],
  119. [AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
  120. [],
  121. [#include <time.h>]
  122. )
  123. AC_CHECK_TYPES([socklen_t],
  124. [], dnl defines HAVE_SOCKLEN_T
  125. [],
  126. [
  127. #include <sys/types.h>
  128. #include <sys/socket.h>
  129. ]
  130. )
  131. dnl openssl on solaris needs -lsocket -lnsl
  132. AC_SEARCH_LIBS([socket], [socket])
  133. AC_SEARCH_LIBS([gethostbyname], [nsl socket])
  134. dnl On Haiku accept() and friends are in libnetwork
  135. AC_SEARCH_LIBS([accept], [network])
  136. dnl clock_gettime() needs -lrt with glibc < 2.17, and possibly other platforms
  137. AC_SEARCH_LIBS([clock_gettime], [rt])
  138. dnl FreeBSD elftc_copyfile()
  139. save_LIBS=$LIBS
  140. LIBS=
  141. AC_SEARCH_LIBS([elftc_copyfile], [elftc], [
  142. AC_CHECK_HEADERS([libelftc.h], [
  143. ELFTC_LIB=$LIBS
  144. AC_DEFINE([HAVE_LIBELFTC], [1], [libelftc])
  145. AC_DEFINE([HAVE_ELFTC_COPYFILE], [1], [elftc_copyfile])
  146. ])
  147. ])
  148. LIBS=$save_LIBS
  149. AC_SUBST([ELFTC_LIB])
  150. dnl need dlopen/-ldl to load plugins (when not on windows)
  151. save_LIBS=$LIBS
  152. LIBS=
  153. AC_SEARCH_LIBS([dlopen], [dl], [
  154. AC_CHECK_HEADERS([dlfcn.h], [
  155. DL_LIB=$LIBS
  156. AC_DEFINE([HAVE_LIBDL], [1], [libdl])
  157. AC_DEFINE([HAVE_DLFCN_H], [1])
  158. ])
  159. ])
  160. LIBS=$save_LIBS
  161. AC_SUBST([DL_LIB])
  162. dnl prepare pkg-config usage below
  163. PKG_PROG_PKG_CONFIG
  164. dnl checking for libev
  165. AC_MSG_NOTICE([----------------------------------------])
  166. AC_MSG_CHECKING([for libev support])
  167. AC_ARG_WITH([libev],
  168. [AS_HELP_STRING([--with-libev@<:@=PATH@:>@],
  169. [Include libev support for fdevent handlers in PATH/include and PATH/lib]
  170. )],
  171. [WITH_LIBEV=$withval],
  172. [WITH_LIBEV=no]
  173. )
  174. AC_MSG_RESULT([$WITH_LIBEV])
  175. LIBEV_CFLAGS=
  176. LIBEV_LIBS=
  177. if test "$WITH_LIBEV" != no; then
  178. PKG_CHECK_MODULES([LIBEV], [libev], [], [
  179. dnl no pkg-config for libev, searching manually:
  180. if test "$WITH_LIBEV" != yes; then
  181. LIBEV_CFLAGS="-I$WITH_LIBEV/include"
  182. LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
  183. else
  184. AC_CHECK_HEADERS([ev.h],
  185. [AC_CHECK_LIB([ev], [ev_time],
  186. [
  187. LIBEV_CFLAGS=
  188. LIBEV_LIBS="-lev"
  189. ],
  190. [AC_MSG_ERROR([libev not found])]
  191. )],
  192. [AC_MSG_ERROR([libev header not found])]
  193. )
  194. fi
  195. ])
  196. AC_DEFINE([HAVE_LIBEV], [1], [libev support])
  197. fi
  198. AC_SUBST([LIBEV_CFLAGS])
  199. AC_SUBST([LIBEV_LIBS])
  200. dnl Checks for mysql
  201. AC_MSG_NOTICE([----------------------------------------])
  202. AC_MSG_CHECKING([for MySQL support])
  203. AC_ARG_WITH([mysql],
  204. [AS_HELP_STRING([--with-mysql@<:@=PATH@:>@],
  205. [Include MySQL support. PATH is the path to 'mysql_config']
  206. )],
  207. [WITH_MYSQL=$withval],
  208. [WITH_MYSQL=no]
  209. )
  210. AC_MSG_RESULT([$WITH_MYSQL])
  211. MYSQL_CFLAGS=
  212. MYSQL_LIBS=
  213. if test "$WITH_MYSQL" != no; then
  214. if test "$WITH_MYSQL" = yes; then
  215. PKG_CHECK_MODULES([MYSQL],[mariadb],[
  216. MYSQL_CONFIG=$PKG_CONFIG
  217. ],[
  218. PKG_CHECK_MODULES([MYSQL],[mysqlclient],[
  219. MYSQL_CONFIG=$PKG_CONFIG
  220. ],[
  221. AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
  222. ])
  223. ])
  224. else
  225. MYSQL_CONFIG=$WITH_MYSQL
  226. fi
  227. if test "$MYSQL_CONFIG" != "$PKG_CONFIG"; then
  228. if test -z "$MYSQL_CONFIG"; then
  229. AC_MSG_ERROR([mysql_config is not found])
  230. fi
  231. if test ! -x "$MYSQL_CONFIG"; then
  232. AC_MSG_ERROR([mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config])
  233. fi
  234. if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
  235. MYSQL_CFLAGS=`"$MYSQL_CONFIG" --include | sed s/\'//g`
  236. else
  237. MYSQL_CFLAGS=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
  238. fi
  239. MYSQL_LIBS=`"$MYSQL_CONFIG" --libs | sed s/\'//g`
  240. fi
  241. AC_MSG_CHECKING([for MySQL includes at])
  242. AC_MSG_RESULT([$MYSQL_CFLAGS])
  243. AC_MSG_CHECKING([for MySQL libraries at])
  244. AC_MSG_RESULT([$MYSQL_LIBS])
  245. AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
  246. fi
  247. AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
  248. AC_SUBST([MYSQL_LIBS])
  249. AC_SUBST([MYSQL_CFLAGS])
  250. dnl Checks for pgsql
  251. AC_MSG_NOTICE([----------------------------------------])
  252. AC_MSG_CHECKING([for PgSQL support])
  253. AC_ARG_WITH([pgsql],
  254. [AS_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
  255. [Include PgSQL support. PATH is the path to 'pg_config']
  256. )],
  257. [WITH_PGSQL=$withval],
  258. [WITH_PGSQL=no]
  259. )
  260. AC_MSG_RESULT([$WITH_PGSQL])
  261. PGSQL_CFLAGS=
  262. PGSQL_LIBS=
  263. if test "$WITH_PGSQL" != no; then
  264. if test "$WITH_PGSQL" = yes; then
  265. PKG_CHECK_MODULES([PGSQL],[libpq],[
  266. PGSQL_CONFIG=$PKG_CONFIG
  267. ],[
  268. AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
  269. ])
  270. else
  271. PGSQL_CONFIG=$WITH_PGSQL
  272. fi
  273. if test "$PGSQL_CONFIG" != "$PKG_CONFIG"; then
  274. if test -z "$PGSQL_CONFIG"; then
  275. AC_MSG_ERROR([pg_config is not found])
  276. fi
  277. if test ! -x "$PGSQL_CONFIG"; then
  278. AC_MSG_ERROR([pg_config not exists or not executable, use --with-pgsql=path-to-pg_config])
  279. fi
  280. PGSQL_CFLAGS="-I`"$PGSQL_CONFIG" --includedir`"
  281. PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
  282. fi
  283. AC_MSG_CHECKING([for PgSQL includes at])
  284. AC_MSG_RESULT([$PGSQL_CFLAGS])
  285. AC_MSG_CHECKING([for PgSQL libraries at])
  286. AC_MSG_RESULT([$PGSQL_LIBS])
  287. AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
  288. fi
  289. AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
  290. AC_SUBST([PGSQL_LIBS])
  291. AC_SUBST([PGSQL_CFLAGS])
  292. dnl Checks for libdbi library
  293. AC_MSG_NOTICE([----------------------------------------])
  294. AC_MSG_CHECKING([for LibDBI support])
  295. AC_ARG_WITH([dbi],
  296. [AS_HELP_STRING([--with-dbi@<:@=PATH@:>@],
  297. [Include DBI support in PATH/include/dbi.h and PATH/lib]
  298. )],
  299. [WITH_DBI=$withval],
  300. [WITH_DBI=no]
  301. )
  302. AC_MSG_RESULT([$WITH_DBI])
  303. DBI_INCLUDE=
  304. DBI_LIBS=
  305. if test "$WITH_DBI" != no; then
  306. if test "$WITH_DBI" != yes; then
  307. DBI_CFLAGS="-I$WITH_DBI/include"
  308. DBI_LIBS="-L$WITH_DBI/lib -ldbi"
  309. else
  310. AC_CHECK_HEADERS([dbi/dbi.h],
  311. [AC_CHECK_LIB([dbi], [dbi_version],
  312. [
  313. DBI_CFLAGS=
  314. DBI_LIBS="-ldbi"
  315. ],
  316. [AC_MSG_ERROR([LibDBI not found])]
  317. )],
  318. [AC_MSG_ERROR([LibDBI header not found])]
  319. )
  320. fi
  321. AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
  322. fi
  323. AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
  324. AC_SUBST([DBI_LIBS])
  325. AC_SUBST([DBI_CFLAGS])
  326. dnl Checks for libsasl2 library
  327. AC_MSG_NOTICE([----------------------------------------])
  328. AC_MSG_CHECKING([for LibSASL support])
  329. AC_ARG_WITH([sasl],
  330. [AS_HELP_STRING([--with-sasl@<:@=PATH@:>@],
  331. [Include SASL support in PATH/include/sasl/sasl.h and PATH/lib]
  332. )],
  333. [WITH_SASL=$withval],
  334. [WITH_SASL=no]
  335. )
  336. AC_MSG_RESULT([$WITH_SASL])
  337. SASL_INCLUDE=
  338. SASL_LIBS=
  339. if test "$WITH_SASL" != no; then
  340. if test "$WITH_SASL" != yes; then
  341. SASL_CFLAGS="-I$WITH_SASL/include"
  342. SASL_LIBS="-L$WITH_SASL/lib -lsasl2"
  343. else
  344. AC_CHECK_HEADERS([sasl/sasl.h],
  345. [AC_CHECK_LIB([sasl2], [sasl_server_init],
  346. [
  347. SASL_CFLAGS=
  348. SASL_LIBS="-lsasl2"
  349. ],
  350. [AC_MSG_ERROR([libsasl2 not found])]
  351. )],
  352. [AC_MSG_ERROR([SASL header not found])]
  353. )
  354. fi
  355. AC_DEFINE([HAVE_SASL], [1], [LibSASL support])
  356. fi
  357. AM_CONDITIONAL([BUILD_WITH_SASL], [test "$WITH_SASL" != no])
  358. AC_SUBST([SASL_LIBS])
  359. AC_SUBST([SASL_CFLAGS])
  360. dnl Check for LDAP
  361. AC_MSG_NOTICE([----------------------------------------])
  362. AC_MSG_CHECKING([for LDAP support])
  363. AC_ARG_WITH([ldap],
  364. [AS_HELP_STRING([--with-ldap], [enable LDAP support])],
  365. [WITH_LDAP=$withval],
  366. [WITH_LDAP=no]
  367. )
  368. AC_MSG_RESULT([$WITH_LDAP])
  369. if test "$WITH_LDAP" != no; then
  370. AC_CHECK_LIB([ldap], [ldap_sasl_bind_s],
  371. [AC_CHECK_HEADERS([ldap.h],
  372. [
  373. LDAP_LIB=-lldap
  374. AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
  375. AC_DEFINE([HAVE_LDAP_H], [1])
  376. ],
  377. [AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
  378. )],
  379. [AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
  380. )
  381. AC_SUBST([LDAP_LIB])
  382. AC_CHECK_LIB([lber], [ber_printf],
  383. [AC_CHECK_HEADERS([lber.h],
  384. [
  385. LBER_LIB=-llber
  386. AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
  387. AC_DEFINE([HAVE_LBER_H], [1])
  388. ],
  389. [AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
  390. )],
  391. [AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
  392. )
  393. AC_SUBST([LBER_LIB])
  394. fi
  395. AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
  396. dnl Check for PAM
  397. AC_MSG_NOTICE([----------------------------------------])
  398. AC_MSG_CHECKING(for PAM support)
  399. AC_ARG_WITH([pam],
  400. [AS_HELP_STRING([--with-pam],[enable PAM support])],
  401. [WITH_PAM=$withval],
  402. [WITH_PAM=no]
  403. )
  404. AC_MSG_RESULT([$withval])
  405. if test "$WITH_PAM" != "no"; then
  406. AC_CHECK_LIB([pam], [pam_start],
  407. [AC_CHECK_HEADERS([security/pam_appl.h],[
  408. PAM_LIB=-lpam
  409. AC_DEFINE([HAVE_PAM], [1], [libpam])
  410. AC_DEFINE([HAVE_SECURITY_PAM_APPL_H], [1])
  411. ],
  412. [AC_MSG_ERROR([pam headers not found, install them or build without --with-pam])]
  413. )],
  414. [AC_MSG_ERROR([pam library not found, install it or build without --with-pam])]
  415. )
  416. AC_SUBST(PAM_LIB)
  417. fi
  418. AM_CONDITIONAL([BUILD_WITH_PAM], [test "$WITH_PAM" != no])
  419. dnl Check for xattr
  420. AC_MSG_NOTICE([----------------------------------------])
  421. AC_MSG_CHECKING([for extended attributes support])
  422. AC_ARG_WITH([attr],
  423. [AS_HELP_STRING([--with-attr], [enable extended attribute support])],
  424. [WITH_ATTR=$withval],
  425. [WITH_ATTR=no]
  426. )
  427. AC_MSG_RESULT([$WITH_ATTR])
  428. if test "$WITH_ATTR" != no; then
  429. have_xattr=no
  430. # libattr (linux only?)
  431. AC_CHECK_LIB([attr], [attr_get], [
  432. AC_CHECK_HEADERS([attr/attributes.h], [
  433. ATTR_LIB=-lattr
  434. AC_DEFINE([HAVE_XATTR], [1], [libattr])
  435. AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
  436. have_xattr=yes
  437. ])
  438. ])
  439. AC_SUBST([ATTR_LIB])
  440. # Linux getxattr
  441. AC_CHECK_FUNC([getxattr], [
  442. AC_CHECK_HEADERS([sys/xattr.h], [
  443. AC_DEFINE([HAVE_XATTR], [1], [Linux extended attributes])
  444. AC_DEFINE([HAVE_SYS_XATTR_H], [1])
  445. have_xattr=yes
  446. ])
  447. ])
  448. # (Free)BSD extattr
  449. AC_CHECK_FUNC([extattr_get_file], [
  450. AC_CHECK_HEADERS([sys/extattr.h], [
  451. AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
  452. AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
  453. have_xattr=yes
  454. ])
  455. ])
  456. if test "$have_xattr" = no; then
  457. AC_MSG_ERROR([no backend found implementing extended attributes])
  458. fi
  459. fi
  460. dnl Check for valgrind
  461. AC_MSG_NOTICE([----------------------------------------])
  462. AC_MSG_CHECKING([for valgrind])
  463. AC_ARG_WITH([valgrind],
  464. [AS_HELP_STRING([--with-valgrind],
  465. [enable internal support for valgrind]
  466. )],
  467. [WITH_VALGRIND=$withval],
  468. [WITH_VALGRIND=no]
  469. )
  470. AC_MSG_RESULT([$WITH_VALGRIND])
  471. if test "$WITH_VALGRIND" != no; then
  472. AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
  473. AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
  474. ])
  475. fi
  476. dnl Checking for libunwind
  477. AC_MSG_NOTICE([----------------------------------------])
  478. AC_MSG_CHECKING([for libunwind])
  479. AC_ARG_WITH([libunwind],
  480. [AS_HELP_STRING([--with-libunwind],
  481. [Include libunwind support for backtraces on assert failures]
  482. )],
  483. [WITH_LIBUNWIND=$withval],
  484. [WITH_LIBUNWIND=no]
  485. )
  486. AC_MSG_RESULT([$WITH_LIBUNWIND])
  487. if test "$WITH_LIBUNWIND" != no; then
  488. PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
  489. AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
  490. ])
  491. AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
  492. fi
  493. dnl Checking for kerberos5
  494. AC_MSG_NOTICE([----------------------------------------])
  495. AC_MSG_CHECKING([for kerberos5])
  496. AC_ARG_WITH([krb5],
  497. [AS_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
  498. [WITH_KRB5=$withval],
  499. [WITH_KRB5=no]
  500. )
  501. AC_MSG_RESULT([$WITH_KRB5])
  502. if test "$WITH_KRB5" != no; then
  503. if test "$WITH_KRB5" != yes; then
  504. krb5_append_CPPFLAGS=" -I$WITH_KRB5/include"
  505. krb5_append_LDFLAGS=" -L$WITH_KRB5/lib"
  506. fi
  507. fi
  508. AC_MSG_CHECKING([custom include directory for kerberos5])
  509. AC_ARG_WITH([krb5-includes],
  510. [AS_HELP_STRING([--with-krb5-includes=DIR], [Kerberos includes])],
  511. [
  512. if test "$WITH_KRB5" = no; then
  513. AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
  514. fi
  515. krb5_append_CPPFLAGS=" -I$withval"
  516. AC_MSG_RESULT([$withval])
  517. ],
  518. [AC_MSG_RESULT([no])]
  519. )
  520. AC_MSG_CHECKING([custom lib directory for kerberos5])
  521. AC_ARG_WITH([krb5-libs],
  522. [AS_HELP_STRING([--with-krb5-libs=DIR], [Kerberos libraries])],
  523. [
  524. if test "$WITH_KRB5" = no; then
  525. AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
  526. fi
  527. krb5_append_LDFLAGS=" -L$withval"
  528. AC_MSG_RESULT([$withval])
  529. ],
  530. [AC_MSG_RESULT([no])]
  531. )
  532. if test "$WITH_KRB5" != no; then
  533. CPPFLAGS="${CPPFLAGS}${krb5_append_CPPFLAGS}"
  534. LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
  535. AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
  536. [AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
  537. [
  538. KRB5_LIB="-lkrb5 -lgssapi_krb5"
  539. AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
  540. ],
  541. [AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
  542. )],
  543. [AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
  544. )
  545. case "$host_os" in
  546. *darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
  547. * ) ;;
  548. esac
  549. fi
  550. AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
  551. AC_SUBST([KRB5_LIB])
  552. dnl Check for openssl
  553. AC_MSG_NOTICE([----------------------------------------])
  554. AC_MSG_CHECKING([for OpenSSL])
  555. AC_ARG_WITH([openssl],
  556. [AS_HELP_STRING([--with-openssl@<:@=DIR@:>@],
  557. [Include openssl support (default no)]
  558. )],
  559. [WITH_OPENSSL=$withval],
  560. [WITH_OPENSSL=no]
  561. )
  562. AC_MSG_RESULT([$WITH_OPENSSL])
  563. AM_CONDITIONAL([BUILD_WITH_OPENSSL], test ! "$WITH_OPENSSL" = no)
  564. if test "$WITH_OPENSSL" != no; then
  565. if test "$WITH_OPENSSL" != yes; then
  566. openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
  567. openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
  568. fi
  569. fi
  570. AC_MSG_CHECKING([custom include directory for openssl])
  571. AC_ARG_WITH([openssl-includes],
  572. [AS_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
  573. [
  574. if test "$WITH_OPENSSL" = no; then
  575. AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
  576. fi
  577. openssl_append_CPPFLAGS=" -I$withval"
  578. AC_MSG_RESULT([$withval])
  579. ],
  580. [AC_MSG_RESULT([no])]
  581. )
  582. AC_MSG_CHECKING([custom lib directory for openssl])
  583. AC_ARG_WITH([openssl-libs],
  584. [AS_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
  585. [
  586. if test "$WITH_OPENSSL" = no; then
  587. AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
  588. fi
  589. openssl_append_LDFLAGS=" -L$withval"
  590. AC_MSG_RESULT([$withval])
  591. ],
  592. [AC_MSG_RESULT([no])]
  593. )
  594. if test "$WITH_OPENSSL" != no; then
  595. if test "$WITH_KRB5" != no; then
  596. AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
  597. fi
  598. CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
  599. LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
  600. AC_CHECK_HEADERS([openssl/ssl.h], [], [
  601. AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
  602. ])
  603. AC_CHECK_LIB([crypto], [BIO_f_base64],
  604. [CRYPTO_LIB="-lcrypto"],
  605. [AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
  606. )
  607. AC_CHECK_LIB([ssl], [SSL_new],
  608. [OPENSSL_LIBS="${openssl_append_LDFLAGS} -lssl -lcrypto"],
  609. [AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
  610. [ -lcrypto "$DL_LIB" ]
  611. )
  612. AC_DEFINE([HAVE_LIBSSL], [1], [Have libssl])
  613. OPENSSL_CFLAGS="${openssl_append_CPPFLAGS}"
  614. AC_SUBST([OPENSSL_CFLAGS])
  615. AC_SUBST([OPENSSL_LIBS])
  616. AC_SUBST([CRYPTO_LIB])
  617. fi
  618. dnl Check for wolfSSL
  619. AC_MSG_NOTICE([----------------------------------------])
  620. AC_MSG_CHECKING([for wolfSSL])
  621. AC_ARG_WITH([wolfssl],
  622. [AS_HELP_STRING([--with-wolfssl@<:@=DIR@:>@],
  623. [Include wolfSSL support (default no)]
  624. )],
  625. [WITH_WOLFSSL=$withval],
  626. [WITH_WOLFSSL=no]
  627. )
  628. AC_MSG_RESULT([$WITH_WOLFSSL])
  629. AM_CONDITIONAL([BUILD_WITH_WOLFSSL], test ! "$WITH_WOLFSSL" = no)
  630. if test "$WITH_WOLFSSL" != no; then
  631. CPPFLAGS_SAVE="${CPPFLAGS}"
  632. LDFLAGS_SAVE="${LDFLAGS}"
  633. if test "$WITH_WOLFSSL" != yes; then
  634. WOLFSSL_CFLAGS="-I$WITH_WOLFSSL/include -I$WITH_WOLFSSL/include/wolfssl"
  635. WOLFSSL_LIBS="-L$WITH_WOLFSSL/lib -lwolfssl"
  636. LDFLAGS="${LDFLAGS} -L$WITH_WOLFSSL/lib"
  637. else
  638. PKG_CHECK_MODULES([WOLFSSL], [wolfssl], [], [
  639. AC_MSG_ERROR([wolfssl not found, install it or build without --with-wolfssl])
  640. ])
  641. if test "$WOLFSSL_LIBS" != "-lwolfssl"; then
  642. LDFLAGS="${LDFLAGS} ${WOLFSSL_LIBS% -lwolfssl}"
  643. fi
  644. fi
  645. CPPFLAGS="${CPPFLAGS} $WOLFSSL_CFLAGS"
  646. AC_CHECK_HEADERS([wolfssl/ssl.h], [], [
  647. AC_MSG_ERROR([wolfssl headers not found. install them or build without --with-wolfssl])
  648. ])
  649. AC_CHECK_LIB([wolfssl], [wolfSSL_Init],
  650. [WOLFSSL_CRYPTO_LIB="-lwolfssl"],
  651. [AC_MSG_ERROR([wolfssl crypto library not found. install it or build without --with-wolfssl])]
  652. )
  653. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  654. #include <wolfssl/options.h>
  655. #if !defined(HAVE_LIGHTY) && !defined(OPENSSL_EXTRA)
  656. #error HAVE_LIGHTY macro not defined
  657. #endif
  658. ]])], [], [AC_MSG_ERROR([wolfssl must be built with ./configure --enable-lighty])])
  659. AC_SUBST([WOLFSSL_CFLAGS])
  660. AC_SUBST([WOLFSSL_LIBS])
  661. if test "$WITH_OPENSSL" = no; then
  662. CRYPTO_LIB="$WOLFSSL_CRYPTO_LIB"
  663. AC_SUBST([CRYPTO_LIB])
  664. else
  665. CPPFLAGS="${CPPFLAGS_SAVE}"
  666. LDFLAGS="${LDFLAGS_SAVE}"
  667. fi
  668. fi
  669. dnl Check for mbedTLS
  670. AC_MSG_NOTICE([----------------------------------------])
  671. AC_MSG_CHECKING([for mbedTLS])
  672. AC_ARG_WITH([mbedtls],
  673. AS_HELP_STRING([--with-mbedtls@<:@=DIR@:>@],[Include mbedTLS support. DIR points to the installation root. (default no)]),
  674. [WITH_MBEDTLS=$withval],
  675. [WITH_MBEDTLS=no]
  676. )
  677. if test "$WITH_MBEDTLS" != "no"; then
  678. use_mbedtls=yes
  679. if test "$WITH_MBEDTLS" != "yes"; then
  680. CPPFLAGS="$CPPFLAGS -I$WITH_MBEDTLS/include"
  681. LDFLAGS="$LDFLAGS -L$WITH_MBEDTLS/lib"
  682. fi
  683. else
  684. use_mbedtls=no
  685. fi
  686. AC_MSG_RESULT([$use_mbedtls])
  687. AM_CONDITIONAL(BUILD_WITH_MBEDTLS, test ! $WITH_MBEDTLS = no)
  688. if test "x$use_mbedtls" = "xyes"; then
  689. AC_CHECK_HEADERS([mbedtls/ssl.h])
  690. OLDLIBS="$LIBS"
  691. AC_CHECK_LIB(mbedcrypto,mbedtls_base64_encode,
  692. [AC_CHECK_LIB(mbedx509, mbedtls_x509_get_name,
  693. [AC_CHECK_LIB(mbedtls, mbedtls_cipher_info_from_type,
  694. [MTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"
  695. CRYPTO_LIB="-lmbedcrypto"
  696. AC_DEFINE(HAVE_LIBMBEDTLS, [1], [Have libmbedtls library])
  697. AC_DEFINE(HAVE_LIBMBEDX509, [1], [Have libmbedx509 library])
  698. AC_DEFINE(HAVE_LIBMBEDCRYPTO, [1], [Have libmbedcrypto library]) ],
  699. [],[-lmbedcrypto "$DL_LIB"])
  700. ],[],[-lmbedcrypto "$DL_LIB"])
  701. ],[],[])
  702. LIBS="$OLDLIBS"
  703. AC_SUBST(MTLS_LIBS)
  704. AC_SUBST(CRYPTO_LIB)
  705. fi
  706. dnl Check for Nettle (and overwrite CRYPTO_LIB if set by OpenSSL or wolfSSL)
  707. AC_MSG_NOTICE([----------------------------------------])
  708. AC_MSG_CHECKING([for Nettle])
  709. AC_ARG_WITH([nettle],
  710. [AS_HELP_STRING([--with-nettle@<:@=DIR@:>@],
  711. [Include Nettle support (default no)]
  712. )],
  713. [WITH_NETTLE=$withval],
  714. [WITH_NETTLE=no]
  715. )
  716. AC_MSG_RESULT([$WITH_NETTLE])
  717. if test "$WITH_NETTLE" != no; then
  718. if test "$WITH_NETTLE" != yes; then
  719. CPPFLAGS="${CPPFLAGS} -I$WITH_NETTLE/include"
  720. LDFLAGS="${LDFLAGS} -L$WITH_NETTLE/lib"
  721. fi
  722. AC_CHECK_HEADERS([nettle/nettle-types.h], [], [
  723. AC_MSG_ERROR([nettle headers not found. install them or build without --with-nettle])
  724. ])
  725. AC_CHECK_LIB([nettle], [nettle_md5_init],
  726. [CRYPTO_LIB="-lnettle"],
  727. [AC_MSG_ERROR([nettle crypto library not found. install it or build without --with-nettle])]
  728. )
  729. AC_SUBST([CRYPTO_LIB])
  730. fi
  731. dnl Check for GnuTLS
  732. AC_MSG_NOTICE([----------------------------------------])
  733. AC_MSG_CHECKING([for GnuTLS])
  734. AC_ARG_WITH([gnutls],
  735. AS_HELP_STRING([--with-gnutls@<:@=DIR@:>@],[Include GnuTLS support. DIR points to the installation root. (default no)]),
  736. [WITH_GNUTLS=$withval],
  737. [WITH_GNUTLS=no]
  738. )
  739. if test "$WITH_GNUTLS" != "no"; then
  740. use_gnutls=yes
  741. else
  742. use_gnutls=no
  743. fi
  744. AC_MSG_RESULT([$use_gnutls])
  745. AM_CONDITIONAL(BUILD_WITH_GNUTLS, test ! $WITH_GNUTLS = no)
  746. GNUTLS_CFLAGS=
  747. GNUTLS_LIBS=
  748. if test "x$use_gnutls" = "xyes"; then
  749. if test "$WITH_GNUTLS" != "yes"; then
  750. GNUTLS_CFLAGS="-I$WITH_GNUTLS/include"
  751. GNUTLS_LIBS="-L$WITH_GNUTLS/lib -lgnutls"
  752. else
  753. dnl oldest GnuTLS supported release is 3.3.x at time this is being written
  754. PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0])
  755. fi
  756. AC_SUBST([GNUTLS_CFLAGS])
  757. AC_SUBST([GNUTLS_LIBS])
  758. AC_DEFINE([HAVE_GNUTLS_CRYPTO_H], [1], [gnutls/crypto.h])
  759. if test "$WITH_OPENSSL" = no && test "$WITH_WOLFSSL" = no && \
  760. test "$WITH_MBEDTLS" = no && test "$WITH_NETTLE" = no; then
  761. AC_SUBST([CRYPTO_LIB],[$GNUTLS_LIBS])
  762. fi
  763. fi
  764. dnl Check for NSS
  765. AC_MSG_NOTICE([----------------------------------------])
  766. AC_MSG_CHECKING([for NSS])
  767. AC_ARG_WITH([nss],
  768. AS_HELP_STRING([--with-nss@<:@=DIR@:>@],[Include NSS support. DIR points to the installation root. (default no)]),
  769. [WITH_NSS=$withval],
  770. [WITH_NSS=no]
  771. )
  772. if test "$WITH_NSS" != "no"; then
  773. use_nss=yes
  774. else
  775. use_nss=no
  776. fi
  777. AC_MSG_RESULT([$use_nss])
  778. AM_CONDITIONAL(BUILD_WITH_NSS, test ! $WITH_NSS = no)
  779. NSS_CFLAGS=
  780. NSS_LIBS=
  781. if test "x$use_nss" = "xyes"; then
  782. if test "$WITH_NSS" != "yes"; then
  783. NSS_CFLAGS="-I$WITH_NSS/include"
  784. NSS_LIBS="-L$WITH_NSS/lib -lnss3"
  785. else
  786. PKG_CHECK_MODULES([NSS],[nss])
  787. if test "x$CRYPTO_LIB" = "x"; then
  788. PKG_CHECK_MODULES([NSPR],[nspr])
  789. CPPFLAGS="$CPPFLAGS $NSPR_CFLAGS"
  790. fi
  791. fi
  792. AC_DEFINE([HAVE_NSS_NSS_H], [1], [nss/nss.h])
  793. AC_DEFINE([HAVE_NSS3_NSS_H], [1], [nss3/nss.h])
  794. AC_SUBST([NSS_CFLAGS])
  795. AC_SUBST([NSS_LIBS])
  796. if test "x$CRYPTO_LIB" = "x"; then
  797. CRYPTO_LIB="-lnss3"
  798. AC_SUBST([CRYPTO_LIB])
  799. fi
  800. fi
  801. dnl pcre support
  802. AC_MSG_NOTICE([----------------------------------------])
  803. AC_MSG_CHECKING([for perl regular expressions support])
  804. AC_ARG_WITH([pcre],
  805. [AS_HELP_STRING([--with-pcre], [Enable pcre support (default yes)])],
  806. [WITH_PCRE=$withval],
  807. [WITH_PCRE=yes]
  808. )
  809. AC_MSG_RESULT([$WITH_PCRE])
  810. if test "$WITH_PCRE" != no; then
  811. if test "$WITH_PCRE" != yes; then
  812. PCRE_LIB="-L$WITH_PCRE/lib -lpcre"
  813. CPPFLAGS="$CPPFLAGS -I$WITH_PCRE/include"
  814. else
  815. AC_PATH_PROG([PCRECONFIG], [pcre-config])
  816. if test -n "$PCRECONFIG"; then
  817. PCRE_LIB=`"$PCRECONFIG" --libs`
  818. CPPFLAGS="$CPPFLAGS `"$PCRECONFIG" --cflags`"
  819. fi
  820. fi
  821. if test -z "$PCRE_LIB"; then
  822. AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
  823. fi
  824. AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
  825. AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
  826. AC_SUBST([PCRE_LIB])
  827. fi
  828. dnl zlib
  829. AC_MSG_NOTICE([----------------------------------------])
  830. AC_MSG_CHECKING([for zlib support])
  831. AC_ARG_WITH([zlib],
  832. [AS_HELP_STRING([--with-zlib],
  833. [Enable zlib support for mod_deflate]
  834. )],
  835. [WITH_ZLIB=$withval],
  836. [WITH_ZLIB=yes]
  837. )
  838. AC_MSG_RESULT([$WITH_ZLIB])
  839. if test "$WITH_ZLIB" != no; then
  840. if test "$WITH_ZLIB" != yes; then
  841. Z_LIB="-L$WITH_ZLIB -lz"
  842. CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
  843. else
  844. AC_CHECK_HEADERS([zlib.h], [],
  845. [AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
  846. )
  847. AC_CHECK_LIB([z], [deflate],
  848. [Z_LIB=-lz],
  849. [AC_MSG_ERROR([zlib library not found, install it or build without --with-zlib])]
  850. )
  851. fi
  852. AC_DEFINE([HAVE_LIBZ], [1], [libz])
  853. AC_DEFINE([HAVE_ZLIB_H], [1])
  854. AC_SUBST([Z_LIB])
  855. fi
  856. dnl zstd
  857. AC_MSG_NOTICE([----------------------------------------])
  858. AC_MSG_CHECKING([for zstd support])
  859. AC_ARG_WITH([zstd],
  860. [AS_HELP_STRING([--with-zstd],
  861. [Enable zstd support for mod_deflate]
  862. )],
  863. [WITH_ZSTD=$withval],
  864. [WITH_ZSTD=no]
  865. )
  866. AC_MSG_RESULT([$WITH_ZSTD])
  867. if test "$WITH_ZSTD" != no; then
  868. if test "$WITH_ZSTD" != yes; then
  869. ZSTD_LIB="-L$WITH_ZSTD -lzstd"
  870. CPPFLAGS="$CPPFLAGS -I$WITH_ZSTD"
  871. else
  872. AC_CHECK_HEADERS([zstd.h], [],
  873. [AC_MSG_ERROR([zstd headers not found, install them or build without --with-zstd])]
  874. )
  875. AC_CHECK_LIB([zstd], [ZSTD_versionNumber],
  876. [ZSTD_LIB=-lzstd],
  877. [AC_MSG_ERROR([zstd library not found, install it or build without --with-zstd])]
  878. )
  879. fi
  880. AC_DEFINE([HAVE_ZSTD], [1], [libzstd])
  881. AC_DEFINE([HAVE_ZSTD_H], [1])
  882. AC_SUBST([ZSTD_LIB])
  883. fi
  884. dnl bzip2
  885. AC_MSG_NOTICE([----------------------------------------])
  886. AC_MSG_CHECKING([for bzip2 support])
  887. AC_ARG_WITH([bzip2],
  888. [AS_HELP_STRING([--with-bzip2],
  889. [Enable bzip2 support for mod_deflate]
  890. )],
  891. [WITH_BZIP2=$withval],
  892. [WITH_BZIP2=no]
  893. )
  894. AC_MSG_RESULT([$WITH_BZIP2])
  895. if test "$WITH_BZIP2" != no; then
  896. if test "$WITH_BZIP2" != yes; then
  897. BZ_LIB="-L$WITH_BZIP2 -lbz2"
  898. CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
  899. else
  900. AC_CHECK_HEADERS([bzlib.h], [], [
  901. AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
  902. ])
  903. AC_CHECK_LIB([bz2], [BZ2_bzCompress],
  904. [BZ_LIB=-lbz2],
  905. [AC_MSG_ERROR([bzip2 library not found, install it or build without --with-bzip2])]
  906. )
  907. fi
  908. AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
  909. AC_DEFINE([HAVE_BZLIB_H], [1])
  910. AC_SUBST([BZ_LIB])
  911. fi
  912. dnl brotli
  913. AC_MSG_NOTICE([----------------------------------------])
  914. AC_MSG_CHECKING([for brotli support])
  915. AC_ARG_WITH([brotli],
  916. [AS_HELP_STRING([--with-brotli],
  917. [Enable brotli support for mod_deflate]
  918. )],
  919. [WITH_BROTLI=$withval],
  920. [WITH_BROTLI=no]
  921. )
  922. AC_MSG_RESULT([$WITH_BROTLI])
  923. if test "$WITH_BROTLI" != no; then
  924. if test "$WITH_BROTLI" != yes; then
  925. BROTLI_LIBS="-L$WITH_BROTLI -lbrotlienc"
  926. CPPFLAGS="$CPPFLAGS -I$WITH_BROTLI"
  927. else
  928. PKG_CHECK_MODULES([BROTLI], [libbrotlienc], [], [
  929. AC_MSG_ERROR([brotli not found, install it or build without --with-brotli])
  930. ])
  931. fi
  932. AC_DEFINE([HAVE_BROTLI_ENCODE_H], [1], [brotli/encode.h])
  933. AC_DEFINE([HAVE_BROTLI], [1], [libbrotlienc])
  934. AC_SUBST([BROTLI_CFLAGS])
  935. AC_SUBST([BROTLI_LIBS])
  936. fi
  937. dnl Check for fam/gamin
  938. AC_MSG_NOTICE([----------------------------------------])
  939. AC_MSG_CHECKING([for FAM])
  940. AC_ARG_WITH([fam],
  941. [AS_HELP_STRING([--with-fam],
  942. [fam/gamin for reducing number of stat() calls]
  943. )],
  944. [WITH_FAM=$withval],
  945. [WITH_FAM=no]
  946. )
  947. AC_MSG_RESULT([$WITH_FAM])
  948. dnl "$ac_cv_func_kqueue" is set further below
  949. case "$host_os" in
  950. *bsd*|*darwin* ) WITH_FAM=no ;;
  951. * ) ;;
  952. esac
  953. if test "$ac_cv_header_sys_inotify_h" != no; then
  954. WITH_FAM=no
  955. fi
  956. if test "$WITH_FAM" != no; then
  957. if test "$WITH_FAM" != yes; then
  958. FAM_LIBS="-L$WITH_FAM -lfam"
  959. CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
  960. else
  961. AC_CHECK_LIB([fam], [FAMOpen2], [
  962. AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
  963. ])
  964. dnl fam has no pkg-config so far, so just search for gamin as fallback
  965. if test -z "$FAM_LIBS"; then
  966. PKG_CHECK_MODULES([FAM], [gamin >= 0.1.0])
  967. fi
  968. fi
  969. if test -z "$FAM_LIBS"; then
  970. AC_MSG_ERROR([fam/gamin headers and/or libs were not found, install them or build without --with-fam])
  971. fi
  972. OLD_LIBS=$LIBS
  973. LIBS=$FAM_LIBS
  974. AC_CHECK_FUNCS([FAMNoExists])
  975. LIBS=$OLD_LIBS
  976. AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
  977. AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
  978. AC_SUBST([FAM_LIBS])
  979. fi
  980. dnl webdav props (xml2 and sqlite3)
  981. AC_MSG_NOTICE([----------------------------------------])
  982. AC_MSG_CHECKING([for properties in mod_webdav])
  983. AC_ARG_WITH([webdav-props],
  984. [AS_HELP_STRING([--with-webdav-props], [properties in mod_webdav])],
  985. [WITH_WEBDAV_PROPS=$withval],
  986. [WITH_WEBDAV_PROPS=no]
  987. )
  988. AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
  989. if test "$WITH_WEBDAV_PROPS" != no; then
  990. AC_MSG_CHECKING([for libxml2])
  991. AC_ARG_WITH([libxml],
  992. [AS_HELP_STRING([--with-libxml],
  993. [libxml2 for properties in mod_webdav]
  994. )],
  995. [WITH_LIBXML=$withval],
  996. [WITH_LIBXML=yes]
  997. )
  998. AC_MSG_RESULT([$WITH_LIBXML])
  999. if test "$WITH_LIBXML" = no; then
  1000. AC_MSG_ERROR([--with-webdav-props requires libxml])
  1001. fi
  1002. if test "$WITH_LIBXML" != yes; then
  1003. XML_LIBS="-L$WITH_LIBXML/.libs -lxml2"
  1004. XML_CFLAGS="-I$WITH_LIBXML/include"
  1005. else
  1006. PKG_CHECK_MODULES([XML], [libxml-2.0], [], [
  1007. AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
  1008. ])
  1009. fi
  1010. AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
  1011. AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
  1012. AC_SUBST([XML_LIBS])
  1013. AC_SUBST([XML_CFLAGS])
  1014. AC_MSG_CHECKING([for sqlite])
  1015. AC_ARG_WITH([sqlite],
  1016. [AS_HELP_STRING([--with-sqlite],
  1017. [sqlite for properties in mod_webdav]
  1018. )],
  1019. [WITH_SQLITE=$withval],
  1020. [WITH_SQLITE=yes]
  1021. )
  1022. AC_MSG_RESULT([$WITH_SQLITE])
  1023. if test "$WITH_SQLITE" = no; then
  1024. AC_MSG_ERROR([--with-webdav-props requires sqlite])
  1025. fi
  1026. if test "$WITH_SQLITE" != yes; then
  1027. SQLITE_LIBS="-L$WITH_SQLITE/.libs -lsqlite3"
  1028. SQLITE_CFLAGS="-I$WITH_SQLITE"
  1029. else
  1030. PKG_CHECK_MODULES([SQLITE], [sqlite3], [], [
  1031. AC_MSG_ERROR([sqlite3 not found, install it or build without --with-webdav-props])
  1032. ])
  1033. fi
  1034. AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
  1035. AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
  1036. AC_SUBST([SQLITE_LIBS])
  1037. AC_SUBST([SQLITE_CFLAGS])
  1038. fi
  1039. dnl webdav locks (uuid)
  1040. AC_MSG_NOTICE([----------------------------------------])
  1041. AC_MSG_CHECKING([for locks in mod_webdav])
  1042. AC_ARG_WITH([webdav-locks],
  1043. [AS_HELP_STRING([--with-webdav-locks],
  1044. [locks in mod_webdav (requires webdav properties)]
  1045. )],
  1046. [WITH_WEBDAV_LOCKS=$withval],
  1047. [WITH_WEBDAV_LOCKS=no]
  1048. )
  1049. AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
  1050. if test "$WITH_WEBDAV_LOCKS" != no; then
  1051. if test "$WITH_WEBDAV_PROPS" = no; then
  1052. AC_MSG_ERROR([--with-webdav-locks requires --with-webdav-props])
  1053. fi
  1054. AC_MSG_CHECKING([for libuuid])
  1055. AC_ARG_WITH([uuid],
  1056. [AS_HELP_STRING([--with-uuid], [uuid for locks in mod_webdav])],
  1057. [WITH_UUID=$withval],
  1058. [WITH_UUID=yes]
  1059. )
  1060. AC_MSG_RESULT([$WITH_UUID])
  1061. if test "$WITH_UUID" = no; then
  1062. AC_MSG_ERROR([--with-webdav-locks requires uuid])
  1063. fi
  1064. if test "$WITH_UUID" != yes; then
  1065. UUID_LIBS="-L$WITH_UUID -luuid"
  1066. CPPFLAGS="$CPPFLAGS -I$WITH_UUID"
  1067. else
  1068. AC_CHECK_LIB([uuid], [uuid_unparse],
  1069. [UUID_LIBS=-luuid],
  1070. [AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
  1071. )
  1072. AC_CHECK_HEADERS([uuid/uuid.h], [],
  1073. [AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
  1074. )
  1075. fi
  1076. AC_DEFINE([HAVE_LIBUUID], [1], [libuuid])
  1077. AC_DEFINE([HAVE_UUID_UUID_H], [1], [uuid/uuid.h is available])
  1078. AC_SUBST([UUID_LIBS])
  1079. fi
  1080. dnl xxhash
  1081. AC_MSG_NOTICE([----------------------------------------])
  1082. AC_MSG_CHECKING([for xxhash support])
  1083. AC_ARG_WITH([xxhash],
  1084. [AS_HELP_STRING([--with-xxhash],
  1085. [Enable system-provided xxhash]
  1086. )],
  1087. [WITH_XXHASH=$withval],
  1088. [WITH_XXHASH=no]
  1089. )
  1090. AC_MSG_RESULT([$WITH_XXHASH])
  1091. if test "$WITH_XXHASH" != no; then
  1092. if test "$WITH_XXHASH" != yes; then
  1093. XXHASH_LIBS="-L$WITH_XXHASH -lxxhash"
  1094. CPPFLAGS="$CPPFLAGS -I$WITH_XXHASH"
  1095. else
  1096. PKG_CHECK_MODULES([XXHASH], [libxxhash], [], [
  1097. AC_CHECK_LIB([xxhash], [XXH_versionNumber],
  1098. [XXHASH_LIBS=-lxxhash],
  1099. [AC_MSG_ERROR([xxhash not found, install it or build without --with-xxhash])]
  1100. )
  1101. AC_CHECK_HEADERS([xxhash.h], [],
  1102. [AC_MSG_ERROR([xxhash not found, install it or build without --with-xxhash])]
  1103. )
  1104. ])
  1105. fi
  1106. AC_DEFINE([HAVE_XXHASH_H], [1], [xxhash.h])
  1107. AC_DEFINE([HAVE_XXHASH], [1], [xxhash])
  1108. AC_SUBST([XXHASH_CFLAGS])
  1109. AC_SUBST([XXHASH_LIBS])
  1110. fi
  1111. dnl Check for gdbm
  1112. AC_MSG_NOTICE([----------------------------------------])
  1113. AC_MSG_CHECKING([for gdbm])
  1114. AC_ARG_WITH([gdbm],
  1115. [AS_HELP_STRING([--with-gdbm], [gdbm storage for mod_trigger_b4_dl])],
  1116. [WITH_GDBM=$withval],
  1117. [WITH_GDBM=no]
  1118. )
  1119. AC_MSG_RESULT([$WITH_GDBM])
  1120. if test "$WITH_GDBM" != no; then
  1121. if test "$WITH_GDBM" != yes; then
  1122. GDBM_LIB="-L$WITH_GDBM -lgdbm"
  1123. CPPFLAGS="$CPPFLAGS -I$WITH_GDBM"
  1124. else
  1125. AC_CHECK_LIB([gdbm], [gdbm_open],
  1126. [GDBM_LIB=-lgdbm],
  1127. [AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
  1128. )
  1129. AC_CHECK_HEADERS([gdbm.h], [],
  1130. [AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
  1131. )
  1132. fi
  1133. AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
  1134. AC_DEFINE([HAVE_GDBM_H], [1])
  1135. AC_SUBST([GDBM_LIB])
  1136. fi
  1137. AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
  1138. dnl Check for GeoIP
  1139. AC_MSG_NOTICE([----------------------------------------])
  1140. AC_MSG_CHECKING([for GeoIP])
  1141. AC_ARG_WITH([geoip],
  1142. [AS_HELP_STRING([--with-geoip], [IP-based geolocation lookup])],
  1143. [WITH_GEOIP=$withval],
  1144. [WITH_GEOIP=no]
  1145. )
  1146. AC_MSG_RESULT([$WITH_GEOIP])
  1147. if test "$WITH_GEOIP" != no; then
  1148. if test "$WITH_GEOIP" != yes; then
  1149. GEOIP_LIB="-L$WITH_GEOIP -lGeoIP"
  1150. CPPFLAGS="$CPPFLAGS -I$WITH_GEOIP"
  1151. else
  1152. AC_CHECK_LIB([GeoIP], [GeoIP_country_name_by_addr],
  1153. [GEOIP_LIB=-lGeoIP],
  1154. [AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
  1155. )
  1156. AC_CHECK_HEADERS([GeoIP.h], [],
  1157. [AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
  1158. )
  1159. fi
  1160. AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
  1161. AC_DEFINE([HAVE_GEOIP_H], [1])
  1162. AC_SUBST([GEOIP_LIB])
  1163. fi
  1164. AM_CONDITIONAL([BUILD_WITH_GEOIP], [test "$WITH_GEOIP" != no])
  1165. dnl Check for maxminddb
  1166. AC_MSG_NOTICE([----------------------------------------])
  1167. AC_MSG_CHECKING([for maxminddb])
  1168. AC_ARG_WITH([maxminddb],
  1169. [AS_HELP_STRING([--with-maxminddb], [IP-based geolocation lookup])],
  1170. [WITH_MAXMINDDB=$withval],
  1171. [WITH_MAXMINDDB=no]
  1172. )
  1173. AC_MSG_RESULT([$WITH_MAXMINDDB])
  1174. if test "$WITH_MAXMINDDB" != no; then
  1175. if test "$WITH_MAXMINDDB" != yes; then
  1176. MAXMINDDB_LIB="-L$WITH_MAXMINDDB -lmaxminddb"
  1177. CPPFLAGS="$CPPFLAGS -I$WITH_MAXMINDDB"
  1178. else
  1179. AC_CHECK_LIB([maxminddb], [MMDB_open],
  1180. [MAXMINDDB_LIB=-lmaxminddb],
  1181. [AC_MSG_ERROR([maxminddb lib not found, install it or build without --with-maxminddb])]
  1182. )
  1183. AC_CHECK_HEADERS([maxminddb.h], [],
  1184. [AC_MSG_ERROR([maxminddb headers not found, install them or build without --with-maxminddb])]
  1185. )
  1186. fi
  1187. AC_DEFINE([HAVE_MAXMINDDB], [1], [libmaxminddb])
  1188. AC_DEFINE([HAVE_MAXMINDDB_H], [1])
  1189. AC_SUBST([MAXMINDDB_LIB])
  1190. fi
  1191. AM_CONDITIONAL([BUILD_WITH_MAXMINDDB], [test "$WITH_MAXMINDDB" != no])
  1192. dnl Check for memcached
  1193. AC_MSG_NOTICE([----------------------------------------])
  1194. AC_MSG_CHECKING([for memcached])
  1195. AC_ARG_WITH([memcached],
  1196. [AS_HELP_STRING([--with-memcached],
  1197. [memcached storage for mod_trigger_b4_dl/mod_cml]
  1198. )],
  1199. [WITH_MEMCACHED=$withval],
  1200. [WITH_MEMCACHED=no]
  1201. )
  1202. AC_MSG_RESULT([$WITH_MEMCACHED])
  1203. if test "$WITH_MEMCACHED" != no; then
  1204. if test "$WITH_MEMCACHED" != yes; then
  1205. MEMCACHED_LIB="-L$WITH_MEMCACHED -lMEMCACHED"
  1206. CPPFLAGS="$CPPFLAGS -I$WITH_MEMCACHED"
  1207. else
  1208. AC_CHECK_LIB([memcached], [memcached],
  1209. [ MEMCACHED_LIB=-lmemcached ],
  1210. [AC_MSG_ERROR([memcached lib not found, install it or build without --with-memcached])]
  1211. )
  1212. AC_CHECK_HEADERS([libmemcached/memcached.h], [],
  1213. [AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
  1214. )
  1215. fi
  1216. AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
  1217. AC_SUBST([MEMCACHED_LIB])
  1218. fi
  1219. AM_CONDITIONAL([BUILD_WITH_MEMCACHED], [test "$WITH_MEMCACHED" != no])
  1220. BUILD_MOD_TRIGGER_B4_DL=no
  1221. if test "$WITH_MEMCACHED" != no || test "$WITH_GDBM" != no ; then
  1222. BUILD_MOD_TRIGGER_B4_DL=yes
  1223. fi
  1224. AM_CONDITIONAL([BUILD_MOD_TRIGGER_B4_DL], [test "$BUILD_MOD_TRIGGER_B4_DL" != no])
  1225. dnl Check for lua
  1226. AC_MSG_NOTICE([----------------------------------------])
  1227. AC_MSG_CHECKING([if lua-support is requested])
  1228. AC_ARG_WITH([lua],
  1229. [AS_HELP_STRING([--with-lua], [lua engine for mod_magnet/mod_cml])],
  1230. [WITH_LUA=$withval],
  1231. [WITH_LUA=no]
  1232. )
  1233. AC_MSG_RESULT([$WITH_LUA])
  1234. if test "$WITH_LUA" != no; then
  1235. found_lua=0
  1236. if test "$WITH_LUA" != yes; then
  1237. PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
  1238. [found_lua=1],
  1239. [AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
  1240. )
  1241. if test "$found_lua" = "0"; then
  1242. LUA_LIBS="-L$WITH_LUA -llua"
  1243. LUA_CFLAGS="-I$WITH_LUA"
  1244. fi
  1245. else
  1246. for luaname in lua5.4 lua-5.4 lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua; do
  1247. if test "$found_lua" = "0"; then
  1248. PKG_CHECK_MODULES([LUA], [$luaname >= 5.1],
  1249. [found_lua=1],
  1250. [AC_MSG_NOTICE([Couldn\'t find $luaname])]
  1251. )
  1252. fi
  1253. done
  1254. if test "$found_lua" = "0"; then
  1255. AC_MSG_ERROR([Couldn\'t find any lua pkg-config module])
  1256. fi
  1257. fi
  1258. AC_DEFINE([HAVE_LUA], [1], [liblua])
  1259. AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
  1260. AC_SUBST([LUA_LIBS])
  1261. AC_SUBST([LUA_CFLAGS])
  1262. fi
  1263. AM_CONDITIONAL([BUILD_WITH_LUA], [test "$WITH_LUA" != no])
  1264. dnl "--with-FEATURE" blocks end
  1265. AC_MSG_NOTICE([----------------------------------------])
  1266. dnl search for crypt_r and (fallback) for crypt
  1267. save_LIBS=$LIBS
  1268. LIBS=
  1269. found_crypt=no
  1270. AC_SEARCH_LIBS([crypt_r], [crypt],
  1271. [
  1272. AC_DEFINE([HAVE_CRYPT_R], [1], [crypt_r])
  1273. AC_CHECK_HEADERS([crypt.h])
  1274. CRYPT_LIB=$LIBS
  1275. found_crypt=crypt_r
  1276. ],
  1277. [AC_SEARCH_LIBS([crypt], [crypt], [
  1278. AC_DEFINE([HAVE_CRYPT], [1], [crypt])
  1279. AC_CHECK_HEADERS([crypt.h])
  1280. CRYPT_LIB=$LIBS
  1281. found_crypt=crypt
  1282. ])]
  1283. )
  1284. LIBS=$save_LIBS
  1285. AC_SUBST([CRYPT_LIB])
  1286. AC_MSG_CHECKING([crypt_r/crypt support])
  1287. AC_MSG_RESULT([$found_crypt])
  1288. dnl check whether sendfilev needs -lsendfile
  1289. AC_MSG_NOTICE([----------------------------------------])
  1290. save_LIBS=$LIBS
  1291. LIBS=
  1292. have_sendfilev=no
  1293. AC_SEARCH_LIBS([sendfilev], [sendfile], [
  1294. if test -z "$LIBS"; then
  1295. have_sendfilev=yes
  1296. else
  1297. have_sendfilev=$LIBS
  1298. fi
  1299. SENDFILE_LIB=$LIBS
  1300. AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
  1301. ])
  1302. LIBS=$save_LIBS
  1303. AC_SUBST([SENDFILE_LIB])
  1304. AC_MSG_CHECKING([solaris sendfilev present])
  1305. AC_MSG_RESULT([$have_sendfilev])
  1306. AC_MSG_NOTICE([----------------------------------------])
  1307. case "$host_os" in
  1308. *mingw* ) LIBS="$LIBS -lwsock32" ;;
  1309. * ) ;;
  1310. esac
  1311. AC_CHECK_FUNCS([\
  1312. arc4random_buf \
  1313. chroot \
  1314. clock_gettime \
  1315. copy_file_range \
  1316. epoll_ctl \
  1317. explicit_bzero \
  1318. explicit_memset \
  1319. fork \
  1320. getloadavg \
  1321. getrlimit \
  1322. getuid \
  1323. gmtime_r \
  1324. inet_aton \
  1325. inet_pton \
  1326. issetugid \
  1327. jrand48 \
  1328. kqueue \
  1329. localtime_r \
  1330. lstat \
  1331. madvise \
  1332. mempcpy \
  1333. memset \
  1334. memset_s \
  1335. mmap \
  1336. pathconf \
  1337. pipe2 \
  1338. poll \
  1339. port_create \
  1340. select \
  1341. send_file \
  1342. sendfile \
  1343. sendfile64 \
  1344. sigaction \
  1345. signal \
  1346. srandom \
  1347. timegm \
  1348. writev \
  1349. ])
  1350. AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
  1351. AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
  1352. AC_MSG_NOTICE([----------------------------------------])
  1353. AC_MSG_CHECKING([if weak symbols are supported])
  1354. AC_LINK_IFELSE(
  1355. [AC_LANG_PROGRAM([[
  1356. __attribute__((weak)) void __dummy(void *x) { }
  1357. void f(void *x) { __dummy(x); }
  1358. ]])],
  1359. [
  1360. AC_MSG_RESULT([yes])
  1361. AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])
  1362. ],
  1363. [AC_MSG_RESULT([no])]
  1364. )
  1365. AC_MSG_NOTICE([----------------------------------------])
  1366. AC_MSG_CHECKING([for Large File System support])
  1367. AC_ARG_ENABLE([lfs],
  1368. [AS_HELP_STRING([--enable-lfs],
  1369. [Turn on Large File System (default)]
  1370. )],
  1371. [
  1372. case "${enableval}" in
  1373. yes) ENABLE_LFS=yes ;;
  1374. no) ENABLE_LFS=no ;;
  1375. *) AC_MSG_ERROR([bad value ${enableval} for --enable-lfs]) ;;
  1376. esac
  1377. ],
  1378. [ ENABLE_LFS=yes ]
  1379. )
  1380. AC_MSG_RESULT([$ENABLE_LFS])
  1381. if test "$ENABLE_LFS" = yes; then
  1382. CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
  1383. fi
  1384. dnl check if sendfile works
  1385. if test "$ac_cv_func_sendfile" = yes; then
  1386. AC_MSG_NOTICE([----------------------------------------])
  1387. AC_MSG_CHECKING([if sendfile works])
  1388. if test "$cross_compiling" = no; then
  1389. AC_RUN_IFELSE([AC_LANG_SOURCE(
  1390. [[
  1391. #ifdef HAVE_SYS_SENDFILE_H
  1392. #include <sys/sendfile.h>
  1393. #endif /* HAVE_SYS_SENDFILE_H */
  1394. #include <errno.h>
  1395. int main() {
  1396. int o = 0;
  1397. if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
  1398. return 0;
  1399. }
  1400. ]])],
  1401. [AC_MSG_RESULT([yes])],
  1402. [
  1403. AC_MSG_RESULT([no])
  1404. AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
  1405. ],[]
  1406. )
  1407. fi
  1408. fi
  1409. dnl Check for IPv6 support
  1410. AC_MSG_NOTICE([----------------------------------------])
  1411. AC_ARG_ENABLE([ipv6],
  1412. [AS_HELP_STRING([--disable-ipv6], [disable IPv6 support])],
  1413. [
  1414. case "${enableval}" in
  1415. yes) ipv6=true ;;
  1416. no) ipv6=false ;;
  1417. *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipv6]) ;;
  1418. esac
  1419. ],
  1420. [ipv6=true]
  1421. )
  1422. if test "$ipv6" = true; then
  1423. AC_CACHE_CHECK([for IPv6 support], [ac_cv_ipv6_support], [
  1424. AC_LINK_IFELSE([AC_LANG_PROGRAM(
  1425. [[
  1426. #include <sys/types.h>
  1427. #include <sys/socket.h>
  1428. #include <netinet/in.h>
  1429. ]],
  1430. [[
  1431. struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
  1432. ]])],
  1433. [ac_cv_ipv6_support=yes],
  1434. [ac_cv_ipv6_support=no]
  1435. )
  1436. ])
  1437. if test "$ac_cv_ipv6_support" = yes; then
  1438. AC_DEFINE([HAVE_IPV6], [1], [Whether to enable IPv6 support])
  1439. else
  1440. AC_MSG_ERROR([IPv6 seems broken. Fix it or build with --disable-ipv6])
  1441. fi
  1442. fi
  1443. # disable mmap by default
  1444. # lighttpd may always use mmap with files it owns (created tmp files)
  1445. AC_MSG_NOTICE([----------------------------------------])
  1446. AC_MSG_CHECKING([use mmap if available])
  1447. AC_ARG_ENABLE([mmap],
  1448. [AS_HELP_STRING([--enable-mmap],
  1449. [use mmap if available]
  1450. )],
  1451. [
  1452. case "${enableval}" in
  1453. yes) mmap=true ;;
  1454. no) mmap=false ;;
  1455. *) AC_MSG_ERROR([bad value ${enableval} for --enable-mmap]) ;;
  1456. esac
  1457. ],
  1458. [mmap=false]
  1459. )
  1460. AC_MSG_RESULT([$mmap])
  1461. if test "$mmap" = true; then
  1462. AC_DEFINE([ENABLE_MMAP], [1], [Use mmap if available])
  1463. fi
  1464. AC_MSG_NOTICE([----------------------------------------])
  1465. dnl check for extra compiler options (warning options)
  1466. if test "${GCC}" = yes; then
  1467. TRY_CFLAGS([-pipe -Wall -W -Wshadow -pedantic])
  1468. fi
  1469. AC_ARG_ENABLE([extra-warnings],
  1470. [AS_HELP_STRING([--enable-extra-warnings],
  1471. [enable extra warnings (gcc specific)]
  1472. )],
  1473. [
  1474. case "${enableval}" in
  1475. error) extrawarnings=error ;;
  1476. yes) extrawarnings=true ;;
  1477. no) extrawarnings=false ;;
  1478. *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
  1479. esac
  1480. ],
  1481. [extrawarnings=false]
  1482. )
  1483. if test "$extrawarnings" = true || test "$extrawarnings" = error; then
  1484. TRY_CFLAGS([-g -O2 -g2 -Wall -Wmissing-declarations -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security])
  1485. TRY_LDFLAGS([-Wl,--as-needed])
  1486. if test "$extrawarnings" = error; then
  1487. AS_VAR_APPEND([CFLAGS], [" -Werror"])
  1488. AS_VAR_APPEND([LDFLAGS], [" -Wl,--fatal-warnings"])
  1489. fi
  1490. fi
  1491. dnl build version-id
  1492. LIGHTTPD_VERSION_ID=m4_format([0x%x%02x%02x], m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))
  1493. AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
  1494. AC_CONFIG_FILES([\
  1495. distribute.sh \
  1496. doc/config/conf.d/Makefile \
  1497. doc/config/Makefile \
  1498. doc/config/vhosts.d/Makefile \
  1499. doc/Makefile \
  1500. doc/outdated/Makefile \
  1501. doc/scripts/Makefile \
  1502. doc/systemd/Makefile \
  1503. Makefile \
  1504. src/Makefile \
  1505. tests/docroot/Makefile \
  1506. tests/docroot/www/indexfile/Makefile \
  1507. tests/docroot/www/Makefile \
  1508. tests/Makefile \
  1509. ])
  1510. AC_OUTPUT
  1511. do_build="\
  1512. mod_access \
  1513. mod_accesslog \
  1514. mod_ajp13 \
  1515. mod_alias \
  1516. mod_auth \
  1517. mod_authn_file \
  1518. mod_cgi \
  1519. mod_deflate \
  1520. mod_dirlisting \
  1521. mod_evhost \
  1522. mod_expire \
  1523. mod_extforward \
  1524. mod_fastcgi \
  1525. mod_flv_streaming \
  1526. mod_indexfile \
  1527. mod_proxy \
  1528. mod_redirect \
  1529. mod_rewrite \
  1530. mod_rrdtool \
  1531. mod_scgi \
  1532. mod_secdownload \
  1533. mod_setenv \
  1534. mod_simple_vhost \
  1535. mod_sockproxy \
  1536. mod_ssi \
  1537. mod_staticfile \
  1538. mod_status \
  1539. mod_userdir \
  1540. mod_usertrack \
  1541. mod_vhostdb \
  1542. mod_webdav \
  1543. mod_wstunnel \
  1544. "
  1545. lighty_track_feature() {
  1546. if eval "$3"; then
  1547. enable_feature="$enable_feature $1"
  1548. do_build="$do_build $2"
  1549. else
  1550. disable_feature="$disable_feature $1"
  1551. no_build="$no_build $2"
  1552. fi
  1553. }
  1554. lighty_track_feature "regex-conditionals" "" \
  1555. 'test "$WITH_PCRE" != no'
  1556. lighty_track_feature "storage-gdbm" "" \
  1557. 'test "$WITH_GDBM" != no'
  1558. lighty_track_feature "storage-memcached" "" \
  1559. 'test "$WITH_MEMCACHED" != no'
  1560. lighty_track_feature "" "mod_trigger_b4_dl" \
  1561. 'test "$BUILD_MOD_TRIGGER_B4_DL" != no'
  1562. lighty_track_feature "mysql" "mod_authn_mysql mod_mysql_vhost mod_vhostdb_mysql" \
  1563. 'test "$WITH_MYSQL" != no'
  1564. lighty_track_feature "postgresql" "mod_vhostdb_pgsql" \
  1565. 'test "$WITH_PGSQL" != no'
  1566. lighty_track_feature "dbi" "mod_authn_dbi mod_vhostdb_dbi" \
  1567. 'test "$WITH_DBI" != no'
  1568. lighty_track_feature "lua" "mod_cml mod_magnet" \
  1569. 'test "$WITH_LUA" != no'
  1570. lighty_track_feature "geoip" "mod_geoip" \
  1571. 'test "$WITH_GEOIP" != no'
  1572. lighty_track_feature "maxminddb" "mod_maxminddb" \
  1573. 'test "$WITH_MAXMINDDB" != no'
  1574. lighty_track_feature "compress-gzip compress-deflate" "" \
  1575. 'test "$WITH_ZLIB" != no'
  1576. lighty_track_feature "compress-bzip2" "" \
  1577. 'test "$WITH_BZIP2" != no'
  1578. lighty_track_feature "compress-brotli" "" \
  1579. 'test "$WITH_BROTLI" != no'
  1580. lighty_track_feature "kerberos" "mod_authn_gssapi" \
  1581. 'test "$WITH_KRB5" != no'
  1582. lighty_track_feature "ldap" "mod_authn_ldap mod_vhostdb_ldap" \
  1583. 'test "$WITH_LDAP" != no'
  1584. lighty_track_feature "pam" "mod_authn_pam" \
  1585. 'test "$WITH_PAM" != no'
  1586. lighty_track_feature "network-openssl" "mod_openssl" \
  1587. 'test "$WITH_OPENSSL" != no'
  1588. lighty_track_feature "network-mbedtls" "mod_mbedtls" \
  1589. 'test "$WITH_MBEDTLS" != no'
  1590. lighty_track_feature "network-gnutls" "mod_gnutls" \
  1591. 'test "$WITH_GNUTLS" != no'
  1592. lighty_track_feature "network-nss" "mod_nss" \
  1593. 'test "$WITH_NSS" != no'
  1594. lighty_track_feature "network-wolfssl" "mod_wolfssl" \
  1595. 'test "$WITH_WOLFSSL" != no'
  1596. lighty_track_feature "auth-crypt" "" \
  1597. 'test "$found_crypt" != no'
  1598. lighty_track_feature "network-ipv6" "" \
  1599. 'test "$ac_cv_ipv6_support" != no'
  1600. lighty_track_feature "large-files" "" \
  1601. 'test "$ENABLE_LFS" = yes'
  1602. case "$host_os" in
  1603. *linux* )
  1604. lighty_track_feature "stat-cache-inotify" "" \
  1605. 'test "$ac_cv_header_sys_inotify_h" != no'
  1606. ;;
  1607. * ) ;;
  1608. esac
  1609. case "$host_os" in
  1610. *bsd*|*darwin* )
  1611. lighty_track_feature "stat-cache-kqueue" "" \
  1612. 'test "$ac_cv_func_kqueue" != no'
  1613. ;;
  1614. * ) ;;
  1615. esac
  1616. case "$host_os" in
  1617. *bsd*|*darwin*|*linux* )
  1618. ;;
  1619. * )
  1620. lighty_track_feature "stat-cache-fam" "" \
  1621. 'test "$WITH_FAM" != no'
  1622. ;;
  1623. esac
  1624. lighty_track_feature "webdav-properties" "" \
  1625. 'test "$WITH_WEBDAV_PROPS" != no'
  1626. lighty_track_feature "webdav-locks" "" \
  1627. 'test "$WITH_WEBDAV_LOCKS" != no'
  1628. dnl output
  1629. $ECHO
  1630. $ECHO "Plugins:"
  1631. $ECHO
  1632. $ECHO "enabled: "
  1633. for p in $do_build; do
  1634. $ECHO " $p"
  1635. done | sort
  1636. $ECHO "disabled: "
  1637. for p in $no_build; do
  1638. $ECHO " $p"
  1639. done | sort
  1640. $ECHO
  1641. $ECHO "Features:"
  1642. $ECHO
  1643. $ECHO "enabled: "
  1644. for p in $enable_feature; do
  1645. $ECHO " $p"
  1646. done | sort
  1647. $ECHO "disabled: "
  1648. for p in $disable_feature; do
  1649. $ECHO " $p"
  1650. done | sort
  1651. $ECHO