summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2022-01-24 11:06:43 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2022-01-24 11:06:43 +0900
commit07afa81fd8e671737c2dc2f59c6dc3b89786d4e6 (patch)
tree5afffbf262786b53273f1557b2e46dc36122892f
parent819be1ee64cb6c29cee8eff43fbe2baa036b052f (diff)
downloadpkg-config-07afa81fd8e671737c2dc2f59c6dc3b89786d4e6.tar.gz
pkg-config-07afa81fd8e671737c2dc2f59c6dc3b89786d4e6.tar.bz2
pkg-config-07afa81fd8e671737c2dc2f59c6dc3b89786d4e6.zip
Imported Upstream version 0.29.2upstream/0.29.2upstream
-rw-r--r--NEWS22
-rw-r--r--check/Makefile.am16
-rw-r--r--check/Makefile.in16
-rwxr-xr-xcheck/check-dependencies44
-rwxr-xr-xcheck/check-relocatable7
-rwxr-xr-xcheck/check-special-flags4
-rwxr-xr-xcheck/check-sysroot6
-rwxr-xr-xcheck/check-system-flags66
-rw-r--r--check/dependencies/a_dep_c.pc10
-rw-r--r--check/dependencies/b_dep_c.pc10
-rw-r--r--check/dependencies/c_dep.pc9
-rw-r--r--check/dependencies/d_dep_e_f.pc10
-rw-r--r--check/dependencies/d_dep_f_e.pc10
-rw-r--r--check/dependencies/e_dep_g_f.pc10
-rw-r--r--check/dependencies/f_dep_g.pc10
-rw-r--r--check/dependencies/g_dep.pc10
-rw-r--r--check/dependencies/h_dep_k_i_j.pc10
-rw-r--r--check/dependencies/i_dep_k_j.pc10
-rw-r--r--check/dependencies/j_dep_k.pc10
-rw-r--r--check/dependencies/k_dep.pc10
-rw-r--r--check/pkgconfig/empty-prefix.pc10
-rw-r--r--check/special-flags.pc4
-rw-r--r--check/system.pc10
-rw-r--r--config.h.win326
-rwxr-xr-xconfigure33
-rw-r--r--configure.ac2
-rw-r--r--glib/glib/gdate.c5
-rw-r--r--main.c2
-rw-r--r--parse.c5
-rw-r--r--pkg-config.159
-rw-r--r--pkg.c307
-rw-r--r--pkg.h3
-rw-r--r--pkg.m4.in14
33 files changed, 549 insertions, 211 deletions
diff --git a/NEWS b/NEWS
index 69c7753..7f64855 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,25 @@
+pkg-config 0.29.2
+=================
+
+- Improved pkg-config's recursive package list expansion performance.
+ Thanks to Matthew Hanna for the fix.
+- Handle an empty prefix setting correctly when --define-prefix is used.
+ (#97453)
+- Lazily load pc files instead of reading all available pc files during
+ initialization. Thanks to Marco Diego Aurélio Mesquita for the fix.
+ (#98215)
+- Check the CPATH environment variable when determining system include
+ paths like GCC does. Document the system search path behavior. Thanks
+ to v4hn for the fix. (#99224)
+- Make PKG_CHECK_MODULES show the module list rather than the variable
+ prefix in configure output. Thanks to Russ Albery for the fix.
+ (#98334)
+- Fix bundled glib build with GCC 6. (#98334)
+- Handle -isystem and -idirafter when PKG_CONFIG_SYSROOT_DIR is set.
+ (#97337)
+- Check the INCLUDE environment variable when determining system include
+ paths on Windows builds when --msvc-syntax is used. (#94729)
+
pkg-config 0.29.1
=================
diff --git a/check/Makefile.am b/check/Makefile.am
index d4000d8..68c6d84 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -29,6 +29,8 @@ TESTS = \
check-relocatable \
check-variable-override \
check-variables \
+ check-dependencies \
+ check-system-flags \
$(NULL)
EXTRA_DIST = \
@@ -98,8 +100,22 @@ EXTRA_DIST = \
gtk/xproto.pc \
gtk/xrender.pc \
tilde.pc \
+ pkgconfig/empty-prefix.pc \
pkgconfig/prefixdef.pc \
pkgconfig/prefixdef-expanded.pc \
pcfiledir.pc \
variables.pc \
+ dependencies/a_dep_c.pc \
+ dependencies/b_dep_c.pc \
+ dependencies/c_dep.pc \
+ dependencies/d_dep_e_f.pc \
+ dependencies/d_dep_f_e.pc \
+ dependencies/e_dep_g_f.pc \
+ dependencies/f_dep_g.pc \
+ dependencies/g_dep.pc \
+ dependencies/h_dep_k_i_j.pc \
+ dependencies/i_dep_k_j.pc \
+ dependencies/j_dep_k.pc \
+ dependencies/k_dep.pc \
+ system.pc \
$(NULL)
diff --git a/check/Makefile.in b/check/Makefile.in
index b44dacf..cdd2b4e 100644
--- a/check/Makefile.in
+++ b/check/Makefile.in
@@ -96,7 +96,7 @@ TESTS = check-cflags check-libs check-mixed-flags check-non-l-flags \
check-requires-version check-print-options check-path \
check-sysroot check-uninstalled check-debug check-gtk \
check-tilde check-relocatable check-variable-override \
- check-variables
+ check-variables check-dependencies check-system-flags
subdir = check
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/pkg.m4.in \
@@ -353,10 +353,24 @@ EXTRA_DIST = \
gtk/xproto.pc \
gtk/xrender.pc \
tilde.pc \
+ pkgconfig/empty-prefix.pc \
pkgconfig/prefixdef.pc \
pkgconfig/prefixdef-expanded.pc \
pcfiledir.pc \
variables.pc \
+ dependencies/a_dep_c.pc \
+ dependencies/b_dep_c.pc \
+ dependencies/c_dep.pc \
+ dependencies/d_dep_e_f.pc \
+ dependencies/d_dep_f_e.pc \
+ dependencies/e_dep_g_f.pc \
+ dependencies/f_dep_g.pc \
+ dependencies/g_dep.pc \
+ dependencies/h_dep_k_i_j.pc \
+ dependencies/i_dep_k_j.pc \
+ dependencies/j_dep_k.pc \
+ dependencies/k_dep.pc \
+ system.pc \
$(NULL)
all: all-am
diff --git a/check/check-dependencies b/check/check-dependencies
new file mode 100755
index 0000000..40472b5
--- /dev/null
+++ b/check/check-dependencies
@@ -0,0 +1,44 @@
+#! /bin/sh
+
+# These tests check the evaluation of the 'recursive_fill_list' function to
+# verify that for any package s that depends on t, that the library defined by
+# package s occurs before that of package t
+
+set -e
+
+. ${srcdir}/common
+
+export PKG_CONFIG_PATH
+PKG_CONFIG_PATH="${srcdir}/dependencies"
+
+# Shared dependency test.
+RESULT="-la_dep_c -lb_dep_c -lc_dep"
+run_test --libs a_dep_c b_dep_c
+run_test --libs c_dep a_dep_c b_dep_c
+run_test --libs a_dep_c c_dep b_dep_c
+run_test --libs a_dep_c b_dep_c c_dep
+
+# Redundancy test.
+#
+# Redundancy on the input line should not pass through.
+RESULT="-la_dep_c -lb_dep_c -lc_dep"
+run_test --libs a_dep_c a_dep_c b_dep_c
+run_test --libs b_dep_c a_dep_c b_dep_c
+
+# Diamond pattern test.
+#
+# One dependency of d depends on the other.
+# Both dependencies of d depend on g
+RESULT="-ld_dep_e_f -le_dep_g_f -lf_dep_g -lg_dep"
+run_test --libs d_dep_e_f
+RESULT="-ld_dep_f_e -le_dep_g_f -lf_dep_g -lg_dep"
+run_test --libs d_dep_f_e
+
+# Nested inclusion.
+#
+# Each package depends on all downsteam packages.
+RESULT="-lh_dep_k_i_j -li_dep_k_j -lj_dep_k -lk_dep"
+run_test --libs h_dep_k_i_j
+run_test --libs h_dep_k_i_j i_dep_k_j
+run_test --libs i_dep_k_j h_dep_k_i_j
+run_test --libs k_dep j_dep_k i_dep_k_j h_dep_k_i_j
diff --git a/check/check-relocatable b/check/check-relocatable
index 589eddf..40c2c88 100755
--- a/check/check-relocatable
+++ b/check/check-relocatable
@@ -44,3 +44,10 @@ for pkg in prefixdef prefixdef-expanded; do
RESULT="-I/reloc/include -L/reloc/lib -lfoo"
run_test --dont-define-prefix --cflags --libs $pkg
done
+
+# Test prefix redefinition for .pc files with an empty prefix. In this
+# case, there should be no prefix adjustment to the other variables. The
+# result should be the same regardless of prefix redefinition.
+RESULT="-I/some/path/include -L/some/path/lib -lfoo"
+run_test --define-prefix --cflags --libs empty-prefix
+run_test --dont-define-prefix --cflags --libs empty-prefix
diff --git a/check/check-special-flags b/check/check-special-flags
index 9679458..78e6341 100755
--- a/check/check-special-flags
+++ b/check/check-special-flags
@@ -4,8 +4,8 @@ set -e
. ${srcdir}/common
-RESULT="-isystem /system1 -idirafter /after1 -idirafter /after2 -isystem /system2 -I/foo -I/bar"
+RESULT="-g -ffoo -I/foo -isystem /system1 -idirafter /after1 -I/bar -idirafter /after2 -isystem /system2"
run_test --cflags special-flags
-RESULT="-framework Foo -lsimple -framework Bar -Wl,-framework -Wl,Baz"
+RESULT="-L/foo -L/bar -framework Foo -lsimple -framework Bar -Wl,-framework -Wl,Baz"
run_test --libs special-flags
diff --git a/check/check-sysroot b/check/check-sysroot
index 7b72ed9..7da415f 100755
--- a/check/check-sysroot
+++ b/check/check-sysroot
@@ -30,3 +30,9 @@ 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
diff --git a/check/check-system-flags b/check/check-system-flags
new file mode 100755
index 0000000..632496c
--- /dev/null
+++ b/check/check-system-flags
@@ -0,0 +1,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
diff --git a/check/dependencies/a_dep_c.pc b/check/dependencies/a_dep_c.pc
new file mode 100644
index 0000000..8d658b4
--- /dev/null
+++ b/check/dependencies/a_dep_c.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -la_dep_c
+Requires: c_dep
diff --git a/check/dependencies/b_dep_c.pc b/check/dependencies/b_dep_c.pc
new file mode 100644
index 0000000..c7625a4
--- /dev/null
+++ b/check/dependencies/b_dep_c.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -lb_dep_c
+Requires: c_dep
diff --git a/check/dependencies/c_dep.pc b/check/dependencies/c_dep.pc
new file mode 100644
index 0000000..67e2dfb
--- /dev/null
+++ b/check/dependencies/c_dep.pc
@@ -0,0 +1,9 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -lc_dep
diff --git a/check/dependencies/d_dep_e_f.pc b/check/dependencies/d_dep_e_f.pc
new file mode 100644
index 0000000..2e6a788
--- /dev/null
+++ b/check/dependencies/d_dep_e_f.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -ld_dep_e_f
+Requires: e_dep_g_f f_dep_g
diff --git a/check/dependencies/d_dep_f_e.pc b/check/dependencies/d_dep_f_e.pc
new file mode 100644
index 0000000..e7bb015
--- /dev/null
+++ b/check/dependencies/d_dep_f_e.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -ld_dep_f_e
+Requires: f_dep_g e_dep_g_f
diff --git a/check/dependencies/e_dep_g_f.pc b/check/dependencies/e_dep_g_f.pc
new file mode 100644
index 0000000..998f800
--- /dev/null
+++ b/check/dependencies/e_dep_g_f.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -le_dep_g_f
+Requires: f_dep_g g_dep
diff --git a/check/dependencies/f_dep_g.pc b/check/dependencies/f_dep_g.pc
new file mode 100644
index 0000000..268bb1e
--- /dev/null
+++ b/check/dependencies/f_dep_g.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -lf_dep_g
+Requires: g_dep
diff --git a/check/dependencies/g_dep.pc b/check/dependencies/g_dep.pc
new file mode 100644
index 0000000..9d17d3b
--- /dev/null
+++ b/check/dependencies/g_dep.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -lg_dep
+Requires:
diff --git a/check/dependencies/h_dep_k_i_j.pc b/check/dependencies/h_dep_k_i_j.pc
new file mode 100644
index 0000000..d29eb14
--- /dev/null
+++ b/check/dependencies/h_dep_k_i_j.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -lh_dep_k_i_j
+Requires: k_dep i_dep_k_j j_dep_k
diff --git a/check/dependencies/i_dep_k_j.pc b/check/dependencies/i_dep_k_j.pc
new file mode 100644
index 0000000..4aad8b1
--- /dev/null
+++ b/check/dependencies/i_dep_k_j.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -li_dep_k_j
+Requires: k_dep j_dep_k
diff --git a/check/dependencies/j_dep_k.pc b/check/dependencies/j_dep_k.pc
new file mode 100644
index 0000000..872e3da
--- /dev/null
+++ b/check/dependencies/j_dep_k.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -lj_dep_k
+Requires: k_dep
diff --git a/check/dependencies/k_dep.pc b/check/dependencies/k_dep.pc
new file mode 100644
index 0000000..45bc739
--- /dev/null
+++ b/check/dependencies/k_dep.pc
@@ -0,0 +1,10 @@
+prefix=/path2
+exec_prefix=${prefix}
+libdir="${exec_prefix}/lib"
+includedir="${prefix}/include"
+
+Name: Dependencies test.
+Description: Test package for testing dependency order.
+Version: 1.0.0
+Libs: -lk_dep
+Requires:
diff --git a/check/pkgconfig/empty-prefix.pc b/check/pkgconfig/empty-prefix.pc
new file mode 100644
index 0000000..9007250
--- /dev/null
+++ b/check/pkgconfig/empty-prefix.pc
@@ -0,0 +1,10 @@
+prefix=
+libdir=/some/path/lib
+includedir=/some/path/include
+
+Name: Empty prefix redefinition test
+Description: Test pkg-config empty prefix redefinition
+Version: 1.0.0
+Requires:
+Libs: -L${libdir} -lfoo
+Cflags: -I${includedir}
diff --git a/check/special-flags.pc b/check/special-flags.pc
index 56e2057..0bdaeb1 100644
--- a/check/special-flags.pc
+++ b/check/special-flags.pc
@@ -7,5 +7,5 @@ Name: Special flags test
Description: Dummy pkgconfig test package for testing pkgconfig
Version: 1.0.0
Requires:
-Libs: -framework Foo -lsimple -framework Bar -Wl,-framework -Wl,Baz
-Cflags: -I/foo -isystem /system1 -idirafter /after1 -I/bar -idirafter /after2 -isystem /system2
+Libs: -L/foo -framework Foo -lsimple -L/bar -framework Bar -Wl,-framework -Wl,Baz
+Cflags: -I/foo -g -isystem /system1 -idirafter /after1 -ffoo -I/bar -idirafter /after2 -isystem /system2
diff --git a/check/system.pc b/check/system.pc
new file mode 100644
index 0000000..2cef2ed
--- /dev/null
+++ b/check/system.pc
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: System library
+Description: Test package
+Version: 1.0.0
+Libs: -L${libdir} -lsystem
+Cflags: -I${includedir}
diff --git a/config.h.win32 b/config.h.win32
index 005cece..d4ddbb2 100644
--- a/config.h.win32
+++ b/config.h.win32
@@ -69,7 +69,7 @@
#define PACKAGE_NAME "pkg-config"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "pkg-config 0.29.1"
+#define PACKAGE_STRING "pkg-config 0.29.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "pkg-config"
@@ -78,13 +78,13 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.29.1"
+#define PACKAGE_VERSION "0.29.2"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "0.29.1"
+#define VERSION "0.29.2"
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
diff --git a/configure b/configure
index e3c6d96..3d2b15a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pkg-config 0.29.1.
+# Generated by GNU Autoconf 2.69 for pkg-config 0.29.2.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=pkg-config>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pkg-config'
PACKAGE_TARNAME='pkg-config'
-PACKAGE_VERSION='0.29.1'
-PACKAGE_STRING='pkg-config 0.29.1'
+PACKAGE_VERSION='0.29.2'
+PACKAGE_STRING='pkg-config 0.29.2'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=pkg-config'
PACKAGE_URL=''
@@ -1354,7 +1354,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pkg-config 0.29.1 to adapt to many kinds of systems.
+\`configure' configures pkg-config 0.29.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1424,7 +1424,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pkg-config 0.29.1:";;
+ short | recursive ) echo "Configuration of pkg-config 0.29.2:";;
esac
cat <<\_ACEOF
@@ -1556,7 +1556,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pkg-config configure 0.29.1
+pkg-config configure 0.29.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1925,7 +1925,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pkg-config $as_me 0.29.1, which was
+It was created by pkg-config $as_me 0.29.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2795,7 +2795,7 @@ fi
# Define the identity of the package.
PACKAGE='pkg-config'
- VERSION='0.29.1'
+ VERSION='0.29.2'
cat >>confdefs.h <<_ACEOF
@@ -13536,7 +13536,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-pkg-config config.lt 0.29.1
+pkg-config config.lt 0.29.2
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -14539,6 +14539,9 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 12 (pkg-config-@VERSION@)
+
@@ -14710,8 +14713,8 @@ $as_echo "no" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5
-$as_echo_n "checking for GLIB... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glib-2.0 >= 2.16" >&5
+$as_echo_n "checking for glib-2.0 >= 2.16... " >&6; }
if test -n "$GLIB_CFLAGS"; then
pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS"
@@ -14751,7 +14754,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -14769,7 +14772,7 @@ fi
as_fn_error $? "Either a previously installed pkg-config or \"glib-2.0 >= 2.16\" could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure to use the bundled copy." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "Either a previously installed pkg-config or \"glib-2.0 >= 2.16\" could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure to use the bundled copy." "$LINENO" 5
else
@@ -15413,7 +15416,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pkg-config $as_me 0.29.1, which was
+This file was extended by pkg-config $as_me 0.29.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15479,7 +15482,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pkg-config config.status 0.29.1
+pkg-config config.status 0.29.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 7cddf3e..5f20721 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
AC_PREREQ([2.62])
AC_INIT([pkg-config],
- [0.29.1],
+ [0.29.2],
[https://bugs.freedesktop.org/enter_bug.cgi?product=pkg-config],
[pkg-config])
diff --git a/glib/glib/gdate.c b/glib/glib/gdate.c
index 1978cf7..20e6c4a 100644
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c
@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d,
*
* Returns: number of characters written to the buffer, or 0 the buffer was too small
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
gsize
g_date_strftime (gchar *s,
gsize slen,
@@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s,
return retval;
#endif
}
+
+#pragma GCC diagnostic pop
diff --git a/main.c b/main.c
index 227ed35..9b27d9a 100644
--- a/main.c
+++ b/main.c
@@ -643,7 +643,7 @@ main (int argc, char **argv)
return 1;
}
- package_init ();
+ package_init (want_list);
if (want_list)
{
diff --git a/parse.c b/parse.c
index 4da6702..7bb666d 100644
--- a/parse.c
+++ b/parse.c
@@ -861,7 +861,9 @@ parse_cflags (Package *pkg, const char *str, const char *path)
tmp = trim_string (argv[i+1]);
option = strdup_escape_shell (tmp);
- flag->type = CFLAGS_OTHER;
+
+ /* These are -I flags since they control the search path */
+ flag->type = CFLAGS_I;
flag->arg = g_strconcat (arg, " ", option, NULL);
pkg->cflags = g_list_prepend (pkg->cflags, flag);
i++;
@@ -1046,6 +1048,7 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
}
else if (define_prefix &&
pkg->orig_prefix != NULL &&
+ *(pkg->orig_prefix) != '\0' &&
strncmp (p, pkg->orig_prefix, strlen (pkg->orig_prefix)) == 0 &&
G_IS_DIR_SEPARATOR (p[strlen (pkg->orig_prefix)]))
{
diff --git a/pkg-config.1 b/pkg-config.1
index f7daa81..a147fc8 100644
--- a/pkg-config.1
+++ b/pkg-config.1
@@ -32,7 +32,7 @@ scenario in a Makefile:
.PP
.nf
program: program.c
- cc program.c $(pkg-config --cflags --libs gnomeui)
+ cc program.c `pkg-config --cflags --libs gnomeui`
.fi
.PP
.I pkg-config
@@ -319,11 +319,47 @@ Normally if you request the package "foo" and the package
uninstalled packages. If this environment variable is set, it
disables said behavior.
.TP
+.I "PKG_CONFIG_SYSTEM_INCLUDE_PATH"
+A path variable containing system directories searched by the compiler.
+This is normally
+.IR /usr/include .
+.TP
+.I "CPATH"
+.TQ
+.I "C_INCLUDE_PATH"
+.TQ
+.I "CPLUS_INCLUDE_PATH"
+Additional paths to append to
+.IR "PKG_CONFIG_SYSTEM_INCLUDE_PATH" .
+These correspond to environment variables used by many compilers to
+affect the header search path. These are ignored on Windows builds when
+\-\-msvc-syntax is in use.
+.TP
+.I "INCLUDE"
+Additional paths to append to
+.IR "PKG_CONFIG_SYSTEM_INCLUDE_PATH"
+on Windows builds when \-\-msvc-syntax is in use. This corresponds to
+the environment variable used by MSVC to add directories to the include
+file search path.
+.TP
.I "PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"
-Don't strip -I/usr/include out of cflags.
+Don't strip system paths out of Cflags. See
+.I "PKG_CONFIG_SYSTEM_INCLUDE_PATH"
+for the definition of system paths.
+.TP
+.I "PKG_CONFIG_SYSTEM_LIBRARY_PATH"
+A path variable containing system directories searched by the linker.
+This is normally
+.I /usr/lib:/lib
+but is dependent on the
+.I pkg-config
+build and can contain other directories such as
+.IR /usr/lib64 .
.TP
.I "PKG_CONFIG_ALLOW_SYSTEM_LIBS"
-Don't strip -L/usr/lib or -L/lib out of libs.
+Don't strip system paths out of Libs. See
+.I "PKG_CONFIG_SYSTEM_LIBRARY_PATH"
+for the definition of system paths.
.TP
.I "PKG_CONFIG_SYSROOT_DIR"
Modify -I and -L to use the directories located in target sysroot.
@@ -440,7 +476,15 @@ macro will be available.
Defines the PKG_CONFIG variable to the best pkg-config available,
useful if you need pkg-config but don't want to use PKG_CHECK_MODULES.
-.\"
+
+If the first call to PKG_PROG_PKG_CONFIG is conditional, then it will
+not work correctly in all cases. Since many of the other macros such as
+PKG_CHECK_MODULES require PKG_PROG_PKG_CONFIG to know which pkg-config
+program to run, PKG_PROG_PKG_CONFIG may be run for the first time from a
+conditional from one of these macros. Therefore, if any of the
+pkg-config macros will be used under a conditional, it's best to run
+PKG_PROG_PKG_CONFIG before any of the other macros are used.
+
.TP
.I "PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])"
Enables static linking through --static prior to calling
@@ -451,9 +495,10 @@ PKG_CHECK_MODULES.
Check to see whether a particular set of modules exists. Similar
to PKG_CHECK_MODULES(), but does not set variables or print errors.
-Similar to PKG_CHECK_MODULES, make sure that the first instance of
-this or PKG_CHECK_MODULES is called, or make sure to call
-PKG_CHECK_EXISTS manually.
+Similar to PKG_CHECK_MODULES, make sure that the first instance of this
+or PKG_CHECK_MODULES is called, or make sure to call PKG_PROG_PKGCONFIG
+manually.
+
.TP
.I "PKG_INSTALLDIR(DIRECTORY)"
diff --git a/pkg.c b/pkg.c
index b439f44..f29ecc7 100644
--- a/pkg.c
+++ b/pkg.c
@@ -43,11 +43,8 @@
static void verify_package (Package *pkg);
static GHashTable *packages = NULL;
-static GHashTable *locations = NULL;
-static GHashTable *path_positions = NULL;
static GHashTable *globals = NULL;
static GList *search_dirs = NULL;
-static int scanned_dir_count = 0;
gboolean disable_uninstalled = FALSE;
gboolean ignore_requires = FALSE;
@@ -121,6 +118,8 @@ name_ends_in_uninstalled (const char *str)
return FALSE;
}
+static Package *
+internal_get_package (const char *name, gboolean warn);
/* Look for .pc files in the given directory and add them into
* locations, ignoring duplicates
@@ -129,7 +128,7 @@ static void
scan_dir (char *dirname)
{
GDir *dir;
- const gchar *d_name;
+ const gchar *filename;
int dirnamelen = strlen (dirname);
/* Use a copy of dirname cause Win32 opendir doesn't like
@@ -161,59 +160,20 @@ scan_dir (char *dirname)
dir = g_dir_open (dirname_copy, 0 , NULL);
g_free (dirname_copy);
- scanned_dir_count += 1;
-
if (!dir)
{
- debug_spew ("Cannot open directory #%i '%s' in package search path: %s\n",
- scanned_dir_count, dirname, g_strerror (errno));
+ debug_spew ("Cannot open directory '%s' in package search path: %s\n",
+ dirname, g_strerror (errno));
return;
}
- debug_spew ("Scanning directory #%i '%s'\n", scanned_dir_count, dirname);
-
- while ((d_name = g_dir_read_name(dir)))
- {
- int len = strlen (d_name);
+ debug_spew ("Scanning directory '%s'\n", dirname);
- if (ends_in_dotpc (d_name))
- {
- char *pkgname = g_malloc (len - EXT_LEN + 1);
-
- debug_spew ("File '%s' appears to be a .pc file\n", d_name);
-
- strncpy (pkgname, d_name, len - EXT_LEN);
- pkgname[len-EXT_LEN] = '\0';
-
- if (g_hash_table_lookup (locations, pkgname))
- {
- debug_spew ("File '%s' ignored, we already know about package '%s'\n", d_name, pkgname);
- g_free (pkgname);
- }
- else
- {
- char *filename = g_malloc (dirnamelen + 1 + len + 1);
- strncpy (filename, dirname, dirnamelen);
- filename[dirnamelen] = G_DIR_SEPARATOR;
- strcpy (filename + dirnamelen + 1, d_name);
-
- if (g_file_test(filename, G_FILE_TEST_IS_REGULAR) == TRUE) {
- g_hash_table_insert (locations, pkgname, filename);
- g_hash_table_insert (path_positions, pkgname,
- GINT_TO_POINTER (scanned_dir_count));
- debug_spew ("Will find package '%s' in file '%s'\n",
- pkgname, filename);
- } else {
- debug_spew ("Ignoring '%s' while looking for '%s'; not a "
- "regular file.\n", pkgname, filename);
- }
- }
- }
- else
- {
- debug_spew ("Ignoring file '%s' in search directory; not a .pc file\n",
- d_name);
- }
+ while ((filename = g_dir_read_name(dir)))
+ {
+ char *path = g_build_filename (dirname, filename, NULL);
+ internal_get_package (path, FALSE);
+ g_free (path);
}
g_dir_close (dir);
}
@@ -243,31 +203,31 @@ add_virtual_pkgconfig_package (void)
}
void
-package_init ()
+package_init (gboolean want_list)
{
- static gboolean initted = FALSE;
-
- if (!initted)
- {
- initted = TRUE;
-
- packages = g_hash_table_new (g_str_hash, g_str_equal);
- locations = g_hash_table_new (g_str_hash, g_str_equal);
- path_positions = g_hash_table_new (g_str_hash, g_str_equal);
+ if (packages)
+ return;
- add_virtual_pkgconfig_package ();
+ packages = g_hash_table_new (g_str_hash, g_str_equal);
- g_list_foreach (search_dirs, (GFunc)scan_dir, NULL);
- }
+ if (want_list)
+ g_list_foreach (search_dirs, (GFunc)scan_dir, NULL);
+ else
+ /* Should not add virtual pkgconfig package when listing to be
+ * compatible with old code that only listed packages from real
+ * files */
+ add_virtual_pkgconfig_package ();
}
static Package *
internal_get_package (const char *name, gboolean warn)
{
Package *pkg = NULL;
- char *key;
- const char *location;
+ char *key = NULL;
+ char *location = NULL;
+ unsigned int path_position = 0;
GList *iter;
+ GList *dir_iter;
pkg = g_hash_table_lookup (packages, name);
@@ -280,7 +240,8 @@ internal_get_package (const char *name, gboolean warn)
if ( ends_in_dotpc (name) )
{
debug_spew ("Considering '%s' to be a filename rather than a package name\n", name);
- location = name;
+ location = g_strdup (name);
+ key = g_strdup (name);
}
else
{
@@ -303,7 +264,18 @@ internal_get_package (const char *name, gboolean warn)
}
}
- location = g_hash_table_lookup (locations, name);
+ for (dir_iter = search_dirs; dir_iter != NULL;
+ dir_iter = g_list_next (dir_iter))
+ {
+ path_position++;
+ location = g_strdup_printf ("%s%c%s.pc", (char*)dir_iter->data,
+ G_DIR_SEPARATOR, name);
+ if (g_file_test (location, G_FILE_TEST_IS_REGULAR))
+ break;
+ g_free (location);
+ location = NULL;
+ }
+
}
if (location == NULL)
@@ -317,21 +289,13 @@ internal_get_package (const char *name, gboolean warn)
return NULL;
}
- if (location != name)
+ if (key == NULL)
key = g_strdup (name);
else
{
/* need to strip package name out of the filename */
- int len = strlen (name);
- const char *end = name + (len - EXT_LEN);
- const char *start = end;
-
- while (start != name && *start != G_DIR_SEPARATOR)
- --start;
-
- g_assert (end >= start);
-
- key = g_strndup (start, end - start);
+ key = g_path_get_basename (name);
+ key[strlen (key) - EXT_LEN] = '\0';
}
debug_spew ("Reading '%s' from file '%s'\n", name, location);
@@ -339,17 +303,18 @@ internal_get_package (const char *name, gboolean warn)
ignore_private_libs, ignore_requires_private);
g_free (key);
+ if (pkg != NULL && strstr (location, "uninstalled.pc"))
+ pkg->uninstalled = TRUE;
+
+ g_free (location);
+
if (pkg == NULL)
{
debug_spew ("Failed to parse '%s'\n", location);
return NULL;
}
- if (strstr (location, "uninstalled.pc"))
- pkg->uninstalled = TRUE;
-
- pkg->path_position =
- GPOINTER_TO_INT (g_hash_table_lookup (path_positions, pkg->key));
+ pkg->path_position = path_position;
debug_spew ("Path position of '%s' is %d\n",
pkg->key, pkg->path_position);
@@ -469,10 +434,21 @@ flag_list_to_string (GList *list)
char *tmpstr = flag->arg;
if (pcsysrootdir != NULL && flag->type & (CFLAGS_I | LIBS_L)) {
- g_string_append_c (str, '-');
- g_string_append_c (str, tmpstr[1]);
- g_string_append (str, pcsysrootdir);
- g_string_append (str, tmpstr+2);
+ /* Handle non-I Cflags like -isystem */
+ if (flag->type & CFLAGS_I && strncmp (tmpstr, "-I", 2) != 0) {
+ char *space = strchr (tmpstr, ' ');
+
+ /* Ensure this has a separate arg */
+ g_assert (space != NULL && space[1] != '\0');
+ g_string_append_len (str, tmpstr, space - tmpstr + 1);
+ g_string_append (str, pcsysrootdir);
+ g_string_append (str, space + 1);
+ } else {
+ g_string_append_c (str, '-');
+ g_string_append_c (str, tmpstr[1]);
+ g_string_append (str, pcsysrootdir);
+ g_string_append (str, tmpstr+2);
+ }
} else {
g_string_append (str, tmpstr);
}
@@ -525,35 +501,44 @@ packages_sort_by_path_position (GList *list)
return g_list_sort (list, pathposcmp);
}
+/* Construct a topological sort of all required packages.
+ *
+ * This is a depth first search starting from the right. The output 'listp' is
+ * in reverse order, with the first node reached in the depth first search at
+ * the end of the list. Previously visited nodes are skipped. The result is
+ * a list of packages such that each packages is listed once and comes before
+ * any package that it depends on.
+ */
static void
-recursive_fill_list (Package *pkg, gboolean include_private, GList **listp)
+recursive_fill_list (Package *pkg, gboolean include_private,
+ GHashTable *visited, GList **listp)
{
GList *tmp;
/*
- * If the package is one of the parents, we can skip it. This allows
- * circular requires loops to be broken.
+ * If the package has already been visited, then it is already in 'listp' and
+ * we can skip it. Additionally, this allows circular requires loops to be
+ * broken.
*/
- if (pkg->in_requires_chain)
+ if (g_hash_table_lookup_extended (visited, pkg->key, NULL, NULL))
{
debug_spew ("Package %s already in requires chain, skipping\n",
pkg->key);
return;
}
-
/* record this package in the dependency chain */
- pkg->in_requires_chain = TRUE;
+ else
+ {
+ g_hash_table_replace (visited, pkg->key, pkg->key);
+ }
/* Start from the end of the required package list to maintain order since
* the recursive list is built by prepending. */
tmp = include_private ? pkg->requires_private : pkg->requires;
for (tmp = g_list_last (tmp); tmp != NULL; tmp = g_list_previous (tmp))
- recursive_fill_list (tmp->data, include_private, listp);
+ recursive_fill_list (tmp->data, include_private, visited, listp);
*listp = g_list_prepend (*listp, pkg);
-
- /* remove this package from the dependency chain now that we've unwound */
- pkg->in_requires_chain = FALSE;
}
/* merge the flags from the individual packages */
@@ -590,43 +575,6 @@ merge_flag_lists (GList *packages, FlagType type)
return merged;
}
-/* Work backwards from the end of the package list to remove duplicate
- * packages. This could happen because the package was specified multiple
- * times on the command line, or because multiple packages require the same
- * package. When we have duplicate dependencies, starting from the end of the
- * list ensures that the dependency shows up later in the package list and
- * Libs will come out correctly. */
-static GList *
-package_list_strip_duplicates (GList *packages)
-{
- GList *cur;
- GHashTable *requires;
-
- requires = g_hash_table_new (g_str_hash, g_str_equal);
- for (cur = g_list_last (packages); cur != NULL; cur = g_list_previous (cur))
- {
- Package *pkg = cur->data;
-
- if (g_hash_table_lookup_extended (requires, pkg->key, NULL, NULL))
- {
- GList *dup = cur;
-
- /* Remove the duplicate package from the list */
- debug_spew ("Removing duplicate package %s\n", pkg->key);
- cur = cur->next;
- packages = g_list_delete_link (packages, dup);
- }
- else
- {
- /* Unique package. Track it and move to the next. */
- g_hash_table_replace (requires, pkg->key, pkg->key);
- }
- }
- g_hash_table_destroy (requires);
-
- return packages;
-}
-
static GList *
fill_list (GList *packages, FlagType type,
gboolean in_path_order, gboolean include_private)
@@ -634,18 +582,15 @@ fill_list (GList *packages, FlagType type,
GList *tmp;
GList *expanded = NULL;
GList *flags;
+ GHashTable *visited;
/* Start from the end of the requested package list to maintain order since
* the recursive list is built by prepending. */
+ visited = g_hash_table_new (g_str_hash, g_str_equal);
for (tmp = g_list_last (packages); tmp != NULL; tmp = g_list_previous (tmp))
- recursive_fill_list (tmp->data, include_private, &expanded);
-
- /* Remove duplicate packages from the recursive list. This should provide a
- * serialized package list where all interdependencies are resolved
- * consistently. */
- spew_package_list (" pre-remove", expanded);
- expanded = package_list_strip_duplicates (expanded);
- spew_package_list ("post-remove", expanded);
+ recursive_fill_list (tmp->data, include_private, visited, &expanded);
+ g_hash_table_destroy (visited);
+ spew_package_list ("post-recurse", expanded);
if (in_path_order)
{
@@ -676,6 +621,25 @@ add_env_variable_to_list (GList *list, const gchar *env)
return list;
}
+/* Well known compiler include path environment variables. These are
+ * used to find additional system include paths to remove. See
+ * https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html. */
+static const gchar *gcc_include_envvars[] = {
+ "CPATH",
+ "C_INCLUDE_PATH",
+ "CPP_INCLUDE_PATH",
+ NULL
+};
+
+#ifdef G_OS_WIN32
+/* MSVC include path environment variables. See
+ * https://msdn.microsoft.com/en-us/library/73f9s62w.aspx. */
+static const gchar *msvc_include_envvars[] = {
+ "INCLUDE",
+ NULL
+};
+#endif
+
static void
verify_package (Package *pkg)
{
@@ -686,8 +650,11 @@ verify_package (Package *pkg)
GList *requires_iter;
GList *conflicts_iter;
GList *system_dir_iter = NULL;
+ GHashTable *visited;
int count;
const gchar *search_path;
+ const gchar **include_envvars;
+ const gchar **var;
/* Be sure we have the required fields */
@@ -756,7 +723,9 @@ verify_package (Package *pkg)
/* Make sure we didn't drag in any conflicts via Requires
* (inefficient algorithm, who cares)
*/
- recursive_fill_list (pkg, TRUE, &requires);
+ visited = g_hash_table_new (g_str_hash, g_str_equal);
+ recursive_fill_list (pkg, TRUE, visited, &requires);
+ g_hash_table_destroy (visited);
conflicts = pkg->conflicts;
requires_iter = requires;
@@ -795,8 +764,8 @@ verify_package (Package *pkg)
g_list_free (requires);
- /* We make a list of system directories that gcc expects so we can remove
- * them.
+ /* We make a list of system directories that compilers expect so we
+ * can remove them.
*/
search_path = g_getenv ("PKG_CONFIG_SYSTEM_INCLUDE_PATH");
@@ -808,16 +777,16 @@ verify_package (Package *pkg)
system_directories = add_env_variable_to_list (system_directories, search_path);
- search_path = g_getenv ("C_INCLUDE_PATH");
- if (search_path != NULL)
- {
- system_directories = add_env_variable_to_list (system_directories, search_path);
- }
-
- search_path = g_getenv ("CPLUS_INCLUDE_PATH");
- if (search_path != NULL)
+#ifdef G_OS_WIN32
+ include_envvars = msvc_syntax ? msvc_include_envvars : gcc_include_envvars;
+#else
+ include_envvars = gcc_include_envvars;
+#endif
+ for (var = include_envvars; *var != NULL; var++)
{
- system_directories = add_env_variable_to_list (system_directories, search_path);
+ search_path = g_getenv (*var);
+ if (search_path != NULL)
+ system_directories = add_env_variable_to_list (system_directories, search_path);
}
count = 0;
@@ -829,8 +798,12 @@ verify_package (Package *pkg)
if (!(flag->type & CFLAGS_I))
continue;
- /* we put things in canonical -I/usr/include (vs. -I /usr/include) format,
- * but if someone changes it later we may as well be robust
+ /* Handle the system cflags. We put things in canonical
+ * -I/usr/include (vs. -I /usr/include) format, but if someone
+ * changes it later we may as well be robust.
+ *
+ * Note that the -i* flags are left out of this handling since
+ * they're intended to adjust the system cflags behavior.
*/
if (((strncmp (flag->arg, "-I", 2) == 0) && (offset = 2))||
((strncmp (flag->arg, "-I ", 3) == 0) && (offset = 3)))
@@ -1198,19 +1171,15 @@ max_len_foreach (gpointer key, gpointer value, gpointer data)
static void
packages_foreach (gpointer key, gpointer value, gpointer data)
{
- Package *pkg = get_package (key);
-
- if (pkg != NULL)
- {
- char *pad;
+ Package *pkg = value;
+ char *pad;
- pad = g_strnfill (GPOINTER_TO_INT (data) - strlen (pkg->key), ' ');
+ pad = g_strnfill (GPOINTER_TO_INT (data) - strlen (pkg->key), ' ');
- printf ("%s%s%s - %s\n",
- pkg->key, pad, pkg->name, pkg->description);
+ printf ("%s%s%s - %s\n",
+ pkg->key, pad, pkg->name, pkg->description);
- g_free (pad);
- }
+ g_free (pad);
}
void
@@ -1221,8 +1190,8 @@ print_package_list (void)
ignore_requires = TRUE;
ignore_requires_private = TRUE;
- g_hash_table_foreach (locations, max_len_foreach, &mlen);
- g_hash_table_foreach (locations, packages_foreach, GINT_TO_POINTER (mlen + 1));
+ g_hash_table_foreach (packages, max_len_foreach, &mlen);
+ g_hash_table_foreach (packages, packages_foreach, GINT_TO_POINTER (mlen + 1));
}
void
diff --git a/pkg.h b/pkg.h
index c2e458a..c6732bd 100644
--- a/pkg.h
+++ b/pkg.h
@@ -84,7 +84,6 @@ struct Package_
int path_position; /* used to order packages by position in path of their .pc file, lower number means earlier in path */
int libs_num; /* Number of times the "Libs" header has been seen */
int libs_private_num; /* Number of times the "Libs.private" header has been seen */
- gboolean in_requires_chain; /* package is in current Requires chain */
char *orig_prefix; /* original prefix value before redefinition */
};
@@ -99,7 +98,7 @@ char * packages_get_var (GList *pkgs,
void add_search_dir (const char *path);
void add_search_dirs (const char *path, const char *separator);
-void package_init (void);
+void package_init (gboolean want_list);
int compare_versions (const char * a, const char *b);
gboolean version_test (ComparisonType comparison,
const char *a,
diff --git a/pkg.m4.in b/pkg.m4.in
index ecc86b1..9102bcf 100644
--- a/pkg.m4.in
+++ b/pkg.m4.in
@@ -1,6 +1,6 @@
-dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-dnl serial 11 (pkg-config-@VERSION@)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 12 (pkg-config-@VERSION@)
+
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
@@ -142,7 +142,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -152,11 +152,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
- else
+ else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
@@ -173,7 +173,7 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full