updates.
[silc.git] / libtoolfix
1 #!/bin/sh
2 #
3 # No Copyright 2002 Pekka Riikonen <priikone@silcnet.org>
4 #
5 # This script fixes the fundamental problem of libtool: it is not 
6 # configurable in run-time.  This changes the libtool so that it becomes
7 # more generic and configurable in run-time.  It is possible to specify
8 # how the libtool should behave by environment variables.
9 #
10 # Environment variables:
11 #
12 # LIBTOOL_ENABLE_SHARED
13 # LIBTOOL_ENABLE_STATIC
14 #
15 # Set either to "yes" or "no" value.  "no" is equivalent to being disabled.
16 # If environment variables are not given then the default settings apply.
17 #
18
19 # Sanity checks
20 if test '!' -f ./libtool; then
21   echo "./libtool does not exist"
22   exit 0
23 fi
24
25 # Take configuration from the ./libtool
26 sed '/^# ltmain\.sh/q' ./libtool >./libtool.tmp
27
28 # Put our wrapper to the new libtool.  This allows the run-time
29 # configuration of the libtool.  This could include a lot of other
30 # things like command line arguments too.
31 cat << EOF >> ./libtool.tmp
32 if test "\$LIBTOOL_ENABLE_SHARED" != ""; then
33   build_libtool_libs=\$LIBTOOL_ENABLE_SHARED
34 fi
35 if test "\$LIBTOOL_ENABLE_STATIC" != ""; then
36   build_old_libs=\$LIBTOOL_ENABLE_STATIC
37 fi
38 EOF
39
40 # Do a trick with the ltmain.sh to make these settings valid
41 ltmain=`pwd`/ltmain.sh
42 echo ". $ltmain" >> ./libtool.tmp
43 mv -f ./libtool.tmp ./libtool
44 chmod +x ./libtool
45
46 exit 1