Commit | Line | Data |
5f51ce50 |
1 | ?RCS: $Id: Extensions.U,v$ |
2 | ?RCS: |
3 | ?RCS: You may redistribute only under the terms of the Artistic Licence, |
4 | ?RCS: as specified in the README file that comes with the distribution. |
5 | ?RCS: You may reuse parts of this distribution only within the terms of |
6 | ?RCS: that same Artistic Licence; a copy of which may be found at the root |
7 | ?RCS: of the source tree for dist 3.0. |
8 | ?RCS: |
9 | ?RCS: $Log: Extensions.U,v $ |
10 | ?RCS: |
11 | ?MAKE:known_extensions extensions dynamic_ext static_ext useposix : \ |
12 | Myread usedl d_socket i_db i_dbm i_ndbm i_gdbm package test cat |
13 | ?MAKE: -pick add $@ %< |
14 | ?S:known_extensions: |
15 | ?S: This variable holds a list of all extensions included in |
16 | ?S: the package. |
17 | ?S:. |
18 | ?S:dynamic_ext: |
19 | ?S: This variable holds a list of extension files we want to |
20 | ?S: link dynamically into the package. It is used by Makefile. |
21 | ?S:. |
22 | ?S:static_ext: |
23 | ?S: This variable holds a list of extension files we want to |
24 | ?S: link statically into the package. It is used by Makefile. |
25 | ?S:. |
26 | ?S:extensions: |
27 | ?S: This variable holds a list of all extension files |
28 | ?S: linked into the package. It is propagated to Config.pm |
29 | ?S: and is typically used to test whether a particular extesion |
30 | ?S: is available. |
31 | ?S:. |
32 | ?S:useposix: |
33 | ?S: This variable holds either 'true' or 'false' to indicate |
34 | ?S: whether the POSIX extension should be used. The sole |
35 | ?S: use for this currently is to allow an easy mechanism |
36 | ?S: for hints files to indicate that POSIX will not compile |
37 | ?S: on a particular system. |
38 | ?S:. |
fec02dd3 |
39 | ?T:xxx yyy avail_ext |
5f51ce50 |
40 | ?INIT:: set useposix=false in your hint file to disable the POSIX extension. |
41 | ?INIT:useposix=true |
42 | echo " " |
43 | echo "Looking for extensions..." >&4 |
44 | cd ../ext |
fec02dd3 |
45 | : If we are using the old config.sh, known_extensions may contain |
46 | : old or inaccurate or duplicate values. |
5f51ce50 |
47 | known_extensions='' |
fec02dd3 |
48 | : We do not use find because it might not be available. |
49 | : We do not just use MANIFEST because the user may have dropped |
50 | : some additional extensions into the source tree and expect them |
51 | : to be built. |
5f51ce50 |
52 | for xxx in * ; do |
53 | if $test -f $xxx/$xxx.xs; then |
54 | known_extensions="$known_extensions $xxx" |
fec02dd3 |
55 | else |
56 | if $test -d $xxx; then |
57 | cd $xxx |
58 | for yyy in * ; do |
59 | if $test -f $yyy/$yyy.xs; then |
60 | known_extensions="$known_extensions $xxx/$yyy" |
61 | fi |
62 | done |
63 | cd .. |
64 | fi |
5f51ce50 |
65 | fi |
66 | done |
67 | set X $known_extensions |
68 | shift |
69 | known_extensions="$*" |
70 | cd ../UU |
71 | |
72 | : Now see which are supported on this system. |
73 | avail_ext='' |
74 | for xxx in $known_extensions ; do |
75 | case "$xxx" in |
76 | DB_File) case "$i_db" in |
77 | $define) avail_ext="$avail_ext $xxx" ;; |
78 | esac |
79 | ;; |
80 | GDBM_File) case "$i_gdbm" in |
81 | $define) avail_ext="$avail_ext $xxx" ;; |
82 | esac |
83 | ;; |
84 | NDBM_File) case "$i_ndbm" in |
85 | $define) avail_ext="$avail_ext $xxx" ;; |
86 | esac |
87 | ;; |
88 | ODBM_File) case "$i_dbm" in |
89 | $define) avail_ext="$avail_ext $xxx" ;; |
90 | esac |
91 | ;; |
92 | POSIX) case "$useposix" in |
93 | true|define|y) avail_ext="$avail_ext $xxx" ;; |
94 | esac |
95 | ;; |
96 | Socket) case "$d_socket" in |
97 | $define) avail_ext="$avail_ext $xxx" ;; |
98 | esac |
99 | ;; |
100 | *) avail_ext="$avail_ext $xxx" |
101 | ;; |
102 | esac |
103 | done |
104 | |
105 | set X $avail_ext |
106 | shift |
107 | avail_ext="$*" |
108 | |
109 | case $usedl in |
110 | $define) |
111 | $cat <<EOM |
112 | A number of extensions are supplied with $package. You may choose to |
113 | compile these extensions for dynamic loading (the default), compile |
114 | them into the $package executable (static loading), or not include |
115 | them at all. Answer "none" to include no extensions. |
116 | |
117 | EOM |
118 | case "$dynamic_ext" in |
119 | ''|' ') dflt="$avail_ext" ;; |
120 | *) dflt="$dynamic_ext" ;; |
121 | esac |
122 | case "$dflt" in |
123 | '') dflt=none;; |
124 | esac |
125 | rp="What extensions do you wish to load dynamically?" |
126 | . ./myread |
127 | case "$ans" in |
128 | none) dynamic_ext='' ;; |
129 | *) dynamic_ext="$ans" ;; |
130 | esac |
131 | |
132 | case "$static_ext" in |
133 | ''|' ') |
134 | : Exclude those already listed in dynamic linking |
135 | dflt='' |
136 | for xxx in $avail_ext; do |
137 | case " $dynamic_ext " in |
138 | *" $xxx "*) ;; |
139 | *) dflt="$dflt $xxx" ;; |
140 | esac |
141 | done |
142 | set X $dflt |
143 | shift |
144 | dflt="$*" |
145 | ;; |
146 | *) dflt="$static_ext" |
147 | ;; |
148 | esac |
149 | |
150 | case "$dflt" in |
151 | '') dflt=none;; |
152 | esac |
153 | rp="What extensions do you wish to load statically?" |
154 | . ./myread |
155 | case "$ans" in |
156 | none) static_ext='' ;; |
157 | *) static_ext="$ans" ;; |
158 | esac |
159 | ;; |
160 | *) |
161 | $cat <<EOM |
162 | A number of extensions are supplied with $package. Answer "none" |
163 | to include no extensions. |
164 | |
165 | EOM |
166 | case "$static_ext" in |
167 | ''|' ') dflt="$avail_ext" ;; |
168 | *) dflt="$static_ext" ;; |
169 | esac |
170 | |
171 | case "$dflt" in |
172 | '') dflt=none;; |
173 | esac |
174 | rp="What extensions do you wish to include?" |
175 | . ./myread |
176 | case "$ans" in |
177 | none) static_ext='' ;; |
178 | *) static_ext="$ans" ;; |
179 | esac |
180 | ;; |
181 | esac |
182 | |
183 | set X $dynamic_ext $static_ext |
184 | shift |
185 | extensions="$*" |
186 | |