dc4039c3e6561c56c3eb6a181e8278acc1b06d53
[openwrt/openwrt.git] / package / network / services / openvpn / patches / 210-build_always_use_internal_lz4.patch
1 --- a/configure.ac
2 +++ b/configure.ac
3 @@ -1078,68 +1078,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 liblz4 < 100],
11 - [have_lz4="yes"],
12 - [LZ4_LIBS="-llz4"] # If this fails, we will do another test next.
13 - # We also add set LZ4_LIBS otherwise the
14 - # linker will not know about the lz4 library
15 - )
16 - fi
17
18 saved_CFLAGS="${CFLAGS}"
19 saved_LIBS="${LIBS}"
20 CFLAGS="${CFLAGS} ${LZ4_CFLAGS}"
21 LIBS="${LIBS} ${LZ4_LIBS}"
22
23 - # If pkgconfig check failed or LZ4_CFLAGS/LZ4_LIBS env vars
24 - # are used, check the version directly in the LZ4 include file
25 - if test "${have_lz4}" != "yes"; then
26 - AC_CHECK_HEADERS([lz4.h],
27 - [have_lz4h="yes"],
28 - [])
29 -
30 - if test "${have_lz4h}" = "yes" ; then
31 - AC_MSG_CHECKING([additionally if system LZ4 version >= 1.7.1])
32 - AC_COMPILE_IFELSE(
33 - [AC_LANG_PROGRAM([[
34 -#include <lz4.h>
35 - ]],
36 - [[
37 -/* Version encoding: MMNNPP (Major miNor Patch) - see lz4.h for details */
38 -#if LZ4_VERSION_NUMBER < 10701L
39 -#error LZ4 is too old
40 -#endif
41 - ]]
42 - )],
43 - [
44 - AC_MSG_RESULT([ok])
45 - have_lz4="yes"
46 - ],
47 - [AC_MSG_RESULT([system LZ4 library is too old])]
48 - )
49 - fi
50 - fi
51 -
52 - # Double check we have a few needed functions
53 - if test "${have_lz4}" = "yes" ; then
54 - AC_CHECK_LIB([lz4],
55 - [LZ4_compress_default],
56 - [],
57 - [have_lz4="no"])
58 - AC_CHECK_LIB([lz4],
59 - [LZ4_decompress_safe],
60 - [],
61 - [have_lz4="no"])
62 - fi
63 -
64 - if test "${have_lz4}" != "yes" ; then
65 - AC_MSG_RESULT([ usable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
66 - AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
67 - LZ4_LIBS=""
68 - fi
69 + AC_MSG_RESULT([ usable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
70 + AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
71 + LZ4_LIBS=""
72 OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}"
73 OPTIONAL_LZ4_LIBS="${LZ4_LIBS}"
74 AC_DEFINE(ENABLE_LZ4, [1], [Enable LZ4 compression library])