[aisleriot] build: Collect pkg-config requirements and only check once



commit 319807d60b48d6379af87b0cc1a3b3d017d19c75
Author: Christian Persch <chpe gnome org>
Date:   Wed Jan 25 19:08:22 2012 +0100

    build: Collect pkg-config requirements and only check once
    
    Collect all the dependency pkgs and only do one pkg-config check at the end.

 configure.ac        |   83 +++++++++++++++++---------------------------------
 src/Makefile.am     |   26 ++--------------
 src/lib/Makefile.am |   32 ++-----------------
 3 files changed, 35 insertions(+), 106 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 276a45f..c26f2b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,7 @@ AM_MAINTAINER_MODE([enable])
 # *****************************************************************************
 
 PKG_PROG_PKG_CONFIG([0.15])
+PKGS=
 
 AC_PROG_CC
 AC_PROG_CPP
@@ -108,20 +109,6 @@ esac
 AC_MSG_RESULT([$os_win32])
 AM_CONDITIONAL([PLATFORM_WIN32_NATIVE],[test "$os_win32" = "yes"])
 
-# ********
-# Features
-# ********
-
-# *****
-# Sound
-# *****
-
-AC_MSG_CHECKING([whether to enable sound support])
-AC_ARG_ENABLE([sound],
-  [AS_HELP_STRING([--enable-sound],[Enable sound using libcanberra])],
-  [],[enable_sound=yes])
-AC_MSG_RESULT([$enable_sound])
-
 # *******
 # Clutter
 # *******
@@ -295,22 +282,25 @@ GIO_REQUIRED=2.31.13
 
 # Check for common modules
 
-need_gthread=no
-PKG_CHECK_MODULES([GTHREAD],[gthread-2.0])
-AC_SUBST([GTHREAD_CFLAGS])
-AC_SUBST([GTHREAD_LIBS])
+PKGS="$PKGS gtk+-$GTK_API_VERSION >= $GTK_REQUIRED"
+
+# *****
+# Sound
+# *****
+
+AC_MSG_CHECKING([whether to enable sound support])
+AC_ARG_ENABLE([sound],
+  [AS_HELP_STRING([--enable-sound],[Enable sound using libcanberra])],
+  [],[enable_sound=yes])
+AC_MSG_RESULT([$enable_sound])
 
-PKG_CHECK_MODULES([GMODULE],[gmodule-2.0])
-AC_SUBST([GMODULE_CFLAGS])
-AC_SUBST([GMODULE_LIBS])
+if test "$enable_sound" = "yes"; then
+  PKGS="$PKGS $LIBCANBERRA_GTK_PKGS"
 
-PKG_CHECK_MODULES([GOBJECT],[gobject-2.0])
-AC_SUBST([GOBJECT_CFLAGS])
-AC_SUBST([GOBJECT_LIBS])
+  AC_DEFINE([ENABLE_SOUND],[1],[Define if sound support is enabled])
+fi
 
-PKG_CHECK_MODULES([GTK],[gtk+-$GTK_API_VERSION >= $GTK_REQUIRED])
-AC_SUBST([GTK_CFLAGS])
-AC_SUBST([GTK_LIBS])
+AM_CONDITIONAL([ENABLE_SOUND],[test "$enable_sound" = "yes"])
 
 # *********
 # GSettings
@@ -324,11 +314,7 @@ AM_GCONF_SOURCE_2
 AC_PATH_PROG([GCONFTOOL],[gconftool-2])
 
 if test "$with_platform" = "gnome"; then
-  PKG_CHECK_MODULES([GNOME],[gconf-2.0 >= $GCONF_REQUIRED])
-  AC_SUBST([GNOME_CFLAGS])
-  AC_SUBST([GNOME_LIBS])
-
-  need_gthread=yes
+  PKGS="$PKGS gconf-2.0 >= $GCONF_REQUIRED"
 fi
 
 # Check for librsvg
@@ -339,13 +325,7 @@ if test "$need_rsvg" = "yes"; then
 
   CAIRO_REQUIRED=1.10.0
 
-  # Errors out if rsvg is not found
-  PKG_CHECK_MODULES([RSVG],[
-    librsvg-2.0 >= $RSVG_REQUIRED
-    cairo >= $CAIRO_REQUIRED])
-
-  AC_SUBST([RSVG_CFLAGS])
-  AC_SUBST([RSVG_LIBS])
+  PKGS="$PKGS librsvg-2.0 >= $RSVG_REQUIRED cairo >= $CAIRO_REQUIRED"
 
   AC_DEFINE([HAVE_RSVG],[1],[Refine if librsvg is available])
 fi
@@ -374,21 +354,6 @@ fi
 
 AM_CONDITIONAL([HAVE_CLUTTER],[test "$with_clutter" = "yes"])
 
-# GThread
-
-AM_CONDITIONAL([WITH_GTHREAD],[test "$need_gthread" = "yes"])
-
-# libcanberra
-
-if test "$enable_sound" = "yes"; then
-  PKG_CHECK_MODULES([CANBERRA_GTK],[$LIBCANBERRA_GTK_PKGS],[],
-    [AC_MSG_ERROR([Sound support was requested, but libcanberra-gtk not found.])])
-
-  AC_DEFINE([ENABLE_SOUND],[1],[Define if sound support is enabled])
-fi
-
-AM_CONDITIONAL([ENABLE_SOUND],[test "$enable_sound" = "yes"])
-
 # *****************
 # Extra build tools
 # *****************
@@ -533,7 +498,7 @@ fi
 
 AC_MSG_RESULT([$with_guile_result])
 
