diff options
author | Gert Doering <gert@greenie.muc.de> | 2014-01-01 22:57:58 +0100 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2014-01-06 12:18:53 +0100 |
commit | 40efb6359aff0e4805c0439acd6e899c687ef058 (patch) | |
tree | ff119c7a017fa18f939f76e0f2577ef9a94f8d1d /configure.ac | |
parent | 56ab21091c0f1e07d0a6ef7815160f6ae072498d (diff) | |
download | openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.tar.gz openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.tar.xz openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.zip |
Implement LZ4 compression.
Implement LZ4 compression, similar to the existing snappy / push-peer-info
model: a LZ4 capable client will send IV_LZ4=1 to the server, and the
algorithm is selected by pushing "compress lz4" back.
LZ4 does not compress as well as LZO or Snappy, but needs far less CPU
and is much faster, thus better suited for mobile devices. See
https://code.google.com/p/lz4/ for more details.
LZ4 include and library path can be specified by specifying LZ4_LIBS=...
and LZ4_CFLAGS=... on the configure command line.
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1388613479-22377-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8153
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 23e76f6..497dd44 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,12 @@ AC_ARG_ENABLE(snappy, [enable_snappy="yes"] ) +AC_ARG_ENABLE(lz4, + [ --disable-lz4 Disable LZ4 compression support], + [enable_lz4="$enableval"], + [enable_lz4="yes"] +) + AC_ARG_ENABLE(comp-stub, [ --enable-comp-stub Don't compile compression support but still allow limited interoperability with compression-enabled peers], [enable_comp_stub="$enableval"], @@ -934,6 +940,47 @@ if test "$enable_snappy" = "yes" && test "$enable_comp_stub" = "no"; then CFLAGS="${saved_CFLAGS}" fi +dnl +dnl check for LZ4 library +dnl + +AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4]) +AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4]) +if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then + AC_CHECKING([for LZ4 Library and Header files]) + havelz4lib=1 + + # if LZ4_LIBS is set, we assume it will work, otherwise test + if test -z "${LZ4_LIBS}"; then + AC_CHECK_LIB(lz4, LZ4_compress, + [ LZ4_LIBS="-llz4" ], + [ + AC_MSG_RESULT([LZ4 library not found.]) + havelz4lib=0 + ]) + fi + + saved_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} ${LZ4_CFLAGS}" + AC_CHECK_HEADER(lz4.h, + , + [ + AC_MSG_RESULT([LZ4 headers not found.]) + havelz4lib=0 + ]) + + if test $havelz4lib = 0 ; then + AC_MSG_RESULT([LZ4 library available from http://code.google.com/p/lz4/]) + AC_MSG_ERROR([Or try ./configure --disable-lz4 OR ./configure --enable-comp-stub]) + fi + OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}" + OPTIONAL_LZ4_LIBS="${LZ4_LIBS}" + AC_DEFINE(ENABLE_LZ4, 1, [Enable LZ4 compression library]) + CFLAGS="${saved_CFLAGS}" +fi + + + AC_MSG_CHECKING([git checkout]) GIT_CHECKOUT="no" @@ -1045,6 +1092,7 @@ fi if test "${enable_comp_stub}" = "yes"; then test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and lzo enabled (use --disable-lzo)]) test "${enable_snappy}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and snappy enabled (use --disable-snappy)]) + test "${enable_lz4}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and LZ4 enabled (use --disable-lz4)]) AC_DEFINE([ENABLE_COMP_STUB], [1], [Enable compression stub capability]) fi @@ -1101,6 +1149,8 @@ AC_SUBST([OPTIONAL_LZO_CFLAGS]) AC_SUBST([OPTIONAL_LZO_LIBS]) AC_SUBST([OPTIONAL_SNAPPY_CFLAGS]) AC_SUBST([OPTIONAL_SNAPPY_LIBS]) +AC_SUBST([OPTIONAL_LZ4_CFLAGS]) +AC_SUBST([OPTIONAL_LZ4_LIBS]) AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS]) AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS]) |