summaryrefslogtreecommitdiff
path: root/check/check-system-flags
blob: 632496ca9575565001ddfaf7da59048a10187117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /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 GCC 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

    # Make sure these are not skipped in --msvc-syntax mode
    if [ "$native_win32" = yes ]; then
        RESULT="-I/usr/include"
        eval $var=/usr/include run_test --cflags --msvc-syntax system
    fi
done

# Check that the various MSVC environment variables also update the
# system include path when --msvc-syntax is in use
for var in INCLUDE; do
    RESULT="-I/usr/include"
    eval $var=/usr/include run_test --cflags system

    # Make sure these are skipped in --msvc-syntax mode
    if [ "$native_win32" = yes ]; then
        RESULT=""
        eval $var=/usr/include run_test --cflags --msvc-syntax system
    fi
done