head	1.1;
branch	1.1.1;
access;
symbols
	RELENG_8_4:1.1.1.7.0.30
	RELENG_9_1_0_RELEASE:1.1.1.7
	RELENG_9_1:1.1.1.7.0.28
	RELENG_9_1_BP:1.1.1.7
	RELENG_8_3_0_RELEASE:1.1.1.7
	RELENG_8_3:1.1.1.7.0.26
	RELENG_8_3_BP:1.1.1.7
	RELENG_9_0_0_RELEASE:1.1.1.7
	RELENG_9_0:1.1.1.7.0.24
	RELENG_9_0_BP:1.1.1.7
	RELENG_9:1.1.1.7.0.22
	RELENG_9_BP:1.1.1.7
	RELENG_7_4_0_RELEASE:1.1.1.7
	RELENG_8_2_0_RELEASE:1.1.1.7
	RELENG_7_4:1.1.1.7.0.20
	RELENG_7_4_BP:1.1.1.7
	RELENG_8_2:1.1.1.7.0.18
	RELENG_8_2_BP:1.1.1.7
	RELENG_8_1_0_RELEASE:1.1.1.7
	RELENG_8_1:1.1.1.7.0.16
	RELENG_8_1_BP:1.1.1.7
	RELENG_7_3_0_RELEASE:1.1.1.7
	RELENG_7_3:1.1.1.7.0.14
	RELENG_7_3_BP:1.1.1.7
	RELENG_8_0_0_RELEASE:1.1.1.7
	RELENG_8_0:1.1.1.7.0.12
	RELENG_8_0_BP:1.1.1.7
	RELENG_8:1.1.1.7.0.10
	RELENG_8_BP:1.1.1.7
	RELENG_7_2_0_RELEASE:1.1.1.7
	RELENG_7_2:1.1.1.7.0.8
	RELENG_7_2_BP:1.1.1.7
	RELENG_7_1_0_RELEASE:1.1.1.7
	RELENG_6_4_0_RELEASE:1.1.1.5.2.1
	RELENG_7_1:1.1.1.7.0.6
	RELENG_7_1_BP:1.1.1.7
	RELENG_6_4:1.1.1.5.2.1.0.4
	RELENG_6_4_BP:1.1.1.5.2.1
	RELENG_7_0_0_RELEASE:1.1.1.7
	RELENG_6_3_0_RELEASE:1.1.1.5.2.1
	RELENG_7_0:1.1.1.7.0.4
	RELENG_7_0_BP:1.1.1.7
	RELENG_6_3:1.1.1.5.2.1.0.2
	RELENG_6_3_BP:1.1.1.5.2.1
	RELENG_7:1.1.1.7.0.2
	RELENG_7_BP:1.1.1.7
	RELENG_6_2_0_RELEASE:1.1.1.5
	v5_2:1.1.1.7
	RELENG_6_2:1.1.1.5.0.8
	RELENG_6_2_BP:1.1.1.5
	RELENG_5_5_0_RELEASE:1.1.1.4
	RELENG_5_5:1.1.1.4.0.10
	RELENG_5_5_BP:1.1.1.4
	RELENG_6_1_0_RELEASE:1.1.1.5
	RELENG_6_1:1.1.1.5.0.6
	RELENG_6_1_BP:1.1.1.5
	v5_1:1.1.1.6
	RELENG_6_0_0_RELEASE:1.1.1.5
	RELENG_6_0:1.1.1.5.0.4
	RELENG_6_0_BP:1.1.1.5
	RELENG_6:1.1.1.5.0.2
	RELENG_6_BP:1.1.1.5
	RELENG_5_4_0_RELEASE:1.1.1.4
	RELENG_5_4:1.1.1.4.0.8
	RELENG_5_4_BP:1.1.1.4
	RELENG_4_11_0_RELEASE:1.1.1.1.4.1
	RELENG_4_11:1.1.1.1.4.1.0.18
	RELENG_4_11_BP:1.1.1.1.4.1
	RELENG_5_3_0_RELEASE:1.1.1.4
	v5_0:1.1.1.5
	RELENG_5_3:1.1.1.4.0.6
	RELENG_5_3_BP:1.1.1.4
	RELENG_5:1.1.1.4.0.4
	RELENG_5_BP:1.1.1.4
	RELENG_4_10_0_RELEASE:1.1.1.1.4.1
	RELENG_4_10:1.1.1.1.4.1.0.16
	RELENG_4_10_BP:1.1.1.1.4.1
	RELENG_5_2_1_RELEASE:1.1.1.4
	RELENG_5_2_0_RELEASE:1.1.1.4
	RELENG_5_2:1.1.1.4.0.2
	RELENG_5_2_BP:1.1.1.4
	RELENG_4_9_0_RELEASE:1.1.1.1.4.1
	RELENG_4_9:1.1.1.1.4.1.0.14
	RELENG_4_9_BP:1.1.1.1.4.1
	v4_3:1.1.1.4
	RELENG_5_1_0_RELEASE:1.1.1.3
	RELENG_5_1:1.1.1.3.0.4
	RELENG_5_1_BP:1.1.1.3
	RELENG_4_8_0_RELEASE:1.1.1.1.4.1
	RELENG_4_8:1.1.1.1.4.1.0.12
	RELENG_4_8_BP:1.1.1.1.4.1
	RELENG_5_0_0_RELEASE:1.1.1.3
	RELENG_5_0:1.1.1.3.0.2
	RELENG_5_0_BP:1.1.1.3
	RELENG_4_7_0_RELEASE:1.1.1.1.4.1
	RELENG_4_7:1.1.1.1.4.1.0.10
	RELENG_4_7_BP:1.1.1.1.4.1
	RELENG_4_6_2_RELEASE:1.1.1.1.4.1
	RELENG_4_6_1_RELEASE:1.1.1.1.4.1
	RELENG_4_6_0_RELEASE:1.1.1.1.4.1
	RELENG_4_6:1.1.1.1.4.1.0.8
	RELENG_4_6_BP:1.1.1.1.4.1
	RELENG_4_5_0_RELEASE:1.1.1.1.4.1
	RELENG_4_5:1.1.1.1.4.1.0.6
	RELENG_4_5_BP:1.1.1.1.4.1
	RELENG_4_4_0_RELEASE:1.1.1.1.4.1
	RELENG_4_4:1.1.1.1.4.1.0.4
	RELENG_4_4_BP:1.1.1.1.4.1
	RELENG_4_3_0_RELEASE:1.1.1.1.4.1
	RELENG_4_3:1.1.1.1.4.1.0.2
	RELENG_4_3_BP:1.1.1.1.4.1
	v4_2:1.1.1.3
	RELENG_4_2_0_RELEASE:1.1.1.1.4.1
	RELENG_4_1_1_RELEASE:1.1.1.1.4.1
	PRE_SMPNG:1.1.1.2
	RELENG_4_1_0_RELEASE:1.1.1.1.4.1
	RELENG_3_5_0_RELEASE:1.1.1.1.2.1
	v4_1:1.1.1.2
	RELENG_4_0_0_RELEASE:1.1.1.1
	RELENG_4:1.1.1.1.0.4
	RELENG_4_BP:1.1.1.1
	RELENG_3_4_0_RELEASE:1.1.1.1.2.1
	RELENG_3_3_0_RELEASE:1.1.1.1.2.1
	RELENG_3:1.1.1.1.0.2
	v4_0:1.1.1.1
	FSF:1.1.1;
