[gmime] autogenerate gmime-version.h based on configure



commit 1290983e5b9a4570bb3c8504615d51780b003d6c
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Tue Apr 28 10:00:10 2009 -0400

    autogenerate gmime-version.h based on configure
    
    2009-04-28  Jeffrey Stedfast  <fejj novell com>
    
    	* build/vs2008/config-win32.h.in: No longer has GMIME_*_VERSION
    	defines - these are all in gmime-version.h now.
    
    	* gmime/gmime-version.h.in: New template for generating
    	gmime-version.h
    
    	* gmime/gmime.h: #include gmime-version.h
    
    	* configure.ac: Renamed from configure.in. Now generates a
    	gmime/gmime-version.h header which contains a macro for checking
    	the GMime version at compile-time. Requested feature from the
    	Balsa guys.
---
 ChangeLog                      |   13 +++++++++++
 autogen.sh                     |    2 +-
 build/vs2008/config-win32.h.in |   15 ------------
 configure.in => configure.ac   |   22 +++++-------------
 gmime/Makefile.am              |    3 ++
 gmime/gmime-version.h.in       |   47 ++++++++++++++++++++++++++++++++++++++++
 gmime/gmime.h                  |   12 +---------
 7 files changed, 71 insertions(+), 43 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 666e2dc..6c09a92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-04-28  Jeffrey Stedfast  <fejj novell com>
+
+	* build/vs2008/config-win32.h.in: No longer has GMIME_*_VERSION
+	defines - these are all in gmime-version.h now.
+
+	* gmime/gmime-version.h.in: New template for generating
+	gmime-version.h
+
+	* configure.ac: Renamed from configure.in. Now generates a
+	gmime/gmime-version.h header which contains a macro for checking
+	the GMime version at compile-time. Requested feature from the
+	Balsa guys.
+
 2009-04-26  Jeffrey Stedfast  <fejj novell com>
 
 	* tests/test-streams.c: Updated to test GIO streams.
diff --git a/autogen.sh b/autogen.sh
index 8f6b86a..1cd085b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -8,7 +8,7 @@ ORIGDIR=`pwd`
 cd $srcdir
 PROJECT=GMime
 TEST_TYPE=-f
-FILE=configure.in
+FILE=configure.ac
 
 DIE=0
 
diff --git a/build/vs2008/config-win32.h.in b/build/vs2008/config-win32.h.in
index 423fbdb..6adf701 100644
--- a/build/vs2008/config-win32.h.in
+++ b/build/vs2008/config-win32.h.in
@@ -4,21 +4,6 @@
 /* Define if GMime should enable warning output. */
 /* #undef ENABLE_WARNINGS */
 
-/* Define to the GMime binary age */
-#define GMIME_BINARY_AGE @GMIME_BINARY_AGE@
-
-/* Define to the GMime interface age */
-#define GMIME_INTERFACE_AGE @GMIME_INTERFACE_AGE@
-
-/* Define to the GMime major version */
-#define GMIME_MAJOR_VERSION @GMIME_MAJOR_VERSION@
-
-/* Define to the GMime micro version */
-#define GMIME_MICRO_VERSION @GMIME_MICRO_VERSION@
-
-/* Define to the GMime minor version */
-#define GMIME_MINOR_VERSION @GMIME_MINOR_VERSION@
-
 /* Define to the GMime version */
 #define GMIME_VERSION "@GMIME_VERSION@"
 
