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.
This commit is contained in:
Emmanuele Bassi 2011-01-19 14:33:27 +00:00
parent 90a01b479c
commit 94b905b9e1
5 changed files with 54 additions and 0 deletions

1
.gitignore vendored
View 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

View 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)

View File

@ -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__ */

View 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"

View 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