summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2012-10-01 15:13:48 -0700
committerDan Nicholson <dbn.lists@gmail.com>2012-10-03 05:33:31 -0700
commit4f7d2a1b285f8104885aa8fe60622c64b6234e79 (patch)
tree5c378058d9b00362c0ceac1b34d84ca6fb7eac07 /check
parent83aef0efd952a33c2ef5d56397002a5123bb073a (diff)
downloadpkg-config-4f7d2a1b285f8104885aa8fe60622c64b6234e79.tar.gz
check: Test -uninstalled functionality
Test the usage of -uninstalled packages with two .pc files: inst.pc and inst-uninstalled.pc. pkg-config should prefer the -uninstalled version unless PKG_CONFIG_DISABLE_UNINSTALLED is set. It should also use the default value of pc_top_builddir unless PKG_CONFIG_TOP_BUILD_DIR is set.
Diffstat (limited to 'check')
-rw-r--r--check/Makefile.am7
-rwxr-xr-xcheck/check-uninstalled46
-rw-r--r--check/inst-uninstalled.pc11
-rw-r--r--check/inst.pc11
4 files changed, 73 insertions, 2 deletions
diff --git a/check/Makefile.am b/check/Makefile.am
index 87264b5..d3510cc 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -16,7 +16,8 @@ TESTS = \
check-version \
check-print-options \
check-path \
- check-sysroot
+ check-sysroot \
+ check-uninstalled
EXTRA_DIST = \
$(TESTS) \
@@ -33,4 +34,6 @@ EXTRA_DIST = \
whitespace.pc \
fields-blank.pc \
sub/sub1.pc \
- sub/sub2.pc
+ sub/sub2.pc \
+ inst.pc \
+ inst-uninstalled.pc
diff --git a/check/check-uninstalled b/check/check-uninstalled
new file mode 100755
index 0000000..dee7881
--- /dev/null
+++ b/check/check-uninstalled
@@ -0,0 +1,46 @@
+#! /bin/sh
+
+set -e
+
+. ${srcdir}/common
+
+# Check to see if we find the uninstalled version
+RESULT=''
+run_test --uninstalled inst
+
+RESULT=''
+run_test --exists inst \>= 2.0
+
+RESULT='-I$(top_builddir)/include'
+run_test --cflags inst
+
+RESULT='-L$(top_builddir)/lib -linst'
+run_test --libs inst
+
+# Alter PKG_CONFIG_TOP_BUILD_DIR
+export PKG_CONFIG_TOP_BUILD_DIR='$(abs_top_builddir)'
+
+RESULT='-I$(abs_top_builddir)/include'
+run_test --cflags inst
+
+RESULT='-L$(abs_top_builddir)/lib -linst'
+run_test --libs inst
+
+unset PKG_CONFIG_TOP_BUILD_DIR
+
+# Check to see if we get the original back
+export PKG_CONFIG_DISABLE_UNINSTALLED=1
+
+RESULT=''
+EXPECT_RETURN=1 run_test --uninstalled inst
+
+RESULT=''
+EXPECT_RETURN=1 run_test --exists inst \>= 2.0
+
+RESULT='-I/inst/include'
+run_test --cflags inst
+
+RESULT='-L/inst/lib -linst'
+run_test --libs inst
+
+unset PKG_CONFIG_DISABLE_UNINSTALLED
diff --git a/check/inst-uninstalled.pc b/check/inst-uninstalled.pc
new file mode 100644
index 0000000..3283a26
--- /dev/null
+++ b/check/inst-uninstalled.pc
@@ -0,0 +1,11 @@
+prefix=${pc_top_builddir}
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: Uninstalled test package
+Description: Test package for checking -uninstalled behavior
+Version: 2.0.0
+Requires:
+Libs: -L${libdir} -linst
+Cflags: -I${includedir}
diff --git a/check/inst.pc b/check/inst.pc
new file mode 100644
index 0000000..64d8d58
--- /dev/null
+++ b/check/inst.pc
@@ -0,0 +1,11 @@
+prefix=/inst
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: Installed test package
+Description: Test package for checking -uninstalled behavior
+Version: 1.0.0
+Requires:
+Libs: -L${libdir} -linst
+Cflags: -I${includedir}