Shared library for Version 2.3 netCDF on AIX 3.2

The following script will convert a "libnetcdf.a" to a shared library
on AIX (ibm rs6000) 3.2 system.  After converting and installing the
library where you want it, you should recompile (or just relink)
ncdump and ncgen so that they will be smaller and use this library.
The install procedure will overwrite the shared library with a 
re-archived version so don't "make install" after modifying the
library to be shareable.  We assume that this is run in a directory
with the file "libnetcdf.a" in it.  After it is run, you will have
the file "libnetcdf_shr.a" in it as well.

#! /bin/sh
# Make a shareable netcdf
mkdir tmp
cd tmp
echo -n 'extracting from libnetcdf.a '
ar x ../libnetcdf.a
echo ' done.'
echo 'getting exports lists'
for x in *.o
        /usr/ucb/nm -p $x
done | awk '(NF==3 && $2=="D") {print $3}' | grep -v '^#' > exports
echo 'linking shareable portion'
ld -o shr.o *.o -bh:4 -H512 -T512 -bM:SRE -bE:exports -lX11 -l
xlf -lm -lc 2>&1
echo 'packaging shareable library'
ar cr ../libnetcdf_shr.a shr.o
cd ..
echo 'cleaning up'
rm -rf tmp