This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add support for assertions. Updated form of:
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
f6538904 23# Generated on Mon Feb 3 15:49:19 EET 2003 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62 25
283fdd21 26cat >c1$$ <<EOF
2304df62
AD
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
283fdd21 37cat >c2$$ <<EOF
2304df62
AD
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
283fdd21 43true || cat c1$$ c2$$
2304df62
AD
44true || exec sh $0 $argv:q
45
283fdd21 46(exit $?0) || cat c2$$
2304df62 47(exit $?0) || exec sh $0 $argv:q
283fdd21 48rm -f c1$$ c2$$
2304df62 49
f6538904 50if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
51 cat >&4 <<EOF
52***
53*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
55*** Please read the README.plan9 for further instructions.
56*** Cannot continue, aborting.
57***
58EOF
59 exit 1
60fi
61
a0d0e21e
LW
62: compute my invocation name
63me=$0
64case "$0" in
65*/*)
66 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67 test "$me" || me=$0
68 ;;
69esac
70
dfe9444c 71: Proper separator for the PATH environment variable
8e07c86e
AD
72p_=:
73: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
74if test -d c:/. ; then
75 if test -n "$OS2_SHELL"; then
76 p_=\;
77 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 79 elif test -n "$DJGPP"; then
495e2cbe
MB
80 case "X${MACHTYPE:-nonesuchmach}" in
81 *cygwin) ;;
82 *) p_=\; ;;
83 esac
dfe9444c 84 fi
39e571d4 85fi
a0d0e21e
LW
86
87: Proper PATH setting
88paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 89paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 90paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 91paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
92paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
93paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
94paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
95paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 96paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
97
98for p in $paths
99do
8e07c86e
AD
100 case "$p_$PATH$p_" in
101 *$p_$p$p_*) ;;
102 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
103 esac
104done
105
8e07c86e 106PATH=.$p_$PATH
2304df62
AD
107export PATH
108
dfe9444c
AD
109: shall we be using ksh?
110inksh=''
111needksh=''
112avoidksh=''
113newsh=/bin/ksh
114changesh=''
ff0cee69 115if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
116 inksh=true
117fi
118if test -f /hp-ux -a -f /bin/ksh; then
119 needksh='to avoid sh bug in "here document" expansion'
120fi
121if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
122 if test X`/usr/bin/uname -v` = X4; then
123 avoidksh="to avoid AIX 4's /bin/sh"
124 newsh=/usr/bin/bsh
2304df62 125 fi
dfe9444c 126fi
cf04f91f
JH
127if test -f /osf_boot -a -f /usr/sbin/setld; then
128 if test X`/usr/bin/uname -s` = XOSF1; then
129 avoidksh="to avoid Digital UNIX' ksh"
130 newsh=/bin/sh
131 unset BIN_SH # if this is 'xpg4' sh will start up ksh
132 fi
133fi
dfe9444c
AD
134case "$inksh/$needksh" in
135/[a-z]*)
c4f23d77 136 ENV=''
dfe9444c
AD
137 changesh=true
138 reason="$needksh"
139 ;;
140esac
141case "$inksh/$avoidksh" in
142true/[a-z]*)
143 changesh=true
144 reason="$avoidksh"
145 ;;
146esac
147case "$inksh/$needksh-$avoidksh-" in
148true/--)
a0d0e21e
LW
149 cat <<EOM
150(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 151mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 152EOM
dfe9444c
AD
153 ;;
154esac
155case "$changesh" in
156true)
2e2a97a6 157 export newsh
dfe9444c
AD
158 echo "(Feeding myself to $newsh $reason.)"
159 case "$0" in
160 Configure|*/Configure) exec $newsh $0 "$@";;
161 *) exec $newsh Configure "$@";;
162 esac
163 ;;
164esac
2304df62 165
bfb7748a
AD
166: if needed set CDPATH to a harmless value that is not chatty
167: avoid bash 2.02 problems with empty CDPATH.
168case "$CDPATH" in
169'') ;;
170*) case "$SHELL" in
171 *bash*) CDPATH='.' ;;
172 *) CDPATH='' ;;
173 esac
174 ;;
175esac
2304df62
AD
176: Configure runs within the UU subdirectory
177test -d UU || mkdir UU
8e07c86e 178cd UU && rm -f ./*
2304df62 179
6b356c8e
JH
180ccname=''
181ccversion=''
b4eb6b3d
JH
182ccsymbols=''
183cppccsymbols=''
184cppsymbols=''
5440bc8e
JH
185from=''
186run=''
187targetarch=''
188to=''
189usecrosscompile=''
9c839522 190perllibs=''
b4eb6b3d
JH
191dynamic_ext=''
192extensions=''
193known_extensions=''
194nonxs_ext=''
195static_ext=''
196useopcode=''
197useposix=''
6fcddf3b 198extras=''
ecfc5424 199d_bsd=''
40a7a20a 200d_eunice=''
2304df62
AD
201d_xenix=''
202eunicefix=''
203Mcc=''
dfe9444c 204ar=''
2304df62
AD
205awk=''
206bash=''
207bison=''
208byacc=''
209cat=''
210chgrp=''
211chmod=''
212chown=''
ecfc5424 213comm=''
2304df62
AD
214compress=''
215cp=''
216cpio=''
217cpp=''
218csh=''
219date=''
220echo=''
221egrep=''
222emacs=''
223expr=''
224find=''
225flex=''
3c728e00 226gmake=''
2304df62 227grep=''
8ff267be 228gzip=''
2304df62
AD
229inews=''
230ksh=''
231less=''
232line=''
233lint=''
234ln=''
235lp=''
236lpr=''
237ls=''
238mail=''
239mailx=''
dfe9444c 240make=''
2304df62
AD
241mkdir=''
242more=''
243mv=''
693762b4 244nm=''
2304df62
AD
245nroff=''
246perl=''
247pg=''
248pmake=''
249pr=''
250rm=''
251rmail=''
252sed=''
253sendmail=''
2304df62
AD
254shar=''
255sleep=''
256smail=''
257sort=''
258submit=''
259tail=''
260tar=''
261tbl=''
693762b4 262tee=''
2304df62
AD
263test=''
264touch=''
265tr=''
266troff=''
267uname=''
268uniq=''
269uuname=''
270vi=''
271zcat=''
8ff267be 272zip=''
b4eb6b3d
JH
273full_ar=''
274full_sed=''
a0d0e21e 275libswanted=''
2304df62
AD
276hint=''
277myuname=''
85e6fe83
LW
278osname=''
279osvers=''
2304df62
AD
280Author=''
281Date=''
282Header=''
283Id=''
284Locker=''
285Log=''
286RCSfile=''
287Revision=''
288Source=''
289State=''
dfe9444c
AD
290_a=''
291_exe=''
292_o=''
4633a7c4
LW
293archobjs=''
294exe_ext=''
295firstmakefile=''
296lib_ext=''
297obj_ext=''
298path_sep=''
b4eb6b3d 299afs=''
a6d26a0d 300afsroot=''
b4eb6b3d
JH
301alignbytes=''
302ansi2knr=''
303archlib=''
304archlibexp=''
305d_archlib=''
306installarchlib=''
307archname=''
308myarchname=''
309d_atolf=''
310d_atoll=''
311baserev=''
312bin=''
313binexp=''
314installbin=''
b4eb6b3d 315byteorder=''
2304df62 316cc=''
2304df62
AD
317ccflags=''
318cppflags=''
319ldflags=''
320lkflags=''
8e07c86e 321locincpth=''
2304df62 322optimize=''
b4eb6b3d 323cf_email=''
2304df62
AD
324cf_by=''
325cf_time=''
b4eb6b3d 326charsize=''
2304df62 327contains=''
b4eb6b3d 328cpp_stuff=''
2304df62
AD
329cpplast=''
330cppminus=''
331cpprun=''
332cppstdin=''
74cac757 333d__fwalk=''
b4eb6b3d
JH
334d_access=''
335d_accessx=''
336d_alarm=''
10bc17b6
JH
337asctime_r_proto=''
338d_asctime_r=''
b4eb6b3d
JH
339d_attribut=''
340d_bcmp=''
341d_bcopy=''
342d_bzero=''
343d_casti32=''
344castflags=''
345d_castneg=''
346d_chown=''
347d_chroot=''
348d_chsize=''
758a5d79 349d_class=''
b4eb6b3d
JH
350d_closedir=''
351d_void_closedir=''
4e0554ec 352d_cmsghdr_s=''
b4eb6b3d
JH
353d_const=''
354cryptlib=''
355d_crypt=''
10bc17b6
JH
356crypt_r_proto=''
357d_crypt_r=''
b4eb6b3d
JH
358d_csh=''
359full_csh=''
10bc17b6
JH
360ctermid_r_proto=''
361d_ctermid_r=''
362ctime_r_proto=''
363d_ctime_r=''
b4eb6b3d
JH
364d_cuserid=''
365d_dbl_dig=''
2ef53570 366d_dbminitproto=''
b4eb6b3d 367d_difftime=''
ae0e3d3b 368d_dirfd=''
b4eb6b3d 369d_dlerror=''
a0d0e21e 370d_dlopen=''
b4eb6b3d
JH
371d_dlsymun=''
372d_dosuid=''
373d_suidsafe=''
10bc17b6
JH
374d_drand48_r=''
375drand48_r_proto=''
b4eb6b3d
JH
376d_drand48proto=''
377d_dup2=''
378d_eaccess=''
379d_endgrent=''
10bc17b6
JH
380d_endgrent_r=''
381endgrent_r_proto=''
b4eb6b3d 382d_endhent=''
10bc17b6
JH
383d_endhostent_r=''
384endhostent_r_proto=''
b4eb6b3d 385d_endnent=''
10bc17b6
JH
386d_endnetent_r=''
387endnetent_r_proto=''
b4eb6b3d 388d_endpent=''
10bc17b6
JH
389d_endprotoent_r=''
390endprotoent_r_proto=''
b4eb6b3d 391d_endpwent=''
10bc17b6
JH
392d_endpwent_r=''
393endpwent_r_proto=''
b4eb6b3d 394d_endsent=''
10bc17b6
JH
395d_endservent_r=''
396endservent_r_proto=''
b363b713 397d_fchdir=''
b4eb6b3d
JH
398d_fchmod=''
399d_fchown=''
400d_fcntl=''
9d9004a9 401d_fcntl_can_lock=''
b4eb6b3d
JH
402d_fd_macros=''
403d_fd_set=''
404d_fds_bits=''
405d_fgetpos=''
758a5d79
JH
406d_finite=''
407d_finitel=''
b4eb6b3d
JH
408d_flexfnam=''
409d_flock=''
2ef53570 410d_flockproto=''
b4eb6b3d 411d_fork=''
758a5d79
JH
412d_fp_class=''
413d_fpclass=''
414d_fpclassify=''
415d_fpclassl=''
b4eb6b3d
JH
416d_fpos64_t=''
417d_frexpl=''
418d_fs_data_s=''
419d_fseeko=''
420d_fsetpos=''
421d_fstatfs=''
411ab01c 422d_fsync=''
b4eb6b3d
JH
423d_ftello=''
424d_ftime=''
425d_gettimeod=''
426d_Gconvert=''
427d_getcwd=''
428d_getespwnam=''
429d_getfsstat=''
430d_getgrent=''
10bc17b6
JH
431d_getgrent_r=''
432getgrent_r_proto=''
433d_getgrgid_r=''
434getgrgid_r_proto=''
435d_getgrnam_r=''
436getgrnam_r_proto=''
b4eb6b3d
JH
437d_getgrps=''
438d_gethbyaddr=''
439d_gethbyname=''
440d_gethent=''
441aphostname=''
442d_gethname=''
443d_phostname=''
444d_uname=''
10bc17b6
JH
445d_gethostbyaddr_r=''
446gethostbyaddr_r_proto=''
447d_gethostbyname_r=''
448gethostbyname_r_proto=''
449d_gethostent_r=''
450gethostent_r_proto=''
b4eb6b3d 451d_gethostprotos=''
4e0554ec 452d_getitimer=''
b4eb6b3d 453d_getlogin=''
10bc17b6
JH
454d_getlogin_r=''
455getlogin_r_proto=''
b4eb6b3d
JH
456d_getmnt=''
457d_getmntent=''
458d_getnbyaddr=''
459d_getnbyname=''
460d_getnent=''
10bc17b6
JH
461d_getnetbyaddr_r=''
462getnetbyaddr_r_proto=''
463d_getnetbyname_r=''
464getnetbyname_r_proto=''
465d_getnetent_r=''
466getnetent_r_proto=''
b4eb6b3d 467d_getnetprotos=''
0c0643d0 468d_getpagsz=''
b4eb6b3d
JH
469d_getpent=''
470d_getpgid=''
471d_getpgrp2=''
472d_bsdgetpgrp=''
473d_getpgrp=''
474d_getppid=''
475d_getprior=''
476d_getpbyname=''
477d_getpbynumber=''
10bc17b6
JH
478d_getprotobyname_r=''
479getprotobyname_r_proto=''
480d_getprotobynumber_r=''
481getprotobynumber_r_proto=''
482d_getprotoent_r=''
483getprotoent_r_proto=''
b4eb6b3d
JH
484d_getprotoprotos=''
485d_getprpwnam=''
486d_getpwent=''
10bc17b6
JH
487d_getpwent_r=''
488getpwent_r_proto=''
489d_getpwnam_r=''
490getpwnam_r_proto=''
491d_getpwuid_r=''
492getpwuid_r_proto=''
b4eb6b3d 493d_getsent=''
10bc17b6
JH
494d_getservbyname_r=''
495getservbyname_r_proto=''
496d_getservbyport_r=''
497getservbyport_r_proto=''
498d_getservent_r=''
499getservent_r_proto=''
b4eb6b3d
JH
500d_getservprotos=''
501d_getspnam=''
10bc17b6
JH
502d_getspnam_r=''
503getspnam_r_proto=''
b4eb6b3d
JH
504d_getsbyname=''
505d_getsbyport=''
10bc17b6
JH
506d_gmtime_r=''
507gmtime_r_proto=''
a4f3eea9 508d_gnulibc=''
5f6e0ee4 509gnulibc_version=''
b4eb6b3d
JH
510d_hasmntopt=''
511d_htonl=''
b4eb6b3d
JH
512d_inetaton=''
513d_int64_t=''
514d_isascii=''
758a5d79
JH
515d_isfinite=''
516d_isinf=''
b4eb6b3d
JH
517d_isnan=''
518d_isnanl=''
519d_killpg=''
520d_lchown=''
521d_ldbl_dig=''
522d_link=''
10bc17b6
JH
523d_localtime_r=''
524localtime_r_proto=''
b4eb6b3d
JH
525d_locconv=''
526d_lockf=''
527d_longdbl=''
528longdblsize=''
529d_longlong=''
530longlongsize=''
531d_lseekproto=''
532d_lstat=''
533d_madvise=''
534d_mblen=''
535d_mbstowcs=''
536d_mbtowc=''
537d_memchr=''
538d_memcmp=''
539d_memcpy=''
540d_memmove=''
541d_memset=''
542d_mkdir=''
543d_mkdtemp=''
544d_mkfifo=''
545d_mkstemp=''
546d_mkstemps=''
547d_mktime=''
548d_mmap=''
549mmaptype=''
550d_modfl=''
e67aeab1 551d_modfl_pow32_bug=''
bc9a1b2c 552d_modflproto=''
b4eb6b3d
JH
553d_mprotect=''
554d_msg=''
555d_msgctl=''
556d_msgget=''
4e0554ec 557d_msghdr_s=''
b4eb6b3d
JH
558d_msgrcv=''
559d_msgsnd=''
560d_msync=''
561d_munmap=''
2d736872 562d_nanosleep=''
b4eb6b3d 563d_nice=''
2765b840 564d_nl_langinfo=''
b4eb6b3d
JH
565d_off64_t=''
566d_open3=''
567d_fpathconf=''
568d_pathconf=''
569d_pause=''
570d_pipe=''
571d_poll=''
2304df62 572d_portable=''
a33c94aa 573d_procselfexe=''
f24dbf84 574procselfexe=''
b4eb6b3d
JH
575d_old_pthread_create_joinable=''
576old_pthread_create_joinable=''
d6483fcc 577d_pthread_atfork=''
b4eb6b3d
JH
578d_pthread_yield=''
579d_sched_yield=''
580sched_yield=''
581d_qgcvt=''
10bc17b6
JH
582d_random_r=''
583random_r_proto=''
584d_readdir64_r=''
585readdir64_r_proto=''
b4eb6b3d
JH
586d_readdir=''
587d_rewinddir=''
588d_seekdir=''
589d_telldir=''
10bc17b6
JH
590d_readdir_r=''
591readdir_r_proto=''
b4eb6b3d 592d_readlink=''
4e0554ec
JH
593d_readv=''
594d_recvmsg=''
b4eb6b3d
JH
595d_rename=''
596d_rmdir=''
597d_safebcpy=''
598d_safemcpy=''
599d_sanemcmp=''
ef9f17be 600d_sbrkproto=''
b4eb6b3d
JH
601d_select=''
602d_sem=''
603d_semctl=''
604d_semget=''
605d_semop=''
4e0554ec 606d_sendmsg=''
b4eb6b3d
JH
607d_setegid=''
608d_seteuid=''
609d_setgrent=''
10bc17b6
JH
610d_setgrent_r=''
611setgrent_r_proto=''
b4eb6b3d
JH
612d_setgrps=''
613d_sethent=''
10bc17b6
JH
614d_sethostent_r=''
615sethostent_r_proto=''
4e0554ec 616d_setitimer=''
b4eb6b3d
JH
617d_setlinebuf=''
618d_setlocale=''
10bc17b6
JH
619d_setlocale_r=''
620setlocale_r_proto=''
b4eb6b3d 621d_setnent=''
10bc17b6
JH
622d_setnetent_r=''
623setnetent_r_proto=''
b4eb6b3d
JH
624d_setpent=''
625d_setpgid=''
626d_setpgrp2=''
627d_bsdsetpgrp=''
628d_setpgrp=''
629d_setprior=''
630d_setproctitle=''
10bc17b6
JH
631d_setprotoent_r=''
632setprotoent_r_proto=''
b4eb6b3d 633d_setpwent=''
10bc17b6
JH
634d_setpwent_r=''
635setpwent_r_proto=''
b4eb6b3d
JH
636d_setregid=''
637d_setresgid=''
638d_setresuid=''
639d_setreuid=''
640d_setrgid=''
641d_setruid=''
642d_setsent=''
10bc17b6
JH
643d_setservent_r=''
644setservent_r_proto=''
b4eb6b3d
JH
645d_setsid=''
646d_setvbuf=''
647d_sfio=''
648usesfio=''
649d_shm=''
650d_shmat=''
651d_shmatprototype=''
652shmattype=''
653d_shmctl=''
654d_shmdt=''
655d_shmget=''
656d_sigaction=''
983dbef6 657d_sigprocmask=''
b4eb6b3d 658d_sigsetjmp=''
49a78c82 659d_sockatmark=''
2ef53570 660d_sockatmarkproto=''
b4eb6b3d
JH
661d_msg_ctrunc=''
662d_msg_dontroute=''
663d_msg_oob=''
664d_msg_peek=''
665d_msg_proxy=''
666d_oldsock=''
667d_scm_rights=''
668d_socket=''
669d_sockpair=''
670sockethdr=''
671socketlib=''
672d_socklen_t=''
673d_socks5_init=''
674d_sqrtl=''
10bc17b6
JH
675d_srand48_r=''
676srand48_r_proto=''
677d_srandom_r=''
678srandom_r_proto=''
eef837ea 679d_sresgproto=''
640374d0 680d_sresuproto=''
b4eb6b3d
JH
681d_statblks=''
682d_statfs_f_flags=''
683d_statfs_s=''
684d_fstatvfs=''
685d_statvfs=''
686d_stdio_cnt_lval=''
687d_stdio_ptr_lval=''
a7ffa9b9
NC
688d_stdio_ptr_lval_nochange_cnt=''
689d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
690d_stdiobase=''
691d_stdstdio=''
692stdio_base=''
693stdio_bufsiz=''
694stdio_cnt=''
695stdio_filbuf=''
696stdio_ptr=''
697d_index=''
698d_strchr=''
699d_strcoll=''
700d_strctcpy=''
701d_strerrm=''
702d_strerror=''
703d_sysernlst=''
704d_syserrlst=''
10bc17b6
JH
705d_strerror_r=''
706strerror_r_proto=''
b3c85772 707d_strftime=''
b4eb6b3d
JH
708d_strtod=''
709d_strtol=''
710d_strtold=''
711d_strtoll=''
28e5dec8 712d_strtoq=''
b4eb6b3d
JH
713d_strtoul=''
714d_strtoull=''
715d_strtouq=''
716d_strxfrm=''
717d_symlink=''
718d_syscall=''
2ef53570 719d_syscallproto=''
b4eb6b3d
JH
720d_sysconf=''
721d_system=''
722d_tcgetpgrp=''
723d_tcsetpgrp=''
724d_telldirproto=''
725d_time=''
726timetype=''
727clocktype=''
728d_times=''
10bc17b6
JH
729d_tmpnam_r=''
730tmpnam_r_proto=''
b4eb6b3d 731d_truncate=''
10bc17b6
JH
732d_ttyname_r=''
733ttyname_r_proto=''
b4eb6b3d 734d_tzname=''
4e0554ec
JH
735d_u32align=''
736d_ualarm=''
b4eb6b3d
JH
737d_umask=''
738d_semctl_semid_ds=''
739d_semctl_semun=''
740d_union_semun=''
758a5d79 741d_unordered=''
4e0554ec 742d_usleep=''
2ef53570 743d_usleepproto=''
b4eb6b3d
JH
744d_ustat=''
745d_vfork=''
746usevfork=''
747d_voidsig=''
748signal_t=''
749d_volatile=''
750d_charvspr=''
751d_vprintf=''
752d_wait4=''
753d_waitpid=''
754d_wcstombs=''
755d_wctomb=''
4e0554ec 756d_writev=''
b4eb6b3d 757dlext=''
85e6fe83
LW
758cccdlflags=''
759ccdlflags=''
2304df62 760dlsrc=''
232e078e 761ld=''
85e6fe83 762lddlflags=''
2304df62 763usedl=''
b4eb6b3d
JH
764doublesize=''
765ebcdic=''
766fflushNULL=''
767fflushall=''
768fpossize=''
769fpostype=''
2d736872 770gccansipedantic=''
5b463ca7 771gccosandvers=''
8a27cf78 772gccversion=''
b4eb6b3d
JH
773gidformat=''
774gidsign=''
775gidsize=''
776gidtype=''
777groupstype=''
778h_fcntl=''
779h_sysfile=''
6e1038e0
MB
780html1dir=''
781html1direxp=''
782installhtml1dir=''
783html3dir=''
784html3direxp=''
785installhtml3dir=''
b4eb6b3d 786i_arpainet=''
10bc17b6 787i_crypt=''
b4eb6b3d
JH
788db_hashtype=''
789db_prefixtype=''
640374d0
JH
790db_version_major=''
791db_version_minor=''
792db_version_patch=''
b4eb6b3d
JH
793i_db=''
794i_dbm=''
795i_rpcsvcdbm=''
796d_dirnamlen=''
797direntrytype=''
798i_dirent=''
a0d0e21e 799i_dld=''
b4eb6b3d
JH
800i_dlfcn=''
801i_fcntl=''
802i_float=''
758a5d79
JH
803i_fp=''
804i_fp_class=''
b4eb6b3d
JH
805i_gdbm=''
806d_grpasswd=''
807i_grp=''
b4eb6b3d
JH
808i_ieeefp=''
809i_inttypes=''
2765b840 810i_langinfo=''
b4eb6b3d
JH
811i_libutil=''
812i_limits=''
813i_locale=''
814i_machcthr=''
815i_malloc=''
816i_math=''
817i_memory=''
818i_mntent=''
819i_ndbm=''
820i_netdb=''
821i_neterrno=''
822i_netinettcp=''
823i_niin=''
824i_sysin=''
825i_poll=''
826i_prot=''
827i_pthread=''
828d_pwage=''
829d_pwchange=''
830d_pwclass=''
831d_pwcomment=''
832d_pwexpire=''
833d_pwgecos=''
834d_pwpasswd=''
835d_pwquota=''
836i_pwd=''
837i_sfio=''
838i_shadow=''
839i_socks=''
840i_stddef=''
841i_stdlib=''
842i_string=''
843strings=''
844i_sunmath=''
845i_sysaccess=''
846i_sysdir=''
847i_sysfile=''
848d_voidtty=''
849i_bsdioctl=''
850i_sysfilio=''
851i_sysioctl=''
852i_syssockio=''
853i_syslog=''
854i_sysmman=''
855i_sysmode=''
856i_sysmount=''
857i_sysndir=''
858i_sysparam=''
859i_sysresrc=''
860i_syssecrt=''
861i_sysselct=''
862i_sysstat=''
863i_sysstatfs=''
864i_sysstatvfs=''
865i_systimes=''
866i_systypes=''
867i_sysuio=''
868i_sysun=''
869i_sysutsname=''
870i_sysvfs=''
871i_syswait=''
872i_sgtty=''
873i_termio=''
874i_termios=''
14b90194
JH
875d_tm_tm_gmtoff=''
876d_tm_tm_zone=''
b4eb6b3d
JH
877i_systime=''
878i_systimek=''
879i_time=''
880timeincl=''
881i_unistd=''
882i_ustat=''
883i_utime=''
884i_values=''
885i_stdarg=''
886i_varargs=''
887i_varhdr=''
888i_vfork=''
889inc_version_list=''
890inc_version_list_init=''
891installprefix=''
892installprefixexp=''
893installstyle=''
894installusrbinperl=''
895intsize=''
896longsize=''
897shortsize=''
4b661809 898issymlink=''
2304df62 899libc=''
b4eb6b3d
JH
900ldlibpthname=''
901libperl=''
902shrpenv=''
903useshrplib=''
a0d0e21e 904glibpth=''
2304df62 905libpth=''
8e07c86e 906loclibpth=''
2304df62
AD
907plibpth=''
908xlibpth=''
1cfa4ec7 909ignore_versioned_solibs=''
2304df62 910libs=''
43999f95
JH
911libsdirs=''
912libsfiles=''
913libsfound=''
13b3f787 914libspath=''
85e6fe83 915lns=''
b4eb6b3d
JH
916d_PRIEUldbl=''
917d_PRIFUldbl=''
918d_PRIGUldbl=''
919d_PRIeldbl=''
920d_PRIfldbl=''
921d_PRIgldbl=''
922d_SCNfldbl=''
923sPRIEUldbl=''
924sPRIFUldbl=''
925sPRIGUldbl=''
926sPRIeldbl=''
927sPRIfldbl=''
928sPRIgldbl=''
929sSCNfldbl=''
930lseeksize=''
931lseektype=''
8ff267be 932make_set_make=''
b4eb6b3d
JH
933d_mymalloc=''
934freetype=''
935mallocobj=''
936mallocsrc=''
937malloctype=''
938usemymalloc=''
939installman1dir=''
940man1dir=''
941man1direxp=''
942man1ext=''
943installman3dir=''
944man3dir=''
945man3direxp=''
946man3ext=''
947modetype=''
948multiarch=''
949mydomain=''
950myhostname=''
951phostname=''
2304df62
AD
952c=''
953n=''
b4eb6b3d
JH
954d_eofnblk=''
955eagain=''
956o_nonblock=''
957rd_nodata=''
2cc61e15 958need_va_copy=''
b4eb6b3d
JH
959netdb_hlen_type=''
960netdb_host_type=''
961netdb_name_type=''
962netdb_net_type=''
963groupcat=''
964hostcat=''
965passcat=''
966orderlib=''
967ranlib=''
968d_perl_otherlibdirs=''
969otherlibdirs=''
2304df62
AD
970package=''
971spackage=''
b4eb6b3d
JH
972pager=''
973api_revision=''
974api_subversion=''
975api_version=''
976api_versionstring=''
977patchlevel=''
151e6568 978perl_patchlevel=''
b4eb6b3d
JH
979revision=''
980subversion=''
981version=''
861eb78d 982version_patchlevel_string=''
b4eb6b3d
JH
983perl5=''
984perladmin=''
985perlpath=''
986d_nv_preserves_uv=''
b4eb6b3d
JH
987i16size=''
988i16type=''
989i32size=''
990i32type=''
991i64size=''
992i64type=''
993i8size=''
994i8type=''
995ivsize=''
996ivtype=''
53133ed1 997nv_preserves_uv_bits=''
b4eb6b3d
JH
998nvsize=''
999nvtype=''
1000u16size=''
1001u16type=''
1002u32size=''
1003u32type=''
1004u64size=''
1005u64type=''
1006u8size=''
1007u8type=''
1008uvsize=''
1009uvtype=''
1010ivdformat=''
1011nvEUformat=''
1012nvFUformat=''
1013nvGUformat=''
1014nveformat=''
1015nvfformat=''
1016nvgformat=''
1017uvXUformat=''
1018uvoformat=''
1019uvuformat=''
1020uvxformat=''
1021pidtype=''
1022prefix=''
1023prefixexp=''
1024installprivlib=''
1025privlib=''
1026privlibexp=''
1027prototype=''
1028ptrsize=''
1029d_PRIXU64=''
1030d_PRId64=''
1031d_PRIi64=''
1032d_PRIo64=''
1033d_PRIu64=''
1034d_PRIx64=''
1035sPRIXU64=''
1036sPRId64=''
1037sPRIi64=''
1038sPRIo64=''
1039sPRIu64=''
1040sPRIx64=''
1041d_quad=''
1042quadkind=''
1043quadtype=''
1044uquadtype=''
1045drand01=''
1046randbits=''
1047randfunc=''
1048randseedtype=''
1049seedfunc=''
1050installscript=''
1051scriptdir=''
1052scriptdirexp=''
1053selectminbits=''
1054selecttype=''
8ff267be 1055sh=''
b4eb6b3d
JH
1056sig_count=''
1057sig_name=''
1058sig_name_init=''
1059sig_num=''
1060sig_num_init=''
76d3c696 1061sig_size=''
b4eb6b3d
JH
1062installsitearch=''
1063sitearch=''
1064sitearchexp=''
1065installsitebin=''
1066sitebin=''
1067sitebinexp=''
6e1038e0
MB
1068installsitehtml1=''
1069sitehtml1=''
1070sitehtml1exp=''
1071installsitehtml3=''
1072sitehtml3=''
1073sitehtml3exp=''
b4eb6b3d
JH
1074installsitelib=''
1075sitelib=''
1076sitelib_stem=''
1077sitelibexp=''
6e1038e0
MB
1078installsiteman1=''
1079siteman1=''
1080siteman1exp=''
1081installsiteman3=''
1082siteman3=''
1083siteman3exp=''
b4eb6b3d
JH
1084siteprefix=''
1085siteprefixexp=''
6e1038e0
MB
1086installsitescript=''
1087sitescript=''
1088sitescriptexp=''
b4eb6b3d
JH
1089sizesize=''
1090sizetype=''
a0d0e21e 1091so=''
b4eb6b3d 1092socksizetype=''
2304df62
AD
1093sharpbang=''
1094shsharp=''
1095spitshell=''
dfe9444c 1096src=''
b4eb6b3d
JH
1097ssizetype=''
1098startperl=''
2304df62 1099startsh=''
b4eb6b3d
JH
1100stdchar=''
1101d_stdio_stream_array=''
1102stdio_stream_array=''
1103sysman=''
5ff3f7a4 1104trnl=''
b4eb6b3d
JH
1105uidformat=''
1106uidsign=''
1107uidsize=''
1108uidtype=''
1109archname64=''
1110use64bitall=''
1111use64bitint=''
1112ccflags_uselargefiles=''
1113ldflags_uselargefiles=''
1114libswanted_uselargefiles=''
1115uselargefiles=''
1116uselongdouble=''
1117usemorebits=''
1118usemultiplicity=''
2304df62 1119nm_opt=''
40a7a20a 1120nm_so_opt=''
2304df62
AD
1121runnm=''
1122usenm=''
b4eb6b3d 1123useperlio=''
29209bc5 1124usesocks=''
b4eb6b3d
JH
1125d_oldpthreads=''
1126use5005threads=''
1127useithreads=''
9514c62b 1128usereentrant=''
b4eb6b3d 1129usethreads=''
2304df62 1130incpath=''
2304df62
AD
1131mips_type=''
1132usrinc=''
b4eb6b3d
JH
1133d_vendorarch=''
1134installvendorarch=''
1135vendorarch=''
1136vendorarchexp=''
1137d_vendorbin=''
1138installvendorbin=''
1139vendorbin=''
1140vendorbinexp=''
6e1038e0
MB
1141installvendorhtml1=''
1142vendorhtml1=''
1143vendorhtml1exp=''
1144installvendorhtml3=''
1145vendorhtml3=''
1146vendorhtml3exp=''
b4eb6b3d
JH
1147d_vendorlib=''
1148installvendorlib=''
1149vendorlib=''
1150vendorlib_stem=''
1151vendorlibexp=''
6e1038e0
MB
1152installvendorman1=''
1153vendorman1=''
1154vendorman1exp=''
1155installvendorman3=''
1156vendorman3=''
1157vendorman3exp=''
b4eb6b3d
JH
1158usevendorprefix=''
1159vendorprefix=''
1160vendorprefixexp=''
6e1038e0
MB
1161d_vendorscript=''
1162installvendorscript=''
1163vendorscript=''
1164vendorscriptexp=''
d56c5707 1165versiononly=''
b4eb6b3d
JH
1166defvoidused=''
1167voidflags=''
1168pm_apiversion=''
1169xs_apiversion=''
3659ebf1
JH
1170yacc=''
1171yaccflags=''
2304df62
AD
1172CONFIG=''
1173
ecfc5424
AD
1174define='define'
1175undef='undef'
1176smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1177rmlist=''
1178
1179: We must find out about Eunice early
1180eunicefix=':'
1181if test -f /etc/unixtovms; then
1182 eunicefix=/etc/unixtovms
1183fi
1184if test -f /etc/unixtovms.exe; then
1185 eunicefix=/etc/unixtovms.exe
1186fi
1187
cfb04860 1188: Set executable suffix now -- needed before hints available
6153ba32
PG
1189if test -f "/libs/version.library"; then
1190: Amiga OS
1191 _exe=""
1192elif test -f "/system/gnu_library/bin/ar.pm"; then
1193: Stratus VOS
cfb04860 1194 _exe=".pm"
6153ba32
PG
1195elif test -n "$DJGPP"; then
1196: DOS DJGPP
cfb04860 1197 _exe=".exe"
6153ba32 1198elif test -d c:/. ; then
506faf56 1199: OS/2 or cygwin
ba863942
JH
1200 _exe=".exe"
1201fi
868439a2 1202
b4eb6b3d 1203i_whoami=''
ff935051
JH
1204: Possible local include directories to search.
1205: Set locincpth to "" in a hint file to defeat local include searches.
1206locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1207locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1208:
1209: no include file wanted by default
1210inclwanted=''
1211
76f47787
JH
1212siteman1=''
1213siteman3=''
1214sitescript=''
1215: Trailing extension. Override this in a hint file, if needed.
1216: Extra object files, if any, needed on this platform.
1217archobjs=''
b4eb6b3d 1218groupstype=''
64615a5e 1219libnames=''
732c9516
JH
1220: change the next line if compiling for Xenix/286 on Xenix/386
1221xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1222: Possible local library directories to search.
1223loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1224loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1225
1226: general looking path for locating libraries
5869b1f1 1227glibpth="/lib /usr/lib $xlibpth"
732c9516 1228glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1229test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1230test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1231
1232: Private path used by Configure to find libraries. Its value
1233: is prepended to libpth. This variable takes care of special
1234: machines, like the mips. Usually, it should be empty.
1235plibpth=''
1236
1cfa4ec7
GS
1237: default library list
1238libswanted=''
921b2963 1239: some systems want to use only the non-versioned libso:s
1cfa4ec7 1240ignore_versioned_solibs=''
76f47787
JH
1241: full support for void wanted by default
1242defvoidused=15
1243
1244ccname=''
1245ccversion=''
1246perllibs=''
1247: set useposix=false in your hint file to disable the POSIX extension.
1248useposix=true
1249: set useopcode=false in your hint file to disable the Opcode extension.
1250useopcode=true
b4eb6b3d
JH
1251archname64=''
1252ccflags_uselargefiles=''
1253ldflags_uselargefiles=''
1254libswanted_uselargefiles=''
1255: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1256: set usesocks on the Configure command line to enable socks.
76f47787 1257archname=''
b4eb6b3d 1258: set usethreads on the Configure command line to enable threads.
cd040c5e 1259usereentrant='undef'
ecfc5424 1260: List of libraries we want.
693762b4 1261: If anyone needs -lnet, put it in a hint file.
997d70a2 1262libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1263libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1264libswanted="$libswanted ndir dir crypt sec"
53df3d8c 1265libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1aef975c 1266: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1267: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1268glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1269glibpth="/usr/shlib $glibpth"
1270: Do not use vfork unless overridden by a hint file.
1271usevfork=false
1272
8ff267be 1273: Find the basic shell for Bourne shell scripts
1274case "$sh" in
1275'')
8ff267be 1276 case "$SYSTYPE" in
1277 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1278 *) xxx='/bin/sh';;
1279 esac
1280 if test -f "$xxx"; then
1281 sh="$xxx"
1282 else
1283 : Build up a list and do a single loop so we can 'break' out.
1284 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1285 for xxx in sh bash ksh pdksh ash; do
1286 for p in $pth; do
1287 try="$try ${p}/${xxx}"
1288 done
1289 done
1290 for xxx in $try; do
1291 if test -f "$xxx"; then
1292 sh="$xxx";
8ff267be 1293 break
a5a94ea5
JH
1294 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1295 sh="$xxx";
1296 break
8ff267be 1297 elif test -f "$xxx.exe"; then
1298 sh="$xxx";
8ff267be 1299 break
1300 fi
1301 done
1302 fi
1303 ;;
1304esac
1305
1306case "$sh" in
a33c94aa 1307'') cat >&2 <<EOM
8ff267be 1308$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1309
8ff267be 1310Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1311Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1312we'll try to straighten this all out.
8ff267be 1313EOM
1314 exit 1
1315 ;;
1316esac
1317
760ac839 1318: see if sh knows # comments
73614538 1319if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1320 shsharp=true
1321 spitshell=cat
760ac839 1322 xcat=/bin/cat
a931254c
JH
1323 test -f $xcat$_exe || xcat=/usr/bin/cat
1324 if test ! -f $xcat$_exe; then
4bdb8fb5 1325 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1326 if test -f $p/cat$_exe; then
1deb0a86 1327 xcat=$p/cat
3c728e00
JH
1328 break
1329 fi
1330 done
1deb0a86
JH
1331 if test ! -f $xcat$_exe; then
1332 echo "Can't find cat anywhere!"
3c728e00
JH
1333 exit 1
1334 fi
1335 fi
5440bc8e
JH
1336 echo "#!$xcat" >sharp
1337 $eunicefix sharp
1338 chmod +x sharp
1339 ./sharp > today
760ac839 1340 if test -s today; then
760ac839
LW
1341 sharpbang='#!'
1342 else
5440bc8e
JH
1343 echo "#! $xcat" > sharp
1344 $eunicefix sharp
1345 chmod +x sharp
1346 ./sharp > today
760ac839 1347 if test -s today; then
760ac839
LW
1348 sharpbang='#! '
1349 else
760ac839
LW
1350 sharpbang=': use '
1351 fi
1352 fi
1353else
dfe9444c 1354 echo " "
8ff267be 1355 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1356 shsharp=false
1357 cd ..
1358 echo "exec grep -v '^[ ]*#'" >spitshell
1359 chmod +x spitshell
1360 $eunicefix spitshell
1361 spitshell=`pwd`/spitshell
1362 cd UU
1363 echo "I presume that if # doesn't work, #! won't work either!"
1364 sharpbang=': use '
1365fi
5440bc8e 1366rm -f sharp today
760ac839
LW
1367
1368: figure out how to guarantee sh startup
8ff267be 1369case "$startsh" in
1370'') startsh=${sharpbang}${sh} ;;
1371*)
760ac839 1372esac
5440bc8e 1373cat >sharp <<EOSS
760ac839
LW
1374$startsh
1375set abc
1376test "$?abc" != 1
1377EOSS
1378
5440bc8e
JH
1379chmod +x sharp
1380$eunicefix sharp
1381if ./sharp; then
8ff267be 1382 : echo "Yup, it does."
760ac839 1383else
dfe9444c
AD
1384 echo "Hmm... '$startsh' does not guarantee sh startup..."
1385 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1386fi
5440bc8e 1387rm -f sharp
760ac839 1388
aebf16e7
AD
1389
1390: Save command line options in file UU/cmdline.opt for later use in
1391: generating config.sh.
1392cat > cmdline.opt <<EOSH
1393# Configure command line arguments.
1394config_arg0='$0'
1395config_args='$*'
1396config_argc=$#
1397EOSH
1398argn=1
ee45ea83
IZ
1399args_exp=''
1400args_sep=''
aebf16e7
AD
1401for arg in "$@"; do
1402 cat >>cmdline.opt <<EOSH
1403config_arg$argn='$arg'
1404EOSH
ee45ea83
IZ
1405 # Extreme backslashitis: replace each ' by '"'"'
1406 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1407$arg
1408EOC
1409 arg_exp=`cat cmdl.opt`
1410 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1411 argn=`expr $argn + 1`
ee45ea83 1412 args_sep=' '
aebf16e7 1413done
ee45ea83
IZ
1414# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1415# used by ./hints/os2.sh
1416rm -f cmdl.opt
aebf16e7 1417
2304df62
AD
1418: produce awk script to parse command line options
1419cat >options.awk <<'EOF'
1420BEGIN {
02e93a22 1421 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1422
1423 len = length(optstr);
1424 for (i = 1; i <= len; i++) {
1425 c = substr(optstr, i, 1);
1426 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1427 if (a == ":") {
1428 arg[c] = 1;
1429 i++;
1430 }
1431 opt[c] = 1;
1432 }
1433}
1434{
1435 expect = 0;
1436 str = $0;
1437 if (substr(str, 1, 1) != "-") {
1438 printf("'%s'\n", str);
1439 next;
1440 }
1441 len = length($0);
1442 for (i = 2; i <= len; i++) {
1443 c = substr(str, i, 1);
1444 if (!opt[c]) {
1445 printf("-%s\n", substr(str, i));
1446 next;
1447 }
1448 printf("-%s\n", c);
1449 if (arg[c]) {
1450 if (i < len)
1451 printf("'%s'\n", substr(str, i + 1));
1452 else
1453 expect = 1;
1454 next;
1455 }
1456 }
1457}
1458END {
1459 if (expect)
1460 print "?";
1461}
1462EOF
1463
1464: process the command line options
4633a7c4
LW
1465set X `for arg in "$@"; do echo "X$arg"; done |
1466 sed -e s/X// | awk -f options.awk`
2304df62
AD
1467eval "set $*"
1468shift
1469rm -f options.awk
1470
1471: set up default values
1472fastread=''
1473reuseval=false
1474config_sh=''
1475alldone=''
1476error=''
1477silent=''
1478extractsh=''
ecfc5424 1479override=''
16d20bd9 1480knowitall=''
02e93a22 1481rm -f optdef.sh posthint.sh
28757baa 1482cat >optdef.sh <<EOS
1483$startsh
1484EOS
2304df62 1485
dfe9444c 1486
2304df62
AD
1487: option parsing
1488while test $# -gt 0; do
1489 case "$1" in
1490 -d) shift; fastread=yes;;
1491 -e) shift; alldone=cont;;
1492 -f)
1493 shift
1494 cd ..
1495 if test -r "$1"; then
1496 config_sh="$1"
1497 else
a0d0e21e 1498 echo "$me: cannot read config file $1." >&2
2304df62
AD
1499 error=true
1500 fi
1501 cd UU
1502 shift;;
1503 -h) shift; error=true;;
1504 -r) shift; reuseval=true;;
dfe9444c 1505 -s) shift; silent=true; realsilent=true;;
2304df62 1506 -E) shift; alldone=exit;;
16d20bd9 1507 -K) shift; knowitall=true;;
ecfc5424 1508 -O) shift; override=true;;
dfe9444c 1509 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1510 -D)
1511 shift
1512 case "$1" in
1513 *=)
1514 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1515 echo "$me: ignoring -D $1" >&2
1516 ;;
ecfc5424 1517 *=*) echo "$1" | \
1aef975c
AD
1518 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1519 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1520 esac
1521 shift
1522 ;;
1523 -U)
1524 shift
1525 case "$1" in
1aef975c 1526 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1527 *=*)
1528 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1529 echo "$me: ignoring -U $1" >&2
1530 ;;
1aef975c 1531 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1532 esac
1533 shift
1534 ;;
02e93a22
JH
1535 -A)
1536 shift
1537 xxx=''
1538 yyy="$1"
02e93a22 1539 zzz=''
5f83a3e9 1540 uuu=undef
02e93a22 1541 case "$yyy" in
f7c31117 1542 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1543 case "$zzz" in
1544 *:*) zzz='' ;;
1545 *) xxx=append
f7c31117
JH
1546 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1547 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1548 esac
1549 ;;
1550 esac
1551 case "$xxx" in
1552 '') case "$yyy" in
f7c31117
JH
1553 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1554 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1555 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1556 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1557 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1558 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1559 esac
1560 ;;
1561 esac
02e93a22
JH
1562 case "$xxx" in
1563 append)
5f83a3e9 1564 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1565 clear)
5f83a3e9 1566 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1567 define)
1568 case "$zzz" in
1569 '') zzz=define ;;
1570 esac
5f83a3e9 1571 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1572 eval)
5f83a3e9 1573 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1574 prepend)
5f83a3e9 1575 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1576 undef)
1577 case "$zzz" in
1578 '') zzz="$uuu" ;;
1579 esac
5f83a3e9
JH
1580 echo "$yyy=$zzz" >> posthint.sh ;;
1581 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1582 esac
bde6b06b 1583 shift
02e93a22 1584 ;;
dfe9444c 1585 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1586 exit 0;;
2304df62 1587 --) break;;
a0d0e21e 1588 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1589 *) break;;
1590 esac
1591done
1592
1593case "$error" in
1594true)
1595 cat >&2 <<EOM
2afac517 1596Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1597 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1598 -d : use defaults for all answers.
1599 -e : go on without questioning past the production of config.sh.
1600 -f : specify an alternate default configuration file.
1601 -h : print this help message and exit (with an error status).
1602 -r : reuse C symbols value if possible (skips costly nm extraction).
1603 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1604 -D : define symbol to have some value:
1605 -D symbol symbol gets the value 'define'
1606 -D symbol=value symbol gets the value 'value'
2304df62 1607 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1608 -K : do not use unless you know what you are doing.
ecfc5424 1609 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1610 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1611 -U : undefine symbol:
1612 -U symbol symbol gets the value 'undef'
1613 -U symbol= symbol gets completely empty
02e93a22 1614 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1615 -A symbol=value append " "value to symbol
02e93a22
JH
1616 -A append:symbol=value append value to symbol
1617 -A define:symbol=value define symbol to have value
02e93a22
JH
1618 -A clear:symbol define symbol to be ''
1619 -A define:symbol define symbol to be 'define'
1620 -A eval:symbol=value define symbol to be eval of value
1621 -A prepend:symbol=value prepend value to symbol
1622 -A undef:symbol define symbol to be 'undef'
1623 -A undef:symbol= define symbol to be ''
2304df62
AD
1624 -V : print version number and exit (with a zero status).
1625EOM
1626 exit 1
1627 ;;
1628esac
1629
dfe9444c
AD
1630: Sanity checks
1631case "$fastread$alldone" in
1632yescont|yesexit) ;;
1633*)
aaeb8e51
GS
1634 case "$extractsh" in
1635 true) ;;
1636 *)
1637 if test ! -t 0; then
1638 echo "Say 'sh Configure', not 'sh <Configure'"
1639 exit 1
1640 fi
1641 ;;
1642 esac
dfe9444c
AD
1643 ;;
1644esac
1645
2304df62
AD
1646exec 4>&1
1647case "$silent" in
1648true) exec 1>/dev/null;;
1649esac
1650
ecfc5424 1651: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1652touch optdef.sh
1653. ./optdef.sh
02e93a22
JH
1654: create the posthint manipulation script and leave the file out there...
1655touch posthint.sh
a0d0e21e 1656
2304df62 1657: set package name
85e6fe83 1658package=perl5
b4eb6b3d
JH
1659first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1660last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1661case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1662ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1663*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1664esac
2304df62 1665
2304df62
AD
1666: Some greps do not return status, grrr.
1667echo "grimblepritz" >grimble
1668if grep blurfldyick grimble >/dev/null 2>&1 ; then
1669 contains=contains
1670elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1671 contains=grep
1672else
1673 contains=contains
1674fi
1675rm -f grimble
1676: the following should work in any shell
1677case "$contains" in
1678contains*)
1679 echo " "
1680 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1681 cat >contains <<'EOSS'
1682grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1683EOSS
1684chmod +x contains
1685esac
1686
dfe9444c
AD
1687: Find the path to the source tree
1688case "$src" in
1689'') case "$0" in
b233458b
JH
1690 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1691 case "$src" in
1692 /*) ;;
8504afb7 1693 .) ;;
b233458b
JH
1694 *) src=`cd ../$src && pwd` ;;
1695 esac
1696 ;;
dfe9444c
AD
1697 *) src='.';;
1698 esac;;
1699esac
1700case "$src" in
1701'') src=/
1702 rsrc=/
1703 ;;
1704/*) rsrc="$src";;
1705*) rsrc="../$src";;
1706esac
1707if test -f $rsrc/Configure && \
1708 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1709then
1710 : found it, so we are ok.
1711else
1712 rsrc=''
1713 for src in . .. ../.. ../../.. ../../../..; do
1714 if test -f ../$src/Configure && \
1715 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1716 then
1717 rsrc=../$src
1718 break
1719 fi
1720 done
1721fi
1722case "$rsrc" in
1723'')
1724 cat <<EOM >&4
1725
1726Sorry, I can't seem to locate the source dir for $package. Please start
1727Configure with an explicit path -- i.e. /some/path/Configure.
1728
1729EOM
1730 exit 1
1731 ;;
1732../.) rsrc='..';;
1733*)
1734 echo " "
1735 echo "Sources for $package found in \"$src\"." >&4
1736 ;;
1737esac
1738
1739: script used to extract .SH files with variable substitutions
1740cat >extract <<'EOS'
a02608de 1741PERL_CONFIG_SH=true
dfe9444c 1742echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1743if test -f MANIFEST; then
1744 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1745else
1746 echo "(Looking for .SH files under the source directory.)"
6904989c 1747 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1748fi
1749shift
1750case $# in
6904989c 17510) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1752esac
6904989c 1753if test ! -f "$src/$1"; then
dfe9444c
AD
1754 shift
1755fi
1756mkdir_p='
1757name=$1;
1758create="";
1759while test $name; do
1760 if test ! -d "$name"; then
1761 create="$name $create";
1762 name=`echo $name | sed -e "s|^[^/]*$||"`;
1763 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1764 else
1765 name="";
1766 fi;
1767done;
1768for file in $create; do
1769 mkdir $file;
1770done
1771'
1772for file in $*; do
1773 case "$src" in
1774 ".")
1775 case "$file" in
1776 */*)
1777 dir=`expr X$file : 'X\(.*\)/'`
1778 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1779 (cd "$dir" && . ./$file)
dfe9444c
AD
1780 ;;
1781 *)
1782 . ./$file
1783 ;;
1784 esac
1785 ;;
1786 *)
1787 case "$file" in
1788 */*)
1789 dir=`expr X$file : 'X\(.*\)/'`
1790 file=`expr X$file : 'X.*/\(.*\)'`
1791 (set x $dir; shift; eval $mkdir_p)
6904989c 1792 sh <"$src/$dir/$file"
dfe9444c
AD
1793 ;;
1794 *)
6904989c 1795 sh <"$src/$file"
dfe9444c
AD
1796 ;;
1797 esac
1798 ;;
1799 esac
1800done
6904989c 1801if test -f "$src/config_h.SH"; then
dfe9444c
AD
1802 if test ! -f config.h; then
1803 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1804 . "$src/config_h.SH"
dfe9444c
AD
1805 fi
1806fi
1807EOS
1808
1809: extract files and exit if asked to do so
1810case "$extractsh" in
1811true)
1812 case "$realsilent" in
1813 true) ;;
1814 *) exec 1>&4;;
1815 esac
1816 case "$config_sh" in
1817 '') config_sh='config.sh';;
1818 esac
1819 echo " "
1820 echo "Fetching answers from $config_sh..."
1821 cd ..
1822 . $config_sh
1823 test "$override" && . ./optdef.sh
1824 echo " "
1825 . UU/extract
1826 rm -rf UU
24ccb310 1827 echo "Extraction done."
dfe9444c
AD
1828 exit 0
1829 ;;
1830esac
1831
1832: Eunice requires " " instead of "", can you believe it
1833echo " "
1834: Here we go...
1835echo "Beginning of configuration questions for $package."
1836
1837trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1838
2304df62
AD
1839: first determine how to suppress newline on echo command
1840echo " "
1841echo "Checking echo to see how to suppress newlines..."
1842(echo "hi there\c" ; echo " ") >.echotmp
1843if $contains c .echotmp >/dev/null 2>&1 ; then
1844 echo "...using -n."
1845 n='-n'
1846 c=''
1847else
1848 cat <<'EOM'
1849...using \c
1850EOM
1851 n=''
1852 c='\c'
1853fi
1854echo $n "The star should be here-->$c"
1855echo '*'
1856rm -f .echotmp
1857
1858: Now test for existence of everything in MANIFEST
1859echo " "
6904989c 1860if test -f "$rsrc/MANIFEST"; then
2304df62 1861 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1862 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1863 rm -f missing
dfe9444c 1864 tmppwd=`pwd`
2304df62 1865 for filelist in x??; do
6904989c 1866 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1867 done
1868 if test -s missing; then
1869 cat missing >&4
1870 cat >&4 <<'EOM'
1871
1872THIS PACKAGE SEEMS TO BE INCOMPLETE.
1873
1874You have the option of continuing the configuration process, despite the
1875distinct possibility that your kit is damaged, by typing 'y'es. If you
1876do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1877and contact the author (perlbug@perl.org).
2304df62
AD
1878
1879EOM
1880 echo $n "Continue? [n] $c" >&4
1881 read ans
1882 case "$ans" in
1883 y*)
1884 echo "Continuing..." >&4
1885 rm -f missing
1886 ;;
1887 *)
1888 echo "ABORTING..." >&4
1889 kill $$
1890 ;;
1891 esac
1892 else
dfe9444c 1893 echo "Looks good..."
2304df62
AD
1894 fi
1895else
1896 echo "There is no MANIFEST file. I hope your kit is complete !"
1897fi
1898rm -f missing x??
1899
5ff3f7a4
GS
1900echo " "
1901: Find the appropriate value for a newline for tr
1902if test -n "$DJGPP"; then
1903 trnl='\012'
1904fi
1905if test X"$trnl" = X; then
1906 case "`echo foo|tr '\n' x 2>/dev/null`" in
1907 foox) trnl='\n' ;;
1908 esac
1909fi
1910if test X"$trnl" = X; then
1911 case "`echo foo|tr '\012' x 2>/dev/null`" in
1912 foox) trnl='\012' ;;
1913 esac
1914fi
1915if test X"$trnl" = X; then
8be2c24c
JH
1916 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1917 fooxy) trnl='\n\r' ;;
1918 esac
1919fi
1920if test X"$trnl" = X; then
5ff3f7a4
GS
1921 cat <<EOM >&2
1922
1923$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1924
1925EOM
1926 exit 1
1927fi
1928
2304df62
AD
1929: compute the number of columns on the terminal for proper question formatting
1930case "$COLUMNS" in
1931'') COLUMNS='80';;
1932esac
1933
1934: set up the echo used in my read
1935myecho="case \"\$xxxm\" in
1936'') echo $n \"\$rp $c\" >&4;;
1937*) case \"\$rp\" in
1938 '') echo $n \"[\$xxxm] $c\";;
1939 *)
1940 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1941 echo \"\$rp\" >&4
1942 echo $n \"[\$xxxm] $c\" >&4
1943 else
1944 echo $n \"\$rp [\$xxxm] $c\" >&4
1945 fi
1946 ;;
1947 esac;;
1948esac"
1949
1950: now set up to do reads with possible shell escape and default assignment
1951cat <<EOSC >myread
28757baa 1952$startsh
2304df62
AD
1953xxxm=\$dflt
1954$myecho
1955ans='!'
1956case "\$fastread" in
1957yes) case "\$dflt" in
1958 '') ;;
1959 *) ans='';
1960 case "\$silent-\$rp" in
1961 true-) ;;
1962 *) echo " " >&4;;
1963 esac;;
1964 esac;;
1965*) case "\$silent" in
1966 true) case "\$rp" in
1967 '') ans='';;
1968 esac;;
1969 esac;;
1970esac
1971while expr "X\$ans" : "X!" >/dev/null; do
1972 read answ
1973 set x \$xxxm
1974 shift
dfe9444c 1975 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1976 case "\$answ" in
dfe9444c
AD
1977 "!")
1978 sh 1>&4
1979 echo " "
1980 $myecho
1981 ;;
1982 !*)
1983 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1984 shift
1985 sh 1>&4 -c "\$*"
1986 echo " "
1987 $myecho
1988 ;;
2304df62
AD
1989 "\$ans")
1990 case "\$ans" in
ecfc5424
AD
1991 \\&*)
1992 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1993 shift
1994 case "\$1" in
1995 -d)
1996 fastread=yes
40a7a20a 1997 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1998 ;;
1999 -*)
40a7a20a 2000 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2001 ;;
2002 esac
2003 $myecho
2004 ans=!
2005 ;;
2304df62
AD
2006 esac;;
2007 *)
2008 case "\$aok" in
2009 y)
2010 echo "*** Substitution done -- please confirm."
2011 xxxm="\$ans"
c9795ab7 2012 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2013 xxxm="\$ans"
2014 ans=!
2015 ;;
2016 *)
2017 echo "*** Error -- try again."
2018 ans=!
2019 ;;
2020 esac
2021 $myecho
2022 ;;
2023 esac
2024 case "\$ans\$xxxm\$nostick" in
2025 '')
2026 ans=!
2027 $myecho
2028 ;;
2029 esac
2030done
2031case "\$ans" in
2032'') ans="\$xxxm";;
2033esac
2034EOSC
2035
2036: create .config dir to save info across Configure sessions
2037test -d ../.config || mkdir ../.config
2038cat >../.config/README <<EOF
2039This directory created by Configure to save information that should
dfe9444c 2040persist across sessions for $package.
2304df62
AD
2041
2042You may safely delete it if you wish.
2043EOF
2044
9507cadf 2045xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2046case "$usedevel" in
0107c034 2047$define|true|[yY]*) ;;
9507cadf 2048*) case "$xversion" in
0107c034
JH
2049 *[13579])
2050 cat >&4 <<EOH
2051*** WHOA THERE!!! ***
2052
2053 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2054 The version of this $package distribution is $xversion, that is, odd,
2055 (as opposed to even) and that signifies a development release.
3d5d58b1 2056 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2057
2058 Do ***NOT*** install this into production use.
2059 Data corruption and crashes are possible.
2060
2061 It is most seriously suggested that you do not continue any further
2062 unless you want to help in developing and debugging Perl.
2063
6adc6a45
JH
2064 If you *still* want to build perl, you can answer 'y' now,
2065 or pass -Dusedevel to Configure.
2066
0107c034
JH
2067EOH
2068 rp='Do you really want to continue?'
2069 dflt='n'
2070 . ./myread
2071 case "$ans" in
8feeef0e
JH
2072 [yY]) echo >&4 "Okay, continuing."
2073 usedevel="$define" ;;
0107c034
JH
2074 *) echo >&4 "Okay, bye."
2075 exit 1
2076 ;;
2077 esac
2078 ;;
2079 esac
2080 ;;
2081esac
8feeef0e
JH
2082case "$usedevel" in
2083$define|true|[yY]*)
2084 case "$versiononly" in
2085 '') versiononly="$define" ;;
2086 esac
2087 case "$installusrbinperl" in
2088 '') installusrbinperl="$undef" ;;
2089 esac
2090 ;;
2091esac
0107c034 2092
2304df62
AD
2093: general instructions
2094needman=true
2095firsttime=true
760ac839 2096user=`(logname) 2>/dev/null`
dfe9444c
AD
2097case "$user" in
2098'') user=`whoami 2>&1`;;
760ac839 2099esac
2304df62
AD
2100if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2101 firsttime=false
2102 echo " "
2103 rp='Would you like to see the instructions?'
2104 dflt=n
2105 . ./myread
2106 case "$ans" in
2107 [yY]*) ;;
2108 *) needman=false;;
2109 esac
2110fi
2111if $needman; then
2112 cat <<EOH
4e2a5f63 2113
2304df62 2114This installation shell script will examine your system and ask you questions
a0d0e21e 2115to determine how the perl5 package should be installed. If you get
2304df62
AD
2116stuck on a question, you may use a ! shell escape to start a subshell or
2117execute a command. Many of the questions will have default answers in square
2118brackets; typing carriage return will give you the default.
2119
2120On some of the questions which ask for file or directory names you are allowed
2121to use the ~name construct to specify the login directory belonging to "name",
2122even if you don't have a shell which knows about that. Questions where this is
2123allowed will be marked "(~name ok)".
2124
2125EOH
2126 rp=''
2127 dflt='Type carriage return to continue'
2128 . ./myread
2129 cat <<'EOH'
2130
2131The prompter used in this script allows you to use shell variables and
2132backticks in your answers. You may use $1, $2, etc... to refer to the words
2133in the default answer, as if the default line was a set of arguments given to a
2134script shell. This means you may also use $* to repeat the whole default line,
2135so you do not have to re-type everything to add something to the default.
2136
2137Everytime there is a substitution, you will have to confirm. If there is an
2138error (e.g. an unmatched backtick), the default answer will remain unchanged
2139and you will be prompted again.
2140
2141If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2142the questions and use the computed defaults (or the previous answers if there
2143was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2144You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2145on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2146
2147EOH
2148 . ./myread
2149 cat <<EOH
2150
2151Much effort has been expended to ensure that this shell script will run on any
2152Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2153Configure and run it again. If you can't run Configure for some reason,
2154you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2155have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2156
2157This installation script affects things in two ways:
2158
21591) it may do direct variable substitutions on some of the files included
2160 in this kit.
21612) it builds a config.h file for inclusion in C programs. You may edit
2162 any of these files as the need arises after running this script.
2163
2164If you make a mistake on a question, there is no easy way to back up to it
2165currently. The easiest thing to do is to edit config.sh and rerun all the SH
2166files. Configure will offer to let you do this before it runs the SH files.
2167
2168EOH
2169 dflt='Type carriage return to continue'
2170 . ./myread
2171 case "$firsttime" in
2172 true) echo $user >>../.config/instruct;;
2173 esac
2174fi
2175
2304df62
AD
2176: find out where common programs are
2177echo " "
2178echo "Locating common programs..." >&4
2179cat <<EOSC >loc
2180$startsh
2181case \$# in
21820) exit 1;;
2183esac
2184thing=\$1
2185shift
2186dflt=\$1
2187shift
2188for dir in \$*; do
2189 case "\$thing" in
2190 .)
2191 if test -d \$dir/\$thing; then
2192 echo \$dir
2193 exit 0
2194 fi
2195 ;;
2196 *)
a0d0e21e 2197 for thisthing in \$dir/\$thing; do
ecfc5424 2198 : just loop through to pick last item
a0d0e21e 2199 done
25f94b33 2200 if test -f \$thisthing; then
a0d0e21e 2201 echo \$thisthing
2304df62 2202 exit 0
a5a94ea5
JH
2203 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2204 echo \$thisthing
2205 exit 0
2304df62 2206 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2207 if test -n "$DJGPP"; then
2208 echo \$dir/\$thing.exe
b921d661 2209 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2210 : on Eunice apparently
2211 echo \$dir/\$thing
b921d661 2212 exit 0
c4f23d77 2213 fi
2d736872 2214 exit 0
2304df62
AD
2215 fi
2216 ;;
2217 esac
2218done
2219echo \$dflt
2220exit 1
2221EOSC
2222chmod +x loc
2223$eunicefix loc
2224loclist="
2225awk
2226cat
f8006fac 2227chmod
b4eb6b3d
JH
2228comm
2229cp
2304df62
AD
2230echo
2231expr
2232grep
a0d0e21e 2233ls
b4eb6b3d 2234mkdir
2304df62
AD
2235rm
2236sed
b4eb6b3d 2237sort
85e6fe83 2238touch
2304df62 2239tr
b4eb6b3d 2240uniq
2304df62
AD
2241"
2242trylist="
2243Mcc
dfe9444c 2244ar
3659ebf1 2245bison
b4eb6b3d 2246byacc
2304df62 2247cpp
b4eb6b3d 2248csh
2304df62
AD
2249date
2250egrep
1fef16b3 2251gmake
8ff267be 2252gzip
b4eb6b3d 2253less
8ff267be 2254ln
3c728e00 2255make
b4eb6b3d 2256more
693762b4 2257nm
b4eb6b3d
JH
2258nroff
2259pg
2304df62
AD
2260test
2261uname
8ff267be 2262zip
2304df62 2263"
8e07c86e 2264pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2265pth="$pth /lib /usr/lib"
2266for file in $loclist; do
dfe9444c
AD
2267 eval xxx=\$$file
2268 case "$xxx" in
2269 /*|?:[\\/]*)
2270 if test -f "$xxx"; then
2271 : ok
2272 else
2273 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2274 xxx=`./loc $file $file $pth`
2275 fi
2276 ;;
2277 '') xxx=`./loc $file $file $pth`;;
2278 *) xxx=`./loc $xxx $xxx $pth`;;
2279 esac
a5a94ea5 2280 eval $file=$xxx$_exe
2304df62
AD
2281 eval _$file=$xxx
2282 case "$xxx" in
2283 /*)
2284 echo $file is in $xxx.
2285 ;;
8e07c86e
AD
2286 ?:[\\/]*)
2287 echo $file is in $xxx.
2288 ;;
2304df62 2289 *)
25f94b33
AD
2290 echo "I don't know where '$file' is, and my life depends on it." >&4
2291 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2292 exit 1
2304df62
AD
2293 ;;
2294 esac
2295done
2296echo " "
2297echo "Don't worry if any of the following aren't found..."
2298say=offhand
2299for file in $trylist; do
dfe9444c
AD
2300 eval xxx=\$$file
2301 case "$xxx" in
2302 /*|?:[\\/]*)
2303 if test -f "$xxx"; then
2304 : ok
2305 else
2306 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2307 xxx=`./loc $file $file $pth`
2308 fi
2309 ;;
2310 '') xxx=`./loc $file $file $pth`;;
2311 *) xxx=`./loc $xxx $xxx $pth`;;
2312 esac
306a8474 2313 eval $file=$xxx$_exe
2304df62
AD
2314 eval _$file=$xxx
2315 case "$xxx" in
2316 /*)
2317 echo $file is in $xxx.
2318 ;;
8e07c86e
AD
2319 ?:[\\/]*)
2320 echo $file is in $xxx.
2321 ;;
2304df62
AD
2322 *)
2323 echo "I don't see $file out there, $say."
2324 say=either
2325 ;;
2326 esac
2327done
2328case "$egrep" in
1fef16b3 2329egrep)
2304df62
AD
2330 echo "Substituting grep for egrep."
2331 egrep=$grep
868439a2 2332 _egrep=$grep
2304df62
AD
2333 ;;
2334esac
8ff267be 2335case "$ln" in
1fef16b3 2336ln)
8ff267be 2337 echo "Substituting cp for ln."
2338 ln=$cp
868439a2 2339 _ln=$cp
8ff267be 2340 ;;
2341esac
2e26f1d5
JH
2342case "$make" in
2343make)
2344 case "$gmake" in
2345 gmake)
2346 echo "I can't find make or gmake, and my life depends on it." >&4
2347 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2348 exit 1
2349 ;;
2350 esac
2351 ;;
2352esac
2353case "$gmake" in
2354gmake) ;;
2355*) # We can't have osname yet.
1fef16b3
JH
2356 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2357 # Assume that gmake, if found, is definitely GNU make
2358 # and prefer it over the system make.
2359 echo "Substituting gmake for make."
2360 make=$gmake
868439a2 2361 _make=$gmake
1fef16b3
JH
2362 fi
2363 ;;
a5a94ea5 2364esac
2304df62
AD
2365case "$test" in
2366test)
2367 echo "Hopefully test is built into your sh."
2368 ;;
2369*)
73614538 2370 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2371 echo "Using the test built into your sh."
2304df62
AD
2372 test=test
2373 _test=test
2374 fi
2375 ;;
2376esac
2377case "$echo" in
2378echo)
2379 echo "Hopefully echo is built into your sh."
2380 ;;
2381'') ;;
2382*)
2383 echo " "
2384echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2385 $echo $n "hi there$c" >foo1
2386 echo $n "hi there$c" >foo2
2387 if cmp foo1 foo2 >/dev/null 2>&1; then
2388 echo "They are compatible. In fact, they may be identical."
2389 else
2390 case "$n" in
2391 '-n') n='' c='\c';;
2392 *) n='-n' c='';;
2393 esac
2394 cat <<FOO
2395They are not compatible! You are probably running ksh on a non-USG system.
2396I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2397have echo built in and we may have to run some Bourne shell scripts. That
2398means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2399
2400FOO
2401 $echo $n "The star should be here-->$c"
2402 $echo "*"
2403 fi
2404 $rm -f foo1 foo2
2405 ;;
2406esac
2407
6b769f8f 2408cat <<EOS >trygcc
2573c5f9
JH
2409$startsh
2410EOS
6b769f8f 2411cat <<'EOSC' >>trygcc
2573c5f9
JH
2412case "$cc" in
2413'') ;;
2414*) $rm -f try try.*
2415 $cat >try.c <<EOM
2416int main(int argc, char *argv[]) {
2417 return 0;
2418}
2419EOM
e4778687 2420 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2421 :
2422 else
2423 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2424 despair=yes
2425 trygcc=yes
2426 case "$cc" in
2427 *gcc*) trygcc=no ;;
2428 esac
2429 case "`$cc -v -c try.c 2>&1`" in
2430 *gcc*) trygcc=no ;;
2431 esac
2432 if $test X"$trygcc" = Xyes; then
2433 if gcc -o try -c try.c; then
2434 echo " "
2435 echo "You seem to have a working gcc, though." >&4
2436 rp="Would you like to use it?"
2437 dflt=y
2438 if $test -f myread; then
2439 . ./myread
2440 else
2441 if $test -f UU/myread; then
2442 . ./UU/myread
2443 else
2444 echo "Cannot find myread, sorry. Aborting." >&2
2445 exit 1
2446 fi
2447 fi
2448 case "$ans" in
6371411c
RB
2449 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2450 if $test -f usethreads.cbu; then
2451 $cat >&4 <<EOM
2452
2453*** However, any setting of the C compiler flags (e.g. for thread support)
2454*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2455*** (together with e.g. -Dusethreads).
2456
2457EOM
2458 fi;;
2573c5f9
JH
2459 esac
2460 fi
2461 fi
6b769f8f
RB
2462 fi
2463 $rm -f try try.*
2464 ;;
2465esac
2466EOSC
2467
2468cat <<EOS >checkcc
2469$startsh
2470EOS
2471cat <<'EOSC' >>checkcc
2472case "$cc" in
2473'') ;;
2474*) $rm -f try try.*
2475 $cat >try.c <<EOM
2476int main(int argc, char *argv[]) {
2477 return 0;
2478}
2479EOM
2480 if $cc -o try $ccflags $ldflags try.c; then
2481 :
2482 else
2573c5f9 2483 if $test X"$despair" = Xyes; then
6b769f8f
RB
2484 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2485 fi
2486 $cat >&4 <<EOM
5dd4fbdf
MB
2487You need to find a working C compiler.
2488Either (purchase and) install the C compiler supplied by your OS vendor,
2489or for a free C compiler try http://gcc.gnu.org/
2490I cannot continue any further, aborting.
2491EOM
6b769f8f 2492 exit 1
2573c5f9
JH
2493 fi
2494 $rm -f try try.*
2495 ;;
2496esac
2497EOSC
2498
a0d0e21e
LW
2499: determine whether symbolic links are supported
2500echo " "
2501$touch blurfl
2502if $ln -s blurfl sym > /dev/null 2>&1 ; then
2503 echo "Symbolic links are supported." >&4
818f00be 2504 lns="$ln -s"
a0d0e21e
LW
2505else
2506 echo "Symbolic links are NOT supported." >&4
2507 lns="$ln"
2508fi
2509$rm -f blurfl sym
2510
dafca956
JH
2511: determine whether symbolic links are supported
2512echo " "
2513case "$lns" in
18ea2752 2514*"ln"*" -s")
dafca956
JH
2515 echo "Checking how to test for symbolic links..." >&4
2516 $lns blurfl sym
4b661809 2517 if $test "X$issymlink" = X; then
2e2a97a6
JH
2518 case "$newsh" in
2519 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2520 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2521 esac
5d644a95
MB
2522 if test $? = 0; then
2523 issymlink="test -h"
2e2a97a6
JH
2524 else
2525 echo "Your builtin 'test -h' may be broken." >&4
2526 case "$test" in
2527 /*) ;;
2528 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2529 for p in $pth
2530 do
2531 if test -f "$p/$test"; then
2532 test="$p/$test"
2533 break
2534 fi
2535 done
2536 ;;
2537 esac
2538 case "$test" in
2539 /*)
2540 echo "Trying external '$test -h'." >&4
2541 issymlink="$test -h"
2542 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2543 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2544 issymlink=''
2545 fi
2546 ;;
2547 *) issymlink='' ;;
2548 esac
5d644a95
MB
2549 fi
2550 fi
4b661809 2551 if $test "X$issymlink" = X; then
dafca956 2552 if $test -L sym 2>/dev/null; then
5d644a95 2553 issymlink="$test -L"
2e2a97a6 2554 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2555 fi
2556 fi
4b661809 2557 if $test "X$issymlink" != X; then
5d644a95 2558 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2559 else
2560 echo "I do not know how you can test for symbolic links." >&4
2561 fi
2562 $rm -f blurfl sym
2563 ;;
2564*) echo "No symbolic links, so not testing for their testing..." >&4
2565 ;;
2566esac
2567echo " "
2568
2569
2570case "$mksymlinks" in
2571$define|true|[yY]*)
2572 case "$src" in
2573 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2574 exit 1
2575 ;;
4b661809 2576 *) case "$lns:$issymlink" in
f314eb9f 2577 *"ln"*" -s:"*"test -"?)
dafca956
JH
2578 echo "Creating the symbolic links..." >&4
2579 echo "(First creating the subdirectories...)" >&4
2580 cd ..
2581 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2582 read directory
2583 test -z "$directory" && break
2584 mkdir -p $directory
2585 done
2586 # Sanity check 1.
2587 if test ! -d t/base; then
2588 echo "Failed to create the subdirectories. Aborting." >&4
2589 exit 1
2590 fi
2591 echo "(Then creating the symlinks...)" >&4
2592 awk '{print $1}' $src/MANIFEST | while true; do
2593 read filename
2594 test -z "$filename" && break
2595 if test -f $filename; then
5d644a95 2596 if $issymlink $filename; then
dafca956
JH
2597 rm -f $filename
2598 fi
2599 fi
2600 if test -f $filename; then
2601 echo "$filename already exists, not symlinking."
2602 else
2603 ln -s $src/$filename $filename
2604 fi
2605 done
2606 # Sanity check 2.
a0d24b8a
JH
2607 if test ! -f t/base/lex.t; then
2608 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2609 exit 1
2610 fi
2611 cd UU
2612 ;;
2613 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2614 ;;
2615 esac
2616 ;;
2617 esac
2618 ;;
2619esac
2620
5440bc8e
JH
2621
2622case "$usecrosscompile" in
2623$define|true|[yY]*)
93bc48fa 2624 $echo "Cross-compiling..."
5440bc8e
JH
2625 croak=''
2626 case "$cc" in
2627 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2628 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2629 ar=$targetarch-ar
2630 # leave out ld, choosing it is more complex
2631 nm=$targetarch-nm
2632 ranlib=$targetarch-ranlib
93bc48fa 2633 $echo 'extern int foo;' > try.c
f8006fac 2634 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2635 shift
2636 if $test $# -gt 0; then
2637 incpth="$incpth $*"
f8006fac
JH
2638 incpth="`$echo $incpth|$sed 's/^ //'`"
2639 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2640 for i in $*; do
f8006fac 2641 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2642 if $test -d $j; then
2643 libpth="$libpth $j"
2644 fi
2645 done
f8006fac
JH
2646 libpth="`$echo $libpth|$sed 's/^ //'`"
2647 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2648 fi
2649 $rm -f try.c
5440bc8e
JH
2650 ;;
2651 esac
2652 case "$targetarch" in
93bc48fa
JH
2653 '') echo "Targetarch not defined." >&4; croak=y ;;
2654 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2655 esac
2656 case "$incpth" in
93bc48fa 2657 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2658 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2659 esac
2660 case "$libpth" in
93bc48fa 2661 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2662 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2663 esac
93bc48fa
JH
2664 case "$usrinc" in
2665 '') for i in $incpth; do
2666 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2667 usrinc=$i
2668 echo "Guessing usrinc $usrinc." >&4
2669 break
2670 fi
2671 done
2672 case "$usrinc" in
2673 '') echo "Usrinc not defined." >&4; croak=y ;;
2674 esac
2675 ;;
2676 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2677 esac
93bc48fa
JH
2678 case "$targethost" in
2679 '') echo "Targethost not defined." >&4; croak=y ;;
2680 *) echo "Using targethost $targethost." >&4
5440bc8e 2681 esac
93bc48fa
JH
2682 locincpth=' '
2683 loclibpth=' '
5440bc8e 2684 case "$croak" in
93bc48fa 2685 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2686 esac
2687 case "$src" in
2688 /*) run=$src/Cross/run
93c0359c 2689 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2690 to=$src/Cross/to
2691 from=$src/Cross/from
2692 ;;
93bc48fa 2693 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2694 run=$pwd/Cross/run
f8006fac 2695 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2696 to=$pwd/Cross/to
2697 from=$pwd/Cross/from
2698 ;;
2699 esac
2700 case "$targetrun" in
2701 '') targetrun=ssh ;;
2702 esac
2703 case "$targetto" in
2704 '') targetto=scp ;;
2705 esac
2706 case "$targetfrom" in
2707 '') targetfrom=scp ;;
2708 esac
2709 run=$run-$targetrun
2710 to=$to-$targetto
2711 from=$from-$targetfrom
93bc48fa
JH
2712 case "$targetdir" in
2713 '') targetdir=/tmp
2714 echo "Guessing targetdir $targetdir." >&4
2715 ;;
2716 esac
5440bc8e 2717 case "$targetuser" in
93bc48fa
JH
2718 '') targetuser=root
2719 echo "Guessing targetuser $targetuser." >&4
2720 ;;
5440bc8e
JH
2721 esac
2722 case "$targetfrom" in
2723 scp) q=-q ;;
2724 *) q='' ;;
2725 esac
2726 case "$targetrun" in
2727 ssh|rsh)
2728 cat >$run <<EOF
2729#!/bin/sh
93c0359c
JH
2730case "\$1" in
2731-cwd)
2732 shift
2733 cwd=\$1
2734 shift
2735 ;;
2736esac
2737case "\$cwd" in
2738'') cwd=$targetdir ;;
2739esac
5440bc8e
JH
2740exe=\$1
2741shift
93c0359c
JH
2742if $test ! -f \$exe.xok; then
2743 $to \$exe
2744 $touch \$exe.xok
2745fi
2746$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2747EOF
2748 ;;
93bc48fa 2749 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2750 exit 1
2751 ;;
2752 esac
93c0359c
JH
2753 case "$targetmkdir" in
2754 */Cross/mkdir)
2755 cat >$targetmkdir <<EOF
2756#!/bin/sh
2757$targetrun -l $targetuser $targethost "mkdir -p \$@"
2758EOF
f8006fac 2759 $chmod a+rx $targetmkdir
93c0359c
JH
2760 ;;
2761 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2762 exit 1
2763 ;;
2764 esac
5440bc8e
JH
2765 case "$targetto" in
2766 scp|rcp)
2767 cat >$to <<EOF
2768#!/bin/sh
2769for f in \$@
2770do
93c0359c
JH
2771 case "\$f" in
2772 /*)
2773 $targetmkdir \`dirname \$f\`
2774 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2775 ;;
2776 *)
2777 $targetmkdir $targetdir/\`dirname \$f\`
2778 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2779 ;;
2780 esac
5440bc8e
JH
2781done
2782exit 0
2783EOF
2784 ;;
2785 cp) cat >$to <<EOF
2786#!/bin/sh
93c0359c
JH
2787for f in \$@
2788do
2789 case "\$f" in
2790 /*)
2791 $mkdir -p $targetdir/\`dirname \$f\`
2792 $cp \$f $targetdir/\$f || exit 1
2793 ;;
2794 *)
2795 $targetmkdir $targetdir/\`dirname \$f\`
2796 $cp \$f $targetdir/\$f || exit 1
2797 ;;
2798 esac
2799done
2800exit 0
5440bc8e
JH
2801EOF
2802 ;;
93bc48fa 2803 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2804 exit 1
2805 ;;
2806 esac
2807 case "$targetfrom" in
2808 scp|rcp)
2809 cat >$from <<EOF
2810#!/bin/sh
2811for f in \$@
2812do
93c0359c 2813 $rm -f \$f
5440bc8e
JH
2814 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2815done
2816exit 0
2817EOF
2818 ;;
2819 cp) cat >$from <<EOF
2820#!/bin/sh
2821for f in \$@
2822do
93c0359c 2823 $rm -f \$f
5440bc8e
JH
2824 cp $targetdir/\$f . || exit 1
2825done
2826exit 0
2827EOF
2828 ;;
93bc48fa 2829 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2830 exit 1
2831 ;;
2832 esac
93bc48fa
JH
2833 if $test ! -f $run; then
2834 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2835 else
f8006fac 2836 $chmod a+rx $run
5440bc8e 2837 fi
93bc48fa
JH
2838 if $test ! -f $to; then
2839 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2840 else
f8006fac 2841 $chmod a+rx $to
5440bc8e 2842 fi
93bc48fa
JH
2843 if $test ! -f $from; then
2844 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2845 else
f8006fac 2846 $chmod a+rx $from
5440bc8e 2847 fi
93bc48fa 2848 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2849 exit 1
2850 fi
2851 cat >&4 <<EOF
f8006fac
JH
2852Using '$run' for remote execution,
2853and '$from' and '$to'
93bc48fa 2854for remote file transfer.
5440bc8e
JH
2855EOF
2856 ;;
2857*) run=''
2858 to=:
2859 from=:
2860 usecrosscompile='undef'
2861 targetarch=''
2862 ;;
2863esac
2864
ecfc5424
AD
2865: see whether [:lower:] and [:upper:] are supported character classes
2866echo " "
ecfc5424
AD
2867case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2868ABYZ)
2869 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2870 up='[:upper:]'
2871 low='[:lower:]'
2872 ;;
28e8609d
JH
2873*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2874 # (0xc9 and 0xd1), therefore that is a nice testing point.
2875 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2876 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2877 ij) up='[A-Z]'
2878 low='[a-z]'
2879 ;;
2880 esac
2881 fi
2882 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2883 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2884 ij) up='A-Z'
2885 low='a-z'
2886 ;;
2887 esac
2888 fi
2889 if test "X$up" = X -o "X$low" = X; then
2890 case "`echo IJ | od -x 2>/dev/null`" in
2891 *C9D1*|*c9d1*)
2892 echo "Hey, this might be EBCDIC." >&4
2893 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2894 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2895 ij) up='[A-IJ-RS-Z]'
2896 low='[a-ij-rs-z]'
2897 ;;
2898 esac
2899 fi
2900 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2901 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2902 ij) up='A-IJ-RS-Z'
2903 low='a-ij-rs-z'
2904 ;;
2905 esac
2906 fi
2907 ;;
2908 esac
2909 fi
2910esac
3eaeeeae 2911case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2912ij)
2913 echo "Using $up and $low to convert case." >&4
2914 ;;
ecfc5424 2915*)
28e8609d
JH
2916 echo "I don't know how to translate letters from upper to lower case." >&4
2917 echo "Your tr is not acting any way I know of." >&4
2918 exit 1
2919 ;;
ecfc5424
AD
2920esac
2921: set up the translation script tr, must be called with ./tr of course
2922cat >tr <<EOSC
2923$startsh
2924case "\$1\$2" in
2925'[A-Z][a-z]') exec $tr '$up' '$low';;
2926'[a-z][A-Z]') exec $tr '$low' '$up';;
2927esac
2928exec $tr "\$@"
2929EOSC
2930chmod +x tr
2931$eunicefix tr
2932
2304df62
AD
2933: Try to determine whether config.sh was made on this system
2934case "$config_sh" in
2935'')
43999f95
JH
2936myuname=`$uname -a 2>/dev/null`
2937$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2938# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2939# because the A-Z/a-z are not consecutive.
a0d0e21e 2940myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2941 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2942newmyuname="$myuname"
2304df62 2943dflt=n
16d20bd9
AD
2944case "$knowitall" in
2945'')
2946 if test -f ../config.sh; then
2947 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2948 eval "`grep myuname= ../config.sh`"
2949 fi
2950 if test "X$myuname" = "X$newmyuname"; then
2951 dflt=y
2952 fi
2304df62 2953 fi
16d20bd9
AD
2954 ;;
2955*) dflt=y;;
2956esac
2304df62
AD
2957
2958: Get old answers from old config file if Configure was run on the
2959: same system, otherwise use the hints.
2960hint=default
2961cd ..
2962if test -f config.sh; then
16d20bd9
AD
2963 echo " "
2964 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2965 . UU/myread
2966 case "$ans" in
f83701cd
AD
2967 n*|N*) echo "OK, I'll ignore it."
2968 mv config.sh config.sh.old
2969 myuname="$newmyuname"
2970 ;;
2304df62 2971 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2972 tmp_n="$n"
2973 tmp_c="$c"
85cad39c 2974 tmp_sh="$sh"
2304df62
AD
2975 . ./config.sh
2976 cp config.sh UU
ecfc5424
AD
2977 n="$tmp_n"
2978 c="$tmp_c"
85cad39c 2979 : Older versions did not always set $sh. Catch re-use of such
2980 : an old config.sh.
2981 case "$sh" in
2982 '') sh="$tmp_sh" ;;
2983 esac
2304df62
AD
2984 hint=previous
2985 ;;
2986 esac
2987fi
2573c5f9 2988. ./UU/checkcc
2304df62
AD
2989if test ! -f config.sh; then
2990 $cat <<EOM
2991
4e2a5f63
AD
2992First time through, eh? I have some defaults handy for some systems
2993that need some extra help getting the Configure answers right:
2304df62
AD
2994
2995EOM
dfe9444c 2996 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2997 dflt=''
2998 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2999 : tests or hints, please send them to perlbug@perl.org
2304df62 3000 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3001 $test -f /irix && osname=irix
85e6fe83
LW
3002 $test -f /xenix && osname=sco_xenix
3003 $test -f /dynix && osname=dynix
3004 $test -f /dnix && osname=dnix
5f05dabc 3005 $test -f /lynx.os && osname=lynxos
3006 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3007 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3008 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3009 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3010 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3011 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3012 $test -d /usr/apollo/bin && osname=apollo
3013 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3014 $test -d /usr/include/minix && osname=minix
d54344fc 3015 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3016 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3017 osname=machten
4633a7c4 3018 if $test -x /sbin/version; then
dfe9444c 3019 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3020 $sed -e 's/[A-Za-z]$//'`
3021 elif $test -x /usr/etc/version; then
dfe9444c 3022 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3023 $sed -e 's/[A-Za-z]$//'`
3024 else
3025 osvers="$2.$3"
3026 fi
3027 fi
aaacdc8b
GS
3028
3029 $test -f /sys/posix.dll &&
3030 $test -f /usr/bin/what &&
3031 set X `/usr/bin/what /sys/posix.dll` &&
3032 $test "$3" = UWIN &&
3033 osname=uwin &&
3034 osvers="$5"
3035
2304df62
AD
3036 if $test -f $uname; then
3037 set X $myuname
3038 shift
3039
2304df62 3040 case "$5" in
85e6fe83 3041 fps*) osname=fps ;;
2304df62
AD
3042 mips*)
3043 case "$4" in
85e6fe83
LW
3044 umips) osname=umips ;;
3045 *) osname=mips ;;
2304df62 3046 esac;;
85e6fe83
LW
3047 [23]100) osname=mips ;;
3048 next*) osname=next ;;
ecfc5424 3049 i386*)
c6912327
JH
3050 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3051 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3052 osname='sco'
3053 osvers=$tmp
3054 elif $test -f /etc/kconfig; then
ecfc5424 3055 osname=isc
bd628c73 3056 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3057 osvers=4
3058 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3059 osvers=3
2304df62 3060 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3061 osvers=2
ecfc5424
AD
3062 fi
3063 fi
2000072c 3064 tmp=''
ecfc5424 3065 ;;
c4f23d77
AD
3066 pc*)
3067 if test -n "$DJGPP"; then
3068 osname=dos
3069 osvers=djgpp
3070 fi
3071 ;;
2304df62
AD
3072 esac
3073
3074 case "$1" in
a0d0e21e
LW
3075 aix) osname=aix
3076 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3077 case "$tmp" in
1aef975c 3078 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
3079 '<3240'|'<>3240') osvers=3.2.0 ;;
3080 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3081 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3082 *) osvers=$tmp;;
a0d0e21e
LW
3083 esac
3084 ;;
aaacdc8b
GS
3085 bsd386) osname=bsd386
3086 osvers=`$uname -r`
3087 ;;
3088 cygwin*) osname=cygwin
3089 osvers="$3"
3090 ;;
23f87696
SZ
3091 *dc.osx) osname=dcosx
3092 osvers="$3"
3093 ;;
a0d0e21e
LW
3094 dnix) osname=dnix
3095 osvers="$3"
3096 ;;
3097 domainos) osname=apollo
3098 osvers="$3"
3099 ;;
3100 dgux) osname=dgux
3101 osvers="$3"
3102 ;;
760ac839 3103 dynixptx*) osname=dynixptx
e58e581d 3104 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3105 ;;
a0d0e21e
LW
3106 freebsd) osname=freebsd
3107 osvers="$3" ;;
3108 genix) osname=genix ;;
3109 hp*) osname=hpux
bfb7748a 3110 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3111 ;;
a78b0d02 3112 irix*) osname=irix
a0d0e21e
LW
3113 case "$3" in
3114 4*) osvers=4 ;;
3115 5*) osvers=5 ;;
ecfc5424 3116 *) osvers="$3" ;;
a0d0e21e
LW
3117 esac
3118 ;;
3119 linux) osname=linux
3120 case "$3" in
a0d0e21e
LW
3121 *) osvers="$3" ;;
3122 esac
3123 ;;
28e8609d
JH
3124 MiNT) osname=mint
3125 ;;
3126 netbsd*) osname=netbsd
ecfc5424
AD
3127 osvers="$3"
3128 ;;
4e81affe
MM
3129 news-os) osvers="$3"
3130 case "$3" in
3131 4*) osname=newsos4 ;;
3132 *) osname=newsos ;;
3133 esac
3134 ;;
aaacdc8b 3135 next*) osname=next ;;
28bb1e2c 3136 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3137 openbsd) osname=openbsd
3138 osvers="$3"
3139 ;;
aaacdc8b
GS
3140 POSIX-BC | posix-bc ) osname=posix-bc
3141 osvers="$3"
a0d0e21e 3142 ;;
ae3afa4e
TH
3143 powerux | power_ux | powermax_os | powermaxos | \
3144 powerunix | power_unix) osname=powerux
3145 osvers="$3"
3146 ;;
aaacdc8b
GS
3147 qnx) osname=qnx
3148 osvers="$4"
3149 ;;
a0d0e21e
LW
3150 solaris) osname=solaris
3151 case "$3" in
3152 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3153 *) osvers="$3" ;;
a0d0e21e
LW
3154 esac
3155 ;;
85e6fe83
LW
3156 sunos) osname=sunos
3157 case "$3" in
85e6fe83
LW
3158 5*) osname=solaris
3159 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3160 *) osvers="$3" ;;
2304df62
AD
3161 esac
3162 ;;
a0d0e21e 3163 titanos) osname=titanos
85e6fe83 3164 case "$3" in
a0d0e21e
LW
3165 1*) osvers=1 ;;
3166 2*) osvers=2 ;;
3167 3*) osvers=3 ;;
3168 4*) osvers=4 ;;
ecfc5424 3169 *) osvers="$3" ;;
2304df62
AD
3170 esac
3171 ;;
85e6fe83 3172 ultrix) osname=ultrix
ecfc5424 3173 osvers="$3"
2304df62 3174 ;;
28757baa 3175 osf1|mls+) case "$5" in
fed7345c
AD
3176 alpha)
3177 osname=dec_osf
fdd85a03 3178 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3179 case "$osvers" in
3180 [1-9].[0-9]*) ;;
3181 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3182 esac
ecfc5424
AD
3183 ;;
3184 hp*) osname=hp_osf1 ;;
3185 mips) osname=mips_osf1 ;;
85e6fe83
LW
3186 esac
3187 ;;
0337d152
BG
3188 unixware) osname=svr5
3189 osvers="$4"
3190 ;;
3c728e00 3191 uts) osname=uts
a0d0e21e
LW
3192 osvers="$3"
3193 ;;
3c728e00
JH
3194 vos) osvers="$3"
3195 ;;
85e6fe83 3196 $2) case "$osname" in
2304df62 3197 *isc*) ;;
a0d0e21e 3198 *freebsd*) ;;
5f05dabc 3199 svr*)
a0d0e21e
LW
3200 : svr4.x or possibly later
3201 case "svr$3" in
3202 ${osname}*)
3203 osname=svr$3
3204 osvers=$4
3205 ;;
3206 esac
3207 case "$osname" in
3208 svr4.0)
3209 : Check for ESIX
3210 if test -f /stand/boot ; then
3211 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3212 if test -n "$INITPROG" -a -f "$INITPROG"; then
3213 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3214 if test -n "$isesix"; then
a0d0e21e
LW
3215 osname=esix4
3216 fi
3217 fi
3218 fi
3219 ;;
3220 esac
3221 ;;
2304df62 3222 *) if test -f /etc/systemid; then
a0d0e21e
LW
3223 osname=sco
3224 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3225 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3226 osvers=$1.$2.$3
c4f23d77 3227 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3228 osvers=$1.$2
c4f23d77 3229 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3230 osvers=$1
2304df62 3231 fi
a0d0e21e
LW
3232 else
3233 case "$osname" in
3234 '') : Still unknown. Probably a generic Sys V.
3235 osname="sysv"
3236 osvers="$3"
3237 ;;
3238 esac
2304df62
AD
3239 fi
3240 ;;
3241 esac
3242 ;;
a0d0e21e
LW
3243 *) case "$osname" in
3244 '') : Still unknown. Probably a generic BSD.
3245 osname="$1"
3246 osvers="$3"
3247 ;;
3248 esac
3249 ;;
2304df62
AD
3250 esac
3251 else
dfe9444c
AD
3252 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3253 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3254 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3255 osname=news_os
2304df62 3256 fi
dfe9444c 3257 $rm -f UU/kernel.what
8e07c86e
AD
3258 elif test -d c:/.; then
3259 set X $myuname
3260 osname=os2
3261 osvers="$5"
2304df62
AD
3262 fi
3263 fi
85e6fe83 3264
5440bc8e
JH
3265 case "$targetarch" in
3266 '') ;;
3267 *) hostarch=$osname
3268 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3269 osvers=''
3270 ;;
3271 esac
3272
a0d0e21e
LW
3273 : Now look for a hint file osname_osvers, unless one has been
3274 : specified already.
3275 case "$hintfile" in
3276 ''|' ')
1e127011 3277 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3278 : Also try without trailing minor version numbers.
1e127011
DD
3279 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3280 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3281 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3282 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3283 case "$file" in
3284 '') dflt=none ;;
3285 *) case "$osvers" in
3286 '') dflt=$file
3287 ;;
dfe9444c 3288 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3289 dflt=$file
dfe9444c 3290 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3291 dflt=$xfile
dfe9444c 3292 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3293 dflt=$xxfile
dfe9444c 3294 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3295 dflt=$xxxfile
dfe9444c 3296 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3297 dflt=$xxxxfile
dfe9444c 3298 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3299 dflt="${osname}"
3300 else
3301 dflt=none
3302 fi
3303 ;;
3304 esac
85e6fe83
LW
3305 ;;
3306 esac
4e2a5f63
AD
3307 if $test -f Policy.sh ; then
3308 case "$dflt" in
3309 *Policy*) ;;
3310 none) dflt="Policy" ;;
3311 *) dflt="Policy $dflt" ;;
3312 esac
3313 fi
85e6fe83 3314 ;;
a0d0e21e 3315 *)
ecfc5424 3316 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3317 ;;
2304df62 3318 esac
1aef975c 3319
4e2a5f63
AD
3320 if $test -f Policy.sh ; then
3321 $cat <<EOM
3322
3323There's also a Policy hint file available, which should make the
3324site-specific (policy) questions easier to answer.
3325EOM
3326
3327 fi
3328
2304df62
AD
3329 $cat <<EOM
3330
3331You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3332A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3333is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3334
3335EOM
4e2a5f63 3336
2304df62 3337 rp="Which of these apply, if any?"
dfe9444c 3338 . UU/myread
85e6fe83
LW
3339 tans=$ans
3340 for file in $tans; do
4e2a5f63
AD
3341 if $test X$file = XPolicy -a -f Policy.sh; then
3342 . Policy.sh
3343 $cat Policy.sh >> UU/config.sh
3344 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3345 . $src/hints/$file.sh
3346 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3347 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3348 : nothing
3349 else
85e6fe83
LW
3350 : Give one chance to correct a possible typo.
3351 echo "$file.sh does not exist"
3352 dflt=$file
3353 rp="hint to use instead?"
dfe9444c 3354 . UU/myread
85e6fe83 3355 for file in $ans; do
dfe9444c
AD
3356 if $test -f "$src/hints/$file.sh"; then
3357 . $src/hints/$file.sh
3358 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3359 elif $test X$ans = X -o X$ans = Xnone ; then
3360 : nothing
3361 else
3362 echo "$file.sh does not exist -- ignored."
3363 fi
3364 done
2304df62
AD
3365 fi
3366 done
85e6fe83 3367
2304df62 3368 hint=recommended
85e6fe83 3369 : Remember our hint file for later.
dfe9444c 3370 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3371 hintfile="$file"
85e6fe83 3372 else
a0d0e21e 3373 hintfile=''
85e6fe83 3374 fi
2304df62
AD
3375fi
3376cd UU
3377;;
3378*)
3379 echo " "
3380 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3381 tmp_n="$n"
3382 tmp_c="$c"
2304df62
AD
3383 cd ..
3384 cp $config_sh config.sh 2>/dev/null
a78b0d02 3385 chmod +w config.sh
2304df62
AD
3386 . ./config.sh
3387 cd UU
3388 cp ../config.sh .
ecfc5424
AD
3389 n="$tmp_n"
3390 c="$tmp_c"
2304df62
AD
3391 hint=previous
3392 ;;
3393esac
1aef975c 3394test "$override" && . ./optdef.sh
2304df62
AD
3395
3396: Restore computed paths
3397for file in $loclist $trylist; do
3398 eval $file="\$_$file"
3399done
3400
85e6fe83 3401cat << EOM
a0d0e21e 3402
85e6fe83 3403Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3404The default value is probably right if the name rings a bell. Otherwise,
3405since spelling matters for me, either accept the default or answer "none"
3406to leave it blank.
a0d0e21e 3407
85e6fe83 3408EOM
85e6fe83 3409case "$osname" in
a0d0e21e 3410 ''|' ')
85e6fe83 3411 case "$hintfile" in
a0d0e21e 3412 ''|' '|none) dflt=none ;;
ecfc5424 3413 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3414 esac
3415 ;;
3416 *) dflt="$osname" ;;
3417esac
3418rp="Operating system name?"
3419. ./myread
3420case "$ans" in
ecfc5424
AD
3421none) osname='' ;;
3422*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3423esac
8ff267be 3424echo " "
3425case "$osvers" in
3426 ''|' ')
3427 case "$hintfile" in
3428 ''|' '|none) dflt=none ;;
3429 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3430 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3431 case "$dflt" in
3432 ''|' ') dflt=none ;;
3433 esac
3434 ;;
3435 esac
3436 ;;
3437 *) dflt="$osvers" ;;
3438esac
3439rp="Operating system version?"
3440. ./myread
3441case "$ans" in
3442none) osvers='' ;;
3443*) osvers="$ans" ;;
3444esac
3445
02e93a22
JH
3446
3447. ./posthint.sh
3448
2304df62 3449: who configured the system
59b83a6f 3450cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3451cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3452case "$cf_by" in
3453"")
8ff267be 3454 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3455 case "$cf_by" in
3456 "") cf_by=unknown ;;
8ff267be 3457 esac ;;
3458esac
2304df62 3459
b4eb6b3d
JH
3460: set up the script used to warn in case of inconsistency
3461cat <<EOS >whoa
3462$startsh
3463EOS
3464cat <<'EOSC' >>whoa
3465dflt=y
3466echo " "
3467echo "*** WHOA THERE!!! ***" >&4
3468echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3469rp=" Keep the $hint value?"
3470. ./myread
3471case "$ans" in
3472y) td=$was; tu=$was;;
3473esac
3474EOSC
3475
3476: function used to set $1 to $val
3477setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3478case "$val$was" in
3479$define$undef) . ./whoa; eval "$var=\$td";;
3480$undef$define) . ./whoa; eval "$var=\$tu";;
3481*) eval "$var=$val";;
3482esac'
3483
b29b105d
JH
3484case "$usesocks" in
3485$define|true|[yY]*) dflt='y';;
3486*) dflt='n';;
3487esac
3488cat <<EOM
3489
3490Perl can be built to use the SOCKS proxy protocol library. To do so,
3491Configure must be run with -Dusesocks. If you use SOCKS you also need
3492to use the PerlIO abstraction layer, this will be implicitly selected.
3493
3494If this doesn't make any sense to you, just accept the default '$dflt'.
3495EOM
3496rp='Build Perl for SOCKS?'
3497. ./myread
3498case "$ans" in
3499y|Y) val="$define" ;;
3500*) val="$undef" ;;
3501esac
3502set usesocks
3503eval $setvar
3504
3505case "$usesocks" in
3506$define|true|[yY]*) useperlio="$define";;
3507esac
3508
3509case "$useperlio" in
3510$define|true|[yY]*|'') dflt='y';;
3511*) dflt='n';;
3512esac
3513cat <<EOM
3514
3515Previous version of $package used the standard IO mechanisms as
3516defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3517alternate IO mechanisms via the PerlIO abstraction layer, but the
3518stdio mechanism is still available if needed. The abstraction layer
3519can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3520Using PerlIO with sfio may cause problems with some extension modules.
3521
3522If this doesn't make any sense to you, just accept the default '$dflt'.
3523EOM
3524rp='Use the PerlIO abstraction layer?'
3525. ./myread
3526case "$ans" in
3527y|Y)
3528 val="$define"
3529 ;;
3530*)
3531 echo "Ok, doing things the stdio way."
3532 val="$undef"
3533 ;;
3534esac
3535set useperlio
3536eval $setvar
3537
3538case "$usesocks" in
3539$define|true|[yY]*)
3540 case "$useperlio" in
3541 $define|true|[yY]*) ;;
3542 *) cat >&4 <<EOM
3543
3544You are using the SOCKS proxy protocol library which means that you
3545should also use the PerlIO layer. You may be headed for trouble.
3546
3547EOM
3548 ;;
3549 esac
3550 ;;
3551esac
3552
3553
b4eb6b3d
JH
3554case "$usethreads" in
3555$define|true|[yY]*) dflt='y';;
8e285145
AD
3556*) # Catch case where user specified ithreads or 5005threads but
3557 # forgot -Dusethreads (A.D. 4/2002)
3558 case "$useithreads$use5005threads" in
b29b105d
JH
3559 *$define*)
3560 case "$useperlio" in
3561 "$define") dflt='y' ;;
3562 *) dflt='n' ;;
3563 esac
3564 ;;
3565 *) dflt='n';;
8e285145
AD
3566 esac
3567 ;;
b4eb6b3d
JH
3568esac
3569cat <<EOM
3570
3571Perl can be built to take advantage of threads on some systems.
3572To do so, Configure can be run with -Dusethreads.
3573
bfce6503
DM
3574Note that Perl built with threading support runs slightly slower
3575and uses more memory than plain Perl. The current implementation
3576is believed to be stable, but it is fairly new, and so should be
3577treated with caution.
b4eb6b3d
JH
3578
3579If this doesn't make any sense to you, just accept the default '$dflt'.
3580EOM
3581rp='Build a threading Perl?'
3582. ./myread
3583case "$ans" in
3584y|Y) val="$define" ;;
3585*) val="$undef" ;;
3586esac
3587set usethreads
3588eval $setvar
3589
3590case "$usethreads" in
3591$define)
3592 $cat <<EOM
3593
bfce6503
DM
3594Since release 5.6, Perl has had two different threading implementations,
3595the newer interpreter-based version (ithreads) with one interpreter per
3596thread, and the older 5.005 version (5005threads).
3597The 5005threads version is effectively unmaintained and will probably be
3598removed in Perl 5.10, so there should be no need to build a Perl using it
3599unless needed for backwards compatibility with some existing 5.005threads
3600code.
b4eb6b3d 3601
b4eb6b3d
JH
3602EOM
3603 : Default to ithreads unless overridden on command line or with
3604 : old config.sh
3605 dflt='y'
3606 case "$use5005threads" in
3607 $define|true|[yY]*) dflt='n';;
3608 esac
3609 case "$useithreads" in
3610 $undef|false|[nN]*) dflt='n';;
3611 esac
bfce6503 3612 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3613 . ./myread
3614 case "$ans" in
3615 y|Y) val="$define" ;;
3616 *) val="$undef" ;;
3617 esac
3618 set useithreads
3619 eval $setvar
3620 : Now set use5005threads to the opposite value.
3621 case "$useithreads" in
3622 $define) val="$undef" ;;
3623 *) val="$define" ;;
3624 esac
3625 set use5005threads
3626 eval $setvar
3627 ;;
3628*)
3629 useithreads="$undef"
3630 use5005threads="$undef"
3631 ;;
3632esac
3633
c915ce7f
JH
3634case "$useithreads$use5005threads" in
3635"$define$define")
3636 $cat >&4 <<EOM
3637
3638You cannot have both the ithreads and the 5.005 threads enabled
3639at the same time. Disabling the 5.005 threads since they are
3640much less stable than the ithreads.
3641
3642EOM
3643 use5005threads="$undef"
3644 ;;
3645esac
3646
b29b105d
JH
3647if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3648 cat >&4 <<EOF
3649***
3650*** To build with ithreads you must also use the PerlIO layer.
3651*** Cannot continue, aborting.
3652***
3653EOF
3654 exit 1
3655fi
3656
b4eb6b3d
JH
3657case "$d_oldpthreads" in
3658'') : Configure tests would be welcome here. For now, assume undef.
3659 val="$undef" ;;
3660*) val="$d_oldpthreads" ;;
3661esac
3662set d_oldpthreads
3663eval $setvar
3664
3665
3666case "$usethreads" in
3667"$define"|true|[yY]*)
3668: Look for a hint-file generated 'call-back-unit'. If the
3669: user has specified that a threading perl is to be built,
3670: we may need to set or change some other defaults.
3671 if $test -f usethreads.cbu; then
3672 echo "Your platform has some specific hints for threaded builds, using them..."
3673 . ./usethreads.cbu
3674 else
3675 $cat <<EOM
3676(Your platform doesn't have any specific hints for threaded builds.
3677 Assuming POSIX threads, then.)
3678EOM
3679 fi
3680 ;;
3681esac
3682
3683cat <<EOM
3684
3685Perl can be built so that multiple Perl interpreters can coexist
3686within the same Perl executable.
3687EOM
3688
3689case "$useithreads" in
3690$define)
3691 cat <<EOM
3692This multiple interpreter support is required for interpreter-based threads.
3693EOM
3694 val="$define"
3695 ;;
3696*) case "$usemultiplicity" in
3697 $define|true|[yY]*) dflt='y';;
3698 *) dflt='n';;
3699 esac
3700 echo " "
3701 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3702 rp='Build Perl for multiplicity?'
3703 . ./myread
3704 case "$ans" in
3705 y|Y) val="$define" ;;
3706 *) val="$undef" ;;
3707 esac
3708 ;;
3709esac
3710set usemultiplicity
3711eval $setvar
3712
96056487
JH
3713
3714case "$usemorebits" in
3715"$define"|true|[yY]*)
3716 use64bitint="$define"
3717 uselongdouble="$define"
3718 usemorebits="$define"
3719 ;;
3720*) usemorebits="$undef"
3721 ;;
3722esac
3723
e5e20432
JH
3724: make some quick guesses about what we are up against
3725echo " "
3726$echo $n "Hmm... $c"
3727echo exit 1 >bsd
3728echo exit 1 >usg
3729echo exit 1 >v7
3730echo exit 1 >osf1
3731echo exit 1 >eunice
3732echo exit 1 >xenix
3733echo exit 1 >venix
3734echo exit 1 >os2
3735d_bsd="$undef"
3736$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3737if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3738then
3739 echo "Looks kind of like an OSF/1 system, but we'll see..."
3740 echo exit 0 >osf1
381aa1ff 3741elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3742 xxx=`./loc addbib blurfl $pth`
3743 if $test -f $xxx; then
3744 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3745 echo exit 0 >bsd
3746 echo exit 0 >usg
3747 else
3748 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3749 echo "Looks kind of like an extended USG system, but we'll see..."
3750 else
3751 echo "Looks kind of like a USG system, but we'll see..."
3752 fi
3753 echo exit 0 >usg
3754 fi
3755elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3756 echo "Looks kind of like a BSD system, but we'll see..."
3757 d_bsd="$define"
3758 echo exit 0 >bsd
3759else
3760 echo "Looks kind of like a Version 7 system, but we'll see..."
3761 echo exit 0 >v7
3762fi
3763case "$eunicefix" in
3764*unixtovms*)
3765 $cat <<'EOI'
3766There is, however, a strange, musty smell in the air that reminds me of
3767something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3768EOI
3769 echo exit 0 >eunice
3770 d_eunice="$define"
3771: it so happens the Eunice I know will not run shell scripts in Unix format
3772 ;;
3773*)
3774 echo " "
3775 echo "Congratulations. You aren't running Eunice."
3776 d_eunice="$undef"
3777 ;;
3778esac
3779: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3780: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3781: semicolon as a patch separator
e5e20432
JH
3782case "$p_" in
3783:) ;;
3784*)
3785 $cat <<'EOI'
3786I have the feeling something is not exactly right, however...don't tell me...
3787lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3788(Or you may be running DOS with DJGPP.)
e5e20432
JH
3789EOI
3790 echo exit 0 >os2
3791 ;;
3792esac
3793if test -f /xenix; then
3794 echo "Actually, this looks more like a XENIX system..."
3795 echo exit 0 >xenix
3796 d_xenix="$define"
3797else
3798 echo " "
3799 echo "It's not Xenix..."
3800 d_xenix="$undef"
3801fi
3802chmod +x xenix
3803$eunicefix xenix
3804if test -f /venix; then
3805 echo "Actually, this looks more like a VENIX system..."
3806 echo exit 0 >venix
3807else
3808 echo " "
3809 if ./xenix; then
3810 : null
3811 else
3812 echo "Nor is it Venix..."
3813 fi
3814fi
3815chmod +x bsd usg v7 osf1 eunice xenix venix os2
3816$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3817$rm -f foo
3818
5869b1f1
JH
3819case "$cc" in
3820'') dflt=cc;;
3821*) dflt="$cc";;
3822esac
3823rp="Use which C compiler?"
3824. ./myread
3825cc="$ans"
6b769f8f
RB
3826
3827: See if they have not cc but they do have gcc
3828. ./trygcc
e5e20432
JH
3829: Look for a hint-file generated 'call-back-unit'. Now that the
3830: user has specified the compiler, we may need to set or change some
3831: other defaults.
3832if $test -f cc.cbu; then
3833 . ./cc.cbu
3834fi
2573c5f9 3835. ./checkcc
8a27cf78 3836
e5e20432
JH
3837echo " "
3838echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3839$cat >try.c <<EOM
e5e20432
JH
3840#include <stdio.h>
3841int main() {
3842#ifdef __GNUC__
3843#ifdef __VERSION__
3844 printf("%s\n", __VERSION__);
3845#else
3846 printf("%s\n", "1");
3847#endif
3848#endif
3849 exit(0);
3850}
3851EOM
5440bc8e
JH
3852if $cc -o try $ccflags $ldflags try.c; then
3853 gccversion=`$run ./try`
e5e20432
JH
3854 case "$gccversion" in
3855 '') echo "You are not using GNU cc." ;;
fc68435e 3856 *) echo "You are using GNU cc $gccversion."
48fe685d 3857 ccname=gcc
fc68435e 3858 ;;
e5e20432
JH
3859 esac
3860else
3861 echo " "
3862 echo "*** WHOA THERE!!! ***" >&4
3863 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3864 case "$knowitall" in
3865 '')
3866 echo " You'd better start hunting for one and let me know about it." >&4
3867 exit 1
3868 ;;
3869 esac
3870fi
5440bc8e 3871$rm -f try try.*
e5e20432
JH
3872case "$gccversion" in
38731*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3874esac
5b463ca7
KS
3875case "$gccversion" in
3876'') gccosandvers='' ;;
10b4ebb5
JH
3877*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3878 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3879 gccshortvers=''
5b463ca7 3880 case "$gccosandvers" in
02903077
JH
3881 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3882 $osname$osvers) ;; # looking good
5b463ca7
KS
3883 $osname*) cat <<EOM >&4
3884
3885*** WHOA THERE!!! ***
3886
3887 Your gcc has not been compiled for the exact release of
3888 your operating system ($gccosandvers versus $osname$osvers).
3889
3890 In general it is a good idea to keep gcc synchronized with
3891 the operating system because otherwise serious problems
3892 may ensue when trying to compile software, like Perl.
3893
3894 I'm trying to be optimistic here, though, and will continue.
3895 If later during the configuration and build icky compilation
02903077
JH
3896 problems appear (headerfile conflicts being the most common
3897 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3898 your operating system release.
3899
3900EOM
3901 ;;
81575342 3902 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3903 esac
3904 ;;
3905esac
e723fc21
JH
3906case "$ccname" in
3907'') ccname="$cc" ;;
3908esac
e5e20432 3909
224cb7cb 3910# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3911# so we will take those off from locincpth.
3912case "$gccversion" in
39133*)
3914 echo "main(){}">try.c
224cb7cb
JH
3915 for incdir in $locincpth; do
3916 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3917 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3918 if test "X$warn" != X; then
44b94491 3919 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3920 fi
76589481
JH
3921 done
3922 $rm -f try try.*
3923esac
640374d0 3924
bd9b35c9
JH
3925: decide how portable to be. Allow command line overrides.
3926case "$d_portable" in
3927"$undef") ;;
3928*) d_portable="$define" ;;
104d25b7 3929esac
85ab1d1d 3930
bd9b35c9
JH
3931: set up shell script to do ~ expansion
3932cat >filexp <<EOSS
3933$startsh
3934: expand filename
3935case "\$1" in
3936 ~/*|~)
3937 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3938 ;;
3939 ~*)
3940 if $test -f /bin/csh; then
3941 /bin/csh -f -c "glob \$1"
3942 failed=\$?
3943 echo ""
3944 exit \$failed
e5e20432 3945 else
bd9b35c9
JH
3946 name=\`$expr x\$1 : '..\([^/]*\)'\`
3947 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3948 if $test ! -d "\$dir"; then
3949 me=\`basename \$0\`
3950 echo "\$me: can't locate home directory for: \$name" >&2
3951 exit 1
3952 fi
3953 case "\$1" in
3954 */*)
3955 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3956 ;;
3957 *)
3958 echo \$dir
e5e20432
JH
3959 ;;
3960 esac
3961 fi
b691c02f 3962 ;;
4633a7c4 3963*)
bd9b35c9 3964 echo \$1
2304df62
AD
3965 ;;
3966esac
4633a7c4
LW
3967EOSS
3968chmod +x filexp
3969$eunicefix filexp
2304df62
AD
3970
3971: now set up to get a file name
28757baa 3972cat <<EOS >getfile
3973$startsh
3974EOS
3975cat <<'EOSC' >>getfile
2304df62
AD
3976tilde=''
3977fullpath=''
3978already=''
3979skip=''
3980none_ok=''
3981exp_file=''
a0d0e21e 3982nopath_ok=''
2304df62
AD
3983orig_rp="$rp"
3984orig_dflt="$dflt"
b233458b
JH
3985case "$gfpth" in
3986'') gfpth='.' ;;
3987esac
2304df62
AD
3988
3989case "$fn" in
ecfc5424 3990*\(*)
d604bb53
JH
3991 : getfile will accept an answer from the comma-separated list
3992 : enclosed in parentheses even if it does not meet other criteria.
3993 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3994 fn=`echo $fn | sed 's/(.*)//'`
3995 ;;
3996esac
3997
3998case "$fn" in
a0d0e21e
LW
3999*:*)
4000 loc_file=`expr $fn : '.*:\(.*\)'`
4001 fn=`expr $fn : '\(.*\):.*'`
4002 ;;
4003esac
4004
4005case "$fn" in
2304df62
AD
4006*~*) tilde=true;;
4007esac
4008case "$fn" in
4009*/*) fullpath=true;;
4010esac
4011case "$fn" in
4012*+*) skip=true;;
4013esac
4014case "$fn" in
4015*n*) none_ok=true;;
4016esac
4017case "$fn" in
4018*e*) exp_file=true;;
4019esac
a0d0e21e
LW
4020case "$fn" in
4021*p*) nopath_ok=true;;
4022esac
2304df62
AD
4023
4024case "$fn" in
4025*f*) type='File';;
4026*d*) type='Directory';;
a0d0e21e 4027*l*) type='Locate';;
2304df62
AD
4028esac
4029
4030what="$type"
4031case "$what" in
4032Locate) what='File';;
4033esac
4034
4035case "$exp_file" in
4036'')
4037 case "$d_portable" in
4038 "$define") ;;
4039 *) exp_file=true;;
4040 esac
4041 ;;
4042esac
4043
4044cd ..
4045while test "$type"; do
4046 redo=''
4047 rp="$orig_rp"
4048 dflt="$orig_dflt"
4049 case "$tilde" in
4050 true) rp="$rp (~name ok)";;
4051 esac
4052 . UU/myread
ecfc5424
AD
4053 if test -f UU/getfile.ok && \
4054 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4055 then
4056 value="$ans"
4057 ansexp="$ans"
4058 break
4059 fi
2304df62
AD
4060 case "$ans" in
4061 none)
4062 value=''
4063 ansexp=''
4064 case "$none_ok" in
4065 true) type='';;
4066 esac
4067 ;;
4068 *)
4069 case "$tilde" in
4070 '') value="$ans"
4071 ansexp="$ans";;
4072 *)
4073 value=`UU/filexp $ans`
4074 case $? in
4075 0)
4076 if test "$ans" != "$value"; then
ecfc5424 4077 echo "(That expands to $value on this system.)"
2304df62
AD
4078 fi
4079 ;;
4080 *) value="$ans";;
4081 esac
4082 ansexp="$value"
4083 case "$exp_file" in
4084 '') value="$ans";;
4085 esac
4086 ;;
4087 esac
4088 case "$fullpath" in
4089 true)
4090 case "$ansexp" in
4091 /*) value="$ansexp" ;;
23da6c43 4092 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4093 *)
4094 redo=true
4095 case "$already" in
4096 true)
4097 echo "I shall only accept a full path name, as in /bin/ls." >&4
4098 echo "Use a ! shell escape if you wish to check pathnames." >&4
4099 ;;
4100 *)
4101 echo "Please give a full path name, starting with slash." >&4
4102 case "$tilde" in
4103 true)
4104 echo "Note that using ~name is ok provided it expands well." >&4
4105 already=true
4106 ;;
4107 esac
4108 esac
4109 ;;
4110 esac
4111 ;;
4112 esac
4113 case "$redo" in
4114 '')
4115 case "$type" in
4116 File)
b233458b
JH
4117 for fp in $gfpth; do
4118 if test "X$fp" = X.; then
4119 pf="$ansexp"
4120 else
4121 pf="$fp/$ansexp"
4122 fi
4123 if test -f "$pf"; then
4124 type=''
4125 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4126 then
4127 echo "($value is not a plain file, but that's ok.)"
4128 type=''
4129 fi
4130 if test X"$type" = X; then
4131 value="$pf"
4132 break
4133 fi
4134 done
2304df62
AD
4135 ;;
4136 Directory)
b233458b
JH
4137 for fp in $gfpth; do
4138 if test "X$fp" = X.; then
f78bfc9c
JH
4139 dir="$ans"
4140 direxp="$ansexp"
b233458b 4141 else
dd858076 4142 dir="$fp/$ansexp"
f78bfc9c 4143 direxp="$fp/$ansexp"
b233458b 4144 fi
f78bfc9c 4145 if test -d "$direxp"; then
b233458b 4146 type=''
f78bfc9c 4147 value="$dir"
b233458b
JH
4148 break
4149 fi
4150 done
2304df62
AD
4151 ;;
4152 Locate)
40000a8c 4153 if test -d "$ansexp"; then
a0d0e21e
LW
4154 echo "(Looking for $loc_file in directory $value.)"
4155 value="$value/$loc_file"
40000a8c 4156 ansexp="$ansexp/$loc_file"
2304df62 4157 fi
40000a8c 4158 if test -f "$ansexp"; then
2304df62
AD
4159 type=''
4160 fi
a0d0e21e
LW
4161 case "$nopath_ok" in
4162 true) case "$value" in
4163 */*) ;;
4164 *) echo "Assuming $value will be in people's path."
4165 type=''
4166 ;;
4167 esac
4168 ;;
4169 esac
2304df62
AD
4170 ;;
4171 esac
4172
4173 case "$skip" in
4174 true) type='';
4175 esac
4176
4177 case "$type" in
4178 '') ;;
4179 *)
4180 if test "$fastread" = yes; then
4181 dflt=y
4182 else
4183 dflt=n
4184 fi
4185 rp="$what $value doesn't exist. Use that name anyway?"
4186 . UU/myread
4187 dflt=''
4188 case "$ans" in
4189 y*) type='';;
4190 *) echo " ";;
4191 esac
4192 ;;
4193 esac
4194 ;;
4195 esac
4196 ;;
4197 esac
4198done
4199cd UU
4200ans="$value"
4201rp="$orig_rp"
4202dflt="$orig_dflt"
ecfc5424 4203rm -f getfile.ok
b233458b 4204test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4205EOSC
4206
bd9b35c9
JH
4207: What should the include directory be ?
4208echo " "
4209$echo $n "Hmm... $c"
4210dflt='/usr/include'
4211incpath=''
4212mips_type=''
4213if $test -f /bin/mips && /bin/mips; then
4214 echo "Looks like a MIPS system..."
4215 $cat >usr.c <<'EOCP'
4216#ifdef SYSTYPE_BSD43
4217/bsd43
4218#endif
4219EOCP
8a27cf78 4220 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4221 dflt='/bsd43/usr/include'
4222 incpath='/bsd43'
4223 mips_type='BSD 4.3'
4224 else
4225 mips_type='System V'
4226 fi
4227 $rm -f usr.c usr.out
4228 echo "and you're compiling with the $mips_type compiler and libraries."
4229 xxx_prompt=y
4230 echo "exit 0" >mips
4231else
4232 echo "Doesn't look like a MIPS system."
4233 xxx_prompt=n
4234 echo "exit 1" >mips
4235fi
4236chmod +x mips
4237$eunicefix mips
4238case "$usrinc" in
4239'') ;;
4240*) dflt="$usrinc";;
4241esac
4242case "$xxx_prompt" in
4243y) fn=d/
4244 echo " "
4245 rp='Where are the include files you want to use?'
4246 . ./getfile
4247 usrinc="$ans"
8e07c86e 4248 ;;
bd9b35c9 4249*) usrinc="$dflt"
8e07c86e
AD
4250 ;;
4251esac
2304df62 4252
96056487
JH
4253: see how we invoke the C preprocessor
4254echo " "
4255echo "Now, how can we feed standard input to your C preprocessor..." >&4
4256cat <<'EOT' >testcpp.c
4257#define ABC abc
4258#define XYZ xyz
4259ABC.XYZ
4260EOT
4261cd ..
4262if test ! -f cppstdin; then
4263 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4264 # AIX cc -E doesn't show the absolute headerfile
4265 # locations but we'll cheat by using the -M flag.
4266 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4267 else
4268 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4269 fi
4270else
4271 echo "Keeping your $hint cppstdin wrapper."
4272fi
4273chmod 755 cppstdin
4274wrapper=`pwd`/cppstdin
4275ok='false'
4276cd UU
4277
4278if $test "X$cppstdin" != "X" && \
4279 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4280 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4281then
4282 echo "You used to use $cppstdin $cppminus so we'll use that again."
4283 case "$cpprun" in
4284 '') echo "But let's see if we can live without a wrapper..." ;;
4285 *)
4286 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4287 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4288 then
4289 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4290 ok='true'
4291 else
4292 echo "(However, $cpprun $cpplast does not work, let's see...)"
4293 fi
4294 ;;
4295 esac
4296else
4297 case "$cppstdin" in
4298 '') ;;
4299 *)
4300 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4301 ;;
4302 esac
4303fi
4304
4305if $ok; then
4306 : nothing
4307elif echo 'Maybe "'"$cc"' -E" will work...'; \
4308 $cc -E <testcpp.c >testcpp.out 2>&1; \
4309 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4310 echo "Yup, it does."
4311 x_cpp="$cc -E"
4312 x_minus='';
4313elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4314 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4315 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4316 echo "Yup, it does."
4317 x_cpp="$cc -E"
4318 x_minus='-';
4319elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4320 $cc -P <testcpp.c >testcpp.out 2>&1; \
4321 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4322 echo "Yipee, that works!"
4323 x_cpp="$cc -P"
4324 x_minus='';
4325elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4326 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4327 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4328 echo "At long last!"
4329 x_cpp="$cc -P"
4330 x_minus='-';
4331elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4332 $cpp <testcpp.c >testcpp.out 2>&1; \
4333 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4334 echo "It works!"
4335 x_cpp="$cpp"
4336 x_minus='';
4337elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4338 $cpp - <testcpp.c >testcpp.out 2>&1; \
4339 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4340 echo "Hooray, it works! I was beginning to wonder."
4341 x_cpp="$cpp"
4342 x_minus='-';
4343elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4344 $wrapper <testcpp.c >testcpp.out 2>&1; \
4345 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346 x_cpp="$wrapper"
4347 x_minus=''
4348 echo "Eureka!"
4349else
4350 dflt=''
4351 rp="No dice. I can't find a C preprocessor. Name one:"
4352 . ./myread
4353 x_cpp="$ans"
4354 x_minus=''
4355 $x_cpp <testcpp.c >testcpp.out 2>&1
4356 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4357 echo "OK, that will do." >&4
4358 else
4359echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4360 exit 1
4361 fi
4362fi
4363
4364case "$ok" in
4365false)
4366 cppstdin="$x_cpp"
4367 cppminus="$x_minus"
4368 cpprun="$x_cpp"
4369 cpplast="$x_minus"
4370 set X $x_cpp
4371 shift
4372 case "$1" in
4373 "$cpp")
4374 echo "Perhaps can we force $cc -E using a wrapper..."
4375 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4376 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4377 then
4378 echo "Yup, we can."
4379 cppstdin="$wrapper"
4380 cppminus='';
4381 else
4382 echo "Nope, we'll have to live without it..."
4383 fi
4384 ;;
4385 esac
4386 case "$cpprun" in
4387 "$wrapper")
4388 cpprun=''
4389 cpplast=''
4390 ;;
4391 esac
4392 ;;
4393esac
4394
4395case "$cppstdin" in
4396"$wrapper"|'cppstdin') ;;
4397*) $rm -f $wrapper;;
4398esac
4399$rm -f testcpp.c testcpp.out
4400
bd9b35c9
JH
4401: Set private lib path
4402case "$plibpth" in
4403'') if ./mips; then
4404 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4405 fi;;
4406esac
4407case "$libpth" in
4408' ') dlist='';;
4409'') dlist="$loclibpth $plibpth $glibpth";;
4410*) dlist="$libpth";;
4411esac
4412
4413: Now check and see which directories actually exist, avoiding duplicates
4414libpth=''
4415for xxx in $dlist
4416do
4417 if $test -d $xxx; then
4418 case " $libpth " in
4419 *" $xxx "*) ;;
4420 *) libpth="$libpth $xxx";;
4421 esac
4422 fi
4423done
4424$cat <<'EOM'
4425
4426Some systems have incompatible or broken versions of libraries. Among
4427the directories listed in the question below, please remove any you
4428know not to be holding relevant libraries, and add any that are needed.
4429Say "none" for none.
8e07c86e
AD
4430
4431EOM
bd9b35c9
JH
4432case "$libpth" in
4433'') dflt='none';;
8e07c86e 4434*)
bd9b35c9
JH
4435 set X $libpth
4436 shift
4437 dflt=${1+"$@"}
8e07c86e 4438 ;;
a0d0e21e 4439esac
bd9b35c9
JH
4440rp="Directories to use for library searches?"
4441. ./myread
4442case "$ans" in
4443none) libpth=' ';;
4444*) libpth="$ans";;
4445esac
a0d0e21e 4446
bd9b35c9
JH
4447: compute shared library extension
4448case "$so" in
4449'')
4450 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4451 dflt='sl'
dd4e71fd 4452 else
bd9b35c9 4453 dflt='so'
dd4e71fd
JH
4454 fi
4455 ;;
bd9b35c9 4456*) dflt="$so";;
dd4e71fd 4457esac
dd4e71fd
JH
4458$cat <<EOM
4459
bd9b35c9 4460On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4461you want to suppress searching of shared libraries for the remainder
bd9b35c9 4462of this configuration.
dd4e71fd
JH
4463
4464EOM
bd9b35c9
JH
4465rp='What is the file extension used for shared libraries?'
4466. ./myread
4467so="$ans"
dd4e71fd 4468
bd9b35c9
JH
4469: Define several unixisms.
4470: Hints files or command line option can be used to override them.
4471: The convoluted testing is in case hints files set either the old
4472: or the new name.
4473case "$_exe" in
4474'') case "$exe_ext" in
1fef16b3 4475 '') ;;
bd9b35c9 4476 *) _exe="$exe_ext" ;;
dd4e71fd 4477 esac
bd9b35c9 4478 ;;
bfb7748a 4479esac
bd9b35c9
JH
4480case "$_a" in
4481'') case "$lib_ext" in
4482 '') _a='.a';;
4483 *) _a="$lib_ext" ;;
dd4e71fd
JH
4484 esac
4485 ;;
dd4e71fd 4486esac
bd9b35c9
JH
4487case "$_o" in
4488'') case "$obj_ext" in
4489 '') _o='.o';;
4490 *) _o="$obj_ext";;
4491 esac
4492 ;;
4493esac
4494case "$p_" in
4495'') case "$path_sep" in
4496 '') p_=':';;
4497 *) p_="$path_sep";;
4498 esac
4499 ;;
4500esac
4501exe_ext=$_exe
4502lib_ext=$_a
4503obj_ext=$_o
4504path_sep=$p_
dd4e71fd 4505
b4eb6b3d
JH
4506: Which makefile gets called first. This is used by make depend.
4507case "$firstmakefile" in
4508'') firstmakefile='makefile';;
4633a7c4 4509esac
4633a7c4 4510
bd9b35c9
JH
4511: Looking for optional libraries
4512echo " "
4513echo "Checking for optional libraries..." >&4
4514case "$libs" in
4515' '|'') dflt='';;
4516*) dflt="$libs";;
4517esac
4518case "$libswanted" in
4519'') libswanted='c_s';;
4520esac
4521case "$usesocks" in
923fc586 4522"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4523esac
68435ea7
JH
4524libsfound=''
4525libsfiles=''
4526libsdirs=''
13b3f787
JH
4527libspath=''
4528for thisdir in $libpth $xlibpth; do
4529 test -d $thisdir && libspath="$libspath $thisdir"
4530done
bd9b35c9 4531for thislib in $libswanted; do
13b3f787 4532 for thisdir in $libspath; do
f7dd4e7f
JH
4533 xxx=''
4534 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4535 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4536 $test -f "$xxx" && eval $libscheck
4537 $test -f "$xxx" && libstyle=shared
4538 fi
4539 if test ! -f "$xxx"; then
4540 xxx=$thisdir/lib$thislib.$so
4541 $test -f "$xxx" && eval $libscheck
4542 $test -f "$xxx" && libstyle=shared
4543 fi
4544 if test ! -f "$xxx"; then
4545 xxx=$thisdir/lib$thislib$_a
4546 $test -f "$xxx" && eval $libscheck
4547 $test -f "$xxx" && libstyle=static
4548 fi
4549 if test ! -f "$xxx"; then
4550 xxx=$thisdir/$thislib$_a
4551 $test -f "$xxx" && eval $libscheck
4552 $test -f "$xxx" && libstyle=static
4553 fi
4554 if test ! -f "$xxx"; then
4555 xxx=$thisdir/lib${thislib}_s$_a
4556 $test -f "$xxx" && eval $libscheck
4557 $test -f "$xxx" && libstyle=static
09ea5ba9 4558 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4559 fi
4560 if test ! -f "$xxx"; then
4561 xxx=$thisdir/Slib$thislib$_a
4562 $test -f "$xxx" && eval $libscheck
4563 $test -f "$xxx" && libstyle=static
4564 fi
4565 if $test -f "$xxx"; then
43999f95 4566 case "$libstyle" in
f7dd4e7f
JH
4567 shared) echo "Found -l$thislib (shared)." ;;
4568 static) echo "Found -l$thislib." ;;
4569 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4570 esac
bd9b35c9
JH
4571 case " $dflt " in
4572 *"-l$thislib "*);;
f7dd4e7f 4573 *) dflt="$dflt -l$thislib"
43999f95
JH
4574 libsfound="$libsfound $xxx"
4575 yyy=`basename $xxx`
4576 libsfiles="$libsfiles $yyy"
1e127011 4577 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4578 case " $libsdirs " in
4579 *" $yyy "*) ;;
4580 *) libsdirs="$libsdirs $yyy" ;;
4581 esac
4582 ;;
bd9b35c9 4583 esac
f7dd4e7f
JH
4584 break
4585 fi
4586 done
4587 if $test ! -f "$xxx"; then
4588 echo "No -l$thislib."
bd9b35c9
JH
4589 fi
4590done
4591set X $dflt
4592shift
4593dflt="$*"
4594case "$libs" in
4595'') dflt="$dflt";;
4596*) dflt="$libs";;
4597esac
4598case "$dflt" in
4599' '|'') dflt='none';;
4600esac
4633a7c4 4601
bd9b35c9 4602$cat <<EOM
4633a7c4 4603
bd9b35c9
JH
4604In order to compile $package on your machine, a number of libraries
4605are usually needed. Include any other special libraries here as well.
4606Say "none" for none. The default list is almost always right.
8e07c86e 4607EOM
8e07c86e 4608
bd9b35c9
JH
4609echo " "
4610rp="What libraries to use?"
4611. ./myread
4612case "$ans" in
4613none) libs=' ';;
4614*) libs="$ans";;
4615esac
d71b2b6b 4616
bd9b35c9
JH
4617: determine optimization, if desired, or use for debug flag also
4618case "$optimize" in
4619' '|$undef) dflt='none';;
4620'') dflt='-O';;
4621*) dflt="$optimize";;
4622esac
4623$cat <<EOH
d71b2b6b 4624
bd9b35c9
JH
4625By default, $package compiles with the -O flag to use the optimizer.
4626Alternately, you might want to use the symbolic debugger, which uses
4627the -g flag (on traditional Unix systems). Either flag can be
4628specified here. To use neither flag, specify the word "none".
d71b2b6b 4629
bd9b35c9
JH
4630EOH
4631rp="What optimizer/debugger flag should be used?"
4632. ./myread
4633optimize="$ans"
4634case "$optimize" in
4635'none') optimize=" ";;
4636esac
4637
4638dflt=''
4639: We will not override a previous value, but we might want to
4640: augment a hint file
4641case "$hint" in
4642default|recommended)
4643 case "$gccversion" in
4644 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4645 esac
bd9b35c9
JH
4646 case "$optimize" in
4647 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4648 esac
bd9b35c9
JH
4649 case "$gccversion" in
4650 2*) if test -d /etc/conf/kconfig.d &&
4651 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4652 then
4653 dflt="$dflt -posix"
4654 fi
f0d04425 4655 ;;
bd9b35c9
JH
4656 esac
4657 case "$gccversion" in
4658 1*) ;;
4659 2.[0-8]*) ;;
4660 ?*) echo " "
4661 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4662 echo 'int main(void) { return 0; }' > gcctest.c
4663 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4664 echo "Yes, it does." 2>&1
4665 case "$ccflags" in
4666 *strict-aliasing*)
4667 echo "Leaving current flags $ccflags alone." 2>&1
4668 ;;
4669 *) dflt="$dflt -fno-strict-aliasing" ;;
4670 esac
4671 else
4672 echo "Nope, it doesn't, but that's ok." 2>&1
4673 fi
f0d04425 4674 ;;
e5e20432
JH
4675 esac
4676 ;;
4677esac
4678
bd9b35c9
JH
4679case "$mips_type" in
4680*BSD*|'') inclwanted="$locincpth $usrinc";;
4681*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4682esac
4683for thisincl in $inclwanted; do
4684 if $test -d $thisincl; then
4685 if $test x$thisincl != x$usrinc; then
4686 case "$dflt" in
422af00a
LC
4687 *" -I$thisincl "*);;
4688 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4689 esac
4690 fi
4691 fi
4692done
40a7a20a 4693
bd9b35c9
JH
4694inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4695 xxx=true;
4696elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4697 xxx=true;
4698else
4699 xxx=false;
4700fi;
4701if $xxx; then
4702 case "$dflt" in
4703 *$2*);;
4704 *) dflt="$dflt -D$2";;
4705 esac;
4706fi'
40a7a20a 4707
bd9b35c9 4708set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4709
bd9b35c9
JH
4710case "$usesocks" in
4711$define)
4712 ccflags="$ccflags -DSOCKS"
4713 ;;
4714esac
40a7a20a 4715
bd9b35c9
JH
4716case "$hint" in
4717default|recommended) dflt="$ccflags $dflt" ;;
4718*) dflt="$ccflags";;
4719esac
40a7a20a 4720
bd9b35c9
JH
4721case "$dflt" in
4722''|' ') dflt=none;;
4723esac
422af00a 4724
bd9b35c9 4725$cat <<EOH
40a7a20a 4726
bd9b35c9
JH
4727Your C compiler may want other flags. For this question you should include
4728-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4729but you should NOT include libraries or ld flags like -lwhatever. If you
4730want $package to honor its debug switch, you should include -DDEBUGGING here.
4731Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4732
bd9b35c9 4733To use no flags, specify the word "none".
40a7a20a 4734
bd9b35c9
JH
4735EOH
4736set X $dflt
4737shift
4738dflt=${1+"$@"}
4739rp="Any additional cc flags?"
4740. ./myread
4741case "$ans" in
4742none) ccflags='';;
4743*) ccflags="$ans";;
4744esac
8e07c86e 4745
bd9b35c9 4746: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4747case "$cppflags" in
4748'') cppflags="$ccflags" ;;
4749*) cppflags="$cppflags $ccflags" ;;
4750esac
bd9b35c9
JH
4751case "$gccversion" in
47521*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4753esac
bd9b35c9
JH
4754case "$mips_type" in
4755'');;
4756*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4757esac
4758case "$cppflags" in
4759'');;
4760*)
4761 echo " "
4762 echo "Let me guess what the preprocessor flags are..." >&4
4763 set X $cppflags
4764 shift
4765 cppflags=''
4766 $cat >cpp.c <<'EOM'
4767#define BLURFL foo
8e07c86e 4768
bd9b35c9
JH
4769BLURFL xx LFRULB
4770EOM
4771 previous=''
4772 for flag in $*
4773 do
4774 case "$flag" in
4775 -*) ftry="$flag";;
4776 *) ftry="$previous $flag";;
4777 esac
4778 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4779 >cpp1.out 2>/dev/null && \
4780 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4781 >cpp2.out 2>/dev/null && \
4782 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4783 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4784 then
4785 cppflags="$cppflags $ftry"
4786 previous=''
4787 else
4788 previous="$flag"
4789 fi
4790 done
4791 set X $cppflags
4792 shift
4793 cppflags=${1+"$@"}
4794 case "$cppflags" in
4795 *-*) echo "They appear to be: $cppflags";;
4796 esac
4797 $rm -f cpp.c cpp?.out
2afac517 4798 ;;
4799esac
8e07c86e 4800
bd9b35c9
JH
4801: flags used in final linking phase
4802case "$ldflags" in
4803'') if ./venix; then
4804 dflt='-i -z'
10a23457 4805 else
bd9b35c9 4806 dflt=''
10a23457 4807 fi
bd9b35c9
JH
4808 case "$ccflags" in
4809 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4810 esac
bd9b35c9
JH
4811 ;;
4812*) dflt="$ldflags";;
4813esac
4814
4815: Try to guess additional flags to pick up local libraries.
4816for thislibdir in $libpth; do
4817 case " $loclibpth " in
4818 *" $thislibdir "*)
4819 case "$dflt " in
4820 *"-L$thislibdir "*) ;;
4821 *) dflt="$dflt -L$thislibdir" ;;
4822 esac
c4f23d77
AD
4823 ;;
4824 esac
bd9b35c9 4825done
c4f23d77 4826
bd9b35c9
JH
4827case "$dflt" in
4828'') dflt='none' ;;
4829esac
c4f23d77 4830
bd9b35c9
JH
4831$cat <<EOH
4832
4833Your C linker may need flags. For this question you should
4834include -L/whatever and any other flags used by the C linker, but you
4835should NOT include libraries like -lwhatever.
4836
4837Make sure you include the appropriate -L/path flags if your C linker
4838does not normally search all of the directories you specified above,
4839namely
4840 $libpth
4841To use no flags, specify the word "none".
4842
4843EOH
4844
4845rp="Any additional ld flags (NOT including libraries)?"
4846. ./myread
4847case "$ans" in
4848none) ldflags='';;
4849*) ldflags="$ans";;
4850esac
4851rmlist="$rmlist pdp11"
4852
4853: coherency check
4854echo " "
4855echo "Checking your choice of C compiler and flags for coherency..." >&4
4856$cat > try.c <<'EOF'
4857#include <stdio.h>
4858int main() { printf("Ok\n"); exit(0); }
4859EOF
7a282f6d 4860set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4861shift
4862$cat >try.msg <<'EOM'
4863I've tried to compile and run the following simple program:
4864
4865EOM
4866$cat try.c >> try.msg
4867
4868$cat >> try.msg <<EOM
4869
4870I used the command:
4871
4872 $*
5440bc8e 4873 $run ./try
bd9b35c9
JH
4874
4875and I got the following output:
4876
4877EOM
4878dflt=y
73614538 4879if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4880 if $sh -c "$run ./try" >>try.msg 2>&1; then
4881 xxx=`$run ./try`
bd9b35c9
JH
4882 case "$xxx" in
4883 "Ok") dflt=n ;;
4884 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4885 case " $libs " in
4886 *" -lsfio "*)
4887 cat >> try.msg <<'EOQS'
4888If $libs contains -lsfio, and sfio is mis-configured, then it
4889sometimes (apparently) runs and exits with a 0 status, but with no
4890output! It may have to do with sfio's use of _exit vs. exit.
4891
4892EOQS
4893 rp="You have a big problem. Shall I abort Configure"
4894 dflt=y
4895 ;;
4896 esac
4897 ;;
4898 esac
4899 else
4900 echo "The program compiled OK, but exited with status $?." >>try.msg
4901 rp="You have a problem. Shall I abort Configure"
4902 dflt=y
4903 fi
4904else
4905 echo "I can't compile the test program." >>try.msg
4906 rp="You have a BIG problem. Shall I abort Configure"
4907 dflt=y
4908fi
4909case "$dflt" in
4910y)
4911 $cat try.msg >&4
4912 case "$knowitall" in
4913 '')
4914 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4915 ;;
bd9b35c9 4916 *) dflt=n;;
c4f23d77 4917 esac
bd9b35c9
JH
4918 echo " "
4919 . ./myread
4920 case "$ans" in
4921 n*|N*) ;;
4922 *) echo "Ok. Stopping Configure." >&4
4923 exit 1
c4f23d77
AD
4924 ;;
4925 esac
4926 ;;
bd9b35c9 4927n) echo "OK, that should do.";;
c4f23d77 4928esac
bd9b35c9 4929$rm -f try try.* core
c4f23d77 4930
bd9b35c9
JH
4931: define a shorthand compile call
4932compile='
4933mc_file=$1;
4934shift;
08413ebc 4935$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4936: define a shorthand compile call for compilations that should be ok.
4937compile_ok='
4938mc_file=$1;
4939shift;
7a282f6d 4940$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4941
b4eb6b3d 4942: check for lengths of integral types
bd9b35c9 4943echo " "
b4eb6b3d
JH
4944case "$intsize" in
4945'')
4946 echo "Checking to see how big your integers are..." >&4
5440bc8e 4947 $cat >try.c <<'EOCP'
bd9b35c9
JH
4948#include <stdio.h>
4949int main()
4950{
b4eb6b3d
JH
4951 printf("intsize=%d;\n", (int)sizeof(int));
4952 printf("longsize=%d;\n", (int)sizeof(long));
4953 printf("shortsize=%d;\n", (int)sizeof(short));
4954 exit(0);
bd9b35c9 4955}
b4eb6b3d 4956EOCP
5440bc8e
JH
4957 set try
4958 if eval $compile_ok && $run ./try > /dev/null; then
4959 eval `$run ./try`
b4eb6b3d
JH
4960 echo "Your integers are $intsize bytes long."
4961 echo "Your long integers are $longsize bytes long."
4962 echo "Your short integers are $shortsize bytes long."
4963 else
4964 $cat >&4 <<EOM
4965!
4966Help! I can't compile and run the intsize test program: please enlighten me!
4967(This is probably a misconfiguration in your system or libraries, and
4968you really ought to fix it. Still, I'll try anyway.)
4969!
bd9b35c9 4970EOM
b4eb6b3d
JH
4971 dflt=4
4972 rp="What is the size of an integer (in bytes)?"
96056487
JH
4973 . ./myread
4974 intsize="$ans"
4975 dflt=$intsize
4976 rp="What is the size of a long integer (in bytes)?"
4977 . ./myread
4978 longsize="$ans"
4979 dflt=2
4980 rp="What is the size of a short integer (in bytes)?"
4981 . ./myread
4982 shortsize="$ans"
b4eb6b3d
JH
4983 fi
4984 ;;
4985esac
96056487 4986$rm -f try try.*
b4eb6b3d 4987
8dfa8df9
JH
4988: check for long long
4989echo " "
4990echo "Checking to see if you have long long..." >&4
4991echo 'int main() { long long x = 7; return 0; }' > try.c
4992set try
4993if eval $compile; then
4994 val="$define"
4995 echo "You have long long."
4996else
4997 val="$undef"
4998 echo "You do not have long long."
4999fi
5000$rm try.*
5001set d_longlong
5002eval $setvar
5003
5004: check for length of long long
5005case "${d_longlong}${longlongsize}" in
5006$define)
5007 echo " "
5008 echo "Checking to see how big your long longs are..." >&4
5009 $cat >try.c <<'EOCP'
5010#include <stdio.h>
5011int main()
5012{
5013 printf("%d\n", (int)sizeof(long long));
5014 return(0);
5015}
5016EOCP
5017 set try
5018 if eval $compile_ok; then
5440bc8e 5019 longlongsize=`$run ./try`
8dfa8df9
JH
5020 echo "Your long longs are $longlongsize bytes long."
5021 else
5022 dflt='8'
5023 echo " "
5024 echo "(I can't seem to compile the test program. Guessing...)"
5025 rp="What is the size of a long long (in bytes)?"
5026 . ./myread
5027 longlongsize="$ans"
5028 fi
5029 if $test "X$longsize" = "X$longlongsize"; then
5030 echo "(That isn't any different from an ordinary long.)"
5031 fi
5032 ;;
5033esac
5034$rm -f try.* try
5035
5036: determine filename position in cpp output
5037echo " "
5038echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5039case "$osname" in
5040vos) testaccess=-e ;;
5041*) testaccess=-r ;;
5042esac
8dfa8df9
JH
5043echo '#include <stdio.h>' > foo.c
5044$cat >fieldn <<EOF
5045$startsh
5046$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5047$grep '^[ ]*#.*stdio\.h' | \
5048while read cline; do
5049 pos=1
5050 set \$cline
5051 while $test \$# -gt 0; do
a5a94ea5 5052 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5053 echo "\$pos"
5054 exit 0
5055 fi
5056 shift
5057 pos=\`expr \$pos + 1\`
5058 done
5059done
5060EOF
5061chmod +x fieldn
5062fieldn=`./fieldn`
5063$rm -f foo.c fieldn
5064case $fieldn in
5065'') pos='???';;
50661) pos=first;;
50672) pos=second;;
50683) pos=third;;
5069*) pos="${fieldn}th";;
5070esac
5071echo "Your cpp writes the filename in the $pos field of the line."
5072
3c728e00
JH
5073case "$osname" in
5074vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5075*) cppfilter='' ;;
5076esac
8dfa8df9
JH
5077: locate header file
5078$cat >findhdr <<EOF
5079$startsh
5080wanted=\$1
5081name=''
5082for usrincdir in $usrinc
5083do
5084 if test -f \$usrincdir/\$wanted; then
5085 echo "\$usrincdir/\$wanted"
5086 exit 0
5087 fi
5088done
5089awkprg='{ print \$$fieldn }'
5090echo "#include <\$wanted>" > foo\$\$.c
5091$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5092$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5093while read cline; do
5094 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5095 case "\$name" in
5096 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5097 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5098 *) exit 2;;
5099 esac;
5100done;
5101#
5102# status = 0: grep returned 0 lines, case statement not executed
5103# status = 1: headerfile found
5104# status = 2: while loop executed, no headerfile found
5105#
5106status=\$?
5107$rm -f foo\$\$.c;
5108if test \$status -eq 1; then
5109 exit 0;
5110fi
5111exit 1
5112EOF
5113chmod +x findhdr
5114
5115: define an alternate in-header-list? function
5116inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5117cont=true; xxf="echo \"<\$1> found.\" >&4";
5118case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5119*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5120esac;
5121case $# in 4) instead=instead;; *) instead="at last";; esac;
5122while $test "$cont"; do
5123 xxx=`./findhdr $1`
5124 var=$2; eval "was=\$$2";
5125 if $test "$xxx" && $test -r "$xxx";
5126 then eval $xxf;
5127 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5128 cont="";
5129 else eval $xxnf;
5130 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5131 set $yyy; shift; shift; yyy=$@;
5132 case $# in 0) cont="";;
5133 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5134 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5135 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5136 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5137 esac;
5138done;
5139while $test "$yyy";
5140do set $yyy; var=$2; eval "was=\$$2";
5141 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5142 set $yyy; shift; shift; yyy=$@;
5143done'
5144
5145: see if inttypes.h is available
5146: we want a real compile instead of Inhdr because some systems
5147: have an inttypes.h which includes non-existent headers
5148echo " "
5149$cat >try.c <<EOCP
5150#include <inttypes.h>
5151int main() {
5152 static int32_t foo32 = 0x12345678;
5153}
5154EOCP
5155set try
5156if eval $compile; then
5157 echo "<inttypes.h> found." >&4
5158 val="$define"
5159else
5160 echo "<inttypes.h> NOT found." >&4
5161 val="$undef"
5162fi
5163$rm -f try.c try
5164set i_inttypes
5165eval $setvar
5166
5167: check for int64_t
5168echo " "
5169echo "Checking to see if you have int64_t..." >&4
5170$cat >try.c <<EOCP
5171#include <sys/types.h>
5172#$i_inttypes I_INTTYPES
5173#ifdef I_INTTYPES
5174#include <inttypes.h>
5175#endif
5176int main() { int64_t x = 7; }
5177EOCP
5178set try
5179if eval $compile; then
5180 val="$define"
5181 echo "You have int64_t."
5182else
5183 val="$undef"
5184 echo "You do not have int64_t."
5185fi
5186$rm -f try try.*
5187set d_int64_t
5188eval $setvar
5189
5190
5191echo " "
5192echo "Checking which 64-bit integer type we could use..." >&4
5193
5194case "$intsize" in
51958) val=int
5196 set quadtype
5197 eval $setvar
5198 val='"unsigned int"'
5199 set uquadtype
5200 eval $setvar
5201 quadkind=1
5202 ;;
5203*) case "$longsize" in
5204 8) val=long
5205 set quadtype
5206 eval $setvar
5207 val='"unsigned long"'
5208 set uquadtype
5209 eval $setvar
5210 quadkind=2
5211 ;;
5212 *) case "$d_longlong:$longlongsize" in
5213 define:8)
5214 val='"long long"'
5215 set quadtype
5216 eval $setvar
5217 val='"unsigned long long"'
5218 set uquadtype
5219 eval $setvar
5220 quadkind=3
5221 ;;
5222 *) case "$d_int64_t" in
5223 define)
5224 val=int64_t
5225 set quadtype
5226 eval $setvar
5227 val=uint64_t
5228 set uquadtype
5229 eval $setvar
5230 quadkind=4
5231 ;;
5232 esac
5233 ;;
5234 esac
5235 ;;
5236 esac
5237 ;;
5238esac
5239
5240case "$quadtype" in
5241'') echo "Alas, no 64-bit integer types in sight." >&4
5242 d_quad="$undef"
5243 ;;
5244*) echo "We could use '$quadtype' for 64-bit integers." >&4
5245 d_quad="$define"
5246 ;;
5247esac
5248
b4eb6b3d
JH
5249
5250case "$uselonglong" in
5251"$define"|true|[yY]*)
5252 cat <<EOM >&4
5253
5254*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5255EOM
5256 use64bitint="$define"
5257 ;;
5258esac
5259case "$use64bits" in
5260"$define"|true|[yY]*)
5261 cat <<EOM >&4
5262
5263*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5264EOM
5265 use64bitint="$define"
5266 ;;
5267esac
5268case "$use64bitints" in
5269"$define"|true|[yY]*)
5270 cat <<EOM >&4
5271
5272*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5273EOM
5274 use64bitint="$define"
5275 ;;
5276esac
5277case "$use64bitsint" in
5278"$define"|true|[yY]*)
5279 cat <<EOM >&4
5280
5281*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5282EOM
5283 use64bitint="$define"
5284 ;;
5285esac
5286case "$uselonglongs" in
5287"$define"|true|[yY]*)
5288 cat <<EOM >&4
5289
5290*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5291EOM
5292 use64bitint="$define"
5293 ;;
5294esac
5295case "$use64bitsall" in
5296"$define"|true|[yY]*)
5297 cat <<EOM >&4
5298
5299*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5300EOM
5301 use64bitall="$define"
5302 ;;
5303esac
5304
5305case "$ccflags" in
5306*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5307esac
5308case "$use64bitall" in
5309"$define"|true|[yY]*) use64bitint="$define" ;;
5310esac
5311
5312case "$longsize" in
53138) cat <<EOM
5314
5315You have natively 64-bit long integers.
5316EOM
5317 val="$define"
5318 ;;
5319*) case "$use64bitint" in
5320 "$define"|true|[yY]*) dflt='y';;
5321 *) dflt='n';;
5322 esac
8dfa8df9
JH
5323 case "$d_quad" in
5324 "$define") ;;
5325 *) dflt='n' ;;
5326 esac
b4eb6b3d
JH
5327 cat <<EOM
5328
5329Perl can be built to take advantage of 64-bit integer types
5330on some systems. To do so, Configure can be run with -Duse64bitint.
5331Choosing this option will most probably introduce binary incompatibilities.
5332
5333If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5334(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5335EOM
5336 rp='Try to use 64-bit integers, if available?'
5337 . ./myread
5338 case "$ans" in
5339 [yY]*) val="$define" ;;
5340 *) val="$undef" ;;
5341 esac
5342 ;;
5343esac
5344set use64bitint
5345eval $setvar
5346
5347case "$use64bitall" in
5348"$define"|true|[yY]*) dflt='y' ;;
5349*) case "$longsize" in
5350 8) dflt='y' ;;
5351 *) dflt='n' ;;
5352 esac
5353 ;;
5354esac
5355cat <<EOM
5356
5357You may also choose to try maximal 64-bitness. It means using as much
535864-bitness as possible on the platform. This in turn means even more
5359binary incompatibilities. On the other hand, your platform may not
5360have any more 64-bitness available than what you already have chosen.
5361
5362If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5363(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5364EOM
5365rp='Try to use maximal 64-bit support, if available?'
5366. ./myread
5367case "$ans" in
5368[yY]*) val="$define" ;;
5369*) val="$undef" ;;
5370esac
5371set use64bitall
5372eval $setvar
5373case "$use64bitall" in
5374"$define")
5375 case "$use64bitint" in
5376 "$undef")
5377 cat <<EOM
5378
5379Since you have chosen a maximally 64-bit build, I'm also turning on
5380the use of 64-bit integers.
5381EOM
5382 use64bitint="$define" ;;
5383 esac
5384 ;;
5385esac
5386
5387case "$use64bitint" in
5388"$define"|true|[yY]*)
5389: Look for a hint-file generated 'call-back-unit'. If the
5390: user has specified that a 64-bit perl is to be built,
5391: we may need to set or change some other defaults.
5392 if $test -f use64bitint.cbu; then
5393 echo "Your platform has some specific hints for 64-bit integers, using them..."
5394 . ./use64bitint.cbu
5395 fi
5396 case "$longsize" in
5397 4) case "$archname64" in
5398 '') archname64=64int ;;
5399 esac
5400 ;;
5401 esac
5402 ;;
5403esac
5404
5405case "$use64bitall" in
5406"$define"|true|[yY]*)
5407: Look for a hint-file generated 'call-back-unit'. If the
5408: user has specified that a maximally 64-bit perl is to be built,
5409: we may need to set or change some other defaults.
5410 if $test -f use64bitall.cbu; then
5411 echo "Your platform has some specific hints for 64-bit builds, using them..."
5412 . ./use64bitall.cbu
5413 fi
5414 case "$longsize" in
5415 4) case "$archname64" in
5416 ''|64int) archname64=64all ;;
5417 esac
5418 ;;
5419 esac
5420 ;;
5421esac
5422
5423echo " "
5424echo "Checking for GNU C Library..." >&4
5f6e0ee4
AD
5425cat >try.c <<'EOCP'
5426/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
5427 alone are insufficient to distinguish different versions, such as
5428 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
5429 libc version 2.1.0. A. Dougherty, June 3, 2002.
5430*/
b4eb6b3d 5431#include <stdio.h>
5f6e0ee4 5432int main(void)
b4eb6b3d
JH
5433{
5434#ifdef __GLIBC__
5f6e0ee4
AD
5435# ifdef __GLIBC_MINOR__
5436# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5437# include <gnu/libc-version.h>
5438 printf("%s\n", gnu_get_libc_version());
5439# else
5440 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
5441# endif
5442# else
5443 printf("%d\n", __GLIBC__);
5444# endif
5445 return 0;
b4eb6b3d 5446#else
5f6e0ee4 5447 return 1;
b4eb6b3d
JH
5448#endif
5449}
5f6e0ee4 5450EOCP
5440bc8e 5451set try
5f6e0ee4 5452if eval $compile_ok && $run ./try > glibc.ver; then
b4eb6b3d 5453 val="$define"
5f6e0ee4
AD
5454 gnulibc_version=`$cat glibc.ver`
5455 echo "You are using the GNU C Library version $gnulibc_version"
b4eb6b3d
JH
5456else
5457 val="$undef"
5f6e0ee4 5458 gnulibc_version=''
b4eb6b3d
JH
5459 echo "You are not using the GNU C Library"
5460fi
5f6e0ee4 5461$rm -f try try.* glibc.ver
b4eb6b3d
JH
5462set d_gnulibc
5463eval $setvar
5464
5465: see if nm is to be used to determine whether a symbol is defined or not
5466case "$usenm" in
5467'')
5468 dflt=''
c1a7f87b
JH
5469 case "$d_gnulibc" in
5470 "$define")
5471 echo " "
5472 echo "nm probably won't work on the GNU C Library." >&4
5473 dflt=n
bd9b35c9 5474 ;;
c1a7f87b
JH
5475 esac
5476 case "$dflt" in
5477 '')
44b94491 5478 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
c1a7f87b
JH
5479 echo " "
5480 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5481 echo "'nm' won't be sufficient on this sytem." >&4
5482 dflt=n
5483 fi
5484 ;;
5485 esac
5486 case "$dflt" in
5487 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5488 if $test $dflt -gt 20; then
5489 dflt=y
5490 else
5491 dflt=n
5492 fi
bd9b35c9
JH
5493 ;;
5494 esac
bd9b35c9
JH
5495 ;;
5496*)
c1a7f87b
JH
5497 case "$usenm" in
5498 true|$define) dflt=y;;
5499 *) dflt=n;;
5500 esac
bd9b35c9
JH
5501 ;;
5502esac
5503$cat <<EOM
5504
c1a7f87b
JH
5505I can use $nm to extract the symbols from your C libraries. This
5506is a time consuming task which may generate huge output on the disk (up
5507to 3 megabytes) but that should make the symbols extraction faster. The
5508alternative is to skip the 'nm' extraction part and to compile a small
5509test program instead to determine whether each symbol is present. If
5510you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5511this may be the best solution.
5512
5513You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5514
5515EOM
c1a7f87b
JH
5516rp="Shall I use $nm to extract C symbols from the libraries?"
5517. ./myread
5518case "$ans" in
5519[Nn]*) usenm=false;;
5520*) usenm=true;;
bd9b35c9 5521esac
bd9b35c9 5522
c1a7f87b
JH
5523runnm=$usenm
5524case "$reuseval" in
5525true) runnm=false;;
8e07c86e 5526esac
29209bc5 5527
c1a7f87b
JH
5528: nm options which may be necessary
5529case "$nm_opt" in
5530'') if $test -f /mach_boot; then
5531 nm_opt='' # Mach
5532 elif $test -d /usr/ccs/lib; then
5533 nm_opt='-p' # Solaris (and SunOS?)
5534 elif $test -f /dgux; then
5535 nm_opt='-p' # DG-UX
5536 elif $test -f /lib64/rld; then
5537 nm_opt='-p' # 64-bit Irix
5538 else
5539 nm_opt=''
5540 fi;;
5541esac
bd9b35c9 5542
c1a7f87b
JH
5543: nm options which may be necessary for shared libraries but illegal
5544: for archive libraries. Thank you, Linux.
5545case "$nm_so_opt" in
5546'') case "$myuname" in
5547 *linux*)
5548 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5549 nm_so_opt='--dynamic'
5550 fi
5551 ;;
bd9b35c9 5552 esac
c1a7f87b
JH
5553 ;;
5554esac
8e07c86e 5555
c1a7f87b
JH
5556case "$runnm" in
5557true)
5558: get list of predefined functions in a handy place
5559echo " "
5560case "$libc" in
5561'') libc=unknown
5562 case "$libs" in
5563 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5564 esac
ff935051
JH
5565 ;;
5566esac
c1a7f87b
JH
5567case "$libs" in
5568'') ;;
5569*) for thislib in $libs; do
5570 case "$thislib" in
5571 -lc|-lc_s)
5572 : Handle C library specially below.
5573 ;;
5574 -l*)
5575 thislib=`echo $thislib | $sed -e 's/^-l//'`
5576 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5577 :
5578 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5579 :
5580 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5581 :
5582 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5583 :
5584 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5585 :
5586 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5587 :
5588 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5589 :
5590 else
5591 try=''
5592 fi
5593 libnames="$libnames $try"
5594 ;;
5595 *) libnames="$libnames $thislib" ;;
34d1710f 5596 esac
c1a7f87b 5597 done
4633a7c4
LW
5598 ;;
5599esac
c1a7f87b
JH
5600xxx=normal
5601case "$libc" in
5602unknown)
5603 set /lib/libc.$so
5604 for xxx in $libpth; do
5605 $test -r $1 || set $xxx/libc.$so
5606 : The messy sed command sorts on library version numbers.
5607 $test -r $1 || \
5608 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5609 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5610 h
5611 s/[0-9][0-9]*/0000&/g
5612 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5613 G
5614 s/\n/ /' | \
381aa1ff 5615 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5616 eval set \$$#
5617 done
5618 $test -r $1 || set /usr/ccs/lib/libc.$so
5619 $test -r $1 || set /lib/libsys_s$_a
5620 ;;
5621*)
5622 set blurfl
5623 ;;
a4f3eea9 5624esac
c1a7f87b
JH
5625if $test -r "$1"; then
5626 echo "Your (shared) C library seems to be in $1."
5627 libc="$1"
5628elif $test -r /lib/libc && $test -r /lib/clib; then
5629 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5630 xxx=apollo
5631 libc='/lib/clib /lib/libc'
5632 if $test -r /lib/syslib; then
5633 echo "(Your math library is in /lib/syslib.)"
5634 libc="$libc /lib/syslib"
5635 fi
5636elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5637 echo "Your C library seems to be in $libc, as you said before."
5638elif $test -r $incpath/usr/lib/libc$_a; then
5639 libc=$incpath/usr/lib/libc$_a;
5640 echo "Your C library seems to be in $libc. That's fine."
5641elif $test -r /lib/libc$_a; then
5642 libc=/lib/libc$_a;
5643 echo "Your C library seems to be in $libc. You're normal."
5644else
5645 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5646 :
5647 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5648 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5649 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5650 :
5651 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5652 :
5653 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5654 :
5655 else
5656 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5657 fi
5658 if $test -r "$tans"; then
5659 echo "Your C library seems to be in $tans, of all places."
5660 libc=$tans
5661 else
5662 libc='blurfl'
5663 fi
5664fi
5665if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5666 dflt="$libc"
5667 cat <<EOM
a4f3eea9 5668
c1a7f87b
JH
5669If the guess above is wrong (which it might be if you're using a strange
5670compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5671
5672EOM
a4f3eea9 5673else
c1a7f87b 5674 dflt=''
381aa1ff 5675 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5676 cat >&4 <<EOM
5677I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5678
c1a7f87b
JH
5679EOM
5680 $sed 's/^/ /' libpath
5681 cat <<EOM
29209bc5 5682
c1a7f87b 5683None of these seems to contain your C library. I need to get its name...
a4f3eea9 5684
bd9b35c9 5685EOM
bd9b35c9 5686fi
c1a7f87b
JH
5687fn=f
5688rp='Where is your C library?'
5689. ./getfile
5690libc="$ans"
a4f3eea9 5691
c1a7f87b 5692echo " "
381aa1ff 5693echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5694set X `cat libnames`
5695shift
5696xxx=files
5697case $# in 1) xxx=file; esac
5698echo "Extracting names from the following $xxx for later perusal:" >&4
5699echo " "
5700$sed 's/^/ /' libnames >&4
5701echo " "
5702$echo $n "This may take a while...$c" >&4
a4f3eea9 5703
c1a7f87b
JH
5704for file in $*; do
5705 case $file in
5706 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5707 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5708 esac
c1a7f87b 5709done >libc.tmp
a4f3eea9 5710
c1a7f87b
JH
5711$echo $n ".$c"
5712$grep fprintf libc.tmp > libc.ptf
5713xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
c56d2bdc 5714xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
c1a7f87b
JH
5715xxx='[ADTSIW]'
5716if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5717 eval $xscan;\
5718 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719 eval $xrun
5720elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5721 eval $xscan;\
5722 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723 eval $xrun
5724elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5725 eval $xscan;\
5726 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727 eval $xrun
5728elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5729 eval $xscan;\
5730 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731 eval $xrun
5732elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5733 eval $xscan;\
5734 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735 eval $xrun
5736elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5737 eval $xscan;\
5738 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739 eval $xrun
5740elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5741 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5742 eval $xscan;\
5743 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744 eval $xrun
5745elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5746 eval $xscan;\
5747 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748 eval $xrun
5749elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5750 eval $xscan;\
5751 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752 eval $xrun
5753elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5754 eval $xscan;\
5755 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756 eval $xrun
5757elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5758 eval $xscan;\
5759 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760 eval $xrun
5761elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5762 eval $xscan;\
5763 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764 eval $xrun
5765elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5766 eval $xscan;\
5767 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768 eval $xrun
5769elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5770 eval $xscan;\
5771 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772 eval $xrun
5773else
5774 $nm -p $* 2>/dev/null >libc.tmp
5775 $grep fprintf libc.tmp > libc.ptf
5776 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5777 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5778 then
5779 nm_opt='-p'
5780 eval $xrun
bd9b35c9 5781 else
c1a7f87b
JH
5782 echo " "
5783 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5784 com=''
5785 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5786 for thisname in $libnames $libc; do
5787 $ar t $thisname >>libc.tmp
5788 done
5789 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5790 echo "Ok." >&4
5791 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5792 # Repeat libc to extract forwarders to DLL entries too
5793 for thisname in $libnames $libc; do
5794 $ar tv $thisname >>libc.tmp
5795 # Revision 50 of EMX has bug in $ar.
5796 # it will not extract forwarders to DLL entries
5797 # Use emximp which will extract exactly them.
5798 emximp -o tmp.imp $thisname \
5799 2>/dev/null && \
5800 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5801 < tmp.imp >>libc.tmp
5802 $rm tmp.imp
5803 done
5804 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5805 echo "Ok." >&4
5806 else
5807 echo "$ar didn't seem to work right." >&4
5808 echo "Maybe this is a Cray...trying bld instead..." >&4
5809 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5810 then
5811 for thisname in $libnames; do
5812 bld t $libnames | \
5813 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5814 $ar t $thisname >>libc.tmp
5815 done
5816 echo "Ok." >&4
bd9b35c9 5817 else
c1a7f87b
JH
5818 echo "That didn't work either. Giving up." >&4
5819 exit 1
bd9b35c9 5820 fi
c1a7f87b 5821 fi
a4f3eea9 5822 fi
a4f3eea9 5823fi
c1a7f87b 5824nm_extract="$com"
522b859a
JH
5825case "$PASE" in
5826define)
5827 echo " "
44b94491 5828 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
c1aca012 5829 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
522b859a
JH
5830 ;;
5831*) if $test -f /lib/syscalls.exp; then
c1a7f87b
JH
5832 echo " "
5833 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
478d3074 5834 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
522b859a
JH
5835 fi
5836 ;;
5837esac
c1a7f87b
JH
5838;;
5839esac
5840$rm -f libnames libpath
bd9b35c9 5841
c1a7f87b
JH
5842: is a C symbol defined?
5843csym='tlook=$1;
5844case "$3" in
5845-v) tf=libc.tmp; tc=""; tdc="";;
5846-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5847*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5848esac;
5849tx=yes;
5850case "$reuseval-$4" in
5851true-) ;;
5852true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5853esac;
5854case "$tx" in
5855yes)
5856 case "$runnm" in
5857 true)
5858 if $contains $tlook $tf >/dev/null 2>&1;
5859 then tval=true;
5860 else tval=false;
5861 fi;;
5862 *)
5863 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5864 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5865 then tval=true;
5866 else tval=false;
5867 fi;
5868 $rm -f t t.c;;
5869 esac;;
5870*)
5871 case "$tval" in
5872 $define) tval=true;;
5873 *) tval=false;;
5874 esac;;
5875esac;
5876eval "$2=$tval"'
bd9b35c9 5877
c1a7f87b
JH
5878: define an is-in-libc? function
5879inlibc='echo " "; td=$define; tu=$undef;
5880sym=$1; var=$2; eval "was=\$$2";
5881tx=yes;
5882case "$reuseval$was" in
5883true) ;;
5884true*) tx=no;;
5885esac;
5886case "$tx" in
5887yes)
5888 set $sym tres -f;
5889 eval $csym;
5890 case "$tres" in
5891 true)
5892 echo "$sym() found." >&4;
5893 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5894 *)
5895 echo "$sym() NOT found." >&4;
5896 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5897 esac;;
bd9b35c9 5898*)
c1a7f87b
JH
5899 case "$was" in
5900 $define) echo "$sym() found." >&4;;
5901 *) echo "$sym() NOT found." >&4;;
5902 esac;;
5903esac'
5904
b4eb6b3d
JH
5905: see if sqrtl exists
5906set sqrtl d_sqrtl
c1a7f87b
JH
5907eval $inlibc
5908
44b94491
MB
5909hasproto='varname=$1; func=$2; shift; shift;
5910while $test $# -ge 2; do
5911 case "$1" in
5912 $define) echo "#include <$2>";;
5913 esac ;
5914 shift 2;
5915done > try.c;
5916$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5917if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5918 echo "$func() prototype found.";
5919 val="$define";
5920else
5921 echo "$func() prototype NOT found.";
5922 val="$undef";
5923fi;
5924set $varname;
5925eval $setvar;
5926$rm -f try.c tryout.c'
5927
b4eb6b3d
JH
5928: check for length of double
5929echo " "
5930case "$doublesize" in
5931'')
5932 echo "Checking to see how big your double precision numbers are..." >&4
5933 $cat >try.c <<'EOCP'
5934#include <stdio.h>
5935int main()
5936{
5937 printf("%d\n", (int)sizeof(double));
5938 exit(0);
5939}
5940EOCP
5941 set try
5942 if eval $compile_ok; then
5440bc8e 5943 doublesize=`$run ./try`
b4eb6b3d
JH
5944 echo "Your double is $doublesize bytes long."
5945 else
5946 dflt='8'
5947 echo "(I can't seem to compile the test program. Guessing...)"
5948 rp="What is the size of a double precision number (in bytes)?"
5949 . ./myread
5950 doublesize="$ans"
5951 fi
5952 ;;
5953esac
5954$rm -f try.c try
5955
5956: check for long doubles
5957echo " "
5958echo "Checking to see if you have long double..." >&4
5959echo 'int main() { long double x = 7.0; }' > try.c
5960set try
5961if eval $compile; then
5962 val="$define"
5963 echo "You have long double."
5964else
5965 val="$undef"
5966 echo "You do not have long double."
5967fi
5968$rm try.*
5969set d_longdbl
5970eval $setvar
5971
5972: check for length of long double
5973case "${d_longdbl}${longdblsize}" in
5974$define)
5975 echo " "
5976 echo "Checking to see how big your long doubles are..." >&4
5977 $cat >try.c <<'EOCP'
5978#include <stdio.h>
5979int main()
5980{
5981 printf("%d\n", sizeof(long double));
5982}
5983EOCP
5984 set try
5985 set try
5986 if eval $compile; then
5440bc8e 5987 longdblsize=`$run ./try`
b4eb6b3d
JH
5988 echo "Your long doubles are $longdblsize bytes long."
5989 else
5990 dflt='8'
5991 echo " "
5992 echo "(I can't seem to compile the test program. Guessing...)" >&4
5993 rp="What is the size of a long double (in bytes)?"
5994 . ./myread
5995 longdblsize="$ans"
5996 fi
5997 if $test "X$doublesize" = "X$longdblsize"; then
5998 echo "(That isn't any different from an ordinary double.)"
5999 fi
6000 ;;
6001esac
6002$rm -f try.* try
6003
dc526090
NC
6004echo " "
6005
6006if $test X"$d_longdbl" = X"$define"; then
6007
6008echo "Checking how to print long doubles..." >&4
6009
6010if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6011 $cat >try.c <<'EOCP'
6012#include <sys/types.h>
6013#include <stdio.h>
6014int main() {
6015 double d = 123.456;
6016 printf("%.3f\n", d);
6017}
6018EOCP
6019 set try
6020 if eval $compile; then
6021 yyy=`$run ./try`
6022 case "$yyy" in
6023 123.456)
6024 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6025 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6026 echo "We will use %f."
6027 ;;
6028 esac
6029 fi
6030fi
6031
6032if $test X"$sPRIfldbl" = X; then
6033 $cat >try.c <<'EOCP'
6034#include <sys/types.h>
6035#include <stdio.h>
6036int main() {
6037 long double d = 123.456;
6038 printf("%.3Lf\n", d);
6039}
6040EOCP
6041 set try
6042 if eval $compile; then
6043 yyy=`$run ./try`
6044 case "$yyy" in
6045 123.456)
6046 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6047 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6048 echo "We will use %Lf."
6049 ;;
6050 esac
6051 fi
6052fi
6053
6054if $test X"$sPRIfldbl" = X; then
6055 $cat >try.c <<'EOCP'
6056#include <sys/types.h>
6057#include <stdio.h>
6058int main() {
6059 long double d = 123.456;
6060 printf("%.3llf\n", d);
6061}
6062EOCP
6063 set try
6064 if eval $compile; then
6065 yyy=`$run ./try`
6066 case "$yyy" in
6067 123.456)
6068 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6069 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6070 echo "We will use %llf."
6071 ;;
6072 esac
6073 fi
6074fi
6075
6076if $test X"$sPRIfldbl" = X; then
6077 $cat >try.c <<'EOCP'
6078#include <sys/types.h>
6079#include <stdio.h>
6080int main() {
6081 long double d = 123.456;
6082 printf("%.3lf\n", d);
6083}
6084EOCP
6085 set try
6086 if eval $compile; then
6087 yyy=`$run ./try`
6088 case "$yyy" in
6089 123.456)
6090 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6091 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6092 echo "We will use %lf."
6093 ;;
6094 esac
6095 fi
6096fi
6097
6098if $test X"$sPRIfldbl" = X; then
6099 echo "Cannot figure out how to print long doubles." >&4
6100else
6101 sSCNfldbl=$sPRIfldbl # expect consistency
6102fi
6103
6104$rm -f try try.*
6105
6106fi # d_longdbl
6107
6108case "$sPRIfldbl" in
6109'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
6110 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
6111 d_SCNfldbl="$undef";
6112 ;;
6113*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
6114 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
6115 d_SCNfldbl="$define";
6116 ;;
6117esac
6118
6119: see if modfl exists
6120set modfl d_modfl
6121eval $inlibc
6122
51997bc3
NC
6123: see if prototype for modfl is available
6124echo " "
6125set d_modflproto modfl math.h
6126eval $hasproto
6127
dc526090
NC
6128d_modfl_pow32_bug="$undef"
6129
6130case "$d_longdbl$d_modfl" in
6131$define$define)
6132 $cat <<EOM
6133Checking to see whether your modfl() is okay for large values...
6134EOM
6135$cat >try.c <<EOCP
6136#include <math.h>
6137#include <stdio.h>
51997bc3
NC
6138EOCP
6139if $test "X$d_modflproto" != "X$define"; then
6140 $cat >>try.c <<EOCP
6141/* Sigh. many current glibcs provide the function, but do not prototype it. */
6142long double modfl (long double, long double *);
6143EOCP
6144fi
6145$cat >>try.c <<EOCP
dc526090
NC
6146int main() {
6147 long double nv = 4294967303.15;
6148 long double v, w;
6149 v = modfl(nv, &w);
6150#ifdef __GLIBC__
6151 printf("glibc");
6152#endif
6153 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6154 return 0;
6155}
6156EOCP
6157 case "$osname:$gccversion" in
6158 aix:) saveccflags="$ccflags"
6159 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6160 esac
6161 set try
6162 if eval $compile; then
6163 foo=`$run ./try`
6164 case "$foo" in
6165 *" 4294967303.150000 1.150000 4294967302.000000")
6166 echo >&4 "Your modfl() is broken for large values."
6167 d_modfl_pow32_bug="$define"
6168 case "$foo" in
6169 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6170 ;;
6171 esac
6172 ;;
6173 *" 4294967303.150000 0.150000 4294967303.000000")
6174 echo >&4 "Your modfl() seems okay for large values."
6175 ;;
6176 *) echo >&4 "I don't understand your modfl() at all."
6177 d_modfl="$undef"
6178 ;;
6179 esac
6180 $rm -f try.* try core core.try.*
6181 else
6182 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6183 d_modfl="$undef"
6184 fi
6185 case "$osname:$gccversion" in
6186 aix:) ccflags="$saveccflags" ;; # restore
6187 esac
6188 ;;
6189esac
6190
6191case "$ccflags" in
6192*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6193esac
6194
6195case "$uselongdouble" in
6196$define|true|[yY]*) dflt='y';;
6197*) dflt='n';;
6198esac
6199cat <<EOM
6200
6201Perl can be built to take advantage of long doubles which
6202(if available) may give more accuracy and range for floating point numbers.
6203
6204If this doesn't make any sense to you, just accept the default '$dflt'.
6205EOM
6206rp='Try to use long doubles if available?'
6207. ./myread
6208case "$ans" in
6209y|Y) val="$define" ;;
6210*) val="$undef" ;;
6211esac
6212set uselongdouble
6213eval $setvar
6214
6215case "$uselongdouble" in
6216true|[yY]*) uselongdouble="$define" ;;
6217esac
6218
6219case "$uselongdouble" in
6220$define)
6221: Look for a hint-file generated 'call-back-unit'. If the
6222: user has specified that long doubles should be used,
6223: we may need to set or change some other defaults.
6224 if $test -f uselongdouble.cbu; then
6225 echo "Your platform has some specific hints for long doubles, using them..."
6226 . ./uselongdouble.cbu
6227 else
6228 $cat <<EOM
6229(Your platform doesn't have any specific hints for long doubles.)
6230EOM
6231 fi
6232 ;;
6233esac
6234
6235message=X
6236case "$uselongdouble:$d_sqrtl:$d_modfl" in
6237$define:$define:$define)
6238 : You have both
6239 ;;
6240$define:$define:$undef)
6241 message="I could not find modfl"
6242 ;;
6243$define:$undef:$define)
6244 message="I could not find sqrtl"
6245 ;;
6246$define:$undef:$undef)
6247 message="I found neither sqrtl nor modfl"
6248 ;;
6249esac
6250
6251if $test "$message" != X; then
6252 $cat <<EOM >&4
6253
6254*** You requested the use of long doubles but you do not seem to have
6255*** the mathematic functions for long doubles.
6256*** ($message)
6257*** I'm disabling the use of long doubles.
6258
6259EOM
6260
6261 uselongdouble=$undef
6262fi
6263
b4eb6b3d
JH
6264: determine the architecture name
6265echo " "
6266if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6267 tarch=`arch`"-$osname"
6268elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6269 if uname -m > tmparch 2>&1 ; then
6270 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6271 -e 's/$/'"-$osname/" tmparch`
6272 else
6273 tarch="$osname"
6274 fi
6275 $rm -f tmparch
6276else
6277 tarch="$osname"
6278fi
6279case "$myarchname" in
6280''|"$tarch") ;;
6281*)
6282 echo "(Your architecture name used to be $myarchname.)"
6283 archname=''
6284 ;;
6285esac
5440bc8e
JH
6286case "$targetarch" in
6287'') ;;
6288*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6289esac
b4eb6b3d
JH
6290myarchname="$tarch"
6291case "$archname" in
6292'') dflt="$tarch";;
6293*) dflt="$archname";;
6294esac
6295rp='What is your architecture name'
6296. ./myread
6297archname="$ans"
6298case "$usethreads" in
6299$define)
6300 echo "Threads selected." >&4
6301 case "$archname" in
6302 *-thread*) echo "...and architecture name already has -thread." >&4
6303 ;;
6304 *) archname="$archname-thread"
6305 echo "...setting architecture name to $archname." >&4
6306 ;;
6307 esac
6308 ;;
6309esac
6310case "$usemultiplicity" in
6311$define)
6312 echo "Multiplicity selected." >&4
6313 case "$archname" in
6314 *-multi*) echo "...and architecture name already has -multi." >&4
6315 ;;
6316 *) archname="$archname-multi"
6317 echo "...setting architecture name to $archname." >&4
6318 ;;
6319 esac
6320 ;;
6321esac
6322case "$use64bitint$use64bitall" in
6323*"$define"*)
6324 case "$archname64" in
6325 '')
6326 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6327 ;;
6328 *)
6329 case "$use64bitint" in
6330 "$define") echo "64 bit integers selected." >&4 ;;
6331 esac
6332 case "$use64bitall" in
6333 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6334 esac
6335 case "$archname" in
6336 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6337 ;;
6338 *) archname="$archname-$archname64"
6339 echo "...setting architecture name to $archname." >&4
6340 ;;
6341 esac
6342 ;;
6343 esac
6344esac
6345case "$uselongdouble" in
6346$define)
6347 echo "Long doubles selected." >&4
6348 case "$longdblsize" in
6349 $doublesize)
262495b9 6350 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
b4eb6b3d
JH
6351 ;;
6352 *)
6353 case "$archname" in
6354 *-ld*) echo "...and architecture name already has -ld." >&4
6355 ;;
6356 *) archname="$archname-ld"
6357 echo "...setting architecture name to $archname." >&4
6358 ;;
6359 esac
6360 ;;
6361 esac
6362 ;;
6363esac
51de783f
JH
6364case "$useperlio" in
6365$define)
6366 echo "Perlio selected." >&4
d46c9a2d
JH
6367 ;;
6368*)
6369 echo "Perlio not selected, using stdio." >&4
51de783f 6370 case "$archname" in
d46c9a2d 6371 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 6372 ;;
d46c9a2d 6373 *) archname="$archname-stdio"
51de783f
JH
6374 echo "...setting architecture name to $archname." >&4
6375 ;;
6376 esac
6377 ;;
6378esac
b4eb6b3d
JH
6379
6380: determine root of directory hierarchy where package will be installed.
6381case "$prefix" in
6382'')
6383 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6384 ;;
30e7fb8a
MB
6385*?/)
6386 dflt=`echo "$prefix" | sed 's/.$//'`
6387 ;;
b4eb6b3d
JH
6388*)
6389 dflt="$prefix"
6390 ;;
6391esac
6392$cat <<EOM
6393
6394By default, $package will be installed in $dflt/bin, manual pages
6395under $dflt/man, etc..., i.e. with $dflt as prefix for all
6396installation directories. Typically this is something like /usr/local.
6397If you wish to have binaries under /usr/bin but other parts of the
6398installation under /usr/local, that's ok: you will be prompted
6399separately for each of the installation directories, the prefix being
6400only used to set the defaults.
6401
6402EOM
6403fn=d~
6404rp='Installation prefix to use?'
6405. ./getfile
6406oldprefix=''
6407case "$prefix" in
6408'') ;;
6409*)
6410 case "$ans" in
6411 "$prefix") ;;
6412 *) oldprefix="$prefix";;
6413 esac
6414 ;;
6415esac
6416prefix="$ans"
6417prefixexp="$ansexp"
6418
a6d26a0d
JH
6419case "$afsroot" in
6420'') afsroot=/afs ;;
6421*) afsroot=$afsroot ;;
6422esac
6423
b4eb6b3d
JH
6424: is AFS running?
6425echo " "
6426case "$afs" in
6427$define|true) afs=true ;;
6428$undef|false) afs=false ;;
a6d26a0d 6429*) if test -d $afsroot; then
b4eb6b3d
JH
6430 afs=true
6431 else
6432 afs=false
6433 fi
6434 ;;
6435esac
6436if $afs; then
6437 echo "AFS may be running... I'll be extra cautious then..." >&4
6438else
6439 echo "AFS does not seem to be running..." >&4
6440fi
6441
6442: determine installation prefix for where package is to be installed.
6443if $afs; then
6444$cat <<EOM
6445
6446Since you are running AFS, I need to distinguish the directory in which
6447files will reside from the directory in which they are installed (and from
6448which they are presumably copied to the former directory by occult means).
6449
6450EOM
6451 case "$installprefix" in
6452 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6453 *) dflt="$installprefix";;
6454 esac
6455else
6456$cat <<EOM
6457
6458In some special cases, particularly when building $package for distribution,
c2bfb7b1
MB
6459it is convenient to distinguish the directory in which files should be
6460installed from the directory ($prefix) in which they will
6461eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
6462
6463EOM
6464 case "$installprefix" in
6465 '') dflt=$prefix ;;
6466 *) dflt=$installprefix;;
6467 esac
6468fi
6469fn=d~
6470rp='What installation prefix should I use for installing files?'
6471. ./getfile
6472installprefix="$ans"
6473installprefixexp="$ansexp"
6474
6475: set the prefixit variable, to compute a suitable default value
6476prefixit='case "$3" in
6477""|none)
6478 case "$oldprefix" in
6479 "") eval "$1=\"\$$2\"";;
6480 *)
6481 case "$3" in
6482 "") eval "$1=";;
6483 none)
6484 eval "tp=\"\$$2\"";
6485 case "$tp" in
6486 ""|" ") eval "$1=\"\$$2\"";;
6487 *) eval "$1=";;
6488 esac;;
6489 esac;;
6490 esac;;
6491*)
6492 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6493 case "$tp" in
6494 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6495 /*-$oldprefix/*|\~*-$oldprefix/*)
6496 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6497 *) eval "$1=\"\$$2\"";;
6498 esac;;
6499esac'
6500
b4eb6b3d
JH
6501: get the patchlevel
6502echo " "
6503echo "Getting the current patchlevel..." >&4
6504if $test -r $rsrc/patchlevel.h;then
6505 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6506 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6507 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6508 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6509 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6510 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6511 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6512else
6513 revision=0
6514 patchlevel=0
6515 subversion=0
6516 api_revision=0
6517 api_version=0
6518 api_subversion=0
151e6568
MB
6519 perl_patchlevel=0
6520 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6521fi
151e6568
MB
6522if $test -r $rsrc/.patch ; then
6523 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6524 perl_patchlevel=`cat $rsrc/.patch`
6525 fi
6526fi
861eb78d
AD
6527: Define a handy string here to avoid duplication in myconfig.SH and configpm.
6528version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 6529case "$perl_patchlevel" in
861eb78d
AD
65300|'') ;;
6531*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 6532esac
861eb78d
AD
6533
6534$echo "(You have $package $version_patchlevel_string.)"
6535
b4eb6b3d
JH
6536case "$osname" in
6537dos|vms)
6538 : XXX Should be a Configure test for double-dots in filenames.
6539 version=`echo $revision $patchlevel $subversion | \
6540 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6541 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6542 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6543 ;;
6544*)
6545 version=`echo $revision $patchlevel $subversion | \
6546 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6547 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6548 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6549 ;;
6550esac
6551: Special case the 5.005_xx maintenance series, which used 5.005
6552: without any subversion label as a subdirectory in $sitelib
6553if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6554 api_versionstring='5.005'
6555fi
6556
6557: determine installation style
6558: For now, try to deduce it from prefix unless it is already set.
6559: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6560case "$installstyle" in
6561'') case "$prefix" in
6562 *perl*) dflt='lib';;
6563 *) dflt='lib/perl5' ;;
6564 esac
6565 ;;
6566*) dflt="$installstyle" ;;
6567esac
6568: Probably not worth prompting for this since we prompt for all
6569: the directories individually, and the prompt would be too long and
6570: confusing anyway.
6571installstyle=$dflt
6572
6573: determine where private library files go
6574: Usual default is /usr/local/lib/perl5/$version.
6575: Also allow things like /opt/perl/lib/$version, since
6576: /opt/perl/lib/perl5... would be redundant.
6577: The default "style" setting is made in installstyle.U
6578case "$installstyle" in
6579*lib/perl5*) set dflt privlib lib/$package/$version ;;
6580*) set dflt privlib lib/$version ;;
6581esac
6582eval $prefixit
6583$cat <<EOM
6584
6585There are some auxiliary files for $package that need to be put into a
6586private library directory that is accessible by everyone.
6587
6588EOM
6589fn=d~+
6590rp='Pathname where the private library files will reside?'
6591. ./getfile
6592privlib="$ans"
6593privlibexp="$ansexp"
6594: Change installation prefix, if necessary.
6595if $test X"$prefix" != X"$installprefix"; then
6596 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6597else
6598 installprivlib="$privlibexp"
6599fi
6600
6601: set the prefixup variable, to restore leading tilda escape
6602prefixup='case "$prefixexp" in
6603"$prefix") ;;
6604*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6605esac'
6606
6607: determine where public architecture dependent libraries go
6608set archlib archlib
6609eval $prefixit
6610: privlib default is /usr/local/lib/$package/$version
6611: archlib default is /usr/local/lib/$package/$version/$archname
6612: privlib may have an optional trailing /share.
6613tdflt=`echo $privlib | $sed 's,/share$,,'`
6614tdflt=$tdflt/$archname
6615case "$archlib" in
6616'') dflt=$tdflt
6617 ;;
6618*) dflt="$archlib"
6619 ;;
6620esac
6621$cat <<EOM
6622
6623$spackage contains architecture-dependent library files. If you are
6624sharing libraries in a heterogeneous environment, you might store
6625these files in a separate location. Otherwise, you can just include
6626them with the rest of the public library files.
6627
6628EOM
6629fn=d+~
6630rp='Where do you want to put the public architecture-dependent libraries?'
6631. ./getfile
6632archlib="$ans"
6633archlibexp="$ansexp"
6634if $test X"$archlib" = X"$privlib"; then
6635 d_archlib="$undef"
6636else
6637 d_archlib="$define"
6638fi
6639: Change installation prefix, if necessary.
6640if $test X"$prefix" != X"$installprefix"; then
6641 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6642else
6643 installarchlib="$archlibexp"
6644fi
6645
b4eb6b3d
JH
6646: see if setuid scripts can be secure
6647$cat <<EOM
6648
6649Some kernels have a bug that prevents setuid #! scripts from being
6650secure. Some sites have disabled setuid #! scripts because of this.
6651
6652First let's decide if your kernel supports secure setuid #! scripts.
6653(If setuid #! scripts would be secure but have been disabled anyway,
6654don't say that they are secure if asked.)
6655
6656EOM
6657
6658val="$undef"
6659if $test -d /dev/fd; then
6660 echo "#!$ls" >reflect
6661 chmod +x,u+s reflect
6662 ./reflect >flect 2>&1
6663 if $contains "/dev/fd" flect >/dev/null; then
6664 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6665 val="$define"
6666 else
6667 $cat <<EOM
6668If you are not sure if they are secure, I can check but I'll need a
6669username and password different from the one you are using right now.
6670If you don't have such a username or don't want me to test, simply
6671enter 'none'.
6672
6673EOM
6674 rp='Other username to test security of setuid scripts with?'
6675 dflt='none'
6676 . ./myread
6677 case "$ans" in
6678 n|none)
6679 case "$d_suidsafe" in
6680 '') echo "I'll assume setuid scripts are *not* secure." >&4
6681 dflt=n;;
6682 "$undef")
6683 echo "Well, the $hint value is *not* secure." >&4
6684 dflt=n;;
6685 *) echo "Well, the $hint value *is* secure." >&4
6686 dflt=y;;
6687 esac
c1a7f87b 6688 ;;
b4eb6b3d
JH
6689 *)
6690 $rm -f reflect flect
6691 echo "#!$ls" >reflect
6692 chmod +x,u+s reflect
6693 echo >flect
6694 chmod a+w flect
6695 echo '"su" will (probably) prompt you for '"$ans's password."
6696 su $ans -c './reflect >flect'
6697 if $contains "/dev/fd" flect >/dev/null; then
6698 echo "Okay, it looks like setuid scripts are secure." >&4
6699 dflt=y
6700 else
6701 echo "I don't think setuid scripts are secure." >&4
6702 dflt=n
6703 fi
6704 ;;
6705 esac
6706 rp='Does your kernel have *secure* setuid scripts?'
6707 . ./myread
6708 case "$ans" in
6709 [yY]*) val="$define";;
6710 *) val="$undef";;
6711 esac
6712 fi
6713else
6714 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6715 echo "(That's for file descriptors, not floppy disks.)"
6716 val="$undef"
6717fi
6718set d_suidsafe
6719eval $setvar
6720
6721$rm -f reflect flect
6722
6723: now see if they want to do setuid emulation
6724echo " "
6725val="$undef"
6726case "$d_suidsafe" in
6727"$define")
6728 val="$undef"
3c728e00 6729 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6730 ;;
6731*)
6732 $cat <<EOM
6733Some systems have disabled setuid scripts, especially systems where
6734setuid scripts cannot be secure. On systems where setuid scripts have
6735been disabled, the setuid/setgid bits on scripts are currently
6736useless. It is possible for $package to detect those bits and emulate
6737setuid/setgid in a secure fashion. This emulation will only work if
6738setuid scripts have been disabled in your kernel.
6739
6740EOM
6741 case "$d_dosuid" in
6742 "$define") dflt=y ;;
6743 *) dflt=n ;;
6744 esac
6745 rp="Do you want to do setuid/setgid emulation?"
6746 . ./myread
6747 case "$ans" in
6748 [yY]*) val="$define";;
6749 *) val="$undef";;
6750 esac
6751 ;;
6752esac
6753set d_dosuid
6754eval $setvar
6755
b4eb6b3d 6756: see if this is a malloc.h system
01d07975
YST
6757: we want a real compile instead of Inhdr because some systems have a
6758: malloc.h that just gives a compile error saying to use stdlib.h instead
6759echo " "
6760$cat >try.c <<EOCP
6761#include <stdlib.h>
6762#include <malloc.h>
6763int main () { return 0; }
6764EOCP
6765set try
6766if eval $compile; then
6767 echo "<malloc.h> found." >&4
6768 val="$define"
6769else
6770 echo "<malloc.h> NOT found." >&4
6771 val="$undef"
6772fi
6773$rm -f try.c try
6774set i_malloc
6775eval $setvar
b4eb6b3d
JH
6776
6777: see if stdlib is available
6778set stdlib.h i_stdlib
6779eval $inhdr
6780
c8b93cf9
JH
6781: check for void type
6782echo " "
6783echo "Checking to see how well your C compiler groks the void type..." >&4
6784case "$voidflags" in
6785'')
6786 $cat >try.c <<'EOCP'
6787#if TRY & 1
6788void sub() {
6789#else
6790sub() {
6791#endif
6792 extern void moo(); /* function returning void */
6793 void (*goo)(); /* ptr to func returning void */
6794#if TRY & 8
6795 void *hue; /* generic ptr */
6796#endif
6797#if TRY & 2
6798 void (*foo[10])();
6799#endif
6800
6801#if TRY & 4
6802 if(goo == moo) {
6803 exit(0);
6804 }
6805#endif
6806 exit(0);
6807}
6808int main() { sub(); }
6809EOCP
6810 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6811 voidflags=$defvoidused
6812 echo "Good. It appears to support void to the level $package wants.">&4
6813 if $contains warning .out >/dev/null 2>&1; then
6814 echo "However, you might get some warnings that look like this:"
6815 $cat .out
6816 fi
6817 else
6818echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6819 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6820 echo "It supports 1..."
6821 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6822 echo "It also supports 2..."
6823 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6824 voidflags=7
6825 echo "And it supports 4 but not 8 definitely."
6826 else
6827 echo "It doesn't support 4..."
6828 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6829 voidflags=11
6830 echo "But it supports 8."
6831 else
6832 voidflags=3
6833 echo "Neither does it support 8."
6834 fi
6835 fi
6836 else
6837 echo "It does not support 2..."
6838 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6839 voidflags=13
6840 echo "But it supports 4 and 8."
6841 else
6842 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6843 voidflags=5
6844 echo "And it supports 4 but has not heard about 8."
6845 else
6846 echo "However it supports 8 but not 4."
6847 fi
6848 fi
6849 fi
6850 else
6851 echo "There is no support at all for void."
6852 voidflags=0
6853 fi
6854 fi
6855esac
6856case "$voidflags" in
6857"$defvoidused") ;;
6858*) $cat >&4 <<'EOM'
6859 Support flag bits are:
6860 1: basic void declarations.
6861 2: arrays of pointers to functions returning void.
6862 4: operations between pointers to and addresses of void functions.
6863 8: generic void pointers.
6864EOM
6865 dflt="$voidflags";
6866 rp="Your void support flags add up to what?"
6867 . ./myread
6868 voidflags="$ans"
6869 ;;
6870esac
6871$rm -f try.* .out
6872
6873: check for length of pointer
6874echo " "
6875case "$ptrsize" in
6876'')
6877 echo "Checking to see how big your pointers are..." >&4
6878 if test "$voidflags" -gt 7; then
6879 echo '#define VOID_PTR char *' > try.c
6880 else
6881 echo '#define VOID_PTR void *' > try.c
6882 fi
6883 $cat >>try.c <<'EOCP'
6884#include <stdio.h>
6885int main()
6886{
6887 printf("%d\n", (int)sizeof(VOID_PTR));
6888 exit(0);
6889}
6890EOCP
6891 set try
6892 if eval $compile_ok; then
6893 ptrsize=`$run ./try`
6894 echo "Your pointers are $ptrsize bytes long."
6895 else
6896 dflt='4'
6897 echo "(I can't seem to compile the test program. Guessing...)" >&4
6898 rp="What is the size of a pointer (in bytes)?"
6899 . ./myread
6900 ptrsize="$ans"
6901 fi
6902 ;;
6903esac
6904$rm -f try.c try
6905case "$use64bitall" in
6906"$define"|true|[yY]*)
6907 case "$ptrsize" in
6908 4) cat <<EOM >&4
6909
6910*** You have chosen a maximally 64-bit build, but your pointers
6911*** are only 4 bytes wide, disabling maximal 64-bitness.
6912
6913EOM
6914 use64bitall="$undef"
6915 case "$use64bitint" in
6916 "$define"|true|[yY]*) ;;
6917 *) cat <<EOM >&4
6918
6919*** Downgrading from maximal 64-bitness to using 64-bit integers.
6920
6921EOM
6922 use64bitint="$define"
6923 ;;
6924 esac
6925 ;;
6926 esac
6927 ;;
6928esac
6929
6930
b4eb6b3d
JH
6931: determine which malloc to compile in
6932echo " "
6933case "$usemymalloc" in
c4163172
JH
6934[yY]*|true|$define) dflt='y' ;;
6935[nN]*|false|$undef) dflt='n' ;;
6936*) case "$ptrsize" in
6937 4) dflt='y' ;;
6938 *) dflt='n' ;;
6939 esac
6940 ;;
8dfa8df9 6941esac
b4eb6b3d
JH
6942rp="Do you wish to attempt to use the malloc that comes with $package?"
6943. ./myread
6944usemymalloc="$ans"
6945case "$ans" in
6946y*|true)
6947 usemymalloc='y'
6948 mallocsrc='malloc.c'
6949 mallocobj="malloc$_o"
6950 d_mymalloc="$define"
6951 case "$libs" in
6952 *-lmalloc*)
6953 : Remove malloc from list of libraries to use
6954 echo "Removing unneeded -lmalloc from library list" >&4
6955 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6956 shift
6957 libs="$*"
6958 echo "libs = $libs" >&4
6959 ;;
6960 esac
6961 ;;
6962*)
6963 usemymalloc='n'
6964 mallocsrc=''
6965 mallocobj=''
6966 d_mymalloc="$undef"
6967 ;;
6968esac
6969
6970: compute the return types of malloc and free
6971echo " "
6972$cat >malloc.c <<END
6973#$i_malloc I_MALLOC
6974#$i_stdlib I_STDLIB
6975#include <stdio.h>
6976#include <sys/types.h>
6977#ifdef I_MALLOC
6978#include <malloc.h>
6979#endif
6980#ifdef I_STDLIB
6981#include <stdlib.h>
6982#endif
6983#ifdef TRY_MALLOC
6984void *malloc();
6985#endif
6986#ifdef TRY_FREE
6987void free();
6988#endif
6989END
6990case "$malloctype" in
6991'')
6992 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6993 malloctype='void *'
6994 else
6995 malloctype='char *'
6996 fi
6997 ;;
6998esac
6999echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7000
7001case "$freetype" in
7002'')
7003 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7004 freetype='void'
7005 else
7006 freetype='int'
7007 fi
7008 ;;
7009esac
7010echo "Your system uses $freetype free(), it would seem." >&4
7011$rm -f malloc.[co]
7012$cat <<EOM
7013
7014After $package is installed, you may wish to install various
7015add-on modules and utilities. Typically, these add-ons will
7016be installed under $prefix with the rest
7017of this package. However, you may wish to install such add-ons
7018elsewhere under a different prefix.
7019
7020If you do not wish to put everything under a single prefix, that's
7021ok. You will be prompted for the individual locations; this siteprefix
7022is only used to suggest the defaults.
7023
7024The default should be fine for most people.
7025
7026EOM
7027fn=d~+
7028rp='Installation prefix to use for add-on modules and utilities?'
7029: XXX Here might be another good place for an installstyle setting.
7030case "$siteprefix" in
7031'') dflt=$prefix ;;
7032*) dflt=$siteprefix ;;
7033esac
7034. ./getfile
7035: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7036oldsiteprefix=''
7037case "$siteprefix" in
7038'') ;;
7039*) case "$ans" in
7040 "$prefix") ;;
7041 *) oldsiteprefix="$prefix";;
7042 esac
7043 ;;
7044esac
7045siteprefix="$ans"
7046siteprefixexp="$ansexp"
7047
7048: determine where site specific libraries go.
7049: Usual default is /usr/local/lib/perl5/site_perl/$version
7050: The default "style" setting is made in installstyle.U
7051: XXX No longer works with Prefixit stuff.
7052prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7053case "$sitelib" in
7054'') case "$installstyle" in
7055 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7056 *) dflt=$siteprefix/lib/site_$prog/$version ;;
7057 esac
7058 ;;
7059*) dflt="$sitelib"
7060 ;;
7061esac
7062$cat <<EOM
7063
7064The installation process will create a directory for
7065site-specific extensions and modules. Most users find it convenient
7066to place all site-specific files in this directory rather than in the
7067main distribution directory.
7068
7069EOM
7070fn=d~+
7071rp='Pathname for the site-specific library files?'
7072. ./getfile
7073sitelib="$ans"
7074sitelibexp="$ansexp"
7075sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7076: Change installation prefix, if necessary.
7077if $test X"$prefix" != X"$installprefix"; then
7078 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7079else
7080 installsitelib="$sitelibexp"
7081fi
7082
7083: determine where site specific architecture-dependent libraries go.
7084: sitelib default is /usr/local/lib/perl5/site_perl/$version
7085: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7086: sitelib may have an optional trailing /share.
7087case "$sitearch" in
7088'') dflt=`echo $sitelib | $sed 's,/share$,,'`
7089 dflt="$dflt/$archname"
7090 ;;
7091*) dflt="$sitearch"
7092 ;;
7093esac
7094set sitearch sitearch none
7095eval $prefixit
7096$cat <<EOM
7097
7098The installation process will also create a directory for
7099architecture-dependent site-specific extensions and modules.
7100
7101EOM
7102fn=d~+
7103rp='Pathname for the site-specific architecture-dependent library files?'
7104. ./getfile
7105sitearch="$ans"
7106sitearchexp="$ansexp"
7107: Change installation prefix, if necessary.
7108if $test X"$prefix" != X"$installprefix"; then
7109 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7110else
7111 installsitearch="$sitearchexp"
7112fi
7113
7114$cat <<EOM
7115
7116The installation process will also create a directory for
7117vendor-supplied add-ons. Vendors who supply perl with their system
7118may find it convenient to place all vendor-supplied files in this
7119directory rather than in the main distribution directory. This will
7120ease upgrades between binary-compatible maintenance versions of perl.
7121
7122Of course you may also use these directories in whatever way you see
7123fit. For example, you might use them to access modules shared over a
7124company-wide network.
7125
7126The default answer should be fine for most people.
7127This causes further questions about vendor add-ons to be skipped
7128and no vendor-specific directories will be configured for perl.
7129
7130EOM
7131rp='Do you want to configure vendor-specific add-on directories?'
7132case "$usevendorprefix" in
7133define|true|[yY]*) dflt=y ;;
7134*) : User may have set vendorprefix directly on Configure command line.
7135 case "$vendorprefix" in
7136 ''|' ') dflt=n ;;
7137 *) dflt=y ;;
7138 esac
7139 ;;
7140esac
7141. ./myread
7142case "$ans" in
7143[yY]*) fn=d~+
7144 rp='Installation prefix to use for vendor-supplied add-ons?'
7145 case "$vendorprefix" in
7146 '') dflt='' ;;
7147 *) dflt=$vendorprefix ;;
7148 esac
7149 . ./getfile
7150 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7151 oldvendorprefix=''
7152 case "$vendorprefix" in
7153 '') ;;
7154 *) case "$ans" in
7155 "$prefix") ;;
7156 *) oldvendorprefix="$prefix";;
7157 esac
7158 ;;
7159 esac
7160 usevendorprefix="$define"
7161 vendorprefix="$ans"
7162 vendorprefixexp="$ansexp"
7163 ;;
7164*) usevendorprefix="$undef"
7165 vendorprefix=''
7166 vendorprefixexp=''
7167 ;;
7168esac
7169
7170case "$vendorprefix" in
7171'') d_vendorlib="$undef"
7172 vendorlib=''
7173 vendorlibexp=''
7174 ;;
7175*) d_vendorlib="$define"
7176 : determine where vendor-supplied modules go.
7177 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7178 case "$vendorlib" in
7179 '')
7180 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7181 case "$installstyle" in
7182 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7183 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7184 esac
7185 ;;
7186 *) dflt="$vendorlib"
7187 ;;
7188 esac
7189 fn=d~+
7190 rp='Pathname for the vendor-supplied library files?'
7191 . ./getfile
7192 vendorlib="$ans"
7193 vendorlibexp="$ansexp"
7194 ;;
7195esac
7196vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7197: Change installation prefix, if necessary.
7198if $test X"$prefix" != X"$installprefix"; then
7199 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7200else
7201 installvendorlib="$vendorlibexp"
7202fi
7203
7204case "$vendorprefix" in
7205'') d_vendorarch="$undef"
7206 vendorarch=''
7207 vendorarchexp=''
7208 ;;
7209*) d_vendorarch="$define"
7210 : determine where vendor-supplied architecture-dependent libraries go.
7211 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7212 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7213 : vendorlib may have an optional trailing /share.
7214 case "$vendorarch" in
7215 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7216 dflt="$dflt/$archname"
7217 ;;
7218 *) dflt="$vendorarch" ;;
7219 esac
7220 fn=d~+
7221 rp='Pathname for vendor-supplied architecture-dependent files?'
7222 . ./getfile
7223 vendorarch="$ans"
7224 vendorarchexp="$ansexp"
7225 ;;
7226esac
7227: Change installation prefix, if necessary.
7228if $test X"$prefix" != X"$installprefix"; then
7229 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7230else
7231 installvendorarch="$vendorarchexp"
7232fi
7233
7234: Final catch-all directories to search
7235$cat <<EOM
7236
7237Lastly, you can have perl look in other directories for extensions and
7238modules in addition to those already specified.
7239These directories will be searched after
7240 $sitearch
7241 $sitelib
7242EOM
7243test X"$vendorlib" != "X" && echo ' ' $vendorlib
7244test X"$vendorarch" != "X" && echo ' ' $vendorarch
7245echo ' '
7246case "$otherlibdirs" in
7247''|' ') dflt='none' ;;
7248*) dflt="$otherlibdirs" ;;
7249esac
7250$cat <<EOM
7251Enter a colon-separated set of extra paths to include in perl's @INC
7252search path, or enter 'none' for no extra paths.
7253
7254EOM
7255
7256rp='Colon-separated list of additional directories for perl to search?'
7257. ./myread
7258case "$ans" in
7259' '|''|none) otherlibdirs=' ' ;;
7260*) otherlibdirs="$ans" ;;
7261esac
7262case "$otherlibdirs" in
7263' ') val=$undef ;;
7264*) val=$define ;;
7265esac
7266set d_perl_otherlibdirs
7267eval $setvar
7268
7269: Cruising for prototypes
7270echo " "
7271echo "Checking out function prototypes..." >&4
7272$cat >prototype.c <<'EOCP'
7273int main(int argc, char *argv[]) {
7274 exit(0);}
7275EOCP
7276if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7277 echo "Your C compiler appears to support function prototypes."
7278 val="$define"
7279else
7280 echo "Your C compiler doesn't seem to understand function prototypes."
7281 val="$undef"
7282fi
7283set prototype
7284eval $setvar
7285$rm -f prototype*
7286
7287case "$prototype" in
7288"$define") ;;
7289*) ansi2knr='ansi2knr'
7290 echo " "
7291 cat <<EOM >&4
7292
7293$me: FATAL ERROR:
7294This version of $package can only be compiled by a compiler that
7295understands function prototypes. Unfortunately, your C compiler
7296 $cc $ccflags
7297doesn't seem to understand them. Sorry about that.
7298
7299If GNU cc is available for your system, perhaps you could try that instead.
7300
7301Eventually, we hope to support building Perl with pre-ANSI compilers.
7302If you would like to help in that effort, please contact <perlbug@perl.org>.
7303
7304Aborting Configure now.
7305EOM
7306 exit 2
7307 ;;
7308esac
7309
7310: determine where public executables go
7311echo " "
7312set dflt bin bin
7313eval $prefixit
7314fn=d~
7315rp='Pathname where the public executables will reside?'
7316. ./getfile
7317if $test "X$ansexp" != "X$binexp"; then
7318 installbin=''
7319fi
7320bin="$ans"
7321binexp="$ansexp"
7322: Change installation prefix, if necessary.
7323: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7324if $test X"$prefix" != X"$installprefix"; then
7325 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7326else
7327 installbin="$binexp"
7328fi
7329
6fcddf3b 7330echo " "
6fcddf3b 7331case "$extras" in
bf35c3f6
JH
7332'') dflt='n';;
7333*) dflt='y';;
6fcddf3b
JH
7334esac
7335cat <<EOM
7336Perl can be built with extra modules or bundles of modules which
7337will be fetched from the CPAN and installed alongside Perl.
7338
7339Notice that you will need access to the CPAN; either via the Internet,
7340or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7341be asked later to configure the CPAN.pm module which will in turn do
7342the installation of the rest of the extra modules or bundles.)
7343
7344Notice also that if the modules require any external software such as
dd2de242
JH
7345libraries and headers (the libz library and the zlib.h header for the
7346Compress::Zlib module, for example) you MUST have any such software
7347already installed, this configuration process will NOT install such
7348things for you.
6fcddf3b
JH
7349
7350If this doesn't make any sense to you, just accept the default '$dflt'.
7351EOM
dd2de242 7352rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7353. ./myread
7354case "$ans" in
7355y|Y)
7356 cat <<EOM
7357
7358Please list any extra modules or bundles to be installed from CPAN,
7359with spaces between the names. The names can be in any format the
dd2de242
JH
7360'install' command of CPAN.pm will understand. (Answer 'none',
7361without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7362EOM
7363 rp='Extras?'
7364 dflt="$extras"
7365 . ./myread
7366 extras="$ans"
7367esac
7368case "$extras" in
7369''|'none')
7370 val=''
7371 $rm -f ../extras.lst
7372 ;;
7373*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7374 echo "$extras" > ../extras.lst
7375 val="'$extras'"
6fcddf3b
JH
7376 ;;
7377esac
7378set extras
7379eval $setvar
7380echo " "
7381
6e1038e0
MB
7382: determine where html pages for programs go
7383set html1dir html1dir none
7384eval $prefixit
7385$cat <<EOM
7386
7387If you wish to install html files for programs in $spackage, indicate
7388the appropriate directory here. To skip installing html files,
7389answer "none".
7390EOM
7391case "$html1dir" in
7392''|none|$undef|' ') dflt=none ;;
7393*) dflt=$html1dir ;;
7394esac
7395fn=dn+~
7396rp="Directory for the main $spackage html pages?"
7397. ./getfile
7398html1dir="$ans"
7399html1direxp="$ansexp"
7400: Use ' ' for none so value is preserved next time through Configure
7401$test X"$html1dir" = "X" && html1dir=' '
7402: Change installation prefix, if necessary.
7403if $test X"$prefix" != X"$installprefix"; then
7404 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7405else
7406 installhtml1dir="$html1direxp"
7407fi
7408
7409: determine where html pages for libraries and modules go
7410set html3dir html3dir none
7411eval $prefixit
7412$cat <<EOM
7413
7414If you wish to install html files for modules associated with $spackage,
7415indicate the appropriate directory here. To skip installing html files,
7416answer "none".
7417EOM
7418: There is no obvious default. If they have specified html1dir, then
7419: try to key off that, possibly changing .../html1 into .../html3.
7420case "$html3dir" in
7421'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7422*) dflt=$html3dir ;;
7423esac
7424fn=dn+~
7425rp="Directory for the $spackage module html pages?"
7426. ./getfile
7427html3dir="$ans"
7428html3direxp="$ansexp"
7429: Use ' ' for none so value is preserved next time through Configure
7430$test X"$html3dir" = "X" && html3dir=' '
7431: Change installation prefix, if necessary.
7432if $test X"$prefix" != X"$installprefix"; then
7433 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7434else
7435 installhtml3dir="$html3direxp"
7436fi
7437
b4eb6b3d
JH
7438: Find perl5.005 or later.
7439echo "Looking for a previously installed perl5.005 or later... "
7440case "$perl5" in
a938a3bb 7441'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 7442 : Check if this perl is recent and can load a simple module
a938a3bb 7443 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
7444 perl5=$tdir/perl
7445 break;
a938a3bb
IZ
7446 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7447 perl5=$tdir/perl5
b4eb6b3d
JH
7448 break;
7449 fi
7450 done
7451 ;;
7452*) perl5="$perl5"
7453 ;;
7454esac
7455case "$perl5" in
7456'') echo "None found. That's ok.";;
7457*) echo "Using $perl5." ;;
7458esac
7459
7460: Determine list of previous versions to include in @INC
7461$cat > getverlist <<EOPL
7462#!$perl5 -w
7463use File::Basename;
7464\$api_versionstring = "$api_versionstring";
7465\$version = "$version";
7466\$stem = "$sitelib_stem";
7467\$archname = "$archname";
7468EOPL
7469 $cat >> getverlist <<'EOPL'
7470# Can't have leading @ because metaconfig interprets it as a command!
7471;@inc_version_list=();
7472# XXX Redo to do opendir/readdir?
7473if (-d $stem) {
7474 chdir($stem);
7475 ;@candidates = glob("5.*");
7476}
7477else {
7478 ;@candidates = ();
7479}
7480
7481# XXX ToDo: These comparisons must be reworked when two-digit
7482# subversions come along, so that 5.7.10 compares as greater than
7483# 5.7.3! By that time, hope that 5.6.x is sufficiently
7484# widespread that we can use the built-in version vectors rather
7485# than reinventing them here. For 5.6.0, however, we must
7486# assume this script will likely be run by 5.005_0x. --AD 1/2000.
7487foreach $d (@candidates) {
7488 if ($d lt $version) {
7489 if ($d ge $api_versionstring) {
7490 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7491 }
7492 elsif ($d ge "5.005") {
7493 unshift(@inc_version_list, grep { -d } $d);
7494 }
7495 }
7496 else {
7497 # Skip newer version. I.e. don't look in
7498 # 5.7.0 if we're installing 5.6.1.
7499 }
7500}
7501
7502if (@inc_version_list) {
7503 print join(' ', @inc_version_list);
7504}
7505else {
7506 # Blank space to preserve value for next Configure run.
7507 print " ";
7508}
7509EOPL
7510chmod +x getverlist
7511case "$inc_version_list" in
a938a3bb 7512'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
7513 dflt=`$perl5 getverlist`
7514 else
7515 dflt='none'
7516 fi
7517 ;;
7518$undef) dflt='none' ;;
6d1a7737 7519*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
7520esac
7521case "$dflt" in
7522''|' ') dflt=none ;;
7523esac
7524case "$dflt" in
d953f698 75255.005) dflt=none ;;
b4eb6b3d 7526esac
ae079a50 7527$cat <<EOM
b4eb6b3d
JH
7528
7529In order to ease the process of upgrading, this version of perl
7530can be configured to use modules built and installed with earlier
7531versions of perl that were installed under $prefix. Specify here
7532the list of earlier versions that this version of perl should check.
7533If Configure detected no earlier versions of perl installed under
7534$prefix, then the list will be empty. Answer 'none' to tell perl
7535to not search earlier versions.
7536
7537The default should almost always be sensible, so if you're not sure,
7538just accept the default.
7539EOM
7540
7541rp='List of earlier versions to include in @INC?'
7542. ./myread
7543case "$ans" in
7544[Nn]one|''|' ') inc_version_list=' ' ;;
7545*) inc_version_list="$ans" ;;
7546esac
7547case "$inc_version_list" in
7548''|' ')
7549 inc_version_list_init='0';;
7550*) inc_version_list_init=`echo $inc_version_list |
7551 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7552 ;;
7553esac
7554$rm -f getverlist
7555
7556: determine whether to install perl also as /usr/bin/perl
7557
7558echo " "
7559if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7560 $cat <<EOM
7561Many scripts expect perl to be installed as /usr/bin/perl.
5e366f65
JH
7562
7563If you want to, I can install the perl you are about to compile
7564as /usr/bin/perl (in addition to $bin/perl).
b4eb6b3d 7565EOM
5e366f65
JH
7566 if test -f /usr/bin/perl; then
7567 $cat <<EOM
7568
7569However, please note that because you already have a /usr/bin/perl,
7570overwriting that with a new Perl would very probably cause problems.
7571Therefore I'm assuming you don't want to do that (unless you insist).
7572
7573EOM
7574 case "$installusrbinperl" in
7575 "$define"|[yY]*) dflt='y';;
2d736872 7576 *) dflt='n';;
5e366f65
JH
7577 esac
7578 else
7579 $cat <<EOM
7580
2d736872 7581Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
5e366f65
JH
7582
7583EOM
7584 case "$installusrbinperl" in
7585 "$undef"|[nN]*) dflt='n';;
2d736872 7586 *) dflt='y';;
5e366f65 7587 esac
2d736872 7588 fi
b4eb6b3d
JH
7589 rp="Do you want to install perl as /usr/bin/perl?"
7590 . ./myread
7591 case "$ans" in
7592 [yY]*) val="$define";;
7593 *) val="$undef" ;;
7594 esac
7595else
7596 val="$undef"
7597fi
7598set installusrbinperl
7599eval $setvar
7600
7601: see if dld is available
7602set dld.h i_dld
7603eval $inhdr
7604
7605: see if dlopen exists
7606xxx_runnm="$runnm"
7607runnm=false
7608set dlopen d_dlopen
7609eval $inlibc
7610runnm="$xxx_runnm"
7611
7612: determine which dynamic loading, if any, to compile in
7613echo " "
7614dldir="ext/DynaLoader"
7615case "$usedl" in
7616$define|y|true)
7617 dflt='y'
7618 usedl="$define"
7619 ;;
7620$undef|n|false)
7621 dflt='n'
7622 usedl="$undef"
7623 ;;
7624*)
7625 dflt='n'
7626 case "$d_dlopen" in
7627 $define) dflt='y' ;;
7628 esac
7629 case "$i_dld" in
7630 $define) dflt='y' ;;
7631 esac
7632 : Does a dl_xxx.xs file exist for this operating system
7633 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7634 ;;
7635esac
7636rp="Do you wish to use dynamic loading?"
7637. ./myread
7638usedl="$ans"
7639case "$ans" in
7640y*) usedl="$define"
7641 case "$dlsrc" in
7642 '')
7643 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7644 dflt="$dldir/dl_${osname}.xs"
7645 elif $test "$d_dlopen" = "$define" ; then
7646 dflt="$dldir/dl_dlopen.xs"
7647 elif $test "$i_dld" = "$define" ; then
7648 dflt="$dldir/dl_dld.xs"
7649 else
7650 dflt=''
7651 fi
7652 ;;
7653 *) dflt="$dldir/$dlsrc"
7654 ;;
7655 esac
7656 echo "The following dynamic loading files are available:"
7657 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7658 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7659 rp="Source file to use for dynamic loading"
7660 fn="fne"
7661 gfpth="$src"
7662 . ./getfile
7663 usedl="$define"
7664 : emulate basename
7665 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7666
7667 $cat << EOM
7668
7669Some systems may require passing special flags to $cc -c to
7670compile modules that will be used to create a shared library.
7671To use no flags, say "none".
7672
7673EOM
7674 case "$cccdlflags" in
7675 '') case "$gccversion" in
7676 '') case "$osname" in
7677 hpux) dflt='+z' ;;
7678 next) dflt='none' ;;
7679 irix*) dflt='-KPIC' ;;
48bcfe03 7680 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7681 sunos) dflt='-pic' ;;
7682 *) dflt='none' ;;
7683 esac
7684 ;;
7685 *) case "$osname" in
b6cc0f4c 7686 darwin) dflt='none' ;;
48bcfe03 7687 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7688 *) dflt='-fpic' ;;
7689 esac ;;
7690 esac ;;
7691 ' ') dflt='none' ;;
7692 *) dflt="$cccdlflags" ;;
7693 esac
7694 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7695 . ./myread
7696 case "$ans" in
7697 none) cccdlflags=' ' ;;
7698 *) cccdlflags="$ans" ;;
7699 esac
7700
7701 cat << EOM
7702
7703Some systems use ld to create libraries that can be dynamically loaded,
7704while other systems (such as those using ELF) use $cc.
7705
7706EOM
7707 case "$ld" in
7708 '') $cat >try.c <<'EOM'
7709/* Test for whether ELF binaries are produced */
7710#include <fcntl.h>
7711#include <stdlib.h>
7712int main() {
7713 char b[4];
7714 int i = open("a.out",O_RDONLY);
7715 if(i == -1)
7716 exit(1); /* fail */
7717 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7718 exit(0); /* succeed (yes, it's ELF) */
7719 else
7720 exit(1); /* fail */
7721}
7722EOM
5440bc8e 7723 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7724 cat <<EOM
7725You appear to have ELF support. I'll use $cc to build dynamic libraries.
7726EOM
7727 dflt="$cc"
7728 else
7729 echo "I'll use ld to build dynamic libraries."
7730 dflt='ld'
7731 fi
7732 rm -f try.c a.out
7733 ;;
7734 *) dflt="$ld"
7735 ;;
7736 esac
7737
7738 rp="What command should be used to create dynamic libraries?"
7739 . ./myread
7740 ld="$ans"
7741
7742 cat << EOM
7743
7744Some systems may require passing special flags to $ld to create a
7745library that can be dynamically loaded. If your ld flags include
7746-L/other/path options to locate libraries outside your loader's normal
7747search path, you may need to specify those -L options here as well. To
7748use no flags, say "none".
7749
7750EOM
7751 case "$lddlflags" in
7752 '') case "$osname" in
7753 beos) dflt='-nostart' ;;
7754 hpux) dflt='-b';
7755 case "$gccversion" in
7756 '') dflt="$dflt +vnocompatwarnings" ;;
7757 esac
7758 ;;
7759 linux|irix*) dflt='-shared' ;;
7760 next) dflt='none' ;;
7761 solaris) dflt='-G' ;;
7762 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7763 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7764 *) dflt='none' ;;
7765 esac
7766 ;;
7767 *) dflt="$lddlflags" ;;
7768 esac
7769
7770 : Try to guess additional flags to pick up local libraries.
7771 : Be careful not to append to a plain 'none'
7772 case "$dflt" in
7773 none) dflt='' ;;
7774 esac
7775 for thisflag in $ldflags; do
7776 case "$thisflag" in
b5b9f165 7777 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7778 case " $dflt " in
7779 *" $thisflag "*) ;;
7780 *) dflt="$dflt $thisflag" ;;
7781 esac
7782 ;;
7783 esac
7784 done
7785
7786 case "$dflt" in
7787 ''|' ') dflt='none' ;;
7788 esac
7789
7790 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7791 . ./myread
7792 case "$ans" in
7793 none) lddlflags=' ' ;;
7794 *) lddlflags="$ans" ;;
7795 esac
7796
7797 cat <<EOM
7798
7799Some systems may require passing special flags to $cc to indicate that
7800the resulting executable will use dynamic linking. To use no flags,
7801say "none".
7802
7803EOM
7804 case "$ccdlflags" in
7805 '') case "$osname" in
7806 hpux) dflt='-Wl,-E' ;;
7807 linux) dflt='-rdynamic' ;;
7808 next) dflt='none' ;;
7809 sunos) dflt='none' ;;
7810 *) dflt='none' ;;
7811 esac ;;
7812 ' ') dflt='none' ;;
7813 *) dflt="$ccdlflags" ;;
7814 esac
7815 rp="Any special flags to pass to $cc to use dynamic linking?"
7816 . ./myread
7817 case "$ans" in
7818 none) ccdlflags=' ' ;;
7819 *) ccdlflags="$ans" ;;
7820 esac
7821 ;;
7822*) usedl="$undef"
7823 ld='ld'
7824 dlsrc='dl_none.xs'
7825 lddlflags=''
7826 ccdlflags=''
7827 ;;
7828esac
7829
7830also=''
7831case "$usedl" in
7832$undef)
7833 # No dynamic loading being used, so don't bother even to prompt.
7834 useshrplib='false'
7835 ;;
7836*) case "$useshrplib" in
7837 '') case "$osname" in
48bcfe03 7838 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7839 dflt=y
7840 also='Building a shared libperl is required for dynamic loading to work on your system.'
7841 ;;
7842 next*)
7843 case "$osvers" in
7844 4*) dflt=y
7845 also='Building a shared libperl is needed for MAB support.'
7846 ;;
7847 *) dflt=n
7848 ;;
7849 esac
7850 ;;
7851 *) dflt=n
7852 ;;
7853 esac
7854 ;;
7855 $define|true|[Yy]*)
7856 dflt=y
7857 ;;
7858 *) dflt=n
7859 ;;
7860 esac
7861 $cat << EOM
7862
7863The perl executable is normally obtained by linking perlmain.c with
7864libperl${_a}, any static extensions (usually just DynaLoader), and
7865any other libraries needed on this system (such as -lm, etc.). Since
7866your system supports dynamic loading, it is probably possible to build
7867a shared libperl.$so. If you will have more than one executable linked
7868to libperl.$so, this will significantly reduce the size of each
7869executable, but it may have a noticeable affect on performance. The
7870default is probably sensible for your system.
7871$also
7872
7873EOM
7874 rp="Build a shared libperl.$so (y/n)"
7875 . ./myread
7876 case "$ans" in
7877 true|$define|[Yy]*)
7878 useshrplib='true' ;;
7879 *) useshrplib='false' ;;
7880 esac
7881 ;;
7882esac
7883
7884case "$useshrplib" in
7885true)
7886 case "$libperl" in
7887 '')
7888 # Figure out a good name for libperl.so. Since it gets stored in
7889 # a version-specific architecture-dependent library, the version
7890 # number isn't really that important, except for making cc/ld happy.
7891 #
7892 # A name such as libperl.so.3.1
7893 majmin="libperl.$so.$patchlevel.$subversion"
7894 # A name such as libperl.so.301
7895 majonly=`echo $patchlevel $subversion |
7896 $awk '{printf "%d%02d", $1, $2}'`
7897 majonly=libperl.$so.$majonly
7898 # I'd prefer to keep the os-specific stuff here to a minimum, and
7899 # rely on figuring it out from the naming of libc.
7900 case "${osname}${osvers}" in
7901 next4*)
7902 dflt=libperl.5.$so
7903 # XXX How handle the --version stuff for MAB?
7904 ;;
7905 linux*) # ld won't link with a bare -lperl otherwise.
7906 dflt=libperl.$so
7907 ;;
b53432e4
GH
7908 cygwin*) # ld links against an importlib
7909 dflt=libperl$lib_ext
b4eb6b3d
JH
7910 ;;
7911 *) # Try to guess based on whether libc has major.minor.
7912 case "$libc" in
7913 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7914 *libc.$so.[0-9]*) dflt=$majonly ;;
7915 *) dflt=libperl.$so ;;
7916 esac
7917 ;;
7918 esac
7919 ;;
7920 *) dflt=$libperl
7921 ;;
7922 esac
7923 cat << EOM
7924
7925I need to select a good name for the shared libperl. If your system uses
7926library names with major and minor numbers, then you might want something
7927like $majmin. Alternatively, if your system uses a single version
7928number for shared libraries, then you might want to use $majonly.
7929Or, your system might be quite happy with a simple libperl.$so.
7930
7931Since the shared libperl will get installed into a version-specific
7932architecture-dependent directory, the version number of the shared perl
7933library probably isn't important, so the default should be o.k.
7934
7935EOM
7936 rp='What name do you want to give to the shared libperl?'
7937 . ./myread
7938 libperl=$ans
7939 echo "Ok, I'll use $libperl"
7940 ;;
7941*)
7942 libperl="libperl${_a}"
7943 ;;
7944esac
7945
7946# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7947case "$shrpdir" in
7948'') ;;
7949*) $cat >&4 <<EOM
7950WARNING: Use of the shrpdir variable for the installation location of
7951the shared $libperl is not supported. It was never documented and
7952will not work in this version. Let me (perlbug@perl.org)
7953know of any problems this may cause.
7954
7955EOM
7956 case "$shrpdir" in
7957 "$archlibexp/CORE")
7958 $cat >&4 <<EOM
7959But your current setting of $shrpdir is
7960the default anyway, so it's harmless.
7961EOM
7962 ;;
7963 *)
7964 $cat >&4 <<EOM
7965Further, your current attempted setting of $shrpdir
7966conflicts with the value of $archlibexp/CORE
7967that installperl will use.
7968EOM
7969 ;;
7970 esac
7971 ;;
7972esac
7973
7974# How will the perl executable find the installed shared $libperl?
7975# Add $xxx to ccdlflags.
7976# If we can't figure out a command-line option, use $shrpenv to
7977# set env LD_RUN_PATH. The main perl makefile uses this.
7978shrpdir=$archlibexp/CORE
7979xxx=''
7980tmp_shrpenv=''
7981if "$useshrplib"; then
7982 case "$osname" in
7983 aix)
7984 # We'll set it in Makefile.SH...
7985 ;;
b5b9f165 7986 solaris)
b4eb6b3d
JH
7987 xxx="-R $shrpdir"
7988 ;;
32b2ae02 7989 freebsd|netbsd|openbsd)
b4eb6b3d
JH
7990 xxx="-Wl,-R$shrpdir"
7991 ;;
6b20d41b 7992 bsdos|linux|irix*|dec_osf)
b4eb6b3d
JH
7993 xxx="-Wl,-rpath,$shrpdir"
7994 ;;
7995 next)
7996 # next doesn't like the default...
7997 ;;
7998 beos)
7999 # beos doesn't like the default, either.
8000 ;;
8001 hpux*)
8002 # hpux doesn't like the default, either.
8003 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8004 ;;
8005 *)
8006 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8007 ;;
8008 esac
8009 case "$xxx" in
8010 '') ;;
8011 *)
8012 # Only add $xxx if it isn't already in ccdlflags.
8013 case " $ccdlflags " in
8014 *" $xxx "*) ;;
8015 *) ccdlflags="$ccdlflags $xxx"
8016 cat <<EOM >&4
8017
8018Adding $xxx to the flags
8019passed to $ld so that the perl executable will find the
8020installed shared $libperl.
8021
8022EOM
8023 ;;
8024 esac
8025 ;;
8026 esac
8027fi
8028# Fix ccdlflags in AIX for building external extensions.
8029# (For building Perl itself bare -bE:perl.exp is needed,
8030# Makefile.SH takes care of this.)
8031case "$osname" in
8032aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8033esac
8034# Respect a hint or command-line value.
8035case "$shrpenv" in
8036'') shrpenv="$tmp_shrpenv" ;;
8037esac
8038case "$ldlibpthname" in
8039'') ldlibpthname=LD_LIBRARY_PATH ;;
8040none) ldlibpthname='' ;;
8041esac
8042
8043: determine where manual pages are on this system
8044echo " "
8045case "$sysman" in
8046'')
4a0a3829
SD
8047 syspath='/usr/share/man/man1 /usr/man/man1'
8048 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8049 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8050 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8051 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8052 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8053 sysman=`./loc . /usr/man/man1 $syspath`
8054 ;;
8055esac
8056if $test -d "$sysman"; then
8057 echo "System manual is in $sysman." >&4
8058else
8059 echo "Could not find manual pages in source form." >&4
8060fi
8061
8062: determine where manual pages go
8063set man1dir man1dir none
8064eval $prefixit
8065$cat <<EOM
8066
8067$spackage has manual pages available in source form.
8068EOM
8069case "$nroff" in
8070nroff)
8071 echo "However, you don't have nroff, so they're probably useless to you."
8072 case "$man1dir" in
8073 '') man1dir="none";;
8074 esac;;
8075esac
8076echo "If you don't want the manual sources installed, answer 'none'."
8077case "$man1dir" in
8078' ') dflt=none
8079 ;;
8080'')
4a0a3829
SD
8081 lookpath="$prefixexp/share/man/man1"
8082 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8083 lookpath="$lookpath $prefixexp/man/p_man/man1"
8084 lookpath="$lookpath $prefixexp/man/u_man/man1"
8085 lookpath="$lookpath $prefixexp/man/man.1"
8086 case "$sysman" in
8087 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8088 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8089 esac
8090 set dflt
8091 eval $prefixup
8092 ;;
8093*) dflt="$man1dir"
8094 ;;
8095esac
8096echo " "
8097fn=dn+~
8098rp="Where do the main $spackage manual pages (source) go?"
8099. ./getfile
8100if $test "X$man1direxp" != "X$ansexp"; then
8101 installman1dir=''
8102fi
8103man1dir="$ans"
8104man1direxp="$ansexp"
8105case "$man1dir" in
8106'') man1dir=' '
8107 installman1dir='';;
8108esac
8109
8110: Change installation prefix, if necessary.
8111if $test X"$prefix" != X"$installprefix"; then
8112 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8113else
8114 installman1dir="$man1direxp"
8115fi
8116
8117: What suffix to use on installed man pages
8118
8119case "$man1dir" in
8120' ')
8121 man1ext='0'
8122 ;;
8123*)
8124 rp="What suffix should be used for the main $spackage man pages?"
8125 case "$man1ext" in
8126 '') case "$man1dir" in
8127 *1) dflt=1 ;;
8128 *1p) dflt=1p ;;
8129 *1pm) dflt=1pm ;;
8130 *l) dflt=l;;
8131 *n) dflt=n;;
8132 *o) dflt=o;;
8133 *p) dflt=p;;
8134 *C) dflt=C;;
8135 *L) dflt=L;;
8136 *L1) dflt=L1;;
8137 *) dflt=1;;
8138 esac
8139 ;;
8140 *) dflt="$man1ext";;
8141 esac
8142 . ./myread
8143 man1ext="$ans"
8144 ;;
8145esac
8146
8147: see if we can have long filenames
8148echo " "
8149first=123456789abcdef
8150$rm -f $first
8151if (echo hi >$first) 2>/dev/null; then
8152 if $test -f 123456789abcde; then
8153 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8154 val="$undef"
8155 else
8156 echo 'You can have filenames longer than 14 characters.'>&4
8157 val="$define"
8158 fi
8159else
8160 $cat <<'EOM'
8161You can't have filenames longer than 14 chars.
8162You can't even think about them!
8163EOM
8164 val="$undef"
8165fi
8166set d_flexfnam
8167eval $setvar
8168$rm -rf 123456789abcde*
8169
8170: determine where library module manual pages go
8171set man3dir man3dir none
8172eval $prefixit
8173$cat <<EOM
8174
8175$spackage has manual pages for many of the library modules.
8176EOM
8177
8178case "$nroff" in
8179nroff)
8180 $cat <<'EOM'
8181However, you don't have nroff, so they're probably useless to you.
8182EOM
8183 case "$man3dir" in
8184 '') man3dir="none";;
8185 esac;;
8186esac
8187
8188case "$d_flexfnam" in
8189undef)
8190 $cat <<'EOM'
8191However, your system can't handle the long file names like File::Basename.3.
8192EOM
8193 case "$man3dir" in
8194 '') man3dir="none";;
8195 esac;;
8196esac
8197
8198echo "If you don't want the manual sources installed, answer 'none'."
8199prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8200case "$man3dir" in
8201'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8202 if $test -d "$privlib/man/man3"; then
8203 cat <<EOM >&4
8204
8205WARNING: Previous versions of perl installed man3 pages into
8206$privlib/man/man3. This version will suggest a
8207new default of $dflt.
8208EOM
8209 tdflt=$dflt
8210 dflt='n'
8211 rp='Do you wish to preserve the old behavior?(y/n)'
8212 . ./myread
8213 case "$ans" in
8214 y*) dflt="$privlib/man/man3" ;;
8215 *) dflt=$tdflt ;;
8216 esac
8217 fi
8218 ;;
8219*) dflt="$man3dir" ;;
8220esac
8221case "$dflt" in
8222' ') dflt=none ;;
8223esac
8224echo " "
8225fn=dn+~
8226rp="Where do the $package library man pages (source) go?"
8227. ./getfile
8228man3dir="$ans"
8229man3direxp="$ansexp"
8230case "$man3dir" in
8231'') man3dir=' '
8232 installman3dir='';;
8233esac
8234
8235: Change installation prefix, if necessary.
8236if $test X"$prefix" != X"$installprefix"; then
8237 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8238else
8239 installman3dir="$man3direxp"
8240fi
8241
8242: What suffix to use on installed man pages
8243case "$man3dir" in
8244' ')
8245 man3ext='0'
8246 ;;
8247*)
8248 rp="What suffix should be used for the $package library man pages?"
8249 case "$man3ext" in
8250 '') case "$man3dir" in
8251 *3) dflt=3 ;;
8252 *3p) dflt=3p ;;
8253 *3pm) dflt=3pm ;;
8254 *l) dflt=l;;
8255 *n) dflt=n;;
8256 *o) dflt=o;;
8257 *p) dflt=p;;
8258 *C) dflt=C;;
8259 *L) dflt=L;;
8260 *L3) dflt=L3;;
8261 *) dflt=3;;
8262 esac
8263 ;;
8264 *) dflt="$man3ext";;
8265 esac
8266 . ./myread
8267 man3ext="$ans"
8268 ;;
8269esac
8270
8271: see if we have to deal with yellow pages, now NIS.
0384a54a 8272if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8273 if $test -f /usr/etc/nibindd; then
8274 echo " "
8275 echo "I'm fairly confident you're on a NeXT."
8276 echo " "
8277 rp='Do you get the hosts file via NetInfo?'
8278 dflt=y
8279 case "$hostcat" in
8280 nidump*) ;;
8281 '') ;;
8282 *) dflt=n;;
8283 esac
8284 . ./myread
8285 case "$ans" in
8286 y*) hostcat='nidump hosts .';;
8287 *) case "$hostcat" in
8288 nidump*) hostcat='';;
8289 esac
8290 ;;
8291 esac
8292 fi
8293 case "$hostcat" in
8294 nidump*) ;;
8295 *)
8296 case "$hostcat" in
8297 *ypcat*) dflt=y;;
8298 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8299 dflt=y
8300 else
8301 dflt=n
8302 fi;;
8303 *) dflt=n;;
8304 esac
8305 echo " "
8306 rp='Are you getting the hosts file via yellow pages?'
8307 . ./myread
8308 case "$ans" in
8309 y*) hostcat='ypcat hosts';;
8310 *) hostcat='cat /etc/hosts';;
8311 esac
8312 ;;
8313 esac
8314fi
8315case "$hostcat" in
8316'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8317esac
8318case "$groupcat" in
8319'') test -f /etc/group && groupcat='cat /etc/group';;
8320esac
8321case "$passcat" in
8322'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8323esac
8324
8325: now get the host name
8326echo " "
8327echo "Figuring out host name..." >&4
8328case "$myhostname" in
8329'') cont=true
8330 echo 'Maybe "hostname" will work...'
73614538 8331 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8332 myhostname=$tans
8333 phostname=hostname
8334 cont=''
8335 fi
8336 ;;
8337*) cont='';;
8338esac
8339if $test "$cont"; then
8340 if ./xenix; then
8341 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8342 if tans=`cat /etc/systemid 2>&1` ; then
8343 myhostname=$tans
8344 phostname='cat /etc/systemid'
8345 echo "Whadyaknow. Xenix always was a bit strange..."
8346 cont=''
8347 fi
8348 elif $test -r /etc/systemid; then
8349 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8350 fi
8351fi
8352if $test "$cont"; then
8353 echo 'No, maybe "uuname -l" will work...'
73614538 8354 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8355 myhostname=$tans
8356 phostname='uuname -l'
8357 else
8358 echo 'Strange. Maybe "uname -n" will work...'
73614538 8359 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8360 myhostname=$tans
8361 phostname='uname -n'
8362 else
8363 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8364 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8365 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8366 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8367 else
8368 case "$myhostname" in
8369 '') echo "Does this machine have an identity crisis or something?"
8370 phostname='';;
8371 *)
8372 echo "Well, you said $myhostname before..."
8373 phostname='echo $myhostname';;
8374 esac
8375 fi
8376 fi
8377 fi
8378fi
52a549d0
JH
8379case "$myhostname" in
8380'') myhostname=noname ;;
8381esac
b4eb6b3d
JH
8382: you do not want to know about this
8383set $myhostname
8384myhostname=$1
8385
8386: verify guess
8387if $test "$myhostname" ; then
8388 dflt=y
8389 rp='Your host name appears to be "'$myhostname'".'" Right?"
8390 . ./myread
8391 case "$ans" in
8392 y*) ;;
8393 *) myhostname='';;
8394 esac
8395fi
8396
8397: bad guess or no guess
8398while $test "X$myhostname" = X ; do
8399 dflt=''
8400 rp="Please type the (one word) name of your host:"
8401 . ./myread
8402 myhostname="$ans"
8403done
8404
8405: translate upper to lower if necessary
8406case "$myhostname" in
8407*[A-Z]*)
8408 echo "(Normalizing case in your host name)"
8409 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8410 ;;
8411esac
8412
8413case "$myhostname" in
8414*.*)
8415 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8416 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8417 echo "(Trimming domain name from host name--host name is now $myhostname)"
8418 ;;
8419*) case "$mydomain" in
8420 '')
8421 {
8422 test "X$hostcat" = "Xypcat hosts" &&
8423 ypmatch "$myhostname" hosts 2>/dev/null |\
8424 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8425 $test -s hosts
8426 } || {
8427 test "X$hostcat" != "X" &&
8428 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8429 /[ ]$myhostname[ . ]/p" > hosts
8430 }
8431 tmp_re="[ . ]"
f08cbdd1
PP
8432 if $test -f hosts; then
8433 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8434 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8435 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8436 hosts | $sort | $uniq | \
8437 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8438 case `$echo X$dflt` in
8439 X*\ *) echo "(Several hosts in the database matched hostname)"
8440 dflt=.
8441 ;;
8442 X.) echo "(You do not have fully-qualified names in the hosts database)"
8443 ;;
8444 esac
8445 else
8446 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8447 dflt=.
f08cbdd1 8448 fi
b4eb6b3d
JH
8449 case "$dflt" in
8450 .)
8451 tans=`./loc resolv.conf X /etc /usr/etc`
8452 if $test -f "$tans"; then
8453 echo "(Attempting domain name extraction from $tans)"
8454 dflt=.`$sed -n -e 's/ / /g' \
8455 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8456 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8457 case "$dflt" in
8458 .) dflt=.`$sed -n -e 's/ / /g' \
8459 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8460 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8461 ;;
8462 esac
8463 fi
8464 ;;
8465 esac
8466 case "$dflt" in
8467 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8468 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8469 case "$dflt" in
8470 '') dflt='.';;
8471 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8472 esac
8473 ;;
8474 esac
59c9e5d6
PP
8475 case "$dflt$osname" in
8476 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8477 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8478 ;;
8479 esac
b4eb6b3d
JH
8480 case "$dflt" in
8481 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8482 dflt='.nonet'
b4eb6b3d
JH
8483 ;;
8484 esac
8485 $rm -f hosts
8486 ;;
8487 *) dflt="$mydomain";;
8488 esac;;
8489esac
8490echo " "
8491rp="What is your domain name?"
8492. ./myread
8493tans="$ans"
8494case "$ans" in
8495'') ;;
8496.*) ;;
8497*) tans=".$tans";;
8498esac
8499mydomain="$tans"
8500
8501: translate upper to lower if necessary
8502case "$mydomain" in
8503*[A-Z]*)
8504 echo "(Normalizing case in your domain name)"
8505 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8506 ;;
8507esac
8508
8509: a little sanity check here
8510case "$phostname" in
8511'') ;;
8512*)
8513 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8514 $myhostname$mydomain|$myhostname) ;;
8515 *)
8516 case "$phostname" in
8517 sed*)
8518 echo "(That doesn't agree with your whoami.h file, by the way.)"
8519 ;;
8520 *)
8521 echo "(That doesn't agree with your $phostname command, by the way.)"
8522 ;;
8523 esac
8524 ;;
8525 esac
8526 ;;
8527esac
8528
8529$cat <<EOM
8530
8531I need to get your e-mail address in Internet format if possible, i.e.
8532something like user@host.domain. Please answer accurately since I have
8533no easy means to double check it. The default value provided below
8534is most probably close to reality but may not be valid from outside
8535your organization...
8536
8537EOM
8538cont=x
8539while test "$cont"; do
8540 case "$cf_email" in
8541 '') dflt="$cf_by@$myhostname$mydomain";;
8542 *) dflt="$cf_email";;
8543 esac
8544 rp='What is your e-mail address?'
8545 . ./myread
8546 cf_email="$ans"
8547 case "$cf_email" in
8548 *@*.*) cont='' ;;
8549 *)
8550 rp='Address does not look like an Internet one. Use it anyway?'
8551 case "$fastread" in
8552 yes) dflt=y ;;
8553 *) dflt=n ;;
8554 esac
8555 . ./myread
8556 case "$ans" in
8557 y*) cont='' ;;
8558 *) echo " " ;;
8559 esac
8560 ;;
8561 esac
8562done
8563
8564$cat <<EOM
8565
8566If you or somebody else will be maintaining perl at your site, please
8567fill in the correct e-mail address here so that they may be contacted
8568if necessary. Currently, the "perlbug" program included with perl
8569will send mail to this address in addition to perlbug@perl.org. You may
8570enter "none" for no administrator.
8571
8572EOM
8573case "$perladmin" in
8574'') dflt="$cf_email";;
8575*) dflt="$perladmin";;
8576esac
8577rp='Perl administrator e-mail address'
8578. ./myread
8579perladmin="$ans"
8580
674912d7
RB
8581: determine whether to only install version-specific parts.
8582echo " "
8583$cat <<EOM
8584Do you want to install only the version-specific parts of the perl
8585distribution? Usually you do *not* want to do this.
8586EOM
8587case "$versiononly" in
8588"$define"|[Yy]*|true) dflt='y' ;;
8589*) dflt='n';
8590esac
8591rp="Do you want to install only the version-specific parts of perl?"
8592. ./myread
8593case "$ans" in
8594[yY]*) val="$define";;
8595*) val="$undef" ;;
8596esac
8597set versiononly
8598eval $setvar
8599
ad493445
MB
8600case "$versiononly" in
8601"$define") inc_version_list=''
8602 inc_version_list_init=0
8603 ;;
8604esac
8605
b4eb6b3d
JH
8606: figure out how to guarantee perl startup
8607case "$startperl" in
8608'')
8609 case "$sharpbang" in
8610 *!)
8611 $cat <<EOH
8612
8613I can use the #! construct to start perl on your system. This will
8614make startup of perl scripts faster, but may cause problems if you
8615want to share those scripts and perl is not in a standard place
8616($binexp/perl) on all your platforms. The alternative is to force
8617a shell by starting the script with a single ':' character.
8618
8619EOH
674912d7
RB
8620 case "$versiononly" in
8621 "$define") dflt="$binexp/perl$version";;
8622 *) dflt="$binexp/perl";;
8623 esac
b4eb6b3d
JH
8624 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8625 . ./myread
8626 case "$ans" in
8627 none) startperl=": # use perl";;
8628 *) startperl="#!$ans"
8629 if $test 30 -lt `echo "$ans" | wc -c`; then
8630 $cat >&4 <<EOM
8631
8632WARNING: Some systems limit the #! command to 32 characters.
8633If you experience difficulty running Perl scripts with #!, try
8634installing Perl in a directory with a shorter pathname.
8635
8636EOM
8637 fi ;;
8638 esac
8639 ;;
8640 *) startperl=": # use perl"
8641 ;;
8642 esac
8643 ;;
8644esac
8645echo "I'll use $startperl to start perl scripts."
8646
8647: figure best path for perl in scripts
8648case "$perlpath" in
8649'')
5e20a8ca
RGS
8650 case "$versiononly" in
8651 "$define") perlpath="$binexp/perl$version";;
8652 *) perlpath="$binexp/perl";;
8653 esac
b4eb6b3d
JH
8654 case "$startperl" in
8655 *!*) ;;
8656 *)
8657 $cat <<EOH
8658
8659I will use the "eval 'exec'" idiom to start Perl on your system.
8660I can use the full path of your Perl binary for this purpose, but
8661doing so may cause problems if you want to share those scripts and
8662Perl is not always in a standard place ($binexp/perl).
8663
8664EOH
8665 dflt="$binexp/perl"
8666 rp="What path shall I use in \"eval 'exec'\"?"
8667 . ./myread
8668 perlpath="$ans"
8669 ;;
8670 esac
8671 ;;
8672esac
8673case "$startperl" in
8674*!*) ;;
8675*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8676esac
8677
8678: determine where public executable scripts go
8679set scriptdir scriptdir
8680eval $prefixit
8681case "$scriptdir" in
8682'')
8683 dflt="$bin"
8684 : guess some guesses
8685 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8686 $test -d /usr/share/bin && dflt=/usr/share/bin
8687 $test -d /usr/local/script && dflt=/usr/local/script
8688 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8689 $test -d $prefixexp/script && dflt=$prefixexp/script
8690 set dflt
8691 eval $prefixup
8692 ;;
8693*) dflt="$scriptdir"
8694 ;;
8695esac
8696$cat <<EOM
8697
8698Some installations have a separate directory just for executable scripts so
8699that they can mount it across multiple architectures but keep the scripts in
8700one spot. You might, for example, have a subdirectory of /usr/share for this.
8701Or you might just lump your scripts in with all your other executables.
8702
8703EOM
8704fn=d~
8705rp='Where do you keep publicly executable scripts?'
8706. ./getfile
8707if $test "X$ansexp" != "X$scriptdirexp"; then
8708 installscript=''
8709fi
8710scriptdir="$ans"
8711scriptdirexp="$ansexp"
8712: Change installation prefix, if necessary.
8713if $test X"$prefix" != X"$installprefix"; then
8714 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8715else
8716 installscript="$scriptdirexp"
8717fi
8718
8719: determine where add-on public executables go
8720case "$sitebin" in
8721'') dflt=$siteprefix/bin ;;
8722*) dflt=$sitebin ;;
8723esac
8724fn=d~
8725rp='Pathname where the add-on public executables should be installed?'
8726. ./getfile
8727sitebin="$ans"
8728sitebinexp="$ansexp"
8729: Change installation prefix, if necessary.
8730if $test X"$prefix" != X"$installprefix"; then
8731 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8732else
8733 installsitebin="$sitebinexp"
8734fi
8735
6e1038e0
MB
8736: determine where add-on html pages go
8737: There is no standard location, so try to copy the previously-selected
8738: directory structure for the core html pages.
8739case "$sitehtml1" in
8740'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8741*) dflt=$sitehtml1 ;;
8742esac
8743case "$dflt" in
8744''|' ') dflt=none ;;
8745esac
8746fn=dn+~
8747rp='Pathname where the site-specific html pages should be installed?'
8748. ./getfile
8749sitehtml1="$ans"
8750sitehtml1exp="$ansexp"
8751: Use ' ' for none so value is preserved next time through Configure
8752$test X"$sitehtml1" = "X" && sitehtml1=' '
8753: Change installation prefix, if necessary.
8754if $test X"$prefix" != X"$installprefix"; then
8755 installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8756else
8757 installsitehtml1="$sitehtml1exp"
8758fi
8759
8760: determine where add-on library html pages go
8761: There is no standard location, so try to copy the previously-selected
8762: directory structure for the core html pages.
8763case "$sitehtml3" in
8764'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8765*) dflt=$sitehtml3 ;;
8766esac
8767case "$dflt" in
8768''|' ') dflt=none ;;
8769esac
8770fn=dn+~
8771rp='Pathname where the site-specific library html pages should be installed?'
8772. ./getfile
8773sitehtml3="$ans"
8774sitehtml3exp="$ansexp"
8775: Use ' ' for none so value is preserved next time through Configure
8776$test X"$sitehtml3" = "X" && sitehtml3=' '
8777: Change installation prefix, if necessary.
8778if $test X"$prefix" != X"$installprefix"; then
8779 installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8780else
8781 installsitehtml3="$sitehtml3exp"
8782fi
8783
8784: determine where add-on manual pages go
8785case "$siteman1" in
8786'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8787*) dflt=$siteman1 ;;
8788esac
8789case "$dflt" in
8790''|' ') dflt=none ;;
8791esac
8792fn=dn+~
8793rp='Pathname where the site-specific manual pages should be installed?'
8794. ./getfile
8795siteman1="$ans"
8796siteman1exp="$ansexp"
8797: Use ' ' for none so value is preserved next time through Configure
8798$test X"$siteman1" = "X" && siteman1=' '
8799: Change installation prefix, if necessary.
8800if $test X"$prefix" != X"$installprefix"; then
8801 installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8802else
8803 installsiteman1="$siteman1exp"
8804fi
8805
8806: determine where add-on library man pages go
8807case "$siteman3" in
8808'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8809*) dflt=$siteman3 ;;
8810esac
8811case "$dflt" in
8812''|' ') dflt=none ;;
8813esac
8814fn=dn+~
8815rp='Pathname where the site-specific library manual pages should be installed?'
8816. ./getfile
8817siteman3="$ans"
8818siteman3exp="$ansexp"
8819: Use ' ' for none so value is preserved next time through Configure
8820$test X"$siteman3" = "X" && siteman3=' '
8821: Change installation prefix, if necessary.
8822if $test X"$prefix" != X"$installprefix"; then
8823 installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8824else
8825 installsiteman3="$siteman3exp"
8826fi
8827
8828: determine where add-on public executable scripts go
8829case "$sitescript" in
8830'') dflt=$siteprefix/script
8831 $test -d $dflt || dflt=$sitebin ;;
8832*) dflt="$sitescript" ;;
8833esac
8834fn=d~+
8835rp='Pathname where add-on public executable scripts should be installed?'
8836. ./getfile
8837sitescript="$ans"
8838sitescriptexp="$ansexp"
8839: Change installation prefix, if necessary.
8840if $test X"$prefix" != X"$installprefix"; then
8841 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8842else
8843 installsitescript="$sitescriptexp"
8844fi
8845
96056487
JH
8846: define an is-a-typedef? function
8847typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8848case "$inclist" in
8849"") inclist="sys/types.h";;
8850esac;
8851eval "varval=\$$var";
8852case "$varval" in
8853"")
8854 $rm -f temp.c;
8855 for inc in $inclist; do
8856 echo "#include <$inc>" >>temp.c;
8857 done;
8858 echo "#ifdef $type" >> temp.c;
8859 echo "printf(\"We have $type\");" >> temp.c;
8860 echo "#endif" >> temp.c;
8861 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8862 if $contains $type temp.E >/dev/null 2>&1; then
8863 eval "$var=\$type";
8864 else
8865 eval "$var=\$def";
8866 fi;
8867 $rm -f temp.?;;
8868*) eval "$var=\$varval";;
8869esac'
8870
8871: define an is-a-typedef? function that prompts if the type is not available.
8872typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8873case "$inclist" in
8874"") inclist="sys/types.h";;
8875esac;
8876eval "varval=\$$var";
8877case "$varval" in
8878"")
8879 $rm -f temp.c;
8880 for inc in $inclist; do
8881 echo "#include <$inc>" >>temp.c;
8882 done;
8883 echo "#ifdef $type" >> temp.c;
8884 echo "printf(\"We have $type\");" >> temp.c;
8885 echo "#endif" >> temp.c;
8886 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8887 echo " " ;
8888 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8889 if $contains $type temp.E >/dev/null 2>&1; then
8890 echo "$type found." >&4;
8891 eval "$var=\$type";
8892 else
8893 echo "$type NOT found." >&4;
8894 dflt="$def";
8895 . ./myread ;
8896 eval "$var=\$ans";
8897 fi;
8898 $rm -f temp.?;;
8899*) eval "$var=\$varval";;
8900esac'
8901
8902: see what type lseek is declared as in the kernel
8903rp="What is the type used for lseek's offset on this system?"
8904set off_t lseektype long stdio.h sys/types.h
8905eval $typedef_ask
8906
8907echo " "
8908echo "Checking to see how big your file offsets are..." >&4
8909$cat >try.c <<EOCP
8910#include <sys/types.h>
8911#include <stdio.h>
8912int main()
8913{
8914 printf("%d\n", (int)sizeof($lseektype));
8915 return(0);
8916}
8917EOCP
8918set try
8919if eval $compile_ok; then
8920 lseeksize=`$run ./try`
8921 echo "Your file offsets are $lseeksize bytes long."
8922else
8923 dflt=$longsize
8924 echo " "
8925 echo "(I can't seem to compile the test program. Guessing...)"
8926 rp="What is the size of your file offsets (in bytes)?"
8927 . ./myread
8928 lseeksize="$ans"
8929fi
8930$rm -f try.c try
8931
8932: see what type file positions are declared as in the library
8933rp="What is the type for file position used by fsetpos()?"
8934set fpos_t fpostype long stdio.h sys/types.h
8935eval $typedef_ask
8936
8937echo " "
8938case "$fpostype" in
8939*_t) zzz="$fpostype" ;;
8940*) zzz="fpos_t" ;;
8941esac
8942echo "Checking the size of $zzz..." >&4
8943cat > try.c <<EOCP
8944#include <sys/types.h>
8945#include <stdio.h>
8946int main() {
8947 printf("%d\n", (int)sizeof($fpostype));
8948 exit(0);
8949}
8950EOCP
8951set try
8952if eval $compile_ok; then
8953 yyy=`$run ./try`
8954 case "$yyy" in
8955 '') fpossize=4
8956 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8957 ;;
8958 *) fpossize=$yyy
8959 echo "Your $zzz is $fpossize bytes long."
8960 ;;
8961 esac
8962else
8963 dflt="$longsize"
8964 echo " " >&4
8965 echo "(I can't compile the test program. Guessing...)" >&4
8966 rp="What is the size of your file positions (in bytes)?"
8967 . ./myread
8968 fpossize="$ans"
8969fi
8970
8971
8972
8973# Backward compatibility (uselfs is deprecated).
8974case "$uselfs" in
8975"$define"|true|[yY]*)
8976 cat <<EOM >&4
8977
8978*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8979EOM
8980 uselargefiles="$define"
8981 ;;
8982esac
8983
8984case "$lseeksize:$fpossize" in
89858:8) cat <<EOM
8986
8987You can have files larger than 2 gigabytes.
8988EOM
8989 val="$define" ;;
8990*) case "$uselargefiles" in
8991 "$undef"|false|[nN]*) dflt='n' ;;
8992 *) dflt='y' ;;
8993 esac
8994 cat <<EOM
8995
8996Perl can be built to understand large files (files larger than 2 gigabytes)
8997on some systems. To do so, Configure can be run with -Duselargefiles.
8998
8999If this doesn't make any sense to you, just accept the default '$dflt'.
9000EOM
9001 rp='Try to understand large files, if available?'
9002 . ./myread
9003 case "$ans" in
9004 y|Y) val="$define" ;;
9005 *) val="$undef" ;;
9006 esac
9007 ;;
9008esac
9009set uselargefiles
9010eval $setvar
9011case "$uselargefiles" in
9012"$define")
9013: Look for a hint-file generated 'call-back-unit'. If the
9014: user has specified that a large files perl is to be built,
9015: we may need to set or change some other defaults.
9016 if $test -f uselargefiles.cbu; then
9017 echo "Your platform has some specific hints for large file builds, using them..."
9018 . ./uselargefiles.cbu
9019 echo " "
9020 echo "Rechecking to see how big your file offsets are..." >&4
9021 $cat >try.c <<EOCP
9022#include <sys/types.h>
9023#include <stdio.h>
9024int main()
9025{
9026 printf("%d\n", (int)sizeof($lseektype));
9027 return(0);
9028}
9029EOCP
9030 set try
9031 if eval $compile_ok; then
9032 lseeksize=`$run ./try`
9033 $echo "Your file offsets are now $lseeksize bytes long."
9034 else
9035 dflt="$lseeksize"
9036 echo " "
9037 echo "(I can't seem to compile the test program. Guessing...)"
9038 rp="What is the size of your file offsets (in bytes)?"
9039 . ./myread
9040 lseeksize="$ans"
9041 fi
9042 case "$fpostype" in
9043 *_t) zzz="$fpostype" ;;
9044 *) zzz="fpos_t" ;;
9045 esac
9046 $echo $n "Rechecking the size of $zzz...$c" >&4
9047 $cat > try.c <<EOCP
9048#include <sys/types.h>
9049#include <stdio.h>
9050int main() {
9051 printf("%d\n", (int)sizeof($fpostype));
9052 exit(0);
9053}
9054EOCP
9055 set try
9056 if eval $compile_ok; then
9057 yyy=`$run ./try`
9058 dflt="$lseeksize"
9059 case "$yyy" in
9060 '') echo " "
9061 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9062 ;;
9063 *) fpossize=$yyy
9064 echo " $fpossize bytes." >&4
9065 ;;
9066 esac
9067 else
9068 dflt="$fpossize"
9069 echo " "
9070 echo "(I can't compile the test program. Guessing...)" >&4
9071 rp="What is the size of your file positions (in bytes)?"
9072 . ./myread
9073 fpossize="$ans"
9074 fi
9075 $rm -f try.c try
9076 fi
9077 ;;
9078esac
9079
b4eb6b3d
JH
9080case "$vendorprefix" in
9081'') d_vendorbin="$undef"
9082 vendorbin=''
9083 vendorbinexp=''
9084 ;;
9085*) d_vendorbin="$define"
9086 : determine where vendor-supplied executables go.
9087 case "$vendorbin" in
9088 '') dflt=$vendorprefix/bin ;;
9089 *) dflt="$vendorbin" ;;
9090 esac
9091 fn=d~+
9092 rp='Pathname for the vendor-supplied executables directory?'
9093 . ./getfile
9094 vendorbin="$ans"
9095 vendorbinexp="$ansexp"
9096 ;;
9097esac
9098: Change installation prefix, if necessary.
9099if $test X"$prefix" != X"$installprefix"; then
9100 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9101else
9102 installvendorbin="$vendorbinexp"
9103fi
9104
6e1038e0
MB
9105case "$vendorprefix" in
9106'') vendorhtml1=''
9107 vendorhtml1exp=''
9108 ;;
9109*) : determine where vendor-supplied html pages go.
9110 : There is no standard location, so try to copy the previously-selected
9111 : directory structure for the core html pages.
9112 : XXX Better default suggestions would be welcome.
9113 case "$vendorhtml1" in
9114 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9115 *) dflt=$vendorhtml1 ;;
9116 esac
9117 case "$dflt" in
9118 ''|' ') dflt=none ;;
9119 esac
9120 fn=dn+~
9121 rp='Pathname for the vendor-supplied html pages?'
9122 . ./getfile
9123 vendorhtml1="$ans"
9124 vendorhtml1exp="$ansexp"
9125 ;;
9126esac
9127: Use ' ' for none so value is preserved next time through Configure
9128$test X"$vendorhtml1" = "X" && vendorhtml1=' '
9129: Change installation prefix, if necessary.
9130if $test X"$prefix" != X"$installprefix"; then
9131 installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9132else
9133 installvendorhtml1="$vendorhtml1exp"
9134fi
9135
9136case "$vendorprefix" in
9137'') vendorhtml3=''
9138 vendorhtml3exp=''
9139 ;;
9140*) : determine where vendor-supplied module html pages go.
9141 : There is no standard location, so try to copy the previously-selected
9142 : directory structure for the core html pages.
9143 : XXX Better default suggestions would be welcome.
9144 case "$vendorhtml3" in
9145 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9146 *) dflt=$vendorhtml3 ;;
9147 esac
9148 case "$dflt" in
9149 ''|' ') dflt=none ;;
9150 esac
9151 fn=dn+~
9152 rp='Pathname for the vendor-supplied html pages?'
9153 . ./getfile
9154 vendorhtml3="$ans"
9155 vendorhtml3exp="$ansexp"
9156 ;;
9157esac
9158: Use ' ' for none so value is preserved next time through Configure
9159$test X"$vendorhtml3" = "X" && vendorhtml3=' '
9160: Change installation prefix, if necessary.
9161if $test X"$prefix" != X"$installprefix"; then
9162 installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9163else
9164 installvendorhtml3="$vendorhtml3exp"
9165fi
9166
9167case "$vendorprefix" in
9168'') vendorman1=''
9169 vendorman1exp=''
9170 ;;
9171*) : determine where vendor-supplied manual pages go.
9172 case "$vendorman1" in
9173 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9174 *) dflt=$vendorman1 ;;
9175 esac
9176 case "$dflt" in
9177 ''|' ') dflt=none ;;
9178 esac
9179 fn=nd~+
9180 rp='Pathname for the vendor-supplied manual section 1 pages?'
9181 . ./getfile
9182 vendorman1="$ans"
9183 vendorman1exp="$ansexp"
9184 ;;
9185esac
9186: Use ' ' for none so value is preserved next time through Configure
9187$test X"$vendorman1" = "X" && vendorman1=' '
9188: Change installation prefix, if necessary.
9189if $test X"$prefix" != X"$installprefix"; then
9190 installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9191else
9192 installvendorman1="$vendorman1exp"
9193fi
9194
9195case "$vendorprefix" in
9196'') vendorman3=''
9197 vendorman3exp=''
9198 ;;
9199*) : determine where vendor-supplied module manual pages go.
9200 case "$vendorman3" in
9201 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9202 *) dflt=$vendorman3 ;;
9203 esac
9204 case "$dflt" in
9205 ''|' ') dflt=none ;;
9206 esac
9207 fn=nd~+
9208 rp='Pathname for the vendor-supplied manual section 3 pages?'
9209 . ./getfile
9210 vendorman3="$ans"
9211 vendorman3exp="$ansexp"
9212 ;;
9213esac
9214: Use ' ' for none so value is preserved next time through Configure
9215$test X"$vendorman3" = "X" && vendorman3=' '
9216: Change installation prefix, if necessary.
9217if $test X"$prefix" != X"$installprefix"; then
9218 installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9219else
9220 installvendorman3="$vendorman3exp"
9221fi
9222
9223case "$vendorprefix" in
9224'') d_vendorscript="$undef"
9225 vendorscript=''
9226 vendorscriptexp=''
9227 ;;
9228*) d_vendorscript="$define"
9229 : determine where vendor-supplied scripts go.
9230 case "$vendorscript" in
9231 '') dflt=$vendorprefix/script
9232 $test -d $dflt || dflt=$vendorbin ;;
9233 *) dflt="$vendorscript" ;;
9234 esac
9235 $cat <<EOM
9236
9237The installation process will create a directory for
9238vendor-supplied scripts.
9239
9240EOM
9241 fn=d~+
9242 rp='Pathname for the vendor-supplied scripts directory?'
9243 . ./getfile
9244 vendorscript="$ans"
9245 vendorscriptexp="$ansexp"
9246 ;;
9247esac
9248: Change installation prefix, if necessary.
9249if $test X"$prefix" != X"$installprefix"; then
9250 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9251else
9252 installvendorscript="$vendorscriptexp"
9253fi
9254
b4eb6b3d
JH
9255: see if qgcvt exists
9256set qgcvt d_qgcvt
9257eval $inlibc
9258
b4eb6b3d 9259: Check how to convert floats to strings.
a5b10d80
YST
9260
9261if test "X$d_Gconvert" = X; then
9262
b4eb6b3d
JH
9263echo " "
9264echo "Checking for an efficient way to convert floats to strings."
9265echo " " > try.c
9266case "$uselongdouble" in
9267"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9268esac
9269case "$d_longdbl" in
9270"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9271esac
9272case "$d_PRIgldbl" in
9273"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9274esac
9275$cat >>try.c <<EOP
9276#ifdef TRY_gconvert
9277#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9278char *myname = "gconvert";
9279#endif
9280#ifdef TRY_gcvt
9281#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9282char *myname = "gcvt";
9283#endif
9284#ifdef TRY_qgcvt
9285#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9286char *myname = "qgcvt";
9287#define DOUBLETYPE long double
9288#endif
9289#ifdef TRY_sprintf
a5b10d80
YST
9290#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9291#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9292#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9293#else
a5b10d80
YST
9294#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9295#endif
9296#else
b4eb6b3d
JH
9297#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9298#endif
9299char *myname = "sprintf";
9300#endif
9301
9302#ifndef DOUBLETYPE
9303#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9304#define DOUBLETYPE long double
9305#else
9306#define DOUBLETYPE double
9307#endif
9308#endif
9309
9310#include <stdio.h>
9311
9312#define I_STDLIB $i_stdlib
9313#ifdef I_STDLIB
9314#include <stdlib.h>
9315#endif
9316
9317int
9318checkit(expect, got)
9319char *expect;
9320char *got;
9321{
9322 if (strcmp(expect, got)) {
9323 printf("%s oddity: Expected %s, got %s\n",
9324 myname, expect, got);
9325 exit(1);
9326 }
9327}
9328
9329int main()
9330{
9331 char buf[64];
9332 buf[63] = '\0';
9333
9334 /* This must be 1st test on (which?) platform */
9335 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9336 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9337 checkit("0.1", buf);
9338
a5b10d80
YST
9339 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9340 checkit("0.01", buf);
9341
9342 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9343 checkit("0.001", buf);
9344
9345 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9346 checkit("0.0001", buf);
9347
9348 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9349 if (strlen(buf) > 5)
9350 checkit("9e-005", buf); /* for Microsoft ?? */
9351 else
9352 checkit("9e-05", buf);
9353
b4eb6b3d
JH
9354 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9355 checkit("1", buf);
9356
9357 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9358 checkit("1.1", buf);
9359
9360 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9361 checkit("1.01", buf);
9362
9363 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9364 checkit("1.001", buf);
9365
9366 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9367 checkit("1.0001", buf);
9368
9369 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9370 checkit("1.00001", buf);
9371
9372 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9373 checkit("1.000001", buf);
9374
9375 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9376 checkit("0", buf);
9377
9378 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9379 checkit("-1", buf);
9380
9381 /* Some Linux gcvt's give 1.e+5 here. */
9382 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9383 checkit("100000", buf);
9384
9385 /* Some Linux gcvt's give -1.e+5 here. */
9386 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9387 checkit("-100000", buf);
9388
9389 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9390 checkit("123.456", buf);
9391
ab6ca9f4 9392 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9393 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9394 /* 34 should be enough to scare even long double
9395 * places into using the e notation. */
ab6ca9f4 9396 if (strlen(buf) > 5)
94b339ad 9397 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9398 else
94b339ad 9399 checkit("1e+34", buf);
8e2a5ede 9400
d1eb8299
YST
9401 /* For Perl, if you add additional tests here, also add them to
9402 * t/base/num.t for benefit of platforms not using Configure or
9403 * overriding d_Gconvert */
9404
b4eb6b3d
JH
9405 exit(0);
9406}
9407EOP
ab6ca9f4 9408: first add preferred functions to our list
a5b10d80 9409xxx_list=""
ab6ca9f4 9410for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9411 case $xxx_convert in
9412 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9413 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9414 esac
9415done
9416: then add any others
9417for xxx_convert in gconvert gcvt sprintf; do
9418 case "$xxx_list" in
9419 *$xxx_convert*) ;;
9420 *) xxx_list="$xxx_list $xxx_convert" ;;
9421 esac
9422done
9423
9424case "$d_longdbl$uselongdouble" in
9425"$define$define")
9426 : again, add prefered functions to our list first
9427 xxx_ld_list=""
ab6ca9f4 9428 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9429 case $xxx_convert in
9430 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9431 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9432 esac
9433 done
9434 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9435 for xxx_convert in qgcvt sprintf $xxx_list; do
9436 case "$xxx_ld_list" in
9437 $xxx_convert*|*" $xxx_convert"*) ;;
9438 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9439 esac
9440 done
9441 : if sprintf cannot do long doubles, move it to the end
9442 if test "$d_PRIgldbl" != "$define"; then
9443 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9444 fi
9445 : if no qgcvt, remove it
9446 if test "$d_qgcvt" != "$define"; then
9447 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9448 fi
9449 : use the ld_list
9450 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9451 ;;
9452esac
9453
9454for xxx_convert in $xxx_list; do
9455 echo "Trying $xxx_convert..."
9456 $rm -f try try$_o
9457 set try -DTRY_$xxx_convert
9458 if eval $compile; then
9459 echo "$xxx_convert() found." >&4
5440bc8e 9460 if $run ./try; then
b4eb6b3d
JH
9461 echo "I'll use $xxx_convert to convert floats into a string." >&4
9462 break;
9463 else
9464 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9465 xxx_convert=''
b4eb6b3d
JH
9466 fi
9467 else
9468 echo "$xxx_convert NOT found." >&4
9469 fi
9470done
ab6ca9f4 9471
a5b10d80
YST
9472if test X$xxx_convert = X; then
9473 echo "*** WHOA THERE!!! ***" >&4
9474 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9475 xxx_convert=sprintf
9476fi
9477
b4eb6b3d
JH
9478case "$xxx_convert" in
9479gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9480gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9481qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9482*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9483 "$define$define$define")
9484 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9485 "$define$define$undef")
9486 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9487 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9488 esac
9489 ;;
9490esac
9491
a5b10d80
YST
9492fi
9493
74cac757
JH
9494: see if _fwalk exists
9495set fwalk d__fwalk
9496eval $inlibc
9497
b4eb6b3d
JH
9498: Initialize h_fcntl
9499h_fcntl=false
9500
9501: Initialize h_sysfile
9502h_sysfile=false
9503
9504: access call always available on UNIX
9505set access d_access
9506eval $inlibc
9507
9508: locate the flags for 'access()'
9509case "$d_access" in
9510"$define")
9511 echo " "
9512 $cat >access.c <<'EOCP'
9513#include <sys/types.h>
9514#ifdef I_FCNTL
9515#include <fcntl.h>
9516#endif
9517#ifdef I_SYS_FILE
9518#include <sys/file.h>
9519#endif
9520#ifdef I_UNISTD
9521#include <unistd.h>
9522#endif
9523int main() {
9524 exit(R_OK);
9525}
9526EOCP
9527 : check sys/file.h first, no particular reason here
9528 if $test `./findhdr sys/file.h` && \
7a282f6d 9529 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9530 h_sysfile=true;
9531 echo "<sys/file.h> defines the *_OK access constants." >&4
9532 elif $test `./findhdr fcntl.h` && \
7a282f6d 9533 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9534 h_fcntl=true;
9535 echo "<fcntl.h> defines the *_OK access constants." >&4
9536 elif $test `./findhdr unistd.h` && \
7a282f6d 9537 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9538 echo "<unistd.h> defines the *_OK access constants." >&4
9539 else
9540 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9541 fi
9542 ;;
9543esac
9544$rm -f access*
9545
9546: see if accessx exists
9547set accessx d_accessx
9548eval $inlibc
9549
9550: see if alarm exists
9551set alarm d_alarm
9552eval $inlibc
9553
a9dade78
JH
9554: see if POSIX threads are available
9555set pthread.h i_pthread
9556eval $inhdr
9557
10bc17b6
JH
9558: define a fucntion to check prototypes
9559$cat > protochk <<EOSH
9560$startsh
9561cc="$cc"
9562optimize="$optimize"
9563ccflags="$ccflags"
9564prototype="$prototype"
9565define="$define"
9566rm=$rm
a9dade78
JH
9567usethreads=$usethreads
9568i_pthread=$i_pthread
9569pthread_h_first=$pthread_h_first
10bc17b6
JH
9570EOSH
9571
9572$cat >> protochk <<'EOSH'
9573
9574$rm -f try.c
9575foo="$1"
9576shift
9577while test $# -ge 2; do
9578 case "$1" in
9579 $define) echo "#include <$2>" >> try.c ;;
9580 literal) echo "$2" >> try.c ;;
9581 esac
cce6a207
MB
9582 # Extra magic for the benefit of systems that need pthread.h
9583 # to be included early to correctly detect threadsafe functions.
9584 # Such functions must guarantee themselves, though, that the usethreads
9585 # and i_pthread have been defined, before calling protochk.
9586 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9587 echo "#include <pthread.h>" >> try.c
9588 pthread_h_done=yes
9589 fi
10bc17b6
JH
9590 shift 2
9591done
9592test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9593cat >> try.c <<'EOCP'
9594#ifdef CAN_PROTOTYPE
9595#define _(args) args
9596#else
9597#define _(args) ()
9598#endif
9599EOCP
9600echo "$foo" >> try.c
9601echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9602$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9603status=$?
9604$rm -f try.[co]
9605exit $status
9606EOSH
9607chmod +x protochk
9608$eunicefix protochk
9609
9610: see if sys/types.h has to be included
9611set sys/types.h i_systypes
9612eval $inhdr
9613
9614: see if sys/select.h has to be included
9615set sys/select.h i_sysselct
9616eval $inhdr
9617
9618hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9619while $test $# -ge 2; do
9620 case "$1" in
9621 $define) echo "#include <$2>";;
9622 esac ;
9623 shift 2;
9624done > try.c;
9625echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9626set try;
9627if eval $compile; then
9628 val="$define";
9629else
9630 val="$undef";
9631fi;
9632set $varname;
9633eval $setvar;
9634$rm -f try.c try.o'
9635
9636: see if we should include time.h, sys/time.h, or both
9637echo " "
9638if test "X$timeincl" = X; then
9639 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9640 $echo $n "I'm now running the test program...$c"
9641 $cat >try.c <<'EOCP'
9642#include <sys/types.h>
9643#ifdef I_TIME
9644#include <time.h>
9645#endif
9646#ifdef I_SYSTIME
9647#ifdef SYSTIMEKERNEL
9648#define KERNEL
9649#endif
9650#include <sys/time.h>
9651#endif
9652#ifdef I_SYSSELECT
9653#include <sys/select.h>
9654#endif
9655int main()
9656{
9657 struct tm foo;
9658#ifdef S_TIMEVAL
9659 struct timeval bar;
9660#endif
9661#ifdef S_TIMEZONE
9662 struct timezone tzp;
9663#endif
9664 if (foo.tm_sec == foo.tm_sec)
9665 exit(0);
9666#ifdef S_TIMEVAL
9667 if (bar.tv_sec == bar.tv_sec)
9668 exit(0);
9669#endif
9670 exit(1);
9671}
9672EOCP
9673 flags=''
9674 for s_timezone in '-DS_TIMEZONE' ''; do
9675 sysselect=''
9676 for s_timeval in '-DS_TIMEVAL' ''; do
9677 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9678 for i_time in '' '-DI_TIME'; do
9679 for i_systime in '-DI_SYSTIME' ''; do
9680 case "$flags" in
9681 '') $echo $n ".$c"
9682 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9683 if eval $compile; then
9684 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9685 shift
9686 flags="$*"
9687 echo " "
9688 $echo $n "Succeeded with $flags$c"
9689 fi
9690 ;;
9691 esac
9692 done
9693 done
9694 done
9695 done
9696 done
9697 timeincl=''
9698 echo " "
9699 case "$flags" in
9700 *SYSTIMEKERNEL*) i_systimek="$define"
9701 timeincl=`./findhdr sys/time.h`
9702 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9703 *) i_systimek="$undef";;
9704 esac
9705 case "$flags" in
9706 *I_TIME*) i_time="$define"
9707 timeincl=`./findhdr time.h`" $timeincl"
9708 echo "We'll include <time.h>." >&4;;
9709 *) i_time="$undef";;
9710 esac
9711 case "$flags" in
9712 *I_SYSTIME*) i_systime="$define"
9713 timeincl=`./findhdr sys/time.h`" $timeincl"
9714 echo "We'll include <sys/time.h>." >&4;;
9715 *) i_systime="$undef";;
9716 esac
9717 $rm -f try.c try
9718fi
9719: see if struct tm knows about tm_zone
9720case "$i_systime$i_time" in
9721*$define*)
9722 echo " "
9723 echo "Checking to see if your struct tm has tm_zone field..." >&4
9724 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9725 eval $hasfield
9726 ;;
9727*) val="$undef"
9728 set d_tm_tm_zone
9729 eval $setvar
9730 ;;
9731esac
9732case "$d_tm_tm_zone" in
9733"$define") echo "Yes, it does." ;;
9734*) echo "No, it doesn't." ;;
9735esac
9736: see if struct tm knows about tm_gmtoff
9737case "$i_systime$i_time" in
9738*$define*)
9739 echo " "
9740 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9741 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9742 eval $hasfield
9743 ;;
9744*) val="$undef"
9745 set d_tm_tm_gmtoff
9746 eval $setvar
9747 ;;
9748esac
9749case "$d_tm_tm_gmtoff" in
9750"$define") echo "Yes, it does." ;;
9751*) echo "No, it doesn't." ;;
9752esac
9753
9754: see if asctime_r exists
9755set asctime_r d_asctime_r
9756eval $inlibc
9757case "$d_asctime_r" in
9758"$define")
d63eadf0 9759 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9760 case "$d_asctime_r_proto:$usethreads" in
9761 ":define") d_asctime_r_proto=define
a48ec845
JH
9762 set d_asctime_r_proto asctime_r $hdrs
9763 eval $hasproto ;;
9764 *) ;;
9765 esac
9766 case "$d_asctime_r_proto" in
9767 define)
10bc17b6
JH
9768 case "$asctime_r_proto" in
9769 ''|0) try='char* asctime_r(const struct tm*, char*);'
9770 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9771 esac
9772 case "$asctime_r_proto" in
9773 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9774 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9775 esac
9776 case "$asctime_r_proto" in
9777 ''|0) try='int asctime_r(const struct tm*, char*);'
9778 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9779 esac
9780 case "$asctime_r_proto" in
9781 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9782 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9783 esac
9784 case "$asctime_r_proto" in
90e831dc 9785 ''|0) d_asctime_r=undef
10bc17b6 9786 asctime_r_proto=0
a48ec845 9787 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9788 * ) case "$asctime_r_proto" in
9789 REENTRANT_PROTO*) ;;
9790 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9791 esac
9792 echo "Prototype: $try" ;;
9793 esac
9794 ;;
c18e646a
JH
9795 *) case "$usethreads" in
9796 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9797 esac
90e831dc
SB
9798 d_asctime_r=undef
9799 asctime_r_proto=0
c18e646a 9800 ;;
a48ec845
JH
9801 esac
9802 ;;
10bc17b6
JH
9803*) asctime_r_proto=0
9804 ;;
9805esac
9806
b4eb6b3d
JH
9807: see if atolf exists
9808set atolf d_atolf
9809eval $inlibc
9810
9811: see if atoll exists
9812set atoll d_atoll
9813eval $inlibc
9814
9815: Look for GNU-cc style attribute checking
9816echo " "
9817echo "Checking whether your compiler can handle __attribute__ ..." >&4
9818$cat >attrib.c <<'EOCP'
9819#include <stdio.h>
9820void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9821EOCP
9822if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9823 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9824 echo "Your C compiler doesn't fully support __attribute__."
9825 val="$undef"
9826 else
9827 echo "Your C compiler supports __attribute__."
9828 val="$define"
9829 fi
9830else
9831 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9832 val="$undef"
9833fi
9834set d_attribut
9835eval $setvar
9836$rm -f attrib*
9837
9838: see if bcmp exists
9839set bcmp d_bcmp
9840eval $inlibc
9841
9842: see if bcopy exists
9843set bcopy d_bcopy
9844eval $inlibc
9845
9846: see if this is a unistd.h system
9847set unistd.h i_unistd
9848eval $inhdr
9849
9850: see if getpgrp exists
9851set getpgrp d_getpgrp
9852eval $inlibc
9853
9854case "$d_getpgrp" in
9855"$define")
9856 echo " "
9857 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 9858 $cat >try.c <<EOP
b4eb6b3d
JH
9859#$i_unistd I_UNISTD
9860#include <sys/types.h>
9861#ifdef I_UNISTD
9862# include <unistd.h>
9863#endif
9864int main()
9865{
9866 if (getuid() == 0) {
9867 printf("(I see you are running Configure as super-user...)\n");
9868 setuid(1);
9869 }
9870#ifdef TRY_BSD_PGRP
9871 if (getpgrp(1) == 0)
9872 exit(0);
9873#else
9874 if (getpgrp() > 0)
9875 exit(0);
9876#endif
9877 exit(1);
9878}
9879EOP
5440bc8e 9880 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9881 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9882 val="$define"
5440bc8e 9883 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9884 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9885 val="$undef"
9886 else
9887 echo "I can't seem to compile and run the test program."
9888 if ./usg; then
9889 xxx="a USG one, i.e. you use getpgrp()."
9890 else
9891 # SVR4 systems can appear rather BSD-ish.
9892 case "$i_unistd" in
9893 $undef)
9894 xxx="a BSD one, i.e. you use getpgrp(pid)."
9895 val="$define"
9896 ;;
9897 $define)
9898 xxx="probably a USG one, i.e. you use getpgrp()."
9899 val="$undef"
9900 ;;
9901 esac
9902 fi
9903 echo "Assuming your getpgrp is $xxx" >&4
9904 fi
9905 ;;
9906*) val="$undef";;
9907esac
9908set d_bsdgetpgrp
9909eval $setvar
5440bc8e 9910$rm -f try try.*
b4eb6b3d
JH
9911
9912: see if setpgrp exists
9913set setpgrp d_setpgrp
9914eval $inlibc
9915
9916case "$d_setpgrp" in
9917"$define")
9918 echo " "
9919 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 9920 $cat >try.c <<EOP
b4eb6b3d
JH
9921#$i_unistd I_UNISTD
9922#include <sys/types.h>
9923#ifdef I_UNISTD
9924# include <unistd.h>
9925#endif
9926int main()
9927{
9928 if (getuid() == 0) {
9929 printf("(I see you are running Configure as super-user...)\n");
9930 setuid(1);
9931 }
9932#ifdef TRY_BSD_PGRP
9933 if (-1 == setpgrp(1, 1))
9934 exit(0);
9935#else
9936 if (setpgrp() != -1)
9937 exit(0);
9938#endif
9939 exit(1);
9940}
9941EOP
5440bc8e 9942 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9943 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9944 val="$define"
5440bc8e 9945 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9946 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9947 val="$undef"
9948 else
9949 echo "(I can't seem to compile and run the test program.)"
9950 if ./usg; then
9951 xxx="a USG one, i.e. you use setpgrp()."
9952 else
9953 # SVR4 systems can appear rather BSD-ish.
9954 case "$i_unistd" in
9955 $undef)
9956 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9957 val="$define"
9958 ;;
9959 $define)
9960 xxx="probably a USG one, i.e. you use setpgrp()."
9961 val="$undef"
9962 ;;
9963 esac
9964 fi
9965 echo "Assuming your setpgrp is $xxx" >&4
9966 fi
9967 ;;
9968*) val="$undef";;
9969esac
9970set d_bsdsetpgrp
9971eval $setvar
5440bc8e 9972$rm -f try try.*
b4eb6b3d
JH
9973: see if bzero exists
9974set bzero d_bzero
9975eval $inlibc
9976
9977: see if signal is declared as pointer to function returning int or void
9978echo " "
9979xxx=`./findhdr signal.h`
9980$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9981if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9982 echo "You have int (*signal())() instead of void." >&4
9983 val="$undef"
9984elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9985 echo "You have void (*signal())()." >&4
9986 val="$define"
9987elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9988 echo "You have int (*signal())() instead of void." >&4
9989 val="$undef"
9990elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9991 echo "You have void (*signal())()." >&4
9992 val="$define"
9993else
9994 case "$d_voidsig" in
9995 '')
9996 echo "I can't determine whether signal handler returns void or int..." >&4
9997 dflt=void
9998 rp="What type does your signal handler return?"
9999 . ./myread
10000 case "$ans" in
10001 v*) val="$define";;
10002 *) val="$undef";;
10003 esac;;
10004 "$define")
10005 echo "As you already told me, signal handler returns void." >&4
10006 val="$define"
10007 ;;
10008 *) echo "As you already told me, signal handler returns int." >&4
10009 val="$undef"
10010 ;;
10011 esac
10012fi
10013set d_voidsig
10014eval $setvar
10015case "$d_voidsig" in
10016"$define") signal_t="void";;
10017*) signal_t="int";;
10018esac
10019$rm -f $$.tmp
10020
10021: check for ability to cast large floats to 32-bit ints.
10022echo " "
10023echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10024if $test "$intsize" -ge 4; then
10025 xxx=int
10026else
10027 xxx=long
10028fi
10029$cat >try.c <<EOCP
10030#include <stdio.h>
10031#include <sys/types.h>
10032#include <signal.h>
10033$signal_t blech(s) int s; { exit(3); }
10034int main()
10035{
10036 $xxx i32;
10037 double f, g;
10038 int result = 0;
10039 char str[16];
10040 signal(SIGFPE, blech);
10041
10042 /* Don't let compiler optimize the test away. Store the number
10043 in a writable string for gcc to pass to sscanf under HP/UX.
10044 */
10045 sprintf(str, "2147483647");
10046 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10047 g = 10 * f;
10048 i32 = ($xxx) g;
10049
10050 /* x86 processors will probably give 0x8000 0000, which is a
10051 sign change. We don't want that. We want to mimic SPARC
10052 behavior here, which is to preserve the sign and give
10053 back 0x7fff ffff.
10054 */
10055 if (i32 != ($xxx) f)
10056 result |= 1;
10057 exit(result);
10058}
10059EOCP
10060set try
10061if eval $compile_ok; then
5440bc8e 10062 $run ./try
b4eb6b3d
JH
10063 yyy=$?
10064else
10065 echo "(I can't seem to compile the test program--assuming it can't)"
10066 yyy=1
10067fi
10068case "$yyy" in
100690) val="$define"
10070 echo "Yup, it can."
10071 ;;
10072*) val="$undef"
10073 echo "Nope, it can't."
10074 ;;
10075esac
10076set d_casti32
10077eval $setvar
10078$rm -f try try.*
10079
10080: check for ability to cast negative floats to unsigned
10081echo " "
10082echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10083$cat >try.c <<EOCP
10084#include <stdio.h>
10085#include <sys/types.h>
10086#include <signal.h>
10087$signal_t blech(s) int s; { exit(7); }
10088$signal_t blech_in_list(s) int s; { exit(4); }
10089unsigned long dummy_long(p) unsigned long p; { return p; }
10090unsigned int dummy_int(p) unsigned int p; { return p; }
10091unsigned short dummy_short(p) unsigned short p; { return p; }
10092int main()
10093{
10094 double f;
10095 unsigned long along;
10096 unsigned int aint;
10097 unsigned short ashort;
10098 int result = 0;
10099 char str[16];
10100
10101 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10102 a direct f = -123. assignment. gcc-2.8.0 reportedly
10103 optimized the whole file away
10104 */
10105 /* Store the number in a writable string for gcc to pass to
10106 sscanf under HP/UX.
10107 */
10108 sprintf(str, "-123");
10109 sscanf(str, "%lf", &f); /* f = -123.; */
10110
10111 signal(SIGFPE, blech);
10112 along = (unsigned long)f;
10113 aint = (unsigned int)f;
10114 ashort = (unsigned short)f;
10115 if (along != (unsigned long)-123)
10116 result |= 1;
10117 if (aint != (unsigned int)-123)
10118 result |= 1;
10119 if (ashort != (unsigned short)-123)
10120 result |= 1;
10121 sprintf(str, "1073741824.");
10122 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10123 f = f + f;
10124 along = 0;
10125 along = (unsigned long)f;
10126 if (along != 0x80000000)
10127 result |= 2;
10128 f -= 1.;
10129 along = 0;
10130 along = (unsigned long)f;
10131 if (along != 0x7fffffff)
10132 result |= 1;
10133 f += 2.;
10134 along = 0;
10135 along = (unsigned long)f;
10136 if (along != 0x80000001)
10137 result |= 2;
10138 if (result)
10139 exit(result);
10140 signal(SIGFPE, blech_in_list);
10141 sprintf(str, "123.");
10142 sscanf(str, "%lf", &f); /* f = 123.; */
10143 along = dummy_long((unsigned long)f);
10144 aint = dummy_int((unsigned int)f);
10145 ashort = dummy_short((unsigned short)f);
10146 if (along != (unsigned long)123)
10147 result |= 4;
10148 if (aint != (unsigned int)123)
10149 result |= 4;
10150 if (ashort != (unsigned short)123)
10151 result |= 4;
10152 exit(result);
10153
10154}
10155EOCP
10156set try
10157if eval $compile_ok; then
5440bc8e 10158 $run ./try
b4eb6b3d
JH
10159 castflags=$?
10160else
10161 echo "(I can't seem to compile the test program--assuming it can't)"
10162 castflags=7
10163fi
10164case "$castflags" in
101650) val="$define"
10166 echo "Yup, it can."
10167 ;;
10168*) val="$undef"
10169 echo "Nope, it can't."
10170 ;;
10171esac
10172set d_castneg
10173eval $setvar
10174$rm -f try.*
10175
10176: see if vprintf exists
10177echo " "
10178if set vprintf val -f d_vprintf; eval $csym; $val; then
10179 echo 'vprintf() found.' >&4
10180 val="$define"
5440bc8e 10181 $cat >try.c <<'EOF'
b4eb6b3d
JH
10182#include <varargs.h>
10183
10184int main() { xxx("foo"); }
10185
10186xxx(va_alist)
10187va_dcl
10188{
10189 va_list args;
10190 char buf[10];
10191
10192 va_start(args);
10193 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10194}
10195EOF
5440bc8e
JH
10196 set try
10197 if eval $compile && $run ./try; then
b4eb6b3d
JH
10198 echo "Your vsprintf() returns (int)." >&4
10199 val2="$undef"
10200 else
10201 echo "Your vsprintf() returns (char*)." >&4
10202 val2="$define"
10203 fi
10204else
10205 echo 'vprintf() NOT found.' >&4
10206 val="$undef"
10207 val2="$undef"
10208fi
5440bc8e 10209$rm -f try try.*
b4eb6b3d
JH
10210set d_vprintf
10211eval $setvar
10212val=$val2
10213set d_charvspr
10214eval $setvar
10215
10216: see if chown exists
10217set chown d_chown
10218eval $inlibc
10219
10220: see if chroot exists
10221set chroot d_chroot
10222eval $inlibc
10223
10224: see if chsize exists
10225set chsize d_chsize
10226eval $inlibc
10227
758a5d79
JH
10228: see if class exists
10229set class d_class
10230eval $inlibc
10231
4e0554ec
JH
10232hasstruct='varname=$1; struct=$2; shift; shift;
10233while $test $# -ge 2; do
10234 case "$1" in
10235 $define) echo "#include <$2>";;
10236 esac ;
10237 shift 2;
10238done > try.c;
10239echo "int main () { struct $struct foo; }" >> try.c;
10240set try;
10241if eval $compile; then
10242 val="$define";
10243else
10244 val="$undef";
10245fi;
10246set $varname;
10247eval $setvar;
10248$rm -f try.c try.o'
10249
4e0554ec
JH
10250socketlib=''
10251sockethdr=''
10252: see whether socket exists
10253echo " "
10254$echo $n "Hmm... $c" >&4
10255if set socket val -f d_socket; eval $csym; $val; then
10256 echo "Looks like you have Berkeley networking support." >&4
10257 d_socket="$define"
10258 if set setsockopt val -f; eval $csym; $val; then
10259 d_oldsock="$undef"
10260 else
10261 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10262 d_oldsock="$define"
10263 fi
10264else
10265 if $contains socklib libc.list >/dev/null 2>&1; then
10266 echo "Looks like you have Berkeley networking support." >&4
10267 d_socket="$define"
10268 : we will have to assume that it supports the 4.2 BSD interface
10269 d_oldsock="$undef"
10270 else
10271 echo "You don't have Berkeley networking in libc$_a..." >&4
10272 if test "X$d_socket" = "X$define"; then
10273 echo "...but you seem to believe that you have sockets." >&4
10274 else
10275 for net in net socket
10276 do
10277 if test -f /usr/lib/lib$net$_a; then
10278 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10279 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10280 if $contains socket libc.list >/dev/null 2>&1; then
10281 d_socket="$define"
10282 socketlib="-l$net"
10283 case "$net" in
10284 net)
10285 echo "...but the Wollongong group seems to have hacked it in." >&4
10286 sockethdr="-I/usr/netinclude"
10287 ;;
10288 esac
3c728e00 10289 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10290 if $contains setsockopt libc.list >/dev/null 2>&1; then
10291 d_oldsock="$undef"
10292 else
10293 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10294 d_oldsock="$define"
10295 fi
10296 break
10297 fi
10298 fi
10299 done
10300 if test "X$d_socket" != "X$define"; then
10301 echo "or anywhere else I see." >&4
10302 d_socket="$undef"
10303 d_oldsock="$undef"
10304 fi
10305 fi
10306 fi
10307fi
10308
10309: see if socketpair exists
10310set socketpair d_sockpair
10311eval $inlibc
10312
10313
10314echo " "
3c728e00 10315echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10316for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10317 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10318 $cat >try.c <<EOF
10319#include <sys/types.h>
10320#include <sys/socket.h>
10321int main() {
10322 int i = $ENUM;
10323}
10324EOF
10325 val="$undef"
10326 set try; if eval $compile; then
10327 val="$define"
10328 fi
10329 set d_${enum}; eval $setvar
10330 $rm -f try.c try
10331done
10332
10333: see if this is a sys/uio.h system
10334set sys/uio.h i_sysuio
10335eval $inhdr
10336
10337
10338echo " "
10339echo "Checking to see if your system supports struct cmsghdr..." >&4
10340set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10341eval $hasstruct
10342case "$d_cmsghdr_s" in
10343"$define") echo "Yes, it does." ;;
10344*) echo "No, it doesn't." ;;
10345esac
10346
10347
b4eb6b3d
JH
10348: check for const keyword
10349echo " "
10350echo 'Checking to see if your C compiler knows about "const"...' >&4
10351$cat >const.c <<'EOCP'
10352typedef struct spug { int drokk; } spug;
76f47787 10353int main()
b4eb6b3d
JH
10354{
10355 const char *foo;
10356 const spug y;
10357}
10358EOCP
10359if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10360 val="$define"
10361 echo "Yup, it does."
10362else
10363 val="$undef"
10364 echo "Nope, it doesn't."
10365fi
10366set d_const
10367eval $setvar
10368
10369: see if crypt exists
10370echo " "
a5a94ea5
JH
10371set crypt d_crypt
10372eval $inlibc
10373case "$d_crypt" in
10374$define) cryptlib='' ;;
10375*) if set crypt val -f d_crypt; eval $csym; $val; then
10376 echo 'crypt() found.' >&4
b4eb6b3d 10377 val="$define"
a5a94ea5
JH
10378 cryptlib=''
10379 else
10380 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10381 if $test -z "$cryptlib"; then
10382 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10383 else
10384 cryptlib=-lcrypt
10385 fi
10386 if $test -z "$cryptlib"; then
10387 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10388 else
10389 cryptlib=-lcrypt
10390 fi
10391 if $test -z "$cryptlib"; then
10392 cryptlib=`./loc libcrypt$_a "" $libpth`
10393 else
10394 cryptlib=-lcrypt
10395 fi
10396 if $test -z "$cryptlib"; then
10397 echo 'crypt() NOT found.' >&4
10398 val="$undef"
10399 else
10400 val="$define"
10401 fi
b4eb6b3d 10402 fi
a5a94ea5
JH
10403 set d_crypt
10404 eval $setvar
10405 ;;
10406esac
b4eb6b3d 10407
10bc17b6
JH
10408: see if this is a crypt.h system
10409set crypt.h i_crypt
10410eval $inhdr
10411
10412: see if crypt_r exists
10413set crypt_r d_crypt_r
10414eval $inlibc
10415case "$d_crypt_r" in
10416"$define")
10417 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10418 case "$d_crypt_r_proto:$usethreads" in
10419 ":define") d_crypt_r_proto=define
a48ec845
JH
10420 set d_crypt_r_proto crypt_r $hdrs
10421 eval $hasproto ;;
10422 *) ;;
10423 esac
10424 case "$d_crypt_r_proto" in
10425 define)
10bc17b6
JH
10426 case "$crypt_r_proto" in
10427 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10428 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10429 esac
10430 case "$crypt_r_proto" in
b430fd04
JH
10431 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10432 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10433 esac
10434 case "$crypt_r_proto" in
90e831dc 10435 ''|0) d_crypt_r=undef
10bc17b6 10436 crypt_r_proto=0
a48ec845 10437 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10438 * ) case "$crypt_r_proto" in
10439 REENTRANT_PROTO*) ;;
10440 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10441 esac
10442 echo "Prototype: $try" ;;
10443 esac
10444 ;;
c18e646a
JH
10445 *) case "$usethreads" in
10446 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10447 esac
90e831dc
SB
10448 d_crypt_r=undef
10449 crypt_r_proto=0
c18e646a 10450 ;;
a48ec845
JH
10451 esac
10452 ;;
10bc17b6
JH
10453*) crypt_r_proto=0
10454 ;;
10455esac
10456
b4eb6b3d
JH
10457: get csh whereabouts
10458case "$csh" in
10459'csh') val="$undef" ;;
10460*) val="$define" ;;
10461esac
10462set d_csh
10463eval $setvar
10464: Respect a hint or command line value for full_csh.
10465case "$full_csh" in
10466'') full_csh=$csh ;;
10467esac
10468
10bc17b6
JH
10469: see if ctermid_r exists
10470set ctermid_r d_ctermid_r
10471eval $inlibc
10472case "$d_ctermid_r" in
10473"$define")
31ee0cb7 10474 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10475 case "$d_ctermid_r_proto:$usethreads" in
10476 ":define") d_ctermid_r_proto=define
a48ec845
JH
10477 set d_ctermid_r_proto ctermid_r $hdrs
10478 eval $hasproto ;;
10479 *) ;;
10480 esac
10481 case "$d_ctermid_r_proto" in
10482 define)
10bc17b6
JH
10483 case "$ctermid_r_proto" in
10484 ''|0) try='char* ctermid_r(char*);'
10485 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10486 esac
10487 case "$ctermid_r_proto" in
90e831dc 10488 ''|0) d_ctermid_r=undef
10bc17b6 10489 ctermid_r_proto=0
a48ec845 10490 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10491 * ) case "$ctermid_r_proto" in
10492 REENTRANT_PROTO*) ;;
10493 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10494 esac
10495 echo "Prototype: $try" ;;
10496 esac
10497 ;;
c18e646a
JH
10498 *) case "$usethreads" in
10499 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10500 esac
90e831dc
SB
10501 d_ctermid_r=undef
10502 ctermid_r_proto=0
c18e646a 10503 ;;
a48ec845
JH
10504 esac
10505 ;;
10bc17b6
JH
10506*) ctermid_r_proto=0
10507 ;;
10508esac
10509
10510: see if ctime_r exists
10511set ctime_r d_ctime_r
10512eval $inlibc
10513case "$d_ctime_r" in
10514"$define")
d63eadf0 10515 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10516 case "$d_ctime_r_proto:$usethreads" in
10517 ":define") d_ctime_r_proto=define
a48ec845
JH
10518 set d_ctime_r_proto ctime_r $hdrs
10519 eval $hasproto ;;
10520 *) ;;
10521 esac
10522 case "$d_ctime_r_proto" in
10523 define)
10bc17b6
JH
10524 case "$ctime_r_proto" in
10525 ''|0) try='char* ctime_r(const time_t*, char*);'
10526 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10527 esac
10528 case "$ctime_r_proto" in
10529 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10530 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10531 esac
10532 case "$ctime_r_proto" in
10533 ''|0) try='int ctime_r(const time_t*, char*);'
10534 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10535 esac
10536 case "$ctime_r_proto" in
10537 ''|0) try='int ctime_r(const time_t*, char*, int);'
10538 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10539 esac
10540 case "$ctime_r_proto" in
90e831dc 10541 ''|0) d_ctime_r=undef
10bc17b6 10542 ctime_r_proto=0
a48ec845 10543 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10544 * ) case "$ctime_r_proto" in
10545 REENTRANT_PROTO*) ;;
10546 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10547 esac
10548 echo "Prototype: $try" ;;
10549 esac
10550 ;;
c18e646a
JH
10551 *) case "$usethreads" in
10552 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10553 esac
90e831dc
SB
10554 d_ctime_r=undef
10555 ctime_r_proto=0
c18e646a 10556 ;;
a48ec845
JH
10557 esac
10558 ;;
10bc17b6
JH
10559*) ctime_r_proto=0
10560 ;;
10561esac
10562
b4eb6b3d
JH
10563: see if cuserid exists
10564set cuserid d_cuserid
10565eval $inlibc
10566
10567: see if this is a limits.h system
10568set limits.h i_limits
10569eval $inhdr
10570
10571: see if this is a float.h system
10572set float.h i_float
10573eval $inhdr
10574
10575: See if number of significant digits in a double precision number is known
10576echo " "
10577$cat >dbl_dig.c <<EOM
10578#$i_limits I_LIMITS
10579#$i_float I_FLOAT
10580#ifdef I_LIMITS
10581#include <limits.h>
10582#endif
10583#ifdef I_FLOAT
10584#include <float.h>
10585#endif
10586#ifdef DBL_DIG
10587printf("Contains DBL_DIG");
10588#endif
10589EOM
10590$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10591if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10592 echo "DBL_DIG found." >&4
10593 val="$define"
10594else
10595 echo "DBL_DIG NOT found." >&4
10596 val="$undef"
10597fi
10598$rm -f dbl_dig.?
10599set d_dbl_dig
10600eval $setvar
10601
2ef53570
JH
10602: see if dbm.h is available
10603: see if dbmclose exists
10604set dbmclose d_dbmclose
10605eval $inlibc
10606
10607case "$d_dbmclose" in
10608$define)
10609 set dbm.h i_dbm
10610 eval $inhdr
10611 case "$i_dbm" in
10612 $define)
10613 val="$undef"
10614 set i_rpcsvcdbm
10615 eval $setvar
10616 ;;
10617 *) set rpcsvc/dbm.h i_rpcsvcdbm
10618 eval $inhdr
10619 ;;
10620 esac
10621 ;;
10622*) echo "We won't be including <dbm.h>"
10623 val="$undef"
10624 set i_dbm
10625 eval $setvar
10626 val="$undef"
10627 set i_rpcsvcdbm
10628 eval $setvar
10629 ;;
10630esac
10631
10632: see if prototype for dbminit is available
10633echo " "
10634set d_dbminitproto dbminit $i_dbm dbm.h
10635eval $hasproto
10636
b4eb6b3d
JH
10637: see if difftime exists
10638set difftime d_difftime
10639eval $inlibc
10640
10641: see if this is a dirent system
10642echo " "
10643if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10644 val="$define"
10645 echo "<dirent.h> found." >&4
10646else
10647 val="$undef"
10648 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10649 echo "<sys/dir.h> found." >&4
10650 echo " "
10651 else
10652 xinc=`./findhdr sys/ndir.h`
10653 fi
10654 echo "<dirent.h> NOT found." >&4
10655fi
10656set i_dirent
10657eval $setvar
10658
10659: Look for type of directory structure.
10660echo " "
10661$cppstdin $cppflags $cppminus < "$xinc" > try.c
10662
10663case "$direntrytype" in
10664''|' ')
10665 case "$i_dirent" in
10666 $define) guess1='struct dirent' ;;
10667 *) guess1='struct direct' ;;
10668 esac
10669 ;;
10670*) guess1="$direntrytype"
10671 ;;
10672esac
10673
10674case "$guess1" in
10675'struct dirent') guess2='struct direct' ;;
10676*) guess2='struct dirent' ;;
10677esac
10678
10679if $contains "$guess1" try.c >/dev/null 2>&1; then
10680 direntrytype="$guess1"
10681 echo "Your directory entries are $direntrytype." >&4
10682elif $contains "$guess2" try.c >/dev/null 2>&1; then
10683 direntrytype="$guess2"
10684 echo "Your directory entries seem to be $direntrytype." >&4
10685else
10686 echo "I don't recognize your system's directory entries." >&4
10687 rp="What type is used for directory entries on this system?"
10688 dflt="$guess1"
10689 . ./myread
10690 direntrytype="$ans"
10691fi
10692$rm -f try.c
10693
10694
10695: see if the directory entry stores field length
10696echo " "
10697$cppstdin $cppflags $cppminus < "$xinc" > try.c
10698if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10699 echo "Good, your directory entry keeps length information in d_namlen." >&4
10700 val="$define"
10701else
10702 echo "Your directory entry does not know about the d_namlen field." >&4
10703 val="$undef"
10704fi
10705set d_dirnamlen
10706eval $setvar
10707$rm -f try.c
10708
ae0e3d3b
JH
10709: see if this is an sysdir system
10710set sys/dir.h i_sysdir
10711eval $inhdr
10712
10713: see if this is an sysndir system
10714set sys/ndir.h i_sysndir
10715eval $inhdr
10716
10717: Look for dirfd
10718echo " "
10719$cat >dirfd.c <<EOM
10720#include <stdio.h>
10721#$i_dirent I_DIRENT /**/
10722#$i_sysdir I_SYS_DIR /**/
10723#$i_sysndir I_SYS_NDIR /**/
10724#$i_systypes I_SYS_TYPES /**/
10725#if defined(I_SYS_TYPES)
10726#include <sys/types.h>
10727#endif
10728#if defined(I_DIRENT)
10729#include <dirent.h>
10730#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10731#include <sys/dir.h>
10732#endif
10733#else
10734#ifdef I_SYS_NDIR
10735#include <sys/ndir.h>
10736#else
10737#ifdef I_SYS_DIR
10738#ifdef hp9000s500
10739#include <ndir.h> /* may be wrong in the future */
10740#else
10741#include <sys/dir.h>
10742#endif
10743#endif
10744#endif
10745#endif
10746int main() {
10747 DIR *dirp = opendir(".");
10748 if (dirfd(dirp) >= 0)
10749 exit(0);
10750 else
10751 exit(1);
10752}
10753EOM
10754set dirfd
10755if eval $compile; then
10756 val="$define"
10757fi
10758case "$val" in
10759$define) echo "dirfd() found." >&4 ;;
10760*) echo "dirfd() NOT found." >&4 ;;
10761esac
10762set d_dirfd
10763eval $setvar
10764$rm -f dirfd*
10765
b4eb6b3d
JH
10766: see if dlerror exists
10767xxx_runnm="$runnm"
10768runnm=false
10769set dlerror d_dlerror
10770eval $inlibc
10771runnm="$xxx_runnm"
10772
10773: see if dlfcn is available
10774set dlfcn.h i_dlfcn
10775eval $inhdr
10776
10777case "$usedl" in
10778$define|y|true)
10779 $cat << EOM
10780
10781On a few systems, the dynamically loaded modules that perl generates and uses
10782will need a different extension than shared libs. The default will probably
10783be appropriate.
10784
10785EOM
10786 case "$dlext" in
10787 '') dflt="$so" ;;
10788 *) dflt="$dlext" ;;
10789 esac
10790 rp='What is the extension of dynamically loaded modules'
10791 . ./myread
10792 dlext="$ans"
10793 ;;
10794*)
10795 dlext="none"
10796 ;;
10797esac
10798
10799: Check if dlsym need a leading underscore
10800echo " "
10801val="$undef"
10802
10803case "$dlsrc" in
10804dl_dlopen.xs)
10805 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10806 $cat >dyna.c <<'EOM'
10807fred () { }
10808EOM
10809
10810$cat >fred.c<<EOM
10811
10812#include <stdio.h>
10813#$i_dlfcn I_DLFCN
10814#ifdef I_DLFCN
5440bc8e 10815#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
10816#else
10817#include <sys/types.h>
10818#include <nlist.h>
10819#include <link.h>
10820#endif
10821
10822extern int fred() ;
10823
10824int main()
10825{
10826 void * handle ;
10827 void * symbol ;
10828#ifndef RTLD_LAZY
10829 int mode = 1 ;
10830#else
10831 int mode = RTLD_LAZY ;
10832#endif
10833 handle = dlopen("./dyna.$dlext", mode) ;
10834 if (handle == NULL) {
10835 printf ("1\n") ;
10836 fflush (stdout) ;
10837 exit(0);
10838 }
10839 symbol = dlsym(handle, "fred") ;
10840 if (symbol == NULL) {
10841 /* try putting a leading underscore */
10842 symbol = dlsym(handle, "_fred") ;
10843 if (symbol == NULL) {
10844 printf ("2\n") ;
10845 fflush (stdout) ;
10846 exit(0);
10847 }
10848 printf ("3\n") ;
10849 }
10850 else
10851 printf ("4\n") ;
10852 fflush (stdout) ;
10853 exit(0);
10854}
10855EOM
10856 : Call the object file tmp-dyna.o in case dlext=o.
10857 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10858 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 10859 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
10860 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10861 xxx=`$run ./fred`
b4eb6b3d
JH
10862 case $xxx in
10863 1) echo "Test program failed using dlopen." >&4
10864 echo "Perhaps you should not use dynamic loading." >&4;;
10865 2) echo "Test program failed using dlsym." >&4
10866 echo "Perhaps you should not use dynamic loading." >&4;;
10867 3) echo "dlsym needs a leading underscore" >&4
10868 val="$define" ;;
10869 4) echo "dlsym doesn't need a leading underscore." >&4;;
10870 esac
10871 else
10872 echo "I can't compile and run the test program." >&4
10873 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10874 fi
10875 ;;
10876esac
10877
3c728e00 10878$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
10879
10880set d_dlsymun
10881eval $setvar
10882
10bc17b6
JH
10883: see if drand48_r exists
10884set drand48_r d_drand48_r
10885eval $inlibc
10886case "$d_drand48_r" in
10887"$define")
10888 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
10889 case "$d_drand48_r_proto:$usethreads" in
10890 ":define") d_drand48_r_proto=define
a48ec845
JH
10891 set d_drand48_r_proto drand48_r $hdrs
10892 eval $hasproto ;;
10893 *) ;;
10894 esac
10895 case "$d_drand48_r_proto" in
10896 define)
10bc17b6
JH
10897 case "$drand48_r_proto" in
10898 ''|0) try='int drand48_r(struct drand48_data*, double*);'
10899 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10900 esac
10901 case "$drand48_r_proto" in
90e831dc 10902 ''|0) d_drand48_r=undef
10bc17b6 10903 drand48_r_proto=0
a48ec845 10904 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10905 * ) case "$drand48_r_proto" in
10906 REENTRANT_PROTO*) ;;
10907 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10908 esac
10909 echo "Prototype: $try" ;;
10910 esac
10911 ;;
c18e646a
JH
10912 *) case "$usethreads" in
10913 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10914 esac
90e831dc
SB
10915 d_drand48_r=undef
10916 drand48_r_proto=0
c18e646a 10917 ;;
a48ec845
JH
10918 esac
10919 ;;
10bc17b6
JH
10920*) drand48_r_proto=0
10921 ;;
10922esac
10923
10924: see if prototype for drand48 is available
10925echo " "
10926set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10927eval $hasproto
10928
b4eb6b3d
JH
10929: see if dup2 exists
10930set dup2 d_dup2
10931eval $inlibc
10932
10933: see if eaccess exists
10934set eaccess d_eaccess
10935eval $inlibc
10936
10937: see if endgrent exists
10938set endgrent d_endgrent
10939eval $inlibc
10940
10bc17b6
JH
10941: see if this is an grp system
10942set grp.h i_grp
10943eval $inhdr
10944
10945case "$i_grp" in
10946$define)
10947 xxx=`./findhdr grp.h`
10948 $cppstdin $cppflags $cppminus < $xxx >$$.h
10949
10950 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10951 val="$define"
10952 else
10953 val="$undef"
10954 fi
10955 set d_grpasswd
10956 eval $setvar
10957
10958 $rm -f $$.h
10959 ;;
10960*)
10961 val="$undef";
10962 set d_grpasswd; eval $setvar
10963 ;;
10964esac
10965
10966: see if endgrent_r exists
10967set endgrent_r d_endgrent_r
10968eval $inlibc
10969case "$d_endgrent_r" in
10970"$define")
10971 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
10972 case "$d_endgrent_r_proto:$usethreads" in
10973 ":define") d_endgrent_r_proto=define
a48ec845
JH
10974 set d_endgrent_r_proto endgrent_r $hdrs
10975 eval $hasproto ;;
10976 *) ;;
10977 esac
10978 case "$d_endgrent_r_proto" in
10979 define)
10bc17b6
JH
10980 case "$endgrent_r_proto" in
10981 ''|0) try='int endgrent_r(FILE**);'
10982 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10983 esac
10984 case "$endgrent_r_proto" in
10985 ''|0) try='void endgrent_r(FILE**);'
10986 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10987 esac
10988 case "$endgrent_r_proto" in
90e831dc 10989 ''|0) d_endgrent_r=undef
10bc17b6 10990 endgrent_r_proto=0
a48ec845 10991 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10992 * ) case "$endgrent_r_proto" in
10993 REENTRANT_PROTO*) ;;
10994 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10995 esac
10996 echo "Prototype: $try" ;;
10997 esac
10998 ;;
c18e646a
JH
10999 *) case "$usethreads" in
11000 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11001 esac
90e831dc
SB
11002 d_endgrent_r=undef
11003 endgrent_r_proto=0
c18e646a 11004 ;;
a48ec845
JH
11005 esac
11006 ;;
10bc17b6
JH
11007*) endgrent_r_proto=0
11008 ;;
11009esac
11010
b4eb6b3d
JH
11011: see if endhostent exists
11012set endhostent d_endhent
11013eval $inlibc
11014
10bc17b6
JH
11015: see if this is a netdb.h system
11016set netdb.h i_netdb
11017eval $inhdr
11018
11019: see if endhostent_r exists
11020set endhostent_r d_endhostent_r
11021eval $inlibc
11022case "$d_endhostent_r" in
11023"$define")
11024 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11025 case "$d_endhostent_r_proto:$usethreads" in
11026 ":define") d_endhostent_r_proto=define
a48ec845
JH
11027 set d_endhostent_r_proto endhostent_r $hdrs
11028 eval $hasproto ;;
11029 *) ;;
11030 esac
11031 case "$d_endhostent_r_proto" in
11032 define)
10bc17b6
JH
11033 case "$endhostent_r_proto" in
11034 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11035 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11036 esac
11037 case "$endhostent_r_proto" in
11038 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11039 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11040 esac
11041 case "$endhostent_r_proto" in
90e831dc 11042 ''|0) d_endhostent_r=undef
10bc17b6 11043 endhostent_r_proto=0
a48ec845 11044 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11045 * ) case "$endhostent_r_proto" in
11046 REENTRANT_PROTO*) ;;
11047 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11048 esac
11049 echo "Prototype: $try" ;;
11050 esac
11051 ;;
c18e646a
JH
11052 *) case "$usethreads" in
11053 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11054 esac
90e831dc
SB
11055 d_endhostent_r=undef
11056 endhostent_r_proto=0
c18e646a 11057 ;;
a48ec845
JH
11058 esac
11059 ;;
10bc17b6
JH
11060*) endhostent_r_proto=0
11061 ;;
11062esac
11063
b4eb6b3d
JH
11064: see if endnetent exists
11065set endnetent d_endnent
11066eval $inlibc
11067
10bc17b6
JH
11068: see if endnetent_r exists
11069set endnetent_r d_endnetent_r
11070eval $inlibc
11071case "$d_endnetent_r" in
11072"$define")
11073 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11074 case "$d_endnetent_r_proto:$usethreads" in
11075 ":define") d_endnetent_r_proto=define
a48ec845
JH
11076 set d_endnetent_r_proto endnetent_r $hdrs
11077 eval $hasproto ;;
11078 *) ;;
11079 esac
11080 case "$d_endnetent_r_proto" in
11081 define)
10bc17b6
JH
11082 case "$endnetent_r_proto" in
11083 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11084 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11085 esac
11086 case "$endnetent_r_proto" in
11087 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11088 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11089 esac
11090 case "$endnetent_r_proto" in
90e831dc 11091 ''|0) d_endnetent_r=undef
10bc17b6 11092 endnetent_r_proto=0
a48ec845 11093 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11094 * ) case "$endnetent_r_proto" in
11095 REENTRANT_PROTO*) ;;
11096 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11097 esac
11098 echo "Prototype: $try" ;;
11099 esac
11100 ;;
c18e646a
JH
11101 *) case "$usethreads" in
11102 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11103 esac
90e831dc
SB
11104 d_endnetent_r=undef
11105 endnetent_r_proto=0
c18e646a 11106 ;;
a48ec845
JH
11107 esac
11108 ;;
10bc17b6
JH
11109*) endnetent_r_proto=0
11110 ;;
11111esac
11112
b4eb6b3d
JH
11113: see if endprotoent exists
11114set endprotoent d_endpent
11115eval $inlibc
11116
10bc17b6
JH
11117: see if endprotoent_r exists
11118set endprotoent_r d_endprotoent_r
11119eval $inlibc
11120case "$d_endprotoent_r" in
11121"$define")
11122 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11123 case "$d_endprotoent_r_proto:$usethreads" in
11124 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11125 set d_endprotoent_r_proto endprotoent_r $hdrs
11126 eval $hasproto ;;
11127 *) ;;
11128 esac
11129 case "$d_endprotoent_r_proto" in
11130 define)
10bc17b6
JH
11131 case "$endprotoent_r_proto" in
11132 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11133 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11134 esac
11135 case "$endprotoent_r_proto" in
11136 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11137 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11138 esac
11139 case "$endprotoent_r_proto" in
90e831dc 11140 ''|0) d_endprotoent_r=undef
10bc17b6 11141 endprotoent_r_proto=0
a48ec845 11142 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11143 * ) case "$endprotoent_r_proto" in
11144 REENTRANT_PROTO*) ;;
11145 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11146 esac
11147 echo "Prototype: $try" ;;
11148 esac
11149 ;;
c18e646a
JH
11150 *) case "$usethreads" in
11151 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11152 esac
90e831dc
SB
11153 d_endprotoent_r=undef
11154 endprotoent_r_proto=0
c18e646a 11155 ;;
a48ec845
JH
11156 esac
11157 ;;
10bc17b6
JH
11158*) endprotoent_r_proto=0
11159 ;;
11160esac
11161
b4eb6b3d
JH
11162: see if endpwent exists
11163set endpwent d_endpwent
11164eval $inlibc
11165
10bc17b6
JH
11166: see if this is a pwd.h system
11167set pwd.h i_pwd
11168eval $inhdr
11169
11170case "$i_pwd" in
11171$define)
11172 xxx=`./findhdr pwd.h`
11173 $cppstdin $cppflags $cppminus < $xxx >$$.h
11174
11175 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11176 val="$define"
11177 else
11178 val="$undef"
11179 fi
11180 set d_pwquota
11181 eval $setvar
11182
11183 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11184 val="$define"
11185 else
11186 val="$undef"
11187 fi
11188 set d_pwage
11189 eval $setvar
11190
11191 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11192 val="$define"
11193 else
11194 val="$undef"
11195 fi
11196 set d_pwchange
11197 eval $setvar
11198
11199 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11200 val="$define"
11201 else
11202 val="$undef"
11203 fi
11204 set d_pwclass
11205 eval $setvar
11206
11207 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11208 val="$define"
11209 else
11210 val="$undef"
11211 fi
11212 set d_pwexpire
11213 eval $setvar
11214
11215 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11216 val="$define"
11217 else
11218 val="$undef"
11219 fi
11220 set d_pwcomment
11221 eval $setvar
11222
11223 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11224 val="$define"
11225 else
11226 val="$undef"
11227 fi
11228 set d_pwgecos
11229 eval $setvar
11230
11231 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11232 val="$define"
11233 else
11234 val="$undef"
11235 fi
11236 set d_pwpasswd
11237 eval $setvar
11238
11239 $rm -f $$.h
11240 ;;
11241*)
11242 val="$undef";
11243 set d_pwquota; eval $setvar
11244 set d_pwage; eval $setvar
11245 set d_pwchange; eval $setvar
11246 set d_pwclass; eval $setvar
11247 set d_pwexpire; eval $setvar
11248 set d_pwcomment; eval $setvar
11249 set d_pwgecos; eval $setvar
11250 set d_pwpasswd; eval $setvar
11251 ;;
11252esac
11253
11254: see if endpwent_r exists
11255set endpwent_r d_endpwent_r
11256eval $inlibc
11257case "$d_endpwent_r" in
11258"$define")
11259 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11260 case "$d_endpwent_r_proto:$usethreads" in
11261 ":define") d_endpwent_r_proto=define
a48ec845
JH
11262 set d_endpwent_r_proto endpwent_r $hdrs
11263 eval $hasproto ;;
11264 *) ;;
11265 esac
11266 case "$d_endpwent_r_proto" in
11267 define)
10bc17b6
JH
11268 case "$endpwent_r_proto" in
11269 ''|0) try='int endpwent_r(FILE**);'
11270 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11271 esac
11272 case "$endpwent_r_proto" in
11273 ''|0) try='void endpwent_r(FILE**);'
11274 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11275 esac
11276 case "$endpwent_r_proto" in
90e831dc 11277 ''|0) d_endpwent_r=undef
10bc17b6 11278 endpwent_r_proto=0
a48ec845 11279 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11280 * ) case "$endpwent_r_proto" in
11281 REENTRANT_PROTO*) ;;
11282 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11283 esac
11284 echo "Prototype: $try" ;;
11285 esac
11286 ;;
c18e646a
JH
11287 *) case "$usethreads" in
11288 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11289 esac
90e831dc
SB
11290 d_endpwent_r=undef
11291 endpwent_r_proto=0
c18e646a 11292 ;;
a48ec845
JH
11293 esac
11294 ;;
10bc17b6
JH
11295*) endpwent_r_proto=0
11296 ;;
11297esac
11298
b4eb6b3d
JH
11299: see if endservent exists
11300set endservent d_endsent
11301eval $inlibc
11302
10bc17b6
JH
11303: see if endservent_r exists
11304set endservent_r d_endservent_r
11305eval $inlibc
11306case "$d_endservent_r" in
11307"$define")
11308 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11309 case "$d_endservent_r_proto:$usethreads" in
11310 ":define") d_endservent_r_proto=define
a48ec845
JH
11311 set d_endservent_r_proto endservent_r $hdrs
11312 eval $hasproto ;;
11313 *) ;;
11314 esac
11315 case "$d_endservent_r_proto" in
11316 define)
10bc17b6
JH
11317 case "$endservent_r_proto" in
11318 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11319 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11320 esac
11321 case "$endservent_r_proto" in
11322 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11323 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11324 esac
11325 case "$endservent_r_proto" in
90e831dc 11326 ''|0) d_endservent_r=undef
10bc17b6 11327 endservent_r_proto=0
a48ec845 11328 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11329 * ) case "$endservent_r_proto" in
11330 REENTRANT_PROTO*) ;;
11331 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11332 esac
11333 echo "Prototype: $try" ;;
11334 esac
11335 ;;
c18e646a
JH
11336 *) case "$usethreads" in
11337 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11338 esac
90e831dc
SB
11339 d_endservent_r=undef
11340 endservent_r_proto=0
c18e646a 11341 ;;
a48ec845
JH
11342 esac
11343 ;;
10bc17b6
JH
11344*) endservent_r_proto=0
11345 ;;
11346esac
11347
b4eb6b3d
JH
11348: Locate the flags for 'open()'
11349echo " "
5440bc8e 11350$cat >try.c <<'EOCP'
b4eb6b3d
JH
11351#include <sys/types.h>
11352#ifdef I_FCNTL
11353#include <fcntl.h>
11354#endif
11355#ifdef I_SYS_FILE
11356#include <sys/file.h>
11357#endif
11358int main() {
11359 if(O_RDONLY);
11360#ifdef O_TRUNC
11361 exit(0);
11362#else
11363 exit(1);
11364#endif
11365}
11366EOCP
11367: check sys/file.h first to get FREAD on Sun
11368if $test `./findhdr sys/file.h` && \
5440bc8e 11369 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11370 h_sysfile=true;
11371 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11372 if $run ./try; then
b4eb6b3d
JH
11373 echo "and you have the 3 argument form of open()." >&4
11374 val="$define"
11375 else
11376 echo "but not the 3 argument form of open(). Oh, well." >&4
11377 val="$undef"
11378 fi
11379elif $test `./findhdr fcntl.h` && \
5440bc8e 11380 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11381 h_fcntl=true;
11382 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11383 if $run ./try; then
b4eb6b3d
JH
11384 echo "and you have the 3 argument form of open()." >&4
11385 val="$define"
11386 else
11387 echo "but not the 3 argument form of open(). Oh, well." >&4
11388 val="$undef"
11389 fi
11390else
11391 val="$undef"
11392 echo "I can't find the O_* constant definitions! You got problems." >&4
11393fi
11394set d_open3
11395eval $setvar
5440bc8e 11396$rm -f try try.*
b4eb6b3d
JH
11397
11398: see which of string.h or strings.h is needed
11399echo " "
11400strings=`./findhdr string.h`
11401if $test "$strings" && $test -r "$strings"; then
11402 echo "Using <string.h> instead of <strings.h>." >&4
11403 val="$define"
11404else
11405 val="$undef"
11406 strings=`./findhdr strings.h`
11407 if $test "$strings" && $test -r "$strings"; then
11408 echo "Using <strings.h> instead of <string.h>." >&4
11409 else
11410 echo "No string header found -- You'll surely have problems." >&4
11411 fi
11412fi
11413set i_string
11414eval $setvar
11415case "$i_string" in
11416"$undef") strings=`./findhdr strings.h`;;
11417*) strings=`./findhdr string.h`;;
11418esac
11419
3c728e00
JH
11420: see if this is a sys/file.h system
11421val=''
11422set sys/file.h val
11423eval $inhdr
11424
11425: do we need to include sys/file.h ?
11426case "$val" in
11427"$define")
11428 echo " "
11429 if $h_sysfile; then
11430 val="$define"
11431 echo "We'll be including <sys/file.h>." >&4
11432 else
11433 val="$undef"
11434 echo "We won't be including <sys/file.h>." >&4
11435 fi
11436 ;;
11437*)
11438 h_sysfile=false
11439 ;;
11440esac
11441set i_sysfile
11442eval $setvar
11443
11444: see if fcntl.h is there
11445val=''
11446set fcntl.h val
11447eval $inhdr
11448
11449: see if we can include fcntl.h
11450case "$val" in
11451"$define")
11452 echo " "
11453 if $h_fcntl; then
11454 val="$define"
11455 echo "We'll be including <fcntl.h>." >&4
11456 else
11457 val="$undef"
11458 if $h_sysfile; then
11459 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11460 else
11461 echo "We won't be including <fcntl.h>." >&4
11462 fi
11463 fi
11464 ;;
11465*)
11466 h_fcntl=false
11467 val="$undef"
11468 ;;
11469esac
11470set i_fcntl
11471eval $setvar
11472
b4eb6b3d
JH
11473: check for non-blocking I/O stuff
11474case "$h_sysfile" in
a0acbdc3
JH
11475true) echo "#include <sys/file.h>" > head.c;;
11476*)
11477 case "$h_fcntl" in
11478 true) echo "#include <fcntl.h>" > head.c;;
11479 *) echo "#include <sys/fcntl.h>" > head.c;;
11480 esac
11481 ;;
b4eb6b3d
JH
11482esac
11483echo " "
11484echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11485case "$o_nonblock" in
11486'')
11487 $cat head.c > try.c
3c728e00 11488 $cat >>try.c <<EOCP
b4eb6b3d 11489#include <stdio.h>
80b3ef99 11490#include <stdlib.h>
3c728e00
JH
11491#$i_fcntl I_FCNTL
11492#ifdef I_FCNTL
11493#include <fcntl.h>
11494#endif
b4eb6b3d
JH
11495int main() {
11496#ifdef O_NONBLOCK
11497 printf("O_NONBLOCK\n");
11498 exit(0);
11499#endif
11500#ifdef O_NDELAY
11501 printf("O_NDELAY\n");
11502 exit(0);
11503#endif
11504#ifdef FNDELAY
11505 printf("FNDELAY\n");
11506 exit(0);
11507#endif
11508 exit(0);
11509}
11510EOCP
11511 set try
11512 if eval $compile_ok; then
5440bc8e 11513 o_nonblock=`$run ./try`
b4eb6b3d
JH
11514 case "$o_nonblock" in
11515 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11516 *) echo "Seems like we can use $o_nonblock.";;
11517 esac
11518 else
11519 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11520 fi
11521 ;;
11522*) echo "Using $hint value $o_nonblock.";;
11523esac
11524$rm -f try try.* .out core
11525
11526echo " "
11527echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11528case "$eagain" in
11529'')
11530 $cat head.c > try.c
11531 $cat >>try.c <<EOCP
11532#include <errno.h>
11533#include <sys/types.h>
11534#include <signal.h>
11535#include <stdio.h>
80b3ef99 11536#include <stdlib.h>
1deb0a86
JH
11537#$i_fcntl I_FCNTL
11538#ifdef I_FCNTL
11539#include <fcntl.h>
11540#endif
b4eb6b3d
JH
11541#define MY_O_NONBLOCK $o_nonblock
11542#ifndef errno /* XXX need better Configure test */
11543extern int errno;
11544#endif
11545#$i_unistd I_UNISTD
11546#ifdef I_UNISTD
11547#include <unistd.h>
11548#endif
11549#$i_string I_STRING
11550#ifdef I_STRING
11551#include <string.h>
11552#else
11553#include <strings.h>
11554#endif
11555$signal_t blech(x) int x; { exit(3); }
11556EOCP
11557 $cat >> try.c <<'EOCP'
11558int main()
11559{
11560 int pd[2];
11561 int pu[2];
11562 char buf[1];
11563 char string[100];
11564
11565 pipe(pd); /* Down: child -> parent */
11566 pipe(pu); /* Up: parent -> child */
11567 if (0 != fork()) {
11568 int ret;
11569 close(pd[1]); /* Parent reads from pd[0] */
11570 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11571#ifdef F_SETFL
b4eb6b3d
JH
11572 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11573 exit(1);
a0acbdc3
JH
11574#else
11575 exit(4);
11576#endif
b4eb6b3d
JH
11577 signal(SIGALRM, blech);
11578 alarm(5);
11579 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11580 exit(2);
11581 sprintf(string, "%d\n", ret);
11582 write(2, string, strlen(string));
11583 alarm(0);
11584#ifdef EAGAIN
11585 if (errno == EAGAIN) {
11586 printf("EAGAIN\n");
11587 goto ok;
11588 }
11589#endif
11590#ifdef EWOULDBLOCK
11591 if (errno == EWOULDBLOCK)
11592 printf("EWOULDBLOCK\n");
11593#endif
11594 ok:
11595 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11596 sleep(2); /* Give it time to close our pipe */
11597 alarm(5);
11598 ret = read(pd[0], buf, 1); /* Should read EOF */
11599 alarm(0);
11600 sprintf(string, "%d\n", ret);
868439a2 11601 write(4, string, strlen(string));
b4eb6b3d
JH
11602 exit(0);
11603 }
11604
11605 close(pd[0]); /* We write to pd[1] */
11606 close(pu[1]); /* We read from pu[0] */
11607 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11608 close(pd[1]); /* Pipe pd is now fully closed! */
11609 exit(0); /* Bye bye, thank you for playing! */
11610}
11611EOCP
11612 set try
11613 if eval $compile_ok; then
11614 echo "$startsh" >mtry
868439a2 11615 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11616 chmod +x mtry
11617 ./mtry >/dev/null 2>&1
11618 case $? in
11619 0) eagain=`$cat try.out`;;
11620 1) echo "Could not perform non-blocking setting!";;
11621 2) echo "I did a successful read() for something that was not there!";;
11622 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11623 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11624 *) echo "Something terribly wrong happened during testing.";;
11625 esac
11626 rd_nodata=`$cat try.ret`
11627 echo "A read() system call with no data present returns $rd_nodata."
11628 case "$rd_nodata" in
11629 0|-1) ;;
11630 *)
11631 echo "(That's peculiar, fixing that to be -1.)"
11632 rd_nodata=-1
11633 ;;
11634 esac
11635 case "$eagain" in
11636 '')
11637 echo "Forcing errno EAGAIN on read() with no data available."
11638 eagain=EAGAIN
11639 ;;
11640 *)
11641 echo "Your read() sets errno to $eagain when no data is available."
11642 ;;
11643 esac
11644 status=`$cat try.err`
11645 case "$status" in
11646 0) echo "And it correctly returns 0 to signal EOF.";;
11647 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11648 *) echo "However, your read() returns '$status' on EOF??";;
11649 esac
11650 val="$define"
11651 if test "$status" = "$rd_nodata"; then
11652 echo "WARNING: you can't distinguish between EOF and no data!"
11653 val="$undef"
11654 fi
11655 else
11656 echo "I can't compile the test program--assuming errno EAGAIN will do."
11657 eagain=EAGAIN
11658 fi
11659 set d_eofnblk
11660 eval $setvar
11661 ;;
11662*)
11663 echo "Using $hint value $eagain."
11664 echo "Your read() returns $rd_nodata when no data is present."
11665 case "$d_eofnblk" in
11666 "$define") echo "And you can see EOF because read() returns 0.";;
11667 "$undef") echo "But you can't see EOF status from read() returned value.";;
11668 *)
11669 echo "(Assuming you can't see EOF status from read anyway.)"
11670 d_eofnblk=$undef
11671 ;;
11672 esac
11673 ;;
11674esac
11675$rm -f try try.* .out core head.c mtry
11676
b363b713
JH
11677: see if fchdir exists
11678set fchdir d_fchdir
11679eval $inlibc
11680
b4eb6b3d
JH
11681: see if fchmod exists
11682set fchmod d_fchmod
11683eval $inlibc
11684
11685: see if fchown exists
11686set fchown d_fchown
11687eval $inlibc
11688
11689: see if this is an fcntl system
11690set fcntl d_fcntl
11691eval $inlibc
11692
9d9004a9
AD
11693echo " "
11694: See if fcntl-based locking works.
832492ee 11695$cat >try.c <<EOCP
9d9004a9
AD
11696#include <stdlib.h>
11697#include <unistd.h>
11698#include <fcntl.h>
832492ee 11699#include <signal.h>
832492ee 11700$signal_t blech(x) int x; { exit(3); }
9d9004a9
AD
11701int main() {
11702#if defined(F_SETLK) && defined(F_SETLKW)
11703 struct flock flock;
11704 int retval, fd;
11705 fd = open("try.c", O_RDONLY);
11706 flock.l_type = F_RDLCK;
11707 flock.l_whence = SEEK_SET;
11708 flock.l_start = flock.l_len = 0;
832492ee
JH
11709 signal(SIGALRM, blech);
11710 alarm(10);
9d9004a9
AD
11711 retval = fcntl(fd, F_SETLK, &flock);
11712 close(fd);
11713 (retval < 0 ? exit(2) : exit(0));
11714#else
11715 exit(2);
11716#endif
11717}
11718EOCP
11719echo "Checking if fcntl-based file locking works... "
11720case "$d_fcntl" in
11721"$define")
11722 set try
11723 if eval $compile_ok; then
5440bc8e 11724 if $run ./try; then
9d9004a9
AD
11725 echo "Yes, it seems to work."
11726 val="$define"
11727 else
11728 echo "Nope, it didn't work."
11729 val="$undef"
832492ee
JH
11730 case "$?" in
11731 3) $cat >&4 <<EOM
11732***
11733*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11734*** This is (almost) impossible.
11735*** If your NFS lock daemons are not feeling well, something like
11736*** this may happen, please investigate. Cannot continue, aborting.
11737***
11738EOM
11739 exit 1
11740 ;;
11741 esac
9d9004a9
AD
11742 fi
11743 else
11744 echo "I'm unable to compile the test program, so I'll assume not."
11745 val="$undef"
11746 fi
11747 ;;
11748*) val="$undef";
11749 echo "Nope, since you don't even have fcntl()."
11750 ;;
11751esac
11752set d_fcntl_can_lock
11753eval $setvar
11754$rm -f try*
11755
11756
b4eb6b3d
JH
11757: check for fd_set items
11758$cat <<EOM
11759
11760Checking to see how well your C compiler handles fd_set and friends ...
11761EOM
5440bc8e 11762$cat >try.c <<EOCP
b4eb6b3d
JH
11763#$i_systime I_SYS_TIME
11764#$i_sysselct I_SYS_SELECT
11765#$d_socket HAS_SOCKET
11766#include <sys/types.h>
11767#ifdef HAS_SOCKET
11768#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11769#endif
11770#ifdef I_SYS_TIME
11771#include <sys/time.h>
11772#endif
11773#ifdef I_SYS_SELECT
11774#include <sys/select.h>
11775#endif
11776int main() {
11777 fd_set fds;
11778
11779#ifdef TRYBITS
11780 if(fds.fds_bits);
11781#endif
11782
11783#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11784 exit(0);
11785#else
11786 exit(1);
11787#endif
11788}
11789EOCP
5440bc8e 11790set try -DTRYBITS
b4eb6b3d
JH
11791if eval $compile; then
11792 d_fds_bits="$define"
11793 d_fd_set="$define"
11794 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 11795 if $run ./try; then
b4eb6b3d
JH
11796 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11797 d_fd_macros="$define"
11798 else
11799 $cat >&4 <<'EOM'
11800but not the normal fd_set macros! Gaaack! I'll have to cover for you.
11801EOM
11802 d_fd_macros="$undef"
11803 fi
11804else
11805 $cat <<'EOM'
11806Hmm, your compiler has some difficulty with fd_set. Checking further...
11807EOM
5440bc8e 11808 set try
b4eb6b3d
JH
11809 if eval $compile; then
11810 d_fds_bits="$undef"
11811 d_fd_set="$define"
11812 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 11813 if $run ./try; then
b4eb6b3d
JH
11814 echo "and you have the normal fd_set macros." >&4
11815 d_fd_macros="$define"
11816 else
11817 $cat <<'EOM'
11818but not the normal fd_set macros! Gross! More work for me...
11819EOM
11820 d_fd_macros="$undef"
11821 fi
11822 else
11823 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
11824 d_fd_set="$undef"
11825 d_fds_bits="$undef"
11826 d_fd_macros="$undef"
11827 fi
11828fi
5440bc8e 11829$rm -f try try.*
b4eb6b3d
JH
11830
11831: see if fgetpos exists
11832set fgetpos d_fgetpos
11833eval $inlibc
11834
758a5d79
JH
11835: see if finite exists
11836set finite d_finite
11837eval $inlibc
11838
11839: see if finitel exists
11840set finitel d_finitel
11841eval $inlibc
11842
b4eb6b3d
JH
11843: see if flock exists
11844set flock d_flock
11845eval $inlibc
11846
2ef53570
JH
11847: see if prototype for flock is available
11848echo " "
11849set d_flockproto flock $i_sysfile sys/file.h
11850eval $hasproto
11851
b4eb6b3d
JH
11852: see if fork exists
11853set fork d_fork
11854eval $inlibc
11855
758a5d79
JH
11856: see if fp_class exists
11857set fp_class d_fp_class
11858eval $inlibc
11859
b4eb6b3d
JH
11860: see if pathconf exists
11861set pathconf d_pathconf
11862eval $inlibc
11863
11864: see if fpathconf exists
11865set fpathconf d_fpathconf
11866eval $inlibc
11867
758a5d79
JH
11868: see if fpclass exists
11869set fpclass d_fpclass
11870eval $inlibc
11871
11872: see if fpclassify exists
11873set fpclassify d_fpclassify
11874eval $inlibc
11875
11876: see if fpclassl exists
11877set fpclassl d_fpclassl
11878eval $inlibc
11879
b4eb6b3d
JH
11880
11881: check for fpos64_t
11882echo " "
11883echo "Checking to see if you have fpos64_t..." >&4
11884$cat >try.c <<EOCP
11885#include <stdio.h>
11886int main() { fpos64_t x = 7; }
11887EOCP
11888set try
11889if eval $compile; then
11890 val="$define"
11891 echo "You have fpos64_t."
11892else
11893 val="$undef"
11894 echo "You do not have fpos64_t."
11895 case "$fpossize" in
11896 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11897 esac
11898fi
11899$rm -f try.* try
11900set d_fpos64_t
11901eval $setvar
11902
11903: see if frexpl exists
11904set frexpl d_frexpl
11905eval $inlibc
11906
b4eb6b3d
JH
11907: see if this is a sys/param system
11908set sys/param.h i_sysparam
11909eval $inhdr
11910
11911: see if this is a sys/mount.h system
11912set sys/mount.h i_sysmount
11913eval $inhdr
11914
b4eb6b3d
JH
11915
11916echo " "
11917echo "Checking to see if your system supports struct fs_data..." >&4
11918set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11919eval $hasstruct
11920case "$d_fs_data_s" in
11921"$define") echo "Yes, it does." ;;
11922*) echo "No, it doesn't." ;;
11923esac
11924
11925: see if fseeko exists
11926set fseeko d_fseeko
11927eval $inlibc
11928case "$longsize" in
119298) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11930esac
11931
11932: see if fsetpos exists
11933set fsetpos d_fsetpos
11934eval $inlibc
11935
11936
11937: see if fstatfs exists
11938set fstatfs d_fstatfs
11939eval $inlibc
11940
11941
11942: see if statvfs exists
11943set statvfs d_statvfs
11944eval $inlibc
11945
11946: see if fstatvfs exists
11947set fstatvfs d_fstatvfs
11948eval $inlibc
11949
11950
411ab01c
JH
11951: see if fsync exists
11952set fsync d_fsync
11953eval $inlibc
11954
b4eb6b3d
JH
11955: see if ftello exists
11956set ftello d_ftello
11957eval $inlibc
11958case "$longsize" in
119598) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11960esac
11961
11962: see if getcwd exists
11963set getcwd d_getcwd
11964eval $inlibc
11965
11966: see if getespwnam exists
11967set getespwnam d_getespwnam
11968eval $inlibc
11969
11970
11971: see if getfsstat exists
11972set getfsstat d_getfsstat
11973eval $inlibc
11974
11975: see if getgrent exists
11976set getgrent d_getgrent
11977eval $inlibc
11978
10bc17b6
JH
11979: see if getgrent_r exists
11980set getgrent_r d_getgrent_r
11981eval $inlibc
11982case "$d_getgrent_r" in
11983"$define")
11984 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11985 case "$d_getgrent_r_proto:$usethreads" in
11986 ":define") d_getgrent_r_proto=define
a48ec845
JH
11987 set d_getgrent_r_proto getgrent_r $hdrs
11988 eval $hasproto ;;
11989 *) ;;
11990 esac
11991 case "$d_getgrent_r_proto" in
11992 define)
10bc17b6
JH
11993 case "$getgrent_r_proto" in
11994 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11995 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11996 esac
11997 case "$getgrent_r_proto" in
11998 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11999 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12000 esac
12001 case "$getgrent_r_proto" in
12002 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12003 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12004 esac
12005 case "$getgrent_r_proto" in
12006 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12007 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12008 esac
12009 case "$getgrent_r_proto" in
12010 ''|0) try='int getgrent_r(struct group*, char*, int);'
12011 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12012 esac
12013 case "$getgrent_r_proto" in
12014 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12015 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12016 esac
12017 case "$getgrent_r_proto" in
90e831dc 12018 ''|0) d_getgrent_r=undef
10bc17b6 12019 getgrent_r_proto=0
a48ec845 12020 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12021 * ) case "$getgrent_r_proto" in
12022 REENTRANT_PROTO*) ;;
12023 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12024 esac
12025 echo "Prototype: $try" ;;
12026 esac
12027 ;;
c18e646a
JH
12028 *) case "$usethreads" in
12029 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12030 esac
90e831dc
SB
12031 d_getgrent_r=undef
12032 getgrent_r_proto=0
c18e646a 12033 ;;
a48ec845
JH
12034 esac
12035 ;;
10bc17b6
JH
12036*) getgrent_r_proto=0
12037 ;;
12038esac
12039
12040: see if getgrgid_r exists
12041set getgrgid_r d_getgrgid_r
12042eval $inlibc
12043case "$d_getgrgid_r" in
12044"$define")
12045 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12046 case "$d_getgrgid_r_proto:$usethreads" in
12047 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12048 set d_getgrgid_r_proto getgrgid_r $hdrs
12049 eval $hasproto ;;
12050 *) ;;
12051 esac
12052 case "$d_getgrgid_r_proto" in
12053 define)
10bc17b6
JH
12054 case "$getgrgid_r_proto" in
12055 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12056 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12057 esac
12058 case "$getgrgid_r_proto" in
12059 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12060 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12061 esac
12062 case "$getgrgid_r_proto" in
12063 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12064 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12065 esac
12066 case "$getgrgid_r_proto" in
12067 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12068 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12069 esac
12070 case "$getgrgid_r_proto" in
90e831dc 12071 ''|0) d_getgrgid_r=undef
10bc17b6 12072 getgrgid_r_proto=0
a48ec845 12073 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12074 * ) case "$getgrgid_r_proto" in
12075 REENTRANT_PROTO*) ;;
12076 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12077 esac
12078 echo "Prototype: $try" ;;
12079 esac
12080 ;;
c18e646a
JH
12081 *) case "$usethreads" in
12082 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12083 esac
90e831dc
SB
12084 d_getgrgid_r=undef
12085 getgrgid_r_proto=0
c18e646a 12086 ;;
a48ec845
JH
12087 esac
12088 ;;
10bc17b6
JH
12089*) getgrgid_r_proto=0
12090 ;;
12091esac
12092
12093: see if getgrnam_r exists
12094set getgrnam_r d_getgrnam_r
12095eval $inlibc
12096case "$d_getgrnam_r" in
12097"$define")
12098 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12099 case "$d_getgrnam_r_proto:$usethreads" in
12100 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12101 set d_getgrnam_r_proto getgrnam_r $hdrs
12102 eval $hasproto ;;
12103 *) ;;
12104 esac
12105 case "$d_getgrnam_r_proto" in
12106 define)
10bc17b6
JH
12107 case "$getgrnam_r_proto" in
12108 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12109 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12110 esac
12111 case "$getgrnam_r_proto" in
12112 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12113 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12114 esac
12115 case "$getgrnam_r_proto" in
12116 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12117 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12118 esac
12119 case "$getgrnam_r_proto" in
12120 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12121 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12122 esac
12123 case "$getgrnam_r_proto" in
12124 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12125 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12126 esac
12127 case "$getgrnam_r_proto" in
90e831dc 12128 ''|0) d_getgrnam_r=undef
10bc17b6 12129 getgrnam_r_proto=0
a48ec845 12130 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12131 * ) case "$getgrnam_r_proto" in
12132 REENTRANT_PROTO*) ;;
12133 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12134 esac
12135 echo "Prototype: $try" ;;
12136 esac
12137 ;;
c18e646a
JH
12138 *) case "$usethreads" in
12139 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12140 esac
90e831dc
SB
12141 d_getgrnam_r=undef
12142 getgrnam_r_proto=0
c18e646a 12143 ;;
a48ec845
JH
12144 esac
12145 ;;
10bc17b6
JH
12146*) getgrnam_r_proto=0
12147 ;;
12148esac
12149
b4eb6b3d
JH
12150: see if gethostbyaddr exists
12151set gethostbyaddr d_gethbyaddr
12152eval $inlibc
12153
12154: see if gethostbyname exists
12155set gethostbyname d_gethbyname
12156eval $inlibc
12157
12158: see if gethostent exists
12159set gethostent d_gethent
12160eval $inlibc
12161
12162: see how we will look up host name
12163echo " "
12164call=''
12165if set gethostname val -f d_gethname; eval $csym; $val; then
12166 echo 'gethostname() found.' >&4
12167 d_gethname="$define"
12168 call=gethostname
12169fi
12170if set uname val -f d_uname; eval $csym; $val; then
12171 if ./xenix; then
12172 $cat <<'EOM'
12173uname() was found, but you're running xenix, and older versions of xenix
12174have a broken uname(). If you don't really know whether your xenix is old
12175enough to have a broken system call, use the default answer.
12176
12177EOM
12178 dflt=y
12179 case "$d_uname" in
12180 "$define") dflt=n;;
12181 esac
12182 rp='Is your uname() broken?'
12183 . ./myread
12184 case "$ans" in
12185 n*) d_uname="$define"; call=uname;;
12186 esac
12187 else
12188 echo 'uname() found.' >&4
12189 d_uname="$define"
12190 case "$call" in
12191 '') call=uname ;;
12192 esac
12193 fi
12194fi
12195case "$d_gethname" in
12196'') d_gethname="$undef";;
12197esac
12198case "$d_uname" in
12199'') d_uname="$undef";;
12200esac
12201case "$d_uname$d_gethname" in
12202*define*)
12203 dflt=n
12204 cat <<EOM
12205
12206Every now and then someone has a $call() that lies about the hostname
12207but can't be fixed for political or economic reasons. If you wish, I can
12208pretend $call() isn't there and maybe compute hostname at run-time
12209thanks to the '$phostname' command.
12210
12211EOM
12212 rp="Shall I ignore $call() from now on?"
12213 . ./myread
12214 case "$ans" in
12215 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12216 esac;;
12217esac
12218case "$phostname" in
12219'') aphostname='';;
12220*) case "$aphostname" in
12221 /*) ;;
12222 *) set X $phostname
12223 shift
12224 file=$1
12225 shift
12226 file=`./loc $file $file $pth`
12227 aphostname=`echo $file $*`
12228 ;;
12229 esac
12230 ;;
12231esac
12232case "$d_uname$d_gethname" in
12233*define*) ;;
12234*)
12235 case "$phostname" in
12236 '')
12237 echo "There will be no way for $package to get your hostname." >&4;;
12238 *)
12239 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12240 ;;
12241 esac;;
12242esac
12243case "$d_phostname" in
12244'') d_phostname="$undef";;
12245esac
12246
10bc17b6
JH
12247: see if gethostbyaddr_r exists
12248set gethostbyaddr_r d_gethostbyaddr_r
12249eval $inlibc
12250case "$d_gethostbyaddr_r" in
12251"$define")
12252 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12253 case "$d_gethostbyaddr_r_proto:$usethreads" in
12254 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12255 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12256 eval $hasproto ;;
12257 *) ;;
12258 esac
12259 case "$d_gethostbyaddr_r_proto" in
12260 define)
10bc17b6
JH
12261 case "$gethostbyaddr_r_proto" in
12262 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12263 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12264 esac
12265 case "$gethostbyaddr_r_proto" in
12266 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12267 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12268 esac
12269 case "$gethostbyaddr_r_proto" in
12270 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12271 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12272 esac
12273 case "$gethostbyaddr_r_proto" in
12274 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12275 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12276 esac
12277 case "$gethostbyaddr_r_proto" in
12278 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12279 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12280 esac
12281 case "$gethostbyaddr_r_proto" in
12282 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12283 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12284 esac
12285 case "$gethostbyaddr_r_proto" in
12286 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12287 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12288 esac
12289 case "$gethostbyaddr_r_proto" in
12290 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12291 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12292 esac
12293 case "$gethostbyaddr_r_proto" in
12294 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12295 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12296 esac
12297 case "$gethostbyaddr_r_proto" in
12298 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12299 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12300 esac
12301 case "$gethostbyaddr_r_proto" in
90e831dc 12302 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12303 gethostbyaddr_r_proto=0
a48ec845 12304 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12305 * ) case "$gethostbyaddr_r_proto" in
12306 REENTRANT_PROTO*) ;;
12307 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12308 esac
12309 echo "Prototype: $try" ;;
12310 esac
12311 ;;
c18e646a
JH
12312 *) case "$usethreads" in
12313 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12314 esac
90e831dc
SB
12315 d_gethostbyaddr_r=undef
12316 gethostbyaddr_r_proto=0
c18e646a 12317 ;;
a48ec845
JH
12318 esac
12319 ;;
10bc17b6
JH
12320*) gethostbyaddr_r_proto=0
12321 ;;
12322esac
12323
12324: see if gethostbyname_r exists
12325set gethostbyname_r d_gethostbyname_r
12326eval $inlibc
12327case "$d_gethostbyname_r" in
12328"$define")
12329 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12330 case "$d_gethostbyname_r_proto:$usethreads" in
12331 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
12332 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12333 eval $hasproto ;;
12334 *) ;;
12335 esac
12336 case "$d_gethostbyname_r_proto" in
12337 define)
10bc17b6
JH
12338 case "$gethostbyname_r_proto" in
12339 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12340 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12341 esac
12342 case "$gethostbyname_r_proto" in
12343 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12344 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12345 esac
12346 case "$gethostbyname_r_proto" in
12347 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12348 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12349 esac
12350 case "$gethostbyname_r_proto" in
90e831dc 12351 ''|0) d_gethostbyname_r=undef
10bc17b6 12352 gethostbyname_r_proto=0
a48ec845 12353 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12354 * ) case "$gethostbyname_r_proto" in
12355 REENTRANT_PROTO*) ;;
12356 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12357 esac
12358 echo "Prototype: $try" ;;
12359 esac
12360 ;;
c18e646a
JH
12361 *) case "$usethreads" in
12362 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12363 esac
90e831dc
SB
12364 d_gethostbyname_r=undef
12365 gethostbyname_r_proto=0
c18e646a 12366 ;;
a48ec845
JH
12367 esac
12368 ;;
10bc17b6
JH
12369*) gethostbyname_r_proto=0
12370 ;;
12371esac
12372
12373: see if gethostent_r exists
12374set gethostent_r d_gethostent_r
12375eval $inlibc
12376case "$d_gethostent_r" in
12377"$define")
12378 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12379 case "$d_gethostent_r_proto:$usethreads" in
12380 ":define") d_gethostent_r_proto=define
a48ec845
JH
12381 set d_gethostent_r_proto gethostent_r $hdrs
12382 eval $hasproto ;;
12383 *) ;;
12384 esac
12385 case "$d_gethostent_r_proto" in
12386 define)
10bc17b6
JH
12387 case "$gethostent_r_proto" in
12388 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12389 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12390 esac
12391 case "$gethostent_r_proto" in
12392 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12393 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12394 esac
12395 case "$gethostent_r_proto" in
12396 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12397 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12398 esac
12399 case "$gethostent_r_proto" in
12400 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12401 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12402 esac
12403 case "$gethostent_r_proto" in
12404 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12405 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12406 esac
12407 case "$gethostent_r_proto" in
12408 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12409 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12410 esac
12411 case "$gethostent_r_proto" in
90e831dc 12412 ''|0) d_gethostent_r=undef
10bc17b6 12413 gethostent_r_proto=0
a48ec845 12414 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12415 * ) case "$gethostent_r_proto" in
12416 REENTRANT_PROTO*) ;;
12417 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12418 esac
12419 echo "Prototype: $try" ;;
12420 esac
12421 ;;
c18e646a
JH
12422 *) case "$usethreads" in
12423 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12424 esac
90e831dc
SB
12425 d_gethostent_r=undef
12426 gethostent_r_proto=0
c18e646a 12427 ;;
a48ec845
JH
12428 esac
12429 ;;
10bc17b6
JH
12430*) gethostent_r_proto=0
12431 ;;
12432esac
b4eb6b3d
JH
12433
12434: see if prototypes for various gethostxxx netdb.h functions are available
12435echo " "
12436set d_gethostprotos gethostent $i_netdb netdb.h
12437eval $hasproto
12438
4e0554ec
JH
12439: see if getitimer exists
12440set getitimer d_getitimer
12441eval $inlibc
12442
b4eb6b3d
JH
12443: see if getlogin exists
12444set getlogin d_getlogin
12445eval $inlibc
12446
10bc17b6
JH
12447: see if getlogin_r exists
12448set getlogin_r d_getlogin_r
12449eval $inlibc
12450case "$d_getlogin_r" in
12451"$define")
12452 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
12453 case "$d_getlogin_r_proto:$usethreads" in
12454 ":define") d_getlogin_r_proto=define
a48ec845
JH
12455 set d_getlogin_r_proto getlogin_r $hdrs
12456 eval $hasproto ;;
12457 *) ;;
12458 esac
12459 case "$d_getlogin_r_proto" in
12460 define)
10bc17b6
JH
12461 case "$getlogin_r_proto" in
12462 ''|0) try='int getlogin_r(char*, size_t);'
12463 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12464 esac
12465 case "$getlogin_r_proto" in
12466 ''|0) try='int getlogin_r(char*, int);'
12467 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12468 esac
12469 case "$getlogin_r_proto" in
12470 ''|0) try='char* getlogin_r(char*, size_t);'
12471 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12472 esac
12473 case "$getlogin_r_proto" in
12474 ''|0) try='char* getlogin_r(char*, int);'
12475 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12476 esac
12477 case "$getlogin_r_proto" in
90e831dc 12478 ''|0) d_getlogin_r=undef
10bc17b6 12479 getlogin_r_proto=0
a48ec845 12480 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12481 * ) case "$getlogin_r_proto" in
12482 REENTRANT_PROTO*) ;;
12483 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12484 esac
12485 echo "Prototype: $try" ;;
12486 esac
12487 ;;
c18e646a
JH
12488 *) case "$usethreads" in
12489 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12490 esac
90e831dc
SB
12491 d_getlogin_r=undef
12492 getlogin_r_proto=0
c18e646a 12493 ;;
a48ec845
JH
12494 esac
12495 ;;
10bc17b6
JH
12496*) getlogin_r_proto=0
12497 ;;
12498esac
12499
b4eb6b3d
JH
12500: see if getmnt exists
12501set getmnt d_getmnt
12502eval $inlibc
12503
12504: see if getmntent exists
12505set getmntent d_getmntent
12506eval $inlibc
12507
12508: see if getnetbyaddr exists
12509set getnetbyaddr d_getnbyaddr
12510eval $inlibc
12511
12512: see if getnetbyname exists
12513set getnetbyname d_getnbyname
12514eval $inlibc
12515
12516: see if getnetent exists
12517set getnetent d_getnent
12518eval $inlibc
12519
10bc17b6
JH
12520: see if getnetbyaddr_r exists
12521set getnetbyaddr_r d_getnetbyaddr_r
12522eval $inlibc
12523case "$d_getnetbyaddr_r" in
12524"$define")
12525 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12526 case "$d_getnetbyaddr_r_proto:$usethreads" in
12527 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
12528 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12529 eval $hasproto ;;
12530 *) ;;
12531 esac
12532 case "$d_getnetbyaddr_r_proto" in
12533 define)
10bc17b6
JH
12534 case "$getnetbyaddr_r_proto" in
12535 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12536 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12537 esac
12538 case "$getnetbyaddr_r_proto" in
12539 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12540 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12541 esac
12542 case "$getnetbyaddr_r_proto" in
12543 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12544 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12545 esac
12546 case "$getnetbyaddr_r_proto" in
12547 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12548 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12549 esac
12550 case "$getnetbyaddr_r_proto" in
12551 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12552 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12553 esac
12554 case "$getnetbyaddr_r_proto" in
12555 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12556 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12557 esac
12558 case "$getnetbyaddr_r_proto" in
12559 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12560 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12561 esac
12562 case "$getnetbyaddr_r_proto" in
90e831dc 12563 ''|0) d_getnetbyaddr_r=undef
10bc17b6 12564 getnetbyaddr_r_proto=0
a48ec845 12565 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12566 * ) case "$getnetbyaddr_r_proto" in
12567 REENTRANT_PROTO*) ;;
12568 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12569 esac
12570 echo "Prototype: $try" ;;
12571 esac
12572 ;;
c18e646a
JH
12573 *) case "$usethreads" in
12574 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12575 esac
90e831dc
SB
12576 d_getnetbyaddr_r=undef
12577 getnetbyaddr_r_proto=0
c18e646a 12578 ;;
a48ec845
JH
12579 esac
12580 ;;
10bc17b6
JH
12581*) getnetbyaddr_r_proto=0
12582 ;;
12583esac
12584
12585: see if getnetbyname_r exists
12586set getnetbyname_r d_getnetbyname_r
12587eval $inlibc
12588case "$d_getnetbyname_r" in
12589"$define")
12590 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12591 case "$d_getnetbyname_r_proto:$usethreads" in
12592 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
12593 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12594 eval $hasproto ;;
12595 *) ;;
12596 esac
12597 case "$d_getnetbyname_r_proto" in
12598 define)
10bc17b6
JH
12599 case "$getnetbyname_r_proto" in
12600 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12601 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12602 esac
12603 case "$getnetbyname_r_proto" in
12604 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12605 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12606 esac
12607 case "$getnetbyname_r_proto" in
12608 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12609 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12610 esac
12611 case "$getnetbyname_r_proto" in
12612 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12613 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12614 esac
12615 case "$getnetbyname_r_proto" in
90e831dc 12616 ''|0) d_getnetbyname_r=undef
10bc17b6 12617 getnetbyname_r_proto=0
a48ec845 12618 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12619 * ) case "$getnetbyname_r_proto" in
12620 REENTRANT_PROTO*) ;;
12621 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12622 esac
12623 echo "Prototype: $try" ;;
12624 esac
12625 ;;
c18e646a
JH
12626 *) case "$usethreads" in
12627 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12628 esac
90e831dc
SB
12629 d_getnetbyname_r=undef
12630 getnetbyname_r_proto=0
c18e646a 12631 ;;
a48ec845
JH
12632 esac
12633 ;;
10bc17b6
JH
12634*) getnetbyname_r_proto=0
12635 ;;
12636esac
12637
12638: see if getnetent_r exists
12639set getnetent_r d_getnetent_r
12640eval $inlibc
12641case "$d_getnetent_r" in
12642"$define")
12643 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12644 case "$d_getnetent_r_proto:$usethreads" in
12645 ":define") d_getnetent_r_proto=define
a48ec845
JH
12646 set d_getnetent_r_proto getnetent_r $hdrs
12647 eval $hasproto ;;
12648 *) ;;
12649 esac
12650 case "$d_getnetent_r_proto" in
12651 define)
10bc17b6
JH
12652 case "$getnetent_r_proto" in
12653 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12654 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12655 esac
12656 case "$getnetent_r_proto" in
12657 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12658 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12659 esac
12660 case "$getnetent_r_proto" in
12661 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12662 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12663 esac
12664 case "$getnetent_r_proto" in
12665 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12666 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12667 esac
12668 case "$getnetent_r_proto" in
12669 ''|0) try='int getnetent_r(struct netent*, char*, int);'
12670 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12671 esac
12672 case "$getnetent_r_proto" in
12673 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12674 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12675 esac
12676 case "$getnetent_r_proto" in
90e831dc 12677 ''|0) d_getnetent_r=undef
10bc17b6 12678 getnetent_r_proto=0
a48ec845 12679 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12680 * ) case "$getnetent_r_proto" in
12681 REENTRANT_PROTO*) ;;
12682 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12683 esac
12684 echo "Prototype: $try" ;;
12685 esac
12686 ;;
c18e646a
JH
12687 *) case "$usethreads" in
12688 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12689 esac
90e831dc
SB
12690 d_getnetent_r=undef
12691 getnetent_r_proto=0
c18e646a 12692 ;;
a48ec845
JH
12693 esac
12694 ;;
10bc17b6
JH
12695*) getnetent_r_proto=0
12696 ;;
12697esac
12698
b4eb6b3d
JH
12699: see if prototypes for various getnetxxx netdb.h functions are available
12700echo " "
12701set d_getnetprotos getnetent $i_netdb netdb.h
12702eval $hasproto
12703
0c0643d0
JH
12704: see if getpagesize exists
12705set getpagesize d_getpagsz
12706eval $inlibc
12707
b4eb6b3d
JH
12708
12709: see if getprotobyname exists
12710set getprotobyname d_getpbyname
12711eval $inlibc
12712
12713: see if getprotobynumber exists
12714set getprotobynumber d_getpbynumber
12715eval $inlibc
12716
12717: see if getprotoent exists
12718set getprotoent d_getpent
12719eval $inlibc
12720
12721: see if getpgid exists
12722set getpgid d_getpgid
12723eval $inlibc
12724
12725: see if getpgrp2 exists
12726set getpgrp2 d_getpgrp2
12727eval $inlibc
12728
12729: see if getppid exists
12730set getppid d_getppid
12731eval $inlibc
12732
12733: see if getpriority exists
12734set getpriority d_getprior
12735eval $inlibc
12736
10bc17b6
JH
12737: see if getprotobyname_r exists
12738set getprotobyname_r d_getprotobyname_r
12739eval $inlibc
12740case "$d_getprotobyname_r" in
12741"$define")
12742 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12743 case "$d_getprotobyname_r_proto:$usethreads" in
12744 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
12745 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12746 eval $hasproto ;;
12747 *) ;;
12748 esac
12749 case "$d_getprotobyname_r_proto" in
12750 define)
10bc17b6
JH
12751 case "$getprotobyname_r_proto" in
12752 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12753 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12754 esac
12755 case "$getprotobyname_r_proto" in
12756 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12757 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12758 esac
12759 case "$getprotobyname_r_proto" in
12760 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12761 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12762 esac
12763 case "$getprotobyname_r_proto" in
90e831dc 12764 ''|0) d_getprotobyname_r=undef
10bc17b6 12765 getprotobyname_r_proto=0
a48ec845 12766 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12767 * ) case "$getprotobyname_r_proto" in
12768 REENTRANT_PROTO*) ;;
12769 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12770 esac
12771 echo "Prototype: $try" ;;
12772 esac
12773 ;;
c18e646a
JH
12774 *) case "$usethreads" in
12775 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12776 esac
90e831dc
SB
12777 d_getprotobyname_r=undef
12778 getprotobyname_r_proto=0
c18e646a 12779 ;;
a48ec845
JH
12780 esac
12781 ;;
10bc17b6
JH
12782*) getprotobyname_r_proto=0
12783 ;;
12784esac
12785
12786: see if getprotobynumber_r exists
12787set getprotobynumber_r d_getprotobynumber_r
12788eval $inlibc
12789case "$d_getprotobynumber_r" in
12790"$define")
12791 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12792 case "$d_getprotobynumber_r_proto:$usethreads" in
12793 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
12794 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12795 eval $hasproto ;;
12796 *) ;;
12797 esac
12798 case "$d_getprotobynumber_r_proto" in
12799 define)
10bc17b6
JH
12800 case "$getprotobynumber_r_proto" in
12801 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12802 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12803 esac
12804 case "$getprotobynumber_r_proto" in
12805 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12806 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12807 esac
12808 case "$getprotobynumber_r_proto" in
12809 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12810 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12811 esac
12812 case "$getprotobynumber_r_proto" in
90e831dc 12813 ''|0) d_getprotobynumber_r=undef
10bc17b6 12814 getprotobynumber_r_proto=0
a48ec845 12815 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12816 * ) case "$getprotobynumber_r_proto" in
12817 REENTRANT_PROTO*) ;;
12818 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12819 esac
12820 echo "Prototype: $try" ;;
12821 esac
12822 ;;
c18e646a
JH
12823 *) case "$usethreads" in
12824 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12825 esac
90e831dc
SB
12826 d_getprotobynumber_r=undef
12827 getprotobynumber_r_proto=0
c18e646a 12828 ;;
a48ec845
JH
12829 esac
12830 ;;
10bc17b6
JH
12831*) getprotobynumber_r_proto=0
12832 ;;
12833esac
12834
12835: see if getprotoent_r exists
12836set getprotoent_r d_getprotoent_r
12837eval $inlibc
12838case "$d_getprotoent_r" in
12839"$define")
12840 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12841 case "$d_getprotoent_r_proto:$usethreads" in
12842 ":define") d_getprotoent_r_proto=define
a48ec845
JH
12843 set d_getprotoent_r_proto getprotoent_r $hdrs
12844 eval $hasproto ;;
12845 *) ;;
12846 esac
12847 case "$d_getprotoent_r_proto" in
12848 define)
10bc17b6
JH
12849 case "$getprotoent_r_proto" in
12850 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12851 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12852 esac
12853 case "$getprotoent_r_proto" in
12854 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12855 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12856 esac
12857 case "$getprotoent_r_proto" in
12858 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12859 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12860 esac
12861 case "$getprotoent_r_proto" in
12862 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12863 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12864 esac
12865 case "$getprotoent_r_proto" in
90e831dc 12866 ''|0) d_getprotoent_r=undef
10bc17b6 12867 getprotoent_r_proto=0
a48ec845 12868 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12869 * ) case "$getprotoent_r_proto" in
12870 REENTRANT_PROTO*) ;;
12871 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12872 esac
12873 echo "Prototype: $try" ;;
12874 esac
12875 ;;
c18e646a
JH
12876 *) case "$usethreads" in
12877 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12878 esac
90e831dc
SB
12879 d_getprotoent_r=undef
12880 getprotoent_r_proto=0
c18e646a 12881 ;;
a48ec845
JH
12882 esac
12883 ;;
10bc17b6
JH
12884*) getprotoent_r_proto=0
12885 ;;
12886esac
12887
b4eb6b3d
JH
12888: see if prototypes for various getprotoxxx netdb.h functions are available
12889echo " "
12890set d_getprotoprotos getprotoent $i_netdb netdb.h
12891eval $hasproto
12892
12893: see if getprpwnam exists
12894set getprpwnam d_getprpwnam
12895eval $inlibc
12896
12897: see if getpwent exists
12898set getpwent d_getpwent
12899eval $inlibc
12900
10bc17b6
JH
12901: see if getpwent_r exists
12902set getpwent_r d_getpwent_r
12903eval $inlibc
12904case "$d_getpwent_r" in
12905"$define")
12906 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12907 case "$d_getpwent_r_proto:$usethreads" in
12908 ":define") d_getpwent_r_proto=define
a48ec845
JH
12909 set d_getpwent_r_proto getpwent_r $hdrs
12910 eval $hasproto ;;
12911 *) ;;
12912 esac
12913 case "$d_getpwent_r_proto" in
12914 define)
10bc17b6
JH
12915 case "$getpwent_r_proto" in
12916 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12917 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12918 esac
12919 case "$getpwent_r_proto" in
12920 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12921 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12922 esac
12923 case "$getpwent_r_proto" in
12924 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12925 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12926 esac
12927 case "$getpwent_r_proto" in
12928 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12929 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12930 esac
12931 case "$getpwent_r_proto" in
12932 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12933 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12934 esac
12935 case "$getpwent_r_proto" in
12936 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12937 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12938 esac
12939 case "$getpwent_r_proto" in
90e831dc 12940 ''|0) d_getpwent_r=undef
10bc17b6 12941 getpwent_r_proto=0
a48ec845 12942 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12943 * ) case "$getpwent_r_proto" in
12944 REENTRANT_PROTO*) ;;
12945 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12946 esac
12947 echo "Prototype: $try" ;;
12948 esac
12949 ;;
c18e646a
JH
12950 *) case "$usethreads" in
12951 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12952 esac
90e831dc
SB
12953 d_getpwent_r=undef
12954 getpwent_r_proto=0
c18e646a 12955 ;;
a48ec845
JH
12956 esac
12957 ;;
10bc17b6
JH
12958*) getpwent_r_proto=0
12959 ;;
12960esac
12961
12962: see if getpwnam_r exists
12963set getpwnam_r d_getpwnam_r
12964eval $inlibc
12965case "$d_getpwnam_r" in
12966"$define")
12967 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12968 case "$d_getpwnam_r_proto:$usethreads" in
12969 ":define") d_getpwnam_r_proto=define
a48ec845
JH
12970 set d_getpwnam_r_proto getpwnam_r $hdrs
12971 eval $hasproto ;;
12972 *) ;;
12973 esac
12974 case "$d_getpwnam_r_proto" in
12975 define)
10bc17b6
JH
12976 case "$getpwnam_r_proto" in
12977 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12978 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12979 esac
12980 case "$getpwnam_r_proto" in
12981 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12982 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12983 esac
12984 case "$getpwnam_r_proto" in
12985 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12986 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12987 esac
12988 case "$getpwnam_r_proto" in
12989 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12990 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12991 esac
12992 case "$getpwnam_r_proto" in
90e831dc 12993 ''|0) d_getpwnam_r=undef
10bc17b6 12994 getpwnam_r_proto=0
a48ec845 12995 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12996 * ) case "$getpwnam_r_proto" in
12997 REENTRANT_PROTO*) ;;
12998 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12999 esac
13000 echo "Prototype: $try" ;;
13001 esac
13002 ;;
c18e646a
JH
13003 *) case "$usethreads" in
13004 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13005 esac
90e831dc
SB
13006 d_getpwnam_r=undef
13007 getpwnam_r_proto=0
c18e646a 13008 ;;
a48ec845
JH
13009 esac
13010 ;;
10bc17b6
JH
13011*) getpwnam_r_proto=0
13012 ;;
13013esac
13014
13015: see if getpwuid_r exists
13016set getpwuid_r d_getpwuid_r
13017eval $inlibc
13018case "$d_getpwuid_r" in
13019"$define")
13020 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13021 case "$d_getpwuid_r_proto:$usethreads" in
13022 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13023 set d_getpwuid_r_proto getpwuid_r $hdrs
13024 eval $hasproto ;;
13025 *) ;;
13026 esac
13027 case "$d_getpwuid_r_proto" in
13028 define)
10bc17b6
JH
13029 case "$getpwuid_r_proto" in
13030 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13031 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13032 esac
13033 case "$getpwuid_r_proto" in
13034 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13035 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13036 esac
13037 case "$getpwuid_r_proto" in
13038 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13039 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13040 esac
13041 case "$getpwuid_r_proto" in
13042 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13043 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13044 esac
13045 case "$getpwuid_r_proto" in
90e831dc 13046 ''|0) d_getpwuid_r=undef
10bc17b6 13047 getpwuid_r_proto=0
a48ec845 13048 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13049 * ) case "$getpwuid_r_proto" in
13050 REENTRANT_PROTO*) ;;
13051 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13052 esac
13053 echo "Prototype: $try" ;;
13054 esac
13055 ;;
c18e646a
JH
13056 *) case "$usethreads" in
13057 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13058 esac
90e831dc
SB
13059 d_getpwuid_r=undef
13060 getpwuid_r_proto=0
c18e646a 13061 ;;
a48ec845
JH
13062 esac
13063 ;;
10bc17b6
JH
13064*) getpwuid_r_proto=0
13065 ;;
13066esac
13067
b4eb6b3d
JH
13068
13069: see if getservbyname exists
13070set getservbyname d_getsbyname
13071eval $inlibc
13072
13073: see if getservbyport exists
13074set getservbyport d_getsbyport
13075eval $inlibc
13076
13077: see if getservent exists
13078set getservent d_getsent
13079eval $inlibc
13080
10bc17b6
JH
13081: see if getservbyname_r exists
13082set getservbyname_r d_getservbyname_r
13083eval $inlibc
13084case "$d_getservbyname_r" in
13085"$define")
13086 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13087 case "$d_getservbyname_r_proto:$usethreads" in
13088 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13089 set d_getservbyname_r_proto getservbyname_r $hdrs
13090 eval $hasproto ;;
13091 *) ;;
13092 esac
13093 case "$d_getservbyname_r_proto" in
13094 define)
10bc17b6
JH
13095 case "$getservbyname_r_proto" in
13096 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13097 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13098 esac
13099 case "$getservbyname_r_proto" in
13100 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13101 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13102 esac
13103 case "$getservbyname_r_proto" in
13104 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13105 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13106 esac
13107 case "$getservbyname_r_proto" in
90e831dc 13108 ''|0) d_getservbyname_r=undef
10bc17b6 13109 getservbyname_r_proto=0
a48ec845 13110 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13111 * ) case "$getservbyname_r_proto" in
13112 REENTRANT_PROTO*) ;;
13113 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13114 esac
13115 echo "Prototype: $try" ;;
13116 esac
13117 ;;
c18e646a
JH
13118 *) case "$usethreads" in
13119 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13120 esac
90e831dc
SB
13121 d_getservbyname_r=undef
13122 getservbyname_r_proto=0
c18e646a 13123 ;;
a48ec845
JH
13124 esac
13125 ;;
10bc17b6
JH
13126*) getservbyname_r_proto=0
13127 ;;
13128esac
13129
13130: see if getservbyport_r exists
13131set getservbyport_r d_getservbyport_r
13132eval $inlibc
13133case "$d_getservbyport_r" in
13134"$define")
13135 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13136 case "$d_getservbyport_r_proto:$usethreads" in
13137 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13138 set d_getservbyport_r_proto getservbyport_r $hdrs
13139 eval $hasproto ;;
13140 *) ;;
13141 esac
13142 case "$d_getservbyport_r_proto" in
13143 define)
10bc17b6
JH
13144 case "$getservbyport_r_proto" in
13145 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13146 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13147 esac
13148 case "$getservbyport_r_proto" in
13149 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13150 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13151 esac
13152 case "$getservbyport_r_proto" in
13153 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13154 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13155 esac
13156 case "$getservbyport_r_proto" in
90e831dc 13157 ''|0) d_getservbyport_r=undef
10bc17b6 13158 getservbyport_r_proto=0
a48ec845 13159 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13160 * ) case "$getservbyport_r_proto" in
13161 REENTRANT_PROTO*) ;;
13162 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13163 esac
13164 echo "Prototype: $try" ;;
13165 esac
13166 ;;
c18e646a
JH
13167 *) case "$usethreads" in
13168 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13169 esac
90e831dc
SB
13170 d_getservbyport_r=undef
13171 getservbyport_r_proto=0
c18e646a 13172 ;;
a48ec845
JH
13173 esac
13174 ;;
10bc17b6
JH
13175*) getservbyport_r_proto=0
13176 ;;
13177esac
13178
13179: see if getservent_r exists
13180set getservent_r d_getservent_r
13181eval $inlibc
13182case "$d_getservent_r" in
13183"$define")
13184 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13185 case "$d_getservent_r_proto:$usethreads" in
13186 ":define") d_getservent_r_proto=define
a48ec845
JH
13187 set d_getservent_r_proto getservent_r $hdrs
13188 eval $hasproto ;;
13189 *) ;;
13190 esac
13191 case "$d_getservent_r_proto" in
13192 define)
10bc17b6
JH
13193 case "$getservent_r_proto" in
13194 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13195 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13196 esac
13197 case "$getservent_r_proto" in
13198 ''|0) try='int getservent_r(struct servent*, char*, int);'
13199 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13200 esac
13201 case "$getservent_r_proto" in
13202 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13203 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13204 esac
13205 case "$getservent_r_proto" in
13206 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13207 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13208 esac
13209 case "$getservent_r_proto" in
90e831dc 13210 ''|0) d_getservent_r=undef
10bc17b6 13211 getservent_r_proto=0
a48ec845 13212 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13213 * ) case "$getservent_r_proto" in
13214 REENTRANT_PROTO*) ;;
13215 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13216 esac
13217 echo "Prototype: $try" ;;
13218 esac
13219 ;;
c18e646a
JH
13220 *) case "$usethreads" in
13221 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13222 esac
90e831dc
SB
13223 d_getservent_r=undef
13224 getservent_r_proto=0
c18e646a 13225 ;;
a48ec845
JH
13226 esac
13227 ;;
10bc17b6
JH
13228*) getservent_r_proto=0
13229 ;;
13230esac
13231
b4eb6b3d
JH
13232: see if prototypes for various getservxxx netdb.h functions are available
13233echo " "
13234set d_getservprotos getservent $i_netdb netdb.h
13235eval $hasproto
13236
13237: see if getspnam exists
13238set getspnam d_getspnam
13239eval $inlibc
13240
10bc17b6
JH
13241: see if this is a shadow.h system
13242set shadow.h i_shadow
13243eval $inhdr
13244
13245: see if getspnam_r exists
13246set getspnam_r d_getspnam_r
13247eval $inlibc
13248case "$d_getspnam_r" in
13249"$define")
13250 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13251 case "$d_getspnam_r_proto:$usethreads" in
13252 ":define") d_getspnam_r_proto=define
a48ec845
JH
13253 set d_getspnam_r_proto getspnam_r $hdrs
13254 eval $hasproto ;;
13255 *) ;;
13256 esac
13257 case "$d_getspnam_r_proto" in
13258 define)
10bc17b6
JH
13259 case "$getspnam_r_proto" in
13260 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13261 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13262 esac
13263 case "$getspnam_r_proto" in
13264 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13265 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13266 esac
13267 case "$getspnam_r_proto" in
90e831dc 13268 ''|0) d_getspnam_r=undef
10bc17b6 13269 getspnam_r_proto=0
a48ec845 13270 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13271 * ) case "$getspnam_r_proto" in
13272 REENTRANT_PROTO*) ;;
13273 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13274 esac
13275 echo "Prototype: $try" ;;
13276 esac
13277 ;;
c18e646a
JH
13278 *) case "$usethreads" in
13279 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13280 esac
90e831dc
SB
13281 d_getspnam_r=undef
13282 getspnam_r_proto=0
c18e646a 13283 ;;
a48ec845
JH
13284 esac
13285 ;;
10bc17b6
JH
13286*) getspnam_r_proto=0
13287 ;;
13288esac
13289
b4eb6b3d
JH
13290: see if gettimeofday or ftime exists
13291set gettimeofday d_gettimeod
13292eval $inlibc
13293case "$d_gettimeod" in
13294"$undef")
13295 set ftime d_ftime
13296 eval $inlibc
13297 ;;
13298*)
13299 val="$undef"; set d_ftime; eval $setvar
13300 ;;
13301esac
13302case "$d_gettimeod$d_ftime" in
13303"$undef$undef")
13304 echo " "
13305 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13306 ;;
13307esac
13308
10bc17b6
JH
13309: see if gmtime_r exists
13310set gmtime_r d_gmtime_r
13311eval $inlibc
13312case "$d_gmtime_r" in
13313"$define")
d63eadf0 13314 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13315 case "$d_gmtime_r_proto:$usethreads" in
13316 ":define") d_gmtime_r_proto=define
a48ec845
JH
13317 set d_gmtime_r_proto gmtime_r $hdrs
13318 eval $hasproto ;;
13319 *) ;;
13320 esac
13321 case "$d_gmtime_r_proto" in
13322 define)
10bc17b6
JH
13323 case "$gmtime_r_proto" in
13324 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13325 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13326 esac
13327 case "$gmtime_r_proto" in
13328 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13329 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13330 esac
13331 case "$gmtime_r_proto" in
90e831dc 13332 ''|0) d_gmtime_r=undef
10bc17b6 13333 gmtime_r_proto=0
a48ec845 13334 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13335 * ) case "$gmtime_r_proto" in
13336 REENTRANT_PROTO*) ;;
13337 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13338 esac
13339 echo "Prototype: $try" ;;
13340 esac
b4eb6b3d 13341 ;;
c18e646a
JH
13342 *) case "$usethreads" in
13343 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13344 esac
90e831dc
SB
13345 d_gmtime_r=undef
13346 gmtime_r_proto=0
c18e646a 13347 ;;
a48ec845
JH
13348 esac
13349 ;;
10bc17b6 13350*) gmtime_r_proto=0
b4eb6b3d
JH
13351 ;;
13352esac
13353
13354: see if hasmntopt exists
13355set hasmntopt d_hasmntopt
13356eval $inlibc
13357
13358: see if this is a netinet/in.h or sys/in.h system
13359set netinet/in.h i_niin sys/in.h i_sysin
13360eval $inhdr
13361
13362: see if arpa/inet.h has to be included
13363set arpa/inet.h i_arpainet
13364eval $inhdr
13365
13366: see if htonl --and friends-- exists
13367val=''
13368set htonl val
13369eval $inlibc
13370
13371: Maybe they are macros.
13372case "$val" in
13373$undef)
13374 $cat >htonl.c <<EOM
13375#include <stdio.h>
13376#include <sys/types.h>
13377#$i_niin I_NETINET_IN
13378#$i_sysin I_SYS_IN
13379#$i_arpainet I_ARPA_INET
13380#ifdef I_NETINET_IN
13381#include <netinet/in.h>
13382#endif
13383#ifdef I_SYS_IN
13384#include <sys/in.h>
13385#endif
13386#ifdef I_ARPA_INET
13387#include <arpa/inet.h>
13388#endif
13389#ifdef htonl
13390printf("Defined as a macro.");
13391#endif
13392EOM
13393 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13394 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13395 val="$define"
13396 echo "But it seems to be defined as a macro." >&4
13397 fi
13398 $rm -f htonl.?
13399 ;;
13400esac
13401set d_htonl
13402eval $setvar
13403
b4eb6b3d
JH
13404: index or strchr
13405echo " "
13406if set index val -f; eval $csym; $val; then
13407 if set strchr val -f d_strchr; eval $csym; $val; then
13408 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13409 val="$define"
13410 vali="$undef"
13411 echo "strchr() found." >&4
13412 else
13413 val="$undef"
13414 vali="$define"
13415 echo "index() found." >&4
13416 fi
13417 else
13418 val="$undef"
13419 vali="$define"
8dfa8df9
JH
13420 echo "index() found." >&4
13421 fi
b4eb6b3d 13422else
8dfa8df9
JH
13423 if set strchr val -f d_strchr; eval $csym; $val; then
13424 val="$define"
13425 vali="$undef"
13426 echo "strchr() found." >&4
13427 else
13428 echo "No index() or strchr() found!" >&4
13429 val="$undef"
13430 vali="$undef"
13431 fi
b4eb6b3d 13432fi
8dfa8df9
JH
13433set d_strchr; eval $setvar
13434val="$vali"
13435set d_index; eval $setvar
13436
13437: check whether inet_aton exists
13438set inet_aton d_inetaton
13439eval $inlibc
b4eb6b3d
JH
13440
13441: Look for isascii
13442echo " "
13443$cat >isascii.c <<'EOCP'
13444#include <stdio.h>
13445#include <ctype.h>
13446int main() {
13447 int c = 'A';
13448 if (isascii(c))
13449 exit(0);
13450 else
13451 exit(1);
13452}
13453EOCP
13454set isascii
13455if eval $compile; then
13456 echo "isascii() found." >&4
13457 val="$define"
13458else
13459 echo "isascii() NOT found." >&4
13460 val="$undef"
13461fi
13462set d_isascii
13463eval $setvar
13464$rm -f isascii*
13465
758a5d79
JH
13466: see if isfinite exists
13467set isfinite d_isfinite
13468eval $inlibc
13469
13470: see if isinf exists
13471set isinf d_isinf
13472eval $inlibc
13473
b4eb6b3d
JH
13474: see if isnan exists
13475set isnan d_isnan
13476eval $inlibc
13477
13478: see if isnanl exists
13479set isnanl d_isnanl
13480eval $inlibc
13481
13482: see if killpg exists
13483set killpg d_killpg
13484eval $inlibc
13485
13486: see if lchown exists
13487echo " "
13488$cat > try.c <<'EOCP'
13489/* System header to define __stub macros and hopefully few prototypes,
13490 which can conflict with char lchown(); below. */
13491#include <assert.h>
13492/* Override any gcc2 internal prototype to avoid an error. */
13493/* We use char because int might match the return type of a gcc2
13494 builtin and then its argument prototype would still apply. */
13495char lchown();
13496int main() {
13497 /* The GNU C library defines this for functions which it implements
13498 to always fail with ENOSYS. Some functions are actually named
13499 something starting with __ and the normal name is an alias. */
13500#if defined (__stub_lchown) || defined (__stub___lchown)
13501choke me
13502#else
13503lchown();
13504#endif
13505; return 0; }
13506EOCP
13507set try
13508if eval $compile; then
13509 $echo "lchown() found." >&4
13510 val="$define"
13511else
13512 $echo "lchown() NOT found." >&4
13513 val="$undef"
13514fi
13515set d_lchown
13516eval $setvar
13517
13518: See if number of significant digits in a double precision number is known
13519echo " "
13520$cat >ldbl_dig.c <<EOM
13521#$i_limits I_LIMITS
13522#$i_float I_FLOAT
13523#ifdef I_LIMITS
13524#include <limits.h>
13525#endif
13526#ifdef I_FLOAT
13527#include <float.h>
13528#endif
13529#ifdef LDBL_DIG
13530printf("Contains LDBL_DIG");
13531#endif
13532EOM
13533$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13534if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13535 echo "LDBL_DIG found." >&4
13536 val="$define"
13537else
13538 echo "LDBL_DIG NOT found." >&4
13539 val="$undef"
13540fi
13541$rm -f ldbl_dig.?
13542set d_ldbl_dig
13543eval $setvar
13544
13545: see if link exists
13546set link d_link
13547eval $inlibc
13548
10bc17b6
JH
13549: see if localtime_r exists
13550set localtime_r d_localtime_r
13551eval $inlibc
13552case "$d_localtime_r" in
13553"$define")
d63eadf0 13554 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13555 case "$d_localtime_r_proto:$usethreads" in
13556 ":define") d_localtime_r_proto=define
a48ec845
JH
13557 set d_localtime_r_proto localtime_r $hdrs
13558 eval $hasproto ;;
13559 *) ;;
13560 esac
13561 case "$d_localtime_r_proto" in
13562 define)
10bc17b6
JH
13563 case "$localtime_r_proto" in
13564 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13565 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13566 esac
13567 case "$localtime_r_proto" in
13568 ''|0) try='int localtime_r(const time_t*, struct tm*);'
13569 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13570 esac
13571 case "$localtime_r_proto" in
90e831dc 13572 ''|0) d_localtime_r=undef
10bc17b6 13573 localtime_r_proto=0
a48ec845 13574 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13575 * ) case "$localtime_r_proto" in
13576 REENTRANT_PROTO*) ;;
13577 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13578 esac
13579 echo "Prototype: $try" ;;
13580 esac
13581 ;;
c18e646a
JH
13582 *) case "$usethreads" in
13583 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13584 esac
90e831dc
SB
13585 d_localtime_r=undef
13586 localtime_r_proto=0
c18e646a 13587 ;;
a48ec845
JH
13588 esac
13589 ;;
10bc17b6
JH
13590*) localtime_r_proto=0
13591 ;;
13592esac
13593
b4eb6b3d
JH
13594: see if localeconv exists
13595set localeconv d_locconv
13596eval $inlibc
13597
13598: see if lockf exists
13599set lockf d_lockf
13600eval $inlibc
13601
b4eb6b3d
JH
13602: see if prototype for lseek is available
13603echo " "
4786929f 13604set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
13605eval $hasproto
13606
13607: see if lstat exists
13608set lstat d_lstat
13609eval $inlibc
13610
13611: see if madvise exists
13612set madvise d_madvise
13613eval $inlibc
13614
13615: see if mblen exists
13616set mblen d_mblen
13617eval $inlibc
13618
13619: see if mbstowcs exists
13620set mbstowcs d_mbstowcs
13621eval $inlibc
13622
13623: see if mbtowc exists
13624set mbtowc d_mbtowc
13625eval $inlibc
13626
13627: see if memchr exists
13628set memchr d_memchr
13629eval $inlibc
13630
13631: see if memcmp exists
13632set memcmp d_memcmp
13633eval $inlibc
13634
13635: see if memcpy exists
13636set memcpy d_memcpy
13637eval $inlibc
13638
13639: see if memmove exists
13640set memmove d_memmove
13641eval $inlibc
13642
13643: see if memset exists
13644set memset d_memset
13645eval $inlibc
13646
13647: see if mkdir exists
13648set mkdir d_mkdir
13649eval $inlibc
13650
13651: see if mkdtemp exists
13652set mkdtemp d_mkdtemp
13653eval $inlibc
13654
13655: see if mkfifo exists
13656set mkfifo d_mkfifo
13657eval $inlibc
13658
13659: see if mkstemp exists
13660set mkstemp d_mkstemp
13661eval $inlibc
13662
13663: see if mkstemps exists
13664set mkstemps d_mkstemps
13665eval $inlibc
13666
13667: see if mktime exists
13668set mktime d_mktime
13669eval $inlibc
13670
13671: see if this is a sys/mman.h system
13672set sys/mman.h i_sysmman
13673eval $inhdr
13674
13675: see if mmap exists
13676set mmap d_mmap
13677eval $inlibc
13678: see what shmat returns
13679: default to something harmless
13680mmaptype='void *'
13681case "$i_sysmman$d_mmap" in
13682"$define$define")
13683 $cat >mmap.c <<'END'
13684#include <sys/mman.h>
13685void *mmap();
13686END
13687 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13688 mmaptype='void *'
13689 else
13690 mmaptype='caddr_t'
13691 fi
13692 echo "and it returns ($mmaptype)." >&4
13693 ;;
13694esac
13695
13696
13697
b4eb6b3d
JH
13698: see if mprotect exists
13699set mprotect d_mprotect
13700eval $inlibc
13701
13702: see if msgctl exists
13703set msgctl d_msgctl
13704eval $inlibc
13705
13706: see if msgget exists
13707set msgget d_msgget
13708eval $inlibc
13709
13710: see if msgsnd exists
13711set msgsnd d_msgsnd
13712eval $inlibc
13713
13714: see if msgrcv exists
13715set msgrcv d_msgrcv
13716eval $inlibc
13717
13718: see how much of the 'msg*(2)' library is present.
13719h_msg=true
13720echo " "
13721case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13722*"$undef"*) h_msg=false;;
13723esac
13724case "$osname" in
13725freebsd)
13726 case "`ipcs 2>&1`" in
13727 "SVID messages"*"not configured"*)
13728 echo "Your $osname does not have the msg*(2) configured." >&4
13729 h_msg=false
13730 val="$undef"
13731 set msgctl d_msgctl
13732 eval $setvar
13733 set msgget d_msgget
13734 eval $setvar
13735 set msgsnd d_msgsnd
13736 eval $setvar
13737 set msgrcv d_msgrcv
13738 eval $setvar
13739 ;;
13740 esac
13741 ;;
13742esac
13743: we could also check for sys/ipc.h ...
13744if $h_msg && $test `./findhdr sys/msg.h`; then
13745 echo "You have the full msg*(2) library." >&4
13746 val="$define"
13747else
13748 echo "You don't have the full msg*(2) library." >&4
13749 val="$undef"
13750fi
13751set d_msg
13752eval $setvar
13753
4e0554ec
JH
13754
13755echo " "
13756echo "Checking to see if your system supports struct msghdr..." >&4
13757set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13758eval $hasstruct
13759case "$d_msghdr_s" in
13760"$define") echo "Yes, it does." ;;
13761*) echo "No, it doesn't." ;;
13762esac
13763
13764
b4eb6b3d
JH
13765: see if msync exists
13766set msync d_msync
13767eval $inlibc
13768
13769: see if munmap exists
13770set munmap d_munmap
13771eval $inlibc
13772
2d736872
MB
13773: see if nanosleep exists
13774set nanosleep d_nanosleep
13775eval $inlibc
13776
b4eb6b3d
JH
13777: see if nice exists
13778set nice d_nice
13779eval $inlibc
13780
2765b840
JH
13781: see if this is a langinfo.h system
13782set langinfo.h i_langinfo
13783eval $inhdr
13784
13785: see if nl_langinfo exists
13786set nl_langinfo d_nl_langinfo
13787eval $inlibc
13788
b4eb6b3d
JH
13789: check for length of character
13790echo " "
13791case "$charsize" in
13792'')
13793 echo "Checking to see how big your characters are (hey, you never know)..." >&4
13794 $cat >try.c <<'EOCP'
13795#include <stdio.h>
13796int main()
13797{
13798 printf("%d\n", (int)sizeof(char));
13799 exit(0);
13800}
13801EOCP
13802 set try
13803 if eval $compile_ok; then
5440bc8e 13804 dflt=`$run ./try`
b4eb6b3d
JH
13805 else
13806 dflt='1'
13807 echo "(I can't seem to compile the test program. Guessing...)"
13808 fi
13809 ;;
13810*)
13811 dflt="$charsize"
13812 ;;
13813esac
13814rp="What is the size of a character (in bytes)?"
13815. ./myread
13816charsize="$ans"
13817$rm -f try.c try
13818
1d1be0dc
NC
13819: check for volatile keyword
13820echo " "
13821echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13822$cat >try.c <<'EOCP'
76f47787 13823int main()
1d1be0dc
NC
13824{
13825 typedef struct _goo_struct goo_struct;
13826 goo_struct * volatile goo = ((goo_struct *)0);
13827 struct _goo_struct {
13828 long long_int;
13829 int reg_int;
13830 char char_var;
13831 };
13832 typedef unsigned short foo_t;
13833 char *volatile foo;
13834 volatile int bar;
13835 volatile foo_t blech;
13836 foo = foo;
13837}
13838EOCP
13839if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13840 val="$define"
13841 echo "Yup, it does."
13842else
13843 val="$undef"
13844 echo "Nope, it doesn't."
13845fi
13846set d_volatile
13847eval $setvar
13848$rm -f try.*
13849
b4eb6b3d
JH
13850
13851echo " "
13852$echo "Choosing the C types to be used for Perl's internal types..." >&4
13853
13854case "$use64bitint:$d_quad:$quadtype" in
13855define:define:?*)
13856 ivtype="$quadtype"
13857 uvtype="$uquadtype"
13858 ivsize=8
13859 uvsize=8
13860 ;;
13861*) ivtype="long"
13862 uvtype="unsigned long"
13863 ivsize=$longsize
13864 uvsize=$longsize
13865 ;;
13866esac
13867
13868case "$uselongdouble:$d_longdbl" in
13869define:define)
13870 nvtype="long double"
13871 nvsize=$longdblsize
13872 ;;
13873*) nvtype=double
13874 nvsize=$doublesize
13875 ;;
13876esac
13877
13878$echo "(IV will be "$ivtype", $ivsize bytes)"
13879$echo "(UV will be "$uvtype", $uvsize bytes)"
13880$echo "(NV will be "$nvtype", $nvsize bytes)"
13881
13882$cat >try.c <<EOCP
13883#$i_inttypes I_INTTYPES
13884#ifdef I_INTTYPES
13885#include <inttypes.h>
13886#endif
13887#include <stdio.h>
13888int main() {
13889#ifdef INT8
13890 int8_t i = INT8_MAX;
13891 uint8_t u = UINT8_MAX;
13892 printf("int8_t\n");
13893#endif
13894#ifdef INT16
13895 int16_t i = INT16_MAX;
13896 uint16_t i = UINT16_MAX;
13897 printf("int16_t\n");
13898#endif
13899#ifdef INT32
13900 int32_t i = INT32_MAX;
13901 uint32_t u = UINT32_MAX;
13902 printf("int32_t\n");
13903#endif
13904}
13905EOCP
13906
13907case "$i8type" in
13908'') case "$charsize" in
13909 1) i8type=char
13910 u8type="unsigned char"
13911 i8size=$charsize
13912 u8size=$charsize
13913 ;;
13914 esac
13915 ;;
13916esac
13917case "$i8type" in
13918'') set try -DINT8
13919 if eval $compile; then
5440bc8e 13920 case "`$run ./try`" in
b4eb6b3d
JH
13921 int8_t) i8type=int8_t
13922 u8type=uint8_t
13923 i8size=1
13924 u8size=1
13925 ;;
13926 esac
13927 fi
13928 ;;
13929esac
13930case "$i8type" in
13931'') if $test $charsize -ge 1; then
13932 i8type=char
13933 u8type="unsigned char"
13934 i8size=$charsize
13935 u8size=$charsize
13936 fi
13937 ;;
13938esac
13939
13940case "$i16type" in
13941'') case "$shortsize" in
13942 2) i16type=short
13943 u16type="unsigned short"
13944 i16size=$shortsize
13945 u16size=$shortsize
13946 ;;
13947 esac
13948 ;;
13949esac
13950case "$i16type" in
13951'') set try -DINT16
13952 if eval $compile; then
5440bc8e 13953 case "`$run ./try`" in
b4eb6b3d
JH
13954 int16_t)
13955 i16type=int16_t
13956 u16type=uint16_t
13957 i16size=2
13958 u16size=2
13959 ;;
13960 esac
13961 fi
13962 ;;
13963esac
13964case "$i16type" in
13965'') if $test $shortsize -ge 2; then
13966 i16type=short
13967 u16type="unsigned short"
13968 i16size=$shortsize
13969 u16size=$shortsize
13970 fi
13971 ;;
13972esac
13973
13974case "$i32type" in
13975'') case "$longsize" in
13976 4) i32type=long
13977 u32type="unsigned long"
13978 i32size=$longsize
13979 u32size=$longsize
13980 ;;
13981 *) case "$intsize" in
13982 4) i32type=int
13983 u32type="unsigned int"
13984 i32size=$intsize
13985 u32size=$intsize
13986 ;;
13987 esac
13988 ;;
13989 esac
13990 ;;
13991esac
13992case "$i32type" in
13993'') set try -DINT32
13994 if eval $compile; then
5440bc8e 13995 case "`$run ./try`" in
b4eb6b3d
JH
13996 int32_t)
13997 i32type=int32_t
13998 u32type=uint32_t
13999 i32size=4
14000 u32size=4
14001 ;;
14002 esac
14003 fi
14004 ;;
14005esac
14006case "$i32type" in
14007'') if $test $intsize -ge 4; then
14008 i32type=int
14009 u32type="unsigned int"
14010 i32size=$intsize
14011 u32size=$intsize
14012 fi
14013 ;;
14014esac
14015
14016case "$i64type" in
14017'') case "$d_quad:$quadtype" in
14018 define:?*)
14019 i64type="$quadtype"
14020 u64type="$uquadtype"
14021 i64size=8
14022 u64size=8
14023 ;;
14024 esac
14025 ;;
14026esac
14027
1d1be0dc
NC
14028$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14029: volatile so that the compiler has to store it out to memory.
14030if test X"$d_volatile" = X"$define"; then
14031 volatile=volatile
14032fi
b4eb6b3d
JH
14033$cat <<EOP >try.c
14034#include <stdio.h>
1d1be0dc
NC
14035#include <sys/types.h>
14036#include <signal.h>
14037#ifdef SIGFPE
14038$volatile int bletched = 0;
14039$signal_t blech(s) int s; { bletched = 1; }
14040#endif
b4eb6b3d
JH
14041int main() {
14042 $uvtype u = 0;
1d1be0dc 14043 $nvtype d;
b4eb6b3d
JH
14044 int n = 8 * $uvsize;
14045 int i;
1d1be0dc
NC
14046#ifdef SIGFPE
14047 signal(SIGFPE, blech);
14048#endif
14049
b4eb6b3d
JH
14050 for (i = 0; i < n; i++) {
14051 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14052 d = ($nvtype)u;
14053 if (($uvtype)d != u)
b4eb6b3d 14054 break;
1d1be0dc
NC
14055 if (d <= 0)
14056 break;
14057 d = ($nvtype)(u - 1);
14058 if (($uvtype)d != (u - 1))
14059 break;
14060#ifdef SIGFPE
14061 if (bletched) {
14062 break;
14063#endif
14064 }
b4eb6b3d 14065 }
efd1522b 14066 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14067 exit(0);
14068}
14069EOP
1d1be0dc
NC
14070set try
14071
14072d_nv_preserves_uv="$undef"
14073if eval $compile; then
53133ed1 14074 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14075fi
53133ed1 14076case "$nv_preserves_uv_bits" in
1d1be0dc 14077\-[1-9]*)
53133ed1
NC
14078 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14079 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14080 d_nv_preserves_uv="$define"
b4eb6b3d 14081 ;;
53133ed1 14082[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14083 d_nv_preserves_uv="$undef" ;;
14084*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14085 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14086esac
14087
1d1be0dc
NC
14088$rm -f try.* try
14089
b4eb6b3d
JH
14090
14091: check for off64_t
14092echo " "
14093echo "Checking to see if you have off64_t..." >&4
14094$cat >try.c <<EOCP
14095#include <sys/types.h>
14096#include <unistd.h>
14097int main() { off64_t x = 7; }
14098EOCP
14099set try
14100if eval $compile; then
14101 val="$define"
14102 echo "You have off64_t."
14103else
14104 val="$undef"
14105 echo "You do not have off64_t."
14106 case "$lseeksize" in
14107 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14108 esac
14109fi
14110$rm -f try.* try
14111set d_off64_t
14112eval $setvar
14113
b4eb6b3d
JH
14114: how to create joinable pthreads
14115if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14116 echo " "
14117 echo "Checking what constant to use for creating joinable pthreads..." >&4
14118 $cat >try.c <<'EOCP'
14119#include <pthread.h>
14120int main() {
14121 int detachstate = JOINABLE;
14122}
14123EOCP
14124 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14125 if eval $compile; then
14126 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14127 val="$undef" # Yes, undef.
14128 set d_old_pthread_create_joinable
14129 eval $setvar
14130 val=""
14131 set old_pthread_create_joinable
14132 eval $setvar
14133 else
14134 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14135 if eval $compile; then
14136 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14137 val="$define"
14138 set d_old_pthread_create_joinable
14139 eval $setvar
14140 val=PTHREAD_CREATE_UNDETACHED
14141 set old_pthread_create_joinable
14142 eval $setvar
14143 else
14144 set try -DJOINABLE=__UNDETACHED
14145 if eval $compile; then
14146 echo "You seem to use __UNDETACHED." >&4
14147 val="$define"
14148 set d_old_pthread_create_joinable
14149 eval $setvar
14150 val=__UNDETACHED
14151 set old_pthread_create_joinable
14152 eval $setvar
14153 else
14154 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
14155 val="$define"
14156 set d_old_pthread_create_joinable
14157 eval $setvar
14158 val=0
14159 set old_pthread_create_joinable
14160 eval $setvar
14161 fi
14162 fi
14163 fi
14164 $rm -f try try.*
14165else
14166 d_old_pthread_create_joinable="$undef"
14167 old_pthread_create_joinable=""
14168fi
14169
14170: see if pause exists
14171set pause d_pause
14172eval $inlibc
14173
14174: see if pipe exists
14175set pipe d_pipe
14176eval $inlibc
14177
14178: see if poll exists
14179set poll d_poll
14180eval $inlibc
14181
c7aff470
NIS
14182: see if readlink exists
14183set readlink d_readlink
14184eval $inlibc
14185
14186echo " "
f24dbf84 14187procselfexe=''
c7aff470 14188val="$undef"
a33c94aa
JH
14189case "$d_readlink" in
14190"$define")
c7aff470
NIS
14191 if $issymlink /proc/self/exe ; then
14192 $ls -l /proc/self/exe > reflect
51660ed5 14193 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 14194 echo "You have Linux-like /proc/self/exe."
92236451 14195 procselfexe='"/proc/self/exe"'
f24dbf84 14196 val="$define"
f24dbf84
JH
14197 fi
14198 fi
14199 if $issymlink /proc/curproc/file ; then
14200 $ls -l /proc/curproc/file > reflect
14201 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14202 echo "You have BSD-like /proc/curproc/file."
92236451 14203 procselfexe='"/proc/curproc/file"'
f24dbf84 14204 val="$define"
c7aff470 14205 fi
c7aff470 14206 fi
a33c94aa
JH
14207 ;;
14208esac
428dc699 14209$rm -f reflect
c7aff470
NIS
14210set d_procselfexe
14211eval $setvar
14212
263fee3f
JH
14213: see whether the pthread_atfork exists
14214$cat >try.c <<EOP
14215#include <pthread.h>
14216#include <stdio.h>
14217int main() {
14218#ifdef PTHREAD_ATFORK
14219 pthread_atfork(NULL,NULL,NULL);
14220#endif
14221}
14222EOP
14223
d6483fcc 14224: see if pthread_atfork exists
263fee3f
JH
14225set try -DPTHREAD_ATFORK
14226if eval $compile; then
14227 val="$define"
14228else
14229 val="$undef"
14230fi
14231case "$usethreads" in
14232$define)
14233 case "$val" in
14234 $define) echo 'pthread_atfork found.' >&4 ;;
14235 *) echo 'pthread_atfork NOT found.' >&4 ;;
14236 esac
14237esac
14238set d_pthread_atfork
14239eval $setvar
d6483fcc 14240
b4eb6b3d
JH
14241
14242: see whether the various POSIXish _yields exist
14243$cat >try.c <<EOP
14244#include <pthread.h>
14245#include <stdio.h>
14246int main() {
14247#ifdef SCHED_YIELD
14248 sched_yield();
14249#else
14250#ifdef PTHREAD_YIELD
14251 pthread_yield();
14252#else
14253#ifdef PTHREAD_YIELD_NULL
14254 pthread_yield(NULL);
14255#endif
14256#endif
14257#endif
14258}
14259EOP
14260: see if sched_yield exists
14261set try -DSCHED_YIELD
14262if eval $compile; then
14263 val="$define"
14264 sched_yield='sched_yield()'
14265else
14266 val="$undef"
14267fi
14268case "$usethreads" in
14269$define)
14270 case "$val" in
14271 $define) echo 'sched_yield() found.' >&4 ;;
14272 *) echo 'sched_yield() NOT found.' >&4 ;;
14273 esac
14274esac
10bc17b6
JH
14275set d_sched_yield
14276eval $setvar
b4eb6b3d 14277
10bc17b6
JH
14278: see if pthread_yield exists
14279set try -DPTHREAD_YIELD
14280if eval $compile; then
14281 val="$define"
14282 case "$sched_yield" in
14283 '') sched_yield='pthread_yield()' ;;
14284 esac
14285else
14286 set try -DPTHREAD_YIELD_NULL
14287 if eval $compile; then
14288 val="$define"
14289 case "$sched_yield" in
14290 '') sched_yield='pthread_yield(NULL)' ;;
14291 esac
14292 else
14293 val="$undef"
14294 fi
14295fi
14296case "$usethreads" in
14297$define)
14298 case "$val" in
14299 $define) echo 'pthread_yield() found.' >&4 ;;
14300 *) echo 'pthread_yield() NOT found.' >&4 ;;
14301 esac
14302 ;;
14303esac
14304set d_pthread_yield
14305eval $setvar
b4eb6b3d 14306
10bc17b6
JH
14307case "$sched_yield" in
14308'') sched_yield=undef ;;
14309esac
b4eb6b3d 14310
10bc17b6
JH
14311$rm -f try try.*
14312
14313: see if random_r exists
14314set random_r d_random_r
14315eval $inlibc
14316case "$d_random_r" in
14317"$define")
14318 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
14319 case "$d_random_r_proto:$usethreads" in
14320 ":define") d_random_r_proto=define
a48ec845
JH
14321 set d_random_r_proto random_r $hdrs
14322 eval $hasproto ;;
14323 *) ;;
14324 esac
14325 case "$d_random_r_proto" in
14326 define)
10bc17b6
JH
14327 case "$random_r_proto" in
14328 ''|0) try='int random_r(int*, struct random_data*);'
14329 ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14330 esac
14331 case "$random_r_proto" in
90e831dc 14332 ''|0) d_random_r=undef
10bc17b6 14333 random_r_proto=0
a48ec845 14334 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14335 * ) case "$random_r_proto" in
14336 REENTRANT_PROTO*) ;;
14337 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14338 esac
14339 echo "Prototype: $try" ;;
14340 esac
b4eb6b3d 14341 ;;
c18e646a
JH
14342 *) case "$usethreads" in
14343 define) echo "random_r has no prototype, not using it." >&4 ;;
14344 esac
90e831dc
SB
14345 d_random_r=undef
14346 random_r_proto=0
c18e646a 14347 ;;
a48ec845
JH
14348 esac
14349 ;;
10bc17b6 14350*) random_r_proto=0
b4eb6b3d
JH
14351 ;;
14352esac
14353
14354: see if readdir and friends exist
14355set readdir d_readdir
14356eval $inlibc
14357set seekdir d_seekdir
14358eval $inlibc
14359set telldir d_telldir
14360eval $inlibc
14361set rewinddir d_rewinddir
14362eval $inlibc
14363
10bc17b6
JH
14364: see if readdir64_r exists
14365set readdir64_r d_readdir64_r
14366eval $inlibc
14367case "$d_readdir64_r" in
14368"$define")
14369 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
14370 case "$d_readdir64_r_proto:$usethreads" in
14371 ":define") d_readdir64_r_proto=define
a48ec845
JH
14372 set d_readdir64_r_proto readdir64_r $hdrs
14373 eval $hasproto ;;
14374 *) ;;
14375 esac
14376 case "$d_readdir64_r_proto" in
14377 define)
10bc17b6
JH
14378 case "$readdir64_r_proto" in
14379 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14380 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14381 esac
14382 case "$readdir64_r_proto" in
14383 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14384 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14385 esac
14386 case "$readdir64_r_proto" in
90e831dc 14387 ''|0) d_readdir64_r=undef
10bc17b6 14388 readdir64_r_proto=0
a48ec845 14389 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14390 * ) case "$readdir64_r_proto" in
14391 REENTRANT_PROTO*) ;;
14392 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14393 esac
14394 echo "Prototype: $try" ;;
14395 esac
14396 ;;
c18e646a
JH
14397 *) case "$usethreads" in
14398 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14399 esac
90e831dc
SB
14400 d_readdir64_r=undef
14401 readdir64_r_proto=0
c18e646a 14402 ;;
a48ec845
JH
14403 esac
14404 ;;
10bc17b6
JH
14405*) readdir64_r_proto=0
14406 ;;
14407esac
14408
14409: see if readdir_r exists
14410set readdir_r d_readdir_r
14411eval $inlibc
14412case "$d_readdir_r" in
14413"$define")
14414 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
14415 case "$d_readdir_r_proto:$usethreads" in
14416 ":define") d_readdir_r_proto=define
a48ec845
JH
14417 set d_readdir_r_proto readdir_r $hdrs
14418 eval $hasproto ;;
14419 *) ;;
14420 esac
14421 case "$d_readdir_r_proto" in
14422 define)
10bc17b6
JH
14423 case "$readdir_r_proto" in
14424 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14425 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14426 esac
14427 case "$readdir_r_proto" in
14428 ''|0) try='int readdir_r(DIR*, struct dirent*);'
14429 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14430 esac
14431 case "$readdir_r_proto" in
90e831dc 14432 ''|0) d_readdir_r=undef
10bc17b6 14433 readdir_r_proto=0
a48ec845 14434 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14435 * ) case "$readdir_r_proto" in
14436 REENTRANT_PROTO*) ;;
14437 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14438 esac
14439 echo "Prototype: $try" ;;
14440 esac
14441 ;;
c18e646a
JH
14442 *) case "$usethreads" in
14443 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14444 esac
90e831dc
SB
14445 d_readdir_r=undef
14446 readdir_r_proto=0
c18e646a 14447 ;;
a48ec845
JH
14448 esac
14449 ;;
10bc17b6
JH
14450*) readdir_r_proto=0
14451 ;;
14452esac
14453
4e0554ec
JH
14454: see if readv exists
14455set readv d_readv
14456eval $inlibc
14457
14458: see if recvmsg exists
14459set recvmsg d_recvmsg
14460eval $inlibc
14461
b4eb6b3d
JH
14462: see if rename exists
14463set rename d_rename
14464eval $inlibc
14465
14466: see if rmdir exists
14467set rmdir d_rmdir
14468eval $inlibc
14469
14470: see if memory.h is available.
14471val=''
14472set memory.h val
14473eval $inhdr
14474
14475: See if it conflicts with string.h
14476case "$val" in
14477$define)
14478 case "$strings" in
14479 '') ;;
14480 *)
14481 $cppstdin $cppflags $cppminus < $strings > mem.h
14482 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14483 echo " "
14484 echo "We won't be including <memory.h>."
14485 val="$undef"
14486 fi
14487 $rm -f mem.h
14488 ;;
14489 esac
14490esac
14491set i_memory
14492eval $setvar
14493
14494: can bcopy handle overlapping blocks?
b6cc3bc4 14495echo " "
b4eb6b3d 14496val="$undef"
b6cc3bc4
AD
14497case "$d_memmove" in
14498"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14499*) case "$d_bcopy" in
14500 "$define")
14501 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14502 $cat >try.c <<EOCP
b4eb6b3d
JH
14503#$i_memory I_MEMORY
14504#$i_stdlib I_STDLIB
14505#$i_string I_STRING
14506#$i_unistd I_UNISTD
14507EOCP
14508 $cat >>try.c <<'EOCP'
14509#include <stdio.h>
14510#ifdef I_MEMORY
14511# include <memory.h>
14512#endif
14513#ifdef I_STDLIB
14514# include <stdlib.h>
14515#endif
14516#ifdef I_STRING
14517# include <string.h>
14518#else
14519# include <strings.h>
14520#endif
14521#ifdef I_UNISTD
14522# include <unistd.h> /* Needed for NetBSD */
14523#endif
14524int main()
14525{
14526char buf[128], abc[128];
14527char *b;
14528int len;
14529int off;
14530int align;
14531
b6cc3bc4
AD
14532/* Copy "abcde..." string to char abc[] so that gcc doesn't
14533 try to store the string in read-only memory. */
b4eb6b3d
JH
14534bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14535
14536for (align = 7; align >= 0; align--) {
14537 for (len = 36; len; len--) {
14538 b = buf+align;
14539 bcopy(abc, b, len);
14540 for (off = 1; off <= len; off++) {
14541 bcopy(b, b+off, len);
14542 bcopy(b+off, b, len);
14543 if (bcmp(b, abc, len))
14544 exit(1);
14545 }
14546 }
14547}
14548exit(0);
14549}
14550EOCP
b6cc3bc4
AD
14551 set try
14552 if eval $compile_ok; then
14553 if ./try 2>/dev/null; then
14554 echo "Yes, it can."
14555 val="$define"
14556 else
14557 echo "It can't, sorry."
14558 fi
b4eb6b3d 14559 else
b6cc3bc4 14560 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14561 fi
b6cc3bc4
AD
14562 ;;
14563 esac
14564 $rm -f try.* try core
b4eb6b3d
JH
14565 ;;
14566esac
b4eb6b3d
JH
14567set d_safebcpy
14568eval $setvar
14569
14570: can memcpy handle overlapping blocks?
b6cc3bc4 14571echo " "
b4eb6b3d 14572val="$undef"
b6cc3bc4
AD
14573case "$d_memmove" in
14574"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14575*) case "$d_memcpy" in
14576 "$define")
14577 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14578 $cat >try.c <<EOCP
b4eb6b3d
JH
14579#$i_memory I_MEMORY
14580#$i_stdlib I_STDLIB
14581#$i_string I_STRING
14582#$i_unistd I_UNISTD
14583EOCP
14584 $cat >>try.c <<'EOCP'
14585#include <stdio.h>
14586#ifdef I_MEMORY
14587# include <memory.h>
14588#endif
14589#ifdef I_STDLIB
14590# include <stdlib.h>
14591#endif
14592#ifdef I_STRING
14593# include <string.h>
14594#else
14595# include <strings.h>
14596#endif
14597#ifdef I_UNISTD
14598# include <unistd.h> /* Needed for NetBSD */
14599#endif
14600int main()
14601{
14602char buf[128], abc[128];
14603char *b;
14604int len;
14605int off;
14606int align;
14607
14608/* Copy "abcde..." string to char abc[] so that gcc doesn't
14609 try to store the string in read-only memory. */
14610memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14611
14612for (align = 7; align >= 0; align--) {
14613 for (len = 36; len; len--) {
14614 b = buf+align;
14615 memcpy(b, abc, len);
14616 for (off = 1; off <= len; off++) {
14617 memcpy(b+off, b, len);
14618 memcpy(b, b+off, len);
14619 if (memcmp(b, abc, len))
14620 exit(1);
14621 }
14622 }
14623}
14624exit(0);
14625}
14626EOCP
b6cc3bc4
AD
14627 set try
14628 if eval $compile_ok; then
14629 if ./try 2>/dev/null; then
14630 echo "Yes, it can."
14631 val="$define"
14632 else
14633 echo "It can't, sorry."
14634 fi
b4eb6b3d 14635 else
b6cc3bc4 14636 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14637 fi
b6cc3bc4
AD
14638 ;;
14639 esac
14640 $rm -f try.* try core
b4eb6b3d
JH
14641 ;;
14642esac
b4eb6b3d
JH
14643set d_safemcpy
14644eval $setvar
14645
14646: can memcmp be trusted to compare relative magnitude?
14647val="$undef"
14648case "$d_memcmp" in
14649"$define")
14650 echo " "
14651 echo "Checking if your memcmp() can compare relative magnitude..." >&4
14652 $cat >try.c <<EOCP
14653#$i_memory I_MEMORY
14654#$i_stdlib I_STDLIB
14655#$i_string I_STRING
14656#$i_unistd I_UNISTD
14657EOCP
14658 $cat >>try.c <<'EOCP'
14659#include <stdio.h>
14660#ifdef I_MEMORY
14661# include <memory.h>
14662#endif
14663#ifdef I_STDLIB
14664# include <stdlib.h>
14665#endif
14666#ifdef I_STRING
14667# include <string.h>
14668#else
14669# include <strings.h>
14670#endif
14671#ifdef I_UNISTD
14672# include <unistd.h> /* Needed for NetBSD */
14673#endif
14674int main()
14675{
14676char a = -1;
14677char b = 0;
14678if ((a < b) && memcmp(&a, &b, 1) < 0)
14679 exit(1);
14680exit(0);
14681}
14682EOCP
14683 set try
14684 if eval $compile_ok; then
5440bc8e 14685 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
14686 echo "Yes, it can."
14687 val="$define"
14688 else
14689 echo "No, it can't (it uses signed chars)."
14690 fi
14691 else
14692 echo "(I can't compile the test program, so we'll assume not...)"
14693 fi
14694 ;;
14695esac
14696$rm -f try.* try core
14697set d_sanemcmp
14698eval $setvar
14699
ef9f17be
JH
14700: see if prototype for sbrk is available
14701echo " "
14702set d_sbrkproto sbrk $i_unistd unistd.h
14703eval $hasproto
14704
b4eb6b3d
JH
14705: see if select exists
14706set select d_select
14707eval $inlibc
14708
14709: see if semctl exists
14710set semctl d_semctl
14711eval $inlibc
14712
14713: see if semget exists
14714set semget d_semget
14715eval $inlibc
14716
14717: see if semop exists
14718set semop d_semop
14719eval $inlibc
14720
14721: see how much of the 'sem*(2)' library is present.
14722h_sem=true
14723echo " "
14724case "$d_semctl$d_semget$d_semop" in
14725*"$undef"*) h_sem=false;;
14726esac
14727case "$osname" in
14728freebsd)
14729 case "`ipcs 2>&1`" in
14730 "SVID messages"*"not configured"*)
14731 echo "Your $osname does not have the sem*(2) configured." >&4
14732 h_sem=false
14733 val="$undef"
14734 set semctl d_semctl
14735 eval $setvar
14736 set semget d_semget
14737 eval $setvar
14738 set semop d_semop
14739 eval $setvar
14740 ;;
14741 esac
14742 ;;
14743esac
14744: we could also check for sys/ipc.h ...
14745if $h_sem && $test `./findhdr sys/sem.h`; then
14746 echo "You have the full sem*(2) library." >&4
14747 val="$define"
14748else
14749 echo "You don't have the full sem*(2) library." >&4
14750 val="$undef"
14751fi
14752set d_sem
14753eval $setvar
14754
14755: see whether sys/sem.h defines union semun
14756echo " "
14757$cat > try.c <<'END'
14758#include <sys/types.h>
14759#include <sys/ipc.h>
14760#include <sys/sem.h>
14761int main () { union semun semun; semun.buf = 0; }
14762END
14763set try
14764if eval $compile; then
14765 echo "You have union semun in <sys/sem.h>." >&4
14766 val="$define"
14767else
14768 echo "You do not have union semun in <sys/sem.h>." >&4
14769 val="$undef"
14770fi
14771$rm -f try try.c try.h
14772set d_union_semun
14773eval $setvar
14774
14775: see how to do semctl IPC_STAT
14776case "$d_sem" in
14777$define)
14778 : see whether semctl IPC_STAT can use union semun
14779 echo " "
14780 $cat > try.h <<END
14781#ifndef S_IRUSR
14782# ifdef S_IREAD
14783# define S_IRUSR S_IREAD
14784# define S_IWUSR S_IWRITE
14785# define S_IXUSR S_IEXEC
14786# else
14787# define S_IRUSR 0400
14788# define S_IWUSR 0200
14789# define S_IXUSR 0100
14790# endif
14791# define S_IRGRP (S_IRUSR>>3)
14792# define S_IWGRP (S_IWUSR>>3)
14793# define S_IXGRP (S_IXUSR>>3)
14794# define S_IROTH (S_IRUSR>>6)
14795# define S_IWOTH (S_IWUSR>>6)
14796# define S_IXOTH (S_IXUSR>>6)
14797#endif
14798#ifndef S_IRWXU
14799# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14800# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14801# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14802#endif
14803END
14804
14805 $cat > try.c <<END
14806#include <sys/types.h>
14807#include <sys/ipc.h>
14808#include <sys/sem.h>
14809#include <sys/stat.h>
14810#include <stdio.h>
14811#include <errno.h>
14812#include "try.h"
14813#ifndef errno
14814extern int errno;
14815#endif
14816#$d_union_semun HAS_UNION_SEMUN
14817int main() {
14818 union semun
14819#ifndef HAS_UNION_SEMUN
14820 {
14821 int val;
14822 struct semid_ds *buf;
14823 unsigned short *array;
14824 }
14825#endif
14826 arg;
14827 int sem, st;
14828
14829#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14830 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14831 if (sem > -1) {
14832 struct semid_ds argbuf;
14833 arg.buf = &argbuf;
14834# ifdef IPC_STAT
14835 st = semctl(sem, 0, IPC_STAT, arg);
14836 if (st == 0)
14837 printf("semun\n");
14838 else
14839# endif /* IPC_STAT */
14840 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14841# ifdef IPC_RMID
14842 if (semctl(sem, 0, IPC_RMID, arg) != 0)
14843# endif /* IPC_RMID */
14844 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14845 } else
14846#endif /* IPC_PRIVATE && ... */
14847 printf("semget failed: errno = %d\n", errno);
14848 return 0;
14849}
14850END
14851 val="$undef"
14852 set try
14853 if eval $compile; then
5440bc8e 14854 xxx=`$run ./try`
b4eb6b3d
JH
14855 case "$xxx" in
14856 semun) val="$define" ;;
14857 esac
14858 fi
14859 $rm -f try try.c
14860 set d_semctl_semun
14861 eval $setvar
14862 case "$d_semctl_semun" in
14863 $define)
14864 echo "You can use union semun for semctl IPC_STAT." >&4
14865 also='also'
14866 ;;
14867 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
14868 also=''
14869 ;;
14870 esac
14871
14872 : see whether semctl IPC_STAT can use struct semid_ds pointer
14873 $cat > try.c <<'END'
14874#include <sys/types.h>
14875#include <sys/ipc.h>
14876#include <sys/sem.h>
14877#include <sys/stat.h>
14878#include "try.h"
14879#include <stdio.h>
14880#include <errno.h>
14881#ifndef errno
14882extern int errno;
14883#endif
14884int main() {
14885 struct semid_ds arg;
14886 int sem, st;
14887
14888#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14889 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14890 if (sem > -1) {
14891# ifdef IPC_STAT
14892 st = semctl(sem, 0, IPC_STAT, &arg);
14893 if (st == 0)
14894 printf("semid_ds\n");
14895 else
14896# endif /* IPC_STAT */
14897 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14898# ifdef IPC_RMID
14899 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14900# endif /* IPC_RMID */
14901 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14902 } else
14903#endif /* IPC_PRIVATE && ... */
14904 printf("semget failed: errno = %d\n", errno);
14905
14906 return 0;
14907}
14908END
14909 val="$undef"
14910 set try
14911 if eval $compile; then
5440bc8e 14912 xxx=`$run ./try`
b4eb6b3d
JH
14913 case "$xxx" in
14914 semid_ds) val="$define" ;;
14915 esac
14916 fi
14917 $rm -f try try.c
14918 set d_semctl_semid_ds
14919 eval $setvar
14920 case "$d_semctl_semid_ds" in
14921 $define)
14922 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14923 ;;
14924 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14925 ;;
14926 esac
14927 $rm -f try.h
14928 ;;
14929*) val="$undef"
14930
14931 # We do not have the full sem*(2) library, so assume we can not
14932 # use either.
14933
14934 set d_semctl_semun
14935 eval $setvar
14936
14937 set d_semctl_semid_ds
14938 eval $setvar
14939 ;;
14940esac
14941
4e0554ec
JH
14942: see if sendmsg exists
14943set sendmsg d_sendmsg
14944eval $inlibc
14945
b4eb6b3d
JH
14946: see if setegid exists
14947set setegid d_setegid
14948eval $inlibc
14949
14950: see if seteuid exists
14951set seteuid d_seteuid
14952eval $inlibc
14953
14954: see if setgrent exists
14955set setgrent d_setgrent
14956eval $inlibc
14957
10bc17b6
JH
14958: see if setgrent_r exists
14959set setgrent_r d_setgrent_r
14960eval $inlibc
14961case "$d_setgrent_r" in
14962"$define")
14963 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
14964 case "$d_setgrent_r_proto:$usethreads" in
14965 ":define") d_setgrent_r_proto=define
a48ec845
JH
14966 set d_setgrent_r_proto setgrent_r $hdrs
14967 eval $hasproto ;;
14968 *) ;;
14969 esac
14970 case "$d_setgrent_r_proto" in
14971 define)
10bc17b6
JH
14972 case "$setgrent_r_proto" in
14973 ''|0) try='int setgrent_r(FILE**);'
14974 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14975 esac
14976 case "$setgrent_r_proto" in
14977 ''|0) try='void setgrent_r(FILE**);'
14978 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14979 esac
14980 case "$setgrent_r_proto" in
90e831dc 14981 ''|0) d_setgrent_r=undef
10bc17b6 14982 setgrent_r_proto=0
a48ec845 14983 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14984 * ) case "$setgrent_r_proto" in
14985 REENTRANT_PROTO*) ;;
14986 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14987 esac
14988 echo "Prototype: $try" ;;
14989 esac
14990 ;;
c18e646a
JH
14991 *) case "$usethreads" in
14992 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14993 esac
90e831dc
SB
14994 d_setgrent_r=undef
14995 setgrent_r_proto=0
c18e646a 14996 ;;
a48ec845
JH
14997 esac
14998 ;;
10bc17b6
JH
14999*) setgrent_r_proto=0
15000 ;;
15001esac
15002
b4eb6b3d
JH
15003: see if sethostent exists
15004set sethostent d_sethent
15005eval $inlibc
15006
10bc17b6
JH
15007: see if sethostent_r exists
15008set sethostent_r d_sethostent_r
15009eval $inlibc
15010case "$d_sethostent_r" in
15011"$define")
15012 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15013 case "$d_sethostent_r_proto:$usethreads" in
15014 ":define") d_sethostent_r_proto=define
a48ec845
JH
15015 set d_sethostent_r_proto sethostent_r $hdrs
15016 eval $hasproto ;;
15017 *) ;;
15018 esac
15019 case "$d_sethostent_r_proto" in
15020 define)
10bc17b6
JH
15021 case "$sethostent_r_proto" in
15022 ''|0) try='int sethostent_r(int, struct hostent_data*);'
15023 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15024 esac
15025 case "$sethostent_r_proto" in
15026 ''|0) try='void sethostent_r(int, struct hostent_data*);'
15027 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15028 esac
15029 case "$sethostent_r_proto" in
90e831dc 15030 ''|0) d_sethostent_r=undef
10bc17b6 15031 sethostent_r_proto=0
a48ec845 15032 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15033 * ) case "$sethostent_r_proto" in
15034 REENTRANT_PROTO*) ;;
15035 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15036 esac
15037 echo "Prototype: $try" ;;
15038 esac
15039 ;;
c18e646a
JH
15040 *) case "$usethreads" in
15041 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15042 esac
90e831dc
SB
15043 d_sethostent_r=undef
15044 sethostent_r_proto=0
c18e646a 15045 ;;
a48ec845
JH
15046 esac
15047 ;;
10bc17b6
JH
15048*) sethostent_r_proto=0
15049 ;;
15050esac
15051
4e0554ec
JH
15052: see if setitimer exists
15053set setitimer d_setitimer
15054eval $inlibc
15055
b4eb6b3d
JH
15056: see if setlinebuf exists
15057set setlinebuf d_setlinebuf
15058eval $inlibc
15059
15060: see if setlocale exists
15061set setlocale d_setlocale
15062eval $inlibc
15063
10bc17b6
JH
15064: see if locale.h is available
15065set locale.h i_locale
15066eval $inhdr
15067
15068: see if setlocale_r exists
15069set setlocale_r d_setlocale_r
15070eval $inlibc
15071case "$d_setlocale_r" in
15072"$define")
15073 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
15074 case "$d_setlocale_r_proto:$usethreads" in
15075 ":define") d_setlocale_r_proto=define
a48ec845
JH
15076 set d_setlocale_r_proto setlocale_r $hdrs
15077 eval $hasproto ;;
15078 *) ;;
15079 esac
15080 case "$d_setlocale_r_proto" in
15081 define)
10bc17b6
JH
15082 case "$setlocale_r_proto" in
15083 ''|0) try='int setlocale_r(int, const char*, char*, int);'
15084 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15085 esac
15086 case "$setlocale_r_proto" in
90e831dc 15087 ''|0) d_setlocale_r=undef
10bc17b6 15088 setlocale_r_proto=0
a48ec845 15089 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15090 * ) case "$setlocale_r_proto" in
15091 REENTRANT_PROTO*) ;;
15092 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15093 esac
15094 echo "Prototype: $try" ;;
15095 esac
15096 ;;
c18e646a
JH
15097 *) case "$usethreads" in
15098 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15099 esac
90e831dc
SB
15100 d_setlocale_r=undef
15101 setlocale_r_proto=0
c18e646a 15102 ;;
a48ec845
JH
15103 esac
15104 ;;
10bc17b6
JH
15105*) setlocale_r_proto=0
15106 ;;
15107esac
15108
b4eb6b3d
JH
15109: see if setnetent exists
15110set setnetent d_setnent
15111eval $inlibc
15112
10bc17b6
JH
15113: see if setnetent_r exists
15114set setnetent_r d_setnetent_r
15115eval $inlibc
15116case "$d_setnetent_r" in
15117"$define")
15118 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15119 case "$d_setnetent_r_proto:$usethreads" in
15120 ":define") d_setnetent_r_proto=define
a48ec845
JH
15121 set d_setnetent_r_proto setnetent_r $hdrs
15122 eval $hasproto ;;
15123 *) ;;
15124 esac
15125 case "$d_setnetent_r_proto" in
15126 define)
10bc17b6
JH
15127 case "$setnetent_r_proto" in
15128 ''|0) try='int setnetent_r(int, struct netent_data*);'
15129 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15130 esac
15131 case "$setnetent_r_proto" in
15132 ''|0) try='void setnetent_r(int, struct netent_data*);'
15133 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15134 esac
15135 case "$setnetent_r_proto" in
90e831dc 15136 ''|0) d_setnetent_r=undef
10bc17b6 15137 setnetent_r_proto=0
a48ec845 15138 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15139 * ) case "$setnetent_r_proto" in
15140 REENTRANT_PROTO*) ;;
15141 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15142 esac
15143 echo "Prototype: $try" ;;
15144 esac
15145 ;;
c18e646a
JH
15146 *) case "$usethreads" in
15147 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15148 esac
90e831dc
SB
15149 d_setnetent_r=undef
15150 setnetent_r_proto=0
c18e646a 15151 ;;
a48ec845
JH
15152 esac
15153 ;;
10bc17b6
JH
15154*) setnetent_r_proto=0
15155 ;;
15156esac
15157
b4eb6b3d
JH
15158: see if setprotoent exists
15159set setprotoent d_setpent
15160eval $inlibc
15161
15162: see if setpgid exists
15163set setpgid d_setpgid
15164eval $inlibc
15165
15166: see if setpgrp2 exists
15167set setpgrp2 d_setpgrp2
15168eval $inlibc
15169
15170: see if setpriority exists
15171set setpriority d_setprior
15172eval $inlibc
15173
15174: see if setproctitle exists
15175set setproctitle d_setproctitle
15176eval $inlibc
15177
10bc17b6
JH
15178: see if setprotoent_r exists
15179set setprotoent_r d_setprotoent_r
15180eval $inlibc
15181case "$d_setprotoent_r" in
15182"$define")
15183 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15184 case "$d_setprotoent_r_proto:$usethreads" in
15185 ":define") d_setprotoent_r_proto=define
a48ec845
JH
15186 set d_setprotoent_r_proto setprotoent_r $hdrs
15187 eval $hasproto ;;
15188 *) ;;
15189 esac
15190 case "$d_setprotoent_r_proto" in
15191 define)
10bc17b6
JH
15192 case "$setprotoent_r_proto" in
15193 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15194 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15195 esac
15196 case "$setprotoent_r_proto" in
15197 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15198 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15199 esac
15200 case "$setprotoent_r_proto" in
90e831dc 15201 ''|0) d_setprotoent_r=undef
10bc17b6 15202 setprotoent_r_proto=0
a48ec845 15203 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15204 * ) case "$setprotoent_r_proto" in
15205 REENTRANT_PROTO*) ;;
15206 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15207 esac
15208 echo "Prototype: $try" ;;
15209 esac
15210 ;;
c18e646a
JH
15211 *) case "$usethreads" in
15212 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15213 esac
90e831dc
SB
15214 d_setprotoent_r=undef
15215 setprotoent_r_proto=0
c18e646a 15216 ;;
a48ec845
JH
15217 esac
15218 ;;
10bc17b6
JH
15219*) setprotoent_r_proto=0
15220 ;;
15221esac
15222
b4eb6b3d
JH
15223: see if setpwent exists
15224set setpwent d_setpwent
15225eval $inlibc
15226
10bc17b6
JH
15227: see if setpwent_r exists
15228set setpwent_r d_setpwent_r
15229eval $inlibc
15230case "$d_setpwent_r" in
15231"$define")
15232 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
15233 case "$d_setpwent_r_proto:$usethreads" in
15234 ":define") d_setpwent_r_proto=define
a48ec845
JH
15235 set d_setpwent_r_proto setpwent_r $hdrs
15236 eval $hasproto ;;
15237 *) ;;
15238 esac
15239 case "$d_setpwent_r_proto" in
15240 define)
10bc17b6
JH
15241 case "$setpwent_r_proto" in
15242 ''|0) try='int setpwent_r(FILE**);'
15243 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15244 esac
15245 case "$setpwent_r_proto" in
15246 ''|0) try='void setpwent_r(FILE**);'
15247 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15248 esac
15249 case "$setpwent_r_proto" in
90e831dc 15250 ''|0) d_setpwent_r=undef
10bc17b6 15251 setpwent_r_proto=0
a48ec845 15252 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15253 * ) case "$setpwent_r_proto" in
15254 REENTRANT_PROTO*) ;;
15255 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15256 esac
15257 echo "Prototype: $try" ;;
15258 esac
15259 ;;
c18e646a
JH
15260 *) case "$usethreads" in
15261 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15262 esac
90e831dc
SB
15263 d_setpwent_r=undef
15264 setpwent_r_proto=0
c18e646a 15265 ;;
a48ec845
JH
15266 esac
15267 ;;
10bc17b6
JH
15268*) setpwent_r_proto=0
15269 ;;
15270esac
15271
b4eb6b3d
JH
15272: see if setregid exists
15273set setregid d_setregid
15274eval $inlibc
15275set setresgid d_setresgid
15276eval $inlibc
15277
15278: see if setreuid exists
15279set setreuid d_setreuid
15280eval $inlibc
15281set setresuid d_setresuid
15282eval $inlibc
15283
15284: see if setrgid exists
15285set setrgid d_setrgid
15286eval $inlibc
15287
15288: see if setruid exists
15289set setruid d_setruid
15290eval $inlibc
15291
15292: see if setservent exists
15293set setservent d_setsent
15294eval $inlibc
15295
10bc17b6
JH
15296: see if setservent_r exists
15297set setservent_r d_setservent_r
15298eval $inlibc
15299case "$d_setservent_r" in
15300"$define")
15301 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15302 case "$d_setservent_r_proto:$usethreads" in
15303 ":define") d_setservent_r_proto=define
a48ec845
JH
15304 set d_setservent_r_proto setservent_r $hdrs
15305 eval $hasproto ;;
15306 *) ;;
15307 esac
15308 case "$d_setservent_r_proto" in
15309 define)
10bc17b6
JH
15310 case "$setservent_r_proto" in
15311 ''|0) try='int setservent_r(int, struct servent_data*);'
15312 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15313 esac
15314 case "$setservent_r_proto" in
15315 ''|0) try='void setservent_r(int, struct servent_data*);'
15316 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15317 esac
15318 case "$setservent_r_proto" in
90e831dc 15319 ''|0) d_setservent_r=undef
10bc17b6 15320 setservent_r_proto=0
a48ec845 15321 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15322 * ) case "$setservent_r_proto" in
15323 REENTRANT_PROTO*) ;;
15324 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15325 esac
15326 echo "Prototype: $try" ;;
15327 esac
15328 ;;
c18e646a
JH
15329 *) case "$usethreads" in
15330 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15331 esac
90e831dc
SB
15332 d_setservent_r=undef
15333 setservent_r_proto=0
c18e646a 15334 ;;
a48ec845
JH
15335 esac
15336 ;;
10bc17b6
JH
15337*) setservent_r_proto=0
15338 ;;
15339esac
15340
b4eb6b3d
JH
15341: see if setsid exists
15342set setsid d_setsid
15343eval $inlibc
15344
15345: see if setvbuf exists
15346set setvbuf d_setvbuf
15347eval $inlibc
15348
15349: see if sfio.h is available
15350set sfio.h i_sfio
15351eval $inhdr
15352
15353
15354: see if sfio library is available
15355case "$i_sfio" in
15356$define)
15357 val=''
15358 set sfreserve val
15359 eval $inlibc
15360 ;;
15361*)
15362 val="$undef"
15363 ;;
15364esac
15365: Ok, but do we want to use it.
15366case "$val" in
15367$define)
15368 case "$usesfio" in
15369 true|$define|[yY]*) dflt='y';;
15370 *) dflt='n';;
15371 esac
15372 echo "$package can use the sfio library, but it is experimental."
15373 case "$useperlio" in
15374 "$undef")
15375 echo "For sfio also the PerlIO abstraction layer is needed."
15376 echo "Earlier you said you wouldn't want that."
15377 ;;
15378 esac
15379 rp="You seem to have sfio available, do you want to try using it?"
15380 . ./myread
15381 case "$ans" in
15382 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
15383 useperlio="$define"
15384 val="$define"
15385 ;;
15386 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
15387 val="$undef"
b4eb6b3d
JH
15388 ;;
15389 esac
15390 ;;
15391*) case "$usesfio" in
15392 true|$define|[yY]*)
15393 echo "Sorry, cannot find sfio on this machine." >&4
15394 echo "Ignoring your setting of usesfio=$usesfio." >&4
15395 val="$undef"
15396 ;;
15397 esac
15398 ;;
15399esac
15400set d_sfio
15401eval $setvar
15402case "$d_sfio" in
15403$define) usesfio='true';;
15404*) usesfio='false';;
15405esac
3659ebf1
JH
15406case "$d_sfio" in
15407$define) ;;
15408*) : Remove sfio from list of libraries to use
7483f793
JH
15409 case "$libs" in
15410 *-lsfio*)
15411 echo "Removing unneeded -lsfio from library list" >&4
15412 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15413 shift
15414 libs="$*"
15415 echo "libs = $libs" >&4
15416 ;;
15417 esac
3659ebf1
JH
15418;;
15419esac
15420
b4eb6b3d
JH
15421
15422: see if shmctl exists
15423set shmctl d_shmctl
15424eval $inlibc
15425
15426: see if shmget exists
15427set shmget d_shmget
15428eval $inlibc
15429
15430: see if shmat exists
15431set shmat d_shmat
15432eval $inlibc
15433: see what shmat returns
15434case "$d_shmat" in
15435"$define")
15436 $cat >shmat.c <<'END'
15437#include <sys/shm.h>
15438void *shmat();
15439END
15440 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15441 shmattype='void *'
15442 else
15443 shmattype='char *'
15444 fi
15445 echo "and it returns ($shmattype)." >&4
15446 : see if a prototype for shmat is available
15447 xxx=`./findhdr sys/shm.h`
15448 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15449 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15450 val="$define"
15451 else
15452 val="$undef"
15453 fi
15454 $rm -f shmat.[co]
15455 ;;
15456*)
15457 val="$undef"
15458 ;;
15459esac
15460set d_shmatprototype
15461eval $setvar
15462
15463: see if shmdt exists
15464set shmdt d_shmdt
15465eval $inlibc
15466
15467: see how much of the 'shm*(2)' library is present.
15468h_shm=true
15469echo " "
15470case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15471*"$undef"*) h_shm=false;;
15472esac
15473case "$osname" in
15474freebsd)
15475 case "`ipcs 2>&1`" in
15476 "SVID shared memory"*"not configured"*)
15477 echo "Your $osname does not have the shm*(2) configured." >&4
15478 h_shm=false
15479 val="$undef"
15480 set shmctl d_shmctl
15481 evat $setvar
15482 set shmget d_shmget
15483 evat $setvar
15484 set shmat d_shmat
15485 evat $setvar
15486 set shmdt d_shmdt
15487 evat $setvar
15488 ;;
15489 esac
15490 ;;
15491esac
15492: we could also check for sys/ipc.h ...
15493if $h_shm && $test `./findhdr sys/shm.h`; then
15494 echo "You have the full shm*(2) library." >&4
15495 val="$define"
15496else
15497 echo "You don't have the full shm*(2) library." >&4
15498 val="$undef"
15499fi
15500set d_shm
15501eval $setvar
15502
15503echo " "
15504: see if we have sigaction
15505if set sigaction val -f d_sigaction; eval $csym; $val; then
15506 echo 'sigaction() found.' >&4
15507 $cat > try.c <<'EOP'
15508#include <stdio.h>
15509#include <sys/types.h>
15510#include <signal.h>
15511int main()
15512{
15513 struct sigaction act, oact;
15514 act.sa_flags = 0;
15515 oact.sa_handler = 0;
15516 /* so that act and oact are used */
15517 exit(act.sa_flags == 0 && oact.sa_handler == 0);
15518}
15519EOP
15520 set try
15521 if eval $compile_ok; then
15522 val="$define"
15523 else
15524 echo "But you don't seem to have a useable struct sigaction." >&4
15525 val="$undef"
15526 fi
15527else
15528 echo 'sigaction NOT found.' >&4
15529 val="$undef"
15530fi
15531set d_sigaction; eval $setvar
15532$rm -f try try$_o try.c
15533
983dbef6
JH
15534: see if sigprocmask exists
15535set sigprocmask d_sigprocmask
15536eval $inlibc
15537
b4eb6b3d
JH
15538: see if sigsetjmp exists
15539echo " "
15540case "$d_sigsetjmp" in
15541'')
15542 $cat >try.c <<'EOP'
15543#include <setjmp.h>
15544sigjmp_buf env;
15545int set = 1;
15546int main()
15547{
15548 if (sigsetjmp(env,1))
15549 exit(set);
15550 set = 0;
15551 siglongjmp(env, 1);
15552 exit(1);
15553}
15554EOP
15555 set try
15556 if eval $compile; then
5440bc8e 15557 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
15558 echo "POSIX sigsetjmp found." >&4
15559 val="$define"
15560 else
15561 $cat >&4 <<EOM
15562Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15563I'll ignore them.
15564EOM
15565 val="$undef"
15566 fi
15567 else
15568 echo "sigsetjmp not found." >&4
15569 val="$undef"
15570 fi
15571 ;;
15572*) val="$d_sigsetjmp"
15573 case "$d_sigsetjmp" in
15574 $define) echo "POSIX sigsetjmp found." >&4;;
15575 $undef) echo "sigsetjmp not found." >&4;;
15576 esac
15577 ;;
15578esac
15579set d_sigsetjmp
15580eval $setvar
15581$rm -f try.c try
15582
49a78c82
JH
15583: see if sockatmark exists
15584set sockatmark d_sockatmark
15585eval $inlibc
15586
2ef53570
JH
15587: see if prototype for sockatmark is available
15588echo " "
15589set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15590eval $hasproto
15591
b4eb6b3d
JH
15592: see if socks5_init exists
15593set socks5_init d_socks5_init
15594eval $inlibc
15595
10bc17b6
JH
15596: see if srand48_r exists
15597set srand48_r d_srand48_r
15598eval $inlibc
15599case "$d_srand48_r" in
15600"$define")
15601 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15602 case "$d_srand48_r_proto:$usethreads" in
15603 ":define") d_srand48_r_proto=define
a48ec845
JH
15604 set d_srand48_r_proto srand48_r $hdrs
15605 eval $hasproto ;;
15606 *) ;;
15607 esac
15608 case "$d_srand48_r_proto" in
15609 define)
10bc17b6
JH
15610 case "$srand48_r_proto" in
15611 ''|0) try='int srand48_r(long, struct drand48_data*);'
15612 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15613 esac
15614 case "$srand48_r_proto" in
90e831dc 15615 ''|0) d_srand48_r=undef
10bc17b6 15616 srand48_r_proto=0
a48ec845 15617 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15618 * ) case "$srand48_r_proto" in
15619 REENTRANT_PROTO*) ;;
15620 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15621 esac
15622 echo "Prototype: $try" ;;
15623 esac
15624 ;;
c18e646a
JH
15625 *) case "$usethreads" in
15626 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15627 esac
90e831dc
SB
15628 d_srand48_r=undef
15629 srand48_r_proto=0
c18e646a 15630 ;;
a48ec845
JH
15631 esac
15632 ;;
10bc17b6
JH
15633*) srand48_r_proto=0
15634 ;;
15635esac
15636
15637: see if srandom_r exists
15638set srandom_r d_srandom_r
15639eval $inlibc
15640case "$d_srandom_r" in
15641"$define")
15642 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15643 case "$d_srandom_r_proto:$usethreads" in
15644 ":define") d_srandom_r_proto=define
a48ec845
JH
15645 set d_srandom_r_proto srandom_r $hdrs
15646 eval $hasproto ;;
15647 *) ;;
15648 esac
15649 case "$d_srandom_r_proto" in
15650 define)
10bc17b6
JH
15651 case "$srandom_r_proto" in
15652 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15653 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15654 esac
15655 case "$srandom_r_proto" in
90e831dc 15656 ''|0) d_srandom_r=undef
10bc17b6 15657 srandom_r_proto=0
a48ec845 15658 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15659 * ) case "$srandom_r_proto" in
15660 REENTRANT_PROTO*) ;;
15661 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15662 esac
15663 echo "Prototype: $try" ;;
15664 esac
15665 ;;
c18e646a
JH
15666 *) case "$usethreads" in
15667 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15668 esac
90e831dc
SB
15669 d_srandom_r=undef
15670 srandom_r_proto=0
c18e646a 15671 ;;
a48ec845
JH
15672 esac
15673 ;;
10bc17b6
JH
15674*) srandom_r_proto=0
15675 ;;
15676esac
15677
eef837ea
JH
15678: see if prototype for setresgid is available
15679echo " "
15680set d_sresgproto setresgid $i_unistd unistd.h
15681eval $hasproto
15682
640374d0
JH
15683: see if prototype for setresuid is available
15684echo " "
15685set d_sresuproto setresuid $i_unistd unistd.h
15686eval $hasproto
15687
b4eb6b3d
JH
15688: see if sys/stat.h is available
15689set sys/stat.h i_sysstat
15690eval $inhdr
15691
15692
15693: see if stat knows about block sizes
15694echo " "
15695echo "Checking to see if your struct stat has st_blocks field..." >&4
15696set d_statblks stat st_blocks $i_sysstat sys/stat.h
15697eval $hasfield
15698
15699
15700: see if this is a sys/vfs.h system
15701set sys/vfs.h i_sysvfs
15702eval $inhdr
15703
15704
15705: see if this is a sys/statfs.h system
15706set sys/statfs.h i_sysstatfs
15707eval $inhdr
15708
15709
15710echo " "
15711echo "Checking to see if your system supports struct statfs..." >&4
15712set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
15713eval $hasstruct
15714case "$d_statfs_s" in
15715"$define") echo "Yes, it does." ;;
15716*) echo "No, it doesn't." ;;
15717esac
15718
15719
15720
15721: see if struct statfs knows about f_flags
15722case "$d_statfs_s" in
15723define)
15724 echo " "
15725 echo "Checking to see if your struct statfs has f_flags field..." >&4
15726 set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
15727 eval $hasfield
15728 ;;
15729*) val="$undef"
15730 set d_statfs_f_flags
15731 eval $setvar
15732 ;;
15733esac
15734case "$d_statfs_f_flags" in
15735"$define") echo "Yes, it does." ;;
15736*) echo "No, it doesn't." ;;
15737esac
15738
15739: see if _ptr and _cnt from stdio act std
15740echo " "
80f36755
NC
15741
15742if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15743 echo "(Looks like you have stdio.h from BSD.)"
15744 case "$stdio_ptr" in
15745 '') stdio_ptr='((fp)->_p)'
15746 ptr_lval=$define
15747 ;;
15748 *) ptr_lval=$d_stdio_ptr_lval;;
15749 esac
15750 case "$stdio_cnt" in
15751 '') stdio_cnt='((fp)->_r)'
15752 cnt_lval=$define
15753 ;;
15754 *) cnt_lval=$d_stdio_cnt_lval;;
15755 esac
15756 case "$stdio_base" in
15757 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15758 esac
15759 case "$stdio_bufsiz" in
15760 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15761 esac
15762elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
15763 echo "(Looks like you have stdio.h from Linux.)"
15764 case "$stdio_ptr" in
15765 '') stdio_ptr='((fp)->_IO_read_ptr)'
15766 ptr_lval=$define
15767 ;;
15768 *) ptr_lval=$d_stdio_ptr_lval;;
15769 esac
15770 case "$stdio_cnt" in
15771 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15772 cnt_lval=$undef
15773 ;;
15774 *) cnt_lval=$d_stdio_cnt_lval;;
15775 esac
15776 case "$stdio_base" in
15777 '') stdio_base='((fp)->_IO_read_base)';;
15778 esac
15779 case "$stdio_bufsiz" in
15780 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15781 esac
15782else
15783 case "$stdio_ptr" in
15784 '') stdio_ptr='((fp)->_ptr)'
15785 ptr_lval=$define
15786 ;;
15787 *) ptr_lval=$d_stdio_ptr_lval;;
15788 esac
15789 case "$stdio_cnt" in
15790 '') stdio_cnt='((fp)->_cnt)'
15791 cnt_lval=$define
15792 ;;
15793 *) cnt_lval=$d_stdio_cnt_lval;;
15794 esac
15795 case "$stdio_base" in
15796 '') stdio_base='((fp)->_base)';;
15797 esac
15798 case "$stdio_bufsiz" in
15799 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15800 esac
15801fi
80f36755 15802
b4eb6b3d
JH
15803: test whether _ptr and _cnt really work
15804echo "Checking how std your stdio is..." >&4
15805$cat >try.c <<EOP
15806#include <stdio.h>
15807#define FILE_ptr(fp) $stdio_ptr
15808#define FILE_cnt(fp) $stdio_cnt
15809int main() {
15810 FILE *fp = fopen("try.c", "r");
15811 char c = getc(fp);
15812 if (
15813 18 <= FILE_cnt(fp) &&
15814 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15815 )
15816 exit(0);
15817 exit(1);
15818}
15819EOP
15820val="$undef"
15821set try
5440bc8e
JH
15822if eval $compile && $to try.c; then
15823 if $run ./try; then
b4eb6b3d
JH
15824 echo "Your stdio acts pretty std."
15825 val="$define"
15826 else
15827 echo "Your stdio isn't very std."
15828 fi
15829else
15830 echo "Your stdio doesn't appear very std."
15831fi
15832$rm -f try.c try
5f6e0ee4
AD
15833
15834# glibc 2.2.90 and above apparently change stdio streams so Perl's
15835# direct buffer manipulation no longer works. The Configure tests
15836# should be changed to correctly detect this, but until then,
15837# the following check should at least let perl compile and run.
15838# (This quick fix should be updated before 5.8.1.)
15839# To be defensive, reject all unknown versions, and all versions > 2.2.9.
15840# A. Dougherty, June 3, 2002.
15841case "$d_gnulibc" in
15842$define)
15843 case "$gnulibc_version" in
15844 2.[01]*) ;;
15845 2.2) ;;
15846 2.2.[0-9]) ;;
15847 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15848 val="$undef"
15849 ;;
15850 esac
15851 ;;
15852esac
b4eb6b3d
JH
15853set d_stdstdio
15854eval $setvar
15855
15856: Can _ptr be used as an lvalue?
15857case "$d_stdstdio$ptr_lval" in
15858$define$define) val=$define ;;
15859*) val=$undef ;;
15860esac
15861set d_stdio_ptr_lval
15862eval $setvar
15863
15864: Can _cnt be used as an lvalue?
15865case "$d_stdstdio$cnt_lval" in
15866$define$define) val=$define ;;
15867*) val=$undef ;;
15868esac
15869set d_stdio_cnt_lval
15870eval $setvar
15871
a7ffa9b9
NC
15872
15873: test whether setting _ptr sets _cnt as a side effect
15874d_stdio_ptr_lval_sets_cnt="$undef"
15875d_stdio_ptr_lval_nochange_cnt="$undef"
15876case "$d_stdio_ptr_lval$d_stdstdio" in
15877$define$define)
15878 echo "Checking to see what happens if we set the stdio ptr..." >&4
15879$cat >try.c <<EOP
15880#include <stdio.h>
15881/* Can we scream? */
15882/* Eat dust sed :-) */
c1d9e6fa 15883/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
15884#define FILE_ptr(fp) $stdio_ptr
15885#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 15886#include <sys/types.h>
a7ffa9b9
NC
15887int main() {
15888 FILE *fp = fopen("try.c", "r");
c1d9e6fa 15889 int c;
a7ffa9b9
NC
15890 char *ptr;
15891 size_t cnt;
c1d9e6fa
JH
15892 if (!fp) {
15893 puts("Fail even to read");
15894 exit(1);
15895 }
15896 c = getc(fp); /* Read away the first # */
15897 if (c == EOF) {
15898 puts("Fail even to read");
15899 exit(1);
15900 }
a7ffa9b9
NC
15901 if (!(
15902 18 <= FILE_cnt(fp) &&
15903 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15904 )) {
15905 puts("Fail even to read");
15906 exit (1);
15907 }
c1d9e6fa
JH
15908 ptr = (char*) FILE_ptr(fp);
15909 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 15910
c1d9e6fa 15911 FILE_ptr(fp) += 42;
a7ffa9b9 15912
c1d9e6fa 15913 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
15914 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15915 exit (1);
15916 }
15917 if (FILE_cnt(fp) <= 20) {
15918 printf ("Fail (<20 chars to test)");
15919 exit (1);
15920 }
15921 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15922 puts("Fail compare");
15923 exit (1);
15924 }
15925 if (cnt == FILE_cnt(fp)) {
15926 puts("Pass_unchanged");
15927 exit (0);
15928 }
15929 if (FILE_cnt(fp) == (cnt - 42)) {
15930 puts("Pass_changed");
15931 exit (0);
15932 }
15933 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15934 return 1;
15935
15936}
15937EOP
15938 set try
5440bc8e
JH
15939 if eval $compile && $to try.c; then
15940 case `$run ./try` in
a7ffa9b9 15941 Pass_changed)
2e32dcfe 15942 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
15943 d_stdio_ptr_lval_sets_cnt="$define" ;;
15944 Pass_unchanged)
15945 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
15946 d_stdio_ptr_lval_nochange_cnt="$define" ;;
15947 Fail*)
15948 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
15949 *)
15950 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15951 esac
15952 else
15953 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
15954 fi
15955 $rm -f try.c try
15956 ;;
15957esac
15958
b4eb6b3d
JH
15959: see if _base is also standard
15960val="$undef"
15961case "$d_stdstdio" in
15962$define)
15963 $cat >try.c <<EOP
15964#include <stdio.h>
15965#define FILE_base(fp) $stdio_base
15966#define FILE_bufsiz(fp) $stdio_bufsiz
15967int main() {
15968 FILE *fp = fopen("try.c", "r");
15969 char c = getc(fp);
15970 if (
15971 19 <= FILE_bufsiz(fp) &&
15972 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15973 )
15974 exit(0);
15975 exit(1);
15976}
15977EOP
15978 set try
5440bc8e
JH
15979 if eval $compile && $to try.c; then
15980 if $run ./try; then
b4eb6b3d
JH
15981 echo "And its _base field acts std."
15982 val="$define"
15983 else
15984 echo "But its _base field isn't std."
15985 fi
15986 else
15987 echo "However, it seems to be lacking the _base field."
15988 fi
15989 $rm -f try.c try
15990 ;;
15991esac
15992set d_stdiobase
15993eval $setvar
15994
15995$cat >&4 <<EOM
15996Checking how to access stdio streams by file descriptor number...
15997EOM
15998case "$stdio_stream_array" in
15999'') $cat >try.c <<EOCP
16000#include <stdio.h>
16001int main() {
16002 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16003 printf("yes\n");
16004}
16005EOCP
16006 for s in _iob __iob __sF
16007 do
16008 set try -DSTDIO_STREAM_ARRAY=$s
16009 if eval $compile; then
5440bc8e 16010 case "`$run ./try`" in
b4eb6b3d
JH
16011 yes) stdio_stream_array=$s; break ;;
16012 esac
16013 fi
16014 done
16015 $rm -f try.* try$exe_ext
16016esac
16017case "$stdio_stream_array" in
16018'') $cat >&4 <<EOM
16019I can't figure out how to access stdio streams by file descriptor number.
16020EOM
16021 d_stdio_stream_array="$undef"
16022 ;;
16023*) $cat >&4 <<EOM
16024You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16025EOM
16026 d_stdio_stream_array="$define"
16027 ;;
16028esac
16029
16030: see if strcoll exists
16031set strcoll d_strcoll
16032eval $inlibc
16033
16034: check for structure copying
16035echo " "
16036echo "Checking to see if your C compiler can copy structs..." >&4
16037$cat >try.c <<'EOCP'
76f47787 16038int main()
b4eb6b3d
JH
16039{
16040 struct blurfl {
16041 int dyick;
16042 } foo, bar;
16043
16044 foo = bar;
16045}
16046EOCP
16047if $cc -c try.c >/dev/null 2>&1 ; then
16048 val="$define"
16049 echo "Yup, it can."
16050else
16051 val="$undef"
16052 echo "Nope, it can't."
16053fi
16054set d_strctcpy
16055eval $setvar
16056$rm -f try.*
16057
16058: see if strerror and/or sys_errlist[] exist
16059echo " "
16060if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16061 if set strerror val -f d_strerror; eval $csym; $val; then
16062 echo 'strerror() found.' >&4
16063 d_strerror="$define"
16064 d_strerrm='strerror(e)'
16065 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16066 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16067 d_syserrlst="$define"
16068 else
16069 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16070 d_syserrlst="$undef"
16071 fi
16072 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16073 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16074 echo 'strerror() found in string header.' >&4
16075 d_strerror="$define"
16076 d_strerrm='strerror(e)'
16077 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16078 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16079 d_syserrlst="$define"
16080 else
16081 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16082 d_syserrlst="$undef"
16083 fi
16084 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16085 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16086 d_strerror="$undef"
16087 d_syserrlst="$define"
16088 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16089 else
16090 echo 'strerror() and sys_errlist[] NOT found.' >&4
16091 d_strerror="$undef"
16092 d_syserrlst="$undef"
16093 d_strerrm='"unknown"'
16094 fi
16095fi
16096
10bc17b6
JH
16097: see if strerror_r exists
16098set strerror_r d_strerror_r
16099eval $inlibc
16100case "$d_strerror_r" in
16101"$define")
16102 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16103 case "$d_strerror_r_proto:$usethreads" in
16104 ":define") d_strerror_r_proto=define
a48ec845
JH
16105 set d_strerror_r_proto strerror_r $hdrs
16106 eval $hasproto ;;
16107 *) ;;
16108 esac
16109 case "$d_strerror_r_proto" in
16110 define)
10bc17b6
JH
16111 case "$strerror_r_proto" in
16112 ''|0) try='int strerror_r(int, char*, size_t);'
16113 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16114 esac
16115 case "$strerror_r_proto" in
16116 ''|0) try='int strerror_r(int, char*, int);'
16117 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16118 esac
16119 case "$strerror_r_proto" in
16120 ''|0) try='char* strerror_r(int, char*, size_t);'
16121 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16122 esac
16123 case "$strerror_r_proto" in
90e831dc 16124 ''|0) d_strerror_r=undef
10bc17b6 16125 strerror_r_proto=0
a48ec845 16126 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16127 * ) case "$strerror_r_proto" in
16128 REENTRANT_PROTO*) ;;
16129 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16130 esac
16131 echo "Prototype: $try" ;;
16132 esac
16133 ;;
c18e646a
JH
16134 *) case "$usethreads" in
16135 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16136 esac
90e831dc
SB
16137 d_strerror_r=undef
16138 strerror_r_proto=0
c18e646a 16139 ;;
a48ec845
JH
16140 esac
16141 ;;
10bc17b6
JH
16142*) strerror_r_proto=0
16143 ;;
16144esac
16145
b3c85772
JH
16146: see if strftime exists
16147set strftime d_strftime
16148eval $inlibc
16149
b4eb6b3d
JH
16150: see if strtod exists
16151set strtod d_strtod
16152eval $inlibc
16153
16154: see if strtol exists
16155set strtol d_strtol
16156eval $inlibc
16157
16158: see if strtold exists
16159set strtold d_strtold
16160eval $inlibc
16161
16162: see if strtoll exists
16163set strtoll d_strtoll
16164eval $inlibc
16165
16166case "$d_longlong-$d_strtoll" in
16167"$define-$define")
16168 $cat <<EOM
16169Checking whether your strtoll() works okay...
16170EOM
16171 $cat >try.c <<'EOCP'
16172#include <errno.h>
16173#ifdef __hpux
16174#define strtoll __strtoll
16175#endif
e75931a7
YST
16176#ifdef __EMX__
16177#define strtoll _strtoll
16178#endif
b4eb6b3d
JH
16179#include <stdio.h>
16180extern long long int strtoll(char *s, char **, int);
16181static int bad = 0;
16182int check(char *s, long long ell, int een) {
16183 long long gll;
16184 errno = 0;
16185 gll = strtoll(s, 0, 10);
16186 if (!((gll == ell) && (errno == een)))
16187 bad++;
16188}
16189int main() {
16190 check(" 1", 1LL, 0);
16191 check(" 0", 0LL, 0);
16192 check("-1", -1LL, 0);
16193 check("-9223372036854775808", -9223372036854775808LL, 0);
16194 check("-9223372036854775808", -9223372036854775808LL, 0);
16195 check(" 9223372036854775807", 9223372036854775807LL, 0);
16196 check("-9223372036854775808", -9223372036854775808LL, 0);
16197 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
16198 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16199 if (!bad)
16200 printf("ok\n");
16201}
16202EOCP
16203 set try
16204 if eval $compile; then
5440bc8e 16205 yyy=`$run ./try`
e75931a7 16206 case "$yyy" in
b4eb6b3d
JH
16207 ok) echo "Your strtoll() seems to be working okay." ;;
16208 *) cat <<EOM >&4
16209Your strtoll() doesn't seem to be working okay.
16210EOM
16211 d_strtoll="$undef"
16212 ;;
69eadf66 16213 esac
e75931a7
YST
16214 else
16215 echo "(I can't seem to compile the test program--assuming it doesn't)"
16216 d_strtoll="$undef"
b4eb6b3d
JH
16217 fi
16218 ;;
16219esac
16220
28e5dec8
JH
16221: see if strtoq exists
16222set strtoq d_strtoq
16223eval $inlibc
16224
b4eb6b3d
JH
16225: see if strtoul exists
16226set strtoul d_strtoul
16227eval $inlibc
16228
d0e6d399
NC
16229case "$d_strtoul" in
16230"$define")
16231 $cat <<EOM
16232Checking whether your strtoul() works okay...
16233EOM
16234 $cat >try.c <<'EOCP'
16235#include <errno.h>
16236#include <stdio.h>
16237extern unsigned long int strtoul(char *s, char **, int);
16238static int bad = 0;
16239void check(char *s, unsigned long eul, int een) {
16240 unsigned long gul;
16241 errno = 0;
16242 gul = strtoul(s, 0, 10);
16243 if (!((gul == eul) && (errno == een)))
16244 bad++;
16245}
16246int main() {
16247 check(" 1", 1L, 0);
16248 check(" 0", 0L, 0);
16249EOCP
16250 case "$longsize" in
16251 8)
16252 $cat >>try.c <<'EOCP'
09c0d2c4
JH
16253 check("18446744073709551615", 18446744073709551615UL, 0);
16254 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 16255#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 16256 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
16257 check("-18446744073709551614", 2, 0);
16258 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
16259 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16260 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 16261#endif
d0e6d399
NC
16262EOCP
16263 ;;
16264 4)
16265 $cat >>try.c <<'EOCP'
16266 check("4294967295", 4294967295UL, 0);
16267 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 16268#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
16269 check("-1", 4294967295UL, 0);
16270 check("-4294967294", 2, 0);
16271 check("-4294967295", 1, 0);
16272 check("-4294967296", 4294967295UL, ERANGE);
16273 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 16274#endif
d0e6d399
NC
16275EOCP
16276 ;;
16277 *)
16278: Should we write these tests to be more portable by sprintf-ing
16279: ~0 and then manipulating that char string as input for strtol?
16280 ;;
16281 esac
16282 $cat >>try.c <<'EOCP'
16283 if (!bad)
16284 printf("ok\n");
16285 return 0;
16286}
16287EOCP
16288 set try
16289 if eval $compile; then
5440bc8e 16290 case "`$run ./try`" in
d0e6d399
NC
16291 ok) echo "Your strtoul() seems to be working okay." ;;
16292 *) cat <<EOM >&4
16293Your strtoul() doesn't seem to be working okay.
16294EOM
16295 d_strtoul="$undef"
16296 ;;
16297 esac
16298 fi
16299 ;;
16300esac
16301
b4eb6b3d
JH
16302: see if strtoull exists
16303set strtoull d_strtoull
16304eval $inlibc
16305
16306case "$d_longlong-$d_strtoull" in
16307"$define-$define")
16308 $cat <<EOM
16309Checking whether your strtoull() works okay...
16310EOM
16311 $cat >try.c <<'EOCP'
16312#include <errno.h>
16313#ifdef __hpux
16314#define strtoull __strtoull
16315#endif
16316#include <stdio.h>
16317extern unsigned long long int strtoull(char *s, char **, int);
16318static int bad = 0;
16319int check(char *s, long long eull, int een) {
16320 long long gull;
16321 errno = 0;
16322 gull = strtoull(s, 0, 10);
16323 if (!((gull == eull) && (errno == een)))
16324 bad++;
16325}
16326int main() {
d0e6d399
NC
16327 check(" 1", 1LL, 0);
16328 check(" 0", 0LL, 0);
16329 check("18446744073709551615", 18446744073709551615ULL, 0);
16330 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16331#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
16332 check("-1", 18446744073709551615ULL, 0);
16333 check("-18446744073709551614", 2LL, 0);
16334 check("-18446744073709551615", 1LL, 0);
16335 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16336 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16337#endif
b4eb6b3d
JH
16338 if (!bad)
16339 printf("ok\n");
16340}
16341EOCP
16342 set try
16343 if eval $compile; then
5440bc8e 16344 case "`$run ./try`" in
b4eb6b3d
JH
16345 ok) echo "Your strtoull() seems to be working okay." ;;
16346 *) cat <<EOM >&4
16347Your strtoull() doesn't seem to be working okay.
16348EOM
16349 d_strtoull="$undef"
16350 ;;
16351 esac
16352 fi
16353 ;;
16354esac
16355
16356: see if strtouq exists
16357set strtouq d_strtouq
16358eval $inlibc
16359
d0e6d399
NC
16360case "$d_strtouq" in
16361"$define")
16362 $cat <<EOM
16363Checking whether your strtouq() works okay...
16364EOM
16365 $cat >try.c <<'EOCP'
16366#include <errno.h>
16367#include <stdio.h>
16368extern unsigned long long int strtouq(char *s, char **, int);
16369static int bad = 0;
16370void check(char *s, unsigned long long eull, int een) {
16371 unsigned long long gull;
16372 errno = 0;
16373 gull = strtouq(s, 0, 10);
16374 if (!((gull == eull) && (errno == een)))
16375 bad++;
16376}
16377int main() {
16378 check(" 1", 1LL, 0);
16379 check(" 0", 0LL, 0);
16380 check("18446744073709551615", 18446744073709551615ULL, 0);
16381 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16382#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
16383 check("-1", 18446744073709551615ULL, 0);
16384 check("-18446744073709551614", 2LL, 0);
16385 check("-18446744073709551615", 1LL, 0);
16386 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16387 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16388#endif
d0e6d399
NC
16389 if (!bad)
16390 printf("ok\n");
16391 return 0;
16392}
16393EOCP
16394 set try
16395 if eval $compile; then
5440bc8e 16396 case "`$run ./try`" in
d0e6d399
NC
16397 ok) echo "Your strtouq() seems to be working okay." ;;
16398 *) cat <<EOM >&4
16399Your strtouq() doesn't seem to be working okay.
16400EOM
16401 d_strtouq="$undef"
16402 ;;
16403 esac
16404 fi
16405 ;;
16406esac
16407
b4eb6b3d
JH
16408: see if strxfrm exists
16409set strxfrm d_strxfrm
16410eval $inlibc
16411
16412: see if symlink exists
16413set symlink d_symlink
16414eval $inlibc
16415
16416: see if syscall exists
16417set syscall d_syscall
16418eval $inlibc
16419
2ef53570
JH
16420: see if prototype for syscall is available
16421echo " "
16422set d_syscallproto syscall $i_unistd unistd.h
16423eval $hasproto
16424
b4eb6b3d
JH
16425: see if sysconf exists
16426set sysconf d_sysconf
16427eval $inlibc
16428
16429: see if system exists
16430set system d_system
16431eval $inlibc
16432
16433: see if tcgetpgrp exists
16434set tcgetpgrp d_tcgetpgrp
16435eval $inlibc
16436
16437: see if tcsetpgrp exists
16438set tcsetpgrp d_tcsetpgrp
16439eval $inlibc
16440
16441: see if prototype for telldir is available
16442echo " "
16443set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16444eval $hasproto
16445
ad493445
MB
16446: see if time exists
16447echo " "
16448if test "X$d_time" = X -o X"$timetype" = X; then
16449 if set time val -f d_time; eval $csym; $val; then
16450 echo 'time() found.' >&4
16451 val="$define"
16452 rp="What is the type returned by time() on this system?"
16453 set time_t timetype long stdio.h sys/types.h
16454 eval $typedef_ask
16455 else
16456 echo 'time() not found, hope that will do.' >&4
16457 val="$undef"
16458 timetype='int';
16459 fi
16460 set d_time
16461 eval $setvar
16462fi
16463
b4eb6b3d
JH
16464: see if this is a sys/times.h system
16465set sys/times.h i_systimes
16466eval $inhdr
16467
16468: see if times exists
16469echo " "
16470if set times val -f d_times; eval $csym; $val; then
16471 echo 'times() found.' >&4
16472 d_times="$define"
16473 inc=''
16474 case "$i_systimes" in
16475 "$define") inc='sys/times.h';;
16476 esac
16477 rp="What is the type returned by times() on this system?"
16478 set clock_t clocktype long stdio.h sys/types.h $inc
16479 eval $typedef_ask
16480else
16481 echo 'times() NOT found, hope that will do.' >&4
16482 d_times="$undef"
16483 clocktype='int'
16484fi
16485
10bc17b6
JH
16486: see if tmpnam_r exists
16487set tmpnam_r d_tmpnam_r
16488eval $inlibc
16489case "$d_tmpnam_r" in
16490"$define")
31ee0cb7 16491 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
16492 case "$d_tmpnam_r_proto:$usethreads" in
16493 ":define") d_tmpnam_r_proto=define
a48ec845
JH
16494 set d_tmpnam_r_proto tmpnam_r $hdrs
16495 eval $hasproto ;;
16496 *) ;;
16497 esac
16498 case "$d_tmpnam_r_proto" in
16499 define)
10bc17b6
JH
16500 case "$tmpnam_r_proto" in
16501 ''|0) try='char* tmpnam_r(char*);'
16502 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16503 esac
16504 case "$tmpnam_r_proto" in
90e831dc 16505 ''|0) d_tmpnam_r=undef
10bc17b6 16506 tmpnam_r_proto=0
a48ec845 16507 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16508 * ) case "$tmpnam_r_proto" in
16509 REENTRANT_PROTO*) ;;
16510 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16511 esac
16512 echo "Prototype: $try" ;;
16513 esac
16514 ;;
c18e646a
JH
16515 *) case "$usethreads" in
16516 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16517 esac
90e831dc
SB
16518 d_tmpnam_r=undef
16519 tmpnam_r_proto=0
c18e646a 16520 ;;
a48ec845
JH
16521 esac
16522 ;;
10bc17b6
JH
16523*) tmpnam_r_proto=0
16524 ;;
16525esac
16526
b4eb6b3d
JH
16527: see if truncate exists
16528set truncate d_truncate
16529eval $inlibc
16530
10bc17b6
JH
16531: see if ttyname_r exists
16532set ttyname_r d_ttyname_r
16533eval $inlibc
16534case "$d_ttyname_r" in
16535"$define")
16536 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
16537 case "$d_ttyname_r_proto:$usethreads" in
16538 ":define") d_ttyname_r_proto=define
a48ec845
JH
16539 set d_ttyname_r_proto ttyname_r $hdrs
16540 eval $hasproto ;;
16541 *) ;;
16542 esac
16543 case "$d_ttyname_r_proto" in
16544 define)
10bc17b6
JH
16545 case "$ttyname_r_proto" in
16546 ''|0) try='int ttyname_r(int, char*, size_t);'
16547 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16548 esac
16549 case "$ttyname_r_proto" in
16550 ''|0) try='int ttyname_r(int, char*, int);'
16551 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16552 esac
16553 case "$ttyname_r_proto" in
16554 ''|0) try='char* ttyname_r(int, char*, int);'
16555 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16556 esac
16557 case "$ttyname_r_proto" in
90e831dc 16558 ''|0) d_ttyname_r=undef
10bc17b6 16559 ttyname_r_proto=0
a48ec845 16560 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16561 * ) case "$ttyname_r_proto" in
16562 REENTRANT_PROTO*) ;;
16563 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16564 esac
16565 echo "Prototype: $try" ;;
16566 esac
16567 ;;
c18e646a
JH
16568 *) case "$usethreads" in
16569 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16570 esac
90e831dc
SB
16571 d_ttyname_r=undef
16572 ttyname_r_proto=0
c18e646a 16573 ;;
a48ec845
JH
16574 esac
16575 ;;
10bc17b6
JH
16576*) ttyname_r_proto=0
16577 ;;
16578esac
16579
b4eb6b3d
JH
16580: see if tzname[] exists
16581echo " "
16582if set tzname val -a d_tzname; eval $csym; $val; then
16583 val="$define"
16584 echo 'tzname[] found.' >&4
16585else
16586 val="$undef"
16587 echo 'tzname[] NOT found.' >&4
16588fi
16589set d_tzname
16590eval $setvar
16591
4e0554ec
JH
16592case "$osname" in
16593next|rhapsody|darwin) multiarch="$define" ;;
16594esac
16595case "$multiarch" in
16596''|[nN]*) multiarch="$undef" ;;
16597esac
16598
24412007 16599: check for ordering of bytes in a UV
4e0554ec 16600echo " "
5440bc8e 16601case "$usecrosscompile$multiarch" in
4e0554ec
JH
16602*$define*)
16603 $cat <<EOM
16604You seem to be either cross-compiling or doing a multiarchitecture build,
16605skipping the byteorder check.
16606
16607EOM
5440bc8e 16608 byteorder='ffff'
4e0554ec
JH
16609 ;;
16610*)
16611 case "$byteorder" in
16612 '')
16613 $cat <<'EOM'
16614In the following, larger digits indicate more significance. A big-endian
16615machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16616little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16617machines may have weird orders like 3412. A Cray will report 87654321,
16618an Alpha will report 12345678. If the test program works the default is
16619probably right.
16620I'm now running the test program...
16621EOM
24412007 16622 $cat >try.c <<EOCP
4e0554ec 16623#include <stdio.h>
24412007
JH
16624#include <sys/types.h>
16625typedef $uvtype UV;
4e0554ec
JH
16626int main()
16627{
16628 int i;
16629 union {
24412007
JH
16630 UV l;
16631 char c[$uvsize];
4e0554ec
JH
16632 } u;
16633
24412007 16634 if ($uvsize > 4)
b5ded3e5 16635 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 16636 else
a4c53327 16637 u.l = (UV)0x04030201;
24412007 16638 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
16639 printf("%c", u.c[i]+'0');
16640 printf("\n");
16641 exit(0);
16642}
16643EOCP
16644 xxx_prompt=y
16645 set try
16646 if eval $compile && ./try > /dev/null; then
5440bc8e 16647 dflt=`$run ./try`
4e0554ec
JH
16648 case "$dflt" in
16649 [1-4][1-4][1-4][1-4]|12345678|87654321)
16650 echo "(The test program ran ok.)"
16651 echo "byteorder=$dflt"
16652 xxx_prompt=n
16653 ;;
16654 ????|????????) echo "(The test program ran ok.)" ;;
16655 *) echo "(The test program didn't run right for some reason.)" ;;
16656 esac
16657 else
16658 dflt='4321'
16659 cat <<'EOM'
16660(I can't seem to compile the test program. Guessing big-endian...)
16661EOM
16662 fi
16663 case "$xxx_prompt" in
16664 y)
24412007 16665 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
16666 . ./myread
16667 byteorder="$ans"
16668 ;;
16669 *) byteorder=$dflt
16670 ;;
16671 esac
16672 ;;
16673 esac
16674 $rm -f try.c try
16675 ;;
16676esac
16677
16678
16679$cat <<EOM
16680
16681Checking to see whether you can access character data unalignedly...
16682EOM
dc7b0a4f
JH
16683case "$d_u32align" in
16684'') $cat >try.c <<EOCP
4e0554ec
JH
16685#include <stdio.h>
16686#define U32 $u32type
d308175a
JH
16687#define BYTEORDER 0x$byteorder
16688#define U8 $u8type
9958dc3c
JH
16689#include <signal.h>
16690#ifdef SIGBUS
16691$signal_t bletch(s) int s; { exit(4); }
16692#endif
4e0554ec
JH
16693int main() {
16694#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 16695 U8 buf[8];
4e0554ec
JH
16696 U32 *up;
16697 int i;
16698
16699 if (sizeof(U32) != 4) {
16700 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16701 exit(1);
16702 }
16703
16704 fflush(stdout);
16705
9958dc3c
JH
16706#ifdef SIGBUS
16707 signal(SIGBUS, bletch);
16708#endif
16709
8906a23e
JH
16710 buf[0] = 0;
16711 buf[1] = 0;
16712 buf[2] = 0;
16713 buf[3] = 1;
16714 buf[5] = 0;
16715 buf[6] = 0;
16716 buf[7] = 0;
16717 buf[8] = 1;
16718
4e0554ec
JH
16719 for (i = 0; i < 4; i++) {
16720 up = (U32*)(buf + i);
16721 if (! ((*up == 1 << (8*i)) || /* big-endian */
16722 (*up == 1 << (8*(3-i))) /* little-endian */
16723 )
16724 )
16725 {
16726 printf("read failed (%x)\n", *up);
16727 exit(2);
16728 }
16729 }
16730
16731 /* write test */
16732 for (i = 0; i < 4; i++) {
16733 up = (U32*)(buf + i);
16734 *up = 0xBeef;
16735 if (*up != 0xBeef) {
16736 printf("write failed (%x)\n", *up);
16737 exit(3);
16738 }
16739 }
16740
16741 exit(0);
16742#else
16743 printf("1\n");
16744 exit(1);
16745#endif
16746 return 0;
16747}
16748EOCP
16749set try
16750if eval $compile_ok; then
d308175a 16751 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 16752 $run ./try 2>&1 >/dev/null
4e0554ec
JH
16753 case "$?" in
16754 0) cat >&4 <<EOM
16755You can access character data pretty unalignedly.
16756EOM
16757 d_u32align="$undef"
16758 ;;
16759 *) cat >&4 <<EOM
16760It seems that you must access character data in an aligned manner.
16761EOM
16762 d_u32align="$define"
16763 ;;
16764 esac
4e0554ec
JH
16765else
16766 rp='Can you access character data at unaligned addresses?'
16767 dflt='n'
16768 . ./myread
16769 case "$ans" in
16770 [yY]*) d_u32align="$undef" ;;
16771 *) d_u32align="$define" ;;
16772 esac
16773fi
e36b5403 16774$rm -f core core.try.* try.core
dc7b0a4f
JH
16775;;
16776esac
4e0554ec
JH
16777
16778: see if ualarm exists
16779set ualarm d_ualarm
16780eval $inlibc
16781
b4eb6b3d
JH
16782: see if umask exists
16783set umask d_umask
16784eval $inlibc
16785
758a5d79
JH
16786: see if unordered exists
16787set unordered d_unordered
16788eval $inlibc
16789
4e0554ec
JH
16790: see if usleep exists
16791set usleep d_usleep
16792eval $inlibc
16793
2ef53570
JH
16794: see if prototype for usleep is available
16795echo " "
16796set d_usleepproto usleep $i_unistd unistd.h
16797eval $hasproto
16798
b4eb6b3d
JH
16799: see if ustat exists
16800set ustat d_ustat
16801eval $inlibc
16802
16803: backward compatibility for d_hvfork
16804if test X$d_hvfork != X; then
16805 d_vfork="$d_hvfork"
16806 d_hvfork=''
16807fi
16808: see if there is a vfork
16809val=''
16810set vfork val
16811eval $inlibc
16812
16813: Ok, but do we want to use it. vfork is reportedly unreliable in
16814: perl on Solaris 2.x, and probably elsewhere.
16815case "$val" in
16816$define)
16817 echo " "
16818 case "$usevfork" in
16819 false) dflt='n';;
16820 *) dflt='y';;
16821 esac
16822 cat <<'EOM'
16823
16824Perl can only use a vfork() that doesn't suffer from strict
16825restrictions on calling functions or modifying global data in
16826the child. For example, glibc-2.1 contains such a vfork()
16827that is unsuitable. If your system provides a proper fork()
16828call, chances are that you do NOT want perl to use vfork().
16829
16830EOM
16831 rp="Do you still want to use vfork()?"
16832 . ./myread
16833 case "$ans" in
16834 y|Y) ;;
16835 *)
16836 echo "Ok, we won't use vfork()."
16837 val="$undef"
16838 ;;
16839 esac
16840 ;;
16841esac
16842set d_vfork
16843eval $setvar
16844case "$d_vfork" in
16845$define) usevfork='true';;
16846*) usevfork='false';;
16847esac
16848
b4eb6b3d
JH
16849: see if closedir exists
16850set closedir d_closedir
16851eval $inlibc
16852
16853case "$d_closedir" in
16854"$define")
16855 echo " "
16856 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 16857 cat > try.c <<EOM
b4eb6b3d
JH
16858#$i_dirent I_DIRENT /**/
16859#$i_sysdir I_SYS_DIR /**/
16860#$i_sysndir I_SYS_NDIR /**/
16861#$i_systypes I_SYS_TYPES /**/
16862
16863#if defined(I_SYS_TYPES)
16864#include <sys/types.h>
16865#endif
16866#if defined(I_DIRENT)
16867#include <dirent.h>
16868#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16869#include <sys/dir.h>
16870#endif
16871#else
16872#ifdef I_SYS_NDIR
16873#include <sys/ndir.h>
16874#else
16875#ifdef I_SYS_DIR
16876#ifdef hp9000s500
16877#include <ndir.h> /* may be wrong in the future */
16878#else
16879#include <sys/dir.h>
16880#endif
16881#endif
16882#endif
16883#endif
16884int main() { return closedir(opendir(".")); }
16885EOM
5440bc8e 16886 set try
b4eb6b3d 16887 if eval $compile_ok; then
5440bc8e 16888 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
16889 echo "Yes, it does."
16890 val="$undef"
16891 else
16892 echo "No, it doesn't."
16893 val="$define"
16894 fi
16895 else
16896 echo "(I can't seem to compile the test program--assuming it doesn't)"
16897 val="$define"
16898 fi
16899 ;;
16900*)
16901 val="$undef";
16902 ;;
16903esac
16904set d_void_closedir
16905eval $setvar
5440bc8e 16906$rm -f try try.*
b4eb6b3d
JH
16907: see if there is a wait4
16908set wait4 d_wait4
16909eval $inlibc
16910
16911: see if waitpid exists
16912set waitpid d_waitpid
16913eval $inlibc
16914
16915: see if wcstombs exists
16916set wcstombs d_wcstombs
16917eval $inlibc
16918
16919: see if wctomb exists
16920set wctomb d_wctomb
16921eval $inlibc
16922
4e0554ec
JH
16923: see if writev exists
16924set writev d_writev
16925eval $inlibc
16926
b4eb6b3d
JH
16927: preserve RCS keywords in files with variable substitution, grrr
16928Date='$Date'
16929Id='$Id'
16930Log='$Log'
16931RCSfile='$RCSfile'
16932Revision='$Revision'
16933
b4eb6b3d
JH
16934: check for alignment requirements
16935echo " "
5440bc8e 16936case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
16937*$define*)
16938 $cat <<EOM
16939You seem to be either cross-compiling or doing a multiarchitecture build,
16940skipping the memory alignment check.
16941
16942EOM
16943 case "$alignbytes" in
16944 '') alignbytes=8 ;;
16945 esac
16946 ;;
16947*)
16948 case "$alignbytes" in
16949 '') echo "Checking alignment constraints..." >&4
16950 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16951 $cat >try.c <<'EOCP'
16952typedef long double NV;
16953EOCP
16954 else
16955 $cat >try.c <<'EOCP'
16956typedef double NV;
16957EOCP
16958 fi
16959 $cat >>try.c <<'EOCP'
16960#include <stdio.h>
16961struct foobar {
16962 char foo;
16963 NV bar;
16964} try_algn;
16965int main()
16966{
16967 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16968 return(0);
16969}
16970EOCP
16971 set try
16972 if eval $compile_ok; then
5440bc8e 16973 dflt=`$run ./try`
b4eb6b3d
JH
16974 else
16975 dflt='8'
16976 echo "(I can't seem to compile the test program...)"
16977 fi
16978 ;;
16979 *) dflt="$alignbytes"
16980 ;;
16981 esac
16982 rp="Doubles must be aligned on a how-many-byte boundary?"
16983 . ./myread
16984 alignbytes="$ans"
16985 $rm -f try.c try
16986 ;;
16987esac
16988
16989
16990: set the base revision
16991baserev=5.0
16992
b4eb6b3d
JH
16993: how do we catenate cpp tokens here?
16994echo " "
16995echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16996$cat >cpp_stuff.c <<'EOCP'
16997#define RCAT(a,b)a/**/b
16998#define ACAT(a,b)a ## b
16999RCAT(Rei,ser)
17000ACAT(Cir,cus)
17001EOCP
17002$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17003if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17004 echo "Oh! Smells like ANSI's been here." >&4
17005 echo "We can catify or stringify, separately or together!"
17006 cpp_stuff=42
17007elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17008 echo "Ah, yes! The good old days!" >&4
17009 echo "However, in the good old days we don't know how to stringify and"
17010 echo "catify at the same time."
17011 cpp_stuff=1
17012else
17013 $cat >&4 <<EOM
17014Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
17015to have to edit the values of CAT[2-5] in config.h...
17016EOM
17017 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17018fi
17019$rm -f cpp_stuff.*
17020
17021: see if this is a db.h system
17022set db.h i_db
17023eval $inhdr
17024
17025case "$i_db" in
17026$define)
17027 : Check db version.
17028 echo " "
17029 echo "Checking Berkeley DB version ..." >&4
17030 $cat >try.c <<EOCP
17031#$d_const HASCONST
17032#ifndef HASCONST
17033#define const
17034#endif
17035#include <sys/types.h>
17036#include <stdio.h>
17037#include <db.h>
640374d0 17038int main(int argc, char *argv[])
b4eb6b3d
JH
17039{
17040#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17041 int Major, Minor, Patch ;
17042 unsigned long Version ;
17043 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17044 if (argc == 2) {
17045 printf("%d %d %d %d %d %d\n",
17046 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17047 Major, Minor, Patch);
17048 exit(0);
17049 }
17050 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17051
17052 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17053 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17054 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17055 Major, Minor, Patch) ;
17056
17057 /* check that db.h & libdb are compatible */
17058 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17059 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17060 exit(3);
17061 }
17062
640374d0 17063 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17064
17065 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17066 + DB_VERSION_PATCH ;
17067
17068 /* needs to be >= 2.3.4 */
17069 if (Version < 2003004) {
17070 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17071 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17072 exit(2);
17073 }
17074
17075 exit(0);
17076#else
17077#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17078 if (argc == 2) {
17079 printf("1 0 0\n");
17080 exit(0);
17081 }
17082 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17083 exit(0); /* DB version < 2: the coast is clear. */
17084#else
17085 exit(1); /* <db.h> not Berkeley DB? */
17086#endif
17087#endif
17088}
17089EOCP
17090 set try
5440bc8e 17091 if eval $compile_ok && $run ./try; then
b4eb6b3d 17092 echo 'Looks OK.' >&4
5440bc8e 17093 set `$run ./try 1`
640374d0
JH
17094 db_version_major=$1
17095 db_version_minor=$2
17096 db_version_patch=$3
b4eb6b3d
JH
17097 else
17098 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
17099 i_db=$undef
17100 case " $libs " in
17101 *"-ldb "*)
17102 : Remove db from list of libraries to use
17103 echo "Removing unusable -ldb from library list" >&4
17104 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17105 shift
17106 libs="$*"
17107 echo "libs = $libs" >&4
17108 ;;
17109 esac
17110 fi
17111 $rm -f try.*
17112 ;;
17113esac
17114
17115case "$i_db" in
17116define)
17117 : Check the return type needed for hash
17118 echo " "
17119 echo "Checking return type needed for hash for Berkeley DB ..." >&4
17120 $cat >try.c <<EOCP
17121#$d_const HASCONST
17122#ifndef HASCONST
17123#define const
17124#endif
17125#include <sys/types.h>
17126#include <db.h>
17127
17128#ifndef DB_VERSION_MAJOR
17129u_int32_t hash_cb (ptr, size)
17130const void *ptr;
17131size_t size;
17132{
17133}
17134HASHINFO info;
17135int main()
17136{
17137 info.hash = hash_cb;
17138}
17139#endif
17140EOCP
17141 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17142 if $contains warning try.out >>/dev/null 2>&1 ; then
17143 db_hashtype='int'
17144 else
17145 db_hashtype='u_int32_t'
17146 fi
17147 else
17148 : XXX Maybe we should just give up here.
17149 db_hashtype=u_int32_t
17150 $cat try.out >&4
17151 echo "Help: I can't seem to compile the db test program." >&4
17152 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17153 fi
17154 $rm -f try.*
17155 echo "Your version of Berkeley DB uses $db_hashtype for hash."
17156 ;;
17157*) db_hashtype=u_int32_t
17158 ;;
17159esac
17160case "$i_db" in
17161define)
17162 : Check the return type needed for prefix
17163 echo " "
17164 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17165 cat >try.c <<EOCP
17166#$d_const HASCONST
17167#ifndef HASCONST
17168#define const
17169#endif
17170#include <sys/types.h>
17171#include <db.h>
17172
17173#ifndef DB_VERSION_MAJOR
17174size_t prefix_cb (key1, key2)
17175const DBT *key1;
17176const DBT *key2;
17177{
17178}
17179BTREEINFO info;
17180int main()
17181{
17182 info.prefix = prefix_cb;
17183}
17184#endif
17185EOCP
17186 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17187 if $contains warning try.out >>/dev/null 2>&1 ; then
17188 db_prefixtype='int'
17189 else
17190 db_prefixtype='size_t'
17191 fi
17192 else
17193 db_prefixtype='size_t'
17194 : XXX Maybe we should just give up here.
17195 $cat try.out >&4
17196 echo "Help: I can't seem to compile the db test program." >&4
17197 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17198 fi
17199 $rm -f try.*
17200 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17201 ;;
17202*) db_prefixtype='size_t'
17203 ;;
17204esac
17205
b4eb6b3d
JH
17206
17207: How can we generate normalized random numbers ?
17208echo " "
17209echo "Looking for a random number function..." >&4
17210case "$randfunc" in
17211'')
17212 if set drand48 val -f; eval $csym; $val; then
17213 dflt="drand48"
17214 echo "Good, found drand48()." >&4
17215 elif set random val -f; eval $csym; $val; then
17216 dflt="random"
17217 echo "OK, found random()." >&4
17218 else
17219 dflt="rand"
17220 echo "Yick, looks like I have to use rand()." >&4
17221 fi
17222 echo " "
17223 ;;
17224*)
17225 dflt="$randfunc"
17226 ;;
17227esac
17228cont=true
17229
17230case "$ccflags" in
17231*-Dmy_rand=*|*-Dmy_srand=*)
17232 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17233 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17234 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17235 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17236 ;;
17237esac
17238
17239while $test "$cont"; do
17240 rp="Use which function to generate random numbers?"
17241 . ./myread
17242 if $test "$ans" = "$dflt"; then
17243 : null
17244 else
17245 randbits=''
17246 fi
17247 randfunc="$ans"
17248 if set $ans val -f; eval $csym; $val; then
17249 cont=''
17250 else
17251 dflt=y
17252 rp="I cannot find function $ans. Use that name anyway?"
17253 . ./myread
17254 dflt=rand
17255 case "$ans" in
17256 [yY]*) cont='';;
17257 esac
17258 fi
17259 case "$cont" in
17260 '')
17261 case "$randfunc" in
17262 drand48)
17263 drand01="drand48()"
17264 seedfunc="srand48"
17265 randbits=48
17266 randseedtype=long
17267 ;;
17268 rand|random)
17269 case "$randbits" in
17270 '')
17271echo "Checking to see how many bits your $randfunc() function produces..." >&4
17272 $cat >try.c <<EOCP
17273#$i_unistd I_UNISTD
17274#$i_stdlib I_STDLIB
17275#include <stdio.h>
17276#ifdef I_UNISTD
17277# include <unistd.h>
17278#endif
17279#ifdef I_STDLIB
17280# include <stdlib.h>
17281#endif
17282int main()
17283{
17284 register int i;
17285 register unsigned long tmp;
17286 register unsigned long max = 0L;
17287
17288 for (i = 1000; i; i--) {
17289 tmp = (unsigned long) $randfunc();
17290 if (tmp > max) max = tmp;
17291 }
17292 for (i = 0; max; i++)
17293 max /= 2;
17294 printf("%d\n",i);
17295}
17296EOCP
17297 set try
17298 if eval $compile_ok; then
17299 dflt=`try`
17300 else
17301 dflt='?'
17302 echo "(I can't seem to compile the test program...)"
17303 fi
17304 ;;
17305 *)
17306 dflt="$randbits"
17307 ;;
17308 esac
17309 rp="How many bits does your $randfunc() function produce?"
17310 . ./myread
17311 randbits="$ans"
17312 $rm -f try.c try
17313 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17314 seedfunc="s$randfunc"
17315 randseedtype=unsigned
17316 ;;
17317 *)
17318 dflt="31"
17319 rp="How many bits does your $randfunc() function produce?"
17320 . ./myread
17321 randbits="$ans"
17322 seedfunc="s$randfunc"
17323 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17324 if set $seedfunc val -f; eval $csym; $val; then
17325 echo "(Using $seedfunc() to seed random generator)"
17326 else
17327 echo "(Warning: no $seedfunc() to seed random generator)"
17328 seedfunc=rand
17329 fi
17330 randseedtype=unsigned
17331 ;;
17332 esac
17333 ;;
17334 esac
17335done
17336
17337echo " "
17338echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 17339$cat >try.c <<'EOM'
b4eb6b3d
JH
17340int main()
17341{
17342 if ('M'==0xd4) return 0;
17343 return 1;
17344}
17345EOM
17346
17347val=$undef
5440bc8e 17348set try
b4eb6b3d 17349if eval $compile_ok; then
5440bc8e 17350 if $run ./try; then
b4eb6b3d
JH
17351 echo "You seem to speak EBCDIC." >&4
17352 val="$define"
17353 else
5440bc8e 17354 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
17355 fi
17356else
17357 echo "I'm unable to compile the test program." >&4
17358 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17359fi
5440bc8e 17360$rm -f try try.*
b4eb6b3d
JH
17361set ebcdic
17362eval $setvar
17363
17364echo " "
17365$cat >&4 <<EOM
17366Checking how to flush all pending stdio output...
17367EOM
17368# I only know how to find the first 32 possibly open files on SunOS.
17369# See also hints/sunos_4_1.sh and util.c --AD
17370case "$osname" in
17371sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17372esac
17373$cat >>try.c <<EOCP
17374#include <stdio.h>
17375#$i_unistd I_UNISTD
17376#ifdef I_UNISTD
17377# include <unistd.h>
17378#endif
17379#$d_sysconf HAS_SYSCONF
17380#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17381#ifdef HAS_STDIO_STREAM_ARRAY
17382# define STDIO_STREAM_ARRAY $stdio_stream_array
17383#endif
17384int main() {
5440bc8e
JH
17385 FILE* p;
17386 unlink("try.out");
17387 p = fopen("try.out", "w");
b4eb6b3d
JH
17388#ifdef TRY_FPUTC
17389 fputc('x', p);
17390#else
17391# ifdef TRY_FPRINTF
17392 fprintf(p, "x");
17393# endif
17394#endif
17395#ifdef TRY_FFLUSH_NULL
17396 fflush(NULL);
17397#endif
17398#ifdef TRY_FFLUSH_ALL
17399 {
17400 long open_max = -1;
17401# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17402 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17403# else
17404# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17405 open_max = sysconf(_SC_OPEN_MAX);
17406# else
17407# ifdef FOPEN_MAX
17408 open_max = FOPEN_MAX;
17409# else
17410# ifdef OPEN_MAX
17411 open_max = OPEN_MAX;
17412# else
17413# ifdef _NFILE
17414 open_max = _NFILE;
17415# endif
17416# endif
17417# endif
17418# endif
17419# endif
17420# ifdef HAS_STDIO_STREAM_ARRAY
17421 if (open_max > 0) {
17422 long i;
17423 for (i = 0; i < open_max; i++)
17424 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17425 STDIO_STREAM_ARRAY[i]._file < open_max &&
17426 STDIO_STREAM_ARRAY[i]._flag)
17427 fflush(&STDIO_STREAM_ARRAY[i]);
17428 }
17429 }
17430# endif
17431#endif
17432 _exit(42);
17433}
17434EOCP
17435: first we have to find out how _not_ to flush
5440bc8e 17436$to try.c
b4eb6b3d
JH
17437if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17438 output=''
17439 set try -DTRY_FPUTC
17440 if eval $compile; then
fbe73d74 17441 $run ./try 2>/dev/null
28f5ac64 17442 code="$?"
5440bc8e 17443 $from try.out
28f5ac64 17444 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17445 output=-DTRY_FPUTC
17446 fi
17447 fi
17448 case "$output" in
17449 '')
17450 set try -DTRY_FPRINTF
b4eb6b3d 17451 if eval $compile; then
fbe73d74 17452 $run ./try 2>/dev/null
28f5ac64 17453 code="$?"
5440bc8e 17454 $from try.out
28f5ac64 17455 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17456 output=-DTRY_FPRINTF
17457 fi
17458 fi
17459 ;;
17460 esac
17461fi
17462: check for fflush NULL behaviour
17463case "$fflushNULL" in
17464'') set try -DTRY_FFLUSH_NULL $output
17465 if eval $compile; then
5440bc8e 17466 $run ./try 2>/dev/null
b4eb6b3d 17467 code="$?"
5440bc8e 17468 $from try.out
b4eb6b3d
JH
17469 if $test -s try.out -a "X$code" = X42; then
17470 fflushNULL="`$cat try.out`"
17471 else
17472 if $test "X$code" != X42; then
17473 $cat >&4 <<EOM
17474(If this test failed, don't worry, we'll try another method shortly.)
17475EOM
17476 fi
17477 fi
17478 fi
17479 $rm -f core try.core core.try.*
17480 case "$fflushNULL" in
17481 x) $cat >&4 <<EOM
17482Your fflush(NULL) works okay for output streams.
17483Let's see if it clobbers input pipes...
17484EOM
17485# As of mid-March 2000 all versions of Solaris appear to have a stdio
17486# bug that improperly flushes the input end of pipes. So we avoid the
17487# autoflush on fork/system/exec support for now. :-(
17488$cat >tryp.c <<EOCP
17489#include <stdio.h>
17490int
17491main(int argc, char **argv)
17492{
17493 char buf[1024];
17494 int i;
17495 char *bp = buf;
17496 while (1) {
17497 while ((i = getc(stdin)) != -1
17498 && (*bp++ = i) != '\n'
17499 && bp < &buf[1024])
17500 /* DO NOTHING */ ;
17501 *bp = '\0';
17502 fprintf(stdout, "%s", buf);
17503 fflush(NULL);
17504 if (i == -1)
17505 return 0;
17506 bp = buf;
17507 }
17508}
17509EOCP
17510 fflushNULL="$define"
17511 set tryp
17512 if eval $compile; then
17513 $rm -f tryp.out
5440bc8e 17514 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17515 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17516 $cat >&4 <<EOM
17517fflush(NULL) seems to behave okay with input streams.
17518EOM
17519 fflushNULL="$define"
17520 else
17521 $cat >&4 <<EOM
17522Ouch, fflush(NULL) clobbers input pipes! We will not use it.
17523EOM
17524 fflushNULL="$undef"
17525 fi
17526 fi
17527 $rm -f core tryp.c tryp.core core.tryp.*
17528 ;;
17529 '') $cat >&4 <<EOM
17530Your fflush(NULL) isn't working (contrary to ANSI C).
17531EOM
17532 fflushNULL="$undef"
17533 ;;
17534 *) $cat >&4 <<EOM
17535Cannot figure out whether your fflush(NULL) works or not.
17536I'm assuming it doesn't (contrary to ANSI C).
17537EOM
17538 fflushNULL="$undef"
17539 ;;
17540 esac
17541 ;;
17542$define|true|[yY]*)
17543 fflushNULL="$define"
17544 ;;
17545*)
17546 fflushNULL="$undef"
17547 ;;
17548esac
17549: check explicit looping only if NULL did not work, and if the pipe
17550: bug does not show up on an explicit flush too
17551case "$fflushNULL" in
17552"$undef")
17553 $cat >tryp.c <<EOCP
17554#include <stdio.h>
17555int
17556main(int argc, char **argv)
17557{
17558 char buf[1024];
17559 int i;
17560 char *bp = buf;
17561 while (1) {
17562 while ((i = getc(stdin)) != -1
17563 && (*bp++ = i) != '\n'
17564 && bp < &buf[1024])
17565 /* DO NOTHING */ ;
17566 *bp = '\0';
17567 fprintf(stdout, "%s", buf);
17568 fflush(stdin);
17569 if (i == -1)
17570 return 0;
17571 bp = buf;
17572 }
17573}
17574EOCP
17575 set tryp
17576 if eval $compile; then
17577 $rm -f tryp.out
5440bc8e 17578 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17579 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17580 $cat >&4 <<EOM
17581Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17582EOM
17583 : now check for fflushall behaviour
17584 case "$fflushall" in
17585 '') set try -DTRY_FFLUSH_ALL $output
17586 if eval $compile; then
17587 $cat >&4 <<EOM
17588(Now testing the other method--but note that this also may fail.)
17589EOM
5440bc8e 17590 $run ./try 2>/dev/null
28f5ac64 17591 code=$?
fbe73d74 17592 $from try.out
28f5ac64 17593 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17594 fflushall="`$cat try.out`"
17595 fi
17596 fi
17597 $rm -f core try.core core.try.*
17598 case "$fflushall" in
17599 x) $cat >&4 <<EOM
17600Whew. Flushing explicitly all the stdio streams works.
17601EOM
17602 fflushall="$define"
17603 ;;
17604 '') $cat >&4 <<EOM
17605Sigh. Flushing explicitly all the stdio streams doesn't work.
17606EOM
17607 fflushall="$undef"
17608 ;;
17609 *) $cat >&4 <<EOM
17610Cannot figure out whether flushing stdio streams explicitly works or not.
17611I'm assuming it doesn't.
17612EOM
17613 fflushall="$undef"
17614 ;;
17615 esac
17616 ;;
17617 "$define"|true|[yY]*)
17618 fflushall="$define"
17619 ;;
17620 *)
17621 fflushall="$undef"
17622 ;;
17623 esac
17624 else
17625 $cat >&4 <<EOM
17626All is futile. Even fflush(stdin) clobbers input pipes!
17627EOM
17628 fflushall="$undef"
17629 fi
17630 else
17631 fflushall="$undef"
17632 fi
17633 $rm -f core tryp.c tryp.core core.tryp.*
17634 ;;
17635*) fflushall="$undef"
17636 ;;
17637esac
17638
17639case "$fflushNULL$fflushall" in
17640undefundef)
17641 $cat <<EOM
17642OK, I give up. I cannot figure out how to flush pending stdio output.
17643We won't be flushing handles at all before fork/exec/popen.
17644EOM
17645 ;;
17646esac
17647$rm -f try.* try$exe_ext
17648
17649: Store the full pathname to the ar program for use in the C program
17650: Respect a hint or command line value for full_ar.
17651case "$full_ar" in
17652'') full_ar=$ar ;;
17653esac
17654
17655: Store the full pathname to the sed program for use in the C program
17656full_sed=$sed
17657
17658: see what type gids are declared as in the kernel
17659echo " "
17660echo "Looking for the type for group ids returned by getgid()."
17661set gid_t gidtype xxx stdio.h sys/types.h
17662eval $typedef
17663case "$gidtype" in
17664xxx)
17665 xxx=`./findhdr sys/user.h`
17666 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17667 case $1 in
17668 unsigned) dflt="$1 $2" ;;
17669 *) dflt="$1" ;;
17670 esac
17671 ;;
17672*) dflt="$gidtype";;
17673esac
17674case "$gidtype" in
17675gid_t) echo "gid_t found." ;;
17676*) rp="What is the type for group ids returned by getgid()?"
17677 . ./myread
17678 gidtype="$ans"
17679 ;;
17680esac
17681
17682echo " "
17683case "$gidtype" in
17684*_t) zzz="$gidtype" ;;
17685*) zzz="gid" ;;
17686esac
17687echo "Checking the size of $zzz..." >&4
17688cat > try.c <<EOCP
17689#include <sys/types.h>
17690#include <stdio.h>
17691int main() {
17692 printf("%d\n", (int)sizeof($gidtype));
17693 exit(0);
17694}
17695EOCP
17696set try
17697if eval $compile_ok; then
5440bc8e 17698 yyy=`$run ./try`
b4eb6b3d
JH
17699 case "$yyy" in
17700 '') gidsize=4
17701 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17702 ;;
17703 *) gidsize=$yyy
17704 echo "Your $zzz is $gidsize bytes long."
17705 ;;
17706 esac
17707else
17708 gidsize=4
17709 echo "(I can't compile the test program--guessing $gidsize.)" >&4
17710fi
17711
17712
17713echo " "
17714case "$gidtype" in
17715*_t) zzz="$gidtype" ;;
17716*) zzz="gid" ;;
17717esac
17718echo "Checking the sign of $zzz..." >&4
17719cat > try.c <<EOCP
17720#include <sys/types.h>
17721#include <stdio.h>
17722int main() {
17723 $gidtype foo = -1;
17724 if (foo < 0)
17725 printf("-1\n");
17726 else
17727 printf("1\n");
17728}
17729EOCP
17730set try
17731if eval $compile; then
5440bc8e 17732 yyy=`$run ./try`
b4eb6b3d
JH
17733 case "$yyy" in
17734 '') gidsign=1
17735 echo "(I can't execute the test program--guessing unsigned.)" >&4
17736 ;;
17737 *) gidsign=$yyy
17738 case "$gidsign" in
17739 1) echo "Your $zzz is unsigned." ;;
17740 -1) echo "Your $zzz is signed." ;;
17741 esac
17742 ;;
17743 esac
17744else
17745 gidsign=1
17746 echo "(I can't compile the test program--guessing unsigned.)" >&4
17747fi
17748
17749
17750echo " "
17751
17752if $test X"$quadtype" != X; then
17753
17754echo "Checking how to print 64-bit integers..." >&4
17755
17756if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17757 $cat >try.c <<'EOCP'
17758#include <sys/types.h>
17759#include <stdio.h>
17760int main() {
17761 int q = 12345678901;
17762 printf("%ld\n", q);
17763}
17764EOCP
17765 set try
17766 if eval $compile; then
5440bc8e 17767 yyy=`$run ./try`
b4eb6b3d
JH
17768 case "$yyy" in
17769 12345678901)
17770 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17771 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17772 echo "We will use %d."
17773 ;;
17774 esac
17775 fi
17776fi
17777
17778if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17779 $cat >try.c <<'EOCP'
17780#include <sys/types.h>
17781#include <stdio.h>
17782int main() {
17783 long q = 12345678901;
17784 printf("%ld\n", q);
17785}
17786EOCP
17787 set try
17788 if eval $compile; then
5440bc8e 17789 yyy=`$run ./try`
b4eb6b3d
JH
17790 case "$yyy" in
17791 12345678901)
17792 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17793 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17794 echo "We will use %ld."
17795 ;;
17796 esac
17797 fi
17798fi
17799
17800if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17801 $cat >try.c <<'EOCP'
17802#include <sys/types.h>
17803#include <inttypes.h>
17804#include <stdio.h>
17805int main() {
17806 int64_t q = 12345678901;
17807 printf("%" PRId64 "\n", q);
17808}
17809EOCP
17810 set try
17811 if eval $compile; then
5440bc8e 17812 yyy=`$run ./try`
b4eb6b3d
JH
17813 case "$yyy" in
17814 12345678901)
17815 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17816 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17817 echo "We will use the C9X style."
17818 ;;
17819 esac
17820 fi
17821fi
17822
2ef53570
JH
17823if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17824 $cat >try.c <<EOCP
b4eb6b3d
JH
17825#include <sys/types.h>
17826#include <stdio.h>
17827int main() {
2ef53570
JH
17828 $quadtype q = 12345678901;
17829 printf("%Ld\n", q);
b4eb6b3d
JH
17830}
17831EOCP
17832 set try
17833 if eval $compile; then
5440bc8e 17834 yyy=`$run ./try`
b4eb6b3d
JH
17835 case "$yyy" in
17836 12345678901)
2ef53570
JH
17837 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17838 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17839 echo "We will use %Ld."
b4eb6b3d
JH
17840 ;;
17841 esac
17842 fi
17843fi
17844
2ef53570
JH
17845if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17846 $cat >try.c <<'EOCP'
b4eb6b3d
JH
17847#include <sys/types.h>
17848#include <stdio.h>
17849int main() {
2ef53570
JH
17850 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17851 printf("%lld\n", q);
b4eb6b3d
JH
17852}
17853EOCP
17854 set try
17855 if eval $compile; then
5440bc8e 17856 yyy=`$run ./try`
b4eb6b3d
JH
17857 case "$yyy" in
17858 12345678901)
2ef53570
JH
17859 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17860 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17861 echo "We will use the %lld style."
b4eb6b3d
JH
17862 ;;
17863 esac
17864 fi
17865fi
17866
17867if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17868 $cat >try.c <<EOCP
17869#include <sys/types.h>
17870#include <stdio.h>
17871int main() {
17872 $quadtype q = 12345678901;
17873 printf("%qd\n", q);
17874}
17875EOCP
17876 set try
17877 if eval $compile; then
5440bc8e 17878 yyy=`$run ./try`
b4eb6b3d
JH
17879 case "$yyy" in
17880 12345678901)
17881 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17882 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17883 echo "We will use %qd."
17884 ;;
17885 esac
17886 fi
17887fi
17888
17889if $test X"$sPRId64" = X; then
17890 echo "Cannot figure out how to print 64-bit integers." >&4
17891fi
17892
17893$rm -f try try.*
17894
17895fi
17896
17897case "$sPRId64" in
17898'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
17899 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
17900 ;;
17901*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
17902 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
17903 ;;
17904esac
17905
17906
17907echo " "
17908$echo "Checking the format strings to be used for Perl's internal types..." >&4
17909
17910if $test X"$ivsize" = X8; then
17911 ivdformat="$sPRId64"
17912 uvuformat="$sPRIu64"
17913 uvoformat="$sPRIo64"
17914 uvxformat="$sPRIx64"
17915 uvXUformat="$sPRIXU64"
17916else
17917 if $test X"$ivsize" = X"$longsize"; then
17918 ivdformat='"ld"'
17919 uvuformat='"lu"'
17920 uvoformat='"lo"'
17921 uvxformat='"lx"'
17922 uvXUformat='"lX"'
17923 else
17924 if $test X"$ivsize" = X"$intsize"; then
17925 ivdformat='"d"'
17926 uvuformat='"u"'
17927 uvoformat='"o"'
17928 uvxformat='"x"'
17929 uvXUformat='"X"'
17930 else
17931 : far out
17932 if $test X"$ivsize" = X"$shortsize"; then
17933 ivdformat='"hd"'
17934 uvuformat='"hu"'
17935 uvoformat='"ho"'
17936 uvxformat='"hx"'
17937 uvXUformat='"hX"'
17938 fi
17939 fi
17940 fi
17941fi
17942
17943if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17944 nveformat="$sPRIeldbl"
17945 nvfformat="$sPRIfldbl"
17946 nvgformat="$sPRIgldbl"
17947 nvEUformat="$sPRIEUldbl"
17948 nvFUformat="$sPRIFUldbl"
17949 nvGUformat="$sPRIGUldbl"
17950else
17951 nveformat='"e"'
17952 nvfformat='"f"'
17953 nvgformat='"g"'
17954 nvEUformat='"E"'
17955 nvFUformat='"F"'
17956 nvGUformat='"G"'
17957fi
17958
17959case "$ivdformat" in
3c728e00 17960'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
17961 exit 1
17962 ;;
17963esac
17964
17965
17966echo " "
17967$echo "Checking the format string to be used for gids..." >&4
17968
17969case "$gidsign" in
17970-1) if $test X"$gidsize" = X"$ivsize"; then
17971 gidformat="$ivdformat"
17972 else
17973 if $test X"$gidsize" = X"$longsize"; then
17974 gidformat='"ld"'
17975 else
17976 if $test X"$gidsize" = X"$intsize"; then
17977 gidformat='"d"'
17978 else
17979 if $test X"$gidsize" = X"$shortsize"; then
17980 gidformat='"hd"'
17981 fi
17982 fi
17983 fi
17984 fi
17985 ;;
17986*) if $test X"$gidsize" = X"$uvsize"; then
17987 gidformat="$uvuformat"
17988 else
17989 if $test X"$gidsize" = X"$longsize"; then
17990 gidformat='"lu"'
17991 else
17992 if $test X"$gidsize" = X"$intsize"; then
17993 gidformat='"u"'
17994 else
17995 if $test X"$gidsize" = X"$shortsize"; then
17996 gidformat='"hu"'
17997 fi
17998 fi
17999 fi
18000 fi
18001 ;;
18002esac
18003
18004: see if getgroups exists
18005set getgroups d_getgrps
18006eval $inlibc
18007
18008: see if setgroups exists
18009set setgroups d_setgrps
18010eval $inlibc
18011
18012
18013: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18014echo " "
18015case "$d_getgrps$d_setgrps" in
18016*define*)
18017 case "$groupstype" in
18018 '') dflt="$gidtype" ;;
18019 *) dflt="$groupstype" ;;
18020 esac
18021 $cat <<EOM
18022What type of pointer is the second argument to getgroups() and setgroups()?
18023Usually this is the same as group ids, $gidtype, but not always.
18024
18025EOM
18026 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18027 . ./myread
18028 groupstype="$ans"
18029 ;;
18030*) groupstype="$gidtype";;
18031esac
18032
18033echo " "
18034echo "Checking if your $make program sets \$(MAKE)..." >&4
18035case "$make_set_make" in
18036'')
18037 $sed 's/^X //' > testmake.mak << 'EOF'
18038Xall:
18039X @echo 'maketemp="$(MAKE)"'
18040EOF
18041 case "`$make -f testmake.mak 2>/dev/null`" in
18042 *maketemp=*) make_set_make='#' ;;
18043 *) make_set_make="MAKE=$make" ;;
18044 esac
18045 $rm -f testmake.mak
18046 ;;
18047esac
18048case "$make_set_make" in
18049'#') echo "Yup, it does.";;
18050*) echo "Nope, it doesn't.";;
18051esac
18052
18053: see what type is used for mode_t
18054rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18055set mode_t modetype int stdio.h sys/types.h
18056eval $typedef_ask
18057
2cc61e15
DD
18058: see if stdarg is available
18059echo " "
18060if $test `./findhdr stdarg.h`; then
18061 echo "<stdarg.h> found." >&4
18062 valstd="$define"
18063else
18064 echo "<stdarg.h> NOT found." >&4
18065 valstd="$undef"
18066fi
18067
18068: see if varags is available
18069echo " "
18070if $test `./findhdr varargs.h`; then
18071 echo "<varargs.h> found." >&4
18072else
18073 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18074fi
18075
18076: set up the varargs testing programs
18077$cat > varargs.c <<EOP
18078#ifdef I_STDARG
18079#include <stdarg.h>
18080#endif
18081#ifdef I_VARARGS
18082#include <varargs.h>
18083#endif
18084
18085#ifdef I_STDARG
18086int f(char *p, ...)
18087#else
18088int f(va_alist)
18089va_dcl
18090#endif
18091{
18092 va_list ap;
18093#ifndef I_STDARG
18094 char *p;
18095#endif
18096#ifdef I_STDARG
18097 va_start(ap,p);
18098#else
18099 va_start(ap);
18100 p = va_arg(ap, char *);
18101#endif
18102 va_end(ap);
18103}
18104EOP
18105$cat > varargs <<EOP
18106$startsh
18107if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18108 echo "true"
18109else
18110 echo "false"
18111fi
18112$rm -f varargs$_o
18113EOP
18114chmod +x varargs
18115
18116: now check which varargs header should be included
18117echo " "
18118i_varhdr=''
18119case "$valstd" in
18120"$define")
18121 if `./varargs I_STDARG`; then
18122 val='stdarg.h'
18123 elif `./varargs I_VARARGS`; then
18124 val='varargs.h'
18125 fi
18126 ;;
18127*)
18128 if `./varargs I_VARARGS`; then
18129 val='varargs.h'
18130 fi
18131 ;;
18132esac
18133case "$val" in
18134'')
18135echo "I could not find the definition for va_dcl... You have problems..." >&4
18136 val="$undef"; set i_stdarg; eval $setvar
18137 val="$undef"; set i_varargs; eval $setvar
18138 ;;
18139*)
18140 set i_varhdr
18141 eval $setvar
18142 case "$i_varhdr" in
18143 stdarg.h)
18144 val="$define"; set i_stdarg; eval $setvar
18145 val="$undef"; set i_varargs; eval $setvar
18146 ;;
18147 varargs.h)
18148 val="$undef"; set i_stdarg; eval $setvar
18149 val="$define"; set i_varargs; eval $setvar
18150 ;;
18151 esac
18152 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18153esac
18154$rm -f varargs*
18155
18156: see if we need va_copy
18157echo " "
18158case "$i_stdarg" in
18159"$define")
18160 $cat >try.c <<EOCP
18161#include <stdarg.h>
18162#include <stdio.h>
85c8a686
DD
18163#$i_stdlib I_STDLIB
18164#ifdef I_STDLIB
18165#include <stdlib.h>
18166#endif
18167#include <signal.h>
2cc61e15
DD
18168
18169int
18170ivfprintf(FILE *f, const char *fmt, va_list *valp)
18171{
18172 return vfprintf(f, fmt, *valp);
18173}
18174
18175int
18176myvfprintf(FILE *f, const char *fmt, va_list val)
18177{
18178 return ivfprintf(f, fmt, &val);
18179}
18180
18181int
18182myprintf(char *fmt, ...)
18183{
18184 va_list val;
18185 va_start(val, fmt);
18186 return myvfprintf(stdout, fmt, val);
18187}
18188
18189int
18190main(int ac, char **av)
18191{
85c8a686
DD
18192 signal(SIGSEGV, exit);
18193
2cc61e15
DD
18194 myprintf("%s%cs all right, then\n", "that", '\'');
18195 exit(0);
18196}
18197EOCP
18198 set try
5440bc8e
JH
18199 if eval $compile && $run ./try 2>&1 >/dev/null; then
18200 case "`$run ./try`" in
2cc61e15
DD
18201 "that's all right, then")
18202 okay=yes
18203 ;;
18204 esac
18205 fi
18206 case "$okay" in
18207 yes) echo "It seems that you don't need va_copy()." >&4
18208 need_va_copy="$undef"
18209 ;;
18210 *) echo "It seems that va_copy() or similar will be needed." >&4
18211 need_va_copy="$define"
18212 ;;
18213 esac
18214 $rm -f try.* core core.* *.core *.core.*
18215 ;;
18216*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18217 ;;
18218esac
18219
b4eb6b3d
JH
18220: see what type is used for size_t
18221rp="What is the type used for the length parameter for string functions?"
18222set size_t sizetype 'unsigned int' stdio.h sys/types.h
18223eval $typedef_ask
18224
18225: check for type of arguments to gethostbyaddr.
18226if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18227 case "$d_gethbyaddr" in
18228 $define)
18229 $cat <<EOM
18230
18231Checking to see what type of arguments are accepted by gethostbyaddr().
18232EOM
18233 hdrs="$define sys/types.h
18234 $d_socket sys/socket.h
18235 $i_niin netinet/in.h
18236 $i_netdb netdb.h
18237 $i_unistd unistd.h"
18238 : The first arg can 'char *' or 'void *'
18239 : The second arg is some of integral type
18240 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18241 for yyy in size_t long int; do
18242 case "$netdb_host_type" in
18243 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18244 if ./protochk "$try" $hdrs; then
18245 echo "Your system accepts $xxx for the first arg."
18246 echo "...and $yyy for the second arg."
18247 netdb_host_type="$xxx"
18248 netdb_hlen_type="$yyy"
18249 fi
18250 ;;
18251 esac
18252 done
18253 done
18254 : In case none of those worked, prompt the user.
18255 case "$netdb_host_type" in
18256 '') rp='What is the type for the 1st argument to gethostbyaddr?'
18257 dflt='char *'
18258 . ./myread
18259 netdb_host_type=$ans
18260 rp='What is the type for the 2nd argument to gethostbyaddr?'
18261 dflt="$sizetype"
18262 . ./myread
18263 netdb_hlen_type=$ans
18264 ;;
18265 esac
18266 ;;
18267 *) : no gethostbyaddr, so pick harmless defaults
18268 netdb_host_type='char *'
18269 netdb_hlen_type="$sizetype"
18270 ;;
18271 esac
18272 # Remove the "const" if needed. -- but then we'll have a
18273 # prototype clash!
18274 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18275fi
18276
18277: check for type of argument to gethostbyname.
18278if test "X$netdb_name_type" = X ; then
18279 case "$d_gethbyname" in
18280 $define)
18281 $cat <<EOM
18282
18283Checking to see what type of argument is accepted by gethostbyname().
18284EOM
18285 hdrs="$define sys/types.h
18286 $d_socket sys/socket.h
18287 $i_niin netinet/in.h
18288 $i_netdb netdb.h
18289 $i_unistd unistd.h"
18290 for xxx in "const char *" "char *"; do
18291 case "$netdb_name_type" in
18292 '') try="extern struct hostent *gethostbyname($xxx);"
18293 if ./protochk "$try" $hdrs; then
18294 echo "Your system accepts $xxx."
18295 netdb_name_type="$xxx"
18296 fi
18297 ;;
18298 esac
18299 done
18300 : In case none of those worked, prompt the user.
18301 case "$netdb_name_type" in
18302 '') rp='What is the type for the 1st argument to gethostbyname?'
18303 dflt='char *'
18304 . ./myread
18305 netdb_name_type=$ans
18306 ;;
18307 esac
18308 ;;
18309 *) : no gethostbyname, so pick harmless default
18310 netdb_name_type='char *'
18311 ;;
18312 esac
18313fi
18314
18315: check for type of 1st argument to getnetbyaddr.
18316if test "X$netdb_net_type" = X ; then
18317 case "$d_getnbyaddr" in
18318 $define)
18319 $cat <<EOM
18320
18321Checking to see what type of 1st argument is accepted by getnetbyaddr().
18322EOM
18323 hdrs="$define sys/types.h
18324 $d_socket sys/socket.h
18325 $i_niin netinet/in.h
18326 $i_netdb netdb.h
18327 $i_unistd unistd.h"
18328 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18329 case "$netdb_net_type" in
18330 '') try="extern struct netent *getnetbyaddr($xxx, int);"
18331 if ./protochk "$try" $hdrs; then
18332 echo "Your system accepts $xxx."
18333 netdb_net_type="$xxx"
18334 fi
18335 ;;
18336 esac
18337 done
18338 : In case none of those worked, prompt the user.
18339 case "$netdb_net_type" in
18340 '') rp='What is the type for the 1st argument to getnetbyaddr?'
18341 dflt='long'
18342 . ./myread
18343 netdb_net_type=$ans
18344 ;;
18345 esac
18346 ;;
18347 *) : no getnetbyaddr, so pick harmless default
18348 netdb_net_type='long'
18349 ;;
18350 esac
18351fi
18352: locate the preferred pager for this system
d604bb53 18353fn=f/
b4eb6b3d
JH
18354case "$pager" in
18355'')
18356 dflt=''
18357 case "$pg" in
18358 /*) dflt=$pg;;
18359 [a-zA-Z]:/*) dflt=$pg;;
18360 esac
18361 case "$more" in
18362 /*) dflt=$more;;
18363 [a-zA-Z]:/*) dflt=$more;;
18364 esac
18365 case "$less" in
18366 /*) dflt=$less;;
18367 [a-zA-Z]:/*) dflt=$less;;
18368 esac
18369 case "$dflt" in
18370 '') dflt=/usr/ucb/more;;
18371 esac
18372 ;;
d604bb53
JH
18373*) dflt="$pager"
18374 : Instruct ./getfile to trust the hinted or previous pager value,
18375 : even if it does not begin with a slash. For example, on os2,
18376 : pager might be cmd /c more. See comments in UU/getfile.
18377 fn="f/($pager)"
18378 ;;
b4eb6b3d
JH
18379esac
18380echo " "
b4eb6b3d
JH
18381rp='What pager is used on your system?'
18382. ./getfile
18383pager="$ans"
18384
18385: see what type pids are declared as in the kernel
18386rp="What is the type of process ids on this system?"
18387set pid_t pidtype int stdio.h sys/types.h
18388eval $typedef_ask
18389
18390: Find earliest binary compatible site_perl subdirectory perl can use.
d953f698 18391xs_apiversion=$version # The current site_perl version.
b4eb6b3d
JH
18392: Find earliest pure perl site_perl subdirectory perl can use.
18393: The versioned directories started at 5.005.
18394pm_apiversion='5.005'
18395
b4eb6b3d
JH
18396: see if ar generates random libraries by itself
18397echo " "
18398echo "Checking how to generate random libraries on your machine..." >&4
18399echo 'int bar1() { return bar2(); }' > bar1.c
18400echo 'int bar2() { return 2; }' > bar2.c
18401$cat > foo.c <<'EOP'
18402int main() { printf("%d\n", bar1()); exit(0); }
18403EOP
18404$cc $ccflags -c bar1.c >/dev/null 2>&1
18405$cc $ccflags -c bar2.c >/dev/null 2>&1
18406$cc $ccflags -c foo.c >/dev/null 2>&1
18407$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 18408if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18409 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18410 echo "$ar appears to generate random libraries itself."
18411 orderlib=false
18412 ranlib=":"
18413elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 18414 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18415 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18416 echo "a table of contents needs to be added with '$ar ts'."
18417 orderlib=false
18418 ranlib="$ar ts"
18419else
18420 case "$ranlib" in
18421 :) ranlib='';;
18422 '')
18423 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18424 $test -f $ranlib || ranlib=''
18425 ;;
18426 esac
18427 if $test -n "$ranlib"; then
18428 echo "your system has '$ranlib'; we'll use that."
18429 orderlib=false
18430 else
18431 echo "your system doesn't seem to support random libraries"
18432 echo "so we'll use lorder and tsort to order the libraries."
18433 orderlib=true
18434 ranlib=":"
18435 fi
18436fi
18437$rm -f foo* bar*
18438
18439: check for type of arguments to select.
18440case "$selecttype" in
18441'') case "$d_select" in
18442 $define)
18443 echo " "
18444 $cat <<EOM
18445Checking to see what type of arguments are accepted by select().
18446EOM
18447 hdrs="$define sys/types.h
18448 $i_systime sys/time.h
18449 $i_sysselct sys/select.h
18450 $d_socket sys/socket.h"
18451 : The first arg can be int, unsigned, or size_t
18452 : The last arg may or may not be 'const'
18453 val=''
18454 : void pointer has been seen but using that
18455 : breaks the selectminbits test
18456 for xxx in 'fd_set *' 'int *'; do
18457 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18458 for tmo in 'struct timeval *' 'const struct timeval *'; do
18459 case "$val" in
18460 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18461 if ./protochk "$try" $hdrs; then
18462 echo "Your system accepts $xxx."
18463 val="$xxx"
18464 fi
18465 ;;
18466 esac
18467 done
18468 done
18469 done
18470 case "$val" in
18471 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18472 case "$d_fd_set" in
18473 $define) dflt="fd_set *" ;;
18474 *) dflt="int *" ;;
18475 esac
18476 . ./myread
18477 val=$ans
18478 ;;
18479 esac
18480 selecttype="$val"
18481 ;;
18482 *) : no select, so pick a harmless default
18483 selecttype='int *'
18484 ;;
18485 esac
18486 ;;
18487esac
18488
18489: check for the select 'width'
18490case "$selectminbits" in
18491'') case "$d_select" in
18492 $define)
18493 $cat <<EOM
18494
18495Checking to see on how many bits at a time your select() operates...
18496EOM
18497 $cat >try.c <<EOCP
18498#include <sys/types.h>
18499#$i_time I_TIME
18500#$i_systime I_SYS_TIME
18501#$i_systimek I_SYS_TIME_KERNEL
18502#ifdef I_TIME
18503# include <time.h>
18504#endif
18505#ifdef I_SYS_TIME
18506# ifdef I_SYS_TIME_KERNEL
18507# define KERNEL
18508# endif
18509# include <sys/time.h>
18510# ifdef I_SYS_TIME_KERNEL
18511# undef KERNEL
18512# endif
18513#endif
18514#$i_sysselct I_SYS_SELECT
18515#ifdef I_SYS_SELECT
18516#include <sys/select.h>
18517#endif
18518#$d_socket HAS_SOCKET
18519#ifdef HAS_SOCKET
18520# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18521#endif
18522#include <stdio.h>
18523$selecttype b;
18524#define S sizeof(*(b))
18525#define MINBITS 64
18526#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18527#define NBITS (NBYTES * 8)
18528int main() {
18529 char s[NBYTES];
18530 struct timeval t;
18531 int i;
18532 FILE* fp;
18533 int fd;
18534
18535 fclose(stdin);
18536 fp = fopen("try.c", "r");
18537 if (fp == 0)
18538 exit(1);
18539 fd = fileno(fp);
18540 if (fd < 0)
18541 exit(2);
18542 b = ($selecttype)s;
18543 for (i = 0; i < NBITS; i++)
18544 FD_SET(i, b);
18545 t.tv_sec = 0;
18546 t.tv_usec = 0;
18547 select(fd + 1, b, 0, 0, &t);
18548 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18549 printf("%d\n", i + 1);
18550 return 0;
18551}
18552EOCP
18553 set try
18554 if eval $compile_ok; then
5440bc8e 18555 selectminbits=`$run ./try`
b4eb6b3d
JH
18556 case "$selectminbits" in
18557 '') cat >&4 <<EOM
18558Cannot figure out on how many bits at a time your select() operates.
18559I'll play safe and guess it is 32 bits.
18560EOM
18561 selectminbits=32
18562 bits="32 bits"
18563 ;;
18564 1) bits="1 bit" ;;
18565 *) bits="$selectminbits bits" ;;
18566 esac
18567 echo "Your select() operates on $bits at a time." >&4
18568 else
18569 rp='What is the minimum number of bits your select() operates on?'
18570 case "$byteorder" in
18571 1234|12345678) dflt=32 ;;
18572 *) dflt=1 ;;
18573 esac
18574 . ./myread
18575 val=$ans
18576 selectminbits="$val"
18577 fi
18578 $rm -f try.* try
18579 ;;
18580 *) : no select, so pick a harmless default
18581 selectminbits='32'
18582 ;;
18583 esac
18584 ;;
18585esac
18586
18587: Trace out the files included by signal.h, then look for SIGxxx names.
18588: Remove SIGARRAYSIZE used by HPUX.
18589: Remove SIGSTKSIZE used by Linux.
18590: Remove SIGSTKSZ used by Posix.
18591: Remove SIGTYP void lines used by OS2.
18592: Some cpps, like os390, dont give the file name anywhere
18593if [ "X$fieldn" = X ]; then
18594 : Just make some guesses. We check them later.
18595 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18596else
18597 xxx=`echo '#include <signal.h>' |
18598 $cppstdin $cppminus $cppflags 2>/dev/null |
18599 $grep '^[ ]*#.*include' |
a938a3bb 18600 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
18601fi
18602: Check this list of files to be sure we have parsed the cpp output ok.
18603: This will also avoid potentially non-existent files, such
18604: as ../foo/bar.h
18605xxxfiles=''
18606for xx in $xxx /dev/null ; do
18607 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18608done
18609: If we have found no files, at least try signal.h
18610case "$xxxfiles" in
18611'') xxxfiles=`./findhdr signal.h` ;;
18612esac
18613xxx=`awk '
18614$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18615 print substr($2, 4, 20)
18616}
18617$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18618 print substr($3, 4, 20)
18619}' $xxxfiles`
18620: Append some common names just in case the awk scan failed.
18621xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18622xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18623xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18624xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18625xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18626
18627: generate a few handy files for later
18628$cat > signal.c <<'EOCP'
18629#include <sys/types.h>
18630#include <signal.h>
18631#include <stdio.h>
18632int main() {
18633
18634/* Strange style to avoid deeply-nested #if/#else/#endif */
18635#ifndef NSIG
18636# ifdef _NSIG
18637# define NSIG (_NSIG)
18638# endif
18639#endif
18640
18641#ifndef NSIG
18642# ifdef SIGMAX
18643# define NSIG (SIGMAX+1)
18644# endif
18645#endif
18646
18647#ifndef NSIG
18648# ifdef SIG_MAX
18649# define NSIG (SIG_MAX+1)
18650# endif
18651#endif
18652
18653#ifndef NSIG
18654# ifdef MAXSIG
18655# define NSIG (MAXSIG+1)
18656# endif
18657#endif
18658
18659#ifndef NSIG
18660# ifdef MAX_SIG
18661# define NSIG (MAX_SIG+1)
18662# endif
18663#endif
18664
18665#ifndef NSIG
18666# ifdef SIGARRAYSIZE
18667# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18668# endif
18669#endif
18670
18671#ifndef NSIG
18672# ifdef _sys_nsig
18673# define NSIG (_sys_nsig) /* Solaris 2.5 */
18674# endif
18675#endif
18676
18677/* Default to some arbitrary number that's big enough to get most
18678 of the common signals.
18679*/
18680#ifndef NSIG
18681# define NSIG 50
18682#endif
18683
18684printf("NSIG %d\n", NSIG);
18685
18686#ifndef JUST_NSIG
18687
18688EOCP
18689
18690echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18691{
18692 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 18693 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
18694 printf $1; printf ");\n"
18695 printf "#endif\n"
18696}
18697END {
18698 printf "#endif /* JUST_NSIG */\n";
18699 printf "exit(0);\n}\n";
18700}
18701' >>signal.c
18702$cat >signal.awk <<'EOP'
18703BEGIN { ndups = 0 }
65197d93
JH
18704$1 ~ /^NSIG$/ { nsig = $2 }
18705($1 !~ /^NSIG$/) && (NF == 2) {
18706 if ($2 > maxsig) { maxsig = $2 }
18707 if (sig_name[$2]) {
18708 dup_name[ndups] = $1
18709 dup_num[ndups] = $2
b4eb6b3d
JH
18710 ndups++
18711 }
18712 else {
65197d93
JH
18713 sig_name[$2] = $1
18714 sig_num[$2] = $2
b4eb6b3d
JH
18715 }
18716}
18717END {
18718 if (nsig == 0) {
18719 nsig = maxsig + 1
18720 }
18721 printf("NSIG %d\n", nsig);
18722 for (n = 1; n < nsig; n++) {
18723 if (sig_name[n]) {
18724 printf("%s %d\n", sig_name[n], sig_num[n])
18725 }
18726 else {
18727 printf("NUM%d %d\n", n, n)
18728 }
18729 }
18730 for (n = 0; n < ndups; n++) {
18731 printf("%s %d\n", dup_name[n], dup_num[n])
18732 }
18733}
18734EOP
18735$cat >signal_cmd <<EOS
18736$startsh
18737if $test -s signal.lst; then
18738 echo "Using your existing signal.lst file"
18739 exit 0
18740fi
18741xxx="$xxx"
18742EOS
18743$cat >>signal_cmd <<'EOS'
18744
18745set signal
18746if eval $compile_ok; then
1eb9ad5b 18747 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18748else
18749 echo "(I can't seem be able to compile the whole test program)" >&4
18750 echo "(I'll try it in little pieces.)" >&4
18751 set signal -DJUST_NSIG
18752 if eval $compile_ok; then
5440bc8e 18753 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
18754 $cat signal.nsg
18755 else
18756 echo "I can't seem to figure out how many signals you have." >&4
18757 echo "Guessing 50." >&4
18758 echo 'NSIG 50' > signal.nsg
18759 fi
18760 : Now look at all the signal names, one at a time.
18761 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18762 $cat > signal.c <<EOCP
18763#include <sys/types.h>
18764#include <signal.h>
18765#include <stdio.h>
18766int main() {
18767printf("$xx %d\n", SIG${xx});
18768return 0;
18769}
18770EOCP
18771 set signal
18772 if eval $compile; then
18773 echo "SIG${xx} found."
5440bc8e 18774 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
18775 else
18776 echo "SIG${xx} NOT found."
18777 fi
18778 done
18779 if $test -s signal.ls1; then
18780 $cat signal.nsg signal.ls1 |
65197d93 18781 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18782 fi
18783
18784fi
18785if $test -s signal.lst; then
18786 :
18787else
18788 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18789 echo 'kill -l' >signal
18790 set X `csh -f <signal`
18791 $rm -f signal
18792 shift
18793 case $# in
18794 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18795 esac
18796 echo $@ | $tr ' ' $trnl | \
18797 $awk '{ printf "%s %d\n", $1, ++s; }
18798 END { printf "NSIG %d\n", ++s }' >signal.lst
18799fi
18800$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18801EOS
18802chmod a+x signal_cmd
18803$eunicefix signal_cmd
18804
18805: generate list of signal names
18806echo " "
18807case "$sig_name_init" in
18808'') doinit=yes ;;
18809*) case "$sig_num_init" in
18810 ''|*,*) doinit=yes ;;
18811 esac ;;
18812esac
18813case "$doinit" in
18814yes)
18815 echo "Generating a list of signal names and numbers..." >&4
18816 . ./signal_cmd
18817 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18818 sig_name=`$awk 'BEGIN { printf "ZERO " }
18819 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18820 sig_num=`$awk 'BEGIN { printf "0 " }
18821 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18822 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
18823 !/^NSIG/ { printf "\"%s\", ", $1 }
18824 END { printf "0\n" }' signal.lst`
18825 sig_num_init=`$awk 'BEGIN { printf "0, " }
18826 !/^NSIG/ { printf "%d, ", $2}
18827 END { printf "0\n"}' signal.lst`
18828 ;;
18829esac
18830echo "The following $sig_count signals are available:"
18831echo " "
18832echo $sig_name | $awk \
18833'BEGIN { linelen = 0 }
18834{
18835 for (i = 1; i <= NF; i++) {
18836 name = "SIG" $i " "
18837 linelen = linelen + length(name)
18838 if (linelen > 70) {
18839 printf "\n"
18840 linelen = length(name)
18841 }
18842 printf "%s", name
18843 }
18844 printf "\n"
18845}'
76d3c696 18846sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
18847$rm -f signal signal.c signal.awk signal.lst signal_cmd
18848
18849echo " "
18850case "$sizetype" in
18851*_t) zzz="$sizetype" ;;
18852*) zzz="filesize" ;;
18853esac
18854echo "Checking the size of $zzz..." >&4
18855cat > try.c <<EOCP
18856#include <sys/types.h>
18857#include <stdio.h>
18858int main() {
18859 printf("%d\n", (int)sizeof($sizetype));
18860 exit(0);
18861}
18862EOCP
18863set try
18864if eval $compile_ok; then
5440bc8e 18865 yyy=`$run ./try`
b4eb6b3d
JH
18866 case "$yyy" in
18867 '') sizesize=4
18868 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18869 ;;
18870 *) sizesize=$yyy
18871 echo "Your $zzz size is $sizesize bytes."
18872 ;;
18873 esac
18874else
18875 sizesize=4
18876 echo "(I can't compile the test program--guessing $sizesize.)" >&4
18877fi
18878
18879
18880: check for socklen_t
18881echo " "
18882echo "Checking to see if you have socklen_t..." >&4
18883$cat >try.c <<EOCP
18884#include <sys/types.h>
18885#$d_socket HAS_SOCKET
18886#ifdef HAS_SOCKET
18887#include <sys/socket.h>
18888#endif
18889int main() { socklen_t x = 16; }
18890EOCP
18891set try
18892if eval $compile; then
18893 val="$define"
18894 echo "You have socklen_t."
18895else
18896 val="$undef"
18897 echo "You do not have socklen_t."
18898 case "$sizetype" in
18899 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18900 esac
18901fi
18902$rm -f try try.*
18903set d_socklen_t
18904eval $setvar
18905
a7710f8d
JH
18906: see if this is a socks.h system
18907set socks.h i_socks
18908eval $inhdr
18909
b4eb6b3d
JH
18910: check for type of the size argument to socket calls
18911case "$d_socket" in
18912"$define")
18913 $cat <<EOM
18914
18915Checking to see what type is the last argument of accept().
18916EOM
b4eb6b3d
JH
18917 yyy=''
18918 case "$d_socklen_t" in
18919 "$define") yyy="$yyy socklen_t"
18920 esac
18921 yyy="$yyy $sizetype int long unsigned"
18922 for xxx in $yyy; do
18923 case "$socksizetype" in
18924 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
18925 case "$usesocks" in
18926 "$define")
18927 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18928 echo "Your system accepts '$xxx *' for the last argument of accept()."
18929 socksizetype="$xxx"
18930 fi
18931 ;;
18932 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
18933 echo "Your system accepts '$xxx *' for the last argument of accept()."
18934 socksizetype="$xxx"
18935 fi
18936 ;;
18937 esac
b4eb6b3d
JH
18938 ;;
18939 esac
18940 done
18941: In case none of those worked, prompt the user.
18942 case "$socksizetype" in
18943 '') rp='What is the type for socket address structure sizes?'
18944 dflt='int'
18945 . ./myread
18946 socksizetype=$ans
18947 ;;
18948 esac
18949 ;;
18950*) : no sockets, so pick relatively harmless default
18951 socksizetype='int'
18952 ;;
18953esac
18954
18955: see what type is used for signed size_t
18956set ssize_t ssizetype int stdio.h sys/types.h
18957eval $typedef
18958dflt="$ssizetype"
5440bc8e 18959$cat > try.c <<EOM
b4eb6b3d
JH
18960#include <stdio.h>
18961#include <sys/types.h>
18962#define Size_t $sizetype
18963#define SSize_t $dflt
18964int main()
18965{
18966 if (sizeof(Size_t) == sizeof(SSize_t))
18967 printf("$dflt\n");
18968 else if (sizeof(Size_t) == sizeof(int))
18969 printf("int\n");
18970 else
18971 printf("long\n");
18972 exit(0);
18973}
18974EOM
18975echo " "
5440bc8e
JH
18976set try
18977if eval $compile_ok && $run ./try > /dev/null; then
18978 ssizetype=`$run ./try`
b4eb6b3d
JH
18979 echo "I'll be using $ssizetype for functions returning a byte count." >&4
18980else
18981 $cat >&4 <<EOM
18982Help! I can't compile and run the ssize_t test program: please enlighten me!
18983(This is probably a misconfiguration in your system or libraries, and
18984you really ought to fix it. Still, I'll try anyway.)
18985
18986I need a type that is the same size as $sizetype, but is guaranteed to
18987be signed. Common values are ssize_t, int and long.
18988
18989EOM
18990 rp="What signed type is the same size as $sizetype?"
18991 . ./myread
18992 ssizetype="$ans"
18993fi
5440bc8e 18994$rm -f try try.*
b4eb6b3d
JH
18995
18996: see what type of char stdio uses.
18997echo " "
aa517f50
JH
18998echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18999if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19000 echo "Your stdio uses unsigned chars." >&4
19001 stdchar="unsigned char"
19002else
aa517f50
JH
19003 echo "Your stdio uses signed chars." >&4
19004 stdchar="char"
b4eb6b3d 19005fi
aa517f50
JH
19006$rm -f stdioh
19007
19008
b4eb6b3d 19009
b4eb6b3d
JH
19010: see what type uids are declared as in the kernel
19011echo " "
19012echo "Looking for the type for user ids returned by getuid()."
19013set uid_t uidtype xxx stdio.h sys/types.h
19014eval $typedef
19015case "$uidtype" in
19016xxx)
19017 xxx=`./findhdr sys/user.h`
19018 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19019 case $1 in
19020 unsigned) dflt="$1 $2" ;;
19021 *) dflt="$1" ;;
19022 esac
19023 ;;
19024*) dflt="$uidtype";;
19025esac
19026case "$uidtype" in
19027uid_t) echo "uid_t found." ;;
19028*) rp="What is the type for user ids returned by getuid()?"
19029 . ./myread
19030 uidtype="$ans"
19031 ;;
19032esac
19033
19034echo " "
19035case "$uidtype" in
19036*_t) zzz="$uidtype" ;;
19037*) zzz="uid" ;;
19038esac
19039echo "Checking the size of $zzz..." >&4
19040cat > try.c <<EOCP
19041#include <sys/types.h>
19042#include <stdio.h>
19043int main() {
19044 printf("%d\n", (int)sizeof($uidtype));
19045 exit(0);
19046}
19047EOCP
19048set try
19049if eval $compile_ok; then
5440bc8e 19050 yyy=`$run ./try`
b4eb6b3d
JH
19051 case "$yyy" in
19052 '') uidsize=4
19053 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19054 ;;
19055 *) uidsize=$yyy
19056 echo "Your $zzz is $uidsize bytes long."
19057 ;;
19058 esac
19059else
19060 uidsize=4
19061 echo "(I can't compile the test program--guessing $uidsize.)" >&4
19062fi
19063
19064echo " "
19065case "$uidtype" in
19066*_t) zzz="$uidtype" ;;
19067*) zzz="uid" ;;
19068esac
19069echo "Checking the sign of $zzz..." >&4
19070cat > try.c <<EOCP
19071#include <sys/types.h>
19072#include <stdio.h>
19073int main() {
19074 $uidtype foo = -1;
19075 if (foo < 0)
19076 printf("-1\n");
19077 else
19078 printf("1\n");
19079}
19080EOCP
19081set try
19082if eval $compile; then
5440bc8e 19083 yyy=`$run ./try`
b4eb6b3d
JH
19084 case "$yyy" in
19085 '') uidsign=1
19086 echo "(I can't execute the test program--guessing unsigned.)" >&4
19087 ;;
19088 *) uidsign=$yyy
19089 case "$uidsign" in
19090 1) echo "Your $zzz is unsigned." ;;
19091 -1) echo "Your $zzz is signed." ;;
19092 esac
19093 ;;
19094 esac
19095else
19096 uidsign=1
19097 echo "(I can't compile the test program--guessing unsigned.)" >&4
19098fi
19099
19100
19101
19102echo " "
19103$echo "Checking the format string to be used for uids..." >&4
19104
19105case "$uidsign" in
19106-1) if $test X"$uidsize" = X"$ivsize"; then
19107 uidformat="$ivdformat"
19108 else
19109 if $test X"$uidsize" = X"$longsize"; then
19110 uidformat='"ld"'
19111 else
19112 if $test X"$uidsize" = X"$intsize"; then
19113 uidformat='"d"'
19114 else
19115 if $test X"$uidsize" = X"$shortsize"; then
19116 uidformat='"hd"'
19117 fi
19118 fi
19119 fi
19120 fi
19121 ;;
19122*) if $test X"$uidsize" = X"$uvsize"; then
19123 uidformat="$uvuformat"
19124 else
19125 if $test X"$uidsize" = X"$longsize"; then
19126 uidformat='"lu"'
19127 else
19128 if $test X"$uidsize" = X"$intsize"; then
19129 uidformat='"u"'
19130 else
19131 if $test X"$uidsize" = X"$shortsize"; then
19132 uidformat='"hu"'
19133 fi
19134 fi
19135 fi
19136 fi
19137 ;;
19138esac
19139
3659ebf1
JH
19140: determine compiler compiler
19141case "$yacc" in
19142'')
19143 dflt=yacc;;
19144*)
19145 dflt="$yacc";;
19146esac
19147echo " "
19148comp='yacc'
3c728e00 19149if $test -f "$byacc$_exe"; then
3659ebf1
JH
19150 dflt="$byacc"
19151 comp="byacc or $comp"
19152fi
3c728e00 19153if $test -f "$bison$_exe"; then
3659ebf1
JH
19154 comp="$comp or bison -y"
19155fi
19156rp="Which compiler compiler ($comp) shall I use?"
19157. ./myread
19158yacc="$ans"
19159case "$yacc" in
19160*bis*)
19161 case "$yacc" in
19162 *-y*) ;;
19163 *)
19164 yacc="$yacc -y"
19165 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19166 ;;
19167 esac
19168 ;;
19169esac
19170
758a5d79
JH
19171: see if this is a fp.h system
19172set fp.h i_fp
19173eval $inhdr
19174
19175: see if this is a fp_class.h system
19176set fp_class.h i_fp_class
19177eval $inhdr
19178
b4eb6b3d 19179: see if this is a ieeefp.h system
b5b9f165
JH
19180case "$i_ieeefp" in
19181'' ) set ieeefp.h i_ieeefp
19182 eval $inhdr
19183 ;;
19184esac
b4eb6b3d
JH
19185
19186: see if this is a libutil.h system
19187set libutil.h i_libutil
19188eval $inhdr
19189
b4eb6b3d
JH
19190: see if mach cthreads are available
19191if test "X$usethreads" = "X$define"; then
19192 set mach/cthreads.h i_machcthr
19193 eval $inhdr
19194else
19195 i_machcthr="$undef"
19196fi
19197
19198
19199
19200: see if this is a math.h system
19201set math.h i_math
19202eval $inhdr
19203
19204: see if this is a mntent.h system
19205set mntent.h i_mntent
19206eval $inhdr
19207
19208: see if ndbm.h is available
19209set ndbm.h t_ndbm
19210eval $inhdr
1c6861ad
JS
19211
19212case "$t_ndbm" in
19213$undef)
19214 # Some Linux distributions such as RedHat 7.1 put the
19215 # ndbm.h header in /usr/include/gdbm/ndbm.h.
19216 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 19217 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
19218 ccflags="$ccflags -I/usr/include/gdbm"
19219 cppflags="$cppflags -I/usr/include/gdbm"
19220 t_ndbm=$define
19221 fi
19222 ;;
19223esac
19224
b4eb6b3d
JH
19225case "$t_ndbm" in
19226$define)
19227 : see if dbm_open exists
19228 set dbm_open d_dbm_open
19229 eval $inlibc
19230 case "$d_dbm_open" in
19231 $undef)
19232 t_ndbm="$undef"
19233 echo "We won't be including <ndbm.h>"
19234 ;;
19235 esac
19236 ;;
19237esac
19238val="$t_ndbm"
19239set i_ndbm
19240eval $setvar
19241
19242: see if net/errno.h is available
19243val=''
19244set net/errno.h val
19245eval $inhdr
19246
19247: Unfortunately, it causes problems on some systems. Arrgh.
19248case "$val" in
19249$define)
19250 cat > try.c <<'EOM'
19251#include <stdio.h>
19252#include <errno.h>
19253#include <net/errno.h>
19254int func()
19255{
19256 return ENOTSOCK;
19257}
19258EOM
19259 if $cc $ccflags -c try.c >/dev/null 2>&1; then
19260 echo "We'll be including <net/errno.h>." >&4
19261 else
19262 echo "We won't be including <net/errno.h>." >&4
19263 val="$undef"
19264 fi
19265 $rm -f try.* try
19266 ;;
19267esac
19268set i_neterrno
19269eval $setvar
19270
19271: see if netinet/tcp.h is available
19272set netinet/tcp.h i_netinettcp
19273eval $inhdr
19274
19275: see if this is a poll.h system
19276set poll.h i_poll
19277eval $inhdr
19278
19279: see if this is a prot.h system
19280set prot.h i_prot
19281eval $inhdr
19282
19283echo " "
19284$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
19285$cat <<'EOSH' > Cppsym.know
19286a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19287AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
19288alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19289ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19290BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
19291BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19292bull c cadmus clipper CMU COFF COMPILER_VERSION
19293concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19294CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
19295Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19296FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19297GLIBC GLIBC_MINOR
19298GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
19299H3050R H3050RX hbullx20 hcx host_mips
19300hp200 hp300 hp700 HP700 hp800 hp9000
19301hp9000s200 hp9000s300 hp9000s400 hp9000s500
19302hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19303i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 19304IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
19305INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19306LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19307LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19308Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19309LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19310M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19311M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19312M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19313MATH_HAS_NO_SIDE_EFFECTS
19314mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19315mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19316mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19317MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19318mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19319NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 19320news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
19321ns32016 ns32332 ns32k nsc32000
19322OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19323pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19324pc532 pdp11 PGC PIC plexus PORTAR posix
19325POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19326POSIX_C_SOURCE POSIX_SOURCE POWER
19327PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 19328riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
19329SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19330sony sony_news sonyrisc sparc sparclite spectrum
19331stardent stdc STDC_EXT stratos sun sun3 sun386
19332Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19333SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19334SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19335sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 19336TM3200 TM5400 TM5600
b4eb6b3d
JH
19337tower tower32 tower32_200 tower32_600 tower32_700
19338tower32_800 tower32_850 tss
19339u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19340ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
19341unix UNIX95 UNIX99 unixpc unos
19342USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19343USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19344USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19345USGr4 USGr4_2
b4eb6b3d
JH
19346Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19347XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19348XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19349z8000
19350EOSH
19351# Maybe put other stuff here too.
19352cat <<EOSH >>Cppsym.know
19353$osname
19354EOSH
19355./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19356./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19357$cat Cppsym.know > Cppsym.c
381aa1ff 19358$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
19359$rm -f Cppsym.a Cppsym.b Cppsym.c
19360cat <<EOSH > Cppsym
19361$startsh
19362if $test \$# -gt 0; then
19363 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19364 if $test -s Cppsym.got; then
19365 $rm -f Cppsym.got
19366 exit 0
19367 fi
19368 $rm -f Cppsym.got
19369 exit 1
19370else
19371 $tr " " "$trnl" | ./Cppsym.try
19372 exit 0
19373fi
19374EOSH
19375chmod +x Cppsym
19376$eunicefix Cppsym
19377cat <<EOSH > Cppsym.try
19378$startsh
19379cat <<'EOCP' > try.c
19380#include <stdio.h>
19381int main() {
19382EOCP
19383$awk \\
19384EOSH
19385cat <<'EOSH' >> Cppsym.try
19386'length($1) > 0 {
2ef53570
JH
19387 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19388 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19389 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19390 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
b4eb6b3d 19391}' >> try.c
2ef53570 19392echo 'return 0;}' >> try.c
b4eb6b3d
JH
19393EOSH
19394cat <<EOSH >> Cppsym.try
19395ccflags="$ccflags"
19396case "$osname-$gccversion" in
19397irix-) ccflags="\$ccflags -woff 1178" ;;
19398os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19399esac
5440bc8e 19400$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
19401EOSH
19402chmod +x Cppsym.try
19403$eunicefix Cppsym.try
19404./Cppsym < Cppsym.know > Cppsym.true
19405: now check the C compiler for additional symbols
19406postprocess_cc_v=''
19407case "$osname" in
19408aix) postprocess_cc_v="|$tr , ' '" ;;
19409esac
19410$cat >ccsym <<EOS
19411$startsh
19412$cat >tmp.c <<EOF
19413extern int foo;
19414EOF
19415for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19416do
19417 case "\$i" in
19418 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 19419 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
19420 esac
19421done
19422$rm -f try.c
19423EOS
19424postprocess_cc_v=''
19425chmod +x ccsym
19426$eunicefix ccsym
19427./ccsym > ccsym1.raw
19428if $test -s ccsym1.raw; then
19429 $sort ccsym1.raw | $uniq >ccsym.raw
19430else
19431 mv ccsym1.raw ccsym.raw
19432fi
19433
19434$awk '/\=/ { print $0; next }
19435 { print $0"=1" }' ccsym.raw >ccsym.list
19436$awk '/\=/ { print $0; next }
19437 { print $0"=1" }' Cppsym.true >ccsym.true
19438$comm -13 ccsym.true ccsym.list >ccsym.own
19439$comm -12 ccsym.true ccsym.list >ccsym.com
19440$comm -23 ccsym.true ccsym.list >ccsym.cpp
19441also=''
19442if $test -z ccsym.raw; then
19443 echo "Your C compiler doesn't seem to define any symbols!" >&4
19444 echo " "
19445 echo "However, your C preprocessor defines the following symbols:"
19446 $cat Cppsym.true
19447 ccsymbols=''
19448 cppsymbols=`$cat Cppsym.true`
19449 cppsymbols=`echo $cppsymbols`
19450 cppccsymbols="$cppsymbols"
19451else
19452 if $test -s ccsym.com; then
19453 echo "Your C compiler and pre-processor define these symbols:"
19454 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19455 also='also '
19456 symbols='ones'
19457 cppccsymbols=`$cat ccsym.com`
19458 cppccsymbols=`echo $cppccsymbols`
19459 $test "$silent" || sleep 1
19460 fi
19461 if $test -s ccsym.cpp; then
19462 $test "$also" && echo " "
19463 echo "Your C pre-processor ${also}defines the following symbols:"
19464 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19465 also='further '
19466 cppsymbols=`$cat ccsym.cpp`
19467 cppsymbols=`echo $cppsymbols`
19468 $test "$silent" || sleep 1
19469 fi
19470 if $test -s ccsym.own; then
19471 $test "$also" && echo " "
19472 echo "Your C compiler ${also}defines the following cpp symbols:"
19473 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19474 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19475 ccsymbols=`$cat ccsym.own`
19476 ccsymbols=`echo $ccsymbols`
19477 $test "$silent" || sleep 1
19478 fi
19479fi
b4eb6b3d
JH
19480
19481: see if this is a termio system
19482val="$undef"
19483val2="$undef"
19484val3="$undef"
19485if $test `./findhdr termios.h`; then
19486 set tcsetattr i_termios
19487 eval $inlibc
19488 val3="$i_termios"
19489fi
19490echo " "
19491case "$val3" in
19492"$define") echo "You have POSIX termios.h... good!" >&4;;
19493*) if ./Cppsym pyr; then
19494 case "`/bin/universe`" in
19495 ucb) if $test `./findhdr sgtty.h`; then
19496 val2="$define"
19497 echo "<sgtty.h> found." >&4
19498 else
19499 echo "System is pyramid with BSD universe."
19500 echo "<sgtty.h> not found--you could have problems." >&4
19501 fi;;
19502 *) if $test `./findhdr termio.h`; then
19503 val="$define"
19504 echo "<termio.h> found." >&4
19505 else
19506 echo "System is pyramid with USG universe."
19507 echo "<termio.h> not found--you could have problems." >&4
19508 fi;;
19509 esac
19510 elif ./usg; then
19511 if $test `./findhdr termio.h`; then
19512 echo "<termio.h> found." >&4
19513 val="$define"
19514 elif $test `./findhdr sgtty.h`; then
19515 echo "<sgtty.h> found." >&4
19516 val2="$define"
19517 else
19518echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19519 fi
19520 else
19521 if $test `./findhdr sgtty.h`; then
19522 echo "<sgtty.h> found." >&4
19523 val2="$define"
19524 elif $test `./findhdr termio.h`; then
19525 echo "<termio.h> found." >&4
19526 val="$define"
19527 else
19528echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19529 fi
19530 fi;;
19531esac
19532set i_termio; eval $setvar
19533val=$val2; set i_sgtty; eval $setvar
19534val=$val3; set i_termios; eval $setvar
19535
b4eb6b3d
JH
19536: see if stddef is available
19537set stddef.h i_stddef
19538eval $inhdr
923fc586 19539
b4eb6b3d
JH
19540: see if this is a sunmath.h system
19541set sunmath.h i_sunmath
19542eval $inhdr
5f80c64f 19543
b4eb6b3d
JH
19544: see if sys/access.h is available
19545set sys/access.h i_sysaccess
19546eval $inhdr
19547
19548: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19549set sys/filio.h i_sysfilio
19550eval $inhdr
19551echo " "
19552if $test `./findhdr sys/ioctl.h`; then
19553 val="$define"
19554 echo '<sys/ioctl.h> found.' >&4
19555else
19556 val="$undef"
19557 if $test $i_sysfilio = "$define"; then
19558 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 19559 else
b4eb6b3d
JH
19560 $test $i_sgtty = "$define" && xxx="sgtty.h"
19561 $test $i_termio = "$define" && xxx="termio.h"
19562 $test $i_termios = "$define" && xxx="termios.h"
19563echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19564 fi
19565fi
19566set i_sysioctl
19567eval $setvar
19568
49a78c82
JH
19569: see if socket ioctl defs are in sys/sockio.h
19570echo " "
19571xxx=`./findhdr sys/sockio.h`
19572if $test "$xxx"; then
19573 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19574 val="$define"
19575 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19576 else
19577 val="$undef"
19578 echo "No socket ioctls found in <sys/sockio.h>." >&4
19579 fi
19580else
19581 val="$undef"
19582 $cat <<EOM
19583<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19584EOM
19585fi
19586set i_syssockio
19587eval $setvar
19588
b4eb6b3d
JH
19589
19590: see if this is a syslog.h system
19591set syslog.h i_syslog
19592eval $inhdr
19593
19594
19595: see if this is a sys/mode.h system
19596set sys/mode.h i_sysmode
19597eval $inhdr
19598
19599: see if sys/resource.h has to be included
19600set sys/resource.h i_sysresrc
19601eval $inhdr
19602
19603: see if sys/security.h is available
19604set sys/security.h i_syssecrt
19605eval $inhdr
19606
19607: see if this is a sys/statvfs.h system
19608set sys/statvfs.h i_sysstatvfs
19609eval $inhdr
19610
b4eb6b3d
JH
19611: see if this is a sys/un.h system
19612set sys/un.h i_sysun
19613eval $inhdr
19614
19615
19616: see if this is a sys/utsname.h system
19617set sys/utsname.h i_sysutsname
19618eval $inhdr
19619
19620: see if this is a syswait system
19621set sys/wait.h i_syswait
19622eval $inhdr
19623
19624: see if this is a ustat.h system
19625set ustat.h i_ustat
19626eval $inhdr
19627
19628: see if this is an utime system
19629set utime.h i_utime
19630eval $inhdr
19631
19632: see if this is a values.h system
19633set values.h i_values
19634eval $inhdr
19635
19636: see if this is a vfork system
19637case "$d_vfork" in
19638"$define")
19639 set vfork.h i_vfork
19640 eval $inhdr
19641 ;;
19642*)
19643 i_vfork="$undef"
19644 ;;
19645esac
19646
19647: see if gdbm.h is available
19648set gdbm.h t_gdbm
19649eval $inhdr
19650case "$t_gdbm" in
19651$define)
19652 : see if gdbm_open exists
19653 set gdbm_open d_gdbm_open
19654 eval $inlibc
19655 case "$d_gdbm_open" in
19656 $undef)
19657 t_gdbm="$undef"
19658 echo "We won't be including <gdbm.h>"
5f80c64f 19659 ;;
b4eb6b3d
JH
19660 esac
19661 ;;
19662esac
19663val="$t_gdbm"
19664set i_gdbm
19665eval $setvar
19666
19667echo " "
19668echo "Looking for extensions..." >&4
19669: If we are using the old config.sh, known_extensions may contain
19670: old or inaccurate or duplicate values.
19671known_extensions=''
19672nonxs_extensions=''
19673: We do not use find because it might not be available.
19674: We do not just use MANIFEST because the user may have dropped
19675: some additional extensions into the source tree and expect them
19676: to be built.
19677
19678: Function to recursively find available extensions, ignoring DynaLoader
19679: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19680find_extensions='
19681 for xxx in *; do
19682 case "$xxx" in
19683 DynaLoader|dynaload) ;;
19684 *)
19685 if $test -f $xxx/$xxx.xs; then
19686 known_extensions="$known_extensions $1$xxx";
19687 elif $test -f $xxx/Makefile.PL; then
19688 nonxs_extensions="$nonxs_extensions $1$xxx";
19689 else
19690 if $test -d $xxx -a $# -lt 10; then
19691 set $1$xxx/ $*;
6904989c 19692 cd "$xxx";
b4eb6b3d
JH
19693 eval $find_extensions;
19694 cd ..;
19695 shift;
19696 fi;
19697 fi
19698 ;;
19699 esac;
19700 done'
19701tdir=`pwd`
6904989c 19702cd "$rsrc/ext"
b4eb6b3d
JH
19703set X
19704shift
19705eval $find_extensions
4e1a6d26
AD
19706# Special case: Add in threads/shared since it is not picked up by the
19707# recursive find above (and adding in general recursive finding breaks
19708# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 19709known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
19710set X $nonxs_extensions
19711shift
19712nonxs_extensions="$*"
19713set X $known_extensions
19714shift
19715known_extensions="$*"
6904989c 19716cd "$tdir"
b4eb6b3d
JH
19717
19718: Now see which are supported on this system.
19719avail_ext=''
19720for xxx in $known_extensions ; do
19721 case "$xxx" in
19722 DB_File|db_file)
19723 case "$i_db" in
19724 $define) avail_ext="$avail_ext $xxx" ;;
19725 esac
19726 ;;
19727 GDBM_File|gdbm_fil)
19728 case "$i_gdbm" in
19729 $define) avail_ext="$avail_ext $xxx" ;;
19730 esac
19731 ;;
1d59c593 19732 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
19733 case "$i_langinfo$d_nl_langinfo" in
19734 $define$define) avail_ext="$avail_ext $xxx" ;;
19735 esac
19736 ;;
b4eb6b3d
JH
19737 NDBM_File|ndbm_fil)
19738 case "$i_ndbm" in
19739 $define)
19740 case "$osname-$use64bitint" in
0be9fa5d 19741 hpux-define)
b4eb6b3d
JH
19742 case "$libs" in
19743 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19744 esac
19745 ;;
19746 *) avail_ext="$avail_ext $xxx" ;;
19747 esac
19748 ;;
19749 esac
19750 ;;
19751 ODBM_File|odbm_fil)
19752 case "${i_dbm}${i_rpcsvcdbm}" in
19753 *"${define}"*)
19754 case "$osname-$use64bitint" in
0be9fa5d 19755 hpux-define)
b4eb6b3d
JH
19756 case "$libs" in
19757 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19758 esac
19759 ;;
19760 *) avail_ext="$avail_ext $xxx" ;;
19761 esac
19762 ;;
19763 esac
19764 ;;
19765 POSIX|posix)
19766 case "$useposix" in
19767 true|define|y) avail_ext="$avail_ext $xxx" ;;
19768 esac
19769 ;;
19770 Opcode|opcode)
19771 case "$useopcode" in
19772 true|define|y) avail_ext="$avail_ext $xxx" ;;
19773 esac
19774 ;;
19775 Socket|socket)
19776 case "$d_socket" in
4a9f028c
JH
19777 true|$define|y)
19778 case "$osname" in
19779 beos) ;; # not unless BONE
19780 *) avail_ext="$avail_ext $xxx" ;;
19781 esac
19782 ;;
b4eb6b3d
JH
19783 esac
19784 ;;
19785 Sys/Syslog|sys/syslog)
19786 : XXX syslog requires socket
19787 case "$d_socket" in
19788 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19789 esac
19790 ;;
19791 Thread|thread)
b00ec89b
AB
19792 case "$usethreads" in
19793 true|$define|y)
19794 case "$useithreads" in
19795 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19796 esac
b4eb6b3d
JH
19797 esac
19798 ;;
f9b6ed1c
AD
19799 XS/APItest|xs/apitest)
19800 # This is just for testing. Skip it unless we have dynamic loading.
19801
19802 case "$usedl" in
19803 $define) avail_ext="$avail_ext $xxx" ;;
19804 esac
19805 ;;
19806 XS/Typemap|xs/typemap)
19807 # This is just for testing. Skip it unless we have dynamic loading.
19808 case "$usedl" in
19809 $define) avail_ext="$avail_ext $xxx" ;;
19810 esac
19811 ;;
7deadc5f 19812 threads|threads/shared)
73e09c8f
JH
19813 # threads and threads::shared are special cases.
19814 # To stop people from asking "Perl 5.8.0 was supposed
19815 # to have this new fancy threads implementation but my
19816 # perl doesn't have it" and from people trying to
19817 # (re)install the threads module using CPAN.pm and
19818 # CPAN.pm then offering to reinstall Perl 5.8.0,
19819 # the threads.pm and threads/shared.pm will always be
19820 # there, croaking informatively ("you need to rebuild
19821 # all of Perl with threads, sorry") when threads haven't
19822 # been compiled in.
19823 # --jhi
19824 avail_ext="$avail_ext $xxx"
1dca008a 19825 ;;
b4eb6b3d
JH
19826 IPC/SysV|ipc/sysv)
19827 : XXX Do we need a useipcsysv variable here
19828 case "${d_msg}${d_sem}${d_shm}" in
19829 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19830 esac
19831 ;;
19832 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
19833 ;;
19834 esac
b4eb6b3d 19835done
5f80c64f 19836
b4eb6b3d
JH
19837set X $avail_ext
19838shift
19839avail_ext="$*"
5f80c64f 19840
b4eb6b3d
JH
19841: Now see which nonxs extensions are supported on this system.
19842: For now assume all are.
19843nonxs_ext=''
19844for xxx in $nonxs_extensions ; do
19845 case "$xxx" in
19846 *) nonxs_ext="$nonxs_ext $xxx"
19847 ;;
19848 esac
19849done
5f80c64f 19850
b4eb6b3d
JH
19851set X $nonxs_ext
19852shift
19853nonxs_ext="$*"
19854
19855case $usedl in
19856$define)
19857 $cat <<EOM
19858A number of extensions are supplied with $package. You may choose to
19859compile these extensions for dynamic loading (the default), compile
19860them into the $package executable (static loading), or not include
19861them at all. Answer "none" to include no extensions.
19862Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
19863
19864EOM
b4eb6b3d 19865 case "$dynamic_ext" in
736accd3
YST
19866 '')
19867 : Exclude those listed in static_ext
19868 dflt=''
19869 for xxx in $avail_ext; do
19870 case " $static_ext " in
19871 *" $xxx "*) ;;
19872 *) dflt="$dflt $xxx" ;;
19873 esac
19874 done
19875 set X $dflt
19876 shift
19877 dflt="$*"
19878 ;;
b4eb6b3d
JH
19879 *) dflt="$dynamic_ext"
19880 # Perhaps we are reusing an old out-of-date config.sh.
19881 case "$hint" in
19882 previous)
19883 if test X"$dynamic_ext" != X"$avail_ext"; then
19884 $cat <<EOM
19885NOTICE: Your previous config.sh list may be incorrect.
19886The extensions now available to you are
19887 ${avail_ext}
19888but the default list from your previous config.sh is
19889 ${dynamic_ext}
9c839522 19890
b4eb6b3d
JH
19891EOM
19892 fi
9c839522
PM
19893 ;;
19894 esac
b4eb6b3d
JH
19895 ;;
19896 esac
5f80c64f 19897 case "$dflt" in
b4eb6b3d
JH
19898 '') dflt=none;;
19899 esac
19900 rp="What extensions do you wish to load dynamically?"
19901 . ./myread
19902 case "$ans" in
19903 none) dynamic_ext=' ' ;;
19904 *) dynamic_ext="$ans" ;;
5f80c64f 19905 esac
5f80c64f 19906
b4eb6b3d
JH
19907 case "$static_ext" in
19908 '')
19909 : Exclude those already listed in dynamic linking
19910 dflt=''
19911 for xxx in $avail_ext; do
19912 case " $dynamic_ext " in
19913 *" $xxx "*) ;;
19914 *) dflt="$dflt $xxx" ;;
19915 esac
19916 done
19917 set X $dflt
19918 shift
19919 dflt="$*"
19920 ;;
19921 *) dflt="$static_ext"
19922 ;;
19923 esac
9c839522 19924
b4eb6b3d
JH
19925 case "$dflt" in
19926 '') dflt=none;;
19927 esac
19928 rp="What extensions do you wish to load statically?"
19929 . ./myread
19930 case "$ans" in
19931 none) static_ext=' ' ;;
19932 *) static_ext="$ans" ;;
19933 esac
19934 ;;
19935*)
19936 $cat <<EOM
19937A number of extensions are supplied with $package. Answer "none"
19938to include no extensions.
19939Note that DynaLoader is always built and need not be mentioned here.
9c839522 19940
b4eb6b3d
JH
19941EOM
19942 case "$static_ext" in
19943 '') dflt="$avail_ext" ;;
19944 *) dflt="$static_ext"
19945 # Perhaps we are reusing an old out-of-date config.sh.
19946 case "$hint" in
19947 previous)
19948 if test X"$static_ext" != X"$avail_ext"; then
19949 $cat <<EOM
19950NOTICE: Your previous config.sh list may be incorrect.
19951The extensions now available to you are
19952 ${avail_ext}
19953but the default list from your previous config.sh is
19954 ${static_ext}
5f80c64f
JH
19955
19956EOM
b4eb6b3d
JH
19957 fi
19958 ;;
19959 esac
19960 ;;
19961 esac
19962 : Exclude those that are not xs extensions
19963 case "$dflt" in
19964 '') dflt=none;;
19965 esac
19966 rp="What extensions do you wish to include?"
19967 . ./myread
19968 case "$ans" in
19969 none) static_ext=' ' ;;
19970 *) static_ext="$ans" ;;
19971 esac
19972 ;;
5f80c64f 19973esac
f1f6834f
AD
19974#
19975# Encode is a special case. If we are building Encode as a static
19976# extension, we need to explicitly list its subextensions as well.
19977# For other nested extensions, this is handled automatically by
19978# the appropriate Makefile.PL.
19979case " $static_ext " in
19980 *" Encode "*) # Add the subextensions of Encode
19981 cd "$rsrc/ext"
19982 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19983 static_ext="$static_ext Encode/$xxx"
19984 done
19985 cd "$tdir"
19986 ;;
19987esac
5f80c64f 19988
b4eb6b3d
JH
19989set X $dynamic_ext $static_ext $nonxs_ext
19990shift
19991extensions="$*"
19992
9c839522
PM
19993: Remove libraries needed only for extensions
19994: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
19995: The exception is SunOS 4.x, which needs them.
19996case "${osname}X${osvers}" in
19997sunos*X4*)
19998 perllibs="$libs"
19999 ;;
20000*) case "$usedl" in
20001 $define|true|[yY]*)
20002 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
20003 shift
20004 perllibs="$*"
20005 ;;
20006 *) perllibs="$libs"
20007 ;;
20008 esac
20009 ;;
9c839522 20010esac
5f80c64f
JH
20011
20012: Remove build directory name from cppstdin so it can be used from
20013: either the present location or the final installed location.
20014echo " "
20015: Get out of the UU directory to get correct path name.
20016cd ..
20017case "$cppstdin" in
20018`pwd`/cppstdin)
20019 echo "Stripping down cppstdin path name"
20020 cppstdin=cppstdin
20021 ;;
20022esac
20023cd UU
20024
20025: end of configuration questions
20026echo " "
20027echo "End of configuration questions."
20028echo " "
20029
20030: back to where it started
20031if test -d ../UU; then
20032 cd ..
20033fi
20034
48370efc
JH
20035: configuration may be patched via a 'config.arch' file
20036if $test -f config.arch; then
20037 echo "I see a config.arch file, loading it."
20038 . ./config.arch
20039fi
20040
5f80c64f
JH
20041: configuration may be patched via a 'config.over' file
20042if $test -f config.over; then
20043 echo " "
20044 dflt=y
20045 rp='I see a config.over file. Do you wish to load it?'
20046 . UU/myread
20047 case "$ans" in
20048 n*) echo "OK, I'll ignore it.";;
20049 *) . ./config.over
20050 echo "Configuration override changes have been loaded."
20051 ;;
20052 esac
20053fi
20054
20055: in case they want portability, strip down executable paths
20056case "$d_portable" in
20057"$define")
20058 echo " "
20059 echo "Stripping down executable paths..." >&4
20060 for file in $loclist $trylist; do
534ac15a
JH
20061 eval temp=\$$file
20062 eval $file=`basename $temp`
5f80c64f
JH
20063 done
20064 ;;
20065esac
20066
20067: create config.sh file
20068echo " "
20069echo "Creating config.sh..." >&4
20070$spitshell <<EOT >config.sh
20071$startsh
20072#
20073# This file was produced by running the Configure script. It holds all the
20074# definitions figured out by Configure. Should you modify one of these values,
20075# do not forget to propagate your changes by running "Configure -der". You may
20076# instead choose to run each of the .SH files by yourself, or "Configure -S".
20077#
20078
20079# Package name : $package
20080# Source directory : $src
20081# Configuration time: $cf_time
20082# Configured by : $cf_by
20083# Target system : $myuname
20084
20085Author='$Author'
20086Date='$Date'
20087Header='$Header'
20088Id='$Id'
20089Locker='$Locker'
20090Log='$Log'
20091Mcc='$Mcc'
20092RCSfile='$RCSfile'
20093Revision='$Revision'
20094Source='$Source'
20095State='$State'
20096_a='$_a'
20097_exe='$_exe'
20098_o='$_o'
b4eb6b3d 20099afs='$afs'
a6d26a0d 20100afsroot='$afsroot'
b4eb6b3d
JH
20101alignbytes='$alignbytes'
20102ansi2knr='$ansi2knr'
20103aphostname='$aphostname'
20104api_revision='$api_revision'
20105api_subversion='$api_subversion'
20106api_version='$api_version'
20107api_versionstring='$api_versionstring'
5f80c64f 20108ar='$ar'
b4eb6b3d
JH
20109archlib='$archlib'
20110archlibexp='$archlibexp'
20111archname64='$archname64'
20112archname='$archname'
5f80c64f 20113archobjs='$archobjs'
10bc17b6 20114asctime_r_proto='$asctime_r_proto'
5f80c64f 20115awk='$awk'
b4eb6b3d 20116baserev='$baserev'
5f80c64f 20117bash='$bash'
b4eb6b3d 20118bin='$bin'
b4eb6b3d 20119binexp='$binexp'
5f80c64f
JH
20120bison='$bison'
20121byacc='$byacc'
b4eb6b3d 20122byteorder='$byteorder'
5f80c64f 20123c='$c'
b4eb6b3d 20124castflags='$castflags'
5f80c64f
JH
20125cat='$cat'
20126cc='$cc'
20127cccdlflags='$cccdlflags'
20128ccdlflags='$ccdlflags'
20129ccflags='$ccflags'
b4eb6b3d 20130ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 20131ccname='$ccname'
b4eb6b3d 20132ccsymbols='$ccsymbols'
6b356c8e 20133ccversion='$ccversion'
5f80c64f 20134cf_by='$cf_by'
b4eb6b3d 20135cf_email='$cf_email'
5f80c64f 20136cf_time='$cf_time'
b4eb6b3d 20137charsize='$charsize'
5f80c64f
JH
20138chgrp='$chgrp'
20139chmod='$chmod'
20140chown='$chown'
b4eb6b3d 20141clocktype='$clocktype'
5f80c64f
JH
20142comm='$comm'
20143compress='$compress'
20144contains='$contains'
20145cp='$cp'
20146cpio='$cpio'
20147cpp='$cpp'
b4eb6b3d
JH
20148cpp_stuff='$cpp_stuff'
20149cppccsymbols='$cppccsymbols'
5f80c64f
JH
20150cppflags='$cppflags'
20151cpplast='$cpplast'
20152cppminus='$cppminus'
20153cpprun='$cpprun'
20154cppstdin='$cppstdin'
b4eb6b3d 20155cppsymbols='$cppsymbols'
10bc17b6 20156crypt_r_proto='$crypt_r_proto'
b4eb6b3d 20157cryptlib='$cryptlib'
5f80c64f 20158csh='$csh'
10bc17b6
JH
20159ctermid_r_proto='$ctermid_r_proto'
20160ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
20161d_Gconvert='$d_Gconvert'
20162d_PRIEUldbl='$d_PRIEUldbl'
20163d_PRIFUldbl='$d_PRIFUldbl'
20164d_PRIGUldbl='$d_PRIGUldbl'
20165d_PRIXU64='$d_PRIXU64'
20166d_PRId64='$d_PRId64'
20167d_PRIeldbl='$d_PRIeldbl'
20168d_PRIfldbl='$d_PRIfldbl'
20169d_PRIgldbl='$d_PRIgldbl'
20170d_PRIi64='$d_PRIi64'
20171d_PRIo64='$d_PRIo64'
20172d_PRIu64='$d_PRIu64'
20173d_PRIx64='$d_PRIx64'
20174d_SCNfldbl='$d_SCNfldbl'
74cac757 20175d__fwalk='$d__fwalk'
b4eb6b3d
JH
20176d_access='$d_access'
20177d_accessx='$d_accessx'
20178d_alarm='$d_alarm'
20179d_archlib='$d_archlib'
10bc17b6 20180d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
20181d_atolf='$d_atolf'
20182d_atoll='$d_atoll'
20183d_attribut='$d_attribut'
20184d_bcmp='$d_bcmp'
20185d_bcopy='$d_bcopy'
5f80c64f 20186d_bsd='$d_bsd'
b4eb6b3d
JH
20187d_bsdgetpgrp='$d_bsdgetpgrp'
20188d_bsdsetpgrp='$d_bsdsetpgrp'
20189d_bzero='$d_bzero'
20190d_casti32='$d_casti32'
20191d_castneg='$d_castneg'
20192d_charvspr='$d_charvspr'
20193d_chown='$d_chown'
20194d_chroot='$d_chroot'
20195d_chsize='$d_chsize'
758a5d79 20196d_class='$d_class'
b4eb6b3d 20197d_closedir='$d_closedir'
4e0554ec 20198d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
20199d_const='$d_const'
20200d_crypt='$d_crypt'
10bc17b6 20201d_crypt_r='$d_crypt_r'
b4eb6b3d 20202d_csh='$d_csh'
10bc17b6
JH
20203d_ctermid_r='$d_ctermid_r'
20204d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
20205d_cuserid='$d_cuserid'
20206d_dbl_dig='$d_dbl_dig'
2ef53570 20207d_dbminitproto='$d_dbminitproto'
b4eb6b3d 20208d_difftime='$d_difftime'
ae0e3d3b 20209d_dirfd='$d_dirfd'
b4eb6b3d
JH
20210d_dirnamlen='$d_dirnamlen'
20211d_dlerror='$d_dlerror'
5f80c64f 20212d_dlopen='$d_dlopen'
b4eb6b3d
JH
20213d_dlsymun='$d_dlsymun'
20214d_dosuid='$d_dosuid'
10bc17b6 20215d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
20216d_drand48proto='$d_drand48proto'
20217d_dup2='$d_dup2'
20218d_eaccess='$d_eaccess'
20219d_endgrent='$d_endgrent'
10bc17b6 20220d_endgrent_r='$d_endgrent_r'
b4eb6b3d 20221d_endhent='$d_endhent'
10bc17b6 20222d_endhostent_r='$d_endhostent_r'
b4eb6b3d 20223d_endnent='$d_endnent'
10bc17b6 20224d_endnetent_r='$d_endnetent_r'
b4eb6b3d 20225d_endpent='$d_endpent'
10bc17b6 20226d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 20227d_endpwent='$d_endpwent'
10bc17b6 20228d_endpwent_r='$d_endpwent_r'
b4eb6b3d 20229d_endsent='$d_endsent'
10bc17b6 20230d_endservent_r='$d_endservent_r'
b4eb6b3d 20231d_eofnblk='$d_eofnblk'
5f80c64f 20232d_eunice='$d_eunice'
b363b713 20233d_fchdir='$d_fchdir'
b4eb6b3d
JH
20234d_fchmod='$d_fchmod'
20235d_fchown='$d_fchown'
20236d_fcntl='$d_fcntl'
9d9004a9 20237d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
20238d_fd_macros='$d_fd_macros'
20239d_fd_set='$d_fd_set'
20240d_fds_bits='$d_fds_bits'
20241d_fgetpos='$d_fgetpos'
758a5d79
JH
20242d_finite='$d_finite'
20243d_finitel='$d_finitel'
b4eb6b3d
JH
20244d_flexfnam='$d_flexfnam'
20245d_flock='$d_flock'
2ef53570 20246d_flockproto='$d_flockproto'
b4eb6b3d 20247d_fork='$d_fork'
758a5d79 20248d_fp_class='$d_fp_class'
b4eb6b3d 20249d_fpathconf='$d_fpathconf'
758a5d79
JH
20250d_fpclass='$d_fpclass'
20251d_fpclassify='$d_fpclassify'
20252d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
20253d_fpos64_t='$d_fpos64_t'
20254d_frexpl='$d_frexpl'
20255d_fs_data_s='$d_fs_data_s'
20256d_fseeko='$d_fseeko'
20257d_fsetpos='$d_fsetpos'
20258d_fstatfs='$d_fstatfs'
20259d_fstatvfs='$d_fstatvfs'
411ab01c 20260d_fsync='$d_fsync'
b4eb6b3d
JH
20261d_ftello='$d_ftello'
20262d_ftime='$d_ftime'
20263d_getcwd='$d_getcwd'
20264d_getespwnam='$d_getespwnam'
20265d_getfsstat='$d_getfsstat'
20266d_getgrent='$d_getgrent'
10bc17b6
JH
20267d_getgrent_r='$d_getgrent_r'
20268d_getgrgid_r='$d_getgrgid_r'
20269d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
20270d_getgrps='$d_getgrps'
20271d_gethbyaddr='$d_gethbyaddr'
20272d_gethbyname='$d_gethbyname'
20273d_gethent='$d_gethent'
20274d_gethname='$d_gethname'
10bc17b6
JH
20275d_gethostbyaddr_r='$d_gethostbyaddr_r'
20276d_gethostbyname_r='$d_gethostbyname_r'
20277d_gethostent_r='$d_gethostent_r'
b4eb6b3d 20278d_gethostprotos='$d_gethostprotos'
4e0554ec 20279d_getitimer='$d_getitimer'
b4eb6b3d 20280d_getlogin='$d_getlogin'
10bc17b6 20281d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
20282d_getmnt='$d_getmnt'
20283d_getmntent='$d_getmntent'
20284d_getnbyaddr='$d_getnbyaddr'
20285d_getnbyname='$d_getnbyname'
20286d_getnent='$d_getnent'
10bc17b6
JH
20287d_getnetbyaddr_r='$d_getnetbyaddr_r'
20288d_getnetbyname_r='$d_getnetbyname_r'
20289d_getnetent_r='$d_getnetent_r'
b4eb6b3d 20290d_getnetprotos='$d_getnetprotos'
0c0643d0 20291d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
20292d_getpbyname='$d_getpbyname'
20293d_getpbynumber='$d_getpbynumber'
20294d_getpent='$d_getpent'
20295d_getpgid='$d_getpgid'
20296d_getpgrp2='$d_getpgrp2'
20297d_getpgrp='$d_getpgrp'
20298d_getppid='$d_getppid'
20299d_getprior='$d_getprior'
10bc17b6
JH
20300d_getprotobyname_r='$d_getprotobyname_r'
20301d_getprotobynumber_r='$d_getprotobynumber_r'
20302d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
20303d_getprotoprotos='$d_getprotoprotos'
20304d_getprpwnam='$d_getprpwnam'
20305d_getpwent='$d_getpwent'
10bc17b6
JH
20306d_getpwent_r='$d_getpwent_r'
20307d_getpwnam_r='$d_getpwnam_r'
20308d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
20309d_getsbyname='$d_getsbyname'
20310d_getsbyport='$d_getsbyport'
20311d_getsent='$d_getsent'
10bc17b6
JH
20312d_getservbyname_r='$d_getservbyname_r'
20313d_getservbyport_r='$d_getservbyport_r'
20314d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
20315d_getservprotos='$d_getservprotos'
20316d_getspnam='$d_getspnam'
10bc17b6 20317d_getspnam_r='$d_getspnam_r'
b4eb6b3d 20318d_gettimeod='$d_gettimeod'
10bc17b6 20319d_gmtime_r='$d_gmtime_r'
5f80c64f 20320d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
20321d_grpasswd='$d_grpasswd'
20322d_hasmntopt='$d_hasmntopt'
20323d_htonl='$d_htonl'
b4eb6b3d
JH
20324d_index='$d_index'
20325d_inetaton='$d_inetaton'
20326d_int64_t='$d_int64_t'
20327d_isascii='$d_isascii'
758a5d79
JH
20328d_isfinite='$d_isfinite'
20329d_isinf='$d_isinf'
b4eb6b3d
JH
20330d_isnan='$d_isnan'
20331d_isnanl='$d_isnanl'
20332d_killpg='$d_killpg'
20333d_lchown='$d_lchown'
20334d_ldbl_dig='$d_ldbl_dig'
20335d_link='$d_link'
10bc17b6 20336d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
20337d_locconv='$d_locconv'
20338d_lockf='$d_lockf'
20339d_longdbl='$d_longdbl'
20340d_longlong='$d_longlong'
20341d_lseekproto='$d_lseekproto'
20342d_lstat='$d_lstat'
20343d_madvise='$d_madvise'
20344d_mblen='$d_mblen'
20345d_mbstowcs='$d_mbstowcs'
20346d_mbtowc='$d_mbtowc'
20347d_memchr='$d_memchr'
20348d_memcmp='$d_memcmp'
20349d_memcpy='$d_memcpy'
20350d_memmove='$d_memmove'
20351d_memset='$d_memset'
20352d_mkdir='$d_mkdir'
20353d_mkdtemp='$d_mkdtemp'
20354d_mkfifo='$d_mkfifo'
20355d_mkstemp='$d_mkstemp'
20356d_mkstemps='$d_mkstemps'
20357d_mktime='$d_mktime'
20358d_mmap='$d_mmap'
20359d_modfl='$d_modfl'
e67aeab1 20360d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 20361d_modflproto='$d_modflproto'
b4eb6b3d
JH
20362d_mprotect='$d_mprotect'
20363d_msg='$d_msg'
20364d_msg_ctrunc='$d_msg_ctrunc'
20365d_msg_dontroute='$d_msg_dontroute'
20366d_msg_oob='$d_msg_oob'
20367d_msg_peek='$d_msg_peek'
20368d_msg_proxy='$d_msg_proxy'
20369d_msgctl='$d_msgctl'
20370d_msgget='$d_msgget'
4e0554ec 20371d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
20372d_msgrcv='$d_msgrcv'
20373d_msgsnd='$d_msgsnd'
20374d_msync='$d_msync'
20375d_munmap='$d_munmap'
20376d_mymalloc='$d_mymalloc'
2d736872 20377d_nanosleep='$d_nanosleep'
b4eb6b3d 20378d_nice='$d_nice'
2765b840 20379d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 20380d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
20381d_off64_t='$d_off64_t'
20382d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20383d_oldpthreads='$d_oldpthreads'
20384d_oldsock='$d_oldsock'
20385d_open3='$d_open3'
20386d_pathconf='$d_pathconf'
20387d_pause='$d_pause'
20388d_perl_otherlibdirs='$d_perl_otherlibdirs'
20389d_phostname='$d_phostname'
20390d_pipe='$d_pipe'
20391d_poll='$d_poll'
5f80c64f 20392d_portable='$d_portable'
c7aff470 20393d_procselfexe='$d_procselfexe'
d6483fcc 20394d_pthread_atfork='$d_pthread_atfork'
b4eb6b3d
JH
20395d_pthread_yield='$d_pthread_yield'
20396d_pwage='$d_pwage'
20397d_pwchange='$d_pwchange'
20398d_pwclass='$d_pwclass'
20399d_pwcomment='$d_pwcomment'
20400d_pwexpire='$d_pwexpire'
20401d_pwgecos='$d_pwgecos'
20402d_pwpasswd='$d_pwpasswd'
20403d_pwquota='$d_pwquota'
20404d_qgcvt='$d_qgcvt'
20405d_quad='$d_quad'
10bc17b6
JH
20406d_random_r='$d_random_r'
20407d_readdir64_r='$d_readdir64_r'
b4eb6b3d 20408d_readdir='$d_readdir'
10bc17b6 20409d_readdir_r='$d_readdir_r'
b4eb6b3d 20410d_readlink='$d_readlink'
4e0554ec
JH
20411d_readv='$d_readv'
20412d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
20413d_rename='$d_rename'
20414d_rewinddir='$d_rewinddir'
20415d_rmdir='$d_rmdir'
20416d_safebcpy='$d_safebcpy'
20417d_safemcpy='$d_safemcpy'
20418d_sanemcmp='$d_sanemcmp'
ef9f17be 20419d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
20420d_sched_yield='$d_sched_yield'
20421d_scm_rights='$d_scm_rights'
20422d_seekdir='$d_seekdir'
20423d_select='$d_select'
20424d_sem='$d_sem'
20425d_semctl='$d_semctl'
20426d_semctl_semid_ds='$d_semctl_semid_ds'
20427d_semctl_semun='$d_semctl_semun'
20428d_semget='$d_semget'
20429d_semop='$d_semop'
4e0554ec 20430d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
20431d_setegid='$d_setegid'
20432d_seteuid='$d_seteuid'
20433d_setgrent='$d_setgrent'
10bc17b6 20434d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
20435d_setgrps='$d_setgrps'
20436d_sethent='$d_sethent'
10bc17b6 20437d_sethostent_r='$d_sethostent_r'
4e0554ec 20438d_setitimer='$d_setitimer'
b4eb6b3d
JH
20439d_setlinebuf='$d_setlinebuf'
20440d_setlocale='$d_setlocale'
10bc17b6 20441d_setlocale_r='$d_setlocale_r'
b4eb6b3d 20442d_setnent='$d_setnent'
10bc17b6 20443d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
20444d_setpent='$d_setpent'
20445d_setpgid='$d_setpgid'
20446d_setpgrp2='$d_setpgrp2'
20447d_setpgrp='$d_setpgrp'
20448d_setprior='$d_setprior'
20449d_setproctitle='$d_setproctitle'
10bc17b6 20450d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 20451d_setpwent='$d_setpwent'
10bc17b6 20452d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
20453d_setregid='$d_setregid'
20454d_setresgid='$d_setresgid'
20455d_setresuid='$d_setresuid'
20456d_setreuid='$d_setreuid'
20457d_setrgid='$d_setrgid'
20458d_setruid='$d_setruid'
20459d_setsent='$d_setsent'
10bc17b6 20460d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
20461d_setsid='$d_setsid'
20462d_setvbuf='$d_setvbuf'
20463d_sfio='$d_sfio'
20464d_shm='$d_shm'
20465d_shmat='$d_shmat'
20466d_shmatprototype='$d_shmatprototype'
20467d_shmctl='$d_shmctl'
20468d_shmdt='$d_shmdt'
20469d_shmget='$d_shmget'
20470d_sigaction='$d_sigaction'
983dbef6 20471d_sigprocmask='$d_sigprocmask'
b4eb6b3d 20472d_sigsetjmp='$d_sigsetjmp'
49a78c82 20473d_sockatmark='$d_sockatmark'
2ef53570 20474d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
20475d_socket='$d_socket'
20476d_socklen_t='$d_socklen_t'
20477d_sockpair='$d_sockpair'
20478d_socks5_init='$d_socks5_init'
20479d_sqrtl='$d_sqrtl'
10bc17b6
JH
20480d_srand48_r='$d_srand48_r'
20481d_srandom_r='$d_srandom_r'
eef837ea 20482d_sresgproto='$d_sresgproto'
640374d0 20483d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
20484d_statblks='$d_statblks'
20485d_statfs_f_flags='$d_statfs_f_flags'
20486d_statfs_s='$d_statfs_s'
20487d_statvfs='$d_statvfs'
20488d_stdio_cnt_lval='$d_stdio_cnt_lval'
20489d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
20490d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20491d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
20492d_stdio_stream_array='$d_stdio_stream_array'
20493d_stdiobase='$d_stdiobase'
20494d_stdstdio='$d_stdstdio'
20495d_strchr='$d_strchr'
20496d_strcoll='$d_strcoll'
20497d_strctcpy='$d_strctcpy'
20498d_strerrm='$d_strerrm'
20499d_strerror='$d_strerror'
10bc17b6 20500d_strerror_r='$d_strerror_r'
b3c85772 20501d_strftime='$d_strftime'
b4eb6b3d
JH
20502d_strtod='$d_strtod'
20503d_strtol='$d_strtol'
20504d_strtold='$d_strtold'
20505d_strtoll='$d_strtoll'
28e5dec8 20506d_strtoq='$d_strtoq'
b4eb6b3d
JH
20507d_strtoul='$d_strtoul'
20508d_strtoull='$d_strtoull'
20509d_strtouq='$d_strtouq'
20510d_strxfrm='$d_strxfrm'
20511d_suidsafe='$d_suidsafe'
20512d_symlink='$d_symlink'
20513d_syscall='$d_syscall'
2ef53570 20514d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
20515d_sysconf='$d_sysconf'
20516d_sysernlst='$d_sysernlst'
20517d_syserrlst='$d_syserrlst'
20518d_system='$d_system'
20519d_tcgetpgrp='$d_tcgetpgrp'
20520d_tcsetpgrp='$d_tcsetpgrp'
20521d_telldir='$d_telldir'
20522d_telldirproto='$d_telldirproto'
20523d_time='$d_time'
20524d_times='$d_times'
14b90194
JH
20525d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20526d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 20527d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 20528d_truncate='$d_truncate'
10bc17b6 20529d_ttyname_r='$d_ttyname_r'
b4eb6b3d 20530d_tzname='$d_tzname'
4e0554ec
JH
20531d_u32align='$d_u32align'
20532d_ualarm='$d_ualarm'
b4eb6b3d
JH
20533d_umask='$d_umask'
20534d_uname='$d_uname'
20535d_union_semun='$d_union_semun'
758a5d79 20536d_unordered='$d_unordered'
4e0554ec 20537d_usleep='$d_usleep'
2ef53570 20538d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
20539d_ustat='$d_ustat'
20540d_vendorarch='$d_vendorarch'
20541d_vendorbin='$d_vendorbin'
20542d_vendorlib='$d_vendorlib'
6e1038e0 20543d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
20544d_vfork='$d_vfork'
20545d_void_closedir='$d_void_closedir'
20546d_voidsig='$d_voidsig'
20547d_voidtty='$d_voidtty'
20548d_volatile='$d_volatile'
20549d_vprintf='$d_vprintf'
20550d_wait4='$d_wait4'
20551d_waitpid='$d_waitpid'
20552d_wcstombs='$d_wcstombs'
20553d_wctomb='$d_wctomb'
4e0554ec 20554d_writev='$d_writev'
5f80c64f
JH
20555d_xenix='$d_xenix'
20556date='$date'
b4eb6b3d
JH
20557db_hashtype='$db_hashtype'
20558db_prefixtype='$db_prefixtype'
640374d0
JH
20559db_version_major='$db_version_major'
20560db_version_minor='$db_version_minor'
20561db_version_patch='$db_version_patch'
b4eb6b3d
JH
20562defvoidused='$defvoidused'
20563direntrytype='$direntrytype'
20564dlext='$dlext'
5f80c64f 20565dlsrc='$dlsrc'
b4eb6b3d
JH
20566doublesize='$doublesize'
20567drand01='$drand01'
10bc17b6 20568drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
20569dynamic_ext='$dynamic_ext'
20570eagain='$eagain'
20571ebcdic='$ebcdic'
5f80c64f
JH
20572echo='$echo'
20573egrep='$egrep'
20574emacs='$emacs'
10bc17b6
JH
20575endgrent_r_proto='$endgrent_r_proto'
20576endhostent_r_proto='$endhostent_r_proto'
20577endnetent_r_proto='$endnetent_r_proto'
20578endprotoent_r_proto='$endprotoent_r_proto'
20579endpwent_r_proto='$endpwent_r_proto'
20580endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
20581eunicefix='$eunicefix'
20582exe_ext='$exe_ext'
20583expr='$expr'
b4eb6b3d 20584extensions='$extensions'
6fcddf3b 20585extras='$extras'
b4eb6b3d
JH
20586fflushNULL='$fflushNULL'
20587fflushall='$fflushall'
5f80c64f
JH
20588find='$find'
20589firstmakefile='$firstmakefile'
20590flex='$flex'
b4eb6b3d
JH
20591fpossize='$fpossize'
20592fpostype='$fpostype'
20593freetype='$freetype'
5440bc8e 20594from='$from'
b4eb6b3d
JH
20595full_ar='$full_ar'
20596full_csh='$full_csh'
20597full_sed='$full_sed'
2d736872 20598gccansipedantic='$gccansipedantic'
5b463ca7 20599gccosandvers='$gccosandvers'
5f80c64f 20600gccversion='$gccversion'
10bc17b6
JH
20601getgrent_r_proto='$getgrent_r_proto'
20602getgrgid_r_proto='$getgrgid_r_proto'
20603getgrnam_r_proto='$getgrnam_r_proto'
20604gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20605gethostbyname_r_proto='$gethostbyname_r_proto'
20606gethostent_r_proto='$gethostent_r_proto'
20607getlogin_r_proto='$getlogin_r_proto'
20608getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20609getnetbyname_r_proto='$getnetbyname_r_proto'
20610getnetent_r_proto='$getnetent_r_proto'
20611getprotobyname_r_proto='$getprotobyname_r_proto'
20612getprotobynumber_r_proto='$getprotobynumber_r_proto'
20613getprotoent_r_proto='$getprotoent_r_proto'
20614getpwent_r_proto='$getpwent_r_proto'
20615getpwnam_r_proto='$getpwnam_r_proto'
20616getpwuid_r_proto='$getpwuid_r_proto'
20617getservbyname_r_proto='$getservbyname_r_proto'
20618getservbyport_r_proto='$getservbyport_r_proto'
20619getservent_r_proto='$getservent_r_proto'
20620getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
20621gidformat='$gidformat'
20622gidsign='$gidsign'
20623gidsize='$gidsize'
20624gidtype='$gidtype'
5f80c64f 20625glibpth='$glibpth'
3c728e00 20626gmake='$gmake'
10bc17b6 20627gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 20628gnulibc_version='$gnulibc_version'
5f80c64f 20629grep='$grep'
b4eb6b3d
JH
20630groupcat='$groupcat'
20631groupstype='$groupstype'
5f80c64f 20632gzip='$gzip'
b4eb6b3d
JH
20633h_fcntl='$h_fcntl'
20634h_sysfile='$h_sysfile'
5f80c64f 20635hint='$hint'
b4eb6b3d 20636hostcat='$hostcat'
6e1038e0
MB
20637html1dir='$html1dir'
20638html1direxp='$html1direxp'
20639html3dir='$html3dir'
20640html3direxp='$html3direxp'
b4eb6b3d
JH
20641i16size='$i16size'
20642i16type='$i16type'
20643i32size='$i32size'
20644i32type='$i32type'
20645i64size='$i64size'
20646i64type='$i64type'
20647i8size='$i8size'
20648i8type='$i8type'
20649i_arpainet='$i_arpainet'
20650i_bsdioctl='$i_bsdioctl'
10bc17b6 20651i_crypt='$i_crypt'
b4eb6b3d
JH
20652i_db='$i_db'
20653i_dbm='$i_dbm'
20654i_dirent='$i_dirent'
5f80c64f 20655i_dld='$i_dld'
b4eb6b3d
JH
20656i_dlfcn='$i_dlfcn'
20657i_fcntl='$i_fcntl'
20658i_float='$i_float'
758a5d79
JH
20659i_fp='$i_fp'
20660i_fp_class='$i_fp_class'
b4eb6b3d
JH
20661i_gdbm='$i_gdbm'
20662i_grp='$i_grp'
b4eb6b3d
JH
20663i_ieeefp='$i_ieeefp'
20664i_inttypes='$i_inttypes'
2765b840 20665i_langinfo='$i_langinfo'
b4eb6b3d
JH
20666i_libutil='$i_libutil'
20667i_limits='$i_limits'
20668i_locale='$i_locale'
20669i_machcthr='$i_machcthr'
20670i_malloc='$i_malloc'
20671i_math='$i_math'
20672i_memory='$i_memory'
20673i_mntent='$i_mntent'
20674i_ndbm='$i_ndbm'
20675i_netdb='$i_netdb'
20676i_neterrno='$i_neterrno'
20677i_netinettcp='$i_netinettcp'
20678i_niin='$i_niin'
20679i_poll='$i_poll'
20680i_prot='$i_prot'
20681i_pthread='$i_pthread'
20682i_pwd='$i_pwd'
20683i_rpcsvcdbm='$i_rpcsvcdbm'
20684i_sfio='$i_sfio'
20685i_sgtty='$i_sgtty'
20686i_shadow='$i_shadow'
20687i_socks='$i_socks'
20688i_stdarg='$i_stdarg'
20689i_stddef='$i_stddef'
20690i_stdlib='$i_stdlib'
20691i_string='$i_string'
20692i_sunmath='$i_sunmath'
20693i_sysaccess='$i_sysaccess'
20694i_sysdir='$i_sysdir'
20695i_sysfile='$i_sysfile'
20696i_sysfilio='$i_sysfilio'
20697i_sysin='$i_sysin'
20698i_sysioctl='$i_sysioctl'
20699i_syslog='$i_syslog'
20700i_sysmman='$i_sysmman'
20701i_sysmode='$i_sysmode'
20702i_sysmount='$i_sysmount'
20703i_sysndir='$i_sysndir'
20704i_sysparam='$i_sysparam'
20705i_sysresrc='$i_sysresrc'
20706i_syssecrt='$i_syssecrt'
20707i_sysselct='$i_sysselct'
20708i_syssockio='$i_syssockio'
20709i_sysstat='$i_sysstat'
20710i_sysstatfs='$i_sysstatfs'
20711i_sysstatvfs='$i_sysstatvfs'
20712i_systime='$i_systime'
20713i_systimek='$i_systimek'
20714i_systimes='$i_systimes'
20715i_systypes='$i_systypes'
20716i_sysuio='$i_sysuio'
20717i_sysun='$i_sysun'
20718i_sysutsname='$i_sysutsname'
20719i_sysvfs='$i_sysvfs'
20720i_syswait='$i_syswait'
20721i_termio='$i_termio'
20722i_termios='$i_termios'
20723i_time='$i_time'
20724i_unistd='$i_unistd'
20725i_ustat='$i_ustat'
20726i_utime='$i_utime'
20727i_values='$i_values'
20728i_varargs='$i_varargs'
20729i_varhdr='$i_varhdr'
20730i_vfork='$i_vfork'
5f80c64f 20731ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
20732inc_version_list='$inc_version_list'
20733inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
20734incpath='$incpath'
20735inews='$inews'
b4eb6b3d
JH
20736installarchlib='$installarchlib'
20737installbin='$installbin'
6e1038e0
MB
20738installhtml1dir='$installhtml1dir'
20739installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
20740installman1dir='$installman1dir'
20741installman3dir='$installman3dir'
20742installprefix='$installprefix'
20743installprefixexp='$installprefixexp'
20744installprivlib='$installprivlib'
20745installscript='$installscript'
20746installsitearch='$installsitearch'
20747installsitebin='$installsitebin'
6e1038e0
MB
20748installsitehtml1='$installsitehtml1'
20749installsitehtml3='$installsitehtml3'
b4eb6b3d 20750installsitelib='$installsitelib'
6e1038e0
MB
20751installsiteman1='$installsiteman1'
20752installsiteman3='$installsiteman3'
20753installsitescript='$installsitescript'
b4eb6b3d
JH
20754installstyle='$installstyle'
20755installusrbinperl='$installusrbinperl'
20756installvendorarch='$installvendorarch'
20757installvendorbin='$installvendorbin'
6e1038e0
MB
20758installvendorhtml1='$installvendorhtml1'
20759installvendorhtml3='$installvendorhtml3'
b4eb6b3d 20760installvendorlib='$installvendorlib'
6e1038e0
MB
20761installvendorman1='$installvendorman1'
20762installvendorman3='$installvendorman3'
20763installvendorscript='$installvendorscript'
b4eb6b3d 20764intsize='$intsize'
4b661809 20765issymlink='$issymlink'
b4eb6b3d
JH
20766ivdformat='$ivdformat'
20767ivsize='$ivsize'
20768ivtype='$ivtype'
20769known_extensions='$known_extensions'
5f80c64f 20770ksh='$ksh'
5f80c64f
JH
20771ld='$ld'
20772lddlflags='$lddlflags'
20773ldflags='$ldflags'
b4eb6b3d
JH
20774ldflags_uselargefiles='$ldflags_uselargefiles'
20775ldlibpthname='$ldlibpthname'
5f80c64f
JH
20776less='$less'
20777lib_ext='$lib_ext'
20778libc='$libc'
b4eb6b3d 20779libperl='$libperl'
5f80c64f
JH
20780libpth='$libpth'
20781libs='$libs'
43999f95
JH
20782libsdirs='$libsdirs'
20783libsfiles='$libsfiles'
20784libsfound='$libsfound'
13b3f787 20785libspath='$libspath'
5f80c64f 20786libswanted='$libswanted'
b4eb6b3d 20787libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
20788line='$line'
20789lint='$lint'
20790lkflags='$lkflags'
20791ln='$ln'
20792lns='$lns'
10bc17b6 20793localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
20794locincpth='$locincpth'
20795loclibpth='$loclibpth'
b4eb6b3d
JH
20796longdblsize='$longdblsize'
20797longlongsize='$longlongsize'
20798longsize='$longsize'
5f80c64f
JH
20799lp='$lp'
20800lpr='$lpr'
20801ls='$ls'
b4eb6b3d
JH
20802lseeksize='$lseeksize'
20803lseektype='$lseektype'
5f80c64f
JH
20804mail='$mail'
20805mailx='$mailx'
20806make='$make'
20807make_set_make='$make_set_make'
b4eb6b3d
JH
20808mallocobj='$mallocobj'
20809mallocsrc='$mallocsrc'
20810malloctype='$malloctype'
20811man1dir='$man1dir'
20812man1direxp='$man1direxp'
20813man1ext='$man1ext'
20814man3dir='$man3dir'
20815man3direxp='$man3direxp'
20816man3ext='$man3ext'
5f80c64f
JH
20817mips_type='$mips_type'
20818mkdir='$mkdir'
b4eb6b3d
JH
20819mmaptype='$mmaptype'
20820modetype='$modetype'
5f80c64f 20821more='$more'
b4eb6b3d 20822multiarch='$multiarch'
5f80c64f 20823mv='$mv'
b4eb6b3d
JH
20824myarchname='$myarchname'
20825mydomain='$mydomain'
20826myhostname='$myhostname'
5f80c64f
JH
20827myuname='$myuname'
20828n='$n'
2cc61e15 20829need_va_copy='$need_va_copy'
b4eb6b3d
JH
20830netdb_hlen_type='$netdb_hlen_type'
20831netdb_host_type='$netdb_host_type'
20832netdb_name_type='$netdb_name_type'
20833netdb_net_type='$netdb_net_type'
5f80c64f
JH
20834nm='$nm'
20835nm_opt='$nm_opt'
20836nm_so_opt='$nm_so_opt'
b4eb6b3d 20837nonxs_ext='$nonxs_ext'
5f80c64f 20838nroff='$nroff'
b4eb6b3d
JH
20839nvEUformat='$nvEUformat'
20840nvFUformat='$nvFUformat'
20841nvGUformat='$nvGUformat'
53133ed1 20842nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
20843nveformat='$nveformat'
20844nvfformat='$nvfformat'
20845nvgformat='$nvgformat'
20846nvsize='$nvsize'
20847nvtype='$nvtype'
20848o_nonblock='$o_nonblock'
5f80c64f 20849obj_ext='$obj_ext'
b4eb6b3d 20850old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 20851optimize='$optimize'
b4eb6b3d 20852orderlib='$orderlib'
5f80c64f
JH
20853osname='$osname'
20854osvers='$osvers'
b4eb6b3d 20855otherlibdirs='$otherlibdirs'
5f80c64f 20856package='$package'
b4eb6b3d
JH
20857pager='$pager'
20858passcat='$passcat'
20859patchlevel='$patchlevel'
5f80c64f 20860path_sep='$path_sep'
b4eb6b3d 20861perl5='$perl5'
5f80c64f 20862perl='$perl'
151e6568 20863perl_patchlevel='$perl_patchlevel'
b4eb6b3d 20864perladmin='$perladmin'
9c839522 20865perllibs='$perllibs'
b4eb6b3d 20866perlpath='$perlpath'
5f80c64f 20867pg='$pg'
b4eb6b3d
JH
20868phostname='$phostname'
20869pidtype='$pidtype'
5f80c64f 20870plibpth='$plibpth'
b4eb6b3d 20871pm_apiversion='$pm_apiversion'
5f80c64f
JH
20872pmake='$pmake'
20873pr='$pr'
b4eb6b3d
JH
20874prefix='$prefix'
20875prefixexp='$prefixexp'
20876privlib='$privlib'
20877privlibexp='$privlibexp'
f24dbf84 20878procselfexe='$procselfexe'
b4eb6b3d
JH
20879prototype='$prototype'
20880ptrsize='$ptrsize'
20881quadkind='$quadkind'
20882quadtype='$quadtype'
20883randbits='$randbits'
20884randfunc='$randfunc'
10bc17b6 20885random_r_proto='$random_r_proto'
b4eb6b3d
JH
20886randseedtype='$randseedtype'
20887ranlib='$ranlib'
20888rd_nodata='$rd_nodata'
10bc17b6
JH
20889readdir64_r_proto='$readdir64_r_proto'
20890readdir_r_proto='$readdir_r_proto'
b4eb6b3d 20891revision='$revision'
5f80c64f
JH
20892rm='$rm'
20893rmail='$rmail'
5440bc8e 20894run='$run'
5f80c64f 20895runnm='$runnm'
b4eb6b3d
JH
20896sPRIEUldbl='$sPRIEUldbl'
20897sPRIFUldbl='$sPRIFUldbl'
20898sPRIGUldbl='$sPRIGUldbl'
20899sPRIXU64='$sPRIXU64'
20900sPRId64='$sPRId64'
20901sPRIeldbl='$sPRIeldbl'
20902sPRIfldbl='$sPRIfldbl'
20903sPRIgldbl='$sPRIgldbl'
20904sPRIi64='$sPRIi64'
20905sPRIo64='$sPRIo64'
20906sPRIu64='$sPRIu64'
20907sPRIx64='$sPRIx64'
20908sSCNfldbl='$sSCNfldbl'
20909sched_yield='$sched_yield'
20910scriptdir='$scriptdir'
20911scriptdirexp='$scriptdirexp'
5f80c64f 20912sed='$sed'
b4eb6b3d
JH
20913seedfunc='$seedfunc'
20914selectminbits='$selectminbits'
20915selecttype='$selecttype'
5f80c64f 20916sendmail='$sendmail'
10bc17b6
JH
20917setgrent_r_proto='$setgrent_r_proto'
20918sethostent_r_proto='$sethostent_r_proto'
20919setlocale_r_proto='$setlocale_r_proto'
20920setnetent_r_proto='$setnetent_r_proto'
20921setprotoent_r_proto='$setprotoent_r_proto'
20922setpwent_r_proto='$setpwent_r_proto'
20923setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
20924sh='$sh'
20925shar='$shar'
20926sharpbang='$sharpbang'
b4eb6b3d
JH
20927shmattype='$shmattype'
20928shortsize='$shortsize'
20929shrpenv='$shrpenv'
5f80c64f 20930shsharp='$shsharp'
b4eb6b3d
JH
20931sig_count='$sig_count'
20932sig_name='$sig_name'
20933sig_name_init='$sig_name_init'
20934sig_num='$sig_num'
20935sig_num_init='$sig_num_init'
76d3c696 20936sig_size='$sig_size'
b4eb6b3d
JH
20937signal_t='$signal_t'
20938sitearch='$sitearch'
20939sitearchexp='$sitearchexp'
20940sitebin='$sitebin'
20941sitebinexp='$sitebinexp'
6e1038e0
MB
20942sitehtml1='$sitehtml1'
20943sitehtml1exp='$sitehtml1exp'
20944sitehtml3='$sitehtml3'
20945sitehtml3exp='$sitehtml3exp'
b4eb6b3d
JH
20946sitelib='$sitelib'
20947sitelib_stem='$sitelib_stem'
20948sitelibexp='$sitelibexp'
6e1038e0
MB
20949siteman1='$siteman1'
20950siteman1exp='$siteman1exp'
20951siteman3='$siteman3'
20952siteman3exp='$siteman3exp'
b4eb6b3d
JH
20953siteprefix='$siteprefix'
20954siteprefixexp='$siteprefixexp'
6e1038e0
MB
20955sitescript='$sitescript'
20956sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
20957sizesize='$sizesize'
20958sizetype='$sizetype'
5f80c64f
JH
20959sleep='$sleep'
20960smail='$smail'
5f80c64f 20961so='$so'
b4eb6b3d
JH
20962sockethdr='$sockethdr'
20963socketlib='$socketlib'
20964socksizetype='$socksizetype'
5f80c64f
JH
20965sort='$sort'
20966spackage='$spackage'
20967spitshell='$spitshell'
10bc17b6
JH
20968srand48_r_proto='$srand48_r_proto'
20969srandom_r_proto='$srandom_r_proto'
5f80c64f 20970src='$src'
b4eb6b3d
JH
20971ssizetype='$ssizetype'
20972startperl='$startperl'
5f80c64f 20973startsh='$startsh'
b4eb6b3d
JH
20974static_ext='$static_ext'
20975stdchar='$stdchar'
20976stdio_base='$stdio_base'
20977stdio_bufsiz='$stdio_bufsiz'
20978stdio_cnt='$stdio_cnt'
20979stdio_filbuf='$stdio_filbuf'
20980stdio_ptr='$stdio_ptr'
20981stdio_stream_array='$stdio_stream_array'
10bc17b6 20982strerror_r_proto='$strerror_r_proto'
b4eb6b3d 20983strings='$strings'
5f80c64f 20984submit='$submit'
b4eb6b3d
JH
20985subversion='$subversion'
20986sysman='$sysman'
5f80c64f
JH
20987tail='$tail'
20988tar='$tar'
5440bc8e 20989targetarch='$targetarch'
5f80c64f
JH
20990tbl='$tbl'
20991tee='$tee'
20992test='$test'
b4eb6b3d
JH
20993timeincl='$timeincl'
20994timetype='$timetype'
10bc17b6 20995tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 20996to='$to'
5f80c64f
JH
20997touch='$touch'
20998tr='$tr'
20999trnl='$trnl'
21000troff='$troff'
10bc17b6 21001ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
21002u16size='$u16size'
21003u16type='$u16type'
21004u32size='$u32size'
21005u32type='$u32type'
21006u64size='$u64size'
21007u64type='$u64type'
21008u8size='$u8size'
21009u8type='$u8type'
21010uidformat='$uidformat'
21011uidsign='$uidsign'
21012uidsize='$uidsize'
21013uidtype='$uidtype'
5f80c64f
JH
21014uname='$uname'
21015uniq='$uniq'
b4eb6b3d
JH
21016uquadtype='$uquadtype'
21017use5005threads='$use5005threads'
21018use64bitall='$use64bitall'
21019use64bitint='$use64bitint'
5440bc8e 21020usecrosscompile='$usecrosscompile'
5f80c64f 21021usedl='$usedl'
b4eb6b3d
JH
21022useithreads='$useithreads'
21023uselargefiles='$uselargefiles'
21024uselongdouble='$uselongdouble'
21025usemorebits='$usemorebits'
21026usemultiplicity='$usemultiplicity'
21027usemymalloc='$usemymalloc'
5f80c64f 21028usenm='$usenm'
b4eb6b3d
JH
21029useopcode='$useopcode'
21030useperlio='$useperlio'
21031useposix='$useposix'
9514c62b 21032usereentrant='$usereentrant'
b4eb6b3d
JH
21033usesfio='$usesfio'
21034useshrplib='$useshrplib'
29209bc5 21035usesocks='$usesocks'
b4eb6b3d
JH
21036usethreads='$usethreads'
21037usevendorprefix='$usevendorprefix'
21038usevfork='$usevfork'
5f80c64f
JH
21039usrinc='$usrinc'
21040uuname='$uuname'
b4eb6b3d
JH
21041uvXUformat='$uvXUformat'
21042uvoformat='$uvoformat'
21043uvsize='$uvsize'
21044uvtype='$uvtype'
21045uvuformat='$uvuformat'
21046uvxformat='$uvxformat'
21047vendorarch='$vendorarch'
21048vendorarchexp='$vendorarchexp'
21049vendorbin='$vendorbin'
21050vendorbinexp='$vendorbinexp'
6e1038e0
MB
21051vendorhtml1='$vendorhtml1'
21052vendorhtml1exp='$vendorhtml1exp'
21053vendorhtml3='$vendorhtml3'
21054vendorhtml3exp='$vendorhtml3exp'
b4eb6b3d
JH
21055vendorlib='$vendorlib'
21056vendorlib_stem='$vendorlib_stem'
21057vendorlibexp='$vendorlibexp'
6e1038e0
MB
21058vendorman1='$vendorman1'
21059vendorman1exp='$vendorman1exp'
21060vendorman3='$vendorman3'
21061vendorman3exp='$vendorman3exp'
b4eb6b3d
JH
21062vendorprefix='$vendorprefix'
21063vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
21064vendorscript='$vendorscript'
21065vendorscriptexp='$vendorscriptexp'
b4eb6b3d 21066version='$version'
861eb78d 21067version_patchlevel_string='$version_patchlevel_string'
d56c5707 21068versiononly='$versiononly'
5f80c64f 21069vi='$vi'
b4eb6b3d 21070voidflags='$voidflags'
5f80c64f 21071xlibpth='$xlibpth'
b4eb6b3d 21072xs_apiversion='$xs_apiversion'
3659ebf1
JH
21073yacc='$yacc'
21074yaccflags='$yaccflags'
5f80c64f
JH
21075zcat='$zcat'
21076zip='$zip'
21077EOT
21078
21079: Add in command line options if available
21080$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21081
21082: add special variables
21083$test -f $src/patchlevel.h && \
d00b958f 21084awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 21085echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 21086echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
21087
21088: propagate old symbols
21089if $test -f UU/config.sh; then
381aa1ff 21090 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 21091 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 21092 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
21093 set X `cat UU/oldsyms`
21094 shift
21095 case $# in
21096 0) ;;
21097 *)
21098 cat <<EOM
21099Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21100EOM
21101 echo "# Variables propagated from previous config.sh file." >>config.sh
21102 for sym in `cat UU/oldsyms`; do
21103 echo " Propagating $hint variable "'$'"$sym..."
21104 eval 'tmp="$'"${sym}"'"'
21105 echo "$tmp" | \
21106 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21107 done
21108 ;;
21109 esac
21110fi
21111
21112: Finish up by extracting the .SH files
21113case "$alldone" in
21114exit)
21115 $rm -rf UU
24ccb310 21116 echo "Extraction done."
5f80c64f
JH
21117 exit 0
21118 ;;
21119cont)
21120 ;;
21121'')
21122 dflt=''
21123 nostick=true
21124 $cat <<EOM
21125
21126If you'd like to make any changes to the config.sh file before I begin
21127to configure things, do it as a shell escape now (e.g. !vi config.sh).
21128
21129EOM
21130 rp="Press return or use a shell escape to edit config.sh:"
21131 . UU/myread
21132 nostick=''
21133 case "$ans" in
21134 '') ;;
21135 *) : in case they cannot read
21136 sh 1>&4 -c "$ans";;
21137 esac
21138 ;;
21139esac
21140
21141: if this fails, just run all the .SH files by hand
21142. ./config.sh
21143
21144echo " "
21145exec 1>&4
a43e8593 21146pwd=`pwd`
5f80c64f 21147. ./UU/extract
6904989c 21148cd "$pwd"
5f80c64f
JH
21149
21150if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21151 dflt=y
21152 case "$silent" in
21153 true) ;;
21154 *)
21155 $cat <<EOM
21156
21157Now you need to generate make dependencies by running "$make depend".
21158You might prefer to run it in background: "$make depend > makedepend.out &"
21159It can take a while, so you might not want to run it right now.
21160
21161EOM
21162 ;;
21163 esac
21164 rp="Run $make depend now?"
21165 . UU/myread
21166 case "$ans" in
21167 y*)
3d5d58b1 21168 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
21169 ;;
21170 *)
21171 echo "You must run '$make depend' then '$make'."
21172 ;;
21173 esac
21174elif test -f [Mm]akefile; then
21175 echo " "
21176 echo "Now you must run a $make."
21177else
24ccb310 21178 echo "Configure done."
5f80c64f
JH
21179fi
21180
21181if $test -f Policy.sh; then
21182 $cat <<EOM
21183
21184If you compile $package on a different machine or from a different object
21185directory, copy the Policy.sh file from this object directory to the
21186new one before you run Configure -- this will help you with most of
21187the policy defaults.
21188
21189EOM
21190fi
21191if $test -f config.msg; then
21192 echo "Hmm. I also noted the following information while running:"
21193 echo " "
21194 $cat config.msg >&4
21195 $rm -f config.msg
21196fi
21197$rm -f kit*isdone ark*isdone
21198$rm -rf UU
21199
21200: End of Configure
21201