1 | #! /bin/sh |
---|
2 | # |
---|
3 | # If these # comments don't work, trim them. |
---|
4 | # |
---|
5 | # (If you are trying to port this package to a machine without sh, |
---|
6 | # I would suggest you have a look at the prototypical config_p.h file |
---|
7 | # and edit it to reflect your system. Some packages may include samples |
---|
8 | # of config.h for certain machines, so you might look for one of those.) |
---|
9 | # |
---|
10 | # Yes, you may rip this off to use in other distribution packages. This |
---|
11 | # script belongs to the public domain and cannot be copyrighted. |
---|
12 | # |
---|
13 | # (Note: this Configure script was generated automatically. Rather than |
---|
14 | # working with this copy of Configure, you may wish to get metaconfig. |
---|
15 | # The dist-3.0 package (which contains metaconfig) was posted in |
---|
16 | # comp.sources.misc so you may fetch it yourself from your nearest |
---|
17 | # archive site. Check with Archie if you don't know where that can be.) |
---|
18 | # |
---|
19 | |
---|
20 | # Generated on Tue May 10 14:30:48 PDT 1994 [metaconfig 3.0 PL26] |
---|
21 | # |
---|
22 | # Hacked by hand by Paul Vojta, ignoring an earlier paragraph. Removed |
---|
23 | # all the questions, and added an argument to specify the C compiler. |
---|
24 | |
---|
25 | # Modifications to this script are Copyright (c) 1994 Paul Vojta. |
---|
26 | # |
---|
27 | # Redistribution and use in source and binary forms, with or without |
---|
28 | # modification, are permitted provided that the following conditions |
---|
29 | # are met: |
---|
30 | # 1. Redistributions of source code must retain the above copyright |
---|
31 | # notice, this list of conditions and the following disclaimer. |
---|
32 | # 2. Redistributions in binary form must reproduce the above copyright |
---|
33 | # notice, this list of conditions and the following disclaimer in the |
---|
34 | # documentation and/or other materials provided with the distribution. |
---|
35 | # |
---|
36 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
37 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
38 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
39 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
---|
40 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
41 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
42 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
43 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
44 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
45 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
46 | # SUCH DAMAGE. |
---|
47 | |
---|
48 | if test ! -t 0; then |
---|
49 | echo "You must run Configure from make." |
---|
50 | exit 1 |
---|
51 | fi |
---|
52 | |
---|
53 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh |
---|
54 | if test -f /hp-ux -a -f /bin/ksh; then |
---|
55 | if (PATH=.; alias -x) >/dev/null 2>&1; then |
---|
56 | : already under /bin/ksh |
---|
57 | else |
---|
58 | cat <<'EOM' |
---|
59 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) |
---|
60 | EOM |
---|
61 | exec /bin/ksh $0 "$@" |
---|
62 | fi |
---|
63 | else |
---|
64 | : Warn them if they use ksh on other systems |
---|
65 | (PATH=.; alias -x) >/dev/null 2>&1 && \ |
---|
66 | cat <<'EOM' |
---|
67 | (I see you are using the Korn shell. Some ksh's blow up on Configure, |
---|
68 | especially on exotic machines. If yours does, try the Bourne shell instead.) |
---|
69 | EOM |
---|
70 | fi |
---|
71 | |
---|
72 | : Check for arguments |
---|
73 | if test $# -eq 0; then |
---|
74 | echo "You must specify an argument saying what C compiler you're using." |
---|
75 | exit 1 |
---|
76 | fi |
---|
77 | |
---|
78 | echo "Sanity check first..." |
---|
79 | cat <<EOF >cfg_test.c |
---|
80 | #include <stdio.h> |
---|
81 | main() {puts("Hello world");} |
---|
82 | EOF |
---|
83 | if $* -o cfg_test cfg_test.c; then |
---|
84 | : blank line |
---|
85 | else |
---|
86 | echo "" |
---|
87 | echo "This is not gonna work. I'm sorry, but you'll have to edit" |
---|
88 | echo "config.h by hand." |
---|
89 | cp config_p.h config.h |
---|
90 | exit 1 |
---|
91 | fi |
---|
92 | |
---|
93 | echo "Checking for stdlib.h" |
---|
94 | cat <<EOF >config.h |
---|
95 | /* |
---|
96 | * This file was generated automatically by the Configure script. |
---|
97 | * Run Configure again to make any necessary changes, or copy |
---|
98 | * config_p.h to config.h and then start editing. |
---|
99 | */ |
---|
100 | |
---|
101 | /* Include <stdlib.h>, if it exists. */ |
---|
102 | EOF |
---|
103 | cat <<EOF >cfg_test.c |
---|
104 | #include <stdlib.h> |
---|
105 | #include <stdio.h> |
---|
106 | main() {puts("Hello world");} |
---|
107 | EOF |
---|
108 | if $* -c cfg_test.c >/dev/null 2>&1; then |
---|
109 | stdlib='yes' |
---|
110 | echo "#include <stdlib.h>" >>config.h |
---|
111 | else |
---|
112 | stdlib='no' |
---|
113 | echo "/* #include <stdlib.h> */" >>config.h |
---|
114 | fi |
---|
115 | |
---|
116 | echo "Checking for stdarg.h" |
---|
117 | cat <<EOF >>config.h |
---|
118 | |
---|
119 | /* Always include this one. */ |
---|
120 | #include <stdio.h> |
---|
121 | |
---|
122 | /* Define I_STDARG if there's a stdarg.h. */ |
---|
123 | EOF |
---|
124 | cat <<EOF >cfg_test.c |
---|
125 | #include "config.h" |
---|
126 | #include <stdarg.h> |
---|
127 | main() {puts("Hello world");} |
---|
128 | EOF |
---|
129 | if $* -c cfg_test.c >/dev/null 2>&1; then |
---|
130 | echo "#define I_STDARG" >>config.h |
---|
131 | else |
---|
132 | echo "#undef I_STDARG" >>config.h |
---|
133 | fi |
---|
134 | |
---|
135 | echo "Checking for string.h vs. strings.h" |
---|
136 | cat <<EOF >>config.h |
---|
137 | |
---|
138 | /* Include either <string.h> or <strings.h> here. */ |
---|
139 | EOF |
---|
140 | |
---|
141 | cat <<EOF >cfg_test.c |
---|
142 | #include "config.h" |
---|
143 | #include <string.h> |
---|
144 | main() {puts("Hello world");} |
---|
145 | EOF |
---|
146 | if $* -c cfg_test.c >/dev/null 2>&1; then |
---|
147 | string='string' |
---|
148 | else |
---|
149 | string='strings' |
---|
150 | fi |
---|
151 | echo "#include <$string.h>" >>config.h |
---|
152 | |
---|
153 | cat <<EOF >>config.h |
---|
154 | |
---|
155 | /* Include <memory.h>, if appropriate. Note that it may have been left |
---|
156 | out even though it exists. We do this because of conflicts on many |
---|
157 | systems. But if it works, then it works. */ |
---|
158 | EOF |
---|
159 | memory='no' |
---|
160 | if test "$stdlib $string" = "no string"; then |
---|
161 | echo "Checking for memory.h" |
---|
162 | cat <<EOF >cfg_test.c |
---|
163 | #include "config.h" |
---|
164 | #include <memory.h> |
---|
165 | main() {puts("Hello world");} |
---|
166 | EOF |
---|
167 | if $* -c cfg_test.c >/dev/null 2>&1; then |
---|
168 | memory='yes' |
---|
169 | fi |
---|
170 | fi |
---|
171 | if test $memory = 'yes'; then |
---|
172 | echo "#include <memory.h>" >>config.h |
---|
173 | else |
---|
174 | echo "/* #include <memory.h> */" >>config.h |
---|
175 | fi |
---|
176 | |
---|
177 | cat <<EOF >>config.h |
---|
178 | |
---|
179 | /* Include <unistd.h> if it exists. */ |
---|
180 | EOF |
---|
181 | echo "Checking for unistd.h" |
---|
182 | cat <<EOF >cfg_test.c |
---|
183 | #include "config.h" |
---|
184 | #include <unistd.h> |
---|
185 | main() {puts("Hello world");} |
---|
186 | EOF |
---|
187 | if $* -c cfg_test.c >/dev/null 2>&1; then |
---|
188 | echo "#include <unistd.h>" >>config.h |
---|
189 | else |
---|
190 | echo "/* #include <unistd.h> */" >>config.h |
---|
191 | fi |
---|
192 | |
---|
193 | echo "Checking for vfork()" |
---|
194 | cat <<EOF >cfg_test.c |
---|
195 | #include "config.h" |
---|
196 | main() {(void) vfork();} |
---|
197 | EOF |
---|
198 | if $* -o cfg_test cfg_test.c >/dev/null 2>&1; then |
---|
199 | vfork='yes' |
---|
200 | else |
---|
201 | vfork='no' |
---|
202 | fi |
---|
203 | |
---|
204 | vforkinc='no' |
---|
205 | if test $vfork = 'yes'; then |
---|
206 | echo "Checking for vfork.h" |
---|
207 | cat <<EOF >cfg_test.c |
---|
208 | #include "config.h" |
---|
209 | #include <vfork.h> |
---|
210 | main() {puts("Hello world");} |
---|
211 | EOF |
---|
212 | if $* -c cfg_test.c >/dev/null 2>&1; then |
---|
213 | vforkinc='yes' |
---|
214 | fi |
---|
215 | fi |
---|
216 | |
---|
217 | cat <<EOF >>config.h |
---|
218 | |
---|
219 | /* If the system has vfork(), then it may require us to include vfork.h */ |
---|
220 | EOF |
---|
221 | if test $vforkinc = yes; then |
---|
222 | echo "#include <vfork.h>" >>config.h |
---|
223 | else |
---|
224 | echo "/* #include <vfork.h> */" >>config.h |
---|
225 | fi |
---|
226 | |
---|
227 | cat <<EOF >>config.h |
---|
228 | |
---|
229 | /* Define this if POSIX <dirent.h> instead of old <sys/dir.h>. */ |
---|
230 | EOF |
---|
231 | echo "Checking for dirent.h vs. sys/dir.h" |
---|
232 | cat <<EOF >cfg_test.c |
---|
233 | #include "config.h" |
---|
234 | #include <dirent.h> |
---|
235 | main() {puts("Hello world");} |
---|
236 | EOF |
---|
237 | if $* -c cfg_test.c >/dev/null 2>&1; then |
---|
238 | echo "#define POSIX_DIRENT" >>config.h |
---|
239 | else |
---|
240 | echo "/* #define POSIX_DIRENT */" >>config.h |
---|
241 | fi |
---|
242 | |
---|
243 | echo "Checking for bzero()" |
---|
244 | cat <<EOF >>config.h |
---|
245 | |
---|
246 | /* If the system has bzero(), use it; otherwise hope they have memset() */ |
---|
247 | EOF |
---|
248 | cat <<EOF >cfg_test.c |
---|
249 | #include "config.h" |
---|
250 | main() {int i; bzero(&i, 1);} |
---|
251 | EOF |
---|
252 | if $* -o cfg_test cfg_test.c >/dev/null 2>&1; then |
---|
253 | echo "/* #define bzero(s, n) memset((s), 0, (n)) */" >>config.h |
---|
254 | else |
---|
255 | echo "#define bzero(s, n) memset((s), 0, (n))" >>config.h |
---|
256 | fi |
---|
257 | |
---|
258 | echo "Checking for memcmp()" |
---|
259 | cat <<EOF >>config.h |
---|
260 | |
---|
261 | /* If the system has memcmp(), use it; otherwise hope they have bcmp() */ |
---|
262 | EOF |
---|
263 | cat <<EOF >cfg_test.c |
---|
264 | #include "config.h" |
---|
265 | main() {char c; memcmp(&c, &c, 1);} |
---|
266 | EOF |
---|
267 | if $* -o cfg_test cfg_test.c >/dev/null 2>&1; then |
---|
268 | echo "/* #define memcmp bcmp */" >>config.h |
---|
269 | else |
---|
270 | echo "#define memcmp bcmp" >>config.h |
---|
271 | fi |
---|
272 | |
---|
273 | echo "Checking for memcpy()" |
---|
274 | cat <<EOF >>config.h |
---|
275 | |
---|
276 | /* If the system has memcpy(), use it; otherwise hope they have bcopy() */ |
---|
277 | EOF |
---|
278 | cat <<EOF >cfg_test.c |
---|
279 | #include "config.h" |
---|
280 | main() {char c; memcpy(&c, &c, 1);} |
---|
281 | EOF |
---|
282 | if $* -o cfg_test cfg_test.c >/dev/null 2>&1; then |
---|
283 | echo "/* #define memcpy(d, s, n) bcopy(s, d, n) */" >>config.h |
---|
284 | else |
---|
285 | echo "#define memcpy(d, s, n) bcopy(s, d, n)" >>config.h |
---|
286 | fi |
---|
287 | |
---|
288 | echo "Checking for strchr()" |
---|
289 | cat <<EOF >>config.h |
---|
290 | |
---|
291 | /* If the system has strchr(), use it; otherwise hope they have index() */ |
---|
292 | /* Likewise for strrchr() and rindex() */ |
---|
293 | EOF |
---|
294 | cat <<EOF >cfg_test.c |
---|
295 | #include "config.h" |
---|
296 | main() {char c; (void) strchr("foo", 'b');} |
---|
297 | EOF |
---|
298 | if $* -o cfg_test cfg_test.c >/dev/null 2>&1; then |
---|
299 | echo "/* #define strchr index */" >>config.h |
---|
300 | echo "/* #define strrchr rindex */" >>config.h |
---|
301 | else |
---|
302 | echo "#define strchr index" >>config.h |
---|
303 | echo "#define strrchr rindex" >>config.h |
---|
304 | fi |
---|
305 | |
---|
306 | cat <<EOF >>config.h |
---|
307 | |
---|
308 | /* Use vfork() if it's available; otherwise, fork() */ |
---|
309 | EOF |
---|
310 | if test $vfork = 'yes'; then |
---|
311 | echo "/* #define vfork fork */" >>config.h |
---|
312 | else |
---|
313 | echo "#define vfork fork" >>config.h |
---|
314 | fi |
---|
315 | |
---|
316 | rm -f cfg_test.c cfg_test.o cfg_test |
---|
317 | echo "Done." |
---|
318 | exit 0 |
---|