-PKG_CHECK_MODULES([GUILE],[$GUILE_PKGS])
+PKGS="$PKGS $GUILE_PKGS"
 
 AC_SUBST([GUILE_EFFECTIVE_VERSION],[$with_guile])
 
@@ -543,6 +508,14 @@ if test "$GUILE" = "false"; then
   AC_MSG_ERROR([guile not found])
 fi
 
+# ************
+# Dependencies
+# ************
+
+PKG_CHECK_MODULES([AISLERIOT],[$PKGS])
+AC_SUBST([AISLERIOT_CFLAGS])
+AC_SUBST([AISLERIOT_LIBS])
+
 # *************
 # Documentation
 # *************
diff --git a/src/Makefile.am b/src/Makefile.am
index d00b34f..aac4614 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,8 +53,7 @@ sol_CPPFLAGS = \
 	$(AM_CPPFLAGS)
 
 sol_CFLAGS = \
-	$(GTK_CFLAGS)	      \
-	$(GUILE_CFLAGS)	      \
+	$(AISLERIOT_CFLAGS) \
 	$(AM_CFLAGS)
 
 sol_LDFLAGS = \
@@ -62,25 +61,9 @@ sol_LDFLAGS = \
 
 sol_LDADD = \
 	lib/libaisleriot.la \
-	$(GTK_LIBS) \
-	$(GUILE_LIBS) \
+	$(AISLERIOT_LIBS) \
 	-lm
 
-if HAVE_GNOME
-sol_CFLAGS += $(GNOME_CFLAGS)
-sol_LDADD += $(GNOME_LIBS)
-endif
-
-if HAVE_RSVG
-sol_CFLAGS += $(RSVG_CFLAGS)
-sol_LDADD += $(RSVG_LIBS)
-endif
-
-if WITH_GTHREAD
-sol_CFLAGS += $(GHTREAD_CFLAGS)
-sol_LDADD += $(GTHREAD_LIBS)
-endif
-
 if PLATFORM_WIN32_NATIVE
 sol_LDFLAGS += -mwindows
 endif
@@ -147,7 +130,7 @@ BUILT_SOURCES = \
 	ar-resources.h \
 	$(NULL)
 
-ar-resources.h ar-resources.c: aisleriot.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies $(srcdir)/aisleriot.gresource.xml)
+ar-resources.h ar-resources.c: aisleriot.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies aisleriot.gresource.xml)
 	$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir . --generate --c-name aisleriot $<
 
 schema_in_files = aisleriot.schemas.in
@@ -177,9 +160,6 @@ EXTRA_DIST = \
 	$(cardimage_DATA)	\
 	$(icon_DATA)		\
 	$(allicons)		\
-	$(ossobackup_in_files)	\
-	$(ossoscript_in_files)	\
-	$(ossoservice_in_files)	\
 	$(schema_in_files)	\
 	game-names.h
 
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 79411b8..2bde114 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -84,34 +84,17 @@ libaisleriot_la_CPPFLAGS = \
 	$(AM_CPPFLAGS)
 
 libaisleriot_la_CFLAGS = \
-	$(GTK_CFLAGS) \
-	$(GIO_CFLAGS) \
+	$(AISLERIOT_CFLAGS) \
 	$(AM_CFLAGS)
 
 libaisleriot_la_LIBADD = \
-	$(GTK_LIBS) \
-	$(GIO_LIBS)
-
-if HAVE_RSVG
-libaisleriot_la_CFLAGS += $(RSVG_CFLAGS)
-libaisleriot_la_LIBADD += $(RSVG_LIBS)
-endif # HAVE_RSVG
+	$(AISLERIOT_LIBS)
 
 if HAVE_CLUTTER
 libaisleriot_la_CFLAGS += $(CLUTTER_CFLAGS)
 libaisleriot_la_LIBADD += $(CLUTTER_LIBS)
 endif # HAVE_CLUTTER
 
-if HAVE_GNOME
-libaisleriot_la_CFLAGS += $(GNOME_CFLAGS)
-libaisleriot_la_LIBADD += $(GNOME_LIBS)
-endif
-
-if ENABLE_SOUND
-libaisleriot_la_CFLAGS += $(CANBERRA_GTK_CFLAGS)
-libaisleriot_la_LIBADD += $(CANBERRA_GTK_LIBS)
-endif
-
 gsettingsschema_in_files = org.gnome.Patience.WindowState.gschema.xml.in
 gsettings_SCHEMAS = $(gsettingsschema_in_files:.gschema.xml.in=.gschema.xml)
 
@@ -142,8 +125,7 @@ ar_cards_renderer_CPPFLAGS = \
 	$(AM_CPPFLAGS)
 
 ar_cards_renderer_CFLAGS = \
-	$(GTK_CFLAGS) \
-	$(RSVG_CFLAGS) \
+	$(AISLERIOT_CFLAGS) \
 	$(AM_CFLAGS)
 
 ar_cards_renderer_LDFLAGS = \
@@ -151,13 +133,7 @@ ar_cards_renderer_LDFLAGS = \
 
 ar_cards_renderer_LDADD = \
 	libaisleriot.la \
-	$(GTK_LIBS) \
-	$(RSVG_LIBS)
-
-if WITH_GTHREAD
-ar_cards_renderer_CFLAGS += $(GHTREAD_CFLAGS)
-ar_cards_renderer_LDADD += $(GTHREAD_LIBS)
-endif # WITH_GTHREAD
+	$(AISLERIOT_LIBS)
 
 endif # HAVE_RSVG
 



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