locks; strict;
comment	@# @;


1.1
date	99.05.28.01.59.23;	author ache;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	99.05.28.01.59.23;	author ache;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.4.1;
next	1.1.1.2;

1.1.1.2
date	2000.03.19.21.18.09;	author ache;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2001.04.11.02.33.07;	author ache;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2003.08.31.17.55.46;	author ache;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2004.10.18.07.02.42;	author ache;	state Exp;
branches
	1.1.1.5.2.1;
next	1.1.1.6;

1.1.1.6
date	2006.03.27.22.47.12;	author ache;	state Exp;
branches;
next	1.1.1.7;

1.1.1.7
date	2006.12.31.09.06.30;	author ache;	state Exp;
branches
	1.1.1.7.30.1;
next	;

1.1.1.1.2.1
date	99.08.18.19.15.42;	author obrien;	state Exp;
branches;
next	;

1.1.1.1.4.1
date	2000.07.06.23.04.36;	author ache;	state Exp;
branches;
next	;

1.1.1.5.2.1
date	2007.04.17.03.23.14;	author rafan;	state Exp;
branches;
next	;

1.1.1.7.30.1
date	2006.12.31.09.06.30;	author svnexp;	state dead;
branches;
next	1.1.1.7.30.2;

1.1.1.7.30.2
date	2013.03.28.13.01.31;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@#! /bin/sh
#
# shlib-install - install a shared library and do any necessary host-specific
#		  post-installation configuration (like ldconfig)
#
# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library
#
# Chet Ramey
# chet@@po.cwru.edu

