# HG changeset patch # User adf88@interia.pl # Date 1503170276 -7200 # Sat Aug 19 21:17:56 2017 +0200 # Branch trunk # Node ID 5c8c3a979b813dcbd3a7451fc09d9824ace5a7c1 # Parent 584e1cc2ffb25cb095e7ffa701d23530d5d10ea5 Preserve PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR environment variables in config.cache diff -r 584e1cc2ffb2 -r 5c8c3a979b81 config.lib --- a/config.lib Sun Aug 13 18:38:42 2017 +0000 +++ b/config.lib Sat Aug 19 21:17:56 2017 +0200 @@ -172,7 +172,7 @@ with_grfcodec with_nforenum with_sse - CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD" + CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR" } detect_params() { @@ -473,6 +473,8 @@ CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";; CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";; LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";; + PKG_CONFIG_PATH=* | --PKG_CONFIG_PATH=* | --PKG-CONFIG-PATH=*) PKG_CONFIG_PATH="$optarg";; + PKG_CONFIG_LIBDIR=* | --PKG_CONFIG_LIBDIR=* | --PKG-CONFIG-LIBDIR=*) PKG_CONFIG_LIBDIR="$optarg";; --ignore-extra-parameters) ignore_extra_parameters="1";; @@ -517,6 +519,20 @@ echo "" >> $config_log } +# Export a variable so tools like pkg-config can see it when invoked. +# If the variable contains an empty string then unset it. +# $1 - name of the variable to export or unset +export_or_unset() { + eval local value=\$$1 + if [ -n "$value" ]; then + export $1; + log 2 "using $1=$value"; + else + unset $1; + log 2 "not using $1"; + fi +} + check_params() { # Some params want to be in full uppercase, else they might not work as # expected.. fix that here @@ -525,6 +541,16 @@ os=`echo $os | tr '[a-z]' '[A-Z]'` cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'` + # Export some variables to be used by pkg-config + # + # PKG_CONFIG_LIBDIR variable musn't be set if we are not willing to + # override the default pkg-config search path, it musn't be an empty + # string. If the variable is empty (e.g. when an empty string comes + # from config.cache) then unset it. This way the "don't override" state + # will be properly preserved when (re)configuring. + export_or_unset PKG_CONFIG_PATH + export_or_unset PKG_CONFIG_LIBDIR + # Check if all params have valid values # Endian only allows AUTO, LE and, BE @@ -3562,6 +3588,8 @@ echo " CFLAGS_BUILD C compiler flags for build time tool generation" echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation" echo " LDFLAGS_BUILD linker flags for build time tool generation" + echo " PKG_CONFIG_PATH additional library search paths (see \"man pkg-config\")" + echo " PKG_CONFIG_LIBDIR replace the default library search path (see \"man pkg-config\")" echo "" echo "Use these variables to override the choices made by 'configure' or to help" echo "it to find libraries and programs with nonstandard names/locations."