perl 5.0 alpha 9
[p5sagit/p5-mst-13.2.git] / U / dlsrc.U
CommitLineData
2304df62 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:
85e6fe83 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 dlobj dldir cccdlflags lddlflags ccdlflags \
21 shlibsuffix: Getfile Myread test osname sed i_dlfcn Findhdr cc
2304df62 22?MAKE: -pick add $@ %<
23?S:usedl:
24?S: This variable contains indicates if the the system supports dynamic
25?S: loading of some sort. See also dlsrc and dlobj.
26?S:.
27?S:dlsrc:
85e6fe83 28?S: This variable contains the name of the dynamic loading file that
2304df62 29?S: will be used with the package.
30?S:.
31?S:dlobj:
32?S: This variable contains the name of the dynamic loading object
85e6fe83 33?S: file that will be used with the package. This is used in Makefile.
34?S:.
35?S:dldir:
36?S: This variable contains the directory from which to fetch dlsrc.
37?S: It is up to the makefile to use it.
38?S:.
39?S:cccdlflags:
40?S: This variable contains any special flags that might need to be
41?S: passed with cc -c to compile modules to be used to create a shared
42?S: library that will be used for dynamic loading. For hpux, this
43?S: should be +z. It is up to the makefile to use it.
44?S:.
45?S:lddlflags:
46?S: This variable contains any special flags that might need to be
47?S: passed to ld to create a shared library suitable for dynamic
48?S: loading. It is up to the makefile to use it. For hpux, it
49?S: should be -b. For sunos 4.1, it is empty.
50?S:.
51?S:ccdlflags:
52?S: This variable contains any special flags that might need to be
53?S: passed to cc to link with a shared library for dynamic loading.
54?S: It is up to the makefile to use it. For sunos 4.1, it should
55?S: be empty.
2304df62 56?S:.
85e6fe83 57?S:shlibsuffix:
58?S: Shared libraries are built by Makefile in the form
59?S: lib/auto/xxx/xxx${shsuffix}, where xxx is
60?S: the name of the library, e.g. /lib/auto/POSIX/POSIX.so
61?S:.
62?C:USE_DYNAMIC_LOADING ~ %<:
2304df62 63?C: This symbol, if defined, indicates that dynamic loading of
64?C: some sort is available.
65?C:.
66?H:?%<:#$usedl USE_DYNAMIC_LOADING /**/
67?H:.
68?W:%<:dlopen
85e6fe83 69?INIT:: File to use for dynamic loading
70?INIT:usedl=''
71?T:xxx
72?X:
73?X: We select a default of 'define' for usedl if either dl_$osname.c
74?X: exists or if i_dlfcn is defined (which probably means dl_sunos.c
75?X: will work.)
76?X:
2304df62 77: determine which dynamic loading, if any, to compile in
78echo " "
79case "$usedl" in
85e6fe83 80'') case "$i_dlfcn" in
81 define) dflt='y' ;;
82 *) dflt='n' ;;
83 esac
84 : Does a dl.c file exist for this operating system
85 $test -f ../ext/dl/dl_${osname}.c && dflt='y'
86 ;;
87define|y|true) dflt='y'
88 usedl="$define"
89 ;;
90*) dflt='n'
91 ;;
2304df62 92esac
93rp="Do you wish to attempt to use dynamic loading?"
94. ./myread
95usedl="$ans"
96case "$ans" in
85e6fe83 97y*) usedl="$define"
98 if $test -f ../ext/dl/dl_${osname}.c ; then
99 dflt="ext/dl/dl_${osname}.c"
100 else
101 dflt='ext/dl/dl.c'
102 fi
103 echo "The following dynamic loading files are available:"
104 cd ..; ls -C ext/dl/dl*.c; cd UU
105 rp="Source file to use for dynamic loading"
106 fn="fne~"
107 . ./getfile
108 : emulate basename and dirname
109 xxx=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@' -e 's@\.c$@@'`
110 dlobj=$xxx.o
111 dlsrc=$xxx.c
112 dldir=`echo $ans | $sed 's@\(.*\)/[^/]*$@\1@'`
113 case "$dldir" in
114 '') dldir="." ;;
115 *) ;;
116 esac
117 if $test -f ../$dldir/$dlsrc; then
118 usedl="$define"
119 else
120 echo "File $dlsrc does not exist -- ignored"
121 usedl="$undef"
122 fi
123
124 cat << EOM
125
126Some systems may require passing special flags to $cc -c to
127compile modules that will be used to create a shared library.
128To use no flags, say "none".
129EOM
130 case "$cccdlflags" in
131 ''|' ') case "$osname" in
132 hpux) dflt='+z' ;;
133 next) dflt='none' ;;
134 sunos) dflt='none' ;;
135 *) dflt='none' ;;
136 esac
137 ;;
138 *) dflt="$cccdlflags" ;;
139 esac
140 rp="Any special flags to pass to $cc -c to compile shared library modules?"
141 . ./myread
142 case "$ans" in
143 none) cccdlflags='' ;;
144 *) cccdlflags="$ans" ;;
145 esac
146
147 cat << 'EOM'
148
149Some systems may require passing special flags to ld to
150create a shared library. To use no flags, say "none".
151EOM
152?X: I have received one report that NeXT requires -r here.
153?X: On SunOS 4.1.3, that makes the library no longer shared.
154 case "$lddlflags" in
155 ''|' ') case "$osname" in
156 hpux) dflt='-b' ;;
157 next) dflt='none' ;;
158 sunos) dflt='none' ;;
159 *) dflt='none' ;;
160 esac
161 ;;
162 *) dflt="$lddlflags" ;;
163 esac
164 rp="Any special flags to pass to ld to create a shared library?"
165 . ./myread
166 case "$ans" in
167 none) lddlflags='' ;;
168 *) lddlflags="$ans" ;;
169 esac
170
171 cat <<EOM
172
173Some systems may require passing special flags to $cc to indicate that
174dynamic linking will be used. To use no flags, say "none".
175EOM
176 case "$ccdlflags" in
177 ''|' ')
178 case "$osname" in
179 hpux) dflt='none' ;;
180 next) dflt='none' ;;
181 sunos) dflt='none' ;;
182 *) dflt='none' ;;
183 esac
184 ;;
185 *) dflt="$ccdlflags"
186 ;;
187 esac
188 rp="Any special flags to pass to $cc to use dynamic loading?"
189 . ./myread
190 case "$ans" in
191 none) ccdlflags='' ;;
192 *) ccdlflags="$ans" ;;
193 esac
194 cat <<EOM
195
196Some systems may require using a special suffix for shared libraries.
197To create the shared library for POSIX, for example, you may need to
198actually build the file POSIX.so.
199
200EOM
201 case "$shlibsuffix" in
202 '')
203 case "$osname" in
204 hpux) dflt='.sl' ;;
205 next) dflt='.so' ;;
206 sunos) dflt='.so' ;;
207 *) dflt='.so' ;;
208 esac
209 ;;
210 *) dflt="$shlibsuffix"
211 ;;
212 esac
213 rp="What is the suffix used for shared libraries?"
214 . ./myread
215 case "$ans" in
216 none) shlibsuffix='' ;;
217 *) shlibsuffix="$ans" ;;
218 esac
219 ;;
220?X: End of usedl=y section
221*) usedl="$undef"
222 : These are currently not used.
223 dlsrc=''
224 dlobj=''
225 dldir=''
226 lddlflags=''
227 ccdlflags=''
228 shlibsuffix='.o'
229 ;;
2304df62 230esac