pkg-config/check/check-system-flags
Dan Nicholson 1dfe95b8b8 check: Add test for system flags pruning
Test that pkg-config respects the various environment variables that
override the system flags handling.

https://bugs.freedesktop.org/show_bug.cgi?id=94729
2017-03-20 11:06:00 -05:00

47 lines
1.2 KiB
Bash
Executable file

#! /bin/sh
set -e
. ${srcdir}/common
# Override the system paths in case pkg-config was built with something
# that doesn't match the test pc file
PKG_CONFIG_SYSTEM_INCLUDE_PATH=/usr/include
if [ "$native_win32" = yes ]; then
PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/lib;/lib"
else
PKG_CONFIG_SYSTEM_LIBRARY_PATH=/usr/lib:/lib
fi
export PKG_CONFIG_SYSTEM_INCLUDE_PATH PKG_CONFIG_SYSTEM_LIBRARY_PATH
RESULT=""
run_test --cflags system
RESULT="-lsystem"
run_test --libs system
# Make sure that the full paths come out when the *_ALLOW_SYSTEM_*
# variables are set
RESULT="-I/usr/include"
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 run_test --cflags system
RESULT="-L/usr/lib -lsystem"
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 run_test --libs system
# Set the system paths to something else and test that the output
# contains the full paths
PKG_CONFIG_SYSTEM_INCLUDE_PATH=/foo/include
PKG_CONFIG_SYSTEM_LIBRARY_PATH=/foo/lib
RESULT="-I/usr/include"
run_test --cflags system
RESULT="-L/usr/lib -lsystem"
run_test --libs system
# Now check that the various compiler environment variables also update
# the system include path
for var in CPATH C_INCLUDE_PATH CPP_INCLUDE_PATH; do
RESULT=""
eval $var=/usr/include run_test --cflags system
done