[PATCH 2/3] Cygwin-specific LDFLAGS and LIBADD

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

 



Cygwin requires some extra LDFLAGS and LIBADD be passed when linking. Rather than add these extra flags to all invocations, I've created special @CYGWIN_EXTRA_*@ symbols to contain them.

This is basically copied from libxml2.

Also ordering of *_LIBADD and *_LDFLAGS seems to be important in automake. Specifically: if libvirt_la_SOURCES comes after libvirt_la_LDFLAGS then automake wasn't able to determine the list of sources (I've no idea why but possibly because libvirt_la_SOURCES is defined in terms of other variables?), so I've reordered these lines.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.97
diff -u -r1.97 configure.in
--- configure.in	27 Nov 2007 14:39:42 -0000	1.97
+++ configure.in	29 Nov 2007 16:40:11 -0000
@@ -529,6 +544,28 @@
     ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
 fi
 
+dnl Extra link-time flags for Cygwin.
+dnl Copied from libxml2 configure.in, but I removed mingw changes
+dnl for now since I'm not supporting mingw at present.  - RWMJ
+cygwin=
+CYGWIN_EXTRA_LDFLAGS=
+CYGWIN_EXTRA_LIBADD=
+CYGWIN_EXTRA_PYTHON_LIBADD=
+case "$host" in
+  *-*-cygwin*)
+    cygwin=yes
+    CYGWIN_EXTRA_LDFLAGS="-no-undefined"
+    CYGWIN_EXTRA_LIBADD="${INTLLIBS}"
+    if test "x$PYTHON_VERSION" != "x"; then
+      CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
+    fi
+    ;;
+esac
+AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
+AC_SUBST(CYGWIN_EXTRA_LIBADD)
+AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
+AM_CONDITIONAL(CYGWIN,[test "x$cygwin" = "xyes"])
+
 # very annoying
 rm -f COPYING
 cp COPYING.LIB COPYING
Index: src/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/src/Makefile.am,v
retrieving revision 1.55
diff -u -r1.55 Makefile.am
--- src/Makefile.am	17 Nov 2007 11:17:48 -0000	1.55
+++ src/Makefile.am	29 Nov 2007 16:43:23 -0000
@@ -24,11 +24,6 @@
 EXTRA_DIST = libvirt_sym.version $(conf_DATA)
 
 lib_LTLIBRARIES = libvirt.la
-libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS)
-libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
-                    -version-info @LIBVIRT_VERSION_INFO@ \
-                    $(COVERAGE_CFLAGS:-f%=-Wc,-f%)
-libvirt_la_CFLAGS = $(COVERAGE_CFLAGS)
 
 CLIENT_SOURCES =						\
 		libvirt.c internal.h				\
@@ -64,6 +59,13 @@
 		../qemud/remote_protocol.c ../qemud/remote_protocol.h
 
 libvirt_la_SOURCES = $(CLIENT_SOURCES) $(SERVER_SOURCES)
+libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(LTLIBOBJS) \
+		    @CYGWIN_EXTRA_LIBADD@
+libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
+                     -version-info @LIBVIRT_VERSION_INFO@ \
+                    $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
+		    @CYGWIN_EXTRA_LDFLAGS@
+libvirt_la_CFLAGS = $(COVERAGE_CFLAGS)
 
 bin_PROGRAMS = virsh
 
Index: python/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/python/Makefile.am,v
retrieving revision 1.10
diff -u -r1.10 Makefile.am
--- python/Makefile.am	15 Nov 2007 13:04:28 -0000	1.10
+++ python/Makefile.am	29 Nov 2007 16:43:48 -0000
@@ -23,8 +23,6 @@
 	libvirt-python-api.xml \
 	$(DOCS)
 
-libvirtmod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs
-
 if WITH_PYTHON
 mylibs = $(top_builddir)/src/libvirt.la
 
@@ -33,10 +31,14 @@
 python_LTLIBRARIES = libvirtmod.la
 
 libvirtmod_la_SOURCES = libvir.c types.c libvirt-py.c libvirt-py.h
-libvirtmod_la_LIBADD = $(mylibs)
 # Python header files contain a redundant decl, hence:
 libvirtmod_la_CFLAGS = -Wno-redundant-decls
 
+libvirtmod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs \
+	@CYGWIN_EXTRA_LDFLAGS@
+libvirtmod_la_LIBADD = $(mylibs) \
+	@CYGWIN_EXTRA_LIBADD@ @CYGWIN_EXTRA_PYTHON_LIBADD@
+
 GENERATE = generator.py
 API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-python-api.xml
 GENERATED= libvirt-export.c \

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]