From: "flichtenheld (Code Review)" Date: Fri, 21 Jun 2024 13:02:41 +0000 In-Reply-To: References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, gert@...1296... Message-ID: <3535840333ffa844443c99961c6c4a7a7e9897fe-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="uiUH+78g0Dw="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: cron2 , openvpn-devel --uiUH+78g0Dw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, plaisthos. Hello plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=3Demail to look at the new patch set (#7). Change subject: configure: Try to detect LZO with pkg-config ...................................................................... configure: Try to detect LZO with pkg-config On most systems this should work just fine. v2: - simplify code by removing -llzo special handling v3: - reintroduce support for autodetection without pkg-config, no need to break backwards compatibility right now v7: - Handle case correctly where lzo/lzo1x.h can not be included at all. On most distros this works even though the .pc file suggests to use it without. We had some partly solution for that but it wasn't really working. Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693 Signed-off-by: Frank Lichtenheld --- M config.h.cmake.in M configure.ac M src/openvpn/lzo.h 3 files changed, 22 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/556/7 diff --git a/config.h.cmake.in b/config.h.cmake.in index effca2a..720d679 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -178,9 +178,6 @@ /* 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 c01ad09..d7d1b18 100644 --- a/configure.ac +++ b/configure.ac @@ -1143,8 +1143,17 @@ AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo]) AC_ARG_VAR([LZO_LIBS], [linker flags for lzo]) -have_lzo=3D"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=3D"yes"], + [] + ) + + if test "${have_lzo}" !=3D "yes"; then + # try to detect without pkg-config + have_lzo=3D"yes" AC_CHECK_LIB( [lzo2], [lzo1x_1_15_compress], @@ -1156,6 +1165,10 @@ [have_lzo=3D"no"] )] ) + fi +else + # assume the user configured it correctly + have_lzo=3D"yes" fi if test "${have_lzo}" =3D "yes"; then saved_CFLAGS=3D"${CFLAGS}" @@ -1166,8 +1179,10 @@ [AC_CHECK_HEADERS( [lzo1x.h], , - [AC_MSG_ERROR([lzo1x.h is missing])] - )] + [AC_MSG_ERROR([lzo1x.h is missing])], + [#include + #include ] + )], ) CFLAGS=3D"${saved_CFLAGS}" fi diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h index 62d73a1..c271527 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 -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693 Gerrit-Change-Number: 556 Gerrit-PatchSet: 7 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-MessageType: newpatchset --uiUH+78g0Dw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: cron2, plaisthos.

flichtenheld uploaded patch set #7 to this change.

<= p>View Ch= ange

configure: Try to detect LZO with pkg-config

On most system= s this should work just fine.

v2:
- simplify code by removing -l= lzo special handling
v3:
- reintroduce support for autodetection wit= hout pkg-config,
no need to break backwards compatibility right nowv7:
- Handle case correctly where lzo/lzo1x.h can not be included
= at all. On most distros this works even though the .pc
file sugges= ts to use it without. We had some partly
solution for that but it was= n't really working.

Change-Id: I1c038dc4ec80d3499582d81eee61fee7= 4f26e693
Signed-off-by: Frank Lichtenheld <frank@...2641...>
--= -
M config.h.cmake.in
M configure.ac
M src/openvpn/lzo.h
3 file= s changed, 22 insertions(+), 12 deletions(-)

git pull ssh://gerri=
t.openvpn.net:29418/openvpn refs/changes/56/556/7
diff --git a/conf=
ig.h.cmake.in b/config.h.cmake.in
index effca2a..720d679 10= 0644
--- a/config.h.cmake.in
+++ b/config.h= .cmake.in
@@ -178,9 +178,6 @@
/* Define to= 1 if you have the <linux/types.h> header file. */
#= cmakedefine HAVE_LINUX_TYPES_H

-/* Define to 1 if you have the <lzoconf.h>= header file. */
-#defi= ne HAVE_LZO_CONF_H
-
/* Define to 1 if you have the <lzo1x.h> header file. = */
#define HAVE_LZO1X_H 1

diff --git a/configure.ac b/configure.ac

index c01ad09..d= 7d1b18 100644
--- a/configure.ac
+++ b/conf= igure.ac
@@ -1143,8 +1143,17 @@
AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
-have_lzo=3D"yes"
-if test -z "${LZO_LIBS}"; then
+if test -z "${LZ= O_CFLAGS}" -a -z "${LZO_LIBS}"; then
+ # if the user did not explicitly spec= ify flags, try to autodetect
+ PKG_CHECK_MODULES([LZO],
+ [lzo2],
+ [have_lzo=3D"yes"],
+ []
+ )
++ if test "${have_lzo= }" !=3D "yes"; then
+ # try to detect without pkg-config
+ have_lzo=3D"yes"
= AC_CHECK_LIB(
[lzo2],
[lzo1x_1_15_c= ompress],
@@ -1156,6 +1165,10 @@
[have_= lzo=3D"no"]
)]
)
<= span style=3D"color: hsl(120, 100%, 40%);">+ fi

+else
+ # assume the user configured it correctly
+ have_lzo=3D"yes"
fi
if test "${have_lzo}" =3D &quo= t;yes"; then
saved_CFLAGS=3D"${CFLAGS}"
@@ -1166,8 +1179,10 @@
[AC_CHECK_HEADERS(<= /span>
[lzo1x.h],
,
- [AC_MSG_ERROR([lzo1x.h is missing])]

- )]
+ [AC_MSG_ERROR([lzo1x.h is missing])],=
+ = [#include <lzodefs.h>
+ #include <lzoconf.h>]+ )],
)
CFLAGS=3D"${saved_CFLAGS}"
fi
diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h
<= span>index 62d73a1..c271527 100644

--- a/src/openvpn/lzo.h<= /span>
+++ b/src/openvpn/lzo.h
@@ -37,17 +37,15 @@=
* @addtogroup compression
* @{<= br> */
-#if defi= ned(HAVE_LZO_CONF_H)
= +#if defined(HAVE_LZO_LZO1X_H)
+#include <lzo/lzo1x.h>
+#elif defined(HAVE_LZO1X_H)
/* The lzo= .h magic gets confused and still wants
* to include lzo/l= zoconf.h even if our include paths
* are setup to include= the paths without lzo/
*/
#include <= lzodefs.h>
#include <lzoconf.h>
-#endif
-#if defined(HAVE_LZO_LZO1X_H)
-#include <lzo/lzo1x.h>
-#elif defined(HAVE_LZO1X_H)
<= span> #include <lzo1x.h>

#endif


To view, visit change 556. To unsubscribe, or = for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee6= 1fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: cron2 <gert@...1296...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-MessageType: newpatchset
--uiUH+78g0Dw=--