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 was only used by the old Makefile.SH extension
19 : mechanism. It is now obsolete and may be removed in a future
22 : This utility takes a list of libraries in the form
23 : -llib1 -llib2 -llib3
24 : and prints out lines suitable for inclusion in an extension
26 : Extra library paths may be included with the form -L/another/path
27 : this will affect the searches for all subsequent libraries.
29 : It is intended to be "dotted" from within an extension Makefile.SH.
30 : see ext/POSIX/Makefile.SH for an example.
31 : Prior to calling this, the variable potential_libs should be set
32 : to the potential list of libraries
34 : It sets the following
35 : extralibs = full list of libraries needed for static linking.
36 : Only those libraries that actually exist are included.
37 : dynaloadlibs = full path names of those libraries that are needed
38 : but can be linked in dynamically on this platform. On
39 : SunOS, for example, this would be .so* libraries,
40 : but not archive libraries.
41 : Eventually, this list can be used to write a bootstrap file.
42 : statloadlibs = list of those libraries which must be statically
43 : linked into the shared library. On SunOS 4.1.3,
44 : for example, I have only an archive version of
45 : -lm, and it must be linked in statically.
47 : This script uses config.sh variables libs, libpth, and so. It is mostly
48 : taken from the metaconfig libs.U unit.
53 for thislib in `echo "XXX $potential_libs " | $sed 's/ -l/ /g'` ; do
56 : Handle case where potential_libs is empty.
59 : Handle possible linker path arguments.
60 newpath=`echo $thislib | $sed 's/^-L//'`
61 if $test -d $newpath; then
62 Llibpth="$Llibpth $newpath"
63 extralibs="$extralibs $thislib"
64 statloadlibs="$statloadlibs $thislib"
68 : Handle possible library arguments.
69 for thispth in $Llibpth $libpth; do
70 : Loop over possible wildcards and take the last one.
71 for fullname in $thispth/lib$thislib.$so.[0-9]* ; do
74 if $test -f $fullname; then
76 elif fullname=$thispth/lib$thislib.$so && $test -f $fullname; then
78 elif fullname=$thispth/lib${thislib}_s.a && $test -f $fullname; then
81 elif fullname=$thispth/lib${thislib}.a && $test -f $fullname; then
83 elif fullname=$thispth/Slib${thislib}.a && $test -f $fullname; then
89 : Now update library lists
92 : Skip nonexistent files
95 : Do not add it into the extralibs if it is already linked in
96 : with the main perl executable.
98 *" -l$thislib "*|*" -l${thislib}_s "*) ;;
99 *) extralibs="$extralibs -l$thislib" ;;
102 : For NeXT and DLD, put files into DYNALOADLIBS to be
103 : converted into a boostrap file. For other systems,
104 : we will use ld with what I have misnamed STATLOADLIBS
105 : to assemble the shared object.
108 dynaloadlibs="$dynaloadlibs $fullname" ;;
112 statloadlibs="$statloadlibs -l$thislib"
115 : For SunOS4, do not add in this shared library
116 : if it is already linked in the main
122 *) statloadlibs="$statloadlibs -l$thislib" ;;
126 statloadlibs="$statloadlibs -l$thislib"
141 extralibs=`echo " $extralibs "| $sed -e 's/ -lm / /'` ;;