Skip to contentSkip to conversation

Change in openvpn[master]: configure: Try to detect LZO with pkg-config first

Openvpn-devel In review flichtenheld (Code Review) 3 participants 19 messages Apr 22, 2024 – Jun 26, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1713800630000.I1c038dc4ec80d3499582d81eee61fee74f26e693@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/556?usp=email

to review the following change.

Change subject: configure: Try to detect LZO with pkg-config first
......................................................................

configure: Try to detect LZO with pkg-config first

On most systems this should work just fine.

Change-Id I1c038dc4ec80d3499582d81eee61fee74f26e693

---
M configure.ac

1 file changed, 12 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/556/1

configure.ac +12 -1
index ce8b2b0..159d47c 100644
@@ -1143,8 +1143,18 @@
 
 AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
 AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
-have_lzo="yes"
+have_lzo="no"
 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],
+			  [AC_CHECK_LIB([lzo2], [lzo1x_1_15_compress], [have_lzo="yes"], [LZO_CFLAGS="" LZO_LIBS=""])]
+			  []
+	)
+    fi
+    if test "${have_lzo}" = "no"; then
+	have_lzo="yes"
 	AC_CHECK_LIB(
 		[lzo2],
 		[lzo1x_1_15_compress],
@@ -1156,6 +1166,7 @@
 			[have_lzo="no"]
 		)]
 	)
+    fi
 fi
 if test "${have_lzo}" = "yes"; then
 	saved_CFLAGS="${CFLAGS}"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config first
......................................................................

Patch Set 2:

This change is ready for review.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 24 Apr 2024 10:35:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

author Applied
#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config first
......................................................................

Patch Set 2:

(1 comment)

Patchset:

PS2:
Does not work for me yet.

Applied this to a fresh git checkout on fbsd14, which has pkg-config and lzo2.pc, but it still failed.

Relevant parts from config.log:

```
configure:18781: checking for LZO
configure:18788: $PKG_CONFIG --exists --print-errors "lzo2"
configure:18791: $? = 0
configure:18805: $PKG_CONFIG --exists --print-errors "lzo2"
configure:18808: $? = 0
configure:18848: result: yes
configure:18850: checking for lzo1x_1_15_compress in -llzo2
configure:18879: cc -o conftest -g -O2 -std=c99   conftest.c -llzo2   -lnv >&5
ld: error: unable to find library -llzo2
```

