diff mbox series

configure: Replace PKG_CONFIG calls with PKG_CHECK_VAR

Message ID 20201126203053.12028-1-ismael@iodev.co.uk
State New
Headers show
Series configure: Replace PKG_CONFIG calls with PKG_CHECK_VAR | expand

Commit Message

Ismael Luceno Nov. 26, 2020, 8:30 p.m. UTC
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
 configure.ac | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 29d043f18950..8e130b3f0775 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,12 +204,8 @@  AC_ARG_WITH(
         [udev-rules-dir],
         AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]),
         [udevrulesdir="$withval"],
-        [udevdir=$($PKG_CONFIG udev --variable=udevdir)
-        if test "x$udevdir" = "x"; then
-            udevrulesdir="/lib/udev/rules.d"
-        else
-            udevrulesdir="$udevdir/rules.d"
-        fi])
+        [PKG_CHECK_VAR([udevdir], [udev], [udevdir])
+	 udevrulesdir="${udevdir:-/lib/udev}/rules.d"])
 AC_SUBST(udevrulesdir)
 
 dnl Checks for header files.
@@ -404,10 +400,10 @@  PKG_CHECK_MODULES(SYSTEMD, [systemd >= 18],
         [have_min_systemd="no"])
 AC_ARG_WITH([systemdsystemunitdir],
         AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
-        [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
-if test "x$with_systemdsystemunitdir" != xno; then
-        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
-fi
+        [], [PKG_CHECK_VAR([with_systemdsystemunitdir], [systemd], [systemdsystemunitdir])])
+AS_IF([test "x$with_systemdsystemunitdir" != xno],
+	[AC_SUBST([systemdsystemunitdir], ["$with_systemdsystemunitdir"])])
+
 AM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_min_systemd" = "yes" \
         -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])