pkg-config/check/check-sysroot
Dan Nicholson d5d8074893 Respect sysroot for -isystem and -idirafter
Treat -isystem and -idirafter as -I Cflags since they control the
compiler search path. Adjust the sysroot handling so that the arguments
to these options have the sysroot prefixed. However, leave them out of the
system Cflags handling since these directives are explicitly trying to
adjust the compiler's system header search behavior.

The special-flags test case output needs adjustment since all the flags
are now considered -I flags and come out in the order specified in the
pc file.

https://bugs.freedesktop.org/show_bug.cgi?id=97337
2017-03-20 07:13:23 -05:00

38 lines
1 KiB
Bash
Executable file

#! /bin/sh
set -e
. ${srcdir}/common
export PKG_CONFIG_SYSROOT_DIR=/sysroot
# MSYS mangles / paths to its own root in windows format. This probably
# means sysroot doesn't work there, but match what pkg-config passes
# back anyway.
[ "$OSTYPE" = msys ] && root=$(cd / && pwd -W) || root=
RESULT=""
run_test --cflags simple
RESULT="-lsimple"
if [ "$list_indirect_deps" = no ]; then
run_test --libs simple
fi
RESULT="-lsimple -lm"
if [ "$list_indirect_deps" = yes ]; then
run_test --libs simple
fi
run_test --libs --static simple
RESULT="-I$root/sysroot/public-dep/include"
run_test --cflags public-dep
RESULT="-L$root/sysroot/public-dep/lib -lpublic-dep"
run_test --libs public-dep
RESULT="-g -ffoo -I$root/sysroot/foo -isystem $root/sysroot/system1 -idirafter $root/sysroot/after1 -I$root/sysroot/bar -idirafter $root/sysroot/after2 -isystem $root/sysroot/system2"
run_test --cflags special-flags
RESULT="-L$root/sysroot/foo -L$root/sysroot/bar -framework Foo -lsimple -framework Bar -Wl,-framework -Wl,Baz"
run_test --libs special-flags