]> granicus.if.org Git - apache/blob - build/instdso.sh
Fix --with-apr=/usr and/or --with-apr-util=/usr.
[apache] / build / instdso.sh
1 #!/bin/sh
2 #
3 # Copyright 2001-2004 The Apache Software Foundation
4 #
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
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
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.
16 #
17 #
18 # instdso.sh - install Apache DSO modules
19 #
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
25
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"
29     exit 1
30 fi
31
32 SH_LIBTOOL=`echo $1 | sed -e 's/^SH_LIBTOOL=//'`
33 DSOARCHIVE=$2
34 DSOARCHIVE_BASENAME=`basename $2`
35 TARGETDIR=$3
36 DSOBASE=`echo $DSOARCHIVE_BASENAME | sed -e 's/\.la$//'`
37 TARGET_NAME="$DSOBASE.so"
38
39 SYS=`uname -s`
40
41 if test "$SYS" = "AIX"
42 then
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"
47     echo $CMD
48     $CMD || exit $?
49 fi
50
51 CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR/"
52 echo $CMD
53 $CMD || exit $?
54
55 if test "$SYS" = "OS/2"
56 then
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.
60     exit 0
61 fi
62
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"`
66
67 if test -z "$DLNAME"
68 then
69   echo "Warning!  dlname not found in $TARGETDIR/$DSOARCHIVE_BASENAME."
70   echo "Assuming installing a .so rather than a libtool archive."
71   exit 0
72 fi
73
74 if test -n "$LIBRARY_NAMES"
75 then
76     for f in $LIBRARY_NAMES
77     do
78         rm -f $TARGETDIR/$f
79     done
80 fi
81
82 if test "$DLNAME" != "$TARGET_NAME"
83 then
84     mv $TARGETDIR/$DLNAME $TARGETDIR/$TARGET_NAME
85 fi
86
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
91
92 exit 0