From 389e1470a52143e18234fcade6fd9041cc5dcfc7 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 23 Apr 2008 13:58:58 +0000 Subject: [PATCH] 2008-04-23 Emmanuele Bassi * configure.ac: * clutter/Makefile.am: Do not build the internal JSON-GLib copy if there is a system installed one. * clutter/clutter-json.h: Remove. * clutter/clutter-json.h.in: Template for the clutter-json.h header file, used to opaquely include the JSON-GLib types. --- ChangeLog | 11 +++++++++++ clutter/Makefile.am | 23 +++++++++++++++-------- clutter/clutter-json.h | 8 -------- clutter/clutter-json.h.in | 13 +++++++++++++ configure.ac | 32 +++++++++++++++++++++++++------- 5 files changed, 64 insertions(+), 23 deletions(-) delete mode 100644 clutter/clutter-json.h create mode 100644 clutter/clutter-json.h.in diff --git a/ChangeLog b/ChangeLog index 6810f8f10..562909a21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-04-23 Emmanuele Bassi + + * configure.ac: + * clutter/Makefile.am: Do not build the internal JSON-GLib + copy if there is a system installed one. + + * clutter/clutter-json.h: Remove. + + * clutter/clutter-json.h.in: Template for the clutter-json.h + header file, used to opaquely include the JSON-GLib types. + 2008-04-23 Emmanuele Bassi * clutter/clutter-actor.c: Document :show-on-set-parent and diff --git a/clutter/Makefile.am b/clutter/Makefile.am index 8c657c71a..96413483f 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -1,6 +1,13 @@ NULL = -SUBDIRS = cogl pango json $(clutterbackend) $(backendextra) +SUBDIRS = cogl pango $(clutterbackend) $(backendextra) + +if LOCAL_JSON_GLIB +SUBDIRS += json +clutter_json_include = -I$(top_srcdir)/clutter/json +clutter_json_dep = json/libclutter-json.la +clutter_json_libadd = $(top_builddir)/clutter/json/libclutter-json.la +endif DIST_SUBDIRS = pango glx eglx eglnative cogl sdl json osx x11 win32 @@ -17,13 +24,13 @@ INCLUDES = \ -I$(top_srcdir)/clutter/pango \ -I$(top_srcdir)/clutter/cogl \ -I$(top_srcdir)/clutter/cogl/$(CLUTTER_COGL) \ - -I$(top_srcdir)/clutter/json \ + $(clutter_json_include) \ -DCLUTTER_PREFIX=\""$(prefix)"\" \ -DCLUTTER_LIBDIR=\""$(libdir)"\" \ -DCLUTTER_DATADIR=\""$(datadir)"\" \ + -DCLUTTER_COMPILATION=1 \ -DG_DISABLE_DEPRECATED \ -DG_LOG_DOMAIN=\"Clutter\" \ - -DCLUTTER_JSON_API=1 \ $(GCC_FLAGS) \ $(CLUTTER_CFLAGS) \ $(CLUTTER_DEBUG_CFLAGS) \ @@ -184,17 +191,17 @@ source_h_priv = \ libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_LIBADD = \ $(CLUTTER_LIBS) \ - pango/libpangoclutter.la \ - $(CLUTTER_FLAVOUR)/libclutter-$(CLUTTER_FLAVOUR).la \ - cogl/$(CLUTTER_COGL)/libclutter-cogl.la \ - json/libclutter-json.la \ + $(top_builddir)/clutter/pango/libpangoclutter.la \ + $(top_builddir)/clutter/$(CLUTTER_FLAVOUR)/libclutter-$(CLUTTER_FLAVOUR).la \ + $(top_builddir)/clutter/cogl/$(CLUTTER_COGL)/libclutter-cogl.la \ + $(clutter_json_libadd) \ $(backendextralib) libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_DEPENDENCIES = \ pango/libpangoclutter.la \ $(CLUTTER_FLAVOUR)/libclutter-$(CLUTTER_FLAVOUR).la \ cogl/$(CLUTTER_COGL)/libclutter-cogl.la \ - json/libclutter-json.la \ + $(clutter_json_dep) \ $(backendextralib) libclutter_@CLUTTER_FLAVOUR@_@CLUTTER_API_VERSION@_la_SOURCES = \ diff --git a/clutter/clutter-json.h b/clutter/clutter-json.h deleted file mode 100644 index d4113ce7a..000000000 --- a/clutter/clutter-json.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __CLUTTER_JSON_H__ -#define __CLUTTER_JSON_H__ - -#include "json/json-types.h" -#include "json/json-parser.h" -#include "json/json-generator.h" - -#endif /* __CLUTTER_JSON_H__ */ diff --git a/clutter/clutter-json.h.in b/clutter/clutter-json.h.in new file mode 100644 index 000000000..d9f03fdcd --- /dev/null +++ b/clutter/clutter-json.h.in @@ -0,0 +1,13 @@ +#ifndef __CLUTTER_JSON_H__ +#define __CLUTTER_JSON_H__ + +/* Include json-glib types opaquely, so that we can swap out + * the internal copy of JSON-GLib with the installed one + * without changing the other headers. + */ + +#include "@JSON_PREFIX@/json-types.h" +#include "@JSON_PREFIX@/json-parser.h" +#include "@JSON_PREFIX@/json-generator.h" + +#endif /* __CLUTTER_JSON_H__ */ diff --git a/configure.ac b/configure.ac index b41a6611c..56139c600 100644 --- a/configure.ac +++ b/configure.ac @@ -109,13 +109,13 @@ fi PKG_CHECK_MODULES(XFIXES, xfixes >= 4, [have_xfixes=yes], [have_xfixes=no]) if test x$have_xfixes = xyes; then - AC_DEFINE(HAVE_XFIXES, 1, Have the XFIXES X extension) + AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension]) X11_LIBS="$X11_LIBS -lXfixes" fi PKG_CHECK_MODULES(XDAMAGE, xdamage, [have_xdamage=yes], [have_xdamage=no]) if test x$have_xdamage = xyes; then - AC_DEFINE(HAVE_XDAMAGE, 1, Have the XDAMAGE X extension) + AC_DEFINE(HAVE_XDAMAGE, 1, [Have the XDAMAGE X extension]) X11_LIBS="$X11_LIBS -lXdamage" fi @@ -123,7 +123,7 @@ fi # though may not be needed at all PKG_CHECK_MODULES(XCOMPOSITE, xcomposite, [have_xcomposite=yes], [have_xcomposite=no]) if test x$have_xcomposite = xyes; then - AC_DEFINE(HAVE_XCOMPOSITE, 1, Have the XCOMPOSITE X extension) + AC_DEFINE(HAVE_XCOMPOSITE, 1, [Have the XCOMPOSITE X extension]) X11_LIBS="$X11_LIBS -lXcomposite" fi @@ -345,15 +345,32 @@ AC_SUBST([clutterbackendlib]) dnl ======================================================================== -CLUTTER_REQUIRES="pangoft2 glib-2.0 >= 2.14 gobject-2.0 gthread-2.0 gdk-pixbuf-2.0 $BACKEND_PC_FILES" +# if we have json-glib installed, use the system library instead of +# the internal copy +AC_MSG_CHECKING([for installed JSON-GLib]) +PKG_CHECK_EXISTS(json-glib-1.0, [have_json=yes], [have_json=no]) +if test "x$have_json" = "xyes"; then + JSON_PREFIX=json-glib + JSON_GLIB_PC=json-glib-1.0 + AC_DEFINE(HAVE_JSON_GLIB, 1, [Have the JSON-GLib library installed]) + AC_MSG_RESULT([found]) +else + JSON_PREFIX=json + AC_MSG_RESULT([not found, using internal copy]) +fi + +AC_SUBST(JSON_PREFIX) +AM_CONDITIONAL(LOCAL_JSON_GLIB, test "x$have_json" = "xno") + +CLUTTER_REQUIRES="pangoft2 glib-2.0 >= 2.14 gobject-2.0 gthread-2.0 gdk-pixbuf-2.0 $BACKEND_PC_FILES $JSON_GLIB_PC" PKG_CHECK_MODULES(CLUTTER_DEPS, [$CLUTTER_REQUIRES]) AC_SUBST(CLUTTER_REQUIRES) +# prefixes for fixing gtk-doc references GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`" GDKPIXBUF_PREFIX="`$PKG_CONFIG --variable=prefix pango`" - AC_SUBST(GLIB_PREFIX) AC_SUBST(PANGO_PREFIX) AC_SUBST(GDKPIXBUF_PREFIX) @@ -406,7 +423,7 @@ fi dnl = GTK Doc check ======================================================== -GTK_DOC_CHECK([1.6]) +GTK_DOC_CHECK([1.8]) dnl = Manual =============================================================== @@ -433,7 +450,7 @@ dnl ======================================================================== AC_SUBST(GCC_FLAGS) -CLUTTER_CFLAGS="$SDL_CFLAGS $EGL_CFLAGS $GLX_CFLAGS $OSX_CFLAGS $WIN32_CFLAGS $CLUTTER_DEPS_CFLAGS " +CLUTTER_CFLAGS="$SDL_CFLAGS $EGL_CFLAGS $GLX_CFLAGS $OSX_CFLAGS $WIN32_CFLAGS $CLUTTER_DEPS_CFLAGS" CLUTTER_LIBS="$SDL_LIBS $EGL_LIBS $GLX_LIBS $OSX_LIBS $WIN32_LIBS $CLUTTER_DEPS_LIBS" AC_SUBST(CLUTTER_CFLAGS) @@ -443,6 +460,7 @@ AC_CONFIG_FILES([ Makefile clutter/Makefile clutter/clutter-version.h + clutter/clutter-json.h clutter/x11/Makefile clutter/x11/clutter-x11.pc clutter/glx/Makefile