[babl] Add BABL_IS_BEING_COMPILED #define support



commit 58ec54a40486cd4ab140406903a3f3832adf26e0
Author: Martin Nordholts <martinn src gnome org>
Date:   Mon Dec 27 21:34:00 2010 +0100

    Add BABL_IS_BEING_COMPILED #define support
    
    Sometimes it is ok that babl includes are included directly and not
    through babl.h, like when we generate GObject introspection files.
    
    The important thing is just that users of the babl API don't begin to
    include headers we don't guarantee to always exist, and
    BABL_IS_BEING_COMPILED doesn't obstruct this goal.

 babl/Makefile.am       |    1 +
 babl/babl-macros.h     |    2 +-
 babl/babl-types.h      |    2 +-
 babl/babl-version.h.in |    2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/babl/Makefile.am b/babl/Makefile.am
index 979afb5..1823265 100644
--- a/babl/Makefile.am
+++ b/babl/Makefile.am
@@ -96,6 +96,7 @@ Babl-$(BABL_API_VERSION).gir: $(G_IR_SCANNER) $(library_include_HEADERS) $(c_sou
             --libtool="$(LIBTOOL)" \
             --output $@ \
             --pkg babl \
+            -DBABL_IS_BEING_COMPILED \
 	    -I$(top_srcdir) \
 	    -I$(top_builddir) \
 	    $(library_include_HEADERS) \
diff --git a/babl/babl-macros.h b/babl/babl-macros.h
index 8de6864..f022d9f 100644
--- a/babl/babl-macros.h
+++ b/babl/babl-macros.h
@@ -19,7 +19,7 @@
 #ifndef _BABL_MACROS_H
 #define _BABL_MACROS_H
 
-#ifndef BABL_INSIDE_BABL_H
+#if !defined(BABL_INSIDE_BABL_H) && !defined(BABL_IS_BEING_COMPILED)
 #error "babl-version.h must not be included directly, include babl.h instead."
 #endif
 
diff --git a/babl/babl-types.h b/babl/babl-types.h
index d1deae7..162e6c9 100644
--- a/babl/babl-types.h
+++ b/babl/babl-types.h
@@ -19,7 +19,7 @@
 #ifndef _BABL_TYPES_H
 #define _BABL_TYPES_H
 
-#ifndef BABL_INSIDE_BABL_H
+#if !defined(BABL_INSIDE_BABL_H) && !defined(BABL_IS_BEING_COMPILED)
 #error "babl-version.h must not be included directly, include babl.h instead."
 #endif
 
diff --git a/babl/babl-version.h.in b/babl/babl-version.h.in
index 9789099..ab00824 100644
--- a/babl/babl-version.h.in
+++ b/babl/babl-version.h.in
@@ -19,7 +19,7 @@
 #ifndef _BABL_VERSION_H
 #define _BABL_VERSION_H
 
-#ifndef BABL_INSIDE_BABL_H
+#if !defined(BABL_INSIDE_BABL_H) && !defined(BABL_IS_BEING_COMPILED)
 #error "babl-version.h must not be included directly, include babl.h instead."
 #endif
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]