mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2026-05-03 00:47:59 +02:00
Use a bundled glib2 to avoid circular dependency
It's nice to say that glib is a base library and you should have it installed to build pkg-config, but it makes bootstrapping pkg-config really annoying since it introduces a circular dependency. Let's be nice to our users and bundle a copy to avoid this situation. The default is still to use the system's glib, but the internal copy can be used by passing --with-internal-glib to configure. The latest stable copy of glib is included and will be updated periodically with their stable releases. The top level autogen.sh is running recursively through glib. If this becomes an issue, we can switch autoreconf to --no-recursive and then descend to glib and run its autogen.sh script. Since this is default off, its integration will probably not be tested often. Therefore, it's forcefully turned on during distcheck to make sure to test it out before distributing a tarball.
This commit is contained in:
parent
75755ba614
commit
c74da521af
2 changed files with 26 additions and 7 deletions
|
|
@ -1,5 +1,9 @@
|
|||
pkg_config_LDADD=@GLIB_LIBS@
|
||||
|
||||
if INTERNAL_GLIB
|
||||
GLIB_SUBDIR = glib
|
||||
endif
|
||||
|
||||
if USE_INSTALLED_POPT
|
||||
pkg_config_LDADD += $(POPT_LIBS)
|
||||
else
|
||||
|
|
@ -43,4 +47,4 @@ pkg_config_SOURCES= \
|
|||
parse.h \
|
||||
parse.c \
|
||||
main.c
|
||||
DISTCHECK_CONFIGURE_FLAGS = --with-installed-popt
|
||||
DISTCHECK_CONFIGURE_FLAGS = --with-installed-popt --with-internal-glib
|
||||
|
|
|
|||
27
configure.ac
27
configure.ac
|
|
@ -117,14 +117,29 @@ esac
|
|||
AC_MSG_RESULT([$native_win32])
|
||||
AM_CONDITIONAL(NATIVE_WIN32, [test "x$native_win32" = xyes])
|
||||
|
||||
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-2.0; then
|
||||
AC_ARG_WITH([internal-glib],
|
||||
[AS_HELP_STRING([--with-internal-glib], [use internal glib])],
|
||||
[with_internal_glib="$withval"],
|
||||
[with_internal_glib=no])
|
||||
AM_CONDITIONAL([INTERNAL_GLIB], [test "x$with_internal_glib" = xyes])
|
||||
if test "x$with_internal_glib" = xyes; then
|
||||
GLIB_CFLAGS='-I$(top_srcdir)/glib -I$(top_srcdir)/glib/glib \
|
||||
-I$(top_builddir)/glib/glib'
|
||||
GLIB_LIBS='$(top_builddir)/glib/glib/libglib-2.0.la'
|
||||
AC_CONFIG_SUBDIRS([glib])
|
||||
else
|
||||
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-2.0; then
|
||||
GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
|
||||
GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
|
||||
else
|
||||
AC_MSG_ERROR([pkg-config and glib-2.0 not found, please set GLIB_CFLAGS and GLIB_LIBS to the correct values])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR(m4_normalize([pkg-config and glib-2.0 not found, please set
|
||||
GLIB_CFLAGS and GLIB_LIBS to the correct
|
||||
values or pass --with-internal-glib to
|
||||
configure]))
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue