case $CONFIG in '') if test -f config.sh; then TOP=.; elif test -f ../config.sh; then TOP=..; elif test -f ../../config.sh; then TOP=../..; elif test -f ../../../config.sh; then TOP=../../..; elif test -f ../../../../config.sh; then TOP=../../../..; else echo "Can't find config.sh."; exit 1 fi . $TOP/config.sh ;; esac : extliblist : : Author: Andy Dougherty doughera@lafcol.lafayette.edu : : This utility was only used by the old Makefile.SH extension : mechanism. It is now obsolete and may be removed in a future : release. : : This utility takes a list of libraries in the form : -llib1 -llib2 -llib3 : and prints out lines suitable for inclusion in an extension : Makefile. : Extra library paths may be included with the form -L/another/path : this will affect the searches for all subsequent libraries. : : It is intended to be "dotted" from within an extension Makefile.SH. : see ext/POSIX/Makefile.SH for an example. : Prior to calling this, the variable potential_libs should be set : to the potential list of libraries : : It sets the following : extralibs = full list of libraries needed for static linking. : Only those libraries that actually exist are included. : dynaloadlibs = full path names of those libraries that are needed : but can be linked in dynamically on this platform. On : SunOS, for example, this would be .so* libraries, : but not archive libraries. : Eventually, this list can be used to write a bootstrap file. : statloadlibs = list of those libraries which must be statically : linked into the shared library. On SunOS 4.1.3, : for example, I have only an archive version of : -lm, and it must be linked in statically. : : This script uses config.sh variables libs, libpth, and so. It is mostly : taken from the metaconfig libs.U unit. extralibs='' dynaloadlibs='' statloadlibs='' Llibpth='' for thislib in `echo "XXX $potential_libs " | $sed 's/ -l/ /g'` ; do case "$thislib" in XXX) : Handle case where potential_libs is empty. ;; -L*) : Handle possible linker path arguments. newpath=`echo $thislib | $sed 's/^-L//'` if $test -d $newpath; then Llibpth="$Llibpth $newpath" extralibs="$extralibs $thislib" statloadlibs="$statloadlibs $thislib" fi ;; *) : Handle possible library arguments. for thispth in $Llibpth $libpth; do : Loop over possible wildcards and take the last one. for fullname in $thispth/lib$thislib.$so.[0-9]* ; do : done if $test -f $fullname; then break elif fullname=$thispth/lib$thislib.$so && $test -f $fullname; then break elif fullname=$thispth/lib${thislib}_s.a && $test -f $fullname; then thislib=${thislib}_s break elif fullname=$thispth/lib${thislib}.a && $test -f $fullname; then break elif fullname=$thispth/Slib${thislib}.a && $test -f $fullname; then break else fullname='' fi done : Now update library lists case "$fullname" in '') : Skip nonexistent files ;; *) : Do not add it into the extralibs if it is already linked in : with the main perl executable. case " $libs " in *" -l$thislib "*|*" -l${thislib}_s "*) ;; *) extralibs="$extralibs -l$thislib" ;; esac : : For NeXT and DLD, put files into DYNALOADLIBS to be : converted into a boostrap file. For other systems, : we will use ld with what I have misnamed STATLOADLIBS : to assemble the shared object. case "$dlsrc" in dl_dld*|dl_next*) dynaloadlibs="$dynaloadlibs $fullname" ;; *) case "$fullname" in *.a) statloadlibs="$statloadlibs -l$thislib" ;; *) : For SunOS4, do not add in this shared library : if it is already linked in the main : perl executable case "$osname" in sunos) case " $libs " in *" -l$thislib "*) ;; *) statloadlibs="$statloadlibs -l$thislib" ;; esac ;; *) statloadlibs="$statloadlibs -l$thislib" ;; esac ;; esac ;; esac ;; esac ;; esac done case "$dlsrc" in dl_next*) extralibs=`echo " $extralibs "| $sed -e 's/ -lm / /'` ;; esac set X $extralibs shift extralibs="$*" set X $dynaloadlibs shift dynaloadlibs="$*" set X $statloadlibs shift statloadlibs="$*"