Bug 27194 - Fix autoconf build for windows
Summary: Fix autoconf build for windows
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.3.x (devel)
Hardware: Other Windows (All)
: medium normal
Assignee: Ralf Habacker
QA Contact: John (J5) Palmieri
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-19 04:57 UTC by Marcus Brinkmann
Modified: 2010-03-19 13:44 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Consistently include config.h in all C source fiels. (42.16 KB, patch)
2010-03-19 04:58 UTC, Marcus Brinkmann
Details | Splinter Review
Define dbus_1_EXPORTS (854 bytes, patch)
2010-03-19 04:59 UTC, Marcus Brinkmann
Details | Splinter Review
Do not use DBUS_WIN in a public header file (670 bytes, patch)
2010-03-19 05:00 UTC, Marcus Brinkmann
Details | Splinter Review

Description Marcus Brinkmann 2010-03-19 04:57:51 UTC
Hi,

now that __declspec(exports) is used, the autoconf build system needs to be adjusted to make it work.  Currently, config.h is not included systematically, which causes for example dbus-errors.h to miss the decoration and thus its symbols are not exported.  The first patch (0001) fixes that by following convention to include <config.h> before any other header file (including system header files!) in every .c file but never in any .h file.

The second patch (0002) adds the missing -Ddbus_1_EXPORTS to the build flags for libdbus-1.dll.

The third patch (0003) fixes the public header files, which currently rely on the internal symbol DBUS_WIN to dispatch between dllimport and dllexport decoration.  That is not defined outside of dbus-windows, and thus should not occur in the public header files.  The patch replaces it by the standard symbol _WIN32.  An alternative approach (not shown here) would be to define DBUS_WIN in dbus-arch-deps.h.

Thanks!
Comment 1 Marcus Brinkmann 2010-03-19 04:58:43 UTC
Created attachment 34236 [details] [review]
Consistently include config.h in all C source fiels.

Include <config.h> first in all .c files, but in no .h files.
Comment 2 Marcus Brinkmann 2010-03-19 04:59:14 UTC
Created attachment 34237 [details] [review]
Define dbus_1_EXPORTS

This defines dbus_1_EXPORTS where needed for autoconf based builds.
Comment 3 Marcus Brinkmann 2010-03-19 05:00:27 UTC
Created attachment 34238 [details] [review]
Do not use DBUS_WIN in a public header file

Use _WIN32 instead DBUS_WIN in public header file.  Alternative would be extending dbus-arch-deps.h, probably by this (untested):

#if @DBUS_WIN@
#define DBUS_WIN 1
#else
#undef DBUS_WIN
#endif
Comment 4 Ralf Habacker 2010-03-19 08:00:06 UTC
Hi Colin, 

do you see any problems with the first patch ? The other two does not make any problem as far as I can see. 
Comment 5 Ralf Habacker 2010-03-19 08:29:47 UTC
patch 1 depends on the wince patch (..glue file). 
I can apply without the related fix, which should be added to the wince patch 

diff --git a/dbus/dbus-sysdeps-wince-glue.c b/dbus/dbus-sysdeps-wince-glue.c
index 38b59c6..204e719 100644
--- a/dbus/dbus-sysdeps-wince-glue.c
+++ b/dbus/dbus-sysdeps-wince-glue.c
@@ -26,6 +26,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-sysdeps.h"
 #include "dbus-sysdeps-win.h"
Comment 6 Ralf Habacker 2010-03-19 12:12:39 UTC
I tried building with cmake/msvc on windows, no other problems detected. 
Comment 7 Ralf Habacker 2010-03-19 13:44:42 UTC
patches tested with cmake and msvc + mingw without any errors - applied 


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.