Use the standard pkg-config macros to check for glib

By using our PKG_CHECK_MODULES from our in-tree pkg.m4, the check for
glib will be done the same way pkg-config is used everywhere else. This
includes the usage of AC_PATH_TOOL in PKG_PROG_PKG_CONFIG, which will
check for $host-pkg-config when --host is set during configure.

Freedesktop #59435 (https://bugs.freedesktop.org/show_bug.cgi?id=59435)
This commit is contained in:
Dan Nicholson 2013-01-17 05:30:58 -08:00
parent ae2fef2c05
commit 7867cbd79c

View file

@ -153,7 +153,10 @@ dnl
dnl Find glib or use internal copy. Required version is 2.16 for
dnl g_win32_get_package_installation_directory_of_module().
dnl
m4_define([glib_module], ["glib-2.0 >= 2.16"])
dnl Pull in pkg-config macros to find external glib.
dnl
m4_include([pkg.m4])
m4_define([glib_module], [glib-2.0 >= 2.16])
AC_ARG_WITH([internal-glib],
[AS_HELP_STRING([--with-internal-glib], [use internal glib])],
[with_internal_glib="$withval"],
@ -168,18 +171,11 @@ if test "x$with_internal_glib" = xyes; then
AC_CONFIG_SUBDIRS([glib])
else
AC_MSG_RESULT([no])
if test "x$GLIB_CFLAGS" = "x" && test "x$GLIB_LIBS" = "x"; then
AC_CHECK_PROGS([PKG_CONFIG], [pkg-config], [])
if test -n $PKG_CONFIG && $PKG_CONFIG --exists glib_module; then
GLIB_CFLAGS=`$PKG_CONFIG --cflags glib_module`
GLIB_LIBS=`$PKG_CONFIG --libs glib_module`
else
AC_MSG_ERROR(m4_normalize([pkg-config and ]glib_module[ not found,
please set GLIB_CFLAGS and GLIB_LIBS to
the correct values or pass
--with-internal-glib to configure]))
fi
fi
PKG_CHECK_MODULES([GLIB], glib_module, [], [AC_MSG_ERROR([]dnl
[m4_normalize([Either a previously installed pkg-config or "]glib_module["
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.])])])
fi
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CFLAGS)