From 9a9c0d7b99d7478e1431bd3fa8c225bdc46b3df4 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 10 Mar 2020 10:50:56 +0100 Subject: [PATCH] configure: improve pkg-config support --- configure | 50 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 4a70118..a4c7b88 100755 --- a/configure +++ b/configure @@ -55,6 +55,34 @@ test_code () { return $result } #}}} +#{{{ test_executable +test_executable () { + name=$1 + executable=$2 + options=$3 + + printf "%s" "Checking for $name : " + + echo $executable $options >> config.log + $executable $options >> config.log 2>&1 + + if [ $? -eq 0 ] + then + echo "Yes" + result=0 + else + echo "No" + result=1 + fi + echo >> config.log + return $result +} +#}}} +#{{{ pkg_config +pkg_config () { + $PKG_CONFIG "$@" 2>> config.log +} +#}}} #{{{ usage usage () { cat < LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path Use these variables to override the choices made by \`configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -156,13 +189,6 @@ add_def () { fi } #}}} -#{{{ pkg_config -pkg_config () { - type pkg-config > /dev/null 2> /dev/null || return 1 - - pkg-config $@ 2> /dev/null -} -#}}} #{{{ get_features get_features () { ff=1 @@ -561,6 +587,16 @@ if [ "x$MYCC" = "xgcc" ] || [ "x$MYCC" = "xclang" ]; then MYCFLAGS="$MYCFLAGS -Wmissing-prototypes -Wall" fi +if [ "x$PKG_CONFIG" = "x" ]; then + PKG_CONFIG=pkg-config +fi + +if ! test_executable "pkg-config" $PKG_CONFIG --version; then + try_nettle=0 + try_nss=0 + try_gnutls=0 +fi + if test_code '64-bit time_t' 'time.h' '' '' ' char x[sizeof(time_t) > 4 ? 1 : -1] = {0}; return x[0];'