diff --git a/configure.in b/configure.ac
similarity index 95%
rename from configure.in
rename to configure.ac
index 0689724..ccb0da5 100644
--- a/configure.in
+++ b/configure.ac
@@ -19,6 +19,11 @@ m4_define([gmime_binary_age],
 m4_define([gmime_version],
           [gmime_major_version.gmime_minor_version.gmime_micro_version])
 
+# the API version is the major.minor since the last API breakage
+m4_define([gmime_api_major], [2])
+m4_define([gmime_api_minor], [6])
+m4_define([gmime_api_version], [gmime_api_major.gmime_api_minor])
+
 # libtool version related macros
 m4_define([gmime_lt_release], [gmime_major_version.gmime_minor_version])
 m4_define([gmime_lt_current],
@@ -33,12 +38,6 @@ m4_define([gmime_lt_current_minus_age],
 m4_define([gmime_debug_default],
           [m4_if(m4_eval(gmime_minor_version % 2), [1], [yes], [minimum])])
 
-# the API version is the major.minor where minor is always even
-m4_define([gmime_api_stable], [m4_eval(10 * gmime_major_version + gmime_minor_version + m4_eval(gmime_minor_version % 2))])
-m4_define([gmime_api_major], [m4_eval(gmime_api_stable / 10)])
-m4_define([gmime_api_minor], [m4_eval(gmime_api_stable % 10)])
-m4_define([gmime_api_version], [gmime_api_major.gmime_api_minor])
-
 
 AC_INIT(gmime, [gmime_version],
         [http://bugzilla.gnome.org/enter_bug.cgi?product=gmime])
@@ -70,16 +69,6 @@ AC_SUBST(GMIME_VERSION)
 AC_SUBST(GMIME_INTERFACE_AGE)
 AC_SUBST(GMIME_BINARY_AGE)
 
-AC_DEFINE(GMIME_MAJOR_VERSION, [gmime_major_version],
-	  [Define to the GMime major version])
-AC_DEFINE(GMIME_MINOR_VERSION, [gmime_minor_version],
-	  [Define to the GMime minor version])
-AC_DEFINE(GMIME_MICRO_VERSION, [gmime_micro_version],
-	  [Define to the GMime micro version])
-AC_DEFINE(GMIME_INTERFACE_AGE, [gmime_interface_age],
-	  [Define to the GMime interface age])
-AC_DEFINE(GMIME_BINARY_AGE, [gmime_binary_age],
-	  [Define to the GMime binary age])
 AC_DEFINE(GMIME_VERSION, ["gmime_version"],
 	  [Define to the GMime version])
 
@@ -583,6 +572,7 @@ docs/tutorial/Makefile
 examples/Makefile
 util/Makefile
 gmime/Makefile
+gmime/gmime-version.h
 mono/Makefile
 mono/AssemblyInfo.cs
 mono/gmime-sharp.dll.config
diff --git a/gmime/Makefile.am b/gmime/Makefile.am
index fc80826..a944d33 100644
--- a/gmime/Makefile.am
+++ b/gmime/Makefile.am
@@ -14,6 +14,8 @@ INCLUDES = 				\
 
 noinst_PROGRAMS = gen-table charset-map
 
+EXTRA_DIST = gmime-version.h.in gmime-version.h
+
 lib_LTLIBRARIES = libgmime-2.6.la
 
 libgmime_2_6_la_SOURCES = 		\
@@ -116,6 +118,7 @@ gmimeinclude_HEADERS = 			\
 	gmime-stream-null.h		\
 	gmime-stream-pipe.h		\
 	gmime-utils.h			\
+	gmime-version.h			\
 	internet-address.h
 
 noinst_HEADERS = 			\
diff --git a/gmime/gmime-version.h.in b/gmime/gmime-version.h.in
new file mode 100644
index 0000000..fab8d8a
--- /dev/null
+++ b/gmime/gmime-version.h.in
@@ -0,0 +1,47 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*  GMime
+ *  Copyright (C) 2000-2009 Jeffrey Stedfast
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1
+ *  of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ *  02110-1301, USA.
+ */
+
+
+#ifndef __GMIME_VERSION_H__
+#define __GMIME_VERSION_H__
+
+#define GMIME_MAJOR_VERSION (@GMIME_MAJOR_VERSION@)
+#define GMIME_MINOR_VERSION (@GMIME_MINOR_VERSION@)
+#define GMIME_MICRO_VERSION (@GMIME_MICRO_VERSION@)
+#define GMIME_BINARY_AGE    (@GMIME_BINARY_AGE@)
+#define GMIME_INTERFACE_AGE (@GMIME_INTERFACE_AGE@)
+
+
+/**
+ * GMIME_CHECK_VERSION:
+ * @major: Minimum major version
+ * @minor: Minimum minor version
+ * @micro: Minimum micro version
+ *
+ * Check whether a GMime version equal to or greater than
+ * @major  minor @micro is present.
+ **/
+#define	GMIME_CHECK_VERSION(major,minor,micro)	\
+    (GMIME_MAJOR_VERSION > (major) || \
+     (GMIME_MAJOR_VERSION == (major) && GMIME_MINOR_VERSION > (minor)) || \
+     (GMIME_MAJOR_VERSION == (major) && GMIME_MINOR_VERSION == (minor) && \
+      GMIME_MICRO_VERSION >= (micro)))
+
+#endif /* __GMIME_VERSION_H__ */
diff --git a/gmime/gmime.h b/gmime/gmime.h
index 422d3a4..f32145f 100644
--- a/gmime/gmime.h
+++ b/gmime/gmime.h
@@ -23,6 +23,7 @@
 #define __GMIME_H__
 
 #include <glib.h>
+#include <gmime/gmime-version.h>
 #include <gmime/gmime-error.h>
 #include <gmime/gmime-charset.h>
 #include <gmime/gmime-iconv.h>
@@ -109,17 +110,6 @@ extern const guint gmime_interface_age;
  **/
 extern const guint gmime_binary_age;
 
-
-/**
- * GMIME_CHECK_VERSION:
- * @major: Minimum major version
- * @minor: Minimum minor version
- * @micro: Minimum micro version
- *
- * Macro that just calls g_mime_check_version()
- **/
-#define GMIME_CHECK_VERSION(major,minor,micro) g_mime_check_version (major, minor, micro)
-
 gboolean g_mime_check_version (guint major, guint minor, guint micro);
 
 



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