summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2012-10-16 20:44:16 -0700
committerDan Nicholson <dbn.lists@gmail.com>2012-11-03 11:07:59 -0700
commit90ed8f193fc36f4b0aabdae996a87a821c67fafc (patch)
tree625edc2638b47d21bc709f47a5c6da5c6b5164de /check
parentd630bf3c756f945b2b494141d504676c9446349d (diff)
Allow all combinations of --cflags and --libs variants
Use a bitmask to keep track of what Libs/Cflags to output. This makes it simple to handle any combination of --cflags and --libs option variants. A lot of excess code is removed in the process as all the flags options can now be carried around in a single variable. Freedesktop #54388 (https://bugs.freedesktop.org/show_bug.cgi?id=54388)
Diffstat (limited to 'check')
-rw-r--r--check/Makefile.am1
-rwxr-xr-xcheck/check-cflags8
-rwxr-xr-xcheck/check-libs20
-rwxr-xr-xcheck/check-mixed-flags79
4 files changed, 108 insertions, 0 deletions
diff --git a/check/Makefile.am b/check/Makefile.am
index 7330e52..8b8485f 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -4,6 +4,7 @@ TESTS_ENVIRONMENT = PKG_CONFIG='$(TESTS_PKG_CONFIG)' $(TESTS_SHELL)
TESTS = \
check-cflags \
check-libs \
+ check-mixed-flags \
check-non-l-flags \
check-define-variable \
check-libs-private \
diff --git a/check/check-cflags b/check/check-cflags
index e5dde65..033cf25 100755
--- a/check/check-cflags
+++ b/check/check-cflags
@@ -18,3 +18,11 @@ run_test --cflags-only-I other
RESULT="-DOTHER"
run_test --cflags-only-other other
+
+# Try various mixed combinations
+RESULT="-DOTHER -I/other/include"
+run_test --cflags-only-I --cflags-only-other other
+run_test --cflags-only-other --cflags-only-I other
+run_test --cflags --cflags-only-I --cflags-only-other other
+run_test --cflags --cflags-only-I other
+run_test --cflags --cflags-only-other other
diff --git a/check/check-libs b/check/check-libs
index 2f837fa..c453b2a 100755
--- a/check/check-libs
+++ b/check/check-libs
@@ -25,3 +25,23 @@ run_test --libs-only-L other
RESULT="-Wl,--as-needed"
run_test --libs-only-other other
+
+# Try various mixed combinations
+RESULT="-L/other/lib -lother"
+run_test --libs-only-l --libs-only-L other
+run_test --libs-only-L --libs-only-l other
+
+RESULT="-Wl,--as-needed -lother"
+run_test --libs-only-l --libs-only-other other
+run_test --libs-only-other --libs-only-l other
+
+RESULT="-Wl,--as-needed -L/other/lib"
+run_test --libs-only-L --libs-only-other other
+run_test --libs-only-other --libs-only-L other
+
+RESULT="-Wl,--as-needed -L/other/lib -lother"
+run_test --libs-only-l --libs-only-L --libs-only-other other
+run_test --libs --libs-only-l --libs-only-L --libs-only-other other
+run_test --libs --libs-only-l other
+run_test --libs --libs-only-L other
+run_test --libs --libs-only-other other
diff --git a/check/check-mixed-flags b/check/check-mixed-flags
new file mode 100755
index 0000000..b96c3b7
--- /dev/null
+++ b/check/check-mixed-flags
@@ -0,0 +1,79 @@
+#! /bin/sh
+
+set -e
+
+. ${srcdir}/common
+
+RESULT="-DOTHER -I/other/include -Wl,--as-needed -L/other/lib -lother"
+run_test --cflags --libs other
+run_test --libs --cflags other
+run_test --cflags-only-I --cflags-only-other --libs-only-l --libs-only-L \
+ --libs-only-other other
+
+RESULT="-I/other/include -lother"
+run_test --cflags-only-I --libs-only-l other
+run_test --libs-only-l --cflags-only-I other
+
+RESULT="-DOTHER -lother"
+run_test --cflags-only-other --libs-only-l other
+run_test --libs-only-l --cflags-only-other other
+
+RESULT="-I/other/include -L/other/lib"
+run_test --cflags-only-I --libs-only-L other
+run_test --libs-only-L --cflags-only-I other
+
+RESULT="-DOTHER -L/other/lib"
+run_test --cflags-only-other --libs-only-L other
+run_test --libs-only-L --cflags-only-other other
+
+RESULT="-I/other/include -Wl,--as-needed"
+run_test --cflags-only-I --libs-only-other other
+run_test --libs-only-other --cflags-only-I other
+
+RESULT="-DOTHER -Wl,--as-needed"
+run_test --cflags-only-other --libs-only-other other
+run_test --libs-only-other --cflags-only-other other
+
+RESULT="-I/other/include -L/other/lib -lother"
+run_test --cflags-only-I --libs-only-L --libs-only-l other
+run_test --libs-only-l --libs-only-L --cflags-only-I other
+
+RESULT="-DOTHER -L/other/lib -lother"
+run_test --cflags-only-other --libs-only-L --libs-only-l other
+run_test --libs-only-l --libs-only-L --cflags-only-other other
+
+RESULT="-I/other/include -Wl,--as-needed -lother"
+run_test --cflags-only-I --libs-only-other --libs-only-l other
+run_test --libs-only-l --libs-only-other --cflags-only-I other
+
+RESULT="-DOTHER -Wl,--as-needed -lother"
+run_test --cflags-only-other --libs-only-other --libs-only-l other
+run_test --libs-only-l --libs-only-other --cflags-only-other other
+
+RESULT="-I/other/include -Wl,--as-needed -L/other/lib"
+run_test --cflags-only-I --libs-only-other --libs-only-L other
+run_test --libs-only-L --libs-only-other --cflags-only-I other
+
+RESULT="-DOTHER -Wl,--as-needed -L/other/lib"
+run_test --cflags-only-other --libs-only-other --libs-only-L other
+run_test --libs-only-L --libs-only-other --cflags-only-other other
+
+RESULT="-DOTHER -I/other/include -lother"
+run_test --cflags --libs-only-l other
+run_test --cflags-only-I --cflags-only-other --libs-only-l other
+
+RESULT="-DOTHER -I/other/include -L/other/lib"
+run_test --cflags --libs-only-L other
+run_test --cflags-only-I --cflags-only-other --libs-only-L other
+
+RESULT="-DOTHER -I/other/include -Wl,--as-needed"
+run_test --cflags --libs-only-other other
+run_test --cflags-only-I --cflags-only-other --libs-only-other other
+
+RESULT="-I/other/include -Wl,--as-needed -L/other/lib -lother"
+run_test --cflags-only-I --libs other
+run_test --cflags-only-I --libs-only-l --libs-only-L --libs-only-other other
+
+RESULT="-DOTHER -Wl,--as-needed -L/other/lib -lother"
+run_test --cflags-only-other --libs other
+run_test --cflags-only-other --libs-only-l --libs-only-L --libs-only-other other