summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2012-11-13 05:51:18 -0800
committerDan Nicholson <dbn.lists@gmail.com>2012-11-28 05:52:13 -0800
commitf5b93bf1b18002c6409c8762d283e216fc045f5c (patch)
tree73c4b88b3637bb9ca98d308d0a3ab719f3b8f4e5
parent3e54448158f42677cfc2de06ff1a910d4289ae59 (diff)
downloadpkg-config-f5b93bf1b18002c6409c8762d283e216fc045f5c.tar.gz
Test stripping of duplicate flags
pkg-config aggressively strips all duplicate arguments from the final output it builds. This is not only and optimization, but it also allows the flag ordering to work correctly when a package on the command line is required by another on the command line.
-rw-r--r--check/Makefile.am5
-rwxr-xr-xcheck/check-duplicate-flags15
-rw-r--r--check/flag-dup-1.pc10
-rw-r--r--check/flag-dup-2.pc11
4 files changed, 40 insertions, 1 deletions
diff --git a/check/Makefile.am b/check/Makefile.am
index e8a4435..cf26f76 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -15,6 +15,7 @@ TESTS = \
check-missing \
check-idirafter \
check-sort-order \
+ check-duplicate-flags \
check-whitespace \
check-cmd-options \
check-version \
@@ -61,4 +62,6 @@ EXTRA_DIST = \
sort/sort/sort-order-3-2.pc \
sort-order-1-3.pc \
sort/sort-order-2-3.pc \
- sort/sort/sort-order-3-3.pc
+ sort/sort/sort-order-3-3.pc \
+ flag-dup-1.pc \
+ flag-dup-2.pc
diff --git a/check/check-duplicate-flags b/check/check-duplicate-flags
new file mode 100755
index 0000000..b1ab54b
--- /dev/null
+++ b/check/check-duplicate-flags
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+set -e
+
+. ${srcdir}/common
+
+RESULT="-DPATH2 -DFOO -DPATH1 -I/path/include"
+run_test --cflags flag-dup-1 flag-dup-2
+RESULT="-DPATH1 -DFOO -DPATH2 -I/path/include"
+run_test --cflags flag-dup-2 flag-dup-1
+
+RESULT="-Wl,--whole-archive --Wl,--no-whole-archive -Xlinker -R /path/lib \
+-L/path/lib -lpath2 -lpath1 -lm"
+run_test --libs flag-dup-1 flag-dup-2
+run_test --libs flag-dup-2 flag-dup-1
diff --git a/check/flag-dup-1.pc b/check/flag-dup-1.pc
new file mode 100644
index 0000000..7e91151
--- /dev/null
+++ b/check/flag-dup-1.pc
@@ -0,0 +1,10 @@
+prefix=/path
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Flag duplicate test 1
+Description: Test package for checking stripping of duplicate flags
+Version: 1.0.0
+Libs: -L${libdir} -lpath1 -Wl,--whole-archive -lm --Wl,--no-whole-archive -Xlinker -R -Xlinker ${libdir}
+Cflags: -I${includedir} -DPATH1 -DFOO
diff --git a/check/flag-dup-2.pc b/check/flag-dup-2.pc
new file mode 100644
index 0000000..fe1b656
--- /dev/null
+++ b/check/flag-dup-2.pc
@@ -0,0 +1,11 @@
+prefix=/path
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Flag duplicate test 2
+Description: Test package for checking stripping of duplicate flags
+Version: 1.0.0
+Libs: -L${libdir} -lpath2 -Wl,--whole-archive -lm --Wl,--no-whole-archive -Xlinker -R -Xlinker ${libdir}
+Cflags: -I${includedir} -DPATH2 -DFOO
+Requires: flag-dup-1