Changeset - r22681:48366d4e6cf3
[Not reviewed]
master
0 1 0
adf88 - 7 years ago 2017-08-27 16:07:24
adf88@openttd.org
(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
1 file changed with 29 insertions and 1 deletions:
0 comments (0 inline, 0 general)
config.lib
Show inline comments
 
@@ -169,13 +169,13 @@ set_default() {
 
		with_threads
 
		with_distcc
 
		with_ccache
 
		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() {
 
	# Walk over all params from the user and override any default settings if
 
	#  needed. This also handles any invalid option.
 
	for p in "$@"; do
 
@@ -470,12 +470,14 @@ detect_params() {
 
			CFLAGS=* | --CFLAGS=*)        CFLAGS="$optarg";;
 
			CXXFLAGS=* | --CXXFLAGS=*)    CXXFLAGS="$optarg";;
 
			LDFLAGS=* | --LDFLAGS=*)      LDFLAGS="$optarg";;
 
			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";;
 

	
 
			--* | -*)
 
				if [ "$ignore_extra_parameters" = "0" ]; then
 
					log 1 "Unknown option $p"
 
@@ -514,20 +516,44 @@ save_params() {
 

	
 
	echo "$configure" >> $config_log
 
	echo "$configure" > config.cache
 
	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
 

	
 
	endian=`echo $endian | tr '[a-z]' '[A-Z]'`
 
	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
 
	if [ -z "`echo $endian | egrep '^(AUTO|LE|BE|PREPROCESSOR)$'`" ]; then
 
		log 1 "configure: error: invalid option --endian=$endian"
 
		log 1 " Available options are: --endian=[AUTO|LE|BE]"
 
@@ -3559,10 +3585,12 @@ showhelp() {
 
	echo "  LDFLAGS                        linker flags, e.g. -L<lib dir> if you"
 
	echo "                                 have libraries in a nonstandard"
 
	echo "                                 directory <lib dir>"
 
	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."
 
}
0 comments (0 inline, 0 general)