summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Leeds <randall@apache.org>2011-09-12 20:53:04 +0000
committerRandall Leeds <randall@apache.org>2011-09-12 20:53:04 +0000
commita0e5efab6bb9d7c080b42de1c342155b3ccb3ac9 (patch)
tree37b4360f26a261f0305150e7d5a3d07569079daf
parent2a2f488b002f379f23d9ec9f64ed4170178b7227 (diff)
downloadcouchdb-a0e5efab6bb9d7c080b42de1c342155b3ccb3ac9.tar.gz
Insane libtool hackery for windows (COUCHDB-1197)
Patch by Dave Cottlehuber git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1169920 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--configure.ac32
1 files changed, 21 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 4edc2c7f3..bfed4562c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -524,19 +524,29 @@ AC_CONFIG_FILES([var/Makefile])
AC_OUTPUT
-# *sob* - on Windows libtool fails as 'libname_spec' isn't correct (it
-# expects GNU style lib names). I can't work out how to configure this
-# option sanely, so we pass the script through sed to modify it.
-# Also, the erlang cc.sh script doesn't cope well with the '-link' command
-# line option libtool provides.
-# PLEASE, someone help put this out of its misery!!
-# This hackery is being tracked via COUCHDB-440.
+# Windows Erlang build tools wrap Microsoft's linker and compiler just enough
+# to be able to build Erlang/OTP successfully, but not enough for full
+# compatibility with GNU AutoTools. The MS VC compiler and linker are
+# hidden from autotools in Erlang's cc.sh and ld.sh wrappers. GNU autoconf
+# identifies this dastardly mix as a unix variant, and libtool kindly
+# passes incorrect flags and names through to the MS linker. The simplest fix
+# is to modify libtool via sed to remove those options.
+# As this is only done once at first configure, and subsequent config or source
+# changes may trigger a silent reversion to the non-functioning original.
+# Changes are;
+# 1. replace LIB$name with $name in libname_spec (e.g. libicu -> icu) to ensure
+# correct windows versions of .lib and .dlls are found or generated.
+# 2. remove incompatible \w-link\w from archive_cmds
+# 3. remove GNU-style directives to be passed through to the linker
+# 4. swap GNU-style shared library flags with MS -dll variant
+# This obscene hackery is tracked under COUCHDB-440 and COUCHDB-1197.
+
if test x${IS_WINDOWS} = xTRUE; then
mv libtool libtool.dist
- sed -E -e 's,libname_spec="lib\\$name",libname_spec="\\\$name",' \
- -e 's,-link,,' \
- -e 's/-Xlinker --out-implib -Xlinker \\\$lib//' \
- -e 's/(-shared -nostdlib)/-dll \1/' \
+ /bin/sed -E -e 's,^libname_spec="lib,libname_spec=",' \
+ -e 's,( -link ), ,' \
+ -e 's,-Xlinker --out-implib -Xlinker \\\$lib,,' \
+ -e 's,(-shared -nostdlib), -dll ,' \
< libtool.dist > libtool
# probably would chmod +x if we weren't on windows...
fi