[gtkmm] Windows: Allow building gtkmm statically also when glibmm is built as a DLL



commit 494890b8febd2d00696b0ab60e88cffbc45b4717
Author: Armin Burgmeier <armin arbur net>
Date:   Sun May 31 23:12:22 2009 +0200

    Windows: Allow building gtkmm statically also when glibmm is built as a DLL
    
    	* configure.ac: Define GTKMM_STATIC_LIB when a static gtkmm library is
    	built.
    
    	* gtk/gtkmmconfig.h.in: Define GTKMM_DLL on Windows when building a
    	DLL, instead of using GLIBMM_DLL, so that it's possible to build
    	glibmm as a static library and gtkmm as a DLL, or vice versa. Bug
    	#583657.
---
 ChangeLog            |   10 ++++++++++
 configure.ac         |    5 +++++
 gtk/gtkmmconfig.h.in |   14 +++++++++++---
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 64dbcf4..45eb206 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-05-31  Armin Burgmeier  <armin openismus com>
+
+	* configure.ac: Define GTKMM_STATIC_LIB when a static gtkmm library is
+	built.
+
+	* gtk/gtkmmconfig.h.in: Define GTKMM_DLL on Windows when building a
+	DLL, instead of using GLIBMM_DLL, so that it's possible to build
+	glibmm as a static library and gtkmm as a DLL, or vice versa. Bug
+	#583657.
+
 2009-05-18  Murray Cumming  <murrayc murrayc com>
 
 	* gtk/src/iconview.hg: get_model(): Use refreturn to correct the ref-counting.
diff --git a/configure.ac b/configure.ac
index 2292aeb..354a092 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,10 +107,15 @@ esac
 AC_MSG_RESULT([$os_win32])
 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
 
+# Disable static libraries by default
 AC_DISABLE_STATIC
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 
+if test x$enable_static = "xyes"; then
+	AC_DEFINE([GTKMM_STATIC_LIB],[1], [Defined when gtkmm is built as a static library])
+fi
+
 AL_PROG_GNU_M4(AC_MSG_ERROR([dnl
 SUN m4 does not work for building gtkmm. 
 Please install GNU m4.]))
diff --git a/gtk/gtkmmconfig.h.in b/gtk/gtkmmconfig.h.in
index 4fbbecf..983b939 100644
--- a/gtk/gtkmmconfig.h.in
+++ b/gtk/gtkmmconfig.h.in
@@ -11,8 +11,10 @@
 #undef GTKMM_ATKMM_ENABLED
 #undef GTKMM_MAEMO_EXTENSIONS_ENABLED
 
-
 #ifdef GLIBMM_CONFIGURE
+
+#undef GTKMM_STATIC_LIB
+
 /* compiler feature tests that are used during compile time and run-time
    by gtkmm only. */
 
@@ -28,8 +30,14 @@
 
 #endif /* GLIBMM_CONFIGURE */
 
+// Enable DLL-specific stuff only when not building a static library
+#if !defined(__CYGWIN__) && defined(__MINGW32__) && !defined(GTKMM_STATIC_LIB)
+  #define GTKMM_DLL
+#elif defined(_MSC_VER)
+  #define GTKMM_DLL
+#endif
 
-#ifdef GLIBMM_DLL
+#ifdef GTKMM_DLL
   #if defined(GTKMM_BUILD) && defined(_WINDLL)
     // Do not dllexport as it is handled by gendef on MSVC
     #define GTKMM_API 
@@ -41,7 +49,7 @@
   #endif /* GTKMM_BUILD - _WINDLL */
 #else
   #define GTKMM_API
-#endif /* GLIBMM_DLL */
+#endif /* GTKMM_DLL */
 
 #undef GTKMM_DISABLE_DEPRECATED
 



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