Dummy commit. Get CVS off the branch.
[deliverable/binutils-gdb.git] / readline / support / shlib-install
CommitLineData
c862e87b
JM
1#! /bin/sh
2#
3# shlib-install - install a shared library and do any necessary host-specific
4# post-installation configuration (like ldconfig)
5#
6# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library
7#
8# Chet Ramey
9# chet@po.cwru.edu
10
11#
12# defaults
13#
14INSTALLDIR=/usr/local/lib
15LDCONFIG=ldconfig
16
17PROGNAME=`basename $0`
18USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library"
19
20# process options
21
22while [ $# -gt 0 ]; do
23 case "$1" in
24 -O) shift; host_os="$1"; shift ;;
25 -d) shift; INSTALLDIR="$1"; shift ;;
26 -i) shift; INSTALLPROG="$1" ; shift ;;
27 -D) echo=echo ; shift ;;
28 -U) uninstall=true ; shift ;;
29 -*) echo "$USAGE" >&2 ; exit 2;;
30 *) break ;;
31 esac
32done
33
34# set install target name
35LIBNAME="$1"
36
37if [ -z "$LIBNAME" ]; then
38 echo "$USAGE" >&2
39 exit 2
40fi
41
42OLDSUFF=old
43MV=mv
44RM="rm -f"
45LN="ln -s"
46
47# pre-install
48
49if [ -z "$uninstall" ]; then
50 ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
51 if [ -f "$INSTALLDIR/$LIBNAME" ]; then
1b17e766 52 ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
c862e87b
JM
53 fi
54fi
55
56# install/uninstall
57
58if [ -z "$uninstall" ] ; then
59 ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
60else
61 ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
62fi
63
64# post-install/uninstall
65
1b17e766
EZ
66# HP-UX requires that a shared library have execute permission
67case "$host_os" in
68hpux*) if [ -z "$uninstall" ]; then
69 chmod 755 ${INSTALLDIR}/${LIBNAME}
70 fi ;;
71*) ;;
72esac
73
c862e87b
JM
74case "$LIBNAME" in
75*.*.[0-9].[0-9]) # libname.so.M.N
76 LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'` # libname.so.M
77 LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'` # libname.so
78 ;;
79*.*.[0-9]) # libname.so.M
80 LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so
81 ;;
1b17e766
EZ
82*.[0-9]) # libname.M
83 LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'` # libname
84 ;;
c862e87b
JM
85esac
86
87#
88# Create symlinks to the installed library. This section is incomplete.
89#
90case "$host_os" in
91*linux*|bsdi4*)
92 # libname.so.M -> libname.so.M.N
93 ${echo} ${RM} ${INSTALLDIR}/$LINK2
94 if [ -z "$uninstall" ]; then
95 ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
96 fi
97
98 # libname.so -> libname.so.M.N
99 ${echo} ${RM} ${INSTALLDIR}/$LINK1
100 if [ -z "$uninstall" ]; then
101 ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
102 fi
103 ;;
104
1b17e766 105solaris2*|aix4.[2-9]*|osf*|irix[56]*)
c862e87b
JM
106 # libname.so -> libname.so.M
107 ${echo} ${RM} ${INSTALLDIR}/$LINK1
108 if [ -z "$uninstall" ]; then
109 ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
110 fi
111 ;;
112
1b17e766
EZ
113
114# FreeBSD 3.x can have either a.out or ELF shared libraries
115freebsd3*)
116 if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
117 # libname.so -> libname.so.M
118 ${echo} ${RM} ${INSTALLDIR}/$LINK1
119 if [ -z "$uninstall" ]; then
120 ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
121 fi
122 else
123 # libname.so.M -> libname.so.M.N
124 ${echo} ${RM} ${INSTALLDIR}/$LINK2
125 if [ -z "$uninstall" ]; then
126 ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
127 fi
128
129 # libname.so -> libname.so.M.N
130 ${echo} ${RM} ${INSTALLDIR}/$LINK1
131 if [ -z "$uninstall" ]; then
132 ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
133 fi
134 fi
135 ;;
136
137hpux1*)
138 # libname.sl -> libname.M
139 ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
140 if [ -z "$uninstall" ]; then
141 ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl
142 fi
143 ;;
144
c862e87b
JM
145*) ;;
146esac
147
148exit 0
This page took 0.131203 seconds and 4 git commands to generate.