This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Metaconfig changes for #10479.
[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 ;;
fa92de3e
YST
164 Sys/Syslog|sys/syslog)
165 : XXX syslog requires socket
166 case "$d_socket" in
167 true|$define|y) avail_ext="$avail_ext $xxx" ;;
168 esac
169 ;;
959f3c4c
JH
170 Thread|thread)
171 case "$usethreads" in
172 true|$define|y) avail_ext="$avail_ext $xxx" ;;
173 esac
174 ;;
175 IPC/SysV|ipc/sysv)
176 : XXX Do we need a useipcsysv variable here
177 case "${d_msg}${d_sem}${d_shm}" in
178 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
179 esac
180 ;;
181 *) avail_ext="$avail_ext $xxx"
182 ;;
183 esac
184done
185
186set X $avail_ext
187shift
188avail_ext="$*"
189
190: Now see which nonxs extensions are supported on this system.
191: For now assume all are.
192nonxs_ext=''
193for xxx in $nonxs_extensions ; do
194 case "$xxx" in
195 *) nonxs_ext="$nonxs_ext $xxx"
196 ;;
197 esac
198done
199
200set X $nonxs_ext
201shift
202nonxs_ext="$*"
203
204case $usedl in
205$define)
206 $cat <<EOM
207A number of extensions are supplied with $package. You may choose to
208compile these extensions for dynamic loading (the default), compile
209them into the $package executable (static loading), or not include
210them at all. Answer "none" to include no extensions.
211Note that DynaLoader is always built and need not be mentioned here.
212
213EOM
214 case "$dynamic_ext" in
215 '') dflt="$avail_ext" ;;
216 *) dflt="$dynamic_ext"
217 # Perhaps we are reusing an old out-of-date config.sh.
218 case "$hint" in
219 previous)
220 if test X"$dynamic_ext" != X"$avail_ext"; then
221 $cat <<EOM
222NOTICE: Your previous config.sh list may be incorrect.
223The extensions now available to you are
224 ${avail_ext}
225but the default list from your previous config.sh is
226 ${dynamic_ext}
227
228EOM
229 fi
230 ;;
231 esac
232 ;;
233 esac
234 case "$dflt" in
235 '') dflt=none;;
236 esac
237 rp="What extensions do you wish to load dynamically?"
238 . ./myread
239 case "$ans" in
240?X: Use ' ' so a subsequent Configure will preserve that value.
241 none) dynamic_ext=' ' ;;
242 *) dynamic_ext="$ans" ;;
243 esac
244
245 case "$static_ext" in
246 '')
247 : Exclude those already listed in dynamic linking
248 dflt=''
249 for xxx in $avail_ext; do
250 case " $dynamic_ext " in
251 *" $xxx "*) ;;
252 *) dflt="$dflt $xxx" ;;
253 esac
254 done
255 set X $dflt
256 shift
257 dflt="$*"
258 ;;
259 *) dflt="$static_ext"
260 ;;
261 esac
262
263 case "$dflt" in
264 '') dflt=none;;
265 esac
266 rp="What extensions do you wish to load statically?"
267 . ./myread
268 case "$ans" in
269?X: Use ' ' so a subsequent Configure will preserve that value.
270 none) static_ext=' ' ;;
271 *) static_ext="$ans" ;;
272 esac
273 ;;
274*)
275 $cat <<EOM
276A number of extensions are supplied with $package. Answer "none"
277to include no extensions.
278Note that DynaLoader is always built and need not be mentioned here.
279
280EOM
281 case "$static_ext" in
282 '') dflt="$avail_ext" ;;
283 *) dflt="$static_ext"
284 # Perhaps we are reusing an old out-of-date config.sh.
285 case "$hint" in
286 previous)
287 if test X"$static_ext" != X"$avail_ext"; then
288 $cat <<EOM
289NOTICE: Your previous config.sh list may be incorrect.
290The extensions now available to you are
291 ${avail_ext}
292but the default list from your previous config.sh is
293 ${static_ext}
294
295EOM
296 fi
297 ;;
298 esac
299 ;;
300 esac
301 : Exclude those that are not xs extensions
302 case "$dflt" in
303 '') dflt=none;;
304 esac
305 rp="What extensions do you wish to include?"
306 . ./myread
307 case "$ans" in
308?X: Use ' ' so a subsequent Configure will preserve that value.
309 none) static_ext=' ' ;;
310 *) static_ext="$ans" ;;
311 esac
312 ;;
313esac
314
315set X $dynamic_ext $static_ext $nonxs_ext
316shift
317extensions="$*"
318