Browse Source

[WIP] build systems cleanup

personal/stbuehler/cleanup-build
Stefan Bühler 4 years ago
parent
commit
ebf8b11abb
  1. 4
      INSTALL
  2. 134
      SConstruct
  3. 129
      configure.ac
  4. 6
      meson_options.txt
  5. 2
      src/SConscript
  6. 6
      src/algo_sha1.c
  7. 2
      src/algo_sha1.h
  8. 4
      src/array.h
  9. 4
      src/base.h
  10. 2
      src/buffer.c
  11. 2
      src/configfile-glue.c
  12. 18
      src/configfile.c
  13. 2
      src/configparser.y
  14. 2
      src/data_config.c
  15. 27
      src/fdevent.h
  16. 2
      src/fdevent_libev.c
  17. 6
      src/keyvalue.c
  18. 4
      src/keyvalue.h
  19. 42
      src/md5.c
  20. 448
      src/meson.build
  21. 16
      src/mod_accesslog.c
  22. 8
      src/mod_authn_file.c
  23. 3
      src/mod_authn_ldap.c
  24. 10
      src/mod_cml.c
  25. 4
      src/mod_cml.h
  26. 2
      src/mod_cml_funcs.c
  27. 2
      src/mod_cml_lua.c
  28. 27
      src/mod_compress.c
  29. 56
      src/mod_deflate.c
  30. 32
      src/mod_dirlisting.c
  31. 11
      src/mod_fastcgi.c
  32. 4
      src/mod_openssl.c
  33. 4
      src/mod_redirect.c
  34. 12
      src/mod_rewrite.c
  35. 12
      src/mod_secdownload.c
  36. 4
      src/mod_status.c
  37. 60
      src/mod_trigger_b4_dl.c
  38. 2
      src/mod_vhostdb_ldap.c
  39. 51
      src/mod_webdav.c
  40. 55
      src/network_backends.h
  41. 4
      src/plugin.c
  42. 13
      src/rand.c
  43. 60
      src/server.c
  44. 86
      src/settings.h
  45. 50
      src/stat_cache.c
  46. 3
      tests/Makefile.am
  47. 14
      tests/fcgi-auth.c
  48. 14
      tests/fcgi-responder.c
  49. 25
      tests/meson.build
  50. 2
      tests/scgi-responder.c

4
INSTALL

@ -42,6 +42,10 @@ configurable variables that might be set in a customized build. build_static=1
can be replaced with build_fullstatic=1 to perform lighttpd static build with
modules *and* to link statically against external dependencies.
full-static build using SCons
-----------------------------
$ scons with_all=1 with_pgsql=0 with_ldap=0 with_krb5=0 with_geoip=0 with_memcached=0 build_fullstatic=1 build_dynamic=0
static build using make
-----------------------

134
SConstruct

