summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-10-29 19:30:45 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-10-29 19:30:45 -0400
commit07622251b0ed83ffe490ddf6e2db9e3e3245c553 (patch)
treef8466c9c597fd6040d21892963f4a80bb0ef1245
parent7ff2a467c9fa31dd3bf98e9ff356e977c4168464 (diff)
downloadlighttpd-git-07622251b0ed83ffe490ddf6e2db9e3e3245c553.tar.gz
[build] option to use system-provided libxxhashlighttpd-1.4.56-rc6
--with-xxhash
-rw-r--r--SConstruct10
-rw-r--r--configure.ac28
-rw-r--r--src/CMakeLists.txt13
-rw-r--r--src/Makefile.am4
-rw-r--r--src/SConscript1
-rw-r--r--src/meson.build15
6 files changed, 69 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct
index d63a00db..6a31c23f 100644
--- a/SConstruct
+++ b/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")
diff --git a/configure.ac b/configure.ac
index 68c4eb0f..44dd6e77 100644
--- a/configure.ac
+++ b/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])
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 16ff59ec..604aba28 100644
--- a/src/CMakeLists.txt
+++ b/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")
diff --git a/src/Makefile.am b/src/Makefile.am
index 69caeed8..780fd15a 100644
--- a/src/Makefile.am
+++ b/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
diff --git a/src/SConscript b/src/SConscript
index 724dfc48..450df238 100644
--- a/src/SConscript
+++ b/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)
diff --git a/src/meson.build b/src/meson.build
index 6f104318..d8639159 100644
--- a/src/meson.build
+++ b/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,