This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The URL for the dist source repo changed
[metaconfig.git] / U / modified / libs.U
index f284c8c..0c7451e 100644 (file)
@@ -1,7 +1,7 @@
 ?RCS: $Id: libs.U,v 3.0.1.6 1997/02/28 16:09:11 ram Exp $
 ?RCS:
 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
-?RCS: 
+?RCS:
 ?RCS: You may redistribute only under the terms of the Artistic Licence,
 ?RCS: as specified in the README file that comes with the distribution.
 ?RCS: You may reuse parts of this distribution only within the terms of
 ?RCS: Revision 3.0  1993/08/18  12:09:03  ram
 ?RCS: Baseline for dist 3.0 netwide release.
 ?RCS:
-?MAKE:libs ignore_versioned_solibs libsfound libsfiles libsdirs: \
+?MAKE:libs ignore_versioned_solibs libsfound libsfiles libsdirs libspath: \
        test cat Myread Oldconfig Loc libpth package xlibpth so _a \
-       usesocks ccflags
+       usesocks sed uselongdouble
 ?MAKE: -pick add $@ %<
 ?S:libs:
 ?S:    This variable holds the additional libraries we want to use.
-?S:    It is up to the Makefile to deal with it.
+?S:    It is up to the Makefile to deal with it.  The list can be empty.
 ?S:.
 ?S:libsfound:
 ?S:    This variable holds the full pathnames of the libraries
 ?S:    This variable holds the directory names aka dirnames of the libraries
 ?S:    we found and accepted, duplicates are removed.
 ?S:.
+?S:libspath:
+?S:    This variable holds the directory names probed for libraries.
+?S:.
 ?S:ignore_versioned_solibs:
 ?S:    This variable should be non-empty if non-versioned shared
 ?S:    libraries (libfoo.so.x.y) are to be ignored (because they
 ?S:    cannot be linked against).
 ?S:.
-?T:xxx yyy thislib libswanted libstyle libname
+?T:xxx yyy thislib thisdir libswanted libstyle
 ?D:libs=''
 ?X:
 ?X: This order is chosen so that libraries  -lndir, -ldir, -lucb, -lbsd,
 ?X: Set proper libswanted in your private Myinit.U if needed.
 ?X:
 ?X:: default ordered library list
-?X:libswanted='net socket inet nsl nm sdbm gdbm ndbm dbm malloc dl'
+?X:libswanted='net socket inet bind nsl nm sdbm gdbm ndbm dbm malloc dl'
 ?X:libswanted="$libswanted dld sun m c_s c posix cposix ndir dir ucb"
-?X:libswanted="$libswanted bsd BSD PW x iconv"
+?X:libswanted="$libswanted bsd BSD PW x"
 ?X:
 ?INIT:: default library list
 ?INIT:libswanted=''
 ?INIT:: some systems want to use only the non-versioned libso:s
 ?INIT:ignore_versioned_solibs=''
 ?LINT:extern libscheck
+?LINT:extern p
+?LINT:use uselongdouble
 : Looking for optional libraries
 echo " "
 echo "Checking for optional libraries..." >&4
@@ -96,63 +101,76 @@ esac
 case "$libswanted" in
 '') libswanted='c_s';;
 esac
-?X: libsocks has nasty naming.
+?X: libsocks has nasty naming scheme.
+?X: This does not work if somebody wants SOCKS 4.
 case "$usesocks" in
-$define)
-       libswanted="$libswanted socks5 socks5_sh"
-       ;;
+"$define") libswanted="$libswanted socks5 socks5_sh" ;;
 esac
+libsfound=''
+libsfiles=''
+libsdirs=''
+libspath=''
+for thisdir in $libpth $xlibpth; do
+  test -d $thisdir && libspath="$libspath $thisdir"
+done
 for thislib in $libswanted; do
-       
-?X:
-?X: Comparisons via case statement use the string " $dflt " to ensure that
-?X: each library is separated by a space. That way, by looking to something
-?X: like *"-l$thislib "*, we ensure we find -lm and not -lmalloc (which was
-?X: the case with the old looking pattern *-l$thislib*.
-?X:
-       libname="$thislib"
-       if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`
-          $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X" ; then
-               libstyle=shared
-       elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
-               libstyle=shared
-       elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
-               libstyle=static
-?X: Don't forget about OS/2 where -lmalloc is spelled out malloc.a
-       elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
-               libstyle=static
-       elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
-               libstyle=static
-               libname=${thislib}_s
-       elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
-               libstyle="static"
-       fi
-       if $test -f "$xxx"; then
-?X: If $xxx is not to be used as a library, $libscheck (set in
-?X: some hints file, most likely) should set the $xxx to a non-file.
-               eval $libscheck
-       fi
-       if $test -f "$xxx"; then
+       for thisdir in $libspath; do
+           xxx=''
+           if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
+               xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib.$so
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=shared
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib$thislib$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/$thislib$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/lib${thislib}_s$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+               $test -f "$xxx" && thislib=${thislib}_s
+           fi
+           if test ! -f "$xxx"; then
+               xxx=$thisdir/Slib$thislib$_a
+               $test -f "$xxx" && eval $libscheck
+               $test -f "$xxx" && libstyle=static
+           fi
+           if $test -f "$xxx"; then
                case "$libstyle" in
-               shared) echo "Found -l$libname (shared)." ;;
-               static) echo "Found -l$libname." ;;
-               *)      echo "Found -l$libname ($libstyle)." ;;
+               shared) echo "Found -l$thislib (shared)." ;;
+               static) echo "Found -l$thislib." ;;
+               *)      echo "Found -l$thislib ($libstyle)." ;;
                esac
                case " $dflt " in
                *"-l$thislib "*);;
-               *) dflt="$dflt -l$libname"
+               *) dflt="$dflt -l$thislib"
                    libsfound="$libsfound $xxx"
                    yyy=`basename $xxx`
                    libsfiles="$libsfiles $yyy"
-                   yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
+                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
                    case " $libsdirs " in
                    *" $yyy "*) ;;
                    *) libsdirs="$libsdirs $yyy" ;;
                    esac
                   ;;
                esac
-       else
-               echo "No -l$thislib."
+               break
+           fi
+       done
+       if $test ! -f "$xxx"; then
+           echo "No -l$thislib."
        fi
 done
 set X $dflt