From: "cron2 (Code Review)" cron2 submitted this change. To view, visit <=
a href=3D"http://gerrit.openvpn.net/c/openvpn/+/465?usp=3Demail">change 465=
Make it more explicit and visible when pkg-con=
fig is not found
Users seem to struggle to read the full error messa=
ge. This adds an
indication if pkg-config is actually found to the warni=
ng/error message
that use pkg-config.
On platforms that do not re=
quire pkg-config and for optional libraries,
the existence of pkg-config=
is mentioned as part of the error/warning message.
When found:
<=
br> configure: error: libnl-genl-3.0 package not found or too old. Is th=
e development package and pkg-config (/usr/bin/pkg-config) installed? Must =
be version 3.4.0 or newer for DCO
not found:
configure: e=
rror: libnl-genl-3.0 package not found or too old. Is the development packa=
ge and pkg-config (not found) installed? Must be version 3.4.0 or newer for=
DCO
On platforms where pkg-config is required (only Linux at the mo=
ment),
configure will abort when not detecting pkg-config:
checki=
ng for pkg-config... no
configure: error: pkg-config is required
=
Change-Id: Iebaa35a23e217a4cd7739af229cbfc08a3d8854a
Signed-off-by: Arne=
Schwabe <arne@...1227...>
Acked-by: Antonio Quartulli <a@...2267...=
81...>
Message-Id: <20240105140540.14757-1-gert@...1296...>
=
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27=
939.html
Signed-off-by: Gert Doering <gert@...1296...>
---
M=
configure.ac
1 file changed, 17 insertions(+), 5 deletions(-)
=
pre>
index f420612..=
3ad9f14 100644
--- a/configure.ac
+++ b/con=
figure.ac
@@ -323,6 +323,7 @@
AM_CONDITI=
ONAL([TARGET_LINUX], [true])
AC_DEFINE_UNQUOTED([TARGET_=
PREFIX], ["L"], [Target prefix])
have_sitnl=3D=
"yes"
+ pk=
g_config_required=3D"yes"
;;
=
*-*-solaris*)
AC_DEFINE([TARGET_SOLARIS], [1], [Are we =
running on Solaris?])
@@ -376,6 +377,16 @@
=
AM_CONDITIONAL([CROSS_COMPILING], test "${cross_compiling}" =3D =
"yes")
PKG_PROG_PKG_CONFIG
+# Add variable to print=
if pkg-config is found or not. Users often miss that
+if test "${PKG_CONFIG}" =3D &qu=
ot;"; then
+ if =
test "${pkg_config_required}" =3D "yes"; then
+ AC_MSG_ERROR([pkg-config is=
required])
+ fi
+ pkg_config_found=3D&quo=
t;(not found)"
+=
else
+ pkg_config_fou=
nd=3D"(${PKG_CONFIG})"
+fi
+
AC_PROG_CPP
AC_PROG_INSTALL
=
AC_PROG_LN_S
@@ -810,7 +821,7 @@
[=
libnl-genl-3.0 >=3D 3.4.0],
[have_libnl=3D"=
yes"],
[
- AC_MSG_ERROR([libnl-genl-3.0 package not found or t=
oo old. Is the development package and pkg-config installed? Must be versio=
n 3.4.0 or newer for DCO])
+ AC_MSG_ERROR([libnl-genl-3.0 package not found or too old. I=
s the development package and pkg-config ${pkg_config_found} installed? Mus=
t be version 3.4.0 or newer for DCO])
]
<=
span> )
CFLAGS=3D"${CFLAGS} ${LIBNL_GENL_CFLA=
GS}"
@@ -854,10 +865,11 @@
dnl=
case "$host" in
*-*-linux*)+ # We require pkg-config
PKG_CHECK_MODULES([LIBCAPNG],
[libc=
ap-ng],
[],
- [AC_MSG_ERROR([libcap-ng package not found. Is the devel=
opment package and pkg-config installed?])]
+ [AC_MSG_ERROR([libcap-ng package not found. I=
s the development package and pkg-config ${pkg_config_found} installed?])]<=
/span>
)
AC_CHECK_HEADER([sys/prctl.h],,[AC_=
MSG_ERROR([sys/prctl.h not found!])])
@@ =
-878,7 +890,7 @@
[OPENSSL],
[openss=
l >=3D 1.0.2],
[have_openssl=3D"yes"],
- [] # If this fails, we=
will do another test next
+ [AC_MSG_WARN([OpenSSL not found by pkg-config ${pkg_config_found}=
])] # If this fails, we will do another test next
)
OPENSSL_LIBS=3D${OPENSSL_LIBS:--lssl -lcrypto}
@@ -1083,7 +1095,7 @@
[WOLFSSL]=
,
[wolfssl],
[],
- [AC_MSG_ERROR([Could not find wolfSSL=
.])]
+ [AC_MSG_ERRO=
R([Could not find wolfSSL using pkg-config ${pkg_config_found}])]
)
PKG_CHECK_VAR(
[WOLFSSL_=
INCLUDEDIR],
@@ -1508,7 +1520,7 @@
PKG_CHE=
CK_MODULES(
[CMOCKA], [cmocka],
[have_c=
mocka=3D"yes"],
- [AC_MSG_WARN([cmocka.pc not found on the system. Unit tests disabled]=
)]
+ [AC_MSG_WARN([cm=
ocka.pc not found on the system using pkg-config ${pkg_config_found}. Unit=
tests disabled])]
)
AM_CONDITIONAL([ENAB=
LE_UNITTESTS], [test "${enable_unit_tests}" =3D "yes" -=
a "${have_cmocka}" =3D "yes" ])
AC_SUB=
ST([ENABLE_UNITTESTS])