From 960a785e10523cc525885380dd03aa2c5ba11bc7 Mon Sep 17 00:00:00 2001 From: Martin Kennedy Date: Wed, 3 Apr 2019 17:01:42 -0400 Subject: [PATCH] Use a guard to prevent dependency on pkg-config when it is not available I picked the methodology off of https://github.com/curl/curl/issues/972. The benefit here is that if someone does not have pkg-config (we know this is unlikely anyways), their configuration script just won't end up with the checks. This provides a patch similar to the one requested in issue #120. --- configure.ac | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 5c1e1ef..aeff177 100644 --- a/configure.ac +++ b/configure.ac @@ -45,8 +45,10 @@ AC_ARG_ENABLE([log-debug], # Mandatory dependencies # -PKG_CHECK_MODULES([DEPS], [libudev libsystemd > 219]) -PKG_CHECK_MODULES([GLIB], [glib-2.0]) +m4_ifdef([PKG_CHECK_MODULES], [ + PKG_CHECK_MODULES([DEPS], [libudev libsystemd > 219]) + PKG_CHECK_MODULES([GLIB], [glib-2.0]) +]) AC_CHECK_HEADERS(readline/readline.h,, AC_MSG_ERROR(GNU readline not found)) @@ -55,8 +57,10 @@ AC_CHECK_HEADERS(readline/readline.h,, AC_MSG_ERROR(GNU readline not found)) # all tests. # -PKG_CHECK_MODULES([CHECK], [check], - [have_check=yes], [have_check=no]) +m4_ifdef([PKG_CHECK_MODULES], [ + PKG_CHECK_MODULES([CHECK], [check], + [have_check=yes], [have_check=no]) +]) AM_CONDITIONAL([BUILD_HAVE_CHECK], [test "x$have_check" = "xyes"]) if test "x$have_check" = "xyes"