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

Message ID 7bb7024258ddc0adf342620e9bafebd19d0ea135-HTML@gerrit.openvpn.net
State Superseded
Headers show
Series [Openvpn-devel,S] Change in openvpn[master]: configure: Try to detect LZO with pkg-config first | expand

Commit Message

flichtenheld (Code Review) April 22, 2024, 3:43 p.m. UTC
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
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
---
M configure.ac
1 file changed, 12 insertions(+), 1 deletion(-)



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

Patch

diff --git a/configure.ac b/configure.ac
index ce8b2b0..159d47c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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}"