summaryrefslogtreecommitdiff
path: root/config.lib
diff options
context:
space:
mode:
authoradf88 <adf88@openttd.org>2017-08-27 16:07:24 +0000
committeradf88 <adf88@openttd.org>2017-08-27 16:07:24 +0000
commit2aa806842f00092d5e5f8bf3faf6aa31ac27ff3f (patch)
tree78cc761e7cfc3efc76ba90aa8bfa54d3075f3e5e /config.lib
parent09abccd3164aada3176fa879f7e109a5117bd2f5 (diff)
downloadopenttd-2aa806842f00092d5e5f8bf3faf6aa31ac27ff3f.tar.xz
(svn r27902) -Feature [FS#6614]: Preserve PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR environment variables in config.cache file (just like other variabes CFLAGS, LDFLAGS etc.) so they can be resused when OpenTTD re-configures itself
Diffstat (limited to 'config.lib')
-rw-r--r--config.lib30
1 files changed, 29 insertions, 1 deletions
diff --git a/config.lib b/config.lib
index 3d10aaa3f..bc2224f68 100644
--- a/config.lib
+++ b/config.lib
@@ -172,7 +172,7 @@ set_default() {
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 @@ detect_params() {
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 @@ save_params() {
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 @@ check_params() {
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 @@ showhelp() {
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."