#
# defaults
#
INSTALLDIR=/usr/local/lib
LDCONFIG=ldconfig

PROGNAME=`basename $0`
USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library"

# process options

while [ $# -gt 0 ]; do
	case "$1" in
	-O)	shift; host_os="$1"; shift ;;
	-d)	shift; INSTALLDIR="$1"; shift ;;
	-i)	shift; INSTALLPROG="$1" ; shift ;;
	-D)	echo=echo ; shift ;;
	-U)	uninstall=true ; shift ;;
	-*)	echo "$USAGE" >&2 ; exit 2;;
	*)	break ;;
	esac
done

# set install target name
LIBNAME="$1"

if [ -z "$LIBNAME" ]; then
	echo "$USAGE" >&2
	exit 2
fi

OLDSUFF=old
MV=mv
RM="rm -f"
LN="ln -s"

# pre-install

if [ -z "$uninstall" ]; then
	${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
	if [ -f "$INSTALLDIR/$LIBNAME" ]; then
		${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
	fi
fi

# install/uninstall

if [ -z "$uninstall" ] ; then
	${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
else
	${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
fi

# post-install/uninstall

case "$LIBNAME" in
*.*.[0-9].[0-9])	# libname.so.M.N
	LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'`	# libname.so.M
	LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'`	# libname.so
	;;
*.*.[0-9])		# libname.so.M
	LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'`		# libname.so
	;;
esac

#
# Create symlinks to the installed library.  This section is incomplete.
#
case "$host_os" in
*linux*|bsdi4*)
	# libname.so.M -> libname.so.M.N
	${echo} ${RM} ${INSTALLDIR}/$LINK2
	if [ -z "$uninstall" ]; then
		${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
	fi

	# libname.so -> libname.so.M.N
	${echo} ${RM} ${INSTALLDIR}/$LINK1
	if [ -z "$uninstall" ]; then
		${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
	fi
	;;

solaris2*|aix4.[2-9]*|hpux1*)
	# libname.so -> libname.so.M
	${echo} ${RM} ${INSTALLDIR}/$LINK1
	if [ -z "$uninstall" ]; then
		${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
	fi
	;;

*)	;;
esac

exit 0
@


1.1.1.1
log
@readline v4.0
@
text
@@


1.1.1.1.4.1
log
@MFC: upgrade to 4.1
@
text
@d52 1
a52 1
		${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
a65 8
# HP-UX requires that a shared library have execute permission
case "$host_os" in
hpux*)	if [ -z "$uninstall" ]; then
		chmod 755 ${INSTALLDIR}/${LIBNAME}
	fi ;;
*)	;;
esac

a73 3
*.[0-9])		# libname.M
	LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'`		# libname
	;;
