Commit 0882b8bb authored by Sébastien Wilmet's avatar Sébastien Wilmet
Browse files

build: use PKG_CHECK_MODULES

All the separate pkg-config calls were done after reading:
http://tirania.org/blog/archive/2012/Oct-20.html
("Drowning Good Ideas with Bloat. The tale of pkg.m4."
by Miguel de Icaza)

But all the GNOME modules I contribute to use PKG_CHECK_MODULES or
AX_PKG_CHECK_MODULES for a library. With those macros, it shows all the
errors at once (if several libs are missing or too old) instead of
aborting at the first error.
parent 93b5c71a
......@@ -81,52 +81,21 @@ AM_PROG_VALAC([${VALA_REQUIRED_VERSION}],
[found_vala=true]
[found_vala=false])
# Checks for dependencies
if ! pkg-config --atleast-version=${GLIB_REQUIRED_VERSION} glib-2.0; then
AC_MSG_ERROR([glib-2.0 >= ${GLIB_REQUIRED_VERSION} required.])
fi
if ! pkg-config --atleast-version=${GLIB_REQUIRED_VERSION} gio-2.0; then
AC_MSG_ERROR([gio-2.0 >= ${GLIB_REQUIRED_VERSION} required.])
fi
AX_REQUIRE_DEFINED([PKG_PROG_PKG_CONFIG])
PKG_PROG_PKG_CONFIG
if ! pkg-config --atleast-version=${GTK_REQUIRED_VERSION} gtk+-3.0; then
AC_MSG_ERROR([gtk+-3.0 >= ${GTK_REQUIRED_VERSION} required.])
fi
if ! pkg-config --atleast-version=${GTKSOURCEVIEW_REQUIRED_VERSION} gtksourceview-3.0; then
AC_MSG_ERROR([gtksourceview-3.0 >= ${GTKSOURCEVIEW_REQUIRED_VERSION} required.])
fi
if ! pkg-config --atleast-version=${GTEF_REQUIRED_VERSION} gtef-2; then
AC_MSG_ERROR([gtef-2 >= ${GTEF_REQUIRED_VERSION} required.])
fi
if ! pkg-config --atleast-version=${GSPELL_REQUIRED_VERSION} gspell-1; then
AC_MSG_ERROR([gspell-1 ${GSPELL_REQUIRED_VERSION} required.])
fi
if ! pkg-config gsettings-desktop-schemas; then
AC_MSG_ERROR([gsettings-desktop-schemas required.])
fi
if ! pkg-config --atleast-version=${GEE_REQUIRED_VERSION} gee-0.8; then
AC_MSG_ERROR([gee-0.8 >= ${GEE_REQUIRED_VERSION} required.])
fi
dependencies="
glib-2.0
gio-2.0
gtk+-3.0
gtksourceview-3.0
gtef-2
gspell-1
# Checks for dependencies
AX_REQUIRE_DEFINED([PKG_CHECK_MODULES])
PKG_CHECK_MODULES([LATEXILA], [
glib-2.0 >= ${GLIB_REQUIRED_VERSION}
gio-2.0 >= ${GLIB_REQUIRED_VERSION}
gtk+-3.0 >= ${GTK_REQUIRED_VERSION}
gtksourceview-3.0 >= ${GTKSOURCEVIEW_REQUIRED_VERSION}
gtef-2 >= ${GTEF_REQUIRED_VERSION}
gspell-1 >= ${GSPELL_REQUIRED_VERSION}
gee-0.8 >= ${GEE_REQUIRED_VERSION}
gsettings-desktop-schemas
gee-0.8"
CFLAGS="$CFLAGS `pkg-config --cflags ${dependencies}`"
LIBS="$LIBS `pkg-config --libs ${dependencies}`"
])
# Native Language Support
AX_REQUIRE_DEFINED([IT_PROG_INTLTOOL])
......
......@@ -80,7 +80,11 @@ latexila_CPPFLAGS = \
-include config.h \
-w
latexila_CFLAGS = \
$(LATEXILA_CFLAGS)
latexila_LDADD = \
$(LATEXILA_LIBS) \
gedit/libgedit.la \
liblatexila/liblatexila.la
......
noinst_LTLIBRARIES = libevince.la
libevince_la_CFLAGS = $(WARN_CFLAGS)
libevince_la_CFLAGS = \
$(LATEXILA_CFLAGS) \
$(WARN_CFLAGS)
libevince_la_LIBADD = \
$(LATEXILA_LIBS)
libevince_built_sources = \
evince-gdbus-generated.c \
......
noinst_LTLIBRARIES = libgedit.la
libgedit_la_CFLAGS = \
$(LATEXILA_CFLAGS)
libgedit_la_LIBADD = \
$(LATEXILA_LIBS)
libgedit_la_SOURCES = \
gedit-close-button.c \
gedit-close-button.h
......
......@@ -3,12 +3,16 @@
noinst_LTLIBRARIES = liblatexila.la
liblatexila_la_CFLAGS = \
$(LATEXILA_CFLAGS) \
$(WARN_CFLAGS) \
$(CODE_COVERAGE_CFLAGS) \
-I$(top_builddir)/src/evince
liblatexila_la_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
liblatexila_la_LIBADD = ../evince/libevince.la
liblatexila_la_LIBADD = \
$(LATEXILA_LIBS) \
../evince/libevince.la
liblatexila_headers = \
latexila.h \
......
......@@ -4,9 +4,11 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/src/liblatexila \
-I$(top_builddir)/src/liblatexila \
$(LATEXILA_CFLAGS) \
$(WARN_CFLAGS)
LDADD = $(top_builddir)/src/liblatexila/liblatexila.la
LDADD = $(top_builddir)/src/liblatexila/liblatexila.la \
$(LATEXILA_LIBS)
build-tools-resources.c: build-tools.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/build-tools.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/build-tools.gresource.xml
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment