Browse Source

[build] option to use system-provided libxxhash

--with-xxhash
master lighttpd-1.4.56-rc6
Glenn Strauss 6 months ago
parent
commit
07622251b0
  1. 10
      SConstruct
  2. 28
      configure.ac
  3. 13
      src/CMakeLists.txt
  4. 4
      src/Makefile.am
  5. 1
      src/SConscript
  6. 15
      src/meson.build

10
SConstruct

@ -267,6 +267,7 @@ vars.AddVariables(
# with_valgrind not supported
# with_xattr not supported
PackageVariable('with_xml', 'enable xml support (required for webdav props)', 'no'),
BoolVariable('with_xxhash', 'build with system-provided xxhash', 'no'),
BoolVariable('with_zlib', 'enable deflate/gzip compression', 'no'),
BoolVariable('with_all', 'enable all with_* features', 'no'),
@ -350,6 +351,7 @@ if 1:
LIBUUID = '',
LIBX509 = '',
LIBXML2 = '',
LIBXXHASH = '',
LIBZ = '',
)
@ -709,6 +711,14 @@ if 1:
fail("Couldn't find xml2")
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LIBXML_H', '-DHAVE_LIBXML2' ])
if env['with_xxhash']:
if not autoconf.CheckLibWithHeader('xxhash', 'xxhash.h', 'C'):
fail("Couldn't find xxhash")
autoconf.env.Append(
CPPFLAGS = [ '-DHAVE_XXHASH_H' ],
LIBXXHASH = 'xxhash',
)
if env['with_zlib']:
if not autoconf.CheckLibWithHeader('z', 'zlib.h', 'C'):
fail("Couldn't find zlib")

28
configure.ac

@ -1181,6 +1181,34 @@ if test "$WITH_WEBDAV_LOCKS" != no; then
AC_SUBST([UUID_LIBS])
fi
dnl xxhash
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for xxhash support])
AC_ARG_WITH([xxhash],
[AC_HELP_STRING([--with-xxhash],
[Enable system-provided xxhash]
)],
[WITH_XXHASH=$withval],
[WITH_XXHASH=no]
)
AC_MSG_RESULT([$WITH_XXHASH])
if test "$WITH_XXHASH" != no; then
if test "$WITH_XXHASH" != yes; then
XXHASH_LIBS="-L$WITH_XXHASH -lxxhash"
CPPFLAGS="$CPPFLAGS -I$WITH_XXHASH"
else
PKG_CHECK_MODULES([XXHASH], [libxxhash], [], [
AC_MSG_ERROR([xxhash not found, install it or build without --with-xxhash])
])
fi
AC_DEFINE([HAVE_XXHASH_H], [1], [xxhash.h])
AC_DEFINE([HAVE_XXHASH], [1], [xxhash])
AC_SUBST([XXHASH_CFLAGS])
AC_SUBST([XXHASH_LIBS])
fi
dnl Check for gdbm
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for gdbm])

13
src/CMakeLists.txt

@ -45,6 +45,7 @@ option(WITH_LIBUNWIND "with libunwind to print backtraces in asserts [default: o
option(WITH_GEOIP "with GeoIP-support mod_geoip [default: off]")
option(WITH_MAXMINDDB "with MaxMind GeoIP2-support mod_maxminddb [default: off]")
option(WITH_SASL "with SASL-support for mod_authn_sasl [default: off]")
option(WITH_XXHASH "with system-provided xxhash [default: off]")
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(BUILD_EXTRA_WARNINGS "extra warnings")
@ -564,6 +565,14 @@ else()
unset(HAVE_LIBUUID)
endif()
if(WITH_XXHASH)
check_include_files(xxhash.h HAVE_XXHASH_H)
check_library_exists(xxhash XXH_versionNumber "" HAVE_XXHASH)
else()
unset(HAVE_XXHASH_H)
unset(HAVE_XXHASH)
endif()
if(WITH_ZLIB)
if(NOT WIN32)
check_include_files(zlib.h HAVE_ZLIB_H)
@ -1083,6 +1092,10 @@ if(HAVE_XATTR)
target_link_libraries(lighttpd attr)
endif()
if(HAVE_XXHASH)
target_link_libraries(lighttpd xxhash)
endif()
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic ${WARN_CFLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")

4
src/Makefile.am

@ -520,7 +520,7 @@ lighttpd_CPPFLAGS = \
$(FAM_CFLAGS) $(LIBEV_CFLAGS) $(LIBUNWIND_CFLAGS)
lighttpd_LDADD = \
$(common_libadd) \
$(CRYPT_LIB) $(CRYPTO_LIB) \
$(CRYPT_LIB) $(CRYPTO_LIB) $(XXHASH_LIBS) \
$(XML_LIBS) $(SQLITE_LIBS) $(UUID_LIBS) $(ELFTC_LIB) \
$(PCRE_LIB) $(Z_LIB) $(BZ_LIB) $(BROTLI_LIBS) \
$(DL_LIB) $(SENDFILE_LIB) $(ATTR_LIB) \
@ -608,7 +608,7 @@ else
## default lighttpd server
lighttpd_SOURCES = $(src)
lighttpd_CPPFLAGS = $(FAM_CFLAGS) $(LIBEV_CFLAGS)
lighttpd_LDADD = $(PCRE_LIB) $(DL_LIB) $(SENDFILE_LIB) $(ATTR_LIB) $(common_libadd) $(CRYPTO_LIB) $(FAM_LIBS) $(LIBEV_LIBS) $(LIBUNWIND_LIBS)
lighttpd_LDADD = $(PCRE_LIB) $(DL_LIB) $(SENDFILE_LIB) $(ATTR_LIB) $(common_libadd) $(CRYPTO_LIB) $(XXHASH_LIBS) $(FAM_LIBS) $(LIBEV_LIBS) $(LIBUNWIND_LIBS)
lighttpd_LDFLAGS = -export-dynamic
endif

1
src/SConscript

@ -309,6 +309,7 @@ instbin = env.Program(bin_targets, src, LINKFLAGS = bin_linkflags,
env['LIBCRYPTO'],
env['LIBDL'],
env['LIBPCRE'],
env['LIBXXHASH'],
)
)
env.Depends(instbin, configparser)

15
src/meson.build

@ -635,6 +635,20 @@ if get_option('with_xattr')
endif
endif
libxxhash = []
if get_option('with_xxhash')
libxxhash = dependency('libxxhash', required: false)
if libxxhash.found()
libxxhash = [ libxxhash ]
else
libxxhash = [ compiler.find_library('xxhash') ]
if not(compiler.has_function('XXH_versionNumber', args: defs, dependencies: libxxhash, prefix: '#include <xxhash.h>'))
error('Couldn\'t find xxhash/xxhash.h or XXH_versionNumber in lib xxhash')
endif
endif
conf_data.set('HAVE_XXHASH_H', true)
endif
libz = []
if get_option('with_zlib')
libz = dependency('zlib', required: false)
@ -804,6 +818,7 @@ executable('lighttpd', configparser,
, libfam
, libpcre
, libunwind
, libxxhash
, libws2_32
],
install: true,

Loading…
Cancel
Save