summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2011-01-19 14:33:27 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2011-01-19 14:33:27 +0000
commit94b905b9e110c671698a0cd59fa827f6ddb0a84d (patch)
treef063cccf118e417e3613ae96a784c637e7cefb23
parent90a01b479c432310f9fcfb5fcd04e23d8fc1a92a (diff)
downloadclutter-94b905b9e110c671698a0cd59fa827f6ddb0a84d.tar.gz
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.
-rw-r--r--.gitignore1
-rw-r--r--clutter/Makefile.am5
-rw-r--r--clutter/clutter-config.h.in16
-rw-r--r--clutter/clutter.h2
-rw-r--r--configure.ac30
5 files changed, 54 insertions, 0 deletions
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 <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__ */
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