[glibmm] Build static libraries correctly under Windows/MinGW



commit e3aaf4725b763f36ed0d220589f75adea9d87e2f
Author: Alexander Shaduri <ashaduri gmail com>
Date:   Sun May 31 22:42:50 2009 +0200

    Build static libraries correctly under Windows/MinGW
    
    	* configure.ac: Define GLIBMM_STATIC_LIB and GIOMM_STATIC_LIB when
    	--enable-static is specified.
    	* gio/giommconfig.h.in: Add GIOMM_STATIC_LIB and don't define GIOMM_DLL
    	when using MinGW unless GIOMM_STATIC_LIB is defined.
    	* glib/glibmmconfig.h.in: Add GLIBMM_STATIC_LIB and don't define
    	GLIBMM_DLL when using MinGW unless GLIBMM_STATIC_LIB is defined.
    
    Signed-off-by: Armin Burgmeier <armin arbur net>
---
 ChangeLog              |   11 +++++++++++
 configure.ac           |    7 +++++++
 gio/giommconfig.h.in   |    6 ++++++
 glib/glibmmconfig.h.in |    7 ++++++-
 4 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 039655d..b7da609 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-23  Alexander Shaduri  <ashaduri gmail com>
+
+	Build static libraries correctly under Windows/MinGW. Bug #583657.
+
+	* configure.ac: Define GLIBMM_STATIC_LIB and GIOMM_STATIC_LIB when
+	--enable-static is specified.
+	* gio/giommconfig.h.in: Add GIOMM_STATIC_LIB and don't define GIOMM_DLL
+	when using MinGW unless GIOMM_STATIC_LIB is defined.
+	* glib/glibmmconfig.h.in: Add GLIBMM_STATIC_LIB and don't define
+	GLIBMM_DLL when using MinGW unless GLIBMM_STATIC_LIB is defined.
+
 2009-05-31  Armin Burgmeier  <armin openismus com>
 
 	* tools/pm/Output.pm: Made gmmproc work on Windows, so that it is
diff --git a/configure.ac b/configure.ac
index 4dd4073..da7ef7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,7 +106,14 @@ esac
 AC_MSG_RESULT([$os_win32])
 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
 
+# Disable static libraries by default
 AC_DISABLE_STATIC
+
+if test x$enable_static = "xyes"; then
+	AC_DEFINE([GLIBMM_STATIC_LIB],[1], [Defined when glibmm is built as a static library])
+	AC_DEFINE([GIOMM_STATIC_LIB],[1], [Defined when giomm is built as a static library])
+fi
+
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 
diff --git a/gio/giommconfig.h.in b/gio/giommconfig.h.in
index b5a5d43..6bf690f 100644
--- a/gio/giommconfig.h.in
+++ b/gio/giommconfig.h.in
@@ -30,6 +30,7 @@
 /* compiler feature tests that are used during compile time and run-time
    by gtk-- only. tests used by gdk-- and gtk-- should go into
    gdk--config.h.in */
+#undef GIOMM_STATIC_LIB
 #undef GIOMM_CXX_HAVE_MUTABLE
 #undef GIOMM_CXX_HAVE_NAMESPACES
 //#undef GIOMM_CXX_GAUB
@@ -66,6 +67,11 @@
 #  define GIOMM_USING_STD(Symbol) /* empty */
 #endif
 
+// Enable DLL-specific stuff only when not building a static library
+#if !defined(__CYGWIN__) && defined(__MINGW32__) && !defined(GIOMM_STATIC_LIB)
+  #define GIOMM_DLL
+#endif
+
 #ifdef GIOMM_DLL
   #if defined(GIOMM_BUILD) && defined(_WINDLL)
     /* Do not dllexport as it is handled by gendef on MSVC */
diff --git a/glib/glibmmconfig.h.in b/glib/glibmmconfig.h.in
index 739ac19..b4dcdde 100644
--- a/glib/glibmmconfig.h.in
+++ b/glib/glibmmconfig.h.in
@@ -17,7 +17,6 @@
 #define GLIBMM_CONFIGURE
 #elif defined(__MINGW32__)
 #define GLIBMM_WIN32
-#define GLIBMM_DLL
 #define GLIBMM_CONFIGURE
 #else
 //AIX clR compiler complains about this even though it doesn't get this far:
@@ -28,6 +27,7 @@
 #endif /* _WIN32 */
 
 #ifdef GLIBMM_CONFIGURE
+#undef GLIBMM_STATIC_LIB
 #undef GLIBMM_CXX_HAVE_MUTABLE
 #undef GLIBMM_CXX_HAVE_NAMESPACES
 #undef GLIBMM_HAVE_WIDE_STREAM
@@ -75,6 +75,11 @@
 #  define GLIBMM_USING_STD(Symbol) /* empty */
 #endif
 
+// Enable DLL-specific stuff only when not building a static library
+#if !defined(__CYGWIN__) && defined(__MINGW32__) && !defined(GLIBMM_STATIC_LIB)
+  #define GLIBMM_DLL
+#endif
+
 #ifdef GLIBMM_DLL
   #if defined(GLIBMM_BUILD) && defined(_WINDLL)
     /* Do not dllexport as it is handled by gendef on MSVC */



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