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