This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
HP-UX 64-bitness/largefile fixes.
[metaconfig.git] / U / perl / Extensions.U
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 osname use64bits \
14         libs
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
58 echo " "
59 echo "Looking for extensions..." >&4
60 : If we are using the old config.sh, known_extensions may contain
61 : old or inaccurate or duplicate values.
62 known_extensions=''
63 nonxs_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
71 find_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;
87                fi;
88            fi
89            ;;
90        esac;
91     done'
92 tdir=`pwd`
93 cd $rsrc/ext
94 set X
95 shift
96 eval $find_extensions
97 set X $nonxs_extensions
98 shift
99 nonxs_extensions="$*"
100 set X $known_extensions
101 shift
102 known_extensions="$*"
103 cd $tdir
104
105 : Now see which are supported on this system.
106 ?X: avail_ext lists available XS extensions.
107 avail_ext=''
108 for 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
123                 $define)
124                     case "$osname-$use64bits" in
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                     ;;
133                 esac
134                 ;;
135         ODBM_File|odbm_fil) 
136                 case "${i_dbm}${i_rpcsvcdbm}" in
137                 *"${define}"*)
138                     case "$osname-$use64bits" in
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                     ;;
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
178 done
179
180 set X $avail_ext
181 shift
182 avail_ext="$*"
183
184 : Now see which nonxs extensions are supported on this system.
185 : For now assume all are.
186 nonxs_ext=''
187 for xxx in $nonxs_extensions ; do
188         case "$xxx" in
189         *)      nonxs_ext="$nonxs_ext $xxx"
190                 ;;
191         esac
192 done
193
194 set X $nonxs_ext
195 shift
196 nonxs_ext="$*"
197
198 case $usedl in
199 $define)
200         $cat <<EOM
201 A number of extensions are supplied with $package.  You may choose to
202 compile these extensions for dynamic loading (the default), compile
203 them into the $package executable (static loading), or not include
204 them at all.  Answer "none" to include no extensions.
205 Note that DynaLoader is always built and need not be mentioned here.
206
207 EOM
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
216 NOTICE:  Your previous config.sh list may be incorrect. 
217 The extensions now available to you are 
218         ${avail_ext}
219 but the default list from your previous config.sh is
220         ${dynamic_ext} 
221
222 EOM
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
270 A number of extensions are supplied with $package.  Answer "none" 
271 to include no extensions. 
272 Note that DynaLoader is always built and need not be mentioned here.
273
274 EOM
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
283 NOTICE:  Your previous config.sh list may be incorrect. 
284 The extensions now available to you are 
285         ${avail_ext}
286 but the default list from your previous config.sh is
287         ${static_ext} 
288
289 EOM
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         ;;
307 esac
308
309 set X $dynamic_ext $static_ext $nonxs_ext
310 shift
311 extensions="$*"
312