build: Generate an instealled config header
authorEmmanuele Bassi <ebassi@linux.intel.com>
Wed, 19 Jan 2011 14:33:27 +0000 (14:33 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Wed, 19 Jan 2011 14:33:27 +0000 (14:33 +0000)
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
clutter/Makefile.am
clutter/clutter-config.h.in [new file with mode: 0644]
clutter/clutter.h
configure.ac

index 68ff6d4..04a2e6c 100644 (file)
@@ -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
index 42c964e..e75ef70 100644 (file)
@@ -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 (file)
index 0000000..0aeadd2
--- /dev/null
@@ -0,0 +1,16 @@
+#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only <clutter/clutter.h> can be included directly."
+#endif
+
+#ifndef __CLUTTER_CONFIG_H__
+#define __CLUTTER_CONFIG_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+@CLUTTER_CONFIG_DEFINES@
+
+G_END_DECLS
+
+#endif /* __CLUTTER_CONFIG_H__ */
index 8448a44..3729cf8 100644 (file)
@@ -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"
index 8abcfac..0f1db8d 100644 (file)
@@ -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