3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
9 echo "Can't find config.sh."; exit 1
16 : Author: Andy Dougherty doughera@lafcol.lafayette.edu
18 : This utility takes a list of libraries in the form
19 : -llib1 -llib2 -llib3
20 : and prints out lines suitable for inclusion in an extension
22 : Extra library paths may be included with the form -L/another/path
23 : this will affect the searches for all subsequent libraries.
25 : It is intended to be "dotted" from within an extension Makefile.SH.
26 : see ext/POSIX/Makefile.SH for an example.
27 : Prior to calling this, the variable potential_libs should be set
28 : to the potential list of libraries
30 : It sets the following
31 : extralibs = full list of libraries needed for static linking.
32 : Only those libraries that actually exist are included.
33 : dynaloadlibs = full path names of those libraries that are needed
34 : but can be linked in dynamically on this platform. On
35 : SunOS, for example, this would be .so* libraries,
36 : but not archive libraries.
37 : Eventually, this list can be used to write a bootstrap file.
38 : statloadlibs = list of those libraries which must be statically
39 : linked into the shared library. On SunOS 4.1.3,
40 : for example, I have only an archive version of
41 : -lm, and it must be linked in statically.
43 : This script uses config.sh variables libs, libpth, and so. It is mostly
44 : taken from the metaconfig libs.U unit.
49 for thislib in `echo "XXX $potential_libs " | $sed 's/ -l/ /g'` ; do
52 : Handle case where potential_libs is empty.
55 : Handle possible linker path arguments.
56 newpath=`echo $thislib | $sed 's/^-L//'`
57 if $test -d $newpath; then
58 Llibpth="$Llibpth $newpath"
59 extralibs="$extralibs $thislib"
60 statloadlibs="$statloadlibs $thislib"
64 : Handle possible library arguments.
65 for thispth in $Llibpth $libpth; do
66 : Loop over possible wildcards and take the last one.
67 for fullname in $thispth/lib$thislib.$so.[0-9]* ; do
70 if $test -f $fullname; then
72 elif fullname=$thispth/lib$thislib.$so && $test -f $fullname; then
74 elif fullname=$thispth/lib${thislib}_s.a && $test -f $fullname; then
77 elif fullname=$thispth/lib${thislib}.a && $test -f $fullname; then
79 elif fullname=$thispth/Slib${thislib}.a && $test -f $fullname; then
85 : Now update library lists
88 : Skip nonexistent files
91 : Do not add it into the extralibs if it is already linked in
92 : with the main perl executable.
94 *" -l$thislib "*|*" -l${thislib}_s "*) ;;
95 *) extralibs="$extralibs -l$thislib" ;;
98 : For NeXT and DLD, put files into DYNALOADLIBS to be
99 : converted into a boostrap file. For other systems,
100 : we will use ld with what I have misnamed STATLOADLIBS
101 : to assemble the shared object.
104 dynaloadlibs="$dynaloadlibs $fullname" ;;
108 statloadlibs="$statloadlibs -l$thislib"
111 : For SunOS4, do not add in this shared library
112 : if it is already linked in the main
118 *) statloadlibs="$statloadlibs -l$thislib" ;;
122 statloadlibs="$statloadlibs -l$thislib"
137 extralibs=`echo " $extralibs "| $sed -e 's/ -lm / /'` ;;