This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[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 19#
58c89e2c
NC
20#
21# Though this script was generated by metaconfig, it is OK to send
22# patches against it. It's up to the Configure pumpkin to backport
23# the patch to the metaunits if it is accepted.
24# See Porting/pumpkin.pod for more information on metaconfig.
25#
2304df62 26
dfe9444c 27# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 28#
5f7d02a9 29# Generated on Wed Aug 2 13:20:07 CEST 2006 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
a868f49f 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
2ea5368e
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
a0d0e21e
LW
68: compute my invocation name
69me=$0
70case "$0" in
71*/*)
72 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73 test "$me" || me=$0
74 ;;
75esac
76
dfe9444c 77: Proper separator for the PATH environment variable
8e07c86e
AD
78p_=:
79: On OS/2 this directory should exist if this is not floppy only system :-]
8257dec7 80if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
81 if test -n "$OS2_SHELL"; then
82 p_=\;
83 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
8257dec7 85 is_os2=yes
c4f23d77 86 elif test -n "$DJGPP"; then
495e2cbe
MB
87 case "X${MACHTYPE:-nonesuchmach}" in
88 *cygwin) ;;
89 *) p_=\; ;;
90 esac
dfe9444c 91 fi
39e571d4 92fi
a0d0e21e
LW
93
94: Proper PATH setting
95paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 96paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 97paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 98paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 99paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
066079d9 100paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
101paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 103paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
104
105for p in $paths
106do
8e07c86e
AD
107 case "$p_$PATH$p_" in
108 *$p_$p$p_*) ;;
109 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
110 esac
111done
112
8e07c86e 113PATH=.$p_$PATH
2304df62
AD
114export PATH
115
dfe9444c
AD
116: shall we be using ksh?
117inksh=''
118needksh=''
119avoidksh=''
120newsh=/bin/ksh
121changesh=''
ff0cee69 122if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
123 inksh=true
124fi
125if test -f /hp-ux -a -f /bin/ksh; then
126 needksh='to avoid sh bug in "here document" expansion'
127fi
128if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129 if test X`/usr/bin/uname -v` = X4; then
130 avoidksh="to avoid AIX 4's /bin/sh"
131 newsh=/usr/bin/bsh
2304df62 132 fi
dfe9444c 133fi
cf04f91f
JH
134if test -f /osf_boot -a -f /usr/sbin/setld; then
135 if test X`/usr/bin/uname -s` = XOSF1; then
136 avoidksh="to avoid Digital UNIX' ksh"
137 newsh=/bin/sh
138 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139 fi
140fi
dfe9444c
AD
141case "$inksh/$needksh" in
142/[a-z]*)
c4f23d77 143 ENV=''
dfe9444c
AD
144 changesh=true
145 reason="$needksh"
146 ;;
147esac
148case "$inksh/$avoidksh" in
149true/[a-z]*)
150 changesh=true
151 reason="$avoidksh"
152 ;;
153esac
154case "$inksh/$needksh-$avoidksh-" in
155true/--)
a0d0e21e
LW
156 cat <<EOM
157(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 158mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 159EOM
dfe9444c
AD
160 ;;
161esac
162case "$changesh" in
163true)
2e2a97a6 164 export newsh
dfe9444c
AD
165 echo "(Feeding myself to $newsh $reason.)"
166 case "$0" in
167 Configure|*/Configure) exec $newsh $0 "$@";;
168 *) exec $newsh Configure "$@";;
169 esac
170 ;;
171esac
2304df62 172
bfb7748a
AD
173: if needed set CDPATH to a harmless value that is not chatty
174: avoid bash 2.02 problems with empty CDPATH.
175case "$CDPATH" in
176'') ;;
177*) case "$SHELL" in
178 *bash*) CDPATH='.' ;;
179 *) CDPATH='' ;;
180 esac
181 ;;
182esac
2304df62
AD
183: Configure runs within the UU subdirectory
184test -d UU || mkdir UU
8e07c86e 185cd UU && rm -f ./*
2304df62 186
6b356c8e
JH
187ccname=''
188ccversion=''
b4eb6b3d
JH
189ccsymbols=''
190cppccsymbols=''
191cppsymbols=''
5440bc8e
JH
192from=''
193run=''
194targetarch=''
195to=''
196usecrosscompile=''
bd43df42 197mistrustnm=''
9c839522 198perllibs=''
b4eb6b3d
JH
199dynamic_ext=''
200extensions=''
201known_extensions=''
202nonxs_ext=''
203static_ext=''
204useopcode=''
205useposix=''
6fcddf3b 206extras=''
ecfc5424 207d_bsd=''
40a7a20a 208d_eunice=''
2304df62
AD
209d_xenix=''
210eunicefix=''
211Mcc=''
dfe9444c 212ar=''
2304df62
AD
213awk=''
214bash=''
215bison=''
216byacc=''
217cat=''
218chgrp=''
219chmod=''
220chown=''
ecfc5424 221comm=''
2304df62
AD
222compress=''
223cp=''
224cpio=''
225cpp=''
226csh=''
227date=''
228echo=''
229egrep=''
230emacs=''
231expr=''
232find=''
233flex=''
3c728e00 234gmake=''
2304df62 235grep=''
8ff267be 236gzip=''
2304df62
AD
237inews=''
238ksh=''
239less=''
240line=''
241lint=''
242ln=''
243lp=''
244lpr=''
245ls=''
246mail=''
247mailx=''
dfe9444c 248make=''
2304df62
AD
249mkdir=''
250more=''
251mv=''
693762b4 252nm=''
2304df62
AD
253nroff=''
254perl=''
255pg=''
256pmake=''
257pr=''
258rm=''
259rmail=''
260sed=''
261sendmail=''
2304df62
AD
262shar=''
263sleep=''
264smail=''
265sort=''
266submit=''
267tail=''
268tar=''
269tbl=''
693762b4 270tee=''
2304df62
AD
271test=''
272touch=''
273tr=''
274troff=''
275uname=''
276uniq=''
277uuname=''
278vi=''
279zcat=''
8ff267be 280zip=''
b4eb6b3d
JH
281full_ar=''
282full_sed=''
a0d0e21e 283libswanted=''
2304df62
AD
284hint=''
285myuname=''
85e6fe83
LW
286osname=''
287osvers=''
2304df62
AD
288Author=''
289Date=''
290Header=''
291Id=''
292Locker=''
293Log=''
294RCSfile=''
295Revision=''
296Source=''
297State=''
dfe9444c
AD
298_a=''
299_exe=''
300_o=''
4633a7c4
LW
301archobjs=''
302exe_ext=''
303firstmakefile=''
304lib_ext=''
305obj_ext=''
306path_sep=''
b4eb6b3d 307afs=''
a6d26a0d 308afsroot=''
b4eb6b3d
JH
309alignbytes=''
310ansi2knr=''
311archlib=''
312archlibexp=''
313d_archlib=''
314installarchlib=''
315archname=''
316myarchname=''
317d_atolf=''
318d_atoll=''
319baserev=''
320bin=''
321binexp=''
de7128ac 322initialinstalllocation=''
b4eb6b3d 323installbin=''
de7128ac 324userelocatableinc=''
b4eb6b3d 325byteorder=''
2304df62 326cc=''
2304df62
AD
327ccflags=''
328cppflags=''
329ldflags=''
330lkflags=''
8e07c86e 331locincpth=''
2304df62 332optimize=''
b4eb6b3d 333cf_email=''
2304df62
AD
334cf_by=''
335cf_time=''
b4eb6b3d 336charsize=''
2304df62 337contains=''
b4eb6b3d 338cpp_stuff=''
2304df62
AD
339cpplast=''
340cppminus=''
341cpprun=''
342cppstdin=''
74cac757 343d__fwalk=''
b4eb6b3d
JH
344d_access=''
345d_accessx=''
5a29c6bc 346d_aintl=''
b4eb6b3d 347d_alarm=''
10bc17b6
JH
348asctime_r_proto=''
349d_asctime_r=''
24c2fff4
NC
350d_attribute_format=''
351d_attribute_malloc=''
352d_attribute_nonnull=''
353d_attribute_noreturn=''
354d_attribute_pure=''
355d_attribute_unused=''
356d_attribute_warn_unused_result=''
b4eb6b3d
JH
357d_bcmp=''
358d_bcopy=''
cb478989
NC
359d_builtin_choose_expr=''
360d_builtin_expect=''
b4eb6b3d 361d_bzero=''
74950343 362d_c99_variadic_macros=''
b4eb6b3d
JH
363d_casti32=''
364castflags=''
365d_castneg=''
366d_chown=''
367d_chroot=''
368d_chsize=''
758a5d79 369d_class=''
1466f2fb 370d_clearenv=''
b4eb6b3d
JH
371d_closedir=''
372d_void_closedir=''
4e0554ec 373d_cmsghdr_s=''
b4eb6b3d 374d_const=''
5a29c6bc 375d_copysignl=''
d2ae4405 376d_cplusplus=''
b4eb6b3d
JH
377cryptlib=''
378d_crypt=''
10bc17b6
JH
379crypt_r_proto=''
380d_crypt_r=''
b4eb6b3d
JH
381d_csh=''
382full_csh=''
10bc17b6
JH
383ctermid_r_proto=''
384d_ctermid_r=''
385ctime_r_proto=''
386d_ctime_r=''
b4eb6b3d
JH
387d_cuserid=''
388d_dbl_dig=''
2ef53570 389d_dbminitproto=''
b4eb6b3d 390d_difftime=''
ae0e3d3b 391d_dirfd=''
b4eb6b3d 392d_dlerror=''
a0d0e21e 393d_dlopen=''
b4eb6b3d
JH
394d_dlsymun=''
395d_dosuid=''
396d_suidsafe=''
10bc17b6
JH
397d_drand48_r=''
398drand48_r_proto=''
b4eb6b3d
JH
399d_drand48proto=''
400d_dup2=''
401d_eaccess=''
402d_endgrent=''
10bc17b6
JH
403d_endgrent_r=''
404endgrent_r_proto=''
b4eb6b3d 405d_endhent=''
10bc17b6
JH
406d_endhostent_r=''
407endhostent_r_proto=''
b4eb6b3d 408d_endnent=''
10bc17b6
JH
409d_endnetent_r=''
410endnetent_r_proto=''
b4eb6b3d 411d_endpent=''
10bc17b6
JH
412d_endprotoent_r=''
413endprotoent_r_proto=''
b4eb6b3d 414d_endpwent=''
10bc17b6
JH
415d_endpwent_r=''
416endpwent_r_proto=''
b4eb6b3d 417d_endsent=''
10bc17b6
JH
418d_endservent_r=''
419endservent_r_proto=''
ff0950a8 420d_faststdio=''
b363b713 421d_fchdir=''
b4eb6b3d
JH
422d_fchmod=''
423d_fchown=''
424d_fcntl=''
9d9004a9 425d_fcntl_can_lock=''
b4eb6b3d
JH
426d_fd_macros=''
427d_fd_set=''
428d_fds_bits=''
429d_fgetpos=''
758a5d79
JH
430d_finite=''
431d_finitel=''
b4eb6b3d
JH
432d_flexfnam=''
433d_flock=''
2ef53570 434d_flockproto=''
b4eb6b3d 435d_fork=''
758a5d79
JH
436d_fp_class=''
437d_fpclass=''
438d_fpclassify=''
439d_fpclassl=''
b4eb6b3d
JH
440d_fpos64_t=''
441d_frexpl=''
442d_fs_data_s=''
443d_fseeko=''
444d_fsetpos=''
445d_fstatfs=''
411ab01c 446d_fsync=''
b4eb6b3d
JH
447d_ftello=''
448d_ftime=''
449d_gettimeod=''
704c3401 450d_futimes=''
b4eb6b3d
JH
451d_Gconvert=''
452d_getcwd=''
453d_getespwnam=''
454d_getfsstat=''
455d_getgrent=''
10bc17b6
JH
456d_getgrent_r=''
457getgrent_r_proto=''
458d_getgrgid_r=''
459getgrgid_r_proto=''
460d_getgrnam_r=''
461getgrnam_r_proto=''
b4eb6b3d
JH
462d_getgrps=''
463d_gethbyaddr=''
464d_gethbyname=''
465d_gethent=''
466aphostname=''
467d_gethname=''
468d_phostname=''
469d_uname=''
10bc17b6
JH
470d_gethostbyaddr_r=''
471gethostbyaddr_r_proto=''
472d_gethostbyname_r=''
473gethostbyname_r_proto=''
474d_gethostent_r=''
475gethostent_r_proto=''
b4eb6b3d 476d_gethostprotos=''
4e0554ec 477d_getitimer=''
b4eb6b3d 478d_getlogin=''
10bc17b6
JH
479d_getlogin_r=''
480getlogin_r_proto=''
b4eb6b3d
JH
481d_getmnt=''
482d_getmntent=''
483d_getnbyaddr=''
484d_getnbyname=''
485d_getnent=''
10bc17b6
JH
486d_getnetbyaddr_r=''
487getnetbyaddr_r_proto=''
488d_getnetbyname_r=''
489getnetbyname_r_proto=''
490d_getnetent_r=''
491getnetent_r_proto=''
b4eb6b3d 492d_getnetprotos=''
0c0643d0 493d_getpagsz=''
b4eb6b3d
JH
494d_getpent=''
495d_getpgid=''
496d_getpgrp2=''
497d_bsdgetpgrp=''
498d_getpgrp=''
499d_getppid=''
500d_getprior=''
501d_getpbyname=''
502d_getpbynumber=''
10bc17b6
JH
503d_getprotobyname_r=''
504getprotobyname_r_proto=''
505d_getprotobynumber_r=''
506getprotobynumber_r_proto=''
507d_getprotoent_r=''
508getprotoent_r_proto=''
b4eb6b3d
JH
509d_getprotoprotos=''
510d_getprpwnam=''
511d_getpwent=''
10bc17b6
JH
512d_getpwent_r=''
513getpwent_r_proto=''
514d_getpwnam_r=''
515getpwnam_r_proto=''
516d_getpwuid_r=''
517getpwuid_r_proto=''
b4eb6b3d 518d_getsent=''
10bc17b6
JH
519d_getservbyname_r=''
520getservbyname_r_proto=''
521d_getservbyport_r=''
522getservbyport_r_proto=''
523d_getservent_r=''
524getservent_r_proto=''
b4eb6b3d
JH
525d_getservprotos=''
526d_getspnam=''
10bc17b6
JH
527d_getspnam_r=''
528getspnam_r_proto=''
b4eb6b3d
JH
529d_getsbyname=''
530d_getsbyport=''
10bc17b6
JH
531d_gmtime_r=''
532gmtime_r_proto=''
a4f3eea9 533d_gnulibc=''
5f6e0ee4 534gnulibc_version=''
b4eb6b3d
JH
535d_hasmntopt=''
536d_htonl=''
5a29c6bc 537d_ilogbl=''
b4eb6b3d
JH
538d_inetaton=''
539d_int64_t=''
540d_isascii=''
758a5d79
JH
541d_isfinite=''
542d_isinf=''
b4eb6b3d
JH
543d_isnan=''
544d_isnanl=''
545d_killpg=''
546d_lchown=''
547d_ldbl_dig=''
a663fd0a 548d_libm_lib_version=''
b4eb6b3d 549d_link=''
10bc17b6
JH
550d_localtime_r=''
551localtime_r_proto=''
b4eb6b3d
JH
552d_locconv=''
553d_lockf=''
554d_longdbl=''
555longdblsize=''
556d_longlong=''
557longlongsize=''
558d_lseekproto=''
559d_lstat=''
560d_madvise=''
1466f2fb
SP
561d_malloc_good_size=''
562d_malloc_size=''
b4eb6b3d
JH
563d_mblen=''
564d_mbstowcs=''
565d_mbtowc=''
566d_memchr=''
567d_memcmp=''
568d_memcpy=''
569d_memmove=''
570d_memset=''
571d_mkdir=''
572d_mkdtemp=''
573d_mkfifo=''
574d_mkstemp=''
575d_mkstemps=''
576d_mktime=''
577d_mmap=''
578mmaptype=''
579d_modfl=''
e67aeab1 580d_modfl_pow32_bug=''
bc9a1b2c 581d_modflproto=''
b4eb6b3d
JH
582d_mprotect=''
583d_msg=''
584d_msgctl=''
585d_msgget=''
4e0554ec 586d_msghdr_s=''
b4eb6b3d
JH
587d_msgrcv=''
588d_msgsnd=''
589d_msync=''
590d_munmap=''
591d_nice=''
2765b840 592d_nl_langinfo=''
b4eb6b3d
JH
593d_off64_t=''
594d_open3=''
595d_fpathconf=''
596d_pathconf=''
597d_pause=''
598d_pipe=''
599d_poll=''
2304df62 600d_portable=''
a33c94aa 601d_procselfexe=''
f24dbf84 602procselfexe=''
b4eb6b3d
JH
603d_old_pthread_create_joinable=''
604old_pthread_create_joinable=''
d6483fcc 605d_pthread_atfork=''
16c773f9 606d_pthread_attr_setscope=''
b4eb6b3d
JH
607d_pthread_yield=''
608d_sched_yield=''
609sched_yield=''
610d_qgcvt=''
10bc17b6
JH
611d_random_r=''
612random_r_proto=''
613d_readdir64_r=''
614readdir64_r_proto=''
b4eb6b3d
JH
615d_readdir=''
616d_rewinddir=''
617d_seekdir=''
618d_telldir=''
10bc17b6
JH
619d_readdir_r=''
620readdir_r_proto=''
b4eb6b3d 621d_readlink=''
4e0554ec
JH
622d_readv=''
623d_recvmsg=''
b4eb6b3d
JH
624d_rename=''
625d_rmdir=''
626d_safebcpy=''
627d_safemcpy=''
628d_sanemcmp=''
ef9f17be 629d_sbrkproto=''
5a29c6bc 630d_scalbnl=''
b4eb6b3d
JH
631d_select=''
632d_sem=''
633d_semctl=''
634d_semget=''
635d_semop=''
4e0554ec 636d_sendmsg=''
b4eb6b3d
JH
637d_setegid=''
638d_seteuid=''
639d_setgrent=''
10bc17b6
JH
640d_setgrent_r=''
641setgrent_r_proto=''
b4eb6b3d
JH
642d_setgrps=''
643d_sethent=''
10bc17b6
JH
644d_sethostent_r=''
645sethostent_r_proto=''
4e0554ec 646d_setitimer=''
b4eb6b3d
JH
647d_setlinebuf=''
648d_setlocale=''
10bc17b6
JH
649d_setlocale_r=''
650setlocale_r_proto=''
b4eb6b3d 651d_setnent=''
10bc17b6
JH
652d_setnetent_r=''
653setnetent_r_proto=''
b4eb6b3d
JH
654d_setpent=''
655d_setpgid=''
656d_setpgrp2=''
657d_bsdsetpgrp=''
658d_setpgrp=''
659d_setprior=''
660d_setproctitle=''
10bc17b6
JH
661d_setprotoent_r=''
662setprotoent_r_proto=''
b4eb6b3d 663d_setpwent=''
10bc17b6
JH
664d_setpwent_r=''
665setpwent_r_proto=''
b4eb6b3d
JH
666d_setregid=''
667d_setresgid=''
668d_setresuid=''
669d_setreuid=''
670d_setrgid=''
671d_setruid=''
672d_setsent=''
10bc17b6
JH
673d_setservent_r=''
674setservent_r_proto=''
b4eb6b3d
JH
675d_setsid=''
676d_setvbuf=''
677d_sfio=''
678usesfio=''
679d_shm=''
680d_shmat=''
681d_shmatprototype=''
682shmattype=''
683d_shmctl=''
684d_shmdt=''
685d_shmget=''
686d_sigaction=''
983dbef6 687d_sigprocmask=''
b4eb6b3d 688d_sigsetjmp=''
5d39362b 689usesitecustomize=''
4531c2c7
SP
690d_snprintf=''
691d_vsnprintf=''
49a78c82 692d_sockatmark=''
2ef53570 693d_sockatmarkproto=''
b4eb6b3d
JH
694d_msg_ctrunc=''
695d_msg_dontroute=''
696d_msg_oob=''
697d_msg_peek=''
698d_msg_proxy=''
699d_oldsock=''
700d_scm_rights=''
701d_socket=''
702d_sockpair=''
703sockethdr=''
704socketlib=''
705d_socklen_t=''
706d_socks5_init=''
704c3401 707d_sprintf_returns_strlen=''
b4eb6b3d 708d_sqrtl=''
10bc17b6
JH
709d_srand48_r=''
710srand48_r_proto=''
711d_srandom_r=''
712srandom_r_proto=''
eef837ea 713d_sresgproto=''
640374d0 714d_sresuproto=''
b4eb6b3d
JH
715d_statblks=''
716d_statfs_f_flags=''
717d_statfs_s=''
718d_fstatvfs=''
719d_statvfs=''
720d_stdio_cnt_lval=''
721d_stdio_ptr_lval=''
a7ffa9b9
NC
722d_stdio_ptr_lval_nochange_cnt=''
723d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
724d_stdiobase=''
725d_stdstdio=''
726stdio_base=''
727stdio_bufsiz=''
728stdio_cnt=''
729stdio_filbuf=''
730stdio_ptr=''
731d_index=''
732d_strchr=''
733d_strcoll=''
734d_strctcpy=''
735d_strerrm=''
736d_strerror=''
737d_sysernlst=''
738d_syserrlst=''
10bc17b6
JH
739d_strerror_r=''
740strerror_r_proto=''
b3c85772 741d_strftime=''
84baed4c
CB
742d_strlcat=''
743d_strlcpy=''
b4eb6b3d
JH
744d_strtod=''
745d_strtol=''
746d_strtold=''
747d_strtoll=''
28e5dec8 748d_strtoq=''
b4eb6b3d
JH
749d_strtoul=''
750d_strtoull=''
751d_strtouq=''
752d_strxfrm=''
753d_symlink=''
754d_syscall=''
2ef53570 755d_syscallproto=''
b4eb6b3d
JH
756d_sysconf=''
757d_system=''
758d_tcgetpgrp=''
759d_tcsetpgrp=''
760d_telldirproto=''
761d_time=''
762timetype=''
763clocktype=''
764d_times=''
10bc17b6
JH
765d_tmpnam_r=''
766tmpnam_r_proto=''
b4eb6b3d 767d_truncate=''
10bc17b6
JH
768d_ttyname_r=''
769ttyname_r_proto=''
b4eb6b3d 770d_tzname=''
4e0554ec
JH
771d_u32align=''
772d_ualarm=''
b4eb6b3d
JH
773d_umask=''
774d_semctl_semid_ds=''
775d_semctl_semun=''
776d_union_semun=''
758a5d79 777d_unordered=''
1466f2fb 778d_unsetenv=''
4e0554ec 779d_usleep=''
2ef53570 780d_usleepproto=''
b4eb6b3d
JH
781d_ustat=''
782d_vfork=''
783usevfork=''
784d_voidsig=''
785signal_t=''
786d_volatile=''
787d_charvspr=''
788d_vprintf=''
789d_wait4=''
790d_waitpid=''
791d_wcstombs=''
792d_wctomb=''
4e0554ec 793d_writev=''
b4eb6b3d 794dlext=''
85e6fe83
LW
795cccdlflags=''
796ccdlflags=''
2304df62 797dlsrc=''
232e078e 798ld=''
85e6fe83 799lddlflags=''
2304df62 800usedl=''
b4eb6b3d
JH
801doublesize=''
802ebcdic=''
803fflushNULL=''
804fflushall=''
805fpossize=''
806fpostype=''
2d736872 807gccansipedantic=''
5b463ca7 808gccosandvers=''
8a27cf78 809gccversion=''
b4eb6b3d
JH
810gidformat=''
811gidsign=''
812gidsize=''
813gidtype=''
814groupstype=''
815h_fcntl=''
816h_sysfile=''
6e1038e0
MB
817html1dir=''
818html1direxp=''
819installhtml1dir=''
820html3dir=''
821html3direxp=''
822installhtml3dir=''
b4eb6b3d 823i_arpainet=''
10bc17b6 824i_crypt=''
b4eb6b3d
JH
825db_hashtype=''
826db_prefixtype=''
640374d0
JH
827db_version_major=''
828db_version_minor=''
829db_version_patch=''
b4eb6b3d
JH
830i_db=''
831i_dbm=''
832i_rpcsvcdbm=''
833d_dirnamlen=''
834direntrytype=''
835i_dirent=''
a0d0e21e 836i_dld=''
b4eb6b3d
JH
837i_dlfcn=''
838i_fcntl=''
839i_float=''
758a5d79
JH
840i_fp=''
841i_fp_class=''
b4eb6b3d
JH
842i_gdbm=''
843d_grpasswd=''
844i_grp=''
b4eb6b3d
JH
845i_ieeefp=''
846i_inttypes=''
2765b840 847i_langinfo=''
b4eb6b3d
JH
848i_libutil=''
849i_limits=''
850i_locale=''
851i_machcthr=''
852i_malloc=''
853i_math=''
854i_memory=''
855i_mntent=''
856i_ndbm=''
857i_netdb=''
858i_neterrno=''
859i_netinettcp=''
860i_niin=''
861i_sysin=''
862i_poll=''
863i_prot=''
864i_pthread=''
865d_pwage=''
866d_pwchange=''
867d_pwclass=''
868d_pwcomment=''
869d_pwexpire=''
870d_pwgecos=''
871d_pwpasswd=''
872d_pwquota=''
873i_pwd=''
874i_sfio=''
875i_shadow=''
876i_socks=''
877i_stddef=''
878i_stdlib=''
879i_string=''
880strings=''
881i_sunmath=''
882i_sysaccess=''
883i_sysdir=''
884i_sysfile=''
885d_voidtty=''
886i_bsdioctl=''
887i_sysfilio=''
888i_sysioctl=''
889i_syssockio=''
890i_syslog=''
891i_sysmman=''
892i_sysmode=''
893i_sysmount=''
894i_sysndir=''
895i_sysparam=''
896i_sysresrc=''
897i_syssecrt=''
898i_sysselct=''
899i_sysstat=''
900i_sysstatfs=''
901i_sysstatvfs=''
902i_systimes=''
903i_systypes=''
904i_sysuio=''
905i_sysun=''
906i_sysutsname=''
907i_sysvfs=''
908i_syswait=''
909i_sgtty=''
910i_termio=''
911i_termios=''
14b90194
JH
912d_tm_tm_gmtoff=''
913d_tm_tm_zone=''
b4eb6b3d
JH
914i_systime=''
915i_systimek=''
916i_time=''
917timeincl=''
918i_unistd=''
919i_ustat=''
920i_utime=''
921i_values=''
922i_stdarg=''
923i_varargs=''
924i_varhdr=''
925i_vfork=''
de7128ac 926d_inc_version_list=''
b4eb6b3d
JH
927inc_version_list=''
928inc_version_list_init=''
929installprefix=''
930installprefixexp=''
931installstyle=''
932installusrbinperl=''
933intsize=''
934longsize=''
935shortsize=''
4b661809 936issymlink=''
2304df62 937libc=''
b4eb6b3d
JH
938ldlibpthname=''
939libperl=''
940shrpenv=''
941useshrplib=''
a0d0e21e 942glibpth=''
2304df62 943libpth=''
8e07c86e 944loclibpth=''
2304df62
AD
945plibpth=''
946xlibpth=''
1cfa4ec7 947ignore_versioned_solibs=''
2304df62 948libs=''
43999f95
JH
949libsdirs=''
950libsfiles=''
951libsfound=''
13b3f787 952libspath=''
85e6fe83 953lns=''
b4eb6b3d
JH
954d_PRIEUldbl=''
955d_PRIFUldbl=''
956d_PRIGUldbl=''
957d_PRIeldbl=''
958d_PRIfldbl=''
959d_PRIgldbl=''
960d_SCNfldbl=''
961sPRIEUldbl=''
962sPRIFUldbl=''
963sPRIGUldbl=''
964sPRIeldbl=''
965sPRIfldbl=''
966sPRIgldbl=''
967sSCNfldbl=''
968lseeksize=''
969lseektype=''
5109a103 970mad=''
5109a103
NC
971madlyh=''
972madlyobj=''
973madlysrc=''
de7128ac
NC
974make_set_make=''
975d_mymalloc=''
976freetype=''
b4eb6b3d
JH
977mallocobj=''
978mallocsrc=''
979malloctype=''
1c6118a4 980usemallocwrap=''
b4eb6b3d
JH
981usemymalloc=''
982installman1dir=''
983man1dir=''
984man1direxp=''
985man1ext=''
986installman3dir=''
987man3dir=''
988man3direxp=''
989man3ext=''
990modetype=''
991multiarch=''
992mydomain=''
993myhostname=''
994phostname=''
2304df62
AD
995c=''
996n=''
b4eb6b3d
JH
997d_eofnblk=''
998eagain=''
999o_nonblock=''
1000rd_nodata=''
2cc61e15 1001need_va_copy=''
b4eb6b3d
JH
1002netdb_hlen_type=''
1003netdb_host_type=''
1004netdb_name_type=''
1005netdb_net_type=''
1006groupcat=''
1007hostcat=''
1008passcat=''
1009orderlib=''
1010ranlib=''
1011d_perl_otherlibdirs=''
1012otherlibdirs=''
2304df62
AD
1013package=''
1014spackage=''
b4eb6b3d
JH
1015pager=''
1016api_revision=''
1017api_subversion=''
1018api_version=''
1019api_versionstring=''
1020patchlevel=''
151e6568 1021perl_patchlevel=''
b4eb6b3d
JH
1022revision=''
1023subversion=''
1024version=''
861eb78d 1025version_patchlevel_string=''
b4eb6b3d
JH
1026perl5=''
1027perladmin=''
1028perlpath=''
1029d_nv_preserves_uv=''
4a989ed6 1030d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1031i16size=''
1032i16type=''
1033i32size=''
1034i32type=''
1035i64size=''
1036i64type=''
1037i8size=''
1038i8type=''
1039ivsize=''
1040ivtype=''
53133ed1 1041nv_preserves_uv_bits=''
b4eb6b3d
JH
1042nvsize=''
1043nvtype=''
1044u16size=''
1045u16type=''
1046u32size=''
1047u32type=''
1048u64size=''
1049u64type=''
1050u8size=''
1051u8type=''
1052uvsize=''
1053uvtype=''
1054ivdformat=''
1055nvEUformat=''
1056nvFUformat=''
1057nvGUformat=''
1058nveformat=''
1059nvfformat=''
1060nvgformat=''
1061uvXUformat=''
1062uvoformat=''
1063uvuformat=''
1064uvxformat=''
1065pidtype=''
1066prefix=''
1067prefixexp=''
1068installprivlib=''
1069privlib=''
1070privlibexp=''
1071prototype=''
1072ptrsize=''
1073d_PRIXU64=''
1074d_PRId64=''
1075d_PRIi64=''
1076d_PRIo64=''
1077d_PRIu64=''
1078d_PRIx64=''
1079sPRIXU64=''
1080sPRId64=''
1081sPRIi64=''
1082sPRIo64=''
1083sPRIu64=''
1084sPRIx64=''
1085d_quad=''
1086quadkind=''
1087quadtype=''
1088uquadtype=''
1089drand01=''
1090randbits=''
1091randfunc=''
1092randseedtype=''
1093seedfunc=''
1094installscript=''
1095scriptdir=''
1096scriptdirexp=''
1097selectminbits=''
1098selecttype=''
8ff267be 1099sh=''
b4eb6b3d
JH
1100sig_count=''
1101sig_name=''
1102sig_name_init=''
1103sig_num=''
1104sig_num_init=''
76d3c696 1105sig_size=''
de7128ac 1106d_sitearch=''
b4eb6b3d
JH
1107installsitearch=''
1108sitearch=''
1109sitearchexp=''
1110installsitebin=''
1111sitebin=''
1112sitebinexp=''
3bb95762
JH
1113installsitehtml1dir=''
1114sitehtml1dir=''
1115sitehtml1direxp=''
1116installsitehtml3dir=''
1117sitehtml3dir=''
1118sitehtml3direxp=''
b4eb6b3d
JH
1119installsitelib=''
1120sitelib=''
1121sitelib_stem=''
1122sitelibexp=''
3bb95762
JH
1123installsiteman1dir=''
1124siteman1dir=''
1125siteman1direxp=''
1126installsiteman3dir=''
1127siteman3dir=''
1128siteman3direxp=''
b4eb6b3d
JH
1129siteprefix=''
1130siteprefixexp=''
6e1038e0
MB
1131installsitescript=''
1132sitescript=''
1133sitescriptexp=''
b4eb6b3d
JH
1134sizesize=''
1135sizetype=''
a0d0e21e 1136so=''
b4eb6b3d 1137socksizetype=''
2304df62
AD
1138sharpbang=''
1139shsharp=''
1140spitshell=''
dfe9444c 1141src=''
b4eb6b3d
JH
1142ssizetype=''
1143startperl=''
2304df62 1144startsh=''
b4eb6b3d
JH
1145stdchar=''
1146d_stdio_stream_array=''
1147stdio_stream_array=''
1148sysman=''
5ff3f7a4 1149trnl=''
b4eb6b3d
JH
1150uidformat=''
1151uidsign=''
1152uidsize=''
1153uidtype=''
1154archname64=''
1155use64bitall=''
1156use64bitint=''
ff0950a8 1157usefaststdio=''
b4eb6b3d
JH
1158ccflags_uselargefiles=''
1159ldflags_uselargefiles=''
1160libswanted_uselargefiles=''
1161uselargefiles=''
1162uselongdouble=''
1163usemorebits=''
1164usemultiplicity=''
2304df62 1165nm_opt=''
40a7a20a 1166nm_so_opt=''
2304df62
AD
1167runnm=''
1168usenm=''
b4eb6b3d 1169useperlio=''
29209bc5 1170usesocks=''
b4eb6b3d
JH
1171d_oldpthreads=''
1172use5005threads=''
1173useithreads=''
9514c62b 1174usereentrant=''
b4eb6b3d 1175usethreads=''
2304df62 1176incpath=''
2304df62
AD
1177mips_type=''
1178usrinc=''
b4eb6b3d
JH
1179d_vendorarch=''
1180installvendorarch=''
1181vendorarch=''
1182vendorarchexp=''
1183d_vendorbin=''
1184installvendorbin=''
1185vendorbin=''
1186vendorbinexp=''
3bb95762
JH
1187installvendorhtml1dir=''
1188vendorhtml1dir=''
1189vendorhtml1direxp=''
1190installvendorhtml3dir=''
1191vendorhtml3dir=''
1192vendorhtml3direxp=''
b4eb6b3d
JH
1193d_vendorlib=''
1194installvendorlib=''
1195vendorlib=''
1196vendorlib_stem=''
1197vendorlibexp=''
3bb95762
JH
1198installvendorman1dir=''
1199vendorman1dir=''
1200vendorman1direxp=''
1201installvendorman3dir=''
1202vendorman3dir=''
1203vendorman3direxp=''
b4eb6b3d
JH
1204usevendorprefix=''
1205vendorprefix=''
1206vendorprefixexp=''
6e1038e0
MB
1207d_vendorscript=''
1208installvendorscript=''
1209vendorscript=''
1210vendorscriptexp=''
d56c5707 1211versiononly=''
b4eb6b3d
JH
1212defvoidused=''
1213voidflags=''
3659ebf1
JH
1214yacc=''
1215yaccflags=''
2304df62
AD
1216CONFIG=''
1217
ecfc5424
AD
1218define='define'
1219undef='undef'
1220smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1221rmlist=''
1222
1223: We must find out about Eunice early
1224eunicefix=':'
1225if test -f /etc/unixtovms; then
1226 eunicefix=/etc/unixtovms
1227fi
1228if test -f /etc/unixtovms.exe; then
1229 eunicefix=/etc/unixtovms.exe
1230fi
1231
cfb04860 1232: Set executable suffix now -- needed before hints available
6153ba32
PG
1233if test -f "/libs/version.library"; then
1234: Amiga OS
1235 _exe=""
1236elif test -f "/system/gnu_library/bin/ar.pm"; then
1237: Stratus VOS
cfb04860 1238 _exe=".pm"
6153ba32
PG
1239elif test -n "$DJGPP"; then
1240: DOS DJGPP
cfb04860 1241 _exe=".exe"
8257dec7 1242elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1243: OS/2 or cygwin
ba863942
JH
1244 _exe=".exe"
1245fi
868439a2 1246
b4eb6b3d 1247i_whoami=''
6bd2d01f
NC
1248ccname=''
1249ccversion=''
1250perllibs=''
1251: set useposix=false in your hint file to disable the POSIX extension.
1252useposix=true
1253: set useopcode=false in your hint file to disable the Opcode extension.
1254useopcode=true
1255: Trailing extension. Override this in a hint file, if needed.
1256: Extra object files, if any, needed on this platform.
1257archobjs=''
1258archname=''
ff935051
JH
1259: Possible local include directories to search.
1260: Set locincpth to "" in a hint file to defeat local include searches.
1261locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1262locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1263:
1264: no include file wanted by default
1265inclwanted=''
1266
07ddae43
NC
1267: Enable -DEBUGGING and -DDEBUGGING from the command line
1268EBUGGING=''
1269DEBUGGING=old
1270
b4eb6b3d 1271groupstype=''
64615a5e 1272libnames=''
732c9516
JH
1273: change the next line if compiling for Xenix/286 on Xenix/386
1274xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1275: Possible local library directories to search.
1276loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279: general looking path for locating libraries
5869b1f1 1280glibpth="/lib /usr/lib $xlibpth"
732c9516 1281glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1282test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1284
1285: Private path used by Configure to find libraries. Its value
1286: is prepended to libpth. This variable takes care of special
1287: machines, like the mips. Usually, it should be empty.
1288plibpth=''
1289
1cfa4ec7
GS
1290: default library list
1291libswanted=''
921b2963 1292: some systems want to use only the non-versioned libso:s
1cfa4ec7 1293ignore_versioned_solibs=''
6bd2d01f
NC
1294siteman1dir=''
1295siteman3dir=''
1296sitescript=''
b4eb6b3d
JH
1297archname64=''
1298ccflags_uselargefiles=''
1299ldflags_uselargefiles=''
1300libswanted_uselargefiles=''
1301: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1302: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1303: set usethreads on the Configure command line to enable threads.
cd040c5e 1304usereentrant='undef'
6bd2d01f
NC
1305: full support for void wanted by default
1306defvoidused=15
1307
ecfc5424 1308: List of libraries we want.
406c4b1e
JH
1309: If anyone needs extra -lxxx, put those in a hint file.
1310libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1311libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1312: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1313: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1314glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1315glibpth="/usr/shlib $glibpth"
1316: Do not use vfork unless overridden by a hint file.
1317usevfork=false
1318
8ff267be 1319: Find the basic shell for Bourne shell scripts
1320case "$sh" in
1321'')
8ff267be 1322 case "$SYSTYPE" in
1323 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1324 *) xxx='/bin/sh';;
1325 esac
1326 if test -f "$xxx"; then
1327 sh="$xxx"
1328 else
1329 : Build up a list and do a single loop so we can 'break' out.
1330 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1331 for xxx in sh bash ksh pdksh ash; do
1332 for p in $pth; do
1333 try="$try ${p}/${xxx}"
1334 done
1335 done
1336 for xxx in $try; do
1337 if test -f "$xxx"; then
1338 sh="$xxx";
8ff267be 1339 break
a5a94ea5
JH
1340 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1341 sh="$xxx";
1342 break
8ff267be 1343 elif test -f "$xxx.exe"; then
1344 sh="$xxx";
8ff267be 1345 break
1346 fi
1347 done
1348 fi
1349 ;;
1350esac
1351
1352case "$sh" in
a33c94aa 1353'') cat >&2 <<EOM
8ff267be 1354$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1355
8ff267be 1356Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1357Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1358we'll try to straighten this all out.
8ff267be 1359EOM
1360 exit 1
1361 ;;
1362esac
1363
760ac839 1364: see if sh knows # comments
73614538 1365if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1366 shsharp=true
1367 spitshell=cat
760ac839 1368 xcat=/bin/cat
a931254c
JH
1369 test -f $xcat$_exe || xcat=/usr/bin/cat
1370 if test ! -f $xcat$_exe; then
4bdb8fb5 1371 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1372 if test -f $p/cat$_exe; then
1deb0a86 1373 xcat=$p/cat
3c728e00
JH
1374 break
1375 fi
1376 done
1deb0a86
JH
1377 if test ! -f $xcat$_exe; then
1378 echo "Can't find cat anywhere!"
3c728e00
JH
1379 exit 1
1380 fi
1381 fi
5440bc8e
JH
1382 echo "#!$xcat" >sharp
1383 $eunicefix sharp
1384 chmod +x sharp
1385 ./sharp > today
760ac839 1386 if test -s today; then
760ac839
LW
1387 sharpbang='#!'
1388 else
5440bc8e
JH
1389 echo "#! $xcat" > sharp
1390 $eunicefix sharp
1391 chmod +x sharp
1392 ./sharp > today
760ac839 1393 if test -s today; then
760ac839
LW
1394 sharpbang='#! '
1395 else
760ac839
LW
1396 sharpbang=': use '
1397 fi
1398 fi
1399else
dfe9444c 1400 echo " "
8ff267be 1401 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1402 shsharp=false
1403 cd ..
1404 echo "exec grep -v '^[ ]*#'" >spitshell
1405 chmod +x spitshell
1406 $eunicefix spitshell
1407 spitshell=`pwd`/spitshell
1408 cd UU
1409 echo "I presume that if # doesn't work, #! won't work either!"
1410 sharpbang=': use '
1411fi
5440bc8e 1412rm -f sharp today
760ac839
LW
1413
1414: figure out how to guarantee sh startup
8ff267be 1415case "$startsh" in
1416'') startsh=${sharpbang}${sh} ;;
1417*)
760ac839 1418esac
5440bc8e 1419cat >sharp <<EOSS
760ac839
LW
1420$startsh
1421set abc
1422test "$?abc" != 1
1423EOSS
1424
5440bc8e
JH
1425chmod +x sharp
1426$eunicefix sharp
1427if ./sharp; then
8ff267be 1428 : echo "Yup, it does."
760ac839 1429else
dfe9444c
AD
1430 echo "Hmm... '$startsh' does not guarantee sh startup..."
1431 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1432fi
5440bc8e 1433rm -f sharp
760ac839 1434
aebf16e7
AD
1435
1436: Save command line options in file UU/cmdline.opt for later use in
1437: generating config.sh.
1438cat > cmdline.opt <<EOSH
1439# Configure command line arguments.
1440config_arg0='$0'
1441config_args='$*'
1442config_argc=$#
1443EOSH
1444argn=1
ee45ea83
IZ
1445args_exp=''
1446args_sep=''
aebf16e7
AD
1447for arg in "$@"; do
1448 cat >>cmdline.opt <<EOSH
1449config_arg$argn='$arg'
1450EOSH
ee45ea83
IZ
1451 # Extreme backslashitis: replace each ' by '"'"'
1452 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1453$arg
1454EOC
1455 arg_exp=`cat cmdl.opt`
1456 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1457 argn=`expr $argn + 1`
ee45ea83 1458 args_sep=' '
aebf16e7 1459done
ee45ea83
IZ
1460# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1461# used by ./hints/os2.sh
1462rm -f cmdl.opt
aebf16e7 1463
2304df62
AD
1464: produce awk script to parse command line options
1465cat >options.awk <<'EOF'
1466BEGIN {
02e93a22 1467 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1468
1469 len = length(optstr);
1470 for (i = 1; i <= len; i++) {
1471 c = substr(optstr, i, 1);
1472 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1473 if (a == ":") {
1474 arg[c] = 1;
1475 i++;
1476 }
1477 opt[c] = 1;
1478 }
1479}
1480{
1481 expect = 0;
1482 str = $0;
1483 if (substr(str, 1, 1) != "-") {
1484 printf("'%s'\n", str);
1485 next;
1486 }
1487 len = length($0);
1488 for (i = 2; i <= len; i++) {
1489 c = substr(str, i, 1);
1490 if (!opt[c]) {
1491 printf("-%s\n", substr(str, i));
1492 next;
1493 }
1494 printf("-%s\n", c);
1495 if (arg[c]) {
1496 if (i < len)
1497 printf("'%s'\n", substr(str, i + 1));
1498 else
1499 expect = 1;
1500 next;
1501 }
1502 }
1503}
1504END {
1505 if (expect)
1506 print "?";
1507}
1508EOF
1509
1510: process the command line options
4633a7c4
LW
1511set X `for arg in "$@"; do echo "X$arg"; done |
1512 sed -e s/X// | awk -f options.awk`
2304df62
AD
1513eval "set $*"
1514shift
1515rm -f options.awk
1516
1517: set up default values
1518fastread=''
1519reuseval=false
1520config_sh=''
1521alldone=''
1522error=''
1523silent=''
1524extractsh=''
ecfc5424 1525override=''
16d20bd9 1526knowitall=''
02e93a22 1527rm -f optdef.sh posthint.sh
28757baa 1528cat >optdef.sh <<EOS
1529$startsh
1530EOS
2304df62 1531
dfe9444c 1532
2304df62
AD
1533: option parsing
1534while test $# -gt 0; do
1535 case "$1" in
1536 -d) shift; fastread=yes;;
1537 -e) shift; alldone=cont;;
1538 -f)
1539 shift
1540 cd ..
1541 if test -r "$1"; then
1542 config_sh="$1"
1543 else
a0d0e21e 1544 echo "$me: cannot read config file $1." >&2
2304df62
AD
1545 error=true
1546 fi
1547 cd UU
1548 shift;;
1549 -h) shift; error=true;;
1550 -r) shift; reuseval=true;;
dfe9444c 1551 -s) shift; silent=true; realsilent=true;;
2304df62 1552 -E) shift; alldone=exit;;
16d20bd9 1553 -K) shift; knowitall=true;;
ecfc5424 1554 -O) shift; override=true;;
dfe9444c 1555 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1556 -D)
1557 shift
1558 case "$1" in
1559 *=)
1560 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1561 echo "$me: ignoring -D $1" >&2
1562 ;;
ecfc5424 1563 *=*) echo "$1" | \
1aef975c
AD
1564 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1565 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1566 esac
1567 shift
1568 ;;
1569 -U)
1570 shift
1571 case "$1" in
1aef975c 1572 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1573 *=*)
1574 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1575 echo "$me: ignoring -U $1" >&2
1576 ;;
1aef975c 1577 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1578 esac
1579 shift
1580 ;;
02e93a22
JH
1581 -A)
1582 shift
1583 xxx=''
1584 yyy="$1"
02e93a22 1585 zzz=''
5f83a3e9 1586 uuu=undef
02e93a22 1587 case "$yyy" in
f7c31117 1588 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1589 case "$zzz" in
1590 *:*) zzz='' ;;
1591 *) xxx=append
f7c31117
JH
1592 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1593 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1594 esac
1595 ;;
1596 esac
1597 case "$xxx" in
1598 '') case "$yyy" in
f7c31117
JH
1599 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1600 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1601 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1602 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1603 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1604 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1605 esac
1606 ;;
1607 esac
02e93a22
JH
1608 case "$xxx" in
1609 append)
5f83a3e9 1610 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1611 clear)
5f83a3e9 1612 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1613 define)
1614 case "$zzz" in
1615 '') zzz=define ;;
1616 esac
5f83a3e9 1617 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1618 eval)
5f83a3e9 1619 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1620 prepend)
5f83a3e9 1621 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1622 undef)
1623 case "$zzz" in
1624 '') zzz="$uuu" ;;
1625 esac
5f83a3e9
JH
1626 echo "$yyy=$zzz" >> posthint.sh ;;
1627 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1628 esac
bde6b06b 1629 shift
02e93a22 1630 ;;
dfe9444c 1631 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1632 exit 0;;
2304df62 1633 --) break;;
a0d0e21e 1634 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1635 *) break;;
1636 esac
1637done
1638
1639case "$error" in
1640true)
1641 cat >&2 <<EOM
2afac517 1642Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1643 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1644 -d : use defaults for all answers.
1645 -e : go on without questioning past the production of config.sh.
1646 -f : specify an alternate default configuration file.
1647 -h : print this help message and exit (with an error status).
1648 -r : reuse C symbols value if possible (skips costly nm extraction).
1649 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1650 -D : define symbol to have some value:
1651 -D symbol symbol gets the value 'define'
1652 -D symbol=value symbol gets the value 'value'
2304df62 1653 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1654 -K : do not use unless you know what you are doing.
ecfc5424 1655 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1656 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1657 -U : undefine symbol:
1658 -U symbol symbol gets the value 'undef'
1659 -U symbol= symbol gets completely empty
02e93a22 1660 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1661 -A symbol=value append " "value to symbol
02e93a22
JH
1662 -A append:symbol=value append value to symbol
1663 -A define:symbol=value define symbol to have value
02e93a22
JH
1664 -A clear:symbol define symbol to be ''
1665 -A define:symbol define symbol to be 'define'
1666 -A eval:symbol=value define symbol to be eval of value
1667 -A prepend:symbol=value prepend value to symbol
1668 -A undef:symbol define symbol to be 'undef'
1669 -A undef:symbol= define symbol to be ''
2304df62
AD
1670 -V : print version number and exit (with a zero status).
1671EOM
1672 exit 1
1673 ;;
1674esac
1675
dfe9444c
AD
1676: Sanity checks
1677case "$fastread$alldone" in
1678yescont|yesexit) ;;
1679*)
aaeb8e51
GS
1680 case "$extractsh" in
1681 true) ;;
1682 *)
1683 if test ! -t 0; then
1684 echo "Say 'sh Configure', not 'sh <Configure'"
1685 exit 1
1686 fi
1687 ;;
1688 esac
dfe9444c
AD
1689 ;;
1690esac
1691
2304df62
AD
1692exec 4>&1
1693case "$silent" in
1694true) exec 1>/dev/null;;
1695esac
1696
ecfc5424 1697: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1698touch optdef.sh
1699. ./optdef.sh
02e93a22
JH
1700: create the posthint manipulation script and leave the file out there...
1701touch posthint.sh
a0d0e21e 1702
2304df62 1703: set package name
85e6fe83 1704package=perl5
b4eb6b3d
JH
1705first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1706last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1707case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1708ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1709*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1710esac
2304df62 1711
2304df62
AD
1712: Some greps do not return status, grrr.
1713echo "grimblepritz" >grimble
1714if grep blurfldyick grimble >/dev/null 2>&1 ; then
1715 contains=contains
1716elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1717 contains=grep
1718else
1719 contains=contains
1720fi
1721rm -f grimble
1722: the following should work in any shell
1723case "$contains" in
1724contains*)
1725 echo " "
1726 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1727 cat >contains <<'EOSS'
1728grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1729EOSS
1730chmod +x contains
1731esac
1732
dfe9444c
AD
1733: Find the path to the source tree
1734case "$src" in
1735'') case "$0" in
b233458b
JH
1736 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1737 case "$src" in
1738 /*) ;;
8504afb7 1739 .) ;;
b233458b
JH
1740 *) src=`cd ../$src && pwd` ;;
1741 esac
1742 ;;
dfe9444c
AD
1743 *) src='.';;
1744 esac;;
1745esac
1746case "$src" in
1747'') src=/
1748 rsrc=/
1749 ;;
1750/*) rsrc="$src";;
1751*) rsrc="../$src";;
1752esac
1753if test -f $rsrc/Configure && \
1754 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1755then
1756 : found it, so we are ok.
1757else
1758 rsrc=''
1759 for src in . .. ../.. ../../.. ../../../..; do
1760 if test -f ../$src/Configure && \
1761 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1762 then
1763 rsrc=../$src
1764 break
1765 fi
1766 done
1767fi
1768case "$rsrc" in
1769'')
1770 cat <<EOM >&4
1771
1772Sorry, I can't seem to locate the source dir for $package. Please start
1773Configure with an explicit path -- i.e. /some/path/Configure.
1774
1775EOM
1776 exit 1
1777 ;;
1778../.) rsrc='..';;
1779*)
1780 echo " "
1781 echo "Sources for $package found in \"$src\"." >&4
1782 ;;
1783esac
1784
1785: script used to extract .SH files with variable substitutions
1786cat >extract <<'EOS'
a02608de 1787PERL_CONFIG_SH=true
dfe9444c 1788echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1789if test -f MANIFEST; then
1790 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1791else
1792 echo "(Looking for .SH files under the source directory.)"
6904989c 1793 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1794fi
1795shift
1796case $# in
6904989c 17970) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1798esac
6904989c 1799if test ! -f "$src/$1"; then
dfe9444c
AD
1800 shift
1801fi
1802mkdir_p='
1803name=$1;
1804create="";
1805while test $name; do
1806 if test ! -d "$name"; then
1807 create="$name $create";
1808 name=`echo $name | sed -e "s|^[^/]*$||"`;
1809 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1810 else
1811 name="";
1812 fi;
1813done;
1814for file in $create; do
1815 mkdir $file;
1816done
1817'
1818for file in $*; do
1819 case "$src" in
1820 ".")
1821 case "$file" in
1822 */*)
1823 dir=`expr X$file : 'X\(.*\)/'`
1824 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1825 (cd "$dir" && . ./$file)
dfe9444c
AD
1826 ;;
1827 *)
1828 . ./$file
1829 ;;
1830 esac
1831 ;;
1832 *)
1833 case "$file" in
1834 */*)
1835 dir=`expr X$file : 'X\(.*\)/'`
1836 file=`expr X$file : 'X.*/\(.*\)'`
1837 (set x $dir; shift; eval $mkdir_p)
6904989c 1838 sh <"$src/$dir/$file"
dfe9444c
AD
1839 ;;
1840 *)
6904989c 1841 sh <"$src/$file"
dfe9444c
AD
1842 ;;
1843 esac
1844 ;;
1845 esac
1846done
6904989c 1847if test -f "$src/config_h.SH"; then
dfe9444c
AD
1848 if test ! -f config.h; then
1849 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1850 . "$src/config_h.SH"
dfe9444c
AD
1851 fi
1852fi
1853EOS
1854
1855: extract files and exit if asked to do so
1856case "$extractsh" in
1857true)
1858 case "$realsilent" in
1859 true) ;;
1860 *) exec 1>&4;;
1861 esac
1862 case "$config_sh" in
1863 '') config_sh='config.sh';;
1864 esac
1865 echo " "
1866 echo "Fetching answers from $config_sh..."
1867 cd ..
1868 . $config_sh
1869 test "$override" && . ./optdef.sh
1870 echo " "
1871 . UU/extract
1872 rm -rf UU
24ccb310 1873 echo "Extraction done."
dfe9444c
AD
1874 exit 0
1875 ;;
1876esac
1877
1878: Eunice requires " " instead of "", can you believe it
1879echo " "
1880: Here we go...
1881echo "Beginning of configuration questions for $package."
1882
1883trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1884
2304df62
AD
1885: first determine how to suppress newline on echo command
1886echo " "
1887echo "Checking echo to see how to suppress newlines..."
1888(echo "hi there\c" ; echo " ") >.echotmp
1889if $contains c .echotmp >/dev/null 2>&1 ; then
1890 echo "...using -n."
1891 n='-n'
1892 c=''
1893else
1894 cat <<'EOM'
1895...using \c
1896EOM
1897 n=''
1898 c='\c'
1899fi
1900echo $n "The star should be here-->$c"
1901echo '*'
1902rm -f .echotmp
1903
1904: Now test for existence of everything in MANIFEST
1905echo " "
6904989c 1906if test -f "$rsrc/MANIFEST"; then
2304df62 1907 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1908 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1909 rm -f missing
dfe9444c 1910 tmppwd=`pwd`
2304df62 1911 for filelist in x??; do
6904989c 1912 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1913 done
1914 if test -s missing; then
1915 cat missing >&4
1916 cat >&4 <<'EOM'
1917
1918THIS PACKAGE SEEMS TO BE INCOMPLETE.
1919
1920You have the option of continuing the configuration process, despite the
1921distinct possibility that your kit is damaged, by typing 'y'es. If you
1922do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1923and contact the author (perlbug@perl.org).
2304df62
AD
1924
1925EOM
1926 echo $n "Continue? [n] $c" >&4
1927 read ans
1928 case "$ans" in
1929 y*)
1930 echo "Continuing..." >&4
1931 rm -f missing
1932 ;;
1933 *)
1934 echo "ABORTING..." >&4
1935 kill $$
1936 ;;
1937 esac
1938 else
dfe9444c 1939 echo "Looks good..."
2304df62
AD
1940 fi
1941else
1942 echo "There is no MANIFEST file. I hope your kit is complete !"
1943fi
1944rm -f missing x??
1945
5ff3f7a4
GS
1946echo " "
1947: Find the appropriate value for a newline for tr
1948if test -n "$DJGPP"; then
1949 trnl='\012'
1950fi
1951if test X"$trnl" = X; then
1952 case "`echo foo|tr '\n' x 2>/dev/null`" in
1953 foox) trnl='\n' ;;
1954 esac
1955fi
1956if test X"$trnl" = X; then
1957 case "`echo foo|tr '\012' x 2>/dev/null`" in
1958 foox) trnl='\012' ;;
1959 esac
1960fi
1961if test X"$trnl" = X; then
8be2c24c
JH
1962 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1963 fooxy) trnl='\n\r' ;;
1964 esac
1965fi
1966if test X"$trnl" = X; then
5ff3f7a4
GS
1967 cat <<EOM >&2
1968
1969$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1970
1971EOM
1972 exit 1
1973fi
1974
2304df62
AD
1975: compute the number of columns on the terminal for proper question formatting
1976case "$COLUMNS" in
1977'') COLUMNS='80';;
1978esac
1979
1980: set up the echo used in my read
1981myecho="case \"\$xxxm\" in
1982'') echo $n \"\$rp $c\" >&4;;
1983*) case \"\$rp\" in
1984 '') echo $n \"[\$xxxm] $c\";;
1985 *)
1986 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1987 echo \"\$rp\" >&4
1988 echo $n \"[\$xxxm] $c\" >&4
1989 else
1990 echo $n \"\$rp [\$xxxm] $c\" >&4
1991 fi
1992 ;;
1993 esac;;
1994esac"
1995
1996: now set up to do reads with possible shell escape and default assignment
1997cat <<EOSC >myread
28757baa 1998$startsh
2304df62
AD
1999xxxm=\$dflt
2000$myecho
2001ans='!'
2002case "\$fastread" in
2003yes) case "\$dflt" in
2004 '') ;;
2005 *) ans='';
2006 case "\$silent-\$rp" in
2007 true-) ;;
2008 *) echo " " >&4;;
2009 esac;;
2010 esac;;
2011*) case "\$silent" in
2012 true) case "\$rp" in
2013 '') ans='';;
2014 esac;;
2015 esac;;
2016esac
2017while expr "X\$ans" : "X!" >/dev/null; do
2018 read answ
2019 set x \$xxxm
2020 shift
dfe9444c 2021 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2022 case "\$answ" in
dfe9444c
AD
2023 "!")
2024 sh 1>&4
2025 echo " "
2026 $myecho
2027 ;;
2028 !*)
2029 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2030 shift
2031 sh 1>&4 -c "\$*"
2032 echo " "
2033 $myecho
2034 ;;
2304df62
AD
2035 "\$ans")
2036 case "\$ans" in
ecfc5424
AD
2037 \\&*)
2038 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2039 shift
2040 case "\$1" in
2041 -d)
2042 fastread=yes
40a7a20a 2043 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2044 ;;
2045 -*)
40a7a20a 2046 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2047 ;;
2048 esac
2049 $myecho
2050 ans=!
2051 ;;
2304df62
AD
2052 esac;;
2053 *)
2054 case "\$aok" in
2055 y)
2056 echo "*** Substitution done -- please confirm."
2057 xxxm="\$ans"
c9795ab7 2058 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2059 xxxm="\$ans"
2060 ans=!
2061 ;;
2062 *)
2063 echo "*** Error -- try again."
2064 ans=!
2065 ;;
2066 esac
2067 $myecho
2068 ;;
2069 esac
2070 case "\$ans\$xxxm\$nostick" in
2071 '')
2072 ans=!
2073 $myecho
2074 ;;
2075 esac
2076done
2077case "\$ans" in
2078'') ans="\$xxxm";;
2079esac
2080EOSC
2081
2082: create .config dir to save info across Configure sessions
2083test -d ../.config || mkdir ../.config
2084cat >../.config/README <<EOF
2085This directory created by Configure to save information that should
dfe9444c 2086persist across sessions for $package.
2304df62
AD
2087
2088You may safely delete it if you wish.
2089EOF
2090
9507cadf 2091xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2092case "$usedevel" in
0107c034 2093$define|true|[yY]*) ;;
9507cadf 2094*) case "$xversion" in
0107c034
JH
2095 *[13579])
2096 cat >&4 <<EOH
2097*** WHOA THERE!!! ***
2098
2099 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2100 The version of this $package distribution is $xversion, that is, odd,
2101 (as opposed to even) and that signifies a development release.
3d5d58b1 2102 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2103
2104 Do ***NOT*** install this into production use.
2105 Data corruption and crashes are possible.
2106
2107 It is most seriously suggested that you do not continue any further
2108 unless you want to help in developing and debugging Perl.
2109
6adc6a45
JH
2110 If you *still* want to build perl, you can answer 'y' now,
2111 or pass -Dusedevel to Configure.
2112
0107c034
JH
2113EOH
2114 rp='Do you really want to continue?'
2115 dflt='n'
2116 . ./myread
2117 case "$ans" in
8feeef0e
JH
2118 [yY]) echo >&4 "Okay, continuing."
2119 usedevel="$define" ;;
0107c034
JH
2120 *) echo >&4 "Okay, bye."
2121 exit 1
2122 ;;
2123 esac
2124 ;;
2125 esac
2126 ;;
2127esac
8feeef0e
JH
2128case "$usedevel" in
2129$define|true|[yY]*)
2130 case "$versiononly" in
2131 '') versiononly="$define" ;;
2132 esac
2133 case "$installusrbinperl" in
2134 '') installusrbinperl="$undef" ;;
2135 esac
2136 ;;
2137esac
0107c034 2138
2304df62
AD
2139: general instructions
2140needman=true
2141firsttime=true
760ac839 2142user=`(logname) 2>/dev/null`
dfe9444c
AD
2143case "$user" in
2144'') user=`whoami 2>&1`;;
760ac839 2145esac
2304df62
AD
2146if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2147 firsttime=false
2148 echo " "
2149 rp='Would you like to see the instructions?'
2150 dflt=n
2151 . ./myread
2152 case "$ans" in
2153 [yY]*) ;;
2154 *) needman=false;;
2155 esac
2156fi
2157if $needman; then
2158 cat <<EOH
4e2a5f63 2159
2304df62 2160This installation shell script will examine your system and ask you questions
a0d0e21e 2161to determine how the perl5 package should be installed. If you get
2304df62
AD
2162stuck on a question, you may use a ! shell escape to start a subshell or
2163execute a command. Many of the questions will have default answers in square
2164brackets; typing carriage return will give you the default.
2165
2166On some of the questions which ask for file or directory names you are allowed
2167to use the ~name construct to specify the login directory belonging to "name",
2168even if you don't have a shell which knows about that. Questions where this is
2169allowed will be marked "(~name ok)".
2170
2171EOH
2172 rp=''
2173 dflt='Type carriage return to continue'
2174 . ./myread
2175 cat <<'EOH'
2176
2177The prompter used in this script allows you to use shell variables and
2178backticks in your answers. You may use $1, $2, etc... to refer to the words
2179in the default answer, as if the default line was a set of arguments given to a
2180script shell. This means you may also use $* to repeat the whole default line,
2181so you do not have to re-type everything to add something to the default.
2182
2183Everytime there is a substitution, you will have to confirm. If there is an
2184error (e.g. an unmatched backtick), the default answer will remain unchanged
2185and you will be prompted again.
2186
2187If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2188the questions and use the computed defaults (or the previous answers if there
2189was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2190You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2191on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2192
2193EOH
2194 . ./myread
2195 cat <<EOH
2196
2197Much effort has been expended to ensure that this shell script will run on any
2198Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2199Configure and run it again. If you can't run Configure for some reason,
2200you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2201have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2202
2203This installation script affects things in two ways:
2204
22051) it may do direct variable substitutions on some of the files included
2206 in this kit.
22072) it builds a config.h file for inclusion in C programs. You may edit
2208 any of these files as the need arises after running this script.
2209
2210If you make a mistake on a question, there is no easy way to back up to it
2211currently. The easiest thing to do is to edit config.sh and rerun all the SH
2212files. Configure will offer to let you do this before it runs the SH files.
2213
2214EOH
2215 dflt='Type carriage return to continue'
2216 . ./myread
2217 case "$firsttime" in
2218 true) echo $user >>../.config/instruct;;
2219 esac
2220fi
2221
2304df62
AD
2222: find out where common programs are
2223echo " "
2224echo "Locating common programs..." >&4
2225cat <<EOSC >loc
2226$startsh
2227case \$# in
22280) exit 1;;
2229esac
2230thing=\$1
2231shift
2232dflt=\$1
2233shift
2234for dir in \$*; do
2235 case "\$thing" in
2236 .)
2237 if test -d \$dir/\$thing; then
2238 echo \$dir
2239 exit 0
2240 fi
2241 ;;
2242 *)
a0d0e21e 2243 for thisthing in \$dir/\$thing; do
ecfc5424 2244 : just loop through to pick last item
a0d0e21e 2245 done
25f94b33 2246 if test -f \$thisthing; then
a0d0e21e 2247 echo \$thisthing
2304df62 2248 exit 0
a5a94ea5
JH
2249 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2250 echo \$thisthing
2251 exit 0
2304df62 2252 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2253 if test -n "$DJGPP"; then
2254 echo \$dir/\$thing.exe
5b7ea690 2255 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2256 : on Eunice apparently
2257 echo \$dir/\$thing
5b7ea690 2258 exit 0
c4f23d77 2259 fi
2d736872 2260 exit 0
2304df62
AD
2261 fi
2262 ;;
2263 esac
2264done
2265echo \$dflt
2266exit 1
2267EOSC
2268chmod +x loc
2269$eunicefix loc
2270loclist="
2271awk
2272cat
f8006fac 2273chmod
b4eb6b3d
JH
2274comm
2275cp
2304df62
AD
2276echo
2277expr
2278grep
a0d0e21e 2279ls
b4eb6b3d 2280mkdir
2304df62
AD
2281rm
2282sed
b4eb6b3d 2283sort
85e6fe83 2284touch
2304df62 2285tr
b4eb6b3d 2286uniq
2304df62
AD
2287"
2288trylist="
2289Mcc
dfe9444c 2290ar
3659ebf1 2291bison
b4eb6b3d 2292byacc
2304df62 2293cpp
b4eb6b3d 2294csh
2304df62
AD
2295date
2296egrep
1fef16b3 2297gmake
8ff267be 2298gzip
b4eb6b3d 2299less
8ff267be 2300ln
3c728e00 2301make
b4eb6b3d 2302more
693762b4 2303nm
b4eb6b3d
JH
2304nroff
2305pg
2304df62
AD
2306test
2307uname
8ff267be 2308zip
2304df62 2309"
8e07c86e 2310pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2311pth="$pth /lib /usr/lib"
2312for file in $loclist; do
dfe9444c
AD
2313 eval xxx=\$$file
2314 case "$xxx" in
2315 /*|?:[\\/]*)
2316 if test -f "$xxx"; then
2317 : ok
2318 else
2319 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2320 xxx=`./loc $file $file $pth`
2321 fi
2322 ;;
2323 '') xxx=`./loc $file $file $pth`;;
2324 *) xxx=`./loc $xxx $xxx $pth`;;
2325 esac
a5a94ea5 2326 eval $file=$xxx$_exe
2304df62
AD
2327 eval _$file=$xxx
2328 case "$xxx" in
2329 /*)
2330 echo $file is in $xxx.
2331 ;;
8e07c86e
AD
2332 ?:[\\/]*)
2333 echo $file is in $xxx.
2334 ;;
2304df62 2335 *)
25f94b33
AD
2336 echo "I don't know where '$file' is, and my life depends on it." >&4
2337 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2338 exit 1
2304df62
AD
2339 ;;
2340 esac
2341done
2342echo " "
2343echo "Don't worry if any of the following aren't found..."
2344say=offhand
2345for file in $trylist; do
dfe9444c
AD
2346 eval xxx=\$$file
2347 case "$xxx" in
2348 /*|?:[\\/]*)
2349 if test -f "$xxx"; then
2350 : ok
2351 else
2352 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2353 xxx=`./loc $file $file $pth`
2354 fi
2355 ;;
2356 '') xxx=`./loc $file $file $pth`;;
2357 *) xxx=`./loc $xxx $xxx $pth`;;
2358 esac
306a8474 2359 eval $file=$xxx$_exe
2304df62
AD
2360 eval _$file=$xxx
2361 case "$xxx" in
2362 /*)
2363 echo $file is in $xxx.
2364 ;;
8e07c86e
AD
2365 ?:[\\/]*)
2366 echo $file is in $xxx.
2367 ;;
2304df62
AD
2368 *)
2369 echo "I don't see $file out there, $say."
2370 say=either
2371 ;;
2372 esac
2373done
2374case "$egrep" in
1fef16b3 2375egrep)
2304df62
AD
2376 echo "Substituting grep for egrep."
2377 egrep=$grep
868439a2 2378 _egrep=$grep
2304df62
AD
2379 ;;
2380esac
8ff267be 2381case "$ln" in
1fef16b3 2382ln)
8ff267be 2383 echo "Substituting cp for ln."
2384 ln=$cp
868439a2 2385 _ln=$cp
8ff267be 2386 ;;
2387esac
2e26f1d5
JH
2388case "$make" in
2389make)
2390 case "$gmake" in
2391 gmake)
2392 echo "I can't find make or gmake, and my life depends on it." >&4
2393 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2394 exit 1
2395 ;;
2396 esac
2397 ;;
2398esac
2399case "$gmake" in
2400gmake) ;;
2401*) # We can't have osname yet.
1fef16b3
JH
2402 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2403 # Assume that gmake, if found, is definitely GNU make
2404 # and prefer it over the system make.
2405 echo "Substituting gmake for make."
2406 make=$gmake
868439a2 2407 _make=$gmake
1fef16b3
JH
2408 fi
2409 ;;
a5a94ea5 2410esac
2304df62
AD
2411case "$test" in
2412test)
2413 echo "Hopefully test is built into your sh."
2414 ;;
2415*)
73614538 2416 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2417 echo "Using the test built into your sh."
2304df62
AD
2418 test=test
2419 _test=test
2420 fi
2421 ;;
2422esac
2423case "$echo" in
2424echo)
2425 echo "Hopefully echo is built into your sh."
2426 ;;
2427'') ;;
2428*)
2429 echo " "
2430echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2431 $echo $n "hi there$c" >foo1
2432 echo $n "hi there$c" >foo2
2433 if cmp foo1 foo2 >/dev/null 2>&1; then
2434 echo "They are compatible. In fact, they may be identical."
2435 else
2436 case "$n" in
2437 '-n') n='' c='\c';;
2438 *) n='-n' c='';;
2439 esac
2440 cat <<FOO
2441They are not compatible! You are probably running ksh on a non-USG system.
2442I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2443have echo built in and we may have to run some Bourne shell scripts. That
2444means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2445
2446FOO
2447 $echo $n "The star should be here-->$c"
2448 $echo "*"
2449 fi
2450 $rm -f foo1 foo2
2451 ;;
2452esac
2453
6b769f8f 2454cat <<EOS >trygcc
2573c5f9
JH
2455$startsh
2456EOS
6b769f8f 2457cat <<'EOSC' >>trygcc
2573c5f9
JH
2458case "$cc" in
2459'') ;;
2460*) $rm -f try try.*
2461 $cat >try.c <<EOM
2462int main(int argc, char *argv[]) {
2463 return 0;
2464}
2465EOM
e4778687 2466 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2467 :
2468 else
2469 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2470 despair=yes
2471 trygcc=yes
2472 case "$cc" in
2473 *gcc*) trygcc=no ;;
2474 esac
2475 case "`$cc -v -c try.c 2>&1`" in
2476 *gcc*) trygcc=no ;;
2477 esac
2478 if $test X"$trygcc" = Xyes; then
2479 if gcc -o try -c try.c; then
2480 echo " "
2481 echo "You seem to have a working gcc, though." >&4
2482 rp="Would you like to use it?"
2483 dflt=y
2484 if $test -f myread; then
2485 . ./myread
2486 else
2487 if $test -f UU/myread; then
2488 . ./UU/myread
2489 else
2490 echo "Cannot find myread, sorry. Aborting." >&2
2491 exit 1
2492 fi
2493 fi
2494 case "$ans" in
6371411c
RB
2495 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2496 if $test -f usethreads.cbu; then
2497 $cat >&4 <<EOM
2498
2499*** However, any setting of the C compiler flags (e.g. for thread support)
2500*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2501*** (together with e.g. -Dusethreads).
2502
2503EOM
2504 fi;;
2573c5f9
JH
2505 esac
2506 fi
2507 fi
6b769f8f
RB
2508 fi
2509 $rm -f try try.*
2510 ;;
2511esac
2512EOSC
2513
2514cat <<EOS >checkcc
2515$startsh
2516EOS
2517cat <<'EOSC' >>checkcc
2518case "$cc" in
2519'') ;;
2520*) $rm -f try try.*
2521 $cat >try.c <<EOM
2522int main(int argc, char *argv[]) {
2523 return 0;
2524}
2525EOM
2526 if $cc -o try $ccflags $ldflags try.c; then
2527 :
2528 else
2573c5f9 2529 if $test X"$despair" = Xyes; then
6b769f8f
RB
2530 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2531 fi
2532 $cat >&4 <<EOM
5dd4fbdf
MB
2533You need to find a working C compiler.
2534Either (purchase and) install the C compiler supplied by your OS vendor,
2535or for a free C compiler try http://gcc.gnu.org/
2536I cannot continue any further, aborting.
2537EOM
6b769f8f 2538 exit 1
2573c5f9
JH
2539 fi
2540 $rm -f try try.*
2541 ;;
2542esac
2543EOSC
2544
a0d0e21e
LW
2545: determine whether symbolic links are supported
2546echo " "
2547$touch blurfl
2548if $ln -s blurfl sym > /dev/null 2>&1 ; then
2549 echo "Symbolic links are supported." >&4
818f00be 2550 lns="$ln -s"
a0d0e21e
LW
2551else
2552 echo "Symbolic links are NOT supported." >&4
2553 lns="$ln"
2554fi
2555$rm -f blurfl sym
2556
dafca956
JH
2557: determine whether symbolic links are supported
2558echo " "
2559case "$lns" in
18ea2752 2560*"ln"*" -s")
dafca956
JH
2561 echo "Checking how to test for symbolic links..." >&4
2562 $lns blurfl sym
4b661809 2563 if $test "X$issymlink" = X; then
2e2a97a6
JH
2564 case "$newsh" in
2565 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2567 esac
5d644a95
MB
2568 if test $? = 0; then
2569 issymlink="test -h"
2e2a97a6
JH
2570 else
2571 echo "Your builtin 'test -h' may be broken." >&4
2572 case "$test" in
2573 /*) ;;
2574 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2575 for p in $pth
2576 do
2577 if test -f "$p/$test"; then
2578 test="$p/$test"
2579 break
2580 fi
2581 done
2582 ;;
2583 esac
2584 case "$test" in
2585 /*)
2586 echo "Trying external '$test -h'." >&4
2587 issymlink="$test -h"
2588 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2589 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2590 issymlink=''
2591 fi
2592 ;;
2593 *) issymlink='' ;;
2594 esac
5d644a95
MB
2595 fi
2596 fi
4b661809 2597 if $test "X$issymlink" = X; then
dafca956 2598 if $test -L sym 2>/dev/null; then
5d644a95 2599 issymlink="$test -L"
2e2a97a6 2600 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2601 fi
2602 fi
4b661809 2603 if $test "X$issymlink" != X; then
5d644a95 2604 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2605 else
2606 echo "I do not know how you can test for symbolic links." >&4
2607 fi
2608 $rm -f blurfl sym
2609 ;;
2610*) echo "No symbolic links, so not testing for their testing..." >&4
2611 ;;
2612esac
2613echo " "
2614
2615
2616case "$mksymlinks" in
2617$define|true|[yY]*)
2618 case "$src" in
2619 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2620 exit 1
2621 ;;
4b661809 2622 *) case "$lns:$issymlink" in
f314eb9f 2623 *"ln"*" -s:"*"test -"?)
dafca956
JH
2624 echo "Creating the symbolic links..." >&4
2625 echo "(First creating the subdirectories...)" >&4
2626 cd ..
2627 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2628 read directory
2629 test -z "$directory" && break
2630 mkdir -p $directory
2631 done
2632 # Sanity check 1.
2633 if test ! -d t/base; then
2634 echo "Failed to create the subdirectories. Aborting." >&4
2635 exit 1
2636 fi
2637 echo "(Then creating the symlinks...)" >&4
2638 awk '{print $1}' $src/MANIFEST | while true; do
2639 read filename
2640 test -z "$filename" && break
2641 if test -f $filename; then
5d644a95 2642 if $issymlink $filename; then
dafca956
JH
2643 rm -f $filename
2644 fi
2645 fi
2646 if test -f $filename; then
2647 echo "$filename already exists, not symlinking."
2648 else
2649 ln -s $src/$filename $filename
2650 fi
2651 done
2652 # Sanity check 2.
a0d24b8a
JH
2653 if test ! -f t/base/lex.t; then
2654 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2655 exit 1
2656 fi
2657 cd UU
2658 ;;
2659 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2660 ;;
2661 esac
2662 ;;
2663 esac
2664 ;;
2665esac
2666
5440bc8e
JH
2667
2668case "$usecrosscompile" in
2669$define|true|[yY]*)
93bc48fa 2670 $echo "Cross-compiling..."
5440bc8e
JH
2671 croak=''
2672 case "$cc" in
2673 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2674 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2675 ar=$targetarch-ar
2676 # leave out ld, choosing it is more complex
2677 nm=$targetarch-nm
2678 ranlib=$targetarch-ranlib
93bc48fa 2679 $echo 'extern int foo;' > try.c
f8006fac 2680 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2681 shift
2682 if $test $# -gt 0; then
2683 incpth="$incpth $*"
f8006fac
JH
2684 incpth="`$echo $incpth|$sed 's/^ //'`"
2685 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2686 for i in $*; do
f8006fac 2687 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2688 if $test -d $j; then
2689 libpth="$libpth $j"
2690 fi
2691 done
f8006fac
JH
2692 libpth="`$echo $libpth|$sed 's/^ //'`"
2693 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2694 fi
2695 $rm -f try.c
5440bc8e
JH
2696 ;;
2697 esac
2698 case "$targetarch" in
93bc48fa
JH
2699 '') echo "Targetarch not defined." >&4; croak=y ;;
2700 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2701 esac
2702 case "$incpth" in
93bc48fa 2703 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2704 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2705 esac
2706 case "$libpth" in
93bc48fa 2707 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2708 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2709 esac
93bc48fa
JH
2710 case "$usrinc" in
2711 '') for i in $incpth; do
2712 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2713 usrinc=$i
2714 echo "Guessing usrinc $usrinc." >&4
2715 break
2716 fi
2717 done
2718 case "$usrinc" in
2719 '') echo "Usrinc not defined." >&4; croak=y ;;
2720 esac
2721 ;;
2722 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2723 esac
93bc48fa
JH
2724 case "$targethost" in
2725 '') echo "Targethost not defined." >&4; croak=y ;;
2726 *) echo "Using targethost $targethost." >&4
5440bc8e 2727 esac
93bc48fa
JH
2728 locincpth=' '
2729 loclibpth=' '
5440bc8e 2730 case "$croak" in
93bc48fa 2731 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2732 esac
2733 case "$src" in
2734 /*) run=$src/Cross/run
93c0359c 2735 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2736 to=$src/Cross/to
2737 from=$src/Cross/from
2738 ;;
93bc48fa 2739 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2740 run=$pwd/Cross/run
f8006fac 2741 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2742 to=$pwd/Cross/to
2743 from=$pwd/Cross/from
2744 ;;
2745 esac
2746 case "$targetrun" in
2747 '') targetrun=ssh ;;
2748 esac
2749 case "$targetto" in
2750 '') targetto=scp ;;
2751 esac
2752 case "$targetfrom" in
2753 '') targetfrom=scp ;;
2754 esac
2755 run=$run-$targetrun
2756 to=$to-$targetto
2757 from=$from-$targetfrom
93bc48fa
JH
2758 case "$targetdir" in
2759 '') targetdir=/tmp
2760 echo "Guessing targetdir $targetdir." >&4
2761 ;;
2762 esac
5440bc8e 2763 case "$targetuser" in
93bc48fa
JH
2764 '') targetuser=root
2765 echo "Guessing targetuser $targetuser." >&4
2766 ;;
5440bc8e
JH
2767 esac
2768 case "$targetfrom" in
2769 scp) q=-q ;;
2770 *) q='' ;;
2771 esac
2772 case "$targetrun" in
2773 ssh|rsh)
2774 cat >$run <<EOF
2775#!/bin/sh
93c0359c
JH
2776case "\$1" in
2777-cwd)
2778 shift
2779 cwd=\$1
2780 shift
2781 ;;
2782esac
2783case "\$cwd" in
2784'') cwd=$targetdir ;;
2785esac
5440bc8e
JH
2786exe=\$1
2787shift
93c0359c
JH
2788if $test ! -f \$exe.xok; then
2789 $to \$exe
2790 $touch \$exe.xok
2791fi
2792$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2793EOF
2794 ;;
93bc48fa 2795 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2796 exit 1
2797 ;;
2798 esac
93c0359c
JH
2799 case "$targetmkdir" in
2800 */Cross/mkdir)
2801 cat >$targetmkdir <<EOF
2802#!/bin/sh
2803$targetrun -l $targetuser $targethost "mkdir -p \$@"
2804EOF
f8006fac 2805 $chmod a+rx $targetmkdir
93c0359c
JH
2806 ;;
2807 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2808 exit 1
2809 ;;
2810 esac
5440bc8e
JH
2811 case "$targetto" in
2812 scp|rcp)
2813 cat >$to <<EOF
2814#!/bin/sh
2815for f in \$@
2816do
93c0359c
JH
2817 case "\$f" in
2818 /*)
2819 $targetmkdir \`dirname \$f\`
2820 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2821 ;;
2822 *)
2823 $targetmkdir $targetdir/\`dirname \$f\`
2824 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2825 ;;
2826 esac
5440bc8e
JH
2827done
2828exit 0
2829EOF
2830 ;;
2831 cp) cat >$to <<EOF
2832#!/bin/sh
93c0359c
JH
2833for f in \$@
2834do
2835 case "\$f" in
2836 /*)
2837 $mkdir -p $targetdir/\`dirname \$f\`
2838 $cp \$f $targetdir/\$f || exit 1
2839 ;;
2840 *)
2841 $targetmkdir $targetdir/\`dirname \$f\`
2842 $cp \$f $targetdir/\$f || exit 1
2843 ;;
2844 esac
2845done
2846exit 0
5440bc8e
JH
2847EOF
2848 ;;
93bc48fa 2849 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2850 exit 1
2851 ;;
2852 esac
2853 case "$targetfrom" in
2854 scp|rcp)
2855 cat >$from <<EOF
2856#!/bin/sh
2857for f in \$@
2858do
93c0359c 2859 $rm -f \$f
5440bc8e
JH
2860 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2861done
2862exit 0
2863EOF
2864 ;;
2865 cp) cat >$from <<EOF
2866#!/bin/sh
2867for f in \$@
2868do
93c0359c 2869 $rm -f \$f
5440bc8e
JH
2870 cp $targetdir/\$f . || exit 1
2871done
2872exit 0
2873EOF
2874 ;;
93bc48fa 2875 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2876 exit 1
2877 ;;
2878 esac
93bc48fa
JH
2879 if $test ! -f $run; then
2880 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2881 else
f8006fac 2882 $chmod a+rx $run
5440bc8e 2883 fi
93bc48fa
JH
2884 if $test ! -f $to; then
2885 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2886 else
f8006fac 2887 $chmod a+rx $to
5440bc8e 2888 fi
93bc48fa
JH
2889 if $test ! -f $from; then
2890 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2891 else
f8006fac 2892 $chmod a+rx $from
5440bc8e 2893 fi
93bc48fa 2894 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2895 exit 1
2896 fi
2897 cat >&4 <<EOF
f8006fac
JH
2898Using '$run' for remote execution,
2899and '$from' and '$to'
93bc48fa 2900for remote file transfer.
5440bc8e
JH
2901EOF
2902 ;;
2903*) run=''
2904 to=:
2905 from=:
2906 usecrosscompile='undef'
2907 targetarch=''
2908 ;;
2909esac
2910
ecfc5424
AD
2911: see whether [:lower:] and [:upper:] are supported character classes
2912echo " "
ecfc5424
AD
2913case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2914ABYZ)
2915 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2916 up='[:upper:]'
2917 low='[:lower:]'
2918 ;;
c931d01c
NC
2919*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2920 # (0xd9 and 0xe2), therefore that is a nice testing point.
2921 if test "X$up" = X -o "X$low" = X; then
2922 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2923 rs) up='[A-Z]'
2924 low='[a-z]'
28e8609d
JH
2925 ;;
2926 esac
c931d01c 2927 fi
28e8609d 2928 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2929 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2930 rs) up='A-Z'
28e8609d
JH
2931 low='a-z'
2932 ;;
2933 esac
c931d01c 2934 fi
28e8609d 2935 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2936 case "`echo RS | od -x 2>/dev/null`" in
2937 *D9E2*|*d9e2*)
28e8609d
JH
2938 echo "Hey, this might be EBCDIC." >&4
2939 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2940 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2941 rs) up='[A-IJ-RS-Z]'
2942 low='[a-ij-rs-z]'
28e8609d
JH
2943 ;;
2944 esac
2945 fi
2946 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2947 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2948 rs) up='A-IJ-RS-Z'
2949 low='a-ij-rs-z'
28e8609d
JH
2950 ;;
2951 esac
2952 fi
2953 ;;
2954 esac
2955 fi
2956esac
c931d01c
NC
2957case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2958rs)
28e8609d
JH
2959 echo "Using $up and $low to convert case." >&4
2960 ;;
ecfc5424 2961*)
28e8609d
JH
2962 echo "I don't know how to translate letters from upper to lower case." >&4
2963 echo "Your tr is not acting any way I know of." >&4
2964 exit 1
2965 ;;
ecfc5424
AD
2966esac
2967: set up the translation script tr, must be called with ./tr of course
2968cat >tr <<EOSC
2969$startsh
2970case "\$1\$2" in
2971'[A-Z][a-z]') exec $tr '$up' '$low';;
2972'[a-z][A-Z]') exec $tr '$low' '$up';;
2973esac
2974exec $tr "\$@"
2975EOSC
2976chmod +x tr
2977$eunicefix tr
2978
2304df62
AD
2979: Try to determine whether config.sh was made on this system
2980case "$config_sh" in
2981'')
43999f95
JH
2982myuname=`$uname -a 2>/dev/null`
2983$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2984# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2985# because the A-Z/a-z are not consecutive.
a0d0e21e 2986myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2987 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2988newmyuname="$myuname"
2304df62 2989dflt=n
16d20bd9
AD
2990case "$knowitall" in
2991'')
2992 if test -f ../config.sh; then
2993 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2994 eval "`grep myuname= ../config.sh`"
2995 fi
2996 if test "X$myuname" = "X$newmyuname"; then
2997 dflt=y
2998 fi
2304df62 2999 fi
16d20bd9
AD
3000 ;;
3001*) dflt=y;;
3002esac
2304df62
AD
3003
3004: Get old answers from old config file if Configure was run on the
3005: same system, otherwise use the hints.
3006hint=default
3007cd ..
3008if test -f config.sh; then
16d20bd9
AD
3009 echo " "
3010 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3011 . UU/myread
3012 case "$ans" in
f83701cd
AD
3013 n*|N*) echo "OK, I'll ignore it."
3014 mv config.sh config.sh.old
3015 myuname="$newmyuname"
3016 ;;
2304df62 3017 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3018 tmp_n="$n"
3019 tmp_c="$c"
85cad39c 3020 tmp_sh="$sh"
2304df62
AD
3021 . ./config.sh
3022 cp config.sh UU
ecfc5424
AD
3023 n="$tmp_n"
3024 c="$tmp_c"
85cad39c 3025 : Older versions did not always set $sh. Catch re-use of such
3026 : an old config.sh.
3027 case "$sh" in
3028 '') sh="$tmp_sh" ;;
3029 esac
2304df62
AD
3030 hint=previous
3031 ;;
3032 esac
3033fi
2573c5f9 3034. ./UU/checkcc
2304df62
AD
3035if test ! -f config.sh; then
3036 $cat <<EOM
3037
4e2a5f63
AD
3038First time through, eh? I have some defaults handy for some systems
3039that need some extra help getting the Configure answers right:
2304df62
AD
3040
3041EOM
dfe9444c 3042 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3043 dflt=''
3044 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3045 : tests or hints, please send them to perlbug@perl.org
2304df62 3046 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3047 $test -f /irix && osname=irix
85e6fe83
LW
3048 $test -f /xenix && osname=sco_xenix
3049 $test -f /dynix && osname=dynix
3050 $test -f /dnix && osname=dnix
5f05dabc 3051 $test -f /lynx.os && osname=lynxos
3052 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3053 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3054 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3055 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3056 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3057 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3058 $test -d /usr/apollo/bin && osname=apollo
3059 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3060 $test -d /usr/include/minix && osname=minix
d54344fc 3061 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3062 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3063 osname=machten
4633a7c4 3064 if $test -x /sbin/version; then
dfe9444c 3065 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3066 $sed -e 's/[A-Za-z]$//'`
3067 elif $test -x /usr/etc/version; then
dfe9444c 3068 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3069 $sed -e 's/[A-Za-z]$//'`
3070 else
3071 osvers="$2.$3"
3072 fi
3073 fi
aaacdc8b
GS
3074
3075 $test -f /sys/posix.dll &&
3076 $test -f /usr/bin/what &&
3077 set X `/usr/bin/what /sys/posix.dll` &&
3078 $test "$3" = UWIN &&
3079 osname=uwin &&
3080 osvers="$5"
3081
2304df62
AD
3082 if $test -f $uname; then
3083 set X $myuname
3084 shift
3085
2304df62 3086 case "$5" in
85e6fe83 3087 fps*) osname=fps ;;
2304df62
AD
3088 mips*)
3089 case "$4" in
85e6fe83
LW
3090 umips) osname=umips ;;
3091 *) osname=mips ;;
2304df62 3092 esac;;
85e6fe83
LW
3093 [23]100) osname=mips ;;
3094 next*) osname=next ;;
ecfc5424 3095 i386*)
c6912327
JH
3096 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3097 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3098 osname='sco'
3099 osvers=$tmp
3100 elif $test -f /etc/kconfig; then
ecfc5424 3101 osname=isc
bd628c73 3102 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3103 osvers=4
3104 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3105 osvers=3
2304df62 3106 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3107 osvers=2
ecfc5424
AD
3108 fi
3109 fi
2000072c 3110 tmp=''
ecfc5424 3111 ;;
c4f23d77
AD
3112 pc*)
3113 if test -n "$DJGPP"; then
3114 osname=dos
3115 osvers=djgpp
3116 fi
3117 ;;
2304df62
AD
3118 esac
3119
3120 case "$1" in
a0d0e21e
LW
3121 aix) osname=aix
3122 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3123 case "$tmp" in
066079d9
NC
3124 # oslevel can fail with:
3125 # oslevel: Unable to acquire lock.
3126 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3127 '<3240'|'<>3240') osvers=3.2.0 ;;
3128 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3129 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3130 *) osvers=$tmp;;
a0d0e21e
LW
3131 esac
3132 ;;
aaacdc8b
GS
3133 bsd386) osname=bsd386
3134 osvers=`$uname -r`
3135 ;;
3136 cygwin*) osname=cygwin
3137 osvers="$3"
3138 ;;
23f87696
SZ
3139 *dc.osx) osname=dcosx
3140 osvers="$3"
3141 ;;
a0d0e21e
LW
3142 dnix) osname=dnix
3143 osvers="$3"
3144 ;;
3145 domainos) osname=apollo
3146 osvers="$3"
3147 ;;
68b474e0
RSG
3148 dgux) osname=dgux
3149 osvers="$3"
3150 ;;
3151 dragonfly) osname=dragonfly
a0d0e21e
LW
3152 osvers="$3"
3153 ;;
760ac839 3154 dynixptx*) osname=dynixptx
e58e581d 3155 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3156 ;;
68b474e0 3157 freebsd) osname=freebsd
a0d0e21e 3158 osvers="$3" ;;
54b41212
NC
3159 genix) osname=genix ;;
3160 gnu) osname=gnu
3161 osvers="$3" ;;
68b474e0 3162 hp*) osname=hpux
bfb7748a 3163 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3164 ;;
54b41212 3165 irix*) osname=irix
a0d0e21e
LW
3166 case "$3" in
3167 4*) osvers=4 ;;
3168 5*) osvers=5 ;;
ecfc5424 3169 *) osvers="$3" ;;
a0d0e21e
LW
3170 esac
3171 ;;
54b41212 3172 linux) osname=linux
a0d0e21e 3173 case "$3" in
a0d0e21e
LW
3174 *) osvers="$3" ;;
3175 esac
3176 ;;
54b41212 3177 MiNT) osname=mint
28e8609d
JH
3178 ;;
3179 netbsd*) osname=netbsd
ecfc5424
AD
3180 osvers="$3"
3181 ;;
4e81affe
MM
3182 news-os) osvers="$3"
3183 case "$3" in
3184 4*) osname=newsos4 ;;
3185 *) osname=newsos ;;
3186 esac
3187 ;;
aaacdc8b 3188 next*) osname=next ;;
28bb1e2c 3189 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3190 openbsd) osname=openbsd
3191 osvers="$3"
3192 ;;
8257dec7
IZ
3193 os2) osname=os2
3194 osvers="$4"
3195 ;;
aaacdc8b
GS
3196 POSIX-BC | posix-bc ) osname=posix-bc
3197 osvers="$3"
a0d0e21e 3198 ;;
ae3afa4e
TH
3199 powerux | power_ux | powermax_os | powermaxos | \
3200 powerunix | power_unix) osname=powerux
3201 osvers="$3"
3202 ;;
aaacdc8b
GS
3203 qnx) osname=qnx
3204 osvers="$4"
3205 ;;
a0d0e21e
LW
3206 solaris) osname=solaris
3207 case "$3" in
3208 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3209 *) osvers="$3" ;;
a0d0e21e
LW
3210 esac
3211 ;;
85e6fe83
LW
3212 sunos) osname=sunos
3213 case "$3" in
85e6fe83
LW
3214 5*) osname=solaris
3215 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3216 *) osvers="$3" ;;
2304df62
AD
3217 esac
3218 ;;
a0d0e21e 3219 titanos) osname=titanos
85e6fe83 3220 case "$3" in
a0d0e21e
LW
3221 1*) osvers=1 ;;
3222 2*) osvers=2 ;;
3223 3*) osvers=3 ;;
3224 4*) osvers=4 ;;
ecfc5424 3225 *) osvers="$3" ;;
2304df62
AD
3226 esac
3227 ;;
85e6fe83 3228 ultrix) osname=ultrix
ecfc5424 3229 osvers="$3"
2304df62 3230 ;;
28757baa 3231 osf1|mls+) case "$5" in
fed7345c
AD
3232 alpha)
3233 osname=dec_osf
c0e211e2 3234 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3235 case "$osvers" in
3236 [1-9].[0-9]*) ;;
3237 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3238 esac
ecfc5424
AD
3239 ;;
3240 hp*) osname=hp_osf1 ;;
3241 mips) osname=mips_osf1 ;;
85e6fe83
LW
3242 esac
3243 ;;
bfd7eeef
JH
3244 # UnixWare 7.1.2 is known as Open UNIX 8
3245 openunix|unixware) osname=svr5
0337d152
BG
3246 osvers="$4"
3247 ;;
3c728e00 3248 uts) osname=uts
a0d0e21e
LW
3249 osvers="$3"
3250 ;;
3c728e00
JH
3251 vos) osvers="$3"
3252 ;;
85e6fe83 3253 $2) case "$osname" in
2304df62 3254 *isc*) ;;
a0d0e21e 3255 *freebsd*) ;;
5f05dabc 3256 svr*)
a0d0e21e 3257 : svr4.x or possibly later
68b474e0 3258 case "svr$3" in
a0d0e21e
LW
3259 ${osname}*)
3260 osname=svr$3
3261 osvers=$4
3262 ;;
3263 esac
3264 case "$osname" in
3265 svr4.0)
3266 : Check for ESIX
3267 if test -f /stand/boot ; then
3268 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3269 if test -n "$INITPROG" -a -f "$INITPROG"; then
3270 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3271 if test -n "$isesix"; then
a0d0e21e
LW
3272 osname=esix4
3273 fi
3274 fi
3275 fi
3276 ;;
3277 esac
3278 ;;
2304df62 3279 *) if test -f /etc/systemid; then
a0d0e21e
LW
3280 osname=sco
3281 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3282 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3283 osvers=$1.$2.$3
c4f23d77 3284 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3285 osvers=$1.$2
c4f23d77 3286 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3287 osvers=$1
2304df62 3288 fi
a0d0e21e
LW
3289 else
3290 case "$osname" in
3291 '') : Still unknown. Probably a generic Sys V.
3292 osname="sysv"
3293 osvers="$3"
3294 ;;
3295 esac
2304df62
AD
3296 fi
3297 ;;
3298 esac
3299 ;;
a0d0e21e
LW
3300 *) case "$osname" in
3301 '') : Still unknown. Probably a generic BSD.
3302 osname="$1"
3303 osvers="$3"
3304 ;;
3305 esac
3306 ;;
2304df62
AD
3307 esac
3308 else
dfe9444c
AD
3309 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3310 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3311 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3312 osname=news_os
2304df62 3313 fi
dfe9444c 3314 $rm -f UU/kernel.what
8257dec7 3315 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3316 set X $myuname
3317 osname=os2
3318 osvers="$5"
2304df62
AD
3319 fi
3320 fi
68b474e0 3321
5440bc8e
JH
3322 case "$targetarch" in
3323 '') ;;
3324 *) hostarch=$osname
3325 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3326 osvers=''
3327 ;;
3328 esac
3329
a0d0e21e
LW
3330 : Now look for a hint file osname_osvers, unless one has been
3331 : specified already.
3332 case "$hintfile" in
3333 ''|' ')
1e127011 3334 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3335 : Also try without trailing minor version numbers.
1e127011
DD
3336 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3337 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3338 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3339 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3340 case "$file" in
3341 '') dflt=none ;;
3342 *) case "$osvers" in
3343 '') dflt=$file
3344 ;;
dfe9444c 3345 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3346 dflt=$file
dfe9444c 3347 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3348 dflt=$xfile
dfe9444c 3349 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3350 dflt=$xxfile
dfe9444c 3351 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3352 dflt=$xxxfile
dfe9444c 3353 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3354 dflt=$xxxxfile
dfe9444c 3355 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3356 dflt="${osname}"
3357 else
3358 dflt=none
3359 fi
3360 ;;
3361 esac
85e6fe83
LW
3362 ;;
3363 esac
4e2a5f63
AD
3364 if $test -f Policy.sh ; then
3365 case "$dflt" in
3366 *Policy*) ;;
3367 none) dflt="Policy" ;;
3368 *) dflt="Policy $dflt" ;;
3369 esac
3370 fi
85e6fe83 3371 ;;
a0d0e21e 3372 *)
ecfc5424 3373 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3374 ;;
2304df62 3375 esac
1aef975c 3376
4e2a5f63
AD
3377 if $test -f Policy.sh ; then
3378 $cat <<EOM
3379
3380There's also a Policy hint file available, which should make the
3381site-specific (policy) questions easier to answer.
3382EOM
3383
3384 fi
3385
2304df62
AD
3386 $cat <<EOM
3387
3388You may give one or more space-separated answers, or "none" if appropriate.
74950343
NC
3389If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3390previous run of Configure, you may specify it as well as or instead of
3391OS-specific hints. If hints are provided for your OS, you should use them:
3392although Perl can probably be built without hints on many platforms, using
3393hints often improve performance and may enable features that Configure can't
3394set up on its own. If there are no hints that match your OS, specify "none";
3395DO NOT give a wrong version or a wrong OS.
2304df62
AD
3396
3397EOM
4e2a5f63 3398
2304df62 3399 rp="Which of these apply, if any?"
dfe9444c 3400 . UU/myread
85e6fe83
LW
3401 tans=$ans
3402 for file in $tans; do
4e2a5f63
AD
3403 if $test X$file = XPolicy -a -f Policy.sh; then
3404 . Policy.sh
3405 $cat Policy.sh >> UU/config.sh
3406 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3407 . $src/hints/$file.sh
3408 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3409 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3410 : nothing
3411 else
85e6fe83
LW
3412 : Give one chance to correct a possible typo.
3413 echo "$file.sh does not exist"
3414 dflt=$file
3415 rp="hint to use instead?"
dfe9444c 3416 . UU/myread
85e6fe83 3417 for file in $ans; do
dfe9444c
AD
3418 if $test -f "$src/hints/$file.sh"; then
3419 . $src/hints/$file.sh
3420 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3421 elif $test X$ans = X -o X$ans = Xnone ; then
3422 : nothing
3423 else
3424 echo "$file.sh does not exist -- ignored."
3425 fi
3426 done
2304df62
AD
3427 fi
3428 done
85e6fe83 3429
2304df62 3430 hint=recommended
85e6fe83 3431 : Remember our hint file for later.
dfe9444c 3432 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3433 hintfile="$file"
85e6fe83 3434 else
a0d0e21e 3435 hintfile=''
85e6fe83 3436 fi
2304df62
AD
3437fi
3438cd UU
3439;;
3440*)
3441 echo " "
3442 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3443 tmp_n="$n"
3444 tmp_c="$c"
2304df62
AD
3445 cd ..
3446 cp $config_sh config.sh 2>/dev/null
a78b0d02 3447 chmod +w config.sh
2304df62
AD
3448 . ./config.sh
3449 cd UU
3450 cp ../config.sh .
ecfc5424
AD
3451 n="$tmp_n"
3452 c="$tmp_c"
2304df62
AD
3453 hint=previous
3454 ;;
3455esac
1aef975c 3456test "$override" && . ./optdef.sh
2304df62
AD
3457
3458: Restore computed paths
3459for file in $loclist $trylist; do
3460 eval $file="\$_$file"
3461done
3462
85e6fe83 3463cat << EOM
a0d0e21e 3464
85e6fe83 3465Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3466The default value is probably right if the name rings a bell. Otherwise,
3467since spelling matters for me, either accept the default or answer "none"
3468to leave it blank.
a0d0e21e 3469
85e6fe83 3470EOM
85e6fe83 3471case "$osname" in
a0d0e21e 3472 ''|' ')
85e6fe83 3473 case "$hintfile" in
a0d0e21e 3474 ''|' '|none) dflt=none ;;
ecfc5424 3475 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3476 esac
3477 ;;
3478 *) dflt="$osname" ;;
3479esac
3480rp="Operating system name?"
3481. ./myread
3482case "$ans" in
ecfc5424
AD
3483none) osname='' ;;
3484*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3485esac
8ff267be 3486echo " "
3487case "$osvers" in
3488 ''|' ')
3489 case "$hintfile" in
3490 ''|' '|none) dflt=none ;;
3491 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3492 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3493 case "$dflt" in
3494 ''|' ') dflt=none ;;
3495 esac
3496 ;;
3497 esac
3498 ;;
3499 *) dflt="$osvers" ;;
3500esac
3501rp="Operating system version?"
3502. ./myread
3503case "$ans" in
3504none) osvers='' ;;
3505*) osvers="$ans" ;;
3506esac
3507
02e93a22
JH
3508
3509. ./posthint.sh
3510
2304df62 3511: who configured the system
59b83a6f 3512cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3513case "$cf_by" in
3514"")
3d46c0ef 3515 cf_by=`(logname) 2>/dev/null`
dfe9444c 3516 case "$cf_by" in
3d46c0ef
NC
3517 "")
3518 cf_by=`(whoami) 2>/dev/null`
3519 case "$cf_by" in
3520 "") cf_by=unknown ;;
3521 esac ;;
8ff267be 3522 esac ;;
3523esac
2304df62 3524
de7128ac
NC
3525: decide how portable to be. Allow command line overrides.
3526case "$d_portable" in
3527"$undef") ;;
3528*) d_portable="$define" ;;
b4eb6b3d 3529esac
b4eb6b3d 3530
de7128ac
NC
3531: set up shell script to do ~ expansion
3532cat >filexp <<EOSS
3533$startsh
3534: expand filename
3535case "\$1" in
3536 ~/*|~)
3537 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3538 ;;
3539 ~*)
3540 if $test -f /bin/csh; then
3541 /bin/csh -f -c "glob \$1"
3542 failed=\$?
3543 echo ""
3544 exit \$failed
3545 else
3546 name=\`$expr x\$1 : '..\([^/]*\)'\`
3547 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3548 if $test ! -d "\$dir"; then
3549 me=\`basename \$0\`
3550 echo "\$me: can't locate home directory for: \$name" >&2
3551 exit 1
3552 fi
3553 case "\$1" in
3554 */*)
3555 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3556 ;;
3557 *)
3558 echo \$dir
3559 ;;
3560 esac
3561 fi
3562 ;;
3563*)
3564 echo \$1
3565 ;;
b29b105d 3566esac
de7128ac
NC
3567EOSS
3568chmod +x filexp
3569$eunicefix filexp
b29b105d 3570
de7128ac
NC
3571: now set up to get a file name
3572cat <<EOS >getfile
3573$startsh
3574EOS
3575cat <<'EOSC' >>getfile
3576tilde=''
3577fullpath=''
3578already=''
3579skip=''
3580none_ok=''
3581exp_file=''
3582nopath_ok=''
3583orig_rp="$rp"
3584orig_dflt="$dflt"
3585case "$gfpth" in
3586'') gfpth='.' ;;
b29b105d 3587esac
b29b105d 3588
de7128ac
NC
3589case "$fn" in
3590*\(*)
3591 : getfile will accept an answer from the comma-separated list
3592 : enclosed in parentheses even if it does not meet other criteria.
3593 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3594 fn=`echo $fn | sed 's/(.*)//'`
3595 ;;
b29b105d
JH
3596esac
3597
de7128ac
NC
3598case "$fn" in
3599*:*)
3600 loc_file=`expr $fn : '.*:\(.*\)'`
3601 fn=`expr $fn : '\(.*\):.*'`
3602 ;;
b29b105d 3603esac
b29b105d 3604
de7128ac
NC
3605case "$fn" in
3606*~*) tilde=true;;
3607esac
3608case "$fn" in
3609*/*) fullpath=true;;
3610esac
3611case "$fn" in
3612*+*) skip=true;;
3613esac
3614case "$fn" in
3615*n*) none_ok=true;;
3616esac
3617case "$fn" in
3618*e*) exp_file=true;;
3619esac
3620case "$fn" in
3621*p*) nopath_ok=true;;
b29b105d 3622esac
b29b105d 3623
de7128ac
NC
3624case "$fn" in
3625*f*) type='File';;
3626*d*) type='Directory';;
3627*l*) type='Locate';;
3628esac
b29b105d 3629
de7128ac
NC
3630what="$type"
3631case "$what" in
3632Locate) what='File';;
3633esac
b29b105d 3634
de7128ac
NC
3635case "$exp_file" in
3636'')
3637 case "$d_portable" in
3638 "$define") ;;
3639 *) exp_file=true;;
b29b105d
JH
3640 esac
3641 ;;
3642esac
3643
de7128ac
NC
3644cd ..
3645while test "$type"; do
3646 redo=''
3647 rp="$orig_rp"
3648 dflt="$orig_dflt"
3649 case "$tilde" in
3650 true) rp="$rp (~name ok)";;
3651 esac
3652 . UU/myread
3653 if test -f UU/getfile.ok && \
3654 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3655 then
3656 value="$ans"
3657 ansexp="$ans"
3658 break
3659 fi
3660 case "$ans" in
3661 none)
3662 value=''
3663 ansexp=''
3664 case "$none_ok" in
3665 true) type='';;
b29b105d
JH
3666 esac
3667 ;;
de7128ac
NC
3668 *)
3669 case "$tilde" in
3670 '') value="$ans"
3671 ansexp="$ans";;
3672 *)
3673 value=`UU/filexp $ans`
3674 case $? in
3675 0)
3676 if test "$ans" != "$value"; then
3677 echo "(That expands to $value on this system.)"
3678 fi
3679 ;;
3680 *) value="$ans";;
3681 esac
3682 ansexp="$value"
3683 case "$exp_file" in
3684 '') value="$ans";;
3685 esac
3686 ;;
3687 esac
3688 case "$fullpath" in
3689 true)
3690 case "$ansexp" in
3691 /*) value="$ansexp" ;;
3692 [a-zA-Z]:/*) value="$ansexp" ;;
3693 *)
3694 redo=true
3695 case "$already" in
3696 true)
3697 echo "I shall only accept a full path name, as in /bin/ls." >&4
3698 echo "Use a ! shell escape if you wish to check pathnames." >&4
3699 ;;
3700 *)
3701 echo "Please give a full path name, starting with slash." >&4
3702 case "$tilde" in
3703 true)
3704 echo "Note that using ~name is ok provided it expands well." >&4
3705 already=true
3706 ;;
3707 esac
3708 esac
3709 ;;
3710 esac
3711 ;;
3712 esac
3713 case "$redo" in
3714 '')
3715 case "$type" in
3716 File)
3717 for fp in $gfpth; do
3718 if test "X$fp" = X.; then
3719 pf="$ansexp"
3720 else
3721 pf="$fp/$ansexp"
3722 fi
3723 if test -f "$pf"; then
3724 type=''
3725 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3726 then
3727 echo "($value is not a plain file, but that's ok.)"
3728 type=''
3729 fi
3730 if test X"$type" = X; then
3731 value="$pf"
3732 break
3733 fi
3734 done
3735 ;;
3736 Directory)
3737 for fp in $gfpth; do
3738 if test "X$fp" = X.; then
3739 dir="$ans"
3740 direxp="$ansexp"
3741 else
3742 dir="$fp/$ansexp"
3743 direxp="$fp/$ansexp"
3744 fi
3745 if test -d "$direxp"; then
3746 type=''
3747 value="$dir"
3748 break
3749 fi
3750 done
3751 ;;
3752 Locate)
3753 if test -d "$ansexp"; then
3754 echo "(Looking for $loc_file in directory $value.)"
3755 value="$value/$loc_file"
3756 ansexp="$ansexp/$loc_file"
3757 fi
3758 if test -f "$ansexp"; then
3759 type=''
3760 fi
3761 case "$nopath_ok" in
3762 true) case "$value" in
3763 */*) ;;
3764 *) echo "Assuming $value will be in people's path."
3765 type=''
3766 ;;
3767 esac
3768 ;;
3769 esac
3770 ;;
3771 esac
b4eb6b3d 3772
de7128ac
NC
3773 case "$skip" in
3774 true) type='';
3775 esac
3776
3777 case "$type" in
3778 '') ;;
3779 *)
3780 if test "$fastread" = yes; then
3781 dflt=y
3782 else
3783 dflt=n
3784 fi
3785 rp="$what $value doesn't exist. Use that name anyway?"
3786 . UU/myread
3787 dflt=''
3788 case "$ans" in
3789 y*) type='';;
3790 *) echo " ";;
3791 esac
3792 ;;
3793 esac
3794 ;;
3795 esac
3796 ;;
b4eb6b3d 3797 esac
de7128ac
NC
3798done
3799cd UU
3800ans="$value"
3801rp="$orig_rp"
3802dflt="$orig_dflt"
3803rm -f getfile.ok
3804test "X$gfpthkeep" != Xy && gfpth=""
3805EOSC
3806
3807: determine root of directory hierarchy where package will be installed.
3808case "$prefix" in
3809'')
3810 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3811 ;;
3812*?/)
3813 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3814 ;;
3815*)
de7128ac 3816 dflt="$prefix"
b4eb6b3d
JH
3817 ;;
3818esac
de7128ac 3819$cat <<EOM
b4eb6b3d 3820
de7128ac
NC
3821By default, $package will be installed in $dflt/bin, manual pages
3822under $dflt/man, etc..., i.e. with $dflt as prefix for all
3823installation directories. Typically this is something like /usr/local.
3824If you wish to have binaries under /usr/bin but other parts of the
3825installation under /usr/local, that's ok: you will be prompted
3826separately for each of the installation directories, the prefix being
3827only used to set the defaults.
c915ce7f
JH
3828
3829EOM
de7128ac
NC
3830fn=d~
3831rp='Installation prefix to use?'
3832. ./getfile
3833oldprefix=''
3834case "$prefix" in
3835'') ;;
3836*)
3837 case "$ans" in
3838 "$prefix") ;;
3839 *) oldprefix="$prefix";;
3840 esac
c915ce7f
JH
3841 ;;
3842esac
de7128ac
NC
3843prefix="$ans"
3844prefixexp="$ansexp"
c915ce7f 3845
de7128ac
NC
3846case "$afsroot" in
3847'') afsroot=/afs ;;
3848*) afsroot=$afsroot ;;
b4eb6b3d 3849esac
b4eb6b3d 3850
de7128ac
NC
3851: is AFS running?
3852echo " "
3853case "$afs" in
3854$define|true) afs=true ;;
3855$undef|false) afs=false ;;
3856*) if test -d $afsroot; then
3857 afs=true
3858 else
3859 afs=false
3860 fi
b4eb6b3d 3861 ;;
de7128ac
NC
3862esac
3863if $afs; then
3864 echo "AFS may be running... I'll be extra cautious then..." >&4
3865else
3866 echo "AFS does not seem to be running..." >&4
6bd2d01f 3867fi
b4eb6b3d 3868
de7128ac
NC
3869: determine installation prefix for where package is to be installed.
3870if $afs; then
3871$cat <<EOM
b4eb6b3d 3872
de7128ac
NC
3873Since you are running AFS, I need to distinguish the directory in which
3874files will reside from the directory in which they are installed (and from
3875which they are presumably copied to the former directory by occult means).
b4eb6b3d 3876
b4eb6b3d 3877EOM
de7128ac
NC
3878 case "$installprefix" in
3879 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3880 *) dflt="$installprefix";;
b4eb6b3d 3881 esac
de7128ac
NC
3882else
3883$cat <<EOM
3884
3885In some special cases, particularly when building $package for distribution,
3886it is convenient to distinguish the directory in which files should be
3887installed from the directory ($prefix) in which they will
3888eventually reside. For most users, these two directories are the same.
3889
3890EOM
3891 case "$installprefix" in
3892 '') dflt=$prefix ;;
3893 *) dflt=$installprefix;;
b4eb6b3d 3894 esac
de7128ac
NC
3895fi
3896fn=d~
3897rp='What installation prefix should I use for installing files?'
3898. ./getfile
3899installprefix="$ans"
3900installprefixexp="$ansexp"
3901
3902: Perform the prefixexp/installprefixexp correction if necessary
3903cat <<EOS >installprefix
3904$startsh
3905EOS
3906cat <<'EOSC' >>installprefix
3907: Change installation prefix, if necessary.
3908if $test X"$prefix" != X"$installprefix"; then
3909 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3910else
3911 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3912fi
3913EOSC
3914chmod +x installprefix
3915$eunicefix installprefix
3916
3917: Set variables such as privlib and privlibexp from the output of ./getfile
3918: performing the prefixexp/installprefixexp correction if necessary.
3919cat <<EOS >setprefixvar
3920$startsh
3921EOS
3922cat <<'EOSC' >>setprefixvar
3923eval "${prefixvar}=\"\$ans\""
3924eval "${prefixvar}exp=\"\$ansexp\""
3925. ./installprefix
3926EOSC
3927chmod +x setprefixvar
3928$eunicefix setprefixvar
3929
3930: set up the script used to warn in case of inconsistency
3931cat <<EOS >whoa
3932$startsh
3933EOS
3934cat <<'EOSC' >>whoa
3935dflt=y
3936echo " "
3937echo "*** WHOA THERE!!! ***" >&4
3938echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3939rp=" Keep the $hint value?"
3940. ./myread
3941case "$ans" in
3942y) td=$was; tu=$was;;
b4eb6b3d 3943esac
de7128ac
NC
3944EOSC
3945
3946: function used to set $1 to $val
3947setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3948case "$val$was" in
3949$define$undef) . ./whoa; eval "$var=\$td";;
3950$undef$define) . ./whoa; eval "$var=\$tu";;
3951*) eval "$var=$val";;
3952esac'
3953
3954case "$usesocks" in
3955$define|true|[yY]*) dflt='y';;
3956*) dflt='n';;
3957esac
3958cat <<EOM
3959
3960Perl can be built to use the SOCKS proxy protocol library. To do so,
3961Configure must be run with -Dusesocks. If you use SOCKS you also need
3962to use the PerlIO abstraction layer, this will be implicitly selected.
3963
3964If this doesn't make any sense to you, just accept the default '$dflt'.
3965EOM
3966rp='Build Perl for SOCKS?'
3967. ./myread
3968case "$ans" in
3969y|Y) val="$define" ;;
3970*) val="$undef" ;;
3971esac
3972set usesocks
b4eb6b3d
JH
3973eval $setvar
3974
de7128ac
NC
3975case "$usesocks" in
3976$define|true|[yY]*) useperlio="$define";;
3977esac
96056487 3978
de7128ac
NC
3979case "$useperlio" in
3980$define|true|[yY]*|'') dflt='y';;
3981*) dflt='n';;
96056487 3982esac
de7128ac 3983cat <<EOM
96056487 3984
de7128ac
NC
3985Previous version of $package used the standard IO mechanisms as
3986defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3987alternate IO mechanisms via the PerlIO abstraction layer, but the
3988stdio mechanism is still available if needed. The abstraction layer
3989can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3990Using PerlIO with sfio may cause problems with some extension modules.
3991
3992If this doesn't make any sense to you, just accept the default '$dflt'.
3993EOM
3994rp='Use the PerlIO abstraction layer?'
3995. ./myread
3996case "$ans" in
3997y|Y)
3998 val="$define"
e5e20432 3999 ;;
de7128ac
NC
4000*)
4001 echo "Ok, doing things the stdio way."
4002 val="$undef"
e5e20432
JH
4003 ;;
4004esac
de7128ac
NC
4005set useperlio
4006eval $setvar
4007
4008case "$usesocks" in
4009$define|true|[yY]*)
4010 case "$useperlio" in
4011 $define|true|[yY]*) ;;
4012 *) cat >&4 <<EOM
4013
4014You are using the SOCKS proxy protocol library which means that you
4015should also use the PerlIO layer. You may be headed for trouble.
4016
4017EOM
4018 ;;
4019 esac
e5e20432
JH
4020 ;;
4021esac
e5e20432 4022
de7128ac
NC
4023
4024case "$usethreads" in
4025$define|true|[yY]*) dflt='y';;
4026*) # Catch case where user specified ithreads or 5005threads but
4027 # forgot -Dusethreads (A.D. 4/2002)
4028 case "$useithreads$use5005threads" in
4029 *$define*)
4030 case "$useperlio" in
4031 "$define") dflt='y' ;;
4032 *) dflt='n' ;;
4033 esac
4034 ;;
4035 *) dflt='n';;
4036 esac
4037 ;;
5869b1f1 4038esac
de7128ac 4039cat <<EOM
6b769f8f 4040
de7128ac
NC
4041Perl can be built to take advantage of threads on some systems.
4042To do so, Configure can be run with -Dusethreads.
5b463ca7 4043
de7128ac
NC
4044Note that Perl built with threading support runs slightly slower
4045and uses more memory than plain Perl. The current implementation
4046is believed to be stable, but it is fairly new, and so should be
4047treated with caution.
5b463ca7 4048
de7128ac 4049If this doesn't make any sense to you, just accept the default '$dflt'.
5b463ca7 4050EOM
de7128ac
NC
4051rp='Build a threading Perl?'
4052. ./myread
4053case "$ans" in
4054y|Y) val="$define" ;;
4055*) val="$undef" ;;
e723fc21 4056esac
de7128ac
NC
4057set usethreads
4058eval $setvar
e5e20432 4059
de7128ac
NC
4060case "$usethreads" in
4061$define)
4062 $cat <<EOM
640374d0 4063
de7128ac
NC
4064Since release 5.6, Perl has had two different threading implementations,
4065the newer interpreter-based version (ithreads) with one interpreter per
4066thread, and the older 5.005 version (5005threads).
4067The 5005threads version is effectively unmaintained and will probably be
4068removed in Perl 5.10, so there should be no need to build a Perl using it
4069unless needed for backwards compatibility with some existing 5.005threads
4070code.
85ab1d1d 4071
de7128ac
NC
4072EOM
4073 : Default to ithreads unless overridden on command line or with
4074 : old config.sh
4075 dflt='y'
4076 case "$use5005threads" in
4077 $define|true|[yY]*) dflt='n';;
4078 esac
4079 case "$useithreads" in
4080 $undef|false|[nN]*) dflt='n';;
4081 esac
4082 rp='Use the newer interpreter-based ithreads?'
4083 . ./myread
4084 case "$ans" in
4085 y|Y) val="$define" ;;
4086 *) val="$undef" ;;
4087 esac
4088 set useithreads
4089 eval $setvar
4090 : Now set use5005threads to the opposite value.
4091 case "$useithreads" in
4092 $define) val="$undef" ;;
4093 *) val="$define" ;;
4094 esac
4095 set use5005threads
4096 eval $setvar
b691c02f 4097 ;;
4633a7c4 4098*)
de7128ac
NC
4099 useithreads="$undef"
4100 use5005threads="$undef"
2304df62
AD
4101 ;;
4102esac
2304df62 4103
de7128ac
NC
4104case "$useithreads$use5005threads" in
4105"$define$define")
4106 $cat >&4 <<EOM
2304df62 4107
de7128ac
NC
4108You cannot have both the ithreads and the 5.005 threads enabled
4109at the same time. Disabling the 5.005 threads since they are
4110much less stable than the ithreads.
ecfc5424 4111
de7128ac
NC
4112EOM
4113 use5005threads="$undef"
a0d0e21e
LW
4114 ;;
4115esac
4116
de7128ac
NC
4117if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4118 cat >&4 <<EOF
4119***
4120*** To build with ithreads you must also use the PerlIO layer.
4121*** Cannot continue, aborting.
4122***
4123EOF
4124 exit 1
4125fi
2304df62 4126
de7128ac
NC
4127case "$d_oldpthreads" in
4128'') : Configure tests would be welcome here. For now, assume undef.
4129 val="$undef" ;;
4130*) val="$d_oldpthreads" ;;
2304df62 4131esac
de7128ac
NC
4132set d_oldpthreads
4133eval $setvar
2304df62 4134
2304df62 4135
de7128ac
NC
4136: Look for a hint-file generated 'call-back-unit'. If the
4137: user has specified that a threading perl is to be built,
4138: we may need to set or change some other defaults.
4139if $test -f usethreads.cbu; then
4140 echo "Your platform has some specific hints regarding threaded builds, using them..."
4141 . ./usethreads.cbu
4142else
4143 case "$usethreads" in
4144 "$define"|true|[yY]*)
4145 $cat <<EOM
4146(Your platform does not have any specific hints for threaded builds.
4147 Assuming POSIX threads, then.)
4148EOM
4149 ;;
4150 esac
4151fi
4152
4153cat <<EOM
4154
4155Perl can be built so that multiple Perl interpreters can coexist
4156within the same Perl executable.
4157EOM
4158
4159case "$useithreads" in
4160$define)
4161 cat <<EOM
4162This multiple interpreter support is required for interpreter-based threads.
4163EOM
4164 val="$define"
4165 ;;
4166*) case "$usemultiplicity" in
4167 $define|true|[yY]*) dflt='y';;
4168 *) dflt='n';;
4169 esac
4170 echo " "
4171 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4172 rp='Build Perl for multiplicity?'
4173 . ./myread
4174 case "$ans" in
4175 y|Y) val="$define" ;;
4176 *) val="$undef" ;;
2304df62
AD
4177 esac
4178 ;;
4179esac
de7128ac
NC
4180set usemultiplicity
4181eval $setvar
2304df62 4182
de7128ac
NC
4183
4184case "$usemorebits" in
4185"$define"|true|[yY]*)
4186 use64bitint="$define"
4187 uselongdouble="$define"
4188 usemorebits="$define"
4189 ;;
4190*) usemorebits="$undef"
4191 ;;
4192esac
4193
4194: make some quick guesses about what we are up against
4195echo " "
4196$echo $n "Hmm... $c"
4197echo exit 1 >bsd
4198echo exit 1 >usg
4199echo exit 1 >v7
4200echo exit 1 >osf1
4201echo exit 1 >eunice
4202echo exit 1 >xenix
4203echo exit 1 >venix
4204echo exit 1 >os2
4205d_bsd="$undef"
4206$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4207if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4208then
4209 echo "Looks kind of like an OSF/1 system, but we'll see..."
4210 echo exit 0 >osf1
4211elif test `echo abc | $tr a-z A-Z` = Abc ; then
4212 xxx=`./loc addbib blurfl $pth`
4213 if $test -f $xxx; then
4214 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4215 echo exit 0 >bsd
4216 echo exit 0 >usg
4217 else
4218 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4219 echo "Looks kind of like an extended USG system, but we'll see..."
4220 else
4221 echo "Looks kind of like a USG system, but we'll see..."
4222 fi
4223 echo exit 0 >usg
ecfc5424 4224 fi
de7128ac
NC
4225elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4226 echo "Looks kind of like a BSD system, but we'll see..."
4227 d_bsd="$define"
4228 echo exit 0 >bsd
4229else
4230 echo "Looks kind of like a Version 7 system, but we'll see..."
4231 echo exit 0 >v7
4232fi
4233case "$eunicefix" in
4234*unixtovms*)
4235 $cat <<'EOI'
4236There is, however, a strange, musty smell in the air that reminds me of
4237something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4238EOI
4239 echo exit 0 >eunice
4240 d_eunice="$define"
4241: it so happens the Eunice I know will not run shell scripts in Unix format
4242 ;;
4243*)
4244 echo " "
4245 echo "Congratulations. You aren't running Eunice."
4246 d_eunice="$undef"
4247 ;;
4248esac
4249: Detect OS2. The p_ variable is set above in the Head.U unit.
4250: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4251: semicolon as a patch separator
4252case "$p_" in
4253:) ;;
4254*)
4255 $cat <<'EOI'
4256I have the feeling something is not exactly right, however...don't tell me...
4257lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4258(Or you may be running DOS with DJGPP.)
4259EOI
4260 echo exit 0 >os2
4261 ;;
4262esac
4263if test -f /xenix; then
4264 echo "Actually, this looks more like a XENIX system..."
4265 echo exit 0 >xenix
4266 d_xenix="$define"
4267else
4268 echo " "
4269 echo "It's not Xenix..."
4270 d_xenix="$undef"
4271fi
4272chmod +x xenix
4273$eunicefix xenix
4274if test -f /venix; then
4275 echo "Actually, this looks more like a VENIX system..."
4276 echo exit 0 >venix
4277else
4278 echo " "
4279 if ./xenix; then
4280 : null
4281 else
4282 echo "Nor is it Venix..."
4283 fi
4284fi
4285chmod +x bsd usg v7 osf1 eunice xenix venix os2
4286$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4287$rm -f foo
2304df62 4288
de7128ac
NC
4289case "$cc" in
4290'') dflt=cc;;
4291*) dflt="$cc";;
4292esac
4293rp="Use which C compiler?"
4294. ./myread
4295cc="$ans"
2304df62 4296
de7128ac
NC
4297: See if they have not cc but they do have gcc
4298. ./trygcc
4299: Look for a hint-file generated 'call-back-unit'. Now that the
4300: user has specified the compiler, we may need to set or change some
4301: other defaults.
4302if $test -f cc.cbu; then
4303 . ./cc.cbu
4304fi
4305. ./checkcc
4306
4307echo " "
4308echo "Checking for GNU cc in disguise and/or its version number..." >&4
4309$cat >try.c <<EOM
4310#include <stdio.h>
4311int main() {
5f7d02a9 4312#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
de7128ac
NC
4313#ifdef __VERSION__
4314 printf("%s\n", __VERSION__);
4315#else
4316 printf("%s\n", "1");
4317#endif
4318#endif
4319 return(0);
4320}
4321EOM
4322if $cc -o try $ccflags $ldflags try.c; then
4323 gccversion=`$run ./try`
4324 case "$gccversion" in
4325 '') echo "You are not using GNU cc." ;;
4326 *) echo "You are using GNU cc $gccversion."
4327 ccname=gcc
4328 ;;
4329 esac
4330else
4331 echo " "
4332 echo "*** WHOA THERE!!! ***" >&4
4333 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4334 case "$knowitall" in
4335 '')
4336 echo " You'd better start hunting for one and let me know about it." >&4
4337 exit 1
2304df62
AD
4338 ;;
4339 esac
de7128ac
NC
4340fi
4341$rm -f try try.*
4342case "$gccversion" in
43431*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4344esac
4345case "$gccversion" in
4346'') gccosandvers='' ;;
4347*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4348 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4349 gccshortvers=''
4350 case "$gccosandvers" in
4351 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4352 $osname$osvers) ;; # looking good
4353 $osname*) cat <<EOM >&4
4354
4355*** WHOA THERE!!! ***
4356
4357 Your gcc has not been compiled for the exact release of
4358 your operating system ($gccosandvers versus $osname$osvers).
4359
4360 In general it is a good idea to keep gcc synchronized with
4361 the operating system because otherwise serious problems
4362 may ensue when trying to compile software, like Perl.
4363
4364 I'm trying to be optimistic here, though, and will continue.
4365 If later during the configuration and build icky compilation
4366 problems appear (headerfile conflicts being the most common
4367 manifestation), I suggest reinstalling the gcc to match
4368 your operating system release.
4369
4370EOM
4371 ;;
4372 *) gccosandvers='' ;; # failed to parse, better be silent
4373 esac
4374 ;;
4375esac
4376case "$ccname" in
4377'') ccname="$cc" ;;
4378esac
4379
4380# gcc 3.* complain about adding -Idirectories that they already know about,
4381# so we will take those off from locincpth.
4382case "$gccversion" in
43833*)
4384 echo "main(){}">try.c
4385 for incdir in $locincpth; do
4386 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4387 grep '^c[cp]p*[01]: warning: changing search order '`
4388 if test "X$warn" != X; then
4389 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4390 fi
4391 done
4392 $rm -f try try.*
4393esac
2304df62 4394
bd9b35c9
JH
4395: What should the include directory be ?
4396echo " "
4397$echo $n "Hmm... $c"
4398dflt='/usr/include'
4399incpath=''
4400mips_type=''
4401if $test -f /bin/mips && /bin/mips; then
4402 echo "Looks like a MIPS system..."
4403 $cat >usr.c <<'EOCP'
4404#ifdef SYSTYPE_BSD43
4405/bsd43
4406#endif
4407EOCP
8a27cf78 4408 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4409 dflt='/bsd43/usr/include'
4410 incpath='/bsd43'
4411 mips_type='BSD 4.3'
4412 else
4413 mips_type='System V'
4414 fi
4415 $rm -f usr.c usr.out
4416 echo "and you're compiling with the $mips_type compiler and libraries."
4417 xxx_prompt=y
4418 echo "exit 0" >mips
4419else
4420 echo "Doesn't look like a MIPS system."
4421 xxx_prompt=n
4422 echo "exit 1" >mips
4423fi
4424chmod +x mips
4425$eunicefix mips
4426case "$usrinc" in
4427'') ;;
4428*) dflt="$usrinc";;
4429esac
4430case "$xxx_prompt" in
4431y) fn=d/
4432 echo " "
4433 rp='Where are the include files you want to use?'
4434 . ./getfile
4435 usrinc="$ans"
8e07c86e 4436 ;;
bd9b35c9 4437*) usrinc="$dflt"
8e07c86e
AD
4438 ;;
4439esac
2304df62 4440
96056487
JH
4441: see how we invoke the C preprocessor
4442echo " "
4443echo "Now, how can we feed standard input to your C preprocessor..." >&4
4444cat <<'EOT' >testcpp.c
4445#define ABC abc
4446#define XYZ xyz
4447ABC.XYZ
4448EOT
4449cd ..
4450if test ! -f cppstdin; then
4451 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4452 # AIX cc -E doesn't show the absolute headerfile
4453 # locations but we'll cheat by using the -M flag.
4454 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
4455 else
4456 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4457 fi
4458else
4459 echo "Keeping your $hint cppstdin wrapper."
4460fi
4461chmod 755 cppstdin
4462wrapper=`pwd`/cppstdin
4463ok='false'
4464cd UU
4465
4466if $test "X$cppstdin" != "X" && \
4467 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4468 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4469then
4470 echo "You used to use $cppstdin $cppminus so we'll use that again."
4471 case "$cpprun" in
4472 '') echo "But let's see if we can live without a wrapper..." ;;
4473 *)
4474 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4475 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4476 then
4477 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4478 ok='true'
4479 else
4480 echo "(However, $cpprun $cpplast does not work, let's see...)"
4481 fi
4482 ;;
4483 esac
4484else
4485 case "$cppstdin" in
4486 '') ;;
4487 *)
4488 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4489 ;;
4490 esac
4491fi
4492
4493if $ok; then
4494 : nothing
4495elif echo 'Maybe "'"$cc"' -E" will work...'; \
4496 $cc -E <testcpp.c >testcpp.out 2>&1; \
4497 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4498 echo "Yup, it does."
4499 x_cpp="$cc -E"
4500 x_minus='';
4501elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4502 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4503 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4504 echo "Yup, it does."
4505 x_cpp="$cc -E"
4506 x_minus='-';
4507elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4508 $cc -P <testcpp.c >testcpp.out 2>&1; \
4509 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4510 echo "Yipee, that works!"
4511 x_cpp="$cc -P"
4512 x_minus='';
4513elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4514 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4515 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4516 echo "At long last!"
4517 x_cpp="$cc -P"
4518 x_minus='-';
4519elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4520 $cpp <testcpp.c >testcpp.out 2>&1; \
4521 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4522 echo "It works!"
4523 x_cpp="$cpp"
4524 x_minus='';
4525elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4526 $cpp - <testcpp.c >testcpp.out 2>&1; \
4527 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4528 echo "Hooray, it works! I was beginning to wonder."
4529 x_cpp="$cpp"
4530 x_minus='-';
4531elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4532 $wrapper <testcpp.c >testcpp.out 2>&1; \
4533 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4534 x_cpp="$wrapper"
4535 x_minus=''
4536 echo "Eureka!"
4537else
4538 dflt=''
4539 rp="No dice. I can't find a C preprocessor. Name one:"
4540 . ./myread
4541 x_cpp="$ans"
4542 x_minus=''
4543 $x_cpp <testcpp.c >testcpp.out 2>&1
4544 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4545 echo "OK, that will do." >&4
4546 else
4547echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4548 exit 1
4549 fi
4550fi
4551
4552case "$ok" in
4553false)
4554 cppstdin="$x_cpp"
4555 cppminus="$x_minus"
4556 cpprun="$x_cpp"
4557 cpplast="$x_minus"
4558 set X $x_cpp
4559 shift
4560 case "$1" in
4561 "$cpp")
4562 echo "Perhaps can we force $cc -E using a wrapper..."
4563 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4564 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4565 then
4566 echo "Yup, we can."
4567 cppstdin="$wrapper"
4568 cppminus='';
4569 else
4570 echo "Nope, we'll have to live without it..."
4571 fi
4572 ;;
4573 esac
4574 case "$cpprun" in
4575 "$wrapper")
4576 cpprun=''
4577 cpplast=''
4578 ;;
4579 esac
4580 ;;
4581esac
4582
4583case "$cppstdin" in
4584"$wrapper"|'cppstdin') ;;
4585*) $rm -f $wrapper;;
4586esac
4587$rm -f testcpp.c testcpp.out
4588
bd9b35c9
JH
4589: Set private lib path
4590case "$plibpth" in
4591'') if ./mips; then
4592 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4593 fi;;
4594esac
4595case "$libpth" in
4596' ') dlist='';;
4597'') dlist="$loclibpth $plibpth $glibpth";;
4598*) dlist="$libpth";;
4599esac
4600
4601: Now check and see which directories actually exist, avoiding duplicates
4602libpth=''
4603for xxx in $dlist
4604do
4605 if $test -d $xxx; then
4606 case " $libpth " in
4607 *" $xxx "*) ;;
4608 *) libpth="$libpth $xxx";;
4609 esac
4610 fi
4611done
4612$cat <<'EOM'
4613
4614Some systems have incompatible or broken versions of libraries. Among
4615the directories listed in the question below, please remove any you
4616know not to be holding relevant libraries, and add any that are needed.
4617Say "none" for none.
8e07c86e
AD
4618
4619EOM
bd9b35c9
JH
4620case "$libpth" in
4621'') dflt='none';;
8e07c86e 4622*)
bd9b35c9
JH
4623 set X $libpth
4624 shift
4625 dflt=${1+"$@"}
8e07c86e 4626 ;;
a0d0e21e 4627esac
bd9b35c9
JH
4628rp="Directories to use for library searches?"
4629. ./myread
4630case "$ans" in
4631none) libpth=' ';;
4632*) libpth="$ans";;
4633esac
a0d0e21e 4634
bd9b35c9
JH
4635: compute shared library extension
4636case "$so" in
4637'')
4638 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4639 dflt='sl'
dd4e71fd 4640 else
bd9b35c9 4641 dflt='so'
dd4e71fd
JH
4642 fi
4643 ;;
bd9b35c9 4644*) dflt="$so";;
dd4e71fd 4645esac
dd4e71fd
JH
4646$cat <<EOM
4647
bd9b35c9 4648On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4649you want to suppress searching of shared libraries for the remainder
bd9b35c9 4650of this configuration.
dd4e71fd
JH
4651
4652EOM
bd9b35c9
JH
4653rp='What is the file extension used for shared libraries?'
4654. ./myread
4655so="$ans"
dd4e71fd 4656
bd9b35c9
JH
4657: Define several unixisms.
4658: Hints files or command line option can be used to override them.
4659: The convoluted testing is in case hints files set either the old
4660: or the new name.
4661case "$_exe" in
4662'') case "$exe_ext" in
1fef16b3 4663 '') ;;
bd9b35c9 4664 *) _exe="$exe_ext" ;;
dd4e71fd 4665 esac
bd9b35c9 4666 ;;
bfb7748a 4667esac
bd9b35c9
JH
4668case "$_a" in
4669'') case "$lib_ext" in
4670 '') _a='.a';;
4671 *) _a="$lib_ext" ;;
dd4e71fd
JH
4672 esac
4673 ;;
dd4e71fd 4674esac
bd9b35c9
JH
4675case "$_o" in
4676'') case "$obj_ext" in
4677 '') _o='.o';;
4678 *) _o="$obj_ext";;
4679 esac
4680 ;;
4681esac
4682case "$p_" in
4683'') case "$path_sep" in
4684 '') p_=':';;
4685 *) p_="$path_sep";;
4686 esac
4687 ;;
4688esac
4689exe_ext=$_exe
4690lib_ext=$_a
4691obj_ext=$_o
4692path_sep=$p_
dd4e71fd 4693
b4eb6b3d
JH
4694: Which makefile gets called first. This is used by make depend.
4695case "$firstmakefile" in
4696'') firstmakefile='makefile';;
4633a7c4 4697esac
4633a7c4 4698
5a29c6bc
JH
4699case "$ccflags" in
4700*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4701esac
4702
4703case "$uselongdouble" in
4704$define|true|[yY]*) dflt='y';;
4705*) dflt='n';;
4706esac
4707cat <<EOM
4708
4709Perl can be built to take advantage of long doubles which
4710(if available) may give more accuracy and range for floating point numbers.
4711
4712If this doesn't make any sense to you, just accept the default '$dflt'.
4713EOM
4714rp='Try to use long doubles if available?'
4715. ./myread
4716case "$ans" in
4717y|Y) val="$define" ;;
4718*) val="$undef" ;;
4719esac
4720set uselongdouble
4721eval $setvar
4722
4723case "$uselongdouble" in
4724true|[yY]*) uselongdouble="$define" ;;
4725esac
4726
5a29c6bc
JH
4727: Look for a hint-file generated 'call-back-unit'. If the
4728: user has specified that long doubles should be used,
4729: we may need to set or change some other defaults.
6bd2d01f
NC
4730if $test -f uselongdouble.cbu; then
4731 echo "Your platform has some specific hints regarding long doubles, using them..."
4732 . ./uselongdouble.cbu
4733else
4734 case "$uselongdouble" in
4735 $define)
5a29c6bc 4736 $cat <<EOM
6bd2d01f 4737(Your platform does not have any specific hints for long doubles.)
5a29c6bc 4738EOM
5a29c6bc 4739 ;;
6bd2d01f
NC
4740 esac
4741fi
5a29c6bc 4742
bd9b35c9
JH
4743: Looking for optional libraries
4744echo " "
4745echo "Checking for optional libraries..." >&4
4746case "$libs" in
4747' '|'') dflt='';;
4748*) dflt="$libs";;
4749esac
4750case "$libswanted" in
4751'') libswanted='c_s';;
4752esac
4753case "$usesocks" in
923fc586 4754"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4755esac
68435ea7
JH
4756libsfound=''
4757libsfiles=''
4758libsdirs=''
13b3f787
JH
4759libspath=''
4760for thisdir in $libpth $xlibpth; do
4761 test -d $thisdir && libspath="$libspath $thisdir"
4762done
bd9b35c9 4763for thislib in $libswanted; do
13b3f787 4764 for thisdir in $libspath; do
f7dd4e7f
JH
4765 xxx=''
4766 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4767 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4768 $test -f "$xxx" && eval $libscheck
4769 $test -f "$xxx" && libstyle=shared
4770 fi
4771 if test ! -f "$xxx"; then
4772 xxx=$thisdir/lib$thislib.$so
4773 $test -f "$xxx" && eval $libscheck
4774 $test -f "$xxx" && libstyle=shared
4775 fi
4776 if test ! -f "$xxx"; then
4777 xxx=$thisdir/lib$thislib$_a
4778 $test -f "$xxx" && eval $libscheck
4779 $test -f "$xxx" && libstyle=static
4780 fi
4781 if test ! -f "$xxx"; then
4782 xxx=$thisdir/$thislib$_a
4783 $test -f "$xxx" && eval $libscheck
4784 $test -f "$xxx" && libstyle=static
4785 fi
4786 if test ! -f "$xxx"; then
4787 xxx=$thisdir/lib${thislib}_s$_a
4788 $test -f "$xxx" && eval $libscheck
4789 $test -f "$xxx" && libstyle=static
09ea5ba9 4790 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4791 fi
4792 if test ! -f "$xxx"; then
4793 xxx=$thisdir/Slib$thislib$_a
4794 $test -f "$xxx" && eval $libscheck
4795 $test -f "$xxx" && libstyle=static
4796 fi
4797 if $test -f "$xxx"; then
43999f95 4798 case "$libstyle" in
f7dd4e7f
JH
4799 shared) echo "Found -l$thislib (shared)." ;;
4800 static) echo "Found -l$thislib." ;;
4801 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4802 esac
bd9b35c9
JH
4803 case " $dflt " in
4804 *"-l$thislib "*);;
f7dd4e7f 4805 *) dflt="$dflt -l$thislib"
43999f95
JH
4806 libsfound="$libsfound $xxx"
4807 yyy=`basename $xxx`
4808 libsfiles="$libsfiles $yyy"
1e127011 4809 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4810 case " $libsdirs " in
4811 *" $yyy "*) ;;
4812 *) libsdirs="$libsdirs $yyy" ;;
4813 esac
4814 ;;
bd9b35c9 4815 esac
f7dd4e7f
JH
4816 break
4817 fi
4818 done
4819 if $test ! -f "$xxx"; then
4820 echo "No -l$thislib."
bd9b35c9
JH
4821 fi
4822done
4823set X $dflt
4824shift
4825dflt="$*"
4826case "$libs" in
4827'') dflt="$dflt";;
4828*) dflt="$libs";;
4829esac
4830case "$dflt" in
4831' '|'') dflt='none';;
4832esac
4633a7c4 4833
bd9b35c9 4834$cat <<EOM
4633a7c4 4835
bd9b35c9
JH
4836In order to compile $package on your machine, a number of libraries
4837are usually needed. Include any other special libraries here as well.
4838Say "none" for none. The default list is almost always right.
8e07c86e 4839EOM
8e07c86e 4840
bd9b35c9
JH
4841echo " "
4842rp="What libraries to use?"
4843. ./myread
4844case "$ans" in
4845none) libs=' ';;
4846*) libs="$ans";;
4847esac
d71b2b6b 4848
bd9b35c9
JH
4849: determine optimization, if desired, or use for debug flag also
4850case "$optimize" in
4851' '|$undef) dflt='none';;
4852'') dflt='-O';;
4853*) dflt="$optimize";;
4854esac
4855$cat <<EOH
d71b2b6b 4856
bd9b35c9
JH
4857By default, $package compiles with the -O flag to use the optimizer.
4858Alternately, you might want to use the symbolic debugger, which uses
4859the -g flag (on traditional Unix systems). Either flag can be
4860specified here. To use neither flag, specify the word "none".
d71b2b6b 4861
bd9b35c9
JH
4862EOH
4863rp="What optimizer/debugger flag should be used?"
4864. ./myread
4865optimize="$ans"
4866case "$optimize" in
4867'none') optimize=" ";;
4868esac
4869
07ddae43
NC
4870: Check what DEBUGGING is required from the command line
4871: -DEBUGGING or -DDEBUGGING or
4872: -DEBUGGING=both = -g + -DDEBUGGING
4873: -DEBUGGING=-g or -Doptimize=-g = -g
4874: -DEBUGGING=none or -UDEBUGGING =
4875: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
4876case "$EBUGGING" in
4877'') ;;
4878*) DEBUGGING=$EBUGGING ;;
4879esac
4880
4881case "$DEBUGGING" in
4882-g|$define)
4883 case "$optimize" in
4884 *-g*) ;;
4885 *) optimize="$optimize -g" ;;
4886 esac ;;
4887none|$undef)
4888 case "$optimize" in
4889 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
4890 shift
4891 optimize="$*"
4892 ;;
4893 esac ;;
4894esac
4895
bd9b35c9 4896dflt=''
07ddae43
NC
4897case "$DEBUGGING" in
4898both|$define) dflt='-DDEBUGGING'
4899esac
4900
bd9b35c9
JH
4901: We will not override a previous value, but we might want to
4902: augment a hint file
4903case "$hint" in
4904default|recommended)
4905 case "$gccversion" in
07ddae43 4906 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 4907 esac
07ddae43
NC
4908 case "$optimize:$DEBUGGING" in
4909 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4910 esac
bd9b35c9
JH
4911 case "$gccversion" in
4912 2*) if test -d /etc/conf/kconfig.d &&
4913 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4914 then
7db0018a 4915 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4916 dflt="$dflt -posix"
4917 fi
f0d04425 4918 ;;
bd9b35c9
JH
4919 esac
4920 case "$gccversion" in
4921 1*) ;;
4922 2.[0-8]*) ;;
4923 ?*) echo " "
4924 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4925 echo 'int main(void) { return 0; }' > gcctest.c
4926 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4927 echo "Yes, it does." 2>&1
4928 case "$ccflags" in
7db0018a 4929 *strict-aliasing*)
bd9b35c9
JH
4930 echo "Leaving current flags $ccflags alone." 2>&1
4931 ;;
4932 *) dflt="$dflt -fno-strict-aliasing" ;;
4933 esac
4934 else
4935 echo "Nope, it doesn't, but that's ok." 2>&1
4936 fi
f0d04425 4937 ;;
e5e20432 4938 esac
7db0018a
AD
4939 # For gcc, adding -pipe speeds up compilations for some, but apparently
4940 # some assemblers can't read from stdin. (It also slows down compilations
4941 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4942 case "$gccversion" in
4943 ?*) echo " "
4944 echo "Checking if your compiler accepts -pipe" 2>&1
4945 echo 'int main(void) { return 0; }' > gcctest.c
3bf3851b 4946 if $cc -pipe -o gcctest gcctest.c; then
7db0018a
AD
4947 echo "Yes, it does." 2>&1
4948 case "$ccflags" in
4949 *-pipe*)
4950 echo "Leaving current flags $ccflags alone." 2>&1
4951 ;;
4952 *) dflt="$dflt -pipe" ;;
4953 esac
4954 else
4955 echo "Nope, it doesn't, but that's ok." 2>&1
4956 fi
3bf3851b
NC
4957
4958 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4959 echo 'int main(void) { return 0; }' > gcctest.c
4960 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4961 echo "Yes, it does." 2>&1
4962 case "$ccflags" in
4963 *-Wdeclaration-after-statement*)
4964 echo "Leaving current flags $ccflags alone." 2>&1
4965 ;;
4966 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4967 esac
4968 else
4969 echo "Nope, it doesn't, but that's ok." 2>&1
4970 fi
7db0018a
AD
4971 ;;
4972 esac
e5e20432
JH
4973 ;;
4974esac
4975
bd9b35c9
JH
4976case "$mips_type" in
4977*BSD*|'') inclwanted="$locincpth $usrinc";;
4978*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4979esac
4980for thisincl in $inclwanted; do
4981 if $test -d $thisincl; then
4982 if $test x$thisincl != x$usrinc; then
4983 case "$dflt" in
7db0018a
AD
4984 *" -I$thisincl "*);;
4985 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4986 esac
4987 fi
4988 fi
4989done
40a7a20a 4990
bd9b35c9
JH
4991inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4992 xxx=true;
4993elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4994 xxx=true;
4995else
4996 xxx=false;
4997fi;
4998if $xxx; then
4999 case "$dflt" in
5000 *$2*);;
5001 *) dflt="$dflt -D$2";;
5002 esac;
5003fi'
40a7a20a 5004
bd9b35c9 5005set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5006
bd9b35c9
JH
5007case "$usesocks" in
5008$define)
5009 ccflags="$ccflags -DSOCKS"
5010 ;;
5011esac
40a7a20a 5012
bd9b35c9
JH
5013case "$hint" in
5014default|recommended) dflt="$ccflags $dflt" ;;
5015*) dflt="$ccflags";;
5016esac
40a7a20a 5017
bd9b35c9
JH
5018case "$dflt" in
5019''|' ') dflt=none;;
5020esac
422af00a 5021
bd9b35c9 5022$cat <<EOH
40a7a20a 5023
bd9b35c9
JH
5024Your C compiler may want other flags. For this question you should include
5025-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5026but you should NOT include libraries or ld flags like -lwhatever. If you
5027want $package to honor its debug switch, you should include -DDEBUGGING here.
5028Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5029
bd9b35c9 5030To use no flags, specify the word "none".
40a7a20a 5031
bd9b35c9
JH
5032EOH
5033set X $dflt
5034shift
5035dflt=${1+"$@"}
5036rp="Any additional cc flags?"
5037. ./myread
5038case "$ans" in
5039none) ccflags='';;
5040*) ccflags="$ans";;
5041esac
8e07c86e 5042
bd9b35c9 5043: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5044case "$cppflags" in
5045'') cppflags="$ccflags" ;;
5046*) cppflags="$cppflags $ccflags" ;;
5047esac
bd9b35c9
JH
5048case "$gccversion" in
50491*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5050esac
bd9b35c9
JH
5051case "$mips_type" in
5052'');;
5053*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5054esac
5055case "$cppflags" in
5056'');;
5057*)
5058 echo " "
5059 echo "Let me guess what the preprocessor flags are..." >&4
5060 set X $cppflags
5061 shift
5062 cppflags=''
5063 $cat >cpp.c <<'EOM'
5064#define BLURFL foo
8e07c86e 5065
bd9b35c9
JH
5066BLURFL xx LFRULB
5067EOM
5068 previous=''
5069 for flag in $*
5070 do
5071 case "$flag" in
5072 -*) ftry="$flag";;
5073 *) ftry="$previous $flag";;
5074 esac
5075 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5076 >cpp1.out 2>/dev/null && \
5077 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5078 >cpp2.out 2>/dev/null && \
5079 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5080 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5081 then
5082 cppflags="$cppflags $ftry"
5083 previous=''
5084 else
5085 previous="$flag"
5086 fi
5087 done
5088 set X $cppflags
5089 shift
5090 cppflags=${1+"$@"}
5091 case "$cppflags" in
5092 *-*) echo "They appear to be: $cppflags";;
5093 esac
5094 $rm -f cpp.c cpp?.out
2afac517 5095 ;;
5096esac
8e07c86e 5097
bd9b35c9
JH
5098: flags used in final linking phase
5099case "$ldflags" in
5100'') if ./venix; then
5101 dflt='-i -z'
10a23457 5102 else
bd9b35c9 5103 dflt=''
10a23457 5104 fi
bd9b35c9
JH
5105 case "$ccflags" in
5106 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5107 esac
bd9b35c9
JH
5108 ;;
5109*) dflt="$ldflags";;
5110esac
5111
5112: Try to guess additional flags to pick up local libraries.
5113for thislibdir in $libpth; do
5114 case " $loclibpth " in
5115 *" $thislibdir "*)
7db0018a 5116 case "$dflt " in
bd9b35c9
JH
5117 *"-L$thislibdir "*) ;;
5118 *) dflt="$dflt -L$thislibdir" ;;
5119 esac
c4f23d77
AD
5120 ;;
5121 esac
bd9b35c9 5122done
c4f23d77 5123
bd9b35c9
JH
5124case "$dflt" in
5125'') dflt='none' ;;
5126esac
c4f23d77 5127
bd9b35c9
JH
5128$cat <<EOH
5129
5130Your C linker may need flags. For this question you should
5131include -L/whatever and any other flags used by the C linker, but you
5132should NOT include libraries like -lwhatever.
5133
5134Make sure you include the appropriate -L/path flags if your C linker
5135does not normally search all of the directories you specified above,
5136namely
5137 $libpth
5138To use no flags, specify the word "none".
5139
5140EOH
5141
5142rp="Any additional ld flags (NOT including libraries)?"
5143. ./myread
5144case "$ans" in
5145none) ldflags='';;
5146*) ldflags="$ans";;
5147esac
5148rmlist="$rmlist pdp11"
5149
5150: coherency check
5151echo " "
5152echo "Checking your choice of C compiler and flags for coherency..." >&4
5153$cat > try.c <<'EOF'
5154#include <stdio.h>
5a29c6bc 5155int main() { printf("Ok\n"); return(0); }
bd9b35c9 5156EOF
7a282f6d 5157set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5158shift
5159$cat >try.msg <<'EOM'
5160I've tried to compile and run the following simple program:
5161
5162EOM
5163$cat try.c >> try.msg
5164
5165$cat >> try.msg <<EOM
5166
5167I used the command:
5168
5169 $*
5440bc8e 5170 $run ./try
bd9b35c9
JH
5171
5172and I got the following output:
5173
5174EOM
5175dflt=y
73614538 5176if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5177 if $sh -c "$run ./try" >>try.msg 2>&1; then
5178 xxx=`$run ./try`
bd9b35c9
JH
5179 case "$xxx" in
5180 "Ok") dflt=n ;;
5181 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5182 case " $libs " in
5183 *" -lsfio "*)
5184 cat >> try.msg <<'EOQS'
5185If $libs contains -lsfio, and sfio is mis-configured, then it
5186sometimes (apparently) runs and exits with a 0 status, but with no
5187output! It may have to do with sfio's use of _exit vs. exit.
5188
5189EOQS
5190 rp="You have a big problem. Shall I abort Configure"
5191 dflt=y
5192 ;;
5193 esac
5194 ;;
5195 esac
5196 else
5197 echo "The program compiled OK, but exited with status $?." >>try.msg
5198 rp="You have a problem. Shall I abort Configure"
5199 dflt=y
5200 fi
5201else
5202 echo "I can't compile the test program." >>try.msg
5203 rp="You have a BIG problem. Shall I abort Configure"
5204 dflt=y
5205fi
5206case "$dflt" in
5207y)
5208 $cat try.msg >&4
5209 case "$knowitall" in
5210 '')
5211 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5212 ;;
bd9b35c9 5213 *) dflt=n;;
c4f23d77 5214 esac
bd9b35c9
JH
5215 echo " "
5216 . ./myread
5217 case "$ans" in
5218 n*|N*) ;;
5219 *) echo "Ok. Stopping Configure." >&4
5220 exit 1
c4f23d77
AD
5221 ;;
5222 esac
5223 ;;
bd9b35c9 5224n) echo "OK, that should do.";;
c4f23d77 5225esac
bd9b35c9 5226$rm -f try try.* core
c4f23d77 5227
bd9b35c9
JH
5228: define a shorthand compile call
5229compile='
5230mc_file=$1;
5231shift;
08413ebc 5232$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5233: define a shorthand compile call for compilations that should be ok.
5234compile_ok='
5235mc_file=$1;
5236shift;
7a282f6d 5237$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5238
8dfa8df9
JH
5239: determine filename position in cpp output
5240echo " "
5241echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5242case "$osname" in
5243vos) testaccess=-e ;;
5244*) testaccess=-r ;;
5245esac
8dfa8df9
JH
5246echo '#include <stdio.h>' > foo.c
5247$cat >fieldn <<EOF
5248$startsh
5249$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5250$grep '^[ ]*#.*stdio\.h' | \
5251while read cline; do
5252 pos=1
5253 set \$cline
5254 while $test \$# -gt 0; do
a5a94ea5 5255 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5256 echo "\$pos"
5257 exit 0
5258 fi
5259 shift
5260 pos=\`expr \$pos + 1\`
5261 done
5262done
5263EOF
5264chmod +x fieldn
5265fieldn=`./fieldn`
5266$rm -f foo.c fieldn
5267case $fieldn in
5268'') pos='???';;
52691) pos=first;;
52702) pos=second;;
52713) pos=third;;
5272*) pos="${fieldn}th";;
5273esac
5274echo "Your cpp writes the filename in the $pos field of the line."
5275
3c728e00
JH
5276case "$osname" in
5277vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
8257dec7 5278os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5279*) cppfilter='' ;;
5280esac
8dfa8df9
JH
5281: locate header file
5282$cat >findhdr <<EOF
5283$startsh
5284wanted=\$1
5285name=''
5286for usrincdir in $usrinc
5287do
5288 if test -f \$usrincdir/\$wanted; then
5289 echo "\$usrincdir/\$wanted"
5290 exit 0
5291 fi
5292done
5293awkprg='{ print \$$fieldn }'
5294echo "#include <\$wanted>" > foo\$\$.c
5295$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5296$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5297while read cline; do
5298 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5299 case "\$name" in
5300 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5301 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5302 *) exit 2;;
5303 esac;
5304done;
5305#
5306# status = 0: grep returned 0 lines, case statement not executed
5307# status = 1: headerfile found
5308# status = 2: while loop executed, no headerfile found
5309#
5310status=\$?
5311$rm -f foo\$\$.c;
5312if test \$status -eq 1; then
5313 exit 0;
5314fi
5315exit 1
5316EOF
5317chmod +x findhdr
5318
5319: define an alternate in-header-list? function
5320inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5321cont=true; xxf="echo \"<\$1> found.\" >&4";
5322case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5323*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5324esac;
5325case $# in 4) instead=instead;; *) instead="at last";; esac;
5326while $test "$cont"; do
5327 xxx=`./findhdr $1`
5328 var=$2; eval "was=\$$2";
5329 if $test "$xxx" && $test -r "$xxx";
5330 then eval $xxf;
5331 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5332 cont="";
5333 else eval $xxnf;
5334 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5335 set $yyy; shift; shift; yyy=$@;
5336 case $# in 0) cont="";;
5337 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5338 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5339 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5340 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5341 esac;
5342done;
5343while $test "$yyy";
5344do set $yyy; var=$2; eval "was=\$$2";
5345 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5346 set $yyy; shift; shift; yyy=$@;
5347done'
5348
5ed858ef
JH
5349: see if stdlib is available
5350set stdlib.h i_stdlib
5351eval $inhdr
5352
5353: check for lengths of integral types
5354echo " "
5355case "$intsize" in
5356'')
5357 echo "Checking to see how big your integers are..." >&4
2376c703 5358 $cat >try.c <<EOCP
5ed858ef
JH
5359#include <stdio.h>
5360#$i_stdlib I_STDLIB
5361#ifdef I_STDLIB
5362#include <stdlib.h>
5363#endif
5364int main()
5365{
5366 printf("intsize=%d;\n", (int)sizeof(int));
5367 printf("longsize=%d;\n", (int)sizeof(long));
5368 printf("shortsize=%d;\n", (int)sizeof(short));
5369 exit(0);
5370}
5371EOCP
5372 set try
5373 if eval $compile_ok && $run ./try > /dev/null; then
5374 eval `$run ./try`
5375 echo "Your integers are $intsize bytes long."
5376 echo "Your long integers are $longsize bytes long."
5377 echo "Your short integers are $shortsize bytes long."
5378 else
5379 $cat >&4 <<EOM
5380!
5381Help! I can't compile and run the intsize test program: please enlighten me!
5382(This is probably a misconfiguration in your system or libraries, and
5383you really ought to fix it. Still, I'll try anyway.)
5384!
5385EOM
5386 dflt=4
5387 rp="What is the size of an integer (in bytes)?"
5388 . ./myread
5389 intsize="$ans"
5390 dflt=$intsize
5391 rp="What is the size of a long integer (in bytes)?"
5392 . ./myread
5393 longsize="$ans"
5394 dflt=2
5395 rp="What is the size of a short integer (in bytes)?"
5396 . ./myread
5397 shortsize="$ans"
5398 fi
5399 ;;
5400esac
5401$rm -f try try.*
5402
5403: check for long long
5404echo " "
5405echo "Checking to see if you have long long..." >&4
5406echo 'int main() { long long x = 7; return 0; }' > try.c
5407set try
5408if eval $compile; then
5409 val="$define"
5410 echo "You have long long."
5411else
5412 val="$undef"
5413 echo "You do not have long long."
5414fi
5415$rm try.*
5416set d_longlong
5417eval $setvar
5418
5419: check for length of long long
5420case "${d_longlong}${longlongsize}" in
5421$define)
5422 echo " "
5423 echo "Checking to see how big your long longs are..." >&4
5424 $cat >try.c <<'EOCP'
5425#include <stdio.h>
5426int main()
5427{
5428 printf("%d\n", (int)sizeof(long long));
5429 return(0);
5430}
5431EOCP
5432 set try
5433 if eval $compile_ok; then
5434 longlongsize=`$run ./try`
5435 echo "Your long longs are $longlongsize bytes long."
5436 else
5437 dflt='8'
5438 echo " "
5439 echo "(I can't seem to compile the test program. Guessing...)"
5440 rp="What is the size of a long long (in bytes)?"
5441 . ./myread
5442 longlongsize="$ans"
5443 fi
5444 if $test "X$longsize" = "X$longlongsize"; then
5445 echo "(That isn't any different from an ordinary long.)"
5446 fi
5447 ;;
5448esac
5449$rm -f try.* try
5450
8dfa8df9
JH
5451: see if inttypes.h is available
5452: we want a real compile instead of Inhdr because some systems
5453: have an inttypes.h which includes non-existent headers
5454echo " "
5455$cat >try.c <<EOCP
5456#include <inttypes.h>
5457int main() {
5458 static int32_t foo32 = 0x12345678;
5459}
5460EOCP
5461set try
5462if eval $compile; then
5463 echo "<inttypes.h> found." >&4
5464 val="$define"
5465else
5466 echo "<inttypes.h> NOT found." >&4
5467 val="$undef"
5468fi
5469$rm -f try.c try
5470set i_inttypes
5471eval $setvar
5472
5473: check for int64_t
5474echo " "
5475echo "Checking to see if you have int64_t..." >&4
5476$cat >try.c <<EOCP
5477#include <sys/types.h>
5478#$i_inttypes I_INTTYPES
5479#ifdef I_INTTYPES
5480#include <inttypes.h>
5481#endif
5482int main() { int64_t x = 7; }
5483EOCP
5484set try
5485if eval $compile; then
5486 val="$define"
5487 echo "You have int64_t."
5488else
5489 val="$undef"
5490 echo "You do not have int64_t."
5491fi
5492$rm -f try try.*
5493set d_int64_t
5494eval $setvar
5495
5496
5497echo " "
5498echo "Checking which 64-bit integer type we could use..." >&4
5499
5500case "$intsize" in
55018) val=int
5502 set quadtype
5503 eval $setvar
5504 val='"unsigned int"'
5505 set uquadtype
5506 eval $setvar
5507 quadkind=1
5508 ;;
5509*) case "$longsize" in
5510 8) val=long
5511 set quadtype
5512 eval $setvar
5513 val='"unsigned long"'
5514 set uquadtype
5515 eval $setvar
5516 quadkind=2
5517 ;;
5518 *) case "$d_longlong:$longlongsize" in
5519 define:8)
5520 val='"long long"'
5521 set quadtype
5522 eval $setvar
5523 val='"unsigned long long"'
5524 set uquadtype
5525 eval $setvar
5526 quadkind=3
5527 ;;
5528 *) case "$d_int64_t" in
5529 define)
5530 val=int64_t
5531 set quadtype
5532 eval $setvar
5533 val=uint64_t
5534 set uquadtype
5535 eval $setvar
5536 quadkind=4
5537 ;;
5538 esac
5539 ;;
5540 esac
5541 ;;
5542 esac
5543 ;;
5544esac
5545
5546case "$quadtype" in
5547'') echo "Alas, no 64-bit integer types in sight." >&4
5548 d_quad="$undef"
5549 ;;
5550*) echo "We could use '$quadtype' for 64-bit integers." >&4
5551 d_quad="$define"
5552 ;;
5553esac
5554
b4eb6b3d
JH
5555
5556case "$uselonglong" in
5557"$define"|true|[yY]*)
5558 cat <<EOM >&4
5559
5560*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5561EOM
5562 use64bitint="$define"
5563 ;;
5564esac
5565case "$use64bits" in
5566"$define"|true|[yY]*)
5567 cat <<EOM >&4
5568
5569*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5570EOM
5571 use64bitint="$define"
5572 ;;
5573esac
5574case "$use64bitints" in
5575"$define"|true|[yY]*)
5576 cat <<EOM >&4
5577
5578*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5579EOM
5580 use64bitint="$define"
5581 ;;
5582esac
5583case "$use64bitsint" in
5584"$define"|true|[yY]*)
5585 cat <<EOM >&4
5586
5587*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5588EOM
5589 use64bitint="$define"
5590 ;;
5591esac
5592case "$uselonglongs" in
5593"$define"|true|[yY]*)
5594 cat <<EOM >&4
5595
5596*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5597EOM
5598 use64bitint="$define"
5599 ;;
5600esac
5601case "$use64bitsall" in
5602"$define"|true|[yY]*)
5603 cat <<EOM >&4
5604
5605*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5606EOM
5607 use64bitall="$define"
5608 ;;
5609esac
5610
5611case "$ccflags" in
5612*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5613esac
5614case "$use64bitall" in
5615"$define"|true|[yY]*) use64bitint="$define" ;;
5616esac
5617
5618case "$longsize" in
56198) cat <<EOM
5620
5621You have natively 64-bit long integers.
5622EOM
5623 val="$define"
5624 ;;
5625*) case "$use64bitint" in
5626 "$define"|true|[yY]*) dflt='y';;
5627 *) dflt='n';;
5628 esac
8dfa8df9
JH
5629 case "$d_quad" in
5630 "$define") ;;
5631 *) dflt='n' ;;
5632 esac
b4eb6b3d
JH
5633 cat <<EOM
5634
5635Perl can be built to take advantage of 64-bit integer types
5636on some systems. To do so, Configure can be run with -Duse64bitint.
5637Choosing this option will most probably introduce binary incompatibilities.
5638
5639If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5640(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5641EOM
5642 rp='Try to use 64-bit integers, if available?'
5643 . ./myread
5644 case "$ans" in
5645 [yY]*) val="$define" ;;
5646 *) val="$undef" ;;
5647 esac
5648 ;;
5649esac
5650set use64bitint
5651eval $setvar
5652
5653case "$use64bitall" in
5654"$define"|true|[yY]*) dflt='y' ;;
5655*) case "$longsize" in
5656 8) dflt='y' ;;
5657 *) dflt='n' ;;
5658 esac
5659 ;;
5660esac
5661cat <<EOM
5662
5663You may also choose to try maximal 64-bitness. It means using as much
566464-bitness as possible on the platform. This in turn means even more
5665binary incompatibilities. On the other hand, your platform may not
5666have any more 64-bitness available than what you already have chosen.
5667
5668If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5669(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5670EOM
5671rp='Try to use maximal 64-bit support, if available?'
5672. ./myread
5673case "$ans" in
5674[yY]*) val="$define" ;;
5675*) val="$undef" ;;
5676esac
5677set use64bitall
5678eval $setvar
5679case "$use64bitall" in
5680"$define")
5681 case "$use64bitint" in
5682 "$undef")
5683 cat <<EOM
5684
5685Since you have chosen a maximally 64-bit build, I'm also turning on
5686the use of 64-bit integers.
5687EOM
5688 use64bitint="$define" ;;
5689 esac
5690 ;;
5691esac
5692
b4eb6b3d
JH
5693: Look for a hint-file generated 'call-back-unit'. If the
5694: user has specified that a 64-bit perl is to be built,
5695: we may need to set or change some other defaults.
c53af328 5696if $test -f use64bitint.cbu; then
6bd2d01f 5697 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
c53af328
NC
5698 . ./use64bitint.cbu
5699fi
6bd2d01f
NC
5700case "$use64bitint" in
5701"$define"|true|[yY]*)
b4eb6b3d
JH
5702 case "$longsize" in
5703 4) case "$archname64" in
5704 '') archname64=64int ;;
5705 esac
5706 ;;
5707 esac
5708 ;;
5709esac
5710
b4eb6b3d
JH
5711: Look for a hint-file generated 'call-back-unit'. If the
5712: user has specified that a maximally 64-bit perl is to be built,
5713: we may need to set or change some other defaults.
c53af328 5714if $test -f use64bitall.cbu; then
6bd2d01f 5715 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
c53af328
NC
5716 . ./use64bitall.cbu
5717fi
6bd2d01f
NC
5718case "$use64bitall" in
5719"$define"|true|[yY]*)
b4eb6b3d
JH
5720 case "$longsize" in
5721 4) case "$archname64" in
5722 ''|64int) archname64=64all ;;
5723 esac
5724 ;;
5725 esac
5726 ;;
5727esac
5728
ff0950a8
JH
5729case "$d_quad:$use64bitint" in
5730$undef:$define)
5731 cat >&4 <<EOF
5732
5733*** You have chosen to use 64-bit integers,
c53af328 5734*** but none can be found.
ff0950a8
JH
5735*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5736*** Cannot continue, aborting.
5737
5738EOF
5739 exit 1
5740 ;;
5741esac
5742
5a29c6bc 5743: check for length of double
b4eb6b3d 5744echo " "
5a29c6bc
JH
5745case "$doublesize" in
5746'')
5747 echo "Checking to see how big your double precision numbers are..." >&4
5748 $cat >try.c <<EOCP
b4eb6b3d 5749#include <stdio.h>
5a29c6bc
JH
5750#$i_stdlib I_STDLIB
5751#ifdef I_STDLIB
5752#include <stdlib.h>
b4eb6b3d 5753#endif
5a29c6bc
JH
5754int main()
5755{
5756 printf("%d\n", (int)sizeof(double));
5757 exit(0);
b4eb6b3d 5758}
5f6e0ee4 5759EOCP
5a29c6bc
JH
5760 set try
5761 if eval $compile_ok; then
5762 doublesize=`$run ./try`
5763 echo "Your double is $doublesize bytes long."
5764 else
5765 dflt='8'
5766 echo "(I can't seem to compile the test program. Guessing...)"
5767 rp="What is the size of a double precision number (in bytes)?"
5768 . ./myread
5769 doublesize="$ans"
5770 fi
5771 ;;
5772esac
5773$rm -f try.c try
5774
5775: check for long doubles
5776echo " "
5777echo "Checking to see if you have long double..." >&4
5778echo 'int main() { long double x = 7.0; }' > try.c
5440bc8e 5779set try
5a29c6bc 5780if eval $compile; then
b4eb6b3d 5781 val="$define"
5a29c6bc 5782 echo "You have long double."
b4eb6b3d
JH
5783else
5784 val="$undef"
5a29c6bc 5785 echo "You do not have long double."
b4eb6b3d 5786fi
5a29c6bc
JH
5787$rm try.*
5788set d_longdbl
b4eb6b3d
JH
5789eval $setvar
5790
5a29c6bc
JH
5791: check for length of long double
5792case "${d_longdbl}${longdblsize}" in
5793$define)
5794 echo " "
5795 echo "Checking to see how big your long doubles are..." >&4
5796 $cat >try.c <<'EOCP'
5797#include <stdio.h>
5798int main()
5799{
5800 printf("%d\n", sizeof(long double));
5801}
5802EOCP
5803 set try
5804 set try
5805 if eval $compile; then
5806 longdblsize=`$run ./try`
5807 echo "Your long doubles are $longdblsize bytes long."
c1a7f87b 5808 else
5a29c6bc
JH
5809 dflt='8'
5810 echo " "
5811 echo "(I can't seem to compile the test program. Guessing...)" >&4
5812 rp="What is the size of a long double (in bytes)?"
5813 . ./myread
5814 longdblsize="$ans"
5815 fi
5816 if $test "X$doublesize" = "X$longdblsize"; then
5057be0e
JH
5817 echo "That isn't any different from an ordinary double."
5818 echo "I'll keep your setting anyway, but you may see some"
5819 echo "harmless compilation warnings."
5a29c6bc 5820 fi
c1a7f87b
JH
5821 ;;
5822esac
5a29c6bc 5823$rm -f try.* try
8e07c86e 5824
5a29c6bc 5825: determine the architecture name
c1a7f87b 5826echo " "
5a29c6bc
JH
5827if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5828 tarch=`arch`"-$osname"
5829elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5830 if uname -m > tmparch 2>&1 ; then
5831 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5832 -e 's/$/'"-$osname/" tmparch`
5833 else
5834 tarch="$osname"
5835 fi
5836 $rm -f tmparch
5837else
5838 tarch="$osname"
5839fi
5840case "$myarchname" in
5841''|"$tarch") ;;
5842*)
5843 echo "(Your architecture name used to be $myarchname.)"
5844 archname=''
ff935051
JH
5845 ;;
5846esac
5a29c6bc 5847case "$targetarch" in
c1a7f87b 5848'') ;;
5a29c6bc
JH
5849*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5850esac
5851myarchname="$tarch"
5852case "$archname" in
5853'') dflt="$tarch";;
5854*) dflt="$archname";;
5855esac
5856rp='What is your architecture name'
5857. ./myread
5858archname="$ans"
5859case "$usethreads" in
5860$define)
5861 echo "Threads selected." >&4
5862 case "$archname" in
5863 *-thread*) echo "...and architecture name already has -thread." >&4
5864 ;;
5865 *) archname="$archname-thread"
5866 echo "...setting architecture name to $archname." >&4
5867 ;;
5868 esac
5869 ;;
5870esac
5871case "$usemultiplicity" in
5872$define)
5873 echo "Multiplicity selected." >&4
5874 case "$archname" in
5875 *-multi*) echo "...and architecture name already has -multi." >&4
5876 ;;
5877 *) archname="$archname-multi"
5878 echo "...setting architecture name to $archname." >&4
5879 ;;
5880 esac
5881 ;;
5882esac
5883case "$use64bitint$use64bitall" in
5884*"$define"*)
5885 case "$archname64" in
5886 '')
5887 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
c1a7f87b 5888 ;;
5a29c6bc
JH
5889 *)
5890 case "$use64bitint" in
5891 "$define") echo "64 bit integers selected." >&4 ;;
5892 esac
5893 case "$use64bitall" in
5894 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5895 esac
5896 case "$archname" in
5897 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5898 ;;
5899 *) archname="$archname-$archname64"
5900 echo "...setting architecture name to $archname." >&4
5901 ;;
5902 esac
5903 ;;
5904 esac
5905esac
5906case "$uselongdouble" in
5907$define)
5908 echo "Long doubles selected." >&4
5909 case "$longdblsize" in
5910 $doublesize)
5911 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5912 ;;
5913 *)
5914 case "$archname" in
5915 *-ld*) echo "...and architecture name already has -ld." >&4
5916 ;;
5917 *) archname="$archname-ld"
de7128ac
NC
5918 echo "...setting architecture name to $archname." >&4
5919 ;;
5920 esac
5921 ;;
b4eb6b3d 5922 esac
de7128ac
NC
5923 ;;
5924esac
5925case "$useperlio" in
5926$define)
5927 echo "Perlio selected." >&4
5928 ;;
5929*)
5930 echo "Perlio not selected, using stdio." >&4
5931 case "$archname" in
5932 *-stdio*) echo "...and architecture name already has -stdio." >&4
5933 ;;
5934 *) archname="$archname-stdio"
5935 echo "...setting architecture name to $archname." >&4
5936 ;;
5937 esac
5938 ;;
5939esac
5940if $test -f archname.cbu; then
5941 echo "Your platform has some specific hints for architecture name, using them..."
5942 . ./archname.cbu
b4eb6b3d 5943fi
b4eb6b3d
JH
5944
5945: set the prefixit variable, to compute a suitable default value
5946prefixit='case "$3" in
5947""|none)
5948 case "$oldprefix" in
5949 "") eval "$1=\"\$$2\"";;
5950 *)
5951 case "$3" in
5952 "") eval "$1=";;
5953 none)
5954 eval "tp=\"\$$2\"";
5955 case "$tp" in
5956 ""|" ") eval "$1=\"\$$2\"";;
5957 *) eval "$1=";;
5958 esac;;
5959 esac;;
5960 esac;;
5961*)
5962 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5963 case "$tp" in
5964 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5965 /*-$oldprefix/*|\~*-$oldprefix/*)
5966 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5967 *) eval "$1=\"\$$2\"";;
5968 esac;;
5969esac'
5970
b4eb6b3d
JH
5971: get the patchlevel
5972echo " "
5973echo "Getting the current patchlevel..." >&4
5974if $test -r $rsrc/patchlevel.h;then
5975 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5976 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5977 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5978 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5979 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5980 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
d1766b33 5981 perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5982else
5983 revision=0
5984 patchlevel=0
5985 subversion=0
5986 api_revision=0
5987 api_version=0
5988 api_subversion=0
151e6568
MB
5989 perl_patchlevel=0
5990 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5991fi
d1766b33
NC
5992if $test -r $rsrc/.patch ; then
5993 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
151e6568
MB
5994 perl_patchlevel=`cat $rsrc/.patch`
5995 fi
5996fi
861eb78d
AD
5997: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5998version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5999case "$perl_patchlevel" in
861eb78d
AD
60000|'') ;;
6001*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 6002esac
861eb78d
AD
6003
6004$echo "(You have $package $version_patchlevel_string.)"
6005
b4eb6b3d
JH
6006case "$osname" in
6007dos|vms)
6008 : XXX Should be a Configure test for double-dots in filenames.
6009 version=`echo $revision $patchlevel $subversion | \
6010 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6011 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6012 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6013 ;;
6014*)
6015 version=`echo $revision $patchlevel $subversion | \
6016 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6017 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6018 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6019 ;;
6020esac
6021: Special case the 5.005_xx maintenance series, which used 5.005
6022: without any subversion label as a subdirectory in $sitelib
6023if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6024 api_versionstring='5.005'
6025fi
6026
6027: determine installation style
6028: For now, try to deduce it from prefix unless it is already set.
6029: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6030case "$installstyle" in
6031'') case "$prefix" in
6032 *perl*) dflt='lib';;
6033 *) dflt='lib/perl5' ;;
6034 esac
6035 ;;
6036*) dflt="$installstyle" ;;
6037esac
6038: Probably not worth prompting for this since we prompt for all
6039: the directories individually, and the prompt would be too long and
6040: confusing anyway.
6041installstyle=$dflt
6042
de7128ac
NC
6043: determine where public executables go
6044echo " "
6045set dflt bin bin
6046eval $prefixit
6047fn=d~
6048rp='Pathname where the public executables will reside?'
6049. ./getfile
6050if $test "X$ansexp" != "X$binexp"; then
6051 installbin=''
6052fi
6053prefixvar=bin
6054: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6055: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
74950343 6056: this via initialinstalllocation
de7128ac
NC
6057. ./setprefixvar
6058
6059case "$userelocatableinc" in
6060$define|true|[yY]*) dflt='y' ;;
6061*) dflt='n' ;;
6062esac
6063cat <<EOM
6064
6065Would you like to build Perl so that the installation is relocatable, so that
6066library paths in @INC are determined relative to the path of the perl binary?
6067This is not advised for system Perl installs, or if you need to run setid
6068scripts or scripts under taint mode.
6069
6070If this doesn't make any sense to you, just accept the default '$dflt'.
6071EOM
6072rp='Use relocatable @INC?'
6073. ./myread
6074case "$ans" in
6075y|Y) val="$define" ;;
6076*) val="$undef" ;;
6077esac
6078set userelocatableinc
6079eval $setvar
6080
74950343 6081initialinstalllocation="$binexp"
de7128ac
NC
6082: Default prefix is now "up one level from where the binaries are"
6083case "$userelocatableinc" in
6084$define|true|[yY]*)
de7128ac
NC
6085 bin=".../"
6086 binexp=".../"
6087 prefix=".../.."
6088 prefixexp=".../.."
6089 installprefixexp=".../.."
6090 ;;
6091esac
6092
b4eb6b3d
JH
6093: determine where private library files go
6094: Usual default is /usr/local/lib/perl5/$version.
de7128ac 6095: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6096: /opt/perl/lib/perl5... would be redundant.
6097: The default "style" setting is made in installstyle.U
6098case "$installstyle" in
6099*lib/perl5*) set dflt privlib lib/$package/$version ;;
6100*) set dflt privlib lib/$version ;;
6101esac
6102eval $prefixit
6103$cat <<EOM
6104
6105There are some auxiliary files for $package that need to be put into a
6106private library directory that is accessible by everyone.
6107
6108EOM
07ddae43 6109fn=$binexp
b4eb6b3d
JH
6110fn=d~+
6111rp='Pathname where the private library files will reside?'
6112. ./getfile
de7128ac
NC
6113prefixvar=privlib
6114. ./setprefixvar
b4eb6b3d
JH
6115
6116: set the prefixup variable, to restore leading tilda escape
6117prefixup='case "$prefixexp" in
6118"$prefix") ;;
6119*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6120esac'
6121
6122: determine where public architecture dependent libraries go
6123set archlib archlib
6124eval $prefixit
6125: privlib default is /usr/local/lib/$package/$version
6126: archlib default is /usr/local/lib/$package/$version/$archname
6127: privlib may have an optional trailing /share.
6128tdflt=`echo $privlib | $sed 's,/share$,,'`
6129tdflt=$tdflt/$archname
6130case "$archlib" in
6131'') dflt=$tdflt
6132 ;;
6133*) dflt="$archlib"
6134 ;;
6135esac
6136$cat <<EOM
6137
6138$spackage contains architecture-dependent library files. If you are
6139sharing libraries in a heterogeneous environment, you might store
6140these files in a separate location. Otherwise, you can just include
6141them with the rest of the public library files.
6142
6143EOM
07ddae43 6144fn=$binexp
b4eb6b3d
JH
6145fn=d+~
6146rp='Where do you want to put the public architecture-dependent libraries?'
6147. ./getfile
de7128ac
NC
6148prefixvar=archlib
6149. ./setprefixvar
b4eb6b3d
JH
6150if $test X"$archlib" = X"$privlib"; then
6151 d_archlib="$undef"
6152else
6153 d_archlib="$define"
6154fi
b4eb6b3d 6155
b4eb6b3d
JH
6156: see if setuid scripts can be secure
6157$cat <<EOM
6158
6159Some kernels have a bug that prevents setuid #! scripts from being
6160secure. Some sites have disabled setuid #! scripts because of this.
6161
6162First let's decide if your kernel supports secure setuid #! scripts.
6163(If setuid #! scripts would be secure but have been disabled anyway,
6164don't say that they are secure if asked.)
6165
de7128ac
NC
6166EOM
6167
6168val="$undef"
6169if $test -d /dev/fd; then
6170 echo "#!$ls" >reflect
6171 chmod +x,u+s reflect
6172 ./reflect >flect 2>&1
6173 if $contains "/dev/fd" flect >/dev/null; then
6174 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6175 val="$define"
6176 else
6177 $cat <<EOM
6178If you are not sure if they are secure, I can check but I'll need a
6179username and password different from the one you are using right now.
6180If you don't have such a username or don't want me to test, simply
6181enter 'none'.
6182
6183EOM
6184 rp='Other username to test security of setuid scripts with?'
6185 dflt='none'
6186 . ./myread
6187 case "$ans" in
6188 n|none)
6189 case "$d_suidsafe" in
6190 '') echo "I'll assume setuid scripts are *not* secure." >&4
6191 dflt=n;;
6192 "$undef")
6193 echo "Well, the $hint value is *not* secure." >&4
6194 dflt=n;;
6195 *) echo "Well, the $hint value *is* secure." >&4
6196 dflt=y;;
6197 esac
6198 ;;
6199 *)
6200 $rm -f reflect flect
6201 echo "#!$ls" >reflect
6202 chmod +x,u+s reflect
6203 echo >flect
6204 chmod a+w flect
6205 echo '"su" will (probably) prompt you for '"$ans's password."
6206 su $ans -c './reflect >flect'
6207 if $contains "/dev/fd" flect >/dev/null; then
6208 echo "Okay, it looks like setuid scripts are secure." >&4
6209 dflt=y
6210 else
6211 echo "I don't think setuid scripts are secure." >&4
6212 dflt=n
6213 fi
6214 ;;
6215 esac
6216 rp='Does your kernel have *secure* setuid scripts?'
6217 . ./myread
6218 case "$ans" in
6219 [yY]*) val="$define";;
6220 *) val="$undef";;
6221 esac
6222 fi
6223else
6224 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6225 echo "(That's for file descriptors, not floppy disks.)"
6226 val="$undef"
6227fi
6228set d_suidsafe
6229eval $setvar
6230
6231$rm -f reflect flect
6232
6233: now see if they want to do setuid emulation
6234echo " "
6235val="$undef"
6236case "$d_suidsafe" in
6237"$define")
6238 val="$undef"
6239 echo "No need to emulate SUID scripts since they are secure here." >&4
6240 ;;
6241*)
6242 $cat <<EOM
6243Some systems have disabled setuid scripts, especially systems where
6244setuid scripts cannot be secure. On systems where setuid scripts have
6245been disabled, the setuid/setgid bits on scripts are currently
6246useless. It is possible for $package to detect those bits and emulate
6247setuid/setgid in a secure fashion. This emulation will only work if
6248setuid scripts have been disabled in your kernel.
6249
6250EOM
6251 case "$d_dosuid" in
6252 "$define") dflt=y ;;
6253 *) dflt=n ;;
6254 esac
6255 rp="Do you want to do setuid/setgid emulation?"
6256 . ./myread
6257 case "$ans" in
6258 [yY]*) val="$define";;
6259 *) val="$undef";;
6260 esac
6261 ;;
6262esac
6263set d_dosuid
6264eval $setvar
6265
6266: Find perl5.005 or later.
6267echo "Looking for a previously installed perl5.005 or later... "
6268case "$perl5" in
6269'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6270 : Check if this perl is recent and can load a simple module
6271 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6272 perl5=$tdir/perl
6273 break;
6274 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6275 perl5=$tdir/perl5
6276 break;
6277 fi
6278 done
6279 ;;
6280*) perl5="$perl5"
6281 ;;
6282esac
6283case "$perl5" in
6284'') echo "None found. That's ok.";;
6285*) echo "Using $perl5." ;;
6286esac
6287
6288$cat <<EOM
6289
6290After $package is installed, you may wish to install various
6291add-on modules and utilities. Typically, these add-ons will
6292be installed under $prefix with the rest
6293of this package. However, you may wish to install such add-ons
6294elsewhere under a different prefix.
6295
6296If you do not wish to put everything under a single prefix, that's
6297ok. You will be prompted for the individual locations; this siteprefix
6298is only used to suggest the defaults.
6299
6300The default should be fine for most people.
6301
6302EOM
6303fn=d~+
6304rp='Installation prefix to use for add-on modules and utilities?'
6305: XXX Here might be another good place for an installstyle setting.
6306case "$siteprefix" in
6307'') dflt=$prefix ;;
6308*) dflt=$siteprefix ;;
6309esac
6310. ./getfile
6311: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6312oldsiteprefix=''
6313case "$siteprefix" in
6314'') ;;
6315*) case "$ans" in
6316 "$prefix") ;;
6317 *) oldsiteprefix="$prefix";;
6318 esac
6319 ;;
6320esac
6321siteprefix="$ans"
6322siteprefixexp="$ansexp"
6323
6324: determine where site specific libraries go.
6325: Usual default is /usr/local/lib/perl5/site_perl/$version
6326: The default "style" setting is made in installstyle.U
6327: XXX No longer works with Prefixit stuff.
6328prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6329case "$sitelib" in
6330'') case "$installstyle" in
6331 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6332 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6333 esac
6334 ;;
6335*) dflt="$sitelib"
6336 ;;
6337esac
6338$cat <<EOM
6339
6340The installation process will create a directory for
6341site-specific extensions and modules. Most users find it convenient
6342to place all site-specific files in this directory rather than in the
6343main distribution directory.
6344
6345EOM
6346fn=d~+
6347rp='Pathname for the site-specific library files?'
6348. ./getfile
6349prefixvar=sitelib
6350. ./setprefixvar
6351sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6352
6353: Determine list of previous versions to include in @INC
6354$cat > getverlist <<EOPL
6355#!$perl5 -w
6356use File::Basename;
6357\$api_versionstring = "$api_versionstring";
6358\$version = "$version";
6359\$stem = "$sitelib_stem";
6360\$archname = "$archname";
6361EOPL
6362 $cat >> getverlist <<'EOPL'
6363# Can't have leading @ because metaconfig interprets it as a command!
6364;@inc_version_list=();
6365# XXX Redo to do opendir/readdir?
6366if (-d $stem) {
6367 chdir($stem);
6368 ;@candidates = glob("5.*");
6369}
6370else {
6371 ;@candidates = ();
6372}
6373
6374# XXX ToDo: These comparisons must be reworked when two-digit
6375# subversions come along, so that 5.7.10 compares as greater than
6376# 5.7.3! By that time, hope that 5.6.x is sufficiently
6377# widespread that we can use the built-in version vectors rather
6378# than reinventing them here. For 5.6.0, however, we must
6379# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6380foreach $d (@candidates) {
6381 if ($d lt $version) {
6382 if ($d ge $api_versionstring) {
6383 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6384 }
6385 elsif ($d ge "5.005") {
6386 unshift(@inc_version_list, grep { -d } $d);
6387 }
6388 }
6389 else {
6390 # Skip newer version. I.e. don't look in
6391 # 5.7.0 if we're installing 5.6.1.
6392 }
6393}
b4eb6b3d 6394
de7128ac
NC
6395if (@inc_version_list) {
6396 print join(' ', @inc_version_list);
6397}
6398else {
6399 # Blank space to preserve value for next Configure run.
6400 print " ";
6401}
6402EOPL
6403chmod +x getverlist
6404case "$inc_version_list" in
6405'') if test -x "$perl5$exe_ext"; then
6406 dflt=`$perl5 getverlist`
b4eb6b3d 6407 else
b4eb6b3d 6408 dflt='none'
b4eb6b3d 6409 fi
b4eb6b3d 6410 ;;
de7128ac
NC
6411$undef) dflt='none' ;;
6412*) eval dflt=\"$inc_version_list\" ;;
6413esac
6414case "$dflt" in
6415''|' ') dflt=none ;;
6416esac
6417case "$dflt" in
64185.005) dflt=none ;;
6419esac
6420$cat <<EOM
6421
6422In order to ease the process of upgrading, this version of perl
6423can be configured to use modules built and installed with earlier
6424versions of perl that were installed under $prefix. Specify here
6425the list of earlier versions that this version of perl should check.
6426If Configure detected no earlier versions of perl installed under
6427$prefix, then the list will be empty. Answer 'none' to tell perl
6428to not search earlier versions.
b4eb6b3d 6429
de7128ac
NC
6430The default should almost always be sensible, so if you're not sure,
6431just accept the default.
b4eb6b3d 6432EOM
de7128ac
NC
6433
6434rp='List of earlier versions to include in @INC?'
6435. ./myread
6436case "$ans" in
6437[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6438*) inc_version_list="$ans" ;;
6439esac
6440case "$inc_version_list" in
6441''|' ')
6442 inc_version_list_init='0'
6443 d_inc_version_list="$undef"
6444 ;;
6445*) inc_version_list_init=`echo $inc_version_list |
6446 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6447 d_inc_version_list="$define"
b4eb6b3d
JH
6448 ;;
6449esac
de7128ac 6450$rm -f getverlist
b4eb6b3d 6451
b4eb6b3d 6452: see if this is a malloc.h system
e290198f
JH
6453: we want a real compile instead of Inhdr because some systems have a
6454: malloc.h that just gives a compile error saying to use stdlib.h instead
6455echo " "
6456$cat >try.c <<EOCP
6457#include <stdlib.h>
6458#include <malloc.h>
6459int main () { return 0; }
6460EOCP
6461set try
6462if eval $compile; then
6463 echo "<malloc.h> found." >&4
6464 val="$define"
6465else
6466 echo "<malloc.h> NOT found." >&4
6467 val="$undef"
6468fi
6469$rm -f try.c try
6470set i_malloc
6471eval $setvar
b4eb6b3d 6472
c8b93cf9
JH
6473: check for void type
6474echo " "
6475echo "Checking to see how well your C compiler groks the void type..." >&4
6476case "$voidflags" in
6477'')
511118e1 6478 $cat >try.c <<EOCP
5ed858ef
JH
6479#$i_stdlib I_STDLIB
6480#ifdef I_STDLIB
6481#include <stdlib.h>
6482#endif
c8b93cf9
JH
6483#if TRY & 1
6484void sub() {
6485#else
6486sub() {
6487#endif
6488 extern void moo(); /* function returning void */
6489 void (*goo)(); /* ptr to func returning void */
6490#if TRY & 8
6491 void *hue; /* generic ptr */
6492#endif
6493#if TRY & 2
6494 void (*foo[10])();
6495#endif
6496
6497#if TRY & 4
6498 if(goo == moo) {
6499 exit(0);
6500 }
6501#endif
6502 exit(0);
6503}
6504int main() { sub(); }
6505EOCP
6506 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6507 voidflags=$defvoidused
6508 echo "Good. It appears to support void to the level $package wants.">&4
6509 if $contains warning .out >/dev/null 2>&1; then
6510 echo "However, you might get some warnings that look like this:"
6511 $cat .out
6512 fi
6513 else
6514echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6515 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6516 echo "It supports 1..."
6517 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6518 echo "It also supports 2..."
6519 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6520 voidflags=7
6521 echo "And it supports 4 but not 8 definitely."
6522 else
6523 echo "It doesn't support 4..."
6524 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6525 voidflags=11
6526 echo "But it supports 8."
6527 else
6528 voidflags=3
6529 echo "Neither does it support 8."
6530 fi
6531 fi
6532 else
6533 echo "It does not support 2..."
6534 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6535 voidflags=13
6536 echo "But it supports 4 and 8."
6537 else
6538 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6539 voidflags=5
6540 echo "And it supports 4 but has not heard about 8."
6541 else
6542 echo "However it supports 8 but not 4."
6543 fi
6544 fi
6545 fi
6546 else
6547 echo "There is no support at all for void."
6548 voidflags=0
6549 fi
6550 fi
6551esac
6552case "$voidflags" in
6553"$defvoidused") ;;
6554*) $cat >&4 <<'EOM'
6555 Support flag bits are:
6556 1: basic void declarations.
6557 2: arrays of pointers to functions returning void.
6558 4: operations between pointers to and addresses of void functions.
6559 8: generic void pointers.
6560EOM
6561 dflt="$voidflags";
6562 rp="Your void support flags add up to what?"
6563 . ./myread
6564 voidflags="$ans"
6565 ;;
6566esac
6567$rm -f try.* .out
6568
6569: check for length of pointer
6570echo " "
6571case "$ptrsize" in
6572'')
6573 echo "Checking to see how big your pointers are..." >&4
6574 if test "$voidflags" -gt 7; then
6575 echo '#define VOID_PTR char *' > try.c
6576 else
6577 echo '#define VOID_PTR void *' > try.c
6578 fi
ada8e391 6579 $cat >>try.c <<EOCP
c8b93cf9 6580#include <stdio.h>
5ed858ef
JH
6581#$i_stdlib I_STDLIB
6582#ifdef I_STDLIB
6583#include <stdlib.h>
6584#endif
c8b93cf9
JH
6585int main()
6586{
6587 printf("%d\n", (int)sizeof(VOID_PTR));
6588 exit(0);
6589}
6590EOCP
6591 set try
6592 if eval $compile_ok; then
6593 ptrsize=`$run ./try`
6594 echo "Your pointers are $ptrsize bytes long."
6595 else
6596 dflt='4'
6597 echo "(I can't seem to compile the test program. Guessing...)" >&4
6598 rp="What is the size of a pointer (in bytes)?"
6599 . ./myread
6600 ptrsize="$ans"
6601 fi
6602 ;;
6603esac
6604$rm -f try.c try
6605case "$use64bitall" in
6606"$define"|true|[yY]*)
6607 case "$ptrsize" in
6608 4) cat <<EOM >&4
6609
ff0950a8
JH
6610*** You have chosen a maximally 64-bit build,
6611*** but your pointers are only 4 bytes wide.
6612*** Please rerun Configure without -Duse64bitall.
c8b93cf9 6613EOM
ff0950a8
JH
6614 case "$d_quad" in
6615 define)
6616 cat <<EOM >&4
6617*** Since you have quads, you could possibly try with -Duse64bitint.
c8b93cf9 6618EOM
c8b93cf9
JH
6619 ;;
6620 esac
ff0950a8
JH
6621 cat <<EOM >&4
6622*** Cannot continue, aborting.
6623
6624EOM
6625
6626 exit 1
c8b93cf9
JH
6627 ;;
6628 esac
6629 ;;
6630esac
6631
c53af328 6632
1c6118a4
JH
6633: determine whether to use malloc wrapping
6634echo " "
6635case "$usemallocwrap" in
6636[yY]*|true|$define) dflt='y' ;;
6637[nN]*|false|$undef) dflt='n' ;;
6638*) case "$usedevel" in
6639 [yY]*|true|$define) dflt='y' ;;
6640 *) dflt='n' ;;
6641 esac
6642 ;;
6643esac
6644rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6645. ./myread
6646usemallocwrap="$ans"
6647case "$ans" in
6648y*|true)
6649 usemallocwrap="$define" ;;
6650*)
6651 usemallocwrap="$undef" ;;
6652esac
c8b93cf9 6653
b4eb6b3d
JH
6654: determine which malloc to compile in
6655echo " "
6656case "$usemymalloc" in
c4163172
JH
6657[yY]*|true|$define) dflt='y' ;;
6658[nN]*|false|$undef) dflt='n' ;;
6659*) case "$ptrsize" in
6660 4) dflt='y' ;;
6661 *) dflt='n' ;;
6662 esac
6663 ;;
8dfa8df9 6664esac
b4eb6b3d
JH
6665rp="Do you wish to attempt to use the malloc that comes with $package?"
6666. ./myread
6667usemymalloc="$ans"
6668case "$ans" in
6669y*|true)
6670 usemymalloc='y'
6671 mallocsrc='malloc.c'
6672 mallocobj="malloc$_o"
6673 d_mymalloc="$define"
6674 case "$libs" in
6675 *-lmalloc*)
6676 : Remove malloc from list of libraries to use
6677 echo "Removing unneeded -lmalloc from library list" >&4
6678 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6679 shift
6680 libs="$*"
6681 echo "libs = $libs" >&4
6682 ;;
6683 esac
6684 ;;
6685*)
6686 usemymalloc='n'
6687 mallocsrc=''
6688 mallocobj=''
6689 d_mymalloc="$undef"
6690 ;;
6691esac
6692
6693: compute the return types of malloc and free
6694echo " "
6695$cat >malloc.c <<END
6696#$i_malloc I_MALLOC
6697#$i_stdlib I_STDLIB
6698#include <stdio.h>
6699#include <sys/types.h>
6700#ifdef I_MALLOC
6701#include <malloc.h>
6702#endif
6703#ifdef I_STDLIB
6704#include <stdlib.h>
6705#endif
6706#ifdef TRY_MALLOC
6707void *malloc();
6708#endif
6709#ifdef TRY_FREE
6710void free();
6711#endif
6712END
6713case "$malloctype" in
6714'')
6715 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
de7128ac
NC
6716 malloctype='void *'
6717 else
6718 malloctype='char *'
6719 fi
6720 ;;
6721esac
6722echo "Your system wants malloc to return '$malloctype', it would seem." >&4
b4eb6b3d 6723
de7128ac
NC
6724case "$freetype" in
6725'')
6726 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6727 freetype='void'
6728 else
6729 freetype='int'
6730 fi
6731 ;;
6732esac
6733echo "Your system uses $freetype free(), it would seem." >&4
6734$rm -f malloc.[co]
b4eb6b3d
JH
6735: determine where site specific architecture-dependent libraries go.
6736: sitelib default is /usr/local/lib/perl5/site_perl/$version
6737: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6738: sitelib may have an optional trailing /share.
6739case "$sitearch" in
6740'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6741 dflt="$dflt/$archname"
6742 ;;
6743*) dflt="$sitearch"
6744 ;;
6745esac
6746set sitearch sitearch none
6747eval $prefixit
6748$cat <<EOM
6749
6750The installation process will also create a directory for
6751architecture-dependent site-specific extensions and modules.
6752
6753EOM
6754fn=d~+
6755rp='Pathname for the site-specific architecture-dependent library files?'
6756. ./getfile
de7128ac
NC
6757prefixvar=sitearch
6758. ./setprefixvar
5109a103
NC
6759if $test X"$sitearch" = X"$sitelib"; then
6760 d_sitearch="$undef"
6761else
6762 d_sitearch="$define"
6763fi
b4eb6b3d
JH
6764
6765$cat <<EOM
6766
6767The installation process will also create a directory for
6768vendor-supplied add-ons. Vendors who supply perl with their system
6769may find it convenient to place all vendor-supplied files in this
6770directory rather than in the main distribution directory. This will
6771ease upgrades between binary-compatible maintenance versions of perl.
6772
6773Of course you may also use these directories in whatever way you see
6774fit. For example, you might use them to access modules shared over a
6775company-wide network.
6776
6777The default answer should be fine for most people.
6778This causes further questions about vendor add-ons to be skipped
6779and no vendor-specific directories will be configured for perl.
6780
6781EOM
6782rp='Do you want to configure vendor-specific add-on directories?'
6783case "$usevendorprefix" in
6784define|true|[yY]*) dflt=y ;;
6785*) : User may have set vendorprefix directly on Configure command line.
6786 case "$vendorprefix" in
6787 ''|' ') dflt=n ;;
6788 *) dflt=y ;;
6789 esac
6790 ;;
6791esac
6792. ./myread
6793case "$ans" in
6794[yY]*) fn=d~+
6795 rp='Installation prefix to use for vendor-supplied add-ons?'
6796 case "$vendorprefix" in
6797 '') dflt='' ;;
6798 *) dflt=$vendorprefix ;;
6799 esac
6800 . ./getfile
6801 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6802 oldvendorprefix=''
6803 case "$vendorprefix" in
6804 '') ;;
6805 *) case "$ans" in
6806 "$prefix") ;;
6807 *) oldvendorprefix="$prefix";;
6808 esac
6809 ;;
6810 esac
6811 usevendorprefix="$define"
6812 vendorprefix="$ans"
6813 vendorprefixexp="$ansexp"
6814 ;;
6815*) usevendorprefix="$undef"
6816 vendorprefix=''
6817 vendorprefixexp=''
6818 ;;
6819esac
6820
6821case "$vendorprefix" in
6822'') d_vendorlib="$undef"
6823 vendorlib=''
6824 vendorlibexp=''
6825 ;;
6826*) d_vendorlib="$define"
6827 : determine where vendor-supplied modules go.
6828 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6829 case "$vendorlib" in
6830 '')
6831 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6832 case "$installstyle" in
6833 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6834 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6835 esac
6836 ;;
6837 *) dflt="$vendorlib"
6838 ;;
6839 esac
6840 fn=d~+
6841 rp='Pathname for the vendor-supplied library files?'
6842 . ./getfile
6843 vendorlib="$ans"
6844 vendorlibexp="$ansexp"
6845 ;;
6846esac
6847vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
de7128ac
NC
6848prefixvar=vendorlib
6849. ./installprefix
b4eb6b3d
JH
6850
6851case "$vendorprefix" in
6852'') d_vendorarch="$undef"
6853 vendorarch=''
6854 vendorarchexp=''
6855 ;;
6856*) d_vendorarch="$define"
6857 : determine where vendor-supplied architecture-dependent libraries go.
6858 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6859 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6860 : vendorlib may have an optional trailing /share.
6861 case "$vendorarch" in
6862 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6863 dflt="$dflt/$archname"
6864 ;;
6865 *) dflt="$vendorarch" ;;
6866 esac
6867 fn=d~+
6868 rp='Pathname for vendor-supplied architecture-dependent files?'
6869 . ./getfile
6870 vendorarch="$ans"
6871 vendorarchexp="$ansexp"
6872 ;;
6873esac
de7128ac
NC
6874prefixvar=vendorarch
6875. ./installprefix
5a29c6bc
JH
6876
6877: Final catch-all directories to search
6878$cat <<EOM
6879
6880Lastly, you can have perl look in other directories for extensions and
6881modules in addition to those already specified.
6882These directories will be searched after
6883 $sitearch
6884 $sitelib
6885EOM
6886test X"$vendorlib" != "X" && echo ' ' $vendorlib
6887test X"$vendorarch" != "X" && echo ' ' $vendorarch
6888echo ' '
6889case "$otherlibdirs" in
6890''|' ') dflt='none' ;;
6891*) dflt="$otherlibdirs" ;;
6892esac
6893$cat <<EOM
6894Enter a colon-separated set of extra paths to include in perl's @INC
6895search path, or enter 'none' for no extra paths.
6896
6897EOM
6898
6899rp='Colon-separated list of additional directories for perl to search?'
6900. ./myread
6901case "$ans" in
6902' '|''|none) otherlibdirs=' ' ;;
6903*) otherlibdirs="$ans" ;;
6904esac
6905case "$otherlibdirs" in
6906' ') val=$undef ;;
6907*) val=$define ;;
6908esac
6909set d_perl_otherlibdirs
6910eval $setvar
6911
6912: Cruising for prototypes
6913echo " "
6914echo "Checking out function prototypes..." >&4
6915$cat >prototype.c <<EOCP
6916#$i_stdlib I_STDLIB
6917#ifdef I_STDLIB
6918#include <stdlib.h>
6919#endif
6920int main(int argc, char *argv[]) {
6921 exit(0);}
6922EOCP
6923if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6924 echo "Your C compiler appears to support function prototypes."
6925 val="$define"
6926else
6927 echo "Your C compiler doesn't seem to understand function prototypes."
6928 val="$undef"
6929fi
6930set prototype
6931eval $setvar
6932$rm -f prototype*
6933
6934case "$prototype" in
6935"$define") ;;
6936*) ansi2knr='ansi2knr'
6937 echo " "
6938 cat <<EOM >&4
6939
6940$me: FATAL ERROR:
6941This version of $package can only be compiled by a compiler that
6942understands function prototypes. Unfortunately, your C compiler
6943 $cc $ccflags
6944doesn't seem to understand them. Sorry about that.
6945
6946If GNU cc is available for your system, perhaps you could try that instead.
6947
6948Eventually, we hope to support building Perl with pre-ANSI compilers.
6949If you would like to help in that effort, please contact <perlbug@perl.org>.
6950
6951Aborting Configure now.
6952EOM
6953 exit 2
6954 ;;
6955esac
6956
5a29c6bc
JH
6957echo " "
6958case "$extras" in
6959'') dflt='n';;
6960*) dflt='y';;
6961esac
6962cat <<EOM
6963Perl can be built with extra modules or bundles of modules which
6964will be fetched from the CPAN and installed alongside Perl.
6965
6966Notice that you will need access to the CPAN; either via the Internet,
6967or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6968be asked later to configure the CPAN.pm module which will in turn do
6969the installation of the rest of the extra modules or bundles.)
6970
6971Notice also that if the modules require any external software such as
6972libraries and headers (the libz library and the zlib.h header for the
6973Compress::Zlib module, for example) you MUST have any such software
6974already installed, this configuration process will NOT install such
6975things for you.
6976
6977If this doesn't make any sense to you, just accept the default '$dflt'.
6978EOM
6979rp='Install any extra modules (y or n)?'
6980. ./myread
6981case "$ans" in
6982y|Y)
6983 cat <<EOM
6984
6985Please list any extra modules or bundles to be installed from CPAN,
6986with spaces between the names. The names can be in any format the
6987'install' command of CPAN.pm will understand. (Answer 'none',
6988without the quotes, to install no extra modules or bundles.)
6989EOM
6990 rp='Extras?'
6991 dflt="$extras"
6992 . ./myread
6993 extras="$ans"
6994esac
6995case "$extras" in
6996''|'none')
6997 val=''
6998 $rm -f ../extras.lst
6999 ;;
7000*) echo "(Saving the list of extras for later...)"
7001 echo "$extras" > ../extras.lst
7002 val="'$extras'"
7003 ;;
7004esac
7005set extras
7006eval $setvar
7007echo " "
7008
7009: determine where html pages for programs go
7010set html1dir html1dir none
7011eval $prefixit
7012$cat <<EOM
7013
de7128ac 7014If you wish to install html files for programs in $spackage, indicate
5a29c6bc
JH
7015the appropriate directory here. To skip installing html files,
7016answer "none".
7017EOM
7018case "$html1dir" in
7019''|none|$undef|' ') dflt=none ;;
7020*) dflt=$html1dir ;;
7021esac
7022fn=dn+~
7023rp="Directory for the main $spackage html pages?"
7024. ./getfile
de7128ac
NC
7025prefixvar=html1dir
7026. ./setprefixvar
5a29c6bc
JH
7027: Use ' ' for none so value is preserved next time through Configure
7028$test X"$html1dir" = "X" && html1dir=' '
5a29c6bc
JH
7029
7030: determine where html pages for libraries and modules go
7031set html3dir html3dir none
7032eval $prefixit
7033$cat <<EOM
7034
7035If you wish to install html files for modules associated with $spackage,
7036indicate the appropriate directory here. To skip installing html files,
7037answer "none".
7038EOM
7039: There is no obvious default. If they have specified html1dir, then
7040: try to key off that, possibly changing .../html1 into .../html3.
7041case "$html3dir" in
7042'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7043*) dflt=$html3dir ;;
7044esac
7045fn=dn+~
7046rp="Directory for the $spackage module html pages?"
7047. ./getfile
de7128ac
NC
7048prefixvar=html3dir
7049. ./setprefixvar
5a29c6bc
JH
7050: Use ' ' for none so value is preserved next time through Configure
7051$test X"$html3dir" = "X" && html3dir=' '
5a29c6bc
JH
7052
7053: determine whether to install perl also as /usr/bin/perl
b4eb6b3d 7054
b4eb6b3d 7055echo " "
5a29c6bc
JH
7056if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7057 $cat <<EOM
7058Many scripts expect perl to be installed as /usr/bin/perl.
b4eb6b3d 7059
5a29c6bc
JH
7060If you want to, I can install the perl you are about to compile
7061as /usr/bin/perl (in addition to $bin/perl).
7062EOM
7063 if test -f /usr/bin/perl; then
7064 $cat <<EOM
b4eb6b3d 7065
5a29c6bc
JH
7066However, please note that because you already have a /usr/bin/perl,
7067overwriting that with a new Perl would very probably cause problems.
7068Therefore I'm assuming you don't want to do that (unless you insist).
b4eb6b3d 7069
5a29c6bc
JH
7070EOM
7071 case "$installusrbinperl" in
7072 "$define"|[yY]*) dflt='y';;
7073 *) dflt='n';;
7074 esac
7075 else
7076 $cat <<EOM
b4eb6b3d 7077
5a29c6bc 7078Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
b4eb6b3d 7079
b4eb6b3d 7080EOM
5a29c6bc
JH
7081 case "$installusrbinperl" in
7082 "$undef"|[nN]*) dflt='n';;
7083 *) dflt='y';;
7084 esac
7085 fi
7086 rp="Do you want to install perl as /usr/bin/perl?"
7087 . ./myread
7088 case "$ans" in
7089 [yY]*) val="$define";;
7090 *) val="$undef" ;;
7091 esac
7092else
7093 val="$undef"
7094fi
7095set installusrbinperl
7096eval $setvar
b4eb6b3d 7097
b4eb6b3d 7098echo " "
5a29c6bc
JH
7099echo "Checking for GNU C Library..." >&4
7100cat >try.c <<'EOCP'
7101/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7102 alone are insufficient to distinguish different versions, such as
7103 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7104 libc version 2.1.0. A. Dougherty, June 3, 2002.
7105*/
7106#include <stdio.h>
7107int main(void)
7108{
7109#ifdef __GLIBC__
7110# ifdef __GLIBC_MINOR__
5f7d02a9 7111# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
5a29c6bc
JH
7112# include <gnu/libc-version.h>
7113 printf("%s\n", gnu_get_libc_version());
7114# else
7115 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7116# endif
7117# else
7118 printf("%d\n", __GLIBC__);
7119# endif
7120 return 0;
7121#else
7122 return 1;
7123#endif
7124}
7125EOCP
7126set try
7127if eval $compile_ok && $run ./try > glibc.ver; then
7128 val="$define"
7129 gnulibc_version=`$cat glibc.ver`
7130 echo "You are using the GNU C Library version $gnulibc_version"
b4eb6b3d 7131else
5a29c6bc
JH
7132 val="$undef"
7133 gnulibc_version=''
7134 echo "You are not using the GNU C Library"
b4eb6b3d 7135fi
5a29c6bc
JH
7136$rm -f try try.* glibc.ver
7137set d_gnulibc
7138eval $setvar
b4eb6b3d 7139
d2ae4405
JH
7140echo " "
7141echo "Checking for C++..." >&4
7142cat >try.c <<'EOCP'
7143#include <stdio.h>
7144int main(void)
7145{
7146#ifdef __cplusplus
7147 printf("define\n");
7148#else
7149 printf("undef\n");
7150#endif
7151 return 0;
7152}
7153EOCP
7154set try
7155if eval $compile_ok && $run ./try > cplusplus; then
7156 val=`$cat cplusplus`
7157 echo "You are using a C++ compiler."
7158else
7159 val="$undef"
7160 echo "You are not using a C++ compiler."
7161fi
7162$rm -f try try.* cplusplus
7163set d_cplusplus
7164eval $setvar
7165
5a29c6bc
JH
7166: see if nm is to be used to determine whether a symbol is defined or not
7167case "$usenm" in
7168'')
7169 dflt=''
7170 case "$d_gnulibc" in
7171 "$define")
7172 echo " "
7173 echo "nm probably won't work on the GNU C Library." >&4
7174 dflt=n
7175 ;;
7176 esac
7177 case "$dflt" in
7178 '')
7179 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7180 echo " "
7181 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7182 echo "'nm' won't be sufficient on this sytem." >&4
7183 dflt=n
7184 fi
7185 ;;
7186 esac
7187 case "$dflt" in
7188 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7189 if $test $dflt -gt 20; then
7190 dflt=y
7191 else
7192 dflt=n
7193 fi
7194 ;;
7195 esac
7196 ;;
7197*)
7198 case "$usenm" in
7199 true|$define) dflt=y;;
7200 *) dflt=n;;
7201 esac
7202 ;;
6fcddf3b 7203esac
5a29c6bc 7204$cat <<EOM
6fcddf3b 7205
5a29c6bc
JH
7206I can use $nm to extract the symbols from your C libraries. This
7207is a time consuming task which may generate huge output on the disk (up
7208to 3 megabytes) but that should make the symbols extraction faster. The
7209alternative is to skip the 'nm' extraction part and to compile a small
7210test program instead to determine whether each symbol is present. If
7211you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7212this may be the best solution.
6fcddf3b 7213
5a29c6bc 7214You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6fcddf3b 7215
6fcddf3b 7216EOM
5a29c6bc 7217rp="Shall I use $nm to extract C symbols from the libraries?"
6fcddf3b
JH
7218. ./myread
7219case "$ans" in
5a29c6bc
JH
7220[Nn]*) usenm=false;;
7221*) usenm=true;;
6fcddf3b 7222esac
6fcddf3b 7223
5a29c6bc
JH
7224runnm=$usenm
7225case "$reuseval" in
7226true) runnm=false;;
6e1038e0 7227esac
6e1038e0 7228
5a29c6bc
JH
7229: nm options which may be necessary
7230case "$nm_opt" in
7231'') if $test -f /mach_boot; then
7232 nm_opt='' # Mach
7233 elif $test -d /usr/ccs/lib; then
7234 nm_opt='-p' # Solaris (and SunOS?)
7235 elif $test -f /dgux; then
7236 nm_opt='-p' # DG-UX
7237 elif $test -f /lib64/rld; then
7238 nm_opt='-p' # 64-bit Irix
7239 else
7240 nm_opt=''
7241 fi;;
7242esac
6e1038e0 7243
5a29c6bc
JH
7244: nm options which may be necessary for shared libraries but illegal
7245: for archive libraries. Thank you, Linux.
7246case "$nm_so_opt" in
7247'') case "$myuname" in
d20247fd 7248 *linux*|gnu*)
5a29c6bc
JH
7249 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7250 nm_so_opt='--dynamic'
7251 fi
7252 ;;
7253 esac
7254 ;;
6e1038e0 7255esac
6e1038e0 7256
5a29c6bc
JH
7257case "$runnm" in
7258true)
7259: get list of predefined functions in a handy place
7260echo " "
7261case "$libc" in
7262'') libc=unknown
7263 case "$libs" in
7264 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7265 esac
7266 ;;
7267esac
7268case "$libs" in
7269'') ;;
7270*) for thislib in $libs; do
7271 case "$thislib" in
7272 -lc|-lc_s)
7273 : Handle C library specially below.
7274 ;;
7275 -l*)
7276 thislib=`echo $thislib | $sed -e 's/^-l//'`
7277 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7278 :
7279 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7280 :
7281 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7282 :
7283 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7284 :
7285 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7286 :
7287 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7288 :
7289 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7290 :
7291 else
7292 try=''
b4eb6b3d 7293 fi
5a29c6bc
JH
7294 libnames="$libnames $try"
7295 ;;
7296 *) libnames="$libnames $thislib" ;;
7297 esac
7298 done
7299 ;;
7300esac
7301xxx=normal
7302case "$libc" in
7303unknown)
7304 set /lib/libc.$so
7305 for xxx in $libpth; do
7306 $test -r $1 || set $xxx/libc.$so
7307 : The messy sed command sorts on library version numbers.
7308 $test -r $1 || \
7309 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7310 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7311 h
7312 s/[0-9][0-9]*/0000&/g
7313 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7314 G
7315 s/\n/ /' | \
7316 $sort | $sed -e 's/^.* //'`
7317 eval set \$$#
b4eb6b3d 7318 done
5a29c6bc
JH
7319 $test -r $1 || set /usr/ccs/lib/libc.$so
7320 $test -r $1 || set /lib/libsys_s$_a
b4eb6b3d 7321 ;;
5a29c6bc
JH
7322*)
7323 set blurfl
b4eb6b3d
JH
7324 ;;
7325esac
5a29c6bc
JH
7326if $test -r "$1"; then
7327 echo "Your (shared) C library seems to be in $1."
7328 libc="$1"
7329elif $test -r /lib/libc && $test -r /lib/clib; then
7330 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7331 xxx=apollo
7332 libc='/lib/clib /lib/libc'
7333 if $test -r /lib/syslib; then
7334 echo "(Your math library is in /lib/syslib.)"
7335 libc="$libc /lib/syslib"
7336 fi
7337elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7338 echo "Your C library seems to be in $libc, as you said before."
7339elif $test -r $incpath/usr/lib/libc$_a; then
7340 libc=$incpath/usr/lib/libc$_a;
7341 echo "Your C library seems to be in $libc. That's fine."
7342elif $test -r /lib/libc$_a; then
7343 libc=/lib/libc$_a;
7344 echo "Your C library seems to be in $libc. You're normal."
7345else
7346 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7347 :
7348 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7349 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7350 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7351 :
7352 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7353 :
7354 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7355 :
b4eb6b3d 7356 else
5a29c6bc 7357 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
b4eb6b3d 7358 fi
5a29c6bc
JH
7359 if $test -r "$tans"; then
7360 echo "Your C library seems to be in $tans, of all places."
7361 libc=$tans
7362 else
7363 libc='blurfl'
7364 fi
7365fi
7366if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7367 dflt="$libc"
7368 cat <<EOM
b4eb6b3d 7369
5a29c6bc
JH
7370If the guess above is wrong (which it might be if you're using a strange
7371compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7372
b4eb6b3d 7373EOM
5a29c6bc
JH
7374else
7375 dflt=''
7376 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7377 cat >&4 <<EOM
7378I can't seem to find your C library. I've looked in the following places:
b4eb6b3d 7379
5a29c6bc
JH
7380EOM
7381 $sed 's/^/ /' libpath
7382 cat <<EOM
b4eb6b3d 7383
5a29c6bc 7384None of these seems to contain your C library. I need to get its name...
5b7ea690 7385
b4eb6b3d 7386EOM
5a29c6bc
JH
7387fi
7388fn=f
7389rp='Where is your C library?'
7390. ./getfile
7391libc="$ans"
5b7ea690 7392
5a29c6bc
JH
7393echo " "
7394echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7395set X `cat libnames`
7396shift
7397xxx=files
7398case $# in 1) xxx=file; esac
7399echo "Extracting names from the following $xxx for later perusal:" >&4
7400echo " "
7401$sed 's/^/ /' libnames >&4
7402echo " "
7403$echo $n "This may take a while...$c" >&4
5b7ea690 7404
5a29c6bc
JH
7405for file in $*; do
7406 case $file in
7407 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7408 *) $nm $nm_opt $file 2>/dev/null;;
7409 esac
7410done >libc.tmp
7411
7412$echo $n ".$c"
7413$grep fprintf libc.tmp > libc.ptf
7414xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7415xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7416xxx='[ADTSIW]'
f7288ffb 7417if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
5a29c6bc
JH
7418 eval $xscan;\
7419 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7420 eval $xrun
7421elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7422 eval $xscan;\
7423 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7424 eval $xrun
7425elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7426 eval $xscan;\
7427 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7428 eval $xrun
7429elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7430 eval $xscan;\
7431 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7432 eval $xrun
7433elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7434 eval $xscan;\
7435 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7436 eval $xrun
7437elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7438 eval $xscan;\
7439 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7440 eval $xrun
7441elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7442 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7443 eval $xscan;\
7444 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7445 eval $xrun
7446elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7447 eval $xscan;\
7448 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7449 eval $xrun
7450elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7451 eval $xscan;\
7452 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7453 eval $xrun
7454elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7455 eval $xscan;\
7456 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7457 eval $xrun
7458elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7459 eval $xscan;\
7460 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7461 eval $xrun
7462elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7463 eval $xscan;\
7464 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7465 eval $xrun
7466elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7467 eval $xscan;\
7468 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7469 eval $xrun
7470elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7471 eval $xscan;\
7472 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7473 eval $xrun
7474else
7475 $nm -p $* 2>/dev/null >libc.tmp
7476 $grep fprintf libc.tmp > libc.ptf
7477 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7478 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7479 then
7480 nm_opt='-p'
7481 eval $xrun
5b7ea690 7482 else
5a29c6bc
JH
7483 echo " "
7484 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7485 com=''
7486 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7487 for thisname in $libnames $libc; do
7488 $ar t $thisname >>libc.tmp
7489 done
7490 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7491 echo "Ok." >&4
7492 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7493 # Repeat libc to extract forwarders to DLL entries too
7494 for thisname in $libnames $libc; do
7495 $ar tv $thisname >>libc.tmp
7496 # Revision 50 of EMX has bug in $ar.
7497 # it will not extract forwarders to DLL entries
7498 # Use emximp which will extract exactly them.
7499 emximp -o tmp.imp $thisname \
7500 2>/dev/null && \
7501 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7502 < tmp.imp >>libc.tmp
7503 $rm tmp.imp
7504 done
7505 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7506 echo "Ok." >&4
7507 else
7508 echo "$ar didn't seem to work right." >&4
7509 echo "Maybe this is a Cray...trying bld instead..." >&4
7510 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7511 then
7512 for thisname in $libnames; do
7513 bld t $libnames | \
7514 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7515 $ar t $thisname >>libc.tmp
7516 done
7517 echo "Ok." >&4
7518 else
7519 echo "That didn't work either. Giving up." >&4
7520 exit 1
7521 fi
7522 fi
2d736872 7523 fi
b4eb6b3d 7524fi
5a29c6bc
JH
7525nm_extract="$com"
7526case "$PASE" in
7527define)
7528 echo " "
7529 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7530 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7531 ;;
7532*) if $test -f /lib/syscalls.exp; then
7533 echo " "
7534 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7535 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7536 fi
7537 ;;
7538esac
7539;;
7540esac
7541$rm -f libnames libpath
b4eb6b3d
JH
7542
7543: see if dld is available
7544set dld.h i_dld
7545eval $inhdr
7546
5a29c6bc
JH
7547: is a C symbol defined?
7548csym='tlook=$1;
7549case "$3" in
5057be0e
JH
7550-v) tf=libc.tmp; tdc="";;
7551-a) tf=libc.tmp; tdc="[]";;
7552*) tlook="^$1\$"; tf=libc.list; tdc="()";;
5a29c6bc
JH
7553esac;
7554tx=yes;
7555case "$reuseval-$4" in
7556true-) ;;
7557true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7558esac;
7559case "$tx" in
7560yes)
f7288ffb 7561 tval=false;
bd43df42
JH
7562 if $test "$runnm" = true; then
7563 if $contains $tlook $tf >/dev/null 2>&1; then
f7288ffb 7564 tval=true;
bd43df42 7565 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
5057be0e 7566 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
bd43df42 7567 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
5057be0e
JH
7568 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7569 $rm -f try$_exe try.c core core.* try.core;
5a29c6bc 7570 fi;
bd43df42 7571 else
5057be0e 7572 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
bd43df42 7573 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5057be0e 7574 $rm -f try$_exe try.c;
f7288ffb
JH
7575 fi;
7576 ;;
5a29c6bc
JH
7577*)
7578 case "$tval" in
7579 $define) tval=true;;
7580 *) tval=false;;
f7288ffb
JH
7581 esac;
7582 ;;
5a29c6bc
JH
7583esac;
7584eval "$2=$tval"'
7585
7586: define an is-in-libc? function
7587inlibc='echo " "; td=$define; tu=$undef;
7588sym=$1; var=$2; eval "was=\$$2";
7589tx=yes;
7590case "$reuseval$was" in
7591true) ;;
7592true*) tx=no;;
7593esac;
7594case "$tx" in
7595yes)
7596 set $sym tres -f;
7597 eval $csym;
7598 case "$tres" in
7599 true)
7600 echo "$sym() found." >&4;
7601 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7602 *)
7603 echo "$sym() NOT found." >&4;
7604 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7605 esac;;
7606*)
7607 case "$was" in
7608 $define) echo "$sym() found." >&4;;
7609 *) echo "$sym() NOT found." >&4;;
7610 esac;;
7611esac'
7612
b4eb6b3d
JH
7613: see if dlopen exists
7614xxx_runnm="$runnm"
d2ae4405 7615xxx_ccflags="$ccflags"
b4eb6b3d 7616runnm=false
d2ae4405
JH
7617: with g++ one needs -shared to get is-in-libc to work for dlopen
7618case "$gccversion" in
7619'') ;;
7620*) case "$d_cplusplus" in
7621 "$define") ccflags="$ccflags -shared" ;;
7622 esac
7623 ;;
7624esac
b4eb6b3d
JH
7625set dlopen d_dlopen
7626eval $inlibc
7627runnm="$xxx_runnm"
d2ae4405 7628ccflags="$xxx_ccflags"
b4eb6b3d 7629
5f7d02a9
NC
7630: see if this is a unistd.h system
7631set unistd.h i_unistd
7632eval $inhdr
7633
b4eb6b3d
JH
7634: determine which dynamic loading, if any, to compile in
7635echo " "
7636dldir="ext/DynaLoader"
7637case "$usedl" in
7638$define|y|true)
7639 dflt='y'
7640 usedl="$define"
7641 ;;
7642$undef|n|false)
7643 dflt='n'
7644 usedl="$undef"
7645 ;;
7646*)
7647 dflt='n'
7648 case "$d_dlopen" in
7649 $define) dflt='y' ;;
7650 esac
7651 case "$i_dld" in
7652 $define) dflt='y' ;;
7653 esac
7654 : Does a dl_xxx.xs file exist for this operating system
7655 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7656 ;;
7657esac
7658rp="Do you wish to use dynamic loading?"
7659. ./myread
7660usedl="$ans"
7661case "$ans" in
7662y*) usedl="$define"
7663 case "$dlsrc" in
7664 '')
7665 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7666 dflt="$dldir/dl_${osname}.xs"
7667 elif $test "$d_dlopen" = "$define" ; then
7668 dflt="$dldir/dl_dlopen.xs"
7669 elif $test "$i_dld" = "$define" ; then
7670 dflt="$dldir/dl_dld.xs"
7671 else
7672 dflt=''
7673 fi
7674 ;;
7675 *) dflt="$dldir/$dlsrc"
7676 ;;
7677 esac
7678 echo "The following dynamic loading files are available:"
7679 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7680 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7681 rp="Source file to use for dynamic loading"
7682 fn="fne"
7683 gfpth="$src"
7684 . ./getfile
7685 usedl="$define"
7686 : emulate basename
7687 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7688
7689 $cat << EOM
7690
7691Some systems may require passing special flags to $cc -c to
7692compile modules that will be used to create a shared library.
7693To use no flags, say "none".
7694
7695EOM
7696 case "$cccdlflags" in
7697 '') case "$gccversion" in
7698 '') case "$osname" in
7699 hpux) dflt='+z' ;;
7700 next) dflt='none' ;;
7701 irix*) dflt='-KPIC' ;;
48bcfe03 7702 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7703 sunos) dflt='-pic' ;;
7704 *) dflt='none' ;;
7705 esac
7706 ;;
7707 *) case "$osname" in
b6cc0f4c 7708 darwin) dflt='none' ;;
48bcfe03 7709 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7710 *) dflt='-fpic' ;;
7711 esac ;;
7712 esac ;;
7713 ' ') dflt='none' ;;
7714 *) dflt="$cccdlflags" ;;
7715 esac
7716 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7717 . ./myread
7718 case "$ans" in
7719 none) cccdlflags=' ' ;;
7720 *) cccdlflags="$ans" ;;
7721 esac
7722
7723 cat << EOM
7724
7725Some systems use ld to create libraries that can be dynamically loaded,
7726while other systems (such as those using ELF) use $cc.
7727
7728EOM
7729 case "$ld" in
5a29c6bc 7730 '') $cat >try.c <<EOM
b4eb6b3d
JH
7731/* Test for whether ELF binaries are produced */
7732#include <fcntl.h>
5a29c6bc
JH
7733#$i_stdlib I_STDLIB
7734#ifdef I_STDLIB
b4eb6b3d 7735#include <stdlib.h>
5a29c6bc 7736#endif
5f7d02a9
NC
7737#$i_unistd I_UNISTD
7738#ifdef I_UNISTD
7739#include <unistd.h>
7740#endif
b4eb6b3d
JH
7741int main() {
7742 char b[4];
7743 int i = open("a.out",O_RDONLY);
7744 if(i == -1)
7745 exit(1); /* fail */
7746 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7747 exit(0); /* succeed (yes, it's ELF) */
7748 else
7749 exit(1); /* fail */
7750}
7751EOM
5440bc8e 7752 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7753 cat <<EOM
7754You appear to have ELF support. I'll use $cc to build dynamic libraries.
7755EOM
7756 dflt="$cc"
7757 else
7758 echo "I'll use ld to build dynamic libraries."
7759 dflt='ld'
7760 fi
7761 rm -f try.c a.out
7762 ;;
7763 *) dflt="$ld"
7764 ;;
7765 esac
7766
7767 rp="What command should be used to create dynamic libraries?"
7768 . ./myread
7769 ld="$ans"
7770
7771 cat << EOM
7772
7773Some systems may require passing special flags to $ld to create a
7774library that can be dynamically loaded. If your ld flags include
7775-L/other/path options to locate libraries outside your loader's normal
7776search path, you may need to specify those -L options here as well. To
7777use no flags, say "none".
7778
7779EOM
7780 case "$lddlflags" in
7781 '') case "$osname" in
7782 beos) dflt='-nostart' ;;
7783 hpux) dflt='-b';
7784 case "$gccversion" in
7785 '') dflt="$dflt +vnocompatwarnings" ;;
7786 esac
7787 ;;
d20247fd 7788 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7789 next) dflt='none' ;;
7790 solaris) dflt='-G' ;;
7791 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7792 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7793 *) dflt='none' ;;
7794 esac
7795 ;;
7796 *) dflt="$lddlflags" ;;
7797 esac
7798
7799 : Try to guess additional flags to pick up local libraries.
7800 : Be careful not to append to a plain 'none'
7801 case "$dflt" in
7802 none) dflt='' ;;
7803 esac
7804 for thisflag in $ldflags; do
7805 case "$thisflag" in
b5b9f165 7806 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7807 case " $dflt " in
7808 *" $thisflag "*) ;;
7809 *) dflt="$dflt $thisflag" ;;
7810 esac
7811 ;;
7812 esac
7813 done
7814
7815 case "$dflt" in
7816 ''|' ') dflt='none' ;;
7817 esac
7818
7819 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7820 . ./myread
7821 case "$ans" in
7822 none) lddlflags=' ' ;;
7823 *) lddlflags="$ans" ;;
7824 esac
7825
7826 cat <<EOM
7827
7828Some systems may require passing special flags to $cc to indicate that
7829the resulting executable will use dynamic linking. To use no flags,
7830say "none".
7831
7832EOM
7833 case "$ccdlflags" in
7834 '') case "$osname" in
d20247fd 7835 linux|hpux|gnu*) dflt='-Wl,-E' ;;
54b41212
NC
7836 next|sunos) dflt='none' ;;
7837 *) dflt='none' ;;
b4eb6b3d
JH
7838 esac ;;
7839 ' ') dflt='none' ;;
7840 *) dflt="$ccdlflags" ;;
7841 esac
7842 rp="Any special flags to pass to $cc to use dynamic linking?"
7843 . ./myread
7844 case "$ans" in
7845 none) ccdlflags=' ' ;;
7846 *) ccdlflags="$ans" ;;
7847 esac
7848 ;;
7849*) usedl="$undef"
7850 ld='ld'
7851 dlsrc='dl_none.xs'
7852 lddlflags=''
7853 ccdlflags=''
7854 ;;
7855esac
7856
7857also=''
7858case "$usedl" in
7859$undef)
7860 # No dynamic loading being used, so don't bother even to prompt.
7861 useshrplib='false'
7862 ;;
7863*) case "$useshrplib" in
7864 '') case "$osname" in
48bcfe03 7865 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7866 dflt=y
7867 also='Building a shared libperl is required for dynamic loading to work on your system.'
7868 ;;
7869 next*)
7870 case "$osvers" in
7871 4*) dflt=y
7872 also='Building a shared libperl is needed for MAB support.'
7873 ;;
7874 *) dflt=n
7875 ;;
7876 esac
7877 ;;
7878 *) dflt=n
7879 ;;
7880 esac
7881 ;;
7882 $define|true|[Yy]*)
7883 dflt=y
7884 ;;
7885 *) dflt=n
7886 ;;
7887 esac
7888 $cat << EOM
7889
7890The perl executable is normally obtained by linking perlmain.c with
7891libperl${_a}, any static extensions (usually just DynaLoader), and
7892any other libraries needed on this system (such as -lm, etc.). Since
7893your system supports dynamic loading, it is probably possible to build
7894a shared libperl.$so. If you will have more than one executable linked
7895to libperl.$so, this will significantly reduce the size of each
58c89e2c 7896executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7897default is probably sensible for your system.
7898$also
7899
7900EOM
7901 rp="Build a shared libperl.$so (y/n)"
7902 . ./myread
7903 case "$ans" in
7904 true|$define|[Yy]*)
7905 useshrplib='true' ;;
7906 *) useshrplib='false' ;;
7907 esac
7908 ;;
7909esac
7910
7911case "$useshrplib" in
7912true)
7913 case "$libperl" in
7914 '')
7915 # Figure out a good name for libperl.so. Since it gets stored in
7916 # a version-specific architecture-dependent library, the version
7917 # number isn't really that important, except for making cc/ld happy.
7918 #
7919 # A name such as libperl.so.3.1
7920 majmin="libperl.$so.$patchlevel.$subversion"
7921 # A name such as libperl.so.301
7922 majonly=`echo $patchlevel $subversion |
7923 $awk '{printf "%d%02d", $1, $2}'`
7924 majonly=libperl.$so.$majonly
7925 # I'd prefer to keep the os-specific stuff here to a minimum, and
7926 # rely on figuring it out from the naming of libc.
7927 case "${osname}${osvers}" in
7928 next4*)
7929 dflt=libperl.5.$so
7930 # XXX How handle the --version stuff for MAB?
7931 ;;
d20247fd 7932 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7933 dflt=libperl.$so
7934 ;;
b53432e4
GH
7935 cygwin*) # ld links against an importlib
7936 dflt=libperl$lib_ext
b4eb6b3d
JH
7937 ;;
7938 *) # Try to guess based on whether libc has major.minor.
7939 case "$libc" in
7940 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7941 *libc.$so.[0-9]*) dflt=$majonly ;;
7942 *) dflt=libperl.$so ;;
7943 esac
7944 ;;
7945 esac
7946 ;;
7947 *) dflt=$libperl
7948 ;;
7949 esac
7950 cat << EOM
7951
7952I need to select a good name for the shared libperl. If your system uses
7953library names with major and minor numbers, then you might want something
7954like $majmin. Alternatively, if your system uses a single version
7955number for shared libraries, then you might want to use $majonly.
7956Or, your system might be quite happy with a simple libperl.$so.
7957
7958Since the shared libperl will get installed into a version-specific
7959architecture-dependent directory, the version number of the shared perl
7960library probably isn't important, so the default should be o.k.
7961
7962EOM
7963 rp='What name do you want to give to the shared libperl?'
7964 . ./myread
7965 libperl=$ans
7966 echo "Ok, I'll use $libperl"
7967 ;;
7968*)
7969 libperl="libperl${_a}"
7970 ;;
7971esac
7972
7973# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7974case "$shrpdir" in
7975'') ;;
7976*) $cat >&4 <<EOM
7977WARNING: Use of the shrpdir variable for the installation location of
7978the shared $libperl is not supported. It was never documented and
7979will not work in this version. Let me (perlbug@perl.org)
7980know of any problems this may cause.
7981
7982EOM
7983 case "$shrpdir" in
7984 "$archlibexp/CORE")
7985 $cat >&4 <<EOM
7986But your current setting of $shrpdir is
7987the default anyway, so it's harmless.
7988EOM
7989 ;;
7990 *)
7991 $cat >&4 <<EOM
7992Further, your current attempted setting of $shrpdir
7993conflicts with the value of $archlibexp/CORE
7994that installperl will use.
7995EOM
7996 ;;
7997 esac
7998 ;;
7999esac
8000
8001# How will the perl executable find the installed shared $libperl?
8002# Add $xxx to ccdlflags.
8003# If we can't figure out a command-line option, use $shrpenv to
8004# set env LD_RUN_PATH. The main perl makefile uses this.
8005shrpdir=$archlibexp/CORE
8006xxx=''
8007tmp_shrpenv=''
8008if "$useshrplib"; then
8009 case "$osname" in
8010 aix)
8011 # We'll set it in Makefile.SH...
8012 ;;
b5b9f165 8013 solaris)
b4eb6b3d
JH
8014 xxx="-R $shrpdir"
8015 ;;
68b474e0 8016 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8017 xxx="-Wl,-R$shrpdir"
8018 ;;
d20247fd 8019 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8020 xxx="-Wl,-rpath,$shrpdir"
8021 ;;
8022 next)
8023 # next doesn't like the default...
8024 ;;
8025 beos)
8026 # beos doesn't like the default, either.
8027 ;;
8028 hpux*)
8029 # hpux doesn't like the default, either.
8030 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8031 ;;
8032 *)
8033 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8034 ;;
8035 esac
8036 case "$xxx" in
8037 '') ;;
8038 *)
8039 # Only add $xxx if it isn't already in ccdlflags.
8040 case " $ccdlflags " in
8041 *" $xxx "*) ;;
8042 *) ccdlflags="$ccdlflags $xxx"
8043 cat <<EOM >&4
8044
8045Adding $xxx to the flags
8046passed to $ld so that the perl executable will find the
8047installed shared $libperl.
8048
8049EOM
8050 ;;
8051 esac
8052 ;;
8053 esac
8054fi
8055# Fix ccdlflags in AIX for building external extensions.
8056# (For building Perl itself bare -bE:perl.exp is needed,
8057# Makefile.SH takes care of this.)
8058case "$osname" in
8059aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8060esac
8061# Respect a hint or command-line value.
8062case "$shrpenv" in
8063'') shrpenv="$tmp_shrpenv" ;;
8064esac
8065case "$ldlibpthname" in
8066'') ldlibpthname=LD_LIBRARY_PATH ;;
8067none) ldlibpthname='' ;;
8068esac
8069
8070: determine where manual pages are on this system
8071echo " "
8072case "$sysman" in
8073'')
4a0a3829
SD
8074 syspath='/usr/share/man/man1 /usr/man/man1'
8075 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8076 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8077 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8078 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8079 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8080 sysman=`./loc . /usr/man/man1 $syspath`
8081 ;;
8082esac
8083if $test -d "$sysman"; then
8084 echo "System manual is in $sysman." >&4
8085else
8086 echo "Could not find manual pages in source form." >&4
8087fi
8088
8089: determine where manual pages go
8090set man1dir man1dir none
8091eval $prefixit
8092$cat <<EOM
8093
8094$spackage has manual pages available in source form.
8095EOM
8096case "$nroff" in
8097nroff)
8098 echo "However, you don't have nroff, so they're probably useless to you."
8099 case "$man1dir" in
8100 '') man1dir="none";;
8101 esac;;
8102esac
8103echo "If you don't want the manual sources installed, answer 'none'."
8104case "$man1dir" in
8105' ') dflt=none
8106 ;;
8107'')
4a0a3829
SD
8108 lookpath="$prefixexp/share/man/man1"
8109 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8110 lookpath="$lookpath $prefixexp/man/p_man/man1"
8111 lookpath="$lookpath $prefixexp/man/u_man/man1"
8112 lookpath="$lookpath $prefixexp/man/man.1"
8113 case "$sysman" in
8114 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8115 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8116 esac
8117 set dflt
8118 eval $prefixup
8119 ;;
8120*) dflt="$man1dir"
8121 ;;
8122esac
8123echo " "
8124fn=dn+~
8125rp="Where do the main $spackage manual pages (source) go?"
8126. ./getfile
8127if $test "X$man1direxp" != "X$ansexp"; then
8128 installman1dir=''
8129fi
de7128ac
NC
8130prefixvar=man1dir
8131. ./setprefixvar
8132
b4eb6b3d
JH
8133case "$man1dir" in
8134'') man1dir=' '
8135 installman1dir='';;
8136esac
8137
b4eb6b3d
JH
8138: What suffix to use on installed man pages
8139
8140case "$man1dir" in
8141' ')
8142 man1ext='0'
8143 ;;
8144*)
8145 rp="What suffix should be used for the main $spackage man pages?"
8146 case "$man1ext" in
8147 '') case "$man1dir" in
8148 *1) dflt=1 ;;
8149 *1p) dflt=1p ;;
8150 *1pm) dflt=1pm ;;
8151 *l) dflt=l;;
8152 *n) dflt=n;;
8153 *o) dflt=o;;
8154 *p) dflt=p;;
8155 *C) dflt=C;;
8156 *L) dflt=L;;
8157 *L1) dflt=L1;;
8158 *) dflt=1;;
8159 esac
8160 ;;
8161 *) dflt="$man1ext";;
8162 esac
8163 . ./myread
8164 man1ext="$ans"
8165 ;;
8166esac
8167
8168: see if we can have long filenames
8169echo " "
8170first=123456789abcdef
8171$rm -f $first
8172if (echo hi >$first) 2>/dev/null; then
8173 if $test -f 123456789abcde; then
8174 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8175 val="$undef"
8176 else
8177 echo 'You can have filenames longer than 14 characters.'>&4
8178 val="$define"
8179 fi
8180else
8181 $cat <<'EOM'
8182You can't have filenames longer than 14 chars.
8183You can't even think about them!
8184EOM
8185 val="$undef"
8186fi
8187set d_flexfnam
8188eval $setvar
8189$rm -rf 123456789abcde*
8190
8191: determine where library module manual pages go
8192set man3dir man3dir none
8193eval $prefixit
8194$cat <<EOM
8195
8196$spackage has manual pages for many of the library modules.
8197EOM
8198
8199case "$nroff" in
8200nroff)
8201 $cat <<'EOM'
8202However, you don't have nroff, so they're probably useless to you.
8203EOM
8204 case "$man3dir" in
8205 '') man3dir="none";;
8206 esac;;
8207esac
8208
8209case "$d_flexfnam" in
8210undef)
8211 $cat <<'EOM'
de7128ac 8212However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8213EOM
8214 case "$man3dir" in
8215 '') man3dir="none";;
8216 esac;;
8217esac
8218
8219echo "If you don't want the manual sources installed, answer 'none'."
8220prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8221case "$man3dir" in
8222'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8223 if $test -d "$privlib/man/man3"; then
8224 cat <<EOM >&4
8225
8226WARNING: Previous versions of perl installed man3 pages into
de7128ac
NC
8227$privlib/man/man3. This version will suggest a
8228new default of $dflt.
b4eb6b3d
JH
8229EOM
8230 tdflt=$dflt
8231 dflt='n'
8232 rp='Do you wish to preserve the old behavior?(y/n)'
8233 . ./myread
8234 case "$ans" in
8235 y*) dflt="$privlib/man/man3" ;;
8236 *) dflt=$tdflt ;;
8237 esac
8238 fi
8239 ;;
8240*) dflt="$man3dir" ;;
8241esac
8242case "$dflt" in
8243' ') dflt=none ;;
8244esac
8245echo " "
8246fn=dn+~
8247rp="Where do the $package library man pages (source) go?"
8248. ./getfile
de7128ac
NC
8249prefixvar=man3dir
8250. ./setprefixvar
8251
b4eb6b3d
JH
8252case "$man3dir" in
8253'') man3dir=' '
8254 installman3dir='';;
8255esac
8256
b4eb6b3d
JH
8257: What suffix to use on installed man pages
8258case "$man3dir" in
8259' ')
8260 man3ext='0'
8261 ;;
8262*)
8263 rp="What suffix should be used for the $package library man pages?"
8264 case "$man3ext" in
8265 '') case "$man3dir" in
8266 *3) dflt=3 ;;
8267 *3p) dflt=3p ;;
8268 *3pm) dflt=3pm ;;
8269 *l) dflt=l;;
8270 *n) dflt=n;;
8271 *o) dflt=o;;
8272 *p) dflt=p;;
8273 *C) dflt=C;;
8274 *L) dflt=L;;
8275 *L3) dflt=L3;;
8276 *) dflt=3;;
8277 esac
8278 ;;
8279 *) dflt="$man3ext";;
8280 esac
8281 . ./myread
8282 man3ext="$ans"
8283 ;;
8284esac
8285
8286: see if we have to deal with yellow pages, now NIS.
0384a54a 8287if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8288 if $test -f /usr/etc/nibindd; then
8289 echo " "
8290 echo "I'm fairly confident you're on a NeXT."
8291 echo " "
8292 rp='Do you get the hosts file via NetInfo?'
8293 dflt=y
8294 case "$hostcat" in
8295 nidump*) ;;
8296 '') ;;
8297 *) dflt=n;;
8298 esac
8299 . ./myread
8300 case "$ans" in
8301 y*) hostcat='nidump hosts .';;
8302 *) case "$hostcat" in
8303 nidump*) hostcat='';;
8304 esac
8305 ;;
8306 esac
8307 fi
8308 case "$hostcat" in
8309 nidump*) ;;
8310 *)
8311 case "$hostcat" in
8312 *ypcat*) dflt=y;;
8313 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8314 dflt=y
8315 else
8316 dflt=n
8317 fi;;
8318 *) dflt=n;;
8319 esac
8320 echo " "
8321 rp='Are you getting the hosts file via yellow pages?'
8322 . ./myread
8323 case "$ans" in
8324 y*) hostcat='ypcat hosts';;
8325 *) hostcat='cat /etc/hosts';;
8326 esac
8327 ;;
8328 esac
8329fi
8330case "$hostcat" in
8331'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8332esac
8333case "$groupcat" in
8334'') test -f /etc/group && groupcat='cat /etc/group';;
8335esac
8336case "$passcat" in
8337'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8338esac
8339
8340: now get the host name
8341echo " "
8342echo "Figuring out host name..." >&4
8343case "$myhostname" in
8344'') cont=true
8345 echo 'Maybe "hostname" will work...'
73614538 8346 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8347 myhostname=$tans
8348 phostname=hostname
8349 cont=''
8350 fi
8351 ;;
8352*) cont='';;
8353esac
8354if $test "$cont"; then
8355 if ./xenix; then
8356 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8357 if tans=`cat /etc/systemid 2>&1` ; then
8358 myhostname=$tans
8359 phostname='cat /etc/systemid'
8360 echo "Whadyaknow. Xenix always was a bit strange..."
8361 cont=''
8362 fi
8363 elif $test -r /etc/systemid; then
8364 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8365 fi
8366fi
8367if $test "$cont"; then
8368 echo 'No, maybe "uuname -l" will work...'
73614538 8369 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8370 myhostname=$tans
8371 phostname='uuname -l'
8372 else
8373 echo 'Strange. Maybe "uname -n" will work...'
73614538 8374 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8375 myhostname=$tans
8376 phostname='uname -n'
8377 else
8378 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8379 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8380 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8381 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8382 else
8383 case "$myhostname" in
8384 '') echo "Does this machine have an identity crisis or something?"
8385 phostname='';;
8386 *)
8387 echo "Well, you said $myhostname before..."
8388 phostname='echo $myhostname';;
8389 esac
8390 fi
8391 fi
8392 fi
8393fi
52a549d0
JH
8394case "$myhostname" in
8395'') myhostname=noname ;;
8396esac
b4eb6b3d
JH
8397: you do not want to know about this
8398set $myhostname
8399myhostname=$1
8400
8401: verify guess
8402if $test "$myhostname" ; then
8403 dflt=y
8404 rp='Your host name appears to be "'$myhostname'".'" Right?"
8405 . ./myread
8406 case "$ans" in
8407 y*) ;;
8408 *) myhostname='';;
8409 esac
8410fi
8411
8412: bad guess or no guess
8413while $test "X$myhostname" = X ; do
8414 dflt=''
8415 rp="Please type the (one word) name of your host:"
8416 . ./myread
8417 myhostname="$ans"
8418done
8419
8420: translate upper to lower if necessary
8421case "$myhostname" in
8422*[A-Z]*)
8423 echo "(Normalizing case in your host name)"
8424 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8425 ;;
8426esac
8427
8428case "$myhostname" in
8429*.*)
8430 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8431 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8432 echo "(Trimming domain name from host name--host name is now $myhostname)"
8433 ;;
8434*) case "$mydomain" in
8435 '')
8436 {
8437 test "X$hostcat" = "Xypcat hosts" &&
8438 ypmatch "$myhostname" hosts 2>/dev/null |\
8439 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8440 $test -s hosts
8441 } || {
8442 test "X$hostcat" != "X" &&
8443 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8444 /[ ]$myhostname[ . ]/p" > hosts
8445 }
8446 tmp_re="[ . ]"
f08cbdd1
PP
8447 if $test -f hosts; then
8448 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8449 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8450 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8451 hosts | $sort | $uniq | \
8452 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8453 case `$echo X$dflt` in
8454 X*\ *) echo "(Several hosts in the database matched hostname)"
8455 dflt=.
8456 ;;
8457 X.) echo "(You do not have fully-qualified names in the hosts database)"
8458 ;;
8459 esac
8460 else
8461 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8462 dflt=.
f08cbdd1 8463 fi
b4eb6b3d
JH
8464 case "$dflt" in
8465 .)
8466 tans=`./loc resolv.conf X /etc /usr/etc`
8467 if $test -f "$tans"; then
8468 echo "(Attempting domain name extraction from $tans)"
8469 dflt=.`$sed -n -e 's/ / /g' \
8470 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8471 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8472 case "$dflt" in
8473 .) dflt=.`$sed -n -e 's/ / /g' \
8474 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8475 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8476 ;;
8477 esac
8478 fi
8479 ;;
8480 esac
8481 case "$dflt" in
8482 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8483 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8484 case "$dflt" in
8485 '') dflt='.';;
8486 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8487 esac
8488 ;;
8489 esac
59c9e5d6
PP
8490 case "$dflt$osname" in
8491 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8492 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8493 ;;
8494 esac
b4eb6b3d
JH
8495 case "$dflt" in
8496 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8497 dflt='.nonet'
b4eb6b3d
JH
8498 ;;
8499 esac
8500 $rm -f hosts
8501 ;;
8502 *) dflt="$mydomain";;
8503 esac;;
8504esac
8505echo " "
8506rp="What is your domain name?"
8507. ./myread
8508tans="$ans"
8509case "$ans" in
8510'') ;;
8511.*) ;;
8512*) tans=".$tans";;
8513esac
8514mydomain="$tans"
8515
8516: translate upper to lower if necessary
8517case "$mydomain" in
8518*[A-Z]*)
8519 echo "(Normalizing case in your domain name)"
8520 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8521 ;;
8522esac
8523
8524: a little sanity check here
8525case "$phostname" in
8526'') ;;
8527*)
8528 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8529 $myhostname$mydomain|$myhostname) ;;
8530 *)
8531 case "$phostname" in
8532 sed*)
8533 echo "(That doesn't agree with your whoami.h file, by the way.)"
8534 ;;
8535 *)
8536 echo "(That doesn't agree with your $phostname command, by the way.)"
8537 ;;
8538 esac
8539 ;;
8540 esac
8541 ;;
8542esac
8543
8544$cat <<EOM
8545
8546I need to get your e-mail address in Internet format if possible, i.e.
8547something like user@host.domain. Please answer accurately since I have
8548no easy means to double check it. The default value provided below
8549is most probably close to reality but may not be valid from outside
8550your organization...
8551
8552EOM
8553cont=x
8554while test "$cont"; do
8555 case "$cf_email" in
8556 '') dflt="$cf_by@$myhostname$mydomain";;
8557 *) dflt="$cf_email";;
8558 esac
8559 rp='What is your e-mail address?'
8560 . ./myread
8561 cf_email="$ans"
8562 case "$cf_email" in
8563 *@*.*) cont='' ;;
8564 *)
8565 rp='Address does not look like an Internet one. Use it anyway?'
8566 case "$fastread" in
8567 yes) dflt=y ;;
8568 *) dflt=n ;;
8569 esac
8570 . ./myread
8571 case "$ans" in
8572 y*) cont='' ;;
8573 *) echo " " ;;
8574 esac
8575 ;;
8576 esac
8577done
8578
8579$cat <<EOM
8580
8581If you or somebody else will be maintaining perl at your site, please
8582fill in the correct e-mail address here so that they may be contacted
8583if necessary. Currently, the "perlbug" program included with perl
8584will send mail to this address in addition to perlbug@perl.org. You may
8585enter "none" for no administrator.
8586
8587EOM
8588case "$perladmin" in
8589'') dflt="$cf_email";;
8590*) dflt="$perladmin";;
8591esac
8592rp='Perl administrator e-mail address'
8593. ./myread
8594perladmin="$ans"
8595
674912d7
RB
8596: determine whether to only install version-specific parts.
8597echo " "
8598$cat <<EOM
8599Do you want to install only the version-specific parts of the perl
8600distribution? Usually you do *not* want to do this.
8601EOM
8602case "$versiononly" in
8603"$define"|[Yy]*|true) dflt='y' ;;
8604*) dflt='n';
8605esac
8606rp="Do you want to install only the version-specific parts of perl?"
8607. ./myread
8608case "$ans" in
8609[yY]*) val="$define";;
8610*) val="$undef" ;;
8611esac
8612set versiononly
8613eval $setvar
8614
ad493445
MB
8615case "$versiononly" in
8616"$define") inc_version_list=''
8617 inc_version_list_init=0
8618 ;;
8619esac
8620
b4eb6b3d 8621: figure out how to guarantee perl startup
de7128ac 8622: XXX Note that this currently takes advantage of the bug that binexp ignores
74950343
NC
8623: the Configure -Dinstallprefix setting, which in turn means that under
8624: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8625case "$startperl" in
8626'')
8627 case "$sharpbang" in
8628 *!)
8629 $cat <<EOH
8630
8631I can use the #! construct to start perl on your system. This will
8632make startup of perl scripts faster, but may cause problems if you
8633want to share those scripts and perl is not in a standard place
74950343
NC
8634($initialinstalllocation/perl) on all your platforms. The alternative
8635is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8636
8637EOH
674912d7 8638 case "$versiononly" in
74950343 8639 "$define") dflt="$initialinstalllocation/perl$version";;
de7128ac 8640 *) dflt="$initialinstalllocation/perl";;
674912d7 8641 esac
b4eb6b3d
JH
8642 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8643 . ./myread
8644 case "$ans" in
8645 none) startperl=": # use perl";;
8646 *) startperl="#!$ans"
8647 if $test 30 -lt `echo "$ans" | wc -c`; then
8648 $cat >&4 <<EOM
8649
8650WARNING: Some systems limit the #! command to 32 characters.
8651If you experience difficulty running Perl scripts with #!, try
8652installing Perl in a directory with a shorter pathname.
8653
8654EOM
8655 fi ;;
8656 esac
8657 ;;
8658 *) startperl=": # use perl"
8659 ;;
8660 esac
8661 ;;
8662esac
8663echo "I'll use $startperl to start perl scripts."
8664
8665: figure best path for perl in scripts
8666case "$perlpath" in
8667'')
5e20a8ca 8668 case "$versiononly" in
de7128ac
NC
8669 "$define") perlpath="$initialinstalllocation/perl$version";;
8670 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8671 esac
b4eb6b3d
JH
8672 case "$startperl" in
8673 *!*) ;;
8674 *)
8675 $cat <<EOH
8676
8677I will use the "eval 'exec'" idiom to start Perl on your system.
8678I can use the full path of your Perl binary for this purpose, but
8679doing so may cause problems if you want to share those scripts and
de7128ac 8680Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8681
8682EOH
de7128ac 8683 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8684 rp="What path shall I use in \"eval 'exec'\"?"
8685 . ./myread
8686 perlpath="$ans"
8687 ;;
8688 esac
8689 ;;
8690esac
8691case "$startperl" in
8692*!*) ;;
8693*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8694esac
8695
8696: determine where public executable scripts go
8697set scriptdir scriptdir
8698eval $prefixit
8699case "$scriptdir" in
8700'')
8701 dflt="$bin"
8702 : guess some guesses
8703 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8704 $test -d /usr/share/bin && dflt=/usr/share/bin
8705 $test -d /usr/local/script && dflt=/usr/local/script
8706 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8707 $test -d $prefixexp/script && dflt=$prefixexp/script
8708 set dflt
8709 eval $prefixup
8710 ;;
8711*) dflt="$scriptdir"
8712 ;;
8713esac
8714$cat <<EOM
de7128ac 8715
b4eb6b3d
JH
8716Some installations have a separate directory just for executable scripts so
8717that they can mount it across multiple architectures but keep the scripts in
8718one spot. You might, for example, have a subdirectory of /usr/share for this.
8719Or you might just lump your scripts in with all your other executables.
de7128ac 8720
b4eb6b3d
JH
8721EOM
8722fn=d~
8723rp='Where do you keep publicly executable scripts?'
8724. ./getfile
8725if $test "X$ansexp" != "X$scriptdirexp"; then
8726 installscript=''
8727fi
de7128ac
NC
8728installscriptdir=''
8729prefixvar=scriptdir
8730. ./setprefixvar
8731: A little fix up for an irregularly named variable.
8732installscript="$installscriptdir"
b4eb6b3d
JH
8733
8734: determine where add-on public executables go
8735case "$sitebin" in
8736'') dflt=$siteprefix/bin ;;
8737*) dflt=$sitebin ;;
8738esac
8739fn=d~
8740rp='Pathname where the add-on public executables should be installed?'
8741. ./getfile
de7128ac
NC
8742prefixvar=sitebin
8743. ./setprefixvar
b4eb6b3d 8744
6e1038e0 8745: determine where add-on html pages go
3bb95762 8746: There is no standard location, so try to copy the previously-selected
6e1038e0 8747: directory structure for the core html pages.
3bb95762
JH
8748case "$sitehtml1dir" in
8749'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8750*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8751esac
8752case "$dflt" in
8753''|' ') dflt=none ;;
8754esac
8755fn=dn+~
8756rp='Pathname where the site-specific html pages should be installed?'
8757. ./getfile
de7128ac
NC
8758prefixvar=sitehtml1dir
8759. ./setprefixvar
6e1038e0
MB
8760
8761: determine where add-on library html pages go
8762: There is no standard location, so try to copy the previously-selected
8763: directory structure for the core html pages.
3bb95762
JH
8764case "$sitehtml3dir" in
8765'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8766*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8767esac
8768case "$dflt" in
8769''|' ') dflt=none ;;
8770esac
8771fn=dn+~
8772rp='Pathname where the site-specific library html pages should be installed?'
8773. ./getfile
de7128ac
NC
8774prefixvar=sitehtml3dir
8775. ./setprefixvar
6e1038e0
MB
8776
8777: determine where add-on manual pages go
3bb95762
JH
8778case "$siteman1dir" in
8779'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
de7128ac 8780*) dflt=$siteman1dir ;;
6e1038e0 8781esac
c061b110
JH
8782case "$dflt" in
8783''|' ') dflt=none ;;
8784esac
6e1038e0
MB
8785fn=dn+~
8786rp='Pathname where the site-specific manual pages should be installed?'
8787. ./getfile
de7128ac
NC
8788prefixvar=siteman1dir
8789. ./setprefixvar
6e1038e0
MB
8790
8791: determine where add-on library man pages go
3bb95762
JH
8792case "$siteman3dir" in
8793'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
de7128ac 8794*) dflt=$siteman3dir ;;
6e1038e0 8795esac
c061b110
JH
8796case "$dflt" in
8797''|' ') dflt=none ;;
8798esac
6e1038e0
MB
8799fn=dn+~
8800rp='Pathname where the site-specific library manual pages should be installed?'
8801. ./getfile
de7128ac
NC
8802prefixvar=siteman3dir
8803. ./setprefixvar
6e1038e0
MB
8804
8805: determine where add-on public executable scripts go
8806case "$sitescript" in
8807'') dflt=$siteprefix/script
8808 $test -d $dflt || dflt=$sitebin ;;
8809*) dflt="$sitescript" ;;
8810esac
8811fn=d~+
8812rp='Pathname where add-on public executable scripts should be installed?'
8813. ./getfile
de7128ac
NC
8814prefixvar=sitescript
8815. ./setprefixvar
6e1038e0 8816
ff0950a8
JH
8817case "$usefaststdio" in
8818$define|true|[yY]*|'')
8819 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8820 case "$xversion" in
8821 [68]) dflt='y' ;;
8822 *) dflt='n' ;;
8823 esac
8824 ;;
8825*) dflt='n';;
8826esac
8827cat <<EOM
8828
8829Perl can be built to use 'fast stdio', which means using the stdio
8830library but also directly manipulating the stdio buffers to enable
8831faster I/O. Using stdio is better for backward compatibility (especially
8832for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8833interface has been preferred instead of stdio.
8834
8835If this doesn't make any sense to you, just accept the default '$dflt'.
8836EOM
8837rp='Use the "fast stdio" if available?'
8838. ./myread
8839case "$ans" in
8840y|Y) val="$define" ;;
8841*) val="$undef" ;;
8842esac
8843set usefaststdio
8844eval $setvar
8845
8846
96056487
JH
8847: define an is-a-typedef? function
8848typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8849case "$inclist" in
8850"") inclist="sys/types.h";;
8851esac;
8852eval "varval=\$$var";
8853case "$varval" in
8854"")
8855 $rm -f temp.c;
8856 for inc in $inclist; do
8857 echo "#include <$inc>" >>temp.c;
8858 done;
8859 echo "#ifdef $type" >> temp.c;
8860 echo "printf(\"We have $type\");" >> temp.c;
8861 echo "#endif" >> temp.c;
8862 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8863 if $contains $type temp.E >/dev/null 2>&1; then
8864 eval "$var=\$type";
8865 else
8866 eval "$var=\$def";
8867 fi;
8868 $rm -f temp.?;;
8869*) eval "$var=\$varval";;
8870esac'
8871
8872: define an is-a-typedef? function that prompts if the type is not available.
8873typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8874case "$inclist" in
8875"") inclist="sys/types.h";;
8876esac;
8877eval "varval=\$$var";
8878case "$varval" in
8879"")
8880 $rm -f temp.c;
8881 for inc in $inclist; do
8882 echo "#include <$inc>" >>temp.c;
8883 done;
8884 echo "#ifdef $type" >> temp.c;
8885 echo "printf(\"We have $type\");" >> temp.c;
8886 echo "#endif" >> temp.c;
8887 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8888 echo " " ;
8889 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8890 if $contains $type temp.E >/dev/null 2>&1; then
8891 echo "$type found." >&4;
8892 eval "$var=\$type";
8893 else
8894 echo "$type NOT found." >&4;
8895 dflt="$def";
8896 . ./myread ;
8897 eval "$var=\$ans";
8898 fi;
8899 $rm -f temp.?;;
8900*) eval "$var=\$varval";;
8901esac'
8902
8903: see what type lseek is declared as in the kernel
8904rp="What is the type used for lseek's offset on this system?"
8905set off_t lseektype long stdio.h sys/types.h
8906eval $typedef_ask
8907
8908echo " "
8909echo "Checking to see how big your file offsets are..." >&4
8910$cat >try.c <<EOCP
8911#include <sys/types.h>
8912#include <stdio.h>
8913int main()
8914{
8915 printf("%d\n", (int)sizeof($lseektype));
8916 return(0);
8917}
8918EOCP
8919set try
8920if eval $compile_ok; then
8921 lseeksize=`$run ./try`
8922 echo "Your file offsets are $lseeksize bytes long."
8923else
8924 dflt=$longsize
8925 echo " "
8926 echo "(I can't seem to compile the test program. Guessing...)"
8927 rp="What is the size of your file offsets (in bytes)?"
8928 . ./myread
8929 lseeksize="$ans"
8930fi
8931$rm -f try.c try
8932
8933: see what type file positions are declared as in the library
8934rp="What is the type for file position used by fsetpos()?"
8935set fpos_t fpostype long stdio.h sys/types.h
8936eval $typedef_ask
8937
8938echo " "
8939case "$fpostype" in
8940*_t) zzz="$fpostype" ;;
8941*) zzz="fpos_t" ;;
8942esac
8943echo "Checking the size of $zzz..." >&4
8944cat > try.c <<EOCP
8945#include <sys/types.h>
8946#include <stdio.h>
5ed858ef
JH
8947#$i_stdlib I_STDLIB
8948#ifdef I_STDLIB
8949#include <stdlib.h>
8950#endif
96056487
JH
8951int main() {
8952 printf("%d\n", (int)sizeof($fpostype));
8953 exit(0);
8954}
8955EOCP
8956set try
8957if eval $compile_ok; then
8958 yyy=`$run ./try`
8959 case "$yyy" in
8960 '') fpossize=4
8961 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8962 ;;
8963 *) fpossize=$yyy
8964 echo "Your $zzz is $fpossize bytes long."
8965 ;;
8966 esac
8967else
8968 dflt="$longsize"
8969 echo " " >&4
8970 echo "(I can't compile the test program. Guessing...)" >&4
8971 rp="What is the size of your file positions (in bytes)?"
8972 . ./myread
8973 fpossize="$ans"
8974fi
8975
96056487
JH
8976# Backward compatibility (uselfs is deprecated).
8977case "$uselfs" in
8978"$define"|true|[yY]*)
8979 cat <<EOM >&4
8980
8981*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8982EOM
8983 uselargefiles="$define"
8984 ;;
8985esac
8986
8987case "$lseeksize:$fpossize" in
89888:8) cat <<EOM
8989
8990You can have files larger than 2 gigabytes.
8991EOM
8992 val="$define" ;;
8993*) case "$uselargefiles" in
8994 "$undef"|false|[nN]*) dflt='n' ;;
8995 *) dflt='y' ;;
8996 esac
8997 cat <<EOM
8998
8999Perl can be built to understand large files (files larger than 2 gigabytes)
9000on some systems. To do so, Configure can be run with -Duselargefiles.
9001
9002If this doesn't make any sense to you, just accept the default '$dflt'.
9003EOM
9004 rp='Try to understand large files, if available?'
9005 . ./myread
9006 case "$ans" in
9007 y|Y) val="$define" ;;
9008 *) val="$undef" ;;
9009 esac
9010 ;;
9011esac
9012set uselargefiles
9013eval $setvar
96056487
JH
9014: Look for a hint-file generated 'call-back-unit'. If the
9015: user has specified that a large files perl is to be built,
9016: we may need to set or change some other defaults.
6bd2d01f
NC
9017if $test -f uselargefiles.cbu; then
9018 echo "Your platform has some specific hints regarding large file builds, using them..."
9019 . ./uselargefiles.cbu
9020fi
9021case "$uselargefiles" in
9022"$define")
96056487 9023 if $test -f uselargefiles.cbu; then
96056487
JH
9024 echo " "
9025 echo "Rechecking to see how big your file offsets are..." >&4
9026 $cat >try.c <<EOCP
9027#include <sys/types.h>
9028#include <stdio.h>
9029int main()
9030{
9031 printf("%d\n", (int)sizeof($lseektype));
9032 return(0);
9033}
9034EOCP
9035 set try
9036 if eval $compile_ok; then
9037 lseeksize=`$run ./try`
9038 $echo "Your file offsets are now $lseeksize bytes long."
9039 else
9040 dflt="$lseeksize"
9041 echo " "
9042 echo "(I can't seem to compile the test program. Guessing...)"
9043 rp="What is the size of your file offsets (in bytes)?"
9044 . ./myread
9045 lseeksize="$ans"
9046 fi
9047 case "$fpostype" in
9048 *_t) zzz="$fpostype" ;;
9049 *) zzz="fpos_t" ;;
9050 esac
9051 $echo $n "Rechecking the size of $zzz...$c" >&4
9052 $cat > try.c <<EOCP
9053#include <sys/types.h>
9054#include <stdio.h>
5a29c6bc
JH
9055#$i_stdlib I_STDLIB
9056#ifdef I_STDLIB
9057#include <stdlib.h>
9058#endif
96056487
JH
9059int main() {
9060 printf("%d\n", (int)sizeof($fpostype));
c04fee9e 9061 return(0);
96056487
JH
9062}
9063EOCP
9064 set try
9065 if eval $compile_ok; then
9066 yyy=`$run ./try`
9067 dflt="$lseeksize"
9068 case "$yyy" in
9069 '') echo " "
9070 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9071 ;;
9072 *) fpossize=$yyy
9073 echo " $fpossize bytes." >&4
9074 ;;
9075 esac
9076 else
9077 dflt="$fpossize"
9078 echo " "
9079 echo "(I can't compile the test program. Guessing...)" >&4
9080 rp="What is the size of your file positions (in bytes)?"
9081 . ./myread
9082 fpossize="$ans"
9083 fi
9084 $rm -f try.c try
9085 fi
9086 ;;
9087esac
9088
b4eb6b3d
JH
9089case "$vendorprefix" in
9090'') d_vendorbin="$undef"
9091 vendorbin=''
9092 vendorbinexp=''
9093 ;;
9094*) d_vendorbin="$define"
9095 : determine where vendor-supplied executables go.
9096 case "$vendorbin" in
9097 '') dflt=$vendorprefix/bin ;;
9098 *) dflt="$vendorbin" ;;
9099 esac
9100 fn=d~+
9101 rp='Pathname for the vendor-supplied executables directory?'
9102 . ./getfile
9103 vendorbin="$ans"
9104 vendorbinexp="$ansexp"
9105 ;;
9106esac
de7128ac
NC
9107prefixvar=vendorbin
9108. ./installprefix
b4eb6b3d 9109
6e1038e0 9110case "$vendorprefix" in
3bb95762
JH
9111'') vendorhtml1dir=''
9112 vendorhtml1direxp=''
6e1038e0
MB
9113 ;;
9114*) : determine where vendor-supplied html pages go.
9115 : There is no standard location, so try to copy the previously-selected
9116 : directory structure for the core html pages.
9117 : XXX Better default suggestions would be welcome.
3bb95762 9118 case "$vendorhtml1dir" in
6e1038e0 9119 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9120 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9121 esac
9122 case "$dflt" in
9123 ''|' ') dflt=none ;;
9124 esac
9125 fn=dn+~
9126 rp='Pathname for the vendor-supplied html pages?'
9127 . ./getfile
3bb95762
JH
9128 vendorhtml1dir="$ans"
9129 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9130 ;;
9131esac
9132: Use ' ' for none so value is preserved next time through Configure
3bb95762 9133$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
de7128ac
NC
9134prefixvar=vendorhtml1dir
9135. ./installprefix
6e1038e0
MB
9136
9137case "$vendorprefix" in
3bb95762
JH
9138'') vendorhtml3dir=''
9139 vendorhtml3direxp=''
6e1038e0
MB
9140 ;;
9141*) : determine where vendor-supplied module html pages go.
9142 : There is no standard location, so try to copy the previously-selected
9143 : directory structure for the core html pages.
9144 : XXX Better default suggestions would be welcome.
3bb95762 9145 case "$vendorhtml3dir" in
6e1038e0 9146 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9147 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9148 esac
9149 case "$dflt" in
9150 ''|' ') dflt=none ;;
9151 esac
9152 fn=dn+~
9153 rp='Pathname for the vendor-supplied html pages?'
9154 . ./getfile
3bb95762
JH
9155 vendorhtml3dir="$ans"
9156 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9157 ;;
9158esac
9159: Use ' ' for none so value is preserved next time through Configure
3bb95762 9160$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
de7128ac
NC
9161prefixvar=vendorhtml3dir
9162. ./installprefix
6e1038e0
MB
9163
9164case "$vendorprefix" in
3bb95762
JH
9165'') vendorman1dir=''
9166 vendorman1direxp=''
6e1038e0
MB
9167 ;;
9168*) : determine where vendor-supplied manual pages go.
3bb95762 9169 case "$vendorman1dir" in
6e1038e0 9170 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9171 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9172 esac
9173 case "$dflt" in
9174 ''|' ') dflt=none ;;
9175 esac
9176 fn=nd~+
9177 rp='Pathname for the vendor-supplied manual section 1 pages?'
9178 . ./getfile
3bb95762
JH
9179 vendorman1dir="$ans"
9180 vendorman1direxp="$ansexp"
6e1038e0
MB
9181 ;;
9182esac
9183: Use ' ' for none so value is preserved next time through Configure
3bb95762 9184$test X"$vendorman1dir" = "X" && vendorman1dir=' '
de7128ac
NC
9185prefixvar=vendorman1dir
9186. ./installprefix
6e1038e0
MB
9187
9188case "$vendorprefix" in
3bb95762
JH
9189'') vendorman3dir=''
9190 vendorman3direxp=''
6e1038e0
MB
9191 ;;
9192*) : determine where vendor-supplied module manual pages go.
3bb95762 9193 case "$vendorman3dir" in
6e1038e0 9194 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9195 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9196 esac
9197 case "$dflt" in
9198 ''|' ') dflt=none ;;
9199 esac
9200 fn=nd~+
9201 rp='Pathname for the vendor-supplied manual section 3 pages?'
9202 . ./getfile
3bb95762
JH
9203 vendorman3dir="$ans"
9204 vendorman3direxp="$ansexp"
6e1038e0
MB
9205 ;;
9206esac
9207: Use ' ' for none so value is preserved next time through Configure
3bb95762 9208$test X"$vendorman3dir" = "X" && vendorman3dir=' '
de7128ac
NC
9209prefixvar=vendorman3dir
9210. ./installprefix
6e1038e0
MB
9211
9212case "$vendorprefix" in
9213'') d_vendorscript="$undef"
9214 vendorscript=''
9215 vendorscriptexp=''
9216 ;;
9217*) d_vendorscript="$define"
9218 : determine where vendor-supplied scripts go.
9219 case "$vendorscript" in
9220 '') dflt=$vendorprefix/script
9221 $test -d $dflt || dflt=$vendorbin ;;
9222 *) dflt="$vendorscript" ;;
9223 esac
9224 $cat <<EOM
9225
de7128ac 9226The installation process will create a directory for
6e1038e0
MB
9227vendor-supplied scripts.
9228
9229EOM
9230 fn=d~+
9231 rp='Pathname for the vendor-supplied scripts directory?'
9232 . ./getfile
9233 vendorscript="$ans"
9234 vendorscriptexp="$ansexp"
9235 ;;
9236esac
de7128ac
NC
9237prefixvar=vendorscript
9238. ./installprefix
5a29c6bc
JH
9239
9240: see if qgcvt exists
9241set qgcvt d_qgcvt
9242eval $inlibc
9243
9244echo " "
9245
9246if $test X"$d_longdbl" = X"$define"; then
9247
9248echo "Checking how to print long doubles..." >&4
9249
9250if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9251 $cat >try.c <<'EOCP'
9252#include <sys/types.h>
9253#include <stdio.h>
9254int main() {
9255 double d = 123.456;
9256 printf("%.3f\n", d);
9257}
9258EOCP
9259 set try
9260 if eval $compile; then
9261 yyy=`$run ./try`
9262 case "$yyy" in
9263 123.456)
9264 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9265 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9266 echo "We will use %f."
9267 ;;
9268 esac
9269 fi
9270fi
9271
9272if $test X"$sPRIfldbl" = X; then
9273 $cat >try.c <<'EOCP'
9274#include <sys/types.h>
9275#include <stdio.h>
9276int main() {
9277 long double d = 123.456;
9278 printf("%.3Lf\n", d);
9279}
9280EOCP
9281 set try
9282 if eval $compile; then
9283 yyy=`$run ./try`
9284 case "$yyy" in
9285 123.456)
9286 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9287 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9288 echo "We will use %Lf."
9289 ;;
9290 esac
9291 fi
9292fi
9293
9294if $test X"$sPRIfldbl" = X; then
9295 $cat >try.c <<'EOCP'
9296#include <sys/types.h>
9297#include <stdio.h>
9298int main() {
9299 long double d = 123.456;
9300 printf("%.3llf\n", d);
9301}
9302EOCP
9303 set try
9304 if eval $compile; then
9305 yyy=`$run ./try`
9306 case "$yyy" in
9307 123.456)
9308 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9309 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9310 echo "We will use %llf."
9311 ;;
9312 esac
9313 fi
9314fi
9315
9316if $test X"$sPRIfldbl" = X; then
9317 $cat >try.c <<'EOCP'
9318#include <sys/types.h>
9319#include <stdio.h>
9320int main() {
9321 long double d = 123.456;
9322 printf("%.3lf\n", d);
9323}
9324EOCP
9325 set try
9326 if eval $compile; then
9327 yyy=`$run ./try`
9328 case "$yyy" in
9329 123.456)
9330 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9331 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9332 echo "We will use %lf."
9333 ;;
9334 esac
9335 fi
9336fi
9337
9338if $test X"$sPRIfldbl" = X; then
9339 echo "Cannot figure out how to print long doubles." >&4
9340else
9341 sSCNfldbl=$sPRIfldbl # expect consistency
6e1038e0
MB
9342fi
9343
5a29c6bc
JH
9344$rm -f try try.*
9345
9346fi # d_longdbl
9347
9348case "$sPRIfldbl" in
9349'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9350 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9351 d_SCNfldbl="$undef";
9352 ;;
9353*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9354 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9355 d_SCNfldbl="$define";
9356 ;;
9357esac
b4eb6b3d 9358
b4eb6b3d 9359: Check how to convert floats to strings.
a5b10d80
YST
9360
9361if test "X$d_Gconvert" = X; then
9362
b4eb6b3d
JH
9363echo " "
9364echo "Checking for an efficient way to convert floats to strings."
9365echo " " > try.c
9366case "$uselongdouble" in
9367"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9368esac
9369case "$d_longdbl" in
9370"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9371esac
9372case "$d_PRIgldbl" in
9373"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9374esac
9375$cat >>try.c <<EOP
9376#ifdef TRY_gconvert
9377#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9378char *myname = "gconvert";
9379#endif
9380#ifdef TRY_gcvt
9381#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9382char *myname = "gcvt";
9383#endif
9384#ifdef TRY_qgcvt
9385#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9386char *myname = "qgcvt";
9387#define DOUBLETYPE long double
9388#endif
9389#ifdef TRY_sprintf
a5b10d80
YST
9390#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9391#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9392#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9393#else
a5b10d80
YST
9394#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9395#endif
9396#else
b4eb6b3d
JH
9397#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9398#endif
9399char *myname = "sprintf";
9400#endif
9401
9402#ifndef DOUBLETYPE
9403#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9404#define DOUBLETYPE long double
9405#else
9406#define DOUBLETYPE double
9407#endif
9408#endif
9409
9410#include <stdio.h>
9411
9412#define I_STDLIB $i_stdlib
9413#ifdef I_STDLIB
9414#include <stdlib.h>
9415#endif
9416
9417int
9418checkit(expect, got)
9419char *expect;
9420char *got;
9421{
9422 if (strcmp(expect, got)) {
9423 printf("%s oddity: Expected %s, got %s\n",
9424 myname, expect, got);
9425 exit(1);
9426 }
9427}
9428
9429int main()
9430{
9431 char buf[64];
9432 buf[63] = '\0';
9433
9434 /* This must be 1st test on (which?) platform */
9435 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9436 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9437 checkit("0.1", buf);
9438
a5b10d80
YST
9439 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9440 checkit("0.01", buf);
9441
9442 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9443 checkit("0.001", buf);
9444
9445 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9446 checkit("0.0001", buf);
9447
9448 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9449 if (strlen(buf) > 5)
9450 checkit("9e-005", buf); /* for Microsoft ?? */
9451 else
9452 checkit("9e-05", buf);
9453
b4eb6b3d
JH
9454 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9455 checkit("1", buf);
9456
9457 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9458 checkit("1.1", buf);
9459
9460 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9461 checkit("1.01", buf);
9462
9463 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9464 checkit("1.001", buf);
9465
9466 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9467 checkit("1.0001", buf);
9468
9469 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9470 checkit("1.00001", buf);
9471
9472 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9473 checkit("1.000001", buf);
9474
9475 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9476 checkit("0", buf);
9477
9478 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9479 checkit("-1", buf);
9480
9481 /* Some Linux gcvt's give 1.e+5 here. */
9482 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9483 checkit("100000", buf);
9484
9485 /* Some Linux gcvt's give -1.e+5 here. */
9486 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9487 checkit("-100000", buf);
9488
9489 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9490 checkit("123.456", buf);
9491
ab6ca9f4 9492 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9493 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9494 /* 34 should be enough to scare even long double
9495 * places into using the e notation. */
ab6ca9f4 9496 if (strlen(buf) > 5)
94b339ad 9497 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9498 else
94b339ad 9499 checkit("1e+34", buf);
8e2a5ede 9500
d1eb8299
YST
9501 /* For Perl, if you add additional tests here, also add them to
9502 * t/base/num.t for benefit of platforms not using Configure or
9503 * overriding d_Gconvert */
9504
b4eb6b3d
JH
9505 exit(0);
9506}
9507EOP
ab6ca9f4 9508: first add preferred functions to our list
a5b10d80 9509xxx_list=""
ab6ca9f4 9510for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9511 case $xxx_convert in
9512 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9513 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9514 esac
9515done
9516: then add any others
9517for xxx_convert in gconvert gcvt sprintf; do
9518 case "$xxx_list" in
9519 *$xxx_convert*) ;;
9520 *) xxx_list="$xxx_list $xxx_convert" ;;
9521 esac
9522done
9523
9524case "$d_longdbl$uselongdouble" in
9525"$define$define")
9526 : again, add prefered functions to our list first
9527 xxx_ld_list=""
ab6ca9f4 9528 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9529 case $xxx_convert in
9530 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9531 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9532 esac
9533 done
9534 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9535 for xxx_convert in qgcvt sprintf $xxx_list; do
9536 case "$xxx_ld_list" in
9537 $xxx_convert*|*" $xxx_convert"*) ;;
9538 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9539 esac
9540 done
9541 : if sprintf cannot do long doubles, move it to the end
9542 if test "$d_PRIgldbl" != "$define"; then
9543 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9544 fi
9545 : if no qgcvt, remove it
9546 if test "$d_qgcvt" != "$define"; then
9547 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9548 fi
9549 : use the ld_list
9550 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9551 ;;
9552esac
9553
9554for xxx_convert in $xxx_list; do
9555 echo "Trying $xxx_convert..."
9556 $rm -f try try$_o
9557 set try -DTRY_$xxx_convert
9558 if eval $compile; then
9559 echo "$xxx_convert() found." >&4
5440bc8e 9560 if $run ./try; then
b4eb6b3d
JH
9561 echo "I'll use $xxx_convert to convert floats into a string." >&4
9562 break;
9563 else
9564 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9565 xxx_convert=''
b4eb6b3d
JH
9566 fi
9567 else
9568 echo "$xxx_convert NOT found." >&4
9569 fi
9570done
ab6ca9f4 9571
a5b10d80
YST
9572if test X$xxx_convert = X; then
9573 echo "*** WHOA THERE!!! ***" >&4
9574 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9575 xxx_convert=sprintf
9576fi
9577
b4eb6b3d
JH
9578case "$xxx_convert" in
9579gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9580gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9581qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9582*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9583 "$define$define$define")
9584 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9585 "$define$define$undef")
9586 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9587 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9588 esac
9589 ;;
9590esac
9591
a5b10d80
YST
9592fi
9593
74cac757
JH
9594: see if _fwalk exists
9595set fwalk d__fwalk
9596eval $inlibc
9597
b4eb6b3d
JH
9598: Initialize h_fcntl
9599h_fcntl=false
9600
9601: Initialize h_sysfile
9602h_sysfile=false
9603
9604: access call always available on UNIX
9605set access d_access
9606eval $inlibc
9607
9608: locate the flags for 'access()'
9609case "$d_access" in
9610"$define")
9611 echo " "
5a29c6bc 9612 $cat >access.c <<EOCP
b4eb6b3d
JH
9613#include <sys/types.h>
9614#ifdef I_FCNTL
9615#include <fcntl.h>
9616#endif
9617#ifdef I_SYS_FILE
9618#include <sys/file.h>
9619#endif
9620#ifdef I_UNISTD
9621#include <unistd.h>
9622#endif
5a29c6bc
JH
9623#$i_stdlib I_STDLIB
9624#ifdef I_STDLIB
9625#include <stdlib.h>
9626#endif
b4eb6b3d
JH
9627int main() {
9628 exit(R_OK);
9629}
9630EOCP
9631 : check sys/file.h first, no particular reason here
9632 if $test `./findhdr sys/file.h` && \
7a282f6d 9633 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9634 h_sysfile=true;
9635 echo "<sys/file.h> defines the *_OK access constants." >&4
9636 elif $test `./findhdr fcntl.h` && \
7a282f6d 9637 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9638 h_fcntl=true;
9639 echo "<fcntl.h> defines the *_OK access constants." >&4
9640 elif $test `./findhdr unistd.h` && \
7a282f6d 9641 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9642 echo "<unistd.h> defines the *_OK access constants." >&4
9643 else
9644 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9645 fi
9646 ;;
9647esac
9648$rm -f access*
9649
9650: see if accessx exists
9651set accessx d_accessx
9652eval $inlibc
9653
5a29c6bc
JH
9654: see if aintl exists
9655set aintl d_aintl
9656eval $inlibc
9657
b4eb6b3d
JH
9658: see if alarm exists
9659set alarm d_alarm
9660eval $inlibc
9661
a9dade78
JH
9662: see if POSIX threads are available
9663set pthread.h i_pthread
9664eval $inhdr
9665
10bc17b6
JH
9666: define a fucntion to check prototypes
9667$cat > protochk <<EOSH
9668$startsh
9669cc="$cc"
9670optimize="$optimize"
9671ccflags="$ccflags"
9672prototype="$prototype"
9673define="$define"
9674rm=$rm
a9dade78
JH
9675usethreads=$usethreads
9676i_pthread=$i_pthread
9677pthread_h_first=$pthread_h_first
10bc17b6
JH
9678EOSH
9679
9680$cat >> protochk <<'EOSH'
9681
9682$rm -f try.c
9683foo="$1"
9684shift
9685while test $# -ge 2; do
9686 case "$1" in
9687 $define) echo "#include <$2>" >> try.c ;;
9688 literal) echo "$2" >> try.c ;;
9689 esac
cce6a207
MB
9690 # Extra magic for the benefit of systems that need pthread.h
9691 # to be included early to correctly detect threadsafe functions.
9692 # Such functions must guarantee themselves, though, that the usethreads
9693 # and i_pthread have been defined, before calling protochk.
9694 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9695 echo "#include <pthread.h>" >> try.c
9696 pthread_h_done=yes
9697 fi
10bc17b6
JH
9698 shift 2
9699done
9700test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9701cat >> try.c <<'EOCP'
9702#ifdef CAN_PROTOTYPE
9703#define _(args) args
9704#else
9705#define _(args) ()
9706#endif
9707EOCP
9708echo "$foo" >> try.c
9709echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9710$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9711status=$?
9712$rm -f try.[co]
9713exit $status
9714EOSH
9715chmod +x protochk
9716$eunicefix protochk
9717
5a29c6bc
JH
9718hasproto='varname=$1; func=$2; shift; shift;
9719while $test $# -ge 2; do
9720 case "$1" in
9721 $define) echo "#include <$2>";;
9722 esac ;
9723 shift 2;
9724done > try.c;
9725$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9726if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9727 echo "$func() prototype found.";
9728 val="$define";
9729else
9730 echo "$func() prototype NOT found.";
9731 val="$undef";
9732fi;
9733set $varname;
9734eval $setvar;
9735$rm -f try.c tryout.c'
9736
10bc17b6
JH
9737: see if sys/types.h has to be included
9738set sys/types.h i_systypes
9739eval $inhdr
9740
9741: see if sys/select.h has to be included
9742set sys/select.h i_sysselct
9743eval $inhdr
9744
9745hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9746while $test $# -ge 2; do
9747 case "$1" in
9748 $define) echo "#include <$2>";;
9749 esac ;
9750 shift 2;
9751done > try.c;
9752echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9753set try;
9754if eval $compile; then
9755 val="$define";
9756else
9757 val="$undef";
9758fi;
9759set $varname;
9760eval $setvar;
9761$rm -f try.c try.o'
9762
9763: see if we should include time.h, sys/time.h, or both
9764echo " "
9765if test "X$timeincl" = X; then
9766 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9767 $echo $n "I'm now running the test program...$c"
5a29c6bc 9768 $cat >try.c <<EOCP
10bc17b6
JH
9769#include <sys/types.h>
9770#ifdef I_TIME
9771#include <time.h>
9772#endif
9773#ifdef I_SYSTIME
9774#ifdef SYSTIMEKERNEL
9775#define KERNEL
9776#endif
9777#include <sys/time.h>
9778#endif
9779#ifdef I_SYSSELECT
9780#include <sys/select.h>
9781#endif
5a29c6bc
JH
9782#$i_stdlib I_STDLIB
9783#ifdef I_STDLIB
9784#include <stdlib.h>
9785#endif
10bc17b6
JH
9786int main()
9787{
9788 struct tm foo;
9789#ifdef S_TIMEVAL
9790 struct timeval bar;
9791#endif
9792#ifdef S_TIMEZONE
9793 struct timezone tzp;
9794#endif
9795 if (foo.tm_sec == foo.tm_sec)
9796 exit(0);
9797#ifdef S_TIMEVAL
9798 if (bar.tv_sec == bar.tv_sec)
9799 exit(0);
9800#endif
9801 exit(1);
9802}
9803EOCP
9804 flags=''
9805 for s_timezone in '-DS_TIMEZONE' ''; do
9806 sysselect=''
9807 for s_timeval in '-DS_TIMEVAL' ''; do
9808 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9809 for i_time in '' '-DI_TIME'; do
9810 for i_systime in '-DI_SYSTIME' ''; do
9811 case "$flags" in
9812 '') $echo $n ".$c"
9813 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9814 if eval $compile; then
9815 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9816 shift
9817 flags="$*"
9818 echo " "
9819 $echo $n "Succeeded with $flags$c"
9820 fi
9821 ;;
9822 esac
9823 done
9824 done
9825 done
9826 done
9827 done
9828 timeincl=''
9829 echo " "
9830 case "$flags" in
9831 *SYSTIMEKERNEL*) i_systimek="$define"
9832 timeincl=`./findhdr sys/time.h`
9833 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9834 *) i_systimek="$undef";;
9835 esac
9836 case "$flags" in
9837 *I_TIME*) i_time="$define"
9838 timeincl=`./findhdr time.h`" $timeincl"
9839 echo "We'll include <time.h>." >&4;;
9840 *) i_time="$undef";;
9841 esac
9842 case "$flags" in
9843 *I_SYSTIME*) i_systime="$define"
9844 timeincl=`./findhdr sys/time.h`" $timeincl"
9845 echo "We'll include <sys/time.h>." >&4;;
9846 *) i_systime="$undef";;
9847 esac
9848 $rm -f try.c try
9849fi
9850: see if struct tm knows about tm_zone
9851case "$i_systime$i_time" in
9852*$define*)
9853 echo " "
9854 echo "Checking to see if your struct tm has tm_zone field..." >&4
9855 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9856 eval $hasfield
9857 ;;
9858*) val="$undef"
9859 set d_tm_tm_zone
9860 eval $setvar
9861 ;;
9862esac
9863case "$d_tm_tm_zone" in
9864"$define") echo "Yes, it does." ;;
9865*) echo "No, it doesn't." ;;
9866esac
9867: see if struct tm knows about tm_gmtoff
9868case "$i_systime$i_time" in
9869*$define*)
9870 echo " "
9871 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9872 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9873 eval $hasfield
9874 ;;
9875*) val="$undef"
9876 set d_tm_tm_gmtoff
9877 eval $setvar
9878 ;;
9879esac
9880case "$d_tm_tm_gmtoff" in
9881"$define") echo "Yes, it does." ;;
9882*) echo "No, it doesn't." ;;
9883esac
9884
9885: see if asctime_r exists
9886set asctime_r d_asctime_r
9887eval $inlibc
9888case "$d_asctime_r" in
9889"$define")
d63eadf0 9890 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9891 case "$d_asctime_r_proto:$usethreads" in
9892 ":define") d_asctime_r_proto=define
a48ec845
JH
9893 set d_asctime_r_proto asctime_r $hdrs
9894 eval $hasproto ;;
9895 *) ;;
9896 esac
9897 case "$d_asctime_r_proto" in
9898 define)
10bc17b6
JH
9899 case "$asctime_r_proto" in
9900 ''|0) try='char* asctime_r(const struct tm*, char*);'
9901 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9902 esac
9903 case "$asctime_r_proto" in
9904 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9905 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9906 esac
9907 case "$asctime_r_proto" in
9908 ''|0) try='int asctime_r(const struct tm*, char*);'
9909 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9910 esac
9911 case "$asctime_r_proto" in
9912 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9913 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9914 esac
9915 case "$asctime_r_proto" in
90e831dc 9916 ''|0) d_asctime_r=undef
10bc17b6 9917 asctime_r_proto=0
a48ec845 9918 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9919 * ) case "$asctime_r_proto" in
9920 REENTRANT_PROTO*) ;;
9921 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9922 esac
9923 echo "Prototype: $try" ;;
9924 esac
9925 ;;
c18e646a
JH
9926 *) case "$usethreads" in
9927 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9928 esac
90e831dc
SB
9929 d_asctime_r=undef
9930 asctime_r_proto=0
c18e646a 9931 ;;
a48ec845
JH
9932 esac
9933 ;;
10bc17b6
JH
9934*) asctime_r_proto=0
9935 ;;
9936esac
9937
b4eb6b3d
JH
9938: see if atolf exists
9939set atolf d_atolf
9940eval $inlibc
9941
9942: see if atoll exists
9943set atoll d_atoll
9944eval $inlibc
9945
24c2fff4
NC
9946: Look for GCC-style attribute format
9947case "$d_attribute_format" in
80512072 9948'')
b4eb6b3d 9949echo " "
24c2fff4 9950echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9951$cat >attrib.c <<'EOCP'
9952#include <stdio.h>
24c2fff4 9953void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9954EOCP
9955if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9956 if $contains 'warning' attrib.out >/dev/null 2>&1; then
24c2fff4 9957 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9958 val="$undef"
9959 else
24c2fff4 9960 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9961 val="$define"
9962 fi
9963else
9964 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9965 val="$undef"
9966fi
80512072 9967;;
24c2fff4 9968*) val="$d_attribute_format" ;;
80512072 9969esac
24c2fff4
NC
9970set d_attribute_format
9971eval $setvar
9972$rm -f attrib*
9973
9974: Look for GCC-style attribute malloc
9975case "$d_attribute_malloc" in
9976'')
9977echo " "
9978echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9979$cat >attrib.c <<'EOCP'
9980#include <stdio.h>
9981char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9982EOCP
9983if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9984 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9985 echo "Your C compiler doesn't support __attribute__((malloc))."
9986 val="$undef"
9987 else
9988 echo "Your C compiler supports __attribute__((malloc))."
9989 val="$define"
9990 fi
9991else
9992 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9993 val="$undef"
9994fi
9995;;
9996*) val="$d_attribute_malloc" ;;
9997esac
9998set d_attribute_malloc
9999eval $setvar
10000$rm -f attrib*
10001
10002: Look for GCC-style attribute nonnull
10003case "$d_attribute_nonnull" in
10004'')
10005echo " "
10006echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10007$cat >attrib.c <<'EOCP'
10008#include <stdio.h>
10009void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10010EOCP
10011if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10012 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10013 echo "Your C compiler doesn't support __attribute__((nonnull))."
10014 val="$undef"
10015 else
10016 echo "Your C compiler supports __attribute__((nonnull))."
10017 val="$define"
10018 fi
10019else
10020 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10021 val="$undef"
10022fi
10023;;
10024*) val="$d_attribute_nonnull" ;;
10025esac
10026set d_attribute_nonnull
10027eval $setvar
10028$rm -f attrib*
10029
10030: Look for GCC-style attribute noreturn
10031case "$d_attribute_noreturn" in
10032'')
10033echo " "
10034echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10035$cat >attrib.c <<'EOCP'
10036#include <stdio.h>
10037void fall_over_dead( void ) __attribute__((noreturn));
10038EOCP
10039if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10040 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10041 echo "Your C compiler doesn't support __attribute__((noreturn))."
10042 val="$undef"
10043 else
10044 echo "Your C compiler supports __attribute__((noreturn))."
10045 val="$define"
10046 fi
10047else
10048 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10049 val="$undef"
10050fi
10051;;
10052*) val="$d_attribute_noreturn" ;;
10053esac
10054set d_attribute_noreturn
10055eval $setvar
10056$rm -f attrib*
10057
10058: Look for GCC-style attribute pure
10059case "$d_attribute_pure" in
10060'')
10061echo " "
10062echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10063$cat >attrib.c <<'EOCP'
10064#include <stdio.h>
10065int square( int n ) __attribute__((pure));
10066EOCP
10067if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10068 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10069 echo "Your C compiler doesn't support __attribute__((pure))."
10070 val="$undef"
10071 else
10072 echo "Your C compiler supports __attribute__((pure))."
10073 val="$define"
10074 fi
10075else
10076 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10077 val="$undef"
10078fi
10079;;
10080*) val="$d_attribute_pure" ;;
10081esac
10082set d_attribute_pure
10083eval $setvar
10084$rm -f attrib*
10085
10086: Look for GCC-style attribute unused
10087case "$d_attribute_unused" in
10088'')
10089echo " "
10090echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10091$cat >attrib.c <<'EOCP'
10092#include <stdio.h>
10093int do_something( int dummy __attribute__((unused)), int n );
10094EOCP
10095if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10096 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10097 echo "Your C compiler doesn't support __attribute__((unused))."
10098 val="$undef"
10099 else
10100 echo "Your C compiler supports __attribute__((unused))."
10101 val="$define"
10102 fi
10103else
10104 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10105 val="$undef"
10106fi
10107;;
10108*) val="$d_attribute_unused" ;;
10109esac
10110set d_attribute_unused
10111eval $setvar
10112$rm -f attrib*
10113
10114: Look for GCC-style attribute warn_unused_result
10115case "$d_attribute_warn_unused_result" in
10116'')
10117echo " "
10118echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10119$cat >attrib.c <<'EOCP'
10120#include <stdio.h>
10121int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10122EOCP
10123if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10124 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10125 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10126 val="$undef"
10127 else
10128 echo "Your C compiler supports __attribute__((warn_unused_result))."
10129 val="$define"
10130 fi
10131else
10132 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10133 val="$undef"
10134fi
10135;;
10136*) val="$d_attribute_warn_unused_result" ;;
10137esac
10138set d_attribute_warn_unused_result
b4eb6b3d
JH
10139eval $setvar
10140$rm -f attrib*
10141
10142: see if bcmp exists
10143set bcmp d_bcmp
10144eval $inlibc
10145
10146: see if bcopy exists
10147set bcopy d_bcopy
10148eval $inlibc
10149
b4eb6b3d
JH
10150: see if getpgrp exists
10151set getpgrp d_getpgrp
10152eval $inlibc
10153
10154case "$d_getpgrp" in
10155"$define")
10156 echo " "
10157 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10158 $cat >try.c <<EOP
b4eb6b3d
JH
10159#$i_unistd I_UNISTD
10160#include <sys/types.h>
10161#ifdef I_UNISTD
10162# include <unistd.h>
10163#endif
5a29c6bc
JH
10164#$i_stdlib I_STDLIB
10165#ifdef I_STDLIB
10166#include <stdlib.h>
10167#endif
b4eb6b3d
JH
10168int main()
10169{
10170 if (getuid() == 0) {
10171 printf("(I see you are running Configure as super-user...)\n");
10172 setuid(1);
10173 }
10174#ifdef TRY_BSD_PGRP
10175 if (getpgrp(1) == 0)
10176 exit(0);
10177#else
10178 if (getpgrp() > 0)
10179 exit(0);
10180#endif
10181 exit(1);
10182}
10183EOP
5440bc8e 10184 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10185 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10186 val="$define"
5440bc8e 10187 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10188 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10189 val="$undef"
10190 else
10191 echo "I can't seem to compile and run the test program."
10192 if ./usg; then
10193 xxx="a USG one, i.e. you use getpgrp()."
10194 else
10195 # SVR4 systems can appear rather BSD-ish.
10196 case "$i_unistd" in
10197 $undef)
10198 xxx="a BSD one, i.e. you use getpgrp(pid)."
10199 val="$define"
10200 ;;
10201 $define)
10202 xxx="probably a USG one, i.e. you use getpgrp()."
10203 val="$undef"
10204 ;;
10205 esac
10206 fi
10207 echo "Assuming your getpgrp is $xxx" >&4
10208 fi
10209 ;;
10210*) val="$undef";;
10211esac
10212set d_bsdgetpgrp
10213eval $setvar
5440bc8e 10214$rm -f try try.*
b4eb6b3d
JH
10215
10216: see if setpgrp exists
10217set setpgrp d_setpgrp
10218eval $inlibc
10219
10220case "$d_setpgrp" in
10221"$define")
10222 echo " "
10223 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10224 $cat >try.c <<EOP
b4eb6b3d
JH
10225#$i_unistd I_UNISTD
10226#include <sys/types.h>
10227#ifdef I_UNISTD
10228# include <unistd.h>
10229#endif
5a29c6bc
JH
10230#$i_stdlib I_STDLIB
10231#ifdef I_STDLIB
10232#include <stdlib.h>
10233#endif
b4eb6b3d
JH
10234int main()
10235{
10236 if (getuid() == 0) {
10237 printf("(I see you are running Configure as super-user...)\n");
10238 setuid(1);
10239 }
10240#ifdef TRY_BSD_PGRP
10241 if (-1 == setpgrp(1, 1))
10242 exit(0);
10243#else
10244 if (setpgrp() != -1)
10245 exit(0);
10246#endif
10247 exit(1);
10248}
10249EOP
5440bc8e 10250 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10251 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10252 val="$define"
5440bc8e 10253 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10254 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10255 val="$undef"
10256 else
10257 echo "(I can't seem to compile and run the test program.)"
10258 if ./usg; then
10259 xxx="a USG one, i.e. you use setpgrp()."
10260 else
10261 # SVR4 systems can appear rather BSD-ish.
10262 case "$i_unistd" in
10263 $undef)
10264 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10265 val="$define"
10266 ;;
10267 $define)
10268 xxx="probably a USG one, i.e. you use setpgrp()."
10269 val="$undef"
10270 ;;
10271 esac
10272 fi
10273 echo "Assuming your setpgrp is $xxx" >&4
10274 fi
10275 ;;
10276*) val="$undef";;
10277esac
10278set d_bsdsetpgrp
10279eval $setvar
5440bc8e 10280$rm -f try try.*
cb478989
NC
10281: Look for GCC-style __builtin_choose_expr
10282case "$d_builtin_choose_expr" in
10283'')
10284 echo " "
10285 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10286 $cat >try.c <<'EOCP'
10287#include <assert.h>
10288#include <stdlib.h>
10289#include <stdio.h>
10290
10291#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10292
10293int main(void) {
10294 assert( SYRINX(1) == 2112 );
10295 assert( SYRINX(1) != 5150 );
10296 assert( SYRINX(0) == 5150 );
10297 assert( SYRINX(0) != 2112 );
10298 puts( "All good!" );
10299 exit(0);
10300}
10301
10302EOCP
10303 set try
10304 if eval $compile; then
10305 echo "Your C compiler supports __builtin_choose_expr."
10306 val="$define"
10307 else
10308 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10309 val="$undef"
10310 fi
10311;;
10312*) val="$d_builtin_choose_expr" ;;
10313esac
10314
10315set d_builtin_choose_expr
10316eval $setvar
10317$rm -f try.* try core core.try.*
10318
10319: Look for GCC-style __builtin_expect
10320case "$d_builtin_expect" in
10321'')
10322 echo " "
10323 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10324 $cat >builtin.c <<'EOCP'
10325int main(void) {
10326 int n = 50;
10327 if ( __builtin_expect(n, 0) ) n = 1;
10328}
10329EOCP
10330 set try
10331 if eval $compile; then
10332 echo "Your C compiler supports __builtin_choose_expr."
10333 val="$define"
10334 else
10335 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10336 val="$undef"
10337 fi
10338 ;;
10339*) val="$d_builtin_expect" ;;
10340esac
10341
10342set d_builtin_expect
10343eval $setvar
10344$rm -f try.* try core core.try.*
10345
b4eb6b3d
JH
10346: see if bzero exists
10347set bzero d_bzero
10348eval $inlibc
10349
74950343
NC
10350: see if stdarg is available
10351echo " "
10352if $test `./findhdr stdarg.h`; then
10353 echo "<stdarg.h> found." >&4
10354 valstd="$define"
10355else
10356 echo "<stdarg.h> NOT found." >&4
10357 valstd="$undef"
10358fi
10359
10360: see if varags is available
10361echo " "
10362if $test `./findhdr varargs.h`; then
10363 echo "<varargs.h> found." >&4
10364else
10365 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10366fi
10367
10368: set up the varargs testing programs
10369$cat > varargs.c <<EOP
10370#ifdef I_STDARG
10371#include <stdarg.h>
10372#endif
10373#ifdef I_VARARGS
10374#include <varargs.h>
10375#endif
10376
10377#ifdef I_STDARG
10378int f(char *p, ...)
10379#else
10380int f(va_alist)
10381va_dcl
10382#endif
10383{
10384 va_list ap;
10385#ifndef I_STDARG
10386 char *p;
10387#endif
10388#ifdef I_STDARG
10389 va_start(ap,p);
10390#else
10391 va_start(ap);
10392 p = va_arg(ap, char *);
10393#endif
10394 va_end(ap);
5f7d02a9 10395 return 0;
74950343
NC
10396}
10397EOP
10398$cat > varargs <<EOP
10399$startsh
10400if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10401 echo "true"
10402else
10403 echo "false"
10404fi
10405$rm -f varargs$_o
10406EOP
10407chmod +x varargs
10408
10409: now check which varargs header should be included
10410echo " "
10411i_varhdr=''
10412case "$valstd" in
10413"$define")
10414 if `./varargs I_STDARG`; then
10415 val='stdarg.h'
10416 elif `./varargs I_VARARGS`; then
10417 val='varargs.h'
10418 fi
10419 ;;
10420*)
10421 if `./varargs I_VARARGS`; then
10422 val='varargs.h'
10423 fi
10424 ;;
10425esac
10426case "$val" in
10427'')
10428echo "I could not find the definition for va_dcl... You have problems..." >&4
10429 val="$undef"; set i_stdarg; eval $setvar
10430 val="$undef"; set i_varargs; eval $setvar
10431 ;;
10432*)
10433 set i_varhdr
10434 eval $setvar
10435 case "$i_varhdr" in
10436 stdarg.h)
10437 val="$define"; set i_stdarg; eval $setvar
10438 val="$undef"; set i_varargs; eval $setvar
10439 ;;
10440 varargs.h)
10441 val="$undef"; set i_stdarg; eval $setvar
10442 val="$define"; set i_varargs; eval $setvar
10443 ;;
10444 esac
10445 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10446esac
10447$rm -f varargs*
10448
10449: see if the Compiler supports C99 variadic macros
10450case "$i_stdarg$i_stdlib" in
10451 "$define$define")
10452 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10453 $cat >try.c <<EOCP
10454#include <stdio.h>
10455#include <stdarg.h>
10456
10457#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10458
10459int main() {
10460 char buf[20];
10461 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10462 puts(buf);
10463 return 0;
10464}
10465EOCP
10466 set try
10467 if eval $compile && $run ./try 2>&1 >/dev/null; then
10468 case "`$run ./try`" in
10469 "123 456 789")
10470 echo "You have C99 variadic macros." >&4
10471 d_c99_variadic_macros="$define"
10472 ;;
10473 *)
10474 echo "You don't have functional C99 variadic macros." >&4
10475 d_c99_variadic_macros="$undef"
10476 ;;
10477 esac
10478 else
10479 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10480 d_c99_variadic_macros="$undef"
10481 fi
10482 $rm -f try.* try core core.try.*
10483 ;;
10484 *)
10485 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10486 d_c99_variadic_macros="$undef"
10487 ;;
10488esac
10489
b4eb6b3d
JH
10490: see if signal is declared as pointer to function returning int or void
10491echo " "
10492xxx=`./findhdr signal.h`
10493$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10494if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10495 echo "You have int (*signal())() instead of void." >&4
10496 val="$undef"
10497elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10498 echo "You have void (*signal())()." >&4
10499 val="$define"
10500elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10501 echo "You have int (*signal())() instead of void." >&4
10502 val="$undef"
10503elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10504 echo "You have void (*signal())()." >&4
10505 val="$define"
10506else
10507 case "$d_voidsig" in
10508 '')
10509 echo "I can't determine whether signal handler returns void or int..." >&4
10510 dflt=void
10511 rp="What type does your signal handler return?"
10512 . ./myread
10513 case "$ans" in
10514 v*) val="$define";;
10515 *) val="$undef";;
10516 esac;;
10517 "$define")
10518 echo "As you already told me, signal handler returns void." >&4
10519 val="$define"
10520 ;;
10521 *) echo "As you already told me, signal handler returns int." >&4
10522 val="$undef"
10523 ;;
10524 esac
10525fi
10526set d_voidsig
10527eval $setvar
10528case "$d_voidsig" in
10529"$define") signal_t="void";;
10530*) signal_t="int";;
10531esac
10532$rm -f $$.tmp
10533
10534: check for ability to cast large floats to 32-bit ints.
10535echo " "
10536echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10537if $test "$intsize" -ge 4; then
10538 xxx=int
10539else
10540 xxx=long
10541fi
10542$cat >try.c <<EOCP
10543#include <stdio.h>
5ed858ef
JH
10544#$i_stdlib I_STDLIB
10545#ifdef I_STDLIB
10546#include <stdlib.h>
10547#endif
b4eb6b3d
JH
10548#include <sys/types.h>
10549#include <signal.h>
5f7d02a9 10550$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10551int main()
10552{
10553 $xxx i32;
10554 double f, g;
10555 int result = 0;
10556 char str[16];
10557 signal(SIGFPE, blech);
10558
10559 /* Don't let compiler optimize the test away. Store the number
10560 in a writable string for gcc to pass to sscanf under HP/UX.
10561 */
10562 sprintf(str, "2147483647");
10563 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10564 g = 10 * f;
10565 i32 = ($xxx) g;
10566
10567 /* x86 processors will probably give 0x8000 0000, which is a
7db0018a 10568 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10569 behavior here, which is to preserve the sign and give
10570 back 0x7fff ffff.
10571 */
10572 if (i32 != ($xxx) f)
10573 result |= 1;
10574 exit(result);
10575}
10576EOCP
10577set try
10578if eval $compile_ok; then
5440bc8e 10579 $run ./try
b4eb6b3d
JH
10580 yyy=$?
10581else
10582 echo "(I can't seem to compile the test program--assuming it can't)"
10583 yyy=1
10584fi
10585case "$yyy" in
105860) val="$define"
10587 echo "Yup, it can."
10588 ;;
10589*) val="$undef"
10590 echo "Nope, it can't."
10591 ;;
10592esac
10593set d_casti32
10594eval $setvar
10595$rm -f try try.*
10596
10597: check for ability to cast negative floats to unsigned
10598echo " "
10599echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10600$cat >try.c <<EOCP
10601#include <stdio.h>
5ed858ef
JH
10602#$i_stdlib I_STDLIB
10603#ifdef I_STDLIB
10604#include <stdlib.h>
10605#endif
b4eb6b3d
JH
10606#include <sys/types.h>
10607#include <signal.h>
5f7d02a9
NC
10608$signal_t blech(int s) { exit(7); }
10609$signal_t blech_in_list(int s) { exit(4); }
10610unsigned long dummy_long(unsigned long p) { return p; }
10611unsigned int dummy_int(unsigned int p) { return p; }
10612unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
10613int main()
10614{
10615 double f;
10616 unsigned long along;
10617 unsigned int aint;
10618 unsigned short ashort;
10619 int result = 0;
10620 char str[16];
10621
10622 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10623 a direct f = -123. assignment. gcc-2.8.0 reportedly
10624 optimized the whole file away
10625 */
10626 /* Store the number in a writable string for gcc to pass to
10627 sscanf under HP/UX.
10628 */
10629 sprintf(str, "-123");
10630 sscanf(str, "%lf", &f); /* f = -123.; */
10631
10632 signal(SIGFPE, blech);
10633 along = (unsigned long)f;
10634 aint = (unsigned int)f;
10635 ashort = (unsigned short)f;
10636 if (along != (unsigned long)-123)
10637 result |= 1;
10638 if (aint != (unsigned int)-123)
10639 result |= 1;
10640 if (ashort != (unsigned short)-123)
10641 result |= 1;
10642 sprintf(str, "1073741824.");
10643 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10644 f = f + f;
10645 along = 0;
10646 along = (unsigned long)f;
10647 if (along != 0x80000000)
10648 result |= 2;
10649 f -= 1.;
10650 along = 0;
10651 along = (unsigned long)f;
10652 if (along != 0x7fffffff)
10653 result |= 1;
10654 f += 2.;
10655 along = 0;
10656 along = (unsigned long)f;
10657 if (along != 0x80000001)
10658 result |= 2;
10659 if (result)
10660 exit(result);
10661 signal(SIGFPE, blech_in_list);
10662 sprintf(str, "123.");
10663 sscanf(str, "%lf", &f); /* f = 123.; */
10664 along = dummy_long((unsigned long)f);
10665 aint = dummy_int((unsigned int)f);
10666 ashort = dummy_short((unsigned short)f);
10667 if (along != (unsigned long)123)
10668 result |= 4;
10669 if (aint != (unsigned int)123)
10670 result |= 4;
10671 if (ashort != (unsigned short)123)
10672 result |= 4;
10673 exit(result);
10674
10675}
10676EOCP
10677set try
10678if eval $compile_ok; then
5440bc8e 10679 $run ./try
b4eb6b3d
JH
10680 castflags=$?
10681else
10682 echo "(I can't seem to compile the test program--assuming it can't)"
10683 castflags=7
10684fi
10685case "$castflags" in
106860) val="$define"
10687 echo "Yup, it can."
10688 ;;
10689*) val="$undef"
10690 echo "Nope, it can't."
10691 ;;
10692esac
10693set d_castneg
10694eval $setvar
10695$rm -f try.*
10696
10697: see if vprintf exists
10698echo " "
10699if set vprintf val -f d_vprintf; eval $csym; $val; then
10700 echo 'vprintf() found.' >&4
10701 val="$define"
5a29c6bc 10702 $cat >try.c <<EOF
b4eb6b3d 10703#include <varargs.h>
5a29c6bc
JH
10704#$i_stdlib I_STDLIB
10705#ifdef I_STDLIB
10706#include <stdlib.h>
10707#endif
b4eb6b3d
JH
10708
10709int main() { xxx("foo"); }
10710
10711xxx(va_alist)
10712va_dcl
10713{
10714 va_list args;
10715 char buf[10];
10716
10717 va_start(args);
10718 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10719}
10720EOF
5440bc8e
JH
10721 set try
10722 if eval $compile && $run ./try; then
b4eb6b3d
JH
10723 echo "Your vsprintf() returns (int)." >&4
10724 val2="$undef"
10725 else
10726 echo "Your vsprintf() returns (char*)." >&4
10727 val2="$define"
10728 fi
10729else
10730 echo 'vprintf() NOT found.' >&4
10731 val="$undef"
10732 val2="$undef"
10733fi
5440bc8e 10734$rm -f try try.*
b4eb6b3d
JH
10735set d_vprintf
10736eval $setvar
10737val=$val2
10738set d_charvspr
10739eval $setvar
10740
10741: see if chown exists
10742set chown d_chown
10743eval $inlibc
10744
10745: see if chroot exists
10746set chroot d_chroot
10747eval $inlibc
10748
10749: see if chsize exists
10750set chsize d_chsize
10751eval $inlibc
10752
758a5d79
JH
10753: see if class exists
10754set class d_class
10755eval $inlibc
10756
1466f2fb
SP
10757: see if clearenv exists
10758set clearenv d_clearenv
10759eval $inlibc
10760
4e0554ec
JH
10761hasstruct='varname=$1; struct=$2; shift; shift;
10762while $test $# -ge 2; do
10763 case "$1" in
10764 $define) echo "#include <$2>";;
10765 esac ;
10766 shift 2;
10767done > try.c;
10768echo "int main () { struct $struct foo; }" >> try.c;
10769set try;
10770if eval $compile; then
10771 val="$define";
10772else
10773 val="$undef";
10774fi;
10775set $varname;
10776eval $setvar;
10777$rm -f try.c try.o'
10778
4e0554ec
JH
10779socketlib=''
10780sockethdr=''
10781: see whether socket exists
10782echo " "
10783$echo $n "Hmm... $c" >&4
10784if set socket val -f d_socket; eval $csym; $val; then
10785 echo "Looks like you have Berkeley networking support." >&4
10786 d_socket="$define"
10787 if set setsockopt val -f; eval $csym; $val; then
10788 d_oldsock="$undef"
10789 else
10790 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10791 d_oldsock="$define"
10792 fi
10793else
10794 if $contains socklib libc.list >/dev/null 2>&1; then
10795 echo "Looks like you have Berkeley networking support." >&4
10796 d_socket="$define"
10797 : we will have to assume that it supports the 4.2 BSD interface
10798 d_oldsock="$undef"
10799 else
10800 echo "You don't have Berkeley networking in libc$_a..." >&4
10801 if test "X$d_socket" = "X$define"; then
10802 echo "...but you seem to believe that you have sockets." >&4
10803 else
10804 for net in net socket
10805 do
10806 if test -f /usr/lib/lib$net$_a; then
10807 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10808 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10809 if $contains socket libc.list >/dev/null 2>&1; then
10810 d_socket="$define"
10811 socketlib="-l$net"
10812 case "$net" in
10813 net)
10814 echo "...but the Wollongong group seems to have hacked it in." >&4
10815 sockethdr="-I/usr/netinclude"
10816 ;;
10817 esac
3c728e00 10818 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10819 if $contains setsockopt libc.list >/dev/null 2>&1; then
10820 d_oldsock="$undef"
10821 else
10822 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10823 d_oldsock="$define"
10824 fi
10825 break
10826 fi
10827 fi
10828 done
10829 if test "X$d_socket" != "X$define"; then
10830 echo "or anywhere else I see." >&4
10831 d_socket="$undef"
10832 d_oldsock="$undef"
10833 fi
10834 fi
10835 fi
10836fi
10837
10838: see if socketpair exists
10839set socketpair d_sockpair
10840eval $inlibc
10841
10842
10843echo " "
3c728e00 10844echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10845for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10846 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10847 $cat >try.c <<EOF
10848#include <sys/types.h>
10849#include <sys/socket.h>
10850int main() {
10851 int i = $ENUM;
10852}
10853EOF
10854 val="$undef"
10855 set try; if eval $compile; then
10856 val="$define"
10857 fi
10858 set d_${enum}; eval $setvar
10859 $rm -f try.c try
10860done
10861
10862: see if this is a sys/uio.h system
10863set sys/uio.h i_sysuio
10864eval $inhdr
10865
10866
10867echo " "
10868echo "Checking to see if your system supports struct cmsghdr..." >&4
10869set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10870eval $hasstruct
10871case "$d_cmsghdr_s" in
10872"$define") echo "Yes, it does." ;;
10873*) echo "No, it doesn't." ;;
10874esac
10875
10876
b4eb6b3d
JH
10877: check for const keyword
10878echo " "
10879echo 'Checking to see if your C compiler knows about "const"...' >&4
10880$cat >const.c <<'EOCP'
10881typedef struct spug { int drokk; } spug;
10882int main()
10883{
10884 const char *foo;
d2ae4405 10885 const spug y = { 0 };
b4eb6b3d
JH
10886}
10887EOCP
10888if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10889 val="$define"
10890 echo "Yup, it does."
10891else
10892 val="$undef"
10893 echo "Nope, it doesn't."
10894fi
10895set d_const
10896eval $setvar
10897
5a29c6bc
JH
10898: see if copysignl exists
10899set copysignl d_copysignl
10900eval $inlibc
10901
b4eb6b3d
JH
10902: see if crypt exists
10903echo " "
a5a94ea5
JH
10904set crypt d_crypt
10905eval $inlibc
10906case "$d_crypt" in
10907$define) cryptlib='' ;;
10908*) if set crypt val -f d_crypt; eval $csym; $val; then
10909 echo 'crypt() found.' >&4
b4eb6b3d 10910 val="$define"
a5a94ea5
JH
10911 cryptlib=''
10912 else
10913 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10914 if $test -z "$cryptlib"; then
10915 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10916 else
10917 cryptlib=-lcrypt
10918 fi
10919 if $test -z "$cryptlib"; then
10920 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10921 else
10922 cryptlib=-lcrypt
10923 fi
10924 if $test -z "$cryptlib"; then
10925 cryptlib=`./loc libcrypt$_a "" $libpth`
10926 else
10927 cryptlib=-lcrypt
10928 fi
10929 if $test -z "$cryptlib"; then
10930 echo 'crypt() NOT found.' >&4
10931 val="$undef"
10932 else
10933 val="$define"
10934 fi
b4eb6b3d 10935 fi
a5a94ea5
JH
10936 set d_crypt
10937 eval $setvar
10938 ;;
10939esac
b4eb6b3d 10940
10bc17b6
JH
10941: see if this is a crypt.h system
10942set crypt.h i_crypt
10943eval $inhdr
10944
10945: see if crypt_r exists
10946set crypt_r d_crypt_r
10947eval $inlibc
10948case "$d_crypt_r" in
10949"$define")
10950 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10951 case "$d_crypt_r_proto:$usethreads" in
10952 ":define") d_crypt_r_proto=define
a48ec845
JH
10953 set d_crypt_r_proto crypt_r $hdrs
10954 eval $hasproto ;;
10955 *) ;;
10956 esac
10957 case "$d_crypt_r_proto" in
10958 define)
10bc17b6
JH
10959 case "$crypt_r_proto" in
10960 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10961 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10962 esac
10963 case "$crypt_r_proto" in
b430fd04
JH
10964 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10965 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10966 esac
10967 case "$crypt_r_proto" in
90e831dc 10968 ''|0) d_crypt_r=undef
10bc17b6 10969 crypt_r_proto=0
a48ec845 10970 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10971 * ) case "$crypt_r_proto" in
10972 REENTRANT_PROTO*) ;;
10973 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10974 esac
10975 echo "Prototype: $try" ;;
10976 esac
10977 ;;
c18e646a
JH
10978 *) case "$usethreads" in
10979 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10980 esac
90e831dc
SB
10981 d_crypt_r=undef
10982 crypt_r_proto=0
c18e646a 10983 ;;
a48ec845
JH
10984 esac
10985 ;;
10bc17b6
JH
10986*) crypt_r_proto=0
10987 ;;
10988esac
10989
b4eb6b3d
JH
10990: get csh whereabouts
10991case "$csh" in
10992'csh') val="$undef" ;;
10993*) val="$define" ;;
10994esac
10995set d_csh
10996eval $setvar
10997: Respect a hint or command line value for full_csh.
10998case "$full_csh" in
10999'') full_csh=$csh ;;
11000esac
11001
10bc17b6
JH
11002: see if ctermid_r exists
11003set ctermid_r d_ctermid_r
11004eval $inlibc
11005case "$d_ctermid_r" in
11006"$define")
31ee0cb7 11007 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11008 case "$d_ctermid_r_proto:$usethreads" in
11009 ":define") d_ctermid_r_proto=define
a48ec845
JH
11010 set d_ctermid_r_proto ctermid_r $hdrs
11011 eval $hasproto ;;
11012 *) ;;
11013 esac
11014 case "$d_ctermid_r_proto" in
11015 define)
10bc17b6
JH
11016 case "$ctermid_r_proto" in
11017 ''|0) try='char* ctermid_r(char*);'
11018 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11019 esac
11020 case "$ctermid_r_proto" in
90e831dc 11021 ''|0) d_ctermid_r=undef
10bc17b6 11022 ctermid_r_proto=0
a48ec845 11023 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11024 * ) case "$ctermid_r_proto" in
11025 REENTRANT_PROTO*) ;;
11026 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11027 esac
11028 echo "Prototype: $try" ;;
11029 esac
11030 ;;
c18e646a
JH
11031 *) case "$usethreads" in
11032 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11033 esac
90e831dc
SB
11034 d_ctermid_r=undef
11035 ctermid_r_proto=0
c18e646a 11036 ;;
a48ec845
JH
11037 esac
11038 ;;
10bc17b6
JH
11039*) ctermid_r_proto=0
11040 ;;
11041esac
11042
11043: see if ctime_r exists
11044set ctime_r d_ctime_r
11045eval $inlibc
11046case "$d_ctime_r" in
11047"$define")
d63eadf0 11048 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11049 case "$d_ctime_r_proto:$usethreads" in
11050 ":define") d_ctime_r_proto=define
a48ec845
JH
11051 set d_ctime_r_proto ctime_r $hdrs
11052 eval $hasproto ;;
11053 *) ;;
11054 esac
11055 case "$d_ctime_r_proto" in
11056 define)
10bc17b6
JH
11057 case "$ctime_r_proto" in
11058 ''|0) try='char* ctime_r(const time_t*, char*);'
11059 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11060 esac
11061 case "$ctime_r_proto" in
11062 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11063 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11064 esac
11065 case "$ctime_r_proto" in
11066 ''|0) try='int ctime_r(const time_t*, char*);'
11067 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11068 esac
11069 case "$ctime_r_proto" in
11070 ''|0) try='int ctime_r(const time_t*, char*, int);'
11071 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11072 esac
11073 case "$ctime_r_proto" in
90e831dc 11074 ''|0) d_ctime_r=undef
10bc17b6 11075 ctime_r_proto=0
a48ec845 11076 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11077 * ) case "$ctime_r_proto" in
11078 REENTRANT_PROTO*) ;;
11079 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11080 esac
11081 echo "Prototype: $try" ;;
11082 esac
11083 ;;
c18e646a
JH
11084 *) case "$usethreads" in
11085 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11086 esac
90e831dc
SB
11087 d_ctime_r=undef
11088 ctime_r_proto=0
c18e646a 11089 ;;
a48ec845
JH
11090 esac
11091 ;;
10bc17b6
JH
11092*) ctime_r_proto=0
11093 ;;
11094esac
11095
b4eb6b3d
JH
11096: see if cuserid exists
11097set cuserid d_cuserid
11098eval $inlibc
11099
11100: see if this is a limits.h system
11101set limits.h i_limits
11102eval $inhdr
11103
11104: see if this is a float.h system
11105set float.h i_float
11106eval $inhdr
11107
11108: See if number of significant digits in a double precision number is known
11109echo " "
11110$cat >dbl_dig.c <<EOM
11111#$i_limits I_LIMITS
11112#$i_float I_FLOAT
11113#ifdef I_LIMITS
11114#include <limits.h>
11115#endif
11116#ifdef I_FLOAT
11117#include <float.h>
11118#endif
11119#ifdef DBL_DIG
11120printf("Contains DBL_DIG");
11121#endif
11122EOM
11123$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11124if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11125 echo "DBL_DIG found." >&4
11126 val="$define"
11127else
11128 echo "DBL_DIG NOT found." >&4
11129 val="$undef"
11130fi
11131$rm -f dbl_dig.?
11132set d_dbl_dig
11133eval $setvar
11134
2ef53570
JH
11135: see if dbm.h is available
11136: see if dbmclose exists
11137set dbmclose d_dbmclose
11138eval $inlibc
11139
11140case "$d_dbmclose" in
11141$define)
11142 set dbm.h i_dbm
11143 eval $inhdr
11144 case "$i_dbm" in
11145 $define)
11146 val="$undef"
11147 set i_rpcsvcdbm
11148 eval $setvar
11149 ;;
11150 *) set rpcsvc/dbm.h i_rpcsvcdbm
11151 eval $inhdr
11152 ;;
11153 esac
11154 ;;
11155*) echo "We won't be including <dbm.h>"
11156 val="$undef"
11157 set i_dbm
11158 eval $setvar
11159 val="$undef"
11160 set i_rpcsvcdbm
11161 eval $setvar
11162 ;;
11163esac
11164
11165: see if prototype for dbminit is available
11166echo " "
11167set d_dbminitproto dbminit $i_dbm dbm.h
11168eval $hasproto
11169
b4eb6b3d
JH
11170: see if difftime exists
11171set difftime d_difftime
11172eval $inlibc
11173
11174: see if this is a dirent system
11175echo " "
11176if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11177 val="$define"
11178 echo "<dirent.h> found." >&4
11179else
11180 val="$undef"
11181 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11182 echo "<sys/dir.h> found." >&4
11183 echo " "
11184 else
11185 xinc=`./findhdr sys/ndir.h`
11186 fi
11187 echo "<dirent.h> NOT found." >&4
11188fi
11189set i_dirent
11190eval $setvar
11191
11192: Look for type of directory structure.
11193echo " "
11194$cppstdin $cppflags $cppminus < "$xinc" > try.c
11195
11196case "$direntrytype" in
11197''|' ')
11198 case "$i_dirent" in
11199 $define) guess1='struct dirent' ;;
11200 *) guess1='struct direct' ;;
11201 esac
11202 ;;
11203*) guess1="$direntrytype"
11204 ;;
11205esac
11206
11207case "$guess1" in
11208'struct dirent') guess2='struct direct' ;;
11209*) guess2='struct dirent' ;;
11210esac
11211
11212if $contains "$guess1" try.c >/dev/null 2>&1; then
11213 direntrytype="$guess1"
11214 echo "Your directory entries are $direntrytype." >&4
11215elif $contains "$guess2" try.c >/dev/null 2>&1; then
11216 direntrytype="$guess2"
11217 echo "Your directory entries seem to be $direntrytype." >&4
11218else
11219 echo "I don't recognize your system's directory entries." >&4
11220 rp="What type is used for directory entries on this system?"
11221 dflt="$guess1"
11222 . ./myread
11223 direntrytype="$ans"
11224fi
11225$rm -f try.c
11226
11227
11228: see if the directory entry stores field length
11229echo " "
11230$cppstdin $cppflags $cppminus < "$xinc" > try.c
11231if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11232 echo "Good, your directory entry keeps length information in d_namlen." >&4
11233 val="$define"
11234else
11235 echo "Your directory entry does not know about the d_namlen field." >&4
11236 val="$undef"
11237fi
11238set d_dirnamlen
11239eval $setvar
11240$rm -f try.c
11241
ae0e3d3b
JH
11242: see if this is an sysdir system
11243set sys/dir.h i_sysdir
11244eval $inhdr
11245
11246: see if this is an sysndir system
11247set sys/ndir.h i_sysndir
11248eval $inhdr
11249
11250: Look for dirfd
11251echo " "
11252$cat >dirfd.c <<EOM
11253#include <stdio.h>
5a29c6bc
JH
11254#$i_stdlib I_STDLIB
11255#ifdef I_STDLIB
11256#include <stdlib.h>
11257#endif
ae0e3d3b
JH
11258#$i_dirent I_DIRENT /**/
11259#$i_sysdir I_SYS_DIR /**/
11260#$i_sysndir I_SYS_NDIR /**/
11261#$i_systypes I_SYS_TYPES /**/
11262#if defined(I_SYS_TYPES)
11263#include <sys/types.h>
11264#endif
11265#if defined(I_DIRENT)
11266#include <dirent.h>
11267#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11268#include <sys/dir.h>
11269#endif
11270#else
11271#ifdef I_SYS_NDIR
11272#include <sys/ndir.h>
11273#else
11274#ifdef I_SYS_DIR
11275#ifdef hp9000s500
11276#include <ndir.h> /* may be wrong in the future */
11277#else
11278#include <sys/dir.h>
11279#endif
11280#endif
11281#endif
11282#endif
11283int main() {
11284 DIR *dirp = opendir(".");
11285 if (dirfd(dirp) >= 0)
11286 exit(0);
11287 else
11288 exit(1);
11289}
11290EOM
58c89e2c 11291val=$undef
ae0e3d3b
JH
11292set dirfd
11293if eval $compile; then
11294 val="$define"
11295fi
11296case "$val" in
11297$define) echo "dirfd() found." >&4 ;;
11298*) echo "dirfd() NOT found." >&4 ;;
11299esac
11300set d_dirfd
11301eval $setvar
11302$rm -f dirfd*
11303
b4eb6b3d
JH
11304: see if dlerror exists
11305xxx_runnm="$runnm"
11306runnm=false
11307set dlerror d_dlerror
11308eval $inlibc
11309runnm="$xxx_runnm"
11310
11311: see if dlfcn is available
11312set dlfcn.h i_dlfcn
11313eval $inhdr
11314
11315case "$usedl" in
11316$define|y|true)
11317 $cat << EOM
11318
11319On a few systems, the dynamically loaded modules that perl generates and uses
11320will need a different extension than shared libs. The default will probably
11321be appropriate.
11322
11323EOM
11324 case "$dlext" in
11325 '') dflt="$so" ;;
11326 *) dflt="$dlext" ;;
11327 esac
11328 rp='What is the extension of dynamically loaded modules'
11329 . ./myread
11330 dlext="$ans"
11331 ;;
11332*)
11333 dlext="none"
11334 ;;
11335esac
11336
11337: Check if dlsym need a leading underscore
11338echo " "
11339val="$undef"
11340
11341case "$dlsrc" in
11342dl_dlopen.xs)
11343 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11344 $cat >dyna.c <<'EOM'
11345fred () { }
11346EOM
11347
11348$cat >fred.c<<EOM
11349
11350#include <stdio.h>
5a29c6bc
JH
11351#$i_stdlib I_STDLIB
11352#ifdef I_STDLIB
11353#include <stdlib.h>
11354#endif
b4eb6b3d
JH
11355#$i_dlfcn I_DLFCN
11356#ifdef I_DLFCN
5440bc8e 11357#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11358#else
11359#include <sys/types.h>
11360#include <nlist.h>
11361#include <link.h>
11362#endif
11363
11364extern int fred() ;
11365
11366int main()
11367{
11368 void * handle ;
11369 void * symbol ;
11370#ifndef RTLD_LAZY
11371 int mode = 1 ;
11372#else
11373 int mode = RTLD_LAZY ;
11374#endif
11375 handle = dlopen("./dyna.$dlext", mode) ;
11376 if (handle == NULL) {
11377 printf ("1\n") ;
11378 fflush (stdout) ;
11379 exit(0);
11380 }
11381 symbol = dlsym(handle, "fred") ;
11382 if (symbol == NULL) {
11383 /* try putting a leading underscore */
11384 symbol = dlsym(handle, "_fred") ;
11385 if (symbol == NULL) {
11386 printf ("2\n") ;
11387 fflush (stdout) ;
11388 exit(0);
11389 }
11390 printf ("3\n") ;
11391 }
11392 else
11393 printf ("4\n") ;
11394 fflush (stdout) ;
11395 exit(0);
11396}
11397EOM
11398 : Call the object file tmp-dyna.o in case dlext=o.
11399 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11400 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11401 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11402 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11403 xxx=`$run ./fred`
b4eb6b3d
JH
11404 case $xxx in
11405 1) echo "Test program failed using dlopen." >&4
11406 echo "Perhaps you should not use dynamic loading." >&4;;
11407 2) echo "Test program failed using dlsym." >&4
11408 echo "Perhaps you should not use dynamic loading." >&4;;
11409 3) echo "dlsym needs a leading underscore" >&4
11410 val="$define" ;;
11411 4) echo "dlsym doesn't need a leading underscore." >&4;;
11412 esac
11413 else
11414 echo "I can't compile and run the test program." >&4
11415 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11416 fi
11417 ;;
11418esac
11419
3c728e00 11420$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11421
11422set d_dlsymun
11423eval $setvar
11424
10bc17b6
JH
11425: see if drand48_r exists
11426set drand48_r d_drand48_r
11427eval $inlibc
11428case "$d_drand48_r" in
11429"$define")
11430 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11431 case "$d_drand48_r_proto:$usethreads" in
11432 ":define") d_drand48_r_proto=define
a48ec845
JH
11433 set d_drand48_r_proto drand48_r $hdrs
11434 eval $hasproto ;;
11435 *) ;;
11436 esac
11437 case "$d_drand48_r_proto" in
11438 define)
10bc17b6
JH
11439 case "$drand48_r_proto" in
11440 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11441 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11442 esac
11443 case "$drand48_r_proto" in
90e831dc 11444 ''|0) d_drand48_r=undef
10bc17b6 11445 drand48_r_proto=0
a48ec845 11446 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11447 * ) case "$drand48_r_proto" in
11448 REENTRANT_PROTO*) ;;
11449 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11450 esac
11451 echo "Prototype: $try" ;;
11452 esac
11453 ;;
c18e646a
JH
11454 *) case "$usethreads" in
11455 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11456 esac
90e831dc
SB
11457 d_drand48_r=undef
11458 drand48_r_proto=0
c18e646a 11459 ;;
a48ec845
JH
11460 esac
11461 ;;
10bc17b6
JH
11462*) drand48_r_proto=0
11463 ;;
11464esac
11465
11466: see if prototype for drand48 is available
11467echo " "
11468set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11469eval $hasproto
11470
b4eb6b3d
JH
11471: see if dup2 exists
11472set dup2 d_dup2
11473eval $inlibc
11474
11475: see if eaccess exists
11476set eaccess d_eaccess
11477eval $inlibc
11478
11479: see if endgrent exists
11480set endgrent d_endgrent
11481eval $inlibc
11482
10bc17b6
JH
11483: see if this is an grp system
11484set grp.h i_grp
11485eval $inhdr
11486
11487case "$i_grp" in
11488$define)
11489 xxx=`./findhdr grp.h`
11490 $cppstdin $cppflags $cppminus < $xxx >$$.h
11491
11492 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11493 val="$define"
11494 else
11495 val="$undef"
11496 fi
11497 set d_grpasswd
11498 eval $setvar
11499
11500 $rm -f $$.h
11501 ;;
11502*)
11503 val="$undef";
11504 set d_grpasswd; eval $setvar
11505 ;;
11506esac
11507
11508: see if endgrent_r exists
11509set endgrent_r d_endgrent_r
11510eval $inlibc
11511case "$d_endgrent_r" in
11512"$define")
11513 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11514 case "$d_endgrent_r_proto:$usethreads" in
11515 ":define") d_endgrent_r_proto=define
a48ec845
JH
11516 set d_endgrent_r_proto endgrent_r $hdrs
11517 eval $hasproto ;;
11518 *) ;;
11519 esac
11520 case "$d_endgrent_r_proto" in
11521 define)
10bc17b6
JH
11522 case "$endgrent_r_proto" in
11523 ''|0) try='int endgrent_r(FILE**);'
11524 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11525 esac
11526 case "$endgrent_r_proto" in
11527 ''|0) try='void endgrent_r(FILE**);'
11528 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11529 esac
11530 case "$endgrent_r_proto" in
90e831dc 11531 ''|0) d_endgrent_r=undef
10bc17b6 11532 endgrent_r_proto=0
a48ec845 11533 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11534 * ) case "$endgrent_r_proto" in
11535 REENTRANT_PROTO*) ;;
11536 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11537 esac
11538 echo "Prototype: $try" ;;
11539 esac
11540 ;;
c18e646a
JH
11541 *) case "$usethreads" in
11542 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11543 esac
90e831dc
SB
11544 d_endgrent_r=undef
11545 endgrent_r_proto=0
c18e646a 11546 ;;
a48ec845
JH
11547 esac
11548 ;;
10bc17b6
JH
11549*) endgrent_r_proto=0
11550 ;;
11551esac
11552
b4eb6b3d
JH
11553: see if endhostent exists
11554set endhostent d_endhent
11555eval $inlibc
11556
10bc17b6
JH
11557: see if this is a netdb.h system
11558set netdb.h i_netdb
11559eval $inhdr
11560
11561: see if endhostent_r exists
11562set endhostent_r d_endhostent_r
11563eval $inlibc
11564case "$d_endhostent_r" in
11565"$define")
11566 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11567 case "$d_endhostent_r_proto:$usethreads" in
11568 ":define") d_endhostent_r_proto=define
a48ec845
JH
11569 set d_endhostent_r_proto endhostent_r $hdrs
11570 eval $hasproto ;;
11571 *) ;;
11572 esac
11573 case "$d_endhostent_r_proto" in
11574 define)
10bc17b6
JH
11575 case "$endhostent_r_proto" in
11576 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11577 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11578 esac
11579 case "$endhostent_r_proto" in
11580 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11581 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11582 esac
11583 case "$endhostent_r_proto" in
90e831dc 11584 ''|0) d_endhostent_r=undef
10bc17b6 11585 endhostent_r_proto=0
a48ec845 11586 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11587 * ) case "$endhostent_r_proto" in
11588 REENTRANT_PROTO*) ;;
11589 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11590 esac
11591 echo "Prototype: $try" ;;
11592 esac
11593 ;;
c18e646a
JH
11594 *) case "$usethreads" in
11595 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11596 esac
90e831dc
SB
11597 d_endhostent_r=undef
11598 endhostent_r_proto=0
c18e646a 11599 ;;
a48ec845
JH
11600 esac
11601 ;;
10bc17b6
JH
11602*) endhostent_r_proto=0
11603 ;;
11604esac
11605
b4eb6b3d
JH
11606: see if endnetent exists
11607set endnetent d_endnent
11608eval $inlibc
11609
10bc17b6
JH
11610: see if endnetent_r exists
11611set endnetent_r d_endnetent_r
11612eval $inlibc
11613case "$d_endnetent_r" in
11614"$define")
11615 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11616 case "$d_endnetent_r_proto:$usethreads" in
11617 ":define") d_endnetent_r_proto=define
a48ec845
JH
11618 set d_endnetent_r_proto endnetent_r $hdrs
11619 eval $hasproto ;;
11620 *) ;;
11621 esac
11622 case "$d_endnetent_r_proto" in
11623 define)
10bc17b6
JH
11624 case "$endnetent_r_proto" in
11625 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11626 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11627 esac
11628 case "$endnetent_r_proto" in
11629 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11630 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11631 esac
11632 case "$endnetent_r_proto" in
90e831dc 11633 ''|0) d_endnetent_r=undef
10bc17b6 11634 endnetent_r_proto=0
a48ec845 11635 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11636 * ) case "$endnetent_r_proto" in
11637 REENTRANT_PROTO*) ;;
11638 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11639 esac
11640 echo "Prototype: $try" ;;
11641 esac
11642 ;;
c18e646a
JH
11643 *) case "$usethreads" in
11644 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11645 esac
90e831dc
SB
11646 d_endnetent_r=undef
11647 endnetent_r_proto=0
c18e646a 11648 ;;
a48ec845
JH
11649 esac
11650 ;;
10bc17b6
JH
11651*) endnetent_r_proto=0
11652 ;;
11653esac
11654
b4eb6b3d
JH
11655: see if endprotoent exists
11656set endprotoent d_endpent
11657eval $inlibc
11658
10bc17b6
JH
11659: see if endprotoent_r exists
11660set endprotoent_r d_endprotoent_r
11661eval $inlibc
11662case "$d_endprotoent_r" in
11663"$define")
11664 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11665 case "$d_endprotoent_r_proto:$usethreads" in
11666 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11667 set d_endprotoent_r_proto endprotoent_r $hdrs
11668 eval $hasproto ;;
11669 *) ;;
11670 esac
11671 case "$d_endprotoent_r_proto" in
11672 define)
10bc17b6
JH
11673 case "$endprotoent_r_proto" in
11674 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11675 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11676 esac
11677 case "$endprotoent_r_proto" in
11678 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11679 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11680 esac
11681 case "$endprotoent_r_proto" in
90e831dc 11682 ''|0) d_endprotoent_r=undef
10bc17b6 11683 endprotoent_r_proto=0
a48ec845 11684 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11685 * ) case "$endprotoent_r_proto" in
11686 REENTRANT_PROTO*) ;;
11687 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11688 esac
11689 echo "Prototype: $try" ;;
11690 esac
11691 ;;
c18e646a
JH
11692 *) case "$usethreads" in
11693 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11694 esac
90e831dc
SB
11695 d_endprotoent_r=undef
11696 endprotoent_r_proto=0
c18e646a 11697 ;;
a48ec845
JH
11698 esac
11699 ;;
10bc17b6
JH
11700*) endprotoent_r_proto=0
11701 ;;
11702esac
11703
b4eb6b3d
JH
11704: see if endpwent exists
11705set endpwent d_endpwent
11706eval $inlibc
11707
10bc17b6
JH
11708: see if this is a pwd.h system
11709set pwd.h i_pwd
11710eval $inhdr
11711
11712case "$i_pwd" in
11713$define)
11714 xxx=`./findhdr pwd.h`
11715 $cppstdin $cppflags $cppminus < $xxx >$$.h
11716
11717 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11718 val="$define"
11719 else
11720 val="$undef"
11721 fi
11722 set d_pwquota
11723 eval $setvar
11724
11725 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11726 val="$define"
11727 else
11728 val="$undef"
11729 fi
11730 set d_pwage
11731 eval $setvar
11732
11733 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11734 val="$define"
11735 else
11736 val="$undef"
11737 fi
11738 set d_pwchange
11739 eval $setvar
11740
11741 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11742 val="$define"
11743 else
11744 val="$undef"
11745 fi
11746 set d_pwclass
11747 eval $setvar
11748
11749 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11750 val="$define"
11751 else
11752 val="$undef"
11753 fi
11754 set d_pwexpire
11755 eval $setvar
11756
11757 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11758 val="$define"
11759 else
11760 val="$undef"
11761 fi
11762 set d_pwcomment
11763 eval $setvar
11764
11765 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11766 val="$define"
11767 else
11768 val="$undef"
11769 fi
11770 set d_pwgecos
11771 eval $setvar
11772
11773 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11774 val="$define"
11775 else
11776 val="$undef"
11777 fi
11778 set d_pwpasswd
11779 eval $setvar
11780
11781 $rm -f $$.h
11782 ;;
11783*)
11784 val="$undef";
11785 set d_pwquota; eval $setvar
11786 set d_pwage; eval $setvar
11787 set d_pwchange; eval $setvar
11788 set d_pwclass; eval $setvar
11789 set d_pwexpire; eval $setvar
11790 set d_pwcomment; eval $setvar
11791 set d_pwgecos; eval $setvar
11792 set d_pwpasswd; eval $setvar
11793 ;;
11794esac
11795
11796: see if endpwent_r exists
11797set endpwent_r d_endpwent_r
11798eval $inlibc
11799case "$d_endpwent_r" in
11800"$define")
11801 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11802 case "$d_endpwent_r_proto:$usethreads" in
11803 ":define") d_endpwent_r_proto=define
a48ec845
JH
11804 set d_endpwent_r_proto endpwent_r $hdrs
11805 eval $hasproto ;;
11806 *) ;;
11807 esac
11808 case "$d_endpwent_r_proto" in
11809 define)
10bc17b6
JH
11810 case "$endpwent_r_proto" in
11811 ''|0) try='int endpwent_r(FILE**);'
11812 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11813 esac
11814 case "$endpwent_r_proto" in
11815 ''|0) try='void endpwent_r(FILE**);'
11816 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11817 esac
11818 case "$endpwent_r_proto" in
90e831dc 11819 ''|0) d_endpwent_r=undef
10bc17b6 11820 endpwent_r_proto=0
a48ec845 11821 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11822 * ) case "$endpwent_r_proto" in
11823 REENTRANT_PROTO*) ;;
11824 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11825 esac
11826 echo "Prototype: $try" ;;
11827 esac
11828 ;;
c18e646a
JH
11829 *) case "$usethreads" in
11830 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11831 esac
90e831dc
SB
11832 d_endpwent_r=undef
11833 endpwent_r_proto=0
c18e646a 11834 ;;
a48ec845
JH
11835 esac
11836 ;;
10bc17b6
JH
11837*) endpwent_r_proto=0
11838 ;;
11839esac
11840
b4eb6b3d
JH
11841: see if endservent exists
11842set endservent d_endsent
11843eval $inlibc
11844
10bc17b6
JH
11845: see if endservent_r exists
11846set endservent_r d_endservent_r
11847eval $inlibc
11848case "$d_endservent_r" in
11849"$define")
11850 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11851 case "$d_endservent_r_proto:$usethreads" in
11852 ":define") d_endservent_r_proto=define
a48ec845
JH
11853 set d_endservent_r_proto endservent_r $hdrs
11854 eval $hasproto ;;
11855 *) ;;
11856 esac
11857 case "$d_endservent_r_proto" in
11858 define)
10bc17b6
JH
11859 case "$endservent_r_proto" in
11860 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11861 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11862 esac
11863 case "$endservent_r_proto" in
11864 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11865 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11866 esac
11867 case "$endservent_r_proto" in
90e831dc 11868 ''|0) d_endservent_r=undef
10bc17b6 11869 endservent_r_proto=0
a48ec845 11870 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11871 * ) case "$endservent_r_proto" in
11872 REENTRANT_PROTO*) ;;
11873 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11874 esac
11875 echo "Prototype: $try" ;;
11876 esac
11877 ;;
c18e646a
JH
11878 *) case "$usethreads" in
11879 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11880 esac
90e831dc
SB
11881 d_endservent_r=undef
11882 endservent_r_proto=0
c18e646a 11883 ;;
a48ec845
JH
11884 esac
11885 ;;
10bc17b6
JH
11886*) endservent_r_proto=0
11887 ;;
11888esac
11889
b4eb6b3d
JH
11890: Locate the flags for 'open()'
11891echo " "
5a29c6bc 11892$cat >try.c <<EOCP
b4eb6b3d
JH
11893#include <sys/types.h>
11894#ifdef I_FCNTL
11895#include <fcntl.h>
11896#endif
11897#ifdef I_SYS_FILE
11898#include <sys/file.h>
11899#endif
5a29c6bc
JH
11900#$i_stdlib I_STDLIB
11901#ifdef I_STDLIB
11902#include <stdlib.h>
11903#endif
b4eb6b3d
JH
11904int main() {
11905 if(O_RDONLY);
11906#ifdef O_TRUNC
11907 exit(0);
11908#else
11909 exit(1);
11910#endif
11911}
11912EOCP
11913: check sys/file.h first to get FREAD on Sun
11914if $test `./findhdr sys/file.h` && \
5440bc8e 11915 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11916 h_sysfile=true;
11917 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11918 if $run ./try; then
b4eb6b3d
JH
11919 echo "and you have the 3 argument form of open()." >&4
11920 val="$define"
11921 else
11922 echo "but not the 3 argument form of open(). Oh, well." >&4
11923 val="$undef"
11924 fi
11925elif $test `./findhdr fcntl.h` && \
5440bc8e 11926 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11927 h_fcntl=true;
11928 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11929 if $run ./try; then
b4eb6b3d
JH
11930 echo "and you have the 3 argument form of open()." >&4
11931 val="$define"
11932 else
11933 echo "but not the 3 argument form of open(). Oh, well." >&4
11934 val="$undef"
11935 fi
11936else
11937 val="$undef"
11938 echo "I can't find the O_* constant definitions! You got problems." >&4
11939fi
11940set d_open3
11941eval $setvar
5440bc8e 11942$rm -f try try.*
b4eb6b3d
JH
11943
11944: see which of string.h or strings.h is needed
11945echo " "
11946strings=`./findhdr string.h`
11947if $test "$strings" && $test -r "$strings"; then
11948 echo "Using <string.h> instead of <strings.h>." >&4
11949 val="$define"
11950else
11951 val="$undef"
11952 strings=`./findhdr strings.h`
11953 if $test "$strings" && $test -r "$strings"; then
11954 echo "Using <strings.h> instead of <string.h>." >&4
11955 else
11956 echo "No string header found -- You'll surely have problems." >&4
11957 fi
11958fi
11959set i_string
11960eval $setvar
11961case "$i_string" in
11962"$undef") strings=`./findhdr strings.h`;;
11963*) strings=`./findhdr string.h`;;
11964esac
11965
3c728e00
JH
11966: see if this is a sys/file.h system
11967val=''
11968set sys/file.h val
11969eval $inhdr
11970
11971: do we need to include sys/file.h ?
11972case "$val" in
11973"$define")
11974 echo " "
11975 if $h_sysfile; then
11976 val="$define"
11977 echo "We'll be including <sys/file.h>." >&4
11978 else
11979 val="$undef"
11980 echo "We won't be including <sys/file.h>." >&4
11981 fi
11982 ;;
11983*)
11984 h_sysfile=false
11985 ;;
11986esac
11987set i_sysfile
11988eval $setvar
11989
11990: see if fcntl.h is there
11991val=''
11992set fcntl.h val
11993eval $inhdr
11994
11995: see if we can include fcntl.h
11996case "$val" in
11997"$define")
11998 echo " "
11999 if $h_fcntl; then
12000 val="$define"
12001 echo "We'll be including <fcntl.h>." >&4
12002 else
12003 val="$undef"
12004 if $h_sysfile; then
12005 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12006 else
12007 echo "We won't be including <fcntl.h>." >&4
12008 fi
12009 fi
12010 ;;
12011*)
12012 h_fcntl=false
12013 val="$undef"
12014 ;;
12015esac
12016set i_fcntl
12017eval $setvar
12018
b4eb6b3d
JH
12019: check for non-blocking I/O stuff
12020case "$h_sysfile" in
a0acbdc3
JH
12021true) echo "#include <sys/file.h>" > head.c;;
12022*)
12023 case "$h_fcntl" in
12024 true) echo "#include <fcntl.h>" > head.c;;
12025 *) echo "#include <sys/fcntl.h>" > head.c;;
12026 esac
12027 ;;
b4eb6b3d
JH
12028esac
12029echo " "
12030echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12031case "$o_nonblock" in
12032'')
12033 $cat head.c > try.c
3c728e00 12034 $cat >>try.c <<EOCP
b4eb6b3d 12035#include <stdio.h>
5a29c6bc
JH
12036#$i_stdlib I_STDLIB
12037#ifdef I_STDLIB
80b3ef99 12038#include <stdlib.h>
5a29c6bc 12039#endif
3c728e00
JH
12040#$i_fcntl I_FCNTL
12041#ifdef I_FCNTL
12042#include <fcntl.h>
12043#endif
b4eb6b3d
JH
12044int main() {
12045#ifdef O_NONBLOCK
12046 printf("O_NONBLOCK\n");
12047 exit(0);
12048#endif
12049#ifdef O_NDELAY
12050 printf("O_NDELAY\n");
12051 exit(0);
12052#endif
12053#ifdef FNDELAY
12054 printf("FNDELAY\n");
12055 exit(0);
12056#endif
12057 exit(0);
12058}
12059EOCP
12060 set try
12061 if eval $compile_ok; then
5440bc8e 12062 o_nonblock=`$run ./try`
b4eb6b3d
JH
12063 case "$o_nonblock" in
12064 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12065 *) echo "Seems like we can use $o_nonblock.";;
12066 esac
12067 else
12068 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12069 fi
12070 ;;
12071*) echo "Using $hint value $o_nonblock.";;
12072esac
12073$rm -f try try.* .out core
12074
12075echo " "
12076echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12077case "$eagain" in
12078'')
12079 $cat head.c > try.c
12080 $cat >>try.c <<EOCP
12081#include <errno.h>
12082#include <sys/types.h>
12083#include <signal.h>
12084#include <stdio.h>
5a29c6bc
JH
12085#$i_stdlib I_STDLIB
12086#ifdef I_STDLIB
12087#include <stdlib.h>
12088#endif
1deb0a86
JH
12089#$i_fcntl I_FCNTL
12090#ifdef I_FCNTL
12091#include <fcntl.h>
12092#endif
b4eb6b3d
JH
12093#define MY_O_NONBLOCK $o_nonblock
12094#ifndef errno /* XXX need better Configure test */
12095extern int errno;
12096#endif
12097#$i_unistd I_UNISTD
12098#ifdef I_UNISTD
12099#include <unistd.h>
12100#endif
12101#$i_string I_STRING
12102#ifdef I_STRING
12103#include <string.h>
12104#else
12105#include <strings.h>
12106#endif
5f7d02a9 12107$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12108EOCP
12109 $cat >> try.c <<'EOCP'
12110int main()
12111{
12112 int pd[2];
12113 int pu[2];
12114 char buf[1];
12115 char string[100];
12116
12117 pipe(pd); /* Down: child -> parent */
12118 pipe(pu); /* Up: parent -> child */
12119 if (0 != fork()) {
12120 int ret;
12121 close(pd[1]); /* Parent reads from pd[0] */
12122 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12123#ifdef F_SETFL
b4eb6b3d
JH
12124 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12125 exit(1);
a0acbdc3
JH
12126#else
12127 exit(4);
12128#endif
b4eb6b3d
JH
12129 signal(SIGALRM, blech);
12130 alarm(5);
12131 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12132 exit(2);
12133 sprintf(string, "%d\n", ret);
12134 write(2, string, strlen(string));
12135 alarm(0);
12136#ifdef EAGAIN
12137 if (errno == EAGAIN) {
12138 printf("EAGAIN\n");
12139 goto ok;
12140 }
12141#endif
12142#ifdef EWOULDBLOCK
12143 if (errno == EWOULDBLOCK)
12144 printf("EWOULDBLOCK\n");
12145#endif
12146 ok:
12147 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12148 sleep(2); /* Give it time to close our pipe */
12149 alarm(5);
12150 ret = read(pd[0], buf, 1); /* Should read EOF */
12151 alarm(0);
12152 sprintf(string, "%d\n", ret);
868439a2 12153 write(4, string, strlen(string));
b4eb6b3d
JH
12154 exit(0);
12155 }
12156
12157 close(pd[0]); /* We write to pd[1] */
12158 close(pu[1]); /* We read from pu[0] */
12159 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12160 close(pd[1]); /* Pipe pd is now fully closed! */
12161 exit(0); /* Bye bye, thank you for playing! */
12162}
12163EOCP
12164 set try
12165 if eval $compile_ok; then
12166 echo "$startsh" >mtry
868439a2 12167 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12168 chmod +x mtry
12169 ./mtry >/dev/null 2>&1
12170 case $? in
12171 0) eagain=`$cat try.out`;;
12172 1) echo "Could not perform non-blocking setting!";;
12173 2) echo "I did a successful read() for something that was not there!";;
12174 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12175 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12176 *) echo "Something terribly wrong happened during testing.";;
12177 esac
12178 rd_nodata=`$cat try.ret`
12179 echo "A read() system call with no data present returns $rd_nodata."
12180 case "$rd_nodata" in
12181 0|-1) ;;
12182 *)
12183 echo "(That's peculiar, fixing that to be -1.)"
12184 rd_nodata=-1
12185 ;;
12186 esac
12187 case "$eagain" in
12188 '')
12189 echo "Forcing errno EAGAIN on read() with no data available."
12190 eagain=EAGAIN
12191 ;;
12192 *)
12193 echo "Your read() sets errno to $eagain when no data is available."
12194 ;;
12195 esac
12196 status=`$cat try.err`
12197 case "$status" in
12198 0) echo "And it correctly returns 0 to signal EOF.";;
12199 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12200 *) echo "However, your read() returns '$status' on EOF??";;
12201 esac
12202 val="$define"
12203 if test "$status" = "$rd_nodata"; then
12204 echo "WARNING: you can't distinguish between EOF and no data!"
12205 val="$undef"
12206 fi
12207 else
12208 echo "I can't compile the test program--assuming errno EAGAIN will do."
12209 eagain=EAGAIN
12210 fi
12211 set d_eofnblk
12212 eval $setvar
12213 ;;
12214*)
12215 echo "Using $hint value $eagain."
12216 echo "Your read() returns $rd_nodata when no data is present."
12217 case "$d_eofnblk" in
12218 "$define") echo "And you can see EOF because read() returns 0.";;
12219 "$undef") echo "But you can't see EOF status from read() returned value.";;
12220 *)
12221 echo "(Assuming you can't see EOF status from read anyway.)"
12222 d_eofnblk=$undef
12223 ;;
12224 esac
12225 ;;
12226esac
12227$rm -f try try.* .out core head.c mtry
12228
ff0950a8
JH
12229: see if _ptr and _cnt from stdio act std
12230echo " "
b4eb6b3d 12231
ff0950a8
JH
12232if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12233 echo "(Looks like you have stdio.h from BSD.)"
12234 case "$stdio_ptr" in
12235 '') stdio_ptr='((fp)->_p)'
12236 ptr_lval=$define
12237 ;;
12238 *) ptr_lval=$d_stdio_ptr_lval;;
12239 esac
12240 case "$stdio_cnt" in
12241 '') stdio_cnt='((fp)->_r)'
12242 cnt_lval=$define
12243 ;;
12244 *) cnt_lval=$d_stdio_cnt_lval;;
12245 esac
12246 case "$stdio_base" in
12247 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12248 esac
12249 case "$stdio_bufsiz" in
12250 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12251 esac
12252elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12253 echo "(Looks like you have stdio.h from Linux.)"
12254 case "$stdio_ptr" in
12255 '') stdio_ptr='((fp)->_IO_read_ptr)'
12256 ptr_lval=$define
12257 ;;
12258 *) ptr_lval=$d_stdio_ptr_lval;;
12259 esac
12260 case "$stdio_cnt" in
12261 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12262 cnt_lval=$undef
12263 ;;
12264 *) cnt_lval=$d_stdio_cnt_lval;;
12265 esac
12266 case "$stdio_base" in
12267 '') stdio_base='((fp)->_IO_read_base)';;
12268 esac
12269 case "$stdio_bufsiz" in
12270 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12271 esac
12272else
12273 case "$stdio_ptr" in
12274 '') stdio_ptr='((fp)->_ptr)'
12275 ptr_lval=$define
12276 ;;
12277 *) ptr_lval=$d_stdio_ptr_lval;;
12278 esac
12279 case "$stdio_cnt" in
12280 '') stdio_cnt='((fp)->_cnt)'
12281 cnt_lval=$define
12282 ;;
12283 *) cnt_lval=$d_stdio_cnt_lval;;
12284 esac
12285 case "$stdio_base" in
12286 '') stdio_base='((fp)->_base)';;
12287 esac
12288 case "$stdio_bufsiz" in
12289 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12290 esac
12291fi
b4eb6b3d 12292
ff0950a8
JH
12293: test whether _ptr and _cnt really work
12294echo "Checking how std your stdio is..." >&4
12295$cat >try.c <<EOP
12296#include <stdio.h>
5a29c6bc
JH
12297#$i_stdlib I_STDLIB
12298#ifdef I_STDLIB
9d9004a9 12299#include <stdlib.h>
5a29c6bc 12300#endif
ff0950a8
JH
12301#define FILE_ptr(fp) $stdio_ptr
12302#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12303int main() {
ff0950a8
JH
12304 FILE *fp = fopen("try.c", "r");
12305 char c = getc(fp);
12306 if (
12307 18 <= FILE_cnt(fp) &&
12308 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12309 )
12310 exit(0);
12311 exit(1);
9d9004a9 12312}
ff0950a8
JH
12313EOP
12314val="$undef"
12315set try
12316if eval $compile && $to try.c; then
12317 if $run ./try; then
12318 echo "Your stdio acts pretty std."
12319 val="$define"
9d9004a9 12320 else
ff0950a8 12321 echo "Your stdio isn't very std."
9d9004a9 12322 fi
ff0950a8
JH
12323else
12324 echo "Your stdio doesn't appear very std."
12325fi
12326$rm -f try.c try
12327
12328# glibc 2.2.90 and above apparently change stdio streams so Perl's
12329# direct buffer manipulation no longer works. The Configure tests
12330# should be changed to correctly detect this, but until then,
12331# the following check should at least let perl compile and run.
12332# (This quick fix should be updated before 5.8.1.)
12333# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12334# A. Dougherty, June 3, 2002.
12335case "$d_gnulibc" in
12336$define)
12337 case "$gnulibc_version" in
12338 2.[01]*) ;;
12339 2.2) ;;
12340 2.2.[0-9]) ;;
12341 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12342 val="$undef"
12343 ;;
12344 esac
9d9004a9
AD
12345 ;;
12346esac
ff0950a8 12347set d_stdstdio
9d9004a9 12348eval $setvar
9d9004a9 12349
ff0950a8
JH
12350: Can _ptr be used as an lvalue?
12351case "$d_stdstdio$ptr_lval" in
12352$define$define) val=$define ;;
12353*) val=$undef ;;
12354esac
12355set d_stdio_ptr_lval
12356eval $setvar
9d9004a9 12357
ff0950a8
JH
12358: Can _cnt be used as an lvalue?
12359case "$d_stdstdio$cnt_lval" in
12360$define$define) val=$define ;;
12361*) val=$undef ;;
12362esac
12363set d_stdio_cnt_lval
12364eval $setvar
b4eb6b3d 12365
ff0950a8
JH
12366
12367: test whether setting _ptr sets _cnt as a side effect
12368d_stdio_ptr_lval_sets_cnt="$undef"
12369d_stdio_ptr_lval_nochange_cnt="$undef"
12370case "$d_stdio_ptr_lval$d_stdstdio" in
12371$define$define)
12372 echo "Checking to see what happens if we set the stdio ptr..." >&4
12373$cat >try.c <<EOP
12374#include <stdio.h>
12375/* Can we scream? */
12376/* Eat dust sed :-) */
12377/* In the buffer space, no one can hear you scream. */
5a29c6bc
JH
12378#$i_stdlib I_STDLIB
12379#ifdef I_STDLIB
12380#include <stdlib.h>
12381#endif
ff0950a8
JH
12382#define FILE_ptr(fp) $stdio_ptr
12383#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12384#include <sys/types.h>
ff0950a8
JH
12385int main() {
12386 FILE *fp = fopen("try.c", "r");
12387 int c;
12388 char *ptr;
12389 size_t cnt;
12390 if (!fp) {
12391 puts("Fail even to read");
12392 exit(1);
12393 }
12394 c = getc(fp); /* Read away the first # */
12395 if (c == EOF) {
12396 puts("Fail even to read");
12397 exit(1);
12398 }
12399 if (!(
12400 18 <= FILE_cnt(fp) &&
12401 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12402 )) {
12403 puts("Fail even to read");
12404 exit (1);
12405 }
12406 ptr = (char*) FILE_ptr(fp);
12407 cnt = (size_t)FILE_cnt(fp);
12408
12409 FILE_ptr(fp) += 42;
12410
12411 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12412 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12413 exit (1);
12414 }
12415 if (FILE_cnt(fp) <= 20) {
12416 printf ("Fail (<20 chars to test)");
12417 exit (1);
12418 }
12419 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12420 puts("Fail compare");
12421 exit (1);
12422 }
12423 if (cnt == FILE_cnt(fp)) {
12424 puts("Pass_unchanged");
12425 exit (0);
12426 }
12427 if (FILE_cnt(fp) == (cnt - 42)) {
12428 puts("Pass_changed");
12429 exit (0);
12430 }
12431 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12432 return 1;
12433
12434}
12435EOP
12436 set try
12437 if eval $compile && $to try.c; then
12438 case `$run ./try` in
12439 Pass_changed)
12440 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12441 d_stdio_ptr_lval_sets_cnt="$define" ;;
12442 Pass_unchanged)
12443 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12444 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12445 Fail*)
12446 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12447 *)
12448 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12449 esac
12450 else
12451 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12452 fi
12453 $rm -f try.c try
12454 ;;
12455esac
12456
12457: see if _base is also standard
12458val="$undef"
12459case "$d_stdstdio" in
12460$define)
12461 $cat >try.c <<EOP
12462#include <stdio.h>
12463#$i_stdlib I_STDLIB
12464#ifdef I_STDLIB
12465#include <stdlib.h>
12466#endif
12467#define FILE_base(fp) $stdio_base
12468#define FILE_bufsiz(fp) $stdio_bufsiz
12469int main() {
12470 FILE *fp = fopen("try.c", "r");
12471 char c = getc(fp);
12472 if (
12473 19 <= FILE_bufsiz(fp) &&
12474 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12475 )
12476 exit(0);
12477 exit(1);
12478}
12479EOP
12480 set try
12481 if eval $compile && $to try.c; then
12482 if $run ./try; then
12483 echo "And its _base field acts std."
12484 val="$define"
12485 else
12486 echo "But its _base field isn't std."
12487 fi
12488 else
12489 echo "However, it seems to be lacking the _base field."
12490 fi
12491 $rm -f try.c try
12492 ;;
12493esac
12494set d_stdiobase
12495eval $setvar
12496
12497: see if fast_stdio exists
12498val="$undef"
12499case "$d_stdstdio:$d_stdio_ptr_lval" in
12500"$define:$define")
12501 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12502 *$define*)
12503 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12504 val="$define"
12505 ;;
12506 esac
12507 ;;
12508esac
12509set d_faststdio
12510eval $setvar
12511
12512
12513
12514: see if fchdir exists
12515set fchdir d_fchdir
12516eval $inlibc
12517
12518: see if fchmod exists
12519set fchmod d_fchmod
12520eval $inlibc
12521
12522: see if fchown exists
12523set fchown d_fchown
12524eval $inlibc
12525
12526: see if this is an fcntl system
12527set fcntl d_fcntl
12528eval $inlibc
12529
12530echo " "
12531: See if fcntl-based locking works.
12532$cat >try.c <<EOCP
12533#$i_stdlib I_STDLIB
12534#ifdef I_STDLIB
12535#include <stdlib.h>
12536#endif
12537#include <unistd.h>
12538#include <fcntl.h>
12539#include <signal.h>
5f7d02a9 12540$signal_t blech(int x) { exit(3); }
ff0950a8
JH
12541int main() {
12542#if defined(F_SETLK) && defined(F_SETLKW)
12543 struct flock flock;
12544 int retval, fd;
12545 fd = open("try.c", O_RDONLY);
12546 flock.l_type = F_RDLCK;
12547 flock.l_whence = SEEK_SET;
12548 flock.l_start = flock.l_len = 0;
12549 signal(SIGALRM, blech);
12550 alarm(10);
12551 retval = fcntl(fd, F_SETLK, &flock);
12552 close(fd);
12553 (retval < 0 ? exit(2) : exit(0));
12554#else
12555 exit(2);
12556#endif
12557}
12558EOCP
12559echo "Checking if fcntl-based file locking works... "
12560case "$d_fcntl" in
12561"$define")
12562 set try
12563 if eval $compile_ok; then
12564 if $run ./try; then
12565 echo "Yes, it seems to work."
12566 val="$define"
12567 else
12568 echo "Nope, it didn't work."
12569 val="$undef"
12570 case "$?" in
12571 3) $cat >&4 <<EOM
12572***
12573*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12574*** This is (almost) impossible.
12575*** If your NFS lock daemons are not feeling well, something like
12576*** this may happen, please investigate. Cannot continue, aborting.
12577***
12578EOM
12579 exit 1
12580 ;;
12581 esac
12582 fi
12583 else
12584 echo "I'm unable to compile the test program, so I'll assume not."
12585 val="$undef"
12586 fi
12587 ;;
12588*) val="$undef";
12589 echo "Nope, since you don't even have fcntl()."
12590 ;;
12591esac
12592set d_fcntl_can_lock
12593eval $setvar
12594$rm -f try*
12595
12596
12597: check for fd_set items
12598$cat <<EOM
12599
12600Checking to see how well your C compiler handles fd_set and friends ...
12601EOM
12602$cat >try.c <<EOCP
12603#$i_stdlib I_STDLIB
12604#ifdef I_STDLIB
12605#include <stdlib.h>
12606#endif
12607#$i_systime I_SYS_TIME
12608#$i_sysselct I_SYS_SELECT
12609#$d_socket HAS_SOCKET
12610#include <sys/types.h>
12611#ifdef HAS_SOCKET
12612#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12613#endif
12614#ifdef I_SYS_TIME
12615#include <sys/time.h>
12616#endif
12617#ifdef I_SYS_SELECT
12618#include <sys/select.h>
b4eb6b3d
JH
12619#endif
12620int main() {
12621 fd_set fds;
12622
12623#ifdef TRYBITS
12624 if(fds.fds_bits);
12625#endif
12626
12627#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12628 exit(0);
12629#else
12630 exit(1);
12631#endif
12632}
12633EOCP
5440bc8e 12634set try -DTRYBITS
b4eb6b3d
JH
12635if eval $compile; then
12636 d_fds_bits="$define"
12637 d_fd_set="$define"
12638 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 12639 if $run ./try; then
b4eb6b3d
JH
12640 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12641 d_fd_macros="$define"
12642 else
12643 $cat >&4 <<'EOM'
12644but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12645EOM
12646 d_fd_macros="$undef"
12647 fi
12648else
12649 $cat <<'EOM'
12650Hmm, your compiler has some difficulty with fd_set. Checking further...
12651EOM
5440bc8e 12652 set try
b4eb6b3d
JH
12653 if eval $compile; then
12654 d_fds_bits="$undef"
12655 d_fd_set="$define"
12656 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12657 if $run ./try; then
b4eb6b3d
JH
12658 echo "and you have the normal fd_set macros." >&4
12659 d_fd_macros="$define"
12660 else
12661 $cat <<'EOM'
12662but not the normal fd_set macros! Gross! More work for me...
12663EOM
12664 d_fd_macros="$undef"
12665 fi
12666 else
12667 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12668 d_fd_set="$undef"
12669 d_fds_bits="$undef"
12670 d_fd_macros="$undef"
12671 fi
12672fi
5440bc8e 12673$rm -f try try.*
b4eb6b3d
JH
12674
12675: see if fgetpos exists
12676set fgetpos d_fgetpos
12677eval $inlibc
12678
758a5d79
JH
12679: see if finite exists
12680set finite d_finite
12681eval $inlibc
12682
12683: see if finitel exists
12684set finitel d_finitel
12685eval $inlibc
12686
b4eb6b3d
JH
12687: see if flock exists
12688set flock d_flock
12689eval $inlibc
12690
2ef53570
JH
12691: see if prototype for flock is available
12692echo " "
12693set d_flockproto flock $i_sysfile sys/file.h
12694eval $hasproto
12695
b4eb6b3d
JH
12696: see if fork exists
12697set fork d_fork
12698eval $inlibc
12699
758a5d79
JH
12700: see if fp_class exists
12701set fp_class d_fp_class
12702eval $inlibc
12703
b4eb6b3d
JH
12704: see if pathconf exists
12705set pathconf d_pathconf
12706eval $inlibc
12707
12708: see if fpathconf exists
12709set fpathconf d_fpathconf
12710eval $inlibc
12711
758a5d79
JH
12712: see if fpclass exists
12713set fpclass d_fpclass
12714eval $inlibc
12715
12716: see if fpclassify exists
12717set fpclassify d_fpclassify
12718eval $inlibc
12719
12720: see if fpclassl exists
12721set fpclassl d_fpclassl
12722eval $inlibc
12723
b4eb6b3d
JH
12724
12725: check for fpos64_t
12726echo " "
12727echo "Checking to see if you have fpos64_t..." >&4
12728$cat >try.c <<EOCP
12729#include <stdio.h>
12730int main() { fpos64_t x = 7; }
12731EOCP
12732set try
12733if eval $compile; then
12734 val="$define"
12735 echo "You have fpos64_t."
12736else
12737 val="$undef"
12738 echo "You do not have fpos64_t."
12739 case "$fpossize" in
12740 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12741 esac
12742fi
12743$rm -f try.* try
12744set d_fpos64_t
12745eval $setvar
12746
12747: see if frexpl exists
12748set frexpl d_frexpl
12749eval $inlibc
12750
b4eb6b3d
JH
12751: see if this is a sys/param system
12752set sys/param.h i_sysparam
12753eval $inhdr
12754
12755: see if this is a sys/mount.h system
12756set sys/mount.h i_sysmount
12757eval $inhdr
12758
b4eb6b3d
JH
12759
12760echo " "
12761echo "Checking to see if your system supports struct fs_data..." >&4
12762set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12763eval $hasstruct
12764case "$d_fs_data_s" in
12765"$define") echo "Yes, it does." ;;
12766*) echo "No, it doesn't." ;;
12767esac
12768
12769: see if fseeko exists
12770set fseeko d_fseeko
12771eval $inlibc
12772case "$longsize" in
127738) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12774esac
12775
12776: see if fsetpos exists
12777set fsetpos d_fsetpos
12778eval $inlibc
12779
12780
12781: see if fstatfs exists
12782set fstatfs d_fstatfs
12783eval $inlibc
12784
12785
12786: see if statvfs exists
12787set statvfs d_statvfs
12788eval $inlibc
12789
12790: see if fstatvfs exists
12791set fstatvfs d_fstatvfs
12792eval $inlibc
12793
12794
411ab01c
JH
12795: see if fsync exists
12796set fsync d_fsync
12797eval $inlibc
12798
b4eb6b3d
JH
12799: see if ftello exists
12800set ftello d_ftello
12801eval $inlibc
12802case "$longsize" in
128038) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12804esac
12805
704c3401
NC
12806d_futimes="$undef"
12807: check for a working futimes
12808echo " "
12809echo "Checking for a working futimes()" >&4
12810$cat >try.c <<EOCP
12811#include <stdio.h>
12812#include <sys/time.h>
12813#include <errno.h>
12814#include <fcntl.h>
12815
12816int main ()
12817{
12818 int fd, rv;
12819 fd = open ("try.c", O_RDWR);
12820 if (-1 == fd) exit (1);
12821 rv = futimes (fd, NULL);
12822 exit (rv == -1 ? errno : 0);
12823}
12824EOCP
12825set try
12826if eval $compile; then
12827 `$run ./try`
12828 rc=$?
12829 case "$rc" in
12830 0) echo "Yes, it does" >&4
12831 d_futimes="$define"
12832 ;;
12833 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12834 ;;
12835 esac
12836else
12837 echo "No, it does not (probably harmless)\n" >&4
12838fi
12839$rm -f try.* try core core.try.*
12840
b4eb6b3d
JH
12841: see if getcwd exists
12842set getcwd d_getcwd
12843eval $inlibc
12844
12845: see if getespwnam exists
12846set getespwnam d_getespwnam
12847eval $inlibc
12848
12849
12850: see if getfsstat exists
12851set getfsstat d_getfsstat
12852eval $inlibc
12853
12854: see if getgrent exists
12855set getgrent d_getgrent
12856eval $inlibc
12857
10bc17b6
JH
12858: see if getgrent_r exists
12859set getgrent_r d_getgrent_r
12860eval $inlibc
12861case "$d_getgrent_r" in
12862"$define")
12863 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12864 case "$d_getgrent_r_proto:$usethreads" in
12865 ":define") d_getgrent_r_proto=define
a48ec845
JH
12866 set d_getgrent_r_proto getgrent_r $hdrs
12867 eval $hasproto ;;
12868 *) ;;
12869 esac
12870 case "$d_getgrent_r_proto" in
12871 define)
10bc17b6
JH
12872 case "$getgrent_r_proto" in
12873 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12874 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12875 esac
12876 case "$getgrent_r_proto" in
12877 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12878 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12879 esac
12880 case "$getgrent_r_proto" in
12881 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12882 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12883 esac
12884 case "$getgrent_r_proto" in
12885 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12886 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12887 esac
12888 case "$getgrent_r_proto" in
12889 ''|0) try='int getgrent_r(struct group*, char*, int);'
12890 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12891 esac
12892 case "$getgrent_r_proto" in
12893 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12894 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12895 esac
12896 case "$getgrent_r_proto" in
90e831dc 12897 ''|0) d_getgrent_r=undef
10bc17b6 12898 getgrent_r_proto=0
a48ec845 12899 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12900 * ) case "$getgrent_r_proto" in
12901 REENTRANT_PROTO*) ;;
12902 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12903 esac
12904 echo "Prototype: $try" ;;
12905 esac
12906 ;;
c18e646a
JH
12907 *) case "$usethreads" in
12908 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12909 esac
90e831dc
SB
12910 d_getgrent_r=undef
12911 getgrent_r_proto=0
c18e646a 12912 ;;
a48ec845
JH
12913 esac
12914 ;;
10bc17b6
JH
12915*) getgrent_r_proto=0
12916 ;;
12917esac
12918
12919: see if getgrgid_r exists
12920set getgrgid_r d_getgrgid_r
12921eval $inlibc
12922case "$d_getgrgid_r" in
12923"$define")
12924 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12925 case "$d_getgrgid_r_proto:$usethreads" in
12926 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12927 set d_getgrgid_r_proto getgrgid_r $hdrs
12928 eval $hasproto ;;
12929 *) ;;
12930 esac
12931 case "$d_getgrgid_r_proto" in
12932 define)
10bc17b6
JH
12933 case "$getgrgid_r_proto" in
12934 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12935 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12936 esac
12937 case "$getgrgid_r_proto" in
12938 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12939 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12940 esac
12941 case "$getgrgid_r_proto" in
12942 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12943 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12944 esac
12945 case "$getgrgid_r_proto" in
12946 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12947 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12948 esac
12949 case "$getgrgid_r_proto" in
90e831dc 12950 ''|0) d_getgrgid_r=undef
10bc17b6 12951 getgrgid_r_proto=0
a48ec845 12952 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12953 * ) case "$getgrgid_r_proto" in
12954 REENTRANT_PROTO*) ;;
12955 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12956 esac
12957 echo "Prototype: $try" ;;
12958 esac
12959 ;;
c18e646a
JH
12960 *) case "$usethreads" in
12961 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12962 esac
90e831dc
SB
12963 d_getgrgid_r=undef
12964 getgrgid_r_proto=0
c18e646a 12965 ;;
a48ec845
JH
12966 esac
12967 ;;
10bc17b6
JH
12968*) getgrgid_r_proto=0
12969 ;;
12970esac
12971
12972: see if getgrnam_r exists
12973set getgrnam_r d_getgrnam_r
12974eval $inlibc
12975case "$d_getgrnam_r" in
12976"$define")
12977 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12978 case "$d_getgrnam_r_proto:$usethreads" in
12979 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12980 set d_getgrnam_r_proto getgrnam_r $hdrs
12981 eval $hasproto ;;
12982 *) ;;
12983 esac
12984 case "$d_getgrnam_r_proto" in
12985 define)
10bc17b6
JH
12986 case "$getgrnam_r_proto" in
12987 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12988 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12989 esac
12990 case "$getgrnam_r_proto" in
12991 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12992 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12993 esac
12994 case "$getgrnam_r_proto" in
12995 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12996 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12997 esac
12998 case "$getgrnam_r_proto" in
12999 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13000 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13001 esac
13002 case "$getgrnam_r_proto" in
13003 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13004 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13005 esac
13006 case "$getgrnam_r_proto" in
90e831dc 13007 ''|0) d_getgrnam_r=undef
10bc17b6 13008 getgrnam_r_proto=0
a48ec845 13009 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13010 * ) case "$getgrnam_r_proto" in
13011 REENTRANT_PROTO*) ;;
13012 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13013 esac
13014 echo "Prototype: $try" ;;
13015 esac
13016 ;;
c18e646a
JH
13017 *) case "$usethreads" in
13018 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13019 esac
90e831dc
SB
13020 d_getgrnam_r=undef
13021 getgrnam_r_proto=0
c18e646a 13022 ;;
a48ec845
JH
13023 esac
13024 ;;
10bc17b6
JH
13025*) getgrnam_r_proto=0
13026 ;;
13027esac
13028
b4eb6b3d
JH
13029: see if gethostbyaddr exists
13030set gethostbyaddr d_gethbyaddr
13031eval $inlibc
13032
13033: see if gethostbyname exists
13034set gethostbyname d_gethbyname
13035eval $inlibc
13036
13037: see if gethostent exists
13038set gethostent d_gethent
13039eval $inlibc
13040
13041: see how we will look up host name
13042echo " "
13043call=''
13044if set gethostname val -f d_gethname; eval $csym; $val; then
13045 echo 'gethostname() found.' >&4
13046 d_gethname="$define"
13047 call=gethostname
13048fi
13049if set uname val -f d_uname; eval $csym; $val; then
13050 if ./xenix; then
13051 $cat <<'EOM'
13052uname() was found, but you're running xenix, and older versions of xenix
13053have a broken uname(). If you don't really know whether your xenix is old
13054enough to have a broken system call, use the default answer.
13055
13056EOM
13057 dflt=y
13058 case "$d_uname" in
13059 "$define") dflt=n;;
13060 esac
13061 rp='Is your uname() broken?'
13062 . ./myread
13063 case "$ans" in
13064 n*) d_uname="$define"; call=uname;;
13065 esac
13066 else
13067 echo 'uname() found.' >&4
13068 d_uname="$define"
13069 case "$call" in
13070 '') call=uname ;;
13071 esac
13072 fi
13073fi
13074case "$d_gethname" in
13075'') d_gethname="$undef";;
13076esac
13077case "$d_uname" in
13078'') d_uname="$undef";;
13079esac
13080case "$d_uname$d_gethname" in
13081*define*)
13082 dflt=n
13083 cat <<EOM
13084
13085Every now and then someone has a $call() that lies about the hostname
13086but can't be fixed for political or economic reasons. If you wish, I can
13087pretend $call() isn't there and maybe compute hostname at run-time
13088thanks to the '$phostname' command.
13089
13090EOM
13091 rp="Shall I ignore $call() from now on?"
13092 . ./myread
13093 case "$ans" in
13094 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13095 esac;;
13096esac
13097case "$phostname" in
13098'') aphostname='';;
13099*) case "$aphostname" in
13100 /*) ;;
13101 *) set X $phostname
13102 shift
13103 file=$1
13104 shift
13105 file=`./loc $file $file $pth`
13106 aphostname=`echo $file $*`
13107 ;;
13108 esac
13109 ;;
13110esac
13111case "$d_uname$d_gethname" in
13112*define*) ;;
13113*)
13114 case "$phostname" in
13115 '')
13116 echo "There will be no way for $package to get your hostname." >&4;;
13117 *)
13118 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13119 ;;
13120 esac;;
13121esac
13122case "$d_phostname" in
13123'') d_phostname="$undef";;
13124esac
13125
10bc17b6
JH
13126: see if gethostbyaddr_r exists
13127set gethostbyaddr_r d_gethostbyaddr_r
13128eval $inlibc
13129case "$d_gethostbyaddr_r" in
13130"$define")
13131 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13132 case "$d_gethostbyaddr_r_proto:$usethreads" in
13133 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13134 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13135 eval $hasproto ;;
13136 *) ;;
13137 esac
13138 case "$d_gethostbyaddr_r_proto" in
13139 define)
10bc17b6
JH
13140 case "$gethostbyaddr_r_proto" in
13141 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13142 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13143 esac
13144 case "$gethostbyaddr_r_proto" in
13145 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13146 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13147 esac
13148 case "$gethostbyaddr_r_proto" in
13149 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13150 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13151 esac
13152 case "$gethostbyaddr_r_proto" in
13153 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13154 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13155 esac
13156 case "$gethostbyaddr_r_proto" in
13157 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13158 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13159 esac
13160 case "$gethostbyaddr_r_proto" in
13161 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13162 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13163 esac
13164 case "$gethostbyaddr_r_proto" in
13165 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13166 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13167 esac
13168 case "$gethostbyaddr_r_proto" in
13169 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13170 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13171 esac
13172 case "$gethostbyaddr_r_proto" in
13173 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13174 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13175 esac
13176 case "$gethostbyaddr_r_proto" in
13177 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13178 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13179 esac
13180 case "$gethostbyaddr_r_proto" in
c71a3471
JH
13181 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13182 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13183 esac
13184 case "$gethostbyaddr_r_proto" in
90e831dc 13185 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13186 gethostbyaddr_r_proto=0
a48ec845 13187 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13188 * ) case "$gethostbyaddr_r_proto" in
13189 REENTRANT_PROTO*) ;;
13190 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13191 esac
13192 echo "Prototype: $try" ;;
13193 esac
13194 ;;
c18e646a
JH
13195 *) case "$usethreads" in
13196 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13197 esac
90e831dc
SB
13198 d_gethostbyaddr_r=undef
13199 gethostbyaddr_r_proto=0
c18e646a 13200 ;;
a48ec845
JH
13201 esac
13202 ;;
10bc17b6
JH
13203*) gethostbyaddr_r_proto=0
13204 ;;
13205esac
13206
13207: see if gethostbyname_r exists
13208set gethostbyname_r d_gethostbyname_r
13209eval $inlibc
13210case "$d_gethostbyname_r" in
13211"$define")
13212 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13213 case "$d_gethostbyname_r_proto:$usethreads" in
13214 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13215 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13216 eval $hasproto ;;
13217 *) ;;
13218 esac
13219 case "$d_gethostbyname_r_proto" in
13220 define)
10bc17b6
JH
13221 case "$gethostbyname_r_proto" in
13222 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13223 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13224 esac
13225 case "$gethostbyname_r_proto" in
13226 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13227 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13228 esac
13229 case "$gethostbyname_r_proto" in
13230 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13231 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13232 esac
13233 case "$gethostbyname_r_proto" in
90e831dc 13234 ''|0) d_gethostbyname_r=undef
10bc17b6 13235 gethostbyname_r_proto=0
a48ec845 13236 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13237 * ) case "$gethostbyname_r_proto" in
13238 REENTRANT_PROTO*) ;;
13239 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13240 esac
13241 echo "Prototype: $try" ;;
13242 esac
13243 ;;
c18e646a
JH
13244 *) case "$usethreads" in
13245 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13246 esac
90e831dc
SB
13247 d_gethostbyname_r=undef
13248 gethostbyname_r_proto=0
c18e646a 13249 ;;
a48ec845
JH
13250 esac
13251 ;;
10bc17b6
JH
13252*) gethostbyname_r_proto=0
13253 ;;
13254esac
13255
13256: see if gethostent_r exists
13257set gethostent_r d_gethostent_r
13258eval $inlibc
13259case "$d_gethostent_r" in
13260"$define")
13261 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13262 case "$d_gethostent_r_proto:$usethreads" in
13263 ":define") d_gethostent_r_proto=define
a48ec845
JH
13264 set d_gethostent_r_proto gethostent_r $hdrs
13265 eval $hasproto ;;
13266 *) ;;
13267 esac
13268 case "$d_gethostent_r_proto" in
13269 define)
10bc17b6
JH
13270 case "$gethostent_r_proto" in
13271 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13272 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13273 esac
13274 case "$gethostent_r_proto" in
13275 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13276 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13277 esac
13278 case "$gethostent_r_proto" in
13279 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13280 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13281 esac
13282 case "$gethostent_r_proto" in
13283 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13284 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13285 esac
13286 case "$gethostent_r_proto" in
13287 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13288 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13289 esac
13290 case "$gethostent_r_proto" in
13291 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13292 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13293 esac
13294 case "$gethostent_r_proto" in
90e831dc 13295 ''|0) d_gethostent_r=undef
10bc17b6 13296 gethostent_r_proto=0
a48ec845 13297 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13298 * ) case "$gethostent_r_proto" in
13299 REENTRANT_PROTO*) ;;
13300 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13301 esac
13302 echo "Prototype: $try" ;;
13303 esac
13304 ;;
c18e646a
JH
13305 *) case "$usethreads" in
13306 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13307 esac
90e831dc
SB
13308 d_gethostent_r=undef
13309 gethostent_r_proto=0
c18e646a 13310 ;;
a48ec845
JH
13311 esac
13312 ;;
10bc17b6
JH
13313*) gethostent_r_proto=0
13314 ;;
13315esac
b4eb6b3d
JH
13316
13317: see if prototypes for various gethostxxx netdb.h functions are available
13318echo " "
13319set d_gethostprotos gethostent $i_netdb netdb.h
13320eval $hasproto
13321
4e0554ec
JH
13322: see if getitimer exists
13323set getitimer d_getitimer
13324eval $inlibc
13325
b4eb6b3d
JH
13326: see if getlogin exists
13327set getlogin d_getlogin
13328eval $inlibc
13329
10bc17b6
JH
13330: see if getlogin_r exists
13331set getlogin_r d_getlogin_r
13332eval $inlibc
13333case "$d_getlogin_r" in
13334"$define")
13335 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13336 case "$d_getlogin_r_proto:$usethreads" in
13337 ":define") d_getlogin_r_proto=define
a48ec845
JH
13338 set d_getlogin_r_proto getlogin_r $hdrs
13339 eval $hasproto ;;
13340 *) ;;
13341 esac
13342 case "$d_getlogin_r_proto" in
13343 define)
10bc17b6
JH
13344 case "$getlogin_r_proto" in
13345 ''|0) try='int getlogin_r(char*, size_t);'
13346 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13347 esac
13348 case "$getlogin_r_proto" in
13349 ''|0) try='int getlogin_r(char*, int);'
13350 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13351 esac
13352 case "$getlogin_r_proto" in
13353 ''|0) try='char* getlogin_r(char*, size_t);'
13354 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13355 esac
13356 case "$getlogin_r_proto" in
13357 ''|0) try='char* getlogin_r(char*, int);'
13358 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13359 esac
13360 case "$getlogin_r_proto" in
90e831dc 13361 ''|0) d_getlogin_r=undef
10bc17b6 13362 getlogin_r_proto=0
a48ec845 13363 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13364 * ) case "$getlogin_r_proto" in
13365 REENTRANT_PROTO*) ;;
13366 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13367 esac
13368 echo "Prototype: $try" ;;
13369 esac
13370 ;;
c18e646a
JH
13371 *) case "$usethreads" in
13372 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13373 esac
90e831dc
SB
13374 d_getlogin_r=undef
13375 getlogin_r_proto=0
c18e646a 13376 ;;
a48ec845
JH
13377 esac
13378 ;;
10bc17b6
JH
13379*) getlogin_r_proto=0
13380 ;;
13381esac
13382
b4eb6b3d
JH
13383: see if getmnt exists
13384set getmnt d_getmnt
13385eval $inlibc
13386
13387: see if getmntent exists
13388set getmntent d_getmntent
13389eval $inlibc
13390
13391: see if getnetbyaddr exists
13392set getnetbyaddr d_getnbyaddr
13393eval $inlibc
13394
13395: see if getnetbyname exists
13396set getnetbyname d_getnbyname
13397eval $inlibc
13398
13399: see if getnetent exists
13400set getnetent d_getnent
13401eval $inlibc
13402
10bc17b6
JH
13403: see if getnetbyaddr_r exists
13404set getnetbyaddr_r d_getnetbyaddr_r
13405eval $inlibc
13406case "$d_getnetbyaddr_r" in
13407"$define")
13408 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13409 case "$d_getnetbyaddr_r_proto:$usethreads" in
13410 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13411 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13412 eval $hasproto ;;
13413 *) ;;
13414 esac
13415 case "$d_getnetbyaddr_r_proto" in
13416 define)
10bc17b6
JH
13417 case "$getnetbyaddr_r_proto" in
13418 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13419 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13420 esac
13421 case "$getnetbyaddr_r_proto" in
13422 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13423 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13424 esac
13425 case "$getnetbyaddr_r_proto" in
13426 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13427 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13428 esac
13429 case "$getnetbyaddr_r_proto" in
13430 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13431 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13432 esac
13433 case "$getnetbyaddr_r_proto" in
13434 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13435 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13436 esac
13437 case "$getnetbyaddr_r_proto" in
13438 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13439 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13440 esac
13441 case "$getnetbyaddr_r_proto" in
13442 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13443 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13444 esac
13445 case "$getnetbyaddr_r_proto" in
c71a3471
JH
13446 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13447 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13448 esac
13449 case "$getnetbyaddr_r_proto" in
90e831dc 13450 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13451 getnetbyaddr_r_proto=0
a48ec845 13452 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13453 * ) case "$getnetbyaddr_r_proto" in
13454 REENTRANT_PROTO*) ;;
13455 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13456 esac
13457 echo "Prototype: $try" ;;
13458 esac
13459 ;;
c18e646a
JH
13460 *) case "$usethreads" in
13461 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13462 esac
90e831dc
SB
13463 d_getnetbyaddr_r=undef
13464 getnetbyaddr_r_proto=0
c18e646a 13465 ;;
a48ec845
JH
13466 esac
13467 ;;
10bc17b6
JH
13468*) getnetbyaddr_r_proto=0
13469 ;;
13470esac
13471
13472: see if getnetbyname_r exists
13473set getnetbyname_r d_getnetbyname_r
13474eval $inlibc
13475case "$d_getnetbyname_r" in
13476"$define")
13477 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13478 case "$d_getnetbyname_r_proto:$usethreads" in
13479 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13480 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13481 eval $hasproto ;;
13482 *) ;;
13483 esac
13484 case "$d_getnetbyname_r_proto" in
13485 define)
10bc17b6
JH
13486 case "$getnetbyname_r_proto" in
13487 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13488 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13489 esac
13490 case "$getnetbyname_r_proto" in
13491 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13492 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13493 esac
13494 case "$getnetbyname_r_proto" in
13495 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13496 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13497 esac
13498 case "$getnetbyname_r_proto" in
13499 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13500 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13501 esac
13502 case "$getnetbyname_r_proto" in
90e831dc 13503 ''|0) d_getnetbyname_r=undef
10bc17b6 13504 getnetbyname_r_proto=0
a48ec845 13505 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13506 * ) case "$getnetbyname_r_proto" in
13507 REENTRANT_PROTO*) ;;
13508 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13509 esac
13510 echo "Prototype: $try" ;;
13511 esac
13512 ;;
c18e646a
JH
13513 *) case "$usethreads" in
13514 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13515 esac
90e831dc
SB
13516 d_getnetbyname_r=undef
13517 getnetbyname_r_proto=0
c18e646a 13518 ;;
a48ec845
JH
13519 esac
13520 ;;
10bc17b6
JH
13521*) getnetbyname_r_proto=0
13522 ;;
13523esac
13524
13525: see if getnetent_r exists
13526set getnetent_r d_getnetent_r
13527eval $inlibc
13528case "$d_getnetent_r" in
13529"$define")
13530 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13531 case "$d_getnetent_r_proto:$usethreads" in
13532 ":define") d_getnetent_r_proto=define
a48ec845
JH
13533 set d_getnetent_r_proto getnetent_r $hdrs
13534 eval $hasproto ;;
13535 *) ;;
13536 esac
13537 case "$d_getnetent_r_proto" in
13538 define)
10bc17b6
JH
13539 case "$getnetent_r_proto" in
13540 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13541 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13542 esac
13543 case "$getnetent_r_proto" in
13544 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13545 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13546 esac
13547 case "$getnetent_r_proto" in
13548 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13549 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13550 esac
13551 case "$getnetent_r_proto" in
13552 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13553 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13554 esac
13555 case "$getnetent_r_proto" in
13556 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13557 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13558 esac
13559 case "$getnetent_r_proto" in
13560 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13561 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13562 esac
13563 case "$getnetent_r_proto" in
90e831dc 13564 ''|0) d_getnetent_r=undef
10bc17b6 13565 getnetent_r_proto=0
a48ec845 13566 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13567 * ) case "$getnetent_r_proto" in
13568 REENTRANT_PROTO*) ;;
13569 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13570 esac
13571 echo "Prototype: $try" ;;
13572 esac
13573 ;;
c18e646a
JH
13574 *) case "$usethreads" in
13575 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13576 esac
90e831dc
SB
13577 d_getnetent_r=undef
13578 getnetent_r_proto=0
c18e646a 13579 ;;
a48ec845
JH
13580 esac
13581 ;;
10bc17b6
JH
13582*) getnetent_r_proto=0
13583 ;;
13584esac
13585
b4eb6b3d
JH
13586: see if prototypes for various getnetxxx netdb.h functions are available
13587echo " "
13588set d_getnetprotos getnetent $i_netdb netdb.h
13589eval $hasproto
13590
0c0643d0
JH
13591: see if getpagesize exists
13592set getpagesize d_getpagsz
13593eval $inlibc
13594
b4eb6b3d
JH
13595
13596: see if getprotobyname exists
13597set getprotobyname d_getpbyname
13598eval $inlibc
13599
13600: see if getprotobynumber exists
13601set getprotobynumber d_getpbynumber
13602eval $inlibc
13603
13604: see if getprotoent exists
13605set getprotoent d_getpent
13606eval $inlibc
13607
13608: see if getpgid exists
13609set getpgid d_getpgid
13610eval $inlibc
13611
13612: see if getpgrp2 exists
13613set getpgrp2 d_getpgrp2
13614eval $inlibc
13615
13616: see if getppid exists
13617set getppid d_getppid
13618eval $inlibc
13619
13620: see if getpriority exists
13621set getpriority d_getprior
13622eval $inlibc
13623
10bc17b6
JH
13624: see if getprotobyname_r exists
13625set getprotobyname_r d_getprotobyname_r
13626eval $inlibc
13627case "$d_getprotobyname_r" in
13628"$define")
13629 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13630 case "$d_getprotobyname_r_proto:$usethreads" in
13631 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13632 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13633 eval $hasproto ;;
13634 *) ;;
13635 esac
13636 case "$d_getprotobyname_r_proto" in
13637 define)
10bc17b6
JH
13638 case "$getprotobyname_r_proto" in
13639 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13640 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13641 esac
13642 case "$getprotobyname_r_proto" in
13643 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13644 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13645 esac
13646 case "$getprotobyname_r_proto" in
13647 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13648 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13649 esac
13650 case "$getprotobyname_r_proto" in
90e831dc 13651 ''|0) d_getprotobyname_r=undef
10bc17b6 13652 getprotobyname_r_proto=0
a48ec845 13653 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13654 * ) case "$getprotobyname_r_proto" in
13655 REENTRANT_PROTO*) ;;
13656 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13657 esac
13658 echo "Prototype: $try" ;;
13659 esac
13660 ;;
c18e646a
JH
13661 *) case "$usethreads" in
13662 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13663 esac
90e831dc
SB
13664 d_getprotobyname_r=undef
13665 getprotobyname_r_proto=0
c18e646a 13666 ;;
a48ec845
JH
13667 esac
13668 ;;
10bc17b6
JH
13669*) getprotobyname_r_proto=0
13670 ;;
13671esac
13672
13673: see if getprotobynumber_r exists
13674set getprotobynumber_r d_getprotobynumber_r
13675eval $inlibc
13676case "$d_getprotobynumber_r" in
13677"$define")
13678 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13679 case "$d_getprotobynumber_r_proto:$usethreads" in
13680 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13681 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13682 eval $hasproto ;;
13683 *) ;;
13684 esac
13685 case "$d_getprotobynumber_r_proto" in
13686 define)
10bc17b6
JH
13687 case "$getprotobynumber_r_proto" in
13688 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13689 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13690 esac
13691 case "$getprotobynumber_r_proto" in
13692 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13693 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13694 esac
13695 case "$getprotobynumber_r_proto" in
13696 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13697 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13698 esac
13699 case "$getprotobynumber_r_proto" in
90e831dc 13700 ''|0) d_getprotobynumber_r=undef
10bc17b6 13701 getprotobynumber_r_proto=0
a48ec845 13702 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13703 * ) case "$getprotobynumber_r_proto" in
13704 REENTRANT_PROTO*) ;;
13705 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13706 esac
13707 echo "Prototype: $try" ;;
13708 esac
13709 ;;
c18e646a
JH
13710 *) case "$usethreads" in
13711 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13712 esac
90e831dc
SB
13713 d_getprotobynumber_r=undef
13714 getprotobynumber_r_proto=0
c18e646a 13715 ;;
a48ec845
JH
13716 esac
13717 ;;
10bc17b6
JH
13718*) getprotobynumber_r_proto=0
13719 ;;
13720esac
13721
13722: see if getprotoent_r exists
13723set getprotoent_r d_getprotoent_r
13724eval $inlibc
13725case "$d_getprotoent_r" in
13726"$define")
13727 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13728 case "$d_getprotoent_r_proto:$usethreads" in
13729 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13730 set d_getprotoent_r_proto getprotoent_r $hdrs
13731 eval $hasproto ;;
13732 *) ;;
13733 esac
13734 case "$d_getprotoent_r_proto" in
13735 define)
10bc17b6
JH
13736 case "$getprotoent_r_proto" in
13737 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13738 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13739 esac
13740 case "$getprotoent_r_proto" in
13741 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13742 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13743 esac
13744 case "$getprotoent_r_proto" in
13745 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13746 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13747 esac
13748 case "$getprotoent_r_proto" in
13749 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13750 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13751 esac
13752 case "$getprotoent_r_proto" in
90e831dc 13753 ''|0) d_getprotoent_r=undef
10bc17b6 13754 getprotoent_r_proto=0
a48ec845 13755 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13756 * ) case "$getprotoent_r_proto" in
13757 REENTRANT_PROTO*) ;;
13758 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13759 esac
13760 echo "Prototype: $try" ;;
13761 esac
13762 ;;
c18e646a
JH
13763 *) case "$usethreads" in
13764 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13765 esac
90e831dc
SB
13766 d_getprotoent_r=undef
13767 getprotoent_r_proto=0
c18e646a 13768 ;;
a48ec845
JH
13769 esac
13770 ;;
10bc17b6
JH
13771*) getprotoent_r_proto=0
13772 ;;
13773esac
13774
b4eb6b3d
JH
13775: see if prototypes for various getprotoxxx netdb.h functions are available
13776echo " "
13777set d_getprotoprotos getprotoent $i_netdb netdb.h
13778eval $hasproto
13779
13780: see if getprpwnam exists
13781set getprpwnam d_getprpwnam
13782eval $inlibc
13783
13784: see if getpwent exists
13785set getpwent d_getpwent
13786eval $inlibc
13787
10bc17b6
JH
13788: see if getpwent_r exists
13789set getpwent_r d_getpwent_r
13790eval $inlibc
13791case "$d_getpwent_r" in
13792"$define")
13793 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13794 case "$d_getpwent_r_proto:$usethreads" in
13795 ":define") d_getpwent_r_proto=define
a48ec845
JH
13796 set d_getpwent_r_proto getpwent_r $hdrs
13797 eval $hasproto ;;
13798 *) ;;
13799 esac
13800 case "$d_getpwent_r_proto" in
13801 define)
10bc17b6
JH
13802 case "$getpwent_r_proto" in
13803 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13804 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13805 esac
13806 case "$getpwent_r_proto" in
13807 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13808 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13809 esac
13810 case "$getpwent_r_proto" in
13811 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13812 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13813 esac
13814 case "$getpwent_r_proto" in
13815 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13816 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13817 esac
13818 case "$getpwent_r_proto" in
13819 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13820 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13821 esac
13822 case "$getpwent_r_proto" in
13823 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13824 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13825 esac
13826 case "$getpwent_r_proto" in
90e831dc 13827 ''|0) d_getpwent_r=undef
10bc17b6 13828 getpwent_r_proto=0
a48ec845 13829 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13830 * ) case "$getpwent_r_proto" in
13831 REENTRANT_PROTO*) ;;
13832 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13833 esac
13834 echo "Prototype: $try" ;;
13835 esac
13836 ;;
c18e646a
JH
13837 *) case "$usethreads" in
13838 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13839 esac
90e831dc
SB
13840 d_getpwent_r=undef
13841 getpwent_r_proto=0
c18e646a 13842 ;;
a48ec845
JH
13843 esac
13844 ;;
10bc17b6
JH
13845*) getpwent_r_proto=0
13846 ;;
13847esac
13848
13849: see if getpwnam_r exists
13850set getpwnam_r d_getpwnam_r
13851eval $inlibc
13852case "$d_getpwnam_r" in
13853"$define")
13854 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13855 case "$d_getpwnam_r_proto:$usethreads" in
13856 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13857 set d_getpwnam_r_proto getpwnam_r $hdrs
13858 eval $hasproto ;;
13859 *) ;;
13860 esac
13861 case "$d_getpwnam_r_proto" in
13862 define)
10bc17b6
JH
13863 case "$getpwnam_r_proto" in
13864 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13865 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13866 esac
13867 case "$getpwnam_r_proto" in
13868 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13869 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13870 esac
13871 case "$getpwnam_r_proto" in
13872 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13873 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13874 esac
13875 case "$getpwnam_r_proto" in
13876 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13877 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13878 esac
13879 case "$getpwnam_r_proto" in
90e831dc 13880 ''|0) d_getpwnam_r=undef
10bc17b6 13881 getpwnam_r_proto=0
a48ec845 13882 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13883 * ) case "$getpwnam_r_proto" in
13884 REENTRANT_PROTO*) ;;
13885 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13886 esac
13887 echo "Prototype: $try" ;;
13888 esac
13889 ;;
c18e646a
JH
13890 *) case "$usethreads" in
13891 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13892 esac
90e831dc
SB
13893 d_getpwnam_r=undef
13894 getpwnam_r_proto=0
c18e646a 13895 ;;
a48ec845
JH
13896 esac
13897 ;;
10bc17b6
JH
13898*) getpwnam_r_proto=0
13899 ;;
13900esac
13901
13902: see if getpwuid_r exists
13903set getpwuid_r d_getpwuid_r
13904eval $inlibc
13905case "$d_getpwuid_r" in
13906"$define")
13907 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13908 case "$d_getpwuid_r_proto:$usethreads" in
13909 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13910 set d_getpwuid_r_proto getpwuid_r $hdrs
13911 eval $hasproto ;;
13912 *) ;;
13913 esac
13914 case "$d_getpwuid_r_proto" in
13915 define)
10bc17b6
JH
13916 case "$getpwuid_r_proto" in
13917 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13918 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13919 esac
13920 case "$getpwuid_r_proto" in
13921 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13922 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13923 esac
13924 case "$getpwuid_r_proto" in
13925 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13926 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13927 esac
13928 case "$getpwuid_r_proto" in
13929 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13930 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13931 esac
13932 case "$getpwuid_r_proto" in
90e831dc 13933 ''|0) d_getpwuid_r=undef
10bc17b6 13934 getpwuid_r_proto=0
a48ec845 13935 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13936 * ) case "$getpwuid_r_proto" in
13937 REENTRANT_PROTO*) ;;
13938 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13939 esac
13940 echo "Prototype: $try" ;;
13941 esac
13942 ;;
c18e646a
JH
13943 *) case "$usethreads" in
13944 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13945 esac
90e831dc
SB
13946 d_getpwuid_r=undef
13947 getpwuid_r_proto=0
c18e646a 13948 ;;
a48ec845
JH
13949 esac
13950 ;;
10bc17b6
JH
13951*) getpwuid_r_proto=0
13952 ;;
13953esac
13954
b4eb6b3d
JH
13955
13956: see if getservbyname exists
13957set getservbyname d_getsbyname
13958eval $inlibc
13959
13960: see if getservbyport exists
13961set getservbyport d_getsbyport
13962eval $inlibc
13963
13964: see if getservent exists
13965set getservent d_getsent
13966eval $inlibc
13967
10bc17b6
JH
13968: see if getservbyname_r exists
13969set getservbyname_r d_getservbyname_r
13970eval $inlibc
13971case "$d_getservbyname_r" in
13972"$define")
13973 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13974 case "$d_getservbyname_r_proto:$usethreads" in
13975 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13976 set d_getservbyname_r_proto getservbyname_r $hdrs
13977 eval $hasproto ;;
13978 *) ;;
13979 esac
13980 case "$d_getservbyname_r_proto" in
13981 define)
10bc17b6
JH
13982 case "$getservbyname_r_proto" in
13983 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13984 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13985 esac
13986 case "$getservbyname_r_proto" in
13987 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13988 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13989 esac
13990 case "$getservbyname_r_proto" in
13991 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13992 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13993 esac
13994 case "$getservbyname_r_proto" in
90e831dc 13995 ''|0) d_getservbyname_r=undef
10bc17b6 13996 getservbyname_r_proto=0
a48ec845 13997 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13998 * ) case "$getservbyname_r_proto" in
13999 REENTRANT_PROTO*) ;;
14000 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14001 esac
14002 echo "Prototype: $try" ;;
14003 esac
14004 ;;
c18e646a
JH
14005 *) case "$usethreads" in
14006 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14007 esac
90e831dc
SB
14008 d_getservbyname_r=undef
14009 getservbyname_r_proto=0
c18e646a 14010 ;;
a48ec845
JH
14011 esac
14012 ;;
10bc17b6
JH
14013*) getservbyname_r_proto=0
14014 ;;
14015esac
14016
14017: see if getservbyport_r exists
14018set getservbyport_r d_getservbyport_r
14019eval $inlibc
14020case "$d_getservbyport_r" in
14021"$define")
14022 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14023 case "$d_getservbyport_r_proto:$usethreads" in
14024 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14025 set d_getservbyport_r_proto getservbyport_r $hdrs
14026 eval $hasproto ;;
14027 *) ;;
14028 esac
14029 case "$d_getservbyport_r_proto" in
14030 define)
10bc17b6
JH
14031 case "$getservbyport_r_proto" in
14032 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14033 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14034 esac
14035 case "$getservbyport_r_proto" in
14036 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14037 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14038 esac
14039 case "$getservbyport_r_proto" in
14040 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14041 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14042 esac
14043 case "$getservbyport_r_proto" in
90e831dc 14044 ''|0) d_getservbyport_r=undef
10bc17b6 14045 getservbyport_r_proto=0
a48ec845 14046 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14047 * ) case "$getservbyport_r_proto" in
14048 REENTRANT_PROTO*) ;;
14049 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14050 esac
14051 echo "Prototype: $try" ;;
14052 esac
14053 ;;
c18e646a
JH
14054 *) case "$usethreads" in
14055 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14056 esac
90e831dc
SB
14057 d_getservbyport_r=undef
14058 getservbyport_r_proto=0
c18e646a 14059 ;;
a48ec845
JH
14060 esac
14061 ;;
10bc17b6
JH
14062*) getservbyport_r_proto=0
14063 ;;
14064esac
14065
14066: see if getservent_r exists
14067set getservent_r d_getservent_r
14068eval $inlibc
14069case "$d_getservent_r" in
14070"$define")
14071 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14072 case "$d_getservent_r_proto:$usethreads" in
14073 ":define") d_getservent_r_proto=define
a48ec845
JH
14074 set d_getservent_r_proto getservent_r $hdrs
14075 eval $hasproto ;;
14076 *) ;;
14077 esac
14078 case "$d_getservent_r_proto" in
14079 define)
10bc17b6
JH
14080 case "$getservent_r_proto" in
14081 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14082 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14083 esac
14084 case "$getservent_r_proto" in
14085 ''|0) try='int getservent_r(struct servent*, char*, int);'
14086 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14087 esac
14088 case "$getservent_r_proto" in
14089 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14090 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14091 esac
14092 case "$getservent_r_proto" in
14093 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14094 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14095 esac
14096 case "$getservent_r_proto" in
90e831dc 14097 ''|0) d_getservent_r=undef
10bc17b6 14098 getservent_r_proto=0
a48ec845 14099 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14100 * ) case "$getservent_r_proto" in
14101 REENTRANT_PROTO*) ;;
14102 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14103 esac
14104 echo "Prototype: $try" ;;
14105 esac
14106 ;;
c18e646a
JH
14107 *) case "$usethreads" in
14108 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14109 esac
90e831dc
SB
14110 d_getservent_r=undef
14111 getservent_r_proto=0
c18e646a 14112 ;;
a48ec845
JH
14113 esac
14114 ;;
10bc17b6
JH
14115*) getservent_r_proto=0
14116 ;;
14117esac
14118
b4eb6b3d
JH
14119: see if prototypes for various getservxxx netdb.h functions are available
14120echo " "
14121set d_getservprotos getservent $i_netdb netdb.h
14122eval $hasproto
14123
14124: see if getspnam exists
14125set getspnam d_getspnam
14126eval $inlibc
14127
10bc17b6
JH
14128: see if this is a shadow.h system
14129set shadow.h i_shadow
14130eval $inhdr
14131
14132: see if getspnam_r exists
14133set getspnam_r d_getspnam_r
14134eval $inlibc
14135case "$d_getspnam_r" in
14136"$define")
14137 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14138 case "$d_getspnam_r_proto:$usethreads" in
14139 ":define") d_getspnam_r_proto=define
a48ec845
JH
14140 set d_getspnam_r_proto getspnam_r $hdrs
14141 eval $hasproto ;;
14142 *) ;;
14143 esac
14144 case "$d_getspnam_r_proto" in
14145 define)
10bc17b6
JH
14146 case "$getspnam_r_proto" in
14147 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14148 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14149 esac
14150 case "$getspnam_r_proto" in
14151 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14152 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14153 esac
14154 case "$getspnam_r_proto" in
90e831dc 14155 ''|0) d_getspnam_r=undef
10bc17b6 14156 getspnam_r_proto=0
a48ec845 14157 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14158 * ) case "$getspnam_r_proto" in
14159 REENTRANT_PROTO*) ;;
14160 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14161 esac
14162 echo "Prototype: $try" ;;
14163 esac
14164 ;;
c18e646a
JH
14165 *) case "$usethreads" in
14166 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14167 esac
90e831dc
SB
14168 d_getspnam_r=undef
14169 getspnam_r_proto=0
c18e646a 14170 ;;
a48ec845
JH
14171 esac
14172 ;;
10bc17b6
JH
14173*) getspnam_r_proto=0
14174 ;;
14175esac
14176
b4eb6b3d
JH
14177: see if gettimeofday or ftime exists
14178set gettimeofday d_gettimeod
14179eval $inlibc
14180case "$d_gettimeod" in
14181"$undef")
14182 set ftime d_ftime
14183 eval $inlibc
14184 ;;
14185*)
14186 val="$undef"; set d_ftime; eval $setvar
14187 ;;
14188esac
14189case "$d_gettimeod$d_ftime" in
14190"$undef$undef")
14191 echo " "
14192 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14193 ;;
14194esac
14195
10bc17b6
JH
14196: see if gmtime_r exists
14197set gmtime_r d_gmtime_r
14198eval $inlibc
14199case "$d_gmtime_r" in
14200"$define")
d63eadf0 14201 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14202 case "$d_gmtime_r_proto:$usethreads" in
14203 ":define") d_gmtime_r_proto=define
a48ec845
JH
14204 set d_gmtime_r_proto gmtime_r $hdrs
14205 eval $hasproto ;;
14206 *) ;;
14207 esac
14208 case "$d_gmtime_r_proto" in
14209 define)
10bc17b6
JH
14210 case "$gmtime_r_proto" in
14211 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14212 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14213 esac
14214 case "$gmtime_r_proto" in
14215 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14216 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14217 esac
14218 case "$gmtime_r_proto" in
90e831dc 14219 ''|0) d_gmtime_r=undef
10bc17b6 14220 gmtime_r_proto=0
a48ec845 14221 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14222 * ) case "$gmtime_r_proto" in
14223 REENTRANT_PROTO*) ;;
14224 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14225 esac
14226 echo "Prototype: $try" ;;
14227 esac
b4eb6b3d 14228 ;;
c18e646a
JH
14229 *) case "$usethreads" in
14230 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14231 esac
90e831dc
SB
14232 d_gmtime_r=undef
14233 gmtime_r_proto=0
c18e646a 14234 ;;
a48ec845
JH
14235 esac
14236 ;;
10bc17b6 14237*) gmtime_r_proto=0
b4eb6b3d
JH
14238 ;;
14239esac
14240
14241: see if hasmntopt exists
14242set hasmntopt d_hasmntopt
14243eval $inlibc
14244
14245: see if this is a netinet/in.h or sys/in.h system
14246set netinet/in.h i_niin sys/in.h i_sysin
14247eval $inhdr
14248
14249: see if arpa/inet.h has to be included
14250set arpa/inet.h i_arpainet
14251eval $inhdr
14252
14253: see if htonl --and friends-- exists
14254val=''
14255set htonl val
14256eval $inlibc
14257
14258: Maybe they are macros.
14259case "$val" in
14260$undef)
14261 $cat >htonl.c <<EOM
14262#include <stdio.h>
14263#include <sys/types.h>
14264#$i_niin I_NETINET_IN
14265#$i_sysin I_SYS_IN
14266#$i_arpainet I_ARPA_INET
14267#ifdef I_NETINET_IN
14268#include <netinet/in.h>
14269#endif
14270#ifdef I_SYS_IN
14271#include <sys/in.h>
14272#endif
14273#ifdef I_ARPA_INET
14274#include <arpa/inet.h>
14275#endif
14276#ifdef htonl
14277printf("Defined as a macro.");
14278#endif
14279EOM
14280 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14281 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14282 val="$define"
14283 echo "But it seems to be defined as a macro." >&4
14284 fi
14285 $rm -f htonl.?
14286 ;;
14287esac
14288set d_htonl
14289eval $setvar
14290
5a29c6bc
JH
14291: see if ilogbl exists
14292set ilogbl d_ilogbl
14293eval $inlibc
14294
b4eb6b3d
JH
14295: index or strchr
14296echo " "
14297if set index val -f; eval $csym; $val; then
14298 if set strchr val -f d_strchr; eval $csym; $val; then
14299 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14300 val="$define"
14301 vali="$undef"
14302 echo "strchr() found." >&4
14303 else
14304 val="$undef"
14305 vali="$define"
14306 echo "index() found." >&4
14307 fi
14308 else
14309 val="$undef"
14310 vali="$define"
8dfa8df9
JH
14311 echo "index() found." >&4
14312 fi
b4eb6b3d 14313else
8dfa8df9
JH
14314 if set strchr val -f d_strchr; eval $csym; $val; then
14315 val="$define"
14316 vali="$undef"
14317 echo "strchr() found." >&4
14318 else
14319 echo "No index() or strchr() found!" >&4
14320 val="$undef"
14321 vali="$undef"
14322 fi
b4eb6b3d 14323fi
8dfa8df9
JH
14324set d_strchr; eval $setvar
14325val="$vali"
14326set d_index; eval $setvar
14327
14328: check whether inet_aton exists
14329set inet_aton d_inetaton
14330eval $inlibc
b4eb6b3d
JH
14331
14332: Look for isascii
14333echo " "
5a29c6bc 14334$cat >isascii.c <<EOCP
b4eb6b3d
JH
14335#include <stdio.h>
14336#include <ctype.h>
5a29c6bc
JH
14337#$i_stdlib I_STDLIB
14338#ifdef I_STDLIB
14339#include <stdlib.h>
14340#endif
b4eb6b3d
JH
14341int main() {
14342 int c = 'A';
14343 if (isascii(c))
14344 exit(0);
14345 else
14346 exit(1);
14347}
14348EOCP
14349set isascii
14350if eval $compile; then
14351 echo "isascii() found." >&4
14352 val="$define"
14353else
14354 echo "isascii() NOT found." >&4
14355 val="$undef"
14356fi
14357set d_isascii
14358eval $setvar
14359$rm -f isascii*
14360
758a5d79
JH
14361: see if isfinite exists
14362set isfinite d_isfinite
14363eval $inlibc
14364
14365: see if isinf exists
14366set isinf d_isinf
14367eval $inlibc
14368
b4eb6b3d
JH
14369: see if isnan exists
14370set isnan d_isnan
14371eval $inlibc
14372
14373: see if isnanl exists
14374set isnanl d_isnanl
14375eval $inlibc
14376
14377: see if killpg exists
14378set killpg d_killpg
14379eval $inlibc
14380
14381: see if lchown exists
14382echo " "
14383$cat > try.c <<'EOCP'
14384/* System header to define __stub macros and hopefully few prototypes,
14385 which can conflict with char lchown(); below. */
14386#include <assert.h>
14387/* Override any gcc2 internal prototype to avoid an error. */
14388/* We use char because int might match the return type of a gcc2
14389 builtin and then its argument prototype would still apply. */
14390char lchown();
14391int main() {
14392 /* The GNU C library defines this for functions which it implements
14393 to always fail with ENOSYS. Some functions are actually named
14394 something starting with __ and the normal name is an alias. */
14395#if defined (__stub_lchown) || defined (__stub___lchown)
14396choke me
14397#else
14398lchown();
14399#endif
14400; return 0; }
14401EOCP
14402set try
14403if eval $compile; then
14404 $echo "lchown() found." >&4
14405 val="$define"
14406else
14407 $echo "lchown() NOT found." >&4
14408 val="$undef"
14409fi
14410set d_lchown
14411eval $setvar
14412
14413: See if number of significant digits in a double precision number is known
14414echo " "
14415$cat >ldbl_dig.c <<EOM
14416#$i_limits I_LIMITS
14417#$i_float I_FLOAT
14418#ifdef I_LIMITS
14419#include <limits.h>
14420#endif
14421#ifdef I_FLOAT
14422#include <float.h>
14423#endif
14424#ifdef LDBL_DIG
14425printf("Contains LDBL_DIG");
14426#endif
14427EOM
14428$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14429if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14430 echo "LDBL_DIG found." >&4
14431 val="$define"
14432else
14433 echo "LDBL_DIG NOT found." >&4
14434 val="$undef"
14435fi
14436$rm -f ldbl_dig.?
14437set d_ldbl_dig
14438eval $setvar
14439
a663fd0a
AT
14440: see if this is a math.h system
14441set math.h i_math
14442eval $inhdr
14443
14444d_libm_lib_version="$undef"
14445case $i_math in
14446 $define)
14447 : check to see if math.h defines _LIB_VERSION
14448 echo " "
14449 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14450 $cat >try.c <<EOCP
14451#include <unistd.h>
14452#include <math.h>
14453int main (int argc, char *argv[])
14454{
14455 printf ("%d\n", _LIB_VERSION);
14456 return (0);
14457 } /* main */
14458EOCP
14459 set try
14460 if eval $compile; then
14461 foo=`$run ./try`
14462 echo "Yes, it does ($foo)" >&4
14463 d_libm_lib_version="$define"
14464 else
14465 echo "No, it does not (probably harmless)\n" >&4
14466 fi
14467 $rm -f try.* try core core.try.*
14468 ;;
14469
14470 esac
14471
b4eb6b3d
JH
14472: see if link exists
14473set link d_link
14474eval $inlibc
14475
10bc17b6
JH
14476: see if localtime_r exists
14477set localtime_r d_localtime_r
14478eval $inlibc
14479case "$d_localtime_r" in
14480"$define")
d63eadf0 14481 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14482 case "$d_localtime_r_proto:$usethreads" in
14483 ":define") d_localtime_r_proto=define
a48ec845
JH
14484 set d_localtime_r_proto localtime_r $hdrs
14485 eval $hasproto ;;
14486 *) ;;
14487 esac
14488 case "$d_localtime_r_proto" in
14489 define)
10bc17b6
JH
14490 case "$localtime_r_proto" in
14491 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14492 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14493 esac
14494 case "$localtime_r_proto" in
14495 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14496 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14497 esac
14498 case "$localtime_r_proto" in
90e831dc 14499 ''|0) d_localtime_r=undef
10bc17b6 14500 localtime_r_proto=0
a48ec845 14501 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14502 * ) case "$localtime_r_proto" in
14503 REENTRANT_PROTO*) ;;
14504 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14505 esac
14506 echo "Prototype: $try" ;;
14507 esac
14508 ;;
c18e646a
JH
14509 *) case "$usethreads" in
14510 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14511 esac
90e831dc
SB
14512 d_localtime_r=undef
14513 localtime_r_proto=0
c18e646a 14514 ;;
a48ec845
JH
14515 esac
14516 ;;
10bc17b6
JH
14517*) localtime_r_proto=0
14518 ;;
14519esac
14520
b4eb6b3d
JH
14521: see if localeconv exists
14522set localeconv d_locconv
14523eval $inlibc
14524
14525: see if lockf exists
14526set lockf d_lockf
14527eval $inlibc
14528
b4eb6b3d
JH
14529: see if prototype for lseek is available
14530echo " "
4786929f 14531set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14532eval $hasproto
14533
14534: see if lstat exists
14535set lstat d_lstat
14536eval $inlibc
14537
14538: see if madvise exists
14539set madvise d_madvise
14540eval $inlibc
14541
1466f2fb
SP
14542: see if malloc_size exists
14543set malloc_size d_malloc_size
14544eval $inlibc
14545
14546: see if malloc_size_good exists
14547set malloc_good_size d_malloc_good_size
14548eval $inlibc
14549
b4eb6b3d
JH
14550: see if mblen exists
14551set mblen d_mblen
14552eval $inlibc
14553
14554: see if mbstowcs exists
14555set mbstowcs d_mbstowcs
14556eval $inlibc
14557
14558: see if mbtowc exists
14559set mbtowc d_mbtowc
14560eval $inlibc
14561
14562: see if memchr exists
14563set memchr d_memchr
14564eval $inlibc
14565
14566: see if memcmp exists
14567set memcmp d_memcmp
14568eval $inlibc
14569
14570: see if memcpy exists
14571set memcpy d_memcpy
14572eval $inlibc
14573
14574: see if memmove exists
14575set memmove d_memmove
14576eval $inlibc
14577
14578: see if memset exists
14579set memset d_memset
14580eval $inlibc
14581
14582: see if mkdir exists
14583set mkdir d_mkdir
14584eval $inlibc
14585
14586: see if mkdtemp exists
14587set mkdtemp d_mkdtemp
14588eval $inlibc
14589
14590: see if mkfifo exists
14591set mkfifo d_mkfifo
14592eval $inlibc
14593
14594: see if mkstemp exists
14595set mkstemp d_mkstemp
14596eval $inlibc
14597
14598: see if mkstemps exists
14599set mkstemps d_mkstemps
14600eval $inlibc
14601
14602: see if mktime exists
14603set mktime d_mktime
14604eval $inlibc
14605
14606: see if this is a sys/mman.h system
14607set sys/mman.h i_sysmman
14608eval $inhdr
14609
14610: see if mmap exists
14611set mmap d_mmap
14612eval $inlibc
14613: see what shmat returns
14614: default to something harmless
14615mmaptype='void *'
14616case "$i_sysmman$d_mmap" in
14617"$define$define")
14618 $cat >mmap.c <<'END'
14619#include <sys/mman.h>
14620void *mmap();
14621END
14622 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14623 mmaptype='void *'
14624 else
14625 mmaptype='caddr_t'
14626 fi
14627 echo "and it returns ($mmaptype)." >&4
14628 ;;
14629esac
14630
14631
14632
5a29c6bc
JH
14633: see if sqrtl exists
14634set sqrtl d_sqrtl
14635eval $inlibc
14636
f3479639
JH
14637: see if scalbnl exists
14638set scalbnl d_scalbnl
14639eval $inlibc
14640
5a29c6bc
JH
14641: see if modfl exists
14642set modfl d_modfl
14643eval $inlibc
14644
14645: see if prototype for modfl is available
14646echo " "
a663fd0a 14647set d_modflproto modfl $i_math math.h
5a29c6bc
JH
14648eval $hasproto
14649
14650d_modfl_pow32_bug="$undef"
14651
14652case "$d_longdbl$d_modfl" in
14653$define$define)
14654 $cat <<EOM
14655Checking to see whether your modfl() is okay for large values...
14656EOM
14657$cat >try.c <<EOCP
14658#include <math.h>
14659#include <stdio.h>
14660EOCP
14661if $test "X$d_modflproto" != "X$define"; then
14662 $cat >>try.c <<EOCP
14663/* Sigh. many current glibcs provide the function, but do not prototype it. */
14664long double modfl (long double, long double *);
14665EOCP
14666fi
14667$cat >>try.c <<EOCP
14668int main() {
14669 long double nv = 4294967303.15;
14670 long double v, w;
14671 v = modfl(nv, &w);
14672#ifdef __GLIBC__
14673 printf("glibc");
14674#endif
14675 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14676 return 0;
14677}
14678EOCP
14679 case "$osname:$gccversion" in
14680 aix:) saveccflags="$ccflags"
14681 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14682 esac
14683 set try
14684 if eval $compile; then
14685 foo=`$run ./try`
14686 case "$foo" in
14687 *" 4294967303.150000 1.150000 4294967302.000000")
14688 echo >&4 "Your modfl() is broken for large values."
14689 d_modfl_pow32_bug="$define"
14690 case "$foo" in
14691 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14692 ;;
14693 esac
14694 ;;
14695 *" 4294967303.150000 0.150000 4294967303.000000")
14696 echo >&4 "Your modfl() seems okay for large values."
14697 ;;
14698 *) echo >&4 "I don't understand your modfl() at all."
14699 d_modfl="$undef"
14700 ;;
14701 esac
14702 $rm -f try.* try core core.try.*
14703 else
14704 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14705 d_modfl="$undef"
14706 fi
14707 case "$osname:$gccversion" in
14708 aix:) ccflags="$saveccflags" ;; # restore
14709 esac
14710 ;;
14711esac
14712
14713if $test "$uselongdouble" = "$define"; then
f3479639
JH
14714 message=""
14715 if $test "$d_sqrtl" != "$define"; then
14716 message="$message sqrtl"
14717 fi
14718 if $test "$d_modfl" != "$define"; then
5a29c6bc
JH
14719 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14720 echo "You have both aintl and copysignl, so I can emulate modfl."
14721 else
f3479639 14722 message="$message modfl"
5a29c6bc 14723 fi
f3479639
JH
14724 fi
14725 if $test "$d_frexpl" != "$define"; then
14726 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14727 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14728 else
14729 message="$message frexpl"
14730 fi
14731 fi
5a29c6bc 14732
f3479639 14733 if $test "$message" != ""; then
5a29c6bc
JH
14734 $cat <<EOM >&4
14735
14736*** You requested the use of long doubles but you do not seem to have
f3479639
JH
14737*** the following mathematical functions needed for long double support:
14738*** $message
ff0950a8
JH
14739*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14740*** Cannot continue, aborting.
5a29c6bc
JH
14741
14742EOM
14743
ff0950a8 14744 exit 1
5a29c6bc
JH
14745 fi
14746fi
14747
b4eb6b3d
JH
14748: see if mprotect exists
14749set mprotect d_mprotect
14750eval $inlibc
14751
14752: see if msgctl exists
14753set msgctl d_msgctl
14754eval $inlibc
14755
14756: see if msgget exists
14757set msgget d_msgget
14758eval $inlibc
14759
14760: see if msgsnd exists
14761set msgsnd d_msgsnd
14762eval $inlibc
14763
14764: see if msgrcv exists
14765set msgrcv d_msgrcv
14766eval $inlibc
14767
14768: see how much of the 'msg*(2)' library is present.
14769h_msg=true
14770echo " "
14771case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14772*"$undef"*) h_msg=false;;
14773esac
14774case "$osname" in
14775freebsd)
14776 case "`ipcs 2>&1`" in
14777 "SVID messages"*"not configured"*)
14778 echo "Your $osname does not have the msg*(2) configured." >&4
14779 h_msg=false
14780 val="$undef"
14781 set msgctl d_msgctl
14782 eval $setvar
14783 set msgget d_msgget
14784 eval $setvar
14785 set msgsnd d_msgsnd
14786 eval $setvar
14787 set msgrcv d_msgrcv
14788 eval $setvar
14789 ;;
14790 esac
14791 ;;
14792esac
14793: we could also check for sys/ipc.h ...
14794if $h_msg && $test `./findhdr sys/msg.h`; then
14795 echo "You have the full msg*(2) library." >&4
14796 val="$define"
14797else
14798 echo "You don't have the full msg*(2) library." >&4
14799 val="$undef"
14800fi
14801set d_msg
14802eval $setvar
14803
4e0554ec
JH
14804
14805echo " "
14806echo "Checking to see if your system supports struct msghdr..." >&4
14807set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14808eval $hasstruct
14809case "$d_msghdr_s" in
14810"$define") echo "Yes, it does." ;;
14811*) echo "No, it doesn't." ;;
14812esac
14813
14814
b4eb6b3d
JH
14815: see if msync exists
14816set msync d_msync
14817eval $inlibc
14818
14819: see if munmap exists
14820set munmap d_munmap
14821eval $inlibc
14822
14823: see if nice exists
14824set nice d_nice
14825eval $inlibc
14826
2765b840
JH
14827: see if this is a langinfo.h system
14828set langinfo.h i_langinfo
14829eval $inhdr
14830
14831: see if nl_langinfo exists
14832set nl_langinfo d_nl_langinfo
14833eval $inlibc
14834
b4eb6b3d
JH
14835: check for length of character
14836echo " "
14837case "$charsize" in
14838'')
14839 echo "Checking to see how big your characters are (hey, you never know)..." >&4
ada8e391 14840 $cat >try.c <<EOCP
b4eb6b3d 14841#include <stdio.h>
5ed858ef
JH
14842#$i_stdlib I_STDLIB
14843#ifdef I_STDLIB
14844#include <stdlib.h>
14845#endif
b4eb6b3d
JH
14846int main()
14847{
14848 printf("%d\n", (int)sizeof(char));
14849 exit(0);
14850}
14851EOCP
14852 set try
14853 if eval $compile_ok; then
5440bc8e 14854 dflt=`$run ./try`
b4eb6b3d
JH
14855 else
14856 dflt='1'
14857 echo "(I can't seem to compile the test program. Guessing...)"
14858 fi
14859 ;;
14860*)
14861 dflt="$charsize"
14862 ;;
14863esac
14864rp="What is the size of a character (in bytes)?"
14865. ./myread
14866charsize="$ans"
14867$rm -f try.c try
14868
1d1be0dc
NC
14869: check for volatile keyword
14870echo " "
14871echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14872$cat >try.c <<'EOCP'
14873int main()
14874{
14875 typedef struct _goo_struct goo_struct;
14876 goo_struct * volatile goo = ((goo_struct *)0);
14877 struct _goo_struct {
14878 long long_int;
14879 int reg_int;
14880 char char_var;
14881 };
14882 typedef unsigned short foo_t;
14883 char *volatile foo;
14884 volatile int bar;
14885 volatile foo_t blech;
14886 foo = foo;
14887}
14888EOCP
14889if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14890 val="$define"
14891 echo "Yup, it does."
14892else
14893 val="$undef"
14894 echo "Nope, it doesn't."
14895fi
14896set d_volatile
14897eval $setvar
14898$rm -f try.*
14899
b4eb6b3d
JH
14900
14901echo " "
14902$echo "Choosing the C types to be used for Perl's internal types..." >&4
14903
14904case "$use64bitint:$d_quad:$quadtype" in
14905define:define:?*)
14906 ivtype="$quadtype"
14907 uvtype="$uquadtype"
14908 ivsize=8
14909 uvsize=8
14910 ;;
14911*) ivtype="long"
14912 uvtype="unsigned long"
14913 ivsize=$longsize
14914 uvsize=$longsize
14915 ;;
14916esac
14917
14918case "$uselongdouble:$d_longdbl" in
14919define:define)
14920 nvtype="long double"
14921 nvsize=$longdblsize
14922 ;;
14923*) nvtype=double
14924 nvsize=$doublesize
14925 ;;
14926esac
14927
14928$echo "(IV will be "$ivtype", $ivsize bytes)"
14929$echo "(UV will be "$uvtype", $uvsize bytes)"
14930$echo "(NV will be "$nvtype", $nvsize bytes)"
14931
14932$cat >try.c <<EOCP
14933#$i_inttypes I_INTTYPES
14934#ifdef I_INTTYPES
14935#include <inttypes.h>
14936#endif
14937#include <stdio.h>
14938int main() {
14939#ifdef INT8
14940 int8_t i = INT8_MAX;
14941 uint8_t u = UINT8_MAX;
14942 printf("int8_t\n");
14943#endif
14944#ifdef INT16
14945 int16_t i = INT16_MAX;
14946 uint16_t i = UINT16_MAX;
14947 printf("int16_t\n");
14948#endif
14949#ifdef INT32
14950 int32_t i = INT32_MAX;
14951 uint32_t u = UINT32_MAX;
14952 printf("int32_t\n");
14953#endif
14954}
14955EOCP
14956
14957case "$i8type" in
14958'') case "$charsize" in
14959 1) i8type=char
14960 u8type="unsigned char"
14961 i8size=$charsize
14962 u8size=$charsize
14963 ;;
14964 esac
14965 ;;
14966esac
14967case "$i8type" in
14968'') set try -DINT8
14969 if eval $compile; then
5440bc8e 14970 case "`$run ./try`" in
b4eb6b3d
JH
14971 int8_t) i8type=int8_t
14972 u8type=uint8_t
14973 i8size=1
14974 u8size=1
14975 ;;
14976 esac
14977 fi
14978 ;;
14979esac
14980case "$i8type" in
14981'') if $test $charsize -ge 1; then
14982 i8type=char
14983 u8type="unsigned char"
14984 i8size=$charsize
14985 u8size=$charsize
14986 fi
14987 ;;
14988esac
14989
14990case "$i16type" in
14991'') case "$shortsize" in
14992 2) i16type=short
14993 u16type="unsigned short"
14994 i16size=$shortsize
14995 u16size=$shortsize
14996 ;;
14997 esac
14998 ;;
14999esac
15000case "$i16type" in
15001'') set try -DINT16
15002 if eval $compile; then
5440bc8e 15003 case "`$run ./try`" in
b4eb6b3d
JH
15004 int16_t)
15005 i16type=int16_t
15006 u16type=uint16_t
15007 i16size=2
15008 u16size=2
15009 ;;
15010 esac
15011 fi
15012 ;;
15013esac
15014case "$i16type" in
15015'') if $test $shortsize -ge 2; then
15016 i16type=short
15017 u16type="unsigned short"
15018 i16size=$shortsize
15019 u16size=$shortsize
15020 fi
15021 ;;
15022esac
15023
15024case "$i32type" in
15025'') case "$longsize" in
15026 4) i32type=long
15027 u32type="unsigned long"
15028 i32size=$longsize
15029 u32size=$longsize
15030 ;;
15031 *) case "$intsize" in
15032 4) i32type=int
15033 u32type="unsigned int"
15034 i32size=$intsize
15035 u32size=$intsize
15036 ;;
15037 esac
15038 ;;
15039 esac
15040 ;;
15041esac
15042case "$i32type" in
15043'') set try -DINT32
15044 if eval $compile; then
5440bc8e 15045 case "`$run ./try`" in
b4eb6b3d
JH
15046 int32_t)
15047 i32type=int32_t
15048 u32type=uint32_t
15049 i32size=4
15050 u32size=4
15051 ;;
15052 esac
15053 fi
15054 ;;
15055esac
15056case "$i32type" in
15057'') if $test $intsize -ge 4; then
15058 i32type=int
15059 u32type="unsigned int"
15060 i32size=$intsize
15061 u32size=$intsize
15062 fi
15063 ;;
15064esac
15065
15066case "$i64type" in
15067'') case "$d_quad:$quadtype" in
15068 define:?*)
15069 i64type="$quadtype"
15070 u64type="$uquadtype"
15071 i64size=8
15072 u64size=8
15073 ;;
15074 esac
15075 ;;
15076esac
15077
1d1be0dc
NC
15078$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15079: volatile so that the compiler has to store it out to memory.
15080if test X"$d_volatile" = X"$define"; then
15081 volatile=volatile
15082fi
b4eb6b3d
JH
15083$cat <<EOP >try.c
15084#include <stdio.h>
5a29c6bc
JH
15085#$i_stdlib I_STDLIB
15086#ifdef I_STDLIB
15087#include <stdlib.h>
15088#endif
1d1be0dc
NC
15089#include <sys/types.h>
15090#include <signal.h>
15091#ifdef SIGFPE
15092$volatile int bletched = 0;
5f7d02a9 15093$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15094#endif
b4eb6b3d
JH
15095int main() {
15096 $uvtype u = 0;
1d1be0dc 15097 $nvtype d;
b4eb6b3d
JH
15098 int n = 8 * $uvsize;
15099 int i;
1d1be0dc
NC
15100#ifdef SIGFPE
15101 signal(SIGFPE, blech);
15102#endif
15103
b4eb6b3d
JH
15104 for (i = 0; i < n; i++) {
15105 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15106 d = ($nvtype)u;
15107 if (($uvtype)d != u)
b4eb6b3d 15108 break;
1d1be0dc
NC
15109 if (d <= 0)
15110 break;
15111 d = ($nvtype)(u - 1);
15112 if (($uvtype)d != (u - 1))
15113 break;
15114#ifdef SIGFPE
15115 if (bletched) {
15116 break;
15117#endif
15118 }
b4eb6b3d 15119 }
efd1522b 15120 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15121 exit(0);
15122}
15123EOP
1d1be0dc
NC
15124set try
15125
15126d_nv_preserves_uv="$undef"
15127if eval $compile; then
53133ed1 15128 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15129fi
53133ed1 15130case "$nv_preserves_uv_bits" in
1d1be0dc 15131\-[1-9]*)
53133ed1
NC
15132 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15133 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15134 d_nv_preserves_uv="$define"
b4eb6b3d 15135 ;;
53133ed1 15136[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15137 d_nv_preserves_uv="$undef" ;;
15138*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 15139 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
15140esac
15141
1d1be0dc
NC
15142$rm -f try.* try
15143
4a989ed6
CB
15144$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15145: volatile so that the compiler has to store it out to memory.
15146if test X"$d_volatile" = X"$define"; then
15147 volatile=volatile
15148fi
15149$cat <<EOP >try.c
15150#include <stdio.h>
15151#$i_stdlib I_STDLIB
15152#ifdef I_STDLIB
15153#include <stdlib.h>
15154#endif
15155#$i_string I_STRING
15156#ifdef I_STRING
15157# include <string.h>
15158#else
15159# include <strings.h>
15160#endif
15161#include <sys/types.h>
15162#include <signal.h>
15163#ifdef SIGFPE
15164$volatile int bletched = 0;
5f7d02a9 15165$signal_t blech(int s) { bletched = 1; }
4a989ed6
CB
15166#endif
15167
15168int checkit($nvtype d, char *where) {
15169 unsigned char *p = (char *)&d;
15170 unsigned char *end = p + sizeof(d);
15171 int fail = 0;
15172
15173 while (p < end)
15174 fail += *p++;
15175
15176 if (!fail)
15177 return 0;
15178
15179 p = (char *)&d;
15180 printf("No - %s: 0x", where);
15181 while (p < end)
15182 printf ("%02X", *p++);
15183 printf("\n");
15184 return 1;
15185}
15186
15187int main(int argc, char **argv) {
15188 $nvtype d = 0.0;
15189 int fail = 0;
15190 fail += checkit(d, "0.0");
15191
15192 /* The compiler shouldn't be assuming that bletched is 0 */
15193 d = bletched;
15194
15195 fail += checkit(d, "bleched");
15196
15197#ifdef SIGFPE
15198 signal(SIGFPE, blech);
15199#endif
15200
15201 /* Paranoia - the compiler should have no way of knowing that ANSI says
15202 that argv[argc] will always be NULL. Actually, if it did assume this it
15203 would be buggy, as this is C and main() can be called from elsewhere in
15204 the program. */
15205 d = argv[argc] ? 1 : 0;
15206
15207 if (d) {
15208 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15209 }
15210
15211 fail += checkit(d, "ternary");
15212
15213 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15214
15215 if (d != 0.0) {
15216 printf("No - memset doesn't give 0.0\n");
15217 /* This might just blow up: */
15218 printf("(gives %g)\n", d);
15219 return 1;
15220 }
15221
15222#ifdef SIGFPE
15223 if (bletched) {
15224 printf("No - something bleched\n");
15225 return 1;
15226 }
15227#endif
15228 if (fail) {
15229 printf("No - %d fail(s)\n", fail);
15230 return 1;
15231 }
15232 printf("Yes\n");
15233 return 0;
15234}
15235EOP
15236set try
15237
15238d_nv_zero_is_allbits_zero="$undef"
15239if eval $compile; then
15240 xxx="`$run ./try`"
15241 case "$?" in
15242 0)
15243 case "$xxx" in
15244 Yes) cat >&4 <<EOM
152450.0 is represented as all bits zero in memory
15246EOM
15247 d_nv_zero_is_allbits_zero="$define"
15248 ;;
15249 *) cat >&4 <<EOM
152500.0 is not represented as all bits zero in memory
15251EOM
15252 d_nv_zero_is_allbits_zero="$undef"
15253 ;;
15254 esac
15255 ;;
15256 *) cat >&4 <<EOM
152570.0 is not represented as all bits zero in memory
15258EOM
15259 d_nv_zero_is_allbits_zero="$undef"
15260 ;;
15261 esac
15262fi
15263
15264$rm -f try.* try
15265
b4eb6b3d
JH
15266
15267: check for off64_t
15268echo " "
15269echo "Checking to see if you have off64_t..." >&4
15270$cat >try.c <<EOCP
15271#include <sys/types.h>
15272#include <unistd.h>
15273int main() { off64_t x = 7; }
15274EOCP
15275set try
15276if eval $compile; then
15277 val="$define"
15278 echo "You have off64_t."
15279else
15280 val="$undef"
15281 echo "You do not have off64_t."
15282 case "$lseeksize" in
15283 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15284 esac
15285fi
15286$rm -f try.* try
15287set d_off64_t
15288eval $setvar
15289
b4eb6b3d
JH
15290: how to create joinable pthreads
15291if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15292 echo " "
15293 echo "Checking what constant to use for creating joinable pthreads..." >&4
15294 $cat >try.c <<'EOCP'
15295#include <pthread.h>
15296int main() {
15297 int detachstate = JOINABLE;
15298}
15299EOCP
15300 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15301 if eval $compile; then
15302 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15303 val="$undef" # Yes, undef.
15304 set d_old_pthread_create_joinable
15305 eval $setvar
15306 val=""
15307 set old_pthread_create_joinable
15308 eval $setvar
15309 else
15310 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15311 if eval $compile; then
15312 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15313 val="$define"
15314 set d_old_pthread_create_joinable
15315 eval $setvar
15316 val=PTHREAD_CREATE_UNDETACHED
15317 set old_pthread_create_joinable
15318 eval $setvar
15319 else
15320 set try -DJOINABLE=__UNDETACHED
15321 if eval $compile; then
15322 echo "You seem to use __UNDETACHED." >&4
15323 val="$define"
15324 set d_old_pthread_create_joinable
15325 eval $setvar
15326 val=__UNDETACHED
15327 set old_pthread_create_joinable
15328 eval $setvar
15329 else
15330 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15331 val="$define"
15332 set d_old_pthread_create_joinable
15333 eval $setvar
15334 val=0
15335 set old_pthread_create_joinable
15336 eval $setvar
15337 fi
15338 fi
15339 fi
15340 $rm -f try try.*
15341else
15342 d_old_pthread_create_joinable="$undef"
15343 old_pthread_create_joinable=""
15344fi
15345
15346: see if pause exists
15347set pause d_pause
15348eval $inlibc
15349
15350: see if pipe exists
15351set pipe d_pipe
15352eval $inlibc
15353
15354: see if poll exists
15355set poll d_poll
15356eval $inlibc
15357
c7aff470
NIS
15358: see if readlink exists
15359set readlink d_readlink
15360eval $inlibc
15361
15362echo " "
f24dbf84 15363procselfexe=''
c7aff470 15364val="$undef"
a33c94aa
JH
15365case "$d_readlink" in
15366"$define")
c7aff470
NIS
15367 if $issymlink /proc/self/exe ; then
15368 $ls -l /proc/self/exe > reflect
51660ed5 15369 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15370 echo "You have Linux-like /proc/self/exe."
92236451 15371 procselfexe='"/proc/self/exe"'
f24dbf84 15372 val="$define"
f24dbf84
JH
15373 fi
15374 fi
15375 if $issymlink /proc/curproc/file ; then
15376 $ls -l /proc/curproc/file > reflect
15377 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15378 echo "You have BSD-like /proc/curproc/file."
92236451 15379 procselfexe='"/proc/curproc/file"'
f24dbf84 15380 val="$define"
c7aff470 15381 fi
c7aff470 15382 fi
a33c94aa
JH
15383 ;;
15384esac
428dc699 15385$rm -f reflect
c7aff470
NIS
15386set d_procselfexe
15387eval $setvar
15388
263fee3f
JH
15389: see whether the pthread_atfork exists
15390$cat >try.c <<EOP
15391#include <pthread.h>
15392#include <stdio.h>
15393int main() {
15394#ifdef PTHREAD_ATFORK
15395 pthread_atfork(NULL,NULL,NULL);
15396#endif
15397}
15398EOP
15399
d6483fcc 15400: see if pthread_atfork exists
263fee3f
JH
15401set try -DPTHREAD_ATFORK
15402if eval $compile; then
15403 val="$define"
15404else
15405 val="$undef"
15406fi
15407case "$usethreads" in
15408$define)
15409 case "$val" in
15410 $define) echo 'pthread_atfork found.' >&4 ;;
15411 *) echo 'pthread_atfork NOT found.' >&4 ;;
15412 esac
15413esac
15414set d_pthread_atfork
15415eval $setvar
d6483fcc 15416
16c773f9
JH
15417: see if pthread_attr_setscope exists
15418set pthread_attr_setscope d_pthread_attr_setscope
15419eval $inlibc
15420
b4eb6b3d
JH
15421
15422: see whether the various POSIXish _yields exist
15423$cat >try.c <<EOP
15424#include <pthread.h>
15425#include <stdio.h>
15426int main() {
15427#ifdef SCHED_YIELD
15428 sched_yield();
15429#else
15430#ifdef PTHREAD_YIELD
15431 pthread_yield();
15432#else
15433#ifdef PTHREAD_YIELD_NULL
15434 pthread_yield(NULL);
15435#endif
15436#endif
15437#endif
15438}
15439EOP
15440: see if sched_yield exists
15441set try -DSCHED_YIELD
15442if eval $compile; then
15443 val="$define"
15444 sched_yield='sched_yield()'
15445else
15446 val="$undef"
15447fi
15448case "$usethreads" in
15449$define)
15450 case "$val" in
15451 $define) echo 'sched_yield() found.' >&4 ;;
15452 *) echo 'sched_yield() NOT found.' >&4 ;;
15453 esac
15454esac
10bc17b6
JH
15455set d_sched_yield
15456eval $setvar
b4eb6b3d 15457
10bc17b6
JH
15458: see if pthread_yield exists
15459set try -DPTHREAD_YIELD
15460if eval $compile; then
15461 val="$define"
15462 case "$sched_yield" in
15463 '') sched_yield='pthread_yield()' ;;
15464 esac
15465else
15466 set try -DPTHREAD_YIELD_NULL
15467 if eval $compile; then
15468 val="$define"
15469 case "$sched_yield" in
15470 '') sched_yield='pthread_yield(NULL)' ;;
15471 esac
15472 else
15473 val="$undef"
15474 fi
15475fi
15476case "$usethreads" in
15477$define)
15478 case "$val" in
15479 $define) echo 'pthread_yield() found.' >&4 ;;
15480 *) echo 'pthread_yield() NOT found.' >&4 ;;
15481 esac
15482 ;;
15483esac
15484set d_pthread_yield
15485eval $setvar
b4eb6b3d 15486
10bc17b6
JH
15487case "$sched_yield" in
15488'') sched_yield=undef ;;
15489esac
b4eb6b3d 15490
10bc17b6
JH
15491$rm -f try try.*
15492
15493: see if random_r exists
15494set random_r d_random_r
15495eval $inlibc
15496case "$d_random_r" in
15497"$define")
15498 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15499 case "$d_random_r_proto:$usethreads" in
15500 ":define") d_random_r_proto=define
a48ec845
JH
15501 set d_random_r_proto random_r $hdrs
15502 eval $hasproto ;;
15503 *) ;;
15504 esac
15505 case "$d_random_r_proto" in
15506 define)
10bc17b6
JH
15507 case "$random_r_proto" in
15508 ''|0) try='int random_r(int*, struct random_data*);'
c71a3471
JH
15509 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15510 esac
15511 case "$random_r_proto" in
15512 ''|0) try='int random_r(long*, struct random_data*);'
15513 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15514 esac
15515 case "$random_r_proto" in
15516 ''|0) try='int random_r(struct random_data*, int32_t*);'
15517 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15518 esac
15519 case "$random_r_proto" in
90e831dc 15520 ''|0) d_random_r=undef
10bc17b6 15521 random_r_proto=0
a48ec845 15522 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15523 * ) case "$random_r_proto" in
15524 REENTRANT_PROTO*) ;;
15525 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15526 esac
15527 echo "Prototype: $try" ;;
15528 esac
b4eb6b3d 15529 ;;
c18e646a
JH
15530 *) case "$usethreads" in
15531 define) echo "random_r has no prototype, not using it." >&4 ;;
15532 esac
90e831dc
SB
15533 d_random_r=undef
15534 random_r_proto=0
c18e646a 15535 ;;
a48ec845
JH
15536 esac
15537 ;;
10bc17b6 15538*) random_r_proto=0
b4eb6b3d
JH
15539 ;;
15540esac
15541
15542: see if readdir and friends exist
15543set readdir d_readdir
15544eval $inlibc
15545set seekdir d_seekdir
15546eval $inlibc
15547set telldir d_telldir
15548eval $inlibc
15549set rewinddir d_rewinddir
15550eval $inlibc
15551
10bc17b6
JH
15552: see if readdir64_r exists
15553set readdir64_r d_readdir64_r
15554eval $inlibc
15555case "$d_readdir64_r" in
15556"$define")
15557 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15558 case "$d_readdir64_r_proto:$usethreads" in
15559 ":define") d_readdir64_r_proto=define
a48ec845
JH
15560 set d_readdir64_r_proto readdir64_r $hdrs
15561 eval $hasproto ;;
15562 *) ;;
15563 esac
15564 case "$d_readdir64_r_proto" in
15565 define)
10bc17b6
JH
15566 case "$readdir64_r_proto" in
15567 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15568 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15569 esac
15570 case "$readdir64_r_proto" in
15571 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15572 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15573 esac
15574 case "$readdir64_r_proto" in
90e831dc 15575 ''|0) d_readdir64_r=undef
10bc17b6 15576 readdir64_r_proto=0
a48ec845 15577 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15578 * ) case "$readdir64_r_proto" in
15579 REENTRANT_PROTO*) ;;
15580 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15581 esac
15582 echo "Prototype: $try" ;;
15583 esac
15584 ;;
c18e646a
JH
15585 *) case "$usethreads" in
15586 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15587 esac
90e831dc
SB
15588 d_readdir64_r=undef
15589 readdir64_r_proto=0
c18e646a 15590 ;;
a48ec845
JH
15591 esac
15592 ;;
10bc17b6
JH
15593*) readdir64_r_proto=0
15594 ;;
15595esac
15596
15597: see if readdir_r exists
15598set readdir_r d_readdir_r
15599eval $inlibc
15600case "$d_readdir_r" in
15601"$define")
15602 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15603 case "$d_readdir_r_proto:$usethreads" in
15604 ":define") d_readdir_r_proto=define
a48ec845
JH
15605 set d_readdir_r_proto readdir_r $hdrs
15606 eval $hasproto ;;
15607 *) ;;
15608 esac
15609 case "$d_readdir_r_proto" in
15610 define)
10bc17b6
JH
15611 case "$readdir_r_proto" in
15612 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15613 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15614 esac
15615 case "$readdir_r_proto" in
15616 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15617 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15618 esac
15619 case "$readdir_r_proto" in
90e831dc 15620 ''|0) d_readdir_r=undef
10bc17b6 15621 readdir_r_proto=0
a48ec845 15622 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15623 * ) case "$readdir_r_proto" in
15624 REENTRANT_PROTO*) ;;
15625 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15626 esac
15627 echo "Prototype: $try" ;;
15628 esac
15629 ;;
c18e646a
JH
15630 *) case "$usethreads" in
15631 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15632 esac
90e831dc
SB
15633 d_readdir_r=undef
15634 readdir_r_proto=0
c18e646a 15635 ;;
a48ec845
JH
15636 esac
15637 ;;
10bc17b6
JH
15638*) readdir_r_proto=0
15639 ;;
15640esac
15641
4e0554ec
JH
15642: see if readv exists
15643set readv d_readv
15644eval $inlibc
15645
15646: see if recvmsg exists
15647set recvmsg d_recvmsg
15648eval $inlibc
15649
b4eb6b3d
JH
15650: see if rename exists
15651set rename d_rename
15652eval $inlibc
15653
15654: see if rmdir exists
15655set rmdir d_rmdir
15656eval $inlibc
15657
15658: see if memory.h is available.
15659val=''
15660set memory.h val
15661eval $inhdr
15662
15663: See if it conflicts with string.h
15664case "$val" in
15665$define)
15666 case "$strings" in
15667 '') ;;
15668 *)
15669 $cppstdin $cppflags $cppminus < $strings > mem.h
15670 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15671 echo " "
15672 echo "We won't be including <memory.h>."
15673 val="$undef"
15674 fi
15675 $rm -f mem.h
15676 ;;
15677 esac
15678esac
15679set i_memory
15680eval $setvar
15681
15682: can bcopy handle overlapping blocks?
b6cc3bc4 15683echo " "
b4eb6b3d 15684val="$undef"
b6cc3bc4
AD
15685case "$d_memmove" in
15686"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15687*) case "$d_bcopy" in
15688 "$define")
15689 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15690 $cat >try.c <<EOCP
b4eb6b3d
JH
15691#$i_memory I_MEMORY
15692#$i_stdlib I_STDLIB
15693#$i_string I_STRING
15694#$i_unistd I_UNISTD
15695EOCP
15696 $cat >>try.c <<'EOCP'
15697#include <stdio.h>
15698#ifdef I_MEMORY
15699# include <memory.h>
15700#endif
15701#ifdef I_STDLIB
15702# include <stdlib.h>
15703#endif
15704#ifdef I_STRING
15705# include <string.h>
15706#else
15707# include <strings.h>
15708#endif
15709#ifdef I_UNISTD
15710# include <unistd.h> /* Needed for NetBSD */
15711#endif
15712int main()
15713{
15714char buf[128], abc[128];
15715char *b;
15716int len;
15717int off;
15718int align;
15719
b6cc3bc4
AD
15720/* Copy "abcde..." string to char abc[] so that gcc doesn't
15721 try to store the string in read-only memory. */
b4eb6b3d
JH
15722bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15723
15724for (align = 7; align >= 0; align--) {
15725 for (len = 36; len; len--) {
15726 b = buf+align;
15727 bcopy(abc, b, len);
15728 for (off = 1; off <= len; off++) {
15729 bcopy(b, b+off, len);
15730 bcopy(b+off, b, len);
15731 if (bcmp(b, abc, len))
15732 exit(1);
15733 }
15734 }
15735}
15736exit(0);
15737}
15738EOCP
b6cc3bc4
AD
15739 set try
15740 if eval $compile_ok; then
15741 if ./try 2>/dev/null; then
15742 echo "Yes, it can."
15743 val="$define"
15744 else
15745 echo "It can't, sorry."
15746 fi
b4eb6b3d 15747 else
b6cc3bc4 15748 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15749 fi
b6cc3bc4
AD
15750 ;;
15751 esac
15752 $rm -f try.* try core
b4eb6b3d
JH
15753 ;;
15754esac
b4eb6b3d
JH
15755set d_safebcpy
15756eval $setvar
15757
15758: can memcpy handle overlapping blocks?
b6cc3bc4 15759echo " "
b4eb6b3d 15760val="$undef"
b6cc3bc4
AD
15761case "$d_memmove" in
15762"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15763*) case "$d_memcpy" in
15764 "$define")
15765 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15766 $cat >try.c <<EOCP
b4eb6b3d
JH
15767#$i_memory I_MEMORY
15768#$i_stdlib I_STDLIB
15769#$i_string I_STRING
15770#$i_unistd I_UNISTD
15771EOCP
15772 $cat >>try.c <<'EOCP'
15773#include <stdio.h>
15774#ifdef I_MEMORY
15775# include <memory.h>
15776#endif
15777#ifdef I_STDLIB
15778# include <stdlib.h>
15779#endif
15780#ifdef I_STRING
15781# include <string.h>
15782#else
15783# include <strings.h>
15784#endif
15785#ifdef I_UNISTD
15786# include <unistd.h> /* Needed for NetBSD */
15787#endif
15788int main()
15789{
15790char buf[128], abc[128];
15791char *b;
15792int len;
15793int off;
15794int align;
15795
15796/* Copy "abcde..." string to char abc[] so that gcc doesn't
15797 try to store the string in read-only memory. */
15798memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15799
15800for (align = 7; align >= 0; align--) {
15801 for (len = 36; len; len--) {
15802 b = buf+align;
15803 memcpy(b, abc, len);
15804 for (off = 1; off <= len; off++) {
15805 memcpy(b+off, b, len);
15806 memcpy(b, b+off, len);
15807 if (memcmp(b, abc, len))
15808 exit(1);
15809 }
15810 }
15811}
15812exit(0);
15813}
15814EOCP
b6cc3bc4
AD
15815 set try
15816 if eval $compile_ok; then
15817 if ./try 2>/dev/null; then
15818 echo "Yes, it can."
15819 val="$define"
15820 else
15821 echo "It can't, sorry."
15822 fi
b4eb6b3d 15823 else
b6cc3bc4 15824 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15825 fi
b6cc3bc4
AD
15826 ;;
15827 esac
15828 $rm -f try.* try core
b4eb6b3d
JH
15829 ;;
15830esac
b4eb6b3d
JH
15831set d_safemcpy
15832eval $setvar
15833
15834: can memcmp be trusted to compare relative magnitude?
15835val="$undef"
15836case "$d_memcmp" in
15837"$define")
15838 echo " "
15839 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15840 $cat >try.c <<EOCP
15841#$i_memory I_MEMORY
15842#$i_stdlib I_STDLIB
15843#$i_string I_STRING
15844#$i_unistd I_UNISTD
15845EOCP
15846 $cat >>try.c <<'EOCP'
15847#include <stdio.h>
15848#ifdef I_MEMORY
15849# include <memory.h>
15850#endif
15851#ifdef I_STDLIB
15852# include <stdlib.h>
15853#endif
15854#ifdef I_STRING
15855# include <string.h>
15856#else
15857# include <strings.h>
15858#endif
15859#ifdef I_UNISTD
15860# include <unistd.h> /* Needed for NetBSD */
15861#endif
15862int main()
15863{
15864char a = -1;
15865char b = 0;
15866if ((a < b) && memcmp(&a, &b, 1) < 0)
15867 exit(1);
15868exit(0);
15869}
15870EOCP
15871 set try
15872 if eval $compile_ok; then
5440bc8e 15873 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15874 echo "Yes, it can."
15875 val="$define"
15876 else
15877 echo "No, it can't (it uses signed chars)."
15878 fi
15879 else
15880 echo "(I can't compile the test program, so we'll assume not...)"
15881 fi
15882 ;;
15883esac
15884$rm -f try.* try core
15885set d_sanemcmp
15886eval $setvar
15887
ef9f17be
JH
15888: see if prototype for sbrk is available
15889echo " "
15890set d_sbrkproto sbrk $i_unistd unistd.h
15891eval $hasproto
15892
b4eb6b3d
JH
15893: see if select exists
15894set select d_select
15895eval $inlibc
15896
15897: see if semctl exists
15898set semctl d_semctl
15899eval $inlibc
15900
15901: see if semget exists
15902set semget d_semget
15903eval $inlibc
15904
15905: see if semop exists
15906set semop d_semop
15907eval $inlibc
15908
15909: see how much of the 'sem*(2)' library is present.
15910h_sem=true
15911echo " "
15912case "$d_semctl$d_semget$d_semop" in
15913*"$undef"*) h_sem=false;;
15914esac
15915case "$osname" in
15916freebsd)
15917 case "`ipcs 2>&1`" in
15918 "SVID messages"*"not configured"*)
15919 echo "Your $osname does not have the sem*(2) configured." >&4
15920 h_sem=false
15921 val="$undef"
15922 set semctl d_semctl
15923 eval $setvar
15924 set semget d_semget
15925 eval $setvar
15926 set semop d_semop
15927 eval $setvar
15928 ;;
15929 esac
15930 ;;
15931esac
15932: we could also check for sys/ipc.h ...
15933if $h_sem && $test `./findhdr sys/sem.h`; then
15934 echo "You have the full sem*(2) library." >&4
15935 val="$define"
15936else
15937 echo "You don't have the full sem*(2) library." >&4
15938 val="$undef"
15939fi
15940set d_sem
15941eval $setvar
15942
15943: see whether sys/sem.h defines union semun
15944echo " "
15945$cat > try.c <<'END'
15946#include <sys/types.h>
15947#include <sys/ipc.h>
15948#include <sys/sem.h>
15949int main () { union semun semun; semun.buf = 0; }
15950END
15951set try
15952if eval $compile; then
15953 echo "You have union semun in <sys/sem.h>." >&4
15954 val="$define"
15955else
15956 echo "You do not have union semun in <sys/sem.h>." >&4
15957 val="$undef"
15958fi
c9569057 15959$rm -f try try.c
b4eb6b3d
JH
15960set d_union_semun
15961eval $setvar
15962
15963: see how to do semctl IPC_STAT
15964case "$d_sem" in
15965$define)
b4eb6b3d
JH
15966 echo " "
15967 $cat > try.h <<END
15968#ifndef S_IRUSR
15969# ifdef S_IREAD
15970# define S_IRUSR S_IREAD
15971# define S_IWUSR S_IWRITE
15972# define S_IXUSR S_IEXEC
15973# else
15974# define S_IRUSR 0400
15975# define S_IWUSR 0200
15976# define S_IXUSR 0100
15977# endif
15978# define S_IRGRP (S_IRUSR>>3)
15979# define S_IWGRP (S_IWUSR>>3)
15980# define S_IXGRP (S_IXUSR>>3)
15981# define S_IROTH (S_IRUSR>>6)
15982# define S_IWOTH (S_IWUSR>>6)
15983# define S_IXOTH (S_IXUSR>>6)
15984#endif
15985#ifndef S_IRWXU
15986# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15987# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15988# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15989#endif
15990END
c9569057 15991 : see whether semctl IPC_STAT can use union semun
c9569057
PP
15992 case "$d_semctl_semun" in
15993 '')
d1766b33 15994 val="$undef"
c9569057 15995 $cat > try.c <<END
b4eb6b3d
JH
15996#include <sys/types.h>
15997#include <sys/ipc.h>
15998#include <sys/sem.h>
15999#include <sys/stat.h>
16000#include <stdio.h>
16001#include <errno.h>
16002#include "try.h"
16003#ifndef errno
16004extern int errno;
16005#endif
16006#$d_union_semun HAS_UNION_SEMUN
16007int main() {
16008 union semun
16009#ifndef HAS_UNION_SEMUN
16010 {
16011 int val;
16012 struct semid_ds *buf;
16013 unsigned short *array;
16014 }
16015#endif
16016 arg;
16017 int sem, st;
16018
16019#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16020 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16021 if (sem > -1) {
16022 struct semid_ds argbuf;
16023 arg.buf = &argbuf;
16024# ifdef IPC_STAT
16025 st = semctl(sem, 0, IPC_STAT, arg);
16026 if (st == 0)
16027 printf("semun\n");
16028 else
16029# endif /* IPC_STAT */
16030 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16031# ifdef IPC_RMID
16032 if (semctl(sem, 0, IPC_RMID, arg) != 0)
d1766b33 16033# endif /* IPC_RMID */
b4eb6b3d
JH
16034 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16035 } else
16036#endif /* IPC_PRIVATE && ... */
16037 printf("semget failed: errno = %d\n", errno);
16038 return 0;
16039}
16040END
c9569057
PP
16041 set try
16042 if eval $compile; then
16043 xxx=`$run ./try`
16044 case "$xxx" in
16045 semun) val="$define" ;;
16046 esac
16047 fi
16048 $rm -f try try.c
d1766b33
NC
16049 set d_semctl_semun
16050 eval $setvar
c9569057
PP
16051 ;;
16052 esac
b4eb6b3d
JH
16053 case "$d_semctl_semun" in
16054 $define)
16055 echo "You can use union semun for semctl IPC_STAT." >&4
16056 also='also'
16057 ;;
16058 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16059 also=''
16060 ;;
16061 esac
16062
16063 : see whether semctl IPC_STAT can use struct semid_ds pointer
c9569057
PP
16064 case "$d_semctl_semid_ds" in
16065 '')
d1766b33 16066 val="$undef"
c9569057 16067 $cat > try.c <<'END'
b4eb6b3d
JH
16068#include <sys/types.h>
16069#include <sys/ipc.h>
16070#include <sys/sem.h>
16071#include <sys/stat.h>
16072#include "try.h"
16073#include <stdio.h>
16074#include <errno.h>
16075#ifndef errno
16076extern int errno;
16077#endif
16078int main() {
16079 struct semid_ds arg;
16080 int sem, st;
16081
16082#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16083 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16084 if (sem > -1) {
16085# ifdef IPC_STAT
16086 st = semctl(sem, 0, IPC_STAT, &arg);
16087 if (st == 0)
16088 printf("semid_ds\n");
16089 else
16090# endif /* IPC_STAT */
16091 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16092# ifdef IPC_RMID
16093 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16094# endif /* IPC_RMID */
16095 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16096 } else
16097#endif /* IPC_PRIVATE && ... */
16098 printf("semget failed: errno = %d\n", errno);
16099
16100 return 0;
16101}
16102END
c9569057
PP
16103 set try
16104 if eval $compile; then
16105 xxx=`$run ./try`
16106 case "$xxx" in
16107 semid_ds) val="$define" ;;
16108 esac
16109 fi
16110 $rm -f try try.c
d1766b33
NC
16111 set d_semctl_semid_ds
16112 eval $setvar
c9569057
PP
16113 ;;
16114 esac
b4eb6b3d
JH
16115 case "$d_semctl_semid_ds" in
16116 $define)
16117 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16118 ;;
16119 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16120 ;;
16121 esac
16122 $rm -f try.h
16123 ;;
16124*) val="$undef"
16125
16126 # We do not have the full sem*(2) library, so assume we can not
16127 # use either.
16128
16129 set d_semctl_semun
16130 eval $setvar
16131
16132 set d_semctl_semid_ds
16133 eval $setvar
16134 ;;
16135esac
16136
4e0554ec
JH
16137: see if sendmsg exists
16138set sendmsg d_sendmsg
16139eval $inlibc
16140
b4eb6b3d
JH
16141: see if setegid exists
16142set setegid d_setegid
16143eval $inlibc
16144
16145: see if seteuid exists
16146set seteuid d_seteuid
16147eval $inlibc
16148
16149: see if setgrent exists
16150set setgrent d_setgrent
16151eval $inlibc
16152
10bc17b6
JH
16153: see if setgrent_r exists
16154set setgrent_r d_setgrent_r
16155eval $inlibc
16156case "$d_setgrent_r" in
16157"$define")
16158 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16159 case "$d_setgrent_r_proto:$usethreads" in
16160 ":define") d_setgrent_r_proto=define
a48ec845
JH
16161 set d_setgrent_r_proto setgrent_r $hdrs
16162 eval $hasproto ;;
16163 *) ;;
16164 esac
16165 case "$d_setgrent_r_proto" in
16166 define)
10bc17b6
JH
16167 case "$setgrent_r_proto" in
16168 ''|0) try='int setgrent_r(FILE**);'
16169 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16170 esac
16171 case "$setgrent_r_proto" in
16172 ''|0) try='void setgrent_r(FILE**);'
16173 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16174 esac
16175 case "$setgrent_r_proto" in
90e831dc 16176 ''|0) d_setgrent_r=undef
10bc17b6 16177 setgrent_r_proto=0
a48ec845 16178 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16179 * ) case "$setgrent_r_proto" in
16180 REENTRANT_PROTO*) ;;
16181 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16182 esac
16183 echo "Prototype: $try" ;;
16184 esac
16185 ;;
c18e646a
JH
16186 *) case "$usethreads" in
16187 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16188 esac
90e831dc
SB
16189 d_setgrent_r=undef
16190 setgrent_r_proto=0
c18e646a 16191 ;;
a48ec845
JH
16192 esac
16193 ;;
10bc17b6
JH
16194*) setgrent_r_proto=0
16195 ;;
16196esac
16197
b4eb6b3d
JH
16198: see if sethostent exists
16199set sethostent d_sethent
16200eval $inlibc
16201
10bc17b6
JH
16202: see if sethostent_r exists
16203set sethostent_r d_sethostent_r
16204eval $inlibc
16205case "$d_sethostent_r" in
16206"$define")
16207 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16208 case "$d_sethostent_r_proto:$usethreads" in
16209 ":define") d_sethostent_r_proto=define
a48ec845
JH
16210 set d_sethostent_r_proto sethostent_r $hdrs
16211 eval $hasproto ;;
16212 *) ;;
16213 esac
16214 case "$d_sethostent_r_proto" in
16215 define)
10bc17b6
JH
16216 case "$sethostent_r_proto" in
16217 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16218 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16219 esac
16220 case "$sethostent_r_proto" in
16221 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16222 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16223 esac
16224 case "$sethostent_r_proto" in
90e831dc 16225 ''|0) d_sethostent_r=undef
10bc17b6 16226 sethostent_r_proto=0
a48ec845 16227 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16228 * ) case "$sethostent_r_proto" in
16229 REENTRANT_PROTO*) ;;
16230 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16231 esac
16232 echo "Prototype: $try" ;;
16233 esac
16234 ;;
c18e646a
JH
16235 *) case "$usethreads" in
16236 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16237 esac
90e831dc
SB
16238 d_sethostent_r=undef
16239 sethostent_r_proto=0
c18e646a 16240 ;;
a48ec845
JH
16241 esac
16242 ;;
10bc17b6
JH
16243*) sethostent_r_proto=0
16244 ;;
16245esac
16246
4e0554ec
JH
16247: see if setitimer exists
16248set setitimer d_setitimer
16249eval $inlibc
16250
b4eb6b3d
JH
16251: see if setlinebuf exists
16252set setlinebuf d_setlinebuf
16253eval $inlibc
16254
16255: see if setlocale exists
16256set setlocale d_setlocale
16257eval $inlibc
16258
10bc17b6
JH
16259: see if locale.h is available
16260set locale.h i_locale
16261eval $inhdr
16262
16263: see if setlocale_r exists
16264set setlocale_r d_setlocale_r
16265eval $inlibc
16266case "$d_setlocale_r" in
16267"$define")
16268 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16269 case "$d_setlocale_r_proto:$usethreads" in
16270 ":define") d_setlocale_r_proto=define
a48ec845
JH
16271 set d_setlocale_r_proto setlocale_r $hdrs
16272 eval $hasproto ;;
16273 *) ;;
16274 esac
16275 case "$d_setlocale_r_proto" in
16276 define)
10bc17b6
JH
16277 case "$setlocale_r_proto" in
16278 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16279 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16280 esac
16281 case "$setlocale_r_proto" in
90e831dc 16282 ''|0) d_setlocale_r=undef
10bc17b6 16283 setlocale_r_proto=0
a48ec845 16284 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16285 * ) case "$setlocale_r_proto" in
16286 REENTRANT_PROTO*) ;;
16287 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16288 esac
16289 echo "Prototype: $try" ;;
16290 esac
16291 ;;
c18e646a
JH
16292 *) case "$usethreads" in
16293 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16294 esac
90e831dc
SB
16295 d_setlocale_r=undef
16296 setlocale_r_proto=0
c18e646a 16297 ;;
a48ec845
JH
16298 esac
16299 ;;
10bc17b6
JH
16300*) setlocale_r_proto=0
16301 ;;
16302esac
16303
b4eb6b3d
JH
16304: see if setnetent exists
16305set setnetent d_setnent
16306eval $inlibc
16307
10bc17b6
JH
16308: see if setnetent_r exists
16309set setnetent_r d_setnetent_r
16310eval $inlibc
16311case "$d_setnetent_r" in
16312"$define")
16313 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16314 case "$d_setnetent_r_proto:$usethreads" in
16315 ":define") d_setnetent_r_proto=define
a48ec845
JH
16316 set d_setnetent_r_proto setnetent_r $hdrs
16317 eval $hasproto ;;
16318 *) ;;
16319 esac
16320 case "$d_setnetent_r_proto" in
16321 define)
10bc17b6
JH
16322 case "$setnetent_r_proto" in
16323 ''|0) try='int setnetent_r(int, struct netent_data*);'
16324 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16325 esac
16326 case "$setnetent_r_proto" in
16327 ''|0) try='void setnetent_r(int, struct netent_data*);'
16328 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16329 esac
16330 case "$setnetent_r_proto" in
90e831dc 16331 ''|0) d_setnetent_r=undef
10bc17b6 16332 setnetent_r_proto=0
a48ec845 16333 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16334 * ) case "$setnetent_r_proto" in
16335 REENTRANT_PROTO*) ;;
16336 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16337 esac
16338 echo "Prototype: $try" ;;
16339 esac
16340 ;;
c18e646a
JH
16341 *) case "$usethreads" in
16342 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16343 esac
90e831dc
SB
16344 d_setnetent_r=undef
16345 setnetent_r_proto=0
c18e646a 16346 ;;
a48ec845
JH
16347 esac
16348 ;;
10bc17b6
JH
16349*) setnetent_r_proto=0
16350 ;;
16351esac
16352
b4eb6b3d
JH
16353: see if setprotoent exists
16354set setprotoent d_setpent
16355eval $inlibc
16356
16357: see if setpgid exists
16358set setpgid d_setpgid
16359eval $inlibc
16360
16361: see if setpgrp2 exists
16362set setpgrp2 d_setpgrp2
16363eval $inlibc
16364
16365: see if setpriority exists
16366set setpriority d_setprior
16367eval $inlibc
16368
16369: see if setproctitle exists
16370set setproctitle d_setproctitle
16371eval $inlibc
16372
10bc17b6
JH
16373: see if setprotoent_r exists
16374set setprotoent_r d_setprotoent_r
16375eval $inlibc
16376case "$d_setprotoent_r" in
16377"$define")
16378 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16379 case "$d_setprotoent_r_proto:$usethreads" in
16380 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16381 set d_setprotoent_r_proto setprotoent_r $hdrs
16382 eval $hasproto ;;
16383 *) ;;
16384 esac
16385 case "$d_setprotoent_r_proto" in
16386 define)
10bc17b6
JH
16387 case "$setprotoent_r_proto" in
16388 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16389 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16390 esac
16391 case "$setprotoent_r_proto" in
16392 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16393 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16394 esac
16395 case "$setprotoent_r_proto" in
90e831dc 16396 ''|0) d_setprotoent_r=undef
10bc17b6 16397 setprotoent_r_proto=0
a48ec845 16398 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16399 * ) case "$setprotoent_r_proto" in
16400 REENTRANT_PROTO*) ;;
16401 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16402 esac
16403 echo "Prototype: $try" ;;
16404 esac
16405 ;;
c18e646a
JH
16406 *) case "$usethreads" in
16407 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16408 esac
90e831dc
SB
16409 d_setprotoent_r=undef
16410 setprotoent_r_proto=0
c18e646a 16411 ;;
a48ec845
JH
16412 esac
16413 ;;
10bc17b6
JH
16414*) setprotoent_r_proto=0
16415 ;;
16416esac
16417
b4eb6b3d
JH
16418: see if setpwent exists
16419set setpwent d_setpwent
16420eval $inlibc
16421
10bc17b6
JH
16422: see if setpwent_r exists
16423set setpwent_r d_setpwent_r
16424eval $inlibc
16425case "$d_setpwent_r" in
16426"$define")
16427 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16428 case "$d_setpwent_r_proto:$usethreads" in
16429 ":define") d_setpwent_r_proto=define
a48ec845
JH
16430 set d_setpwent_r_proto setpwent_r $hdrs
16431 eval $hasproto ;;
16432 *) ;;
16433 esac
16434 case "$d_setpwent_r_proto" in
16435 define)
10bc17b6
JH
16436 case "$setpwent_r_proto" in
16437 ''|0) try='int setpwent_r(FILE**);'
16438 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16439 esac
16440 case "$setpwent_r_proto" in
16441 ''|0) try='void setpwent_r(FILE**);'
16442 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16443 esac
16444 case "$setpwent_r_proto" in
90e831dc 16445 ''|0) d_setpwent_r=undef
10bc17b6 16446 setpwent_r_proto=0
a48ec845 16447 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16448 * ) case "$setpwent_r_proto" in
16449 REENTRANT_PROTO*) ;;
16450 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16451 esac
16452 echo "Prototype: $try" ;;
16453 esac
16454 ;;
c18e646a
JH
16455 *) case "$usethreads" in
16456 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16457 esac
90e831dc
SB
16458 d_setpwent_r=undef
16459 setpwent_r_proto=0
c18e646a 16460 ;;
a48ec845
JH
16461 esac
16462 ;;
10bc17b6
JH
16463*) setpwent_r_proto=0
16464 ;;
16465esac
16466
b4eb6b3d
JH
16467: see if setregid exists
16468set setregid d_setregid
16469eval $inlibc
16470set setresgid d_setresgid
16471eval $inlibc
16472
16473: see if setreuid exists
16474set setreuid d_setreuid
16475eval $inlibc
16476set setresuid d_setresuid
16477eval $inlibc
16478
16479: see if setrgid exists
16480set setrgid d_setrgid
16481eval $inlibc
16482
16483: see if setruid exists
16484set setruid d_setruid
16485eval $inlibc
16486
16487: see if setservent exists
16488set setservent d_setsent
16489eval $inlibc
16490
10bc17b6
JH
16491: see if setservent_r exists
16492set setservent_r d_setservent_r
16493eval $inlibc
16494case "$d_setservent_r" in
16495"$define")
16496 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16497 case "$d_setservent_r_proto:$usethreads" in
16498 ":define") d_setservent_r_proto=define
a48ec845
JH
16499 set d_setservent_r_proto setservent_r $hdrs
16500 eval $hasproto ;;
16501 *) ;;
16502 esac
16503 case "$d_setservent_r_proto" in
16504 define)
10bc17b6
JH
16505 case "$setservent_r_proto" in
16506 ''|0) try='int setservent_r(int, struct servent_data*);'
16507 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16508 esac
16509 case "$setservent_r_proto" in
16510 ''|0) try='void setservent_r(int, struct servent_data*);'
16511 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16512 esac
16513 case "$setservent_r_proto" in
90e831dc 16514 ''|0) d_setservent_r=undef
10bc17b6 16515 setservent_r_proto=0
a48ec845 16516 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16517 * ) case "$setservent_r_proto" in
16518 REENTRANT_PROTO*) ;;
16519 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16520 esac
16521 echo "Prototype: $try" ;;
16522 esac
16523 ;;
c18e646a
JH
16524 *) case "$usethreads" in
16525 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16526 esac
90e831dc
SB
16527 d_setservent_r=undef
16528 setservent_r_proto=0
c18e646a 16529 ;;
a48ec845
JH
16530 esac
16531 ;;
10bc17b6
JH
16532*) setservent_r_proto=0
16533 ;;
16534esac
16535
b4eb6b3d
JH
16536: see if setsid exists
16537set setsid d_setsid
16538eval $inlibc
16539
16540: see if setvbuf exists
16541set setvbuf d_setvbuf
16542eval $inlibc
16543
16544: see if sfio.h is available
16545set sfio.h i_sfio
16546eval $inhdr
16547
16548
16549: see if sfio library is available
16550case "$i_sfio" in
16551$define)
16552 val=''
16553 set sfreserve val
16554 eval $inlibc
16555 ;;
16556*)
16557 val="$undef"
16558 ;;
16559esac
16560: Ok, but do we want to use it.
16561case "$val" in
16562$define)
16563 case "$usesfio" in
16564 true|$define|[yY]*) dflt='y';;
16565 *) dflt='n';;
16566 esac
16567 echo "$package can use the sfio library, but it is experimental."
16568 case "$useperlio" in
16569 "$undef")
16570 echo "For sfio also the PerlIO abstraction layer is needed."
16571 echo "Earlier you said you wouldn't want that."
16572 ;;
16573 esac
16574 rp="You seem to have sfio available, do you want to try using it?"
16575 . ./myread
16576 case "$ans" in
16577 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16578 useperlio="$define"
16579 val="$define"
16580 ;;
16581 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16582 val="$undef"
b4eb6b3d
JH
16583 ;;
16584 esac
16585 ;;
16586*) case "$usesfio" in
16587 true|$define|[yY]*)
16588 echo "Sorry, cannot find sfio on this machine." >&4
16589 echo "Ignoring your setting of usesfio=$usesfio." >&4
16590 val="$undef"
16591 ;;
16592 esac
16593 ;;
16594esac
16595set d_sfio
16596eval $setvar
16597case "$d_sfio" in
16598$define) usesfio='true';;
16599*) usesfio='false';;
16600esac
3659ebf1
JH
16601case "$d_sfio" in
16602$define) ;;
16603*) : Remove sfio from list of libraries to use
7483f793
JH
16604 case "$libs" in
16605 *-lsfio*)
16606 echo "Removing unneeded -lsfio from library list" >&4
16607 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16608 shift
16609 libs="$*"
16610 echo "libs = $libs" >&4
16611 ;;
16612 esac
3659ebf1
JH
16613;;
16614esac
16615
b4eb6b3d
JH
16616
16617: see if shmctl exists
16618set shmctl d_shmctl
16619eval $inlibc
16620
16621: see if shmget exists
16622set shmget d_shmget
16623eval $inlibc
16624
16625: see if shmat exists
16626set shmat d_shmat
16627eval $inlibc
16628: see what shmat returns
16629case "$d_shmat" in
16630"$define")
16631 $cat >shmat.c <<'END'
16632#include <sys/shm.h>
16633void *shmat();
16634END
16635 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16636 shmattype='void *'
16637 else
16638 shmattype='char *'
16639 fi
16640 echo "and it returns ($shmattype)." >&4
16641 : see if a prototype for shmat is available
16642 xxx=`./findhdr sys/shm.h`
16643 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16644 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16645 val="$define"
16646 else
16647 val="$undef"
16648 fi
16649 $rm -f shmat.[co]
16650 ;;
16651*)
16652 val="$undef"
16653 ;;
16654esac
16655set d_shmatprototype
16656eval $setvar
16657
16658: see if shmdt exists
16659set shmdt d_shmdt
16660eval $inlibc
16661
16662: see how much of the 'shm*(2)' library is present.
16663h_shm=true
16664echo " "
16665case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16666*"$undef"*) h_shm=false;;
16667esac
16668case "$osname" in
16669freebsd)
16670 case "`ipcs 2>&1`" in
16671 "SVID shared memory"*"not configured"*)
16672 echo "Your $osname does not have the shm*(2) configured." >&4
16673 h_shm=false
16674 val="$undef"
16675 set shmctl d_shmctl
16676 evat $setvar
16677 set shmget d_shmget
16678 evat $setvar
16679 set shmat d_shmat
16680 evat $setvar
16681 set shmdt d_shmdt
16682 evat $setvar
16683 ;;
16684 esac
16685 ;;
16686esac
16687: we could also check for sys/ipc.h ...
16688if $h_shm && $test `./findhdr sys/shm.h`; then
16689 echo "You have the full shm*(2) library." >&4
16690 val="$define"
16691else
16692 echo "You don't have the full shm*(2) library." >&4
16693 val="$undef"
16694fi
16695set d_shm
16696eval $setvar
16697
16698echo " "
16699: see if we have sigaction
16700if set sigaction val -f d_sigaction; eval $csym; $val; then
16701 echo 'sigaction() found.' >&4
c04fee9e 16702 $cat > try.c <<EOP
b4eb6b3d
JH
16703#include <stdio.h>
16704#include <sys/types.h>
16705#include <signal.h>
c04fee9e
JH
16706#$i_stdlib I_STDLIB
16707#ifdef I_STDLIB
16708#include <stdlib.h>
16709#endif
b4eb6b3d
JH
16710int main()
16711{
16712 struct sigaction act, oact;
16713 act.sa_flags = 0;
16714 oact.sa_handler = 0;
16715 /* so that act and oact are used */
16716 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16717}
16718EOP
16719 set try
16720 if eval $compile_ok; then
16721 val="$define"
16722 else
16723 echo "But you don't seem to have a useable struct sigaction." >&4
16724 val="$undef"
16725 fi
16726else
16727 echo 'sigaction NOT found.' >&4
16728 val="$undef"
16729fi
16730set d_sigaction; eval $setvar
16731$rm -f try try$_o try.c
16732
983dbef6
JH
16733: see if sigprocmask exists
16734set sigprocmask d_sigprocmask
16735eval $inlibc
16736
b4eb6b3d
JH
16737: see if sigsetjmp exists
16738echo " "
16739case "$d_sigsetjmp" in
16740'')
511118e1 16741 $cat >try.c <<EOP
b4eb6b3d 16742#include <setjmp.h>
5ed858ef
JH
16743#$i_stdlib I_STDLIB
16744#ifdef I_STDLIB
16745#include <stdlib.h>
16746#endif
b4eb6b3d
JH
16747sigjmp_buf env;
16748int set = 1;
16749int main()
16750{
16751 if (sigsetjmp(env,1))
16752 exit(set);
16753 set = 0;
16754 siglongjmp(env, 1);
16755 exit(1);
16756}
16757EOP
16758 set try
16759 if eval $compile; then
5440bc8e 16760 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16761 echo "POSIX sigsetjmp found." >&4
16762 val="$define"
16763 else
16764 $cat >&4 <<EOM
16765Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16766I'll ignore them.
16767EOM
16768 val="$undef"
16769 fi
16770 else
16771 echo "sigsetjmp not found." >&4
16772 val="$undef"
16773 fi
16774 ;;
16775*) val="$d_sigsetjmp"
16776 case "$d_sigsetjmp" in
16777 $define) echo "POSIX sigsetjmp found." >&4;;
16778 $undef) echo "sigsetjmp not found." >&4;;
16779 esac
16780 ;;
16781esac
16782set d_sigsetjmp
16783eval $setvar
16784$rm -f try.c try
16785
4531c2c7
SP
16786: see if snprintf exists
16787set snprintf d_snprintf
16788eval $inlibc
16789
16790: see if vsnprintf exists
16791set vsnprintf d_vsnprintf
16792eval $inlibc
16793
16794case "$d_snprintf-$d_vsnprintf" in
16795"$define-$define")
16796 $cat <<EOM
16797Checking whether your snprintf() and vsnprintf() work okay...
16798EOM
16799 $cat >try.c <<'EOCP'
16800/* v?snprintf testing logic courtesy of Russ Allbery.
16801 * According to C99:
16802 * - if the buffer is too short it still must be \0-terminated
16803 * - if the buffer is too short the potentially required length
16804 * must be returned and not -1
16805 * - if the buffer is NULL the potentially required length
16806 * must be returned and not -1 or core dump
16807 */
16808#include <stdio.h>
16809#include <stdarg.h>
16810
16811char buf[2];
16812
16813int test (char *format, ...)
16814{
16815 va_list args;
16816 int count;
16817
16818 va_start (args, format);
16819 count = vsnprintf (buf, sizeof buf, format, args);
16820 va_end (args);
16821 return count;
16822}
16823
16824int main ()
16825{
16826 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16827 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16828}
16829EOCP
16830 set try
16831 if eval $compile; then
16832 `$run ./try`
16833 case "$?" in
16834 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16835 *) cat <<EOM >&4
16836Your snprintf() and snprintf() don't seem to be working okay.
16837EOM
16838 d_snprintf="$undef"
16839 d_vsnprintf="$undef"
16840 ;;
16841 esac
16842 else
16843 echo "(I can't seem to compile the test program--assuming they don't)"
16844 d_snprintf="$undef"
16845 d_vsnprintf="$undef"
16846 fi
16847 $rm -f try.* try core core.try.*
16848 ;;
16849esac
16850
49a78c82
JH
16851: see if sockatmark exists
16852set sockatmark d_sockatmark
16853eval $inlibc
16854
2ef53570
JH
16855: see if prototype for sockatmark is available
16856echo " "
16857set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16858eval $hasproto
16859
b4eb6b3d
JH
16860: see if socks5_init exists
16861set socks5_init d_socks5_init
16862eval $inlibc
16863
704c3401
NC
16864: see if sprintf returns the length of the string in the buffer as per ANSI
16865$echo "Checking whether sprintf returns the length of the string..." >&4
16866$cat <<EOP >try.c
16867#include <stdio.h>
16868#$i_stdlib I_STDLIB
16869#ifdef I_STDLIB
16870#include <stdlib.h>
16871#endif
16872#$i_string I_STRING
16873#ifdef I_STRING
16874# include <string.h>
16875#else
16876# include <strings.h>
16877#endif
16878#$i_math I_MATH
16879#ifdef I_MATH
16880#include <math.h>
16881#endif
16882
16883char buffer[256];
16884
16885int check (size_t expect, int test) {
16886 size_t got = strlen(buffer);
16887 if (expect == got)
16888 return 0;
16889
16890 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16891 test, buffer);
16892 exit (test);
16893}
16894
16895int main(int argc, char **argv) {
16896 int test = 0;
16897
16898 check(sprintf(buffer, ""), ++test);
16899 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16900 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16901
16902 return 0;
16903}
16904EOP
16905set try
16906
16907d_sprintf_returns_strlen="$undef"
16908if eval $compile; then
16909 xxx="`$run ./try`"
16910 case "$?" in
16911 0) cat >&4 <<EOM
16912sprintf returns the length of the string (as ANSI says it should)
16913EOM
16914 d_sprintf_returns_strlen="$define"
16915 ;;
16916 *) cat >&4 <<EOM
16917sprintf does not return the length of the string (how old is this system?)
16918EOM
16919 d_sprintf_returns_strlen="$undef"
16920 ;;
16921 esac
16922fi
16923
16924$rm -f try.* try
16925
10bc17b6
JH
16926: see if srand48_r exists
16927set srand48_r d_srand48_r
16928eval $inlibc
16929case "$d_srand48_r" in
16930"$define")
16931 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16932 case "$d_srand48_r_proto:$usethreads" in
16933 ":define") d_srand48_r_proto=define
a48ec845
JH
16934 set d_srand48_r_proto srand48_r $hdrs
16935 eval $hasproto ;;
16936 *) ;;
16937 esac
16938 case "$d_srand48_r_proto" in
16939 define)
10bc17b6
JH
16940 case "$srand48_r_proto" in
16941 ''|0) try='int srand48_r(long, struct drand48_data*);'
16942 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16943 esac
16944 case "$srand48_r_proto" in
90e831dc 16945 ''|0) d_srand48_r=undef
10bc17b6 16946 srand48_r_proto=0
a48ec845 16947 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16948 * ) case "$srand48_r_proto" in
16949 REENTRANT_PROTO*) ;;
16950 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16951 esac
16952 echo "Prototype: $try" ;;
16953 esac
16954 ;;
c18e646a
JH
16955 *) case "$usethreads" in
16956 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16957 esac
90e831dc
SB
16958 d_srand48_r=undef
16959 srand48_r_proto=0
c18e646a 16960 ;;
a48ec845
JH
16961 esac
16962 ;;
10bc17b6
JH
16963*) srand48_r_proto=0
16964 ;;
16965esac
16966
16967: see if srandom_r exists
16968set srandom_r d_srandom_r
16969eval $inlibc
16970case "$d_srandom_r" in
16971"$define")
16972 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16973 case "$d_srandom_r_proto:$usethreads" in
16974 ":define") d_srandom_r_proto=define
a48ec845
JH
16975 set d_srandom_r_proto srandom_r $hdrs
16976 eval $hasproto ;;
16977 *) ;;
16978 esac
16979 case "$d_srandom_r_proto" in
16980 define)
10bc17b6
JH
16981 case "$srandom_r_proto" in
16982 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16983 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16984 esac
16985 case "$srandom_r_proto" in
90e831dc 16986 ''|0) d_srandom_r=undef
10bc17b6 16987 srandom_r_proto=0
a48ec845 16988 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16989 * ) case "$srandom_r_proto" in
16990 REENTRANT_PROTO*) ;;
16991 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16992 esac
16993 echo "Prototype: $try" ;;
16994 esac
16995 ;;
c18e646a
JH
16996 *) case "$usethreads" in
16997 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16998 esac
90e831dc
SB
16999 d_srandom_r=undef
17000 srandom_r_proto=0
c18e646a 17001 ;;
a48ec845
JH
17002 esac
17003 ;;
10bc17b6
JH
17004*) srandom_r_proto=0
17005 ;;
17006esac
17007
eef837ea
JH
17008: see if prototype for setresgid is available
17009echo " "
17010set d_sresgproto setresgid $i_unistd unistd.h
17011eval $hasproto
17012
640374d0
JH
17013: see if prototype for setresuid is available
17014echo " "
17015set d_sresuproto setresuid $i_unistd unistd.h
17016eval $hasproto
17017
b4eb6b3d
JH
17018: see if sys/stat.h is available
17019set sys/stat.h i_sysstat
17020eval $inhdr
17021
17022
17023: see if stat knows about block sizes
17024echo " "
17025echo "Checking to see if your struct stat has st_blocks field..." >&4
17026set d_statblks stat st_blocks $i_sysstat sys/stat.h
17027eval $hasfield
17028
17029
17030: see if this is a sys/vfs.h system
17031set sys/vfs.h i_sysvfs
17032eval $inhdr
17033
17034
17035: see if this is a sys/statfs.h system
17036set sys/statfs.h i_sysstatfs
17037eval $inhdr
17038
17039
17040echo " "
17041echo "Checking to see if your system supports struct statfs..." >&4
17042set 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
17043eval $hasstruct
17044case "$d_statfs_s" in
17045"$define") echo "Yes, it does." ;;
17046*) echo "No, it doesn't." ;;
17047esac
17048
17049
17050
17051: see if struct statfs knows about f_flags
17052case "$d_statfs_s" in
17053define)
17054 echo " "
17055 echo "Checking to see if your struct statfs has f_flags field..." >&4
17056 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
17057 eval $hasfield
17058 ;;
17059*) val="$undef"
17060 set d_statfs_f_flags
17061 eval $setvar
17062 ;;
17063esac
17064case "$d_statfs_f_flags" in
17065"$define") echo "Yes, it does." ;;
17066*) echo "No, it doesn't." ;;
17067esac
17068
b4eb6b3d
JH
17069$cat >&4 <<EOM
17070Checking how to access stdio streams by file descriptor number...
17071EOM
17072case "$stdio_stream_array" in
17073'') $cat >try.c <<EOCP
17074#include <stdio.h>
17075int main() {
17076 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17077 printf("yes\n");
17078}
17079EOCP
17080 for s in _iob __iob __sF
17081 do
17082 set try -DSTDIO_STREAM_ARRAY=$s
17083 if eval $compile; then
5440bc8e 17084 case "`$run ./try`" in
b4eb6b3d
JH
17085 yes) stdio_stream_array=$s; break ;;
17086 esac
17087 fi
17088 done
17089 $rm -f try.* try$exe_ext
17090esac
17091case "$stdio_stream_array" in
17092'') $cat >&4 <<EOM
17093I can't figure out how to access stdio streams by file descriptor number.
17094EOM
17095 d_stdio_stream_array="$undef"
17096 ;;
17097*) $cat >&4 <<EOM
17098You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17099EOM
17100 d_stdio_stream_array="$define"
17101 ;;
17102esac
17103
17104: see if strcoll exists
17105set strcoll d_strcoll
17106eval $inlibc
17107
17108: check for structure copying
17109echo " "
17110echo "Checking to see if your C compiler can copy structs..." >&4
17111$cat >try.c <<'EOCP'
17112int main()
17113{
17114 struct blurfl {
17115 int dyick;
17116 } foo, bar;
17117
17118 foo = bar;
17119}
17120EOCP
17121if $cc -c try.c >/dev/null 2>&1 ; then
17122 val="$define"
17123 echo "Yup, it can."
17124else
17125 val="$undef"
17126 echo "Nope, it can't."
17127fi
17128set d_strctcpy
17129eval $setvar
17130$rm -f try.*
17131
17132: see if strerror and/or sys_errlist[] exist
17133echo " "
17134if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17135 if set strerror val -f d_strerror; eval $csym; $val; then
17136 echo 'strerror() found.' >&4
17137 d_strerror="$define"
17138 d_strerrm='strerror(e)'
17139 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17140 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17141 d_syserrlst="$define"
17142 else
17143 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17144 d_syserrlst="$undef"
17145 fi
17146 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17147 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17148 echo 'strerror() found in string header.' >&4
17149 d_strerror="$define"
17150 d_strerrm='strerror(e)'
17151 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17152 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17153 d_syserrlst="$define"
17154 else
17155 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17156 d_syserrlst="$undef"
17157 fi
17158 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17159 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17160 d_strerror="$undef"
17161 d_syserrlst="$define"
17162 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17163 else
17164 echo 'strerror() and sys_errlist[] NOT found.' >&4
17165 d_strerror="$undef"
17166 d_syserrlst="$undef"
17167 d_strerrm='"unknown"'
17168 fi
17169fi
17170
10bc17b6
JH
17171: see if strerror_r exists
17172set strerror_r d_strerror_r
17173eval $inlibc
17174case "$d_strerror_r" in
17175"$define")
17176 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17177 case "$d_strerror_r_proto:$usethreads" in
17178 ":define") d_strerror_r_proto=define
a48ec845
JH
17179 set d_strerror_r_proto strerror_r $hdrs
17180 eval $hasproto ;;
17181 *) ;;
17182 esac
17183 case "$d_strerror_r_proto" in
17184 define)
10bc17b6
JH
17185 case "$strerror_r_proto" in
17186 ''|0) try='int strerror_r(int, char*, size_t);'
17187 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17188 esac
17189 case "$strerror_r_proto" in
17190 ''|0) try='int strerror_r(int, char*, int);'
17191 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17192 esac
17193 case "$strerror_r_proto" in
17194 ''|0) try='char* strerror_r(int, char*, size_t);'
17195 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17196 esac
17197 case "$strerror_r_proto" in
90e831dc 17198 ''|0) d_strerror_r=undef
10bc17b6 17199 strerror_r_proto=0
a48ec845 17200 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17201 * ) case "$strerror_r_proto" in
17202 REENTRANT_PROTO*) ;;
17203 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17204 esac
17205 echo "Prototype: $try" ;;
17206 esac
17207 ;;
c18e646a
JH
17208 *) case "$usethreads" in
17209 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17210 esac
90e831dc
SB
17211 d_strerror_r=undef
17212 strerror_r_proto=0
c18e646a 17213 ;;
a48ec845
JH
17214 esac
17215 ;;
10bc17b6
JH
17216*) strerror_r_proto=0
17217 ;;
17218esac
17219
b3c85772
JH
17220: see if strftime exists
17221set strftime d_strftime
17222eval $inlibc
17223
84baed4c
CB
17224: see if strlcat exists
17225set strlcat d_strlcat
17226eval $inlibc
17227
17228: see if strlcpy exists
17229set strlcpy d_strlcpy
17230eval $inlibc
17231
b4eb6b3d
JH
17232: see if strtod exists
17233set strtod d_strtod
17234eval $inlibc
17235
17236: see if strtol exists
17237set strtol d_strtol
17238eval $inlibc
17239
17240: see if strtold exists
17241set strtold d_strtold
17242eval $inlibc
17243
17244: see if strtoll exists
17245set strtoll d_strtoll
17246eval $inlibc
17247
17248case "$d_longlong-$d_strtoll" in
17249"$define-$define")
17250 $cat <<EOM
17251Checking whether your strtoll() works okay...
17252EOM
17253 $cat >try.c <<'EOCP'
17254#include <errno.h>
17255#ifdef __hpux
17256#define strtoll __strtoll
17257#endif
e75931a7
YST
17258#ifdef __EMX__
17259#define strtoll _strtoll
17260#endif
b4eb6b3d
JH
17261#include <stdio.h>
17262extern long long int strtoll(char *s, char **, int);
17263static int bad = 0;
17264int check(char *s, long long ell, int een) {
17265 long long gll;
17266 errno = 0;
17267 gll = strtoll(s, 0, 10);
17268 if (!((gll == ell) && (errno == een)))
17269 bad++;
17270}
17271int main() {
17272 check(" 1", 1LL, 0);
17273 check(" 0", 0LL, 0);
17274 check("-1", -1LL, 0);
17275 check("-9223372036854775808", -9223372036854775808LL, 0);
17276 check("-9223372036854775808", -9223372036854775808LL, 0);
17277 check(" 9223372036854775807", 9223372036854775807LL, 0);
17278 check("-9223372036854775808", -9223372036854775808LL, 0);
17279 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17280 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17281 if (!bad)
17282 printf("ok\n");
17283}
17284EOCP
17285 set try
17286 if eval $compile; then
5440bc8e 17287 yyy=`$run ./try`
e75931a7 17288 case "$yyy" in
b4eb6b3d
JH
17289 ok) echo "Your strtoll() seems to be working okay." ;;
17290 *) cat <<EOM >&4
17291Your strtoll() doesn't seem to be working okay.
17292EOM
17293 d_strtoll="$undef"
17294 ;;
69eadf66 17295 esac
e75931a7
YST
17296 else
17297 echo "(I can't seem to compile the test program--assuming it doesn't)"
17298 d_strtoll="$undef"
b4eb6b3d
JH
17299 fi
17300 ;;
17301esac
17302
28e5dec8
JH
17303: see if strtoq exists
17304set strtoq d_strtoq
17305eval $inlibc
17306
b4eb6b3d
JH
17307: see if strtoul exists
17308set strtoul d_strtoul
17309eval $inlibc
17310
d0e6d399
NC
17311case "$d_strtoul" in
17312"$define")
17313 $cat <<EOM
17314Checking whether your strtoul() works okay...
17315EOM
17316 $cat >try.c <<'EOCP'
17317#include <errno.h>
17318#include <stdio.h>
17319extern unsigned long int strtoul(char *s, char **, int);
17320static int bad = 0;
17321void check(char *s, unsigned long eul, int een) {
17322 unsigned long gul;
17323 errno = 0;
17324 gul = strtoul(s, 0, 10);
17325 if (!((gul == eul) && (errno == een)))
17326 bad++;
17327}
17328int main() {
17329 check(" 1", 1L, 0);
17330 check(" 0", 0L, 0);
17331EOCP
17332 case "$longsize" in
17333 8)
17334 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17335 check("18446744073709551615", 18446744073709551615UL, 0);
17336 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17337#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17338 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17339 check("-18446744073709551614", 2, 0);
17340 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17341 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17342 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17343#endif
d0e6d399
NC
17344EOCP
17345 ;;
17346 4)
17347 $cat >>try.c <<'EOCP'
17348 check("4294967295", 4294967295UL, 0);
17349 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17350#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17351 check("-1", 4294967295UL, 0);
17352 check("-4294967294", 2, 0);
17353 check("-4294967295", 1, 0);
17354 check("-4294967296", 4294967295UL, ERANGE);
17355 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17356#endif
d0e6d399
NC
17357EOCP
17358 ;;
17359 *)
17360: Should we write these tests to be more portable by sprintf-ing
17361: ~0 and then manipulating that char string as input for strtol?
17362 ;;
17363 esac
17364 $cat >>try.c <<'EOCP'
17365 if (!bad)
17366 printf("ok\n");
17367 return 0;
17368}
17369EOCP
17370 set try
17371 if eval $compile; then
5440bc8e 17372 case "`$run ./try`" in
d0e6d399
NC
17373 ok) echo "Your strtoul() seems to be working okay." ;;
17374 *) cat <<EOM >&4
17375Your strtoul() doesn't seem to be working okay.
17376EOM
17377 d_strtoul="$undef"
17378 ;;
17379 esac
17380 fi
17381 ;;
17382esac
17383
b4eb6b3d
JH
17384: see if strtoull exists
17385set strtoull d_strtoull
17386eval $inlibc
17387
17388case "$d_longlong-$d_strtoull" in
17389"$define-$define")
17390 $cat <<EOM
17391Checking whether your strtoull() works okay...
17392EOM
17393 $cat >try.c <<'EOCP'
17394#include <errno.h>
17395#ifdef __hpux
17396#define strtoull __strtoull
17397#endif
17398#include <stdio.h>
17399extern unsigned long long int strtoull(char *s, char **, int);
17400static int bad = 0;
17401int check(char *s, long long eull, int een) {
17402 long long gull;
17403 errno = 0;
17404 gull = strtoull(s, 0, 10);
17405 if (!((gull == eull) && (errno == een)))
17406 bad++;
17407}
17408int main() {
d0e6d399
NC
17409 check(" 1", 1LL, 0);
17410 check(" 0", 0LL, 0);
17411 check("18446744073709551615", 18446744073709551615ULL, 0);
17412 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17413#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17414 check("-1", 18446744073709551615ULL, 0);
17415 check("-18446744073709551614", 2LL, 0);
17416 check("-18446744073709551615", 1LL, 0);
17417 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17418 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17419#endif
b4eb6b3d
JH
17420 if (!bad)
17421 printf("ok\n");
17422}
17423EOCP
17424 set try
17425 if eval $compile; then
5440bc8e 17426 case "`$run ./try`" in
b4eb6b3d
JH
17427 ok) echo "Your strtoull() seems to be working okay." ;;
17428 *) cat <<EOM >&4
17429Your strtoull() doesn't seem to be working okay.
17430EOM
17431 d_strtoull="$undef"
17432 ;;
17433 esac
17434 fi
17435 ;;
17436esac
17437
17438: see if strtouq exists
17439set strtouq d_strtouq
17440eval $inlibc
17441
d0e6d399
NC
17442case "$d_strtouq" in
17443"$define")
17444 $cat <<EOM
17445Checking whether your strtouq() works okay...
17446EOM
17447 $cat >try.c <<'EOCP'
17448#include <errno.h>
17449#include <stdio.h>
17450extern unsigned long long int strtouq(char *s, char **, int);
17451static int bad = 0;
17452void check(char *s, unsigned long long eull, int een) {
17453 unsigned long long gull;
17454 errno = 0;
17455 gull = strtouq(s, 0, 10);
17456 if (!((gull == eull) && (errno == een)))
17457 bad++;
17458}
17459int main() {
17460 check(" 1", 1LL, 0);
17461 check(" 0", 0LL, 0);
17462 check("18446744073709551615", 18446744073709551615ULL, 0);
17463 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17464#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17465 check("-1", 18446744073709551615ULL, 0);
17466 check("-18446744073709551614", 2LL, 0);
17467 check("-18446744073709551615", 1LL, 0);
17468 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17469 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17470#endif
d0e6d399
NC
17471 if (!bad)
17472 printf("ok\n");
17473 return 0;
17474}
17475EOCP
17476 set try
17477 if eval $compile; then
5440bc8e 17478 case "`$run ./try`" in
d0e6d399
NC
17479 ok) echo "Your strtouq() seems to be working okay." ;;
17480 *) cat <<EOM >&4
17481Your strtouq() doesn't seem to be working okay.
17482EOM
17483 d_strtouq="$undef"
17484 ;;
17485 esac
17486 fi
17487 ;;
17488esac
17489
b4eb6b3d
JH
17490: see if strxfrm exists
17491set strxfrm d_strxfrm
17492eval $inlibc
17493
17494: see if symlink exists
17495set symlink d_symlink
17496eval $inlibc
17497
17498: see if syscall exists
17499set syscall d_syscall
17500eval $inlibc
17501
2ef53570
JH
17502: see if prototype for syscall is available
17503echo " "
17504set d_syscallproto syscall $i_unistd unistd.h
17505eval $hasproto
17506
b4eb6b3d
JH
17507: see if sysconf exists
17508set sysconf d_sysconf
17509eval $inlibc
17510
17511: see if system exists
17512set system d_system
17513eval $inlibc
17514
17515: see if tcgetpgrp exists
17516set tcgetpgrp d_tcgetpgrp
17517eval $inlibc
17518
17519: see if tcsetpgrp exists
17520set tcsetpgrp d_tcsetpgrp
17521eval $inlibc
17522
17523: see if prototype for telldir is available
17524echo " "
17525set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17526eval $hasproto
17527
ad493445
MB
17528: see if time exists
17529echo " "
17530if test "X$d_time" = X -o X"$timetype" = X; then
17531 if set time val -f d_time; eval $csym; $val; then
17532 echo 'time() found.' >&4
17533 val="$define"
17534 rp="What is the type returned by time() on this system?"
17535 set time_t timetype long stdio.h sys/types.h
17536 eval $typedef_ask
17537 else
17538 echo 'time() not found, hope that will do.' >&4
17539 val="$undef"
17540 timetype='int';
17541 fi
17542 set d_time
17543 eval $setvar
17544fi
17545
b4eb6b3d
JH
17546: see if this is a sys/times.h system
17547set sys/times.h i_systimes
17548eval $inhdr
17549
17550: see if times exists
17551echo " "
17552if set times val -f d_times; eval $csym; $val; then
17553 echo 'times() found.' >&4
17554 d_times="$define"
17555 inc=''
17556 case "$i_systimes" in
17557 "$define") inc='sys/times.h';;
17558 esac
17559 rp="What is the type returned by times() on this system?"
17560 set clock_t clocktype long stdio.h sys/types.h $inc
17561 eval $typedef_ask
17562else
17563 echo 'times() NOT found, hope that will do.' >&4
17564 d_times="$undef"
17565 clocktype='int'
17566fi
17567
10bc17b6
JH
17568: see if tmpnam_r exists
17569set tmpnam_r d_tmpnam_r
17570eval $inlibc
17571case "$d_tmpnam_r" in
17572"$define")
31ee0cb7 17573 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17574 case "$d_tmpnam_r_proto:$usethreads" in
17575 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17576 set d_tmpnam_r_proto tmpnam_r $hdrs
17577 eval $hasproto ;;
17578 *) ;;
17579 esac
17580 case "$d_tmpnam_r_proto" in
17581 define)
10bc17b6
JH
17582 case "$tmpnam_r_proto" in
17583 ''|0) try='char* tmpnam_r(char*);'
17584 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17585 esac
17586 case "$tmpnam_r_proto" in
90e831dc 17587 ''|0) d_tmpnam_r=undef
10bc17b6 17588 tmpnam_r_proto=0
a48ec845 17589 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17590 * ) case "$tmpnam_r_proto" in
17591 REENTRANT_PROTO*) ;;
17592 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17593 esac
17594 echo "Prototype: $try" ;;
17595 esac
17596 ;;
c18e646a
JH
17597 *) case "$usethreads" in
17598 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17599 esac
90e831dc
SB
17600 d_tmpnam_r=undef
17601 tmpnam_r_proto=0
c18e646a 17602 ;;
a48ec845
JH
17603 esac
17604 ;;
10bc17b6
JH
17605*) tmpnam_r_proto=0
17606 ;;
17607esac
17608
b4eb6b3d
JH
17609: see if truncate exists
17610set truncate d_truncate
17611eval $inlibc
17612
10bc17b6
JH
17613: see if ttyname_r exists
17614set ttyname_r d_ttyname_r
17615eval $inlibc
17616case "$d_ttyname_r" in
17617"$define")
17618 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17619 case "$d_ttyname_r_proto:$usethreads" in
17620 ":define") d_ttyname_r_proto=define
a48ec845
JH
17621 set d_ttyname_r_proto ttyname_r $hdrs
17622 eval $hasproto ;;
17623 *) ;;
17624 esac
17625 case "$d_ttyname_r_proto" in
17626 define)
10bc17b6
JH
17627 case "$ttyname_r_proto" in
17628 ''|0) try='int ttyname_r(int, char*, size_t);'
17629 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17630 esac
17631 case "$ttyname_r_proto" in
17632 ''|0) try='int ttyname_r(int, char*, int);'
17633 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17634 esac
17635 case "$ttyname_r_proto" in
17636 ''|0) try='char* ttyname_r(int, char*, int);'
17637 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17638 esac
17639 case "$ttyname_r_proto" in
90e831dc 17640 ''|0) d_ttyname_r=undef
10bc17b6 17641 ttyname_r_proto=0
a48ec845 17642 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17643 * ) case "$ttyname_r_proto" in
17644 REENTRANT_PROTO*) ;;
17645 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17646 esac
17647 echo "Prototype: $try" ;;
17648 esac
17649 ;;
c18e646a
JH
17650 *) case "$usethreads" in
17651 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17652 esac
90e831dc
SB
17653 d_ttyname_r=undef
17654 ttyname_r_proto=0
c18e646a 17655 ;;
a48ec845
JH
17656 esac
17657 ;;
10bc17b6
JH
17658*) ttyname_r_proto=0
17659 ;;
17660esac
17661
b4eb6b3d
JH
17662: see if tzname[] exists
17663echo " "
17664if set tzname val -a d_tzname; eval $csym; $val; then
17665 val="$define"
17666 echo 'tzname[] found.' >&4
17667else
17668 val="$undef"
17669 echo 'tzname[] NOT found.' >&4
17670fi
17671set d_tzname
17672eval $setvar
17673
4e0554ec
JH
17674case "$osname" in
17675next|rhapsody|darwin) multiarch="$define" ;;
17676esac
17677case "$multiarch" in
17678''|[nN]*) multiarch="$undef" ;;
17679esac
17680
24412007 17681: check for ordering of bytes in a UV
4e0554ec 17682echo " "
5440bc8e 17683case "$usecrosscompile$multiarch" in
4e0554ec
JH
17684*$define*)
17685 $cat <<EOM
17686You seem to be either cross-compiling or doing a multiarchitecture build,
17687skipping the byteorder check.
17688
17689EOM
5440bc8e 17690 byteorder='ffff'
4e0554ec
JH
17691 ;;
17692*)
17693 case "$byteorder" in
17694 '')
17695 $cat <<'EOM'
17696In the following, larger digits indicate more significance. A big-endian
17697machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17698little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17699machines may have weird orders like 3412. A Cray will report 87654321,
17700an Alpha will report 12345678. If the test program works the default is
17701probably right.
17702I'm now running the test program...
17703EOM
24412007 17704 $cat >try.c <<EOCP
4e0554ec 17705#include <stdio.h>
5a29c6bc
JH
17706#$i_stdlib I_STDLIB
17707#ifdef I_STDLIB
17708#include <stdlib.h>
17709#endif
24412007
JH
17710#include <sys/types.h>
17711typedef $uvtype UV;
4e0554ec
JH
17712int main()
17713{
17714 int i;
17715 union {
24412007
JH
17716 UV l;
17717 char c[$uvsize];
4e0554ec
JH
17718 } u;
17719
24412007 17720 if ($uvsize > 4)
b5ded3e5 17721 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17722 else
a4c53327 17723 u.l = (UV)0x04030201;
24412007 17724 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17725 printf("%c", u.c[i]+'0');
17726 printf("\n");
17727 exit(0);
17728}
17729EOCP
17730 xxx_prompt=y
17731 set try
17732 if eval $compile && ./try > /dev/null; then
5440bc8e 17733 dflt=`$run ./try`
4e0554ec
JH
17734 case "$dflt" in
17735 [1-4][1-4][1-4][1-4]|12345678|87654321)
17736 echo "(The test program ran ok.)"
17737 echo "byteorder=$dflt"
17738 xxx_prompt=n
17739 ;;
17740 ????|????????) echo "(The test program ran ok.)" ;;
17741 *) echo "(The test program didn't run right for some reason.)" ;;
17742 esac
17743 else
17744 dflt='4321'
17745 cat <<'EOM'
17746(I can't seem to compile the test program. Guessing big-endian...)
17747EOM
17748 fi
17749 case "$xxx_prompt" in
17750 y)
24412007 17751 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17752 . ./myread
17753 byteorder="$ans"
17754 ;;
17755 *) byteorder=$dflt
17756 ;;
17757 esac
17758 ;;
17759 esac
17760 $rm -f try.c try
17761 ;;
17762esac
17763
17764
17765$cat <<EOM
17766
17767Checking to see whether you can access character data unalignedly...
17768EOM
dc7b0a4f
JH
17769case "$d_u32align" in
17770'') $cat >try.c <<EOCP
4e0554ec 17771#include <stdio.h>
5ed858ef
JH
17772#$i_stdlib I_STDLIB
17773#ifdef I_STDLIB
17774#include <stdlib.h>
17775#endif
4e0554ec 17776#define U32 $u32type
d308175a
JH
17777#define BYTEORDER 0x$byteorder
17778#define U8 $u8type
9958dc3c
JH
17779#include <signal.h>
17780#ifdef SIGBUS
5f7d02a9 17781$signal_t bletch(int s) { exit(4); }
9958dc3c 17782#endif
4e0554ec
JH
17783int main() {
17784#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17785 U8 buf[8];
4e0554ec
JH
17786 U32 *up;
17787 int i;
17788
17789 if (sizeof(U32) != 4) {
17790 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17791 exit(1);
17792 }
17793
17794 fflush(stdout);
17795
9958dc3c
JH
17796#ifdef SIGBUS
17797 signal(SIGBUS, bletch);
17798#endif
17799
8906a23e
JH
17800 buf[0] = 0;
17801 buf[1] = 0;
17802 buf[2] = 0;
17803 buf[3] = 1;
9beed644 17804 buf[4] = 0;
8906a23e
JH
17805 buf[5] = 0;
17806 buf[6] = 0;
9beed644 17807 buf[7] = 1;
8906a23e 17808
4e0554ec
JH
17809 for (i = 0; i < 4; i++) {
17810 up = (U32*)(buf + i);
17811 if (! ((*up == 1 << (8*i)) || /* big-endian */
17812 (*up == 1 << (8*(3-i))) /* little-endian */
17813 )
17814 )
17815 {
17816 printf("read failed (%x)\n", *up);
17817 exit(2);
17818 }
17819 }
17820
17821 /* write test */
17822 for (i = 0; i < 4; i++) {
17823 up = (U32*)(buf + i);
17824 *up = 0xBeef;
17825 if (*up != 0xBeef) {
17826 printf("write failed (%x)\n", *up);
17827 exit(3);
17828 }
17829 }
17830
17831 exit(0);
17832#else
17833 printf("1\n");
17834 exit(1);
17835#endif
17836 return 0;
17837}
17838EOCP
17839set try
17840if eval $compile_ok; then
d308175a 17841 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17842 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17843 case "$?" in
17844 0) cat >&4 <<EOM
17845You can access character data pretty unalignedly.
17846EOM
17847 d_u32align="$undef"
17848 ;;
17849 *) cat >&4 <<EOM
17850It seems that you must access character data in an aligned manner.
17851EOM
17852 d_u32align="$define"
17853 ;;
17854 esac
4e0554ec
JH
17855else
17856 rp='Can you access character data at unaligned addresses?'
17857 dflt='n'
17858 . ./myread
17859 case "$ans" in
17860 [yY]*) d_u32align="$undef" ;;
17861 *) d_u32align="$define" ;;
17862 esac
17863fi
e36b5403 17864$rm -f core core.try.* try.core
dc7b0a4f
JH
17865;;
17866esac
4e0554ec
JH
17867
17868: see if ualarm exists
17869set ualarm d_ualarm
17870eval $inlibc
17871
b4eb6b3d
JH
17872: see if umask exists
17873set umask d_umask
17874eval $inlibc
17875
758a5d79
JH
17876: see if unordered exists
17877set unordered d_unordered
17878eval $inlibc
17879
1466f2fb
SP
17880: see if unsetenv exists
17881set unsetenv d_unsetenv
17882eval $inlibc
17883
4e0554ec
JH
17884: see if usleep exists
17885set usleep d_usleep
17886eval $inlibc
17887
2ef53570
JH
17888: see if prototype for usleep is available
17889echo " "
17890set d_usleepproto usleep $i_unistd unistd.h
17891eval $hasproto
17892
b4eb6b3d
JH
17893: see if ustat exists
17894set ustat d_ustat
17895eval $inlibc
17896
17897: backward compatibility for d_hvfork
17898if test X$d_hvfork != X; then
17899 d_vfork="$d_hvfork"
17900 d_hvfork=''
17901fi
17902: see if there is a vfork
17903val=''
17904set vfork val
17905eval $inlibc
17906
17907: Ok, but do we want to use it. vfork is reportedly unreliable in
17908: perl on Solaris 2.x, and probably elsewhere.
17909case "$val" in
17910$define)
17911 echo " "
17912 case "$usevfork" in
17913 false) dflt='n';;
17914 *) dflt='y';;
17915 esac
17916 cat <<'EOM'
17917
17918Perl can only use a vfork() that doesn't suffer from strict
17919restrictions on calling functions or modifying global data in
17920the child. For example, glibc-2.1 contains such a vfork()
17921that is unsuitable. If your system provides a proper fork()
17922call, chances are that you do NOT want perl to use vfork().
17923
17924EOM
17925 rp="Do you still want to use vfork()?"
17926 . ./myread
17927 case "$ans" in
17928 y|Y) ;;
17929 *)
17930 echo "Ok, we won't use vfork()."
17931 val="$undef"
17932 ;;
17933 esac
17934 ;;
17935esac
17936set d_vfork
17937eval $setvar
17938case "$d_vfork" in
17939$define) usevfork='true';;
17940*) usevfork='false';;
17941esac
17942
b4eb6b3d
JH
17943: see if closedir exists
17944set closedir d_closedir
17945eval $inlibc
17946
17947case "$d_closedir" in
17948"$define")
17949 echo " "
17950 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17951 cat > try.c <<EOM
b4eb6b3d
JH
17952#$i_dirent I_DIRENT /**/
17953#$i_sysdir I_SYS_DIR /**/
17954#$i_sysndir I_SYS_NDIR /**/
17955#$i_systypes I_SYS_TYPES /**/
17956
17957#if defined(I_SYS_TYPES)
17958#include <sys/types.h>
17959#endif
17960#if defined(I_DIRENT)
17961#include <dirent.h>
17962#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17963#include <sys/dir.h>
17964#endif
17965#else
17966#ifdef I_SYS_NDIR
17967#include <sys/ndir.h>
17968#else
17969#ifdef I_SYS_DIR
17970#ifdef hp9000s500
17971#include <ndir.h> /* may be wrong in the future */
17972#else
17973#include <sys/dir.h>
17974#endif
17975#endif
17976#endif
17977#endif
17978int main() { return closedir(opendir(".")); }
17979EOM
5440bc8e 17980 set try
b4eb6b3d 17981 if eval $compile_ok; then
5440bc8e 17982 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17983 echo "Yes, it does."
17984 val="$undef"
17985 else
17986 echo "No, it doesn't."
17987 val="$define"
17988 fi
17989 else
17990 echo "(I can't seem to compile the test program--assuming it doesn't)"
17991 val="$define"
17992 fi
17993 ;;
17994*)
17995 val="$undef";
17996 ;;
17997esac
17998set d_void_closedir
17999eval $setvar
5440bc8e 18000$rm -f try try.*
b4eb6b3d
JH
18001: see if there is a wait4
18002set wait4 d_wait4
18003eval $inlibc
18004
18005: see if waitpid exists
18006set waitpid d_waitpid
18007eval $inlibc
18008
18009: see if wcstombs exists
18010set wcstombs d_wcstombs
18011eval $inlibc
18012
18013: see if wctomb exists
18014set wctomb d_wctomb
18015eval $inlibc
18016
4e0554ec
JH
18017: see if writev exists
18018set writev d_writev
18019eval $inlibc
18020
b4eb6b3d
JH
18021: preserve RCS keywords in files with variable substitution, grrr
18022Date='$Date'
18023Id='$Id'
18024Log='$Log'
18025RCSfile='$RCSfile'
18026Revision='$Revision'
18027
b4eb6b3d
JH
18028: check for alignment requirements
18029echo " "
5440bc8e 18030case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18031*$define*)
18032 $cat <<EOM
18033You seem to be either cross-compiling or doing a multiarchitecture build,
18034skipping the memory alignment check.
18035
18036EOM
18037 case "$alignbytes" in
18038 '') alignbytes=8 ;;
18039 esac
18040 ;;
18041*)
18042 case "$alignbytes" in
18043 '') echo "Checking alignment constraints..." >&4
18044 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18045 $cat >try.c <<'EOCP'
18046typedef long double NV;
18047EOCP
18048 else
18049 $cat >try.c <<'EOCP'
18050typedef double NV;
18051EOCP
18052 fi
18053 $cat >>try.c <<'EOCP'
18054#include <stdio.h>
18055struct foobar {
18056 char foo;
18057 NV bar;
18058} try_algn;
18059int main()
18060{
18061 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18062 return(0);
18063}
18064EOCP
18065 set try
18066 if eval $compile_ok; then
5440bc8e 18067 dflt=`$run ./try`
b4eb6b3d
JH
18068 else
18069 dflt='8'
18070 echo "(I can't seem to compile the test program...)"
18071 fi
18072 ;;
18073 *) dflt="$alignbytes"
18074 ;;
18075 esac
18076 rp="Doubles must be aligned on a how-many-byte boundary?"
18077 . ./myread
18078 alignbytes="$ans"
18079 $rm -f try.c try
18080 ;;
18081esac
18082
18083
18084: set the base revision
18085baserev=5.0
18086
92b39ff2 18087: how do we concatenate cpp tokens here?
b4eb6b3d 18088echo " "
92b39ff2 18089echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18090$cat >cpp_stuff.c <<'EOCP'
18091#define RCAT(a,b)a/**/b
18092#define ACAT(a,b)a ## b
18093RCAT(Rei,ser)
18094ACAT(Cir,cus)
18095EOCP
18096$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18097if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18098 echo "Oh! Smells like ANSI's been here." >&4
18099 echo "We can catify or stringify, separately or together!"
18100 cpp_stuff=42
18101elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18102 echo "Ah, yes! The good old days!" >&4
18103 echo "However, in the good old days we don't know how to stringify and"
18104 echo "catify at the same time."
18105 cpp_stuff=1
18106else
18107 $cat >&4 <<EOM
92b39ff2
JH
18108Hmm, I don't seem to be able to concatenate tokens with your cpp.
18109You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18110EOM
18111 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18112fi
18113$rm -f cpp_stuff.*
18114
18115: see if this is a db.h system
18116set db.h i_db
18117eval $inhdr
18118
18119case "$i_db" in
18120$define)
18121 : Check db version.
18122 echo " "
18123 echo "Checking Berkeley DB version ..." >&4
18124 $cat >try.c <<EOCP
18125#$d_const HASCONST
18126#ifndef HASCONST
18127#define const
18128#endif
18129#include <sys/types.h>
18130#include <stdio.h>
5a29c6bc
JH
18131#$i_stdlib I_STDLIB
18132#ifdef I_STDLIB
18133#include <stdlib.h>
18134#endif
b4eb6b3d 18135#include <db.h>
640374d0 18136int main(int argc, char *argv[])
b4eb6b3d
JH
18137{
18138#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18139 int Major, Minor, Patch ;
18140 unsigned long Version ;
18141 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18142 if (argc == 2) {
18143 printf("%d %d %d %d %d %d\n",
18144 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18145 Major, Minor, Patch);
18146 exit(0);
18147 }
18148 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18149
18150 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18151 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18152 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18153 Major, Minor, Patch) ;
18154
18155 /* check that db.h & libdb are compatible */
18156 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18157 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
18158 exit(3);
18159 }
18160
640374d0 18161 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18162
18163 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18164 + DB_VERSION_PATCH ;
18165
18166 /* needs to be >= 2.3.4 */
18167 if (Version < 2003004) {
18168 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18169 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
18170 exit(2);
18171 }
18172
18173 exit(0);
18174#else
18175#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18176 if (argc == 2) {
18177 printf("1 0 0\n");
18178 exit(0);
18179 }
18180 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18181 exit(0); /* DB version < 2: the coast is clear. */
18182#else
18183 exit(1); /* <db.h> not Berkeley DB? */
18184#endif
18185#endif
18186}
18187EOCP
18188 set try
5440bc8e 18189 if eval $compile_ok && $run ./try; then
b4eb6b3d 18190 echo 'Looks OK.' >&4
5440bc8e 18191 set `$run ./try 1`
640374d0
JH
18192 db_version_major=$1
18193 db_version_minor=$2
18194 db_version_patch=$3
b4eb6b3d
JH
18195 else
18196 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18197 i_db=$undef
18198 case " $libs " in
18199 *"-ldb "*)
18200 : Remove db from list of libraries to use
18201 echo "Removing unusable -ldb from library list" >&4
18202 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18203 shift
18204 libs="$*"
18205 echo "libs = $libs" >&4
18206 ;;
18207 esac
18208 fi
18209 $rm -f try.*
18210 ;;
18211esac
18212
18213case "$i_db" in
18214define)
18215 : Check the return type needed for hash
18216 echo " "
18217 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18218 $cat >try.c <<EOCP
18219#$d_const HASCONST
18220#ifndef HASCONST
18221#define const
18222#endif
18223#include <sys/types.h>
18224#include <db.h>
18225
18226#ifndef DB_VERSION_MAJOR
18227u_int32_t hash_cb (ptr, size)
18228const void *ptr;
18229size_t size;
18230{
18231}
18232HASHINFO info;
18233int main()
18234{
18235 info.hash = hash_cb;
18236}
18237#endif
18238EOCP
18239 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18240 if $contains warning try.out >>/dev/null 2>&1 ; then
18241 db_hashtype='int'
18242 else
18243 db_hashtype='u_int32_t'
18244 fi
18245 else
18246 : XXX Maybe we should just give up here.
18247 db_hashtype=u_int32_t
18248 $cat try.out >&4
18249 echo "Help: I can't seem to compile the db test program." >&4
18250 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18251 fi
18252 $rm -f try.*
18253 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18254 ;;
18255*) db_hashtype=u_int32_t
18256 ;;
18257esac
18258case "$i_db" in
18259define)
18260 : Check the return type needed for prefix
18261 echo " "
18262 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18263 cat >try.c <<EOCP
18264#$d_const HASCONST
18265#ifndef HASCONST
18266#define const
18267#endif
18268#include <sys/types.h>
18269#include <db.h>
18270
18271#ifndef DB_VERSION_MAJOR
18272size_t prefix_cb (key1, key2)
18273const DBT *key1;
18274const DBT *key2;
18275{
18276}
18277BTREEINFO info;
18278int main()
18279{
18280 info.prefix = prefix_cb;
18281}
18282#endif
18283EOCP
18284 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18285 if $contains warning try.out >>/dev/null 2>&1 ; then
18286 db_prefixtype='int'
18287 else
18288 db_prefixtype='size_t'
18289 fi
18290 else
18291 db_prefixtype='size_t'
18292 : XXX Maybe we should just give up here.
18293 $cat try.out >&4
18294 echo "Help: I can't seem to compile the db test program." >&4
18295 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18296 fi
18297 $rm -f try.*
18298 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18299 ;;
18300*) db_prefixtype='size_t'
18301 ;;
18302esac
18303
b4eb6b3d
JH
18304
18305: How can we generate normalized random numbers ?
18306echo " "
18307echo "Looking for a random number function..." >&4
18308case "$randfunc" in
18309'')
18310 if set drand48 val -f; eval $csym; $val; then
18311 dflt="drand48"
18312 echo "Good, found drand48()." >&4
18313 elif set random val -f; eval $csym; $val; then
18314 dflt="random"
18315 echo "OK, found random()." >&4
18316 else
18317 dflt="rand"
18318 echo "Yick, looks like I have to use rand()." >&4
18319 fi
18320 echo " "
18321 ;;
18322*)
18323 dflt="$randfunc"
18324 ;;
18325esac
18326cont=true
18327
18328case "$ccflags" in
18329*-Dmy_rand=*|*-Dmy_srand=*)
18330 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18331 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18332 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18333 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18334 ;;
18335esac
18336
18337while $test "$cont"; do
18338 rp="Use which function to generate random numbers?"
18339 . ./myread
18340 if $test "$ans" = "$dflt"; then
18341 : null
18342 else
18343 randbits=''
18344 fi
18345 randfunc="$ans"
18346 if set $ans val -f; eval $csym; $val; then
18347 cont=''
18348 else
18349 dflt=y
18350 rp="I cannot find function $ans. Use that name anyway?"
18351 . ./myread
18352 dflt=rand
18353 case "$ans" in
18354 [yY]*) cont='';;
18355 esac
18356 fi
18357 case "$cont" in
18358 '')
18359 case "$randfunc" in
18360 drand48)
18361 drand01="drand48()"
18362 seedfunc="srand48"
18363 randbits=48
18364 randseedtype=long
18365 ;;
18366 rand|random)
18367 case "$randbits" in
18368 '')
18369echo "Checking to see how many bits your $randfunc() function produces..." >&4
18370 $cat >try.c <<EOCP
18371#$i_unistd I_UNISTD
18372#$i_stdlib I_STDLIB
18373#include <stdio.h>
18374#ifdef I_UNISTD
18375# include <unistd.h>
18376#endif
18377#ifdef I_STDLIB
18378# include <stdlib.h>
18379#endif
18380int main()
18381{
18382 register int i;
18383 register unsigned long tmp;
18384 register unsigned long max = 0L;
18385
18386 for (i = 1000; i; i--) {
18387 tmp = (unsigned long) $randfunc();
18388 if (tmp > max) max = tmp;
18389 }
18390 for (i = 0; max; i++)
18391 max /= 2;
18392 printf("%d\n",i);
18393}
18394EOCP
18395 set try
18396 if eval $compile_ok; then
18397 dflt=`try`
18398 else
18399 dflt='?'
18400 echo "(I can't seem to compile the test program...)"
18401 fi
18402 ;;
18403 *)
18404 dflt="$randbits"
18405 ;;
18406 esac
18407 rp="How many bits does your $randfunc() function produce?"
18408 . ./myread
18409 randbits="$ans"
18410 $rm -f try.c try
18411 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18412 seedfunc="s$randfunc"
18413 randseedtype=unsigned
18414 ;;
18415 *)
18416 dflt="31"
18417 rp="How many bits does your $randfunc() function produce?"
18418 . ./myread
18419 randbits="$ans"
18420 seedfunc="s$randfunc"
18421 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18422 if set $seedfunc val -f; eval $csym; $val; then
18423 echo "(Using $seedfunc() to seed random generator)"
18424 else
18425 echo "(Warning: no $seedfunc() to seed random generator)"
18426 seedfunc=rand
18427 fi
18428 randseedtype=unsigned
18429 ;;
18430 esac
18431 ;;
18432 esac
18433done
18434
18435echo " "
18436echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18437$cat >try.c <<'EOM'
b4eb6b3d
JH
18438int main()
18439{
18440 if ('M'==0xd4) return 0;
18441 return 1;
18442}
18443EOM
18444
18445val=$undef
5440bc8e 18446set try
b4eb6b3d 18447if eval $compile_ok; then
5440bc8e 18448 if $run ./try; then
b4eb6b3d
JH
18449 echo "You seem to speak EBCDIC." >&4
18450 val="$define"
18451 else
5440bc8e 18452 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18453 fi
18454else
18455 echo "I'm unable to compile the test program." >&4
18456 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18457fi
5440bc8e 18458$rm -f try try.*
b4eb6b3d
JH
18459set ebcdic
18460eval $setvar
18461
18462echo " "
18463$cat >&4 <<EOM
18464Checking how to flush all pending stdio output...
18465EOM
18466# I only know how to find the first 32 possibly open files on SunOS.
18467# See also hints/sunos_4_1.sh and util.c --AD
18468case "$osname" in
18469sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18470esac
18471$cat >>try.c <<EOCP
18472#include <stdio.h>
5a29c6bc
JH
18473#$i_stdlib I_STDLIB
18474#ifdef I_STDLIB
18475#include <stdlib.h>
18476#endif
b4eb6b3d
JH
18477#$i_unistd I_UNISTD
18478#ifdef I_UNISTD
18479# include <unistd.h>
18480#endif
18481#$d_sysconf HAS_SYSCONF
18482#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18483#ifdef HAS_STDIO_STREAM_ARRAY
18484# define STDIO_STREAM_ARRAY $stdio_stream_array
18485#endif
18486int main() {
5440bc8e
JH
18487 FILE* p;
18488 unlink("try.out");
18489 p = fopen("try.out", "w");
b4eb6b3d
JH
18490#ifdef TRY_FPUTC
18491 fputc('x', p);
18492#else
18493# ifdef TRY_FPRINTF
18494 fprintf(p, "x");
18495# endif
18496#endif
18497#ifdef TRY_FFLUSH_NULL
18498 fflush(NULL);
18499#endif
18500#ifdef TRY_FFLUSH_ALL
18501 {
18502 long open_max = -1;
18503# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18504 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18505# else
18506# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18507 open_max = sysconf(_SC_OPEN_MAX);
18508# else
18509# ifdef FOPEN_MAX
18510 open_max = FOPEN_MAX;
18511# else
18512# ifdef OPEN_MAX
18513 open_max = OPEN_MAX;
18514# else
18515# ifdef _NFILE
18516 open_max = _NFILE;
18517# endif
18518# endif
18519# endif
18520# endif
18521# endif
18522# ifdef HAS_STDIO_STREAM_ARRAY
18523 if (open_max > 0) {
18524 long i;
18525 for (i = 0; i < open_max; i++)
18526 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18527 STDIO_STREAM_ARRAY[i]._file < open_max &&
18528 STDIO_STREAM_ARRAY[i]._flag)
18529 fflush(&STDIO_STREAM_ARRAY[i]);
18530 }
18531 }
18532# endif
18533#endif
18534 _exit(42);
18535}
18536EOCP
18537: first we have to find out how _not_ to flush
5440bc8e 18538$to try.c
b4eb6b3d
JH
18539if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18540 output=''
18541 set try -DTRY_FPUTC
18542 if eval $compile; then
fbe73d74 18543 $run ./try 2>/dev/null
28f5ac64 18544 code="$?"
5440bc8e 18545 $from try.out
28f5ac64 18546 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18547 output=-DTRY_FPUTC
18548 fi
18549 fi
18550 case "$output" in
18551 '')
18552 set try -DTRY_FPRINTF
b4eb6b3d 18553 if eval $compile; then
fbe73d74 18554 $run ./try 2>/dev/null
28f5ac64 18555 code="$?"
5440bc8e 18556 $from try.out
28f5ac64 18557 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18558 output=-DTRY_FPRINTF
18559 fi
18560 fi
18561 ;;
18562 esac
18563fi
18564: check for fflush NULL behaviour
18565case "$fflushNULL" in
18566'') set try -DTRY_FFLUSH_NULL $output
18567 if eval $compile; then
5440bc8e 18568 $run ./try 2>/dev/null
b4eb6b3d 18569 code="$?"
5440bc8e 18570 $from try.out
b4eb6b3d
JH
18571 if $test -s try.out -a "X$code" = X42; then
18572 fflushNULL="`$cat try.out`"
18573 else
18574 if $test "X$code" != X42; then
18575 $cat >&4 <<EOM
18576(If this test failed, don't worry, we'll try another method shortly.)
18577EOM
18578 fi
18579 fi
18580 fi
18581 $rm -f core try.core core.try.*
18582 case "$fflushNULL" in
18583 x) $cat >&4 <<EOM
18584Your fflush(NULL) works okay for output streams.
18585Let's see if it clobbers input pipes...
18586EOM
18587# As of mid-March 2000 all versions of Solaris appear to have a stdio
18588# bug that improperly flushes the input end of pipes. So we avoid the
18589# autoflush on fork/system/exec support for now. :-(
18590$cat >tryp.c <<EOCP
18591#include <stdio.h>
18592int
18593main(int argc, char **argv)
18594{
18595 char buf[1024];
18596 int i;
18597 char *bp = buf;
18598 while (1) {
18599 while ((i = getc(stdin)) != -1
18600 && (*bp++ = i) != '\n'
18601 && bp < &buf[1024])
18602 /* DO NOTHING */ ;
18603 *bp = '\0';
18604 fprintf(stdout, "%s", buf);
18605 fflush(NULL);
18606 if (i == -1)
18607 return 0;
18608 bp = buf;
18609 }
18610}
18611EOCP
18612 fflushNULL="$define"
18613 set tryp
18614 if eval $compile; then
18615 $rm -f tryp.out
5440bc8e 18616 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18617 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18618 $cat >&4 <<EOM
18619fflush(NULL) seems to behave okay with input streams.
18620EOM
18621 fflushNULL="$define"
18622 else
18623 $cat >&4 <<EOM
18624Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18625EOM
18626 fflushNULL="$undef"
18627 fi
18628 fi
18629 $rm -f core tryp.c tryp.core core.tryp.*
18630 ;;
18631 '') $cat >&4 <<EOM
18632Your fflush(NULL) isn't working (contrary to ANSI C).
18633EOM
18634 fflushNULL="$undef"
18635 ;;
18636 *) $cat >&4 <<EOM
18637Cannot figure out whether your fflush(NULL) works or not.
18638I'm assuming it doesn't (contrary to ANSI C).
18639EOM
18640 fflushNULL="$undef"
18641 ;;
18642 esac
18643 ;;
18644$define|true|[yY]*)
18645 fflushNULL="$define"
18646 ;;
18647*)
18648 fflushNULL="$undef"
18649 ;;
18650esac
18651: check explicit looping only if NULL did not work, and if the pipe
18652: bug does not show up on an explicit flush too
18653case "$fflushNULL" in
18654"$undef")
18655 $cat >tryp.c <<EOCP
18656#include <stdio.h>
18657int
18658main(int argc, char **argv)
18659{
18660 char buf[1024];
18661 int i;
18662 char *bp = buf;
18663 while (1) {
18664 while ((i = getc(stdin)) != -1
18665 && (*bp++ = i) != '\n'
18666 && bp < &buf[1024])
18667 /* DO NOTHING */ ;
18668 *bp = '\0';
18669 fprintf(stdout, "%s", buf);
18670 fflush(stdin);
18671 if (i == -1)
18672 return 0;
18673 bp = buf;
18674 }
18675}
18676EOCP
18677 set tryp
18678 if eval $compile; then
18679 $rm -f tryp.out
5440bc8e 18680 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18681 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18682 $cat >&4 <<EOM
18683Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18684EOM
18685 : now check for fflushall behaviour
18686 case "$fflushall" in
18687 '') set try -DTRY_FFLUSH_ALL $output
18688 if eval $compile; then
18689 $cat >&4 <<EOM
18690(Now testing the other method--but note that this also may fail.)
18691EOM
5440bc8e 18692 $run ./try 2>/dev/null
28f5ac64 18693 code=$?
fbe73d74 18694 $from try.out
28f5ac64 18695 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18696 fflushall="`$cat try.out`"
18697 fi
18698 fi
18699 $rm -f core try.core core.try.*
18700 case "$fflushall" in
18701 x) $cat >&4 <<EOM
18702Whew. Flushing explicitly all the stdio streams works.
18703EOM
18704 fflushall="$define"
18705 ;;
18706 '') $cat >&4 <<EOM
18707Sigh. Flushing explicitly all the stdio streams doesn't work.
18708EOM
18709 fflushall="$undef"
18710 ;;
18711 *) $cat >&4 <<EOM
18712Cannot figure out whether flushing stdio streams explicitly works or not.
18713I'm assuming it doesn't.
18714EOM
18715 fflushall="$undef"
18716 ;;
18717 esac
18718 ;;
18719 "$define"|true|[yY]*)
18720 fflushall="$define"
18721 ;;
18722 *)
18723 fflushall="$undef"
18724 ;;
18725 esac
18726 else
18727 $cat >&4 <<EOM
18728All is futile. Even fflush(stdin) clobbers input pipes!
18729EOM
18730 fflushall="$undef"
18731 fi
18732 else
18733 fflushall="$undef"
18734 fi
18735 $rm -f core tryp.c tryp.core core.tryp.*
18736 ;;
18737*) fflushall="$undef"
18738 ;;
18739esac
18740
18741case "$fflushNULL$fflushall" in
18742undefundef)
18743 $cat <<EOM
18744OK, I give up. I cannot figure out how to flush pending stdio output.
18745We won't be flushing handles at all before fork/exec/popen.
18746EOM
18747 ;;
18748esac
18749$rm -f try.* try$exe_ext
18750
18751: Store the full pathname to the ar program for use in the C program
18752: Respect a hint or command line value for full_ar.
18753case "$full_ar" in
18754'') full_ar=$ar ;;
18755esac
18756
18757: Store the full pathname to the sed program for use in the C program
18758full_sed=$sed
18759
18760: see what type gids are declared as in the kernel
18761echo " "
18762echo "Looking for the type for group ids returned by getgid()."
18763set gid_t gidtype xxx stdio.h sys/types.h
18764eval $typedef
18765case "$gidtype" in
18766xxx)
18767 xxx=`./findhdr sys/user.h`
18768 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18769 case $1 in
18770 unsigned) dflt="$1 $2" ;;
18771 *) dflt="$1" ;;
18772 esac
18773 ;;
18774*) dflt="$gidtype";;
18775esac
18776case "$gidtype" in
18777gid_t) echo "gid_t found." ;;
18778*) rp="What is the type for group ids returned by getgid()?"
18779 . ./myread
18780 gidtype="$ans"
18781 ;;
18782esac
18783
18784echo " "
18785case "$gidtype" in
18786*_t) zzz="$gidtype" ;;
18787*) zzz="gid" ;;
18788esac
18789echo "Checking the size of $zzz..." >&4
18790cat > try.c <<EOCP
18791#include <sys/types.h>
18792#include <stdio.h>
5ed858ef
JH
18793#$i_stdlib I_STDLIB
18794#ifdef I_STDLIB
18795#include <stdlib.h>
18796#endif
b4eb6b3d
JH
18797int main() {
18798 printf("%d\n", (int)sizeof($gidtype));
18799 exit(0);
18800}
18801EOCP
18802set try
18803if eval $compile_ok; then
5440bc8e 18804 yyy=`$run ./try`
b4eb6b3d
JH
18805 case "$yyy" in
18806 '') gidsize=4
18807 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18808 ;;
18809 *) gidsize=$yyy
18810 echo "Your $zzz is $gidsize bytes long."
18811 ;;
18812 esac
18813else
18814 gidsize=4
18815 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18816fi
18817
18818
18819echo " "
18820case "$gidtype" in
18821*_t) zzz="$gidtype" ;;
18822*) zzz="gid" ;;
18823esac
18824echo "Checking the sign of $zzz..." >&4
18825cat > try.c <<EOCP
18826#include <sys/types.h>
18827#include <stdio.h>
18828int main() {
18829 $gidtype foo = -1;
18830 if (foo < 0)
18831 printf("-1\n");
18832 else
18833 printf("1\n");
18834}
18835EOCP
18836set try
18837if eval $compile; then
5440bc8e 18838 yyy=`$run ./try`
b4eb6b3d
JH
18839 case "$yyy" in
18840 '') gidsign=1
18841 echo "(I can't execute the test program--guessing unsigned.)" >&4
18842 ;;
18843 *) gidsign=$yyy
18844 case "$gidsign" in
18845 1) echo "Your $zzz is unsigned." ;;
18846 -1) echo "Your $zzz is signed." ;;
18847 esac
18848 ;;
18849 esac
18850else
18851 gidsign=1
18852 echo "(I can't compile the test program--guessing unsigned.)" >&4
18853fi
18854
18855
18856echo " "
18857
18858if $test X"$quadtype" != X; then
18859
18860echo "Checking how to print 64-bit integers..." >&4
18861
18862if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18863 $cat >try.c <<'EOCP'
18864#include <sys/types.h>
18865#include <stdio.h>
18866int main() {
18867 int q = 12345678901;
18868 printf("%ld\n", q);
18869}
18870EOCP
18871 set try
18872 if eval $compile; then
5440bc8e 18873 yyy=`$run ./try`
b4eb6b3d
JH
18874 case "$yyy" in
18875 12345678901)
18876 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18877 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18878 echo "We will use %d."
18879 ;;
18880 esac
18881 fi
18882fi
18883
18884if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18885 $cat >try.c <<'EOCP'
18886#include <sys/types.h>
18887#include <stdio.h>
18888int main() {
18889 long q = 12345678901;
18890 printf("%ld\n", q);
18891}
18892EOCP
18893 set try
18894 if eval $compile; then
5440bc8e 18895 yyy=`$run ./try`
b4eb6b3d
JH
18896 case "$yyy" in
18897 12345678901)
18898 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18899 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18900 echo "We will use %ld."
18901 ;;
18902 esac
18903 fi
18904fi
18905
18906if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18907 $cat >try.c <<'EOCP'
18908#include <sys/types.h>
18909#include <inttypes.h>
18910#include <stdio.h>
18911int main() {
18912 int64_t q = 12345678901;
18913 printf("%" PRId64 "\n", q);
18914}
18915EOCP
18916 set try
18917 if eval $compile; then
5440bc8e 18918 yyy=`$run ./try`
b4eb6b3d
JH
18919 case "$yyy" in
18920 12345678901)
18921 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18922 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18923 echo "We will use the C9X style."
18924 ;;
18925 esac
18926 fi
18927fi
18928
2ef53570
JH
18929if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18930 $cat >try.c <<EOCP
b4eb6b3d
JH
18931#include <sys/types.h>
18932#include <stdio.h>
18933int main() {
2ef53570
JH
18934 $quadtype q = 12345678901;
18935 printf("%Ld\n", q);
b4eb6b3d
JH
18936}
18937EOCP
18938 set try
18939 if eval $compile; then
5440bc8e 18940 yyy=`$run ./try`
b4eb6b3d
JH
18941 case "$yyy" in
18942 12345678901)
2ef53570
JH
18943 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18944 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18945 echo "We will use %Ld."
b4eb6b3d
JH
18946 ;;
18947 esac
18948 fi
18949fi
18950
2ef53570
JH
18951if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18952 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18953#include <sys/types.h>
18954#include <stdio.h>
18955int main() {
2ef53570
JH
18956 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18957 printf("%lld\n", q);
b4eb6b3d
JH
18958}
18959EOCP
18960 set try
18961 if eval $compile; then
5440bc8e 18962 yyy=`$run ./try`
b4eb6b3d
JH
18963 case "$yyy" in
18964 12345678901)
2ef53570
JH
18965 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18966 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18967 echo "We will use the %lld style."
b4eb6b3d
JH
18968 ;;
18969 esac
18970 fi
18971fi
18972
18973if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18974 $cat >try.c <<EOCP
18975#include <sys/types.h>
18976#include <stdio.h>
18977int main() {
18978 $quadtype q = 12345678901;
18979 printf("%qd\n", q);
18980}
18981EOCP
18982 set try
18983 if eval $compile; then
5440bc8e 18984 yyy=`$run ./try`
b4eb6b3d
JH
18985 case "$yyy" in
18986 12345678901)
18987 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18988 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18989 echo "We will use %qd."
18990 ;;
18991 esac
18992 fi
18993fi
18994
18995if $test X"$sPRId64" = X; then
18996 echo "Cannot figure out how to print 64-bit integers." >&4
18997fi
18998
18999$rm -f try try.*
19000
19001fi
19002
19003case "$sPRId64" in
19004'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19005 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19006 ;;
19007*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19008 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19009 ;;
19010esac
19011
19012
19013echo " "
19014$echo "Checking the format strings to be used for Perl's internal types..." >&4
19015
19016if $test X"$ivsize" = X8; then
19017 ivdformat="$sPRId64"
19018 uvuformat="$sPRIu64"
19019 uvoformat="$sPRIo64"
19020 uvxformat="$sPRIx64"
19021 uvXUformat="$sPRIXU64"
19022else
19023 if $test X"$ivsize" = X"$longsize"; then
19024 ivdformat='"ld"'
19025 uvuformat='"lu"'
19026 uvoformat='"lo"'
19027 uvxformat='"lx"'
19028 uvXUformat='"lX"'
19029 else
19030 if $test X"$ivsize" = X"$intsize"; then
19031 ivdformat='"d"'
19032 uvuformat='"u"'
19033 uvoformat='"o"'
19034 uvxformat='"x"'
19035 uvXUformat='"X"'
19036 else
19037 : far out
19038 if $test X"$ivsize" = X"$shortsize"; then
19039 ivdformat='"hd"'
19040 uvuformat='"hu"'
19041 uvoformat='"ho"'
19042 uvxformat='"hx"'
19043 uvXUformat='"hX"'
19044 fi
19045 fi
19046 fi
19047fi
19048
19049if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19050 nveformat="$sPRIeldbl"
19051 nvfformat="$sPRIfldbl"
19052 nvgformat="$sPRIgldbl"
19053 nvEUformat="$sPRIEUldbl"
19054 nvFUformat="$sPRIFUldbl"
19055 nvGUformat="$sPRIGUldbl"
19056else
19057 nveformat='"e"'
19058 nvfformat='"f"'
19059 nvgformat='"g"'
19060 nvEUformat='"E"'
19061 nvFUformat='"F"'
19062 nvGUformat='"G"'
19063fi
19064
19065case "$ivdformat" in
3c728e00 19066'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19067 exit 1
19068 ;;
19069esac
19070
19071
19072echo " "
19073$echo "Checking the format string to be used for gids..." >&4
19074
19075case "$gidsign" in
19076-1) if $test X"$gidsize" = X"$ivsize"; then
19077 gidformat="$ivdformat"
19078 else
19079 if $test X"$gidsize" = X"$longsize"; then
19080 gidformat='"ld"'
19081 else
19082 if $test X"$gidsize" = X"$intsize"; then
19083 gidformat='"d"'
19084 else
19085 if $test X"$gidsize" = X"$shortsize"; then
19086 gidformat='"hd"'
19087 fi
19088 fi
19089 fi
19090 fi
19091 ;;
19092*) if $test X"$gidsize" = X"$uvsize"; then
19093 gidformat="$uvuformat"
19094 else
19095 if $test X"$gidsize" = X"$longsize"; then
19096 gidformat='"lu"'
19097 else
19098 if $test X"$gidsize" = X"$intsize"; then
19099 gidformat='"u"'
19100 else
19101 if $test X"$gidsize" = X"$shortsize"; then
19102 gidformat='"hu"'
19103 fi
19104 fi
19105 fi
19106 fi
19107 ;;
19108esac
19109
19110: see if getgroups exists
19111set getgroups d_getgrps
19112eval $inlibc
19113
19114: see if setgroups exists
19115set setgroups d_setgrps
19116eval $inlibc
19117
19118
19119: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19120echo " "
19121case "$d_getgrps$d_setgrps" in
19122*define*)
19123 case "$groupstype" in
19124 '') dflt="$gidtype" ;;
19125 *) dflt="$groupstype" ;;
19126 esac
19127 $cat <<EOM
19128What type of pointer is the second argument to getgroups() and setgroups()?
19129Usually this is the same as group ids, $gidtype, but not always.
19130
19131EOM
19132 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19133 . ./myread
19134 groupstype="$ans"
19135 ;;
19136*) groupstype="$gidtype";;
19137esac
19138
5109a103 19139
de7128ac
NC
19140if $test $patchlevel -lt 9; then
19141: MAD is not available in 5.8.x or earlier.
19142 ans=n;
19143else
19144 case "$mad" in
19145 $define|true|[yY]*) dflt='y' ;;
19146 *) dflt='n' ;;
19147 esac
19148 cat <<EOM
5109a103
NC
19149
19150Would you like to build with Misc Attribute Decoration? This is development
19151work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19152overhead on the interpreter.
19153
19154If this doesn't make any sense to you, just accept the default '$dflt'.
19155EOM
de7128ac
NC
19156 rp='Build Perl with MAD?'
19157 . ./myread
19158fi
5109a103
NC
19159case "$ans" in
19160y|Y) val="$define"
19161 madlyh='madly.h madly.act madly.tab'
19162 madlysrc='madly.c'
19163 madlyobj="madly$_o" ;;
19164*) val="$undef"
19165 madlyh=''
19166 madlysrc=''
19167 madlyobj='' ;;
19168esac
19169set mad
19170eval $setvar
19171
b4eb6b3d
JH
19172echo " "
19173echo "Checking if your $make program sets \$(MAKE)..." >&4
19174case "$make_set_make" in
19175'')
19176 $sed 's/^X //' > testmake.mak << 'EOF'
19177Xall:
19178X @echo 'maketemp="$(MAKE)"'
19179EOF
19180 case "`$make -f testmake.mak 2>/dev/null`" in
19181 *maketemp=*) make_set_make='#' ;;
19182 *) make_set_make="MAKE=$make" ;;
19183 esac
19184 $rm -f testmake.mak
19185 ;;
19186esac
19187case "$make_set_make" in
19188'#') echo "Yup, it does.";;
19189*) echo "Nope, it doesn't.";;
19190esac
19191
19192: see what type is used for mode_t
19193rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19194set mode_t modetype int stdio.h sys/types.h
19195eval $typedef_ask
19196
2cc61e15
DD
19197: see if we need va_copy
19198echo " "
19199case "$i_stdarg" in
19200"$define")
19201 $cat >try.c <<EOCP
19202#include <stdarg.h>
19203#include <stdio.h>
85c8a686
DD
19204#$i_stdlib I_STDLIB
19205#ifdef I_STDLIB
19206#include <stdlib.h>
19207#endif
19208#include <signal.h>
2cc61e15
DD
19209
19210int
19211ivfprintf(FILE *f, const char *fmt, va_list *valp)
19212{
19213 return vfprintf(f, fmt, *valp);
19214}
19215
19216int
19217myvfprintf(FILE *f, const char *fmt, va_list val)
19218{
19219 return ivfprintf(f, fmt, &val);
19220}
19221
19222int
19223myprintf(char *fmt, ...)
19224{
19225 va_list val;
19226 va_start(val, fmt);
19227 return myvfprintf(stdout, fmt, val);
19228}
19229
19230int
19231main(int ac, char **av)
19232{
85c8a686
DD
19233 signal(SIGSEGV, exit);
19234
2cc61e15
DD
19235 myprintf("%s%cs all right, then\n", "that", '\'');
19236 exit(0);
19237}
19238EOCP
19239 set try
5440bc8e
JH
19240 if eval $compile && $run ./try 2>&1 >/dev/null; then
19241 case "`$run ./try`" in
2cc61e15
DD
19242 "that's all right, then")
19243 okay=yes
19244 ;;
19245 esac
19246 fi
19247 case "$okay" in
19248 yes) echo "It seems that you don't need va_copy()." >&4
19249 need_va_copy="$undef"
19250 ;;
19251 *) echo "It seems that va_copy() or similar will be needed." >&4
19252 need_va_copy="$define"
19253 ;;
19254 esac
19255 $rm -f try.* core core.* *.core *.core.*
19256 ;;
19257*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19258 ;;
19259esac
19260
b4eb6b3d
JH
19261: see what type is used for size_t
19262rp="What is the type used for the length parameter for string functions?"
19263set size_t sizetype 'unsigned int' stdio.h sys/types.h
19264eval $typedef_ask
19265
19266: check for type of arguments to gethostbyaddr.
19267if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19268 case "$d_gethbyaddr" in
19269 $define)
19270 $cat <<EOM
19271
19272Checking to see what type of arguments are accepted by gethostbyaddr().
19273EOM
19274 hdrs="$define sys/types.h
19275 $d_socket sys/socket.h
19276 $i_niin netinet/in.h
19277 $i_netdb netdb.h
19278 $i_unistd unistd.h"
19279 : The first arg can 'char *' or 'void *'
19280 : The second arg is some of integral type
19281 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19282 for yyy in size_t long int; do
19283 case "$netdb_host_type" in
19284 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19285 if ./protochk "$try" $hdrs; then
19286 echo "Your system accepts $xxx for the first arg."
19287 echo "...and $yyy for the second arg."
19288 netdb_host_type="$xxx"
19289 netdb_hlen_type="$yyy"
19290 fi
19291 ;;
19292 esac
19293 done
19294 done
19295 : In case none of those worked, prompt the user.
19296 case "$netdb_host_type" in
19297 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19298 dflt='char *'
19299 . ./myread
19300 netdb_host_type=$ans
19301 rp='What is the type for the 2nd argument to gethostbyaddr?'
19302 dflt="$sizetype"
19303 . ./myread
19304 netdb_hlen_type=$ans
19305 ;;
19306 esac
19307 ;;
19308 *) : no gethostbyaddr, so pick harmless defaults
19309 netdb_host_type='char *'
19310 netdb_hlen_type="$sizetype"
19311 ;;
19312 esac
19313 # Remove the "const" if needed. -- but then we'll have a
19314 # prototype clash!
19315 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19316fi
19317
19318: check for type of argument to gethostbyname.
19319if test "X$netdb_name_type" = X ; then
19320 case "$d_gethbyname" in
19321 $define)
19322 $cat <<EOM
19323
19324Checking to see what type of argument is accepted by gethostbyname().
19325EOM
19326 hdrs="$define sys/types.h
19327 $d_socket sys/socket.h
19328 $i_niin netinet/in.h
19329 $i_netdb netdb.h
19330 $i_unistd unistd.h"
19331 for xxx in "const char *" "char *"; do
19332 case "$netdb_name_type" in
19333 '') try="extern struct hostent *gethostbyname($xxx);"
19334 if ./protochk "$try" $hdrs; then
19335 echo "Your system accepts $xxx."
19336 netdb_name_type="$xxx"
19337 fi
19338 ;;
19339 esac
19340 done
19341 : In case none of those worked, prompt the user.
19342 case "$netdb_name_type" in
19343 '') rp='What is the type for the 1st argument to gethostbyname?'
19344 dflt='char *'
19345 . ./myread
19346 netdb_name_type=$ans
19347 ;;
19348 esac
19349 ;;
19350 *) : no gethostbyname, so pick harmless default
19351 netdb_name_type='char *'
19352 ;;
19353 esac
19354fi
19355
19356: check for type of 1st argument to getnetbyaddr.
19357if test "X$netdb_net_type" = X ; then
19358 case "$d_getnbyaddr" in
19359 $define)
19360 $cat <<EOM
19361
19362Checking to see what type of 1st argument is accepted by getnetbyaddr().
19363EOM
19364 hdrs="$define sys/types.h
19365 $d_socket sys/socket.h
19366 $i_niin netinet/in.h
19367 $i_netdb netdb.h
19368 $i_unistd unistd.h"
19369 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19370 case "$netdb_net_type" in
19371 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19372 if ./protochk "$try" $hdrs; then
19373 echo "Your system accepts $xxx."
19374 netdb_net_type="$xxx"
19375 fi
19376 ;;
19377 esac
19378 done
19379 : In case none of those worked, prompt the user.
19380 case "$netdb_net_type" in
19381 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19382 dflt='long'
19383 . ./myread
19384 netdb_net_type=$ans
19385 ;;
19386 esac
19387 ;;
19388 *) : no getnetbyaddr, so pick harmless default
19389 netdb_net_type='long'
19390 ;;
19391 esac
19392fi
19393: locate the preferred pager for this system
d604bb53 19394fn=f/
b4eb6b3d
JH
19395case "$pager" in
19396'')
19397 dflt=''
19398 case "$pg" in
19399 /*) dflt=$pg;;
19400 [a-zA-Z]:/*) dflt=$pg;;
19401 esac
19402 case "$more" in
19403 /*) dflt=$more;;
19404 [a-zA-Z]:/*) dflt=$more;;
19405 esac
19406 case "$less" in
19407 /*) dflt=$less;;
19408 [a-zA-Z]:/*) dflt=$less;;
19409 esac
19410 case "$dflt" in
19411 '') dflt=/usr/ucb/more;;
19412 esac
19413 ;;
d604bb53
JH
19414*) dflt="$pager"
19415 : Instruct ./getfile to trust the hinted or previous pager value,
19416 : even if it does not begin with a slash. For example, on os2,
19417 : pager might be cmd /c more. See comments in UU/getfile.
19418 fn="f/($pager)"
19419 ;;
b4eb6b3d
JH
19420esac
19421echo " "
b4eb6b3d
JH
19422rp='What pager is used on your system?'
19423. ./getfile
19424pager="$ans"
19425
19426: see what type pids are declared as in the kernel
19427rp="What is the type of process ids on this system?"
19428set pid_t pidtype int stdio.h sys/types.h
19429eval $typedef_ask
19430
b4eb6b3d
JH
19431: see if ar generates random libraries by itself
19432echo " "
19433echo "Checking how to generate random libraries on your machine..." >&4
19434echo 'int bar1() { return bar2(); }' > bar1.c
19435echo 'int bar2() { return 2; }' > bar2.c
5a29c6bc
JH
19436$cat > foo.c <<EOP
19437#$i_stdlib I_STDLIB
19438#ifdef I_STDLIB
19439#include <stdlib.h>
19440#endif
b4eb6b3d
JH
19441int main() { printf("%d\n", bar1()); exit(0); }
19442EOP
19443$cc $ccflags -c bar1.c >/dev/null 2>&1
19444$cc $ccflags -c bar2.c >/dev/null 2>&1
19445$cc $ccflags -c foo.c >/dev/null 2>&1
19446$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19447if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19448 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19449 echo "$ar appears to generate random libraries itself."
19450 orderlib=false
cf011bf2
NC
19451 if [ "X$ranlib" = "X" ]; then
19452 ranlib=":"
19453 fi
5f7d02a9
NC
19454elif $ar s bar$_a >/dev/null 2>&1 &&
19455 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19456 $run ./foobar >/dev/null 2>&1; then
19457 echo "a table of contents needs to be added with '$ar s'."
19458 orderlib=false
19459 ranlib="$ar s"
b4eb6b3d 19460elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19461 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19462 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19463 echo "a table of contents needs to be added with '$ar ts'."
19464 orderlib=false
19465 ranlib="$ar ts"
19466else
19467 case "$ranlib" in
19468 :) ranlib='';;
19469 '')
19470 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19471 $test -f $ranlib || ranlib=''
19472 ;;
19473 esac
19474 if $test -n "$ranlib"; then
19475 echo "your system has '$ranlib'; we'll use that."
19476 orderlib=false
19477 else
19478 echo "your system doesn't seem to support random libraries"
19479 echo "so we'll use lorder and tsort to order the libraries."
19480 orderlib=true
19481 ranlib=":"
19482 fi
19483fi
5f7d02a9 19484$rm -f foo* bar*
b4eb6b3d
JH
19485
19486: check for type of arguments to select.
19487case "$selecttype" in
19488'') case "$d_select" in
19489 $define)
19490 echo " "
19491 $cat <<EOM
19492Checking to see what type of arguments are accepted by select().
19493EOM
19494 hdrs="$define sys/types.h
19495 $i_systime sys/time.h
19496 $i_sysselct sys/select.h
19497 $d_socket sys/socket.h"
19498 : The first arg can be int, unsigned, or size_t
19499 : The last arg may or may not be 'const'
19500 val=''
19501 : void pointer has been seen but using that
19502 : breaks the selectminbits test
19503 for xxx in 'fd_set *' 'int *'; do
19504 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19505 for tmo in 'struct timeval *' 'const struct timeval *'; do
19506 case "$val" in
19507 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19508 if ./protochk "$try" $hdrs; then
19509 echo "Your system accepts $xxx."
19510 val="$xxx"
19511 fi
19512 ;;
19513 esac
19514 done
19515 done
19516 done
19517 case "$val" in
19518 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19519 case "$d_fd_set" in
19520 $define) dflt="fd_set *" ;;
19521 *) dflt="int *" ;;
19522 esac
19523 . ./myread
19524 val=$ans
19525 ;;
19526 esac
19527 selecttype="$val"
19528 ;;
19529 *) : no select, so pick a harmless default
19530 selecttype='int *'
19531 ;;
19532 esac
19533 ;;
19534esac
19535
19536: check for the select 'width'
19537case "$selectminbits" in
5a29c6bc
JH
19538'') safebits=`expr $ptrsize \* 8`
19539 case "$d_select" in
b4eb6b3d
JH
19540 $define)
19541 $cat <<EOM
19542
19543Checking to see on how many bits at a time your select() operates...
19544EOM
19545 $cat >try.c <<EOCP
19546#include <sys/types.h>
19547#$i_time I_TIME
19548#$i_systime I_SYS_TIME
19549#$i_systimek I_SYS_TIME_KERNEL
19550#ifdef I_TIME
19551# include <time.h>
19552#endif
19553#ifdef I_SYS_TIME
19554# ifdef I_SYS_TIME_KERNEL
19555# define KERNEL
19556# endif
19557# include <sys/time.h>
19558# ifdef I_SYS_TIME_KERNEL
19559# undef KERNEL
19560# endif
19561#endif
19562#$i_sysselct I_SYS_SELECT
19563#ifdef I_SYS_SELECT
19564#include <sys/select.h>
19565#endif
19566#$d_socket HAS_SOCKET
19567#ifdef HAS_SOCKET
19568# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19569#endif
19570#include <stdio.h>
5ed858ef
JH
19571#$i_stdlib I_STDLIB
19572#ifdef I_STDLIB
19573#include <stdlib.h>
19574#endif
b4eb6b3d
JH
19575$selecttype b;
19576#define S sizeof(*(b))
19577#define MINBITS 64
19578#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19579#define NBITS (NBYTES * 8)
19580int main() {
5f7d02a9 19581 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
19582 struct timeval t;
19583 int i;
19584 FILE* fp;
19585 int fd;
19586
5a29c6bc
JH
19587 if (!s)
19588 exit(1);
b4eb6b3d
JH
19589 fclose(stdin);
19590 fp = fopen("try.c", "r");
19591 if (fp == 0)
5a29c6bc 19592 exit(2);
b4eb6b3d
JH
19593 fd = fileno(fp);
19594 if (fd < 0)
5a29c6bc 19595 exit(3);
b4eb6b3d
JH
19596 b = ($selecttype)s;
19597 for (i = 0; i < NBITS; i++)
19598 FD_SET(i, b);
19599 t.tv_sec = 0;
19600 t.tv_usec = 0;
19601 select(fd + 1, b, 0, 0, &t);
19602 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
5a29c6bc 19603 free(s);
b4eb6b3d
JH
19604 printf("%d\n", i + 1);
19605 return 0;
19606}
19607EOCP
19608 set try
19609 if eval $compile_ok; then
5440bc8e 19610 selectminbits=`$run ./try`
b4eb6b3d
JH
19611 case "$selectminbits" in
19612 '') cat >&4 <<EOM
19613Cannot figure out on how many bits at a time your select() operates.
5a29c6bc 19614I'll play safe and guess it is $safebits bits.
b4eb6b3d 19615EOM
5a29c6bc
JH
19616 selectminbits=$safebits
19617 bits="$safebits bits"
b4eb6b3d
JH
19618 ;;
19619 1) bits="1 bit" ;;
19620 *) bits="$selectminbits bits" ;;
19621 esac
19622 echo "Your select() operates on $bits at a time." >&4
19623 else
19624 rp='What is the minimum number of bits your select() operates on?'
19625 case "$byteorder" in
5a29c6bc
JH
19626 12345678) dflt=64 ;;
19627 1234) dflt=32 ;;
b4eb6b3d
JH
19628 *) dflt=1 ;;
19629 esac
19630 . ./myread
19631 val=$ans
19632 selectminbits="$val"
19633 fi
19634 $rm -f try.* try
19635 ;;
19636 *) : no select, so pick a harmless default
5a29c6bc 19637 selectminbits=$safebits
b4eb6b3d
JH
19638 ;;
19639 esac
19640 ;;
19641esac
19642
19643: Trace out the files included by signal.h, then look for SIGxxx names.
19644: Remove SIGARRAYSIZE used by HPUX.
19645: Remove SIGSTKSIZE used by Linux.
19646: Remove SIGSTKSZ used by Posix.
19647: Remove SIGTYP void lines used by OS2.
19648: Some cpps, like os390, dont give the file name anywhere
19649if [ "X$fieldn" = X ]; then
19650 : Just make some guesses. We check them later.
19651 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19652else
19653 xxx=`echo '#include <signal.h>' |
19654 $cppstdin $cppminus $cppflags 2>/dev/null |
19655 $grep '^[ ]*#.*include' |
a938a3bb 19656 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19657fi
19658: Check this list of files to be sure we have parsed the cpp output ok.
19659: This will also avoid potentially non-existent files, such
19660: as ../foo/bar.h
19661xxxfiles=''
19662for xx in $xxx /dev/null ; do
19663 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19664done
19665: If we have found no files, at least try signal.h
19666case "$xxxfiles" in
19667'') xxxfiles=`./findhdr signal.h` ;;
19668esac
19669xxx=`awk '
19670$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19671 print substr($2, 4, 20)
19672}
19673$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19674 print substr($3, 4, 20)
19675}' $xxxfiles`
19676: Append some common names just in case the awk scan failed.
19677xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19678xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19679xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19680xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19681xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19682
19683: generate a few handy files for later
5a29c6bc 19684$cat > signal.c <<EOCP
b4eb6b3d
JH
19685#include <sys/types.h>
19686#include <signal.h>
5a29c6bc
JH
19687#$i_stdlib I_STDLIB
19688#ifdef I_STDLIB
19689#include <stdlib.h>
19690#endif
b4eb6b3d
JH
19691#include <stdio.h>
19692int main() {
19693
19694/* Strange style to avoid deeply-nested #if/#else/#endif */
19695#ifndef NSIG
19696# ifdef _NSIG
19697# define NSIG (_NSIG)
19698# endif
19699#endif
19700
19701#ifndef NSIG
19702# ifdef SIGMAX
19703# define NSIG (SIGMAX+1)
19704# endif
19705#endif
19706
19707#ifndef NSIG
19708# ifdef SIG_MAX
19709# define NSIG (SIG_MAX+1)
19710# endif
19711#endif
19712
19713#ifndef NSIG
84a61f45
JH
19714# ifdef _SIG_MAX
19715# define NSIG (_SIG_MAX+1)
19716# endif
19717#endif
19718
19719#ifndef NSIG
b4eb6b3d
JH
19720# ifdef MAXSIG
19721# define NSIG (MAXSIG+1)
19722# endif
19723#endif
19724
19725#ifndef NSIG
19726# ifdef MAX_SIG
19727# define NSIG (MAX_SIG+1)
19728# endif
19729#endif
19730
19731#ifndef NSIG
19732# ifdef SIGARRAYSIZE
84a61f45 19733# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19734# endif
19735#endif
19736
19737#ifndef NSIG
19738# ifdef _sys_nsig
19739# define NSIG (_sys_nsig) /* Solaris 2.5 */
19740# endif
19741#endif
19742
19743/* Default to some arbitrary number that's big enough to get most
19744 of the common signals.
19745*/
19746#ifndef NSIG
19747# define NSIG 50
19748#endif
19749
19750printf("NSIG %d\n", NSIG);
19751
19752#ifndef JUST_NSIG
19753
19754EOCP
19755
19756echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19757{
19758 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19759 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19760 printf $1; printf ");\n"
19761 printf "#endif\n"
19762}
19763END {
19764 printf "#endif /* JUST_NSIG */\n";
19765 printf "exit(0);\n}\n";
19766}
19767' >>signal.c
19768$cat >signal.awk <<'EOP'
19769BEGIN { ndups = 0 }
65197d93 19770$1 ~ /^NSIG$/ { nsig = $2 }
582e5fa1 19771($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19772 if ($2 > maxsig) { maxsig = $2 }
19773 if (sig_name[$2]) {
19774 dup_name[ndups] = $1
19775 dup_num[ndups] = $2
b4eb6b3d
JH
19776 ndups++
19777 }
19778 else {
65197d93
JH
19779 sig_name[$2] = $1
19780 sig_num[$2] = $2
b4eb6b3d
JH
19781 }
19782}
19783END {
19784 if (nsig == 0) {
19785 nsig = maxsig + 1
19786 }
19787 printf("NSIG %d\n", nsig);
19788 for (n = 1; n < nsig; n++) {
19789 if (sig_name[n]) {
19790 printf("%s %d\n", sig_name[n], sig_num[n])
19791 }
19792 else {
19793 printf("NUM%d %d\n", n, n)
19794 }
19795 }
19796 for (n = 0; n < ndups; n++) {
19797 printf("%s %d\n", dup_name[n], dup_num[n])
19798 }
19799}
19800EOP
19801$cat >signal_cmd <<EOS
19802$startsh
19803if $test -s signal.lst; then
19804 echo "Using your existing signal.lst file"
19805 exit 0
19806fi
19807xxx="$xxx"
19808EOS
19809$cat >>signal_cmd <<'EOS'
19810
19811set signal
19812if eval $compile_ok; then
1eb9ad5b 19813 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19814else
19815 echo "(I can't seem be able to compile the whole test program)" >&4
19816 echo "(I'll try it in little pieces.)" >&4
19817 set signal -DJUST_NSIG
19818 if eval $compile_ok; then
5440bc8e 19819 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19820 $cat signal.nsg
19821 else
19822 echo "I can't seem to figure out how many signals you have." >&4
19823 echo "Guessing 50." >&4
19824 echo 'NSIG 50' > signal.nsg
19825 fi
19826 : Now look at all the signal names, one at a time.
19827 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19828 $cat > signal.c <<EOCP
19829#include <sys/types.h>
19830#include <signal.h>
19831#include <stdio.h>
19832int main() {
19833printf("$xx %d\n", SIG${xx});
19834return 0;
19835}
19836EOCP
19837 set signal
19838 if eval $compile; then
19839 echo "SIG${xx} found."
5440bc8e 19840 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19841 else
19842 echo "SIG${xx} NOT found."
19843 fi
19844 done
19845 if $test -s signal.ls1; then
19846 $cat signal.nsg signal.ls1 |
65197d93 19847 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19848 fi
19849
19850fi
19851if $test -s signal.lst; then
19852 :
19853else
19854 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19855 echo 'kill -l' >signal
19856 set X `csh -f <signal`
19857 $rm -f signal
19858 shift
19859 case $# in
19860 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19861 esac
19862 echo $@ | $tr ' ' $trnl | \
19863 $awk '{ printf "%s %d\n", $1, ++s; }
19864 END { printf "NSIG %d\n", ++s }' >signal.lst
19865fi
19866$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19867EOS
19868chmod a+x signal_cmd
19869$eunicefix signal_cmd
19870
19871: generate list of signal names
19872echo " "
19873case "$sig_name_init" in
19874'') doinit=yes ;;
19875*) case "$sig_num_init" in
19876 ''|*,*) doinit=yes ;;
19877 esac ;;
19878esac
19879case "$doinit" in
19880yes)
19881 echo "Generating a list of signal names and numbers..." >&4
19882 . ./signal_cmd
19883 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19884 sig_name=`$awk 'BEGIN { printf "ZERO " }
19885 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19886 sig_num=`$awk 'BEGIN { printf "0 " }
19887 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19888 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19889 !/^NSIG/ { printf "\"%s\", ", $1 }
19890 END { printf "0\n" }' signal.lst`
19891 sig_num_init=`$awk 'BEGIN { printf "0, " }
19892 !/^NSIG/ { printf "%d, ", $2}
19893 END { printf "0\n"}' signal.lst`
19894 ;;
19895esac
19896echo "The following $sig_count signals are available:"
19897echo " "
19898echo $sig_name | $awk \
19899'BEGIN { linelen = 0 }
19900{
19901 for (i = 1; i <= NF; i++) {
19902 name = "SIG" $i " "
19903 linelen = linelen + length(name)
19904 if (linelen > 70) {
19905 printf "\n"
19906 linelen = length(name)
19907 }
19908 printf "%s", name
19909 }
19910 printf "\n"
19911}'
76d3c696 19912sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19913$rm -f signal signal.c signal.awk signal.lst signal_cmd
19914
19915echo " "
19916case "$sizetype" in
19917*_t) zzz="$sizetype" ;;
19918*) zzz="filesize" ;;
19919esac
19920echo "Checking the size of $zzz..." >&4
19921cat > try.c <<EOCP
19922#include <sys/types.h>
19923#include <stdio.h>
5ed858ef
JH
19924#$i_stdlib I_STDLIB
19925#ifdef I_STDLIB
19926#include <stdlib.h>
19927#endif
b4eb6b3d
JH
19928int main() {
19929 printf("%d\n", (int)sizeof($sizetype));
19930 exit(0);
19931}
19932EOCP
19933set try
19934if eval $compile_ok; then
5440bc8e 19935 yyy=`$run ./try`
b4eb6b3d
JH
19936 case "$yyy" in
19937 '') sizesize=4
19938 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19939 ;;
19940 *) sizesize=$yyy
19941 echo "Your $zzz size is $sizesize bytes."
19942 ;;
19943 esac
19944else
19945 sizesize=4
19946 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19947fi
19948
19949
19950: check for socklen_t
19951echo " "
19952echo "Checking to see if you have socklen_t..." >&4
19953$cat >try.c <<EOCP
19954#include <sys/types.h>
19955#$d_socket HAS_SOCKET
19956#ifdef HAS_SOCKET
19957#include <sys/socket.h>
19958#endif
19959int main() { socklen_t x = 16; }
19960EOCP
19961set try
19962if eval $compile; then
19963 val="$define"
19964 echo "You have socklen_t."
19965else
19966 val="$undef"
19967 echo "You do not have socklen_t."
19968 case "$sizetype" in
19969 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19970 esac
19971fi
19972$rm -f try try.*
19973set d_socklen_t
19974eval $setvar
19975
a7710f8d
JH
19976: see if this is a socks.h system
19977set socks.h i_socks
19978eval $inhdr
19979
b4eb6b3d
JH
19980: check for type of the size argument to socket calls
19981case "$d_socket" in
19982"$define")
19983 $cat <<EOM
19984
19985Checking to see what type is the last argument of accept().
19986EOM
b4eb6b3d
JH
19987 yyy=''
19988 case "$d_socklen_t" in
19989 "$define") yyy="$yyy socklen_t"
19990 esac
19991 yyy="$yyy $sizetype int long unsigned"
19992 for xxx in $yyy; do
19993 case "$socksizetype" in
19994 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19995 case "$usesocks" in
19996 "$define")
19997 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19998 echo "Your system accepts '$xxx *' for the last argument of accept()."
19999 socksizetype="$xxx"
20000 fi
20001 ;;
20002 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20003 echo "Your system accepts '$xxx *' for the last argument of accept()."
20004 socksizetype="$xxx"
20005 fi
20006 ;;
20007 esac
b4eb6b3d
JH
20008 ;;
20009 esac
20010 done
20011: In case none of those worked, prompt the user.
20012 case "$socksizetype" in
20013 '') rp='What is the type for socket address structure sizes?'
20014 dflt='int'
20015 . ./myread
20016 socksizetype=$ans
20017 ;;
20018 esac
20019 ;;
20020*) : no sockets, so pick relatively harmless default
20021 socksizetype='int'
20022 ;;
20023esac
20024
20025: see what type is used for signed size_t
20026set ssize_t ssizetype int stdio.h sys/types.h
20027eval $typedef
20028dflt="$ssizetype"
5440bc8e 20029$cat > try.c <<EOM
b4eb6b3d 20030#include <stdio.h>
5ed858ef
JH
20031#$i_stdlib I_STDLIB
20032#ifdef I_STDLIB
20033#include <stdlib.h>
20034#endif
b4eb6b3d
JH
20035#include <sys/types.h>
20036#define Size_t $sizetype
20037#define SSize_t $dflt
20038int main()
20039{
20040 if (sizeof(Size_t) == sizeof(SSize_t))
20041 printf("$dflt\n");
20042 else if (sizeof(Size_t) == sizeof(int))
20043 printf("int\n");
20044 else
20045 printf("long\n");
20046 exit(0);
20047}
20048EOM
20049echo " "
5440bc8e
JH
20050set try
20051if eval $compile_ok && $run ./try > /dev/null; then
20052 ssizetype=`$run ./try`
b4eb6b3d
JH
20053 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20054else
20055 $cat >&4 <<EOM
20056Help! I can't compile and run the ssize_t test program: please enlighten me!
20057(This is probably a misconfiguration in your system or libraries, and
20058you really ought to fix it. Still, I'll try anyway.)
20059
20060I need a type that is the same size as $sizetype, but is guaranteed to
20061be signed. Common values are ssize_t, int and long.
20062
20063EOM
20064 rp="What signed type is the same size as $sizetype?"
20065 . ./myread
20066 ssizetype="$ans"
20067fi
5440bc8e 20068$rm -f try try.*
b4eb6b3d
JH
20069
20070: see what type of char stdio uses.
20071echo " "
704c3401
NC
20072echo '#include <stdio.h>' > stdio.c
20073$cppstdin $cppminus < stdio.c > stdioh
aa517f50 20074if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20075 echo "Your stdio uses unsigned chars." >&4
20076 stdchar="unsigned char"
20077else
aa517f50
JH
20078 echo "Your stdio uses signed chars." >&4
20079 stdchar="char"
b4eb6b3d 20080fi
704c3401 20081$rm -f stdio.* stdioh
b4eb6b3d 20082
b4eb6b3d
JH
20083: see what type uids are declared as in the kernel
20084echo " "
20085echo "Looking for the type for user ids returned by getuid()."
20086set uid_t uidtype xxx stdio.h sys/types.h
20087eval $typedef
20088case "$uidtype" in
20089xxx)
20090 xxx=`./findhdr sys/user.h`
20091 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20092 case $1 in
20093 unsigned) dflt="$1 $2" ;;
20094 *) dflt="$1" ;;
20095 esac
20096 ;;
20097*) dflt="$uidtype";;
20098esac
20099case "$uidtype" in
20100uid_t) echo "uid_t found." ;;
20101*) rp="What is the type for user ids returned by getuid()?"
20102 . ./myread
20103 uidtype="$ans"
20104 ;;
20105esac
20106
20107echo " "
20108case "$uidtype" in
20109*_t) zzz="$uidtype" ;;
20110*) zzz="uid" ;;
20111esac
20112echo "Checking the size of $zzz..." >&4
20113cat > try.c <<EOCP
20114#include <sys/types.h>
20115#include <stdio.h>
5ed858ef
JH
20116#$i_stdlib I_STDLIB
20117#ifdef I_STDLIB
20118#include <stdlib.h>
20119#endif
b4eb6b3d
JH
20120int main() {
20121 printf("%d\n", (int)sizeof($uidtype));
20122 exit(0);
20123}
20124EOCP
20125set try
20126if eval $compile_ok; then
5440bc8e 20127 yyy=`$run ./try`
b4eb6b3d
JH
20128 case "$yyy" in
20129 '') uidsize=4
20130 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20131 ;;
20132 *) uidsize=$yyy
20133 echo "Your $zzz is $uidsize bytes long."
20134 ;;
20135 esac
20136else
20137 uidsize=4
20138 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20139fi
20140
20141echo " "
20142case "$uidtype" in
20143*_t) zzz="$uidtype" ;;
20144*) zzz="uid" ;;
20145esac
20146echo "Checking the sign of $zzz..." >&4
20147cat > try.c <<EOCP
20148#include <sys/types.h>
20149#include <stdio.h>
20150int main() {
20151 $uidtype foo = -1;
20152 if (foo < 0)
20153 printf("-1\n");
20154 else
20155 printf("1\n");
20156}
20157EOCP
20158set try
20159if eval $compile; then
5440bc8e 20160 yyy=`$run ./try`
b4eb6b3d
JH
20161 case "$yyy" in
20162 '') uidsign=1
20163 echo "(I can't execute the test program--guessing unsigned.)" >&4
20164 ;;
20165 *) uidsign=$yyy
20166 case "$uidsign" in
20167 1) echo "Your $zzz is unsigned." ;;
20168 -1) echo "Your $zzz is signed." ;;
20169 esac
20170 ;;
20171 esac
20172else
20173 uidsign=1
20174 echo "(I can't compile the test program--guessing unsigned.)" >&4
20175fi
20176
20177
20178
20179echo " "
20180$echo "Checking the format string to be used for uids..." >&4
20181
20182case "$uidsign" in
20183-1) if $test X"$uidsize" = X"$ivsize"; then
20184 uidformat="$ivdformat"
20185 else
20186 if $test X"$uidsize" = X"$longsize"; then
20187 uidformat='"ld"'
20188 else
20189 if $test X"$uidsize" = X"$intsize"; then
20190 uidformat='"d"'
20191 else
20192 if $test X"$uidsize" = X"$shortsize"; then
20193 uidformat='"hd"'
20194 fi
20195 fi
20196 fi
20197 fi
20198 ;;
20199*) if $test X"$uidsize" = X"$uvsize"; then
20200 uidformat="$uvuformat"
20201 else
20202 if $test X"$uidsize" = X"$longsize"; then
20203 uidformat='"lu"'
20204 else
20205 if $test X"$uidsize" = X"$intsize"; then
20206 uidformat='"u"'
20207 else
20208 if $test X"$uidsize" = X"$shortsize"; then
20209 uidformat='"hu"'
20210 fi
20211 fi
20212 fi
20213 fi
20214 ;;
20215esac
20216
a663fd0a
AT
20217
20218case "$usesitecustomize" in
20219 $define|true|[Yy]*)
20220 usesitecustomize="$define"
20221 ;;
20222 *)
20223 usesitecustomize="$undef"
20224 ;;
20225 esac
20226
3659ebf1
JH
20227: determine compiler compiler
20228case "$yacc" in
20229'')
20230 dflt=yacc;;
20231*)
20232 dflt="$yacc";;
20233esac
20234echo " "
20235comp='yacc'
3c728e00 20236if $test -f "$byacc$_exe"; then
3659ebf1
JH
20237 dflt="$byacc"
20238 comp="byacc or $comp"
20239fi
3c728e00 20240if $test -f "$bison$_exe"; then
3659ebf1
JH
20241 comp="$comp or bison -y"
20242fi
20243rp="Which compiler compiler ($comp) shall I use?"
20244. ./myread
20245yacc="$ans"
20246case "$yacc" in
20247*bis*)
20248 case "$yacc" in
20249 *-y*) ;;
20250 *)
20251 yacc="$yacc -y"
20252 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20253 ;;
20254 esac
20255 ;;
20256esac
20257
758a5d79
JH
20258: see if this is a fp.h system
20259set fp.h i_fp
20260eval $inhdr
20261
20262: see if this is a fp_class.h system
20263set fp_class.h i_fp_class
20264eval $inhdr
20265
b4eb6b3d 20266: see if this is a ieeefp.h system
b5b9f165
JH
20267case "$i_ieeefp" in
20268'' ) set ieeefp.h i_ieeefp
20269 eval $inhdr
20270 ;;
20271esac
b4eb6b3d
JH
20272
20273: see if this is a libutil.h system
20274set libutil.h i_libutil
20275eval $inhdr
20276
b4eb6b3d
JH
20277: see if mach cthreads are available
20278if test "X$usethreads" = "X$define"; then
20279 set mach/cthreads.h i_machcthr
20280 eval $inhdr
20281else
20282 i_machcthr="$undef"
20283fi
20284
20285
20286
b4eb6b3d
JH
20287: see if this is a mntent.h system
20288set mntent.h i_mntent
20289eval $inhdr
20290
20291: see if ndbm.h is available
20292set ndbm.h t_ndbm
20293eval $inhdr
1c6861ad
JS
20294
20295case "$t_ndbm" in
20296$undef)
20297 # Some Linux distributions such as RedHat 7.1 put the
20298 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20299 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20300 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20301 ccflags="$ccflags -I/usr/include/gdbm"
20302 cppflags="$cppflags -I/usr/include/gdbm"
20303 t_ndbm=$define
20304 fi
20305 ;;
20306esac
20307
b4eb6b3d
JH
20308case "$t_ndbm" in
20309$define)
20310 : see if dbm_open exists
20311 set dbm_open d_dbm_open
20312 eval $inlibc
20313 case "$d_dbm_open" in
20314 $undef)
20315 t_ndbm="$undef"
20316 echo "We won't be including <ndbm.h>"
20317 ;;
20318 esac
20319 ;;
20320esac
20321val="$t_ndbm"
20322set i_ndbm
20323eval $setvar
20324
20325: see if net/errno.h is available
20326val=''
20327set net/errno.h val
20328eval $inhdr
20329
20330: Unfortunately, it causes problems on some systems. Arrgh.
20331case "$val" in
20332$define)
20333 cat > try.c <<'EOM'
20334#include <stdio.h>
20335#include <errno.h>
20336#include <net/errno.h>
20337int func()
20338{
20339 return ENOTSOCK;
20340}
20341EOM
20342 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20343 echo "We'll be including <net/errno.h>." >&4
20344 else
20345 echo "We won't be including <net/errno.h>." >&4
20346 val="$undef"
20347 fi
20348 $rm -f try.* try
20349 ;;
20350esac
20351set i_neterrno
20352eval $setvar
20353
20354: see if netinet/tcp.h is available
20355set netinet/tcp.h i_netinettcp
20356eval $inhdr
20357
20358: see if this is a poll.h system
20359set poll.h i_poll
20360eval $inhdr
20361
20362: see if this is a prot.h system
20363set prot.h i_prot
20364eval $inhdr
20365
20366echo " "
4c42f03c 20367$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20368$cat <<'EOSH' > Cppsym.know
20369a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20370AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
1466f2fb 20371alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20372ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20373BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20374BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20375bull c cadmus clipper CMU COFF COMPILER_VERSION
20376concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
cf011bf2 20377CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20378Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20379FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20380GLIBC GLIBC_MINOR
20381GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20382H3050R H3050RX hbullx20 hcx host_mips
20383hp200 hp300 hp700 HP700 hp800 hp9000
20384hp9000s200 hp9000s300 hp9000s400 hp9000s500
20385hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20386i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20387IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20388INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20389LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20390LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20391Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20392LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20393M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20394M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20395M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20396MATH_HAS_NO_SIDE_EFFECTS
20397mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20398mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20399mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20400MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20401mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20402NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20403news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20404ns32016 ns32332 ns32k nsc32000
20405OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20406pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20407pc532 pdp11 PGC PIC plexus PORTAR posix
20408POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20409POSIX_C_SOURCE POSIX_SOURCE POWER
20410PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20411riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20412SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20413sony sony_news sonyrisc sparc sparclite spectrum
20414stardent stdc STDC_EXT stratos sun sun3 sun386
20415Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20416SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20417SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20418sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20419TM3200 TM5400 TM5600
b4eb6b3d
JH
20420tower tower32 tower32_200 tower32_600 tower32_700
20421tower32_800 tower32_850 tss
20422u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20423ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20424unix UNIX95 UNIX99 unixpc unos
20425USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20426USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20427USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20428USGr4 USGr4_2
1466f2fb 20429Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20430XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20431XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20432z8000
20433EOSH
20434# Maybe put other stuff here too.
20435cat <<EOSH >>Cppsym.know
20436$osname
20437EOSH
20438./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20439./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20440$cat Cppsym.know > Cppsym.c
381aa1ff 20441$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20442$rm -f Cppsym.a Cppsym.b Cppsym.c
20443cat <<EOSH > Cppsym
20444$startsh
20445if $test \$# -gt 0; then
20446 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20447 if $test -s Cppsym.got; then
20448 $rm -f Cppsym.got
20449 exit 0
20450 fi
20451 $rm -f Cppsym.got
20452 exit 1
20453else
20454 $tr " " "$trnl" | ./Cppsym.try
20455 exit 0
20456fi
20457EOSH
20458chmod +x Cppsym
20459$eunicefix Cppsym
20460cat <<EOSH > Cppsym.try
20461$startsh
20462cat <<'EOCP' > try.c
20463#include <stdio.h>
704c3401
NC
20464#if cpp_stuff == 1
20465#define STRINGIFY(a) "a"
20466#endif
20467#if cpp_stuff == 42
20468#define StGiFy(a) #a
20469#define STRINGIFY(a) StGiFy(a)
20470#endif
20471#if $cpp_stuff != 1 && $cpp_stuff != 42
20472# include "Bletch: How does this C preprocessor stringify macros?"
20473#endif
b4eb6b3d
JH
20474int main() {
20475EOCP
20476$awk \\
20477EOSH
20478cat <<'EOSH' >> Cppsym.try
20479'length($1) > 0 {
704c3401
NC
20480 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20481 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20482 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20483 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20484}' >> try.c
2ef53570 20485echo 'return 0;}' >> try.c
b4eb6b3d
JH
20486EOSH
20487cat <<EOSH >> Cppsym.try
20488ccflags="$ccflags"
20489case "$osname-$gccversion" in
20490irix-) ccflags="\$ccflags -woff 1178" ;;
20491os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20492esac
704c3401 20493$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20494EOSH
20495chmod +x Cppsym.try
20496$eunicefix Cppsym.try
20497./Cppsym < Cppsym.know > Cppsym.true
4c42f03c
JVD
20498: Add in any linux cpp "predefined macros":
20499case "$osname::$gccversion" in
20500 *linux*::*.*)
20501 tHdrH=_tmpHdr
20502 rm -f $tHdrH'.h' $tHdrH
20503 touch $tHdrH'.h'
20504 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20505 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20506 if [ -s $tHdrH'_cppsym.real' ]; then
20507 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20508 fi
20509 fi
20510 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20511 ;;
20512esac
b4eb6b3d
JH
20513: now check the C compiler for additional symbols
20514postprocess_cc_v=''
20515case "$osname" in
20516aix) postprocess_cc_v="|$tr , ' '" ;;
20517esac
20518$cat >ccsym <<EOS
20519$startsh
20520$cat >tmp.c <<EOF
20521extern int foo;
20522EOF
20523for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20524do
20525 case "\$i" in
20526 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20527 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20528 esac
20529done
20530$rm -f try.c
20531EOS
20532postprocess_cc_v=''
20533chmod +x ccsym
20534$eunicefix ccsym
20535./ccsym > ccsym1.raw
20536if $test -s ccsym1.raw; then
20537 $sort ccsym1.raw | $uniq >ccsym.raw
20538else
20539 mv ccsym1.raw ccsym.raw
20540fi
20541
20542$awk '/\=/ { print $0; next }
20543 { print $0"=1" }' ccsym.raw >ccsym.list
704c3401
NC
20544$comm -13 Cppsym.true ccsym.list >ccsym.own
20545$comm -12 Cppsym.true ccsym.list >ccsym.com
20546$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20547also=''
20548if $test -z ccsym.raw; then
20549 echo "Your C compiler doesn't seem to define any symbols!" >&4
20550 echo " "
20551 echo "However, your C preprocessor defines the following symbols:"
20552 $cat Cppsym.true
20553 ccsymbols=''
20554 cppsymbols=`$cat Cppsym.true`
20555 cppsymbols=`echo $cppsymbols`
20556 cppccsymbols="$cppsymbols"
20557else
20558 if $test -s ccsym.com; then
20559 echo "Your C compiler and pre-processor define these symbols:"
20560 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20561 also='also '
20562 symbols='ones'
20563 cppccsymbols=`$cat ccsym.com`
20564 cppccsymbols=`echo $cppccsymbols`
20565 $test "$silent" || sleep 1
20566 fi
20567 if $test -s ccsym.cpp; then
20568 $test "$also" && echo " "
20569 echo "Your C pre-processor ${also}defines the following symbols:"
20570 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20571 also='further '
20572 cppsymbols=`$cat ccsym.cpp`
20573 cppsymbols=`echo $cppsymbols`
20574 $test "$silent" || sleep 1
20575 fi
20576 if $test -s ccsym.own; then
20577 $test "$also" && echo " "
20578 echo "Your C compiler ${also}defines the following cpp symbols:"
20579 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20580 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20581 ccsymbols=`$cat ccsym.own`
20582 ccsymbols=`echo $ccsymbols`
20583 $test "$silent" || sleep 1
20584 fi
20585fi
b4eb6b3d
JH
20586
20587: see if this is a termio system
20588val="$undef"
20589val2="$undef"
20590val3="$undef"
20591if $test `./findhdr termios.h`; then
20592 set tcsetattr i_termios
20593 eval $inlibc
20594 val3="$i_termios"
20595fi
20596echo " "
20597case "$val3" in
20598"$define") echo "You have POSIX termios.h... good!" >&4;;
20599*) if ./Cppsym pyr; then
20600 case "`/bin/universe`" in
20601 ucb) if $test `./findhdr sgtty.h`; then
20602 val2="$define"
20603 echo "<sgtty.h> found." >&4
20604 else
20605 echo "System is pyramid with BSD universe."
20606 echo "<sgtty.h> not found--you could have problems." >&4
20607 fi;;
20608 *) if $test `./findhdr termio.h`; then
20609 val="$define"
20610 echo "<termio.h> found." >&4
20611 else
20612 echo "System is pyramid with USG universe."
20613 echo "<termio.h> not found--you could have problems." >&4
20614 fi;;
20615 esac
20616 elif ./usg; then
20617 if $test `./findhdr termio.h`; then
20618 echo "<termio.h> found." >&4
20619 val="$define"
20620 elif $test `./findhdr sgtty.h`; then
20621 echo "<sgtty.h> found." >&4
20622 val2="$define"
20623 else
20624echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20625 fi
20626 else
20627 if $test `./findhdr sgtty.h`; then
20628 echo "<sgtty.h> found." >&4
20629 val2="$define"
20630 elif $test `./findhdr termio.h`; then
20631 echo "<termio.h> found." >&4
20632 val="$define"
20633 else
20634echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20635 fi
20636 fi;;
20637esac
20638set i_termio; eval $setvar
20639val=$val2; set i_sgtty; eval $setvar
20640val=$val3; set i_termios; eval $setvar
20641
b4eb6b3d
JH
20642: see if stddef is available
20643set stddef.h i_stddef
20644eval $inhdr
923fc586 20645
b4eb6b3d
JH
20646: see if this is a sunmath.h system
20647set sunmath.h i_sunmath
20648eval $inhdr
5f80c64f 20649
b4eb6b3d
JH
20650: see if sys/access.h is available
20651set sys/access.h i_sysaccess
20652eval $inhdr
20653
20654: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20655set sys/filio.h i_sysfilio
20656eval $inhdr
20657echo " "
20658if $test `./findhdr sys/ioctl.h`; then
20659 val="$define"
20660 echo '<sys/ioctl.h> found.' >&4
20661else
20662 val="$undef"
20663 if $test $i_sysfilio = "$define"; then
20664 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20665 else
b4eb6b3d
JH
20666 $test $i_sgtty = "$define" && xxx="sgtty.h"
20667 $test $i_termio = "$define" && xxx="termio.h"
20668 $test $i_termios = "$define" && xxx="termios.h"
20669echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20670 fi
20671fi
20672set i_sysioctl
20673eval $setvar
20674
49a78c82
JH
20675: see if socket ioctl defs are in sys/sockio.h
20676echo " "
20677xxx=`./findhdr sys/sockio.h`
20678if $test "$xxx"; then
20679 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20680 val="$define"
20681 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20682 else
20683 val="$undef"
20684 echo "No socket ioctls found in <sys/sockio.h>." >&4
20685 fi
20686else
20687 val="$undef"
20688 $cat <<EOM
20689<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20690EOM
20691fi
20692set i_syssockio
20693eval $setvar
20694
b4eb6b3d
JH
20695
20696: see if this is a syslog.h system
20697set syslog.h i_syslog
20698eval $inhdr
20699
20700
20701: see if this is a sys/mode.h system
20702set sys/mode.h i_sysmode
20703eval $inhdr
20704
20705: see if sys/resource.h has to be included
20706set sys/resource.h i_sysresrc
20707eval $inhdr
20708
20709: see if sys/security.h is available
20710set sys/security.h i_syssecrt
20711eval $inhdr
20712
20713: see if this is a sys/statvfs.h system
20714set sys/statvfs.h i_sysstatvfs
20715eval $inhdr
20716
b4eb6b3d
JH
20717: see if this is a sys/un.h system
20718set sys/un.h i_sysun
20719eval $inhdr
20720
20721
20722: see if this is a sys/utsname.h system
20723set sys/utsname.h i_sysutsname
20724eval $inhdr
20725
20726: see if this is a syswait system
20727set sys/wait.h i_syswait
20728eval $inhdr
20729
20730: see if this is a ustat.h system
20731set ustat.h i_ustat
20732eval $inhdr
20733
20734: see if this is an utime system
20735set utime.h i_utime
20736eval $inhdr
20737
20738: see if this is a values.h system
20739set values.h i_values
20740eval $inhdr
20741
20742: see if this is a vfork system
20743case "$d_vfork" in
20744"$define")
20745 set vfork.h i_vfork
20746 eval $inhdr
20747 ;;
20748*)
20749 i_vfork="$undef"
20750 ;;
20751esac
20752
20753: see if gdbm.h is available
20754set gdbm.h t_gdbm
20755eval $inhdr
20756case "$t_gdbm" in
20757$define)
20758 : see if gdbm_open exists
20759 set gdbm_open d_gdbm_open
20760 eval $inlibc
20761 case "$d_gdbm_open" in
20762 $undef)
20763 t_gdbm="$undef"
20764 echo "We won't be including <gdbm.h>"
5f80c64f 20765 ;;
b4eb6b3d
JH
20766 esac
20767 ;;
20768esac
20769val="$t_gdbm"
20770set i_gdbm
20771eval $setvar
20772
20773echo " "
20774echo "Looking for extensions..." >&4
20775: If we are using the old config.sh, known_extensions may contain
20776: old or inaccurate or duplicate values.
20777known_extensions=''
20778nonxs_extensions=''
20779: We do not use find because it might not be available.
20780: We do not just use MANIFEST because the user may have dropped
20781: some additional extensions into the source tree and expect them
20782: to be built.
20783
20784: Function to recursively find available extensions, ignoring DynaLoader
20785: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20786find_extensions='
20787 for xxx in *; do
20788 case "$xxx" in
20789 DynaLoader|dynaload) ;;
20790 *)
20791 if $test -f $xxx/$xxx.xs; then
20792 known_extensions="$known_extensions $1$xxx";
20793 elif $test -f $xxx/Makefile.PL; then
20794 nonxs_extensions="$nonxs_extensions $1$xxx";
20795 else
20796 if $test -d $xxx -a $# -lt 10; then
20797 set $1$xxx/ $*;
6904989c 20798 cd "$xxx";
b4eb6b3d
JH
20799 eval $find_extensions;
20800 cd ..;
20801 shift;
20802 fi;
20803 fi
20804 ;;
20805 esac;
20806 done'
20807tdir=`pwd`
6904989c 20808cd "$rsrc/ext"
b4eb6b3d
JH
20809set X
20810shift
20811eval $find_extensions
4e1a6d26
AD
20812# Special case: Add in threads/shared since it is not picked up by the
20813# recursive find above (and adding in general recursive finding breaks
20814# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20815known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20816set X $nonxs_extensions
20817shift
20818nonxs_extensions="$*"
20819set X $known_extensions
20820shift
20821known_extensions="$*"
6904989c 20822cd "$tdir"
b4eb6b3d
JH
20823
20824: Now see which are supported on this system.
20825avail_ext=''
20826for xxx in $known_extensions ; do
20827 case "$xxx" in
20828 DB_File|db_file)
20829 case "$i_db" in
20830 $define) avail_ext="$avail_ext $xxx" ;;
20831 esac
20832 ;;
20833 GDBM_File|gdbm_fil)
20834 case "$i_gdbm" in
20835 $define) avail_ext="$avail_ext $xxx" ;;
20836 esac
20837 ;;
1d59c593 20838 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20839 case "$i_langinfo$d_nl_langinfo" in
20840 $define$define) avail_ext="$avail_ext $xxx" ;;
20841 esac
20842 ;;
b4eb6b3d
JH
20843 NDBM_File|ndbm_fil)
20844 case "$i_ndbm" in
20845 $define)
20846 case "$osname-$use64bitint" in
0be9fa5d 20847 hpux-define)
b4eb6b3d
JH
20848 case "$libs" in
20849 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20850 esac
20851 ;;
20852 *) avail_ext="$avail_ext $xxx" ;;
20853 esac
20854 ;;
20855 esac
20856 ;;
20857 ODBM_File|odbm_fil)
20858 case "${i_dbm}${i_rpcsvcdbm}" in
20859 *"${define}"*)
20860 case "$osname-$use64bitint" in
0be9fa5d 20861 hpux-define)
b4eb6b3d
JH
20862 case "$libs" in
20863 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20864 esac
20865 ;;
20866 *) avail_ext="$avail_ext $xxx" ;;
20867 esac
20868 ;;
20869 esac
20870 ;;
20871 POSIX|posix)
20872 case "$useposix" in
20873 true|define|y) avail_ext="$avail_ext $xxx" ;;
20874 esac
20875 ;;
20876 Opcode|opcode)
20877 case "$useopcode" in
20878 true|define|y) avail_ext="$avail_ext $xxx" ;;
20879 esac
20880 ;;
20881 Socket|socket)
20882 case "$d_socket" in
4a9f028c
JH
20883 true|$define|y)
20884 case "$osname" in
20885 beos) ;; # not unless BONE
20886 *) avail_ext="$avail_ext $xxx" ;;
20887 esac
20888 ;;
b4eb6b3d
JH
20889 esac
20890 ;;
20891 Sys/Syslog|sys/syslog)
20892 : XXX syslog requires socket
20893 case "$d_socket" in
20894 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20895 esac
20896 ;;
20897 Thread|thread)
b00ec89b
AB
20898 case "$usethreads" in
20899 true|$define|y)
20900 case "$useithreads" in
20901 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20902 esac
b4eb6b3d
JH
20903 esac
20904 ;;
f9b6ed1c
AD
20905 XS/APItest|xs/apitest)
20906 # This is just for testing. Skip it unless we have dynamic loading.
20907
20908 case "$usedl" in
20909 $define) avail_ext="$avail_ext $xxx" ;;
20910 esac
20911 ;;
20912 XS/Typemap|xs/typemap)
20913 # This is just for testing. Skip it unless we have dynamic loading.
20914 case "$usedl" in
20915 $define) avail_ext="$avail_ext $xxx" ;;
20916 esac
20917 ;;
7deadc5f 20918 threads|threads/shared)
73e09c8f
JH
20919 # threads and threads::shared are special cases.
20920 # To stop people from asking "Perl 5.8.0 was supposed
20921 # to have this new fancy threads implementation but my
20922 # perl doesn't have it" and from people trying to
20923 # (re)install the threads module using CPAN.pm and
20924 # CPAN.pm then offering to reinstall Perl 5.8.0,
20925 # the threads.pm and threads/shared.pm will always be
20926 # there, croaking informatively ("you need to rebuild
20927 # all of Perl with threads, sorry") when threads haven't
20928 # been compiled in.
20929 # --jhi
20930 avail_ext="$avail_ext $xxx"
1dca008a 20931 ;;
b4eb6b3d
JH
20932 IPC/SysV|ipc/sysv)
20933 : XXX Do we need a useipcsysv variable here
20934 case "${d_msg}${d_sem}${d_shm}" in
20935 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20936 esac
20937 ;;
20938 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20939 ;;
20940 esac
b4eb6b3d 20941done
5f80c64f 20942
b4eb6b3d
JH
20943set X $avail_ext
20944shift
20945avail_ext="$*"
5f80c64f 20946
4bedfb0f
JH
20947case "$onlyextensions" in
20948'') ;;
20949*) keepextensions=''
20950 echo "You have requested that only certains extensions be included..." >&4
20951 for i in $onlyextensions; do
20952 case " $avail_ext " in
20953 *" $i "*)
20954 echo "Keeping extension $i."
20955 keepextensions="$keepextensions $i"
20956 ;;
20957 *) echo "Ignoring extension $i." ;;
20958 esac
20959 done
20960 avail_ext="$keepextensions"
20961 ;;
20962esac
20963
20964case "$noextensions" in
20965'') ;;
20966*) keepextensions=''
20967 echo "You have requested that certain extensions be ignored..." >&4
20968 for i in $avail_ext; do
67bae6b3
JH
20969 case " $noextensions " in
20970 *" $i "*) echo "Ignoring extension $i." ;;
4bedfb0f
JH
20971 *) echo "Keeping extension $i.";
20972 keepextensions="$keepextensions $i"
20973 ;;
20974 esac
20975 done
20976 avail_ext="$keepextensions"
20977 ;;
20978esac
20979
b4eb6b3d
JH
20980: Now see which nonxs extensions are supported on this system.
20981: For now assume all are.
20982nonxs_ext=''
20983for xxx in $nonxs_extensions ; do
20984 case "$xxx" in
20985 *) nonxs_ext="$nonxs_ext $xxx"
20986 ;;
20987 esac
20988done
5f80c64f 20989
b4eb6b3d
JH
20990set X $nonxs_ext
20991shift
20992nonxs_ext="$*"
20993
20994case $usedl in
20995$define)
20996 $cat <<EOM
20997A number of extensions are supplied with $package. You may choose to
20998compile these extensions for dynamic loading (the default), compile
20999them into the $package executable (static loading), or not include
21000them at all. Answer "none" to include no extensions.
21001Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21002
21003EOM
b4eb6b3d 21004 case "$dynamic_ext" in
5b7ea690
JH
21005 '')
21006 : Exclude those listed in static_ext
21007 dflt=''
21008 for xxx in $avail_ext; do
21009 case " $static_ext " in
21010 *" $xxx "*) ;;
21011 *) dflt="$dflt $xxx" ;;
21012 esac
21013 done
21014 set X $dflt
21015 shift
21016 dflt="$*"
21017 ;;
b4eb6b3d
JH
21018 *) dflt="$dynamic_ext"
21019 # Perhaps we are reusing an old out-of-date config.sh.
21020 case "$hint" in
21021 previous)
21022 if test X"$dynamic_ext" != X"$avail_ext"; then
21023 $cat <<EOM
21024NOTICE: Your previous config.sh list may be incorrect.
21025The extensions now available to you are
21026 ${avail_ext}
21027but the default list from your previous config.sh is
21028 ${dynamic_ext}
9c839522 21029
b4eb6b3d
JH
21030EOM
21031 fi
9c839522
PM
21032 ;;
21033 esac
b4eb6b3d
JH
21034 ;;
21035 esac
5f80c64f 21036 case "$dflt" in
b4eb6b3d
JH
21037 '') dflt=none;;
21038 esac
21039 rp="What extensions do you wish to load dynamically?"
21040 . ./myread
21041 case "$ans" in
21042 none) dynamic_ext=' ' ;;
21043 *) dynamic_ext="$ans" ;;
5f80c64f 21044 esac
5f80c64f 21045
b4eb6b3d
JH
21046 case "$static_ext" in
21047 '')
21048 : Exclude those already listed in dynamic linking
21049 dflt=''
21050 for xxx in $avail_ext; do
21051 case " $dynamic_ext " in
21052 *" $xxx "*) ;;
21053 *) dflt="$dflt $xxx" ;;
21054 esac
21055 done
21056 set X $dflt
21057 shift
21058 dflt="$*"
21059 ;;
21060 *) dflt="$static_ext"
21061 ;;
21062 esac
9c839522 21063
b4eb6b3d
JH
21064 case "$dflt" in
21065 '') dflt=none;;
21066 esac
21067 rp="What extensions do you wish to load statically?"
21068 . ./myread
21069 case "$ans" in
21070 none) static_ext=' ' ;;
21071 *) static_ext="$ans" ;;
21072 esac
21073 ;;
21074*)
21075 $cat <<EOM
21076A number of extensions are supplied with $package. Answer "none"
21077to include no extensions.
21078Note that DynaLoader is always built and need not be mentioned here.
9c839522 21079
b4eb6b3d
JH
21080EOM
21081 case "$static_ext" in
21082 '') dflt="$avail_ext" ;;
21083 *) dflt="$static_ext"
21084 # Perhaps we are reusing an old out-of-date config.sh.
21085 case "$hint" in
21086 previous)
21087 if test X"$static_ext" != X"$avail_ext"; then
21088 $cat <<EOM
21089NOTICE: Your previous config.sh list may be incorrect.
21090The extensions now available to you are
21091 ${avail_ext}
21092but the default list from your previous config.sh is
21093 ${static_ext}
5f80c64f
JH
21094
21095EOM
b4eb6b3d
JH
21096 fi
21097 ;;
21098 esac
21099 ;;
21100 esac
21101 : Exclude those that are not xs extensions
21102 case "$dflt" in
21103 '') dflt=none;;
21104 esac
21105 rp="What extensions do you wish to include?"
21106 . ./myread
21107 case "$ans" in
21108 none) static_ext=' ' ;;
21109 *) static_ext="$ans" ;;
21110 esac
21111 ;;
5f80c64f 21112esac
f1f6834f
AD
21113#
21114# Encode is a special case. If we are building Encode as a static
21115# extension, we need to explicitly list its subextensions as well.
21116# For other nested extensions, this is handled automatically by
21117# the appropriate Makefile.PL.
21118case " $static_ext " in
21119 *" Encode "*) # Add the subextensions of Encode
21120 cd "$rsrc/ext"
21121 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21122 static_ext="$static_ext Encode/$xxx"
21123 done
21124 cd "$tdir"
21125 ;;
21126esac
5f80c64f 21127
b4eb6b3d
JH
21128set X $dynamic_ext $static_ext $nonxs_ext
21129shift
21130extensions="$*"
21131
3a067427
AD
21132# Sanity check: We require an extension suitable for use with
21133# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21134# should show up as failures in the test suite, but it's helpful to
21135# catch them now.) The 'extensions' list is normally sorted
21136# alphabetically, so we need to accept either
21137# DB_File ... Fcntl ... IO ....
21138# or something like
21139# Fcntl ... NDBM_File ... IO ....
3b46a705
JH
21140case " $extensions" in
21141*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21142*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21143*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
5a29c6bc
JH
21144*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21145 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21146 ;;
21147esac
21148
9c839522
PM
21149: Remove libraries needed only for extensions
21150: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21151: The exception is SunOS 4.x, which needs them.
21152case "${osname}X${osvers}" in
21153sunos*X4*)
21154 perllibs="$libs"
21155 ;;
21156*) case "$usedl" in
21157 $define|true|[yY]*)
21158 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21159 shift
21160 perllibs="$*"
21161 ;;
21162 *) perllibs="$libs"
21163 ;;
21164 esac
21165 ;;
9c839522 21166esac
5f80c64f
JH
21167
21168: Remove build directory name from cppstdin so it can be used from
21169: either the present location or the final installed location.
21170echo " "
21171: Get out of the UU directory to get correct path name.
21172cd ..
21173case "$cppstdin" in
21174`pwd`/cppstdin)
21175 echo "Stripping down cppstdin path name"
21176 cppstdin=cppstdin
21177 ;;
21178esac
21179cd UU
21180
21181: end of configuration questions
21182echo " "
21183echo "End of configuration questions."
21184echo " "
21185
21186: back to where it started
21187if test -d ../UU; then
21188 cd ..
21189fi
21190
48370efc
JH
21191: configuration may be patched via a 'config.arch' file
21192if $test -f config.arch; then
21193 echo "I see a config.arch file, loading it."
21194 . ./config.arch
21195fi
21196
5f80c64f
JH
21197: configuration may be patched via a 'config.over' file
21198if $test -f config.over; then
21199 echo " "
21200 dflt=y
21201 rp='I see a config.over file. Do you wish to load it?'
21202 . UU/myread
21203 case "$ans" in
21204 n*) echo "OK, I'll ignore it.";;
21205 *) . ./config.over
21206 echo "Configuration override changes have been loaded."
21207 ;;
21208 esac
21209fi
21210
21211: in case they want portability, strip down executable paths
21212case "$d_portable" in
21213"$define")
21214 echo " "
21215 echo "Stripping down executable paths..." >&4
21216 for file in $loclist $trylist; do
534ac15a
JH
21217 eval temp=\$$file
21218 eval $file=`basename $temp`
5f80c64f
JH
21219 done
21220 ;;
21221esac
21222
21223: create config.sh file
21224echo " "
21225echo "Creating config.sh..." >&4
21226$spitshell <<EOT >config.sh
21227$startsh
21228#
21229# This file was produced by running the Configure script. It holds all the
21230# definitions figured out by Configure. Should you modify one of these values,
21231# do not forget to propagate your changes by running "Configure -der". You may
21232# instead choose to run each of the .SH files by yourself, or "Configure -S".
21233#
21234
21235# Package name : $package
21236# Source directory : $src
21237# Configuration time: $cf_time
21238# Configured by : $cf_by
21239# Target system : $myuname
21240
21241Author='$Author'
21242Date='$Date'
21243Header='$Header'
21244Id='$Id'
21245Locker='$Locker'
21246Log='$Log'
21247Mcc='$Mcc'
21248RCSfile='$RCSfile'
21249Revision='$Revision'
21250Source='$Source'
21251State='$State'
21252_a='$_a'
21253_exe='$_exe'
21254_o='$_o'
b4eb6b3d 21255afs='$afs'
a6d26a0d 21256afsroot='$afsroot'
b4eb6b3d
JH
21257alignbytes='$alignbytes'
21258ansi2knr='$ansi2knr'
21259aphostname='$aphostname'
21260api_revision='$api_revision'
21261api_subversion='$api_subversion'
21262api_version='$api_version'
21263api_versionstring='$api_versionstring'
5f80c64f 21264ar='$ar'
b4eb6b3d
JH
21265archlib='$archlib'
21266archlibexp='$archlibexp'
21267archname64='$archname64'
21268archname='$archname'
5f80c64f 21269archobjs='$archobjs'
10bc17b6 21270asctime_r_proto='$asctime_r_proto'
5f80c64f 21271awk='$awk'
b4eb6b3d 21272baserev='$baserev'
5f80c64f 21273bash='$bash'
b4eb6b3d 21274bin='$bin'
b4eb6b3d 21275binexp='$binexp'
5f80c64f
JH
21276bison='$bison'
21277byacc='$byacc'
b4eb6b3d 21278byteorder='$byteorder'
5f80c64f 21279c='$c'
b4eb6b3d 21280castflags='$castflags'
5f80c64f
JH
21281cat='$cat'
21282cc='$cc'
21283cccdlflags='$cccdlflags'
21284ccdlflags='$ccdlflags'
21285ccflags='$ccflags'
b4eb6b3d 21286ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21287ccname='$ccname'
b4eb6b3d 21288ccsymbols='$ccsymbols'
6b356c8e 21289ccversion='$ccversion'
5f80c64f 21290cf_by='$cf_by'
b4eb6b3d 21291cf_email='$cf_email'
5f80c64f 21292cf_time='$cf_time'
b4eb6b3d 21293charsize='$charsize'
5f80c64f
JH
21294chgrp='$chgrp'
21295chmod='$chmod'
21296chown='$chown'
b4eb6b3d 21297clocktype='$clocktype'
5f80c64f
JH
21298comm='$comm'
21299compress='$compress'
21300contains='$contains'
21301cp='$cp'
21302cpio='$cpio'
21303cpp='$cpp'
b4eb6b3d
JH
21304cpp_stuff='$cpp_stuff'
21305cppccsymbols='$cppccsymbols'
5f80c64f
JH
21306cppflags='$cppflags'
21307cpplast='$cpplast'
21308cppminus='$cppminus'
21309cpprun='$cpprun'
21310cppstdin='$cppstdin'
b4eb6b3d 21311cppsymbols='$cppsymbols'
10bc17b6 21312crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21313cryptlib='$cryptlib'
5f80c64f 21314csh='$csh'
10bc17b6
JH
21315ctermid_r_proto='$ctermid_r_proto'
21316ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21317d_Gconvert='$d_Gconvert'
21318d_PRIEUldbl='$d_PRIEUldbl'
21319d_PRIFUldbl='$d_PRIFUldbl'
21320d_PRIGUldbl='$d_PRIGUldbl'
21321d_PRIXU64='$d_PRIXU64'
21322d_PRId64='$d_PRId64'
21323d_PRIeldbl='$d_PRIeldbl'
21324d_PRIfldbl='$d_PRIfldbl'
21325d_PRIgldbl='$d_PRIgldbl'
21326d_PRIi64='$d_PRIi64'
21327d_PRIo64='$d_PRIo64'
21328d_PRIu64='$d_PRIu64'
21329d_PRIx64='$d_PRIx64'
21330d_SCNfldbl='$d_SCNfldbl'
74cac757 21331d__fwalk='$d__fwalk'
b4eb6b3d
JH
21332d_access='$d_access'
21333d_accessx='$d_accessx'
5a29c6bc 21334d_aintl='$d_aintl'
b4eb6b3d
JH
21335d_alarm='$d_alarm'
21336d_archlib='$d_archlib'
10bc17b6 21337d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21338d_atolf='$d_atolf'
21339d_atoll='$d_atoll'
24c2fff4
NC
21340d_attribute_format='$d_attribute_format'
21341d_attribute_malloc='$d_attribute_malloc'
21342d_attribute_nonnull='$d_attribute_nonnull'
21343d_attribute_noreturn='$d_attribute_noreturn'
21344d_attribute_pure='$d_attribute_pure'
21345d_attribute_unused='$d_attribute_unused'
21346d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21347d_bcmp='$d_bcmp'
21348d_bcopy='$d_bcopy'
5f80c64f 21349d_bsd='$d_bsd'
b4eb6b3d
JH
21350d_bsdgetpgrp='$d_bsdgetpgrp'
21351d_bsdsetpgrp='$d_bsdsetpgrp'
cb478989
NC
21352d_builtin_choose_expr='$d_builtin_choose_expr'
21353d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21354d_bzero='$d_bzero'
74950343 21355d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21356d_casti32='$d_casti32'
21357d_castneg='$d_castneg'
21358d_charvspr='$d_charvspr'
21359d_chown='$d_chown'
21360d_chroot='$d_chroot'
21361d_chsize='$d_chsize'
758a5d79 21362d_class='$d_class'
1466f2fb 21363d_clearenv='$d_clearenv'
b4eb6b3d 21364d_closedir='$d_closedir'
4e0554ec 21365d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21366d_const='$d_const'
5a29c6bc 21367d_copysignl='$d_copysignl'
d2ae4405 21368d_cplusplus='$d_cplusplus'
b4eb6b3d 21369d_crypt='$d_crypt'
10bc17b6 21370d_crypt_r='$d_crypt_r'
b4eb6b3d 21371d_csh='$d_csh'
10bc17b6
JH
21372d_ctermid_r='$d_ctermid_r'
21373d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21374d_cuserid='$d_cuserid'
21375d_dbl_dig='$d_dbl_dig'
2ef53570 21376d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21377d_difftime='$d_difftime'
ae0e3d3b 21378d_dirfd='$d_dirfd'
b4eb6b3d
JH
21379d_dirnamlen='$d_dirnamlen'
21380d_dlerror='$d_dlerror'
5f80c64f 21381d_dlopen='$d_dlopen'
b4eb6b3d
JH
21382d_dlsymun='$d_dlsymun'
21383d_dosuid='$d_dosuid'
10bc17b6 21384d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21385d_drand48proto='$d_drand48proto'
21386d_dup2='$d_dup2'
21387d_eaccess='$d_eaccess'
21388d_endgrent='$d_endgrent'
10bc17b6 21389d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21390d_endhent='$d_endhent'
10bc17b6 21391d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21392d_endnent='$d_endnent'
10bc17b6 21393d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21394d_endpent='$d_endpent'
10bc17b6 21395d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21396d_endpwent='$d_endpwent'
10bc17b6 21397d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21398d_endsent='$d_endsent'
10bc17b6 21399d_endservent_r='$d_endservent_r'
b4eb6b3d 21400d_eofnblk='$d_eofnblk'
5f80c64f 21401d_eunice='$d_eunice'
ff0950a8 21402d_faststdio='$d_faststdio'
b363b713 21403d_fchdir='$d_fchdir'
b4eb6b3d
JH
21404d_fchmod='$d_fchmod'
21405d_fchown='$d_fchown'
21406d_fcntl='$d_fcntl'
9d9004a9 21407d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21408d_fd_macros='$d_fd_macros'
21409d_fd_set='$d_fd_set'
21410d_fds_bits='$d_fds_bits'
21411d_fgetpos='$d_fgetpos'
758a5d79
JH
21412d_finite='$d_finite'
21413d_finitel='$d_finitel'
b4eb6b3d
JH
21414d_flexfnam='$d_flexfnam'
21415d_flock='$d_flock'
2ef53570 21416d_flockproto='$d_flockproto'
b4eb6b3d 21417d_fork='$d_fork'
758a5d79 21418d_fp_class='$d_fp_class'
b4eb6b3d 21419d_fpathconf='$d_fpathconf'
758a5d79
JH
21420d_fpclass='$d_fpclass'
21421d_fpclassify='$d_fpclassify'
21422d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21423d_fpos64_t='$d_fpos64_t'
21424d_frexpl='$d_frexpl'
21425d_fs_data_s='$d_fs_data_s'
21426d_fseeko='$d_fseeko'
21427d_fsetpos='$d_fsetpos'
21428d_fstatfs='$d_fstatfs'
21429d_fstatvfs='$d_fstatvfs'
411ab01c 21430d_fsync='$d_fsync'
b4eb6b3d
JH
21431d_ftello='$d_ftello'
21432d_ftime='$d_ftime'
704c3401 21433d_futimes='$d_futimes'
b4eb6b3d
JH
21434d_getcwd='$d_getcwd'
21435d_getespwnam='$d_getespwnam'
21436d_getfsstat='$d_getfsstat'
21437d_getgrent='$d_getgrent'
10bc17b6
JH
21438d_getgrent_r='$d_getgrent_r'
21439d_getgrgid_r='$d_getgrgid_r'
21440d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21441d_getgrps='$d_getgrps'
21442d_gethbyaddr='$d_gethbyaddr'
21443d_gethbyname='$d_gethbyname'
21444d_gethent='$d_gethent'
21445d_gethname='$d_gethname'
10bc17b6
JH
21446d_gethostbyaddr_r='$d_gethostbyaddr_r'
21447d_gethostbyname_r='$d_gethostbyname_r'
21448d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21449d_gethostprotos='$d_gethostprotos'
4e0554ec 21450d_getitimer='$d_getitimer'
b4eb6b3d 21451d_getlogin='$d_getlogin'
10bc17b6 21452d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21453d_getmnt='$d_getmnt'
21454d_getmntent='$d_getmntent'
21455d_getnbyaddr='$d_getnbyaddr'
21456d_getnbyname='$d_getnbyname'
21457d_getnent='$d_getnent'
10bc17b6
JH
21458d_getnetbyaddr_r='$d_getnetbyaddr_r'
21459d_getnetbyname_r='$d_getnetbyname_r'
21460d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21461d_getnetprotos='$d_getnetprotos'
0c0643d0 21462d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21463d_getpbyname='$d_getpbyname'
21464d_getpbynumber='$d_getpbynumber'
21465d_getpent='$d_getpent'
21466d_getpgid='$d_getpgid'
21467d_getpgrp2='$d_getpgrp2'
21468d_getpgrp='$d_getpgrp'
21469d_getppid='$d_getppid'
21470d_getprior='$d_getprior'
10bc17b6
JH
21471d_getprotobyname_r='$d_getprotobyname_r'
21472d_getprotobynumber_r='$d_getprotobynumber_r'
21473d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21474d_getprotoprotos='$d_getprotoprotos'
21475d_getprpwnam='$d_getprpwnam'
21476d_getpwent='$d_getpwent'
10bc17b6
JH
21477d_getpwent_r='$d_getpwent_r'
21478d_getpwnam_r='$d_getpwnam_r'
21479d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21480d_getsbyname='$d_getsbyname'
21481d_getsbyport='$d_getsbyport'
21482d_getsent='$d_getsent'
10bc17b6
JH
21483d_getservbyname_r='$d_getservbyname_r'
21484d_getservbyport_r='$d_getservbyport_r'
21485d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21486d_getservprotos='$d_getservprotos'
21487d_getspnam='$d_getspnam'
10bc17b6 21488d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21489d_gettimeod='$d_gettimeod'
10bc17b6 21490d_gmtime_r='$d_gmtime_r'
5f80c64f 21491d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21492d_grpasswd='$d_grpasswd'
21493d_hasmntopt='$d_hasmntopt'
21494d_htonl='$d_htonl'
5a29c6bc 21495d_ilogbl='$d_ilogbl'
de7128ac 21496d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21497d_index='$d_index'
21498d_inetaton='$d_inetaton'
21499d_int64_t='$d_int64_t'
21500d_isascii='$d_isascii'
758a5d79
JH
21501d_isfinite='$d_isfinite'
21502d_isinf='$d_isinf'
b4eb6b3d
JH
21503d_isnan='$d_isnan'
21504d_isnanl='$d_isnanl'
21505d_killpg='$d_killpg'
21506d_lchown='$d_lchown'
21507d_ldbl_dig='$d_ldbl_dig'
a663fd0a 21508d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21509d_link='$d_link'
10bc17b6 21510d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
21511d_locconv='$d_locconv'
21512d_lockf='$d_lockf'
21513d_longdbl='$d_longdbl'
21514d_longlong='$d_longlong'
21515d_lseekproto='$d_lseekproto'
21516d_lstat='$d_lstat'
21517d_madvise='$d_madvise'
1466f2fb
SP
21518d_malloc_good_size='$d_malloc_good_size'
21519d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21520d_mblen='$d_mblen'
21521d_mbstowcs='$d_mbstowcs'
21522d_mbtowc='$d_mbtowc'
21523d_memchr='$d_memchr'
21524d_memcmp='$d_memcmp'
21525d_memcpy='$d_memcpy'
21526d_memmove='$d_memmove'
21527d_memset='$d_memset'
21528d_mkdir='$d_mkdir'
21529d_mkdtemp='$d_mkdtemp'
21530d_mkfifo='$d_mkfifo'
21531d_mkstemp='$d_mkstemp'
21532d_mkstemps='$d_mkstemps'
21533d_mktime='$d_mktime'
21534d_mmap='$d_mmap'
21535d_modfl='$d_modfl'
e67aeab1 21536d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21537d_modflproto='$d_modflproto'
b4eb6b3d
JH
21538d_mprotect='$d_mprotect'
21539d_msg='$d_msg'
21540d_msg_ctrunc='$d_msg_ctrunc'
21541d_msg_dontroute='$d_msg_dontroute'
21542d_msg_oob='$d_msg_oob'
21543d_msg_peek='$d_msg_peek'
21544d_msg_proxy='$d_msg_proxy'
21545d_msgctl='$d_msgctl'
21546d_msgget='$d_msgget'
4e0554ec 21547d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21548d_msgrcv='$d_msgrcv'
21549d_msgsnd='$d_msgsnd'
21550d_msync='$d_msync'
21551d_munmap='$d_munmap'
21552d_mymalloc='$d_mymalloc'
21553d_nice='$d_nice'
2765b840 21554d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21555d_nv_preserves_uv='$d_nv_preserves_uv'
4a989ed6 21556d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21557d_off64_t='$d_off64_t'
21558d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21559d_oldpthreads='$d_oldpthreads'
21560d_oldsock='$d_oldsock'
21561d_open3='$d_open3'
21562d_pathconf='$d_pathconf'
21563d_pause='$d_pause'
21564d_perl_otherlibdirs='$d_perl_otherlibdirs'
21565d_phostname='$d_phostname'
21566d_pipe='$d_pipe'
21567d_poll='$d_poll'
5f80c64f 21568d_portable='$d_portable'
c7aff470 21569d_procselfexe='$d_procselfexe'
d6483fcc 21570d_pthread_atfork='$d_pthread_atfork'
16c773f9 21571d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21572d_pthread_yield='$d_pthread_yield'
21573d_pwage='$d_pwage'
21574d_pwchange='$d_pwchange'
21575d_pwclass='$d_pwclass'
21576d_pwcomment='$d_pwcomment'
21577d_pwexpire='$d_pwexpire'
21578d_pwgecos='$d_pwgecos'
21579d_pwpasswd='$d_pwpasswd'
21580d_pwquota='$d_pwquota'
21581d_qgcvt='$d_qgcvt'
21582d_quad='$d_quad'
10bc17b6
JH
21583d_random_r='$d_random_r'
21584d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21585d_readdir='$d_readdir'
10bc17b6 21586d_readdir_r='$d_readdir_r'
b4eb6b3d 21587d_readlink='$d_readlink'
4e0554ec
JH
21588d_readv='$d_readv'
21589d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21590d_rename='$d_rename'
21591d_rewinddir='$d_rewinddir'
21592d_rmdir='$d_rmdir'
21593d_safebcpy='$d_safebcpy'
21594d_safemcpy='$d_safemcpy'
21595d_sanemcmp='$d_sanemcmp'
ef9f17be 21596d_sbrkproto='$d_sbrkproto'
5a29c6bc 21597d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21598d_sched_yield='$d_sched_yield'
21599d_scm_rights='$d_scm_rights'
21600d_seekdir='$d_seekdir'
21601d_select='$d_select'
21602d_sem='$d_sem'
21603d_semctl='$d_semctl'
21604d_semctl_semid_ds='$d_semctl_semid_ds'
21605d_semctl_semun='$d_semctl_semun'
21606d_semget='$d_semget'
21607d_semop='$d_semop'
4e0554ec 21608d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21609d_setegid='$d_setegid'
21610d_seteuid='$d_seteuid'
21611d_setgrent='$d_setgrent'
10bc17b6 21612d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21613d_setgrps='$d_setgrps'
21614d_sethent='$d_sethent'
10bc17b6 21615d_sethostent_r='$d_sethostent_r'
4e0554ec 21616d_setitimer='$d_setitimer'
b4eb6b3d
JH
21617d_setlinebuf='$d_setlinebuf'
21618d_setlocale='$d_setlocale'
10bc17b6 21619d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21620d_setnent='$d_setnent'
10bc17b6 21621d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21622d_setpent='$d_setpent'
21623d_setpgid='$d_setpgid'
21624d_setpgrp2='$d_setpgrp2'
21625d_setpgrp='$d_setpgrp'
21626d_setprior='$d_setprior'
21627d_setproctitle='$d_setproctitle'
10bc17b6 21628d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21629d_setpwent='$d_setpwent'
10bc17b6 21630d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21631d_setregid='$d_setregid'
21632d_setresgid='$d_setresgid'
21633d_setresuid='$d_setresuid'
21634d_setreuid='$d_setreuid'
21635d_setrgid='$d_setrgid'
21636d_setruid='$d_setruid'
21637d_setsent='$d_setsent'
10bc17b6 21638d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21639d_setsid='$d_setsid'
21640d_setvbuf='$d_setvbuf'
21641d_sfio='$d_sfio'
21642d_shm='$d_shm'
21643d_shmat='$d_shmat'
21644d_shmatprototype='$d_shmatprototype'
21645d_shmctl='$d_shmctl'
21646d_shmdt='$d_shmdt'
21647d_shmget='$d_shmget'
21648d_sigaction='$d_sigaction'
983dbef6 21649d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21650d_sigsetjmp='$d_sigsetjmp'
4531c2c7 21651d_snprintf='$d_snprintf'
5109a103 21652d_sitearch='$d_sitearch'
49a78c82 21653d_sockatmark='$d_sockatmark'
2ef53570 21654d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21655d_socket='$d_socket'
21656d_socklen_t='$d_socklen_t'
21657d_sockpair='$d_sockpair'
21658d_socks5_init='$d_socks5_init'
704c3401 21659d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21660d_sqrtl='$d_sqrtl'
10bc17b6
JH
21661d_srand48_r='$d_srand48_r'
21662d_srandom_r='$d_srandom_r'
eef837ea 21663d_sresgproto='$d_sresgproto'
640374d0 21664d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21665d_statblks='$d_statblks'
21666d_statfs_f_flags='$d_statfs_f_flags'
21667d_statfs_s='$d_statfs_s'
21668d_statvfs='$d_statvfs'
21669d_stdio_cnt_lval='$d_stdio_cnt_lval'
21670d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21671d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21672d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21673d_stdio_stream_array='$d_stdio_stream_array'
21674d_stdiobase='$d_stdiobase'
21675d_stdstdio='$d_stdstdio'
21676d_strchr='$d_strchr'
21677d_strcoll='$d_strcoll'
21678d_strctcpy='$d_strctcpy'
21679d_strerrm='$d_strerrm'
21680d_strerror='$d_strerror'
10bc17b6 21681d_strerror_r='$d_strerror_r'
b3c85772 21682d_strftime='$d_strftime'
84baed4c
CB
21683d_strlcat='$d_strlcat'
21684d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21685d_strtod='$d_strtod'
21686d_strtol='$d_strtol'
21687d_strtold='$d_strtold'
21688d_strtoll='$d_strtoll'
28e5dec8 21689d_strtoq='$d_strtoq'
b4eb6b3d
JH
21690d_strtoul='$d_strtoul'
21691d_strtoull='$d_strtoull'
21692d_strtouq='$d_strtouq'
21693d_strxfrm='$d_strxfrm'
21694d_suidsafe='$d_suidsafe'
21695d_symlink='$d_symlink'
21696d_syscall='$d_syscall'
2ef53570 21697d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21698d_sysconf='$d_sysconf'
21699d_sysernlst='$d_sysernlst'
21700d_syserrlst='$d_syserrlst'
21701d_system='$d_system'
21702d_tcgetpgrp='$d_tcgetpgrp'
21703d_tcsetpgrp='$d_tcsetpgrp'
21704d_telldir='$d_telldir'
21705d_telldirproto='$d_telldirproto'
21706d_time='$d_time'
21707d_times='$d_times'
14b90194
JH
21708d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21709d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21710d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21711d_truncate='$d_truncate'
10bc17b6 21712d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21713d_tzname='$d_tzname'
4e0554ec
JH
21714d_u32align='$d_u32align'
21715d_ualarm='$d_ualarm'
b4eb6b3d
JH
21716d_umask='$d_umask'
21717d_uname='$d_uname'
21718d_union_semun='$d_union_semun'
758a5d79 21719d_unordered='$d_unordered'
1466f2fb 21720d_unsetenv='$d_unsetenv'
4e0554ec 21721d_usleep='$d_usleep'
2ef53570 21722d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21723d_ustat='$d_ustat'
21724d_vendorarch='$d_vendorarch'
21725d_vendorbin='$d_vendorbin'
21726d_vendorlib='$d_vendorlib'
6e1038e0 21727d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21728d_vfork='$d_vfork'
21729d_void_closedir='$d_void_closedir'
21730d_voidsig='$d_voidsig'
21731d_voidtty='$d_voidtty'
21732d_volatile='$d_volatile'
21733d_vprintf='$d_vprintf'
4531c2c7 21734d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21735d_wait4='$d_wait4'
21736d_waitpid='$d_waitpid'
21737d_wcstombs='$d_wcstombs'
21738d_wctomb='$d_wctomb'
4e0554ec 21739d_writev='$d_writev'
5f80c64f
JH
21740d_xenix='$d_xenix'
21741date='$date'
b4eb6b3d
JH
21742db_hashtype='$db_hashtype'
21743db_prefixtype='$db_prefixtype'
640374d0
JH
21744db_version_major='$db_version_major'
21745db_version_minor='$db_version_minor'
21746db_version_patch='$db_version_patch'
b4eb6b3d
JH
21747defvoidused='$defvoidused'
21748direntrytype='$direntrytype'
21749dlext='$dlext'
5f80c64f 21750dlsrc='$dlsrc'
b4eb6b3d
JH
21751doublesize='$doublesize'
21752drand01='$drand01'
10bc17b6 21753drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21754dynamic_ext='$dynamic_ext'
21755eagain='$eagain'
21756ebcdic='$ebcdic'
5f80c64f
JH
21757echo='$echo'
21758egrep='$egrep'
21759emacs='$emacs'
10bc17b6
JH
21760endgrent_r_proto='$endgrent_r_proto'
21761endhostent_r_proto='$endhostent_r_proto'
21762endnetent_r_proto='$endnetent_r_proto'
21763endprotoent_r_proto='$endprotoent_r_proto'
21764endpwent_r_proto='$endpwent_r_proto'
21765endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21766eunicefix='$eunicefix'
21767exe_ext='$exe_ext'
21768expr='$expr'
b4eb6b3d 21769extensions='$extensions'
6fcddf3b 21770extras='$extras'
b4eb6b3d
JH
21771fflushNULL='$fflushNULL'
21772fflushall='$fflushall'
5f80c64f
JH
21773find='$find'
21774firstmakefile='$firstmakefile'
21775flex='$flex'
b4eb6b3d
JH
21776fpossize='$fpossize'
21777fpostype='$fpostype'
21778freetype='$freetype'
5440bc8e 21779from='$from'
b4eb6b3d
JH
21780full_ar='$full_ar'
21781full_csh='$full_csh'
21782full_sed='$full_sed'
2d736872 21783gccansipedantic='$gccansipedantic'
5b463ca7 21784gccosandvers='$gccosandvers'
5f80c64f 21785gccversion='$gccversion'
10bc17b6
JH
21786getgrent_r_proto='$getgrent_r_proto'
21787getgrgid_r_proto='$getgrgid_r_proto'
21788getgrnam_r_proto='$getgrnam_r_proto'
21789gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21790gethostbyname_r_proto='$gethostbyname_r_proto'
21791gethostent_r_proto='$gethostent_r_proto'
21792getlogin_r_proto='$getlogin_r_proto'
21793getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21794getnetbyname_r_proto='$getnetbyname_r_proto'
21795getnetent_r_proto='$getnetent_r_proto'
21796getprotobyname_r_proto='$getprotobyname_r_proto'
21797getprotobynumber_r_proto='$getprotobynumber_r_proto'
21798getprotoent_r_proto='$getprotoent_r_proto'
21799getpwent_r_proto='$getpwent_r_proto'
21800getpwnam_r_proto='$getpwnam_r_proto'
21801getpwuid_r_proto='$getpwuid_r_proto'
21802getservbyname_r_proto='$getservbyname_r_proto'
21803getservbyport_r_proto='$getservbyport_r_proto'
21804getservent_r_proto='$getservent_r_proto'
21805getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21806gidformat='$gidformat'
21807gidsign='$gidsign'
21808gidsize='$gidsize'
21809gidtype='$gidtype'
5f80c64f 21810glibpth='$glibpth'
3c728e00 21811gmake='$gmake'
10bc17b6 21812gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21813gnulibc_version='$gnulibc_version'
5f80c64f 21814grep='$grep'
b4eb6b3d
JH
21815groupcat='$groupcat'
21816groupstype='$groupstype'
5f80c64f 21817gzip='$gzip'
b4eb6b3d
JH
21818h_fcntl='$h_fcntl'
21819h_sysfile='$h_sysfile'
5f80c64f 21820hint='$hint'
b4eb6b3d 21821hostcat='$hostcat'
6e1038e0
MB
21822html1dir='$html1dir'
21823html1direxp='$html1direxp'
21824html3dir='$html3dir'
21825html3direxp='$html3direxp'
b4eb6b3d
JH
21826i16size='$i16size'
21827i16type='$i16type'
21828i32size='$i32size'
21829i32type='$i32type'
21830i64size='$i64size'
21831i64type='$i64type'
21832i8size='$i8size'
21833i8type='$i8type'
21834i_arpainet='$i_arpainet'
21835i_bsdioctl='$i_bsdioctl'
10bc17b6 21836i_crypt='$i_crypt'
b4eb6b3d
JH
21837i_db='$i_db'
21838i_dbm='$i_dbm'
21839i_dirent='$i_dirent'
5f80c64f 21840i_dld='$i_dld'
b4eb6b3d
JH
21841i_dlfcn='$i_dlfcn'
21842i_fcntl='$i_fcntl'
21843i_float='$i_float'
758a5d79
JH
21844i_fp='$i_fp'
21845i_fp_class='$i_fp_class'
b4eb6b3d
JH
21846i_gdbm='$i_gdbm'
21847i_grp='$i_grp'
b4eb6b3d
JH
21848i_ieeefp='$i_ieeefp'
21849i_inttypes='$i_inttypes'
2765b840 21850i_langinfo='$i_langinfo'
b4eb6b3d
JH
21851i_libutil='$i_libutil'
21852i_limits='$i_limits'
21853i_locale='$i_locale'
21854i_machcthr='$i_machcthr'
21855i_malloc='$i_malloc'
21856i_math='$i_math'
21857i_memory='$i_memory'
21858i_mntent='$i_mntent'
21859i_ndbm='$i_ndbm'
21860i_netdb='$i_netdb'
21861i_neterrno='$i_neterrno'
21862i_netinettcp='$i_netinettcp'
21863i_niin='$i_niin'
21864i_poll='$i_poll'
21865i_prot='$i_prot'
21866i_pthread='$i_pthread'
21867i_pwd='$i_pwd'
21868i_rpcsvcdbm='$i_rpcsvcdbm'
21869i_sfio='$i_sfio'
21870i_sgtty='$i_sgtty'
21871i_shadow='$i_shadow'
21872i_socks='$i_socks'
21873i_stdarg='$i_stdarg'
21874i_stddef='$i_stddef'
21875i_stdlib='$i_stdlib'
21876i_string='$i_string'
21877i_sunmath='$i_sunmath'
21878i_sysaccess='$i_sysaccess'
21879i_sysdir='$i_sysdir'
21880i_sysfile='$i_sysfile'
21881i_sysfilio='$i_sysfilio'
21882i_sysin='$i_sysin'
21883i_sysioctl='$i_sysioctl'
21884i_syslog='$i_syslog'
21885i_sysmman='$i_sysmman'
21886i_sysmode='$i_sysmode'
21887i_sysmount='$i_sysmount'
21888i_sysndir='$i_sysndir'
21889i_sysparam='$i_sysparam'
21890i_sysresrc='$i_sysresrc'
21891i_syssecrt='$i_syssecrt'
21892i_sysselct='$i_sysselct'
21893i_syssockio='$i_syssockio'
21894i_sysstat='$i_sysstat'
21895i_sysstatfs='$i_sysstatfs'
21896i_sysstatvfs='$i_sysstatvfs'
21897i_systime='$i_systime'
21898i_systimek='$i_systimek'
21899i_systimes='$i_systimes'
21900i_systypes='$i_systypes'
21901i_sysuio='$i_sysuio'
21902i_sysun='$i_sysun'
21903i_sysutsname='$i_sysutsname'
21904i_sysvfs='$i_sysvfs'
21905i_syswait='$i_syswait'
21906i_termio='$i_termio'
21907i_termios='$i_termios'
21908i_time='$i_time'
21909i_unistd='$i_unistd'
21910i_ustat='$i_ustat'
21911i_utime='$i_utime'
21912i_values='$i_values'
21913i_varargs='$i_varargs'
21914i_varhdr='$i_varhdr'
21915i_vfork='$i_vfork'
5f80c64f 21916ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21917inc_version_list='$inc_version_list'
21918inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21919incpath='$incpath'
21920inews='$inews'
de7128ac 21921initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
21922installarchlib='$installarchlib'
21923installbin='$installbin'
6e1038e0
MB
21924installhtml1dir='$installhtml1dir'
21925installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21926installman1dir='$installman1dir'
21927installman3dir='$installman3dir'
21928installprefix='$installprefix'
21929installprefixexp='$installprefixexp'
21930installprivlib='$installprivlib'
21931installscript='$installscript'
21932installsitearch='$installsitearch'
21933installsitebin='$installsitebin'
3bb95762
JH
21934installsitehtml1dir='$installsitehtml1dir'
21935installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21936installsitelib='$installsitelib'
3bb95762
JH
21937installsiteman1dir='$installsiteman1dir'
21938installsiteman3dir='$installsiteman3dir'
6e1038e0 21939installsitescript='$installsitescript'
b4eb6b3d
JH
21940installstyle='$installstyle'
21941installusrbinperl='$installusrbinperl'
21942installvendorarch='$installvendorarch'
21943installvendorbin='$installvendorbin'
3bb95762
JH
21944installvendorhtml1dir='$installvendorhtml1dir'
21945installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21946installvendorlib='$installvendorlib'
3bb95762
JH
21947installvendorman1dir='$installvendorman1dir'
21948installvendorman3dir='$installvendorman3dir'
6e1038e0 21949installvendorscript='$installvendorscript'
b4eb6b3d 21950intsize='$intsize'
4b661809 21951issymlink='$issymlink'
b4eb6b3d
JH
21952ivdformat='$ivdformat'
21953ivsize='$ivsize'
21954ivtype='$ivtype'
21955known_extensions='$known_extensions'
5f80c64f 21956ksh='$ksh'
5f80c64f
JH
21957ld='$ld'
21958lddlflags='$lddlflags'
21959ldflags='$ldflags'
b4eb6b3d
JH
21960ldflags_uselargefiles='$ldflags_uselargefiles'
21961ldlibpthname='$ldlibpthname'
5f80c64f
JH
21962less='$less'
21963lib_ext='$lib_ext'
21964libc='$libc'
b4eb6b3d 21965libperl='$libperl'
5f80c64f
JH
21966libpth='$libpth'
21967libs='$libs'
43999f95
JH
21968libsdirs='$libsdirs'
21969libsfiles='$libsfiles'
21970libsfound='$libsfound'
13b3f787 21971libspath='$libspath'
5f80c64f 21972libswanted='$libswanted'
b4eb6b3d 21973libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21974line='$line'
21975lint='$lint'
21976lkflags='$lkflags'
21977ln='$ln'
21978lns='$lns'
10bc17b6 21979localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21980locincpth='$locincpth'
21981loclibpth='$loclibpth'
b4eb6b3d
JH
21982longdblsize='$longdblsize'
21983longlongsize='$longlongsize'
21984longsize='$longsize'
5f80c64f
JH
21985lp='$lp'
21986lpr='$lpr'
21987ls='$ls'
b4eb6b3d
JH
21988lseeksize='$lseeksize'
21989lseektype='$lseektype'
5109a103 21990mad='$mad'
de7128ac
NC
21991madlyh='$madlyh'
21992madlyobj='$madlyobj'
21993madlysrc='$madlysrc'
5f80c64f
JH
21994mail='$mail'
21995mailx='$mailx'
21996make='$make'
21997make_set_make='$make_set_make'
b4eb6b3d
JH
21998mallocobj='$mallocobj'
21999mallocsrc='$mallocsrc'
22000malloctype='$malloctype'
22001man1dir='$man1dir'
22002man1direxp='$man1direxp'
22003man1ext='$man1ext'
22004man3dir='$man3dir'
22005man3direxp='$man3direxp'
22006man3ext='$man3ext'
5f80c64f 22007mips_type='$mips_type'
bd43df42 22008mistrustnm='$mistrustnm'
5f80c64f 22009mkdir='$mkdir'
b4eb6b3d
JH
22010mmaptype='$mmaptype'
22011modetype='$modetype'
5f80c64f 22012more='$more'
b4eb6b3d 22013multiarch='$multiarch'
5f80c64f 22014mv='$mv'
b4eb6b3d
JH
22015myarchname='$myarchname'
22016mydomain='$mydomain'
22017myhostname='$myhostname'
5f80c64f
JH
22018myuname='$myuname'
22019n='$n'
2cc61e15 22020need_va_copy='$need_va_copy'
b4eb6b3d
JH
22021netdb_hlen_type='$netdb_hlen_type'
22022netdb_host_type='$netdb_host_type'
22023netdb_name_type='$netdb_name_type'
22024netdb_net_type='$netdb_net_type'
5f80c64f
JH
22025nm='$nm'
22026nm_opt='$nm_opt'
22027nm_so_opt='$nm_so_opt'
b4eb6b3d 22028nonxs_ext='$nonxs_ext'
5f80c64f 22029nroff='$nroff'
b4eb6b3d
JH
22030nvEUformat='$nvEUformat'
22031nvFUformat='$nvFUformat'
22032nvGUformat='$nvGUformat'
53133ed1 22033nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22034nveformat='$nveformat'
22035nvfformat='$nvfformat'
22036nvgformat='$nvgformat'
22037nvsize='$nvsize'
22038nvtype='$nvtype'
22039o_nonblock='$o_nonblock'
5f80c64f 22040obj_ext='$obj_ext'
b4eb6b3d 22041old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22042optimize='$optimize'
b4eb6b3d 22043orderlib='$orderlib'
5f80c64f
JH
22044osname='$osname'
22045osvers='$osvers'
b4eb6b3d 22046otherlibdirs='$otherlibdirs'
5f80c64f 22047package='$package'
b4eb6b3d
JH
22048pager='$pager'
22049passcat='$passcat'
22050patchlevel='$patchlevel'
5f80c64f 22051path_sep='$path_sep'
b4eb6b3d 22052perl5='$perl5'
5f80c64f 22053perl='$perl'
151e6568 22054perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22055perladmin='$perladmin'
9c839522 22056perllibs='$perllibs'
b4eb6b3d 22057perlpath='$perlpath'
5f80c64f 22058pg='$pg'
b4eb6b3d
JH
22059phostname='$phostname'
22060pidtype='$pidtype'
5f80c64f
JH
22061plibpth='$plibpth'
22062pmake='$pmake'
22063pr='$pr'
b4eb6b3d
JH
22064prefix='$prefix'
22065prefixexp='$prefixexp'
22066privlib='$privlib'
22067privlibexp='$privlibexp'
f24dbf84 22068procselfexe='$procselfexe'
b4eb6b3d
JH
22069prototype='$prototype'
22070ptrsize='$ptrsize'
22071quadkind='$quadkind'
22072quadtype='$quadtype'
22073randbits='$randbits'
22074randfunc='$randfunc'
10bc17b6 22075random_r_proto='$random_r_proto'
b4eb6b3d
JH
22076randseedtype='$randseedtype'
22077ranlib='$ranlib'
22078rd_nodata='$rd_nodata'
10bc17b6
JH
22079readdir64_r_proto='$readdir64_r_proto'
22080readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22081revision='$revision'
5f80c64f
JH
22082rm='$rm'
22083rmail='$rmail'
5440bc8e 22084run='$run'
5f80c64f 22085runnm='$runnm'
b4eb6b3d
JH
22086sPRIEUldbl='$sPRIEUldbl'
22087sPRIFUldbl='$sPRIFUldbl'
22088sPRIGUldbl='$sPRIGUldbl'
22089sPRIXU64='$sPRIXU64'
22090sPRId64='$sPRId64'
22091sPRIeldbl='$sPRIeldbl'
22092sPRIfldbl='$sPRIfldbl'
22093sPRIgldbl='$sPRIgldbl'
22094sPRIi64='$sPRIi64'
22095sPRIo64='$sPRIo64'
22096sPRIu64='$sPRIu64'
22097sPRIx64='$sPRIx64'
22098sSCNfldbl='$sSCNfldbl'
22099sched_yield='$sched_yield'
22100scriptdir='$scriptdir'
22101scriptdirexp='$scriptdirexp'
5f80c64f 22102sed='$sed'
b4eb6b3d
JH
22103seedfunc='$seedfunc'
22104selectminbits='$selectminbits'
22105selecttype='$selecttype'
5f80c64f 22106sendmail='$sendmail'
10bc17b6
JH
22107setgrent_r_proto='$setgrent_r_proto'
22108sethostent_r_proto='$sethostent_r_proto'
22109setlocale_r_proto='$setlocale_r_proto'
22110setnetent_r_proto='$setnetent_r_proto'
22111setprotoent_r_proto='$setprotoent_r_proto'
22112setpwent_r_proto='$setpwent_r_proto'
22113setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22114sh='$sh'
22115shar='$shar'
22116sharpbang='$sharpbang'
b4eb6b3d
JH
22117shmattype='$shmattype'
22118shortsize='$shortsize'
22119shrpenv='$shrpenv'
5f80c64f 22120shsharp='$shsharp'
b4eb6b3d
JH
22121sig_count='$sig_count'
22122sig_name='$sig_name'
22123sig_name_init='$sig_name_init'
22124sig_num='$sig_num'
22125sig_num_init='$sig_num_init'
76d3c696 22126sig_size='$sig_size'
b4eb6b3d
JH
22127signal_t='$signal_t'
22128sitearch='$sitearch'
22129sitearchexp='$sitearchexp'
22130sitebin='$sitebin'
22131sitebinexp='$sitebinexp'
3bb95762
JH
22132sitehtml1dir='$sitehtml1dir'
22133sitehtml1direxp='$sitehtml1direxp'
22134sitehtml3dir='$sitehtml3dir'
22135sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22136sitelib='$sitelib'
22137sitelib_stem='$sitelib_stem'
22138sitelibexp='$sitelibexp'
3bb95762
JH
22139siteman1dir='$siteman1dir'
22140siteman1direxp='$siteman1direxp'
22141siteman3dir='$siteman3dir'
22142siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22143siteprefix='$siteprefix'
22144siteprefixexp='$siteprefixexp'
6e1038e0
MB
22145sitescript='$sitescript'
22146sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22147sizesize='$sizesize'
22148sizetype='$sizetype'
5f80c64f
JH
22149sleep='$sleep'
22150smail='$smail'
5f80c64f 22151so='$so'
b4eb6b3d
JH
22152sockethdr='$sockethdr'
22153socketlib='$socketlib'
22154socksizetype='$socksizetype'
5f80c64f
JH
22155sort='$sort'
22156spackage='$spackage'
22157spitshell='$spitshell'
10bc17b6
JH
22158srand48_r_proto='$srand48_r_proto'
22159srandom_r_proto='$srandom_r_proto'
5f80c64f 22160src='$src'
b4eb6b3d
JH
22161ssizetype='$ssizetype'
22162startperl='$startperl'
5f80c64f 22163startsh='$startsh'
b4eb6b3d
JH
22164static_ext='$static_ext'
22165stdchar='$stdchar'
22166stdio_base='$stdio_base'
22167stdio_bufsiz='$stdio_bufsiz'
22168stdio_cnt='$stdio_cnt'
22169stdio_filbuf='$stdio_filbuf'
22170stdio_ptr='$stdio_ptr'
22171stdio_stream_array='$stdio_stream_array'
10bc17b6 22172strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22173strings='$strings'
5f80c64f 22174submit='$submit'
b4eb6b3d
JH
22175subversion='$subversion'
22176sysman='$sysman'
5f80c64f
JH
22177tail='$tail'
22178tar='$tar'
5440bc8e 22179targetarch='$targetarch'
5f80c64f
JH
22180tbl='$tbl'
22181tee='$tee'
22182test='$test'
b4eb6b3d
JH
22183timeincl='$timeincl'
22184timetype='$timetype'
10bc17b6 22185tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22186to='$to'
5f80c64f
JH
22187touch='$touch'
22188tr='$tr'
22189trnl='$trnl'
22190troff='$troff'
10bc17b6 22191ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22192u16size='$u16size'
22193u16type='$u16type'
22194u32size='$u32size'
22195u32type='$u32type'
22196u64size='$u64size'
22197u64type='$u64type'
22198u8size='$u8size'
22199u8type='$u8type'
22200uidformat='$uidformat'
22201uidsign='$uidsign'
22202uidsize='$uidsize'
22203uidtype='$uidtype'
5f80c64f
JH
22204uname='$uname'
22205uniq='$uniq'
b4eb6b3d
JH
22206uquadtype='$uquadtype'
22207use5005threads='$use5005threads'
22208use64bitall='$use64bitall'
22209use64bitint='$use64bitint'
5440bc8e 22210usecrosscompile='$usecrosscompile'
5f80c64f 22211usedl='$usedl'
ff0950a8 22212usefaststdio='$usefaststdio'
b4eb6b3d
JH
22213useithreads='$useithreads'
22214uselargefiles='$uselargefiles'
22215uselongdouble='$uselongdouble'
c53af328 22216usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22217usemorebits='$usemorebits'
22218usemultiplicity='$usemultiplicity'
22219usemymalloc='$usemymalloc'
5f80c64f 22220usenm='$usenm'
b4eb6b3d
JH
22221useopcode='$useopcode'
22222useperlio='$useperlio'
22223useposix='$useposix'
9514c62b 22224usereentrant='$usereentrant'
63fe74dd 22225userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22226usesfio='$usesfio'
22227useshrplib='$useshrplib'
5d39362b 22228usesitecustomize='$usesitecustomize'
29209bc5 22229usesocks='$usesocks'
b4eb6b3d
JH
22230usethreads='$usethreads'
22231usevendorprefix='$usevendorprefix'
22232usevfork='$usevfork'
5f80c64f
JH
22233usrinc='$usrinc'
22234uuname='$uuname'
b4eb6b3d
JH
22235uvXUformat='$uvXUformat'
22236uvoformat='$uvoformat'
22237uvsize='$uvsize'
22238uvtype='$uvtype'
22239uvuformat='$uvuformat'
22240uvxformat='$uvxformat'
22241vendorarch='$vendorarch'
22242vendorarchexp='$vendorarchexp'
22243vendorbin='$vendorbin'
22244vendorbinexp='$vendorbinexp'
3bb95762
JH
22245vendorhtml1dir='$vendorhtml1dir'
22246vendorhtml1direxp='$vendorhtml1direxp'
22247vendorhtml3dir='$vendorhtml3dir'
22248vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22249vendorlib='$vendorlib'
22250vendorlib_stem='$vendorlib_stem'
22251vendorlibexp='$vendorlibexp'
3bb95762
JH
22252vendorman1dir='$vendorman1dir'
22253vendorman1direxp='$vendorman1direxp'
22254vendorman3dir='$vendorman3dir'
22255vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22256vendorprefix='$vendorprefix'
22257vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22258vendorscript='$vendorscript'
22259vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22260version='$version'
861eb78d 22261version_patchlevel_string='$version_patchlevel_string'
d56c5707 22262versiononly='$versiononly'
5f80c64f 22263vi='$vi'
b4eb6b3d 22264voidflags='$voidflags'
5f80c64f 22265xlibpth='$xlibpth'
3659ebf1
JH
22266yacc='$yacc'
22267yaccflags='$yaccflags'
5f80c64f
JH
22268zcat='$zcat'
22269zip='$zip'
22270EOT
22271
22272: Add in command line options if available
22273$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22274
22275: add special variables
22276$test -f $src/patchlevel.h && \
d00b958f 22277awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22278echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22279echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22280
22281: propagate old symbols
22282if $test -f UU/config.sh; then
381aa1ff 22283 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22284 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22285 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22286 set X `cat UU/oldsyms`
22287 shift
22288 case $# in
22289 0) ;;
22290 *)
22291 cat <<EOM
22292Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22293EOM
22294 echo "# Variables propagated from previous config.sh file." >>config.sh
22295 for sym in `cat UU/oldsyms`; do
22296 echo " Propagating $hint variable "'$'"$sym..."
22297 eval 'tmp="$'"${sym}"'"'
22298 echo "$tmp" | \
22299 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22300 done
22301 ;;
22302 esac
22303fi
22304
22305: Finish up by extracting the .SH files
22306case "$alldone" in
22307exit)
22308 $rm -rf UU
24ccb310 22309 echo "Extraction done."
5f80c64f
JH
22310 exit 0
22311 ;;
22312cont)
22313 ;;
22314'')
22315 dflt=''
22316 nostick=true
22317 $cat <<EOM
22318
22319If you'd like to make any changes to the config.sh file before I begin
22320to configure things, do it as a shell escape now (e.g. !vi config.sh).
22321
22322EOM
22323 rp="Press return or use a shell escape to edit config.sh:"
22324 . UU/myread
22325 nostick=''
22326 case "$ans" in
22327 '') ;;
22328 *) : in case they cannot read
22329 sh 1>&4 -c "$ans";;
22330 esac
22331 ;;
22332esac
22333
22334: if this fails, just run all the .SH files by hand
22335. ./config.sh
22336
22337echo " "
22338exec 1>&4
a43e8593 22339pwd=`pwd`
5f80c64f 22340. ./UU/extract
6904989c 22341cd "$pwd"
5f80c64f
JH
22342
22343if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22344 dflt=y
22345 case "$silent" in
22346 true) ;;
22347 *)
22348 $cat <<EOM
22349
22350Now you need to generate make dependencies by running "$make depend".
22351You might prefer to run it in background: "$make depend > makedepend.out &"
22352It can take a while, so you might not want to run it right now.
22353
22354EOM
22355 ;;
22356 esac
22357 rp="Run $make depend now?"
22358 . UU/myread
22359 case "$ans" in
22360 y*)
3d5d58b1 22361 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22362 ;;
22363 *)
22364 echo "You must run '$make depend' then '$make'."
22365 ;;
22366 esac
22367elif test -f [Mm]akefile; then
22368 echo " "
22369 echo "Now you must run a $make."
22370else
24ccb310 22371 echo "Configure done."
5f80c64f
JH
22372fi
22373
22374if $test -f Policy.sh; then
22375 $cat <<EOM
22376
22377If you compile $package on a different machine or from a different object
22378directory, copy the Policy.sh file from this object directory to the
22379new one before you run Configure -- this will help you with most of
22380the policy defaults.
22381
22382EOM
22383fi
22384if $test -f config.msg; then
22385 echo "Hmm. I also noted the following information while running:"
22386 echo " "
22387 $cat config.msg >&4
22388 $rm -f config.msg
22389fi
22390$rm -f kit*isdone ark*isdone
22391$rm -rf UU
22392
22393: End of Configure
22394