Sync readline/ to version 7.0 alpha
[deliverable/binutils-gdb.git] / readline / support / shlib-install
index e43a7c0935fba0af6aac2eb647beb58d493e750c..cfec3bd1e62e46e1b6ab4591fc506bdad1580803 100755 (executable)
@@ -3,7 +3,7 @@
 # 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
+# usage: shlib-install [-D] -O host_os [-V host_vendor] -d installation-dir [-b bin-dir] -i install-prog [-U] library
 #
 # Chet Ramey
 # chet@po.cwru.edu
@@ -15,14 +15,16 @@ INSTALLDIR=/usr/local/lib
 LDCONFIG=ldconfig
 
 PROGNAME=`basename $0`
-USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library"
+USAGE="$PROGNAME [-D] -O host_os [-V host_vendor] -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 ;;
+       -V)     shift; host_vendor="$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 ;;
@@ -49,7 +51,7 @@ LN="ln -s"
 if [ -z "$uninstall" ]; then
        ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
        if [ -f "$INSTALLDIR/$LIBNAME" ]; then
-               ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
+               ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
        fi
 fi
 
@@ -63,6 +65,36 @@ 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.  Solaris doesn't seem to mind,
+# but ldd still 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*|solaris2*)
+       if [ -z "$uninstall" ]; then
+               chmod 555 ${INSTALLDIR}/${LIBNAME}
+       fi ;;
+cygwin*|mingw*)
+       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
@@ -71,33 +103,102 @@ case "$LIBNAME" in
 *.*.[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*|bsdi4*)
+case "$host_os-$host_vendor" in
+*linux*|freebsd*-gentoo)
+       # 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*|netbsd*|mirbsd*)
        # libname.so.M -> libname.so.M.N
        ${echo} ${RM} ${INSTALLDIR}/$LINK2
        if [ -z "$uninstall" ]; then
-               ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
+               eval $INSTALL_LINK2
        fi
 
        # libname.so -> libname.so.M.N
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
        if [ -z "$uninstall" ]; then
-               ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
+               eval $INSTALL_LINK1
+       fi
+       ;;
+
+solaris2*|aix4.[2-9]*|aix[5-9]*|osf*|irix[56]*|sysv[45]*|dgux*|interix*)
+       # libname.so -> libname.so.M
+       ${echo} ${RM} ${INSTALLDIR}/$LINK1
+       if [ -z "$uninstall" ]; then
+               eval $INSTALL_LINK1
        fi
        ;;
 
-solaris2*|aix4.[2-9]*|hpux1*)
+
+# FreeBSD 3.x and above can have either a.out or ELF shared libraries
+freebsd3*|freebsdaout*)
+       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
+       ;;
+
+freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*)
        # libname.so -> libname.so.M
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
        if [ -z "$uninstall" ]; then
-               ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
+               eval $INSTALL_LINK1
        fi
        ;;
+       
+hpux1*)
+       # libname.sl -> libname.M
+       ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
+       if [ -z "$uninstall" ]; then
+               eval $INSTALL_LINK1
+       fi
+       ;;
+
+cygwin*|mingw*)
+       # 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
This page took 0.028799 seconds and 4 git commands to generate.