This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rename use64bits to use64bitint;
[metaconfig.git] / U / perl / Extensions.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: Extensions.U,v$
2?RCS:
3?RCS: Copyright (c) 1996-1998, Andy Dougherty
4?RCS:
5?RCS: You may distribute under the terms of either the GNU General Public
6?RCS: License or the Artistic License, as specified in the README file.
7?RCS:
8?RCS: $Log: Extensions.U,v $
9?RCS:
10?MAKE:known_extensions extensions dynamic_ext static_ext nonxs_ext \
11 useposix useopcode : \
12 Myread hint usedl d_sem d_socket i_db i_dbm i_rpcsvcdbm i_gdbm \
33b2427b 13 i_ndbm usethreads package test cat rsrc d_msg d_shm osname use64bitint \
d12857d9 14 libs
959f3c4c
JH
15?MAKE: -pick add $@ %<
16?Y:BOTTOM
17?S:known_extensions:
18?S: This variable holds a list of all XS extensions included in
19?S: the package.
20?S:.
21?S:dynamic_ext:
22?S: This variable holds a list of XS extension files we want to
23?S: link dynamically into the package. It is used by Makefile.
24?S:.
25?S:static_ext:
26?S: This variable holds a list of XS extension files we want to
27?S: link statically into the package. It is used by Makefile.
28?S:.
29?S:nonxs_ext:
30?S: This variable holds a list of all non-xs extensions included
31?S: in the package. All of them will be built.
32?S:.
33?S:extensions:
34?S: This variable holds a list of all extension files (both XS and
35?S: non-xs linked into the package. It is propagated to Config.pm
36?S: and is typically used to test whether a particular extesion
37?S: is available.
38?S:.
39?S:useposix:
40?S: This variable holds either 'true' or 'false' to indicate
41?S: whether the POSIX extension should be used. The sole
42?S: use for this currently is to allow an easy mechanism
43?S: for hints files to indicate that POSIX will not compile
44?S: on a particular system.
45?S:.
46?S:useopcode:
47?S: This variable holds either 'true' or 'false' to indicate
48?S: whether the Opcode extension should be used. The sole
49?S: use for this currently is to allow an easy mechanism
50?S: for users to skip the Opcode extension from the Configure
51?S: command line.
52?S:.
53?T:xxx avail_ext tdir nonxs_extensions find_extensions
54?INIT:: set useposix=false in your hint file to disable the POSIX extension.
55?INIT:useposix=true
56?INIT:: set useopcode=false in your hint file to disable the Opcode extension.
57?INIT:useopcode=true
58echo " "
59echo "Looking for extensions..." >&4
60: If we are using the old config.sh, known_extensions may contain
61: old or inaccurate or duplicate values.
62known_extensions=''
63nonxs_extensions=''
64: We do not use find because it might not be available.
65: We do not just use MANIFEST because the user may have dropped
66: some additional extensions into the source tree and expect them
67: to be built.
68
69: Function to recursively find available extensions, ignoring DynaLoader
70: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
71find_extensions='
72 for xxx in *; do
73 case "$xxx" in
74 DynaLoader|dynaload) ;;
75 *)
76 if $test -f $xxx/$xxx.xs; then
77 known_extensions="$known_extensions $1$xxx";
78 elif $test -f $xxx/Makefile.PL; then
79 nonxs_extensions="$nonxs_extensions $1$xxx";
80 else
81 if $test -d $xxx -a $# -lt 10; then
82 set $1$xxx/ $*;
83 cd $xxx;
84 eval $find_extensions;
85 cd ..;
86 shift;
84e2cbfd 87 fi;
959f3c4c
JH
88 fi
89 ;;
84e2cbfd 90 esac;
959f3c4c
JH
91 done'
92tdir=`pwd`
93cd $rsrc/ext
86a2f2c4 94set X
959f3c4c
JH
95shift
96eval $find_extensions
97set X $nonxs_extensions
98shift
99nonxs_extensions="$*"
100set X $known_extensions
101shift
102known_extensions="$*"
103cd $tdir
104
105: Now see which are supported on this system.
106?X: avail_ext lists available XS extensions.
107avail_ext=''
108for xxx in $known_extensions ; do
109 case "$xxx" in
110?X: Handle possible DOS 8.3 filename and case alterations
111 DB_File|db_file)
112 case "$i_db" in
113 $define) avail_ext="$avail_ext $xxx" ;;
114 esac
115 ;;
116 GDBM_File|gdbm_fil)
117 case "$i_gdbm" in
118 $define) avail_ext="$avail_ext $xxx" ;;
119 esac
120 ;;
121 NDBM_File|ndbm_fil)
122 case "$i_ndbm" in
4ee071c7 123 $define)
33b2427b 124 case "$osname-$use64bitint" in
4ee071c7
JH
125 hpux-define)
126 case "$libs" in
127 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
128 esac
129 ;;
130 *) avail_ext="$avail_ext $xxx" ;;
131 esac
132 ;;
959f3c4c
JH
133 esac
134 ;;
135 ODBM_File|odbm_fil)
136 case "${i_dbm}${i_rpcsvcdbm}" in
4ee071c7 137 *"${define}"*)
33b2427b 138 case "$osname-$use64bitint" in
4ee071c7
JH
139 hpux-define)
140 case "$libs" in
141 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
142 esac
143 ;;
144 *) avail_ext="$avail_ext $xxx" ;;
145 esac
146 ;;
959f3c4c
JH
147 esac
148 ;;
149 POSIX|posix)
150 case "$useposix" in
151 true|define|y) avail_ext="$avail_ext $xxx" ;;
152 esac
153 ;;
154 Opcode|opcode)
155 case "$useopcode" in
156 true|define|y) avail_ext="$avail_ext $xxx" ;;
157 esac
158 ;;
159 Socket|socket)
160 case "$d_socket" in
161 true|$define|y) avail_ext="$avail_ext $xxx" ;;
162 esac
163 ;;
164 Thread|thread)
165 case "$usethreads" in
166 true|$define|y) avail_ext="$avail_ext $xxx" ;;
167 esac
168 ;;
169 IPC/SysV|ipc/sysv)
170 : XXX Do we need a useipcsysv variable here
171 case "${d_msg}${d_sem}${d_shm}" in
172 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
173 esac
174 ;;
175 *) avail_ext="$avail_ext $xxx"
176 ;;
177 esac
178done
179
180set X $avail_ext
181shift
182avail_ext="$*"
183
184: Now see which nonxs extensions are supported on this system.
185: For now assume all are.
186nonxs_ext=''
187for xxx in $nonxs_extensions ; do
188 case "$xxx" in
189 *) nonxs_ext="$nonxs_ext $xxx"
190 ;;
191 esac
192done
193
194set X $nonxs_ext
195shift
196nonxs_ext="$*"
197
198case $usedl in
199$define)
200 $cat <<EOM
201A number of extensions are supplied with $package. You may choose to
202compile these extensions for dynamic loading (the default), compile
203them into the $package executable (static loading), or not include
204them at all. Answer "none" to include no extensions.
205Note that DynaLoader is always built and need not be mentioned here.
206
207EOM
208 case "$dynamic_ext" in
209 '') dflt="$avail_ext" ;;
210 *) dflt="$dynamic_ext"
211 # Perhaps we are reusing an old out-of-date config.sh.
212 case "$hint" in
213 previous)
214 if test X"$dynamic_ext" != X"$avail_ext"; then
215 $cat <<EOM
216NOTICE: Your previous config.sh list may be incorrect.
217The extensions now available to you are
218 ${avail_ext}
219but the default list from your previous config.sh is
220 ${dynamic_ext}
221
222EOM
223 fi
224 ;;
225 esac
226 ;;
227 esac
228 case "$dflt" in
229 '') dflt=none;;
230 esac
231 rp="What extensions do you wish to load dynamically?"
232 . ./myread
233 case "$ans" in
234?X: Use ' ' so a subsequent Configure will preserve that value.
235 none) dynamic_ext=' ' ;;
236 *) dynamic_ext="$ans" ;;
237 esac
238
239 case "$static_ext" in
240 '')
241 : Exclude those already listed in dynamic linking
242 dflt=''
243 for xxx in $avail_ext; do
244 case " $dynamic_ext " in
245 *" $xxx "*) ;;
246 *) dflt="$dflt $xxx" ;;
247 esac
248 done
249 set X $dflt
250 shift
251 dflt="$*"
252 ;;
253 *) dflt="$static_ext"
254 ;;
255 esac
256
257 case "$dflt" in
258 '') dflt=none;;
259 esac
260 rp="What extensions do you wish to load statically?"
261 . ./myread
262 case "$ans" in
263?X: Use ' ' so a subsequent Configure will preserve that value.
264 none) static_ext=' ' ;;
265 *) static_ext="$ans" ;;
266 esac
267 ;;
268*)
269 $cat <<EOM
270A number of extensions are supplied with $package. Answer "none"
271to include no extensions.
272Note that DynaLoader is always built and need not be mentioned here.
273
274EOM
275 case "$static_ext" in
276 '') dflt="$avail_ext" ;;
277 *) dflt="$static_ext"
278 # Perhaps we are reusing an old out-of-date config.sh.
279 case "$hint" in
280 previous)
281 if test X"$static_ext" != X"$avail_ext"; then
282 $cat <<EOM
283NOTICE: Your previous config.sh list may be incorrect.
284The extensions now available to you are
285 ${avail_ext}
286but the default list from your previous config.sh is
287 ${static_ext}
288
289EOM
290 fi
291 ;;
292 esac
293 ;;
294 esac
295 : Exclude those that are not xs extensions
296 case "$dflt" in
297 '') dflt=none;;
298 esac
299 rp="What extensions do you wish to include?"
300 . ./myread
301 case "$ans" in
302?X: Use ' ' so a subsequent Configure will preserve that value.
303 none) static_ext=' ' ;;
304 *) static_ext="$ans" ;;
305 esac
306 ;;
307esac
308
309set X $dynamic_ext $static_ext $nonxs_ext
310shift
311extensions="$*"
312