d94 1
a94 1
solaris2*|aix4.[2-9]*|osf*|irix[56]*)
a98 32
	fi
	;;


# FreeBSD 3.x can have either a.out or ELF shared libraries
freebsd3*)
	if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
		# libname.so -> libname.so.M
		${echo} ${RM} ${INSTALLDIR}/$LINK1
		if [ -z "$uninstall" ]; then
			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
		fi
	else
		# libname.so.M -> libname.so.M.N
		${echo} ${RM} ${INSTALLDIR}/$LINK2
		if [ -z "$uninstall" ]; then
			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
		fi

		# libname.so -> libname.so.M.N
		${echo} ${RM} ${INSTALLDIR}/$LINK1
		if [ -z "$uninstall" ]; then
			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
		fi
	fi
	;;

hpux1*)
	# libname.sl -> libname.M
	${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
	if [ -z "$uninstall" ]; then
		${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl
@


1.1.1.2
log
@Initial import of v4.1
@
text
@d52 1
a52 1
		${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
a65 8
# HP-UX requires that a shared library have execute permission
case "$host_os" in
hpux*)	if [ -z "$uninstall" ]; then
		chmod 755 ${INSTALLDIR}/${LIBNAME}
	fi ;;
*)	;;
esac

a73 3
*.[0-9])		# libname.M
	LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'`		# libname
	;;
d94 1
a94 1
solaris2*|aix4.[2-9]*|osf*|irix[56]*)
a98 32
	fi
	;;


# FreeBSD 3.x can have either a.out or ELF shared libraries
freebsd3*)
	if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
		# libname.so -> libname.so.M
		${echo} ${RM} ${INSTALLDIR}/$LINK1
		if [ -z "$uninstall" ]; then
			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
		fi
	else
		# libname.so.M -> libname.so.M.N
		${echo} ${RM} ${INSTALLDIR}/$LINK2
		if [ -z "$uninstall" ]; then
			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
		fi

		# libname.so -> libname.so.M.N
		${echo} ${RM} ${INSTALLDIR}/$LINK1
		if [ -z "$uninstall" ]; then
			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
		fi
	fi
	;;

hpux1*)
	# libname.sl -> libname.M
	${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
	if [ -z "$uninstall" ]; then
		${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl
@


1.1.1.3
log
@v4.2 initial import
@
text
@d69 1
a69 1
		chmod 555 ${INSTALLDIR}/${LIBNAME}
a86 3
INSTALL_LINK1='cd $INSTALLDIR ; ln -s $LIBNAME $LINK1'
INSTALL_LINK2='cd $INSTALLDIR ; ln -s $LIBNAME $LINK2'

d95 1
a95 1
		${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK2
d101 1
a101 1
		${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
d109 1
a109 1
		${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
d120 1
a120 1
			${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
d126 1
a126 1
			${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK2
d132 1
a132 1
			${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
d141 1
a141 2
#		${echo} ln -s $LIBNAME ${INSTALLDIR}/${LINK1}.sl
		${echo} ln -s $LIBNAME ${INSTALLDIR}/${LINK1}
@


1.1.1.4
log
@Virgin import of GNU Readline 4.3
@
text
@d66 1
a66 1
# HP-UX and Darwin/MacOS X require that a shared library have execute permission
d68 1
a68 2
hpux*|darwin*|macosx*)
	if [ -z "$uninstall" ]; then
a84 3
*.[0-9].[0-9].dylib)	# libname.M.N.dylib
	LINK2=`echo $LIBNAME | sed 's:\(.*\.[0-9]\)\.[0-9]:\1:'`	# libname.M.dylib
	LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]\.[0-9]:\1:'`	# libname.dylib
d94 1
a94 1
*linux*|bsdi4*|*gnu*|darwin*|macosx*)
d108 1
a108 1
solaris2*|aix4.[2-9]*|osf*|irix[56]*|sysv[45]*|dgux*)
d117 2
a118 2
# FreeBSD 3.x and above can have either a.out or ELF shared libraries
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*)
@


1.1.1.5
log
@Virgin import of GNU Readline 5.0
@
text
@d91 2
a92 2
INSTALL_LINK1='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
INSTALL_LINK2='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
d98 1
a98 1
*linux*)
d102 1
a102 15
		eval $INSTALL_LINK2
	fi

	# libname.so -> libname.so.M
	${echo} ${RM} ${INSTALLDIR}/$LINK1
	if [ -z "$uninstall" ]; then
		${echo} cd $INSTALLDIR && ${echo} ${LN} $LINK2 $LINK1
	fi
	;;

bsdi4*|*gnu*|darwin*|macosx*|k*bsd*-gnu)
	# libname.so.M -> libname.so.M.N
	${echo} ${RM} ${INSTALLDIR}/$LINK2
	if [ -z "$uninstall" ]; then
		eval $INSTALL_LINK2
