summaryrefslogtreecommitdiff
path: root/U/dlsrc.U
blob: 64317cfbb78c00cc061199b1a1d42ab797b41a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
?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 <okamoto@hpcc101.corp.hp.com>
?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 <<EOM

Some systems may require passing special flags to $cc to indicate that
the resulting executable will use dynamic linking.  To use no flags,
say "none".

EOM
    case "$ccdlflags" in
    ''|' ') case "$osname" in
		hpux)	dflt='none' ;;
		next)	dflt='none' ;;
		sunos)	dflt='none' ;;
		*)	dflt='none' ;;
	    esac ;;
    *)  dflt="$ccdlflags" ;;
    esac
    rp="Any special flags to pass to $cc to use dynamic loading?"
    . ./myread
    case "$ans" in
    none) ccdlflags='' ;;
    *) ccdlflags="$ans" ;;
    esac
    ;;
?X: End of usedl=y section
*)  usedl="$undef"
    dlsrc='dl_none.xs'
    lddlflags=''
    ccdlflags=''
    ;;
esac

?X: Currently libperl is only created as a shared library if
?X: using dynamic loading on a SysVR4 system.  Feel free to
?X: add prompts here to allow the user to choose a shared
?X: libperl in other cases.
val="$undef"
case "$osname" in
esix*|svr4*)
    case "$usedl" in
    $define)
	$cat <<EOM

System V Release 4 systems can support dynamic loading
only if libperl is created as a shared library.

EOM
	val="$define"
	;;
    esac ;;
esac
set d_shrplib; eval $setvar
case "$d_shrplib" in
$define)
    cat <<EOM >&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