Users seem to struggle to read the full error message. This adds an
indication if pkg-config is actually found to the warning/error message
that use pkg-config.
On platforms that do not require pkg-config and for optional libraries,
the existence of pkg-config is mentioned as part of the error/warning message.
When found:
configure: error: libnl-genl-3.0 package not found or too old. Is the development package and pkg-config (/usr/bin/pkg-config) installed? Must be version 3.4.0 or newer for DCO
not found:
configure: error: libnl-genl-3.0 package not found or too old. Is the development package 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 moment),
configure will abort when not detecting pkg-config:
checking for pkg-config... no
configure: error: pkg-config is required
Change-Id: Iebaa35a23e217a4cd7739af229cbfc08a3d8854a
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <20240105140540.14757-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27939.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit c0f38019b4a2044c1fe873d7d33c13ce571d3386)
| ... | ... |
@@ -329,6 +329,7 @@ case "$host" in |
| 329 | 329 |
AM_CONDITIONAL([TARGET_LINUX], [true]) |
| 330 | 330 |
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix]) |
| 331 | 331 |
have_sitnl="yes" |
| 332 |
+ pkg_config_required="yes" |
|
| 332 | 333 |
;; |
| 333 | 334 |
*-*-solaris*) |
| 334 | 335 |
AC_DEFINE([TARGET_SOLARIS], [1], [Are we running on Solaris?]) |
| ... | ... |
@@ -382,6 +383,16 @@ esac |
| 382 | 382 |
AM_CONDITIONAL([CROSS_COMPILING], test "${cross_compiling}" = "yes")
|
| 383 | 383 |
|
| 384 | 384 |
PKG_PROG_PKG_CONFIG |
| 385 |
+# Add variable to print if pkg-config is found or not. Users often miss that |
|
| 386 |
+if test "${PKG_CONFIG}" = ""; then
|
|
| 387 |
+ if test "${pkg_config_required}" = "yes"; then
|
|
| 388 |
+ AC_MSG_ERROR([pkg-config is required]) |
|
| 389 |
+ fi |
|
| 390 |
+ pkg_config_found="(not found)" |
|
| 391 |
+else |
|
| 392 |
+ pkg_config_found="(${PKG_CONFIG})"
|
|
| 393 |
+fi |
|
| 394 |
+ |
|
| 385 | 395 |
AC_PROG_CPP |
| 386 | 396 |
AC_PROG_INSTALL |
| 387 | 397 |
AC_PROG_LN_S |
| ... | ... |
@@ -819,7 +830,7 @@ if test "$enable_dco" != "no"; then |
| 819 | 819 |
[libnl-genl-3.0 >= 3.4.0], |
| 820 | 820 |
[have_libnl="yes"], |
| 821 | 821 |
[ |
| 822 |
- AC_MSG_ERROR([libnl-genl-3.0 package not found or too old. Is the development package and pkg-config installed? Must be version 3.4.0 or newer for DCO]) |
|
| 822 |
+ AC_MSG_ERROR([libnl-genl-3.0 package not found or too old. Is the development package and pkg-config ${pkg_config_found} installed? Must be version 3.4.0 or newer for DCO])
|
|
| 823 | 823 |
] |
| 824 | 824 |
) |
| 825 | 825 |
CFLAGS="${CFLAGS} ${LIBNL_GENL_CFLAGS}"
|
| ... | ... |
@@ -863,10 +874,11 @@ dnl Depend on libcap-ng on Linux |
| 863 | 863 |
dnl |
| 864 | 864 |
case "$host" in |
| 865 | 865 |
*-*-linux*) |
| 866 |
+ # We require pkg-config |
|
| 866 | 867 |
PKG_CHECK_MODULES([LIBCAPNG], |
| 867 | 868 |
[libcap-ng], |
| 868 | 869 |
[], |
| 869 |
- [AC_MSG_ERROR([libcap-ng package not found. Is the development package and pkg-config installed?])] |
|
| 870 |
+ [AC_MSG_ERROR([libcap-ng package not found. Is the development package and pkg-config ${pkg_config_found} installed?])]
|
|
| 870 | 871 |
) |
| 871 | 872 |
AC_CHECK_HEADER([sys/prctl.h],,[AC_MSG_ERROR([sys/prctl.h not found!])]) |
| 872 | 873 |
|
| ... | ... |
@@ -887,7 +899,7 @@ if test "${with_crypto_library}" = "openssl"; then
|
| 887 | 887 |
[OPENSSL], |
| 888 | 888 |
[openssl >= 1.0.2], |
| 889 | 889 |
[have_openssl="yes"], |
| 890 |
- [] # If this fails, we will do another test next |
|
| 890 |
+ [AC_MSG_WARN([OpenSSL not found by pkg-config ${pkg_config_found}])] # If this fails, we will do another test next
|
|
| 891 | 891 |
) |
| 892 | 892 |
OPENSSL_LIBS=${OPENSSL_LIBS:--lssl -lcrypto}
|
| 893 | 893 |
fi |
| ... | ... |
@@ -1070,7 +1082,7 @@ elif test "${with_crypto_library}" = "wolfssl"; then
|
| 1070 | 1070 |
[WOLFSSL], |
| 1071 | 1071 |
[wolfssl], |
| 1072 | 1072 |
[], |
| 1073 |
- [AC_MSG_ERROR([Could not find wolfSSL.])] |
|
| 1073 |
+ [AC_MSG_ERROR([Could not find wolfSSL using pkg-config ${pkg_config_found}])]
|
|
| 1074 | 1074 |
) |
| 1075 | 1075 |
PKG_CHECK_VAR( |
| 1076 | 1076 |
[WOLFSSL_INCLUDEDIR], |
| ... | ... |
@@ -1478,7 +1490,7 @@ AC_ARG_ENABLE( |
| 1478 | 1478 |
PKG_CHECK_MODULES( |
| 1479 | 1479 |
[CMOCKA], [cmocka], |
| 1480 | 1480 |
[have_cmocka="yes"], |
| 1481 |
- [AC_MSG_WARN([cmocka.pc not found on the system. Unit tests disabled])] |
|
| 1481 |
+ [AC_MSG_WARN([cmocka.pc not found on the system using pkg-config ${pkg_config_found}. Unit tests disabled])]
|
|
| 1482 | 1482 |
) |
| 1483 | 1483 |
AM_CONDITIONAL([ENABLE_UNITTESTS], [test "${enable_unit_tests}" = "yes" -a "${have_cmocka}" = "yes" ])
|
| 1484 | 1484 |
AC_SUBST([ENABLE_UNITTESTS]) |