and from pkgconf output
```
[email protected]... $ pkg-config --cflags lzo2
-I/usr/local/include/lzo
[email protected]... $ pkg-config --libs lzo2
-L/usr/local/lib -llzo2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 08 May 2024 13:49:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config first
......................................................................

Patch Set 2:

(1 comment)

File configure.ac:

http://gerrit.openvpn.net/c/openvpn/+/556/comment/269f68bb_0cc07361 :
PS2, Line 1148: if test -z "${LZO_CFLAGS}" -a -z "${LZO_LIBS}"; then
Isn't this -z LZO_LIBS always true since it is under the -z LZO_LIBS check anyway?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 08 May 2024 13:49:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#5 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: flichtenheld.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/556?usp=email

to look at the new patch set (#3).

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.

Also remove the handling to autodetect -llzo. This seems to be very uncommon now (we do not have examples of it in our build farm). If you have a system that needs -llzo just specify LZO_LIBS or configure pkg-config correctly.

v2:
- simplify code by removing -llzo special handling

Change-Id I1c038dc4ec80d3499582d81eee61fee74f26e693

---
M configure.ac

1 file changed, 9 insertions(+), 12 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/556/3

configure.ac +9 -12
index ce8b2b0..e5c11da 100644
@@ -1143,19 +1143,16 @@
 
 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
-	AC_CHECK_LIB(
+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],
-		[lzo1x_1_15_compress],
-		[LZO_LIBS="-llzo2"],
-		[AC_CHECK_LIB(
-			[lzo],
-			[lzo1x_1_15_compress],
-			[LZO_LIBS="-llzo"],
-			[have_lzo="no"]
-		)]
-	)
+		[have_lzo="yes"],
+		[have_lzo="no"]
+    )
+else
+    # assume the user configured it correctly
+    have_lzo="yes"
 fi
 if test "${have_lzo}" = "yes"; then
 	saved_CFLAGS="${CFLAGS}"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#6 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config
......................................................................

Patch Set 3:

(2 comments)

Patchset:

PS2:

Quoted 1 line

Does not work for me yet. […]

Yeah, I tried to include the -llzo check in pkg-config, which just made no sense. And it did not work for the case where LZO_CFLAGS were important anyway. I now decided to just remove it completely.

File configure.ac:

http://gerrit.openvpn.net/c/openvpn/+/556/comment/1166fc22_a203022f :
PS2, Line 1148: if test -z "${LZO_CFLAGS}" -a -z "${LZO_LIBS}"; then

Quoted 1 line

Isn't this -z LZO_LIBS always true since it is under the -z LZO_LIBS check anyway?

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Wed, 08 May 2024 14:21:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#7 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

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=email

to look at the new patch set (#4).

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

Change-Id I1c038dc4ec80d3499582d81eee61fee74f26e693

---
M configure.ac

1 file changed, 15 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/556/4

configure.ac +15 -2
index ce8b2b0..d834f30 100644
@@ -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="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 @@
 			[have_lzo="no"]
 		)]
 	)
+    fi
+else
+    # assume the user configured it correctly
+    have_lzo="yes"
 fi
 if test "${have_lzo}" = "yes"; then
 	saved_CFLAGS="${CFLAGS}"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-MessageType: newpatchset

#8 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config
......................................................................

Patch Set 6:

(1 comment)

Patchset:

PS6:
close...

fbsd14, master + this patch, "configure" with no further arguments

```
checking for lzo2... yes
checking for lzo/lzoutil.h... no
checking for lzoutil.h... no
configure: error: lzoutil.h is missing
$ locate lzoutil.h
/usr/local/include/lzo/lzoutil.h
```

and this might actually be a broken .pc, as the failure is

```
configure:18961: result: no
configure:18969: checking for lzoutil.h
configure:18969: cc -c -g -O2 -std=c99 -I/usr/local/include/lzo  conftest.c >&5
In file included from conftest.c:162:
/usr/local/include/lzo/lzoutil.h:33:10: fatal error: 'lzo/lzoconf.h' file not fo
und
#include <lzo/lzoconf.h>
         ^~~~~~~~~~~~~~~
```

so we *should* -I/usr/local/include.

On the other side, lzoutil.h has this comment

```
/***********************************************************************
// LZO-v1 deprecated macros (which were used in the old example programs)
//
// THIS FILE IS DEPRECATED. DO NOT USE.
************************************************************************/
```

so maybe we shouldn't check for this one at all? (we use lzo_malloc() and lzo_free() though, but those are simple defines to plain malloc/free).

Mmmh.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 02 Jun 2024 16:56:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#9 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config
......................................................................

Patch Set 6:

(1 comment)

Patchset:

PS6:

Quoted 1 line

close... […]

Okay, I can prepare a separate patch that gets rid of lzoutil.h completely. But as you said, the .pc file seems at fault here.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Tue, 04 Jun 2024 11:09:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#10 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

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=email

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

---
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

config.h.cmake.in +0 -3
index effca2a..720d679 100644
@@ -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. */
-#define HAVE_LZO_CONF_H
-
 /* Define to 1 if you have the <lzo1x.h> header file. */
 #define HAVE_LZO1X_H 1
 
configure.ac +19 -4
index c01ad09..d7d1b18 100644
@@ -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="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 @@
 			[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,10 @@
 		[AC_CHECK_HEADERS(
 			[lzo1x.h],
 			,
-			[AC_MSG_ERROR([lzo1x.h is missing])]
-		)]
+			[AC_MSG_ERROR([lzo1x.h is missing])],
+                        [#include <lzodefs.h>
+                         #include <lzoconf.h>]
+		)],
 	)
 	CFLAGS="${saved_CFLAGS}"
 fi
src/openvpn/lzo.h +3 -5
index 62d73a1..c271527 100644
@@ -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 include lzo/lzoconf.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)
 #include <lzo1x.h>
 #endif
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-MessageType: newpatchset

#11 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config
......................................................................

Patch Set 7:

(2 comments)

Patchset:

PS2:

Quoted 1 line

Yeah, I tried to include the -llzo check in pkg-config, which just made no sense. […]

Done

Patchset:

PS6:

Quoted 1 line

Okay, I can prepare a separate patch that gets rid of lzoutil.h completely. But as you said, the . […]

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Fri, 21 Jun 2024 13:03:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#12 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config
......................................................................

Patch Set 7: Code-Review+2

(2 comments)

Patchset:

PS6:

Quoted 1 line

close... […]

I think the pc is broken... everything LZO itself includes uses <lzo/lzoconf.h>... but it's the same (Cflags: -I${includedir}/lzo) on gentoo... where it just happens to work because /usr/include is in the include path anyway. Gah.

Patchset:

PS7:
Tested on FreeBSD 14, "configure with no option" -> succeeds & builds fine (LZO in /usr/local/..., make using -I/usr/local/include/lzo -I/usr/local/include because that's where cmocka and lz4 are living). Disabling LZ4 makes compilation succeed with only -I/usr/local/include/lzo. This is good :-)

All the buildbots still succeed, which means this hasn't broken explicitly setting "whatever we used before".

oi2024 has lzo in /usr/include/, so, boring case.

obsd75 has lzo in /usr/local/include/lzo, patched configure works, compile works. With --disable-lz4 there is no mention of -I/usr/local/include anymore, and it still succeeds ;-)

nbsd81 has /usr/pkg/include/lzo/ and the patched configure finds it fine, and then barfs on

```
configure:18379: checking for lzo1x.h
configure:18379: gcc -c -g -O2 -std=c99 -I/usr/pkg/include/lzo  conftest.c >&5
In file included from conftest.c:136:0:
/usr/pkg/include/lzo/lzodefs.h:1035:6: error: #error "unexpected configuration -
 check your compiler defines"
 #    error "unexpected configuration - check your compiler defines"
      ^
