summaryrefslogtreecommitdiff
path: root/ext/util
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1994-10-17 23:00:00 +0000
committerLarry Wall <lwall@netlabs.com>1994-10-17 23:00:00 +0000
commita0d0e21ea6ea90a22318550944fe6cb09ae10cda (patch)
treefaca1018149b736b1142f487e44d1ff2de5cc1fa /ext/util
parent85e6fe838fb25b257a1b363debf8691c0992ef71 (diff)
downloadperl-a0d0e21ea6ea90a22318550944fe6cb09ae10cda.tar.gz
perl 5.000perl-5.000
[editor's note: this commit combines approximate 4 months of furious releases of Andy Dougherty and Larry Wall - see pod/perlhist.pod for details. Andy notes that; Alas neither my "Irwin AccuTrack" nor my DC 600A quarter-inch cartridge backup tapes from that era seem to be readable anymore. I guess 13 years exceeds the shelf life for that backup technology :-(. ]
Diffstat (limited to 'ext/util')
-rwxr-xr-xext/util/extliblist151
-rw-r--r--ext/util/make_ext74
-rw-r--r--ext/util/mkbootstrap5
3 files changed, 230 insertions, 0 deletions
diff --git a/ext/util/extliblist b/ext/util/extliblist
new file mode 100755
index 0000000000..2b8938fa4d
--- /dev/null
+++ b/ext/util/extliblist
@@ -0,0 +1,151 @@
+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 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="$*"
+
diff --git a/ext/util/make_ext b/ext/util/make_ext
new file mode 100644
index 0000000000..fba77c0c9f
--- /dev/null
+++ b/ext/util/make_ext
@@ -0,0 +1,74 @@
+# This script acts as a simple interface for building extensions.
+# It primarily used by the perl Makefile:
+#
+# d_dummy $(dynamic_ext): miniperl preplibrary FORCE
+# ext/util/make_ext dynamic $@
+#
+# It may be deleted in a later release of perl so try to
+# avoid using it for other purposes.
+
+linktype=$1
+extspec=$2
+
+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 generated by Configure"; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+
+if test "X$extspec" = X; then
+ echo "make_ext: no extension specified"
+ exit 1;
+fi
+
+# convert old style Name.a into ext/Name/Name.a format
+case "$extspec" in
+ext/*) ;;
+*) extspec=`echo "$extspec" | sed -e 's:\(.*\)\.\(.*\):ext/\1/\1.\2:'`
+esac
+
+# get extension directory path, module name and depth
+pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/[^/]*$::'`
+mname=`echo "$pname" | sed -e 's!/!::!'`
+depth=`echo "$pname" | sed -e 's![^/][^/]*!..!g'`
+
+if test ! -d "ext/$pname"; then
+ echo " Skipping $extspec (directory does not exist)"
+ exit 0 # not an error ?
+fi
+
+# check link type and do any preliminaries
+case "$linktype" in
+static) makeargs='CCCDLFLAGS=' ;;
+dynamic) makeargs='' ;;
+*) echo "make_ext: unknown link type '$linktype'"; exit 1;;
+'') echo "make_ext: no link type specified (eg static or dynamic)"; exit 1;;
+esac
+
+echo ""
+echo " Making $mname ($linktype)"
+
+cd ext/$pname
+
+if test ! -f Makefile ; then
+ test -f Makefile.PL && ../$depth/miniperl -I../$depth/lib Makefile.PL
+fi
+if test ! -f Makefile ; then
+ test -f Makefile.SH && sh Makefile.SH
+fi
+
+make=${altmake-make}
+
+$make config
+
+$make $linktype $makeargs
+
+exit $?
diff --git a/ext/util/mkbootstrap b/ext/util/mkbootstrap
new file mode 100644
index 0000000000..6c3a7e10ed
--- /dev/null
+++ b/ext/util/mkbootstrap
@@ -0,0 +1,5 @@
+#!../../miniperl -w -I../../lib
+
+use ExtUtils::MakeMaker;
+&mkbootstrap(join(" ",@ARGV));
+exit;