os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/ldAix
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/ldAix	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,78 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# ldAix ldCmd ldArg ldArg ...
     1.7 +#
     1.8 +# This shell script provides a wrapper for ld under AIX in order to
     1.9 +# create the .exp file required for linking.  Its arguments consist
    1.10 +# of the name and arguments that would normally be provided to the
    1.11 +# ld command.  This script extracts the names of the object files
    1.12 +# from the argument list, creates a .exp file describing all of the
    1.13 +# symbols exported by those files, and then invokes "ldCmd" to
    1.14 +# perform the real link.
    1.15 +#
    1.16 +# RCS: @(#) $Id: ldAix,v 1.4 2002/09/27 01:28:26 hobbs Exp $
    1.17 +
    1.18 +# Extract from the arguments the names of all of the object files.
    1.19 +
    1.20 +args=$*
    1.21 +ofiles=""
    1.22 +for i do
    1.23 +    x=`echo $i | grep '[^.].o$'`
    1.24 +    if test "$x" != ""; then
    1.25 +	ofiles="$ofiles $i"
    1.26 +    fi
    1.27 +done
    1.28 +
    1.29 +# Extract the name of the object file that we're linking.
    1.30 +outputFile=`echo $args | sed -e 's/.*-o \([^ ]*\).*/\1/'`
    1.31 +
    1.32 +# Create the export file from all of the object files, using nm followed
    1.33 +# by sed editing.  Here are some tricky aspects of this:
    1.34 +#
    1.35 +# 1. Nm produces different output under AIX 4.1 than under AIX 3.2.5;
    1.36 +#    the following statements handle both versions.
    1.37 +# 2. Use the -g switch to nm instead of -e under 4.1 (this shows just
    1.38 +#    externals, not statics;  -g isn't available under 3.2.5, though).
    1.39 +# 3. Use the -X32_64 switch to nm on AIX-4+ to handle 32 or 64bit compiles.
    1.40 +# 4. Eliminate lines that end in ":": these are the names of object
    1.41 +#    files (relevant in 4.1 only).
    1.42 +# 5. Eliminate entries with the "U" key letter;  these are undefined
    1.43 +#    symbols (relevant in 4.1 only).
    1.44 +# 6. Eliminate lines that contain the string "0|extern" preceded by space;
    1.45 +#    in 3.2.5, these are undefined symbols (address 0).
    1.46 +# 7. Eliminate lines containing the "unamex" symbol.  In 3.2.5, these
    1.47 +#    are also undefined symbols.
    1.48 +# 8. If a line starts with ".", delete the leading ".", since this will
    1.49 +#    just cause confusion later.
    1.50 +# 9. Eliminate everything after the first field in a line, so that we're
    1.51 +#    left with just the symbol name.
    1.52 +
    1.53 +nmopts="-g -C"
    1.54 +osver=`uname -v`
    1.55 +if test $osver -eq 3; then
    1.56 +  nmopts="-e"
    1.57 +fi
    1.58 +if test $osver -gt 3; then
    1.59 +  nmopts="$nmopts -X32_64"
    1.60 +fi
    1.61 +rm -f lib.exp
    1.62 +echo "#! $outputFile" >lib.exp
    1.63 +/usr/ccs/bin/nm $nmopts -h $ofiles | sed -e '/:$/d' -e '/ U /d' -e '/[ 	]0|extern/d' -e '/unamex/d' -e 's/^\.//' -e 's/[ 	|].*//' | sort | uniq >>lib.exp
    1.64 +
    1.65 +# If we're linking a .a file, then link all the objects together into a 
    1.66 +# single file "shr.o" and then put that into the archive.  Otherwise link 
    1.67 +# the object files directly into the .a file.
    1.68 +
    1.69 +outputFile=`echo $args | sed -e 's/.*-o \([^ ]*\).*/\1/'`
    1.70 +noDotA=`echo $outputFile | sed -e '/\.a$/d'`
    1.71 +echo "noDotA=\"$noDotA\""
    1.72 +if test "$noDotA" = "" ; then
    1.73 +    linkArgs=`echo $args | sed -e 's/-o .*\.a /-o shr.o /'`
    1.74 +    echo $linkArgs
    1.75 +    eval $linkArgs
    1.76 +    echo ar cr $outputFile shr.o
    1.77 +    ar cr $outputFile shr.o
    1.78 +    rm -f shr.o
    1.79 +else
    1.80 +    eval $args
    1.81 +fi