This is file patch-08-installed-glib for pkg-config-0.21 to be applied on top of patch-04-autoreconf-bug Introduce --with-installed-glib, allowing to use installed Glib-2.x on non-Win32 systems. diff -ur -x autom4te.cache -x aclocal.m4 -x configure -x Makefile.in -x config.h.in -x 'config.h.in~' pkg-config-0.21.orig/Makefile.am pkg-config-0.21/Makefile.am --- pkg-config-0.21.orig/Makefile.am 2006-08-16 19:05:30.000000000 +0200 +++ pkg-config-0.21/Makefile.am 2007-01-19 15:23:43.000000000 +0100 @@ -2,10 +2,11 @@ included_glib_includes = @GLIB_CFLAGS@ pkg_config_LDADD=@GLIB_LIBS@ else -SUBDIRS = glib-1.2.8 check +GLIB_SUBDIR = glib-1.2.8 included_glib_includes = -I./glib-1.2.8 pkg_config_LDADD=glib-1.2.8/libglib.la endif +SUBDIRS = $(GLIB_SUBDIR) check m4dir = $(datadir)/aclocal m4_DATA = pkg.m4 diff -ur -x autom4te.cache -x aclocal.m4 -x configure -x Makefile.in -x config.h.in -x 'config.h.in~' pkg-config-0.21.orig/configure.in pkg-config-0.21/configure.in --- pkg-config-0.21.orig/configure.in 2007-01-19 15:00:41.000000000 +0100 +++ pkg-config-0.21/configure.in 2007-01-19 15:10:59.000000000 +0100 @@ -76,7 +76,6 @@ case "$host" in *-*-mingw*) native_win32=yes - AC_DEFINE(USE_INSTALLED_GLIB, 1, [We are using an installed GLib]) ;; *) native_win32=no @@ -84,8 +83,6 @@ esac AC_MSG_RESULT([$native_win32]) -AM_CONDITIONAL(USE_INSTALLED_GLIB, test x$native_win32 = xyes) - case "$libdir" in *lib64) AC_DEFINE(PREFER_LIB64,1,[Define if your native architecture defines libdir to be $prefix/lib64 instead of $prefix/lib.]) ;; *) : ;; @@ -102,11 +99,34 @@ GLIB_CFLAGS="-I$includedir/glib-2.0 -I$libdir/glib-2.0/include" GLIB_LIBS="-L$libdir -lglib-2.0 -liconv -lintl" + use_installed_glib=yes +else + use_installed_glib=no + AC_ARG_WITH([installed-glib], + [ --with-installed-glib Use installed Glib-2.x], [ + if test x$withval = xyes; then + # Not on Win32, but the user requested to use the installed Glib-2.x, + # therefore we may assume that (some older version of) pkg-config can + # be found in the users PATH (otherwise we simply ignore the request). + AC_CHECK_PROGS([PKG_CONFIG], [pkg-config], []) + if test -n $PKG_CONFIG && $PKG_CONFIG --exists glib-2.0; then + GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0` + GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0` + use_installed_glib=yes + fi + fi + ]) +fi # !native_win32 + +if test x$use_installed_glib = xyes; then + AC_DEFINE(USE_INSTALLED_GLIB, 1, [We are using an installed GLib]) AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_CFLAGS) else AC_CONFIG_SUBDIRS(glib-1.2.8) -fi # !native_win32 +fi # !use_installed_glib + +AM_CONDITIONAL(USE_INSTALLED_GLIB, test x$use_installed_glib = xyes) AC_FUNC_ALLOCA