Added libtoolfix to fix *all* problems of libtool.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 4 Dec 2002 19:10:57 +0000 (19:10 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 4 Dec 2002 19:10:57 +0000 (19:10 +0000)
CHANGES
TODO
lib/silccrypt/Makefile.am
lib/silcsim/Makefile.am
libtoolfix [new file with mode: 0755]

diff --git a/CHANGES b/CHANGES
index b9b330266b074a27579641daa30637df48df1d45..e7c4de0daa710bd245094d53d4fdd10463e5b1f6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,12 @@ Wed Dec  4 18:29:13 EET 2002  Pekka Riikonen <priikone@silcnet.org>
          decoded and encoded public key.  Affected files are
          lib/silccore/silcmessage.[ch].
 
+       * Added libtoolfix script that makes the libtool more generic
+         and configurable in run-time.  Now we can specify in run-time
+         if what kind of libraries we want to create, regardless of
+         configuration.  SIMs are now creates even if --disable-shared
+         was explicitly given.
+
 Tue Dec  3 23:26:55 EET 2002  Pekka Riikonen <priikone@silcnet.org>
 
        * Fixed founder key sending in CMODE command in client.
diff --git a/TODO b/TODO
index 5100e53aead3b399bfbacdc57750610429724ec6..c972651c0cd7f583863f0e167d85c26e12d3da8c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -23,8 +23,6 @@ TODO for SILC Server 1.0
 TODO/bugs In SILC Libraries
 ===========================
 
- o libtool hack to compile SIM even when disable-shared
-
  o Test cases for all cryptographic primitive in lib/silccrypt/
 
  o Test cases for all payload encoding and decoding routins in lib/silccore/
index c3f058f0af2a5d4583b08ceb95074e02fe4c7f08..ec36004dc448c616e547a4e9b3693818833d3ecb 100644 (file)
@@ -20,6 +20,10 @@ AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
 noinst_LTLIBRARIES = libsilccrypt.la
 
+# Compile silccrypt always also as shared library since the SIMs will
+# need it.
+LIBTOOL_ENABLE_SHARED=yes
+
 libsilccrypt_la_SOURCES = \
        none.c \
        rc5.c \
index e02b1526eda3b9df2df84cd03014b70b9a62f781..4ff1af45e774c8209c66220cc2ab7fbfa846b2ed 100644 (file)
@@ -52,6 +52,10 @@ if SILC_SIM
 all: $(SIM_CIPHER_OBJS) $(SIM_HASH_OBJS)
 endif
 
+# Libtool to compile always SIM as shared library
+LIBTOOL_ENABLE_SHARED=yes
+LIBTOOL_ENABLE_STATIC=no
+
 $(SIM_CIPHER_OBJS):
        @if test '!' -f lib$*.la ; then \
          $(LIBTOOL) --mode=link $(CCLD) -rpath $(silc_modulesdir) \
diff --git a/libtoolfix b/libtoolfix
new file mode 100755 (executable)
index 0000000..4f2a01f
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# No Copyright 2002 Pekka Riikonen <priikone@silcnet.org>
+#
+# This script fixes the fundamental problem of libtool: it is not 
+# configurable in run-time.  This changes the libtool so that it becomes
+# more generic and configurable in run-time.  It is possible to specify
+# how the libtool should behave by environment variables.
+#
+# Environment variables:
+#
+# LIBTOOL_ENABLE_SHARED
+# LIBTOOL_ENABLE_STATIC
+#
+# Set either to "yes" or "no" value.  "no" is equivalent to being disabled.
+# If environment variables are not given then the default settings apply.
+#
+
+# Sanity checks
+if test '!' -f ./libtool; then
+  echo "./libtool does not exist"
+  exit 0
+fi
+
+# Take configuration from the ./libtool
+sed '/^# ltmain\.sh/q' ./libtool >./libtool.tmp
+
+# Put our wrapper to the new libtool.  This allows the run-time
+# configuration of the libtool.  This could include a lot of other
+# things like command line arguments too.
+cat << EOF >> ./libtool.tmp
+if test "\$LIBTOOL_ENABLE_SHARED" != ""; then
+  build_libtool_libs=\$LIBTOOL_ENABLE_SHARED
+fi
+if test "\$LIBTOOL_ENABLE_STATIC" != ""; then
+  build_old_libs=\$LIBTOOL_ENABLE_STATIC
+fi
+EOF
+
+# Do a trick with the ltmain.sh to make these settings valid
+ltmain=`pwd`/ltmain.sh
+echo ". $ltmain" >> ./libtool.tmp
+mv ./libtool ./libtool.orig
+mv ./libtool.tmp ./libtool
+chmod +x ./libtool
+
+exit 1