d108 1
a108 1
		eval $INSTALL_LINK1
d116 1
a116 1
		eval $INSTALL_LINK1
d127 1
a127 1
			eval $INSTALL_LINK1
d133 1
a133 1
			eval $INSTALL_LINK2
d139 1
a139 1
			eval $INSTALL_LINK1
d148 2
a149 1
		eval $INSTALL_LINK1
@


1.1.1.5.2.1
log
@MFC readline 5.2 patchset 002

Approved by:	delphij (mentor)
OKed by:	ache
@
text
@d6 1
a6 1
# usage: shlib-install [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library
d18 1
a18 1
USAGE="$PROGNAME [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library"
a25 1
	-b)	shift; BINDIR="$1" ; shift ;;
a66 3
# Linux does, too, and ldd warns about it
# Cygwin installs both a dll (which must go in $BINDIR) and an implicit
# link library (in $libdir)
d68 1
a68 1
hpux*|darwin*|macosx*|linux*)
a71 17
cygwin*)
	IMPLIBNAME=`echo ${LIBNAME} \
		| sed -e 's,^cyg,lib,' -e 's,[0-9]*.dll$,.dll.a,'`
	if [ -z "$uninstall" ]; then
		${echo} $RM ${BINDIR}/${LIBNAME}.${OLDSUFF}
		if [ -f "$BINDIR/$LIBNAME" ]; then
			${echo} $MV $BINDIR/$LIBNAME $BINDIR/$LIBNAME.$OLDSUFF
		fi
		${echo} $MV ${INSTALLDIR}/${LIBNAME} ${BINDIR}/${LIBNAME}
		${echo} chmod a+x ${BINDIR}/${LIBNAME}
		${echo} eval ${INSTALLPROG} ${LIBNAME}.a \
			${INSTALLDIR}/${IMPLIBNAME}
	else
		${echo} ${RM} ${BINDIR}/${LIBNAME}
		${echo} ${RM} ${INSTALLDIR}/${IMPLIBNAME}
	fi ;;

a165 6
cygwin*)
	# Links to .dlls don't work.  Hence shobj-conf used DLLVERSION.dll
	# instead of so.SHLIB_MAJOR.SHLIB_MINOR.  The postinstall above
	# took care of everything else.
	;;

@


1.1.1.6
log
@Virgin import of GNU Readline 5.1
@
text
@d6 1
a6 1
# usage: shlib-install [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library
d18 1
a18 1
USAGE="$PROGNAME [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library"
a25 1
	-b)	shift; BINDIR="$1" ; shift ;;
