diff --git a/config.h.cmake.in b/config.h.cmake.in index effca2a5c80..720d679c867 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -178,9 +178,6 @@ don't. */ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LINUX_TYPES_H -/* Define to 1 if you have the header file. */ -#define HAVE_LZO_CONF_H - /* Define to 1 if you have the header file. */ #define HAVE_LZO1X_H 1 diff --git a/configure.ac b/configure.ac index c01ad093d1c..555c97e75e5 100644 --- a/configure.ac +++ b/configure.ac @@ -1143,8 +1143,17 @@ fi AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo]) AC_ARG_VAR([LZO_LIBS], [linker flags for lzo]) -have_lzo="yes" -if test -z "${LZO_LIBS}"; then +if test -z "${LZO_CFLAGS}" -a -z "${LZO_LIBS}"; then + # if the user did not explicitly specify flags, try to autodetect + PKG_CHECK_MODULES([LZO], + [lzo2], + [have_lzo="yes"], + [] + ) + + if test "${have_lzo}" != "yes"; then + # try to detect without pkg-config + have_lzo="yes" AC_CHECK_LIB( [lzo2], [lzo1x_1_15_compress], @@ -1156,6 +1165,10 @@ if test -z "${LZO_LIBS}"; then [have_lzo="no"] )] ) + fi +else + # assume the user configured it correctly + have_lzo="yes" fi if test "${have_lzo}" = "yes"; then saved_CFLAGS="${CFLAGS}" @@ -1166,8 +1179,11 @@ if test "${have_lzo}" = "yes"; then [AC_CHECK_HEADERS( [lzo1x.h], , - [AC_MSG_ERROR([lzo1x.h is missing])] - )] + [AC_MSG_ERROR([lzo1x.h is missing])], + [#include + #include + #include ] + )], ) CFLAGS="${saved_CFLAGS}" fi diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h index 62d73a1b36b..c271527697e 100644 --- a/src/openvpn/lzo.h +++ b/src/openvpn/lzo.h @@ -37,17 +37,15 @@ * @addtogroup compression * @{ */ -#if defined(HAVE_LZO_CONF_H) +#if defined(HAVE_LZO_LZO1X_H) +#include +#elif defined(HAVE_LZO1X_H) /* The lzo.h magic gets confused and still wants * to include lzo/lzoconf.h even if our include paths * are setup to include the paths without lzo/ */ #include #include -#endif -#if defined(HAVE_LZO_LZO1X_H) -#include -#elif defined(HAVE_LZO1X_H) #include #endif