summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2004-04-13 22:20:43 +0000
committerDavid Schleef <ds@schleef.org>2004-04-13 22:20:43 +0000
commitdfbe01076ca09686d37a2816a7c884c5adedb7af (patch)
tree088f9c5d80ce88ecc427364e8895e969fafbea7c
parent99901894a48091bfed16826702c38c4063e64954 (diff)
Needed for building DLLs on Windows
Original commit message from CVS: Needed for building DLLs on Windows
-rw-r--r--as-libtool.mak49
-rw-r--r--m4/as-libtool.m419
2 files changed, 67 insertions, 1 deletions
diff --git a/as-libtool.mak b/as-libtool.mak
new file mode 100644
index 0000000..1ddf1e3
--- /dev/null
+++ b/as-libtool.mak
@@ -0,0 +1,49 @@
+# some Makefile.am snippets to fix libtool's breakage w.r.t. DLL
+# building
+#
+#
+# define AS_LIBTOOL_LIB before calling. Sorry, only one lib per
+# directory
+#
+
+
+# add this to EXTRA_DIST
+as_libtool_EXTRA_DIST = $(AS_LIBTOOL_LIB).def
+
+if AS_LIBTOOL_WIN32
+
+as_libtool_noinst_DATA_files = $(AS_LIBTOOL_LIB).lib
+
+as_libtool_LDFLAGS = -no-undefined -export-symbols $(srcdir)/$(AS_LIBTOOL_LIB).def
+
+# depend on this in install-data-local
+as-libtool-install-data-local:
+ $(INSTALL) $(AS_LIBTOOL_LIB).lib $(DESTDIR)$(libdir)
+ $(INSTALL) .libs/$(AS_LIBTOOL_LIB).dll.a $(DESTDIR)$(libdir)
+ $(INSTALL) $(srcdir)/$(AS_LIBTOOL_LIB).def $(DESTDIR)$(libdir)
+
+# depend on this in uninstall-local
+as-libtool-uninstall-local:
+ -rm $(DESTDIR)$(libdir)/$(AS_LIBTOOL_LIB).lib
+ -rm $(DESTDIR)$(libdir)/$(AS_LIBTOOL_LIB).dll.a
+ -rm $(DESTDIR)$(libdir)/$(AS_LIBTOOL_LIB).def
+
+else
+
+as-libtool-install-data-local:
+as-libtool-uninstall-local:
+
+endif
+
+$(AS_LIBTOOL_LIB).lib: $(AS_LIBTOOL_LIB).la $(AS_LIBTOOL_LIB).def
+ dlltool -S $(CC) -f "-c" --export-all-symbols --input-def \
+ $(srcdir)/$(AS_LIBTOOL_LIB).def --output-lib $@
+
+$(AS_LIBTOOL_LIB).def:
+ echo EXPORTS >$(AS_LIBTOOL_LIB).def.tmp
+ nm --defined-only -g .libs/$(AS_LIBTOOL_LIB).so | \
+ awk '{ print $$3 }' | \
+ grep -v '^{_DYNAMIC,_GLOBAL_OFFSET_TABLE_,__bss_start,_edata,_end,_fini,_init}$$' | \
+ sed 's/^/ /' >>$(AS_LIBTOOL_LIB).def.tmp
+ mv $(AS_LIBTOOL_LIB).def.tmp $(AS_LIBTOOL_LIB).def
+
diff --git a/m4/as-libtool.m4 b/m4/as-libtool.m4
index 870b47e..807cf24 100644
--- a/m4/as-libtool.m4
+++ b/m4/as-libtool.m4
@@ -1,4 +1,4 @@
-dnl as-libtool.m4 0.1.2
+dnl as-libtool.m4 0.1.3
dnl autostars m4 macro for libtool versioning
dnl thomas@apestaart.org
dnl
@@ -35,4 +35,21 @@ dnl [$1]_LT_LDFLAGS="$[$1]_LT_LDFLAGS -version-info $[$1]_LIBVERSION"
AC_SUBST([$1]_LT_LDFLAGS)
AC_LIBTOOL_DLOPEN
+ AM_PROG_LIBTOOL
+
+ case "$host" in
+ *-*-mingw*)
+ as_libtool_win32=yes
+ enable_static=no
+ enable_shared=yes
+ ;;
+ *)
+ as_libtool_win32=no
+ ;;
+ esac
+ AM_CONDITIONAL(AS_LIBTOOL_WIN32, [test "$as_libtool_win32" = "yes"])
+
+ m4_pattern_allow([AS_LIBTOOL_WIN32])
+ m4_pattern_allow([AS_LIBTOOL_WIN32_TRUE])
+ m4_pattern_allow([AS_LIBTOOL_WIN32_FALSE])
])