From: Karel Zak Date: Tue, 14 Jun 2022 13:47:05 +0000 (+0200) Subject: build-sys: use PKG_CHECK_VAR() X-Git-Tag: v2.39-rc1~610 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6d3f34a8593adee7ba3dfa933fb5fb2c9ea7ff3;p=thirdparty%2Futil-linux.git build-sys: use PKG_CHECK_VAR() Do not call 'PKG_CONFIG --exists' and '$PKG_CONFIG --variable' if there is a much more robust PKG_CHECK_VAR() macro. It's also not necessary to check for the dirs if all the feature (systemd or bashcompletiondir) is disabled. Reported-by: Rolf Eike Beer Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index f6ce2d12b4..83c49d9444 100644 --- a/configure.ac +++ b/configure.ac @@ -2442,13 +2442,11 @@ AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$have_systemd" = xyes]) AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [directory for systemd unit files (requires systemd support)]), - [], [with_systemdsystemunitdir=check] -) -AS_IF([test "x$with_systemdsystemunitdir" = xcheck], [ + [], [ AS_IF([test "x$have_systemd" = xyes], [ - with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` - ],[ - with_systemdsystemunitdir=no + PKG_CHECK_VAR([with_systemdsystemunitdir], [systemd], [systemdsystemunitdir], + [], + [with_systemdsystemunitdir=no]) ]) ]) AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ @@ -2492,17 +2490,6 @@ AS_IF([test "x$with_vendordir" != x], [ ]) -AC_ARG_WITH([bashcompletiondir], - AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), - [], - [AS_IF([`$PKG_CONFIG --exists bash-completion`], [ - with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion` - ], [ - with_bashcompletiondir=${datadir}/bash-completion/completions - ]) -]) -AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) - AC_ARG_ENABLE([bash-completion], AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]), [], [enable_bash_completion=yes] @@ -2510,6 +2497,18 @@ AC_ARG_ENABLE([bash-completion], AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes]) +AC_ARG_WITH([bashcompletiondir], + AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), + [], [ + AS_IF([test "x$enable_bash_completion" = xyes], [ + PKG_CHECK_VAR([with_bashcompletiondir], [bash-completion], [completionsdir], + [], + [with_bashcompletiondir=${datadir}/bash-completion/completions]) + ]) +]) +AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) + + AC_ARG_WITH([python], AS_HELP_STRING([--without-python], [do not build python bindings, use --with-python={2,3} to force version]),