?RCS: $Id: dlsrc.U,v$ ?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: that same Artistic Licence; a copy of which may be found at the root ?RCS: of the source tree for dist 3.0. ?RCS: ?RCS: $Log: dlsrc.U,v $ ?RCS: ?X: hpux support thanks to Jeff Okamoto ?X: ?X: To create a shared library, you must compile ALL source files in the ?X: library with +z (or possibly +Z if the library is whopping huge), ?X: then link the library with -b. Example: ?X: cc -c +z module_a.c ?X: cc -c +z module_b.c ?X: ld -b module_a.o module_b.o -o module.sl ?X: ?MAKE:usedl dlsrc cccdlflags lddlflags ccdlflags d_shrplib shrpdir: \ Getfile Myread test osname sed i_dld d_dlopen Findhdr Setvar \ cc ldflags cat archlib ?MAKE: -pick add $@ %< ?S:usedl: ?S: This variable indicates if the the system supports dynamic ?S: loading of some sort. See also dlsrc and dlobj. ?S:. ?S:dlsrc: ?S: This variable contains the name of the dynamic loading file that ?S: will be used with the package. ?S:. ?S:cccdlflags: ?S: This variable contains any special flags that might need to be ?S: passed with cc -c to compile modules to be used to create a shared ?S: library that will be used for dynamic loading. For hpux, this ?S: should be +z. It is up to the makefile to use it. ?S:. ?S:lddlflags: ?S: This variable contains any special flags that might need to be ?S: passed to ld to create a shared library suitable for dynamic ?S: loading. It is up to the makefile to use it. For hpux, it ?S: should be -b. For sunos 4.1, it is empty. ?S:. ?S:ccdlflags: ?S: This variable contains any special flags that might need to be ?S: passed to cc to link with a shared library for dynamic loading. ?S: It is up to the makefile to use it. For sunos 4.1, it should ?S: be empty. ?S:. ?S:d_shrplib: ?S: This variable indicates whether libperl should be made as a ?S: shared library. This must be true for dynamic loading to ?S: work on (some) System V Release 4 systems. ?S:. ?S:shrpdir: ?S: This variable contains the directory where the libperl shared ?S: library will be installed. LD_RUN_PATH is set to this when ?S: linking with libperl (unless it is /usr/lib, the default). ?S:. ?C:USE_DYNAMIC_LOADING ~ %<: ?C: This symbol, if defined, indicates that dynamic loading of ?C: some sort is available. ?C:. ?H:?%<:#$usedl USE_DYNAMIC_LOADING /**/ ?H:. ?W:%<:dlopen ?LINT: set d_shrplib shrpdir ?T:dldir : determine which dynamic loading, if any, to compile in echo " " dldir="ext/DynaLoader" case "$usedl" in $define|y|true) dflt='y' usedl="$define" ;; $undef|n|false) dflt='n' usedl="$undef" ;; *) dflt='n' case "$d_dlopen" in $define) dflt='y' ;; esac case "$i_dld" in $define) dflt='y' ;; esac : Does a dl_xxx.xs file exist for this operating system $test -f ../$dldir/dl_${osname}.xs && dflt='y' ;; esac rp="Do you wish to use dynamic loading?" . ./myread usedl="$ans" case "$ans" in y*) usedl="$define" case "$dlsrc" in '') if $test -f ../$dldir/dl_${osname}.xs ; then dflt="$dldir/dl_${osname}.xs" elif $test "$d_dlopen" = "$define" ; then dflt="$dldir/dl_dlopen.xs" elif $test "$i_dld" = "$define" ; then dflt="$dldir/dl_dld.xs" else dflt='' fi ;; *) dflt="$dldir/$dlsrc" ;; esac echo "The following dynamic loading files are available:" : Can not go over to $dldir because getfile has path hard-coded in. cd ..; ls -C $dldir/dl*.xs; cd UU rp="Source file to use for dynamic loading" fn="fne" . ./getfile usedl="$define" : emulate basename dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'` $cat << EOM Some systems may require passing special flags to $cc -c to compile modules that will be used to create a shared library. To use no flags, say "none". EOM case "$cccdlflags" in ''|' ') case "$cc" in *gcc*) dflt='-fpic' ;; *) case "$osname" in hpux) dflt='+z' ;; next) dflt='none' ;; solaris) dflt='-K pic' ;; sunos) dflt='-pic' ;; svr4*|esix*) dflt='-Kpic' ;; *) dflt='none' ;; esac ;; esac ;; *) dflt="$cccdlflags" ;; esac rp="Any special flags to pass to $cc -c to compile shared library modules?" . ./myread case "$ans" in none) cccdlflags='' ;; *) cccdlflags="$ans" ;; esac cat << 'EOM' Some systems may require passing special flags to ld to create a library that can be dynamically loaded. If your ld flags include -L/other/path options to locate libraries outside your loader's normal search path, you may need to specify those -L options here as well. To use no flags, say "none". EOM ?X: I have received one report that NeXT requires -r here. ?X: On SunOS 4.1.3, that makes the library no longer shared. ?X: This stuff probably all belongs in hints files anyway. case "$lddlflags" in ''|' ') case "$osname" in hpux) dflt='-b' ;; next) dflt='none' ;; solaris) dflt='-G' ;; sunos) dflt='-assert nodefinitions' ;; svr4*|esix*) dflt="-G $ldflags" ;; *) dflt='none' ;; esac ;; *) dflt="$lddlflags" ;; esac rp="Any special flags to pass to ld to create a dynamically loaded library?" . ./myread case "$ans" in none) lddlflags='' ;; *) lddlflags="$ans" ;; esac cat <&4 Be sure to add the perl source directory to the LD_LIBRARY_PATH environment variable before running make: LD_LIBRARY_PATH=`cd ..;pwd`; export LD_LIBRARY_PATH or setenv LD_LIBRARY_PATH `cd ..;pwd` EOM ;; esac case "$d_shrplib" in $define) case "$shrpdir" in "") dflt="$archlib/CORE";; *) dflt="$shrpdir";; esac rp="What directory should we install the shared libperl into?" fn="d~" . ./getfile shrpdir="$ans" ;; *) shrpdir='none' ;; esac