This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't include utime.h in vms.c -- it collides with
[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#
5cadb3f3
MB
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#
d13b798d 29# Generated on Wed Nov 9 11:15:45 CET 2005 [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
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
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 :-]
5c728af0 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]'`
5c728af0 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"
87bdd940 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=''
6b34ded5 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=''
322installbin=''
b4eb6b3d 323byteorder=''
2304df62 324cc=''
2304df62
AD
325ccflags=''
326cppflags=''
327ldflags=''
328lkflags=''
8e07c86e 329locincpth=''
2304df62 330optimize=''
b4eb6b3d 331cf_email=''
2304df62
AD
332cf_by=''
333cf_time=''
b4eb6b3d 334charsize=''
2304df62 335contains=''
b4eb6b3d 336cpp_stuff=''
2304df62
AD
337cpplast=''
338cppminus=''
339cpprun=''
340cppstdin=''
74cac757 341d__fwalk=''
b4eb6b3d
JH
342d_access=''
343d_accessx=''
55954f19 344d_aintl=''
b4eb6b3d 345d_alarm=''
10bc17b6
JH
346asctime_r_proto=''
347d_asctime_r=''
0dbb1585
AL
348d_attribute_format=''
349d_attribute_malloc=''
350d_attribute_nonnull=''
351d_attribute_noreturn=''
352d_attribute_pure=''
353d_attribute_unused=''
354d_attribute_warn_unused_result=''
b4eb6b3d
JH
355d_bcmp=''
356d_bcopy=''
357d_bzero=''
358d_casti32=''
359castflags=''
360d_castneg=''
361d_chown=''
362d_chroot=''
363d_chsize=''
758a5d79 364d_class=''
b0a2e8e6 365d_clearenv=''
b4eb6b3d
JH
366d_closedir=''
367d_void_closedir=''
4e0554ec 368d_cmsghdr_s=''
b4eb6b3d 369d_const=''
36adc09b 370d_copysignl=''
b4eb6b3d
JH
371cryptlib=''
372d_crypt=''
10bc17b6
JH
373crypt_r_proto=''
374d_crypt_r=''
b4eb6b3d
JH
375d_csh=''
376full_csh=''
10bc17b6
JH
377ctermid_r_proto=''
378d_ctermid_r=''
379ctime_r_proto=''
380d_ctime_r=''
b4eb6b3d
JH
381d_cuserid=''
382d_dbl_dig=''
2ef53570 383d_dbminitproto=''
b4eb6b3d 384d_difftime=''
ae0e3d3b 385d_dirfd=''
b4eb6b3d 386d_dlerror=''
a0d0e21e 387d_dlopen=''
b4eb6b3d
JH
388d_dlsymun=''
389d_dosuid=''
390d_suidsafe=''
10bc17b6
JH
391d_drand48_r=''
392drand48_r_proto=''
b4eb6b3d
JH
393d_drand48proto=''
394d_dup2=''
395d_eaccess=''
396d_endgrent=''
10bc17b6
JH
397d_endgrent_r=''
398endgrent_r_proto=''
b4eb6b3d 399d_endhent=''
10bc17b6
JH
400d_endhostent_r=''
401endhostent_r_proto=''
b4eb6b3d 402d_endnent=''
10bc17b6
JH
403d_endnetent_r=''
404endnetent_r_proto=''
b4eb6b3d 405d_endpent=''
10bc17b6
JH
406d_endprotoent_r=''
407endprotoent_r_proto=''
b4eb6b3d 408d_endpwent=''
10bc17b6
JH
409d_endpwent_r=''
410endpwent_r_proto=''
b4eb6b3d 411d_endsent=''
10bc17b6
JH
412d_endservent_r=''
413endservent_r_proto=''
15b61c98 414d_faststdio=''
b363b713 415d_fchdir=''
b4eb6b3d
JH
416d_fchmod=''
417d_fchown=''
418d_fcntl=''
9d9004a9 419d_fcntl_can_lock=''
b4eb6b3d
JH
420d_fd_macros=''
421d_fd_set=''
422d_fds_bits=''
423d_fgetpos=''
758a5d79
JH
424d_finite=''
425d_finitel=''
b4eb6b3d
JH
426d_flexfnam=''
427d_flock=''
2ef53570 428d_flockproto=''
b4eb6b3d 429d_fork=''
758a5d79
JH
430d_fp_class=''
431d_fpclass=''
432d_fpclassify=''
433d_fpclassl=''
b4eb6b3d
JH
434d_fpos64_t=''
435d_frexpl=''
436d_fs_data_s=''
437d_fseeko=''
438d_fsetpos=''
439d_fstatfs=''
411ab01c 440d_fsync=''
b4eb6b3d
JH
441d_ftello=''
442d_ftime=''
443d_gettimeod=''
dc814df1 444d_futimes=''
b4eb6b3d
JH
445d_Gconvert=''
446d_getcwd=''
447d_getespwnam=''
448d_getfsstat=''
449d_getgrent=''
10bc17b6
JH
450d_getgrent_r=''
451getgrent_r_proto=''
452d_getgrgid_r=''
453getgrgid_r_proto=''
454d_getgrnam_r=''
455getgrnam_r_proto=''
b4eb6b3d
JH
456d_getgrps=''
457d_gethbyaddr=''
458d_gethbyname=''
459d_gethent=''
460aphostname=''
461d_gethname=''
462d_phostname=''
463d_uname=''
10bc17b6
JH
464d_gethostbyaddr_r=''
465gethostbyaddr_r_proto=''
466d_gethostbyname_r=''
467gethostbyname_r_proto=''
468d_gethostent_r=''
469gethostent_r_proto=''
b4eb6b3d 470d_gethostprotos=''
4e0554ec 471d_getitimer=''
b4eb6b3d 472d_getlogin=''
10bc17b6
JH
473d_getlogin_r=''
474getlogin_r_proto=''
b4eb6b3d
JH
475d_getmnt=''
476d_getmntent=''
477d_getnbyaddr=''
478d_getnbyname=''
479d_getnent=''
10bc17b6
JH
480d_getnetbyaddr_r=''
481getnetbyaddr_r_proto=''
482d_getnetbyname_r=''
483getnetbyname_r_proto=''
484d_getnetent_r=''
485getnetent_r_proto=''
b4eb6b3d 486d_getnetprotos=''
0c0643d0 487d_getpagsz=''
b4eb6b3d
JH
488d_getpent=''
489d_getpgid=''
490d_getpgrp2=''
491d_bsdgetpgrp=''
492d_getpgrp=''
493d_getppid=''
494d_getprior=''
495d_getpbyname=''
496d_getpbynumber=''
10bc17b6
JH
497d_getprotobyname_r=''
498getprotobyname_r_proto=''
499d_getprotobynumber_r=''
500getprotobynumber_r_proto=''
501d_getprotoent_r=''
502getprotoent_r_proto=''
b4eb6b3d
JH
503d_getprotoprotos=''
504d_getprpwnam=''
505d_getpwent=''
10bc17b6
JH
506d_getpwent_r=''
507getpwent_r_proto=''
508d_getpwnam_r=''
509getpwnam_r_proto=''
510d_getpwuid_r=''
511getpwuid_r_proto=''
b4eb6b3d 512d_getsent=''
10bc17b6
JH
513d_getservbyname_r=''
514getservbyname_r_proto=''
515d_getservbyport_r=''
516getservbyport_r_proto=''
517d_getservent_r=''
518getservent_r_proto=''
b4eb6b3d
JH
519d_getservprotos=''
520d_getspnam=''
10bc17b6
JH
521d_getspnam_r=''
522getspnam_r_proto=''
b4eb6b3d
JH
523d_getsbyname=''
524d_getsbyport=''
10bc17b6
JH
525d_gmtime_r=''
526gmtime_r_proto=''
a4f3eea9 527d_gnulibc=''
5f6e0ee4 528gnulibc_version=''
b4eb6b3d
JH
529d_hasmntopt=''
530d_htonl=''
55954f19 531d_ilogbl=''
b4eb6b3d
JH
532d_inetaton=''
533d_int64_t=''
534d_isascii=''
758a5d79
JH
535d_isfinite=''
536d_isinf=''
b4eb6b3d
JH
537d_isnan=''
538d_isnanl=''
539d_killpg=''
540d_lchown=''
541d_ldbl_dig=''
0a0abfba 542d_libm_lib_version=''
b4eb6b3d 543d_link=''
10bc17b6
JH
544d_localtime_r=''
545localtime_r_proto=''
b4eb6b3d
JH
546d_locconv=''
547d_lockf=''
548d_longdbl=''
549longdblsize=''
550d_longlong=''
551longlongsize=''
552d_lseekproto=''
553d_lstat=''
554d_madvise=''
7dd121ae
MB
555d_malloc_good_size=''
556d_malloc_size=''
b4eb6b3d
JH
557d_mblen=''
558d_mbstowcs=''
559d_mbtowc=''
560d_memchr=''
561d_memcmp=''
562d_memcpy=''
563d_memmove=''
564d_memset=''
565d_mkdir=''
566d_mkdtemp=''
567d_mkfifo=''
568d_mkstemp=''
569d_mkstemps=''
570d_mktime=''
571d_mmap=''
572mmaptype=''
573d_modfl=''
e67aeab1 574d_modfl_pow32_bug=''
bc9a1b2c 575d_modflproto=''
b4eb6b3d
JH
576d_mprotect=''
577d_msg=''
578d_msgctl=''
579d_msgget=''
4e0554ec 580d_msghdr_s=''
b4eb6b3d
JH
581d_msgrcv=''
582d_msgsnd=''
583d_msync=''
584d_munmap=''
585d_nice=''
2765b840 586d_nl_langinfo=''
b4eb6b3d
JH
587d_off64_t=''
588d_open3=''
589d_fpathconf=''
590d_pathconf=''
591d_pause=''
592d_pipe=''
593d_poll=''
2304df62 594d_portable=''
a33c94aa 595d_procselfexe=''
f24dbf84 596procselfexe=''
b4eb6b3d
JH
597d_old_pthread_create_joinable=''
598old_pthread_create_joinable=''
d6483fcc 599d_pthread_atfork=''
58d975c3 600d_pthread_attr_setscope=''
b4eb6b3d
JH
601d_pthread_yield=''
602d_sched_yield=''
603sched_yield=''
604d_qgcvt=''
10bc17b6
JH
605d_random_r=''
606random_r_proto=''
607d_readdir64_r=''
608readdir64_r_proto=''
b4eb6b3d
JH
609d_readdir=''
610d_rewinddir=''
611d_seekdir=''
612d_telldir=''
10bc17b6
JH
613d_readdir_r=''
614readdir_r_proto=''
b4eb6b3d 615d_readlink=''
4e0554ec
JH
616d_readv=''
617d_recvmsg=''
b4eb6b3d
JH
618d_rename=''
619d_rmdir=''
620d_safebcpy=''
621d_safemcpy=''
622d_sanemcmp=''
ef9f17be 623d_sbrkproto=''
55954f19 624d_scalbnl=''
b4eb6b3d
JH
625d_select=''
626d_sem=''
627d_semctl=''
628d_semget=''
629d_semop=''
4e0554ec 630d_sendmsg=''
b4eb6b3d
JH
631d_setegid=''
632d_seteuid=''
633d_setgrent=''
10bc17b6
JH
634d_setgrent_r=''
635setgrent_r_proto=''
b4eb6b3d
JH
636d_setgrps=''
637d_sethent=''
10bc17b6
JH
638d_sethostent_r=''
639sethostent_r_proto=''
4e0554ec 640d_setitimer=''
b4eb6b3d
JH
641d_setlinebuf=''
642d_setlocale=''
10bc17b6
JH
643d_setlocale_r=''
644setlocale_r_proto=''
b4eb6b3d 645d_setnent=''
10bc17b6
JH
646d_setnetent_r=''
647setnetent_r_proto=''
b4eb6b3d
JH
648d_setpent=''
649d_setpgid=''
650d_setpgrp2=''
651d_bsdsetpgrp=''
652d_setpgrp=''
653d_setprior=''
654d_setproctitle=''
10bc17b6
JH
655d_setprotoent_r=''
656setprotoent_r_proto=''
b4eb6b3d 657d_setpwent=''
10bc17b6
JH
658d_setpwent_r=''
659setpwent_r_proto=''
b4eb6b3d
JH
660d_setregid=''
661d_setresgid=''
662d_setresuid=''
663d_setreuid=''
664d_setrgid=''
665d_setruid=''
666d_setsent=''
10bc17b6
JH
667d_setservent_r=''
668setservent_r_proto=''
b4eb6b3d
JH
669d_setsid=''
670d_setvbuf=''
671d_sfio=''
672usesfio=''
673d_shm=''
674d_shmat=''
675d_shmatprototype=''
676shmattype=''
677d_shmctl=''
678d_shmdt=''
679d_shmget=''
680d_sigaction=''
983dbef6 681d_sigprocmask=''
b4eb6b3d 682d_sigsetjmp=''
5f106f9c 683usesitecustomize=''
49a78c82 684d_sockatmark=''
2ef53570 685d_sockatmarkproto=''
b4eb6b3d
JH
686d_msg_ctrunc=''
687d_msg_dontroute=''
688d_msg_oob=''
689d_msg_peek=''
690d_msg_proxy=''
691d_oldsock=''
692d_scm_rights=''
693d_socket=''
694d_sockpair=''
695sockethdr=''
696socketlib=''
697d_socklen_t=''
698d_socks5_init=''
360321b3 699d_sprintf_returns_strlen=''
b4eb6b3d 700d_sqrtl=''
10bc17b6
JH
701d_srand48_r=''
702srand48_r_proto=''
703d_srandom_r=''
704srandom_r_proto=''
eef837ea 705d_sresgproto=''
640374d0 706d_sresuproto=''
b4eb6b3d
JH
707d_statblks=''
708d_statfs_f_flags=''
709d_statfs_s=''
710d_fstatvfs=''
711d_statvfs=''
712d_stdio_cnt_lval=''
713d_stdio_ptr_lval=''
a7ffa9b9
NC
714d_stdio_ptr_lval_nochange_cnt=''
715d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
716d_stdiobase=''
717d_stdstdio=''
718stdio_base=''
719stdio_bufsiz=''
720stdio_cnt=''
721stdio_filbuf=''
722stdio_ptr=''
723d_index=''
724d_strchr=''
725d_strcoll=''
726d_strctcpy=''
727d_strerrm=''
728d_strerror=''
729d_sysernlst=''
730d_syserrlst=''
10bc17b6
JH
731d_strerror_r=''
732strerror_r_proto=''
b3c85772 733d_strftime=''
08c92000
MB
734d_strlcat=''
735d_strlcpy=''
b4eb6b3d
JH
736d_strtod=''
737d_strtol=''
738d_strtold=''
739d_strtoll=''
28e5dec8 740d_strtoq=''
b4eb6b3d
JH
741d_strtoul=''
742d_strtoull=''
743d_strtouq=''
744d_strxfrm=''
745d_symlink=''
746d_syscall=''
2ef53570 747d_syscallproto=''
b4eb6b3d
JH
748d_sysconf=''
749d_system=''
750d_tcgetpgrp=''
751d_tcsetpgrp=''
752d_telldirproto=''
753d_time=''
754timetype=''
755clocktype=''
756d_times=''
10bc17b6
JH
757d_tmpnam_r=''
758tmpnam_r_proto=''
b4eb6b3d 759d_truncate=''
10bc17b6
JH
760d_ttyname_r=''
761ttyname_r_proto=''
b4eb6b3d 762d_tzname=''
4e0554ec
JH
763d_u32align=''
764d_ualarm=''
b4eb6b3d
JH
765d_umask=''
766d_semctl_semid_ds=''
767d_semctl_semun=''
768d_union_semun=''
758a5d79 769d_unordered=''
bdf33aa7 770d_unsetenv=''
4e0554ec 771d_usleep=''
2ef53570 772d_usleepproto=''
b4eb6b3d
JH
773d_ustat=''
774d_vfork=''
775usevfork=''
776d_voidsig=''
777signal_t=''
778d_volatile=''
779d_charvspr=''
780d_vprintf=''
781d_wait4=''
782d_waitpid=''
783d_wcstombs=''
784d_wctomb=''
4e0554ec 785d_writev=''
b4eb6b3d 786dlext=''
85e6fe83
LW
787cccdlflags=''
788ccdlflags=''
2304df62 789dlsrc=''
232e078e 790ld=''
85e6fe83 791lddlflags=''
2304df62 792usedl=''
b4eb6b3d
JH
793doublesize=''
794ebcdic=''
795fflushNULL=''
796fflushall=''
797fpossize=''
798fpostype=''
2d736872 799gccansipedantic=''
5b463ca7 800gccosandvers=''
8a27cf78 801gccversion=''
b4eb6b3d
JH
802gidformat=''
803gidsign=''
804gidsize=''
805gidtype=''
806groupstype=''
807h_fcntl=''
808h_sysfile=''
6e1038e0
MB
809html1dir=''
810html1direxp=''
811installhtml1dir=''
812html3dir=''
813html3direxp=''
814installhtml3dir=''
b4eb6b3d 815i_arpainet=''
10bc17b6 816i_crypt=''
b4eb6b3d
JH
817db_hashtype=''
818db_prefixtype=''
640374d0
JH
819db_version_major=''
820db_version_minor=''
821db_version_patch=''
b4eb6b3d
JH
822i_db=''
823i_dbm=''
824i_rpcsvcdbm=''
825d_dirnamlen=''
826direntrytype=''
827i_dirent=''
a0d0e21e 828i_dld=''
b4eb6b3d
JH
829i_dlfcn=''
830i_fcntl=''
831i_float=''
758a5d79
JH
832i_fp=''
833i_fp_class=''
b4eb6b3d
JH
834i_gdbm=''
835d_grpasswd=''
836i_grp=''
b4eb6b3d
JH
837i_ieeefp=''
838i_inttypes=''
2765b840 839i_langinfo=''
b4eb6b3d
JH
840i_libutil=''
841i_limits=''
842i_locale=''
843i_machcthr=''
844i_malloc=''
845i_math=''
846i_memory=''
847i_mntent=''
848i_ndbm=''
849i_netdb=''
850i_neterrno=''
851i_netinettcp=''
852i_niin=''
853i_sysin=''
854i_poll=''
855i_prot=''
856i_pthread=''
857d_pwage=''
858d_pwchange=''
859d_pwclass=''
860d_pwcomment=''
861d_pwexpire=''
862d_pwgecos=''
863d_pwpasswd=''
864d_pwquota=''
865i_pwd=''
866i_sfio=''
867i_shadow=''
868i_socks=''
869i_stddef=''
870i_stdlib=''
871i_string=''
872strings=''
873i_sunmath=''
874i_sysaccess=''
875i_sysdir=''
876i_sysfile=''
877d_voidtty=''
878i_bsdioctl=''
879i_sysfilio=''
880i_sysioctl=''
881i_syssockio=''
882i_syslog=''
883i_sysmman=''
884i_sysmode=''
885i_sysmount=''
886i_sysndir=''
887i_sysparam=''
888i_sysresrc=''
889i_syssecrt=''
890i_sysselct=''
891i_sysstat=''
892i_sysstatfs=''
893i_sysstatvfs=''
894i_systimes=''
895i_systypes=''
896i_sysuio=''
897i_sysun=''
898i_sysutsname=''
899i_sysvfs=''
900i_syswait=''
901i_sgtty=''
902i_termio=''
903i_termios=''
14b90194
JH
904d_tm_tm_gmtoff=''
905d_tm_tm_zone=''
b4eb6b3d
JH
906i_systime=''
907i_systimek=''
908i_time=''
909timeincl=''
910i_unistd=''
911i_ustat=''
912i_utime=''
913i_values=''
914i_stdarg=''
915i_varargs=''
916i_varhdr=''
917i_vfork=''
918inc_version_list=''
919inc_version_list_init=''
920installprefix=''
921installprefixexp=''
922installstyle=''
923installusrbinperl=''
924intsize=''
925longsize=''
926shortsize=''
4b661809 927issymlink=''
2304df62 928libc=''
b4eb6b3d
JH
929ldlibpthname=''
930libperl=''
931shrpenv=''
932useshrplib=''
a0d0e21e 933glibpth=''
2304df62 934libpth=''
8e07c86e 935loclibpth=''
2304df62
AD
936plibpth=''
937xlibpth=''
1cfa4ec7 938ignore_versioned_solibs=''
2304df62 939libs=''
43999f95
JH
940libsdirs=''
941libsfiles=''
942libsfound=''
13b3f787 943libspath=''
85e6fe83 944lns=''
b4eb6b3d
JH
945d_PRIEUldbl=''
946d_PRIFUldbl=''
947d_PRIGUldbl=''
948d_PRIeldbl=''
949d_PRIfldbl=''
950d_PRIgldbl=''
951d_SCNfldbl=''
952sPRIEUldbl=''
953sPRIFUldbl=''
954sPRIGUldbl=''
955sPRIeldbl=''
956sPRIfldbl=''
957sPRIgldbl=''
958sSCNfldbl=''
959lseeksize=''
960lseektype=''
8ff267be 961make_set_make=''
b4eb6b3d
JH
962d_mymalloc=''
963freetype=''
964mallocobj=''
965mallocsrc=''
966malloctype=''
9df442c2 967usemallocwrap=''
b4eb6b3d
JH
968usemymalloc=''
969installman1dir=''
970man1dir=''
971man1direxp=''
972man1ext=''
973installman3dir=''
974man3dir=''
975man3direxp=''
976man3ext=''
977modetype=''
978multiarch=''
979mydomain=''
980myhostname=''
981phostname=''
2304df62
AD
982c=''
983n=''
b4eb6b3d
JH
984d_eofnblk=''
985eagain=''
986o_nonblock=''
987rd_nodata=''
2cc61e15 988need_va_copy=''
b4eb6b3d
JH
989netdb_hlen_type=''
990netdb_host_type=''
991netdb_name_type=''
992netdb_net_type=''
993groupcat=''
994hostcat=''
995passcat=''
996orderlib=''
997ranlib=''
998d_perl_otherlibdirs=''
999otherlibdirs=''
2304df62
AD
1000package=''
1001spackage=''
b4eb6b3d
JH
1002pager=''
1003api_revision=''
1004api_subversion=''
1005api_version=''
1006api_versionstring=''
1007patchlevel=''
151e6568 1008perl_patchlevel=''
b4eb6b3d
JH
1009revision=''
1010subversion=''
1011version=''
861eb78d 1012version_patchlevel_string=''
b4eb6b3d
JH
1013perl5=''
1014perladmin=''
1015perlpath=''
1016d_nv_preserves_uv=''
f607920a 1017d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1018i16size=''
1019i16type=''
1020i32size=''
1021i32type=''
1022i64size=''
1023i64type=''
1024i8size=''
1025i8type=''
1026ivsize=''
1027ivtype=''
53133ed1 1028nv_preserves_uv_bits=''
b4eb6b3d
JH
1029nvsize=''
1030nvtype=''
1031u16size=''
1032u16type=''
1033u32size=''
1034u32type=''
1035u64size=''
1036u64type=''
1037u8size=''
1038u8type=''
1039uvsize=''
1040uvtype=''
1041ivdformat=''
1042nvEUformat=''
1043nvFUformat=''
1044nvGUformat=''
1045nveformat=''
1046nvfformat=''
1047nvgformat=''
1048uvXUformat=''
1049uvoformat=''
1050uvuformat=''
1051uvxformat=''
1052pidtype=''
1053prefix=''
1054prefixexp=''
1055installprivlib=''
1056privlib=''
1057privlibexp=''
1058prototype=''
1059ptrsize=''
1060d_PRIXU64=''
1061d_PRId64=''
1062d_PRIi64=''
1063d_PRIo64=''
1064d_PRIu64=''
1065d_PRIx64=''
1066sPRIXU64=''
1067sPRId64=''
1068sPRIi64=''
1069sPRIo64=''
1070sPRIu64=''
1071sPRIx64=''
1072d_quad=''
1073quadkind=''
1074quadtype=''
1075uquadtype=''
1076drand01=''
1077randbits=''
1078randfunc=''
1079randseedtype=''
1080seedfunc=''
1081installscript=''
1082scriptdir=''
1083scriptdirexp=''
1084selectminbits=''
1085selecttype=''
8ff267be 1086sh=''
b4eb6b3d
JH
1087sig_count=''
1088sig_name=''
1089sig_name_init=''
1090sig_num=''
1091sig_num_init=''
76d3c696 1092sig_size=''
b4eb6b3d
JH
1093installsitearch=''
1094sitearch=''
1095sitearchexp=''
1096installsitebin=''
1097sitebin=''
1098sitebinexp=''
8d2cbf27
JH
1099installsitehtml1dir=''
1100sitehtml1dir=''
1101sitehtml1direxp=''
1102installsitehtml3dir=''
1103sitehtml3dir=''
1104sitehtml3direxp=''
b4eb6b3d
JH
1105installsitelib=''
1106sitelib=''
1107sitelib_stem=''
1108sitelibexp=''
91e123a8
JH
1109installsiteman1dir=''
1110siteman1dir=''
1111siteman1direxp=''
1112installsiteman3dir=''
1113siteman3dir=''
1114siteman3direxp=''
b4eb6b3d
JH
1115siteprefix=''
1116siteprefixexp=''
6e1038e0
MB
1117installsitescript=''
1118sitescript=''
1119sitescriptexp=''
b4eb6b3d
JH
1120sizesize=''
1121sizetype=''
a0d0e21e 1122so=''
b4eb6b3d 1123socksizetype=''
2304df62
AD
1124sharpbang=''
1125shsharp=''
1126spitshell=''
dfe9444c 1127src=''
b4eb6b3d
JH
1128ssizetype=''
1129startperl=''
2304df62 1130startsh=''
b4eb6b3d
JH
1131stdchar=''
1132d_stdio_stream_array=''
1133stdio_stream_array=''
1134sysman=''
5ff3f7a4 1135trnl=''
b4eb6b3d
JH
1136uidformat=''
1137uidsign=''
1138uidsize=''
1139uidtype=''
1140archname64=''
1141use64bitall=''
1142use64bitint=''
15b61c98 1143usefaststdio=''
b4eb6b3d
JH
1144ccflags_uselargefiles=''
1145ldflags_uselargefiles=''
1146libswanted_uselargefiles=''
1147uselargefiles=''
1148uselongdouble=''
1149usemorebits=''
1150usemultiplicity=''
2304df62 1151nm_opt=''
40a7a20a 1152nm_so_opt=''
2304df62
AD
1153runnm=''
1154usenm=''
b4eb6b3d 1155useperlio=''
db0f2be4 1156userelocatableinc=''
29209bc5 1157usesocks=''
b4eb6b3d
JH
1158d_oldpthreads=''
1159use5005threads=''
1160useithreads=''
9514c62b 1161usereentrant=''
b4eb6b3d 1162usethreads=''
2304df62 1163incpath=''
2304df62
AD
1164mips_type=''
1165usrinc=''
b4eb6b3d
JH
1166d_vendorarch=''
1167installvendorarch=''
1168vendorarch=''
1169vendorarchexp=''
1170d_vendorbin=''
1171installvendorbin=''
1172vendorbin=''
1173vendorbinexp=''
8d2cbf27
JH
1174installvendorhtml1dir=''
1175vendorhtml1dir=''
1176vendorhtml1direxp=''
1177installvendorhtml3dir=''
1178vendorhtml3dir=''
1179vendorhtml3direxp=''
b4eb6b3d
JH
1180d_vendorlib=''
1181installvendorlib=''
1182vendorlib=''
1183vendorlib_stem=''
1184vendorlibexp=''
91e123a8
JH
1185installvendorman1dir=''
1186vendorman1dir=''
1187vendorman1direxp=''
1188installvendorman3dir=''
1189vendorman3dir=''
1190vendorman3direxp=''
b4eb6b3d
JH
1191usevendorprefix=''
1192vendorprefix=''
1193vendorprefixexp=''
6e1038e0
MB
1194d_vendorscript=''
1195installvendorscript=''
1196vendorscript=''
1197vendorscriptexp=''
d56c5707 1198versiononly=''
b4eb6b3d
JH
1199defvoidused=''
1200voidflags=''
3659ebf1
JH
1201yacc=''
1202yaccflags=''
2304df62
AD
1203CONFIG=''
1204
ecfc5424
AD
1205define='define'
1206undef='undef'
1207smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1208rmlist=''
1209
1210: We must find out about Eunice early
1211eunicefix=':'
1212if test -f /etc/unixtovms; then
1213 eunicefix=/etc/unixtovms
1214fi
1215if test -f /etc/unixtovms.exe; then
1216 eunicefix=/etc/unixtovms.exe
1217fi
1218
cfb04860 1219: Set executable suffix now -- needed before hints available
6153ba32
PG
1220if test -f "/libs/version.library"; then
1221: Amiga OS
1222 _exe=""
1223elif test -f "/system/gnu_library/bin/ar.pm"; then
1224: Stratus VOS
cfb04860 1225 _exe=".pm"
6153ba32
PG
1226elif test -n "$DJGPP"; then
1227: DOS DJGPP
cfb04860 1228 _exe=".exe"
5c728af0 1229elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1230: OS/2 or cygwin
ba863942
JH
1231 _exe=".exe"
1232fi
868439a2 1233
b4eb6b3d 1234i_whoami=''
9da7673b
MB
1235ccname=''
1236ccversion=''
1237perllibs=''
1238: set useposix=false in your hint file to disable the POSIX extension.
1239useposix=true
1240: set useopcode=false in your hint file to disable the Opcode extension.
1241useopcode=true
1242: Trailing extension. Override this in a hint file, if needed.
1243: Extra object files, if any, needed on this platform.
1244archobjs=''
1245archname=''
ff935051
JH
1246: Possible local include directories to search.
1247: Set locincpth to "" in a hint file to defeat local include searches.
1248locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1249locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1250:
1251: no include file wanted by default
1252inclwanted=''
1253
b4eb6b3d 1254groupstype=''
64615a5e 1255libnames=''
732c9516
JH
1256: change the next line if compiling for Xenix/286 on Xenix/386
1257xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1258: Possible local library directories to search.
1259loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1260loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1261
1262: general looking path for locating libraries
5869b1f1 1263glibpth="/lib /usr/lib $xlibpth"
732c9516 1264glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1265test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1266test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1267
1268: Private path used by Configure to find libraries. Its value
1269: is prepended to libpth. This variable takes care of special
1270: machines, like the mips. Usually, it should be empty.
1271plibpth=''
1272
1cfa4ec7
GS
1273: default library list
1274libswanted=''
921b2963 1275: some systems want to use only the non-versioned libso:s
1cfa4ec7 1276ignore_versioned_solibs=''
9da7673b
MB
1277siteman1dir=''
1278siteman3dir=''
1279sitescript=''
b4eb6b3d
JH
1280archname64=''
1281ccflags_uselargefiles=''
1282ldflags_uselargefiles=''
1283libswanted_uselargefiles=''
1284: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1285: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1286: set usethreads on the Configure command line to enable threads.
cd040c5e 1287usereentrant='undef'
9da7673b
MB
1288: full support for void wanted by default
1289defvoidused=15
1290
ecfc5424 1291: List of libraries we want.
15431986 1292: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1293libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1294libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1295: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1296: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1297glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1298glibpth="/usr/shlib $glibpth"
1299: Do not use vfork unless overridden by a hint file.
1300usevfork=false
1301
8ff267be 1302: Find the basic shell for Bourne shell scripts
1303case "$sh" in
1304'')
8ff267be 1305 case "$SYSTYPE" in
1306 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1307 *) xxx='/bin/sh';;
1308 esac
1309 if test -f "$xxx"; then
1310 sh="$xxx"
1311 else
1312 : Build up a list and do a single loop so we can 'break' out.
1313 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1314 for xxx in sh bash ksh pdksh ash; do
1315 for p in $pth; do
1316 try="$try ${p}/${xxx}"
1317 done
1318 done
1319 for xxx in $try; do
1320 if test -f "$xxx"; then
1321 sh="$xxx";
8ff267be 1322 break
a5a94ea5
JH
1323 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1324 sh="$xxx";
1325 break
8ff267be 1326 elif test -f "$xxx.exe"; then
1327 sh="$xxx";
8ff267be 1328 break
1329 fi
1330 done
1331 fi
1332 ;;
1333esac
1334
1335case "$sh" in
a33c94aa 1336'') cat >&2 <<EOM
8ff267be 1337$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1338
8ff267be 1339Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1340Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1341we'll try to straighten this all out.
8ff267be 1342EOM
1343 exit 1
1344 ;;
1345esac
1346
760ac839 1347: see if sh knows # comments
73614538 1348if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1349 shsharp=true
1350 spitshell=cat
760ac839 1351 xcat=/bin/cat
a931254c
JH
1352 test -f $xcat$_exe || xcat=/usr/bin/cat
1353 if test ! -f $xcat$_exe; then
4bdb8fb5 1354 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1355 if test -f $p/cat$_exe; then
1deb0a86 1356 xcat=$p/cat
3c728e00
JH
1357 break
1358 fi
1359 done
1deb0a86
JH
1360 if test ! -f $xcat$_exe; then
1361 echo "Can't find cat anywhere!"
3c728e00
JH
1362 exit 1
1363 fi
1364 fi
5440bc8e
JH
1365 echo "#!$xcat" >sharp
1366 $eunicefix sharp
1367 chmod +x sharp
1368 ./sharp > today
760ac839 1369 if test -s today; then
760ac839
LW
1370 sharpbang='#!'
1371 else
5440bc8e
JH
1372 echo "#! $xcat" > sharp
1373 $eunicefix sharp
1374 chmod +x sharp
1375 ./sharp > today
760ac839 1376 if test -s today; then
760ac839
LW
1377 sharpbang='#! '
1378 else
760ac839
LW
1379 sharpbang=': use '
1380 fi
1381 fi
1382else
dfe9444c 1383 echo " "
8ff267be 1384 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1385 shsharp=false
1386 cd ..
1387 echo "exec grep -v '^[ ]*#'" >spitshell
1388 chmod +x spitshell
1389 $eunicefix spitshell
1390 spitshell=`pwd`/spitshell
1391 cd UU
1392 echo "I presume that if # doesn't work, #! won't work either!"
1393 sharpbang=': use '
1394fi
5440bc8e 1395rm -f sharp today
760ac839
LW
1396
1397: figure out how to guarantee sh startup
8ff267be 1398case "$startsh" in
1399'') startsh=${sharpbang}${sh} ;;
1400*)
760ac839 1401esac
5440bc8e 1402cat >sharp <<EOSS
760ac839
LW
1403$startsh
1404set abc
1405test "$?abc" != 1
1406EOSS
1407
5440bc8e
JH
1408chmod +x sharp
1409$eunicefix sharp
1410if ./sharp; then
8ff267be 1411 : echo "Yup, it does."
760ac839 1412else
dfe9444c
AD
1413 echo "Hmm... '$startsh' does not guarantee sh startup..."
1414 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1415fi
5440bc8e 1416rm -f sharp
760ac839 1417
aebf16e7
AD
1418
1419: Save command line options in file UU/cmdline.opt for later use in
1420: generating config.sh.
1421cat > cmdline.opt <<EOSH
1422# Configure command line arguments.
1423config_arg0='$0'
1424config_args='$*'
1425config_argc=$#
1426EOSH
1427argn=1
ee45ea83
IZ
1428args_exp=''
1429args_sep=''
aebf16e7
AD
1430for arg in "$@"; do
1431 cat >>cmdline.opt <<EOSH
1432config_arg$argn='$arg'
1433EOSH
ee45ea83
IZ
1434 # Extreme backslashitis: replace each ' by '"'"'
1435 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1436$arg
1437EOC
1438 arg_exp=`cat cmdl.opt`
1439 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1440 argn=`expr $argn + 1`
ee45ea83 1441 args_sep=' '
aebf16e7 1442done
ee45ea83
IZ
1443# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1444# used by ./hints/os2.sh
1445rm -f cmdl.opt
aebf16e7 1446
2304df62
AD
1447: produce awk script to parse command line options
1448cat >options.awk <<'EOF'
1449BEGIN {
02e93a22 1450 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1451
1452 len = length(optstr);
1453 for (i = 1; i <= len; i++) {
1454 c = substr(optstr, i, 1);
1455 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1456 if (a == ":") {
1457 arg[c] = 1;
1458 i++;
1459 }
1460 opt[c] = 1;
1461 }
1462}
1463{
1464 expect = 0;
1465 str = $0;
1466 if (substr(str, 1, 1) != "-") {
1467 printf("'%s'\n", str);
1468 next;
1469 }
1470 len = length($0);
1471 for (i = 2; i <= len; i++) {
1472 c = substr(str, i, 1);
1473 if (!opt[c]) {
1474 printf("-%s\n", substr(str, i));
1475 next;
1476 }
1477 printf("-%s\n", c);
1478 if (arg[c]) {
1479 if (i < len)
1480 printf("'%s'\n", substr(str, i + 1));
1481 else
1482 expect = 1;
1483 next;
1484 }
1485 }
1486}
1487END {
1488 if (expect)
1489 print "?";
1490}
1491EOF
1492
1493: process the command line options
4633a7c4
LW
1494set X `for arg in "$@"; do echo "X$arg"; done |
1495 sed -e s/X// | awk -f options.awk`
2304df62
AD
1496eval "set $*"
1497shift
1498rm -f options.awk
1499
1500: set up default values
1501fastread=''
1502reuseval=false
1503config_sh=''
1504alldone=''
1505error=''
1506silent=''
1507extractsh=''
ecfc5424 1508override=''
16d20bd9 1509knowitall=''
02e93a22 1510rm -f optdef.sh posthint.sh
28757baa 1511cat >optdef.sh <<EOS
1512$startsh
1513EOS
2304df62 1514
dfe9444c 1515
2304df62
AD
1516: option parsing
1517while test $# -gt 0; do
1518 case "$1" in
1519 -d) shift; fastread=yes;;
1520 -e) shift; alldone=cont;;
1521 -f)
1522 shift
1523 cd ..
1524 if test -r "$1"; then
1525 config_sh="$1"
1526 else
a0d0e21e 1527 echo "$me: cannot read config file $1." >&2
2304df62
AD
1528 error=true
1529 fi
1530 cd UU
1531 shift;;
1532 -h) shift; error=true;;
1533 -r) shift; reuseval=true;;
dfe9444c 1534 -s) shift; silent=true; realsilent=true;;
2304df62 1535 -E) shift; alldone=exit;;
16d20bd9 1536 -K) shift; knowitall=true;;
ecfc5424 1537 -O) shift; override=true;;
dfe9444c 1538 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1539 -D)
1540 shift
1541 case "$1" in
1542 *=)
1543 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1544 echo "$me: ignoring -D $1" >&2
1545 ;;
ecfc5424 1546 *=*) echo "$1" | \
1aef975c
AD
1547 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1548 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1549 esac
1550 shift
1551 ;;
1552 -U)
1553 shift
1554 case "$1" in
1aef975c 1555 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1556 *=*)
1557 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1558 echo "$me: ignoring -U $1" >&2
1559 ;;
1aef975c 1560 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1561 esac
1562 shift
1563 ;;
02e93a22
JH
1564 -A)
1565 shift
1566 xxx=''
1567 yyy="$1"
02e93a22 1568 zzz=''
5f83a3e9 1569 uuu=undef
02e93a22 1570 case "$yyy" in
f7c31117 1571 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1572 case "$zzz" in
1573 *:*) zzz='' ;;
1574 *) xxx=append
f7c31117
JH
1575 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1576 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1577 esac
1578 ;;
1579 esac
1580 case "$xxx" in
1581 '') case "$yyy" in
f7c31117
JH
1582 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1583 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1584 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1585 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1586 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1587 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1588 esac
1589 ;;
1590 esac
02e93a22
JH
1591 case "$xxx" in
1592 append)
5f83a3e9 1593 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1594 clear)
5f83a3e9 1595 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1596 define)
1597 case "$zzz" in
1598 '') zzz=define ;;
1599 esac
5f83a3e9 1600 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1601 eval)
5f83a3e9 1602 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1603 prepend)
5f83a3e9 1604 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1605 undef)
1606 case "$zzz" in
1607 '') zzz="$uuu" ;;
1608 esac
5f83a3e9
JH
1609 echo "$yyy=$zzz" >> posthint.sh ;;
1610 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1611 esac
bde6b06b 1612 shift
02e93a22 1613 ;;
dfe9444c 1614 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1615 exit 0;;
2304df62 1616 --) break;;
a0d0e21e 1617 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1618 *) break;;
1619 esac
1620done
1621
1622case "$error" in
1623true)
1624 cat >&2 <<EOM
2afac517 1625Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1626 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1627 -d : use defaults for all answers.
1628 -e : go on without questioning past the production of config.sh.
1629 -f : specify an alternate default configuration file.
1630 -h : print this help message and exit (with an error status).
1631 -r : reuse C symbols value if possible (skips costly nm extraction).
1632 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1633 -D : define symbol to have some value:
1634 -D symbol symbol gets the value 'define'
1635 -D symbol=value symbol gets the value 'value'
2304df62 1636 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1637 -K : do not use unless you know what you are doing.
ecfc5424 1638 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1639 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1640 -U : undefine symbol:
1641 -U symbol symbol gets the value 'undef'
1642 -U symbol= symbol gets completely empty
02e93a22 1643 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1644 -A symbol=value append " "value to symbol
02e93a22
JH
1645 -A append:symbol=value append value to symbol
1646 -A define:symbol=value define symbol to have value
02e93a22
JH
1647 -A clear:symbol define symbol to be ''
1648 -A define:symbol define symbol to be 'define'
1649 -A eval:symbol=value define symbol to be eval of value
1650 -A prepend:symbol=value prepend value to symbol
1651 -A undef:symbol define symbol to be 'undef'
1652 -A undef:symbol= define symbol to be ''
2304df62
AD
1653 -V : print version number and exit (with a zero status).
1654EOM
1655 exit 1
1656 ;;
1657esac
1658
dfe9444c
AD
1659: Sanity checks
1660case "$fastread$alldone" in
1661yescont|yesexit) ;;
1662*)
aaeb8e51
GS
1663 case "$extractsh" in
1664 true) ;;
1665 *)
1666 if test ! -t 0; then
1667 echo "Say 'sh Configure', not 'sh <Configure'"
1668 exit 1
1669 fi
1670 ;;
1671 esac
dfe9444c
AD
1672 ;;
1673esac
1674
2304df62
AD
1675exec 4>&1
1676case "$silent" in
1677true) exec 1>/dev/null;;
1678esac
1679
ecfc5424 1680: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1681touch optdef.sh
1682. ./optdef.sh
02e93a22
JH
1683: create the posthint manipulation script and leave the file out there...
1684touch posthint.sh
a0d0e21e 1685
2304df62 1686: set package name
85e6fe83 1687package=perl5
b4eb6b3d
JH
1688first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1689last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1690case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1691ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1692*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1693esac
2304df62 1694
2304df62
AD
1695: Some greps do not return status, grrr.
1696echo "grimblepritz" >grimble
1697if grep blurfldyick grimble >/dev/null 2>&1 ; then
1698 contains=contains
1699elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1700 contains=grep
1701else
1702 contains=contains
1703fi
1704rm -f grimble
1705: the following should work in any shell
1706case "$contains" in
1707contains*)
1708 echo " "
1709 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1710 cat >contains <<'EOSS'
1711grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1712EOSS
1713chmod +x contains
1714esac
1715
dfe9444c
AD
1716: Find the path to the source tree
1717case "$src" in
1718'') case "$0" in
b233458b
JH
1719 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1720 case "$src" in
1721 /*) ;;
8504afb7 1722 .) ;;
b233458b
JH
1723 *) src=`cd ../$src && pwd` ;;
1724 esac
1725 ;;
dfe9444c
AD
1726 *) src='.';;
1727 esac;;
1728esac
1729case "$src" in
1730'') src=/
1731 rsrc=/
1732 ;;
1733/*) rsrc="$src";;
1734*) rsrc="../$src";;
1735esac
1736if test -f $rsrc/Configure && \
1737 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1738then
1739 : found it, so we are ok.
1740else
1741 rsrc=''
1742 for src in . .. ../.. ../../.. ../../../..; do
1743 if test -f ../$src/Configure && \
1744 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1745 then
1746 rsrc=../$src
1747 break
1748 fi
1749 done
1750fi
1751case "$rsrc" in
1752'')
1753 cat <<EOM >&4
1754
1755Sorry, I can't seem to locate the source dir for $package. Please start
1756Configure with an explicit path -- i.e. /some/path/Configure.
1757
1758EOM
1759 exit 1
1760 ;;
1761../.) rsrc='..';;
1762*)
1763 echo " "
1764 echo "Sources for $package found in \"$src\"." >&4
1765 ;;
1766esac
1767
1768: script used to extract .SH files with variable substitutions
1769cat >extract <<'EOS'
a02608de 1770PERL_CONFIG_SH=true
dfe9444c 1771echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1772if test -f MANIFEST; then
1773 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1774else
1775 echo "(Looking for .SH files under the source directory.)"
6904989c 1776 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1777fi
1778shift
1779case $# in
6904989c 17800) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1781esac
6904989c 1782if test ! -f "$src/$1"; then
dfe9444c
AD
1783 shift
1784fi
1785mkdir_p='
1786name=$1;
1787create="";
1788while test $name; do
1789 if test ! -d "$name"; then
1790 create="$name $create";
1791 name=`echo $name | sed -e "s|^[^/]*$||"`;
1792 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1793 else
1794 name="";
1795 fi;
1796done;
1797for file in $create; do
1798 mkdir $file;
1799done
1800'
1801for file in $*; do
1802 case "$src" in
1803 ".")
1804 case "$file" in
1805 */*)
1806 dir=`expr X$file : 'X\(.*\)/'`
1807 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1808 (cd "$dir" && . ./$file)
dfe9444c
AD
1809 ;;
1810 *)
1811 . ./$file
1812 ;;
1813 esac
1814 ;;
1815 *)
1816 case "$file" in
1817 */*)
1818 dir=`expr X$file : 'X\(.*\)/'`
1819 file=`expr X$file : 'X.*/\(.*\)'`
1820 (set x $dir; shift; eval $mkdir_p)
6904989c 1821 sh <"$src/$dir/$file"
dfe9444c
AD
1822 ;;
1823 *)
6904989c 1824 sh <"$src/$file"
dfe9444c
AD
1825 ;;
1826 esac
1827 ;;
1828 esac
1829done
6904989c 1830if test -f "$src/config_h.SH"; then
dfe9444c
AD
1831 if test ! -f config.h; then
1832 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1833 . "$src/config_h.SH"
dfe9444c
AD
1834 fi
1835fi
1836EOS
1837
1838: extract files and exit if asked to do so
1839case "$extractsh" in
1840true)
1841 case "$realsilent" in
1842 true) ;;
1843 *) exec 1>&4;;
1844 esac
1845 case "$config_sh" in
1846 '') config_sh='config.sh';;
1847 esac
1848 echo " "
1849 echo "Fetching answers from $config_sh..."
1850 cd ..
1851 . $config_sh
1852 test "$override" && . ./optdef.sh
1853 echo " "
1854 . UU/extract
1855 rm -rf UU
24ccb310 1856 echo "Extraction done."
dfe9444c
AD
1857 exit 0
1858 ;;
1859esac
1860
1861: Eunice requires " " instead of "", can you believe it
1862echo " "
1863: Here we go...
1864echo "Beginning of configuration questions for $package."
1865
1866trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1867
2304df62
AD
1868: first determine how to suppress newline on echo command
1869echo " "
1870echo "Checking echo to see how to suppress newlines..."
1871(echo "hi there\c" ; echo " ") >.echotmp
1872if $contains c .echotmp >/dev/null 2>&1 ; then
1873 echo "...using -n."
1874 n='-n'
1875 c=''
1876else
1877 cat <<'EOM'
1878...using \c
1879EOM
1880 n=''
1881 c='\c'
1882fi
1883echo $n "The star should be here-->$c"
1884echo '*'
1885rm -f .echotmp
1886
1887: Now test for existence of everything in MANIFEST
1888echo " "
6904989c 1889if test -f "$rsrc/MANIFEST"; then
2304df62 1890 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1891 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1892 rm -f missing
dfe9444c 1893 tmppwd=`pwd`
2304df62 1894 for filelist in x??; do
6904989c 1895 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1896 done
1897 if test -s missing; then
1898 cat missing >&4
1899 cat >&4 <<'EOM'
1900
1901THIS PACKAGE SEEMS TO BE INCOMPLETE.
1902
1903You have the option of continuing the configuration process, despite the
1904distinct possibility that your kit is damaged, by typing 'y'es. If you
1905do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1906and contact the author (perlbug@perl.org).
2304df62
AD
1907
1908EOM
1909 echo $n "Continue? [n] $c" >&4
1910 read ans
1911 case "$ans" in
1912 y*)
1913 echo "Continuing..." >&4
1914 rm -f missing
1915 ;;
1916 *)
1917 echo "ABORTING..." >&4
1918 kill $$
1919 ;;
1920 esac
1921 else
dfe9444c 1922 echo "Looks good..."
2304df62
AD
1923 fi
1924else
1925 echo "There is no MANIFEST file. I hope your kit is complete !"
1926fi
1927rm -f missing x??
1928
5ff3f7a4
GS
1929echo " "
1930: Find the appropriate value for a newline for tr
1931if test -n "$DJGPP"; then
1932 trnl='\012'
1933fi
1934if test X"$trnl" = X; then
1935 case "`echo foo|tr '\n' x 2>/dev/null`" in
1936 foox) trnl='\n' ;;
1937 esac
1938fi
1939if test X"$trnl" = X; then
1940 case "`echo foo|tr '\012' x 2>/dev/null`" in
1941 foox) trnl='\012' ;;
1942 esac
1943fi
1944if test X"$trnl" = X; then
8be2c24c
JH
1945 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1946 fooxy) trnl='\n\r' ;;
1947 esac
1948fi
1949if test X"$trnl" = X; then
5ff3f7a4
GS
1950 cat <<EOM >&2
1951
1952$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1953
1954EOM
1955 exit 1
1956fi
1957
2304df62
AD
1958: compute the number of columns on the terminal for proper question formatting
1959case "$COLUMNS" in
1960'') COLUMNS='80';;
1961esac
1962
1963: set up the echo used in my read
1964myecho="case \"\$xxxm\" in
1965'') echo $n \"\$rp $c\" >&4;;
1966*) case \"\$rp\" in
1967 '') echo $n \"[\$xxxm] $c\";;
1968 *)
1969 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1970 echo \"\$rp\" >&4
1971 echo $n \"[\$xxxm] $c\" >&4
1972 else
1973 echo $n \"\$rp [\$xxxm] $c\" >&4
1974 fi
1975 ;;
1976 esac;;
1977esac"
1978
1979: now set up to do reads with possible shell escape and default assignment
1980cat <<EOSC >myread
28757baa 1981$startsh
2304df62
AD
1982xxxm=\$dflt
1983$myecho
1984ans='!'
1985case "\$fastread" in
1986yes) case "\$dflt" in
1987 '') ;;
1988 *) ans='';
1989 case "\$silent-\$rp" in
1990 true-) ;;
1991 *) echo " " >&4;;
1992 esac;;
1993 esac;;
1994*) case "\$silent" in
1995 true) case "\$rp" in
1996 '') ans='';;
1997 esac;;
1998 esac;;
1999esac
2000while expr "X\$ans" : "X!" >/dev/null; do
2001 read answ
2002 set x \$xxxm
2003 shift
dfe9444c 2004 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2005 case "\$answ" in
dfe9444c
AD
2006 "!")
2007 sh 1>&4
2008 echo " "
2009 $myecho
2010 ;;
2011 !*)
2012 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2013 shift
2014 sh 1>&4 -c "\$*"
2015 echo " "
2016 $myecho
2017 ;;
2304df62
AD
2018 "\$ans")
2019 case "\$ans" in
ecfc5424
AD
2020 \\&*)
2021 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2022 shift
2023 case "\$1" in
2024 -d)
2025 fastread=yes
40a7a20a 2026 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2027 ;;
2028 -*)
40a7a20a 2029 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2030 ;;
2031 esac
2032 $myecho
2033 ans=!
2034 ;;
2304df62
AD
2035 esac;;
2036 *)
2037 case "\$aok" in
2038 y)
2039 echo "*** Substitution done -- please confirm."
2040 xxxm="\$ans"
c9795ab7 2041 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2042 xxxm="\$ans"
2043 ans=!
2044 ;;
2045 *)
2046 echo "*** Error -- try again."
2047 ans=!
2048 ;;
2049 esac
2050 $myecho
2051 ;;
2052 esac
2053 case "\$ans\$xxxm\$nostick" in
2054 '')
2055 ans=!
2056 $myecho
2057 ;;
2058 esac
2059done
2060case "\$ans" in
2061'') ans="\$xxxm";;
2062esac
2063EOSC
2064
2065: create .config dir to save info across Configure sessions
2066test -d ../.config || mkdir ../.config
2067cat >../.config/README <<EOF
2068This directory created by Configure to save information that should
dfe9444c 2069persist across sessions for $package.
2304df62
AD
2070
2071You may safely delete it if you wish.
2072EOF
2073
9507cadf 2074xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2075case "$usedevel" in
0107c034 2076$define|true|[yY]*) ;;
9507cadf 2077*) case "$xversion" in
0107c034
JH
2078 *[13579])
2079 cat >&4 <<EOH
2080*** WHOA THERE!!! ***
2081
2082 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2083 The version of this $package distribution is $xversion, that is, odd,
2084 (as opposed to even) and that signifies a development release.
3d5d58b1 2085 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2086
2087 Do ***NOT*** install this into production use.
2088 Data corruption and crashes are possible.
2089
2090 It is most seriously suggested that you do not continue any further
2091 unless you want to help in developing and debugging Perl.
2092
6adc6a45
JH
2093 If you *still* want to build perl, you can answer 'y' now,
2094 or pass -Dusedevel to Configure.
2095
0107c034
JH
2096EOH
2097 rp='Do you really want to continue?'
2098 dflt='n'
2099 . ./myread
2100 case "$ans" in
8feeef0e
JH
2101 [yY]) echo >&4 "Okay, continuing."
2102 usedevel="$define" ;;
0107c034
JH
2103 *) echo >&4 "Okay, bye."
2104 exit 1
2105 ;;
2106 esac
2107 ;;
2108 esac
2109 ;;
2110esac
8feeef0e
JH
2111case "$usedevel" in
2112$define|true|[yY]*)
2113 case "$versiononly" in
2114 '') versiononly="$define" ;;
2115 esac
2116 case "$installusrbinperl" in
2117 '') installusrbinperl="$undef" ;;
2118 esac
2119 ;;
2120esac
0107c034 2121
2304df62
AD
2122: general instructions
2123needman=true
2124firsttime=true
760ac839 2125user=`(logname) 2>/dev/null`
dfe9444c
AD
2126case "$user" in
2127'') user=`whoami 2>&1`;;
760ac839 2128esac
2304df62
AD
2129if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2130 firsttime=false
2131 echo " "
2132 rp='Would you like to see the instructions?'
2133 dflt=n
2134 . ./myread
2135 case "$ans" in
2136 [yY]*) ;;
2137 *) needman=false;;
2138 esac
2139fi
2140if $needman; then
2141 cat <<EOH
4e2a5f63 2142
2304df62 2143This installation shell script will examine your system and ask you questions
a0d0e21e 2144to determine how the perl5 package should be installed. If you get
2304df62
AD
2145stuck on a question, you may use a ! shell escape to start a subshell or
2146execute a command. Many of the questions will have default answers in square
2147brackets; typing carriage return will give you the default.
2148
2149On some of the questions which ask for file or directory names you are allowed
2150to use the ~name construct to specify the login directory belonging to "name",
2151even if you don't have a shell which knows about that. Questions where this is
2152allowed will be marked "(~name ok)".
2153
2154EOH
2155 rp=''
2156 dflt='Type carriage return to continue'
2157 . ./myread
2158 cat <<'EOH'
2159
2160The prompter used in this script allows you to use shell variables and
2161backticks in your answers. You may use $1, $2, etc... to refer to the words
2162in the default answer, as if the default line was a set of arguments given to a
2163script shell. This means you may also use $* to repeat the whole default line,
2164so you do not have to re-type everything to add something to the default.
2165
2166Everytime there is a substitution, you will have to confirm. If there is an
2167error (e.g. an unmatched backtick), the default answer will remain unchanged
2168and you will be prompted again.
2169
2170If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2171the questions and use the computed defaults (or the previous answers if there
2172was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2173You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2174on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2175
2176EOH
2177 . ./myread
2178 cat <<EOH
2179
2180Much effort has been expended to ensure that this shell script will run on any
2181Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2182Configure and run it again. If you can't run Configure for some reason,
2183you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2184have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2185
2186This installation script affects things in two ways:
2187
21881) it may do direct variable substitutions on some of the files included
2189 in this kit.
21902) it builds a config.h file for inclusion in C programs. You may edit
2191 any of these files as the need arises after running this script.
2192
2193If you make a mistake on a question, there is no easy way to back up to it
2194currently. The easiest thing to do is to edit config.sh and rerun all the SH
2195files. Configure will offer to let you do this before it runs the SH files.
2196
2197EOH
2198 dflt='Type carriage return to continue'
2199 . ./myread
2200 case "$firsttime" in
2201 true) echo $user >>../.config/instruct;;
2202 esac
2203fi
2204
2304df62
AD
2205: find out where common programs are
2206echo " "
2207echo "Locating common programs..." >&4
2208cat <<EOSC >loc
2209$startsh
2210case \$# in
22110) exit 1;;
2212esac
2213thing=\$1
2214shift
2215dflt=\$1
2216shift
2217for dir in \$*; do
2218 case "\$thing" in
2219 .)
2220 if test -d \$dir/\$thing; then
2221 echo \$dir
2222 exit 0
2223 fi
2224 ;;
2225 *)
a0d0e21e 2226 for thisthing in \$dir/\$thing; do
ecfc5424 2227 : just loop through to pick last item
a0d0e21e 2228 done
25f94b33 2229 if test -f \$thisthing; then
a0d0e21e 2230 echo \$thisthing
2304df62 2231 exit 0
a5a94ea5
JH
2232 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2233 echo \$thisthing
2234 exit 0
2304df62 2235 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2236 if test -n "$DJGPP"; then
2237 echo \$dir/\$thing.exe
b921d661 2238 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2239 : on Eunice apparently
2240 echo \$dir/\$thing
b921d661 2241 exit 0
c4f23d77 2242 fi
2d736872 2243 exit 0
2304df62
AD
2244 fi
2245 ;;
2246 esac
2247done
2248echo \$dflt
2249exit 1
2250EOSC
2251chmod +x loc
2252$eunicefix loc
2253loclist="
2254awk
2255cat
f8006fac 2256chmod
b4eb6b3d
JH
2257comm
2258cp
2304df62
AD
2259echo
2260expr
2261grep
a0d0e21e 2262ls
b4eb6b3d 2263mkdir
2304df62
AD
2264rm
2265sed
b4eb6b3d 2266sort
85e6fe83 2267touch
2304df62 2268tr
b4eb6b3d 2269uniq
2304df62
AD
2270"
2271trylist="
2272Mcc
dfe9444c 2273ar
3659ebf1 2274bison
b4eb6b3d 2275byacc
2304df62 2276cpp
b4eb6b3d 2277csh
2304df62
AD
2278date
2279egrep
1fef16b3 2280gmake
8ff267be 2281gzip
b4eb6b3d 2282less
8ff267be 2283ln
3c728e00 2284make
b4eb6b3d 2285more
693762b4 2286nm
b4eb6b3d
JH
2287nroff
2288pg
2304df62
AD
2289test
2290uname
8ff267be 2291zip
2304df62 2292"
8e07c86e 2293pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2294pth="$pth /lib /usr/lib"
2295for file in $loclist; do
dfe9444c
AD
2296 eval xxx=\$$file
2297 case "$xxx" in
2298 /*|?:[\\/]*)
2299 if test -f "$xxx"; then
2300 : ok
2301 else
2302 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2303 xxx=`./loc $file $file $pth`
2304 fi
2305 ;;
2306 '') xxx=`./loc $file $file $pth`;;
2307 *) xxx=`./loc $xxx $xxx $pth`;;
2308 esac
a5a94ea5 2309 eval $file=$xxx$_exe
2304df62
AD
2310 eval _$file=$xxx
2311 case "$xxx" in
2312 /*)
2313 echo $file is in $xxx.
2314 ;;
8e07c86e
AD
2315 ?:[\\/]*)
2316 echo $file is in $xxx.
2317 ;;
2304df62 2318 *)
25f94b33
AD
2319 echo "I don't know where '$file' is, and my life depends on it." >&4
2320 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2321 exit 1
2304df62
AD
2322 ;;
2323 esac
2324done
2325echo " "
2326echo "Don't worry if any of the following aren't found..."
2327say=offhand
2328for file in $trylist; do
dfe9444c
AD
2329 eval xxx=\$$file
2330 case "$xxx" in
2331 /*|?:[\\/]*)
2332 if test -f "$xxx"; then
2333 : ok
2334 else
2335 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2336 xxx=`./loc $file $file $pth`
2337 fi
2338 ;;
2339 '') xxx=`./loc $file $file $pth`;;
2340 *) xxx=`./loc $xxx $xxx $pth`;;
2341 esac
306a8474 2342 eval $file=$xxx$_exe
2304df62
AD
2343 eval _$file=$xxx
2344 case "$xxx" in
2345 /*)
2346 echo $file is in $xxx.
2347 ;;
8e07c86e
AD
2348 ?:[\\/]*)
2349 echo $file is in $xxx.
2350 ;;
2304df62
AD
2351 *)
2352 echo "I don't see $file out there, $say."
2353 say=either
2354 ;;
2355 esac
2356done
2357case "$egrep" in
1fef16b3 2358egrep)
2304df62
AD
2359 echo "Substituting grep for egrep."
2360 egrep=$grep
868439a2 2361 _egrep=$grep
2304df62
AD
2362 ;;
2363esac
8ff267be 2364case "$ln" in
1fef16b3 2365ln)
8ff267be 2366 echo "Substituting cp for ln."
2367 ln=$cp
868439a2 2368 _ln=$cp
8ff267be 2369 ;;
2370esac
2e26f1d5
JH
2371case "$make" in
2372make)
2373 case "$gmake" in
2374 gmake)
2375 echo "I can't find make or gmake, and my life depends on it." >&4
2376 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2377 exit 1
2378 ;;
2379 esac
2380 ;;
2381esac
2382case "$gmake" in
2383gmake) ;;
2384*) # We can't have osname yet.
1fef16b3
JH
2385 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2386 # Assume that gmake, if found, is definitely GNU make
2387 # and prefer it over the system make.
2388 echo "Substituting gmake for make."
2389 make=$gmake
868439a2 2390 _make=$gmake
1fef16b3
JH
2391 fi
2392 ;;
a5a94ea5 2393esac
2304df62
AD
2394case "$test" in
2395test)
2396 echo "Hopefully test is built into your sh."
2397 ;;
2398*)
73614538 2399 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2400 echo "Using the test built into your sh."
2304df62
AD
2401 test=test
2402 _test=test
2403 fi
2404 ;;
2405esac
2406case "$echo" in
2407echo)
2408 echo "Hopefully echo is built into your sh."
2409 ;;
2410'') ;;
2411*)
2412 echo " "
2413echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2414 $echo $n "hi there$c" >foo1
2415 echo $n "hi there$c" >foo2
2416 if cmp foo1 foo2 >/dev/null 2>&1; then
2417 echo "They are compatible. In fact, they may be identical."
2418 else
2419 case "$n" in
2420 '-n') n='' c='\c';;
2421 *) n='-n' c='';;
2422 esac
2423 cat <<FOO
2424They are not compatible! You are probably running ksh on a non-USG system.
2425I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2426have echo built in and we may have to run some Bourne shell scripts. That
2427means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2428
2429FOO
2430 $echo $n "The star should be here-->$c"
2431 $echo "*"
2432 fi
2433 $rm -f foo1 foo2
2434 ;;
2435esac
2436
6b769f8f 2437cat <<EOS >trygcc
2573c5f9
JH
2438$startsh
2439EOS
6b769f8f 2440cat <<'EOSC' >>trygcc
2573c5f9
JH
2441case "$cc" in
2442'') ;;
2443*) $rm -f try try.*
2444 $cat >try.c <<EOM
2445int main(int argc, char *argv[]) {
2446 return 0;
2447}
2448EOM
e4778687 2449 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2450 :
2451 else
2452 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2453 despair=yes
2454 trygcc=yes
2455 case "$cc" in
2456 *gcc*) trygcc=no ;;
2457 esac
2458 case "`$cc -v -c try.c 2>&1`" in
2459 *gcc*) trygcc=no ;;
2460 esac
2461 if $test X"$trygcc" = Xyes; then
2462 if gcc -o try -c try.c; then
2463 echo " "
2464 echo "You seem to have a working gcc, though." >&4
2465 rp="Would you like to use it?"
2466 dflt=y
2467 if $test -f myread; then
2468 . ./myread
2469 else
2470 if $test -f UU/myread; then
2471 . ./UU/myread
2472 else
2473 echo "Cannot find myread, sorry. Aborting." >&2
2474 exit 1
2475 fi
2476 fi
2477 case "$ans" in
6371411c
RB
2478 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2479 if $test -f usethreads.cbu; then
2480 $cat >&4 <<EOM
2481
2482*** However, any setting of the C compiler flags (e.g. for thread support)
2483*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2484*** (together with e.g. -Dusethreads).
2485
2486EOM
2487 fi;;
2573c5f9
JH
2488 esac
2489 fi
2490 fi
6b769f8f
RB
2491 fi
2492 $rm -f try try.*
2493 ;;
2494esac
2495EOSC
2496
2497cat <<EOS >checkcc
2498$startsh
2499EOS
2500cat <<'EOSC' >>checkcc
2501case "$cc" in
2502'') ;;
2503*) $rm -f try try.*
2504 $cat >try.c <<EOM
2505int main(int argc, char *argv[]) {
2506 return 0;
2507}
2508EOM
2509 if $cc -o try $ccflags $ldflags try.c; then
2510 :
2511 else
2573c5f9 2512 if $test X"$despair" = Xyes; then
6b769f8f
RB
2513 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2514 fi
2515 $cat >&4 <<EOM
5dd4fbdf
MB
2516You need to find a working C compiler.
2517Either (purchase and) install the C compiler supplied by your OS vendor,
2518or for a free C compiler try http://gcc.gnu.org/
2519I cannot continue any further, aborting.
2520EOM
6b769f8f 2521 exit 1
2573c5f9
JH
2522 fi
2523 $rm -f try try.*
2524 ;;
2525esac
2526EOSC
2527
a0d0e21e
LW
2528: determine whether symbolic links are supported
2529echo " "
2530$touch blurfl
2531if $ln -s blurfl sym > /dev/null 2>&1 ; then
2532 echo "Symbolic links are supported." >&4
818f00be 2533 lns="$ln -s"
a0d0e21e
LW
2534else
2535 echo "Symbolic links are NOT supported." >&4
2536 lns="$ln"
2537fi
2538$rm -f blurfl sym
2539
dafca956
JH
2540: determine whether symbolic links are supported
2541echo " "
2542case "$lns" in
18ea2752 2543*"ln"*" -s")
dafca956
JH
2544 echo "Checking how to test for symbolic links..." >&4
2545 $lns blurfl sym
4b661809 2546 if $test "X$issymlink" = X; then
2e2a97a6
JH
2547 case "$newsh" in
2548 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2549 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2550 esac
5d644a95
MB
2551 if test $? = 0; then
2552 issymlink="test -h"
2e2a97a6
JH
2553 else
2554 echo "Your builtin 'test -h' may be broken." >&4
2555 case "$test" in
2556 /*) ;;
2557 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2558 for p in $pth
2559 do
2560 if test -f "$p/$test"; then
2561 test="$p/$test"
2562 break
2563 fi
2564 done
2565 ;;
2566 esac
2567 case "$test" in
2568 /*)
2569 echo "Trying external '$test -h'." >&4
2570 issymlink="$test -h"
2571 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2572 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2573 issymlink=''
2574 fi
2575 ;;
2576 *) issymlink='' ;;
2577 esac
5d644a95
MB
2578 fi
2579 fi
4b661809 2580 if $test "X$issymlink" = X; then
dafca956 2581 if $test -L sym 2>/dev/null; then
5d644a95 2582 issymlink="$test -L"
2e2a97a6 2583 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2584 fi
2585 fi
4b661809 2586 if $test "X$issymlink" != X; then
5d644a95 2587 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2588 else
2589 echo "I do not know how you can test for symbolic links." >&4
2590 fi
2591 $rm -f blurfl sym
2592 ;;
2593*) echo "No symbolic links, so not testing for their testing..." >&4
2594 ;;
2595esac
2596echo " "
2597
2598
2599case "$mksymlinks" in
2600$define|true|[yY]*)
2601 case "$src" in
2602 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2603 exit 1
2604 ;;
4b661809 2605 *) case "$lns:$issymlink" in
f314eb9f 2606 *"ln"*" -s:"*"test -"?)
dafca956
JH
2607 echo "Creating the symbolic links..." >&4
2608 echo "(First creating the subdirectories...)" >&4
2609 cd ..
2610 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2611 read directory
2612 test -z "$directory" && break
2613 mkdir -p $directory
2614 done
2615 # Sanity check 1.
2616 if test ! -d t/base; then
2617 echo "Failed to create the subdirectories. Aborting." >&4
2618 exit 1
2619 fi
2620 echo "(Then creating the symlinks...)" >&4
2621 awk '{print $1}' $src/MANIFEST | while true; do
2622 read filename
2623 test -z "$filename" && break
2624 if test -f $filename; then
5d644a95 2625 if $issymlink $filename; then
dafca956
JH
2626 rm -f $filename
2627 fi
2628 fi
2629 if test -f $filename; then
2630 echo "$filename already exists, not symlinking."
2631 else
2632 ln -s $src/$filename $filename
2633 fi
2634 done
2635 # Sanity check 2.
a0d24b8a
JH
2636 if test ! -f t/base/lex.t; then
2637 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2638 exit 1
2639 fi
2640 cd UU
2641 ;;
2642 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2643 ;;
2644 esac
2645 ;;
2646 esac
2647 ;;
2648esac
2649
5440bc8e
JH
2650
2651case "$usecrosscompile" in
2652$define|true|[yY]*)
93bc48fa 2653 $echo "Cross-compiling..."
5440bc8e
JH
2654 croak=''
2655 case "$cc" in
2656 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2657 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2658 ar=$targetarch-ar
2659 # leave out ld, choosing it is more complex
2660 nm=$targetarch-nm
2661 ranlib=$targetarch-ranlib
93bc48fa 2662 $echo 'extern int foo;' > try.c
f8006fac 2663 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2664 shift
2665 if $test $# -gt 0; then
2666 incpth="$incpth $*"
f8006fac
JH
2667 incpth="`$echo $incpth|$sed 's/^ //'`"
2668 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2669 for i in $*; do
f8006fac 2670 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2671 if $test -d $j; then
2672 libpth="$libpth $j"
2673 fi
2674 done
f8006fac
JH
2675 libpth="`$echo $libpth|$sed 's/^ //'`"
2676 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2677 fi
2678 $rm -f try.c
5440bc8e
JH
2679 ;;
2680 esac
2681 case "$targetarch" in
93bc48fa
JH
2682 '') echo "Targetarch not defined." >&4; croak=y ;;
2683 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2684 esac
2685 case "$incpth" in
93bc48fa 2686 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2687 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2688 esac
2689 case "$libpth" in
93bc48fa 2690 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2691 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2692 esac
93bc48fa
JH
2693 case "$usrinc" in
2694 '') for i in $incpth; do
2695 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2696 usrinc=$i
2697 echo "Guessing usrinc $usrinc." >&4
2698 break
2699 fi
2700 done
2701 case "$usrinc" in
2702 '') echo "Usrinc not defined." >&4; croak=y ;;
2703 esac
2704 ;;
2705 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2706 esac
93bc48fa
JH
2707 case "$targethost" in
2708 '') echo "Targethost not defined." >&4; croak=y ;;
2709 *) echo "Using targethost $targethost." >&4
5440bc8e 2710 esac
93bc48fa
JH
2711 locincpth=' '
2712 loclibpth=' '
5440bc8e 2713 case "$croak" in
93bc48fa 2714 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2715 esac
2716 case "$src" in
2717 /*) run=$src/Cross/run
93c0359c 2718 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2719 to=$src/Cross/to
2720 from=$src/Cross/from
2721 ;;
93bc48fa 2722 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2723 run=$pwd/Cross/run
f8006fac 2724 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2725 to=$pwd/Cross/to
2726 from=$pwd/Cross/from
2727 ;;
2728 esac
2729 case "$targetrun" in
2730 '') targetrun=ssh ;;
2731 esac
2732 case "$targetto" in
2733 '') targetto=scp ;;
2734 esac
2735 case "$targetfrom" in
2736 '') targetfrom=scp ;;
2737 esac
2738 run=$run-$targetrun
2739 to=$to-$targetto
2740 from=$from-$targetfrom
93bc48fa
JH
2741 case "$targetdir" in
2742 '') targetdir=/tmp
2743 echo "Guessing targetdir $targetdir." >&4
2744 ;;
2745 esac
5440bc8e 2746 case "$targetuser" in
93bc48fa
JH
2747 '') targetuser=root
2748 echo "Guessing targetuser $targetuser." >&4
2749 ;;
5440bc8e
JH
2750 esac
2751 case "$targetfrom" in
2752 scp) q=-q ;;
2753 *) q='' ;;
2754 esac
2755 case "$targetrun" in
2756 ssh|rsh)
2757 cat >$run <<EOF
2758#!/bin/sh
93c0359c
JH
2759case "\$1" in
2760-cwd)
2761 shift
2762 cwd=\$1
2763 shift
2764 ;;
2765esac
2766case "\$cwd" in
2767'') cwd=$targetdir ;;
2768esac
5440bc8e
JH
2769exe=\$1
2770shift
93c0359c
JH
2771if $test ! -f \$exe.xok; then
2772 $to \$exe
2773 $touch \$exe.xok
2774fi
2775$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2776EOF
2777 ;;
93bc48fa 2778 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2779 exit 1
2780 ;;
2781 esac
93c0359c
JH
2782 case "$targetmkdir" in
2783 */Cross/mkdir)
2784 cat >$targetmkdir <<EOF
2785#!/bin/sh
2786$targetrun -l $targetuser $targethost "mkdir -p \$@"
2787EOF
f8006fac 2788 $chmod a+rx $targetmkdir
93c0359c
JH
2789 ;;
2790 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2791 exit 1
2792 ;;
2793 esac
5440bc8e
JH
2794 case "$targetto" in
2795 scp|rcp)
2796 cat >$to <<EOF
2797#!/bin/sh
2798for f in \$@
2799do
93c0359c
JH
2800 case "\$f" in
2801 /*)
2802 $targetmkdir \`dirname \$f\`
2803 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2804 ;;
2805 *)
2806 $targetmkdir $targetdir/\`dirname \$f\`
2807 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2808 ;;
2809 esac
5440bc8e
JH
2810done
2811exit 0
2812EOF
2813 ;;
2814 cp) cat >$to <<EOF
2815#!/bin/sh
93c0359c
JH
2816for f in \$@
2817do
2818 case "\$f" in
2819 /*)
2820 $mkdir -p $targetdir/\`dirname \$f\`
2821 $cp \$f $targetdir/\$f || exit 1
2822 ;;
2823 *)
2824 $targetmkdir $targetdir/\`dirname \$f\`
2825 $cp \$f $targetdir/\$f || exit 1
2826 ;;
2827 esac
2828done
2829exit 0
5440bc8e
JH
2830EOF
2831 ;;
93bc48fa 2832 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2833 exit 1
2834 ;;
2835 esac
2836 case "$targetfrom" in
2837 scp|rcp)
2838 cat >$from <<EOF
2839#!/bin/sh
2840for f in \$@
2841do
93c0359c 2842 $rm -f \$f
5440bc8e
JH
2843 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2844done
2845exit 0
2846EOF
2847 ;;
2848 cp) cat >$from <<EOF
2849#!/bin/sh
2850for f in \$@
2851do
93c0359c 2852 $rm -f \$f
5440bc8e
JH
2853 cp $targetdir/\$f . || exit 1
2854done
2855exit 0
2856EOF
2857 ;;
93bc48fa 2858 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2859 exit 1
2860 ;;
2861 esac
93bc48fa
JH
2862 if $test ! -f $run; then
2863 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2864 else
f8006fac 2865 $chmod a+rx $run
5440bc8e 2866 fi
93bc48fa
JH
2867 if $test ! -f $to; then
2868 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2869 else
f8006fac 2870 $chmod a+rx $to
5440bc8e 2871 fi
93bc48fa
JH
2872 if $test ! -f $from; then
2873 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2874 else
f8006fac 2875 $chmod a+rx $from
5440bc8e 2876 fi
93bc48fa 2877 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2878 exit 1
2879 fi
2880 cat >&4 <<EOF
f8006fac
JH
2881Using '$run' for remote execution,
2882and '$from' and '$to'
93bc48fa 2883for remote file transfer.
5440bc8e
JH
2884EOF
2885 ;;
2886*) run=''
2887 to=:
2888 from=:
2889 usecrosscompile='undef'
2890 targetarch=''
2891 ;;
2892esac
2893
ecfc5424
AD
2894: see whether [:lower:] and [:upper:] are supported character classes
2895echo " "
ecfc5424
AD
2896case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2897ABYZ)
2898 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2899 up='[:upper:]'
2900 low='[:lower:]'
2901 ;;
416d0bea
MB
2902*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2903 # (0xd9 and 0xe2), therefore that is a nice testing point.
2904 if test "X$up" = X -o "X$low" = X; then
2905 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2906 rs) up='[A-Z]'
2907 low='[a-z]'
28e8609d
JH
2908 ;;
2909 esac
416d0bea 2910 fi
28e8609d 2911 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2912 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2913 rs) up='A-Z'
28e8609d
JH
2914 low='a-z'
2915 ;;
2916 esac
416d0bea 2917 fi
28e8609d 2918 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2919 case "`echo RS | od -x 2>/dev/null`" in
2920 *D9E2*|*d9e2*)
28e8609d
JH
2921 echo "Hey, this might be EBCDIC." >&4
2922 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2923 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2924 rs) up='[A-IJ-RS-Z]'
2925 low='[a-ij-rs-z]'
28e8609d
JH
2926 ;;
2927 esac
2928 fi
2929 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2930 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2931 rs) up='A-IJ-RS-Z'
2932 low='a-ij-rs-z'
28e8609d
JH
2933 ;;
2934 esac
2935 fi
2936 ;;
2937 esac
2938 fi
2939esac
416d0bea
MB
2940case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2941rs)
28e8609d
JH
2942 echo "Using $up and $low to convert case." >&4
2943 ;;
ecfc5424 2944*)
28e8609d
JH
2945 echo "I don't know how to translate letters from upper to lower case." >&4
2946 echo "Your tr is not acting any way I know of." >&4
2947 exit 1
2948 ;;
ecfc5424
AD
2949esac
2950: set up the translation script tr, must be called with ./tr of course
2951cat >tr <<EOSC
2952$startsh
2953case "\$1\$2" in
2954'[A-Z][a-z]') exec $tr '$up' '$low';;
2955'[a-z][A-Z]') exec $tr '$low' '$up';;
2956esac
2957exec $tr "\$@"
2958EOSC
2959chmod +x tr
2960$eunicefix tr
2961
2304df62
AD
2962: Try to determine whether config.sh was made on this system
2963case "$config_sh" in
2964'')
43999f95
JH
2965myuname=`$uname -a 2>/dev/null`
2966$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2967# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2968# because the A-Z/a-z are not consecutive.
a0d0e21e 2969myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2970 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2971newmyuname="$myuname"
2304df62 2972dflt=n
16d20bd9
AD
2973case "$knowitall" in
2974'')
2975 if test -f ../config.sh; then
2976 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2977 eval "`grep myuname= ../config.sh`"
2978 fi
2979 if test "X$myuname" = "X$newmyuname"; then
2980 dflt=y
2981 fi
2304df62 2982 fi
16d20bd9
AD
2983 ;;
2984*) dflt=y;;
2985esac
2304df62
AD
2986
2987: Get old answers from old config file if Configure was run on the
2988: same system, otherwise use the hints.
2989hint=default
2990cd ..
2991if test -f config.sh; then
16d20bd9
AD
2992 echo " "
2993 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2994 . UU/myread
2995 case "$ans" in
f83701cd
AD
2996 n*|N*) echo "OK, I'll ignore it."
2997 mv config.sh config.sh.old
2998 myuname="$newmyuname"
2999 ;;
2304df62 3000 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3001 tmp_n="$n"
3002 tmp_c="$c"
85cad39c 3003 tmp_sh="$sh"
2304df62
AD
3004 . ./config.sh
3005 cp config.sh UU
ecfc5424
AD
3006 n="$tmp_n"
3007 c="$tmp_c"
85cad39c 3008 : Older versions did not always set $sh. Catch re-use of such
3009 : an old config.sh.
3010 case "$sh" in
3011 '') sh="$tmp_sh" ;;
3012 esac
2304df62
AD
3013 hint=previous
3014 ;;
3015 esac
3016fi
2573c5f9 3017. ./UU/checkcc
2304df62
AD
3018if test ! -f config.sh; then
3019 $cat <<EOM
3020
4e2a5f63
AD
3021First time through, eh? I have some defaults handy for some systems
3022that need some extra help getting the Configure answers right:
2304df62
AD
3023
3024EOM
dfe9444c 3025 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3026 dflt=''
3027 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3028 : tests or hints, please send them to perlbug@perl.org
2304df62 3029 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3030 $test -f /irix && osname=irix
85e6fe83
LW
3031 $test -f /xenix && osname=sco_xenix
3032 $test -f /dynix && osname=dynix
3033 $test -f /dnix && osname=dnix
5f05dabc 3034 $test -f /lynx.os && osname=lynxos
3035 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3036 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3037 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3038 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3039 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3040 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3041 $test -d /usr/apollo/bin && osname=apollo
3042 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3043 $test -d /usr/include/minix && osname=minix
d54344fc 3044 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3045 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3046 osname=machten
4633a7c4 3047 if $test -x /sbin/version; then
dfe9444c 3048 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3049 $sed -e 's/[A-Za-z]$//'`
3050 elif $test -x /usr/etc/version; then
dfe9444c 3051 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3052 $sed -e 's/[A-Za-z]$//'`
3053 else
3054 osvers="$2.$3"
3055 fi
3056 fi
aaacdc8b
GS
3057
3058 $test -f /sys/posix.dll &&
3059 $test -f /usr/bin/what &&
3060 set X `/usr/bin/what /sys/posix.dll` &&
3061 $test "$3" = UWIN &&
3062 osname=uwin &&
3063 osvers="$5"
3064
2304df62
AD
3065 if $test -f $uname; then
3066 set X $myuname
3067 shift
3068
2304df62 3069 case "$5" in
85e6fe83 3070 fps*) osname=fps ;;
2304df62
AD
3071 mips*)
3072 case "$4" in
85e6fe83
LW
3073 umips) osname=umips ;;
3074 *) osname=mips ;;
2304df62 3075 esac;;
85e6fe83
LW
3076 [23]100) osname=mips ;;
3077 next*) osname=next ;;
ecfc5424 3078 i386*)
c6912327
JH
3079 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3080 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3081 osname='sco'
3082 osvers=$tmp
3083 elif $test -f /etc/kconfig; then
ecfc5424 3084 osname=isc
bd628c73 3085 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3086 osvers=4
3087 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3088 osvers=3
2304df62 3089 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3090 osvers=2
ecfc5424
AD
3091 fi
3092 fi
2000072c 3093 tmp=''
ecfc5424 3094 ;;
c4f23d77
AD
3095 pc*)
3096 if test -n "$DJGPP"; then
3097 osname=dos
3098 osvers=djgpp
3099 fi
3100 ;;
2304df62
AD
3101 esac
3102
3103 case "$1" in
a0d0e21e
LW
3104 aix) osname=aix
3105 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3106 case "$tmp" in
e81c5c2a
NC
3107 # oslevel can fail with:
3108 # oslevel: Unable to acquire lock.
3109 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3110 '<3240'|'<>3240') osvers=3.2.0 ;;
3111 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3112 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3113 *) osvers=$tmp;;
a0d0e21e
LW
3114 esac
3115 ;;
aaacdc8b
GS
3116 bsd386) osname=bsd386
3117 osvers=`$uname -r`
3118 ;;
3119 cygwin*) osname=cygwin
3120 osvers="$3"
3121 ;;
23f87696
SZ
3122 *dc.osx) osname=dcosx
3123 osvers="$3"
3124 ;;
a0d0e21e
LW
3125 dnix) osname=dnix
3126 osvers="$3"
3127 ;;
3128 domainos) osname=apollo
3129 osvers="$3"
3130 ;;
761ee4e8 3131 dgux) osname=dgux
a0d0e21e
LW
3132 osvers="$3"
3133 ;;
760ac839 3134 dynixptx*) osname=dynixptx
e58e581d 3135 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3136 ;;
a0d0e21e
LW
3137 freebsd) osname=freebsd
3138 osvers="$3" ;;
761ee4e8
BD
3139 genix) osname=genix ;;
3140 gnu) osname=gnu
3141 osvers="$3" ;;
3142 hp*) osname=hpux
bfb7748a 3143 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3144 ;;
761ee4e8 3145 irix*) osname=irix
a0d0e21e
LW
3146 case "$3" in
3147 4*) osvers=4 ;;
3148 5*) osvers=5 ;;
ecfc5424 3149 *) osvers="$3" ;;
a0d0e21e
LW
3150 esac
3151 ;;
761ee4e8 3152 linux) osname=linux
a0d0e21e 3153 case "$3" in
a0d0e21e
LW
3154 *) osvers="$3" ;;
3155 esac
3156 ;;
761ee4e8 3157 MiNT) osname=mint
28e8609d
JH
3158 ;;
3159 netbsd*) osname=netbsd
ecfc5424
AD
3160 osvers="$3"
3161 ;;
4e81affe
MM
3162 news-os) osvers="$3"
3163 case "$3" in
3164 4*) osname=newsos4 ;;
3165 *) osname=newsos ;;
3166 esac
3167 ;;
aaacdc8b 3168 next*) osname=next ;;
28bb1e2c 3169 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3170 openbsd) osname=openbsd
3171 osvers="$3"
3172 ;;
5c728af0
IZ
3173 os2) osname=os2
3174 osvers="$4"
3175 ;;
aaacdc8b
GS
3176 POSIX-BC | posix-bc ) osname=posix-bc
3177 osvers="$3"
a0d0e21e 3178 ;;
ae3afa4e
TH
3179 powerux | power_ux | powermax_os | powermaxos | \
3180 powerunix | power_unix) osname=powerux
3181 osvers="$3"
3182 ;;
aaacdc8b
GS
3183 qnx) osname=qnx
3184 osvers="$4"
3185 ;;
a0d0e21e
LW
3186 solaris) osname=solaris
3187 case "$3" in
3188 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3189 *) osvers="$3" ;;
a0d0e21e
LW
3190 esac
3191 ;;
85e6fe83
LW
3192 sunos) osname=sunos
3193 case "$3" in
85e6fe83
LW
3194 5*) osname=solaris
3195 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3196 *) osvers="$3" ;;
2304df62
AD
3197 esac
3198 ;;
a0d0e21e 3199 titanos) osname=titanos
85e6fe83 3200 case "$3" in
a0d0e21e
LW
3201 1*) osvers=1 ;;
3202 2*) osvers=2 ;;
3203 3*) osvers=3 ;;
3204 4*) osvers=4 ;;
ecfc5424 3205 *) osvers="$3" ;;
2304df62
AD
3206 esac
3207 ;;
85e6fe83 3208 ultrix) osname=ultrix
ecfc5424 3209 osvers="$3"
2304df62 3210 ;;
28757baa 3211 osf1|mls+) case "$5" in
fed7345c
AD
3212 alpha)
3213 osname=dec_osf
fdd85a03 3214 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3215 case "$osvers" in
3216 [1-9].[0-9]*) ;;
3217 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3218 esac
ecfc5424
AD
3219 ;;
3220 hp*) osname=hp_osf1 ;;
3221 mips) osname=mips_osf1 ;;
85e6fe83
LW
3222 esac
3223 ;;
af1ff193 3224 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3225 openunix|unixware) osname=svr5
0337d152
BG
3226 osvers="$4"
3227 ;;
3c728e00 3228 uts) osname=uts
a0d0e21e
LW
3229 osvers="$3"
3230 ;;
3c728e00
JH
3231 vos) osvers="$3"
3232 ;;
85e6fe83 3233 $2) case "$osname" in
2304df62 3234 *isc*) ;;
a0d0e21e 3235 *freebsd*) ;;
5f05dabc 3236 svr*)
a0d0e21e
LW
3237 : svr4.x or possibly later
3238 case "svr$3" in
3239 ${osname}*)
3240 osname=svr$3
3241 osvers=$4
3242 ;;
3243 esac
3244 case "$osname" in
3245 svr4.0)
3246 : Check for ESIX
3247 if test -f /stand/boot ; then
3248 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3249 if test -n "$INITPROG" -a -f "$INITPROG"; then
3250 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3251 if test -n "$isesix"; then
a0d0e21e
LW
3252 osname=esix4
3253 fi
3254 fi
3255 fi
3256 ;;
3257 esac
3258 ;;
2304df62 3259 *) if test -f /etc/systemid; then
a0d0e21e
LW
3260 osname=sco
3261 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3262 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3263 osvers=$1.$2.$3
c4f23d77 3264 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3265 osvers=$1.$2
c4f23d77 3266 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3267 osvers=$1
2304df62 3268 fi
a0d0e21e
LW
3269 else
3270 case "$osname" in
3271 '') : Still unknown. Probably a generic Sys V.
3272 osname="sysv"
3273 osvers="$3"
3274 ;;
3275 esac
2304df62
AD
3276 fi
3277 ;;
3278 esac
3279 ;;
a0d0e21e
LW
3280 *) case "$osname" in
3281 '') : Still unknown. Probably a generic BSD.
3282 osname="$1"
3283 osvers="$3"
3284 ;;
3285 esac
3286 ;;
2304df62
AD
3287 esac
3288 else
dfe9444c
AD
3289 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3290 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3291 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3292 osname=news_os
2304df62 3293 fi
dfe9444c 3294 $rm -f UU/kernel.what
5c728af0 3295 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3296 set X $myuname
3297 osname=os2
3298 osvers="$5"
2304df62
AD
3299 fi
3300 fi
85e6fe83 3301
5440bc8e
JH
3302 case "$targetarch" in
3303 '') ;;
3304 *) hostarch=$osname
3305 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3306 osvers=''
3307 ;;
3308 esac
3309
a0d0e21e
LW
3310 : Now look for a hint file osname_osvers, unless one has been
3311 : specified already.
3312 case "$hintfile" in
3313 ''|' ')
1e127011 3314 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3315 : Also try without trailing minor version numbers.
1e127011
DD
3316 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3317 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3318 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3319 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3320 case "$file" in
3321 '') dflt=none ;;
3322 *) case "$osvers" in
3323 '') dflt=$file
3324 ;;
dfe9444c 3325 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3326 dflt=$file
dfe9444c 3327 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3328 dflt=$xfile
dfe9444c 3329 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3330 dflt=$xxfile
dfe9444c 3331 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3332 dflt=$xxxfile
dfe9444c 3333 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3334 dflt=$xxxxfile
dfe9444c 3335 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3336 dflt="${osname}"
3337 else
3338 dflt=none
3339 fi
3340 ;;
3341 esac
85e6fe83
LW
3342 ;;
3343 esac
4e2a5f63
AD
3344 if $test -f Policy.sh ; then
3345 case "$dflt" in
3346 *Policy*) ;;
3347 none) dflt="Policy" ;;
3348 *) dflt="Policy $dflt" ;;
3349 esac
3350 fi
85e6fe83 3351 ;;
a0d0e21e 3352 *)
ecfc5424 3353 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3354 ;;
2304df62 3355 esac
1aef975c 3356
4e2a5f63
AD
3357 if $test -f Policy.sh ; then
3358 $cat <<EOM
3359
3360There's also a Policy hint file available, which should make the
3361site-specific (policy) questions easier to answer.
3362EOM
3363
3364 fi
3365
2304df62
AD
3366 $cat <<EOM
3367
3368You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3369A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3370is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3371
3372EOM
4e2a5f63 3373
2304df62 3374 rp="Which of these apply, if any?"
dfe9444c 3375 . UU/myread
85e6fe83
LW
3376 tans=$ans
3377 for file in $tans; do
4e2a5f63
AD
3378 if $test X$file = XPolicy -a -f Policy.sh; then
3379 . Policy.sh
3380 $cat Policy.sh >> UU/config.sh
3381 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3382 . $src/hints/$file.sh
3383 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3384 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3385 : nothing
3386 else
85e6fe83
LW
3387 : Give one chance to correct a possible typo.
3388 echo "$file.sh does not exist"
3389 dflt=$file
3390 rp="hint to use instead?"
dfe9444c 3391 . UU/myread
85e6fe83 3392 for file in $ans; do
dfe9444c
AD
3393 if $test -f "$src/hints/$file.sh"; then
3394 . $src/hints/$file.sh
3395 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3396 elif $test X$ans = X -o X$ans = Xnone ; then
3397 : nothing
3398 else
3399 echo "$file.sh does not exist -- ignored."
3400 fi
3401 done
2304df62
AD
3402 fi
3403 done
85e6fe83 3404
2304df62 3405 hint=recommended
85e6fe83 3406 : Remember our hint file for later.
dfe9444c 3407 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3408 hintfile="$file"
85e6fe83 3409 else
a0d0e21e 3410 hintfile=''
85e6fe83 3411 fi
2304df62
AD
3412fi
3413cd UU
3414;;
3415*)
3416 echo " "
3417 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3418 tmp_n="$n"
3419 tmp_c="$c"
2304df62
AD
3420 cd ..
3421 cp $config_sh config.sh 2>/dev/null
a78b0d02 3422 chmod +w config.sh
2304df62
AD
3423 . ./config.sh
3424 cd UU
3425 cp ../config.sh .
ecfc5424
AD
3426 n="$tmp_n"
3427 c="$tmp_c"
2304df62
AD
3428 hint=previous
3429 ;;
3430esac
1aef975c 3431test "$override" && . ./optdef.sh
2304df62
AD
3432
3433: Restore computed paths
3434for file in $loclist $trylist; do
3435 eval $file="\$_$file"
3436done
3437
85e6fe83 3438cat << EOM
a0d0e21e 3439
85e6fe83 3440Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3441The default value is probably right if the name rings a bell. Otherwise,
3442since spelling matters for me, either accept the default or answer "none"
3443to leave it blank.
a0d0e21e 3444
85e6fe83 3445EOM
85e6fe83 3446case "$osname" in
a0d0e21e 3447 ''|' ')
85e6fe83 3448 case "$hintfile" in
a0d0e21e 3449 ''|' '|none) dflt=none ;;
ecfc5424 3450 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3451 esac
3452 ;;
3453 *) dflt="$osname" ;;
3454esac
3455rp="Operating system name?"
3456. ./myread
3457case "$ans" in
ecfc5424
AD
3458none) osname='' ;;
3459*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3460esac
8ff267be 3461echo " "
3462case "$osvers" in
3463 ''|' ')
3464 case "$hintfile" in
3465 ''|' '|none) dflt=none ;;
3466 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3467 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3468 case "$dflt" in
3469 ''|' ') dflt=none ;;
3470 esac
3471 ;;
3472 esac
3473 ;;
3474 *) dflt="$osvers" ;;
3475esac
3476rp="Operating system version?"
3477. ./myread
3478case "$ans" in
3479none) osvers='' ;;
3480*) osvers="$ans" ;;
3481esac
3482
02e93a22
JH
3483
3484. ./posthint.sh
3485
2304df62 3486: who configured the system
59b83a6f 3487cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3488case "$cf_by" in
3489"")
7c04078e 3490 cf_by=`(logname) 2>/dev/null`
dfe9444c 3491 case "$cf_by" in
7c04078e
GA
3492 "")
3493 cf_by=`(whoami) 2>/dev/null`
3494 case "$cf_by" in
3495 "") cf_by=unknown ;;
3496 esac ;;
8ff267be 3497 esac ;;
3498esac
2304df62 3499
b4eb6b3d
JH
3500: set up the script used to warn in case of inconsistency
3501cat <<EOS >whoa
3502$startsh
3503EOS
3504cat <<'EOSC' >>whoa
3505dflt=y
3506echo " "
3507echo "*** WHOA THERE!!! ***" >&4
3508echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3509rp=" Keep the $hint value?"
3510. ./myread
3511case "$ans" in
3512y) td=$was; tu=$was;;
3513esac
3514EOSC
3515
3516: function used to set $1 to $val
3517setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3518case "$val$was" in
3519$define$undef) . ./whoa; eval "$var=\$td";;
3520$undef$define) . ./whoa; eval "$var=\$tu";;
3521*) eval "$var=$val";;
3522esac'
3523
b29b105d
JH
3524case "$usesocks" in
3525$define|true|[yY]*) dflt='y';;
3526*) dflt='n';;
3527esac
3528cat <<EOM
3529
3530Perl can be built to use the SOCKS proxy protocol library. To do so,
3531Configure must be run with -Dusesocks. If you use SOCKS you also need
3532to use the PerlIO abstraction layer, this will be implicitly selected.
3533
3534If this doesn't make any sense to you, just accept the default '$dflt'.
3535EOM
3536rp='Build Perl for SOCKS?'
3537. ./myread
3538case "$ans" in
3539y|Y) val="$define" ;;
3540*) val="$undef" ;;
3541esac
3542set usesocks
3543eval $setvar
3544
3545case "$usesocks" in
3546$define|true|[yY]*) useperlio="$define";;
3547esac
3548
3549case "$useperlio" in
3550$define|true|[yY]*|'') dflt='y';;
3551*) dflt='n';;
3552esac
3553cat <<EOM
3554
3555Previous version of $package used the standard IO mechanisms as
3556defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3557alternate IO mechanisms via the PerlIO abstraction layer, but the
3558stdio mechanism is still available if needed. The abstraction layer
3559can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3560Using PerlIO with sfio may cause problems with some extension modules.
3561
3562If this doesn't make any sense to you, just accept the default '$dflt'.
3563EOM
3564rp='Use the PerlIO abstraction layer?'
3565. ./myread
3566case "$ans" in
3567y|Y)
3568 val="$define"
3569 ;;
3570*)
3571 echo "Ok, doing things the stdio way."
3572 val="$undef"
3573 ;;
3574esac
3575set useperlio
3576eval $setvar
3577
3578case "$usesocks" in
3579$define|true|[yY]*)
3580 case "$useperlio" in
3581 $define|true|[yY]*) ;;
3582 *) cat >&4 <<EOM
3583
3584You are using the SOCKS proxy protocol library which means that you
3585should also use the PerlIO layer. You may be headed for trouble.
3586
3587EOM
3588 ;;
3589 esac
3590 ;;
3591esac
3592
3593
b4eb6b3d
JH
3594case "$usethreads" in
3595$define|true|[yY]*) dflt='y';;
8e285145
AD
3596*) # Catch case where user specified ithreads or 5005threads but
3597 # forgot -Dusethreads (A.D. 4/2002)
3598 case "$useithreads$use5005threads" in
b29b105d
JH
3599 *$define*)
3600 case "$useperlio" in
3601 "$define") dflt='y' ;;
3602 *) dflt='n' ;;
3603 esac
3604 ;;
3605 *) dflt='n';;
8e285145
AD
3606 esac
3607 ;;
b4eb6b3d
JH
3608esac
3609cat <<EOM
3610
3611Perl can be built to take advantage of threads on some systems.
3612To do so, Configure can be run with -Dusethreads.
3613
bfce6503
DM
3614Note that Perl built with threading support runs slightly slower
3615and uses more memory than plain Perl. The current implementation
3616is believed to be stable, but it is fairly new, and so should be
3617treated with caution.
b4eb6b3d
JH
3618
3619If this doesn't make any sense to you, just accept the default '$dflt'.
3620EOM
3621rp='Build a threading Perl?'
3622. ./myread
3623case "$ans" in
3624y|Y) val="$define" ;;
3625*) val="$undef" ;;
3626esac
3627set usethreads
3628eval $setvar
3629
3630case "$usethreads" in
3631$define)
3632 $cat <<EOM
3633
bfce6503
DM
3634Since release 5.6, Perl has had two different threading implementations,
3635the newer interpreter-based version (ithreads) with one interpreter per
3636thread, and the older 5.005 version (5005threads).
3637The 5005threads version is effectively unmaintained and will probably be
3638removed in Perl 5.10, so there should be no need to build a Perl using it
3639unless needed for backwards compatibility with some existing 5.005threads
3640code.
b4eb6b3d 3641
b4eb6b3d
JH
3642EOM
3643 : Default to ithreads unless overridden on command line or with
3644 : old config.sh
3645 dflt='y'
3646 case "$use5005threads" in
3647 $define|true|[yY]*) dflt='n';;
3648 esac
3649 case "$useithreads" in
3650 $undef|false|[nN]*) dflt='n';;
3651 esac
bfce6503 3652 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3653 . ./myread
3654 case "$ans" in
3655 y|Y) val="$define" ;;
3656 *) val="$undef" ;;
3657 esac
3658 set useithreads
3659 eval $setvar
3660 : Now set use5005threads to the opposite value.
3661 case "$useithreads" in
3662 $define) val="$undef" ;;
3663 *) val="$define" ;;
3664 esac
3665 set use5005threads
3666 eval $setvar
3667 ;;
3668*)
3669 useithreads="$undef"
3670 use5005threads="$undef"
3671 ;;
3672esac
3673
c915ce7f
JH
3674case "$useithreads$use5005threads" in
3675"$define$define")
3676 $cat >&4 <<EOM
3677
3678You cannot have both the ithreads and the 5.005 threads enabled
3679at the same time. Disabling the 5.005 threads since they are
3680much less stable than the ithreads.
3681
3682EOM
3683 use5005threads="$undef"
3684 ;;
3685esac
3686
b29b105d
JH
3687if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3688 cat >&4 <<EOF
3689***
3690*** To build with ithreads you must also use the PerlIO layer.
3691*** Cannot continue, aborting.
3692***
3693EOF
3694 exit 1
3695fi
3696
b4eb6b3d
JH
3697case "$d_oldpthreads" in
3698'') : Configure tests would be welcome here. For now, assume undef.
3699 val="$undef" ;;
3700*) val="$d_oldpthreads" ;;
3701esac
3702set d_oldpthreads
3703eval $setvar
3704
3705
b4eb6b3d
JH
3706: Look for a hint-file generated 'call-back-unit'. If the
3707: user has specified that a threading perl is to be built,
3708: we may need to set or change some other defaults.
9da7673b
MB
3709if $test -f usethreads.cbu; then
3710 echo "Your platform has some specific hints regarding threaded builds, using them..."
3711 . ./usethreads.cbu
3712else
3713 case "$usethreads" in
3714 "$define"|true|[yY]*)
b4eb6b3d 3715 $cat <<EOM
9da7673b 3716(Your platform does not have any specific hints for threaded builds.
b4eb6b3d
JH
3717 Assuming POSIX threads, then.)
3718EOM
b4eb6b3d 3719 ;;
9da7673b
MB
3720 esac
3721fi
b4eb6b3d
JH
3722
3723cat <<EOM
3724
3725Perl can be built so that multiple Perl interpreters can coexist
3726within the same Perl executable.
3727EOM
3728
3729case "$useithreads" in
3730$define)
3731 cat <<EOM
3732This multiple interpreter support is required for interpreter-based threads.
3733EOM
3734 val="$define"
3735 ;;
3736*) case "$usemultiplicity" in
3737 $define|true|[yY]*) dflt='y';;
3738 *) dflt='n';;
3739 esac
3740 echo " "
3741 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3742 rp='Build Perl for multiplicity?'
3743 . ./myread
3744 case "$ans" in
3745 y|Y) val="$define" ;;
3746 *) val="$undef" ;;
3747 esac
3748 ;;
3749esac
3750set usemultiplicity
3751eval $setvar
3752
96056487
JH
3753
3754case "$usemorebits" in
3755"$define"|true|[yY]*)
3756 use64bitint="$define"
3757 uselongdouble="$define"
3758 usemorebits="$define"
3759 ;;
3760*) usemorebits="$undef"
3761 ;;
3762esac
3763
e5e20432
JH
3764: make some quick guesses about what we are up against
3765echo " "
3766$echo $n "Hmm... $c"
3767echo exit 1 >bsd
3768echo exit 1 >usg
3769echo exit 1 >v7
3770echo exit 1 >osf1
3771echo exit 1 >eunice
3772echo exit 1 >xenix
3773echo exit 1 >venix
3774echo exit 1 >os2
3775d_bsd="$undef"
3776$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3777if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3778then
3779 echo "Looks kind of like an OSF/1 system, but we'll see..."
3780 echo exit 0 >osf1
381aa1ff 3781elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3782 xxx=`./loc addbib blurfl $pth`
3783 if $test -f $xxx; then
3784 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3785 echo exit 0 >bsd
3786 echo exit 0 >usg
3787 else
3788 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3789 echo "Looks kind of like an extended USG system, but we'll see..."
3790 else
3791 echo "Looks kind of like a USG system, but we'll see..."
3792 fi
3793 echo exit 0 >usg
3794 fi
3795elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3796 echo "Looks kind of like a BSD system, but we'll see..."
3797 d_bsd="$define"
3798 echo exit 0 >bsd
3799else
3800 echo "Looks kind of like a Version 7 system, but we'll see..."
3801 echo exit 0 >v7
3802fi
3803case "$eunicefix" in
3804*unixtovms*)
3805 $cat <<'EOI'
3806There is, however, a strange, musty smell in the air that reminds me of
3807something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3808EOI
3809 echo exit 0 >eunice
3810 d_eunice="$define"
3811: it so happens the Eunice I know will not run shell scripts in Unix format
3812 ;;
3813*)
3814 echo " "
3815 echo "Congratulations. You aren't running Eunice."
3816 d_eunice="$undef"
3817 ;;
3818esac
3819: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3820: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3821: semicolon as a patch separator
e5e20432
JH
3822case "$p_" in
3823:) ;;
3824*)
3825 $cat <<'EOI'
3826I have the feeling something is not exactly right, however...don't tell me...
3827lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3828(Or you may be running DOS with DJGPP.)
e5e20432
JH
3829EOI
3830 echo exit 0 >os2
3831 ;;
3832esac
3833if test -f /xenix; then
3834 echo "Actually, this looks more like a XENIX system..."
3835 echo exit 0 >xenix
3836 d_xenix="$define"
3837else
3838 echo " "
3839 echo "It's not Xenix..."
3840 d_xenix="$undef"
3841fi
3842chmod +x xenix
3843$eunicefix xenix
3844if test -f /venix; then
3845 echo "Actually, this looks more like a VENIX system..."
3846 echo exit 0 >venix
3847else
3848 echo " "
3849 if ./xenix; then
3850 : null
3851 else
3852 echo "Nor is it Venix..."
3853 fi
3854fi
3855chmod +x bsd usg v7 osf1 eunice xenix venix os2
3856$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3857$rm -f foo
3858
5869b1f1
JH
3859case "$cc" in
3860'') dflt=cc;;
3861*) dflt="$cc";;
3862esac
3863rp="Use which C compiler?"
3864. ./myread
3865cc="$ans"
6b769f8f
RB
3866
3867: See if they have not cc but they do have gcc
3868. ./trygcc
e5e20432
JH
3869: Look for a hint-file generated 'call-back-unit'. Now that the
3870: user has specified the compiler, we may need to set or change some
3871: other defaults.
3872if $test -f cc.cbu; then
3873 . ./cc.cbu
3874fi
2573c5f9 3875. ./checkcc
8a27cf78 3876
e5e20432
JH
3877echo " "
3878echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3879$cat >try.c <<EOM
e5e20432
JH
3880#include <stdio.h>
3881int main() {
3882#ifdef __GNUC__
3883#ifdef __VERSION__
3884 printf("%s\n", __VERSION__);
3885#else
3886 printf("%s\n", "1");
3887#endif
3888#endif
073b6de5 3889 return(0);
e5e20432
JH
3890}
3891EOM
5440bc8e
JH
3892if $cc -o try $ccflags $ldflags try.c; then
3893 gccversion=`$run ./try`
e5e20432
JH
3894 case "$gccversion" in
3895 '') echo "You are not using GNU cc." ;;
fc68435e 3896 *) echo "You are using GNU cc $gccversion."
48fe685d 3897 ccname=gcc
fc68435e 3898 ;;
e5e20432
JH
3899 esac
3900else
3901 echo " "
3902 echo "*** WHOA THERE!!! ***" >&4
3903 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3904 case "$knowitall" in
3905 '')
3906 echo " You'd better start hunting for one and let me know about it." >&4
3907 exit 1
3908 ;;
3909 esac
3910fi
5440bc8e 3911$rm -f try try.*
e5e20432
JH
3912case "$gccversion" in
39131*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3914esac
5b463ca7
KS
3915case "$gccversion" in
3916'') gccosandvers='' ;;
10b4ebb5
JH
3917*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3918 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3919 gccshortvers=''
5b463ca7 3920 case "$gccosandvers" in
02903077
JH
3921 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3922 $osname$osvers) ;; # looking good
5b463ca7
KS
3923 $osname*) cat <<EOM >&4
3924
3925*** WHOA THERE!!! ***
3926
3927 Your gcc has not been compiled for the exact release of
3928 your operating system ($gccosandvers versus $osname$osvers).
3929
3930 In general it is a good idea to keep gcc synchronized with
3931 the operating system because otherwise serious problems
3932 may ensue when trying to compile software, like Perl.
3933
3934 I'm trying to be optimistic here, though, and will continue.
3935 If later during the configuration and build icky compilation
02903077
JH
3936 problems appear (headerfile conflicts being the most common
3937 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3938 your operating system release.
3939
3940EOM
3941 ;;
81575342 3942 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3943 esac
3944 ;;
3945esac
e723fc21
JH
3946case "$ccname" in
3947'') ccname="$cc" ;;
3948esac
e5e20432 3949
224cb7cb 3950# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3951# so we will take those off from locincpth.
3952case "$gccversion" in
39533*)
3954 echo "main(){}">try.c
224cb7cb
JH
3955 for incdir in $locincpth; do
3956 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3957 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3958 if test "X$warn" != X; then
44b94491 3959 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3960 fi
76589481
JH
3961 done
3962 $rm -f try try.*
3963esac
640374d0 3964
bd9b35c9
JH
3965: decide how portable to be. Allow command line overrides.
3966case "$d_portable" in
3967"$undef") ;;
3968*) d_portable="$define" ;;
104d25b7 3969esac
85ab1d1d 3970
bd9b35c9
JH
3971: set up shell script to do ~ expansion
3972cat >filexp <<EOSS
3973$startsh
3974: expand filename
3975case "\$1" in
3976 ~/*|~)
3977 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3978 ;;
3979 ~*)
3980 if $test -f /bin/csh; then
3981 /bin/csh -f -c "glob \$1"
3982 failed=\$?
3983 echo ""
3984 exit \$failed
e5e20432 3985 else
bd9b35c9
JH
3986 name=\`$expr x\$1 : '..\([^/]*\)'\`
3987 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3988 if $test ! -d "\$dir"; then
3989 me=\`basename \$0\`
3990 echo "\$me: can't locate home directory for: \$name" >&2
3991 exit 1
3992 fi
3993 case "\$1" in
3994 */*)
3995 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3996 ;;
3997 *)
3998 echo \$dir
e5e20432
JH
3999 ;;
4000 esac
4001 fi
b691c02f 4002 ;;
4633a7c4 4003*)
bd9b35c9 4004 echo \$1
2304df62
AD
4005 ;;
4006esac
4633a7c4
LW
4007EOSS
4008chmod +x filexp
4009$eunicefix filexp
2304df62
AD
4010
4011: now set up to get a file name
28757baa 4012cat <<EOS >getfile
4013$startsh
4014EOS
4015cat <<'EOSC' >>getfile
2304df62
AD
4016tilde=''
4017fullpath=''
4018already=''
4019skip=''
4020none_ok=''
4021exp_file=''
a0d0e21e 4022nopath_ok=''
2304df62
AD
4023orig_rp="$rp"
4024orig_dflt="$dflt"
b233458b
JH
4025case "$gfpth" in
4026'') gfpth='.' ;;
4027esac
2304df62
AD
4028
4029case "$fn" in
ecfc5424 4030*\(*)
d604bb53
JH
4031 : getfile will accept an answer from the comma-separated list
4032 : enclosed in parentheses even if it does not meet other criteria.
4033 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
4034 fn=`echo $fn | sed 's/(.*)//'`
4035 ;;
4036esac
4037
4038case "$fn" in
a0d0e21e
LW
4039*:*)
4040 loc_file=`expr $fn : '.*:\(.*\)'`
4041 fn=`expr $fn : '\(.*\):.*'`
4042 ;;
4043esac
4044
4045case "$fn" in
2304df62
AD
4046*~*) tilde=true;;
4047esac
4048case "$fn" in
4049*/*) fullpath=true;;
4050esac
4051case "$fn" in
4052*+*) skip=true;;
4053esac
4054case "$fn" in
4055*n*) none_ok=true;;
4056esac
4057case "$fn" in
4058*e*) exp_file=true;;
4059esac
a0d0e21e
LW
4060case "$fn" in
4061*p*) nopath_ok=true;;
4062esac
2304df62
AD
4063
4064case "$fn" in
4065*f*) type='File';;
4066*d*) type='Directory';;
a0d0e21e 4067*l*) type='Locate';;
2304df62
AD
4068esac
4069
4070what="$type"
4071case "$what" in
4072Locate) what='File';;
4073esac
4074
4075case "$exp_file" in
4076'')
4077 case "$d_portable" in
4078 "$define") ;;
4079 *) exp_file=true;;
4080 esac
4081 ;;
4082esac
4083
4084cd ..
4085while test "$type"; do
4086 redo=''
4087 rp="$orig_rp"
4088 dflt="$orig_dflt"
4089 case "$tilde" in
4090 true) rp="$rp (~name ok)";;
4091 esac
4092 . UU/myread
ecfc5424
AD
4093 if test -f UU/getfile.ok && \
4094 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4095 then
4096 value="$ans"
4097 ansexp="$ans"
4098 break
4099 fi
2304df62
AD
4100 case "$ans" in
4101 none)
4102 value=''
4103 ansexp=''
4104 case "$none_ok" in
4105 true) type='';;
4106 esac
4107 ;;
4108 *)
4109 case "$tilde" in
4110 '') value="$ans"
4111 ansexp="$ans";;
4112 *)
4113 value=`UU/filexp $ans`
4114 case $? in
4115 0)
4116 if test "$ans" != "$value"; then
ecfc5424 4117 echo "(That expands to $value on this system.)"
2304df62
AD
4118 fi
4119 ;;
4120 *) value="$ans";;
4121 esac
4122 ansexp="$value"
4123 case "$exp_file" in
4124 '') value="$ans";;
4125 esac
4126 ;;
4127 esac
4128 case "$fullpath" in
4129 true)
4130 case "$ansexp" in
4131 /*) value="$ansexp" ;;
23da6c43 4132 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4133 *)
4134 redo=true
4135 case "$already" in
4136 true)
4137 echo "I shall only accept a full path name, as in /bin/ls." >&4
4138 echo "Use a ! shell escape if you wish to check pathnames." >&4
4139 ;;
4140 *)
4141 echo "Please give a full path name, starting with slash." >&4
4142 case "$tilde" in
4143 true)
4144 echo "Note that using ~name is ok provided it expands well." >&4
4145 already=true
4146 ;;
4147 esac
4148 esac
4149 ;;
4150 esac
4151 ;;
4152 esac
4153 case "$redo" in
4154 '')
4155 case "$type" in
4156 File)
b233458b
JH
4157 for fp in $gfpth; do
4158 if test "X$fp" = X.; then
4159 pf="$ansexp"
4160 else
4161 pf="$fp/$ansexp"
4162 fi
4163 if test -f "$pf"; then
4164 type=''
4165 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4166 then
4167 echo "($value is not a plain file, but that's ok.)"
4168 type=''
4169 fi
4170 if test X"$type" = X; then
4171 value="$pf"
4172 break
4173 fi
4174 done
2304df62
AD
4175 ;;
4176 Directory)
b233458b
JH
4177 for fp in $gfpth; do
4178 if test "X$fp" = X.; then
f78bfc9c
JH
4179 dir="$ans"
4180 direxp="$ansexp"
b233458b 4181 else
dd858076 4182 dir="$fp/$ansexp"
f78bfc9c 4183 direxp="$fp/$ansexp"
b233458b 4184 fi
f78bfc9c 4185 if test -d "$direxp"; then
b233458b 4186 type=''
f78bfc9c 4187 value="$dir"
b233458b
JH
4188 break
4189 fi
4190 done
2304df62
AD
4191 ;;
4192 Locate)
40000a8c 4193 if test -d "$ansexp"; then
a0d0e21e
LW
4194 echo "(Looking for $loc_file in directory $value.)"
4195 value="$value/$loc_file"
40000a8c 4196 ansexp="$ansexp/$loc_file"
2304df62 4197 fi
40000a8c 4198 if test -f "$ansexp"; then
2304df62
AD
4199 type=''
4200 fi
a0d0e21e
LW
4201 case "$nopath_ok" in
4202 true) case "$value" in
4203 */*) ;;
4204 *) echo "Assuming $value will be in people's path."
4205 type=''
4206 ;;
4207 esac
4208 ;;
4209 esac
2304df62
AD
4210 ;;
4211 esac
4212
4213 case "$skip" in
4214 true) type='';
4215 esac
4216
4217 case "$type" in
4218 '') ;;
4219 *)
4220 if test "$fastread" = yes; then
4221 dflt=y
4222 else
4223 dflt=n
4224 fi
4225 rp="$what $value doesn't exist. Use that name anyway?"
4226 . UU/myread
4227 dflt=''
4228 case "$ans" in
4229 y*) type='';;
4230 *) echo " ";;
4231 esac
4232 ;;
4233 esac
4234 ;;
4235 esac
4236 ;;
4237 esac
4238done
4239cd UU
4240ans="$value"
4241rp="$orig_rp"
4242dflt="$orig_dflt"
ecfc5424 4243rm -f getfile.ok
b233458b 4244test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4245EOSC
4246
bd9b35c9
JH
4247: What should the include directory be ?
4248echo " "
4249$echo $n "Hmm... $c"
4250dflt='/usr/include'
4251incpath=''
4252mips_type=''
4253if $test -f /bin/mips && /bin/mips; then
4254 echo "Looks like a MIPS system..."
4255 $cat >usr.c <<'EOCP'
4256#ifdef SYSTYPE_BSD43
4257/bsd43
4258#endif
4259EOCP
8a27cf78 4260 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4261 dflt='/bsd43/usr/include'
4262 incpath='/bsd43'
4263 mips_type='BSD 4.3'
4264 else
4265 mips_type='System V'
4266 fi
4267 $rm -f usr.c usr.out
4268 echo "and you're compiling with the $mips_type compiler and libraries."
4269 xxx_prompt=y
4270 echo "exit 0" >mips
4271else
4272 echo "Doesn't look like a MIPS system."
4273 xxx_prompt=n
4274 echo "exit 1" >mips
4275fi
4276chmod +x mips
4277$eunicefix mips
4278case "$usrinc" in
4279'') ;;
4280*) dflt="$usrinc";;
4281esac
4282case "$xxx_prompt" in
4283y) fn=d/
4284 echo " "
4285 rp='Where are the include files you want to use?'
4286 . ./getfile
4287 usrinc="$ans"
8e07c86e 4288 ;;
bd9b35c9 4289*) usrinc="$dflt"
8e07c86e
AD
4290 ;;
4291esac
2304df62 4292
96056487
JH
4293: see how we invoke the C preprocessor
4294echo " "
4295echo "Now, how can we feed standard input to your C preprocessor..." >&4
4296cat <<'EOT' >testcpp.c
4297#define ABC abc
4298#define XYZ xyz
4299ABC.XYZ
4300EOT
4301cd ..
4302if test ! -f cppstdin; then
4303 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4304 # AIX cc -E doesn't show the absolute headerfile
4305 # locations but we'll cheat by using the -M flag.
4306 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
4307 else
4308 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4309 fi
4310else
4311 echo "Keeping your $hint cppstdin wrapper."
4312fi
4313chmod 755 cppstdin
4314wrapper=`pwd`/cppstdin
4315ok='false'
4316cd UU
4317
4318if $test "X$cppstdin" != "X" && \
4319 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4320 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4321then
4322 echo "You used to use $cppstdin $cppminus so we'll use that again."
4323 case "$cpprun" in
4324 '') echo "But let's see if we can live without a wrapper..." ;;
4325 *)
4326 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4327 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4328 then
4329 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4330 ok='true'
4331 else
4332 echo "(However, $cpprun $cpplast does not work, let's see...)"
4333 fi
4334 ;;
4335 esac
4336else
4337 case "$cppstdin" in
4338 '') ;;
4339 *)
4340 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4341 ;;
4342 esac
4343fi
4344
4345if $ok; then
4346 : nothing
4347elif echo 'Maybe "'"$cc"' -E" will work...'; \
4348 $cc -E <testcpp.c >testcpp.out 2>&1; \
4349 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350 echo "Yup, it does."
4351 x_cpp="$cc -E"
4352 x_minus='';
4353elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4354 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4355 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4356 echo "Yup, it does."
4357 x_cpp="$cc -E"
4358 x_minus='-';
4359elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4360 $cc -P <testcpp.c >testcpp.out 2>&1; \
4361 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362 echo "Yipee, that works!"
4363 x_cpp="$cc -P"
4364 x_minus='';
4365elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4366 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4367 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4368 echo "At long last!"
4369 x_cpp="$cc -P"
4370 x_minus='-';
4371elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4372 $cpp <testcpp.c >testcpp.out 2>&1; \
4373 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4374 echo "It works!"
4375 x_cpp="$cpp"
4376 x_minus='';
4377elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4378 $cpp - <testcpp.c >testcpp.out 2>&1; \
4379 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4380 echo "Hooray, it works! I was beginning to wonder."
4381 x_cpp="$cpp"
4382 x_minus='-';
4383elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4384 $wrapper <testcpp.c >testcpp.out 2>&1; \
4385 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4386 x_cpp="$wrapper"
4387 x_minus=''
4388 echo "Eureka!"
4389else
4390 dflt=''
4391 rp="No dice. I can't find a C preprocessor. Name one:"
4392 . ./myread
4393 x_cpp="$ans"
4394 x_minus=''
4395 $x_cpp <testcpp.c >testcpp.out 2>&1
4396 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4397 echo "OK, that will do." >&4
4398 else
4399echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4400 exit 1
4401 fi
4402fi
4403
4404case "$ok" in
4405false)
4406 cppstdin="$x_cpp"
4407 cppminus="$x_minus"
4408 cpprun="$x_cpp"
4409 cpplast="$x_minus"
4410 set X $x_cpp
4411 shift
4412 case "$1" in
4413 "$cpp")
4414 echo "Perhaps can we force $cc -E using a wrapper..."
4415 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4416 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4417 then
4418 echo "Yup, we can."
4419 cppstdin="$wrapper"
4420 cppminus='';
4421 else
4422 echo "Nope, we'll have to live without it..."
4423 fi
4424 ;;
4425 esac
4426 case "$cpprun" in
4427 "$wrapper")
4428 cpprun=''
4429 cpplast=''
4430 ;;
4431 esac
4432 ;;
4433esac
4434
4435case "$cppstdin" in
4436"$wrapper"|'cppstdin') ;;
4437*) $rm -f $wrapper;;
4438esac
4439$rm -f testcpp.c testcpp.out
4440
bd9b35c9
JH
4441: Set private lib path
4442case "$plibpth" in
4443'') if ./mips; then
4444 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4445 fi;;
4446esac
4447case "$libpth" in
4448' ') dlist='';;
4449'') dlist="$loclibpth $plibpth $glibpth";;
4450*) dlist="$libpth";;
4451esac
4452
4453: Now check and see which directories actually exist, avoiding duplicates
4454libpth=''
4455for xxx in $dlist
4456do
4457 if $test -d $xxx; then
4458 case " $libpth " in
4459 *" $xxx "*) ;;
4460 *) libpth="$libpth $xxx";;
4461 esac
4462 fi
4463done
4464$cat <<'EOM'
4465
4466Some systems have incompatible or broken versions of libraries. Among
4467the directories listed in the question below, please remove any you
4468know not to be holding relevant libraries, and add any that are needed.
4469Say "none" for none.
8e07c86e
AD
4470
4471EOM
bd9b35c9
JH
4472case "$libpth" in
4473'') dflt='none';;
8e07c86e 4474*)
bd9b35c9
JH
4475 set X $libpth
4476 shift
4477 dflt=${1+"$@"}
8e07c86e 4478 ;;
a0d0e21e 4479esac
bd9b35c9
JH
4480rp="Directories to use for library searches?"
4481. ./myread
4482case "$ans" in
4483none) libpth=' ';;
4484*) libpth="$ans";;
4485esac
a0d0e21e 4486
bd9b35c9
JH
4487: compute shared library extension
4488case "$so" in
4489'')
4490 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4491 dflt='sl'
dd4e71fd 4492 else
bd9b35c9 4493 dflt='so'
dd4e71fd
JH
4494 fi
4495 ;;
bd9b35c9 4496*) dflt="$so";;
dd4e71fd 4497esac
dd4e71fd
JH
4498$cat <<EOM
4499
bd9b35c9 4500On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4501you want to suppress searching of shared libraries for the remainder
bd9b35c9 4502of this configuration.
dd4e71fd
JH
4503
4504EOM
bd9b35c9
JH
4505rp='What is the file extension used for shared libraries?'
4506. ./myread
4507so="$ans"
dd4e71fd 4508
bd9b35c9
JH
4509: Define several unixisms.
4510: Hints files or command line option can be used to override them.
4511: The convoluted testing is in case hints files set either the old
4512: or the new name.
4513case "$_exe" in
4514'') case "$exe_ext" in
1fef16b3 4515 '') ;;
bd9b35c9 4516 *) _exe="$exe_ext" ;;
dd4e71fd 4517 esac
bd9b35c9 4518 ;;
bfb7748a 4519esac
bd9b35c9
JH
4520case "$_a" in
4521'') case "$lib_ext" in
4522 '') _a='.a';;
4523 *) _a="$lib_ext" ;;
dd4e71fd
JH
4524 esac
4525 ;;
dd4e71fd 4526esac
bd9b35c9
JH
4527case "$_o" in
4528'') case "$obj_ext" in
4529 '') _o='.o';;
4530 *) _o="$obj_ext";;
4531 esac
4532 ;;
4533esac
4534case "$p_" in
4535'') case "$path_sep" in
4536 '') p_=':';;
4537 *) p_="$path_sep";;
4538 esac
4539 ;;
4540esac
4541exe_ext=$_exe
4542lib_ext=$_a
4543obj_ext=$_o
4544path_sep=$p_
dd4e71fd 4545
b4eb6b3d
JH
4546: Which makefile gets called first. This is used by make depend.
4547case "$firstmakefile" in
4548'') firstmakefile='makefile';;
4633a7c4 4549esac
4633a7c4 4550
1f603089
JH
4551case "$ccflags" in
4552*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4553esac
4554
4555case "$uselongdouble" in
4556$define|true|[yY]*) dflt='y';;
4557*) dflt='n';;
4558esac
4559cat <<EOM
4560
4561Perl can be built to take advantage of long doubles which
4562(if available) may give more accuracy and range for floating point numbers.
4563
4564If this doesn't make any sense to you, just accept the default '$dflt'.
4565EOM
4566rp='Try to use long doubles if available?'
4567. ./myread
4568case "$ans" in
4569y|Y) val="$define" ;;
4570*) val="$undef" ;;
4571esac
4572set uselongdouble
4573eval $setvar
4574
4575case "$uselongdouble" in
4576true|[yY]*) uselongdouble="$define" ;;
4577esac
4578
1f603089
JH
4579: Look for a hint-file generated 'call-back-unit'. If the
4580: user has specified that long doubles should be used,
4581: we may need to set or change some other defaults.
9da7673b
MB
4582if $test -f uselongdouble.cbu; then
4583 echo "Your platform has some specific hints regarding long doubles, using them..."
4584 . ./uselongdouble.cbu
4585else
4586 case "$uselongdouble" in
4587 $define)
1f603089 4588 $cat <<EOM
9da7673b 4589(Your platform does not have any specific hints for long doubles.)
1f603089 4590EOM
1f603089 4591 ;;
9da7673b
MB
4592 esac
4593fi
1f603089 4594
bd9b35c9
JH
4595: Looking for optional libraries
4596echo " "
4597echo "Checking for optional libraries..." >&4
4598case "$libs" in
4599' '|'') dflt='';;
4600*) dflt="$libs";;
4601esac
4602case "$libswanted" in
4603'') libswanted='c_s';;
4604esac
4605case "$usesocks" in
923fc586 4606"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4607esac
68435ea7
JH
4608libsfound=''
4609libsfiles=''
4610libsdirs=''
13b3f787
JH
4611libspath=''
4612for thisdir in $libpth $xlibpth; do
4613 test -d $thisdir && libspath="$libspath $thisdir"
4614done
bd9b35c9 4615for thislib in $libswanted; do
13b3f787 4616 for thisdir in $libspath; do
f7dd4e7f
JH
4617 xxx=''
4618 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4619 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4620 $test -f "$xxx" && eval $libscheck
4621 $test -f "$xxx" && libstyle=shared
4622 fi
4623 if test ! -f "$xxx"; then
4624 xxx=$thisdir/lib$thislib.$so
4625 $test -f "$xxx" && eval $libscheck
4626 $test -f "$xxx" && libstyle=shared
4627 fi
4628 if test ! -f "$xxx"; then
4629 xxx=$thisdir/lib$thislib$_a
4630 $test -f "$xxx" && eval $libscheck
4631 $test -f "$xxx" && libstyle=static
4632 fi
4633 if test ! -f "$xxx"; then
4634 xxx=$thisdir/$thislib$_a
4635 $test -f "$xxx" && eval $libscheck
4636 $test -f "$xxx" && libstyle=static
4637 fi
4638 if test ! -f "$xxx"; then
4639 xxx=$thisdir/lib${thislib}_s$_a
4640 $test -f "$xxx" && eval $libscheck
4641 $test -f "$xxx" && libstyle=static
09ea5ba9 4642 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4643 fi
4644 if test ! -f "$xxx"; then
4645 xxx=$thisdir/Slib$thislib$_a
4646 $test -f "$xxx" && eval $libscheck
4647 $test -f "$xxx" && libstyle=static
4648 fi
4649 if $test -f "$xxx"; then
43999f95 4650 case "$libstyle" in
f7dd4e7f
JH
4651 shared) echo "Found -l$thislib (shared)." ;;
4652 static) echo "Found -l$thislib." ;;
4653 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4654 esac
bd9b35c9
JH
4655 case " $dflt " in
4656 *"-l$thislib "*);;
f7dd4e7f 4657 *) dflt="$dflt -l$thislib"
43999f95
JH
4658 libsfound="$libsfound $xxx"
4659 yyy=`basename $xxx`
4660 libsfiles="$libsfiles $yyy"
1e127011 4661 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4662 case " $libsdirs " in
4663 *" $yyy "*) ;;
4664 *) libsdirs="$libsdirs $yyy" ;;
4665 esac
4666 ;;
bd9b35c9 4667 esac
f7dd4e7f
JH
4668 break
4669 fi
4670 done
4671 if $test ! -f "$xxx"; then
4672 echo "No -l$thislib."
bd9b35c9
JH
4673 fi
4674done
4675set X $dflt
4676shift
4677dflt="$*"
4678case "$libs" in
4679'') dflt="$dflt";;
4680*) dflt="$libs";;
4681esac
4682case "$dflt" in
4683' '|'') dflt='none';;
4684esac
4633a7c4 4685
bd9b35c9 4686$cat <<EOM
4633a7c4 4687
bd9b35c9
JH
4688In order to compile $package on your machine, a number of libraries
4689are usually needed. Include any other special libraries here as well.
4690Say "none" for none. The default list is almost always right.
8e07c86e 4691EOM
8e07c86e 4692
bd9b35c9
JH
4693echo " "
4694rp="What libraries to use?"
4695. ./myread
4696case "$ans" in
4697none) libs=' ';;
4698*) libs="$ans";;
4699esac
d71b2b6b 4700
bd9b35c9
JH
4701: determine optimization, if desired, or use for debug flag also
4702case "$optimize" in
4703' '|$undef) dflt='none';;
4704'') dflt='-O';;
4705*) dflt="$optimize";;
4706esac
4707$cat <<EOH
d71b2b6b 4708
bd9b35c9
JH
4709By default, $package compiles with the -O flag to use the optimizer.
4710Alternately, you might want to use the symbolic debugger, which uses
4711the -g flag (on traditional Unix systems). Either flag can be
4712specified here. To use neither flag, specify the word "none".
d71b2b6b 4713
bd9b35c9
JH
4714EOH
4715rp="What optimizer/debugger flag should be used?"
4716. ./myread
4717optimize="$ans"
4718case "$optimize" in
4719'none') optimize=" ";;
4720esac
4721
4722dflt=''
4723: We will not override a previous value, but we might want to
4724: augment a hint file
4725case "$hint" in
4726default|recommended)
4727 case "$gccversion" in
4728 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4729 esac
bd9b35c9
JH
4730 case "$optimize" in
4731 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4732 esac
bd9b35c9
JH
4733 case "$gccversion" in
4734 2*) if test -d /etc/conf/kconfig.d &&
4735 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4736 then
00e89ad4 4737 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4738 dflt="$dflt -posix"
4739 fi
f0d04425 4740 ;;
bd9b35c9
JH
4741 esac
4742 case "$gccversion" in
4743 1*) ;;
4744 2.[0-8]*) ;;
4745 ?*) echo " "
4746 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4747 echo 'int main(void) { return 0; }' > gcctest.c
4748 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4749 echo "Yes, it does." 2>&1
4750 case "$ccflags" in
00e89ad4 4751 *strict-aliasing*)
bd9b35c9
JH
4752 echo "Leaving current flags $ccflags alone." 2>&1
4753 ;;
4754 *) dflt="$dflt -fno-strict-aliasing" ;;
4755 esac
4756 else
4757 echo "Nope, it doesn't, but that's ok." 2>&1
4758 fi
f0d04425 4759 ;;
e5e20432 4760 esac
00e89ad4
AD
4761 # For gcc, adding -pipe speeds up compilations for some, but apparently
4762 # some assemblers can't read from stdin. (It also slows down compilations
4763 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4764 case "$gccversion" in
4765 ?*) echo " "
4766 echo "Checking if your compiler accepts -pipe" 2>&1
4767 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4768 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4769 echo "Yes, it does." 2>&1
4770 case "$ccflags" in
4771 *-pipe*)
4772 echo "Leaving current flags $ccflags alone." 2>&1
4773 ;;
4774 *) dflt="$dflt -pipe" ;;
4775 esac
4776 else
4777 echo "Nope, it doesn't, but that's ok." 2>&1
4778 fi
6347b5be
SP
4779
4780 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4781 echo 'int main(void) { return 0; }' > gcctest.c
4782 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4783 echo "Yes, it does." 2>&1
4784 case "$ccflags" in
4785 *-Wdeclaration-after-statement*)
4786 echo "Leaving current flags $ccflags alone." 2>&1
4787 ;;
4788 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4789 esac
4790 else
4791 echo "Nope, it doesn't, but that's ok." 2>&1
4792 fi
00e89ad4
AD
4793 ;;
4794 esac
e5e20432
JH
4795 ;;
4796esac
4797
bd9b35c9
JH
4798case "$mips_type" in
4799*BSD*|'') inclwanted="$locincpth $usrinc";;
4800*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4801esac
4802for thisincl in $inclwanted; do
4803 if $test -d $thisincl; then
4804 if $test x$thisincl != x$usrinc; then
4805 case "$dflt" in
00e89ad4
AD
4806 *" -I$thisincl "*);;
4807 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4808 esac
4809 fi
4810 fi
4811done
40a7a20a 4812
bd9b35c9
JH
4813inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4814 xxx=true;
4815elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4816 xxx=true;
4817else
4818 xxx=false;
4819fi;
4820if $xxx; then
4821 case "$dflt" in
4822 *$2*);;
4823 *) dflt="$dflt -D$2";;
4824 esac;
4825fi'
40a7a20a 4826
bd9b35c9 4827set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4828
bd9b35c9
JH
4829case "$usesocks" in
4830$define)
4831 ccflags="$ccflags -DSOCKS"
4832 ;;
4833esac
40a7a20a 4834
bd9b35c9
JH
4835case "$hint" in
4836default|recommended) dflt="$ccflags $dflt" ;;
4837*) dflt="$ccflags";;
4838esac
40a7a20a 4839
bd9b35c9
JH
4840case "$dflt" in
4841''|' ') dflt=none;;
4842esac
422af00a 4843
bd9b35c9 4844$cat <<EOH
40a7a20a 4845
bd9b35c9
JH
4846Your C compiler may want other flags. For this question you should include
4847-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4848but you should NOT include libraries or ld flags like -lwhatever. If you
4849want $package to honor its debug switch, you should include -DDEBUGGING here.
4850Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4851
bd9b35c9 4852To use no flags, specify the word "none".
40a7a20a 4853
bd9b35c9
JH
4854EOH
4855set X $dflt
4856shift
4857dflt=${1+"$@"}
4858rp="Any additional cc flags?"
4859. ./myread
4860case "$ans" in
4861none) ccflags='';;
4862*) ccflags="$ans";;
4863esac
8e07c86e 4864
bd9b35c9 4865: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4866case "$cppflags" in
4867'') cppflags="$ccflags" ;;
4868*) cppflags="$cppflags $ccflags" ;;
4869esac
bd9b35c9
JH
4870case "$gccversion" in
48711*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4872esac
bd9b35c9
JH
4873case "$mips_type" in
4874'');;
4875*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4876esac
4877case "$cppflags" in
4878'');;
4879*)
4880 echo " "
4881 echo "Let me guess what the preprocessor flags are..." >&4
4882 set X $cppflags
4883 shift
4884 cppflags=''
4885 $cat >cpp.c <<'EOM'
4886#define BLURFL foo
8e07c86e 4887
bd9b35c9
JH
4888BLURFL xx LFRULB
4889EOM
4890 previous=''
4891 for flag in $*
4892 do
4893 case "$flag" in
4894 -*) ftry="$flag";;
4895 *) ftry="$previous $flag";;
4896 esac
4897 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4898 >cpp1.out 2>/dev/null && \
4899 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4900 >cpp2.out 2>/dev/null && \
4901 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4902 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4903 then
4904 cppflags="$cppflags $ftry"
4905 previous=''
4906 else
4907 previous="$flag"
4908 fi
4909 done
4910 set X $cppflags
4911 shift
4912 cppflags=${1+"$@"}
4913 case "$cppflags" in
4914 *-*) echo "They appear to be: $cppflags";;
4915 esac
4916 $rm -f cpp.c cpp?.out
2afac517 4917 ;;
4918esac
8e07c86e 4919
bd9b35c9
JH
4920: flags used in final linking phase
4921case "$ldflags" in
4922'') if ./venix; then
4923 dflt='-i -z'
10a23457 4924 else
bd9b35c9 4925 dflt=''
10a23457 4926 fi
bd9b35c9
JH
4927 case "$ccflags" in
4928 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4929 esac
bd9b35c9
JH
4930 ;;
4931*) dflt="$ldflags";;
4932esac
4933
4934: Try to guess additional flags to pick up local libraries.
4935for thislibdir in $libpth; do
4936 case " $loclibpth " in
4937 *" $thislibdir "*)
00e89ad4 4938 case "$dflt " in
bd9b35c9
JH
4939 *"-L$thislibdir "*) ;;
4940 *) dflt="$dflt -L$thislibdir" ;;
4941 esac
c4f23d77
AD
4942 ;;
4943 esac
bd9b35c9 4944done
c4f23d77 4945
bd9b35c9
JH
4946case "$dflt" in
4947'') dflt='none' ;;
4948esac
c4f23d77 4949
bd9b35c9
JH
4950$cat <<EOH
4951
4952Your C linker may need flags. For this question you should
4953include -L/whatever and any other flags used by the C linker, but you
4954should NOT include libraries like -lwhatever.
4955
4956Make sure you include the appropriate -L/path flags if your C linker
4957does not normally search all of the directories you specified above,
4958namely
4959 $libpth
4960To use no flags, specify the word "none".
4961
4962EOH
4963
4964rp="Any additional ld flags (NOT including libraries)?"
4965. ./myread
4966case "$ans" in
4967none) ldflags='';;
4968*) ldflags="$ans";;
4969esac
4970rmlist="$rmlist pdp11"
4971
4972: coherency check
4973echo " "
4974echo "Checking your choice of C compiler and flags for coherency..." >&4
4975$cat > try.c <<'EOF'
4976#include <stdio.h>
55954f19 4977int main() { printf("Ok\n"); return(0); }
bd9b35c9 4978EOF
7a282f6d 4979set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4980shift
4981$cat >try.msg <<'EOM'
4982I've tried to compile and run the following simple program:
4983
4984EOM
4985$cat try.c >> try.msg
4986
4987$cat >> try.msg <<EOM
4988
4989I used the command:
4990
4991 $*
5440bc8e 4992 $run ./try
bd9b35c9
JH
4993
4994and I got the following output:
4995
4996EOM
4997dflt=y
73614538 4998if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4999 if $sh -c "$run ./try" >>try.msg 2>&1; then
5000 xxx=`$run ./try`
bd9b35c9
JH
5001 case "$xxx" in
5002 "Ok") dflt=n ;;
5003 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5004 case " $libs " in
5005 *" -lsfio "*)
5006 cat >> try.msg <<'EOQS'
5007If $libs contains -lsfio, and sfio is mis-configured, then it
5008sometimes (apparently) runs and exits with a 0 status, but with no
5009output! It may have to do with sfio's use of _exit vs. exit.
5010
5011EOQS
5012 rp="You have a big problem. Shall I abort Configure"
5013 dflt=y
5014 ;;
5015 esac
5016 ;;
5017 esac
5018 else
5019 echo "The program compiled OK, but exited with status $?." >>try.msg
5020 rp="You have a problem. Shall I abort Configure"
5021 dflt=y
5022 fi
5023else
5024 echo "I can't compile the test program." >>try.msg
5025 rp="You have a BIG problem. Shall I abort Configure"
5026 dflt=y
5027fi
5028case "$dflt" in
5029y)
5030 $cat try.msg >&4
5031 case "$knowitall" in
5032 '')
5033 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5034 ;;
bd9b35c9 5035 *) dflt=n;;
c4f23d77 5036 esac
bd9b35c9
JH
5037 echo " "
5038 . ./myread
5039 case "$ans" in
5040 n*|N*) ;;
5041 *) echo "Ok. Stopping Configure." >&4
5042 exit 1
c4f23d77
AD
5043 ;;
5044 esac
5045 ;;
bd9b35c9 5046n) echo "OK, that should do.";;
c4f23d77 5047esac
bd9b35c9 5048$rm -f try try.* core
c4f23d77 5049
bd9b35c9
JH
5050: define a shorthand compile call
5051compile='
5052mc_file=$1;
5053shift;
08413ebc 5054$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5055: define a shorthand compile call for compilations that should be ok.
5056compile_ok='
5057mc_file=$1;
5058shift;
7a282f6d 5059$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5060
8dfa8df9
JH
5061: determine filename position in cpp output
5062echo " "
5063echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5064case "$osname" in
5065vos) testaccess=-e ;;
5066*) testaccess=-r ;;
5067esac
8dfa8df9
JH
5068echo '#include <stdio.h>' > foo.c
5069$cat >fieldn <<EOF
5070$startsh
5071$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5072$grep '^[ ]*#.*stdio\.h' | \
5073while read cline; do
5074 pos=1
5075 set \$cline
5076 while $test \$# -gt 0; do
a5a94ea5 5077 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5078 echo "\$pos"
5079 exit 0
5080 fi
5081 shift
5082 pos=\`expr \$pos + 1\`
5083 done
5084done
5085EOF
5086chmod +x fieldn
5087fieldn=`./fieldn`
5088$rm -f foo.c fieldn
5089case $fieldn in
5090'') pos='???';;
50911) pos=first;;
50922) pos=second;;
50933) pos=third;;
5094*) pos="${fieldn}th";;
5095esac
5096echo "Your cpp writes the filename in the $pos field of the line."
5097
3c728e00
JH
5098case "$osname" in
5099vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5100os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5101*) cppfilter='' ;;
5102esac
8dfa8df9
JH
5103: locate header file
5104$cat >findhdr <<EOF
5105$startsh
5106wanted=\$1
5107name=''
5108for usrincdir in $usrinc
5109do
5110 if test -f \$usrincdir/\$wanted; then
5111 echo "\$usrincdir/\$wanted"
5112 exit 0
5113 fi
5114done
5115awkprg='{ print \$$fieldn }'
5116echo "#include <\$wanted>" > foo\$\$.c
5117$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5118$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5119while read cline; do
5120 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5121 case "\$name" in
5122 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5123 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5124 *) exit 2;;
5125 esac;
5126done;
5127#
5128# status = 0: grep returned 0 lines, case statement not executed
5129# status = 1: headerfile found
5130# status = 2: while loop executed, no headerfile found
5131#
5132status=\$?
5133$rm -f foo\$\$.c;
5134if test \$status -eq 1; then
5135 exit 0;
5136fi
5137exit 1
5138EOF
5139chmod +x findhdr
5140
5141: define an alternate in-header-list? function
5142inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5143cont=true; xxf="echo \"<\$1> found.\" >&4";
5144case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5145*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5146esac;
5147case $# in 4) instead=instead;; *) instead="at last";; esac;
5148while $test "$cont"; do
5149 xxx=`./findhdr $1`
5150 var=$2; eval "was=\$$2";
5151 if $test "$xxx" && $test -r "$xxx";
5152 then eval $xxf;
5153 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5154 cont="";
5155 else eval $xxnf;
5156 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5157 set $yyy; shift; shift; yyy=$@;
5158 case $# in 0) cont="";;
5159 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5160 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5161 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5162 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5163 esac;
5164done;
5165while $test "$yyy";
5166do set $yyy; var=$2; eval "was=\$$2";
5167 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5168 set $yyy; shift; shift; yyy=$@;
5169done'
5170
d1daaddf
JH
5171: see if stdlib is available
5172set stdlib.h i_stdlib
5173eval $inhdr
5174
5175: check for lengths of integral types
5176echo " "
5177case "$intsize" in
5178'')
5179 echo "Checking to see how big your integers are..." >&4
c63dfae1 5180 $cat >try.c <<EOCP
d1daaddf
JH
5181#include <stdio.h>
5182#$i_stdlib I_STDLIB
5183#ifdef I_STDLIB
5184#include <stdlib.h>
5185#endif
5186int main()
5187{
5188 printf("intsize=%d;\n", (int)sizeof(int));
5189 printf("longsize=%d;\n", (int)sizeof(long));
5190 printf("shortsize=%d;\n", (int)sizeof(short));
5191 exit(0);
5192}
5193EOCP
5194 set try
5195 if eval $compile_ok && $run ./try > /dev/null; then
5196 eval `$run ./try`
5197 echo "Your integers are $intsize bytes long."
5198 echo "Your long integers are $longsize bytes long."
5199 echo "Your short integers are $shortsize bytes long."
5200 else
5201 $cat >&4 <<EOM
5202!
5203Help! I can't compile and run the intsize test program: please enlighten me!
5204(This is probably a misconfiguration in your system or libraries, and
5205you really ought to fix it. Still, I'll try anyway.)
5206!
5207EOM
5208 dflt=4
5209 rp="What is the size of an integer (in bytes)?"
5210 . ./myread
5211 intsize="$ans"
5212 dflt=$intsize
5213 rp="What is the size of a long integer (in bytes)?"
5214 . ./myread
5215 longsize="$ans"
5216 dflt=2
5217 rp="What is the size of a short integer (in bytes)?"
5218 . ./myread
5219 shortsize="$ans"
5220 fi
5221 ;;
5222esac
5223$rm -f try try.*
5224
5225: check for long long
5226echo " "
5227echo "Checking to see if you have long long..." >&4
5228echo 'int main() { long long x = 7; return 0; }' > try.c
5229set try
5230if eval $compile; then
5231 val="$define"
5232 echo "You have long long."
5233else
5234 val="$undef"
5235 echo "You do not have long long."
5236fi
5237$rm try.*
5238set d_longlong
5239eval $setvar
5240
5241: check for length of long long
5242case "${d_longlong}${longlongsize}" in
5243$define)
5244 echo " "
5245 echo "Checking to see how big your long longs are..." >&4
5246 $cat >try.c <<'EOCP'
5247#include <stdio.h>
5248int main()
5249{
5250 printf("%d\n", (int)sizeof(long long));
5251 return(0);
5252}
5253EOCP
5254 set try
5255 if eval $compile_ok; then
5256 longlongsize=`$run ./try`
5257 echo "Your long longs are $longlongsize bytes long."
5258 else
5259 dflt='8'
5260 echo " "
5261 echo "(I can't seem to compile the test program. Guessing...)"
5262 rp="What is the size of a long long (in bytes)?"
5263 . ./myread
5264 longlongsize="$ans"
5265 fi
5266 if $test "X$longsize" = "X$longlongsize"; then
5267 echo "(That isn't any different from an ordinary long.)"
5268 fi
5269 ;;
5270esac
5271$rm -f try.* try
5272
8dfa8df9
JH
5273: see if inttypes.h is available
5274: we want a real compile instead of Inhdr because some systems
5275: have an inttypes.h which includes non-existent headers
5276echo " "
5277$cat >try.c <<EOCP
5278#include <inttypes.h>
5279int main() {
5280 static int32_t foo32 = 0x12345678;
5281}
5282EOCP
5283set try
5284if eval $compile; then
5285 echo "<inttypes.h> found." >&4
5286 val="$define"
5287else
5288 echo "<inttypes.h> NOT found." >&4
5289 val="$undef"
5290fi
5291$rm -f try.c try
5292set i_inttypes
5293eval $setvar
5294
5295: check for int64_t
5296echo " "
5297echo "Checking to see if you have int64_t..." >&4
5298$cat >try.c <<EOCP
5299#include <sys/types.h>
5300#$i_inttypes I_INTTYPES
5301#ifdef I_INTTYPES
5302#include <inttypes.h>
5303#endif
5304int main() { int64_t x = 7; }
5305EOCP
5306set try
5307if eval $compile; then
5308 val="$define"
5309 echo "You have int64_t."
5310else
5311 val="$undef"
5312 echo "You do not have int64_t."
5313fi
5314$rm -f try try.*
5315set d_int64_t
5316eval $setvar
5317
5318
5319echo " "
5320echo "Checking which 64-bit integer type we could use..." >&4
5321
5322case "$intsize" in
53238) val=int
5324 set quadtype
5325 eval $setvar
5326 val='"unsigned int"'
5327 set uquadtype
5328 eval $setvar
5329 quadkind=1
5330 ;;
5331*) case "$longsize" in
5332 8) val=long
5333 set quadtype
5334 eval $setvar
5335 val='"unsigned long"'
5336 set uquadtype
5337 eval $setvar
5338 quadkind=2
5339 ;;
5340 *) case "$d_longlong:$longlongsize" in
5341 define:8)
5342 val='"long long"'
5343 set quadtype
5344 eval $setvar
5345 val='"unsigned long long"'
5346 set uquadtype
5347 eval $setvar
5348 quadkind=3
5349 ;;
5350 *) case "$d_int64_t" in
5351 define)
5352 val=int64_t
5353 set quadtype
5354 eval $setvar
5355 val=uint64_t
5356 set uquadtype
5357 eval $setvar
5358 quadkind=4
5359 ;;
5360 esac
5361 ;;
5362 esac
5363 ;;
5364 esac
5365 ;;
5366esac
5367
5368case "$quadtype" in
5369'') echo "Alas, no 64-bit integer types in sight." >&4
5370 d_quad="$undef"
5371 ;;
5372*) echo "We could use '$quadtype' for 64-bit integers." >&4
5373 d_quad="$define"
5374 ;;
5375esac
5376
b4eb6b3d
JH
5377
5378case "$uselonglong" in
5379"$define"|true|[yY]*)
5380 cat <<EOM >&4
5381
5382*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5383EOM
5384 use64bitint="$define"
5385 ;;
5386esac
5387case "$use64bits" in
5388"$define"|true|[yY]*)
5389 cat <<EOM >&4
5390
5391*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5392EOM
5393 use64bitint="$define"
5394 ;;
5395esac
5396case "$use64bitints" in
5397"$define"|true|[yY]*)
5398 cat <<EOM >&4
5399
5400*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5401EOM
5402 use64bitint="$define"
5403 ;;
5404esac
5405case "$use64bitsint" in
5406"$define"|true|[yY]*)
5407 cat <<EOM >&4
5408
5409*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5410EOM
5411 use64bitint="$define"
5412 ;;
5413esac
5414case "$uselonglongs" in
5415"$define"|true|[yY]*)
5416 cat <<EOM >&4
5417
5418*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5419EOM
5420 use64bitint="$define"
5421 ;;
5422esac
5423case "$use64bitsall" in
5424"$define"|true|[yY]*)
5425 cat <<EOM >&4
5426
5427*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5428EOM
5429 use64bitall="$define"
5430 ;;
5431esac
5432
5433case "$ccflags" in
5434*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5435esac
5436case "$use64bitall" in
5437"$define"|true|[yY]*) use64bitint="$define" ;;
5438esac
5439
5440case "$longsize" in
54418) cat <<EOM
5442
5443You have natively 64-bit long integers.
5444EOM
5445 val="$define"
5446 ;;
5447*) case "$use64bitint" in
5448 "$define"|true|[yY]*) dflt='y';;
5449 *) dflt='n';;
5450 esac
8dfa8df9
JH
5451 case "$d_quad" in
5452 "$define") ;;
5453 *) dflt='n' ;;
5454 esac
b4eb6b3d
JH
5455 cat <<EOM
5456
5457Perl can be built to take advantage of 64-bit integer types
5458on some systems. To do so, Configure can be run with -Duse64bitint.
5459Choosing this option will most probably introduce binary incompatibilities.
5460
5461If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5462(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5463EOM
5464 rp='Try to use 64-bit integers, if available?'
5465 . ./myread
5466 case "$ans" in
5467 [yY]*) val="$define" ;;
5468 *) val="$undef" ;;
5469 esac
5470 ;;
5471esac
5472set use64bitint
5473eval $setvar
5474
5475case "$use64bitall" in
5476"$define"|true|[yY]*) dflt='y' ;;
5477*) case "$longsize" in
5478 8) dflt='y' ;;
5479 *) dflt='n' ;;
5480 esac
5481 ;;
5482esac
5483cat <<EOM
5484
5485You may also choose to try maximal 64-bitness. It means using as much
548664-bitness as possible on the platform. This in turn means even more
5487binary incompatibilities. On the other hand, your platform may not
5488have any more 64-bitness available than what you already have chosen.
5489
5490If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5491(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5492EOM
5493rp='Try to use maximal 64-bit support, if available?'
5494. ./myread
5495case "$ans" in
5496[yY]*) val="$define" ;;
5497*) val="$undef" ;;
5498esac
5499set use64bitall
5500eval $setvar
5501case "$use64bitall" in
5502"$define")
5503 case "$use64bitint" in
5504 "$undef")
5505 cat <<EOM
5506
5507Since you have chosen a maximally 64-bit build, I'm also turning on
5508the use of 64-bit integers.
5509EOM
5510 use64bitint="$define" ;;
5511 esac
5512 ;;
5513esac
5514
b4eb6b3d
JH
5515: Look for a hint-file generated 'call-back-unit'. If the
5516: user has specified that a 64-bit perl is to be built,
5517: we may need to set or change some other defaults.
19a100ff 5518if $test -f use64bitint.cbu; then
9da7673b 5519 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5520 . ./use64bitint.cbu
5521fi
9da7673b
MB
5522case "$use64bitint" in
5523"$define"|true|[yY]*)
b4eb6b3d
JH
5524 case "$longsize" in
5525 4) case "$archname64" in
5526 '') archname64=64int ;;
5527 esac
5528 ;;
5529 esac
5530 ;;
5531esac
5532
b4eb6b3d
JH
5533: Look for a hint-file generated 'call-back-unit'. If the
5534: user has specified that a maximally 64-bit perl is to be built,
5535: we may need to set or change some other defaults.
19a100ff 5536if $test -f use64bitall.cbu; then
9da7673b 5537 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5538 . ./use64bitall.cbu
5539fi
9da7673b
MB
5540case "$use64bitall" in
5541"$define"|true|[yY]*)
b4eb6b3d
JH
5542 case "$longsize" in
5543 4) case "$archname64" in
5544 ''|64int) archname64=64all ;;
5545 esac
5546 ;;
5547 esac
5548 ;;
5549esac
5550
1911a026
JH
5551case "$d_quad:$use64bitint" in
5552$undef:$define)
5553 cat >&4 <<EOF
5554
5555*** You have chosen to use 64-bit integers,
19a100ff 5556*** but none can be found.
09b58c7b 5557*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5558*** Cannot continue, aborting.
5559
5560EOF
5561 exit 1
5562 ;;
5563esac
5564
36adc09b
JH
5565: check for length of double
5566echo " "
5567case "$doublesize" in
5568'')
5569 echo "Checking to see how big your double precision numbers are..." >&4
5570 $cat >try.c <<EOCP
5571#include <stdio.h>
1911a026
JH
5572#$i_stdlib I_STDLIB
5573#ifdef I_STDLIB
5574#include <stdlib.h>
5575#endif
36adc09b
JH
5576int main()
5577{
5578 printf("%d\n", (int)sizeof(double));
1911a026 5579 exit(0);
36adc09b
JH
5580}
5581EOCP
5582 set try
5583 if eval $compile_ok; then
5584 doublesize=`$run ./try`
5585 echo "Your double is $doublesize bytes long."
5586 else
5587 dflt='8'
5588 echo "(I can't seem to compile the test program. Guessing...)"
5589 rp="What is the size of a double precision number (in bytes)?"
5590 . ./myread
5591 doublesize="$ans"
5592 fi
5593 ;;
5594esac
5595$rm -f try.c try
5596
5597: check for long doubles
5598echo " "
5599echo "Checking to see if you have long double..." >&4
5600echo 'int main() { long double x = 7.0; }' > try.c
5601set try
5602if eval $compile; then
5603 val="$define"
5604 echo "You have long double."
5605else
5606 val="$undef"
5607 echo "You do not have long double."
5608fi
5609$rm try.*
5610set d_longdbl
5611eval $setvar
5612
5613: check for length of long double
5614case "${d_longdbl}${longdblsize}" in
5615$define)
5616 echo " "
5617 echo "Checking to see how big your long doubles are..." >&4
5618 $cat >try.c <<'EOCP'
5619#include <stdio.h>
5620int main()
5621{
5622 printf("%d\n", sizeof(long double));
5623}
5624EOCP
5625 set try
5626 set try
5627 if eval $compile; then
5628 longdblsize=`$run ./try`
5629 echo "Your long doubles are $longdblsize bytes long."
5630 else
5631 dflt='8'
5632 echo " "
5633 echo "(I can't seem to compile the test program. Guessing...)" >&4
5634 rp="What is the size of a long double (in bytes)?"
5635 . ./myread
5636 longdblsize="$ans"
5637 fi
5638 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5639 echo "That isn't any different from an ordinary double."
5640 echo "I'll keep your setting anyway, but you may see some"
5641 echo "harmless compilation warnings."
36adc09b
JH
5642 fi
5643 ;;
5644esac
5645$rm -f try.* try
5646
89ce900e 5647: determine the architecture name
b4eb6b3d 5648echo " "
89ce900e
JH
5649if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5650 tarch=`arch`"-$osname"
5651elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5652 if uname -m > tmparch 2>&1 ; then
5653 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5654 -e 's/$/'"-$osname/" tmparch`
5655 else
5656 tarch="$osname"
5657 fi
5658 $rm -f tmparch
b4eb6b3d 5659else
89ce900e 5660 tarch="$osname"
b4eb6b3d 5661fi
89ce900e
JH
5662case "$myarchname" in
5663''|"$tarch") ;;
5664*)
5665 echo "(Your architecture name used to be $myarchname.)"
5666 archname=''
5667 ;;
5668esac
5669case "$targetarch" in
5670'') ;;
5671*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5672esac
5673myarchname="$tarch"
5674case "$archname" in
5675'') dflt="$tarch";;
5676*) dflt="$archname";;
5677esac
5678rp='What is your architecture name'
5679. ./myread
5680archname="$ans"
5681case "$usethreads" in
5682$define)
5683 echo "Threads selected." >&4
5684 case "$archname" in
5685 *-thread*) echo "...and architecture name already has -thread." >&4
5686 ;;
5687 *) archname="$archname-thread"
5688 echo "...setting architecture name to $archname." >&4
5689 ;;
5690 esac
5691 ;;
5692esac
5693case "$usemultiplicity" in
5694$define)
5695 echo "Multiplicity selected." >&4
5696 case "$archname" in
5697 *-multi*) echo "...and architecture name already has -multi." >&4
5698 ;;
5699 *) archname="$archname-multi"
5700 echo "...setting architecture name to $archname." >&4
5701 ;;
5702 esac
5703 ;;
5704esac
5705case "$use64bitint$use64bitall" in
5706*"$define"*)
5707 case "$archname64" in
5708 '')
5709 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5710 ;;
89ce900e
JH
5711 *)
5712 case "$use64bitint" in
5713 "$define") echo "64 bit integers selected." >&4 ;;
5714 esac
5715 case "$use64bitall" in
5716 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5717 esac
5718 case "$archname" in
5719 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5720 ;;
5721 *) archname="$archname-$archname64"
5722 echo "...setting architecture name to $archname." >&4
5723 ;;
5724 esac
c1a7f87b
JH
5725 ;;
5726 esac
89ce900e
JH
5727esac
5728case "$uselongdouble" in
5729$define)
5730 echo "Long doubles selected." >&4
5731 case "$longdblsize" in
5732 $doublesize)
5733 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5734 ;;
5735 *)
5736 case "$archname" in
5737 *-ld*) echo "...and architecture name already has -ld." >&4
5738 ;;
5739 *) archname="$archname-ld"
5740 echo "...setting architecture name to $archname." >&4
5741 ;;
5742 esac
bd9b35c9
JH
5743 ;;
5744 esac
bd9b35c9 5745 ;;
89ce900e
JH
5746esac
5747case "$useperlio" in
5748$define)
5749 echo "Perlio selected." >&4
5750 ;;
bd9b35c9 5751*)
89ce900e
JH
5752 echo "Perlio not selected, using stdio." >&4
5753 case "$archname" in
5754 *-stdio*) echo "...and architecture name already has -stdio." >&4
5755 ;;
5756 *) archname="$archname-stdio"
5757 echo "...setting architecture name to $archname." >&4
5758 ;;
5759 esac
bd9b35c9
JH
5760 ;;
5761esac
d2e0c6f7
JH
5762if $test -f archname.cbu; then
5763 echo "Your platform has some specific hints for architecture name, using them..."
5764 . ./archname.cbu
5765fi
bd9b35c9 5766
89ce900e
JH
5767: determine root of directory hierarchy where package will be installed.
5768case "$prefix" in
5769'')
5770 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5771 ;;
5772*?/)
5773 dflt=`echo "$prefix" | sed 's/.$//'`
5774 ;;
5775*)
5776 dflt="$prefix"
5777 ;;
5778esac
5779$cat <<EOM
c1a7f87b 5780
89ce900e
JH
5781By default, $package will be installed in $dflt/bin, manual pages
5782under $dflt/man, etc..., i.e. with $dflt as prefix for all
5783installation directories. Typically this is something like /usr/local.
5784If you wish to have binaries under /usr/bin but other parts of the
5785installation under /usr/local, that's ok: you will be prompted
5786separately for each of the installation directories, the prefix being
5787only used to set the defaults.
bd9b35c9
JH
5788
5789EOM
89ce900e
JH
5790fn=d~
5791rp='Installation prefix to use?'
5792. ./getfile
5793oldprefix=''
5794case "$prefix" in
5795'') ;;
5796*)
5797 case "$ans" in
5798 "$prefix") ;;
5799 *) oldprefix="$prefix";;
5800 esac
5801 ;;
bd9b35c9 5802esac
89ce900e
JH
5803prefix="$ans"
5804prefixexp="$ansexp"
bd9b35c9 5805
89ce900e
JH
5806case "$afsroot" in
5807'') afsroot=/afs ;;
5808*) afsroot=$afsroot ;;
8e07c86e 5809esac
29209bc5 5810
89ce900e
JH
5811: is AFS running?
5812echo " "
5813case "$afs" in
5814$define|true) afs=true ;;
5815$undef|false) afs=false ;;
5816*) if test -d $afsroot; then
5817 afs=true
c1a7f87b 5818 else
89ce900e
JH
5819 afs=false
5820 fi
5821 ;;
c1a7f87b 5822esac
89ce900e
JH
5823if $afs; then
5824 echo "AFS may be running... I'll be extra cautious then..." >&4
5825else
5826 echo "AFS does not seem to be running..." >&4
5827fi
b4eb6b3d
JH
5828
5829: determine installation prefix for where package is to be installed.
5830if $afs; then
5831$cat <<EOM
5832
5833Since you are running AFS, I need to distinguish the directory in which
5834files will reside from the directory in which they are installed (and from
5835which they are presumably copied to the former directory by occult means).
5836
5837EOM
5838 case "$installprefix" in
5839 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5840 *) dflt="$installprefix";;
5841 esac
5842else
5843$cat <<EOM
5844
5845In some special cases, particularly when building $package for distribution,
c2bfb7b1
MB
5846it is convenient to distinguish the directory in which files should be
5847installed from the directory ($prefix) in which they will
5848eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
5849
5850EOM
5851 case "$installprefix" in
5852 '') dflt=$prefix ;;
5853 *) dflt=$installprefix;;
5854 esac
5855fi
5856fn=d~
5857rp='What installation prefix should I use for installing files?'
5858. ./getfile
5859installprefix="$ans"
5860installprefixexp="$ansexp"
5861
5862: set the prefixit variable, to compute a suitable default value
5863prefixit='case "$3" in
5864""|none)
5865 case "$oldprefix" in
5866 "") eval "$1=\"\$$2\"";;
5867 *)
5868 case "$3" in
5869 "") eval "$1=";;
5870 none)
5871 eval "tp=\"\$$2\"";
5872 case "$tp" in
5873 ""|" ") eval "$1=\"\$$2\"";;
5874 *) eval "$1=";;
5875 esac;;
5876 esac;;
5877 esac;;
5878*)
5879 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5880 case "$tp" in
5881 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5882 /*-$oldprefix/*|\~*-$oldprefix/*)
5883 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5884 *) eval "$1=\"\$$2\"";;
5885 esac;;
5886esac'
5887
b4eb6b3d
JH
5888: get the patchlevel
5889echo " "
5890echo "Getting the current patchlevel..." >&4
5891if $test -r $rsrc/patchlevel.h;then
5892 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5893 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5894 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5895 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5896 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5897 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
d13b798d 5898 perl_patchlevel=`grep 'define PERL_PATCHNUM [0-9][0-9]*' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5899else
5900 revision=0
5901 patchlevel=0
5902 subversion=0
5903 api_revision=0
5904 api_version=0
5905 api_subversion=0
151e6568
MB
5906 perl_patchlevel=0
5907 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5908fi
151e6568
MB
5909if $test -r $rsrc/.patch ; then
5910 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5911 perl_patchlevel=`cat $rsrc/.patch`
5912 fi
5913fi
861eb78d
AD
5914: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5915version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5916case "$perl_patchlevel" in
861eb78d
AD
59170|'') ;;
5918*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 5919esac
861eb78d
AD
5920
5921$echo "(You have $package $version_patchlevel_string.)"
5922
b4eb6b3d
JH
5923case "$osname" in
5924dos|vms)
5925 : XXX Should be a Configure test for double-dots in filenames.
5926 version=`echo $revision $patchlevel $subversion | \
5927 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5928 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5929 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5930 ;;
5931*)
5932 version=`echo $revision $patchlevel $subversion | \
5933 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5934 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5935 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5936 ;;
5937esac
5938: Special case the 5.005_xx maintenance series, which used 5.005
5939: without any subversion label as a subdirectory in $sitelib
5940if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5941 api_versionstring='5.005'
5942fi
5943
5944: determine installation style
5945: For now, try to deduce it from prefix unless it is already set.
5946: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5947case "$installstyle" in
5948'') case "$prefix" in
5949 *perl*) dflt='lib';;
5950 *) dflt='lib/perl5' ;;
5951 esac
5952 ;;
5953*) dflt="$installstyle" ;;
5954esac
5955: Probably not worth prompting for this since we prompt for all
5956: the directories individually, and the prompt would be too long and
5957: confusing anyway.
5958installstyle=$dflt
5959
5960: determine where private library files go
5961: Usual default is /usr/local/lib/perl5/$version.
5962: Also allow things like /opt/perl/lib/$version, since
5963: /opt/perl/lib/perl5... would be redundant.
5964: The default "style" setting is made in installstyle.U
5965case "$installstyle" in
5966*lib/perl5*) set dflt privlib lib/$package/$version ;;
5967*) set dflt privlib lib/$version ;;
5968esac
5969eval $prefixit
5970$cat <<EOM
5971
5972There are some auxiliary files for $package that need to be put into a
5973private library directory that is accessible by everyone.
5974
5975EOM
5976fn=d~+
5977rp='Pathname where the private library files will reside?'
5978. ./getfile
5979privlib="$ans"
5980privlibexp="$ansexp"
5981: Change installation prefix, if necessary.
5982if $test X"$prefix" != X"$installprefix"; then
5983 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5984else
5985 installprivlib="$privlibexp"
5986fi
5987
5988: set the prefixup variable, to restore leading tilda escape
5989prefixup='case "$prefixexp" in
5990"$prefix") ;;
5991*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5992esac'
5993
5994: determine where public architecture dependent libraries go
5995set archlib archlib
5996eval $prefixit
5997: privlib default is /usr/local/lib/$package/$version
5998: archlib default is /usr/local/lib/$package/$version/$archname
5999: privlib may have an optional trailing /share.
6000tdflt=`echo $privlib | $sed 's,/share$,,'`
6001tdflt=$tdflt/$archname
6002case "$archlib" in
6003'') dflt=$tdflt
6004 ;;
6005*) dflt="$archlib"
6006 ;;
6007esac
6008$cat <<EOM
6009
6010$spackage contains architecture-dependent library files. If you are
6011sharing libraries in a heterogeneous environment, you might store
6012these files in a separate location. Otherwise, you can just include
6013them with the rest of the public library files.
6014
6015EOM
6016fn=d+~
6017rp='Where do you want to put the public architecture-dependent libraries?'
6018. ./getfile
6019archlib="$ans"
6020archlibexp="$ansexp"
6021if $test X"$archlib" = X"$privlib"; then
6022 d_archlib="$undef"
6023else
6024 d_archlib="$define"
6025fi
6026: Change installation prefix, if necessary.
6027if $test X"$prefix" != X"$installprefix"; then
6028 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6029else
6030 installarchlib="$archlibexp"
6031fi
6032
b4eb6b3d
JH
6033: see if setuid scripts can be secure
6034$cat <<EOM
6035
6036Some kernels have a bug that prevents setuid #! scripts from being
6037secure. Some sites have disabled setuid #! scripts because of this.
6038
6039First let's decide if your kernel supports secure setuid #! scripts.
6040(If setuid #! scripts would be secure but have been disabled anyway,
6041don't say that they are secure if asked.)
6042
6043EOM
6044
6045val="$undef"
6046if $test -d /dev/fd; then
6047 echo "#!$ls" >reflect
6048 chmod +x,u+s reflect
6049 ./reflect >flect 2>&1
6050 if $contains "/dev/fd" flect >/dev/null; then
6051 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6052 val="$define"
6053 else
6054 $cat <<EOM
6055If you are not sure if they are secure, I can check but I'll need a
6056username and password different from the one you are using right now.
6057If you don't have such a username or don't want me to test, simply
6058enter 'none'.
6059
6060EOM
6061 rp='Other username to test security of setuid scripts with?'
6062 dflt='none'
6063 . ./myread
6064 case "$ans" in
6065 n|none)
6066 case "$d_suidsafe" in
6067 '') echo "I'll assume setuid scripts are *not* secure." >&4
6068 dflt=n;;
6069 "$undef")
6070 echo "Well, the $hint value is *not* secure." >&4
6071 dflt=n;;
6072 *) echo "Well, the $hint value *is* secure." >&4
6073 dflt=y;;
6074 esac
c1a7f87b 6075 ;;
b4eb6b3d
JH
6076 *)
6077 $rm -f reflect flect
6078 echo "#!$ls" >reflect
6079 chmod +x,u+s reflect
6080 echo >flect
6081 chmod a+w flect
6082 echo '"su" will (probably) prompt you for '"$ans's password."
6083 su $ans -c './reflect >flect'
6084 if $contains "/dev/fd" flect >/dev/null; then
6085 echo "Okay, it looks like setuid scripts are secure." >&4
6086 dflt=y
6087 else
6088 echo "I don't think setuid scripts are secure." >&4
6089 dflt=n
6090 fi
6091 ;;
6092 esac
6093 rp='Does your kernel have *secure* setuid scripts?'
6094 . ./myread
6095 case "$ans" in
6096 [yY]*) val="$define";;
6097 *) val="$undef";;
6098 esac
6099 fi
6100else
6101 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6102 echo "(That's for file descriptors, not floppy disks.)"
6103 val="$undef"
6104fi
6105set d_suidsafe
6106eval $setvar
6107
6108$rm -f reflect flect
6109
6110: now see if they want to do setuid emulation
6111echo " "
6112val="$undef"
6113case "$d_suidsafe" in
6114"$define")
6115 val="$undef"
3c728e00 6116 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6117 ;;
6118*)
6119 $cat <<EOM
6120Some systems have disabled setuid scripts, especially systems where
6121setuid scripts cannot be secure. On systems where setuid scripts have
6122been disabled, the setuid/setgid bits on scripts are currently
6123useless. It is possible for $package to detect those bits and emulate
6124setuid/setgid in a secure fashion. This emulation will only work if
6125setuid scripts have been disabled in your kernel.
6126
6127EOM
6128 case "$d_dosuid" in
6129 "$define") dflt=y ;;
6130 *) dflt=n ;;
6131 esac
6132 rp="Do you want to do setuid/setgid emulation?"
6133 . ./myread
6134 case "$ans" in
6135 [yY]*) val="$define";;
6136 *) val="$undef";;
6137 esac
6138 ;;
6139esac
6140set d_dosuid
6141eval $setvar
6142
b4eb6b3d 6143: see if this is a malloc.h system
01d07975
YST
6144: we want a real compile instead of Inhdr because some systems have a
6145: malloc.h that just gives a compile error saying to use stdlib.h instead
6146echo " "
6147$cat >try.c <<EOCP
6148#include <stdlib.h>
6149#include <malloc.h>
6150int main () { return 0; }
6151EOCP
6152set try
6153if eval $compile; then
6154 echo "<malloc.h> found." >&4
6155 val="$define"
6156else
6157 echo "<malloc.h> NOT found." >&4
6158 val="$undef"
6159fi
6160$rm -f try.c try
6161set i_malloc
6162eval $setvar
b4eb6b3d 6163
c8b93cf9
JH
6164: check for void type
6165echo " "
6166echo "Checking to see how well your C compiler groks the void type..." >&4
6167case "$voidflags" in
6168'')
c727eafa 6169 $cat >try.c <<EOCP
d1daaddf
JH
6170#$i_stdlib I_STDLIB
6171#ifdef I_STDLIB
6172#include <stdlib.h>
6173#endif
c8b93cf9
JH
6174#if TRY & 1
6175void sub() {
6176#else
6177sub() {
6178#endif
6179 extern void moo(); /* function returning void */
6180 void (*goo)(); /* ptr to func returning void */
6181#if TRY & 8
6182 void *hue; /* generic ptr */
6183#endif
6184#if TRY & 2
6185 void (*foo[10])();
6186#endif
6187
6188#if TRY & 4
6189 if(goo == moo) {
6190 exit(0);
6191 }
6192#endif
6193 exit(0);
6194}
6195int main() { sub(); }
6196EOCP
6197 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6198 voidflags=$defvoidused
6199 echo "Good. It appears to support void to the level $package wants.">&4
6200 if $contains warning .out >/dev/null 2>&1; then
6201 echo "However, you might get some warnings that look like this:"
6202 $cat .out
6203 fi
6204 else
6205echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6206 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6207 echo "It supports 1..."
6208 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6209 echo "It also supports 2..."
6210 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6211 voidflags=7
6212 echo "And it supports 4 but not 8 definitely."
6213 else
6214 echo "It doesn't support 4..."
6215 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6216 voidflags=11
6217 echo "But it supports 8."
6218 else
6219 voidflags=3
6220 echo "Neither does it support 8."
6221 fi
6222 fi
6223 else
6224 echo "It does not support 2..."
6225 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6226 voidflags=13
6227 echo "But it supports 4 and 8."
6228 else
6229 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6230 voidflags=5
6231 echo "And it supports 4 but has not heard about 8."
6232 else
6233 echo "However it supports 8 but not 4."
6234 fi
6235 fi
6236 fi
6237 else
6238 echo "There is no support at all for void."
6239 voidflags=0
6240 fi
6241 fi
6242esac
6243case "$voidflags" in
6244"$defvoidused") ;;
6245*) $cat >&4 <<'EOM'
6246 Support flag bits are:
6247 1: basic void declarations.
6248 2: arrays of pointers to functions returning void.
6249 4: operations between pointers to and addresses of void functions.
6250 8: generic void pointers.
6251EOM
6252 dflt="$voidflags";
6253 rp="Your void support flags add up to what?"
6254 . ./myread
6255 voidflags="$ans"
6256 ;;
6257esac
6258$rm -f try.* .out
6259
6260: check for length of pointer
6261echo " "
6262case "$ptrsize" in
6263'')
6264 echo "Checking to see how big your pointers are..." >&4
6265 if test "$voidflags" -gt 7; then
6266 echo '#define VOID_PTR char *' > try.c
6267 else
6268 echo '#define VOID_PTR void *' > try.c
6269 fi
74d00865 6270 $cat >>try.c <<EOCP
c8b93cf9 6271#include <stdio.h>
d1daaddf
JH
6272#$i_stdlib I_STDLIB
6273#ifdef I_STDLIB
6274#include <stdlib.h>
6275#endif
c8b93cf9
JH
6276int main()
6277{
6278 printf("%d\n", (int)sizeof(VOID_PTR));
6279 exit(0);
6280}
6281EOCP
6282 set try
6283 if eval $compile_ok; then
6284 ptrsize=`$run ./try`
6285 echo "Your pointers are $ptrsize bytes long."
6286 else
6287 dflt='4'
6288 echo "(I can't seem to compile the test program. Guessing...)" >&4
6289 rp="What is the size of a pointer (in bytes)?"
6290 . ./myread
6291 ptrsize="$ans"
6292 fi
6293 ;;
6294esac
6295$rm -f try.c try
6296case "$use64bitall" in
6297"$define"|true|[yY]*)
6298 case "$ptrsize" in
6299 4) cat <<EOM >&4
6300
1911a026
JH
6301*** You have chosen a maximally 64-bit build,
6302*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6303*** Please rerun Configure without -Duse64bitall.
6304EOM
6305 case "$d_quad" in
6306 define)
6307 cat <<EOM >&4
6308*** Since you have quads, you could possibly try with -Duse64bitint.
6309EOM
6310 ;;
6311 esac
6312 cat <<EOM >&4
1911a026 6313*** Cannot continue, aborting.
c8b93cf9
JH
6314
6315EOM
09b58c7b 6316
1911a026 6317 exit 1
c8b93cf9
JH
6318 ;;
6319 esac
6320 ;;
6321esac
6322
19a100ff 6323
9df442c2
NC
6324: determine whether to use malloc wrapping
6325echo " "
6326case "$usemallocwrap" in
6327[yY]*|true|$define) dflt='y' ;;
6328[nN]*|false|$undef) dflt='n' ;;
6329*) case "$usedevel" in
6330 [yY]*|true|$define) dflt='y' ;;
6331 *) dflt='n' ;;
6332 esac
6333 ;;
6334esac
6335rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6336. ./myread
6337usemallocwrap="$ans"
6338case "$ans" in
6339y*|true)
6340 usemallocwrap="$define" ;;
6341*)
6342 usemallocwrap="$undef" ;;
6343esac
c8b93cf9 6344
b4eb6b3d
JH
6345: determine which malloc to compile in
6346echo " "
6347case "$usemymalloc" in
c4163172
JH
6348[yY]*|true|$define) dflt='y' ;;
6349[nN]*|false|$undef) dflt='n' ;;
6350*) case "$ptrsize" in
6351 4) dflt='y' ;;
6352 *) dflt='n' ;;
6353 esac
6354 ;;
8dfa8df9 6355esac
b4eb6b3d
JH
6356rp="Do you wish to attempt to use the malloc that comes with $package?"
6357. ./myread
6358usemymalloc="$ans"
6359case "$ans" in
6360y*|true)
6361 usemymalloc='y'
6362 mallocsrc='malloc.c'
6363 mallocobj="malloc$_o"
6364 d_mymalloc="$define"
6365 case "$libs" in
6366 *-lmalloc*)
6367 : Remove malloc from list of libraries to use
6368 echo "Removing unneeded -lmalloc from library list" >&4
6369 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6370 shift
6371 libs="$*"
6372 echo "libs = $libs" >&4
6373 ;;
6374 esac
6375 ;;
6376*)
6377 usemymalloc='n'
6378 mallocsrc=''
6379 mallocobj=''
6380 d_mymalloc="$undef"
6381 ;;
6382esac
6383
6384: compute the return types of malloc and free
6385echo " "
6386$cat >malloc.c <<END
6387#$i_malloc I_MALLOC
6388#$i_stdlib I_STDLIB
6389#include <stdio.h>
6390#include <sys/types.h>
6391#ifdef I_MALLOC
6392#include <malloc.h>
6393#endif
6394#ifdef I_STDLIB
6395#include <stdlib.h>
6396#endif
6397#ifdef TRY_MALLOC
6398void *malloc();
6399#endif
6400#ifdef TRY_FREE
6401void free();
6402#endif
6403END
6404case "$malloctype" in
6405'')
6406 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6407 malloctype='void *'
6408 else
6409 malloctype='char *'
6410 fi
6411 ;;
6412esac
6413echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6414
6415case "$freetype" in
6416'')
6417 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6418 freetype='void'
6419 else
6420 freetype='int'
6421 fi
6422 ;;
6423esac
6424echo "Your system uses $freetype free(), it would seem." >&4
6425$rm -f malloc.[co]
6426$cat <<EOM
6427
6428After $package is installed, you may wish to install various
6429add-on modules and utilities. Typically, these add-ons will
6430be installed under $prefix with the rest
6431of this package. However, you may wish to install such add-ons
6432elsewhere under a different prefix.
6433
6434If you do not wish to put everything under a single prefix, that's
6435ok. You will be prompted for the individual locations; this siteprefix
6436is only used to suggest the defaults.
6437
6438The default should be fine for most people.
6439
6440EOM
6441fn=d~+
6442rp='Installation prefix to use for add-on modules and utilities?'
6443: XXX Here might be another good place for an installstyle setting.
6444case "$siteprefix" in
6445'') dflt=$prefix ;;
6446*) dflt=$siteprefix ;;
6447esac
6448. ./getfile
6449: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6450oldsiteprefix=''
6451case "$siteprefix" in
6452'') ;;
6453*) case "$ans" in
6454 "$prefix") ;;
6455 *) oldsiteprefix="$prefix";;
6456 esac
6457 ;;
6458esac
6459siteprefix="$ans"
6460siteprefixexp="$ansexp"
6461
6462: determine where site specific libraries go.
6463: Usual default is /usr/local/lib/perl5/site_perl/$version
6464: The default "style" setting is made in installstyle.U
6465: XXX No longer works with Prefixit stuff.
6466prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6467case "$sitelib" in
6468'') case "$installstyle" in
6469 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6470 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6471 esac
6472 ;;
6473*) dflt="$sitelib"
6474 ;;
6475esac
6476$cat <<EOM
6477
6478The installation process will create a directory for
6479site-specific extensions and modules. Most users find it convenient
6480to place all site-specific files in this directory rather than in the
6481main distribution directory.
6482
6483EOM
6484fn=d~+
6485rp='Pathname for the site-specific library files?'
6486. ./getfile
6487sitelib="$ans"
6488sitelibexp="$ansexp"
6489sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6490: Change installation prefix, if necessary.
6491if $test X"$prefix" != X"$installprefix"; then
6492 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6493else
6494 installsitelib="$sitelibexp"
6495fi
6496
6497: determine where site specific architecture-dependent libraries go.
6498: sitelib default is /usr/local/lib/perl5/site_perl/$version
6499: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6500: sitelib may have an optional trailing /share.
6501case "$sitearch" in
6502'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6503 dflt="$dflt/$archname"
6504 ;;
6505*) dflt="$sitearch"
6506 ;;
6507esac
6508set sitearch sitearch none
6509eval $prefixit
6510$cat <<EOM
6511
6512The installation process will also create a directory for
6513architecture-dependent site-specific extensions and modules.
6514
6515EOM
6516fn=d~+
6517rp='Pathname for the site-specific architecture-dependent library files?'
6518. ./getfile
6519sitearch="$ans"
6520sitearchexp="$ansexp"
6521: Change installation prefix, if necessary.
6522if $test X"$prefix" != X"$installprefix"; then
6523 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6524else
6525 installsitearch="$sitearchexp"
6526fi
6527
6528$cat <<EOM
6529
6530The installation process will also create a directory for
6531vendor-supplied add-ons. Vendors who supply perl with their system
6532may find it convenient to place all vendor-supplied files in this
6533directory rather than in the main distribution directory. This will
6534ease upgrades between binary-compatible maintenance versions of perl.
6535
6536Of course you may also use these directories in whatever way you see
6537fit. For example, you might use them to access modules shared over a
6538company-wide network.
6539
6540The default answer should be fine for most people.
6541This causes further questions about vendor add-ons to be skipped
6542and no vendor-specific directories will be configured for perl.
6543
6544EOM
6545rp='Do you want to configure vendor-specific add-on directories?'
6546case "$usevendorprefix" in
6547define|true|[yY]*) dflt=y ;;
6548*) : User may have set vendorprefix directly on Configure command line.
6549 case "$vendorprefix" in
6550 ''|' ') dflt=n ;;
6551 *) dflt=y ;;
6552 esac
6553 ;;
6554esac
6555. ./myread
6556case "$ans" in
6557[yY]*) fn=d~+
6558 rp='Installation prefix to use for vendor-supplied add-ons?'
6559 case "$vendorprefix" in
6560 '') dflt='' ;;
6561 *) dflt=$vendorprefix ;;
6562 esac
6563 . ./getfile
6564 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6565 oldvendorprefix=''
6566 case "$vendorprefix" in
6567 '') ;;
6568 *) case "$ans" in
6569 "$prefix") ;;
6570 *) oldvendorprefix="$prefix";;
6571 esac
6572 ;;
6573 esac
6574 usevendorprefix="$define"
6575 vendorprefix="$ans"
6576 vendorprefixexp="$ansexp"
6577 ;;
6578*) usevendorprefix="$undef"
6579 vendorprefix=''
6580 vendorprefixexp=''
6581 ;;
6582esac
6583
6584case "$vendorprefix" in
6585'') d_vendorlib="$undef"
6586 vendorlib=''
6587 vendorlibexp=''
6588 ;;
6589*) d_vendorlib="$define"
6590 : determine where vendor-supplied modules go.
6591 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6592 case "$vendorlib" in
6593 '')
6594 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6595 case "$installstyle" in
6596 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6597 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6598 esac
6599 ;;
6600 *) dflt="$vendorlib"
6601 ;;
6602 esac
6603 fn=d~+
6604 rp='Pathname for the vendor-supplied library files?'
6605 . ./getfile
6606 vendorlib="$ans"
6607 vendorlibexp="$ansexp"
6608 ;;
6609esac
6610vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6611: Change installation prefix, if necessary.
6612if $test X"$prefix" != X"$installprefix"; then
6613 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6614else
6615 installvendorlib="$vendorlibexp"
6616fi
6617
6618case "$vendorprefix" in
6619'') d_vendorarch="$undef"
6620 vendorarch=''
6621 vendorarchexp=''
6622 ;;
6623*) d_vendorarch="$define"
6624 : determine where vendor-supplied architecture-dependent libraries go.
6625 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6626 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6627 : vendorlib may have an optional trailing /share.
6628 case "$vendorarch" in
6629 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6630 dflt="$dflt/$archname"
6631 ;;
6632 *) dflt="$vendorarch" ;;
6633 esac
6634 fn=d~+
6635 rp='Pathname for vendor-supplied architecture-dependent files?'
6636 . ./getfile
6637 vendorarch="$ans"
6638 vendorarchexp="$ansexp"
6639 ;;
6640esac
6641: Change installation prefix, if necessary.
6642if $test X"$prefix" != X"$installprefix"; then
6643 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6644else
6645 installvendorarch="$vendorarchexp"
6646fi
6647
6648: Final catch-all directories to search
6649$cat <<EOM
6650
6651Lastly, you can have perl look in other directories for extensions and
6652modules in addition to those already specified.
6653These directories will be searched after
6654 $sitearch
6655 $sitelib
6656EOM
6657test X"$vendorlib" != "X" && echo ' ' $vendorlib
6658test X"$vendorarch" != "X" && echo ' ' $vendorarch
6659echo ' '
6660case "$otherlibdirs" in
6661''|' ') dflt='none' ;;
6662*) dflt="$otherlibdirs" ;;
6663esac
6664$cat <<EOM
6665Enter a colon-separated set of extra paths to include in perl's @INC
6666search path, or enter 'none' for no extra paths.
6667
6668EOM
6669
6670rp='Colon-separated list of additional directories for perl to search?'
6671. ./myread
6672case "$ans" in
6673' '|''|none) otherlibdirs=' ' ;;
6674*) otherlibdirs="$ans" ;;
6675esac
6676case "$otherlibdirs" in
6677' ') val=$undef ;;
6678*) val=$define ;;
6679esac
6680set d_perl_otherlibdirs
6681eval $setvar
6682
6683: Cruising for prototypes
6684echo " "
6685echo "Checking out function prototypes..." >&4
55954f19
JH
6686$cat >prototype.c <<EOCP
6687#$i_stdlib I_STDLIB
6688#ifdef I_STDLIB
6689#include <stdlib.h>
6690#endif
b4eb6b3d
JH
6691int main(int argc, char *argv[]) {
6692 exit(0);}
6693EOCP
6694if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6695 echo "Your C compiler appears to support function prototypes."
6696 val="$define"
6697else
6698 echo "Your C compiler doesn't seem to understand function prototypes."
6699 val="$undef"
6700fi
6701set prototype
6702eval $setvar
6703$rm -f prototype*
6704
6705case "$prototype" in
6706"$define") ;;
6707*) ansi2knr='ansi2knr'
6708 echo " "
6709 cat <<EOM >&4
6710
6711$me: FATAL ERROR:
6712This version of $package can only be compiled by a compiler that
6713understands function prototypes. Unfortunately, your C compiler
6714 $cc $ccflags
6715doesn't seem to understand them. Sorry about that.
6716
6717If GNU cc is available for your system, perhaps you could try that instead.
6718
6719Eventually, we hope to support building Perl with pre-ANSI compilers.
6720If you would like to help in that effort, please contact <perlbug@perl.org>.
6721
6722Aborting Configure now.
6723EOM
6724 exit 2
6725 ;;
6726esac
6727
6728: determine where public executables go
6729echo " "
6730set dflt bin bin
6731eval $prefixit
6732fn=d~
6733rp='Pathname where the public executables will reside?'
6734. ./getfile
6735if $test "X$ansexp" != "X$binexp"; then
6736 installbin=''
6737fi
6738bin="$ans"
6739binexp="$ansexp"
6740: Change installation prefix, if necessary.
6741: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6742if $test X"$prefix" != X"$installprefix"; then
6743 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6744else
6745 installbin="$binexp"
6746fi
6747
6fcddf3b 6748echo " "
6fcddf3b 6749case "$extras" in
bf35c3f6
JH
6750'') dflt='n';;
6751*) dflt='y';;
6fcddf3b
JH
6752esac
6753cat <<EOM
6754Perl can be built with extra modules or bundles of modules which
6755will be fetched from the CPAN and installed alongside Perl.
6756
6757Notice that you will need access to the CPAN; either via the Internet,
6758or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6759be asked later to configure the CPAN.pm module which will in turn do
6760the installation of the rest of the extra modules or bundles.)
6761
6762Notice also that if the modules require any external software such as
dd2de242
JH
6763libraries and headers (the libz library and the zlib.h header for the
6764Compress::Zlib module, for example) you MUST have any such software
6765already installed, this configuration process will NOT install such
6766things for you.
6fcddf3b
JH
6767
6768If this doesn't make any sense to you, just accept the default '$dflt'.
6769EOM
dd2de242 6770rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6771. ./myread
6772case "$ans" in
6773y|Y)
6774 cat <<EOM
6775
6776Please list any extra modules or bundles to be installed from CPAN,
6777with spaces between the names. The names can be in any format the
dd2de242
JH
6778'install' command of CPAN.pm will understand. (Answer 'none',
6779without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6780EOM
6781 rp='Extras?'
6782 dflt="$extras"
6783 . ./myread
6784 extras="$ans"
6785esac
6786case "$extras" in
6787''|'none')
6788 val=''
6789 $rm -f ../extras.lst
6790 ;;
6791*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6792 echo "$extras" > ../extras.lst
6793 val="'$extras'"
6fcddf3b
JH
6794 ;;
6795esac
6796set extras
6797eval $setvar
6798echo " "
6799
6e1038e0
MB
6800: determine where html pages for programs go
6801set html1dir html1dir none
6802eval $prefixit
6803$cat <<EOM
6804
6805If you wish to install html files for programs in $spackage, indicate
6806the appropriate directory here. To skip installing html files,
6807answer "none".
6808EOM
6809case "$html1dir" in
6810''|none|$undef|' ') dflt=none ;;
6811*) dflt=$html1dir ;;
6812esac
6813fn=dn+~
6814rp="Directory for the main $spackage html pages?"
6815. ./getfile
6816html1dir="$ans"
6817html1direxp="$ansexp"
6818: Use ' ' for none so value is preserved next time through Configure
6819$test X"$html1dir" = "X" && html1dir=' '
6820: Change installation prefix, if necessary.
6821if $test X"$prefix" != X"$installprefix"; then
6822 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6823else
6824 installhtml1dir="$html1direxp"
6825fi
6826
6827: determine where html pages for libraries and modules go
6828set html3dir html3dir none
6829eval $prefixit
6830$cat <<EOM
6831
6832If you wish to install html files for modules associated with $spackage,
6833indicate the appropriate directory here. To skip installing html files,
6834answer "none".
6835EOM
6836: There is no obvious default. If they have specified html1dir, then
6837: try to key off that, possibly changing .../html1 into .../html3.
6838case "$html3dir" in
6839'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6840*) dflt=$html3dir ;;
6841esac
6842fn=dn+~
6843rp="Directory for the $spackage module html pages?"
6844. ./getfile
6845html3dir="$ans"
6846html3direxp="$ansexp"
6847: Use ' ' for none so value is preserved next time through Configure
6848$test X"$html3dir" = "X" && html3dir=' '
6849: Change installation prefix, if necessary.
6850if $test X"$prefix" != X"$installprefix"; then
6851 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6852else
6853 installhtml3dir="$html3direxp"
6854fi
6855
b4eb6b3d
JH
6856: Find perl5.005 or later.
6857echo "Looking for a previously installed perl5.005 or later... "
6858case "$perl5" in
a938a3bb 6859'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6860 : Check if this perl is recent and can load a simple module
a938a3bb 6861 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6862 perl5=$tdir/perl
6863 break;
a938a3bb
IZ
6864 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6865 perl5=$tdir/perl5
b4eb6b3d
JH
6866 break;
6867 fi
89ce900e
JH
6868 done
6869 ;;
6870*) perl5="$perl5"
6871 ;;
6872esac
6873case "$perl5" in
6874'') echo "None found. That's ok.";;
6875*) echo "Using $perl5." ;;
6876esac
6877
6878: Determine list of previous versions to include in @INC
6879$cat > getverlist <<EOPL
6880#!$perl5 -w
6881use File::Basename;
6882\$api_versionstring = "$api_versionstring";
6883\$version = "$version";
6884\$stem = "$sitelib_stem";
6885\$archname = "$archname";
6886EOPL
6887 $cat >> getverlist <<'EOPL'
6888# Can't have leading @ because metaconfig interprets it as a command!
6889;@inc_version_list=();
6890# XXX Redo to do opendir/readdir?
6891if (-d $stem) {
6892 chdir($stem);
6893 ;@candidates = glob("5.*");
6894}
6895else {
6896 ;@candidates = ();
6897}
6898
6899# XXX ToDo: These comparisons must be reworked when two-digit
6900# subversions come along, so that 5.7.10 compares as greater than
6901# 5.7.3! By that time, hope that 5.6.x is sufficiently
6902# widespread that we can use the built-in version vectors rather
6903# than reinventing them here. For 5.6.0, however, we must
6904# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6905foreach $d (@candidates) {
6906 if ($d lt $version) {
6907 if ($d ge $api_versionstring) {
6908 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6909 }
6910 elsif ($d ge "5.005") {
6911 unshift(@inc_version_list, grep { -d } $d);
6912 }
6913 }
6914 else {
6915 # Skip newer version. I.e. don't look in
6916 # 5.7.0 if we're installing 5.6.1.
6917 }
6918}
6919
6920if (@inc_version_list) {
6921 print join(' ', @inc_version_list);
6922}
6923else {
6924 # Blank space to preserve value for next Configure run.
6925 print " ";
6926}
6927EOPL
6928chmod +x getverlist
6929case "$inc_version_list" in
6930'') if test -x "$perl5$exe_ext"; then
6931 dflt=`$perl5 getverlist`
6932 else
6933 dflt='none'
6934 fi
6935 ;;
6936$undef) dflt='none' ;;
6937*) eval dflt=\"$inc_version_list\" ;;
6938esac
6939case "$dflt" in
6940''|' ') dflt=none ;;
6941esac
6942case "$dflt" in
69435.005) dflt=none ;;
6944esac
6945$cat <<EOM
6946
6947In order to ease the process of upgrading, this version of perl
6948can be configured to use modules built and installed with earlier
6949versions of perl that were installed under $prefix. Specify here
6950the list of earlier versions that this version of perl should check.
6951If Configure detected no earlier versions of perl installed under
6952$prefix, then the list will be empty. Answer 'none' to tell perl
6953to not search earlier versions.
6954
6955The default should almost always be sensible, so if you're not sure,
6956just accept the default.
6957EOM
6958
6959rp='List of earlier versions to include in @INC?'
6960. ./myread
6961case "$ans" in
d2556f21 6962[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
89ce900e
JH
6963*) inc_version_list="$ans" ;;
6964esac
6965case "$inc_version_list" in
6966''|' ')
6967 inc_version_list_init='0';;
6968*) inc_version_list_init=`echo $inc_version_list |
6969 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6970 ;;
6971esac
6972$rm -f getverlist
6973
6974: determine whether to install perl also as /usr/bin/perl
6975
6976echo " "
6977if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6978 $cat <<EOM
6979Many scripts expect perl to be installed as /usr/bin/perl.
6980
6981If you want to, I can install the perl you are about to compile
6982as /usr/bin/perl (in addition to $bin/perl).
6983EOM
6984 if test -f /usr/bin/perl; then
6985 $cat <<EOM
6986
6987However, please note that because you already have a /usr/bin/perl,
6988overwriting that with a new Perl would very probably cause problems.
6989Therefore I'm assuming you don't want to do that (unless you insist).
6990
6991EOM
6992 case "$installusrbinperl" in
6993 "$define"|[yY]*) dflt='y';;
6994 *) dflt='n';;
6995 esac
6996 else
6997 $cat <<EOM
6998
6999Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7000
7001EOM
7002 case "$installusrbinperl" in
7003 "$undef"|[nN]*) dflt='n';;
7004 *) dflt='y';;
7005 esac
7006 fi
7007 rp="Do you want to install perl as /usr/bin/perl?"
7008 . ./myread
7009 case "$ans" in
7010 [yY]*) val="$define";;
7011 *) val="$undef" ;;
7012 esac
7013else
7014 val="$undef"
7015fi
7016set installusrbinperl
7017eval $setvar
7018
7019echo " "
7020echo "Checking for GNU C Library..." >&4
7021cat >try.c <<'EOCP'
7022/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7023 alone are insufficient to distinguish different versions, such as
7024 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7025 libc version 2.1.0. A. Dougherty, June 3, 2002.
7026*/
7027#include <stdio.h>
7028int main(void)
7029{
7030#ifdef __GLIBC__
7031# ifdef __GLIBC_MINOR__
7032# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7033# include <gnu/libc-version.h>
7034 printf("%s\n", gnu_get_libc_version());
7035# else
7036 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7037# endif
7038# else
7039 printf("%d\n", __GLIBC__);
7040# endif
7041 return 0;
7042#else
7043 return 1;
7044#endif
7045}
7046EOCP
7047set try
7048if eval $compile_ok && $run ./try > glibc.ver; then
7049 val="$define"
7050 gnulibc_version=`$cat glibc.ver`
7051 echo "You are using the GNU C Library version $gnulibc_version"
7052else
7053 val="$undef"
7054 gnulibc_version=''
7055 echo "You are not using the GNU C Library"
7056fi
7057$rm -f try try.* glibc.ver
7058set d_gnulibc
7059eval $setvar
7060
7061: see if nm is to be used to determine whether a symbol is defined or not
7062case "$usenm" in
7063'')
7064 dflt=''
7065 case "$d_gnulibc" in
7066 "$define")
7067 echo " "
7068 echo "nm probably won't work on the GNU C Library." >&4
7069 dflt=n
7070 ;;
7071 esac
7072 case "$dflt" in
7073 '')
7074 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7075 echo " "
7076 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7077 echo "'nm' won't be sufficient on this sytem." >&4
7078 dflt=n
7079 fi
7080 ;;
7081 esac
7082 case "$dflt" in
7083 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7084 if $test $dflt -gt 20; then
7085 dflt=y
7086 else
7087 dflt=n
7088 fi
7089 ;;
7090 esac
b4eb6b3d 7091 ;;
89ce900e
JH
7092*)
7093 case "$usenm" in
7094 true|$define) dflt=y;;
7095 *) dflt=n;;
7096 esac
b4eb6b3d
JH
7097 ;;
7098esac
89ce900e 7099$cat <<EOM
b4eb6b3d 7100
89ce900e
JH
7101I can use $nm to extract the symbols from your C libraries. This
7102is a time consuming task which may generate huge output on the disk (up
7103to 3 megabytes) but that should make the symbols extraction faster. The
7104alternative is to skip the 'nm' extraction part and to compile a small
7105test program instead to determine whether each symbol is present. If
7106you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7107this may be the best solution.
b4eb6b3d 7108
89ce900e 7109You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7110
89ce900e
JH
7111EOM
7112rp="Shall I use $nm to extract C symbols from the libraries?"
7113. ./myread
7114case "$ans" in
7115[Nn]*) usenm=false;;
7116*) usenm=true;;
b4eb6b3d 7117esac
89ce900e
JH
7118
7119runnm=$usenm
7120case "$reuseval" in
7121true) runnm=false;;
b4eb6b3d 7122esac
b4eb6b3d 7123
89ce900e
JH
7124: nm options which may be necessary
7125case "$nm_opt" in
7126'') if $test -f /mach_boot; then
7127 nm_opt='' # Mach
7128 elif $test -d /usr/ccs/lib; then
7129 nm_opt='-p' # Solaris (and SunOS?)
7130 elif $test -f /dgux; then
7131 nm_opt='-p' # DG-UX
7132 elif $test -f /lib64/rld; then
7133 nm_opt='-p' # 64-bit Irix
7134 else
7135 nm_opt=''
7136 fi;;
7137esac
b4eb6b3d 7138
89ce900e
JH
7139: nm options which may be necessary for shared libraries but illegal
7140: for archive libraries. Thank you, Linux.
7141case "$nm_so_opt" in
7142'') case "$myuname" in
fb2e1bc0 7143 *linux*|gnu*)
89ce900e
JH
7144 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7145 nm_so_opt='--dynamic'
7146 fi
7147 ;;
7148 esac
7149 ;;
7150esac
b4eb6b3d 7151
89ce900e
JH
7152case "$runnm" in
7153true)
7154: get list of predefined functions in a handy place
7155echo " "
7156case "$libc" in
7157'') libc=unknown
7158 case "$libs" in
7159 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7160 esac
7161 ;;
b4eb6b3d 7162esac
89ce900e
JH
7163case "$libs" in
7164'') ;;
7165*) for thislib in $libs; do
7166 case "$thislib" in
7167 -lc|-lc_s)
7168 : Handle C library specially below.
7169 ;;
7170 -l*)
7171 thislib=`echo $thislib | $sed -e 's/^-l//'`
7172 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7173 :
7174 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7175 :
7176 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7177 :
7178 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7179 :
7180 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7181 :
7182 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7183 :
7184 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7185 :
7186 else
7187 try=''
7188 fi
7189 libnames="$libnames $try"
7190 ;;
7191 *) libnames="$libnames $thislib" ;;
7192 esac
7193 done
b4eb6b3d
JH
7194 ;;
7195esac
89ce900e
JH
7196xxx=normal
7197case "$libc" in
7198unknown)
7199 set /lib/libc.$so
7200 for xxx in $libpth; do
7201 $test -r $1 || set $xxx/libc.$so
7202 : The messy sed command sorts on library version numbers.
7203 $test -r $1 || \
7204 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7205 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7206 h
7207 s/[0-9][0-9]*/0000&/g
7208 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7209 G
7210 s/\n/ /' | \
7211 $sort | $sed -e 's/^.* //'`
7212 eval set \$$#
7213 done
7214 $test -r $1 || set /usr/ccs/lib/libc.$so
7215 $test -r $1 || set /lib/libsys_s$_a
7216 ;;
7217*)
7218 set blurfl
7219 ;;
7220esac
7221if $test -r "$1"; then
7222 echo "Your (shared) C library seems to be in $1."
7223 libc="$1"
7224elif $test -r /lib/libc && $test -r /lib/clib; then
7225 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7226 xxx=apollo
7227 libc='/lib/clib /lib/libc'
7228 if $test -r /lib/syslib; then
7229 echo "(Your math library is in /lib/syslib.)"
7230 libc="$libc /lib/syslib"
7231 fi
7232elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7233 echo "Your C library seems to be in $libc, as you said before."
7234elif $test -r $incpath/usr/lib/libc$_a; then
7235 libc=$incpath/usr/lib/libc$_a;
7236 echo "Your C library seems to be in $libc. That's fine."
7237elif $test -r /lib/libc$_a; then
7238 libc=/lib/libc$_a;
7239 echo "Your C library seems to be in $libc. You're normal."
7240else
7241 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7242 :
7243 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7244 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7245 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7246 :
7247 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7248 :
7249 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7250 :
7251 else
7252 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7253 fi
7254 if $test -r "$tans"; then
7255 echo "Your C library seems to be in $tans, of all places."
7256 libc=$tans
7257 else
7258 libc='blurfl'
7259 fi
7260fi
7261if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7262 dflt="$libc"
7263 cat <<EOM
b4eb6b3d 7264
89ce900e
JH
7265If the guess above is wrong (which it might be if you're using a strange
7266compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7267
89ce900e
JH
7268EOM
7269else
7270 dflt=''
7271 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7272 cat >&4 <<EOM
7273I can't seem to find your C library. I've looked in the following places:
5e366f65 7274
b4eb6b3d 7275EOM
89ce900e
JH
7276 $sed 's/^/ /' libpath
7277 cat <<EOM
5e366f65 7278
89ce900e 7279None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7280
7281EOM
89ce900e
JH
7282fi
7283fn=f
7284rp='Where is your C library?'
7285. ./getfile
7286libc="$ans"
5e366f65 7287
89ce900e
JH
7288echo " "
7289echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7290set X `cat libnames`
7291shift
7292xxx=files
7293case $# in 1) xxx=file; esac
7294echo "Extracting names from the following $xxx for later perusal:" >&4
7295echo " "
7296$sed 's/^/ /' libnames >&4
7297echo " "
7298$echo $n "This may take a while...$c" >&4
5e366f65 7299
89ce900e
JH
7300for file in $*; do
7301 case $file in
7302 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7303 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7304 esac
89ce900e
JH
7305done >libc.tmp
7306
7307$echo $n ".$c"
7308$grep fprintf libc.tmp > libc.ptf
7309xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7310xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7311xxx='[ADTSIW]'
ab900c53 7312if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7313 eval $xscan;\
7314 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7315 eval $xrun
7316elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7317 eval $xscan;\
7318 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7319 eval $xrun
7320elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7321 eval $xscan;\
7322 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7323 eval $xrun
7324elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7325 eval $xscan;\
7326 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7327 eval $xrun
7328elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7329 eval $xscan;\
7330 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7331 eval $xrun
7332elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7333 eval $xscan;\
7334 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7335 eval $xrun
7336elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7337 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7338 eval $xscan;\
7339 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7340 eval $xrun
7341elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7342 eval $xscan;\
7343 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7344 eval $xrun
7345elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7346 eval $xscan;\
7347 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348 eval $xrun
7349elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7350 eval $xscan;\
7351 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7352 eval $xrun
7353elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7354 eval $xscan;\
7355 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7356 eval $xrun
7357elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7358 eval $xscan;\
7359 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7360 eval $xrun
7361elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7362 eval $xscan;\
7363 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7364 eval $xrun
7365elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7366 eval $xscan;\
7367 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7368 eval $xrun
b4eb6b3d 7369else
89ce900e
JH
7370 $nm -p $* 2>/dev/null >libc.tmp
7371 $grep fprintf libc.tmp > libc.ptf
7372 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7373 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7374 then
7375 nm_opt='-p'
7376 eval $xrun
7377 else
7378 echo " "
7379 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7380 com=''
7381 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7382 for thisname in $libnames $libc; do
7383 $ar t $thisname >>libc.tmp
7384 done
7385 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7386 echo "Ok." >&4
7387 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7388 # Repeat libc to extract forwarders to DLL entries too
7389 for thisname in $libnames $libc; do
7390 $ar tv $thisname >>libc.tmp
7391 # Revision 50 of EMX has bug in $ar.
7392 # it will not extract forwarders to DLL entries
7393 # Use emximp which will extract exactly them.
7394 emximp -o tmp.imp $thisname \
7395 2>/dev/null && \
7396 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7397 < tmp.imp >>libc.tmp
7398 $rm tmp.imp
7399 done
7400 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7401 echo "Ok." >&4
7402 else
7403 echo "$ar didn't seem to work right." >&4
7404 echo "Maybe this is a Cray...trying bld instead..." >&4
7405 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7406 then
7407 for thisname in $libnames; do
7408 bld t $libnames | \
7409 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7410 $ar t $thisname >>libc.tmp
7411 done
7412 echo "Ok." >&4
7413 else
7414 echo "That didn't work either. Giving up." >&4
7415 exit 1
7416 fi
7417 fi
7418 fi
b4eb6b3d 7419fi
89ce900e
JH
7420nm_extract="$com"
7421case "$PASE" in
7422define)
7423 echo " "
7424 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7425 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7426 ;;
7427*) if $test -f /lib/syscalls.exp; then
7428 echo " "
7429 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7430 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7431 fi
7432 ;;
7433esac
7434;;
7435esac
7436$rm -f libnames libpath
b4eb6b3d
JH
7437
7438: see if dld is available
7439set dld.h i_dld
7440eval $inhdr
7441
89ce900e
JH
7442: is a C symbol defined?
7443csym='tlook=$1;
7444case "$3" in
373dfab3
JH
7445-v) tf=libc.tmp; tdc="";;
7446-a) tf=libc.tmp; tdc="[]";;
7447*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7448esac;
7449tx=yes;
7450case "$reuseval-$4" in
7451true-) ;;
7452true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7453esac;
7454case "$tx" in
7455yes)
ab900c53 7456 tval=false;
5129fff4
JH
7457 if $test "$runnm" = true; then
7458 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7459 tval=true;
5129fff4 7460 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7461 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7462 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7463 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7464 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7465 fi;
5129fff4 7466 else
373dfab3 7467 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7468 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7469 $rm -f try$_exe try.c;
ab900c53
AB
7470 fi;
7471 ;;
89ce900e
JH
7472*)
7473 case "$tval" in
7474 $define) tval=true;;
7475 *) tval=false;;
ab900c53
AB
7476 esac;
7477 ;;
89ce900e
JH
7478esac;
7479eval "$2=$tval"'
7480
7481: define an is-in-libc? function
7482inlibc='echo " "; td=$define; tu=$undef;
7483sym=$1; var=$2; eval "was=\$$2";
7484tx=yes;
7485case "$reuseval$was" in
7486true) ;;
7487true*) tx=no;;
7488esac;
7489case "$tx" in
7490yes)
7491 set $sym tres -f;
7492 eval $csym;
7493 case "$tres" in
7494 true)
7495 echo "$sym() found." >&4;
7496 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7497 *)
7498 echo "$sym() NOT found." >&4;
7499 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7500 esac;;
7501*)
7502 case "$was" in
7503 $define) echo "$sym() found." >&4;;
7504 *) echo "$sym() NOT found." >&4;;
7505 esac;;
7506esac'
7507
b4eb6b3d
JH
7508: see if dlopen exists
7509xxx_runnm="$runnm"
7510runnm=false
7511set dlopen d_dlopen
7512eval $inlibc
7513runnm="$xxx_runnm"
7514
7515: determine which dynamic loading, if any, to compile in
7516echo " "
7517dldir="ext/DynaLoader"
7518case "$usedl" in
7519$define|y|true)
7520 dflt='y'
7521 usedl="$define"
7522 ;;
7523$undef|n|false)
7524 dflt='n'
7525 usedl="$undef"
7526 ;;
7527*)
7528 dflt='n'
7529 case "$d_dlopen" in
7530 $define) dflt='y' ;;
7531 esac
7532 case "$i_dld" in
7533 $define) dflt='y' ;;
7534 esac
7535 : Does a dl_xxx.xs file exist for this operating system
7536 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7537 ;;
7538esac
7539rp="Do you wish to use dynamic loading?"
7540. ./myread
7541usedl="$ans"
7542case "$ans" in
7543y*) usedl="$define"
7544 case "$dlsrc" in
7545 '')
7546 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7547 dflt="$dldir/dl_${osname}.xs"
7548 elif $test "$d_dlopen" = "$define" ; then
7549 dflt="$dldir/dl_dlopen.xs"
7550 elif $test "$i_dld" = "$define" ; then
7551 dflt="$dldir/dl_dld.xs"
7552 else
7553 dflt=''
7554 fi
7555 ;;
7556 *) dflt="$dldir/$dlsrc"
7557 ;;
7558 esac
7559 echo "The following dynamic loading files are available:"
7560 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7561 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7562 rp="Source file to use for dynamic loading"
7563 fn="fne"
7564 gfpth="$src"
7565 . ./getfile
7566 usedl="$define"
7567 : emulate basename
7568 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7569
7570 $cat << EOM
7571
7572Some systems may require passing special flags to $cc -c to
7573compile modules that will be used to create a shared library.
7574To use no flags, say "none".
7575
7576EOM
7577 case "$cccdlflags" in
7578 '') case "$gccversion" in
7579 '') case "$osname" in
7580 hpux) dflt='+z' ;;
7581 next) dflt='none' ;;
7582 irix*) dflt='-KPIC' ;;
48bcfe03 7583 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7584 sunos) dflt='-pic' ;;
7585 *) dflt='none' ;;
7586 esac
7587 ;;
7588 *) case "$osname" in
b6cc0f4c 7589 darwin) dflt='none' ;;
48bcfe03 7590 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7591 *) dflt='-fpic' ;;
7592 esac ;;
7593 esac ;;
7594 ' ') dflt='none' ;;
7595 *) dflt="$cccdlflags" ;;
7596 esac
7597 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7598 . ./myread
7599 case "$ans" in
7600 none) cccdlflags=' ' ;;
7601 *) cccdlflags="$ans" ;;
7602 esac
7603
7604 cat << EOM
7605
7606Some systems use ld to create libraries that can be dynamically loaded,
7607while other systems (such as those using ELF) use $cc.
7608
7609EOM
7610 case "$ld" in
55954f19 7611 '') $cat >try.c <<EOM
b4eb6b3d
JH
7612/* Test for whether ELF binaries are produced */
7613#include <fcntl.h>
55954f19
JH
7614#$i_stdlib I_STDLIB
7615#ifdef I_STDLIB
b4eb6b3d 7616#include <stdlib.h>
55954f19 7617#endif
b4eb6b3d
JH
7618int main() {
7619 char b[4];
7620 int i = open("a.out",O_RDONLY);
7621 if(i == -1)
7622 exit(1); /* fail */
7623 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7624 exit(0); /* succeed (yes, it's ELF) */
7625 else
7626 exit(1); /* fail */
7627}
7628EOM
5440bc8e 7629 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7630 cat <<EOM
7631You appear to have ELF support. I'll use $cc to build dynamic libraries.
7632EOM
7633 dflt="$cc"
7634 else
7635 echo "I'll use ld to build dynamic libraries."
7636 dflt='ld'
7637 fi
7638 rm -f try.c a.out
7639 ;;
7640 *) dflt="$ld"
7641 ;;
7642 esac
7643
7644 rp="What command should be used to create dynamic libraries?"
7645 . ./myread
7646 ld="$ans"
7647
7648 cat << EOM
7649
7650Some systems may require passing special flags to $ld to create a
7651library that can be dynamically loaded. If your ld flags include
7652-L/other/path options to locate libraries outside your loader's normal
7653search path, you may need to specify those -L options here as well. To
7654use no flags, say "none".
7655
7656EOM
7657 case "$lddlflags" in
7658 '') case "$osname" in
7659 beos) dflt='-nostart' ;;
7660 hpux) dflt='-b';
7661 case "$gccversion" in
7662 '') dflt="$dflt +vnocompatwarnings" ;;
7663 esac
7664 ;;
fb2e1bc0 7665 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7666 next) dflt='none' ;;
7667 solaris) dflt='-G' ;;
7668 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7669 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7670 *) dflt='none' ;;
7671 esac
7672 ;;
7673 *) dflt="$lddlflags" ;;
7674 esac
7675
7676 : Try to guess additional flags to pick up local libraries.
7677 : Be careful not to append to a plain 'none'
7678 case "$dflt" in
7679 none) dflt='' ;;
7680 esac
7681 for thisflag in $ldflags; do
7682 case "$thisflag" in
b5b9f165 7683 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7684 case " $dflt " in
7685 *" $thisflag "*) ;;
7686 *) dflt="$dflt $thisflag" ;;
7687 esac
7688 ;;
7689 esac
7690 done
7691
7692 case "$dflt" in
7693 ''|' ') dflt='none' ;;
7694 esac
7695
7696 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7697 . ./myread
7698 case "$ans" in
7699 none) lddlflags=' ' ;;
7700 *) lddlflags="$ans" ;;
7701 esac
7702
7703 cat <<EOM
7704
7705Some systems may require passing special flags to $cc to indicate that
7706the resulting executable will use dynamic linking. To use no flags,
7707say "none".
7708
7709EOM
7710 case "$ccdlflags" in
7711 '') case "$osname" in
fb2e1bc0 7712 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7713 next|sunos) dflt='none' ;;
7714 *) dflt='none' ;;
b4eb6b3d
JH
7715 esac ;;
7716 ' ') dflt='none' ;;
7717 *) dflt="$ccdlflags" ;;
7718 esac
7719 rp="Any special flags to pass to $cc to use dynamic linking?"
7720 . ./myread
7721 case "$ans" in
7722 none) ccdlflags=' ' ;;
7723 *) ccdlflags="$ans" ;;
7724 esac
7725 ;;
7726*) usedl="$undef"
7727 ld='ld'
7728 dlsrc='dl_none.xs'
7729 lddlflags=''
7730 ccdlflags=''
7731 ;;
7732esac
7733
7734also=''
7735case "$usedl" in
7736$undef)
7737 # No dynamic loading being used, so don't bother even to prompt.
7738 useshrplib='false'
7739 ;;
7740*) case "$useshrplib" in
7741 '') case "$osname" in
48bcfe03 7742 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7743 dflt=y
7744 also='Building a shared libperl is required for dynamic loading to work on your system.'
7745 ;;
7746 next*)
7747 case "$osvers" in
7748 4*) dflt=y
7749 also='Building a shared libperl is needed for MAB support.'
7750 ;;
7751 *) dflt=n
7752 ;;
7753 esac
7754 ;;
7755 *) dflt=n
7756 ;;
7757 esac
7758 ;;
7759 $define|true|[Yy]*)
7760 dflt=y
7761 ;;
7762 *) dflt=n
7763 ;;
7764 esac
7765 $cat << EOM
7766
7767The perl executable is normally obtained by linking perlmain.c with
7768libperl${_a}, any static extensions (usually just DynaLoader), and
7769any other libraries needed on this system (such as -lm, etc.). Since
7770your system supports dynamic loading, it is probably possible to build
7771a shared libperl.$so. If you will have more than one executable linked
7772to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7773executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7774default is probably sensible for your system.
7775$also
7776
7777EOM
7778 rp="Build a shared libperl.$so (y/n)"
7779 . ./myread
7780 case "$ans" in
7781 true|$define|[Yy]*)
7782 useshrplib='true' ;;
7783 *) useshrplib='false' ;;
7784 esac
7785 ;;
7786esac
7787
7788case "$useshrplib" in
7789true)
7790 case "$libperl" in
7791 '')
7792 # Figure out a good name for libperl.so. Since it gets stored in
7793 # a version-specific architecture-dependent library, the version
7794 # number isn't really that important, except for making cc/ld happy.
7795 #
7796 # A name such as libperl.so.3.1
7797 majmin="libperl.$so.$patchlevel.$subversion"
7798 # A name such as libperl.so.301
7799 majonly=`echo $patchlevel $subversion |
7800 $awk '{printf "%d%02d", $1, $2}'`
7801 majonly=libperl.$so.$majonly
7802 # I'd prefer to keep the os-specific stuff here to a minimum, and
7803 # rely on figuring it out from the naming of libc.
7804 case "${osname}${osvers}" in
7805 next4*)
7806 dflt=libperl.5.$so
7807 # XXX How handle the --version stuff for MAB?
7808 ;;
fb2e1bc0 7809 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7810 dflt=libperl.$so
7811 ;;
b53432e4
GH
7812 cygwin*) # ld links against an importlib
7813 dflt=libperl$lib_ext
b4eb6b3d
JH
7814 ;;
7815 *) # Try to guess based on whether libc has major.minor.
7816 case "$libc" in
7817 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7818 *libc.$so.[0-9]*) dflt=$majonly ;;
7819 *) dflt=libperl.$so ;;
7820 esac
7821 ;;
7822 esac
7823 ;;
7824 *) dflt=$libperl
7825 ;;
7826 esac
7827 cat << EOM
7828
7829I need to select a good name for the shared libperl. If your system uses
7830library names with major and minor numbers, then you might want something
7831like $majmin. Alternatively, if your system uses a single version
7832number for shared libraries, then you might want to use $majonly.
7833Or, your system might be quite happy with a simple libperl.$so.
7834
7835Since the shared libperl will get installed into a version-specific
7836architecture-dependent directory, the version number of the shared perl
7837library probably isn't important, so the default should be o.k.
7838
7839EOM
7840 rp='What name do you want to give to the shared libperl?'
7841 . ./myread
7842 libperl=$ans
7843 echo "Ok, I'll use $libperl"
7844 ;;
7845*)
7846 libperl="libperl${_a}"
7847 ;;
7848esac
7849
7850# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7851case "$shrpdir" in
7852'') ;;
7853*) $cat >&4 <<EOM
7854WARNING: Use of the shrpdir variable for the installation location of
7855the shared $libperl is not supported. It was never documented and
7856will not work in this version. Let me (perlbug@perl.org)
7857know of any problems this may cause.
7858
7859EOM
7860 case "$shrpdir" in
7861 "$archlibexp/CORE")
7862 $cat >&4 <<EOM
7863But your current setting of $shrpdir is
7864the default anyway, so it's harmless.
7865EOM
7866 ;;
7867 *)
7868 $cat >&4 <<EOM
7869Further, your current attempted setting of $shrpdir
7870conflicts with the value of $archlibexp/CORE
7871that installperl will use.
7872EOM
7873 ;;
7874 esac
7875 ;;
7876esac
7877
7878# How will the perl executable find the installed shared $libperl?
7879# Add $xxx to ccdlflags.
7880# If we can't figure out a command-line option, use $shrpenv to
7881# set env LD_RUN_PATH. The main perl makefile uses this.
7882shrpdir=$archlibexp/CORE
7883xxx=''
7884tmp_shrpenv=''
7885if "$useshrplib"; then
7886 case "$osname" in
7887 aix)
7888 # We'll set it in Makefile.SH...
7889 ;;
b5b9f165 7890 solaris)
b4eb6b3d
JH
7891 xxx="-R $shrpdir"
7892 ;;
46fcf6af 7893 freebsd|netbsd|openbsd|interix)
b4eb6b3d
JH
7894 xxx="-Wl,-R$shrpdir"
7895 ;;
fb2e1bc0 7896 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7897 xxx="-Wl,-rpath,$shrpdir"
7898 ;;
7899 next)
7900 # next doesn't like the default...
7901 ;;
7902 beos)
7903 # beos doesn't like the default, either.
7904 ;;
7905 hpux*)
7906 # hpux doesn't like the default, either.
7907 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7908 ;;
7909 *)
7910 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7911 ;;
7912 esac
7913 case "$xxx" in
7914 '') ;;
7915 *)
7916 # Only add $xxx if it isn't already in ccdlflags.
7917 case " $ccdlflags " in
7918 *" $xxx "*) ;;
7919 *) ccdlflags="$ccdlflags $xxx"
7920 cat <<EOM >&4
7921
7922Adding $xxx to the flags
7923passed to $ld so that the perl executable will find the
7924installed shared $libperl.
7925
7926EOM
7927 ;;
7928 esac
7929 ;;
7930 esac
7931fi
7932# Fix ccdlflags in AIX for building external extensions.
7933# (For building Perl itself bare -bE:perl.exp is needed,
7934# Makefile.SH takes care of this.)
7935case "$osname" in
7936aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7937esac
7938# Respect a hint or command-line value.
7939case "$shrpenv" in
7940'') shrpenv="$tmp_shrpenv" ;;
7941esac
7942case "$ldlibpthname" in
7943'') ldlibpthname=LD_LIBRARY_PATH ;;
7944none) ldlibpthname='' ;;
7945esac
7946
7947: determine where manual pages are on this system
7948echo " "
7949case "$sysman" in
7950'')
4a0a3829
SD
7951 syspath='/usr/share/man/man1 /usr/man/man1'
7952 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7953 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7954 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7955 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7956 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7957 sysman=`./loc . /usr/man/man1 $syspath`
7958 ;;
7959esac
7960if $test -d "$sysman"; then
7961 echo "System manual is in $sysman." >&4
7962else
7963 echo "Could not find manual pages in source form." >&4
7964fi
7965
7966: determine where manual pages go
7967set man1dir man1dir none
7968eval $prefixit
7969$cat <<EOM
7970
7971$spackage has manual pages available in source form.
7972EOM
7973case "$nroff" in
7974nroff)
7975 echo "However, you don't have nroff, so they're probably useless to you."
7976 case "$man1dir" in
7977 '') man1dir="none";;
7978 esac;;
7979esac
7980echo "If you don't want the manual sources installed, answer 'none'."
7981case "$man1dir" in
7982' ') dflt=none
7983 ;;
7984'')
4a0a3829
SD
7985 lookpath="$prefixexp/share/man/man1"
7986 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7987 lookpath="$lookpath $prefixexp/man/p_man/man1"
7988 lookpath="$lookpath $prefixexp/man/u_man/man1"
7989 lookpath="$lookpath $prefixexp/man/man.1"
7990 case "$sysman" in
7991 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7992 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7993 esac
7994 set dflt
7995 eval $prefixup
7996 ;;
7997*) dflt="$man1dir"
7998 ;;
7999esac
8000echo " "
8001fn=dn+~
8002rp="Where do the main $spackage manual pages (source) go?"
8003. ./getfile
8004if $test "X$man1direxp" != "X$ansexp"; then
8005 installman1dir=''
8006fi
8007man1dir="$ans"
8008man1direxp="$ansexp"
8009case "$man1dir" in
8010'') man1dir=' '
8011 installman1dir='';;
8012esac
8013
8014: Change installation prefix, if necessary.
8015if $test X"$prefix" != X"$installprefix"; then
8016 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8017else
8018 installman1dir="$man1direxp"
8019fi
8020
8021: What suffix to use on installed man pages
8022
8023case "$man1dir" in
8024' ')
8025 man1ext='0'
8026 ;;
8027*)
8028 rp="What suffix should be used for the main $spackage man pages?"
8029 case "$man1ext" in
8030 '') case "$man1dir" in
8031 *1) dflt=1 ;;
8032 *1p) dflt=1p ;;
8033 *1pm) dflt=1pm ;;
8034 *l) dflt=l;;
8035 *n) dflt=n;;
8036 *o) dflt=o;;
8037 *p) dflt=p;;
8038 *C) dflt=C;;
8039 *L) dflt=L;;
8040 *L1) dflt=L1;;
8041 *) dflt=1;;
8042 esac
8043 ;;
8044 *) dflt="$man1ext";;
8045 esac
8046 . ./myread
8047 man1ext="$ans"
8048 ;;
8049esac
8050
8051: see if we can have long filenames
8052echo " "
8053first=123456789abcdef
8054$rm -f $first
8055if (echo hi >$first) 2>/dev/null; then
8056 if $test -f 123456789abcde; then
8057 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8058 val="$undef"
8059 else
8060 echo 'You can have filenames longer than 14 characters.'>&4
8061 val="$define"
8062 fi
8063else
8064 $cat <<'EOM'
8065You can't have filenames longer than 14 chars.
8066You can't even think about them!
8067EOM
8068 val="$undef"
8069fi
8070set d_flexfnam
8071eval $setvar
8072$rm -rf 123456789abcde*
8073
8074: determine where library module manual pages go
8075set man3dir man3dir none
8076eval $prefixit
8077$cat <<EOM
8078
8079$spackage has manual pages for many of the library modules.
8080EOM
8081
8082case "$nroff" in
8083nroff)
8084 $cat <<'EOM'
8085However, you don't have nroff, so they're probably useless to you.
8086EOM
8087 case "$man3dir" in
8088 '') man3dir="none";;
8089 esac;;
8090esac
8091
8092case "$d_flexfnam" in
8093undef)
8094 $cat <<'EOM'
8095However, your system can't handle the long file names like File::Basename.3.
8096EOM
8097 case "$man3dir" in
8098 '') man3dir="none";;
8099 esac;;
8100esac
8101
8102echo "If you don't want the manual sources installed, answer 'none'."
8103prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8104case "$man3dir" in
8105'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8106 if $test -d "$privlib/man/man3"; then
8107 cat <<EOM >&4
8108
8109WARNING: Previous versions of perl installed man3 pages into
8110$privlib/man/man3. This version will suggest a
8111new default of $dflt.
8112EOM
8113 tdflt=$dflt
8114 dflt='n'
8115 rp='Do you wish to preserve the old behavior?(y/n)'
8116 . ./myread
8117 case "$ans" in
8118 y*) dflt="$privlib/man/man3" ;;
8119 *) dflt=$tdflt ;;
8120 esac
8121 fi
8122 ;;
8123*) dflt="$man3dir" ;;
8124esac
8125case "$dflt" in
8126' ') dflt=none ;;
8127esac
8128echo " "
8129fn=dn+~
8130rp="Where do the $package library man pages (source) go?"
8131. ./getfile
8132man3dir="$ans"
8133man3direxp="$ansexp"
8134case "$man3dir" in
8135'') man3dir=' '
8136 installman3dir='';;
8137esac
8138
8139: Change installation prefix, if necessary.
8140if $test X"$prefix" != X"$installprefix"; then
8141 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8142else
8143 installman3dir="$man3direxp"
8144fi
8145
8146: What suffix to use on installed man pages
8147case "$man3dir" in
8148' ')
8149 man3ext='0'
8150 ;;
8151*)
8152 rp="What suffix should be used for the $package library man pages?"
8153 case "$man3ext" in
8154 '') case "$man3dir" in
8155 *3) dflt=3 ;;
8156 *3p) dflt=3p ;;
8157 *3pm) dflt=3pm ;;
8158 *l) dflt=l;;
8159 *n) dflt=n;;
8160 *o) dflt=o;;
8161 *p) dflt=p;;
8162 *C) dflt=C;;
8163 *L) dflt=L;;
8164 *L3) dflt=L3;;
8165 *) dflt=3;;
8166 esac
8167 ;;
8168 *) dflt="$man3ext";;
8169 esac
8170 . ./myread
8171 man3ext="$ans"
8172 ;;
8173esac
8174
8175: see if we have to deal with yellow pages, now NIS.
0384a54a 8176if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8177 if $test -f /usr/etc/nibindd; then
8178 echo " "
8179 echo "I'm fairly confident you're on a NeXT."
8180 echo " "
8181 rp='Do you get the hosts file via NetInfo?'
8182 dflt=y
8183 case "$hostcat" in
8184 nidump*) ;;
8185 '') ;;
8186 *) dflt=n;;
8187 esac
8188 . ./myread
8189 case "$ans" in
8190 y*) hostcat='nidump hosts .';;
8191 *) case "$hostcat" in
8192 nidump*) hostcat='';;
8193 esac
8194 ;;
8195 esac
8196 fi
8197 case "$hostcat" in
8198 nidump*) ;;
8199 *)
8200 case "$hostcat" in
8201 *ypcat*) dflt=y;;
8202 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8203 dflt=y
8204 else
8205 dflt=n
8206 fi;;
8207 *) dflt=n;;
8208 esac
8209 echo " "
8210 rp='Are you getting the hosts file via yellow pages?'
8211 . ./myread
8212 case "$ans" in
8213 y*) hostcat='ypcat hosts';;
8214 *) hostcat='cat /etc/hosts';;
8215 esac
8216 ;;
8217 esac
8218fi
8219case "$hostcat" in
8220'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8221esac
8222case "$groupcat" in
8223'') test -f /etc/group && groupcat='cat /etc/group';;
8224esac
8225case "$passcat" in
8226'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8227esac
8228
8229: now get the host name
8230echo " "
8231echo "Figuring out host name..." >&4
8232case "$myhostname" in
8233'') cont=true
8234 echo 'Maybe "hostname" will work...'
73614538 8235 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8236 myhostname=$tans
8237 phostname=hostname
8238 cont=''
8239 fi
8240 ;;
8241*) cont='';;
8242esac
8243if $test "$cont"; then
8244 if ./xenix; then
8245 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8246 if tans=`cat /etc/systemid 2>&1` ; then
8247 myhostname=$tans
8248 phostname='cat /etc/systemid'
8249 echo "Whadyaknow. Xenix always was a bit strange..."
8250 cont=''
8251 fi
8252 elif $test -r /etc/systemid; then
8253 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8254 fi
8255fi
8256if $test "$cont"; then
8257 echo 'No, maybe "uuname -l" will work...'
73614538 8258 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8259 myhostname=$tans
8260 phostname='uuname -l'
8261 else
8262 echo 'Strange. Maybe "uname -n" will work...'
73614538 8263 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8264 myhostname=$tans
8265 phostname='uname -n'
8266 else
8267 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8268 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8269 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8270 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8271 else
8272 case "$myhostname" in
8273 '') echo "Does this machine have an identity crisis or something?"
8274 phostname='';;
8275 *)
8276 echo "Well, you said $myhostname before..."
8277 phostname='echo $myhostname';;
8278 esac
8279 fi
8280 fi
8281 fi
8282fi
52a549d0
JH
8283case "$myhostname" in
8284'') myhostname=noname ;;
8285esac
b4eb6b3d
JH
8286: you do not want to know about this
8287set $myhostname
8288myhostname=$1
8289
8290: verify guess
8291if $test "$myhostname" ; then
8292 dflt=y
8293 rp='Your host name appears to be "'$myhostname'".'" Right?"
8294 . ./myread
8295 case "$ans" in
8296 y*) ;;
8297 *) myhostname='';;
8298 esac
8299fi
8300
8301: bad guess or no guess
8302while $test "X$myhostname" = X ; do
8303 dflt=''
8304 rp="Please type the (one word) name of your host:"
8305 . ./myread
8306 myhostname="$ans"
8307done
8308
8309: translate upper to lower if necessary
8310case "$myhostname" in
8311*[A-Z]*)
8312 echo "(Normalizing case in your host name)"
8313 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8314 ;;
8315esac
8316
8317case "$myhostname" in
8318*.*)
8319 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8320 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8321 echo "(Trimming domain name from host name--host name is now $myhostname)"
8322 ;;
8323*) case "$mydomain" in
8324 '')
8325 {
8326 test "X$hostcat" = "Xypcat hosts" &&
8327 ypmatch "$myhostname" hosts 2>/dev/null |\
8328 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8329 $test -s hosts
8330 } || {
8331 test "X$hostcat" != "X" &&
8332 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8333 /[ ]$myhostname[ . ]/p" > hosts
8334 }
8335 tmp_re="[ . ]"
f08cbdd1
PP
8336 if $test -f hosts; then
8337 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8338 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8339 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8340 hosts | $sort | $uniq | \
8341 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8342 case `$echo X$dflt` in
8343 X*\ *) echo "(Several hosts in the database matched hostname)"
8344 dflt=.
8345 ;;
8346 X.) echo "(You do not have fully-qualified names in the hosts database)"
8347 ;;
8348 esac
8349 else
8350 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8351 dflt=.
f08cbdd1 8352 fi
b4eb6b3d
JH
8353 case "$dflt" in
8354 .)
8355 tans=`./loc resolv.conf X /etc /usr/etc`
8356 if $test -f "$tans"; then
8357 echo "(Attempting domain name extraction from $tans)"
8358 dflt=.`$sed -n -e 's/ / /g' \
8359 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8360 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8361 case "$dflt" in
8362 .) dflt=.`$sed -n -e 's/ / /g' \
8363 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8364 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8365 ;;
8366 esac
8367 fi
8368 ;;
8369 esac
8370 case "$dflt" in
8371 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8372 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8373 case "$dflt" in
8374 '') dflt='.';;
8375 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8376 esac
8377 ;;
8378 esac
59c9e5d6
PP
8379 case "$dflt$osname" in
8380 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8381 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8382 ;;
8383 esac
b4eb6b3d
JH
8384 case "$dflt" in
8385 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8386 dflt='.nonet'
b4eb6b3d
JH
8387 ;;
8388 esac
8389 $rm -f hosts
8390 ;;
8391 *) dflt="$mydomain";;
8392 esac;;
8393esac
8394echo " "
8395rp="What is your domain name?"
8396. ./myread
8397tans="$ans"
8398case "$ans" in
8399'') ;;
8400.*) ;;
8401*) tans=".$tans";;
8402esac
8403mydomain="$tans"
8404
8405: translate upper to lower if necessary
8406case "$mydomain" in
8407*[A-Z]*)
8408 echo "(Normalizing case in your domain name)"
8409 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8410 ;;
8411esac
8412
8413: a little sanity check here
8414case "$phostname" in
8415'') ;;
8416*)
8417 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8418 $myhostname$mydomain|$myhostname) ;;
8419 *)
8420 case "$phostname" in
8421 sed*)
8422 echo "(That doesn't agree with your whoami.h file, by the way.)"
8423 ;;
8424 *)
8425 echo "(That doesn't agree with your $phostname command, by the way.)"
8426 ;;
8427 esac
8428 ;;
8429 esac
8430 ;;
8431esac
8432
8433$cat <<EOM
8434
8435I need to get your e-mail address in Internet format if possible, i.e.
8436something like user@host.domain. Please answer accurately since I have
8437no easy means to double check it. The default value provided below
8438is most probably close to reality but may not be valid from outside
8439your organization...
8440
8441EOM
8442cont=x
8443while test "$cont"; do
8444 case "$cf_email" in
8445 '') dflt="$cf_by@$myhostname$mydomain";;
8446 *) dflt="$cf_email";;
8447 esac
8448 rp='What is your e-mail address?'
8449 . ./myread
8450 cf_email="$ans"
8451 case "$cf_email" in
8452 *@*.*) cont='' ;;
8453 *)
8454 rp='Address does not look like an Internet one. Use it anyway?'
8455 case "$fastread" in
8456 yes) dflt=y ;;
8457 *) dflt=n ;;
8458 esac
8459 . ./myread
8460 case "$ans" in
8461 y*) cont='' ;;
8462 *) echo " " ;;
8463 esac
8464 ;;
8465 esac
8466done
8467
8468$cat <<EOM
8469
8470If you or somebody else will be maintaining perl at your site, please
8471fill in the correct e-mail address here so that they may be contacted
8472if necessary. Currently, the "perlbug" program included with perl
8473will send mail to this address in addition to perlbug@perl.org. You may
8474enter "none" for no administrator.
8475
8476EOM
8477case "$perladmin" in
8478'') dflt="$cf_email";;
8479*) dflt="$perladmin";;
8480esac
8481rp='Perl administrator e-mail address'
8482. ./myread
8483perladmin="$ans"
8484
674912d7
RB
8485: determine whether to only install version-specific parts.
8486echo " "
8487$cat <<EOM
8488Do you want to install only the version-specific parts of the perl
8489distribution? Usually you do *not* want to do this.
8490EOM
8491case "$versiononly" in
8492"$define"|[Yy]*|true) dflt='y' ;;
8493*) dflt='n';
8494esac
8495rp="Do you want to install only the version-specific parts of perl?"
8496. ./myread
8497case "$ans" in
8498[yY]*) val="$define";;
8499*) val="$undef" ;;
8500esac
8501set versiononly
8502eval $setvar
8503
ad493445
MB
8504case "$versiononly" in
8505"$define") inc_version_list=''
8506 inc_version_list_init=0
8507 ;;
8508esac
8509
b4eb6b3d
JH
8510: figure out how to guarantee perl startup
8511case "$startperl" in
8512'')
8513 case "$sharpbang" in
8514 *!)
8515 $cat <<EOH
8516
8517I can use the #! construct to start perl on your system. This will
8518make startup of perl scripts faster, but may cause problems if you
8519want to share those scripts and perl is not in a standard place
8520($binexp/perl) on all your platforms. The alternative is to force
8521a shell by starting the script with a single ':' character.
8522
8523EOH
674912d7
RB
8524 case "$versiononly" in
8525 "$define") dflt="$binexp/perl$version";;
8526 *) dflt="$binexp/perl";;
8527 esac
b4eb6b3d
JH
8528 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8529 . ./myread
8530 case "$ans" in
8531 none) startperl=": # use perl";;
8532 *) startperl="#!$ans"
8533 if $test 30 -lt `echo "$ans" | wc -c`; then
8534 $cat >&4 <<EOM
8535
8536WARNING: Some systems limit the #! command to 32 characters.
8537If you experience difficulty running Perl scripts with #!, try
8538installing Perl in a directory with a shorter pathname.
8539
8540EOM
8541 fi ;;
8542 esac
8543 ;;
8544 *) startperl=": # use perl"
8545 ;;
8546 esac
8547 ;;
8548esac
8549echo "I'll use $startperl to start perl scripts."
8550
8551: figure best path for perl in scripts
8552case "$perlpath" in
8553'')
5e20a8ca
RGS
8554 case "$versiononly" in
8555 "$define") perlpath="$binexp/perl$version";;
8556 *) perlpath="$binexp/perl";;
8557 esac
b4eb6b3d
JH
8558 case "$startperl" in
8559 *!*) ;;
8560 *)
8561 $cat <<EOH
8562
8563I will use the "eval 'exec'" idiom to start Perl on your system.
8564I can use the full path of your Perl binary for this purpose, but
8565doing so may cause problems if you want to share those scripts and
8566Perl is not always in a standard place ($binexp/perl).
8567
8568EOH
8569 dflt="$binexp/perl"
8570 rp="What path shall I use in \"eval 'exec'\"?"
8571 . ./myread
8572 perlpath="$ans"
8573 ;;
8574 esac
8575 ;;
8576esac
8577case "$startperl" in
8578*!*) ;;
8579*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8580esac
8581
8582: determine where public executable scripts go
8583set scriptdir scriptdir
8584eval $prefixit
8585case "$scriptdir" in
8586'')
8587 dflt="$bin"
8588 : guess some guesses
8589 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8590 $test -d /usr/share/bin && dflt=/usr/share/bin
8591 $test -d /usr/local/script && dflt=/usr/local/script
8592 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8593 $test -d $prefixexp/script && dflt=$prefixexp/script
8594 set dflt
8595 eval $prefixup
8596 ;;
8597*) dflt="$scriptdir"
8598 ;;
8599esac
8600$cat <<EOM
8601
8602Some installations have a separate directory just for executable scripts so
8603that they can mount it across multiple architectures but keep the scripts in
8604one spot. You might, for example, have a subdirectory of /usr/share for this.
8605Or you might just lump your scripts in with all your other executables.
8606
8607EOM
8608fn=d~
8609rp='Where do you keep publicly executable scripts?'
8610. ./getfile
8611if $test "X$ansexp" != "X$scriptdirexp"; then
8612 installscript=''
8613fi
8614scriptdir="$ans"
8615scriptdirexp="$ansexp"
8616: Change installation prefix, if necessary.
8617if $test X"$prefix" != X"$installprefix"; then
8618 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8619else
8620 installscript="$scriptdirexp"
8621fi
8622
8623: determine where add-on public executables go
8624case "$sitebin" in
8625'') dflt=$siteprefix/bin ;;
8626*) dflt=$sitebin ;;
8627esac
8628fn=d~
8629rp='Pathname where the add-on public executables should be installed?'
8630. ./getfile
8631sitebin="$ans"
8632sitebinexp="$ansexp"
8633: Change installation prefix, if necessary.
8634if $test X"$prefix" != X"$installprefix"; then
8635 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8636else
8637 installsitebin="$sitebinexp"
8638fi
8639
6e1038e0 8640: determine where add-on html pages go
8d2cbf27 8641: There is no standard location, so try to copy the previously-selected
6e1038e0 8642: directory structure for the core html pages.
8d2cbf27
JH
8643case "$sitehtml1dir" in
8644'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8645*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8646esac
8647case "$dflt" in
8648''|' ') dflt=none ;;
8649esac
8650fn=dn+~
8651rp='Pathname where the site-specific html pages should be installed?'
8652. ./getfile
8d2cbf27
JH
8653sitehtml1dir="$ans"
8654sitehtml1direxp="$ansexp"
6e1038e0
MB
8655: Change installation prefix, if necessary.
8656if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8657 installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8658else
8d2cbf27 8659 installsitehtml1dir="$sitehtml1direxp"
6e1038e0
MB
8660fi
8661
8662: determine where add-on library html pages go
8663: There is no standard location, so try to copy the previously-selected
8664: directory structure for the core html pages.
8d2cbf27
JH
8665case "$sitehtml3dir" in
8666'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8667*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8668esac
8669case "$dflt" in
8670''|' ') dflt=none ;;
8671esac
8672fn=dn+~
8673rp='Pathname where the site-specific library html pages should be installed?'
8674. ./getfile
8d2cbf27
JH
8675sitehtml3dir="$ans"
8676sitehtml3direxp="$ansexp"
6e1038e0
MB
8677: Change installation prefix, if necessary.
8678if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8679 installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8680else
8d2cbf27 8681 installsitehtml3dir="$sitehtml3direxp"
6e1038e0
MB
8682fi
8683
8684: determine where add-on manual pages go
91e123a8
JH
8685case "$siteman1dir" in
8686'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8687*) dflt=$siteman1dir ;;
6e1038e0 8688esac
257059b5
JH
8689case "$dflt" in
8690''|' ') dflt=none ;;
8691esac
6e1038e0
MB
8692fn=dn+~
8693rp='Pathname where the site-specific manual pages should be installed?'
8694. ./getfile
91e123a8
JH
8695siteman1dir="$ans"
8696siteman1direxp="$ansexp"
6e1038e0
MB
8697: Change installation prefix, if necessary.
8698if $test X"$prefix" != X"$installprefix"; then
91e123a8 8699 installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8700else
91e123a8 8701 installsiteman1dir="$siteman1direxp"
6e1038e0
MB
8702fi
8703
8704: determine where add-on library man pages go
91e123a8
JH
8705case "$siteman3dir" in
8706'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8707*) dflt=$siteman3dir ;;
6e1038e0 8708esac
257059b5
JH
8709case "$dflt" in
8710''|' ') dflt=none ;;
8711esac
6e1038e0
MB
8712fn=dn+~
8713rp='Pathname where the site-specific library manual pages should be installed?'
8714. ./getfile
91e123a8
JH
8715siteman3dir="$ans"
8716siteman3direxp="$ansexp"
6e1038e0
MB
8717: Change installation prefix, if necessary.
8718if $test X"$prefix" != X"$installprefix"; then
91e123a8 8719 installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8720else
91e123a8 8721 installsiteman3dir="$siteman3direxp"
6e1038e0
MB
8722fi
8723
8724: determine where add-on public executable scripts go
8725case "$sitescript" in
8726'') dflt=$siteprefix/script
8727 $test -d $dflt || dflt=$sitebin ;;
8728*) dflt="$sitescript" ;;
8729esac
8730fn=d~+
8731rp='Pathname where add-on public executable scripts should be installed?'
8732. ./getfile
8733sitescript="$ans"
8734sitescriptexp="$ansexp"
8735: Change installation prefix, if necessary.
8736if $test X"$prefix" != X"$installprefix"; then
8737 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8738else
8739 installsitescript="$sitescriptexp"
8740fi
8741
15b61c98
JH
8742case "$usefaststdio" in
8743$define|true|[yY]*|'')
8744 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8745 case "$xversion" in
8746 [68]) dflt='y' ;;
8747 *) dflt='n' ;;
8748 esac
8749 ;;
8750*) dflt='n';;
8751esac
8752cat <<EOM
8753
8754Perl can be built to use 'fast stdio', which means using the stdio
8755library but also directly manipulating the stdio buffers to enable
8756faster I/O. Using stdio is better for backward compatibility (especially
8757for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8758interface has been preferred instead of stdio.
8759
8760If this doesn't make any sense to you, just accept the default '$dflt'.
8761EOM
8762rp='Use the "fast stdio" if available?'
8763. ./myread
8764case "$ans" in
8765y|Y) val="$define" ;;
8766*) val="$undef" ;;
8767esac
8768set usefaststdio
8769eval $setvar
8770
8771
96056487
JH
8772: define an is-a-typedef? function
8773typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8774case "$inclist" in
8775"") inclist="sys/types.h";;
8776esac;
8777eval "varval=\$$var";
8778case "$varval" in
8779"")
8780 $rm -f temp.c;
8781 for inc in $inclist; do
8782 echo "#include <$inc>" >>temp.c;
8783 done;
8784 echo "#ifdef $type" >> temp.c;
8785 echo "printf(\"We have $type\");" >> temp.c;
8786 echo "#endif" >> temp.c;
8787 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8788 if $contains $type temp.E >/dev/null 2>&1; then
8789 eval "$var=\$type";
8790 else
8791 eval "$var=\$def";
8792 fi;
8793 $rm -f temp.?;;
8794*) eval "$var=\$varval";;
8795esac'
8796
8797: define an is-a-typedef? function that prompts if the type is not available.
8798typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8799case "$inclist" in
8800"") inclist="sys/types.h";;
8801esac;
8802eval "varval=\$$var";
8803case "$varval" in
8804"")
8805 $rm -f temp.c;
8806 for inc in $inclist; do
8807 echo "#include <$inc>" >>temp.c;
8808 done;
8809 echo "#ifdef $type" >> temp.c;
8810 echo "printf(\"We have $type\");" >> temp.c;
8811 echo "#endif" >> temp.c;
8812 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8813 echo " " ;
8814 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8815 if $contains $type temp.E >/dev/null 2>&1; then
8816 echo "$type found." >&4;
8817 eval "$var=\$type";
8818 else
8819 echo "$type NOT found." >&4;
8820 dflt="$def";
8821 . ./myread ;
8822 eval "$var=\$ans";
8823 fi;
8824 $rm -f temp.?;;
8825*) eval "$var=\$varval";;
8826esac'
8827
8828: see what type lseek is declared as in the kernel
8829rp="What is the type used for lseek's offset on this system?"
8830set off_t lseektype long stdio.h sys/types.h
8831eval $typedef_ask
8832
8833echo " "
8834echo "Checking to see how big your file offsets are..." >&4
8835$cat >try.c <<EOCP
8836#include <sys/types.h>
8837#include <stdio.h>
8838int main()
8839{
8840 printf("%d\n", (int)sizeof($lseektype));
8841 return(0);
8842}
8843EOCP
8844set try
8845if eval $compile_ok; then
8846 lseeksize=`$run ./try`
8847 echo "Your file offsets are $lseeksize bytes long."
8848else
8849 dflt=$longsize
8850 echo " "
8851 echo "(I can't seem to compile the test program. Guessing...)"
8852 rp="What is the size of your file offsets (in bytes)?"
8853 . ./myread
8854 lseeksize="$ans"
8855fi
8856$rm -f try.c try
8857
8858: see what type file positions are declared as in the library
8859rp="What is the type for file position used by fsetpos()?"
8860set fpos_t fpostype long stdio.h sys/types.h
8861eval $typedef_ask
8862
8863echo " "
8864case "$fpostype" in
8865*_t) zzz="$fpostype" ;;
8866*) zzz="fpos_t" ;;
8867esac
8868echo "Checking the size of $zzz..." >&4
8869cat > try.c <<EOCP
8870#include <sys/types.h>
8871#include <stdio.h>
d1daaddf
JH
8872#$i_stdlib I_STDLIB
8873#ifdef I_STDLIB
8874#include <stdlib.h>
8875#endif
96056487
JH
8876int main() {
8877 printf("%d\n", (int)sizeof($fpostype));
8878 exit(0);
8879}
8880EOCP
8881set try
8882if eval $compile_ok; then
8883 yyy=`$run ./try`
8884 case "$yyy" in
8885 '') fpossize=4
8886 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8887 ;;
8888 *) fpossize=$yyy
8889 echo "Your $zzz is $fpossize bytes long."
8890 ;;
8891 esac
8892else
8893 dflt="$longsize"
8894 echo " " >&4
8895 echo "(I can't compile the test program. Guessing...)" >&4
8896 rp="What is the size of your file positions (in bytes)?"
8897 . ./myread
8898 fpossize="$ans"
8899fi
8900
96056487
JH
8901# Backward compatibility (uselfs is deprecated).
8902case "$uselfs" in
8903"$define"|true|[yY]*)
8904 cat <<EOM >&4
8905
8906*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8907EOM
8908 uselargefiles="$define"
8909 ;;
8910esac
8911
8912case "$lseeksize:$fpossize" in
89138:8) cat <<EOM
8914
8915You can have files larger than 2 gigabytes.
8916EOM
8917 val="$define" ;;
8918*) case "$uselargefiles" in
8919 "$undef"|false|[nN]*) dflt='n' ;;
8920 *) dflt='y' ;;
8921 esac
8922 cat <<EOM
8923
8924Perl can be built to understand large files (files larger than 2 gigabytes)
8925on some systems. To do so, Configure can be run with -Duselargefiles.
8926
8927If this doesn't make any sense to you, just accept the default '$dflt'.
8928EOM
8929 rp='Try to understand large files, if available?'
8930 . ./myread
8931 case "$ans" in
8932 y|Y) val="$define" ;;
8933 *) val="$undef" ;;
8934 esac
8935 ;;
8936esac
8937set uselargefiles
8938eval $setvar
96056487
JH
8939: Look for a hint-file generated 'call-back-unit'. If the
8940: user has specified that a large files perl is to be built,
8941: we may need to set or change some other defaults.
9da7673b
MB
8942if $test -f uselargefiles.cbu; then
8943 echo "Your platform has some specific hints regarding large file builds, using them..."
8944 . ./uselargefiles.cbu
8945fi
8946case "$uselargefiles" in
8947"$define")
96056487 8948 if $test -f uselargefiles.cbu; then
96056487
JH
8949 echo " "
8950 echo "Rechecking to see how big your file offsets are..." >&4
8951 $cat >try.c <<EOCP
8952#include <sys/types.h>
8953#include <stdio.h>
8954int main()
8955{
8956 printf("%d\n", (int)sizeof($lseektype));
8957 return(0);
8958}
8959EOCP
8960 set try
8961 if eval $compile_ok; then
8962 lseeksize=`$run ./try`
8963 $echo "Your file offsets are now $lseeksize bytes long."
8964 else
8965 dflt="$lseeksize"
8966 echo " "
8967 echo "(I can't seem to compile the test program. Guessing...)"
8968 rp="What is the size of your file offsets (in bytes)?"
8969 . ./myread
8970 lseeksize="$ans"
8971 fi
8972 case "$fpostype" in
8973 *_t) zzz="$fpostype" ;;
8974 *) zzz="fpos_t" ;;
8975 esac
8976 $echo $n "Rechecking the size of $zzz...$c" >&4
8977 $cat > try.c <<EOCP
8978#include <sys/types.h>
8979#include <stdio.h>
55954f19
JH
8980#$i_stdlib I_STDLIB
8981#ifdef I_STDLIB
8982#include <stdlib.h>
8983#endif
96056487
JH
8984int main() {
8985 printf("%d\n", (int)sizeof($fpostype));
073b6de5 8986 return(0);
96056487
JH
8987}
8988EOCP
8989 set try
8990 if eval $compile_ok; then
8991 yyy=`$run ./try`
8992 dflt="$lseeksize"
8993 case "$yyy" in
8994 '') echo " "
8995 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8996 ;;
8997 *) fpossize=$yyy
8998 echo " $fpossize bytes." >&4
8999 ;;
9000 esac
9001 else
9002 dflt="$fpossize"
9003 echo " "
9004 echo "(I can't compile the test program. Guessing...)" >&4
9005 rp="What is the size of your file positions (in bytes)?"
9006 . ./myread
9007 fpossize="$ans"
9008 fi
9009 $rm -f try.c try
9010 fi
9011 ;;
9012esac
9013
db0f2be4
MB
9014# probably will refer to
9015# $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9016need_relocation=0
9017userelocatableinc=undef
9018
b4eb6b3d
JH
9019case "$vendorprefix" in
9020'') d_vendorbin="$undef"
9021 vendorbin=''
9022 vendorbinexp=''
9023 ;;
9024*) d_vendorbin="$define"
9025 : determine where vendor-supplied executables go.
9026 case "$vendorbin" in
9027 '') dflt=$vendorprefix/bin ;;
9028 *) dflt="$vendorbin" ;;
9029 esac
9030 fn=d~+
9031 rp='Pathname for the vendor-supplied executables directory?'
9032 . ./getfile
9033 vendorbin="$ans"
9034 vendorbinexp="$ansexp"
9035 ;;
9036esac
9037: Change installation prefix, if necessary.
9038if $test X"$prefix" != X"$installprefix"; then
9039 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9040else
9041 installvendorbin="$vendorbinexp"
9042fi
9043
6e1038e0 9044case "$vendorprefix" in
8d2cbf27
JH
9045'') vendorhtml1dir=''
9046 vendorhtml1direxp=''
6e1038e0
MB
9047 ;;
9048*) : determine where vendor-supplied html pages go.
9049 : There is no standard location, so try to copy the previously-selected
9050 : directory structure for the core html pages.
9051 : XXX Better default suggestions would be welcome.
8d2cbf27 9052 case "$vendorhtml1dir" in
6e1038e0 9053 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9054 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9055 esac
9056 case "$dflt" in
9057 ''|' ') dflt=none ;;
9058 esac
9059 fn=dn+~
9060 rp='Pathname for the vendor-supplied html pages?'
9061 . ./getfile
8d2cbf27
JH
9062 vendorhtml1dir="$ans"
9063 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9064 ;;
9065esac
9066: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9067$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
6e1038e0
MB
9068: Change installation prefix, if necessary.
9069if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9070 installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9071else
8d2cbf27 9072 installvendorhtml1dir="$vendorhtml1direxp"
6e1038e0
MB
9073fi
9074
9075case "$vendorprefix" in
8d2cbf27
JH
9076'') vendorhtml3dir=''
9077 vendorhtml3direxp=''
6e1038e0
MB
9078 ;;
9079*) : determine where vendor-supplied module html pages go.
9080 : There is no standard location, so try to copy the previously-selected
9081 : directory structure for the core html pages.
9082 : XXX Better default suggestions would be welcome.
8d2cbf27 9083 case "$vendorhtml3dir" in
6e1038e0 9084 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9085 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9086 esac
9087 case "$dflt" in
9088 ''|' ') dflt=none ;;
9089 esac
9090 fn=dn+~
9091 rp='Pathname for the vendor-supplied html pages?'
9092 . ./getfile
8d2cbf27
JH
9093 vendorhtml3dir="$ans"
9094 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9095 ;;
9096esac
9097: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9098$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
6e1038e0
MB
9099: Change installation prefix, if necessary.
9100if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9101 installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9102else
8d2cbf27 9103 installvendorhtml3dir="$vendorhtml3direxp"
6e1038e0
MB
9104fi
9105
9106case "$vendorprefix" in
91e123a8
JH
9107'') vendorman1dir=''
9108 vendorman1direxp=''
6e1038e0
MB
9109 ;;
9110*) : determine where vendor-supplied manual pages go.
91e123a8 9111 case "$vendorman1dir" in
6e1038e0 9112 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9113 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9114 esac
9115 case "$dflt" in
9116 ''|' ') dflt=none ;;
9117 esac
9118 fn=nd~+
9119 rp='Pathname for the vendor-supplied manual section 1 pages?'
9120 . ./getfile
91e123a8
JH
9121 vendorman1dir="$ans"
9122 vendorman1direxp="$ansexp"
6e1038e0
MB
9123 ;;
9124esac
9125: Use ' ' for none so value is preserved next time through Configure
91e123a8 9126$test X"$vendorman1dir" = "X" && vendorman1dir=' '
6e1038e0
MB
9127: Change installation prefix, if necessary.
9128if $test X"$prefix" != X"$installprefix"; then
91e123a8 9129 installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9130else
91e123a8 9131 installvendorman1dir="$vendorman1direxp"
6e1038e0
MB
9132fi
9133
9134case "$vendorprefix" in
91e123a8
JH
9135'') vendorman3dir=''
9136 vendorman3direxp=''
6e1038e0
MB
9137 ;;
9138*) : determine where vendor-supplied module manual pages go.
91e123a8 9139 case "$vendorman3dir" in
6e1038e0 9140 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9141 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9142 esac
9143 case "$dflt" in
9144 ''|' ') dflt=none ;;
9145 esac
9146 fn=nd~+
9147 rp='Pathname for the vendor-supplied manual section 3 pages?'
9148 . ./getfile
91e123a8
JH
9149 vendorman3dir="$ans"
9150 vendorman3direxp="$ansexp"
6e1038e0
MB
9151 ;;
9152esac
9153: Use ' ' for none so value is preserved next time through Configure
91e123a8 9154$test X"$vendorman3dir" = "X" && vendorman3dir=' '
6e1038e0
MB
9155: Change installation prefix, if necessary.
9156if $test X"$prefix" != X"$installprefix"; then
91e123a8 9157 installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9158else
91e123a8 9159 installvendorman3dir="$vendorman3direxp"
6e1038e0
MB
9160fi
9161
9162case "$vendorprefix" in
9163'') d_vendorscript="$undef"
9164 vendorscript=''
9165 vendorscriptexp=''
9166 ;;
9167*) d_vendorscript="$define"
9168 : determine where vendor-supplied scripts go.
9169 case "$vendorscript" in
9170 '') dflt=$vendorprefix/script
9171 $test -d $dflt || dflt=$vendorbin ;;
9172 *) dflt="$vendorscript" ;;
9173 esac
9174 $cat <<EOM
9175
9176The installation process will create a directory for
9177vendor-supplied scripts.
9178
9179EOM
9180 fn=d~+
9181 rp='Pathname for the vendor-supplied scripts directory?'
9182 . ./getfile
9183 vendorscript="$ans"
9184 vendorscriptexp="$ansexp"
9185 ;;
9186esac
9187: Change installation prefix, if necessary.
9188if $test X"$prefix" != X"$installprefix"; then
9189 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9190else
9191 installvendorscript="$vendorscriptexp"
9192fi
9193
b4eb6b3d
JH
9194: see if qgcvt exists
9195set qgcvt d_qgcvt
9196eval $inlibc
9197
89ce900e
JH
9198echo " "
9199
9200if $test X"$d_longdbl" = X"$define"; then
9201
9202echo "Checking how to print long doubles..." >&4
9203
9204if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9205 $cat >try.c <<'EOCP'
9206#include <sys/types.h>
9207#include <stdio.h>
9208int main() {
9209 double d = 123.456;
9210 printf("%.3f\n", d);
9211}
9212EOCP
9213 set try
9214 if eval $compile; then
9215 yyy=`$run ./try`
9216 case "$yyy" in
9217 123.456)
9218 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9219 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9220 echo "We will use %f."
9221 ;;
9222 esac
9223 fi
9224fi
9225
9226if $test X"$sPRIfldbl" = X; then
9227 $cat >try.c <<'EOCP'
9228#include <sys/types.h>
9229#include <stdio.h>
9230int main() {
9231 long double d = 123.456;
9232 printf("%.3Lf\n", d);
9233}
9234EOCP
9235 set try
9236 if eval $compile; then
9237 yyy=`$run ./try`
9238 case "$yyy" in
9239 123.456)
9240 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9241 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9242 echo "We will use %Lf."
9243 ;;
9244 esac
9245 fi
9246fi
9247
9248if $test X"$sPRIfldbl" = X; then
9249 $cat >try.c <<'EOCP'
9250#include <sys/types.h>
9251#include <stdio.h>
9252int main() {
9253 long double d = 123.456;
9254 printf("%.3llf\n", d);
9255}
9256EOCP
9257 set try
9258 if eval $compile; then
9259 yyy=`$run ./try`
9260 case "$yyy" in
9261 123.456)
9262 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9263 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9264 echo "We will use %llf."
9265 ;;
9266 esac
9267 fi
9268fi
9269
9270if $test X"$sPRIfldbl" = X; then
9271 $cat >try.c <<'EOCP'
9272#include <sys/types.h>
9273#include <stdio.h>
9274int main() {
9275 long double d = 123.456;
9276 printf("%.3lf\n", d);
9277}
9278EOCP
9279 set try
9280 if eval $compile; then
9281 yyy=`$run ./try`
9282 case "$yyy" in
9283 123.456)
9284 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9285 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9286 echo "We will use %lf."
9287 ;;
9288 esac
9289 fi
9290fi
9291
9292if $test X"$sPRIfldbl" = X; then
9293 echo "Cannot figure out how to print long doubles." >&4
9294else
9295 sSCNfldbl=$sPRIfldbl # expect consistency
9296fi
9297
9298$rm -f try try.*
9299
9300fi # d_longdbl
9301
9302case "$sPRIfldbl" in
9303'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9304 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9305 d_SCNfldbl="$undef";
9306 ;;
9307*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9308 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9309 d_SCNfldbl="$define";
9310 ;;
9311esac
9312
b4eb6b3d 9313: Check how to convert floats to strings.
a5b10d80
YST
9314
9315if test "X$d_Gconvert" = X; then
9316
b4eb6b3d
JH
9317echo " "
9318echo "Checking for an efficient way to convert floats to strings."
9319echo " " > try.c
9320case "$uselongdouble" in
9321"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9322esac
9323case "$d_longdbl" in
9324"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9325esac
9326case "$d_PRIgldbl" in
9327"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9328esac
9329$cat >>try.c <<EOP
9330#ifdef TRY_gconvert
9331#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9332char *myname = "gconvert";
9333#endif
9334#ifdef TRY_gcvt
9335#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9336char *myname = "gcvt";
9337#endif
9338#ifdef TRY_qgcvt
9339#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9340char *myname = "qgcvt";
9341#define DOUBLETYPE long double
9342#endif
9343#ifdef TRY_sprintf
a5b10d80
YST
9344#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9345#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9346#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9347#else
a5b10d80
YST
9348#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9349#endif
9350#else
b4eb6b3d
JH
9351#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9352#endif
9353char *myname = "sprintf";
9354#endif
9355
9356#ifndef DOUBLETYPE
9357#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9358#define DOUBLETYPE long double
9359#else
9360#define DOUBLETYPE double
9361#endif
9362#endif
9363
9364#include <stdio.h>
9365
9366#define I_STDLIB $i_stdlib
9367#ifdef I_STDLIB
9368#include <stdlib.h>
9369#endif
9370
9371int
9372checkit(expect, got)
9373char *expect;
9374char *got;
9375{
9376 if (strcmp(expect, got)) {
9377 printf("%s oddity: Expected %s, got %s\n",
9378 myname, expect, got);
9379 exit(1);
9380 }
9381}
9382
9383int main()
9384{
9385 char buf[64];
9386 buf[63] = '\0';
9387
9388 /* This must be 1st test on (which?) platform */
9389 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9390 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9391 checkit("0.1", buf);
9392
a5b10d80
YST
9393 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9394 checkit("0.01", buf);
9395
9396 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9397 checkit("0.001", buf);
9398
9399 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9400 checkit("0.0001", buf);
9401
9402 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9403 if (strlen(buf) > 5)
9404 checkit("9e-005", buf); /* for Microsoft ?? */
9405 else
9406 checkit("9e-05", buf);
9407
b4eb6b3d
JH
9408 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9409 checkit("1", buf);
9410
9411 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9412 checkit("1.1", buf);
9413
9414 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9415 checkit("1.01", buf);
9416
9417 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9418 checkit("1.001", buf);
9419
9420 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9421 checkit("1.0001", buf);
9422
9423 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9424 checkit("1.00001", buf);
9425
9426 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9427 checkit("1.000001", buf);
9428
9429 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9430 checkit("0", buf);
9431
9432 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9433 checkit("-1", buf);
9434
9435 /* Some Linux gcvt's give 1.e+5 here. */
9436 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9437 checkit("100000", buf);
9438
9439 /* Some Linux gcvt's give -1.e+5 here. */
9440 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9441 checkit("-100000", buf);
9442
9443 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9444 checkit("123.456", buf);
9445
ab6ca9f4 9446 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9447 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9448 /* 34 should be enough to scare even long double
9449 * places into using the e notation. */
ab6ca9f4 9450 if (strlen(buf) > 5)
94b339ad 9451 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9452 else
94b339ad 9453 checkit("1e+34", buf);
8e2a5ede 9454
d1eb8299
YST
9455 /* For Perl, if you add additional tests here, also add them to
9456 * t/base/num.t for benefit of platforms not using Configure or
9457 * overriding d_Gconvert */
9458
b4eb6b3d
JH
9459 exit(0);
9460}
9461EOP
ab6ca9f4 9462: first add preferred functions to our list
a5b10d80 9463xxx_list=""
ab6ca9f4 9464for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9465 case $xxx_convert in
9466 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9467 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9468 esac
9469done
9470: then add any others
9471for xxx_convert in gconvert gcvt sprintf; do
9472 case "$xxx_list" in
9473 *$xxx_convert*) ;;
9474 *) xxx_list="$xxx_list $xxx_convert" ;;
9475 esac
9476done
9477
9478case "$d_longdbl$uselongdouble" in
9479"$define$define")
9480 : again, add prefered functions to our list first
9481 xxx_ld_list=""
ab6ca9f4 9482 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9483 case $xxx_convert in
9484 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9485 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9486 esac
9487 done
9488 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9489 for xxx_convert in qgcvt sprintf $xxx_list; do
9490 case "$xxx_ld_list" in
9491 $xxx_convert*|*" $xxx_convert"*) ;;
9492 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9493 esac
9494 done
9495 : if sprintf cannot do long doubles, move it to the end
9496 if test "$d_PRIgldbl" != "$define"; then
9497 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9498 fi
9499 : if no qgcvt, remove it
9500 if test "$d_qgcvt" != "$define"; then
9501 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9502 fi
9503 : use the ld_list
9504 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9505 ;;
9506esac
9507
9508for xxx_convert in $xxx_list; do
9509 echo "Trying $xxx_convert..."
9510 $rm -f try try$_o
9511 set try -DTRY_$xxx_convert
9512 if eval $compile; then
9513 echo "$xxx_convert() found." >&4
5440bc8e 9514 if $run ./try; then
b4eb6b3d
JH
9515 echo "I'll use $xxx_convert to convert floats into a string." >&4
9516 break;
9517 else
9518 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9519 xxx_convert=''
b4eb6b3d
JH
9520 fi
9521 else
9522 echo "$xxx_convert NOT found." >&4
9523 fi
9524done
ab6ca9f4 9525
a5b10d80
YST
9526if test X$xxx_convert = X; then
9527 echo "*** WHOA THERE!!! ***" >&4
9528 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9529 xxx_convert=sprintf
9530fi
9531
b4eb6b3d
JH
9532case "$xxx_convert" in
9533gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9534gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9535qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9536*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9537 "$define$define$define")
9538 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9539 "$define$define$undef")
9540 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9541 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9542 esac
9543 ;;
9544esac
9545
a5b10d80
YST
9546fi
9547
74cac757
JH
9548: see if _fwalk exists
9549set fwalk d__fwalk
9550eval $inlibc
9551
b4eb6b3d
JH
9552: Initialize h_fcntl
9553h_fcntl=false
9554
9555: Initialize h_sysfile
9556h_sysfile=false
9557
9558: access call always available on UNIX
9559set access d_access
9560eval $inlibc
9561
9562: locate the flags for 'access()'
9563case "$d_access" in
9564"$define")
9565 echo " "
55954f19 9566 $cat >access.c <<EOCP
b4eb6b3d
JH
9567#include <sys/types.h>
9568#ifdef I_FCNTL
9569#include <fcntl.h>
9570#endif
9571#ifdef I_SYS_FILE
9572#include <sys/file.h>
9573#endif
9574#ifdef I_UNISTD
9575#include <unistd.h>
9576#endif
55954f19
JH
9577#$i_stdlib I_STDLIB
9578#ifdef I_STDLIB
9579#include <stdlib.h>
9580#endif
b4eb6b3d
JH
9581int main() {
9582 exit(R_OK);
9583}
9584EOCP
9585 : check sys/file.h first, no particular reason here
9586 if $test `./findhdr sys/file.h` && \
7a282f6d 9587 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9588 h_sysfile=true;
9589 echo "<sys/file.h> defines the *_OK access constants." >&4
9590 elif $test `./findhdr fcntl.h` && \
7a282f6d 9591 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9592 h_fcntl=true;
9593 echo "<fcntl.h> defines the *_OK access constants." >&4
9594 elif $test `./findhdr unistd.h` && \
7a282f6d 9595 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9596 echo "<unistd.h> defines the *_OK access constants." >&4
9597 else
9598 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9599 fi
9600 ;;
9601esac
9602$rm -f access*
9603
9604: see if accessx exists
9605set accessx d_accessx
9606eval $inlibc
9607
89ce900e
JH
9608: see if aintl exists
9609set aintl d_aintl
9610eval $inlibc
9611
b4eb6b3d
JH
9612: see if alarm exists
9613set alarm d_alarm
9614eval $inlibc
9615
a9dade78
JH
9616: see if POSIX threads are available
9617set pthread.h i_pthread
9618eval $inhdr
9619
10bc17b6
JH
9620: define a fucntion to check prototypes
9621$cat > protochk <<EOSH
9622$startsh
9623cc="$cc"
9624optimize="$optimize"
9625ccflags="$ccflags"
9626prototype="$prototype"
9627define="$define"
9628rm=$rm
a9dade78
JH
9629usethreads=$usethreads
9630i_pthread=$i_pthread
9631pthread_h_first=$pthread_h_first
10bc17b6
JH
9632EOSH
9633
9634$cat >> protochk <<'EOSH'
9635
9636$rm -f try.c
9637foo="$1"
9638shift
9639while test $# -ge 2; do
9640 case "$1" in
9641 $define) echo "#include <$2>" >> try.c ;;
9642 literal) echo "$2" >> try.c ;;
9643 esac
cce6a207
MB
9644 # Extra magic for the benefit of systems that need pthread.h
9645 # to be included early to correctly detect threadsafe functions.
9646 # Such functions must guarantee themselves, though, that the usethreads
9647 # and i_pthread have been defined, before calling protochk.
9648 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9649 echo "#include <pthread.h>" >> try.c
9650 pthread_h_done=yes
9651 fi
10bc17b6
JH
9652 shift 2
9653done
9654test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9655cat >> try.c <<'EOCP'
9656#ifdef CAN_PROTOTYPE
9657#define _(args) args
9658#else
9659#define _(args) ()
9660#endif
9661EOCP
9662echo "$foo" >> try.c
9663echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9664$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9665status=$?
9666$rm -f try.[co]
9667exit $status
9668EOSH
9669chmod +x protochk
9670$eunicefix protochk
9671
89ce900e
JH
9672hasproto='varname=$1; func=$2; shift; shift;
9673while $test $# -ge 2; do
9674 case "$1" in
9675 $define) echo "#include <$2>";;
9676 esac ;
9677 shift 2;
9678done > try.c;
9679$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9680if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9681 echo "$func() prototype found.";
9682 val="$define";
9683else
9684 echo "$func() prototype NOT found.";
9685 val="$undef";
9686fi;
9687set $varname;
9688eval $setvar;
9689$rm -f try.c tryout.c'
9690
10bc17b6
JH
9691: see if sys/types.h has to be included
9692set sys/types.h i_systypes
9693eval $inhdr
9694
9695: see if sys/select.h has to be included
9696set sys/select.h i_sysselct
9697eval $inhdr
9698
9699hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9700while $test $# -ge 2; do
9701 case "$1" in
9702 $define) echo "#include <$2>";;
9703 esac ;
9704 shift 2;
9705done > try.c;
9706echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9707set try;
9708if eval $compile; then
9709 val="$define";
9710else
9711 val="$undef";
9712fi;
9713set $varname;
9714eval $setvar;
9715$rm -f try.c try.o'
9716
9717: see if we should include time.h, sys/time.h, or both
9718echo " "
9719if test "X$timeincl" = X; then
9720 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9721 $echo $n "I'm now running the test program...$c"
55954f19 9722 $cat >try.c <<EOCP
10bc17b6
JH
9723#include <sys/types.h>
9724#ifdef I_TIME
9725#include <time.h>
9726#endif
9727#ifdef I_SYSTIME
9728#ifdef SYSTIMEKERNEL
9729#define KERNEL
9730#endif
9731#include <sys/time.h>
9732#endif
9733#ifdef I_SYSSELECT
9734#include <sys/select.h>
9735#endif
55954f19
JH
9736#$i_stdlib I_STDLIB
9737#ifdef I_STDLIB
9738#include <stdlib.h>
9739#endif
10bc17b6
JH
9740int main()
9741{
9742 struct tm foo;
9743#ifdef S_TIMEVAL
9744 struct timeval bar;
9745#endif
9746#ifdef S_TIMEZONE
9747 struct timezone tzp;
9748#endif
9749 if (foo.tm_sec == foo.tm_sec)
9750 exit(0);
9751#ifdef S_TIMEVAL
9752 if (bar.tv_sec == bar.tv_sec)
9753 exit(0);
9754#endif
9755 exit(1);
9756}
9757EOCP
9758 flags=''
9759 for s_timezone in '-DS_TIMEZONE' ''; do
9760 sysselect=''
9761 for s_timeval in '-DS_TIMEVAL' ''; do
9762 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9763 for i_time in '' '-DI_TIME'; do
9764 for i_systime in '-DI_SYSTIME' ''; do
9765 case "$flags" in
9766 '') $echo $n ".$c"
9767 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9768 if eval $compile; then
9769 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9770 shift
9771 flags="$*"
9772 echo " "
9773 $echo $n "Succeeded with $flags$c"
9774 fi
9775 ;;
9776 esac
9777 done
9778 done
9779 done
9780 done
9781 done
9782 timeincl=''
9783 echo " "
9784 case "$flags" in
9785 *SYSTIMEKERNEL*) i_systimek="$define"
9786 timeincl=`./findhdr sys/time.h`
9787 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9788 *) i_systimek="$undef";;
9789 esac
9790 case "$flags" in
9791 *I_TIME*) i_time="$define"
9792 timeincl=`./findhdr time.h`" $timeincl"
9793 echo "We'll include <time.h>." >&4;;
9794 *) i_time="$undef";;
9795 esac
9796 case "$flags" in
9797 *I_SYSTIME*) i_systime="$define"
9798 timeincl=`./findhdr sys/time.h`" $timeincl"
9799 echo "We'll include <sys/time.h>." >&4;;
9800 *) i_systime="$undef";;
9801 esac
9802 $rm -f try.c try
9803fi
9804: see if struct tm knows about tm_zone
9805case "$i_systime$i_time" in
9806*$define*)
9807 echo " "
9808 echo "Checking to see if your struct tm has tm_zone field..." >&4
9809 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9810 eval $hasfield
9811 ;;
9812*) val="$undef"
9813 set d_tm_tm_zone
9814 eval $setvar
9815 ;;
9816esac
9817case "$d_tm_tm_zone" in
9818"$define") echo "Yes, it does." ;;
9819*) echo "No, it doesn't." ;;
9820esac
9821: see if struct tm knows about tm_gmtoff
9822case "$i_systime$i_time" in
9823*$define*)
9824 echo " "
9825 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9826 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9827 eval $hasfield
9828 ;;
9829*) val="$undef"
9830 set d_tm_tm_gmtoff
9831 eval $setvar
9832 ;;
9833esac
9834case "$d_tm_tm_gmtoff" in
9835"$define") echo "Yes, it does." ;;
9836*) echo "No, it doesn't." ;;
9837esac
9838
9839: see if asctime_r exists
9840set asctime_r d_asctime_r
9841eval $inlibc
9842case "$d_asctime_r" in
9843"$define")
d63eadf0 9844 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9845 case "$d_asctime_r_proto:$usethreads" in
9846 ":define") d_asctime_r_proto=define
a48ec845
JH
9847 set d_asctime_r_proto asctime_r $hdrs
9848 eval $hasproto ;;
9849 *) ;;
9850 esac
9851 case "$d_asctime_r_proto" in
9852 define)
10bc17b6
JH
9853 case "$asctime_r_proto" in
9854 ''|0) try='char* asctime_r(const struct tm*, char*);'
9855 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9856 esac
9857 case "$asctime_r_proto" in
9858 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9859 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9860 esac
9861 case "$asctime_r_proto" in
9862 ''|0) try='int asctime_r(const struct tm*, char*);'
9863 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9864 esac
9865 case "$asctime_r_proto" in
9866 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9867 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9868 esac
9869 case "$asctime_r_proto" in
90e831dc 9870 ''|0) d_asctime_r=undef
10bc17b6 9871 asctime_r_proto=0
a48ec845 9872 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9873 * ) case "$asctime_r_proto" in
9874 REENTRANT_PROTO*) ;;
9875 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9876 esac
9877 echo "Prototype: $try" ;;
9878 esac
9879 ;;
c18e646a
JH
9880 *) case "$usethreads" in
9881 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9882 esac
90e831dc
SB
9883 d_asctime_r=undef
9884 asctime_r_proto=0
c18e646a 9885 ;;
a48ec845
JH
9886 esac
9887 ;;
10bc17b6
JH
9888*) asctime_r_proto=0
9889 ;;
9890esac
9891
b4eb6b3d
JH
9892: see if atolf exists
9893set atolf d_atolf
9894eval $inlibc
9895
9896: see if atoll exists
9897set atoll d_atoll
9898eval $inlibc
9899
0dbb1585
AL
9900: Look for GCC-style attribute format
9901case "$d_attribute_format" in
bde30f85 9902'')
b4eb6b3d 9903echo " "
0dbb1585 9904echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9905$cat >attrib.c <<'EOCP'
9906#include <stdio.h>
0dbb1585 9907void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9908EOCP
9909if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9910 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9911 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9912 val="$undef"
9913 else
0dbb1585 9914 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9915 val="$define"
9916 fi
9917else
9918 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9919 val="$undef"
9920fi
bde30f85 9921;;
0dbb1585 9922*) val="$d_attribute_format" ;;
bde30f85 9923esac
0dbb1585
AL
9924set d_attribute_format
9925eval $setvar
9926$rm -f attrib*
9927
9928: Look for GCC-style attribute malloc
9929case "$d_attribute_malloc" in
9930'')
9931echo " "
9932echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9933$cat >attrib.c <<'EOCP'
9934#include <stdio.h>
9935char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9936EOCP
9937if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9938 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9939 echo "Your C compiler doesn't support __attribute__((malloc))."
9940 val="$undef"
9941 else
9942 echo "Your C compiler supports __attribute__((malloc))."
9943 val="$define"
9944 fi
9945else
9946 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9947 val="$undef"
9948fi
9949;;
9950*) val="$d_attribute_malloc" ;;
9951esac
9952set d_attribute_malloc
9953eval $setvar
9954$rm -f attrib*
9955
9956: Look for GCC-style attribute nonnull
9957case "$d_attribute_nonnull" in
9958'')
9959echo " "
9960echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9961$cat >attrib.c <<'EOCP'
9962#include <stdio.h>
9963void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9964EOCP
9965if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9966 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9967 echo "Your C compiler doesn't support __attribute__((nonnull))."
9968 val="$undef"
9969 else
9970 echo "Your C compiler supports __attribute__((nonnull))."
9971 val="$define"
9972 fi
9973else
9974 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9975 val="$undef"
9976fi
9977;;
9978*) val="$d_attribute_nonnull" ;;
9979esac
9980set d_attribute_nonnull
9981eval $setvar
9982$rm -f attrib*
9983
9984: Look for GCC-style attribute noreturn
9985case "$d_attribute_noreturn" in
9986'')
9987echo " "
9988echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9989$cat >attrib.c <<'EOCP'
9990#include <stdio.h>
9991void fall_over_dead( void ) __attribute__((noreturn));
9992EOCP
9993if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9994 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9995 echo "Your C compiler doesn't support __attribute__((noreturn))."
9996 val="$undef"
9997 else
9998 echo "Your C compiler supports __attribute__((noreturn))."
9999 val="$define"
10000 fi
10001else
10002 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10003 val="$undef"
10004fi
10005;;
10006*) val="$d_attribute_noreturn" ;;
10007esac
10008set d_attribute_noreturn
10009eval $setvar
10010$rm -f attrib*
10011
10012: Look for GCC-style attribute pure
10013case "$d_attribute_pure" in
10014'')
10015echo " "
10016echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10017$cat >attrib.c <<'EOCP'
10018#include <stdio.h>
10019int square( int n ) __attribute__((pure));
10020EOCP
10021if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10022 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10023 echo "Your C compiler doesn't support __attribute__((pure))."
10024 val="$undef"
10025 else
10026 echo "Your C compiler supports __attribute__((pure))."
10027 val="$define"
10028 fi
10029else
10030 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10031 val="$undef"
10032fi
10033;;
10034*) val="$d_attribute_pure" ;;
10035esac
10036set d_attribute_pure
10037eval $setvar
10038$rm -f attrib*
10039
10040: Look for GCC-style attribute unused
10041case "$d_attribute_unused" in
10042'')
10043echo " "
10044echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10045$cat >attrib.c <<'EOCP'
10046#include <stdio.h>
10047int do_something( int dummy __attribute__((unused)), int n );
10048EOCP
10049if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10050 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10051 echo "Your C compiler doesn't support __attribute__((unused))."
10052 val="$undef"
10053 else
10054 echo "Your C compiler supports __attribute__((unused))."
10055 val="$define"
10056 fi
10057else
10058 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10059 val="$undef"
10060fi
10061;;
10062*) val="$d_attribute_unused" ;;
10063esac
10064set d_attribute_unused
10065eval $setvar
10066$rm -f attrib*
10067
10068: Look for GCC-style attribute warn_unused_result
10069case "$d_attribute_warn_unused_result" in
10070'')
10071echo " "
10072echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10073$cat >attrib.c <<'EOCP'
10074#include <stdio.h>
10075int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10076EOCP
10077if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10078 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10079 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10080 val="$undef"
10081 else
10082 echo "Your C compiler supports __attribute__((warn_unused_result))."
10083 val="$define"
10084 fi
10085else
10086 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10087 val="$undef"
10088fi
10089;;
10090*) val="$d_attribute_warn_unused_result" ;;
10091esac
10092set d_attribute_warn_unused_result
b4eb6b3d
JH
10093eval $setvar
10094$rm -f attrib*
10095
10096: see if bcmp exists
10097set bcmp d_bcmp
10098eval $inlibc
10099
10100: see if bcopy exists
10101set bcopy d_bcopy
10102eval $inlibc
10103
10104: see if this is a unistd.h system
10105set unistd.h i_unistd
10106eval $inhdr
10107
10108: see if getpgrp exists
10109set getpgrp d_getpgrp
10110eval $inlibc
10111
10112case "$d_getpgrp" in
10113"$define")
10114 echo " "
10115 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10116 $cat >try.c <<EOP
b4eb6b3d
JH
10117#$i_unistd I_UNISTD
10118#include <sys/types.h>
10119#ifdef I_UNISTD
10120# include <unistd.h>
10121#endif
55954f19
JH
10122#$i_stdlib I_STDLIB
10123#ifdef I_STDLIB
10124#include <stdlib.h>
10125#endif
b4eb6b3d
JH
10126int main()
10127{
10128 if (getuid() == 0) {
10129 printf("(I see you are running Configure as super-user...)\n");
10130 setuid(1);
10131 }
10132#ifdef TRY_BSD_PGRP
10133 if (getpgrp(1) == 0)
10134 exit(0);
10135#else
10136 if (getpgrp() > 0)
10137 exit(0);
10138#endif
10139 exit(1);
10140}
10141EOP
5440bc8e 10142 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10143 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10144 val="$define"
5440bc8e 10145 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10146 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10147 val="$undef"
10148 else
10149 echo "I can't seem to compile and run the test program."
10150 if ./usg; then
10151 xxx="a USG one, i.e. you use getpgrp()."
10152 else
10153 # SVR4 systems can appear rather BSD-ish.
10154 case "$i_unistd" in
10155 $undef)
10156 xxx="a BSD one, i.e. you use getpgrp(pid)."
10157 val="$define"
10158 ;;
10159 $define)
10160 xxx="probably a USG one, i.e. you use getpgrp()."
10161 val="$undef"
10162 ;;
10163 esac
10164 fi
10165 echo "Assuming your getpgrp is $xxx" >&4
10166 fi
10167 ;;
10168*) val="$undef";;
10169esac
10170set d_bsdgetpgrp
10171eval $setvar
5440bc8e 10172$rm -f try try.*
b4eb6b3d
JH
10173
10174: see if setpgrp exists
10175set setpgrp d_setpgrp
10176eval $inlibc
10177
10178case "$d_setpgrp" in
10179"$define")
10180 echo " "
10181 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10182 $cat >try.c <<EOP
b4eb6b3d
JH
10183#$i_unistd I_UNISTD
10184#include <sys/types.h>
10185#ifdef I_UNISTD
10186# include <unistd.h>
10187#endif
55954f19
JH
10188#$i_stdlib I_STDLIB
10189#ifdef I_STDLIB
10190#include <stdlib.h>
10191#endif
b4eb6b3d
JH
10192int main()
10193{
10194 if (getuid() == 0) {
10195 printf("(I see you are running Configure as super-user...)\n");
10196 setuid(1);
10197 }
10198#ifdef TRY_BSD_PGRP
10199 if (-1 == setpgrp(1, 1))
10200 exit(0);
10201#else
10202 if (setpgrp() != -1)
10203 exit(0);
10204#endif
10205 exit(1);
10206}
10207EOP
5440bc8e 10208 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10209 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10210 val="$define"
5440bc8e 10211 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10212 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10213 val="$undef"
10214 else
10215 echo "(I can't seem to compile and run the test program.)"
10216 if ./usg; then
10217 xxx="a USG one, i.e. you use setpgrp()."
10218 else
10219 # SVR4 systems can appear rather BSD-ish.
10220 case "$i_unistd" in
10221 $undef)
10222 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10223 val="$define"
10224 ;;
10225 $define)
10226 xxx="probably a USG one, i.e. you use setpgrp()."
10227 val="$undef"
10228 ;;
10229 esac
10230 fi
10231 echo "Assuming your setpgrp is $xxx" >&4
10232 fi
10233 ;;
10234*) val="$undef";;
10235esac
10236set d_bsdsetpgrp
10237eval $setvar
5440bc8e 10238$rm -f try try.*
b4eb6b3d
JH
10239: see if bzero exists
10240set bzero d_bzero
10241eval $inlibc
10242
10243: see if signal is declared as pointer to function returning int or void
10244echo " "
10245xxx=`./findhdr signal.h`
10246$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10247if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10248 echo "You have int (*signal())() instead of void." >&4
10249 val="$undef"
10250elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10251 echo "You have void (*signal())()." >&4
10252 val="$define"
10253elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10254 echo "You have int (*signal())() instead of void." >&4
10255 val="$undef"
10256elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10257 echo "You have void (*signal())()." >&4
10258 val="$define"
10259else
10260 case "$d_voidsig" in
10261 '')
10262 echo "I can't determine whether signal handler returns void or int..." >&4
10263 dflt=void
10264 rp="What type does your signal handler return?"
10265 . ./myread
10266 case "$ans" in
10267 v*) val="$define";;
10268 *) val="$undef";;
10269 esac;;
10270 "$define")
10271 echo "As you already told me, signal handler returns void." >&4
10272 val="$define"
10273 ;;
10274 *) echo "As you already told me, signal handler returns int." >&4
10275 val="$undef"
10276 ;;
10277 esac
10278fi
10279set d_voidsig
10280eval $setvar
10281case "$d_voidsig" in
10282"$define") signal_t="void";;
10283*) signal_t="int";;
10284esac
10285$rm -f $$.tmp
10286
10287: check for ability to cast large floats to 32-bit ints.
10288echo " "
10289echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10290if $test "$intsize" -ge 4; then
10291 xxx=int
10292else
10293 xxx=long
10294fi
10295$cat >try.c <<EOCP
10296#include <stdio.h>
d1daaddf
JH
10297#$i_stdlib I_STDLIB
10298#ifdef I_STDLIB
10299#include <stdlib.h>
10300#endif
b4eb6b3d
JH
10301#include <sys/types.h>
10302#include <signal.h>
10303$signal_t blech(s) int s; { exit(3); }
10304int main()
10305{
10306 $xxx i32;
10307 double f, g;
10308 int result = 0;
10309 char str[16];
10310 signal(SIGFPE, blech);
10311
10312 /* Don't let compiler optimize the test away. Store the number
10313 in a writable string for gcc to pass to sscanf under HP/UX.
10314 */
10315 sprintf(str, "2147483647");
10316 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10317 g = 10 * f;
10318 i32 = ($xxx) g;
10319
10320 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10321 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10322 behavior here, which is to preserve the sign and give
10323 back 0x7fff ffff.
10324 */
10325 if (i32 != ($xxx) f)
10326 result |= 1;
10327 exit(result);
10328}
10329EOCP
10330set try
10331if eval $compile_ok; then
5440bc8e 10332 $run ./try
b4eb6b3d
JH
10333 yyy=$?
10334else
10335 echo "(I can't seem to compile the test program--assuming it can't)"
10336 yyy=1
10337fi
10338case "$yyy" in
103390) val="$define"
10340 echo "Yup, it can."
10341 ;;
10342*) val="$undef"
10343 echo "Nope, it can't."
10344 ;;
10345esac
10346set d_casti32
10347eval $setvar
10348$rm -f try try.*
10349
10350: check for ability to cast negative floats to unsigned
10351echo " "
10352echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10353$cat >try.c <<EOCP
10354#include <stdio.h>
d1daaddf
JH
10355#$i_stdlib I_STDLIB
10356#ifdef I_STDLIB
10357#include <stdlib.h>
10358#endif
b4eb6b3d
JH
10359#include <sys/types.h>
10360#include <signal.h>
10361$signal_t blech(s) int s; { exit(7); }
10362$signal_t blech_in_list(s) int s; { exit(4); }
10363unsigned long dummy_long(p) unsigned long p; { return p; }
10364unsigned int dummy_int(p) unsigned int p; { return p; }
10365unsigned short dummy_short(p) unsigned short p; { return p; }
10366int main()
10367{
10368 double f;
10369 unsigned long along;
10370 unsigned int aint;
10371 unsigned short ashort;
10372 int result = 0;
10373 char str[16];
10374
10375 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10376 a direct f = -123. assignment. gcc-2.8.0 reportedly
10377 optimized the whole file away
10378 */
10379 /* Store the number in a writable string for gcc to pass to
10380 sscanf under HP/UX.
10381 */
10382 sprintf(str, "-123");
10383 sscanf(str, "%lf", &f); /* f = -123.; */
10384
10385 signal(SIGFPE, blech);
10386 along = (unsigned long)f;
10387 aint = (unsigned int)f;
10388 ashort = (unsigned short)f;
10389 if (along != (unsigned long)-123)
10390 result |= 1;
10391 if (aint != (unsigned int)-123)
10392 result |= 1;
10393 if (ashort != (unsigned short)-123)
10394 result |= 1;
10395 sprintf(str, "1073741824.");
10396 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10397 f = f + f;
10398 along = 0;
10399 along = (unsigned long)f;
10400 if (along != 0x80000000)
10401 result |= 2;
10402 f -= 1.;
10403 along = 0;
10404 along = (unsigned long)f;
10405 if (along != 0x7fffffff)
10406 result |= 1;
10407 f += 2.;
10408 along = 0;
10409 along = (unsigned long)f;
10410 if (along != 0x80000001)
10411 result |= 2;
10412 if (result)
10413 exit(result);
10414 signal(SIGFPE, blech_in_list);
10415 sprintf(str, "123.");
10416 sscanf(str, "%lf", &f); /* f = 123.; */
10417 along = dummy_long((unsigned long)f);
10418 aint = dummy_int((unsigned int)f);
10419 ashort = dummy_short((unsigned short)f);
10420 if (along != (unsigned long)123)
10421 result |= 4;
10422 if (aint != (unsigned int)123)
10423 result |= 4;
10424 if (ashort != (unsigned short)123)
10425 result |= 4;
10426 exit(result);
10427
10428}
10429EOCP
10430set try
10431if eval $compile_ok; then
5440bc8e 10432 $run ./try
b4eb6b3d
JH
10433 castflags=$?
10434else
10435 echo "(I can't seem to compile the test program--assuming it can't)"
10436 castflags=7
10437fi
10438case "$castflags" in
104390) val="$define"
10440 echo "Yup, it can."
10441 ;;
10442*) val="$undef"
10443 echo "Nope, it can't."
10444 ;;
10445esac
10446set d_castneg
10447eval $setvar
10448$rm -f try.*
10449
10450: see if vprintf exists
10451echo " "
10452if set vprintf val -f d_vprintf; eval $csym; $val; then
10453 echo 'vprintf() found.' >&4
10454 val="$define"
55954f19 10455 $cat >try.c <<EOF
b4eb6b3d 10456#include <varargs.h>
55954f19
JH
10457#$i_stdlib I_STDLIB
10458#ifdef I_STDLIB
10459#include <stdlib.h>
10460#endif
b4eb6b3d
JH
10461
10462int main() { xxx("foo"); }
10463
10464xxx(va_alist)
10465va_dcl
10466{
10467 va_list args;
10468 char buf[10];
10469
10470 va_start(args);
10471 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10472}
10473EOF
5440bc8e
JH
10474 set try
10475 if eval $compile && $run ./try; then
b4eb6b3d
JH
10476 echo "Your vsprintf() returns (int)." >&4
10477 val2="$undef"
10478 else
10479 echo "Your vsprintf() returns (char*)." >&4
10480 val2="$define"
10481 fi
10482else
10483 echo 'vprintf() NOT found.' >&4
10484 val="$undef"
10485 val2="$undef"
10486fi
5440bc8e 10487$rm -f try try.*
b4eb6b3d
JH
10488set d_vprintf
10489eval $setvar
10490val=$val2
10491set d_charvspr
10492eval $setvar
10493
10494: see if chown exists
10495set chown d_chown
10496eval $inlibc
10497
10498: see if chroot exists
10499set chroot d_chroot
10500eval $inlibc
10501
10502: see if chsize exists
10503set chsize d_chsize
10504eval $inlibc
10505
758a5d79
JH
10506: see if class exists
10507set class d_class
10508eval $inlibc
10509
b0a2e8e6
MB
10510: see if clearenv exists
10511set clearenv d_clearenv
10512eval $inlibc
10513
4e0554ec
JH
10514hasstruct='varname=$1; struct=$2; shift; shift;
10515while $test $# -ge 2; do
10516 case "$1" in
10517 $define) echo "#include <$2>";;
10518 esac ;
10519 shift 2;
10520done > try.c;
10521echo "int main () { struct $struct foo; }" >> try.c;
10522set try;
10523if eval $compile; then
10524 val="$define";
10525else
10526 val="$undef";
10527fi;
10528set $varname;
10529eval $setvar;
10530$rm -f try.c try.o'
10531
4e0554ec
JH
10532socketlib=''
10533sockethdr=''
10534: see whether socket exists
10535echo " "
10536$echo $n "Hmm... $c" >&4
10537if set socket val -f d_socket; eval $csym; $val; then
10538 echo "Looks like you have Berkeley networking support." >&4
10539 d_socket="$define"
10540 if set setsockopt val -f; eval $csym; $val; then
10541 d_oldsock="$undef"
10542 else
10543 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10544 d_oldsock="$define"
10545 fi
10546else
10547 if $contains socklib libc.list >/dev/null 2>&1; then
10548 echo "Looks like you have Berkeley networking support." >&4
10549 d_socket="$define"
10550 : we will have to assume that it supports the 4.2 BSD interface
10551 d_oldsock="$undef"
10552 else
10553 echo "You don't have Berkeley networking in libc$_a..." >&4
10554 if test "X$d_socket" = "X$define"; then
10555 echo "...but you seem to believe that you have sockets." >&4
10556 else
10557 for net in net socket
10558 do
10559 if test -f /usr/lib/lib$net$_a; then
10560 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10561 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10562 if $contains socket libc.list >/dev/null 2>&1; then
10563 d_socket="$define"
10564 socketlib="-l$net"
10565 case "$net" in
10566 net)
10567 echo "...but the Wollongong group seems to have hacked it in." >&4
10568 sockethdr="-I/usr/netinclude"
10569 ;;
10570 esac
3c728e00 10571 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10572 if $contains setsockopt libc.list >/dev/null 2>&1; then
10573 d_oldsock="$undef"
10574 else
10575 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10576 d_oldsock="$define"
10577 fi
10578 break
10579 fi
10580 fi
10581 done
10582 if test "X$d_socket" != "X$define"; then
10583 echo "or anywhere else I see." >&4
10584 d_socket="$undef"
10585 d_oldsock="$undef"
10586 fi
10587 fi
10588 fi
10589fi
10590
10591: see if socketpair exists
10592set socketpair d_sockpair
10593eval $inlibc
10594
10595
10596echo " "
3c728e00 10597echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10598for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10599 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10600 $cat >try.c <<EOF
10601#include <sys/types.h>
10602#include <sys/socket.h>
10603int main() {
10604 int i = $ENUM;
10605}
10606EOF
10607 val="$undef"
10608 set try; if eval $compile; then
10609 val="$define"
10610 fi
10611 set d_${enum}; eval $setvar
10612 $rm -f try.c try
10613done
10614
10615: see if this is a sys/uio.h system
10616set sys/uio.h i_sysuio
10617eval $inhdr
10618
10619
10620echo " "
10621echo "Checking to see if your system supports struct cmsghdr..." >&4
10622set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10623eval $hasstruct
10624case "$d_cmsghdr_s" in
10625"$define") echo "Yes, it does." ;;
10626*) echo "No, it doesn't." ;;
10627esac
10628
10629
b4eb6b3d
JH
10630: check for const keyword
10631echo " "
10632echo 'Checking to see if your C compiler knows about "const"...' >&4
10633$cat >const.c <<'EOCP'
10634typedef struct spug { int drokk; } spug;
76f47787 10635int main()
b4eb6b3d
JH
10636{
10637 const char *foo;
10638 const spug y;
10639}
10640EOCP
10641if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10642 val="$define"
10643 echo "Yup, it does."
10644else
10645 val="$undef"
10646 echo "Nope, it doesn't."
10647fi
10648set d_const
10649eval $setvar
10650
89ce900e
JH
10651: see if copysignl exists
10652set copysignl d_copysignl
10653eval $inlibc
10654
b4eb6b3d
JH
10655: see if crypt exists
10656echo " "
a5a94ea5
JH
10657set crypt d_crypt
10658eval $inlibc
10659case "$d_crypt" in
10660$define) cryptlib='' ;;
10661*) if set crypt val -f d_crypt; eval $csym; $val; then
10662 echo 'crypt() found.' >&4
b4eb6b3d 10663 val="$define"
a5a94ea5
JH
10664 cryptlib=''
10665 else
10666 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10667 if $test -z "$cryptlib"; then
10668 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10669 else
10670 cryptlib=-lcrypt
10671 fi
10672 if $test -z "$cryptlib"; then
10673 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10674 else
10675 cryptlib=-lcrypt
10676 fi
10677 if $test -z "$cryptlib"; then
10678 cryptlib=`./loc libcrypt$_a "" $libpth`
10679 else
10680 cryptlib=-lcrypt
10681 fi
10682 if $test -z "$cryptlib"; then
10683 echo 'crypt() NOT found.' >&4
10684 val="$undef"
10685 else
10686 val="$define"
10687 fi
b4eb6b3d 10688 fi
a5a94ea5
JH
10689 set d_crypt
10690 eval $setvar
10691 ;;
10692esac
b4eb6b3d 10693
10bc17b6
JH
10694: see if this is a crypt.h system
10695set crypt.h i_crypt
10696eval $inhdr
10697
10698: see if crypt_r exists
10699set crypt_r d_crypt_r
10700eval $inlibc
10701case "$d_crypt_r" in
10702"$define")
10703 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10704 case "$d_crypt_r_proto:$usethreads" in
10705 ":define") d_crypt_r_proto=define
a48ec845
JH
10706 set d_crypt_r_proto crypt_r $hdrs
10707 eval $hasproto ;;
10708 *) ;;
10709 esac
10710 case "$d_crypt_r_proto" in
10711 define)
10bc17b6
JH
10712 case "$crypt_r_proto" in
10713 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10714 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10715 esac
10716 case "$crypt_r_proto" in
b430fd04
JH
10717 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10718 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10719 esac
10720 case "$crypt_r_proto" in
90e831dc 10721 ''|0) d_crypt_r=undef
10bc17b6 10722 crypt_r_proto=0
a48ec845 10723 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10724 * ) case "$crypt_r_proto" in
10725 REENTRANT_PROTO*) ;;
10726 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10727 esac
10728 echo "Prototype: $try" ;;
10729 esac
10730 ;;
c18e646a
JH
10731 *) case "$usethreads" in
10732 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10733 esac
90e831dc
SB
10734 d_crypt_r=undef
10735 crypt_r_proto=0
c18e646a 10736 ;;
a48ec845
JH
10737 esac
10738 ;;
10bc17b6
JH
10739*) crypt_r_proto=0
10740 ;;
10741esac
10742
b4eb6b3d
JH
10743: get csh whereabouts
10744case "$csh" in
10745'csh') val="$undef" ;;
10746*) val="$define" ;;
10747esac
10748set d_csh
10749eval $setvar
10750: Respect a hint or command line value for full_csh.
10751case "$full_csh" in
10752'') full_csh=$csh ;;
10753esac
10754
10bc17b6
JH
10755: see if ctermid_r exists
10756set ctermid_r d_ctermid_r
10757eval $inlibc
10758case "$d_ctermid_r" in
10759"$define")
31ee0cb7 10760 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10761 case "$d_ctermid_r_proto:$usethreads" in
10762 ":define") d_ctermid_r_proto=define
a48ec845
JH
10763 set d_ctermid_r_proto ctermid_r $hdrs
10764 eval $hasproto ;;
10765 *) ;;
10766 esac
10767 case "$d_ctermid_r_proto" in
10768 define)
10bc17b6
JH
10769 case "$ctermid_r_proto" in
10770 ''|0) try='char* ctermid_r(char*);'
10771 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10772 esac
10773 case "$ctermid_r_proto" in
90e831dc 10774 ''|0) d_ctermid_r=undef
10bc17b6 10775 ctermid_r_proto=0
a48ec845 10776 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10777 * ) case "$ctermid_r_proto" in
10778 REENTRANT_PROTO*) ;;
10779 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10780 esac
10781 echo "Prototype: $try" ;;
10782 esac
10783 ;;
c18e646a
JH
10784 *) case "$usethreads" in
10785 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10786 esac
90e831dc
SB
10787 d_ctermid_r=undef
10788 ctermid_r_proto=0
c18e646a 10789 ;;
a48ec845
JH
10790 esac
10791 ;;
10bc17b6
JH
10792*) ctermid_r_proto=0
10793 ;;
10794esac
10795
10796: see if ctime_r exists
10797set ctime_r d_ctime_r
10798eval $inlibc
10799case "$d_ctime_r" in
10800"$define")
d63eadf0 10801 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10802 case "$d_ctime_r_proto:$usethreads" in
10803 ":define") d_ctime_r_proto=define
a48ec845
JH
10804 set d_ctime_r_proto ctime_r $hdrs
10805 eval $hasproto ;;
10806 *) ;;
10807 esac
10808 case "$d_ctime_r_proto" in
10809 define)
10bc17b6
JH
10810 case "$ctime_r_proto" in
10811 ''|0) try='char* ctime_r(const time_t*, char*);'
10812 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10813 esac
10814 case "$ctime_r_proto" in
10815 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10816 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10817 esac
10818 case "$ctime_r_proto" in
10819 ''|0) try='int ctime_r(const time_t*, char*);'
10820 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10821 esac
10822 case "$ctime_r_proto" in
10823 ''|0) try='int ctime_r(const time_t*, char*, int);'
10824 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10825 esac
10826 case "$ctime_r_proto" in
90e831dc 10827 ''|0) d_ctime_r=undef
10bc17b6 10828 ctime_r_proto=0
a48ec845 10829 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10830 * ) case "$ctime_r_proto" in
10831 REENTRANT_PROTO*) ;;
10832 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10833 esac
10834 echo "Prototype: $try" ;;
10835 esac
10836 ;;
c18e646a
JH
10837 *) case "$usethreads" in
10838 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10839 esac
90e831dc
SB
10840 d_ctime_r=undef
10841 ctime_r_proto=0
c18e646a 10842 ;;
a48ec845
JH
10843 esac
10844 ;;
10bc17b6
JH
10845*) ctime_r_proto=0
10846 ;;
10847esac
10848
b4eb6b3d
JH
10849: see if cuserid exists
10850set cuserid d_cuserid
10851eval $inlibc
10852
10853: see if this is a limits.h system
10854set limits.h i_limits
10855eval $inhdr
10856
10857: see if this is a float.h system
10858set float.h i_float
10859eval $inhdr
10860
10861: See if number of significant digits in a double precision number is known
10862echo " "
10863$cat >dbl_dig.c <<EOM
10864#$i_limits I_LIMITS
10865#$i_float I_FLOAT
10866#ifdef I_LIMITS
10867#include <limits.h>
10868#endif
10869#ifdef I_FLOAT
10870#include <float.h>
10871#endif
10872#ifdef DBL_DIG
10873printf("Contains DBL_DIG");
10874#endif
10875EOM
10876$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10877if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10878 echo "DBL_DIG found." >&4
10879 val="$define"
10880else
10881 echo "DBL_DIG NOT found." >&4
10882 val="$undef"
10883fi
10884$rm -f dbl_dig.?
10885set d_dbl_dig
10886eval $setvar
10887
2ef53570
JH
10888: see if dbm.h is available
10889: see if dbmclose exists
10890set dbmclose d_dbmclose
10891eval $inlibc
10892
10893case "$d_dbmclose" in
10894$define)
10895 set dbm.h i_dbm
10896 eval $inhdr
10897 case "$i_dbm" in
10898 $define)
10899 val="$undef"
10900 set i_rpcsvcdbm
10901 eval $setvar
10902 ;;
10903 *) set rpcsvc/dbm.h i_rpcsvcdbm
10904 eval $inhdr
10905 ;;
10906 esac
10907 ;;
10908*) echo "We won't be including <dbm.h>"
10909 val="$undef"
10910 set i_dbm
10911 eval $setvar
10912 val="$undef"
10913 set i_rpcsvcdbm
10914 eval $setvar
10915 ;;
10916esac
10917
10918: see if prototype for dbminit is available
10919echo " "
10920set d_dbminitproto dbminit $i_dbm dbm.h
10921eval $hasproto
10922
b4eb6b3d
JH
10923: see if difftime exists
10924set difftime d_difftime
10925eval $inlibc
10926
10927: see if this is a dirent system
10928echo " "
10929if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10930 val="$define"
10931 echo "<dirent.h> found." >&4
10932else
10933 val="$undef"
10934 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10935 echo "<sys/dir.h> found." >&4
10936 echo " "
10937 else
10938 xinc=`./findhdr sys/ndir.h`
10939 fi
10940 echo "<dirent.h> NOT found." >&4
10941fi
10942set i_dirent
10943eval $setvar
10944
10945: Look for type of directory structure.
10946echo " "
10947$cppstdin $cppflags $cppminus < "$xinc" > try.c
10948
10949case "$direntrytype" in
10950''|' ')
10951 case "$i_dirent" in
10952 $define) guess1='struct dirent' ;;
10953 *) guess1='struct direct' ;;
10954 esac
10955 ;;
10956*) guess1="$direntrytype"
10957 ;;
10958esac
10959
10960case "$guess1" in
10961'struct dirent') guess2='struct direct' ;;
10962*) guess2='struct dirent' ;;
10963esac
10964
10965if $contains "$guess1" try.c >/dev/null 2>&1; then
10966 direntrytype="$guess1"
10967 echo "Your directory entries are $direntrytype." >&4
10968elif $contains "$guess2" try.c >/dev/null 2>&1; then
10969 direntrytype="$guess2"
10970 echo "Your directory entries seem to be $direntrytype." >&4
10971else
10972 echo "I don't recognize your system's directory entries." >&4
10973 rp="What type is used for directory entries on this system?"
10974 dflt="$guess1"
10975 . ./myread
10976 direntrytype="$ans"
10977fi
10978$rm -f try.c
10979
10980
10981: see if the directory entry stores field length
10982echo " "
10983$cppstdin $cppflags $cppminus < "$xinc" > try.c
10984if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10985 echo "Good, your directory entry keeps length information in d_namlen." >&4
10986 val="$define"
10987else
10988 echo "Your directory entry does not know about the d_namlen field." >&4
10989 val="$undef"
10990fi
10991set d_dirnamlen
10992eval $setvar
10993$rm -f try.c
10994
ae0e3d3b
JH
10995: see if this is an sysdir system
10996set sys/dir.h i_sysdir
10997eval $inhdr
10998
10999: see if this is an sysndir system
11000set sys/ndir.h i_sysndir
11001eval $inhdr
11002
11003: Look for dirfd
11004echo " "
11005$cat >dirfd.c <<EOM
11006#include <stdio.h>
55954f19
JH
11007#$i_stdlib I_STDLIB
11008#ifdef I_STDLIB
11009#include <stdlib.h>
11010#endif
ae0e3d3b
JH
11011#$i_dirent I_DIRENT /**/
11012#$i_sysdir I_SYS_DIR /**/
11013#$i_sysndir I_SYS_NDIR /**/
11014#$i_systypes I_SYS_TYPES /**/
11015#if defined(I_SYS_TYPES)
11016#include <sys/types.h>
11017#endif
11018#if defined(I_DIRENT)
11019#include <dirent.h>
11020#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11021#include <sys/dir.h>
11022#endif
11023#else
11024#ifdef I_SYS_NDIR
11025#include <sys/ndir.h>
11026#else
11027#ifdef I_SYS_DIR
11028#ifdef hp9000s500
11029#include <ndir.h> /* may be wrong in the future */
11030#else
11031#include <sys/dir.h>
11032#endif
11033#endif
11034#endif
11035#endif
11036int main() {
11037 DIR *dirp = opendir(".");
11038 if (dirfd(dirp) >= 0)
11039 exit(0);
11040 else
11041 exit(1);
11042}
11043EOM
5cadb3f3 11044val=$undef
ae0e3d3b
JH
11045set dirfd
11046if eval $compile; then
11047 val="$define"
11048fi
11049case "$val" in
11050$define) echo "dirfd() found." >&4 ;;
11051*) echo "dirfd() NOT found." >&4 ;;
11052esac
11053set d_dirfd
11054eval $setvar
11055$rm -f dirfd*
11056
b4eb6b3d
JH
11057: see if dlerror exists
11058xxx_runnm="$runnm"
11059runnm=false
11060set dlerror d_dlerror
11061eval $inlibc
11062runnm="$xxx_runnm"
11063
11064: see if dlfcn is available
11065set dlfcn.h i_dlfcn
11066eval $inhdr
11067
11068case "$usedl" in
11069$define|y|true)
11070 $cat << EOM
11071
11072On a few systems, the dynamically loaded modules that perl generates and uses
11073will need a different extension than shared libs. The default will probably
11074be appropriate.
11075
11076EOM
11077 case "$dlext" in
11078 '') dflt="$so" ;;
11079 *) dflt="$dlext" ;;
11080 esac
11081 rp='What is the extension of dynamically loaded modules'
11082 . ./myread
11083 dlext="$ans"
11084 ;;
11085*)
11086 dlext="none"
11087 ;;
11088esac
11089
11090: Check if dlsym need a leading underscore
11091echo " "
11092val="$undef"
11093
11094case "$dlsrc" in
11095dl_dlopen.xs)
11096 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11097 $cat >dyna.c <<'EOM'
11098fred () { }
11099EOM
11100
11101$cat >fred.c<<EOM
11102
11103#include <stdio.h>
55954f19
JH
11104#$i_stdlib I_STDLIB
11105#ifdef I_STDLIB
11106#include <stdlib.h>
11107#endif
b4eb6b3d
JH
11108#$i_dlfcn I_DLFCN
11109#ifdef I_DLFCN
5440bc8e 11110#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11111#else
11112#include <sys/types.h>
11113#include <nlist.h>
11114#include <link.h>
11115#endif
11116
11117extern int fred() ;
11118
11119int main()
11120{
11121 void * handle ;
11122 void * symbol ;
11123#ifndef RTLD_LAZY
11124 int mode = 1 ;
11125#else
11126 int mode = RTLD_LAZY ;
11127#endif
11128 handle = dlopen("./dyna.$dlext", mode) ;
11129 if (handle == NULL) {
11130 printf ("1\n") ;
11131 fflush (stdout) ;
11132 exit(0);
11133 }
11134 symbol = dlsym(handle, "fred") ;
11135 if (symbol == NULL) {
11136 /* try putting a leading underscore */
11137 symbol = dlsym(handle, "_fred") ;
11138 if (symbol == NULL) {
11139 printf ("2\n") ;
11140 fflush (stdout) ;
11141 exit(0);
11142 }
11143 printf ("3\n") ;
11144 }
11145 else
11146 printf ("4\n") ;
11147 fflush (stdout) ;
11148 exit(0);
11149}
11150EOM
11151 : Call the object file tmp-dyna.o in case dlext=o.
11152 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11153 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11154 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11155 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11156 xxx=`$run ./fred`
b4eb6b3d
JH
11157 case $xxx in
11158 1) echo "Test program failed using dlopen." >&4
11159 echo "Perhaps you should not use dynamic loading." >&4;;
11160 2) echo "Test program failed using dlsym." >&4
11161 echo "Perhaps you should not use dynamic loading." >&4;;
11162 3) echo "dlsym needs a leading underscore" >&4
11163 val="$define" ;;
11164 4) echo "dlsym doesn't need a leading underscore." >&4;;
11165 esac
11166 else
11167 echo "I can't compile and run the test program." >&4
11168 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11169 fi
11170 ;;
11171esac
11172
3c728e00 11173$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11174
11175set d_dlsymun
11176eval $setvar
11177
10bc17b6
JH
11178: see if drand48_r exists
11179set drand48_r d_drand48_r
11180eval $inlibc
11181case "$d_drand48_r" in
11182"$define")
11183 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11184 case "$d_drand48_r_proto:$usethreads" in
11185 ":define") d_drand48_r_proto=define
a48ec845
JH
11186 set d_drand48_r_proto drand48_r $hdrs
11187 eval $hasproto ;;
11188 *) ;;
11189 esac
11190 case "$d_drand48_r_proto" in
11191 define)
10bc17b6
JH
11192 case "$drand48_r_proto" in
11193 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11194 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11195 esac
11196 case "$drand48_r_proto" in
90e831dc 11197 ''|0) d_drand48_r=undef
10bc17b6 11198 drand48_r_proto=0
a48ec845 11199 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11200 * ) case "$drand48_r_proto" in
11201 REENTRANT_PROTO*) ;;
11202 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11203 esac
11204 echo "Prototype: $try" ;;
11205 esac
11206 ;;
c18e646a
JH
11207 *) case "$usethreads" in
11208 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11209 esac
90e831dc
SB
11210 d_drand48_r=undef
11211 drand48_r_proto=0
c18e646a 11212 ;;
a48ec845
JH
11213 esac
11214 ;;
10bc17b6
JH
11215*) drand48_r_proto=0
11216 ;;
11217esac
11218
11219: see if prototype for drand48 is available
11220echo " "
11221set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11222eval $hasproto
11223
b4eb6b3d
JH
11224: see if dup2 exists
11225set dup2 d_dup2
11226eval $inlibc
11227
11228: see if eaccess exists
11229set eaccess d_eaccess
11230eval $inlibc
11231
11232: see if endgrent exists
11233set endgrent d_endgrent
11234eval $inlibc
11235
10bc17b6
JH
11236: see if this is an grp system
11237set grp.h i_grp
11238eval $inhdr
11239
11240case "$i_grp" in
11241$define)
11242 xxx=`./findhdr grp.h`
11243 $cppstdin $cppflags $cppminus < $xxx >$$.h
11244
11245 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11246 val="$define"
11247 else
11248 val="$undef"
11249 fi
11250 set d_grpasswd
11251 eval $setvar
11252
11253 $rm -f $$.h
11254 ;;
11255*)
11256 val="$undef";
11257 set d_grpasswd; eval $setvar
11258 ;;
11259esac
11260
11261: see if endgrent_r exists
11262set endgrent_r d_endgrent_r
11263eval $inlibc
11264case "$d_endgrent_r" in
11265"$define")
11266 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11267 case "$d_endgrent_r_proto:$usethreads" in
11268 ":define") d_endgrent_r_proto=define
a48ec845
JH
11269 set d_endgrent_r_proto endgrent_r $hdrs
11270 eval $hasproto ;;
11271 *) ;;
11272 esac
11273 case "$d_endgrent_r_proto" in
11274 define)
10bc17b6
JH
11275 case "$endgrent_r_proto" in
11276 ''|0) try='int endgrent_r(FILE**);'
11277 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11278 esac
11279 case "$endgrent_r_proto" in
11280 ''|0) try='void endgrent_r(FILE**);'
11281 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11282 esac
11283 case "$endgrent_r_proto" in
90e831dc 11284 ''|0) d_endgrent_r=undef
10bc17b6 11285 endgrent_r_proto=0
a48ec845 11286 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11287 * ) case "$endgrent_r_proto" in
11288 REENTRANT_PROTO*) ;;
11289 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11290 esac
11291 echo "Prototype: $try" ;;
11292 esac
11293 ;;
c18e646a
JH
11294 *) case "$usethreads" in
11295 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11296 esac
90e831dc
SB
11297 d_endgrent_r=undef
11298 endgrent_r_proto=0
c18e646a 11299 ;;
a48ec845
JH
11300 esac
11301 ;;
10bc17b6
JH
11302*) endgrent_r_proto=0
11303 ;;
11304esac
11305
b4eb6b3d
JH
11306: see if endhostent exists
11307set endhostent d_endhent
11308eval $inlibc
11309
10bc17b6
JH
11310: see if this is a netdb.h system
11311set netdb.h i_netdb
11312eval $inhdr
11313
11314: see if endhostent_r exists
11315set endhostent_r d_endhostent_r
11316eval $inlibc
11317case "$d_endhostent_r" in
11318"$define")
11319 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11320 case "$d_endhostent_r_proto:$usethreads" in
11321 ":define") d_endhostent_r_proto=define
a48ec845
JH
11322 set d_endhostent_r_proto endhostent_r $hdrs
11323 eval $hasproto ;;
11324 *) ;;
11325 esac
11326 case "$d_endhostent_r_proto" in
11327 define)
10bc17b6
JH
11328 case "$endhostent_r_proto" in
11329 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11330 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11331 esac
11332 case "$endhostent_r_proto" in
11333 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11334 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11335 esac
11336 case "$endhostent_r_proto" in
90e831dc 11337 ''|0) d_endhostent_r=undef
10bc17b6 11338 endhostent_r_proto=0
a48ec845 11339 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11340 * ) case "$endhostent_r_proto" in
11341 REENTRANT_PROTO*) ;;
11342 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11343 esac
11344 echo "Prototype: $try" ;;
11345 esac
11346 ;;
c18e646a
JH
11347 *) case "$usethreads" in
11348 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11349 esac
90e831dc
SB
11350 d_endhostent_r=undef
11351 endhostent_r_proto=0
c18e646a 11352 ;;
a48ec845
JH
11353 esac
11354 ;;
10bc17b6
JH
11355*) endhostent_r_proto=0
11356 ;;
11357esac
11358
b4eb6b3d
JH
11359: see if endnetent exists
11360set endnetent d_endnent
11361eval $inlibc
11362
10bc17b6
JH
11363: see if endnetent_r exists
11364set endnetent_r d_endnetent_r
11365eval $inlibc
11366case "$d_endnetent_r" in
11367"$define")
11368 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11369 case "$d_endnetent_r_proto:$usethreads" in
11370 ":define") d_endnetent_r_proto=define
a48ec845
JH
11371 set d_endnetent_r_proto endnetent_r $hdrs
11372 eval $hasproto ;;
11373 *) ;;
11374 esac
11375 case "$d_endnetent_r_proto" in
11376 define)
10bc17b6
JH
11377 case "$endnetent_r_proto" in
11378 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11379 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11380 esac
11381 case "$endnetent_r_proto" in
11382 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11383 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11384 esac
11385 case "$endnetent_r_proto" in
90e831dc 11386 ''|0) d_endnetent_r=undef
10bc17b6 11387 endnetent_r_proto=0
a48ec845 11388 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11389 * ) case "$endnetent_r_proto" in
11390 REENTRANT_PROTO*) ;;
11391 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11392 esac
11393 echo "Prototype: $try" ;;
11394 esac
11395 ;;
c18e646a
JH
11396 *) case "$usethreads" in
11397 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11398 esac
90e831dc
SB
11399 d_endnetent_r=undef
11400 endnetent_r_proto=0
c18e646a 11401 ;;
a48ec845
JH
11402 esac
11403 ;;
10bc17b6
JH
11404*) endnetent_r_proto=0
11405 ;;
11406esac
11407
b4eb6b3d
JH
11408: see if endprotoent exists
11409set endprotoent d_endpent
11410eval $inlibc
11411
10bc17b6
JH
11412: see if endprotoent_r exists
11413set endprotoent_r d_endprotoent_r
11414eval $inlibc
11415case "$d_endprotoent_r" in
11416"$define")
11417 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11418 case "$d_endprotoent_r_proto:$usethreads" in
11419 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11420 set d_endprotoent_r_proto endprotoent_r $hdrs
11421 eval $hasproto ;;
11422 *) ;;
11423 esac
11424 case "$d_endprotoent_r_proto" in
11425 define)
10bc17b6
JH
11426 case "$endprotoent_r_proto" in
11427 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11428 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11429 esac
11430 case "$endprotoent_r_proto" in
11431 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11432 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11433 esac
11434 case "$endprotoent_r_proto" in
90e831dc 11435 ''|0) d_endprotoent_r=undef
10bc17b6 11436 endprotoent_r_proto=0
a48ec845 11437 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11438 * ) case "$endprotoent_r_proto" in
11439 REENTRANT_PROTO*) ;;
11440 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11441 esac
11442 echo "Prototype: $try" ;;
11443 esac
11444 ;;
c18e646a
JH
11445 *) case "$usethreads" in
11446 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11447 esac
90e831dc
SB
11448 d_endprotoent_r=undef
11449 endprotoent_r_proto=0
c18e646a 11450 ;;
a48ec845
JH
11451 esac
11452 ;;
10bc17b6
JH
11453*) endprotoent_r_proto=0
11454 ;;
11455esac
11456
b4eb6b3d
JH
11457: see if endpwent exists
11458set endpwent d_endpwent
11459eval $inlibc
11460
10bc17b6
JH
11461: see if this is a pwd.h system
11462set pwd.h i_pwd
11463eval $inhdr
11464
11465case "$i_pwd" in
11466$define)
11467 xxx=`./findhdr pwd.h`
11468 $cppstdin $cppflags $cppminus < $xxx >$$.h
11469
11470 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11471 val="$define"
11472 else
11473 val="$undef"
11474 fi
11475 set d_pwquota
11476 eval $setvar
11477
11478 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11479 val="$define"
11480 else
11481 val="$undef"
11482 fi
11483 set d_pwage
11484 eval $setvar
11485
11486 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11487 val="$define"
11488 else
11489 val="$undef"
11490 fi
11491 set d_pwchange
11492 eval $setvar
11493
11494 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11495 val="$define"
11496 else
11497 val="$undef"
11498 fi
11499 set d_pwclass
11500 eval $setvar
11501
11502 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11503 val="$define"
11504 else
11505 val="$undef"
11506 fi
11507 set d_pwexpire
11508 eval $setvar
11509
11510 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11511 val="$define"
11512 else
11513 val="$undef"
11514 fi
11515 set d_pwcomment
11516 eval $setvar
11517
11518 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11519 val="$define"
11520 else
11521 val="$undef"
11522 fi
11523 set d_pwgecos
11524 eval $setvar
11525
11526 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11527 val="$define"
11528 else
11529 val="$undef"
11530 fi
11531 set d_pwpasswd
11532 eval $setvar
11533
11534 $rm -f $$.h
11535 ;;
11536*)
11537 val="$undef";
11538 set d_pwquota; eval $setvar
11539 set d_pwage; eval $setvar
11540 set d_pwchange; eval $setvar
11541 set d_pwclass; eval $setvar
11542 set d_pwexpire; eval $setvar
11543 set d_pwcomment; eval $setvar
11544 set d_pwgecos; eval $setvar
11545 set d_pwpasswd; eval $setvar
11546 ;;
11547esac
11548
11549: see if endpwent_r exists
11550set endpwent_r d_endpwent_r
11551eval $inlibc
11552case "$d_endpwent_r" in
11553"$define")
11554 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11555 case "$d_endpwent_r_proto:$usethreads" in
11556 ":define") d_endpwent_r_proto=define
a48ec845
JH
11557 set d_endpwent_r_proto endpwent_r $hdrs
11558 eval $hasproto ;;
11559 *) ;;
11560 esac
11561 case "$d_endpwent_r_proto" in
11562 define)
10bc17b6
JH
11563 case "$endpwent_r_proto" in
11564 ''|0) try='int endpwent_r(FILE**);'
11565 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11566 esac
11567 case "$endpwent_r_proto" in
11568 ''|0) try='void endpwent_r(FILE**);'
11569 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11570 esac
11571 case "$endpwent_r_proto" in
90e831dc 11572 ''|0) d_endpwent_r=undef
10bc17b6 11573 endpwent_r_proto=0
a48ec845 11574 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11575 * ) case "$endpwent_r_proto" in
11576 REENTRANT_PROTO*) ;;
11577 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11578 esac
11579 echo "Prototype: $try" ;;
11580 esac
11581 ;;
c18e646a
JH
11582 *) case "$usethreads" in
11583 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11584 esac
90e831dc
SB
11585 d_endpwent_r=undef
11586 endpwent_r_proto=0
c18e646a 11587 ;;
a48ec845
JH
11588 esac
11589 ;;
10bc17b6
JH
11590*) endpwent_r_proto=0
11591 ;;
11592esac
11593
b4eb6b3d
JH
11594: see if endservent exists
11595set endservent d_endsent
11596eval $inlibc
11597
10bc17b6
JH
11598: see if endservent_r exists
11599set endservent_r d_endservent_r
11600eval $inlibc
11601case "$d_endservent_r" in
11602"$define")
11603 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11604 case "$d_endservent_r_proto:$usethreads" in
11605 ":define") d_endservent_r_proto=define
a48ec845
JH
11606 set d_endservent_r_proto endservent_r $hdrs
11607 eval $hasproto ;;
11608 *) ;;
11609 esac
11610 case "$d_endservent_r_proto" in
11611 define)
10bc17b6
JH
11612 case "$endservent_r_proto" in
11613 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11614 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11615 esac
11616 case "$endservent_r_proto" in
11617 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11618 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11619 esac
11620 case "$endservent_r_proto" in
90e831dc 11621 ''|0) d_endservent_r=undef
10bc17b6 11622 endservent_r_proto=0
a48ec845 11623 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11624 * ) case "$endservent_r_proto" in
11625 REENTRANT_PROTO*) ;;
11626 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11627 esac
11628 echo "Prototype: $try" ;;
11629 esac
11630 ;;
c18e646a
JH
11631 *) case "$usethreads" in
11632 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11633 esac
90e831dc
SB
11634 d_endservent_r=undef
11635 endservent_r_proto=0
c18e646a 11636 ;;
a48ec845
JH
11637 esac
11638 ;;
10bc17b6
JH
11639*) endservent_r_proto=0
11640 ;;
11641esac
11642
b4eb6b3d
JH
11643: Locate the flags for 'open()'
11644echo " "
55954f19 11645$cat >try.c <<EOCP
b4eb6b3d
JH
11646#include <sys/types.h>
11647#ifdef I_FCNTL
11648#include <fcntl.h>
11649#endif
11650#ifdef I_SYS_FILE
11651#include <sys/file.h>
11652#endif
55954f19
JH
11653#$i_stdlib I_STDLIB
11654#ifdef I_STDLIB
11655#include <stdlib.h>
11656#endif
b4eb6b3d
JH
11657int main() {
11658 if(O_RDONLY);
11659#ifdef O_TRUNC
11660 exit(0);
11661#else
11662 exit(1);
11663#endif
11664}
11665EOCP
11666: check sys/file.h first to get FREAD on Sun
11667if $test `./findhdr sys/file.h` && \
5440bc8e 11668 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11669 h_sysfile=true;
11670 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11671 if $run ./try; then
b4eb6b3d
JH
11672 echo "and you have the 3 argument form of open()." >&4
11673 val="$define"
11674 else
11675 echo "but not the 3 argument form of open(). Oh, well." >&4
11676 val="$undef"
11677 fi
11678elif $test `./findhdr fcntl.h` && \
5440bc8e 11679 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11680 h_fcntl=true;
11681 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11682 if $run ./try; then
b4eb6b3d
JH
11683 echo "and you have the 3 argument form of open()." >&4
11684 val="$define"
11685 else
11686 echo "but not the 3 argument form of open(). Oh, well." >&4
11687 val="$undef"
11688 fi
11689else
11690 val="$undef"
11691 echo "I can't find the O_* constant definitions! You got problems." >&4
11692fi
11693set d_open3
11694eval $setvar
5440bc8e 11695$rm -f try try.*
b4eb6b3d
JH
11696
11697: see which of string.h or strings.h is needed
11698echo " "
11699strings=`./findhdr string.h`
11700if $test "$strings" && $test -r "$strings"; then
11701 echo "Using <string.h> instead of <strings.h>." >&4
11702 val="$define"
11703else
11704 val="$undef"
11705 strings=`./findhdr strings.h`
11706 if $test "$strings" && $test -r "$strings"; then
11707 echo "Using <strings.h> instead of <string.h>." >&4
11708 else
11709 echo "No string header found -- You'll surely have problems." >&4
11710 fi
11711fi
11712set i_string
11713eval $setvar
11714case "$i_string" in
11715"$undef") strings=`./findhdr strings.h`;;
11716*) strings=`./findhdr string.h`;;
11717esac
11718
3c728e00
JH
11719: see if this is a sys/file.h system
11720val=''
11721set sys/file.h val
11722eval $inhdr
11723
11724: do we need to include sys/file.h ?
11725case "$val" in
11726"$define")
11727 echo " "
11728 if $h_sysfile; then
11729 val="$define"
11730 echo "We'll be including <sys/file.h>." >&4
11731 else
11732 val="$undef"
11733 echo "We won't be including <sys/file.h>." >&4
11734 fi
11735 ;;
11736*)
11737 h_sysfile=false
11738 ;;
11739esac
11740set i_sysfile
11741eval $setvar
11742
11743: see if fcntl.h is there
11744val=''
11745set fcntl.h val
11746eval $inhdr
11747
11748: see if we can include fcntl.h
11749case "$val" in
11750"$define")
11751 echo " "
11752 if $h_fcntl; then
11753 val="$define"
11754 echo "We'll be including <fcntl.h>." >&4
11755 else
11756 val="$undef"
11757 if $h_sysfile; then
11758 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11759 else
11760 echo "We won't be including <fcntl.h>." >&4
11761 fi
11762 fi
11763 ;;
11764*)
11765 h_fcntl=false
11766 val="$undef"
11767 ;;
11768esac
11769set i_fcntl
11770eval $setvar
11771
b4eb6b3d
JH
11772: check for non-blocking I/O stuff
11773case "$h_sysfile" in
a0acbdc3
JH
11774true) echo "#include <sys/file.h>" > head.c;;
11775*)
11776 case "$h_fcntl" in
11777 true) echo "#include <fcntl.h>" > head.c;;
11778 *) echo "#include <sys/fcntl.h>" > head.c;;
11779 esac
11780 ;;
b4eb6b3d
JH
11781esac
11782echo " "
11783echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11784case "$o_nonblock" in
11785'')
11786 $cat head.c > try.c
3c728e00 11787 $cat >>try.c <<EOCP
b4eb6b3d 11788#include <stdio.h>
55954f19
JH
11789#$i_stdlib I_STDLIB
11790#ifdef I_STDLIB
80b3ef99 11791#include <stdlib.h>
55954f19 11792#endif
3c728e00
JH
11793#$i_fcntl I_FCNTL
11794#ifdef I_FCNTL
11795#include <fcntl.h>
11796#endif
b4eb6b3d
JH
11797int main() {
11798#ifdef O_NONBLOCK
11799 printf("O_NONBLOCK\n");
11800 exit(0);
11801#endif
11802#ifdef O_NDELAY
11803 printf("O_NDELAY\n");
11804 exit(0);
11805#endif
11806#ifdef FNDELAY
11807 printf("FNDELAY\n");
11808 exit(0);
11809#endif
11810 exit(0);
11811}
11812EOCP
11813 set try
11814 if eval $compile_ok; then
5440bc8e 11815 o_nonblock=`$run ./try`
b4eb6b3d
JH
11816 case "$o_nonblock" in
11817 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11818 *) echo "Seems like we can use $o_nonblock.";;
11819 esac
11820 else
11821 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11822 fi
11823 ;;
11824*) echo "Using $hint value $o_nonblock.";;
11825esac
11826$rm -f try try.* .out core
11827
11828echo " "
11829echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11830case "$eagain" in
11831'')
11832 $cat head.c > try.c
11833 $cat >>try.c <<EOCP
11834#include <errno.h>
11835#include <sys/types.h>
11836#include <signal.h>
11837#include <stdio.h>
55954f19
JH
11838#$i_stdlib I_STDLIB
11839#ifdef I_STDLIB
11840#include <stdlib.h>
11841#endif
1deb0a86
JH
11842#$i_fcntl I_FCNTL
11843#ifdef I_FCNTL
11844#include <fcntl.h>
11845#endif
b4eb6b3d
JH
11846#define MY_O_NONBLOCK $o_nonblock
11847#ifndef errno /* XXX need better Configure test */
11848extern int errno;
11849#endif
11850#$i_unistd I_UNISTD
11851#ifdef I_UNISTD
11852#include <unistd.h>
11853#endif
11854#$i_string I_STRING
11855#ifdef I_STRING
11856#include <string.h>
11857#else
11858#include <strings.h>
11859#endif
11860$signal_t blech(x) int x; { exit(3); }
11861EOCP
11862 $cat >> try.c <<'EOCP'
11863int main()
11864{
11865 int pd[2];
11866 int pu[2];
11867 char buf[1];
11868 char string[100];
11869
11870 pipe(pd); /* Down: child -> parent */
11871 pipe(pu); /* Up: parent -> child */
11872 if (0 != fork()) {
11873 int ret;
11874 close(pd[1]); /* Parent reads from pd[0] */
11875 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11876#ifdef F_SETFL
b4eb6b3d
JH
11877 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11878 exit(1);
a0acbdc3
JH
11879#else
11880 exit(4);
11881#endif
b4eb6b3d
JH
11882 signal(SIGALRM, blech);
11883 alarm(5);
11884 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11885 exit(2);
11886 sprintf(string, "%d\n", ret);
11887 write(2, string, strlen(string));
11888 alarm(0);
11889#ifdef EAGAIN
11890 if (errno == EAGAIN) {
11891 printf("EAGAIN\n");
11892 goto ok;
11893 }
11894#endif
11895#ifdef EWOULDBLOCK
11896 if (errno == EWOULDBLOCK)
11897 printf("EWOULDBLOCK\n");
11898#endif
11899 ok:
11900 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11901 sleep(2); /* Give it time to close our pipe */
11902 alarm(5);
11903 ret = read(pd[0], buf, 1); /* Should read EOF */
11904 alarm(0);
11905 sprintf(string, "%d\n", ret);
868439a2 11906 write(4, string, strlen(string));
b4eb6b3d
JH
11907 exit(0);
11908 }
11909
11910 close(pd[0]); /* We write to pd[1] */
11911 close(pu[1]); /* We read from pu[0] */
11912 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11913 close(pd[1]); /* Pipe pd is now fully closed! */
11914 exit(0); /* Bye bye, thank you for playing! */
11915}
11916EOCP
11917 set try
11918 if eval $compile_ok; then
11919 echo "$startsh" >mtry
868439a2 11920 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11921 chmod +x mtry
11922 ./mtry >/dev/null 2>&1
11923 case $? in
11924 0) eagain=`$cat try.out`;;
11925 1) echo "Could not perform non-blocking setting!";;
11926 2) echo "I did a successful read() for something that was not there!";;
11927 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11928 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11929 *) echo "Something terribly wrong happened during testing.";;
11930 esac
11931 rd_nodata=`$cat try.ret`
11932 echo "A read() system call with no data present returns $rd_nodata."
11933 case "$rd_nodata" in
11934 0|-1) ;;
11935 *)
11936 echo "(That's peculiar, fixing that to be -1.)"
11937 rd_nodata=-1
11938 ;;
11939 esac
11940 case "$eagain" in
11941 '')
11942 echo "Forcing errno EAGAIN on read() with no data available."
11943 eagain=EAGAIN
11944 ;;
11945 *)
11946 echo "Your read() sets errno to $eagain when no data is available."
11947 ;;
11948 esac
11949 status=`$cat try.err`
11950 case "$status" in
11951 0) echo "And it correctly returns 0 to signal EOF.";;
11952 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11953 *) echo "However, your read() returns '$status' on EOF??";;
11954 esac
11955 val="$define"
11956 if test "$status" = "$rd_nodata"; then
11957 echo "WARNING: you can't distinguish between EOF and no data!"
11958 val="$undef"
11959 fi
11960 else
11961 echo "I can't compile the test program--assuming errno EAGAIN will do."
11962 eagain=EAGAIN
11963 fi
11964 set d_eofnblk
11965 eval $setvar
11966 ;;
11967*)
11968 echo "Using $hint value $eagain."
11969 echo "Your read() returns $rd_nodata when no data is present."
11970 case "$d_eofnblk" in
11971 "$define") echo "And you can see EOF because read() returns 0.";;
11972 "$undef") echo "But you can't see EOF status from read() returned value.";;
11973 *)
11974 echo "(Assuming you can't see EOF status from read anyway.)"
11975 d_eofnblk=$undef
11976 ;;
11977 esac
11978 ;;
11979esac
11980$rm -f try try.* .out core head.c mtry
11981
15b61c98
JH
11982: see if _ptr and _cnt from stdio act std
11983echo " "
b4eb6b3d 11984
15b61c98
JH
11985if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11986 echo "(Looks like you have stdio.h from BSD.)"
11987 case "$stdio_ptr" in
11988 '') stdio_ptr='((fp)->_p)'
11989 ptr_lval=$define
11990 ;;
11991 *) ptr_lval=$d_stdio_ptr_lval;;
11992 esac
11993 case "$stdio_cnt" in
11994 '') stdio_cnt='((fp)->_r)'
11995 cnt_lval=$define
11996 ;;
11997 *) cnt_lval=$d_stdio_cnt_lval;;
11998 esac
11999 case "$stdio_base" in
12000 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12001 esac
12002 case "$stdio_bufsiz" in
12003 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12004 esac
12005elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12006 echo "(Looks like you have stdio.h from Linux.)"
12007 case "$stdio_ptr" in
12008 '') stdio_ptr='((fp)->_IO_read_ptr)'
12009 ptr_lval=$define
12010 ;;
12011 *) ptr_lval=$d_stdio_ptr_lval;;
12012 esac
12013 case "$stdio_cnt" in
12014 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12015 cnt_lval=$undef
12016 ;;
12017 *) cnt_lval=$d_stdio_cnt_lval;;
12018 esac
12019 case "$stdio_base" in
12020 '') stdio_base='((fp)->_IO_read_base)';;
12021 esac
12022 case "$stdio_bufsiz" in
12023 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12024 esac
12025else
12026 case "$stdio_ptr" in
12027 '') stdio_ptr='((fp)->_ptr)'
12028 ptr_lval=$define
12029 ;;
12030 *) ptr_lval=$d_stdio_ptr_lval;;
12031 esac
12032 case "$stdio_cnt" in
12033 '') stdio_cnt='((fp)->_cnt)'
12034 cnt_lval=$define
12035 ;;
12036 *) cnt_lval=$d_stdio_cnt_lval;;
12037 esac
12038 case "$stdio_base" in
12039 '') stdio_base='((fp)->_base)';;
12040 esac
12041 case "$stdio_bufsiz" in
12042 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12043 esac
12044fi
b4eb6b3d 12045
15b61c98
JH
12046: test whether _ptr and _cnt really work
12047echo "Checking how std your stdio is..." >&4
12048$cat >try.c <<EOP
12049#include <stdio.h>
55954f19
JH
12050#$i_stdlib I_STDLIB
12051#ifdef I_STDLIB
9d9004a9 12052#include <stdlib.h>
55954f19 12053#endif
15b61c98
JH
12054#define FILE_ptr(fp) $stdio_ptr
12055#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12056int main() {
15b61c98
JH
12057 FILE *fp = fopen("try.c", "r");
12058 char c = getc(fp);
12059 if (
12060 18 <= FILE_cnt(fp) &&
12061 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12062 )
12063 exit(0);
12064 exit(1);
9d9004a9 12065}
15b61c98
JH
12066EOP
12067val="$undef"
12068set try
12069if eval $compile && $to try.c; then
12070 if $run ./try; then
12071 echo "Your stdio acts pretty std."
12072 val="$define"
9d9004a9 12073 else
15b61c98 12074 echo "Your stdio isn't very std."
9d9004a9 12075 fi
15b61c98
JH
12076else
12077 echo "Your stdio doesn't appear very std."
12078fi
12079$rm -f try.c try
12080
12081# glibc 2.2.90 and above apparently change stdio streams so Perl's
12082# direct buffer manipulation no longer works. The Configure tests
12083# should be changed to correctly detect this, but until then,
12084# the following check should at least let perl compile and run.
12085# (This quick fix should be updated before 5.8.1.)
12086# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12087# A. Dougherty, June 3, 2002.
12088case "$d_gnulibc" in
12089$define)
12090 case "$gnulibc_version" in
12091 2.[01]*) ;;
12092 2.2) ;;
12093 2.2.[0-9]) ;;
12094 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12095 val="$undef"
12096 ;;
12097 esac
9d9004a9
AD
12098 ;;
12099esac
15b61c98 12100set d_stdstdio
9d9004a9 12101eval $setvar
9d9004a9 12102
15b61c98
JH
12103: Can _ptr be used as an lvalue?
12104case "$d_stdstdio$ptr_lval" in
12105$define$define) val=$define ;;
12106*) val=$undef ;;
12107esac
12108set d_stdio_ptr_lval
12109eval $setvar
9d9004a9 12110
15b61c98
JH
12111: Can _cnt be used as an lvalue?
12112case "$d_stdstdio$cnt_lval" in
12113$define$define) val=$define ;;
12114*) val=$undef ;;
12115esac
12116set d_stdio_cnt_lval
12117eval $setvar
b4eb6b3d 12118
15b61c98
JH
12119
12120: test whether setting _ptr sets _cnt as a side effect
12121d_stdio_ptr_lval_sets_cnt="$undef"
12122d_stdio_ptr_lval_nochange_cnt="$undef"
12123case "$d_stdio_ptr_lval$d_stdstdio" in
12124$define$define)
12125 echo "Checking to see what happens if we set the stdio ptr..." >&4
12126$cat >try.c <<EOP
12127#include <stdio.h>
12128/* Can we scream? */
12129/* Eat dust sed :-) */
12130/* In the buffer space, no one can hear you scream. */
55954f19
JH
12131#$i_stdlib I_STDLIB
12132#ifdef I_STDLIB
12133#include <stdlib.h>
12134#endif
15b61c98
JH
12135#define FILE_ptr(fp) $stdio_ptr
12136#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12137#include <sys/types.h>
b4eb6b3d 12138int main() {
15b61c98
JH
12139 FILE *fp = fopen("try.c", "r");
12140 int c;
12141 char *ptr;
12142 size_t cnt;
12143 if (!fp) {
12144 puts("Fail even to read");
12145 exit(1);
12146 }
12147 c = getc(fp); /* Read away the first # */
12148 if (c == EOF) {
12149 puts("Fail even to read");
12150 exit(1);
12151 }
12152 if (!(
12153 18 <= FILE_cnt(fp) &&
12154 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12155 )) {
12156 puts("Fail even to read");
12157 exit (1);
12158 }
12159 ptr = (char*) FILE_ptr(fp);
12160 cnt = (size_t)FILE_cnt(fp);
12161
12162 FILE_ptr(fp) += 42;
12163
12164 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12165 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12166 exit (1);
12167 }
12168 if (FILE_cnt(fp) <= 20) {
12169 printf ("Fail (<20 chars to test)");
12170 exit (1);
12171 }
12172 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12173 puts("Fail compare");
12174 exit (1);
12175 }
12176 if (cnt == FILE_cnt(fp)) {
12177 puts("Pass_unchanged");
12178 exit (0);
12179 }
12180 if (FILE_cnt(fp) == (cnt - 42)) {
12181 puts("Pass_changed");
12182 exit (0);
12183 }
12184 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12185 return 1;
12186
12187}
12188EOP
12189 set try
12190 if eval $compile && $to try.c; then
12191 case `$run ./try` in
12192 Pass_changed)
12193 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12194 d_stdio_ptr_lval_sets_cnt="$define" ;;
12195 Pass_unchanged)
12196 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12197 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12198 Fail*)
12199 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12200 *)
12201 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12202 esac
12203 else
12204 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12205 fi
12206 $rm -f try.c try
12207 ;;
12208esac
12209
12210: see if _base is also standard
12211val="$undef"
12212case "$d_stdstdio" in
12213$define)
12214 $cat >try.c <<EOP
12215#include <stdio.h>
12216#$i_stdlib I_STDLIB
12217#ifdef I_STDLIB
12218#include <stdlib.h>
12219#endif
12220#define FILE_base(fp) $stdio_base
12221#define FILE_bufsiz(fp) $stdio_bufsiz
12222int main() {
12223 FILE *fp = fopen("try.c", "r");
12224 char c = getc(fp);
12225 if (
12226 19 <= FILE_bufsiz(fp) &&
12227 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12228 )
12229 exit(0);
12230 exit(1);
12231}
12232EOP
12233 set try
12234 if eval $compile && $to try.c; then
12235 if $run ./try; then
12236 echo "And its _base field acts std."
12237 val="$define"
12238 else
12239 echo "But its _base field isn't std."
12240 fi
12241 else
12242 echo "However, it seems to be lacking the _base field."
12243 fi
12244 $rm -f try.c try
12245 ;;
12246esac
12247set d_stdiobase
12248eval $setvar
12249
12250: see if fast_stdio exists
12251val="$undef"
12252case "$d_stdstdio:$d_stdio_ptr_lval" in
12253"$define:$define")
12254 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12255 *$define*)
12256 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12257 val="$define"
12258 ;;
12259 esac
12260 ;;
12261esac
12262set d_faststdio
12263eval $setvar
12264
12265
12266
12267: see if fchdir exists
12268set fchdir d_fchdir
12269eval $inlibc
12270
12271: see if fchmod exists
12272set fchmod d_fchmod
12273eval $inlibc
12274
12275: see if fchown exists
12276set fchown d_fchown
12277eval $inlibc
12278
12279: see if this is an fcntl system
12280set fcntl d_fcntl
12281eval $inlibc
12282
12283echo " "
12284: See if fcntl-based locking works.
12285$cat >try.c <<EOCP
12286#$i_stdlib I_STDLIB
12287#ifdef I_STDLIB
12288#include <stdlib.h>
12289#endif
12290#include <unistd.h>
12291#include <fcntl.h>
12292#include <signal.h>
12293$signal_t blech(x) int x; { exit(3); }
12294int main() {
12295#if defined(F_SETLK) && defined(F_SETLKW)
12296 struct flock flock;
12297 int retval, fd;
12298 fd = open("try.c", O_RDONLY);
12299 flock.l_type = F_RDLCK;
12300 flock.l_whence = SEEK_SET;
12301 flock.l_start = flock.l_len = 0;
12302 signal(SIGALRM, blech);
12303 alarm(10);
12304 retval = fcntl(fd, F_SETLK, &flock);
12305 close(fd);
12306 (retval < 0 ? exit(2) : exit(0));
12307#else
12308 exit(2);
12309#endif
12310}
12311EOCP
12312echo "Checking if fcntl-based file locking works... "
12313case "$d_fcntl" in
12314"$define")
12315 set try
12316 if eval $compile_ok; then
12317 if $run ./try; then
12318 echo "Yes, it seems to work."
12319 val="$define"
12320 else
12321 echo "Nope, it didn't work."
12322 val="$undef"
12323 case "$?" in
12324 3) $cat >&4 <<EOM
12325***
12326*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12327*** This is (almost) impossible.
12328*** If your NFS lock daemons are not feeling well, something like
12329*** this may happen, please investigate. Cannot continue, aborting.
12330***
12331EOM
12332 exit 1
12333 ;;
12334 esac
12335 fi
12336 else
12337 echo "I'm unable to compile the test program, so I'll assume not."
12338 val="$undef"
12339 fi
12340 ;;
12341*) val="$undef";
12342 echo "Nope, since you don't even have fcntl()."
12343 ;;
12344esac
12345set d_fcntl_can_lock
12346eval $setvar
12347$rm -f try*
12348
12349
12350: check for fd_set items
12351$cat <<EOM
12352
12353Checking to see how well your C compiler handles fd_set and friends ...
12354EOM
12355$cat >try.c <<EOCP
12356#$i_stdlib I_STDLIB
12357#ifdef I_STDLIB
12358#include <stdlib.h>
12359#endif
12360#$i_systime I_SYS_TIME
12361#$i_sysselct I_SYS_SELECT
12362#$d_socket HAS_SOCKET
12363#include <sys/types.h>
12364#ifdef HAS_SOCKET
12365#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12366#endif
12367#ifdef I_SYS_TIME
12368#include <sys/time.h>
12369#endif
12370#ifdef I_SYS_SELECT
12371#include <sys/select.h>
12372#endif
12373int main() {
12374 fd_set fds;
12375
12376#ifdef TRYBITS
12377 if(fds.fds_bits);
12378#endif
12379
12380#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12381 exit(0);
12382#else
12383 exit(1);
12384#endif
12385}
12386EOCP
12387set try -DTRYBITS
12388if eval $compile; then
12389 d_fds_bits="$define"
12390 d_fd_set="$define"
12391 echo "Well, your system knows about the normal fd_set typedef..." >&4
12392 if $run ./try; then
b4eb6b3d
JH
12393 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12394 d_fd_macros="$define"
12395 else
12396 $cat >&4 <<'EOM'
12397but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12398EOM
12399 d_fd_macros="$undef"
12400 fi
12401else
12402 $cat <<'EOM'
12403Hmm, your compiler has some difficulty with fd_set. Checking further...
12404EOM
5440bc8e 12405 set try
b4eb6b3d
JH
12406 if eval $compile; then
12407 d_fds_bits="$undef"
12408 d_fd_set="$define"
12409 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12410 if $run ./try; then
b4eb6b3d
JH
12411 echo "and you have the normal fd_set macros." >&4
12412 d_fd_macros="$define"
12413 else
12414 $cat <<'EOM'
12415but not the normal fd_set macros! Gross! More work for me...
12416EOM
12417 d_fd_macros="$undef"
12418 fi
12419 else
12420 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12421 d_fd_set="$undef"
12422 d_fds_bits="$undef"
12423 d_fd_macros="$undef"
12424 fi
12425fi
5440bc8e 12426$rm -f try try.*
b4eb6b3d
JH
12427
12428: see if fgetpos exists
12429set fgetpos d_fgetpos
12430eval $inlibc
12431
758a5d79
JH
12432: see if finite exists
12433set finite d_finite
12434eval $inlibc
12435
12436: see if finitel exists
12437set finitel d_finitel
12438eval $inlibc
12439
b4eb6b3d
JH
12440: see if flock exists
12441set flock d_flock
12442eval $inlibc
12443
2ef53570
JH
12444: see if prototype for flock is available
12445echo " "
12446set d_flockproto flock $i_sysfile sys/file.h
12447eval $hasproto
12448
b4eb6b3d
JH
12449: see if fork exists
12450set fork d_fork
12451eval $inlibc
12452
758a5d79
JH
12453: see if fp_class exists
12454set fp_class d_fp_class
12455eval $inlibc
12456
b4eb6b3d
JH
12457: see if pathconf exists
12458set pathconf d_pathconf
12459eval $inlibc
12460
12461: see if fpathconf exists
12462set fpathconf d_fpathconf
12463eval $inlibc
12464
758a5d79
JH
12465: see if fpclass exists
12466set fpclass d_fpclass
12467eval $inlibc
12468
12469: see if fpclassify exists
12470set fpclassify d_fpclassify
12471eval $inlibc
12472
12473: see if fpclassl exists
12474set fpclassl d_fpclassl
12475eval $inlibc
12476
b4eb6b3d
JH
12477
12478: check for fpos64_t
12479echo " "
12480echo "Checking to see if you have fpos64_t..." >&4
12481$cat >try.c <<EOCP
12482#include <stdio.h>
12483int main() { fpos64_t x = 7; }
12484EOCP
12485set try
12486if eval $compile; then
12487 val="$define"
12488 echo "You have fpos64_t."
12489else
12490 val="$undef"
12491 echo "You do not have fpos64_t."
12492 case "$fpossize" in
12493 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12494 esac
12495fi
12496$rm -f try.* try
12497set d_fpos64_t
12498eval $setvar
12499
12500: see if frexpl exists
12501set frexpl d_frexpl
12502eval $inlibc
12503
b4eb6b3d
JH
12504: see if this is a sys/param system
12505set sys/param.h i_sysparam
12506eval $inhdr
12507
12508: see if this is a sys/mount.h system
12509set sys/mount.h i_sysmount
12510eval $inhdr
12511
b4eb6b3d
JH
12512
12513echo " "
12514echo "Checking to see if your system supports struct fs_data..." >&4
12515set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12516eval $hasstruct
12517case "$d_fs_data_s" in
12518"$define") echo "Yes, it does." ;;
12519*) echo "No, it doesn't." ;;
12520esac
12521
12522: see if fseeko exists
12523set fseeko d_fseeko
12524eval $inlibc
12525case "$longsize" in
125268) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12527esac
12528
12529: see if fsetpos exists
12530set fsetpos d_fsetpos
12531eval $inlibc
12532
12533
12534: see if fstatfs exists
12535set fstatfs d_fstatfs
12536eval $inlibc
12537
12538
12539: see if statvfs exists
12540set statvfs d_statvfs
12541eval $inlibc
12542
12543: see if fstatvfs exists
12544set fstatvfs d_fstatvfs
12545eval $inlibc
12546
12547
411ab01c
JH
12548: see if fsync exists
12549set fsync d_fsync
12550eval $inlibc
12551
b4eb6b3d
JH
12552: see if ftello exists
12553set ftello d_ftello
12554eval $inlibc
12555case "$longsize" in
125568) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12557esac
12558
bff98e24
SP
12559d_futimes="$undef"
12560: check for a working futimes
12561echo " "
12562echo "Checking for a working futimes()" >&4
12563$cat >try.c <<EOCP
12564#include <stdio.h>
12565#include <sys/time.h>
12566#include <errno.h>
12567#include <fcntl.h>
12568
12569int main ()
12570{
12571 int fd, rv;
12572 fd = open ("try.c", O_RDWR);
12573 if (-1 == fd) exit (1);
12574 rv = futimes (fd, NULL);
12575 exit (rv == -1 ? errno : 0);
12576}
12577EOCP
12578set try
12579if eval $compile; then
12580 `$run ./try`
12581 rc=$?
12582 case "$rc" in
12583 0) echo "Yes, it does" >&4
12584 d_futimes="$define"
12585 ;;
12586 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12587 ;;
12588 esac
12589else
12590 echo "No, it does not (probably harmless)\n" >&4
12591fi
12592$rm -f try.* try core core.try.*
dc814df1 12593
b4eb6b3d
JH
12594: see if getcwd exists
12595set getcwd d_getcwd
12596eval $inlibc
12597
12598: see if getespwnam exists
12599set getespwnam d_getespwnam
12600eval $inlibc
12601
12602
12603: see if getfsstat exists
12604set getfsstat d_getfsstat
12605eval $inlibc
12606
12607: see if getgrent exists
12608set getgrent d_getgrent
12609eval $inlibc
12610
10bc17b6
JH
12611: see if getgrent_r exists
12612set getgrent_r d_getgrent_r
12613eval $inlibc
12614case "$d_getgrent_r" in
12615"$define")
12616 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12617 case "$d_getgrent_r_proto:$usethreads" in
12618 ":define") d_getgrent_r_proto=define
a48ec845
JH
12619 set d_getgrent_r_proto getgrent_r $hdrs
12620 eval $hasproto ;;
12621 *) ;;
12622 esac
12623 case "$d_getgrent_r_proto" in
12624 define)
10bc17b6
JH
12625 case "$getgrent_r_proto" in
12626 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12627 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12628 esac
12629 case "$getgrent_r_proto" in
12630 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12631 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12632 esac
12633 case "$getgrent_r_proto" in
12634 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12635 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12636 esac
12637 case "$getgrent_r_proto" in
12638 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12639 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12640 esac
12641 case "$getgrent_r_proto" in
12642 ''|0) try='int getgrent_r(struct group*, char*, int);'
12643 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12644 esac
12645 case "$getgrent_r_proto" in
12646 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12647 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12648 esac
12649 case "$getgrent_r_proto" in
90e831dc 12650 ''|0) d_getgrent_r=undef
10bc17b6 12651 getgrent_r_proto=0
a48ec845 12652 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12653 * ) case "$getgrent_r_proto" in
12654 REENTRANT_PROTO*) ;;
12655 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12656 esac
12657 echo "Prototype: $try" ;;
12658 esac
12659 ;;
c18e646a
JH
12660 *) case "$usethreads" in
12661 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12662 esac
90e831dc
SB
12663 d_getgrent_r=undef
12664 getgrent_r_proto=0
c18e646a 12665 ;;
a48ec845
JH
12666 esac
12667 ;;
10bc17b6
JH
12668*) getgrent_r_proto=0
12669 ;;
12670esac
12671
12672: see if getgrgid_r exists
12673set getgrgid_r d_getgrgid_r
12674eval $inlibc
12675case "$d_getgrgid_r" in
12676"$define")
12677 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12678 case "$d_getgrgid_r_proto:$usethreads" in
12679 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12680 set d_getgrgid_r_proto getgrgid_r $hdrs
12681 eval $hasproto ;;
12682 *) ;;
12683 esac
12684 case "$d_getgrgid_r_proto" in
12685 define)
10bc17b6
JH
12686 case "$getgrgid_r_proto" in
12687 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12688 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12689 esac
12690 case "$getgrgid_r_proto" in
12691 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12692 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12693 esac
12694 case "$getgrgid_r_proto" in
12695 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12696 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12697 esac
12698 case "$getgrgid_r_proto" in
12699 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12700 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12701 esac
12702 case "$getgrgid_r_proto" in
90e831dc 12703 ''|0) d_getgrgid_r=undef
10bc17b6 12704 getgrgid_r_proto=0
a48ec845 12705 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12706 * ) case "$getgrgid_r_proto" in
12707 REENTRANT_PROTO*) ;;
12708 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12709 esac
12710 echo "Prototype: $try" ;;
12711 esac
12712 ;;
c18e646a
JH
12713 *) case "$usethreads" in
12714 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12715 esac
90e831dc
SB
12716 d_getgrgid_r=undef
12717 getgrgid_r_proto=0
c18e646a 12718 ;;
a48ec845
JH
12719 esac
12720 ;;
10bc17b6
JH
12721*) getgrgid_r_proto=0
12722 ;;
12723esac
12724
12725: see if getgrnam_r exists
12726set getgrnam_r d_getgrnam_r
12727eval $inlibc
12728case "$d_getgrnam_r" in
12729"$define")
12730 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12731 case "$d_getgrnam_r_proto:$usethreads" in
12732 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12733 set d_getgrnam_r_proto getgrnam_r $hdrs
12734 eval $hasproto ;;
12735 *) ;;
12736 esac
12737 case "$d_getgrnam_r_proto" in
12738 define)
10bc17b6
JH
12739 case "$getgrnam_r_proto" in
12740 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12741 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12742 esac
12743 case "$getgrnam_r_proto" in
12744 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12745 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12746 esac
12747 case "$getgrnam_r_proto" in
12748 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12749 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12750 esac
12751 case "$getgrnam_r_proto" in
12752 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12753 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12754 esac
12755 case "$getgrnam_r_proto" in
12756 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12757 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12758 esac
12759 case "$getgrnam_r_proto" in
90e831dc 12760 ''|0) d_getgrnam_r=undef
10bc17b6 12761 getgrnam_r_proto=0
a48ec845 12762 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12763 * ) case "$getgrnam_r_proto" in
12764 REENTRANT_PROTO*) ;;
12765 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12766 esac
12767 echo "Prototype: $try" ;;
12768 esac
12769 ;;
c18e646a
JH
12770 *) case "$usethreads" in
12771 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12772 esac
90e831dc
SB
12773 d_getgrnam_r=undef
12774 getgrnam_r_proto=0
c18e646a 12775 ;;
a48ec845
JH
12776 esac
12777 ;;
10bc17b6
JH
12778*) getgrnam_r_proto=0
12779 ;;
12780esac
12781
b4eb6b3d
JH
12782: see if gethostbyaddr exists
12783set gethostbyaddr d_gethbyaddr
12784eval $inlibc
12785
12786: see if gethostbyname exists
12787set gethostbyname d_gethbyname
12788eval $inlibc
12789
12790: see if gethostent exists
12791set gethostent d_gethent
12792eval $inlibc
12793
12794: see how we will look up host name
12795echo " "
12796call=''
12797if set gethostname val -f d_gethname; eval $csym; $val; then
12798 echo 'gethostname() found.' >&4
12799 d_gethname="$define"
12800 call=gethostname
12801fi
12802if set uname val -f d_uname; eval $csym; $val; then
12803 if ./xenix; then
12804 $cat <<'EOM'
12805uname() was found, but you're running xenix, and older versions of xenix
12806have a broken uname(). If you don't really know whether your xenix is old
12807enough to have a broken system call, use the default answer.
12808
12809EOM
12810 dflt=y
12811 case "$d_uname" in
12812 "$define") dflt=n;;
12813 esac
12814 rp='Is your uname() broken?'
12815 . ./myread
12816 case "$ans" in
12817 n*) d_uname="$define"; call=uname;;
12818 esac
12819 else
12820 echo 'uname() found.' >&4
12821 d_uname="$define"
12822 case "$call" in
12823 '') call=uname ;;
12824 esac
12825 fi
12826fi
12827case "$d_gethname" in
12828'') d_gethname="$undef";;
12829esac
12830case "$d_uname" in
12831'') d_uname="$undef";;
12832esac
12833case "$d_uname$d_gethname" in
12834*define*)
12835 dflt=n
12836 cat <<EOM
12837
12838Every now and then someone has a $call() that lies about the hostname
12839but can't be fixed for political or economic reasons. If you wish, I can
12840pretend $call() isn't there and maybe compute hostname at run-time
12841thanks to the '$phostname' command.
12842
12843EOM
12844 rp="Shall I ignore $call() from now on?"
12845 . ./myread
12846 case "$ans" in
12847 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12848 esac;;
12849esac
12850case "$phostname" in
12851'') aphostname='';;
12852*) case "$aphostname" in
12853 /*) ;;
12854 *) set X $phostname
12855 shift
12856 file=$1
12857 shift
12858 file=`./loc $file $file $pth`
12859 aphostname=`echo $file $*`
12860 ;;
12861 esac
12862 ;;
12863esac
12864case "$d_uname$d_gethname" in
12865*define*) ;;
12866*)
12867 case "$phostname" in
12868 '')
12869 echo "There will be no way for $package to get your hostname." >&4;;
12870 *)
12871 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12872 ;;
12873 esac;;
12874esac
12875case "$d_phostname" in
12876'') d_phostname="$undef";;
12877esac
12878
10bc17b6
JH
12879: see if gethostbyaddr_r exists
12880set gethostbyaddr_r d_gethostbyaddr_r
12881eval $inlibc
12882case "$d_gethostbyaddr_r" in
12883"$define")
12884 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12885 case "$d_gethostbyaddr_r_proto:$usethreads" in
12886 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12887 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12888 eval $hasproto ;;
12889 *) ;;
12890 esac
12891 case "$d_gethostbyaddr_r_proto" in
12892 define)
10bc17b6
JH
12893 case "$gethostbyaddr_r_proto" in
12894 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12895 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12896 esac
12897 case "$gethostbyaddr_r_proto" in
12898 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12899 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12900 esac
12901 case "$gethostbyaddr_r_proto" in
12902 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12903 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12904 esac
12905 case "$gethostbyaddr_r_proto" in
12906 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12907 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12908 esac
12909 case "$gethostbyaddr_r_proto" in
12910 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12911 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12912 esac
12913 case "$gethostbyaddr_r_proto" in
12914 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12915 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12916 esac
12917 case "$gethostbyaddr_r_proto" in
12918 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12919 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12920 esac
12921 case "$gethostbyaddr_r_proto" in
12922 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12923 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12924 esac
12925 case "$gethostbyaddr_r_proto" in
12926 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12927 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12928 esac
12929 case "$gethostbyaddr_r_proto" in
12930 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12931 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12932 esac
12933 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
12934 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12935 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12936 esac
12937 case "$gethostbyaddr_r_proto" in
90e831dc 12938 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12939 gethostbyaddr_r_proto=0
a48ec845 12940 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12941 * ) case "$gethostbyaddr_r_proto" in
12942 REENTRANT_PROTO*) ;;
12943 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12944 esac
12945 echo "Prototype: $try" ;;
12946 esac
12947 ;;
c18e646a
JH
12948 *) case "$usethreads" in
12949 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12950 esac
90e831dc
SB
12951 d_gethostbyaddr_r=undef
12952 gethostbyaddr_r_proto=0
c18e646a 12953 ;;
a48ec845
JH
12954 esac
12955 ;;
10bc17b6
JH
12956*) gethostbyaddr_r_proto=0
12957 ;;
12958esac
12959
12960: see if gethostbyname_r exists
12961set gethostbyname_r d_gethostbyname_r
12962eval $inlibc
12963case "$d_gethostbyname_r" in
12964"$define")
12965 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12966 case "$d_gethostbyname_r_proto:$usethreads" in
12967 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
12968 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12969 eval $hasproto ;;
12970 *) ;;
12971 esac
12972 case "$d_gethostbyname_r_proto" in
12973 define)
10bc17b6
JH
12974 case "$gethostbyname_r_proto" in
12975 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12976 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12977 esac
12978 case "$gethostbyname_r_proto" in
12979 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12980 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12981 esac
12982 case "$gethostbyname_r_proto" in
12983 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12984 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12985 esac
12986 case "$gethostbyname_r_proto" in
90e831dc 12987 ''|0) d_gethostbyname_r=undef
10bc17b6 12988 gethostbyname_r_proto=0
a48ec845 12989 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12990 * ) case "$gethostbyname_r_proto" in
12991 REENTRANT_PROTO*) ;;
12992 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12993 esac
12994 echo "Prototype: $try" ;;
12995 esac
12996 ;;
c18e646a
JH
12997 *) case "$usethreads" in
12998 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12999 esac
90e831dc
SB
13000 d_gethostbyname_r=undef
13001 gethostbyname_r_proto=0
c18e646a 13002 ;;
a48ec845
JH
13003 esac
13004 ;;
10bc17b6
JH
13005*) gethostbyname_r_proto=0
13006 ;;
13007esac
13008
13009: see if gethostent_r exists
13010set gethostent_r d_gethostent_r
13011eval $inlibc
13012case "$d_gethostent_r" in
13013"$define")
13014 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13015 case "$d_gethostent_r_proto:$usethreads" in
13016 ":define") d_gethostent_r_proto=define
a48ec845
JH
13017 set d_gethostent_r_proto gethostent_r $hdrs
13018 eval $hasproto ;;
13019 *) ;;
13020 esac
13021 case "$d_gethostent_r_proto" in
13022 define)
10bc17b6
JH
13023 case "$gethostent_r_proto" in
13024 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13025 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13026 esac
13027 case "$gethostent_r_proto" in
13028 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13029 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13030 esac
13031 case "$gethostent_r_proto" in
13032 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13033 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13034 esac
13035 case "$gethostent_r_proto" in
13036 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13037 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13038 esac
13039 case "$gethostent_r_proto" in
13040 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13041 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13042 esac
13043 case "$gethostent_r_proto" in
13044 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13045 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13046 esac
13047 case "$gethostent_r_proto" in
90e831dc 13048 ''|0) d_gethostent_r=undef
10bc17b6 13049 gethostent_r_proto=0
a48ec845 13050 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13051 * ) case "$gethostent_r_proto" in
13052 REENTRANT_PROTO*) ;;
13053 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13054 esac
13055 echo "Prototype: $try" ;;
13056 esac
13057 ;;
c18e646a
JH
13058 *) case "$usethreads" in
13059 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13060 esac
90e831dc
SB
13061 d_gethostent_r=undef
13062 gethostent_r_proto=0
c18e646a 13063 ;;
a48ec845
JH
13064 esac
13065 ;;
10bc17b6
JH
13066*) gethostent_r_proto=0
13067 ;;
13068esac
b4eb6b3d
JH
13069
13070: see if prototypes for various gethostxxx netdb.h functions are available
13071echo " "
13072set d_gethostprotos gethostent $i_netdb netdb.h
13073eval $hasproto
13074
4e0554ec
JH
13075: see if getitimer exists
13076set getitimer d_getitimer
13077eval $inlibc
13078
b4eb6b3d
JH
13079: see if getlogin exists
13080set getlogin d_getlogin
13081eval $inlibc
13082
10bc17b6
JH
13083: see if getlogin_r exists
13084set getlogin_r d_getlogin_r
13085eval $inlibc
13086case "$d_getlogin_r" in
13087"$define")
13088 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13089 case "$d_getlogin_r_proto:$usethreads" in
13090 ":define") d_getlogin_r_proto=define
a48ec845
JH
13091 set d_getlogin_r_proto getlogin_r $hdrs
13092 eval $hasproto ;;
13093 *) ;;
13094 esac
13095 case "$d_getlogin_r_proto" in
13096 define)
10bc17b6
JH
13097 case "$getlogin_r_proto" in
13098 ''|0) try='int getlogin_r(char*, size_t);'
13099 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13100 esac
13101 case "$getlogin_r_proto" in
13102 ''|0) try='int getlogin_r(char*, int);'
13103 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13104 esac
13105 case "$getlogin_r_proto" in
13106 ''|0) try='char* getlogin_r(char*, size_t);'
13107 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13108 esac
13109 case "$getlogin_r_proto" in
13110 ''|0) try='char* getlogin_r(char*, int);'
13111 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13112 esac
13113 case "$getlogin_r_proto" in
90e831dc 13114 ''|0) d_getlogin_r=undef
10bc17b6 13115 getlogin_r_proto=0
a48ec845 13116 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13117 * ) case "$getlogin_r_proto" in
13118 REENTRANT_PROTO*) ;;
13119 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13120 esac
13121 echo "Prototype: $try" ;;
13122 esac
13123 ;;
c18e646a
JH
13124 *) case "$usethreads" in
13125 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13126 esac
90e831dc
SB
13127 d_getlogin_r=undef
13128 getlogin_r_proto=0
c18e646a 13129 ;;
a48ec845
JH
13130 esac
13131 ;;
10bc17b6
JH
13132*) getlogin_r_proto=0
13133 ;;
13134esac
13135
b4eb6b3d
JH
13136: see if getmnt exists
13137set getmnt d_getmnt
13138eval $inlibc
13139
13140: see if getmntent exists
13141set getmntent d_getmntent
13142eval $inlibc
13143
13144: see if getnetbyaddr exists
13145set getnetbyaddr d_getnbyaddr
13146eval $inlibc
13147
13148: see if getnetbyname exists
13149set getnetbyname d_getnbyname
13150eval $inlibc
13151
13152: see if getnetent exists
13153set getnetent d_getnent
13154eval $inlibc
13155
10bc17b6
JH
13156: see if getnetbyaddr_r exists
13157set getnetbyaddr_r d_getnetbyaddr_r
13158eval $inlibc
13159case "$d_getnetbyaddr_r" in
13160"$define")
13161 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13162 case "$d_getnetbyaddr_r_proto:$usethreads" in
13163 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13164 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13165 eval $hasproto ;;
13166 *) ;;
13167 esac
13168 case "$d_getnetbyaddr_r_proto" in
13169 define)
10bc17b6
JH
13170 case "$getnetbyaddr_r_proto" in
13171 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13172 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13173 esac
13174 case "$getnetbyaddr_r_proto" in
13175 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13176 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13177 esac
13178 case "$getnetbyaddr_r_proto" in
13179 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13180 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13181 esac
13182 case "$getnetbyaddr_r_proto" in
13183 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13184 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13185 esac
13186 case "$getnetbyaddr_r_proto" in
13187 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13188 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13189 esac
13190 case "$getnetbyaddr_r_proto" in
13191 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13192 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13193 esac
13194 case "$getnetbyaddr_r_proto" in
13195 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13196 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13197 esac
13198 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13199 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13200 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13201 esac
13202 case "$getnetbyaddr_r_proto" in
90e831dc 13203 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13204 getnetbyaddr_r_proto=0
a48ec845 13205 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13206 * ) case "$getnetbyaddr_r_proto" in
13207 REENTRANT_PROTO*) ;;
13208 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13209 esac
13210 echo "Prototype: $try" ;;
13211 esac
13212 ;;
c18e646a
JH
13213 *) case "$usethreads" in
13214 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13215 esac
90e831dc
SB
13216 d_getnetbyaddr_r=undef
13217 getnetbyaddr_r_proto=0
c18e646a 13218 ;;
a48ec845
JH
13219 esac
13220 ;;
10bc17b6
JH
13221*) getnetbyaddr_r_proto=0
13222 ;;
13223esac
13224
13225: see if getnetbyname_r exists
13226set getnetbyname_r d_getnetbyname_r
13227eval $inlibc
13228case "$d_getnetbyname_r" in
13229"$define")
13230 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13231 case "$d_getnetbyname_r_proto:$usethreads" in
13232 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13233 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13234 eval $hasproto ;;
13235 *) ;;
13236 esac
13237 case "$d_getnetbyname_r_proto" in
13238 define)
10bc17b6
JH
13239 case "$getnetbyname_r_proto" in
13240 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13241 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13242 esac
13243 case "$getnetbyname_r_proto" in
13244 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13245 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13246 esac
13247 case "$getnetbyname_r_proto" in
13248 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13249 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13250 esac
13251 case "$getnetbyname_r_proto" in
13252 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13253 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13254 esac
13255 case "$getnetbyname_r_proto" in
90e831dc 13256 ''|0) d_getnetbyname_r=undef
10bc17b6 13257 getnetbyname_r_proto=0
a48ec845 13258 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13259 * ) case "$getnetbyname_r_proto" in
13260 REENTRANT_PROTO*) ;;
13261 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13262 esac
13263 echo "Prototype: $try" ;;
13264 esac
13265 ;;
c18e646a
JH
13266 *) case "$usethreads" in
13267 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13268 esac
90e831dc
SB
13269 d_getnetbyname_r=undef
13270 getnetbyname_r_proto=0
c18e646a 13271 ;;
a48ec845
JH
13272 esac
13273 ;;
10bc17b6
JH
13274*) getnetbyname_r_proto=0
13275 ;;
13276esac
13277
13278: see if getnetent_r exists
13279set getnetent_r d_getnetent_r
13280eval $inlibc
13281case "$d_getnetent_r" in
13282"$define")
13283 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13284 case "$d_getnetent_r_proto:$usethreads" in
13285 ":define") d_getnetent_r_proto=define
a48ec845
JH
13286 set d_getnetent_r_proto getnetent_r $hdrs
13287 eval $hasproto ;;
13288 *) ;;
13289 esac
13290 case "$d_getnetent_r_proto" in
13291 define)
10bc17b6
JH
13292 case "$getnetent_r_proto" in
13293 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13294 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13295 esac
13296 case "$getnetent_r_proto" in
13297 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13298 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13299 esac
13300 case "$getnetent_r_proto" in
13301 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13302 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13303 esac
13304 case "$getnetent_r_proto" in
13305 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13306 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13307 esac
13308 case "$getnetent_r_proto" in
13309 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13310 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13311 esac
13312 case "$getnetent_r_proto" in
13313 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13314 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13315 esac
13316 case "$getnetent_r_proto" in
90e831dc 13317 ''|0) d_getnetent_r=undef
10bc17b6 13318 getnetent_r_proto=0
a48ec845 13319 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13320 * ) case "$getnetent_r_proto" in
13321 REENTRANT_PROTO*) ;;
13322 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13323 esac
13324 echo "Prototype: $try" ;;
13325 esac
13326 ;;
c18e646a
JH
13327 *) case "$usethreads" in
13328 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13329 esac
90e831dc
SB
13330 d_getnetent_r=undef
13331 getnetent_r_proto=0
c18e646a 13332 ;;
a48ec845
JH
13333 esac
13334 ;;
10bc17b6
JH
13335*) getnetent_r_proto=0
13336 ;;
13337esac
13338
b4eb6b3d
JH
13339: see if prototypes for various getnetxxx netdb.h functions are available
13340echo " "
13341set d_getnetprotos getnetent $i_netdb netdb.h
13342eval $hasproto
13343
0c0643d0
JH
13344: see if getpagesize exists
13345set getpagesize d_getpagsz
13346eval $inlibc
13347
b4eb6b3d
JH
13348
13349: see if getprotobyname exists
13350set getprotobyname d_getpbyname
13351eval $inlibc
13352
13353: see if getprotobynumber exists
13354set getprotobynumber d_getpbynumber
13355eval $inlibc
13356
13357: see if getprotoent exists
13358set getprotoent d_getpent
13359eval $inlibc
13360
13361: see if getpgid exists
13362set getpgid d_getpgid
13363eval $inlibc
13364
13365: see if getpgrp2 exists
13366set getpgrp2 d_getpgrp2
13367eval $inlibc
13368
13369: see if getppid exists
13370set getppid d_getppid
13371eval $inlibc
13372
13373: see if getpriority exists
13374set getpriority d_getprior
13375eval $inlibc
13376
10bc17b6
JH
13377: see if getprotobyname_r exists
13378set getprotobyname_r d_getprotobyname_r
13379eval $inlibc
13380case "$d_getprotobyname_r" in
13381"$define")
13382 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13383 case "$d_getprotobyname_r_proto:$usethreads" in
13384 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13385 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13386 eval $hasproto ;;
13387 *) ;;
13388 esac
13389 case "$d_getprotobyname_r_proto" in
13390 define)
10bc17b6
JH
13391 case "$getprotobyname_r_proto" in
13392 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13393 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13394 esac
13395 case "$getprotobyname_r_proto" in
13396 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13397 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13398 esac
13399 case "$getprotobyname_r_proto" in
13400 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13401 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13402 esac
13403 case "$getprotobyname_r_proto" in
90e831dc 13404 ''|0) d_getprotobyname_r=undef
10bc17b6 13405 getprotobyname_r_proto=0
a48ec845 13406 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13407 * ) case "$getprotobyname_r_proto" in
13408 REENTRANT_PROTO*) ;;
13409 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13410 esac
13411 echo "Prototype: $try" ;;
13412 esac
13413 ;;
c18e646a
JH
13414 *) case "$usethreads" in
13415 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13416 esac
90e831dc
SB
13417 d_getprotobyname_r=undef
13418 getprotobyname_r_proto=0
c18e646a 13419 ;;
a48ec845
JH
13420 esac
13421 ;;
10bc17b6
JH
13422*) getprotobyname_r_proto=0
13423 ;;
13424esac
13425
13426: see if getprotobynumber_r exists
13427set getprotobynumber_r d_getprotobynumber_r
13428eval $inlibc
13429case "$d_getprotobynumber_r" in
13430"$define")
13431 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13432 case "$d_getprotobynumber_r_proto:$usethreads" in
13433 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13434 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13435 eval $hasproto ;;
13436 *) ;;
13437 esac
13438 case "$d_getprotobynumber_r_proto" in
13439 define)
10bc17b6
JH
13440 case "$getprotobynumber_r_proto" in
13441 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13442 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13443 esac
13444 case "$getprotobynumber_r_proto" in
13445 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13446 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13447 esac
13448 case "$getprotobynumber_r_proto" in
13449 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13450 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13451 esac
13452 case "$getprotobynumber_r_proto" in
90e831dc 13453 ''|0) d_getprotobynumber_r=undef
10bc17b6 13454 getprotobynumber_r_proto=0
a48ec845 13455 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13456 * ) case "$getprotobynumber_r_proto" in
13457 REENTRANT_PROTO*) ;;
13458 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13459 esac
13460 echo "Prototype: $try" ;;
13461 esac
13462 ;;
c18e646a
JH
13463 *) case "$usethreads" in
13464 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13465 esac
90e831dc
SB
13466 d_getprotobynumber_r=undef
13467 getprotobynumber_r_proto=0
c18e646a 13468 ;;
a48ec845
JH
13469 esac
13470 ;;
10bc17b6
JH
13471*) getprotobynumber_r_proto=0
13472 ;;
13473esac
13474
13475: see if getprotoent_r exists
13476set getprotoent_r d_getprotoent_r
13477eval $inlibc
13478case "$d_getprotoent_r" in
13479"$define")
13480 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13481 case "$d_getprotoent_r_proto:$usethreads" in
13482 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13483 set d_getprotoent_r_proto getprotoent_r $hdrs
13484 eval $hasproto ;;
13485 *) ;;
13486 esac
13487 case "$d_getprotoent_r_proto" in
13488 define)
10bc17b6
JH
13489 case "$getprotoent_r_proto" in
13490 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13491 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13492 esac
13493 case "$getprotoent_r_proto" in
13494 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13495 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13496 esac
13497 case "$getprotoent_r_proto" in
13498 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13499 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13500 esac
13501 case "$getprotoent_r_proto" in
13502 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13503 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13504 esac
13505 case "$getprotoent_r_proto" in
90e831dc 13506 ''|0) d_getprotoent_r=undef
10bc17b6 13507 getprotoent_r_proto=0
a48ec845 13508 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13509 * ) case "$getprotoent_r_proto" in
13510 REENTRANT_PROTO*) ;;
13511 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13512 esac
13513 echo "Prototype: $try" ;;
13514 esac
13515 ;;
c18e646a
JH
13516 *) case "$usethreads" in
13517 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13518 esac
90e831dc
SB
13519 d_getprotoent_r=undef
13520 getprotoent_r_proto=0
c18e646a 13521 ;;
a48ec845
JH
13522 esac
13523 ;;
10bc17b6
JH
13524*) getprotoent_r_proto=0
13525 ;;
13526esac
13527
b4eb6b3d
JH
13528: see if prototypes for various getprotoxxx netdb.h functions are available
13529echo " "
13530set d_getprotoprotos getprotoent $i_netdb netdb.h
13531eval $hasproto
13532
13533: see if getprpwnam exists
13534set getprpwnam d_getprpwnam
13535eval $inlibc
13536
13537: see if getpwent exists
13538set getpwent d_getpwent
13539eval $inlibc
13540
10bc17b6
JH
13541: see if getpwent_r exists
13542set getpwent_r d_getpwent_r
13543eval $inlibc
13544case "$d_getpwent_r" in
13545"$define")
13546 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13547 case "$d_getpwent_r_proto:$usethreads" in
13548 ":define") d_getpwent_r_proto=define
a48ec845
JH
13549 set d_getpwent_r_proto getpwent_r $hdrs
13550 eval $hasproto ;;
13551 *) ;;
13552 esac
13553 case "$d_getpwent_r_proto" in
13554 define)
10bc17b6
JH
13555 case "$getpwent_r_proto" in
13556 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13557 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13558 esac
13559 case "$getpwent_r_proto" in
13560 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13561 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13562 esac
13563 case "$getpwent_r_proto" in
13564 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13565 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13566 esac
13567 case "$getpwent_r_proto" in
13568 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13569 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13570 esac
13571 case "$getpwent_r_proto" in
13572 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13573 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13574 esac
13575 case "$getpwent_r_proto" in
13576 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13577 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13578 esac
13579 case "$getpwent_r_proto" in
90e831dc 13580 ''|0) d_getpwent_r=undef
10bc17b6 13581 getpwent_r_proto=0
a48ec845 13582 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13583 * ) case "$getpwent_r_proto" in
13584 REENTRANT_PROTO*) ;;
13585 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13586 esac
13587 echo "Prototype: $try" ;;
13588 esac
13589 ;;
c18e646a
JH
13590 *) case "$usethreads" in
13591 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13592 esac
90e831dc
SB
13593 d_getpwent_r=undef
13594 getpwent_r_proto=0
c18e646a 13595 ;;
a48ec845
JH
13596 esac
13597 ;;
10bc17b6
JH
13598*) getpwent_r_proto=0
13599 ;;
13600esac
13601
13602: see if getpwnam_r exists
13603set getpwnam_r d_getpwnam_r
13604eval $inlibc
13605case "$d_getpwnam_r" in
13606"$define")
13607 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13608 case "$d_getpwnam_r_proto:$usethreads" in
13609 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13610 set d_getpwnam_r_proto getpwnam_r $hdrs
13611 eval $hasproto ;;
13612 *) ;;
13613 esac
13614 case "$d_getpwnam_r_proto" in
13615 define)
10bc17b6
JH
13616 case "$getpwnam_r_proto" in
13617 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13618 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13619 esac
13620 case "$getpwnam_r_proto" in
13621 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13622 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13623 esac
13624 case "$getpwnam_r_proto" in
13625 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13626 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13627 esac
13628 case "$getpwnam_r_proto" in
13629 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13630 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13631 esac
13632 case "$getpwnam_r_proto" in
90e831dc 13633 ''|0) d_getpwnam_r=undef
10bc17b6 13634 getpwnam_r_proto=0
a48ec845 13635 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13636 * ) case "$getpwnam_r_proto" in
13637 REENTRANT_PROTO*) ;;
13638 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13639 esac
13640 echo "Prototype: $try" ;;
13641 esac
13642 ;;
c18e646a
JH
13643 *) case "$usethreads" in
13644 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13645 esac
90e831dc
SB
13646 d_getpwnam_r=undef
13647 getpwnam_r_proto=0
c18e646a 13648 ;;
a48ec845
JH
13649 esac
13650 ;;
10bc17b6
JH
13651*) getpwnam_r_proto=0
13652 ;;
13653esac
13654
13655: see if getpwuid_r exists
13656set getpwuid_r d_getpwuid_r
13657eval $inlibc
13658case "$d_getpwuid_r" in
13659"$define")
13660 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13661 case "$d_getpwuid_r_proto:$usethreads" in
13662 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13663 set d_getpwuid_r_proto getpwuid_r $hdrs
13664 eval $hasproto ;;
13665 *) ;;
13666 esac
13667 case "$d_getpwuid_r_proto" in
13668 define)
10bc17b6
JH
13669 case "$getpwuid_r_proto" in
13670 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13671 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13672 esac
13673 case "$getpwuid_r_proto" in
13674 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13675 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13676 esac
13677 case "$getpwuid_r_proto" in
13678 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13679 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13680 esac
13681 case "$getpwuid_r_proto" in
13682 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13683 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13684 esac
13685 case "$getpwuid_r_proto" in
90e831dc 13686 ''|0) d_getpwuid_r=undef
10bc17b6 13687 getpwuid_r_proto=0
a48ec845 13688 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13689 * ) case "$getpwuid_r_proto" in
13690 REENTRANT_PROTO*) ;;
13691 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13692 esac
13693 echo "Prototype: $try" ;;
13694 esac
13695 ;;
c18e646a
JH
13696 *) case "$usethreads" in
13697 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13698 esac
90e831dc
SB
13699 d_getpwuid_r=undef
13700 getpwuid_r_proto=0
c18e646a 13701 ;;
a48ec845
JH
13702 esac
13703 ;;
10bc17b6
JH
13704*) getpwuid_r_proto=0
13705 ;;
13706esac
13707
b4eb6b3d
JH
13708
13709: see if getservbyname exists
13710set getservbyname d_getsbyname
13711eval $inlibc
13712
13713: see if getservbyport exists
13714set getservbyport d_getsbyport
13715eval $inlibc
13716
13717: see if getservent exists
13718set getservent d_getsent
13719eval $inlibc
13720
10bc17b6
JH
13721: see if getservbyname_r exists
13722set getservbyname_r d_getservbyname_r
13723eval $inlibc
13724case "$d_getservbyname_r" in
13725"$define")
13726 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13727 case "$d_getservbyname_r_proto:$usethreads" in
13728 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13729 set d_getservbyname_r_proto getservbyname_r $hdrs
13730 eval $hasproto ;;
13731 *) ;;
13732 esac
13733 case "$d_getservbyname_r_proto" in
13734 define)
10bc17b6
JH
13735 case "$getservbyname_r_proto" in
13736 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13737 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13738 esac
13739 case "$getservbyname_r_proto" in
13740 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13741 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13742 esac
13743 case "$getservbyname_r_proto" in
13744 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13745 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13746 esac
13747 case "$getservbyname_r_proto" in
90e831dc 13748 ''|0) d_getservbyname_r=undef
10bc17b6 13749 getservbyname_r_proto=0
a48ec845 13750 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13751 * ) case "$getservbyname_r_proto" in
13752 REENTRANT_PROTO*) ;;
13753 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13754 esac
13755 echo "Prototype: $try" ;;
13756 esac
13757 ;;
c18e646a
JH
13758 *) case "$usethreads" in
13759 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13760 esac
90e831dc
SB
13761 d_getservbyname_r=undef
13762 getservbyname_r_proto=0
c18e646a 13763 ;;
a48ec845
JH
13764 esac
13765 ;;
10bc17b6
JH
13766*) getservbyname_r_proto=0
13767 ;;
13768esac
13769
13770: see if getservbyport_r exists
13771set getservbyport_r d_getservbyport_r
13772eval $inlibc
13773case "$d_getservbyport_r" in
13774"$define")
13775 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13776 case "$d_getservbyport_r_proto:$usethreads" in
13777 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13778 set d_getservbyport_r_proto getservbyport_r $hdrs
13779 eval $hasproto ;;
13780 *) ;;
13781 esac
13782 case "$d_getservbyport_r_proto" in
13783 define)
10bc17b6
JH
13784 case "$getservbyport_r_proto" in
13785 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13786 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13787 esac
13788 case "$getservbyport_r_proto" in
13789 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13790 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13791 esac
13792 case "$getservbyport_r_proto" in
13793 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13794 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13795 esac
13796 case "$getservbyport_r_proto" in
90e831dc 13797 ''|0) d_getservbyport_r=undef
10bc17b6 13798 getservbyport_r_proto=0
a48ec845 13799 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13800 * ) case "$getservbyport_r_proto" in
13801 REENTRANT_PROTO*) ;;
13802 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13803 esac
13804 echo "Prototype: $try" ;;
13805 esac
13806 ;;
c18e646a
JH
13807 *) case "$usethreads" in
13808 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13809 esac
90e831dc
SB
13810 d_getservbyport_r=undef
13811 getservbyport_r_proto=0
c18e646a 13812 ;;
a48ec845
JH
13813 esac
13814 ;;
10bc17b6
JH
13815*) getservbyport_r_proto=0
13816 ;;
13817esac
13818
13819: see if getservent_r exists
13820set getservent_r d_getservent_r
13821eval $inlibc
13822case "$d_getservent_r" in
13823"$define")
13824 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13825 case "$d_getservent_r_proto:$usethreads" in
13826 ":define") d_getservent_r_proto=define
a48ec845
JH
13827 set d_getservent_r_proto getservent_r $hdrs
13828 eval $hasproto ;;
13829 *) ;;
13830 esac
13831 case "$d_getservent_r_proto" in
13832 define)
10bc17b6
JH
13833 case "$getservent_r_proto" in
13834 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13835 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13836 esac
13837 case "$getservent_r_proto" in
13838 ''|0) try='int getservent_r(struct servent*, char*, int);'
13839 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13840 esac
13841 case "$getservent_r_proto" in
13842 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13843 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13844 esac
13845 case "$getservent_r_proto" in
13846 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13847 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13848 esac
13849 case "$getservent_r_proto" in
90e831dc 13850 ''|0) d_getservent_r=undef
10bc17b6 13851 getservent_r_proto=0
a48ec845 13852 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13853 * ) case "$getservent_r_proto" in
13854 REENTRANT_PROTO*) ;;
13855 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13856 esac
13857 echo "Prototype: $try" ;;
13858 esac
13859 ;;
c18e646a
JH
13860 *) case "$usethreads" in
13861 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13862 esac
90e831dc
SB
13863 d_getservent_r=undef
13864 getservent_r_proto=0
c18e646a 13865 ;;
a48ec845
JH
13866 esac
13867 ;;
10bc17b6
JH
13868*) getservent_r_proto=0
13869 ;;
13870esac
13871
b4eb6b3d
JH
13872: see if prototypes for various getservxxx netdb.h functions are available
13873echo " "
13874set d_getservprotos getservent $i_netdb netdb.h
13875eval $hasproto
13876
13877: see if getspnam exists
13878set getspnam d_getspnam
13879eval $inlibc
13880
10bc17b6
JH
13881: see if this is a shadow.h system
13882set shadow.h i_shadow
13883eval $inhdr
13884
13885: see if getspnam_r exists
13886set getspnam_r d_getspnam_r
13887eval $inlibc
13888case "$d_getspnam_r" in
13889"$define")
13890 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13891 case "$d_getspnam_r_proto:$usethreads" in
13892 ":define") d_getspnam_r_proto=define
a48ec845
JH
13893 set d_getspnam_r_proto getspnam_r $hdrs
13894 eval $hasproto ;;
13895 *) ;;
13896 esac
13897 case "$d_getspnam_r_proto" in
13898 define)
10bc17b6
JH
13899 case "$getspnam_r_proto" in
13900 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13901 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13902 esac
13903 case "$getspnam_r_proto" in
13904 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13905 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13906 esac
13907 case "$getspnam_r_proto" in
90e831dc 13908 ''|0) d_getspnam_r=undef
10bc17b6 13909 getspnam_r_proto=0
a48ec845 13910 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13911 * ) case "$getspnam_r_proto" in
13912 REENTRANT_PROTO*) ;;
13913 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13914 esac
13915 echo "Prototype: $try" ;;
13916 esac
13917 ;;
c18e646a
JH
13918 *) case "$usethreads" in
13919 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13920 esac
90e831dc
SB
13921 d_getspnam_r=undef
13922 getspnam_r_proto=0
c18e646a 13923 ;;
a48ec845
JH
13924 esac
13925 ;;
10bc17b6
JH
13926*) getspnam_r_proto=0
13927 ;;
13928esac
13929
b4eb6b3d
JH
13930: see if gettimeofday or ftime exists
13931set gettimeofday d_gettimeod
13932eval $inlibc
13933case "$d_gettimeod" in
13934"$undef")
13935 set ftime d_ftime
13936 eval $inlibc
13937 ;;
13938*)
13939 val="$undef"; set d_ftime; eval $setvar
13940 ;;
13941esac
13942case "$d_gettimeod$d_ftime" in
13943"$undef$undef")
13944 echo " "
13945 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13946 ;;
13947esac
13948
10bc17b6
JH
13949: see if gmtime_r exists
13950set gmtime_r d_gmtime_r
13951eval $inlibc
13952case "$d_gmtime_r" in
13953"$define")
d63eadf0 13954 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13955 case "$d_gmtime_r_proto:$usethreads" in
13956 ":define") d_gmtime_r_proto=define
a48ec845
JH
13957 set d_gmtime_r_proto gmtime_r $hdrs
13958 eval $hasproto ;;
13959 *) ;;
13960 esac
13961 case "$d_gmtime_r_proto" in
13962 define)
10bc17b6
JH
13963 case "$gmtime_r_proto" in
13964 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13965 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13966 esac
13967 case "$gmtime_r_proto" in
13968 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13969 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13970 esac
13971 case "$gmtime_r_proto" in
90e831dc 13972 ''|0) d_gmtime_r=undef
10bc17b6 13973 gmtime_r_proto=0
a48ec845 13974 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13975 * ) case "$gmtime_r_proto" in
13976 REENTRANT_PROTO*) ;;
13977 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13978 esac
13979 echo "Prototype: $try" ;;
13980 esac
b4eb6b3d 13981 ;;
c18e646a
JH
13982 *) case "$usethreads" in
13983 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13984 esac
90e831dc
SB
13985 d_gmtime_r=undef
13986 gmtime_r_proto=0
c18e646a 13987 ;;
a48ec845
JH
13988 esac
13989 ;;
10bc17b6 13990*) gmtime_r_proto=0
b4eb6b3d
JH
13991 ;;
13992esac
13993
13994: see if hasmntopt exists
13995set hasmntopt d_hasmntopt
13996eval $inlibc
13997
13998: see if this is a netinet/in.h or sys/in.h system
13999set netinet/in.h i_niin sys/in.h i_sysin
14000eval $inhdr
14001
14002: see if arpa/inet.h has to be included
14003set arpa/inet.h i_arpainet
14004eval $inhdr
14005
14006: see if htonl --and friends-- exists
14007val=''
14008set htonl val
14009eval $inlibc
14010
14011: Maybe they are macros.
14012case "$val" in
14013$undef)
14014 $cat >htonl.c <<EOM
14015#include <stdio.h>
14016#include <sys/types.h>
14017#$i_niin I_NETINET_IN
14018#$i_sysin I_SYS_IN
14019#$i_arpainet I_ARPA_INET
14020#ifdef I_NETINET_IN
14021#include <netinet/in.h>
14022#endif
14023#ifdef I_SYS_IN
14024#include <sys/in.h>
14025#endif
14026#ifdef I_ARPA_INET
14027#include <arpa/inet.h>
14028#endif
14029#ifdef htonl
14030printf("Defined as a macro.");
14031#endif
14032EOM
14033 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14034 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14035 val="$define"
14036 echo "But it seems to be defined as a macro." >&4
14037 fi
14038 $rm -f htonl.?
14039 ;;
14040esac
14041set d_htonl
14042eval $setvar
14043
36adc09b
JH
14044: see if ilogbl exists
14045set ilogbl d_ilogbl
14046eval $inlibc
14047
b4eb6b3d
JH
14048: index or strchr
14049echo " "
14050if set index val -f; eval $csym; $val; then
14051 if set strchr val -f d_strchr; eval $csym; $val; then
14052 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14053 val="$define"
14054 vali="$undef"
14055 echo "strchr() found." >&4
14056 else
14057 val="$undef"
14058 vali="$define"
14059 echo "index() found." >&4
14060 fi
14061 else
14062 val="$undef"
14063 vali="$define"
8dfa8df9
JH
14064 echo "index() found." >&4
14065 fi
b4eb6b3d 14066else
8dfa8df9
JH
14067 if set strchr val -f d_strchr; eval $csym; $val; then
14068 val="$define"
14069 vali="$undef"
14070 echo "strchr() found." >&4
14071 else
14072 echo "No index() or strchr() found!" >&4
14073 val="$undef"
14074 vali="$undef"
14075 fi
b4eb6b3d 14076fi
8dfa8df9
JH
14077set d_strchr; eval $setvar
14078val="$vali"
14079set d_index; eval $setvar
14080
14081: check whether inet_aton exists
14082set inet_aton d_inetaton
14083eval $inlibc
b4eb6b3d
JH
14084
14085: Look for isascii
14086echo " "
36adc09b 14087$cat >isascii.c <<EOCP
b4eb6b3d
JH
14088#include <stdio.h>
14089#include <ctype.h>
55954f19
JH
14090#$i_stdlib I_STDLIB
14091#ifdef I_STDLIB
14092#include <stdlib.h>
14093#endif
b4eb6b3d
JH
14094int main() {
14095 int c = 'A';
14096 if (isascii(c))
14097 exit(0);
14098 else
14099 exit(1);
14100}
14101EOCP
14102set isascii
14103if eval $compile; then
14104 echo "isascii() found." >&4
14105 val="$define"
14106else
14107 echo "isascii() NOT found." >&4
14108 val="$undef"
14109fi
14110set d_isascii
14111eval $setvar
14112$rm -f isascii*
14113
758a5d79
JH
14114: see if isfinite exists
14115set isfinite d_isfinite
14116eval $inlibc
14117
14118: see if isinf exists
14119set isinf d_isinf
14120eval $inlibc
14121
b4eb6b3d
JH
14122: see if isnan exists
14123set isnan d_isnan
14124eval $inlibc
14125
14126: see if isnanl exists
14127set isnanl d_isnanl
14128eval $inlibc
14129
14130: see if killpg exists
14131set killpg d_killpg
14132eval $inlibc
14133
14134: see if lchown exists
14135echo " "
14136$cat > try.c <<'EOCP'
14137/* System header to define __stub macros and hopefully few prototypes,
14138 which can conflict with char lchown(); below. */
14139#include <assert.h>
14140/* Override any gcc2 internal prototype to avoid an error. */
14141/* We use char because int might match the return type of a gcc2
14142 builtin and then its argument prototype would still apply. */
14143char lchown();
14144int main() {
14145 /* The GNU C library defines this for functions which it implements
14146 to always fail with ENOSYS. Some functions are actually named
14147 something starting with __ and the normal name is an alias. */
14148#if defined (__stub_lchown) || defined (__stub___lchown)
14149choke me
14150#else
14151lchown();
14152#endif
14153; return 0; }
14154EOCP
14155set try
14156if eval $compile; then
14157 $echo "lchown() found." >&4
14158 val="$define"
14159else
14160 $echo "lchown() NOT found." >&4
14161 val="$undef"
14162fi
14163set d_lchown
14164eval $setvar
14165
14166: See if number of significant digits in a double precision number is known
14167echo " "
14168$cat >ldbl_dig.c <<EOM
14169#$i_limits I_LIMITS
14170#$i_float I_FLOAT
14171#ifdef I_LIMITS
14172#include <limits.h>
14173#endif
14174#ifdef I_FLOAT
14175#include <float.h>
14176#endif
14177#ifdef LDBL_DIG
14178printf("Contains LDBL_DIG");
14179#endif
14180EOM
14181$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14182if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14183 echo "LDBL_DIG found." >&4
14184 val="$define"
14185else
14186 echo "LDBL_DIG NOT found." >&4
14187 val="$undef"
14188fi
14189$rm -f ldbl_dig.?
14190set d_ldbl_dig
14191eval $setvar
14192
0a0abfba
MB
14193: see if this is a math.h system
14194set math.h i_math
14195eval $inhdr
14196
14197d_libm_lib_version="$undef"
14198case $i_math in
14199 $define)
14200 : check to see if math.h defines _LIB_VERSION
14201 echo " "
14202 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14203 $cat >try.c <<EOCP
14204#include <unistd.h>
14205#include <math.h>
14206int main (int argc, char *argv[])
14207{
14208 printf ("%d\n", _LIB_VERSION);
14209 return (0);
14210 } /* main */
14211EOCP
14212 set try
14213 if eval $compile; then
14214 foo=`$run ./try`
14215 echo "Yes, it does ($foo)" >&4
14216 d_libm_lib_version="$define"
14217 else
14218 echo "No, it does not (probably harmless)\n" >&4
14219 fi
14220 $rm -f try.* try core core.try.*
14221 ;;
14222
14223 esac
14224
b4eb6b3d
JH
14225: see if link exists
14226set link d_link
14227eval $inlibc
14228
10bc17b6
JH
14229: see if localtime_r exists
14230set localtime_r d_localtime_r
14231eval $inlibc
14232case "$d_localtime_r" in
14233"$define")
d63eadf0 14234 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14235 case "$d_localtime_r_proto:$usethreads" in
14236 ":define") d_localtime_r_proto=define
a48ec845
JH
14237 set d_localtime_r_proto localtime_r $hdrs
14238 eval $hasproto ;;
14239 *) ;;
14240 esac
14241 case "$d_localtime_r_proto" in
14242 define)
10bc17b6
JH
14243 case "$localtime_r_proto" in
14244 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14245 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14246 esac
14247 case "$localtime_r_proto" in
14248 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14249 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14250 esac
14251 case "$localtime_r_proto" in
90e831dc 14252 ''|0) d_localtime_r=undef
10bc17b6 14253 localtime_r_proto=0
a48ec845 14254 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14255 * ) case "$localtime_r_proto" in
14256 REENTRANT_PROTO*) ;;
14257 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14258 esac
14259 echo "Prototype: $try" ;;
14260 esac
14261 ;;
c18e646a
JH
14262 *) case "$usethreads" in
14263 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14264 esac
90e831dc
SB
14265 d_localtime_r=undef
14266 localtime_r_proto=0
c18e646a 14267 ;;
a48ec845
JH
14268 esac
14269 ;;
10bc17b6
JH
14270*) localtime_r_proto=0
14271 ;;
14272esac
14273
b4eb6b3d
JH
14274: see if localeconv exists
14275set localeconv d_locconv
14276eval $inlibc
14277
14278: see if lockf exists
14279set lockf d_lockf
14280eval $inlibc
14281
b4eb6b3d
JH
14282: see if prototype for lseek is available
14283echo " "
4786929f 14284set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14285eval $hasproto
14286
14287: see if lstat exists
14288set lstat d_lstat
14289eval $inlibc
14290
14291: see if madvise exists
14292set madvise d_madvise
14293eval $inlibc
14294
7dd121ae
MB
14295: see if malloc_size exists
14296set malloc_size d_malloc_size
14297eval $inlibc
14298
14299: see if malloc_size_good exists
14300set malloc_good_size d_malloc_good_size
14301eval $inlibc
14302
b4eb6b3d
JH
14303: see if mblen exists
14304set mblen d_mblen
14305eval $inlibc
14306
14307: see if mbstowcs exists
14308set mbstowcs d_mbstowcs
14309eval $inlibc
14310
14311: see if mbtowc exists
14312set mbtowc d_mbtowc
14313eval $inlibc
14314
14315: see if memchr exists
14316set memchr d_memchr
14317eval $inlibc
14318
14319: see if memcmp exists
14320set memcmp d_memcmp
14321eval $inlibc
14322
14323: see if memcpy exists
14324set memcpy d_memcpy
14325eval $inlibc
14326
14327: see if memmove exists
14328set memmove d_memmove
14329eval $inlibc
14330
14331: see if memset exists
14332set memset d_memset
14333eval $inlibc
14334
14335: see if mkdir exists
14336set mkdir d_mkdir
14337eval $inlibc
14338
14339: see if mkdtemp exists
14340set mkdtemp d_mkdtemp
14341eval $inlibc
14342
14343: see if mkfifo exists
14344set mkfifo d_mkfifo
14345eval $inlibc
14346
14347: see if mkstemp exists
14348set mkstemp d_mkstemp
14349eval $inlibc
14350
14351: see if mkstemps exists
14352set mkstemps d_mkstemps
14353eval $inlibc
14354
14355: see if mktime exists
14356set mktime d_mktime
14357eval $inlibc
14358
14359: see if this is a sys/mman.h system
14360set sys/mman.h i_sysmman
14361eval $inhdr
14362
14363: see if mmap exists
14364set mmap d_mmap
14365eval $inlibc
14366: see what shmat returns
14367: default to something harmless
14368mmaptype='void *'
14369case "$i_sysmman$d_mmap" in
14370"$define$define")
14371 $cat >mmap.c <<'END'
14372#include <sys/mman.h>
14373void *mmap();
14374END
14375 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14376 mmaptype='void *'
14377 else
14378 mmaptype='caddr_t'
14379 fi
14380 echo "and it returns ($mmaptype)." >&4
14381 ;;
14382esac
14383
14384
14385
89ce900e
JH
14386: see if sqrtl exists
14387set sqrtl d_sqrtl
14388eval $inlibc
14389
af1ff193
JH
14390: see if scalbnl exists
14391set scalbnl d_scalbnl
14392eval $inlibc
14393
89ce900e
JH
14394: see if modfl exists
14395set modfl d_modfl
14396eval $inlibc
14397
14398: see if prototype for modfl is available
14399echo " "
3a794506 14400set d_modflproto modfl $i_math math.h
89ce900e
JH
14401eval $hasproto
14402
14403d_modfl_pow32_bug="$undef"
14404
14405case "$d_longdbl$d_modfl" in
14406$define$define)
14407 $cat <<EOM
14408Checking to see whether your modfl() is okay for large values...
14409EOM
14410$cat >try.c <<EOCP
14411#include <math.h>
14412#include <stdio.h>
14413EOCP
14414if $test "X$d_modflproto" != "X$define"; then
14415 $cat >>try.c <<EOCP
14416/* Sigh. many current glibcs provide the function, but do not prototype it. */
14417long double modfl (long double, long double *);
14418EOCP
14419fi
14420$cat >>try.c <<EOCP
14421int main() {
14422 long double nv = 4294967303.15;
14423 long double v, w;
14424 v = modfl(nv, &w);
14425#ifdef __GLIBC__
14426 printf("glibc");
14427#endif
14428 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14429 return 0;
14430}
14431EOCP
14432 case "$osname:$gccversion" in
14433 aix:) saveccflags="$ccflags"
14434 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14435 esac
14436 set try
14437 if eval $compile; then
14438 foo=`$run ./try`
14439 case "$foo" in
14440 *" 4294967303.150000 1.150000 4294967302.000000")
14441 echo >&4 "Your modfl() is broken for large values."
14442 d_modfl_pow32_bug="$define"
14443 case "$foo" in
14444 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14445 ;;
14446 esac
14447 ;;
14448 *" 4294967303.150000 0.150000 4294967303.000000")
14449 echo >&4 "Your modfl() seems okay for large values."
14450 ;;
14451 *) echo >&4 "I don't understand your modfl() at all."
14452 d_modfl="$undef"
14453 ;;
14454 esac
14455 $rm -f try.* try core core.try.*
14456 else
14457 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14458 d_modfl="$undef"
14459 fi
14460 case "$osname:$gccversion" in
14461 aix:) ccflags="$saveccflags" ;; # restore
14462 esac
14463 ;;
14464esac
14465
14466if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14467 message=""
14468 if $test "$d_sqrtl" != "$define"; then
14469 message="$message sqrtl"
14470 fi
14471 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14472 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14473 echo "You have both aintl and copysignl, so I can emulate modfl."
14474 else
af1ff193 14475 message="$message modfl"
89ce900e 14476 fi
af1ff193
JH
14477 fi
14478 if $test "$d_frexpl" != "$define"; then
14479 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14480 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14481 else
14482 message="$message frexpl"
14483 fi
14484 fi
89ce900e 14485
af1ff193 14486 if $test "$message" != ""; then
89ce900e
JH
14487 $cat <<EOM >&4
14488
14489*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14490*** the following mathematical functions needed for long double support:
14491*** $message
fe63a0b4
JH
14492*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14493*** Cannot continue, aborting.
89ce900e
JH
14494
14495EOM
14496
fe63a0b4 14497 exit 1
89ce900e
JH
14498 fi
14499fi
14500
b4eb6b3d
JH
14501: see if mprotect exists
14502set mprotect d_mprotect
14503eval $inlibc
14504
14505: see if msgctl exists
14506set msgctl d_msgctl
14507eval $inlibc
14508
14509: see if msgget exists
14510set msgget d_msgget
14511eval $inlibc
14512
14513: see if msgsnd exists
14514set msgsnd d_msgsnd
14515eval $inlibc
14516
14517: see if msgrcv exists
14518set msgrcv d_msgrcv
14519eval $inlibc
14520
14521: see how much of the 'msg*(2)' library is present.
14522h_msg=true
14523echo " "
14524case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14525*"$undef"*) h_msg=false;;
14526esac
14527case "$osname" in
14528freebsd)
14529 case "`ipcs 2>&1`" in
14530 "SVID messages"*"not configured"*)
14531 echo "Your $osname does not have the msg*(2) configured." >&4
14532 h_msg=false
14533 val="$undef"
14534 set msgctl d_msgctl
14535 eval $setvar
14536 set msgget d_msgget
14537 eval $setvar
14538 set msgsnd d_msgsnd
14539 eval $setvar
14540 set msgrcv d_msgrcv
14541 eval $setvar
14542 ;;
14543 esac
14544 ;;
14545esac
14546: we could also check for sys/ipc.h ...
14547if $h_msg && $test `./findhdr sys/msg.h`; then
14548 echo "You have the full msg*(2) library." >&4
14549 val="$define"
14550else
14551 echo "You don't have the full msg*(2) library." >&4
14552 val="$undef"
14553fi
14554set d_msg
14555eval $setvar
14556
4e0554ec
JH
14557
14558echo " "
14559echo "Checking to see if your system supports struct msghdr..." >&4
14560set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14561eval $hasstruct
14562case "$d_msghdr_s" in
14563"$define") echo "Yes, it does." ;;
14564*) echo "No, it doesn't." ;;
14565esac
14566
14567
b4eb6b3d
JH
14568: see if msync exists
14569set msync d_msync
14570eval $inlibc
14571
14572: see if munmap exists
14573set munmap d_munmap
14574eval $inlibc
14575
14576: see if nice exists
14577set nice d_nice
14578eval $inlibc
14579
2765b840
JH
14580: see if this is a langinfo.h system
14581set langinfo.h i_langinfo
14582eval $inhdr
14583
14584: see if nl_langinfo exists
14585set nl_langinfo d_nl_langinfo
14586eval $inlibc
14587
b4eb6b3d
JH
14588: check for length of character
14589echo " "
14590case "$charsize" in
14591'')
14592 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14593 $cat >try.c <<EOCP
b4eb6b3d 14594#include <stdio.h>
d1daaddf
JH
14595#$i_stdlib I_STDLIB
14596#ifdef I_STDLIB
14597#include <stdlib.h>
14598#endif
b4eb6b3d
JH
14599int main()
14600{
14601 printf("%d\n", (int)sizeof(char));
14602 exit(0);
14603}
14604EOCP
14605 set try
14606 if eval $compile_ok; then
5440bc8e 14607 dflt=`$run ./try`
b4eb6b3d
JH
14608 else
14609 dflt='1'
14610 echo "(I can't seem to compile the test program. Guessing...)"
14611 fi
14612 ;;
14613*)
14614 dflt="$charsize"
14615 ;;
14616esac
14617rp="What is the size of a character (in bytes)?"
14618. ./myread
14619charsize="$ans"
14620$rm -f try.c try
14621
1d1be0dc
NC
14622: check for volatile keyword
14623echo " "
14624echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14625$cat >try.c <<'EOCP'
76f47787 14626int main()
1d1be0dc
NC
14627{
14628 typedef struct _goo_struct goo_struct;
14629 goo_struct * volatile goo = ((goo_struct *)0);
14630 struct _goo_struct {
14631 long long_int;
14632 int reg_int;
14633 char char_var;
14634 };
14635 typedef unsigned short foo_t;
14636 char *volatile foo;
14637 volatile int bar;
14638 volatile foo_t blech;
14639 foo = foo;
14640}
14641EOCP
14642if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14643 val="$define"
14644 echo "Yup, it does."
14645else
14646 val="$undef"
14647 echo "Nope, it doesn't."
14648fi
14649set d_volatile
14650eval $setvar
14651$rm -f try.*
14652
b4eb6b3d
JH
14653
14654echo " "
14655$echo "Choosing the C types to be used for Perl's internal types..." >&4
14656
14657case "$use64bitint:$d_quad:$quadtype" in
14658define:define:?*)
14659 ivtype="$quadtype"
14660 uvtype="$uquadtype"
14661 ivsize=8
14662 uvsize=8
14663 ;;
14664*) ivtype="long"
14665 uvtype="unsigned long"
14666 ivsize=$longsize
14667 uvsize=$longsize
14668 ;;
14669esac
14670
14671case "$uselongdouble:$d_longdbl" in
14672define:define)
14673 nvtype="long double"
14674 nvsize=$longdblsize
14675 ;;
14676*) nvtype=double
14677 nvsize=$doublesize
14678 ;;
14679esac
14680
14681$echo "(IV will be "$ivtype", $ivsize bytes)"
14682$echo "(UV will be "$uvtype", $uvsize bytes)"
14683$echo "(NV will be "$nvtype", $nvsize bytes)"
14684
14685$cat >try.c <<EOCP
14686#$i_inttypes I_INTTYPES
14687#ifdef I_INTTYPES
14688#include <inttypes.h>
14689#endif
14690#include <stdio.h>
14691int main() {
14692#ifdef INT8
14693 int8_t i = INT8_MAX;
14694 uint8_t u = UINT8_MAX;
14695 printf("int8_t\n");
14696#endif
14697#ifdef INT16
14698 int16_t i = INT16_MAX;
14699 uint16_t i = UINT16_MAX;
14700 printf("int16_t\n");
14701#endif
14702#ifdef INT32
14703 int32_t i = INT32_MAX;
14704 uint32_t u = UINT32_MAX;
14705 printf("int32_t\n");
14706#endif
14707}
14708EOCP
14709
14710case "$i8type" in
14711'') case "$charsize" in
14712 1) i8type=char
14713 u8type="unsigned char"
14714 i8size=$charsize
14715 u8size=$charsize
14716 ;;
14717 esac
14718 ;;
14719esac
14720case "$i8type" in
14721'') set try -DINT8
14722 if eval $compile; then
5440bc8e 14723 case "`$run ./try`" in
b4eb6b3d
JH
14724 int8_t) i8type=int8_t
14725 u8type=uint8_t
14726 i8size=1
14727 u8size=1
14728 ;;
14729 esac
14730 fi
14731 ;;
14732esac
14733case "$i8type" in
14734'') if $test $charsize -ge 1; then
14735 i8type=char
14736 u8type="unsigned char"
14737 i8size=$charsize
14738 u8size=$charsize
14739 fi
14740 ;;
14741esac
14742
14743case "$i16type" in
14744'') case "$shortsize" in
14745 2) i16type=short
14746 u16type="unsigned short"
14747 i16size=$shortsize
14748 u16size=$shortsize
14749 ;;
14750 esac
14751 ;;
14752esac
14753case "$i16type" in
14754'') set try -DINT16
14755 if eval $compile; then
5440bc8e 14756 case "`$run ./try`" in
b4eb6b3d
JH
14757 int16_t)
14758 i16type=int16_t
14759 u16type=uint16_t
14760 i16size=2
14761 u16size=2
14762 ;;
14763 esac
14764 fi
14765 ;;
14766esac
14767case "$i16type" in
14768'') if $test $shortsize -ge 2; then
14769 i16type=short
14770 u16type="unsigned short"
14771 i16size=$shortsize
14772 u16size=$shortsize
14773 fi
14774 ;;
14775esac
14776
14777case "$i32type" in
14778'') case "$longsize" in
14779 4) i32type=long
14780 u32type="unsigned long"
14781 i32size=$longsize
14782 u32size=$longsize
14783 ;;
14784 *) case "$intsize" in
14785 4) i32type=int
14786 u32type="unsigned int"
14787 i32size=$intsize
14788 u32size=$intsize
14789 ;;
14790 esac
14791 ;;
14792 esac
14793 ;;
14794esac
14795case "$i32type" in
14796'') set try -DINT32
14797 if eval $compile; then
5440bc8e 14798 case "`$run ./try`" in
b4eb6b3d
JH
14799 int32_t)
14800 i32type=int32_t
14801 u32type=uint32_t
14802 i32size=4
14803 u32size=4
14804 ;;
14805 esac
14806 fi
14807 ;;
14808esac
14809case "$i32type" in
14810'') if $test $intsize -ge 4; then
14811 i32type=int
14812 u32type="unsigned int"
14813 i32size=$intsize
14814 u32size=$intsize
14815 fi
14816 ;;
14817esac
14818
14819case "$i64type" in
14820'') case "$d_quad:$quadtype" in
14821 define:?*)
14822 i64type="$quadtype"
14823 u64type="$uquadtype"
14824 i64size=8
14825 u64size=8
14826 ;;
14827 esac
14828 ;;
14829esac
14830
1d1be0dc
NC
14831$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14832: volatile so that the compiler has to store it out to memory.
14833if test X"$d_volatile" = X"$define"; then
14834 volatile=volatile
14835fi
b4eb6b3d
JH
14836$cat <<EOP >try.c
14837#include <stdio.h>
55954f19
JH
14838#$i_stdlib I_STDLIB
14839#ifdef I_STDLIB
14840#include <stdlib.h>
14841#endif
1d1be0dc
NC
14842#include <sys/types.h>
14843#include <signal.h>
14844#ifdef SIGFPE
14845$volatile int bletched = 0;
14846$signal_t blech(s) int s; { bletched = 1; }
14847#endif
b4eb6b3d
JH
14848int main() {
14849 $uvtype u = 0;
1d1be0dc 14850 $nvtype d;
b4eb6b3d
JH
14851 int n = 8 * $uvsize;
14852 int i;
1d1be0dc
NC
14853#ifdef SIGFPE
14854 signal(SIGFPE, blech);
14855#endif
14856
b4eb6b3d
JH
14857 for (i = 0; i < n; i++) {
14858 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14859 d = ($nvtype)u;
14860 if (($uvtype)d != u)
b4eb6b3d 14861 break;
1d1be0dc
NC
14862 if (d <= 0)
14863 break;
14864 d = ($nvtype)(u - 1);
14865 if (($uvtype)d != (u - 1))
14866 break;
14867#ifdef SIGFPE
14868 if (bletched) {
14869 break;
14870#endif
14871 }
b4eb6b3d 14872 }
efd1522b 14873 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14874 exit(0);
14875}
14876EOP
1d1be0dc
NC
14877set try
14878
14879d_nv_preserves_uv="$undef"
14880if eval $compile; then
53133ed1 14881 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14882fi
53133ed1 14883case "$nv_preserves_uv_bits" in
1d1be0dc 14884\-[1-9]*)
53133ed1
NC
14885 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14886 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14887 d_nv_preserves_uv="$define"
b4eb6b3d 14888 ;;
53133ed1 14889[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14890 d_nv_preserves_uv="$undef" ;;
14891*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14892 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14893esac
14894
1d1be0dc
NC
14895$rm -f try.* try
14896
f607920a
CB
14897$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14898: volatile so that the compiler has to store it out to memory.
14899if test X"$d_volatile" = X"$define"; then
14900 volatile=volatile
14901fi
14902$cat <<EOP >try.c
14903#include <stdio.h>
14904#$i_stdlib I_STDLIB
14905#ifdef I_STDLIB
14906#include <stdlib.h>
14907#endif
14908#$i_string I_STRING
14909#ifdef I_STRING
14910# include <string.h>
14911#else
14912# include <strings.h>
14913#endif
14914#include <sys/types.h>
14915#include <signal.h>
14916#ifdef SIGFPE
14917$volatile int bletched = 0;
14918$signal_t blech(s) int s; { bletched = 1; }
14919#endif
14920
14921int checkit($nvtype d, char *where) {
14922 unsigned char *p = (char *)&d;
14923 unsigned char *end = p + sizeof(d);
14924 int fail = 0;
14925
14926 while (p < end)
14927 fail += *p++;
14928
14929 if (!fail)
17f6277d 14930 return 0;
f607920a
CB
14931
14932 p = (char *)&d;
14933 printf("No - %s: 0x", where);
14934 while (p < end)
14935 printf ("%02X", *p++);
14936 printf("\n");
14937 return 1;
14938}
14939
14940int main(int argc, char **argv) {
14941 $nvtype d = 0.0;
14942 int fail = 0;
14943 fail += checkit(d, "0.0");
14944
14945 /* The compiler shouldn't be assuming that bletched is 0 */
14946 d = bletched;
14947
14948 fail += checkit(d, "bleched");
14949
14950#ifdef SIGFPE
14951 signal(SIGFPE, blech);
14952#endif
14953
14954 /* Paranoia - the compiler should have no way of knowing that ANSI says
14955 that argv[argc] will always be NULL. Actually, if it did assume this it
14956 would be buggy, as this is C and main() can be called from elsewhere in
14957 the program. */
14958 d = argv[argc] ? 1 : 0;
14959
14960 if (d) {
14961 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14962 }
14963
14964 fail += checkit(d, "ternary");
14965
14966 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14967
14968 if (d != 0.0) {
14969 printf("No - memset doesn't give 0.0\n");
14970 /* This might just blow up: */
14971 printf("(gives %g)\n", d);
14972 return 1;
14973 }
14974
14975#ifdef SIGFPE
14976 if (bletched) {
14977 printf("No - something bleched\n");
14978 return 1;
14979 }
14980#endif
14981 if (fail) {
14982 printf("No - %d fail(s)\n", fail);
14983 return 1;
14984 }
14985 printf("Yes\n");
14986 return 0;
14987}
14988EOP
14989set try
14990
14991d_nv_zero_is_allbits_zero="$undef"
14992if eval $compile; then
14993 xxx="`$run ./try`"
14994 case "$?" in
14995 0)
14996 case "$xxx" in
14997 Yes) cat >&4 <<EOM
149980.0 is represented as all bits zero in memory
14999EOM
15000 d_nv_zero_is_allbits_zero="$define"
15001 ;;
15002 *) cat >&4 <<EOM
150030.0 is not represented as all bits zero in memory
15004EOM
15005 d_nv_zero_is_allbits_zero="$undef"
15006 ;;
15007 esac
15008 ;;
15009 *) cat >&4 <<EOM
150100.0 is not represented as all bits zero in memory
15011EOM
15012 d_nv_zero_is_allbits_zero="$undef"
15013 ;;
15014 esac
15015fi
15016
15017$rm -f try.* try
15018
b4eb6b3d
JH
15019
15020: check for off64_t
15021echo " "
15022echo "Checking to see if you have off64_t..." >&4
15023$cat >try.c <<EOCP
15024#include <sys/types.h>
15025#include <unistd.h>
15026int main() { off64_t x = 7; }
15027EOCP
15028set try
15029if eval $compile; then
15030 val="$define"
15031 echo "You have off64_t."
15032else
15033 val="$undef"
15034 echo "You do not have off64_t."
15035 case "$lseeksize" in
15036 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15037 esac
15038fi
15039$rm -f try.* try
15040set d_off64_t
15041eval $setvar
15042
b4eb6b3d
JH
15043: how to create joinable pthreads
15044if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15045 echo " "
15046 echo "Checking what constant to use for creating joinable pthreads..." >&4
15047 $cat >try.c <<'EOCP'
15048#include <pthread.h>
15049int main() {
15050 int detachstate = JOINABLE;
15051}
15052EOCP
15053 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15054 if eval $compile; then
15055 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15056 val="$undef" # Yes, undef.
15057 set d_old_pthread_create_joinable
15058 eval $setvar
15059 val=""
15060 set old_pthread_create_joinable
15061 eval $setvar
15062 else
15063 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15064 if eval $compile; then
15065 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15066 val="$define"
15067 set d_old_pthread_create_joinable
15068 eval $setvar
15069 val=PTHREAD_CREATE_UNDETACHED
15070 set old_pthread_create_joinable
15071 eval $setvar
15072 else
15073 set try -DJOINABLE=__UNDETACHED
15074 if eval $compile; then
15075 echo "You seem to use __UNDETACHED." >&4
15076 val="$define"
15077 set d_old_pthread_create_joinable
15078 eval $setvar
15079 val=__UNDETACHED
15080 set old_pthread_create_joinable
15081 eval $setvar
15082 else
15083 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15084 val="$define"
15085 set d_old_pthread_create_joinable
15086 eval $setvar
15087 val=0
15088 set old_pthread_create_joinable
15089 eval $setvar
15090 fi
15091 fi
15092 fi
15093 $rm -f try try.*
15094else
15095 d_old_pthread_create_joinable="$undef"
15096 old_pthread_create_joinable=""
15097fi
15098
15099: see if pause exists
15100set pause d_pause
15101eval $inlibc
15102
15103: see if pipe exists
15104set pipe d_pipe
15105eval $inlibc
15106
15107: see if poll exists
15108set poll d_poll
15109eval $inlibc
15110
c7aff470
NIS
15111: see if readlink exists
15112set readlink d_readlink
15113eval $inlibc
15114
15115echo " "
f24dbf84 15116procselfexe=''
c7aff470 15117val="$undef"
a33c94aa
JH
15118case "$d_readlink" in
15119"$define")
c7aff470
NIS
15120 if $issymlink /proc/self/exe ; then
15121 $ls -l /proc/self/exe > reflect
51660ed5 15122 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15123 echo "You have Linux-like /proc/self/exe."
92236451 15124 procselfexe='"/proc/self/exe"'
f24dbf84 15125 val="$define"
f24dbf84
JH
15126 fi
15127 fi
15128 if $issymlink /proc/curproc/file ; then
15129 $ls -l /proc/curproc/file > reflect
15130 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15131 echo "You have BSD-like /proc/curproc/file."
92236451 15132 procselfexe='"/proc/curproc/file"'
f24dbf84 15133 val="$define"
c7aff470 15134 fi
c7aff470 15135 fi
a33c94aa
JH
15136 ;;
15137esac
428dc699 15138$rm -f reflect
c7aff470
NIS
15139set d_procselfexe
15140eval $setvar
15141
263fee3f
JH
15142: see whether the pthread_atfork exists
15143$cat >try.c <<EOP
15144#include <pthread.h>
15145#include <stdio.h>
15146int main() {
15147#ifdef PTHREAD_ATFORK
15148 pthread_atfork(NULL,NULL,NULL);
15149#endif
15150}
15151EOP
15152
d6483fcc 15153: see if pthread_atfork exists
263fee3f
JH
15154set try -DPTHREAD_ATFORK
15155if eval $compile; then
15156 val="$define"
15157else
15158 val="$undef"
15159fi
15160case "$usethreads" in
15161$define)
15162 case "$val" in
15163 $define) echo 'pthread_atfork found.' >&4 ;;
15164 *) echo 'pthread_atfork NOT found.' >&4 ;;
15165 esac
15166esac
15167set d_pthread_atfork
15168eval $setvar
d6483fcc 15169
58d975c3
JH
15170: see if pthread_attr_setscope exists
15171set pthread_attr_setscope d_pthread_attr_setscope
15172eval $inlibc
15173
b4eb6b3d
JH
15174
15175: see whether the various POSIXish _yields exist
15176$cat >try.c <<EOP
15177#include <pthread.h>
15178#include <stdio.h>
15179int main() {
15180#ifdef SCHED_YIELD
15181 sched_yield();
15182#else
15183#ifdef PTHREAD_YIELD
15184 pthread_yield();
15185#else
15186#ifdef PTHREAD_YIELD_NULL
15187 pthread_yield(NULL);
15188#endif
15189#endif
15190#endif
15191}
15192EOP
15193: see if sched_yield exists
15194set try -DSCHED_YIELD
15195if eval $compile; then
15196 val="$define"
15197 sched_yield='sched_yield()'
15198else
15199 val="$undef"
15200fi
15201case "$usethreads" in
15202$define)
15203 case "$val" in
15204 $define) echo 'sched_yield() found.' >&4 ;;
15205 *) echo 'sched_yield() NOT found.' >&4 ;;
15206 esac
15207esac
10bc17b6
JH
15208set d_sched_yield
15209eval $setvar
b4eb6b3d 15210
10bc17b6
JH
15211: see if pthread_yield exists
15212set try -DPTHREAD_YIELD
15213if eval $compile; then
15214 val="$define"
15215 case "$sched_yield" in
15216 '') sched_yield='pthread_yield()' ;;
15217 esac
15218else
15219 set try -DPTHREAD_YIELD_NULL
15220 if eval $compile; then
15221 val="$define"
15222 case "$sched_yield" in
15223 '') sched_yield='pthread_yield(NULL)' ;;
15224 esac
15225 else
15226 val="$undef"
15227 fi
15228fi
15229case "$usethreads" in
15230$define)
15231 case "$val" in
15232 $define) echo 'pthread_yield() found.' >&4 ;;
15233 *) echo 'pthread_yield() NOT found.' >&4 ;;
15234 esac
15235 ;;
15236esac
15237set d_pthread_yield
15238eval $setvar
b4eb6b3d 15239
10bc17b6
JH
15240case "$sched_yield" in
15241'') sched_yield=undef ;;
15242esac
b4eb6b3d 15243
10bc17b6
JH
15244$rm -f try try.*
15245
15246: see if random_r exists
15247set random_r d_random_r
15248eval $inlibc
15249case "$d_random_r" in
15250"$define")
15251 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15252 case "$d_random_r_proto:$usethreads" in
15253 ":define") d_random_r_proto=define
a48ec845
JH
15254 set d_random_r_proto random_r $hdrs
15255 eval $hasproto ;;
15256 *) ;;
15257 esac
15258 case "$d_random_r_proto" in
15259 define)
10bc17b6
JH
15260 case "$random_r_proto" in
15261 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15262 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15263 esac
15264 case "$random_r_proto" in
15265 ''|0) try='int random_r(long*, struct random_data*);'
15266 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15267 esac
15268 case "$random_r_proto" in
15269 ''|0) try='int random_r(struct random_data*, int32_t*);'
15270 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15271 esac
15272 case "$random_r_proto" in
90e831dc 15273 ''|0) d_random_r=undef
10bc17b6 15274 random_r_proto=0
a48ec845 15275 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15276 * ) case "$random_r_proto" in
15277 REENTRANT_PROTO*) ;;
15278 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15279 esac
15280 echo "Prototype: $try" ;;
15281 esac
b4eb6b3d 15282 ;;
c18e646a
JH
15283 *) case "$usethreads" in
15284 define) echo "random_r has no prototype, not using it." >&4 ;;
15285 esac
90e831dc
SB
15286 d_random_r=undef
15287 random_r_proto=0
c18e646a 15288 ;;
a48ec845
JH
15289 esac
15290 ;;
10bc17b6 15291*) random_r_proto=0
b4eb6b3d
JH
15292 ;;
15293esac
15294
15295: see if readdir and friends exist
15296set readdir d_readdir
15297eval $inlibc
15298set seekdir d_seekdir
15299eval $inlibc
15300set telldir d_telldir
15301eval $inlibc
15302set rewinddir d_rewinddir
15303eval $inlibc
15304
10bc17b6
JH
15305: see if readdir64_r exists
15306set readdir64_r d_readdir64_r
15307eval $inlibc
15308case "$d_readdir64_r" in
15309"$define")
15310 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15311 case "$d_readdir64_r_proto:$usethreads" in
15312 ":define") d_readdir64_r_proto=define
a48ec845
JH
15313 set d_readdir64_r_proto readdir64_r $hdrs
15314 eval $hasproto ;;
15315 *) ;;
15316 esac
15317 case "$d_readdir64_r_proto" in
15318 define)
10bc17b6
JH
15319 case "$readdir64_r_proto" in
15320 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15321 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15322 esac
15323 case "$readdir64_r_proto" in
15324 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15325 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15326 esac
15327 case "$readdir64_r_proto" in
90e831dc 15328 ''|0) d_readdir64_r=undef
10bc17b6 15329 readdir64_r_proto=0
a48ec845 15330 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15331 * ) case "$readdir64_r_proto" in
15332 REENTRANT_PROTO*) ;;
15333 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15334 esac
15335 echo "Prototype: $try" ;;
15336 esac
15337 ;;
c18e646a
JH
15338 *) case "$usethreads" in
15339 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15340 esac
90e831dc
SB
15341 d_readdir64_r=undef
15342 readdir64_r_proto=0
c18e646a 15343 ;;
a48ec845
JH
15344 esac
15345 ;;
10bc17b6
JH
15346*) readdir64_r_proto=0
15347 ;;
15348esac
15349
15350: see if readdir_r exists
15351set readdir_r d_readdir_r
15352eval $inlibc
15353case "$d_readdir_r" in
15354"$define")
15355 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15356 case "$d_readdir_r_proto:$usethreads" in
15357 ":define") d_readdir_r_proto=define
a48ec845
JH
15358 set d_readdir_r_proto readdir_r $hdrs
15359 eval $hasproto ;;
15360 *) ;;
15361 esac
15362 case "$d_readdir_r_proto" in
15363 define)
10bc17b6
JH
15364 case "$readdir_r_proto" in
15365 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15366 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15367 esac
15368 case "$readdir_r_proto" in
15369 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15370 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15371 esac
15372 case "$readdir_r_proto" in
90e831dc 15373 ''|0) d_readdir_r=undef
10bc17b6 15374 readdir_r_proto=0
a48ec845 15375 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15376 * ) case "$readdir_r_proto" in
15377 REENTRANT_PROTO*) ;;
15378 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15379 esac
15380 echo "Prototype: $try" ;;
15381 esac
15382 ;;
c18e646a
JH
15383 *) case "$usethreads" in
15384 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15385 esac
90e831dc
SB
15386 d_readdir_r=undef
15387 readdir_r_proto=0
c18e646a 15388 ;;
a48ec845
JH
15389 esac
15390 ;;
10bc17b6
JH
15391*) readdir_r_proto=0
15392 ;;
15393esac
15394
4e0554ec
JH
15395: see if readv exists
15396set readv d_readv
15397eval $inlibc
15398
15399: see if recvmsg exists
15400set recvmsg d_recvmsg
15401eval $inlibc
15402
b4eb6b3d
JH
15403: see if rename exists
15404set rename d_rename
15405eval $inlibc
15406
15407: see if rmdir exists
15408set rmdir d_rmdir
15409eval $inlibc
15410
15411: see if memory.h is available.
15412val=''
15413set memory.h val
15414eval $inhdr
15415
15416: See if it conflicts with string.h
15417case "$val" in
15418$define)
15419 case "$strings" in
15420 '') ;;
15421 *)
15422 $cppstdin $cppflags $cppminus < $strings > mem.h
15423 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15424 echo " "
15425 echo "We won't be including <memory.h>."
15426 val="$undef"
15427 fi
15428 $rm -f mem.h
15429 ;;
15430 esac
15431esac
15432set i_memory
15433eval $setvar
15434
15435: can bcopy handle overlapping blocks?
b6cc3bc4 15436echo " "
b4eb6b3d 15437val="$undef"
b6cc3bc4
AD
15438case "$d_memmove" in
15439"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15440*) case "$d_bcopy" in
15441 "$define")
15442 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15443 $cat >try.c <<EOCP
b4eb6b3d
JH
15444#$i_memory I_MEMORY
15445#$i_stdlib I_STDLIB
15446#$i_string I_STRING
15447#$i_unistd I_UNISTD
15448EOCP
15449 $cat >>try.c <<'EOCP'
15450#include <stdio.h>
15451#ifdef I_MEMORY
15452# include <memory.h>
15453#endif
15454#ifdef I_STDLIB
15455# include <stdlib.h>
15456#endif
15457#ifdef I_STRING
15458# include <string.h>
15459#else
15460# include <strings.h>
15461#endif
15462#ifdef I_UNISTD
15463# include <unistd.h> /* Needed for NetBSD */
15464#endif
15465int main()
15466{
15467char buf[128], abc[128];
15468char *b;
15469int len;
15470int off;
15471int align;
15472
b6cc3bc4
AD
15473/* Copy "abcde..." string to char abc[] so that gcc doesn't
15474 try to store the string in read-only memory. */
b4eb6b3d
JH
15475bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15476
15477for (align = 7; align >= 0; align--) {
15478 for (len = 36; len; len--) {
15479 b = buf+align;
15480 bcopy(abc, b, len);
15481 for (off = 1; off <= len; off++) {
15482 bcopy(b, b+off, len);
15483 bcopy(b+off, b, len);
15484 if (bcmp(b, abc, len))
15485 exit(1);
15486 }
15487 }
15488}
15489exit(0);
15490}
15491EOCP
b6cc3bc4
AD
15492 set try
15493 if eval $compile_ok; then
15494 if ./try 2>/dev/null; then
15495 echo "Yes, it can."
15496 val="$define"
15497 else
15498 echo "It can't, sorry."
15499 fi
b4eb6b3d 15500 else
b6cc3bc4 15501 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15502 fi
b6cc3bc4
AD
15503 ;;
15504 esac
15505 $rm -f try.* try core
b4eb6b3d
JH
15506 ;;
15507esac
b4eb6b3d
JH
15508set d_safebcpy
15509eval $setvar
15510
15511: can memcpy handle overlapping blocks?
b6cc3bc4 15512echo " "
b4eb6b3d 15513val="$undef"
b6cc3bc4
AD
15514case "$d_memmove" in
15515"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15516*) case "$d_memcpy" in
15517 "$define")
15518 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15519 $cat >try.c <<EOCP
b4eb6b3d
JH
15520#$i_memory I_MEMORY
15521#$i_stdlib I_STDLIB
15522#$i_string I_STRING
15523#$i_unistd I_UNISTD
15524EOCP
15525 $cat >>try.c <<'EOCP'
15526#include <stdio.h>
15527#ifdef I_MEMORY
15528# include <memory.h>
15529#endif
15530#ifdef I_STDLIB
15531# include <stdlib.h>
15532#endif
15533#ifdef I_STRING
15534# include <string.h>
15535#else
15536# include <strings.h>
15537#endif
15538#ifdef I_UNISTD
15539# include <unistd.h> /* Needed for NetBSD */
15540#endif
15541int main()
15542{
15543char buf[128], abc[128];
15544char *b;
15545int len;
15546int off;
15547int align;
15548
15549/* Copy "abcde..." string to char abc[] so that gcc doesn't
15550 try to store the string in read-only memory. */
15551memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15552
15553for (align = 7; align >= 0; align--) {
15554 for (len = 36; len; len--) {
15555 b = buf+align;
15556 memcpy(b, abc, len);
15557 for (off = 1; off <= len; off++) {
15558 memcpy(b+off, b, len);
15559 memcpy(b, b+off, len);
15560 if (memcmp(b, abc, len))
15561 exit(1);
15562 }
15563 }
15564}
15565exit(0);
15566}
15567EOCP
b6cc3bc4
AD
15568 set try
15569 if eval $compile_ok; then
15570 if ./try 2>/dev/null; then
15571 echo "Yes, it can."
15572 val="$define"
15573 else
15574 echo "It can't, sorry."
15575 fi
b4eb6b3d 15576 else
b6cc3bc4 15577 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15578 fi
b6cc3bc4
AD
15579 ;;
15580 esac
15581 $rm -f try.* try core
b4eb6b3d
JH
15582 ;;
15583esac
b4eb6b3d
JH
15584set d_safemcpy
15585eval $setvar
15586
15587: can memcmp be trusted to compare relative magnitude?
15588val="$undef"
15589case "$d_memcmp" in
15590"$define")
15591 echo " "
15592 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15593 $cat >try.c <<EOCP
15594#$i_memory I_MEMORY
15595#$i_stdlib I_STDLIB
15596#$i_string I_STRING
15597#$i_unistd I_UNISTD
15598EOCP
15599 $cat >>try.c <<'EOCP'
15600#include <stdio.h>
15601#ifdef I_MEMORY
15602# include <memory.h>
15603#endif
15604#ifdef I_STDLIB
36adc09b 15605# include <stdlib.h>
b4eb6b3d
JH
15606#endif
15607#ifdef I_STRING
15608# include <string.h>
15609#else
15610# include <strings.h>
15611#endif
15612#ifdef I_UNISTD
15613# include <unistd.h> /* Needed for NetBSD */
15614#endif
15615int main()
15616{
15617char a = -1;
15618char b = 0;
15619if ((a < b) && memcmp(&a, &b, 1) < 0)
15620 exit(1);
15621exit(0);
15622}
15623EOCP
15624 set try
15625 if eval $compile_ok; then
5440bc8e 15626 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15627 echo "Yes, it can."
15628 val="$define"
15629 else
15630 echo "No, it can't (it uses signed chars)."
15631 fi
15632 else
15633 echo "(I can't compile the test program, so we'll assume not...)"
15634 fi
15635 ;;
15636esac
15637$rm -f try.* try core
15638set d_sanemcmp
15639eval $setvar
15640
ef9f17be
JH
15641: see if prototype for sbrk is available
15642echo " "
15643set d_sbrkproto sbrk $i_unistd unistd.h
15644eval $hasproto
15645
b4eb6b3d
JH
15646: see if select exists
15647set select d_select
15648eval $inlibc
15649
15650: see if semctl exists
15651set semctl d_semctl
15652eval $inlibc
15653
15654: see if semget exists
15655set semget d_semget
15656eval $inlibc
15657
15658: see if semop exists
15659set semop d_semop
15660eval $inlibc
15661
15662: see how much of the 'sem*(2)' library is present.
15663h_sem=true
15664echo " "
15665case "$d_semctl$d_semget$d_semop" in
15666*"$undef"*) h_sem=false;;
15667esac
15668case "$osname" in
15669freebsd)
15670 case "`ipcs 2>&1`" in
15671 "SVID messages"*"not configured"*)
15672 echo "Your $osname does not have the sem*(2) configured." >&4
15673 h_sem=false
15674 val="$undef"
15675 set semctl d_semctl
15676 eval $setvar
15677 set semget d_semget
15678 eval $setvar
15679 set semop d_semop
15680 eval $setvar
15681 ;;
15682 esac
15683 ;;
15684esac
15685: we could also check for sys/ipc.h ...
15686if $h_sem && $test `./findhdr sys/sem.h`; then
15687 echo "You have the full sem*(2) library." >&4
15688 val="$define"
15689else
15690 echo "You don't have the full sem*(2) library." >&4
15691 val="$undef"
15692fi
15693set d_sem
15694eval $setvar
15695
15696: see whether sys/sem.h defines union semun
15697echo " "
15698$cat > try.c <<'END'
15699#include <sys/types.h>
15700#include <sys/ipc.h>
15701#include <sys/sem.h>
15702int main () { union semun semun; semun.buf = 0; }
15703END
15704set try
15705if eval $compile; then
15706 echo "You have union semun in <sys/sem.h>." >&4
15707 val="$define"
15708else
15709 echo "You do not have union semun in <sys/sem.h>." >&4
15710 val="$undef"
15711fi
2fad75a1 15712$rm -f try try.c
b4eb6b3d
JH
15713set d_union_semun
15714eval $setvar
15715
15716: see how to do semctl IPC_STAT
15717case "$d_sem" in
15718$define)
b4eb6b3d
JH
15719 echo " "
15720 $cat > try.h <<END
15721#ifndef S_IRUSR
15722# ifdef S_IREAD
15723# define S_IRUSR S_IREAD
15724# define S_IWUSR S_IWRITE
15725# define S_IXUSR S_IEXEC
15726# else
15727# define S_IRUSR 0400
15728# define S_IWUSR 0200
15729# define S_IXUSR 0100
15730# endif
15731# define S_IRGRP (S_IRUSR>>3)
15732# define S_IWGRP (S_IWUSR>>3)
15733# define S_IXGRP (S_IXUSR>>3)
15734# define S_IROTH (S_IRUSR>>6)
15735# define S_IWOTH (S_IWUSR>>6)
15736# define S_IXOTH (S_IXUSR>>6)
15737#endif
15738#ifndef S_IRWXU
15739# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15740# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15741# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15742#endif
15743END
2fad75a1
JH
15744 : see whether semctl IPC_STAT can use union semun
15745 val="$undef"
15746 case "$d_semctl_semun" in
15747 '')
15748 $cat > try.c <<END
b4eb6b3d
JH
15749#include <sys/types.h>
15750#include <sys/ipc.h>
15751#include <sys/sem.h>
15752#include <sys/stat.h>
15753#include <stdio.h>
15754#include <errno.h>
15755#include "try.h"
15756#ifndef errno
15757extern int errno;
15758#endif
15759#$d_union_semun HAS_UNION_SEMUN
15760int main() {
15761 union semun
15762#ifndef HAS_UNION_SEMUN
15763 {
15764 int val;
15765 struct semid_ds *buf;
15766 unsigned short *array;
15767 }
15768#endif
15769 arg;
15770 int sem, st;
15771
15772#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15773 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15774 if (sem > -1) {
15775 struct semid_ds argbuf;
15776 arg.buf = &argbuf;
15777# ifdef IPC_STAT
15778 st = semctl(sem, 0, IPC_STAT, arg);
15779 if (st == 0)
15780 printf("semun\n");
15781 else
15782# endif /* IPC_STAT */
15783 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15784# ifdef IPC_RMID
15785 if (semctl(sem, 0, IPC_RMID, arg) != 0)
15786# endif /* IPC_RMID */
15787 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15788 } else
15789#endif /* IPC_PRIVATE && ... */
15790 printf("semget failed: errno = %d\n", errno);
15791 return 0;
15792}
15793END
2fad75a1
JH
15794 set try
15795 if eval $compile; then
15796 xxx=`$run ./try`
15797 case "$xxx" in
15798 semun) val="$define" ;;
15799 esac
15800 fi
15801 $rm -f try try.c
15802 ;;
15803 esac
b4eb6b3d
JH
15804 set d_semctl_semun
15805 eval $setvar
15806 case "$d_semctl_semun" in
15807 $define)
15808 echo "You can use union semun for semctl IPC_STAT." >&4
15809 also='also'
15810 ;;
15811 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15812 also=''
15813 ;;
15814 esac
15815
15816 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
15817 val="$undef"
15818 case "$d_semctl_semid_ds" in
15819 '')
15820 $cat > try.c <<'END'
b4eb6b3d
JH
15821#include <sys/types.h>
15822#include <sys/ipc.h>
15823#include <sys/sem.h>
15824#include <sys/stat.h>
15825#include "try.h"
15826#include <stdio.h>
15827#include <errno.h>
15828#ifndef errno
15829extern int errno;
15830#endif
15831int main() {
15832 struct semid_ds arg;
15833 int sem, st;
15834
15835#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15836 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15837 if (sem > -1) {
15838# ifdef IPC_STAT
15839 st = semctl(sem, 0, IPC_STAT, &arg);
15840 if (st == 0)
15841 printf("semid_ds\n");
15842 else
15843# endif /* IPC_STAT */
15844 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15845# ifdef IPC_RMID
15846 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15847# endif /* IPC_RMID */
15848 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15849 } else
15850#endif /* IPC_PRIVATE && ... */
15851 printf("semget failed: errno = %d\n", errno);
15852
15853 return 0;
15854}
15855END
2fad75a1
JH
15856 set try
15857 if eval $compile; then
15858 xxx=`$run ./try`
15859 case "$xxx" in
15860 semid_ds) val="$define" ;;
15861 esac
15862 fi
15863 $rm -f try try.c
15864 ;;
15865 esac
b4eb6b3d
JH
15866 set d_semctl_semid_ds
15867 eval $setvar
15868 case "$d_semctl_semid_ds" in
15869 $define)
15870 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15871 ;;
15872 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15873 ;;
15874 esac
15875 $rm -f try.h
15876 ;;
15877*) val="$undef"
15878
15879 # We do not have the full sem*(2) library, so assume we can not
15880 # use either.
15881
15882 set d_semctl_semun
15883 eval $setvar
15884
15885 set d_semctl_semid_ds
15886 eval $setvar
15887 ;;
15888esac
15889
4e0554ec
JH
15890: see if sendmsg exists
15891set sendmsg d_sendmsg
15892eval $inlibc
15893
b4eb6b3d
JH
15894: see if setegid exists
15895set setegid d_setegid
15896eval $inlibc
15897
15898: see if seteuid exists
15899set seteuid d_seteuid
15900eval $inlibc
15901
15902: see if setgrent exists
15903set setgrent d_setgrent
15904eval $inlibc
15905
10bc17b6
JH
15906: see if setgrent_r exists
15907set setgrent_r d_setgrent_r
15908eval $inlibc
15909case "$d_setgrent_r" in
15910"$define")
15911 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15912 case "$d_setgrent_r_proto:$usethreads" in
15913 ":define") d_setgrent_r_proto=define
a48ec845
JH
15914 set d_setgrent_r_proto setgrent_r $hdrs
15915 eval $hasproto ;;
15916 *) ;;
15917 esac
15918 case "$d_setgrent_r_proto" in
15919 define)
10bc17b6
JH
15920 case "$setgrent_r_proto" in
15921 ''|0) try='int setgrent_r(FILE**);'
15922 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15923 esac
15924 case "$setgrent_r_proto" in
15925 ''|0) try='void setgrent_r(FILE**);'
15926 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15927 esac
15928 case "$setgrent_r_proto" in
90e831dc 15929 ''|0) d_setgrent_r=undef
10bc17b6 15930 setgrent_r_proto=0
a48ec845 15931 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15932 * ) case "$setgrent_r_proto" in
15933 REENTRANT_PROTO*) ;;
15934 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15935 esac
15936 echo "Prototype: $try" ;;
15937 esac
15938 ;;
c18e646a
JH
15939 *) case "$usethreads" in
15940 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15941 esac
90e831dc
SB
15942 d_setgrent_r=undef
15943 setgrent_r_proto=0
c18e646a 15944 ;;
a48ec845
JH
15945 esac
15946 ;;
10bc17b6
JH
15947*) setgrent_r_proto=0
15948 ;;
15949esac
15950
b4eb6b3d
JH
15951: see if sethostent exists
15952set sethostent d_sethent
15953eval $inlibc
15954
10bc17b6
JH
15955: see if sethostent_r exists
15956set sethostent_r d_sethostent_r
15957eval $inlibc
15958case "$d_sethostent_r" in
15959"$define")
15960 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15961 case "$d_sethostent_r_proto:$usethreads" in
15962 ":define") d_sethostent_r_proto=define
a48ec845
JH
15963 set d_sethostent_r_proto sethostent_r $hdrs
15964 eval $hasproto ;;
15965 *) ;;
15966 esac
15967 case "$d_sethostent_r_proto" in
15968 define)
10bc17b6
JH
15969 case "$sethostent_r_proto" in
15970 ''|0) try='int sethostent_r(int, struct hostent_data*);'
15971 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15972 esac
15973 case "$sethostent_r_proto" in
15974 ''|0) try='void sethostent_r(int, struct hostent_data*);'
15975 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15976 esac
15977 case "$sethostent_r_proto" in
90e831dc 15978 ''|0) d_sethostent_r=undef
10bc17b6 15979 sethostent_r_proto=0
a48ec845 15980 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15981 * ) case "$sethostent_r_proto" in
15982 REENTRANT_PROTO*) ;;
15983 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15984 esac
15985 echo "Prototype: $try" ;;
15986 esac
15987 ;;
c18e646a
JH
15988 *) case "$usethreads" in
15989 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15990 esac
90e831dc
SB
15991 d_sethostent_r=undef
15992 sethostent_r_proto=0
c18e646a 15993 ;;
a48ec845
JH
15994 esac
15995 ;;
10bc17b6
JH
15996*) sethostent_r_proto=0
15997 ;;
15998esac
15999
4e0554ec
JH
16000: see if setitimer exists
16001set setitimer d_setitimer
16002eval $inlibc
16003
b4eb6b3d
JH
16004: see if setlinebuf exists
16005set setlinebuf d_setlinebuf
16006eval $inlibc
16007
16008: see if setlocale exists
16009set setlocale d_setlocale
16010eval $inlibc
16011
10bc17b6
JH
16012: see if locale.h is available
16013set locale.h i_locale
16014eval $inhdr
16015
16016: see if setlocale_r exists
16017set setlocale_r d_setlocale_r
16018eval $inlibc
16019case "$d_setlocale_r" in
16020"$define")
16021 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16022 case "$d_setlocale_r_proto:$usethreads" in
16023 ":define") d_setlocale_r_proto=define
a48ec845
JH
16024 set d_setlocale_r_proto setlocale_r $hdrs
16025 eval $hasproto ;;
16026 *) ;;
16027 esac
16028 case "$d_setlocale_r_proto" in
16029 define)
10bc17b6
JH
16030 case "$setlocale_r_proto" in
16031 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16032 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16033 esac
16034 case "$setlocale_r_proto" in
90e831dc 16035 ''|0) d_setlocale_r=undef
10bc17b6 16036 setlocale_r_proto=0
a48ec845 16037 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16038 * ) case "$setlocale_r_proto" in
16039 REENTRANT_PROTO*) ;;
16040 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16041 esac
16042 echo "Prototype: $try" ;;
16043 esac
16044 ;;
c18e646a
JH
16045 *) case "$usethreads" in
16046 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16047 esac
90e831dc
SB
16048 d_setlocale_r=undef
16049 setlocale_r_proto=0
c18e646a 16050 ;;
a48ec845
JH
16051 esac
16052 ;;
10bc17b6
JH
16053*) setlocale_r_proto=0
16054 ;;
16055esac
16056
b4eb6b3d
JH
16057: see if setnetent exists
16058set setnetent d_setnent
16059eval $inlibc
16060
10bc17b6
JH
16061: see if setnetent_r exists
16062set setnetent_r d_setnetent_r
16063eval $inlibc
16064case "$d_setnetent_r" in
16065"$define")
16066 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16067 case "$d_setnetent_r_proto:$usethreads" in
16068 ":define") d_setnetent_r_proto=define
a48ec845
JH
16069 set d_setnetent_r_proto setnetent_r $hdrs
16070 eval $hasproto ;;
16071 *) ;;
16072 esac
16073 case "$d_setnetent_r_proto" in
16074 define)
10bc17b6
JH
16075 case "$setnetent_r_proto" in
16076 ''|0) try='int setnetent_r(int, struct netent_data*);'
16077 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16078 esac
16079 case "$setnetent_r_proto" in
16080 ''|0) try='void setnetent_r(int, struct netent_data*);'
16081 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16082 esac
16083 case "$setnetent_r_proto" in
90e831dc 16084 ''|0) d_setnetent_r=undef
10bc17b6 16085 setnetent_r_proto=0
a48ec845 16086 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16087 * ) case "$setnetent_r_proto" in
16088 REENTRANT_PROTO*) ;;
16089 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16090 esac
16091 echo "Prototype: $try" ;;
16092 esac
16093 ;;
c18e646a
JH
16094 *) case "$usethreads" in
16095 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16096 esac
90e831dc
SB
16097 d_setnetent_r=undef
16098 setnetent_r_proto=0
c18e646a 16099 ;;
a48ec845
JH
16100 esac
16101 ;;
10bc17b6
JH
16102*) setnetent_r_proto=0
16103 ;;
16104esac
16105
b4eb6b3d
JH
16106: see if setprotoent exists
16107set setprotoent d_setpent
16108eval $inlibc
16109
16110: see if setpgid exists
16111set setpgid d_setpgid
16112eval $inlibc
16113
16114: see if setpgrp2 exists
16115set setpgrp2 d_setpgrp2
16116eval $inlibc
16117
16118: see if setpriority exists
16119set setpriority d_setprior
16120eval $inlibc
16121
16122: see if setproctitle exists
16123set setproctitle d_setproctitle
16124eval $inlibc
16125
10bc17b6
JH
16126: see if setprotoent_r exists
16127set setprotoent_r d_setprotoent_r
16128eval $inlibc
16129case "$d_setprotoent_r" in
16130"$define")
16131 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16132 case "$d_setprotoent_r_proto:$usethreads" in
16133 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16134 set d_setprotoent_r_proto setprotoent_r $hdrs
16135 eval $hasproto ;;
16136 *) ;;
16137 esac
16138 case "$d_setprotoent_r_proto" in
16139 define)
10bc17b6
JH
16140 case "$setprotoent_r_proto" in
16141 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16142 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16143 esac
16144 case "$setprotoent_r_proto" in
16145 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16146 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16147 esac
16148 case "$setprotoent_r_proto" in
90e831dc 16149 ''|0) d_setprotoent_r=undef
10bc17b6 16150 setprotoent_r_proto=0
a48ec845 16151 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16152 * ) case "$setprotoent_r_proto" in
16153 REENTRANT_PROTO*) ;;
16154 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16155 esac
16156 echo "Prototype: $try" ;;
16157 esac
16158 ;;
c18e646a
JH
16159 *) case "$usethreads" in
16160 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16161 esac
90e831dc
SB
16162 d_setprotoent_r=undef
16163 setprotoent_r_proto=0
c18e646a 16164 ;;
a48ec845
JH
16165 esac
16166 ;;
10bc17b6
JH
16167*) setprotoent_r_proto=0
16168 ;;
16169esac
16170
b4eb6b3d
JH
16171: see if setpwent exists
16172set setpwent d_setpwent
16173eval $inlibc
16174
10bc17b6
JH
16175: see if setpwent_r exists
16176set setpwent_r d_setpwent_r
16177eval $inlibc
16178case "$d_setpwent_r" in
16179"$define")
16180 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16181 case "$d_setpwent_r_proto:$usethreads" in
16182 ":define") d_setpwent_r_proto=define
a48ec845
JH
16183 set d_setpwent_r_proto setpwent_r $hdrs
16184 eval $hasproto ;;
16185 *) ;;
16186 esac
16187 case "$d_setpwent_r_proto" in
16188 define)
10bc17b6
JH
16189 case "$setpwent_r_proto" in
16190 ''|0) try='int setpwent_r(FILE**);'
16191 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16192 esac
16193 case "$setpwent_r_proto" in
16194 ''|0) try='void setpwent_r(FILE**);'
16195 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16196 esac
16197 case "$setpwent_r_proto" in
90e831dc 16198 ''|0) d_setpwent_r=undef
10bc17b6 16199 setpwent_r_proto=0
a48ec845 16200 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16201 * ) case "$setpwent_r_proto" in
16202 REENTRANT_PROTO*) ;;
16203 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16204 esac
16205 echo "Prototype: $try" ;;
16206 esac
16207 ;;
c18e646a
JH
16208 *) case "$usethreads" in
16209 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16210 esac
90e831dc
SB
16211 d_setpwent_r=undef
16212 setpwent_r_proto=0
c18e646a 16213 ;;
a48ec845
JH
16214 esac
16215 ;;
10bc17b6
JH
16216*) setpwent_r_proto=0
16217 ;;
16218esac
16219
b4eb6b3d
JH
16220: see if setregid exists
16221set setregid d_setregid
16222eval $inlibc
16223set setresgid d_setresgid
16224eval $inlibc
16225
16226: see if setreuid exists
16227set setreuid d_setreuid
16228eval $inlibc
16229set setresuid d_setresuid
16230eval $inlibc
16231
16232: see if setrgid exists
16233set setrgid d_setrgid
16234eval $inlibc
16235
16236: see if setruid exists
16237set setruid d_setruid
16238eval $inlibc
16239
16240: see if setservent exists
16241set setservent d_setsent
16242eval $inlibc
16243
10bc17b6
JH
16244: see if setservent_r exists
16245set setservent_r d_setservent_r
16246eval $inlibc
16247case "$d_setservent_r" in
16248"$define")
16249 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16250 case "$d_setservent_r_proto:$usethreads" in
16251 ":define") d_setservent_r_proto=define
a48ec845
JH
16252 set d_setservent_r_proto setservent_r $hdrs
16253 eval $hasproto ;;
16254 *) ;;
16255 esac
16256 case "$d_setservent_r_proto" in
16257 define)
10bc17b6
JH
16258 case "$setservent_r_proto" in
16259 ''|0) try='int setservent_r(int, struct servent_data*);'
16260 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16261 esac
16262 case "$setservent_r_proto" in
16263 ''|0) try='void setservent_r(int, struct servent_data*);'
16264 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16265 esac
16266 case "$setservent_r_proto" in
90e831dc 16267 ''|0) d_setservent_r=undef
10bc17b6 16268 setservent_r_proto=0
a48ec845 16269 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16270 * ) case "$setservent_r_proto" in
16271 REENTRANT_PROTO*) ;;
16272 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16273 esac
16274 echo "Prototype: $try" ;;
16275 esac
16276 ;;
c18e646a
JH
16277 *) case "$usethreads" in
16278 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16279 esac
90e831dc
SB
16280 d_setservent_r=undef
16281 setservent_r_proto=0
c18e646a 16282 ;;
a48ec845
JH
16283 esac
16284 ;;
10bc17b6
JH
16285*) setservent_r_proto=0
16286 ;;
16287esac
16288
b4eb6b3d
JH
16289: see if setsid exists
16290set setsid d_setsid
16291eval $inlibc
16292
16293: see if setvbuf exists
16294set setvbuf d_setvbuf
16295eval $inlibc
16296
16297: see if sfio.h is available
16298set sfio.h i_sfio
16299eval $inhdr
16300
16301
16302: see if sfio library is available
16303case "$i_sfio" in
16304$define)
16305 val=''
16306 set sfreserve val
16307 eval $inlibc
16308 ;;
16309*)
16310 val="$undef"
16311 ;;
16312esac
16313: Ok, but do we want to use it.
16314case "$val" in
16315$define)
16316 case "$usesfio" in
16317 true|$define|[yY]*) dflt='y';;
16318 *) dflt='n';;
16319 esac
16320 echo "$package can use the sfio library, but it is experimental."
16321 case "$useperlio" in
16322 "$undef")
16323 echo "For sfio also the PerlIO abstraction layer is needed."
16324 echo "Earlier you said you wouldn't want that."
16325 ;;
16326 esac
16327 rp="You seem to have sfio available, do you want to try using it?"
16328 . ./myread
16329 case "$ans" in
16330 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16331 useperlio="$define"
16332 val="$define"
16333 ;;
16334 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16335 val="$undef"
b4eb6b3d
JH
16336 ;;
16337 esac
16338 ;;
16339*) case "$usesfio" in
16340 true|$define|[yY]*)
16341 echo "Sorry, cannot find sfio on this machine." >&4
16342 echo "Ignoring your setting of usesfio=$usesfio." >&4
16343 val="$undef"
16344 ;;
16345 esac
16346 ;;
16347esac
16348set d_sfio
16349eval $setvar
16350case "$d_sfio" in
16351$define) usesfio='true';;
16352*) usesfio='false';;
16353esac
3659ebf1
JH
16354case "$d_sfio" in
16355$define) ;;
16356*) : Remove sfio from list of libraries to use
7483f793
JH
16357 case "$libs" in
16358 *-lsfio*)
16359 echo "Removing unneeded -lsfio from library list" >&4
16360 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16361 shift
16362 libs="$*"
16363 echo "libs = $libs" >&4
16364 ;;
16365 esac
3659ebf1
JH
16366;;
16367esac
16368
b4eb6b3d
JH
16369
16370: see if shmctl exists
16371set shmctl d_shmctl
16372eval $inlibc
16373
16374: see if shmget exists
16375set shmget d_shmget
16376eval $inlibc
16377
16378: see if shmat exists
16379set shmat d_shmat
16380eval $inlibc
16381: see what shmat returns
16382case "$d_shmat" in
16383"$define")
16384 $cat >shmat.c <<'END'
16385#include <sys/shm.h>
16386void *shmat();
16387END
16388 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16389 shmattype='void *'
16390 else
16391 shmattype='char *'
16392 fi
16393 echo "and it returns ($shmattype)." >&4
16394 : see if a prototype for shmat is available
16395 xxx=`./findhdr sys/shm.h`
16396 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16397 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16398 val="$define"
16399 else
16400 val="$undef"
16401 fi
16402 $rm -f shmat.[co]
16403 ;;
16404*)
16405 val="$undef"
16406 ;;
16407esac
16408set d_shmatprototype
16409eval $setvar
16410
16411: see if shmdt exists
16412set shmdt d_shmdt
16413eval $inlibc
16414
16415: see how much of the 'shm*(2)' library is present.
16416h_shm=true
16417echo " "
16418case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16419*"$undef"*) h_shm=false;;
16420esac
16421case "$osname" in
16422freebsd)
16423 case "`ipcs 2>&1`" in
16424 "SVID shared memory"*"not configured"*)
16425 echo "Your $osname does not have the shm*(2) configured." >&4
16426 h_shm=false
16427 val="$undef"
16428 set shmctl d_shmctl
16429 evat $setvar
16430 set shmget d_shmget
16431 evat $setvar
16432 set shmat d_shmat
16433 evat $setvar
16434 set shmdt d_shmdt
16435 evat $setvar
16436 ;;
16437 esac
16438 ;;
16439esac
16440: we could also check for sys/ipc.h ...
16441if $h_shm && $test `./findhdr sys/shm.h`; then
16442 echo "You have the full shm*(2) library." >&4
16443 val="$define"
16444else
16445 echo "You don't have the full shm*(2) library." >&4
16446 val="$undef"
16447fi
16448set d_shm
16449eval $setvar
16450
16451echo " "
16452: see if we have sigaction
16453if set sigaction val -f d_sigaction; eval $csym; $val; then
16454 echo 'sigaction() found.' >&4
073b6de5 16455 $cat > try.c <<EOP
b4eb6b3d
JH
16456#include <stdio.h>
16457#include <sys/types.h>
16458#include <signal.h>
073b6de5
JH
16459#$i_stdlib I_STDLIB
16460#ifdef I_STDLIB
16461#include <stdlib.h>
16462#endif
b4eb6b3d
JH
16463int main()
16464{
16465 struct sigaction act, oact;
16466 act.sa_flags = 0;
16467 oact.sa_handler = 0;
16468 /* so that act and oact are used */
16469 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16470}
16471EOP
16472 set try
16473 if eval $compile_ok; then
16474 val="$define"
16475 else
16476 echo "But you don't seem to have a useable struct sigaction." >&4
16477 val="$undef"
16478 fi
16479else
16480 echo 'sigaction NOT found.' >&4
16481 val="$undef"
16482fi
16483set d_sigaction; eval $setvar
16484$rm -f try try$_o try.c
16485
983dbef6
JH
16486: see if sigprocmask exists
16487set sigprocmask d_sigprocmask
16488eval $inlibc
16489
b4eb6b3d
JH
16490: see if sigsetjmp exists
16491echo " "
16492case "$d_sigsetjmp" in
16493'')
c727eafa 16494 $cat >try.c <<EOP
b4eb6b3d 16495#include <setjmp.h>
d1daaddf
JH
16496#$i_stdlib I_STDLIB
16497#ifdef I_STDLIB
16498#include <stdlib.h>
16499#endif
b4eb6b3d
JH
16500sigjmp_buf env;
16501int set = 1;
16502int main()
16503{
16504 if (sigsetjmp(env,1))
16505 exit(set);
16506 set = 0;
16507 siglongjmp(env, 1);
16508 exit(1);
16509}
16510EOP
16511 set try
16512 if eval $compile; then
5440bc8e 16513 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16514 echo "POSIX sigsetjmp found." >&4
16515 val="$define"
16516 else
16517 $cat >&4 <<EOM
16518Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16519I'll ignore them.
16520EOM
16521 val="$undef"
16522 fi
16523 else
16524 echo "sigsetjmp not found." >&4
16525 val="$undef"
16526 fi
16527 ;;
16528*) val="$d_sigsetjmp"
16529 case "$d_sigsetjmp" in
16530 $define) echo "POSIX sigsetjmp found." >&4;;
16531 $undef) echo "sigsetjmp not found." >&4;;
16532 esac
16533 ;;
16534esac
16535set d_sigsetjmp
16536eval $setvar
16537$rm -f try.c try
16538
49a78c82
JH
16539: see if sockatmark exists
16540set sockatmark d_sockatmark
16541eval $inlibc
16542
2ef53570
JH
16543: see if prototype for sockatmark is available
16544echo " "
16545set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16546eval $hasproto
16547
b4eb6b3d
JH
16548: see if socks5_init exists
16549set socks5_init d_socks5_init
16550eval $inlibc
16551
360321b3
YST
16552: see if sprintf returns the length of the string in the buffer as per ANSI
16553$echo "Checking whether sprintf returns the length of the string..." >&4
16554$cat <<EOP >try.c
16555#include <stdio.h>
16556#$i_stdlib I_STDLIB
16557#ifdef I_STDLIB
16558#include <stdlib.h>
16559#endif
16560#$i_string I_STRING
16561#ifdef I_STRING
16562# include <string.h>
16563#else
16564# include <strings.h>
16565#endif
16566#$i_math I_MATH
16567#ifdef I_MATH
16568#include <math.h>
16569#endif
16570
16571char buffer[256];
16572
16573int check (size_t expect, int test) {
16574 size_t got = strlen(buffer);
16575 if (expect == got)
16576 return 0;
16577
16578 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16579 test, buffer);
16580 exit (test);
16581}
16582
16583int main(int argc, char **argv) {
16584 int test = 0;
16585
16586 check(sprintf(buffer, ""), ++test);
16587 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16588 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16589
16590 return 0;
16591}
16592EOP
16593set try
16594
16595d_sprintf_returns_strlen="$undef"
16596if eval $compile; then
16597 xxx="`$run ./try`"
16598 case "$?" in
16599 0) cat >&4 <<EOM
16600sprintf returns the length of the string (as ANSI says it should)
16601EOM
16602 d_sprintf_returns_strlen="$define"
16603 ;;
16604 *) cat >&4 <<EOM
16605sprintf does not return the length of the string (how old is this system?)
16606EOM
16607 d_sprintf_returns_strlen="$undef"
16608 ;;
16609 esac
16610fi
16611
16612$rm -f try.* try
16613
10bc17b6
JH
16614: see if srand48_r exists
16615set srand48_r d_srand48_r
16616eval $inlibc
16617case "$d_srand48_r" in
16618"$define")
16619 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16620 case "$d_srand48_r_proto:$usethreads" in
16621 ":define") d_srand48_r_proto=define
a48ec845
JH
16622 set d_srand48_r_proto srand48_r $hdrs
16623 eval $hasproto ;;
16624 *) ;;
16625 esac
16626 case "$d_srand48_r_proto" in
16627 define)
10bc17b6
JH
16628 case "$srand48_r_proto" in
16629 ''|0) try='int srand48_r(long, struct drand48_data*);'
16630 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16631 esac
16632 case "$srand48_r_proto" in
90e831dc 16633 ''|0) d_srand48_r=undef
10bc17b6 16634 srand48_r_proto=0
a48ec845 16635 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16636 * ) case "$srand48_r_proto" in
16637 REENTRANT_PROTO*) ;;
16638 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16639 esac
16640 echo "Prototype: $try" ;;
16641 esac
16642 ;;
c18e646a
JH
16643 *) case "$usethreads" in
16644 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16645 esac
90e831dc
SB
16646 d_srand48_r=undef
16647 srand48_r_proto=0
c18e646a 16648 ;;
a48ec845
JH
16649 esac
16650 ;;
10bc17b6
JH
16651*) srand48_r_proto=0
16652 ;;
16653esac
16654
16655: see if srandom_r exists
16656set srandom_r d_srandom_r
16657eval $inlibc
16658case "$d_srandom_r" in
16659"$define")
16660 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16661 case "$d_srandom_r_proto:$usethreads" in
16662 ":define") d_srandom_r_proto=define
a48ec845
JH
16663 set d_srandom_r_proto srandom_r $hdrs
16664 eval $hasproto ;;
16665 *) ;;
16666 esac
16667 case "$d_srandom_r_proto" in
16668 define)
10bc17b6
JH
16669 case "$srandom_r_proto" in
16670 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16671 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16672 esac
16673 case "$srandom_r_proto" in
90e831dc 16674 ''|0) d_srandom_r=undef
10bc17b6 16675 srandom_r_proto=0
a48ec845 16676 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16677 * ) case "$srandom_r_proto" in
16678 REENTRANT_PROTO*) ;;
16679 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16680 esac
16681 echo "Prototype: $try" ;;
16682 esac
16683 ;;
c18e646a
JH
16684 *) case "$usethreads" in
16685 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16686 esac
90e831dc
SB
16687 d_srandom_r=undef
16688 srandom_r_proto=0
c18e646a 16689 ;;
a48ec845
JH
16690 esac
16691 ;;
10bc17b6
JH
16692*) srandom_r_proto=0
16693 ;;
16694esac
16695
eef837ea
JH
16696: see if prototype for setresgid is available
16697echo " "
16698set d_sresgproto setresgid $i_unistd unistd.h
16699eval $hasproto
16700
640374d0
JH
16701: see if prototype for setresuid is available
16702echo " "
16703set d_sresuproto setresuid $i_unistd unistd.h
16704eval $hasproto
16705
b4eb6b3d
JH
16706: see if sys/stat.h is available
16707set sys/stat.h i_sysstat
16708eval $inhdr
16709
16710
16711: see if stat knows about block sizes
16712echo " "
16713echo "Checking to see if your struct stat has st_blocks field..." >&4
16714set d_statblks stat st_blocks $i_sysstat sys/stat.h
16715eval $hasfield
16716
16717
16718: see if this is a sys/vfs.h system
16719set sys/vfs.h i_sysvfs
16720eval $inhdr
16721
16722
16723: see if this is a sys/statfs.h system
16724set sys/statfs.h i_sysstatfs
16725eval $inhdr
16726
16727
16728echo " "
16729echo "Checking to see if your system supports struct statfs..." >&4
16730set 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
16731eval $hasstruct
16732case "$d_statfs_s" in
16733"$define") echo "Yes, it does." ;;
16734*) echo "No, it doesn't." ;;
16735esac
16736
16737
16738
16739: see if struct statfs knows about f_flags
16740case "$d_statfs_s" in
16741define)
16742 echo " "
16743 echo "Checking to see if your struct statfs has f_flags field..." >&4
16744 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
16745 eval $hasfield
16746 ;;
16747*) val="$undef"
16748 set d_statfs_f_flags
16749 eval $setvar
16750 ;;
16751esac
16752case "$d_statfs_f_flags" in
16753"$define") echo "Yes, it does." ;;
16754*) echo "No, it doesn't." ;;
16755esac
16756
b4eb6b3d
JH
16757$cat >&4 <<EOM
16758Checking how to access stdio streams by file descriptor number...
16759EOM
16760case "$stdio_stream_array" in
16761'') $cat >try.c <<EOCP
16762#include <stdio.h>
16763int main() {
16764 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16765 printf("yes\n");
16766}
16767EOCP
16768 for s in _iob __iob __sF
16769 do
16770 set try -DSTDIO_STREAM_ARRAY=$s
16771 if eval $compile; then
5440bc8e 16772 case "`$run ./try`" in
b4eb6b3d
JH
16773 yes) stdio_stream_array=$s; break ;;
16774 esac
16775 fi
16776 done
16777 $rm -f try.* try$exe_ext
16778esac
16779case "$stdio_stream_array" in
16780'') $cat >&4 <<EOM
16781I can't figure out how to access stdio streams by file descriptor number.
16782EOM
16783 d_stdio_stream_array="$undef"
16784 ;;
16785*) $cat >&4 <<EOM
16786You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16787EOM
16788 d_stdio_stream_array="$define"
16789 ;;
16790esac
16791
16792: see if strcoll exists
16793set strcoll d_strcoll
16794eval $inlibc
16795
16796: check for structure copying
16797echo " "
16798echo "Checking to see if your C compiler can copy structs..." >&4
16799$cat >try.c <<'EOCP'
76f47787 16800int main()
b4eb6b3d
JH
16801{
16802 struct blurfl {
16803 int dyick;
16804 } foo, bar;
16805
16806 foo = bar;
16807}
16808EOCP
16809if $cc -c try.c >/dev/null 2>&1 ; then
16810 val="$define"
16811 echo "Yup, it can."
16812else
16813 val="$undef"
16814 echo "Nope, it can't."
16815fi
16816set d_strctcpy
16817eval $setvar
16818$rm -f try.*
16819
16820: see if strerror and/or sys_errlist[] exist
16821echo " "
16822if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16823 if set strerror val -f d_strerror; eval $csym; $val; then
16824 echo 'strerror() found.' >&4
16825 d_strerror="$define"
16826 d_strerrm='strerror(e)'
16827 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16828 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16829 d_syserrlst="$define"
16830 else
16831 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16832 d_syserrlst="$undef"
16833 fi
16834 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16835 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16836 echo 'strerror() found in string header.' >&4
16837 d_strerror="$define"
16838 d_strerrm='strerror(e)'
16839 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16840 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16841 d_syserrlst="$define"
16842 else
16843 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16844 d_syserrlst="$undef"
16845 fi
16846 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16847 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16848 d_strerror="$undef"
16849 d_syserrlst="$define"
16850 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16851 else
16852 echo 'strerror() and sys_errlist[] NOT found.' >&4
16853 d_strerror="$undef"
16854 d_syserrlst="$undef"
16855 d_strerrm='"unknown"'
16856 fi
16857fi
16858
10bc17b6
JH
16859: see if strerror_r exists
16860set strerror_r d_strerror_r
16861eval $inlibc
16862case "$d_strerror_r" in
16863"$define")
16864 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16865 case "$d_strerror_r_proto:$usethreads" in
16866 ":define") d_strerror_r_proto=define
a48ec845
JH
16867 set d_strerror_r_proto strerror_r $hdrs
16868 eval $hasproto ;;
16869 *) ;;
16870 esac
16871 case "$d_strerror_r_proto" in
16872 define)
10bc17b6
JH
16873 case "$strerror_r_proto" in
16874 ''|0) try='int strerror_r(int, char*, size_t);'
16875 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16876 esac
16877 case "$strerror_r_proto" in
16878 ''|0) try='int strerror_r(int, char*, int);'
16879 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16880 esac
16881 case "$strerror_r_proto" in
16882 ''|0) try='char* strerror_r(int, char*, size_t);'
16883 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16884 esac
16885 case "$strerror_r_proto" in
90e831dc 16886 ''|0) d_strerror_r=undef
10bc17b6 16887 strerror_r_proto=0
a48ec845 16888 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16889 * ) case "$strerror_r_proto" in
16890 REENTRANT_PROTO*) ;;
16891 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16892 esac
16893 echo "Prototype: $try" ;;
16894 esac
16895 ;;
c18e646a
JH
16896 *) case "$usethreads" in
16897 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16898 esac
90e831dc
SB
16899 d_strerror_r=undef
16900 strerror_r_proto=0
c18e646a 16901 ;;
a48ec845
JH
16902 esac
16903 ;;
10bc17b6
JH
16904*) strerror_r_proto=0
16905 ;;
16906esac
16907
b3c85772
JH
16908: see if strftime exists
16909set strftime d_strftime
16910eval $inlibc
16911
08c92000
MB
16912: see if strlcat exists
16913set strlcat d_strlcat
16914eval $inlibc
16915
16916: see if strlcpy exists
16917set strlcpy d_strlcpy
16918eval $inlibc
16919
b4eb6b3d
JH
16920: see if strtod exists
16921set strtod d_strtod
16922eval $inlibc
16923
16924: see if strtol exists
16925set strtol d_strtol
16926eval $inlibc
16927
16928: see if strtold exists
16929set strtold d_strtold
16930eval $inlibc
16931
16932: see if strtoll exists
16933set strtoll d_strtoll
16934eval $inlibc
16935
16936case "$d_longlong-$d_strtoll" in
16937"$define-$define")
16938 $cat <<EOM
16939Checking whether your strtoll() works okay...
16940EOM
16941 $cat >try.c <<'EOCP'
16942#include <errno.h>
16943#ifdef __hpux
16944#define strtoll __strtoll
16945#endif
e75931a7
YST
16946#ifdef __EMX__
16947#define strtoll _strtoll
16948#endif
b4eb6b3d
JH
16949#include <stdio.h>
16950extern long long int strtoll(char *s, char **, int);
16951static int bad = 0;
16952int check(char *s, long long ell, int een) {
16953 long long gll;
16954 errno = 0;
16955 gll = strtoll(s, 0, 10);
16956 if (!((gll == ell) && (errno == een)))
16957 bad++;
16958}
16959int main() {
16960 check(" 1", 1LL, 0);
16961 check(" 0", 0LL, 0);
16962 check("-1", -1LL, 0);
16963 check("-9223372036854775808", -9223372036854775808LL, 0);
16964 check("-9223372036854775808", -9223372036854775808LL, 0);
16965 check(" 9223372036854775807", 9223372036854775807LL, 0);
16966 check("-9223372036854775808", -9223372036854775808LL, 0);
16967 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
16968 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16969 if (!bad)
16970 printf("ok\n");
16971}
16972EOCP
16973 set try
16974 if eval $compile; then
5440bc8e 16975 yyy=`$run ./try`
e75931a7 16976 case "$yyy" in
b4eb6b3d
JH
16977 ok) echo "Your strtoll() seems to be working okay." ;;
16978 *) cat <<EOM >&4
16979Your strtoll() doesn't seem to be working okay.
16980EOM
16981 d_strtoll="$undef"
16982 ;;
69eadf66 16983 esac
e75931a7
YST
16984 else
16985 echo "(I can't seem to compile the test program--assuming it doesn't)"
16986 d_strtoll="$undef"
b4eb6b3d
JH
16987 fi
16988 ;;
16989esac
16990
28e5dec8
JH
16991: see if strtoq exists
16992set strtoq d_strtoq
16993eval $inlibc
16994
b4eb6b3d
JH
16995: see if strtoul exists
16996set strtoul d_strtoul
16997eval $inlibc
16998
d0e6d399
NC
16999case "$d_strtoul" in
17000"$define")
17001 $cat <<EOM
17002Checking whether your strtoul() works okay...
17003EOM
17004 $cat >try.c <<'EOCP'
17005#include <errno.h>
17006#include <stdio.h>
17007extern unsigned long int strtoul(char *s, char **, int);
17008static int bad = 0;
17009void check(char *s, unsigned long eul, int een) {
17010 unsigned long gul;
17011 errno = 0;
17012 gul = strtoul(s, 0, 10);
17013 if (!((gul == eul) && (errno == een)))
17014 bad++;
17015}
17016int main() {
17017 check(" 1", 1L, 0);
17018 check(" 0", 0L, 0);
17019EOCP
17020 case "$longsize" in
17021 8)
17022 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17023 check("18446744073709551615", 18446744073709551615UL, 0);
17024 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17025#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17026 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17027 check("-18446744073709551614", 2, 0);
17028 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17029 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17030 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17031#endif
d0e6d399
NC
17032EOCP
17033 ;;
17034 4)
17035 $cat >>try.c <<'EOCP'
17036 check("4294967295", 4294967295UL, 0);
17037 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17038#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17039 check("-1", 4294967295UL, 0);
17040 check("-4294967294", 2, 0);
17041 check("-4294967295", 1, 0);
17042 check("-4294967296", 4294967295UL, ERANGE);
17043 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17044#endif
d0e6d399
NC
17045EOCP
17046 ;;
17047 *)
17048: Should we write these tests to be more portable by sprintf-ing
17049: ~0 and then manipulating that char string as input for strtol?
17050 ;;
17051 esac
17052 $cat >>try.c <<'EOCP'
17053 if (!bad)
17054 printf("ok\n");
17055 return 0;
17056}
17057EOCP
17058 set try
17059 if eval $compile; then
5440bc8e 17060 case "`$run ./try`" in
d0e6d399
NC
17061 ok) echo "Your strtoul() seems to be working okay." ;;
17062 *) cat <<EOM >&4
17063Your strtoul() doesn't seem to be working okay.
17064EOM
17065 d_strtoul="$undef"
17066 ;;
17067 esac
17068 fi
17069 ;;
17070esac
17071
b4eb6b3d
JH
17072: see if strtoull exists
17073set strtoull d_strtoull
17074eval $inlibc
17075
17076case "$d_longlong-$d_strtoull" in
17077"$define-$define")
17078 $cat <<EOM
17079Checking whether your strtoull() works okay...
17080EOM
17081 $cat >try.c <<'EOCP'
17082#include <errno.h>
17083#ifdef __hpux
17084#define strtoull __strtoull
17085#endif
17086#include <stdio.h>
17087extern unsigned long long int strtoull(char *s, char **, int);
17088static int bad = 0;
17089int check(char *s, long long eull, int een) {
17090 long long gull;
17091 errno = 0;
17092 gull = strtoull(s, 0, 10);
17093 if (!((gull == eull) && (errno == een)))
17094 bad++;
17095}
17096int main() {
d0e6d399
NC
17097 check(" 1", 1LL, 0);
17098 check(" 0", 0LL, 0);
17099 check("18446744073709551615", 18446744073709551615ULL, 0);
17100 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17101#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17102 check("-1", 18446744073709551615ULL, 0);
17103 check("-18446744073709551614", 2LL, 0);
17104 check("-18446744073709551615", 1LL, 0);
17105 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17106 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17107#endif
b4eb6b3d
JH
17108 if (!bad)
17109 printf("ok\n");
17110}
17111EOCP
17112 set try
17113 if eval $compile; then
5440bc8e 17114 case "`$run ./try`" in
b4eb6b3d
JH
17115 ok) echo "Your strtoull() seems to be working okay." ;;
17116 *) cat <<EOM >&4
17117Your strtoull() doesn't seem to be working okay.
17118EOM
17119 d_strtoull="$undef"
17120 ;;
17121 esac
17122 fi
17123 ;;
17124esac
17125
17126: see if strtouq exists
17127set strtouq d_strtouq
17128eval $inlibc
17129
d0e6d399
NC
17130case "$d_strtouq" in
17131"$define")
17132 $cat <<EOM
17133Checking whether your strtouq() works okay...
17134EOM
17135 $cat >try.c <<'EOCP'
17136#include <errno.h>
17137#include <stdio.h>
17138extern unsigned long long int strtouq(char *s, char **, int);
17139static int bad = 0;
17140void check(char *s, unsigned long long eull, int een) {
17141 unsigned long long gull;
17142 errno = 0;
17143 gull = strtouq(s, 0, 10);
17144 if (!((gull == eull) && (errno == een)))
17145 bad++;
17146}
17147int main() {
17148 check(" 1", 1LL, 0);
17149 check(" 0", 0LL, 0);
17150 check("18446744073709551615", 18446744073709551615ULL, 0);
17151 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17152#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17153 check("-1", 18446744073709551615ULL, 0);
17154 check("-18446744073709551614", 2LL, 0);
17155 check("-18446744073709551615", 1LL, 0);
17156 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17157 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17158#endif
d0e6d399
NC
17159 if (!bad)
17160 printf("ok\n");
17161 return 0;
17162}
17163EOCP
17164 set try
17165 if eval $compile; then
5440bc8e 17166 case "`$run ./try`" in
d0e6d399
NC
17167 ok) echo "Your strtouq() seems to be working okay." ;;
17168 *) cat <<EOM >&4
17169Your strtouq() doesn't seem to be working okay.
17170EOM
17171 d_strtouq="$undef"
17172 ;;
17173 esac
17174 fi
17175 ;;
17176esac
17177
b4eb6b3d
JH
17178: see if strxfrm exists
17179set strxfrm d_strxfrm
17180eval $inlibc
17181
17182: see if symlink exists
17183set symlink d_symlink
17184eval $inlibc
17185
17186: see if syscall exists
17187set syscall d_syscall
17188eval $inlibc
17189
2ef53570
JH
17190: see if prototype for syscall is available
17191echo " "
17192set d_syscallproto syscall $i_unistd unistd.h
17193eval $hasproto
17194
b4eb6b3d
JH
17195: see if sysconf exists
17196set sysconf d_sysconf
17197eval $inlibc
17198
17199: see if system exists
17200set system d_system
17201eval $inlibc
17202
17203: see if tcgetpgrp exists
17204set tcgetpgrp d_tcgetpgrp
17205eval $inlibc
17206
17207: see if tcsetpgrp exists
17208set tcsetpgrp d_tcsetpgrp
17209eval $inlibc
17210
17211: see if prototype for telldir is available
17212echo " "
17213set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17214eval $hasproto
17215
ad493445
MB
17216: see if time exists
17217echo " "
17218if test "X$d_time" = X -o X"$timetype" = X; then
17219 if set time val -f d_time; eval $csym; $val; then
17220 echo 'time() found.' >&4
17221 val="$define"
17222 rp="What is the type returned by time() on this system?"
17223 set time_t timetype long stdio.h sys/types.h
17224 eval $typedef_ask
17225 else
17226 echo 'time() not found, hope that will do.' >&4
17227 val="$undef"
17228 timetype='int';
17229 fi
17230 set d_time
17231 eval $setvar
17232fi
17233
b4eb6b3d
JH
17234: see if this is a sys/times.h system
17235set sys/times.h i_systimes
17236eval $inhdr
17237
17238: see if times exists
17239echo " "
17240if set times val -f d_times; eval $csym; $val; then
17241 echo 'times() found.' >&4
17242 d_times="$define"
17243 inc=''
17244 case "$i_systimes" in
17245 "$define") inc='sys/times.h';;
17246 esac
17247 rp="What is the type returned by times() on this system?"
17248 set clock_t clocktype long stdio.h sys/types.h $inc
17249 eval $typedef_ask
17250else
17251 echo 'times() NOT found, hope that will do.' >&4
17252 d_times="$undef"
17253 clocktype='int'
17254fi
17255
10bc17b6
JH
17256: see if tmpnam_r exists
17257set tmpnam_r d_tmpnam_r
17258eval $inlibc
17259case "$d_tmpnam_r" in
17260"$define")
31ee0cb7 17261 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17262 case "$d_tmpnam_r_proto:$usethreads" in
17263 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17264 set d_tmpnam_r_proto tmpnam_r $hdrs
17265 eval $hasproto ;;
17266 *) ;;
17267 esac
17268 case "$d_tmpnam_r_proto" in
17269 define)
10bc17b6
JH
17270 case "$tmpnam_r_proto" in
17271 ''|0) try='char* tmpnam_r(char*);'
17272 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17273 esac
17274 case "$tmpnam_r_proto" in
90e831dc 17275 ''|0) d_tmpnam_r=undef
10bc17b6 17276 tmpnam_r_proto=0
a48ec845 17277 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17278 * ) case "$tmpnam_r_proto" in
17279 REENTRANT_PROTO*) ;;
17280 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17281 esac
17282 echo "Prototype: $try" ;;
17283 esac
17284 ;;
c18e646a
JH
17285 *) case "$usethreads" in
17286 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17287 esac
90e831dc
SB
17288 d_tmpnam_r=undef
17289 tmpnam_r_proto=0
c18e646a 17290 ;;
a48ec845
JH
17291 esac
17292 ;;
10bc17b6
JH
17293*) tmpnam_r_proto=0
17294 ;;
17295esac
17296
b4eb6b3d
JH
17297: see if truncate exists
17298set truncate d_truncate
17299eval $inlibc
17300
10bc17b6
JH
17301: see if ttyname_r exists
17302set ttyname_r d_ttyname_r
17303eval $inlibc
17304case "$d_ttyname_r" in
17305"$define")
17306 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17307 case "$d_ttyname_r_proto:$usethreads" in
17308 ":define") d_ttyname_r_proto=define
a48ec845
JH
17309 set d_ttyname_r_proto ttyname_r $hdrs
17310 eval $hasproto ;;
17311 *) ;;
17312 esac
17313 case "$d_ttyname_r_proto" in
17314 define)
10bc17b6
JH
17315 case "$ttyname_r_proto" in
17316 ''|0) try='int ttyname_r(int, char*, size_t);'
17317 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17318 esac
17319 case "$ttyname_r_proto" in
17320 ''|0) try='int ttyname_r(int, char*, int);'
17321 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17322 esac
17323 case "$ttyname_r_proto" in
17324 ''|0) try='char* ttyname_r(int, char*, int);'
17325 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17326 esac
17327 case "$ttyname_r_proto" in
90e831dc 17328 ''|0) d_ttyname_r=undef
10bc17b6 17329 ttyname_r_proto=0
a48ec845 17330 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17331 * ) case "$ttyname_r_proto" in
17332 REENTRANT_PROTO*) ;;
17333 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17334 esac
17335 echo "Prototype: $try" ;;
17336 esac
17337 ;;
c18e646a
JH
17338 *) case "$usethreads" in
17339 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17340 esac
90e831dc
SB
17341 d_ttyname_r=undef
17342 ttyname_r_proto=0
c18e646a 17343 ;;
a48ec845
JH
17344 esac
17345 ;;
10bc17b6
JH
17346*) ttyname_r_proto=0
17347 ;;
17348esac
17349
b4eb6b3d
JH
17350: see if tzname[] exists
17351echo " "
17352if set tzname val -a d_tzname; eval $csym; $val; then
17353 val="$define"
17354 echo 'tzname[] found.' >&4
17355else
17356 val="$undef"
17357 echo 'tzname[] NOT found.' >&4
17358fi
17359set d_tzname
17360eval $setvar
17361
4e0554ec
JH
17362case "$osname" in
17363next|rhapsody|darwin) multiarch="$define" ;;
17364esac
17365case "$multiarch" in
17366''|[nN]*) multiarch="$undef" ;;
17367esac
17368
24412007 17369: check for ordering of bytes in a UV
4e0554ec 17370echo " "
5440bc8e 17371case "$usecrosscompile$multiarch" in
4e0554ec
JH
17372*$define*)
17373 $cat <<EOM
17374You seem to be either cross-compiling or doing a multiarchitecture build,
17375skipping the byteorder check.
17376
17377EOM
5440bc8e 17378 byteorder='ffff'
4e0554ec
JH
17379 ;;
17380*)
17381 case "$byteorder" in
17382 '')
17383 $cat <<'EOM'
17384In the following, larger digits indicate more significance. A big-endian
17385machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17386little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17387machines may have weird orders like 3412. A Cray will report 87654321,
17388an Alpha will report 12345678. If the test program works the default is
17389probably right.
17390I'm now running the test program...
17391EOM
24412007 17392 $cat >try.c <<EOCP
4e0554ec 17393#include <stdio.h>
55954f19
JH
17394#$i_stdlib I_STDLIB
17395#ifdef I_STDLIB
17396#include <stdlib.h>
17397#endif
24412007
JH
17398#include <sys/types.h>
17399typedef $uvtype UV;
4e0554ec
JH
17400int main()
17401{
17402 int i;
17403 union {
24412007
JH
17404 UV l;
17405 char c[$uvsize];
4e0554ec
JH
17406 } u;
17407
24412007 17408 if ($uvsize > 4)
b5ded3e5 17409 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17410 else
a4c53327 17411 u.l = (UV)0x04030201;
24412007 17412 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17413 printf("%c", u.c[i]+'0');
17414 printf("\n");
17415 exit(0);
17416}
17417EOCP
17418 xxx_prompt=y
17419 set try
17420 if eval $compile && ./try > /dev/null; then
5440bc8e 17421 dflt=`$run ./try`
4e0554ec
JH
17422 case "$dflt" in
17423 [1-4][1-4][1-4][1-4]|12345678|87654321)
17424 echo "(The test program ran ok.)"
17425 echo "byteorder=$dflt"
17426 xxx_prompt=n
17427 ;;
17428 ????|????????) echo "(The test program ran ok.)" ;;
17429 *) echo "(The test program didn't run right for some reason.)" ;;
17430 esac
17431 else
17432 dflt='4321'
17433 cat <<'EOM'
17434(I can't seem to compile the test program. Guessing big-endian...)
17435EOM
17436 fi
17437 case "$xxx_prompt" in
17438 y)
24412007 17439 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17440 . ./myread
17441 byteorder="$ans"
17442 ;;
17443 *) byteorder=$dflt
17444 ;;
17445 esac
17446 ;;
17447 esac
17448 $rm -f try.c try
17449 ;;
17450esac
17451
17452
17453$cat <<EOM
17454
17455Checking to see whether you can access character data unalignedly...
17456EOM
dc7b0a4f
JH
17457case "$d_u32align" in
17458'') $cat >try.c <<EOCP
4e0554ec 17459#include <stdio.h>
d1daaddf
JH
17460#$i_stdlib I_STDLIB
17461#ifdef I_STDLIB
17462#include <stdlib.h>
17463#endif
4e0554ec 17464#define U32 $u32type
d308175a
JH
17465#define BYTEORDER 0x$byteorder
17466#define U8 $u8type
9958dc3c
JH
17467#include <signal.h>
17468#ifdef SIGBUS
17469$signal_t bletch(s) int s; { exit(4); }
17470#endif
4e0554ec
JH
17471int main() {
17472#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17473 U8 buf[8];
4e0554ec
JH
17474 U32 *up;
17475 int i;
17476
17477 if (sizeof(U32) != 4) {
17478 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17479 exit(1);
17480 }
17481
17482 fflush(stdout);
17483
9958dc3c
JH
17484#ifdef SIGBUS
17485 signal(SIGBUS, bletch);
17486#endif
17487
8906a23e
JH
17488 buf[0] = 0;
17489 buf[1] = 0;
17490 buf[2] = 0;
17491 buf[3] = 1;
7eac3fd6 17492 buf[4] = 0;
8906a23e
JH
17493 buf[5] = 0;
17494 buf[6] = 0;
7eac3fd6 17495 buf[7] = 1;
8906a23e 17496
4e0554ec
JH
17497 for (i = 0; i < 4; i++) {
17498 up = (U32*)(buf + i);
17499 if (! ((*up == 1 << (8*i)) || /* big-endian */
17500 (*up == 1 << (8*(3-i))) /* little-endian */
17501 )
17502 )
17503 {
17504 printf("read failed (%x)\n", *up);
17505 exit(2);
17506 }
17507 }
17508
17509 /* write test */
17510 for (i = 0; i < 4; i++) {
17511 up = (U32*)(buf + i);
17512 *up = 0xBeef;
17513 if (*up != 0xBeef) {
17514 printf("write failed (%x)\n", *up);
17515 exit(3);
17516 }
17517 }
17518
17519 exit(0);
17520#else
17521 printf("1\n");
17522 exit(1);
17523#endif
17524 return 0;
17525}
17526EOCP
17527set try
17528if eval $compile_ok; then
d308175a 17529 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17530 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17531 case "$?" in
17532 0) cat >&4 <<EOM
17533You can access character data pretty unalignedly.
17534EOM
17535 d_u32align="$undef"
17536 ;;
17537 *) cat >&4 <<EOM
17538It seems that you must access character data in an aligned manner.
17539EOM
17540 d_u32align="$define"
17541 ;;
17542 esac
4e0554ec
JH
17543else
17544 rp='Can you access character data at unaligned addresses?'
17545 dflt='n'
17546 . ./myread
17547 case "$ans" in
17548 [yY]*) d_u32align="$undef" ;;
17549 *) d_u32align="$define" ;;
17550 esac
17551fi
e36b5403 17552$rm -f core core.try.* try.core
dc7b0a4f
JH
17553;;
17554esac
4e0554ec
JH
17555
17556: see if ualarm exists
17557set ualarm d_ualarm
17558eval $inlibc
17559
b4eb6b3d
JH
17560: see if umask exists
17561set umask d_umask
17562eval $inlibc
17563
758a5d79
JH
17564: see if unordered exists
17565set unordered d_unordered
17566eval $inlibc
17567
bdf33aa7
SP
17568: see if unsetenv exists
17569set unsetenv d_unsetenv
17570eval $inlibc
17571
4e0554ec
JH
17572: see if usleep exists
17573set usleep d_usleep
17574eval $inlibc
17575
2ef53570
JH
17576: see if prototype for usleep is available
17577echo " "
17578set d_usleepproto usleep $i_unistd unistd.h
17579eval $hasproto
17580
b4eb6b3d
JH
17581: see if ustat exists
17582set ustat d_ustat
17583eval $inlibc
17584
17585: backward compatibility for d_hvfork
17586if test X$d_hvfork != X; then
17587 d_vfork="$d_hvfork"
17588 d_hvfork=''
17589fi
17590: see if there is a vfork
17591val=''
17592set vfork val
17593eval $inlibc
17594
17595: Ok, but do we want to use it. vfork is reportedly unreliable in
17596: perl on Solaris 2.x, and probably elsewhere.
17597case "$val" in
17598$define)
17599 echo " "
17600 case "$usevfork" in
17601 false) dflt='n';;
17602 *) dflt='y';;
17603 esac
17604 cat <<'EOM'
17605
17606Perl can only use a vfork() that doesn't suffer from strict
17607restrictions on calling functions or modifying global data in
17608the child. For example, glibc-2.1 contains such a vfork()
17609that is unsuitable. If your system provides a proper fork()
17610call, chances are that you do NOT want perl to use vfork().
17611
17612EOM
17613 rp="Do you still want to use vfork()?"
17614 . ./myread
17615 case "$ans" in
17616 y|Y) ;;
17617 *)
17618 echo "Ok, we won't use vfork()."
17619 val="$undef"
17620 ;;
17621 esac
17622 ;;
17623esac
17624set d_vfork
17625eval $setvar
17626case "$d_vfork" in
17627$define) usevfork='true';;
17628*) usevfork='false';;
17629esac
17630
b4eb6b3d
JH
17631: see if closedir exists
17632set closedir d_closedir
17633eval $inlibc
17634
17635case "$d_closedir" in
17636"$define")
17637 echo " "
17638 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17639 cat > try.c <<EOM
b4eb6b3d
JH
17640#$i_dirent I_DIRENT /**/
17641#$i_sysdir I_SYS_DIR /**/
17642#$i_sysndir I_SYS_NDIR /**/
17643#$i_systypes I_SYS_TYPES /**/
17644
17645#if defined(I_SYS_TYPES)
17646#include <sys/types.h>
17647#endif
17648#if defined(I_DIRENT)
17649#include <dirent.h>
17650#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17651#include <sys/dir.h>
17652#endif
17653#else
17654#ifdef I_SYS_NDIR
17655#include <sys/ndir.h>
17656#else
17657#ifdef I_SYS_DIR
17658#ifdef hp9000s500
17659#include <ndir.h> /* may be wrong in the future */
17660#else
17661#include <sys/dir.h>
17662#endif
17663#endif
17664#endif
17665#endif
17666int main() { return closedir(opendir(".")); }
17667EOM
5440bc8e 17668 set try
b4eb6b3d 17669 if eval $compile_ok; then
5440bc8e 17670 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17671 echo "Yes, it does."
17672 val="$undef"
17673 else
17674 echo "No, it doesn't."
17675 val="$define"
17676 fi
17677 else
17678 echo "(I can't seem to compile the test program--assuming it doesn't)"
17679 val="$define"
17680 fi
17681 ;;
17682*)
17683 val="$undef";
17684 ;;
17685esac
17686set d_void_closedir
17687eval $setvar
5440bc8e 17688$rm -f try try.*
b4eb6b3d
JH
17689: see if there is a wait4
17690set wait4 d_wait4
17691eval $inlibc
17692
17693: see if waitpid exists
17694set waitpid d_waitpid
17695eval $inlibc
17696
17697: see if wcstombs exists
17698set wcstombs d_wcstombs
17699eval $inlibc
17700
17701: see if wctomb exists
17702set wctomb d_wctomb
17703eval $inlibc
17704
4e0554ec
JH
17705: see if writev exists
17706set writev d_writev
17707eval $inlibc
17708
b4eb6b3d
JH
17709: preserve RCS keywords in files with variable substitution, grrr
17710Date='$Date'
17711Id='$Id'
17712Log='$Log'
17713RCSfile='$RCSfile'
17714Revision='$Revision'
17715
b4eb6b3d
JH
17716: check for alignment requirements
17717echo " "
5440bc8e 17718case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17719*$define*)
17720 $cat <<EOM
17721You seem to be either cross-compiling or doing a multiarchitecture build,
17722skipping the memory alignment check.
17723
17724EOM
17725 case "$alignbytes" in
17726 '') alignbytes=8 ;;
17727 esac
17728 ;;
17729*)
17730 case "$alignbytes" in
17731 '') echo "Checking alignment constraints..." >&4
17732 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17733 $cat >try.c <<'EOCP'
17734typedef long double NV;
17735EOCP
17736 else
17737 $cat >try.c <<'EOCP'
17738typedef double NV;
17739EOCP
17740 fi
17741 $cat >>try.c <<'EOCP'
17742#include <stdio.h>
17743struct foobar {
17744 char foo;
17745 NV bar;
17746} try_algn;
17747int main()
17748{
17749 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17750 return(0);
17751}
17752EOCP
17753 set try
17754 if eval $compile_ok; then
5440bc8e 17755 dflt=`$run ./try`
b4eb6b3d
JH
17756 else
17757 dflt='8'
17758 echo "(I can't seem to compile the test program...)"
17759 fi
17760 ;;
17761 *) dflt="$alignbytes"
17762 ;;
17763 esac
17764 rp="Doubles must be aligned on a how-many-byte boundary?"
17765 . ./myread
17766 alignbytes="$ans"
17767 $rm -f try.c try
17768 ;;
17769esac
17770
17771
17772: set the base revision
17773baserev=5.0
17774
3099fc99 17775: how do we concatenate cpp tokens here?
b4eb6b3d 17776echo " "
3099fc99 17777echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17778$cat >cpp_stuff.c <<'EOCP'
17779#define RCAT(a,b)a/**/b
17780#define ACAT(a,b)a ## b
17781RCAT(Rei,ser)
17782ACAT(Cir,cus)
17783EOCP
17784$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17785if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17786 echo "Oh! Smells like ANSI's been here." >&4
17787 echo "We can catify or stringify, separately or together!"
17788 cpp_stuff=42
17789elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17790 echo "Ah, yes! The good old days!" >&4
17791 echo "However, in the good old days we don't know how to stringify and"
17792 echo "catify at the same time."
17793 cpp_stuff=1
17794else
17795 $cat >&4 <<EOM
3099fc99
CW
17796Hmm, I don't seem to be able to concatenate tokens with your cpp.
17797You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17798EOM
17799 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17800fi
17801$rm -f cpp_stuff.*
17802
17803: see if this is a db.h system
17804set db.h i_db
17805eval $inhdr
17806
17807case "$i_db" in
17808$define)
17809 : Check db version.
17810 echo " "
17811 echo "Checking Berkeley DB version ..." >&4
17812 $cat >try.c <<EOCP
17813#$d_const HASCONST
17814#ifndef HASCONST
17815#define const
17816#endif
17817#include <sys/types.h>
17818#include <stdio.h>
55954f19
JH
17819#$i_stdlib I_STDLIB
17820#ifdef I_STDLIB
17821#include <stdlib.h>
17822#endif
b4eb6b3d 17823#include <db.h>
640374d0 17824int main(int argc, char *argv[])
b4eb6b3d
JH
17825{
17826#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17827 int Major, Minor, Patch ;
17828 unsigned long Version ;
17829 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17830 if (argc == 2) {
17831 printf("%d %d %d %d %d %d\n",
17832 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17833 Major, Minor, Patch);
17834 exit(0);
17835 }
17836 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17837
17838 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17839 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17840 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17841 Major, Minor, Patch) ;
17842
17843 /* check that db.h & libdb are compatible */
17844 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17845 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17846 exit(3);
17847 }
17848
640374d0 17849 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17850
17851 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17852 + DB_VERSION_PATCH ;
17853
17854 /* needs to be >= 2.3.4 */
17855 if (Version < 2003004) {
17856 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17857 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17858 exit(2);
17859 }
17860
17861 exit(0);
17862#else
17863#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17864 if (argc == 2) {
17865 printf("1 0 0\n");
17866 exit(0);
17867 }
17868 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17869 exit(0); /* DB version < 2: the coast is clear. */
17870#else
17871 exit(1); /* <db.h> not Berkeley DB? */
17872#endif
17873#endif
17874}
17875EOCP
17876 set try
5440bc8e 17877 if eval $compile_ok && $run ./try; then
b4eb6b3d 17878 echo 'Looks OK.' >&4
5440bc8e 17879 set `$run ./try 1`
640374d0
JH
17880 db_version_major=$1
17881 db_version_minor=$2
17882 db_version_patch=$3
b4eb6b3d
JH
17883 else
17884 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
17885 i_db=$undef
17886 case " $libs " in
17887 *"-ldb "*)
17888 : Remove db from list of libraries to use
17889 echo "Removing unusable -ldb from library list" >&4
17890 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17891 shift
17892 libs="$*"
17893 echo "libs = $libs" >&4
17894 ;;
17895 esac
17896 fi
17897 $rm -f try.*
17898 ;;
17899esac
17900
17901case "$i_db" in
17902define)
17903 : Check the return type needed for hash
17904 echo " "
17905 echo "Checking return type needed for hash for Berkeley DB ..." >&4
17906 $cat >try.c <<EOCP
17907#$d_const HASCONST
17908#ifndef HASCONST
17909#define const
17910#endif
17911#include <sys/types.h>
17912#include <db.h>
17913
17914#ifndef DB_VERSION_MAJOR
17915u_int32_t hash_cb (ptr, size)
17916const void *ptr;
17917size_t size;
17918{
17919}
17920HASHINFO info;
17921int main()
17922{
17923 info.hash = hash_cb;
17924}
17925#endif
17926EOCP
17927 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17928 if $contains warning try.out >>/dev/null 2>&1 ; then
17929 db_hashtype='int'
17930 else
17931 db_hashtype='u_int32_t'
17932 fi
17933 else
17934 : XXX Maybe we should just give up here.
17935 db_hashtype=u_int32_t
17936 $cat try.out >&4
17937 echo "Help: I can't seem to compile the db test program." >&4
17938 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17939 fi
17940 $rm -f try.*
17941 echo "Your version of Berkeley DB uses $db_hashtype for hash."
17942 ;;
17943*) db_hashtype=u_int32_t
17944 ;;
17945esac
17946case "$i_db" in
17947define)
17948 : Check the return type needed for prefix
17949 echo " "
17950 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17951 cat >try.c <<EOCP
17952#$d_const HASCONST
17953#ifndef HASCONST
17954#define const
17955#endif
17956#include <sys/types.h>
17957#include <db.h>
17958
17959#ifndef DB_VERSION_MAJOR
17960size_t prefix_cb (key1, key2)
17961const DBT *key1;
17962const DBT *key2;
17963{
17964}
17965BTREEINFO info;
17966int main()
17967{
17968 info.prefix = prefix_cb;
17969}
17970#endif
17971EOCP
17972 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17973 if $contains warning try.out >>/dev/null 2>&1 ; then
17974 db_prefixtype='int'
17975 else
17976 db_prefixtype='size_t'
17977 fi
17978 else
17979 db_prefixtype='size_t'
17980 : XXX Maybe we should just give up here.
17981 $cat try.out >&4
17982 echo "Help: I can't seem to compile the db test program." >&4
17983 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17984 fi
17985 $rm -f try.*
17986 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17987 ;;
17988*) db_prefixtype='size_t'
17989 ;;
17990esac
17991
b4eb6b3d
JH
17992
17993: How can we generate normalized random numbers ?
17994echo " "
17995echo "Looking for a random number function..." >&4
17996case "$randfunc" in
17997'')
17998 if set drand48 val -f; eval $csym; $val; then
17999 dflt="drand48"
18000 echo "Good, found drand48()." >&4
18001 elif set random val -f; eval $csym; $val; then
18002 dflt="random"
18003 echo "OK, found random()." >&4
18004 else
18005 dflt="rand"
18006 echo "Yick, looks like I have to use rand()." >&4
18007 fi
18008 echo " "
18009 ;;
18010*)
18011 dflt="$randfunc"
18012 ;;
18013esac
18014cont=true
18015
18016case "$ccflags" in
18017*-Dmy_rand=*|*-Dmy_srand=*)
18018 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18019 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18020 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18021 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18022 ;;
18023esac
18024
18025while $test "$cont"; do
18026 rp="Use which function to generate random numbers?"
18027 . ./myread
18028 if $test "$ans" = "$dflt"; then
18029 : null
18030 else
18031 randbits=''
18032 fi
18033 randfunc="$ans"
18034 if set $ans val -f; eval $csym; $val; then
18035 cont=''
18036 else
18037 dflt=y
18038 rp="I cannot find function $ans. Use that name anyway?"
18039 . ./myread
18040 dflt=rand
18041 case "$ans" in
18042 [yY]*) cont='';;
18043 esac
18044 fi
18045 case "$cont" in
18046 '')
18047 case "$randfunc" in
18048 drand48)
18049 drand01="drand48()"
18050 seedfunc="srand48"
18051 randbits=48
18052 randseedtype=long
18053 ;;
18054 rand|random)
18055 case "$randbits" in
18056 '')
18057echo "Checking to see how many bits your $randfunc() function produces..." >&4
18058 $cat >try.c <<EOCP
18059#$i_unistd I_UNISTD
18060#$i_stdlib I_STDLIB
18061#include <stdio.h>
18062#ifdef I_UNISTD
18063# include <unistd.h>
18064#endif
18065#ifdef I_STDLIB
18066# include <stdlib.h>
18067#endif
18068int main()
18069{
18070 register int i;
18071 register unsigned long tmp;
18072 register unsigned long max = 0L;
18073
18074 for (i = 1000; i; i--) {
18075 tmp = (unsigned long) $randfunc();
18076 if (tmp > max) max = tmp;
18077 }
18078 for (i = 0; max; i++)
18079 max /= 2;
18080 printf("%d\n",i);
18081}
18082EOCP
18083 set try
18084 if eval $compile_ok; then
18085 dflt=`try`
18086 else
18087 dflt='?'
18088 echo "(I can't seem to compile the test program...)"
18089 fi
18090 ;;
18091 *)
18092 dflt="$randbits"
18093 ;;
18094 esac
18095 rp="How many bits does your $randfunc() function produce?"
18096 . ./myread
18097 randbits="$ans"
18098 $rm -f try.c try
18099 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18100 seedfunc="s$randfunc"
18101 randseedtype=unsigned
18102 ;;
18103 *)
18104 dflt="31"
18105 rp="How many bits does your $randfunc() function produce?"
18106 . ./myread
18107 randbits="$ans"
18108 seedfunc="s$randfunc"
18109 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18110 if set $seedfunc val -f; eval $csym; $val; then
18111 echo "(Using $seedfunc() to seed random generator)"
18112 else
18113 echo "(Warning: no $seedfunc() to seed random generator)"
18114 seedfunc=rand
18115 fi
18116 randseedtype=unsigned
18117 ;;
18118 esac
18119 ;;
18120 esac
18121done
18122
18123echo " "
18124echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18125$cat >try.c <<'EOM'
b4eb6b3d
JH
18126int main()
18127{
18128 if ('M'==0xd4) return 0;
18129 return 1;
18130}
18131EOM
18132
18133val=$undef
5440bc8e 18134set try
b4eb6b3d 18135if eval $compile_ok; then
5440bc8e 18136 if $run ./try; then
b4eb6b3d
JH
18137 echo "You seem to speak EBCDIC." >&4
18138 val="$define"
18139 else
5440bc8e 18140 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18141 fi
18142else
18143 echo "I'm unable to compile the test program." >&4
18144 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18145fi
5440bc8e 18146$rm -f try try.*
b4eb6b3d
JH
18147set ebcdic
18148eval $setvar
18149
18150echo " "
18151$cat >&4 <<EOM
18152Checking how to flush all pending stdio output...
18153EOM
18154# I only know how to find the first 32 possibly open files on SunOS.
18155# See also hints/sunos_4_1.sh and util.c --AD
18156case "$osname" in
18157sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18158esac
18159$cat >>try.c <<EOCP
18160#include <stdio.h>
55954f19
JH
18161#$i_stdlib I_STDLIB
18162#ifdef I_STDLIB
18163#include <stdlib.h>
18164#endif
b4eb6b3d
JH
18165#$i_unistd I_UNISTD
18166#ifdef I_UNISTD
18167# include <unistd.h>
18168#endif
18169#$d_sysconf HAS_SYSCONF
18170#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18171#ifdef HAS_STDIO_STREAM_ARRAY
18172# define STDIO_STREAM_ARRAY $stdio_stream_array
18173#endif
18174int main() {
5440bc8e
JH
18175 FILE* p;
18176 unlink("try.out");
18177 p = fopen("try.out", "w");
b4eb6b3d
JH
18178#ifdef TRY_FPUTC
18179 fputc('x', p);
18180#else
18181# ifdef TRY_FPRINTF
18182 fprintf(p, "x");
18183# endif
18184#endif
18185#ifdef TRY_FFLUSH_NULL
18186 fflush(NULL);
18187#endif
18188#ifdef TRY_FFLUSH_ALL
18189 {
18190 long open_max = -1;
18191# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18192 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18193# else
18194# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18195 open_max = sysconf(_SC_OPEN_MAX);
18196# else
18197# ifdef FOPEN_MAX
18198 open_max = FOPEN_MAX;
18199# else
18200# ifdef OPEN_MAX
18201 open_max = OPEN_MAX;
18202# else
18203# ifdef _NFILE
18204 open_max = _NFILE;
18205# endif
18206# endif
18207# endif
18208# endif
18209# endif
18210# ifdef HAS_STDIO_STREAM_ARRAY
18211 if (open_max > 0) {
18212 long i;
18213 for (i = 0; i < open_max; i++)
18214 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18215 STDIO_STREAM_ARRAY[i]._file < open_max &&
18216 STDIO_STREAM_ARRAY[i]._flag)
18217 fflush(&STDIO_STREAM_ARRAY[i]);
18218 }
18219 }
18220# endif
18221#endif
18222 _exit(42);
18223}
18224EOCP
18225: first we have to find out how _not_ to flush
5440bc8e 18226$to try.c
b4eb6b3d
JH
18227if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18228 output=''
18229 set try -DTRY_FPUTC
18230 if eval $compile; then
fbe73d74 18231 $run ./try 2>/dev/null
28f5ac64 18232 code="$?"
5440bc8e 18233 $from try.out
28f5ac64 18234 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18235 output=-DTRY_FPUTC
18236 fi
18237 fi
18238 case "$output" in
18239 '')
18240 set try -DTRY_FPRINTF
b4eb6b3d 18241 if eval $compile; then
fbe73d74 18242 $run ./try 2>/dev/null
28f5ac64 18243 code="$?"
5440bc8e 18244 $from try.out
28f5ac64 18245 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18246 output=-DTRY_FPRINTF
18247 fi
18248 fi
18249 ;;
18250 esac
18251fi
18252: check for fflush NULL behaviour
18253case "$fflushNULL" in
18254'') set try -DTRY_FFLUSH_NULL $output
18255 if eval $compile; then
5440bc8e 18256 $run ./try 2>/dev/null
b4eb6b3d 18257 code="$?"
5440bc8e 18258 $from try.out
b4eb6b3d
JH
18259 if $test -s try.out -a "X$code" = X42; then
18260 fflushNULL="`$cat try.out`"
18261 else
18262 if $test "X$code" != X42; then
18263 $cat >&4 <<EOM
18264(If this test failed, don't worry, we'll try another method shortly.)
18265EOM
18266 fi
18267 fi
18268 fi
18269 $rm -f core try.core core.try.*
18270 case "$fflushNULL" in
18271 x) $cat >&4 <<EOM
18272Your fflush(NULL) works okay for output streams.
18273Let's see if it clobbers input pipes...
18274EOM
18275# As of mid-March 2000 all versions of Solaris appear to have a stdio
18276# bug that improperly flushes the input end of pipes. So we avoid the
18277# autoflush on fork/system/exec support for now. :-(
18278$cat >tryp.c <<EOCP
18279#include <stdio.h>
18280int
18281main(int argc, char **argv)
18282{
18283 char buf[1024];
18284 int i;
18285 char *bp = buf;
18286 while (1) {
18287 while ((i = getc(stdin)) != -1
18288 && (*bp++ = i) != '\n'
18289 && bp < &buf[1024])
18290 /* DO NOTHING */ ;
18291 *bp = '\0';
18292 fprintf(stdout, "%s", buf);
18293 fflush(NULL);
18294 if (i == -1)
18295 return 0;
18296 bp = buf;
18297 }
18298}
18299EOCP
18300 fflushNULL="$define"
18301 set tryp
18302 if eval $compile; then
18303 $rm -f tryp.out
5440bc8e 18304 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18305 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18306 $cat >&4 <<EOM
18307fflush(NULL) seems to behave okay with input streams.
18308EOM
18309 fflushNULL="$define"
18310 else
18311 $cat >&4 <<EOM
18312Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18313EOM
18314 fflushNULL="$undef"
18315 fi
18316 fi
18317 $rm -f core tryp.c tryp.core core.tryp.*
18318 ;;
18319 '') $cat >&4 <<EOM
18320Your fflush(NULL) isn't working (contrary to ANSI C).
18321EOM
18322 fflushNULL="$undef"
18323 ;;
18324 *) $cat >&4 <<EOM
18325Cannot figure out whether your fflush(NULL) works or not.
18326I'm assuming it doesn't (contrary to ANSI C).
18327EOM
18328 fflushNULL="$undef"
18329 ;;
18330 esac
18331 ;;
18332$define|true|[yY]*)
18333 fflushNULL="$define"
18334 ;;
18335*)
18336 fflushNULL="$undef"
18337 ;;
18338esac
18339: check explicit looping only if NULL did not work, and if the pipe
18340: bug does not show up on an explicit flush too
18341case "$fflushNULL" in
18342"$undef")
18343 $cat >tryp.c <<EOCP
18344#include <stdio.h>
18345int
18346main(int argc, char **argv)
18347{
18348 char buf[1024];
18349 int i;
18350 char *bp = buf;
18351 while (1) {
18352 while ((i = getc(stdin)) != -1
18353 && (*bp++ = i) != '\n'
18354 && bp < &buf[1024])
18355 /* DO NOTHING */ ;
18356 *bp = '\0';
18357 fprintf(stdout, "%s", buf);
18358 fflush(stdin);
18359 if (i == -1)
18360 return 0;
18361 bp = buf;
18362 }
18363}
18364EOCP
18365 set tryp
18366 if eval $compile; then
18367 $rm -f tryp.out
5440bc8e 18368 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18369 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18370 $cat >&4 <<EOM
18371Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18372EOM
18373 : now check for fflushall behaviour
18374 case "$fflushall" in
18375 '') set try -DTRY_FFLUSH_ALL $output
18376 if eval $compile; then
18377 $cat >&4 <<EOM
18378(Now testing the other method--but note that this also may fail.)
18379EOM
5440bc8e 18380 $run ./try 2>/dev/null
28f5ac64 18381 code=$?
fbe73d74 18382 $from try.out
28f5ac64 18383 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18384 fflushall="`$cat try.out`"
18385 fi
18386 fi
18387 $rm -f core try.core core.try.*
18388 case "$fflushall" in
18389 x) $cat >&4 <<EOM
18390Whew. Flushing explicitly all the stdio streams works.
18391EOM
18392 fflushall="$define"
18393 ;;
18394 '') $cat >&4 <<EOM
18395Sigh. Flushing explicitly all the stdio streams doesn't work.
18396EOM
18397 fflushall="$undef"
18398 ;;
18399 *) $cat >&4 <<EOM
18400Cannot figure out whether flushing stdio streams explicitly works or not.
18401I'm assuming it doesn't.
18402EOM
18403 fflushall="$undef"
18404 ;;
18405 esac
18406 ;;
18407 "$define"|true|[yY]*)
18408 fflushall="$define"
18409 ;;
18410 *)
18411 fflushall="$undef"
18412 ;;
18413 esac
18414 else
18415 $cat >&4 <<EOM
18416All is futile. Even fflush(stdin) clobbers input pipes!
18417EOM
18418 fflushall="$undef"
18419 fi
18420 else
18421 fflushall="$undef"
18422 fi
18423 $rm -f core tryp.c tryp.core core.tryp.*
18424 ;;
18425*) fflushall="$undef"
18426 ;;
18427esac
18428
18429case "$fflushNULL$fflushall" in
18430undefundef)
18431 $cat <<EOM
18432OK, I give up. I cannot figure out how to flush pending stdio output.
18433We won't be flushing handles at all before fork/exec/popen.
18434EOM
18435 ;;
18436esac
18437$rm -f try.* try$exe_ext
18438
18439: Store the full pathname to the ar program for use in the C program
18440: Respect a hint or command line value for full_ar.
18441case "$full_ar" in
18442'') full_ar=$ar ;;
18443esac
18444
18445: Store the full pathname to the sed program for use in the C program
18446full_sed=$sed
18447
18448: see what type gids are declared as in the kernel
18449echo " "
18450echo "Looking for the type for group ids returned by getgid()."
18451set gid_t gidtype xxx stdio.h sys/types.h
18452eval $typedef
18453case "$gidtype" in
18454xxx)
18455 xxx=`./findhdr sys/user.h`
18456 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18457 case $1 in
18458 unsigned) dflt="$1 $2" ;;
18459 *) dflt="$1" ;;
18460 esac
18461 ;;
18462*) dflt="$gidtype";;
18463esac
18464case "$gidtype" in
18465gid_t) echo "gid_t found." ;;
18466*) rp="What is the type for group ids returned by getgid()?"
18467 . ./myread
18468 gidtype="$ans"
18469 ;;
18470esac
18471
18472echo " "
18473case "$gidtype" in
18474*_t) zzz="$gidtype" ;;
18475*) zzz="gid" ;;
18476esac
18477echo "Checking the size of $zzz..." >&4
18478cat > try.c <<EOCP
18479#include <sys/types.h>
18480#include <stdio.h>
d1daaddf
JH
18481#$i_stdlib I_STDLIB
18482#ifdef I_STDLIB
18483#include <stdlib.h>
18484#endif
b4eb6b3d
JH
18485int main() {
18486 printf("%d\n", (int)sizeof($gidtype));
18487 exit(0);
18488}
18489EOCP
18490set try
18491if eval $compile_ok; then
5440bc8e 18492 yyy=`$run ./try`
b4eb6b3d
JH
18493 case "$yyy" in
18494 '') gidsize=4
18495 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18496 ;;
18497 *) gidsize=$yyy
18498 echo "Your $zzz is $gidsize bytes long."
18499 ;;
18500 esac
18501else
18502 gidsize=4
18503 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18504fi
18505
18506
18507echo " "
18508case "$gidtype" in
18509*_t) zzz="$gidtype" ;;
18510*) zzz="gid" ;;
18511esac
18512echo "Checking the sign of $zzz..." >&4
18513cat > try.c <<EOCP
18514#include <sys/types.h>
18515#include <stdio.h>
18516int main() {
18517 $gidtype foo = -1;
18518 if (foo < 0)
18519 printf("-1\n");
18520 else
18521 printf("1\n");
18522}
18523EOCP
18524set try
18525if eval $compile; then
5440bc8e 18526 yyy=`$run ./try`
b4eb6b3d
JH
18527 case "$yyy" in
18528 '') gidsign=1
18529 echo "(I can't execute the test program--guessing unsigned.)" >&4
18530 ;;
18531 *) gidsign=$yyy
18532 case "$gidsign" in
18533 1) echo "Your $zzz is unsigned." ;;
18534 -1) echo "Your $zzz is signed." ;;
18535 esac
18536 ;;
18537 esac
18538else
18539 gidsign=1
18540 echo "(I can't compile the test program--guessing unsigned.)" >&4
18541fi
18542
18543
18544echo " "
18545
18546if $test X"$quadtype" != X; then
18547
18548echo "Checking how to print 64-bit integers..." >&4
18549
18550if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18551 $cat >try.c <<'EOCP'
18552#include <sys/types.h>
18553#include <stdio.h>
18554int main() {
18555 int q = 12345678901;
18556 printf("%ld\n", q);
18557}
18558EOCP
18559 set try
18560 if eval $compile; then
5440bc8e 18561 yyy=`$run ./try`
b4eb6b3d
JH
18562 case "$yyy" in
18563 12345678901)
18564 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18565 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18566 echo "We will use %d."
18567 ;;
18568 esac
18569 fi
18570fi
18571
18572if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18573 $cat >try.c <<'EOCP'
18574#include <sys/types.h>
18575#include <stdio.h>
18576int main() {
18577 long q = 12345678901;
18578 printf("%ld\n", q);
18579}
18580EOCP
18581 set try
18582 if eval $compile; then
5440bc8e 18583 yyy=`$run ./try`
b4eb6b3d
JH
18584 case "$yyy" in
18585 12345678901)
18586 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18587 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18588 echo "We will use %ld."
18589 ;;
18590 esac
18591 fi
18592fi
18593
18594if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18595 $cat >try.c <<'EOCP'
18596#include <sys/types.h>
18597#include <inttypes.h>
18598#include <stdio.h>
18599int main() {
18600 int64_t q = 12345678901;
18601 printf("%" PRId64 "\n", q);
18602}
18603EOCP
18604 set try
18605 if eval $compile; then
5440bc8e 18606 yyy=`$run ./try`
b4eb6b3d
JH
18607 case "$yyy" in
18608 12345678901)
18609 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18610 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18611 echo "We will use the C9X style."
18612 ;;
18613 esac
18614 fi
18615fi
18616
2ef53570
JH
18617if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18618 $cat >try.c <<EOCP
b4eb6b3d
JH
18619#include <sys/types.h>
18620#include <stdio.h>
18621int main() {
2ef53570
JH
18622 $quadtype q = 12345678901;
18623 printf("%Ld\n", q);
b4eb6b3d
JH
18624}
18625EOCP
18626 set try
18627 if eval $compile; then
5440bc8e 18628 yyy=`$run ./try`
b4eb6b3d
JH
18629 case "$yyy" in
18630 12345678901)
2ef53570
JH
18631 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18632 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18633 echo "We will use %Ld."
b4eb6b3d
JH
18634 ;;
18635 esac
18636 fi
18637fi
18638
2ef53570
JH
18639if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18640 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18641#include <sys/types.h>
18642#include <stdio.h>
18643int main() {
2ef53570
JH
18644 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18645 printf("%lld\n", q);
b4eb6b3d
JH
18646}
18647EOCP
18648 set try
18649 if eval $compile; then
5440bc8e 18650 yyy=`$run ./try`
b4eb6b3d
JH
18651 case "$yyy" in
18652 12345678901)
2ef53570
JH
18653 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18654 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18655 echo "We will use the %lld style."
b4eb6b3d
JH
18656 ;;
18657 esac
18658 fi
18659fi
18660
18661if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18662 $cat >try.c <<EOCP
18663#include <sys/types.h>
18664#include <stdio.h>
18665int main() {
18666 $quadtype q = 12345678901;
18667 printf("%qd\n", q);
18668}
18669EOCP
18670 set try
18671 if eval $compile; then
5440bc8e 18672 yyy=`$run ./try`
b4eb6b3d
JH
18673 case "$yyy" in
18674 12345678901)
18675 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18676 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18677 echo "We will use %qd."
18678 ;;
18679 esac
18680 fi
18681fi
18682
18683if $test X"$sPRId64" = X; then
18684 echo "Cannot figure out how to print 64-bit integers." >&4
18685fi
18686
18687$rm -f try try.*
18688
18689fi
18690
18691case "$sPRId64" in
18692'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18693 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18694 ;;
18695*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18696 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18697 ;;
18698esac
18699
18700
18701echo " "
18702$echo "Checking the format strings to be used for Perl's internal types..." >&4
18703
18704if $test X"$ivsize" = X8; then
18705 ivdformat="$sPRId64"
18706 uvuformat="$sPRIu64"
18707 uvoformat="$sPRIo64"
18708 uvxformat="$sPRIx64"
18709 uvXUformat="$sPRIXU64"
18710else
18711 if $test X"$ivsize" = X"$longsize"; then
18712 ivdformat='"ld"'
18713 uvuformat='"lu"'
18714 uvoformat='"lo"'
18715 uvxformat='"lx"'
18716 uvXUformat='"lX"'
18717 else
18718 if $test X"$ivsize" = X"$intsize"; then
18719 ivdformat='"d"'
18720 uvuformat='"u"'
18721 uvoformat='"o"'
18722 uvxformat='"x"'
18723 uvXUformat='"X"'
18724 else
18725 : far out
18726 if $test X"$ivsize" = X"$shortsize"; then
18727 ivdformat='"hd"'
18728 uvuformat='"hu"'
18729 uvoformat='"ho"'
18730 uvxformat='"hx"'
18731 uvXUformat='"hX"'
18732 fi
18733 fi
18734 fi
18735fi
18736
18737if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18738 nveformat="$sPRIeldbl"
18739 nvfformat="$sPRIfldbl"
18740 nvgformat="$sPRIgldbl"
18741 nvEUformat="$sPRIEUldbl"
18742 nvFUformat="$sPRIFUldbl"
18743 nvGUformat="$sPRIGUldbl"
18744else
18745 nveformat='"e"'
18746 nvfformat='"f"'
18747 nvgformat='"g"'
18748 nvEUformat='"E"'
18749 nvFUformat='"F"'
18750 nvGUformat='"G"'
18751fi
18752
18753case "$ivdformat" in
3c728e00 18754'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18755 exit 1
18756 ;;
18757esac
18758
18759
18760echo " "
18761$echo "Checking the format string to be used for gids..." >&4
18762
18763case "$gidsign" in
18764-1) if $test X"$gidsize" = X"$ivsize"; then
18765 gidformat="$ivdformat"
18766 else
18767 if $test X"$gidsize" = X"$longsize"; then
18768 gidformat='"ld"'
18769 else
18770 if $test X"$gidsize" = X"$intsize"; then
18771 gidformat='"d"'
18772 else
18773 if $test X"$gidsize" = X"$shortsize"; then
18774 gidformat='"hd"'
18775 fi
18776 fi
18777 fi
18778 fi
18779 ;;
18780*) if $test X"$gidsize" = X"$uvsize"; then
18781 gidformat="$uvuformat"
18782 else
18783 if $test X"$gidsize" = X"$longsize"; then
18784 gidformat='"lu"'
18785 else
18786 if $test X"$gidsize" = X"$intsize"; then
18787 gidformat='"u"'
18788 else
18789 if $test X"$gidsize" = X"$shortsize"; then
18790 gidformat='"hu"'
18791 fi
18792 fi
18793 fi
18794 fi
18795 ;;
18796esac
18797
18798: see if getgroups exists
18799set getgroups d_getgrps
18800eval $inlibc
18801
18802: see if setgroups exists
18803set setgroups d_setgrps
18804eval $inlibc
18805
18806
18807: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18808echo " "
18809case "$d_getgrps$d_setgrps" in
18810*define*)
18811 case "$groupstype" in
18812 '') dflt="$gidtype" ;;
18813 *) dflt="$groupstype" ;;
18814 esac
18815 $cat <<EOM
18816What type of pointer is the second argument to getgroups() and setgroups()?
18817Usually this is the same as group ids, $gidtype, but not always.
18818
18819EOM
18820 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18821 . ./myread
18822 groupstype="$ans"
18823 ;;
18824*) groupstype="$gidtype";;
18825esac
18826
18827echo " "
18828echo "Checking if your $make program sets \$(MAKE)..." >&4
18829case "$make_set_make" in
18830'')
18831 $sed 's/^X //' > testmake.mak << 'EOF'
18832Xall:
18833X @echo 'maketemp="$(MAKE)"'
18834EOF
18835 case "`$make -f testmake.mak 2>/dev/null`" in
18836 *maketemp=*) make_set_make='#' ;;
18837 *) make_set_make="MAKE=$make" ;;
18838 esac
18839 $rm -f testmake.mak
18840 ;;
18841esac
18842case "$make_set_make" in
18843'#') echo "Yup, it does.";;
18844*) echo "Nope, it doesn't.";;
18845esac
18846
18847: see what type is used for mode_t
18848rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18849set mode_t modetype int stdio.h sys/types.h
18850eval $typedef_ask
18851
2cc61e15
DD
18852: see if stdarg is available
18853echo " "
18854if $test `./findhdr stdarg.h`; then
18855 echo "<stdarg.h> found." >&4
18856 valstd="$define"
18857else
18858 echo "<stdarg.h> NOT found." >&4
18859 valstd="$undef"
18860fi
18861
18862: see if varags is available
18863echo " "
18864if $test `./findhdr varargs.h`; then
18865 echo "<varargs.h> found." >&4
18866else
18867 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18868fi
18869
18870: set up the varargs testing programs
18871$cat > varargs.c <<EOP
18872#ifdef I_STDARG
18873#include <stdarg.h>
18874#endif
18875#ifdef I_VARARGS
18876#include <varargs.h>
18877#endif
18878
18879#ifdef I_STDARG
18880int f(char *p, ...)
18881#else
18882int f(va_alist)
18883va_dcl
18884#endif
18885{
18886 va_list ap;
18887#ifndef I_STDARG
18888 char *p;
18889#endif
18890#ifdef I_STDARG
18891 va_start(ap,p);
18892#else
18893 va_start(ap);
18894 p = va_arg(ap, char *);
18895#endif
18896 va_end(ap);
18897}
18898EOP
18899$cat > varargs <<EOP
18900$startsh
18901if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18902 echo "true"
18903else
18904 echo "false"
18905fi
18906$rm -f varargs$_o
18907EOP
18908chmod +x varargs
18909
18910: now check which varargs header should be included
18911echo " "
18912i_varhdr=''
18913case "$valstd" in
18914"$define")
18915 if `./varargs I_STDARG`; then
18916 val='stdarg.h'
18917 elif `./varargs I_VARARGS`; then
18918 val='varargs.h'
18919 fi
18920 ;;
18921*)
18922 if `./varargs I_VARARGS`; then
18923 val='varargs.h'
18924 fi
18925 ;;
18926esac
18927case "$val" in
18928'')
18929echo "I could not find the definition for va_dcl... You have problems..." >&4
18930 val="$undef"; set i_stdarg; eval $setvar
18931 val="$undef"; set i_varargs; eval $setvar
18932 ;;
18933*)
18934 set i_varhdr
18935 eval $setvar
18936 case "$i_varhdr" in
18937 stdarg.h)
18938 val="$define"; set i_stdarg; eval $setvar
18939 val="$undef"; set i_varargs; eval $setvar
18940 ;;
18941 varargs.h)
18942 val="$undef"; set i_stdarg; eval $setvar
18943 val="$define"; set i_varargs; eval $setvar
18944 ;;
18945 esac
18946 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18947esac
18948$rm -f varargs*
18949
18950: see if we need va_copy
18951echo " "
18952case "$i_stdarg" in
18953"$define")
18954 $cat >try.c <<EOCP
18955#include <stdarg.h>
18956#include <stdio.h>
85c8a686
DD
18957#$i_stdlib I_STDLIB
18958#ifdef I_STDLIB
18959#include <stdlib.h>
18960#endif
18961#include <signal.h>
2cc61e15
DD
18962
18963int
18964ivfprintf(FILE *f, const char *fmt, va_list *valp)
18965{
18966 return vfprintf(f, fmt, *valp);
18967}
18968
18969int
18970myvfprintf(FILE *f, const char *fmt, va_list val)
18971{
18972 return ivfprintf(f, fmt, &val);
18973}
18974
18975int
18976myprintf(char *fmt, ...)
18977{
18978 va_list val;
18979 va_start(val, fmt);
18980 return myvfprintf(stdout, fmt, val);
18981}
18982
18983int
18984main(int ac, char **av)
18985{
85c8a686
DD
18986 signal(SIGSEGV, exit);
18987
2cc61e15
DD
18988 myprintf("%s%cs all right, then\n", "that", '\'');
18989 exit(0);
18990}
18991EOCP
18992 set try
5440bc8e
JH
18993 if eval $compile && $run ./try 2>&1 >/dev/null; then
18994 case "`$run ./try`" in
2cc61e15
DD
18995 "that's all right, then")
18996 okay=yes
18997 ;;
18998 esac
18999 fi
19000 case "$okay" in
19001 yes) echo "It seems that you don't need va_copy()." >&4
19002 need_va_copy="$undef"
19003 ;;
19004 *) echo "It seems that va_copy() or similar will be needed." >&4
19005 need_va_copy="$define"
19006 ;;
19007 esac
19008 $rm -f try.* core core.* *.core *.core.*
19009 ;;
19010*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19011 ;;
19012esac
19013
b4eb6b3d
JH
19014: see what type is used for size_t
19015rp="What is the type used for the length parameter for string functions?"
19016set size_t sizetype 'unsigned int' stdio.h sys/types.h
19017eval $typedef_ask
19018
19019: check for type of arguments to gethostbyaddr.
19020if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19021 case "$d_gethbyaddr" in
19022 $define)
19023 $cat <<EOM
19024
19025Checking to see what type of arguments are accepted by gethostbyaddr().
19026EOM
19027 hdrs="$define sys/types.h
19028 $d_socket sys/socket.h
19029 $i_niin netinet/in.h
19030 $i_netdb netdb.h
19031 $i_unistd unistd.h"
19032 : The first arg can 'char *' or 'void *'
19033 : The second arg is some of integral type
19034 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19035 for yyy in size_t long int; do
19036 case "$netdb_host_type" in
19037 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19038 if ./protochk "$try" $hdrs; then
19039 echo "Your system accepts $xxx for the first arg."
19040 echo "...and $yyy for the second arg."
19041 netdb_host_type="$xxx"
19042 netdb_hlen_type="$yyy"
19043 fi
19044 ;;
19045 esac
19046 done
19047 done
19048 : In case none of those worked, prompt the user.
19049 case "$netdb_host_type" in
19050 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19051 dflt='char *'
19052 . ./myread
19053 netdb_host_type=$ans
19054 rp='What is the type for the 2nd argument to gethostbyaddr?'
19055 dflt="$sizetype"
19056 . ./myread
19057 netdb_hlen_type=$ans
19058 ;;
19059 esac
19060 ;;
19061 *) : no gethostbyaddr, so pick harmless defaults
19062 netdb_host_type='char *'
19063 netdb_hlen_type="$sizetype"
19064 ;;
19065 esac
19066 # Remove the "const" if needed. -- but then we'll have a
19067 # prototype clash!
19068 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19069fi
19070
19071: check for type of argument to gethostbyname.
19072if test "X$netdb_name_type" = X ; then
19073 case "$d_gethbyname" in
19074 $define)
19075 $cat <<EOM
19076
19077Checking to see what type of argument is accepted by gethostbyname().
19078EOM
19079 hdrs="$define sys/types.h
19080 $d_socket sys/socket.h
19081 $i_niin netinet/in.h
19082 $i_netdb netdb.h
19083 $i_unistd unistd.h"
19084 for xxx in "const char *" "char *"; do
19085 case "$netdb_name_type" in
19086 '') try="extern struct hostent *gethostbyname($xxx);"
19087 if ./protochk "$try" $hdrs; then
19088 echo "Your system accepts $xxx."
19089 netdb_name_type="$xxx"
19090 fi
19091 ;;
19092 esac
19093 done
19094 : In case none of those worked, prompt the user.
19095 case "$netdb_name_type" in
19096 '') rp='What is the type for the 1st argument to gethostbyname?'
19097 dflt='char *'
19098 . ./myread
19099 netdb_name_type=$ans
19100 ;;
19101 esac
19102 ;;
19103 *) : no gethostbyname, so pick harmless default
19104 netdb_name_type='char *'
19105 ;;
19106 esac
19107fi
19108
19109: check for type of 1st argument to getnetbyaddr.
19110if test "X$netdb_net_type" = X ; then
19111 case "$d_getnbyaddr" in
19112 $define)
19113 $cat <<EOM
19114
19115Checking to see what type of 1st argument is accepted by getnetbyaddr().
19116EOM
19117 hdrs="$define sys/types.h
19118 $d_socket sys/socket.h
19119 $i_niin netinet/in.h
19120 $i_netdb netdb.h
19121 $i_unistd unistd.h"
19122 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19123 case "$netdb_net_type" in
19124 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19125 if ./protochk "$try" $hdrs; then
19126 echo "Your system accepts $xxx."
19127 netdb_net_type="$xxx"
19128 fi
19129 ;;
19130 esac
19131 done
19132 : In case none of those worked, prompt the user.
19133 case "$netdb_net_type" in
19134 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19135 dflt='long'
19136 . ./myread
19137 netdb_net_type=$ans
19138 ;;
19139 esac
19140 ;;
19141 *) : no getnetbyaddr, so pick harmless default
19142 netdb_net_type='long'
19143 ;;
19144 esac
19145fi
19146: locate the preferred pager for this system
d604bb53 19147fn=f/
b4eb6b3d
JH
19148case "$pager" in
19149'')
19150 dflt=''
19151 case "$pg" in
19152 /*) dflt=$pg;;
19153 [a-zA-Z]:/*) dflt=$pg;;
19154 esac
19155 case "$more" in
19156 /*) dflt=$more;;
19157 [a-zA-Z]:/*) dflt=$more;;
19158 esac
19159 case "$less" in
19160 /*) dflt=$less;;
19161 [a-zA-Z]:/*) dflt=$less;;
19162 esac
19163 case "$dflt" in
19164 '') dflt=/usr/ucb/more;;
19165 esac
19166 ;;
d604bb53
JH
19167*) dflt="$pager"
19168 : Instruct ./getfile to trust the hinted or previous pager value,
19169 : even if it does not begin with a slash. For example, on os2,
19170 : pager might be cmd /c more. See comments in UU/getfile.
19171 fn="f/($pager)"
19172 ;;
b4eb6b3d
JH
19173esac
19174echo " "
b4eb6b3d
JH
19175rp='What pager is used on your system?'
19176. ./getfile
19177pager="$ans"
19178
19179: see what type pids are declared as in the kernel
19180rp="What is the type of process ids on this system?"
19181set pid_t pidtype int stdio.h sys/types.h
19182eval $typedef_ask
19183
b4eb6b3d
JH
19184: see if ar generates random libraries by itself
19185echo " "
19186echo "Checking how to generate random libraries on your machine..." >&4
19187echo 'int bar1() { return bar2(); }' > bar1.c
19188echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19189$cat > foo.c <<EOP
19190#$i_stdlib I_STDLIB
19191#ifdef I_STDLIB
19192#include <stdlib.h>
19193#endif
b4eb6b3d
JH
19194int main() { printf("%d\n", bar1()); exit(0); }
19195EOP
19196$cc $ccflags -c bar1.c >/dev/null 2>&1
19197$cc $ccflags -c bar2.c >/dev/null 2>&1
19198$cc $ccflags -c foo.c >/dev/null 2>&1
19199$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19200if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19201 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19202 echo "$ar appears to generate random libraries itself."
19203 orderlib=false
e39a9d84
LC
19204 if [ "X$ranlib" = "X" ]; then
19205 ranlib=":"
19206 fi
b4eb6b3d 19207elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19208 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19209 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19210 echo "a table of contents needs to be added with '$ar ts'."
19211 orderlib=false
19212 ranlib="$ar ts"
19213else
19214 case "$ranlib" in
19215 :) ranlib='';;
19216 '')
19217 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19218 $test -f $ranlib || ranlib=''
19219 ;;
19220 esac
19221 if $test -n "$ranlib"; then
19222 echo "your system has '$ranlib'; we'll use that."
19223 orderlib=false
19224 else
19225 echo "your system doesn't seem to support random libraries"
19226 echo "so we'll use lorder and tsort to order the libraries."
19227 orderlib=true
19228 ranlib=":"
19229 fi
19230fi
19231$rm -f foo* bar*
19232
19233: check for type of arguments to select.
19234case "$selecttype" in
19235'') case "$d_select" in
19236 $define)
19237 echo " "
19238 $cat <<EOM
19239Checking to see what type of arguments are accepted by select().
19240EOM
19241 hdrs="$define sys/types.h
19242 $i_systime sys/time.h
19243 $i_sysselct sys/select.h
19244 $d_socket sys/socket.h"
19245 : The first arg can be int, unsigned, or size_t
19246 : The last arg may or may not be 'const'
19247 val=''
19248 : void pointer has been seen but using that
19249 : breaks the selectminbits test
19250 for xxx in 'fd_set *' 'int *'; do
19251 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19252 for tmo in 'struct timeval *' 'const struct timeval *'; do
19253 case "$val" in
19254 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19255 if ./protochk "$try" $hdrs; then
19256 echo "Your system accepts $xxx."
19257 val="$xxx"
19258 fi
19259 ;;
19260 esac
19261 done
19262 done
19263 done
19264 case "$val" in
19265 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19266 case "$d_fd_set" in
19267 $define) dflt="fd_set *" ;;
19268 *) dflt="int *" ;;
19269 esac
19270 . ./myread
19271 val=$ans
19272 ;;
19273 esac
19274 selecttype="$val"
19275 ;;
19276 *) : no select, so pick a harmless default
19277 selecttype='int *'
19278 ;;
19279 esac
19280 ;;
19281esac
19282
19283: check for the select 'width'
19284case "$selectminbits" in
e6e7e605
JH
19285'') safebits=`expr $ptrsize \* 8`
19286 case "$d_select" in
b4eb6b3d
JH
19287 $define)
19288 $cat <<EOM
19289
19290Checking to see on how many bits at a time your select() operates...
19291EOM
19292 $cat >try.c <<EOCP
19293#include <sys/types.h>
19294#$i_time I_TIME
19295#$i_systime I_SYS_TIME
19296#$i_systimek I_SYS_TIME_KERNEL
19297#ifdef I_TIME
19298# include <time.h>
19299#endif
19300#ifdef I_SYS_TIME
19301# ifdef I_SYS_TIME_KERNEL
19302# define KERNEL
19303# endif
19304# include <sys/time.h>
19305# ifdef I_SYS_TIME_KERNEL
19306# undef KERNEL
19307# endif
19308#endif
19309#$i_sysselct I_SYS_SELECT
19310#ifdef I_SYS_SELECT
19311#include <sys/select.h>
19312#endif
19313#$d_socket HAS_SOCKET
19314#ifdef HAS_SOCKET
19315# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19316#endif
19317#include <stdio.h>
d1daaddf
JH
19318#$i_stdlib I_STDLIB
19319#ifdef I_STDLIB
19320#include <stdlib.h>
19321#endif
b4eb6b3d
JH
19322$selecttype b;
19323#define S sizeof(*(b))
19324#define MINBITS 64
19325#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19326#define NBITS (NBYTES * 8)
19327int main() {
e6e7e605 19328 char *s = malloc(NBYTES);
b4eb6b3d
JH
19329 struct timeval t;
19330 int i;
19331 FILE* fp;
19332 int fd;
19333
e6e7e605
JH
19334 if (!s)
19335 exit(1);
b4eb6b3d
JH
19336 fclose(stdin);
19337 fp = fopen("try.c", "r");
19338 if (fp == 0)
e6e7e605 19339 exit(2);
b4eb6b3d
JH
19340 fd = fileno(fp);
19341 if (fd < 0)
e6e7e605 19342 exit(3);
b4eb6b3d
JH
19343 b = ($selecttype)s;
19344 for (i = 0; i < NBITS; i++)
19345 FD_SET(i, b);
19346 t.tv_sec = 0;
19347 t.tv_usec = 0;
19348 select(fd + 1, b, 0, 0, &t);
19349 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19350 free(s);
b4eb6b3d
JH
19351 printf("%d\n", i + 1);
19352 return 0;
19353}
19354EOCP
19355 set try
19356 if eval $compile_ok; then
5440bc8e 19357 selectminbits=`$run ./try`
b4eb6b3d
JH
19358 case "$selectminbits" in
19359 '') cat >&4 <<EOM
19360Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19361I'll play safe and guess it is $safebits bits.
b4eb6b3d 19362EOM
e6e7e605
JH
19363 selectminbits=$safebits
19364 bits="$safebits bits"
b4eb6b3d
JH
19365 ;;
19366 1) bits="1 bit" ;;
19367 *) bits="$selectminbits bits" ;;
19368 esac
19369 echo "Your select() operates on $bits at a time." >&4
19370 else
19371 rp='What is the minimum number of bits your select() operates on?'
19372 case "$byteorder" in
e6e7e605
JH
19373 12345678) dflt=64 ;;
19374 1234) dflt=32 ;;
b4eb6b3d
JH
19375 *) dflt=1 ;;
19376 esac
19377 . ./myread
19378 val=$ans
19379 selectminbits="$val"
19380 fi
19381 $rm -f try.* try
19382 ;;
19383 *) : no select, so pick a harmless default
e6e7e605 19384 selectminbits=$safebits
b4eb6b3d
JH
19385 ;;
19386 esac
19387 ;;
19388esac
19389
19390: Trace out the files included by signal.h, then look for SIGxxx names.
19391: Remove SIGARRAYSIZE used by HPUX.
19392: Remove SIGSTKSIZE used by Linux.
19393: Remove SIGSTKSZ used by Posix.
19394: Remove SIGTYP void lines used by OS2.
19395: Some cpps, like os390, dont give the file name anywhere
19396if [ "X$fieldn" = X ]; then
19397 : Just make some guesses. We check them later.
19398 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19399else
19400 xxx=`echo '#include <signal.h>' |
19401 $cppstdin $cppminus $cppflags 2>/dev/null |
19402 $grep '^[ ]*#.*include' |
a938a3bb 19403 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19404fi
19405: Check this list of files to be sure we have parsed the cpp output ok.
19406: This will also avoid potentially non-existent files, such
19407: as ../foo/bar.h
19408xxxfiles=''
19409for xx in $xxx /dev/null ; do
19410 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19411done
19412: If we have found no files, at least try signal.h
19413case "$xxxfiles" in
19414'') xxxfiles=`./findhdr signal.h` ;;
19415esac
19416xxx=`awk '
19417$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19418 print substr($2, 4, 20)
19419}
19420$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19421 print substr($3, 4, 20)
19422}' $xxxfiles`
19423: Append some common names just in case the awk scan failed.
19424xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19425xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19426xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19427xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19428xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19429
19430: generate a few handy files for later
55954f19 19431$cat > signal.c <<EOCP
b4eb6b3d
JH
19432#include <sys/types.h>
19433#include <signal.h>
55954f19
JH
19434#$i_stdlib I_STDLIB
19435#ifdef I_STDLIB
19436#include <stdlib.h>
19437#endif
b4eb6b3d
JH
19438#include <stdio.h>
19439int main() {
19440
19441/* Strange style to avoid deeply-nested #if/#else/#endif */
19442#ifndef NSIG
19443# ifdef _NSIG
19444# define NSIG (_NSIG)
19445# endif
19446#endif
19447
19448#ifndef NSIG
19449# ifdef SIGMAX
19450# define NSIG (SIGMAX+1)
19451# endif
19452#endif
19453
19454#ifndef NSIG
19455# ifdef SIG_MAX
19456# define NSIG (SIG_MAX+1)
19457# endif
19458#endif
19459
19460#ifndef NSIG
3609ea0d
JH
19461# ifdef _SIG_MAX
19462# define NSIG (_SIG_MAX+1)
19463# endif
19464#endif
19465
19466#ifndef NSIG
b4eb6b3d
JH
19467# ifdef MAXSIG
19468# define NSIG (MAXSIG+1)
19469# endif
19470#endif
19471
19472#ifndef NSIG
19473# ifdef MAX_SIG
19474# define NSIG (MAX_SIG+1)
19475# endif
19476#endif
19477
19478#ifndef NSIG
19479# ifdef SIGARRAYSIZE
3609ea0d 19480# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19481# endif
19482#endif
19483
19484#ifndef NSIG
19485# ifdef _sys_nsig
19486# define NSIG (_sys_nsig) /* Solaris 2.5 */
19487# endif
19488#endif
19489
19490/* Default to some arbitrary number that's big enough to get most
19491 of the common signals.
19492*/
19493#ifndef NSIG
19494# define NSIG 50
19495#endif
19496
19497printf("NSIG %d\n", NSIG);
19498
19499#ifndef JUST_NSIG
19500
19501EOCP
19502
19503echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19504{
19505 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19506 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19507 printf $1; printf ");\n"
19508 printf "#endif\n"
19509}
19510END {
19511 printf "#endif /* JUST_NSIG */\n";
19512 printf "exit(0);\n}\n";
19513}
19514' >>signal.c
19515$cat >signal.awk <<'EOP'
19516BEGIN { ndups = 0 }
65197d93 19517$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19518($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19519 if ($2 > maxsig) { maxsig = $2 }
19520 if (sig_name[$2]) {
19521 dup_name[ndups] = $1
19522 dup_num[ndups] = $2
b4eb6b3d
JH
19523 ndups++
19524 }
1ebe1ffb 19525 else {
65197d93
JH
19526 sig_name[$2] = $1
19527 sig_num[$2] = $2
b4eb6b3d
JH
19528 }
19529}
19530END {
19531 if (nsig == 0) {
19532 nsig = maxsig + 1
19533 }
19534 printf("NSIG %d\n", nsig);
19535 for (n = 1; n < nsig; n++) {
19536 if (sig_name[n]) {
19537 printf("%s %d\n", sig_name[n], sig_num[n])
19538 }
19539 else {
19540 printf("NUM%d %d\n", n, n)
19541 }
19542 }
19543 for (n = 0; n < ndups; n++) {
19544 printf("%s %d\n", dup_name[n], dup_num[n])
19545 }
19546}
19547EOP
19548$cat >signal_cmd <<EOS
19549$startsh
19550if $test -s signal.lst; then
19551 echo "Using your existing signal.lst file"
19552 exit 0
19553fi
19554xxx="$xxx"
19555EOS
19556$cat >>signal_cmd <<'EOS'
19557
19558set signal
19559if eval $compile_ok; then
1eb9ad5b 19560 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19561else
19562 echo "(I can't seem be able to compile the whole test program)" >&4
19563 echo "(I'll try it in little pieces.)" >&4
19564 set signal -DJUST_NSIG
19565 if eval $compile_ok; then
5440bc8e 19566 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19567 $cat signal.nsg
19568 else
19569 echo "I can't seem to figure out how many signals you have." >&4
19570 echo "Guessing 50." >&4
19571 echo 'NSIG 50' > signal.nsg
19572 fi
19573 : Now look at all the signal names, one at a time.
19574 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19575 $cat > signal.c <<EOCP
19576#include <sys/types.h>
19577#include <signal.h>
19578#include <stdio.h>
19579int main() {
19580printf("$xx %d\n", SIG${xx});
19581return 0;
19582}
19583EOCP
19584 set signal
19585 if eval $compile; then
19586 echo "SIG${xx} found."
5440bc8e 19587 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19588 else
19589 echo "SIG${xx} NOT found."
19590 fi
19591 done
19592 if $test -s signal.ls1; then
19593 $cat signal.nsg signal.ls1 |
65197d93 19594 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19595 fi
19596
19597fi
19598if $test -s signal.lst; then
19599 :
19600else
19601 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19602 echo 'kill -l' >signal
19603 set X `csh -f <signal`
19604 $rm -f signal
19605 shift
19606 case $# in
19607 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19608 esac
19609 echo $@ | $tr ' ' $trnl | \
19610 $awk '{ printf "%s %d\n", $1, ++s; }
19611 END { printf "NSIG %d\n", ++s }' >signal.lst
19612fi
19613$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19614EOS
19615chmod a+x signal_cmd
19616$eunicefix signal_cmd
19617
19618: generate list of signal names
19619echo " "
19620case "$sig_name_init" in
19621'') doinit=yes ;;
19622*) case "$sig_num_init" in
19623 ''|*,*) doinit=yes ;;
19624 esac ;;
19625esac
19626case "$doinit" in
19627yes)
19628 echo "Generating a list of signal names and numbers..." >&4
19629 . ./signal_cmd
19630 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19631 sig_name=`$awk 'BEGIN { printf "ZERO " }
19632 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19633 sig_num=`$awk 'BEGIN { printf "0 " }
19634 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19635 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19636 !/^NSIG/ { printf "\"%s\", ", $1 }
19637 END { printf "0\n" }' signal.lst`
19638 sig_num_init=`$awk 'BEGIN { printf "0, " }
19639 !/^NSIG/ { printf "%d, ", $2}
19640 END { printf "0\n"}' signal.lst`
19641 ;;
19642esac
19643echo "The following $sig_count signals are available:"
19644echo " "
19645echo $sig_name | $awk \
19646'BEGIN { linelen = 0 }
19647{
19648 for (i = 1; i <= NF; i++) {
19649 name = "SIG" $i " "
19650 linelen = linelen + length(name)
19651 if (linelen > 70) {
19652 printf "\n"
19653 linelen = length(name)
19654 }
19655 printf "%s", name
19656 }
19657 printf "\n"
19658}'
76d3c696 19659sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19660$rm -f signal signal.c signal.awk signal.lst signal_cmd
19661
19662echo " "
19663case "$sizetype" in
19664*_t) zzz="$sizetype" ;;
19665*) zzz="filesize" ;;
19666esac
19667echo "Checking the size of $zzz..." >&4
19668cat > try.c <<EOCP
19669#include <sys/types.h>
19670#include <stdio.h>
d1daaddf
JH
19671#$i_stdlib I_STDLIB
19672#ifdef I_STDLIB
19673#include <stdlib.h>
19674#endif
b4eb6b3d
JH
19675int main() {
19676 printf("%d\n", (int)sizeof($sizetype));
19677 exit(0);
19678}
19679EOCP
19680set try
19681if eval $compile_ok; then
5440bc8e 19682 yyy=`$run ./try`
b4eb6b3d
JH
19683 case "$yyy" in
19684 '') sizesize=4
19685 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19686 ;;
19687 *) sizesize=$yyy
19688 echo "Your $zzz size is $sizesize bytes."
19689 ;;
19690 esac
19691else
19692 sizesize=4
19693 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19694fi
19695
19696
19697: check for socklen_t
19698echo " "
19699echo "Checking to see if you have socklen_t..." >&4
19700$cat >try.c <<EOCP
19701#include <sys/types.h>
19702#$d_socket HAS_SOCKET
19703#ifdef HAS_SOCKET
19704#include <sys/socket.h>
19705#endif
19706int main() { socklen_t x = 16; }
19707EOCP
19708set try
19709if eval $compile; then
19710 val="$define"
19711 echo "You have socklen_t."
19712else
19713 val="$undef"
19714 echo "You do not have socklen_t."
19715 case "$sizetype" in
19716 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19717 esac
19718fi
19719$rm -f try try.*
19720set d_socklen_t
19721eval $setvar
19722
a7710f8d
JH
19723: see if this is a socks.h system
19724set socks.h i_socks
19725eval $inhdr
19726
b4eb6b3d
JH
19727: check for type of the size argument to socket calls
19728case "$d_socket" in
19729"$define")
19730 $cat <<EOM
19731
19732Checking to see what type is the last argument of accept().
19733EOM
b4eb6b3d
JH
19734 yyy=''
19735 case "$d_socklen_t" in
19736 "$define") yyy="$yyy socklen_t"
19737 esac
19738 yyy="$yyy $sizetype int long unsigned"
19739 for xxx in $yyy; do
19740 case "$socksizetype" in
19741 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19742 case "$usesocks" in
19743 "$define")
19744 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19745 echo "Your system accepts '$xxx *' for the last argument of accept()."
19746 socksizetype="$xxx"
19747 fi
19748 ;;
19749 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19750 echo "Your system accepts '$xxx *' for the last argument of accept()."
19751 socksizetype="$xxx"
19752 fi
19753 ;;
19754 esac
b4eb6b3d
JH
19755 ;;
19756 esac
19757 done
19758: In case none of those worked, prompt the user.
19759 case "$socksizetype" in
19760 '') rp='What is the type for socket address structure sizes?'
19761 dflt='int'
19762 . ./myread
19763 socksizetype=$ans
19764 ;;
19765 esac
19766 ;;
19767*) : no sockets, so pick relatively harmless default
19768 socksizetype='int'
19769 ;;
19770esac
19771
19772: see what type is used for signed size_t
19773set ssize_t ssizetype int stdio.h sys/types.h
19774eval $typedef
19775dflt="$ssizetype"
5440bc8e 19776$cat > try.c <<EOM
b4eb6b3d 19777#include <stdio.h>
d1daaddf
JH
19778#$i_stdlib I_STDLIB
19779#ifdef I_STDLIB
19780#include <stdlib.h>
19781#endif
b4eb6b3d
JH
19782#include <sys/types.h>
19783#define Size_t $sizetype
19784#define SSize_t $dflt
19785int main()
19786{
19787 if (sizeof(Size_t) == sizeof(SSize_t))
19788 printf("$dflt\n");
19789 else if (sizeof(Size_t) == sizeof(int))
19790 printf("int\n");
19791 else
19792 printf("long\n");
19793 exit(0);
19794}
19795EOM
19796echo " "
5440bc8e
JH
19797set try
19798if eval $compile_ok && $run ./try > /dev/null; then
19799 ssizetype=`$run ./try`
b4eb6b3d
JH
19800 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19801else
19802 $cat >&4 <<EOM
19803Help! I can't compile and run the ssize_t test program: please enlighten me!
19804(This is probably a misconfiguration in your system or libraries, and
19805you really ought to fix it. Still, I'll try anyway.)
19806
19807I need a type that is the same size as $sizetype, but is guaranteed to
19808be signed. Common values are ssize_t, int and long.
19809
19810EOM
19811 rp="What signed type is the same size as $sizetype?"
19812 . ./myread
19813 ssizetype="$ans"
19814fi
5440bc8e 19815$rm -f try try.*
b4eb6b3d
JH
19816
19817: see what type of char stdio uses.
19818echo " "
aa517f50
JH
19819echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19820if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19821 echo "Your stdio uses unsigned chars." >&4
19822 stdchar="unsigned char"
19823else
aa517f50
JH
19824 echo "Your stdio uses signed chars." >&4
19825 stdchar="char"
b4eb6b3d 19826fi
aa517f50
JH
19827$rm -f stdioh
19828
19829
b4eb6b3d 19830
b4eb6b3d
JH
19831: see what type uids are declared as in the kernel
19832echo " "
19833echo "Looking for the type for user ids returned by getuid()."
19834set uid_t uidtype xxx stdio.h sys/types.h
19835eval $typedef
19836case "$uidtype" in
19837xxx)
19838 xxx=`./findhdr sys/user.h`
19839 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19840 case $1 in
19841 unsigned) dflt="$1 $2" ;;
19842 *) dflt="$1" ;;
19843 esac
19844 ;;
19845*) dflt="$uidtype";;
19846esac
19847case "$uidtype" in
19848uid_t) echo "uid_t found." ;;
19849*) rp="What is the type for user ids returned by getuid()?"
19850 . ./myread
19851 uidtype="$ans"
19852 ;;
19853esac
19854
19855echo " "
19856case "$uidtype" in
19857*_t) zzz="$uidtype" ;;
19858*) zzz="uid" ;;
19859esac
19860echo "Checking the size of $zzz..." >&4
19861cat > try.c <<EOCP
19862#include <sys/types.h>
19863#include <stdio.h>
d1daaddf
JH
19864#$i_stdlib I_STDLIB
19865#ifdef I_STDLIB
19866#include <stdlib.h>
19867#endif
b4eb6b3d
JH
19868int main() {
19869 printf("%d\n", (int)sizeof($uidtype));
19870 exit(0);
19871}
19872EOCP
19873set try
19874if eval $compile_ok; then
5440bc8e 19875 yyy=`$run ./try`
b4eb6b3d
JH
19876 case "$yyy" in
19877 '') uidsize=4
19878 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19879 ;;
19880 *) uidsize=$yyy
19881 echo "Your $zzz is $uidsize bytes long."
19882 ;;
19883 esac
19884else
19885 uidsize=4
19886 echo "(I can't compile the test program--guessing $uidsize.)" >&4
19887fi
19888
19889echo " "
19890case "$uidtype" in
19891*_t) zzz="$uidtype" ;;
19892*) zzz="uid" ;;
19893esac
19894echo "Checking the sign of $zzz..." >&4
19895cat > try.c <<EOCP
19896#include <sys/types.h>
19897#include <stdio.h>
19898int main() {
19899 $uidtype foo = -1;
19900 if (foo < 0)
19901 printf("-1\n");
19902 else
19903 printf("1\n");
19904}
19905EOCP
19906set try
19907if eval $compile; then
5440bc8e 19908 yyy=`$run ./try`
b4eb6b3d
JH
19909 case "$yyy" in
19910 '') uidsign=1
19911 echo "(I can't execute the test program--guessing unsigned.)" >&4
19912 ;;
19913 *) uidsign=$yyy
19914 case "$uidsign" in
19915 1) echo "Your $zzz is unsigned." ;;
19916 -1) echo "Your $zzz is signed." ;;
19917 esac
19918 ;;
19919 esac
19920else
19921 uidsign=1
19922 echo "(I can't compile the test program--guessing unsigned.)" >&4
19923fi
19924
19925
19926
19927echo " "
19928$echo "Checking the format string to be used for uids..." >&4
19929
19930case "$uidsign" in
19931-1) if $test X"$uidsize" = X"$ivsize"; then
19932 uidformat="$ivdformat"
19933 else
19934 if $test X"$uidsize" = X"$longsize"; then
19935 uidformat='"ld"'
19936 else
19937 if $test X"$uidsize" = X"$intsize"; then
19938 uidformat='"d"'
19939 else
19940 if $test X"$uidsize" = X"$shortsize"; then
19941 uidformat='"hd"'
19942 fi
19943 fi
19944 fi
19945 fi
19946 ;;
19947*) if $test X"$uidsize" = X"$uvsize"; then
19948 uidformat="$uvuformat"
19949 else
19950 if $test X"$uidsize" = X"$longsize"; then
19951 uidformat='"lu"'
19952 else
19953 if $test X"$uidsize" = X"$intsize"; then
19954 uidformat='"u"'
19955 else
19956 if $test X"$uidsize" = X"$shortsize"; then
19957 uidformat='"hu"'
19958 fi
19959 fi
19960 fi
19961 fi
19962 ;;
19963esac
19964
4afd418c
MB
19965
19966case "$usesitecustomize" in
19967 $define|true|[Yy]*)
19968 usesitecustomize="$define"
19969 ;;
19970 *)
19971 usesitecustomize="$undef"
19972 ;;
19973 esac
19974
3659ebf1
JH
19975: determine compiler compiler
19976case "$yacc" in
19977'')
19978 dflt=yacc;;
19979*)
19980 dflt="$yacc";;
19981esac
19982echo " "
19983comp='yacc'
3c728e00 19984if $test -f "$byacc$_exe"; then
3659ebf1
JH
19985 dflt="$byacc"
19986 comp="byacc or $comp"
19987fi
3c728e00 19988if $test -f "$bison$_exe"; then
3659ebf1
JH
19989 comp="$comp or bison -y"
19990fi
19991rp="Which compiler compiler ($comp) shall I use?"
19992. ./myread
19993yacc="$ans"
19994case "$yacc" in
19995*bis*)
19996 case "$yacc" in
19997 *-y*) ;;
19998 *)
19999 yacc="$yacc -y"
20000 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20001 ;;
20002 esac
20003 ;;
20004esac
20005
758a5d79
JH
20006: see if this is a fp.h system
20007set fp.h i_fp
20008eval $inhdr
20009
20010: see if this is a fp_class.h system
20011set fp_class.h i_fp_class
20012eval $inhdr
20013
b4eb6b3d 20014: see if this is a ieeefp.h system
b5b9f165
JH
20015case "$i_ieeefp" in
20016'' ) set ieeefp.h i_ieeefp
20017 eval $inhdr
20018 ;;
20019esac
b4eb6b3d
JH
20020
20021: see if this is a libutil.h system
20022set libutil.h i_libutil
20023eval $inhdr
20024
b4eb6b3d
JH
20025: see if mach cthreads are available
20026if test "X$usethreads" = "X$define"; then
20027 set mach/cthreads.h i_machcthr
20028 eval $inhdr
20029else
20030 i_machcthr="$undef"
20031fi
20032
20033
20034
b4eb6b3d
JH
20035: see if this is a mntent.h system
20036set mntent.h i_mntent
20037eval $inhdr
20038
20039: see if ndbm.h is available
20040set ndbm.h t_ndbm
20041eval $inhdr
1c6861ad
JS
20042
20043case "$t_ndbm" in
20044$undef)
20045 # Some Linux distributions such as RedHat 7.1 put the
20046 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20047 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20048 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20049 ccflags="$ccflags -I/usr/include/gdbm"
20050 cppflags="$cppflags -I/usr/include/gdbm"
20051 t_ndbm=$define
20052 fi
20053 ;;
20054esac
20055
b4eb6b3d
JH
20056case "$t_ndbm" in
20057$define)
20058 : see if dbm_open exists
20059 set dbm_open d_dbm_open
20060 eval $inlibc
20061 case "$d_dbm_open" in
20062 $undef)
20063 t_ndbm="$undef"
20064 echo "We won't be including <ndbm.h>"
20065 ;;
20066 esac
20067 ;;
20068esac
20069val="$t_ndbm"
20070set i_ndbm
20071eval $setvar
20072
20073: see if net/errno.h is available
20074val=''
20075set net/errno.h val
20076eval $inhdr
20077
20078: Unfortunately, it causes problems on some systems. Arrgh.
20079case "$val" in
20080$define)
20081 cat > try.c <<'EOM'
20082#include <stdio.h>
20083#include <errno.h>
20084#include <net/errno.h>
20085int func()
20086{
20087 return ENOTSOCK;
20088}
20089EOM
20090 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20091 echo "We'll be including <net/errno.h>." >&4
20092 else
20093 echo "We won't be including <net/errno.h>." >&4
20094 val="$undef"
20095 fi
20096 $rm -f try.* try
20097 ;;
20098esac
20099set i_neterrno
20100eval $setvar
20101
20102: see if netinet/tcp.h is available
20103set netinet/tcp.h i_netinettcp
20104eval $inhdr
20105
20106: see if this is a poll.h system
20107set poll.h i_poll
20108eval $inhdr
20109
20110: see if this is a prot.h system
20111set prot.h i_prot
20112eval $inhdr
20113
20114echo " "
20115$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20116$cat <<'EOSH' > Cppsym.know
20117a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20118AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20119alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20120ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20121BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20122BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20123bull c cadmus clipper CMU COFF COMPILER_VERSION
20124concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20125CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20126Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20127FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20128GLIBC GLIBC_MINOR
20129GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20130H3050R H3050RX hbullx20 hcx host_mips
20131hp200 hp300 hp700 HP700 hp800 hp9000
20132hp9000s200 hp9000s300 hp9000s400 hp9000s500
20133hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20134i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20135IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20136INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20137LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20138LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20139Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20140LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20141M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20142M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20143M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20144MATH_HAS_NO_SIDE_EFFECTS
20145mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20146mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20147mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20148MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20149mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20150NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20151news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20152ns32016 ns32332 ns32k nsc32000
20153OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20154pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20155pc532 pdp11 PGC PIC plexus PORTAR posix
20156POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20157POSIX_C_SOURCE POSIX_SOURCE POWER
20158PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20159riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20160SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20161sony sony_news sonyrisc sparc sparclite spectrum
20162stardent stdc STDC_EXT stratos sun sun3 sun386
20163Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20164SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20165SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20166sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20167TM3200 TM5400 TM5600
b4eb6b3d
JH
20168tower tower32 tower32_200 tower32_600 tower32_700
20169tower32_800 tower32_850 tss
20170u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20171ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20172unix UNIX95 UNIX99 unixpc unos
20173USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20174USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20175USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20176USGr4 USGr4_2
44c87379 20177Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20178XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20179XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20180z8000
20181EOSH
20182# Maybe put other stuff here too.
20183cat <<EOSH >>Cppsym.know
20184$osname
20185EOSH
20186./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20187./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20188$cat Cppsym.know > Cppsym.c
381aa1ff 20189$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20190$rm -f Cppsym.a Cppsym.b Cppsym.c
20191cat <<EOSH > Cppsym
20192$startsh
20193if $test \$# -gt 0; then
20194 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20195 if $test -s Cppsym.got; then
20196 $rm -f Cppsym.got
20197 exit 0
20198 fi
20199 $rm -f Cppsym.got
20200 exit 1
20201else
20202 $tr " " "$trnl" | ./Cppsym.try
20203 exit 0
20204fi
20205EOSH
20206chmod +x Cppsym
20207$eunicefix Cppsym
20208cat <<EOSH > Cppsym.try
20209$startsh
20210cat <<'EOCP' > try.c
20211#include <stdio.h>
360321b3
YST
20212#if cpp_stuff == 1
20213#define STRINGIFY(a) "a"
20214#endif
20215#if cpp_stuff == 42
20216#define StGiFy(a) #a
20217#define STRINGIFY(a) StGiFy(a)
20218#endif
20219#if $cpp_stuff != 1 && $cpp_stuff != 42
20220# include "Bletch: How does this C preprocessor stringify macros?"
20221#endif
b4eb6b3d
JH
20222int main() {
20223EOCP
20224$awk \\
20225EOSH
20226cat <<'EOSH' >> Cppsym.try
20227'length($1) > 0 {
360321b3
YST
20228 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20229 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20230 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20231 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20232}' >> try.c
2ef53570 20233echo 'return 0;}' >> try.c
b4eb6b3d
JH
20234EOSH
20235cat <<EOSH >> Cppsym.try
20236ccflags="$ccflags"
20237case "$osname-$gccversion" in
20238irix-) ccflags="\$ccflags -woff 1178" ;;
20239os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20240esac
360321b3 20241$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20242EOSH
20243chmod +x Cppsym.try
20244$eunicefix Cppsym.try
20245./Cppsym < Cppsym.know > Cppsym.true
20246: now check the C compiler for additional symbols
20247postprocess_cc_v=''
20248case "$osname" in
20249aix) postprocess_cc_v="|$tr , ' '" ;;
20250esac
20251$cat >ccsym <<EOS
20252$startsh
20253$cat >tmp.c <<EOF
20254extern int foo;
20255EOF
20256for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20257do
20258 case "\$i" in
20259 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20260 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20261 esac
20262done
20263$rm -f try.c
20264EOS
20265postprocess_cc_v=''
20266chmod +x ccsym
20267$eunicefix ccsym
20268./ccsym > ccsym1.raw
20269if $test -s ccsym1.raw; then
20270 $sort ccsym1.raw | $uniq >ccsym.raw
20271else
20272 mv ccsym1.raw ccsym.raw
20273fi
20274
20275$awk '/\=/ { print $0; next }
20276 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20277$comm -13 Cppsym.true ccsym.list >ccsym.own
20278$comm -12 Cppsym.true ccsym.list >ccsym.com
20279$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20280also=''
20281if $test -z ccsym.raw; then
20282 echo "Your C compiler doesn't seem to define any symbols!" >&4
20283 echo " "
20284 echo "However, your C preprocessor defines the following symbols:"
20285 $cat Cppsym.true
20286 ccsymbols=''
20287 cppsymbols=`$cat Cppsym.true`
20288 cppsymbols=`echo $cppsymbols`
20289 cppccsymbols="$cppsymbols"
20290else
20291 if $test -s ccsym.com; then
20292 echo "Your C compiler and pre-processor define these symbols:"
20293 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20294 also='also '
20295 symbols='ones'
20296 cppccsymbols=`$cat ccsym.com`
20297 cppccsymbols=`echo $cppccsymbols`
20298 $test "$silent" || sleep 1
20299 fi
20300 if $test -s ccsym.cpp; then
20301 $test "$also" && echo " "
20302 echo "Your C pre-processor ${also}defines the following symbols:"
20303 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20304 also='further '
20305 cppsymbols=`$cat ccsym.cpp`
20306 cppsymbols=`echo $cppsymbols`
20307 $test "$silent" || sleep 1
20308 fi
20309 if $test -s ccsym.own; then
20310 $test "$also" && echo " "
20311 echo "Your C compiler ${also}defines the following cpp symbols:"
20312 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20313 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20314 ccsymbols=`$cat ccsym.own`
20315 ccsymbols=`echo $ccsymbols`
20316 $test "$silent" || sleep 1
20317 fi
20318fi
b4eb6b3d
JH
20319
20320: see if this is a termio system
20321val="$undef"
20322val2="$undef"
20323val3="$undef"
20324if $test `./findhdr termios.h`; then
20325 set tcsetattr i_termios
20326 eval $inlibc
20327 val3="$i_termios"
20328fi
20329echo " "
20330case "$val3" in
20331"$define") echo "You have POSIX termios.h... good!" >&4;;
20332*) if ./Cppsym pyr; then
20333 case "`/bin/universe`" in
20334 ucb) if $test `./findhdr sgtty.h`; then
20335 val2="$define"
20336 echo "<sgtty.h> found." >&4
20337 else
20338 echo "System is pyramid with BSD universe."
20339 echo "<sgtty.h> not found--you could have problems." >&4
20340 fi;;
20341 *) if $test `./findhdr termio.h`; then
20342 val="$define"
20343 echo "<termio.h> found." >&4
20344 else
20345 echo "System is pyramid with USG universe."
20346 echo "<termio.h> not found--you could have problems." >&4
20347 fi;;
20348 esac
20349 elif ./usg; then
20350 if $test `./findhdr termio.h`; then
20351 echo "<termio.h> found." >&4
20352 val="$define"
20353 elif $test `./findhdr sgtty.h`; then
20354 echo "<sgtty.h> found." >&4
20355 val2="$define"
20356 else
20357echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20358 fi
20359 else
20360 if $test `./findhdr sgtty.h`; then
20361 echo "<sgtty.h> found." >&4
20362 val2="$define"
20363 elif $test `./findhdr termio.h`; then
20364 echo "<termio.h> found." >&4
20365 val="$define"
20366 else
20367echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20368 fi
20369 fi;;
20370esac
20371set i_termio; eval $setvar
20372val=$val2; set i_sgtty; eval $setvar
20373val=$val3; set i_termios; eval $setvar
20374
b4eb6b3d
JH
20375: see if stddef is available
20376set stddef.h i_stddef
20377eval $inhdr
923fc586 20378
b4eb6b3d
JH
20379: see if this is a sunmath.h system
20380set sunmath.h i_sunmath
20381eval $inhdr
5f80c64f 20382
b4eb6b3d
JH
20383: see if sys/access.h is available
20384set sys/access.h i_sysaccess
20385eval $inhdr
20386
20387: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20388set sys/filio.h i_sysfilio
20389eval $inhdr
20390echo " "
20391if $test `./findhdr sys/ioctl.h`; then
20392 val="$define"
20393 echo '<sys/ioctl.h> found.' >&4
20394else
20395 val="$undef"
20396 if $test $i_sysfilio = "$define"; then
20397 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20398 else
b4eb6b3d
JH
20399 $test $i_sgtty = "$define" && xxx="sgtty.h"
20400 $test $i_termio = "$define" && xxx="termio.h"
20401 $test $i_termios = "$define" && xxx="termios.h"
20402echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20403 fi
20404fi
20405set i_sysioctl
20406eval $setvar
20407
49a78c82
JH
20408: see if socket ioctl defs are in sys/sockio.h
20409echo " "
20410xxx=`./findhdr sys/sockio.h`
20411if $test "$xxx"; then
20412 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20413 val="$define"
20414 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20415 else
20416 val="$undef"
20417 echo "No socket ioctls found in <sys/sockio.h>." >&4
20418 fi
20419else
20420 val="$undef"
20421 $cat <<EOM
20422<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20423EOM
20424fi
20425set i_syssockio
20426eval $setvar
20427
b4eb6b3d
JH
20428
20429: see if this is a syslog.h system
20430set syslog.h i_syslog
20431eval $inhdr
20432
20433
20434: see if this is a sys/mode.h system
20435set sys/mode.h i_sysmode
20436eval $inhdr
20437
20438: see if sys/resource.h has to be included
20439set sys/resource.h i_sysresrc
20440eval $inhdr
20441
20442: see if sys/security.h is available
20443set sys/security.h i_syssecrt
20444eval $inhdr
20445
20446: see if this is a sys/statvfs.h system
20447set sys/statvfs.h i_sysstatvfs
20448eval $inhdr
20449
b4eb6b3d
JH
20450: see if this is a sys/un.h system
20451set sys/un.h i_sysun
20452eval $inhdr
20453
20454
20455: see if this is a sys/utsname.h system
20456set sys/utsname.h i_sysutsname
20457eval $inhdr
20458
20459: see if this is a syswait system
20460set sys/wait.h i_syswait
20461eval $inhdr
20462
20463: see if this is a ustat.h system
20464set ustat.h i_ustat
20465eval $inhdr
20466
20467: see if this is an utime system
20468set utime.h i_utime
20469eval $inhdr
20470
20471: see if this is a values.h system
20472set values.h i_values
20473eval $inhdr
20474
20475: see if this is a vfork system
20476case "$d_vfork" in
20477"$define")
20478 set vfork.h i_vfork
20479 eval $inhdr
20480 ;;
20481*)
20482 i_vfork="$undef"
20483 ;;
20484esac
20485
20486: see if gdbm.h is available
20487set gdbm.h t_gdbm
20488eval $inhdr
20489case "$t_gdbm" in
20490$define)
20491 : see if gdbm_open exists
20492 set gdbm_open d_gdbm_open
20493 eval $inlibc
20494 case "$d_gdbm_open" in
20495 $undef)
20496 t_gdbm="$undef"
20497 echo "We won't be including <gdbm.h>"
5f80c64f 20498 ;;
b4eb6b3d
JH
20499 esac
20500 ;;
20501esac
20502val="$t_gdbm"
20503set i_gdbm
20504eval $setvar
20505
20506echo " "
20507echo "Looking for extensions..." >&4
20508: If we are using the old config.sh, known_extensions may contain
20509: old or inaccurate or duplicate values.
20510known_extensions=''
20511nonxs_extensions=''
20512: We do not use find because it might not be available.
20513: We do not just use MANIFEST because the user may have dropped
20514: some additional extensions into the source tree and expect them
20515: to be built.
20516
20517: Function to recursively find available extensions, ignoring DynaLoader
20518: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20519find_extensions='
20520 for xxx in *; do
20521 case "$xxx" in
20522 DynaLoader|dynaload) ;;
20523 *)
20524 if $test -f $xxx/$xxx.xs; then
20525 known_extensions="$known_extensions $1$xxx";
20526 elif $test -f $xxx/Makefile.PL; then
20527 nonxs_extensions="$nonxs_extensions $1$xxx";
20528 else
20529 if $test -d $xxx -a $# -lt 10; then
20530 set $1$xxx/ $*;
6904989c 20531 cd "$xxx";
b4eb6b3d
JH
20532 eval $find_extensions;
20533 cd ..;
20534 shift;
20535 fi;
20536 fi
20537 ;;
20538 esac;
20539 done'
20540tdir=`pwd`
6904989c 20541cd "$rsrc/ext"
b4eb6b3d
JH
20542set X
20543shift
20544eval $find_extensions
4e1a6d26
AD
20545# Special case: Add in threads/shared since it is not picked up by the
20546# recursive find above (and adding in general recursive finding breaks
20547# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20548known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20549set X $nonxs_extensions
20550shift
20551nonxs_extensions="$*"
20552set X $known_extensions
20553shift
20554known_extensions="$*"
6904989c 20555cd "$tdir"
b4eb6b3d
JH
20556
20557: Now see which are supported on this system.
20558avail_ext=''
20559for xxx in $known_extensions ; do
20560 case "$xxx" in
20561 DB_File|db_file)
20562 case "$i_db" in
20563 $define) avail_ext="$avail_ext $xxx" ;;
20564 esac
20565 ;;
20566 GDBM_File|gdbm_fil)
20567 case "$i_gdbm" in
20568 $define) avail_ext="$avail_ext $xxx" ;;
20569 esac
20570 ;;
1d59c593 20571 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20572 case "$i_langinfo$d_nl_langinfo" in
20573 $define$define) avail_ext="$avail_ext $xxx" ;;
20574 esac
20575 ;;
b4eb6b3d
JH
20576 NDBM_File|ndbm_fil)
20577 case "$i_ndbm" in
20578 $define)
20579 case "$osname-$use64bitint" in
0be9fa5d 20580 hpux-define)
b4eb6b3d
JH
20581 case "$libs" in
20582 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20583 esac
20584 ;;
20585 *) avail_ext="$avail_ext $xxx" ;;
20586 esac
20587 ;;
20588 esac
20589 ;;
20590 ODBM_File|odbm_fil)
20591 case "${i_dbm}${i_rpcsvcdbm}" in
20592 *"${define}"*)
20593 case "$osname-$use64bitint" in
0be9fa5d 20594 hpux-define)
b4eb6b3d
JH
20595 case "$libs" in
20596 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20597 esac
20598 ;;
20599 *) avail_ext="$avail_ext $xxx" ;;
20600 esac
20601 ;;
20602 esac
20603 ;;
20604 POSIX|posix)
20605 case "$useposix" in
20606 true|define|y) avail_ext="$avail_ext $xxx" ;;
20607 esac
20608 ;;
20609 Opcode|opcode)
20610 case "$useopcode" in
20611 true|define|y) avail_ext="$avail_ext $xxx" ;;
20612 esac
20613 ;;
20614 Socket|socket)
20615 case "$d_socket" in
4a9f028c
JH
20616 true|$define|y)
20617 case "$osname" in
20618 beos) ;; # not unless BONE
20619 *) avail_ext="$avail_ext $xxx" ;;
20620 esac
20621 ;;
b4eb6b3d
JH
20622 esac
20623 ;;
20624 Sys/Syslog|sys/syslog)
20625 : XXX syslog requires socket
20626 case "$d_socket" in
20627 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20628 esac
20629 ;;
20630 Thread|thread)
b00ec89b
AB
20631 case "$usethreads" in
20632 true|$define|y)
20633 case "$useithreads" in
20634 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20635 esac
b4eb6b3d
JH
20636 esac
20637 ;;
f9b6ed1c
AD
20638 XS/APItest|xs/apitest)
20639 # This is just for testing. Skip it unless we have dynamic loading.
20640
20641 case "$usedl" in
20642 $define) avail_ext="$avail_ext $xxx" ;;
20643 esac
20644 ;;
20645 XS/Typemap|xs/typemap)
20646 # This is just for testing. Skip it unless we have dynamic loading.
20647 case "$usedl" in
20648 $define) avail_ext="$avail_ext $xxx" ;;
20649 esac
20650 ;;
7deadc5f 20651 threads|threads/shared)
73e09c8f
JH
20652 # threads and threads::shared are special cases.
20653 # To stop people from asking "Perl 5.8.0 was supposed
20654 # to have this new fancy threads implementation but my
20655 # perl doesn't have it" and from people trying to
20656 # (re)install the threads module using CPAN.pm and
20657 # CPAN.pm then offering to reinstall Perl 5.8.0,
20658 # the threads.pm and threads/shared.pm will always be
20659 # there, croaking informatively ("you need to rebuild
20660 # all of Perl with threads, sorry") when threads haven't
20661 # been compiled in.
20662 # --jhi
20663 avail_ext="$avail_ext $xxx"
1dca008a 20664 ;;
b4eb6b3d
JH
20665 IPC/SysV|ipc/sysv)
20666 : XXX Do we need a useipcsysv variable here
20667 case "${d_msg}${d_sem}${d_shm}" in
20668 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20669 esac
20670 ;;
20671 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20672 ;;
20673 esac
b4eb6b3d 20674done
5f80c64f 20675
b4eb6b3d
JH
20676set X $avail_ext
20677shift
20678avail_ext="$*"
5f80c64f 20679
ef0c5be8
JH
20680case "$onlyextensions" in
20681'') ;;
20682*) keepextensions=''
20683 echo "You have requested that only certains extensions be included..." >&4
20684 for i in $onlyextensions; do
20685 case " $avail_ext " in
20686 *" $i "*)
20687 echo "Keeping extension $i."
20688 keepextensions="$keepextensions $i"
20689 ;;
20690 *) echo "Ignoring extension $i." ;;
20691 esac
20692 done
20693 avail_ext="$keepextensions"
20694 ;;
20695esac
20696
20697case "$noextensions" in
20698'') ;;
20699*) keepextensions=''
20700 echo "You have requested that certain extensions be ignored..." >&4
20701 for i in $avail_ext; do
c3dadc13
AD
20702 case " $noextensions " in
20703 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20704 *) echo "Keeping extension $i.";
20705 keepextensions="$keepextensions $i"
20706 ;;
20707 esac
20708 done
20709 avail_ext="$keepextensions"
20710 ;;
20711esac
20712
b4eb6b3d
JH
20713: Now see which nonxs extensions are supported on this system.
20714: For now assume all are.
20715nonxs_ext=''
20716for xxx in $nonxs_extensions ; do
20717 case "$xxx" in
20718 *) nonxs_ext="$nonxs_ext $xxx"
20719 ;;
20720 esac
20721done
5f80c64f 20722
b4eb6b3d
JH
20723set X $nonxs_ext
20724shift
20725nonxs_ext="$*"
20726
20727case $usedl in
20728$define)
20729 $cat <<EOM
20730A number of extensions are supplied with $package. You may choose to
20731compile these extensions for dynamic loading (the default), compile
20732them into the $package executable (static loading), or not include
20733them at all. Answer "none" to include no extensions.
20734Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20735
20736EOM
b4eb6b3d 20737 case "$dynamic_ext" in
736accd3
YST
20738 '')
20739 : Exclude those listed in static_ext
20740 dflt=''
20741 for xxx in $avail_ext; do
20742 case " $static_ext " in
20743 *" $xxx "*) ;;
20744 *) dflt="$dflt $xxx" ;;
20745 esac
20746 done
20747 set X $dflt
20748 shift
20749 dflt="$*"
20750 ;;
b4eb6b3d
JH
20751 *) dflt="$dynamic_ext"
20752 # Perhaps we are reusing an old out-of-date config.sh.
20753 case "$hint" in
20754 previous)
20755 if test X"$dynamic_ext" != X"$avail_ext"; then
20756 $cat <<EOM
20757NOTICE: Your previous config.sh list may be incorrect.
20758The extensions now available to you are
20759 ${avail_ext}
20760but the default list from your previous config.sh is
20761 ${dynamic_ext}
9c839522 20762
b4eb6b3d
JH
20763EOM
20764 fi
9c839522
PM
20765 ;;
20766 esac
b4eb6b3d
JH
20767 ;;
20768 esac
5f80c64f 20769 case "$dflt" in
b4eb6b3d
JH
20770 '') dflt=none;;
20771 esac
20772 rp="What extensions do you wish to load dynamically?"
20773 . ./myread
20774 case "$ans" in
20775 none) dynamic_ext=' ' ;;
20776 *) dynamic_ext="$ans" ;;
5f80c64f 20777 esac
5f80c64f 20778
b4eb6b3d
JH
20779 case "$static_ext" in
20780 '')
20781 : Exclude those already listed in dynamic linking
20782 dflt=''
20783 for xxx in $avail_ext; do
20784 case " $dynamic_ext " in
20785 *" $xxx "*) ;;
20786 *) dflt="$dflt $xxx" ;;
20787 esac
20788 done
20789 set X $dflt
20790 shift
20791 dflt="$*"
20792 ;;
20793 *) dflt="$static_ext"
20794 ;;
20795 esac
9c839522 20796
b4eb6b3d
JH
20797 case "$dflt" in
20798 '') dflt=none;;
20799 esac
20800 rp="What extensions do you wish to load statically?"
20801 . ./myread
20802 case "$ans" in
20803 none) static_ext=' ' ;;
20804 *) static_ext="$ans" ;;
20805 esac
20806 ;;
20807*)
20808 $cat <<EOM
20809A number of extensions are supplied with $package. Answer "none"
20810to include no extensions.
20811Note that DynaLoader is always built and need not be mentioned here.
9c839522 20812
b4eb6b3d
JH
20813EOM
20814 case "$static_ext" in
20815 '') dflt="$avail_ext" ;;
20816 *) dflt="$static_ext"
20817 # Perhaps we are reusing an old out-of-date config.sh.
20818 case "$hint" in
20819 previous)
20820 if test X"$static_ext" != X"$avail_ext"; then
20821 $cat <<EOM
20822NOTICE: Your previous config.sh list may be incorrect.
20823The extensions now available to you are
20824 ${avail_ext}
20825but the default list from your previous config.sh is
20826 ${static_ext}
5f80c64f
JH
20827
20828EOM
b4eb6b3d
JH
20829 fi
20830 ;;
20831 esac
20832 ;;
20833 esac
20834 : Exclude those that are not xs extensions
20835 case "$dflt" in
20836 '') dflt=none;;
20837 esac
20838 rp="What extensions do you wish to include?"
20839 . ./myread
20840 case "$ans" in
20841 none) static_ext=' ' ;;
20842 *) static_ext="$ans" ;;
20843 esac
20844 ;;
5f80c64f 20845esac
f1f6834f
AD
20846#
20847# Encode is a special case. If we are building Encode as a static
20848# extension, we need to explicitly list its subextensions as well.
20849# For other nested extensions, this is handled automatically by
20850# the appropriate Makefile.PL.
20851case " $static_ext " in
20852 *" Encode "*) # Add the subextensions of Encode
20853 cd "$rsrc/ext"
20854 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20855 static_ext="$static_ext Encode/$xxx"
20856 done
20857 cd "$tdir"
20858 ;;
20859esac
5f80c64f 20860
b4eb6b3d
JH
20861set X $dynamic_ext $static_ext $nonxs_ext
20862shift
20863extensions="$*"
20864
93a2cd18
AD
20865# Sanity check: We require an extension suitable for use with
20866# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
20867# should show up as failures in the test suite, but it's helpful to
20868# catch them now.) The 'extensions' list is normally sorted
20869# alphabetically, so we need to accept either
20870# DB_File ... Fcntl ... IO ....
20871# or something like
20872# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
20873case " $extensions" in
20874*"_File "*" Fcntl "*" IO "*) ;; # DB_File
20875*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20876*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
20877*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20878 echo "WARNING: The Perl you are building will be quite crippled." >& 4
20879 ;;
20880esac
20881
9c839522
PM
20882: Remove libraries needed only for extensions
20883: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
20884: The exception is SunOS 4.x, which needs them.
20885case "${osname}X${osvers}" in
20886sunos*X4*)
20887 perllibs="$libs"
20888 ;;
20889*) case "$usedl" in
20890 $define|true|[yY]*)
20891 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
20892 shift
20893 perllibs="$*"
20894 ;;
20895 *) perllibs="$libs"
20896 ;;
20897 esac
20898 ;;
9c839522 20899esac
5f80c64f
JH
20900
20901: Remove build directory name from cppstdin so it can be used from
20902: either the present location or the final installed location.
20903echo " "
20904: Get out of the UU directory to get correct path name.
20905cd ..
20906case "$cppstdin" in
20907`pwd`/cppstdin)
20908 echo "Stripping down cppstdin path name"
20909 cppstdin=cppstdin
20910 ;;
20911esac
20912cd UU
20913
20914: end of configuration questions
20915echo " "
20916echo "End of configuration questions."
20917echo " "
20918
20919: back to where it started
20920if test -d ../UU; then
20921 cd ..
20922fi
20923
48370efc
JH
20924: configuration may be patched via a 'config.arch' file
20925if $test -f config.arch; then
20926 echo "I see a config.arch file, loading it."
20927 . ./config.arch
20928fi
20929
5f80c64f
JH
20930: configuration may be patched via a 'config.over' file
20931if $test -f config.over; then
20932 echo " "
20933 dflt=y
20934 rp='I see a config.over file. Do you wish to load it?'
20935 . UU/myread
20936 case "$ans" in
20937 n*) echo "OK, I'll ignore it.";;
20938 *) . ./config.over
20939 echo "Configuration override changes have been loaded."
20940 ;;
20941 esac
20942fi
20943
20944: in case they want portability, strip down executable paths
20945case "$d_portable" in
20946"$define")
20947 echo " "
20948 echo "Stripping down executable paths..." >&4
20949 for file in $loclist $trylist; do
534ac15a
JH
20950 eval temp=\$$file
20951 eval $file=`basename $temp`
5f80c64f
JH
20952 done
20953 ;;
20954esac
20955
20956: create config.sh file
20957echo " "
20958echo "Creating config.sh..." >&4
20959$spitshell <<EOT >config.sh
20960$startsh
20961#
20962# This file was produced by running the Configure script. It holds all the
20963# definitions figured out by Configure. Should you modify one of these values,
20964# do not forget to propagate your changes by running "Configure -der". You may
20965# instead choose to run each of the .SH files by yourself, or "Configure -S".
20966#
20967
20968# Package name : $package
20969# Source directory : $src
20970# Configuration time: $cf_time
20971# Configured by : $cf_by
20972# Target system : $myuname
20973
20974Author='$Author'
20975Date='$Date'
20976Header='$Header'
20977Id='$Id'
20978Locker='$Locker'
20979Log='$Log'
20980Mcc='$Mcc'
20981RCSfile='$RCSfile'
20982Revision='$Revision'
20983Source='$Source'
20984State='$State'
20985_a='$_a'
20986_exe='$_exe'
20987_o='$_o'
b4eb6b3d 20988afs='$afs'
a6d26a0d 20989afsroot='$afsroot'
b4eb6b3d
JH
20990alignbytes='$alignbytes'
20991ansi2knr='$ansi2knr'
20992aphostname='$aphostname'
20993api_revision='$api_revision'
20994api_subversion='$api_subversion'
20995api_version='$api_version'
20996api_versionstring='$api_versionstring'
5f80c64f 20997ar='$ar'
b4eb6b3d
JH
20998archlib='$archlib'
20999archlibexp='$archlibexp'
21000archname64='$archname64'
21001archname='$archname'
5f80c64f 21002archobjs='$archobjs'
10bc17b6 21003asctime_r_proto='$asctime_r_proto'
5f80c64f 21004awk='$awk'
b4eb6b3d 21005baserev='$baserev'
5f80c64f 21006bash='$bash'
b4eb6b3d 21007bin='$bin'
b4eb6b3d 21008binexp='$binexp'
5f80c64f
JH
21009bison='$bison'
21010byacc='$byacc'
b4eb6b3d 21011byteorder='$byteorder'
5f80c64f 21012c='$c'
b4eb6b3d 21013castflags='$castflags'
5f80c64f
JH
21014cat='$cat'
21015cc='$cc'
21016cccdlflags='$cccdlflags'
21017ccdlflags='$ccdlflags'
21018ccflags='$ccflags'
b4eb6b3d 21019ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21020ccname='$ccname'
b4eb6b3d 21021ccsymbols='$ccsymbols'
6b356c8e 21022ccversion='$ccversion'
5f80c64f 21023cf_by='$cf_by'
b4eb6b3d 21024cf_email='$cf_email'
5f80c64f 21025cf_time='$cf_time'
b4eb6b3d 21026charsize='$charsize'
5f80c64f
JH
21027chgrp='$chgrp'
21028chmod='$chmod'
21029chown='$chown'
b4eb6b3d 21030clocktype='$clocktype'
5f80c64f
JH
21031comm='$comm'
21032compress='$compress'
21033contains='$contains'
21034cp='$cp'
21035cpio='$cpio'
21036cpp='$cpp'
b4eb6b3d
JH
21037cpp_stuff='$cpp_stuff'
21038cppccsymbols='$cppccsymbols'
5f80c64f
JH
21039cppflags='$cppflags'
21040cpplast='$cpplast'
21041cppminus='$cppminus'
21042cpprun='$cpprun'
21043cppstdin='$cppstdin'
b4eb6b3d 21044cppsymbols='$cppsymbols'
10bc17b6 21045crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21046cryptlib='$cryptlib'
5f80c64f 21047csh='$csh'
10bc17b6
JH
21048ctermid_r_proto='$ctermid_r_proto'
21049ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21050d_Gconvert='$d_Gconvert'
21051d_PRIEUldbl='$d_PRIEUldbl'
21052d_PRIFUldbl='$d_PRIFUldbl'
21053d_PRIGUldbl='$d_PRIGUldbl'
21054d_PRIXU64='$d_PRIXU64'
21055d_PRId64='$d_PRId64'
21056d_PRIeldbl='$d_PRIeldbl'
21057d_PRIfldbl='$d_PRIfldbl'
21058d_PRIgldbl='$d_PRIgldbl'
21059d_PRIi64='$d_PRIi64'
21060d_PRIo64='$d_PRIo64'
21061d_PRIu64='$d_PRIu64'
21062d_PRIx64='$d_PRIx64'
21063d_SCNfldbl='$d_SCNfldbl'
74cac757 21064d__fwalk='$d__fwalk'
b4eb6b3d
JH
21065d_access='$d_access'
21066d_accessx='$d_accessx'
55954f19 21067d_aintl='$d_aintl'
b4eb6b3d
JH
21068d_alarm='$d_alarm'
21069d_archlib='$d_archlib'
10bc17b6 21070d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21071d_atolf='$d_atolf'
21072d_atoll='$d_atoll'
0dbb1585
AL
21073d_attribute_format='$d_attribute_format'
21074d_attribute_malloc='$d_attribute_malloc'
21075d_attribute_nonnull='$d_attribute_nonnull'
21076d_attribute_noreturn='$d_attribute_noreturn'
21077d_attribute_pure='$d_attribute_pure'
21078d_attribute_unused='$d_attribute_unused'
21079d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21080d_bcmp='$d_bcmp'
21081d_bcopy='$d_bcopy'
5f80c64f 21082d_bsd='$d_bsd'
b4eb6b3d
JH
21083d_bsdgetpgrp='$d_bsdgetpgrp'
21084d_bsdsetpgrp='$d_bsdsetpgrp'
21085d_bzero='$d_bzero'
21086d_casti32='$d_casti32'
21087d_castneg='$d_castneg'
21088d_charvspr='$d_charvspr'
21089d_chown='$d_chown'
21090d_chroot='$d_chroot'
21091d_chsize='$d_chsize'
758a5d79 21092d_class='$d_class'
b0a2e8e6 21093d_clearenv='$d_clearenv'
b4eb6b3d 21094d_closedir='$d_closedir'
4e0554ec 21095d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21096d_const='$d_const'
55954f19 21097d_copysignl='$d_copysignl'
b4eb6b3d 21098d_crypt='$d_crypt'
10bc17b6 21099d_crypt_r='$d_crypt_r'
b4eb6b3d 21100d_csh='$d_csh'
10bc17b6
JH
21101d_ctermid_r='$d_ctermid_r'
21102d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21103d_cuserid='$d_cuserid'
21104d_dbl_dig='$d_dbl_dig'
2ef53570 21105d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21106d_difftime='$d_difftime'
ae0e3d3b 21107d_dirfd='$d_dirfd'
b4eb6b3d
JH
21108d_dirnamlen='$d_dirnamlen'
21109d_dlerror='$d_dlerror'
5f80c64f 21110d_dlopen='$d_dlopen'
b4eb6b3d
JH
21111d_dlsymun='$d_dlsymun'
21112d_dosuid='$d_dosuid'
10bc17b6 21113d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21114d_drand48proto='$d_drand48proto'
21115d_dup2='$d_dup2'
21116d_eaccess='$d_eaccess'
21117d_endgrent='$d_endgrent'
10bc17b6 21118d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21119d_endhent='$d_endhent'
10bc17b6 21120d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21121d_endnent='$d_endnent'
10bc17b6 21122d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21123d_endpent='$d_endpent'
10bc17b6 21124d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21125d_endpwent='$d_endpwent'
10bc17b6 21126d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21127d_endsent='$d_endsent'
10bc17b6 21128d_endservent_r='$d_endservent_r'
b4eb6b3d 21129d_eofnblk='$d_eofnblk'
5f80c64f 21130d_eunice='$d_eunice'
15b61c98 21131d_faststdio='$d_faststdio'
b363b713 21132d_fchdir='$d_fchdir'
b4eb6b3d
JH
21133d_fchmod='$d_fchmod'
21134d_fchown='$d_fchown'
21135d_fcntl='$d_fcntl'
9d9004a9 21136d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21137d_fd_macros='$d_fd_macros'
21138d_fd_set='$d_fd_set'
21139d_fds_bits='$d_fds_bits'
21140d_fgetpos='$d_fgetpos'
758a5d79
JH
21141d_finite='$d_finite'
21142d_finitel='$d_finitel'
b4eb6b3d
JH
21143d_flexfnam='$d_flexfnam'
21144d_flock='$d_flock'
2ef53570 21145d_flockproto='$d_flockproto'
b4eb6b3d 21146d_fork='$d_fork'
758a5d79 21147d_fp_class='$d_fp_class'
b4eb6b3d 21148d_fpathconf='$d_fpathconf'
758a5d79
JH
21149d_fpclass='$d_fpclass'
21150d_fpclassify='$d_fpclassify'
21151d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21152d_fpos64_t='$d_fpos64_t'
21153d_frexpl='$d_frexpl'
21154d_fs_data_s='$d_fs_data_s'
21155d_fseeko='$d_fseeko'
21156d_fsetpos='$d_fsetpos'
21157d_fstatfs='$d_fstatfs'
21158d_fstatvfs='$d_fstatvfs'
411ab01c 21159d_fsync='$d_fsync'
b4eb6b3d
JH
21160d_ftello='$d_ftello'
21161d_ftime='$d_ftime'
dc814df1 21162d_futimes='$d_futimes'
b4eb6b3d
JH
21163d_getcwd='$d_getcwd'
21164d_getespwnam='$d_getespwnam'
21165d_getfsstat='$d_getfsstat'
21166d_getgrent='$d_getgrent'
10bc17b6
JH
21167d_getgrent_r='$d_getgrent_r'
21168d_getgrgid_r='$d_getgrgid_r'
21169d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21170d_getgrps='$d_getgrps'
21171d_gethbyaddr='$d_gethbyaddr'
21172d_gethbyname='$d_gethbyname'
21173d_gethent='$d_gethent'
21174d_gethname='$d_gethname'
10bc17b6
JH
21175d_gethostbyaddr_r='$d_gethostbyaddr_r'
21176d_gethostbyname_r='$d_gethostbyname_r'
21177d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21178d_gethostprotos='$d_gethostprotos'
4e0554ec 21179d_getitimer='$d_getitimer'
b4eb6b3d 21180d_getlogin='$d_getlogin'
10bc17b6 21181d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21182d_getmnt='$d_getmnt'
21183d_getmntent='$d_getmntent'
21184d_getnbyaddr='$d_getnbyaddr'
21185d_getnbyname='$d_getnbyname'
21186d_getnent='$d_getnent'
10bc17b6
JH
21187d_getnetbyaddr_r='$d_getnetbyaddr_r'
21188d_getnetbyname_r='$d_getnetbyname_r'
21189d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21190d_getnetprotos='$d_getnetprotos'
0c0643d0 21191d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21192d_getpbyname='$d_getpbyname'
21193d_getpbynumber='$d_getpbynumber'
21194d_getpent='$d_getpent'
21195d_getpgid='$d_getpgid'
21196d_getpgrp2='$d_getpgrp2'
21197d_getpgrp='$d_getpgrp'
21198d_getppid='$d_getppid'
21199d_getprior='$d_getprior'
10bc17b6
JH
21200d_getprotobyname_r='$d_getprotobyname_r'
21201d_getprotobynumber_r='$d_getprotobynumber_r'
21202d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21203d_getprotoprotos='$d_getprotoprotos'
21204d_getprpwnam='$d_getprpwnam'
21205d_getpwent='$d_getpwent'
10bc17b6
JH
21206d_getpwent_r='$d_getpwent_r'
21207d_getpwnam_r='$d_getpwnam_r'
21208d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21209d_getsbyname='$d_getsbyname'
21210d_getsbyport='$d_getsbyport'
21211d_getsent='$d_getsent'
10bc17b6
JH
21212d_getservbyname_r='$d_getservbyname_r'
21213d_getservbyport_r='$d_getservbyport_r'
21214d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21215d_getservprotos='$d_getservprotos'
21216d_getspnam='$d_getspnam'
10bc17b6 21217d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21218d_gettimeod='$d_gettimeod'
10bc17b6 21219d_gmtime_r='$d_gmtime_r'
5f80c64f 21220d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21221d_grpasswd='$d_grpasswd'
21222d_hasmntopt='$d_hasmntopt'
21223d_htonl='$d_htonl'
55954f19 21224d_ilogbl='$d_ilogbl'
b4eb6b3d
JH
21225d_index='$d_index'
21226d_inetaton='$d_inetaton'
21227d_int64_t='$d_int64_t'
21228d_isascii='$d_isascii'
758a5d79
JH
21229d_isfinite='$d_isfinite'
21230d_isinf='$d_isinf'
b4eb6b3d
JH
21231d_isnan='$d_isnan'
21232d_isnanl='$d_isnanl'
21233d_killpg='$d_killpg'
21234d_lchown='$d_lchown'
21235d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21236d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21237d_link='$d_link'
10bc17b6 21238d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
21239d_locconv='$d_locconv'
21240d_lockf='$d_lockf'
21241d_longdbl='$d_longdbl'
21242d_longlong='$d_longlong'
21243d_lseekproto='$d_lseekproto'
21244d_lstat='$d_lstat'
21245d_madvise='$d_madvise'
7dd121ae
MB
21246d_malloc_good_size='$d_malloc_good_size'
21247d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21248d_mblen='$d_mblen'
21249d_mbstowcs='$d_mbstowcs'
21250d_mbtowc='$d_mbtowc'
21251d_memchr='$d_memchr'
21252d_memcmp='$d_memcmp'
21253d_memcpy='$d_memcpy'
21254d_memmove='$d_memmove'
21255d_memset='$d_memset'
21256d_mkdir='$d_mkdir'
21257d_mkdtemp='$d_mkdtemp'
21258d_mkfifo='$d_mkfifo'
21259d_mkstemp='$d_mkstemp'
21260d_mkstemps='$d_mkstemps'
21261d_mktime='$d_mktime'
21262d_mmap='$d_mmap'
21263d_modfl='$d_modfl'
e67aeab1 21264d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21265d_modflproto='$d_modflproto'
b4eb6b3d
JH
21266d_mprotect='$d_mprotect'
21267d_msg='$d_msg'
21268d_msg_ctrunc='$d_msg_ctrunc'
21269d_msg_dontroute='$d_msg_dontroute'
21270d_msg_oob='$d_msg_oob'
21271d_msg_peek='$d_msg_peek'
21272d_msg_proxy='$d_msg_proxy'
21273d_msgctl='$d_msgctl'
21274d_msgget='$d_msgget'
4e0554ec 21275d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21276d_msgrcv='$d_msgrcv'
21277d_msgsnd='$d_msgsnd'
21278d_msync='$d_msync'
21279d_munmap='$d_munmap'
21280d_mymalloc='$d_mymalloc'
21281d_nice='$d_nice'
2765b840 21282d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21283d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21284d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21285d_off64_t='$d_off64_t'
21286d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21287d_oldpthreads='$d_oldpthreads'
21288d_oldsock='$d_oldsock'
21289d_open3='$d_open3'
21290d_pathconf='$d_pathconf'
21291d_pause='$d_pause'
21292d_perl_otherlibdirs='$d_perl_otherlibdirs'
21293d_phostname='$d_phostname'
21294d_pipe='$d_pipe'
21295d_poll='$d_poll'
5f80c64f 21296d_portable='$d_portable'
c7aff470 21297d_procselfexe='$d_procselfexe'
d6483fcc 21298d_pthread_atfork='$d_pthread_atfork'
58d975c3 21299d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21300d_pthread_yield='$d_pthread_yield'
21301d_pwage='$d_pwage'
21302d_pwchange='$d_pwchange'
21303d_pwclass='$d_pwclass'
21304d_pwcomment='$d_pwcomment'
21305d_pwexpire='$d_pwexpire'
21306d_pwgecos='$d_pwgecos'
21307d_pwpasswd='$d_pwpasswd'
21308d_pwquota='$d_pwquota'
21309d_qgcvt='$d_qgcvt'
21310d_quad='$d_quad'
10bc17b6
JH
21311d_random_r='$d_random_r'
21312d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21313d_readdir='$d_readdir'
10bc17b6 21314d_readdir_r='$d_readdir_r'
b4eb6b3d 21315d_readlink='$d_readlink'
4e0554ec
JH
21316d_readv='$d_readv'
21317d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21318d_rename='$d_rename'
21319d_rewinddir='$d_rewinddir'
21320d_rmdir='$d_rmdir'
21321d_safebcpy='$d_safebcpy'
21322d_safemcpy='$d_safemcpy'
21323d_sanemcmp='$d_sanemcmp'
ef9f17be 21324d_sbrkproto='$d_sbrkproto'
55954f19 21325d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21326d_sched_yield='$d_sched_yield'
21327d_scm_rights='$d_scm_rights'
21328d_seekdir='$d_seekdir'
21329d_select='$d_select'
21330d_sem='$d_sem'
21331d_semctl='$d_semctl'
21332d_semctl_semid_ds='$d_semctl_semid_ds'
21333d_semctl_semun='$d_semctl_semun'
21334d_semget='$d_semget'
21335d_semop='$d_semop'
4e0554ec 21336d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21337d_setegid='$d_setegid'
21338d_seteuid='$d_seteuid'
21339d_setgrent='$d_setgrent'
10bc17b6 21340d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21341d_setgrps='$d_setgrps'
21342d_sethent='$d_sethent'
10bc17b6 21343d_sethostent_r='$d_sethostent_r'
4e0554ec 21344d_setitimer='$d_setitimer'
b4eb6b3d
JH
21345d_setlinebuf='$d_setlinebuf'
21346d_setlocale='$d_setlocale'
10bc17b6 21347d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21348d_setnent='$d_setnent'
10bc17b6 21349d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21350d_setpent='$d_setpent'
21351d_setpgid='$d_setpgid'
21352d_setpgrp2='$d_setpgrp2'
21353d_setpgrp='$d_setpgrp'
21354d_setprior='$d_setprior'
21355d_setproctitle='$d_setproctitle'
10bc17b6 21356d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21357d_setpwent='$d_setpwent'
10bc17b6 21358d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21359d_setregid='$d_setregid'
21360d_setresgid='$d_setresgid'
21361d_setresuid='$d_setresuid'
21362d_setreuid='$d_setreuid'
21363d_setrgid='$d_setrgid'
21364d_setruid='$d_setruid'
21365d_setsent='$d_setsent'
10bc17b6 21366d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21367d_setsid='$d_setsid'
21368d_setvbuf='$d_setvbuf'
21369d_sfio='$d_sfio'
21370d_shm='$d_shm'
21371d_shmat='$d_shmat'
21372d_shmatprototype='$d_shmatprototype'
21373d_shmctl='$d_shmctl'
21374d_shmdt='$d_shmdt'
21375d_shmget='$d_shmget'
21376d_sigaction='$d_sigaction'
983dbef6 21377d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21378d_sigsetjmp='$d_sigsetjmp'
49a78c82 21379d_sockatmark='$d_sockatmark'
2ef53570 21380d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21381d_socket='$d_socket'
21382d_socklen_t='$d_socklen_t'
21383d_sockpair='$d_sockpair'
21384d_socks5_init='$d_socks5_init'
360321b3 21385d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21386d_sqrtl='$d_sqrtl'
10bc17b6
JH
21387d_srand48_r='$d_srand48_r'
21388d_srandom_r='$d_srandom_r'
eef837ea 21389d_sresgproto='$d_sresgproto'
640374d0 21390d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21391d_statblks='$d_statblks'
21392d_statfs_f_flags='$d_statfs_f_flags'
21393d_statfs_s='$d_statfs_s'
21394d_statvfs='$d_statvfs'
21395d_stdio_cnt_lval='$d_stdio_cnt_lval'
21396d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21397d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21398d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21399d_stdio_stream_array='$d_stdio_stream_array'
21400d_stdiobase='$d_stdiobase'
21401d_stdstdio='$d_stdstdio'
21402d_strchr='$d_strchr'
21403d_strcoll='$d_strcoll'
21404d_strctcpy='$d_strctcpy'
21405d_strerrm='$d_strerrm'
21406d_strerror='$d_strerror'
10bc17b6 21407d_strerror_r='$d_strerror_r'
b3c85772 21408d_strftime='$d_strftime'
08c92000
MB
21409d_strlcat='$d_strlcat'
21410d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21411d_strtod='$d_strtod'
21412d_strtol='$d_strtol'
21413d_strtold='$d_strtold'
21414d_strtoll='$d_strtoll'
28e5dec8 21415d_strtoq='$d_strtoq'
b4eb6b3d
JH
21416d_strtoul='$d_strtoul'
21417d_strtoull='$d_strtoull'
21418d_strtouq='$d_strtouq'
21419d_strxfrm='$d_strxfrm'
21420d_suidsafe='$d_suidsafe'
21421d_symlink='$d_symlink'
21422d_syscall='$d_syscall'
2ef53570 21423d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21424d_sysconf='$d_sysconf'
21425d_sysernlst='$d_sysernlst'
21426d_syserrlst='$d_syserrlst'
21427d_system='$d_system'
21428d_tcgetpgrp='$d_tcgetpgrp'
21429d_tcsetpgrp='$d_tcsetpgrp'
21430d_telldir='$d_telldir'
21431d_telldirproto='$d_telldirproto'
21432d_time='$d_time'
21433d_times='$d_times'
14b90194
JH
21434d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21435d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21436d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21437d_truncate='$d_truncate'
10bc17b6 21438d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21439d_tzname='$d_tzname'
4e0554ec
JH
21440d_u32align='$d_u32align'
21441d_ualarm='$d_ualarm'
b4eb6b3d
JH
21442d_umask='$d_umask'
21443d_uname='$d_uname'
21444d_union_semun='$d_union_semun'
758a5d79 21445d_unordered='$d_unordered'
bdf33aa7 21446d_unsetenv='$d_unsetenv'
4e0554ec 21447d_usleep='$d_usleep'
2ef53570 21448d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21449d_ustat='$d_ustat'
21450d_vendorarch='$d_vendorarch'
21451d_vendorbin='$d_vendorbin'
21452d_vendorlib='$d_vendorlib'
6e1038e0 21453d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21454d_vfork='$d_vfork'
21455d_void_closedir='$d_void_closedir'
21456d_voidsig='$d_voidsig'
21457d_voidtty='$d_voidtty'
21458d_volatile='$d_volatile'
21459d_vprintf='$d_vprintf'
21460d_wait4='$d_wait4'
21461d_waitpid='$d_waitpid'
21462d_wcstombs='$d_wcstombs'
21463d_wctomb='$d_wctomb'
4e0554ec 21464d_writev='$d_writev'
5f80c64f
JH
21465d_xenix='$d_xenix'
21466date='$date'
b4eb6b3d
JH
21467db_hashtype='$db_hashtype'
21468db_prefixtype='$db_prefixtype'
640374d0
JH
21469db_version_major='$db_version_major'
21470db_version_minor='$db_version_minor'
21471db_version_patch='$db_version_patch'
b4eb6b3d
JH
21472defvoidused='$defvoidused'
21473direntrytype='$direntrytype'
21474dlext='$dlext'
5f80c64f 21475dlsrc='$dlsrc'
b4eb6b3d
JH
21476doublesize='$doublesize'
21477drand01='$drand01'
10bc17b6 21478drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21479dynamic_ext='$dynamic_ext'
21480eagain='$eagain'
21481ebcdic='$ebcdic'
5f80c64f
JH
21482echo='$echo'
21483egrep='$egrep'
21484emacs='$emacs'
10bc17b6
JH
21485endgrent_r_proto='$endgrent_r_proto'
21486endhostent_r_proto='$endhostent_r_proto'
21487endnetent_r_proto='$endnetent_r_proto'
21488endprotoent_r_proto='$endprotoent_r_proto'
21489endpwent_r_proto='$endpwent_r_proto'
21490endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21491eunicefix='$eunicefix'
21492exe_ext='$exe_ext'
21493expr='$expr'
b4eb6b3d 21494extensions='$extensions'
6fcddf3b 21495extras='$extras'
b4eb6b3d
JH
21496fflushNULL='$fflushNULL'
21497fflushall='$fflushall'
5f80c64f
JH
21498find='$find'
21499firstmakefile='$firstmakefile'
21500flex='$flex'
b4eb6b3d
JH
21501fpossize='$fpossize'
21502fpostype='$fpostype'
21503freetype='$freetype'
5440bc8e 21504from='$from'
b4eb6b3d
JH
21505full_ar='$full_ar'
21506full_csh='$full_csh'
21507full_sed='$full_sed'
2d736872 21508gccansipedantic='$gccansipedantic'
5b463ca7 21509gccosandvers='$gccosandvers'
5f80c64f 21510gccversion='$gccversion'
10bc17b6
JH
21511getgrent_r_proto='$getgrent_r_proto'
21512getgrgid_r_proto='$getgrgid_r_proto'
21513getgrnam_r_proto='$getgrnam_r_proto'
21514gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21515gethostbyname_r_proto='$gethostbyname_r_proto'
21516gethostent_r_proto='$gethostent_r_proto'
21517getlogin_r_proto='$getlogin_r_proto'
21518getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21519getnetbyname_r_proto='$getnetbyname_r_proto'
21520getnetent_r_proto='$getnetent_r_proto'
21521getprotobyname_r_proto='$getprotobyname_r_proto'
21522getprotobynumber_r_proto='$getprotobynumber_r_proto'
21523getprotoent_r_proto='$getprotoent_r_proto'
21524getpwent_r_proto='$getpwent_r_proto'
21525getpwnam_r_proto='$getpwnam_r_proto'
21526getpwuid_r_proto='$getpwuid_r_proto'
21527getservbyname_r_proto='$getservbyname_r_proto'
21528getservbyport_r_proto='$getservbyport_r_proto'
21529getservent_r_proto='$getservent_r_proto'
21530getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21531gidformat='$gidformat'
21532gidsign='$gidsign'
21533gidsize='$gidsize'
21534gidtype='$gidtype'
5f80c64f 21535glibpth='$glibpth'
3c728e00 21536gmake='$gmake'
10bc17b6 21537gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21538gnulibc_version='$gnulibc_version'
5f80c64f 21539grep='$grep'
b4eb6b3d
JH
21540groupcat='$groupcat'
21541groupstype='$groupstype'
5f80c64f 21542gzip='$gzip'
b4eb6b3d
JH
21543h_fcntl='$h_fcntl'
21544h_sysfile='$h_sysfile'
5f80c64f 21545hint='$hint'
b4eb6b3d 21546hostcat='$hostcat'
6e1038e0
MB
21547html1dir='$html1dir'
21548html1direxp='$html1direxp'
21549html3dir='$html3dir'
21550html3direxp='$html3direxp'
b4eb6b3d
JH
21551i16size='$i16size'
21552i16type='$i16type'
21553i32size='$i32size'
21554i32type='$i32type'
21555i64size='$i64size'
21556i64type='$i64type'
21557i8size='$i8size'
21558i8type='$i8type'
21559i_arpainet='$i_arpainet'
21560i_bsdioctl='$i_bsdioctl'
10bc17b6 21561i_crypt='$i_crypt'
b4eb6b3d
JH
21562i_db='$i_db'
21563i_dbm='$i_dbm'
21564i_dirent='$i_dirent'
5f80c64f 21565i_dld='$i_dld'
b4eb6b3d
JH
21566i_dlfcn='$i_dlfcn'
21567i_fcntl='$i_fcntl'
21568i_float='$i_float'
758a5d79
JH
21569i_fp='$i_fp'
21570i_fp_class='$i_fp_class'
b4eb6b3d
JH
21571i_gdbm='$i_gdbm'
21572i_grp='$i_grp'
b4eb6b3d
JH
21573i_ieeefp='$i_ieeefp'
21574i_inttypes='$i_inttypes'
2765b840 21575i_langinfo='$i_langinfo'
b4eb6b3d
JH
21576i_libutil='$i_libutil'
21577i_limits='$i_limits'
21578i_locale='$i_locale'
21579i_machcthr='$i_machcthr'
21580i_malloc='$i_malloc'
21581i_math='$i_math'
21582i_memory='$i_memory'
21583i_mntent='$i_mntent'
21584i_ndbm='$i_ndbm'
21585i_netdb='$i_netdb'
21586i_neterrno='$i_neterrno'
21587i_netinettcp='$i_netinettcp'
21588i_niin='$i_niin'
21589i_poll='$i_poll'
21590i_prot='$i_prot'
21591i_pthread='$i_pthread'
21592i_pwd='$i_pwd'
21593i_rpcsvcdbm='$i_rpcsvcdbm'
21594i_sfio='$i_sfio'
21595i_sgtty='$i_sgtty'
21596i_shadow='$i_shadow'
21597i_socks='$i_socks'
21598i_stdarg='$i_stdarg'
21599i_stddef='$i_stddef'
21600i_stdlib='$i_stdlib'
21601i_string='$i_string'
21602i_sunmath='$i_sunmath'
21603i_sysaccess='$i_sysaccess'
21604i_sysdir='$i_sysdir'
21605i_sysfile='$i_sysfile'
21606i_sysfilio='$i_sysfilio'
21607i_sysin='$i_sysin'
21608i_sysioctl='$i_sysioctl'
21609i_syslog='$i_syslog'
21610i_sysmman='$i_sysmman'
21611i_sysmode='$i_sysmode'
21612i_sysmount='$i_sysmount'
21613i_sysndir='$i_sysndir'
21614i_sysparam='$i_sysparam'
21615i_sysresrc='$i_sysresrc'
21616i_syssecrt='$i_syssecrt'
21617i_sysselct='$i_sysselct'
21618i_syssockio='$i_syssockio'
21619i_sysstat='$i_sysstat'
21620i_sysstatfs='$i_sysstatfs'
21621i_sysstatvfs='$i_sysstatvfs'
21622i_systime='$i_systime'
21623i_systimek='$i_systimek'
21624i_systimes='$i_systimes'
21625i_systypes='$i_systypes'
21626i_sysuio='$i_sysuio'
21627i_sysun='$i_sysun'
21628i_sysutsname='$i_sysutsname'
21629i_sysvfs='$i_sysvfs'
21630i_syswait='$i_syswait'
21631i_termio='$i_termio'
21632i_termios='$i_termios'
21633i_time='$i_time'
21634i_unistd='$i_unistd'
21635i_ustat='$i_ustat'
21636i_utime='$i_utime'
21637i_values='$i_values'
21638i_varargs='$i_varargs'
21639i_varhdr='$i_varhdr'
21640i_vfork='$i_vfork'
5f80c64f 21641ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21642inc_version_list='$inc_version_list'
21643inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21644incpath='$incpath'
21645inews='$inews'
b4eb6b3d
JH
21646installarchlib='$installarchlib'
21647installbin='$installbin'
6e1038e0
MB
21648installhtml1dir='$installhtml1dir'
21649installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21650installman1dir='$installman1dir'
21651installman3dir='$installman3dir'
21652installprefix='$installprefix'
21653installprefixexp='$installprefixexp'
21654installprivlib='$installprivlib'
21655installscript='$installscript'
21656installsitearch='$installsitearch'
21657installsitebin='$installsitebin'
8d2cbf27
JH
21658installsitehtml1dir='$installsitehtml1dir'
21659installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21660installsitelib='$installsitelib'
91e123a8
JH
21661installsiteman1dir='$installsiteman1dir'
21662installsiteman3dir='$installsiteman3dir'
6e1038e0 21663installsitescript='$installsitescript'
b4eb6b3d
JH
21664installstyle='$installstyle'
21665installusrbinperl='$installusrbinperl'
21666installvendorarch='$installvendorarch'
21667installvendorbin='$installvendorbin'
8d2cbf27
JH
21668installvendorhtml1dir='$installvendorhtml1dir'
21669installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21670installvendorlib='$installvendorlib'
91e123a8
JH
21671installvendorman1dir='$installvendorman1dir'
21672installvendorman3dir='$installvendorman3dir'
6e1038e0 21673installvendorscript='$installvendorscript'
b4eb6b3d 21674intsize='$intsize'
4b661809 21675issymlink='$issymlink'
b4eb6b3d
JH
21676ivdformat='$ivdformat'
21677ivsize='$ivsize'
21678ivtype='$ivtype'
21679known_extensions='$known_extensions'
5f80c64f 21680ksh='$ksh'
5f80c64f
JH
21681ld='$ld'
21682lddlflags='$lddlflags'
21683ldflags='$ldflags'
b4eb6b3d
JH
21684ldflags_uselargefiles='$ldflags_uselargefiles'
21685ldlibpthname='$ldlibpthname'
5f80c64f
JH
21686less='$less'
21687lib_ext='$lib_ext'
21688libc='$libc'
b4eb6b3d 21689libperl='$libperl'
5f80c64f
JH
21690libpth='$libpth'
21691libs='$libs'
43999f95
JH
21692libsdirs='$libsdirs'
21693libsfiles='$libsfiles'
21694libsfound='$libsfound'
13b3f787 21695libspath='$libspath'
5f80c64f 21696libswanted='$libswanted'
b4eb6b3d 21697libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21698line='$line'
21699lint='$lint'
21700lkflags='$lkflags'
21701ln='$ln'
21702lns='$lns'
10bc17b6 21703localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21704locincpth='$locincpth'
21705loclibpth='$loclibpth'
b4eb6b3d
JH
21706longdblsize='$longdblsize'
21707longlongsize='$longlongsize'
21708longsize='$longsize'
5f80c64f
JH
21709lp='$lp'
21710lpr='$lpr'
21711ls='$ls'
b4eb6b3d
JH
21712lseeksize='$lseeksize'
21713lseektype='$lseektype'
5f80c64f
JH
21714mail='$mail'
21715mailx='$mailx'
21716make='$make'
21717make_set_make='$make_set_make'
b4eb6b3d
JH
21718mallocobj='$mallocobj'
21719mallocsrc='$mallocsrc'
21720malloctype='$malloctype'
21721man1dir='$man1dir'
21722man1direxp='$man1direxp'
21723man1ext='$man1ext'
21724man3dir='$man3dir'
21725man3direxp='$man3direxp'
21726man3ext='$man3ext'
5f80c64f 21727mips_type='$mips_type'
5129fff4 21728mistrustnm='$mistrustnm'
5f80c64f 21729mkdir='$mkdir'
b4eb6b3d
JH
21730mmaptype='$mmaptype'
21731modetype='$modetype'
5f80c64f 21732more='$more'
b4eb6b3d 21733multiarch='$multiarch'
5f80c64f 21734mv='$mv'
b4eb6b3d
JH
21735myarchname='$myarchname'
21736mydomain='$mydomain'
21737myhostname='$myhostname'
5f80c64f
JH
21738myuname='$myuname'
21739n='$n'
2cc61e15 21740need_va_copy='$need_va_copy'
b4eb6b3d
JH
21741netdb_hlen_type='$netdb_hlen_type'
21742netdb_host_type='$netdb_host_type'
21743netdb_name_type='$netdb_name_type'
21744netdb_net_type='$netdb_net_type'
5f80c64f
JH
21745nm='$nm'
21746nm_opt='$nm_opt'
21747nm_so_opt='$nm_so_opt'
b4eb6b3d 21748nonxs_ext='$nonxs_ext'
5f80c64f 21749nroff='$nroff'
b4eb6b3d
JH
21750nvEUformat='$nvEUformat'
21751nvFUformat='$nvFUformat'
21752nvGUformat='$nvGUformat'
53133ed1 21753nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21754nveformat='$nveformat'
21755nvfformat='$nvfformat'
21756nvgformat='$nvgformat'
21757nvsize='$nvsize'
21758nvtype='$nvtype'
21759o_nonblock='$o_nonblock'
5f80c64f 21760obj_ext='$obj_ext'
b4eb6b3d 21761old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21762optimize='$optimize'
b4eb6b3d 21763orderlib='$orderlib'
5f80c64f
JH
21764osname='$osname'
21765osvers='$osvers'
b4eb6b3d 21766otherlibdirs='$otherlibdirs'
5f80c64f 21767package='$package'
b4eb6b3d
JH
21768pager='$pager'
21769passcat='$passcat'
21770patchlevel='$patchlevel'
5f80c64f 21771path_sep='$path_sep'
b4eb6b3d 21772perl5='$perl5'
5f80c64f 21773perl='$perl'
151e6568 21774perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21775perladmin='$perladmin'
9c839522 21776perllibs='$perllibs'
b4eb6b3d 21777perlpath='$perlpath'
5f80c64f 21778pg='$pg'
b4eb6b3d
JH
21779phostname='$phostname'
21780pidtype='$pidtype'
5f80c64f
JH
21781plibpth='$plibpth'
21782pmake='$pmake'
21783pr='$pr'
b4eb6b3d
JH
21784prefix='$prefix'
21785prefixexp='$prefixexp'
21786privlib='$privlib'
21787privlibexp='$privlibexp'
f24dbf84 21788procselfexe='$procselfexe'
b4eb6b3d
JH
21789prototype='$prototype'
21790ptrsize='$ptrsize'
21791quadkind='$quadkind'
21792quadtype='$quadtype'
21793randbits='$randbits'
21794randfunc='$randfunc'
10bc17b6 21795random_r_proto='$random_r_proto'
b4eb6b3d
JH
21796randseedtype='$randseedtype'
21797ranlib='$ranlib'
21798rd_nodata='$rd_nodata'
10bc17b6
JH
21799readdir64_r_proto='$readdir64_r_proto'
21800readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21801revision='$revision'
5f80c64f
JH
21802rm='$rm'
21803rmail='$rmail'
5440bc8e 21804run='$run'
5f80c64f 21805runnm='$runnm'
b4eb6b3d
JH
21806sPRIEUldbl='$sPRIEUldbl'
21807sPRIFUldbl='$sPRIFUldbl'
21808sPRIGUldbl='$sPRIGUldbl'
21809sPRIXU64='$sPRIXU64'
21810sPRId64='$sPRId64'
21811sPRIeldbl='$sPRIeldbl'
21812sPRIfldbl='$sPRIfldbl'
21813sPRIgldbl='$sPRIgldbl'
21814sPRIi64='$sPRIi64'
21815sPRIo64='$sPRIo64'
21816sPRIu64='$sPRIu64'
21817sPRIx64='$sPRIx64'
21818sSCNfldbl='$sSCNfldbl'
21819sched_yield='$sched_yield'
21820scriptdir='$scriptdir'
21821scriptdirexp='$scriptdirexp'
5f80c64f 21822sed='$sed'
b4eb6b3d
JH
21823seedfunc='$seedfunc'
21824selectminbits='$selectminbits'
21825selecttype='$selecttype'
5f80c64f 21826sendmail='$sendmail'
10bc17b6
JH
21827setgrent_r_proto='$setgrent_r_proto'
21828sethostent_r_proto='$sethostent_r_proto'
21829setlocale_r_proto='$setlocale_r_proto'
21830setnetent_r_proto='$setnetent_r_proto'
21831setprotoent_r_proto='$setprotoent_r_proto'
21832setpwent_r_proto='$setpwent_r_proto'
21833setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
21834sh='$sh'
21835shar='$shar'
21836sharpbang='$sharpbang'
b4eb6b3d
JH
21837shmattype='$shmattype'
21838shortsize='$shortsize'
21839shrpenv='$shrpenv'
5f80c64f 21840shsharp='$shsharp'
b4eb6b3d
JH
21841sig_count='$sig_count'
21842sig_name='$sig_name'
21843sig_name_init='$sig_name_init'
21844sig_num='$sig_num'
21845sig_num_init='$sig_num_init'
76d3c696 21846sig_size='$sig_size'
b4eb6b3d
JH
21847signal_t='$signal_t'
21848sitearch='$sitearch'
21849sitearchexp='$sitearchexp'
21850sitebin='$sitebin'
21851sitebinexp='$sitebinexp'
8d2cbf27
JH
21852sitehtml1dir='$sitehtml1dir'
21853sitehtml1direxp='$sitehtml1direxp'
21854sitehtml3dir='$sitehtml3dir'
21855sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
21856sitelib='$sitelib'
21857sitelib_stem='$sitelib_stem'
21858sitelibexp='$sitelibexp'
91e123a8
JH
21859siteman1dir='$siteman1dir'
21860siteman1direxp='$siteman1direxp'
21861siteman3dir='$siteman3dir'
21862siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
21863siteprefix='$siteprefix'
21864siteprefixexp='$siteprefixexp'
6e1038e0
MB
21865sitescript='$sitescript'
21866sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
21867sizesize='$sizesize'
21868sizetype='$sizetype'
5f80c64f
JH
21869sleep='$sleep'
21870smail='$smail'
5f80c64f 21871so='$so'
b4eb6b3d
JH
21872sockethdr='$sockethdr'
21873socketlib='$socketlib'
21874socksizetype='$socksizetype'
5f80c64f
JH
21875sort='$sort'
21876spackage='$spackage'
21877spitshell='$spitshell'
10bc17b6
JH
21878srand48_r_proto='$srand48_r_proto'
21879srandom_r_proto='$srandom_r_proto'
5f80c64f 21880src='$src'
b4eb6b3d
JH
21881ssizetype='$ssizetype'
21882startperl='$startperl'
5f80c64f 21883startsh='$startsh'
b4eb6b3d
JH
21884static_ext='$static_ext'
21885stdchar='$stdchar'
21886stdio_base='$stdio_base'
21887stdio_bufsiz='$stdio_bufsiz'
21888stdio_cnt='$stdio_cnt'
21889stdio_filbuf='$stdio_filbuf'
21890stdio_ptr='$stdio_ptr'
21891stdio_stream_array='$stdio_stream_array'
10bc17b6 21892strerror_r_proto='$strerror_r_proto'
b4eb6b3d 21893strings='$strings'
5f80c64f 21894submit='$submit'
b4eb6b3d
JH
21895subversion='$subversion'
21896sysman='$sysman'
5f80c64f
JH
21897tail='$tail'
21898tar='$tar'
5440bc8e 21899targetarch='$targetarch'
5f80c64f
JH
21900tbl='$tbl'
21901tee='$tee'
21902test='$test'
b4eb6b3d
JH
21903timeincl='$timeincl'
21904timetype='$timetype'
10bc17b6 21905tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 21906to='$to'
5f80c64f
JH
21907touch='$touch'
21908tr='$tr'
21909trnl='$trnl'
21910troff='$troff'
10bc17b6 21911ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
21912u16size='$u16size'
21913u16type='$u16type'
21914u32size='$u32size'
21915u32type='$u32type'
21916u64size='$u64size'
21917u64type='$u64type'
21918u8size='$u8size'
21919u8type='$u8type'
21920uidformat='$uidformat'
21921uidsign='$uidsign'
21922uidsize='$uidsize'
21923uidtype='$uidtype'
5f80c64f
JH
21924uname='$uname'
21925uniq='$uniq'
b4eb6b3d
JH
21926uquadtype='$uquadtype'
21927use5005threads='$use5005threads'
21928use64bitall='$use64bitall'
21929use64bitint='$use64bitint'
5440bc8e 21930usecrosscompile='$usecrosscompile'
5f80c64f 21931usedl='$usedl'
15b61c98 21932usefaststdio='$usefaststdio'
b4eb6b3d
JH
21933useithreads='$useithreads'
21934uselargefiles='$uselargefiles'
21935uselongdouble='$uselongdouble'
19a100ff 21936usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
21937usemorebits='$usemorebits'
21938usemultiplicity='$usemultiplicity'
21939usemymalloc='$usemymalloc'
5f80c64f 21940usenm='$usenm'
b4eb6b3d
JH
21941useopcode='$useopcode'
21942useperlio='$useperlio'
21943useposix='$useposix'
9514c62b 21944usereentrant='$usereentrant'
d51aaa9d 21945userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
21946usesfio='$usesfio'
21947useshrplib='$useshrplib'
5f106f9c 21948usesitecustomize='$usesitecustomize'
29209bc5 21949usesocks='$usesocks'
b4eb6b3d
JH
21950usethreads='$usethreads'
21951usevendorprefix='$usevendorprefix'
21952usevfork='$usevfork'
5f80c64f
JH
21953usrinc='$usrinc'
21954uuname='$uuname'
b4eb6b3d
JH
21955uvXUformat='$uvXUformat'
21956uvoformat='$uvoformat'
21957uvsize='$uvsize'
21958uvtype='$uvtype'
21959uvuformat='$uvuformat'
21960uvxformat='$uvxformat'
21961vendorarch='$vendorarch'
21962vendorarchexp='$vendorarchexp'
21963vendorbin='$vendorbin'
21964vendorbinexp='$vendorbinexp'
8d2cbf27
JH
21965vendorhtml1dir='$vendorhtml1dir'
21966vendorhtml1direxp='$vendorhtml1direxp'
21967vendorhtml3dir='$vendorhtml3dir'
21968vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
21969vendorlib='$vendorlib'
21970vendorlib_stem='$vendorlib_stem'
21971vendorlibexp='$vendorlibexp'
91e123a8
JH
21972vendorman1dir='$vendorman1dir'
21973vendorman1direxp='$vendorman1direxp'
21974vendorman3dir='$vendorman3dir'
21975vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
21976vendorprefix='$vendorprefix'
21977vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
21978vendorscript='$vendorscript'
21979vendorscriptexp='$vendorscriptexp'
b4eb6b3d 21980version='$version'
861eb78d 21981version_patchlevel_string='$version_patchlevel_string'
d56c5707 21982versiononly='$versiononly'
5f80c64f 21983vi='$vi'
b4eb6b3d 21984voidflags='$voidflags'
5f80c64f 21985xlibpth='$xlibpth'
3659ebf1
JH
21986yacc='$yacc'
21987yaccflags='$yaccflags'
5f80c64f
JH
21988zcat='$zcat'
21989zip='$zip'
21990EOT
21991
21992: Add in command line options if available
21993$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21994
21995: add special variables
21996$test -f $src/patchlevel.h && \
d00b958f 21997awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 21998echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 21999echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22000
22001: propagate old symbols
22002if $test -f UU/config.sh; then
381aa1ff 22003 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22004 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22005 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22006 set X `cat UU/oldsyms`
22007 shift
22008 case $# in
22009 0) ;;
22010 *)
22011 cat <<EOM
22012Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22013EOM
22014 echo "# Variables propagated from previous config.sh file." >>config.sh
22015 for sym in `cat UU/oldsyms`; do
22016 echo " Propagating $hint variable "'$'"$sym..."
22017 eval 'tmp="$'"${sym}"'"'
22018 echo "$tmp" | \
22019 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22020 done
22021 ;;
22022 esac
22023fi
22024
22025: Finish up by extracting the .SH files
22026case "$alldone" in
22027exit)
22028 $rm -rf UU
24ccb310 22029 echo "Extraction done."
5f80c64f
JH
22030 exit 0
22031 ;;
22032cont)
22033 ;;
22034'')
22035 dflt=''
22036 nostick=true
22037 $cat <<EOM
22038
22039If you'd like to make any changes to the config.sh file before I begin
22040to configure things, do it as a shell escape now (e.g. !vi config.sh).
22041
22042EOM
22043 rp="Press return or use a shell escape to edit config.sh:"
22044 . UU/myread
22045 nostick=''
22046 case "$ans" in
22047 '') ;;
22048 *) : in case they cannot read
22049 sh 1>&4 -c "$ans";;
22050 esac
22051 ;;
22052esac
22053
22054: if this fails, just run all the .SH files by hand
22055. ./config.sh
22056
22057echo " "
22058exec 1>&4
a43e8593 22059pwd=`pwd`
5f80c64f 22060. ./UU/extract
6904989c 22061cd "$pwd"
5f80c64f
JH
22062
22063if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22064 dflt=y
22065 case "$silent" in
22066 true) ;;
22067 *)
22068 $cat <<EOM
22069
22070Now you need to generate make dependencies by running "$make depend".
22071You might prefer to run it in background: "$make depend > makedepend.out &"
22072It can take a while, so you might not want to run it right now.
22073
22074EOM
22075 ;;
22076 esac
22077 rp="Run $make depend now?"
22078 . UU/myread
22079 case "$ans" in
22080 y*)
3d5d58b1 22081 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22082 ;;
22083 *)
22084 echo "You must run '$make depend' then '$make'."
22085 ;;
22086 esac
22087elif test -f [Mm]akefile; then
22088 echo " "
22089 echo "Now you must run a $make."
22090else
24ccb310 22091 echo "Configure done."
5f80c64f
JH
22092fi
22093
22094if $test -f Policy.sh; then
22095 $cat <<EOM
22096
22097If you compile $package on a different machine or from a different object
22098directory, copy the Policy.sh file from this object directory to the
22099new one before you run Configure -- this will help you with most of
22100the policy defaults.
22101
22102EOM
22103fi
22104if $test -f config.msg; then
22105 echo "Hmm. I also noted the following information while running:"
22106 echo " "
22107 $cat config.msg >&4
22108 $rm -f config.msg
22109fi
22110$rm -f kit*isdone ark*isdone
22111$rm -rf UU
22112
22113: End of Configure
22114