From: "cron2 (Code Review)" Date: Wed, 26 Jun 2024 16:55:37 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="pp/25cXu5oo="; 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: flichtenheld , plaisthos Cc: openvpn-devel --pp/25cXu5oo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#9) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 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. v8: - Handle systems that do not implicitly include limits.h in configure test builds. lzodefs.h usually relies on lzoconf.h to include it. Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20240626161921.179301-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28= 848.html Signed-off-by: Gert Doering --- M config.h.cmake.in M configure.ac M src/openvpn/lzo.h 3 files changed, 23 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/556/9 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..555c97e 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,11 @@ [AC_CHECK_HEADERS( [lzo1x.h], , - [AC_MSG_ERROR([lzo1x.h is missing])] - )] + [AC_MSG_ERROR([lzo1x.h is missing])], + [#include + #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: 9 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --pp/25cXu5oo= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #9 to the change originally cr= eated by flichtenheld.

View Change

The following approvals got outda= ted and were removed: Code-Review+2 by cron2

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 aut= odetection without pkg-config,
no need to break backwards compatibili= ty right now
v7:
- Handle case correctly where lzo/lzo1x.h can not b= e included
at all. On most distros this works even though the .pc
= file suggests to use it without. We had some partly
solution for t= hat but it wasn't really working.
v8:
- Handle systems that do n= ot implicitly include limits.h
in configure test builds.
lzodef= s.h usually relies on lzoconf.h to include it.

Change-Id: I1c038dc4e= c80d3499582d81eee61fee74f26e693
Signed-off-by: Frank Lichtenheld <fra= nk@...2641...>
Acked-by: Gert Doering <gert@...1296...>
Mess= age-Id: <20240626161921.179301-1-frank@...2641...>
URL: https://ww= w.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28848.html
Sig= ned-off-by: Gert Doering <gert@...1296...>
---
M config.h.cmake= .in
M configure.ac
M src/openvpn/lzo.h
3 files changed, 23 inserti= ons(+), 12 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/o=
penvpn refs/changes/56/556/9
diff --git a/config.h.cmake.in b/confi=
g.h.cmake.in
index effca2a..720d679 100644
= --- a/config.h.cmake.in
+++ b/config.h.cmake.in
<= span>@@ -178,9 +178,6 @@
/* Define to 1 if you have the &l= t;linux/types.h> header file. */
#cmakedefine HAVE_LINU= X_TYPES_H

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

diff --git a/config= ure.ac b/configure.ac
index c01ad09..555c97e 100644<= br>--- a/configure.ac
+++ b/configure.ac
@@ -1143,8 +1143,17 @@


AC_ARG_VAR([L= ZO_CFLAGS], [C compiler flags for lzo])
AC_ARG_VAR([LZO_LI= BS], [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 auto= detect
+ PKG_CHECK= _MODULES([LZO],
+ [l= zo2],
+ [have_lzo=3D= "yes"],
+ = []
+ )
<= span style=3D"color: hsl(120, 100%, 40%);">+

+ 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"]<= /span>
)]
)
+ 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,11 @@
[AC_CHECK_HEADERS(
[l= zo1x.h],
,
- [AC_MSG_ERROR([lzo1x.h is missing])]
- )]
+ [AC_MSG_ERROR([lzo1x.h is missing])],
+ [#include <lim= its.h>
+ = #include <lzodefs.h>
+ #include <lzoconf.h>]<= /span>
+ )],
)

CFLAGS=3D"${saved_CFLAGS}"
fi

diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h

index 62d73a1..c271527 100644
--- a/src/openv= pn/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 <lzo/lzo1x.h>
+#elif defined(HAVE_LZO1X_H)
/= * The lzo.h magic gets confused and still wants
* to incl= ude lzo/lzoconf.h even if our include paths
* are setup t= o include the paths without lzo/
*/
#inc= lude <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 unsub= scribe, 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: 9
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--pp/25cXu5oo=--