[gtk-vnc] Fix DLL linking on mingw32
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] Fix DLL linking on mingw32
- Date: Sun, 11 Jul 2010 18:10:10 +0000 (UTC)
commit ac565a88d41797be3ef3908e8b237332935ed8c5
Author: Daniel P. Berrange <berrange redhat com>
Date: Sun Jul 11 19:05:52 2010 +0100
Fix DLL linking on mingw32
libtool does not like -Wl,--no-undefined, even though the compiler
and linker are happy enough. Revert to using -no-undefined on
mingw32 platforms. Also use the correct style of linker script
for exporting symbols on mingw32
configure.ac | 29 ++++++++++++++++++++++++++---
src/Makefile.am | 26 ++++++++++++++++++++++----
2 files changed, 48 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5d055d0..38ec544 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,10 +120,32 @@ AC_ARG_WITH(examples,
WITH_EXAMPLES=$withval
+NO_UNDEFINED_LDFLAGS=
+VERSION_SCRIPT_FLAGS=
+USE_VERSION_DEFS=0
+case "$host" in
+ *-*-mingw*)
+ VERSION_SCRIPT_FLAGS="-Wl,"
+ USE_VERSION_DEFS=1
+ NO_UNDEFINED_FLAGS="-no-undefined"
+ ;;
+
+ *-*-cygwin*)
+ NO_UNDEFINED_LDFLAGS="-no-undefined"
+ ;;
+
+ *)
+ NO_UNDEFINED_FLAGS="-Wl,--no-undefined"
+ VERSION_SCRIPT_FLAGS=-Wl,--version-script=
+ `ld --help 2>&1 | grep -- --version-script >/dev/null` || \
+ VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
+ ;;
+esac
+AC_SUBST([NO_UNDEFINED_FLAGS])
+AC_SUBST([VERSION_SCRIPT_FLAGS])
+AM_CONDITIONAL([USE_VERSION_DEFS], [test "$USE_VERSION_DEFS" = "1"])
+
dnl check ld support --version-script
-VERSION_SCRIPT_FLAGS=-Wl,--version-script=
-`ld --help 2>&1 | grep -- --version-script >/dev/null` || \
- VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
AC_SUBST(VERSION_SCRIPT_FLAGS)
PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= $GOBJECT_REQUIRED)
@@ -381,6 +403,7 @@ Configure summary:
Compiler ...................: ${CC}
Compiler Flags .............: ${CFLAGS}
+ Extra Link Flags ...........: ${VERSION_SCRIPT_FLAGS} ${NO_UNDEFINED_FLAGS}
Prefix......................: ${prefix}
Python binding .............: ${WITH_PYTHON}
diff --git a/src/Makefile.am b/src/Makefile.am
index 36b658d..b4dcd70 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,6 +3,24 @@ EXTRA_DIST = libgvnc_sym.version libgtk-vnc_sym.version vncmarshal.txt
lib_LTLIBRARIES = libgvnc-1.0.la libgtk-vnc-1.0.la
+BUILT_SOURCES =
+if USE_VERSION_DEFS
+GVNC_VERSION_FILE = $(builddir)/libgvnc_sym.def
+GTK_VNC_VERSION_FILE = $(builddir)/libgtk-vnc_sym.def
+BUILT_SOURCES += $(GVNC_VERSION_FILE) $(GTK_VNC_VERSION_FILE)
+else
+GVNC_VERSION_FILE = $(srcdir)/libgvnc_sym.version
+GTK_VNC_VERSION_FILE = $(srcdir)/libgtk-vnc_sym.version
+endif
+
+%.def: %.version
+ $(AM_V_GEN)rm -f -- $ -tmp $@ ; \
+ printf 'EXPORTS\n' > $ -tmp && \
+ sed -e '/^$$/d; /#/d; /:/d; /\}/d; /\*/d; /LIBVIRT_/d; s/[ \t]*\(.*\)\;/ \1/g' $^ >> $ -tmp && \
+ chmod a-w $ -tmp && \
+ mv $ -tmp $@
+
+
libgvnc_1_0_la_LIBADD = \
@GOBJECT_LIBS@ \
@GTHREAD_LIBS@ \
@@ -23,8 +41,8 @@ libgvnc_1_0_la_CFLAGS = \
-I$(top_srcdir)/gnulib/lib \
-I../gnulib/lib
libgvnc_1_0_la_LDFLAGS = \
- @VERSION_SCRIPT_FLAGS $(srcdir)/libgvnc_sym.version \
- -version-info 0:1:0 -Wl,--no-undefined
+ $(VERSION_SCRIPT_FLAGS)$(GVNC_VERSION_FILE) \
+ -version-info 0:1:0 $(NO_UNDEFINED_FLAGS)
gvnc_includedir = $(includedir)/gvnc-1.0/
gvnc_include_HEADERS = \
@@ -78,8 +96,8 @@ libgtk_vnc_1_0_la_CFLAGS = \
-I$(top_srcdir)/gnulib/lib \
-I../gnulib/lib
libgtk_vnc_1_0_la_LDFLAGS = \
- @VERSION_SCRIPT_FLAGS $(srcdir)/libgtk-vnc_sym.version \
- -version-info 0:1:0 -Wl,--no-undefined
+ $(VERSION_SCRIPT_FLAGS)$(GTK_VNC_VERSION_FILE) \
+ -version-info 0:1:0 $(NO_UNDEFINED_FLAGS)
gtk_vnc_includedir = $(includedir)/gtk-vnc-1.0/
gtk_vnc_include_HEADERS = \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]