perl5.000 patch.0k: MakeMaker 4.06 and to fix minor portability and build problems...
[p5sagit/p5-mst-13.2.git] / U / dlsrc.U
CommitLineData
5f51ce50 1?RCS: $Id: dlsrc.U,v$
2?RCS:
3?RCS: You may redistribute only under the terms of the Artistic Licence,
4?RCS: as specified in the README file that comes with the distribution.
5?RCS: You may reuse parts of this distribution only within the terms of
6?RCS: that same Artistic Licence; a copy of which may be found at the root
7?RCS: of the source tree for dist 3.0.
8?RCS:
9?RCS: $Log: dlsrc.U,v $
10?RCS:
11?X: hpux support thanks to Jeff Okamoto <okamoto@hpcc101.corp.hp.com>
12?X:
13?X: To create a shared library, you must compile ALL source files in the
14?X: library with +z (or possibly +Z if the library is whopping huge),
15?X: then link the library with -b. Example:
16?X: cc -c +z module_a.c
17?X: cc -c +z module_b.c
18?X: ld -b module_a.o module_b.o -o module.sl
19?X:
20?MAKE:usedl dlsrc cccdlflags lddlflags ccdlflags d_shrplib shrpdir: \
21 Getfile Myread test osname sed i_dld d_dlopen Findhdr Setvar \
22 cc ldflags cat archlib
23?MAKE: -pick add $@ %<
24?S:usedl:
25?S: This variable indicates if the the system supports dynamic
26?S: loading of some sort. See also dlsrc and dlobj.
27?S:.
28?S:dlsrc:
29?S: This variable contains the name of the dynamic loading file that
30?S: will be used with the package.
31?S:.
32?S:cccdlflags:
33?S: This variable contains any special flags that might need to be
34?S: passed with cc -c to compile modules to be used to create a shared
35?S: library that will be used for dynamic loading. For hpux, this
36?S: should be +z. It is up to the makefile to use it.
37?S:.
38?S:lddlflags:
39?S: This variable contains any special flags that might need to be
40?S: passed to ld to create a shared library suitable for dynamic
41?S: loading. It is up to the makefile to use it. For hpux, it
42?S: should be -b. For sunos 4.1, it is empty.
43?S:.
44?S:ccdlflags:
45?S: This variable contains any special flags that might need to be
46?S: passed to cc to link with a shared library for dynamic loading.
47?S: It is up to the makefile to use it. For sunos 4.1, it should
48?S: be empty.
49?S:.
50?S:d_shrplib:
51?S: This variable indicates whether libperl should be made as a
52?S: shared library. This must be true for dynamic loading to
53?S: work on (some) System V Release 4 systems.
54?S:.
55?S:shrpdir:
56?S: This variable contains the directory where the libperl shared
57?S: library will be installed. LD_RUN_PATH is set to this when
58?S: linking with libperl (unless it is /usr/lib, the default).
59?S:.
60?C:USE_DYNAMIC_LOADING ~ %<:
61?C: This symbol, if defined, indicates that dynamic loading of
62?C: some sort is available.
63?C:.
64?H:?%<:#$usedl USE_DYNAMIC_LOADING /**/
65?H:.
66?W:%<:dlopen
67?LINT: set d_shrplib shrpdir
68?T:dldir
69: determine which dynamic loading, if any, to compile in
70echo " "
71dldir="ext/DynaLoader"
72case "$usedl" in
73$define|y|true)
74 dflt='y'
75 usedl="$define"
76 ;;
77$undef|n|false)
78 dflt='n'
79 usedl="$undef"
80 ;;
81*)
82 dflt='n'
83 case "$d_dlopen" in
84 $define) dflt='y' ;;
85 esac
86 case "$i_dld" in
87 $define) dflt='y' ;;
88 esac
89 : Does a dl_xxx.xs file exist for this operating system
90 $test -f ../$dldir/dl_${osname}.xs && dflt='y'
91 ;;
92esac
93rp="Do you wish to use dynamic loading?"
94. ./myread
95usedl="$ans"
96case "$ans" in
97y*) usedl="$define"
98 case "$dlsrc" in
99 '')
100 if $test -f ../$dldir/dl_${osname}.xs ; then
101 dflt="$dldir/dl_${osname}.xs"
102 elif $test "$d_dlopen" = "$define" ; then
103 dflt="$dldir/dl_dlopen.xs"
104 elif $test "$i_dld" = "$define" ; then
105 dflt="$dldir/dl_dld.xs"
106 else
107 dflt=''
108 fi
109 ;;
110 *) dflt="$dldir/$dlsrc"
111 ;;
112 esac
113 echo "The following dynamic loading files are available:"
114 : Can not go over to $dldir because getfile has path hard-coded in.
115 cd ..; ls -C $dldir/dl*.xs; cd UU
116 rp="Source file to use for dynamic loading"
fed7345c 117 fn="fne"
5f51ce50 118 . ./getfile
119 usedl="$define"
120 : emulate basename
121 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
122 $cat << EOM
123
124Some systems may require passing special flags to $cc -c to
125compile modules that will be used to create a shared library.
126To use no flags, say "none".
127
128EOM
129 case "$cccdlflags" in
130 ''|' ') case "$cc" in
131 *gcc*) dflt='-fpic' ;;
132 *) case "$osname" in
133 hpux) dflt='+z' ;;
134 next) dflt='none' ;;
135 solaris) dflt='-K pic' ;;
136 sunos) dflt='-pic' ;;
137 svr4*|esix*) dflt='-Kpic' ;;
138 *) dflt='none' ;;
139 esac ;;
140 esac ;;
141 *) dflt="$cccdlflags" ;;
142 esac
143 rp="Any special flags to pass to $cc -c to compile shared library modules?"
144 . ./myread
145 case "$ans" in
146 none) cccdlflags='' ;;
147 *) cccdlflags="$ans" ;;
148 esac
149
150 cat << 'EOM'
151
152Some systems may require passing special flags to ld to create a
153library that can be dynamically loaded. If your ld flags include
154-L/other/path options to locate libraries outside your loader's normal
155search path, you may need to specify those -L options here as well. To
156use no flags, say "none".
157
158EOM
159?X: I have received one report that NeXT requires -r here.
160?X: On SunOS 4.1.3, that makes the library no longer shared.
161?X: This stuff probably all belongs in hints files anyway.
162 case "$lddlflags" in
163 ''|' ') case "$osname" in
164 hpux) dflt='-b' ;;
165 next) dflt='none' ;;
166 solaris) dflt='-G' ;;
167 sunos) dflt='-assert nodefinitions' ;;
168 svr4*|esix*) dflt="-G $ldflags" ;;
169 *) dflt='none' ;;
170 esac
171 ;;
172 *) dflt="$lddlflags" ;;
173 esac
174 rp="Any special flags to pass to ld to create a dynamically loaded library?"
175 . ./myread
176 case "$ans" in
177 none) lddlflags='' ;;
178 *) lddlflags="$ans" ;;
179 esac
180
181 cat <<EOM
182
183Some systems may require passing special flags to $cc to indicate that
184the resulting executable will use dynamic linking. To use no flags,
185say "none".
186
187EOM
188 case "$ccdlflags" in
189 ''|' ') case "$osname" in
190 hpux) dflt='none' ;;
191 next) dflt='none' ;;
192 sunos) dflt='none' ;;
193 *) dflt='none' ;;
194 esac ;;
195 *) dflt="$ccdlflags" ;;
196 esac
197 rp="Any special flags to pass to $cc to use dynamic loading?"
198 . ./myread
199 case "$ans" in
200 none) ccdlflags='' ;;
201 *) ccdlflags="$ans" ;;
202 esac
203 ;;
204?X: End of usedl=y section
205*) usedl="$undef"
206 dlsrc='dl_none.xs'
207 lddlflags=''
208 ccdlflags=''
209 ;;
210esac
211
212?X: Currently libperl is only created as a shared library if
213?X: using dynamic loading on a SysVR4 system. Feel free to
214?X: add prompts here to allow the user to choose a shared
215?X: libperl in other cases.
216val="$undef"
217case "$osname" in
218esix*|svr4*)
219 case "$usedl" in
220 $define)
221 $cat <<EOM
222
223System V Release 4 systems can support dynamic loading
224only if libperl is created as a shared library.
225
226EOM
227 val="$define"
228 ;;
229 esac ;;
230esac
231set d_shrplib; eval $setvar
232case "$d_shrplib" in
233$define)
234 cat <<EOM >&4
235
236Be sure to add the perl source directory to the LD_LIBRARY_PATH
237environment variable before running make:
238 LD_LIBRARY_PATH=`cd ..;pwd`; export LD_LIBRARY_PATH
239or
240 setenv LD_LIBRARY_PATH `cd ..;pwd`
241
242EOM
243;;
244esac
245case "$d_shrplib" in
246$define)
247 case "$shrpdir" in
248 "") dflt="$archlib/CORE";;
249 *) dflt="$shrpdir";;
250 esac
251 rp="What directory should we install the shared libperl into?"
252 fn="d~"
253 . ./getfile
254 shrpdir="$ans"
255 ;;
256*) shrpdir='none'
257 ;;
258esac
259