@ -333,16 +333,10 @@ if 1:
)
autoconf.haveCHeaders([
'arpa/inet.h',
'crypt.h',
'fcntl.h',
'getopt.h',
'inttypes.h',
'linux/random.h',
'netinet/in.h',
'poll.h',
'port.h',
'pwd.h',
'stdint.h',
'stdlib.h',
'string.h',
'strings.h',
@ -352,47 +346,42 @@ if 1:
'sys/filio.h',
'sys/mman.h',
'sys/poll.h',
'sys/port.h',
'sys/prctl.h',
'sys/resource.h',
'sys/select.h',
'sys/sendfile.h',
'sys/socket.h',
'sys/time.h',
'sys/uio.h',
'sys/un.h',
'sys/wait.h',
'syslog.h',
'unistd.h',
'winsock2.h',
# "have" the last header if we include others before?
['sys/time.h', 'sys/types.h', 'sys/resource.h'],
['sys/types.h', 'netinet/in.h'],
['sys/types.h', 'sys/event.h'],
['sys/types.h', 'sys/mman.h'],
['sys/types.h', 'sys/select.h'],
['sys/types.h', 'sys/socket.h'],
['sys/types.h', 'sys/uio.h'],
['sys/types.h', 'sys/un.h'],
])
# headers checked in special autoconf macros
autoconf.haveCHeaders([
'inttypes.h',
'stdint.h',
'sys/wait.h',
])
autoconf.haveFuncs([
'arc4random_buf',
'chroot',
'clock_gettime',
'dup2',
'epoll_ctl',
'explicit_bzero',
'fork',
'getcwd',
'gethostbyname',
'getloadavg',
'getopt',
'getrlimit',
'getuid',
'inet_ntoa',
'inet_ntop',
'gmtime_r',
'inet_pton',
'issetugid',
'jrand48',
@ -401,60 +390,48 @@ if 1:
'lstat',
'madvise',
'memset_s',
'memset',
'mmap',
'munmap',
'pathconf',
'pipe2',
'poll',
'port_create',
'posix_fadvise',
'prctl',
'select',
'send_file',
'sendfile',
'sendfile64',
'sigaction',
'signal',
'socket',
'srandom',
'stat',
'strchr',
'strdup',
'strerror',
'strftime',
'strstr',
'strtol',
'writev',
])
autoconf.haveFunc('getentropy', 'sys/random.h')
autoconf.haveFunc('getrandom', 'linux/random.h')
autoconf.haveTypes(Split('pid_t size_t off_t'))
# have crypt_r/crypt, and is -lcrypt needed?
if autoconf.CheckLib('crypt'):
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_LIBCRYPT' ],
LIBCRYPT = 'crypt',
)
with autoconf.restoreEnvLibs():
autoconf.env['LIBS'] = ['crypt']
autoconf.haveFuncs(['crypt', 'crypt_r'])
else:
autoconf.haveFuncs(['crypt', 'crypt_r'])
if autoconf.CheckType('socklen_t', '#include <unistd.h>\n#include <sys/socket.h>\n#include <sys/types.h>'):
if autoconf.haveCHeader('crypt.h'):
if autoconf.haveFunc('crypt_r'):
pass
elif autoconf.haveFuncInLib('crypt_r', 'crypt'):
autoconf.env.Append(LIBCRYPT = [ 'crypt' ])
if autoconf.haveFunc('crypt'):
pass
elif autoconf.haveFuncInLib('crypt', 'crypt'):
autoconf.env.Append(LIBCRYPT = [ 'crypt' ])
if autoconf.CheckType('socklen_t', '#include <sys/types.h>\n#include <sys/socket.h>'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_SOCKLEN_T' ])
if autoconf.CheckType('struct sockaddr_storage', '#include <sys/socket.h>\n'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_SOCKADDR_STORAGE' ])
if autoconf.CheckCHeader('sys/random.h'):
autoconf.haveFunc('getentropy', 'sys/random.h')
if autoconf.CheckLibWithHeader('rt', 'time.h', 'c', 'clock_gettime(CLOCK_MONOTONIC, (struct timespec*)0);'):
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_CLOCK_GETTIME' ],
LIBS = [ 'rt' ],
)
if autoconf.haveCHeader('linux/random.h'):
autoconf.haveFunc('getrandom', 'linux/random.h')
if not autoconf.CheckFunc('clock_gettime'):
# maybe we need -lrt for clock_gettime
if autoconf.CheckLibWithHeader('rt', 'time.h', 'c', 'clock_gettime(CLOCK_MONOTONIC, (struct timespec*)0);'):
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_CLOCK_GETTIME' ],
LIBS = [ 'rt' ],
)
if autoconf.CheckIPv6():
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_IPV6' ])
@ -463,20 +440,21 @@ if 1:
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_WEAK_SYMBOLS' ])
if autoconf.CheckGmtOffInStructTm():
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_TM_GMTOFF' ])
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_TM_TM_GMTOFF' ])
if autoconf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
autoconf.env.Append(LIBDL = 'dl')
# used in tests if present
if autoconf.CheckLibWithHeader('fcgi', 'fastcgi.h', 'C'):
autoconf.env.Append(LIBFCGI = 'fcgi')
if autoconf.CheckLib('fcgi'):
if autoconf.haveCHeader('fcgi_stdio.h') or autoconf.haveCHeader('fastcgi/fcgi_stdio.h'):
autoconf.env.Append(LIBFCGI = 'fcgi')
if env['with_bzip2']:
if not autoconf.CheckLibWithHeader('bz2', 'bzlib.h', 'C'):
fail("Couldn't find bz2")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_BZLIB_H', '-DHAVE_LIBBZ2' ],
CPPFLAGS = [ '-DWITH_BZIP' ],
LIBBZ2 = 'bz2',
)
@ -484,7 +462,7 @@ if 1:
if not autoconf.CheckLibWithHeader('dbi', 'dbi/dbi.h', 'C'):
fail("Couldn't find dbi")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_DBI_H', '-DHAVE_LIBDBI' ],
CPPFLAGS = [ '-DWITH_DBI' ],
LIBDBI = 'dbi',
)
@ -492,16 +470,16 @@ if 1:
if not autoconf.CheckLibWithHeader('fam', 'fam.h', 'C'):
fail("Couldn't find fam")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_FAM_H', '-DHAVE_LIBFAM' ],
CPPFLAGS = [ '-DWITH_FAM' ],
LIBS = [ 'fam' ],
)
autoconf.haveFunc('FAMNoExists')
autoconf.haveFunc('FAMNoExists');
if env['with_gdbm']:
if not autoconf.CheckLibWithHeader('gdbm', 'gdbm.h', 'C'):
fail("Couldn't find gdbm")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_GDBM_H', '-DHAVE_GDBM' ],
CPPFLAGS = [ '-DWITH_GDBM' ],
LIBGDBM = 'gdbm',
)
@ -509,7 +487,7 @@ if 1:
if not autoconf.CheckLibWithHeader('GeoIP', 'GeoIP.h', 'C'):
fail("Couldn't find geoip")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_GEOIP' ],
CPPFLAGS = [ '-DWITH_GEOIP' ],
LIBGEOIP = 'GeoIP',
)
@ -519,7 +497,7 @@ if 1:
if not autoconf.CheckLibWithHeader('gssapi_krb5', 'gssapi/gssapi_krb5.h', 'C'):
fail("Couldn't find gssapi_krb5")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_KRB5' ],
CPPFLAGS = [ '-DWITH_KRB5' ],
LIBKRB5 = 'krb5',
LIBGSSAPI_KRB5 = 'gssapi_krb5',
)
@ -530,11 +508,7 @@ if 1:
if not autoconf.CheckLibWithHeader('lber', 'lber.h', 'C'):
fail("Couldn't find lber")
autoconf.env.Append(
CPPFLAGS = [
'-DLDAP_DEPRECATED=1',
'-DHAVE_LDAP_H', '-DHAVE_LIBLDAP',
'-DHAVE_LBER_H', '-DHAVE_LIBLBER',
],
CPPFLAGS = [ '-DWITH_LDAP' ],
LIBLDAP = 'ldap',
LIBLBER = 'lber',
)
@ -544,7 +518,7 @@ if 1:
for lua_name in ['lua5.3', 'lua-5.3', 'lua5.2', 'lua-5.2', 'lua5.1', 'lua-5.1', 'lua']:
print("Searching for lua: " + lua_name + " >= 5.0")
if autoconf.CheckParseConfigForLib('LIBLUA', "pkg-config '" + lua_name + " >= 5.0' --cflags --libs"):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LUA_H' ])
autoconf.env.Append(CPPFLAGS = [ '-DWITH_LUA' ])
found_lua = True
break
if not found_lua:
@ -554,7 +528,7 @@ if 1:
if not autoconf.CheckLibWithHeader('memcached', 'libmemcached/memcached.h', 'C'):
fail("Couldn't find memcached")
autoconf.env.Append(
CPPFLAGS = [ '-DUSE_MEMCACHED' ],
CPPFLAGS = [ '-DWITH_MEMCACHED' ],
LIBMEMCACHED = 'memcached',
)
@ -562,13 +536,13 @@ if 1:
mysql_config = autoconf.checkProgram('mysql', 'mysql_config')
if not autoconf.CheckParseConfigForLib('LIBMYSQL', mysql_config + ' --cflags --libs'):
fail("Couldn't find mysql")
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_MYSQL_H', '-DHAVE_LIBMYSQL' ])
autoconf.env.Append(CPPFLAGS = [ '-DWITH_MYSQL' ])
if env['with_openssl']:
if not autoconf.CheckLibWithHeader('ssl', 'openssl/ssl.h', 'C'):
fail("Couldn't find openssl")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_OPENSSL_SSL_H', '-DHAVE_LIBSSL'],
CPPFLAGS = [ '-DWITH_OPENSSL' ] ,
LIBSSL = 'ssl',
LIBCRYPTO = 'crypto',
)
@ -577,18 +551,18 @@ if 1:
pcre_config = autoconf.checkProgram('pcre', 'pcre-config')
if not autoconf.CheckParseConfigForLib('LIBPCRE', pcre_config + ' --cflags --libs'):
fail("Couldn't find pcre")
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_PCRE_H', '-DHAVE_LIBPCRE' ])
autoconf.env.Append(CPPFLAGS = [ '-DWITH_PCRE' ])
if env['with_pgsql']:
if not autoconf.CheckParseConfigForLib('LIBPGSQL', 'pkg-config libpq --cflags --libs'):
fail("Couldn't find libpq")
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_PGSQL_H', '-DHAVE_LIBPGSQL' ])
autoconf.env.Append(CPPFLAGS = [ '-DWITH_PGSQL' ])
if env['with_sqlite3']:
if not autoconf.CheckLibWithHeader('sqlite3', 'sqlite3.h', 'C'):
fail("Couldn't find sqlite3")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_SQLITE3_H', '-DHAVE_LIBSQLITE3' ],
CPPFLAGS = [ '-DWITH_SQLITE3' ],
LIBSQLITE3 = 'sqlite3',
)
@ -596,7 +570,7 @@ if 1:
if not autoconf.CheckLibWithHeader('uuid', 'uuid/uuid.h', 'C'):
fail("Couldn't find uuid")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_UUID_UUID_H', '-DHAVE_LIBUUID' ],
CPPFLAGS = [ '-DWITH_UUID' ],
LIBUUID = 'uuid',
)
@ -604,13 +578,13 @@ if 1:
xml2_config = autoconf.checkProgram('xml', 'xml2-config')
if not autoconf.CheckParseConfigForLib('LIBXML2', xml2_config + ' --cflags --libs'):
fail("Couldn't find xml2")
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LIBXML_H', '-DHAVE_LIBXML2' ])
autoconf.env.Append(CPPFLAGS = [ '-DWITH_XML' ])
if env['with_zlib']:
if not autoconf.CheckLibWithHeader('z', 'zlib.h', 'C'):
fail("Couldn't find zlib")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_ZLIB_H', '-DHAVE_LIBZ' ],
CPPFLAGS = [ '-DWITH_ZLIB' ],
LIBZ = 'z',
)

