d49e0bf9ec9f46df6a041a494059ea92cbdb8727
[openwrt/openwrt.git] / package / network / services / openvpn / patches / 210-build_always_use_internal_lz4.patch
1 --- a/configure.ac
2 +++ b/configure.ac
3 @@ -1068,62 +1068,15 @@ dnl
4 AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4])
5 AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])
6 if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then
7 - if test -z "${LZ4_CFLAGS}" -a -z "${LZ4_LIBS}"; then
8 - # if the user did not explicitly specify flags, try to autodetect
9 - PKG_CHECK_MODULES([LZ4],
10 - [liblz4 >= 1.7.1],
11 - [have_lz4="yes"],
12 - [] # If this fails, we will do another test next
13 - )
14 - fi
15
16 saved_CFLAGS="${CFLAGS}"
17 saved_LIBS="${LIBS}"
18 CFLAGS="${CFLAGS} ${LZ4_CFLAGS}"
19 LIBS="${LIBS} ${LZ4_LIBS}"
20
21 - # If pkgconfig check failed or LZ4_CFLAGS/LZ4_LIBS env vars
22 - # are used, check the version directly in the LZ4 include file
23 - if test "${have_lz4}" != "yes"; then
24 - AC_CHECK_HEADERS([lz4.h],
25 - [have_lz4h="yes"],
26 - [])
27 -
28 - if test "${have_lz4h}" = "yes" ; then
29 - AC_MSG_CHECKING([additionally if system LZ4 version >= 1.7.1])
30 - AC_COMPILE_IFELSE(
31 - [AC_LANG_PROGRAM([[
32 -#include <lz4.h>
33 - ]],
34 - [[
35 -/* Version encoding: MMNNPP (Major miNor Patch) - see lz4.h for details */
36 -#if LZ4_VERSION_NUMBER < 10701L
37 -#error LZ4 is too old
38 -#endif
39 - ]]
40 - )],
41 - [
42 - AC_MSG_RESULT([ok])
43 - have_lz4="yes"
44 - ],
45 - [AC_MSG_RESULT([system LZ4 library is too old])]
46 - )
47 - fi
48 - fi
49 -
50 - # if LZ4_LIBS is set, we assume it will work, otherwise test
51 - if test -z "${LZ4_LIBS}"; then
52 - AC_CHECK_LIB([lz4],
53 - [LZ4_compress],
54 - [LZ4_LIBS="-llz4"],
55 - [have_lz4="no"])
56 - fi
57 -
58 - if test "${have_lz4}" != "yes" ; then
59 - AC_MSG_RESULT([ usuable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
60 - AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
61 - LZ4_LIBS=""
62 - fi
63 + AC_MSG_RESULT([ usuable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
64 + AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
65 + LZ4_LIBS=""
66 OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}"
67 OPTIONAL_LZ4_LIBS="${LZ4_LIBS}"
68 AC_DEFINE(ENABLE_LZ4, [1], [Enable LZ4 compression library])