3 # Copyright 2001-2004 The Apache Software Foundation
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 # instdso.sh - install Apache DSO modules
20 # we use this instead of libtool --install because:
21 # 1) on a few platforms libtool doesn't install DSOs exactly like we'd
22 # want (weird names, doesn't remove DSO first)
23 # 2) we never want the .la files copied, so we might as well copy
24 # the .so files ourselves
26 if test "$#" != "3"; then
27 echo "wrong number of arguments to instdso.sh"
28 echo "Usage: instdso.sh SH_LIBTOOL-value dso-name path-to-modules"
32 SH_LIBTOOL=`echo $1 | sed -e 's/^SH_LIBTOOL=//'`
34 DSOARCHIVE_BASENAME=`basename $2`
36 DSOBASE=`echo $DSOARCHIVE_BASENAME | sed -e 's/\.la$//'`
37 TARGET_NAME="$DSOBASE.so"
41 if test "$SYS" = "AIX"
43 # on AIX, shared libraries remain in storage even when
44 # all processes using them have exited; standard practice
45 # prior to installing a shared library is to rm -f first
46 CMD="rm -f $TARGETDIR/$TARGET_NAME"
51 CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR/"
55 if test "$SYS" = "OS/2"
57 # on OS/2, aplibtool --install doesn't copy the .la files & we can't
58 # rename DLLs to have a .so extension or they won't load so none of the
59 # steps below make sense.
63 DLNAME=`grep "^dlname" $TARGETDIR/$DSOARCHIVE_BASENAME | sed -e "s/dlname='\([^']*\)'/\1/"`
64 LIBRARY_NAMES=`grep "library_names" $TARGETDIR/$DSOARCHIVE_BASENAME | sed -e "s/dlname='\([^']*\)'/\1/"`
65 LIBRARY_NAMES=`echo $LIBRARY_NAMES | sed -e "s/ *$DLNAME//g"`
69 echo "Warning! dlname not found in $TARGETDIR/$DSOARCHIVE_BASENAME."
70 echo "Assuming installing a .so rather than a libtool archive."
74 if test -n "$LIBRARY_NAMES"
76 for f in $LIBRARY_NAMES
82 if test "$DLNAME" != "$TARGET_NAME"
84 mv $TARGETDIR/$DLNAME $TARGETDIR/$TARGET_NAME
87 rm -f $TARGETDIR/$DSOARCHIVE_BASENAME
88 rm -f $TARGETDIR/$DSOBASE.a
89 rm -f $TARGETDIR/lib$DSOBASE.a
90 rm -f $TARGETDIR/lib$TARGET_NAME