129
configure.ac

@ -122,18 +122,16 @@ AC_CHECK_HEADERS([\
sys/uio.h \
sys/un.h \
syslog.h \
uuid/uuid.h \
])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBER([struct tm.tm_gmtoff],
[AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],
[], dnl defines HAVE_STRUCT_TM_TM_GMTOFF
[],
[#include <time.h>]
)
@ -160,11 +158,7 @@ dnl need dlopen/-ldl to load plugins (when not on windows)
save_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS([dlopen], [dl], [
AC_CHECK_HEADERS([dlfcn.h], [
DL_LIB=$LIBS
AC_DEFINE([HAVE_LIBDL], [1], [libdl])
AC_DEFINE([HAVE_DLFCN_H], [1])
])
AC_CHECK_HEADERS([dlfcn.h], [DL_LIB=$LIBS])
])
LIBS=$save_LIBS
AC_SUBST([DL_LIB])
@ -198,7 +192,7 @@ if test "$WITH_LIBEV" != no; then
LIBEV_CFLAGS="-I$WITH_LIBEV/include"
LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
else
AC_CHECK_HEADERS([ev.h],
AC_CHECK_HEADER([ev.h],
[AC_CHECK_LIB([ev], [ev_time],
[
LIBEV_CFLAGS=
@ -211,7 +205,7 @@ if test "$WITH_LIBEV" != no; then
fi
])
AC_DEFINE([HAVE_LIBEV], [1], [libev support])
AC_DEFINE([WITH_LIBEV], [1], [libev])
fi
AC_SUBST([LIBEV_CFLAGS])
@ -259,7 +253,7 @@ if test "$WITH_MYSQL" != no; then
AC_MSG_CHECKING([for MySQL libraries at])
AC_MSG_RESULT([$MYSQL_LIBS])
AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
AC_DEFINE([WITH_MYSQL], [1], [mysql])
fi
AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
@ -304,7 +298,7 @@ if test "$WITH_PGSQL" != no; then
AC_MSG_CHECKING([for PgSQL libraries at])
AC_MSG_RESULT([$PGSQL_LIBS])
AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
AC_DEFINE([WITH_PGSQL], [1], [pgsql])
fi
AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
@ -331,7 +325,7 @@ if test "$WITH_DBI" != no; then
DBI_CFLAGS="-I$WITH_LIBDBI/include"
DBI_LIBS="-L$WITH_LIBDBI/lib -ldbi"
else
AC_CHECK_HEADERS([dbi/dbi.h],
AC_CHECK_HEADER([dbi/dbi.h],
[AC_CHECK_LIB([dbi], [dbi_version],
[
DBI_CFLAGS=
@ -343,7 +337,7 @@ if test "$WITH_DBI" != no; then
)
fi
AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
AC_DEFINE([WITH_DBI], [1], [LibDBI support])
fi
AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
@ -363,30 +357,20 @@ AC_MSG_RESULT([$WITH_LDAP])
if test "$WITH_LDAP" != no; then
AC_CHECK_LIB([ldap], [ldap_bind],
[AC_CHECK_HEADERS([ldap.h],
[
LDAP_LIB=-lldap
AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
AC_DEFINE([HAVE_LDAP_H], [1])
AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
],
[AC_CHECK_HEADER([ldap.h], [LDAP_LIB=-lldap],
[AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
)],
[AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
)
AC_SUBST([LDAP_LIB])
AC_CHECK_LIB([lber], [ber_printf],
[AC_CHECK_HEADERS([lber.h],
[
LBER_LIB=-llber
AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
AC_DEFINE([HAVE_LBER_H], [1])
],
[AC_CHECK_HEADER([lber.h], [LBER_LIB=-llber],
[AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
)],
[AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
)
AC_SUBST([LBER_LIB])
AC_DEFINE([WITH_LDAP], [1], [LDAP])
fi
AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
@ -404,10 +388,9 @@ if test "$WITH_ATTR" != no; then
have_xattr=no
# libattr (linux only?)
AC_CHECK_LIB([attr], [attr_get], [
AC_CHECK_HEADERS([attr/attributes.h], [
AC_CHECK_HEADER([attr/attributes.h], [
ATTR_LIB=-lattr
AC_DEFINE([HAVE_XATTR], [1], [libattr])
AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
AC_DEFINE([HAVE_LIBATTR], [1], [libattr])
have_xattr=yes
])
])
@ -415,9 +398,8 @@ if test "$WITH_ATTR" != no; then
# (Free)BSD extattr
AC_CHECK_FUNC([extattr_get_file], [
AC_CHECK_HEADERS([sys/extattr.h], [
AC_CHECK_HEADER([sys/extattr.h], [
AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
have_xattr=yes
])
])
@ -425,6 +407,7 @@ if test "$WITH_ATTR" != no; then
if test "$have_xattr" = no; then
AC_MSG_ERROR([no backend found implementing extended attributes])
fi
AC_DEFINE([WITH_XATTR], [1], [xattr])
fi
dnl Check for valgrind
@ -440,9 +423,10 @@ AC_ARG_WITH([valgrind],
AC_MSG_RESULT([$WITH_VALGRIND])
if test "$WITH_VALGRIND" != no; then
AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
AC_CHECK_HEADER([valgrind/valgrind.h], [], [
AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
])
AC_DEFINE([WITH_VALGRIND], [1], [valgrind])
fi
dnl Checking for libunwind
@ -461,7 +445,7 @@ if test "$WITH_LIBUNWIND" != no; then
PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
])
AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
AC_DEFINE([WITH_LIBUNWIND], [1], [libunwind])
fi
dnl Checking for kerberos5
@ -512,10 +496,9 @@ if test "$WITH_KRB5" != no; then
LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
[AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
[AC_CHECK_HEADER([gssapi/gssapi_krb5.h],
[
KRB5_LIB="-lkrb5 -lgssapi_krb5"
AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
],
[AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
)],
@ -525,6 +508,8 @@ if test "$WITH_KRB5" != no; then
*darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
* ) ;;
esac
AC_DEFINE([WITH_KRB5], [1], [krb5])
fi
AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
@ -578,27 +563,24 @@ AC_ARG_WITH([openssl-libs],
AM_CONDITIONAL([BUILD_WITH_OPENSSL], [test "$WITH_OPENSSL" != no])
if test "$WITH_OPENSSL" != no; then
if test "$WITH_KRB5" != no; then
AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
fi
CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
AC_CHECK_HEADERS([openssl/ssl.h], [], [
AC_CHECK_HEADER([openssl/ssl.h], [], [
AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
])
AC_CHECK_LIB([crypto], [BIO_f_base64],
[CRYPTO_LIB="-lcrypto"],
[AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
)
AC_CHECK_LIB([ssl], [SSL_new],
[SSL_LIB="-lssl -lcrypto"],
[AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
[AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])]
[ -lcrypto "$DL_LIB" ]
)
AC_DEFINE([HAVE_LIBSSL], [], [Have libssl])
AC_DEFINE([WITH_OPENSSL], [], [openssl])
AC_SUBST([SSL_LIB])
AC_SUBST([CRYPTO_LIB])
fi
@ -629,8 +611,7 @@ if test "$WITH_PCRE" != no; then
AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
fi
AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
AC_DEFINE([WITH_PCRE], [1], [pcre])
AC_SUBST([PCRE_LIB])
fi
@ -651,7 +632,7 @@ if test "$WITH_ZLIB" != no; then
Z_LIB="-L$WITH_ZLIB -lz"
CPPFLAGS="$CPPFLAGS -I$WITH_ZLIB"
else
AC_CHECK_HEADERS([zlib.h], [],
AC_CHECK_HEADER([zlib.h], [],
[AC_MSG_ERROR([zlib headers not found, install them or build without --with-zlib])]
)
AC_CHECK_LIB([z], [deflate],
@ -660,8 +641,7 @@ if test "$WITH_ZLIB" != no; then
)
fi
AC_DEFINE([HAVE_LIBZ], [1], [libz])
AC_DEFINE([HAVE_ZLIB_H], [1])
AC_DEFINE([WITH_ZLIB], [1], [zlib])
AC_SUBST([Z_LIB])
fi
@ -682,7 +662,7 @@ if test "$WITH_BZIP2" != no; then
BZ_LIB="-L$WITH_BZIP2 -lbz2"
CPPFLAGS="$CPPFLAGS -I$WITH_BZIP2"
else
AC_CHECK_HEADERS([bzlib.h], [], [
AC_CHECK_HEADER([bzlib.h], [], [
AC_MSG_ERROR([bzip2 headers not found, install them or build without --with-bzip2])
])
AC_CHECK_LIB([bz2], [BZ2_bzCompress],
@ -691,8 +671,7 @@ if test "$WITH_BZIP2" != no; then
)
fi
AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
AC_DEFINE([HAVE_BZLIB_H], [1])
AC_DEFINE([WITH_BZIP], [1], [bzip2])
AC_SUBST([BZ_LIB])
fi
@ -714,7 +693,7 @@ if test "$WITH_FAM" != no; then
CPPFLAGS="$CPPFLAGS -I$WITH_FAM"
else
AC_CHECK_LIB([fam], [FAMOpen2], [
AC_CHECK_HEADERS([fam.h], [FAM_LIBS=-lfam])
AC_CHECK_HEADER([fam.h], [FAM_LIBS=-lfam])
])
dnl fam has no pkg-config so far, so just search for gamin as fallback
if test -z "$FAM_LIBS"; then
@ -731,8 +710,7 @@ if test "$WITH_FAM" != no; then
AC_CHECK_FUNCS([FAMNoExists])
LIBS=$OLD_LIBS
AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
AC_DEFINE([WITH_FAM], [1], [fam])
AC_SUBST([FAM_LIBS])
fi
@ -770,9 +748,7 @@ if test "$WITH_WEBDAV_PROPS" != no; then
AC_MSG_ERROR([libxml2 not found, install it or build without --with-webdav-props])
])
fi
AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
AC_DEFINE([WITH_XML], [1], [libxml2])
AC_SUBST([XML_LIBS])
AC_SUBST([XML_CFLAGS])
@ -799,8 +775,7 @@ if test "$WITH_WEBDAV_PROPS" != no; then
])
fi
AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
AC_DEFINE([WITH_SQLITE3], [1], [sqlite3])
AC_SUBST([SQLITE_LIBS])
AC_SUBST([SQLITE_CFLAGS])
fi
@ -843,13 +818,12 @@ if test "$WITH_WEBDAV_LOCKS" != no; then
[UUID_LIBS=-luuid],
[AC_MSG_ERROR([uuid lib not found, install it or build without --with-webdav-locks])]
)
AC_CHECK_HEADERS([uuid/uuid.h], [],
AC_CHECK_HEADER([uuid/uuid.h], [],
[AC_MSG_ERROR([uuid headers not found, install them or build without --with-webdav-locks])]
)
fi
AC_DEFINE([HAVE_UUID], [1], [libuuid])
AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
AC_DEFINE([WITH_UUID], [1], [uuid])
AC_SUBST([UUID_LIBS])
fi
@ -872,13 +846,12 @@ if test "$WITH_GDBM" != no; then
[GDBM_LIB=-lgdbm],
[AC_MSG_ERROR([gdbm lib not found, install it or build without --with-gdbm])]
)
AC_CHECK_HEADERS([gdbm.h], [],
AC_CHECK_HEADER([gdbm.h], [],
[AC_MSG_ERROR([gdbm headers not found, install them or build without --with-gdbm])]
)
fi
AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
AC_DEFINE([HAVE_GDBM_H], [1])
AC_DEFINE([WITH_GDBM], [1], [gdbm])
AC_SUBST([GDBM_LIB])
fi
AM_CONDITIONAL([BUILD_WITH_GDBM], [test "$WITH_GDBM" != no])
@ -902,13 +875,12 @@ if test "$WITH_GEOIP" != no; then
[GEOIP_LIB=-lGeoIP],
[AC_MSG_ERROR([GeoIP lib not found, install it or build without --with-geoip])]
)
AC_CHECK_HEADERS([GeoIP.h], [],
AC_CHECK_HEADER([GeoIP.h], [],
[AC_MSG_ERROR([GeoIP headers not found, install them or build without --with-geoip])]
)
fi
AC_DEFINE([HAVE_GEOIP], [1], [libGeoIP])
AC_DEFINE([HAVE_GEOIP_H], [1])
AC_DEFINE([WITH_GEOIP], [1], [GeoIP])
AC_SUBST([GEOIP_LIB])
fi
AM_CONDITIONAL([BUILD_WITH_GEOIP], [test "$WITH_GEOIP" != no])
@ -934,12 +906,12 @@ if test "$WITH_MEMCACHED" != no; then
[ MEMCACHED_LIB=-lmemcached ],
[AC_MSG_ERROR([memcached lib not found, install it or build without --with-memcached])]
)
AC_CHECK_HEADERS([libmemcached/memcached.h], [],
AC_CHECK_HEADER([libmemcached/memcached.h], [],
[AC_MSG_ERROR([memcached headers not found, install them or build without --with-memcached])]
)
fi
AC_DEFINE([USE_MEMCACHED], [1], [libmemcached])
AC_DEFINE([WITH_MEMCACHED], [1], [memcached])
AC_SUBST([MEMCACHED_LIB])
fi
AM_CONDITIONAL([BUILD_WITH_MEMCACHED], [test "$WITH_MEMCACHED" != no])
@ -986,8 +958,7 @@ if test "$WITH_LUA" != no; then
fi
fi
AC_DEFINE([HAVE_LUA], [1], [liblua])
AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
AC_DEFINE([WITH_LUA], [1], [lua])
AC_SUBST([LUA_LIBS])
AC_SUBST([LUA_CFLAGS])
fi
@ -1065,7 +1036,6 @@ AC_CHECK_FUNCS([\
localtime_r \
lstat \
madvise \
memset \
memset_s \
mmap \
pathconf \
@ -1081,7 +1051,7 @@ AC_CHECK_FUNCS([\
srandom \
writev \
])
AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
AC_CHECK_HEADER([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
AC_MSG_NOTICE([----------------------------------------])
@ -1211,9 +1181,12 @@ dnl check for fastcgi lib, for the tests only
AC_MSG_NOTICE([----------------------------------------])
fastcgi_found=no
AC_CHECK_LIB([fcgi], [FCGI_Accept], [
AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h], [
fastcgi_found=yes
])
AC_CHECK_HEADERS([fcgi_stdio.h fastcgi/fcgi_stdio.h],
[
fastcgi_found=yes
break # only need one header
]
)
])
AM_CONDITIONAL([CHECK_WITH_FASTCGI], [test "$fastcgi_found" = yes])

6
meson_options.txt

@ -116,6 +116,12 @@ option('build_static',
description: 'build a static lighttpd with all modules added',
)
option('link_static',
type: 'boolean',
value: false,
description: 'try to link dependencies statically',
)
option('moduledir',
type: 'string',
value: 'lib/lighttpd',

2
src/SConscript

@ -47,7 +47,7 @@ def WorkaroundFreeBSDLibOrder(libs):
return libs
def GatherLibs(env, *libs):
libs = RemoveDuplicateLibs(env['LIBS'] + list(libs) + [env['APPEND_LIBS']])
libs = RemoveDuplicateLibs(list(env['LIBS']) + list(libs) + [env['APPEND_LIBS']])
return WorkaroundFreeBSDLibOrder(libs)
common_src = Split("base64.c buffer.c log.c \

6
src/algo_sha1.c

@ -1,11 +1,7 @@
#include "first.h"
typedef int innocuous_typedef_to_quiet_empty_translation_unit_compiler_warning;
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#define USE_OPENSSL_CRYPTO
#endif
#ifndef USE_OPENSSL_CRYPTO
#if !defined(WITH_OPENSSL)
#include "sys-endian.h"
#include "algo_sha1.h"

2
src/algo_sha1.h

@ -2,7 +2,7 @@
#define INCLUDED_ALGO_SHA1_H
#include "first.h"
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#if defined(WITH_OPENSSL)
#include <openssl/sha.h>

4
src/array.h

@ -2,7 +2,7 @@
#define ARRAY_H
#include "first.h"
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
# include <pcre.h>
#endif
@ -118,7 +118,7 @@ struct data_config {
data_config *next;
buffer *string;
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
pcre *regex;
pcre_extra *regex_study;
#endif

4
src/base.h

@ -204,7 +204,7 @@ typedef struct {
char is_symlink;
#endif
#ifdef HAVE_FAM_H
#if defined(WITH_FAM)
int dir_version;
#endif
@ -474,7 +474,7 @@ typedef struct {
enum { STAT_CACHE_ENGINE_UNSET,
STAT_CACHE_ENGINE_NONE,
STAT_CACHE_ENGINE_SIMPLE
#ifdef HAVE_FAM_H
#if defined(WITH_FAM)
, STAT_CACHE_ENGINE_FAM
#endif
} stat_cache_engine;

2
src/buffer.c

@ -1017,7 +1017,7 @@ void buffer_to_upper(buffer *b) {
#include <stdio.h>
#ifdef HAVE_LIBUNWIND
#if defined(WITH_LIBUNWIND)
# define UNW_LOCAL_ONLY
# include <libunwind.h>

2
src/configfile-glue.c

@ -540,7 +540,7 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat
return (dc->cond == CONFIG_COND_EQ) ? COND_RESULT_FALSE : COND_RESULT_TRUE;
}
break;
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
case CONFIG_COND_NOMATCH:
case CONFIG_COND_MATCH: {
int n;

18
src/configfile.c

@ -24,7 +24,7 @@
#include <glob.h>
#if defined(HAVE_MYSQL) || (defined(HAVE_LDAP_H) && defined(HAVE_LBER_H) && defined(HAVE_LIBLDAP) && defined(HAVE_LIBLBER))
#if defined(WITH_MYSQL) || defined(WITH_LDAP)
static void config_warn_authn_module (server *srv, const char *module) {
size_t len = strlen(module);
for (size_t i = 0; i < srv->config_context->used; ++i) {
@ -45,7 +45,7 @@ static void config_warn_authn_module (server *srv, const char *module) {
}
#endif
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#if defined(WITH_OPENSSL)
static void config_warn_openssl_module (server *srv) {
for (size_t i = 0; i < srv->config_context->used; ++i) {
const data_config *config = (data_config const*)srv->config_context->data[i];
@ -347,7 +347,7 @@ static int config_insert(server *srv) {
"unexpected value for mimetype.assign; expected list of \"ext\" => \"mimetype\"");
}
#if !(defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H)
#if defined(WITH_OPENSSL)
if (s->ssl_enabled) {
log_error_write(srv, __FILE__, __LINE__, "s",
"ssl support is missing, recompile with --with-openssl");
@ -370,7 +370,7 @@ static int config_insert(server *srv) {
srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE;
} else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("simple"))) {
srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE;
#ifdef HAVE_FAM_H
#if defined(WITH_FAM)
} else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("fam"))) {
srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_FAM;
#endif
@ -379,7 +379,7 @@ static int config_insert(server *srv) {
} else {
log_error_write(srv, __FILE__, __LINE__, "sb",
"server.stat-cache-engine can be one of \"disable\", \"simple\","
#ifdef HAVE_FAM_H
#if defined(WITH_FAM)
" \"fam\","
#endif
" but not:", stat_cache_string);
@ -488,7 +488,7 @@ static int config_insert(server *srv) {
}
if (append_mod_openssl) {
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#if defined(WITH_OPENSSL)
config_warn_openssl_module(srv);
#endif
}
@ -503,12 +503,12 @@ static int config_insert(server *srv) {
array_insert_unique(srv->srvconf.modules, (data_unset *)ds);
}
if (append_mod_authn_ldap) {
#if defined(HAVE_LDAP_H) && defined(HAVE_LBER_H) && defined(HAVE_LIBLDAP) && defined(HAVE_LIBLBER)
#if defined(WITH_LDAP)
config_warn_authn_module(srv, "ldap");
#endif
}
if (append_mod_authn_mysql) {
#if defined(HAVE_MYSQL)
#if defined(WITH_MYSQL)
config_warn_authn_module(srv, "mysql");
#endif
}
@ -1400,7 +1400,7 @@ int config_set_defaults(server *srv) {
#ifdef USE_SELECT
{ FDEVENT_HANDLER_SELECT, "select" },
#endif
#ifdef USE_LIBEV
#if defined(WITH_LIBEV)
{ FDEVENT_HANDLER_LIBEV, "libev" },
#endif
#ifdef USE_SOLARIS_DEVPOLL

2
src/configparser.y

@ -696,7 +696,7 @@ context ::= DOLLAR SRVVARNAME(B) LBRACKET stringop(C) RBRACKET cond(E) expressio
break;
case CONFIG_COND_NOMATCH:
case CONFIG_COND_MATCH: {
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
const char *errptr;
int erroff, captures;

2
src/data_config.c

@ -31,7 +31,7 @@ static void data_config_free(data_unset *d) {
vector_config_weak_clear(&ds->children);
if (ds->string) buffer_free(ds->string);
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
if (ds->regex) pcre_free(ds->regex);
if (ds->regex_study) pcre_free(ds->regex_study);
#endif

27
src/fdevent.h

@ -12,47 +12,36 @@
#include <sys/types.h>
/* select event-system */
#if defined(HAVE_EPOLL_CTL) && defined(HAVE_SYS_EPOLL_H)
# define USE_LINUX_EPOLL
#if defined(USE_LINUX_EPOLL)
struct epoll_event; /* declaration */
#endif
/* MacOS 10.3.x has poll.h under /usr/include/, all other unixes
* under /usr/include/sys/ */
#if defined HAVE_POLL && (defined(HAVE_SYS_POLL_H) || defined(HAVE_POLL_H))
# define USE_POLL
#if defined(USE_POLL)
struct pollfd; /* declaration */
#endif
#if defined HAVE_SELECT
#if defined(USE_SELECT)
# ifdef __WIN32
# include <winsock2.h>
# endif
# define USE_SELECT
# ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
# endif
#endif
#if defined HAVE_SYS_DEVPOLL_H && defined(__sun)
# define USE_SOLARIS_DEVPOLL
#if defined(USE_SOLARIS_DEVPOLL)
struct pollfd; /* declaration */
#endif
#if defined HAVE_PORT_H && defined HAVE_PORT_CREATE && defined(__sun)
# define USE_SOLARIS_PORT
#if defined(USE_SOLARIS_PORT)
# include <port.h>
#endif
#if defined HAVE_SYS_EVENT_H && defined HAVE_KQUEUE
# define USE_FREEBSD_KQUEUE
#if defined(USE_FREEBSD_KQUEUE)
struct kevent; /* declaration */
#endif
#if defined HAVE_LIBEV
# define USE_LIBEV
#if defined(WITH_LIBEV)
struct ev_loop; /* declaration */
#endif
@ -164,7 +153,7 @@ typedef struct fdevents {
#ifdef USE_SOLARIS_PORT
int port_fd;
#endif
#ifdef USE_LIBEV
#if defined(WITH_LIBEV)
struct ev_loop *libev_loop;
#endif
int (*reset)(struct fdevents *ev);

2
src/fdevent_libev.c

@ -6,7 +6,7 @@
#include "buffer.h"
#include "log.h"
#ifdef USE_LIBEV
#if defined(WITH_LIBEV)
# include <ev.h>

6
src/keyvalue.c

@ -180,7 +180,7 @@ pcre_keyvalue_buffer *pcre_keyvalue_buffer_init(void) {
}
int pcre_keyvalue_buffer_append(server *srv, pcre_keyvalue_buffer *kvb, const char *key, const char *value) {
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
size_t i;
const char *errptr;
int erroff;
@ -189,7 +189,7 @@ int pcre_keyvalue_buffer_append(server *srv, pcre_keyvalue_buffer *kvb, const ch
if (!key) return -1;
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
if (kvb->size == 0) {
kvb->size = 4;
kvb->used = 0;
@ -241,7 +241,7 @@ int pcre_keyvalue_buffer_append(server *srv, pcre_keyvalue_buffer *kvb, const ch
}
void pcre_keyvalue_buffer_free(pcre_keyvalue_buffer *kvb) {
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
size_t i;
pcre_keyvalue *kv;

4
src/keyvalue.h

@ -2,7 +2,7 @@
#define _KEY_VALUE_H_
#include "first.h"
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
# include <pcre.h>
#endif
@ -69,7 +69,7 @@ typedef struct {
} keyvalue;
typedef struct {
#ifdef HAVE_PCRE_H
#if defined(WITH_PCRE)
pcre *key;
pcre_extra *key_extra;
#endif

42
src/md5.c

@ -28,13 +28,8 @@ documentation and/or software.
#include "md5.h"
#if 0 /* Note: not defined here or in lighttpd local "md5.h" */
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#define USE_OPENSSL_CRYPTO
#endif
#endif
#ifndef USE_OPENSSL_CRYPTO
/* Note: not defined here or in lighttpd local "md5.h" */
/* #if !defined(WITH_OPENSSL) */
#include <string.h>
/* Constants for MD5Transform routine.
@ -61,16 +56,8 @@ static void li_MD5Transform (UINT4 [4], const unsigned char [64]);
static void Encode (unsigned char *, UINT4 *, unsigned int);
static void Decode (UINT4 *, const unsigned char *, unsigned int);
#ifdef HAVE_MEMCPY
#define MD5_memcpy(output, input, len) memcpy((output), (input), (len))
#else
static void MD5_memcpy (POINTER, POINTER, unsigned int);
#endif
#ifdef HAVE_MEMSET
#define MD5_memset(output, value, len) memset((output), (value), (len))
#else
static void MD5_memset (POINTER, int, unsigned int);
#endif
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -315,27 +302,4 @@ static void Decode (UINT4 *output, const unsigned char *input, unsigned int len)
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
/* Note: Replace "for loop" with standard memcpy if possible.
*/
#ifndef HAVE_MEMCPY
static void MD5_memcpy (POINTER output, POINTER input, unsigned int len)
{
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
}
#endif
/* Note: Replace "for loop" with standard memset if possible.
*/
#ifndef HAVE_MEMSET
static void MD5_memset (POINTER output, int value, unsigned int len)
{
unsigned int i;
for (i = 0; i < len; i++)
((char *)output)[i] = (char)value;
}
#endif
#endif
/* #endif */

448
src/meson.build

@ -1,5 +1,7 @@
sbinddir = join_paths(get_option('prefix'), get_option('sbindir'))
moduledir = join_paths(get_option('prefix'), get_option('moduledir'))
# doesn't do much so far :(
link_static = get_option('link_static')
include_base_paths = [
'/usr/include',
@ -26,71 +28,75 @@ endif
compiler = meson.get_compiler('c')
conf_data = configuration_data()
conf_data.set('HAVE_SYS_DEVPOLL_H', compiler.has_header('sys/devpoll.h'))
conf_data.set('HAVE_SYS_EPOLL_H', compiler.has_header('sys/epoll.h'))
conf_data.set('HAVE_SYS_EVENT_H', compiler.has_header('sys/event.h'))
conf_data.set('HAVE_SYS_MMAN_H', compiler.has_header('sys/mman.h'))
conf_data.set('HAVE_SYS_POLL_H', compiler.has_header('sys/poll.h'))
conf_data.set('HAVE_SYS_PORT_H', compiler.has_header('sys/port.h'))
conf_data.set('HAVE_SYS_PRCTL_H', compiler.has_header('sys/prctl.h'))
conf_data.set('HAVE_SYS_RESOURCE_H', compiler.has_header('sys/resource.h'))
conf_data.set('HAVE_SYS_SENDFILE_H', compiler.has_header('sys/sendfile.h'))
conf_data.set('HAVE_SYS_SELECT_H', compiler.has_header('sys/select.h'))
conf_data.set('HAVE_SYS_TYPES_H', compiler.has_header('sys/types.h'))
conf_data.set('HAVE_SYS_UIO_H', compiler.has_header('sys/uio.h'))
conf_data.set('HAVE_SYS_UN_H', compiler.has_header('sys/un.h'))
conf_data.set('HAVE_SYS_WAIT_H', compiler.has_header('sys/wait.h'))
conf_data.set('HAVE_SYS_TIME_H', compiler.has_header('sys/time.h'))
conf_data.set('HAVE_UNISTD_H', compiler.has_header('unistd.h'))
conf_data.set('HAVE_PTHREAD_H', compiler.has_header('pthread.h'))
conf_data.set('HAVE_GETOPT_H', compiler.has_header('getopt.h'))
conf_data.set('HAVE_INTTYPES_H', compiler.has_header('inttypes.h'))
conf_data.set('HAVE_POLL_H', compiler.has_header('poll.h'))
conf_data.set('HAVE_PWD_H', compiler.has_header('pwd.h'))
conf_data.set('HAVE_STDDEF_H', compiler.has_header('stddef.h'))
conf_data.set('HAVE_STDINT_H', compiler.has_header('stdint.h'))
conf_data.set('HAVE_STRINGS_H', compiler.has_header('strings.h'))
conf_data.set('HAVE_SYSLOG_H', compiler.has_header('syslog.h'))
# check for fastcgi lib, for the tests only
conf_data.set('HAVE_FASTCGI_H', compiler.has_header('fastcgi.h'))
if not(conf_data.get('HAVE_FASTCGI_H'))
conf_data.set('HAVE_FASTCGI_FASTCGI_H', compiler.has_header('fastcgi/fastcgi.h'))
endif
check_headers = [
'getopt.h',
'poll.h',
'port.h',
'pwd.h',
'stdlib.h',
'string.h',
'strings.h',
'sys/devpoll.h',
'sys/epoll.h',
'sys/event.h',
'sys/filio.h',
'sys/mman.h',
'sys/poll.h',
'sys/prctl.h',
'sys/resource.h',
'sys/select.h',
'sys/sendfile.h',
'sys/time.h',
'sys/uio.h',
'sys/un.h',
'syslog.h',
]
# headers checked in special autoconf macros
check_headers += [
'inttypes.h',
'stdint.h',
'sys/wait.h',
]
foreach h: check_headers
conf_data.set('HAVE_' + h.to_upper().underscorify(), compiler.has_header(h))
endforeach
# will be needed for auth
conf_data.set('HAVE_CRYPT_H', compiler.has_header('crypt.h'))
if conf_data.get('HAVE_CRYPT_H')
# check if we need libcrypt for crypt_r / crypt
libcrypt = compiler.find_library('crypt', required: false)
# crypt_r in default libs?
if compiler.has_function('crypt_r', args: defs, prefix: '#include <crypt.h>')
libcrypt = []
conf_data.set('HAVE_CRYPT_R', 1)
# crypt_r in -lcrypt ?
elif compiler.has_function('crypt_r', args: defs + ['-lcrypt'], prefix: '#include <crypt.h>')
libcrypt = [ compiler.find_library('crypt') ]
elif libcrypt.found() and compiler.has_function('crypt_r', args: defs, dependencies: libcrypt, prefix: '#include <crypt.h>')
libcrypt = [ libcrypt ]
conf_data.set('HAVE_CRYPT_R', 1)
# crypt in default libs?
elif compiler.has_function('crypt', args: defs, prefix: '#include <crypt.h>')
libcrypt = []
conf_data.set('HAVE_CRYPT', 1)
# crypt in -lcrypt ?
elif compiler.has_function('crypt', args: defs + ['-lcrypt'], prefix: '#include <crypt.h>')
libcrypt = [ compiler.find_library('crypt') ]
elif libcrypt.found() and compiler.has_function('crypt', args: defs, dependencies: libcrypt, prefix: '#include <crypt.h>')
libcrypt = [ libcrypt ]
conf_data.set('HAVE_CRYPT', 1)
endif
endif
conf_data.set('HAVE_SYS_INOTIFY_H', compiler.has_header('sys/inotify.h'))
if conf_data.get('HAVE_SYS_INOTIFY_H')
conf_data.set('HAVE_INOTIFY_INIT', compiler.has_function('inotify_init', args: defs))
endif
conf_data.set('HAVE_SOCKLEN_T', compiler.has_type('socklen_t', args: defs, prefix: '#include <sys/socket.h>'))
conf_data.set('HAVE_SOCKLEN_T', compiler.has_type('socklen_t',
args: defs,
prefix: '''
#include <sys/types.h>
#include <sys/socket.h>
'''
))
conf_data.set('HAVE_SYS_RANDOM_H', compiler.has_header('sys/random.h'))
if conf_data.get('HAVE_SYS_RANDOM_H')
if compiler.has_header('sys/random.h')
conf_data.set('HAVE_GETENTROPY', compiler.has_function(
'getentropy',
args: defs,
@ -107,52 +113,45 @@ if conf_data.get('HAVE_LINUX_RANDOM_H')
))
endif
conf_data.set('SIZEOF_LONG', compiler.sizeof('long', args: defs))
conf_data.set('SIZEOF_OFF_T', compiler.sizeof('off_t', args: defs))
conf_data.set('HAVE_ARC4RANDOM_BUF', compiler.has_function('arc4random_buf', args: defs))
conf_data.set('HAVE_CHROOT', compiler.has_function('chroot', args: defs))
conf_data.set('HAVE_EPOLL_CTL', compiler.has_function('epoll_ctl', args: defs))
conf_data.set('HAVE_FORK', compiler.has_function('fork', args: defs))
conf_data.set('HAVE_GETLOADAVG', compiler.has_function('getloadavg', args: defs))
conf_data.set('HAVE_GETRLIMIT', compiler.has_function('getrlimit', args: defs))
conf_data.set('HAVE_GETUID', compiler.has_function('getuid', args: defs))
conf_data.set('HAVE_GMTIME_R', compiler.has_function('gmtime_r', args: defs))
conf_data.set('HAVE_INET_NTOP', compiler.has_function('inet_ntop', args: defs))
conf_data.set('HAVE_JRAND48', compiler.has_function('jrand48', args: defs))
conf_data.set('HAVE_KQUEUE', compiler.has_function('kqueue', args: defs))
conf_data.set('HAVE_LOCALTIME_R', compiler.has_function('localtime_r', args: defs))
conf_data.set('HAVE_LSTAT', compiler.has_function('lstat', args: defs))
conf_data.set('HAVE_MADVISE', compiler.has_function('madvise', args: defs))
conf_data.set('HAVE_MEMCPY', compiler.has_function('memcpy', args: defs))
conf_data.set('HAVE_MEMSET', compiler.has_function('memset', args: defs))
conf_data.set('HAVE_MMAP', compiler.has_function('mmap', args: defs))
conf_data.set('HAVE_PATHCONF', compiler.has_function('pathconf', args: defs))
conf_data.set('HAVE_PIPE2', compiler.has_function('pipe2', args: defs))
conf_data.set('HAVE_POLL', compiler.has_function('poll', args: defs))
conf_data.set('HAVE_PORT_CREATE', compiler.has_function('port_create', args: defs))
conf_data.set('HAVE_PRCTL', compiler.has_function('prctl', args: defs))
conf_data.set('HAVE_PREAD', compiler.has_function('pread', args: defs))
conf_data.set('HAVE_POSIX_FADVISE', compiler.has_function('posix_fadvise', args: defs))
conf_data.set('HAVE_SELECT', compiler.has_function('select', args: defs))
conf_data.set('HAVE_SENDFILE', compiler.has_function('sendfile', args: defs))
conf_data.set('HAVE_SEND_FILE', compiler.has_function('send_file', args: defs))
conf_data.set('HAVE_SENDFILE64', compiler.has_function('sendfile64', args: defs))
conf_data.set('HAVE_SENDFILEV', compiler.has_function('sendfilev', args: defs))
conf_data.set('HAVE_SIGACTION', compiler.has_function('sigaction', args: defs))
conf_data.set('HAVE_SIGNAL', compiler.has_function('signal', args: defs))
conf_data.set('HAVE_SIGTIMEDWAIT', compiler.has_function('sigtimedwait', args: defs))
conf_data.set('HAVE_SRANDOM', compiler.has_function('srandom', args: defs))
conf_data.set('HAVE_STRPTIME', compiler.has_function('strptime', args: defs))
conf_data.set('HAVE_SYSLOG', compiler.has_function('syslog', args: defs))
conf_data.set('HAVE_WRITEV', compiler.has_function('writev', args: defs))
conf_data.set('HAVE_INET_ATON', compiler.has_function('inet_aton', args: defs))
conf_data.set('HAVE_ISSETUGID', compiler.has_function('issetugid', args: defs))
conf_data.set('HAVE_INET_PTON', compiler.has_function('inet_pton', args: defs))
conf_data.set('HAVE_MEMSET_S', compiler.has_function('memset_s', args: defs))
conf_data.set('HAVE_EXPLICIT_BZERO', compiler.has_function('explicit_bzero', args: defs))
conf_data.set('HAVE_CLOCK_GETTIME', compiler.has_header_symbol('time.h', 'clock_gettime'))
check_funcs = [
'arc4random_buf',
'chroot',
'clock_gettime',
'epoll_ctl',
'explicit_bzero',
'fork',
'getloadavg',
'getrlimit',
'getuid',
'gmtime_r',
'inet_pton',
'issetugid',
'jrand48',
'kqueue',
'localtime_r',
'lstat',
'madvise',
'memset_s',
'mmap',
'pathconf',
'pipe2',
'poll',
'port_create',
'select',
'send_file',
'sendfile',
'sendfile64',
'sigaction',
'signal',
'srandom',
'writev',
]
foreach f: check_funcs
conf_data.set('HAVE_' + f.to_upper(), compiler.has_function(f, args: defs))
endforeach
# check whether clock_gettime needs -lrt
clock_lib = []
if not(conf_data.get('HAVE_CLOCK_GETTIME'))
if compiler.has_function('clock_gettime', args: defs + ['-lrt'], prefix: '#include <time.h>')
@ -186,7 +185,7 @@ conf_data.set('HAVE_WEAK_SYMBOLS', compiler.compiles('''
args: defs
))
conf_data.set('HAVE_STRUCT_TM_GMTOFF', compiler.compiles('''
conf_data.set('HAVE_STRUCT_TM_TM_GMTOFF', compiler.compiles('''
#include <time.h>
int main(void) {
struct tm t;
@ -218,15 +217,14 @@ libbz2 = []
if get_option('with_bzip')
libbz2 = [ compiler.find_library('bz2') ]
if compiler.has_function('BZ2_bzCompress', args: defs, dependencies: libbz2, prefix: '#include <bzlib.h>')
conf_data.set('HAVE_BZLIB_H', true)
conf_data.set('HAVE_LIBBZ2', true)
conf_data.set('WITH_BZIP', true)
else
error('Couldn\'t find bz2 header / library')
endif
endif
if get_option('with_dbi')
libdbi = dependency('dbi', required: false)
libdbi = dependency('dbi', required: false, static: link_static)
if libdbi.found()
libdbi = [ libdbi ]
else
@ -235,7 +233,7 @@ if get_option('with_dbi')
error('Couldn\'t find dbi/dbi.h or dbi_conn_connect in lib dbi')
endif
endif
conf_data.set('HAVE_DBI', true)
conf_data.set('WITH_DBI', true)
endif
libfam = []
@ -244,12 +242,13 @@ if get_option('with_fam')
if not(compiler.has_function('FAMOpen2', args: defs, dependencies: libfam, prefix: '#include <fam.h>'))
error('Couldn\'t find fam.h or FAMOpen2 in lib fam')
endif
conf_data.set('HAVE_FAM_H', true)
conf_data.set('HAVE_FAMNOEXISTS', compiler.has_function('FAMNoExists', args: defs, dependencies: libfam, prefix: '#include <fam.h>'))
conf_data.set('WITH_FAM', true)