a66 2
# Cygwin installs both a dll (which must go in $BINDIR) and an implicit
# link library (in $libdir)
a71 17
cygwin*)
	IMPLIBNAME=`echo ${LIBNAME} \
		| sed -e 's,^cyg,lib,' -e 's,[0-9]*.dll$,.dll.a,'`
	if [ -z "$uninstall" ]; then
		${echo} $RM ${BINDIR}/${LIBNAME}.${OLDSUFF}
		if [ -f "$BINDIR/$LIBNAME" ]; then
			${echo} $MV $BINDIR/$LIBNAME $BINDIR/$LIBNAME.$OLDSUFF
		fi
		${echo} $MV ${INSTALLDIR}/${LIBNAME} ${BINDIR}/${LIBNAME}
		${echo} chmod a+x ${BINDIR}/${LIBNAME}
		${echo} eval ${INSTALLPROG} ${LIBNAME}.a \
			${INSTALLDIR}/${IMPLIBNAME}
	else
		${echo} ${RM} ${BINDIR}/${LIBNAME}
		${echo} ${RM} ${INSTALLDIR}/${IMPLIBNAME}
	fi ;;

a165 6
cygwin*)
	# Links to .dlls don't work.  Hence shobj-conf used DLLVERSION.dll
	# instead of so.SHLIB_MAJOR.SHLIB_MINOR.  The postinstall above
	# took care of everything else.
	;;

@


1.1.1.7
log
@Virgin import of GNU Readline 5.2
@
text
@a67 1
# Linux does, too, and ldd warns about it
d71 1
a71 1
hpux*|darwin*|macosx*|linux*)
@


1.1.1.7.30.1
log
@file shlib-install was added on branch RELENG_8_4 on 2013-03-28 13:01:31 +0000
@
text
@d1 196
@


1.1.1.7.30.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 196
#! /bin/sh
#
# shlib-install - install a shared library and do any necessary host-specific
#		  post-installation configuration (like ldconfig)
#
# usage: shlib-install [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library
#
# Chet Ramey
# chet@@po.cwru.edu

#
# defaults
#
INSTALLDIR=/usr/local/lib
LDCONFIG=ldconfig

PROGNAME=`basename $0`
USAGE="$PROGNAME [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library"

# process options

while [ $# -gt 0 ]; do
	case "$1" in
	-O)	shift; host_os="$1"; shift ;;
	-d)	shift; INSTALLDIR="$1"; shift ;;
	-b)	shift; BINDIR="$1" ; shift ;;
	-i)	shift; INSTALLPROG="$1" ; shift ;;
	-D)	echo=echo ; shift ;;
	-U)	uninstall=true ; shift ;;
	-*)	echo "$USAGE" >&2 ; exit 2;;
	*)	break ;;
	esac
done

# set install target name
LIBNAME="$1"

if [ -z "$LIBNAME" ]; then
	echo "$USAGE" >&2
	exit 2
fi

OLDSUFF=old
MV=mv
RM="rm -f"
LN="ln -s"

# pre-install

if [ -z "$uninstall" ]; then
	${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
	if [ -f "$INSTALLDIR/$LIBNAME" ]; then
		${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
	fi
fi

# install/uninstall

if [ -z "$uninstall" ] ; then
	${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
else
	${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
fi

# post-install/uninstall

# HP-UX and Darwin/MacOS X require that a shared library have execute permission
# Linux does, too, and ldd warns about it
# Cygwin installs both a dll (which must go in $BINDIR) and an implicit
# link library (in $libdir)
case "$host_os" in
hpux*|darwin*|macosx*|linux*)
	if [ -z "$uninstall" ]; then
		chmod 555 ${INSTALLDIR}/${LIBNAME}
	fi ;;
cygwin*)
	IMPLIBNAME=`echo ${LIBNAME} \
		| sed -e 's,^cyg,lib,' -e 's,[0-9]*.dll$,.dll.a,'`
	if [ -z "$uninstall" ]; then
		${echo} $RM ${BINDIR}/${LIBNAME}.${OLDSUFF}
		if [ -f "$BINDIR/$LIBNAME" ]; then
			${echo} $MV $BINDIR/$LIBNAME $BINDIR/$LIBNAME.$OLDSUFF
		fi
		${echo} $MV ${INSTALLDIR}/${LIBNAME} ${BINDIR}/${LIBNAME}
		${echo} chmod a+x ${BINDIR}/${LIBNAME}
		${echo} eval ${INSTALLPROG} ${LIBNAME}.a \
			${INSTALLDIR}/${IMPLIBNAME}
	else
		${echo} ${RM} ${BINDIR}/${LIBNAME}
		${echo} ${RM} ${INSTALLDIR}/${IMPLIBNAME}
	fi ;;

*)	;;
esac

case "$LIBNAME" in
*.*.[0-9].[0-9])	# libname.so.M.N
	LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'`	# libname.so.M
	LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'`	# libname.so
	;;
