]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
When not producing a dynamic library, define DBUS_STATIC_BUILD
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 12 Mar 2012 14:15:48 +0000 (14:15 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 15 Jun 2012 13:25:48 +0000 (14:25 +0100)
When targeting Windows, linking against the static library requires
special effort to turn off DLL import/export processing. We normally
link some things against the dynamic library, but if we're not building
that, we'll have to link everything statically.

Based on patches from 'william' on fd.o #46367.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33973
Tested-by: René Berber <Rene.Berber gmail com>
configure.ac
dbus-1-uninstalled.pc.in
dbus-1.pc.in
test/Makefile.am
tools/Makefile.am

index 837e7b25d114cd1981ea536579805aced3f35cd1..8d9522785daba3c6e8714c2344ad7969c70c8264 100644 (file)
@@ -123,6 +123,16 @@ AM_CONDITIONAL(DBUS_WINCE, test "$dbus_wince" = yes)
 AM_CONDITIONAL(DBUS_UNIX, test "$dbus_unix" = yes)
 AM_CONDITIONAL(DBUS_CYGWIN, test "$dbus_cygwin" = yes)
 
+DBUS_STATIC_BUILD_CPPFLAGS=
+if test "x$enable_shared" = xno; then
+    # On Windows, linking against the static library requires special effort
+    # to turn off DLL import/export processing. We normally link some things
+    # against the dynamic library, but if we're not building that, we'll
+    # have to link everything statically.
+    DBUS_STATIC_BUILD_CPPFLAGS=-DDBUS_STATIC_BUILD
+fi
+AC_SUBST([DBUS_STATIC_BUILD_CPPFLAGS])
+
 AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no)
 AC_ARG_ENABLE(verbose-mode, AS_HELP_STRING([--enable-verbose-mode],[support verbose debug mode]),enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
 AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion checks]),enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
index f00723252e8e8b64a0dd41ad071e3185a3d530c6..038c83e20a3f2c3e95ac839a34e05c0793217b0f 100644 (file)
@@ -14,4 +14,4 @@ Description: Free desktop message bus (uninstalled copy)
 Version: @VERSION@
 Libs: ${abs_top_builddir}/dbus/libdbus-1.la
 Libs.private: @LIBDBUS_LIBS@
-Cflags: -I${abs_top_srcdir}
+Cflags: -I${abs_top_srcdir} @DBUS_STATIC_BUILD_CPPFLAGS@
index 7201e07f9850132e6cda8ffe62942c8ee88c56de..25f8bcee4808c21f0455fdcb7b257e5c90fdf8e6 100644 (file)
@@ -14,4 +14,4 @@ Description: Free desktop message bus
 Version: @VERSION@
 Libs: -L${libdir} -ldbus-1
 Libs.private: @LIBDBUS_LIBS@
-Cflags: -I${includedir}/dbus-1.0 -I${libdir}/dbus-1.0/include
+Cflags: -I${includedir}/dbus-1.0 -I${libdir}/dbus-1.0/include @DBUS_STATIC_BUILD_CPPFLAGS@
index aa04792b4fbf49564497247f68300bc67ecb1905..e94489986c36c5876631563854c4538b9443ee02 100644 (file)
@@ -4,8 +4,10 @@
 SUBDIRS= . name-test 
 DIST_SUBDIRS=name-test
 
+# CPPFLAGS for binaries that are normally dynamic
 AM_CPPFLAGS = \
        -I$(top_srcdir) \
+       $(DBUS_STATIC_BUILD_CPPFLAGS) \
        $(GLIB_CFLAGS) \
        $(DBUS_GLIB_CFLAGS) \
        $(NULL)
@@ -13,6 +15,7 @@ AM_CPPFLAGS = \
 # improve backtraces from test stuff
 AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
 
+# CPPFLAGS for binaries that are always static
 static_cppflags = \
        $(AM_CPPFLAGS) \
        -DDBUS_STATIC_BUILD \
index 08b902347a4f864ddeb1b941dc08f3d57e7999ca..c4632e3e08007a673db0befb12ef70e7e5cbc632 100644 (file)
@@ -2,6 +2,7 @@ configdir=$(sysconfdir)/dbus-1
 
 AM_CPPFLAGS = \
        -I$(top_srcdir) \
+       $(DBUS_STATIC_BUILD_CPPFLAGS) \
        $(DBUS_X_CFLAGS) \
        -DDBUS_COMPILATION \
        -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\" \