```

which is something weird about UINT_MAX testing against LZO_0xffffffffL. Not sure how to fix that. It does not break on the buildbot as that one has a symlink from /usr/include/lzo -> /usr/pkg/include/lzo (to apease older source trees) - with that, the configure change works fine. Without, it bombs. I would still tend to progress the patch, unless someone has a good idea how to tackle this...

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 26 Jun 2024 12:29:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#13 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

Hello cron2, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/556?usp=email

to look at the new patch set (#8).

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

---
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/8

config.h.cmake.in +0 -3
index effca2a..720d679 100644
@@ -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. */
-#define HAVE_LZO_CONF_H
-
 /* Define to 1 if you have the <lzo1x.h> header file. */
 #define HAVE_LZO1X_H 1
 
configure.ac +20 -4
index c01ad09..555c97e 100644
@@ -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="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 @@
 			[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 @@
 		[AC_CHECK_HEADERS(
 			[lzo1x.h],
 			,
-			[AC_MSG_ERROR([lzo1x.h is missing])]
-		)]
+			[AC_MSG_ERROR([lzo1x.h is missing])],
+                        [#include <limits.h>
+                         #include <lzodefs.h>
+                         #include <lzoconf.h>]
+		)],
 	)
 	CFLAGS="${saved_CFLAGS}"
 fi
src/openvpn/lzo.h +3 -5
index 62d73a1..c271527 100644
@@ -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 include lzo/lzoconf.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)
 #include <lzo1x.h>
 #endif
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#14 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config
......................................................................

Patch Set 8:

(2 comments)

Patchset:

PS6:

Quoted 1 line

I think the pc is broken... everything LZO itself includes uses <lzo/lzoconf.h>... […]

Done

Patchset:

PS7:

Quoted 1 line

Tested on FreeBSD 14, "configure with no option" -> succeeds & builds fine (LZO in /usr/local/... […]

We found out this is because lzodefs.h relies on lzoconf.h to include limits.h. So we need to imitate that.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Wed, 26 Jun 2024 13:51:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#15 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

Attention is currently required from: plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

Change subject: configure: Try to detect LZO with pkg-config
......................................................................

Patch Set 8: Code-Review+2

(1 comment)

Patchset:

PS8:
this should appease all systems :-) - the to-be-expected fails are server-null, so (at least that's what I expect) not a fault of this patch

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 26 Jun 2024 13:51:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#16 lore raw

PATCH v8 1/1 configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

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

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/556
This mail reflects revision 8 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

config.h.cmake.in +0 -3
index effca2a..720d679 100644
@@ -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. */
-#define HAVE_LZO_CONF_H
-
 /* Define to 1 if you have the <lzo1x.h> header file. */
 #define HAVE_LZO1X_H 1
 
configure.ac +20 -4
index c01ad09..555c97e 100644
@@ -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="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 @@
 			[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 @@
 		[AC_CHECK_HEADERS(
 			[lzo1x.h],
 			,
-			[AC_MSG_ERROR([lzo1x.h is missing])]
-		)]
+			[AC_MSG_ERROR([lzo1x.h is missing])],
+                        [#include <limits.h>
+                         #include <lzodefs.h>
+                         #include <lzoconf.h>]
+		)],
 	)
 	CFLAGS="${saved_CFLAGS}"
 fi
src/openvpn/lzo.h +3 -5
index 62d73a1..c271527 100644
@@ -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 include lzo/lzoconf.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)
 #include <lzo1x.h>
 #endif
 
#17 lore raw

[Openvpn-devel] [PATCH applied] Re: configure: Try to detect LZO with pkg-config

Detailed test reports are in the gerrit notes... so not repeating them here :-) - but finally, we have something that just detects LZO "wherever it is", as long as a pkg-config entry is there - the need to have LZO_CFLAGS/LZO_LIBS on all the *BSDs has irked me since 2.1 or so... (thanks!)

Sanity-tested the 2.6 branch via GHA.

Your patch has been applied to the master and release/2.6 branch (no real code change, maintenance).

commit 0ea51261d096b54281287bbd2a6899041c4dbd43 (master) commit 3c43b016e9767df74909ea5644399e8872e38c97 (release/2.6)

Author: Frank Lichtenheld
Date:   Wed Jun 26 18:19:21 2024 +0200
     configure: Try to detect LZO with pkg-config

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg28848.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#18 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

cron2 has uploaded a new patch set (#9) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28848.html

---
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

config.h.cmake.in +0 -3
index effca2a..720d679 100644
@@ -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. */
-#define HAVE_LZO_CONF_H
-
 /* Define to 1 if you have the <lzo1x.h> header file. */
 #define HAVE_LZO1X_H 1
 
configure.ac +20 -4
index c01ad09..555c97e 100644
@@ -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="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 @@
 			[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 @@
 		[AC_CHECK_HEADERS(
 			[lzo1x.h],
 			,
-			[AC_MSG_ERROR([lzo1x.h is missing])]
-		)]
+			[AC_MSG_ERROR([lzo1x.h is missing])],
+                        [#include <limits.h>
+                         #include <lzodefs.h>
+                         #include <lzoconf.h>]
+		)],
 	)
 	CFLAGS="${saved_CFLAGS}"
 fi
src/openvpn/lzo.h +3 -5
index 62d73a1..c271527 100644
@@ -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 include lzo/lzoconf.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)
 #include <lzo1x.h>
 #endif
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#19 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config

In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/556?usp=email )

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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28848.html

---
M config.h.cmake.in
M configure.ac
M src/openvpn/lzo.h

3 files changed, 23 insertions(+), 12 deletions(-)
config.h.cmake.in +0 -3
index effca2a..720d679 100644
@@ -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. */
-#define HAVE_LZO_CONF_H
-
 /* Define to 1 if you have the <lzo1x.h> header file. */
 #define HAVE_LZO1X_H 1
 
configure.ac +20 -4
index c01ad09..555c97e 100644
@@ -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="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 @@
 			[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 @@
 		[AC_CHECK_HEADERS(
 			[lzo1x.h],
 			,
-			[AC_MSG_ERROR([lzo1x.h is missing])]
-		)]
+			[AC_MSG_ERROR([lzo1x.h is missing])],
+                        [#include <limits.h>
+                         #include <lzodefs.h>
+                         #include <lzoconf.h>]
+		)],
 	)
 	CFLAGS="${saved_CFLAGS}"
 fi
src/openvpn/lzo.h +3 -5
index 62d73a1..c271527 100644
@@ -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 include lzo/lzoconf.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)
 #include <lzo1x.h>
 #endif
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/556?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c038dc4ec80d3499582d81eee61fee74f26e693
Gerrit-Change-Number: 556
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged