1 ?RCS: $Id: Extensions.U,v$
3 ?RCS: Copyright (c) 1996-1998, Andy Dougherty
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.
8 ?RCS: $Log: Extensions.U,v $
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 use5005threads package test cat rsrc \
14 d_msg d_shm osname use64bitint i_langinfo d_nl_langinfo \
15 libs d_cplusplus sed ls rm contains
16 ?MAKE: -pick add $@ %<
19 ?S: This variable holds a list of all XS extensions included in
23 ?S: This variable holds a list of XS extension files we want to
24 ?S: link dynamically into the package. It is used by Makefile.
27 ?S: This variable holds a list of XS extension files we want to
28 ?S: link statically into the package. It is used by Makefile.
31 ?S: This variable holds a list of all non-xs extensions included
32 ?S: in the package. All of them will be built.
35 ?S: This variable holds a list of all extension files (both XS and
36 ?S: non-xs linked into the package. It is propagated to Config.pm
37 ?S: and is typically used to test whether a particular extesion
41 ?S: This variable holds either 'true' or 'false' to indicate
42 ?S: whether the POSIX extension should be used. The sole
43 ?S: use for this currently is to allow an easy mechanism
44 ?S: for hints files to indicate that POSIX will not compile
45 ?S: on a particular system.
48 ?S: This variable holds either 'true' or 'false' to indicate
49 ?S: whether the Opcode extension should be used. The sole
50 ?S: use for this currently is to allow an easy mechanism
51 ?S: for users to skip the Opcode extension from the Configure
54 ?T:xxx avail_ext this_ext leaf tdir nonxs_extensions find_extensions
55 ?INIT:: set useposix=false in your hint file to disable the POSIX extension.
57 ?INIT:: set useopcode=false in your hint file to disable the Opcode extension.
59 ?LINT:extern noextensions
60 ?LINT:extern onlyextensions
64 echo "Looking for extensions..." >&4
65 : If we are using the old config.sh, known_extensions may contain
66 : old or inaccurate or duplicate values.
69 : We do not use find because it might not be available.
70 : We do not just use MANIFEST because the user may have dropped
71 : some additional extensions into the source tree and expect them
74 : Function to recursively find available extensions, ignoring DynaLoader
75 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
79 DynaLoader|dynaload) ;;
81 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
82 leaf=`echo $xxx | $sed -e s/.*-//`;
83 if $test -d File-Glob; then
85 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
86 known_extensions="$known_extensions $this_ext";
87 elif $contains "\.c$" $$.tmp; then
88 known_extensions="$known_extensions $this_ext";
89 elif $test -d $xxx; then
90 nonxs_extensions="$nonxs_extensions $this_ext";
94 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
95 known_extensions="$known_extensions $1$this_ext";
96 elif $test -f $xxx/Makefile.PL; then
97 nonxs_extensions="$nonxs_extensions $1$this_ext";
99 if $test -d $xxx -a $# -lt 10; then
102 eval $find_extensions;
115 eval $find_extensions
116 if $test -d File-Glob; then
119 # Special case: Add in modules that nest beyond the first level.
120 # Currently threads/shared and Hash/Util/FieldHash, since they are
121 # not picked up by the recursive find above (and adding in general
122 # recursive finding breaks SDBM_File/sdbm).
123 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
124 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
126 set X $known_extensions
128 known_extensions="$*"
129 set X $nonxs_extensions
131 nonxs_extensions="$*"
134 : Now see which are supported on this system.
135 ?X: avail_ext lists available XS extensions.
137 for xxx in $known_extensions ; do
139 ?X: Handle possible DOS 8.3 filename and case alterations
142 $define) avail_ext="$avail_ext $xxx" ;;
147 $define) avail_ext="$avail_ext $xxx" ;;
150 I18N/Langinfo|i18n_lan)
151 case "$i_langinfo$d_nl_langinfo" in
152 $define$define) avail_ext="$avail_ext $xxx" ;;
156 : XXX Do we need a useipcsysv variable here
157 case "${d_msg}${d_sem}${d_shm}" in
158 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
164 case "$osname-$use64bitint" in
167 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
170 *) avail_ext="$avail_ext $xxx" ;;
176 case "${i_dbm}${i_rpcsvcdbm}" in
178 case "$d_cplusplus" in
179 define) ;; # delete as a function name will not work
180 *) case "$osname-$use64bitint" in
183 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
186 *) avail_ext="$avail_ext $xxx" ;;
195 true|define|y) avail_ext="$avail_ext $xxx" ;;
200 true|define|y) avail_ext="$avail_ext $xxx" ;;
207 beos) ;; # not unless BONE
208 *) avail_ext="$avail_ext $xxx" ;;
213 Sys/Syslog|sys/syslog)
214 : XXX syslog requires socket
216 true|$define|y) avail_ext="$avail_ext $xxx" ;;
220 case "$usethreads" in
222 case "$use5005threads" in
223 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
227 threads|threads/shared)
228 # threads and threads::shared are special cases.
229 # To stop people from asking "Perl 5.8.0 was supposed
230 # to have this new fancy threads implementation but my
231 # perl doesn't have it" and from people trying to
232 # (re)install the threads module using CPAN.pm and
233 # CPAN.pm then offering to reinstall Perl 5.8.0,
234 # the threads.pm and threads/shared.pm will always be
235 # there, croaking informatively ("you need to rebuild
236 # all of Perl with threads, sorry") when threads haven't
239 avail_ext="$avail_ext $xxx"
245 cygwin) avail_ext="$avail_ext $xxx" ;;
248 XS/APItest|xs/apitest)
249 # This is just for testing. Skip it unless we have dynamic loading.
252 $define) avail_ext="$avail_ext $xxx" ;;
255 XS/Typemap|xs/typemap)
256 # This is just for testing. Skip it unless we have dynamic loading.
258 $define) avail_ext="$avail_ext $xxx" ;;
261 *) avail_ext="$avail_ext $xxx"
270 case "$onlyextensions" in
273 echo "You have requested that only certains extensions be included..." >&4
274 for i in $onlyextensions; do
275 case " $avail_ext " in
277 echo "Keeping extension $i."
278 keepextensions="$keepextensions $i"
280 *) echo "Ignoring extension $i." ;;
283 avail_ext="$keepextensions"
287 case "$noextensions" in
290 echo "You have requested that certain extensions be ignored..." >&4
291 for i in $avail_ext; do
292 case " $noextensions " in
293 *" $i "*) echo "Ignoring extension $i." ;;
294 *) echo "Keeping extension $i.";
295 keepextensions="$keepextensions $i"
299 avail_ext="$keepextensions"
303 : Now see which nonxs extensions are supported on this system.
304 : For now assume all are.
306 for xxx in $nonxs_extensions ; do
308 *) nonxs_ext="$nonxs_ext $xxx"
320 A number of extensions are supplied with $package. You may choose to
321 compile these extensions for dynamic loading (the default), compile
322 them into the $package executable (static loading), or not include
323 them at all. Answer "none" to include no extensions.
324 Note that DynaLoader is always built and need not be mentioned here.
327 case "$dynamic_ext" in
329 : Exclude those listed in static_ext
331 for xxx in $avail_ext; do
332 case " $static_ext " in
334 *) dflt="$dflt $xxx" ;;
341 *) dflt="$dynamic_ext"
342 # Perhaps we are reusing an old out-of-date config.sh.
345 if test X"$dynamic_ext" != X"$avail_ext"; then
347 NOTICE: Your previous config.sh list may be incorrect.
348 The extensions now available to you are
350 but the default list from your previous config.sh is
362 rp="What extensions do you wish to load dynamically?"
365 ?X: Use ' ' so a subsequent Configure will preserve that value.
366 none) dynamic_ext=' ' ;;
367 *) dynamic_ext="$ans" ;;
370 case "$static_ext" in
372 : Exclude those already listed in dynamic linking
374 for xxx in $avail_ext; do
375 case " $dynamic_ext " in
377 *) dflt="$dflt $xxx" ;;
384 *) dflt="$static_ext"
391 rp="What extensions do you wish to load statically?"
394 ?X: Use ' ' so a subsequent Configure will preserve that value.
395 none) static_ext=' ' ;;
396 *) static_ext="$ans" ;;
401 A number of extensions are supplied with $package. Answer "none"
402 to include no extensions.
403 Note that DynaLoader is always built and need not be mentioned here.
406 case "$static_ext" in
407 '') dflt="$avail_ext" ;;
408 *) dflt="$static_ext"
409 # Perhaps we are reusing an old out-of-date config.sh.
412 if test X"$static_ext" != X"$avail_ext"; then
414 NOTICE: Your previous config.sh list may be incorrect.
415 The extensions now available to you are
417 but the default list from your previous config.sh is
426 : Exclude those that are not xs extensions
430 rp="What extensions do you wish to include?"
433 ?X: Use ' ' so a subsequent Configure will preserve that value.
434 none) static_ext=' ' ;;
435 *) static_ext="$ans" ;;
440 # Encode is a special case. If we are building Encode as a static
441 # extension, we need to explicitly list its subextensions as well.
442 # For other nested extensions, this is handled automatically by
443 # the appropriate Makefile.PL.
444 case " $static_ext " in
445 *" Encode "*) # Add the subextensions of Encode
447 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
448 static_ext="$static_ext Encode/$xxx"
454 set X $dynamic_ext $static_ext $nonxs_ext
458 # Sanity check: We require an extension suitable for use with
459 # AnyDBM_File, as well as Fcntl and IO. (Failure to have these
460 # should show up as failures in the test suite, but it's helpful to
461 # catch them now.) The 'extensions' list is normally sorted
462 # alphabetically, so we need to accept either
463 # DB_File ... Fcntl ... IO ....
465 # Fcntl ... NDBM_File ... IO ....
466 case " $extensions" in
467 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
468 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
469 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
470 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
471 echo "WARNING: The Perl you are building will be quite crippled." >& 4