]> granicus.if.org Git - apache/blob - build/install.sh
Fix --with-apr=/usr and/or --with-apr-util=/usr.
[apache] / build / install.sh
1 #!/bin/sh
2 #
3 # Copyright 1999-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 # install.sh -- install a program, script or datafile
19 #
20 # Based on `install-sh' from the X Consortium's X11R5 distribution
21 # as of 89/12/18 which is freely available.
22 # Cleaned up for Apache's Autoconf-style Interface (APACI)
23 # by Ralf S. Engelschall <rse apache.org>
24
25 #
26 #   put in absolute paths if you don't have them in your path; 
27 #   or use env. vars.
28 #
29 mvprog="${MVPROG-mv}"
30 cpprog="${CPPROG-cp}"
31 chmodprog="${CHMODPROG-chmod}"
32 chownprog="${CHOWNPROG-chown}"
33 chgrpprog="${CHGRPPROG-chgrp}"
34 stripprog="${STRIPPROG-strip}"
35 rmprog="${RMPROG-rm}"
36
37 #
38 #   parse argument line
39 #
40 instcmd="$mvprog"
41 chmodcmd=""
42 chowncmd=""
43 chgrpcmd=""
44 stripcmd=""
45 rmcmd="$rmprog -f"
46 mvcmd="$mvprog"
47 ext=""
48 src=""
49 dst=""
50 while [ "x$1" != "x" ]; do
51     case $1 in
52         -c) instcmd="$cpprog"
53             shift; continue
54             ;;
55         -m) chmodcmd="$chmodprog $2"
56             shift; shift; continue
57             ;;
58         -o) chowncmd="$chownprog $2"
59             shift; shift; continue
60             ;;
61         -g) chgrpcmd="$chgrpprog $2"
62             shift; shift; continue
63             ;;
64         -s) stripcmd="$stripprog"
65             shift; continue
66             ;;
67         -S) stripcmd="$stripprog $2"
68             shift; shift; continue
69             ;;
70         -e) ext="$2"
71             shift; shift; continue
72             ;;
73         *)  if [ "x$src" = "x" ]; then
74                 src=$1
75             else
76                 dst=$1
77             fi
78             shift; continue
79             ;;
80     esac
81 done
82 if [ "x$src" = "x" ]; then
83      echo "install.sh: no input file specified"
84      exit 1
85 fi
86 if [ "x$dst" = "x" ]; then
87      echo "install.sh: no destination specified"
88      exit 1
89 fi
90
91 #
92 #  If destination is a directory, append the input filename; if
93 #  your system does not like double slashes in filenames, you may
94 #  need to add some logic
95 #
96 if [ -d $dst ]; then
97     dst="$dst/`basename $src`"
98 fi
99
100 #  Add a possible extension (such as ".exe") to src and dst
101 src="$src$ext"
102 dst="$dst$ext"
103
104 #  Make a temp file name in the proper directory.
105 dstdir=`dirname $dst`
106 dsttmp=$dstdir/#inst.$$#
107
108 #  Move or copy the file name to the temp name
109 $instcmd $src $dsttmp
110
111 #  And set any options; do chmod last to preserve setuid bits
112 if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
113 if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
114 if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
115 if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
116
117 #  Now rename the file to the real destination.
118 $rmcmd $dst
119 $mvcmd $dsttmp $dst
120
121 exit 0
122