From 94b905b9e110c671698a0cd59fa827f6ddb0a84d Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 19 Jan 2011 14:33:27 +0000 Subject: [PATCH] build: Generate an instealled config header Clutter has some platform-specific API that is accessible only if the right backend has been compiled in. Third party applications that wish to be portable across backends might want to use defines and other pre-processor tricks to determine header inclusion and API usage. While Clutter has an internal set of symbols it can use, third party applications don't have the luxury of being able to access the config.h generated by Clutter's configure script. For this reason, Clutter should install a configuration header with a series of namespaced defines that can be picked up by applications and other third party code. --- .gitignore | 1 + clutter/Makefile.am | 5 +++++ clutter/clutter-config.h.in | 16 ++++++++++++++++ clutter/clutter.h | 2 ++ configure.ac | 30 ++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 clutter/clutter-config.h.in diff --git a/.gitignore b/.gitignore index 68ff6d44d..04a2e6cf0 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ compile stamp-enum-types stamp-marshal /ChangeLog* +/clutter/clutter-config.h /clutter/clutter-enum-types.[ch] /clutter/clutter-marshal.[ch] /clutter/clutter-version.h diff --git a/clutter/Makefile.am b/clutter/Makefile.am index 42c964e78..e75ef7004 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -264,6 +264,10 @@ built_source_h = \ clutter-marshal.h \ $(NULL) +# config header +DISTCLEANFILES += clutter-config.h +EXTRA_DIST += clutter-config.h.in + # version header DISTCLEANFILES += clutter-version.h EXTRA_DIST += clutter-version.h.in @@ -612,6 +616,7 @@ DISTCLEANFILES += $(pc_files) clutter_include_HEADERS = $(source_h) $(top_srcdir)/clutter/clutter.h nodist_clutter_include_HEADERS = \ + $(top_builddir)/clutter/clutter-config.h \ $(top_builddir)/clutter/clutter-version.h \ $(built_source_h) diff --git a/clutter/clutter-config.h.in b/clutter/clutter-config.h.in new file mode 100644 index 000000000..0aeadd25c --- /dev/null +++ b/clutter/clutter-config.h.in @@ -0,0 +1,16 @@ +#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __CLUTTER_CONFIG_H__ +#define __CLUTTER_CONFIG_H__ + +#include + +G_BEGIN_DECLS + +@CLUTTER_CONFIG_DEFINES@ + +G_END_DECLS + +#endif /* __CLUTTER_CONFIG_H__ */ diff --git a/clutter/clutter.h b/clutter/clutter.h index 8448a4490..3729cf8eb 100644 --- a/clutter/clutter.h +++ b/clutter/clutter.h @@ -30,6 +30,8 @@ #include "clutter-deprecated.h" +#include "clutter-config.h" + #include "clutter-action.h" #include "clutter-actor.h" #include "clutter-actor-meta.h" diff --git a/configure.ac b/configure.ac index 8abcfac7b..0f1db8d45 100644 --- a/configure.ac +++ b/configure.ac @@ -673,6 +673,35 @@ dnl using the define also. AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1], [Can use Cogl 2.0 API internally]) +dnl === Clutter configuration ================================================= + +CLUTTER_CONFIG_DEFINES= + +# windowing systems +AS_IF([test "x$SUPPORT_XLIB" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_X11 1"]) +AS_IF([test "x$SUPPORT_GLX" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_GLX 1"]) +AS_IF([test "x$SUPPORT_EGL" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_EGL 1"]) +AS_IF([test "x$SUPPORT_WAYLAND" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_WAYLAND 1"]) +AS_IF([test "x$SUPPORT_OSX" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_OSX 1"]) +AS_IF([test "x$SUPPORT_WIN32" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_WIN32 1"]) +AS_IF([test "x$SUPPORT_CEX100" = "x1"], + [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES +#define CLUTTER_WINDOWING_CEX100 1"]) + +AC_SUBST([CLUTTER_CONFIG_DEFINES]) + dnl === Clutter substitutions ================================================= # Eventually the idea of a winsys should be hidden from Clutter and moved # into Cogl, but for now we have CLUTTER_WINSYS... @@ -1121,6 +1150,7 @@ AC_CONFIG_FILES([ build/mingw/Makefile clutter/Makefile + clutter/clutter-config.h clutter/clutter-version.h clutter/clutter-$CLUTTER_API_VERSION.pc:clutter/clutter.pc.in