[latexila] Autotools: do not use the PKG_CHECK_MODULES macro



commit 71781c509286a6fcaea4fff930023f29ea47fff0
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Sat Nov 17 19:52:36 2012 +0100

    Autotools: do not use the PKG_CHECK_MODULES macro
    
    http://tirania.org/blog/archive/2012/Oct-20.html

 configure.ac             |   50 ++++++++++++++++++++++++++++++++++-----------
 src/Makefile.am          |    5 +---
 src/gedit/Makefile.am    |    3 --
 src/gtkspell/Makefile.am |    3 --
 4 files changed, 39 insertions(+), 22 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b586379..cae2c69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,18 +93,46 @@ AC_DEFUN([AM_PROG_VALAC_CUSTOM],
 AM_PROG_VALAC_CUSTOM([${VALA_REQUIRED_VERSION}])
 
 # Checks for dependencies
-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}
+
+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
+
+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 gsettings-desktop-schemas; then
+	AC_MSG_ERROR([gsettings-desktop-schemas required.])
+fi
+
+if ! pkg-config gee-1.0; then
+	AC_MSG_ERROR([gee-1.0 required.])
+fi
+
+if ! pkg-config enchant; then
+	AC_MSG_ERROR([enchant required.])
+fi
+
+dependencies="
+	glib-2.0
+	gio-2.0
+	gtk+-3.0
+	gtksourceview-3.0
 	gsettings-desktop-schemas
 	gee-1.0
-	enchant
-])
+	enchant"
 
-AC_SUBST([LATEXILA_CFLAGS])
-AC_SUBST([LATEXILA_LIBS])
+CFLAGS="$CFLAGS `pkg-config --cflags ${dependencies}`"
+LIBS="$LIBS `pkg-config --libs ${dependencies}`"
 
 # Native Language Support
 IT_PROG_INTLTOOL([0.40.0])
@@ -122,10 +150,8 @@ AC_DEFINE_UNQUOTED([LOCALE_DIR],
                    ["${LOCALE_DIR}"],
 		   [locale directory])
 
-# Help documentation
+# Misc
 YELP_HELP_INIT
-
-# GSettings
 GLIB_GSETTINGS
 
 # Generate files
diff --git a/src/Makefile.am b/src/Makefile.am
index cc55635..36ff059 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -73,10 +73,7 @@ latexila_SOURCES = 			\
 latexila_CPPFLAGS =		\
 	-I$(top_srcdir)		\
 	-I$(srcdir)/gedit	\
-	-I$(srcdir)/gtkspell	\
-	$(LATEXILA_CFLAGS)
-
-latexila_LDFLAGS = $(LATEXILA_LIBS)
+	-I$(srcdir)/gtkspell
 
 latexila_LDADD = 		\
 	gedit/libgedit.la	\
diff --git a/src/gedit/Makefile.am b/src/gedit/Makefile.am
index 8c0cf74..7c684ec 100644
--- a/src/gedit/Makefile.am
+++ b/src/gedit/Makefile.am
@@ -1,8 +1,5 @@
 noinst_LTLIBRARIES = libgedit.la
 
-libgedit_la_CPPFLAGS = $(LATEXILA_CFLAGS)
-libgedit_la_LDFLAGS = $(LATEXILA_LIBS)
-
 libgedit_la_SOURCES = 		\
 	gedit-close-button.c	\
 	gedit-close-button.h
diff --git a/src/gtkspell/Makefile.am b/src/gtkspell/Makefile.am
index bd5e4da..b6a9765 100644
--- a/src/gtkspell/Makefile.am
+++ b/src/gtkspell/Makefile.am
@@ -1,8 +1,5 @@
 noinst_LTLIBRARIES = libgtkspell.la
 
-libgtkspell_la_CPPFLAGS = $(LATEXILA_CFLAGS)
-libgtkspell_la_LDFLAGS = $(LATEXILA_LIBS)
-
 libgtkspell_la_SOURCES = gtkspell.c gtkspell.h
 
 -include $(top_srcdir)/git.mk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]