*.*.[0-9])		# libname.so.M
	LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'`		# libname.so
	;;
*.[0-9])		# libname.M
	LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'`		# libname
	;;
*.[0-9].[0-9].dylib)	# libname.M.N.dylib
	LINK2=`echo $LIBNAME | sed 's:\(.*\.[0-9]\)\.[0-9]:\1:'`	# libname.M.dylib
	LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]\.[0-9]:\1:'`	# libname.dylib
esac

INSTALL_LINK1='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
INSTALL_LINK2='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'

#
# Create symlinks to the installed library.  This section is incomplete.
#
case "$host_os" in
*linux*)
	# libname.so.M -> libname.so.M.N
	${echo} ${RM} ${INSTALLDIR}/$LINK2
	if [ -z "$uninstall" ]; then
		eval $INSTALL_LINK2
	fi

	# libname.so -> libname.so.M
	${echo} ${RM} ${INSTALLDIR}/$LINK1
	if [ -z "$uninstall" ]; then
		${echo} cd $INSTALLDIR && ${echo} ${LN} $LINK2 $LINK1
	fi
	;;

bsdi4*|*gnu*|darwin*|macosx*|k*bsd*-gnu)
	# libname.so.M -> libname.so.M.N
	${echo} ${RM} ${INSTALLDIR}/$LINK2
	if [ -z "$uninstall" ]; then
		eval $INSTALL_LINK2
	fi

	# libname.so -> libname.so.M.N
	${echo} ${RM} ${INSTALLDIR}/$LINK1
	if [ -z "$uninstall" ]; then
		eval $INSTALL_LINK1
	fi
	;;

solaris2*|aix4.[2-9]*|osf*|irix[56]*|sysv[45]*|dgux*)
	# libname.so -> libname.so.M
	${echo} ${RM} ${INSTALLDIR}/$LINK1
	if [ -z "$uninstall" ]; then
		eval $INSTALL_LINK1
	fi
	;;


# FreeBSD 3.x and above can have either a.out or ELF shared libraries
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*)
	if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
		# libname.so -> libname.so.M
		${echo} ${RM} ${INSTALLDIR}/$LINK1
		if [ -z "$uninstall" ]; then
			eval $INSTALL_LINK1
		fi
	else
		# libname.so.M -> libname.so.M.N
		${echo} ${RM} ${INSTALLDIR}/$LINK2
		if [ -z "$uninstall" ]; then
			eval $INSTALL_LINK2
		fi

		# libname.so -> libname.so.M.N
		${echo} ${RM} ${INSTALLDIR}/$LINK1
		if [ -z "$uninstall" ]; then
			eval $INSTALL_LINK1
		fi
	fi
	;;

hpux1*)
	# libname.sl -> libname.M
	${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
	if [ -z "$uninstall" ]; then
		eval $INSTALL_LINK1
	fi
	;;

cygwin*)
	# Links to .dlls don't work.  Hence shobj-conf used DLLVERSION.dll
	# instead of so.SHLIB_MAJOR.SHLIB_MINOR.  The postinstall above
	# took care of everything else.
	;;

*)	;;
esac

exit 0
@


1.1.1.1.2.1
log
@MFC: upgrade to readline-4.0.
@
text
@@

