This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Typo nits from Wolfgang Laun.
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
ad493445 23# Generated on Fri Mar 29 18:09:14 EET 2002 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62 25
283fdd21 26cat >c1$$ <<EOF
2304df62
AD
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
283fdd21 37cat >c2$$ <<EOF
2304df62
AD
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
283fdd21 43true || cat c1$$ c2$$
2304df62
AD
44true || exec sh $0 $argv:q
45
283fdd21 46(exit $?0) || cat c2$$
2304df62 47(exit $?0) || exec sh $0 $argv:q
283fdd21 48rm -f c1$$ c2$$
2304df62 49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
dfe9444c 59: Proper separator for the PATH environment variable
8e07c86e
AD
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
62if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
64 p_=\;
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 67 elif test -n "$DJGPP"; then
495e2cbe
MB
68 case "X${MACHTYPE:-nonesuchmach}" in
69 *cygwin) ;;
70 *) p_=\; ;;
71 esac
dfe9444c 72 fi
39e571d4 73fi
a0d0e21e
LW
74
75: Proper PATH setting
76paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 77paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 78paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 79paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
80paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 84paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
85
86for p in $paths
87do
8e07c86e
AD
88 case "$p_$PATH$p_" in
89 *$p_$p$p_*) ;;
90 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
91 esac
92done
93
8e07c86e 94PATH=.$p_$PATH
2304df62
AD
95export PATH
96
dfe9444c
AD
97: shall we be using ksh?
98inksh=''
99needksh=''
100avoidksh=''
101newsh=/bin/ksh
102changesh=''
ff0cee69 103if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
104 inksh=true
105fi
106if test -f /hp-ux -a -f /bin/ksh; then
107 needksh='to avoid sh bug in "here document" expansion'
108fi
109if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110 if test X`/usr/bin/uname -v` = X4; then
111 avoidksh="to avoid AIX 4's /bin/sh"
112 newsh=/usr/bin/bsh
2304df62 113 fi
dfe9444c 114fi
cf04f91f
JH
115if test -f /osf_boot -a -f /usr/sbin/setld; then
116 if test X`/usr/bin/uname -s` = XOSF1; then
117 avoidksh="to avoid Digital UNIX' ksh"
118 newsh=/bin/sh
119 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120 fi
121fi
dfe9444c
AD
122case "$inksh/$needksh" in
123/[a-z]*)
c4f23d77 124 ENV=''
dfe9444c
AD
125 changesh=true
126 reason="$needksh"
127 ;;
128esac
129case "$inksh/$avoidksh" in
130true/[a-z]*)
131 changesh=true
132 reason="$avoidksh"
133 ;;
134esac
135case "$inksh/$needksh-$avoidksh-" in
136true/--)
a0d0e21e
LW
137 cat <<EOM
138(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 139mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 140EOM
dfe9444c
AD
141 ;;
142esac
143case "$changesh" in
144true)
2e2a97a6 145 export newsh
dfe9444c
AD
146 echo "(Feeding myself to $newsh $reason.)"
147 case "$0" in
148 Configure|*/Configure) exec $newsh $0 "$@";;
149 *) exec $newsh Configure "$@";;
150 esac
151 ;;
152esac
2304df62 153
bfb7748a
AD
154: if needed set CDPATH to a harmless value that is not chatty
155: avoid bash 2.02 problems with empty CDPATH.
156case "$CDPATH" in
157'') ;;
158*) case "$SHELL" in
159 *bash*) CDPATH='.' ;;
160 *) CDPATH='' ;;
161 esac
162 ;;
163esac
2304df62
AD
164: Configure runs within the UU subdirectory
165test -d UU || mkdir UU
8e07c86e 166cd UU && rm -f ./*
2304df62 167
1fef16b3 168
6b356c8e
JH
169ccname=''
170ccversion=''
b4eb6b3d
JH
171ccsymbols=''
172cppccsymbols=''
173cppsymbols=''
5440bc8e
JH
174from=''
175run=''
176targetarch=''
177to=''
178usecrosscompile=''
9c839522 179perllibs=''
b4eb6b3d
JH
180dynamic_ext=''
181extensions=''
182known_extensions=''
183nonxs_ext=''
184static_ext=''
185useopcode=''
186useposix=''
6fcddf3b 187extras=''
ecfc5424 188d_bsd=''
40a7a20a 189d_eunice=''
2304df62
AD
190d_xenix=''
191eunicefix=''
192Mcc=''
dfe9444c 193ar=''
2304df62
AD
194awk=''
195bash=''
196bison=''
197byacc=''
198cat=''
199chgrp=''
200chmod=''
201chown=''
ecfc5424 202comm=''
2304df62
AD
203compress=''
204cp=''
205cpio=''
206cpp=''
207csh=''
208date=''
209echo=''
210egrep=''
211emacs=''
212expr=''
213find=''
214flex=''
3c728e00 215gmake=''
2304df62 216grep=''
8ff267be 217gzip=''
2304df62
AD
218inews=''
219ksh=''
220less=''
221line=''
222lint=''
223ln=''
224lp=''
225lpr=''
226ls=''
227mail=''
228mailx=''
dfe9444c 229make=''
2304df62
AD
230mkdir=''
231more=''
232mv=''
693762b4 233nm=''
2304df62
AD
234nroff=''
235perl=''
236pg=''
237pmake=''
238pr=''
239rm=''
240rmail=''
241sed=''
242sendmail=''
2304df62
AD
243shar=''
244sleep=''
245smail=''
246sort=''
247submit=''
248tail=''
249tar=''
250tbl=''
693762b4 251tee=''
2304df62
AD
252test=''
253touch=''
254tr=''
255troff=''
256uname=''
257uniq=''
258uuname=''
259vi=''
260zcat=''
8ff267be 261zip=''
b4eb6b3d
JH
262full_ar=''
263full_sed=''
a0d0e21e 264libswanted=''
2304df62
AD
265hint=''
266myuname=''
85e6fe83
LW
267osname=''
268osvers=''
2304df62
AD
269Author=''
270Date=''
271Header=''
272Id=''
273Locker=''
274Log=''
275RCSfile=''
276Revision=''
277Source=''
278State=''
dfe9444c
AD
279_a=''
280_exe=''
281_o=''
4633a7c4
LW
282archobjs=''
283exe_ext=''
284firstmakefile=''
285lib_ext=''
286obj_ext=''
287path_sep=''
b4eb6b3d 288afs=''
a6d26a0d 289afsroot=''
b4eb6b3d
JH
290alignbytes=''
291ansi2knr=''
292archlib=''
293archlibexp=''
294d_archlib=''
295installarchlib=''
296archname=''
297myarchname=''
298d_atolf=''
299d_atoll=''
300baserev=''
301bin=''
302binexp=''
303installbin=''
304bincompat5005=''
305d_bincompat5005=''
306byteorder=''
2304df62 307cc=''
2304df62
AD
308ccflags=''
309cppflags=''
310ldflags=''
311lkflags=''
8e07c86e 312locincpth=''
2304df62 313optimize=''
b4eb6b3d 314cf_email=''
2304df62
AD
315cf_by=''
316cf_time=''
b4eb6b3d 317charsize=''
2304df62 318contains=''
b4eb6b3d 319cpp_stuff=''
2304df62
AD
320cpplast=''
321cppminus=''
322cpprun=''
323cppstdin=''
74cac757 324d__fwalk=''
b4eb6b3d
JH
325d_access=''
326d_accessx=''
327d_alarm=''
10bc17b6
JH
328asctime_r_proto=''
329d_asctime_r=''
b4eb6b3d
JH
330d_attribut=''
331d_bcmp=''
332d_bcopy=''
333d_bzero=''
334d_casti32=''
335castflags=''
336d_castneg=''
337d_chown=''
338d_chroot=''
339d_chsize=''
758a5d79 340d_class=''
b4eb6b3d
JH
341d_closedir=''
342d_void_closedir=''
4e0554ec 343d_cmsghdr_s=''
b4eb6b3d
JH
344d_const=''
345cryptlib=''
346d_crypt=''
10bc17b6
JH
347crypt_r_proto=''
348d_crypt_r=''
b4eb6b3d
JH
349d_csh=''
350full_csh=''
10bc17b6
JH
351ctermid_r_proto=''
352d_ctermid_r=''
353ctime_r_proto=''
354d_ctime_r=''
b4eb6b3d
JH
355d_cuserid=''
356d_dbl_dig=''
2ef53570 357d_dbminitproto=''
b4eb6b3d 358d_difftime=''
ae0e3d3b 359d_dirfd=''
b4eb6b3d 360d_dlerror=''
a0d0e21e 361d_dlopen=''
b4eb6b3d
JH
362d_dlsymun=''
363d_dosuid=''
364d_suidsafe=''
10bc17b6
JH
365d_drand48_r=''
366drand48_r_proto=''
b4eb6b3d
JH
367d_drand48proto=''
368d_dup2=''
369d_eaccess=''
370d_endgrent=''
10bc17b6
JH
371d_endgrent_r=''
372endgrent_r_proto=''
b4eb6b3d 373d_endhent=''
10bc17b6
JH
374d_endhostent_r=''
375endhostent_r_proto=''
b4eb6b3d 376d_endnent=''
10bc17b6
JH
377d_endnetent_r=''
378endnetent_r_proto=''
b4eb6b3d 379d_endpent=''
10bc17b6
JH
380d_endprotoent_r=''
381endprotoent_r_proto=''
b4eb6b3d 382d_endpwent=''
10bc17b6
JH
383d_endpwent_r=''
384endpwent_r_proto=''
b4eb6b3d 385d_endsent=''
10bc17b6
JH
386d_endservent_r=''
387endservent_r_proto=''
b363b713 388d_fchdir=''
b4eb6b3d
JH
389d_fchmod=''
390d_fchown=''
391d_fcntl=''
9d9004a9 392d_fcntl_can_lock=''
b4eb6b3d
JH
393d_fd_macros=''
394d_fd_set=''
395d_fds_bits=''
396d_fgetpos=''
758a5d79
JH
397d_finite=''
398d_finitel=''
b4eb6b3d
JH
399d_flexfnam=''
400d_flock=''
2ef53570 401d_flockproto=''
b4eb6b3d 402d_fork=''
758a5d79
JH
403d_fp_class=''
404d_fpclass=''
405d_fpclassify=''
406d_fpclassl=''
b4eb6b3d
JH
407d_fpos64_t=''
408d_frexpl=''
409d_fs_data_s=''
410d_fseeko=''
411d_fsetpos=''
412d_fstatfs=''
411ab01c 413d_fsync=''
b4eb6b3d
JH
414d_ftello=''
415d_ftime=''
416d_gettimeod=''
417d_Gconvert=''
418d_getcwd=''
419d_getespwnam=''
420d_getfsstat=''
421d_getgrent=''
10bc17b6
JH
422d_getgrent_r=''
423getgrent_r_proto=''
424d_getgrgid_r=''
425getgrgid_r_proto=''
426d_getgrnam_r=''
427getgrnam_r_proto=''
b4eb6b3d
JH
428d_getgrps=''
429d_gethbyaddr=''
430d_gethbyname=''
431d_gethent=''
432aphostname=''
433d_gethname=''
434d_phostname=''
435d_uname=''
10bc17b6
JH
436d_gethostbyaddr_r=''
437gethostbyaddr_r_proto=''
438d_gethostbyname_r=''
439gethostbyname_r_proto=''
440d_gethostent_r=''
441gethostent_r_proto=''
b4eb6b3d 442d_gethostprotos=''
4e0554ec 443d_getitimer=''
b4eb6b3d 444d_getlogin=''
10bc17b6
JH
445d_getlogin_r=''
446getlogin_r_proto=''
b4eb6b3d
JH
447d_getmnt=''
448d_getmntent=''
449d_getnbyaddr=''
450d_getnbyname=''
451d_getnent=''
10bc17b6
JH
452d_getnetbyaddr_r=''
453getnetbyaddr_r_proto=''
454d_getnetbyname_r=''
455getnetbyname_r_proto=''
456d_getnetent_r=''
457getnetent_r_proto=''
b4eb6b3d 458d_getnetprotos=''
0c0643d0 459d_getpagsz=''
b4eb6b3d
JH
460d_getpent=''
461d_getpgid=''
462d_getpgrp2=''
463d_bsdgetpgrp=''
464d_getpgrp=''
465d_getppid=''
466d_getprior=''
467d_getpbyname=''
468d_getpbynumber=''
10bc17b6
JH
469d_getprotobyname_r=''
470getprotobyname_r_proto=''
471d_getprotobynumber_r=''
472getprotobynumber_r_proto=''
473d_getprotoent_r=''
474getprotoent_r_proto=''
b4eb6b3d
JH
475d_getprotoprotos=''
476d_getprpwnam=''
477d_getpwent=''
10bc17b6
JH
478d_getpwent_r=''
479getpwent_r_proto=''
480d_getpwnam_r=''
481getpwnam_r_proto=''
482d_getpwuid_r=''
483getpwuid_r_proto=''
b4eb6b3d 484d_getsent=''
10bc17b6
JH
485d_getservbyname_r=''
486getservbyname_r_proto=''
487d_getservbyport_r=''
488getservbyport_r_proto=''
489d_getservent_r=''
490getservent_r_proto=''
b4eb6b3d
JH
491d_getservprotos=''
492d_getspnam=''
10bc17b6
JH
493d_getspnam_r=''
494getspnam_r_proto=''
b4eb6b3d
JH
495d_getsbyname=''
496d_getsbyport=''
10bc17b6
JH
497d_gmtime_r=''
498gmtime_r_proto=''
a4f3eea9 499d_gnulibc=''
b4eb6b3d
JH
500d_hasmntopt=''
501d_htonl=''
b4eb6b3d
JH
502d_inetaton=''
503d_int64_t=''
504d_isascii=''
758a5d79
JH
505d_isfinite=''
506d_isinf=''
b4eb6b3d
JH
507d_isnan=''
508d_isnanl=''
509d_killpg=''
510d_lchown=''
511d_ldbl_dig=''
512d_link=''
10bc17b6
JH
513d_localtime_r=''
514localtime_r_proto=''
b4eb6b3d
JH
515d_locconv=''
516d_lockf=''
517d_longdbl=''
518longdblsize=''
519d_longlong=''
520longlongsize=''
521d_lseekproto=''
522d_lstat=''
523d_madvise=''
524d_mblen=''
525d_mbstowcs=''
526d_mbtowc=''
527d_memchr=''
528d_memcmp=''
529d_memcpy=''
530d_memmove=''
531d_memset=''
532d_mkdir=''
533d_mkdtemp=''
534d_mkfifo=''
535d_mkstemp=''
536d_mkstemps=''
537d_mktime=''
538d_mmap=''
539mmaptype=''
540d_modfl=''
e67aeab1 541d_modfl_pow32_bug=''
b4eb6b3d
JH
542d_mprotect=''
543d_msg=''
544d_msgctl=''
545d_msgget=''
4e0554ec 546d_msghdr_s=''
b4eb6b3d
JH
547d_msgrcv=''
548d_msgsnd=''
549d_msync=''
550d_munmap=''
551d_nice=''
2765b840 552d_nl_langinfo=''
b4eb6b3d
JH
553d_off64_t=''
554d_open3=''
555d_fpathconf=''
556d_pathconf=''
557d_pause=''
558d_pipe=''
559d_poll=''
2304df62 560d_portable=''
a33c94aa 561d_procselfexe=''
f24dbf84 562procselfexe=''
b4eb6b3d
JH
563d_old_pthread_create_joinable=''
564old_pthread_create_joinable=''
d6483fcc 565d_pthread_atfork=''
b4eb6b3d
JH
566d_pthread_yield=''
567d_sched_yield=''
568sched_yield=''
569d_qgcvt=''
10bc17b6
JH
570d_random_r=''
571random_r_proto=''
572d_readdir64_r=''
573readdir64_r_proto=''
b4eb6b3d
JH
574d_readdir=''
575d_rewinddir=''
576d_seekdir=''
577d_telldir=''
10bc17b6
JH
578d_readdir_r=''
579readdir_r_proto=''
b4eb6b3d 580d_readlink=''
4e0554ec
JH
581d_readv=''
582d_recvmsg=''
b4eb6b3d
JH
583d_rename=''
584d_rmdir=''
585d_safebcpy=''
586d_safemcpy=''
587d_sanemcmp=''
ef9f17be 588d_sbrkproto=''
b4eb6b3d
JH
589d_select=''
590d_sem=''
591d_semctl=''
592d_semget=''
593d_semop=''
4e0554ec 594d_sendmsg=''
b4eb6b3d
JH
595d_setegid=''
596d_seteuid=''
597d_setgrent=''
10bc17b6
JH
598d_setgrent_r=''
599setgrent_r_proto=''
b4eb6b3d
JH
600d_setgrps=''
601d_sethent=''
10bc17b6
JH
602d_sethostent_r=''
603sethostent_r_proto=''
4e0554ec 604d_setitimer=''
b4eb6b3d
JH
605d_setlinebuf=''
606d_setlocale=''
10bc17b6
JH
607d_setlocale_r=''
608setlocale_r_proto=''
b4eb6b3d 609d_setnent=''
10bc17b6
JH
610d_setnetent_r=''
611setnetent_r_proto=''
b4eb6b3d
JH
612d_setpent=''
613d_setpgid=''
614d_setpgrp2=''
615d_bsdsetpgrp=''
616d_setpgrp=''
617d_setprior=''
618d_setproctitle=''
10bc17b6
JH
619d_setprotoent_r=''
620setprotoent_r_proto=''
b4eb6b3d 621d_setpwent=''
10bc17b6
JH
622d_setpwent_r=''
623setpwent_r_proto=''
b4eb6b3d
JH
624d_setregid=''
625d_setresgid=''
626d_setresuid=''
627d_setreuid=''
628d_setrgid=''
629d_setruid=''
630d_setsent=''
10bc17b6
JH
631d_setservent_r=''
632setservent_r_proto=''
b4eb6b3d
JH
633d_setsid=''
634d_setvbuf=''
635d_sfio=''
636usesfio=''
637d_shm=''
638d_shmat=''
639d_shmatprototype=''
640shmattype=''
641d_shmctl=''
642d_shmdt=''
643d_shmget=''
644d_sigaction=''
983dbef6 645d_sigprocmask=''
b4eb6b3d 646d_sigsetjmp=''
49a78c82 647d_sockatmark=''
2ef53570 648d_sockatmarkproto=''
b4eb6b3d
JH
649d_msg_ctrunc=''
650d_msg_dontroute=''
651d_msg_oob=''
652d_msg_peek=''
653d_msg_proxy=''
654d_oldsock=''
655d_scm_rights=''
656d_socket=''
657d_sockpair=''
658sockethdr=''
659socketlib=''
660d_socklen_t=''
661d_socks5_init=''
662d_sqrtl=''
10bc17b6
JH
663d_srand48_r=''
664srand48_r_proto=''
665d_srandom_r=''
666srandom_r_proto=''
eef837ea 667d_sresgproto=''
640374d0 668d_sresuproto=''
b4eb6b3d
JH
669d_statblks=''
670d_statfs_f_flags=''
671d_statfs_s=''
672d_fstatvfs=''
673d_statvfs=''
674d_stdio_cnt_lval=''
675d_stdio_ptr_lval=''
a7ffa9b9
NC
676d_stdio_ptr_lval_nochange_cnt=''
677d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
678d_stdiobase=''
679d_stdstdio=''
680stdio_base=''
681stdio_bufsiz=''
682stdio_cnt=''
683stdio_filbuf=''
684stdio_ptr=''
685d_index=''
686d_strchr=''
687d_strcoll=''
688d_strctcpy=''
689d_strerrm=''
690d_strerror=''
691d_sysernlst=''
692d_syserrlst=''
10bc17b6
JH
693d_strerror_r=''
694strerror_r_proto=''
b3c85772 695d_strftime=''
b4eb6b3d
JH
696d_strtod=''
697d_strtol=''
698d_strtold=''
699d_strtoll=''
28e5dec8 700d_strtoq=''
b4eb6b3d
JH
701d_strtoul=''
702d_strtoull=''
703d_strtouq=''
704d_strxfrm=''
705d_symlink=''
706d_syscall=''
2ef53570 707d_syscallproto=''
b4eb6b3d
JH
708d_sysconf=''
709d_system=''
710d_tcgetpgrp=''
711d_tcsetpgrp=''
712d_telldirproto=''
713d_time=''
714timetype=''
715clocktype=''
716d_times=''
10bc17b6
JH
717d_tmpnam_r=''
718tmpnam_r_proto=''
b4eb6b3d 719d_truncate=''
10bc17b6
JH
720d_ttyname_r=''
721ttyname_r_proto=''
b4eb6b3d 722d_tzname=''
4e0554ec
JH
723d_u32align=''
724d_ualarm=''
b4eb6b3d
JH
725d_umask=''
726d_semctl_semid_ds=''
727d_semctl_semun=''
728d_union_semun=''
758a5d79 729d_unordered=''
4e0554ec 730d_usleep=''
2ef53570 731d_usleepproto=''
b4eb6b3d
JH
732d_ustat=''
733d_vfork=''
734usevfork=''
735d_voidsig=''
736signal_t=''
737d_volatile=''
738d_charvspr=''
739d_vprintf=''
740d_wait4=''
741d_waitpid=''
742d_wcstombs=''
743d_wctomb=''
4e0554ec 744d_writev=''
b4eb6b3d 745dlext=''
85e6fe83
LW
746cccdlflags=''
747ccdlflags=''
2304df62 748dlsrc=''
232e078e 749ld=''
85e6fe83 750lddlflags=''
2304df62 751usedl=''
b4eb6b3d
JH
752doublesize=''
753ebcdic=''
754fflushNULL=''
755fflushall=''
756fpossize=''
757fpostype=''
5b463ca7 758gccosandvers=''
8a27cf78 759gccversion=''
b4eb6b3d
JH
760gidformat=''
761gidsign=''
762gidsize=''
763gidtype=''
764groupstype=''
765h_fcntl=''
766h_sysfile=''
767i_arpainet=''
10bc17b6 768i_crypt=''
b4eb6b3d
JH
769db_hashtype=''
770db_prefixtype=''
640374d0
JH
771db_version_major=''
772db_version_minor=''
773db_version_patch=''
b4eb6b3d
JH
774i_db=''
775i_dbm=''
776i_rpcsvcdbm=''
777d_dirnamlen=''
778direntrytype=''
779i_dirent=''
a0d0e21e 780i_dld=''
b4eb6b3d
JH
781i_dlfcn=''
782i_fcntl=''
783i_float=''
758a5d79
JH
784i_fp=''
785i_fp_class=''
b4eb6b3d
JH
786i_gdbm=''
787d_grpasswd=''
788i_grp=''
b4eb6b3d
JH
789i_ieeefp=''
790i_inttypes=''
2765b840 791i_langinfo=''
b4eb6b3d
JH
792i_libutil=''
793i_limits=''
794i_locale=''
795i_machcthr=''
796i_malloc=''
797i_math=''
798i_memory=''
799i_mntent=''
800i_ndbm=''
801i_netdb=''
802i_neterrno=''
803i_netinettcp=''
804i_niin=''
805i_sysin=''
806i_poll=''
807i_prot=''
808i_pthread=''
809d_pwage=''
810d_pwchange=''
811d_pwclass=''
812d_pwcomment=''
813d_pwexpire=''
814d_pwgecos=''
815d_pwpasswd=''
816d_pwquota=''
817i_pwd=''
818i_sfio=''
819i_shadow=''
820i_socks=''
821i_stddef=''
822i_stdlib=''
823i_string=''
824strings=''
825i_sunmath=''
826i_sysaccess=''
827i_sysdir=''
828i_sysfile=''
829d_voidtty=''
830i_bsdioctl=''
831i_sysfilio=''
832i_sysioctl=''
833i_syssockio=''
834i_syslog=''
835i_sysmman=''
836i_sysmode=''
837i_sysmount=''
838i_sysndir=''
839i_sysparam=''
840i_sysresrc=''
841i_syssecrt=''
842i_sysselct=''
843i_sysstat=''
844i_sysstatfs=''
845i_sysstatvfs=''
846i_systimes=''
847i_systypes=''
848i_sysuio=''
849i_sysun=''
850i_sysutsname=''
851i_sysvfs=''
852i_syswait=''
853i_sgtty=''
854i_termio=''
855i_termios=''
14b90194
JH
856d_tm_tm_gmtoff=''
857d_tm_tm_zone=''
b4eb6b3d
JH
858i_systime=''
859i_systimek=''
860i_time=''
861timeincl=''
862i_unistd=''
863i_ustat=''
864i_utime=''
865i_values=''
866i_stdarg=''
867i_varargs=''
868i_varhdr=''
869i_vfork=''
870inc_version_list=''
871inc_version_list_init=''
872installprefix=''
873installprefixexp=''
874installstyle=''
875installusrbinperl=''
876intsize=''
877longsize=''
878shortsize=''
4b661809 879issymlink=''
2304df62 880libc=''
b4eb6b3d
JH
881ldlibpthname=''
882libperl=''
883shrpenv=''
884useshrplib=''
a0d0e21e 885glibpth=''
2304df62 886libpth=''
8e07c86e 887loclibpth=''
2304df62
AD
888plibpth=''
889xlibpth=''
1cfa4ec7 890ignore_versioned_solibs=''
2304df62 891libs=''
43999f95
JH
892libsdirs=''
893libsfiles=''
894libsfound=''
13b3f787 895libspath=''
85e6fe83 896lns=''
b4eb6b3d
JH
897d_PRIEUldbl=''
898d_PRIFUldbl=''
899d_PRIGUldbl=''
900d_PRIeldbl=''
901d_PRIfldbl=''
902d_PRIgldbl=''
903d_SCNfldbl=''
904sPRIEUldbl=''
905sPRIFUldbl=''
906sPRIGUldbl=''
907sPRIeldbl=''
908sPRIfldbl=''
909sPRIgldbl=''
910sSCNfldbl=''
911lseeksize=''
912lseektype=''
8ff267be 913make_set_make=''
b4eb6b3d
JH
914d_mymalloc=''
915freetype=''
916mallocobj=''
917mallocsrc=''
918malloctype=''
919usemymalloc=''
920installman1dir=''
921man1dir=''
922man1direxp=''
923man1ext=''
924installman3dir=''
925man3dir=''
926man3direxp=''
927man3ext=''
928modetype=''
929multiarch=''
930mydomain=''
931myhostname=''
932phostname=''
2304df62
AD
933c=''
934n=''
b4eb6b3d
JH
935d_eofnblk=''
936eagain=''
937o_nonblock=''
938rd_nodata=''
2cc61e15 939need_va_copy=''
b4eb6b3d
JH
940netdb_hlen_type=''
941netdb_host_type=''
942netdb_name_type=''
943netdb_net_type=''
944groupcat=''
945hostcat=''
946passcat=''
947orderlib=''
948ranlib=''
949d_perl_otherlibdirs=''
950otherlibdirs=''
2304df62
AD
951package=''
952spackage=''
b4eb6b3d
JH
953pager=''
954api_revision=''
955api_subversion=''
956api_version=''
957api_versionstring=''
958patchlevel=''
151e6568 959perl_patchlevel=''
b4eb6b3d
JH
960revision=''
961subversion=''
962version=''
861eb78d 963version_patchlevel_string=''
b4eb6b3d
JH
964perl5=''
965perladmin=''
966perlpath=''
967d_nv_preserves_uv=''
b4eb6b3d
JH
968i16size=''
969i16type=''
970i32size=''
971i32type=''
972i64size=''
973i64type=''
974i8size=''
975i8type=''
976ivsize=''
977ivtype=''
53133ed1 978nv_preserves_uv_bits=''
b4eb6b3d
JH
979nvsize=''
980nvtype=''
981u16size=''
982u16type=''
983u32size=''
984u32type=''
985u64size=''
986u64type=''
987u8size=''
988u8type=''
989uvsize=''
990uvtype=''
991ivdformat=''
992nvEUformat=''
993nvFUformat=''
994nvGUformat=''
995nveformat=''
996nvfformat=''
997nvgformat=''
998uvXUformat=''
999uvoformat=''
1000uvuformat=''
1001uvxformat=''
1002pidtype=''
1003prefix=''
1004prefixexp=''
1005installprivlib=''
1006privlib=''
1007privlibexp=''
1008prototype=''
1009ptrsize=''
1010d_PRIXU64=''
1011d_PRId64=''
1012d_PRIi64=''
1013d_PRIo64=''
1014d_PRIu64=''
1015d_PRIx64=''
1016sPRIXU64=''
1017sPRId64=''
1018sPRIi64=''
1019sPRIo64=''
1020sPRIu64=''
1021sPRIx64=''
1022d_quad=''
1023quadkind=''
1024quadtype=''
1025uquadtype=''
1026drand01=''
1027randbits=''
1028randfunc=''
1029randseedtype=''
1030seedfunc=''
1031installscript=''
1032scriptdir=''
1033scriptdirexp=''
1034selectminbits=''
1035selecttype=''
8ff267be 1036sh=''
b4eb6b3d
JH
1037sig_count=''
1038sig_name=''
1039sig_name_init=''
1040sig_num=''
1041sig_num_init=''
76d3c696 1042sig_size=''
b4eb6b3d
JH
1043installsitearch=''
1044sitearch=''
1045sitearchexp=''
1046installsitebin=''
1047sitebin=''
1048sitebinexp=''
1049installsitelib=''
1050sitelib=''
1051sitelib_stem=''
1052sitelibexp=''
1053siteprefix=''
1054siteprefixexp=''
1055sizesize=''
1056sizetype=''
a0d0e21e 1057so=''
b4eb6b3d 1058socksizetype=''
2304df62
AD
1059sharpbang=''
1060shsharp=''
1061spitshell=''
dfe9444c 1062src=''
b4eb6b3d
JH
1063ssizetype=''
1064startperl=''
2304df62 1065startsh=''
b4eb6b3d
JH
1066stdchar=''
1067d_stdio_stream_array=''
1068stdio_stream_array=''
1069sysman=''
5ff3f7a4 1070trnl=''
b4eb6b3d
JH
1071uidformat=''
1072uidsign=''
1073uidsize=''
1074uidtype=''
1075archname64=''
1076use64bitall=''
1077use64bitint=''
1078ccflags_uselargefiles=''
1079ldflags_uselargefiles=''
1080libswanted_uselargefiles=''
1081uselargefiles=''
1082uselongdouble=''
1083usemorebits=''
1084usemultiplicity=''
2304df62 1085nm_opt=''
40a7a20a 1086nm_so_opt=''
2304df62
AD
1087runnm=''
1088usenm=''
b4eb6b3d 1089useperlio=''
29209bc5 1090usesocks=''
b4eb6b3d
JH
1091d_oldpthreads=''
1092use5005threads=''
1093useithreads=''
9514c62b 1094usereentrant=''
b4eb6b3d 1095usethreads=''
2304df62 1096incpath=''
2304df62
AD
1097mips_type=''
1098usrinc=''
b4eb6b3d
JH
1099d_vendorarch=''
1100installvendorarch=''
1101vendorarch=''
1102vendorarchexp=''
1103d_vendorbin=''
1104installvendorbin=''
1105vendorbin=''
1106vendorbinexp=''
1107d_vendorlib=''
1108installvendorlib=''
1109vendorlib=''
1110vendorlib_stem=''
1111vendorlibexp=''
1112usevendorprefix=''
1113vendorprefix=''
1114vendorprefixexp=''
d56c5707 1115versiononly=''
b4eb6b3d
JH
1116defvoidused=''
1117voidflags=''
1118pm_apiversion=''
1119xs_apiversion=''
3659ebf1
JH
1120yacc=''
1121yaccflags=''
2304df62
AD
1122CONFIG=''
1123
ecfc5424
AD
1124define='define'
1125undef='undef'
1126smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1127rmlist=''
1128
1129: We must find out about Eunice early
1130eunicefix=':'
1131if test -f /etc/unixtovms; then
1132 eunicefix=/etc/unixtovms
1133fi
1134if test -f /etc/unixtovms.exe; then
1135 eunicefix=/etc/unixtovms.exe
1136fi
1137
cfb04860 1138: Set executable suffix now -- needed before hints available
6153ba32
PG
1139if test -f "/libs/version.library"; then
1140: Amiga OS
1141 _exe=""
1142elif test -f "/system/gnu_library/bin/ar.pm"; then
1143: Stratus VOS
cfb04860 1144 _exe=".pm"
6153ba32
PG
1145elif test -n "$DJGPP"; then
1146: DOS DJGPP
cfb04860 1147 _exe=".exe"
6153ba32 1148elif test -d c:/. ; then
506faf56 1149: OS/2 or cygwin
ba863942
JH
1150 _exe=".exe"
1151fi
868439a2 1152
b4eb6b3d 1153i_whoami=''
a33c94aa
JH
1154ccname=''
1155ccversion=''
1156perllibs=''
1157: set useposix=false in your hint file to disable the POSIX extension.
1158useposix=true
1159: set useopcode=false in your hint file to disable the Opcode extension.
1160useopcode=true
1161: Trailing extension. Override this in a hint file, if needed.
a33c94aa
JH
1162: Extra object files, if any, needed on this platform.
1163archobjs=''
1164archname=''
ff935051
JH
1165: Possible local include directories to search.
1166: Set locincpth to "" in a hint file to defeat local include searches.
1167locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1168locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1169:
1170: no include file wanted by default
1171inclwanted=''
1172
b4eb6b3d 1173groupstype=''
64615a5e 1174libnames=''
732c9516
JH
1175: change the next line if compiling for Xenix/286 on Xenix/386
1176xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1177: Possible local library directories to search.
1178loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1179loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1180
1181: general looking path for locating libraries
5869b1f1 1182glibpth="/lib /usr/lib $xlibpth"
732c9516 1183glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1184test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1185test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1186
1187: Private path used by Configure to find libraries. Its value
1188: is prepended to libpth. This variable takes care of special
1189: machines, like the mips. Usually, it should be empty.
1190plibpth=''
1191
1cfa4ec7
GS
1192: default library list
1193libswanted=''
921b2963 1194: some systems want to use only the non-versioned libso:s
1cfa4ec7 1195ignore_versioned_solibs=''
b4eb6b3d
JH
1196archname64=''
1197ccflags_uselargefiles=''
1198ldflags_uselargefiles=''
1199libswanted_uselargefiles=''
1200: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1201: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1202: set usethreads on the Configure command line to enable threads.
cd040c5e 1203usereentrant='undef'
a33c94aa
JH
1204: full support for void wanted by default
1205defvoidused=15
1206
ecfc5424 1207: List of libraries we want.
693762b4 1208: If anyone needs -lnet, put it in a hint file.
997d70a2 1209libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1210libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1211libswanted="$libswanted ndir dir crypt sec"
e61ecf27 1212libswanted="$libswanted ucb bsd BSD PW x util"
1aef975c 1213: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1214: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1215glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1216glibpth="/usr/shlib $glibpth"
1217: Do not use vfork unless overridden by a hint file.
1218usevfork=false
1219
8ff267be 1220: Find the basic shell for Bourne shell scripts
1221case "$sh" in
1222'')
8ff267be 1223 case "$SYSTYPE" in
1224 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1225 *) xxx='/bin/sh';;
1226 esac
1227 if test -f "$xxx"; then
1228 sh="$xxx"
1229 else
1230 : Build up a list and do a single loop so we can 'break' out.
1231 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1232 for xxx in sh bash ksh pdksh ash; do
1233 for p in $pth; do
1234 try="$try ${p}/${xxx}"
1235 done
1236 done
1237 for xxx in $try; do
1238 if test -f "$xxx"; then
1239 sh="$xxx";
8ff267be 1240 break
a5a94ea5
JH
1241 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1242 sh="$xxx";
1243 break
8ff267be 1244 elif test -f "$xxx.exe"; then
1245 sh="$xxx";
8ff267be 1246 break
1247 fi
1248 done
1249 fi
1250 ;;
1251esac
1252
1253case "$sh" in
a33c94aa 1254'') cat >&2 <<EOM
8ff267be 1255$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1256
8ff267be 1257Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1258Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1259we'll try to straighten this all out.
8ff267be 1260EOM
1261 exit 1
1262 ;;
1263esac
1264
760ac839 1265: see if sh knows # comments
73614538 1266if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1267 shsharp=true
1268 spitshell=cat
760ac839 1269 xcat=/bin/cat
a931254c
JH
1270 test -f $xcat$_exe || xcat=/usr/bin/cat
1271 if test ! -f $xcat$_exe; then
4bdb8fb5 1272 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1273 if test -f $p/cat$_exe; then
1deb0a86 1274 xcat=$p/cat
3c728e00
JH
1275 break
1276 fi
1277 done
1deb0a86
JH
1278 if test ! -f $xcat$_exe; then
1279 echo "Can't find cat anywhere!"
3c728e00
JH
1280 exit 1
1281 fi
1282 fi
5440bc8e
JH
1283 echo "#!$xcat" >sharp
1284 $eunicefix sharp
1285 chmod +x sharp
1286 ./sharp > today
760ac839 1287 if test -s today; then
760ac839
LW
1288 sharpbang='#!'
1289 else
5440bc8e
JH
1290 echo "#! $xcat" > sharp
1291 $eunicefix sharp
1292 chmod +x sharp
1293 ./sharp > today
760ac839 1294 if test -s today; then
760ac839
LW
1295 sharpbang='#! '
1296 else
760ac839
LW
1297 sharpbang=': use '
1298 fi
1299 fi
1300else
dfe9444c 1301 echo " "
8ff267be 1302 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1303 shsharp=false
1304 cd ..
1305 echo "exec grep -v '^[ ]*#'" >spitshell
1306 chmod +x spitshell
1307 $eunicefix spitshell
1308 spitshell=`pwd`/spitshell
1309 cd UU
1310 echo "I presume that if # doesn't work, #! won't work either!"
1311 sharpbang=': use '
1312fi
5440bc8e 1313rm -f sharp today
760ac839
LW
1314
1315: figure out how to guarantee sh startup
8ff267be 1316case "$startsh" in
1317'') startsh=${sharpbang}${sh} ;;
1318*)
760ac839 1319esac
5440bc8e 1320cat >sharp <<EOSS
760ac839
LW
1321$startsh
1322set abc
1323test "$?abc" != 1
1324EOSS
1325
5440bc8e
JH
1326chmod +x sharp
1327$eunicefix sharp
1328if ./sharp; then
8ff267be 1329 : echo "Yup, it does."
760ac839 1330else
dfe9444c
AD
1331 echo "Hmm... '$startsh' does not guarantee sh startup..."
1332 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1333fi
5440bc8e 1334rm -f sharp
760ac839 1335
aebf16e7
AD
1336
1337: Save command line options in file UU/cmdline.opt for later use in
1338: generating config.sh.
1339cat > cmdline.opt <<EOSH
1340# Configure command line arguments.
1341config_arg0='$0'
1342config_args='$*'
1343config_argc=$#
1344EOSH
1345argn=1
ee45ea83
IZ
1346args_exp=''
1347args_sep=''
aebf16e7
AD
1348for arg in "$@"; do
1349 cat >>cmdline.opt <<EOSH
1350config_arg$argn='$arg'
1351EOSH
ee45ea83
IZ
1352 # Extreme backslashitis: replace each ' by '"'"'
1353 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1354$arg
1355EOC
1356 arg_exp=`cat cmdl.opt`
1357 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1358 argn=`expr $argn + 1`
ee45ea83 1359 args_sep=' '
aebf16e7 1360done
ee45ea83
IZ
1361# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1362# used by ./hints/os2.sh
1363rm -f cmdl.opt
aebf16e7 1364
2304df62
AD
1365: produce awk script to parse command line options
1366cat >options.awk <<'EOF'
1367BEGIN {
02e93a22 1368 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1369
1370 len = length(optstr);
1371 for (i = 1; i <= len; i++) {
1372 c = substr(optstr, i, 1);
1373 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1374 if (a == ":") {
1375 arg[c] = 1;
1376 i++;
1377 }
1378 opt[c] = 1;
1379 }
1380}
1381{
1382 expect = 0;
1383 str = $0;
1384 if (substr(str, 1, 1) != "-") {
1385 printf("'%s'\n", str);
1386 next;
1387 }
1388 len = length($0);
1389 for (i = 2; i <= len; i++) {
1390 c = substr(str, i, 1);
1391 if (!opt[c]) {
1392 printf("-%s\n", substr(str, i));
1393 next;
1394 }
1395 printf("-%s\n", c);
1396 if (arg[c]) {
1397 if (i < len)
1398 printf("'%s'\n", substr(str, i + 1));
1399 else
1400 expect = 1;
1401 next;
1402 }
1403 }
1404}
1405END {
1406 if (expect)
1407 print "?";
1408}
1409EOF
1410
1411: process the command line options
4633a7c4
LW
1412set X `for arg in "$@"; do echo "X$arg"; done |
1413 sed -e s/X// | awk -f options.awk`
2304df62
AD
1414eval "set $*"
1415shift
1416rm -f options.awk
1417
1418: set up default values
1419fastread=''
1420reuseval=false
1421config_sh=''
1422alldone=''
1423error=''
1424silent=''
1425extractsh=''
ecfc5424 1426override=''
16d20bd9 1427knowitall=''
02e93a22 1428rm -f optdef.sh posthint.sh
28757baa 1429cat >optdef.sh <<EOS
1430$startsh
1431EOS
2304df62 1432
dfe9444c 1433
2304df62
AD
1434: option parsing
1435while test $# -gt 0; do
1436 case "$1" in
1437 -d) shift; fastread=yes;;
1438 -e) shift; alldone=cont;;
1439 -f)
1440 shift
1441 cd ..
1442 if test -r "$1"; then
1443 config_sh="$1"
1444 else
a0d0e21e 1445 echo "$me: cannot read config file $1." >&2
2304df62
AD
1446 error=true
1447 fi
1448 cd UU
1449 shift;;
1450 -h) shift; error=true;;
1451 -r) shift; reuseval=true;;
dfe9444c 1452 -s) shift; silent=true; realsilent=true;;
2304df62 1453 -E) shift; alldone=exit;;
16d20bd9 1454 -K) shift; knowitall=true;;
ecfc5424 1455 -O) shift; override=true;;
dfe9444c 1456 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1457 -D)
1458 shift
1459 case "$1" in
1460 *=)
1461 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1462 echo "$me: ignoring -D $1" >&2
1463 ;;
ecfc5424 1464 *=*) echo "$1" | \
1aef975c
AD
1465 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1466 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1467 esac
1468 shift
1469 ;;
1470 -U)
1471 shift
1472 case "$1" in
1aef975c 1473 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1474 *=*)
1475 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1476 echo "$me: ignoring -U $1" >&2
1477 ;;
1aef975c 1478 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1479 esac
1480 shift
1481 ;;
02e93a22
JH
1482 -A)
1483 shift
1484 xxx=''
1485 yyy="$1"
02e93a22 1486 zzz=''
5f83a3e9 1487 uuu=undef
02e93a22 1488 case "$yyy" in
5f83a3e9
JH
1489 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1490 case "$zzz" in
1491 *:*) zzz='' ;;
1492 *) xxx=append
1493 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1494 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1495 esac
1496 ;;
1497 esac
1498 case "$xxx" in
1499 '') case "$yyy" in
1500 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1501 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1502 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1503 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1504 *) xxx=`echo $yyy|sed 's!:.*!!'`
1505 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1506 esac
1507 ;;
1508 esac
02e93a22
JH
1509 case "$xxx" in
1510 append)
5f83a3e9 1511 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1512 clear)
5f83a3e9 1513 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1514 define)
1515 case "$zzz" in
1516 '') zzz=define ;;
1517 esac
5f83a3e9 1518 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1519 eval)
5f83a3e9 1520 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1521 prepend)
5f83a3e9 1522 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1523 undef)
1524 case "$zzz" in
1525 '') zzz="$uuu" ;;
1526 esac
5f83a3e9
JH
1527 echo "$yyy=$zzz" >> posthint.sh ;;
1528 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1529 esac
bde6b06b 1530 shift
02e93a22 1531 ;;
dfe9444c 1532 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1533 exit 0;;
2304df62 1534 --) break;;
a0d0e21e 1535 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1536 *) break;;
1537 esac
1538done
1539
1540case "$error" in
1541true)
1542 cat >&2 <<EOM
2afac517 1543Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1544 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1545 -d : use defaults for all answers.
1546 -e : go on without questioning past the production of config.sh.
1547 -f : specify an alternate default configuration file.
1548 -h : print this help message and exit (with an error status).
1549 -r : reuse C symbols value if possible (skips costly nm extraction).
1550 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1551 -D : define symbol to have some value:
1552 -D symbol symbol gets the value 'define'
1553 -D symbol=value symbol gets the value 'value'
2304df62 1554 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1555 -K : do not use unless you know what you are doing.
ecfc5424 1556 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1557 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1558 -U : undefine symbol:
1559 -U symbol symbol gets the value 'undef'
1560 -U symbol= symbol gets completely empty
02e93a22 1561 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1562 -A symbol=value append " "value to symbol
02e93a22
JH
1563 -A append:symbol=value append value to symbol
1564 -A define:symbol=value define symbol to have value
02e93a22
JH
1565 -A clear:symbol define symbol to be ''
1566 -A define:symbol define symbol to be 'define'
1567 -A eval:symbol=value define symbol to be eval of value
1568 -A prepend:symbol=value prepend value to symbol
1569 -A undef:symbol define symbol to be 'undef'
1570 -A undef:symbol= define symbol to be ''
2304df62
AD
1571 -V : print version number and exit (with a zero status).
1572EOM
1573 exit 1
1574 ;;
1575esac
1576
dfe9444c
AD
1577: Sanity checks
1578case "$fastread$alldone" in
1579yescont|yesexit) ;;
1580*)
aaeb8e51
GS
1581 case "$extractsh" in
1582 true) ;;
1583 *)
1584 if test ! -t 0; then
1585 echo "Say 'sh Configure', not 'sh <Configure'"
1586 exit 1
1587 fi
1588 ;;
1589 esac
dfe9444c
AD
1590 ;;
1591esac
1592
2304df62
AD
1593exec 4>&1
1594case "$silent" in
1595true) exec 1>/dev/null;;
1596esac
1597
ecfc5424 1598: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1599touch optdef.sh
1600. ./optdef.sh
02e93a22
JH
1601: create the posthint manipulation script and leave the file out there...
1602touch posthint.sh
a0d0e21e 1603
2304df62 1604: set package name
85e6fe83 1605package=perl5
b4eb6b3d
JH
1606first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1607last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1608case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1609ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1610*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1611esac
2304df62 1612
2304df62
AD
1613: Some greps do not return status, grrr.
1614echo "grimblepritz" >grimble
1615if grep blurfldyick grimble >/dev/null 2>&1 ; then
1616 contains=contains
1617elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1618 contains=grep
1619else
1620 contains=contains
1621fi
1622rm -f grimble
1623: the following should work in any shell
1624case "$contains" in
1625contains*)
1626 echo " "
1627 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1628 cat >contains <<'EOSS'
1629grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1630EOSS
1631chmod +x contains
1632esac
1633
dfe9444c
AD
1634: Find the path to the source tree
1635case "$src" in
1636'') case "$0" in
b233458b
JH
1637 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1638 case "$src" in
1639 /*) ;;
8504afb7 1640 .) ;;
b233458b
JH
1641 *) src=`cd ../$src && pwd` ;;
1642 esac
1643 ;;
dfe9444c
AD
1644 *) src='.';;
1645 esac;;
1646esac
1647case "$src" in
1648'') src=/
1649 rsrc=/
1650 ;;
1651/*) rsrc="$src";;
1652*) rsrc="../$src";;
1653esac
1654if test -f $rsrc/Configure && \
1655 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1656then
1657 : found it, so we are ok.
1658else
1659 rsrc=''
1660 for src in . .. ../.. ../../.. ../../../..; do
1661 if test -f ../$src/Configure && \
1662 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1663 then
1664 rsrc=../$src
1665 break
1666 fi
1667 done
1668fi
1669case "$rsrc" in
1670'')
1671 cat <<EOM >&4
1672
1673Sorry, I can't seem to locate the source dir for $package. Please start
1674Configure with an explicit path -- i.e. /some/path/Configure.
1675
1676EOM
1677 exit 1
1678 ;;
1679../.) rsrc='..';;
1680*)
1681 echo " "
1682 echo "Sources for $package found in \"$src\"." >&4
1683 ;;
1684esac
1685
1686: script used to extract .SH files with variable substitutions
1687cat >extract <<'EOS'
a02608de 1688PERL_CONFIG_SH=true
dfe9444c 1689echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1690if test -f MANIFEST; then
1691 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1692else
1693 echo "(Looking for .SH files under the source directory.)"
6904989c 1694 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1695fi
1696shift
1697case $# in
6904989c 16980) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1699esac
6904989c 1700if test ! -f "$src/$1"; then
dfe9444c
AD
1701 shift
1702fi
1703mkdir_p='
1704name=$1;
1705create="";
1706while test $name; do
1707 if test ! -d "$name"; then
1708 create="$name $create";
1709 name=`echo $name | sed -e "s|^[^/]*$||"`;
1710 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1711 else
1712 name="";
1713 fi;
1714done;
1715for file in $create; do
1716 mkdir $file;
1717done
1718'
1719for file in $*; do
1720 case "$src" in
1721 ".")
1722 case "$file" in
1723 */*)
1724 dir=`expr X$file : 'X\(.*\)/'`
1725 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1726 (cd "$dir" && . ./$file)
dfe9444c
AD
1727 ;;
1728 *)
1729 . ./$file
1730 ;;
1731 esac
1732 ;;
1733 *)
1734 case "$file" in
1735 */*)
1736 dir=`expr X$file : 'X\(.*\)/'`
1737 file=`expr X$file : 'X.*/\(.*\)'`
1738 (set x $dir; shift; eval $mkdir_p)
6904989c 1739 sh <"$src/$dir/$file"
dfe9444c
AD
1740 ;;
1741 *)
6904989c 1742 sh <"$src/$file"
dfe9444c
AD
1743 ;;
1744 esac
1745 ;;
1746 esac
1747done
6904989c 1748if test -f "$src/config_h.SH"; then
dfe9444c
AD
1749 if test ! -f config.h; then
1750 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1751 . "$src/config_h.SH"
dfe9444c
AD
1752 fi
1753fi
1754EOS
1755
1756: extract files and exit if asked to do so
1757case "$extractsh" in
1758true)
1759 case "$realsilent" in
1760 true) ;;
1761 *) exec 1>&4;;
1762 esac
1763 case "$config_sh" in
1764 '') config_sh='config.sh';;
1765 esac
1766 echo " "
1767 echo "Fetching answers from $config_sh..."
1768 cd ..
1769 . $config_sh
1770 test "$override" && . ./optdef.sh
1771 echo " "
1772 . UU/extract
1773 rm -rf UU
24ccb310 1774 echo "Extraction done."
dfe9444c
AD
1775 exit 0
1776 ;;
1777esac
1778
1779: Eunice requires " " instead of "", can you believe it
1780echo " "
1781: Here we go...
1782echo "Beginning of configuration questions for $package."
1783
1784trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1785
2304df62
AD
1786: first determine how to suppress newline on echo command
1787echo " "
1788echo "Checking echo to see how to suppress newlines..."
1789(echo "hi there\c" ; echo " ") >.echotmp
1790if $contains c .echotmp >/dev/null 2>&1 ; then
1791 echo "...using -n."
1792 n='-n'
1793 c=''
1794else
1795 cat <<'EOM'
1796...using \c
1797EOM
1798 n=''
1799 c='\c'
1800fi
1801echo $n "The star should be here-->$c"
1802echo '*'
1803rm -f .echotmp
1804
1805: Now test for existence of everything in MANIFEST
1806echo " "
6904989c 1807if test -f "$rsrc/MANIFEST"; then
2304df62 1808 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1809 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1810 rm -f missing
dfe9444c 1811 tmppwd=`pwd`
2304df62 1812 for filelist in x??; do
6904989c 1813 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1814 done
1815 if test -s missing; then
1816 cat missing >&4
1817 cat >&4 <<'EOM'
1818
1819THIS PACKAGE SEEMS TO BE INCOMPLETE.
1820
1821You have the option of continuing the configuration process, despite the
1822distinct possibility that your kit is damaged, by typing 'y'es. If you
1823do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1824and contact the author (perlbug@perl.org).
2304df62
AD
1825
1826EOM
1827 echo $n "Continue? [n] $c" >&4
1828 read ans
1829 case "$ans" in
1830 y*)
1831 echo "Continuing..." >&4
1832 rm -f missing
1833 ;;
1834 *)
1835 echo "ABORTING..." >&4
1836 kill $$
1837 ;;
1838 esac
1839 else
dfe9444c 1840 echo "Looks good..."
2304df62
AD
1841 fi
1842else
1843 echo "There is no MANIFEST file. I hope your kit is complete !"
1844fi
1845rm -f missing x??
1846
5ff3f7a4
GS
1847echo " "
1848: Find the appropriate value for a newline for tr
1849if test -n "$DJGPP"; then
1850 trnl='\012'
1851fi
1852if test X"$trnl" = X; then
1853 case "`echo foo|tr '\n' x 2>/dev/null`" in
1854 foox) trnl='\n' ;;
1855 esac
1856fi
1857if test X"$trnl" = X; then
1858 case "`echo foo|tr '\012' x 2>/dev/null`" in
1859 foox) trnl='\012' ;;
1860 esac
1861fi
1862if test X"$trnl" = X; then
1863 cat <<EOM >&2
1864
1865$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1866
1867EOM
1868 exit 1
1869fi
1870
2304df62
AD
1871: compute the number of columns on the terminal for proper question formatting
1872case "$COLUMNS" in
1873'') COLUMNS='80';;
1874esac
1875
1876: set up the echo used in my read
1877myecho="case \"\$xxxm\" in
1878'') echo $n \"\$rp $c\" >&4;;
1879*) case \"\$rp\" in
1880 '') echo $n \"[\$xxxm] $c\";;
1881 *)
1882 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1883 echo \"\$rp\" >&4
1884 echo $n \"[\$xxxm] $c\" >&4
1885 else
1886 echo $n \"\$rp [\$xxxm] $c\" >&4
1887 fi
1888 ;;
1889 esac;;
1890esac"
1891
1892: now set up to do reads with possible shell escape and default assignment
1893cat <<EOSC >myread
28757baa 1894$startsh
2304df62
AD
1895xxxm=\$dflt
1896$myecho
1897ans='!'
1898case "\$fastread" in
1899yes) case "\$dflt" in
1900 '') ;;
1901 *) ans='';
1902 case "\$silent-\$rp" in
1903 true-) ;;
1904 *) echo " " >&4;;
1905 esac;;
1906 esac;;
1907*) case "\$silent" in
1908 true) case "\$rp" in
1909 '') ans='';;
1910 esac;;
1911 esac;;
1912esac
1913while expr "X\$ans" : "X!" >/dev/null; do
1914 read answ
1915 set x \$xxxm
1916 shift
dfe9444c 1917 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1918 case "\$answ" in
dfe9444c
AD
1919 "!")
1920 sh 1>&4
1921 echo " "
1922 $myecho
1923 ;;
1924 !*)
1925 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1926 shift
1927 sh 1>&4 -c "\$*"
1928 echo " "
1929 $myecho
1930 ;;
2304df62
AD
1931 "\$ans")
1932 case "\$ans" in
ecfc5424
AD
1933 \\&*)
1934 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1935 shift
1936 case "\$1" in
1937 -d)
1938 fastread=yes
40a7a20a 1939 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1940 ;;
1941 -*)
40a7a20a 1942 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1943 ;;
1944 esac
1945 $myecho
1946 ans=!
1947 ;;
2304df62
AD
1948 esac;;
1949 *)
1950 case "\$aok" in
1951 y)
1952 echo "*** Substitution done -- please confirm."
1953 xxxm="\$ans"
c9795ab7 1954 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1955 xxxm="\$ans"
1956 ans=!
1957 ;;
1958 *)
1959 echo "*** Error -- try again."
1960 ans=!
1961 ;;
1962 esac
1963 $myecho
1964 ;;
1965 esac
1966 case "\$ans\$xxxm\$nostick" in
1967 '')
1968 ans=!
1969 $myecho
1970 ;;
1971 esac
1972done
1973case "\$ans" in
1974'') ans="\$xxxm";;
1975esac
1976EOSC
1977
1978: create .config dir to save info across Configure sessions
1979test -d ../.config || mkdir ../.config
1980cat >../.config/README <<EOF
1981This directory created by Configure to save information that should
dfe9444c 1982persist across sessions for $package.
2304df62
AD
1983
1984You may safely delete it if you wish.
1985EOF
1986
9507cadf 1987xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1988case "$usedevel" in
0107c034 1989$define|true|[yY]*) ;;
9507cadf 1990*) case "$xversion" in
0107c034
JH
1991 *[13579])
1992 cat >&4 <<EOH
1993*** WHOA THERE!!! ***
1994
1995 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1996 The version of this $package distribution is $xversion, that is, odd,
1997 (as opposed to even) and that signifies a development release.
3d5d58b1 1998 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1999
2000 Do ***NOT*** install this into production use.
2001 Data corruption and crashes are possible.
2002
2003 It is most seriously suggested that you do not continue any further
2004 unless you want to help in developing and debugging Perl.
2005
6adc6a45
JH
2006 If you *still* want to build perl, you can answer 'y' now,
2007 or pass -Dusedevel to Configure.
2008
0107c034
JH
2009EOH
2010 rp='Do you really want to continue?'
2011 dflt='n'
2012 . ./myread
2013 case "$ans" in
8feeef0e
JH
2014 [yY]) echo >&4 "Okay, continuing."
2015 usedevel="$define" ;;
0107c034
JH
2016 *) echo >&4 "Okay, bye."
2017 exit 1
2018 ;;
2019 esac
2020 ;;
2021 esac
2022 ;;
2023esac
8feeef0e
JH
2024case "$usedevel" in
2025$define|true|[yY]*)
2026 case "$versiononly" in
2027 '') versiononly="$define" ;;
2028 esac
2029 case "$installusrbinperl" in
2030 '') installusrbinperl="$undef" ;;
2031 esac
2032 ;;
2033esac
0107c034 2034
2304df62
AD
2035: general instructions
2036needman=true
2037firsttime=true
760ac839 2038user=`(logname) 2>/dev/null`
dfe9444c
AD
2039case "$user" in
2040'') user=`whoami 2>&1`;;
760ac839 2041esac
2304df62
AD
2042if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2043 firsttime=false
2044 echo " "
2045 rp='Would you like to see the instructions?'
2046 dflt=n
2047 . ./myread
2048 case "$ans" in
2049 [yY]*) ;;
2050 *) needman=false;;
2051 esac
2052fi
2053if $needman; then
2054 cat <<EOH
4e2a5f63 2055
2304df62 2056This installation shell script will examine your system and ask you questions
a0d0e21e 2057to determine how the perl5 package should be installed. If you get
2304df62
AD
2058stuck on a question, you may use a ! shell escape to start a subshell or
2059execute a command. Many of the questions will have default answers in square
2060brackets; typing carriage return will give you the default.
2061
2062On some of the questions which ask for file or directory names you are allowed
2063to use the ~name construct to specify the login directory belonging to "name",
2064even if you don't have a shell which knows about that. Questions where this is
2065allowed will be marked "(~name ok)".
2066
2067EOH
2068 rp=''
2069 dflt='Type carriage return to continue'
2070 . ./myread
2071 cat <<'EOH'
2072
2073The prompter used in this script allows you to use shell variables and
2074backticks in your answers. You may use $1, $2, etc... to refer to the words
2075in the default answer, as if the default line was a set of arguments given to a
2076script shell. This means you may also use $* to repeat the whole default line,
2077so you do not have to re-type everything to add something to the default.
2078
2079Everytime there is a substitution, you will have to confirm. If there is an
2080error (e.g. an unmatched backtick), the default answer will remain unchanged
2081and you will be prompted again.
2082
2083If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2084the questions and use the computed defaults (or the previous answers if there
2085was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2086You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2087on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2088
2089EOH
2090 . ./myread
2091 cat <<EOH
2092
2093Much effort has been expended to ensure that this shell script will run on any
2094Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2095Configure and run it again. If you can't run Configure for some reason,
2096you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2097have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2098
2099This installation script affects things in two ways:
2100
21011) it may do direct variable substitutions on some of the files included
2102 in this kit.
21032) it builds a config.h file for inclusion in C programs. You may edit
2104 any of these files as the need arises after running this script.
2105
2106If you make a mistake on a question, there is no easy way to back up to it
2107currently. The easiest thing to do is to edit config.sh and rerun all the SH
2108files. Configure will offer to let you do this before it runs the SH files.
2109
2110EOH
2111 dflt='Type carriage return to continue'
2112 . ./myread
2113 case "$firsttime" in
2114 true) echo $user >>../.config/instruct;;
2115 esac
2116fi
2117
2304df62
AD
2118: find out where common programs are
2119echo " "
2120echo "Locating common programs..." >&4
2121cat <<EOSC >loc
2122$startsh
2123case \$# in
21240) exit 1;;
2125esac
2126thing=\$1
2127shift
2128dflt=\$1
2129shift
2130for dir in \$*; do
2131 case "\$thing" in
2132 .)
2133 if test -d \$dir/\$thing; then
2134 echo \$dir
2135 exit 0
2136 fi
2137 ;;
2138 *)
a0d0e21e 2139 for thisthing in \$dir/\$thing; do
ecfc5424 2140 : just loop through to pick last item
a0d0e21e 2141 done
25f94b33 2142 if test -f \$thisthing; then
a0d0e21e 2143 echo \$thisthing
2304df62 2144 exit 0
a5a94ea5
JH
2145 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2146 echo \$thisthing
2147 exit 0
2304df62 2148 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2149 if test -n "$DJGPP"; then
2150 echo \$dir/\$thing.exe
2151 else
2152 : on Eunice apparently
2153 echo \$dir/\$thing
2154 fi
2304df62
AD
2155 exit 0
2156 fi
2157 ;;
2158 esac
2159done
2160echo \$dflt
2161exit 1
2162EOSC
2163chmod +x loc
2164$eunicefix loc
2165loclist="
2166awk
2167cat
f8006fac 2168chmod
b4eb6b3d
JH
2169comm
2170cp
2304df62
AD
2171echo
2172expr
2173grep
a0d0e21e 2174ls
b4eb6b3d 2175mkdir
2304df62
AD
2176rm
2177sed
b4eb6b3d 2178sort
85e6fe83 2179touch
2304df62 2180tr
b4eb6b3d 2181uniq
2304df62
AD
2182"
2183trylist="
2184Mcc
dfe9444c 2185ar
3659ebf1 2186bison
b4eb6b3d 2187byacc
2304df62 2188cpp
b4eb6b3d 2189csh
2304df62
AD
2190date
2191egrep
1fef16b3 2192gmake
8ff267be 2193gzip
b4eb6b3d 2194less
8ff267be 2195ln
3c728e00 2196make
b4eb6b3d 2197more
693762b4 2198nm
b4eb6b3d
JH
2199nroff
2200pg
2304df62
AD
2201test
2202uname
8ff267be 2203zip
2304df62 2204"
8e07c86e 2205pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2206pth="$pth /lib /usr/lib"
2207for file in $loclist; do
dfe9444c
AD
2208 eval xxx=\$$file
2209 case "$xxx" in
2210 /*|?:[\\/]*)
2211 if test -f "$xxx"; then
2212 : ok
2213 else
2214 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2215 xxx=`./loc $file $file $pth`
2216 fi
2217 ;;
2218 '') xxx=`./loc $file $file $pth`;;
2219 *) xxx=`./loc $xxx $xxx $pth`;;
2220 esac
a5a94ea5 2221 eval $file=$xxx$_exe
2304df62
AD
2222 eval _$file=$xxx
2223 case "$xxx" in
2224 /*)
2225 echo $file is in $xxx.
2226 ;;
8e07c86e
AD
2227 ?:[\\/]*)
2228 echo $file is in $xxx.
2229 ;;
2304df62 2230 *)
25f94b33
AD
2231 echo "I don't know where '$file' is, and my life depends on it." >&4
2232 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2233 exit 1
2304df62
AD
2234 ;;
2235 esac
2236done
2237echo " "
2238echo "Don't worry if any of the following aren't found..."
2239say=offhand
2240for file in $trylist; do
dfe9444c
AD
2241 eval xxx=\$$file
2242 case "$xxx" in
2243 /*|?:[\\/]*)
2244 if test -f "$xxx"; then
2245 : ok
2246 else
2247 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2248 xxx=`./loc $file $file $pth`
2249 fi
2250 ;;
2251 '') xxx=`./loc $file $file $pth`;;
2252 *) xxx=`./loc $xxx $xxx $pth`;;
2253 esac
306a8474 2254 eval $file=$xxx$_exe
2304df62
AD
2255 eval _$file=$xxx
2256 case "$xxx" in
2257 /*)
2258 echo $file is in $xxx.
2259 ;;
8e07c86e
AD
2260 ?:[\\/]*)
2261 echo $file is in $xxx.
2262 ;;
2304df62
AD
2263 *)
2264 echo "I don't see $file out there, $say."
2265 say=either
2266 ;;
2267 esac
2268done
2269case "$egrep" in
1fef16b3 2270egrep)
2304df62
AD
2271 echo "Substituting grep for egrep."
2272 egrep=$grep
868439a2 2273 _egrep=$grep
2304df62
AD
2274 ;;
2275esac
8ff267be 2276case "$ln" in
1fef16b3 2277ln)
8ff267be 2278 echo "Substituting cp for ln."
2279 ln=$cp
868439a2 2280 _ln=$cp
8ff267be 2281 ;;
2282esac
2e26f1d5
JH
2283case "$make" in
2284make)
2285 case "$gmake" in
2286 gmake)
2287 echo "I can't find make or gmake, and my life depends on it." >&4
2288 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2289 exit 1
2290 ;;
2291 esac
2292 ;;
2293esac
2294case "$gmake" in
2295gmake) ;;
2296*) # We can't have osname yet.
1fef16b3
JH
2297 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2298 # Assume that gmake, if found, is definitely GNU make
2299 # and prefer it over the system make.
2300 echo "Substituting gmake for make."
2301 make=$gmake
868439a2 2302 _make=$gmake
1fef16b3
JH
2303 fi
2304 ;;
a5a94ea5 2305esac
2304df62
AD
2306case "$test" in
2307test)
2308 echo "Hopefully test is built into your sh."
2309 ;;
2310*)
73614538 2311 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2312 echo "Using the test built into your sh."
2304df62
AD
2313 test=test
2314 _test=test
2315 fi
2316 ;;
2317esac
2318case "$echo" in
2319echo)
2320 echo "Hopefully echo is built into your sh."
2321 ;;
2322'') ;;
2323*)
2324 echo " "
2325echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2326 $echo $n "hi there$c" >foo1
2327 echo $n "hi there$c" >foo2
2328 if cmp foo1 foo2 >/dev/null 2>&1; then
2329 echo "They are compatible. In fact, they may be identical."
2330 else
2331 case "$n" in
2332 '-n') n='' c='\c';;
2333 *) n='-n' c='';;
2334 esac
2335 cat <<FOO
2336They are not compatible! You are probably running ksh on a non-USG system.
2337I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2338have echo built in and we may have to run some Bourne shell scripts. That
2339means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2340
2341FOO
2342 $echo $n "The star should be here-->$c"
2343 $echo "*"
2344 fi
2345 $rm -f foo1 foo2
2346 ;;
2347esac
2348
6b769f8f 2349cat <<EOS >trygcc
2573c5f9
JH
2350$startsh
2351EOS
6b769f8f 2352cat <<'EOSC' >>trygcc
2573c5f9
JH
2353case "$cc" in
2354'') ;;
2355*) $rm -f try try.*
2356 $cat >try.c <<EOM
2357int main(int argc, char *argv[]) {
2358 return 0;
2359}
2360EOM
e4778687 2361 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2362 :
2363 else
2364 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2365 despair=yes
2366 trygcc=yes
2367 case "$cc" in
2368 *gcc*) trygcc=no ;;
2369 esac
2370 case "`$cc -v -c try.c 2>&1`" in
2371 *gcc*) trygcc=no ;;
2372 esac
2373 if $test X"$trygcc" = Xyes; then
2374 if gcc -o try -c try.c; then
2375 echo " "
2376 echo "You seem to have a working gcc, though." >&4
2377 rp="Would you like to use it?"
2378 dflt=y
2379 if $test -f myread; then
2380 . ./myread
2381 else
2382 if $test -f UU/myread; then
2383 . ./UU/myread
2384 else
2385 echo "Cannot find myread, sorry. Aborting." >&2
2386 exit 1
2387 fi
2388 fi
2389 case "$ans" in
6371411c
RB
2390 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2391 if $test -f usethreads.cbu; then
2392 $cat >&4 <<EOM
2393
2394*** However, any setting of the C compiler flags (e.g. for thread support)
2395*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2396*** (together with e.g. -Dusethreads).
2397
2398EOM
2399 fi;;
2573c5f9
JH
2400 esac
2401 fi
2402 fi
6b769f8f
RB
2403 fi
2404 $rm -f try try.*
2405 ;;
2406esac
2407EOSC
2408
2409cat <<EOS >checkcc
2410$startsh
2411EOS
2412cat <<'EOSC' >>checkcc
2413case "$cc" in
2414'') ;;
2415*) $rm -f try try.*
2416 $cat >try.c <<EOM
2417int main(int argc, char *argv[]) {
2418 return 0;
2419}
2420EOM
2421 if $cc -o try $ccflags $ldflags try.c; then
2422 :
2423 else
2573c5f9 2424 if $test X"$despair" = Xyes; then
6b769f8f
RB
2425 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2426 fi
2427 $cat >&4 <<EOM
5dd4fbdf
MB
2428You need to find a working C compiler.
2429Either (purchase and) install the C compiler supplied by your OS vendor,
2430or for a free C compiler try http://gcc.gnu.org/
2431I cannot continue any further, aborting.
2432EOM
6b769f8f 2433 exit 1
2573c5f9
JH
2434 fi
2435 $rm -f try try.*
2436 ;;
2437esac
2438EOSC
2439
a0d0e21e
LW
2440: determine whether symbolic links are supported
2441echo " "
2442$touch blurfl
2443if $ln -s blurfl sym > /dev/null 2>&1 ; then
2444 echo "Symbolic links are supported." >&4
818f00be 2445 lns="$ln -s"
a0d0e21e
LW
2446else
2447 echo "Symbolic links are NOT supported." >&4
2448 lns="$ln"
2449fi
2450$rm -f blurfl sym
2451
dafca956
JH
2452: determine whether symbolic links are supported
2453echo " "
2454case "$lns" in
18ea2752 2455*"ln"*" -s")
dafca956
JH
2456 echo "Checking how to test for symbolic links..." >&4
2457 $lns blurfl sym
4b661809 2458 if $test "X$issymlink" = X; then
2e2a97a6
JH
2459 case "$newsh" in
2460 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2461 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2462 esac
5d644a95
MB
2463 if test $? = 0; then
2464 issymlink="test -h"
2e2a97a6
JH
2465 else
2466 echo "Your builtin 'test -h' may be broken." >&4
2467 case "$test" in
2468 /*) ;;
2469 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2470 for p in $pth
2471 do
2472 if test -f "$p/$test"; then
2473 test="$p/$test"
2474 break
2475 fi
2476 done
2477 ;;
2478 esac
2479 case "$test" in
2480 /*)
2481 echo "Trying external '$test -h'." >&4
2482 issymlink="$test -h"
2483 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2484 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2485 issymlink=''
2486 fi
2487 ;;
2488 *) issymlink='' ;;
2489 esac
5d644a95
MB
2490 fi
2491 fi
4b661809 2492 if $test "X$issymlink" = X; then
dafca956 2493 if $test -L sym 2>/dev/null; then
5d644a95 2494 issymlink="$test -L"
2e2a97a6 2495 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2496 fi
2497 fi
4b661809 2498 if $test "X$issymlink" != X; then
5d644a95 2499 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2500 else
2501 echo "I do not know how you can test for symbolic links." >&4
2502 fi
2503 $rm -f blurfl sym
2504 ;;
2505*) echo "No symbolic links, so not testing for their testing..." >&4
2506 ;;
2507esac
2508echo " "
2509
2510
2511case "$mksymlinks" in
2512$define|true|[yY]*)
2513 case "$src" in
2514 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2515 exit 1
2516 ;;
4b661809 2517 *) case "$lns:$issymlink" in
f314eb9f 2518 *"ln"*" -s:"*"test -"?)
dafca956
JH
2519 echo "Creating the symbolic links..." >&4
2520 echo "(First creating the subdirectories...)" >&4
2521 cd ..
2522 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2523 read directory
2524 test -z "$directory" && break
2525 mkdir -p $directory
2526 done
2527 # Sanity check 1.
2528 if test ! -d t/base; then
2529 echo "Failed to create the subdirectories. Aborting." >&4
2530 exit 1
2531 fi
2532 echo "(Then creating the symlinks...)" >&4
2533 awk '{print $1}' $src/MANIFEST | while true; do
2534 read filename
2535 test -z "$filename" && break
2536 if test -f $filename; then
5d644a95 2537 if $issymlink $filename; then
dafca956
JH
2538 rm -f $filename
2539 fi
2540 fi
2541 if test -f $filename; then
2542 echo "$filename already exists, not symlinking."
2543 else
2544 ln -s $src/$filename $filename
2545 fi
2546 done
2547 # Sanity check 2.
a0d24b8a
JH
2548 if test ! -f t/base/lex.t; then
2549 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2550 exit 1
2551 fi
2552 cd UU
2553 ;;
2554 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2555 ;;
2556 esac
2557 ;;
2558 esac
2559 ;;
2560esac
2561
5440bc8e
JH
2562
2563case "$usecrosscompile" in
2564$define|true|[yY]*)
93bc48fa 2565 $echo "Cross-compiling..."
5440bc8e
JH
2566 croak=''
2567 case "$cc" in
2568 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2569 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2570 ar=$targetarch-ar
2571 # leave out ld, choosing it is more complex
2572 nm=$targetarch-nm
2573 ranlib=$targetarch-ranlib
93bc48fa 2574 $echo 'extern int foo;' > try.c
f8006fac 2575 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2576 shift
2577 if $test $# -gt 0; then
2578 incpth="$incpth $*"
f8006fac
JH
2579 incpth="`$echo $incpth|$sed 's/^ //'`"
2580 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2581 for i in $*; do
f8006fac 2582 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2583 if $test -d $j; then
2584 libpth="$libpth $j"
2585 fi
2586 done
f8006fac
JH
2587 libpth="`$echo $libpth|$sed 's/^ //'`"
2588 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2589 fi
2590 $rm -f try.c
5440bc8e
JH
2591 ;;
2592 esac
2593 case "$targetarch" in
93bc48fa
JH
2594 '') echo "Targetarch not defined." >&4; croak=y ;;
2595 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2596 esac
2597 case "$incpth" in
93bc48fa 2598 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2599 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2600 esac
2601 case "$libpth" in
93bc48fa 2602 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2603 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2604 esac
93bc48fa
JH
2605 case "$usrinc" in
2606 '') for i in $incpth; do
2607 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2608 usrinc=$i
2609 echo "Guessing usrinc $usrinc." >&4
2610 break
2611 fi
2612 done
2613 case "$usrinc" in
2614 '') echo "Usrinc not defined." >&4; croak=y ;;
2615 esac
2616 ;;
2617 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2618 esac
93bc48fa
JH
2619 case "$targethost" in
2620 '') echo "Targethost not defined." >&4; croak=y ;;
2621 *) echo "Using targethost $targethost." >&4
5440bc8e 2622 esac
93bc48fa
JH
2623 locincpth=' '
2624 loclibpth=' '
5440bc8e 2625 case "$croak" in
93bc48fa 2626 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2627 esac
2628 case "$src" in
2629 /*) run=$src/Cross/run
93c0359c 2630 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2631 to=$src/Cross/to
2632 from=$src/Cross/from
2633 ;;
93bc48fa 2634 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2635 run=$pwd/Cross/run
f8006fac 2636 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2637 to=$pwd/Cross/to
2638 from=$pwd/Cross/from
2639 ;;
2640 esac
2641 case "$targetrun" in
2642 '') targetrun=ssh ;;
2643 esac
2644 case "$targetto" in
2645 '') targetto=scp ;;
2646 esac
2647 case "$targetfrom" in
2648 '') targetfrom=scp ;;
2649 esac
2650 run=$run-$targetrun
2651 to=$to-$targetto
2652 from=$from-$targetfrom
93bc48fa
JH
2653 case "$targetdir" in
2654 '') targetdir=/tmp
2655 echo "Guessing targetdir $targetdir." >&4
2656 ;;
2657 esac
5440bc8e 2658 case "$targetuser" in
93bc48fa
JH
2659 '') targetuser=root
2660 echo "Guessing targetuser $targetuser." >&4
2661 ;;
5440bc8e
JH
2662 esac
2663 case "$targetfrom" in
2664 scp) q=-q ;;
2665 *) q='' ;;
2666 esac
2667 case "$targetrun" in
2668 ssh|rsh)
2669 cat >$run <<EOF
2670#!/bin/sh
93c0359c
JH
2671case "\$1" in
2672-cwd)
2673 shift
2674 cwd=\$1
2675 shift
2676 ;;
2677esac
2678case "\$cwd" in
2679'') cwd=$targetdir ;;
2680esac
5440bc8e
JH
2681exe=\$1
2682shift
93c0359c
JH
2683if $test ! -f \$exe.xok; then
2684 $to \$exe
2685 $touch \$exe.xok
2686fi
2687$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2688EOF
2689 ;;
93bc48fa 2690 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2691 exit 1
2692 ;;
2693 esac
93c0359c
JH
2694 case "$targetmkdir" in
2695 */Cross/mkdir)
2696 cat >$targetmkdir <<EOF
2697#!/bin/sh
2698$targetrun -l $targetuser $targethost "mkdir -p \$@"
2699EOF
f8006fac 2700 $chmod a+rx $targetmkdir
93c0359c
JH
2701 ;;
2702 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2703 exit 1
2704 ;;
2705 esac
5440bc8e
JH
2706 case "$targetto" in
2707 scp|rcp)
2708 cat >$to <<EOF
2709#!/bin/sh
2710for f in \$@
2711do
93c0359c
JH
2712 case "\$f" in
2713 /*)
2714 $targetmkdir \`dirname \$f\`
2715 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2716 ;;
2717 *)
2718 $targetmkdir $targetdir/\`dirname \$f\`
2719 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2720 ;;
2721 esac
5440bc8e
JH
2722done
2723exit 0
2724EOF
2725 ;;
2726 cp) cat >$to <<EOF
2727#!/bin/sh
93c0359c
JH
2728for f in \$@
2729do
2730 case "\$f" in
2731 /*)
2732 $mkdir -p $targetdir/\`dirname \$f\`
2733 $cp \$f $targetdir/\$f || exit 1
2734 ;;
2735 *)
2736 $targetmkdir $targetdir/\`dirname \$f\`
2737 $cp \$f $targetdir/\$f || exit 1
2738 ;;
2739 esac
2740done
2741exit 0
5440bc8e
JH
2742EOF
2743 ;;
93bc48fa 2744 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2745 exit 1
2746 ;;
2747 esac
2748 case "$targetfrom" in
2749 scp|rcp)
2750 cat >$from <<EOF
2751#!/bin/sh
2752for f in \$@
2753do
93c0359c 2754 $rm -f \$f
5440bc8e
JH
2755 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2756done
2757exit 0
2758EOF
2759 ;;
2760 cp) cat >$from <<EOF
2761#!/bin/sh
2762for f in \$@
2763do
93c0359c 2764 $rm -f \$f
5440bc8e
JH
2765 cp $targetdir/\$f . || exit 1
2766done
2767exit 0
2768EOF
2769 ;;
93bc48fa 2770 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2771 exit 1
2772 ;;
2773 esac
93bc48fa
JH
2774 if $test ! -f $run; then
2775 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2776 else
f8006fac 2777 $chmod a+rx $run
5440bc8e 2778 fi
93bc48fa
JH
2779 if $test ! -f $to; then
2780 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2781 else
f8006fac 2782 $chmod a+rx $to
5440bc8e 2783 fi
93bc48fa
JH
2784 if $test ! -f $from; then
2785 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2786 else
f8006fac 2787 $chmod a+rx $from
5440bc8e 2788 fi
93bc48fa 2789 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2790 exit 1
2791 fi
2792 cat >&4 <<EOF
f8006fac
JH
2793Using '$run' for remote execution,
2794and '$from' and '$to'
93bc48fa 2795for remote file transfer.
5440bc8e
JH
2796EOF
2797 ;;
2798*) run=''
2799 to=:
2800 from=:
2801 usecrosscompile='undef'
2802 targetarch=''
2803 ;;
2804esac
2805
ecfc5424
AD
2806: see whether [:lower:] and [:upper:] are supported character classes
2807echo " "
ecfc5424
AD
2808case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2809ABYZ)
2810 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2811 up='[:upper:]'
2812 low='[:lower:]'
2813 ;;
28e8609d
JH
2814*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2815 # (0xc9 and 0xd1), therefore that is a nice testing point.
2816 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2817 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2818 ij) up='[A-Z]'
2819 low='[a-z]'
2820 ;;
2821 esac
2822 fi
2823 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2824 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2825 ij) up='A-Z'
2826 low='a-z'
2827 ;;
2828 esac
2829 fi
2830 if test "X$up" = X -o "X$low" = X; then
2831 case "`echo IJ | od -x 2>/dev/null`" in
2832 *C9D1*|*c9d1*)
2833 echo "Hey, this might be EBCDIC." >&4
2834 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2835 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2836 ij) up='[A-IJ-RS-Z]'
2837 low='[a-ij-rs-z]'
2838 ;;
2839 esac
2840 fi
2841 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2842 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2843 ij) up='A-IJ-RS-Z'
2844 low='a-ij-rs-z'
2845 ;;
2846 esac
2847 fi
2848 ;;
2849 esac
2850 fi
2851esac
3eaeeeae 2852case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2853ij)
2854 echo "Using $up and $low to convert case." >&4
2855 ;;
ecfc5424 2856*)
28e8609d
JH
2857 echo "I don't know how to translate letters from upper to lower case." >&4
2858 echo "Your tr is not acting any way I know of." >&4
2859 exit 1
2860 ;;
ecfc5424
AD
2861esac
2862: set up the translation script tr, must be called with ./tr of course
2863cat >tr <<EOSC
2864$startsh
2865case "\$1\$2" in
2866'[A-Z][a-z]') exec $tr '$up' '$low';;
2867'[a-z][A-Z]') exec $tr '$low' '$up';;
2868esac
2869exec $tr "\$@"
2870EOSC
2871chmod +x tr
2872$eunicefix tr
2873
2304df62
AD
2874: Try to determine whether config.sh was made on this system
2875case "$config_sh" in
2876'')
43999f95
JH
2877myuname=`$uname -a 2>/dev/null`
2878$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2879# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2880# because the A-Z/a-z are not consecutive.
a0d0e21e 2881myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2882 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2883newmyuname="$myuname"
2304df62 2884dflt=n
16d20bd9
AD
2885case "$knowitall" in
2886'')
2887 if test -f ../config.sh; then
2888 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2889 eval "`grep myuname= ../config.sh`"
2890 fi
2891 if test "X$myuname" = "X$newmyuname"; then
2892 dflt=y
2893 fi
2304df62 2894 fi
16d20bd9
AD
2895 ;;
2896*) dflt=y;;
2897esac
2304df62
AD
2898
2899: Get old answers from old config file if Configure was run on the
2900: same system, otherwise use the hints.
2901hint=default
2902cd ..
2903if test -f config.sh; then
16d20bd9
AD
2904 echo " "
2905 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2906 . UU/myread
2907 case "$ans" in
f83701cd
AD
2908 n*|N*) echo "OK, I'll ignore it."
2909 mv config.sh config.sh.old
2910 myuname="$newmyuname"
2911 ;;
2304df62 2912 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2913 tmp_n="$n"
2914 tmp_c="$c"
85cad39c 2915 tmp_sh="$sh"
2304df62
AD
2916 . ./config.sh
2917 cp config.sh UU
ecfc5424
AD
2918 n="$tmp_n"
2919 c="$tmp_c"
85cad39c 2920 : Older versions did not always set $sh. Catch re-use of such
2921 : an old config.sh.
2922 case "$sh" in
2923 '') sh="$tmp_sh" ;;
2924 esac
2304df62
AD
2925 hint=previous
2926 ;;
2927 esac
2928fi
2573c5f9 2929. ./UU/checkcc
2304df62
AD
2930if test ! -f config.sh; then
2931 $cat <<EOM
2932
4e2a5f63
AD
2933First time through, eh? I have some defaults handy for some systems
2934that need some extra help getting the Configure answers right:
2304df62
AD
2935
2936EOM
dfe9444c 2937 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2938 dflt=''
2939 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2940 : tests or hints, please send them to perlbug@perl.org
2304df62 2941 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2942 $test -f /irix && osname=irix
85e6fe83
LW
2943 $test -f /xenix && osname=sco_xenix
2944 $test -f /dynix && osname=dynix
2945 $test -f /dnix && osname=dnix
5f05dabc 2946 $test -f /lynx.os && osname=lynxos
2947 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2948 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2949 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2950 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2951 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2952 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2953 $test -d /usr/apollo/bin && osname=apollo
2954 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2955 $test -d /usr/include/minix && osname=minix
d54344fc 2956 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 2957 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2958 osname=machten
4633a7c4 2959 if $test -x /sbin/version; then
dfe9444c 2960 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2961 $sed -e 's/[A-Za-z]$//'`
2962 elif $test -x /usr/etc/version; then
dfe9444c 2963 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2964 $sed -e 's/[A-Za-z]$//'`
2965 else
2966 osvers="$2.$3"
2967 fi
2968 fi
aaacdc8b
GS
2969
2970 $test -f /sys/posix.dll &&
2971 $test -f /usr/bin/what &&
2972 set X `/usr/bin/what /sys/posix.dll` &&
2973 $test "$3" = UWIN &&
2974 osname=uwin &&
2975 osvers="$5"
2976
2304df62
AD
2977 if $test -f $uname; then
2978 set X $myuname
2979 shift
2980
2304df62 2981 case "$5" in
85e6fe83 2982 fps*) osname=fps ;;
2304df62
AD
2983 mips*)
2984 case "$4" in
85e6fe83
LW
2985 umips) osname=umips ;;
2986 *) osname=mips ;;
2304df62 2987 esac;;
85e6fe83
LW
2988 [23]100) osname=mips ;;
2989 next*) osname=next ;;
ecfc5424 2990 i386*)
c6912327
JH
2991 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2992 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2993 osname='sco'
2994 osvers=$tmp
2995 elif $test -f /etc/kconfig; then
ecfc5424 2996 osname=isc
bd628c73 2997 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2998 osvers=4
2999 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3000 osvers=3
2304df62 3001 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3002 osvers=2
ecfc5424
AD
3003 fi
3004 fi
2000072c 3005 tmp=''
ecfc5424 3006 ;;
c4f23d77
AD
3007 pc*)
3008 if test -n "$DJGPP"; then
3009 osname=dos
3010 osvers=djgpp
3011 fi
3012 ;;
2304df62
AD
3013 esac
3014
3015 case "$1" in
a0d0e21e
LW
3016 aix) osname=aix
3017 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3018 case "$tmp" in
1aef975c 3019 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
3020 '<3240'|'<>3240') osvers=3.2.0 ;;
3021 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3022 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3023 *) osvers=$tmp;;
a0d0e21e
LW
3024 esac
3025 ;;
aaacdc8b
GS
3026 bsd386) osname=bsd386
3027 osvers=`$uname -r`
3028 ;;
3029 cygwin*) osname=cygwin
3030 osvers="$3"
3031 ;;
23f87696
SZ
3032 *dc.osx) osname=dcosx
3033 osvers="$3"
3034 ;;
a0d0e21e
LW
3035 dnix) osname=dnix
3036 osvers="$3"
3037 ;;
3038 domainos) osname=apollo
3039 osvers="$3"
3040 ;;
3041 dgux) osname=dgux
3042 osvers="$3"
3043 ;;
760ac839 3044 dynixptx*) osname=dynixptx
e58e581d 3045 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3046 ;;
a0d0e21e
LW
3047 freebsd) osname=freebsd
3048 osvers="$3" ;;
3049 genix) osname=genix ;;
3050 hp*) osname=hpux
bfb7748a 3051 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3052 ;;
a78b0d02 3053 irix*) osname=irix
a0d0e21e
LW
3054 case "$3" in
3055 4*) osvers=4 ;;
3056 5*) osvers=5 ;;
ecfc5424 3057 *) osvers="$3" ;;
a0d0e21e
LW
3058 esac
3059 ;;
3060 linux) osname=linux
3061 case "$3" in
a0d0e21e
LW
3062 *) osvers="$3" ;;
3063 esac
3064 ;;
28e8609d
JH
3065 MiNT) osname=mint
3066 ;;
3067 netbsd*) osname=netbsd
ecfc5424
AD
3068 osvers="$3"
3069 ;;
4e81affe
MM
3070 news-os) osvers="$3"
3071 case "$3" in
3072 4*) osname=newsos4 ;;
3073 *) osname=newsos ;;
3074 esac
3075 ;;
aaacdc8b 3076 next*) osname=next ;;
28bb1e2c 3077 nonstop-ux) osname=nonstopux ;;
aaacdc8b
GS
3078 POSIX-BC | posix-bc ) osname=posix-bc
3079 osvers="$3"
a0d0e21e 3080 ;;
ae3afa4e
TH
3081 powerux | power_ux | powermax_os | powermaxos | \
3082 powerunix | power_unix) osname=powerux
3083 osvers="$3"
3084 ;;
aaacdc8b
GS
3085 qnx) osname=qnx
3086 osvers="$4"
3087 ;;
a0d0e21e
LW
3088 solaris) osname=solaris
3089 case "$3" in
3090 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3091 *) osvers="$3" ;;
a0d0e21e
LW
3092 esac
3093 ;;
85e6fe83
LW
3094 sunos) osname=sunos
3095 case "$3" in
85e6fe83
LW
3096 5*) osname=solaris
3097 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3098 *) osvers="$3" ;;
2304df62
AD
3099 esac
3100 ;;
a0d0e21e 3101 titanos) osname=titanos
85e6fe83 3102 case "$3" in
a0d0e21e
LW
3103 1*) osvers=1 ;;
3104 2*) osvers=2 ;;
3105 3*) osvers=3 ;;
3106 4*) osvers=4 ;;
ecfc5424 3107 *) osvers="$3" ;;
2304df62
AD
3108 esac
3109 ;;
85e6fe83 3110 ultrix) osname=ultrix
ecfc5424 3111 osvers="$3"
2304df62 3112 ;;
28757baa 3113 osf1|mls+) case "$5" in
fed7345c
AD
3114 alpha)
3115 osname=dec_osf
2aa76180
JH
3116 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3117 case "$osvers" in
3118 [1-9].[0-9]*) ;;
3119 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3120 esac
ecfc5424
AD
3121 ;;
3122 hp*) osname=hp_osf1 ;;
3123 mips) osname=mips_osf1 ;;
85e6fe83
LW
3124 esac
3125 ;;
0337d152
BG
3126 unixware) osname=svr5
3127 osvers="$4"
3128 ;;
3c728e00 3129 uts) osname=uts
a0d0e21e
LW
3130 osvers="$3"
3131 ;;
3c728e00
JH
3132 vos) osvers="$3"
3133 ;;
85e6fe83 3134 $2) case "$osname" in
2304df62 3135 *isc*) ;;
a0d0e21e 3136 *freebsd*) ;;
5f05dabc 3137 svr*)
a0d0e21e
LW
3138 : svr4.x or possibly later
3139 case "svr$3" in
3140 ${osname}*)
3141 osname=svr$3
3142 osvers=$4
3143 ;;
3144 esac
3145 case "$osname" in
3146 svr4.0)
3147 : Check for ESIX
3148 if test -f /stand/boot ; then
3149 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3150 if test -n "$INITPROG" -a -f "$INITPROG"; then
3151 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3152 if test -n "$isesix"; then
a0d0e21e
LW
3153 osname=esix4
3154 fi
3155 fi
3156 fi
3157 ;;
3158 esac
3159 ;;
2304df62 3160 *) if test -f /etc/systemid; then
a0d0e21e
LW
3161 osname=sco
3162 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3163 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3164 osvers=$1.$2.$3
c4f23d77 3165 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3166 osvers=$1.$2
c4f23d77 3167 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3168 osvers=$1
2304df62 3169 fi
a0d0e21e
LW
3170 else
3171 case "$osname" in
3172 '') : Still unknown. Probably a generic Sys V.
3173 osname="sysv"
3174 osvers="$3"
3175 ;;
3176 esac
2304df62
AD
3177 fi
3178 ;;
3179 esac
3180 ;;
a0d0e21e
LW
3181 *) case "$osname" in
3182 '') : Still unknown. Probably a generic BSD.
3183 osname="$1"
3184 osvers="$3"
3185 ;;
3186 esac
3187 ;;
2304df62
AD
3188 esac
3189 else
dfe9444c
AD
3190 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3191 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3192 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3193 osname=news_os
2304df62 3194 fi
dfe9444c 3195 $rm -f UU/kernel.what
8e07c86e
AD
3196 elif test -d c:/.; then
3197 set X $myuname
3198 osname=os2
3199 osvers="$5"
2304df62
AD
3200 fi
3201 fi
85e6fe83 3202
5440bc8e
JH
3203 case "$targetarch" in
3204 '') ;;
3205 *) hostarch=$osname
3206 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3207 osvers=''
3208 ;;
3209 esac
3210
a0d0e21e
LW
3211 : Now look for a hint file osname_osvers, unless one has been
3212 : specified already.
3213 case "$hintfile" in
3214 ''|' ')
1e127011 3215 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3216 : Also try without trailing minor version numbers.
1e127011
DD
3217 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3218 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3219 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3220 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3221 case "$file" in
3222 '') dflt=none ;;
3223 *) case "$osvers" in
3224 '') dflt=$file
3225 ;;
dfe9444c 3226 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3227 dflt=$file
dfe9444c 3228 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3229 dflt=$xfile
dfe9444c 3230 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3231 dflt=$xxfile
dfe9444c 3232 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3233 dflt=$xxxfile
dfe9444c 3234 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3235 dflt=$xxxxfile
dfe9444c 3236 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3237 dflt="${osname}"
3238 else
3239 dflt=none
3240 fi
3241 ;;
3242 esac
85e6fe83
LW
3243 ;;
3244 esac
4e2a5f63
AD
3245 if $test -f Policy.sh ; then
3246 case "$dflt" in
3247 *Policy*) ;;
3248 none) dflt="Policy" ;;
3249 *) dflt="Policy $dflt" ;;
3250 esac
3251 fi
85e6fe83 3252 ;;
a0d0e21e 3253 *)
ecfc5424 3254 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3255 ;;
2304df62 3256 esac
1aef975c 3257
4e2a5f63
AD
3258 if $test -f Policy.sh ; then
3259 $cat <<EOM
3260
3261There's also a Policy hint file available, which should make the
3262site-specific (policy) questions easier to answer.
3263EOM
3264
3265 fi
3266
2304df62
AD
3267 $cat <<EOM
3268
3269You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3270A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3271is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3272
3273EOM
4e2a5f63 3274
2304df62 3275 rp="Which of these apply, if any?"
dfe9444c 3276 . UU/myread
85e6fe83
LW
3277 tans=$ans
3278 for file in $tans; do
4e2a5f63
AD
3279 if $test X$file = XPolicy -a -f Policy.sh; then
3280 . Policy.sh
3281 $cat Policy.sh >> UU/config.sh
3282 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3283 . $src/hints/$file.sh
3284 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3285 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3286 : nothing
3287 else
85e6fe83
LW
3288 : Give one chance to correct a possible typo.
3289 echo "$file.sh does not exist"
3290 dflt=$file
3291 rp="hint to use instead?"
dfe9444c 3292 . UU/myread
85e6fe83 3293 for file in $ans; do
dfe9444c
AD
3294 if $test -f "$src/hints/$file.sh"; then
3295 . $src/hints/$file.sh
3296 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3297 elif $test X$ans = X -o X$ans = Xnone ; then
3298 : nothing
3299 else
3300 echo "$file.sh does not exist -- ignored."
3301 fi
3302 done
2304df62
AD
3303 fi
3304 done
85e6fe83 3305
2304df62 3306 hint=recommended
85e6fe83 3307 : Remember our hint file for later.
dfe9444c 3308 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3309 hintfile="$file"
85e6fe83 3310 else
a0d0e21e 3311 hintfile=''
85e6fe83 3312 fi
2304df62
AD
3313fi
3314cd UU
3315;;
3316*)
3317 echo " "
3318 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3319 tmp_n="$n"
3320 tmp_c="$c"
2304df62
AD
3321 cd ..
3322 cp $config_sh config.sh 2>/dev/null
a78b0d02 3323 chmod +w config.sh
2304df62
AD
3324 . ./config.sh
3325 cd UU
3326 cp ../config.sh .
ecfc5424
AD
3327 n="$tmp_n"
3328 c="$tmp_c"
2304df62
AD
3329 hint=previous
3330 ;;
3331esac
1aef975c 3332test "$override" && . ./optdef.sh
2304df62
AD
3333
3334: Restore computed paths
3335for file in $loclist $trylist; do
3336 eval $file="\$_$file"
3337done
3338
85e6fe83 3339cat << EOM
a0d0e21e 3340
85e6fe83 3341Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3342The default value is probably right if the name rings a bell. Otherwise,
3343since spelling matters for me, either accept the default or answer "none"
3344to leave it blank.
a0d0e21e 3345
85e6fe83 3346EOM
85e6fe83 3347case "$osname" in
a0d0e21e 3348 ''|' ')
85e6fe83 3349 case "$hintfile" in
a0d0e21e 3350 ''|' '|none) dflt=none ;;
ecfc5424 3351 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3352 esac
3353 ;;
3354 *) dflt="$osname" ;;
3355esac
3356rp="Operating system name?"
3357. ./myread
3358case "$ans" in
ecfc5424
AD
3359none) osname='' ;;
3360*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3361esac
8ff267be 3362echo " "
3363case "$osvers" in
3364 ''|' ')
3365 case "$hintfile" in
3366 ''|' '|none) dflt=none ;;
3367 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3368 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3369 case "$dflt" in
3370 ''|' ') dflt=none ;;
3371 esac
3372 ;;
3373 esac
3374 ;;
3375 *) dflt="$osvers" ;;
3376esac
3377rp="Operating system version?"
3378. ./myread
3379case "$ans" in
3380none) osvers='' ;;
3381*) osvers="$ans" ;;
3382esac
3383
02e93a22
JH
3384
3385. ./posthint.sh
3386
2304df62 3387: who configured the system
59b83a6f 3388cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3389cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3390case "$cf_by" in
3391"")
8ff267be 3392 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3393 case "$cf_by" in
3394 "") cf_by=unknown ;;
8ff267be 3395 esac ;;
3396esac
2304df62 3397
b4eb6b3d
JH
3398: set up the script used to warn in case of inconsistency
3399cat <<EOS >whoa
3400$startsh
3401EOS
3402cat <<'EOSC' >>whoa
3403dflt=y
3404echo " "
3405echo "*** WHOA THERE!!! ***" >&4
3406echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3407rp=" Keep the $hint value?"
3408. ./myread
3409case "$ans" in
3410y) td=$was; tu=$was;;
3411esac
3412EOSC
3413
3414: function used to set $1 to $val
3415setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3416case "$val$was" in
3417$define$undef) . ./whoa; eval "$var=\$td";;
3418$undef$define) . ./whoa; eval "$var=\$tu";;
3419*) eval "$var=$val";;
3420esac'
3421
3422case "$usethreads" in
3423$define|true|[yY]*) dflt='y';;
3424*) dflt='n';;
3425esac
3426cat <<EOM
3427
3428Perl can be built to take advantage of threads on some systems.
3429To do so, Configure can be run with -Dusethreads.
3430
3431Note that threading is a highly experimental feature, and
3432some known race conditions still remain. If you choose to try
3433it, be very sure to not actually deploy it for production
3434purposes. README.threads has more details, and is required
3435reading if you enable threads.
3436
3437If this doesn't make any sense to you, just accept the default '$dflt'.
3438EOM
3439rp='Build a threading Perl?'
3440. ./myread
3441case "$ans" in
3442y|Y) val="$define" ;;
3443*) val="$undef" ;;
3444esac
3445set usethreads
3446eval $setvar
3447
3448case "$usethreads" in
3449$define)
3450 $cat <<EOM
3451
6d5328bc
JH
3452As of release 5.6, Perl has two different threading implementations,
3453an interpreter-based version (ithreads) with one interpreter per
3454thread, and the 5.005 version (5005threads). Both implementations
3455are considered experimental, but since 5.8 ithreads somewhat less so.
3456The 5005threads is effectively unmaintained.
b4eb6b3d 3457
b4eb6b3d
JH
3458EOM
3459 : Default to ithreads unless overridden on command line or with
3460 : old config.sh
3461 dflt='y'
3462 case "$use5005threads" in
3463 $define|true|[yY]*) dflt='n';;
3464 esac
3465 case "$useithreads" in
3466 $undef|false|[nN]*) dflt='n';;
3467 esac
3468 rp='Use interpreter-based ithreads?'
3469 . ./myread
3470 case "$ans" in
3471 y|Y) val="$define" ;;
3472 *) val="$undef" ;;
3473 esac
3474 set useithreads
3475 eval $setvar
3476 : Now set use5005threads to the opposite value.
3477 case "$useithreads" in
3478 $define) val="$undef" ;;
3479 *) val="$define" ;;
3480 esac
3481 set use5005threads
3482 eval $setvar
3483 ;;
3484*)
3485 useithreads="$undef"
3486 use5005threads="$undef"
3487 ;;
3488esac
3489
c915ce7f
JH
3490case "$useithreads$use5005threads" in
3491"$define$define")
3492 $cat >&4 <<EOM
3493
3494You cannot have both the ithreads and the 5.005 threads enabled
3495at the same time. Disabling the 5.005 threads since they are
3496much less stable than the ithreads.
3497
3498EOM
3499 use5005threads="$undef"
3500 ;;
3501esac
3502
b4eb6b3d
JH
3503case "$d_oldpthreads" in
3504'') : Configure tests would be welcome here. For now, assume undef.
3505 val="$undef" ;;
3506*) val="$d_oldpthreads" ;;
3507esac
3508set d_oldpthreads
3509eval $setvar
3510
3511
3512case "$usethreads" in
3513"$define"|true|[yY]*)
3514: Look for a hint-file generated 'call-back-unit'. If the
3515: user has specified that a threading perl is to be built,
3516: we may need to set or change some other defaults.
3517 if $test -f usethreads.cbu; then
3518 echo "Your platform has some specific hints for threaded builds, using them..."
3519 . ./usethreads.cbu
3520 else
3521 $cat <<EOM
3522(Your platform doesn't have any specific hints for threaded builds.
3523 Assuming POSIX threads, then.)
3524EOM
3525 fi
3526 ;;
3527esac
3528
3529cat <<EOM
3530
3531Perl can be built so that multiple Perl interpreters can coexist
3532within the same Perl executable.
3533EOM
3534
3535case "$useithreads" in
3536$define)
3537 cat <<EOM
3538This multiple interpreter support is required for interpreter-based threads.
3539EOM
3540 val="$define"
3541 ;;
3542*) case "$usemultiplicity" in
3543 $define|true|[yY]*) dflt='y';;
3544 *) dflt='n';;
3545 esac
3546 echo " "
3547 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3548 rp='Build Perl for multiplicity?'
3549 . ./myread
3550 case "$ans" in
3551 y|Y) val="$define" ;;
3552 *) val="$undef" ;;
3553 esac
3554 ;;
3555esac
3556set usemultiplicity
3557eval $setvar
3558
96056487
JH
3559
3560case "$usemorebits" in
3561"$define"|true|[yY]*)
3562 use64bitint="$define"
3563 uselongdouble="$define"
3564 usemorebits="$define"
3565 ;;
3566*) usemorebits="$undef"
3567 ;;
3568esac
3569
e5e20432
JH
3570: make some quick guesses about what we are up against
3571echo " "
3572$echo $n "Hmm... $c"
3573echo exit 1 >bsd
3574echo exit 1 >usg
3575echo exit 1 >v7
3576echo exit 1 >osf1
3577echo exit 1 >eunice
3578echo exit 1 >xenix
3579echo exit 1 >venix
3580echo exit 1 >os2
3581d_bsd="$undef"
3582$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3583if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3584then
3585 echo "Looks kind of like an OSF/1 system, but we'll see..."
3586 echo exit 0 >osf1
381aa1ff 3587elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3588 xxx=`./loc addbib blurfl $pth`
3589 if $test -f $xxx; then
3590 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3591 echo exit 0 >bsd
3592 echo exit 0 >usg
3593 else
3594 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3595 echo "Looks kind of like an extended USG system, but we'll see..."
3596 else
3597 echo "Looks kind of like a USG system, but we'll see..."
3598 fi
3599 echo exit 0 >usg
3600 fi
3601elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3602 echo "Looks kind of like a BSD system, but we'll see..."
3603 d_bsd="$define"
3604 echo exit 0 >bsd
3605else
3606 echo "Looks kind of like a Version 7 system, but we'll see..."
3607 echo exit 0 >v7
3608fi
3609case "$eunicefix" in
3610*unixtovms*)
3611 $cat <<'EOI'
3612There is, however, a strange, musty smell in the air that reminds me of
3613something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3614EOI
3615 echo exit 0 >eunice
3616 d_eunice="$define"
3617: it so happens the Eunice I know will not run shell scripts in Unix format
3618 ;;
3619*)
3620 echo " "
3621 echo "Congratulations. You aren't running Eunice."
3622 d_eunice="$undef"
3623 ;;
3624esac
3625: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3626: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3627: semicolon as a patch separator
e5e20432
JH
3628case "$p_" in
3629:) ;;
3630*)
3631 $cat <<'EOI'
3632I have the feeling something is not exactly right, however...don't tell me...
3633lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3634(Or you may be running DOS with DJGPP.)
e5e20432
JH
3635EOI
3636 echo exit 0 >os2
3637 ;;
3638esac
3639if test -f /xenix; then
3640 echo "Actually, this looks more like a XENIX system..."
3641 echo exit 0 >xenix
3642 d_xenix="$define"
3643else
3644 echo " "
3645 echo "It's not Xenix..."
3646 d_xenix="$undef"
3647fi
3648chmod +x xenix
3649$eunicefix xenix
3650if test -f /venix; then
3651 echo "Actually, this looks more like a VENIX system..."
3652 echo exit 0 >venix
3653else
3654 echo " "
3655 if ./xenix; then
3656 : null
3657 else
3658 echo "Nor is it Venix..."
3659 fi
3660fi
3661chmod +x bsd usg v7 osf1 eunice xenix venix os2
3662$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3663$rm -f foo
3664
5869b1f1
JH
3665case "$cc" in
3666'') dflt=cc;;
3667*) dflt="$cc";;
3668esac
3669rp="Use which C compiler?"
3670. ./myread
3671cc="$ans"
6b769f8f
RB
3672
3673: See if they have not cc but they do have gcc
3674. ./trygcc
e5e20432
JH
3675: Look for a hint-file generated 'call-back-unit'. Now that the
3676: user has specified the compiler, we may need to set or change some
3677: other defaults.
3678if $test -f cc.cbu; then
3679 . ./cc.cbu
3680fi
2573c5f9 3681. ./checkcc
8a27cf78 3682
e5e20432
JH
3683echo " "
3684echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3685$cat >try.c <<EOM
e5e20432
JH
3686#include <stdio.h>
3687int main() {
3688#ifdef __GNUC__
3689#ifdef __VERSION__
3690 printf("%s\n", __VERSION__);
3691#else
3692 printf("%s\n", "1");
3693#endif
3694#endif
3695 exit(0);
3696}
3697EOM
5440bc8e
JH
3698if $cc -o try $ccflags $ldflags try.c; then
3699 gccversion=`$run ./try`
e5e20432
JH
3700 case "$gccversion" in
3701 '') echo "You are not using GNU cc." ;;
fc68435e 3702 *) echo "You are using GNU cc $gccversion."
e723fc21 3703 ccname=gcc
fc68435e 3704 ;;
e5e20432
JH
3705 esac
3706else
3707 echo " "
3708 echo "*** WHOA THERE!!! ***" >&4
3709 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3710 case "$knowitall" in
3711 '')
3712 echo " You'd better start hunting for one and let me know about it." >&4
3713 exit 1
3714 ;;
3715 esac
3716fi
5440bc8e 3717$rm -f try try.*
e5e20432
JH
3718case "$gccversion" in
37191*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3720esac
5b463ca7
KS
3721case "$gccversion" in
3722'') gccosandvers='' ;;
10b4ebb5
JH
3723*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3724 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3725 gccshortvers=''
5b463ca7 3726 case "$gccosandvers" in
02903077
JH
3727 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3728 $osname$osvers) ;; # looking good
5b463ca7
KS
3729 $osname*) cat <<EOM >&4
3730
3731*** WHOA THERE!!! ***
3732
3733 Your gcc has not been compiled for the exact release of
3734 your operating system ($gccosandvers versus $osname$osvers).
3735
3736 In general it is a good idea to keep gcc synchronized with
3737 the operating system because otherwise serious problems
3738 may ensue when trying to compile software, like Perl.
3739
3740 I'm trying to be optimistic here, though, and will continue.
3741 If later during the configuration and build icky compilation
02903077
JH
3742 problems appear (headerfile conflicts being the most common
3743 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3744 your operating system release.
3745
3746EOM
3747 ;;
81575342 3748 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3749 esac
3750 ;;
3751esac
e723fc21
JH
3752case "$ccname" in
3753'') ccname="$cc" ;;
3754esac
e5e20432 3755
640374d0 3756
bd9b35c9
JH
3757: decide how portable to be. Allow command line overrides.
3758case "$d_portable" in
3759"$undef") ;;
3760*) d_portable="$define" ;;
104d25b7 3761esac
85ab1d1d 3762
bd9b35c9
JH
3763: set up shell script to do ~ expansion
3764cat >filexp <<EOSS
3765$startsh
3766: expand filename
3767case "\$1" in
3768 ~/*|~)
3769 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3770 ;;
3771 ~*)
3772 if $test -f /bin/csh; then
3773 /bin/csh -f -c "glob \$1"
3774 failed=\$?
3775 echo ""
3776 exit \$failed
e5e20432 3777 else
bd9b35c9
JH
3778 name=\`$expr x\$1 : '..\([^/]*\)'\`
3779 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3780 if $test ! -d "\$dir"; then
3781 me=\`basename \$0\`
3782 echo "\$me: can't locate home directory for: \$name" >&2
3783 exit 1
3784 fi
3785 case "\$1" in
3786 */*)
3787 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3788 ;;
3789 *)
3790 echo \$dir
e5e20432
JH
3791 ;;
3792 esac
3793 fi
b691c02f 3794 ;;
4633a7c4 3795*)
bd9b35c9 3796 echo \$1
2304df62
AD
3797 ;;
3798esac
4633a7c4
LW
3799EOSS
3800chmod +x filexp
3801$eunicefix filexp
2304df62
AD
3802
3803: now set up to get a file name
28757baa 3804cat <<EOS >getfile
3805$startsh
3806EOS
3807cat <<'EOSC' >>getfile
2304df62
AD
3808tilde=''
3809fullpath=''
3810already=''
3811skip=''
3812none_ok=''
3813exp_file=''
a0d0e21e 3814nopath_ok=''
2304df62
AD
3815orig_rp="$rp"
3816orig_dflt="$dflt"
b233458b
JH
3817case "$gfpth" in
3818'') gfpth='.' ;;
3819esac
2304df62
AD
3820
3821case "$fn" in
ecfc5424 3822*\(*)
381aa1ff 3823 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3824 fn=`echo $fn | sed 's/(.*)//'`
3825 ;;
3826esac
3827
3828case "$fn" in
a0d0e21e
LW
3829*:*)
3830 loc_file=`expr $fn : '.*:\(.*\)'`
3831 fn=`expr $fn : '\(.*\):.*'`
3832 ;;
3833esac
3834
3835case "$fn" in
2304df62
AD
3836*~*) tilde=true;;
3837esac
3838case "$fn" in
3839*/*) fullpath=true;;
3840esac
3841case "$fn" in
3842*+*) skip=true;;
3843esac
3844case "$fn" in
3845*n*) none_ok=true;;
3846esac
3847case "$fn" in
3848*e*) exp_file=true;;
3849esac
a0d0e21e
LW
3850case "$fn" in
3851*p*) nopath_ok=true;;
3852esac
2304df62
AD
3853
3854case "$fn" in
3855*f*) type='File';;
3856*d*) type='Directory';;
a0d0e21e 3857*l*) type='Locate';;
2304df62
AD
3858esac
3859
3860what="$type"
3861case "$what" in
3862Locate) what='File';;
3863esac
3864
3865case "$exp_file" in
3866'')
3867 case "$d_portable" in
3868 "$define") ;;
3869 *) exp_file=true;;
3870 esac
3871 ;;
3872esac
3873
3874cd ..
3875while test "$type"; do
3876 redo=''
3877 rp="$orig_rp"
3878 dflt="$orig_dflt"
3879 case "$tilde" in
3880 true) rp="$rp (~name ok)";;
3881 esac
3882 . UU/myread
ecfc5424
AD
3883 if test -f UU/getfile.ok && \
3884 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3885 then
3886 value="$ans"
3887 ansexp="$ans"
3888 break
3889 fi
2304df62
AD
3890 case "$ans" in
3891 none)
3892 value=''
3893 ansexp=''
3894 case "$none_ok" in
3895 true) type='';;
3896 esac
3897 ;;
3898 *)
3899 case "$tilde" in
3900 '') value="$ans"
3901 ansexp="$ans";;
3902 *)
3903 value=`UU/filexp $ans`
3904 case $? in
3905 0)
3906 if test "$ans" != "$value"; then
ecfc5424 3907 echo "(That expands to $value on this system.)"
2304df62
AD
3908 fi
3909 ;;
3910 *) value="$ans";;
3911 esac
3912 ansexp="$value"
3913 case "$exp_file" in
3914 '') value="$ans";;
3915 esac
3916 ;;
3917 esac
3918 case "$fullpath" in
3919 true)
3920 case "$ansexp" in
3921 /*) value="$ansexp" ;;
23da6c43 3922 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3923 *)
3924 redo=true
3925 case "$already" in
3926 true)
3927 echo "I shall only accept a full path name, as in /bin/ls." >&4
3928 echo "Use a ! shell escape if you wish to check pathnames." >&4
3929 ;;
3930 *)
3931 echo "Please give a full path name, starting with slash." >&4
3932 case "$tilde" in
3933 true)
3934 echo "Note that using ~name is ok provided it expands well." >&4
3935 already=true
3936 ;;
3937 esac
3938 esac
3939 ;;
3940 esac
3941 ;;
3942 esac
3943 case "$redo" in
3944 '')
3945 case "$type" in
3946 File)
b233458b
JH
3947 for fp in $gfpth; do
3948 if test "X$fp" = X.; then
3949 pf="$ansexp"
3950 else
3951 pf="$fp/$ansexp"
3952 fi
3953 if test -f "$pf"; then
3954 type=''
3955 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3956 then
3957 echo "($value is not a plain file, but that's ok.)"
3958 type=''
3959 fi
3960 if test X"$type" = X; then
3961 value="$pf"
3962 break
3963 fi
3964 done
2304df62
AD
3965 ;;
3966 Directory)
b233458b
JH
3967 for fp in $gfpth; do
3968 if test "X$fp" = X.; then
f78bfc9c
JH
3969 dir="$ans"
3970 direxp="$ansexp"
b233458b 3971 else
dd858076 3972 dir="$fp/$ansexp"
f78bfc9c 3973 direxp="$fp/$ansexp"
b233458b 3974 fi
f78bfc9c 3975 if test -d "$direxp"; then
b233458b 3976 type=''
f78bfc9c 3977 value="$dir"
b233458b
JH
3978 break
3979 fi
3980 done
2304df62
AD
3981 ;;
3982 Locate)
40000a8c 3983 if test -d "$ansexp"; then
a0d0e21e
LW
3984 echo "(Looking for $loc_file in directory $value.)"
3985 value="$value/$loc_file"
40000a8c 3986 ansexp="$ansexp/$loc_file"
2304df62 3987 fi
40000a8c 3988 if test -f "$ansexp"; then
2304df62
AD
3989 type=''
3990 fi
a0d0e21e
LW
3991 case "$nopath_ok" in
3992 true) case "$value" in
3993 */*) ;;
3994 *) echo "Assuming $value will be in people's path."
3995 type=''
3996 ;;
3997 esac
3998 ;;
3999 esac
2304df62
AD
4000 ;;
4001 esac
4002
4003 case "$skip" in
4004 true) type='';
4005 esac
4006
4007 case "$type" in
4008 '') ;;
4009 *)
4010 if test "$fastread" = yes; then
4011 dflt=y
4012 else
4013 dflt=n
4014 fi
4015 rp="$what $value doesn't exist. Use that name anyway?"
4016 . UU/myread
4017 dflt=''
4018 case "$ans" in
4019 y*) type='';;
4020 *) echo " ";;
4021 esac
4022 ;;
4023 esac
4024 ;;
4025 esac
4026 ;;
4027 esac
4028done
4029cd UU
4030ans="$value"
4031rp="$orig_rp"
4032dflt="$orig_dflt"
ecfc5424 4033rm -f getfile.ok
b233458b 4034test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4035EOSC
4036
bd9b35c9
JH
4037: What should the include directory be ?
4038echo " "
4039$echo $n "Hmm... $c"
4040dflt='/usr/include'
4041incpath=''
4042mips_type=''
4043if $test -f /bin/mips && /bin/mips; then
4044 echo "Looks like a MIPS system..."
4045 $cat >usr.c <<'EOCP'
4046#ifdef SYSTYPE_BSD43
4047/bsd43
4048#endif
4049EOCP
8a27cf78 4050 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4051 dflt='/bsd43/usr/include'
4052 incpath='/bsd43'
4053 mips_type='BSD 4.3'
4054 else
4055 mips_type='System V'
4056 fi
4057 $rm -f usr.c usr.out
4058 echo "and you're compiling with the $mips_type compiler and libraries."
4059 xxx_prompt=y
4060 echo "exit 0" >mips
4061else
4062 echo "Doesn't look like a MIPS system."
4063 xxx_prompt=n
4064 echo "exit 1" >mips
4065fi
4066chmod +x mips
4067$eunicefix mips
4068case "$usrinc" in
4069'') ;;
4070*) dflt="$usrinc";;
4071esac
4072case "$xxx_prompt" in
4073y) fn=d/
4074 echo " "
4075 rp='Where are the include files you want to use?'
4076 . ./getfile
4077 usrinc="$ans"
8e07c86e 4078 ;;
bd9b35c9 4079*) usrinc="$dflt"
8e07c86e
AD
4080 ;;
4081esac
2304df62 4082
96056487
JH
4083: see how we invoke the C preprocessor
4084echo " "
4085echo "Now, how can we feed standard input to your C preprocessor..." >&4
4086cat <<'EOT' >testcpp.c
4087#define ABC abc
4088#define XYZ xyz
4089ABC.XYZ
4090EOT
4091cd ..
4092if test ! -f cppstdin; then
4093 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4094 # AIX cc -E doesn't show the absolute headerfile
4095 # locations but we'll cheat by using the -M flag.
4096 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
4097 else
4098 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4099 fi
4100else
4101 echo "Keeping your $hint cppstdin wrapper."
4102fi
4103chmod 755 cppstdin
4104wrapper=`pwd`/cppstdin
4105ok='false'
4106cd UU
4107
4108if $test "X$cppstdin" != "X" && \
4109 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4110 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4111then
4112 echo "You used to use $cppstdin $cppminus so we'll use that again."
4113 case "$cpprun" in
4114 '') echo "But let's see if we can live without a wrapper..." ;;
4115 *)
4116 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4117 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4118 then
4119 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4120 ok='true'
4121 else
4122 echo "(However, $cpprun $cpplast does not work, let's see...)"
4123 fi
4124 ;;
4125 esac
4126else
4127 case "$cppstdin" in
4128 '') ;;
4129 *)
4130 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4131 ;;
4132 esac
4133fi
4134
4135if $ok; then
4136 : nothing
4137elif echo 'Maybe "'"$cc"' -E" will work...'; \
4138 $cc -E <testcpp.c >testcpp.out 2>&1; \
4139 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4140 echo "Yup, it does."
4141 x_cpp="$cc -E"
4142 x_minus='';
4143elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4144 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4145 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4146 echo "Yup, it does."
4147 x_cpp="$cc -E"
4148 x_minus='-';
4149elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4150 $cc -P <testcpp.c >testcpp.out 2>&1; \
4151 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4152 echo "Yipee, that works!"
4153 x_cpp="$cc -P"
4154 x_minus='';
4155elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4156 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4157 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4158 echo "At long last!"
4159 x_cpp="$cc -P"
4160 x_minus='-';
4161elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4162 $cpp <testcpp.c >testcpp.out 2>&1; \
4163 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4164 echo "It works!"
4165 x_cpp="$cpp"
4166 x_minus='';
4167elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4168 $cpp - <testcpp.c >testcpp.out 2>&1; \
4169 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4170 echo "Hooray, it works! I was beginning to wonder."
4171 x_cpp="$cpp"
4172 x_minus='-';
4173elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4174 $wrapper <testcpp.c >testcpp.out 2>&1; \
4175 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4176 x_cpp="$wrapper"
4177 x_minus=''
4178 echo "Eureka!"
4179else
4180 dflt=''
4181 rp="No dice. I can't find a C preprocessor. Name one:"
4182 . ./myread
4183 x_cpp="$ans"
4184 x_minus=''
4185 $x_cpp <testcpp.c >testcpp.out 2>&1
4186 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4187 echo "OK, that will do." >&4
4188 else
4189echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4190 exit 1
4191 fi
4192fi
4193
4194case "$ok" in
4195false)
4196 cppstdin="$x_cpp"
4197 cppminus="$x_minus"
4198 cpprun="$x_cpp"
4199 cpplast="$x_minus"
4200 set X $x_cpp
4201 shift
4202 case "$1" in
4203 "$cpp")
4204 echo "Perhaps can we force $cc -E using a wrapper..."
4205 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4206 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4207 then
4208 echo "Yup, we can."
4209 cppstdin="$wrapper"
4210 cppminus='';
4211 else
4212 echo "Nope, we'll have to live without it..."
4213 fi
4214 ;;
4215 esac
4216 case "$cpprun" in
4217 "$wrapper")
4218 cpprun=''
4219 cpplast=''
4220 ;;
4221 esac
4222 ;;
4223esac
4224
4225case "$cppstdin" in
4226"$wrapper"|'cppstdin') ;;
4227*) $rm -f $wrapper;;
4228esac
4229$rm -f testcpp.c testcpp.out
4230
bd9b35c9
JH
4231: Set private lib path
4232case "$plibpth" in
4233'') if ./mips; then
4234 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4235 fi;;
4236esac
4237case "$libpth" in
4238' ') dlist='';;
4239'') dlist="$loclibpth $plibpth $glibpth";;
4240*) dlist="$libpth";;
4241esac
4242
4243: Now check and see which directories actually exist, avoiding duplicates
4244libpth=''
4245for xxx in $dlist
4246do
4247 if $test -d $xxx; then
4248 case " $libpth " in
4249 *" $xxx "*) ;;
4250 *) libpth="$libpth $xxx";;
4251 esac
4252 fi
4253done
4254$cat <<'EOM'
4255
4256Some systems have incompatible or broken versions of libraries. Among
4257the directories listed in the question below, please remove any you
4258know not to be holding relevant libraries, and add any that are needed.
4259Say "none" for none.
8e07c86e
AD
4260
4261EOM
bd9b35c9
JH
4262case "$libpth" in
4263'') dflt='none';;
8e07c86e 4264*)
bd9b35c9
JH
4265 set X $libpth
4266 shift
4267 dflt=${1+"$@"}
8e07c86e 4268 ;;
a0d0e21e 4269esac
bd9b35c9
JH
4270rp="Directories to use for library searches?"
4271. ./myread
4272case "$ans" in
4273none) libpth=' ';;
4274*) libpth="$ans";;
4275esac
a0d0e21e 4276
bd9b35c9
JH
4277: compute shared library extension
4278case "$so" in
4279'')
4280 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4281 dflt='sl'
dd4e71fd 4282 else
bd9b35c9 4283 dflt='so'
dd4e71fd
JH
4284 fi
4285 ;;
bd9b35c9 4286*) dflt="$so";;
dd4e71fd 4287esac
dd4e71fd
JH
4288$cat <<EOM
4289
bd9b35c9 4290On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4291you want to suppress searching of shared libraries for the remainder
bd9b35c9 4292of this configuration.
dd4e71fd
JH
4293
4294EOM
bd9b35c9
JH
4295rp='What is the file extension used for shared libraries?'
4296. ./myread
4297so="$ans"
dd4e71fd 4298
bd9b35c9
JH
4299: Define several unixisms.
4300: Hints files or command line option can be used to override them.
4301: The convoluted testing is in case hints files set either the old
4302: or the new name.
4303case "$_exe" in
4304'') case "$exe_ext" in
1fef16b3 4305 '') ;;
bd9b35c9 4306 *) _exe="$exe_ext" ;;
dd4e71fd 4307 esac
bd9b35c9 4308 ;;
bfb7748a 4309esac
bd9b35c9
JH
4310case "$_a" in
4311'') case "$lib_ext" in
4312 '') _a='.a';;
4313 *) _a="$lib_ext" ;;
dd4e71fd
JH
4314 esac
4315 ;;
dd4e71fd 4316esac
bd9b35c9
JH
4317case "$_o" in
4318'') case "$obj_ext" in
4319 '') _o='.o';;
4320 *) _o="$obj_ext";;
4321 esac
4322 ;;
4323esac
4324case "$p_" in
4325'') case "$path_sep" in
4326 '') p_=':';;
4327 *) p_="$path_sep";;
4328 esac
4329 ;;
4330esac
4331exe_ext=$_exe
4332lib_ext=$_a
4333obj_ext=$_o
4334path_sep=$p_
dd4e71fd 4335
b4eb6b3d
JH
4336: Which makefile gets called first. This is used by make depend.
4337case "$firstmakefile" in
4338'') firstmakefile='makefile';;
4633a7c4 4339esac
4633a7c4 4340
0f0995ae
JH
4341case "$usesocks" in
4342$define|true|[yY]*) dflt='y';;
4343*) dflt='n';;
4344esac
bd9b35c9 4345cat <<EOM
4633a7c4 4346
bd9b35c9 4347Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
4348Configure must be run with -Dusesocks. If you use SOCKS you also need
4349to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 4350
0f0995ae 4351If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4352EOM
bd9b35c9
JH
4353rp='Build Perl for SOCKS?'
4354. ./myread
4355case "$ans" in
4356y|Y) val="$define" ;;
4357*) val="$undef" ;;
4358esac
4359set usesocks
4360eval $setvar
4361
cf829ab0
JH
4362case "$usesocks" in
4363$define|true|[yY]*) useperlio="$define";;
4364esac
4365
bd9b35c9
JH
4366: Looking for optional libraries
4367echo " "
4368echo "Checking for optional libraries..." >&4
4369case "$libs" in
4370' '|'') dflt='';;
4371*) dflt="$libs";;
4372esac
4373case "$libswanted" in
4374'') libswanted='c_s';;
4375esac
4376case "$usesocks" in
923fc586 4377"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4378esac
68435ea7
JH
4379libsfound=''
4380libsfiles=''
4381libsdirs=''
13b3f787
JH
4382libspath=''
4383for thisdir in $libpth $xlibpth; do
4384 test -d $thisdir && libspath="$libspath $thisdir"
4385done
bd9b35c9 4386for thislib in $libswanted; do
13b3f787 4387 for thisdir in $libspath; do
f7dd4e7f
JH
4388 xxx=''
4389 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4390 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4391 $test -f "$xxx" && eval $libscheck
4392 $test -f "$xxx" && libstyle=shared
4393 fi
4394 if test ! -f "$xxx"; then
4395 xxx=$thisdir/lib$thislib.$so
4396 $test -f "$xxx" && eval $libscheck
4397 $test -f "$xxx" && libstyle=shared
4398 fi
4399 if test ! -f "$xxx"; then
4400 xxx=$thisdir/lib$thislib$_a
4401 $test -f "$xxx" && eval $libscheck
4402 $test -f "$xxx" && libstyle=static
4403 fi
4404 if test ! -f "$xxx"; then
4405 xxx=$thisdir/$thislib$_a
4406 $test -f "$xxx" && eval $libscheck
4407 $test -f "$xxx" && libstyle=static
4408 fi
4409 if test ! -f "$xxx"; then
4410 xxx=$thisdir/lib${thislib}_s$_a
4411 $test -f "$xxx" && eval $libscheck
4412 $test -f "$xxx" && libstyle=static
09ea5ba9 4413 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4414 fi
4415 if test ! -f "$xxx"; then
4416 xxx=$thisdir/Slib$thislib$_a
4417 $test -f "$xxx" && eval $libscheck
4418 $test -f "$xxx" && libstyle=static
4419 fi
4420 if $test -f "$xxx"; then
43999f95 4421 case "$libstyle" in
f7dd4e7f
JH
4422 shared) echo "Found -l$thislib (shared)." ;;
4423 static) echo "Found -l$thislib." ;;
4424 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4425 esac
bd9b35c9
JH
4426 case " $dflt " in
4427 *"-l$thislib "*);;
f7dd4e7f 4428 *) dflt="$dflt -l$thislib"
43999f95
JH
4429 libsfound="$libsfound $xxx"
4430 yyy=`basename $xxx`
4431 libsfiles="$libsfiles $yyy"
1e127011 4432 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4433 case " $libsdirs " in
4434 *" $yyy "*) ;;
4435 *) libsdirs="$libsdirs $yyy" ;;
4436 esac
4437 ;;
bd9b35c9 4438 esac
f7dd4e7f
JH
4439 break
4440 fi
4441 done
4442 if $test ! -f "$xxx"; then
4443 echo "No -l$thislib."
bd9b35c9
JH
4444 fi
4445done
4446set X $dflt
4447shift
4448dflt="$*"
4449case "$libs" in
4450'') dflt="$dflt";;
4451*) dflt="$libs";;
4452esac
4453case "$dflt" in
4454' '|'') dflt='none';;
4455esac
4633a7c4 4456
bd9b35c9 4457$cat <<EOM
4633a7c4 4458
bd9b35c9
JH
4459In order to compile $package on your machine, a number of libraries
4460are usually needed. Include any other special libraries here as well.
4461Say "none" for none. The default list is almost always right.
8e07c86e 4462EOM
8e07c86e 4463
bd9b35c9
JH
4464echo " "
4465rp="What libraries to use?"
4466. ./myread
4467case "$ans" in
4468none) libs=' ';;
4469*) libs="$ans";;
4470esac
d71b2b6b 4471
bd9b35c9
JH
4472: determine optimization, if desired, or use for debug flag also
4473case "$optimize" in
4474' '|$undef) dflt='none';;
4475'') dflt='-O';;
4476*) dflt="$optimize";;
4477esac
4478$cat <<EOH
d71b2b6b 4479
bd9b35c9
JH
4480By default, $package compiles with the -O flag to use the optimizer.
4481Alternately, you might want to use the symbolic debugger, which uses
4482the -g flag (on traditional Unix systems). Either flag can be
4483specified here. To use neither flag, specify the word "none".
d71b2b6b 4484
bd9b35c9
JH
4485EOH
4486rp="What optimizer/debugger flag should be used?"
4487. ./myread
4488optimize="$ans"
4489case "$optimize" in
4490'none') optimize=" ";;
4491esac
4492
4493dflt=''
4494: We will not override a previous value, but we might want to
4495: augment a hint file
4496case "$hint" in
4497default|recommended)
4498 case "$gccversion" in
4499 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4500 esac
bd9b35c9
JH
4501 case "$optimize" in
4502 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4503 esac
bd9b35c9
JH
4504 case "$gccversion" in
4505 2*) if test -d /etc/conf/kconfig.d &&
4506 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4507 then
4508 dflt="$dflt -posix"
4509 fi
f0d04425 4510 ;;
bd9b35c9
JH
4511 esac
4512 case "$gccversion" in
4513 1*) ;;
4514 2.[0-8]*) ;;
4515 ?*) echo " "
4516 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4517 echo 'int main(void) { return 0; }' > gcctest.c
4518 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4519 echo "Yes, it does." 2>&1
4520 case "$ccflags" in
4521 *strict-aliasing*)
4522 echo "Leaving current flags $ccflags alone." 2>&1
4523 ;;
4524 *) dflt="$dflt -fno-strict-aliasing" ;;
4525 esac
4526 else
4527 echo "Nope, it doesn't, but that's ok." 2>&1
4528 fi
f0d04425 4529 ;;
e5e20432
JH
4530 esac
4531 ;;
4532esac
4533
bd9b35c9
JH
4534case "$mips_type" in
4535*BSD*|'') inclwanted="$locincpth $usrinc";;
4536*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4537esac
4538for thisincl in $inclwanted; do
4539 if $test -d $thisincl; then
4540 if $test x$thisincl != x$usrinc; then
4541 case "$dflt" in
422af00a
LC
4542 *" -I$thisincl "*);;
4543 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4544 esac
4545 fi
4546 fi
4547done
40a7a20a 4548
bd9b35c9
JH
4549inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4550 xxx=true;
4551elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4552 xxx=true;
4553else
4554 xxx=false;
4555fi;
4556if $xxx; then
4557 case "$dflt" in
4558 *$2*);;
4559 *) dflt="$dflt -D$2";;
4560 esac;
4561fi'
40a7a20a 4562
bd9b35c9 4563set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4564
bd9b35c9
JH
4565case "$usesocks" in
4566$define)
4567 ccflags="$ccflags -DSOCKS"
4568 ;;
4569esac
40a7a20a 4570
bd9b35c9
JH
4571case "$hint" in
4572default|recommended) dflt="$ccflags $dflt" ;;
4573*) dflt="$ccflags";;
4574esac
40a7a20a 4575
bd9b35c9
JH
4576case "$dflt" in
4577''|' ') dflt=none;;
4578esac
422af00a 4579
bd9b35c9 4580$cat <<EOH
40a7a20a 4581
bd9b35c9
JH
4582Your C compiler may want other flags. For this question you should include
4583-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4584but you should NOT include libraries or ld flags like -lwhatever. If you
4585want $package to honor its debug switch, you should include -DDEBUGGING here.
4586Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4587
bd9b35c9 4588To use no flags, specify the word "none".
40a7a20a 4589
bd9b35c9
JH
4590EOH
4591set X $dflt
4592shift
4593dflt=${1+"$@"}
4594rp="Any additional cc flags?"
4595. ./myread
4596case "$ans" in
4597none) ccflags='';;
4598*) ccflags="$ans";;
4599esac
8e07c86e 4600
bd9b35c9 4601: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4602case "$cppflags" in
4603'') cppflags="$ccflags" ;;
4604*) cppflags="$cppflags $ccflags" ;;
4605esac
bd9b35c9
JH
4606case "$gccversion" in
46071*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4608esac
bd9b35c9
JH
4609case "$mips_type" in
4610'');;
4611*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4612esac
4613case "$cppflags" in
4614'');;
4615*)
4616 echo " "
4617 echo "Let me guess what the preprocessor flags are..." >&4
4618 set X $cppflags
4619 shift
4620 cppflags=''
4621 $cat >cpp.c <<'EOM'
4622#define BLURFL foo
8e07c86e 4623
bd9b35c9
JH
4624BLURFL xx LFRULB
4625EOM
4626 previous=''
4627 for flag in $*
4628 do
4629 case "$flag" in
4630 -*) ftry="$flag";;
4631 *) ftry="$previous $flag";;
4632 esac
4633 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4634 >cpp1.out 2>/dev/null && \
4635 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4636 >cpp2.out 2>/dev/null && \
4637 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4638 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4639 then
4640 cppflags="$cppflags $ftry"
4641 previous=''
4642 else
4643 previous="$flag"
4644 fi
4645 done
4646 set X $cppflags
4647 shift
4648 cppflags=${1+"$@"}
4649 case "$cppflags" in
4650 *-*) echo "They appear to be: $cppflags";;
4651 esac
4652 $rm -f cpp.c cpp?.out
2afac517 4653 ;;
4654esac
8e07c86e 4655
bd9b35c9
JH
4656: flags used in final linking phase
4657case "$ldflags" in
4658'') if ./venix; then
4659 dflt='-i -z'
10a23457 4660 else
bd9b35c9 4661 dflt=''
10a23457 4662 fi
bd9b35c9
JH
4663 case "$ccflags" in
4664 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4665 esac
bd9b35c9
JH
4666 ;;
4667*) dflt="$ldflags";;
4668esac
4669
4670: Try to guess additional flags to pick up local libraries.
4671for thislibdir in $libpth; do
4672 case " $loclibpth " in
4673 *" $thislibdir "*)
4674 case "$dflt " in
4675 *"-L$thislibdir "*) ;;
4676 *) dflt="$dflt -L$thislibdir" ;;
4677 esac
c4f23d77
AD
4678 ;;
4679 esac
bd9b35c9 4680done
c4f23d77 4681
bd9b35c9
JH
4682case "$dflt" in
4683'') dflt='none' ;;
4684esac
c4f23d77 4685
bd9b35c9
JH
4686$cat <<EOH
4687
4688Your C linker may need flags. For this question you should
4689include -L/whatever and any other flags used by the C linker, but you
4690should NOT include libraries like -lwhatever.
4691
4692Make sure you include the appropriate -L/path flags if your C linker
4693does not normally search all of the directories you specified above,
4694namely
4695 $libpth
4696To use no flags, specify the word "none".
4697
4698EOH
4699
4700rp="Any additional ld flags (NOT including libraries)?"
4701. ./myread
4702case "$ans" in
4703none) ldflags='';;
4704*) ldflags="$ans";;
4705esac
4706rmlist="$rmlist pdp11"
4707
4708: coherency check
4709echo " "
4710echo "Checking your choice of C compiler and flags for coherency..." >&4
4711$cat > try.c <<'EOF'
4712#include <stdio.h>
4713int main() { printf("Ok\n"); exit(0); }
4714EOF
7a282f6d 4715set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4716shift
4717$cat >try.msg <<'EOM'
4718I've tried to compile and run the following simple program:
4719
4720EOM
4721$cat try.c >> try.msg
4722
4723$cat >> try.msg <<EOM
4724
4725I used the command:
4726
4727 $*
5440bc8e 4728 $run ./try
bd9b35c9
JH
4729
4730and I got the following output:
4731
4732EOM
4733dflt=y
73614538 4734if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4735 if $sh -c "$run ./try" >>try.msg 2>&1; then
4736 xxx=`$run ./try`
bd9b35c9
JH
4737 case "$xxx" in
4738 "Ok") dflt=n ;;
4739 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4740 case " $libs " in
4741 *" -lsfio "*)
4742 cat >> try.msg <<'EOQS'
4743If $libs contains -lsfio, and sfio is mis-configured, then it
4744sometimes (apparently) runs and exits with a 0 status, but with no
4745output! It may have to do with sfio's use of _exit vs. exit.
4746
4747EOQS
4748 rp="You have a big problem. Shall I abort Configure"
4749 dflt=y
4750 ;;
4751 esac
4752 ;;
4753 esac
4754 else
4755 echo "The program compiled OK, but exited with status $?." >>try.msg
4756 rp="You have a problem. Shall I abort Configure"
4757 dflt=y
4758 fi
4759else
4760 echo "I can't compile the test program." >>try.msg
4761 rp="You have a BIG problem. Shall I abort Configure"
4762 dflt=y
4763fi
4764case "$dflt" in
4765y)
4766 $cat try.msg >&4
4767 case "$knowitall" in
4768 '')
4769 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4770 ;;
bd9b35c9 4771 *) dflt=n;;
c4f23d77 4772 esac
bd9b35c9
JH
4773 echo " "
4774 . ./myread
4775 case "$ans" in
4776 n*|N*) ;;
4777 *) echo "Ok. Stopping Configure." >&4
4778 exit 1
c4f23d77
AD
4779 ;;
4780 esac
4781 ;;
bd9b35c9 4782n) echo "OK, that should do.";;
c4f23d77 4783esac
bd9b35c9 4784$rm -f try try.* core
c4f23d77 4785
bd9b35c9
JH
4786: define a shorthand compile call
4787compile='
4788mc_file=$1;
4789shift;
08413ebc 4790$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4791: define a shorthand compile call for compilations that should be ok.
4792compile_ok='
4793mc_file=$1;
4794shift;
7a282f6d 4795$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4796
b4eb6b3d 4797: check for lengths of integral types
bd9b35c9 4798echo " "
b4eb6b3d
JH
4799case "$intsize" in
4800'')
4801 echo "Checking to see how big your integers are..." >&4
5440bc8e 4802 $cat >try.c <<'EOCP'
bd9b35c9
JH
4803#include <stdio.h>
4804int main()
4805{
b4eb6b3d
JH
4806 printf("intsize=%d;\n", (int)sizeof(int));
4807 printf("longsize=%d;\n", (int)sizeof(long));
4808 printf("shortsize=%d;\n", (int)sizeof(short));
4809 exit(0);
bd9b35c9 4810}
b4eb6b3d 4811EOCP
5440bc8e
JH
4812 set try
4813 if eval $compile_ok && $run ./try > /dev/null; then
4814 eval `$run ./try`
b4eb6b3d
JH
4815 echo "Your integers are $intsize bytes long."
4816 echo "Your long integers are $longsize bytes long."
4817 echo "Your short integers are $shortsize bytes long."
4818 else
4819 $cat >&4 <<EOM
4820!
4821Help! I can't compile and run the intsize test program: please enlighten me!
4822(This is probably a misconfiguration in your system or libraries, and
4823you really ought to fix it. Still, I'll try anyway.)
4824!
bd9b35c9 4825EOM
b4eb6b3d
JH
4826 dflt=4
4827 rp="What is the size of an integer (in bytes)?"
96056487
JH
4828 . ./myread
4829 intsize="$ans"
4830 dflt=$intsize
4831 rp="What is the size of a long integer (in bytes)?"
4832 . ./myread
4833 longsize="$ans"
4834 dflt=2
4835 rp="What is the size of a short integer (in bytes)?"
4836 . ./myread
4837 shortsize="$ans"
b4eb6b3d
JH
4838 fi
4839 ;;
4840esac
96056487 4841$rm -f try try.*
b4eb6b3d 4842
8dfa8df9
JH
4843: check for void type
4844echo " "
4845echo "Checking to see how well your C compiler groks the void type..." >&4
4846case "$voidflags" in
4847'')
4848 $cat >try.c <<'EOCP'
4849#if TRY & 1
4850void sub() {
4851#else
4852sub() {
4853#endif
4854 extern void moo(); /* function returning void */
4855 void (*goo)(); /* ptr to func returning void */
4856#if TRY & 8
4857 void *hue; /* generic ptr */
4858#endif
4859#if TRY & 2
4860 void (*foo[10])();
4861#endif
4862
4863#if TRY & 4
4864 if(goo == moo) {
4865 exit(0);
4866 }
4867#endif
4868 exit(0);
4869}
4870int main() { sub(); }
4871EOCP
4872 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4873 voidflags=$defvoidused
4874 echo "Good. It appears to support void to the level $package wants.">&4
4875 if $contains warning .out >/dev/null 2>&1; then
4876 echo "However, you might get some warnings that look like this:"
4877 $cat .out
4878 fi
4879 else
4880echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4881 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4882 echo "It supports 1..."
4883 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4884 echo "It also supports 2..."
4885 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4886 voidflags=7
4887 echo "And it supports 4 but not 8 definitely."
4888 else
4889 echo "It doesn't support 4..."
4890 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4891 voidflags=11
4892 echo "But it supports 8."
4893 else
4894 voidflags=3
4895 echo "Neither does it support 8."
4896 fi
4897 fi
4898 else
4899 echo "It does not support 2..."
4900 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4901 voidflags=13
4902 echo "But it supports 4 and 8."
4903 else
4904 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4905 voidflags=5
4906 echo "And it supports 4 but has not heard about 8."
4907 else
4908 echo "However it supports 8 but not 4."
4909 fi
4910 fi
4911 fi
4912 else
4913 echo "There is no support at all for void."
4914 voidflags=0
4915 fi
4916 fi
4917esac
4918case "$voidflags" in
4919"$defvoidused") ;;
4920*) $cat >&4 <<'EOM'
4921 Support flag bits are:
4922 1: basic void declarations.
4923 2: arrays of pointers to functions returning void.
4924 4: operations between pointers to and addresses of void functions.
4925 8: generic void pointers.
4926EOM
4927 dflt="$voidflags";
4928 rp="Your void support flags add up to what?"
4929 . ./myread
4930 voidflags="$ans"
4931 ;;
4932esac
4933$rm -f try.* .out
4934
4935: check for length of pointer
4936echo " "
4937case "$ptrsize" in
4938'')
4939 echo "Checking to see how big your pointers are..." >&4
4940 if test "$voidflags" -gt 7; then
4941 echo '#define VOID_PTR char *' > try.c
4942 else
4943 echo '#define VOID_PTR void *' > try.c
4944 fi
4945 $cat >>try.c <<'EOCP'
4946#include <stdio.h>
4947int main()
4948{
4949 printf("%d\n", (int)sizeof(VOID_PTR));
4950 exit(0);
4951}
4952EOCP
4953 set try
4954 if eval $compile_ok; then
5440bc8e 4955 ptrsize=`$run ./try`
8dfa8df9
JH
4956 echo "Your pointers are $ptrsize bytes long."
4957 else
4958 dflt='4'
4959 echo "(I can't seem to compile the test program. Guessing...)" >&4
4960 rp="What is the size of a pointer (in bytes)?"
4961 . ./myread
4962 ptrsize="$ans"
4963 fi
4964 ;;
4965esac
4966$rm -f try.c try
4967
4968: check for long long
4969echo " "
4970echo "Checking to see if you have long long..." >&4
4971echo 'int main() { long long x = 7; return 0; }' > try.c
4972set try
4973if eval $compile; then
4974 val="$define"
4975 echo "You have long long."
4976else
4977 val="$undef"
4978 echo "You do not have long long."
4979fi
4980$rm try.*
4981set d_longlong
4982eval $setvar
4983
4984: check for length of long long
4985case "${d_longlong}${longlongsize}" in
4986$define)
4987 echo " "
4988 echo "Checking to see how big your long longs are..." >&4
4989 $cat >try.c <<'EOCP'
4990#include <stdio.h>
4991int main()
4992{
4993 printf("%d\n", (int)sizeof(long long));
4994 return(0);
4995}
4996EOCP
4997 set try
4998 if eval $compile_ok; then
5440bc8e 4999 longlongsize=`$run ./try`
8dfa8df9
JH
5000 echo "Your long longs are $longlongsize bytes long."
5001 else
5002 dflt='8'
5003 echo " "
5004 echo "(I can't seem to compile the test program. Guessing...)"
5005 rp="What is the size of a long long (in bytes)?"
5006 . ./myread
5007 longlongsize="$ans"
5008 fi
5009 if $test "X$longsize" = "X$longlongsize"; then
5010 echo "(That isn't any different from an ordinary long.)"
5011 fi
5012 ;;
5013esac
5014$rm -f try.* try
5015
5016: determine filename position in cpp output
5017echo " "
5018echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5019case "$osname" in
5020vos) testaccess=-e ;;
5021*) testaccess=-r ;;
5022esac
8dfa8df9
JH
5023echo '#include <stdio.h>' > foo.c
5024$cat >fieldn <<EOF
5025$startsh
5026$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5027$grep '^[ ]*#.*stdio\.h' | \
5028while read cline; do
5029 pos=1
5030 set \$cline
5031 while $test \$# -gt 0; do
a5a94ea5 5032 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5033 echo "\$pos"
5034 exit 0
5035 fi
5036 shift
5037 pos=\`expr \$pos + 1\`
5038 done
5039done
5040EOF
5041chmod +x fieldn
5042fieldn=`./fieldn`
5043$rm -f foo.c fieldn
5044case $fieldn in
5045'') pos='???';;
50461) pos=first;;
50472) pos=second;;
50483) pos=third;;
5049*) pos="${fieldn}th";;
5050esac
5051echo "Your cpp writes the filename in the $pos field of the line."
5052
3c728e00
JH
5053case "$osname" in
5054vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5055*) cppfilter='' ;;
5056esac
8dfa8df9
JH
5057: locate header file
5058$cat >findhdr <<EOF
5059$startsh
5060wanted=\$1
5061name=''
5062for usrincdir in $usrinc
5063do
5064 if test -f \$usrincdir/\$wanted; then
5065 echo "\$usrincdir/\$wanted"
5066 exit 0
5067 fi
5068done
5069awkprg='{ print \$$fieldn }'
5070echo "#include <\$wanted>" > foo\$\$.c
5071$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5072$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5073while read cline; do
5074 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5075 case "\$name" in
5076 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5077 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5078 *) exit 2;;
5079 esac;
5080done;
5081#
5082# status = 0: grep returned 0 lines, case statement not executed
5083# status = 1: headerfile found
5084# status = 2: while loop executed, no headerfile found
5085#
5086status=\$?
5087$rm -f foo\$\$.c;
5088if test \$status -eq 1; then
5089 exit 0;
5090fi
5091exit 1
5092EOF
5093chmod +x findhdr
5094
5095: define an alternate in-header-list? function
5096inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5097cont=true; xxf="echo \"<\$1> found.\" >&4";
5098case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5099*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5100esac;
5101case $# in 4) instead=instead;; *) instead="at last";; esac;
5102while $test "$cont"; do
5103 xxx=`./findhdr $1`
5104 var=$2; eval "was=\$$2";
5105 if $test "$xxx" && $test -r "$xxx";
5106 then eval $xxf;
5107 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5108 cont="";
5109 else eval $xxnf;
5110 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5111 set $yyy; shift; shift; yyy=$@;
5112 case $# in 0) cont="";;
5113 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5114 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5115 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5116 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5117 esac;
5118done;
5119while $test "$yyy";
5120do set $yyy; var=$2; eval "was=\$$2";
5121 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5122 set $yyy; shift; shift; yyy=$@;
5123done'
5124
5125: see if inttypes.h is available
5126: we want a real compile instead of Inhdr because some systems
5127: have an inttypes.h which includes non-existent headers
5128echo " "
5129$cat >try.c <<EOCP
5130#include <inttypes.h>
5131int main() {
5132 static int32_t foo32 = 0x12345678;
5133}
5134EOCP
5135set try
5136if eval $compile; then
5137 echo "<inttypes.h> found." >&4
5138 val="$define"
5139else
5140 echo "<inttypes.h> NOT found." >&4
5141 val="$undef"
5142fi
5143$rm -f try.c try
5144set i_inttypes
5145eval $setvar
5146
5147: check for int64_t
5148echo " "
5149echo "Checking to see if you have int64_t..." >&4
5150$cat >try.c <<EOCP
5151#include <sys/types.h>
5152#$i_inttypes I_INTTYPES
5153#ifdef I_INTTYPES
5154#include <inttypes.h>
5155#endif
5156int main() { int64_t x = 7; }
5157EOCP
5158set try
5159if eval $compile; then
5160 val="$define"
5161 echo "You have int64_t."
5162else
5163 val="$undef"
5164 echo "You do not have int64_t."
5165fi
5166$rm -f try try.*
5167set d_int64_t
5168eval $setvar
5169
5170
5171echo " "
5172echo "Checking which 64-bit integer type we could use..." >&4
5173
5174case "$intsize" in
51758) val=int
5176 set quadtype
5177 eval $setvar
5178 val='"unsigned int"'
5179 set uquadtype
5180 eval $setvar
5181 quadkind=1
5182 ;;
5183*) case "$longsize" in
5184 8) val=long
5185 set quadtype
5186 eval $setvar
5187 val='"unsigned long"'
5188 set uquadtype
5189 eval $setvar
5190 quadkind=2
5191 ;;
5192 *) case "$d_longlong:$longlongsize" in
5193 define:8)
5194 val='"long long"'
5195 set quadtype
5196 eval $setvar
5197 val='"unsigned long long"'
5198 set uquadtype
5199 eval $setvar
5200 quadkind=3
5201 ;;
5202 *) case "$d_int64_t" in
5203 define)
5204 val=int64_t
5205 set quadtype
5206 eval $setvar
5207 val=uint64_t
5208 set uquadtype
5209 eval $setvar
5210 quadkind=4
5211 ;;
5212 esac
5213 ;;
5214 esac
5215 ;;
5216 esac
5217 ;;
5218esac
5219
5220case "$quadtype" in
5221'') echo "Alas, no 64-bit integer types in sight." >&4
5222 d_quad="$undef"
5223 ;;
5224*) echo "We could use '$quadtype' for 64-bit integers." >&4
5225 d_quad="$define"
5226 ;;
5227esac
5228
b4eb6b3d
JH
5229
5230case "$uselonglong" in
5231"$define"|true|[yY]*)
5232 cat <<EOM >&4
5233
5234*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5235EOM
5236 use64bitint="$define"
5237 ;;
5238esac
5239case "$use64bits" in
5240"$define"|true|[yY]*)
5241 cat <<EOM >&4
5242
5243*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5244EOM
5245 use64bitint="$define"
5246 ;;
5247esac
5248case "$use64bitints" in
5249"$define"|true|[yY]*)
5250 cat <<EOM >&4
5251
5252*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5253EOM
5254 use64bitint="$define"
5255 ;;
5256esac
5257case "$use64bitsint" in
5258"$define"|true|[yY]*)
5259 cat <<EOM >&4
5260
5261*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5262EOM
5263 use64bitint="$define"
5264 ;;
5265esac
5266case "$uselonglongs" in
5267"$define"|true|[yY]*)
5268 cat <<EOM >&4
5269
5270*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5271EOM
5272 use64bitint="$define"
5273 ;;
5274esac
5275case "$use64bitsall" in
5276"$define"|true|[yY]*)
5277 cat <<EOM >&4
5278
5279*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5280EOM
5281 use64bitall="$define"
5282 ;;
5283esac
5284
5285case "$ccflags" in
5286*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5287esac
5288case "$use64bitall" in
5289"$define"|true|[yY]*) use64bitint="$define" ;;
5290esac
5291
5292case "$longsize" in
52938) cat <<EOM
5294
5295You have natively 64-bit long integers.
5296EOM
5297 val="$define"
5298 ;;
5299*) case "$use64bitint" in
5300 "$define"|true|[yY]*) dflt='y';;
5301 *) dflt='n';;
5302 esac
8dfa8df9
JH
5303 case "$d_quad" in
5304 "$define") ;;
5305 *) dflt='n' ;;
5306 esac
b4eb6b3d
JH
5307 cat <<EOM
5308
5309Perl can be built to take advantage of 64-bit integer types
5310on some systems. To do so, Configure can be run with -Duse64bitint.
5311Choosing this option will most probably introduce binary incompatibilities.
5312
5313If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5314(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5315EOM
5316 rp='Try to use 64-bit integers, if available?'
5317 . ./myread
5318 case "$ans" in
5319 [yY]*) val="$define" ;;
5320 *) val="$undef" ;;
5321 esac
5322 ;;
5323esac
5324set use64bitint
5325eval $setvar
5326
5327case "$use64bitall" in
5328"$define"|true|[yY]*) dflt='y' ;;
5329*) case "$longsize" in
5330 8) dflt='y' ;;
5331 *) dflt='n' ;;
5332 esac
5333 ;;
5334esac
5335cat <<EOM
5336
5337You may also choose to try maximal 64-bitness. It means using as much
533864-bitness as possible on the platform. This in turn means even more
5339binary incompatibilities. On the other hand, your platform may not
5340have any more 64-bitness available than what you already have chosen.
5341
5342If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5343(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5344EOM
5345rp='Try to use maximal 64-bit support, if available?'
5346. ./myread
5347case "$ans" in
5348[yY]*) val="$define" ;;
5349*) val="$undef" ;;
5350esac
5351set use64bitall
5352eval $setvar
5353case "$use64bitall" in
5354"$define")
5355 case "$use64bitint" in
5356 "$undef")
5357 cat <<EOM
5358
5359Since you have chosen a maximally 64-bit build, I'm also turning on
5360the use of 64-bit integers.
5361EOM
5362 use64bitint="$define" ;;
5363 esac
5364 ;;
5365esac
5366
8dfa8df9
JH
5367case "$use64bitall" in
5368"$define"|true|[yY]*)
5369 case "$ptrsize" in
5370 4) cat <<EOM >&4
5371
5372*** You have chosen a maximally 64-bit build, but your pointers
5373*** are only 4 bytes wide, disabling maximal 64-bitness.
5374
5375EOM
5376 use64bitall="$undef"
5377 case "$use64bitint" in
5378 "$define"|true|[yY]*) ;;
5379 *) cat <<EOM >&4
5380
5381*** Downgrading from maximal 64-bitness to using 64-bit integers.
5382
5383EOM
5384 use64bitint="$define"
5385 ;;
5386 esac
5387 ;;
5388 esac
5389 ;;
5390esac
5391
b4eb6b3d
JH
5392case "$use64bitint" in
5393"$define"|true|[yY]*)
5394: Look for a hint-file generated 'call-back-unit'. If the
5395: user has specified that a 64-bit perl is to be built,
5396: we may need to set or change some other defaults.
5397 if $test -f use64bitint.cbu; then
5398 echo "Your platform has some specific hints for 64-bit integers, using them..."
5399 . ./use64bitint.cbu
5400 fi
5401 case "$longsize" in
5402 4) case "$archname64" in
5403 '') archname64=64int ;;
5404 esac
5405 ;;
5406 esac
5407 ;;
5408esac
5409
5410case "$use64bitall" in
5411"$define"|true|[yY]*)
5412: Look for a hint-file generated 'call-back-unit'. If the
5413: user has specified that a maximally 64-bit perl is to be built,
5414: we may need to set or change some other defaults.
5415 if $test -f use64bitall.cbu; then
5416 echo "Your platform has some specific hints for 64-bit builds, using them..."
5417 . ./use64bitall.cbu
5418 fi
5419 case "$longsize" in
5420 4) case "$archname64" in
5421 ''|64int) archname64=64all ;;
5422 esac
5423 ;;
5424 esac
5425 ;;
5426esac
5427
5428echo " "
5429echo "Checking for GNU C Library..." >&4
5440bc8e 5430cat >try.c <<EOM
b4eb6b3d
JH
5431#include <stdio.h>
5432int main()
5433{
5434#ifdef __GLIBC__
5435 exit(0);
5436#else
5437 exit(1);
5438#endif
5439}
5440EOM
5440bc8e
JH
5441set try
5442if eval $compile_ok && $run ./try; then
b4eb6b3d
JH
5443 val="$define"
5444 echo "You are using the GNU C Library"
5445else
5446 val="$undef"
5447 echo "You are not using the GNU C Library"
5448fi
5440bc8e 5449$rm -f try try.*
b4eb6b3d
JH
5450set d_gnulibc
5451eval $setvar
5452
5453: see if nm is to be used to determine whether a symbol is defined or not
5454case "$usenm" in
5455'')
5456 dflt=''
c1a7f87b
JH
5457 case "$d_gnulibc" in
5458 "$define")
5459 echo " "
5460 echo "nm probably won't work on the GNU C Library." >&4
5461 dflt=n
bd9b35c9 5462 ;;
c1a7f87b
JH
5463 esac
5464 case "$dflt" in
5465 '')
5466 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5467 echo " "
5468 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5469 echo "'nm' won't be sufficient on this sytem." >&4
5470 dflt=n
5471 fi
5472 ;;
5473 esac
5474 case "$dflt" in
5475 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5476 if $test $dflt -gt 20; then
5477 dflt=y
5478 else
5479 dflt=n
5480 fi
bd9b35c9
JH
5481 ;;
5482 esac
bd9b35c9
JH
5483 ;;
5484*)
c1a7f87b
JH
5485 case "$usenm" in
5486 true|$define) dflt=y;;
5487 *) dflt=n;;
5488 esac
bd9b35c9
JH
5489 ;;
5490esac
5491$cat <<EOM
5492
c1a7f87b
JH
5493I can use $nm to extract the symbols from your C libraries. This
5494is a time consuming task which may generate huge output on the disk (up
5495to 3 megabytes) but that should make the symbols extraction faster. The
5496alternative is to skip the 'nm' extraction part and to compile a small
5497test program instead to determine whether each symbol is present. If
5498you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5499this may be the best solution.
5500
5501You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5502
5503EOM
c1a7f87b
JH
5504rp="Shall I use $nm to extract C symbols from the libraries?"
5505. ./myread
5506case "$ans" in
5507[Nn]*) usenm=false;;
5508*) usenm=true;;
bd9b35c9 5509esac
bd9b35c9 5510
c1a7f87b
JH
5511runnm=$usenm
5512case "$reuseval" in
5513true) runnm=false;;
8e07c86e 5514esac
29209bc5 5515
c1a7f87b
JH
5516: nm options which may be necessary
5517case "$nm_opt" in
5518'') if $test -f /mach_boot; then
5519 nm_opt='' # Mach
5520 elif $test -d /usr/ccs/lib; then
5521 nm_opt='-p' # Solaris (and SunOS?)
5522 elif $test -f /dgux; then
5523 nm_opt='-p' # DG-UX
5524 elif $test -f /lib64/rld; then
5525 nm_opt='-p' # 64-bit Irix
5526 else
5527 nm_opt=''
5528 fi;;
5529esac
bd9b35c9 5530
c1a7f87b
JH
5531: nm options which may be necessary for shared libraries but illegal
5532: for archive libraries. Thank you, Linux.
5533case "$nm_so_opt" in
5534'') case "$myuname" in
5535 *linux*)
5536 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5537 nm_so_opt='--dynamic'
5538 fi
5539 ;;
bd9b35c9 5540 esac
c1a7f87b
JH
5541 ;;
5542esac
8e07c86e 5543
c1a7f87b
JH
5544case "$runnm" in
5545true)
5546: get list of predefined functions in a handy place
5547echo " "
5548case "$libc" in
5549'') libc=unknown
5550 case "$libs" in
5551 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5552 esac
ff935051
JH
5553 ;;
5554esac
c1a7f87b
JH
5555case "$libs" in
5556'') ;;
5557*) for thislib in $libs; do
5558 case "$thislib" in
5559 -lc|-lc_s)
5560 : Handle C library specially below.
5561 ;;
5562 -l*)
5563 thislib=`echo $thislib | $sed -e 's/^-l//'`
5564 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5565 :
5566 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5567 :
5568 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5569 :
5570 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5571 :
5572 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5573 :
5574 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5575 :
5576 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5577 :
5578 else
5579 try=''
5580 fi
5581 libnames="$libnames $try"
5582 ;;
5583 *) libnames="$libnames $thislib" ;;
34d1710f 5584 esac
c1a7f87b 5585 done
4633a7c4
LW
5586 ;;
5587esac
c1a7f87b
JH
5588xxx=normal
5589case "$libc" in
5590unknown)
5591 set /lib/libc.$so
5592 for xxx in $libpth; do
5593 $test -r $1 || set $xxx/libc.$so
5594 : The messy sed command sorts on library version numbers.
5595 $test -r $1 || \
5596 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5597 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5598 h
5599 s/[0-9][0-9]*/0000&/g
5600 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5601 G
5602 s/\n/ /' | \
381aa1ff 5603 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5604 eval set \$$#
5605 done
5606 $test -r $1 || set /usr/ccs/lib/libc.$so
5607 $test -r $1 || set /lib/libsys_s$_a
5608 ;;
5609*)
5610 set blurfl
5611 ;;
a4f3eea9 5612esac
c1a7f87b
JH
5613if $test -r "$1"; then
5614 echo "Your (shared) C library seems to be in $1."
5615 libc="$1"
5616elif $test -r /lib/libc && $test -r /lib/clib; then
5617 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5618 xxx=apollo
5619 libc='/lib/clib /lib/libc'
5620 if $test -r /lib/syslib; then
5621 echo "(Your math library is in /lib/syslib.)"
5622 libc="$libc /lib/syslib"
5623 fi
5624elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5625 echo "Your C library seems to be in $libc, as you said before."
5626elif $test -r $incpath/usr/lib/libc$_a; then
5627 libc=$incpath/usr/lib/libc$_a;
5628 echo "Your C library seems to be in $libc. That's fine."
5629elif $test -r /lib/libc$_a; then
5630 libc=/lib/libc$_a;
5631 echo "Your C library seems to be in $libc. You're normal."
5632else
5633 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5634 :
5635 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5636 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5637 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5638 :
5639 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5640 :
5641 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5642 :
5643 else
5644 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5645 fi
5646 if $test -r "$tans"; then
5647 echo "Your C library seems to be in $tans, of all places."
5648 libc=$tans
5649 else
5650 libc='blurfl'
5651 fi
5652fi
5653if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5654 dflt="$libc"
5655 cat <<EOM
a4f3eea9 5656
c1a7f87b
JH
5657If the guess above is wrong (which it might be if you're using a strange
5658compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5659
5660EOM
a4f3eea9 5661else
c1a7f87b 5662 dflt=''
381aa1ff 5663 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5664 cat >&4 <<EOM
5665I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5666
c1a7f87b
JH
5667EOM
5668 $sed 's/^/ /' libpath
5669 cat <<EOM
29209bc5 5670
c1a7f87b 5671None of these seems to contain your C library. I need to get its name...
a4f3eea9 5672
bd9b35c9 5673EOM
bd9b35c9 5674fi
c1a7f87b
JH
5675fn=f
5676rp='Where is your C library?'
5677. ./getfile
5678libc="$ans"
a4f3eea9 5679
c1a7f87b 5680echo " "
381aa1ff 5681echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5682set X `cat libnames`
5683shift
5684xxx=files
5685case $# in 1) xxx=file; esac
5686echo "Extracting names from the following $xxx for later perusal:" >&4
5687echo " "
5688$sed 's/^/ /' libnames >&4
5689echo " "
5690$echo $n "This may take a while...$c" >&4
a4f3eea9 5691
c1a7f87b
JH
5692for file in $*; do
5693 case $file in
5694 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5695 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5696 esac
c1a7f87b 5697done >libc.tmp
a4f3eea9 5698
c1a7f87b
JH
5699$echo $n ".$c"
5700$grep fprintf libc.tmp > libc.ptf
5701xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
c56d2bdc 5702xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
c1a7f87b
JH
5703xxx='[ADTSIW]'
5704if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5705 eval $xscan;\
5706 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5707 eval $xrun
5708elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5709 eval $xscan;\
5710 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5711 eval $xrun
5712elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5713 eval $xscan;\
5714 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715 eval $xrun
5716elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5717 eval $xscan;\
5718 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719 eval $xrun
5720elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5721 eval $xscan;\
5722 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723 eval $xrun
5724elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5725 eval $xscan;\
5726 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727 eval $xrun
5728elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5729 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5730 eval $xscan;\
5731 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732 eval $xrun
5733elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5734 eval $xscan;\
5735 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736 eval $xrun
5737elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5738 eval $xscan;\
5739 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740 eval $xrun
5741elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5742 eval $xscan;\
5743 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744 eval $xrun
5745elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5746 eval $xscan;\
5747 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748 eval $xrun
5749elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5750 eval $xscan;\
5751 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752 eval $xrun
5753elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5754 eval $xscan;\
5755 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756 eval $xrun
5757elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5758 eval $xscan;\
5759 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760 eval $xrun
5761else
5762 $nm -p $* 2>/dev/null >libc.tmp
5763 $grep fprintf libc.tmp > libc.ptf
5764 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5765 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5766 then
5767 nm_opt='-p'
5768 eval $xrun
bd9b35c9 5769 else
c1a7f87b
JH
5770 echo " "
5771 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5772 com=''
5773 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5774 for thisname in $libnames $libc; do
5775 $ar t $thisname >>libc.tmp
5776 done
5777 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5778 echo "Ok." >&4
5779 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5780 # Repeat libc to extract forwarders to DLL entries too
5781 for thisname in $libnames $libc; do
5782 $ar tv $thisname >>libc.tmp
5783 # Revision 50 of EMX has bug in $ar.
5784 # it will not extract forwarders to DLL entries
5785 # Use emximp which will extract exactly them.
5786 emximp -o tmp.imp $thisname \
5787 2>/dev/null && \
5788 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5789 < tmp.imp >>libc.tmp
5790 $rm tmp.imp
5791 done
5792 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5793 echo "Ok." >&4
5794 else
5795 echo "$ar didn't seem to work right." >&4
5796 echo "Maybe this is a Cray...trying bld instead..." >&4
5797 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5798 then
5799 for thisname in $libnames; do
5800 bld t $libnames | \
5801 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5802 $ar t $thisname >>libc.tmp
5803 done
5804 echo "Ok." >&4
bd9b35c9 5805 else
c1a7f87b
JH
5806 echo "That didn't work either. Giving up." >&4
5807 exit 1
bd9b35c9 5808 fi
c1a7f87b 5809 fi
a4f3eea9 5810 fi
a4f3eea9 5811fi
c1a7f87b
JH
5812nm_extract="$com"
5813if $test -f /lib/syscalls.exp; then
5814 echo " "
5815 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
a8c676c6 5816 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
c1a7f87b
JH
5817fi
5818;;
5819esac
5820$rm -f libnames libpath
bd9b35c9 5821
c1a7f87b
JH
5822: is a C symbol defined?
5823csym='tlook=$1;
5824case "$3" in
5825-v) tf=libc.tmp; tc=""; tdc="";;
5826-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5827*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5828esac;
5829tx=yes;
5830case "$reuseval-$4" in
5831true-) ;;
5832true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5833esac;
5834case "$tx" in
5835yes)
5836 case "$runnm" in
5837 true)
5838 if $contains $tlook $tf >/dev/null 2>&1;
5839 then tval=true;
5840 else tval=false;
5841 fi;;
5842 *)
5843 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5844 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5845 then tval=true;
5846 else tval=false;
5847 fi;
5848 $rm -f t t.c;;
5849 esac;;
5850*)
5851 case "$tval" in
5852 $define) tval=true;;
5853 *) tval=false;;
5854 esac;;
5855esac;
5856eval "$2=$tval"'
bd9b35c9 5857
c1a7f87b
JH
5858: define an is-in-libc? function
5859inlibc='echo " "; td=$define; tu=$undef;
5860sym=$1; var=$2; eval "was=\$$2";
5861tx=yes;
5862case "$reuseval$was" in
5863true) ;;
5864true*) tx=no;;
5865esac;
5866case "$tx" in
5867yes)
5868 set $sym tres -f;
5869 eval $csym;
5870 case "$tres" in
5871 true)
5872 echo "$sym() found." >&4;
5873 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5874 *)
5875 echo "$sym() NOT found." >&4;
5876 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5877 esac;;
bd9b35c9 5878*)
c1a7f87b
JH
5879 case "$was" in
5880 $define) echo "$sym() found." >&4;;
5881 *) echo "$sym() NOT found." >&4;;
5882 esac;;
5883esac'
5884
b4eb6b3d
JH
5885: see if sqrtl exists
5886set sqrtl d_sqrtl
c1a7f87b
JH
5887eval $inlibc
5888
b4eb6b3d
JH
5889: check for length of double
5890echo " "
5891case "$doublesize" in
5892'')
5893 echo "Checking to see how big your double precision numbers are..." >&4
5894 $cat >try.c <<'EOCP'
5895#include <stdio.h>
5896int main()
5897{
5898 printf("%d\n", (int)sizeof(double));
5899 exit(0);
5900}
5901EOCP
5902 set try
5903 if eval $compile_ok; then
5440bc8e 5904 doublesize=`$run ./try`
b4eb6b3d
JH
5905 echo "Your double is $doublesize bytes long."
5906 else
5907 dflt='8'
5908 echo "(I can't seem to compile the test program. Guessing...)"
5909 rp="What is the size of a double precision number (in bytes)?"
5910 . ./myread
5911 doublesize="$ans"
5912 fi
5913 ;;
5914esac
5915$rm -f try.c try
5916
5917: check for long doubles
5918echo " "
5919echo "Checking to see if you have long double..." >&4
5920echo 'int main() { long double x = 7.0; }' > try.c
5921set try
5922if eval $compile; then
5923 val="$define"
5924 echo "You have long double."
5925else
5926 val="$undef"
5927 echo "You do not have long double."
5928fi
5929$rm try.*
5930set d_longdbl
5931eval $setvar
5932
5933: check for length of long double
5934case "${d_longdbl}${longdblsize}" in
5935$define)
5936 echo " "
5937 echo "Checking to see how big your long doubles are..." >&4
5938 $cat >try.c <<'EOCP'
5939#include <stdio.h>
5940int main()
5941{
5942 printf("%d\n", sizeof(long double));
5943}
5944EOCP
5945 set try
5946 set try
5947 if eval $compile; then
5440bc8e 5948 longdblsize=`$run ./try`
b4eb6b3d
JH
5949 echo "Your long doubles are $longdblsize bytes long."
5950 else
5951 dflt='8'
5952 echo " "
5953 echo "(I can't seem to compile the test program. Guessing...)" >&4
5954 rp="What is the size of a long double (in bytes)?"
5955 . ./myread
5956 longdblsize="$ans"
5957 fi
5958 if $test "X$doublesize" = "X$longdblsize"; then
5959 echo "(That isn't any different from an ordinary double.)"
5960 fi
5961 ;;
5962esac
5963$rm -f try.* try
5964
dc526090
NC
5965echo " "
5966
5967if $test X"$d_longdbl" = X"$define"; then
5968
5969echo "Checking how to print long doubles..." >&4
5970
5971if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5972 $cat >try.c <<'EOCP'
5973#include <sys/types.h>
5974#include <stdio.h>
5975int main() {
5976 double d = 123.456;
5977 printf("%.3f\n", d);
5978}
5979EOCP
5980 set try
5981 if eval $compile; then
5982 yyy=`$run ./try`
5983 case "$yyy" in
5984 123.456)
5985 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5986 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5987 echo "We will use %f."
5988 ;;
5989 esac
5990 fi
5991fi
5992
5993if $test X"$sPRIfldbl" = X; then
5994 $cat >try.c <<'EOCP'
5995#include <sys/types.h>
5996#include <stdio.h>
5997int main() {
5998 long double d = 123.456;
5999 printf("%.3Lf\n", d);
6000}
6001EOCP
6002 set try
6003 if eval $compile; then
6004 yyy=`$run ./try`
6005 case "$yyy" in
6006 123.456)
6007 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6008 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6009 echo "We will use %Lf."
6010 ;;
6011 esac
6012 fi
6013fi
6014
6015if $test X"$sPRIfldbl" = X; then
6016 $cat >try.c <<'EOCP'
6017#include <sys/types.h>
6018#include <stdio.h>
6019int main() {
6020 long double d = 123.456;
6021 printf("%.3llf\n", d);
6022}
6023EOCP
6024 set try
6025 if eval $compile; then
6026 yyy=`$run ./try`
6027 case "$yyy" in
6028 123.456)
6029 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6030 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6031 echo "We will use %llf."
6032 ;;
6033 esac
6034 fi
6035fi
6036
6037if $test X"$sPRIfldbl" = X; then
6038 $cat >try.c <<'EOCP'
6039#include <sys/types.h>
6040#include <stdio.h>
6041int main() {
6042 long double d = 123.456;
6043 printf("%.3lf\n", d);
6044}
6045EOCP
6046 set try
6047 if eval $compile; then
6048 yyy=`$run ./try`
6049 case "$yyy" in
6050 123.456)
6051 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6052 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6053 echo "We will use %lf."
6054 ;;
6055 esac
6056 fi
6057fi
6058
6059if $test X"$sPRIfldbl" = X; then
6060 echo "Cannot figure out how to print long doubles." >&4
6061else
6062 sSCNfldbl=$sPRIfldbl # expect consistency
6063fi
6064
6065$rm -f try try.*
6066
6067fi # d_longdbl
6068
6069case "$sPRIfldbl" in
6070'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
6071 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
6072 d_SCNfldbl="$undef";
6073 ;;
6074*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
6075 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
6076 d_SCNfldbl="$define";
6077 ;;
6078esac
6079
6080: see if modfl exists
6081set modfl d_modfl
6082eval $inlibc
6083
6084d_modfl_pow32_bug="$undef"
6085
6086case "$d_longdbl$d_modfl" in
6087$define$define)
6088 $cat <<EOM
6089Checking to see whether your modfl() is okay for large values...
6090EOM
6091$cat >try.c <<EOCP
6092#include <math.h>
6093#include <stdio.h>
6094int main() {
6095 long double nv = 4294967303.15;
6096 long double v, w;
6097 v = modfl(nv, &w);
6098#ifdef __GLIBC__
6099 printf("glibc");
6100#endif
6101 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6102 return 0;
6103}
6104EOCP
6105 case "$osname:$gccversion" in
6106 aix:) saveccflags="$ccflags"
6107 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6108 esac
6109 set try
6110 if eval $compile; then
6111 foo=`$run ./try`
6112 case "$foo" in
6113 *" 4294967303.150000 1.150000 4294967302.000000")
6114 echo >&4 "Your modfl() is broken for large values."
6115 d_modfl_pow32_bug="$define"
6116 case "$foo" in
6117 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6118 ;;
6119 esac
6120 ;;
6121 *" 4294967303.150000 0.150000 4294967303.000000")
6122 echo >&4 "Your modfl() seems okay for large values."
6123 ;;
6124 *) echo >&4 "I don't understand your modfl() at all."
6125 d_modfl="$undef"
6126 ;;
6127 esac
6128 $rm -f try.* try core core.try.*
6129 else
6130 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6131 d_modfl="$undef"
6132 fi
6133 case "$osname:$gccversion" in
6134 aix:) ccflags="$saveccflags" ;; # restore
6135 esac
6136 ;;
6137esac
6138
6139case "$ccflags" in
6140*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6141esac
6142
6143case "$uselongdouble" in
6144$define|true|[yY]*) dflt='y';;
6145*) dflt='n';;
6146esac
6147cat <<EOM
6148
6149Perl can be built to take advantage of long doubles which
6150(if available) may give more accuracy and range for floating point numbers.
6151
6152If this doesn't make any sense to you, just accept the default '$dflt'.
6153EOM
6154rp='Try to use long doubles if available?'
6155. ./myread
6156case "$ans" in
6157y|Y) val="$define" ;;
6158*) val="$undef" ;;
6159esac
6160set uselongdouble
6161eval $setvar
6162
6163case "$uselongdouble" in
6164true|[yY]*) uselongdouble="$define" ;;
6165esac
6166
6167case "$uselongdouble" in
6168$define)
6169: Look for a hint-file generated 'call-back-unit'. If the
6170: user has specified that long doubles should be used,
6171: we may need to set or change some other defaults.
6172 if $test -f uselongdouble.cbu; then
6173 echo "Your platform has some specific hints for long doubles, using them..."
6174 . ./uselongdouble.cbu
6175 else
6176 $cat <<EOM
6177(Your platform doesn't have any specific hints for long doubles.)
6178EOM
6179 fi
6180 ;;
6181esac
6182
6183message=X
6184case "$uselongdouble:$d_sqrtl:$d_modfl" in
6185$define:$define:$define)
6186 : You have both
6187 ;;
6188$define:$define:$undef)
6189 message="I could not find modfl"
6190 ;;
6191$define:$undef:$define)
6192 message="I could not find sqrtl"
6193 ;;
6194$define:$undef:$undef)
6195 message="I found neither sqrtl nor modfl"
6196 ;;
6197esac
6198
6199if $test "$message" != X; then
6200 $cat <<EOM >&4
6201
6202*** You requested the use of long doubles but you do not seem to have
6203*** the mathematic functions for long doubles.
6204*** ($message)
6205*** I'm disabling the use of long doubles.
6206
6207EOM
6208
6209 uselongdouble=$undef
6210fi
6211
51de783f 6212case "$useperlio" in
5a3a8a02 6213$define|true|[yY]*|'') dflt='y';;
51de783f
JH
6214*) dflt='n';;
6215esac
6216cat <<EOM
6217
6218Previous version of $package used the standard IO mechanisms as
5a3a8a02 6219defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 6220alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
6221stdio mechanism is still available if needed. The abstraction layer
6222can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
6223Using PerlIO with sfio may cause problems with some extension modules.
6224
6225If this doesn't make any sense to you, just accept the default '$dflt'.
6226EOM
5a3a8a02 6227rp='Use the PerlIO abstraction layer?'
51de783f
JH
6228. ./myread
6229case "$ans" in
6230y|Y)
6231 val="$define"
5a3a8a02 6232 ;;
51de783f
JH
6233*)
6234 echo "Ok, doing things the stdio way."
6235 val="$undef"
6236 ;;
6237esac
6238set useperlio
6239eval $setvar
6240
6241case "$usesocks" in
6242$define|true|[yY]*)
6243 case "$useperlio" in
6244 $define|true|[yY]*) ;;
6245 *) cat >&4 <<EOM
6246
6247You are using the SOCKS proxy protocol library which means that you
6248should also use the PerlIO layer. You may be headed for trouble.
6249
6250EOM
6251 ;;
6252 esac
6253 ;;
6254esac
6255
6256
b4eb6b3d
JH
6257: determine the architecture name
6258echo " "
6259if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6260 tarch=`arch`"-$osname"
6261elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6262 if uname -m > tmparch 2>&1 ; then
6263 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6264 -e 's/$/'"-$osname/" tmparch`
6265 else
6266 tarch="$osname"
6267 fi
6268 $rm -f tmparch
6269else
6270 tarch="$osname"
6271fi
6272case "$myarchname" in
6273''|"$tarch") ;;
6274*)
6275 echo "(Your architecture name used to be $myarchname.)"
6276 archname=''
6277 ;;
6278esac
5440bc8e
JH
6279case "$targetarch" in
6280'') ;;
6281*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6282esac
b4eb6b3d
JH
6283myarchname="$tarch"
6284case "$archname" in
6285'') dflt="$tarch";;
6286*) dflt="$archname";;
6287esac
6288rp='What is your architecture name'
6289. ./myread
6290archname="$ans"
6291case "$usethreads" in
6292$define)
6293 echo "Threads selected." >&4
6294 case "$archname" in
6295 *-thread*) echo "...and architecture name already has -thread." >&4
6296 ;;
6297 *) archname="$archname-thread"
6298 echo "...setting architecture name to $archname." >&4
6299 ;;
6300 esac
6301 ;;
6302esac
6303case "$usemultiplicity" in
6304$define)
6305 echo "Multiplicity selected." >&4
6306 case "$archname" in
6307 *-multi*) echo "...and architecture name already has -multi." >&4
6308 ;;
6309 *) archname="$archname-multi"
6310 echo "...setting architecture name to $archname." >&4
6311 ;;
6312 esac
6313 ;;
6314esac
6315case "$use64bitint$use64bitall" in
6316*"$define"*)
6317 case "$archname64" in
6318 '')
6319 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6320 ;;
6321 *)
6322 case "$use64bitint" in
6323 "$define") echo "64 bit integers selected." >&4 ;;
6324 esac
6325 case "$use64bitall" in
6326 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6327 esac
6328 case "$archname" in
6329 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6330 ;;
6331 *) archname="$archname-$archname64"
6332 echo "...setting architecture name to $archname." >&4
6333 ;;
6334 esac
6335 ;;
6336 esac
6337esac
6338case "$uselongdouble" in
6339$define)
6340 echo "Long doubles selected." >&4
6341 case "$longdblsize" in
6342 $doublesize)
262495b9 6343 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
b4eb6b3d
JH
6344 ;;
6345 *)
6346 case "$archname" in
6347 *-ld*) echo "...and architecture name already has -ld." >&4
6348 ;;
6349 *) archname="$archname-ld"
6350 echo "...setting architecture name to $archname." >&4
6351 ;;
6352 esac
6353 ;;
6354 esac
6355 ;;
6356esac
51de783f
JH
6357case "$useperlio" in
6358$define)
6359 echo "Perlio selected." >&4
d46c9a2d
JH
6360 ;;
6361*)
6362 echo "Perlio not selected, using stdio." >&4
51de783f 6363 case "$archname" in
d46c9a2d 6364 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 6365 ;;
d46c9a2d 6366 *) archname="$archname-stdio"
51de783f
JH
6367 echo "...setting architecture name to $archname." >&4
6368 ;;
6369 esac
6370 ;;
6371esac
b4eb6b3d
JH
6372
6373: determine root of directory hierarchy where package will be installed.
6374case "$prefix" in
6375'')
6376 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6377 ;;
6378*)
6379 dflt="$prefix"
6380 ;;
6381esac
6382$cat <<EOM
6383
6384By default, $package will be installed in $dflt/bin, manual pages
6385under $dflt/man, etc..., i.e. with $dflt as prefix for all
6386installation directories. Typically this is something like /usr/local.
6387If you wish to have binaries under /usr/bin but other parts of the
6388installation under /usr/local, that's ok: you will be prompted
6389separately for each of the installation directories, the prefix being
6390only used to set the defaults.
6391
6392EOM
6393fn=d~
6394rp='Installation prefix to use?'
6395. ./getfile
6396oldprefix=''
6397case "$prefix" in
6398'') ;;
6399*)
6400 case "$ans" in
6401 "$prefix") ;;
6402 *) oldprefix="$prefix";;
6403 esac
6404 ;;
6405esac
6406prefix="$ans"
6407prefixexp="$ansexp"
6408
a6d26a0d
JH
6409case "$afsroot" in
6410'') afsroot=/afs ;;
6411*) afsroot=$afsroot ;;
6412esac
6413
b4eb6b3d
JH
6414: is AFS running?
6415echo " "
6416case "$afs" in
6417$define|true) afs=true ;;
6418$undef|false) afs=false ;;
a6d26a0d 6419*) if test -d $afsroot; then
b4eb6b3d
JH
6420 afs=true
6421 else
6422 afs=false
6423 fi
6424 ;;
6425esac
6426if $afs; then
6427 echo "AFS may be running... I'll be extra cautious then..." >&4
6428else
6429 echo "AFS does not seem to be running..." >&4
6430fi
6431
6432: determine installation prefix for where package is to be installed.
6433if $afs; then
6434$cat <<EOM
6435
6436Since you are running AFS, I need to distinguish the directory in which
6437files will reside from the directory in which they are installed (and from
6438which they are presumably copied to the former directory by occult means).
6439
6440EOM
6441 case "$installprefix" in
6442 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6443 *) dflt="$installprefix";;
6444 esac
6445else
6446$cat <<EOM
6447
6448In some special cases, particularly when building $package for distribution,
6449it is convenient to distinguish between the directory in which files should
6450be installed from the directory ($prefix) in which they
6451will eventually reside. For most users, these two directories are the same.
6452
6453EOM
6454 case "$installprefix" in
6455 '') dflt=$prefix ;;
6456 *) dflt=$installprefix;;
6457 esac
6458fi
6459fn=d~
6460rp='What installation prefix should I use for installing files?'
6461. ./getfile
6462installprefix="$ans"
6463installprefixexp="$ansexp"
6464
6465: set the prefixit variable, to compute a suitable default value
6466prefixit='case "$3" in
6467""|none)
6468 case "$oldprefix" in
6469 "") eval "$1=\"\$$2\"";;
6470 *)
6471 case "$3" in
6472 "") eval "$1=";;
6473 none)
6474 eval "tp=\"\$$2\"";
6475 case "$tp" in
6476 ""|" ") eval "$1=\"\$$2\"";;
6477 *) eval "$1=";;
6478 esac;;
6479 esac;;
6480 esac;;
6481*)
6482 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6483 case "$tp" in
6484 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6485 /*-$oldprefix/*|\~*-$oldprefix/*)
6486 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6487 *) eval "$1=\"\$$2\"";;
6488 esac;;
6489esac'
6490
b4eb6b3d
JH
6491: get the patchlevel
6492echo " "
6493echo "Getting the current patchlevel..." >&4
6494if $test -r $rsrc/patchlevel.h;then
6495 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6496 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6497 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6498 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6499 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6500 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6501 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6502else
6503 revision=0
6504 patchlevel=0
6505 subversion=0
6506 api_revision=0
6507 api_version=0
6508 api_subversion=0
151e6568
MB
6509 perl_patchlevel=0
6510 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6511fi
151e6568
MB
6512if $test -r $rsrc/.patch ; then
6513 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6514 perl_patchlevel=`cat $rsrc/.patch`
6515 fi
6516fi
861eb78d
AD
6517: Define a handy string here to avoid duplication in myconfig.SH and configpm.
6518version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 6519case "$perl_patchlevel" in
861eb78d
AD
65200|'') ;;
6521*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 6522esac
861eb78d
AD
6523
6524$echo "(You have $package $version_patchlevel_string.)"
6525
b4eb6b3d
JH
6526case "$osname" in
6527dos|vms)
6528 : XXX Should be a Configure test for double-dots in filenames.
6529 version=`echo $revision $patchlevel $subversion | \
6530 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6531 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6532 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6533 ;;
6534*)
6535 version=`echo $revision $patchlevel $subversion | \
6536 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6537 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6538 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6539 ;;
6540esac
6541: Special case the 5.005_xx maintenance series, which used 5.005
6542: without any subversion label as a subdirectory in $sitelib
6543if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6544 api_versionstring='5.005'
6545fi
6546
6547: determine installation style
6548: For now, try to deduce it from prefix unless it is already set.
6549: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6550case "$installstyle" in
6551'') case "$prefix" in
6552 *perl*) dflt='lib';;
6553 *) dflt='lib/perl5' ;;
6554 esac
6555 ;;
6556*) dflt="$installstyle" ;;
6557esac
6558: Probably not worth prompting for this since we prompt for all
6559: the directories individually, and the prompt would be too long and
6560: confusing anyway.
6561installstyle=$dflt
6562
6563: determine where private library files go
6564: Usual default is /usr/local/lib/perl5/$version.
6565: Also allow things like /opt/perl/lib/$version, since
6566: /opt/perl/lib/perl5... would be redundant.
6567: The default "style" setting is made in installstyle.U
6568case "$installstyle" in
6569*lib/perl5*) set dflt privlib lib/$package/$version ;;
6570*) set dflt privlib lib/$version ;;
6571esac
6572eval $prefixit
6573$cat <<EOM
6574
6575There are some auxiliary files for $package that need to be put into a
6576private library directory that is accessible by everyone.
6577
6578EOM
6579fn=d~+
6580rp='Pathname where the private library files will reside?'
6581. ./getfile
6582privlib="$ans"
6583privlibexp="$ansexp"
6584: Change installation prefix, if necessary.
6585if $test X"$prefix" != X"$installprefix"; then
6586 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6587else
6588 installprivlib="$privlibexp"
6589fi
6590
6591: set the prefixup variable, to restore leading tilda escape
6592prefixup='case "$prefixexp" in
6593"$prefix") ;;
6594*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6595esac'
6596
6597: determine where public architecture dependent libraries go
6598set archlib archlib
6599eval $prefixit
6600: privlib default is /usr/local/lib/$package/$version
6601: archlib default is /usr/local/lib/$package/$version/$archname
6602: privlib may have an optional trailing /share.
6603tdflt=`echo $privlib | $sed 's,/share$,,'`
6604tdflt=$tdflt/$archname
6605case "$archlib" in
6606'') dflt=$tdflt
6607 ;;
6608*) dflt="$archlib"
6609 ;;
6610esac
6611$cat <<EOM
6612
6613$spackage contains architecture-dependent library files. If you are
6614sharing libraries in a heterogeneous environment, you might store
6615these files in a separate location. Otherwise, you can just include
6616them with the rest of the public library files.
6617
6618EOM
6619fn=d+~
6620rp='Where do you want to put the public architecture-dependent libraries?'
6621. ./getfile
6622archlib="$ans"
6623archlibexp="$ansexp"
6624if $test X"$archlib" = X"$privlib"; then
6625 d_archlib="$undef"
6626else
6627 d_archlib="$define"
6628fi
6629: Change installation prefix, if necessary.
6630if $test X"$prefix" != X"$installprefix"; then
6631 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6632else
6633 installarchlib="$archlibexp"
6634fi
6635
6636
6637: Binary compatibility with 5.005 is not possible for builds
6638: with advanced features
6639case "$usethreads$usemultiplicity" in
6640*define*)
6641 bincompat5005="$undef"
6642 d_bincompat5005="$undef"
6643 ;;
6644*) $cat <<EOM
6645
6646This version of Perl can be compiled for binary compatibility with 5.005.
6647If you decide to do so, you will be able to continue using most of the
6648extensions that were compiled for Perl 5.005.
6649
6650EOM
6651 case "$bincompat5005$d_bincompat5005" in
6652 *"$undef"*) dflt=n ;;
6653 *) dflt=y ;;
6654 esac
6655 rp='Binary compatibility with Perl 5.005?'
6656 . ./myread
6657 case "$ans" in
6658 y*) val="$define" ;;
6659 *) val="$undef" ;;
6660 esac
6661 set d_bincompat5005
6662 eval $setvar
6663 case "$d_bincompat5005" in
6664 "$define")
6665 bincompat5005="$define"
6666 ;;
6667 *) bincompat5005="$undef"
6668 d_bincompat5005="$undef"
6669 ;;
6670 esac
6671 ;;
6672esac
6673
6674
6675: see if setuid scripts can be secure
6676$cat <<EOM
6677
6678Some kernels have a bug that prevents setuid #! scripts from being
6679secure. Some sites have disabled setuid #! scripts because of this.
6680
6681First let's decide if your kernel supports secure setuid #! scripts.
6682(If setuid #! scripts would be secure but have been disabled anyway,
6683don't say that they are secure if asked.)
6684
6685EOM
6686
6687val="$undef"
6688if $test -d /dev/fd; then
6689 echo "#!$ls" >reflect
6690 chmod +x,u+s reflect
6691 ./reflect >flect 2>&1
6692 if $contains "/dev/fd" flect >/dev/null; then
6693 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6694 val="$define"
6695 else
6696 $cat <<EOM
6697If you are not sure if they are secure, I can check but I'll need a
6698username and password different from the one you are using right now.
6699If you don't have such a username or don't want me to test, simply
6700enter 'none'.
6701
6702EOM
6703 rp='Other username to test security of setuid scripts with?'
6704 dflt='none'
6705 . ./myread
6706 case "$ans" in
6707 n|none)
6708 case "$d_suidsafe" in
6709 '') echo "I'll assume setuid scripts are *not* secure." >&4
6710 dflt=n;;
6711 "$undef")
6712 echo "Well, the $hint value is *not* secure." >&4
6713 dflt=n;;
6714 *) echo "Well, the $hint value *is* secure." >&4
6715 dflt=y;;
6716 esac
c1a7f87b 6717 ;;
b4eb6b3d
JH
6718 *)
6719 $rm -f reflect flect
6720 echo "#!$ls" >reflect
6721 chmod +x,u+s reflect
6722 echo >flect
6723 chmod a+w flect
6724 echo '"su" will (probably) prompt you for '"$ans's password."
6725 su $ans -c './reflect >flect'
6726 if $contains "/dev/fd" flect >/dev/null; then
6727 echo "Okay, it looks like setuid scripts are secure." >&4
6728 dflt=y
6729 else
6730 echo "I don't think setuid scripts are secure." >&4
6731 dflt=n
6732 fi
6733 ;;
6734 esac
6735 rp='Does your kernel have *secure* setuid scripts?'
6736 . ./myread
6737 case "$ans" in
6738 [yY]*) val="$define";;
6739 *) val="$undef";;
6740 esac
6741 fi
6742else
6743 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6744 echo "(That's for file descriptors, not floppy disks.)"
6745 val="$undef"
6746fi
6747set d_suidsafe
6748eval $setvar
6749
6750$rm -f reflect flect
6751
6752: now see if they want to do setuid emulation
6753echo " "
6754val="$undef"
6755case "$d_suidsafe" in
6756"$define")
6757 val="$undef"
3c728e00 6758 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6759 ;;
6760*)
6761 $cat <<EOM
6762Some systems have disabled setuid scripts, especially systems where
6763setuid scripts cannot be secure. On systems where setuid scripts have
6764been disabled, the setuid/setgid bits on scripts are currently
6765useless. It is possible for $package to detect those bits and emulate
6766setuid/setgid in a secure fashion. This emulation will only work if
6767setuid scripts have been disabled in your kernel.
6768
6769EOM
6770 case "$d_dosuid" in
6771 "$define") dflt=y ;;
6772 *) dflt=n ;;
6773 esac
6774 rp="Do you want to do setuid/setgid emulation?"
6775 . ./myread
6776 case "$ans" in
6777 [yY]*) val="$define";;
6778 *) val="$undef";;
6779 esac
6780 ;;
6781esac
6782set d_dosuid
6783eval $setvar
6784
b4eb6b3d
JH
6785: see if this is a malloc.h system
6786set malloc.h i_malloc
6787eval $inhdr
6788
6789: see if stdlib is available
6790set stdlib.h i_stdlib
6791eval $inhdr
6792
6793: determine which malloc to compile in
6794echo " "
6795case "$usemymalloc" in
c4163172
JH
6796[yY]*|true|$define) dflt='y' ;;
6797[nN]*|false|$undef) dflt='n' ;;
6798*) case "$ptrsize" in
6799 4) dflt='y' ;;
6800 *) dflt='n' ;;
6801 esac
6802 ;;
8dfa8df9 6803esac
b4eb6b3d
JH
6804rp="Do you wish to attempt to use the malloc that comes with $package?"
6805. ./myread
6806usemymalloc="$ans"
6807case "$ans" in
6808y*|true)
6809 usemymalloc='y'
6810 mallocsrc='malloc.c'
6811 mallocobj="malloc$_o"
6812 d_mymalloc="$define"
6813 case "$libs" in
6814 *-lmalloc*)
6815 : Remove malloc from list of libraries to use
6816 echo "Removing unneeded -lmalloc from library list" >&4
6817 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6818 shift
6819 libs="$*"
6820 echo "libs = $libs" >&4
6821 ;;
6822 esac
6823 ;;
6824*)
6825 usemymalloc='n'
6826 mallocsrc=''
6827 mallocobj=''
6828 d_mymalloc="$undef"
6829 ;;
6830esac
6831
6832: compute the return types of malloc and free
6833echo " "
6834$cat >malloc.c <<END
6835#$i_malloc I_MALLOC
6836#$i_stdlib I_STDLIB
6837#include <stdio.h>
6838#include <sys/types.h>
6839#ifdef I_MALLOC
6840#include <malloc.h>
6841#endif
6842#ifdef I_STDLIB
6843#include <stdlib.h>
6844#endif
6845#ifdef TRY_MALLOC
6846void *malloc();
6847#endif
6848#ifdef TRY_FREE
6849void free();
6850#endif
6851END
6852case "$malloctype" in
6853'')
6854 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6855 malloctype='void *'
6856 else
6857 malloctype='char *'
6858 fi
6859 ;;
6860esac
6861echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6862
6863case "$freetype" in
6864'')
6865 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6866 freetype='void'
6867 else
6868 freetype='int'
6869 fi
6870 ;;
6871esac
6872echo "Your system uses $freetype free(), it would seem." >&4
6873$rm -f malloc.[co]
6874$cat <<EOM
6875
6876After $package is installed, you may wish to install various
6877add-on modules and utilities. Typically, these add-ons will
6878be installed under $prefix with the rest
6879of this package. However, you may wish to install such add-ons
6880elsewhere under a different prefix.
6881
6882If you do not wish to put everything under a single prefix, that's
6883ok. You will be prompted for the individual locations; this siteprefix
6884is only used to suggest the defaults.
6885
6886The default should be fine for most people.
6887
6888EOM
6889fn=d~+
6890rp='Installation prefix to use for add-on modules and utilities?'
6891: XXX Here might be another good place for an installstyle setting.
6892case "$siteprefix" in
6893'') dflt=$prefix ;;
6894*) dflt=$siteprefix ;;
6895esac
6896. ./getfile
6897: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6898oldsiteprefix=''
6899case "$siteprefix" in
6900'') ;;
6901*) case "$ans" in
6902 "$prefix") ;;
6903 *) oldsiteprefix="$prefix";;
6904 esac
6905 ;;
6906esac
6907siteprefix="$ans"
6908siteprefixexp="$ansexp"
6909
6910: determine where site specific libraries go.
6911: Usual default is /usr/local/lib/perl5/site_perl/$version
6912: The default "style" setting is made in installstyle.U
6913: XXX No longer works with Prefixit stuff.
6914prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6915case "$sitelib" in
6916'') case "$installstyle" in
6917 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6918 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6919 esac
6920 ;;
6921*) dflt="$sitelib"
6922 ;;
6923esac
6924$cat <<EOM
6925
6926The installation process will create a directory for
6927site-specific extensions and modules. Most users find it convenient
6928to place all site-specific files in this directory rather than in the
6929main distribution directory.
6930
6931EOM
6932fn=d~+
6933rp='Pathname for the site-specific library files?'
6934. ./getfile
6935sitelib="$ans"
6936sitelibexp="$ansexp"
6937sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6938: Change installation prefix, if necessary.
6939if $test X"$prefix" != X"$installprefix"; then
6940 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6941else
6942 installsitelib="$sitelibexp"
6943fi
6944
6945: determine where site specific architecture-dependent libraries go.
6946: sitelib default is /usr/local/lib/perl5/site_perl/$version
6947: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6948: sitelib may have an optional trailing /share.
6949case "$sitearch" in
6950'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6951 dflt="$dflt/$archname"
6952 ;;
6953*) dflt="$sitearch"
6954 ;;
6955esac
6956set sitearch sitearch none
6957eval $prefixit
6958$cat <<EOM
6959
6960The installation process will also create a directory for
6961architecture-dependent site-specific extensions and modules.
6962
6963EOM
6964fn=d~+
6965rp='Pathname for the site-specific architecture-dependent library files?'
6966. ./getfile
6967sitearch="$ans"
6968sitearchexp="$ansexp"
6969: Change installation prefix, if necessary.
6970if $test X"$prefix" != X"$installprefix"; then
6971 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6972else
6973 installsitearch="$sitearchexp"
6974fi
6975
6976$cat <<EOM
6977
6978The installation process will also create a directory for
6979vendor-supplied add-ons. Vendors who supply perl with their system
6980may find it convenient to place all vendor-supplied files in this
6981directory rather than in the main distribution directory. This will
6982ease upgrades between binary-compatible maintenance versions of perl.
6983
6984Of course you may also use these directories in whatever way you see
6985fit. For example, you might use them to access modules shared over a
6986company-wide network.
6987
6988The default answer should be fine for most people.
6989This causes further questions about vendor add-ons to be skipped
6990and no vendor-specific directories will be configured for perl.
6991
6992EOM
6993rp='Do you want to configure vendor-specific add-on directories?'
6994case "$usevendorprefix" in
6995define|true|[yY]*) dflt=y ;;
6996*) : User may have set vendorprefix directly on Configure command line.
6997 case "$vendorprefix" in
6998 ''|' ') dflt=n ;;
6999 *) dflt=y ;;
7000 esac
7001 ;;
7002esac
7003. ./myread
7004case "$ans" in
7005[yY]*) fn=d~+
7006 rp='Installation prefix to use for vendor-supplied add-ons?'
7007 case "$vendorprefix" in
7008 '') dflt='' ;;
7009 *) dflt=$vendorprefix ;;
7010 esac
7011 . ./getfile
7012 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7013 oldvendorprefix=''
7014 case "$vendorprefix" in
7015 '') ;;
7016 *) case "$ans" in
7017 "$prefix") ;;
7018 *) oldvendorprefix="$prefix";;
7019 esac
7020 ;;
7021 esac
7022 usevendorprefix="$define"
7023 vendorprefix="$ans"
7024 vendorprefixexp="$ansexp"
7025 ;;
7026*) usevendorprefix="$undef"
7027 vendorprefix=''
7028 vendorprefixexp=''
7029 ;;
7030esac
7031
7032case "$vendorprefix" in
7033'') d_vendorlib="$undef"
7034 vendorlib=''
7035 vendorlibexp=''
7036 ;;
7037*) d_vendorlib="$define"
7038 : determine where vendor-supplied modules go.
7039 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7040 case "$vendorlib" in
7041 '')
7042 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7043 case "$installstyle" in
7044 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7045 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7046 esac
7047 ;;
7048 *) dflt="$vendorlib"
7049 ;;
7050 esac
7051 fn=d~+
7052 rp='Pathname for the vendor-supplied library files?'
7053 . ./getfile
7054 vendorlib="$ans"
7055 vendorlibexp="$ansexp"
7056 ;;
7057esac
7058vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7059: Change installation prefix, if necessary.
7060if $test X"$prefix" != X"$installprefix"; then
7061 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7062else
7063 installvendorlib="$vendorlibexp"
7064fi
7065
7066case "$vendorprefix" in
7067'') d_vendorarch="$undef"
7068 vendorarch=''
7069 vendorarchexp=''
7070 ;;
7071*) d_vendorarch="$define"
7072 : determine where vendor-supplied architecture-dependent libraries go.
7073 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7074 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7075 : vendorlib may have an optional trailing /share.
7076 case "$vendorarch" in
7077 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7078 dflt="$dflt/$archname"
7079 ;;
7080 *) dflt="$vendorarch" ;;
7081 esac
7082 fn=d~+
7083 rp='Pathname for vendor-supplied architecture-dependent files?'
7084 . ./getfile
7085 vendorarch="$ans"
7086 vendorarchexp="$ansexp"
7087 ;;
7088esac
7089: Change installation prefix, if necessary.
7090if $test X"$prefix" != X"$installprefix"; then
7091 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7092else
7093 installvendorarch="$vendorarchexp"
7094fi
7095
7096: Final catch-all directories to search
7097$cat <<EOM
7098
7099Lastly, you can have perl look in other directories for extensions and
7100modules in addition to those already specified.
7101These directories will be searched after
7102 $sitearch
7103 $sitelib
7104EOM
7105test X"$vendorlib" != "X" && echo ' ' $vendorlib
7106test X"$vendorarch" != "X" && echo ' ' $vendorarch
7107echo ' '
7108case "$otherlibdirs" in
7109''|' ') dflt='none' ;;
7110*) dflt="$otherlibdirs" ;;
7111esac
7112$cat <<EOM
7113Enter a colon-separated set of extra paths to include in perl's @INC
7114search path, or enter 'none' for no extra paths.
7115
7116EOM
7117
7118rp='Colon-separated list of additional directories for perl to search?'
7119. ./myread
7120case "$ans" in
7121' '|''|none) otherlibdirs=' ' ;;
7122*) otherlibdirs="$ans" ;;
7123esac
7124case "$otherlibdirs" in
7125' ') val=$undef ;;
7126*) val=$define ;;
7127esac
7128set d_perl_otherlibdirs
7129eval $setvar
7130
7131: Cruising for prototypes
7132echo " "
7133echo "Checking out function prototypes..." >&4
7134$cat >prototype.c <<'EOCP'
7135int main(int argc, char *argv[]) {
7136 exit(0);}
7137EOCP
7138if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7139 echo "Your C compiler appears to support function prototypes."
7140 val="$define"
7141else
7142 echo "Your C compiler doesn't seem to understand function prototypes."
7143 val="$undef"
7144fi
7145set prototype
7146eval $setvar
7147$rm -f prototype*
7148
7149case "$prototype" in
7150"$define") ;;
7151*) ansi2knr='ansi2knr'
7152 echo " "
7153 cat <<EOM >&4
7154
7155$me: FATAL ERROR:
7156This version of $package can only be compiled by a compiler that
7157understands function prototypes. Unfortunately, your C compiler
7158 $cc $ccflags
7159doesn't seem to understand them. Sorry about that.
7160
7161If GNU cc is available for your system, perhaps you could try that instead.
7162
7163Eventually, we hope to support building Perl with pre-ANSI compilers.
7164If you would like to help in that effort, please contact <perlbug@perl.org>.
7165
7166Aborting Configure now.
7167EOM
7168 exit 2
7169 ;;
7170esac
7171
7172: determine where public executables go
7173echo " "
7174set dflt bin bin
7175eval $prefixit
7176fn=d~
7177rp='Pathname where the public executables will reside?'
7178. ./getfile
7179if $test "X$ansexp" != "X$binexp"; then
7180 installbin=''
7181fi
7182bin="$ans"
7183binexp="$ansexp"
7184: Change installation prefix, if necessary.
7185: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7186if $test X"$prefix" != X"$installprefix"; then
7187 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7188else
7189 installbin="$binexp"
7190fi
7191
6fcddf3b 7192echo " "
6fcddf3b 7193case "$extras" in
bf35c3f6
JH
7194'') dflt='n';;
7195*) dflt='y';;
6fcddf3b
JH
7196esac
7197cat <<EOM
7198Perl can be built with extra modules or bundles of modules which
7199will be fetched from the CPAN and installed alongside Perl.
7200
7201Notice that you will need access to the CPAN; either via the Internet,
7202or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7203be asked later to configure the CPAN.pm module which will in turn do
7204the installation of the rest of the extra modules or bundles.)
7205
7206Notice also that if the modules require any external software such as
dd2de242
JH
7207libraries and headers (the libz library and the zlib.h header for the
7208Compress::Zlib module, for example) you MUST have any such software
7209already installed, this configuration process will NOT install such
7210things for you.
6fcddf3b
JH
7211
7212If this doesn't make any sense to you, just accept the default '$dflt'.
7213EOM
dd2de242 7214rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7215. ./myread
7216case "$ans" in
7217y|Y)
7218 cat <<EOM
7219
7220Please list any extra modules or bundles to be installed from CPAN,
7221with spaces between the names. The names can be in any format the
dd2de242
JH
7222'install' command of CPAN.pm will understand. (Answer 'none',
7223without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7224EOM
7225 rp='Extras?'
7226 dflt="$extras"
7227 . ./myread
7228 extras="$ans"
7229esac
7230case "$extras" in
7231''|'none')
7232 val=''
7233 $rm -f ../extras.lst
7234 ;;
7235*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7236 echo "$extras" > ../extras.lst
7237 val="'$extras'"
6fcddf3b
JH
7238 ;;
7239esac
7240set extras
7241eval $setvar
7242echo " "
7243
b4eb6b3d
JH
7244: Find perl5.005 or later.
7245echo "Looking for a previously installed perl5.005 or later... "
7246case "$perl5" in
a938a3bb 7247'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 7248 : Check if this perl is recent and can load a simple module
a938a3bb 7249 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
7250 perl5=$tdir/perl
7251 break;
a938a3bb
IZ
7252 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7253 perl5=$tdir/perl5
b4eb6b3d
JH
7254 break;
7255 fi
7256 done
7257 ;;
7258*) perl5="$perl5"
7259 ;;
7260esac
7261case "$perl5" in
7262'') echo "None found. That's ok.";;
7263*) echo "Using $perl5." ;;
7264esac
7265
7266: Determine list of previous versions to include in @INC
7267$cat > getverlist <<EOPL
7268#!$perl5 -w
7269use File::Basename;
7270\$api_versionstring = "$api_versionstring";
7271\$version = "$version";
7272\$stem = "$sitelib_stem";
7273\$archname = "$archname";
7274EOPL
7275 $cat >> getverlist <<'EOPL'
7276# Can't have leading @ because metaconfig interprets it as a command!
7277;@inc_version_list=();
7278# XXX Redo to do opendir/readdir?
7279if (-d $stem) {
7280 chdir($stem);
7281 ;@candidates = glob("5.*");
7282}
7283else {
7284 ;@candidates = ();
7285}
7286
7287# XXX ToDo: These comparisons must be reworked when two-digit
7288# subversions come along, so that 5.7.10 compares as greater than
7289# 5.7.3! By that time, hope that 5.6.x is sufficiently
7290# widespread that we can use the built-in version vectors rather
7291# than reinventing them here. For 5.6.0, however, we must
7292# assume this script will likely be run by 5.005_0x. --AD 1/2000.
7293foreach $d (@candidates) {
7294 if ($d lt $version) {
7295 if ($d ge $api_versionstring) {
7296 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7297 }
7298 elsif ($d ge "5.005") {
7299 unshift(@inc_version_list, grep { -d } $d);
7300 }
7301 }
7302 else {
7303 # Skip newer version. I.e. don't look in
7304 # 5.7.0 if we're installing 5.6.1.
7305 }
7306}
7307
7308if (@inc_version_list) {
7309 print join(' ', @inc_version_list);
7310}
7311else {
7312 # Blank space to preserve value for next Configure run.
7313 print " ";
7314}
7315EOPL
7316chmod +x getverlist
7317case "$inc_version_list" in
a938a3bb 7318'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
7319 dflt=`$perl5 getverlist`
7320 else
7321 dflt='none'
7322 fi
7323 ;;
7324$undef) dflt='none' ;;
6d1a7737 7325*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
7326esac
7327case "$dflt" in
7328''|' ') dflt=none ;;
7329esac
7330case "$dflt" in
73315.005) case "$bincompat5005" in
7332 $define|true|[yY]*) ;;
7333 *) dflt=none ;;
7334 esac
7335 ;;
7336esac
7337$cat <<'EOM'
7338
7339In order to ease the process of upgrading, this version of perl
7340can be configured to use modules built and installed with earlier
7341versions of perl that were installed under $prefix. Specify here
7342the list of earlier versions that this version of perl should check.
7343If Configure detected no earlier versions of perl installed under
7344$prefix, then the list will be empty. Answer 'none' to tell perl
7345to not search earlier versions.
7346
7347The default should almost always be sensible, so if you're not sure,
7348just accept the default.
7349EOM
7350
7351rp='List of earlier versions to include in @INC?'
7352. ./myread
7353case "$ans" in
7354[Nn]one|''|' ') inc_version_list=' ' ;;
7355*) inc_version_list="$ans" ;;
7356esac
7357case "$inc_version_list" in
7358''|' ')
7359 inc_version_list_init='0';;
7360*) inc_version_list_init=`echo $inc_version_list |
7361 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7362 ;;
7363esac
7364$rm -f getverlist
7365
7366: determine whether to install perl also as /usr/bin/perl
7367
7368echo " "
7369if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7370 $cat <<EOM
7371Many scripts expect perl to be installed as /usr/bin/perl.
7372I can install the perl you are about to compile also as /usr/bin/perl
7373(in addition to $installbin/perl).
7374EOM
7375 case "$installusrbinperl" in
7376 "$undef"|[nN]*) dflt='n';;
7377 *) dflt='y';;
7378 esac
7379 rp="Do you want to install perl as /usr/bin/perl?"
7380 . ./myread
7381 case "$ans" in
7382 [yY]*) val="$define";;
7383 *) val="$undef" ;;
7384 esac
7385else
7386 val="$undef"
7387fi
7388set installusrbinperl
7389eval $setvar
7390
7391: see if dld is available
7392set dld.h i_dld
7393eval $inhdr
7394
7395: see if dlopen exists
7396xxx_runnm="$runnm"
7397runnm=false
7398set dlopen d_dlopen
7399eval $inlibc
7400runnm="$xxx_runnm"
7401
7402: determine which dynamic loading, if any, to compile in
7403echo " "
7404dldir="ext/DynaLoader"
7405case "$usedl" in
7406$define|y|true)
7407 dflt='y'
7408 usedl="$define"
7409 ;;
7410$undef|n|false)
7411 dflt='n'
7412 usedl="$undef"
7413 ;;
7414*)
7415 dflt='n'
7416 case "$d_dlopen" in
7417 $define) dflt='y' ;;
7418 esac
7419 case "$i_dld" in
7420 $define) dflt='y' ;;
7421 esac
7422 : Does a dl_xxx.xs file exist for this operating system
7423 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7424 ;;
7425esac
7426rp="Do you wish to use dynamic loading?"
7427. ./myread
7428usedl="$ans"
7429case "$ans" in
7430y*) usedl="$define"
7431 case "$dlsrc" in
7432 '')
7433 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7434 dflt="$dldir/dl_${osname}.xs"
7435 elif $test "$d_dlopen" = "$define" ; then
7436 dflt="$dldir/dl_dlopen.xs"
7437 elif $test "$i_dld" = "$define" ; then
7438 dflt="$dldir/dl_dld.xs"
7439 else
7440 dflt=''
7441 fi
7442 ;;
7443 *) dflt="$dldir/$dlsrc"
7444 ;;
7445 esac
7446 echo "The following dynamic loading files are available:"
7447 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7448 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7449 rp="Source file to use for dynamic loading"
7450 fn="fne"
7451 gfpth="$src"
7452 . ./getfile
7453 usedl="$define"
7454 : emulate basename
7455 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7456
7457 $cat << EOM
7458
7459Some systems may require passing special flags to $cc -c to
7460compile modules that will be used to create a shared library.
7461To use no flags, say "none".
7462
7463EOM
7464 case "$cccdlflags" in
7465 '') case "$gccversion" in
7466 '') case "$osname" in
7467 hpux) dflt='+z' ;;
7468 next) dflt='none' ;;
7469 irix*) dflt='-KPIC' ;;
48bcfe03 7470 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7471 sunos) dflt='-pic' ;;
7472 *) dflt='none' ;;
7473 esac
7474 ;;
7475 *) case "$osname" in
b6cc0f4c 7476 darwin) dflt='none' ;;
48bcfe03 7477 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7478 *) dflt='-fpic' ;;
7479 esac ;;
7480 esac ;;
7481 ' ') dflt='none' ;;
7482 *) dflt="$cccdlflags" ;;
7483 esac
7484 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7485 . ./myread
7486 case "$ans" in
7487 none) cccdlflags=' ' ;;
7488 *) cccdlflags="$ans" ;;
7489 esac
7490
7491 cat << EOM
7492
7493Some systems use ld to create libraries that can be dynamically loaded,
7494while other systems (such as those using ELF) use $cc.
7495
7496EOM
7497 case "$ld" in
7498 '') $cat >try.c <<'EOM'
7499/* Test for whether ELF binaries are produced */
7500#include <fcntl.h>
7501#include <stdlib.h>
7502int main() {
7503 char b[4];
7504 int i = open("a.out",O_RDONLY);
7505 if(i == -1)
7506 exit(1); /* fail */
7507 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7508 exit(0); /* succeed (yes, it's ELF) */
7509 else
7510 exit(1); /* fail */
7511}
7512EOM
5440bc8e 7513 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7514 cat <<EOM
7515You appear to have ELF support. I'll use $cc to build dynamic libraries.
7516EOM
7517 dflt="$cc"
7518 else
7519 echo "I'll use ld to build dynamic libraries."
7520 dflt='ld'
7521 fi
7522 rm -f try.c a.out
7523 ;;
7524 *) dflt="$ld"
7525 ;;
7526 esac
7527
7528 rp="What command should be used to create dynamic libraries?"
7529 . ./myread
7530 ld="$ans"
7531
7532 cat << EOM
7533
7534Some systems may require passing special flags to $ld to create a
7535library that can be dynamically loaded. If your ld flags include
7536-L/other/path options to locate libraries outside your loader's normal
7537search path, you may need to specify those -L options here as well. To
7538use no flags, say "none".
7539
7540EOM
7541 case "$lddlflags" in
7542 '') case "$osname" in
7543 beos) dflt='-nostart' ;;
7544 hpux) dflt='-b';
7545 case "$gccversion" in
7546 '') dflt="$dflt +vnocompatwarnings" ;;
7547 esac
7548 ;;
7549 linux|irix*) dflt='-shared' ;;
7550 next) dflt='none' ;;
7551 solaris) dflt='-G' ;;
7552 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7553 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7554 *) dflt='none' ;;
7555 esac
7556 ;;
7557 *) dflt="$lddlflags" ;;
7558 esac
7559
7560 : Try to guess additional flags to pick up local libraries.
7561 : Be careful not to append to a plain 'none'
7562 case "$dflt" in
7563 none) dflt='' ;;
7564 esac
7565 for thisflag in $ldflags; do
7566 case "$thisflag" in
b5b9f165 7567 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7568 case " $dflt " in
7569 *" $thisflag "*) ;;
7570 *) dflt="$dflt $thisflag" ;;
7571 esac
7572 ;;
7573 esac
7574 done
7575
7576 case "$dflt" in
7577 ''|' ') dflt='none' ;;
7578 esac
7579
7580 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7581 . ./myread
7582 case "$ans" in
7583 none) lddlflags=' ' ;;
7584 *) lddlflags="$ans" ;;
7585 esac
7586
7587 cat <<EOM
7588
7589Some systems may require passing special flags to $cc to indicate that
7590the resulting executable will use dynamic linking. To use no flags,
7591say "none".
7592
7593EOM
7594 case "$ccdlflags" in
7595 '') case "$osname" in
7596 hpux) dflt='-Wl,-E' ;;
7597 linux) dflt='-rdynamic' ;;
7598 next) dflt='none' ;;
7599 sunos) dflt='none' ;;
7600 *) dflt='none' ;;
7601 esac ;;
7602 ' ') dflt='none' ;;
7603 *) dflt="$ccdlflags" ;;
7604 esac
7605 rp="Any special flags to pass to $cc to use dynamic linking?"
7606 . ./myread
7607 case "$ans" in
7608 none) ccdlflags=' ' ;;
7609 *) ccdlflags="$ans" ;;
7610 esac
7611 ;;
7612*) usedl="$undef"
7613 ld='ld'
7614 dlsrc='dl_none.xs'
7615 lddlflags=''
7616 ccdlflags=''
7617 ;;
7618esac
7619
7620also=''
7621case "$usedl" in
7622$undef)
7623 # No dynamic loading being used, so don't bother even to prompt.
7624 useshrplib='false'
7625 ;;
7626*) case "$useshrplib" in
7627 '') case "$osname" in
48bcfe03 7628 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7629 dflt=y
7630 also='Building a shared libperl is required for dynamic loading to work on your system.'
7631 ;;
7632 next*)
7633 case "$osvers" in
7634 4*) dflt=y
7635 also='Building a shared libperl is needed for MAB support.'
7636 ;;
7637 *) dflt=n
7638 ;;
7639 esac
7640 ;;
7641 *) dflt=n
7642 ;;
7643 esac
7644 ;;
7645 $define|true|[Yy]*)
7646 dflt=y
7647 ;;
7648 *) dflt=n
7649 ;;
7650 esac
7651 $cat << EOM
7652
7653The perl executable is normally obtained by linking perlmain.c with
7654libperl${_a}, any static extensions (usually just DynaLoader), and
7655any other libraries needed on this system (such as -lm, etc.). Since
7656your system supports dynamic loading, it is probably possible to build
7657a shared libperl.$so. If you will have more than one executable linked
7658to libperl.$so, this will significantly reduce the size of each
7659executable, but it may have a noticeable affect on performance. The
7660default is probably sensible for your system.
7661$also
7662
7663EOM
7664 rp="Build a shared libperl.$so (y/n)"
7665 . ./myread
7666 case "$ans" in
7667 true|$define|[Yy]*)
7668 useshrplib='true' ;;
7669 *) useshrplib='false' ;;
7670 esac
7671 ;;
7672esac
7673
7674case "$useshrplib" in
7675true)
7676 case "$libperl" in
7677 '')
7678 # Figure out a good name for libperl.so. Since it gets stored in
7679 # a version-specific architecture-dependent library, the version
7680 # number isn't really that important, except for making cc/ld happy.
7681 #
7682 # A name such as libperl.so.3.1
7683 majmin="libperl.$so.$patchlevel.$subversion"
7684 # A name such as libperl.so.301
7685 majonly=`echo $patchlevel $subversion |
7686 $awk '{printf "%d%02d", $1, $2}'`
7687 majonly=libperl.$so.$majonly
7688 # I'd prefer to keep the os-specific stuff here to a minimum, and
7689 # rely on figuring it out from the naming of libc.
7690 case "${osname}${osvers}" in
7691 next4*)
7692 dflt=libperl.5.$so
7693 # XXX How handle the --version stuff for MAB?
7694 ;;
7695 linux*) # ld won't link with a bare -lperl otherwise.
7696 dflt=libperl.$so
7697 ;;
b53432e4
GH
7698 cygwin*) # ld links against an importlib
7699 dflt=libperl$lib_ext
b4eb6b3d
JH
7700 ;;
7701 *) # Try to guess based on whether libc has major.minor.
7702 case "$libc" in
7703 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7704 *libc.$so.[0-9]*) dflt=$majonly ;;
7705 *) dflt=libperl.$so ;;
7706 esac
7707 ;;
7708 esac
7709 ;;
7710 *) dflt=$libperl
7711 ;;
7712 esac
7713 cat << EOM
7714
7715I need to select a good name for the shared libperl. If your system uses
7716library names with major and minor numbers, then you might want something
7717like $majmin. Alternatively, if your system uses a single version
7718number for shared libraries, then you might want to use $majonly.
7719Or, your system might be quite happy with a simple libperl.$so.
7720
7721Since the shared libperl will get installed into a version-specific
7722architecture-dependent directory, the version number of the shared perl
7723library probably isn't important, so the default should be o.k.
7724
7725EOM
7726 rp='What name do you want to give to the shared libperl?'
7727 . ./myread
7728 libperl=$ans
7729 echo "Ok, I'll use $libperl"
7730 ;;
7731*)
7732 libperl="libperl${_a}"
7733 ;;
7734esac
7735
7736# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7737case "$shrpdir" in
7738'') ;;
7739*) $cat >&4 <<EOM
7740WARNING: Use of the shrpdir variable for the installation location of
7741the shared $libperl is not supported. It was never documented and
7742will not work in this version. Let me (perlbug@perl.org)
7743know of any problems this may cause.
7744
7745EOM
7746 case "$shrpdir" in
7747 "$archlibexp/CORE")
7748 $cat >&4 <<EOM
7749But your current setting of $shrpdir is
7750the default anyway, so it's harmless.
7751EOM
7752 ;;
7753 *)
7754 $cat >&4 <<EOM
7755Further, your current attempted setting of $shrpdir
7756conflicts with the value of $archlibexp/CORE
7757that installperl will use.
7758EOM
7759 ;;
7760 esac
7761 ;;
7762esac
7763
7764# How will the perl executable find the installed shared $libperl?
7765# Add $xxx to ccdlflags.
7766# If we can't figure out a command-line option, use $shrpenv to
7767# set env LD_RUN_PATH. The main perl makefile uses this.
7768shrpdir=$archlibexp/CORE
7769xxx=''
7770tmp_shrpenv=''
7771if "$useshrplib"; then
7772 case "$osname" in
7773 aix)
7774 # We'll set it in Makefile.SH...
7775 ;;
b5b9f165 7776 solaris)
b4eb6b3d
JH
7777 xxx="-R $shrpdir"
7778 ;;
b5b9f165 7779 freebsd|netbsd)
b4eb6b3d
JH
7780 xxx="-Wl,-R$shrpdir"
7781 ;;
6b20d41b 7782 bsdos|linux|irix*|dec_osf)
b4eb6b3d
JH
7783 xxx="-Wl,-rpath,$shrpdir"
7784 ;;
7785 next)
7786 # next doesn't like the default...
7787 ;;
7788 beos)
7789 # beos doesn't like the default, either.
7790 ;;
7791 hpux*)
7792 # hpux doesn't like the default, either.
7793 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7794 ;;
7795 *)
7796 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7797 ;;
7798 esac
7799 case "$xxx" in
7800 '') ;;
7801 *)
7802 # Only add $xxx if it isn't already in ccdlflags.
7803 case " $ccdlflags " in
7804 *" $xxx "*) ;;
7805 *) ccdlflags="$ccdlflags $xxx"
7806 cat <<EOM >&4
7807
7808Adding $xxx to the flags
7809passed to $ld so that the perl executable will find the
7810installed shared $libperl.
7811
7812EOM
7813 ;;
7814 esac
7815 ;;
7816 esac
7817fi
7818# Fix ccdlflags in AIX for building external extensions.
7819# (For building Perl itself bare -bE:perl.exp is needed,
7820# Makefile.SH takes care of this.)
7821case "$osname" in
7822aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7823esac
7824# Respect a hint or command-line value.
7825case "$shrpenv" in
7826'') shrpenv="$tmp_shrpenv" ;;
7827esac
7828case "$ldlibpthname" in
7829'') ldlibpthname=LD_LIBRARY_PATH ;;
7830none) ldlibpthname='' ;;
7831esac
7832
7833: determine where manual pages are on this system
7834echo " "
7835case "$sysman" in
7836'')
4a0a3829
SD
7837 syspath='/usr/share/man/man1 /usr/man/man1'
7838 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7839 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7840 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7841 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7842 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7843 sysman=`./loc . /usr/man/man1 $syspath`
7844 ;;
7845esac
7846if $test -d "$sysman"; then
7847 echo "System manual is in $sysman." >&4
7848else
7849 echo "Could not find manual pages in source form." >&4
7850fi
7851
7852: determine where manual pages go
7853set man1dir man1dir none
7854eval $prefixit
7855$cat <<EOM
7856
7857$spackage has manual pages available in source form.
7858EOM
7859case "$nroff" in
7860nroff)
7861 echo "However, you don't have nroff, so they're probably useless to you."
7862 case "$man1dir" in
7863 '') man1dir="none";;
7864 esac;;
7865esac
7866echo "If you don't want the manual sources installed, answer 'none'."
7867case "$man1dir" in
7868' ') dflt=none
7869 ;;
7870'')
4a0a3829
SD
7871 lookpath="$prefixexp/share/man/man1"
7872 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7873 lookpath="$lookpath $prefixexp/man/p_man/man1"
7874 lookpath="$lookpath $prefixexp/man/u_man/man1"
7875 lookpath="$lookpath $prefixexp/man/man.1"
7876 case "$sysman" in
7877 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7878 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7879 esac
7880 set dflt
7881 eval $prefixup
7882 ;;
7883*) dflt="$man1dir"
7884 ;;
7885esac
7886echo " "
7887fn=dn+~
7888rp="Where do the main $spackage manual pages (source) go?"
7889. ./getfile
7890if $test "X$man1direxp" != "X$ansexp"; then
7891 installman1dir=''
7892fi
7893man1dir="$ans"
7894man1direxp="$ansexp"
7895case "$man1dir" in
7896'') man1dir=' '
7897 installman1dir='';;
7898esac
7899
7900: Change installation prefix, if necessary.
7901if $test X"$prefix" != X"$installprefix"; then
7902 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7903else
7904 installman1dir="$man1direxp"
7905fi
7906
7907: What suffix to use on installed man pages
7908
7909case "$man1dir" in
7910' ')
7911 man1ext='0'
7912 ;;
7913*)
7914 rp="What suffix should be used for the main $spackage man pages?"
7915 case "$man1ext" in
7916 '') case "$man1dir" in
7917 *1) dflt=1 ;;
7918 *1p) dflt=1p ;;
7919 *1pm) dflt=1pm ;;
7920 *l) dflt=l;;
7921 *n) dflt=n;;
7922 *o) dflt=o;;
7923 *p) dflt=p;;
7924 *C) dflt=C;;
7925 *L) dflt=L;;
7926 *L1) dflt=L1;;
7927 *) dflt=1;;
7928 esac
7929 ;;
7930 *) dflt="$man1ext";;
7931 esac
7932 . ./myread
7933 man1ext="$ans"
7934 ;;
7935esac
7936
7937: see if we can have long filenames
7938echo " "
7939first=123456789abcdef
7940$rm -f $first
7941if (echo hi >$first) 2>/dev/null; then
7942 if $test -f 123456789abcde; then
7943 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7944 val="$undef"
7945 else
7946 echo 'You can have filenames longer than 14 characters.'>&4
7947 val="$define"
7948 fi
7949else
7950 $cat <<'EOM'
7951You can't have filenames longer than 14 chars.
7952You can't even think about them!
7953EOM
7954 val="$undef"
7955fi
7956set d_flexfnam
7957eval $setvar
7958$rm -rf 123456789abcde*
7959
7960: determine where library module manual pages go
7961set man3dir man3dir none
7962eval $prefixit
7963$cat <<EOM
7964
7965$spackage has manual pages for many of the library modules.
7966EOM
7967
7968case "$nroff" in
7969nroff)
7970 $cat <<'EOM'
7971However, you don't have nroff, so they're probably useless to you.
7972EOM
7973 case "$man3dir" in
7974 '') man3dir="none";;
7975 esac;;
7976esac
7977
7978case "$d_flexfnam" in
7979undef)
7980 $cat <<'EOM'
7981However, your system can't handle the long file names like File::Basename.3.
7982EOM
7983 case "$man3dir" in
7984 '') man3dir="none";;
7985 esac;;
7986esac
7987
7988echo "If you don't want the manual sources installed, answer 'none'."
7989prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7990case "$man3dir" in
7991'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7992 if $test -d "$privlib/man/man3"; then
7993 cat <<EOM >&4
7994
7995WARNING: Previous versions of perl installed man3 pages into
7996$privlib/man/man3. This version will suggest a
7997new default of $dflt.
7998EOM
7999 tdflt=$dflt
8000 dflt='n'
8001 rp='Do you wish to preserve the old behavior?(y/n)'
8002 . ./myread
8003 case "$ans" in
8004 y*) dflt="$privlib/man/man3" ;;
8005 *) dflt=$tdflt ;;
8006 esac
8007 fi
8008 ;;
8009*) dflt="$man3dir" ;;
8010esac
8011case "$dflt" in
8012' ') dflt=none ;;
8013esac
8014echo " "
8015fn=dn+~
8016rp="Where do the $package library man pages (source) go?"
8017. ./getfile
8018man3dir="$ans"
8019man3direxp="$ansexp"
8020case "$man3dir" in
8021'') man3dir=' '
8022 installman3dir='';;
8023esac
8024
8025: Change installation prefix, if necessary.
8026if $test X"$prefix" != X"$installprefix"; then
8027 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8028else
8029 installman3dir="$man3direxp"
8030fi
8031
8032: What suffix to use on installed man pages
8033case "$man3dir" in
8034' ')
8035 man3ext='0'
8036 ;;
8037*)
8038 rp="What suffix should be used for the $package library man pages?"
8039 case "$man3ext" in
8040 '') case "$man3dir" in
8041 *3) dflt=3 ;;
8042 *3p) dflt=3p ;;
8043 *3pm) dflt=3pm ;;
8044 *l) dflt=l;;
8045 *n) dflt=n;;
8046 *o) dflt=o;;
8047 *p) dflt=p;;
8048 *C) dflt=C;;
8049 *L) dflt=L;;
8050 *L3) dflt=L3;;
8051 *) dflt=3;;
8052 esac
8053 ;;
8054 *) dflt="$man3ext";;
8055 esac
8056 . ./myread
8057 man3ext="$ans"
8058 ;;
8059esac
8060
8061: see if we have to deal with yellow pages, now NIS.
0384a54a 8062if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8063 if $test -f /usr/etc/nibindd; then
8064 echo " "
8065 echo "I'm fairly confident you're on a NeXT."
8066 echo " "
8067 rp='Do you get the hosts file via NetInfo?'
8068 dflt=y
8069 case "$hostcat" in
8070 nidump*) ;;
8071 '') ;;
8072 *) dflt=n;;
8073 esac
8074 . ./myread
8075 case "$ans" in
8076 y*) hostcat='nidump hosts .';;
8077 *) case "$hostcat" in
8078 nidump*) hostcat='';;
8079 esac
8080 ;;
8081 esac
8082 fi
8083 case "$hostcat" in
8084 nidump*) ;;
8085 *)
8086 case "$hostcat" in
8087 *ypcat*) dflt=y;;
8088 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8089 dflt=y
8090 else
8091 dflt=n
8092 fi;;
8093 *) dflt=n;;
8094 esac
8095 echo " "
8096 rp='Are you getting the hosts file via yellow pages?'
8097 . ./myread
8098 case "$ans" in
8099 y*) hostcat='ypcat hosts';;
8100 *) hostcat='cat /etc/hosts';;
8101 esac
8102 ;;
8103 esac
8104fi
8105case "$hostcat" in
8106'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8107esac
8108case "$groupcat" in
8109'') test -f /etc/group && groupcat='cat /etc/group';;
8110esac
8111case "$passcat" in
8112'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8113esac
8114
8115: now get the host name
8116echo " "
8117echo "Figuring out host name..." >&4
8118case "$myhostname" in
8119'') cont=true
8120 echo 'Maybe "hostname" will work...'
73614538 8121 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8122 myhostname=$tans
8123 phostname=hostname
8124 cont=''
8125 fi
8126 ;;
8127*) cont='';;
8128esac
8129if $test "$cont"; then
8130 if ./xenix; then
8131 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8132 if tans=`cat /etc/systemid 2>&1` ; then
8133 myhostname=$tans
8134 phostname='cat /etc/systemid'
8135 echo "Whadyaknow. Xenix always was a bit strange..."
8136 cont=''
8137 fi
8138 elif $test -r /etc/systemid; then
8139 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8140 fi
8141fi
8142if $test "$cont"; then
8143 echo 'No, maybe "uuname -l" will work...'
73614538 8144 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8145 myhostname=$tans
8146 phostname='uuname -l'
8147 else
8148 echo 'Strange. Maybe "uname -n" will work...'
73614538 8149 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8150 myhostname=$tans
8151 phostname='uname -n'
8152 else
8153 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8154 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8155 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8156 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8157 else
8158 case "$myhostname" in
8159 '') echo "Does this machine have an identity crisis or something?"
8160 phostname='';;
8161 *)
8162 echo "Well, you said $myhostname before..."
8163 phostname='echo $myhostname';;
8164 esac
8165 fi
8166 fi
8167 fi
8168fi
52a549d0
JH
8169case "$myhostname" in
8170'') myhostname=noname ;;
8171esac
b4eb6b3d
JH
8172: you do not want to know about this
8173set $myhostname
8174myhostname=$1
8175
8176: verify guess
8177if $test "$myhostname" ; then
8178 dflt=y
8179 rp='Your host name appears to be "'$myhostname'".'" Right?"
8180 . ./myread
8181 case "$ans" in
8182 y*) ;;
8183 *) myhostname='';;
8184 esac
8185fi
8186
8187: bad guess or no guess
8188while $test "X$myhostname" = X ; do
8189 dflt=''
8190 rp="Please type the (one word) name of your host:"
8191 . ./myread
8192 myhostname="$ans"
8193done
8194
8195: translate upper to lower if necessary
8196case "$myhostname" in
8197*[A-Z]*)
8198 echo "(Normalizing case in your host name)"
8199 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8200 ;;
8201esac
8202
8203case "$myhostname" in
8204*.*)
8205 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8206 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8207 echo "(Trimming domain name from host name--host name is now $myhostname)"
8208 ;;
8209*) case "$mydomain" in
8210 '')
8211 {
8212 test "X$hostcat" = "Xypcat hosts" &&
8213 ypmatch "$myhostname" hosts 2>/dev/null |\
8214 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8215 $test -s hosts
8216 } || {
8217 test "X$hostcat" != "X" &&
8218 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8219 /[ ]$myhostname[ . ]/p" > hosts
8220 }
8221 tmp_re="[ . ]"
f08cbdd1
PP
8222 if $test -f hosts; then
8223 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8224 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8225 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8226 hosts | $sort | $uniq | \
8227 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8228 case `$echo X$dflt` in
8229 X*\ *) echo "(Several hosts in the database matched hostname)"
8230 dflt=.
8231 ;;
8232 X.) echo "(You do not have fully-qualified names in the hosts database)"
8233 ;;
8234 esac
8235 else
8236 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8237 dflt=.
f08cbdd1 8238 fi
b4eb6b3d
JH
8239 case "$dflt" in
8240 .)
8241 tans=`./loc resolv.conf X /etc /usr/etc`
8242 if $test -f "$tans"; then
8243 echo "(Attempting domain name extraction from $tans)"
8244 dflt=.`$sed -n -e 's/ / /g' \
8245 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8246 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8247 case "$dflt" in
8248 .) dflt=.`$sed -n -e 's/ / /g' \
8249 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8250 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8251 ;;
8252 esac
8253 fi
8254 ;;
8255 esac
8256 case "$dflt" in
8257 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8258 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8259 case "$dflt" in
8260 '') dflt='.';;
8261 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8262 esac
8263 ;;
8264 esac
59c9e5d6
PP
8265 case "$dflt$osname" in
8266 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8267 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8268 ;;
8269 esac
b4eb6b3d
JH
8270 case "$dflt" in
8271 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8272 dflt='.nonet'
b4eb6b3d
JH
8273 ;;
8274 esac
8275 $rm -f hosts
8276 ;;
8277 *) dflt="$mydomain";;
8278 esac;;
8279esac
8280echo " "
8281rp="What is your domain name?"
8282. ./myread
8283tans="$ans"
8284case "$ans" in
8285'') ;;
8286.*) ;;
8287*) tans=".$tans";;
8288esac
8289mydomain="$tans"
8290
8291: translate upper to lower if necessary
8292case "$mydomain" in
8293*[A-Z]*)
8294 echo "(Normalizing case in your domain name)"
8295 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8296 ;;
8297esac
8298
8299: a little sanity check here
8300case "$phostname" in
8301'') ;;
8302*)
8303 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8304 $myhostname$mydomain|$myhostname) ;;
8305 *)
8306 case "$phostname" in
8307 sed*)
8308 echo "(That doesn't agree with your whoami.h file, by the way.)"
8309 ;;
8310 *)
8311 echo "(That doesn't agree with your $phostname command, by the way.)"
8312 ;;
8313 esac
8314 ;;
8315 esac
8316 ;;
8317esac
8318
8319$cat <<EOM
8320
8321I need to get your e-mail address in Internet format if possible, i.e.
8322something like user@host.domain. Please answer accurately since I have
8323no easy means to double check it. The default value provided below
8324is most probably close to reality but may not be valid from outside
8325your organization...
8326
8327EOM
8328cont=x
8329while test "$cont"; do
8330 case "$cf_email" in
8331 '') dflt="$cf_by@$myhostname$mydomain";;
8332 *) dflt="$cf_email";;
8333 esac
8334 rp='What is your e-mail address?'
8335 . ./myread
8336 cf_email="$ans"
8337 case "$cf_email" in
8338 *@*.*) cont='' ;;
8339 *)
8340 rp='Address does not look like an Internet one. Use it anyway?'
8341 case "$fastread" in
8342 yes) dflt=y ;;
8343 *) dflt=n ;;
8344 esac
8345 . ./myread
8346 case "$ans" in
8347 y*) cont='' ;;
8348 *) echo " " ;;
8349 esac
8350 ;;
8351 esac
8352done
8353
8354$cat <<EOM
8355
8356If you or somebody else will be maintaining perl at your site, please
8357fill in the correct e-mail address here so that they may be contacted
8358if necessary. Currently, the "perlbug" program included with perl
8359will send mail to this address in addition to perlbug@perl.org. You may
8360enter "none" for no administrator.
8361
8362EOM
8363case "$perladmin" in
8364'') dflt="$cf_email";;
8365*) dflt="$perladmin";;
8366esac
8367rp='Perl administrator e-mail address'
8368. ./myread
8369perladmin="$ans"
8370
674912d7
RB
8371: determine whether to only install version-specific parts.
8372echo " "
8373$cat <<EOM
8374Do you want to install only the version-specific parts of the perl
8375distribution? Usually you do *not* want to do this.
8376EOM
8377case "$versiononly" in
8378"$define"|[Yy]*|true) dflt='y' ;;
8379*) dflt='n';
8380esac
8381rp="Do you want to install only the version-specific parts of perl?"
8382. ./myread
8383case "$ans" in
8384[yY]*) val="$define";;
8385*) val="$undef" ;;
8386esac
8387set versiononly
8388eval $setvar
8389
ad493445
MB
8390case "$versiononly" in
8391"$define") inc_version_list=''
8392 inc_version_list_init=0
8393 ;;
8394esac
8395
b4eb6b3d
JH
8396: figure out how to guarantee perl startup
8397case "$startperl" in
8398'')
8399 case "$sharpbang" in
8400 *!)
8401 $cat <<EOH
8402
8403I can use the #! construct to start perl on your system. This will
8404make startup of perl scripts faster, but may cause problems if you
8405want to share those scripts and perl is not in a standard place
8406($binexp/perl) on all your platforms. The alternative is to force
8407a shell by starting the script with a single ':' character.
8408
8409EOH
674912d7
RB
8410 case "$versiononly" in
8411 "$define") dflt="$binexp/perl$version";;
8412 *) dflt="$binexp/perl";;
8413 esac
b4eb6b3d
JH
8414 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8415 . ./myread
8416 case "$ans" in
8417 none) startperl=": # use perl";;
8418 *) startperl="#!$ans"
8419 if $test 30 -lt `echo "$ans" | wc -c`; then
8420 $cat >&4 <<EOM
8421
8422WARNING: Some systems limit the #! command to 32 characters.
8423If you experience difficulty running Perl scripts with #!, try
8424installing Perl in a directory with a shorter pathname.
8425
8426EOM
8427 fi ;;
8428 esac
8429 ;;
8430 *) startperl=": # use perl"
8431 ;;
8432 esac
8433 ;;
8434esac
8435echo "I'll use $startperl to start perl scripts."
8436
8437: figure best path for perl in scripts
8438case "$perlpath" in
8439'')
5e20a8ca
RGS
8440 case "$versiononly" in
8441 "$define") perlpath="$binexp/perl$version";;
8442 *) perlpath="$binexp/perl";;
8443 esac
b4eb6b3d
JH
8444 case "$startperl" in
8445 *!*) ;;
8446 *)
8447 $cat <<EOH
8448
8449I will use the "eval 'exec'" idiom to start Perl on your system.
8450I can use the full path of your Perl binary for this purpose, but
8451doing so may cause problems if you want to share those scripts and
8452Perl is not always in a standard place ($binexp/perl).
8453
8454EOH
8455 dflt="$binexp/perl"
8456 rp="What path shall I use in \"eval 'exec'\"?"
8457 . ./myread
8458 perlpath="$ans"
8459 ;;
8460 esac
8461 ;;
8462esac
8463case "$startperl" in
8464*!*) ;;
8465*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8466esac
8467
8468: determine where public executable scripts go
8469set scriptdir scriptdir
8470eval $prefixit
8471case "$scriptdir" in
8472'')
8473 dflt="$bin"
8474 : guess some guesses
8475 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8476 $test -d /usr/share/bin && dflt=/usr/share/bin
8477 $test -d /usr/local/script && dflt=/usr/local/script
8478 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8479 $test -d $prefixexp/script && dflt=$prefixexp/script
8480 set dflt
8481 eval $prefixup
8482 ;;
8483*) dflt="$scriptdir"
8484 ;;
8485esac
8486$cat <<EOM
8487
8488Some installations have a separate directory just for executable scripts so
8489that they can mount it across multiple architectures but keep the scripts in
8490one spot. You might, for example, have a subdirectory of /usr/share for this.
8491Or you might just lump your scripts in with all your other executables.
8492
8493EOM
8494fn=d~
8495rp='Where do you keep publicly executable scripts?'
8496. ./getfile
8497if $test "X$ansexp" != "X$scriptdirexp"; then
8498 installscript=''
8499fi
8500scriptdir="$ans"
8501scriptdirexp="$ansexp"
8502: Change installation prefix, if necessary.
8503if $test X"$prefix" != X"$installprefix"; then
8504 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8505else
8506 installscript="$scriptdirexp"
8507fi
8508
8509: determine where add-on public executables go
8510case "$sitebin" in
8511'') dflt=$siteprefix/bin ;;
8512*) dflt=$sitebin ;;
8513esac
8514fn=d~
8515rp='Pathname where the add-on public executables should be installed?'
8516. ./getfile
8517sitebin="$ans"
8518sitebinexp="$ansexp"
8519: Change installation prefix, if necessary.
8520if $test X"$prefix" != X"$installprefix"; then
8521 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8522else
8523 installsitebin="$sitebinexp"
8524fi
8525
96056487
JH
8526: define an is-a-typedef? function
8527typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8528case "$inclist" in
8529"") inclist="sys/types.h";;
8530esac;
8531eval "varval=\$$var";
8532case "$varval" in
8533"")
8534 $rm -f temp.c;
8535 for inc in $inclist; do
8536 echo "#include <$inc>" >>temp.c;
8537 done;
8538 echo "#ifdef $type" >> temp.c;
8539 echo "printf(\"We have $type\");" >> temp.c;
8540 echo "#endif" >> temp.c;
8541 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8542 if $contains $type temp.E >/dev/null 2>&1; then
8543 eval "$var=\$type";
8544 else
8545 eval "$var=\$def";
8546 fi;
8547 $rm -f temp.?;;
8548*) eval "$var=\$varval";;
8549esac'
8550
8551: define an is-a-typedef? function that prompts if the type is not available.
8552typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8553case "$inclist" in
8554"") inclist="sys/types.h";;
8555esac;
8556eval "varval=\$$var";
8557case "$varval" in
8558"")
8559 $rm -f temp.c;
8560 for inc in $inclist; do
8561 echo "#include <$inc>" >>temp.c;
8562 done;
8563 echo "#ifdef $type" >> temp.c;
8564 echo "printf(\"We have $type\");" >> temp.c;
8565 echo "#endif" >> temp.c;
8566 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8567 echo " " ;
8568 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8569 if $contains $type temp.E >/dev/null 2>&1; then
8570 echo "$type found." >&4;
8571 eval "$var=\$type";
8572 else
8573 echo "$type NOT found." >&4;
8574 dflt="$def";
8575 . ./myread ;
8576 eval "$var=\$ans";
8577 fi;
8578 $rm -f temp.?;;
8579*) eval "$var=\$varval";;
8580esac'
8581
8582: see what type lseek is declared as in the kernel
8583rp="What is the type used for lseek's offset on this system?"
8584set off_t lseektype long stdio.h sys/types.h
8585eval $typedef_ask
8586
8587echo " "
8588echo "Checking to see how big your file offsets are..." >&4
8589$cat >try.c <<EOCP
8590#include <sys/types.h>
8591#include <stdio.h>
8592int main()
8593{
8594 printf("%d\n", (int)sizeof($lseektype));
8595 return(0);
8596}
8597EOCP
8598set try
8599if eval $compile_ok; then
8600 lseeksize=`$run ./try`
8601 echo "Your file offsets are $lseeksize bytes long."
8602else
8603 dflt=$longsize
8604 echo " "
8605 echo "(I can't seem to compile the test program. Guessing...)"
8606 rp="What is the size of your file offsets (in bytes)?"
8607 . ./myread
8608 lseeksize="$ans"
8609fi
8610$rm -f try.c try
8611
8612: see what type file positions are declared as in the library
8613rp="What is the type for file position used by fsetpos()?"
8614set fpos_t fpostype long stdio.h sys/types.h
8615eval $typedef_ask
8616
8617echo " "
8618case "$fpostype" in
8619*_t) zzz="$fpostype" ;;
8620*) zzz="fpos_t" ;;
8621esac
8622echo "Checking the size of $zzz..." >&4
8623cat > try.c <<EOCP
8624#include <sys/types.h>
8625#include <stdio.h>
8626int main() {
8627 printf("%d\n", (int)sizeof($fpostype));
8628 exit(0);
8629}
8630EOCP
8631set try
8632if eval $compile_ok; then
8633 yyy=`$run ./try`
8634 case "$yyy" in
8635 '') fpossize=4
8636 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8637 ;;
8638 *) fpossize=$yyy
8639 echo "Your $zzz is $fpossize bytes long."
8640 ;;
8641 esac
8642else
8643 dflt="$longsize"
8644 echo " " >&4
8645 echo "(I can't compile the test program. Guessing...)" >&4
8646 rp="What is the size of your file positions (in bytes)?"
8647 . ./myread
8648 fpossize="$ans"
8649fi
8650
8651
8652
8653# Backward compatibility (uselfs is deprecated).
8654case "$uselfs" in
8655"$define"|true|[yY]*)
8656 cat <<EOM >&4
8657
8658*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8659EOM
8660 uselargefiles="$define"
8661 ;;
8662esac
8663
8664case "$lseeksize:$fpossize" in
86658:8) cat <<EOM
8666
8667You can have files larger than 2 gigabytes.
8668EOM
8669 val="$define" ;;
8670*) case "$uselargefiles" in
8671 "$undef"|false|[nN]*) dflt='n' ;;
8672 *) dflt='y' ;;
8673 esac
8674 cat <<EOM
8675
8676Perl can be built to understand large files (files larger than 2 gigabytes)
8677on some systems. To do so, Configure can be run with -Duselargefiles.
8678
8679If this doesn't make any sense to you, just accept the default '$dflt'.
8680EOM
8681 rp='Try to understand large files, if available?'
8682 . ./myread
8683 case "$ans" in
8684 y|Y) val="$define" ;;
8685 *) val="$undef" ;;
8686 esac
8687 ;;
8688esac
8689set uselargefiles
8690eval $setvar
8691case "$uselargefiles" in
8692"$define")
8693: Look for a hint-file generated 'call-back-unit'. If the
8694: user has specified that a large files perl is to be built,
8695: we may need to set or change some other defaults.
8696 if $test -f uselargefiles.cbu; then
8697 echo "Your platform has some specific hints for large file builds, using them..."
8698 . ./uselargefiles.cbu
8699 echo " "
8700 echo "Rechecking to see how big your file offsets are..." >&4
8701 $cat >try.c <<EOCP
8702#include <sys/types.h>
8703#include <stdio.h>
8704int main()
8705{
8706 printf("%d\n", (int)sizeof($lseektype));
8707 return(0);
8708}
8709EOCP
8710 set try
8711 if eval $compile_ok; then
8712 lseeksize=`$run ./try`
8713 $echo "Your file offsets are now $lseeksize bytes long."
8714 else
8715 dflt="$lseeksize"
8716 echo " "
8717 echo "(I can't seem to compile the test program. Guessing...)"
8718 rp="What is the size of your file offsets (in bytes)?"
8719 . ./myread
8720 lseeksize="$ans"
8721 fi
8722 case "$fpostype" in
8723 *_t) zzz="$fpostype" ;;
8724 *) zzz="fpos_t" ;;
8725 esac
8726 $echo $n "Rechecking the size of $zzz...$c" >&4
8727 $cat > try.c <<EOCP
8728#include <sys/types.h>
8729#include <stdio.h>
8730int main() {
8731 printf("%d\n", (int)sizeof($fpostype));
8732 exit(0);
8733}
8734EOCP
8735 set try
8736 if eval $compile_ok; then
8737 yyy=`$run ./try`
8738 dflt="$lseeksize"
8739 case "$yyy" in
8740 '') echo " "
8741 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8742 ;;
8743 *) fpossize=$yyy
8744 echo " $fpossize bytes." >&4
8745 ;;
8746 esac
8747 else
8748 dflt="$fpossize"
8749 echo " "
8750 echo "(I can't compile the test program. Guessing...)" >&4
8751 rp="What is the size of your file positions (in bytes)?"
8752 . ./myread
8753 fpossize="$ans"
8754 fi
8755 $rm -f try.c try
8756 fi
8757 ;;
8758esac
8759
b4eb6b3d
JH
8760case "$vendorprefix" in
8761'') d_vendorbin="$undef"
8762 vendorbin=''
8763 vendorbinexp=''
8764 ;;
8765*) d_vendorbin="$define"
8766 : determine where vendor-supplied executables go.
8767 case "$vendorbin" in
8768 '') dflt=$vendorprefix/bin ;;
8769 *) dflt="$vendorbin" ;;
8770 esac
8771 fn=d~+
8772 rp='Pathname for the vendor-supplied executables directory?'
8773 . ./getfile
8774 vendorbin="$ans"
8775 vendorbinexp="$ansexp"
8776 ;;
8777esac
8778: Change installation prefix, if necessary.
8779if $test X"$prefix" != X"$installprefix"; then
8780 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8781else
8782 installvendorbin="$vendorbinexp"
8783fi
8784
8785: see if qgcvt exists
8786set qgcvt d_qgcvt
8787eval $inlibc
8788
b4eb6b3d 8789: Check how to convert floats to strings.
a5b10d80
YST
8790
8791if test "X$d_Gconvert" = X; then
8792
b4eb6b3d
JH
8793echo " "
8794echo "Checking for an efficient way to convert floats to strings."
8795echo " " > try.c
8796case "$uselongdouble" in
8797"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8798esac
8799case "$d_longdbl" in
8800"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8801esac
8802case "$d_PRIgldbl" in
8803"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8804esac
8805$cat >>try.c <<EOP
8806#ifdef TRY_gconvert
8807#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8808char *myname = "gconvert";
8809#endif
8810#ifdef TRY_gcvt
8811#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8812char *myname = "gcvt";
8813#endif
8814#ifdef TRY_qgcvt
8815#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8816char *myname = "qgcvt";
8817#define DOUBLETYPE long double
8818#endif
8819#ifdef TRY_sprintf
a5b10d80
YST
8820#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8821#ifdef HAS_PRIgldbl
b4eb6b3d
JH
8822#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8823#else
a5b10d80
YST
8824#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8825#endif
8826#else
b4eb6b3d
JH
8827#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8828#endif
8829char *myname = "sprintf";
8830#endif
8831
8832#ifndef DOUBLETYPE
8833#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8834#define DOUBLETYPE long double
8835#else
8836#define DOUBLETYPE double
8837#endif
8838#endif
8839
8840#include <stdio.h>
8841
8842#define I_STDLIB $i_stdlib
8843#ifdef I_STDLIB
8844#include <stdlib.h>
8845#endif
8846
8847int
8848checkit(expect, got)
8849char *expect;
8850char *got;
8851{
8852 if (strcmp(expect, got)) {
8853 printf("%s oddity: Expected %s, got %s\n",
8854 myname, expect, got);
8855 exit(1);
8856 }
8857}
8858
8859int main()
8860{
8861 char buf[64];
8862 buf[63] = '\0';
8863
8864 /* This must be 1st test on (which?) platform */
8865 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8866 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8867 checkit("0.1", buf);
8868
a5b10d80
YST
8869 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
8870 checkit("0.01", buf);
8871
8872 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
8873 checkit("0.001", buf);
8874
8875 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
8876 checkit("0.0001", buf);
8877
8878 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8879 if (strlen(buf) > 5)
8880 checkit("9e-005", buf); /* for Microsoft ?? */
8881 else
8882 checkit("9e-05", buf);
8883
b4eb6b3d
JH
8884 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8885 checkit("1", buf);
8886
8887 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8888 checkit("1.1", buf);
8889
8890 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8891 checkit("1.01", buf);
8892
8893 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8894 checkit("1.001", buf);
8895
8896 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8897 checkit("1.0001", buf);
8898
8899 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8900 checkit("1.00001", buf);
8901
8902 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8903 checkit("1.000001", buf);
8904
8905 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8906 checkit("0", buf);
8907
8908 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8909 checkit("-1", buf);
8910
8911 /* Some Linux gcvt's give 1.e+5 here. */
8912 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8913 checkit("100000", buf);
8914
8915 /* Some Linux gcvt's give -1.e+5 here. */
8916 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8917 checkit("-100000", buf);
8918
8919 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8920 checkit("123.456", buf);
8921
ab6ca9f4 8922 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
8923 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8924 /* 34 should be enough to scare even long double
8925 * places into using the e notation. */
ab6ca9f4 8926 if (strlen(buf) > 5)
94b339ad 8927 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 8928 else
94b339ad 8929 checkit("1e+34", buf);
8e2a5ede 8930
d1eb8299
YST
8931 /* For Perl, if you add additional tests here, also add them to
8932 * t/base/num.t for benefit of platforms not using Configure or
8933 * overriding d_Gconvert */
8934
b4eb6b3d
JH
8935 exit(0);
8936}
8937EOP
ab6ca9f4 8938: first add preferred functions to our list
a5b10d80 8939xxx_list=""
ab6ca9f4 8940for xxx_convert in $gconvert_preference; do
a5b10d80
YST
8941 case $xxx_convert in
8942 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 8943 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
8944 esac
8945done
8946: then add any others
8947for xxx_convert in gconvert gcvt sprintf; do
8948 case "$xxx_list" in
8949 *$xxx_convert*) ;;
8950 *) xxx_list="$xxx_list $xxx_convert" ;;
8951 esac
8952done
8953
8954case "$d_longdbl$uselongdouble" in
8955"$define$define")
8956 : again, add prefered functions to our list first
8957 xxx_ld_list=""
ab6ca9f4 8958 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
8959 case $xxx_convert in
8960 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 8961 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
8962 esac
8963 done
8964 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8965 for xxx_convert in qgcvt sprintf $xxx_list; do
8966 case "$xxx_ld_list" in
8967 $xxx_convert*|*" $xxx_convert"*) ;;
8968 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8969 esac
8970 done
8971 : if sprintf cannot do long doubles, move it to the end
8972 if test "$d_PRIgldbl" != "$define"; then
8973 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8974 fi
8975 : if no qgcvt, remove it
8976 if test "$d_qgcvt" != "$define"; then
8977 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8978 fi
8979 : use the ld_list
8980 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
8981 ;;
8982esac
8983
8984for xxx_convert in $xxx_list; do
8985 echo "Trying $xxx_convert..."
8986 $rm -f try try$_o
8987 set try -DTRY_$xxx_convert
8988 if eval $compile; then
8989 echo "$xxx_convert() found." >&4
5440bc8e 8990 if $run ./try; then
b4eb6b3d
JH
8991 echo "I'll use $xxx_convert to convert floats into a string." >&4
8992 break;
8993 else
8994 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 8995 xxx_convert=''
b4eb6b3d
JH
8996 fi
8997 else
8998 echo "$xxx_convert NOT found." >&4
8999 fi
9000done
ab6ca9f4 9001
a5b10d80
YST
9002if test X$xxx_convert = X; then
9003 echo "*** WHOA THERE!!! ***" >&4
9004 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9005 xxx_convert=sprintf
9006fi
9007
b4eb6b3d
JH
9008case "$xxx_convert" in
9009gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9010gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9011qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9012*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9013 "$define$define$define")
9014 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9015 "$define$define$undef")
9016 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9017 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9018 esac
9019 ;;
9020esac
9021
a5b10d80
YST
9022fi
9023
74cac757
JH
9024: see if _fwalk exists
9025set fwalk d__fwalk
9026eval $inlibc
9027
b4eb6b3d
JH
9028: Initialize h_fcntl
9029h_fcntl=false
9030
9031: Initialize h_sysfile
9032h_sysfile=false
9033
9034: access call always available on UNIX
9035set access d_access
9036eval $inlibc
9037
9038: locate the flags for 'access()'
9039case "$d_access" in
9040"$define")
9041 echo " "
9042 $cat >access.c <<'EOCP'
9043#include <sys/types.h>
9044#ifdef I_FCNTL
9045#include <fcntl.h>
9046#endif
9047#ifdef I_SYS_FILE
9048#include <sys/file.h>
9049#endif
9050#ifdef I_UNISTD
9051#include <unistd.h>
9052#endif
9053int main() {
9054 exit(R_OK);
9055}
9056EOCP
9057 : check sys/file.h first, no particular reason here
9058 if $test `./findhdr sys/file.h` && \
7a282f6d 9059 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9060 h_sysfile=true;
9061 echo "<sys/file.h> defines the *_OK access constants." >&4
9062 elif $test `./findhdr fcntl.h` && \
7a282f6d 9063 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9064 h_fcntl=true;
9065 echo "<fcntl.h> defines the *_OK access constants." >&4
9066 elif $test `./findhdr unistd.h` && \
7a282f6d 9067 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9068 echo "<unistd.h> defines the *_OK access constants." >&4
9069 else
9070 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9071 fi
9072 ;;
9073esac
9074$rm -f access*
9075
9076: see if accessx exists
9077set accessx d_accessx
9078eval $inlibc
9079
9080: see if alarm exists
9081set alarm d_alarm
9082eval $inlibc
9083
10bc17b6
JH
9084: define a fucntion to check prototypes
9085$cat > protochk <<EOSH
9086$startsh
9087cc="$cc"
9088optimize="$optimize"
9089ccflags="$ccflags"
9090prototype="$prototype"
9091define="$define"
9092rm=$rm
9093EOSH
9094
9095$cat >> protochk <<'EOSH'
9096
9097$rm -f try.c
9098foo="$1"
9099shift
9100while test $# -ge 2; do
9101 case "$1" in
9102 $define) echo "#include <$2>" >> try.c ;;
9103 literal) echo "$2" >> try.c ;;
9104 esac
9105 shift 2
9106done
9107test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9108cat >> try.c <<'EOCP'
9109#ifdef CAN_PROTOTYPE
9110#define _(args) args
9111#else
9112#define _(args) ()
9113#endif
9114EOCP
9115echo "$foo" >> try.c
9116echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9117$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9118status=$?
9119$rm -f try.[co]
9120exit $status
9121EOSH
9122chmod +x protochk
9123$eunicefix protochk
9124
a48ec845
JH
9125hasproto='varname=$1; func=$2; shift; shift;
9126while $test $# -ge 2; do
9127 case "$1" in
9128 $define) echo "#include <$2>";;
9129 esac ;
9130 shift 2;
9131done > try.c;
9132$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9133if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9134 echo "$func() prototype found.";
9135 val="$define";
9136else
9137 echo "$func() prototype NOT found.";
9138 val="$undef";
9139fi;
9140set $varname;
9141eval $setvar;
9142$rm -f try.c tryout.c'
9143
10bc17b6
JH
9144: see if sys/types.h has to be included
9145set sys/types.h i_systypes
9146eval $inhdr
9147
9148: see if sys/select.h has to be included
9149set sys/select.h i_sysselct
9150eval $inhdr
9151
9152hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9153while $test $# -ge 2; do
9154 case "$1" in
9155 $define) echo "#include <$2>";;
9156 esac ;
9157 shift 2;
9158done > try.c;
9159echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9160set try;
9161if eval $compile; then
9162 val="$define";
9163else
9164 val="$undef";
9165fi;
9166set $varname;
9167eval $setvar;
9168$rm -f try.c try.o'
9169
9170: see if we should include time.h, sys/time.h, or both
9171echo " "
9172if test "X$timeincl" = X; then
9173 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9174 $echo $n "I'm now running the test program...$c"
9175 $cat >try.c <<'EOCP'
9176#include <sys/types.h>
9177#ifdef I_TIME
9178#include <time.h>
9179#endif
9180#ifdef I_SYSTIME
9181#ifdef SYSTIMEKERNEL
9182#define KERNEL
9183#endif
9184#include <sys/time.h>
9185#endif
9186#ifdef I_SYSSELECT
9187#include <sys/select.h>
9188#endif
9189int main()
9190{
9191 struct tm foo;
9192#ifdef S_TIMEVAL
9193 struct timeval bar;
9194#endif
9195#ifdef S_TIMEZONE
9196 struct timezone tzp;
9197#endif
9198 if (foo.tm_sec == foo.tm_sec)
9199 exit(0);
9200#ifdef S_TIMEVAL
9201 if (bar.tv_sec == bar.tv_sec)
9202 exit(0);
9203#endif
9204 exit(1);
9205}
9206EOCP
9207 flags=''
9208 for s_timezone in '-DS_TIMEZONE' ''; do
9209 sysselect=''
9210 for s_timeval in '-DS_TIMEVAL' ''; do
9211 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9212 for i_time in '' '-DI_TIME'; do
9213 for i_systime in '-DI_SYSTIME' ''; do
9214 case "$flags" in
9215 '') $echo $n ".$c"
9216 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9217 if eval $compile; then
9218 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9219 shift
9220 flags="$*"
9221 echo " "
9222 $echo $n "Succeeded with $flags$c"
9223 fi
9224 ;;
9225 esac
9226 done
9227 done
9228 done
9229 done
9230 done
9231 timeincl=''
9232 echo " "
9233 case "$flags" in
9234 *SYSTIMEKERNEL*) i_systimek="$define"
9235 timeincl=`./findhdr sys/time.h`
9236 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9237 *) i_systimek="$undef";;
9238 esac
9239 case "$flags" in
9240 *I_TIME*) i_time="$define"
9241 timeincl=`./findhdr time.h`" $timeincl"
9242 echo "We'll include <time.h>." >&4;;
9243 *) i_time="$undef";;
9244 esac
9245 case "$flags" in
9246 *I_SYSTIME*) i_systime="$define"
9247 timeincl=`./findhdr sys/time.h`" $timeincl"
9248 echo "We'll include <sys/time.h>." >&4;;
9249 *) i_systime="$undef";;
9250 esac
9251 $rm -f try.c try
9252fi
9253: see if struct tm knows about tm_zone
9254case "$i_systime$i_time" in
9255*$define*)
9256 echo " "
9257 echo "Checking to see if your struct tm has tm_zone field..." >&4
9258 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9259 eval $hasfield
9260 ;;
9261*) val="$undef"
9262 set d_tm_tm_zone
9263 eval $setvar
9264 ;;
9265esac
9266case "$d_tm_tm_zone" in
9267"$define") echo "Yes, it does." ;;
9268*) echo "No, it doesn't." ;;
9269esac
9270: see if struct tm knows about tm_gmtoff
9271case "$i_systime$i_time" in
9272*$define*)
9273 echo " "
9274 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9275 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9276 eval $hasfield
9277 ;;
9278*) val="$undef"
9279 set d_tm_tm_gmtoff
9280 eval $setvar
9281 ;;
9282esac
9283case "$d_tm_tm_gmtoff" in
9284"$define") echo "Yes, it does." ;;
9285*) echo "No, it doesn't." ;;
9286esac
9287
9288: see if asctime_r exists
9289set asctime_r d_asctime_r
9290eval $inlibc
9291case "$d_asctime_r" in
9292"$define")
9293 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
90e831dc
SB
9294 case "time" in
9295 time)
9296 hdrs="$hdrs $i_systime sys/time.h"
9297 ;;
9298 esac
c18e646a
JH
9299 case "$d_asctime_r_proto:$usethreads" in
9300 ":define") d_asctime_r_proto=define
a48ec845
JH
9301 set d_asctime_r_proto asctime_r $hdrs
9302 eval $hasproto ;;
9303 *) ;;
9304 esac
9305 case "$d_asctime_r_proto" in
9306 define)
10bc17b6
JH
9307 case "$asctime_r_proto" in
9308 ''|0) try='char* asctime_r(const struct tm*, char*);'
9309 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9310 esac
9311 case "$asctime_r_proto" in
9312 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9313 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9314 esac
9315 case "$asctime_r_proto" in
9316 ''|0) try='int asctime_r(const struct tm*, char*);'
9317 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9318 esac
9319 case "$asctime_r_proto" in
9320 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9321 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9322 esac
9323 case "$asctime_r_proto" in
90e831dc 9324 ''|0) d_asctime_r=undef
10bc17b6 9325 asctime_r_proto=0
a48ec845 9326 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9327 * ) case "$asctime_r_proto" in
9328 REENTRANT_PROTO*) ;;
9329 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9330 esac
9331 echo "Prototype: $try" ;;
9332 esac
9333 ;;
c18e646a
JH
9334 *) case "$usethreads" in
9335 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9336 esac
90e831dc
SB
9337 d_asctime_r=undef
9338 asctime_r_proto=0
c18e646a 9339 ;;
a48ec845
JH
9340 esac
9341 ;;
10bc17b6
JH
9342*) asctime_r_proto=0
9343 ;;
9344esac
9345
b4eb6b3d
JH
9346: see if atolf exists
9347set atolf d_atolf
9348eval $inlibc
9349
9350: see if atoll exists
9351set atoll d_atoll
9352eval $inlibc
9353
9354: Look for GNU-cc style attribute checking
9355echo " "
9356echo "Checking whether your compiler can handle __attribute__ ..." >&4
9357$cat >attrib.c <<'EOCP'
9358#include <stdio.h>
9359void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9360EOCP
9361if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9362 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9363 echo "Your C compiler doesn't fully support __attribute__."
9364 val="$undef"
9365 else
9366 echo "Your C compiler supports __attribute__."
9367 val="$define"
9368 fi
9369else
9370 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9371 val="$undef"
9372fi
9373set d_attribut
9374eval $setvar
9375$rm -f attrib*
9376
9377: see if bcmp exists
9378set bcmp d_bcmp
9379eval $inlibc
9380
9381: see if bcopy exists
9382set bcopy d_bcopy
9383eval $inlibc
9384
9385: see if this is a unistd.h system
9386set unistd.h i_unistd
9387eval $inhdr
9388
9389: see if getpgrp exists
9390set getpgrp d_getpgrp
9391eval $inlibc
9392
9393case "$d_getpgrp" in
9394"$define")
9395 echo " "
9396 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 9397 $cat >try.c <<EOP
b4eb6b3d
JH
9398#$i_unistd I_UNISTD
9399#include <sys/types.h>
9400#ifdef I_UNISTD
9401# include <unistd.h>
9402#endif
9403int main()
9404{
9405 if (getuid() == 0) {
9406 printf("(I see you are running Configure as super-user...)\n");
9407 setuid(1);
9408 }
9409#ifdef TRY_BSD_PGRP
9410 if (getpgrp(1) == 0)
9411 exit(0);
9412#else
9413 if (getpgrp() > 0)
9414 exit(0);
9415#endif
9416 exit(1);
9417}
9418EOP
5440bc8e 9419 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9420 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9421 val="$define"
5440bc8e 9422 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9423 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9424 val="$undef"
9425 else
9426 echo "I can't seem to compile and run the test program."
9427 if ./usg; then
9428 xxx="a USG one, i.e. you use getpgrp()."
9429 else
9430 # SVR4 systems can appear rather BSD-ish.
9431 case "$i_unistd" in
9432 $undef)
9433 xxx="a BSD one, i.e. you use getpgrp(pid)."
9434 val="$define"
9435 ;;
9436 $define)
9437 xxx="probably a USG one, i.e. you use getpgrp()."
9438 val="$undef"
9439 ;;
9440 esac
9441 fi
9442 echo "Assuming your getpgrp is $xxx" >&4
9443 fi
9444 ;;
9445*) val="$undef";;
9446esac
9447set d_bsdgetpgrp
9448eval $setvar
5440bc8e 9449$rm -f try try.*
b4eb6b3d
JH
9450
9451: see if setpgrp exists
9452set setpgrp d_setpgrp
9453eval $inlibc
9454
9455case "$d_setpgrp" in
9456"$define")
9457 echo " "
9458 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 9459 $cat >try.c <<EOP
b4eb6b3d
JH
9460#$i_unistd I_UNISTD
9461#include <sys/types.h>
9462#ifdef I_UNISTD
9463# include <unistd.h>
9464#endif
9465int main()
9466{
9467 if (getuid() == 0) {
9468 printf("(I see you are running Configure as super-user...)\n");
9469 setuid(1);
9470 }
9471#ifdef TRY_BSD_PGRP
9472 if (-1 == setpgrp(1, 1))
9473 exit(0);
9474#else
9475 if (setpgrp() != -1)
9476 exit(0);
9477#endif
9478 exit(1);
9479}
9480EOP
5440bc8e 9481 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9482 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9483 val="$define"
5440bc8e 9484 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9485 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9486 val="$undef"
9487 else
9488 echo "(I can't seem to compile and run the test program.)"
9489 if ./usg; then
9490 xxx="a USG one, i.e. you use setpgrp()."
9491 else
9492 # SVR4 systems can appear rather BSD-ish.
9493 case "$i_unistd" in
9494 $undef)
9495 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9496 val="$define"
9497 ;;
9498 $define)
9499 xxx="probably a USG one, i.e. you use setpgrp()."
9500 val="$undef"
9501 ;;
9502 esac
9503 fi
9504 echo "Assuming your setpgrp is $xxx" >&4
9505 fi
9506 ;;
9507*) val="$undef";;
9508esac
9509set d_bsdsetpgrp
9510eval $setvar
5440bc8e 9511$rm -f try try.*
b4eb6b3d
JH
9512: see if bzero exists
9513set bzero d_bzero
9514eval $inlibc
9515
9516: see if signal is declared as pointer to function returning int or void
9517echo " "
9518xxx=`./findhdr signal.h`
9519$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9520if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9521 echo "You have int (*signal())() instead of void." >&4
9522 val="$undef"
9523elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9524 echo "You have void (*signal())()." >&4
9525 val="$define"
9526elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9527 echo "You have int (*signal())() instead of void." >&4
9528 val="$undef"
9529elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9530 echo "You have void (*signal())()." >&4
9531 val="$define"
9532else
9533 case "$d_voidsig" in
9534 '')
9535 echo "I can't determine whether signal handler returns void or int..." >&4
9536 dflt=void
9537 rp="What type does your signal handler return?"
9538 . ./myread
9539 case "$ans" in
9540 v*) val="$define";;
9541 *) val="$undef";;
9542 esac;;
9543 "$define")
9544 echo "As you already told me, signal handler returns void." >&4
9545 val="$define"
9546 ;;
9547 *) echo "As you already told me, signal handler returns int." >&4
9548 val="$undef"
9549 ;;
9550 esac
9551fi
9552set d_voidsig
9553eval $setvar
9554case "$d_voidsig" in
9555"$define") signal_t="void";;
9556*) signal_t="int";;
9557esac
9558$rm -f $$.tmp
9559
9560: check for ability to cast large floats to 32-bit ints.
9561echo " "
9562echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9563if $test "$intsize" -ge 4; then
9564 xxx=int
9565else
9566 xxx=long
9567fi
9568$cat >try.c <<EOCP
9569#include <stdio.h>
9570#include <sys/types.h>
9571#include <signal.h>
9572$signal_t blech(s) int s; { exit(3); }
9573int main()
9574{
9575 $xxx i32;
9576 double f, g;
9577 int result = 0;
9578 char str[16];
9579 signal(SIGFPE, blech);
9580
9581 /* Don't let compiler optimize the test away. Store the number
9582 in a writable string for gcc to pass to sscanf under HP/UX.
9583 */
9584 sprintf(str, "2147483647");
9585 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9586 g = 10 * f;
9587 i32 = ($xxx) g;
9588
9589 /* x86 processors will probably give 0x8000 0000, which is a
9590 sign change. We don't want that. We want to mimic SPARC
9591 behavior here, which is to preserve the sign and give
9592 back 0x7fff ffff.
9593 */
9594 if (i32 != ($xxx) f)
9595 result |= 1;
9596 exit(result);
9597}
9598EOCP
9599set try
9600if eval $compile_ok; then
5440bc8e 9601 $run ./try
b4eb6b3d
JH
9602 yyy=$?
9603else
9604 echo "(I can't seem to compile the test program--assuming it can't)"
9605 yyy=1
9606fi
9607case "$yyy" in
96080) val="$define"
9609 echo "Yup, it can."
9610 ;;
9611*) val="$undef"
9612 echo "Nope, it can't."
9613 ;;
9614esac
9615set d_casti32
9616eval $setvar
9617$rm -f try try.*
9618
9619: check for ability to cast negative floats to unsigned
9620echo " "
9621echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9622$cat >try.c <<EOCP
9623#include <stdio.h>
9624#include <sys/types.h>
9625#include <signal.h>
9626$signal_t blech(s) int s; { exit(7); }
9627$signal_t blech_in_list(s) int s; { exit(4); }
9628unsigned long dummy_long(p) unsigned long p; { return p; }
9629unsigned int dummy_int(p) unsigned int p; { return p; }
9630unsigned short dummy_short(p) unsigned short p; { return p; }
9631int main()
9632{
9633 double f;
9634 unsigned long along;
9635 unsigned int aint;
9636 unsigned short ashort;
9637 int result = 0;
9638 char str[16];
9639
9640 /* Frustrate gcc-2.7.2's optimizer which failed this test with
9641 a direct f = -123. assignment. gcc-2.8.0 reportedly
9642 optimized the whole file away
9643 */
9644 /* Store the number in a writable string for gcc to pass to
9645 sscanf under HP/UX.
9646 */
9647 sprintf(str, "-123");
9648 sscanf(str, "%lf", &f); /* f = -123.; */
9649
9650 signal(SIGFPE, blech);
9651 along = (unsigned long)f;
9652 aint = (unsigned int)f;
9653 ashort = (unsigned short)f;
9654 if (along != (unsigned long)-123)
9655 result |= 1;
9656 if (aint != (unsigned int)-123)
9657 result |= 1;
9658 if (ashort != (unsigned short)-123)
9659 result |= 1;
9660 sprintf(str, "1073741824.");
9661 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9662 f = f + f;
9663 along = 0;
9664 along = (unsigned long)f;
9665 if (along != 0x80000000)
9666 result |= 2;
9667 f -= 1.;
9668 along = 0;
9669 along = (unsigned long)f;
9670 if (along != 0x7fffffff)
9671 result |= 1;
9672 f += 2.;
9673 along = 0;
9674 along = (unsigned long)f;
9675 if (along != 0x80000001)
9676 result |= 2;
9677 if (result)
9678 exit(result);
9679 signal(SIGFPE, blech_in_list);
9680 sprintf(str, "123.");
9681 sscanf(str, "%lf", &f); /* f = 123.; */
9682 along = dummy_long((unsigned long)f);
9683 aint = dummy_int((unsigned int)f);
9684 ashort = dummy_short((unsigned short)f);
9685 if (along != (unsigned long)123)
9686 result |= 4;
9687 if (aint != (unsigned int)123)
9688 result |= 4;
9689 if (ashort != (unsigned short)123)
9690 result |= 4;
9691 exit(result);
9692
9693}
9694EOCP
9695set try
9696if eval $compile_ok; then
5440bc8e 9697 $run ./try
b4eb6b3d
JH
9698 castflags=$?
9699else
9700 echo "(I can't seem to compile the test program--assuming it can't)"
9701 castflags=7
9702fi
9703case "$castflags" in
97040) val="$define"
9705 echo "Yup, it can."
9706 ;;
9707*) val="$undef"
9708 echo "Nope, it can't."
9709 ;;
9710esac
9711set d_castneg
9712eval $setvar
9713$rm -f try.*
9714
9715: see if vprintf exists
9716echo " "
9717if set vprintf val -f d_vprintf; eval $csym; $val; then
9718 echo 'vprintf() found.' >&4
9719 val="$define"
5440bc8e 9720 $cat >try.c <<'EOF'
b4eb6b3d
JH
9721#include <varargs.h>
9722
9723int main() { xxx("foo"); }
9724
9725xxx(va_alist)
9726va_dcl
9727{
9728 va_list args;
9729 char buf[10];
9730
9731 va_start(args);
9732 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9733}
9734EOF
5440bc8e
JH
9735 set try
9736 if eval $compile && $run ./try; then
b4eb6b3d
JH
9737 echo "Your vsprintf() returns (int)." >&4
9738 val2="$undef"
9739 else
9740 echo "Your vsprintf() returns (char*)." >&4
9741 val2="$define"
9742 fi
9743else
9744 echo 'vprintf() NOT found.' >&4
9745 val="$undef"
9746 val2="$undef"
9747fi
5440bc8e 9748$rm -f try try.*
b4eb6b3d
JH
9749set d_vprintf
9750eval $setvar
9751val=$val2
9752set d_charvspr
9753eval $setvar
9754
9755: see if chown exists
9756set chown d_chown
9757eval $inlibc
9758
9759: see if chroot exists
9760set chroot d_chroot
9761eval $inlibc
9762
9763: see if chsize exists
9764set chsize d_chsize
9765eval $inlibc
9766
758a5d79
JH
9767: see if class exists
9768set class d_class
9769eval $inlibc
9770
4e0554ec
JH
9771hasstruct='varname=$1; struct=$2; shift; shift;
9772while $test $# -ge 2; do
9773 case "$1" in
9774 $define) echo "#include <$2>";;
9775 esac ;
9776 shift 2;
9777done > try.c;
9778echo "int main () { struct $struct foo; }" >> try.c;
9779set try;
9780if eval $compile; then
9781 val="$define";
9782else
9783 val="$undef";
9784fi;
9785set $varname;
9786eval $setvar;
9787$rm -f try.c try.o'
9788
4e0554ec
JH
9789socketlib=''
9790sockethdr=''
9791: see whether socket exists
9792echo " "
9793$echo $n "Hmm... $c" >&4
9794if set socket val -f d_socket; eval $csym; $val; then
9795 echo "Looks like you have Berkeley networking support." >&4
9796 d_socket="$define"
9797 if set setsockopt val -f; eval $csym; $val; then
9798 d_oldsock="$undef"
9799 else
9800 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9801 d_oldsock="$define"
9802 fi
9803else
9804 if $contains socklib libc.list >/dev/null 2>&1; then
9805 echo "Looks like you have Berkeley networking support." >&4
9806 d_socket="$define"
9807 : we will have to assume that it supports the 4.2 BSD interface
9808 d_oldsock="$undef"
9809 else
9810 echo "You don't have Berkeley networking in libc$_a..." >&4
9811 if test "X$d_socket" = "X$define"; then
9812 echo "...but you seem to believe that you have sockets." >&4
9813 else
9814 for net in net socket
9815 do
9816 if test -f /usr/lib/lib$net$_a; then
9817 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
9818 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9819 if $contains socket libc.list >/dev/null 2>&1; then
9820 d_socket="$define"
9821 socketlib="-l$net"
9822 case "$net" in
9823 net)
9824 echo "...but the Wollongong group seems to have hacked it in." >&4
9825 sockethdr="-I/usr/netinclude"
9826 ;;
9827 esac
3c728e00 9828 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
9829 if $contains setsockopt libc.list >/dev/null 2>&1; then
9830 d_oldsock="$undef"
9831 else
9832 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9833 d_oldsock="$define"
9834 fi
9835 break
9836 fi
9837 fi
9838 done
9839 if test "X$d_socket" != "X$define"; then
9840 echo "or anywhere else I see." >&4
9841 d_socket="$undef"
9842 d_oldsock="$undef"
9843 fi
9844 fi
9845 fi
9846fi
9847
9848: see if socketpair exists
9849set socketpair d_sockpair
9850eval $inlibc
9851
9852
9853echo " "
3c728e00 9854echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
9855for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9856 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9857 $cat >try.c <<EOF
9858#include <sys/types.h>
9859#include <sys/socket.h>
9860int main() {
9861 int i = $ENUM;
9862}
9863EOF
9864 val="$undef"
9865 set try; if eval $compile; then
9866 val="$define"
9867 fi
9868 set d_${enum}; eval $setvar
9869 $rm -f try.c try
9870done
9871
9872: see if this is a sys/uio.h system
9873set sys/uio.h i_sysuio
9874eval $inhdr
9875
9876
9877echo " "
9878echo "Checking to see if your system supports struct cmsghdr..." >&4
9879set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9880eval $hasstruct
9881case "$d_cmsghdr_s" in
9882"$define") echo "Yes, it does." ;;
9883*) echo "No, it doesn't." ;;
9884esac
9885
9886
b4eb6b3d
JH
9887: check for const keyword
9888echo " "
9889echo 'Checking to see if your C compiler knows about "const"...' >&4
9890$cat >const.c <<'EOCP'
9891typedef struct spug { int drokk; } spug;
9892int main()
9893{
9894 const char *foo;
9895 const spug y;
9896}
9897EOCP
9898if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9899 val="$define"
9900 echo "Yup, it does."
9901else
9902 val="$undef"
9903 echo "Nope, it doesn't."
9904fi
9905set d_const
9906eval $setvar
9907
9908: see if crypt exists
9909echo " "
a5a94ea5
JH
9910set crypt d_crypt
9911eval $inlibc
9912case "$d_crypt" in
9913$define) cryptlib='' ;;
9914*) if set crypt val -f d_crypt; eval $csym; $val; then
9915 echo 'crypt() found.' >&4
b4eb6b3d 9916 val="$define"
a5a94ea5
JH
9917 cryptlib=''
9918 else
9919 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9920 if $test -z "$cryptlib"; then
9921 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9922 else
9923 cryptlib=-lcrypt
9924 fi
9925 if $test -z "$cryptlib"; then
9926 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9927 else
9928 cryptlib=-lcrypt
9929 fi
9930 if $test -z "$cryptlib"; then
9931 cryptlib=`./loc libcrypt$_a "" $libpth`
9932 else
9933 cryptlib=-lcrypt
9934 fi
9935 if $test -z "$cryptlib"; then
9936 echo 'crypt() NOT found.' >&4
9937 val="$undef"
9938 else
9939 val="$define"
9940 fi
b4eb6b3d 9941 fi
a5a94ea5
JH
9942 set d_crypt
9943 eval $setvar
9944 ;;
9945esac
b4eb6b3d 9946
10bc17b6
JH
9947: see if this is a crypt.h system
9948set crypt.h i_crypt
9949eval $inhdr
9950
9951: see if crypt_r exists
9952set crypt_r d_crypt_r
9953eval $inlibc
9954case "$d_crypt_r" in
9955"$define")
9956 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
90e831dc
SB
9957 case "crypt" in
9958 time)
9959 hdrs="$hdrs $i_systime sys/time.h"
9960 ;;
9961 esac
c18e646a
JH
9962 case "$d_crypt_r_proto:$usethreads" in
9963 ":define") d_crypt_r_proto=define
a48ec845
JH
9964 set d_crypt_r_proto crypt_r $hdrs
9965 eval $hasproto ;;
9966 *) ;;
9967 esac
9968 case "$d_crypt_r_proto" in
9969 define)
10bc17b6
JH
9970 case "$crypt_r_proto" in
9971 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9972 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9973 esac
9974 case "$crypt_r_proto" in
b430fd04
JH
9975 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9976 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9977 esac
9978 case "$crypt_r_proto" in
90e831dc 9979 ''|0) d_crypt_r=undef
10bc17b6 9980 crypt_r_proto=0
a48ec845 9981 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9982 * ) case "$crypt_r_proto" in
9983 REENTRANT_PROTO*) ;;
9984 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9985 esac
9986 echo "Prototype: $try" ;;
9987 esac
9988 ;;
c18e646a
JH
9989 *) case "$usethreads" in
9990 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9991 esac
90e831dc
SB
9992 d_crypt_r=undef
9993 crypt_r_proto=0
c18e646a 9994 ;;
a48ec845
JH
9995 esac
9996 ;;
10bc17b6
JH
9997*) crypt_r_proto=0
9998 ;;
9999esac
10000
b4eb6b3d
JH
10001: get csh whereabouts
10002case "$csh" in
10003'csh') val="$undef" ;;
10004*) val="$define" ;;
10005esac
10006set d_csh
10007eval $setvar
10008: Respect a hint or command line value for full_csh.
10009case "$full_csh" in
10010'') full_csh=$csh ;;
10011esac
10012
10bc17b6
JH
10013: see if ctermid_r exists
10014set ctermid_r d_ctermid_r
10015eval $inlibc
10016case "$d_ctermid_r" in
10017"$define")
31ee0cb7 10018 hdrs="$i_systypes sys/types.h define stdio.h "
90e831dc
SB
10019 case "stdio" in
10020 time)
10021 hdrs="$hdrs $i_systime sys/time.h"
10022 ;;
10023 esac
c18e646a
JH
10024 case "$d_ctermid_r_proto:$usethreads" in
10025 ":define") d_ctermid_r_proto=define
a48ec845
JH
10026 set d_ctermid_r_proto ctermid_r $hdrs
10027 eval $hasproto ;;
10028 *) ;;
10029 esac
10030 case "$d_ctermid_r_proto" in
10031 define)
10bc17b6
JH
10032 case "$ctermid_r_proto" in
10033 ''|0) try='char* ctermid_r(char*);'
10034 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10035 esac
10036 case "$ctermid_r_proto" in
90e831dc 10037 ''|0) d_ctermid_r=undef
10bc17b6 10038 ctermid_r_proto=0
a48ec845 10039 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10040 * ) case "$ctermid_r_proto" in
10041 REENTRANT_PROTO*) ;;
10042 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10043 esac
10044 echo "Prototype: $try" ;;
10045 esac
10046 ;;
c18e646a
JH
10047 *) case "$usethreads" in
10048 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10049 esac
90e831dc
SB
10050 d_ctermid_r=undef
10051 ctermid_r_proto=0
c18e646a 10052 ;;
a48ec845
JH
10053 esac
10054 ;;
10bc17b6
JH
10055*) ctermid_r_proto=0
10056 ;;
10057esac
10058
10059: see if ctime_r exists
10060set ctime_r d_ctime_r
10061eval $inlibc
10062case "$d_ctime_r" in
10063"$define")
10064 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
90e831dc
SB
10065 case "time" in
10066 time)
10067 hdrs="$hdrs $i_systime sys/time.h"
10068 ;;
10069 esac
c18e646a
JH
10070 case "$d_ctime_r_proto:$usethreads" in
10071 ":define") d_ctime_r_proto=define
a48ec845
JH
10072 set d_ctime_r_proto ctime_r $hdrs
10073 eval $hasproto ;;
10074 *) ;;
10075 esac
10076 case "$d_ctime_r_proto" in
10077 define)
10bc17b6
JH
10078 case "$ctime_r_proto" in
10079 ''|0) try='char* ctime_r(const time_t*, char*);'
10080 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10081 esac
10082 case "$ctime_r_proto" in
10083 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10084 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10085 esac
10086 case "$ctime_r_proto" in
10087 ''|0) try='int ctime_r(const time_t*, char*);'
10088 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10089 esac
10090 case "$ctime_r_proto" in
10091 ''|0) try='int ctime_r(const time_t*, char*, int);'
10092 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10093 esac
10094 case "$ctime_r_proto" in
90e831dc 10095 ''|0) d_ctime_r=undef
10bc17b6 10096 ctime_r_proto=0
a48ec845 10097 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10098 * ) case "$ctime_r_proto" in
10099 REENTRANT_PROTO*) ;;
10100 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10101 esac
10102 echo "Prototype: $try" ;;
10103 esac
10104 ;;
c18e646a
JH
10105 *) case "$usethreads" in
10106 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10107 esac
90e831dc
SB
10108 d_ctime_r=undef
10109 ctime_r_proto=0
c18e646a 10110 ;;
a48ec845
JH
10111 esac
10112 ;;
10bc17b6
JH
10113*) ctime_r_proto=0
10114 ;;
10115esac
10116
b4eb6b3d
JH
10117: see if cuserid exists
10118set cuserid d_cuserid
10119eval $inlibc
10120
10121: see if this is a limits.h system
10122set limits.h i_limits
10123eval $inhdr
10124
10125: see if this is a float.h system
10126set float.h i_float
10127eval $inhdr
10128
10129: See if number of significant digits in a double precision number is known
10130echo " "
10131$cat >dbl_dig.c <<EOM
10132#$i_limits I_LIMITS
10133#$i_float I_FLOAT
10134#ifdef I_LIMITS
10135#include <limits.h>
10136#endif
10137#ifdef I_FLOAT
10138#include <float.h>
10139#endif
10140#ifdef DBL_DIG
10141printf("Contains DBL_DIG");
10142#endif
10143EOM
10144$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10145if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10146 echo "DBL_DIG found." >&4
10147 val="$define"
10148else
10149 echo "DBL_DIG NOT found." >&4
10150 val="$undef"
10151fi
10152$rm -f dbl_dig.?
10153set d_dbl_dig
10154eval $setvar
10155
2ef53570
JH
10156: see if dbm.h is available
10157: see if dbmclose exists
10158set dbmclose d_dbmclose
10159eval $inlibc
10160
10161case "$d_dbmclose" in
10162$define)
10163 set dbm.h i_dbm
10164 eval $inhdr
10165 case "$i_dbm" in
10166 $define)
10167 val="$undef"
10168 set i_rpcsvcdbm
10169 eval $setvar
10170 ;;
10171 *) set rpcsvc/dbm.h i_rpcsvcdbm
10172 eval $inhdr
10173 ;;
10174 esac
10175 ;;
10176*) echo "We won't be including <dbm.h>"
10177 val="$undef"
10178 set i_dbm
10179 eval $setvar
10180 val="$undef"
10181 set i_rpcsvcdbm
10182 eval $setvar
10183 ;;
10184esac
10185
10186: see if prototype for dbminit is available
10187echo " "
10188set d_dbminitproto dbminit $i_dbm dbm.h
10189eval $hasproto
10190
b4eb6b3d
JH
10191: see if difftime exists
10192set difftime d_difftime
10193eval $inlibc
10194
10195: see if this is a dirent system
10196echo " "
10197if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10198 val="$define"
10199 echo "<dirent.h> found." >&4
10200else
10201 val="$undef"
10202 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10203 echo "<sys/dir.h> found." >&4
10204 echo " "
10205 else
10206 xinc=`./findhdr sys/ndir.h`
10207 fi
10208 echo "<dirent.h> NOT found." >&4
10209fi
10210set i_dirent
10211eval $setvar
10212
10213: Look for type of directory structure.
10214echo " "
10215$cppstdin $cppflags $cppminus < "$xinc" > try.c
10216
10217case "$direntrytype" in
10218''|' ')
10219 case "$i_dirent" in
10220 $define) guess1='struct dirent' ;;
10221 *) guess1='struct direct' ;;
10222 esac
10223 ;;
10224*) guess1="$direntrytype"
10225 ;;
10226esac
10227
10228case "$guess1" in
10229'struct dirent') guess2='struct direct' ;;
10230*) guess2='struct dirent' ;;
10231esac
10232
10233if $contains "$guess1" try.c >/dev/null 2>&1; then
10234 direntrytype="$guess1"
10235 echo "Your directory entries are $direntrytype." >&4
10236elif $contains "$guess2" try.c >/dev/null 2>&1; then
10237 direntrytype="$guess2"
10238 echo "Your directory entries seem to be $direntrytype." >&4
10239else
10240 echo "I don't recognize your system's directory entries." >&4
10241 rp="What type is used for directory entries on this system?"
10242 dflt="$guess1"
10243 . ./myread
10244 direntrytype="$ans"
10245fi
10246$rm -f try.c
10247
10248
10249: see if the directory entry stores field length
10250echo " "
10251$cppstdin $cppflags $cppminus < "$xinc" > try.c
10252if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10253 echo "Good, your directory entry keeps length information in d_namlen." >&4
10254 val="$define"
10255else
10256 echo "Your directory entry does not know about the d_namlen field." >&4
10257 val="$undef"
10258fi
10259set d_dirnamlen
10260eval $setvar
10261$rm -f try.c
10262
ae0e3d3b
JH
10263: see if this is an sysdir system
10264set sys/dir.h i_sysdir
10265eval $inhdr
10266
10267: see if this is an sysndir system
10268set sys/ndir.h i_sysndir
10269eval $inhdr
10270
10271: Look for dirfd
10272echo " "
10273$cat >dirfd.c <<EOM
10274#include <stdio.h>
10275#$i_dirent I_DIRENT /**/
10276#$i_sysdir I_SYS_DIR /**/
10277#$i_sysndir I_SYS_NDIR /**/
10278#$i_systypes I_SYS_TYPES /**/
10279#if defined(I_SYS_TYPES)
10280#include <sys/types.h>
10281#endif
10282#if defined(I_DIRENT)
10283#include <dirent.h>
10284#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10285#include <sys/dir.h>
10286#endif
10287#else
10288#ifdef I_SYS_NDIR
10289#include <sys/ndir.h>
10290#else
10291#ifdef I_SYS_DIR
10292#ifdef hp9000s500
10293#include <ndir.h> /* may be wrong in the future */
10294#else
10295#include <sys/dir.h>
10296#endif
10297#endif
10298#endif
10299#endif
10300int main() {
10301 DIR *dirp = opendir(".");
10302 if (dirfd(dirp) >= 0)
10303 exit(0);
10304 else
10305 exit(1);
10306}
10307EOM
10308set dirfd
10309if eval $compile; then
10310 val="$define"
10311fi
10312case "$val" in
10313$define) echo "dirfd() found." >&4 ;;
10314*) echo "dirfd() NOT found." >&4 ;;
10315esac
10316set d_dirfd
10317eval $setvar
10318$rm -f dirfd*
10319
b4eb6b3d
JH
10320: see if dlerror exists
10321xxx_runnm="$runnm"
10322runnm=false
10323set dlerror d_dlerror
10324eval $inlibc
10325runnm="$xxx_runnm"
10326
10327: see if dlfcn is available
10328set dlfcn.h i_dlfcn
10329eval $inhdr
10330
10331case "$usedl" in
10332$define|y|true)
10333 $cat << EOM
10334
10335On a few systems, the dynamically loaded modules that perl generates and uses
10336will need a different extension than shared libs. The default will probably
10337be appropriate.
10338
10339EOM
10340 case "$dlext" in
10341 '') dflt="$so" ;;
10342 *) dflt="$dlext" ;;
10343 esac
10344 rp='What is the extension of dynamically loaded modules'
10345 . ./myread
10346 dlext="$ans"
10347 ;;
10348*)
10349 dlext="none"
10350 ;;
10351esac
10352
10353: Check if dlsym need a leading underscore
10354echo " "
10355val="$undef"
10356
10357case "$dlsrc" in
10358dl_dlopen.xs)
10359 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10360 $cat >dyna.c <<'EOM'
10361fred () { }
10362EOM
10363
10364$cat >fred.c<<EOM
10365
10366#include <stdio.h>
10367#$i_dlfcn I_DLFCN
10368#ifdef I_DLFCN
5440bc8e 10369#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
10370#else
10371#include <sys/types.h>
10372#include <nlist.h>
10373#include <link.h>
10374#endif
10375
10376extern int fred() ;
10377
10378int main()
10379{
10380 void * handle ;
10381 void * symbol ;
10382#ifndef RTLD_LAZY
10383 int mode = 1 ;
10384#else
10385 int mode = RTLD_LAZY ;
10386#endif
10387 handle = dlopen("./dyna.$dlext", mode) ;
10388 if (handle == NULL) {
10389 printf ("1\n") ;
10390 fflush (stdout) ;
10391 exit(0);
10392 }
10393 symbol = dlsym(handle, "fred") ;
10394 if (symbol == NULL) {
10395 /* try putting a leading underscore */
10396 symbol = dlsym(handle, "_fred") ;
10397 if (symbol == NULL) {
10398 printf ("2\n") ;
10399 fflush (stdout) ;
10400 exit(0);
10401 }
10402 printf ("3\n") ;
10403 }
10404 else
10405 printf ("4\n") ;
10406 fflush (stdout) ;
10407 exit(0);
10408}
10409EOM
10410 : Call the object file tmp-dyna.o in case dlext=o.
10411 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10412 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 10413 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
10414 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10415 xxx=`$run ./fred`
b4eb6b3d
JH
10416 case $xxx in
10417 1) echo "Test program failed using dlopen." >&4
10418 echo "Perhaps you should not use dynamic loading." >&4;;
10419 2) echo "Test program failed using dlsym." >&4
10420 echo "Perhaps you should not use dynamic loading." >&4;;
10421 3) echo "dlsym needs a leading underscore" >&4
10422 val="$define" ;;
10423 4) echo "dlsym doesn't need a leading underscore." >&4;;
10424 esac
10425 else
10426 echo "I can't compile and run the test program." >&4
10427 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10428 fi
10429 ;;
10430esac
10431
3c728e00 10432$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
10433
10434set d_dlsymun
10435eval $setvar
10436
10bc17b6
JH
10437: see if drand48_r exists
10438set drand48_r d_drand48_r
10439eval $inlibc
10440case "$d_drand48_r" in
10441"$define")
10442 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
90e831dc
SB
10443 case "stdlib" in
10444 time)
10445 hdrs="$hdrs $i_systime sys/time.h"
10446 ;;
10447 esac
c18e646a
JH
10448 case "$d_drand48_r_proto:$usethreads" in
10449 ":define") d_drand48_r_proto=define
a48ec845
JH
10450 set d_drand48_r_proto drand48_r $hdrs
10451 eval $hasproto ;;
10452 *) ;;
10453 esac
10454 case "$d_drand48_r_proto" in
10455 define)
10bc17b6
JH
10456 case "$drand48_r_proto" in
10457 ''|0) try='int drand48_r(struct drand48_data*, double*);'
10458 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10459 esac
10460 case "$drand48_r_proto" in
90e831dc 10461 ''|0) d_drand48_r=undef
10bc17b6 10462 drand48_r_proto=0
a48ec845 10463 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10464 * ) case "$drand48_r_proto" in
10465 REENTRANT_PROTO*) ;;
10466 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10467 esac
10468 echo "Prototype: $try" ;;
10469 esac
10470 ;;
c18e646a
JH
10471 *) case "$usethreads" in
10472 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10473 esac
90e831dc
SB
10474 d_drand48_r=undef
10475 drand48_r_proto=0
c18e646a 10476 ;;
a48ec845
JH
10477 esac
10478 ;;
10bc17b6
JH
10479*) drand48_r_proto=0
10480 ;;
10481esac
10482
10483: see if prototype for drand48 is available
10484echo " "
10485set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10486eval $hasproto
10487
b4eb6b3d
JH
10488: see if dup2 exists
10489set dup2 d_dup2
10490eval $inlibc
10491
10492: see if eaccess exists
10493set eaccess d_eaccess
10494eval $inlibc
10495
10496: see if endgrent exists
10497set endgrent d_endgrent
10498eval $inlibc
10499
10bc17b6
JH
10500: see if this is an grp system
10501set grp.h i_grp
10502eval $inhdr
10503
10504case "$i_grp" in
10505$define)
10506 xxx=`./findhdr grp.h`
10507 $cppstdin $cppflags $cppminus < $xxx >$$.h
10508
10509 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10510 val="$define"
10511 else
10512 val="$undef"
10513 fi
10514 set d_grpasswd
10515 eval $setvar
10516
10517 $rm -f $$.h
10518 ;;
10519*)
10520 val="$undef";
10521 set d_grpasswd; eval $setvar
10522 ;;
10523esac
10524
10525: see if endgrent_r exists
10526set endgrent_r d_endgrent_r
10527eval $inlibc
10528case "$d_endgrent_r" in
10529"$define")
10530 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
90e831dc
SB
10531 case "grp" in
10532 time)
10533 hdrs="$hdrs $i_systime sys/time.h"
10534 ;;
10535 esac
c18e646a
JH
10536 case "$d_endgrent_r_proto:$usethreads" in
10537 ":define") d_endgrent_r_proto=define
a48ec845
JH
10538 set d_endgrent_r_proto endgrent_r $hdrs
10539 eval $hasproto ;;
10540 *) ;;
10541 esac
10542 case "$d_endgrent_r_proto" in
10543 define)
10bc17b6
JH
10544 case "$endgrent_r_proto" in
10545 ''|0) try='int endgrent_r(FILE**);'
10546 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10547 esac
10548 case "$endgrent_r_proto" in
10549 ''|0) try='void endgrent_r(FILE**);'
10550 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10551 esac
10552 case "$endgrent_r_proto" in
90e831dc 10553 ''|0) d_endgrent_r=undef
10bc17b6 10554 endgrent_r_proto=0
a48ec845 10555 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10556 * ) case "$endgrent_r_proto" in
10557 REENTRANT_PROTO*) ;;
10558 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10559 esac
10560 echo "Prototype: $try" ;;
10561 esac
10562 ;;
c18e646a
JH
10563 *) case "$usethreads" in
10564 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10565 esac
90e831dc
SB
10566 d_endgrent_r=undef
10567 endgrent_r_proto=0
c18e646a 10568 ;;
a48ec845
JH
10569 esac
10570 ;;
10bc17b6
JH
10571*) endgrent_r_proto=0
10572 ;;
10573esac
10574
b4eb6b3d
JH
10575: see if endhostent exists
10576set endhostent d_endhent
10577eval $inlibc
10578
10bc17b6
JH
10579: see if this is a netdb.h system
10580set netdb.h i_netdb
10581eval $inhdr
10582
10583: see if endhostent_r exists
10584set endhostent_r d_endhostent_r
10585eval $inlibc
10586case "$d_endhostent_r" in
10587"$define")
10588 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
10589 case "netdb" in
10590 time)
10591 hdrs="$hdrs $i_systime sys/time.h"
10592 ;;
10593 esac
c18e646a
JH
10594 case "$d_endhostent_r_proto:$usethreads" in
10595 ":define") d_endhostent_r_proto=define
a48ec845
JH
10596 set d_endhostent_r_proto endhostent_r $hdrs
10597 eval $hasproto ;;
10598 *) ;;
10599 esac
10600 case "$d_endhostent_r_proto" in
10601 define)
10bc17b6
JH
10602 case "$endhostent_r_proto" in
10603 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 10604 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
10605 esac
10606 case "$endhostent_r_proto" in
10607 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 10608 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
10609 esac
10610 case "$endhostent_r_proto" in
90e831dc 10611 ''|0) d_endhostent_r=undef
10bc17b6 10612 endhostent_r_proto=0
a48ec845 10613 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10614 * ) case "$endhostent_r_proto" in
10615 REENTRANT_PROTO*) ;;
10616 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10617 esac
10618 echo "Prototype: $try" ;;
10619 esac
10620 ;;
c18e646a
JH
10621 *) case "$usethreads" in
10622 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10623 esac
90e831dc
SB
10624 d_endhostent_r=undef
10625 endhostent_r_proto=0
c18e646a 10626 ;;
a48ec845
JH
10627 esac
10628 ;;
10bc17b6
JH
10629*) endhostent_r_proto=0
10630 ;;
10631esac
10632
b4eb6b3d
JH
10633: see if endnetent exists
10634set endnetent d_endnent
10635eval $inlibc
10636
10bc17b6
JH
10637: see if endnetent_r exists
10638set endnetent_r d_endnetent_r
10639eval $inlibc
10640case "$d_endnetent_r" in
10641"$define")
10642 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
10643 case "netdb" in
10644 time)
10645 hdrs="$hdrs $i_systime sys/time.h"
10646 ;;
10647 esac
c18e646a
JH
10648 case "$d_endnetent_r_proto:$usethreads" in
10649 ":define") d_endnetent_r_proto=define
a48ec845
JH
10650 set d_endnetent_r_proto endnetent_r $hdrs
10651 eval $hasproto ;;
10652 *) ;;
10653 esac
10654 case "$d_endnetent_r_proto" in
10655 define)
10bc17b6
JH
10656 case "$endnetent_r_proto" in
10657 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 10658 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
10659 esac
10660 case "$endnetent_r_proto" in
10661 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 10662 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
10663 esac
10664 case "$endnetent_r_proto" in
90e831dc 10665 ''|0) d_endnetent_r=undef
10bc17b6 10666 endnetent_r_proto=0
a48ec845 10667 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10668 * ) case "$endnetent_r_proto" in
10669 REENTRANT_PROTO*) ;;
10670 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10671 esac
10672 echo "Prototype: $try" ;;
10673 esac
10674 ;;
c18e646a
JH
10675 *) case "$usethreads" in
10676 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10677 esac
90e831dc
SB
10678 d_endnetent_r=undef
10679 endnetent_r_proto=0
c18e646a 10680 ;;
a48ec845
JH
10681 esac
10682 ;;
10bc17b6
JH
10683*) endnetent_r_proto=0
10684 ;;
10685esac
10686
b4eb6b3d
JH
10687: see if endprotoent exists
10688set endprotoent d_endpent
10689eval $inlibc
10690
10bc17b6
JH
10691: see if endprotoent_r exists
10692set endprotoent_r d_endprotoent_r
10693eval $inlibc
10694case "$d_endprotoent_r" in
10695"$define")
10696 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
10697 case "netdb" in
10698 time)
10699 hdrs="$hdrs $i_systime sys/time.h"
10700 ;;
10701 esac
c18e646a
JH
10702 case "$d_endprotoent_r_proto:$usethreads" in
10703 ":define") d_endprotoent_r_proto=define
a48ec845
JH
10704 set d_endprotoent_r_proto endprotoent_r $hdrs
10705 eval $hasproto ;;
10706 *) ;;
10707 esac
10708 case "$d_endprotoent_r_proto" in
10709 define)
10bc17b6
JH
10710 case "$endprotoent_r_proto" in
10711 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 10712 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
10713 esac
10714 case "$endprotoent_r_proto" in
10715 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 10716 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
10717 esac
10718 case "$endprotoent_r_proto" in
90e831dc 10719 ''|0) d_endprotoent_r=undef
10bc17b6 10720 endprotoent_r_proto=0
a48ec845 10721 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10722 * ) case "$endprotoent_r_proto" in
10723 REENTRANT_PROTO*) ;;
10724 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10725 esac
10726 echo "Prototype: $try" ;;
10727 esac
10728 ;;
c18e646a
JH
10729 *) case "$usethreads" in
10730 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10731 esac
90e831dc
SB
10732 d_endprotoent_r=undef
10733 endprotoent_r_proto=0
c18e646a 10734 ;;
a48ec845
JH
10735 esac
10736 ;;
10bc17b6
JH
10737*) endprotoent_r_proto=0
10738 ;;
10739esac
10740
b4eb6b3d
JH
10741: see if endpwent exists
10742set endpwent d_endpwent
10743eval $inlibc
10744
10bc17b6
JH
10745: see if this is a pwd.h system
10746set pwd.h i_pwd
10747eval $inhdr
10748
10749case "$i_pwd" in
10750$define)
10751 xxx=`./findhdr pwd.h`
10752 $cppstdin $cppflags $cppminus < $xxx >$$.h
10753
10754 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10755 val="$define"
10756 else
10757 val="$undef"
10758 fi
10759 set d_pwquota
10760 eval $setvar
10761
10762 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10763 val="$define"
10764 else
10765 val="$undef"
10766 fi
10767 set d_pwage
10768 eval $setvar
10769
10770 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10771 val="$define"
10772 else
10773 val="$undef"
10774 fi
10775 set d_pwchange
10776 eval $setvar
10777
10778 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10779 val="$define"
10780 else
10781 val="$undef"
10782 fi
10783 set d_pwclass
10784 eval $setvar
10785
10786 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10787 val="$define"
10788 else
10789 val="$undef"
10790 fi
10791 set d_pwexpire
10792 eval $setvar
10793
10794 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10795 val="$define"
10796 else
10797 val="$undef"
10798 fi
10799 set d_pwcomment
10800 eval $setvar
10801
10802 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10803 val="$define"
10804 else
10805 val="$undef"
10806 fi
10807 set d_pwgecos
10808 eval $setvar
10809
10810 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10811 val="$define"
10812 else
10813 val="$undef"
10814 fi
10815 set d_pwpasswd
10816 eval $setvar
10817
10818 $rm -f $$.h
10819 ;;
10820*)
10821 val="$undef";
10822 set d_pwquota; eval $setvar
10823 set d_pwage; eval $setvar
10824 set d_pwchange; eval $setvar
10825 set d_pwclass; eval $setvar
10826 set d_pwexpire; eval $setvar
10827 set d_pwcomment; eval $setvar
10828 set d_pwgecos; eval $setvar
10829 set d_pwpasswd; eval $setvar
10830 ;;
10831esac
10832
10833: see if endpwent_r exists
10834set endpwent_r d_endpwent_r
10835eval $inlibc
10836case "$d_endpwent_r" in
10837"$define")
10838 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
90e831dc
SB
10839 case "pwd" in
10840 time)
10841 hdrs="$hdrs $i_systime sys/time.h"
10842 ;;
10843 esac
c18e646a
JH
10844 case "$d_endpwent_r_proto:$usethreads" in
10845 ":define") d_endpwent_r_proto=define
a48ec845
JH
10846 set d_endpwent_r_proto endpwent_r $hdrs
10847 eval $hasproto ;;
10848 *) ;;
10849 esac
10850 case "$d_endpwent_r_proto" in
10851 define)
10bc17b6
JH
10852 case "$endpwent_r_proto" in
10853 ''|0) try='int endpwent_r(FILE**);'
10854 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10855 esac
10856 case "$endpwent_r_proto" in
10857 ''|0) try='void endpwent_r(FILE**);'
10858 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10859 esac
10860 case "$endpwent_r_proto" in
90e831dc 10861 ''|0) d_endpwent_r=undef
10bc17b6 10862 endpwent_r_proto=0
a48ec845 10863 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10864 * ) case "$endpwent_r_proto" in
10865 REENTRANT_PROTO*) ;;
10866 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10867 esac
10868 echo "Prototype: $try" ;;
10869 esac
10870 ;;
c18e646a
JH
10871 *) case "$usethreads" in
10872 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10873 esac
90e831dc
SB
10874 d_endpwent_r=undef
10875 endpwent_r_proto=0
c18e646a 10876 ;;
a48ec845
JH
10877 esac
10878 ;;
10bc17b6
JH
10879*) endpwent_r_proto=0
10880 ;;
10881esac
10882
b4eb6b3d
JH
10883: see if endservent exists
10884set endservent d_endsent
10885eval $inlibc
10886
10bc17b6
JH
10887: see if endservent_r exists
10888set endservent_r d_endservent_r
10889eval $inlibc
10890case "$d_endservent_r" in
10891"$define")
10892 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
10893 case "netdb" in
10894 time)
10895 hdrs="$hdrs $i_systime sys/time.h"
10896 ;;
10897 esac
c18e646a
JH
10898 case "$d_endservent_r_proto:$usethreads" in
10899 ":define") d_endservent_r_proto=define
a48ec845
JH
10900 set d_endservent_r_proto endservent_r $hdrs
10901 eval $hasproto ;;
10902 *) ;;
10903 esac
10904 case "$d_endservent_r_proto" in
10905 define)
10bc17b6
JH
10906 case "$endservent_r_proto" in
10907 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 10908 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
10909 esac
10910 case "$endservent_r_proto" in
10911 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 10912 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
10913 esac
10914 case "$endservent_r_proto" in
90e831dc 10915 ''|0) d_endservent_r=undef
10bc17b6 10916 endservent_r_proto=0
a48ec845 10917 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10918 * ) case "$endservent_r_proto" in
10919 REENTRANT_PROTO*) ;;
10920 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10921 esac
10922 echo "Prototype: $try" ;;
10923 esac
10924 ;;
c18e646a
JH
10925 *) case "$usethreads" in
10926 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10927 esac
90e831dc
SB
10928 d_endservent_r=undef
10929 endservent_r_proto=0
c18e646a 10930 ;;
a48ec845
JH
10931 esac
10932 ;;
10bc17b6
JH
10933*) endservent_r_proto=0
10934 ;;
10935esac
10936
b4eb6b3d
JH
10937: Locate the flags for 'open()'
10938echo " "
5440bc8e 10939$cat >try.c <<'EOCP'
b4eb6b3d
JH
10940#include <sys/types.h>
10941#ifdef I_FCNTL
10942#include <fcntl.h>
10943#endif
10944#ifdef I_SYS_FILE
10945#include <sys/file.h>
10946#endif
10947int main() {
10948 if(O_RDONLY);
10949#ifdef O_TRUNC
10950 exit(0);
10951#else
10952 exit(1);
10953#endif
10954}
10955EOCP
10956: check sys/file.h first to get FREAD on Sun
10957if $test `./findhdr sys/file.h` && \
5440bc8e 10958 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
10959 h_sysfile=true;
10960 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 10961 if $run ./try; then
b4eb6b3d
JH
10962 echo "and you have the 3 argument form of open()." >&4
10963 val="$define"
10964 else
10965 echo "but not the 3 argument form of open(). Oh, well." >&4
10966 val="$undef"
10967 fi
10968elif $test `./findhdr fcntl.h` && \
5440bc8e 10969 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
10970 h_fcntl=true;
10971 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 10972 if $run ./try; then
b4eb6b3d
JH
10973 echo "and you have the 3 argument form of open()." >&4
10974 val="$define"
10975 else
10976 echo "but not the 3 argument form of open(). Oh, well." >&4
10977 val="$undef"
10978 fi
10979else
10980 val="$undef"
10981 echo "I can't find the O_* constant definitions! You got problems." >&4
10982fi
10983set d_open3
10984eval $setvar
5440bc8e 10985$rm -f try try.*
b4eb6b3d
JH
10986
10987: see which of string.h or strings.h is needed
10988echo " "
10989strings=`./findhdr string.h`
10990if $test "$strings" && $test -r "$strings"; then
10991 echo "Using <string.h> instead of <strings.h>." >&4
10992 val="$define"
10993else
10994 val="$undef"
10995 strings=`./findhdr strings.h`
10996 if $test "$strings" && $test -r "$strings"; then
10997 echo "Using <strings.h> instead of <string.h>." >&4
10998 else
10999 echo "No string header found -- You'll surely have problems." >&4
11000 fi
11001fi
11002set i_string
11003eval $setvar
11004case "$i_string" in
11005"$undef") strings=`./findhdr strings.h`;;
11006*) strings=`./findhdr string.h`;;
11007esac
11008
3c728e00
JH
11009: see if this is a sys/file.h system
11010val=''
11011set sys/file.h val
11012eval $inhdr
11013
11014: do we need to include sys/file.h ?
11015case "$val" in
11016"$define")
11017 echo " "
11018 if $h_sysfile; then
11019 val="$define"
11020 echo "We'll be including <sys/file.h>." >&4
11021 else
11022 val="$undef"
11023 echo "We won't be including <sys/file.h>." >&4
11024 fi
11025 ;;
11026*)
11027 h_sysfile=false
11028 ;;
11029esac
11030set i_sysfile
11031eval $setvar
11032
11033: see if fcntl.h is there
11034val=''
11035set fcntl.h val
11036eval $inhdr
11037
11038: see if we can include fcntl.h
11039case "$val" in
11040"$define")
11041 echo " "
11042 if $h_fcntl; then
11043 val="$define"
11044 echo "We'll be including <fcntl.h>." >&4
11045 else
11046 val="$undef"
11047 if $h_sysfile; then
11048 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11049 else
11050 echo "We won't be including <fcntl.h>." >&4
11051 fi
11052 fi
11053 ;;
11054*)
11055 h_fcntl=false
11056 val="$undef"
11057 ;;
11058esac
11059set i_fcntl
11060eval $setvar
11061
b4eb6b3d
JH
11062: check for non-blocking I/O stuff
11063case "$h_sysfile" in
a0acbdc3
JH
11064true) echo "#include <sys/file.h>" > head.c;;
11065*)
11066 case "$h_fcntl" in
11067 true) echo "#include <fcntl.h>" > head.c;;
11068 *) echo "#include <sys/fcntl.h>" > head.c;;
11069 esac
11070 ;;
b4eb6b3d
JH
11071esac
11072echo " "
11073echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11074case "$o_nonblock" in
11075'')
11076 $cat head.c > try.c
3c728e00 11077 $cat >>try.c <<EOCP
b4eb6b3d 11078#include <stdio.h>
80b3ef99 11079#include <stdlib.h>
3c728e00
JH
11080#$i_fcntl I_FCNTL
11081#ifdef I_FCNTL
11082#include <fcntl.h>
11083#endif
b4eb6b3d
JH
11084int main() {
11085#ifdef O_NONBLOCK
11086 printf("O_NONBLOCK\n");
11087 exit(0);
11088#endif
11089#ifdef O_NDELAY
11090 printf("O_NDELAY\n");
11091 exit(0);
11092#endif
11093#ifdef FNDELAY
11094 printf("FNDELAY\n");
11095 exit(0);
11096#endif
11097 exit(0);
11098}
11099EOCP
11100 set try
11101 if eval $compile_ok; then
5440bc8e 11102 o_nonblock=`$run ./try`
b4eb6b3d
JH
11103 case "$o_nonblock" in
11104 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11105 *) echo "Seems like we can use $o_nonblock.";;
11106 esac
11107 else
11108 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11109 fi
11110 ;;
11111*) echo "Using $hint value $o_nonblock.";;
11112esac
11113$rm -f try try.* .out core
11114
11115echo " "
11116echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11117case "$eagain" in
11118'')
11119 $cat head.c > try.c
11120 $cat >>try.c <<EOCP
11121#include <errno.h>
11122#include <sys/types.h>
11123#include <signal.h>
11124#include <stdio.h>
80b3ef99 11125#include <stdlib.h>
1deb0a86
JH
11126#$i_fcntl I_FCNTL
11127#ifdef I_FCNTL
11128#include <fcntl.h>
11129#endif
b4eb6b3d
JH
11130#define MY_O_NONBLOCK $o_nonblock
11131#ifndef errno /* XXX need better Configure test */
11132extern int errno;
11133#endif
11134#$i_unistd I_UNISTD
11135#ifdef I_UNISTD
11136#include <unistd.h>
11137#endif
11138#$i_string I_STRING
11139#ifdef I_STRING
11140#include <string.h>
11141#else
11142#include <strings.h>
11143#endif
11144$signal_t blech(x) int x; { exit(3); }
11145EOCP
11146 $cat >> try.c <<'EOCP'
11147int main()
11148{
11149 int pd[2];
11150 int pu[2];
11151 char buf[1];
11152 char string[100];
11153
11154 pipe(pd); /* Down: child -> parent */
11155 pipe(pu); /* Up: parent -> child */
11156 if (0 != fork()) {
11157 int ret;
11158 close(pd[1]); /* Parent reads from pd[0] */
11159 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11160#ifdef F_SETFL
b4eb6b3d
JH
11161 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11162 exit(1);
a0acbdc3
JH
11163#else
11164 exit(4);
11165#endif
b4eb6b3d
JH
11166 signal(SIGALRM, blech);
11167 alarm(5);
11168 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11169 exit(2);
11170 sprintf(string, "%d\n", ret);
11171 write(2, string, strlen(string));
11172 alarm(0);
11173#ifdef EAGAIN
11174 if (errno == EAGAIN) {
11175 printf("EAGAIN\n");
11176 goto ok;
11177 }
11178#endif
11179#ifdef EWOULDBLOCK
11180 if (errno == EWOULDBLOCK)
11181 printf("EWOULDBLOCK\n");
11182#endif
11183 ok:
11184 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11185 sleep(2); /* Give it time to close our pipe */
11186 alarm(5);
11187 ret = read(pd[0], buf, 1); /* Should read EOF */
11188 alarm(0);
11189 sprintf(string, "%d\n", ret);
868439a2 11190 write(4, string, strlen(string));
b4eb6b3d
JH
11191 exit(0);
11192 }
11193
11194 close(pd[0]); /* We write to pd[1] */
11195 close(pu[1]); /* We read from pu[0] */
11196 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11197 close(pd[1]); /* Pipe pd is now fully closed! */
11198 exit(0); /* Bye bye, thank you for playing! */
11199}
11200EOCP
11201 set try
11202 if eval $compile_ok; then
11203 echo "$startsh" >mtry
868439a2 11204 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11205 chmod +x mtry
11206 ./mtry >/dev/null 2>&1
11207 case $? in
11208 0) eagain=`$cat try.out`;;
11209 1) echo "Could not perform non-blocking setting!";;
11210 2) echo "I did a successful read() for something that was not there!";;
11211 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11212 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11213 *) echo "Something terribly wrong happened during testing.";;
11214 esac
11215 rd_nodata=`$cat try.ret`
11216 echo "A read() system call with no data present returns $rd_nodata."
11217 case "$rd_nodata" in
11218 0|-1) ;;
11219 *)
11220 echo "(That's peculiar, fixing that to be -1.)"
11221 rd_nodata=-1
11222 ;;
11223 esac
11224 case "$eagain" in
11225 '')
11226 echo "Forcing errno EAGAIN on read() with no data available."
11227 eagain=EAGAIN
11228 ;;
11229 *)
11230 echo "Your read() sets errno to $eagain when no data is available."
11231 ;;
11232 esac
11233 status=`$cat try.err`
11234 case "$status" in
11235 0) echo "And it correctly returns 0 to signal EOF.";;
11236 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11237 *) echo "However, your read() returns '$status' on EOF??";;
11238 esac
11239 val="$define"
11240 if test "$status" = "$rd_nodata"; then
11241 echo "WARNING: you can't distinguish between EOF and no data!"
11242 val="$undef"
11243 fi
11244 else
11245 echo "I can't compile the test program--assuming errno EAGAIN will do."
11246 eagain=EAGAIN
11247 fi
11248 set d_eofnblk
11249 eval $setvar
11250 ;;
11251*)
11252 echo "Using $hint value $eagain."
11253 echo "Your read() returns $rd_nodata when no data is present."
11254 case "$d_eofnblk" in
11255 "$define") echo "And you can see EOF because read() returns 0.";;
11256 "$undef") echo "But you can't see EOF status from read() returned value.";;
11257 *)
11258 echo "(Assuming you can't see EOF status from read anyway.)"
11259 d_eofnblk=$undef
11260 ;;
11261 esac
11262 ;;
11263esac
11264$rm -f try try.* .out core head.c mtry
11265
b363b713
JH
11266: see if fchdir exists
11267set fchdir d_fchdir
11268eval $inlibc
11269
b4eb6b3d
JH
11270: see if fchmod exists
11271set fchmod d_fchmod
11272eval $inlibc
11273
11274: see if fchown exists
11275set fchown d_fchown
11276eval $inlibc
11277
11278: see if this is an fcntl system
11279set fcntl d_fcntl
11280eval $inlibc
11281
9d9004a9
AD
11282echo " "
11283: See if fcntl-based locking works.
832492ee 11284$cat >try.c <<EOCP
9d9004a9
AD
11285#include <stdlib.h>
11286#include <unistd.h>
11287#include <fcntl.h>
832492ee 11288#include <signal.h>
832492ee 11289$signal_t blech(x) int x; { exit(3); }
9d9004a9
AD
11290int main() {
11291#if defined(F_SETLK) && defined(F_SETLKW)
11292 struct flock flock;
11293 int retval, fd;
11294 fd = open("try.c", O_RDONLY);
11295 flock.l_type = F_RDLCK;
11296 flock.l_whence = SEEK_SET;
11297 flock.l_start = flock.l_len = 0;
832492ee
JH
11298 signal(SIGALRM, blech);
11299 alarm(10);
9d9004a9
AD
11300 retval = fcntl(fd, F_SETLK, &flock);
11301 close(fd);
11302 (retval < 0 ? exit(2) : exit(0));
11303#else
11304 exit(2);
11305#endif
11306}
11307EOCP
11308echo "Checking if fcntl-based file locking works... "
11309case "$d_fcntl" in
11310"$define")
11311 set try
11312 if eval $compile_ok; then
5440bc8e 11313 if $run ./try; then
9d9004a9
AD
11314 echo "Yes, it seems to work."
11315 val="$define"
11316 else
11317 echo "Nope, it didn't work."
11318 val="$undef"
832492ee
JH
11319 case "$?" in
11320 3) $cat >&4 <<EOM
11321***
11322*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11323*** This is (almost) impossible.
11324*** If your NFS lock daemons are not feeling well, something like
11325*** this may happen, please investigate. Cannot continue, aborting.
11326***
11327EOM
11328 exit 1
11329 ;;
11330 esac
9d9004a9
AD
11331 fi
11332 else
11333 echo "I'm unable to compile the test program, so I'll assume not."
11334 val="$undef"
11335 fi
11336 ;;
11337*) val="$undef";
11338 echo "Nope, since you don't even have fcntl()."
11339 ;;
11340esac
11341set d_fcntl_can_lock
11342eval $setvar
11343$rm -f try*
11344
11345
b4eb6b3d
JH
11346: check for fd_set items
11347$cat <<EOM
11348
11349Checking to see how well your C compiler handles fd_set and friends ...
11350EOM
5440bc8e 11351$cat >try.c <<EOCP
b4eb6b3d
JH
11352#$i_systime I_SYS_TIME
11353#$i_sysselct I_SYS_SELECT
11354#$d_socket HAS_SOCKET
11355#include <sys/types.h>
11356#ifdef HAS_SOCKET
11357#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11358#endif
11359#ifdef I_SYS_TIME
11360#include <sys/time.h>
11361#endif
11362#ifdef I_SYS_SELECT
11363#include <sys/select.h>
11364#endif
11365int main() {
11366 fd_set fds;
11367
11368#ifdef TRYBITS
11369 if(fds.fds_bits);
11370#endif
11371
11372#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11373 exit(0);
11374#else
11375 exit(1);
11376#endif
11377}
11378EOCP
5440bc8e 11379set try -DTRYBITS
b4eb6b3d
JH
11380if eval $compile; then
11381 d_fds_bits="$define"
11382 d_fd_set="$define"
11383 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 11384 if $run ./try; then
b4eb6b3d
JH
11385 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11386 d_fd_macros="$define"
11387 else
11388 $cat >&4 <<'EOM'
11389but not the normal fd_set macros! Gaaack! I'll have to cover for you.
11390EOM
11391 d_fd_macros="$undef"
11392 fi
11393else
11394 $cat <<'EOM'
11395Hmm, your compiler has some difficulty with fd_set. Checking further...
11396EOM
5440bc8e 11397 set try
b4eb6b3d
JH
11398 if eval $compile; then
11399 d_fds_bits="$undef"
11400 d_fd_set="$define"
11401 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 11402 if $run ./try; then
b4eb6b3d
JH
11403 echo "and you have the normal fd_set macros." >&4
11404 d_fd_macros="$define"
11405 else
11406 $cat <<'EOM'
11407but not the normal fd_set macros! Gross! More work for me...
11408EOM
11409 d_fd_macros="$undef"
11410 fi
11411 else
11412 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
11413 d_fd_set="$undef"
11414 d_fds_bits="$undef"
11415 d_fd_macros="$undef"
11416 fi
11417fi
5440bc8e 11418$rm -f try try.*
b4eb6b3d
JH
11419
11420: see if fgetpos exists
11421set fgetpos d_fgetpos
11422eval $inlibc
11423
758a5d79
JH
11424: see if finite exists
11425set finite d_finite
11426eval $inlibc
11427
11428: see if finitel exists
11429set finitel d_finitel
11430eval $inlibc
11431
b4eb6b3d
JH
11432: see if flock exists
11433set flock d_flock
11434eval $inlibc
11435
2ef53570
JH
11436: see if prototype for flock is available
11437echo " "
11438set d_flockproto flock $i_sysfile sys/file.h
11439eval $hasproto
11440
b4eb6b3d
JH
11441: see if fork exists
11442set fork d_fork
11443eval $inlibc
11444
758a5d79
JH
11445: see if fp_class exists
11446set fp_class d_fp_class
11447eval $inlibc
11448
b4eb6b3d
JH
11449: see if pathconf exists
11450set pathconf d_pathconf
11451eval $inlibc
11452
11453: see if fpathconf exists
11454set fpathconf d_fpathconf
11455eval $inlibc
11456
758a5d79
JH
11457: see if fpclass exists
11458set fpclass d_fpclass
11459eval $inlibc
11460
11461: see if fpclassify exists
11462set fpclassify d_fpclassify
11463eval $inlibc
11464
11465: see if fpclassl exists
11466set fpclassl d_fpclassl
11467eval $inlibc
11468
b4eb6b3d
JH
11469
11470: check for fpos64_t
11471echo " "
11472echo "Checking to see if you have fpos64_t..." >&4
11473$cat >try.c <<EOCP
11474#include <stdio.h>
11475int main() { fpos64_t x = 7; }
11476EOCP
11477set try
11478if eval $compile; then
11479 val="$define"
11480 echo "You have fpos64_t."
11481else
11482 val="$undef"
11483 echo "You do not have fpos64_t."
11484 case "$fpossize" in
11485 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11486 esac
11487fi
11488$rm -f try.* try
11489set d_fpos64_t
11490eval $setvar
11491
11492: see if frexpl exists
11493set frexpl d_frexpl
11494eval $inlibc
11495
b4eb6b3d
JH
11496: see if this is a sys/param system
11497set sys/param.h i_sysparam
11498eval $inhdr
11499
11500: see if this is a sys/mount.h system
11501set sys/mount.h i_sysmount
11502eval $inhdr
11503
b4eb6b3d
JH
11504
11505echo " "
11506echo "Checking to see if your system supports struct fs_data..." >&4
11507set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11508eval $hasstruct
11509case "$d_fs_data_s" in
11510"$define") echo "Yes, it does." ;;
11511*) echo "No, it doesn't." ;;
11512esac
11513
11514: see if fseeko exists
11515set fseeko d_fseeko
11516eval $inlibc
11517case "$longsize" in
115188) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11519esac
11520
11521: see if fsetpos exists
11522set fsetpos d_fsetpos
11523eval $inlibc
11524
11525
11526: see if fstatfs exists
11527set fstatfs d_fstatfs
11528eval $inlibc
11529
11530
11531: see if statvfs exists
11532set statvfs d_statvfs
11533eval $inlibc
11534
11535: see if fstatvfs exists
11536set fstatvfs d_fstatvfs
11537eval $inlibc
11538
11539
411ab01c
JH
11540: see if fsync exists
11541set fsync d_fsync
11542eval $inlibc
11543
b4eb6b3d
JH
11544: see if ftello exists
11545set ftello d_ftello
11546eval $inlibc
11547case "$longsize" in
115488) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11549esac
11550
11551: see if getcwd exists
11552set getcwd d_getcwd
11553eval $inlibc
11554
11555: see if getespwnam exists
11556set getespwnam d_getespwnam
11557eval $inlibc
11558
11559
11560: see if getfsstat exists
11561set getfsstat d_getfsstat
11562eval $inlibc
11563
11564: see if getgrent exists
11565set getgrent d_getgrent
11566eval $inlibc
11567
10bc17b6
JH
11568: see if getgrent_r exists
11569set getgrent_r d_getgrent_r
11570eval $inlibc
11571case "$d_getgrent_r" in
11572"$define")
11573 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
90e831dc
SB
11574 case "grp" in
11575 time)
11576 hdrs="$hdrs $i_systime sys/time.h"
11577 ;;
11578 esac
c18e646a
JH
11579 case "$d_getgrent_r_proto:$usethreads" in
11580 ":define") d_getgrent_r_proto=define
a48ec845
JH
11581 set d_getgrent_r_proto getgrent_r $hdrs
11582 eval $hasproto ;;
11583 *) ;;
11584 esac
11585 case "$d_getgrent_r_proto" in
11586 define)
10bc17b6
JH
11587 case "$getgrent_r_proto" in
11588 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11589 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11590 esac
11591 case "$getgrent_r_proto" in
11592 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11593 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11594 esac
11595 case "$getgrent_r_proto" in
11596 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11597 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11598 esac
11599 case "$getgrent_r_proto" in
11600 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11601 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11602 esac
11603 case "$getgrent_r_proto" in
11604 ''|0) try='int getgrent_r(struct group*, char*, int);'
11605 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11606 esac
11607 case "$getgrent_r_proto" in
11608 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11609 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11610 esac
11611 case "$getgrent_r_proto" in
90e831dc 11612 ''|0) d_getgrent_r=undef
10bc17b6 11613 getgrent_r_proto=0
a48ec845 11614 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11615 * ) case "$getgrent_r_proto" in
11616 REENTRANT_PROTO*) ;;
11617 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11618 esac
11619 echo "Prototype: $try" ;;
11620 esac
11621 ;;
c18e646a
JH
11622 *) case "$usethreads" in
11623 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11624 esac
90e831dc
SB
11625 d_getgrent_r=undef
11626 getgrent_r_proto=0
c18e646a 11627 ;;
a48ec845
JH
11628 esac
11629 ;;
10bc17b6
JH
11630*) getgrent_r_proto=0
11631 ;;
11632esac
11633
11634: see if getgrgid_r exists
11635set getgrgid_r d_getgrgid_r
11636eval $inlibc
11637case "$d_getgrgid_r" in
11638"$define")
11639 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
90e831dc
SB
11640 case "grp" in
11641 time)
11642 hdrs="$hdrs $i_systime sys/time.h"
11643 ;;
11644 esac
c18e646a
JH
11645 case "$d_getgrgid_r_proto:$usethreads" in
11646 ":define") d_getgrgid_r_proto=define
a48ec845
JH
11647 set d_getgrgid_r_proto getgrgid_r $hdrs
11648 eval $hasproto ;;
11649 *) ;;
11650 esac
11651 case "$d_getgrgid_r_proto" in
11652 define)
10bc17b6
JH
11653 case "$getgrgid_r_proto" in
11654 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11655 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11656 esac
11657 case "$getgrgid_r_proto" in
11658 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11659 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11660 esac
11661 case "$getgrgid_r_proto" in
11662 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11663 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11664 esac
11665 case "$getgrgid_r_proto" in
11666 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11667 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11668 esac
11669 case "$getgrgid_r_proto" in
90e831dc 11670 ''|0) d_getgrgid_r=undef
10bc17b6 11671 getgrgid_r_proto=0
a48ec845 11672 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11673 * ) case "$getgrgid_r_proto" in
11674 REENTRANT_PROTO*) ;;
11675 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11676 esac
11677 echo "Prototype: $try" ;;
11678 esac
11679 ;;
c18e646a
JH
11680 *) case "$usethreads" in
11681 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11682 esac
90e831dc
SB
11683 d_getgrgid_r=undef
11684 getgrgid_r_proto=0
c18e646a 11685 ;;
a48ec845
JH
11686 esac
11687 ;;
10bc17b6
JH
11688*) getgrgid_r_proto=0
11689 ;;
11690esac
11691
11692: see if getgrnam_r exists
11693set getgrnam_r d_getgrnam_r
11694eval $inlibc
11695case "$d_getgrnam_r" in
11696"$define")
11697 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
90e831dc
SB
11698 case "grp" in
11699 time)
11700 hdrs="$hdrs $i_systime sys/time.h"
11701 ;;
11702 esac
c18e646a
JH
11703 case "$d_getgrnam_r_proto:$usethreads" in
11704 ":define") d_getgrnam_r_proto=define
a48ec845
JH
11705 set d_getgrnam_r_proto getgrnam_r $hdrs
11706 eval $hasproto ;;
11707 *) ;;
11708 esac
11709 case "$d_getgrnam_r_proto" in
11710 define)
10bc17b6
JH
11711 case "$getgrnam_r_proto" in
11712 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11713 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11714 esac
11715 case "$getgrnam_r_proto" in
11716 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11717 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11718 esac
11719 case "$getgrnam_r_proto" in
11720 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11721 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11722 esac
11723 case "$getgrnam_r_proto" in
11724 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11725 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11726 esac
11727 case "$getgrnam_r_proto" in
11728 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11729 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11730 esac
11731 case "$getgrnam_r_proto" in
90e831dc 11732 ''|0) d_getgrnam_r=undef
10bc17b6 11733 getgrnam_r_proto=0
a48ec845 11734 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11735 * ) case "$getgrnam_r_proto" in
11736 REENTRANT_PROTO*) ;;
11737 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11738 esac
11739 echo "Prototype: $try" ;;
11740 esac
11741 ;;
c18e646a
JH
11742 *) case "$usethreads" in
11743 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11744 esac
90e831dc
SB
11745 d_getgrnam_r=undef
11746 getgrnam_r_proto=0
c18e646a 11747 ;;
a48ec845
JH
11748 esac
11749 ;;
10bc17b6
JH
11750*) getgrnam_r_proto=0
11751 ;;
11752esac
11753
b4eb6b3d
JH
11754: see if gethostbyaddr exists
11755set gethostbyaddr d_gethbyaddr
11756eval $inlibc
11757
11758: see if gethostbyname exists
11759set gethostbyname d_gethbyname
11760eval $inlibc
11761
11762: see if gethostent exists
11763set gethostent d_gethent
11764eval $inlibc
11765
11766: see how we will look up host name
11767echo " "
11768call=''
11769if set gethostname val -f d_gethname; eval $csym; $val; then
11770 echo 'gethostname() found.' >&4
11771 d_gethname="$define"
11772 call=gethostname
11773fi
11774if set uname val -f d_uname; eval $csym; $val; then
11775 if ./xenix; then
11776 $cat <<'EOM'
11777uname() was found, but you're running xenix, and older versions of xenix
11778have a broken uname(). If you don't really know whether your xenix is old
11779enough to have a broken system call, use the default answer.
11780
11781EOM
11782 dflt=y
11783 case "$d_uname" in
11784 "$define") dflt=n;;
11785 esac
11786 rp='Is your uname() broken?'
11787 . ./myread
11788 case "$ans" in
11789 n*) d_uname="$define"; call=uname;;
11790 esac
11791 else
11792 echo 'uname() found.' >&4
11793 d_uname="$define"
11794 case "$call" in
11795 '') call=uname ;;
11796 esac
11797 fi
11798fi
11799case "$d_gethname" in
11800'') d_gethname="$undef";;
11801esac
11802case "$d_uname" in
11803'') d_uname="$undef";;
11804esac
11805case "$d_uname$d_gethname" in
11806*define*)
11807 dflt=n
11808 cat <<EOM
11809
11810Every now and then someone has a $call() that lies about the hostname
11811but can't be fixed for political or economic reasons. If you wish, I can
11812pretend $call() isn't there and maybe compute hostname at run-time
11813thanks to the '$phostname' command.
11814
11815EOM
11816 rp="Shall I ignore $call() from now on?"
11817 . ./myread
11818 case "$ans" in
11819 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11820 esac;;
11821esac
11822case "$phostname" in
11823'') aphostname='';;
11824*) case "$aphostname" in
11825 /*) ;;
11826 *) set X $phostname
11827 shift
11828 file=$1
11829 shift
11830 file=`./loc $file $file $pth`
11831 aphostname=`echo $file $*`
11832 ;;
11833 esac
11834 ;;
11835esac
11836case "$d_uname$d_gethname" in
11837*define*) ;;
11838*)
11839 case "$phostname" in
11840 '')
11841 echo "There will be no way for $package to get your hostname." >&4;;
11842 *)
11843 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11844 ;;
11845 esac;;
11846esac
11847case "$d_phostname" in
11848'') d_phostname="$undef";;
11849esac
11850
10bc17b6
JH
11851: see if gethostbyaddr_r exists
11852set gethostbyaddr_r d_gethostbyaddr_r
11853eval $inlibc
11854case "$d_gethostbyaddr_r" in
11855"$define")
11856 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
11857 case "netdb" in
11858 time)
11859 hdrs="$hdrs $i_systime sys/time.h"
11860 ;;
11861 esac
c18e646a
JH
11862 case "$d_gethostbyaddr_r_proto:$usethreads" in
11863 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
11864 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11865 eval $hasproto ;;
11866 *) ;;
11867 esac
11868 case "$d_gethostbyaddr_r_proto" in
11869 define)
10bc17b6
JH
11870 case "$gethostbyaddr_r_proto" in
11871 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11872 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11873 esac
11874 case "$gethostbyaddr_r_proto" in
11875 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11876 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11877 esac
11878 case "$gethostbyaddr_r_proto" in
11879 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11880 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11881 esac
11882 case "$gethostbyaddr_r_proto" in
11883 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11884 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11885 esac
11886 case "$gethostbyaddr_r_proto" in
11887 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11888 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11889 esac
11890 case "$gethostbyaddr_r_proto" in
11891 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11892 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11893 esac
11894 case "$gethostbyaddr_r_proto" in
11895 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11896 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11897 esac
11898 case "$gethostbyaddr_r_proto" in
11899 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11900 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11901 esac
11902 case "$gethostbyaddr_r_proto" in
11903 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11904 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11905 esac
11906 case "$gethostbyaddr_r_proto" in
11907 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11908 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11909 esac
11910 case "$gethostbyaddr_r_proto" in
90e831dc 11911 ''|0) d_gethostbyaddr_r=undef
10bc17b6 11912 gethostbyaddr_r_proto=0
a48ec845 11913 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11914 * ) case "$gethostbyaddr_r_proto" in
11915 REENTRANT_PROTO*) ;;
11916 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11917 esac
11918 echo "Prototype: $try" ;;
11919 esac
11920 ;;
c18e646a
JH
11921 *) case "$usethreads" in
11922 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11923 esac
90e831dc
SB
11924 d_gethostbyaddr_r=undef
11925 gethostbyaddr_r_proto=0
c18e646a 11926 ;;
a48ec845
JH
11927 esac
11928 ;;
10bc17b6
JH
11929*) gethostbyaddr_r_proto=0
11930 ;;
11931esac
11932
11933: see if gethostbyname_r exists
11934set gethostbyname_r d_gethostbyname_r
11935eval $inlibc
11936case "$d_gethostbyname_r" in
11937"$define")
11938 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
11939 case "netdb" in
11940 time)
11941 hdrs="$hdrs $i_systime sys/time.h"
11942 ;;
11943 esac
c18e646a
JH
11944 case "$d_gethostbyname_r_proto:$usethreads" in
11945 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
11946 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11947 eval $hasproto ;;
11948 *) ;;
11949 esac
11950 case "$d_gethostbyname_r_proto" in
11951 define)
10bc17b6
JH
11952 case "$gethostbyname_r_proto" in
11953 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11954 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11955 esac
11956 case "$gethostbyname_r_proto" in
11957 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11958 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11959 esac
11960 case "$gethostbyname_r_proto" in
11961 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11962 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11963 esac
11964 case "$gethostbyname_r_proto" in
90e831dc 11965 ''|0) d_gethostbyname_r=undef
10bc17b6 11966 gethostbyname_r_proto=0
a48ec845 11967 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11968 * ) case "$gethostbyname_r_proto" in
11969 REENTRANT_PROTO*) ;;
11970 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11971 esac
11972 echo "Prototype: $try" ;;
11973 esac
11974 ;;
c18e646a
JH
11975 *) case "$usethreads" in
11976 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11977 esac
90e831dc
SB
11978 d_gethostbyname_r=undef
11979 gethostbyname_r_proto=0
c18e646a 11980 ;;
a48ec845
JH
11981 esac
11982 ;;
10bc17b6
JH
11983*) gethostbyname_r_proto=0
11984 ;;
11985esac
11986
11987: see if gethostent_r exists
11988set gethostent_r d_gethostent_r
11989eval $inlibc
11990case "$d_gethostent_r" in
11991"$define")
11992 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
11993 case "netdb" in
11994 time)
11995 hdrs="$hdrs $i_systime sys/time.h"
11996 ;;
11997 esac
c18e646a
JH
11998 case "$d_gethostent_r_proto:$usethreads" in
11999 ":define") d_gethostent_r_proto=define
a48ec845
JH
12000 set d_gethostent_r_proto gethostent_r $hdrs
12001 eval $hasproto ;;
12002 *) ;;
12003 esac
12004 case "$d_gethostent_r_proto" in
12005 define)
10bc17b6
JH
12006 case "$gethostent_r_proto" in
12007 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12008 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12009 esac
12010 case "$gethostent_r_proto" in
12011 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12012 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12013 esac
12014 case "$gethostent_r_proto" in
12015 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12016 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12017 esac
12018 case "$gethostent_r_proto" in
12019 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12020 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12021 esac
12022 case "$gethostent_r_proto" in
12023 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12024 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12025 esac
12026 case "$gethostent_r_proto" in
12027 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12028 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12029 esac
12030 case "$gethostent_r_proto" in
90e831dc 12031 ''|0) d_gethostent_r=undef
10bc17b6 12032 gethostent_r_proto=0
a48ec845 12033 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12034 * ) case "$gethostent_r_proto" in
12035 REENTRANT_PROTO*) ;;
12036 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12037 esac
12038 echo "Prototype: $try" ;;
12039 esac
12040 ;;
c18e646a
JH
12041 *) case "$usethreads" in
12042 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12043 esac
90e831dc
SB
12044 d_gethostent_r=undef
12045 gethostent_r_proto=0
c18e646a 12046 ;;
a48ec845
JH
12047 esac
12048 ;;
10bc17b6
JH
12049*) gethostent_r_proto=0
12050 ;;
12051esac
b4eb6b3d
JH
12052
12053: see if prototypes for various gethostxxx netdb.h functions are available
12054echo " "
12055set d_gethostprotos gethostent $i_netdb netdb.h
12056eval $hasproto
12057
4e0554ec
JH
12058: see if getitimer exists
12059set getitimer d_getitimer
12060eval $inlibc
12061
b4eb6b3d
JH
12062: see if getlogin exists
12063set getlogin d_getlogin
12064eval $inlibc
12065
10bc17b6
JH
12066: see if getlogin_r exists
12067set getlogin_r d_getlogin_r
12068eval $inlibc
12069case "$d_getlogin_r" in
12070"$define")
12071 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
90e831dc
SB
12072 case "unistd" in
12073 time)
12074 hdrs="$hdrs $i_systime sys/time.h"
12075 ;;
12076 esac
c18e646a
JH
12077 case "$d_getlogin_r_proto:$usethreads" in
12078 ":define") d_getlogin_r_proto=define
a48ec845
JH
12079 set d_getlogin_r_proto getlogin_r $hdrs
12080 eval $hasproto ;;
12081 *) ;;
12082 esac
12083 case "$d_getlogin_r_proto" in
12084 define)
10bc17b6
JH
12085 case "$getlogin_r_proto" in
12086 ''|0) try='int getlogin_r(char*, size_t);'
12087 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12088 esac
12089 case "$getlogin_r_proto" in
12090 ''|0) try='int getlogin_r(char*, int);'
12091 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12092 esac
12093 case "$getlogin_r_proto" in
12094 ''|0) try='char* getlogin_r(char*, size_t);'
12095 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12096 esac
12097 case "$getlogin_r_proto" in
12098 ''|0) try='char* getlogin_r(char*, int);'
12099 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12100 esac
12101 case "$getlogin_r_proto" in
90e831dc 12102 ''|0) d_getlogin_r=undef
10bc17b6 12103 getlogin_r_proto=0
a48ec845 12104 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12105 * ) case "$getlogin_r_proto" in
12106 REENTRANT_PROTO*) ;;
12107 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12108 esac
12109 echo "Prototype: $try" ;;
12110 esac
12111 ;;
c18e646a
JH
12112 *) case "$usethreads" in
12113 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12114 esac
90e831dc
SB
12115 d_getlogin_r=undef
12116 getlogin_r_proto=0
c18e646a 12117 ;;
a48ec845
JH
12118 esac
12119 ;;
10bc17b6
JH
12120*) getlogin_r_proto=0
12121 ;;
12122esac
12123
b4eb6b3d
JH
12124: see if getmnt exists
12125set getmnt d_getmnt
12126eval $inlibc
12127
12128: see if getmntent exists
12129set getmntent d_getmntent
12130eval $inlibc
12131
12132: see if getnetbyaddr exists
12133set getnetbyaddr d_getnbyaddr
12134eval $inlibc
12135
12136: see if getnetbyname exists
12137set getnetbyname d_getnbyname
12138eval $inlibc
12139
12140: see if getnetent exists
12141set getnetent d_getnent
12142eval $inlibc
12143
10bc17b6
JH
12144: see if getnetbyaddr_r exists
12145set getnetbyaddr_r d_getnetbyaddr_r
12146eval $inlibc
12147case "$d_getnetbyaddr_r" in
12148"$define")
12149 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12150 case "netdb" in
12151 time)
12152 hdrs="$hdrs $i_systime sys/time.h"
12153 ;;
12154 esac
c18e646a
JH
12155 case "$d_getnetbyaddr_r_proto:$usethreads" in
12156 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
12157 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12158 eval $hasproto ;;
12159 *) ;;
12160 esac
12161 case "$d_getnetbyaddr_r_proto" in
12162 define)
10bc17b6
JH
12163 case "$getnetbyaddr_r_proto" in
12164 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12165 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12166 esac
12167 case "$getnetbyaddr_r_proto" in
12168 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12169 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12170 esac
12171 case "$getnetbyaddr_r_proto" in
12172 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12173 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12174 esac
12175 case "$getnetbyaddr_r_proto" in
12176 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12177 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12178 esac
12179 case "$getnetbyaddr_r_proto" in
12180 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12181 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12182 esac
12183 case "$getnetbyaddr_r_proto" in
12184 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12185 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12186 esac
12187 case "$getnetbyaddr_r_proto" in
12188 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12189 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12190 esac
12191 case "$getnetbyaddr_r_proto" in
90e831dc 12192 ''|0) d_getnetbyaddr_r=undef
10bc17b6 12193 getnetbyaddr_r_proto=0
a48ec845 12194 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12195 * ) case "$getnetbyaddr_r_proto" in
12196 REENTRANT_PROTO*) ;;
12197 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12198 esac
12199 echo "Prototype: $try" ;;
12200 esac
12201 ;;
c18e646a
JH
12202 *) case "$usethreads" in
12203 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12204 esac
90e831dc
SB
12205 d_getnetbyaddr_r=undef
12206 getnetbyaddr_r_proto=0
c18e646a 12207 ;;
a48ec845
JH
12208 esac
12209 ;;
10bc17b6
JH
12210*) getnetbyaddr_r_proto=0
12211 ;;
12212esac
12213
12214: see if getnetbyname_r exists
12215set getnetbyname_r d_getnetbyname_r
12216eval $inlibc
12217case "$d_getnetbyname_r" in
12218"$define")
12219 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12220 case "netdb" in
12221 time)
12222 hdrs="$hdrs $i_systime sys/time.h"
12223 ;;
12224 esac
c18e646a
JH
12225 case "$d_getnetbyname_r_proto:$usethreads" in
12226 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
12227 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12228 eval $hasproto ;;
12229 *) ;;
12230 esac
12231 case "$d_getnetbyname_r_proto" in
12232 define)
10bc17b6
JH
12233 case "$getnetbyname_r_proto" in
12234 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12235 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12236 esac
12237 case "$getnetbyname_r_proto" in
12238 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12239 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12240 esac
12241 case "$getnetbyname_r_proto" in
12242 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12243 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12244 esac
12245 case "$getnetbyname_r_proto" in
12246 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12247 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12248 esac
12249 case "$getnetbyname_r_proto" in
90e831dc 12250 ''|0) d_getnetbyname_r=undef
10bc17b6 12251 getnetbyname_r_proto=0
a48ec845 12252 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12253 * ) case "$getnetbyname_r_proto" in
12254 REENTRANT_PROTO*) ;;
12255 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12256 esac
12257 echo "Prototype: $try" ;;
12258 esac
12259 ;;
c18e646a
JH
12260 *) case "$usethreads" in
12261 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12262 esac
90e831dc
SB
12263 d_getnetbyname_r=undef
12264 getnetbyname_r_proto=0
c18e646a 12265 ;;
a48ec845
JH
12266 esac
12267 ;;
10bc17b6
JH
12268*) getnetbyname_r_proto=0
12269 ;;
12270esac
12271
12272: see if getnetent_r exists
12273set getnetent_r d_getnetent_r
12274eval $inlibc
12275case "$d_getnetent_r" in
12276"$define")
12277 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12278 case "netdb" in
12279 time)
12280 hdrs="$hdrs $i_systime sys/time.h"
12281 ;;
12282 esac
c18e646a
JH
12283 case "$d_getnetent_r_proto:$usethreads" in
12284 ":define") d_getnetent_r_proto=define
a48ec845
JH
12285 set d_getnetent_r_proto getnetent_r $hdrs
12286 eval $hasproto ;;
12287 *) ;;
12288 esac
12289 case "$d_getnetent_r_proto" in
12290 define)
10bc17b6
JH
12291 case "$getnetent_r_proto" in
12292 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12293 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12294 esac
12295 case "$getnetent_r_proto" in
12296 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12297 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12298 esac
12299 case "$getnetent_r_proto" in
12300 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12301 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12302 esac
12303 case "$getnetent_r_proto" in
12304 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12305 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12306 esac
12307 case "$getnetent_r_proto" in
12308 ''|0) try='int getnetent_r(struct netent*, char*, int);'
12309 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12310 esac
12311 case "$getnetent_r_proto" in
12312 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12313 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12314 esac
12315 case "$getnetent_r_proto" in
90e831dc 12316 ''|0) d_getnetent_r=undef
10bc17b6 12317 getnetent_r_proto=0
a48ec845 12318 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12319 * ) case "$getnetent_r_proto" in
12320 REENTRANT_PROTO*) ;;
12321 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12322 esac
12323 echo "Prototype: $try" ;;
12324 esac
12325 ;;
c18e646a
JH
12326 *) case "$usethreads" in
12327 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12328 esac
90e831dc
SB
12329 d_getnetent_r=undef
12330 getnetent_r_proto=0
c18e646a 12331 ;;
a48ec845
JH
12332 esac
12333 ;;
10bc17b6
JH
12334*) getnetent_r_proto=0
12335 ;;
12336esac
12337
b4eb6b3d
JH
12338: see if prototypes for various getnetxxx netdb.h functions are available
12339echo " "
12340set d_getnetprotos getnetent $i_netdb netdb.h
12341eval $hasproto
12342
0c0643d0
JH
12343: see if getpagesize exists
12344set getpagesize d_getpagsz
12345eval $inlibc
12346
b4eb6b3d
JH
12347
12348: see if getprotobyname exists
12349set getprotobyname d_getpbyname
12350eval $inlibc
12351
12352: see if getprotobynumber exists
12353set getprotobynumber d_getpbynumber
12354eval $inlibc
12355
12356: see if getprotoent exists
12357set getprotoent d_getpent
12358eval $inlibc
12359
12360: see if getpgid exists
12361set getpgid d_getpgid
12362eval $inlibc
12363
12364: see if getpgrp2 exists
12365set getpgrp2 d_getpgrp2
12366eval $inlibc
12367
12368: see if getppid exists
12369set getppid d_getppid
12370eval $inlibc
12371
12372: see if getpriority exists
12373set getpriority d_getprior
12374eval $inlibc
12375
10bc17b6
JH
12376: see if getprotobyname_r exists
12377set getprotobyname_r d_getprotobyname_r
12378eval $inlibc
12379case "$d_getprotobyname_r" in
12380"$define")
12381 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12382 case "netdb" in
12383 time)
12384 hdrs="$hdrs $i_systime sys/time.h"
12385 ;;
12386 esac
c18e646a
JH
12387 case "$d_getprotobyname_r_proto:$usethreads" in
12388 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
12389 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12390 eval $hasproto ;;
12391 *) ;;
12392 esac
12393 case "$d_getprotobyname_r_proto" in
12394 define)
10bc17b6
JH
12395 case "$getprotobyname_r_proto" in
12396 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12397 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12398 esac
12399 case "$getprotobyname_r_proto" in
12400 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12401 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12402 esac
12403 case "$getprotobyname_r_proto" in
12404 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12405 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12406 esac
12407 case "$getprotobyname_r_proto" in
90e831dc 12408 ''|0) d_getprotobyname_r=undef
10bc17b6 12409 getprotobyname_r_proto=0
a48ec845 12410 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12411 * ) case "$getprotobyname_r_proto" in
12412 REENTRANT_PROTO*) ;;
12413 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12414 esac
12415 echo "Prototype: $try" ;;
12416 esac
12417 ;;
c18e646a
JH
12418 *) case "$usethreads" in
12419 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12420 esac
90e831dc
SB
12421 d_getprotobyname_r=undef
12422 getprotobyname_r_proto=0
c18e646a 12423 ;;
a48ec845
JH
12424 esac
12425 ;;
10bc17b6
JH
12426*) getprotobyname_r_proto=0
12427 ;;
12428esac
12429
12430: see if getprotobynumber_r exists
12431set getprotobynumber_r d_getprotobynumber_r
12432eval $inlibc
12433case "$d_getprotobynumber_r" in
12434"$define")
12435 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12436 case "netdb" in
12437 time)
12438 hdrs="$hdrs $i_systime sys/time.h"
12439 ;;
12440 esac
c18e646a
JH
12441 case "$d_getprotobynumber_r_proto:$usethreads" in
12442 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
12443 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12444 eval $hasproto ;;
12445 *) ;;
12446 esac
12447 case "$d_getprotobynumber_r_proto" in
12448 define)
10bc17b6
JH
12449 case "$getprotobynumber_r_proto" in
12450 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12451 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12452 esac
12453 case "$getprotobynumber_r_proto" in
12454 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12455 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12456 esac
12457 case "$getprotobynumber_r_proto" in
12458 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12459 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12460 esac
12461 case "$getprotobynumber_r_proto" in
90e831dc 12462 ''|0) d_getprotobynumber_r=undef
10bc17b6 12463 getprotobynumber_r_proto=0
a48ec845 12464 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12465 * ) case "$getprotobynumber_r_proto" in
12466 REENTRANT_PROTO*) ;;
12467 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12468 esac
12469 echo "Prototype: $try" ;;
12470 esac
12471 ;;
c18e646a
JH
12472 *) case "$usethreads" in
12473 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12474 esac
90e831dc
SB
12475 d_getprotobynumber_r=undef
12476 getprotobynumber_r_proto=0
c18e646a 12477 ;;
a48ec845
JH
12478 esac
12479 ;;
10bc17b6
JH
12480*) getprotobynumber_r_proto=0
12481 ;;
12482esac
12483
12484: see if getprotoent_r exists
12485set getprotoent_r d_getprotoent_r
12486eval $inlibc
12487case "$d_getprotoent_r" in
12488"$define")
12489 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12490 case "netdb" in
12491 time)
12492 hdrs="$hdrs $i_systime sys/time.h"
12493 ;;
12494 esac
c18e646a
JH
12495 case "$d_getprotoent_r_proto:$usethreads" in
12496 ":define") d_getprotoent_r_proto=define
a48ec845
JH
12497 set d_getprotoent_r_proto getprotoent_r $hdrs
12498 eval $hasproto ;;
12499 *) ;;
12500 esac
12501 case "$d_getprotoent_r_proto" in
12502 define)
10bc17b6
JH
12503 case "$getprotoent_r_proto" in
12504 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12505 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12506 esac
12507 case "$getprotoent_r_proto" in
12508 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12509 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12510 esac
12511 case "$getprotoent_r_proto" in
12512 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12513 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12514 esac
12515 case "$getprotoent_r_proto" in
12516 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12517 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12518 esac
12519 case "$getprotoent_r_proto" in
90e831dc 12520 ''|0) d_getprotoent_r=undef
10bc17b6 12521 getprotoent_r_proto=0
a48ec845 12522 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12523 * ) case "$getprotoent_r_proto" in
12524 REENTRANT_PROTO*) ;;
12525 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12526 esac
12527 echo "Prototype: $try" ;;
12528 esac
12529 ;;
c18e646a
JH
12530 *) case "$usethreads" in
12531 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12532 esac
90e831dc
SB
12533 d_getprotoent_r=undef
12534 getprotoent_r_proto=0
c18e646a 12535 ;;
a48ec845
JH
12536 esac
12537 ;;
10bc17b6
JH
12538*) getprotoent_r_proto=0
12539 ;;
12540esac
12541
b4eb6b3d
JH
12542: see if prototypes for various getprotoxxx netdb.h functions are available
12543echo " "
12544set d_getprotoprotos getprotoent $i_netdb netdb.h
12545eval $hasproto
12546
12547: see if getprpwnam exists
12548set getprpwnam d_getprpwnam
12549eval $inlibc
12550
12551: see if getpwent exists
12552set getpwent d_getpwent
12553eval $inlibc
12554
10bc17b6
JH
12555: see if getpwent_r exists
12556set getpwent_r d_getpwent_r
12557eval $inlibc
12558case "$d_getpwent_r" in
12559"$define")
12560 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
90e831dc
SB
12561 case "pwd" in
12562 time)
12563 hdrs="$hdrs $i_systime sys/time.h"
12564 ;;
12565 esac
c18e646a
JH
12566 case "$d_getpwent_r_proto:$usethreads" in
12567 ":define") d_getpwent_r_proto=define
a48ec845
JH
12568 set d_getpwent_r_proto getpwent_r $hdrs
12569 eval $hasproto ;;
12570 *) ;;
12571 esac
12572 case "$d_getpwent_r_proto" in
12573 define)
10bc17b6
JH
12574 case "$getpwent_r_proto" in
12575 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12576 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12577 esac
12578 case "$getpwent_r_proto" in
12579 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12580 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12581 esac
12582 case "$getpwent_r_proto" in
12583 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12584 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12585 esac
12586 case "$getpwent_r_proto" in
12587 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12588 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12589 esac
12590 case "$getpwent_r_proto" in
12591 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12592 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12593 esac
12594 case "$getpwent_r_proto" in
12595 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12596 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12597 esac
12598 case "$getpwent_r_proto" in
90e831dc 12599 ''|0) d_getpwent_r=undef
10bc17b6 12600 getpwent_r_proto=0
a48ec845 12601 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12602 * ) case "$getpwent_r_proto" in
12603 REENTRANT_PROTO*) ;;
12604 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12605 esac
12606 echo "Prototype: $try" ;;
12607 esac
12608 ;;
c18e646a
JH
12609 *) case "$usethreads" in
12610 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12611 esac
90e831dc
SB
12612 d_getpwent_r=undef
12613 getpwent_r_proto=0
c18e646a 12614 ;;
a48ec845
JH
12615 esac
12616 ;;
10bc17b6
JH
12617*) getpwent_r_proto=0
12618 ;;
12619esac
12620
12621: see if getpwnam_r exists
12622set getpwnam_r d_getpwnam_r
12623eval $inlibc
12624case "$d_getpwnam_r" in
12625"$define")
12626 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
90e831dc
SB
12627 case "pwd" in
12628 time)
12629 hdrs="$hdrs $i_systime sys/time.h"
12630 ;;
12631 esac
c18e646a
JH
12632 case "$d_getpwnam_r_proto:$usethreads" in
12633 ":define") d_getpwnam_r_proto=define
a48ec845
JH
12634 set d_getpwnam_r_proto getpwnam_r $hdrs
12635 eval $hasproto ;;
12636 *) ;;
12637 esac
12638 case "$d_getpwnam_r_proto" in
12639 define)
10bc17b6
JH
12640 case "$getpwnam_r_proto" in
12641 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12642 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12643 esac
12644 case "$getpwnam_r_proto" in
12645 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12646 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12647 esac
12648 case "$getpwnam_r_proto" in
12649 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12650 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12651 esac
12652 case "$getpwnam_r_proto" in
12653 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12654 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12655 esac
12656 case "$getpwnam_r_proto" in
90e831dc 12657 ''|0) d_getpwnam_r=undef
10bc17b6 12658 getpwnam_r_proto=0
a48ec845 12659 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12660 * ) case "$getpwnam_r_proto" in
12661 REENTRANT_PROTO*) ;;
12662 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12663 esac
12664 echo "Prototype: $try" ;;
12665 esac
12666 ;;
c18e646a
JH
12667 *) case "$usethreads" in
12668 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12669 esac
90e831dc
SB
12670 d_getpwnam_r=undef
12671 getpwnam_r_proto=0
c18e646a 12672 ;;
a48ec845
JH
12673 esac
12674 ;;
10bc17b6
JH
12675*) getpwnam_r_proto=0
12676 ;;
12677esac
12678
12679: see if getpwuid_r exists
12680set getpwuid_r d_getpwuid_r
12681eval $inlibc
12682case "$d_getpwuid_r" in
12683"$define")
12684 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
90e831dc
SB
12685 case "pwd" in
12686 time)
12687 hdrs="$hdrs $i_systime sys/time.h"
12688 ;;
12689 esac
c18e646a
JH
12690 case "$d_getpwuid_r_proto:$usethreads" in
12691 ":define") d_getpwuid_r_proto=define
a48ec845
JH
12692 set d_getpwuid_r_proto getpwuid_r $hdrs
12693 eval $hasproto ;;
12694 *) ;;
12695 esac
12696 case "$d_getpwuid_r_proto" in
12697 define)
10bc17b6
JH
12698 case "$getpwuid_r_proto" in
12699 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12700 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12701 esac
12702 case "$getpwuid_r_proto" in
12703 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12704 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12705 esac
12706 case "$getpwuid_r_proto" in
12707 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12708 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12709 esac
12710 case "$getpwuid_r_proto" in
12711 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12712 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12713 esac
12714 case "$getpwuid_r_proto" in
90e831dc 12715 ''|0) d_getpwuid_r=undef
10bc17b6 12716 getpwuid_r_proto=0
a48ec845 12717 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12718 * ) case "$getpwuid_r_proto" in
12719 REENTRANT_PROTO*) ;;
12720 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12721 esac
12722 echo "Prototype: $try" ;;
12723 esac
12724 ;;
c18e646a
JH
12725 *) case "$usethreads" in
12726 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12727 esac
90e831dc
SB
12728 d_getpwuid_r=undef
12729 getpwuid_r_proto=0
c18e646a 12730 ;;
a48ec845
JH
12731 esac
12732 ;;
10bc17b6
JH
12733*) getpwuid_r_proto=0
12734 ;;
12735esac
12736
b4eb6b3d
JH
12737
12738: see if getservbyname exists
12739set getservbyname d_getsbyname
12740eval $inlibc
12741
12742: see if getservbyport exists
12743set getservbyport d_getsbyport
12744eval $inlibc
12745
12746: see if getservent exists
12747set getservent d_getsent
12748eval $inlibc
12749
10bc17b6
JH
12750: see if getservbyname_r exists
12751set getservbyname_r d_getservbyname_r
12752eval $inlibc
12753case "$d_getservbyname_r" in
12754"$define")
12755 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12756 case "netdb" in
12757 time)
12758 hdrs="$hdrs $i_systime sys/time.h"
12759 ;;
12760 esac
c18e646a
JH
12761 case "$d_getservbyname_r_proto:$usethreads" in
12762 ":define") d_getservbyname_r_proto=define
a48ec845
JH
12763 set d_getservbyname_r_proto getservbyname_r $hdrs
12764 eval $hasproto ;;
12765 *) ;;
12766 esac
12767 case "$d_getservbyname_r_proto" in
12768 define)
10bc17b6
JH
12769 case "$getservbyname_r_proto" in
12770 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12771 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12772 esac
12773 case "$getservbyname_r_proto" in
12774 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12775 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12776 esac
12777 case "$getservbyname_r_proto" in
12778 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12779 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12780 esac
12781 case "$getservbyname_r_proto" in
90e831dc 12782 ''|0) d_getservbyname_r=undef
10bc17b6 12783 getservbyname_r_proto=0
a48ec845 12784 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12785 * ) case "$getservbyname_r_proto" in
12786 REENTRANT_PROTO*) ;;
12787 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12788 esac
12789 echo "Prototype: $try" ;;
12790 esac
12791 ;;
c18e646a
JH
12792 *) case "$usethreads" in
12793 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12794 esac
90e831dc
SB
12795 d_getservbyname_r=undef
12796 getservbyname_r_proto=0
c18e646a 12797 ;;
a48ec845
JH
12798 esac
12799 ;;
10bc17b6
JH
12800*) getservbyname_r_proto=0
12801 ;;
12802esac
12803
12804: see if getservbyport_r exists
12805set getservbyport_r d_getservbyport_r
12806eval $inlibc
12807case "$d_getservbyport_r" in
12808"$define")
12809 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12810 case "netdb" in
12811 time)
12812 hdrs="$hdrs $i_systime sys/time.h"
12813 ;;
12814 esac
c18e646a
JH
12815 case "$d_getservbyport_r_proto:$usethreads" in
12816 ":define") d_getservbyport_r_proto=define
a48ec845
JH
12817 set d_getservbyport_r_proto getservbyport_r $hdrs
12818 eval $hasproto ;;
12819 *) ;;
12820 esac
12821 case "$d_getservbyport_r_proto" in
12822 define)
10bc17b6
JH
12823 case "$getservbyport_r_proto" in
12824 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12825 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12826 esac
12827 case "$getservbyport_r_proto" in
12828 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12829 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12830 esac
12831 case "$getservbyport_r_proto" in
12832 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12833 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12834 esac
12835 case "$getservbyport_r_proto" in
90e831dc 12836 ''|0) d_getservbyport_r=undef
10bc17b6 12837 getservbyport_r_proto=0
a48ec845 12838 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12839 * ) case "$getservbyport_r_proto" in
12840 REENTRANT_PROTO*) ;;
12841 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12842 esac
12843 echo "Prototype: $try" ;;
12844 esac
12845 ;;
c18e646a
JH
12846 *) case "$usethreads" in
12847 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12848 esac
90e831dc
SB
12849 d_getservbyport_r=undef
12850 getservbyport_r_proto=0
c18e646a 12851 ;;
a48ec845
JH
12852 esac
12853 ;;
10bc17b6
JH
12854*) getservbyport_r_proto=0
12855 ;;
12856esac
12857
12858: see if getservent_r exists
12859set getservent_r d_getservent_r
12860eval $inlibc
12861case "$d_getservent_r" in
12862"$define")
12863 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
12864 case "netdb" in
12865 time)
12866 hdrs="$hdrs $i_systime sys/time.h"
12867 ;;
12868 esac
c18e646a
JH
12869 case "$d_getservent_r_proto:$usethreads" in
12870 ":define") d_getservent_r_proto=define
a48ec845
JH
12871 set d_getservent_r_proto getservent_r $hdrs
12872 eval $hasproto ;;
12873 *) ;;
12874 esac
12875 case "$d_getservent_r_proto" in
12876 define)
10bc17b6
JH
12877 case "$getservent_r_proto" in
12878 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12879 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12880 esac
12881 case "$getservent_r_proto" in
12882 ''|0) try='int getservent_r(struct servent*, char*, int);'
12883 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12884 esac
12885 case "$getservent_r_proto" in
12886 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12887 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12888 esac
12889 case "$getservent_r_proto" in
12890 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12891 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12892 esac
12893 case "$getservent_r_proto" in
90e831dc 12894 ''|0) d_getservent_r=undef
10bc17b6 12895 getservent_r_proto=0
a48ec845 12896 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12897 * ) case "$getservent_r_proto" in
12898 REENTRANT_PROTO*) ;;
12899 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12900 esac
12901 echo "Prototype: $try" ;;
12902 esac
12903 ;;
c18e646a
JH
12904 *) case "$usethreads" in
12905 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12906 esac
90e831dc
SB
12907 d_getservent_r=undef
12908 getservent_r_proto=0
c18e646a 12909 ;;
a48ec845
JH
12910 esac
12911 ;;
10bc17b6
JH
12912*) getservent_r_proto=0
12913 ;;
12914esac
12915
b4eb6b3d
JH
12916: see if prototypes for various getservxxx netdb.h functions are available
12917echo " "
12918set d_getservprotos getservent $i_netdb netdb.h
12919eval $hasproto
12920
12921: see if getspnam exists
12922set getspnam d_getspnam
12923eval $inlibc
12924
10bc17b6
JH
12925: see if this is a shadow.h system
12926set shadow.h i_shadow
12927eval $inhdr
12928
12929: see if getspnam_r exists
12930set getspnam_r d_getspnam_r
12931eval $inlibc
12932case "$d_getspnam_r" in
12933"$define")
12934 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
90e831dc
SB
12935 case "shadow" in
12936 time)
12937 hdrs="$hdrs $i_systime sys/time.h"
12938 ;;
12939 esac
c18e646a
JH
12940 case "$d_getspnam_r_proto:$usethreads" in
12941 ":define") d_getspnam_r_proto=define
a48ec845
JH
12942 set d_getspnam_r_proto getspnam_r $hdrs
12943 eval $hasproto ;;
12944 *) ;;
12945 esac
12946 case "$d_getspnam_r_proto" in
12947 define)
10bc17b6
JH
12948 case "$getspnam_r_proto" in
12949 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12950 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12951 esac
12952 case "$getspnam_r_proto" in
12953 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12954 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12955 esac
12956 case "$getspnam_r_proto" in
90e831dc 12957 ''|0) d_getspnam_r=undef
10bc17b6 12958 getspnam_r_proto=0
a48ec845 12959 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12960 * ) case "$getspnam_r_proto" in
12961 REENTRANT_PROTO*) ;;
12962 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12963 esac
12964 echo "Prototype: $try" ;;
12965 esac
12966 ;;
c18e646a
JH
12967 *) case "$usethreads" in
12968 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12969 esac
90e831dc
SB
12970 d_getspnam_r=undef
12971 getspnam_r_proto=0
c18e646a 12972 ;;
a48ec845
JH
12973 esac
12974 ;;
10bc17b6
JH
12975*) getspnam_r_proto=0
12976 ;;
12977esac
12978
b4eb6b3d
JH
12979: see if gettimeofday or ftime exists
12980set gettimeofday d_gettimeod
12981eval $inlibc
12982case "$d_gettimeod" in
12983"$undef")
12984 set ftime d_ftime
12985 eval $inlibc
12986 ;;
12987*)
12988 val="$undef"; set d_ftime; eval $setvar
12989 ;;
12990esac
12991case "$d_gettimeod$d_ftime" in
12992"$undef$undef")
12993 echo " "
12994 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12995 ;;
12996esac
12997
10bc17b6
JH
12998: see if gmtime_r exists
12999set gmtime_r d_gmtime_r
13000eval $inlibc
13001case "$d_gmtime_r" in
13002"$define")
13003 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
90e831dc
SB
13004 case "time" in
13005 time)
13006 hdrs="$hdrs $i_systime sys/time.h"
13007 ;;
13008 esac
c18e646a
JH
13009 case "$d_gmtime_r_proto:$usethreads" in
13010 ":define") d_gmtime_r_proto=define
a48ec845
JH
13011 set d_gmtime_r_proto gmtime_r $hdrs
13012 eval $hasproto ;;
13013 *) ;;
13014 esac
13015 case "$d_gmtime_r_proto" in
13016 define)
10bc17b6
JH
13017 case "$gmtime_r_proto" in
13018 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13019 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13020 esac
13021 case "$gmtime_r_proto" in
13022 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13023 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13024 esac
13025 case "$gmtime_r_proto" in
90e831dc 13026 ''|0) d_gmtime_r=undef
10bc17b6 13027 gmtime_r_proto=0
a48ec845 13028 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13029 * ) case "$gmtime_r_proto" in
13030 REENTRANT_PROTO*) ;;
13031 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13032 esac
13033 echo "Prototype: $try" ;;
13034 esac
b4eb6b3d 13035 ;;
c18e646a
JH
13036 *) case "$usethreads" in
13037 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13038 esac
90e831dc
SB
13039 d_gmtime_r=undef
13040 gmtime_r_proto=0
c18e646a 13041 ;;
a48ec845
JH
13042 esac
13043 ;;
10bc17b6 13044*) gmtime_r_proto=0
b4eb6b3d
JH
13045 ;;
13046esac
13047
13048: see if hasmntopt exists
13049set hasmntopt d_hasmntopt
13050eval $inlibc
13051
13052: see if this is a netinet/in.h or sys/in.h system
13053set netinet/in.h i_niin sys/in.h i_sysin
13054eval $inhdr
13055
13056: see if arpa/inet.h has to be included
13057set arpa/inet.h i_arpainet
13058eval $inhdr
13059
13060: see if htonl --and friends-- exists
13061val=''
13062set htonl val
13063eval $inlibc
13064
13065: Maybe they are macros.
13066case "$val" in
13067$undef)
13068 $cat >htonl.c <<EOM
13069#include <stdio.h>
13070#include <sys/types.h>
13071#$i_niin I_NETINET_IN
13072#$i_sysin I_SYS_IN
13073#$i_arpainet I_ARPA_INET
13074#ifdef I_NETINET_IN
13075#include <netinet/in.h>
13076#endif
13077#ifdef I_SYS_IN
13078#include <sys/in.h>
13079#endif
13080#ifdef I_ARPA_INET
13081#include <arpa/inet.h>
13082#endif
13083#ifdef htonl
13084printf("Defined as a macro.");
13085#endif
13086EOM
13087 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13088 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13089 val="$define"
13090 echo "But it seems to be defined as a macro." >&4
13091 fi
13092 $rm -f htonl.?
13093 ;;
13094esac
13095set d_htonl
13096eval $setvar
13097
b4eb6b3d
JH
13098: index or strchr
13099echo " "
13100if set index val -f; eval $csym; $val; then
13101 if set strchr val -f d_strchr; eval $csym; $val; then
13102 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13103 val="$define"
13104 vali="$undef"
13105 echo "strchr() found." >&4
13106 else
13107 val="$undef"
13108 vali="$define"
13109 echo "index() found." >&4
13110 fi
13111 else
13112 val="$undef"
13113 vali="$define"
8dfa8df9
JH
13114 echo "index() found." >&4
13115 fi
b4eb6b3d 13116else
8dfa8df9
JH
13117 if set strchr val -f d_strchr; eval $csym; $val; then
13118 val="$define"
13119 vali="$undef"
13120 echo "strchr() found." >&4
13121 else
13122 echo "No index() or strchr() found!" >&4
13123 val="$undef"
13124 vali="$undef"
13125 fi
b4eb6b3d 13126fi
8dfa8df9
JH
13127set d_strchr; eval $setvar
13128val="$vali"
13129set d_index; eval $setvar
13130
13131: check whether inet_aton exists
13132set inet_aton d_inetaton
13133eval $inlibc
b4eb6b3d
JH
13134
13135: Look for isascii
13136echo " "
13137$cat >isascii.c <<'EOCP'
13138#include <stdio.h>
13139#include <ctype.h>
13140int main() {
13141 int c = 'A';
13142 if (isascii(c))
13143 exit(0);
13144 else
13145 exit(1);
13146}
13147EOCP
13148set isascii
13149if eval $compile; then
13150 echo "isascii() found." >&4
13151 val="$define"
13152else
13153 echo "isascii() NOT found." >&4
13154 val="$undef"
13155fi
13156set d_isascii
13157eval $setvar
13158$rm -f isascii*
13159
758a5d79
JH
13160: see if isfinite exists
13161set isfinite d_isfinite
13162eval $inlibc
13163
13164: see if isinf exists
13165set isinf d_isinf
13166eval $inlibc
13167
b4eb6b3d
JH
13168: see if isnan exists
13169set isnan d_isnan
13170eval $inlibc
13171
13172: see if isnanl exists
13173set isnanl d_isnanl
13174eval $inlibc
13175
13176: see if killpg exists
13177set killpg d_killpg
13178eval $inlibc
13179
13180: see if lchown exists
13181echo " "
13182$cat > try.c <<'EOCP'
13183/* System header to define __stub macros and hopefully few prototypes,
13184 which can conflict with char lchown(); below. */
13185#include <assert.h>
13186/* Override any gcc2 internal prototype to avoid an error. */
13187/* We use char because int might match the return type of a gcc2
13188 builtin and then its argument prototype would still apply. */
13189char lchown();
13190int main() {
13191 /* The GNU C library defines this for functions which it implements
13192 to always fail with ENOSYS. Some functions are actually named
13193 something starting with __ and the normal name is an alias. */
13194#if defined (__stub_lchown) || defined (__stub___lchown)
13195choke me
13196#else
13197lchown();
13198#endif
13199; return 0; }
13200EOCP
13201set try
13202if eval $compile; then
13203 $echo "lchown() found." >&4
13204 val="$define"
13205else
13206 $echo "lchown() NOT found." >&4
13207 val="$undef"
13208fi
13209set d_lchown
13210eval $setvar
13211
13212: See if number of significant digits in a double precision number is known
13213echo " "
13214$cat >ldbl_dig.c <<EOM
13215#$i_limits I_LIMITS
13216#$i_float I_FLOAT
13217#ifdef I_LIMITS
13218#include <limits.h>
13219#endif
13220#ifdef I_FLOAT
13221#include <float.h>
13222#endif
13223#ifdef LDBL_DIG
13224printf("Contains LDBL_DIG");
13225#endif
13226EOM
13227$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13228if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13229 echo "LDBL_DIG found." >&4
13230 val="$define"
13231else
13232 echo "LDBL_DIG NOT found." >&4
13233 val="$undef"
13234fi
13235$rm -f ldbl_dig.?
13236set d_ldbl_dig
13237eval $setvar
13238
13239: see if link exists
13240set link d_link
13241eval $inlibc
13242
10bc17b6
JH
13243: see if localtime_r exists
13244set localtime_r d_localtime_r
13245eval $inlibc
13246case "$d_localtime_r" in
13247"$define")
13248 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
90e831dc
SB
13249 case "time" in
13250 time)
13251 hdrs="$hdrs $i_systime sys/time.h"
13252 ;;
13253 esac
c18e646a
JH
13254 case "$d_localtime_r_proto:$usethreads" in
13255 ":define") d_localtime_r_proto=define
a48ec845
JH
13256 set d_localtime_r_proto localtime_r $hdrs
13257 eval $hasproto ;;
13258 *) ;;
13259 esac
13260 case "$d_localtime_r_proto" in
13261 define)
10bc17b6
JH
13262 case "$localtime_r_proto" in
13263 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13264 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13265 esac
13266 case "$localtime_r_proto" in
13267 ''|0) try='int localtime_r(const time_t*, struct tm*);'
13268 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13269 esac
13270 case "$localtime_r_proto" in
90e831dc 13271 ''|0) d_localtime_r=undef
10bc17b6 13272 localtime_r_proto=0
a48ec845 13273 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13274 * ) case "$localtime_r_proto" in
13275 REENTRANT_PROTO*) ;;
13276 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13277 esac
13278 echo "Prototype: $try" ;;
13279 esac
13280 ;;
c18e646a
JH
13281 *) case "$usethreads" in
13282 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13283 esac
90e831dc
SB
13284 d_localtime_r=undef
13285 localtime_r_proto=0
c18e646a 13286 ;;
a48ec845
JH
13287 esac
13288 ;;
10bc17b6
JH
13289*) localtime_r_proto=0
13290 ;;
13291esac
13292
b4eb6b3d
JH
13293: see if localeconv exists
13294set localeconv d_locconv
13295eval $inlibc
13296
13297: see if lockf exists
13298set lockf d_lockf
13299eval $inlibc
13300
b4eb6b3d
JH
13301: see if prototype for lseek is available
13302echo " "
4786929f 13303set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
13304eval $hasproto
13305
13306: see if lstat exists
13307set lstat d_lstat
13308eval $inlibc
13309
13310: see if madvise exists
13311set madvise d_madvise
13312eval $inlibc
13313
13314: see if mblen exists
13315set mblen d_mblen
13316eval $inlibc
13317
13318: see if mbstowcs exists
13319set mbstowcs d_mbstowcs
13320eval $inlibc
13321
13322: see if mbtowc exists
13323set mbtowc d_mbtowc
13324eval $inlibc
13325
13326: see if memchr exists
13327set memchr d_memchr
13328eval $inlibc
13329
13330: see if memcmp exists
13331set memcmp d_memcmp
13332eval $inlibc
13333
13334: see if memcpy exists
13335set memcpy d_memcpy
13336eval $inlibc
13337
13338: see if memmove exists
13339set memmove d_memmove
13340eval $inlibc
13341
13342: see if memset exists
13343set memset d_memset
13344eval $inlibc
13345
13346: see if mkdir exists
13347set mkdir d_mkdir
13348eval $inlibc
13349
13350: see if mkdtemp exists
13351set mkdtemp d_mkdtemp
13352eval $inlibc
13353
13354: see if mkfifo exists
13355set mkfifo d_mkfifo
13356eval $inlibc
13357
13358: see if mkstemp exists
13359set mkstemp d_mkstemp
13360eval $inlibc
13361
13362: see if mkstemps exists
13363set mkstemps d_mkstemps
13364eval $inlibc
13365
13366: see if mktime exists
13367set mktime d_mktime
13368eval $inlibc
13369
13370: see if this is a sys/mman.h system
13371set sys/mman.h i_sysmman
13372eval $inhdr
13373
13374: see if mmap exists
13375set mmap d_mmap
13376eval $inlibc
13377: see what shmat returns
13378: default to something harmless
13379mmaptype='void *'
13380case "$i_sysmman$d_mmap" in
13381"$define$define")
13382 $cat >mmap.c <<'END'
13383#include <sys/mman.h>
13384void *mmap();
13385END
13386 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13387 mmaptype='void *'
13388 else
13389 mmaptype='caddr_t'
13390 fi
13391 echo "and it returns ($mmaptype)." >&4
13392 ;;
13393esac
13394
13395
13396
b4eb6b3d
JH
13397: see if mprotect exists
13398set mprotect d_mprotect
13399eval $inlibc
13400
13401: see if msgctl exists
13402set msgctl d_msgctl
13403eval $inlibc
13404
13405: see if msgget exists
13406set msgget d_msgget
13407eval $inlibc
13408
13409: see if msgsnd exists
13410set msgsnd d_msgsnd
13411eval $inlibc
13412
13413: see if msgrcv exists
13414set msgrcv d_msgrcv
13415eval $inlibc
13416
13417: see how much of the 'msg*(2)' library is present.
13418h_msg=true
13419echo " "
13420case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13421*"$undef"*) h_msg=false;;
13422esac
13423case "$osname" in
13424freebsd)
13425 case "`ipcs 2>&1`" in
13426 "SVID messages"*"not configured"*)
13427 echo "Your $osname does not have the msg*(2) configured." >&4
13428 h_msg=false
13429 val="$undef"
13430 set msgctl d_msgctl
13431 eval $setvar
13432 set msgget d_msgget
13433 eval $setvar
13434 set msgsnd d_msgsnd
13435 eval $setvar
13436 set msgrcv d_msgrcv
13437 eval $setvar
13438 ;;
13439 esac
13440 ;;
13441esac
13442: we could also check for sys/ipc.h ...
13443if $h_msg && $test `./findhdr sys/msg.h`; then
13444 echo "You have the full msg*(2) library." >&4
13445 val="$define"
13446else
13447 echo "You don't have the full msg*(2) library." >&4
13448 val="$undef"
13449fi
13450set d_msg
13451eval $setvar
13452
4e0554ec
JH
13453
13454echo " "
13455echo "Checking to see if your system supports struct msghdr..." >&4
13456set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13457eval $hasstruct
13458case "$d_msghdr_s" in
13459"$define") echo "Yes, it does." ;;
13460*) echo "No, it doesn't." ;;
13461esac
13462
13463
b4eb6b3d
JH
13464: see if msync exists
13465set msync d_msync
13466eval $inlibc
13467
13468: see if munmap exists
13469set munmap d_munmap
13470eval $inlibc
13471
13472: see if nice exists
13473set nice d_nice
13474eval $inlibc
13475
2765b840
JH
13476: see if this is a langinfo.h system
13477set langinfo.h i_langinfo
13478eval $inhdr
13479
13480: see if nl_langinfo exists
13481set nl_langinfo d_nl_langinfo
13482eval $inlibc
13483
b4eb6b3d
JH
13484: check for length of character
13485echo " "
13486case "$charsize" in
13487'')
13488 echo "Checking to see how big your characters are (hey, you never know)..." >&4
13489 $cat >try.c <<'EOCP'
13490#include <stdio.h>
13491int main()
13492{
13493 printf("%d\n", (int)sizeof(char));
13494 exit(0);
13495}
13496EOCP
13497 set try
13498 if eval $compile_ok; then
5440bc8e 13499 dflt=`$run ./try`
b4eb6b3d
JH
13500 else
13501 dflt='1'
13502 echo "(I can't seem to compile the test program. Guessing...)"
13503 fi
13504 ;;
13505*)
13506 dflt="$charsize"
13507 ;;
13508esac
13509rp="What is the size of a character (in bytes)?"
13510. ./myread
13511charsize="$ans"
13512$rm -f try.c try
13513
1d1be0dc
NC
13514: check for volatile keyword
13515echo " "
13516echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13517$cat >try.c <<'EOCP'
13518int main()
13519{
13520 typedef struct _goo_struct goo_struct;
13521 goo_struct * volatile goo = ((goo_struct *)0);
13522 struct _goo_struct {
13523 long long_int;
13524 int reg_int;
13525 char char_var;
13526 };
13527 typedef unsigned short foo_t;
13528 char *volatile foo;
13529 volatile int bar;
13530 volatile foo_t blech;
13531 foo = foo;
13532}
13533EOCP
13534if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13535 val="$define"
13536 echo "Yup, it does."
13537else
13538 val="$undef"
13539 echo "Nope, it doesn't."
13540fi
13541set d_volatile
13542eval $setvar
13543$rm -f try.*
13544
b4eb6b3d
JH
13545
13546echo " "
13547$echo "Choosing the C types to be used for Perl's internal types..." >&4
13548
13549case "$use64bitint:$d_quad:$quadtype" in
13550define:define:?*)
13551 ivtype="$quadtype"
13552 uvtype="$uquadtype"
13553 ivsize=8
13554 uvsize=8
13555 ;;
13556*) ivtype="long"
13557 uvtype="unsigned long"
13558 ivsize=$longsize
13559 uvsize=$longsize
13560 ;;
13561esac
13562
13563case "$uselongdouble:$d_longdbl" in
13564define:define)
13565 nvtype="long double"
13566 nvsize=$longdblsize
13567 ;;
13568*) nvtype=double
13569 nvsize=$doublesize
13570 ;;
13571esac
13572
13573$echo "(IV will be "$ivtype", $ivsize bytes)"
13574$echo "(UV will be "$uvtype", $uvsize bytes)"
13575$echo "(NV will be "$nvtype", $nvsize bytes)"
13576
13577$cat >try.c <<EOCP
13578#$i_inttypes I_INTTYPES
13579#ifdef I_INTTYPES
13580#include <inttypes.h>
13581#endif
13582#include <stdio.h>
13583int main() {
13584#ifdef INT8
13585 int8_t i = INT8_MAX;
13586 uint8_t u = UINT8_MAX;
13587 printf("int8_t\n");
13588#endif
13589#ifdef INT16
13590 int16_t i = INT16_MAX;
13591 uint16_t i = UINT16_MAX;
13592 printf("int16_t\n");
13593#endif
13594#ifdef INT32
13595 int32_t i = INT32_MAX;
13596 uint32_t u = UINT32_MAX;
13597 printf("int32_t\n");
13598#endif
13599}
13600EOCP
13601
13602case "$i8type" in
13603'') case "$charsize" in
13604 1) i8type=char
13605 u8type="unsigned char"
13606 i8size=$charsize
13607 u8size=$charsize
13608 ;;
13609 esac
13610 ;;
13611esac
13612case "$i8type" in
13613'') set try -DINT8
13614 if eval $compile; then
5440bc8e 13615 case "`$run ./try`" in
b4eb6b3d
JH
13616 int8_t) i8type=int8_t
13617 u8type=uint8_t
13618 i8size=1
13619 u8size=1
13620 ;;
13621 esac
13622 fi
13623 ;;
13624esac
13625case "$i8type" in
13626'') if $test $charsize -ge 1; then
13627 i8type=char
13628 u8type="unsigned char"
13629 i8size=$charsize
13630 u8size=$charsize
13631 fi
13632 ;;
13633esac
13634
13635case "$i16type" in
13636'') case "$shortsize" in
13637 2) i16type=short
13638 u16type="unsigned short"
13639 i16size=$shortsize
13640 u16size=$shortsize
13641 ;;
13642 esac
13643 ;;
13644esac
13645case "$i16type" in
13646'') set try -DINT16
13647 if eval $compile; then
5440bc8e 13648 case "`$run ./try`" in
b4eb6b3d
JH
13649 int16_t)
13650 i16type=int16_t
13651 u16type=uint16_t
13652 i16size=2
13653 u16size=2
13654 ;;
13655 esac
13656 fi
13657 ;;
13658esac
13659case "$i16type" in
13660'') if $test $shortsize -ge 2; then
13661 i16type=short
13662 u16type="unsigned short"
13663 i16size=$shortsize
13664 u16size=$shortsize
13665 fi
13666 ;;
13667esac
13668
13669case "$i32type" in
13670'') case "$longsize" in
13671 4) i32type=long
13672 u32type="unsigned long"
13673 i32size=$longsize
13674 u32size=$longsize
13675 ;;
13676 *) case "$intsize" in
13677 4) i32type=int
13678 u32type="unsigned int"
13679 i32size=$intsize
13680 u32size=$intsize
13681 ;;
13682 esac
13683 ;;
13684 esac
13685 ;;
13686esac
13687case "$i32type" in
13688'') set try -DINT32
13689 if eval $compile; then
5440bc8e 13690 case "`$run ./try`" in
b4eb6b3d
JH
13691 int32_t)
13692 i32type=int32_t
13693 u32type=uint32_t
13694 i32size=4
13695 u32size=4
13696 ;;
13697 esac
13698 fi
13699 ;;
13700esac
13701case "$i32type" in
13702'') if $test $intsize -ge 4; then
13703 i32type=int
13704 u32type="unsigned int"
13705 i32size=$intsize
13706 u32size=$intsize
13707 fi
13708 ;;
13709esac
13710
13711case "$i64type" in
13712'') case "$d_quad:$quadtype" in
13713 define:?*)
13714 i64type="$quadtype"
13715 u64type="$uquadtype"
13716 i64size=8
13717 u64size=8
13718 ;;
13719 esac
13720 ;;
13721esac
13722
1d1be0dc
NC
13723$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13724: volatile so that the compiler has to store it out to memory.
13725if test X"$d_volatile" = X"$define"; then
13726 volatile=volatile
13727fi
b4eb6b3d
JH
13728$cat <<EOP >try.c
13729#include <stdio.h>
1d1be0dc
NC
13730#include <sys/types.h>
13731#include <signal.h>
13732#ifdef SIGFPE
13733$volatile int bletched = 0;
13734$signal_t blech(s) int s; { bletched = 1; }
13735#endif
b4eb6b3d
JH
13736int main() {
13737 $uvtype u = 0;
1d1be0dc 13738 $nvtype d;
b4eb6b3d
JH
13739 int n = 8 * $uvsize;
13740 int i;
1d1be0dc
NC
13741#ifdef SIGFPE
13742 signal(SIGFPE, blech);
13743#endif
13744
b4eb6b3d
JH
13745 for (i = 0; i < n; i++) {
13746 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
13747 d = ($nvtype)u;
13748 if (($uvtype)d != u)
b4eb6b3d 13749 break;
1d1be0dc
NC
13750 if (d <= 0)
13751 break;
13752 d = ($nvtype)(u - 1);
13753 if (($uvtype)d != (u - 1))
13754 break;
13755#ifdef SIGFPE
13756 if (bletched) {
13757 break;
13758#endif
13759 }
b4eb6b3d 13760 }
efd1522b 13761 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
13762 exit(0);
13763}
13764EOP
1d1be0dc
NC
13765set try
13766
13767d_nv_preserves_uv="$undef"
13768if eval $compile; then
53133ed1 13769 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 13770fi
53133ed1 13771case "$nv_preserves_uv_bits" in
1d1be0dc 13772\-[1-9]*)
53133ed1
NC
13773 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13774 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 13775 d_nv_preserves_uv="$define"
b4eb6b3d 13776 ;;
53133ed1 13777[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
13778 d_nv_preserves_uv="$undef" ;;
13779*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 13780 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
13781esac
13782
1d1be0dc
NC
13783$rm -f try.* try
13784
b4eb6b3d
JH
13785
13786: check for off64_t
13787echo " "
13788echo "Checking to see if you have off64_t..." >&4
13789$cat >try.c <<EOCP
13790#include <sys/types.h>
13791#include <unistd.h>
13792int main() { off64_t x = 7; }
13793EOCP
13794set try
13795if eval $compile; then
13796 val="$define"
13797 echo "You have off64_t."
13798else
13799 val="$undef"
13800 echo "You do not have off64_t."
13801 case "$lseeksize" in
13802 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13803 esac
13804fi
13805$rm -f try.* try
13806set d_off64_t
13807eval $setvar
13808
13809: see if POSIX threads are available
13810set pthread.h i_pthread
13811eval $inhdr
13812
13813
13814
13815
13816: how to create joinable pthreads
13817if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13818 echo " "
13819 echo "Checking what constant to use for creating joinable pthreads..." >&4
13820 $cat >try.c <<'EOCP'
13821#include <pthread.h>
13822int main() {
13823 int detachstate = JOINABLE;
13824}
13825EOCP
13826 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13827 if eval $compile; then
13828 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13829 val="$undef" # Yes, undef.
13830 set d_old_pthread_create_joinable
13831 eval $setvar
13832 val=""
13833 set old_pthread_create_joinable
13834 eval $setvar
13835 else
13836 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13837 if eval $compile; then
13838 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13839 val="$define"
13840 set d_old_pthread_create_joinable
13841 eval $setvar
13842 val=PTHREAD_CREATE_UNDETACHED
13843 set old_pthread_create_joinable
13844 eval $setvar
13845 else
13846 set try -DJOINABLE=__UNDETACHED
13847 if eval $compile; then
13848 echo "You seem to use __UNDETACHED." >&4
13849 val="$define"
13850 set d_old_pthread_create_joinable
13851 eval $setvar
13852 val=__UNDETACHED
13853 set old_pthread_create_joinable
13854 eval $setvar
13855 else
13856 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13857 val="$define"
13858 set d_old_pthread_create_joinable
13859 eval $setvar
13860 val=0
13861 set old_pthread_create_joinable
13862 eval $setvar
13863 fi
13864 fi
13865 fi
13866 $rm -f try try.*
13867else
13868 d_old_pthread_create_joinable="$undef"
13869 old_pthread_create_joinable=""
13870fi
13871
13872: see if pause exists
13873set pause d_pause
13874eval $inlibc
13875
13876: see if pipe exists
13877set pipe d_pipe
13878eval $inlibc
13879
13880: see if poll exists
13881set poll d_poll
13882eval $inlibc
13883
c7aff470
NIS
13884: see if readlink exists
13885set readlink d_readlink
13886eval $inlibc
13887
13888echo " "
f24dbf84 13889procselfexe=''
c7aff470 13890val="$undef"
a33c94aa
JH
13891case "$d_readlink" in
13892"$define")
c7aff470
NIS
13893 if $issymlink /proc/self/exe ; then
13894 $ls -l /proc/self/exe > reflect
51660ed5 13895 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 13896 echo "You have Linux-like /proc/self/exe."
92236451 13897 procselfexe='"/proc/self/exe"'
f24dbf84 13898 val="$define"
f24dbf84
JH
13899 fi
13900 fi
13901 if $issymlink /proc/curproc/file ; then
13902 $ls -l /proc/curproc/file > reflect
13903 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13904 echo "You have BSD-like /proc/curproc/file."
92236451 13905 procselfexe='"/proc/curproc/file"'
f24dbf84 13906 val="$define"
c7aff470 13907 fi
c7aff470 13908 fi
a33c94aa
JH
13909 ;;
13910esac
428dc699 13911$rm -f reflect
c7aff470
NIS
13912set d_procselfexe
13913eval $setvar
13914
263fee3f
JH
13915: see whether the pthread_atfork exists
13916$cat >try.c <<EOP
13917#include <pthread.h>
13918#include <stdio.h>
13919int main() {
13920#ifdef PTHREAD_ATFORK
13921 pthread_atfork(NULL,NULL,NULL);
13922#endif
13923}
13924EOP
13925
d6483fcc 13926: see if pthread_atfork exists
263fee3f
JH
13927set try -DPTHREAD_ATFORK
13928if eval $compile; then
13929 val="$define"
13930else
13931 val="$undef"
13932fi
13933case "$usethreads" in
13934$define)
13935 case "$val" in
13936 $define) echo 'pthread_atfork found.' >&4 ;;
13937 *) echo 'pthread_atfork NOT found.' >&4 ;;
13938 esac
13939esac
13940set d_pthread_atfork
13941eval $setvar
d6483fcc 13942
b4eb6b3d
JH
13943
13944: see whether the various POSIXish _yields exist
13945$cat >try.c <<EOP
13946#include <pthread.h>
13947#include <stdio.h>
13948int main() {
13949#ifdef SCHED_YIELD
13950 sched_yield();
13951#else
13952#ifdef PTHREAD_YIELD
13953 pthread_yield();
13954#else
13955#ifdef PTHREAD_YIELD_NULL
13956 pthread_yield(NULL);
13957#endif
13958#endif
13959#endif
13960}
13961EOP
13962: see if sched_yield exists
13963set try -DSCHED_YIELD
13964if eval $compile; then
13965 val="$define"
13966 sched_yield='sched_yield()'
13967else
13968 val="$undef"
13969fi
13970case "$usethreads" in
13971$define)
13972 case "$val" in
13973 $define) echo 'sched_yield() found.' >&4 ;;
13974 *) echo 'sched_yield() NOT found.' >&4 ;;
13975 esac
13976esac
10bc17b6
JH
13977set d_sched_yield
13978eval $setvar
b4eb6b3d 13979
10bc17b6
JH
13980: see if pthread_yield exists
13981set try -DPTHREAD_YIELD
13982if eval $compile; then
13983 val="$define"
13984 case "$sched_yield" in
13985 '') sched_yield='pthread_yield()' ;;
13986 esac
13987else
13988 set try -DPTHREAD_YIELD_NULL
13989 if eval $compile; then
13990 val="$define"
13991 case "$sched_yield" in
13992 '') sched_yield='pthread_yield(NULL)' ;;
13993 esac
13994 else
13995 val="$undef"
13996 fi
13997fi
13998case "$usethreads" in
13999$define)
14000 case "$val" in
14001 $define) echo 'pthread_yield() found.' >&4 ;;
14002 *) echo 'pthread_yield() NOT found.' >&4 ;;
14003 esac
14004 ;;
14005esac
14006set d_pthread_yield
14007eval $setvar
b4eb6b3d 14008
10bc17b6
JH
14009case "$sched_yield" in
14010'') sched_yield=undef ;;
14011esac
b4eb6b3d 14012
10bc17b6
JH
14013$rm -f try try.*
14014
14015: see if random_r exists
14016set random_r d_random_r
14017eval $inlibc
14018case "$d_random_r" in
14019"$define")
14020 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
90e831dc
SB
14021 case "stdlib" in
14022 time)
14023 hdrs="$hdrs $i_systime sys/time.h"
14024 ;;
14025 esac
c18e646a
JH
14026 case "$d_random_r_proto:$usethreads" in
14027 ":define") d_random_r_proto=define
a48ec845
JH
14028 set d_random_r_proto random_r $hdrs
14029 eval $hasproto ;;
14030 *) ;;
14031 esac
14032 case "$d_random_r_proto" in
14033 define)
10bc17b6
JH
14034 case "$random_r_proto" in
14035 ''|0) try='int random_r(int*, struct random_data*);'
14036 ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14037 esac
14038 case "$random_r_proto" in
90e831dc 14039 ''|0) d_random_r=undef
10bc17b6 14040 random_r_proto=0
a48ec845 14041 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14042 * ) case "$random_r_proto" in
14043 REENTRANT_PROTO*) ;;
14044 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14045 esac
14046 echo "Prototype: $try" ;;
14047 esac
b4eb6b3d 14048 ;;
c18e646a
JH
14049 *) case "$usethreads" in
14050 define) echo "random_r has no prototype, not using it." >&4 ;;
14051 esac
90e831dc
SB
14052 d_random_r=undef
14053 random_r_proto=0
c18e646a 14054 ;;
a48ec845
JH
14055 esac
14056 ;;
10bc17b6 14057*) random_r_proto=0
b4eb6b3d
JH
14058 ;;
14059esac
14060
14061: see if readdir and friends exist
14062set readdir d_readdir
14063eval $inlibc
14064set seekdir d_seekdir
14065eval $inlibc
14066set telldir d_telldir
14067eval $inlibc
14068set rewinddir d_rewinddir
14069eval $inlibc
14070
10bc17b6
JH
14071: see if readdir64_r exists
14072set readdir64_r d_readdir64_r
14073eval $inlibc
14074case "$d_readdir64_r" in
14075"$define")
14076 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
90e831dc
SB
14077 case "dirent" in
14078 time)
14079 hdrs="$hdrs $i_systime sys/time.h"
14080 ;;
14081 esac
c18e646a
JH
14082 case "$d_readdir64_r_proto:$usethreads" in
14083 ":define") d_readdir64_r_proto=define
a48ec845
JH
14084 set d_readdir64_r_proto readdir64_r $hdrs
14085 eval $hasproto ;;
14086 *) ;;
14087 esac
14088 case "$d_readdir64_r_proto" in
14089 define)
10bc17b6
JH
14090 case "$readdir64_r_proto" in
14091 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14092 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14093 esac
14094 case "$readdir64_r_proto" in
14095 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14096 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14097 esac
14098 case "$readdir64_r_proto" in
90e831dc 14099 ''|0) d_readdir64_r=undef
10bc17b6 14100 readdir64_r_proto=0
a48ec845 14101 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14102 * ) case "$readdir64_r_proto" in
14103 REENTRANT_PROTO*) ;;
14104 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14105 esac
14106 echo "Prototype: $try" ;;
14107 esac
14108 ;;
c18e646a
JH
14109 *) case "$usethreads" in
14110 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14111 esac
90e831dc
SB
14112 d_readdir64_r=undef
14113 readdir64_r_proto=0
c18e646a 14114 ;;
a48ec845
JH
14115 esac
14116 ;;
10bc17b6
JH
14117*) readdir64_r_proto=0
14118 ;;
14119esac
14120
14121: see if readdir_r exists
14122set readdir_r d_readdir_r
14123eval $inlibc
14124case "$d_readdir_r" in
14125"$define")
14126 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
90e831dc
SB
14127 case "dirent" in
14128 time)
14129 hdrs="$hdrs $i_systime sys/time.h"
14130 ;;
14131 esac
c18e646a
JH
14132 case "$d_readdir_r_proto:$usethreads" in
14133 ":define") d_readdir_r_proto=define
a48ec845
JH
14134 set d_readdir_r_proto readdir_r $hdrs
14135 eval $hasproto ;;
14136 *) ;;
14137 esac
14138 case "$d_readdir_r_proto" in
14139 define)
10bc17b6
JH
14140 case "$readdir_r_proto" in
14141 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14142 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14143 esac
14144 case "$readdir_r_proto" in
14145 ''|0) try='int readdir_r(DIR*, struct dirent*);'
14146 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14147 esac
14148 case "$readdir_r_proto" in
90e831dc 14149 ''|0) d_readdir_r=undef
10bc17b6 14150 readdir_r_proto=0
a48ec845 14151 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14152 * ) case "$readdir_r_proto" in
14153 REENTRANT_PROTO*) ;;
14154 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14155 esac
14156 echo "Prototype: $try" ;;
14157 esac
14158 ;;
c18e646a
JH
14159 *) case "$usethreads" in
14160 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14161 esac
90e831dc
SB
14162 d_readdir_r=undef
14163 readdir_r_proto=0
c18e646a 14164 ;;
a48ec845
JH
14165 esac
14166 ;;
10bc17b6
JH
14167*) readdir_r_proto=0
14168 ;;
14169esac
14170
4e0554ec
JH
14171: see if readv exists
14172set readv d_readv
14173eval $inlibc
14174
14175: see if recvmsg exists
14176set recvmsg d_recvmsg
14177eval $inlibc
14178
b4eb6b3d
JH
14179: see if rename exists
14180set rename d_rename
14181eval $inlibc
14182
14183: see if rmdir exists
14184set rmdir d_rmdir
14185eval $inlibc
14186
14187: see if memory.h is available.
14188val=''
14189set memory.h val
14190eval $inhdr
14191
14192: See if it conflicts with string.h
14193case "$val" in
14194$define)
14195 case "$strings" in
14196 '') ;;
14197 *)
14198 $cppstdin $cppflags $cppminus < $strings > mem.h
14199 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14200 echo " "
14201 echo "We won't be including <memory.h>."
14202 val="$undef"
14203 fi
14204 $rm -f mem.h
14205 ;;
14206 esac
14207esac
14208set i_memory
14209eval $setvar
14210
14211: can bcopy handle overlapping blocks?
b6cc3bc4 14212echo " "
b4eb6b3d 14213val="$undef"
b6cc3bc4
AD
14214case "$d_memmove" in
14215"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14216*) case "$d_bcopy" in
14217 "$define")
14218 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14219 $cat >try.c <<EOCP
b4eb6b3d
JH
14220#$i_memory I_MEMORY
14221#$i_stdlib I_STDLIB
14222#$i_string I_STRING
14223#$i_unistd I_UNISTD
14224EOCP
14225 $cat >>try.c <<'EOCP'
14226#include <stdio.h>
14227#ifdef I_MEMORY
14228# include <memory.h>
14229#endif
14230#ifdef I_STDLIB
14231# include <stdlib.h>
14232#endif
14233#ifdef I_STRING
14234# include <string.h>
14235#else
14236# include <strings.h>
14237#endif
14238#ifdef I_UNISTD
14239# include <unistd.h> /* Needed for NetBSD */
14240#endif
14241int main()
14242{
14243char buf[128], abc[128];
14244char *b;
14245int len;
14246int off;
14247int align;
14248
b6cc3bc4
AD
14249/* Copy "abcde..." string to char abc[] so that gcc doesn't
14250 try to store the string in read-only memory. */
b4eb6b3d
JH
14251bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14252
14253for (align = 7; align >= 0; align--) {
14254 for (len = 36; len; len--) {
14255 b = buf+align;
14256 bcopy(abc, b, len);
14257 for (off = 1; off <= len; off++) {
14258 bcopy(b, b+off, len);
14259 bcopy(b+off, b, len);
14260 if (bcmp(b, abc, len))
14261 exit(1);
14262 }
14263 }
14264}
14265exit(0);
14266}
14267EOCP
b6cc3bc4
AD
14268 set try
14269 if eval $compile_ok; then
14270 if ./try 2>/dev/null; then
14271 echo "Yes, it can."
14272 val="$define"
14273 else
14274 echo "It can't, sorry."
14275 fi
b4eb6b3d 14276 else
b6cc3bc4 14277 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14278 fi
b6cc3bc4
AD
14279 ;;
14280 esac
14281 $rm -f try.* try core
b4eb6b3d
JH
14282 ;;
14283esac
b4eb6b3d
JH
14284set d_safebcpy
14285eval $setvar
14286
14287: can memcpy handle overlapping blocks?
b6cc3bc4 14288echo " "
b4eb6b3d 14289val="$undef"
b6cc3bc4
AD
14290case "$d_memmove" in
14291"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14292*) case "$d_memcpy" in
14293 "$define")
14294 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14295 $cat >try.c <<EOCP
b4eb6b3d
JH
14296#$i_memory I_MEMORY
14297#$i_stdlib I_STDLIB
14298#$i_string I_STRING
14299#$i_unistd I_UNISTD
14300EOCP
14301 $cat >>try.c <<'EOCP'
14302#include <stdio.h>
14303#ifdef I_MEMORY
14304# include <memory.h>
14305#endif
14306#ifdef I_STDLIB
14307# include <stdlib.h>
14308#endif
14309#ifdef I_STRING
14310# include <string.h>
14311#else
14312# include <strings.h>
14313#endif
14314#ifdef I_UNISTD
14315# include <unistd.h> /* Needed for NetBSD */
14316#endif
14317int main()
14318{
14319char buf[128], abc[128];
14320char *b;
14321int len;
14322int off;
14323int align;
14324
14325/* Copy "abcde..." string to char abc[] so that gcc doesn't
14326 try to store the string in read-only memory. */
14327memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14328
14329for (align = 7; align >= 0; align--) {
14330 for (len = 36; len; len--) {
14331 b = buf+align;
14332 memcpy(b, abc, len);
14333 for (off = 1; off <= len; off++) {
14334 memcpy(b+off, b, len);
14335 memcpy(b, b+off, len);
14336 if (memcmp(b, abc, len))
14337 exit(1);
14338 }
14339 }
14340}
14341exit(0);
14342}
14343EOCP
b6cc3bc4
AD
14344 set try
14345 if eval $compile_ok; then
14346 if ./try 2>/dev/null; then
14347 echo "Yes, it can."
14348 val="$define"
14349 else
14350 echo "It can't, sorry."
14351 fi
b4eb6b3d 14352 else
b6cc3bc4 14353 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14354 fi
b6cc3bc4
AD
14355 ;;
14356 esac
14357 $rm -f try.* try core
b4eb6b3d
JH
14358 ;;
14359esac
b4eb6b3d
JH
14360set d_safemcpy
14361eval $setvar
14362
14363: can memcmp be trusted to compare relative magnitude?
14364val="$undef"
14365case "$d_memcmp" in
14366"$define")
14367 echo " "
14368 echo "Checking if your memcmp() can compare relative magnitude..." >&4
14369 $cat >try.c <<EOCP
14370#$i_memory I_MEMORY
14371#$i_stdlib I_STDLIB
14372#$i_string I_STRING
14373#$i_unistd I_UNISTD
14374EOCP
14375 $cat >>try.c <<'EOCP'
14376#include <stdio.h>
14377#ifdef I_MEMORY
14378# include <memory.h>
14379#endif
14380#ifdef I_STDLIB
14381# include <stdlib.h>
14382#endif
14383#ifdef I_STRING
14384# include <string.h>
14385#else
14386# include <strings.h>
14387#endif
14388#ifdef I_UNISTD
14389# include <unistd.h> /* Needed for NetBSD */
14390#endif
14391int main()
14392{
14393char a = -1;
14394char b = 0;
14395if ((a < b) && memcmp(&a, &b, 1) < 0)
14396 exit(1);
14397exit(0);
14398}
14399EOCP
14400 set try
14401 if eval $compile_ok; then
5440bc8e 14402 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
14403 echo "Yes, it can."
14404 val="$define"
14405 else
14406 echo "No, it can't (it uses signed chars)."
14407 fi
14408 else
14409 echo "(I can't compile the test program, so we'll assume not...)"
14410 fi
14411 ;;
14412esac
14413$rm -f try.* try core
14414set d_sanemcmp
14415eval $setvar
14416
ef9f17be
JH
14417: see if prototype for sbrk is available
14418echo " "
14419set d_sbrkproto sbrk $i_unistd unistd.h
14420eval $hasproto
14421
b4eb6b3d
JH
14422: see if select exists
14423set select d_select
14424eval $inlibc
14425
14426: see if semctl exists
14427set semctl d_semctl
14428eval $inlibc
14429
14430: see if semget exists
14431set semget d_semget
14432eval $inlibc
14433
14434: see if semop exists
14435set semop d_semop
14436eval $inlibc
14437
14438: see how much of the 'sem*(2)' library is present.
14439h_sem=true
14440echo " "
14441case "$d_semctl$d_semget$d_semop" in
14442*"$undef"*) h_sem=false;;
14443esac
14444case "$osname" in
14445freebsd)
14446 case "`ipcs 2>&1`" in
14447 "SVID messages"*"not configured"*)
14448 echo "Your $osname does not have the sem*(2) configured." >&4
14449 h_sem=false
14450 val="$undef"
14451 set semctl d_semctl
14452 eval $setvar
14453 set semget d_semget
14454 eval $setvar
14455 set semop d_semop
14456 eval $setvar
14457 ;;
14458 esac
14459 ;;
14460esac
14461: we could also check for sys/ipc.h ...
14462if $h_sem && $test `./findhdr sys/sem.h`; then
14463 echo "You have the full sem*(2) library." >&4
14464 val="$define"
14465else
14466 echo "You don't have the full sem*(2) library." >&4
14467 val="$undef"
14468fi
14469set d_sem
14470eval $setvar
14471
14472: see whether sys/sem.h defines union semun
14473echo " "
14474$cat > try.c <<'END'
14475#include <sys/types.h>
14476#include <sys/ipc.h>
14477#include <sys/sem.h>
14478int main () { union semun semun; semun.buf = 0; }
14479END
14480set try
14481if eval $compile; then
14482 echo "You have union semun in <sys/sem.h>." >&4
14483 val="$define"
14484else
14485 echo "You do not have union semun in <sys/sem.h>." >&4
14486 val="$undef"
14487fi
14488$rm -f try try.c try.h
14489set d_union_semun
14490eval $setvar
14491
14492: see how to do semctl IPC_STAT
14493case "$d_sem" in
14494$define)
14495 : see whether semctl IPC_STAT can use union semun
14496 echo " "
14497 $cat > try.h <<END
14498#ifndef S_IRUSR
14499# ifdef S_IREAD
14500# define S_IRUSR S_IREAD
14501# define S_IWUSR S_IWRITE
14502# define S_IXUSR S_IEXEC
14503# else
14504# define S_IRUSR 0400
14505# define S_IWUSR 0200
14506# define S_IXUSR 0100
14507# endif
14508# define S_IRGRP (S_IRUSR>>3)
14509# define S_IWGRP (S_IWUSR>>3)
14510# define S_IXGRP (S_IXUSR>>3)
14511# define S_IROTH (S_IRUSR>>6)
14512# define S_IWOTH (S_IWUSR>>6)
14513# define S_IXOTH (S_IXUSR>>6)
14514#endif
14515#ifndef S_IRWXU
14516# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14517# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14518# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14519#endif
14520END
14521
14522 $cat > try.c <<END
14523#include <sys/types.h>
14524#include <sys/ipc.h>
14525#include <sys/sem.h>
14526#include <sys/stat.h>
14527#include <stdio.h>
14528#include <errno.h>
14529#include "try.h"
14530#ifndef errno
14531extern int errno;
14532#endif
14533#$d_union_semun HAS_UNION_SEMUN
14534int main() {
14535 union semun
14536#ifndef HAS_UNION_SEMUN
14537 {
14538 int val;
14539 struct semid_ds *buf;
14540 unsigned short *array;
14541 }
14542#endif
14543 arg;
14544 int sem, st;
14545
14546#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14547 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14548 if (sem > -1) {
14549 struct semid_ds argbuf;
14550 arg.buf = &argbuf;
14551# ifdef IPC_STAT
14552 st = semctl(sem, 0, IPC_STAT, arg);
14553 if (st == 0)
14554 printf("semun\n");
14555 else
14556# endif /* IPC_STAT */
14557 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14558# ifdef IPC_RMID
14559 if (semctl(sem, 0, IPC_RMID, arg) != 0)
14560# endif /* IPC_RMID */
14561 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14562 } else
14563#endif /* IPC_PRIVATE && ... */
14564 printf("semget failed: errno = %d\n", errno);
14565 return 0;
14566}
14567END
14568 val="$undef"
14569 set try
14570 if eval $compile; then
5440bc8e 14571 xxx=`$run ./try`
b4eb6b3d
JH
14572 case "$xxx" in
14573 semun) val="$define" ;;
14574 esac
14575 fi
14576 $rm -f try try.c
14577 set d_semctl_semun
14578 eval $setvar
14579 case "$d_semctl_semun" in
14580 $define)
14581 echo "You can use union semun for semctl IPC_STAT." >&4
14582 also='also'
14583 ;;
14584 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
14585 also=''
14586 ;;
14587 esac
14588
14589 : see whether semctl IPC_STAT can use struct semid_ds pointer
14590 $cat > try.c <<'END'
14591#include <sys/types.h>
14592#include <sys/ipc.h>
14593#include <sys/sem.h>
14594#include <sys/stat.h>
14595#include "try.h"
14596#include <stdio.h>
14597#include <errno.h>
14598#ifndef errno
14599extern int errno;
14600#endif
14601int main() {
14602 struct semid_ds arg;
14603 int sem, st;
14604
14605#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14606 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14607 if (sem > -1) {
14608# ifdef IPC_STAT
14609 st = semctl(sem, 0, IPC_STAT, &arg);
14610 if (st == 0)
14611 printf("semid_ds\n");
14612 else
14613# endif /* IPC_STAT */
14614 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14615# ifdef IPC_RMID
14616 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14617# endif /* IPC_RMID */
14618 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14619 } else
14620#endif /* IPC_PRIVATE && ... */
14621 printf("semget failed: errno = %d\n", errno);
14622
14623 return 0;
14624}
14625END
14626 val="$undef"
14627 set try
14628 if eval $compile; then
5440bc8e 14629 xxx=`$run ./try`
b4eb6b3d
JH
14630 case "$xxx" in
14631 semid_ds) val="$define" ;;
14632 esac
14633 fi
14634 $rm -f try try.c
14635 set d_semctl_semid_ds
14636 eval $setvar
14637 case "$d_semctl_semid_ds" in
14638 $define)
14639 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14640 ;;
14641 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14642 ;;
14643 esac
14644 $rm -f try.h
14645 ;;
14646*) val="$undef"
14647
14648 # We do not have the full sem*(2) library, so assume we can not
14649 # use either.
14650
14651 set d_semctl_semun
14652 eval $setvar
14653
14654 set d_semctl_semid_ds
14655 eval $setvar
14656 ;;
14657esac
14658
4e0554ec
JH
14659: see if sendmsg exists
14660set sendmsg d_sendmsg
14661eval $inlibc
14662
b4eb6b3d
JH
14663: see if setegid exists
14664set setegid d_setegid
14665eval $inlibc
14666
14667: see if seteuid exists
14668set seteuid d_seteuid
14669eval $inlibc
14670
14671: see if setgrent exists
14672set setgrent d_setgrent
14673eval $inlibc
14674
10bc17b6
JH
14675: see if setgrent_r exists
14676set setgrent_r d_setgrent_r
14677eval $inlibc
14678case "$d_setgrent_r" in
14679"$define")
14680 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
90e831dc
SB
14681 case "grp" in
14682 time)
14683 hdrs="$hdrs $i_systime sys/time.h"
14684 ;;
14685 esac
c18e646a
JH
14686 case "$d_setgrent_r_proto:$usethreads" in
14687 ":define") d_setgrent_r_proto=define
a48ec845
JH
14688 set d_setgrent_r_proto setgrent_r $hdrs
14689 eval $hasproto ;;
14690 *) ;;
14691 esac
14692 case "$d_setgrent_r_proto" in
14693 define)
10bc17b6
JH
14694 case "$setgrent_r_proto" in
14695 ''|0) try='int setgrent_r(FILE**);'
14696 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14697 esac
14698 case "$setgrent_r_proto" in
14699 ''|0) try='void setgrent_r(FILE**);'
14700 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14701 esac
14702 case "$setgrent_r_proto" in
90e831dc 14703 ''|0) d_setgrent_r=undef
10bc17b6 14704 setgrent_r_proto=0
a48ec845 14705 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14706 * ) case "$setgrent_r_proto" in
14707 REENTRANT_PROTO*) ;;
14708 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14709 esac
14710 echo "Prototype: $try" ;;
14711 esac
14712 ;;
c18e646a
JH
14713 *) case "$usethreads" in
14714 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14715 esac
90e831dc
SB
14716 d_setgrent_r=undef
14717 setgrent_r_proto=0
c18e646a 14718 ;;
a48ec845
JH
14719 esac
14720 ;;
10bc17b6
JH
14721*) setgrent_r_proto=0
14722 ;;
14723esac
14724
b4eb6b3d
JH
14725: see if sethostent exists
14726set sethostent d_sethent
14727eval $inlibc
14728
10bc17b6
JH
14729: see if sethostent_r exists
14730set sethostent_r d_sethostent_r
14731eval $inlibc
14732case "$d_sethostent_r" in
14733"$define")
14734 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
14735 case "netdb" in
14736 time)
14737 hdrs="$hdrs $i_systime sys/time.h"
14738 ;;
14739 esac
c18e646a
JH
14740 case "$d_sethostent_r_proto:$usethreads" in
14741 ":define") d_sethostent_r_proto=define
a48ec845
JH
14742 set d_sethostent_r_proto sethostent_r $hdrs
14743 eval $hasproto ;;
14744 *) ;;
14745 esac
14746 case "$d_sethostent_r_proto" in
14747 define)
10bc17b6
JH
14748 case "$sethostent_r_proto" in
14749 ''|0) try='int sethostent_r(int, struct hostent_data*);'
14750 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14751 esac
14752 case "$sethostent_r_proto" in
14753 ''|0) try='void sethostent_r(int, struct hostent_data*);'
14754 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14755 esac
14756 case "$sethostent_r_proto" in
90e831dc 14757 ''|0) d_sethostent_r=undef
10bc17b6 14758 sethostent_r_proto=0
a48ec845 14759 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14760 * ) case "$sethostent_r_proto" in
14761 REENTRANT_PROTO*) ;;
14762 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14763 esac
14764 echo "Prototype: $try" ;;
14765 esac
14766 ;;
c18e646a
JH
14767 *) case "$usethreads" in
14768 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14769 esac
90e831dc
SB
14770 d_sethostent_r=undef
14771 sethostent_r_proto=0
c18e646a 14772 ;;
a48ec845
JH
14773 esac
14774 ;;
10bc17b6
JH
14775*) sethostent_r_proto=0
14776 ;;
14777esac
14778
4e0554ec
JH
14779: see if setitimer exists
14780set setitimer d_setitimer
14781eval $inlibc
14782
b4eb6b3d
JH
14783: see if setlinebuf exists
14784set setlinebuf d_setlinebuf
14785eval $inlibc
14786
14787: see if setlocale exists
14788set setlocale d_setlocale
14789eval $inlibc
14790
10bc17b6
JH
14791: see if locale.h is available
14792set locale.h i_locale
14793eval $inhdr
14794
14795: see if setlocale_r exists
14796set setlocale_r d_setlocale_r
14797eval $inlibc
14798case "$d_setlocale_r" in
14799"$define")
14800 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
90e831dc
SB
14801 case "locale" in
14802 time)
14803 hdrs="$hdrs $i_systime sys/time.h"
14804 ;;
14805 esac
c18e646a
JH
14806 case "$d_setlocale_r_proto:$usethreads" in
14807 ":define") d_setlocale_r_proto=define
a48ec845
JH
14808 set d_setlocale_r_proto setlocale_r $hdrs
14809 eval $hasproto ;;
14810 *) ;;
14811 esac
14812 case "$d_setlocale_r_proto" in
14813 define)
10bc17b6
JH
14814 case "$setlocale_r_proto" in
14815 ''|0) try='int setlocale_r(int, const char*, char*, int);'
14816 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14817 esac
14818 case "$setlocale_r_proto" in
90e831dc 14819 ''|0) d_setlocale_r=undef
10bc17b6 14820 setlocale_r_proto=0
a48ec845 14821 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14822 * ) case "$setlocale_r_proto" in
14823 REENTRANT_PROTO*) ;;
14824 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14825 esac
14826 echo "Prototype: $try" ;;
14827 esac
14828 ;;
c18e646a
JH
14829 *) case "$usethreads" in
14830 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14831 esac
90e831dc
SB
14832 d_setlocale_r=undef
14833 setlocale_r_proto=0
c18e646a 14834 ;;
a48ec845
JH
14835 esac
14836 ;;
10bc17b6
JH
14837*) setlocale_r_proto=0
14838 ;;
14839esac
14840
b4eb6b3d
JH
14841: see if setnetent exists
14842set setnetent d_setnent
14843eval $inlibc
14844
10bc17b6
JH
14845: see if setnetent_r exists
14846set setnetent_r d_setnetent_r
14847eval $inlibc
14848case "$d_setnetent_r" in
14849"$define")
14850 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
14851 case "netdb" in
14852 time)
14853 hdrs="$hdrs $i_systime sys/time.h"
14854 ;;
14855 esac
c18e646a
JH
14856 case "$d_setnetent_r_proto:$usethreads" in
14857 ":define") d_setnetent_r_proto=define
a48ec845
JH
14858 set d_setnetent_r_proto setnetent_r $hdrs
14859 eval $hasproto ;;
14860 *) ;;
14861 esac
14862 case "$d_setnetent_r_proto" in
14863 define)
10bc17b6
JH
14864 case "$setnetent_r_proto" in
14865 ''|0) try='int setnetent_r(int, struct netent_data*);'
14866 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14867 esac
14868 case "$setnetent_r_proto" in
14869 ''|0) try='void setnetent_r(int, struct netent_data*);'
14870 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14871 esac
14872 case "$setnetent_r_proto" in
90e831dc 14873 ''|0) d_setnetent_r=undef
10bc17b6 14874 setnetent_r_proto=0
a48ec845 14875 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14876 * ) case "$setnetent_r_proto" in
14877 REENTRANT_PROTO*) ;;
14878 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14879 esac
14880 echo "Prototype: $try" ;;
14881 esac
14882 ;;
c18e646a
JH
14883 *) case "$usethreads" in
14884 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14885 esac
90e831dc
SB
14886 d_setnetent_r=undef
14887 setnetent_r_proto=0
c18e646a 14888 ;;
a48ec845
JH
14889 esac
14890 ;;
10bc17b6
JH
14891*) setnetent_r_proto=0
14892 ;;
14893esac
14894
b4eb6b3d
JH
14895: see if setprotoent exists
14896set setprotoent d_setpent
14897eval $inlibc
14898
14899: see if setpgid exists
14900set setpgid d_setpgid
14901eval $inlibc
14902
14903: see if setpgrp2 exists
14904set setpgrp2 d_setpgrp2
14905eval $inlibc
14906
14907: see if setpriority exists
14908set setpriority d_setprior
14909eval $inlibc
14910
14911: see if setproctitle exists
14912set setproctitle d_setproctitle
14913eval $inlibc
14914
10bc17b6
JH
14915: see if setprotoent_r exists
14916set setprotoent_r d_setprotoent_r
14917eval $inlibc
14918case "$d_setprotoent_r" in
14919"$define")
14920 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
14921 case "netdb" in
14922 time)
14923 hdrs="$hdrs $i_systime sys/time.h"
14924 ;;
14925 esac
c18e646a
JH
14926 case "$d_setprotoent_r_proto:$usethreads" in
14927 ":define") d_setprotoent_r_proto=define
a48ec845
JH
14928 set d_setprotoent_r_proto setprotoent_r $hdrs
14929 eval $hasproto ;;
14930 *) ;;
14931 esac
14932 case "$d_setprotoent_r_proto" in
14933 define)
10bc17b6
JH
14934 case "$setprotoent_r_proto" in
14935 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14936 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14937 esac
14938 case "$setprotoent_r_proto" in
14939 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14940 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14941 esac
14942 case "$setprotoent_r_proto" in
90e831dc 14943 ''|0) d_setprotoent_r=undef
10bc17b6 14944 setprotoent_r_proto=0
a48ec845 14945 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14946 * ) case "$setprotoent_r_proto" in
14947 REENTRANT_PROTO*) ;;
14948 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14949 esac
14950 echo "Prototype: $try" ;;
14951 esac
14952 ;;
c18e646a
JH
14953 *) case "$usethreads" in
14954 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14955 esac
90e831dc
SB
14956 d_setprotoent_r=undef
14957 setprotoent_r_proto=0
c18e646a 14958 ;;
a48ec845
JH
14959 esac
14960 ;;
10bc17b6
JH
14961*) setprotoent_r_proto=0
14962 ;;
14963esac
14964
b4eb6b3d
JH
14965: see if setpwent exists
14966set setpwent d_setpwent
14967eval $inlibc
14968
10bc17b6
JH
14969: see if setpwent_r exists
14970set setpwent_r d_setpwent_r
14971eval $inlibc
14972case "$d_setpwent_r" in
14973"$define")
14974 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
90e831dc
SB
14975 case "pwd" in
14976 time)
14977 hdrs="$hdrs $i_systime sys/time.h"
14978 ;;
14979 esac
c18e646a
JH
14980 case "$d_setpwent_r_proto:$usethreads" in
14981 ":define") d_setpwent_r_proto=define
a48ec845
JH
14982 set d_setpwent_r_proto setpwent_r $hdrs
14983 eval $hasproto ;;
14984 *) ;;
14985 esac
14986 case "$d_setpwent_r_proto" in
14987 define)
10bc17b6
JH
14988 case "$setpwent_r_proto" in
14989 ''|0) try='int setpwent_r(FILE**);'
14990 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14991 esac
14992 case "$setpwent_r_proto" in
14993 ''|0) try='void setpwent_r(FILE**);'
14994 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14995 esac
14996 case "$setpwent_r_proto" in
90e831dc 14997 ''|0) d_setpwent_r=undef
10bc17b6 14998 setpwent_r_proto=0
a48ec845 14999 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15000 * ) case "$setpwent_r_proto" in
15001 REENTRANT_PROTO*) ;;
15002 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15003 esac
15004 echo "Prototype: $try" ;;
15005 esac
15006 ;;
c18e646a
JH
15007 *) case "$usethreads" in
15008 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15009 esac
90e831dc
SB
15010 d_setpwent_r=undef
15011 setpwent_r_proto=0
c18e646a 15012 ;;
a48ec845
JH
15013 esac
15014 ;;
10bc17b6
JH
15015*) setpwent_r_proto=0
15016 ;;
15017esac
15018
b4eb6b3d
JH
15019: see if setregid exists
15020set setregid d_setregid
15021eval $inlibc
15022set setresgid d_setresgid
15023eval $inlibc
15024
15025: see if setreuid exists
15026set setreuid d_setreuid
15027eval $inlibc
15028set setresuid d_setresuid
15029eval $inlibc
15030
15031: see if setrgid exists
15032set setrgid d_setrgid
15033eval $inlibc
15034
15035: see if setruid exists
15036set setruid d_setruid
15037eval $inlibc
15038
15039: see if setservent exists
15040set setservent d_setsent
15041eval $inlibc
15042
10bc17b6
JH
15043: see if setservent_r exists
15044set setservent_r d_setservent_r
15045eval $inlibc
15046case "$d_setservent_r" in
15047"$define")
15048 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
90e831dc
SB
15049 case "netdb" in
15050 time)
15051 hdrs="$hdrs $i_systime sys/time.h"
15052 ;;
15053 esac
c18e646a
JH
15054 case "$d_setservent_r_proto:$usethreads" in
15055 ":define") d_setservent_r_proto=define
a48ec845
JH
15056 set d_setservent_r_proto setservent_r $hdrs
15057 eval $hasproto ;;
15058 *) ;;
15059 esac
15060 case "$d_setservent_r_proto" in
15061 define)
10bc17b6
JH
15062 case "$setservent_r_proto" in
15063 ''|0) try='int setservent_r(int, struct servent_data*);'
15064 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15065 esac
15066 case "$setservent_r_proto" in
15067 ''|0) try='void setservent_r(int, struct servent_data*);'
15068 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15069 esac
15070 case "$setservent_r_proto" in
90e831dc 15071 ''|0) d_setservent_r=undef
10bc17b6 15072 setservent_r_proto=0
a48ec845 15073 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15074 * ) case "$setservent_r_proto" in
15075 REENTRANT_PROTO*) ;;
15076 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15077 esac
15078 echo "Prototype: $try" ;;
15079 esac
15080 ;;
c18e646a
JH
15081 *) case "$usethreads" in
15082 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15083 esac
90e831dc
SB
15084 d_setservent_r=undef
15085 setservent_r_proto=0
c18e646a 15086 ;;
a48ec845
JH
15087 esac
15088 ;;
10bc17b6
JH
15089*) setservent_r_proto=0
15090 ;;
15091esac
15092
b4eb6b3d
JH
15093: see if setsid exists
15094set setsid d_setsid
15095eval $inlibc
15096
15097: see if setvbuf exists
15098set setvbuf d_setvbuf
15099eval $inlibc
15100
15101: see if sfio.h is available
15102set sfio.h i_sfio
15103eval $inhdr
15104
15105
15106: see if sfio library is available
15107case "$i_sfio" in
15108$define)
15109 val=''
15110 set sfreserve val
15111 eval $inlibc
15112 ;;
15113*)
15114 val="$undef"
15115 ;;
15116esac
15117: Ok, but do we want to use it.
15118case "$val" in
15119$define)
15120 case "$usesfio" in
15121 true|$define|[yY]*) dflt='y';;
15122 *) dflt='n';;
15123 esac
15124 echo "$package can use the sfio library, but it is experimental."
15125 case "$useperlio" in
15126 "$undef")
15127 echo "For sfio also the PerlIO abstraction layer is needed."
15128 echo "Earlier you said you wouldn't want that."
15129 ;;
15130 esac
15131 rp="You seem to have sfio available, do you want to try using it?"
15132 . ./myread
15133 case "$ans" in
15134 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
15135 useperlio="$define"
15136 val="$define"
15137 ;;
15138 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
15139 val="$undef"
b4eb6b3d
JH
15140 ;;
15141 esac
15142 ;;
15143*) case "$usesfio" in
15144 true|$define|[yY]*)
15145 echo "Sorry, cannot find sfio on this machine." >&4
15146 echo "Ignoring your setting of usesfio=$usesfio." >&4
15147 val="$undef"
15148 ;;
15149 esac
15150 ;;
15151esac
15152set d_sfio
15153eval $setvar
15154case "$d_sfio" in
15155$define) usesfio='true';;
15156*) usesfio='false';;
15157esac
3659ebf1
JH
15158case "$d_sfio" in
15159$define) ;;
15160*) : Remove sfio from list of libraries to use
7483f793
JH
15161 case "$libs" in
15162 *-lsfio*)
15163 echo "Removing unneeded -lsfio from library list" >&4
15164 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15165 shift
15166 libs="$*"
15167 echo "libs = $libs" >&4
15168 ;;
15169 esac
3659ebf1
JH
15170;;
15171esac
15172
b4eb6b3d
JH
15173
15174: see if shmctl exists
15175set shmctl d_shmctl
15176eval $inlibc
15177
15178: see if shmget exists
15179set shmget d_shmget
15180eval $inlibc
15181
15182: see if shmat exists
15183set shmat d_shmat
15184eval $inlibc
15185: see what shmat returns
15186case "$d_shmat" in
15187"$define")
15188 $cat >shmat.c <<'END'
15189#include <sys/shm.h>
15190void *shmat();
15191END
15192 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15193 shmattype='void *'
15194 else
15195 shmattype='char *'
15196 fi
15197 echo "and it returns ($shmattype)." >&4
15198 : see if a prototype for shmat is available
15199 xxx=`./findhdr sys/shm.h`
15200 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15201 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15202 val="$define"
15203 else
15204 val="$undef"
15205 fi
15206 $rm -f shmat.[co]
15207 ;;
15208*)
15209 val="$undef"
15210 ;;
15211esac
15212set d_shmatprototype
15213eval $setvar
15214
15215: see if shmdt exists
15216set shmdt d_shmdt
15217eval $inlibc
15218
15219: see how much of the 'shm*(2)' library is present.
15220h_shm=true
15221echo " "
15222case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15223*"$undef"*) h_shm=false;;
15224esac
15225case "$osname" in
15226freebsd)
15227 case "`ipcs 2>&1`" in
15228 "SVID shared memory"*"not configured"*)
15229 echo "Your $osname does not have the shm*(2) configured." >&4
15230 h_shm=false
15231 val="$undef"
15232 set shmctl d_shmctl
15233 evat $setvar
15234 set shmget d_shmget
15235 evat $setvar
15236 set shmat d_shmat
15237 evat $setvar
15238 set shmdt d_shmdt
15239 evat $setvar
15240 ;;
15241 esac
15242 ;;
15243esac
15244: we could also check for sys/ipc.h ...
15245if $h_shm && $test `./findhdr sys/shm.h`; then
15246 echo "You have the full shm*(2) library." >&4
15247 val="$define"
15248else
15249 echo "You don't have the full shm*(2) library." >&4
15250 val="$undef"
15251fi
15252set d_shm
15253eval $setvar
15254
15255echo " "
15256: see if we have sigaction
15257if set sigaction val -f d_sigaction; eval $csym; $val; then
15258 echo 'sigaction() found.' >&4
15259 $cat > try.c <<'EOP'
15260#include <stdio.h>
15261#include <sys/types.h>
15262#include <signal.h>
15263int main()
15264{
15265 struct sigaction act, oact;
15266 act.sa_flags = 0;
15267 oact.sa_handler = 0;
15268 /* so that act and oact are used */
15269 exit(act.sa_flags == 0 && oact.sa_handler == 0);
15270}
15271EOP
15272 set try
15273 if eval $compile_ok; then
15274 val="$define"
15275 else
15276 echo "But you don't seem to have a useable struct sigaction." >&4
15277 val="$undef"
15278 fi
15279else
15280 echo 'sigaction NOT found.' >&4
15281 val="$undef"
15282fi
15283set d_sigaction; eval $setvar
15284$rm -f try try$_o try.c
15285
983dbef6
JH
15286: see if sigprocmask exists
15287set sigprocmask d_sigprocmask
15288eval $inlibc
15289
b4eb6b3d
JH
15290: see if sigsetjmp exists
15291echo " "
15292case "$d_sigsetjmp" in
15293'')
15294 $cat >try.c <<'EOP'
15295#include <setjmp.h>
15296sigjmp_buf env;
15297int set = 1;
15298int main()
15299{
15300 if (sigsetjmp(env,1))
15301 exit(set);
15302 set = 0;
15303 siglongjmp(env, 1);
15304 exit(1);
15305}
15306EOP
15307 set try
15308 if eval $compile; then
5440bc8e 15309 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
15310 echo "POSIX sigsetjmp found." >&4
15311 val="$define"
15312 else
15313 $cat >&4 <<EOM
15314Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15315I'll ignore them.
15316EOM
15317 val="$undef"
15318 fi
15319 else
15320 echo "sigsetjmp not found." >&4
15321 val="$undef"
15322 fi
15323 ;;
15324*) val="$d_sigsetjmp"
15325 case "$d_sigsetjmp" in
15326 $define) echo "POSIX sigsetjmp found." >&4;;
15327 $undef) echo "sigsetjmp not found." >&4;;
15328 esac
15329 ;;
15330esac
15331set d_sigsetjmp
15332eval $setvar
15333$rm -f try.c try
15334
49a78c82
JH
15335: see if sockatmark exists
15336set sockatmark d_sockatmark
15337eval $inlibc
15338
2ef53570
JH
15339: see if prototype for sockatmark is available
15340echo " "
15341set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15342eval $hasproto
15343
b4eb6b3d
JH
15344: see if socks5_init exists
15345set socks5_init d_socks5_init
15346eval $inlibc
15347
10bc17b6
JH
15348: see if srand48_r exists
15349set srand48_r d_srand48_r
15350eval $inlibc
15351case "$d_srand48_r" in
15352"$define")
15353 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
90e831dc
SB
15354 case "stdlib" in
15355 time)
15356 hdrs="$hdrs $i_systime sys/time.h"
15357 ;;
15358 esac
c18e646a
JH
15359 case "$d_srand48_r_proto:$usethreads" in
15360 ":define") d_srand48_r_proto=define
a48ec845
JH
15361 set d_srand48_r_proto srand48_r $hdrs
15362 eval $hasproto ;;
15363 *) ;;
15364 esac
15365 case "$d_srand48_r_proto" in
15366 define)
10bc17b6
JH
15367 case "$srand48_r_proto" in
15368 ''|0) try='int srand48_r(long, struct drand48_data*);'
15369 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15370 esac
15371 case "$srand48_r_proto" in
90e831dc 15372 ''|0) d_srand48_r=undef
10bc17b6 15373 srand48_r_proto=0
a48ec845 15374 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15375 * ) case "$srand48_r_proto" in
15376 REENTRANT_PROTO*) ;;
15377 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15378 esac
15379 echo "Prototype: $try" ;;
15380 esac
15381 ;;
c18e646a
JH
15382 *) case "$usethreads" in
15383 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15384 esac
90e831dc
SB
15385 d_srand48_r=undef
15386 srand48_r_proto=0
c18e646a 15387 ;;
a48ec845
JH
15388 esac
15389 ;;
10bc17b6
JH
15390*) srand48_r_proto=0
15391 ;;
15392esac
15393
15394: see if srandom_r exists
15395set srandom_r d_srandom_r
15396eval $inlibc
15397case "$d_srandom_r" in
15398"$define")
15399 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
90e831dc
SB
15400 case "stdlib" in
15401 time)
15402 hdrs="$hdrs $i_systime sys/time.h"
15403 ;;
15404 esac
c18e646a
JH
15405 case "$d_srandom_r_proto:$usethreads" in
15406 ":define") d_srandom_r_proto=define
a48ec845
JH
15407 set d_srandom_r_proto srandom_r $hdrs
15408 eval $hasproto ;;
15409 *) ;;
15410 esac
15411 case "$d_srandom_r_proto" in
15412 define)
10bc17b6
JH
15413 case "$srandom_r_proto" in
15414 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15415 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15416 esac
15417 case "$srandom_r_proto" in
90e831dc 15418 ''|0) d_srandom_r=undef
10bc17b6 15419 srandom_r_proto=0
a48ec845 15420 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15421 * ) case "$srandom_r_proto" in
15422 REENTRANT_PROTO*) ;;
15423 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15424 esac
15425 echo "Prototype: $try" ;;
15426 esac
15427 ;;
c18e646a
JH
15428 *) case "$usethreads" in
15429 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15430 esac
90e831dc
SB
15431 d_srandom_r=undef
15432 srandom_r_proto=0
c18e646a 15433 ;;
a48ec845
JH
15434 esac
15435 ;;
10bc17b6
JH
15436*) srandom_r_proto=0
15437 ;;
15438esac
15439
eef837ea
JH
15440: see if prototype for setresgid is available
15441echo " "
15442set d_sresgproto setresgid $i_unistd unistd.h
15443eval $hasproto
15444
640374d0
JH
15445: see if prototype for setresuid is available
15446echo " "
15447set d_sresuproto setresuid $i_unistd unistd.h
15448eval $hasproto
15449
b4eb6b3d
JH
15450: see if sys/stat.h is available
15451set sys/stat.h i_sysstat
15452eval $inhdr
15453
15454
15455: see if stat knows about block sizes
15456echo " "
15457echo "Checking to see if your struct stat has st_blocks field..." >&4
15458set d_statblks stat st_blocks $i_sysstat sys/stat.h
15459eval $hasfield
15460
15461
15462: see if this is a sys/vfs.h system
15463set sys/vfs.h i_sysvfs
15464eval $inhdr
15465
15466
15467: see if this is a sys/statfs.h system
15468set sys/statfs.h i_sysstatfs
15469eval $inhdr
15470
15471
15472echo " "
15473echo "Checking to see if your system supports struct statfs..." >&4
15474set 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
15475eval $hasstruct
15476case "$d_statfs_s" in
15477"$define") echo "Yes, it does." ;;
15478*) echo "No, it doesn't." ;;
15479esac
15480
15481
15482
15483: see if struct statfs knows about f_flags
15484case "$d_statfs_s" in
15485define)
15486 echo " "
15487 echo "Checking to see if your struct statfs has f_flags field..." >&4
15488 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
15489 eval $hasfield
15490 ;;
15491*) val="$undef"
15492 set d_statfs_f_flags
15493 eval $setvar
15494 ;;
15495esac
15496case "$d_statfs_f_flags" in
15497"$define") echo "Yes, it does." ;;
15498*) echo "No, it doesn't." ;;
15499esac
15500
15501: see if _ptr and _cnt from stdio act std
15502echo " "
80f36755
NC
15503
15504if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15505 echo "(Looks like you have stdio.h from BSD.)"
15506 case "$stdio_ptr" in
15507 '') stdio_ptr='((fp)->_p)'
15508 ptr_lval=$define
15509 ;;
15510 *) ptr_lval=$d_stdio_ptr_lval;;
15511 esac
15512 case "$stdio_cnt" in
15513 '') stdio_cnt='((fp)->_r)'
15514 cnt_lval=$define
15515 ;;
15516 *) cnt_lval=$d_stdio_cnt_lval;;
15517 esac
15518 case "$stdio_base" in
15519 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15520 esac
15521 case "$stdio_bufsiz" in
15522 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15523 esac
15524elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
15525 echo "(Looks like you have stdio.h from Linux.)"
15526 case "$stdio_ptr" in
15527 '') stdio_ptr='((fp)->_IO_read_ptr)'
15528 ptr_lval=$define
15529 ;;
15530 *) ptr_lval=$d_stdio_ptr_lval;;
15531 esac
15532 case "$stdio_cnt" in
15533 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15534 cnt_lval=$undef
15535 ;;
15536 *) cnt_lval=$d_stdio_cnt_lval;;
15537 esac
15538 case "$stdio_base" in
15539 '') stdio_base='((fp)->_IO_read_base)';;
15540 esac
15541 case "$stdio_bufsiz" in
15542 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15543 esac
15544else
15545 case "$stdio_ptr" in
15546 '') stdio_ptr='((fp)->_ptr)'
15547 ptr_lval=$define
15548 ;;
15549 *) ptr_lval=$d_stdio_ptr_lval;;
15550 esac
15551 case "$stdio_cnt" in
15552 '') stdio_cnt='((fp)->_cnt)'
15553 cnt_lval=$define
15554 ;;
15555 *) cnt_lval=$d_stdio_cnt_lval;;
15556 esac
15557 case "$stdio_base" in
15558 '') stdio_base='((fp)->_base)';;
15559 esac
15560 case "$stdio_bufsiz" in
15561 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15562 esac
15563fi
80f36755 15564
b4eb6b3d
JH
15565: test whether _ptr and _cnt really work
15566echo "Checking how std your stdio is..." >&4
15567$cat >try.c <<EOP
15568#include <stdio.h>
15569#define FILE_ptr(fp) $stdio_ptr
15570#define FILE_cnt(fp) $stdio_cnt
15571int main() {
15572 FILE *fp = fopen("try.c", "r");
15573 char c = getc(fp);
15574 if (
15575 18 <= FILE_cnt(fp) &&
15576 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15577 )
15578 exit(0);
15579 exit(1);
15580}
15581EOP
15582val="$undef"
15583set try
5440bc8e
JH
15584if eval $compile && $to try.c; then
15585 if $run ./try; then
b4eb6b3d
JH
15586 echo "Your stdio acts pretty std."
15587 val="$define"
15588 else
15589 echo "Your stdio isn't very std."
15590 fi
15591else
15592 echo "Your stdio doesn't appear very std."
15593fi
15594$rm -f try.c try
15595set d_stdstdio
15596eval $setvar
15597
15598: Can _ptr be used as an lvalue?
15599case "$d_stdstdio$ptr_lval" in
15600$define$define) val=$define ;;
15601*) val=$undef ;;
15602esac
15603set d_stdio_ptr_lval
15604eval $setvar
15605
15606: Can _cnt be used as an lvalue?
15607case "$d_stdstdio$cnt_lval" in
15608$define$define) val=$define ;;
15609*) val=$undef ;;
15610esac
15611set d_stdio_cnt_lval
15612eval $setvar
15613
a7ffa9b9
NC
15614
15615: test whether setting _ptr sets _cnt as a side effect
15616d_stdio_ptr_lval_sets_cnt="$undef"
15617d_stdio_ptr_lval_nochange_cnt="$undef"
15618case "$d_stdio_ptr_lval$d_stdstdio" in
15619$define$define)
15620 echo "Checking to see what happens if we set the stdio ptr..." >&4
15621$cat >try.c <<EOP
15622#include <stdio.h>
15623/* Can we scream? */
15624/* Eat dust sed :-) */
c1d9e6fa 15625/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
15626#define FILE_ptr(fp) $stdio_ptr
15627#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 15628#include <sys/types.h>
a7ffa9b9
NC
15629int main() {
15630 FILE *fp = fopen("try.c", "r");
c1d9e6fa 15631 int c;
a7ffa9b9
NC
15632 char *ptr;
15633 size_t cnt;
c1d9e6fa
JH
15634 if (!fp) {
15635 puts("Fail even to read");
15636 exit(1);
15637 }
15638 c = getc(fp); /* Read away the first # */
15639 if (c == EOF) {
15640 puts("Fail even to read");
15641 exit(1);
15642 }
a7ffa9b9
NC
15643 if (!(
15644 18 <= FILE_cnt(fp) &&
15645 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15646 )) {
15647 puts("Fail even to read");
15648 exit (1);
15649 }
c1d9e6fa
JH
15650 ptr = (char*) FILE_ptr(fp);
15651 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 15652
c1d9e6fa 15653 FILE_ptr(fp) += 42;
a7ffa9b9 15654
c1d9e6fa 15655 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
15656 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15657 exit (1);
15658 }
15659 if (FILE_cnt(fp) <= 20) {
15660 printf ("Fail (<20 chars to test)");
15661 exit (1);
15662 }
15663 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15664 puts("Fail compare");
15665 exit (1);
15666 }
15667 if (cnt == FILE_cnt(fp)) {
15668 puts("Pass_unchanged");
15669 exit (0);
15670 }
15671 if (FILE_cnt(fp) == (cnt - 42)) {
15672 puts("Pass_changed");
15673 exit (0);
15674 }
15675 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15676 return 1;
15677
15678}
15679EOP
15680 set try
5440bc8e
JH
15681 if eval $compile && $to try.c; then
15682 case `$run ./try` in
a7ffa9b9 15683 Pass_changed)
2e32dcfe 15684 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
15685 d_stdio_ptr_lval_sets_cnt="$define" ;;
15686 Pass_unchanged)
15687 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
15688 d_stdio_ptr_lval_nochange_cnt="$define" ;;
15689 Fail*)
15690 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
15691 *)
15692 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15693 esac
15694 else
15695 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
15696 fi
15697 $rm -f try.c try
15698 ;;
15699esac
15700
b4eb6b3d
JH
15701: see if _base is also standard
15702val="$undef"
15703case "$d_stdstdio" in
15704$define)
15705 $cat >try.c <<EOP
15706#include <stdio.h>
15707#define FILE_base(fp) $stdio_base
15708#define FILE_bufsiz(fp) $stdio_bufsiz
15709int main() {
15710 FILE *fp = fopen("try.c", "r");
15711 char c = getc(fp);
15712 if (
15713 19 <= FILE_bufsiz(fp) &&
15714 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15715 )
15716 exit(0);
15717 exit(1);
15718}
15719EOP
15720 set try
5440bc8e
JH
15721 if eval $compile && $to try.c; then
15722 if $run ./try; then
b4eb6b3d
JH
15723 echo "And its _base field acts std."
15724 val="$define"
15725 else
15726 echo "But its _base field isn't std."
15727 fi
15728 else
15729 echo "However, it seems to be lacking the _base field."
15730 fi
15731 $rm -f try.c try
15732 ;;
15733esac
15734set d_stdiobase
15735eval $setvar
15736
15737$cat >&4 <<EOM
15738Checking how to access stdio streams by file descriptor number...
15739EOM
15740case "$stdio_stream_array" in
15741'') $cat >try.c <<EOCP
15742#include <stdio.h>
15743int main() {
15744 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15745 printf("yes\n");
15746}
15747EOCP
15748 for s in _iob __iob __sF
15749 do
15750 set try -DSTDIO_STREAM_ARRAY=$s
15751 if eval $compile; then
5440bc8e 15752 case "`$run ./try`" in
b4eb6b3d
JH
15753 yes) stdio_stream_array=$s; break ;;
15754 esac
15755 fi
15756 done
15757 $rm -f try.* try$exe_ext
15758esac
15759case "$stdio_stream_array" in
15760'') $cat >&4 <<EOM
15761I can't figure out how to access stdio streams by file descriptor number.
15762EOM
15763 d_stdio_stream_array="$undef"
15764 ;;
15765*) $cat >&4 <<EOM
15766You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15767EOM
15768 d_stdio_stream_array="$define"
15769 ;;
15770esac
15771
15772: see if strcoll exists
15773set strcoll d_strcoll
15774eval $inlibc
15775
15776: check for structure copying
15777echo " "
15778echo "Checking to see if your C compiler can copy structs..." >&4
15779$cat >try.c <<'EOCP'
15780int main()
15781{
15782 struct blurfl {
15783 int dyick;
15784 } foo, bar;
15785
15786 foo = bar;
15787}
15788EOCP
15789if $cc -c try.c >/dev/null 2>&1 ; then
15790 val="$define"
15791 echo "Yup, it can."
15792else
15793 val="$undef"
15794 echo "Nope, it can't."
15795fi
15796set d_strctcpy
15797eval $setvar
15798$rm -f try.*
15799
15800: see if strerror and/or sys_errlist[] exist
15801echo " "
15802if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15803 if set strerror val -f d_strerror; eval $csym; $val; then
15804 echo 'strerror() found.' >&4
15805 d_strerror="$define"
15806 d_strerrm='strerror(e)'
15807 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15808 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
15809 d_syserrlst="$define"
15810 else
15811 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15812 d_syserrlst="$undef"
15813 fi
15814 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15815 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15816 echo 'strerror() found in string header.' >&4
15817 d_strerror="$define"
15818 d_strerrm='strerror(e)'
15819 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15820 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15821 d_syserrlst="$define"
15822 else
15823 echo "(You don't appear to have any sys_errlist[], how can this be?)"
15824 d_syserrlst="$undef"
15825 fi
15826 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15827 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15828 d_strerror="$undef"
15829 d_syserrlst="$define"
15830 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15831 else
15832 echo 'strerror() and sys_errlist[] NOT found.' >&4
15833 d_strerror="$undef"
15834 d_syserrlst="$undef"
15835 d_strerrm='"unknown"'
15836 fi
15837fi
15838
10bc17b6
JH
15839: see if strerror_r exists
15840set strerror_r d_strerror_r
15841eval $inlibc
15842case "$d_strerror_r" in
15843"$define")
15844 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
90e831dc
SB
15845 case "string" in
15846 time)
15847 hdrs="$hdrs $i_systime sys/time.h"
15848 ;;
15849 esac
c18e646a
JH
15850 case "$d_strerror_r_proto:$usethreads" in
15851 ":define") d_strerror_r_proto=define
a48ec845
JH
15852 set d_strerror_r_proto strerror_r $hdrs
15853 eval $hasproto ;;
15854 *) ;;
15855 esac
15856 case "$d_strerror_r_proto" in
15857 define)
10bc17b6
JH
15858 case "$strerror_r_proto" in
15859 ''|0) try='int strerror_r(int, char*, size_t);'
15860 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15861 esac
15862 case "$strerror_r_proto" in
15863 ''|0) try='int strerror_r(int, char*, int);'
15864 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15865 esac
15866 case "$strerror_r_proto" in
15867 ''|0) try='char* strerror_r(int, char*, size_t);'
15868 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15869 esac
15870 case "$strerror_r_proto" in
90e831dc 15871 ''|0) d_strerror_r=undef
10bc17b6 15872 strerror_r_proto=0
a48ec845 15873 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15874 * ) case "$strerror_r_proto" in
15875 REENTRANT_PROTO*) ;;
15876 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15877 esac
15878 echo "Prototype: $try" ;;
15879 esac
15880 ;;
c18e646a
JH
15881 *) case "$usethreads" in
15882 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15883 esac
90e831dc
SB
15884 d_strerror_r=undef
15885 strerror_r_proto=0
c18e646a 15886 ;;
a48ec845
JH
15887 esac
15888 ;;
10bc17b6
JH
15889*) strerror_r_proto=0
15890 ;;
15891esac
15892
b3c85772
JH
15893: see if strftime exists
15894set strftime d_strftime
15895eval $inlibc
15896
b4eb6b3d
JH
15897: see if strtod exists
15898set strtod d_strtod
15899eval $inlibc
15900
15901: see if strtol exists
15902set strtol d_strtol
15903eval $inlibc
15904
15905: see if strtold exists
15906set strtold d_strtold
15907eval $inlibc
15908
15909: see if strtoll exists
15910set strtoll d_strtoll
15911eval $inlibc
15912
15913case "$d_longlong-$d_strtoll" in
15914"$define-$define")
15915 $cat <<EOM
15916Checking whether your strtoll() works okay...
15917EOM
15918 $cat >try.c <<'EOCP'
15919#include <errno.h>
15920#ifdef __hpux
15921#define strtoll __strtoll
15922#endif
e75931a7
YST
15923#ifdef __EMX__
15924#define strtoll _strtoll
15925#endif
b4eb6b3d
JH
15926#include <stdio.h>
15927extern long long int strtoll(char *s, char **, int);
15928static int bad = 0;
15929int check(char *s, long long ell, int een) {
15930 long long gll;
15931 errno = 0;
15932 gll = strtoll(s, 0, 10);
15933 if (!((gll == ell) && (errno == een)))
15934 bad++;
15935}
15936int main() {
15937 check(" 1", 1LL, 0);
15938 check(" 0", 0LL, 0);
15939 check("-1", -1LL, 0);
15940 check("-9223372036854775808", -9223372036854775808LL, 0);
15941 check("-9223372036854775808", -9223372036854775808LL, 0);
15942 check(" 9223372036854775807", 9223372036854775807LL, 0);
15943 check("-9223372036854775808", -9223372036854775808LL, 0);
15944 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
15945 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15946 if (!bad)
15947 printf("ok\n");
15948}
15949EOCP
15950 set try
15951 if eval $compile; then
5440bc8e 15952 yyy=`$run ./try`
e75931a7 15953 case "$yyy" in
b4eb6b3d
JH
15954 ok) echo "Your strtoll() seems to be working okay." ;;
15955 *) cat <<EOM >&4
15956Your strtoll() doesn't seem to be working okay.
15957EOM
15958 d_strtoll="$undef"
15959 ;;
69eadf66 15960 esac
e75931a7
YST
15961 else
15962 echo "(I can't seem to compile the test program--assuming it doesn't)"
15963 d_strtoll="$undef"
b4eb6b3d
JH
15964 fi
15965 ;;
15966esac
15967
28e5dec8
JH
15968: see if strtoq exists
15969set strtoq d_strtoq
15970eval $inlibc
15971
b4eb6b3d
JH
15972: see if strtoul exists
15973set strtoul d_strtoul
15974eval $inlibc
15975
d0e6d399
NC
15976case "$d_strtoul" in
15977"$define")
15978 $cat <<EOM
15979Checking whether your strtoul() works okay...
15980EOM
15981 $cat >try.c <<'EOCP'
15982#include <errno.h>
15983#include <stdio.h>
15984extern unsigned long int strtoul(char *s, char **, int);
15985static int bad = 0;
15986void check(char *s, unsigned long eul, int een) {
15987 unsigned long gul;
15988 errno = 0;
15989 gul = strtoul(s, 0, 10);
15990 if (!((gul == eul) && (errno == een)))
15991 bad++;
15992}
15993int main() {
15994 check(" 1", 1L, 0);
15995 check(" 0", 0L, 0);
15996EOCP
15997 case "$longsize" in
15998 8)
15999 $cat >>try.c <<'EOCP'
09c0d2c4
JH
16000 check("18446744073709551615", 18446744073709551615UL, 0);
16001 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 16002#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 16003 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
16004 check("-18446744073709551614", 2, 0);
16005 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
16006 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16007 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 16008#endif
d0e6d399
NC
16009EOCP
16010 ;;
16011 4)
16012 $cat >>try.c <<'EOCP'
16013 check("4294967295", 4294967295UL, 0);
16014 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 16015#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
16016 check("-1", 4294967295UL, 0);
16017 check("-4294967294", 2, 0);
16018 check("-4294967295", 1, 0);
16019 check("-4294967296", 4294967295UL, ERANGE);
16020 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 16021#endif
d0e6d399
NC
16022EOCP
16023 ;;
16024 *)
16025: Should we write these tests to be more portable by sprintf-ing
16026: ~0 and then manipulating that char string as input for strtol?
16027 ;;
16028 esac
16029 $cat >>try.c <<'EOCP'
16030 if (!bad)
16031 printf("ok\n");
16032 return 0;
16033}
16034EOCP
16035 set try
16036 if eval $compile; then
5440bc8e 16037 case "`$run ./try`" in
d0e6d399
NC
16038 ok) echo "Your strtoul() seems to be working okay." ;;
16039 *) cat <<EOM >&4
16040Your strtoul() doesn't seem to be working okay.
16041EOM
16042 d_strtoul="$undef"
16043 ;;
16044 esac
16045 fi
16046 ;;
16047esac
16048
b4eb6b3d
JH
16049: see if strtoull exists
16050set strtoull d_strtoull
16051eval $inlibc
16052
16053case "$d_longlong-$d_strtoull" in
16054"$define-$define")
16055 $cat <<EOM
16056Checking whether your strtoull() works okay...
16057EOM
16058 $cat >try.c <<'EOCP'
16059#include <errno.h>
16060#ifdef __hpux
16061#define strtoull __strtoull
16062#endif
16063#include <stdio.h>
16064extern unsigned long long int strtoull(char *s, char **, int);
16065static int bad = 0;
16066int check(char *s, long long eull, int een) {
16067 long long gull;
16068 errno = 0;
16069 gull = strtoull(s, 0, 10);
16070 if (!((gull == eull) && (errno == een)))
16071 bad++;
16072}
16073int main() {
d0e6d399
NC
16074 check(" 1", 1LL, 0);
16075 check(" 0", 0LL, 0);
16076 check("18446744073709551615", 18446744073709551615ULL, 0);
16077 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16078#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
16079 check("-1", 18446744073709551615ULL, 0);
16080 check("-18446744073709551614", 2LL, 0);
16081 check("-18446744073709551615", 1LL, 0);
16082 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16083 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16084#endif
b4eb6b3d
JH
16085 if (!bad)
16086 printf("ok\n");
16087}
16088EOCP
16089 set try
16090 if eval $compile; then
5440bc8e 16091 case "`$run ./try`" in
b4eb6b3d
JH
16092 ok) echo "Your strtoull() seems to be working okay." ;;
16093 *) cat <<EOM >&4
16094Your strtoull() doesn't seem to be working okay.
16095EOM
16096 d_strtoull="$undef"
16097 ;;
16098 esac
16099 fi
16100 ;;
16101esac
16102
16103: see if strtouq exists
16104set strtouq d_strtouq
16105eval $inlibc
16106
d0e6d399
NC
16107case "$d_strtouq" in
16108"$define")
16109 $cat <<EOM
16110Checking whether your strtouq() works okay...
16111EOM
16112 $cat >try.c <<'EOCP'
16113#include <errno.h>
16114#include <stdio.h>
16115extern unsigned long long int strtouq(char *s, char **, int);
16116static int bad = 0;
16117void check(char *s, unsigned long long eull, int een) {
16118 unsigned long long gull;
16119 errno = 0;
16120 gull = strtouq(s, 0, 10);
16121 if (!((gull == eull) && (errno == een)))
16122 bad++;
16123}
16124int main() {
16125 check(" 1", 1LL, 0);
16126 check(" 0", 0LL, 0);
16127 check("18446744073709551615", 18446744073709551615ULL, 0);
16128 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16129#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
16130 check("-1", 18446744073709551615ULL, 0);
16131 check("-18446744073709551614", 2LL, 0);
16132 check("-18446744073709551615", 1LL, 0);
16133 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16134 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16135#endif
d0e6d399
NC
16136 if (!bad)
16137 printf("ok\n");
16138 return 0;
16139}
16140EOCP
16141 set try
16142 if eval $compile; then
5440bc8e 16143 case "`$run ./try`" in
d0e6d399
NC
16144 ok) echo "Your strtouq() seems to be working okay." ;;
16145 *) cat <<EOM >&4
16146Your strtouq() doesn't seem to be working okay.
16147EOM
16148 d_strtouq="$undef"
16149 ;;
16150 esac
16151 fi
16152 ;;
16153esac
16154
b4eb6b3d
JH
16155: see if strxfrm exists
16156set strxfrm d_strxfrm
16157eval $inlibc
16158
16159: see if symlink exists
16160set symlink d_symlink
16161eval $inlibc
16162
16163: see if syscall exists
16164set syscall d_syscall
16165eval $inlibc
16166
2ef53570
JH
16167: see if prototype for syscall is available
16168echo " "
16169set d_syscallproto syscall $i_unistd unistd.h
16170eval $hasproto
16171
b4eb6b3d
JH
16172: see if sysconf exists
16173set sysconf d_sysconf
16174eval $inlibc
16175
16176: see if system exists
16177set system d_system
16178eval $inlibc
16179
16180: see if tcgetpgrp exists
16181set tcgetpgrp d_tcgetpgrp
16182eval $inlibc
16183
16184: see if tcsetpgrp exists
16185set tcsetpgrp d_tcsetpgrp
16186eval $inlibc
16187
16188: see if prototype for telldir is available
16189echo " "
16190set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16191eval $hasproto
16192
ad493445
MB
16193: see if time exists
16194echo " "
16195if test "X$d_time" = X -o X"$timetype" = X; then
16196 if set time val -f d_time; eval $csym; $val; then
16197 echo 'time() found.' >&4
16198 val="$define"
16199 rp="What is the type returned by time() on this system?"
16200 set time_t timetype long stdio.h sys/types.h
16201 eval $typedef_ask
16202 else
16203 echo 'time() not found, hope that will do.' >&4
16204 val="$undef"
16205 timetype='int';
16206 fi
16207 set d_time
16208 eval $setvar
16209fi
16210
b4eb6b3d
JH
16211: see if this is a sys/times.h system
16212set sys/times.h i_systimes
16213eval $inhdr
16214
16215: see if times exists
16216echo " "
16217if set times val -f d_times; eval $csym; $val; then
16218 echo 'times() found.' >&4
16219 d_times="$define"
16220 inc=''
16221 case "$i_systimes" in
16222 "$define") inc='sys/times.h';;
16223 esac
16224 rp="What is the type returned by times() on this system?"
16225 set clock_t clocktype long stdio.h sys/types.h $inc
16226 eval $typedef_ask
16227else
16228 echo 'times() NOT found, hope that will do.' >&4
16229 d_times="$undef"
16230 clocktype='int'
16231fi
16232
10bc17b6
JH
16233: see if tmpnam_r exists
16234set tmpnam_r d_tmpnam_r
16235eval $inlibc
16236case "$d_tmpnam_r" in
16237"$define")
31ee0cb7 16238 hdrs="$i_systypes sys/types.h define stdio.h "
90e831dc
SB
16239 case "stdio" in
16240 time)
16241 hdrs="$hdrs $i_systime sys/time.h"
16242 ;;
16243 esac
c18e646a
JH
16244 case "$d_tmpnam_r_proto:$usethreads" in
16245 ":define") d_tmpnam_r_proto=define
a48ec845
JH
16246 set d_tmpnam_r_proto tmpnam_r $hdrs
16247 eval $hasproto ;;
16248 *) ;;
16249 esac
16250 case "$d_tmpnam_r_proto" in
16251 define)
10bc17b6
JH
16252 case "$tmpnam_r_proto" in
16253 ''|0) try='char* tmpnam_r(char*);'
16254 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16255 esac
16256 case "$tmpnam_r_proto" in
90e831dc 16257 ''|0) d_tmpnam_r=undef
10bc17b6 16258 tmpnam_r_proto=0
a48ec845 16259 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16260 * ) case "$tmpnam_r_proto" in
16261 REENTRANT_PROTO*) ;;
16262 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16263 esac
16264 echo "Prototype: $try" ;;
16265 esac
16266 ;;
c18e646a
JH
16267 *) case "$usethreads" in
16268 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16269 esac
90e831dc
SB
16270 d_tmpnam_r=undef
16271 tmpnam_r_proto=0
c18e646a 16272 ;;
a48ec845
JH
16273 esac
16274 ;;
10bc17b6
JH
16275*) tmpnam_r_proto=0
16276 ;;
16277esac
16278
b4eb6b3d
JH
16279: see if truncate exists
16280set truncate d_truncate
16281eval $inlibc
16282
10bc17b6
JH
16283: see if ttyname_r exists
16284set ttyname_r d_ttyname_r
16285eval $inlibc
16286case "$d_ttyname_r" in
16287"$define")
16288 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
90e831dc
SB
16289 case "unistd" in
16290 time)
16291 hdrs="$hdrs $i_systime sys/time.h"
16292 ;;
16293 esac
c18e646a
JH
16294 case "$d_ttyname_r_proto:$usethreads" in
16295 ":define") d_ttyname_r_proto=define
a48ec845
JH
16296 set d_ttyname_r_proto ttyname_r $hdrs
16297 eval $hasproto ;;
16298 *) ;;
16299 esac
16300 case "$d_ttyname_r_proto" in
16301 define)
10bc17b6
JH
16302 case "$ttyname_r_proto" in
16303 ''|0) try='int ttyname_r(int, char*, size_t);'
16304 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16305 esac
16306 case "$ttyname_r_proto" in
16307 ''|0) try='int ttyname_r(int, char*, int);'
16308 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16309 esac
16310 case "$ttyname_r_proto" in
16311 ''|0) try='char* ttyname_r(int, char*, int);'
16312 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16313 esac
16314 case "$ttyname_r_proto" in
90e831dc 16315 ''|0) d_ttyname_r=undef
10bc17b6 16316 ttyname_r_proto=0
a48ec845 16317 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16318 * ) case "$ttyname_r_proto" in
16319 REENTRANT_PROTO*) ;;
16320 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16321 esac
16322 echo "Prototype: $try" ;;
16323 esac
16324 ;;
c18e646a
JH
16325 *) case "$usethreads" in
16326 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16327 esac
90e831dc
SB
16328 d_ttyname_r=undef
16329 ttyname_r_proto=0
c18e646a 16330 ;;
a48ec845
JH
16331 esac
16332 ;;
10bc17b6
JH
16333*) ttyname_r_proto=0
16334 ;;
16335esac
16336
b4eb6b3d
JH
16337: see if tzname[] exists
16338echo " "
16339if set tzname val -a d_tzname; eval $csym; $val; then
16340 val="$define"
16341 echo 'tzname[] found.' >&4
16342else
16343 val="$undef"
16344 echo 'tzname[] NOT found.' >&4
16345fi
16346set d_tzname
16347eval $setvar
16348
4e0554ec
JH
16349case "$osname" in
16350next|rhapsody|darwin) multiarch="$define" ;;
16351esac
16352case "$multiarch" in
16353''|[nN]*) multiarch="$undef" ;;
16354esac
16355
16356: check for ordering of bytes in a long
16357echo " "
5440bc8e 16358case "$usecrosscompile$multiarch" in
4e0554ec
JH
16359*$define*)
16360 $cat <<EOM
16361You seem to be either cross-compiling or doing a multiarchitecture build,
16362skipping the byteorder check.
16363
16364EOM
5440bc8e 16365 byteorder='ffff'
4e0554ec
JH
16366 ;;
16367*)
16368 case "$byteorder" in
16369 '')
16370 $cat <<'EOM'
16371In the following, larger digits indicate more significance. A big-endian
16372machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16373little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16374machines may have weird orders like 3412. A Cray will report 87654321,
16375an Alpha will report 12345678. If the test program works the default is
16376probably right.
16377I'm now running the test program...
16378EOM
16379 $cat >try.c <<'EOCP'
16380#include <stdio.h>
16381int main()
16382{
16383 int i;
16384 union {
16385 unsigned long l;
16386 char c[sizeof(long)];
16387 } u;
16388
16389 if (sizeof(long) > 4)
16390 u.l = (0x08070605L << 32) | 0x04030201L;
16391 else
16392 u.l = 0x04030201L;
16393 for (i = 0; i < sizeof(long); i++)
16394 printf("%c", u.c[i]+'0');
16395 printf("\n");
16396 exit(0);
16397}
16398EOCP
16399 xxx_prompt=y
16400 set try
16401 if eval $compile && ./try > /dev/null; then
5440bc8e 16402 dflt=`$run ./try`
4e0554ec
JH
16403 case "$dflt" in
16404 [1-4][1-4][1-4][1-4]|12345678|87654321)
16405 echo "(The test program ran ok.)"
16406 echo "byteorder=$dflt"
16407 xxx_prompt=n
16408 ;;
16409 ????|????????) echo "(The test program ran ok.)" ;;
16410 *) echo "(The test program didn't run right for some reason.)" ;;
16411 esac
16412 else
16413 dflt='4321'
16414 cat <<'EOM'
16415(I can't seem to compile the test program. Guessing big-endian...)
16416EOM
16417 fi
16418 case "$xxx_prompt" in
16419 y)
16420 rp="What is the order of bytes in a long?"
16421 . ./myread
16422 byteorder="$ans"
16423 ;;
16424 *) byteorder=$dflt
16425 ;;
16426 esac
16427 ;;
16428 esac
16429 $rm -f try.c try
16430 ;;
16431esac
16432
16433
16434$cat <<EOM
16435
16436Checking to see whether you can access character data unalignedly...
16437EOM
dc7b0a4f
JH
16438case "$d_u32align" in
16439'') $cat >try.c <<EOCP
4e0554ec
JH
16440#include <stdio.h>
16441#define U32 $u32type
d308175a
JH
16442#define BYTEORDER 0x$byteorder
16443#define U8 $u8type
9958dc3c
JH
16444#include <signal.h>
16445#ifdef SIGBUS
16446$signal_t bletch(s) int s; { exit(4); }
16447#endif
4e0554ec
JH
16448int main() {
16449#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 16450 U8 buf[8];
4e0554ec
JH
16451 U32 *up;
16452 int i;
16453
16454 if (sizeof(U32) != 4) {
16455 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16456 exit(1);
16457 }
16458
16459 fflush(stdout);
16460
9958dc3c
JH
16461#ifdef SIGBUS
16462 signal(SIGBUS, bletch);
16463#endif
16464
8906a23e
JH
16465 buf[0] = 0;
16466 buf[1] = 0;
16467 buf[2] = 0;
16468 buf[3] = 1;
16469 buf[5] = 0;
16470 buf[6] = 0;
16471 buf[7] = 0;
16472 buf[8] = 1;
16473
4e0554ec
JH
16474 for (i = 0; i < 4; i++) {
16475 up = (U32*)(buf + i);
16476 if (! ((*up == 1 << (8*i)) || /* big-endian */
16477 (*up == 1 << (8*(3-i))) /* little-endian */
16478 )
16479 )
16480 {
16481 printf("read failed (%x)\n", *up);
16482 exit(2);
16483 }
16484 }
16485
16486 /* write test */
16487 for (i = 0; i < 4; i++) {
16488 up = (U32*)(buf + i);
16489 *up = 0xBeef;
16490 if (*up != 0xBeef) {
16491 printf("write failed (%x)\n", *up);
16492 exit(3);
16493 }
16494 }
16495
16496 exit(0);
16497#else
16498 printf("1\n");
16499 exit(1);
16500#endif
16501 return 0;
16502}
16503EOCP
16504set try
16505if eval $compile_ok; then
d308175a 16506 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 16507 $run ./try 2>&1 >/dev/null
4e0554ec
JH
16508 case "$?" in
16509 0) cat >&4 <<EOM
16510You can access character data pretty unalignedly.
16511EOM
16512 d_u32align="$undef"
16513 ;;
16514 *) cat >&4 <<EOM
16515It seems that you must access character data in an aligned manner.
16516EOM
16517 d_u32align="$define"
16518 ;;
16519 esac
4e0554ec
JH
16520else
16521 rp='Can you access character data at unaligned addresses?'
16522 dflt='n'
16523 . ./myread
16524 case "$ans" in
16525 [yY]*) d_u32align="$undef" ;;
16526 *) d_u32align="$define" ;;
16527 esac
16528fi
e36b5403 16529$rm -f core core.try.* try.core
dc7b0a4f
JH
16530;;
16531esac
4e0554ec
JH
16532
16533: see if ualarm exists
16534set ualarm d_ualarm
16535eval $inlibc
16536
b4eb6b3d
JH
16537: see if umask exists
16538set umask d_umask
16539eval $inlibc
16540
758a5d79
JH
16541: see if unordered exists
16542set unordered d_unordered
16543eval $inlibc
16544
4e0554ec
JH
16545: see if usleep exists
16546set usleep d_usleep
16547eval $inlibc
16548
2ef53570
JH
16549: see if prototype for usleep is available
16550echo " "
16551set d_usleepproto usleep $i_unistd unistd.h
16552eval $hasproto
16553
b4eb6b3d
JH
16554: see if ustat exists
16555set ustat d_ustat
16556eval $inlibc
16557
16558: backward compatibility for d_hvfork
16559if test X$d_hvfork != X; then
16560 d_vfork="$d_hvfork"
16561 d_hvfork=''
16562fi
16563: see if there is a vfork
16564val=''
16565set vfork val
16566eval $inlibc
16567
16568: Ok, but do we want to use it. vfork is reportedly unreliable in
16569: perl on Solaris 2.x, and probably elsewhere.
16570case "$val" in
16571$define)
16572 echo " "
16573 case "$usevfork" in
16574 false) dflt='n';;
16575 *) dflt='y';;
16576 esac
16577 cat <<'EOM'
16578
16579Perl can only use a vfork() that doesn't suffer from strict
16580restrictions on calling functions or modifying global data in
16581the child. For example, glibc-2.1 contains such a vfork()
16582that is unsuitable. If your system provides a proper fork()
16583call, chances are that you do NOT want perl to use vfork().
16584
16585EOM
16586 rp="Do you still want to use vfork()?"
16587 . ./myread
16588 case "$ans" in
16589 y|Y) ;;
16590 *)
16591 echo "Ok, we won't use vfork()."
16592 val="$undef"
16593 ;;
16594 esac
16595 ;;
16596esac
16597set d_vfork
16598eval $setvar
16599case "$d_vfork" in
16600$define) usevfork='true';;
16601*) usevfork='false';;
16602esac
16603
b4eb6b3d
JH
16604: see if closedir exists
16605set closedir d_closedir
16606eval $inlibc
16607
16608case "$d_closedir" in
16609"$define")
16610 echo " "
16611 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 16612 cat > try.c <<EOM
b4eb6b3d
JH
16613#$i_dirent I_DIRENT /**/
16614#$i_sysdir I_SYS_DIR /**/
16615#$i_sysndir I_SYS_NDIR /**/
16616#$i_systypes I_SYS_TYPES /**/
16617
16618#if defined(I_SYS_TYPES)
16619#include <sys/types.h>
16620#endif
16621#if defined(I_DIRENT)
16622#include <dirent.h>
16623#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16624#include <sys/dir.h>
16625#endif
16626#else
16627#ifdef I_SYS_NDIR
16628#include <sys/ndir.h>
16629#else
16630#ifdef I_SYS_DIR
16631#ifdef hp9000s500
16632#include <ndir.h> /* may be wrong in the future */
16633#else
16634#include <sys/dir.h>
16635#endif
16636#endif
16637#endif
16638#endif
16639int main() { return closedir(opendir(".")); }
16640EOM
5440bc8e 16641 set try
b4eb6b3d 16642 if eval $compile_ok; then
5440bc8e 16643 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
16644 echo "Yes, it does."
16645 val="$undef"
16646 else
16647 echo "No, it doesn't."
16648 val="$define"
16649 fi
16650 else
16651 echo "(I can't seem to compile the test program--assuming it doesn't)"
16652 val="$define"
16653 fi
16654 ;;
16655*)
16656 val="$undef";
16657 ;;
16658esac
16659set d_void_closedir
16660eval $setvar
5440bc8e 16661$rm -f try try.*
b4eb6b3d
JH
16662: see if there is a wait4
16663set wait4 d_wait4
16664eval $inlibc
16665
16666: see if waitpid exists
16667set waitpid d_waitpid
16668eval $inlibc
16669
16670: see if wcstombs exists
16671set wcstombs d_wcstombs
16672eval $inlibc
16673
16674: see if wctomb exists
16675set wctomb d_wctomb
16676eval $inlibc
16677
4e0554ec
JH
16678: see if writev exists
16679set writev d_writev
16680eval $inlibc
16681
b4eb6b3d
JH
16682: preserve RCS keywords in files with variable substitution, grrr
16683Date='$Date'
16684Id='$Id'
16685Log='$Log'
16686RCSfile='$RCSfile'
16687Revision='$Revision'
16688
b4eb6b3d
JH
16689: check for alignment requirements
16690echo " "
5440bc8e 16691case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
16692*$define*)
16693 $cat <<EOM
16694You seem to be either cross-compiling or doing a multiarchitecture build,
16695skipping the memory alignment check.
16696
16697EOM
16698 case "$alignbytes" in
16699 '') alignbytes=8 ;;
16700 esac
16701 ;;
16702*)
16703 case "$alignbytes" in
16704 '') echo "Checking alignment constraints..." >&4
16705 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16706 $cat >try.c <<'EOCP'
16707typedef long double NV;
16708EOCP
16709 else
16710 $cat >try.c <<'EOCP'
16711typedef double NV;
16712EOCP
16713 fi
16714 $cat >>try.c <<'EOCP'
16715#include <stdio.h>
16716struct foobar {
16717 char foo;
16718 NV bar;
16719} try_algn;
16720int main()
16721{
16722 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16723 return(0);
16724}
16725EOCP
16726 set try
16727 if eval $compile_ok; then
5440bc8e 16728 dflt=`$run ./try`
b4eb6b3d
JH
16729 else
16730 dflt='8'
16731 echo "(I can't seem to compile the test program...)"
16732 fi
16733 ;;
16734 *) dflt="$alignbytes"
16735 ;;
16736 esac
16737 rp="Doubles must be aligned on a how-many-byte boundary?"
16738 . ./myread
16739 alignbytes="$ans"
16740 $rm -f try.c try
16741 ;;
16742esac
16743
16744
16745: set the base revision
16746baserev=5.0
16747
b4eb6b3d
JH
16748: how do we catenate cpp tokens here?
16749echo " "
16750echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16751$cat >cpp_stuff.c <<'EOCP'
16752#define RCAT(a,b)a/**/b
16753#define ACAT(a,b)a ## b
16754RCAT(Rei,ser)
16755ACAT(Cir,cus)
16756EOCP
16757$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16758if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16759 echo "Oh! Smells like ANSI's been here." >&4
16760 echo "We can catify or stringify, separately or together!"
16761 cpp_stuff=42
16762elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16763 echo "Ah, yes! The good old days!" >&4
16764 echo "However, in the good old days we don't know how to stringify and"
16765 echo "catify at the same time."
16766 cpp_stuff=1
16767else
16768 $cat >&4 <<EOM
16769Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
16770to have to edit the values of CAT[2-5] in config.h...
16771EOM
16772 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16773fi
16774$rm -f cpp_stuff.*
16775
16776: see if this is a db.h system
16777set db.h i_db
16778eval $inhdr
16779
16780case "$i_db" in
16781$define)
16782 : Check db version.
16783 echo " "
16784 echo "Checking Berkeley DB version ..." >&4
16785 $cat >try.c <<EOCP
16786#$d_const HASCONST
16787#ifndef HASCONST
16788#define const
16789#endif
16790#include <sys/types.h>
16791#include <stdio.h>
16792#include <db.h>
640374d0 16793int main(int argc, char *argv[])
b4eb6b3d
JH
16794{
16795#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16796 int Major, Minor, Patch ;
16797 unsigned long Version ;
16798 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
16799 if (argc == 2) {
16800 printf("%d %d %d %d %d %d\n",
16801 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16802 Major, Minor, Patch);
16803 exit(0);
16804 }
16805 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
16806
16807 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16808 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16809 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16810 Major, Minor, Patch) ;
16811
16812 /* check that db.h & libdb are compatible */
16813 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 16814 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
16815 exit(3);
16816 }
16817
640374d0 16818 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
16819
16820 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16821 + DB_VERSION_PATCH ;
16822
16823 /* needs to be >= 2.3.4 */
16824 if (Version < 2003004) {
16825 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 16826 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
16827 exit(2);
16828 }
16829
16830 exit(0);
16831#else
16832#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
16833 if (argc == 2) {
16834 printf("1 0 0\n");
16835 exit(0);
16836 }
16837 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
16838 exit(0); /* DB version < 2: the coast is clear. */
16839#else
16840 exit(1); /* <db.h> not Berkeley DB? */
16841#endif
16842#endif
16843}
16844EOCP
16845 set try
5440bc8e 16846 if eval $compile_ok && $run ./try; then
b4eb6b3d 16847 echo 'Looks OK.' >&4
5440bc8e 16848 set `$run ./try 1`
640374d0
JH
16849 db_version_major=$1
16850 db_version_minor=$2
16851 db_version_patch=$3
b4eb6b3d
JH
16852 else
16853 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
16854 i_db=$undef
16855 case " $libs " in
16856 *"-ldb "*)
16857 : Remove db from list of libraries to use
16858 echo "Removing unusable -ldb from library list" >&4
16859 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16860 shift
16861 libs="$*"
16862 echo "libs = $libs" >&4
16863 ;;
16864 esac
16865 fi
16866 $rm -f try.*
16867 ;;
16868esac
16869
16870case "$i_db" in
16871define)
16872 : Check the return type needed for hash
16873 echo " "
16874 echo "Checking return type needed for hash for Berkeley DB ..." >&4
16875 $cat >try.c <<EOCP
16876#$d_const HASCONST
16877#ifndef HASCONST
16878#define const
16879#endif
16880#include <sys/types.h>
16881#include <db.h>
16882
16883#ifndef DB_VERSION_MAJOR
16884u_int32_t hash_cb (ptr, size)
16885const void *ptr;
16886size_t size;
16887{
16888}
16889HASHINFO info;
16890int main()
16891{
16892 info.hash = hash_cb;
16893}
16894#endif
16895EOCP
16896 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16897 if $contains warning try.out >>/dev/null 2>&1 ; then
16898 db_hashtype='int'
16899 else
16900 db_hashtype='u_int32_t'
16901 fi
16902 else
16903 : XXX Maybe we should just give up here.
16904 db_hashtype=u_int32_t
16905 $cat try.out >&4
16906 echo "Help: I can't seem to compile the db test program." >&4
16907 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16908 fi
16909 $rm -f try.*
16910 echo "Your version of Berkeley DB uses $db_hashtype for hash."
16911 ;;
16912*) db_hashtype=u_int32_t
16913 ;;
16914esac
16915case "$i_db" in
16916define)
16917 : Check the return type needed for prefix
16918 echo " "
16919 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16920 cat >try.c <<EOCP
16921#$d_const HASCONST
16922#ifndef HASCONST
16923#define const
16924#endif
16925#include <sys/types.h>
16926#include <db.h>
16927
16928#ifndef DB_VERSION_MAJOR
16929size_t prefix_cb (key1, key2)
16930const DBT *key1;
16931const DBT *key2;
16932{
16933}
16934BTREEINFO info;
16935int main()
16936{
16937 info.prefix = prefix_cb;
16938}
16939#endif
16940EOCP
16941 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16942 if $contains warning try.out >>/dev/null 2>&1 ; then
16943 db_prefixtype='int'
16944 else
16945 db_prefixtype='size_t'
16946 fi
16947 else
16948 db_prefixtype='size_t'
16949 : XXX Maybe we should just give up here.
16950 $cat try.out >&4
16951 echo "Help: I can't seem to compile the db test program." >&4
16952 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16953 fi
16954 $rm -f try.*
16955 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16956 ;;
16957*) db_prefixtype='size_t'
16958 ;;
16959esac
16960
b4eb6b3d
JH
16961
16962: How can we generate normalized random numbers ?
16963echo " "
16964echo "Looking for a random number function..." >&4
16965case "$randfunc" in
16966'')
16967 if set drand48 val -f; eval $csym; $val; then
16968 dflt="drand48"
16969 echo "Good, found drand48()." >&4
16970 elif set random val -f; eval $csym; $val; then
16971 dflt="random"
16972 echo "OK, found random()." >&4
16973 else
16974 dflt="rand"
16975 echo "Yick, looks like I have to use rand()." >&4
16976 fi
16977 echo " "
16978 ;;
16979*)
16980 dflt="$randfunc"
16981 ;;
16982esac
16983cont=true
16984
16985case "$ccflags" in
16986*-Dmy_rand=*|*-Dmy_srand=*)
16987 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16988 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16989 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16990 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16991 ;;
16992esac
16993
16994while $test "$cont"; do
16995 rp="Use which function to generate random numbers?"
16996 . ./myread
16997 if $test "$ans" = "$dflt"; then
16998 : null
16999 else
17000 randbits=''
17001 fi
17002 randfunc="$ans"
17003 if set $ans val -f; eval $csym; $val; then
17004 cont=''
17005 else
17006 dflt=y
17007 rp="I cannot find function $ans. Use that name anyway?"
17008 . ./myread
17009 dflt=rand
17010 case "$ans" in
17011 [yY]*) cont='';;
17012 esac
17013 fi
17014 case "$cont" in
17015 '')
17016 case "$randfunc" in
17017 drand48)
17018 drand01="drand48()"
17019 seedfunc="srand48"
17020 randbits=48
17021 randseedtype=long
17022 ;;
17023 rand|random)
17024 case "$randbits" in
17025 '')
17026echo "Checking to see how many bits your $randfunc() function produces..." >&4
17027 $cat >try.c <<EOCP
17028#$i_unistd I_UNISTD
17029#$i_stdlib I_STDLIB
17030#include <stdio.h>
17031#ifdef I_UNISTD
17032# include <unistd.h>
17033#endif
17034#ifdef I_STDLIB
17035# include <stdlib.h>
17036#endif
17037int main()
17038{
17039 register int i;
17040 register unsigned long tmp;
17041 register unsigned long max = 0L;
17042
17043 for (i = 1000; i; i--) {
17044 tmp = (unsigned long) $randfunc();
17045 if (tmp > max) max = tmp;
17046 }
17047 for (i = 0; max; i++)
17048 max /= 2;
17049 printf("%d\n",i);
17050}
17051EOCP
17052 set try
17053 if eval $compile_ok; then
17054 dflt=`try`
17055 else
17056 dflt='?'
17057 echo "(I can't seem to compile the test program...)"
17058 fi
17059 ;;
17060 *)
17061 dflt="$randbits"
17062 ;;
17063 esac
17064 rp="How many bits does your $randfunc() function produce?"
17065 . ./myread
17066 randbits="$ans"
17067 $rm -f try.c try
17068 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17069 seedfunc="s$randfunc"
17070 randseedtype=unsigned
17071 ;;
17072 *)
17073 dflt="31"
17074 rp="How many bits does your $randfunc() function produce?"
17075 . ./myread
17076 randbits="$ans"
17077 seedfunc="s$randfunc"
17078 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17079 if set $seedfunc val -f; eval $csym; $val; then
17080 echo "(Using $seedfunc() to seed random generator)"
17081 else
17082 echo "(Warning: no $seedfunc() to seed random generator)"
17083 seedfunc=rand
17084 fi
17085 randseedtype=unsigned
17086 ;;
17087 esac
17088 ;;
17089 esac
17090done
17091
17092echo " "
17093echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 17094$cat >try.c <<'EOM'
b4eb6b3d
JH
17095int main()
17096{
17097 if ('M'==0xd4) return 0;
17098 return 1;
17099}
17100EOM
17101
17102val=$undef
5440bc8e 17103set try
b4eb6b3d 17104if eval $compile_ok; then
5440bc8e 17105 if $run ./try; then
b4eb6b3d
JH
17106 echo "You seem to speak EBCDIC." >&4
17107 val="$define"
17108 else
5440bc8e 17109 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
17110 fi
17111else
17112 echo "I'm unable to compile the test program." >&4
17113 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17114fi
5440bc8e 17115$rm -f try try.*
b4eb6b3d
JH
17116set ebcdic
17117eval $setvar
17118
17119echo " "
17120$cat >&4 <<EOM
17121Checking how to flush all pending stdio output...
17122EOM
17123# I only know how to find the first 32 possibly open files on SunOS.
17124# See also hints/sunos_4_1.sh and util.c --AD
17125case "$osname" in
17126sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17127esac
17128$cat >>try.c <<EOCP
17129#include <stdio.h>
17130#$i_unistd I_UNISTD
17131#ifdef I_UNISTD
17132# include <unistd.h>
17133#endif
17134#$d_sysconf HAS_SYSCONF
17135#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17136#ifdef HAS_STDIO_STREAM_ARRAY
17137# define STDIO_STREAM_ARRAY $stdio_stream_array
17138#endif
17139int main() {
5440bc8e
JH
17140 FILE* p;
17141 unlink("try.out");
17142 p = fopen("try.out", "w");
b4eb6b3d
JH
17143#ifdef TRY_FPUTC
17144 fputc('x', p);
17145#else
17146# ifdef TRY_FPRINTF
17147 fprintf(p, "x");
17148# endif
17149#endif
17150#ifdef TRY_FFLUSH_NULL
17151 fflush(NULL);
17152#endif
17153#ifdef TRY_FFLUSH_ALL
17154 {
17155 long open_max = -1;
17156# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17157 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17158# else
17159# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17160 open_max = sysconf(_SC_OPEN_MAX);
17161# else
17162# ifdef FOPEN_MAX
17163 open_max = FOPEN_MAX;
17164# else
17165# ifdef OPEN_MAX
17166 open_max = OPEN_MAX;
17167# else
17168# ifdef _NFILE
17169 open_max = _NFILE;
17170# endif
17171# endif
17172# endif
17173# endif
17174# endif
17175# ifdef HAS_STDIO_STREAM_ARRAY
17176 if (open_max > 0) {
17177 long i;
17178 for (i = 0; i < open_max; i++)
17179 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17180 STDIO_STREAM_ARRAY[i]._file < open_max &&
17181 STDIO_STREAM_ARRAY[i]._flag)
17182 fflush(&STDIO_STREAM_ARRAY[i]);
17183 }
17184 }
17185# endif
17186#endif
17187 _exit(42);
17188}
17189EOCP
17190: first we have to find out how _not_ to flush
5440bc8e 17191$to try.c
b4eb6b3d
JH
17192if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17193 output=''
17194 set try -DTRY_FPUTC
17195 if eval $compile; then
fbe73d74 17196 $run ./try 2>/dev/null
28f5ac64 17197 code="$?"
5440bc8e 17198 $from try.out
28f5ac64 17199 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17200 output=-DTRY_FPUTC
17201 fi
17202 fi
17203 case "$output" in
17204 '')
17205 set try -DTRY_FPRINTF
b4eb6b3d 17206 if eval $compile; then
fbe73d74 17207 $run ./try 2>/dev/null
28f5ac64 17208 code="$?"
5440bc8e 17209 $from try.out
28f5ac64 17210 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17211 output=-DTRY_FPRINTF
17212 fi
17213 fi
17214 ;;
17215 esac
17216fi
17217: check for fflush NULL behaviour
17218case "$fflushNULL" in
17219'') set try -DTRY_FFLUSH_NULL $output
17220 if eval $compile; then
5440bc8e 17221 $run ./try 2>/dev/null
b4eb6b3d 17222 code="$?"
5440bc8e 17223 $from try.out
b4eb6b3d
JH
17224 if $test -s try.out -a "X$code" = X42; then
17225 fflushNULL="`$cat try.out`"
17226 else
17227 if $test "X$code" != X42; then
17228 $cat >&4 <<EOM
17229(If this test failed, don't worry, we'll try another method shortly.)
17230EOM
17231 fi
17232 fi
17233 fi
17234 $rm -f core try.core core.try.*
17235 case "$fflushNULL" in
17236 x) $cat >&4 <<EOM
17237Your fflush(NULL) works okay for output streams.
17238Let's see if it clobbers input pipes...
17239EOM
17240# As of mid-March 2000 all versions of Solaris appear to have a stdio
17241# bug that improperly flushes the input end of pipes. So we avoid the
17242# autoflush on fork/system/exec support for now. :-(
17243$cat >tryp.c <<EOCP
17244#include <stdio.h>
17245int
17246main(int argc, char **argv)
17247{
17248 char buf[1024];
17249 int i;
17250 char *bp = buf;
17251 while (1) {
17252 while ((i = getc(stdin)) != -1
17253 && (*bp++ = i) != '\n'
17254 && bp < &buf[1024])
17255 /* DO NOTHING */ ;
17256 *bp = '\0';
17257 fprintf(stdout, "%s", buf);
17258 fflush(NULL);
17259 if (i == -1)
17260 return 0;
17261 bp = buf;
17262 }
17263}
17264EOCP
17265 fflushNULL="$define"
17266 set tryp
17267 if eval $compile; then
17268 $rm -f tryp.out
5440bc8e 17269 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17270 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17271 $cat >&4 <<EOM
17272fflush(NULL) seems to behave okay with input streams.
17273EOM
17274 fflushNULL="$define"
17275 else
17276 $cat >&4 <<EOM
17277Ouch, fflush(NULL) clobbers input pipes! We will not use it.
17278EOM
17279 fflushNULL="$undef"
17280 fi
17281 fi
17282 $rm -f core tryp.c tryp.core core.tryp.*
17283 ;;
17284 '') $cat >&4 <<EOM
17285Your fflush(NULL) isn't working (contrary to ANSI C).
17286EOM
17287 fflushNULL="$undef"
17288 ;;
17289 *) $cat >&4 <<EOM
17290Cannot figure out whether your fflush(NULL) works or not.
17291I'm assuming it doesn't (contrary to ANSI C).
17292EOM
17293 fflushNULL="$undef"
17294 ;;
17295 esac
17296 ;;
17297$define|true|[yY]*)
17298 fflushNULL="$define"
17299 ;;
17300*)
17301 fflushNULL="$undef"
17302 ;;
17303esac
17304: check explicit looping only if NULL did not work, and if the pipe
17305: bug does not show up on an explicit flush too
17306case "$fflushNULL" in
17307"$undef")
17308 $cat >tryp.c <<EOCP
17309#include <stdio.h>
17310int
17311main(int argc, char **argv)
17312{
17313 char buf[1024];
17314 int i;
17315 char *bp = buf;
17316 while (1) {
17317 while ((i = getc(stdin)) != -1
17318 && (*bp++ = i) != '\n'
17319 && bp < &buf[1024])
17320 /* DO NOTHING */ ;
17321 *bp = '\0';
17322 fprintf(stdout, "%s", buf);
17323 fflush(stdin);
17324 if (i == -1)
17325 return 0;
17326 bp = buf;
17327 }
17328}
17329EOCP
17330 set tryp
17331 if eval $compile; then
17332 $rm -f tryp.out
5440bc8e 17333 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17334 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17335 $cat >&4 <<EOM
17336Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17337EOM
17338 : now check for fflushall behaviour
17339 case "$fflushall" in
17340 '') set try -DTRY_FFLUSH_ALL $output
17341 if eval $compile; then
17342 $cat >&4 <<EOM
17343(Now testing the other method--but note that this also may fail.)
17344EOM
5440bc8e 17345 $run ./try 2>/dev/null
28f5ac64 17346 code=$?
fbe73d74 17347 $from try.out
28f5ac64 17348 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17349 fflushall="`$cat try.out`"
17350 fi
17351 fi
17352 $rm -f core try.core core.try.*
17353 case "$fflushall" in
17354 x) $cat >&4 <<EOM
17355Whew. Flushing explicitly all the stdio streams works.
17356EOM
17357 fflushall="$define"
17358 ;;
17359 '') $cat >&4 <<EOM
17360Sigh. Flushing explicitly all the stdio streams doesn't work.
17361EOM
17362 fflushall="$undef"
17363 ;;
17364 *) $cat >&4 <<EOM
17365Cannot figure out whether flushing stdio streams explicitly works or not.
17366I'm assuming it doesn't.
17367EOM
17368 fflushall="$undef"
17369 ;;
17370 esac
17371 ;;
17372 "$define"|true|[yY]*)
17373 fflushall="$define"
17374 ;;
17375 *)
17376 fflushall="$undef"
17377 ;;
17378 esac
17379 else
17380 $cat >&4 <<EOM
17381All is futile. Even fflush(stdin) clobbers input pipes!
17382EOM
17383 fflushall="$undef"
17384 fi
17385 else
17386 fflushall="$undef"
17387 fi
17388 $rm -f core tryp.c tryp.core core.tryp.*
17389 ;;
17390*) fflushall="$undef"
17391 ;;
17392esac
17393
17394case "$fflushNULL$fflushall" in
17395undefundef)
17396 $cat <<EOM
17397OK, I give up. I cannot figure out how to flush pending stdio output.
17398We won't be flushing handles at all before fork/exec/popen.
17399EOM
17400 ;;
17401esac
17402$rm -f try.* try$exe_ext
17403
17404: Store the full pathname to the ar program for use in the C program
17405: Respect a hint or command line value for full_ar.
17406case "$full_ar" in
17407'') full_ar=$ar ;;
17408esac
17409
17410: Store the full pathname to the sed program for use in the C program
17411full_sed=$sed
17412
17413: see what type gids are declared as in the kernel
17414echo " "
17415echo "Looking for the type for group ids returned by getgid()."
17416set gid_t gidtype xxx stdio.h sys/types.h
17417eval $typedef
17418case "$gidtype" in
17419xxx)
17420 xxx=`./findhdr sys/user.h`
17421 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17422 case $1 in
17423 unsigned) dflt="$1 $2" ;;
17424 *) dflt="$1" ;;
17425 esac
17426 ;;
17427*) dflt="$gidtype";;
17428esac
17429case "$gidtype" in
17430gid_t) echo "gid_t found." ;;
17431*) rp="What is the type for group ids returned by getgid()?"
17432 . ./myread
17433 gidtype="$ans"
17434 ;;
17435esac
17436
17437echo " "
17438case "$gidtype" in
17439*_t) zzz="$gidtype" ;;
17440*) zzz="gid" ;;
17441esac
17442echo "Checking the size of $zzz..." >&4
17443cat > try.c <<EOCP
17444#include <sys/types.h>
17445#include <stdio.h>
17446int main() {
17447 printf("%d\n", (int)sizeof($gidtype));
17448 exit(0);
17449}
17450EOCP
17451set try
17452if eval $compile_ok; then
5440bc8e 17453 yyy=`$run ./try`
b4eb6b3d
JH
17454 case "$yyy" in
17455 '') gidsize=4
17456 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17457 ;;
17458 *) gidsize=$yyy
17459 echo "Your $zzz is $gidsize bytes long."
17460 ;;
17461 esac
17462else
17463 gidsize=4
17464 echo "(I can't compile the test program--guessing $gidsize.)" >&4
17465fi
17466
17467
17468echo " "
17469case "$gidtype" in
17470*_t) zzz="$gidtype" ;;
17471*) zzz="gid" ;;
17472esac
17473echo "Checking the sign of $zzz..." >&4
17474cat > try.c <<EOCP
17475#include <sys/types.h>
17476#include <stdio.h>
17477int main() {
17478 $gidtype foo = -1;
17479 if (foo < 0)
17480 printf("-1\n");
17481 else
17482 printf("1\n");
17483}
17484EOCP
17485set try
17486if eval $compile; then
5440bc8e 17487 yyy=`$run ./try`
b4eb6b3d
JH
17488 case "$yyy" in
17489 '') gidsign=1
17490 echo "(I can't execute the test program--guessing unsigned.)" >&4
17491 ;;
17492 *) gidsign=$yyy
17493 case "$gidsign" in
17494 1) echo "Your $zzz is unsigned." ;;
17495 -1) echo "Your $zzz is signed." ;;
17496 esac
17497 ;;
17498 esac
17499else
17500 gidsign=1
17501 echo "(I can't compile the test program--guessing unsigned.)" >&4
17502fi
17503
17504
17505echo " "
17506
17507if $test X"$quadtype" != X; then
17508
17509echo "Checking how to print 64-bit integers..." >&4
17510
17511if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17512 $cat >try.c <<'EOCP'
17513#include <sys/types.h>
17514#include <stdio.h>
17515int main() {
17516 int q = 12345678901;
17517 printf("%ld\n", q);
17518}
17519EOCP
17520 set try
17521 if eval $compile; then
5440bc8e 17522 yyy=`$run ./try`
b4eb6b3d
JH
17523 case "$yyy" in
17524 12345678901)
17525 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17526 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17527 echo "We will use %d."
17528 ;;
17529 esac
17530 fi
17531fi
17532
17533if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17534 $cat >try.c <<'EOCP'
17535#include <sys/types.h>
17536#include <stdio.h>
17537int main() {
17538 long q = 12345678901;
17539 printf("%ld\n", q);
17540}
17541EOCP
17542 set try
17543 if eval $compile; then
5440bc8e 17544 yyy=`$run ./try`
b4eb6b3d
JH
17545 case "$yyy" in
17546 12345678901)
17547 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17548 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17549 echo "We will use %ld."
17550 ;;
17551 esac
17552 fi
17553fi
17554
17555if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17556 $cat >try.c <<'EOCP'
17557#include <sys/types.h>
17558#include <inttypes.h>
17559#include <stdio.h>
17560int main() {
17561 int64_t q = 12345678901;
17562 printf("%" PRId64 "\n", q);
17563}
17564EOCP
17565 set try
17566 if eval $compile; then
5440bc8e 17567 yyy=`$run ./try`
b4eb6b3d
JH
17568 case "$yyy" in
17569 12345678901)
17570 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17571 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17572 echo "We will use the C9X style."
17573 ;;
17574 esac
17575 fi
17576fi
17577
2ef53570
JH
17578if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17579 $cat >try.c <<EOCP
b4eb6b3d
JH
17580#include <sys/types.h>
17581#include <stdio.h>
17582int main() {
2ef53570
JH
17583 $quadtype q = 12345678901;
17584 printf("%Ld\n", q);
b4eb6b3d
JH
17585}
17586EOCP
17587 set try
17588 if eval $compile; then
5440bc8e 17589 yyy=`$run ./try`
b4eb6b3d
JH
17590 case "$yyy" in
17591 12345678901)
2ef53570
JH
17592 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17593 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17594 echo "We will use %Ld."
b4eb6b3d
JH
17595 ;;
17596 esac
17597 fi
17598fi
17599
2ef53570
JH
17600if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17601 $cat >try.c <<'EOCP'
b4eb6b3d
JH
17602#include <sys/types.h>
17603#include <stdio.h>
17604int main() {
2ef53570
JH
17605 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17606 printf("%lld\n", q);
b4eb6b3d
JH
17607}
17608EOCP
17609 set try
17610 if eval $compile; then
5440bc8e 17611 yyy=`$run ./try`
b4eb6b3d
JH
17612 case "$yyy" in
17613 12345678901)
2ef53570
JH
17614 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17615 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17616 echo "We will use the %lld style."
b4eb6b3d
JH
17617 ;;
17618 esac
17619 fi
17620fi
17621
17622if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17623 $cat >try.c <<EOCP
17624#include <sys/types.h>
17625#include <stdio.h>
17626int main() {
17627 $quadtype q = 12345678901;
17628 printf("%qd\n", q);
17629}
17630EOCP
17631 set try
17632 if eval $compile; then
5440bc8e 17633 yyy=`$run ./try`
b4eb6b3d
JH
17634 case "$yyy" in
17635 12345678901)
17636 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17637 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17638 echo "We will use %qd."
17639 ;;
17640 esac
17641 fi
17642fi
17643
17644if $test X"$sPRId64" = X; then
17645 echo "Cannot figure out how to print 64-bit integers." >&4
17646fi
17647
17648$rm -f try try.*
17649
17650fi
17651
17652case "$sPRId64" in
17653'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
17654 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
17655 ;;
17656*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
17657 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
17658 ;;
17659esac
17660
17661
17662echo " "
17663$echo "Checking the format strings to be used for Perl's internal types..." >&4
17664
17665if $test X"$ivsize" = X8; then
17666 ivdformat="$sPRId64"
17667 uvuformat="$sPRIu64"
17668 uvoformat="$sPRIo64"
17669 uvxformat="$sPRIx64"
17670 uvXUformat="$sPRIXU64"
17671else
17672 if $test X"$ivsize" = X"$longsize"; then
17673 ivdformat='"ld"'
17674 uvuformat='"lu"'
17675 uvoformat='"lo"'
17676 uvxformat='"lx"'
17677 uvXUformat='"lX"'
17678 else
17679 if $test X"$ivsize" = X"$intsize"; then
17680 ivdformat='"d"'
17681 uvuformat='"u"'
17682 uvoformat='"o"'
17683 uvxformat='"x"'
17684 uvXUformat='"X"'
17685 else
17686 : far out
17687 if $test X"$ivsize" = X"$shortsize"; then
17688 ivdformat='"hd"'
17689 uvuformat='"hu"'
17690 uvoformat='"ho"'
17691 uvxformat='"hx"'
17692 uvXUformat='"hX"'
17693 fi
17694 fi
17695 fi
17696fi
17697
17698if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17699 nveformat="$sPRIeldbl"
17700 nvfformat="$sPRIfldbl"
17701 nvgformat="$sPRIgldbl"
17702 nvEUformat="$sPRIEUldbl"
17703 nvFUformat="$sPRIFUldbl"
17704 nvGUformat="$sPRIGUldbl"
17705else
17706 nveformat='"e"'
17707 nvfformat='"f"'
17708 nvgformat='"g"'
17709 nvEUformat='"E"'
17710 nvFUformat='"F"'
17711 nvGUformat='"G"'
17712fi
17713
17714case "$ivdformat" in
3c728e00 17715'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
17716 exit 1
17717 ;;
17718esac
17719
17720
17721echo " "
17722$echo "Checking the format string to be used for gids..." >&4
17723
17724case "$gidsign" in
17725-1) if $test X"$gidsize" = X"$ivsize"; then
17726 gidformat="$ivdformat"
17727 else
17728 if $test X"$gidsize" = X"$longsize"; then
17729 gidformat='"ld"'
17730 else
17731 if $test X"$gidsize" = X"$intsize"; then
17732 gidformat='"d"'
17733 else
17734 if $test X"$gidsize" = X"$shortsize"; then
17735 gidformat='"hd"'
17736 fi
17737 fi
17738 fi
17739 fi
17740 ;;
17741*) if $test X"$gidsize" = X"$uvsize"; then
17742 gidformat="$uvuformat"
17743 else
17744 if $test X"$gidsize" = X"$longsize"; then
17745 gidformat='"lu"'
17746 else
17747 if $test X"$gidsize" = X"$intsize"; then
17748 gidformat='"u"'
17749 else
17750 if $test X"$gidsize" = X"$shortsize"; then
17751 gidformat='"hu"'
17752 fi
17753 fi
17754 fi
17755 fi
17756 ;;
17757esac
17758
17759: see if getgroups exists
17760set getgroups d_getgrps
17761eval $inlibc
17762
17763: see if setgroups exists
17764set setgroups d_setgrps
17765eval $inlibc
17766
17767
17768: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17769echo " "
17770case "$d_getgrps$d_setgrps" in
17771*define*)
17772 case "$groupstype" in
17773 '') dflt="$gidtype" ;;
17774 *) dflt="$groupstype" ;;
17775 esac
17776 $cat <<EOM
17777What type of pointer is the second argument to getgroups() and setgroups()?
17778Usually this is the same as group ids, $gidtype, but not always.
17779
17780EOM
17781 rp='What type pointer is the second argument to getgroups() and setgroups()?'
17782 . ./myread
17783 groupstype="$ans"
17784 ;;
17785*) groupstype="$gidtype";;
17786esac
17787
17788echo " "
17789echo "Checking if your $make program sets \$(MAKE)..." >&4
17790case "$make_set_make" in
17791'')
17792 $sed 's/^X //' > testmake.mak << 'EOF'
17793Xall:
17794X @echo 'maketemp="$(MAKE)"'
17795EOF
17796 case "`$make -f testmake.mak 2>/dev/null`" in
17797 *maketemp=*) make_set_make='#' ;;
17798 *) make_set_make="MAKE=$make" ;;
17799 esac
17800 $rm -f testmake.mak
17801 ;;
17802esac
17803case "$make_set_make" in
17804'#') echo "Yup, it does.";;
17805*) echo "Nope, it doesn't.";;
17806esac
17807
17808: see what type is used for mode_t
17809rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17810set mode_t modetype int stdio.h sys/types.h
17811eval $typedef_ask
17812
2cc61e15
DD
17813: see if stdarg is available
17814echo " "
17815if $test `./findhdr stdarg.h`; then
17816 echo "<stdarg.h> found." >&4
17817 valstd="$define"
17818else
17819 echo "<stdarg.h> NOT found." >&4
17820 valstd="$undef"
17821fi
17822
17823: see if varags is available
17824echo " "
17825if $test `./findhdr varargs.h`; then
17826 echo "<varargs.h> found." >&4
17827else
17828 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17829fi
17830
17831: set up the varargs testing programs
17832$cat > varargs.c <<EOP
17833#ifdef I_STDARG
17834#include <stdarg.h>
17835#endif
17836#ifdef I_VARARGS
17837#include <varargs.h>
17838#endif
17839
17840#ifdef I_STDARG
17841int f(char *p, ...)
17842#else
17843int f(va_alist)
17844va_dcl
17845#endif
17846{
17847 va_list ap;
17848#ifndef I_STDARG
17849 char *p;
17850#endif
17851#ifdef I_STDARG
17852 va_start(ap,p);
17853#else
17854 va_start(ap);
17855 p = va_arg(ap, char *);
17856#endif
17857 va_end(ap);
17858}
17859EOP
17860$cat > varargs <<EOP
17861$startsh
17862if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17863 echo "true"
17864else
17865 echo "false"
17866fi
17867$rm -f varargs$_o
17868EOP
17869chmod +x varargs
17870
17871: now check which varargs header should be included
17872echo " "
17873i_varhdr=''
17874case "$valstd" in
17875"$define")
17876 if `./varargs I_STDARG`; then
17877 val='stdarg.h'
17878 elif `./varargs I_VARARGS`; then
17879 val='varargs.h'
17880 fi
17881 ;;
17882*)
17883 if `./varargs I_VARARGS`; then
17884 val='varargs.h'
17885 fi
17886 ;;
17887esac
17888case "$val" in
17889'')
17890echo "I could not find the definition for va_dcl... You have problems..." >&4
17891 val="$undef"; set i_stdarg; eval $setvar
17892 val="$undef"; set i_varargs; eval $setvar
17893 ;;
17894*)
17895 set i_varhdr
17896 eval $setvar
17897 case "$i_varhdr" in
17898 stdarg.h)
17899 val="$define"; set i_stdarg; eval $setvar
17900 val="$undef"; set i_varargs; eval $setvar
17901 ;;
17902 varargs.h)
17903 val="$undef"; set i_stdarg; eval $setvar
17904 val="$define"; set i_varargs; eval $setvar
17905 ;;
17906 esac
17907 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17908esac
17909$rm -f varargs*
17910
17911: see if we need va_copy
17912echo " "
17913case "$i_stdarg" in
17914"$define")
17915 $cat >try.c <<EOCP
17916#include <stdarg.h>
17917#include <stdio.h>
85c8a686
DD
17918#$i_stdlib I_STDLIB
17919#ifdef I_STDLIB
17920#include <stdlib.h>
17921#endif
17922#include <signal.h>
2cc61e15
DD
17923
17924int
17925ivfprintf(FILE *f, const char *fmt, va_list *valp)
17926{
17927 return vfprintf(f, fmt, *valp);
17928}
17929
17930int
17931myvfprintf(FILE *f, const char *fmt, va_list val)
17932{
17933 return ivfprintf(f, fmt, &val);
17934}
17935
17936int
17937myprintf(char *fmt, ...)
17938{
17939 va_list val;
17940 va_start(val, fmt);
17941 return myvfprintf(stdout, fmt, val);
17942}
17943
17944int
17945main(int ac, char **av)
17946{
85c8a686
DD
17947 signal(SIGSEGV, exit);
17948
2cc61e15
DD
17949 myprintf("%s%cs all right, then\n", "that", '\'');
17950 exit(0);
17951}
17952EOCP
17953 set try
5440bc8e
JH
17954 if eval $compile && $run ./try 2>&1 >/dev/null; then
17955 case "`$run ./try`" in
2cc61e15
DD
17956 "that's all right, then")
17957 okay=yes
17958 ;;
17959 esac
17960 fi
17961 case "$okay" in
17962 yes) echo "It seems that you don't need va_copy()." >&4
17963 need_va_copy="$undef"
17964 ;;
17965 *) echo "It seems that va_copy() or similar will be needed." >&4
17966 need_va_copy="$define"
17967 ;;
17968 esac
17969 $rm -f try.* core core.* *.core *.core.*
17970 ;;
17971*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17972 ;;
17973esac
17974
b4eb6b3d
JH
17975: see what type is used for size_t
17976rp="What is the type used for the length parameter for string functions?"
17977set size_t sizetype 'unsigned int' stdio.h sys/types.h
17978eval $typedef_ask
17979
17980: check for type of arguments to gethostbyaddr.
17981if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17982 case "$d_gethbyaddr" in
17983 $define)
17984 $cat <<EOM
17985
17986Checking to see what type of arguments are accepted by gethostbyaddr().
17987EOM
17988 hdrs="$define sys/types.h
17989 $d_socket sys/socket.h
17990 $i_niin netinet/in.h
17991 $i_netdb netdb.h
17992 $i_unistd unistd.h"
17993 : The first arg can 'char *' or 'void *'
17994 : The second arg is some of integral type
17995 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17996 for yyy in size_t long int; do
17997 case "$netdb_host_type" in
17998 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17999 if ./protochk "$try" $hdrs; then
18000 echo "Your system accepts $xxx for the first arg."
18001 echo "...and $yyy for the second arg."
18002 netdb_host_type="$xxx"
18003 netdb_hlen_type="$yyy"
18004 fi
18005 ;;
18006 esac
18007 done
18008 done
18009 : In case none of those worked, prompt the user.
18010 case "$netdb_host_type" in
18011 '') rp='What is the type for the 1st argument to gethostbyaddr?'
18012 dflt='char *'
18013 . ./myread
18014 netdb_host_type=$ans
18015 rp='What is the type for the 2nd argument to gethostbyaddr?'
18016 dflt="$sizetype"
18017 . ./myread
18018 netdb_hlen_type=$ans
18019 ;;
18020 esac
18021 ;;
18022 *) : no gethostbyaddr, so pick harmless defaults
18023 netdb_host_type='char *'
18024 netdb_hlen_type="$sizetype"
18025 ;;
18026 esac
18027 # Remove the "const" if needed. -- but then we'll have a
18028 # prototype clash!
18029 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18030fi
18031
18032: check for type of argument to gethostbyname.
18033if test "X$netdb_name_type" = X ; then
18034 case "$d_gethbyname" in
18035 $define)
18036 $cat <<EOM
18037
18038Checking to see what type of argument is accepted by gethostbyname().
18039EOM
18040 hdrs="$define sys/types.h
18041 $d_socket sys/socket.h
18042 $i_niin netinet/in.h
18043 $i_netdb netdb.h
18044 $i_unistd unistd.h"
18045 for xxx in "const char *" "char *"; do
18046 case "$netdb_name_type" in
18047 '') try="extern struct hostent *gethostbyname($xxx);"
18048 if ./protochk "$try" $hdrs; then
18049 echo "Your system accepts $xxx."
18050 netdb_name_type="$xxx"
18051 fi
18052 ;;
18053 esac
18054 done
18055 : In case none of those worked, prompt the user.
18056 case "$netdb_name_type" in
18057 '') rp='What is the type for the 1st argument to gethostbyname?'
18058 dflt='char *'
18059 . ./myread
18060 netdb_name_type=$ans
18061 ;;
18062 esac
18063 ;;
18064 *) : no gethostbyname, so pick harmless default
18065 netdb_name_type='char *'
18066 ;;
18067 esac
18068fi
18069
18070: check for type of 1st argument to getnetbyaddr.
18071if test "X$netdb_net_type" = X ; then
18072 case "$d_getnbyaddr" in
18073 $define)
18074 $cat <<EOM
18075
18076Checking to see what type of 1st argument is accepted by getnetbyaddr().
18077EOM
18078 hdrs="$define sys/types.h
18079 $d_socket sys/socket.h
18080 $i_niin netinet/in.h
18081 $i_netdb netdb.h
18082 $i_unistd unistd.h"
18083 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18084 case "$netdb_net_type" in
18085 '') try="extern struct netent *getnetbyaddr($xxx, int);"
18086 if ./protochk "$try" $hdrs; then
18087 echo "Your system accepts $xxx."
18088 netdb_net_type="$xxx"
18089 fi
18090 ;;
18091 esac
18092 done
18093 : In case none of those worked, prompt the user.
18094 case "$netdb_net_type" in
18095 '') rp='What is the type for the 1st argument to getnetbyaddr?'
18096 dflt='long'
18097 . ./myread
18098 netdb_net_type=$ans
18099 ;;
18100 esac
18101 ;;
18102 *) : no getnetbyaddr, so pick harmless default
18103 netdb_net_type='long'
18104 ;;
18105 esac
18106fi
18107: locate the preferred pager for this system
18108case "$pager" in
18109'')
18110 dflt=''
18111 case "$pg" in
18112 /*) dflt=$pg;;
18113 [a-zA-Z]:/*) dflt=$pg;;
18114 esac
18115 case "$more" in
18116 /*) dflt=$more;;
18117 [a-zA-Z]:/*) dflt=$more;;
18118 esac
18119 case "$less" in
18120 /*) dflt=$less;;
18121 [a-zA-Z]:/*) dflt=$less;;
18122 esac
18123 case "$dflt" in
18124 '') dflt=/usr/ucb/more;;
18125 esac
18126 ;;
18127*) dflt="$pager";;
18128esac
18129echo " "
18130fn=f/
18131rp='What pager is used on your system?'
18132. ./getfile
18133pager="$ans"
18134
18135: see what type pids are declared as in the kernel
18136rp="What is the type of process ids on this system?"
18137set pid_t pidtype int stdio.h sys/types.h
18138eval $typedef_ask
18139
18140: Find earliest binary compatible site_perl subdirectory perl can use.
18141case "$bincompat5005" in
18142"$define") xs_apiversion='5.005' ;;
18143*) xs_apiversion=$version ;; # The current site_perl version.
18144esac
18145: Find earliest pure perl site_perl subdirectory perl can use.
18146: The versioned directories started at 5.005.
18147pm_apiversion='5.005'
18148
b4eb6b3d
JH
18149: see if ar generates random libraries by itself
18150echo " "
18151echo "Checking how to generate random libraries on your machine..." >&4
18152echo 'int bar1() { return bar2(); }' > bar1.c
18153echo 'int bar2() { return 2; }' > bar2.c
18154$cat > foo.c <<'EOP'
18155int main() { printf("%d\n", bar1()); exit(0); }
18156EOP
18157$cc $ccflags -c bar1.c >/dev/null 2>&1
18158$cc $ccflags -c bar2.c >/dev/null 2>&1
18159$cc $ccflags -c foo.c >/dev/null 2>&1
18160$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 18161if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18162 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18163 echo "$ar appears to generate random libraries itself."
18164 orderlib=false
18165 ranlib=":"
18166elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 18167 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18168 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18169 echo "a table of contents needs to be added with '$ar ts'."
18170 orderlib=false
18171 ranlib="$ar ts"
18172else
18173 case "$ranlib" in
18174 :) ranlib='';;
18175 '')
18176 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18177 $test -f $ranlib || ranlib=''
18178 ;;
18179 esac
18180 if $test -n "$ranlib"; then
18181 echo "your system has '$ranlib'; we'll use that."
18182 orderlib=false
18183 else
18184 echo "your system doesn't seem to support random libraries"
18185 echo "so we'll use lorder and tsort to order the libraries."
18186 orderlib=true
18187 ranlib=":"
18188 fi
18189fi
18190$rm -f foo* bar*
18191
18192: check for type of arguments to select.
18193case "$selecttype" in
18194'') case "$d_select" in
18195 $define)
18196 echo " "
18197 $cat <<EOM
18198Checking to see what type of arguments are accepted by select().
18199EOM
18200 hdrs="$define sys/types.h
18201 $i_systime sys/time.h
18202 $i_sysselct sys/select.h
18203 $d_socket sys/socket.h"
18204 : The first arg can be int, unsigned, or size_t
18205 : The last arg may or may not be 'const'
18206 val=''
18207 : void pointer has been seen but using that
18208 : breaks the selectminbits test
18209 for xxx in 'fd_set *' 'int *'; do
18210 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18211 for tmo in 'struct timeval *' 'const struct timeval *'; do
18212 case "$val" in
18213 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18214 if ./protochk "$try" $hdrs; then
18215 echo "Your system accepts $xxx."
18216 val="$xxx"
18217 fi
18218 ;;
18219 esac
18220 done
18221 done
18222 done
18223 case "$val" in
18224 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18225 case "$d_fd_set" in
18226 $define) dflt="fd_set *" ;;
18227 *) dflt="int *" ;;
18228 esac
18229 . ./myread
18230 val=$ans
18231 ;;
18232 esac
18233 selecttype="$val"
18234 ;;
18235 *) : no select, so pick a harmless default
18236 selecttype='int *'
18237 ;;
18238 esac
18239 ;;
18240esac
18241
18242: check for the select 'width'
18243case "$selectminbits" in
18244'') case "$d_select" in
18245 $define)
18246 $cat <<EOM
18247
18248Checking to see on how many bits at a time your select() operates...
18249EOM
18250 $cat >try.c <<EOCP
18251#include <sys/types.h>
18252#$i_time I_TIME
18253#$i_systime I_SYS_TIME
18254#$i_systimek I_SYS_TIME_KERNEL
18255#ifdef I_TIME
18256# include <time.h>
18257#endif
18258#ifdef I_SYS_TIME
18259# ifdef I_SYS_TIME_KERNEL
18260# define KERNEL
18261# endif
18262# include <sys/time.h>
18263# ifdef I_SYS_TIME_KERNEL
18264# undef KERNEL
18265# endif
18266#endif
18267#$i_sysselct I_SYS_SELECT
18268#ifdef I_SYS_SELECT
18269#include <sys/select.h>
18270#endif
18271#$d_socket HAS_SOCKET
18272#ifdef HAS_SOCKET
18273# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18274#endif
18275#include <stdio.h>
18276$selecttype b;
18277#define S sizeof(*(b))
18278#define MINBITS 64
18279#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18280#define NBITS (NBYTES * 8)
18281int main() {
18282 char s[NBYTES];
18283 struct timeval t;
18284 int i;
18285 FILE* fp;
18286 int fd;
18287
18288 fclose(stdin);
18289 fp = fopen("try.c", "r");
18290 if (fp == 0)
18291 exit(1);
18292 fd = fileno(fp);
18293 if (fd < 0)
18294 exit(2);
18295 b = ($selecttype)s;
18296 for (i = 0; i < NBITS; i++)
18297 FD_SET(i, b);
18298 t.tv_sec = 0;
18299 t.tv_usec = 0;
18300 select(fd + 1, b, 0, 0, &t);
18301 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18302 printf("%d\n", i + 1);
18303 return 0;
18304}
18305EOCP
18306 set try
18307 if eval $compile_ok; then
5440bc8e 18308 selectminbits=`$run ./try`
b4eb6b3d
JH
18309 case "$selectminbits" in
18310 '') cat >&4 <<EOM
18311Cannot figure out on how many bits at a time your select() operates.
18312I'll play safe and guess it is 32 bits.
18313EOM
18314 selectminbits=32
18315 bits="32 bits"
18316 ;;
18317 1) bits="1 bit" ;;
18318 *) bits="$selectminbits bits" ;;
18319 esac
18320 echo "Your select() operates on $bits at a time." >&4
18321 else
18322 rp='What is the minimum number of bits your select() operates on?'
18323 case "$byteorder" in
18324 1234|12345678) dflt=32 ;;
18325 *) dflt=1 ;;
18326 esac
18327 . ./myread
18328 val=$ans
18329 selectminbits="$val"
18330 fi
18331 $rm -f try.* try
18332 ;;
18333 *) : no select, so pick a harmless default
18334 selectminbits='32'
18335 ;;
18336 esac
18337 ;;
18338esac
18339
18340: Trace out the files included by signal.h, then look for SIGxxx names.
18341: Remove SIGARRAYSIZE used by HPUX.
18342: Remove SIGSTKSIZE used by Linux.
18343: Remove SIGSTKSZ used by Posix.
18344: Remove SIGTYP void lines used by OS2.
18345: Some cpps, like os390, dont give the file name anywhere
18346if [ "X$fieldn" = X ]; then
18347 : Just make some guesses. We check them later.
18348 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18349else
18350 xxx=`echo '#include <signal.h>' |
18351 $cppstdin $cppminus $cppflags 2>/dev/null |
18352 $grep '^[ ]*#.*include' |
a938a3bb 18353 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
18354fi
18355: Check this list of files to be sure we have parsed the cpp output ok.
18356: This will also avoid potentially non-existent files, such
18357: as ../foo/bar.h
18358xxxfiles=''
18359for xx in $xxx /dev/null ; do
18360 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18361done
18362: If we have found no files, at least try signal.h
18363case "$xxxfiles" in
18364'') xxxfiles=`./findhdr signal.h` ;;
18365esac
18366xxx=`awk '
18367$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18368 print substr($2, 4, 20)
18369}
18370$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18371 print substr($3, 4, 20)
18372}' $xxxfiles`
18373: Append some common names just in case the awk scan failed.
18374xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18375xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18376xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18377xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18378xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18379
18380: generate a few handy files for later
18381$cat > signal.c <<'EOCP'
18382#include <sys/types.h>
18383#include <signal.h>
18384#include <stdio.h>
18385int main() {
18386
18387/* Strange style to avoid deeply-nested #if/#else/#endif */
18388#ifndef NSIG
18389# ifdef _NSIG
18390# define NSIG (_NSIG)
18391# endif
18392#endif
18393
18394#ifndef NSIG
18395# ifdef SIGMAX
18396# define NSIG (SIGMAX+1)
18397# endif
18398#endif
18399
18400#ifndef NSIG
18401# ifdef SIG_MAX
18402# define NSIG (SIG_MAX+1)
18403# endif
18404#endif
18405
18406#ifndef NSIG
18407# ifdef MAXSIG
18408# define NSIG (MAXSIG+1)
18409# endif
18410#endif
18411
18412#ifndef NSIG
18413# ifdef MAX_SIG
18414# define NSIG (MAX_SIG+1)
18415# endif
18416#endif
18417
18418#ifndef NSIG
18419# ifdef SIGARRAYSIZE
18420# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18421# endif
18422#endif
18423
18424#ifndef NSIG
18425# ifdef _sys_nsig
18426# define NSIG (_sys_nsig) /* Solaris 2.5 */
18427# endif
18428#endif
18429
18430/* Default to some arbitrary number that's big enough to get most
18431 of the common signals.
18432*/
18433#ifndef NSIG
18434# define NSIG 50
18435#endif
18436
18437printf("NSIG %d\n", NSIG);
18438
18439#ifndef JUST_NSIG
18440
18441EOCP
18442
18443echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18444{
18445 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 18446 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
18447 printf $1; printf ");\n"
18448 printf "#endif\n"
18449}
18450END {
18451 printf "#endif /* JUST_NSIG */\n";
18452 printf "exit(0);\n}\n";
18453}
18454' >>signal.c
18455$cat >signal.awk <<'EOP'
18456BEGIN { ndups = 0 }
65197d93
JH
18457$1 ~ /^NSIG$/ { nsig = $2 }
18458($1 !~ /^NSIG$/) && (NF == 2) {
18459 if ($2 > maxsig) { maxsig = $2 }
18460 if (sig_name[$2]) {
18461 dup_name[ndups] = $1
18462 dup_num[ndups] = $2
b4eb6b3d
JH
18463 ndups++
18464 }
18465 else {
65197d93
JH
18466 sig_name[$2] = $1
18467 sig_num[$2] = $2
b4eb6b3d
JH
18468 }
18469}
18470END {
18471 if (nsig == 0) {
18472 nsig = maxsig + 1
18473 }
18474 printf("NSIG %d\n", nsig);
18475 for (n = 1; n < nsig; n++) {
18476 if (sig_name[n]) {
18477 printf("%s %d\n", sig_name[n], sig_num[n])
18478 }
18479 else {
18480 printf("NUM%d %d\n", n, n)
18481 }
18482 }
18483 for (n = 0; n < ndups; n++) {
18484 printf("%s %d\n", dup_name[n], dup_num[n])
18485 }
18486}
18487EOP
18488$cat >signal_cmd <<EOS
18489$startsh
18490if $test -s signal.lst; then
18491 echo "Using your existing signal.lst file"
18492 exit 0
18493fi
18494xxx="$xxx"
18495EOS
18496$cat >>signal_cmd <<'EOS'
18497
18498set signal
18499if eval $compile_ok; then
1eb9ad5b 18500 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18501else
18502 echo "(I can't seem be able to compile the whole test program)" >&4
18503 echo "(I'll try it in little pieces.)" >&4
18504 set signal -DJUST_NSIG
18505 if eval $compile_ok; then
5440bc8e 18506 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
18507 $cat signal.nsg
18508 else
18509 echo "I can't seem to figure out how many signals you have." >&4
18510 echo "Guessing 50." >&4
18511 echo 'NSIG 50' > signal.nsg
18512 fi
18513 : Now look at all the signal names, one at a time.
18514 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18515 $cat > signal.c <<EOCP
18516#include <sys/types.h>
18517#include <signal.h>
18518#include <stdio.h>
18519int main() {
18520printf("$xx %d\n", SIG${xx});
18521return 0;
18522}
18523EOCP
18524 set signal
18525 if eval $compile; then
18526 echo "SIG${xx} found."
5440bc8e 18527 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
18528 else
18529 echo "SIG${xx} NOT found."
18530 fi
18531 done
18532 if $test -s signal.ls1; then
18533 $cat signal.nsg signal.ls1 |
65197d93 18534 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18535 fi
18536
18537fi
18538if $test -s signal.lst; then
18539 :
18540else
18541 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18542 echo 'kill -l' >signal
18543 set X `csh -f <signal`
18544 $rm -f signal
18545 shift
18546 case $# in
18547 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18548 esac
18549 echo $@ | $tr ' ' $trnl | \
18550 $awk '{ printf "%s %d\n", $1, ++s; }
18551 END { printf "NSIG %d\n", ++s }' >signal.lst
18552fi
18553$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18554EOS
18555chmod a+x signal_cmd
18556$eunicefix signal_cmd
18557
18558: generate list of signal names
18559echo " "
18560case "$sig_name_init" in
18561'') doinit=yes ;;
18562*) case "$sig_num_init" in
18563 ''|*,*) doinit=yes ;;
18564 esac ;;
18565esac
18566case "$doinit" in
18567yes)
18568 echo "Generating a list of signal names and numbers..." >&4
18569 . ./signal_cmd
18570 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18571 sig_name=`$awk 'BEGIN { printf "ZERO " }
18572 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18573 sig_num=`$awk 'BEGIN { printf "0 " }
18574 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18575 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
18576 !/^NSIG/ { printf "\"%s\", ", $1 }
18577 END { printf "0\n" }' signal.lst`
18578 sig_num_init=`$awk 'BEGIN { printf "0, " }
18579 !/^NSIG/ { printf "%d, ", $2}
18580 END { printf "0\n"}' signal.lst`
18581 ;;
18582esac
18583echo "The following $sig_count signals are available:"
18584echo " "
18585echo $sig_name | $awk \
18586'BEGIN { linelen = 0 }
18587{
18588 for (i = 1; i <= NF; i++) {
18589 name = "SIG" $i " "
18590 linelen = linelen + length(name)
18591 if (linelen > 70) {
18592 printf "\n"
18593 linelen = length(name)
18594 }
18595 printf "%s", name
18596 }
18597 printf "\n"
18598}'
76d3c696 18599sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
18600$rm -f signal signal.c signal.awk signal.lst signal_cmd
18601
18602echo " "
18603case "$sizetype" in
18604*_t) zzz="$sizetype" ;;
18605*) zzz="filesize" ;;
18606esac
18607echo "Checking the size of $zzz..." >&4
18608cat > try.c <<EOCP
18609#include <sys/types.h>
18610#include <stdio.h>
18611int main() {
18612 printf("%d\n", (int)sizeof($sizetype));
18613 exit(0);
18614}
18615EOCP
18616set try
18617if eval $compile_ok; then
5440bc8e 18618 yyy=`$run ./try`
b4eb6b3d
JH
18619 case "$yyy" in
18620 '') sizesize=4
18621 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18622 ;;
18623 *) sizesize=$yyy
18624 echo "Your $zzz size is $sizesize bytes."
18625 ;;
18626 esac
18627else
18628 sizesize=4
18629 echo "(I can't compile the test program--guessing $sizesize.)" >&4
18630fi
18631
18632
18633: check for socklen_t
18634echo " "
18635echo "Checking to see if you have socklen_t..." >&4
18636$cat >try.c <<EOCP
18637#include <sys/types.h>
18638#$d_socket HAS_SOCKET
18639#ifdef HAS_SOCKET
18640#include <sys/socket.h>
18641#endif
18642int main() { socklen_t x = 16; }
18643EOCP
18644set try
18645if eval $compile; then
18646 val="$define"
18647 echo "You have socklen_t."
18648else
18649 val="$undef"
18650 echo "You do not have socklen_t."
18651 case "$sizetype" in
18652 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18653 esac
18654fi
18655$rm -f try try.*
18656set d_socklen_t
18657eval $setvar
18658
a7710f8d
JH
18659: see if this is a socks.h system
18660set socks.h i_socks
18661eval $inhdr
18662
b4eb6b3d
JH
18663: check for type of the size argument to socket calls
18664case "$d_socket" in
18665"$define")
18666 $cat <<EOM
18667
18668Checking to see what type is the last argument of accept().
18669EOM
b4eb6b3d
JH
18670 yyy=''
18671 case "$d_socklen_t" in
18672 "$define") yyy="$yyy socklen_t"
18673 esac
18674 yyy="$yyy $sizetype int long unsigned"
18675 for xxx in $yyy; do
18676 case "$socksizetype" in
18677 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
18678 case "$usesocks" in
18679 "$define")
18680 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18681 echo "Your system accepts '$xxx *' for the last argument of accept()."
18682 socksizetype="$xxx"
18683 fi
18684 ;;
18685 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
18686 echo "Your system accepts '$xxx *' for the last argument of accept()."
18687 socksizetype="$xxx"
18688 fi
18689 ;;
18690 esac
b4eb6b3d
JH
18691 ;;
18692 esac
18693 done
18694: In case none of those worked, prompt the user.
18695 case "$socksizetype" in
18696 '') rp='What is the type for socket address structure sizes?'
18697 dflt='int'
18698 . ./myread
18699 socksizetype=$ans
18700 ;;
18701 esac
18702 ;;
18703*) : no sockets, so pick relatively harmless default
18704 socksizetype='int'
18705 ;;
18706esac
18707
18708: see what type is used for signed size_t
18709set ssize_t ssizetype int stdio.h sys/types.h
18710eval $typedef
18711dflt="$ssizetype"
5440bc8e 18712$cat > try.c <<EOM
b4eb6b3d
JH
18713#include <stdio.h>
18714#include <sys/types.h>
18715#define Size_t $sizetype
18716#define SSize_t $dflt
18717int main()
18718{
18719 if (sizeof(Size_t) == sizeof(SSize_t))
18720 printf("$dflt\n");
18721 else if (sizeof(Size_t) == sizeof(int))
18722 printf("int\n");
18723 else
18724 printf("long\n");
18725 exit(0);
18726}
18727EOM
18728echo " "
5440bc8e
JH
18729set try
18730if eval $compile_ok && $run ./try > /dev/null; then
18731 ssizetype=`$run ./try`
b4eb6b3d
JH
18732 echo "I'll be using $ssizetype for functions returning a byte count." >&4
18733else
18734 $cat >&4 <<EOM
18735Help! I can't compile and run the ssize_t test program: please enlighten me!
18736(This is probably a misconfiguration in your system or libraries, and
18737you really ought to fix it. Still, I'll try anyway.)
18738
18739I need a type that is the same size as $sizetype, but is guaranteed to
18740be signed. Common values are ssize_t, int and long.
18741
18742EOM
18743 rp="What signed type is the same size as $sizetype?"
18744 . ./myread
18745 ssizetype="$ans"
18746fi
5440bc8e 18747$rm -f try try.*
b4eb6b3d
JH
18748
18749: see what type of char stdio uses.
18750echo " "
aa517f50
JH
18751echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18752if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
18753 echo "Your stdio uses unsigned chars." >&4
18754 stdchar="unsigned char"
18755else
aa517f50
JH
18756 echo "Your stdio uses signed chars." >&4
18757 stdchar="char"
b4eb6b3d 18758fi
aa517f50
JH
18759$rm -f stdioh
18760
18761
b4eb6b3d 18762
b4eb6b3d
JH
18763: see what type uids are declared as in the kernel
18764echo " "
18765echo "Looking for the type for user ids returned by getuid()."
18766set uid_t uidtype xxx stdio.h sys/types.h
18767eval $typedef
18768case "$uidtype" in
18769xxx)
18770 xxx=`./findhdr sys/user.h`
18771 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18772 case $1 in
18773 unsigned) dflt="$1 $2" ;;
18774 *) dflt="$1" ;;
18775 esac
18776 ;;
18777*) dflt="$uidtype";;
18778esac
18779case "$uidtype" in
18780uid_t) echo "uid_t found." ;;
18781*) rp="What is the type for user ids returned by getuid()?"
18782 . ./myread
18783 uidtype="$ans"
18784 ;;
18785esac
18786
18787echo " "
18788case "$uidtype" in
18789*_t) zzz="$uidtype" ;;
18790*) zzz="uid" ;;
18791esac
18792echo "Checking the size of $zzz..." >&4
18793cat > try.c <<EOCP
18794#include <sys/types.h>
18795#include <stdio.h>
18796int main() {
18797 printf("%d\n", (int)sizeof($uidtype));
18798 exit(0);
18799}
18800EOCP
18801set try
18802if eval $compile_ok; then
5440bc8e 18803 yyy=`$run ./try`
b4eb6b3d
JH
18804 case "$yyy" in
18805 '') uidsize=4
18806 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18807 ;;
18808 *) uidsize=$yyy
18809 echo "Your $zzz is $uidsize bytes long."
18810 ;;
18811 esac
18812else
18813 uidsize=4
18814 echo "(I can't compile the test program--guessing $uidsize.)" >&4
18815fi
18816
18817echo " "
18818case "$uidtype" in
18819*_t) zzz="$uidtype" ;;
18820*) zzz="uid" ;;
18821esac
18822echo "Checking the sign of $zzz..." >&4
18823cat > try.c <<EOCP
18824#include <sys/types.h>
18825#include <stdio.h>
18826int main() {
18827 $uidtype foo = -1;
18828 if (foo < 0)
18829 printf("-1\n");
18830 else
18831 printf("1\n");
18832}
18833EOCP
18834set try
18835if eval $compile; then
5440bc8e 18836 yyy=`$run ./try`
b4eb6b3d
JH
18837 case "$yyy" in
18838 '') uidsign=1
18839 echo "(I can't execute the test program--guessing unsigned.)" >&4
18840 ;;
18841 *) uidsign=$yyy
18842 case "$uidsign" in
18843 1) echo "Your $zzz is unsigned." ;;
18844 -1) echo "Your $zzz is signed." ;;
18845 esac
18846 ;;
18847 esac
18848else
18849 uidsign=1
18850 echo "(I can't compile the test program--guessing unsigned.)" >&4
18851fi
18852
18853
18854
18855echo " "
18856$echo "Checking the format string to be used for uids..." >&4
18857
18858case "$uidsign" in
18859-1) if $test X"$uidsize" = X"$ivsize"; then
18860 uidformat="$ivdformat"
18861 else
18862 if $test X"$uidsize" = X"$longsize"; then
18863 uidformat='"ld"'
18864 else
18865 if $test X"$uidsize" = X"$intsize"; then
18866 uidformat='"d"'
18867 else
18868 if $test X"$uidsize" = X"$shortsize"; then
18869 uidformat='"hd"'
18870 fi
18871 fi
18872 fi
18873 fi
18874 ;;
18875*) if $test X"$uidsize" = X"$uvsize"; then
18876 uidformat="$uvuformat"
18877 else
18878 if $test X"$uidsize" = X"$longsize"; then
18879 uidformat='"lu"'
18880 else
18881 if $test X"$uidsize" = X"$intsize"; then
18882 uidformat='"u"'
18883 else
18884 if $test X"$uidsize" = X"$shortsize"; then
18885 uidformat='"hu"'
18886 fi
18887 fi
18888 fi
18889 fi
18890 ;;
18891esac
18892
3659ebf1
JH
18893: determine compiler compiler
18894case "$yacc" in
18895'')
18896 dflt=yacc;;
18897*)
18898 dflt="$yacc";;
18899esac
18900echo " "
18901comp='yacc'
3c728e00 18902if $test -f "$byacc$_exe"; then
3659ebf1
JH
18903 dflt="$byacc"
18904 comp="byacc or $comp"
18905fi
3c728e00 18906if $test -f "$bison$_exe"; then
3659ebf1
JH
18907 comp="$comp or bison -y"
18908fi
18909rp="Which compiler compiler ($comp) shall I use?"
18910. ./myread
18911yacc="$ans"
18912case "$yacc" in
18913*bis*)
18914 case "$yacc" in
18915 *-y*) ;;
18916 *)
18917 yacc="$yacc -y"
18918 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18919 ;;
18920 esac
18921 ;;
18922esac
18923
758a5d79
JH
18924: see if this is a fp.h system
18925set fp.h i_fp
18926eval $inhdr
18927
18928: see if this is a fp_class.h system
18929set fp_class.h i_fp_class
18930eval $inhdr
18931
b4eb6b3d 18932: see if this is a ieeefp.h system
b5b9f165
JH
18933case "$i_ieeefp" in
18934'' ) set ieeefp.h i_ieeefp
18935 eval $inhdr
18936 ;;
18937esac
b4eb6b3d
JH
18938
18939: see if this is a libutil.h system
18940set libutil.h i_libutil
18941eval $inhdr
18942
b4eb6b3d
JH
18943: see if mach cthreads are available
18944if test "X$usethreads" = "X$define"; then
18945 set mach/cthreads.h i_machcthr
18946 eval $inhdr
18947else
18948 i_machcthr="$undef"
18949fi
18950
18951
18952
18953: see if this is a math.h system
18954set math.h i_math
18955eval $inhdr
18956
18957: see if this is a mntent.h system
18958set mntent.h i_mntent
18959eval $inhdr
18960
18961: see if ndbm.h is available
18962set ndbm.h t_ndbm
18963eval $inhdr
1c6861ad
JS
18964
18965case "$t_ndbm" in
18966$undef)
18967 # Some Linux distributions such as RedHat 7.1 put the
18968 # ndbm.h header in /usr/include/gdbm/ndbm.h.
18969 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 18970 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
18971 ccflags="$ccflags -I/usr/include/gdbm"
18972 cppflags="$cppflags -I/usr/include/gdbm"
18973 t_ndbm=$define
18974 fi
18975 ;;
18976esac
18977
b4eb6b3d
JH
18978case "$t_ndbm" in
18979$define)
18980 : see if dbm_open exists
18981 set dbm_open d_dbm_open
18982 eval $inlibc
18983 case "$d_dbm_open" in
18984 $undef)
18985 t_ndbm="$undef"
18986 echo "We won't be including <ndbm.h>"
18987 ;;
18988 esac
18989 ;;
18990esac
18991val="$t_ndbm"
18992set i_ndbm
18993eval $setvar
18994
18995: see if net/errno.h is available
18996val=''
18997set net/errno.h val
18998eval $inhdr
18999
19000: Unfortunately, it causes problems on some systems. Arrgh.
19001case "$val" in
19002$define)
19003 cat > try.c <<'EOM'
19004#include <stdio.h>
19005#include <errno.h>
19006#include <net/errno.h>
19007int func()
19008{
19009 return ENOTSOCK;
19010}
19011EOM
19012 if $cc $ccflags -c try.c >/dev/null 2>&1; then
19013 echo "We'll be including <net/errno.h>." >&4
19014 else
19015 echo "We won't be including <net/errno.h>." >&4
19016 val="$undef"
19017 fi
19018 $rm -f try.* try
19019 ;;
19020esac
19021set i_neterrno
19022eval $setvar
19023
19024: see if netinet/tcp.h is available
19025set netinet/tcp.h i_netinettcp
19026eval $inhdr
19027
19028: see if this is a poll.h system
19029set poll.h i_poll
19030eval $inhdr
19031
19032: see if this is a prot.h system
19033set prot.h i_prot
19034eval $inhdr
19035
19036echo " "
19037$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
19038$cat <<'EOSH' > Cppsym.know
19039a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19040AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
19041alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19042ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19043BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
19044BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19045bull c cadmus clipper CMU COFF COMPILER_VERSION
19046concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19047CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
19048Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19049FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19050GLIBC GLIBC_MINOR
19051GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
19052H3050R H3050RX hbullx20 hcx host_mips
19053hp200 hp300 hp700 HP700 hp800 hp9000
19054hp9000s200 hp9000s300 hp9000s400 hp9000s500
19055hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19056i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 19057IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
19058INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19059LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19060LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19061Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19062LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19063M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19064M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19065M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19066MATH_HAS_NO_SIDE_EFFECTS
19067mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19068mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19069mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19070MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19071mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19072NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 19073news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
19074ns32016 ns32332 ns32k nsc32000
19075OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19076pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19077pc532 pdp11 PGC PIC plexus PORTAR posix
19078POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19079POSIX_C_SOURCE POSIX_SOURCE POWER
19080PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 19081riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
19082SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19083sony sony_news sonyrisc sparc sparclite spectrum
19084stardent stdc STDC_EXT stratos sun sun3 sun386
19085Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19086SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19087SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19088sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 19089TM3200 TM5400 TM5600
b4eb6b3d
JH
19090tower tower32 tower32_200 tower32_600 tower32_700
19091tower32_800 tower32_850 tss
19092u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19093ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
19094unix UNIX95 UNIX99 unixpc unos
19095USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19096USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19097USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19098USGr4 USGr4_2
b4eb6b3d
JH
19099Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19100XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19101XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19102z8000
19103EOSH
19104# Maybe put other stuff here too.
19105cat <<EOSH >>Cppsym.know
19106$osname
19107EOSH
19108./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19109./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19110$cat Cppsym.know > Cppsym.c
381aa1ff 19111$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
19112$rm -f Cppsym.a Cppsym.b Cppsym.c
19113cat <<EOSH > Cppsym
19114$startsh
19115if $test \$# -gt 0; then
19116 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19117 if $test -s Cppsym.got; then
19118 $rm -f Cppsym.got
19119 exit 0
19120 fi
19121 $rm -f Cppsym.got
19122 exit 1
19123else
19124 $tr " " "$trnl" | ./Cppsym.try
19125 exit 0
19126fi
19127EOSH
19128chmod +x Cppsym
19129$eunicefix Cppsym
19130cat <<EOSH > Cppsym.try
19131$startsh
19132cat <<'EOCP' > try.c
19133#include <stdio.h>
19134int main() {
19135EOCP
19136$awk \\
19137EOSH
19138cat <<'EOSH' >> Cppsym.try
19139'length($1) > 0 {
2ef53570
JH
19140 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19141 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19142 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19143 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
b4eb6b3d 19144}' >> try.c
2ef53570 19145echo 'return 0;}' >> try.c
b4eb6b3d
JH
19146EOSH
19147cat <<EOSH >> Cppsym.try
19148ccflags="$ccflags"
19149case "$osname-$gccversion" in
19150irix-) ccflags="\$ccflags -woff 1178" ;;
19151os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19152esac
5440bc8e 19153$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
19154EOSH
19155chmod +x Cppsym.try
19156$eunicefix Cppsym.try
19157./Cppsym < Cppsym.know > Cppsym.true
19158: now check the C compiler for additional symbols
19159postprocess_cc_v=''
19160case "$osname" in
19161aix) postprocess_cc_v="|$tr , ' '" ;;
19162esac
19163$cat >ccsym <<EOS
19164$startsh
19165$cat >tmp.c <<EOF
19166extern int foo;
19167EOF
19168for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19169do
19170 case "\$i" in
19171 -D*) echo "\$i" | $sed 's/^-D//';;
19172 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
19173 esac
19174done
19175$rm -f try.c
19176EOS
19177postprocess_cc_v=''
19178chmod +x ccsym
19179$eunicefix ccsym
19180./ccsym > ccsym1.raw
19181if $test -s ccsym1.raw; then
19182 $sort ccsym1.raw | $uniq >ccsym.raw
19183else
19184 mv ccsym1.raw ccsym.raw
19185fi
19186
19187$awk '/\=/ { print $0; next }
19188 { print $0"=1" }' ccsym.raw >ccsym.list
19189$awk '/\=/ { print $0; next }
19190 { print $0"=1" }' Cppsym.true >ccsym.true
19191$comm -13 ccsym.true ccsym.list >ccsym.own
19192$comm -12 ccsym.true ccsym.list >ccsym.com
19193$comm -23 ccsym.true ccsym.list >ccsym.cpp
19194also=''
19195if $test -z ccsym.raw; then
19196 echo "Your C compiler doesn't seem to define any symbols!" >&4
19197 echo " "
19198 echo "However, your C preprocessor defines the following symbols:"
19199 $cat Cppsym.true
19200 ccsymbols=''
19201 cppsymbols=`$cat Cppsym.true`
19202 cppsymbols=`echo $cppsymbols`
19203 cppccsymbols="$cppsymbols"
19204else
19205 if $test -s ccsym.com; then
19206 echo "Your C compiler and pre-processor define these symbols:"
19207 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19208 also='also '
19209 symbols='ones'
19210 cppccsymbols=`$cat ccsym.com`
19211 cppccsymbols=`echo $cppccsymbols`
19212 $test "$silent" || sleep 1
19213 fi
19214 if $test -s ccsym.cpp; then
19215 $test "$also" && echo " "
19216 echo "Your C pre-processor ${also}defines the following symbols:"
19217 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19218 also='further '
19219 cppsymbols=`$cat ccsym.cpp`
19220 cppsymbols=`echo $cppsymbols`
19221 $test "$silent" || sleep 1
19222 fi
19223 if $test -s ccsym.own; then
19224 $test "$also" && echo " "
19225 echo "Your C compiler ${also}defines the following cpp symbols:"
19226 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19227 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19228 ccsymbols=`$cat ccsym.own`
19229 ccsymbols=`echo $ccsymbols`
19230 $test "$silent" || sleep 1
19231 fi
19232fi
b4eb6b3d
JH
19233
19234: see if this is a termio system
19235val="$undef"
19236val2="$undef"
19237val3="$undef"
19238if $test `./findhdr termios.h`; then
19239 set tcsetattr i_termios
19240 eval $inlibc
19241 val3="$i_termios"
19242fi
19243echo " "
19244case "$val3" in
19245"$define") echo "You have POSIX termios.h... good!" >&4;;
19246*) if ./Cppsym pyr; then
19247 case "`/bin/universe`" in
19248 ucb) if $test `./findhdr sgtty.h`; then
19249 val2="$define"
19250 echo "<sgtty.h> found." >&4
19251 else
19252 echo "System is pyramid with BSD universe."
19253 echo "<sgtty.h> not found--you could have problems." >&4
19254 fi;;
19255 *) if $test `./findhdr termio.h`; then
19256 val="$define"
19257 echo "<termio.h> found." >&4
19258 else
19259 echo "System is pyramid with USG universe."
19260 echo "<termio.h> not found--you could have problems." >&4
19261 fi;;
19262 esac
19263 elif ./usg; then
19264 if $test `./findhdr termio.h`; then
19265 echo "<termio.h> found." >&4
19266 val="$define"
19267 elif $test `./findhdr sgtty.h`; then
19268 echo "<sgtty.h> found." >&4
19269 val2="$define"
19270 else
19271echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19272 fi
19273 else
19274 if $test `./findhdr sgtty.h`; then
19275 echo "<sgtty.h> found." >&4
19276 val2="$define"
19277 elif $test `./findhdr termio.h`; then
19278 echo "<termio.h> found." >&4
19279 val="$define"
19280 else
19281echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19282 fi
19283 fi;;
19284esac
19285set i_termio; eval $setvar
19286val=$val2; set i_sgtty; eval $setvar
19287val=$val3; set i_termios; eval $setvar
19288
b4eb6b3d
JH
19289: see if stddef is available
19290set stddef.h i_stddef
19291eval $inhdr
923fc586 19292
b4eb6b3d
JH
19293: see if this is a sunmath.h system
19294set sunmath.h i_sunmath
19295eval $inhdr
5f80c64f 19296
b4eb6b3d
JH
19297: see if sys/access.h is available
19298set sys/access.h i_sysaccess
19299eval $inhdr
19300
19301: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19302set sys/filio.h i_sysfilio
19303eval $inhdr
19304echo " "
19305if $test `./findhdr sys/ioctl.h`; then
19306 val="$define"
19307 echo '<sys/ioctl.h> found.' >&4
19308else
19309 val="$undef"
19310 if $test $i_sysfilio = "$define"; then
19311 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 19312 else
b4eb6b3d
JH
19313 $test $i_sgtty = "$define" && xxx="sgtty.h"
19314 $test $i_termio = "$define" && xxx="termio.h"
19315 $test $i_termios = "$define" && xxx="termios.h"
19316echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19317 fi
19318fi
19319set i_sysioctl
19320eval $setvar
19321
49a78c82
JH
19322: see if socket ioctl defs are in sys/sockio.h
19323echo " "
19324xxx=`./findhdr sys/sockio.h`
19325if $test "$xxx"; then
19326 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19327 val="$define"
19328 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19329 else
19330 val="$undef"
19331 echo "No socket ioctls found in <sys/sockio.h>." >&4
19332 fi
19333else
19334 val="$undef"
19335 $cat <<EOM
19336<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19337EOM
19338fi
19339set i_syssockio
19340eval $setvar
19341
b4eb6b3d
JH
19342
19343: see if this is a syslog.h system
19344set syslog.h i_syslog
19345eval $inhdr
19346
19347
19348: see if this is a sys/mode.h system
19349set sys/mode.h i_sysmode
19350eval $inhdr
19351
19352: see if sys/resource.h has to be included
19353set sys/resource.h i_sysresrc
19354eval $inhdr
19355
19356: see if sys/security.h is available
19357set sys/security.h i_syssecrt
19358eval $inhdr
19359
19360: see if this is a sys/statvfs.h system
19361set sys/statvfs.h i_sysstatvfs
19362eval $inhdr
19363
b4eb6b3d
JH
19364: see if this is a sys/un.h system
19365set sys/un.h i_sysun
19366eval $inhdr
19367
19368
19369: see if this is a sys/utsname.h system
19370set sys/utsname.h i_sysutsname
19371eval $inhdr
19372
19373: see if this is a syswait system
19374set sys/wait.h i_syswait
19375eval $inhdr
19376
19377: see if this is a ustat.h system
19378set ustat.h i_ustat
19379eval $inhdr
19380
19381: see if this is an utime system
19382set utime.h i_utime
19383eval $inhdr
19384
19385: see if this is a values.h system
19386set values.h i_values
19387eval $inhdr
19388
19389: see if this is a vfork system
19390case "$d_vfork" in
19391"$define")
19392 set vfork.h i_vfork
19393 eval $inhdr
19394 ;;
19395*)
19396 i_vfork="$undef"
19397 ;;
19398esac
19399
19400: see if gdbm.h is available
19401set gdbm.h t_gdbm
19402eval $inhdr
19403case "$t_gdbm" in
19404$define)
19405 : see if gdbm_open exists
19406 set gdbm_open d_gdbm_open
19407 eval $inlibc
19408 case "$d_gdbm_open" in
19409 $undef)
19410 t_gdbm="$undef"
19411 echo "We won't be including <gdbm.h>"
5f80c64f 19412 ;;
b4eb6b3d
JH
19413 esac
19414 ;;
19415esac
19416val="$t_gdbm"
19417set i_gdbm
19418eval $setvar
19419
19420echo " "
19421echo "Looking for extensions..." >&4
19422: If we are using the old config.sh, known_extensions may contain
19423: old or inaccurate or duplicate values.
19424known_extensions=''
19425nonxs_extensions=''
19426: We do not use find because it might not be available.
19427: We do not just use MANIFEST because the user may have dropped
19428: some additional extensions into the source tree and expect them
19429: to be built.
19430
19431: Function to recursively find available extensions, ignoring DynaLoader
19432: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19433find_extensions='
19434 for xxx in *; do
19435 case "$xxx" in
19436 DynaLoader|dynaload) ;;
19437 *)
19438 if $test -f $xxx/$xxx.xs; then
19439 known_extensions="$known_extensions $1$xxx";
19440 elif $test -f $xxx/Makefile.PL; then
19441 nonxs_extensions="$nonxs_extensions $1$xxx";
19442 else
19443 if $test -d $xxx -a $# -lt 10; then
19444 set $1$xxx/ $*;
6904989c 19445 cd "$xxx";
b4eb6b3d
JH
19446 eval $find_extensions;
19447 cd ..;
19448 shift;
19449 fi;
19450 fi
19451 ;;
19452 esac;
19453 done'
19454tdir=`pwd`
6904989c 19455cd "$rsrc/ext"
b4eb6b3d
JH
19456set X
19457shift
19458eval $find_extensions
4e1a6d26
AD
19459# Special case: Add in threads/shared since it is not picked up by the
19460# recursive find above (and adding in general recursive finding breaks
19461# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 19462known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
19463set X $nonxs_extensions
19464shift
19465nonxs_extensions="$*"
19466set X $known_extensions
19467shift
19468known_extensions="$*"
6904989c 19469cd "$tdir"
b4eb6b3d
JH
19470
19471: Now see which are supported on this system.
19472avail_ext=''
19473for xxx in $known_extensions ; do
19474 case "$xxx" in
19475 DB_File|db_file)
19476 case "$i_db" in
19477 $define) avail_ext="$avail_ext $xxx" ;;
19478 esac
19479 ;;
19480 GDBM_File|gdbm_fil)
19481 case "$i_gdbm" in
19482 $define) avail_ext="$avail_ext $xxx" ;;
19483 esac
19484 ;;
1d59c593 19485 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
19486 case "$i_langinfo$d_nl_langinfo" in
19487 $define$define) avail_ext="$avail_ext $xxx" ;;
19488 esac
19489 ;;
b4eb6b3d
JH
19490 NDBM_File|ndbm_fil)
19491 case "$i_ndbm" in
19492 $define)
19493 case "$osname-$use64bitint" in
252f4fb1 19494 cygwin-*|hpux-define)
b4eb6b3d
JH
19495 case "$libs" in
19496 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19497 esac
19498 ;;
19499 *) avail_ext="$avail_ext $xxx" ;;
19500 esac
19501 ;;
19502 esac
19503 ;;
19504 ODBM_File|odbm_fil)
19505 case "${i_dbm}${i_rpcsvcdbm}" in
19506 *"${define}"*)
19507 case "$osname-$use64bitint" in
252f4fb1 19508 cygwin-*|hpux-define)
b4eb6b3d
JH
19509 case "$libs" in
19510 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19511 esac
19512 ;;
19513 *) avail_ext="$avail_ext $xxx" ;;
19514 esac
19515 ;;
19516 esac
19517 ;;
19518 POSIX|posix)
19519 case "$useposix" in
19520 true|define|y) avail_ext="$avail_ext $xxx" ;;
19521 esac
19522 ;;
19523 Opcode|opcode)
19524 case "$useopcode" in
19525 true|define|y) avail_ext="$avail_ext $xxx" ;;
19526 esac
19527 ;;
19528 Socket|socket)
19529 case "$d_socket" in
4a9f028c
JH
19530 true|$define|y)
19531 case "$osname" in
19532 beos) ;; # not unless BONE
19533 *) avail_ext="$avail_ext $xxx" ;;
19534 esac
19535 ;;
b4eb6b3d
JH
19536 esac
19537 ;;
19538 Sys/Syslog|sys/syslog)
19539 : XXX syslog requires socket
19540 case "$d_socket" in
19541 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19542 esac
19543 ;;
19544 Thread|thread)
b00ec89b
AB
19545 case "$usethreads" in
19546 true|$define|y)
19547 case "$useithreads" in
19548 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19549 esac
b4eb6b3d
JH
19550 esac
19551 ;;
7deadc5f 19552 threads|threads/shared)
1dca008a
JH
19553 case "$usethreads" in
19554 true|$define|y)
19555 case "$useithreads" in
19556 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
19557 esac
19558 esac
19559 ;;
b4eb6b3d
JH
19560 IPC/SysV|ipc/sysv)
19561 : XXX Do we need a useipcsysv variable here
19562 case "${d_msg}${d_sem}${d_shm}" in
19563 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19564 esac
19565 ;;
19566 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
19567 ;;
19568 esac
b4eb6b3d 19569done
5f80c64f 19570
b4eb6b3d
JH
19571set X $avail_ext
19572shift
19573avail_ext="$*"
5f80c64f 19574
b4eb6b3d
JH
19575: Now see which nonxs extensions are supported on this system.
19576: For now assume all are.
19577nonxs_ext=''
19578for xxx in $nonxs_extensions ; do
19579 case "$xxx" in
19580 *) nonxs_ext="$nonxs_ext $xxx"
19581 ;;
19582 esac
19583done
5f80c64f 19584
b4eb6b3d
JH
19585set X $nonxs_ext
19586shift
19587nonxs_ext="$*"
19588
19589case $usedl in
19590$define)
19591 $cat <<EOM
19592A number of extensions are supplied with $package. You may choose to
19593compile these extensions for dynamic loading (the default), compile
19594them into the $package executable (static loading), or not include
19595them at all. Answer "none" to include no extensions.
19596Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
19597
19598EOM
b4eb6b3d
JH
19599 case "$dynamic_ext" in
19600 '') dflt="$avail_ext" ;;
19601 *) dflt="$dynamic_ext"
19602 # Perhaps we are reusing an old out-of-date config.sh.
19603 case "$hint" in
19604 previous)
19605 if test X"$dynamic_ext" != X"$avail_ext"; then
19606 $cat <<EOM
19607NOTICE: Your previous config.sh list may be incorrect.
19608The extensions now available to you are
19609 ${avail_ext}
19610but the default list from your previous config.sh is
19611 ${dynamic_ext}
9c839522 19612
b4eb6b3d
JH
19613EOM
19614 fi
9c839522
PM
19615 ;;
19616 esac
b4eb6b3d
JH
19617 ;;
19618 esac
5f80c64f 19619 case "$dflt" in
b4eb6b3d
JH
19620 '') dflt=none;;
19621 esac
19622 rp="What extensions do you wish to load dynamically?"
19623 . ./myread
19624 case "$ans" in
19625 none) dynamic_ext=' ' ;;
19626 *) dynamic_ext="$ans" ;;
5f80c64f 19627 esac
5f80c64f 19628
b4eb6b3d
JH
19629 case "$static_ext" in
19630 '')
19631 : Exclude those already listed in dynamic linking
19632 dflt=''
19633 for xxx in $avail_ext; do
19634 case " $dynamic_ext " in
19635 *" $xxx "*) ;;
19636 *) dflt="$dflt $xxx" ;;
19637 esac
19638 done
19639 set X $dflt
19640 shift
19641 dflt="$*"
19642 ;;
19643 *) dflt="$static_ext"
19644 ;;
19645 esac
9c839522 19646
b4eb6b3d
JH
19647 case "$dflt" in
19648 '') dflt=none;;
19649 esac
19650 rp="What extensions do you wish to load statically?"
19651 . ./myread
19652 case "$ans" in
19653 none) static_ext=' ' ;;
19654 *) static_ext="$ans" ;;
19655 esac
19656 ;;
19657*)
19658 $cat <<EOM
19659A number of extensions are supplied with $package. Answer "none"
19660to include no extensions.
19661Note that DynaLoader is always built and need not be mentioned here.
9c839522 19662
b4eb6b3d
JH
19663EOM
19664 case "$static_ext" in
19665 '') dflt="$avail_ext" ;;
19666 *) dflt="$static_ext"
19667 # Perhaps we are reusing an old out-of-date config.sh.
19668 case "$hint" in
19669 previous)
19670 if test X"$static_ext" != X"$avail_ext"; then
19671 $cat <<EOM
19672NOTICE: Your previous config.sh list may be incorrect.
19673The extensions now available to you are
19674 ${avail_ext}
19675but the default list from your previous config.sh is
19676 ${static_ext}
5f80c64f
JH
19677
19678EOM
b4eb6b3d
JH
19679 fi
19680 ;;
19681 esac
19682 ;;
19683 esac
19684 : Exclude those that are not xs extensions
19685 case "$dflt" in
19686 '') dflt=none;;
998b396c
JH
19687 *) case " $dflt " in
19688 *" Encode "*) # Add the subextensions of Encode
19689 cd "$rsrc/ext"
ec0d5e21 19690 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
998b396c
JH
19691 dflt="$dflt Encode/$xxx"
19692 done
19693 cd "$tdir"
19694 ;;
19695 esac
19696 ;;
b4eb6b3d
JH
19697 esac
19698 rp="What extensions do you wish to include?"
19699 . ./myread
19700 case "$ans" in
19701 none) static_ext=' ' ;;
19702 *) static_ext="$ans" ;;
19703 esac
19704 ;;
5f80c64f
JH
19705esac
19706
b4eb6b3d
JH
19707set X $dynamic_ext $static_ext $nonxs_ext
19708shift
19709extensions="$*"
19710
9c839522
PM
19711: Remove libraries needed only for extensions
19712: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
19713: The exception is SunOS 4.x, which needs them.
19714case "${osname}X${osvers}" in
19715sunos*X4*)
19716 perllibs="$libs"
19717 ;;
19718*) case "$usedl" in
19719 $define|true|[yY]*)
19720 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
19721 shift
19722 perllibs="$*"
19723 ;;
19724 *) perllibs="$libs"
19725 ;;
19726 esac
19727 ;;
9c839522 19728esac
5f80c64f
JH
19729
19730: Remove build directory name from cppstdin so it can be used from
19731: either the present location or the final installed location.
19732echo " "
19733: Get out of the UU directory to get correct path name.
19734cd ..
19735case "$cppstdin" in
19736`pwd`/cppstdin)
19737 echo "Stripping down cppstdin path name"
19738 cppstdin=cppstdin
19739 ;;
19740esac
19741cd UU
19742
19743: end of configuration questions
19744echo " "
19745echo "End of configuration questions."
19746echo " "
19747
19748: back to where it started
19749if test -d ../UU; then
19750 cd ..
19751fi
19752
48370efc
JH
19753: configuration may be patched via a 'config.arch' file
19754if $test -f config.arch; then
19755 echo "I see a config.arch file, loading it."
19756 . ./config.arch
19757fi
19758
5f80c64f
JH
19759: configuration may be patched via a 'config.over' file
19760if $test -f config.over; then
19761 echo " "
19762 dflt=y
19763 rp='I see a config.over file. Do you wish to load it?'
19764 . UU/myread
19765 case "$ans" in
19766 n*) echo "OK, I'll ignore it.";;
19767 *) . ./config.over
19768 echo "Configuration override changes have been loaded."
19769 ;;
19770 esac
19771fi
19772
19773: in case they want portability, strip down executable paths
19774case "$d_portable" in
19775"$define")
19776 echo " "
19777 echo "Stripping down executable paths..." >&4
19778 for file in $loclist $trylist; do
534ac15a
JH
19779 eval temp=\$$file
19780 eval $file=`basename $temp`
5f80c64f
JH
19781 done
19782 ;;
19783esac
19784
19785: create config.sh file
19786echo " "
19787echo "Creating config.sh..." >&4
19788$spitshell <<EOT >config.sh
19789$startsh
19790#
19791# This file was produced by running the Configure script. It holds all the
19792# definitions figured out by Configure. Should you modify one of these values,
19793# do not forget to propagate your changes by running "Configure -der". You may
19794# instead choose to run each of the .SH files by yourself, or "Configure -S".
19795#
19796
19797# Package name : $package
19798# Source directory : $src
19799# Configuration time: $cf_time
19800# Configured by : $cf_by
19801# Target system : $myuname
19802
19803Author='$Author'
19804Date='$Date'
19805Header='$Header'
19806Id='$Id'
19807Locker='$Locker'
19808Log='$Log'
19809Mcc='$Mcc'
19810RCSfile='$RCSfile'
19811Revision='$Revision'
19812Source='$Source'
19813State='$State'
19814_a='$_a'
19815_exe='$_exe'
19816_o='$_o'
b4eb6b3d 19817afs='$afs'
a6d26a0d 19818afsroot='$afsroot'
b4eb6b3d
JH
19819alignbytes='$alignbytes'
19820ansi2knr='$ansi2knr'
19821aphostname='$aphostname'
19822api_revision='$api_revision'
19823api_subversion='$api_subversion'
19824api_version='$api_version'
19825api_versionstring='$api_versionstring'
5f80c64f 19826ar='$ar'
b4eb6b3d
JH
19827archlib='$archlib'
19828archlibexp='$archlibexp'
19829archname64='$archname64'
19830archname='$archname'
5f80c64f 19831archobjs='$archobjs'
10bc17b6 19832asctime_r_proto='$asctime_r_proto'
5f80c64f 19833awk='$awk'
b4eb6b3d 19834baserev='$baserev'
5f80c64f 19835bash='$bash'
b4eb6b3d
JH
19836bin='$bin'
19837bincompat5005='$bincompat5005'
19838binexp='$binexp'
5f80c64f
JH
19839bison='$bison'
19840byacc='$byacc'
b4eb6b3d 19841byteorder='$byteorder'
5f80c64f 19842c='$c'
b4eb6b3d 19843castflags='$castflags'
5f80c64f
JH
19844cat='$cat'
19845cc='$cc'
19846cccdlflags='$cccdlflags'
19847ccdlflags='$ccdlflags'
19848ccflags='$ccflags'
b4eb6b3d 19849ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 19850ccname='$ccname'
b4eb6b3d 19851ccsymbols='$ccsymbols'
6b356c8e 19852ccversion='$ccversion'
5f80c64f 19853cf_by='$cf_by'
b4eb6b3d 19854cf_email='$cf_email'
5f80c64f 19855cf_time='$cf_time'
b4eb6b3d 19856charsize='$charsize'
5f80c64f
JH
19857chgrp='$chgrp'
19858chmod='$chmod'
19859chown='$chown'
b4eb6b3d 19860clocktype='$clocktype'
5f80c64f
JH
19861comm='$comm'
19862compress='$compress'
19863contains='$contains'
19864cp='$cp'
19865cpio='$cpio'
19866cpp='$cpp'
b4eb6b3d
JH
19867cpp_stuff='$cpp_stuff'
19868cppccsymbols='$cppccsymbols'
5f80c64f
JH
19869cppflags='$cppflags'
19870cpplast='$cpplast'
19871cppminus='$cppminus'
19872cpprun='$cpprun'
19873cppstdin='$cppstdin'
b4eb6b3d 19874cppsymbols='$cppsymbols'
10bc17b6 19875crypt_r_proto='$crypt_r_proto'
b4eb6b3d 19876cryptlib='$cryptlib'
5f80c64f 19877csh='$csh'
10bc17b6
JH
19878ctermid_r_proto='$ctermid_r_proto'
19879ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
19880d_Gconvert='$d_Gconvert'
19881d_PRIEUldbl='$d_PRIEUldbl'
19882d_PRIFUldbl='$d_PRIFUldbl'
19883d_PRIGUldbl='$d_PRIGUldbl'
19884d_PRIXU64='$d_PRIXU64'
19885d_PRId64='$d_PRId64'
19886d_PRIeldbl='$d_PRIeldbl'
19887d_PRIfldbl='$d_PRIfldbl'
19888d_PRIgldbl='$d_PRIgldbl'
19889d_PRIi64='$d_PRIi64'
19890d_PRIo64='$d_PRIo64'
19891d_PRIu64='$d_PRIu64'
19892d_PRIx64='$d_PRIx64'
19893d_SCNfldbl='$d_SCNfldbl'
74cac757 19894d__fwalk='$d__fwalk'
b4eb6b3d
JH
19895d_access='$d_access'
19896d_accessx='$d_accessx'
19897d_alarm='$d_alarm'
19898d_archlib='$d_archlib'
10bc17b6 19899d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
19900d_atolf='$d_atolf'
19901d_atoll='$d_atoll'
19902d_attribut='$d_attribut'
19903d_bcmp='$d_bcmp'
19904d_bcopy='$d_bcopy'
19905d_bincompat5005='$d_bincompat5005'
5f80c64f 19906d_bsd='$d_bsd'
b4eb6b3d
JH
19907d_bsdgetpgrp='$d_bsdgetpgrp'
19908d_bsdsetpgrp='$d_bsdsetpgrp'
19909d_bzero='$d_bzero'
19910d_casti32='$d_casti32'
19911d_castneg='$d_castneg'
19912d_charvspr='$d_charvspr'
19913d_chown='$d_chown'
19914d_chroot='$d_chroot'
19915d_chsize='$d_chsize'
758a5d79 19916d_class='$d_class'
b4eb6b3d 19917d_closedir='$d_closedir'
4e0554ec 19918d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
19919d_const='$d_const'
19920d_crypt='$d_crypt'
10bc17b6 19921d_crypt_r='$d_crypt_r'
b4eb6b3d 19922d_csh='$d_csh'
10bc17b6
JH
19923d_ctermid_r='$d_ctermid_r'
19924d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
19925d_cuserid='$d_cuserid'
19926d_dbl_dig='$d_dbl_dig'
2ef53570 19927d_dbminitproto='$d_dbminitproto'
b4eb6b3d 19928d_difftime='$d_difftime'
ae0e3d3b 19929d_dirfd='$d_dirfd'
b4eb6b3d
JH
19930d_dirnamlen='$d_dirnamlen'
19931d_dlerror='$d_dlerror'
5f80c64f 19932d_dlopen='$d_dlopen'
b4eb6b3d
JH
19933d_dlsymun='$d_dlsymun'
19934d_dosuid='$d_dosuid'
10bc17b6 19935d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
19936d_drand48proto='$d_drand48proto'
19937d_dup2='$d_dup2'
19938d_eaccess='$d_eaccess'
19939d_endgrent='$d_endgrent'
10bc17b6 19940d_endgrent_r='$d_endgrent_r'
b4eb6b3d 19941d_endhent='$d_endhent'
10bc17b6 19942d_endhostent_r='$d_endhostent_r'
b4eb6b3d 19943d_endnent='$d_endnent'
10bc17b6 19944d_endnetent_r='$d_endnetent_r'
b4eb6b3d 19945d_endpent='$d_endpent'
10bc17b6 19946d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 19947d_endpwent='$d_endpwent'
10bc17b6 19948d_endpwent_r='$d_endpwent_r'
b4eb6b3d 19949d_endsent='$d_endsent'
10bc17b6 19950d_endservent_r='$d_endservent_r'
b4eb6b3d 19951d_eofnblk='$d_eofnblk'
5f80c64f 19952d_eunice='$d_eunice'
b363b713 19953d_fchdir='$d_fchdir'
b4eb6b3d
JH
19954d_fchmod='$d_fchmod'
19955d_fchown='$d_fchown'
19956d_fcntl='$d_fcntl'
9d9004a9 19957d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
19958d_fd_macros='$d_fd_macros'
19959d_fd_set='$d_fd_set'
19960d_fds_bits='$d_fds_bits'
19961d_fgetpos='$d_fgetpos'
758a5d79
JH
19962d_finite='$d_finite'
19963d_finitel='$d_finitel'
b4eb6b3d
JH
19964d_flexfnam='$d_flexfnam'
19965d_flock='$d_flock'
2ef53570 19966d_flockproto='$d_flockproto'
b4eb6b3d 19967d_fork='$d_fork'
758a5d79 19968d_fp_class='$d_fp_class'
b4eb6b3d 19969d_fpathconf='$d_fpathconf'
758a5d79
JH
19970d_fpclass='$d_fpclass'
19971d_fpclassify='$d_fpclassify'
19972d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
19973d_fpos64_t='$d_fpos64_t'
19974d_frexpl='$d_frexpl'
19975d_fs_data_s='$d_fs_data_s'
19976d_fseeko='$d_fseeko'
19977d_fsetpos='$d_fsetpos'
19978d_fstatfs='$d_fstatfs'
19979d_fstatvfs='$d_fstatvfs'
411ab01c 19980d_fsync='$d_fsync'
b4eb6b3d
JH
19981d_ftello='$d_ftello'
19982d_ftime='$d_ftime'
19983d_getcwd='$d_getcwd'
19984d_getespwnam='$d_getespwnam'
19985d_getfsstat='$d_getfsstat'
19986d_getgrent='$d_getgrent'
10bc17b6
JH
19987d_getgrent_r='$d_getgrent_r'
19988d_getgrgid_r='$d_getgrgid_r'
19989d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
19990d_getgrps='$d_getgrps'
19991d_gethbyaddr='$d_gethbyaddr'
19992d_gethbyname='$d_gethbyname'
19993d_gethent='$d_gethent'
19994d_gethname='$d_gethname'
10bc17b6
JH
19995d_gethostbyaddr_r='$d_gethostbyaddr_r'
19996d_gethostbyname_r='$d_gethostbyname_r'
19997d_gethostent_r='$d_gethostent_r'
b4eb6b3d 19998d_gethostprotos='$d_gethostprotos'
4e0554ec 19999d_getitimer='$d_getitimer'
b4eb6b3d 20000d_getlogin='$d_getlogin'
10bc17b6 20001d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
20002d_getmnt='$d_getmnt'
20003d_getmntent='$d_getmntent'
20004d_getnbyaddr='$d_getnbyaddr'
20005d_getnbyname='$d_getnbyname'
20006d_getnent='$d_getnent'
10bc17b6
JH
20007d_getnetbyaddr_r='$d_getnetbyaddr_r'
20008d_getnetbyname_r='$d_getnetbyname_r'
20009d_getnetent_r='$d_getnetent_r'
b4eb6b3d 20010d_getnetprotos='$d_getnetprotos'
0c0643d0 20011d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
20012d_getpbyname='$d_getpbyname'
20013d_getpbynumber='$d_getpbynumber'
20014d_getpent='$d_getpent'
20015d_getpgid='$d_getpgid'
20016d_getpgrp2='$d_getpgrp2'
20017d_getpgrp='$d_getpgrp'
20018d_getppid='$d_getppid'
20019d_getprior='$d_getprior'
10bc17b6
JH
20020d_getprotobyname_r='$d_getprotobyname_r'
20021d_getprotobynumber_r='$d_getprotobynumber_r'
20022d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
20023d_getprotoprotos='$d_getprotoprotos'
20024d_getprpwnam='$d_getprpwnam'
20025d_getpwent='$d_getpwent'
10bc17b6
JH
20026d_getpwent_r='$d_getpwent_r'
20027d_getpwnam_r='$d_getpwnam_r'
20028d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
20029d_getsbyname='$d_getsbyname'
20030d_getsbyport='$d_getsbyport'
20031d_getsent='$d_getsent'
10bc17b6
JH
20032d_getservbyname_r='$d_getservbyname_r'
20033d_getservbyport_r='$d_getservbyport_r'
20034d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
20035d_getservprotos='$d_getservprotos'
20036d_getspnam='$d_getspnam'
10bc17b6 20037d_getspnam_r='$d_getspnam_r'
b4eb6b3d 20038d_gettimeod='$d_gettimeod'
10bc17b6 20039d_gmtime_r='$d_gmtime_r'
5f80c64f 20040d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
20041d_grpasswd='$d_grpasswd'
20042d_hasmntopt='$d_hasmntopt'
20043d_htonl='$d_htonl'
b4eb6b3d
JH
20044d_index='$d_index'
20045d_inetaton='$d_inetaton'
20046d_int64_t='$d_int64_t'
20047d_isascii='$d_isascii'
758a5d79
JH
20048d_isfinite='$d_isfinite'
20049d_isinf='$d_isinf'
b4eb6b3d
JH
20050d_isnan='$d_isnan'
20051d_isnanl='$d_isnanl'
20052d_killpg='$d_killpg'
20053d_lchown='$d_lchown'
20054d_ldbl_dig='$d_ldbl_dig'
20055d_link='$d_link'
10bc17b6 20056d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
20057d_locconv='$d_locconv'
20058d_lockf='$d_lockf'
20059d_longdbl='$d_longdbl'
20060d_longlong='$d_longlong'
20061d_lseekproto='$d_lseekproto'
20062d_lstat='$d_lstat'
20063d_madvise='$d_madvise'
20064d_mblen='$d_mblen'
20065d_mbstowcs='$d_mbstowcs'
20066d_mbtowc='$d_mbtowc'
20067d_memchr='$d_memchr'
20068d_memcmp='$d_memcmp'
20069d_memcpy='$d_memcpy'
20070d_memmove='$d_memmove'
20071d_memset='$d_memset'
20072d_mkdir='$d_mkdir'
20073d_mkdtemp='$d_mkdtemp'
20074d_mkfifo='$d_mkfifo'
20075d_mkstemp='$d_mkstemp'
20076d_mkstemps='$d_mkstemps'
20077d_mktime='$d_mktime'
20078d_mmap='$d_mmap'
20079d_modfl='$d_modfl'
e67aeab1 20080d_modfl_pow32_bug='$d_modfl_pow32_bug'
b4eb6b3d
JH
20081d_mprotect='$d_mprotect'
20082d_msg='$d_msg'
20083d_msg_ctrunc='$d_msg_ctrunc'
20084d_msg_dontroute='$d_msg_dontroute'
20085d_msg_oob='$d_msg_oob'
20086d_msg_peek='$d_msg_peek'
20087d_msg_proxy='$d_msg_proxy'
20088d_msgctl='$d_msgctl'
20089d_msgget='$d_msgget'
4e0554ec 20090d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
20091d_msgrcv='$d_msgrcv'
20092d_msgsnd='$d_msgsnd'
20093d_msync='$d_msync'
20094d_munmap='$d_munmap'
20095d_mymalloc='$d_mymalloc'
20096d_nice='$d_nice'
2765b840 20097d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 20098d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
20099d_off64_t='$d_off64_t'
20100d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20101d_oldpthreads='$d_oldpthreads'
20102d_oldsock='$d_oldsock'
20103d_open3='$d_open3'
20104d_pathconf='$d_pathconf'
20105d_pause='$d_pause'
20106d_perl_otherlibdirs='$d_perl_otherlibdirs'
20107d_phostname='$d_phostname'
20108d_pipe='$d_pipe'
20109d_poll='$d_poll'
5f80c64f 20110d_portable='$d_portable'
c7aff470 20111d_procselfexe='$d_procselfexe'
d6483fcc 20112d_pthread_atfork='$d_pthread_atfork'
b4eb6b3d
JH
20113d_pthread_yield='$d_pthread_yield'
20114d_pwage='$d_pwage'
20115d_pwchange='$d_pwchange'
20116d_pwclass='$d_pwclass'
20117d_pwcomment='$d_pwcomment'
20118d_pwexpire='$d_pwexpire'
20119d_pwgecos='$d_pwgecos'
20120d_pwpasswd='$d_pwpasswd'
20121d_pwquota='$d_pwquota'
20122d_qgcvt='$d_qgcvt'
20123d_quad='$d_quad'
10bc17b6
JH
20124d_random_r='$d_random_r'
20125d_readdir64_r='$d_readdir64_r'
b4eb6b3d 20126d_readdir='$d_readdir'
10bc17b6 20127d_readdir_r='$d_readdir_r'
b4eb6b3d 20128d_readlink='$d_readlink'
4e0554ec
JH
20129d_readv='$d_readv'
20130d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
20131d_rename='$d_rename'
20132d_rewinddir='$d_rewinddir'
20133d_rmdir='$d_rmdir'
20134d_safebcpy='$d_safebcpy'
20135d_safemcpy='$d_safemcpy'
20136d_sanemcmp='$d_sanemcmp'
ef9f17be 20137d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
20138d_sched_yield='$d_sched_yield'
20139d_scm_rights='$d_scm_rights'
20140d_seekdir='$d_seekdir'
20141d_select='$d_select'
20142d_sem='$d_sem'
20143d_semctl='$d_semctl'
20144d_semctl_semid_ds='$d_semctl_semid_ds'
20145d_semctl_semun='$d_semctl_semun'
20146d_semget='$d_semget'
20147d_semop='$d_semop'
4e0554ec 20148d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
20149d_setegid='$d_setegid'
20150d_seteuid='$d_seteuid'
20151d_setgrent='$d_setgrent'
10bc17b6 20152d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
20153d_setgrps='$d_setgrps'
20154d_sethent='$d_sethent'
10bc17b6 20155d_sethostent_r='$d_sethostent_r'
4e0554ec 20156d_setitimer='$d_setitimer'
b4eb6b3d
JH
20157d_setlinebuf='$d_setlinebuf'
20158d_setlocale='$d_setlocale'
10bc17b6 20159d_setlocale_r='$d_setlocale_r'
b4eb6b3d 20160d_setnent='$d_setnent'
10bc17b6 20161d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
20162d_setpent='$d_setpent'
20163d_setpgid='$d_setpgid'
20164d_setpgrp2='$d_setpgrp2'
20165d_setpgrp='$d_setpgrp'
20166d_setprior='$d_setprior'
20167d_setproctitle='$d_setproctitle'
10bc17b6 20168d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 20169d_setpwent='$d_setpwent'
10bc17b6 20170d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
20171d_setregid='$d_setregid'
20172d_setresgid='$d_setresgid'
20173d_setresuid='$d_setresuid'
20174d_setreuid='$d_setreuid'
20175d_setrgid='$d_setrgid'
20176d_setruid='$d_setruid'
20177d_setsent='$d_setsent'
10bc17b6 20178d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
20179d_setsid='$d_setsid'
20180d_setvbuf='$d_setvbuf'
20181d_sfio='$d_sfio'
20182d_shm='$d_shm'
20183d_shmat='$d_shmat'
20184d_shmatprototype='$d_shmatprototype'
20185d_shmctl='$d_shmctl'
20186d_shmdt='$d_shmdt'
20187d_shmget='$d_shmget'
20188d_sigaction='$d_sigaction'
983dbef6 20189d_sigprocmask='$d_sigprocmask'
b4eb6b3d 20190d_sigsetjmp='$d_sigsetjmp'
49a78c82 20191d_sockatmark='$d_sockatmark'
2ef53570 20192d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
20193d_socket='$d_socket'
20194d_socklen_t='$d_socklen_t'
20195d_sockpair='$d_sockpair'
20196d_socks5_init='$d_socks5_init'
20197d_sqrtl='$d_sqrtl'
10bc17b6
JH
20198d_srand48_r='$d_srand48_r'
20199d_srandom_r='$d_srandom_r'
eef837ea 20200d_sresgproto='$d_sresgproto'
640374d0 20201d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
20202d_statblks='$d_statblks'
20203d_statfs_f_flags='$d_statfs_f_flags'
20204d_statfs_s='$d_statfs_s'
20205d_statvfs='$d_statvfs'
20206d_stdio_cnt_lval='$d_stdio_cnt_lval'
20207d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
20208d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20209d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
20210d_stdio_stream_array='$d_stdio_stream_array'
20211d_stdiobase='$d_stdiobase'
20212d_stdstdio='$d_stdstdio'
20213d_strchr='$d_strchr'
20214d_strcoll='$d_strcoll'
20215d_strctcpy='$d_strctcpy'
20216d_strerrm='$d_strerrm'
20217d_strerror='$d_strerror'
10bc17b6 20218d_strerror_r='$d_strerror_r'
b3c85772 20219d_strftime='$d_strftime'
b4eb6b3d
JH
20220d_strtod='$d_strtod'
20221d_strtol='$d_strtol'
20222d_strtold='$d_strtold'
20223d_strtoll='$d_strtoll'
28e5dec8 20224d_strtoq='$d_strtoq'
b4eb6b3d
JH
20225d_strtoul='$d_strtoul'
20226d_strtoull='$d_strtoull'
20227d_strtouq='$d_strtouq'
20228d_strxfrm='$d_strxfrm'
20229d_suidsafe='$d_suidsafe'
20230d_symlink='$d_symlink'
20231d_syscall='$d_syscall'
2ef53570 20232d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
20233d_sysconf='$d_sysconf'
20234d_sysernlst='$d_sysernlst'
20235d_syserrlst='$d_syserrlst'
20236d_system='$d_system'
20237d_tcgetpgrp='$d_tcgetpgrp'
20238d_tcsetpgrp='$d_tcsetpgrp'
20239d_telldir='$d_telldir'
20240d_telldirproto='$d_telldirproto'
20241d_time='$d_time'
20242d_times='$d_times'
14b90194
JH
20243d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20244d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 20245d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 20246d_truncate='$d_truncate'
10bc17b6 20247d_ttyname_r='$d_ttyname_r'
b4eb6b3d 20248d_tzname='$d_tzname'
4e0554ec
JH
20249d_u32align='$d_u32align'
20250d_ualarm='$d_ualarm'
b4eb6b3d
JH
20251d_umask='$d_umask'
20252d_uname='$d_uname'
20253d_union_semun='$d_union_semun'
758a5d79 20254d_unordered='$d_unordered'
4e0554ec 20255d_usleep='$d_usleep'
2ef53570 20256d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
20257d_ustat='$d_ustat'
20258d_vendorarch='$d_vendorarch'
20259d_vendorbin='$d_vendorbin'
20260d_vendorlib='$d_vendorlib'
20261d_vfork='$d_vfork'
20262d_void_closedir='$d_void_closedir'
20263d_voidsig='$d_voidsig'
20264d_voidtty='$d_voidtty'
20265d_volatile='$d_volatile'
20266d_vprintf='$d_vprintf'
20267d_wait4='$d_wait4'
20268d_waitpid='$d_waitpid'
20269d_wcstombs='$d_wcstombs'
20270d_wctomb='$d_wctomb'
4e0554ec 20271d_writev='$d_writev'
5f80c64f
JH
20272d_xenix='$d_xenix'
20273date='$date'
b4eb6b3d
JH
20274db_hashtype='$db_hashtype'
20275db_prefixtype='$db_prefixtype'
640374d0
JH
20276db_version_major='$db_version_major'
20277db_version_minor='$db_version_minor'
20278db_version_patch='$db_version_patch'
b4eb6b3d
JH
20279defvoidused='$defvoidused'
20280direntrytype='$direntrytype'
20281dlext='$dlext'
5f80c64f 20282dlsrc='$dlsrc'
b4eb6b3d
JH
20283doublesize='$doublesize'
20284drand01='$drand01'
10bc17b6 20285drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
20286dynamic_ext='$dynamic_ext'
20287eagain='$eagain'
20288ebcdic='$ebcdic'
5f80c64f
JH
20289echo='$echo'
20290egrep='$egrep'
20291emacs='$emacs'
10bc17b6
JH
20292endgrent_r_proto='$endgrent_r_proto'
20293endhostent_r_proto='$endhostent_r_proto'
20294endnetent_r_proto='$endnetent_r_proto'
20295endprotoent_r_proto='$endprotoent_r_proto'
20296endpwent_r_proto='$endpwent_r_proto'
20297endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
20298eunicefix='$eunicefix'
20299exe_ext='$exe_ext'
20300expr='$expr'
b4eb6b3d 20301extensions='$extensions'
6fcddf3b 20302extras='$extras'
b4eb6b3d
JH
20303fflushNULL='$fflushNULL'
20304fflushall='$fflushall'
5f80c64f
JH
20305find='$find'
20306firstmakefile='$firstmakefile'
20307flex='$flex'
b4eb6b3d
JH
20308fpossize='$fpossize'
20309fpostype='$fpostype'
20310freetype='$freetype'
5440bc8e 20311from='$from'
b4eb6b3d
JH
20312full_ar='$full_ar'
20313full_csh='$full_csh'
20314full_sed='$full_sed'
5b463ca7 20315gccosandvers='$gccosandvers'
5f80c64f 20316gccversion='$gccversion'
10bc17b6
JH
20317getgrent_r_proto='$getgrent_r_proto'
20318getgrgid_r_proto='$getgrgid_r_proto'
20319getgrnam_r_proto='$getgrnam_r_proto'
20320gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20321gethostbyname_r_proto='$gethostbyname_r_proto'
20322gethostent_r_proto='$gethostent_r_proto'
20323getlogin_r_proto='$getlogin_r_proto'
20324getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20325getnetbyname_r_proto='$getnetbyname_r_proto'
20326getnetent_r_proto='$getnetent_r_proto'
20327getprotobyname_r_proto='$getprotobyname_r_proto'
20328getprotobynumber_r_proto='$getprotobynumber_r_proto'
20329getprotoent_r_proto='$getprotoent_r_proto'
20330getpwent_r_proto='$getpwent_r_proto'
20331getpwnam_r_proto='$getpwnam_r_proto'
20332getpwuid_r_proto='$getpwuid_r_proto'
20333getservbyname_r_proto='$getservbyname_r_proto'
20334getservbyport_r_proto='$getservbyport_r_proto'
20335getservent_r_proto='$getservent_r_proto'
20336getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
20337gidformat='$gidformat'
20338gidsign='$gidsign'
20339gidsize='$gidsize'
20340gidtype='$gidtype'
5f80c64f 20341glibpth='$glibpth'
3c728e00 20342gmake='$gmake'
10bc17b6 20343gmtime_r_proto='$gmtime_r_proto'
5f80c64f 20344grep='$grep'
b4eb6b3d
JH
20345groupcat='$groupcat'
20346groupstype='$groupstype'
5f80c64f 20347gzip='$gzip'
b4eb6b3d
JH
20348h_fcntl='$h_fcntl'
20349h_sysfile='$h_sysfile'
5f80c64f 20350hint='$hint'
b4eb6b3d
JH
20351hostcat='$hostcat'
20352i16size='$i16size'
20353i16type='$i16type'
20354i32size='$i32size'
20355i32type='$i32type'
20356i64size='$i64size'
20357i64type='$i64type'
20358i8size='$i8size'
20359i8type='$i8type'
20360i_arpainet='$i_arpainet'
20361i_bsdioctl='$i_bsdioctl'
10bc17b6 20362i_crypt='$i_crypt'
b4eb6b3d
JH
20363i_db='$i_db'
20364i_dbm='$i_dbm'
20365i_dirent='$i_dirent'
5f80c64f 20366i_dld='$i_dld'
b4eb6b3d
JH
20367i_dlfcn='$i_dlfcn'
20368i_fcntl='$i_fcntl'
20369i_float='$i_float'
758a5d79
JH
20370i_fp='$i_fp'
20371i_fp_class='$i_fp_class'
b4eb6b3d
JH
20372i_gdbm='$i_gdbm'
20373i_grp='$i_grp'
b4eb6b3d
JH
20374i_ieeefp='$i_ieeefp'
20375i_inttypes='$i_inttypes'
2765b840 20376i_langinfo='$i_langinfo'
b4eb6b3d
JH
20377i_libutil='$i_libutil'
20378i_limits='$i_limits'
20379i_locale='$i_locale'
20380i_machcthr='$i_machcthr'
20381i_malloc='$i_malloc'
20382i_math='$i_math'
20383i_memory='$i_memory'
20384i_mntent='$i_mntent'
20385i_ndbm='$i_ndbm'
20386i_netdb='$i_netdb'
20387i_neterrno='$i_neterrno'
20388i_netinettcp='$i_netinettcp'
20389i_niin='$i_niin'
20390i_poll='$i_poll'
20391i_prot='$i_prot'
20392i_pthread='$i_pthread'
20393i_pwd='$i_pwd'
20394i_rpcsvcdbm='$i_rpcsvcdbm'
20395i_sfio='$i_sfio'
20396i_sgtty='$i_sgtty'
20397i_shadow='$i_shadow'
20398i_socks='$i_socks'
20399i_stdarg='$i_stdarg'
20400i_stddef='$i_stddef'
20401i_stdlib='$i_stdlib'
20402i_string='$i_string'
20403i_sunmath='$i_sunmath'
20404i_sysaccess='$i_sysaccess'
20405i_sysdir='$i_sysdir'
20406i_sysfile='$i_sysfile'
20407i_sysfilio='$i_sysfilio'
20408i_sysin='$i_sysin'
20409i_sysioctl='$i_sysioctl'
20410i_syslog='$i_syslog'
20411i_sysmman='$i_sysmman'
20412i_sysmode='$i_sysmode'
20413i_sysmount='$i_sysmount'
20414i_sysndir='$i_sysndir'
20415i_sysparam='$i_sysparam'
20416i_sysresrc='$i_sysresrc'
20417i_syssecrt='$i_syssecrt'
20418i_sysselct='$i_sysselct'
20419i_syssockio='$i_syssockio'
20420i_sysstat='$i_sysstat'
20421i_sysstatfs='$i_sysstatfs'
20422i_sysstatvfs='$i_sysstatvfs'
20423i_systime='$i_systime'
20424i_systimek='$i_systimek'
20425i_systimes='$i_systimes'
20426i_systypes='$i_systypes'
20427i_sysuio='$i_sysuio'
20428i_sysun='$i_sysun'
20429i_sysutsname='$i_sysutsname'
20430i_sysvfs='$i_sysvfs'
20431i_syswait='$i_syswait'
20432i_termio='$i_termio'
20433i_termios='$i_termios'
20434i_time='$i_time'
20435i_unistd='$i_unistd'
20436i_ustat='$i_ustat'
20437i_utime='$i_utime'
20438i_values='$i_values'
20439i_varargs='$i_varargs'
20440i_varhdr='$i_varhdr'
20441i_vfork='$i_vfork'
5f80c64f 20442ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
20443inc_version_list='$inc_version_list'
20444inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
20445incpath='$incpath'
20446inews='$inews'
b4eb6b3d
JH
20447installarchlib='$installarchlib'
20448installbin='$installbin'
20449installman1dir='$installman1dir'
20450installman3dir='$installman3dir'
20451installprefix='$installprefix'
20452installprefixexp='$installprefixexp'
20453installprivlib='$installprivlib'
20454installscript='$installscript'
20455installsitearch='$installsitearch'
20456installsitebin='$installsitebin'
20457installsitelib='$installsitelib'
20458installstyle='$installstyle'
20459installusrbinperl='$installusrbinperl'
20460installvendorarch='$installvendorarch'
20461installvendorbin='$installvendorbin'
20462installvendorlib='$installvendorlib'
20463intsize='$intsize'
4b661809 20464issymlink='$issymlink'
b4eb6b3d
JH
20465ivdformat='$ivdformat'
20466ivsize='$ivsize'
20467ivtype='$ivtype'
20468known_extensions='$known_extensions'
5f80c64f 20469ksh='$ksh'
5f80c64f
JH
20470ld='$ld'
20471lddlflags='$lddlflags'
20472ldflags='$ldflags'
b4eb6b3d
JH
20473ldflags_uselargefiles='$ldflags_uselargefiles'
20474ldlibpthname='$ldlibpthname'
5f80c64f
JH
20475less='$less'
20476lib_ext='$lib_ext'
20477libc='$libc'
b4eb6b3d 20478libperl='$libperl'
5f80c64f
JH
20479libpth='$libpth'
20480libs='$libs'
43999f95
JH
20481libsdirs='$libsdirs'
20482libsfiles='$libsfiles'
20483libsfound='$libsfound'
13b3f787 20484libspath='$libspath'
5f80c64f 20485libswanted='$libswanted'
b4eb6b3d 20486libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
20487line='$line'
20488lint='$lint'
20489lkflags='$lkflags'
20490ln='$ln'
20491lns='$lns'
10bc17b6 20492localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
20493locincpth='$locincpth'
20494loclibpth='$loclibpth'
b4eb6b3d
JH
20495longdblsize='$longdblsize'
20496longlongsize='$longlongsize'
20497longsize='$longsize'
5f80c64f
JH
20498lp='$lp'
20499lpr='$lpr'
20500ls='$ls'
b4eb6b3d
JH
20501lseeksize='$lseeksize'
20502lseektype='$lseektype'
5f80c64f
JH
20503mail='$mail'
20504mailx='$mailx'
20505make='$make'
20506make_set_make='$make_set_make'
b4eb6b3d
JH
20507mallocobj='$mallocobj'
20508mallocsrc='$mallocsrc'
20509malloctype='$malloctype'
20510man1dir='$man1dir'
20511man1direxp='$man1direxp'
20512man1ext='$man1ext'
20513man3dir='$man3dir'
20514man3direxp='$man3direxp'
20515man3ext='$man3ext'
5f80c64f
JH
20516mips_type='$mips_type'
20517mkdir='$mkdir'
b4eb6b3d
JH
20518mmaptype='$mmaptype'
20519modetype='$modetype'
5f80c64f 20520more='$more'
b4eb6b3d 20521multiarch='$multiarch'
5f80c64f 20522mv='$mv'
b4eb6b3d
JH
20523myarchname='$myarchname'
20524mydomain='$mydomain'
20525myhostname='$myhostname'
5f80c64f
JH
20526myuname='$myuname'
20527n='$n'
2cc61e15 20528need_va_copy='$need_va_copy'
b4eb6b3d
JH
20529netdb_hlen_type='$netdb_hlen_type'
20530netdb_host_type='$netdb_host_type'
20531netdb_name_type='$netdb_name_type'
20532netdb_net_type='$netdb_net_type'
5f80c64f
JH
20533nm='$nm'
20534nm_opt='$nm_opt'
20535nm_so_opt='$nm_so_opt'
b4eb6b3d 20536nonxs_ext='$nonxs_ext'
5f80c64f 20537nroff='$nroff'
b4eb6b3d
JH
20538nvEUformat='$nvEUformat'
20539nvFUformat='$nvFUformat'
20540nvGUformat='$nvGUformat'
53133ed1 20541nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
20542nveformat='$nveformat'
20543nvfformat='$nvfformat'
20544nvgformat='$nvgformat'
20545nvsize='$nvsize'
20546nvtype='$nvtype'
20547o_nonblock='$o_nonblock'
5f80c64f 20548obj_ext='$obj_ext'
b4eb6b3d 20549old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 20550optimize='$optimize'
b4eb6b3d 20551orderlib='$orderlib'
5f80c64f
JH
20552osname='$osname'
20553osvers='$osvers'
b4eb6b3d 20554otherlibdirs='$otherlibdirs'
5f80c64f 20555package='$package'
b4eb6b3d
JH
20556pager='$pager'
20557passcat='$passcat'
20558patchlevel='$patchlevel'
5f80c64f 20559path_sep='$path_sep'
b4eb6b3d 20560perl5='$perl5'
5f80c64f 20561perl='$perl'
151e6568 20562perl_patchlevel='$perl_patchlevel'
b4eb6b3d 20563perladmin='$perladmin'
9c839522 20564perllibs='$perllibs'
b4eb6b3d 20565perlpath='$perlpath'
5f80c64f 20566pg='$pg'
b4eb6b3d
JH
20567phostname='$phostname'
20568pidtype='$pidtype'
5f80c64f 20569plibpth='$plibpth'
b4eb6b3d 20570pm_apiversion='$pm_apiversion'
5f80c64f
JH
20571pmake='$pmake'
20572pr='$pr'
b4eb6b3d
JH
20573prefix='$prefix'
20574prefixexp='$prefixexp'
20575privlib='$privlib'
20576privlibexp='$privlibexp'
f24dbf84 20577procselfexe='$procselfexe'
b4eb6b3d
JH
20578prototype='$prototype'
20579ptrsize='$ptrsize'
20580quadkind='$quadkind'
20581quadtype='$quadtype'
20582randbits='$randbits'
20583randfunc='$randfunc'
10bc17b6 20584random_r_proto='$random_r_proto'
b4eb6b3d
JH
20585randseedtype='$randseedtype'
20586ranlib='$ranlib'
20587rd_nodata='$rd_nodata'
10bc17b6
JH
20588readdir64_r_proto='$readdir64_r_proto'
20589readdir_r_proto='$readdir_r_proto'
b4eb6b3d 20590revision='$revision'
5f80c64f
JH
20591rm='$rm'
20592rmail='$rmail'
5440bc8e 20593run='$run'
5f80c64f 20594runnm='$runnm'
b4eb6b3d
JH
20595sPRIEUldbl='$sPRIEUldbl'
20596sPRIFUldbl='$sPRIFUldbl'
20597sPRIGUldbl='$sPRIGUldbl'
20598sPRIXU64='$sPRIXU64'
20599sPRId64='$sPRId64'
20600sPRIeldbl='$sPRIeldbl'
20601sPRIfldbl='$sPRIfldbl'
20602sPRIgldbl='$sPRIgldbl'
20603sPRIi64='$sPRIi64'
20604sPRIo64='$sPRIo64'
20605sPRIu64='$sPRIu64'
20606sPRIx64='$sPRIx64'
20607sSCNfldbl='$sSCNfldbl'
20608sched_yield='$sched_yield'
20609scriptdir='$scriptdir'
20610scriptdirexp='$scriptdirexp'
5f80c64f 20611sed='$sed'
b4eb6b3d
JH
20612seedfunc='$seedfunc'
20613selectminbits='$selectminbits'
20614selecttype='$selecttype'
5f80c64f 20615sendmail='$sendmail'
10bc17b6
JH
20616setgrent_r_proto='$setgrent_r_proto'
20617sethostent_r_proto='$sethostent_r_proto'
20618setlocale_r_proto='$setlocale_r_proto'
20619setnetent_r_proto='$setnetent_r_proto'
20620setprotoent_r_proto='$setprotoent_r_proto'
20621setpwent_r_proto='$setpwent_r_proto'
20622setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
20623sh='$sh'
20624shar='$shar'
20625sharpbang='$sharpbang'
b4eb6b3d
JH
20626shmattype='$shmattype'
20627shortsize='$shortsize'
20628shrpenv='$shrpenv'
5f80c64f 20629shsharp='$shsharp'
b4eb6b3d
JH
20630sig_count='$sig_count'
20631sig_name='$sig_name'
20632sig_name_init='$sig_name_init'
20633sig_num='$sig_num'
20634sig_num_init='$sig_num_init'
76d3c696 20635sig_size='$sig_size'
b4eb6b3d
JH
20636signal_t='$signal_t'
20637sitearch='$sitearch'
20638sitearchexp='$sitearchexp'
20639sitebin='$sitebin'
20640sitebinexp='$sitebinexp'
20641sitelib='$sitelib'
20642sitelib_stem='$sitelib_stem'
20643sitelibexp='$sitelibexp'
20644siteprefix='$siteprefix'
20645siteprefixexp='$siteprefixexp'
20646sizesize='$sizesize'
20647sizetype='$sizetype'
5f80c64f
JH
20648sleep='$sleep'
20649smail='$smail'
5f80c64f 20650so='$so'
b4eb6b3d
JH
20651sockethdr='$sockethdr'
20652socketlib='$socketlib'
20653socksizetype='$socksizetype'
5f80c64f
JH
20654sort='$sort'
20655spackage='$spackage'
20656spitshell='$spitshell'
10bc17b6
JH
20657srand48_r_proto='$srand48_r_proto'
20658srandom_r_proto='$srandom_r_proto'
5f80c64f 20659src='$src'
b4eb6b3d
JH
20660ssizetype='$ssizetype'
20661startperl='$startperl'
5f80c64f 20662startsh='$startsh'
b4eb6b3d
JH
20663static_ext='$static_ext'
20664stdchar='$stdchar'
20665stdio_base='$stdio_base'
20666stdio_bufsiz='$stdio_bufsiz'
20667stdio_cnt='$stdio_cnt'
20668stdio_filbuf='$stdio_filbuf'
20669stdio_ptr='$stdio_ptr'
20670stdio_stream_array='$stdio_stream_array'
10bc17b6 20671strerror_r_proto='$strerror_r_proto'
b4eb6b3d 20672strings='$strings'
5f80c64f 20673submit='$submit'
b4eb6b3d
JH
20674subversion='$subversion'
20675sysman='$sysman'
5f80c64f
JH
20676tail='$tail'
20677tar='$tar'
5440bc8e 20678targetarch='$targetarch'
5f80c64f
JH
20679tbl='$tbl'
20680tee='$tee'
20681test='$test'
b4eb6b3d
JH
20682timeincl='$timeincl'
20683timetype='$timetype'
10bc17b6 20684tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 20685to='$to'
5f80c64f
JH
20686touch='$touch'
20687tr='$tr'
20688trnl='$trnl'
20689troff='$troff'
10bc17b6 20690ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
20691u16size='$u16size'
20692u16type='$u16type'
20693u32size='$u32size'
20694u32type='$u32type'
20695u64size='$u64size'
20696u64type='$u64type'
20697u8size='$u8size'
20698u8type='$u8type'
20699uidformat='$uidformat'
20700uidsign='$uidsign'
20701uidsize='$uidsize'
20702uidtype='$uidtype'
5f80c64f
JH
20703uname='$uname'
20704uniq='$uniq'
b4eb6b3d
JH
20705uquadtype='$uquadtype'
20706use5005threads='$use5005threads'
20707use64bitall='$use64bitall'
20708use64bitint='$use64bitint'
5440bc8e 20709usecrosscompile='$usecrosscompile'
5f80c64f 20710usedl='$usedl'
b4eb6b3d
JH
20711useithreads='$useithreads'
20712uselargefiles='$uselargefiles'
20713uselongdouble='$uselongdouble'
20714usemorebits='$usemorebits'
20715usemultiplicity='$usemultiplicity'
20716usemymalloc='$usemymalloc'
5f80c64f 20717usenm='$usenm'
b4eb6b3d
JH
20718useopcode='$useopcode'
20719useperlio='$useperlio'
20720useposix='$useposix'
9514c62b 20721usereentrant='$usereentrant'
b4eb6b3d
JH
20722usesfio='$usesfio'
20723useshrplib='$useshrplib'
29209bc5 20724usesocks='$usesocks'
b4eb6b3d
JH
20725usethreads='$usethreads'
20726usevendorprefix='$usevendorprefix'
20727usevfork='$usevfork'
5f80c64f
JH
20728usrinc='$usrinc'
20729uuname='$uuname'
b4eb6b3d
JH
20730uvXUformat='$uvXUformat'
20731uvoformat='$uvoformat'
20732uvsize='$uvsize'
20733uvtype='$uvtype'
20734uvuformat='$uvuformat'
20735uvxformat='$uvxformat'
20736vendorarch='$vendorarch'
20737vendorarchexp='$vendorarchexp'
20738vendorbin='$vendorbin'
20739vendorbinexp='$vendorbinexp'
20740vendorlib='$vendorlib'
20741vendorlib_stem='$vendorlib_stem'
20742vendorlibexp='$vendorlibexp'
20743vendorprefix='$vendorprefix'
20744vendorprefixexp='$vendorprefixexp'
20745version='$version'
861eb78d 20746version_patchlevel_string='$version_patchlevel_string'
d56c5707 20747versiononly='$versiononly'
5f80c64f 20748vi='$vi'
b4eb6b3d 20749voidflags='$voidflags'
5f80c64f 20750xlibpth='$xlibpth'
b4eb6b3d 20751xs_apiversion='$xs_apiversion'
3659ebf1
JH
20752yacc='$yacc'
20753yaccflags='$yaccflags'
5f80c64f
JH
20754zcat='$zcat'
20755zip='$zip'
20756EOT
20757
20758: Add in command line options if available
20759$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20760
20761: add special variables
20762$test -f $src/patchlevel.h && \
d00b958f 20763awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 20764echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 20765echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
20766
20767: propagate old symbols
20768if $test -f UU/config.sh; then
381aa1ff 20769 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 20770 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 20771 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
20772 set X `cat UU/oldsyms`
20773 shift
20774 case $# in
20775 0) ;;
20776 *)
20777 cat <<EOM
20778Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20779EOM
20780 echo "# Variables propagated from previous config.sh file." >>config.sh
20781 for sym in `cat UU/oldsyms`; do
20782 echo " Propagating $hint variable "'$'"$sym..."
20783 eval 'tmp="$'"${sym}"'"'
20784 echo "$tmp" | \
20785 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20786 done
20787 ;;
20788 esac
20789fi
20790
20791: Finish up by extracting the .SH files
20792case "$alldone" in
20793exit)
20794 $rm -rf UU
24ccb310 20795 echo "Extraction done."
5f80c64f
JH
20796 exit 0
20797 ;;
20798cont)
20799 ;;
20800'')
20801 dflt=''
20802 nostick=true
20803 $cat <<EOM
20804
20805If you'd like to make any changes to the config.sh file before I begin
20806to configure things, do it as a shell escape now (e.g. !vi config.sh).
20807
20808EOM
20809 rp="Press return or use a shell escape to edit config.sh:"
20810 . UU/myread
20811 nostick=''
20812 case "$ans" in
20813 '') ;;
20814 *) : in case they cannot read
20815 sh 1>&4 -c "$ans";;
20816 esac
20817 ;;
20818esac
20819
20820: if this fails, just run all the .SH files by hand
20821. ./config.sh
20822
20823echo " "
20824exec 1>&4
a43e8593 20825pwd=`pwd`
5f80c64f 20826. ./UU/extract
6904989c 20827cd "$pwd"
5f80c64f
JH
20828
20829if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20830 dflt=y
20831 case "$silent" in
20832 true) ;;
20833 *)
20834 $cat <<EOM
20835
20836Now you need to generate make dependencies by running "$make depend".
20837You might prefer to run it in background: "$make depend > makedepend.out &"
20838It can take a while, so you might not want to run it right now.
20839
20840EOM
20841 ;;
20842 esac
20843 rp="Run $make depend now?"
20844 . UU/myread
20845 case "$ans" in
20846 y*)
3d5d58b1 20847 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
20848 ;;
20849 *)
20850 echo "You must run '$make depend' then '$make'."
20851 ;;
20852 esac
20853elif test -f [Mm]akefile; then
20854 echo " "
20855 echo "Now you must run a $make."
20856else
24ccb310 20857 echo "Configure done."
5f80c64f
JH
20858fi
20859
20860if $test -f Policy.sh; then
20861 $cat <<EOM
20862
20863If you compile $package on a different machine or from a different object
20864directory, copy the Policy.sh file from this object directory to the
20865new one before you run Configure -- this will help you with most of
20866the policy defaults.
20867
20868EOM
20869fi
20870if $test -f config.msg; then
20871 echo "Hmm. I also noted the following information while running:"
20872 echo " "
20873 $cat config.msg >&4
20874 $rm -f config.msg
20875fi
20876$rm -f kit*isdone ark*isdone
20877$rm -rf UU
20878
20879: End of Configure
20880