This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[ID 20000716.023] syslog test fails without sockets
[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 use64bitint \
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-$use64bitint" 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-$use64bitint" 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         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                 ;;
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
184 done
185
186 set X $avail_ext
187 shift
188 avail_ext="$*"
189
190 : Now see which nonxs extensions are supported on this system.
191 : For now assume all are.
192 nonxs_ext=''
193 for xxx in $nonxs_extensions ; do
194         case "$xxx" in
195         *)      nonxs_ext="$nonxs_ext $xxx"
196                 ;;
197         esac
198 done
199
200 set X $nonxs_ext
201 shift
202 nonxs_ext="$*"
203
204 case $usedl in
205 $define)
206         $cat <<EOM
207 A number of extensions are supplied with $package.  You may choose to
208 compile these extensions for dynamic loading (the default), compile
209 them into the $package executable (static loading), or not include
210 them at all.  Answer "none" to include no extensions.
211 Note that DynaLoader is always built and need not be mentioned here.
212
213 EOM
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
222 NOTICE:  Your previous config.sh list may be incorrect. 
223 The extensions now available to you are 
224         ${avail_ext}
225 but the default list from your previous config.sh is
226         ${dynamic_ext} 
227
228 EOM
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
276 A number of extensions are supplied with $package.  Answer "none" 
277 to include no extensions. 
278 Note that DynaLoader is always built and need not be mentioned here.
279
280 EOM
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
289 NOTICE:  Your previous config.sh list may be incorrect. 
290 The extensions now available to you are 
291         ${avail_ext}
292 but the default list from your previous config.sh is
293         ${static_ext} 
294
295 EOM
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         ;;
313 esac
314
315 set X $dynamic_ext $static_ext $nonxs_ext
316 shift
317 extensions="$*"
318