This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
CPAN.pm sync
[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#
73e09c8f 23# Generated on Wed Apr 17 17:49:13 EET DST 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 ;;
65dc58a1
TM
3078 openbsd) osname=openbsd
3079 osvers="$3"
3080 ;;
aaacdc8b
GS
3081 POSIX-BC | posix-bc ) osname=posix-bc
3082 osvers="$3"
a0d0e21e 3083 ;;
ae3afa4e
TH
3084 powerux | power_ux | powermax_os | powermaxos | \
3085 powerunix | power_unix) osname=powerux
3086 osvers="$3"
3087 ;;
aaacdc8b
GS
3088 qnx) osname=qnx
3089 osvers="$4"
3090 ;;
a0d0e21e
LW
3091 solaris) osname=solaris
3092 case "$3" in
3093 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3094 *) osvers="$3" ;;
a0d0e21e
LW
3095 esac
3096 ;;
85e6fe83
LW
3097 sunos) osname=sunos
3098 case "$3" in
85e6fe83
LW
3099 5*) osname=solaris
3100 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3101 *) osvers="$3" ;;
2304df62
AD
3102 esac
3103 ;;
a0d0e21e 3104 titanos) osname=titanos
85e6fe83 3105 case "$3" in
a0d0e21e
LW
3106 1*) osvers=1 ;;
3107 2*) osvers=2 ;;
3108 3*) osvers=3 ;;
3109 4*) osvers=4 ;;
ecfc5424 3110 *) osvers="$3" ;;
2304df62
AD
3111 esac
3112 ;;
85e6fe83 3113 ultrix) osname=ultrix
ecfc5424 3114 osvers="$3"
2304df62 3115 ;;
28757baa 3116 osf1|mls+) case "$5" in
fed7345c
AD
3117 alpha)
3118 osname=dec_osf
2aa76180
JH
3119 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3120 case "$osvers" in
3121 [1-9].[0-9]*) ;;
3122 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3123 esac
ecfc5424
AD
3124 ;;
3125 hp*) osname=hp_osf1 ;;
3126 mips) osname=mips_osf1 ;;
85e6fe83
LW
3127 esac
3128 ;;
0337d152
BG
3129 unixware) osname=svr5
3130 osvers="$4"
3131 ;;
3c728e00 3132 uts) osname=uts
a0d0e21e
LW
3133 osvers="$3"
3134 ;;
3c728e00
JH
3135 vos) osvers="$3"
3136 ;;
85e6fe83 3137 $2) case "$osname" in
2304df62 3138 *isc*) ;;
a0d0e21e 3139 *freebsd*) ;;
5f05dabc 3140 svr*)
a0d0e21e
LW
3141 : svr4.x or possibly later
3142 case "svr$3" in
3143 ${osname}*)
3144 osname=svr$3
3145 osvers=$4
3146 ;;
3147 esac
3148 case "$osname" in
3149 svr4.0)
3150 : Check for ESIX
3151 if test -f /stand/boot ; then
3152 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3153 if test -n "$INITPROG" -a -f "$INITPROG"; then
3154 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3155 if test -n "$isesix"; then
a0d0e21e
LW
3156 osname=esix4
3157 fi
3158 fi
3159 fi
3160 ;;
3161 esac
3162 ;;
2304df62 3163 *) if test -f /etc/systemid; then
a0d0e21e
LW
3164 osname=sco
3165 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3166 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3167 osvers=$1.$2.$3
c4f23d77 3168 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3169 osvers=$1.$2
c4f23d77 3170 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3171 osvers=$1
2304df62 3172 fi
a0d0e21e
LW
3173 else
3174 case "$osname" in
3175 '') : Still unknown. Probably a generic Sys V.
3176 osname="sysv"
3177 osvers="$3"
3178 ;;
3179 esac
2304df62
AD
3180 fi
3181 ;;
3182 esac
3183 ;;
a0d0e21e
LW
3184 *) case "$osname" in
3185 '') : Still unknown. Probably a generic BSD.
3186 osname="$1"
3187 osvers="$3"
3188 ;;
3189 esac
3190 ;;
2304df62
AD
3191 esac
3192 else
dfe9444c
AD
3193 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3194 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3195 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3196 osname=news_os
2304df62 3197 fi
dfe9444c 3198 $rm -f UU/kernel.what
8e07c86e
AD
3199 elif test -d c:/.; then
3200 set X $myuname
3201 osname=os2
3202 osvers="$5"
2304df62
AD
3203 fi
3204 fi
85e6fe83 3205
5440bc8e
JH
3206 case "$targetarch" in
3207 '') ;;
3208 *) hostarch=$osname
3209 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3210 osvers=''
3211 ;;
3212 esac
3213
a0d0e21e
LW
3214 : Now look for a hint file osname_osvers, unless one has been
3215 : specified already.
3216 case "$hintfile" in
3217 ''|' ')
1e127011 3218 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3219 : Also try without trailing minor version numbers.
1e127011
DD
3220 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3221 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3222 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3223 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3224 case "$file" in
3225 '') dflt=none ;;
3226 *) case "$osvers" in
3227 '') dflt=$file
3228 ;;
dfe9444c 3229 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3230 dflt=$file
dfe9444c 3231 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3232 dflt=$xfile
dfe9444c 3233 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3234 dflt=$xxfile
dfe9444c 3235 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3236 dflt=$xxxfile
dfe9444c 3237 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3238 dflt=$xxxxfile
dfe9444c 3239 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3240 dflt="${osname}"
3241 else
3242 dflt=none
3243 fi
3244 ;;
3245 esac
85e6fe83
LW
3246 ;;
3247 esac
4e2a5f63
AD
3248 if $test -f Policy.sh ; then
3249 case "$dflt" in
3250 *Policy*) ;;
3251 none) dflt="Policy" ;;
3252 *) dflt="Policy $dflt" ;;
3253 esac
3254 fi
85e6fe83 3255 ;;
a0d0e21e 3256 *)
ecfc5424 3257 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3258 ;;
2304df62 3259 esac
1aef975c 3260
4e2a5f63
AD
3261 if $test -f Policy.sh ; then
3262 $cat <<EOM
3263
3264There's also a Policy hint file available, which should make the
3265site-specific (policy) questions easier to answer.
3266EOM
3267
3268 fi
3269
2304df62
AD
3270 $cat <<EOM
3271
3272You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3273A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3274is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3275
3276EOM
4e2a5f63 3277
2304df62 3278 rp="Which of these apply, if any?"
dfe9444c 3279 . UU/myread
85e6fe83
LW
3280 tans=$ans
3281 for file in $tans; do
4e2a5f63
AD
3282 if $test X$file = XPolicy -a -f Policy.sh; then
3283 . Policy.sh
3284 $cat Policy.sh >> UU/config.sh
3285 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3286 . $src/hints/$file.sh
3287 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3288 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3289 : nothing
3290 else
85e6fe83
LW
3291 : Give one chance to correct a possible typo.
3292 echo "$file.sh does not exist"
3293 dflt=$file
3294 rp="hint to use instead?"
dfe9444c 3295 . UU/myread
85e6fe83 3296 for file in $ans; do
dfe9444c
AD
3297 if $test -f "$src/hints/$file.sh"; then
3298 . $src/hints/$file.sh
3299 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3300 elif $test X$ans = X -o X$ans = Xnone ; then
3301 : nothing
3302 else
3303 echo "$file.sh does not exist -- ignored."
3304 fi
3305 done
2304df62
AD
3306 fi
3307 done
85e6fe83 3308
2304df62 3309 hint=recommended
85e6fe83 3310 : Remember our hint file for later.
dfe9444c 3311 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3312 hintfile="$file"
85e6fe83 3313 else
a0d0e21e 3314 hintfile=''
85e6fe83 3315 fi
2304df62
AD
3316fi
3317cd UU
3318;;
3319*)
3320 echo " "
3321 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3322 tmp_n="$n"
3323 tmp_c="$c"
2304df62
AD
3324 cd ..
3325 cp $config_sh config.sh 2>/dev/null
a78b0d02 3326 chmod +w config.sh
2304df62
AD
3327 . ./config.sh
3328 cd UU
3329 cp ../config.sh .
ecfc5424
AD
3330 n="$tmp_n"
3331 c="$tmp_c"
2304df62
AD
3332 hint=previous
3333 ;;
3334esac
1aef975c 3335test "$override" && . ./optdef.sh
2304df62
AD
3336
3337: Restore computed paths
3338for file in $loclist $trylist; do
3339 eval $file="\$_$file"
3340done
3341
85e6fe83 3342cat << EOM
a0d0e21e 3343
85e6fe83 3344Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3345The default value is probably right if the name rings a bell. Otherwise,
3346since spelling matters for me, either accept the default or answer "none"
3347to leave it blank.
a0d0e21e 3348
85e6fe83 3349EOM
85e6fe83 3350case "$osname" in
a0d0e21e 3351 ''|' ')
85e6fe83 3352 case "$hintfile" in
a0d0e21e 3353 ''|' '|none) dflt=none ;;
ecfc5424 3354 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3355 esac
3356 ;;
3357 *) dflt="$osname" ;;
3358esac
3359rp="Operating system name?"
3360. ./myread
3361case "$ans" in
ecfc5424
AD
3362none) osname='' ;;
3363*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3364esac
8ff267be 3365echo " "
3366case "$osvers" in
3367 ''|' ')
3368 case "$hintfile" in
3369 ''|' '|none) dflt=none ;;
3370 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3371 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3372 case "$dflt" in
3373 ''|' ') dflt=none ;;
3374 esac
3375 ;;
3376 esac
3377 ;;
3378 *) dflt="$osvers" ;;
3379esac
3380rp="Operating system version?"
3381. ./myread
3382case "$ans" in
3383none) osvers='' ;;
3384*) osvers="$ans" ;;
3385esac
3386
02e93a22
JH
3387
3388. ./posthint.sh
3389
2304df62 3390: who configured the system
59b83a6f 3391cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3392cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3393case "$cf_by" in
3394"")
8ff267be 3395 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3396 case "$cf_by" in
3397 "") cf_by=unknown ;;
8ff267be 3398 esac ;;
3399esac
2304df62 3400
b4eb6b3d
JH
3401: set up the script used to warn in case of inconsistency
3402cat <<EOS >whoa
3403$startsh
3404EOS
3405cat <<'EOSC' >>whoa
3406dflt=y
3407echo " "
3408echo "*** WHOA THERE!!! ***" >&4
3409echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3410rp=" Keep the $hint value?"
3411. ./myread
3412case "$ans" in
3413y) td=$was; tu=$was;;
3414esac
3415EOSC
3416
3417: function used to set $1 to $val
3418setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3419case "$val$was" in
3420$define$undef) . ./whoa; eval "$var=\$td";;
3421$undef$define) . ./whoa; eval "$var=\$tu";;
3422*) eval "$var=$val";;
3423esac'
3424
3425case "$usethreads" in
3426$define|true|[yY]*) dflt='y';;
8e285145
AD
3427*) # Catch case where user specified ithreads or 5005threads but
3428 # forgot -Dusethreads (A.D. 4/2002)
3429 case "$useithreads$use5005threads" in
3430 *$define*) dflt='y' ;;
3431 *) dflt='n';;
3432 esac
3433 ;;
b4eb6b3d
JH
3434esac
3435cat <<EOM
3436
3437Perl can be built to take advantage of threads on some systems.
3438To do so, Configure can be run with -Dusethreads.
3439
3440Note that threading is a highly experimental feature, and
3441some known race conditions still remain. If you choose to try
3442it, be very sure to not actually deploy it for production
3443purposes. README.threads has more details, and is required
3444reading if you enable threads.
3445
3446If this doesn't make any sense to you, just accept the default '$dflt'.
3447EOM
3448rp='Build a threading Perl?'
3449. ./myread
3450case "$ans" in
3451y|Y) val="$define" ;;
3452*) val="$undef" ;;
3453esac
3454set usethreads
3455eval $setvar
3456
3457case "$usethreads" in
3458$define)
3459 $cat <<EOM
3460
6d5328bc
JH
3461As of release 5.6, Perl has two different threading implementations,
3462an interpreter-based version (ithreads) with one interpreter per
3463thread, and the 5.005 version (5005threads). Both implementations
3464are considered experimental, but since 5.8 ithreads somewhat less so.
3465The 5005threads is effectively unmaintained.
b4eb6b3d 3466
b4eb6b3d
JH
3467EOM
3468 : Default to ithreads unless overridden on command line or with
3469 : old config.sh
3470 dflt='y'
3471 case "$use5005threads" in
3472 $define|true|[yY]*) dflt='n';;
3473 esac
3474 case "$useithreads" in
3475 $undef|false|[nN]*) dflt='n';;
3476 esac
3477 rp='Use interpreter-based ithreads?'
3478 . ./myread
3479 case "$ans" in
3480 y|Y) val="$define" ;;
3481 *) val="$undef" ;;
3482 esac
3483 set useithreads
3484 eval $setvar
3485 : Now set use5005threads to the opposite value.
3486 case "$useithreads" in
3487 $define) val="$undef" ;;
3488 *) val="$define" ;;
3489 esac
3490 set use5005threads
3491 eval $setvar
3492 ;;
3493*)
3494 useithreads="$undef"
3495 use5005threads="$undef"
3496 ;;
3497esac
3498
c915ce7f
JH
3499case "$useithreads$use5005threads" in
3500"$define$define")
3501 $cat >&4 <<EOM
3502
3503You cannot have both the ithreads and the 5.005 threads enabled
3504at the same time. Disabling the 5.005 threads since they are
3505much less stable than the ithreads.
3506
3507EOM
3508 use5005threads="$undef"
3509 ;;
3510esac
3511
b4eb6b3d
JH
3512case "$d_oldpthreads" in
3513'') : Configure tests would be welcome here. For now, assume undef.
3514 val="$undef" ;;
3515*) val="$d_oldpthreads" ;;
3516esac
3517set d_oldpthreads
3518eval $setvar
3519
3520
3521case "$usethreads" in
3522"$define"|true|[yY]*)
3523: Look for a hint-file generated 'call-back-unit'. If the
3524: user has specified that a threading perl is to be built,
3525: we may need to set or change some other defaults.
3526 if $test -f usethreads.cbu; then
3527 echo "Your platform has some specific hints for threaded builds, using them..."
3528 . ./usethreads.cbu
3529 else
3530 $cat <<EOM
3531(Your platform doesn't have any specific hints for threaded builds.
3532 Assuming POSIX threads, then.)
3533EOM
3534 fi
3535 ;;
3536esac
3537
3538cat <<EOM
3539
3540Perl can be built so that multiple Perl interpreters can coexist
3541within the same Perl executable.
3542EOM
3543
3544case "$useithreads" in
3545$define)
3546 cat <<EOM
3547This multiple interpreter support is required for interpreter-based threads.
3548EOM
3549 val="$define"
3550 ;;
3551*) case "$usemultiplicity" in
3552 $define|true|[yY]*) dflt='y';;
3553 *) dflt='n';;
3554 esac
3555 echo " "
3556 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3557 rp='Build Perl for multiplicity?'
3558 . ./myread
3559 case "$ans" in
3560 y|Y) val="$define" ;;
3561 *) val="$undef" ;;
3562 esac
3563 ;;
3564esac
3565set usemultiplicity
3566eval $setvar
3567
96056487
JH
3568
3569case "$usemorebits" in
3570"$define"|true|[yY]*)
3571 use64bitint="$define"
3572 uselongdouble="$define"
3573 usemorebits="$define"
3574 ;;
3575*) usemorebits="$undef"
3576 ;;
3577esac
3578
e5e20432
JH
3579: make some quick guesses about what we are up against
3580echo " "
3581$echo $n "Hmm... $c"
3582echo exit 1 >bsd
3583echo exit 1 >usg
3584echo exit 1 >v7
3585echo exit 1 >osf1
3586echo exit 1 >eunice
3587echo exit 1 >xenix
3588echo exit 1 >venix
3589echo exit 1 >os2
3590d_bsd="$undef"
3591$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3592if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3593then
3594 echo "Looks kind of like an OSF/1 system, but we'll see..."
3595 echo exit 0 >osf1
381aa1ff 3596elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3597 xxx=`./loc addbib blurfl $pth`
3598 if $test -f $xxx; then
3599 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3600 echo exit 0 >bsd
3601 echo exit 0 >usg
3602 else
3603 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3604 echo "Looks kind of like an extended USG system, but we'll see..."
3605 else
3606 echo "Looks kind of like a USG system, but we'll see..."
3607 fi
3608 echo exit 0 >usg
3609 fi
3610elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3611 echo "Looks kind of like a BSD system, but we'll see..."
3612 d_bsd="$define"
3613 echo exit 0 >bsd
3614else
3615 echo "Looks kind of like a Version 7 system, but we'll see..."
3616 echo exit 0 >v7
3617fi
3618case "$eunicefix" in
3619*unixtovms*)
3620 $cat <<'EOI'
3621There is, however, a strange, musty smell in the air that reminds me of
3622something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3623EOI
3624 echo exit 0 >eunice
3625 d_eunice="$define"
3626: it so happens the Eunice I know will not run shell scripts in Unix format
3627 ;;
3628*)
3629 echo " "
3630 echo "Congratulations. You aren't running Eunice."
3631 d_eunice="$undef"
3632 ;;
3633esac
3634: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3635: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3636: semicolon as a patch separator
e5e20432
JH
3637case "$p_" in
3638:) ;;
3639*)
3640 $cat <<'EOI'
3641I have the feeling something is not exactly right, however...don't tell me...
3642lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3643(Or you may be running DOS with DJGPP.)
e5e20432
JH
3644EOI
3645 echo exit 0 >os2
3646 ;;
3647esac
3648if test -f /xenix; then
3649 echo "Actually, this looks more like a XENIX system..."
3650 echo exit 0 >xenix
3651 d_xenix="$define"
3652else
3653 echo " "
3654 echo "It's not Xenix..."
3655 d_xenix="$undef"
3656fi
3657chmod +x xenix
3658$eunicefix xenix
3659if test -f /venix; then
3660 echo "Actually, this looks more like a VENIX system..."
3661 echo exit 0 >venix
3662else
3663 echo " "
3664 if ./xenix; then
3665 : null
3666 else
3667 echo "Nor is it Venix..."
3668 fi
3669fi
3670chmod +x bsd usg v7 osf1 eunice xenix venix os2
3671$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3672$rm -f foo
3673
5869b1f1
JH
3674case "$cc" in
3675'') dflt=cc;;
3676*) dflt="$cc";;
3677esac
3678rp="Use which C compiler?"
3679. ./myread
3680cc="$ans"
6b769f8f
RB
3681
3682: See if they have not cc but they do have gcc
3683. ./trygcc
e5e20432
JH
3684: Look for a hint-file generated 'call-back-unit'. Now that the
3685: user has specified the compiler, we may need to set or change some
3686: other defaults.
3687if $test -f cc.cbu; then
3688 . ./cc.cbu
3689fi
2573c5f9 3690. ./checkcc
8a27cf78 3691
e5e20432
JH
3692echo " "
3693echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3694$cat >try.c <<EOM
e5e20432
JH
3695#include <stdio.h>
3696int main() {
3697#ifdef __GNUC__
3698#ifdef __VERSION__
3699 printf("%s\n", __VERSION__);
3700#else
3701 printf("%s\n", "1");
3702#endif
3703#endif
3704 exit(0);
3705}
3706EOM
5440bc8e
JH
3707if $cc -o try $ccflags $ldflags try.c; then
3708 gccversion=`$run ./try`
e5e20432
JH
3709 case "$gccversion" in
3710 '') echo "You are not using GNU cc." ;;
fc68435e 3711 *) echo "You are using GNU cc $gccversion."
e723fc21 3712 ccname=gcc
fc68435e 3713 ;;
e5e20432
JH
3714 esac
3715else
3716 echo " "
3717 echo "*** WHOA THERE!!! ***" >&4
3718 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3719 case "$knowitall" in
3720 '')
3721 echo " You'd better start hunting for one and let me know about it." >&4
3722 exit 1
3723 ;;
3724 esac
3725fi
5440bc8e 3726$rm -f try try.*
e5e20432
JH
3727case "$gccversion" in
37281*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3729esac
5b463ca7
KS
3730case "$gccversion" in
3731'') gccosandvers='' ;;
10b4ebb5
JH
3732*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3733 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3734 gccshortvers=''
5b463ca7 3735 case "$gccosandvers" in
02903077
JH
3736 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3737 $osname$osvers) ;; # looking good
5b463ca7
KS
3738 $osname*) cat <<EOM >&4
3739
3740*** WHOA THERE!!! ***
3741
3742 Your gcc has not been compiled for the exact release of
3743 your operating system ($gccosandvers versus $osname$osvers).
3744
3745 In general it is a good idea to keep gcc synchronized with
3746 the operating system because otherwise serious problems
3747 may ensue when trying to compile software, like Perl.
3748
3749 I'm trying to be optimistic here, though, and will continue.
3750 If later during the configuration and build icky compilation
02903077
JH
3751 problems appear (headerfile conflicts being the most common
3752 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3753 your operating system release.
3754
3755EOM
3756 ;;
81575342 3757 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3758 esac
3759 ;;
3760esac
e723fc21
JH
3761case "$ccname" in
3762'') ccname="$cc" ;;
3763esac
e5e20432 3764
640374d0 3765
bd9b35c9
JH
3766: decide how portable to be. Allow command line overrides.
3767case "$d_portable" in
3768"$undef") ;;
3769*) d_portable="$define" ;;
104d25b7 3770esac
85ab1d1d 3771
bd9b35c9
JH
3772: set up shell script to do ~ expansion
3773cat >filexp <<EOSS
3774$startsh
3775: expand filename
3776case "\$1" in
3777 ~/*|~)
3778 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3779 ;;
3780 ~*)
3781 if $test -f /bin/csh; then
3782 /bin/csh -f -c "glob \$1"
3783 failed=\$?
3784 echo ""
3785 exit \$failed
e5e20432 3786 else
bd9b35c9
JH
3787 name=\`$expr x\$1 : '..\([^/]*\)'\`
3788 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3789 if $test ! -d "\$dir"; then
3790 me=\`basename \$0\`
3791 echo "\$me: can't locate home directory for: \$name" >&2
3792 exit 1
3793 fi
3794 case "\$1" in
3795 */*)
3796 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3797 ;;
3798 *)
3799 echo \$dir
e5e20432
JH
3800 ;;
3801 esac
3802 fi
b691c02f 3803 ;;
4633a7c4 3804*)
bd9b35c9 3805 echo \$1
2304df62
AD
3806 ;;
3807esac
4633a7c4
LW
3808EOSS
3809chmod +x filexp
3810$eunicefix filexp
2304df62
AD
3811
3812: now set up to get a file name
28757baa 3813cat <<EOS >getfile
3814$startsh
3815EOS
3816cat <<'EOSC' >>getfile
2304df62
AD
3817tilde=''
3818fullpath=''
3819already=''
3820skip=''
3821none_ok=''
3822exp_file=''
a0d0e21e 3823nopath_ok=''
2304df62
AD
3824orig_rp="$rp"
3825orig_dflt="$dflt"
b233458b
JH
3826case "$gfpth" in
3827'') gfpth='.' ;;
3828esac
2304df62
AD
3829
3830case "$fn" in
ecfc5424 3831*\(*)
381aa1ff 3832 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3833 fn=`echo $fn | sed 's/(.*)//'`
3834 ;;
3835esac
3836
3837case "$fn" in
a0d0e21e
LW
3838*:*)
3839 loc_file=`expr $fn : '.*:\(.*\)'`
3840 fn=`expr $fn : '\(.*\):.*'`
3841 ;;
3842esac
3843
3844case "$fn" in
2304df62
AD
3845*~*) tilde=true;;
3846esac
3847case "$fn" in
3848*/*) fullpath=true;;
3849esac
3850case "$fn" in
3851*+*) skip=true;;
3852esac
3853case "$fn" in
3854*n*) none_ok=true;;
3855esac
3856case "$fn" in
3857*e*) exp_file=true;;
3858esac
a0d0e21e
LW
3859case "$fn" in
3860*p*) nopath_ok=true;;
3861esac
2304df62
AD
3862
3863case "$fn" in
3864*f*) type='File';;
3865*d*) type='Directory';;
a0d0e21e 3866*l*) type='Locate';;
2304df62
AD
3867esac
3868
3869what="$type"
3870case "$what" in
3871Locate) what='File';;
3872esac
3873
3874case "$exp_file" in
3875'')
3876 case "$d_portable" in
3877 "$define") ;;
3878 *) exp_file=true;;
3879 esac
3880 ;;
3881esac
3882
3883cd ..
3884while test "$type"; do
3885 redo=''
3886 rp="$orig_rp"
3887 dflt="$orig_dflt"
3888 case "$tilde" in
3889 true) rp="$rp (~name ok)";;
3890 esac
3891 . UU/myread
ecfc5424
AD
3892 if test -f UU/getfile.ok && \
3893 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3894 then
3895 value="$ans"
3896 ansexp="$ans"
3897 break
3898 fi
2304df62
AD
3899 case "$ans" in
3900 none)
3901 value=''
3902 ansexp=''
3903 case "$none_ok" in
3904 true) type='';;
3905 esac
3906 ;;
3907 *)
3908 case "$tilde" in
3909 '') value="$ans"
3910 ansexp="$ans";;
3911 *)
3912 value=`UU/filexp $ans`
3913 case $? in
3914 0)
3915 if test "$ans" != "$value"; then
ecfc5424 3916 echo "(That expands to $value on this system.)"
2304df62
AD
3917 fi
3918 ;;
3919 *) value="$ans";;
3920 esac
3921 ansexp="$value"
3922 case "$exp_file" in
3923 '') value="$ans";;
3924 esac
3925 ;;
3926 esac
3927 case "$fullpath" in
3928 true)
3929 case "$ansexp" in
3930 /*) value="$ansexp" ;;
23da6c43 3931 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3932 *)
3933 redo=true
3934 case "$already" in
3935 true)
3936 echo "I shall only accept a full path name, as in /bin/ls." >&4
3937 echo "Use a ! shell escape if you wish to check pathnames." >&4
3938 ;;
3939 *)
3940 echo "Please give a full path name, starting with slash." >&4
3941 case "$tilde" in
3942 true)
3943 echo "Note that using ~name is ok provided it expands well." >&4
3944 already=true
3945 ;;
3946 esac
3947 esac
3948 ;;
3949 esac
3950 ;;
3951 esac
3952 case "$redo" in
3953 '')
3954 case "$type" in
3955 File)
b233458b
JH
3956 for fp in $gfpth; do
3957 if test "X$fp" = X.; then
3958 pf="$ansexp"
3959 else
3960 pf="$fp/$ansexp"
3961 fi
3962 if test -f "$pf"; then
3963 type=''
3964 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3965 then
3966 echo "($value is not a plain file, but that's ok.)"
3967 type=''
3968 fi
3969 if test X"$type" = X; then
3970 value="$pf"
3971 break
3972 fi
3973 done
2304df62
AD
3974 ;;
3975 Directory)
b233458b
JH
3976 for fp in $gfpth; do
3977 if test "X$fp" = X.; then
f78bfc9c
JH
3978 dir="$ans"
3979 direxp="$ansexp"
b233458b 3980 else
dd858076 3981 dir="$fp/$ansexp"
f78bfc9c 3982 direxp="$fp/$ansexp"
b233458b 3983 fi
f78bfc9c 3984 if test -d "$direxp"; then
b233458b 3985 type=''
f78bfc9c 3986 value="$dir"
b233458b
JH
3987 break
3988 fi
3989 done
2304df62
AD
3990 ;;
3991 Locate)
40000a8c 3992 if test -d "$ansexp"; then
a0d0e21e
LW
3993 echo "(Looking for $loc_file in directory $value.)"
3994 value="$value/$loc_file"
40000a8c 3995 ansexp="$ansexp/$loc_file"
2304df62 3996 fi
40000a8c 3997 if test -f "$ansexp"; then
2304df62
AD
3998 type=''
3999 fi
a0d0e21e
LW
4000 case "$nopath_ok" in
4001 true) case "$value" in
4002 */*) ;;
4003 *) echo "Assuming $value will be in people's path."
4004 type=''
4005 ;;
4006 esac
4007 ;;
4008 esac
2304df62
AD
4009 ;;
4010 esac
4011
4012 case "$skip" in
4013 true) type='';
4014 esac
4015
4016 case "$type" in
4017 '') ;;
4018 *)
4019 if test "$fastread" = yes; then
4020 dflt=y
4021 else
4022 dflt=n
4023 fi
4024 rp="$what $value doesn't exist. Use that name anyway?"
4025 . UU/myread
4026 dflt=''
4027 case "$ans" in
4028 y*) type='';;
4029 *) echo " ";;
4030 esac
4031 ;;
4032 esac
4033 ;;
4034 esac
4035 ;;
4036 esac
4037done
4038cd UU
4039ans="$value"
4040rp="$orig_rp"
4041dflt="$orig_dflt"
ecfc5424 4042rm -f getfile.ok
b233458b 4043test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4044EOSC
4045
bd9b35c9
JH
4046: What should the include directory be ?
4047echo " "
4048$echo $n "Hmm... $c"
4049dflt='/usr/include'
4050incpath=''
4051mips_type=''
4052if $test -f /bin/mips && /bin/mips; then
4053 echo "Looks like a MIPS system..."
4054 $cat >usr.c <<'EOCP'
4055#ifdef SYSTYPE_BSD43
4056/bsd43
4057#endif
4058EOCP
8a27cf78 4059 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4060 dflt='/bsd43/usr/include'
4061 incpath='/bsd43'
4062 mips_type='BSD 4.3'
4063 else
4064 mips_type='System V'
4065 fi
4066 $rm -f usr.c usr.out
4067 echo "and you're compiling with the $mips_type compiler and libraries."
4068 xxx_prompt=y
4069 echo "exit 0" >mips
4070else
4071 echo "Doesn't look like a MIPS system."
4072 xxx_prompt=n
4073 echo "exit 1" >mips
4074fi
4075chmod +x mips
4076$eunicefix mips
4077case "$usrinc" in
4078'') ;;
4079*) dflt="$usrinc";;
4080esac
4081case "$xxx_prompt" in
4082y) fn=d/
4083 echo " "
4084 rp='Where are the include files you want to use?'
4085 . ./getfile
4086 usrinc="$ans"
8e07c86e 4087 ;;
bd9b35c9 4088*) usrinc="$dflt"
8e07c86e
AD
4089 ;;
4090esac
2304df62 4091
96056487
JH
4092: see how we invoke the C preprocessor
4093echo " "
4094echo "Now, how can we feed standard input to your C preprocessor..." >&4
4095cat <<'EOT' >testcpp.c
4096#define ABC abc
4097#define XYZ xyz
4098ABC.XYZ
4099EOT
4100cd ..
4101if test ! -f cppstdin; then
4102 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4103 # AIX cc -E doesn't show the absolute headerfile
4104 # locations but we'll cheat by using the -M flag.
4105 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
4106 else
4107 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4108 fi
4109else
4110 echo "Keeping your $hint cppstdin wrapper."
4111fi
4112chmod 755 cppstdin
4113wrapper=`pwd`/cppstdin
4114ok='false'
4115cd UU
4116
4117if $test "X$cppstdin" != "X" && \
4118 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4119 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4120then
4121 echo "You used to use $cppstdin $cppminus so we'll use that again."
4122 case "$cpprun" in
4123 '') echo "But let's see if we can live without a wrapper..." ;;
4124 *)
4125 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4126 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4127 then
4128 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4129 ok='true'
4130 else
4131 echo "(However, $cpprun $cpplast does not work, let's see...)"
4132 fi
4133 ;;
4134 esac
4135else
4136 case "$cppstdin" in
4137 '') ;;
4138 *)
4139 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4140 ;;
4141 esac
4142fi
4143
4144if $ok; then
4145 : nothing
4146elif echo 'Maybe "'"$cc"' -E" will work...'; \
4147 $cc -E <testcpp.c >testcpp.out 2>&1; \
4148 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4149 echo "Yup, it does."
4150 x_cpp="$cc -E"
4151 x_minus='';
4152elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4153 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4154 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4155 echo "Yup, it does."
4156 x_cpp="$cc -E"
4157 x_minus='-';
4158elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4159 $cc -P <testcpp.c >testcpp.out 2>&1; \
4160 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4161 echo "Yipee, that works!"
4162 x_cpp="$cc -P"
4163 x_minus='';
4164elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4165 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4166 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4167 echo "At long last!"
4168 x_cpp="$cc -P"
4169 x_minus='-';
4170elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4171 $cpp <testcpp.c >testcpp.out 2>&1; \
4172 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4173 echo "It works!"
4174 x_cpp="$cpp"
4175 x_minus='';
4176elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4177 $cpp - <testcpp.c >testcpp.out 2>&1; \
4178 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4179 echo "Hooray, it works! I was beginning to wonder."
4180 x_cpp="$cpp"
4181 x_minus='-';
4182elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4183 $wrapper <testcpp.c >testcpp.out 2>&1; \
4184 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4185 x_cpp="$wrapper"
4186 x_minus=''
4187 echo "Eureka!"
4188else
4189 dflt=''
4190 rp="No dice. I can't find a C preprocessor. Name one:"
4191 . ./myread
4192 x_cpp="$ans"
4193 x_minus=''
4194 $x_cpp <testcpp.c >testcpp.out 2>&1
4195 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4196 echo "OK, that will do." >&4
4197 else
4198echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4199 exit 1
4200 fi
4201fi
4202
4203case "$ok" in
4204false)
4205 cppstdin="$x_cpp"
4206 cppminus="$x_minus"
4207 cpprun="$x_cpp"
4208 cpplast="$x_minus"
4209 set X $x_cpp
4210 shift
4211 case "$1" in
4212 "$cpp")
4213 echo "Perhaps can we force $cc -E using a wrapper..."
4214 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4215 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4216 then
4217 echo "Yup, we can."
4218 cppstdin="$wrapper"
4219 cppminus='';
4220 else
4221 echo "Nope, we'll have to live without it..."
4222 fi
4223 ;;
4224 esac
4225 case "$cpprun" in
4226 "$wrapper")
4227 cpprun=''
4228 cpplast=''
4229 ;;
4230 esac
4231 ;;
4232esac
4233
4234case "$cppstdin" in
4235"$wrapper"|'cppstdin') ;;
4236*) $rm -f $wrapper;;
4237esac
4238$rm -f testcpp.c testcpp.out
4239
bd9b35c9
JH
4240: Set private lib path
4241case "$plibpth" in
4242'') if ./mips; then
4243 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4244 fi;;
4245esac
4246case "$libpth" in
4247' ') dlist='';;
4248'') dlist="$loclibpth $plibpth $glibpth";;
4249*) dlist="$libpth";;
4250esac
4251
4252: Now check and see which directories actually exist, avoiding duplicates
4253libpth=''
4254for xxx in $dlist
4255do
4256 if $test -d $xxx; then
4257 case " $libpth " in
4258 *" $xxx "*) ;;
4259 *) libpth="$libpth $xxx";;
4260 esac
4261 fi
4262done
4263$cat <<'EOM'
4264
4265Some systems have incompatible or broken versions of libraries. Among
4266the directories listed in the question below, please remove any you
4267know not to be holding relevant libraries, and add any that are needed.
4268Say "none" for none.
8e07c86e
AD
4269
4270EOM
bd9b35c9
JH
4271case "$libpth" in
4272'') dflt='none';;
8e07c86e 4273*)
bd9b35c9
JH
4274 set X $libpth
4275 shift
4276 dflt=${1+"$@"}
8e07c86e 4277 ;;
a0d0e21e 4278esac
bd9b35c9
JH
4279rp="Directories to use for library searches?"
4280. ./myread
4281case "$ans" in
4282none) libpth=' ';;
4283*) libpth="$ans";;
4284esac
a0d0e21e 4285
bd9b35c9
JH
4286: compute shared library extension
4287case "$so" in
4288'')
4289 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4290 dflt='sl'
dd4e71fd 4291 else
bd9b35c9 4292 dflt='so'
dd4e71fd
JH
4293 fi
4294 ;;
bd9b35c9 4295*) dflt="$so";;
dd4e71fd 4296esac
dd4e71fd
JH
4297$cat <<EOM
4298
bd9b35c9 4299On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4300you want to suppress searching of shared libraries for the remainder
bd9b35c9 4301of this configuration.
dd4e71fd
JH
4302
4303EOM
bd9b35c9
JH
4304rp='What is the file extension used for shared libraries?'
4305. ./myread
4306so="$ans"
dd4e71fd 4307
bd9b35c9
JH
4308: Define several unixisms.
4309: Hints files or command line option can be used to override them.
4310: The convoluted testing is in case hints files set either the old
4311: or the new name.
4312case "$_exe" in
4313'') case "$exe_ext" in
1fef16b3 4314 '') ;;
bd9b35c9 4315 *) _exe="$exe_ext" ;;
dd4e71fd 4316 esac
bd9b35c9 4317 ;;
bfb7748a 4318esac
bd9b35c9
JH
4319case "$_a" in
4320'') case "$lib_ext" in
4321 '') _a='.a';;
4322 *) _a="$lib_ext" ;;
dd4e71fd
JH
4323 esac
4324 ;;
dd4e71fd 4325esac
bd9b35c9
JH
4326case "$_o" in
4327'') case "$obj_ext" in
4328 '') _o='.o';;
4329 *) _o="$obj_ext";;
4330 esac
4331 ;;
4332esac
4333case "$p_" in
4334'') case "$path_sep" in
4335 '') p_=':';;
4336 *) p_="$path_sep";;
4337 esac
4338 ;;
4339esac
4340exe_ext=$_exe
4341lib_ext=$_a
4342obj_ext=$_o
4343path_sep=$p_
dd4e71fd 4344
b4eb6b3d
JH
4345: Which makefile gets called first. This is used by make depend.
4346case "$firstmakefile" in
4347'') firstmakefile='makefile';;
4633a7c4 4348esac
4633a7c4 4349
0f0995ae
JH
4350case "$usesocks" in
4351$define|true|[yY]*) dflt='y';;
4352*) dflt='n';;
4353esac
bd9b35c9 4354cat <<EOM
4633a7c4 4355
bd9b35c9 4356Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
4357Configure must be run with -Dusesocks. If you use SOCKS you also need
4358to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 4359
0f0995ae 4360If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4361EOM
bd9b35c9
JH
4362rp='Build Perl for SOCKS?'
4363. ./myread
4364case "$ans" in
4365y|Y) val="$define" ;;
4366*) val="$undef" ;;
4367esac
4368set usesocks
4369eval $setvar
4370
cf829ab0
JH
4371case "$usesocks" in
4372$define|true|[yY]*) useperlio="$define";;
4373esac
4374
bd9b35c9
JH
4375: Looking for optional libraries
4376echo " "
4377echo "Checking for optional libraries..." >&4
4378case "$libs" in
4379' '|'') dflt='';;
4380*) dflt="$libs";;
4381esac
4382case "$libswanted" in
4383'') libswanted='c_s';;
4384esac
4385case "$usesocks" in
923fc586 4386"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4387esac
68435ea7
JH
4388libsfound=''
4389libsfiles=''
4390libsdirs=''
13b3f787
JH
4391libspath=''
4392for thisdir in $libpth $xlibpth; do
4393 test -d $thisdir && libspath="$libspath $thisdir"
4394done
bd9b35c9 4395for thislib in $libswanted; do
13b3f787 4396 for thisdir in $libspath; do
f7dd4e7f
JH
4397 xxx=''
4398 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4399 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4400 $test -f "$xxx" && eval $libscheck
4401 $test -f "$xxx" && libstyle=shared
4402 fi
4403 if test ! -f "$xxx"; then
4404 xxx=$thisdir/lib$thislib.$so
4405 $test -f "$xxx" && eval $libscheck
4406 $test -f "$xxx" && libstyle=shared
4407 fi
4408 if test ! -f "$xxx"; then
4409 xxx=$thisdir/lib$thislib$_a
4410 $test -f "$xxx" && eval $libscheck
4411 $test -f "$xxx" && libstyle=static
4412 fi
4413 if test ! -f "$xxx"; then
4414 xxx=$thisdir/$thislib$_a
4415 $test -f "$xxx" && eval $libscheck
4416 $test -f "$xxx" && libstyle=static
4417 fi
4418 if test ! -f "$xxx"; then
4419 xxx=$thisdir/lib${thislib}_s$_a
4420 $test -f "$xxx" && eval $libscheck
4421 $test -f "$xxx" && libstyle=static
09ea5ba9 4422 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4423 fi
4424 if test ! -f "$xxx"; then
4425 xxx=$thisdir/Slib$thislib$_a
4426 $test -f "$xxx" && eval $libscheck
4427 $test -f "$xxx" && libstyle=static
4428 fi
4429 if $test -f "$xxx"; then
43999f95 4430 case "$libstyle" in
f7dd4e7f
JH
4431 shared) echo "Found -l$thislib (shared)." ;;
4432 static) echo "Found -l$thislib." ;;
4433 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4434 esac
bd9b35c9
JH
4435 case " $dflt " in
4436 *"-l$thislib "*);;
f7dd4e7f 4437 *) dflt="$dflt -l$thislib"
43999f95
JH
4438 libsfound="$libsfound $xxx"
4439 yyy=`basename $xxx`
4440 libsfiles="$libsfiles $yyy"
1e127011 4441 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4442 case " $libsdirs " in
4443 *" $yyy "*) ;;
4444 *) libsdirs="$libsdirs $yyy" ;;
4445 esac
4446 ;;
bd9b35c9 4447 esac
f7dd4e7f
JH
4448 break
4449 fi
4450 done
4451 if $test ! -f "$xxx"; then
4452 echo "No -l$thislib."
bd9b35c9
JH
4453 fi
4454done
4455set X $dflt
4456shift
4457dflt="$*"
4458case "$libs" in
4459'') dflt="$dflt";;
4460*) dflt="$libs";;
4461esac
4462case "$dflt" in
4463' '|'') dflt='none';;
4464esac
4633a7c4 4465
bd9b35c9 4466$cat <<EOM
4633a7c4 4467
bd9b35c9
JH
4468In order to compile $package on your machine, a number of libraries
4469are usually needed. Include any other special libraries here as well.
4470Say "none" for none. The default list is almost always right.
8e07c86e 4471EOM
8e07c86e 4472
bd9b35c9
JH
4473echo " "
4474rp="What libraries to use?"
4475. ./myread
4476case "$ans" in
4477none) libs=' ';;
4478*) libs="$ans";;
4479esac
d71b2b6b 4480
bd9b35c9
JH
4481: determine optimization, if desired, or use for debug flag also
4482case "$optimize" in
4483' '|$undef) dflt='none';;
4484'') dflt='-O';;
4485*) dflt="$optimize";;
4486esac
4487$cat <<EOH
d71b2b6b 4488
bd9b35c9
JH
4489By default, $package compiles with the -O flag to use the optimizer.
4490Alternately, you might want to use the symbolic debugger, which uses
4491the -g flag (on traditional Unix systems). Either flag can be
4492specified here. To use neither flag, specify the word "none".
d71b2b6b 4493
bd9b35c9
JH
4494EOH
4495rp="What optimizer/debugger flag should be used?"
4496. ./myread
4497optimize="$ans"
4498case "$optimize" in
4499'none') optimize=" ";;
4500esac
4501
4502dflt=''
4503: We will not override a previous value, but we might want to
4504: augment a hint file
4505case "$hint" in
4506default|recommended)
4507 case "$gccversion" in
4508 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4509 esac
bd9b35c9
JH
4510 case "$optimize" in
4511 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4512 esac
bd9b35c9
JH
4513 case "$gccversion" in
4514 2*) if test -d /etc/conf/kconfig.d &&
4515 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4516 then
4517 dflt="$dflt -posix"
4518 fi
f0d04425 4519 ;;
bd9b35c9
JH
4520 esac
4521 case "$gccversion" in
4522 1*) ;;
4523 2.[0-8]*) ;;
4524 ?*) echo " "
4525 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4526 echo 'int main(void) { return 0; }' > gcctest.c
4527 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4528 echo "Yes, it does." 2>&1
4529 case "$ccflags" in
4530 *strict-aliasing*)
4531 echo "Leaving current flags $ccflags alone." 2>&1
4532 ;;
4533 *) dflt="$dflt -fno-strict-aliasing" ;;
4534 esac
4535 else
4536 echo "Nope, it doesn't, but that's ok." 2>&1
4537 fi
f0d04425 4538 ;;
e5e20432
JH
4539 esac
4540 ;;
4541esac
4542
bd9b35c9
JH
4543case "$mips_type" in
4544*BSD*|'') inclwanted="$locincpth $usrinc";;
4545*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4546esac
4547for thisincl in $inclwanted; do
4548 if $test -d $thisincl; then
4549 if $test x$thisincl != x$usrinc; then
4550 case "$dflt" in
422af00a
LC
4551 *" -I$thisincl "*);;
4552 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4553 esac
4554 fi
4555 fi
4556done
40a7a20a 4557
bd9b35c9
JH
4558inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4559 xxx=true;
4560elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4561 xxx=true;
4562else
4563 xxx=false;
4564fi;
4565if $xxx; then
4566 case "$dflt" in
4567 *$2*);;
4568 *) dflt="$dflt -D$2";;
4569 esac;
4570fi'
40a7a20a 4571
bd9b35c9 4572set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4573
bd9b35c9
JH
4574case "$usesocks" in
4575$define)
4576 ccflags="$ccflags -DSOCKS"
4577 ;;
4578esac
40a7a20a 4579
bd9b35c9
JH
4580case "$hint" in
4581default|recommended) dflt="$ccflags $dflt" ;;
4582*) dflt="$ccflags";;
4583esac
40a7a20a 4584
bd9b35c9
JH
4585case "$dflt" in
4586''|' ') dflt=none;;
4587esac
422af00a 4588
bd9b35c9 4589$cat <<EOH
40a7a20a 4590
bd9b35c9
JH
4591Your C compiler may want other flags. For this question you should include
4592-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4593but you should NOT include libraries or ld flags like -lwhatever. If you
4594want $package to honor its debug switch, you should include -DDEBUGGING here.
4595Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4596
bd9b35c9 4597To use no flags, specify the word "none".
40a7a20a 4598
bd9b35c9
JH
4599EOH
4600set X $dflt
4601shift
4602dflt=${1+"$@"}
4603rp="Any additional cc flags?"
4604. ./myread
4605case "$ans" in
4606none) ccflags='';;
4607*) ccflags="$ans";;
4608esac
8e07c86e 4609
bd9b35c9 4610: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4611case "$cppflags" in
4612'') cppflags="$ccflags" ;;
4613*) cppflags="$cppflags $ccflags" ;;
4614esac
bd9b35c9
JH
4615case "$gccversion" in
46161*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4617esac
bd9b35c9
JH
4618case "$mips_type" in
4619'');;
4620*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4621esac
4622case "$cppflags" in
4623'');;
4624*)
4625 echo " "
4626 echo "Let me guess what the preprocessor flags are..." >&4
4627 set X $cppflags
4628 shift
4629 cppflags=''
4630 $cat >cpp.c <<'EOM'
4631#define BLURFL foo
8e07c86e 4632
bd9b35c9
JH
4633BLURFL xx LFRULB
4634EOM
4635 previous=''
4636 for flag in $*
4637 do
4638 case "$flag" in
4639 -*) ftry="$flag";;
4640 *) ftry="$previous $flag";;
4641 esac
4642 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4643 >cpp1.out 2>/dev/null && \
4644 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4645 >cpp2.out 2>/dev/null && \
4646 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4647 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4648 then
4649 cppflags="$cppflags $ftry"
4650 previous=''
4651 else
4652 previous="$flag"
4653 fi
4654 done
4655 set X $cppflags
4656 shift
4657 cppflags=${1+"$@"}
4658 case "$cppflags" in
4659 *-*) echo "They appear to be: $cppflags";;
4660 esac
4661 $rm -f cpp.c cpp?.out
2afac517 4662 ;;
4663esac
8e07c86e 4664
bd9b35c9
JH
4665: flags used in final linking phase
4666case "$ldflags" in
4667'') if ./venix; then
4668 dflt='-i -z'
10a23457 4669 else
bd9b35c9 4670 dflt=''
10a23457 4671 fi
bd9b35c9
JH
4672 case "$ccflags" in
4673 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4674 esac
bd9b35c9
JH
4675 ;;
4676*) dflt="$ldflags";;
4677esac
4678
4679: Try to guess additional flags to pick up local libraries.
4680for thislibdir in $libpth; do
4681 case " $loclibpth " in
4682 *" $thislibdir "*)
4683 case "$dflt " in
4684 *"-L$thislibdir "*) ;;
4685 *) dflt="$dflt -L$thislibdir" ;;
4686 esac
c4f23d77
AD
4687 ;;
4688 esac
bd9b35c9 4689done
c4f23d77 4690
bd9b35c9
JH
4691case "$dflt" in
4692'') dflt='none' ;;
4693esac
c4f23d77 4694
bd9b35c9
JH
4695$cat <<EOH
4696
4697Your C linker may need flags. For this question you should
4698include -L/whatever and any other flags used by the C linker, but you
4699should NOT include libraries like -lwhatever.
4700
4701Make sure you include the appropriate -L/path flags if your C linker
4702does not normally search all of the directories you specified above,
4703namely
4704 $libpth
4705To use no flags, specify the word "none".
4706
4707EOH
4708
4709rp="Any additional ld flags (NOT including libraries)?"
4710. ./myread
4711case "$ans" in
4712none) ldflags='';;
4713*) ldflags="$ans";;
4714esac
4715rmlist="$rmlist pdp11"
4716
4717: coherency check
4718echo " "
4719echo "Checking your choice of C compiler and flags for coherency..." >&4
4720$cat > try.c <<'EOF'
4721#include <stdio.h>
4722int main() { printf("Ok\n"); exit(0); }
4723EOF
7a282f6d 4724set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4725shift
4726$cat >try.msg <<'EOM'
4727I've tried to compile and run the following simple program:
4728
4729EOM
4730$cat try.c >> try.msg
4731
4732$cat >> try.msg <<EOM
4733
4734I used the command:
4735
4736 $*
5440bc8e 4737 $run ./try
bd9b35c9
JH
4738
4739and I got the following output:
4740
4741EOM
4742dflt=y
73614538 4743if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4744 if $sh -c "$run ./try" >>try.msg 2>&1; then
4745 xxx=`$run ./try`
bd9b35c9
JH
4746 case "$xxx" in
4747 "Ok") dflt=n ;;
4748 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4749 case " $libs " in
4750 *" -lsfio "*)
4751 cat >> try.msg <<'EOQS'
4752If $libs contains -lsfio, and sfio is mis-configured, then it
4753sometimes (apparently) runs and exits with a 0 status, but with no
4754output! It may have to do with sfio's use of _exit vs. exit.
4755
4756EOQS
4757 rp="You have a big problem. Shall I abort Configure"
4758 dflt=y
4759 ;;
4760 esac
4761 ;;
4762 esac
4763 else
4764 echo "The program compiled OK, but exited with status $?." >>try.msg
4765 rp="You have a problem. Shall I abort Configure"
4766 dflt=y
4767 fi
4768else
4769 echo "I can't compile the test program." >>try.msg
4770 rp="You have a BIG problem. Shall I abort Configure"
4771 dflt=y
4772fi
4773case "$dflt" in
4774y)
4775 $cat try.msg >&4
4776 case "$knowitall" in
4777 '')
4778 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4779 ;;
bd9b35c9 4780 *) dflt=n;;
c4f23d77 4781 esac
bd9b35c9
JH
4782 echo " "
4783 . ./myread
4784 case "$ans" in
4785 n*|N*) ;;
4786 *) echo "Ok. Stopping Configure." >&4
4787 exit 1
c4f23d77
AD
4788 ;;
4789 esac
4790 ;;
bd9b35c9 4791n) echo "OK, that should do.";;
c4f23d77 4792esac
bd9b35c9 4793$rm -f try try.* core
c4f23d77 4794
bd9b35c9
JH
4795: define a shorthand compile call
4796compile='
4797mc_file=$1;
4798shift;
08413ebc 4799$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4800: define a shorthand compile call for compilations that should be ok.
4801compile_ok='
4802mc_file=$1;
4803shift;
7a282f6d 4804$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4805
b4eb6b3d 4806: check for lengths of integral types
bd9b35c9 4807echo " "
b4eb6b3d
JH
4808case "$intsize" in
4809'')
4810 echo "Checking to see how big your integers are..." >&4
5440bc8e 4811 $cat >try.c <<'EOCP'
bd9b35c9
JH
4812#include <stdio.h>
4813int main()
4814{
b4eb6b3d
JH
4815 printf("intsize=%d;\n", (int)sizeof(int));
4816 printf("longsize=%d;\n", (int)sizeof(long));
4817 printf("shortsize=%d;\n", (int)sizeof(short));
4818 exit(0);
bd9b35c9 4819}
b4eb6b3d 4820EOCP
5440bc8e
JH
4821 set try
4822 if eval $compile_ok && $run ./try > /dev/null; then
4823 eval `$run ./try`
b4eb6b3d
JH
4824 echo "Your integers are $intsize bytes long."
4825 echo "Your long integers are $longsize bytes long."
4826 echo "Your short integers are $shortsize bytes long."
4827 else
4828 $cat >&4 <<EOM
4829!
4830Help! I can't compile and run the intsize test program: please enlighten me!
4831(This is probably a misconfiguration in your system or libraries, and
4832you really ought to fix it. Still, I'll try anyway.)
4833!
bd9b35c9 4834EOM
b4eb6b3d
JH
4835 dflt=4
4836 rp="What is the size of an integer (in bytes)?"
96056487
JH
4837 . ./myread
4838 intsize="$ans"
4839 dflt=$intsize
4840 rp="What is the size of a long integer (in bytes)?"
4841 . ./myread
4842 longsize="$ans"
4843 dflt=2
4844 rp="What is the size of a short integer (in bytes)?"
4845 . ./myread
4846 shortsize="$ans"
b4eb6b3d
JH
4847 fi
4848 ;;
4849esac
96056487 4850$rm -f try try.*
b4eb6b3d 4851
8dfa8df9
JH
4852: check for void type
4853echo " "
4854echo "Checking to see how well your C compiler groks the void type..." >&4
4855case "$voidflags" in
4856'')
4857 $cat >try.c <<'EOCP'
4858#if TRY & 1
4859void sub() {
4860#else
4861sub() {
4862#endif
4863 extern void moo(); /* function returning void */
4864 void (*goo)(); /* ptr to func returning void */
4865#if TRY & 8
4866 void *hue; /* generic ptr */
4867#endif
4868#if TRY & 2
4869 void (*foo[10])();
4870#endif
4871
4872#if TRY & 4
4873 if(goo == moo) {
4874 exit(0);
4875 }
4876#endif
4877 exit(0);
4878}
4879int main() { sub(); }
4880EOCP
4881 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4882 voidflags=$defvoidused
4883 echo "Good. It appears to support void to the level $package wants.">&4
4884 if $contains warning .out >/dev/null 2>&1; then
4885 echo "However, you might get some warnings that look like this:"
4886 $cat .out
4887 fi
4888 else
4889echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4890 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4891 echo "It supports 1..."
4892 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4893 echo "It also supports 2..."
4894 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4895 voidflags=7
4896 echo "And it supports 4 but not 8 definitely."
4897 else
4898 echo "It doesn't support 4..."
4899 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4900 voidflags=11
4901 echo "But it supports 8."
4902 else
4903 voidflags=3
4904 echo "Neither does it support 8."
4905 fi
4906 fi
4907 else
4908 echo "It does not support 2..."
4909 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4910 voidflags=13
4911 echo "But it supports 4 and 8."
4912 else
4913 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4914 voidflags=5
4915 echo "And it supports 4 but has not heard about 8."
4916 else
4917 echo "However it supports 8 but not 4."
4918 fi
4919 fi
4920 fi
4921 else
4922 echo "There is no support at all for void."
4923 voidflags=0
4924 fi
4925 fi
4926esac
4927case "$voidflags" in
4928"$defvoidused") ;;
4929*) $cat >&4 <<'EOM'
4930 Support flag bits are:
4931 1: basic void declarations.
4932 2: arrays of pointers to functions returning void.
4933 4: operations between pointers to and addresses of void functions.
4934 8: generic void pointers.
4935EOM
4936 dflt="$voidflags";
4937 rp="Your void support flags add up to what?"
4938 . ./myread
4939 voidflags="$ans"
4940 ;;
4941esac
4942$rm -f try.* .out
4943
4944: check for length of pointer
4945echo " "
4946case "$ptrsize" in
4947'')
4948 echo "Checking to see how big your pointers are..." >&4
4949 if test "$voidflags" -gt 7; then
4950 echo '#define VOID_PTR char *' > try.c
4951 else
4952 echo '#define VOID_PTR void *' > try.c
4953 fi
4954 $cat >>try.c <<'EOCP'
4955#include <stdio.h>
4956int main()
4957{
4958 printf("%d\n", (int)sizeof(VOID_PTR));
4959 exit(0);
4960}
4961EOCP
4962 set try
4963 if eval $compile_ok; then
5440bc8e 4964 ptrsize=`$run ./try`
8dfa8df9
JH
4965 echo "Your pointers are $ptrsize bytes long."
4966 else
4967 dflt='4'
4968 echo "(I can't seem to compile the test program. Guessing...)" >&4
4969 rp="What is the size of a pointer (in bytes)?"
4970 . ./myread
4971 ptrsize="$ans"
4972 fi
4973 ;;
4974esac
4975$rm -f try.c try
4976
4977: check for long long
4978echo " "
4979echo "Checking to see if you have long long..." >&4
4980echo 'int main() { long long x = 7; return 0; }' > try.c
4981set try
4982if eval $compile; then
4983 val="$define"
4984 echo "You have long long."
4985else
4986 val="$undef"
4987 echo "You do not have long long."
4988fi
4989$rm try.*
4990set d_longlong
4991eval $setvar
4992
4993: check for length of long long
4994case "${d_longlong}${longlongsize}" in
4995$define)
4996 echo " "
4997 echo "Checking to see how big your long longs are..." >&4
4998 $cat >try.c <<'EOCP'
4999#include <stdio.h>
5000int main()
5001{
5002 printf("%d\n", (int)sizeof(long long));
5003 return(0);
5004}
5005EOCP
5006 set try
5007 if eval $compile_ok; then
5440bc8e 5008 longlongsize=`$run ./try`
8dfa8df9
JH
5009 echo "Your long longs are $longlongsize bytes long."
5010 else
5011 dflt='8'
5012 echo " "
5013 echo "(I can't seem to compile the test program. Guessing...)"
5014 rp="What is the size of a long long (in bytes)?"
5015 . ./myread
5016 longlongsize="$ans"
5017 fi
5018 if $test "X$longsize" = "X$longlongsize"; then
5019 echo "(That isn't any different from an ordinary long.)"
5020 fi
5021 ;;
5022esac
5023$rm -f try.* try
5024
5025: determine filename position in cpp output
5026echo " "
5027echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5028case "$osname" in
5029vos) testaccess=-e ;;
5030*) testaccess=-r ;;
5031esac
8dfa8df9
JH
5032echo '#include <stdio.h>' > foo.c
5033$cat >fieldn <<EOF
5034$startsh
5035$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5036$grep '^[ ]*#.*stdio\.h' | \
5037while read cline; do
5038 pos=1
5039 set \$cline
5040 while $test \$# -gt 0; do
a5a94ea5 5041 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5042 echo "\$pos"
5043 exit 0
5044 fi
5045 shift
5046 pos=\`expr \$pos + 1\`
5047 done
5048done
5049EOF
5050chmod +x fieldn
5051fieldn=`./fieldn`
5052$rm -f foo.c fieldn
5053case $fieldn in
5054'') pos='???';;
50551) pos=first;;
50562) pos=second;;
50573) pos=third;;
5058*) pos="${fieldn}th";;
5059esac
5060echo "Your cpp writes the filename in the $pos field of the line."
5061
3c728e00
JH
5062case "$osname" in
5063vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5064*) cppfilter='' ;;
5065esac
8dfa8df9
JH
5066: locate header file
5067$cat >findhdr <<EOF
5068$startsh
5069wanted=\$1
5070name=''
5071for usrincdir in $usrinc
5072do
5073 if test -f \$usrincdir/\$wanted; then
5074 echo "\$usrincdir/\$wanted"
5075 exit 0
5076 fi
5077done
5078awkprg='{ print \$$fieldn }'
5079echo "#include <\$wanted>" > foo\$\$.c
5080$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5081$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5082while read cline; do
5083 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5084 case "\$name" in
5085 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5086 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5087 *) exit 2;;
5088 esac;
5089done;
5090#
5091# status = 0: grep returned 0 lines, case statement not executed
5092# status = 1: headerfile found
5093# status = 2: while loop executed, no headerfile found
5094#
5095status=\$?
5096$rm -f foo\$\$.c;
5097if test \$status -eq 1; then
5098 exit 0;
5099fi
5100exit 1
5101EOF
5102chmod +x findhdr
5103
5104: define an alternate in-header-list? function
5105inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5106cont=true; xxf="echo \"<\$1> found.\" >&4";
5107case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5108*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5109esac;
5110case $# in 4) instead=instead;; *) instead="at last";; esac;
5111while $test "$cont"; do
5112 xxx=`./findhdr $1`
5113 var=$2; eval "was=\$$2";
5114 if $test "$xxx" && $test -r "$xxx";
5115 then eval $xxf;
5116 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5117 cont="";
5118 else eval $xxnf;
5119 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5120 set $yyy; shift; shift; yyy=$@;
5121 case $# in 0) cont="";;
5122 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5123 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5124 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5125 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5126 esac;
5127done;
5128while $test "$yyy";
5129do set $yyy; var=$2; eval "was=\$$2";
5130 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5131 set $yyy; shift; shift; yyy=$@;
5132done'
5133
5134: see if inttypes.h is available
5135: we want a real compile instead of Inhdr because some systems
5136: have an inttypes.h which includes non-existent headers
5137echo " "
5138$cat >try.c <<EOCP
5139#include <inttypes.h>
5140int main() {
5141 static int32_t foo32 = 0x12345678;
5142}
5143EOCP
5144set try
5145if eval $compile; then
5146 echo "<inttypes.h> found." >&4
5147 val="$define"
5148else
5149 echo "<inttypes.h> NOT found." >&4
5150 val="$undef"
5151fi
5152$rm -f try.c try
5153set i_inttypes
5154eval $setvar
5155
5156: check for int64_t
5157echo " "
5158echo "Checking to see if you have int64_t..." >&4
5159$cat >try.c <<EOCP
5160#include <sys/types.h>
5161#$i_inttypes I_INTTYPES
5162#ifdef I_INTTYPES
5163#include <inttypes.h>
5164#endif
5165int main() { int64_t x = 7; }
5166EOCP
5167set try
5168if eval $compile; then
5169 val="$define"
5170 echo "You have int64_t."
5171else
5172 val="$undef"
5173 echo "You do not have int64_t."
5174fi
5175$rm -f try try.*
5176set d_int64_t
5177eval $setvar
5178
5179
5180echo " "
5181echo "Checking which 64-bit integer type we could use..." >&4
5182
5183case "$intsize" in
51848) val=int
5185 set quadtype
5186 eval $setvar
5187 val='"unsigned int"'
5188 set uquadtype
5189 eval $setvar
5190 quadkind=1
5191 ;;
5192*) case "$longsize" in
5193 8) val=long
5194 set quadtype
5195 eval $setvar
5196 val='"unsigned long"'
5197 set uquadtype
5198 eval $setvar
5199 quadkind=2
5200 ;;
5201 *) case "$d_longlong:$longlongsize" in
5202 define:8)
5203 val='"long long"'
5204 set quadtype
5205 eval $setvar
5206 val='"unsigned long long"'
5207 set uquadtype
5208 eval $setvar
5209 quadkind=3
5210 ;;
5211 *) case "$d_int64_t" in
5212 define)
5213 val=int64_t
5214 set quadtype
5215 eval $setvar
5216 val=uint64_t
5217 set uquadtype
5218 eval $setvar
5219 quadkind=4
5220 ;;
5221 esac
5222 ;;
5223 esac
5224 ;;
5225 esac
5226 ;;
5227esac
5228
5229case "$quadtype" in
5230'') echo "Alas, no 64-bit integer types in sight." >&4
5231 d_quad="$undef"
5232 ;;
5233*) echo "We could use '$quadtype' for 64-bit integers." >&4
5234 d_quad="$define"
5235 ;;
5236esac
5237
b4eb6b3d
JH
5238
5239case "$uselonglong" in
5240"$define"|true|[yY]*)
5241 cat <<EOM >&4
5242
5243*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5244EOM
5245 use64bitint="$define"
5246 ;;
5247esac
5248case "$use64bits" in
5249"$define"|true|[yY]*)
5250 cat <<EOM >&4
5251
5252*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5253EOM
5254 use64bitint="$define"
5255 ;;
5256esac
5257case "$use64bitints" in
5258"$define"|true|[yY]*)
5259 cat <<EOM >&4
5260
5261*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5262EOM
5263 use64bitint="$define"
5264 ;;
5265esac
5266case "$use64bitsint" in
5267"$define"|true|[yY]*)
5268 cat <<EOM >&4
5269
5270*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5271EOM
5272 use64bitint="$define"
5273 ;;
5274esac
5275case "$uselonglongs" in
5276"$define"|true|[yY]*)
5277 cat <<EOM >&4
5278
5279*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5280EOM
5281 use64bitint="$define"
5282 ;;
5283esac
5284case "$use64bitsall" in
5285"$define"|true|[yY]*)
5286 cat <<EOM >&4
5287
5288*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5289EOM
5290 use64bitall="$define"
5291 ;;
5292esac
5293
5294case "$ccflags" in
5295*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5296esac
5297case "$use64bitall" in
5298"$define"|true|[yY]*) use64bitint="$define" ;;
5299esac
5300
5301case "$longsize" in
53028) cat <<EOM
5303
5304You have natively 64-bit long integers.
5305EOM
5306 val="$define"
5307 ;;
5308*) case "$use64bitint" in
5309 "$define"|true|[yY]*) dflt='y';;
5310 *) dflt='n';;
5311 esac
8dfa8df9
JH
5312 case "$d_quad" in
5313 "$define") ;;
5314 *) dflt='n' ;;
5315 esac
b4eb6b3d
JH
5316 cat <<EOM
5317
5318Perl can be built to take advantage of 64-bit integer types
5319on some systems. To do so, Configure can be run with -Duse64bitint.
5320Choosing this option will most probably introduce binary incompatibilities.
5321
5322If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5323(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5324EOM
5325 rp='Try to use 64-bit integers, if available?'
5326 . ./myread
5327 case "$ans" in
5328 [yY]*) val="$define" ;;
5329 *) val="$undef" ;;
5330 esac
5331 ;;
5332esac
5333set use64bitint
5334eval $setvar
5335
5336case "$use64bitall" in
5337"$define"|true|[yY]*) dflt='y' ;;
5338*) case "$longsize" in
5339 8) dflt='y' ;;
5340 *) dflt='n' ;;
5341 esac
5342 ;;
5343esac
5344cat <<EOM
5345
5346You may also choose to try maximal 64-bitness. It means using as much
534764-bitness as possible on the platform. This in turn means even more
5348binary incompatibilities. On the other hand, your platform may not
5349have any more 64-bitness available than what you already have chosen.
5350
5351If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5352(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5353EOM
5354rp='Try to use maximal 64-bit support, if available?'
5355. ./myread
5356case "$ans" in
5357[yY]*) val="$define" ;;
5358*) val="$undef" ;;
5359esac
5360set use64bitall
5361eval $setvar
5362case "$use64bitall" in
5363"$define")
5364 case "$use64bitint" in
5365 "$undef")
5366 cat <<EOM
5367
5368Since you have chosen a maximally 64-bit build, I'm also turning on
5369the use of 64-bit integers.
5370EOM
5371 use64bitint="$define" ;;
5372 esac
5373 ;;
5374esac
5375
8dfa8df9
JH
5376case "$use64bitall" in
5377"$define"|true|[yY]*)
5378 case "$ptrsize" in
5379 4) cat <<EOM >&4
5380
5381*** You have chosen a maximally 64-bit build, but your pointers
5382*** are only 4 bytes wide, disabling maximal 64-bitness.
5383
5384EOM
5385 use64bitall="$undef"
5386 case "$use64bitint" in
5387 "$define"|true|[yY]*) ;;
5388 *) cat <<EOM >&4
5389
5390*** Downgrading from maximal 64-bitness to using 64-bit integers.
5391
5392EOM
5393 use64bitint="$define"
5394 ;;
5395 esac
5396 ;;
5397 esac
5398 ;;
5399esac
5400
b4eb6b3d
JH
5401case "$use64bitint" in
5402"$define"|true|[yY]*)
5403: Look for a hint-file generated 'call-back-unit'. If the
5404: user has specified that a 64-bit perl is to be built,
5405: we may need to set or change some other defaults.
5406 if $test -f use64bitint.cbu; then
5407 echo "Your platform has some specific hints for 64-bit integers, using them..."
5408 . ./use64bitint.cbu
5409 fi
5410 case "$longsize" in
5411 4) case "$archname64" in
5412 '') archname64=64int ;;
5413 esac
5414 ;;
5415 esac
5416 ;;
5417esac
5418
5419case "$use64bitall" in
5420"$define"|true|[yY]*)
5421: Look for a hint-file generated 'call-back-unit'. If the
5422: user has specified that a maximally 64-bit perl is to be built,
5423: we may need to set or change some other defaults.
5424 if $test -f use64bitall.cbu; then
5425 echo "Your platform has some specific hints for 64-bit builds, using them..."
5426 . ./use64bitall.cbu
5427 fi
5428 case "$longsize" in
5429 4) case "$archname64" in
5430 ''|64int) archname64=64all ;;
5431 esac
5432 ;;
5433 esac
5434 ;;
5435esac
5436
5437echo " "
5438echo "Checking for GNU C Library..." >&4
5440bc8e 5439cat >try.c <<EOM
b4eb6b3d
JH
5440#include <stdio.h>
5441int main()
5442{
5443#ifdef __GLIBC__
5444 exit(0);
5445#else
5446 exit(1);
5447#endif
5448}
5449EOM
5440bc8e
JH
5450set try
5451if eval $compile_ok && $run ./try; then
b4eb6b3d
JH
5452 val="$define"
5453 echo "You are using the GNU C Library"
5454else
5455 val="$undef"
5456 echo "You are not using the GNU C Library"
5457fi
5440bc8e 5458$rm -f try try.*
b4eb6b3d
JH
5459set d_gnulibc
5460eval $setvar
5461
5462: see if nm is to be used to determine whether a symbol is defined or not
5463case "$usenm" in
5464'')
5465 dflt=''
c1a7f87b
JH
5466 case "$d_gnulibc" in
5467 "$define")
5468 echo " "
5469 echo "nm probably won't work on the GNU C Library." >&4
5470 dflt=n
bd9b35c9 5471 ;;
c1a7f87b
JH
5472 esac
5473 case "$dflt" in
5474 '')
5475 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5476 echo " "
5477 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5478 echo "'nm' won't be sufficient on this sytem." >&4
5479 dflt=n
5480 fi
5481 ;;
5482 esac
5483 case "$dflt" in
5484 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5485 if $test $dflt -gt 20; then
5486 dflt=y
5487 else
5488 dflt=n
5489 fi
bd9b35c9
JH
5490 ;;
5491 esac
bd9b35c9
JH
5492 ;;
5493*)
c1a7f87b
JH
5494 case "$usenm" in
5495 true|$define) dflt=y;;
5496 *) dflt=n;;
5497 esac
bd9b35c9
JH
5498 ;;
5499esac
5500$cat <<EOM
5501
c1a7f87b
JH
5502I can use $nm to extract the symbols from your C libraries. This
5503is a time consuming task which may generate huge output on the disk (up
5504to 3 megabytes) but that should make the symbols extraction faster. The
5505alternative is to skip the 'nm' extraction part and to compile a small
5506test program instead to determine whether each symbol is present. If
5507you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5508this may be the best solution.
5509
5510You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5511
5512EOM
c1a7f87b
JH
5513rp="Shall I use $nm to extract C symbols from the libraries?"
5514. ./myread
5515case "$ans" in
5516[Nn]*) usenm=false;;
5517*) usenm=true;;
bd9b35c9 5518esac
bd9b35c9 5519
c1a7f87b
JH
5520runnm=$usenm
5521case "$reuseval" in
5522true) runnm=false;;
8e07c86e 5523esac
29209bc5 5524
c1a7f87b
JH
5525: nm options which may be necessary
5526case "$nm_opt" in
5527'') if $test -f /mach_boot; then
5528 nm_opt='' # Mach
5529 elif $test -d /usr/ccs/lib; then
5530 nm_opt='-p' # Solaris (and SunOS?)
5531 elif $test -f /dgux; then
5532 nm_opt='-p' # DG-UX
5533 elif $test -f /lib64/rld; then
5534 nm_opt='-p' # 64-bit Irix
5535 else
5536 nm_opt=''
5537 fi;;
5538esac
bd9b35c9 5539
c1a7f87b
JH
5540: nm options which may be necessary for shared libraries but illegal
5541: for archive libraries. Thank you, Linux.
5542case "$nm_so_opt" in
5543'') case "$myuname" in
5544 *linux*)
5545 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5546 nm_so_opt='--dynamic'
5547 fi
5548 ;;
bd9b35c9 5549 esac
c1a7f87b
JH
5550 ;;
5551esac
8e07c86e 5552
c1a7f87b
JH
5553case "$runnm" in
5554true)
5555: get list of predefined functions in a handy place
5556echo " "
5557case "$libc" in
5558'') libc=unknown
5559 case "$libs" in
5560 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5561 esac
ff935051
JH
5562 ;;
5563esac
c1a7f87b
JH
5564case "$libs" in
5565'') ;;
5566*) for thislib in $libs; do
5567 case "$thislib" in
5568 -lc|-lc_s)
5569 : Handle C library specially below.
5570 ;;
5571 -l*)
5572 thislib=`echo $thislib | $sed -e 's/^-l//'`
5573 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5574 :
5575 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5576 :
5577 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5578 :
5579 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5580 :
5581 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5582 :
5583 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5584 :
5585 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5586 :
5587 else
5588 try=''
5589 fi
5590 libnames="$libnames $try"
5591 ;;
5592 *) libnames="$libnames $thislib" ;;
34d1710f 5593 esac
c1a7f87b 5594 done
4633a7c4
LW
5595 ;;
5596esac
c1a7f87b
JH
5597xxx=normal
5598case "$libc" in
5599unknown)
5600 set /lib/libc.$so
5601 for xxx in $libpth; do
5602 $test -r $1 || set $xxx/libc.$so
5603 : The messy sed command sorts on library version numbers.
5604 $test -r $1 || \
5605 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5606 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5607 h
5608 s/[0-9][0-9]*/0000&/g
5609 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5610 G
5611 s/\n/ /' | \
381aa1ff 5612 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5613 eval set \$$#
5614 done
5615 $test -r $1 || set /usr/ccs/lib/libc.$so
5616 $test -r $1 || set /lib/libsys_s$_a
5617 ;;
5618*)
5619 set blurfl
5620 ;;
a4f3eea9 5621esac
c1a7f87b
JH
5622if $test -r "$1"; then
5623 echo "Your (shared) C library seems to be in $1."
5624 libc="$1"
5625elif $test -r /lib/libc && $test -r /lib/clib; then
5626 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5627 xxx=apollo
5628 libc='/lib/clib /lib/libc'
5629 if $test -r /lib/syslib; then
5630 echo "(Your math library is in /lib/syslib.)"
5631 libc="$libc /lib/syslib"
5632 fi
5633elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5634 echo "Your C library seems to be in $libc, as you said before."
5635elif $test -r $incpath/usr/lib/libc$_a; then
5636 libc=$incpath/usr/lib/libc$_a;
5637 echo "Your C library seems to be in $libc. That's fine."
5638elif $test -r /lib/libc$_a; then
5639 libc=/lib/libc$_a;
5640 echo "Your C library seems to be in $libc. You're normal."
5641else
5642 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5643 :
5644 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5645 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5646 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5647 :
5648 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5649 :
5650 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5651 :
5652 else
5653 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5654 fi
5655 if $test -r "$tans"; then
5656 echo "Your C library seems to be in $tans, of all places."
5657 libc=$tans
5658 else
5659 libc='blurfl'
5660 fi
5661fi
5662if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5663 dflt="$libc"
5664 cat <<EOM
a4f3eea9 5665
c1a7f87b
JH
5666If the guess above is wrong (which it might be if you're using a strange
5667compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5668
5669EOM
a4f3eea9 5670else
c1a7f87b 5671 dflt=''
381aa1ff 5672 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5673 cat >&4 <<EOM
5674I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5675
c1a7f87b
JH
5676EOM
5677 $sed 's/^/ /' libpath
5678 cat <<EOM
29209bc5 5679
c1a7f87b 5680None of these seems to contain your C library. I need to get its name...
a4f3eea9 5681
bd9b35c9 5682EOM
bd9b35c9 5683fi
c1a7f87b
JH
5684fn=f
5685rp='Where is your C library?'
5686. ./getfile
5687libc="$ans"
a4f3eea9 5688
c1a7f87b 5689echo " "
381aa1ff 5690echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5691set X `cat libnames`
5692shift
5693xxx=files
5694case $# in 1) xxx=file; esac
5695echo "Extracting names from the following $xxx for later perusal:" >&4
5696echo " "
5697$sed 's/^/ /' libnames >&4
5698echo " "
5699$echo $n "This may take a while...$c" >&4
a4f3eea9 5700
c1a7f87b
JH
5701for file in $*; do
5702 case $file in
5703 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5704 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5705 esac
c1a7f87b 5706done >libc.tmp
a4f3eea9 5707
c1a7f87b
JH
5708$echo $n ".$c"
5709$grep fprintf libc.tmp > libc.ptf
5710xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
c56d2bdc 5711xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
c1a7f87b
JH
5712xxx='[ADTSIW]'
5713if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5714 eval $xscan;\
5715 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5716 eval $xrun
5717elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5718 eval $xscan;\
5719 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5720 eval $xrun
5721elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5722 eval $xscan;\
5723 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5724 eval $xrun
5725elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5726 eval $xscan;\
5727 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728 eval $xrun
5729elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\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'";\
5734 eval $xscan;\
5735 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736 eval $xrun
5737elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5738 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5739 eval $xscan;\
5740 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5741 eval $xrun
5742elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5743 eval $xscan;\
5744 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5745 eval $xrun
5746elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5747 eval $xscan;\
5748 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5749 eval $xrun
5750elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5751 eval $xscan;\
5752 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753 eval $xrun
5754elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5755 eval $xscan;\
5756 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757 eval $xrun
5758elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5759 eval $xscan;\
5760 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761 eval $xrun
5762elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5763 eval $xscan;\
5764 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5765 eval $xrun
5766elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5767 eval $xscan;\
5768 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5769 eval $xrun
5770else
5771 $nm -p $* 2>/dev/null >libc.tmp
5772 $grep fprintf libc.tmp > libc.ptf
5773 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5774 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5775 then
5776 nm_opt='-p'
5777 eval $xrun
bd9b35c9 5778 else
c1a7f87b
JH
5779 echo " "
5780 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5781 com=''
5782 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5783 for thisname in $libnames $libc; do
5784 $ar t $thisname >>libc.tmp
5785 done
5786 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5787 echo "Ok." >&4
5788 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5789 # Repeat libc to extract forwarders to DLL entries too
5790 for thisname in $libnames $libc; do
5791 $ar tv $thisname >>libc.tmp
5792 # Revision 50 of EMX has bug in $ar.
5793 # it will not extract forwarders to DLL entries
5794 # Use emximp which will extract exactly them.
5795 emximp -o tmp.imp $thisname \
5796 2>/dev/null && \
5797 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5798 < tmp.imp >>libc.tmp
5799 $rm tmp.imp
5800 done
5801 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5802 echo "Ok." >&4
5803 else
5804 echo "$ar didn't seem to work right." >&4
5805 echo "Maybe this is a Cray...trying bld instead..." >&4
5806 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5807 then
5808 for thisname in $libnames; do
5809 bld t $libnames | \
5810 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5811 $ar t $thisname >>libc.tmp
5812 done
5813 echo "Ok." >&4
bd9b35c9 5814 else
c1a7f87b
JH
5815 echo "That didn't work either. Giving up." >&4
5816 exit 1
bd9b35c9 5817 fi
c1a7f87b 5818 fi
a4f3eea9 5819 fi
a4f3eea9 5820fi
c1a7f87b
JH
5821nm_extract="$com"
5822if $test -f /lib/syscalls.exp; then
5823 echo " "
5824 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
a8c676c6 5825 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
c1a7f87b
JH
5826fi
5827;;
5828esac
5829$rm -f libnames libpath
bd9b35c9 5830
c1a7f87b
JH
5831: is a C symbol defined?
5832csym='tlook=$1;
5833case "$3" in
5834-v) tf=libc.tmp; tc=""; tdc="";;
5835-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5836*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5837esac;
5838tx=yes;
5839case "$reuseval-$4" in
5840true-) ;;
5841true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5842esac;
5843case "$tx" in
5844yes)
5845 case "$runnm" in
5846 true)
5847 if $contains $tlook $tf >/dev/null 2>&1;
5848 then tval=true;
5849 else tval=false;
5850 fi;;
5851 *)
5852 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5853 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5854 then tval=true;
5855 else tval=false;
5856 fi;
5857 $rm -f t t.c;;
5858 esac;;
5859*)
5860 case "$tval" in
5861 $define) tval=true;;
5862 *) tval=false;;
5863 esac;;
5864esac;
5865eval "$2=$tval"'
bd9b35c9 5866
c1a7f87b
JH
5867: define an is-in-libc? function
5868inlibc='echo " "; td=$define; tu=$undef;
5869sym=$1; var=$2; eval "was=\$$2";
5870tx=yes;
5871case "$reuseval$was" in
5872true) ;;
5873true*) tx=no;;
5874esac;
5875case "$tx" in
5876yes)
5877 set $sym tres -f;
5878 eval $csym;
5879 case "$tres" in
5880 true)
5881 echo "$sym() found." >&4;
5882 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5883 *)
5884 echo "$sym() NOT found." >&4;
5885 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5886 esac;;
bd9b35c9 5887*)
c1a7f87b
JH
5888 case "$was" in
5889 $define) echo "$sym() found." >&4;;
5890 *) echo "$sym() NOT found." >&4;;
5891 esac;;
5892esac'
5893
b4eb6b3d
JH
5894: see if sqrtl exists
5895set sqrtl d_sqrtl
c1a7f87b
JH
5896eval $inlibc
5897
b4eb6b3d
JH
5898: check for length of double
5899echo " "
5900case "$doublesize" in
5901'')
5902 echo "Checking to see how big your double precision numbers are..." >&4
5903 $cat >try.c <<'EOCP'
5904#include <stdio.h>
5905int main()
5906{
5907 printf("%d\n", (int)sizeof(double));
5908 exit(0);
5909}
5910EOCP
5911 set try
5912 if eval $compile_ok; then
5440bc8e 5913 doublesize=`$run ./try`
b4eb6b3d
JH
5914 echo "Your double is $doublesize bytes long."
5915 else
5916 dflt='8'
5917 echo "(I can't seem to compile the test program. Guessing...)"
5918 rp="What is the size of a double precision number (in bytes)?"
5919 . ./myread
5920 doublesize="$ans"
5921 fi
5922 ;;
5923esac
5924$rm -f try.c try
5925
5926: check for long doubles
5927echo " "
5928echo "Checking to see if you have long double..." >&4
5929echo 'int main() { long double x = 7.0; }' > try.c
5930set try
5931if eval $compile; then
5932 val="$define"
5933 echo "You have long double."
5934else
5935 val="$undef"
5936 echo "You do not have long double."
5937fi
5938$rm try.*
5939set d_longdbl
5940eval $setvar
5941
5942: check for length of long double
5943case "${d_longdbl}${longdblsize}" in
5944$define)
5945 echo " "
5946 echo "Checking to see how big your long doubles are..." >&4
5947 $cat >try.c <<'EOCP'
5948#include <stdio.h>
5949int main()
5950{
5951 printf("%d\n", sizeof(long double));
5952}
5953EOCP
5954 set try
5955 set try
5956 if eval $compile; then
5440bc8e 5957 longdblsize=`$run ./try`
b4eb6b3d
JH
5958 echo "Your long doubles are $longdblsize bytes long."
5959 else
5960 dflt='8'
5961 echo " "
5962 echo "(I can't seem to compile the test program. Guessing...)" >&4
5963 rp="What is the size of a long double (in bytes)?"
5964 . ./myread
5965 longdblsize="$ans"
5966 fi
5967 if $test "X$doublesize" = "X$longdblsize"; then
5968 echo "(That isn't any different from an ordinary double.)"
5969 fi
5970 ;;
5971esac
5972$rm -f try.* try
5973
dc526090
NC
5974echo " "
5975
5976if $test X"$d_longdbl" = X"$define"; then
5977
5978echo "Checking how to print long doubles..." >&4
5979
5980if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5981 $cat >try.c <<'EOCP'
5982#include <sys/types.h>
5983#include <stdio.h>
5984int main() {
5985 double d = 123.456;
5986 printf("%.3f\n", d);
5987}
5988EOCP
5989 set try
5990 if eval $compile; then
5991 yyy=`$run ./try`
5992 case "$yyy" in
5993 123.456)
5994 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5995 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5996 echo "We will use %f."
5997 ;;
5998 esac
5999 fi
6000fi
6001
6002if $test X"$sPRIfldbl" = X; then
6003 $cat >try.c <<'EOCP'
6004#include <sys/types.h>
6005#include <stdio.h>
6006int main() {
6007 long double d = 123.456;
6008 printf("%.3Lf\n", d);
6009}
6010EOCP
6011 set try
6012 if eval $compile; then
6013 yyy=`$run ./try`
6014 case "$yyy" in
6015 123.456)
6016 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6017 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6018 echo "We will use %Lf."
6019 ;;
6020 esac
6021 fi
6022fi
6023
6024if $test X"$sPRIfldbl" = X; then
6025 $cat >try.c <<'EOCP'
6026#include <sys/types.h>
6027#include <stdio.h>
6028int main() {
6029 long double d = 123.456;
6030 printf("%.3llf\n", d);
6031}
6032EOCP
6033 set try
6034 if eval $compile; then
6035 yyy=`$run ./try`
6036 case "$yyy" in
6037 123.456)
6038 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6039 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6040 echo "We will use %llf."
6041 ;;
6042 esac
6043 fi
6044fi
6045
6046if $test X"$sPRIfldbl" = X; then
6047 $cat >try.c <<'EOCP'
6048#include <sys/types.h>
6049#include <stdio.h>
6050int main() {
6051 long double d = 123.456;
6052 printf("%.3lf\n", d);
6053}
6054EOCP
6055 set try
6056 if eval $compile; then
6057 yyy=`$run ./try`
6058 case "$yyy" in
6059 123.456)
6060 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6061 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6062 echo "We will use %lf."
6063 ;;
6064 esac
6065 fi
6066fi
6067
6068if $test X"$sPRIfldbl" = X; then
6069 echo "Cannot figure out how to print long doubles." >&4
6070else
6071 sSCNfldbl=$sPRIfldbl # expect consistency
6072fi
6073
6074$rm -f try try.*
6075
6076fi # d_longdbl
6077
6078case "$sPRIfldbl" in
6079'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
6080 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
6081 d_SCNfldbl="$undef";
6082 ;;
6083*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
6084 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
6085 d_SCNfldbl="$define";
6086 ;;
6087esac
6088
6089: see if modfl exists
6090set modfl d_modfl
6091eval $inlibc
6092
6093d_modfl_pow32_bug="$undef"
6094
6095case "$d_longdbl$d_modfl" in
6096$define$define)
6097 $cat <<EOM
6098Checking to see whether your modfl() is okay for large values...
6099EOM
6100$cat >try.c <<EOCP
6101#include <math.h>
6102#include <stdio.h>
6103int main() {
6104 long double nv = 4294967303.15;
6105 long double v, w;
6106 v = modfl(nv, &w);
6107#ifdef __GLIBC__
6108 printf("glibc");
6109#endif
6110 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6111 return 0;
6112}
6113EOCP
6114 case "$osname:$gccversion" in
6115 aix:) saveccflags="$ccflags"
6116 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6117 esac
6118 set try
6119 if eval $compile; then
6120 foo=`$run ./try`
6121 case "$foo" in
6122 *" 4294967303.150000 1.150000 4294967302.000000")
6123 echo >&4 "Your modfl() is broken for large values."
6124 d_modfl_pow32_bug="$define"
6125 case "$foo" in
6126 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6127 ;;
6128 esac
6129 ;;
6130 *" 4294967303.150000 0.150000 4294967303.000000")
6131 echo >&4 "Your modfl() seems okay for large values."
6132 ;;
6133 *) echo >&4 "I don't understand your modfl() at all."
6134 d_modfl="$undef"
6135 ;;
6136 esac
6137 $rm -f try.* try core core.try.*
6138 else
6139 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6140 d_modfl="$undef"
6141 fi
6142 case "$osname:$gccversion" in
6143 aix:) ccflags="$saveccflags" ;; # restore
6144 esac
6145 ;;
6146esac
6147
6148case "$ccflags" in
6149*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6150esac
6151
6152case "$uselongdouble" in
6153$define|true|[yY]*) dflt='y';;
6154*) dflt='n';;
6155esac
6156cat <<EOM
6157
6158Perl can be built to take advantage of long doubles which
6159(if available) may give more accuracy and range for floating point numbers.
6160
6161If this doesn't make any sense to you, just accept the default '$dflt'.
6162EOM
6163rp='Try to use long doubles if available?'
6164. ./myread
6165case "$ans" in
6166y|Y) val="$define" ;;
6167*) val="$undef" ;;
6168esac
6169set uselongdouble
6170eval $setvar
6171
6172case "$uselongdouble" in
6173true|[yY]*) uselongdouble="$define" ;;
6174esac
6175
6176case "$uselongdouble" in
6177$define)
6178: Look for a hint-file generated 'call-back-unit'. If the
6179: user has specified that long doubles should be used,
6180: we may need to set or change some other defaults.
6181 if $test -f uselongdouble.cbu; then
6182 echo "Your platform has some specific hints for long doubles, using them..."
6183 . ./uselongdouble.cbu
6184 else
6185 $cat <<EOM
6186(Your platform doesn't have any specific hints for long doubles.)
6187EOM
6188 fi
6189 ;;
6190esac
6191
6192message=X
6193case "$uselongdouble:$d_sqrtl:$d_modfl" in
6194$define:$define:$define)
6195 : You have both
6196 ;;
6197$define:$define:$undef)
6198 message="I could not find modfl"
6199 ;;
6200$define:$undef:$define)
6201 message="I could not find sqrtl"
6202 ;;
6203$define:$undef:$undef)
6204 message="I found neither sqrtl nor modfl"
6205 ;;
6206esac
6207
6208if $test "$message" != X; then
6209 $cat <<EOM >&4
6210
6211*** You requested the use of long doubles but you do not seem to have
6212*** the mathematic functions for long doubles.
6213*** ($message)
6214*** I'm disabling the use of long doubles.
6215
6216EOM
6217
6218 uselongdouble=$undef
6219fi
6220
51de783f 6221case "$useperlio" in
5a3a8a02 6222$define|true|[yY]*|'') dflt='y';;
51de783f
JH
6223*) dflt='n';;
6224esac
6225cat <<EOM
6226
6227Previous version of $package used the standard IO mechanisms as
5a3a8a02 6228defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 6229alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
6230stdio mechanism is still available if needed. The abstraction layer
6231can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
6232Using PerlIO with sfio may cause problems with some extension modules.
6233
6234If this doesn't make any sense to you, just accept the default '$dflt'.
6235EOM
5a3a8a02 6236rp='Use the PerlIO abstraction layer?'
51de783f
JH
6237. ./myread
6238case "$ans" in
6239y|Y)
6240 val="$define"
5a3a8a02 6241 ;;
51de783f
JH
6242*)
6243 echo "Ok, doing things the stdio way."
6244 val="$undef"
6245 ;;
6246esac
6247set useperlio
6248eval $setvar
6249
6250case "$usesocks" in
6251$define|true|[yY]*)
6252 case "$useperlio" in
6253 $define|true|[yY]*) ;;
6254 *) cat >&4 <<EOM
6255
6256You are using the SOCKS proxy protocol library which means that you
6257should also use the PerlIO layer. You may be headed for trouble.
6258
6259EOM
6260 ;;
6261 esac
6262 ;;
6263esac
6264
6265
b4eb6b3d
JH
6266: determine the architecture name
6267echo " "
6268if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6269 tarch=`arch`"-$osname"
6270elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6271 if uname -m > tmparch 2>&1 ; then
6272 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6273 -e 's/$/'"-$osname/" tmparch`
6274 else
6275 tarch="$osname"
6276 fi
6277 $rm -f tmparch
6278else
6279 tarch="$osname"
6280fi
6281case "$myarchname" in
6282''|"$tarch") ;;
6283*)
6284 echo "(Your architecture name used to be $myarchname.)"
6285 archname=''
6286 ;;
6287esac
5440bc8e
JH
6288case "$targetarch" in
6289'') ;;
6290*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6291esac
b4eb6b3d
JH
6292myarchname="$tarch"
6293case "$archname" in
6294'') dflt="$tarch";;
6295*) dflt="$archname";;
6296esac
6297rp='What is your architecture name'
6298. ./myread
6299archname="$ans"
6300case "$usethreads" in
6301$define)
6302 echo "Threads selected." >&4
6303 case "$archname" in
6304 *-thread*) echo "...and architecture name already has -thread." >&4
6305 ;;
6306 *) archname="$archname-thread"
6307 echo "...setting architecture name to $archname." >&4
6308 ;;
6309 esac
6310 ;;
6311esac
6312case "$usemultiplicity" in
6313$define)
6314 echo "Multiplicity selected." >&4
6315 case "$archname" in
6316 *-multi*) echo "...and architecture name already has -multi." >&4
6317 ;;
6318 *) archname="$archname-multi"
6319 echo "...setting architecture name to $archname." >&4
6320 ;;
6321 esac
6322 ;;
6323esac
6324case "$use64bitint$use64bitall" in
6325*"$define"*)
6326 case "$archname64" in
6327 '')
6328 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6329 ;;
6330 *)
6331 case "$use64bitint" in
6332 "$define") echo "64 bit integers selected." >&4 ;;
6333 esac
6334 case "$use64bitall" in
6335 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6336 esac
6337 case "$archname" in
6338 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6339 ;;
6340 *) archname="$archname-$archname64"
6341 echo "...setting architecture name to $archname." >&4
6342 ;;
6343 esac
6344 ;;
6345 esac
6346esac
6347case "$uselongdouble" in
6348$define)
6349 echo "Long doubles selected." >&4
6350 case "$longdblsize" in
6351 $doublesize)
262495b9 6352 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
b4eb6b3d
JH
6353 ;;
6354 *)
6355 case "$archname" in
6356 *-ld*) echo "...and architecture name already has -ld." >&4
6357 ;;
6358 *) archname="$archname-ld"
6359 echo "...setting architecture name to $archname." >&4
6360 ;;
6361 esac
6362 ;;
6363 esac
6364 ;;
6365esac
51de783f
JH
6366case "$useperlio" in
6367$define)
6368 echo "Perlio selected." >&4
d46c9a2d
JH
6369 ;;
6370*)
6371 echo "Perlio not selected, using stdio." >&4
51de783f 6372 case "$archname" in
d46c9a2d 6373 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 6374 ;;
d46c9a2d 6375 *) archname="$archname-stdio"
51de783f
JH
6376 echo "...setting architecture name to $archname." >&4
6377 ;;
6378 esac
6379 ;;
6380esac
b4eb6b3d
JH
6381
6382: determine root of directory hierarchy where package will be installed.
6383case "$prefix" in
6384'')
6385 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6386 ;;
6387*)
6388 dflt="$prefix"
6389 ;;
6390esac
6391$cat <<EOM
6392
6393By default, $package will be installed in $dflt/bin, manual pages
6394under $dflt/man, etc..., i.e. with $dflt as prefix for all
6395installation directories. Typically this is something like /usr/local.
6396If you wish to have binaries under /usr/bin but other parts of the
6397installation under /usr/local, that's ok: you will be prompted
6398separately for each of the installation directories, the prefix being
6399only used to set the defaults.
6400
6401EOM
6402fn=d~
6403rp='Installation prefix to use?'
6404. ./getfile
6405oldprefix=''
6406case "$prefix" in
6407'') ;;
6408*)
6409 case "$ans" in
6410 "$prefix") ;;
6411 *) oldprefix="$prefix";;
6412 esac
6413 ;;
6414esac
6415prefix="$ans"
6416prefixexp="$ansexp"
6417
a6d26a0d
JH
6418case "$afsroot" in
6419'') afsroot=/afs ;;
6420*) afsroot=$afsroot ;;
6421esac
6422
b4eb6b3d
JH
6423: is AFS running?
6424echo " "
6425case "$afs" in
6426$define|true) afs=true ;;
6427$undef|false) afs=false ;;
a6d26a0d 6428*) if test -d $afsroot; then
b4eb6b3d
JH
6429 afs=true
6430 else
6431 afs=false
6432 fi
6433 ;;
6434esac
6435if $afs; then
6436 echo "AFS may be running... I'll be extra cautious then..." >&4
6437else
6438 echo "AFS does not seem to be running..." >&4
6439fi
6440
6441: determine installation prefix for where package is to be installed.
6442if $afs; then
6443$cat <<EOM
6444
6445Since you are running AFS, I need to distinguish the directory in which
6446files will reside from the directory in which they are installed (and from
6447which they are presumably copied to the former directory by occult means).
6448
6449EOM
6450 case "$installprefix" in
6451 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6452 *) dflt="$installprefix";;
6453 esac
6454else
6455$cat <<EOM
6456
6457In some special cases, particularly when building $package for distribution,
6458it is convenient to distinguish between the directory in which files should
6459be installed from the directory ($prefix) in which they
6460will eventually reside. For most users, these two directories are the same.
6461
6462EOM
6463 case "$installprefix" in
6464 '') dflt=$prefix ;;
6465 *) dflt=$installprefix;;
6466 esac
6467fi
6468fn=d~
6469rp='What installation prefix should I use for installing files?'
6470. ./getfile
6471installprefix="$ans"
6472installprefixexp="$ansexp"
6473
6474: set the prefixit variable, to compute a suitable default value
6475prefixit='case "$3" in
6476""|none)
6477 case "$oldprefix" in
6478 "") eval "$1=\"\$$2\"";;
6479 *)
6480 case "$3" in
6481 "") eval "$1=";;
6482 none)
6483 eval "tp=\"\$$2\"";
6484 case "$tp" in
6485 ""|" ") eval "$1=\"\$$2\"";;
6486 *) eval "$1=";;
6487 esac;;
6488 esac;;
6489 esac;;
6490*)
6491 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6492 case "$tp" in
6493 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6494 /*-$oldprefix/*|\~*-$oldprefix/*)
6495 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6496 *) eval "$1=\"\$$2\"";;
6497 esac;;
6498esac'
6499
b4eb6b3d
JH
6500: get the patchlevel
6501echo " "
6502echo "Getting the current patchlevel..." >&4
6503if $test -r $rsrc/patchlevel.h;then
6504 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6505 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6506 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6507 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6508 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6509 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6510 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6511else
6512 revision=0
6513 patchlevel=0
6514 subversion=0
6515 api_revision=0
6516 api_version=0
6517 api_subversion=0
151e6568
MB
6518 perl_patchlevel=0
6519 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6520fi
151e6568
MB
6521if $test -r $rsrc/.patch ; then
6522 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6523 perl_patchlevel=`cat $rsrc/.patch`
6524 fi
6525fi
861eb78d
AD
6526: Define a handy string here to avoid duplication in myconfig.SH and configpm.
6527version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 6528case "$perl_patchlevel" in
861eb78d
AD
65290|'') ;;
6530*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 6531esac
861eb78d
AD
6532
6533$echo "(You have $package $version_patchlevel_string.)"
6534
b4eb6b3d
JH
6535case "$osname" in
6536dos|vms)
6537 : XXX Should be a Configure test for double-dots in filenames.
6538 version=`echo $revision $patchlevel $subversion | \
6539 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6540 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6541 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6542 ;;
6543*)
6544 version=`echo $revision $patchlevel $subversion | \
6545 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6546 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6547 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6548 ;;
6549esac
6550: Special case the 5.005_xx maintenance series, which used 5.005
6551: without any subversion label as a subdirectory in $sitelib
6552if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6553 api_versionstring='5.005'
6554fi
6555
6556: determine installation style
6557: For now, try to deduce it from prefix unless it is already set.
6558: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6559case "$installstyle" in
6560'') case "$prefix" in
6561 *perl*) dflt='lib';;
6562 *) dflt='lib/perl5' ;;
6563 esac
6564 ;;
6565*) dflt="$installstyle" ;;
6566esac
6567: Probably not worth prompting for this since we prompt for all
6568: the directories individually, and the prompt would be too long and
6569: confusing anyway.
6570installstyle=$dflt
6571
6572: determine where private library files go
6573: Usual default is /usr/local/lib/perl5/$version.
6574: Also allow things like /opt/perl/lib/$version, since
6575: /opt/perl/lib/perl5... would be redundant.
6576: The default "style" setting is made in installstyle.U
6577case "$installstyle" in
6578*lib/perl5*) set dflt privlib lib/$package/$version ;;
6579*) set dflt privlib lib/$version ;;
6580esac
6581eval $prefixit
6582$cat <<EOM
6583
6584There are some auxiliary files for $package that need to be put into a
6585private library directory that is accessible by everyone.
6586
6587EOM
6588fn=d~+
6589rp='Pathname where the private library files will reside?'
6590. ./getfile
6591privlib="$ans"
6592privlibexp="$ansexp"
6593: Change installation prefix, if necessary.
6594if $test X"$prefix" != X"$installprefix"; then
6595 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6596else
6597 installprivlib="$privlibexp"
6598fi
6599
6600: set the prefixup variable, to restore leading tilda escape
6601prefixup='case "$prefixexp" in
6602"$prefix") ;;
6603*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6604esac'
6605
6606: determine where public architecture dependent libraries go
6607set archlib archlib
6608eval $prefixit
6609: privlib default is /usr/local/lib/$package/$version
6610: archlib default is /usr/local/lib/$package/$version/$archname
6611: privlib may have an optional trailing /share.
6612tdflt=`echo $privlib | $sed 's,/share$,,'`
6613tdflt=$tdflt/$archname
6614case "$archlib" in
6615'') dflt=$tdflt
6616 ;;
6617*) dflt="$archlib"
6618 ;;
6619esac
6620$cat <<EOM
6621
6622$spackage contains architecture-dependent library files. If you are
6623sharing libraries in a heterogeneous environment, you might store
6624these files in a separate location. Otherwise, you can just include
6625them with the rest of the public library files.
6626
6627EOM
6628fn=d+~
6629rp='Where do you want to put the public architecture-dependent libraries?'
6630. ./getfile
6631archlib="$ans"
6632archlibexp="$ansexp"
6633if $test X"$archlib" = X"$privlib"; then
6634 d_archlib="$undef"
6635else
6636 d_archlib="$define"
6637fi
6638: Change installation prefix, if necessary.
6639if $test X"$prefix" != X"$installprefix"; then
6640 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6641else
6642 installarchlib="$archlibexp"
6643fi
6644
6645
6646: Binary compatibility with 5.005 is not possible for builds
6647: with advanced features
6648case "$usethreads$usemultiplicity" in
6649*define*)
6650 bincompat5005="$undef"
6651 d_bincompat5005="$undef"
6652 ;;
6653*) $cat <<EOM
6654
6655This version of Perl can be compiled for binary compatibility with 5.005.
6656If you decide to do so, you will be able to continue using most of the
6657extensions that were compiled for Perl 5.005.
6658
6659EOM
6660 case "$bincompat5005$d_bincompat5005" in
6661 *"$undef"*) dflt=n ;;
6662 *) dflt=y ;;
6663 esac
6664 rp='Binary compatibility with Perl 5.005?'
6665 . ./myread
6666 case "$ans" in
6667 y*) val="$define" ;;
6668 *) val="$undef" ;;
6669 esac
6670 set d_bincompat5005
6671 eval $setvar
6672 case "$d_bincompat5005" in
6673 "$define")
6674 bincompat5005="$define"
6675 ;;
6676 *) bincompat5005="$undef"
6677 d_bincompat5005="$undef"
6678 ;;
6679 esac
6680 ;;
6681esac
6682
6683
6684: see if setuid scripts can be secure
6685$cat <<EOM
6686
6687Some kernels have a bug that prevents setuid #! scripts from being
6688secure. Some sites have disabled setuid #! scripts because of this.
6689
6690First let's decide if your kernel supports secure setuid #! scripts.
6691(If setuid #! scripts would be secure but have been disabled anyway,
6692don't say that they are secure if asked.)
6693
6694EOM
6695
6696val="$undef"
6697if $test -d /dev/fd; then
6698 echo "#!$ls" >reflect
6699 chmod +x,u+s reflect
6700 ./reflect >flect 2>&1
6701 if $contains "/dev/fd" flect >/dev/null; then
6702 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6703 val="$define"
6704 else
6705 $cat <<EOM
6706If you are not sure if they are secure, I can check but I'll need a
6707username and password different from the one you are using right now.
6708If you don't have such a username or don't want me to test, simply
6709enter 'none'.
6710
6711EOM
6712 rp='Other username to test security of setuid scripts with?'
6713 dflt='none'
6714 . ./myread
6715 case "$ans" in
6716 n|none)
6717 case "$d_suidsafe" in
6718 '') echo "I'll assume setuid scripts are *not* secure." >&4
6719 dflt=n;;
6720 "$undef")
6721 echo "Well, the $hint value is *not* secure." >&4
6722 dflt=n;;
6723 *) echo "Well, the $hint value *is* secure." >&4
6724 dflt=y;;
6725 esac
c1a7f87b 6726 ;;
b4eb6b3d
JH
6727 *)
6728 $rm -f reflect flect
6729 echo "#!$ls" >reflect
6730 chmod +x,u+s reflect
6731 echo >flect
6732 chmod a+w flect
6733 echo '"su" will (probably) prompt you for '"$ans's password."
6734 su $ans -c './reflect >flect'
6735 if $contains "/dev/fd" flect >/dev/null; then
6736 echo "Okay, it looks like setuid scripts are secure." >&4
6737 dflt=y
6738 else
6739 echo "I don't think setuid scripts are secure." >&4
6740 dflt=n
6741 fi
6742 ;;
6743 esac
6744 rp='Does your kernel have *secure* setuid scripts?'
6745 . ./myread
6746 case "$ans" in
6747 [yY]*) val="$define";;
6748 *) val="$undef";;
6749 esac
6750 fi
6751else
6752 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6753 echo "(That's for file descriptors, not floppy disks.)"
6754 val="$undef"
6755fi
6756set d_suidsafe
6757eval $setvar
6758
6759$rm -f reflect flect
6760
6761: now see if they want to do setuid emulation
6762echo " "
6763val="$undef"
6764case "$d_suidsafe" in
6765"$define")
6766 val="$undef"
3c728e00 6767 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6768 ;;
6769*)
6770 $cat <<EOM
6771Some systems have disabled setuid scripts, especially systems where
6772setuid scripts cannot be secure. On systems where setuid scripts have
6773been disabled, the setuid/setgid bits on scripts are currently
6774useless. It is possible for $package to detect those bits and emulate
6775setuid/setgid in a secure fashion. This emulation will only work if
6776setuid scripts have been disabled in your kernel.
6777
6778EOM
6779 case "$d_dosuid" in
6780 "$define") dflt=y ;;
6781 *) dflt=n ;;
6782 esac
6783 rp="Do you want to do setuid/setgid emulation?"
6784 . ./myread
6785 case "$ans" in
6786 [yY]*) val="$define";;
6787 *) val="$undef";;
6788 esac
6789 ;;
6790esac
6791set d_dosuid
6792eval $setvar
6793
b4eb6b3d
JH
6794: see if this is a malloc.h system
6795set malloc.h i_malloc
6796eval $inhdr
6797
6798: see if stdlib is available
6799set stdlib.h i_stdlib
6800eval $inhdr
6801
6802: determine which malloc to compile in
6803echo " "
6804case "$usemymalloc" in
c4163172
JH
6805[yY]*|true|$define) dflt='y' ;;
6806[nN]*|false|$undef) dflt='n' ;;
6807*) case "$ptrsize" in
6808 4) dflt='y' ;;
6809 *) dflt='n' ;;
6810 esac
6811 ;;
8dfa8df9 6812esac
b4eb6b3d
JH
6813rp="Do you wish to attempt to use the malloc that comes with $package?"
6814. ./myread
6815usemymalloc="$ans"
6816case "$ans" in
6817y*|true)
6818 usemymalloc='y'
6819 mallocsrc='malloc.c'
6820 mallocobj="malloc$_o"
6821 d_mymalloc="$define"
6822 case "$libs" in
6823 *-lmalloc*)
6824 : Remove malloc from list of libraries to use
6825 echo "Removing unneeded -lmalloc from library list" >&4
6826 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6827 shift
6828 libs="$*"
6829 echo "libs = $libs" >&4
6830 ;;
6831 esac
6832 ;;
6833*)
6834 usemymalloc='n'
6835 mallocsrc=''
6836 mallocobj=''
6837 d_mymalloc="$undef"
6838 ;;
6839esac
6840
6841: compute the return types of malloc and free
6842echo " "
6843$cat >malloc.c <<END
6844#$i_malloc I_MALLOC
6845#$i_stdlib I_STDLIB
6846#include <stdio.h>
6847#include <sys/types.h>
6848#ifdef I_MALLOC
6849#include <malloc.h>
6850#endif
6851#ifdef I_STDLIB
6852#include <stdlib.h>
6853#endif
6854#ifdef TRY_MALLOC
6855void *malloc();
6856#endif
6857#ifdef TRY_FREE
6858void free();
6859#endif
6860END
6861case "$malloctype" in
6862'')
6863 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6864 malloctype='void *'
6865 else
6866 malloctype='char *'
6867 fi
6868 ;;
6869esac
6870echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6871
6872case "$freetype" in
6873'')
6874 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6875 freetype='void'
6876 else
6877 freetype='int'
6878 fi
6879 ;;
6880esac
6881echo "Your system uses $freetype free(), it would seem." >&4
6882$rm -f malloc.[co]
6883$cat <<EOM
6884
6885After $package is installed, you may wish to install various
6886add-on modules and utilities. Typically, these add-ons will
6887be installed under $prefix with the rest
6888of this package. However, you may wish to install such add-ons
6889elsewhere under a different prefix.
6890
6891If you do not wish to put everything under a single prefix, that's
6892ok. You will be prompted for the individual locations; this siteprefix
6893is only used to suggest the defaults.
6894
6895The default should be fine for most people.
6896
6897EOM
6898fn=d~+
6899rp='Installation prefix to use for add-on modules and utilities?'
6900: XXX Here might be another good place for an installstyle setting.
6901case "$siteprefix" in
6902'') dflt=$prefix ;;
6903*) dflt=$siteprefix ;;
6904esac
6905. ./getfile
6906: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6907oldsiteprefix=''
6908case "$siteprefix" in
6909'') ;;
6910*) case "$ans" in
6911 "$prefix") ;;
6912 *) oldsiteprefix="$prefix";;
6913 esac
6914 ;;
6915esac
6916siteprefix="$ans"
6917siteprefixexp="$ansexp"
6918
6919: determine where site specific libraries go.
6920: Usual default is /usr/local/lib/perl5/site_perl/$version
6921: The default "style" setting is made in installstyle.U
6922: XXX No longer works with Prefixit stuff.
6923prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6924case "$sitelib" in
6925'') case "$installstyle" in
6926 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6927 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6928 esac
6929 ;;
6930*) dflt="$sitelib"
6931 ;;
6932esac
6933$cat <<EOM
6934
6935The installation process will create a directory for
6936site-specific extensions and modules. Most users find it convenient
6937to place all site-specific files in this directory rather than in the
6938main distribution directory.
6939
6940EOM
6941fn=d~+
6942rp='Pathname for the site-specific library files?'
6943. ./getfile
6944sitelib="$ans"
6945sitelibexp="$ansexp"
6946sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6947: Change installation prefix, if necessary.
6948if $test X"$prefix" != X"$installprefix"; then
6949 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6950else
6951 installsitelib="$sitelibexp"
6952fi
6953
6954: determine where site specific architecture-dependent libraries go.
6955: sitelib default is /usr/local/lib/perl5/site_perl/$version
6956: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6957: sitelib may have an optional trailing /share.
6958case "$sitearch" in
6959'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6960 dflt="$dflt/$archname"
6961 ;;
6962*) dflt="$sitearch"
6963 ;;
6964esac
6965set sitearch sitearch none
6966eval $prefixit
6967$cat <<EOM
6968
6969The installation process will also create a directory for
6970architecture-dependent site-specific extensions and modules.
6971
6972EOM
6973fn=d~+
6974rp='Pathname for the site-specific architecture-dependent library files?'
6975. ./getfile
6976sitearch="$ans"
6977sitearchexp="$ansexp"
6978: Change installation prefix, if necessary.
6979if $test X"$prefix" != X"$installprefix"; then
6980 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6981else
6982 installsitearch="$sitearchexp"
6983fi
6984
6985$cat <<EOM
6986
6987The installation process will also create a directory for
6988vendor-supplied add-ons. Vendors who supply perl with their system
6989may find it convenient to place all vendor-supplied files in this
6990directory rather than in the main distribution directory. This will
6991ease upgrades between binary-compatible maintenance versions of perl.
6992
6993Of course you may also use these directories in whatever way you see
6994fit. For example, you might use them to access modules shared over a
6995company-wide network.
6996
6997The default answer should be fine for most people.
6998This causes further questions about vendor add-ons to be skipped
6999and no vendor-specific directories will be configured for perl.
7000
7001EOM
7002rp='Do you want to configure vendor-specific add-on directories?'
7003case "$usevendorprefix" in
7004define|true|[yY]*) dflt=y ;;
7005*) : User may have set vendorprefix directly on Configure command line.
7006 case "$vendorprefix" in
7007 ''|' ') dflt=n ;;
7008 *) dflt=y ;;
7009 esac
7010 ;;
7011esac
7012. ./myread
7013case "$ans" in
7014[yY]*) fn=d~+
7015 rp='Installation prefix to use for vendor-supplied add-ons?'
7016 case "$vendorprefix" in
7017 '') dflt='' ;;
7018 *) dflt=$vendorprefix ;;
7019 esac
7020 . ./getfile
7021 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7022 oldvendorprefix=''
7023 case "$vendorprefix" in
7024 '') ;;
7025 *) case "$ans" in
7026 "$prefix") ;;
7027 *) oldvendorprefix="$prefix";;
7028 esac
7029 ;;
7030 esac
7031 usevendorprefix="$define"
7032 vendorprefix="$ans"
7033 vendorprefixexp="$ansexp"
7034 ;;
7035*) usevendorprefix="$undef"
7036 vendorprefix=''
7037 vendorprefixexp=''
7038 ;;
7039esac
7040
7041case "$vendorprefix" in
7042'') d_vendorlib="$undef"
7043 vendorlib=''
7044 vendorlibexp=''
7045 ;;
7046*) d_vendorlib="$define"
7047 : determine where vendor-supplied modules go.
7048 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7049 case "$vendorlib" in
7050 '')
7051 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7052 case "$installstyle" in
7053 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7054 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7055 esac
7056 ;;
7057 *) dflt="$vendorlib"
7058 ;;
7059 esac
7060 fn=d~+
7061 rp='Pathname for the vendor-supplied library files?'
7062 . ./getfile
7063 vendorlib="$ans"
7064 vendorlibexp="$ansexp"
7065 ;;
7066esac
7067vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7068: Change installation prefix, if necessary.
7069if $test X"$prefix" != X"$installprefix"; then
7070 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7071else
7072 installvendorlib="$vendorlibexp"
7073fi
7074
7075case "$vendorprefix" in
7076'') d_vendorarch="$undef"
7077 vendorarch=''
7078 vendorarchexp=''
7079 ;;
7080*) d_vendorarch="$define"
7081 : determine where vendor-supplied architecture-dependent libraries go.
7082 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7083 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7084 : vendorlib may have an optional trailing /share.
7085 case "$vendorarch" in
7086 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7087 dflt="$dflt/$archname"
7088 ;;
7089 *) dflt="$vendorarch" ;;
7090 esac
7091 fn=d~+
7092 rp='Pathname for vendor-supplied architecture-dependent files?'
7093 . ./getfile
7094 vendorarch="$ans"
7095 vendorarchexp="$ansexp"
7096 ;;
7097esac
7098: Change installation prefix, if necessary.
7099if $test X"$prefix" != X"$installprefix"; then
7100 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7101else
7102 installvendorarch="$vendorarchexp"
7103fi
7104
7105: Final catch-all directories to search
7106$cat <<EOM
7107
7108Lastly, you can have perl look in other directories for extensions and
7109modules in addition to those already specified.
7110These directories will be searched after
7111 $sitearch
7112 $sitelib
7113EOM
7114test X"$vendorlib" != "X" && echo ' ' $vendorlib
7115test X"$vendorarch" != "X" && echo ' ' $vendorarch
7116echo ' '
7117case "$otherlibdirs" in
7118''|' ') dflt='none' ;;
7119*) dflt="$otherlibdirs" ;;
7120esac
7121$cat <<EOM
7122Enter a colon-separated set of extra paths to include in perl's @INC
7123search path, or enter 'none' for no extra paths.
7124
7125EOM
7126
7127rp='Colon-separated list of additional directories for perl to search?'
7128. ./myread
7129case "$ans" in
7130' '|''|none) otherlibdirs=' ' ;;
7131*) otherlibdirs="$ans" ;;
7132esac
7133case "$otherlibdirs" in
7134' ') val=$undef ;;
7135*) val=$define ;;
7136esac
7137set d_perl_otherlibdirs
7138eval $setvar
7139
7140: Cruising for prototypes
7141echo " "
7142echo "Checking out function prototypes..." >&4
7143$cat >prototype.c <<'EOCP'
7144int main(int argc, char *argv[]) {
7145 exit(0);}
7146EOCP
7147if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7148 echo "Your C compiler appears to support function prototypes."
7149 val="$define"
7150else
7151 echo "Your C compiler doesn't seem to understand function prototypes."
7152 val="$undef"
7153fi
7154set prototype
7155eval $setvar
7156$rm -f prototype*
7157
7158case "$prototype" in
7159"$define") ;;
7160*) ansi2knr='ansi2knr'
7161 echo " "
7162 cat <<EOM >&4
7163
7164$me: FATAL ERROR:
7165This version of $package can only be compiled by a compiler that
7166understands function prototypes. Unfortunately, your C compiler
7167 $cc $ccflags
7168doesn't seem to understand them. Sorry about that.
7169
7170If GNU cc is available for your system, perhaps you could try that instead.
7171
7172Eventually, we hope to support building Perl with pre-ANSI compilers.
7173If you would like to help in that effort, please contact <perlbug@perl.org>.
7174
7175Aborting Configure now.
7176EOM
7177 exit 2
7178 ;;
7179esac
7180
7181: determine where public executables go
7182echo " "
7183set dflt bin bin
7184eval $prefixit
7185fn=d~
7186rp='Pathname where the public executables will reside?'
7187. ./getfile
7188if $test "X$ansexp" != "X$binexp"; then
7189 installbin=''
7190fi
7191bin="$ans"
7192binexp="$ansexp"
7193: Change installation prefix, if necessary.
7194: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7195if $test X"$prefix" != X"$installprefix"; then
7196 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7197else
7198 installbin="$binexp"
7199fi
7200
6fcddf3b 7201echo " "
6fcddf3b 7202case "$extras" in
bf35c3f6
JH
7203'') dflt='n';;
7204*) dflt='y';;
6fcddf3b
JH
7205esac
7206cat <<EOM
7207Perl can be built with extra modules or bundles of modules which
7208will be fetched from the CPAN and installed alongside Perl.
7209
7210Notice that you will need access to the CPAN; either via the Internet,
7211or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7212be asked later to configure the CPAN.pm module which will in turn do
7213the installation of the rest of the extra modules or bundles.)
7214
7215Notice also that if the modules require any external software such as
dd2de242
JH
7216libraries and headers (the libz library and the zlib.h header for the
7217Compress::Zlib module, for example) you MUST have any such software
7218already installed, this configuration process will NOT install such
7219things for you.
6fcddf3b
JH
7220
7221If this doesn't make any sense to you, just accept the default '$dflt'.
7222EOM
dd2de242 7223rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7224. ./myread
7225case "$ans" in
7226y|Y)
7227 cat <<EOM
7228
7229Please list any extra modules or bundles to be installed from CPAN,
7230with spaces between the names. The names can be in any format the
dd2de242
JH
7231'install' command of CPAN.pm will understand. (Answer 'none',
7232without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7233EOM
7234 rp='Extras?'
7235 dflt="$extras"
7236 . ./myread
7237 extras="$ans"
7238esac
7239case "$extras" in
7240''|'none')
7241 val=''
7242 $rm -f ../extras.lst
7243 ;;
7244*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7245 echo "$extras" > ../extras.lst
7246 val="'$extras'"
6fcddf3b
JH
7247 ;;
7248esac
7249set extras
7250eval $setvar
7251echo " "
7252
b4eb6b3d
JH
7253: Find perl5.005 or later.
7254echo "Looking for a previously installed perl5.005 or later... "
7255case "$perl5" in
a938a3bb 7256'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 7257 : Check if this perl is recent and can load a simple module
a938a3bb 7258 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
7259 perl5=$tdir/perl
7260 break;
a938a3bb
IZ
7261 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7262 perl5=$tdir/perl5
b4eb6b3d
JH
7263 break;
7264 fi
7265 done
7266 ;;
7267*) perl5="$perl5"
7268 ;;
7269esac
7270case "$perl5" in
7271'') echo "None found. That's ok.";;
7272*) echo "Using $perl5." ;;
7273esac
7274
7275: Determine list of previous versions to include in @INC
7276$cat > getverlist <<EOPL
7277#!$perl5 -w
7278use File::Basename;
7279\$api_versionstring = "$api_versionstring";
7280\$version = "$version";
7281\$stem = "$sitelib_stem";
7282\$archname = "$archname";
7283EOPL
7284 $cat >> getverlist <<'EOPL'
7285# Can't have leading @ because metaconfig interprets it as a command!
7286;@inc_version_list=();
7287# XXX Redo to do opendir/readdir?
7288if (-d $stem) {
7289 chdir($stem);
7290 ;@candidates = glob("5.*");
7291}
7292else {
7293 ;@candidates = ();
7294}
7295
7296# XXX ToDo: These comparisons must be reworked when two-digit
7297# subversions come along, so that 5.7.10 compares as greater than
7298# 5.7.3! By that time, hope that 5.6.x is sufficiently
7299# widespread that we can use the built-in version vectors rather
7300# than reinventing them here. For 5.6.0, however, we must
7301# assume this script will likely be run by 5.005_0x. --AD 1/2000.
7302foreach $d (@candidates) {
7303 if ($d lt $version) {
7304 if ($d ge $api_versionstring) {
7305 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7306 }
7307 elsif ($d ge "5.005") {
7308 unshift(@inc_version_list, grep { -d } $d);
7309 }
7310 }
7311 else {
7312 # Skip newer version. I.e. don't look in
7313 # 5.7.0 if we're installing 5.6.1.
7314 }
7315}
7316
7317if (@inc_version_list) {
7318 print join(' ', @inc_version_list);
7319}
7320else {
7321 # Blank space to preserve value for next Configure run.
7322 print " ";
7323}
7324EOPL
7325chmod +x getverlist
7326case "$inc_version_list" in
a938a3bb 7327'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
7328 dflt=`$perl5 getverlist`
7329 else
7330 dflt='none'
7331 fi
7332 ;;
7333$undef) dflt='none' ;;
6d1a7737 7334*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
7335esac
7336case "$dflt" in
7337''|' ') dflt=none ;;
7338esac
7339case "$dflt" in
73405.005) case "$bincompat5005" in
7341 $define|true|[yY]*) ;;
7342 *) dflt=none ;;
7343 esac
7344 ;;
7345esac
7346$cat <<'EOM'
7347
7348In order to ease the process of upgrading, this version of perl
7349can be configured to use modules built and installed with earlier
7350versions of perl that were installed under $prefix. Specify here
7351the list of earlier versions that this version of perl should check.
7352If Configure detected no earlier versions of perl installed under
7353$prefix, then the list will be empty. Answer 'none' to tell perl
7354to not search earlier versions.
7355
7356The default should almost always be sensible, so if you're not sure,
7357just accept the default.
7358EOM
7359
7360rp='List of earlier versions to include in @INC?'
7361. ./myread
7362case "$ans" in
7363[Nn]one|''|' ') inc_version_list=' ' ;;
7364*) inc_version_list="$ans" ;;
7365esac
7366case "$inc_version_list" in
7367''|' ')
7368 inc_version_list_init='0';;
7369*) inc_version_list_init=`echo $inc_version_list |
7370 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7371 ;;
7372esac
7373$rm -f getverlist
7374
7375: determine whether to install perl also as /usr/bin/perl
7376
7377echo " "
7378if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7379 $cat <<EOM
7380Many scripts expect perl to be installed as /usr/bin/perl.
7381I can install the perl you are about to compile also as /usr/bin/perl
7382(in addition to $installbin/perl).
7383EOM
7384 case "$installusrbinperl" in
7385 "$undef"|[nN]*) dflt='n';;
7386 *) dflt='y';;
7387 esac
7388 rp="Do you want to install perl as /usr/bin/perl?"
7389 . ./myread
7390 case "$ans" in
7391 [yY]*) val="$define";;
7392 *) val="$undef" ;;
7393 esac
7394else
7395 val="$undef"
7396fi
7397set installusrbinperl
7398eval $setvar
7399
7400: see if dld is available
7401set dld.h i_dld
7402eval $inhdr
7403
7404: see if dlopen exists
7405xxx_runnm="$runnm"
7406runnm=false
7407set dlopen d_dlopen
7408eval $inlibc
7409runnm="$xxx_runnm"
7410
7411: determine which dynamic loading, if any, to compile in
7412echo " "
7413dldir="ext/DynaLoader"
7414case "$usedl" in
7415$define|y|true)
7416 dflt='y'
7417 usedl="$define"
7418 ;;
7419$undef|n|false)
7420 dflt='n'
7421 usedl="$undef"
7422 ;;
7423*)
7424 dflt='n'
7425 case "$d_dlopen" in
7426 $define) dflt='y' ;;
7427 esac
7428 case "$i_dld" in
7429 $define) dflt='y' ;;
7430 esac
7431 : Does a dl_xxx.xs file exist for this operating system
7432 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7433 ;;
7434esac
7435rp="Do you wish to use dynamic loading?"
7436. ./myread
7437usedl="$ans"
7438case "$ans" in
7439y*) usedl="$define"
7440 case "$dlsrc" in
7441 '')
7442 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7443 dflt="$dldir/dl_${osname}.xs"
7444 elif $test "$d_dlopen" = "$define" ; then
7445 dflt="$dldir/dl_dlopen.xs"
7446 elif $test "$i_dld" = "$define" ; then
7447 dflt="$dldir/dl_dld.xs"
7448 else
7449 dflt=''
7450 fi
7451 ;;
7452 *) dflt="$dldir/$dlsrc"
7453 ;;
7454 esac
7455 echo "The following dynamic loading files are available:"
7456 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7457 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7458 rp="Source file to use for dynamic loading"
7459 fn="fne"
7460 gfpth="$src"
7461 . ./getfile
7462 usedl="$define"
7463 : emulate basename
7464 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7465
7466 $cat << EOM
7467
7468Some systems may require passing special flags to $cc -c to
7469compile modules that will be used to create a shared library.
7470To use no flags, say "none".
7471
7472EOM
7473 case "$cccdlflags" in
7474 '') case "$gccversion" in
7475 '') case "$osname" in
7476 hpux) dflt='+z' ;;
7477 next) dflt='none' ;;
7478 irix*) dflt='-KPIC' ;;
48bcfe03 7479 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7480 sunos) dflt='-pic' ;;
7481 *) dflt='none' ;;
7482 esac
7483 ;;
7484 *) case "$osname" in
b6cc0f4c 7485 darwin) dflt='none' ;;
48bcfe03 7486 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7487 *) dflt='-fpic' ;;
7488 esac ;;
7489 esac ;;
7490 ' ') dflt='none' ;;
7491 *) dflt="$cccdlflags" ;;
7492 esac
7493 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7494 . ./myread
7495 case "$ans" in
7496 none) cccdlflags=' ' ;;
7497 *) cccdlflags="$ans" ;;
7498 esac
7499
7500 cat << EOM
7501
7502Some systems use ld to create libraries that can be dynamically loaded,
7503while other systems (such as those using ELF) use $cc.
7504
7505EOM
7506 case "$ld" in
7507 '') $cat >try.c <<'EOM'
7508/* Test for whether ELF binaries are produced */
7509#include <fcntl.h>
7510#include <stdlib.h>
7511int main() {
7512 char b[4];
7513 int i = open("a.out",O_RDONLY);
7514 if(i == -1)
7515 exit(1); /* fail */
7516 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7517 exit(0); /* succeed (yes, it's ELF) */
7518 else
7519 exit(1); /* fail */
7520}
7521EOM
5440bc8e 7522 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7523 cat <<EOM
7524You appear to have ELF support. I'll use $cc to build dynamic libraries.
7525EOM
7526 dflt="$cc"
7527 else
7528 echo "I'll use ld to build dynamic libraries."
7529 dflt='ld'
7530 fi
7531 rm -f try.c a.out
7532 ;;
7533 *) dflt="$ld"
7534 ;;
7535 esac
7536
7537 rp="What command should be used to create dynamic libraries?"
7538 . ./myread
7539 ld="$ans"
7540
7541 cat << EOM
7542
7543Some systems may require passing special flags to $ld to create a
7544library that can be dynamically loaded. If your ld flags include
7545-L/other/path options to locate libraries outside your loader's normal
7546search path, you may need to specify those -L options here as well. To
7547use no flags, say "none".
7548
7549EOM
7550 case "$lddlflags" in
7551 '') case "$osname" in
7552 beos) dflt='-nostart' ;;
7553 hpux) dflt='-b';
7554 case "$gccversion" in
7555 '') dflt="$dflt +vnocompatwarnings" ;;
7556 esac
7557 ;;
7558 linux|irix*) dflt='-shared' ;;
7559 next) dflt='none' ;;
7560 solaris) dflt='-G' ;;
7561 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7562 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7563 *) dflt='none' ;;
7564 esac
7565 ;;
7566 *) dflt="$lddlflags" ;;
7567 esac
7568
7569 : Try to guess additional flags to pick up local libraries.
7570 : Be careful not to append to a plain 'none'
7571 case "$dflt" in
7572 none) dflt='' ;;
7573 esac
7574 for thisflag in $ldflags; do
7575 case "$thisflag" in
b5b9f165 7576 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7577 case " $dflt " in
7578 *" $thisflag "*) ;;
7579 *) dflt="$dflt $thisflag" ;;
7580 esac
7581 ;;
7582 esac
7583 done
7584
7585 case "$dflt" in
7586 ''|' ') dflt='none' ;;
7587 esac
7588
7589 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7590 . ./myread
7591 case "$ans" in
7592 none) lddlflags=' ' ;;
7593 *) lddlflags="$ans" ;;
7594 esac
7595
7596 cat <<EOM
7597
7598Some systems may require passing special flags to $cc to indicate that
7599the resulting executable will use dynamic linking. To use no flags,
7600say "none".
7601
7602EOM
7603 case "$ccdlflags" in
7604 '') case "$osname" in
7605 hpux) dflt='-Wl,-E' ;;
7606 linux) dflt='-rdynamic' ;;
7607 next) dflt='none' ;;
7608 sunos) dflt='none' ;;
7609 *) dflt='none' ;;
7610 esac ;;
7611 ' ') dflt='none' ;;
7612 *) dflt="$ccdlflags" ;;
7613 esac
7614 rp="Any special flags to pass to $cc to use dynamic linking?"
7615 . ./myread
7616 case "$ans" in
7617 none) ccdlflags=' ' ;;
7618 *) ccdlflags="$ans" ;;
7619 esac
7620 ;;
7621*) usedl="$undef"
7622 ld='ld'
7623 dlsrc='dl_none.xs'
7624 lddlflags=''
7625 ccdlflags=''
7626 ;;
7627esac
7628
7629also=''
7630case "$usedl" in
7631$undef)
7632 # No dynamic loading being used, so don't bother even to prompt.
7633 useshrplib='false'
7634 ;;
7635*) case "$useshrplib" in
7636 '') case "$osname" in
48bcfe03 7637 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7638 dflt=y
7639 also='Building a shared libperl is required for dynamic loading to work on your system.'
7640 ;;
7641 next*)
7642 case "$osvers" in
7643 4*) dflt=y
7644 also='Building a shared libperl is needed for MAB support.'
7645 ;;
7646 *) dflt=n
7647 ;;
7648 esac
7649 ;;
7650 *) dflt=n
7651 ;;
7652 esac
7653 ;;
7654 $define|true|[Yy]*)
7655 dflt=y
7656 ;;
7657 *) dflt=n
7658 ;;
7659 esac
7660 $cat << EOM
7661
7662The perl executable is normally obtained by linking perlmain.c with
7663libperl${_a}, any static extensions (usually just DynaLoader), and
7664any other libraries needed on this system (such as -lm, etc.). Since
7665your system supports dynamic loading, it is probably possible to build
7666a shared libperl.$so. If you will have more than one executable linked
7667to libperl.$so, this will significantly reduce the size of each
7668executable, but it may have a noticeable affect on performance. The
7669default is probably sensible for your system.
7670$also
7671
7672EOM
7673 rp="Build a shared libperl.$so (y/n)"
7674 . ./myread
7675 case "$ans" in
7676 true|$define|[Yy]*)
7677 useshrplib='true' ;;
7678 *) useshrplib='false' ;;
7679 esac
7680 ;;
7681esac
7682
7683case "$useshrplib" in
7684true)
7685 case "$libperl" in
7686 '')
7687 # Figure out a good name for libperl.so. Since it gets stored in
7688 # a version-specific architecture-dependent library, the version
7689 # number isn't really that important, except for making cc/ld happy.
7690 #
7691 # A name such as libperl.so.3.1
7692 majmin="libperl.$so.$patchlevel.$subversion"
7693 # A name such as libperl.so.301
7694 majonly=`echo $patchlevel $subversion |
7695 $awk '{printf "%d%02d", $1, $2}'`
7696 majonly=libperl.$so.$majonly
7697 # I'd prefer to keep the os-specific stuff here to a minimum, and
7698 # rely on figuring it out from the naming of libc.
7699 case "${osname}${osvers}" in
7700 next4*)
7701 dflt=libperl.5.$so
7702 # XXX How handle the --version stuff for MAB?
7703 ;;
7704 linux*) # ld won't link with a bare -lperl otherwise.
7705 dflt=libperl.$so
7706 ;;
b53432e4
GH
7707 cygwin*) # ld links against an importlib
7708 dflt=libperl$lib_ext
b4eb6b3d
JH
7709 ;;
7710 *) # Try to guess based on whether libc has major.minor.
7711 case "$libc" in
7712 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7713 *libc.$so.[0-9]*) dflt=$majonly ;;
7714 *) dflt=libperl.$so ;;
7715 esac
7716 ;;
7717 esac
7718 ;;
7719 *) dflt=$libperl
7720 ;;
7721 esac
7722 cat << EOM
7723
7724I need to select a good name for the shared libperl. If your system uses
7725library names with major and minor numbers, then you might want something
7726like $majmin. Alternatively, if your system uses a single version
7727number for shared libraries, then you might want to use $majonly.
7728Or, your system might be quite happy with a simple libperl.$so.
7729
7730Since the shared libperl will get installed into a version-specific
7731architecture-dependent directory, the version number of the shared perl
7732library probably isn't important, so the default should be o.k.
7733
7734EOM
7735 rp='What name do you want to give to the shared libperl?'
7736 . ./myread
7737 libperl=$ans
7738 echo "Ok, I'll use $libperl"
7739 ;;
7740*)
7741 libperl="libperl${_a}"
7742 ;;
7743esac
7744
7745# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7746case "$shrpdir" in
7747'') ;;
7748*) $cat >&4 <<EOM
7749WARNING: Use of the shrpdir variable for the installation location of
7750the shared $libperl is not supported. It was never documented and
7751will not work in this version. Let me (perlbug@perl.org)
7752know of any problems this may cause.
7753
7754EOM
7755 case "$shrpdir" in
7756 "$archlibexp/CORE")
7757 $cat >&4 <<EOM
7758But your current setting of $shrpdir is
7759the default anyway, so it's harmless.
7760EOM
7761 ;;
7762 *)
7763 $cat >&4 <<EOM
7764Further, your current attempted setting of $shrpdir
7765conflicts with the value of $archlibexp/CORE
7766that installperl will use.
7767EOM
7768 ;;
7769 esac
7770 ;;
7771esac
7772
7773# How will the perl executable find the installed shared $libperl?
7774# Add $xxx to ccdlflags.
7775# If we can't figure out a command-line option, use $shrpenv to
7776# set env LD_RUN_PATH. The main perl makefile uses this.
7777shrpdir=$archlibexp/CORE
7778xxx=''
7779tmp_shrpenv=''
7780if "$useshrplib"; then
7781 case "$osname" in
7782 aix)
7783 # We'll set it in Makefile.SH...
7784 ;;
b5b9f165 7785 solaris)
b4eb6b3d
JH
7786 xxx="-R $shrpdir"
7787 ;;
b5b9f165 7788 freebsd|netbsd)
b4eb6b3d
JH
7789 xxx="-Wl,-R$shrpdir"
7790 ;;
6b20d41b 7791 bsdos|linux|irix*|dec_osf)
b4eb6b3d
JH
7792 xxx="-Wl,-rpath,$shrpdir"
7793 ;;
7794 next)
7795 # next doesn't like the default...
7796 ;;
7797 beos)
7798 # beos doesn't like the default, either.
7799 ;;
7800 hpux*)
7801 # hpux doesn't like the default, either.
7802 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7803 ;;
7804 *)
7805 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7806 ;;
7807 esac
7808 case "$xxx" in
7809 '') ;;
7810 *)
7811 # Only add $xxx if it isn't already in ccdlflags.
7812 case " $ccdlflags " in
7813 *" $xxx "*) ;;
7814 *) ccdlflags="$ccdlflags $xxx"
7815 cat <<EOM >&4
7816
7817Adding $xxx to the flags
7818passed to $ld so that the perl executable will find the
7819installed shared $libperl.
7820
7821EOM
7822 ;;
7823 esac
7824 ;;
7825 esac
7826fi
7827# Fix ccdlflags in AIX for building external extensions.
7828# (For building Perl itself bare -bE:perl.exp is needed,
7829# Makefile.SH takes care of this.)
7830case "$osname" in
7831aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7832esac
7833# Respect a hint or command-line value.
7834case "$shrpenv" in
7835'') shrpenv="$tmp_shrpenv" ;;
7836esac
7837case "$ldlibpthname" in
7838'') ldlibpthname=LD_LIBRARY_PATH ;;
7839none) ldlibpthname='' ;;
7840esac
7841
7842: determine where manual pages are on this system
7843echo " "
7844case "$sysman" in
7845'')
4a0a3829
SD
7846 syspath='/usr/share/man/man1 /usr/man/man1'
7847 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7848 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7849 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7850 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7851 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7852 sysman=`./loc . /usr/man/man1 $syspath`
7853 ;;
7854esac
7855if $test -d "$sysman"; then
7856 echo "System manual is in $sysman." >&4
7857else
7858 echo "Could not find manual pages in source form." >&4
7859fi
7860
7861: determine where manual pages go
7862set man1dir man1dir none
7863eval $prefixit
7864$cat <<EOM
7865
7866$spackage has manual pages available in source form.
7867EOM
7868case "$nroff" in
7869nroff)
7870 echo "However, you don't have nroff, so they're probably useless to you."
7871 case "$man1dir" in
7872 '') man1dir="none";;
7873 esac;;
7874esac
7875echo "If you don't want the manual sources installed, answer 'none'."
7876case "$man1dir" in
7877' ') dflt=none
7878 ;;
7879'')
4a0a3829
SD
7880 lookpath="$prefixexp/share/man/man1"
7881 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7882 lookpath="$lookpath $prefixexp/man/p_man/man1"
7883 lookpath="$lookpath $prefixexp/man/u_man/man1"
7884 lookpath="$lookpath $prefixexp/man/man.1"
7885 case "$sysman" in
7886 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7887 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7888 esac
7889 set dflt
7890 eval $prefixup
7891 ;;
7892*) dflt="$man1dir"
7893 ;;
7894esac
7895echo " "
7896fn=dn+~
7897rp="Where do the main $spackage manual pages (source) go?"
7898. ./getfile
7899if $test "X$man1direxp" != "X$ansexp"; then
7900 installman1dir=''
7901fi
7902man1dir="$ans"
7903man1direxp="$ansexp"
7904case "$man1dir" in
7905'') man1dir=' '
7906 installman1dir='';;
7907esac
7908
7909: Change installation prefix, if necessary.
7910if $test X"$prefix" != X"$installprefix"; then
7911 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7912else
7913 installman1dir="$man1direxp"
7914fi
7915
7916: What suffix to use on installed man pages
7917
7918case "$man1dir" in
7919' ')
7920 man1ext='0'
7921 ;;
7922*)
7923 rp="What suffix should be used for the main $spackage man pages?"
7924 case "$man1ext" in
7925 '') case "$man1dir" in
7926 *1) dflt=1 ;;
7927 *1p) dflt=1p ;;
7928 *1pm) dflt=1pm ;;
7929 *l) dflt=l;;
7930 *n) dflt=n;;
7931 *o) dflt=o;;
7932 *p) dflt=p;;
7933 *C) dflt=C;;
7934 *L) dflt=L;;
7935 *L1) dflt=L1;;
7936 *) dflt=1;;
7937 esac
7938 ;;
7939 *) dflt="$man1ext";;
7940 esac
7941 . ./myread
7942 man1ext="$ans"
7943 ;;
7944esac
7945
7946: see if we can have long filenames
7947echo " "
7948first=123456789abcdef
7949$rm -f $first
7950if (echo hi >$first) 2>/dev/null; then
7951 if $test -f 123456789abcde; then
7952 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7953 val="$undef"
7954 else
7955 echo 'You can have filenames longer than 14 characters.'>&4
7956 val="$define"
7957 fi
7958else
7959 $cat <<'EOM'
7960You can't have filenames longer than 14 chars.
7961You can't even think about them!
7962EOM
7963 val="$undef"
7964fi
7965set d_flexfnam
7966eval $setvar
7967$rm -rf 123456789abcde*
7968
7969: determine where library module manual pages go
7970set man3dir man3dir none
7971eval $prefixit
7972$cat <<EOM
7973
7974$spackage has manual pages for many of the library modules.
7975EOM
7976
7977case "$nroff" in
7978nroff)
7979 $cat <<'EOM'
7980However, you don't have nroff, so they're probably useless to you.
7981EOM
7982 case "$man3dir" in
7983 '') man3dir="none";;
7984 esac;;
7985esac
7986
7987case "$d_flexfnam" in
7988undef)
7989 $cat <<'EOM'
7990However, your system can't handle the long file names like File::Basename.3.
7991EOM
7992 case "$man3dir" in
7993 '') man3dir="none";;
7994 esac;;
7995esac
7996
7997echo "If you don't want the manual sources installed, answer 'none'."
7998prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7999case "$man3dir" in
8000'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8001 if $test -d "$privlib/man/man3"; then
8002 cat <<EOM >&4
8003
8004WARNING: Previous versions of perl installed man3 pages into
8005$privlib/man/man3. This version will suggest a
8006new default of $dflt.
8007EOM
8008 tdflt=$dflt
8009 dflt='n'
8010 rp='Do you wish to preserve the old behavior?(y/n)'
8011 . ./myread
8012 case "$ans" in
8013 y*) dflt="$privlib/man/man3" ;;
8014 *) dflt=$tdflt ;;
8015 esac
8016 fi
8017 ;;
8018*) dflt="$man3dir" ;;
8019esac
8020case "$dflt" in
8021' ') dflt=none ;;
8022esac
8023echo " "
8024fn=dn+~
8025rp="Where do the $package library man pages (source) go?"
8026. ./getfile
8027man3dir="$ans"
8028man3direxp="$ansexp"
8029case "$man3dir" in
8030'') man3dir=' '
8031 installman3dir='';;
8032esac
8033
8034: Change installation prefix, if necessary.
8035if $test X"$prefix" != X"$installprefix"; then
8036 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8037else
8038 installman3dir="$man3direxp"
8039fi
8040
8041: What suffix to use on installed man pages
8042case "$man3dir" in
8043' ')
8044 man3ext='0'
8045 ;;
8046*)
8047 rp="What suffix should be used for the $package library man pages?"
8048 case "$man3ext" in
8049 '') case "$man3dir" in
8050 *3) dflt=3 ;;
8051 *3p) dflt=3p ;;
8052 *3pm) dflt=3pm ;;
8053 *l) dflt=l;;
8054 *n) dflt=n;;
8055 *o) dflt=o;;
8056 *p) dflt=p;;
8057 *C) dflt=C;;
8058 *L) dflt=L;;
8059 *L3) dflt=L3;;
8060 *) dflt=3;;
8061 esac
8062 ;;
8063 *) dflt="$man3ext";;
8064 esac
8065 . ./myread
8066 man3ext="$ans"
8067 ;;
8068esac
8069
8070: see if we have to deal with yellow pages, now NIS.
0384a54a 8071if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8072 if $test -f /usr/etc/nibindd; then
8073 echo " "
8074 echo "I'm fairly confident you're on a NeXT."
8075 echo " "
8076 rp='Do you get the hosts file via NetInfo?'
8077 dflt=y
8078 case "$hostcat" in
8079 nidump*) ;;
8080 '') ;;
8081 *) dflt=n;;
8082 esac
8083 . ./myread
8084 case "$ans" in
8085 y*) hostcat='nidump hosts .';;
8086 *) case "$hostcat" in
8087 nidump*) hostcat='';;
8088 esac
8089 ;;
8090 esac
8091 fi
8092 case "$hostcat" in
8093 nidump*) ;;
8094 *)
8095 case "$hostcat" in
8096 *ypcat*) dflt=y;;
8097 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8098 dflt=y
8099 else
8100 dflt=n
8101 fi;;
8102 *) dflt=n;;
8103 esac
8104 echo " "
8105 rp='Are you getting the hosts file via yellow pages?'
8106 . ./myread
8107 case "$ans" in
8108 y*) hostcat='ypcat hosts';;
8109 *) hostcat='cat /etc/hosts';;
8110 esac
8111 ;;
8112 esac
8113fi
8114case "$hostcat" in
8115'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8116esac
8117case "$groupcat" in
8118'') test -f /etc/group && groupcat='cat /etc/group';;
8119esac
8120case "$passcat" in
8121'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8122esac
8123
8124: now get the host name
8125echo " "
8126echo "Figuring out host name..." >&4
8127case "$myhostname" in
8128'') cont=true
8129 echo 'Maybe "hostname" will work...'
73614538 8130 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8131 myhostname=$tans
8132 phostname=hostname
8133 cont=''
8134 fi
8135 ;;
8136*) cont='';;
8137esac
8138if $test "$cont"; then
8139 if ./xenix; then
8140 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8141 if tans=`cat /etc/systemid 2>&1` ; then
8142 myhostname=$tans
8143 phostname='cat /etc/systemid'
8144 echo "Whadyaknow. Xenix always was a bit strange..."
8145 cont=''
8146 fi
8147 elif $test -r /etc/systemid; then
8148 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8149 fi
8150fi
8151if $test "$cont"; then
8152 echo 'No, maybe "uuname -l" will work...'
73614538 8153 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8154 myhostname=$tans
8155 phostname='uuname -l'
8156 else
8157 echo 'Strange. Maybe "uname -n" will work...'
73614538 8158 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8159 myhostname=$tans
8160 phostname='uname -n'
8161 else
8162 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8163 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8164 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8165 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8166 else
8167 case "$myhostname" in
8168 '') echo "Does this machine have an identity crisis or something?"
8169 phostname='';;
8170 *)
8171 echo "Well, you said $myhostname before..."
8172 phostname='echo $myhostname';;
8173 esac
8174 fi
8175 fi
8176 fi
8177fi
52a549d0
JH
8178case "$myhostname" in
8179'') myhostname=noname ;;
8180esac
b4eb6b3d
JH
8181: you do not want to know about this
8182set $myhostname
8183myhostname=$1
8184
8185: verify guess
8186if $test "$myhostname" ; then
8187 dflt=y
8188 rp='Your host name appears to be "'$myhostname'".'" Right?"
8189 . ./myread
8190 case "$ans" in
8191 y*) ;;
8192 *) myhostname='';;
8193 esac
8194fi
8195
8196: bad guess or no guess
8197while $test "X$myhostname" = X ; do
8198 dflt=''
8199 rp="Please type the (one word) name of your host:"
8200 . ./myread
8201 myhostname="$ans"
8202done
8203
8204: translate upper to lower if necessary
8205case "$myhostname" in
8206*[A-Z]*)
8207 echo "(Normalizing case in your host name)"
8208 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8209 ;;
8210esac
8211
8212case "$myhostname" in
8213*.*)
8214 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8215 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8216 echo "(Trimming domain name from host name--host name is now $myhostname)"
8217 ;;
8218*) case "$mydomain" in
8219 '')
8220 {
8221 test "X$hostcat" = "Xypcat hosts" &&
8222 ypmatch "$myhostname" hosts 2>/dev/null |\
8223 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8224 $test -s hosts
8225 } || {
8226 test "X$hostcat" != "X" &&
8227 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8228 /[ ]$myhostname[ . ]/p" > hosts
8229 }
8230 tmp_re="[ . ]"
f08cbdd1
PP
8231 if $test -f hosts; then
8232 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8233 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8234 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8235 hosts | $sort | $uniq | \
8236 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8237 case `$echo X$dflt` in
8238 X*\ *) echo "(Several hosts in the database matched hostname)"
8239 dflt=.
8240 ;;
8241 X.) echo "(You do not have fully-qualified names in the hosts database)"
8242 ;;
8243 esac
8244 else
8245 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8246 dflt=.
f08cbdd1 8247 fi
b4eb6b3d
JH
8248 case "$dflt" in
8249 .)
8250 tans=`./loc resolv.conf X /etc /usr/etc`
8251 if $test -f "$tans"; then
8252 echo "(Attempting domain name extraction from $tans)"
8253 dflt=.`$sed -n -e 's/ / /g' \
8254 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8255 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8256 case "$dflt" in
8257 .) dflt=.`$sed -n -e 's/ / /g' \
8258 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8259 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8260 ;;
8261 esac
8262 fi
8263 ;;
8264 esac
8265 case "$dflt" in
8266 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8267 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8268 case "$dflt" in
8269 '') dflt='.';;
8270 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8271 esac
8272 ;;
8273 esac
59c9e5d6
PP
8274 case "$dflt$osname" in
8275 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8276 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8277 ;;
8278 esac
b4eb6b3d
JH
8279 case "$dflt" in
8280 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8281 dflt='.nonet'
b4eb6b3d
JH
8282 ;;
8283 esac
8284 $rm -f hosts
8285 ;;
8286 *) dflt="$mydomain";;
8287 esac;;
8288esac
8289echo " "
8290rp="What is your domain name?"
8291. ./myread
8292tans="$ans"
8293case "$ans" in
8294'') ;;
8295.*) ;;
8296*) tans=".$tans";;
8297esac
8298mydomain="$tans"
8299
8300: translate upper to lower if necessary
8301case "$mydomain" in
8302*[A-Z]*)
8303 echo "(Normalizing case in your domain name)"
8304 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8305 ;;
8306esac
8307
8308: a little sanity check here
8309case "$phostname" in
8310'') ;;
8311*)
8312 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8313 $myhostname$mydomain|$myhostname) ;;
8314 *)
8315 case "$phostname" in
8316 sed*)
8317 echo "(That doesn't agree with your whoami.h file, by the way.)"
8318 ;;
8319 *)
8320 echo "(That doesn't agree with your $phostname command, by the way.)"
8321 ;;
8322 esac
8323 ;;
8324 esac
8325 ;;
8326esac
8327
8328$cat <<EOM
8329
8330I need to get your e-mail address in Internet format if possible, i.e.
8331something like user@host.domain. Please answer accurately since I have
8332no easy means to double check it. The default value provided below
8333is most probably close to reality but may not be valid from outside
8334your organization...
8335
8336EOM
8337cont=x
8338while test "$cont"; do
8339 case "$cf_email" in
8340 '') dflt="$cf_by@$myhostname$mydomain";;
8341 *) dflt="$cf_email";;
8342 esac
8343 rp='What is your e-mail address?'
8344 . ./myread
8345 cf_email="$ans"
8346 case "$cf_email" in
8347 *@*.*) cont='' ;;
8348 *)
8349 rp='Address does not look like an Internet one. Use it anyway?'
8350 case "$fastread" in
8351 yes) dflt=y ;;
8352 *) dflt=n ;;
8353 esac
8354 . ./myread
8355 case "$ans" in
8356 y*) cont='' ;;
8357 *) echo " " ;;
8358 esac
8359 ;;
8360 esac
8361done
8362
8363$cat <<EOM
8364
8365If you or somebody else will be maintaining perl at your site, please
8366fill in the correct e-mail address here so that they may be contacted
8367if necessary. Currently, the "perlbug" program included with perl
8368will send mail to this address in addition to perlbug@perl.org. You may
8369enter "none" for no administrator.
8370
8371EOM
8372case "$perladmin" in
8373'') dflt="$cf_email";;
8374*) dflt="$perladmin";;
8375esac
8376rp='Perl administrator e-mail address'
8377. ./myread
8378perladmin="$ans"
8379
674912d7
RB
8380: determine whether to only install version-specific parts.
8381echo " "
8382$cat <<EOM
8383Do you want to install only the version-specific parts of the perl
8384distribution? Usually you do *not* want to do this.
8385EOM
8386case "$versiononly" in
8387"$define"|[Yy]*|true) dflt='y' ;;
8388*) dflt='n';
8389esac
8390rp="Do you want to install only the version-specific parts of perl?"
8391. ./myread
8392case "$ans" in
8393[yY]*) val="$define";;
8394*) val="$undef" ;;
8395esac
8396set versiononly
8397eval $setvar
8398
ad493445
MB
8399case "$versiononly" in
8400"$define") inc_version_list=''
8401 inc_version_list_init=0
8402 ;;
8403esac
8404
b4eb6b3d
JH
8405: figure out how to guarantee perl startup
8406case "$startperl" in
8407'')
8408 case "$sharpbang" in
8409 *!)
8410 $cat <<EOH
8411
8412I can use the #! construct to start perl on your system. This will
8413make startup of perl scripts faster, but may cause problems if you
8414want to share those scripts and perl is not in a standard place
8415($binexp/perl) on all your platforms. The alternative is to force
8416a shell by starting the script with a single ':' character.
8417
8418EOH
674912d7
RB
8419 case "$versiononly" in
8420 "$define") dflt="$binexp/perl$version";;
8421 *) dflt="$binexp/perl";;
8422 esac
b4eb6b3d
JH
8423 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8424 . ./myread
8425 case "$ans" in
8426 none) startperl=": # use perl";;
8427 *) startperl="#!$ans"
8428 if $test 30 -lt `echo "$ans" | wc -c`; then
8429 $cat >&4 <<EOM
8430
8431WARNING: Some systems limit the #! command to 32 characters.
8432If you experience difficulty running Perl scripts with #!, try
8433installing Perl in a directory with a shorter pathname.
8434
8435EOM
8436 fi ;;
8437 esac
8438 ;;
8439 *) startperl=": # use perl"
8440 ;;
8441 esac
8442 ;;
8443esac
8444echo "I'll use $startperl to start perl scripts."
8445
8446: figure best path for perl in scripts
8447case "$perlpath" in
8448'')
5e20a8ca
RGS
8449 case "$versiononly" in
8450 "$define") perlpath="$binexp/perl$version";;
8451 *) perlpath="$binexp/perl";;
8452 esac
b4eb6b3d
JH
8453 case "$startperl" in
8454 *!*) ;;
8455 *)
8456 $cat <<EOH
8457
8458I will use the "eval 'exec'" idiom to start Perl on your system.
8459I can use the full path of your Perl binary for this purpose, but
8460doing so may cause problems if you want to share those scripts and
8461Perl is not always in a standard place ($binexp/perl).
8462
8463EOH
8464 dflt="$binexp/perl"
8465 rp="What path shall I use in \"eval 'exec'\"?"
8466 . ./myread
8467 perlpath="$ans"
8468 ;;
8469 esac
8470 ;;
8471esac
8472case "$startperl" in
8473*!*) ;;
8474*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8475esac
8476
8477: determine where public executable scripts go
8478set scriptdir scriptdir
8479eval $prefixit
8480case "$scriptdir" in
8481'')
8482 dflt="$bin"
8483 : guess some guesses
8484 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8485 $test -d /usr/share/bin && dflt=/usr/share/bin
8486 $test -d /usr/local/script && dflt=/usr/local/script
8487 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8488 $test -d $prefixexp/script && dflt=$prefixexp/script
8489 set dflt
8490 eval $prefixup
8491 ;;
8492*) dflt="$scriptdir"
8493 ;;
8494esac
8495$cat <<EOM
8496
8497Some installations have a separate directory just for executable scripts so
8498that they can mount it across multiple architectures but keep the scripts in
8499one spot. You might, for example, have a subdirectory of /usr/share for this.
8500Or you might just lump your scripts in with all your other executables.
8501
8502EOM
8503fn=d~
8504rp='Where do you keep publicly executable scripts?'
8505. ./getfile
8506if $test "X$ansexp" != "X$scriptdirexp"; then
8507 installscript=''
8508fi
8509scriptdir="$ans"
8510scriptdirexp="$ansexp"
8511: Change installation prefix, if necessary.
8512if $test X"$prefix" != X"$installprefix"; then
8513 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8514else
8515 installscript="$scriptdirexp"
8516fi
8517
8518: determine where add-on public executables go
8519case "$sitebin" in
8520'') dflt=$siteprefix/bin ;;
8521*) dflt=$sitebin ;;
8522esac
8523fn=d~
8524rp='Pathname where the add-on public executables should be installed?'
8525. ./getfile
8526sitebin="$ans"
8527sitebinexp="$ansexp"
8528: Change installation prefix, if necessary.
8529if $test X"$prefix" != X"$installprefix"; then
8530 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8531else
8532 installsitebin="$sitebinexp"
8533fi
8534
96056487
JH
8535: define an is-a-typedef? function
8536typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8537case "$inclist" in
8538"") inclist="sys/types.h";;
8539esac;
8540eval "varval=\$$var";
8541case "$varval" in
8542"")
8543 $rm -f temp.c;
8544 for inc in $inclist; do
8545 echo "#include <$inc>" >>temp.c;
8546 done;
8547 echo "#ifdef $type" >> temp.c;
8548 echo "printf(\"We have $type\");" >> temp.c;
8549 echo "#endif" >> temp.c;
8550 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8551 if $contains $type temp.E >/dev/null 2>&1; then
8552 eval "$var=\$type";
8553 else
8554 eval "$var=\$def";
8555 fi;
8556 $rm -f temp.?;;
8557*) eval "$var=\$varval";;
8558esac'
8559
8560: define an is-a-typedef? function that prompts if the type is not available.
8561typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8562case "$inclist" in
8563"") inclist="sys/types.h";;
8564esac;
8565eval "varval=\$$var";
8566case "$varval" in
8567"")
8568 $rm -f temp.c;
8569 for inc in $inclist; do
8570 echo "#include <$inc>" >>temp.c;
8571 done;
8572 echo "#ifdef $type" >> temp.c;
8573 echo "printf(\"We have $type\");" >> temp.c;
8574 echo "#endif" >> temp.c;
8575 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8576 echo " " ;
8577 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8578 if $contains $type temp.E >/dev/null 2>&1; then
8579 echo "$type found." >&4;
8580 eval "$var=\$type";
8581 else
8582 echo "$type NOT found." >&4;
8583 dflt="$def";
8584 . ./myread ;
8585 eval "$var=\$ans";
8586 fi;
8587 $rm -f temp.?;;
8588*) eval "$var=\$varval";;
8589esac'
8590
8591: see what type lseek is declared as in the kernel
8592rp="What is the type used for lseek's offset on this system?"
8593set off_t lseektype long stdio.h sys/types.h
8594eval $typedef_ask
8595
8596echo " "
8597echo "Checking to see how big your file offsets are..." >&4
8598$cat >try.c <<EOCP
8599#include <sys/types.h>
8600#include <stdio.h>
8601int main()
8602{
8603 printf("%d\n", (int)sizeof($lseektype));
8604 return(0);
8605}
8606EOCP
8607set try
8608if eval $compile_ok; then
8609 lseeksize=`$run ./try`
8610 echo "Your file offsets are $lseeksize bytes long."
8611else
8612 dflt=$longsize
8613 echo " "
8614 echo "(I can't seem to compile the test program. Guessing...)"
8615 rp="What is the size of your file offsets (in bytes)?"
8616 . ./myread
8617 lseeksize="$ans"
8618fi
8619$rm -f try.c try
8620
8621: see what type file positions are declared as in the library
8622rp="What is the type for file position used by fsetpos()?"
8623set fpos_t fpostype long stdio.h sys/types.h
8624eval $typedef_ask
8625
8626echo " "
8627case "$fpostype" in
8628*_t) zzz="$fpostype" ;;
8629*) zzz="fpos_t" ;;
8630esac
8631echo "Checking the size of $zzz..." >&4
8632cat > try.c <<EOCP
8633#include <sys/types.h>
8634#include <stdio.h>
8635int main() {
8636 printf("%d\n", (int)sizeof($fpostype));
8637 exit(0);
8638}
8639EOCP
8640set try
8641if eval $compile_ok; then
8642 yyy=`$run ./try`
8643 case "$yyy" in
8644 '') fpossize=4
8645 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8646 ;;
8647 *) fpossize=$yyy
8648 echo "Your $zzz is $fpossize bytes long."
8649 ;;
8650 esac
8651else
8652 dflt="$longsize"
8653 echo " " >&4
8654 echo "(I can't compile the test program. Guessing...)" >&4
8655 rp="What is the size of your file positions (in bytes)?"
8656 . ./myread
8657 fpossize="$ans"
8658fi
8659
8660
8661
8662# Backward compatibility (uselfs is deprecated).
8663case "$uselfs" in
8664"$define"|true|[yY]*)
8665 cat <<EOM >&4
8666
8667*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8668EOM
8669 uselargefiles="$define"
8670 ;;
8671esac
8672
8673case "$lseeksize:$fpossize" in
86748:8) cat <<EOM
8675
8676You can have files larger than 2 gigabytes.
8677EOM
8678 val="$define" ;;
8679*) case "$uselargefiles" in
8680 "$undef"|false|[nN]*) dflt='n' ;;
8681 *) dflt='y' ;;
8682 esac
8683 cat <<EOM
8684
8685Perl can be built to understand large files (files larger than 2 gigabytes)
8686on some systems. To do so, Configure can be run with -Duselargefiles.
8687
8688If this doesn't make any sense to you, just accept the default '$dflt'.
8689EOM
8690 rp='Try to understand large files, if available?'
8691 . ./myread
8692 case "$ans" in
8693 y|Y) val="$define" ;;
8694 *) val="$undef" ;;
8695 esac
8696 ;;
8697esac
8698set uselargefiles
8699eval $setvar
8700case "$uselargefiles" in
8701"$define")
8702: Look for a hint-file generated 'call-back-unit'. If the
8703: user has specified that a large files perl is to be built,
8704: we may need to set or change some other defaults.
8705 if $test -f uselargefiles.cbu; then
8706 echo "Your platform has some specific hints for large file builds, using them..."
8707 . ./uselargefiles.cbu
8708 echo " "
8709 echo "Rechecking to see how big your file offsets are..." >&4
8710 $cat >try.c <<EOCP
8711#include <sys/types.h>
8712#include <stdio.h>
8713int main()
8714{
8715 printf("%d\n", (int)sizeof($lseektype));
8716 return(0);
8717}
8718EOCP
8719 set try
8720 if eval $compile_ok; then
8721 lseeksize=`$run ./try`
8722 $echo "Your file offsets are now $lseeksize bytes long."
8723 else
8724 dflt="$lseeksize"
8725 echo " "
8726 echo "(I can't seem to compile the test program. Guessing...)"
8727 rp="What is the size of your file offsets (in bytes)?"
8728 . ./myread
8729 lseeksize="$ans"
8730 fi
8731 case "$fpostype" in
8732 *_t) zzz="$fpostype" ;;
8733 *) zzz="fpos_t" ;;
8734 esac
8735 $echo $n "Rechecking the size of $zzz...$c" >&4
8736 $cat > try.c <<EOCP
8737#include <sys/types.h>
8738#include <stdio.h>
8739int main() {
8740 printf("%d\n", (int)sizeof($fpostype));
8741 exit(0);
8742}
8743EOCP
8744 set try
8745 if eval $compile_ok; then
8746 yyy=`$run ./try`
8747 dflt="$lseeksize"
8748 case "$yyy" in
8749 '') echo " "
8750 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8751 ;;
8752 *) fpossize=$yyy
8753 echo " $fpossize bytes." >&4
8754 ;;
8755 esac
8756 else
8757 dflt="$fpossize"
8758 echo " "
8759 echo "(I can't compile the test program. Guessing...)" >&4
8760 rp="What is the size of your file positions (in bytes)?"
8761 . ./myread
8762 fpossize="$ans"
8763 fi
8764 $rm -f try.c try
8765 fi
8766 ;;
8767esac
8768
b4eb6b3d
JH
8769case "$vendorprefix" in
8770'') d_vendorbin="$undef"
8771 vendorbin=''
8772 vendorbinexp=''
8773 ;;
8774*) d_vendorbin="$define"
8775 : determine where vendor-supplied executables go.
8776 case "$vendorbin" in
8777 '') dflt=$vendorprefix/bin ;;
8778 *) dflt="$vendorbin" ;;
8779 esac
8780 fn=d~+
8781 rp='Pathname for the vendor-supplied executables directory?'
8782 . ./getfile
8783 vendorbin="$ans"
8784 vendorbinexp="$ansexp"
8785 ;;
8786esac
8787: Change installation prefix, if necessary.
8788if $test X"$prefix" != X"$installprefix"; then
8789 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8790else
8791 installvendorbin="$vendorbinexp"
8792fi
8793
8794: see if qgcvt exists
8795set qgcvt d_qgcvt
8796eval $inlibc
8797
b4eb6b3d 8798: Check how to convert floats to strings.
a5b10d80
YST
8799
8800if test "X$d_Gconvert" = X; then
8801
b4eb6b3d
JH
8802echo " "
8803echo "Checking for an efficient way to convert floats to strings."
8804echo " " > try.c
8805case "$uselongdouble" in
8806"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8807esac
8808case "$d_longdbl" in
8809"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8810esac
8811case "$d_PRIgldbl" in
8812"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8813esac
8814$cat >>try.c <<EOP
8815#ifdef TRY_gconvert
8816#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8817char *myname = "gconvert";
8818#endif
8819#ifdef TRY_gcvt
8820#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8821char *myname = "gcvt";
8822#endif
8823#ifdef TRY_qgcvt
8824#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8825char *myname = "qgcvt";
8826#define DOUBLETYPE long double
8827#endif
8828#ifdef TRY_sprintf
a5b10d80
YST
8829#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8830#ifdef HAS_PRIgldbl
b4eb6b3d
JH
8831#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8832#else
a5b10d80
YST
8833#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8834#endif
8835#else
b4eb6b3d
JH
8836#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8837#endif
8838char *myname = "sprintf";
8839#endif
8840
8841#ifndef DOUBLETYPE
8842#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8843#define DOUBLETYPE long double
8844#else
8845#define DOUBLETYPE double
8846#endif
8847#endif
8848
8849#include <stdio.h>
8850
8851#define I_STDLIB $i_stdlib
8852#ifdef I_STDLIB
8853#include <stdlib.h>
8854#endif
8855
8856int
8857checkit(expect, got)
8858char *expect;
8859char *got;
8860{
8861 if (strcmp(expect, got)) {
8862 printf("%s oddity: Expected %s, got %s\n",
8863 myname, expect, got);
8864 exit(1);
8865 }
8866}
8867
8868int main()
8869{
8870 char buf[64];
8871 buf[63] = '\0';
8872
8873 /* This must be 1st test on (which?) platform */
8874 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8875 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8876 checkit("0.1", buf);
8877
a5b10d80
YST
8878 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
8879 checkit("0.01", buf);
8880
8881 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
8882 checkit("0.001", buf);
8883
8884 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
8885 checkit("0.0001", buf);
8886
8887 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8888 if (strlen(buf) > 5)
8889 checkit("9e-005", buf); /* for Microsoft ?? */
8890 else
8891 checkit("9e-05", buf);
8892
b4eb6b3d
JH
8893 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8894 checkit("1", buf);
8895
8896 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8897 checkit("1.1", buf);
8898
8899 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8900 checkit("1.01", buf);
8901
8902 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8903 checkit("1.001", buf);
8904
8905 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8906 checkit("1.0001", buf);
8907
8908 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8909 checkit("1.00001", buf);
8910
8911 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8912 checkit("1.000001", buf);
8913
8914 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8915 checkit("0", buf);
8916
8917 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8918 checkit("-1", buf);
8919
8920 /* Some Linux gcvt's give 1.e+5 here. */
8921 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8922 checkit("100000", buf);
8923
8924 /* Some Linux gcvt's give -1.e+5 here. */
8925 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8926 checkit("-100000", buf);
8927
8928 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8929 checkit("123.456", buf);
8930
ab6ca9f4 8931 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
8932 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8933 /* 34 should be enough to scare even long double
8934 * places into using the e notation. */
ab6ca9f4 8935 if (strlen(buf) > 5)
94b339ad 8936 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 8937 else
94b339ad 8938 checkit("1e+34", buf);
8e2a5ede 8939
d1eb8299
YST
8940 /* For Perl, if you add additional tests here, also add them to
8941 * t/base/num.t for benefit of platforms not using Configure or
8942 * overriding d_Gconvert */
8943
b4eb6b3d
JH
8944 exit(0);
8945}
8946EOP
ab6ca9f4 8947: first add preferred functions to our list
a5b10d80 8948xxx_list=""
ab6ca9f4 8949for xxx_convert in $gconvert_preference; do
a5b10d80
YST
8950 case $xxx_convert in
8951 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 8952 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
8953 esac
8954done
8955: then add any others
8956for xxx_convert in gconvert gcvt sprintf; do
8957 case "$xxx_list" in
8958 *$xxx_convert*) ;;
8959 *) xxx_list="$xxx_list $xxx_convert" ;;
8960 esac
8961done
8962
8963case "$d_longdbl$uselongdouble" in
8964"$define$define")
8965 : again, add prefered functions to our list first
8966 xxx_ld_list=""
ab6ca9f4 8967 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
8968 case $xxx_convert in
8969 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 8970 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
8971 esac
8972 done
8973 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8974 for xxx_convert in qgcvt sprintf $xxx_list; do
8975 case "$xxx_ld_list" in
8976 $xxx_convert*|*" $xxx_convert"*) ;;
8977 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8978 esac
8979 done
8980 : if sprintf cannot do long doubles, move it to the end
8981 if test "$d_PRIgldbl" != "$define"; then
8982 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8983 fi
8984 : if no qgcvt, remove it
8985 if test "$d_qgcvt" != "$define"; then
8986 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8987 fi
8988 : use the ld_list
8989 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
8990 ;;
8991esac
8992
8993for xxx_convert in $xxx_list; do
8994 echo "Trying $xxx_convert..."
8995 $rm -f try try$_o
8996 set try -DTRY_$xxx_convert
8997 if eval $compile; then
8998 echo "$xxx_convert() found." >&4
5440bc8e 8999 if $run ./try; then
b4eb6b3d
JH
9000 echo "I'll use $xxx_convert to convert floats into a string." >&4
9001 break;
9002 else
9003 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9004 xxx_convert=''
b4eb6b3d
JH
9005 fi
9006 else
9007 echo "$xxx_convert NOT found." >&4
9008 fi
9009done
ab6ca9f4 9010
a5b10d80
YST
9011if test X$xxx_convert = X; then
9012 echo "*** WHOA THERE!!! ***" >&4
9013 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9014 xxx_convert=sprintf
9015fi
9016
b4eb6b3d
JH
9017case "$xxx_convert" in
9018gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9019gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9020qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9021*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9022 "$define$define$define")
9023 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9024 "$define$define$undef")
9025 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9026 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9027 esac
9028 ;;
9029esac
9030
a5b10d80
YST
9031fi
9032
74cac757
JH
9033: see if _fwalk exists
9034set fwalk d__fwalk
9035eval $inlibc
9036
b4eb6b3d
JH
9037: Initialize h_fcntl
9038h_fcntl=false
9039
9040: Initialize h_sysfile
9041h_sysfile=false
9042
9043: access call always available on UNIX
9044set access d_access
9045eval $inlibc
9046
9047: locate the flags for 'access()'
9048case "$d_access" in
9049"$define")
9050 echo " "
9051 $cat >access.c <<'EOCP'
9052#include <sys/types.h>
9053#ifdef I_FCNTL
9054#include <fcntl.h>
9055#endif
9056#ifdef I_SYS_FILE
9057#include <sys/file.h>
9058#endif
9059#ifdef I_UNISTD
9060#include <unistd.h>
9061#endif
9062int main() {
9063 exit(R_OK);
9064}
9065EOCP
9066 : check sys/file.h first, no particular reason here
9067 if $test `./findhdr sys/file.h` && \
7a282f6d 9068 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9069 h_sysfile=true;
9070 echo "<sys/file.h> defines the *_OK access constants." >&4
9071 elif $test `./findhdr fcntl.h` && \
7a282f6d 9072 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9073 h_fcntl=true;
9074 echo "<fcntl.h> defines the *_OK access constants." >&4
9075 elif $test `./findhdr unistd.h` && \
7a282f6d 9076 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9077 echo "<unistd.h> defines the *_OK access constants." >&4
9078 else
9079 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9080 fi
9081 ;;
9082esac
9083$rm -f access*
9084
9085: see if accessx exists
9086set accessx d_accessx
9087eval $inlibc
9088
9089: see if alarm exists
9090set alarm d_alarm
9091eval $inlibc
9092
a9dade78
JH
9093: see if POSIX threads are available
9094set pthread.h i_pthread
9095eval $inhdr
9096
10bc17b6
JH
9097: define a fucntion to check prototypes
9098$cat > protochk <<EOSH
9099$startsh
9100cc="$cc"
9101optimize="$optimize"
9102ccflags="$ccflags"
9103prototype="$prototype"
9104define="$define"
9105rm=$rm
a9dade78
JH
9106usethreads=$usethreads
9107i_pthread=$i_pthread
9108pthread_h_first=$pthread_h_first
10bc17b6
JH
9109EOSH
9110
9111$cat >> protochk <<'EOSH'
9112
9113$rm -f try.c
9114foo="$1"
9115shift
9116while test $# -ge 2; do
9117 case "$1" in
9118 $define) echo "#include <$2>" >> try.c ;;
9119 literal) echo "$2" >> try.c ;;
9120 esac
cce6a207
MB
9121 # Extra magic for the benefit of systems that need pthread.h
9122 # to be included early to correctly detect threadsafe functions.
9123 # Such functions must guarantee themselves, though, that the usethreads
9124 # and i_pthread have been defined, before calling protochk.
9125 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9126 echo "#include <pthread.h>" >> try.c
9127 pthread_h_done=yes
9128 fi
10bc17b6
JH
9129 shift 2
9130done
9131test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9132cat >> try.c <<'EOCP'
9133#ifdef CAN_PROTOTYPE
9134#define _(args) args
9135#else
9136#define _(args) ()
9137#endif
9138EOCP
9139echo "$foo" >> try.c
9140echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9141$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9142status=$?
9143$rm -f try.[co]
9144exit $status
9145EOSH
9146chmod +x protochk
9147$eunicefix protochk
9148
a48ec845
JH
9149hasproto='varname=$1; func=$2; shift; shift;
9150while $test $# -ge 2; do
9151 case "$1" in
9152 $define) echo "#include <$2>";;
9153 esac ;
9154 shift 2;
9155done > try.c;
9156$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9157if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9158 echo "$func() prototype found.";
9159 val="$define";
9160else
9161 echo "$func() prototype NOT found.";
9162 val="$undef";
9163fi;
9164set $varname;
9165eval $setvar;
9166$rm -f try.c tryout.c'
9167
10bc17b6
JH
9168: see if sys/types.h has to be included
9169set sys/types.h i_systypes
9170eval $inhdr
9171
9172: see if sys/select.h has to be included
9173set sys/select.h i_sysselct
9174eval $inhdr
9175
9176hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9177while $test $# -ge 2; do
9178 case "$1" in
9179 $define) echo "#include <$2>";;
9180 esac ;
9181 shift 2;
9182done > try.c;
9183echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9184set try;
9185if eval $compile; then
9186 val="$define";
9187else
9188 val="$undef";
9189fi;
9190set $varname;
9191eval $setvar;
9192$rm -f try.c try.o'
9193
9194: see if we should include time.h, sys/time.h, or both
9195echo " "
9196if test "X$timeincl" = X; then
9197 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9198 $echo $n "I'm now running the test program...$c"
9199 $cat >try.c <<'EOCP'
9200#include <sys/types.h>
9201#ifdef I_TIME
9202#include <time.h>
9203#endif
9204#ifdef I_SYSTIME
9205#ifdef SYSTIMEKERNEL
9206#define KERNEL
9207#endif
9208#include <sys/time.h>
9209#endif
9210#ifdef I_SYSSELECT
9211#include <sys/select.h>
9212#endif
9213int main()
9214{
9215 struct tm foo;
9216#ifdef S_TIMEVAL
9217 struct timeval bar;
9218#endif
9219#ifdef S_TIMEZONE
9220 struct timezone tzp;
9221#endif
9222 if (foo.tm_sec == foo.tm_sec)
9223 exit(0);
9224#ifdef S_TIMEVAL
9225 if (bar.tv_sec == bar.tv_sec)
9226 exit(0);
9227#endif
9228 exit(1);
9229}
9230EOCP
9231 flags=''
9232 for s_timezone in '-DS_TIMEZONE' ''; do
9233 sysselect=''
9234 for s_timeval in '-DS_TIMEVAL' ''; do
9235 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9236 for i_time in '' '-DI_TIME'; do
9237 for i_systime in '-DI_SYSTIME' ''; do
9238 case "$flags" in
9239 '') $echo $n ".$c"
9240 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9241 if eval $compile; then
9242 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9243 shift
9244 flags="$*"
9245 echo " "
9246 $echo $n "Succeeded with $flags$c"
9247 fi
9248 ;;
9249 esac
9250 done
9251 done
9252 done
9253 done
9254 done
9255 timeincl=''
9256 echo " "
9257 case "$flags" in
9258 *SYSTIMEKERNEL*) i_systimek="$define"
9259 timeincl=`./findhdr sys/time.h`
9260 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9261 *) i_systimek="$undef";;
9262 esac
9263 case "$flags" in
9264 *I_TIME*) i_time="$define"
9265 timeincl=`./findhdr time.h`" $timeincl"
9266 echo "We'll include <time.h>." >&4;;
9267 *) i_time="$undef";;
9268 esac
9269 case "$flags" in
9270 *I_SYSTIME*) i_systime="$define"
9271 timeincl=`./findhdr sys/time.h`" $timeincl"
9272 echo "We'll include <sys/time.h>." >&4;;
9273 *) i_systime="$undef";;
9274 esac
9275 $rm -f try.c try
9276fi
9277: see if struct tm knows about tm_zone
9278case "$i_systime$i_time" in
9279*$define*)
9280 echo " "
9281 echo "Checking to see if your struct tm has tm_zone field..." >&4
9282 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9283 eval $hasfield
9284 ;;
9285*) val="$undef"
9286 set d_tm_tm_zone
9287 eval $setvar
9288 ;;
9289esac
9290case "$d_tm_tm_zone" in
9291"$define") echo "Yes, it does." ;;
9292*) echo "No, it doesn't." ;;
9293esac
9294: see if struct tm knows about tm_gmtoff
9295case "$i_systime$i_time" in
9296*$define*)
9297 echo " "
9298 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9299 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9300 eval $hasfield
9301 ;;
9302*) val="$undef"
9303 set d_tm_tm_gmtoff
9304 eval $setvar
9305 ;;
9306esac
9307case "$d_tm_tm_gmtoff" in
9308"$define") echo "Yes, it does." ;;
9309*) echo "No, it doesn't." ;;
9310esac
9311
9312: see if asctime_r exists
9313set asctime_r d_asctime_r
9314eval $inlibc
9315case "$d_asctime_r" in
9316"$define")
d63eadf0 9317 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9318 case "$d_asctime_r_proto:$usethreads" in
9319 ":define") d_asctime_r_proto=define
a48ec845
JH
9320 set d_asctime_r_proto asctime_r $hdrs
9321 eval $hasproto ;;
9322 *) ;;
9323 esac
9324 case "$d_asctime_r_proto" in
9325 define)
10bc17b6
JH
9326 case "$asctime_r_proto" in
9327 ''|0) try='char* asctime_r(const struct tm*, char*);'
9328 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9329 esac
9330 case "$asctime_r_proto" in
9331 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9332 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9333 esac
9334 case "$asctime_r_proto" in
9335 ''|0) try='int asctime_r(const struct tm*, char*);'
9336 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9337 esac
9338 case "$asctime_r_proto" in
9339 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9340 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9341 esac
9342 case "$asctime_r_proto" in
90e831dc 9343 ''|0) d_asctime_r=undef
10bc17b6 9344 asctime_r_proto=0
a48ec845 9345 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9346 * ) case "$asctime_r_proto" in
9347 REENTRANT_PROTO*) ;;
9348 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9349 esac
9350 echo "Prototype: $try" ;;
9351 esac
9352 ;;
c18e646a
JH
9353 *) case "$usethreads" in
9354 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9355 esac
90e831dc
SB
9356 d_asctime_r=undef
9357 asctime_r_proto=0
c18e646a 9358 ;;
a48ec845
JH
9359 esac
9360 ;;
10bc17b6
JH
9361*) asctime_r_proto=0
9362 ;;
9363esac
9364
b4eb6b3d
JH
9365: see if atolf exists
9366set atolf d_atolf
9367eval $inlibc
9368
9369: see if atoll exists
9370set atoll d_atoll
9371eval $inlibc
9372
9373: Look for GNU-cc style attribute checking
9374echo " "
9375echo "Checking whether your compiler can handle __attribute__ ..." >&4
9376$cat >attrib.c <<'EOCP'
9377#include <stdio.h>
9378void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9379EOCP
9380if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9381 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9382 echo "Your C compiler doesn't fully support __attribute__."
9383 val="$undef"
9384 else
9385 echo "Your C compiler supports __attribute__."
9386 val="$define"
9387 fi
9388else
9389 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9390 val="$undef"
9391fi
9392set d_attribut
9393eval $setvar
9394$rm -f attrib*
9395
9396: see if bcmp exists
9397set bcmp d_bcmp
9398eval $inlibc
9399
9400: see if bcopy exists
9401set bcopy d_bcopy
9402eval $inlibc
9403
9404: see if this is a unistd.h system
9405set unistd.h i_unistd
9406eval $inhdr
9407
9408: see if getpgrp exists
9409set getpgrp d_getpgrp
9410eval $inlibc
9411
9412case "$d_getpgrp" in
9413"$define")
9414 echo " "
9415 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 9416 $cat >try.c <<EOP
b4eb6b3d
JH
9417#$i_unistd I_UNISTD
9418#include <sys/types.h>
9419#ifdef I_UNISTD
9420# include <unistd.h>
9421#endif
9422int main()
9423{
9424 if (getuid() == 0) {
9425 printf("(I see you are running Configure as super-user...)\n");
9426 setuid(1);
9427 }
9428#ifdef TRY_BSD_PGRP
9429 if (getpgrp(1) == 0)
9430 exit(0);
9431#else
9432 if (getpgrp() > 0)
9433 exit(0);
9434#endif
9435 exit(1);
9436}
9437EOP
5440bc8e 9438 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9439 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9440 val="$define"
5440bc8e 9441 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9442 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9443 val="$undef"
9444 else
9445 echo "I can't seem to compile and run the test program."
9446 if ./usg; then
9447 xxx="a USG one, i.e. you use getpgrp()."
9448 else
9449 # SVR4 systems can appear rather BSD-ish.
9450 case "$i_unistd" in
9451 $undef)
9452 xxx="a BSD one, i.e. you use getpgrp(pid)."
9453 val="$define"
9454 ;;
9455 $define)
9456 xxx="probably a USG one, i.e. you use getpgrp()."
9457 val="$undef"
9458 ;;
9459 esac
9460 fi
9461 echo "Assuming your getpgrp is $xxx" >&4
9462 fi
9463 ;;
9464*) val="$undef";;
9465esac
9466set d_bsdgetpgrp
9467eval $setvar
5440bc8e 9468$rm -f try try.*
b4eb6b3d
JH
9469
9470: see if setpgrp exists
9471set setpgrp d_setpgrp
9472eval $inlibc
9473
9474case "$d_setpgrp" in
9475"$define")
9476 echo " "
9477 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 9478 $cat >try.c <<EOP
b4eb6b3d
JH
9479#$i_unistd I_UNISTD
9480#include <sys/types.h>
9481#ifdef I_UNISTD
9482# include <unistd.h>
9483#endif
9484int main()
9485{
9486 if (getuid() == 0) {
9487 printf("(I see you are running Configure as super-user...)\n");
9488 setuid(1);
9489 }
9490#ifdef TRY_BSD_PGRP
9491 if (-1 == setpgrp(1, 1))
9492 exit(0);
9493#else
9494 if (setpgrp() != -1)
9495 exit(0);
9496#endif
9497 exit(1);
9498}
9499EOP
5440bc8e 9500 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9501 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9502 val="$define"
5440bc8e 9503 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9504 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9505 val="$undef"
9506 else
9507 echo "(I can't seem to compile and run the test program.)"
9508 if ./usg; then
9509 xxx="a USG one, i.e. you use setpgrp()."
9510 else
9511 # SVR4 systems can appear rather BSD-ish.
9512 case "$i_unistd" in
9513 $undef)
9514 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9515 val="$define"
9516 ;;
9517 $define)
9518 xxx="probably a USG one, i.e. you use setpgrp()."
9519 val="$undef"
9520 ;;
9521 esac
9522 fi
9523 echo "Assuming your setpgrp is $xxx" >&4
9524 fi
9525 ;;
9526*) val="$undef";;
9527esac
9528set d_bsdsetpgrp
9529eval $setvar
5440bc8e 9530$rm -f try try.*
b4eb6b3d
JH
9531: see if bzero exists
9532set bzero d_bzero
9533eval $inlibc
9534
9535: see if signal is declared as pointer to function returning int or void
9536echo " "
9537xxx=`./findhdr signal.h`
9538$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9539if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9540 echo "You have int (*signal())() instead of void." >&4
9541 val="$undef"
9542elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9543 echo "You have void (*signal())()." >&4
9544 val="$define"
9545elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9546 echo "You have int (*signal())() instead of void." >&4
9547 val="$undef"
9548elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9549 echo "You have void (*signal())()." >&4
9550 val="$define"
9551else
9552 case "$d_voidsig" in
9553 '')
9554 echo "I can't determine whether signal handler returns void or int..." >&4
9555 dflt=void
9556 rp="What type does your signal handler return?"
9557 . ./myread
9558 case "$ans" in
9559 v*) val="$define";;
9560 *) val="$undef";;
9561 esac;;
9562 "$define")
9563 echo "As you already told me, signal handler returns void." >&4
9564 val="$define"
9565 ;;
9566 *) echo "As you already told me, signal handler returns int." >&4
9567 val="$undef"
9568 ;;
9569 esac
9570fi
9571set d_voidsig
9572eval $setvar
9573case "$d_voidsig" in
9574"$define") signal_t="void";;
9575*) signal_t="int";;
9576esac
9577$rm -f $$.tmp
9578
9579: check for ability to cast large floats to 32-bit ints.
9580echo " "
9581echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9582if $test "$intsize" -ge 4; then
9583 xxx=int
9584else
9585 xxx=long
9586fi
9587$cat >try.c <<EOCP
9588#include <stdio.h>
9589#include <sys/types.h>
9590#include <signal.h>
9591$signal_t blech(s) int s; { exit(3); }
9592int main()
9593{
9594 $xxx i32;
9595 double f, g;
9596 int result = 0;
9597 char str[16];
9598 signal(SIGFPE, blech);
9599
9600 /* Don't let compiler optimize the test away. Store the number
9601 in a writable string for gcc to pass to sscanf under HP/UX.
9602 */
9603 sprintf(str, "2147483647");
9604 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9605 g = 10 * f;
9606 i32 = ($xxx) g;
9607
9608 /* x86 processors will probably give 0x8000 0000, which is a
9609 sign change. We don't want that. We want to mimic SPARC
9610 behavior here, which is to preserve the sign and give
9611 back 0x7fff ffff.
9612 */
9613 if (i32 != ($xxx) f)
9614 result |= 1;
9615 exit(result);
9616}
9617EOCP
9618set try
9619if eval $compile_ok; then
5440bc8e 9620 $run ./try
b4eb6b3d
JH
9621 yyy=$?
9622else
9623 echo "(I can't seem to compile the test program--assuming it can't)"
9624 yyy=1
9625fi
9626case "$yyy" in
96270) val="$define"
9628 echo "Yup, it can."
9629 ;;
9630*) val="$undef"
9631 echo "Nope, it can't."
9632 ;;
9633esac
9634set d_casti32
9635eval $setvar
9636$rm -f try try.*
9637
9638: check for ability to cast negative floats to unsigned
9639echo " "
9640echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9641$cat >try.c <<EOCP
9642#include <stdio.h>
9643#include <sys/types.h>
9644#include <signal.h>
9645$signal_t blech(s) int s; { exit(7); }
9646$signal_t blech_in_list(s) int s; { exit(4); }
9647unsigned long dummy_long(p) unsigned long p; { return p; }
9648unsigned int dummy_int(p) unsigned int p; { return p; }
9649unsigned short dummy_short(p) unsigned short p; { return p; }
9650int main()
9651{
9652 double f;
9653 unsigned long along;
9654 unsigned int aint;
9655 unsigned short ashort;
9656 int result = 0;
9657 char str[16];
9658
9659 /* Frustrate gcc-2.7.2's optimizer which failed this test with
9660 a direct f = -123. assignment. gcc-2.8.0 reportedly
9661 optimized the whole file away
9662 */
9663 /* Store the number in a writable string for gcc to pass to
9664 sscanf under HP/UX.
9665 */
9666 sprintf(str, "-123");
9667 sscanf(str, "%lf", &f); /* f = -123.; */
9668
9669 signal(SIGFPE, blech);
9670 along = (unsigned long)f;
9671 aint = (unsigned int)f;
9672 ashort = (unsigned short)f;
9673 if (along != (unsigned long)-123)
9674 result |= 1;
9675 if (aint != (unsigned int)-123)
9676 result |= 1;
9677 if (ashort != (unsigned short)-123)
9678 result |= 1;
9679 sprintf(str, "1073741824.");
9680 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9681 f = f + f;
9682 along = 0;
9683 along = (unsigned long)f;
9684 if (along != 0x80000000)
9685 result |= 2;
9686 f -= 1.;
9687 along = 0;
9688 along = (unsigned long)f;
9689 if (along != 0x7fffffff)
9690 result |= 1;
9691 f += 2.;
9692 along = 0;
9693 along = (unsigned long)f;
9694 if (along != 0x80000001)
9695 result |= 2;
9696 if (result)
9697 exit(result);
9698 signal(SIGFPE, blech_in_list);
9699 sprintf(str, "123.");
9700 sscanf(str, "%lf", &f); /* f = 123.; */
9701 along = dummy_long((unsigned long)f);
9702 aint = dummy_int((unsigned int)f);
9703 ashort = dummy_short((unsigned short)f);
9704 if (along != (unsigned long)123)
9705 result |= 4;
9706 if (aint != (unsigned int)123)
9707 result |= 4;
9708 if (ashort != (unsigned short)123)
9709 result |= 4;
9710 exit(result);
9711
9712}
9713EOCP
9714set try
9715if eval $compile_ok; then
5440bc8e 9716 $run ./try
b4eb6b3d
JH
9717 castflags=$?
9718else
9719 echo "(I can't seem to compile the test program--assuming it can't)"
9720 castflags=7
9721fi
9722case "$castflags" in
97230) val="$define"
9724 echo "Yup, it can."
9725 ;;
9726*) val="$undef"
9727 echo "Nope, it can't."
9728 ;;
9729esac
9730set d_castneg
9731eval $setvar
9732$rm -f try.*
9733
9734: see if vprintf exists
9735echo " "
9736if set vprintf val -f d_vprintf; eval $csym; $val; then
9737 echo 'vprintf() found.' >&4
9738 val="$define"
5440bc8e 9739 $cat >try.c <<'EOF'
b4eb6b3d
JH
9740#include <varargs.h>
9741
9742int main() { xxx("foo"); }
9743
9744xxx(va_alist)
9745va_dcl
9746{
9747 va_list args;
9748 char buf[10];
9749
9750 va_start(args);
9751 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9752}
9753EOF
5440bc8e
JH
9754 set try
9755 if eval $compile && $run ./try; then
b4eb6b3d
JH
9756 echo "Your vsprintf() returns (int)." >&4
9757 val2="$undef"
9758 else
9759 echo "Your vsprintf() returns (char*)." >&4
9760 val2="$define"
9761 fi
9762else
9763 echo 'vprintf() NOT found.' >&4
9764 val="$undef"
9765 val2="$undef"
9766fi
5440bc8e 9767$rm -f try try.*
b4eb6b3d
JH
9768set d_vprintf
9769eval $setvar
9770val=$val2
9771set d_charvspr
9772eval $setvar
9773
9774: see if chown exists
9775set chown d_chown
9776eval $inlibc
9777
9778: see if chroot exists
9779set chroot d_chroot
9780eval $inlibc
9781
9782: see if chsize exists
9783set chsize d_chsize
9784eval $inlibc
9785
758a5d79
JH
9786: see if class exists
9787set class d_class
9788eval $inlibc
9789
4e0554ec
JH
9790hasstruct='varname=$1; struct=$2; shift; shift;
9791while $test $# -ge 2; do
9792 case "$1" in
9793 $define) echo "#include <$2>";;
9794 esac ;
9795 shift 2;
9796done > try.c;
9797echo "int main () { struct $struct foo; }" >> try.c;
9798set try;
9799if eval $compile; then
9800 val="$define";
9801else
9802 val="$undef";
9803fi;
9804set $varname;
9805eval $setvar;
9806$rm -f try.c try.o'
9807
4e0554ec
JH
9808socketlib=''
9809sockethdr=''
9810: see whether socket exists
9811echo " "
9812$echo $n "Hmm... $c" >&4
9813if set socket val -f d_socket; eval $csym; $val; then
9814 echo "Looks like you have Berkeley networking support." >&4
9815 d_socket="$define"
9816 if set setsockopt val -f; eval $csym; $val; then
9817 d_oldsock="$undef"
9818 else
9819 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9820 d_oldsock="$define"
9821 fi
9822else
9823 if $contains socklib libc.list >/dev/null 2>&1; then
9824 echo "Looks like you have Berkeley networking support." >&4
9825 d_socket="$define"
9826 : we will have to assume that it supports the 4.2 BSD interface
9827 d_oldsock="$undef"
9828 else
9829 echo "You don't have Berkeley networking in libc$_a..." >&4
9830 if test "X$d_socket" = "X$define"; then
9831 echo "...but you seem to believe that you have sockets." >&4
9832 else
9833 for net in net socket
9834 do
9835 if test -f /usr/lib/lib$net$_a; then
9836 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
9837 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9838 if $contains socket libc.list >/dev/null 2>&1; then
9839 d_socket="$define"
9840 socketlib="-l$net"
9841 case "$net" in
9842 net)
9843 echo "...but the Wollongong group seems to have hacked it in." >&4
9844 sockethdr="-I/usr/netinclude"
9845 ;;
9846 esac
3c728e00 9847 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
9848 if $contains setsockopt libc.list >/dev/null 2>&1; then
9849 d_oldsock="$undef"
9850 else
9851 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9852 d_oldsock="$define"
9853 fi
9854 break
9855 fi
9856 fi
9857 done
9858 if test "X$d_socket" != "X$define"; then
9859 echo "or anywhere else I see." >&4
9860 d_socket="$undef"
9861 d_oldsock="$undef"
9862 fi
9863 fi
9864 fi
9865fi
9866
9867: see if socketpair exists
9868set socketpair d_sockpair
9869eval $inlibc
9870
9871
9872echo " "
3c728e00 9873echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
9874for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9875 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9876 $cat >try.c <<EOF
9877#include <sys/types.h>
9878#include <sys/socket.h>
9879int main() {
9880 int i = $ENUM;
9881}
9882EOF
9883 val="$undef"
9884 set try; if eval $compile; then
9885 val="$define"
9886 fi
9887 set d_${enum}; eval $setvar
9888 $rm -f try.c try
9889done
9890
9891: see if this is a sys/uio.h system
9892set sys/uio.h i_sysuio
9893eval $inhdr
9894
9895
9896echo " "
9897echo "Checking to see if your system supports struct cmsghdr..." >&4
9898set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9899eval $hasstruct
9900case "$d_cmsghdr_s" in
9901"$define") echo "Yes, it does." ;;
9902*) echo "No, it doesn't." ;;
9903esac
9904
9905
b4eb6b3d
JH
9906: check for const keyword
9907echo " "
9908echo 'Checking to see if your C compiler knows about "const"...' >&4
9909$cat >const.c <<'EOCP'
9910typedef struct spug { int drokk; } spug;
9911int main()
9912{
9913 const char *foo;
9914 const spug y;
9915}
9916EOCP
9917if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9918 val="$define"
9919 echo "Yup, it does."
9920else
9921 val="$undef"
9922 echo "Nope, it doesn't."
9923fi
9924set d_const
9925eval $setvar
9926
9927: see if crypt exists
9928echo " "
a5a94ea5
JH
9929set crypt d_crypt
9930eval $inlibc
9931case "$d_crypt" in
9932$define) cryptlib='' ;;
9933*) if set crypt val -f d_crypt; eval $csym; $val; then
9934 echo 'crypt() found.' >&4
b4eb6b3d 9935 val="$define"
a5a94ea5
JH
9936 cryptlib=''
9937 else
9938 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9939 if $test -z "$cryptlib"; then
9940 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9941 else
9942 cryptlib=-lcrypt
9943 fi
9944 if $test -z "$cryptlib"; then
9945 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9946 else
9947 cryptlib=-lcrypt
9948 fi
9949 if $test -z "$cryptlib"; then
9950 cryptlib=`./loc libcrypt$_a "" $libpth`
9951 else
9952 cryptlib=-lcrypt
9953 fi
9954 if $test -z "$cryptlib"; then
9955 echo 'crypt() NOT found.' >&4
9956 val="$undef"
9957 else
9958 val="$define"
9959 fi
b4eb6b3d 9960 fi
a5a94ea5
JH
9961 set d_crypt
9962 eval $setvar
9963 ;;
9964esac
b4eb6b3d 9965
10bc17b6
JH
9966: see if this is a crypt.h system
9967set crypt.h i_crypt
9968eval $inhdr
9969
9970: see if crypt_r exists
9971set crypt_r d_crypt_r
9972eval $inlibc
9973case "$d_crypt_r" in
9974"$define")
9975 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
9976 case "$d_crypt_r_proto:$usethreads" in
9977 ":define") d_crypt_r_proto=define
a48ec845
JH
9978 set d_crypt_r_proto crypt_r $hdrs
9979 eval $hasproto ;;
9980 *) ;;
9981 esac
9982 case "$d_crypt_r_proto" in
9983 define)
10bc17b6
JH
9984 case "$crypt_r_proto" in
9985 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9986 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9987 esac
9988 case "$crypt_r_proto" in
b430fd04
JH
9989 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9990 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9991 esac
9992 case "$crypt_r_proto" in
90e831dc 9993 ''|0) d_crypt_r=undef
10bc17b6 9994 crypt_r_proto=0
a48ec845 9995 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9996 * ) case "$crypt_r_proto" in
9997 REENTRANT_PROTO*) ;;
9998 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9999 esac
10000 echo "Prototype: $try" ;;
10001 esac
10002 ;;
c18e646a
JH
10003 *) case "$usethreads" in
10004 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10005 esac
90e831dc
SB
10006 d_crypt_r=undef
10007 crypt_r_proto=0
c18e646a 10008 ;;
a48ec845
JH
10009 esac
10010 ;;
10bc17b6
JH
10011*) crypt_r_proto=0
10012 ;;
10013esac
10014
b4eb6b3d
JH
10015: get csh whereabouts
10016case "$csh" in
10017'csh') val="$undef" ;;
10018*) val="$define" ;;
10019esac
10020set d_csh
10021eval $setvar
10022: Respect a hint or command line value for full_csh.
10023case "$full_csh" in
10024'') full_csh=$csh ;;
10025esac
10026
10bc17b6
JH
10027: see if ctermid_r exists
10028set ctermid_r d_ctermid_r
10029eval $inlibc
10030case "$d_ctermid_r" in
10031"$define")
31ee0cb7 10032 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10033 case "$d_ctermid_r_proto:$usethreads" in
10034 ":define") d_ctermid_r_proto=define
a48ec845
JH
10035 set d_ctermid_r_proto ctermid_r $hdrs
10036 eval $hasproto ;;
10037 *) ;;
10038 esac
10039 case "$d_ctermid_r_proto" in
10040 define)
10bc17b6
JH
10041 case "$ctermid_r_proto" in
10042 ''|0) try='char* ctermid_r(char*);'
10043 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10044 esac
10045 case "$ctermid_r_proto" in
90e831dc 10046 ''|0) d_ctermid_r=undef
10bc17b6 10047 ctermid_r_proto=0
a48ec845 10048 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10049 * ) case "$ctermid_r_proto" in
10050 REENTRANT_PROTO*) ;;
10051 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10052 esac
10053 echo "Prototype: $try" ;;
10054 esac
10055 ;;
c18e646a
JH
10056 *) case "$usethreads" in
10057 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10058 esac
90e831dc
SB
10059 d_ctermid_r=undef
10060 ctermid_r_proto=0
c18e646a 10061 ;;
a48ec845
JH
10062 esac
10063 ;;
10bc17b6
JH
10064*) ctermid_r_proto=0
10065 ;;
10066esac
10067
10068: see if ctime_r exists
10069set ctime_r d_ctime_r
10070eval $inlibc
10071case "$d_ctime_r" in
10072"$define")
d63eadf0 10073 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10074 case "$d_ctime_r_proto:$usethreads" in
10075 ":define") d_ctime_r_proto=define
a48ec845
JH
10076 set d_ctime_r_proto ctime_r $hdrs
10077 eval $hasproto ;;
10078 *) ;;
10079 esac
10080 case "$d_ctime_r_proto" in
10081 define)
10bc17b6
JH
10082 case "$ctime_r_proto" in
10083 ''|0) try='char* ctime_r(const time_t*, char*);'
10084 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10085 esac
10086 case "$ctime_r_proto" in
10087 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10088 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10089 esac
10090 case "$ctime_r_proto" in
10091 ''|0) try='int ctime_r(const time_t*, char*);'
10092 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10093 esac
10094 case "$ctime_r_proto" in
10095 ''|0) try='int ctime_r(const time_t*, char*, int);'
10096 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10097 esac
10098 case "$ctime_r_proto" in
90e831dc 10099 ''|0) d_ctime_r=undef
10bc17b6 10100 ctime_r_proto=0
a48ec845 10101 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10102 * ) case "$ctime_r_proto" in
10103 REENTRANT_PROTO*) ;;
10104 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10105 esac
10106 echo "Prototype: $try" ;;
10107 esac
10108 ;;
c18e646a
JH
10109 *) case "$usethreads" in
10110 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10111 esac
90e831dc
SB
10112 d_ctime_r=undef
10113 ctime_r_proto=0
c18e646a 10114 ;;
a48ec845
JH
10115 esac
10116 ;;
10bc17b6
JH
10117*) ctime_r_proto=0
10118 ;;
10119esac
10120
b4eb6b3d
JH
10121: see if cuserid exists
10122set cuserid d_cuserid
10123eval $inlibc
10124
10125: see if this is a limits.h system
10126set limits.h i_limits
10127eval $inhdr
10128
10129: see if this is a float.h system
10130set float.h i_float
10131eval $inhdr
10132
10133: See if number of significant digits in a double precision number is known
10134echo " "
10135$cat >dbl_dig.c <<EOM
10136#$i_limits I_LIMITS
10137#$i_float I_FLOAT
10138#ifdef I_LIMITS
10139#include <limits.h>
10140#endif
10141#ifdef I_FLOAT
10142#include <float.h>
10143#endif
10144#ifdef DBL_DIG
10145printf("Contains DBL_DIG");
10146#endif
10147EOM
10148$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10149if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10150 echo "DBL_DIG found." >&4
10151 val="$define"
10152else
10153 echo "DBL_DIG NOT found." >&4
10154 val="$undef"
10155fi
10156$rm -f dbl_dig.?
10157set d_dbl_dig
10158eval $setvar
10159
2ef53570
JH
10160: see if dbm.h is available
10161: see if dbmclose exists
10162set dbmclose d_dbmclose
10163eval $inlibc
10164
10165case "$d_dbmclose" in
10166$define)
10167 set dbm.h i_dbm
10168 eval $inhdr
10169 case "$i_dbm" in
10170 $define)
10171 val="$undef"
10172 set i_rpcsvcdbm
10173 eval $setvar
10174 ;;
10175 *) set rpcsvc/dbm.h i_rpcsvcdbm
10176 eval $inhdr
10177 ;;
10178 esac
10179 ;;
10180*) echo "We won't be including <dbm.h>"
10181 val="$undef"
10182 set i_dbm
10183 eval $setvar
10184 val="$undef"
10185 set i_rpcsvcdbm
10186 eval $setvar
10187 ;;
10188esac
10189
10190: see if prototype for dbminit is available
10191echo " "
10192set d_dbminitproto dbminit $i_dbm dbm.h
10193eval $hasproto
10194
b4eb6b3d
JH
10195: see if difftime exists
10196set difftime d_difftime
10197eval $inlibc
10198
10199: see if this is a dirent system
10200echo " "
10201if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10202 val="$define"
10203 echo "<dirent.h> found." >&4
10204else
10205 val="$undef"
10206 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10207 echo "<sys/dir.h> found." >&4
10208 echo " "
10209 else
10210 xinc=`./findhdr sys/ndir.h`
10211 fi
10212 echo "<dirent.h> NOT found." >&4
10213fi
10214set i_dirent
10215eval $setvar
10216
10217: Look for type of directory structure.
10218echo " "
10219$cppstdin $cppflags $cppminus < "$xinc" > try.c
10220
10221case "$direntrytype" in
10222''|' ')
10223 case "$i_dirent" in
10224 $define) guess1='struct dirent' ;;
10225 *) guess1='struct direct' ;;
10226 esac
10227 ;;
10228*) guess1="$direntrytype"
10229 ;;
10230esac
10231
10232case "$guess1" in
10233'struct dirent') guess2='struct direct' ;;
10234*) guess2='struct dirent' ;;
10235esac
10236
10237if $contains "$guess1" try.c >/dev/null 2>&1; then
10238 direntrytype="$guess1"
10239 echo "Your directory entries are $direntrytype." >&4
10240elif $contains "$guess2" try.c >/dev/null 2>&1; then
10241 direntrytype="$guess2"
10242 echo "Your directory entries seem to be $direntrytype." >&4
10243else
10244 echo "I don't recognize your system's directory entries." >&4
10245 rp="What type is used for directory entries on this system?"
10246 dflt="$guess1"
10247 . ./myread
10248 direntrytype="$ans"
10249fi
10250$rm -f try.c
10251
10252
10253: see if the directory entry stores field length
10254echo " "
10255$cppstdin $cppflags $cppminus < "$xinc" > try.c
10256if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10257 echo "Good, your directory entry keeps length information in d_namlen." >&4
10258 val="$define"
10259else
10260 echo "Your directory entry does not know about the d_namlen field." >&4
10261 val="$undef"
10262fi
10263set d_dirnamlen
10264eval $setvar
10265$rm -f try.c
10266
ae0e3d3b
JH
10267: see if this is an sysdir system
10268set sys/dir.h i_sysdir
10269eval $inhdr
10270
10271: see if this is an sysndir system
10272set sys/ndir.h i_sysndir
10273eval $inhdr
10274
10275: Look for dirfd
10276echo " "
10277$cat >dirfd.c <<EOM
10278#include <stdio.h>
10279#$i_dirent I_DIRENT /**/
10280#$i_sysdir I_SYS_DIR /**/
10281#$i_sysndir I_SYS_NDIR /**/
10282#$i_systypes I_SYS_TYPES /**/
10283#if defined(I_SYS_TYPES)
10284#include <sys/types.h>
10285#endif
10286#if defined(I_DIRENT)
10287#include <dirent.h>
10288#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10289#include <sys/dir.h>
10290#endif
10291#else
10292#ifdef I_SYS_NDIR
10293#include <sys/ndir.h>
10294#else
10295#ifdef I_SYS_DIR
10296#ifdef hp9000s500
10297#include <ndir.h> /* may be wrong in the future */
10298#else
10299#include <sys/dir.h>
10300#endif
10301#endif
10302#endif
10303#endif
10304int main() {
10305 DIR *dirp = opendir(".");
10306 if (dirfd(dirp) >= 0)
10307 exit(0);
10308 else
10309 exit(1);
10310}
10311EOM
10312set dirfd
10313if eval $compile; then
10314 val="$define"
10315fi
10316case "$val" in
10317$define) echo "dirfd() found." >&4 ;;
10318*) echo "dirfd() NOT found." >&4 ;;
10319esac
10320set d_dirfd
10321eval $setvar
10322$rm -f dirfd*
10323
b4eb6b3d
JH
10324: see if dlerror exists
10325xxx_runnm="$runnm"
10326runnm=false
10327set dlerror d_dlerror
10328eval $inlibc
10329runnm="$xxx_runnm"
10330
10331: see if dlfcn is available
10332set dlfcn.h i_dlfcn
10333eval $inhdr
10334
10335case "$usedl" in
10336$define|y|true)
10337 $cat << EOM
10338
10339On a few systems, the dynamically loaded modules that perl generates and uses
10340will need a different extension than shared libs. The default will probably
10341be appropriate.
10342
10343EOM
10344 case "$dlext" in
10345 '') dflt="$so" ;;
10346 *) dflt="$dlext" ;;
10347 esac
10348 rp='What is the extension of dynamically loaded modules'
10349 . ./myread
10350 dlext="$ans"
10351 ;;
10352*)
10353 dlext="none"
10354 ;;
10355esac
10356
10357: Check if dlsym need a leading underscore
10358echo " "
10359val="$undef"
10360
10361case "$dlsrc" in
10362dl_dlopen.xs)
10363 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10364 $cat >dyna.c <<'EOM'
10365fred () { }
10366EOM
10367
10368$cat >fred.c<<EOM
10369
10370#include <stdio.h>
10371#$i_dlfcn I_DLFCN
10372#ifdef I_DLFCN
5440bc8e 10373#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
10374#else
10375#include <sys/types.h>
10376#include <nlist.h>
10377#include <link.h>
10378#endif
10379
10380extern int fred() ;
10381
10382int main()
10383{
10384 void * handle ;
10385 void * symbol ;
10386#ifndef RTLD_LAZY
10387 int mode = 1 ;
10388#else
10389 int mode = RTLD_LAZY ;
10390#endif
10391 handle = dlopen("./dyna.$dlext", mode) ;
10392 if (handle == NULL) {
10393 printf ("1\n") ;
10394 fflush (stdout) ;
10395 exit(0);
10396 }
10397 symbol = dlsym(handle, "fred") ;
10398 if (symbol == NULL) {
10399 /* try putting a leading underscore */
10400 symbol = dlsym(handle, "_fred") ;
10401 if (symbol == NULL) {
10402 printf ("2\n") ;
10403 fflush (stdout) ;
10404 exit(0);
10405 }
10406 printf ("3\n") ;
10407 }
10408 else
10409 printf ("4\n") ;
10410 fflush (stdout) ;
10411 exit(0);
10412}
10413EOM
10414 : Call the object file tmp-dyna.o in case dlext=o.
10415 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10416 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 10417 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
10418 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10419 xxx=`$run ./fred`
b4eb6b3d
JH
10420 case $xxx in
10421 1) echo "Test program failed using dlopen." >&4
10422 echo "Perhaps you should not use dynamic loading." >&4;;
10423 2) echo "Test program failed using dlsym." >&4
10424 echo "Perhaps you should not use dynamic loading." >&4;;
10425 3) echo "dlsym needs a leading underscore" >&4
10426 val="$define" ;;
10427 4) echo "dlsym doesn't need a leading underscore." >&4;;
10428 esac
10429 else
10430 echo "I can't compile and run the test program." >&4
10431 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10432 fi
10433 ;;
10434esac
10435
3c728e00 10436$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
10437
10438set d_dlsymun
10439eval $setvar
10440
10bc17b6
JH
10441: see if drand48_r exists
10442set drand48_r d_drand48_r
10443eval $inlibc
10444case "$d_drand48_r" in
10445"$define")
10446 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
10447 case "$d_drand48_r_proto:$usethreads" in
10448 ":define") d_drand48_r_proto=define
a48ec845
JH
10449 set d_drand48_r_proto drand48_r $hdrs
10450 eval $hasproto ;;
10451 *) ;;
10452 esac
10453 case "$d_drand48_r_proto" in
10454 define)
10bc17b6
JH
10455 case "$drand48_r_proto" in
10456 ''|0) try='int drand48_r(struct drand48_data*, double*);'
10457 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10458 esac
10459 case "$drand48_r_proto" in
90e831dc 10460 ''|0) d_drand48_r=undef
10bc17b6 10461 drand48_r_proto=0
a48ec845 10462 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10463 * ) case "$drand48_r_proto" in
10464 REENTRANT_PROTO*) ;;
10465 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10466 esac
10467 echo "Prototype: $try" ;;
10468 esac
10469 ;;
c18e646a
JH
10470 *) case "$usethreads" in
10471 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10472 esac
90e831dc
SB
10473 d_drand48_r=undef
10474 drand48_r_proto=0
c18e646a 10475 ;;
a48ec845
JH
10476 esac
10477 ;;
10bc17b6
JH
10478*) drand48_r_proto=0
10479 ;;
10480esac
10481
10482: see if prototype for drand48 is available
10483echo " "
10484set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10485eval $hasproto
10486
b4eb6b3d
JH
10487: see if dup2 exists
10488set dup2 d_dup2
10489eval $inlibc
10490
10491: see if eaccess exists
10492set eaccess d_eaccess
10493eval $inlibc
10494
10495: see if endgrent exists
10496set endgrent d_endgrent
10497eval $inlibc
10498
10bc17b6
JH
10499: see if this is an grp system
10500set grp.h i_grp
10501eval $inhdr
10502
10503case "$i_grp" in
10504$define)
10505 xxx=`./findhdr grp.h`
10506 $cppstdin $cppflags $cppminus < $xxx >$$.h
10507
10508 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10509 val="$define"
10510 else
10511 val="$undef"
10512 fi
10513 set d_grpasswd
10514 eval $setvar
10515
10516 $rm -f $$.h
10517 ;;
10518*)
10519 val="$undef";
10520 set d_grpasswd; eval $setvar
10521 ;;
10522esac
10523
10524: see if endgrent_r exists
10525set endgrent_r d_endgrent_r
10526eval $inlibc
10527case "$d_endgrent_r" in
10528"$define")
10529 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
10530 case "$d_endgrent_r_proto:$usethreads" in
10531 ":define") d_endgrent_r_proto=define
a48ec845
JH
10532 set d_endgrent_r_proto endgrent_r $hdrs
10533 eval $hasproto ;;
10534 *) ;;
10535 esac
10536 case "$d_endgrent_r_proto" in
10537 define)
10bc17b6
JH
10538 case "$endgrent_r_proto" in
10539 ''|0) try='int endgrent_r(FILE**);'
10540 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10541 esac
10542 case "$endgrent_r_proto" in
10543 ''|0) try='void endgrent_r(FILE**);'
10544 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10545 esac
10546 case "$endgrent_r_proto" in
90e831dc 10547 ''|0) d_endgrent_r=undef
10bc17b6 10548 endgrent_r_proto=0
a48ec845 10549 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10550 * ) case "$endgrent_r_proto" in
10551 REENTRANT_PROTO*) ;;
10552 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10553 esac
10554 echo "Prototype: $try" ;;
10555 esac
10556 ;;
c18e646a
JH
10557 *) case "$usethreads" in
10558 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10559 esac
90e831dc
SB
10560 d_endgrent_r=undef
10561 endgrent_r_proto=0
c18e646a 10562 ;;
a48ec845
JH
10563 esac
10564 ;;
10bc17b6
JH
10565*) endgrent_r_proto=0
10566 ;;
10567esac
10568
b4eb6b3d
JH
10569: see if endhostent exists
10570set endhostent d_endhent
10571eval $inlibc
10572
10bc17b6
JH
10573: see if this is a netdb.h system
10574set netdb.h i_netdb
10575eval $inhdr
10576
10577: see if endhostent_r exists
10578set endhostent_r d_endhostent_r
10579eval $inlibc
10580case "$d_endhostent_r" in
10581"$define")
10582 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10583 case "$d_endhostent_r_proto:$usethreads" in
10584 ":define") d_endhostent_r_proto=define
a48ec845
JH
10585 set d_endhostent_r_proto endhostent_r $hdrs
10586 eval $hasproto ;;
10587 *) ;;
10588 esac
10589 case "$d_endhostent_r_proto" in
10590 define)
10bc17b6
JH
10591 case "$endhostent_r_proto" in
10592 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 10593 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
10594 esac
10595 case "$endhostent_r_proto" in
10596 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 10597 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
10598 esac
10599 case "$endhostent_r_proto" in
90e831dc 10600 ''|0) d_endhostent_r=undef
10bc17b6 10601 endhostent_r_proto=0
a48ec845 10602 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10603 * ) case "$endhostent_r_proto" in
10604 REENTRANT_PROTO*) ;;
10605 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10606 esac
10607 echo "Prototype: $try" ;;
10608 esac
10609 ;;
c18e646a
JH
10610 *) case "$usethreads" in
10611 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10612 esac
90e831dc
SB
10613 d_endhostent_r=undef
10614 endhostent_r_proto=0
c18e646a 10615 ;;
a48ec845
JH
10616 esac
10617 ;;
10bc17b6
JH
10618*) endhostent_r_proto=0
10619 ;;
10620esac
10621
b4eb6b3d
JH
10622: see if endnetent exists
10623set endnetent d_endnent
10624eval $inlibc
10625
10bc17b6
JH
10626: see if endnetent_r exists
10627set endnetent_r d_endnetent_r
10628eval $inlibc
10629case "$d_endnetent_r" in
10630"$define")
10631 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10632 case "$d_endnetent_r_proto:$usethreads" in
10633 ":define") d_endnetent_r_proto=define
a48ec845
JH
10634 set d_endnetent_r_proto endnetent_r $hdrs
10635 eval $hasproto ;;
10636 *) ;;
10637 esac
10638 case "$d_endnetent_r_proto" in
10639 define)
10bc17b6
JH
10640 case "$endnetent_r_proto" in
10641 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 10642 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
10643 esac
10644 case "$endnetent_r_proto" in
10645 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 10646 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
10647 esac
10648 case "$endnetent_r_proto" in
90e831dc 10649 ''|0) d_endnetent_r=undef
10bc17b6 10650 endnetent_r_proto=0
a48ec845 10651 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10652 * ) case "$endnetent_r_proto" in
10653 REENTRANT_PROTO*) ;;
10654 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10655 esac
10656 echo "Prototype: $try" ;;
10657 esac
10658 ;;
c18e646a
JH
10659 *) case "$usethreads" in
10660 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10661 esac
90e831dc
SB
10662 d_endnetent_r=undef
10663 endnetent_r_proto=0
c18e646a 10664 ;;
a48ec845
JH
10665 esac
10666 ;;
10bc17b6
JH
10667*) endnetent_r_proto=0
10668 ;;
10669esac
10670
b4eb6b3d
JH
10671: see if endprotoent exists
10672set endprotoent d_endpent
10673eval $inlibc
10674
10bc17b6
JH
10675: see if endprotoent_r exists
10676set endprotoent_r d_endprotoent_r
10677eval $inlibc
10678case "$d_endprotoent_r" in
10679"$define")
10680 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10681 case "$d_endprotoent_r_proto:$usethreads" in
10682 ":define") d_endprotoent_r_proto=define
a48ec845
JH
10683 set d_endprotoent_r_proto endprotoent_r $hdrs
10684 eval $hasproto ;;
10685 *) ;;
10686 esac
10687 case "$d_endprotoent_r_proto" in
10688 define)
10bc17b6
JH
10689 case "$endprotoent_r_proto" in
10690 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 10691 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
10692 esac
10693 case "$endprotoent_r_proto" in
10694 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 10695 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
10696 esac
10697 case "$endprotoent_r_proto" in
90e831dc 10698 ''|0) d_endprotoent_r=undef
10bc17b6 10699 endprotoent_r_proto=0
a48ec845 10700 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10701 * ) case "$endprotoent_r_proto" in
10702 REENTRANT_PROTO*) ;;
10703 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10704 esac
10705 echo "Prototype: $try" ;;
10706 esac
10707 ;;
c18e646a
JH
10708 *) case "$usethreads" in
10709 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10710 esac
90e831dc
SB
10711 d_endprotoent_r=undef
10712 endprotoent_r_proto=0
c18e646a 10713 ;;
a48ec845
JH
10714 esac
10715 ;;
10bc17b6
JH
10716*) endprotoent_r_proto=0
10717 ;;
10718esac
10719
b4eb6b3d
JH
10720: see if endpwent exists
10721set endpwent d_endpwent
10722eval $inlibc
10723
10bc17b6
JH
10724: see if this is a pwd.h system
10725set pwd.h i_pwd
10726eval $inhdr
10727
10728case "$i_pwd" in
10729$define)
10730 xxx=`./findhdr pwd.h`
10731 $cppstdin $cppflags $cppminus < $xxx >$$.h
10732
10733 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10734 val="$define"
10735 else
10736 val="$undef"
10737 fi
10738 set d_pwquota
10739 eval $setvar
10740
10741 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10742 val="$define"
10743 else
10744 val="$undef"
10745 fi
10746 set d_pwage
10747 eval $setvar
10748
10749 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10750 val="$define"
10751 else
10752 val="$undef"
10753 fi
10754 set d_pwchange
10755 eval $setvar
10756
10757 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10758 val="$define"
10759 else
10760 val="$undef"
10761 fi
10762 set d_pwclass
10763 eval $setvar
10764
10765 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10766 val="$define"
10767 else
10768 val="$undef"
10769 fi
10770 set d_pwexpire
10771 eval $setvar
10772
10773 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10774 val="$define"
10775 else
10776 val="$undef"
10777 fi
10778 set d_pwcomment
10779 eval $setvar
10780
10781 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10782 val="$define"
10783 else
10784 val="$undef"
10785 fi
10786 set d_pwgecos
10787 eval $setvar
10788
10789 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10790 val="$define"
10791 else
10792 val="$undef"
10793 fi
10794 set d_pwpasswd
10795 eval $setvar
10796
10797 $rm -f $$.h
10798 ;;
10799*)
10800 val="$undef";
10801 set d_pwquota; eval $setvar
10802 set d_pwage; eval $setvar
10803 set d_pwchange; eval $setvar
10804 set d_pwclass; eval $setvar
10805 set d_pwexpire; eval $setvar
10806 set d_pwcomment; eval $setvar
10807 set d_pwgecos; eval $setvar
10808 set d_pwpasswd; eval $setvar
10809 ;;
10810esac
10811
10812: see if endpwent_r exists
10813set endpwent_r d_endpwent_r
10814eval $inlibc
10815case "$d_endpwent_r" in
10816"$define")
10817 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
10818 case "$d_endpwent_r_proto:$usethreads" in
10819 ":define") d_endpwent_r_proto=define
a48ec845
JH
10820 set d_endpwent_r_proto endpwent_r $hdrs
10821 eval $hasproto ;;
10822 *) ;;
10823 esac
10824 case "$d_endpwent_r_proto" in
10825 define)
10bc17b6
JH
10826 case "$endpwent_r_proto" in
10827 ''|0) try='int endpwent_r(FILE**);'
10828 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10829 esac
10830 case "$endpwent_r_proto" in
10831 ''|0) try='void endpwent_r(FILE**);'
10832 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10833 esac
10834 case "$endpwent_r_proto" in
90e831dc 10835 ''|0) d_endpwent_r=undef
10bc17b6 10836 endpwent_r_proto=0
a48ec845 10837 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10838 * ) case "$endpwent_r_proto" in
10839 REENTRANT_PROTO*) ;;
10840 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10841 esac
10842 echo "Prototype: $try" ;;
10843 esac
10844 ;;
c18e646a
JH
10845 *) case "$usethreads" in
10846 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10847 esac
90e831dc
SB
10848 d_endpwent_r=undef
10849 endpwent_r_proto=0
c18e646a 10850 ;;
a48ec845
JH
10851 esac
10852 ;;
10bc17b6
JH
10853*) endpwent_r_proto=0
10854 ;;
10855esac
10856
b4eb6b3d
JH
10857: see if endservent exists
10858set endservent d_endsent
10859eval $inlibc
10860
10bc17b6
JH
10861: see if endservent_r exists
10862set endservent_r d_endservent_r
10863eval $inlibc
10864case "$d_endservent_r" in
10865"$define")
10866 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10867 case "$d_endservent_r_proto:$usethreads" in
10868 ":define") d_endservent_r_proto=define
a48ec845
JH
10869 set d_endservent_r_proto endservent_r $hdrs
10870 eval $hasproto ;;
10871 *) ;;
10872 esac
10873 case "$d_endservent_r_proto" in
10874 define)
10bc17b6
JH
10875 case "$endservent_r_proto" in
10876 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 10877 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
10878 esac
10879 case "$endservent_r_proto" in
10880 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 10881 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
10882 esac
10883 case "$endservent_r_proto" in
90e831dc 10884 ''|0) d_endservent_r=undef
10bc17b6 10885 endservent_r_proto=0
a48ec845 10886 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10887 * ) case "$endservent_r_proto" in
10888 REENTRANT_PROTO*) ;;
10889 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10890 esac
10891 echo "Prototype: $try" ;;
10892 esac
10893 ;;
c18e646a
JH
10894 *) case "$usethreads" in
10895 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10896 esac
90e831dc
SB
10897 d_endservent_r=undef
10898 endservent_r_proto=0
c18e646a 10899 ;;
a48ec845
JH
10900 esac
10901 ;;
10bc17b6
JH
10902*) endservent_r_proto=0
10903 ;;
10904esac
10905
b4eb6b3d
JH
10906: Locate the flags for 'open()'
10907echo " "
5440bc8e 10908$cat >try.c <<'EOCP'
b4eb6b3d
JH
10909#include <sys/types.h>
10910#ifdef I_FCNTL
10911#include <fcntl.h>
10912#endif
10913#ifdef I_SYS_FILE
10914#include <sys/file.h>
10915#endif
10916int main() {
10917 if(O_RDONLY);
10918#ifdef O_TRUNC
10919 exit(0);
10920#else
10921 exit(1);
10922#endif
10923}
10924EOCP
10925: check sys/file.h first to get FREAD on Sun
10926if $test `./findhdr sys/file.h` && \
5440bc8e 10927 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
10928 h_sysfile=true;
10929 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 10930 if $run ./try; then
b4eb6b3d
JH
10931 echo "and you have the 3 argument form of open()." >&4
10932 val="$define"
10933 else
10934 echo "but not the 3 argument form of open(). Oh, well." >&4
10935 val="$undef"
10936 fi
10937elif $test `./findhdr fcntl.h` && \
5440bc8e 10938 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
10939 h_fcntl=true;
10940 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 10941 if $run ./try; then
b4eb6b3d
JH
10942 echo "and you have the 3 argument form of open()." >&4
10943 val="$define"
10944 else
10945 echo "but not the 3 argument form of open(). Oh, well." >&4
10946 val="$undef"
10947 fi
10948else
10949 val="$undef"
10950 echo "I can't find the O_* constant definitions! You got problems." >&4
10951fi
10952set d_open3
10953eval $setvar
5440bc8e 10954$rm -f try try.*
b4eb6b3d
JH
10955
10956: see which of string.h or strings.h is needed
10957echo " "
10958strings=`./findhdr string.h`
10959if $test "$strings" && $test -r "$strings"; then
10960 echo "Using <string.h> instead of <strings.h>." >&4
10961 val="$define"
10962else
10963 val="$undef"
10964 strings=`./findhdr strings.h`
10965 if $test "$strings" && $test -r "$strings"; then
10966 echo "Using <strings.h> instead of <string.h>." >&4
10967 else
10968 echo "No string header found -- You'll surely have problems." >&4
10969 fi
10970fi
10971set i_string
10972eval $setvar
10973case "$i_string" in
10974"$undef") strings=`./findhdr strings.h`;;
10975*) strings=`./findhdr string.h`;;
10976esac
10977
3c728e00
JH
10978: see if this is a sys/file.h system
10979val=''
10980set sys/file.h val
10981eval $inhdr
10982
10983: do we need to include sys/file.h ?
10984case "$val" in
10985"$define")
10986 echo " "
10987 if $h_sysfile; then
10988 val="$define"
10989 echo "We'll be including <sys/file.h>." >&4
10990 else
10991 val="$undef"
10992 echo "We won't be including <sys/file.h>." >&4
10993 fi
10994 ;;
10995*)
10996 h_sysfile=false
10997 ;;
10998esac
10999set i_sysfile
11000eval $setvar
11001
11002: see if fcntl.h is there
11003val=''
11004set fcntl.h val
11005eval $inhdr
11006
11007: see if we can include fcntl.h
11008case "$val" in
11009"$define")
11010 echo " "
11011 if $h_fcntl; then
11012 val="$define"
11013 echo "We'll be including <fcntl.h>." >&4
11014 else
11015 val="$undef"
11016 if $h_sysfile; then
11017 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11018 else
11019 echo "We won't be including <fcntl.h>." >&4
11020 fi
11021 fi
11022 ;;
11023*)
11024 h_fcntl=false
11025 val="$undef"
11026 ;;
11027esac
11028set i_fcntl
11029eval $setvar
11030
b4eb6b3d
JH
11031: check for non-blocking I/O stuff
11032case "$h_sysfile" in
a0acbdc3
JH
11033true) echo "#include <sys/file.h>" > head.c;;
11034*)
11035 case "$h_fcntl" in
11036 true) echo "#include <fcntl.h>" > head.c;;
11037 *) echo "#include <sys/fcntl.h>" > head.c;;
11038 esac
11039 ;;
b4eb6b3d
JH
11040esac
11041echo " "
11042echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11043case "$o_nonblock" in
11044'')
11045 $cat head.c > try.c
3c728e00 11046 $cat >>try.c <<EOCP
b4eb6b3d 11047#include <stdio.h>
80b3ef99 11048#include <stdlib.h>
3c728e00
JH
11049#$i_fcntl I_FCNTL
11050#ifdef I_FCNTL
11051#include <fcntl.h>
11052#endif
b4eb6b3d
JH
11053int main() {
11054#ifdef O_NONBLOCK
11055 printf("O_NONBLOCK\n");
11056 exit(0);
11057#endif
11058#ifdef O_NDELAY
11059 printf("O_NDELAY\n");
11060 exit(0);
11061#endif
11062#ifdef FNDELAY
11063 printf("FNDELAY\n");
11064 exit(0);
11065#endif
11066 exit(0);
11067}
11068EOCP
11069 set try
11070 if eval $compile_ok; then
5440bc8e 11071 o_nonblock=`$run ./try`
b4eb6b3d
JH
11072 case "$o_nonblock" in
11073 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11074 *) echo "Seems like we can use $o_nonblock.";;
11075 esac
11076 else
11077 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11078 fi
11079 ;;
11080*) echo "Using $hint value $o_nonblock.";;
11081esac
11082$rm -f try try.* .out core
11083
11084echo " "
11085echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11086case "$eagain" in
11087'')
11088 $cat head.c > try.c
11089 $cat >>try.c <<EOCP
11090#include <errno.h>
11091#include <sys/types.h>
11092#include <signal.h>
11093#include <stdio.h>
80b3ef99 11094#include <stdlib.h>
1deb0a86
JH
11095#$i_fcntl I_FCNTL
11096#ifdef I_FCNTL
11097#include <fcntl.h>
11098#endif
b4eb6b3d
JH
11099#define MY_O_NONBLOCK $o_nonblock
11100#ifndef errno /* XXX need better Configure test */
11101extern int errno;
11102#endif
11103#$i_unistd I_UNISTD
11104#ifdef I_UNISTD
11105#include <unistd.h>
11106#endif
11107#$i_string I_STRING
11108#ifdef I_STRING
11109#include <string.h>
11110#else
11111#include <strings.h>
11112#endif
11113$signal_t blech(x) int x; { exit(3); }
11114EOCP
11115 $cat >> try.c <<'EOCP'
11116int main()
11117{
11118 int pd[2];
11119 int pu[2];
11120 char buf[1];
11121 char string[100];
11122
11123 pipe(pd); /* Down: child -> parent */
11124 pipe(pu); /* Up: parent -> child */
11125 if (0 != fork()) {
11126 int ret;
11127 close(pd[1]); /* Parent reads from pd[0] */
11128 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11129#ifdef F_SETFL
b4eb6b3d
JH
11130 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11131 exit(1);
a0acbdc3
JH
11132#else
11133 exit(4);
11134#endif
b4eb6b3d
JH
11135 signal(SIGALRM, blech);
11136 alarm(5);
11137 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11138 exit(2);
11139 sprintf(string, "%d\n", ret);
11140 write(2, string, strlen(string));
11141 alarm(0);
11142#ifdef EAGAIN
11143 if (errno == EAGAIN) {
11144 printf("EAGAIN\n");
11145 goto ok;
11146 }
11147#endif
11148#ifdef EWOULDBLOCK
11149 if (errno == EWOULDBLOCK)
11150 printf("EWOULDBLOCK\n");
11151#endif
11152 ok:
11153 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11154 sleep(2); /* Give it time to close our pipe */
11155 alarm(5);
11156 ret = read(pd[0], buf, 1); /* Should read EOF */
11157 alarm(0);
11158 sprintf(string, "%d\n", ret);
868439a2 11159 write(4, string, strlen(string));
b4eb6b3d
JH
11160 exit(0);
11161 }
11162
11163 close(pd[0]); /* We write to pd[1] */
11164 close(pu[1]); /* We read from pu[0] */
11165 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11166 close(pd[1]); /* Pipe pd is now fully closed! */
11167 exit(0); /* Bye bye, thank you for playing! */
11168}
11169EOCP
11170 set try
11171 if eval $compile_ok; then
11172 echo "$startsh" >mtry
868439a2 11173 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11174 chmod +x mtry
11175 ./mtry >/dev/null 2>&1
11176 case $? in
11177 0) eagain=`$cat try.out`;;
11178 1) echo "Could not perform non-blocking setting!";;
11179 2) echo "I did a successful read() for something that was not there!";;
11180 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11181 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11182 *) echo "Something terribly wrong happened during testing.";;
11183 esac
11184 rd_nodata=`$cat try.ret`
11185 echo "A read() system call with no data present returns $rd_nodata."
11186 case "$rd_nodata" in
11187 0|-1) ;;
11188 *)
11189 echo "(That's peculiar, fixing that to be -1.)"
11190 rd_nodata=-1
11191 ;;
11192 esac
11193 case "$eagain" in
11194 '')
11195 echo "Forcing errno EAGAIN on read() with no data available."
11196 eagain=EAGAIN
11197 ;;
11198 *)
11199 echo "Your read() sets errno to $eagain when no data is available."
11200 ;;
11201 esac
11202 status=`$cat try.err`
11203 case "$status" in
11204 0) echo "And it correctly returns 0 to signal EOF.";;
11205 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11206 *) echo "However, your read() returns '$status' on EOF??";;
11207 esac
11208 val="$define"
11209 if test "$status" = "$rd_nodata"; then
11210 echo "WARNING: you can't distinguish between EOF and no data!"
11211 val="$undef"
11212 fi
11213 else
11214 echo "I can't compile the test program--assuming errno EAGAIN will do."
11215 eagain=EAGAIN
11216 fi
11217 set d_eofnblk
11218 eval $setvar
11219 ;;
11220*)
11221 echo "Using $hint value $eagain."
11222 echo "Your read() returns $rd_nodata when no data is present."
11223 case "$d_eofnblk" in
11224 "$define") echo "And you can see EOF because read() returns 0.";;
11225 "$undef") echo "But you can't see EOF status from read() returned value.";;
11226 *)
11227 echo "(Assuming you can't see EOF status from read anyway.)"
11228 d_eofnblk=$undef
11229 ;;
11230 esac
11231 ;;
11232esac
11233$rm -f try try.* .out core head.c mtry
11234
b363b713
JH
11235: see if fchdir exists
11236set fchdir d_fchdir
11237eval $inlibc
11238
b4eb6b3d
JH
11239: see if fchmod exists
11240set fchmod d_fchmod
11241eval $inlibc
11242
11243: see if fchown exists
11244set fchown d_fchown
11245eval $inlibc
11246
11247: see if this is an fcntl system
11248set fcntl d_fcntl
11249eval $inlibc
11250
9d9004a9
AD
11251echo " "
11252: See if fcntl-based locking works.
832492ee 11253$cat >try.c <<EOCP
9d9004a9
AD
11254#include <stdlib.h>
11255#include <unistd.h>
11256#include <fcntl.h>
832492ee 11257#include <signal.h>
832492ee 11258$signal_t blech(x) int x; { exit(3); }
9d9004a9
AD
11259int main() {
11260#if defined(F_SETLK) && defined(F_SETLKW)
11261 struct flock flock;
11262 int retval, fd;
11263 fd = open("try.c", O_RDONLY);
11264 flock.l_type = F_RDLCK;
11265 flock.l_whence = SEEK_SET;
11266 flock.l_start = flock.l_len = 0;
832492ee
JH
11267 signal(SIGALRM, blech);
11268 alarm(10);
9d9004a9
AD
11269 retval = fcntl(fd, F_SETLK, &flock);
11270 close(fd);
11271 (retval < 0 ? exit(2) : exit(0));
11272#else
11273 exit(2);
11274#endif
11275}
11276EOCP
11277echo "Checking if fcntl-based file locking works... "
11278case "$d_fcntl" in
11279"$define")
11280 set try
11281 if eval $compile_ok; then
5440bc8e 11282 if $run ./try; then
9d9004a9
AD
11283 echo "Yes, it seems to work."
11284 val="$define"
11285 else
11286 echo "Nope, it didn't work."
11287 val="$undef"
832492ee
JH
11288 case "$?" in
11289 3) $cat >&4 <<EOM
11290***
11291*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11292*** This is (almost) impossible.
11293*** If your NFS lock daemons are not feeling well, something like
11294*** this may happen, please investigate. Cannot continue, aborting.
11295***
11296EOM
11297 exit 1
11298 ;;
11299 esac
9d9004a9
AD
11300 fi
11301 else
11302 echo "I'm unable to compile the test program, so I'll assume not."
11303 val="$undef"
11304 fi
11305 ;;
11306*) val="$undef";
11307 echo "Nope, since you don't even have fcntl()."
11308 ;;
11309esac
11310set d_fcntl_can_lock
11311eval $setvar
11312$rm -f try*
11313
11314
b4eb6b3d
JH
11315: check for fd_set items
11316$cat <<EOM
11317
11318Checking to see how well your C compiler handles fd_set and friends ...
11319EOM
5440bc8e 11320$cat >try.c <<EOCP
b4eb6b3d
JH
11321#$i_systime I_SYS_TIME
11322#$i_sysselct I_SYS_SELECT
11323#$d_socket HAS_SOCKET
11324#include <sys/types.h>
11325#ifdef HAS_SOCKET
11326#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11327#endif
11328#ifdef I_SYS_TIME
11329#include <sys/time.h>
11330#endif
11331#ifdef I_SYS_SELECT
11332#include <sys/select.h>
11333#endif
11334int main() {
11335 fd_set fds;
11336
11337#ifdef TRYBITS
11338 if(fds.fds_bits);
11339#endif
11340
11341#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11342 exit(0);
11343#else
11344 exit(1);
11345#endif
11346}
11347EOCP
5440bc8e 11348set try -DTRYBITS
b4eb6b3d
JH
11349if eval $compile; then
11350 d_fds_bits="$define"
11351 d_fd_set="$define"
11352 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 11353 if $run ./try; then
b4eb6b3d
JH
11354 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11355 d_fd_macros="$define"
11356 else
11357 $cat >&4 <<'EOM'
11358but not the normal fd_set macros! Gaaack! I'll have to cover for you.
11359EOM
11360 d_fd_macros="$undef"
11361 fi
11362else
11363 $cat <<'EOM'
11364Hmm, your compiler has some difficulty with fd_set. Checking further...
11365EOM
5440bc8e 11366 set try
b4eb6b3d
JH
11367 if eval $compile; then
11368 d_fds_bits="$undef"
11369 d_fd_set="$define"
11370 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 11371 if $run ./try; then
b4eb6b3d
JH
11372 echo "and you have the normal fd_set macros." >&4
11373 d_fd_macros="$define"
11374 else
11375 $cat <<'EOM'
11376but not the normal fd_set macros! Gross! More work for me...
11377EOM
11378 d_fd_macros="$undef"
11379 fi
11380 else
11381 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
11382 d_fd_set="$undef"
11383 d_fds_bits="$undef"
11384 d_fd_macros="$undef"
11385 fi
11386fi
5440bc8e 11387$rm -f try try.*
b4eb6b3d
JH
11388
11389: see if fgetpos exists
11390set fgetpos d_fgetpos
11391eval $inlibc
11392
758a5d79
JH
11393: see if finite exists
11394set finite d_finite
11395eval $inlibc
11396
11397: see if finitel exists
11398set finitel d_finitel
11399eval $inlibc
11400
b4eb6b3d
JH
11401: see if flock exists
11402set flock d_flock
11403eval $inlibc
11404
2ef53570
JH
11405: see if prototype for flock is available
11406echo " "
11407set d_flockproto flock $i_sysfile sys/file.h
11408eval $hasproto
11409
b4eb6b3d
JH
11410: see if fork exists
11411set fork d_fork
11412eval $inlibc
11413
758a5d79
JH
11414: see if fp_class exists
11415set fp_class d_fp_class
11416eval $inlibc
11417
b4eb6b3d
JH
11418: see if pathconf exists
11419set pathconf d_pathconf
11420eval $inlibc
11421
11422: see if fpathconf exists
11423set fpathconf d_fpathconf
11424eval $inlibc
11425
758a5d79
JH
11426: see if fpclass exists
11427set fpclass d_fpclass
11428eval $inlibc
11429
11430: see if fpclassify exists
11431set fpclassify d_fpclassify
11432eval $inlibc
11433
11434: see if fpclassl exists
11435set fpclassl d_fpclassl
11436eval $inlibc
11437
b4eb6b3d
JH
11438
11439: check for fpos64_t
11440echo " "
11441echo "Checking to see if you have fpos64_t..." >&4
11442$cat >try.c <<EOCP
11443#include <stdio.h>
11444int main() { fpos64_t x = 7; }
11445EOCP
11446set try
11447if eval $compile; then
11448 val="$define"
11449 echo "You have fpos64_t."
11450else
11451 val="$undef"
11452 echo "You do not have fpos64_t."
11453 case "$fpossize" in
11454 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11455 esac
11456fi
11457$rm -f try.* try
11458set d_fpos64_t
11459eval $setvar
11460
11461: see if frexpl exists
11462set frexpl d_frexpl
11463eval $inlibc
11464
b4eb6b3d
JH
11465: see if this is a sys/param system
11466set sys/param.h i_sysparam
11467eval $inhdr
11468
11469: see if this is a sys/mount.h system
11470set sys/mount.h i_sysmount
11471eval $inhdr
11472
b4eb6b3d
JH
11473
11474echo " "
11475echo "Checking to see if your system supports struct fs_data..." >&4
11476set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11477eval $hasstruct
11478case "$d_fs_data_s" in
11479"$define") echo "Yes, it does." ;;
11480*) echo "No, it doesn't." ;;
11481esac
11482
11483: see if fseeko exists
11484set fseeko d_fseeko
11485eval $inlibc
11486case "$longsize" in
114878) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11488esac
11489
11490: see if fsetpos exists
11491set fsetpos d_fsetpos
11492eval $inlibc
11493
11494
11495: see if fstatfs exists
11496set fstatfs d_fstatfs
11497eval $inlibc
11498
11499
11500: see if statvfs exists
11501set statvfs d_statvfs
11502eval $inlibc
11503
11504: see if fstatvfs exists
11505set fstatvfs d_fstatvfs
11506eval $inlibc
11507
11508
411ab01c
JH
11509: see if fsync exists
11510set fsync d_fsync
11511eval $inlibc
11512
b4eb6b3d
JH
11513: see if ftello exists
11514set ftello d_ftello
11515eval $inlibc
11516case "$longsize" in
115178) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11518esac
11519
11520: see if getcwd exists
11521set getcwd d_getcwd
11522eval $inlibc
11523
11524: see if getespwnam exists
11525set getespwnam d_getespwnam
11526eval $inlibc
11527
11528
11529: see if getfsstat exists
11530set getfsstat d_getfsstat
11531eval $inlibc
11532
11533: see if getgrent exists
11534set getgrent d_getgrent
11535eval $inlibc
11536
10bc17b6
JH
11537: see if getgrent_r exists
11538set getgrent_r d_getgrent_r
11539eval $inlibc
11540case "$d_getgrent_r" in
11541"$define")
11542 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11543 case "$d_getgrent_r_proto:$usethreads" in
11544 ":define") d_getgrent_r_proto=define
a48ec845
JH
11545 set d_getgrent_r_proto getgrent_r $hdrs
11546 eval $hasproto ;;
11547 *) ;;
11548 esac
11549 case "$d_getgrent_r_proto" in
11550 define)
10bc17b6
JH
11551 case "$getgrent_r_proto" in
11552 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11553 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11554 esac
11555 case "$getgrent_r_proto" in
11556 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11557 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11558 esac
11559 case "$getgrent_r_proto" in
11560 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11561 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11562 esac
11563 case "$getgrent_r_proto" in
11564 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11565 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11566 esac
11567 case "$getgrent_r_proto" in
11568 ''|0) try='int getgrent_r(struct group*, char*, int);'
11569 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11570 esac
11571 case "$getgrent_r_proto" in
11572 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11573 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11574 esac
11575 case "$getgrent_r_proto" in
90e831dc 11576 ''|0) d_getgrent_r=undef
10bc17b6 11577 getgrent_r_proto=0
a48ec845 11578 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11579 * ) case "$getgrent_r_proto" in
11580 REENTRANT_PROTO*) ;;
11581 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11582 esac
11583 echo "Prototype: $try" ;;
11584 esac
11585 ;;
c18e646a
JH
11586 *) case "$usethreads" in
11587 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11588 esac
90e831dc
SB
11589 d_getgrent_r=undef
11590 getgrent_r_proto=0
c18e646a 11591 ;;
a48ec845
JH
11592 esac
11593 ;;
10bc17b6
JH
11594*) getgrent_r_proto=0
11595 ;;
11596esac
11597
11598: see if getgrgid_r exists
11599set getgrgid_r d_getgrgid_r
11600eval $inlibc
11601case "$d_getgrgid_r" in
11602"$define")
11603 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11604 case "$d_getgrgid_r_proto:$usethreads" in
11605 ":define") d_getgrgid_r_proto=define
a48ec845
JH
11606 set d_getgrgid_r_proto getgrgid_r $hdrs
11607 eval $hasproto ;;
11608 *) ;;
11609 esac
11610 case "$d_getgrgid_r_proto" in
11611 define)
10bc17b6
JH
11612 case "$getgrgid_r_proto" in
11613 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11614 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11615 esac
11616 case "$getgrgid_r_proto" in
11617 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11618 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11619 esac
11620 case "$getgrgid_r_proto" in
11621 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11622 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11623 esac
11624 case "$getgrgid_r_proto" in
11625 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11626 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11627 esac
11628 case "$getgrgid_r_proto" in
90e831dc 11629 ''|0) d_getgrgid_r=undef
10bc17b6 11630 getgrgid_r_proto=0
a48ec845 11631 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11632 * ) case "$getgrgid_r_proto" in
11633 REENTRANT_PROTO*) ;;
11634 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11635 esac
11636 echo "Prototype: $try" ;;
11637 esac
11638 ;;
c18e646a
JH
11639 *) case "$usethreads" in
11640 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11641 esac
90e831dc
SB
11642 d_getgrgid_r=undef
11643 getgrgid_r_proto=0
c18e646a 11644 ;;
a48ec845
JH
11645 esac
11646 ;;
10bc17b6
JH
11647*) getgrgid_r_proto=0
11648 ;;
11649esac
11650
11651: see if getgrnam_r exists
11652set getgrnam_r d_getgrnam_r
11653eval $inlibc
11654case "$d_getgrnam_r" in
11655"$define")
11656 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11657 case "$d_getgrnam_r_proto:$usethreads" in
11658 ":define") d_getgrnam_r_proto=define
a48ec845
JH
11659 set d_getgrnam_r_proto getgrnam_r $hdrs
11660 eval $hasproto ;;
11661 *) ;;
11662 esac
11663 case "$d_getgrnam_r_proto" in
11664 define)
10bc17b6
JH
11665 case "$getgrnam_r_proto" in
11666 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11667 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11668 esac
11669 case "$getgrnam_r_proto" in
11670 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11671 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11672 esac
11673 case "$getgrnam_r_proto" in
11674 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11675 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11676 esac
11677 case "$getgrnam_r_proto" in
11678 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11679 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11680 esac
11681 case "$getgrnam_r_proto" in
11682 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11683 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11684 esac
11685 case "$getgrnam_r_proto" in
90e831dc 11686 ''|0) d_getgrnam_r=undef
10bc17b6 11687 getgrnam_r_proto=0
a48ec845 11688 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11689 * ) case "$getgrnam_r_proto" in
11690 REENTRANT_PROTO*) ;;
11691 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11692 esac
11693 echo "Prototype: $try" ;;
11694 esac
11695 ;;
c18e646a
JH
11696 *) case "$usethreads" in
11697 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11698 esac
90e831dc
SB
11699 d_getgrnam_r=undef
11700 getgrnam_r_proto=0
c18e646a 11701 ;;
a48ec845
JH
11702 esac
11703 ;;
10bc17b6
JH
11704*) getgrnam_r_proto=0
11705 ;;
11706esac
11707
b4eb6b3d
JH
11708: see if gethostbyaddr exists
11709set gethostbyaddr d_gethbyaddr
11710eval $inlibc
11711
11712: see if gethostbyname exists
11713set gethostbyname d_gethbyname
11714eval $inlibc
11715
11716: see if gethostent exists
11717set gethostent d_gethent
11718eval $inlibc
11719
11720: see how we will look up host name
11721echo " "
11722call=''
11723if set gethostname val -f d_gethname; eval $csym; $val; then
11724 echo 'gethostname() found.' >&4
11725 d_gethname="$define"
11726 call=gethostname
11727fi
11728if set uname val -f d_uname; eval $csym; $val; then
11729 if ./xenix; then
11730 $cat <<'EOM'
11731uname() was found, but you're running xenix, and older versions of xenix
11732have a broken uname(). If you don't really know whether your xenix is old
11733enough to have a broken system call, use the default answer.
11734
11735EOM
11736 dflt=y
11737 case "$d_uname" in
11738 "$define") dflt=n;;
11739 esac
11740 rp='Is your uname() broken?'
11741 . ./myread
11742 case "$ans" in
11743 n*) d_uname="$define"; call=uname;;
11744 esac
11745 else
11746 echo 'uname() found.' >&4
11747 d_uname="$define"
11748 case "$call" in
11749 '') call=uname ;;
11750 esac
11751 fi
11752fi
11753case "$d_gethname" in
11754'') d_gethname="$undef";;
11755esac
11756case "$d_uname" in
11757'') d_uname="$undef";;
11758esac
11759case "$d_uname$d_gethname" in
11760*define*)
11761 dflt=n
11762 cat <<EOM
11763
11764Every now and then someone has a $call() that lies about the hostname
11765but can't be fixed for political or economic reasons. If you wish, I can
11766pretend $call() isn't there and maybe compute hostname at run-time
11767thanks to the '$phostname' command.
11768
11769EOM
11770 rp="Shall I ignore $call() from now on?"
11771 . ./myread
11772 case "$ans" in
11773 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11774 esac;;
11775esac
11776case "$phostname" in
11777'') aphostname='';;
11778*) case "$aphostname" in
11779 /*) ;;
11780 *) set X $phostname
11781 shift
11782 file=$1
11783 shift
11784 file=`./loc $file $file $pth`
11785 aphostname=`echo $file $*`
11786 ;;
11787 esac
11788 ;;
11789esac
11790case "$d_uname$d_gethname" in
11791*define*) ;;
11792*)
11793 case "$phostname" in
11794 '')
11795 echo "There will be no way for $package to get your hostname." >&4;;
11796 *)
11797 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11798 ;;
11799 esac;;
11800esac
11801case "$d_phostname" in
11802'') d_phostname="$undef";;
11803esac
11804
10bc17b6
JH
11805: see if gethostbyaddr_r exists
11806set gethostbyaddr_r d_gethostbyaddr_r
11807eval $inlibc
11808case "$d_gethostbyaddr_r" in
11809"$define")
11810 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11811 case "$d_gethostbyaddr_r_proto:$usethreads" in
11812 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
11813 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11814 eval $hasproto ;;
11815 *) ;;
11816 esac
11817 case "$d_gethostbyaddr_r_proto" in
11818 define)
10bc17b6
JH
11819 case "$gethostbyaddr_r_proto" in
11820 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11821 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11822 esac
11823 case "$gethostbyaddr_r_proto" in
11824 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11825 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11826 esac
11827 case "$gethostbyaddr_r_proto" in
11828 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11829 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11830 esac
11831 case "$gethostbyaddr_r_proto" in
11832 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11833 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11834 esac
11835 case "$gethostbyaddr_r_proto" in
11836 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11837 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11838 esac
11839 case "$gethostbyaddr_r_proto" in
11840 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11841 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11842 esac
11843 case "$gethostbyaddr_r_proto" in
11844 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11845 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11846 esac
11847 case "$gethostbyaddr_r_proto" in
11848 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11849 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11850 esac
11851 case "$gethostbyaddr_r_proto" in
11852 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11853 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11854 esac
11855 case "$gethostbyaddr_r_proto" in
11856 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11857 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11858 esac
11859 case "$gethostbyaddr_r_proto" in
90e831dc 11860 ''|0) d_gethostbyaddr_r=undef
10bc17b6 11861 gethostbyaddr_r_proto=0
a48ec845 11862 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11863 * ) case "$gethostbyaddr_r_proto" in
11864 REENTRANT_PROTO*) ;;
11865 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11866 esac
11867 echo "Prototype: $try" ;;
11868 esac
11869 ;;
c18e646a
JH
11870 *) case "$usethreads" in
11871 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11872 esac
90e831dc
SB
11873 d_gethostbyaddr_r=undef
11874 gethostbyaddr_r_proto=0
c18e646a 11875 ;;
a48ec845
JH
11876 esac
11877 ;;
10bc17b6
JH
11878*) gethostbyaddr_r_proto=0
11879 ;;
11880esac
11881
11882: see if gethostbyname_r exists
11883set gethostbyname_r d_gethostbyname_r
11884eval $inlibc
11885case "$d_gethostbyname_r" in
11886"$define")
11887 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11888 case "$d_gethostbyname_r_proto:$usethreads" in
11889 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
11890 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11891 eval $hasproto ;;
11892 *) ;;
11893 esac
11894 case "$d_gethostbyname_r_proto" in
11895 define)
10bc17b6
JH
11896 case "$gethostbyname_r_proto" in
11897 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11898 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11899 esac
11900 case "$gethostbyname_r_proto" in
11901 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11902 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11903 esac
11904 case "$gethostbyname_r_proto" in
11905 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11906 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11907 esac
11908 case "$gethostbyname_r_proto" in
90e831dc 11909 ''|0) d_gethostbyname_r=undef
10bc17b6 11910 gethostbyname_r_proto=0
a48ec845 11911 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11912 * ) case "$gethostbyname_r_proto" in
11913 REENTRANT_PROTO*) ;;
11914 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11915 esac
11916 echo "Prototype: $try" ;;
11917 esac
11918 ;;
c18e646a
JH
11919 *) case "$usethreads" in
11920 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11921 esac
90e831dc
SB
11922 d_gethostbyname_r=undef
11923 gethostbyname_r_proto=0
c18e646a 11924 ;;
a48ec845
JH
11925 esac
11926 ;;
10bc17b6
JH
11927*) gethostbyname_r_proto=0
11928 ;;
11929esac
11930
11931: see if gethostent_r exists
11932set gethostent_r d_gethostent_r
11933eval $inlibc
11934case "$d_gethostent_r" in
11935"$define")
11936 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11937 case "$d_gethostent_r_proto:$usethreads" in
11938 ":define") d_gethostent_r_proto=define
a48ec845
JH
11939 set d_gethostent_r_proto gethostent_r $hdrs
11940 eval $hasproto ;;
11941 *) ;;
11942 esac
11943 case "$d_gethostent_r_proto" in
11944 define)
10bc17b6
JH
11945 case "$gethostent_r_proto" in
11946 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11947 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11948 esac
11949 case "$gethostent_r_proto" in
11950 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11951 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11952 esac
11953 case "$gethostent_r_proto" in
11954 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11955 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11956 esac
11957 case "$gethostent_r_proto" in
11958 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11959 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11960 esac
11961 case "$gethostent_r_proto" in
11962 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11963 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11964 esac
11965 case "$gethostent_r_proto" in
11966 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11967 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11968 esac
11969 case "$gethostent_r_proto" in
90e831dc 11970 ''|0) d_gethostent_r=undef
10bc17b6 11971 gethostent_r_proto=0
a48ec845 11972 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11973 * ) case "$gethostent_r_proto" in
11974 REENTRANT_PROTO*) ;;
11975 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11976 esac
11977 echo "Prototype: $try" ;;
11978 esac
11979 ;;
c18e646a
JH
11980 *) case "$usethreads" in
11981 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11982 esac
90e831dc
SB
11983 d_gethostent_r=undef
11984 gethostent_r_proto=0
c18e646a 11985 ;;
a48ec845
JH
11986 esac
11987 ;;
10bc17b6
JH
11988*) gethostent_r_proto=0
11989 ;;
11990esac
b4eb6b3d
JH
11991
11992: see if prototypes for various gethostxxx netdb.h functions are available
11993echo " "
11994set d_gethostprotos gethostent $i_netdb netdb.h
11995eval $hasproto
11996
4e0554ec
JH
11997: see if getitimer exists
11998set getitimer d_getitimer
11999eval $inlibc
12000
b4eb6b3d
JH
12001: see if getlogin exists
12002set getlogin d_getlogin
12003eval $inlibc
12004
10bc17b6
JH
12005: see if getlogin_r exists
12006set getlogin_r d_getlogin_r
12007eval $inlibc
12008case "$d_getlogin_r" in
12009"$define")
12010 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
12011 case "$d_getlogin_r_proto:$usethreads" in
12012 ":define") d_getlogin_r_proto=define
a48ec845
JH
12013 set d_getlogin_r_proto getlogin_r $hdrs
12014 eval $hasproto ;;
12015 *) ;;
12016 esac
12017 case "$d_getlogin_r_proto" in
12018 define)
10bc17b6
JH
12019 case "$getlogin_r_proto" in
12020 ''|0) try='int getlogin_r(char*, size_t);'
12021 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12022 esac
12023 case "$getlogin_r_proto" in
12024 ''|0) try='int getlogin_r(char*, int);'
12025 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12026 esac
12027 case "$getlogin_r_proto" in
12028 ''|0) try='char* getlogin_r(char*, size_t);'
12029 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12030 esac
12031 case "$getlogin_r_proto" in
12032 ''|0) try='char* getlogin_r(char*, int);'
12033 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12034 esac
12035 case "$getlogin_r_proto" in
90e831dc 12036 ''|0) d_getlogin_r=undef
10bc17b6 12037 getlogin_r_proto=0
a48ec845 12038 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12039 * ) case "$getlogin_r_proto" in
12040 REENTRANT_PROTO*) ;;
12041 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12042 esac
12043 echo "Prototype: $try" ;;
12044 esac
12045 ;;
c18e646a
JH
12046 *) case "$usethreads" in
12047 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12048 esac
90e831dc
SB
12049 d_getlogin_r=undef
12050 getlogin_r_proto=0
c18e646a 12051 ;;
a48ec845
JH
12052 esac
12053 ;;
10bc17b6
JH
12054*) getlogin_r_proto=0
12055 ;;
12056esac
12057
b4eb6b3d
JH
12058: see if getmnt exists
12059set getmnt d_getmnt
12060eval $inlibc
12061
12062: see if getmntent exists
12063set getmntent d_getmntent
12064eval $inlibc
12065
12066: see if getnetbyaddr exists
12067set getnetbyaddr d_getnbyaddr
12068eval $inlibc
12069
12070: see if getnetbyname exists
12071set getnetbyname d_getnbyname
12072eval $inlibc
12073
12074: see if getnetent exists
12075set getnetent d_getnent
12076eval $inlibc
12077
10bc17b6
JH
12078: see if getnetbyaddr_r exists
12079set getnetbyaddr_r d_getnetbyaddr_r
12080eval $inlibc
12081case "$d_getnetbyaddr_r" in
12082"$define")
12083 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12084 case "$d_getnetbyaddr_r_proto:$usethreads" in
12085 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
12086 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12087 eval $hasproto ;;
12088 *) ;;
12089 esac
12090 case "$d_getnetbyaddr_r_proto" in
12091 define)
10bc17b6
JH
12092 case "$getnetbyaddr_r_proto" in
12093 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12094 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12095 esac
12096 case "$getnetbyaddr_r_proto" in
12097 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12098 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12099 esac
12100 case "$getnetbyaddr_r_proto" in
12101 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12102 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12103 esac
12104 case "$getnetbyaddr_r_proto" in
12105 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12106 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12107 esac
12108 case "$getnetbyaddr_r_proto" in
12109 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12110 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12111 esac
12112 case "$getnetbyaddr_r_proto" in
12113 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12114 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12115 esac
12116 case "$getnetbyaddr_r_proto" in
12117 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12118 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12119 esac
12120 case "$getnetbyaddr_r_proto" in
90e831dc 12121 ''|0) d_getnetbyaddr_r=undef
10bc17b6 12122 getnetbyaddr_r_proto=0
a48ec845 12123 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12124 * ) case "$getnetbyaddr_r_proto" in
12125 REENTRANT_PROTO*) ;;
12126 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12127 esac
12128 echo "Prototype: $try" ;;
12129 esac
12130 ;;
c18e646a
JH
12131 *) case "$usethreads" in
12132 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12133 esac
90e831dc
SB
12134 d_getnetbyaddr_r=undef
12135 getnetbyaddr_r_proto=0
c18e646a 12136 ;;
a48ec845
JH
12137 esac
12138 ;;
10bc17b6
JH
12139*) getnetbyaddr_r_proto=0
12140 ;;
12141esac
12142
12143: see if getnetbyname_r exists
12144set getnetbyname_r d_getnetbyname_r
12145eval $inlibc
12146case "$d_getnetbyname_r" in
12147"$define")
12148 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12149 case "$d_getnetbyname_r_proto:$usethreads" in
12150 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
12151 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12152 eval $hasproto ;;
12153 *) ;;
12154 esac
12155 case "$d_getnetbyname_r_proto" in
12156 define)
10bc17b6
JH
12157 case "$getnetbyname_r_proto" in
12158 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12159 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12160 esac
12161 case "$getnetbyname_r_proto" in
12162 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12163 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12164 esac
12165 case "$getnetbyname_r_proto" in
12166 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12167 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12168 esac
12169 case "$getnetbyname_r_proto" in
12170 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12171 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12172 esac
12173 case "$getnetbyname_r_proto" in
90e831dc 12174 ''|0) d_getnetbyname_r=undef
10bc17b6 12175 getnetbyname_r_proto=0
a48ec845 12176 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12177 * ) case "$getnetbyname_r_proto" in
12178 REENTRANT_PROTO*) ;;
12179 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12180 esac
12181 echo "Prototype: $try" ;;
12182 esac
12183 ;;
c18e646a
JH
12184 *) case "$usethreads" in
12185 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12186 esac
90e831dc
SB
12187 d_getnetbyname_r=undef
12188 getnetbyname_r_proto=0
c18e646a 12189 ;;
a48ec845
JH
12190 esac
12191 ;;
10bc17b6
JH
12192*) getnetbyname_r_proto=0
12193 ;;
12194esac
12195
12196: see if getnetent_r exists
12197set getnetent_r d_getnetent_r
12198eval $inlibc
12199case "$d_getnetent_r" in
12200"$define")
12201 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12202 case "$d_getnetent_r_proto:$usethreads" in
12203 ":define") d_getnetent_r_proto=define
a48ec845
JH
12204 set d_getnetent_r_proto getnetent_r $hdrs
12205 eval $hasproto ;;
12206 *) ;;
12207 esac
12208 case "$d_getnetent_r_proto" in
12209 define)
10bc17b6
JH
12210 case "$getnetent_r_proto" in
12211 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12212 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12213 esac
12214 case "$getnetent_r_proto" in
12215 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12216 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12217 esac
12218 case "$getnetent_r_proto" in
12219 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12220 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12221 esac
12222 case "$getnetent_r_proto" in
12223 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12224 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12225 esac
12226 case "$getnetent_r_proto" in
12227 ''|0) try='int getnetent_r(struct netent*, char*, int);'
12228 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12229 esac
12230 case "$getnetent_r_proto" in
12231 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12232 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12233 esac
12234 case "$getnetent_r_proto" in
90e831dc 12235 ''|0) d_getnetent_r=undef
10bc17b6 12236 getnetent_r_proto=0
a48ec845 12237 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12238 * ) case "$getnetent_r_proto" in
12239 REENTRANT_PROTO*) ;;
12240 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12241 esac
12242 echo "Prototype: $try" ;;
12243 esac
12244 ;;
c18e646a
JH
12245 *) case "$usethreads" in
12246 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12247 esac
90e831dc
SB
12248 d_getnetent_r=undef
12249 getnetent_r_proto=0
c18e646a 12250 ;;
a48ec845
JH
12251 esac
12252 ;;
10bc17b6
JH
12253*) getnetent_r_proto=0
12254 ;;
12255esac
12256
b4eb6b3d
JH
12257: see if prototypes for various getnetxxx netdb.h functions are available
12258echo " "
12259set d_getnetprotos getnetent $i_netdb netdb.h
12260eval $hasproto
12261
0c0643d0
JH
12262: see if getpagesize exists
12263set getpagesize d_getpagsz
12264eval $inlibc
12265
b4eb6b3d
JH
12266
12267: see if getprotobyname exists
12268set getprotobyname d_getpbyname
12269eval $inlibc
12270
12271: see if getprotobynumber exists
12272set getprotobynumber d_getpbynumber
12273eval $inlibc
12274
12275: see if getprotoent exists
12276set getprotoent d_getpent
12277eval $inlibc
12278
12279: see if getpgid exists
12280set getpgid d_getpgid
12281eval $inlibc
12282
12283: see if getpgrp2 exists
12284set getpgrp2 d_getpgrp2
12285eval $inlibc
12286
12287: see if getppid exists
12288set getppid d_getppid
12289eval $inlibc
12290
12291: see if getpriority exists
12292set getpriority d_getprior
12293eval $inlibc
12294
10bc17b6
JH
12295: see if getprotobyname_r exists
12296set getprotobyname_r d_getprotobyname_r
12297eval $inlibc
12298case "$d_getprotobyname_r" in
12299"$define")
12300 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12301 case "$d_getprotobyname_r_proto:$usethreads" in
12302 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
12303 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12304 eval $hasproto ;;
12305 *) ;;
12306 esac
12307 case "$d_getprotobyname_r_proto" in
12308 define)
10bc17b6
JH
12309 case "$getprotobyname_r_proto" in
12310 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12311 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12312 esac
12313 case "$getprotobyname_r_proto" in
12314 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12315 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12316 esac
12317 case "$getprotobyname_r_proto" in
12318 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12319 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12320 esac
12321 case "$getprotobyname_r_proto" in
90e831dc 12322 ''|0) d_getprotobyname_r=undef
10bc17b6 12323 getprotobyname_r_proto=0
a48ec845 12324 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12325 * ) case "$getprotobyname_r_proto" in
12326 REENTRANT_PROTO*) ;;
12327 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12328 esac
12329 echo "Prototype: $try" ;;
12330 esac
12331 ;;
c18e646a
JH
12332 *) case "$usethreads" in
12333 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12334 esac
90e831dc
SB
12335 d_getprotobyname_r=undef
12336 getprotobyname_r_proto=0
c18e646a 12337 ;;
a48ec845
JH
12338 esac
12339 ;;
10bc17b6
JH
12340*) getprotobyname_r_proto=0
12341 ;;
12342esac
12343
12344: see if getprotobynumber_r exists
12345set getprotobynumber_r d_getprotobynumber_r
12346eval $inlibc
12347case "$d_getprotobynumber_r" in
12348"$define")
12349 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12350 case "$d_getprotobynumber_r_proto:$usethreads" in
12351 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
12352 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12353 eval $hasproto ;;
12354 *) ;;
12355 esac
12356 case "$d_getprotobynumber_r_proto" in
12357 define)
10bc17b6
JH
12358 case "$getprotobynumber_r_proto" in
12359 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12360 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12361 esac
12362 case "$getprotobynumber_r_proto" in
12363 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12364 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12365 esac
12366 case "$getprotobynumber_r_proto" in
12367 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12368 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12369 esac
12370 case "$getprotobynumber_r_proto" in
90e831dc 12371 ''|0) d_getprotobynumber_r=undef
10bc17b6 12372 getprotobynumber_r_proto=0
a48ec845 12373 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12374 * ) case "$getprotobynumber_r_proto" in
12375 REENTRANT_PROTO*) ;;
12376 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12377 esac
12378 echo "Prototype: $try" ;;
12379 esac
12380 ;;
c18e646a
JH
12381 *) case "$usethreads" in
12382 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12383 esac
90e831dc
SB
12384 d_getprotobynumber_r=undef
12385 getprotobynumber_r_proto=0
c18e646a 12386 ;;
a48ec845
JH
12387 esac
12388 ;;
10bc17b6
JH
12389*) getprotobynumber_r_proto=0
12390 ;;
12391esac
12392
12393: see if getprotoent_r exists
12394set getprotoent_r d_getprotoent_r
12395eval $inlibc
12396case "$d_getprotoent_r" in
12397"$define")
12398 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12399 case "$d_getprotoent_r_proto:$usethreads" in
12400 ":define") d_getprotoent_r_proto=define
a48ec845
JH
12401 set d_getprotoent_r_proto getprotoent_r $hdrs
12402 eval $hasproto ;;
12403 *) ;;
12404 esac
12405 case "$d_getprotoent_r_proto" in
12406 define)
10bc17b6
JH
12407 case "$getprotoent_r_proto" in
12408 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12409 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12410 esac
12411 case "$getprotoent_r_proto" in
12412 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12413 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12414 esac
12415 case "$getprotoent_r_proto" in
12416 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12417 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12418 esac
12419 case "$getprotoent_r_proto" in
12420 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12421 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12422 esac
12423 case "$getprotoent_r_proto" in
90e831dc 12424 ''|0) d_getprotoent_r=undef
10bc17b6 12425 getprotoent_r_proto=0
a48ec845 12426 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12427 * ) case "$getprotoent_r_proto" in
12428 REENTRANT_PROTO*) ;;
12429 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12430 esac
12431 echo "Prototype: $try" ;;
12432 esac
12433 ;;
c18e646a
JH
12434 *) case "$usethreads" in
12435 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12436 esac
90e831dc
SB
12437 d_getprotoent_r=undef
12438 getprotoent_r_proto=0
c18e646a 12439 ;;
a48ec845
JH
12440 esac
12441 ;;
10bc17b6
JH
12442*) getprotoent_r_proto=0
12443 ;;
12444esac
12445
b4eb6b3d
JH
12446: see if prototypes for various getprotoxxx netdb.h functions are available
12447echo " "
12448set d_getprotoprotos getprotoent $i_netdb netdb.h
12449eval $hasproto
12450
12451: see if getprpwnam exists
12452set getprpwnam d_getprpwnam
12453eval $inlibc
12454
12455: see if getpwent exists
12456set getpwent d_getpwent
12457eval $inlibc
12458
10bc17b6
JH
12459: see if getpwent_r exists
12460set getpwent_r d_getpwent_r
12461eval $inlibc
12462case "$d_getpwent_r" in
12463"$define")
12464 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12465 case "$d_getpwent_r_proto:$usethreads" in
12466 ":define") d_getpwent_r_proto=define
a48ec845
JH
12467 set d_getpwent_r_proto getpwent_r $hdrs
12468 eval $hasproto ;;
12469 *) ;;
12470 esac
12471 case "$d_getpwent_r_proto" in
12472 define)
10bc17b6
JH
12473 case "$getpwent_r_proto" in
12474 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12475 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12476 esac
12477 case "$getpwent_r_proto" in
12478 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12479 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12480 esac
12481 case "$getpwent_r_proto" in
12482 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12483 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12484 esac
12485 case "$getpwent_r_proto" in
12486 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12487 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12488 esac
12489 case "$getpwent_r_proto" in
12490 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12491 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12492 esac
12493 case "$getpwent_r_proto" in
12494 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12495 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12496 esac
12497 case "$getpwent_r_proto" in
90e831dc 12498 ''|0) d_getpwent_r=undef
10bc17b6 12499 getpwent_r_proto=0
a48ec845 12500 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12501 * ) case "$getpwent_r_proto" in
12502 REENTRANT_PROTO*) ;;
12503 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12504 esac
12505 echo "Prototype: $try" ;;
12506 esac
12507 ;;
c18e646a
JH
12508 *) case "$usethreads" in
12509 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12510 esac
90e831dc
SB
12511 d_getpwent_r=undef
12512 getpwent_r_proto=0
c18e646a 12513 ;;
a48ec845
JH
12514 esac
12515 ;;
10bc17b6
JH
12516*) getpwent_r_proto=0
12517 ;;
12518esac
12519
12520: see if getpwnam_r exists
12521set getpwnam_r d_getpwnam_r
12522eval $inlibc
12523case "$d_getpwnam_r" in
12524"$define")
12525 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12526 case "$d_getpwnam_r_proto:$usethreads" in
12527 ":define") d_getpwnam_r_proto=define
a48ec845
JH
12528 set d_getpwnam_r_proto getpwnam_r $hdrs
12529 eval $hasproto ;;
12530 *) ;;
12531 esac
12532 case "$d_getpwnam_r_proto" in
12533 define)
10bc17b6
JH
12534 case "$getpwnam_r_proto" in
12535 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12536 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12537 esac
12538 case "$getpwnam_r_proto" in
12539 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12540 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12541 esac
12542 case "$getpwnam_r_proto" in
12543 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12544 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12545 esac
12546 case "$getpwnam_r_proto" in
12547 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12548 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12549 esac
12550 case "$getpwnam_r_proto" in
90e831dc 12551 ''|0) d_getpwnam_r=undef
10bc17b6 12552 getpwnam_r_proto=0
a48ec845 12553 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12554 * ) case "$getpwnam_r_proto" in
12555 REENTRANT_PROTO*) ;;
12556 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12557 esac
12558 echo "Prototype: $try" ;;
12559 esac
12560 ;;
c18e646a
JH
12561 *) case "$usethreads" in
12562 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12563 esac
90e831dc
SB
12564 d_getpwnam_r=undef
12565 getpwnam_r_proto=0
c18e646a 12566 ;;
a48ec845
JH
12567 esac
12568 ;;
10bc17b6
JH
12569*) getpwnam_r_proto=0
12570 ;;
12571esac
12572
12573: see if getpwuid_r exists
12574set getpwuid_r d_getpwuid_r
12575eval $inlibc
12576case "$d_getpwuid_r" in
12577"$define")
12578 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12579 case "$d_getpwuid_r_proto:$usethreads" in
12580 ":define") d_getpwuid_r_proto=define
a48ec845
JH
12581 set d_getpwuid_r_proto getpwuid_r $hdrs
12582 eval $hasproto ;;
12583 *) ;;
12584 esac
12585 case "$d_getpwuid_r_proto" in
12586 define)
10bc17b6
JH
12587 case "$getpwuid_r_proto" in
12588 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12589 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12590 esac
12591 case "$getpwuid_r_proto" in
12592 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12593 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12594 esac
12595 case "$getpwuid_r_proto" in
12596 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12597 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12598 esac
12599 case "$getpwuid_r_proto" in
12600 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12601 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12602 esac
12603 case "$getpwuid_r_proto" in
90e831dc 12604 ''|0) d_getpwuid_r=undef
10bc17b6 12605 getpwuid_r_proto=0
a48ec845 12606 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12607 * ) case "$getpwuid_r_proto" in
12608 REENTRANT_PROTO*) ;;
12609 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12610 esac
12611 echo "Prototype: $try" ;;
12612 esac
12613 ;;
c18e646a
JH
12614 *) case "$usethreads" in
12615 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12616 esac
90e831dc
SB
12617 d_getpwuid_r=undef
12618 getpwuid_r_proto=0
c18e646a 12619 ;;
a48ec845
JH
12620 esac
12621 ;;
10bc17b6
JH
12622*) getpwuid_r_proto=0
12623 ;;
12624esac
12625
b4eb6b3d
JH
12626
12627: see if getservbyname exists
12628set getservbyname d_getsbyname
12629eval $inlibc
12630
12631: see if getservbyport exists
12632set getservbyport d_getsbyport
12633eval $inlibc
12634
12635: see if getservent exists
12636set getservent d_getsent
12637eval $inlibc
12638
10bc17b6
JH
12639: see if getservbyname_r exists
12640set getservbyname_r d_getservbyname_r
12641eval $inlibc
12642case "$d_getservbyname_r" in
12643"$define")
12644 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12645 case "$d_getservbyname_r_proto:$usethreads" in
12646 ":define") d_getservbyname_r_proto=define
a48ec845
JH
12647 set d_getservbyname_r_proto getservbyname_r $hdrs
12648 eval $hasproto ;;
12649 *) ;;
12650 esac
12651 case "$d_getservbyname_r_proto" in
12652 define)
10bc17b6
JH
12653 case "$getservbyname_r_proto" in
12654 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12655 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12656 esac
12657 case "$getservbyname_r_proto" in
12658 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12659 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12660 esac
12661 case "$getservbyname_r_proto" in
12662 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12663 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12664 esac
12665 case "$getservbyname_r_proto" in
90e831dc 12666 ''|0) d_getservbyname_r=undef
10bc17b6 12667 getservbyname_r_proto=0
a48ec845 12668 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12669 * ) case "$getservbyname_r_proto" in
12670 REENTRANT_PROTO*) ;;
12671 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12672 esac
12673 echo "Prototype: $try" ;;
12674 esac
12675 ;;
c18e646a
JH
12676 *) case "$usethreads" in
12677 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12678 esac
90e831dc
SB
12679 d_getservbyname_r=undef
12680 getservbyname_r_proto=0
c18e646a 12681 ;;
a48ec845
JH
12682 esac
12683 ;;
10bc17b6
JH
12684*) getservbyname_r_proto=0
12685 ;;
12686esac
12687
12688: see if getservbyport_r exists
12689set getservbyport_r d_getservbyport_r
12690eval $inlibc
12691case "$d_getservbyport_r" in
12692"$define")
12693 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12694 case "$d_getservbyport_r_proto:$usethreads" in
12695 ":define") d_getservbyport_r_proto=define
a48ec845
JH
12696 set d_getservbyport_r_proto getservbyport_r $hdrs
12697 eval $hasproto ;;
12698 *) ;;
12699 esac
12700 case "$d_getservbyport_r_proto" in
12701 define)
10bc17b6
JH
12702 case "$getservbyport_r_proto" in
12703 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12704 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12705 esac
12706 case "$getservbyport_r_proto" in
12707 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12708 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12709 esac
12710 case "$getservbyport_r_proto" in
12711 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12712 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12713 esac
12714 case "$getservbyport_r_proto" in
90e831dc 12715 ''|0) d_getservbyport_r=undef
10bc17b6 12716 getservbyport_r_proto=0
a48ec845 12717 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12718 * ) case "$getservbyport_r_proto" in
12719 REENTRANT_PROTO*) ;;
12720 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12721 esac
12722 echo "Prototype: $try" ;;
12723 esac
12724 ;;
c18e646a
JH
12725 *) case "$usethreads" in
12726 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12727 esac
90e831dc
SB
12728 d_getservbyport_r=undef
12729 getservbyport_r_proto=0
c18e646a 12730 ;;
a48ec845
JH
12731 esac
12732 ;;
10bc17b6
JH
12733*) getservbyport_r_proto=0
12734 ;;
12735esac
12736
12737: see if getservent_r exists
12738set getservent_r d_getservent_r
12739eval $inlibc
12740case "$d_getservent_r" in
12741"$define")
12742 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12743 case "$d_getservent_r_proto:$usethreads" in
12744 ":define") d_getservent_r_proto=define
a48ec845
JH
12745 set d_getservent_r_proto getservent_r $hdrs
12746 eval $hasproto ;;
12747 *) ;;
12748 esac
12749 case "$d_getservent_r_proto" in
12750 define)
10bc17b6
JH
12751 case "$getservent_r_proto" in
12752 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12753 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12754 esac
12755 case "$getservent_r_proto" in
12756 ''|0) try='int getservent_r(struct servent*, char*, int);'
12757 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12758 esac
12759 case "$getservent_r_proto" in
12760 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12761 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12762 esac
12763 case "$getservent_r_proto" in
12764 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12765 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12766 esac
12767 case "$getservent_r_proto" in
90e831dc 12768 ''|0) d_getservent_r=undef
10bc17b6 12769 getservent_r_proto=0
a48ec845 12770 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12771 * ) case "$getservent_r_proto" in
12772 REENTRANT_PROTO*) ;;
12773 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12774 esac
12775 echo "Prototype: $try" ;;
12776 esac
12777 ;;
c18e646a
JH
12778 *) case "$usethreads" in
12779 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12780 esac
90e831dc
SB
12781 d_getservent_r=undef
12782 getservent_r_proto=0
c18e646a 12783 ;;
a48ec845
JH
12784 esac
12785 ;;
10bc17b6
JH
12786*) getservent_r_proto=0
12787 ;;
12788esac
12789
b4eb6b3d
JH
12790: see if prototypes for various getservxxx netdb.h functions are available
12791echo " "
12792set d_getservprotos getservent $i_netdb netdb.h
12793eval $hasproto
12794
12795: see if getspnam exists
12796set getspnam d_getspnam
12797eval $inlibc
12798
10bc17b6
JH
12799: see if this is a shadow.h system
12800set shadow.h i_shadow
12801eval $inhdr
12802
12803: see if getspnam_r exists
12804set getspnam_r d_getspnam_r
12805eval $inlibc
12806case "$d_getspnam_r" in
12807"$define")
12808 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
12809 case "$d_getspnam_r_proto:$usethreads" in
12810 ":define") d_getspnam_r_proto=define
a48ec845
JH
12811 set d_getspnam_r_proto getspnam_r $hdrs
12812 eval $hasproto ;;
12813 *) ;;
12814 esac
12815 case "$d_getspnam_r_proto" in
12816 define)
10bc17b6
JH
12817 case "$getspnam_r_proto" in
12818 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12819 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12820 esac
12821 case "$getspnam_r_proto" in
12822 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12823 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12824 esac
12825 case "$getspnam_r_proto" in
90e831dc 12826 ''|0) d_getspnam_r=undef
10bc17b6 12827 getspnam_r_proto=0
a48ec845 12828 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12829 * ) case "$getspnam_r_proto" in
12830 REENTRANT_PROTO*) ;;
12831 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12832 esac
12833 echo "Prototype: $try" ;;
12834 esac
12835 ;;
c18e646a
JH
12836 *) case "$usethreads" in
12837 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12838 esac
90e831dc
SB
12839 d_getspnam_r=undef
12840 getspnam_r_proto=0
c18e646a 12841 ;;
a48ec845
JH
12842 esac
12843 ;;
10bc17b6
JH
12844*) getspnam_r_proto=0
12845 ;;
12846esac
12847
b4eb6b3d
JH
12848: see if gettimeofday or ftime exists
12849set gettimeofday d_gettimeod
12850eval $inlibc
12851case "$d_gettimeod" in
12852"$undef")
12853 set ftime d_ftime
12854 eval $inlibc
12855 ;;
12856*)
12857 val="$undef"; set d_ftime; eval $setvar
12858 ;;
12859esac
12860case "$d_gettimeod$d_ftime" in
12861"$undef$undef")
12862 echo " "
12863 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12864 ;;
12865esac
12866
10bc17b6
JH
12867: see if gmtime_r exists
12868set gmtime_r d_gmtime_r
12869eval $inlibc
12870case "$d_gmtime_r" in
12871"$define")
d63eadf0 12872 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
12873 case "$d_gmtime_r_proto:$usethreads" in
12874 ":define") d_gmtime_r_proto=define
a48ec845
JH
12875 set d_gmtime_r_proto gmtime_r $hdrs
12876 eval $hasproto ;;
12877 *) ;;
12878 esac
12879 case "$d_gmtime_r_proto" in
12880 define)
10bc17b6
JH
12881 case "$gmtime_r_proto" in
12882 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12883 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12884 esac
12885 case "$gmtime_r_proto" in
12886 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12887 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12888 esac
12889 case "$gmtime_r_proto" in
90e831dc 12890 ''|0) d_gmtime_r=undef
10bc17b6 12891 gmtime_r_proto=0
a48ec845 12892 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12893 * ) case "$gmtime_r_proto" in
12894 REENTRANT_PROTO*) ;;
12895 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12896 esac
12897 echo "Prototype: $try" ;;
12898 esac
b4eb6b3d 12899 ;;
c18e646a
JH
12900 *) case "$usethreads" in
12901 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12902 esac
90e831dc
SB
12903 d_gmtime_r=undef
12904 gmtime_r_proto=0
c18e646a 12905 ;;
a48ec845
JH
12906 esac
12907 ;;
10bc17b6 12908*) gmtime_r_proto=0
b4eb6b3d
JH
12909 ;;
12910esac
12911
12912: see if hasmntopt exists
12913set hasmntopt d_hasmntopt
12914eval $inlibc
12915
12916: see if this is a netinet/in.h or sys/in.h system
12917set netinet/in.h i_niin sys/in.h i_sysin
12918eval $inhdr
12919
12920: see if arpa/inet.h has to be included
12921set arpa/inet.h i_arpainet
12922eval $inhdr
12923
12924: see if htonl --and friends-- exists
12925val=''
12926set htonl val
12927eval $inlibc
12928
12929: Maybe they are macros.
12930case "$val" in
12931$undef)
12932 $cat >htonl.c <<EOM
12933#include <stdio.h>
12934#include <sys/types.h>
12935#$i_niin I_NETINET_IN
12936#$i_sysin I_SYS_IN
12937#$i_arpainet I_ARPA_INET
12938#ifdef I_NETINET_IN
12939#include <netinet/in.h>
12940#endif
12941#ifdef I_SYS_IN
12942#include <sys/in.h>
12943#endif
12944#ifdef I_ARPA_INET
12945#include <arpa/inet.h>
12946#endif
12947#ifdef htonl
12948printf("Defined as a macro.");
12949#endif
12950EOM
12951 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12952 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12953 val="$define"
12954 echo "But it seems to be defined as a macro." >&4
12955 fi
12956 $rm -f htonl.?
12957 ;;
12958esac
12959set d_htonl
12960eval $setvar
12961
b4eb6b3d
JH
12962: index or strchr
12963echo " "
12964if set index val -f; eval $csym; $val; then
12965 if set strchr val -f d_strchr; eval $csym; $val; then
12966 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12967 val="$define"
12968 vali="$undef"
12969 echo "strchr() found." >&4
12970 else
12971 val="$undef"
12972 vali="$define"
12973 echo "index() found." >&4
12974 fi
12975 else
12976 val="$undef"
12977 vali="$define"
8dfa8df9
JH
12978 echo "index() found." >&4
12979 fi
b4eb6b3d 12980else
8dfa8df9
JH
12981 if set strchr val -f d_strchr; eval $csym; $val; then
12982 val="$define"
12983 vali="$undef"
12984 echo "strchr() found." >&4
12985 else
12986 echo "No index() or strchr() found!" >&4
12987 val="$undef"
12988 vali="$undef"
12989 fi
b4eb6b3d 12990fi
8dfa8df9
JH
12991set d_strchr; eval $setvar
12992val="$vali"
12993set d_index; eval $setvar
12994
12995: check whether inet_aton exists
12996set inet_aton d_inetaton
12997eval $inlibc
b4eb6b3d
JH
12998
12999: Look for isascii
13000echo " "
13001$cat >isascii.c <<'EOCP'
13002#include <stdio.h>
13003#include <ctype.h>
13004int main() {
13005 int c = 'A';
13006 if (isascii(c))
13007 exit(0);
13008 else
13009 exit(1);
13010}
13011EOCP
13012set isascii
13013if eval $compile; then
13014 echo "isascii() found." >&4
13015 val="$define"
13016else
13017 echo "isascii() NOT found." >&4
13018 val="$undef"
13019fi
13020set d_isascii
13021eval $setvar
13022$rm -f isascii*
13023
758a5d79
JH
13024: see if isfinite exists
13025set isfinite d_isfinite
13026eval $inlibc
13027
13028: see if isinf exists
13029set isinf d_isinf
13030eval $inlibc
13031
b4eb6b3d
JH
13032: see if isnan exists
13033set isnan d_isnan
13034eval $inlibc
13035
13036: see if isnanl exists
13037set isnanl d_isnanl
13038eval $inlibc
13039
13040: see if killpg exists
13041set killpg d_killpg
13042eval $inlibc
13043
13044: see if lchown exists
13045echo " "
13046$cat > try.c <<'EOCP'
13047/* System header to define __stub macros and hopefully few prototypes,
13048 which can conflict with char lchown(); below. */
13049#include <assert.h>
13050/* Override any gcc2 internal prototype to avoid an error. */
13051/* We use char because int might match the return type of a gcc2
13052 builtin and then its argument prototype would still apply. */
13053char lchown();
13054int main() {
13055 /* The GNU C library defines this for functions which it implements
13056 to always fail with ENOSYS. Some functions are actually named
13057 something starting with __ and the normal name is an alias. */
13058#if defined (__stub_lchown) || defined (__stub___lchown)
13059choke me
13060#else
13061lchown();
13062#endif
13063; return 0; }
13064EOCP
13065set try
13066if eval $compile; then
13067 $echo "lchown() found." >&4
13068 val="$define"
13069else
13070 $echo "lchown() NOT found." >&4
13071 val="$undef"
13072fi
13073set d_lchown
13074eval $setvar
13075
13076: See if number of significant digits in a double precision number is known
13077echo " "
13078$cat >ldbl_dig.c <<EOM
13079#$i_limits I_LIMITS
13080#$i_float I_FLOAT
13081#ifdef I_LIMITS
13082#include <limits.h>
13083#endif
13084#ifdef I_FLOAT
13085#include <float.h>
13086#endif
13087#ifdef LDBL_DIG
13088printf("Contains LDBL_DIG");
13089#endif
13090EOM
13091$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13092if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13093 echo "LDBL_DIG found." >&4
13094 val="$define"
13095else
13096 echo "LDBL_DIG NOT found." >&4
13097 val="$undef"
13098fi
13099$rm -f ldbl_dig.?
13100set d_ldbl_dig
13101eval $setvar
13102
13103: see if link exists
13104set link d_link
13105eval $inlibc
13106
10bc17b6
JH
13107: see if localtime_r exists
13108set localtime_r d_localtime_r
13109eval $inlibc
13110case "$d_localtime_r" in
13111"$define")
d63eadf0 13112 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13113 case "$d_localtime_r_proto:$usethreads" in
13114 ":define") d_localtime_r_proto=define
a48ec845
JH
13115 set d_localtime_r_proto localtime_r $hdrs
13116 eval $hasproto ;;
13117 *) ;;
13118 esac
13119 case "$d_localtime_r_proto" in
13120 define)
10bc17b6
JH
13121 case "$localtime_r_proto" in
13122 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13123 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13124 esac
13125 case "$localtime_r_proto" in
13126 ''|0) try='int localtime_r(const time_t*, struct tm*);'
13127 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13128 esac
13129 case "$localtime_r_proto" in
90e831dc 13130 ''|0) d_localtime_r=undef
10bc17b6 13131 localtime_r_proto=0
a48ec845 13132 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13133 * ) case "$localtime_r_proto" in
13134 REENTRANT_PROTO*) ;;
13135 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13136 esac
13137 echo "Prototype: $try" ;;
13138 esac
13139 ;;
c18e646a
JH
13140 *) case "$usethreads" in
13141 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13142 esac
90e831dc
SB
13143 d_localtime_r=undef
13144 localtime_r_proto=0
c18e646a 13145 ;;
a48ec845
JH
13146 esac
13147 ;;
10bc17b6
JH
13148*) localtime_r_proto=0
13149 ;;
13150esac
13151
b4eb6b3d
JH
13152: see if localeconv exists
13153set localeconv d_locconv
13154eval $inlibc
13155
13156: see if lockf exists
13157set lockf d_lockf
13158eval $inlibc
13159
b4eb6b3d
JH
13160: see if prototype for lseek is available
13161echo " "
4786929f 13162set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
13163eval $hasproto
13164
13165: see if lstat exists
13166set lstat d_lstat
13167eval $inlibc
13168
13169: see if madvise exists
13170set madvise d_madvise
13171eval $inlibc
13172
13173: see if mblen exists
13174set mblen d_mblen
13175eval $inlibc
13176
13177: see if mbstowcs exists
13178set mbstowcs d_mbstowcs
13179eval $inlibc
13180
13181: see if mbtowc exists
13182set mbtowc d_mbtowc
13183eval $inlibc
13184
13185: see if memchr exists
13186set memchr d_memchr
13187eval $inlibc
13188
13189: see if memcmp exists
13190set memcmp d_memcmp
13191eval $inlibc
13192
13193: see if memcpy exists
13194set memcpy d_memcpy
13195eval $inlibc
13196
13197: see if memmove exists
13198set memmove d_memmove
13199eval $inlibc
13200
13201: see if memset exists
13202set memset d_memset
13203eval $inlibc
13204
13205: see if mkdir exists
13206set mkdir d_mkdir
13207eval $inlibc
13208
13209: see if mkdtemp exists
13210set mkdtemp d_mkdtemp
13211eval $inlibc
13212
13213: see if mkfifo exists
13214set mkfifo d_mkfifo
13215eval $inlibc
13216
13217: see if mkstemp exists
13218set mkstemp d_mkstemp
13219eval $inlibc
13220
13221: see if mkstemps exists
13222set mkstemps d_mkstemps
13223eval $inlibc
13224
13225: see if mktime exists
13226set mktime d_mktime
13227eval $inlibc
13228
13229: see if this is a sys/mman.h system
13230set sys/mman.h i_sysmman
13231eval $inhdr
13232
13233: see if mmap exists
13234set mmap d_mmap
13235eval $inlibc
13236: see what shmat returns
13237: default to something harmless
13238mmaptype='void *'
13239case "$i_sysmman$d_mmap" in
13240"$define$define")
13241 $cat >mmap.c <<'END'
13242#include <sys/mman.h>
13243void *mmap();
13244END
13245 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13246 mmaptype='void *'
13247 else
13248 mmaptype='caddr_t'
13249 fi
13250 echo "and it returns ($mmaptype)." >&4
13251 ;;
13252esac
13253
13254
13255
b4eb6b3d
JH
13256: see if mprotect exists
13257set mprotect d_mprotect
13258eval $inlibc
13259
13260: see if msgctl exists
13261set msgctl d_msgctl
13262eval $inlibc
13263
13264: see if msgget exists
13265set msgget d_msgget
13266eval $inlibc
13267
13268: see if msgsnd exists
13269set msgsnd d_msgsnd
13270eval $inlibc
13271
13272: see if msgrcv exists
13273set msgrcv d_msgrcv
13274eval $inlibc
13275
13276: see how much of the 'msg*(2)' library is present.
13277h_msg=true
13278echo " "
13279case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13280*"$undef"*) h_msg=false;;
13281esac
13282case "$osname" in
13283freebsd)
13284 case "`ipcs 2>&1`" in
13285 "SVID messages"*"not configured"*)
13286 echo "Your $osname does not have the msg*(2) configured." >&4
13287 h_msg=false
13288 val="$undef"
13289 set msgctl d_msgctl
13290 eval $setvar
13291 set msgget d_msgget
13292 eval $setvar
13293 set msgsnd d_msgsnd
13294 eval $setvar
13295 set msgrcv d_msgrcv
13296 eval $setvar
13297 ;;
13298 esac
13299 ;;
13300esac
13301: we could also check for sys/ipc.h ...
13302if $h_msg && $test `./findhdr sys/msg.h`; then
13303 echo "You have the full msg*(2) library." >&4
13304 val="$define"
13305else
13306 echo "You don't have the full msg*(2) library." >&4
13307 val="$undef"
13308fi
13309set d_msg
13310eval $setvar
13311
4e0554ec
JH
13312
13313echo " "
13314echo "Checking to see if your system supports struct msghdr..." >&4
13315set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13316eval $hasstruct
13317case "$d_msghdr_s" in
13318"$define") echo "Yes, it does." ;;
13319*) echo "No, it doesn't." ;;
13320esac
13321
13322
b4eb6b3d
JH
13323: see if msync exists
13324set msync d_msync
13325eval $inlibc
13326
13327: see if munmap exists
13328set munmap d_munmap
13329eval $inlibc
13330
13331: see if nice exists
13332set nice d_nice
13333eval $inlibc
13334
2765b840
JH
13335: see if this is a langinfo.h system
13336set langinfo.h i_langinfo
13337eval $inhdr
13338
13339: see if nl_langinfo exists
13340set nl_langinfo d_nl_langinfo
13341eval $inlibc
13342
b4eb6b3d
JH
13343: check for length of character
13344echo " "
13345case "$charsize" in
13346'')
13347 echo "Checking to see how big your characters are (hey, you never know)..." >&4
13348 $cat >try.c <<'EOCP'
13349#include <stdio.h>
13350int main()
13351{
13352 printf("%d\n", (int)sizeof(char));
13353 exit(0);
13354}
13355EOCP
13356 set try
13357 if eval $compile_ok; then
5440bc8e 13358 dflt=`$run ./try`
b4eb6b3d
JH
13359 else
13360 dflt='1'
13361 echo "(I can't seem to compile the test program. Guessing...)"
13362 fi
13363 ;;
13364*)
13365 dflt="$charsize"
13366 ;;
13367esac
13368rp="What is the size of a character (in bytes)?"
13369. ./myread
13370charsize="$ans"
13371$rm -f try.c try
13372
1d1be0dc
NC
13373: check for volatile keyword
13374echo " "
13375echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13376$cat >try.c <<'EOCP'
13377int main()
13378{
13379 typedef struct _goo_struct goo_struct;
13380 goo_struct * volatile goo = ((goo_struct *)0);
13381 struct _goo_struct {
13382 long long_int;
13383 int reg_int;
13384 char char_var;
13385 };
13386 typedef unsigned short foo_t;
13387 char *volatile foo;
13388 volatile int bar;
13389 volatile foo_t blech;
13390 foo = foo;
13391}
13392EOCP
13393if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13394 val="$define"
13395 echo "Yup, it does."
13396else
13397 val="$undef"
13398 echo "Nope, it doesn't."
13399fi
13400set d_volatile
13401eval $setvar
13402$rm -f try.*
13403
b4eb6b3d
JH
13404
13405echo " "
13406$echo "Choosing the C types to be used for Perl's internal types..." >&4
13407
13408case "$use64bitint:$d_quad:$quadtype" in
13409define:define:?*)
13410 ivtype="$quadtype"
13411 uvtype="$uquadtype"
13412 ivsize=8
13413 uvsize=8
13414 ;;
13415*) ivtype="long"
13416 uvtype="unsigned long"
13417 ivsize=$longsize
13418 uvsize=$longsize
13419 ;;
13420esac
13421
13422case "$uselongdouble:$d_longdbl" in
13423define:define)
13424 nvtype="long double"
13425 nvsize=$longdblsize
13426 ;;
13427*) nvtype=double
13428 nvsize=$doublesize
13429 ;;
13430esac
13431
13432$echo "(IV will be "$ivtype", $ivsize bytes)"
13433$echo "(UV will be "$uvtype", $uvsize bytes)"
13434$echo "(NV will be "$nvtype", $nvsize bytes)"
13435
13436$cat >try.c <<EOCP
13437#$i_inttypes I_INTTYPES
13438#ifdef I_INTTYPES
13439#include <inttypes.h>
13440#endif
13441#include <stdio.h>
13442int main() {
13443#ifdef INT8
13444 int8_t i = INT8_MAX;
13445 uint8_t u = UINT8_MAX;
13446 printf("int8_t\n");
13447#endif
13448#ifdef INT16
13449 int16_t i = INT16_MAX;
13450 uint16_t i = UINT16_MAX;
13451 printf("int16_t\n");
13452#endif
13453#ifdef INT32
13454 int32_t i = INT32_MAX;
13455 uint32_t u = UINT32_MAX;
13456 printf("int32_t\n");
13457#endif
13458}
13459EOCP
13460
13461case "$i8type" in
13462'') case "$charsize" in
13463 1) i8type=char
13464 u8type="unsigned char"
13465 i8size=$charsize
13466 u8size=$charsize
13467 ;;
13468 esac
13469 ;;
13470esac
13471case "$i8type" in
13472'') set try -DINT8
13473 if eval $compile; then
5440bc8e 13474 case "`$run ./try`" in
b4eb6b3d
JH
13475 int8_t) i8type=int8_t
13476 u8type=uint8_t
13477 i8size=1
13478 u8size=1
13479 ;;
13480 esac
13481 fi
13482 ;;
13483esac
13484case "$i8type" in
13485'') if $test $charsize -ge 1; then
13486 i8type=char
13487 u8type="unsigned char"
13488 i8size=$charsize
13489 u8size=$charsize
13490 fi
13491 ;;
13492esac
13493
13494case "$i16type" in
13495'') case "$shortsize" in
13496 2) i16type=short
13497 u16type="unsigned short"
13498 i16size=$shortsize
13499 u16size=$shortsize
13500 ;;
13501 esac
13502 ;;
13503esac
13504case "$i16type" in
13505'') set try -DINT16
13506 if eval $compile; then
5440bc8e 13507 case "`$run ./try`" in
b4eb6b3d
JH
13508 int16_t)
13509 i16type=int16_t
13510 u16type=uint16_t
13511 i16size=2
13512 u16size=2
13513 ;;
13514 esac
13515 fi
13516 ;;
13517esac
13518case "$i16type" in
13519'') if $test $shortsize -ge 2; then
13520 i16type=short
13521 u16type="unsigned short"
13522 i16size=$shortsize
13523 u16size=$shortsize
13524 fi
13525 ;;
13526esac
13527
13528case "$i32type" in
13529'') case "$longsize" in
13530 4) i32type=long
13531 u32type="unsigned long"
13532 i32size=$longsize
13533 u32size=$longsize
13534 ;;
13535 *) case "$intsize" in
13536 4) i32type=int
13537 u32type="unsigned int"
13538 i32size=$intsize
13539 u32size=$intsize
13540 ;;
13541 esac
13542 ;;
13543 esac
13544 ;;
13545esac
13546case "$i32type" in
13547'') set try -DINT32
13548 if eval $compile; then
5440bc8e 13549 case "`$run ./try`" in
b4eb6b3d
JH
13550 int32_t)
13551 i32type=int32_t
13552 u32type=uint32_t
13553 i32size=4
13554 u32size=4
13555 ;;
13556 esac
13557 fi
13558 ;;
13559esac
13560case "$i32type" in
13561'') if $test $intsize -ge 4; then
13562 i32type=int
13563 u32type="unsigned int"
13564 i32size=$intsize
13565 u32size=$intsize
13566 fi
13567 ;;
13568esac
13569
13570case "$i64type" in
13571'') case "$d_quad:$quadtype" in
13572 define:?*)
13573 i64type="$quadtype"
13574 u64type="$uquadtype"
13575 i64size=8
13576 u64size=8
13577 ;;
13578 esac
13579 ;;
13580esac
13581
1d1be0dc
NC
13582$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13583: volatile so that the compiler has to store it out to memory.
13584if test X"$d_volatile" = X"$define"; then
13585 volatile=volatile
13586fi
b4eb6b3d
JH
13587$cat <<EOP >try.c
13588#include <stdio.h>
1d1be0dc
NC
13589#include <sys/types.h>
13590#include <signal.h>
13591#ifdef SIGFPE
13592$volatile int bletched = 0;
13593$signal_t blech(s) int s; { bletched = 1; }
13594#endif
b4eb6b3d
JH
13595int main() {
13596 $uvtype u = 0;
1d1be0dc 13597 $nvtype d;
b4eb6b3d
JH
13598 int n = 8 * $uvsize;
13599 int i;
1d1be0dc
NC
13600#ifdef SIGFPE
13601 signal(SIGFPE, blech);
13602#endif
13603
b4eb6b3d
JH
13604 for (i = 0; i < n; i++) {
13605 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
13606 d = ($nvtype)u;
13607 if (($uvtype)d != u)
b4eb6b3d 13608 break;
1d1be0dc
NC
13609 if (d <= 0)
13610 break;
13611 d = ($nvtype)(u - 1);
13612 if (($uvtype)d != (u - 1))
13613 break;
13614#ifdef SIGFPE
13615 if (bletched) {
13616 break;
13617#endif
13618 }
b4eb6b3d 13619 }
efd1522b 13620 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
13621 exit(0);
13622}
13623EOP
1d1be0dc
NC
13624set try
13625
13626d_nv_preserves_uv="$undef"
13627if eval $compile; then
53133ed1 13628 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 13629fi
53133ed1 13630case "$nv_preserves_uv_bits" in
1d1be0dc 13631\-[1-9]*)
53133ed1
NC
13632 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13633 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 13634 d_nv_preserves_uv="$define"
b4eb6b3d 13635 ;;
53133ed1 13636[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
13637 d_nv_preserves_uv="$undef" ;;
13638*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 13639 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
13640esac
13641
1d1be0dc
NC
13642$rm -f try.* try
13643
b4eb6b3d
JH
13644
13645: check for off64_t
13646echo " "
13647echo "Checking to see if you have off64_t..." >&4
13648$cat >try.c <<EOCP
13649#include <sys/types.h>
13650#include <unistd.h>
13651int main() { off64_t x = 7; }
13652EOCP
13653set try
13654if eval $compile; then
13655 val="$define"
13656 echo "You have off64_t."
13657else
13658 val="$undef"
13659 echo "You do not have off64_t."
13660 case "$lseeksize" in
13661 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13662 esac
13663fi
13664$rm -f try.* try
13665set d_off64_t
13666eval $setvar
13667
b4eb6b3d
JH
13668: how to create joinable pthreads
13669if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13670 echo " "
13671 echo "Checking what constant to use for creating joinable pthreads..." >&4
13672 $cat >try.c <<'EOCP'
13673#include <pthread.h>
13674int main() {
13675 int detachstate = JOINABLE;
13676}
13677EOCP
13678 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13679 if eval $compile; then
13680 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13681 val="$undef" # Yes, undef.
13682 set d_old_pthread_create_joinable
13683 eval $setvar
13684 val=""
13685 set old_pthread_create_joinable
13686 eval $setvar
13687 else
13688 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13689 if eval $compile; then
13690 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13691 val="$define"
13692 set d_old_pthread_create_joinable
13693 eval $setvar
13694 val=PTHREAD_CREATE_UNDETACHED
13695 set old_pthread_create_joinable
13696 eval $setvar
13697 else
13698 set try -DJOINABLE=__UNDETACHED
13699 if eval $compile; then
13700 echo "You seem to use __UNDETACHED." >&4
13701 val="$define"
13702 set d_old_pthread_create_joinable
13703 eval $setvar
13704 val=__UNDETACHED
13705 set old_pthread_create_joinable
13706 eval $setvar
13707 else
13708 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13709 val="$define"
13710 set d_old_pthread_create_joinable
13711 eval $setvar
13712 val=0
13713 set old_pthread_create_joinable
13714 eval $setvar
13715 fi
13716 fi
13717 fi
13718 $rm -f try try.*
13719else
13720 d_old_pthread_create_joinable="$undef"
13721 old_pthread_create_joinable=""
13722fi
13723
13724: see if pause exists
13725set pause d_pause
13726eval $inlibc
13727
13728: see if pipe exists
13729set pipe d_pipe
13730eval $inlibc
13731
13732: see if poll exists
13733set poll d_poll
13734eval $inlibc
13735
c7aff470
NIS
13736: see if readlink exists
13737set readlink d_readlink
13738eval $inlibc
13739
13740echo " "
f24dbf84 13741procselfexe=''
c7aff470 13742val="$undef"
a33c94aa
JH
13743case "$d_readlink" in
13744"$define")
c7aff470
NIS
13745 if $issymlink /proc/self/exe ; then
13746 $ls -l /proc/self/exe > reflect
51660ed5 13747 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 13748 echo "You have Linux-like /proc/self/exe."
92236451 13749 procselfexe='"/proc/self/exe"'
f24dbf84 13750 val="$define"
f24dbf84
JH
13751 fi
13752 fi
13753 if $issymlink /proc/curproc/file ; then
13754 $ls -l /proc/curproc/file > reflect
13755 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13756 echo "You have BSD-like /proc/curproc/file."
92236451 13757 procselfexe='"/proc/curproc/file"'
f24dbf84 13758 val="$define"
c7aff470 13759 fi
c7aff470 13760 fi
a33c94aa
JH
13761 ;;
13762esac
428dc699 13763$rm -f reflect
c7aff470
NIS
13764set d_procselfexe
13765eval $setvar
13766
263fee3f
JH
13767: see whether the pthread_atfork exists
13768$cat >try.c <<EOP
13769#include <pthread.h>
13770#include <stdio.h>
13771int main() {
13772#ifdef PTHREAD_ATFORK
13773 pthread_atfork(NULL,NULL,NULL);
13774#endif
13775}
13776EOP
13777
d6483fcc 13778: see if pthread_atfork exists
263fee3f
JH
13779set try -DPTHREAD_ATFORK
13780if eval $compile; then
13781 val="$define"
13782else
13783 val="$undef"
13784fi
13785case "$usethreads" in
13786$define)
13787 case "$val" in
13788 $define) echo 'pthread_atfork found.' >&4 ;;
13789 *) echo 'pthread_atfork NOT found.' >&4 ;;
13790 esac
13791esac
13792set d_pthread_atfork
13793eval $setvar
d6483fcc 13794
b4eb6b3d
JH
13795
13796: see whether the various POSIXish _yields exist
13797$cat >try.c <<EOP
13798#include <pthread.h>
13799#include <stdio.h>
13800int main() {
13801#ifdef SCHED_YIELD
13802 sched_yield();
13803#else
13804#ifdef PTHREAD_YIELD
13805 pthread_yield();
13806#else
13807#ifdef PTHREAD_YIELD_NULL
13808 pthread_yield(NULL);
13809#endif
13810#endif
13811#endif
13812}
13813EOP
13814: see if sched_yield exists
13815set try -DSCHED_YIELD
13816if eval $compile; then
13817 val="$define"
13818 sched_yield='sched_yield()'
13819else
13820 val="$undef"
13821fi
13822case "$usethreads" in
13823$define)
13824 case "$val" in
13825 $define) echo 'sched_yield() found.' >&4 ;;
13826 *) echo 'sched_yield() NOT found.' >&4 ;;
13827 esac
13828esac
10bc17b6
JH
13829set d_sched_yield
13830eval $setvar
b4eb6b3d 13831
10bc17b6
JH
13832: see if pthread_yield exists
13833set try -DPTHREAD_YIELD
13834if eval $compile; then
13835 val="$define"
13836 case "$sched_yield" in
13837 '') sched_yield='pthread_yield()' ;;
13838 esac
13839else
13840 set try -DPTHREAD_YIELD_NULL
13841 if eval $compile; then
13842 val="$define"
13843 case "$sched_yield" in
13844 '') sched_yield='pthread_yield(NULL)' ;;
13845 esac
13846 else
13847 val="$undef"
13848 fi
13849fi
13850case "$usethreads" in
13851$define)
13852 case "$val" in
13853 $define) echo 'pthread_yield() found.' >&4 ;;
13854 *) echo 'pthread_yield() NOT found.' >&4 ;;
13855 esac
13856 ;;
13857esac
13858set d_pthread_yield
13859eval $setvar
b4eb6b3d 13860
10bc17b6
JH
13861case "$sched_yield" in
13862'') sched_yield=undef ;;
13863esac
b4eb6b3d 13864
10bc17b6
JH
13865$rm -f try try.*
13866
13867: see if random_r exists
13868set random_r d_random_r
13869eval $inlibc
13870case "$d_random_r" in
13871"$define")
13872 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
13873 case "$d_random_r_proto:$usethreads" in
13874 ":define") d_random_r_proto=define
a48ec845
JH
13875 set d_random_r_proto random_r $hdrs
13876 eval $hasproto ;;
13877 *) ;;
13878 esac
13879 case "$d_random_r_proto" in
13880 define)
10bc17b6
JH
13881 case "$random_r_proto" in
13882 ''|0) try='int random_r(int*, struct random_data*);'
13883 ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13884 esac
13885 case "$random_r_proto" in
90e831dc 13886 ''|0) d_random_r=undef
10bc17b6 13887 random_r_proto=0
a48ec845 13888 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13889 * ) case "$random_r_proto" in
13890 REENTRANT_PROTO*) ;;
13891 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13892 esac
13893 echo "Prototype: $try" ;;
13894 esac
b4eb6b3d 13895 ;;
c18e646a
JH
13896 *) case "$usethreads" in
13897 define) echo "random_r has no prototype, not using it." >&4 ;;
13898 esac
90e831dc
SB
13899 d_random_r=undef
13900 random_r_proto=0
c18e646a 13901 ;;
a48ec845
JH
13902 esac
13903 ;;
10bc17b6 13904*) random_r_proto=0
b4eb6b3d
JH
13905 ;;
13906esac
13907
13908: see if readdir and friends exist
13909set readdir d_readdir
13910eval $inlibc
13911set seekdir d_seekdir
13912eval $inlibc
13913set telldir d_telldir
13914eval $inlibc
13915set rewinddir d_rewinddir
13916eval $inlibc
13917
10bc17b6
JH
13918: see if readdir64_r exists
13919set readdir64_r d_readdir64_r
13920eval $inlibc
13921case "$d_readdir64_r" in
13922"$define")
13923 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
13924 case "$d_readdir64_r_proto:$usethreads" in
13925 ":define") d_readdir64_r_proto=define
a48ec845
JH
13926 set d_readdir64_r_proto readdir64_r $hdrs
13927 eval $hasproto ;;
13928 *) ;;
13929 esac
13930 case "$d_readdir64_r_proto" in
13931 define)
10bc17b6
JH
13932 case "$readdir64_r_proto" in
13933 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13934 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13935 esac
13936 case "$readdir64_r_proto" in
13937 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13938 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13939 esac
13940 case "$readdir64_r_proto" in
90e831dc 13941 ''|0) d_readdir64_r=undef
10bc17b6 13942 readdir64_r_proto=0
a48ec845 13943 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13944 * ) case "$readdir64_r_proto" in
13945 REENTRANT_PROTO*) ;;
13946 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13947 esac
13948 echo "Prototype: $try" ;;
13949 esac
13950 ;;
c18e646a
JH
13951 *) case "$usethreads" in
13952 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13953 esac
90e831dc
SB
13954 d_readdir64_r=undef
13955 readdir64_r_proto=0
c18e646a 13956 ;;
a48ec845
JH
13957 esac
13958 ;;
10bc17b6
JH
13959*) readdir64_r_proto=0
13960 ;;
13961esac
13962
13963: see if readdir_r exists
13964set readdir_r d_readdir_r
13965eval $inlibc
13966case "$d_readdir_r" in
13967"$define")
13968 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
13969 case "$d_readdir_r_proto:$usethreads" in
13970 ":define") d_readdir_r_proto=define
a48ec845
JH
13971 set d_readdir_r_proto readdir_r $hdrs
13972 eval $hasproto ;;
13973 *) ;;
13974 esac
13975 case "$d_readdir_r_proto" in
13976 define)
10bc17b6
JH
13977 case "$readdir_r_proto" in
13978 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13979 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13980 esac
13981 case "$readdir_r_proto" in
13982 ''|0) try='int readdir_r(DIR*, struct dirent*);'
13983 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13984 esac
13985 case "$readdir_r_proto" in
90e831dc 13986 ''|0) d_readdir_r=undef
10bc17b6 13987 readdir_r_proto=0
a48ec845 13988 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13989 * ) case "$readdir_r_proto" in
13990 REENTRANT_PROTO*) ;;
13991 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13992 esac
13993 echo "Prototype: $try" ;;
13994 esac
13995 ;;
c18e646a
JH
13996 *) case "$usethreads" in
13997 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13998 esac
90e831dc
SB
13999 d_readdir_r=undef
14000 readdir_r_proto=0
c18e646a 14001 ;;
a48ec845
JH
14002 esac
14003 ;;
10bc17b6
JH
14004*) readdir_r_proto=0
14005 ;;
14006esac
14007
4e0554ec
JH
14008: see if readv exists
14009set readv d_readv
14010eval $inlibc
14011
14012: see if recvmsg exists
14013set recvmsg d_recvmsg
14014eval $inlibc
14015
b4eb6b3d
JH
14016: see if rename exists
14017set rename d_rename
14018eval $inlibc
14019
14020: see if rmdir exists
14021set rmdir d_rmdir
14022eval $inlibc
14023
14024: see if memory.h is available.
14025val=''
14026set memory.h val
14027eval $inhdr
14028
14029: See if it conflicts with string.h
14030case "$val" in
14031$define)
14032 case "$strings" in
14033 '') ;;
14034 *)
14035 $cppstdin $cppflags $cppminus < $strings > mem.h
14036 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14037 echo " "
14038 echo "We won't be including <memory.h>."
14039 val="$undef"
14040 fi
14041 $rm -f mem.h
14042 ;;
14043 esac
14044esac
14045set i_memory
14046eval $setvar
14047
14048: can bcopy handle overlapping blocks?
b6cc3bc4 14049echo " "
b4eb6b3d 14050val="$undef"
b6cc3bc4
AD
14051case "$d_memmove" in
14052"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14053*) case "$d_bcopy" in
14054 "$define")
14055 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14056 $cat >try.c <<EOCP
b4eb6b3d
JH
14057#$i_memory I_MEMORY
14058#$i_stdlib I_STDLIB
14059#$i_string I_STRING
14060#$i_unistd I_UNISTD
14061EOCP
14062 $cat >>try.c <<'EOCP'
14063#include <stdio.h>
14064#ifdef I_MEMORY
14065# include <memory.h>
14066#endif
14067#ifdef I_STDLIB
14068# include <stdlib.h>
14069#endif
14070#ifdef I_STRING
14071# include <string.h>
14072#else
14073# include <strings.h>
14074#endif
14075#ifdef I_UNISTD
14076# include <unistd.h> /* Needed for NetBSD */
14077#endif
14078int main()
14079{
14080char buf[128], abc[128];
14081char *b;
14082int len;
14083int off;
14084int align;
14085
b6cc3bc4
AD
14086/* Copy "abcde..." string to char abc[] so that gcc doesn't
14087 try to store the string in read-only memory. */
b4eb6b3d
JH
14088bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14089
14090for (align = 7; align >= 0; align--) {
14091 for (len = 36; len; len--) {
14092 b = buf+align;
14093 bcopy(abc, b, len);
14094 for (off = 1; off <= len; off++) {
14095 bcopy(b, b+off, len);
14096 bcopy(b+off, b, len);
14097 if (bcmp(b, abc, len))
14098 exit(1);
14099 }
14100 }
14101}
14102exit(0);
14103}
14104EOCP
b6cc3bc4
AD
14105 set try
14106 if eval $compile_ok; then
14107 if ./try 2>/dev/null; then
14108 echo "Yes, it can."
14109 val="$define"
14110 else
14111 echo "It can't, sorry."
14112 fi
b4eb6b3d 14113 else
b6cc3bc4 14114 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14115 fi
b6cc3bc4
AD
14116 ;;
14117 esac
14118 $rm -f try.* try core
b4eb6b3d
JH
14119 ;;
14120esac
b4eb6b3d
JH
14121set d_safebcpy
14122eval $setvar
14123
14124: can memcpy handle overlapping blocks?
b6cc3bc4 14125echo " "
b4eb6b3d 14126val="$undef"
b6cc3bc4
AD
14127case "$d_memmove" in
14128"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14129*) case "$d_memcpy" in
14130 "$define")
14131 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14132 $cat >try.c <<EOCP
b4eb6b3d
JH
14133#$i_memory I_MEMORY
14134#$i_stdlib I_STDLIB
14135#$i_string I_STRING
14136#$i_unistd I_UNISTD
14137EOCP
14138 $cat >>try.c <<'EOCP'
14139#include <stdio.h>
14140#ifdef I_MEMORY
14141# include <memory.h>
14142#endif
14143#ifdef I_STDLIB
14144# include <stdlib.h>
14145#endif
14146#ifdef I_STRING
14147# include <string.h>
14148#else
14149# include <strings.h>
14150#endif
14151#ifdef I_UNISTD
14152# include <unistd.h> /* Needed for NetBSD */
14153#endif
14154int main()
14155{
14156char buf[128], abc[128];
14157char *b;
14158int len;
14159int off;
14160int align;
14161
14162/* Copy "abcde..." string to char abc[] so that gcc doesn't
14163 try to store the string in read-only memory. */
14164memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14165
14166for (align = 7; align >= 0; align--) {
14167 for (len = 36; len; len--) {
14168 b = buf+align;
14169 memcpy(b, abc, len);
14170 for (off = 1; off <= len; off++) {
14171 memcpy(b+off, b, len);
14172 memcpy(b, b+off, len);
14173 if (memcmp(b, abc, len))
14174 exit(1);
14175 }
14176 }
14177}
14178exit(0);
14179}
14180EOCP
b6cc3bc4
AD
14181 set try
14182 if eval $compile_ok; then
14183 if ./try 2>/dev/null; then
14184 echo "Yes, it can."
14185 val="$define"
14186 else
14187 echo "It can't, sorry."
14188 fi
b4eb6b3d 14189 else
b6cc3bc4 14190 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14191 fi
b6cc3bc4
AD
14192 ;;
14193 esac
14194 $rm -f try.* try core
b4eb6b3d
JH
14195 ;;
14196esac
b4eb6b3d
JH
14197set d_safemcpy
14198eval $setvar
14199
14200: can memcmp be trusted to compare relative magnitude?
14201val="$undef"
14202case "$d_memcmp" in
14203"$define")
14204 echo " "
14205 echo "Checking if your memcmp() can compare relative magnitude..." >&4
14206 $cat >try.c <<EOCP
14207#$i_memory I_MEMORY
14208#$i_stdlib I_STDLIB
14209#$i_string I_STRING
14210#$i_unistd I_UNISTD
14211EOCP
14212 $cat >>try.c <<'EOCP'
14213#include <stdio.h>
14214#ifdef I_MEMORY
14215# include <memory.h>
14216#endif
14217#ifdef I_STDLIB
14218# include <stdlib.h>
14219#endif
14220#ifdef I_STRING
14221# include <string.h>
14222#else
14223# include <strings.h>
14224#endif
14225#ifdef I_UNISTD
14226# include <unistd.h> /* Needed for NetBSD */
14227#endif
14228int main()
14229{
14230char a = -1;
14231char b = 0;
14232if ((a < b) && memcmp(&a, &b, 1) < 0)
14233 exit(1);
14234exit(0);
14235}
14236EOCP
14237 set try
14238 if eval $compile_ok; then
5440bc8e 14239 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
14240 echo "Yes, it can."
14241 val="$define"
14242 else
14243 echo "No, it can't (it uses signed chars)."
14244 fi
14245 else
14246 echo "(I can't compile the test program, so we'll assume not...)"
14247 fi
14248 ;;
14249esac
14250$rm -f try.* try core
14251set d_sanemcmp
14252eval $setvar
14253
ef9f17be
JH
14254: see if prototype for sbrk is available
14255echo " "
14256set d_sbrkproto sbrk $i_unistd unistd.h
14257eval $hasproto
14258
b4eb6b3d
JH
14259: see if select exists
14260set select d_select
14261eval $inlibc
14262
14263: see if semctl exists
14264set semctl d_semctl
14265eval $inlibc
14266
14267: see if semget exists
14268set semget d_semget
14269eval $inlibc
14270
14271: see if semop exists
14272set semop d_semop
14273eval $inlibc
14274
14275: see how much of the 'sem*(2)' library is present.
14276h_sem=true
14277echo " "
14278case "$d_semctl$d_semget$d_semop" in
14279*"$undef"*) h_sem=false;;
14280esac
14281case "$osname" in
14282freebsd)
14283 case "`ipcs 2>&1`" in
14284 "SVID messages"*"not configured"*)
14285 echo "Your $osname does not have the sem*(2) configured." >&4
14286 h_sem=false
14287 val="$undef"
14288 set semctl d_semctl
14289 eval $setvar
14290 set semget d_semget
14291 eval $setvar
14292 set semop d_semop
14293 eval $setvar
14294 ;;
14295 esac
14296 ;;
14297esac
14298: we could also check for sys/ipc.h ...
14299if $h_sem && $test `./findhdr sys/sem.h`; then
14300 echo "You have the full sem*(2) library." >&4
14301 val="$define"
14302else
14303 echo "You don't have the full sem*(2) library." >&4
14304 val="$undef"
14305fi
14306set d_sem
14307eval $setvar
14308
14309: see whether sys/sem.h defines union semun
14310echo " "
14311$cat > try.c <<'END'
14312#include <sys/types.h>
14313#include <sys/ipc.h>
14314#include <sys/sem.h>
14315int main () { union semun semun; semun.buf = 0; }
14316END
14317set try
14318if eval $compile; then
14319 echo "You have union semun in <sys/sem.h>." >&4
14320 val="$define"
14321else
14322 echo "You do not have union semun in <sys/sem.h>." >&4
14323 val="$undef"
14324fi
14325$rm -f try try.c try.h
14326set d_union_semun
14327eval $setvar
14328
14329: see how to do semctl IPC_STAT
14330case "$d_sem" in
14331$define)
14332 : see whether semctl IPC_STAT can use union semun
14333 echo " "
14334 $cat > try.h <<END
14335#ifndef S_IRUSR
14336# ifdef S_IREAD
14337# define S_IRUSR S_IREAD
14338# define S_IWUSR S_IWRITE
14339# define S_IXUSR S_IEXEC
14340# else
14341# define S_IRUSR 0400
14342# define S_IWUSR 0200
14343# define S_IXUSR 0100
14344# endif
14345# define S_IRGRP (S_IRUSR>>3)
14346# define S_IWGRP (S_IWUSR>>3)
14347# define S_IXGRP (S_IXUSR>>3)
14348# define S_IROTH (S_IRUSR>>6)
14349# define S_IWOTH (S_IWUSR>>6)
14350# define S_IXOTH (S_IXUSR>>6)
14351#endif
14352#ifndef S_IRWXU
14353# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14354# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14355# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14356#endif
14357END
14358
14359 $cat > try.c <<END
14360#include <sys/types.h>
14361#include <sys/ipc.h>
14362#include <sys/sem.h>
14363#include <sys/stat.h>
14364#include <stdio.h>
14365#include <errno.h>
14366#include "try.h"
14367#ifndef errno
14368extern int errno;
14369#endif
14370#$d_union_semun HAS_UNION_SEMUN
14371int main() {
14372 union semun
14373#ifndef HAS_UNION_SEMUN
14374 {
14375 int val;
14376 struct semid_ds *buf;
14377 unsigned short *array;
14378 }
14379#endif
14380 arg;
14381 int sem, st;
14382
14383#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14384 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14385 if (sem > -1) {
14386 struct semid_ds argbuf;
14387 arg.buf = &argbuf;
14388# ifdef IPC_STAT
14389 st = semctl(sem, 0, IPC_STAT, arg);
14390 if (st == 0)
14391 printf("semun\n");
14392 else
14393# endif /* IPC_STAT */
14394 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14395# ifdef IPC_RMID
14396 if (semctl(sem, 0, IPC_RMID, arg) != 0)
14397# endif /* IPC_RMID */
14398 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14399 } else
14400#endif /* IPC_PRIVATE && ... */
14401 printf("semget failed: errno = %d\n", errno);
14402 return 0;
14403}
14404END
14405 val="$undef"
14406 set try
14407 if eval $compile; then
5440bc8e 14408 xxx=`$run ./try`
b4eb6b3d
JH
14409 case "$xxx" in
14410 semun) val="$define" ;;
14411 esac
14412 fi
14413 $rm -f try try.c
14414 set d_semctl_semun
14415 eval $setvar
14416 case "$d_semctl_semun" in
14417 $define)
14418 echo "You can use union semun for semctl IPC_STAT." >&4
14419 also='also'
14420 ;;
14421 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
14422 also=''
14423 ;;
14424 esac
14425
14426 : see whether semctl IPC_STAT can use struct semid_ds pointer
14427 $cat > try.c <<'END'
14428#include <sys/types.h>
14429#include <sys/ipc.h>
14430#include <sys/sem.h>
14431#include <sys/stat.h>
14432#include "try.h"
14433#include <stdio.h>
14434#include <errno.h>
14435#ifndef errno
14436extern int errno;
14437#endif
14438int main() {
14439 struct semid_ds arg;
14440 int sem, st;
14441
14442#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14443 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14444 if (sem > -1) {
14445# ifdef IPC_STAT
14446 st = semctl(sem, 0, IPC_STAT, &arg);
14447 if (st == 0)
14448 printf("semid_ds\n");
14449 else
14450# endif /* IPC_STAT */
14451 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14452# ifdef IPC_RMID
14453 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14454# endif /* IPC_RMID */
14455 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14456 } else
14457#endif /* IPC_PRIVATE && ... */
14458 printf("semget failed: errno = %d\n", errno);
14459
14460 return 0;
14461}
14462END
14463 val="$undef"
14464 set try
14465 if eval $compile; then
5440bc8e 14466 xxx=`$run ./try`
b4eb6b3d
JH
14467 case "$xxx" in
14468 semid_ds) val="$define" ;;
14469 esac
14470 fi
14471 $rm -f try try.c
14472 set d_semctl_semid_ds
14473 eval $setvar
14474 case "$d_semctl_semid_ds" in
14475 $define)
14476 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14477 ;;
14478 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14479 ;;
14480 esac
14481 $rm -f try.h
14482 ;;
14483*) val="$undef"
14484
14485 # We do not have the full sem*(2) library, so assume we can not
14486 # use either.
14487
14488 set d_semctl_semun
14489 eval $setvar
14490
14491 set d_semctl_semid_ds
14492 eval $setvar
14493 ;;
14494esac
14495
4e0554ec
JH
14496: see if sendmsg exists
14497set sendmsg d_sendmsg
14498eval $inlibc
14499
b4eb6b3d
JH
14500: see if setegid exists
14501set setegid d_setegid
14502eval $inlibc
14503
14504: see if seteuid exists
14505set seteuid d_seteuid
14506eval $inlibc
14507
14508: see if setgrent exists
14509set setgrent d_setgrent
14510eval $inlibc
14511
10bc17b6
JH
14512: see if setgrent_r exists
14513set setgrent_r d_setgrent_r
14514eval $inlibc
14515case "$d_setgrent_r" in
14516"$define")
14517 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
14518 case "$d_setgrent_r_proto:$usethreads" in
14519 ":define") d_setgrent_r_proto=define
a48ec845
JH
14520 set d_setgrent_r_proto setgrent_r $hdrs
14521 eval $hasproto ;;
14522 *) ;;
14523 esac
14524 case "$d_setgrent_r_proto" in
14525 define)
10bc17b6
JH
14526 case "$setgrent_r_proto" in
14527 ''|0) try='int setgrent_r(FILE**);'
14528 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14529 esac
14530 case "$setgrent_r_proto" in
14531 ''|0) try='void setgrent_r(FILE**);'
14532 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14533 esac
14534 case "$setgrent_r_proto" in
90e831dc 14535 ''|0) d_setgrent_r=undef
10bc17b6 14536 setgrent_r_proto=0
a48ec845 14537 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14538 * ) case "$setgrent_r_proto" in
14539 REENTRANT_PROTO*) ;;
14540 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14541 esac
14542 echo "Prototype: $try" ;;
14543 esac
14544 ;;
c18e646a
JH
14545 *) case "$usethreads" in
14546 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14547 esac
90e831dc
SB
14548 d_setgrent_r=undef
14549 setgrent_r_proto=0
c18e646a 14550 ;;
a48ec845
JH
14551 esac
14552 ;;
10bc17b6
JH
14553*) setgrent_r_proto=0
14554 ;;
14555esac
14556
b4eb6b3d
JH
14557: see if sethostent exists
14558set sethostent d_sethent
14559eval $inlibc
14560
10bc17b6
JH
14561: see if sethostent_r exists
14562set sethostent_r d_sethostent_r
14563eval $inlibc
14564case "$d_sethostent_r" in
14565"$define")
14566 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14567 case "$d_sethostent_r_proto:$usethreads" in
14568 ":define") d_sethostent_r_proto=define
a48ec845
JH
14569 set d_sethostent_r_proto sethostent_r $hdrs
14570 eval $hasproto ;;
14571 *) ;;
14572 esac
14573 case "$d_sethostent_r_proto" in
14574 define)
10bc17b6
JH
14575 case "$sethostent_r_proto" in
14576 ''|0) try='int sethostent_r(int, struct hostent_data*);'
14577 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14578 esac
14579 case "$sethostent_r_proto" in
14580 ''|0) try='void sethostent_r(int, struct hostent_data*);'
14581 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14582 esac
14583 case "$sethostent_r_proto" in
90e831dc 14584 ''|0) d_sethostent_r=undef
10bc17b6 14585 sethostent_r_proto=0
a48ec845 14586 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14587 * ) case "$sethostent_r_proto" in
14588 REENTRANT_PROTO*) ;;
14589 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14590 esac
14591 echo "Prototype: $try" ;;
14592 esac
14593 ;;
c18e646a
JH
14594 *) case "$usethreads" in
14595 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14596 esac
90e831dc
SB
14597 d_sethostent_r=undef
14598 sethostent_r_proto=0
c18e646a 14599 ;;
a48ec845
JH
14600 esac
14601 ;;
10bc17b6
JH
14602*) sethostent_r_proto=0
14603 ;;
14604esac
14605
4e0554ec
JH
14606: see if setitimer exists
14607set setitimer d_setitimer
14608eval $inlibc
14609
b4eb6b3d
JH
14610: see if setlinebuf exists
14611set setlinebuf d_setlinebuf
14612eval $inlibc
14613
14614: see if setlocale exists
14615set setlocale d_setlocale
14616eval $inlibc
14617
10bc17b6
JH
14618: see if locale.h is available
14619set locale.h i_locale
14620eval $inhdr
14621
14622: see if setlocale_r exists
14623set setlocale_r d_setlocale_r
14624eval $inlibc
14625case "$d_setlocale_r" in
14626"$define")
14627 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
14628 case "$d_setlocale_r_proto:$usethreads" in
14629 ":define") d_setlocale_r_proto=define
a48ec845
JH
14630 set d_setlocale_r_proto setlocale_r $hdrs
14631 eval $hasproto ;;
14632 *) ;;
14633 esac
14634 case "$d_setlocale_r_proto" in
14635 define)
10bc17b6
JH
14636 case "$setlocale_r_proto" in
14637 ''|0) try='int setlocale_r(int, const char*, char*, int);'
14638 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14639 esac
14640 case "$setlocale_r_proto" in
90e831dc 14641 ''|0) d_setlocale_r=undef
10bc17b6 14642 setlocale_r_proto=0
a48ec845 14643 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14644 * ) case "$setlocale_r_proto" in
14645 REENTRANT_PROTO*) ;;
14646 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14647 esac
14648 echo "Prototype: $try" ;;
14649 esac
14650 ;;
c18e646a
JH
14651 *) case "$usethreads" in
14652 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14653 esac
90e831dc
SB
14654 d_setlocale_r=undef
14655 setlocale_r_proto=0
c18e646a 14656 ;;
a48ec845
JH
14657 esac
14658 ;;
10bc17b6
JH
14659*) setlocale_r_proto=0
14660 ;;
14661esac
14662
b4eb6b3d
JH
14663: see if setnetent exists
14664set setnetent d_setnent
14665eval $inlibc
14666
10bc17b6
JH
14667: see if setnetent_r exists
14668set setnetent_r d_setnetent_r
14669eval $inlibc
14670case "$d_setnetent_r" in
14671"$define")
14672 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14673 case "$d_setnetent_r_proto:$usethreads" in
14674 ":define") d_setnetent_r_proto=define
a48ec845
JH
14675 set d_setnetent_r_proto setnetent_r $hdrs
14676 eval $hasproto ;;
14677 *) ;;
14678 esac
14679 case "$d_setnetent_r_proto" in
14680 define)
10bc17b6
JH
14681 case "$setnetent_r_proto" in
14682 ''|0) try='int setnetent_r(int, struct netent_data*);'
14683 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14684 esac
14685 case "$setnetent_r_proto" in
14686 ''|0) try='void setnetent_r(int, struct netent_data*);'
14687 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14688 esac
14689 case "$setnetent_r_proto" in
90e831dc 14690 ''|0) d_setnetent_r=undef
10bc17b6 14691 setnetent_r_proto=0
a48ec845 14692 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14693 * ) case "$setnetent_r_proto" in
14694 REENTRANT_PROTO*) ;;
14695 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14696 esac
14697 echo "Prototype: $try" ;;
14698 esac
14699 ;;
c18e646a
JH
14700 *) case "$usethreads" in
14701 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14702 esac
90e831dc
SB
14703 d_setnetent_r=undef
14704 setnetent_r_proto=0
c18e646a 14705 ;;
a48ec845
JH
14706 esac
14707 ;;
10bc17b6
JH
14708*) setnetent_r_proto=0
14709 ;;
14710esac
14711
b4eb6b3d
JH
14712: see if setprotoent exists
14713set setprotoent d_setpent
14714eval $inlibc
14715
14716: see if setpgid exists
14717set setpgid d_setpgid
14718eval $inlibc
14719
14720: see if setpgrp2 exists
14721set setpgrp2 d_setpgrp2
14722eval $inlibc
14723
14724: see if setpriority exists
14725set setpriority d_setprior
14726eval $inlibc
14727
14728: see if setproctitle exists
14729set setproctitle d_setproctitle
14730eval $inlibc
14731
10bc17b6
JH
14732: see if setprotoent_r exists
14733set setprotoent_r d_setprotoent_r
14734eval $inlibc
14735case "$d_setprotoent_r" in
14736"$define")
14737 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14738 case "$d_setprotoent_r_proto:$usethreads" in
14739 ":define") d_setprotoent_r_proto=define
a48ec845
JH
14740 set d_setprotoent_r_proto setprotoent_r $hdrs
14741 eval $hasproto ;;
14742 *) ;;
14743 esac
14744 case "$d_setprotoent_r_proto" in
14745 define)
10bc17b6
JH
14746 case "$setprotoent_r_proto" in
14747 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14748 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14749 esac
14750 case "$setprotoent_r_proto" in
14751 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14752 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14753 esac
14754 case "$setprotoent_r_proto" in
90e831dc 14755 ''|0) d_setprotoent_r=undef
10bc17b6 14756 setprotoent_r_proto=0
a48ec845 14757 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14758 * ) case "$setprotoent_r_proto" in
14759 REENTRANT_PROTO*) ;;
14760 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14761 esac
14762 echo "Prototype: $try" ;;
14763 esac
14764 ;;
c18e646a
JH
14765 *) case "$usethreads" in
14766 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14767 esac
90e831dc
SB
14768 d_setprotoent_r=undef
14769 setprotoent_r_proto=0
c18e646a 14770 ;;
a48ec845
JH
14771 esac
14772 ;;
10bc17b6
JH
14773*) setprotoent_r_proto=0
14774 ;;
14775esac
14776
b4eb6b3d
JH
14777: see if setpwent exists
14778set setpwent d_setpwent
14779eval $inlibc
14780
10bc17b6
JH
14781: see if setpwent_r exists
14782set setpwent_r d_setpwent_r
14783eval $inlibc
14784case "$d_setpwent_r" in
14785"$define")
14786 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14787 case "$d_setpwent_r_proto:$usethreads" in
14788 ":define") d_setpwent_r_proto=define
a48ec845
JH
14789 set d_setpwent_r_proto setpwent_r $hdrs
14790 eval $hasproto ;;
14791 *) ;;
14792 esac
14793 case "$d_setpwent_r_proto" in
14794 define)
10bc17b6
JH
14795 case "$setpwent_r_proto" in
14796 ''|0) try='int setpwent_r(FILE**);'
14797 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14798 esac
14799 case "$setpwent_r_proto" in
14800 ''|0) try='void setpwent_r(FILE**);'
14801 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14802 esac
14803 case "$setpwent_r_proto" in
90e831dc 14804 ''|0) d_setpwent_r=undef
10bc17b6 14805 setpwent_r_proto=0
a48ec845 14806 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14807 * ) case "$setpwent_r_proto" in
14808 REENTRANT_PROTO*) ;;
14809 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14810 esac
14811 echo "Prototype: $try" ;;
14812 esac
14813 ;;
c18e646a
JH
14814 *) case "$usethreads" in
14815 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14816 esac
90e831dc
SB
14817 d_setpwent_r=undef
14818 setpwent_r_proto=0
c18e646a 14819 ;;
a48ec845
JH
14820 esac
14821 ;;
10bc17b6
JH
14822*) setpwent_r_proto=0
14823 ;;
14824esac
14825
b4eb6b3d
JH
14826: see if setregid exists
14827set setregid d_setregid
14828eval $inlibc
14829set setresgid d_setresgid
14830eval $inlibc
14831
14832: see if setreuid exists
14833set setreuid d_setreuid
14834eval $inlibc
14835set setresuid d_setresuid
14836eval $inlibc
14837
14838: see if setrgid exists
14839set setrgid d_setrgid
14840eval $inlibc
14841
14842: see if setruid exists
14843set setruid d_setruid
14844eval $inlibc
14845
14846: see if setservent exists
14847set setservent d_setsent
14848eval $inlibc
14849
10bc17b6
JH
14850: see if setservent_r exists
14851set setservent_r d_setservent_r
14852eval $inlibc
14853case "$d_setservent_r" in
14854"$define")
14855 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14856 case "$d_setservent_r_proto:$usethreads" in
14857 ":define") d_setservent_r_proto=define
a48ec845
JH
14858 set d_setservent_r_proto setservent_r $hdrs
14859 eval $hasproto ;;
14860 *) ;;
14861 esac
14862 case "$d_setservent_r_proto" in
14863 define)
10bc17b6
JH
14864 case "$setservent_r_proto" in
14865 ''|0) try='int setservent_r(int, struct servent_data*);'
14866 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14867 esac
14868 case "$setservent_r_proto" in
14869 ''|0) try='void setservent_r(int, struct servent_data*);'
14870 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14871 esac
14872 case "$setservent_r_proto" in
90e831dc 14873 ''|0) d_setservent_r=undef
10bc17b6 14874 setservent_r_proto=0
a48ec845 14875 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14876 * ) case "$setservent_r_proto" in
14877 REENTRANT_PROTO*) ;;
14878 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14879 esac
14880 echo "Prototype: $try" ;;
14881 esac
14882 ;;
c18e646a
JH
14883 *) case "$usethreads" in
14884 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14885 esac
90e831dc
SB
14886 d_setservent_r=undef
14887 setservent_r_proto=0
c18e646a 14888 ;;
a48ec845
JH
14889 esac
14890 ;;
10bc17b6
JH
14891*) setservent_r_proto=0
14892 ;;
14893esac
14894
b4eb6b3d
JH
14895: see if setsid exists
14896set setsid d_setsid
14897eval $inlibc
14898
14899: see if setvbuf exists
14900set setvbuf d_setvbuf
14901eval $inlibc
14902
14903: see if sfio.h is available
14904set sfio.h i_sfio
14905eval $inhdr
14906
14907
14908: see if sfio library is available
14909case "$i_sfio" in
14910$define)
14911 val=''
14912 set sfreserve val
14913 eval $inlibc
14914 ;;
14915*)
14916 val="$undef"
14917 ;;
14918esac
14919: Ok, but do we want to use it.
14920case "$val" in
14921$define)
14922 case "$usesfio" in
14923 true|$define|[yY]*) dflt='y';;
14924 *) dflt='n';;
14925 esac
14926 echo "$package can use the sfio library, but it is experimental."
14927 case "$useperlio" in
14928 "$undef")
14929 echo "For sfio also the PerlIO abstraction layer is needed."
14930 echo "Earlier you said you wouldn't want that."
14931 ;;
14932 esac
14933 rp="You seem to have sfio available, do you want to try using it?"
14934 . ./myread
14935 case "$ans" in
14936 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
14937 useperlio="$define"
14938 val="$define"
14939 ;;
14940 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
14941 val="$undef"
b4eb6b3d
JH
14942 ;;
14943 esac
14944 ;;
14945*) case "$usesfio" in
14946 true|$define|[yY]*)
14947 echo "Sorry, cannot find sfio on this machine." >&4
14948 echo "Ignoring your setting of usesfio=$usesfio." >&4
14949 val="$undef"
14950 ;;
14951 esac
14952 ;;
14953esac
14954set d_sfio
14955eval $setvar
14956case "$d_sfio" in
14957$define) usesfio='true';;
14958*) usesfio='false';;
14959esac
3659ebf1
JH
14960case "$d_sfio" in
14961$define) ;;
14962*) : Remove sfio from list of libraries to use
7483f793
JH
14963 case "$libs" in
14964 *-lsfio*)
14965 echo "Removing unneeded -lsfio from library list" >&4
14966 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14967 shift
14968 libs="$*"
14969 echo "libs = $libs" >&4
14970 ;;
14971 esac
3659ebf1
JH
14972;;
14973esac
14974
b4eb6b3d
JH
14975
14976: see if shmctl exists
14977set shmctl d_shmctl
14978eval $inlibc
14979
14980: see if shmget exists
14981set shmget d_shmget
14982eval $inlibc
14983
14984: see if shmat exists
14985set shmat d_shmat
14986eval $inlibc
14987: see what shmat returns
14988case "$d_shmat" in
14989"$define")
14990 $cat >shmat.c <<'END'
14991#include <sys/shm.h>
14992void *shmat();
14993END
14994 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14995 shmattype='void *'
14996 else
14997 shmattype='char *'
14998 fi
14999 echo "and it returns ($shmattype)." >&4
15000 : see if a prototype for shmat is available
15001 xxx=`./findhdr sys/shm.h`
15002 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15003 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15004 val="$define"
15005 else
15006 val="$undef"
15007 fi
15008 $rm -f shmat.[co]
15009 ;;
15010*)
15011 val="$undef"
15012 ;;
15013esac
15014set d_shmatprototype
15015eval $setvar
15016
15017: see if shmdt exists
15018set shmdt d_shmdt
15019eval $inlibc
15020
15021: see how much of the 'shm*(2)' library is present.
15022h_shm=true
15023echo " "
15024case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15025*"$undef"*) h_shm=false;;
15026esac
15027case "$osname" in
15028freebsd)
15029 case "`ipcs 2>&1`" in
15030 "SVID shared memory"*"not configured"*)
15031 echo "Your $osname does not have the shm*(2) configured." >&4
15032 h_shm=false
15033 val="$undef"
15034 set shmctl d_shmctl
15035 evat $setvar
15036 set shmget d_shmget
15037 evat $setvar
15038 set shmat d_shmat
15039 evat $setvar
15040 set shmdt d_shmdt
15041 evat $setvar
15042 ;;
15043 esac
15044 ;;
15045esac
15046: we could also check for sys/ipc.h ...
15047if $h_shm && $test `./findhdr sys/shm.h`; then
15048 echo "You have the full shm*(2) library." >&4
15049 val="$define"
15050else
15051 echo "You don't have the full shm*(2) library." >&4
15052 val="$undef"
15053fi
15054set d_shm
15055eval $setvar
15056
15057echo " "
15058: see if we have sigaction
15059if set sigaction val -f d_sigaction; eval $csym; $val; then
15060 echo 'sigaction() found.' >&4
15061 $cat > try.c <<'EOP'
15062#include <stdio.h>
15063#include <sys/types.h>
15064#include <signal.h>
15065int main()
15066{
15067 struct sigaction act, oact;
15068 act.sa_flags = 0;
15069 oact.sa_handler = 0;
15070 /* so that act and oact are used */
15071 exit(act.sa_flags == 0 && oact.sa_handler == 0);
15072}
15073EOP
15074 set try
15075 if eval $compile_ok; then
15076 val="$define"
15077 else
15078 echo "But you don't seem to have a useable struct sigaction." >&4
15079 val="$undef"
15080 fi
15081else
15082 echo 'sigaction NOT found.' >&4
15083 val="$undef"
15084fi
15085set d_sigaction; eval $setvar
15086$rm -f try try$_o try.c
15087
983dbef6
JH
15088: see if sigprocmask exists
15089set sigprocmask d_sigprocmask
15090eval $inlibc
15091
b4eb6b3d
JH
15092: see if sigsetjmp exists
15093echo " "
15094case "$d_sigsetjmp" in
15095'')
15096 $cat >try.c <<'EOP'
15097#include <setjmp.h>
15098sigjmp_buf env;
15099int set = 1;
15100int main()
15101{
15102 if (sigsetjmp(env,1))
15103 exit(set);
15104 set = 0;
15105 siglongjmp(env, 1);
15106 exit(1);
15107}
15108EOP
15109 set try
15110 if eval $compile; then
5440bc8e 15111 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
15112 echo "POSIX sigsetjmp found." >&4
15113 val="$define"
15114 else
15115 $cat >&4 <<EOM
15116Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15117I'll ignore them.
15118EOM
15119 val="$undef"
15120 fi
15121 else
15122 echo "sigsetjmp not found." >&4
15123 val="$undef"
15124 fi
15125 ;;
15126*) val="$d_sigsetjmp"
15127 case "$d_sigsetjmp" in
15128 $define) echo "POSIX sigsetjmp found." >&4;;
15129 $undef) echo "sigsetjmp not found." >&4;;
15130 esac
15131 ;;
15132esac
15133set d_sigsetjmp
15134eval $setvar
15135$rm -f try.c try
15136
49a78c82
JH
15137: see if sockatmark exists
15138set sockatmark d_sockatmark
15139eval $inlibc
15140
2ef53570
JH
15141: see if prototype for sockatmark is available
15142echo " "
15143set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15144eval $hasproto
15145
b4eb6b3d
JH
15146: see if socks5_init exists
15147set socks5_init d_socks5_init
15148eval $inlibc
15149
10bc17b6
JH
15150: see if srand48_r exists
15151set srand48_r d_srand48_r
15152eval $inlibc
15153case "$d_srand48_r" in
15154"$define")
15155 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15156 case "$d_srand48_r_proto:$usethreads" in
15157 ":define") d_srand48_r_proto=define
a48ec845
JH
15158 set d_srand48_r_proto srand48_r $hdrs
15159 eval $hasproto ;;
15160 *) ;;
15161 esac
15162 case "$d_srand48_r_proto" in
15163 define)
10bc17b6
JH
15164 case "$srand48_r_proto" in
15165 ''|0) try='int srand48_r(long, struct drand48_data*);'
15166 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15167 esac
15168 case "$srand48_r_proto" in
90e831dc 15169 ''|0) d_srand48_r=undef
10bc17b6 15170 srand48_r_proto=0
a48ec845 15171 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15172 * ) case "$srand48_r_proto" in
15173 REENTRANT_PROTO*) ;;
15174 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15175 esac
15176 echo "Prototype: $try" ;;
15177 esac
15178 ;;
c18e646a
JH
15179 *) case "$usethreads" in
15180 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15181 esac
90e831dc
SB
15182 d_srand48_r=undef
15183 srand48_r_proto=0
c18e646a 15184 ;;
a48ec845
JH
15185 esac
15186 ;;
10bc17b6
JH
15187*) srand48_r_proto=0
15188 ;;
15189esac
15190
15191: see if srandom_r exists
15192set srandom_r d_srandom_r
15193eval $inlibc
15194case "$d_srandom_r" in
15195"$define")
15196 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15197 case "$d_srandom_r_proto:$usethreads" in
15198 ":define") d_srandom_r_proto=define
a48ec845
JH
15199 set d_srandom_r_proto srandom_r $hdrs
15200 eval $hasproto ;;
15201 *) ;;
15202 esac
15203 case "$d_srandom_r_proto" in
15204 define)
10bc17b6
JH
15205 case "$srandom_r_proto" in
15206 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15207 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15208 esac
15209 case "$srandom_r_proto" in
90e831dc 15210 ''|0) d_srandom_r=undef
10bc17b6 15211 srandom_r_proto=0
a48ec845 15212 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15213 * ) case "$srandom_r_proto" in
15214 REENTRANT_PROTO*) ;;
15215 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15216 esac
15217 echo "Prototype: $try" ;;
15218 esac
15219 ;;
c18e646a
JH
15220 *) case "$usethreads" in
15221 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15222 esac
90e831dc
SB
15223 d_srandom_r=undef
15224 srandom_r_proto=0
c18e646a 15225 ;;
a48ec845
JH
15226 esac
15227 ;;
10bc17b6
JH
15228*) srandom_r_proto=0
15229 ;;
15230esac
15231
eef837ea
JH
15232: see if prototype for setresgid is available
15233echo " "
15234set d_sresgproto setresgid $i_unistd unistd.h
15235eval $hasproto
15236
640374d0
JH
15237: see if prototype for setresuid is available
15238echo " "
15239set d_sresuproto setresuid $i_unistd unistd.h
15240eval $hasproto
15241
b4eb6b3d
JH
15242: see if sys/stat.h is available
15243set sys/stat.h i_sysstat
15244eval $inhdr
15245
15246
15247: see if stat knows about block sizes
15248echo " "
15249echo "Checking to see if your struct stat has st_blocks field..." >&4
15250set d_statblks stat st_blocks $i_sysstat sys/stat.h
15251eval $hasfield
15252
15253
15254: see if this is a sys/vfs.h system
15255set sys/vfs.h i_sysvfs
15256eval $inhdr
15257
15258
15259: see if this is a sys/statfs.h system
15260set sys/statfs.h i_sysstatfs
15261eval $inhdr
15262
15263
15264echo " "
15265echo "Checking to see if your system supports struct statfs..." >&4
15266set 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
15267eval $hasstruct
15268case "$d_statfs_s" in
15269"$define") echo "Yes, it does." ;;
15270*) echo "No, it doesn't." ;;
15271esac
15272
15273
15274
15275: see if struct statfs knows about f_flags
15276case "$d_statfs_s" in
15277define)
15278 echo " "
15279 echo "Checking to see if your struct statfs has f_flags field..." >&4
15280 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
15281 eval $hasfield
15282 ;;
15283*) val="$undef"
15284 set d_statfs_f_flags
15285 eval $setvar
15286 ;;
15287esac
15288case "$d_statfs_f_flags" in
15289"$define") echo "Yes, it does." ;;
15290*) echo "No, it doesn't." ;;
15291esac
15292
15293: see if _ptr and _cnt from stdio act std
15294echo " "
80f36755
NC
15295
15296if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15297 echo "(Looks like you have stdio.h from BSD.)"
15298 case "$stdio_ptr" in
15299 '') stdio_ptr='((fp)->_p)'
15300 ptr_lval=$define
15301 ;;
15302 *) ptr_lval=$d_stdio_ptr_lval;;
15303 esac
15304 case "$stdio_cnt" in
15305 '') stdio_cnt='((fp)->_r)'
15306 cnt_lval=$define
15307 ;;
15308 *) cnt_lval=$d_stdio_cnt_lval;;
15309 esac
15310 case "$stdio_base" in
15311 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15312 esac
15313 case "$stdio_bufsiz" in
15314 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15315 esac
15316elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
15317 echo "(Looks like you have stdio.h from Linux.)"
15318 case "$stdio_ptr" in
15319 '') stdio_ptr='((fp)->_IO_read_ptr)'
15320 ptr_lval=$define
15321 ;;
15322 *) ptr_lval=$d_stdio_ptr_lval;;
15323 esac
15324 case "$stdio_cnt" in
15325 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15326 cnt_lval=$undef
15327 ;;
15328 *) cnt_lval=$d_stdio_cnt_lval;;
15329 esac
15330 case "$stdio_base" in
15331 '') stdio_base='((fp)->_IO_read_base)';;
15332 esac
15333 case "$stdio_bufsiz" in
15334 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15335 esac
15336else
15337 case "$stdio_ptr" in
15338 '') stdio_ptr='((fp)->_ptr)'
15339 ptr_lval=$define
15340 ;;
15341 *) ptr_lval=$d_stdio_ptr_lval;;
15342 esac
15343 case "$stdio_cnt" in
15344 '') stdio_cnt='((fp)->_cnt)'
15345 cnt_lval=$define
15346 ;;
15347 *) cnt_lval=$d_stdio_cnt_lval;;
15348 esac
15349 case "$stdio_base" in
15350 '') stdio_base='((fp)->_base)';;
15351 esac
15352 case "$stdio_bufsiz" in
15353 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15354 esac
15355fi
80f36755 15356
b4eb6b3d
JH
15357: test whether _ptr and _cnt really work
15358echo "Checking how std your stdio is..." >&4
15359$cat >try.c <<EOP
15360#include <stdio.h>
15361#define FILE_ptr(fp) $stdio_ptr
15362#define FILE_cnt(fp) $stdio_cnt
15363int main() {
15364 FILE *fp = fopen("try.c", "r");
15365 char c = getc(fp);
15366 if (
15367 18 <= FILE_cnt(fp) &&
15368 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15369 )
15370 exit(0);
15371 exit(1);
15372}
15373EOP
15374val="$undef"
15375set try
5440bc8e
JH
15376if eval $compile && $to try.c; then
15377 if $run ./try; then
b4eb6b3d
JH
15378 echo "Your stdio acts pretty std."
15379 val="$define"
15380 else
15381 echo "Your stdio isn't very std."
15382 fi
15383else
15384 echo "Your stdio doesn't appear very std."
15385fi
15386$rm -f try.c try
15387set d_stdstdio
15388eval $setvar
15389
15390: Can _ptr be used as an lvalue?
15391case "$d_stdstdio$ptr_lval" in
15392$define$define) val=$define ;;
15393*) val=$undef ;;
15394esac
15395set d_stdio_ptr_lval
15396eval $setvar
15397
15398: Can _cnt be used as an lvalue?
15399case "$d_stdstdio$cnt_lval" in
15400$define$define) val=$define ;;
15401*) val=$undef ;;
15402esac
15403set d_stdio_cnt_lval
15404eval $setvar
15405
a7ffa9b9
NC
15406
15407: test whether setting _ptr sets _cnt as a side effect
15408d_stdio_ptr_lval_sets_cnt="$undef"
15409d_stdio_ptr_lval_nochange_cnt="$undef"
15410case "$d_stdio_ptr_lval$d_stdstdio" in
15411$define$define)
15412 echo "Checking to see what happens if we set the stdio ptr..." >&4
15413$cat >try.c <<EOP
15414#include <stdio.h>
15415/* Can we scream? */
15416/* Eat dust sed :-) */
c1d9e6fa 15417/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
15418#define FILE_ptr(fp) $stdio_ptr
15419#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 15420#include <sys/types.h>
a7ffa9b9
NC
15421int main() {
15422 FILE *fp = fopen("try.c", "r");
c1d9e6fa 15423 int c;
a7ffa9b9
NC
15424 char *ptr;
15425 size_t cnt;
c1d9e6fa
JH
15426 if (!fp) {
15427 puts("Fail even to read");
15428 exit(1);
15429 }
15430 c = getc(fp); /* Read away the first # */
15431 if (c == EOF) {
15432 puts("Fail even to read");
15433 exit(1);
15434 }
a7ffa9b9
NC
15435 if (!(
15436 18 <= FILE_cnt(fp) &&
15437 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15438 )) {
15439 puts("Fail even to read");
15440 exit (1);
15441 }
c1d9e6fa
JH
15442 ptr = (char*) FILE_ptr(fp);
15443 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 15444
c1d9e6fa 15445 FILE_ptr(fp) += 42;
a7ffa9b9 15446
c1d9e6fa 15447 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
15448 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15449 exit (1);
15450 }
15451 if (FILE_cnt(fp) <= 20) {
15452 printf ("Fail (<20 chars to test)");
15453 exit (1);
15454 }
15455 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15456 puts("Fail compare");
15457 exit (1);
15458 }
15459 if (cnt == FILE_cnt(fp)) {
15460 puts("Pass_unchanged");
15461 exit (0);
15462 }
15463 if (FILE_cnt(fp) == (cnt - 42)) {
15464 puts("Pass_changed");
15465 exit (0);
15466 }
15467 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15468 return 1;
15469
15470}
15471EOP
15472 set try
5440bc8e
JH
15473 if eval $compile && $to try.c; then
15474 case `$run ./try` in
a7ffa9b9 15475 Pass_changed)
2e32dcfe 15476 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
15477 d_stdio_ptr_lval_sets_cnt="$define" ;;
15478 Pass_unchanged)
15479 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
15480 d_stdio_ptr_lval_nochange_cnt="$define" ;;
15481 Fail*)
15482 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
15483 *)
15484 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15485 esac
15486 else
15487 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
15488 fi
15489 $rm -f try.c try
15490 ;;
15491esac
15492
b4eb6b3d
JH
15493: see if _base is also standard
15494val="$undef"
15495case "$d_stdstdio" in
15496$define)
15497 $cat >try.c <<EOP
15498#include <stdio.h>
15499#define FILE_base(fp) $stdio_base
15500#define FILE_bufsiz(fp) $stdio_bufsiz
15501int main() {
15502 FILE *fp = fopen("try.c", "r");
15503 char c = getc(fp);
15504 if (
15505 19 <= FILE_bufsiz(fp) &&
15506 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15507 )
15508 exit(0);
15509 exit(1);
15510}
15511EOP
15512 set try
5440bc8e
JH
15513 if eval $compile && $to try.c; then
15514 if $run ./try; then
b4eb6b3d
JH
15515 echo "And its _base field acts std."
15516 val="$define"
15517 else
15518 echo "But its _base field isn't std."
15519 fi
15520 else
15521 echo "However, it seems to be lacking the _base field."
15522 fi
15523 $rm -f try.c try
15524 ;;
15525esac
15526set d_stdiobase
15527eval $setvar
15528
15529$cat >&4 <<EOM
15530Checking how to access stdio streams by file descriptor number...
15531EOM
15532case "$stdio_stream_array" in
15533'') $cat >try.c <<EOCP
15534#include <stdio.h>
15535int main() {
15536 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15537 printf("yes\n");
15538}
15539EOCP
15540 for s in _iob __iob __sF
15541 do
15542 set try -DSTDIO_STREAM_ARRAY=$s
15543 if eval $compile; then
5440bc8e 15544 case "`$run ./try`" in
b4eb6b3d
JH
15545 yes) stdio_stream_array=$s; break ;;
15546 esac
15547 fi
15548 done
15549 $rm -f try.* try$exe_ext
15550esac
15551case "$stdio_stream_array" in
15552'') $cat >&4 <<EOM
15553I can't figure out how to access stdio streams by file descriptor number.
15554EOM
15555 d_stdio_stream_array="$undef"
15556 ;;
15557*) $cat >&4 <<EOM
15558You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15559EOM
15560 d_stdio_stream_array="$define"
15561 ;;
15562esac
15563
15564: see if strcoll exists
15565set strcoll d_strcoll
15566eval $inlibc
15567
15568: check for structure copying
15569echo " "
15570echo "Checking to see if your C compiler can copy structs..." >&4
15571$cat >try.c <<'EOCP'
15572int main()
15573{
15574 struct blurfl {
15575 int dyick;
15576 } foo, bar;
15577
15578 foo = bar;
15579}
15580EOCP
15581if $cc -c try.c >/dev/null 2>&1 ; then
15582 val="$define"
15583 echo "Yup, it can."
15584else
15585 val="$undef"
15586 echo "Nope, it can't."
15587fi
15588set d_strctcpy
15589eval $setvar
15590$rm -f try.*
15591
15592: see if strerror and/or sys_errlist[] exist
15593echo " "
15594if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15595 if set strerror val -f d_strerror; eval $csym; $val; then
15596 echo 'strerror() found.' >&4
15597 d_strerror="$define"
15598 d_strerrm='strerror(e)'
15599 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15600 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
15601 d_syserrlst="$define"
15602 else
15603 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15604 d_syserrlst="$undef"
15605 fi
15606 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15607 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15608 echo 'strerror() found in string header.' >&4
15609 d_strerror="$define"
15610 d_strerrm='strerror(e)'
15611 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15612 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15613 d_syserrlst="$define"
15614 else
15615 echo "(You don't appear to have any sys_errlist[], how can this be?)"
15616 d_syserrlst="$undef"
15617 fi
15618 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15619 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15620 d_strerror="$undef"
15621 d_syserrlst="$define"
15622 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15623 else
15624 echo 'strerror() and sys_errlist[] NOT found.' >&4
15625 d_strerror="$undef"
15626 d_syserrlst="$undef"
15627 d_strerrm='"unknown"'
15628 fi
15629fi
15630
10bc17b6
JH
15631: see if strerror_r exists
15632set strerror_r d_strerror_r
15633eval $inlibc
15634case "$d_strerror_r" in
15635"$define")
15636 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
15637 case "$d_strerror_r_proto:$usethreads" in
15638 ":define") d_strerror_r_proto=define
a48ec845
JH
15639 set d_strerror_r_proto strerror_r $hdrs
15640 eval $hasproto ;;
15641 *) ;;
15642 esac
15643 case "$d_strerror_r_proto" in
15644 define)
10bc17b6
JH
15645 case "$strerror_r_proto" in
15646 ''|0) try='int strerror_r(int, char*, size_t);'
15647 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15648 esac
15649 case "$strerror_r_proto" in
15650 ''|0) try='int strerror_r(int, char*, int);'
15651 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15652 esac
15653 case "$strerror_r_proto" in
15654 ''|0) try='char* strerror_r(int, char*, size_t);'
15655 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15656 esac
15657 case "$strerror_r_proto" in
90e831dc 15658 ''|0) d_strerror_r=undef
10bc17b6 15659 strerror_r_proto=0
a48ec845 15660 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15661 * ) case "$strerror_r_proto" in
15662 REENTRANT_PROTO*) ;;
15663 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15664 esac
15665 echo "Prototype: $try" ;;
15666 esac
15667 ;;
c18e646a
JH
15668 *) case "$usethreads" in
15669 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15670 esac
90e831dc
SB
15671 d_strerror_r=undef
15672 strerror_r_proto=0
c18e646a 15673 ;;
a48ec845
JH
15674 esac
15675 ;;
10bc17b6
JH
15676*) strerror_r_proto=0
15677 ;;
15678esac
15679
b3c85772
JH
15680: see if strftime exists
15681set strftime d_strftime
15682eval $inlibc
15683
b4eb6b3d
JH
15684: see if strtod exists
15685set strtod d_strtod
15686eval $inlibc
15687
15688: see if strtol exists
15689set strtol d_strtol
15690eval $inlibc
15691
15692: see if strtold exists
15693set strtold d_strtold
15694eval $inlibc
15695
15696: see if strtoll exists
15697set strtoll d_strtoll
15698eval $inlibc
15699
15700case "$d_longlong-$d_strtoll" in
15701"$define-$define")
15702 $cat <<EOM
15703Checking whether your strtoll() works okay...
15704EOM
15705 $cat >try.c <<'EOCP'
15706#include <errno.h>
15707#ifdef __hpux
15708#define strtoll __strtoll
15709#endif
e75931a7
YST
15710#ifdef __EMX__
15711#define strtoll _strtoll
15712#endif
b4eb6b3d
JH
15713#include <stdio.h>
15714extern long long int strtoll(char *s, char **, int);
15715static int bad = 0;
15716int check(char *s, long long ell, int een) {
15717 long long gll;
15718 errno = 0;
15719 gll = strtoll(s, 0, 10);
15720 if (!((gll == ell) && (errno == een)))
15721 bad++;
15722}
15723int main() {
15724 check(" 1", 1LL, 0);
15725 check(" 0", 0LL, 0);
15726 check("-1", -1LL, 0);
15727 check("-9223372036854775808", -9223372036854775808LL, 0);
15728 check("-9223372036854775808", -9223372036854775808LL, 0);
15729 check(" 9223372036854775807", 9223372036854775807LL, 0);
15730 check("-9223372036854775808", -9223372036854775808LL, 0);
15731 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
15732 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15733 if (!bad)
15734 printf("ok\n");
15735}
15736EOCP
15737 set try
15738 if eval $compile; then
5440bc8e 15739 yyy=`$run ./try`
e75931a7 15740 case "$yyy" in
b4eb6b3d
JH
15741 ok) echo "Your strtoll() seems to be working okay." ;;
15742 *) cat <<EOM >&4
15743Your strtoll() doesn't seem to be working okay.
15744EOM
15745 d_strtoll="$undef"
15746 ;;
69eadf66 15747 esac
e75931a7
YST
15748 else
15749 echo "(I can't seem to compile the test program--assuming it doesn't)"
15750 d_strtoll="$undef"
b4eb6b3d
JH
15751 fi
15752 ;;
15753esac
15754
28e5dec8
JH
15755: see if strtoq exists
15756set strtoq d_strtoq
15757eval $inlibc
15758
b4eb6b3d
JH
15759: see if strtoul exists
15760set strtoul d_strtoul
15761eval $inlibc
15762
d0e6d399
NC
15763case "$d_strtoul" in
15764"$define")
15765 $cat <<EOM
15766Checking whether your strtoul() works okay...
15767EOM
15768 $cat >try.c <<'EOCP'
15769#include <errno.h>
15770#include <stdio.h>
15771extern unsigned long int strtoul(char *s, char **, int);
15772static int bad = 0;
15773void check(char *s, unsigned long eul, int een) {
15774 unsigned long gul;
15775 errno = 0;
15776 gul = strtoul(s, 0, 10);
15777 if (!((gul == eul) && (errno == een)))
15778 bad++;
15779}
15780int main() {
15781 check(" 1", 1L, 0);
15782 check(" 0", 0L, 0);
15783EOCP
15784 case "$longsize" in
15785 8)
15786 $cat >>try.c <<'EOCP'
09c0d2c4
JH
15787 check("18446744073709551615", 18446744073709551615UL, 0);
15788 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 15789#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 15790 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
15791 check("-18446744073709551614", 2, 0);
15792 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
15793 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15794 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 15795#endif
d0e6d399
NC
15796EOCP
15797 ;;
15798 4)
15799 $cat >>try.c <<'EOCP'
15800 check("4294967295", 4294967295UL, 0);
15801 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 15802#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
15803 check("-1", 4294967295UL, 0);
15804 check("-4294967294", 2, 0);
15805 check("-4294967295", 1, 0);
15806 check("-4294967296", 4294967295UL, ERANGE);
15807 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 15808#endif
d0e6d399
NC
15809EOCP
15810 ;;
15811 *)
15812: Should we write these tests to be more portable by sprintf-ing
15813: ~0 and then manipulating that char string as input for strtol?
15814 ;;
15815 esac
15816 $cat >>try.c <<'EOCP'
15817 if (!bad)
15818 printf("ok\n");
15819 return 0;
15820}
15821EOCP
15822 set try
15823 if eval $compile; then
5440bc8e 15824 case "`$run ./try`" in
d0e6d399
NC
15825 ok) echo "Your strtoul() seems to be working okay." ;;
15826 *) cat <<EOM >&4
15827Your strtoul() doesn't seem to be working okay.
15828EOM
15829 d_strtoul="$undef"
15830 ;;
15831 esac
15832 fi
15833 ;;
15834esac
15835
b4eb6b3d
JH
15836: see if strtoull exists
15837set strtoull d_strtoull
15838eval $inlibc
15839
15840case "$d_longlong-$d_strtoull" in
15841"$define-$define")
15842 $cat <<EOM
15843Checking whether your strtoull() works okay...
15844EOM
15845 $cat >try.c <<'EOCP'
15846#include <errno.h>
15847#ifdef __hpux
15848#define strtoull __strtoull
15849#endif
15850#include <stdio.h>
15851extern unsigned long long int strtoull(char *s, char **, int);
15852static int bad = 0;
15853int check(char *s, long long eull, int een) {
15854 long long gull;
15855 errno = 0;
15856 gull = strtoull(s, 0, 10);
15857 if (!((gull == eull) && (errno == een)))
15858 bad++;
15859}
15860int main() {
d0e6d399
NC
15861 check(" 1", 1LL, 0);
15862 check(" 0", 0LL, 0);
15863 check("18446744073709551615", 18446744073709551615ULL, 0);
15864 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 15865#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
15866 check("-1", 18446744073709551615ULL, 0);
15867 check("-18446744073709551614", 2LL, 0);
15868 check("-18446744073709551615", 1LL, 0);
15869 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15870 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 15871#endif
b4eb6b3d
JH
15872 if (!bad)
15873 printf("ok\n");
15874}
15875EOCP
15876 set try
15877 if eval $compile; then
5440bc8e 15878 case "`$run ./try`" in
b4eb6b3d
JH
15879 ok) echo "Your strtoull() seems to be working okay." ;;
15880 *) cat <<EOM >&4
15881Your strtoull() doesn't seem to be working okay.
15882EOM
15883 d_strtoull="$undef"
15884 ;;
15885 esac
15886 fi
15887 ;;
15888esac
15889
15890: see if strtouq exists
15891set strtouq d_strtouq
15892eval $inlibc
15893
d0e6d399
NC
15894case "$d_strtouq" in
15895"$define")
15896 $cat <<EOM
15897Checking whether your strtouq() works okay...
15898EOM
15899 $cat >try.c <<'EOCP'
15900#include <errno.h>
15901#include <stdio.h>
15902extern unsigned long long int strtouq(char *s, char **, int);
15903static int bad = 0;
15904void check(char *s, unsigned long long eull, int een) {
15905 unsigned long long gull;
15906 errno = 0;
15907 gull = strtouq(s, 0, 10);
15908 if (!((gull == eull) && (errno == een)))
15909 bad++;
15910}
15911int main() {
15912 check(" 1", 1LL, 0);
15913 check(" 0", 0LL, 0);
15914 check("18446744073709551615", 18446744073709551615ULL, 0);
15915 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 15916#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
15917 check("-1", 18446744073709551615ULL, 0);
15918 check("-18446744073709551614", 2LL, 0);
15919 check("-18446744073709551615", 1LL, 0);
15920 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15921 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 15922#endif
d0e6d399
NC
15923 if (!bad)
15924 printf("ok\n");
15925 return 0;
15926}
15927EOCP
15928 set try
15929 if eval $compile; then
5440bc8e 15930 case "`$run ./try`" in
d0e6d399
NC
15931 ok) echo "Your strtouq() seems to be working okay." ;;
15932 *) cat <<EOM >&4
15933Your strtouq() doesn't seem to be working okay.
15934EOM
15935 d_strtouq="$undef"
15936 ;;
15937 esac
15938 fi
15939 ;;
15940esac
15941
b4eb6b3d
JH
15942: see if strxfrm exists
15943set strxfrm d_strxfrm
15944eval $inlibc
15945
15946: see if symlink exists
15947set symlink d_symlink
15948eval $inlibc
15949
15950: see if syscall exists
15951set syscall d_syscall
15952eval $inlibc
15953
2ef53570
JH
15954: see if prototype for syscall is available
15955echo " "
15956set d_syscallproto syscall $i_unistd unistd.h
15957eval $hasproto
15958
b4eb6b3d
JH
15959: see if sysconf exists
15960set sysconf d_sysconf
15961eval $inlibc
15962
15963: see if system exists
15964set system d_system
15965eval $inlibc
15966
15967: see if tcgetpgrp exists
15968set tcgetpgrp d_tcgetpgrp
15969eval $inlibc
15970
15971: see if tcsetpgrp exists
15972set tcsetpgrp d_tcsetpgrp
15973eval $inlibc
15974
15975: see if prototype for telldir is available
15976echo " "
15977set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15978eval $hasproto
15979
ad493445
MB
15980: see if time exists
15981echo " "
15982if test "X$d_time" = X -o X"$timetype" = X; then
15983 if set time val -f d_time; eval $csym; $val; then
15984 echo 'time() found.' >&4
15985 val="$define"
15986 rp="What is the type returned by time() on this system?"
15987 set time_t timetype long stdio.h sys/types.h
15988 eval $typedef_ask
15989 else
15990 echo 'time() not found, hope that will do.' >&4
15991 val="$undef"
15992 timetype='int';
15993 fi
15994 set d_time
15995 eval $setvar
15996fi
15997
b4eb6b3d
JH
15998: see if this is a sys/times.h system
15999set sys/times.h i_systimes
16000eval $inhdr
16001
16002: see if times exists
16003echo " "
16004if set times val -f d_times; eval $csym; $val; then
16005 echo 'times() found.' >&4
16006 d_times="$define"
16007 inc=''
16008 case "$i_systimes" in
16009 "$define") inc='sys/times.h';;
16010 esac
16011 rp="What is the type returned by times() on this system?"
16012 set clock_t clocktype long stdio.h sys/types.h $inc
16013 eval $typedef_ask
16014else
16015 echo 'times() NOT found, hope that will do.' >&4
16016 d_times="$undef"
16017 clocktype='int'
16018fi
16019
10bc17b6
JH
16020: see if tmpnam_r exists
16021set tmpnam_r d_tmpnam_r
16022eval $inlibc
16023case "$d_tmpnam_r" in
16024"$define")
31ee0cb7 16025 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
16026 case "$d_tmpnam_r_proto:$usethreads" in
16027 ":define") d_tmpnam_r_proto=define
a48ec845
JH
16028 set d_tmpnam_r_proto tmpnam_r $hdrs
16029 eval $hasproto ;;
16030 *) ;;
16031 esac
16032 case "$d_tmpnam_r_proto" in
16033 define)
10bc17b6
JH
16034 case "$tmpnam_r_proto" in
16035 ''|0) try='char* tmpnam_r(char*);'
16036 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16037 esac
16038 case "$tmpnam_r_proto" in
90e831dc 16039 ''|0) d_tmpnam_r=undef
10bc17b6 16040 tmpnam_r_proto=0
a48ec845 16041 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16042 * ) case "$tmpnam_r_proto" in
16043 REENTRANT_PROTO*) ;;
16044 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16045 esac
16046 echo "Prototype: $try" ;;
16047 esac
16048 ;;
c18e646a
JH
16049 *) case "$usethreads" in
16050 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16051 esac
90e831dc
SB
16052 d_tmpnam_r=undef
16053 tmpnam_r_proto=0
c18e646a 16054 ;;
a48ec845
JH
16055 esac
16056 ;;
10bc17b6
JH
16057*) tmpnam_r_proto=0
16058 ;;
16059esac
16060
b4eb6b3d
JH
16061: see if truncate exists
16062set truncate d_truncate
16063eval $inlibc
16064
10bc17b6
JH
16065: see if ttyname_r exists
16066set ttyname_r d_ttyname_r
16067eval $inlibc
16068case "$d_ttyname_r" in
16069"$define")
16070 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
16071 case "$d_ttyname_r_proto:$usethreads" in
16072 ":define") d_ttyname_r_proto=define
a48ec845
JH
16073 set d_ttyname_r_proto ttyname_r $hdrs
16074 eval $hasproto ;;
16075 *) ;;
16076 esac
16077 case "$d_ttyname_r_proto" in
16078 define)
10bc17b6
JH
16079 case "$ttyname_r_proto" in
16080 ''|0) try='int ttyname_r(int, char*, size_t);'
16081 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16082 esac
16083 case "$ttyname_r_proto" in
16084 ''|0) try='int ttyname_r(int, char*, int);'
16085 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16086 esac
16087 case "$ttyname_r_proto" in
16088 ''|0) try='char* ttyname_r(int, char*, int);'
16089 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16090 esac
16091 case "$ttyname_r_proto" in
90e831dc 16092 ''|0) d_ttyname_r=undef
10bc17b6 16093 ttyname_r_proto=0
a48ec845 16094 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16095 * ) case "$ttyname_r_proto" in
16096 REENTRANT_PROTO*) ;;
16097 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16098 esac
16099 echo "Prototype: $try" ;;
16100 esac
16101 ;;
c18e646a
JH
16102 *) case "$usethreads" in
16103 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16104 esac
90e831dc
SB
16105 d_ttyname_r=undef
16106 ttyname_r_proto=0
c18e646a 16107 ;;
a48ec845
JH
16108 esac
16109 ;;
10bc17b6
JH
16110*) ttyname_r_proto=0
16111 ;;
16112esac
16113
b4eb6b3d
JH
16114: see if tzname[] exists
16115echo " "
16116if set tzname val -a d_tzname; eval $csym; $val; then
16117 val="$define"
16118 echo 'tzname[] found.' >&4
16119else
16120 val="$undef"
16121 echo 'tzname[] NOT found.' >&4
16122fi
16123set d_tzname
16124eval $setvar
16125
4e0554ec
JH
16126case "$osname" in
16127next|rhapsody|darwin) multiarch="$define" ;;
16128esac
16129case "$multiarch" in
16130''|[nN]*) multiarch="$undef" ;;
16131esac
16132
16133: check for ordering of bytes in a long
16134echo " "
5440bc8e 16135case "$usecrosscompile$multiarch" in
4e0554ec
JH
16136*$define*)
16137 $cat <<EOM
16138You seem to be either cross-compiling or doing a multiarchitecture build,
16139skipping the byteorder check.
16140
16141EOM
5440bc8e 16142 byteorder='ffff'
4e0554ec
JH
16143 ;;
16144*)
16145 case "$byteorder" in
16146 '')
16147 $cat <<'EOM'
16148In the following, larger digits indicate more significance. A big-endian
16149machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16150little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16151machines may have weird orders like 3412. A Cray will report 87654321,
16152an Alpha will report 12345678. If the test program works the default is
16153probably right.
16154I'm now running the test program...
16155EOM
16156 $cat >try.c <<'EOCP'
16157#include <stdio.h>
16158int main()
16159{
16160 int i;
16161 union {
16162 unsigned long l;
16163 char c[sizeof(long)];
16164 } u;
16165
16166 if (sizeof(long) > 4)
16167 u.l = (0x08070605L << 32) | 0x04030201L;
16168 else
16169 u.l = 0x04030201L;
16170 for (i = 0; i < sizeof(long); i++)
16171 printf("%c", u.c[i]+'0');
16172 printf("\n");
16173 exit(0);
16174}
16175EOCP
16176 xxx_prompt=y
16177 set try
16178 if eval $compile && ./try > /dev/null; then
5440bc8e 16179 dflt=`$run ./try`
4e0554ec
JH
16180 case "$dflt" in
16181 [1-4][1-4][1-4][1-4]|12345678|87654321)
16182 echo "(The test program ran ok.)"
16183 echo "byteorder=$dflt"
16184 xxx_prompt=n
16185 ;;
16186 ????|????????) echo "(The test program ran ok.)" ;;
16187 *) echo "(The test program didn't run right for some reason.)" ;;
16188 esac
16189 else
16190 dflt='4321'
16191 cat <<'EOM'
16192(I can't seem to compile the test program. Guessing big-endian...)
16193EOM
16194 fi
16195 case "$xxx_prompt" in
16196 y)
16197 rp="What is the order of bytes in a long?"
16198 . ./myread
16199 byteorder="$ans"
16200 ;;
16201 *) byteorder=$dflt
16202 ;;
16203 esac
16204 ;;
16205 esac
16206 $rm -f try.c try
16207 ;;
16208esac
16209
16210
16211$cat <<EOM
16212
16213Checking to see whether you can access character data unalignedly...
16214EOM
dc7b0a4f
JH
16215case "$d_u32align" in
16216'') $cat >try.c <<EOCP
4e0554ec
JH
16217#include <stdio.h>
16218#define U32 $u32type
d308175a
JH
16219#define BYTEORDER 0x$byteorder
16220#define U8 $u8type
9958dc3c
JH
16221#include <signal.h>
16222#ifdef SIGBUS
16223$signal_t bletch(s) int s; { exit(4); }
16224#endif
4e0554ec
JH
16225int main() {
16226#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 16227 U8 buf[8];
4e0554ec
JH
16228 U32 *up;
16229 int i;
16230
16231 if (sizeof(U32) != 4) {
16232 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16233 exit(1);
16234 }
16235
16236 fflush(stdout);
16237
9958dc3c
JH
16238#ifdef SIGBUS
16239 signal(SIGBUS, bletch);
16240#endif
16241
8906a23e
JH
16242 buf[0] = 0;
16243 buf[1] = 0;
16244 buf[2] = 0;
16245 buf[3] = 1;
16246 buf[5] = 0;
16247 buf[6] = 0;
16248 buf[7] = 0;
16249 buf[8] = 1;
16250
4e0554ec
JH
16251 for (i = 0; i < 4; i++) {
16252 up = (U32*)(buf + i);
16253 if (! ((*up == 1 << (8*i)) || /* big-endian */
16254 (*up == 1 << (8*(3-i))) /* little-endian */
16255 )
16256 )
16257 {
16258 printf("read failed (%x)\n", *up);
16259 exit(2);
16260 }
16261 }
16262
16263 /* write test */
16264 for (i = 0; i < 4; i++) {
16265 up = (U32*)(buf + i);
16266 *up = 0xBeef;
16267 if (*up != 0xBeef) {
16268 printf("write failed (%x)\n", *up);
16269 exit(3);
16270 }
16271 }
16272
16273 exit(0);
16274#else
16275 printf("1\n");
16276 exit(1);
16277#endif
16278 return 0;
16279}
16280EOCP
16281set try
16282if eval $compile_ok; then
d308175a 16283 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 16284 $run ./try 2>&1 >/dev/null
4e0554ec
JH
16285 case "$?" in
16286 0) cat >&4 <<EOM
16287You can access character data pretty unalignedly.
16288EOM
16289 d_u32align="$undef"
16290 ;;
16291 *) cat >&4 <<EOM
16292It seems that you must access character data in an aligned manner.
16293EOM
16294 d_u32align="$define"
16295 ;;
16296 esac
4e0554ec
JH
16297else
16298 rp='Can you access character data at unaligned addresses?'
16299 dflt='n'
16300 . ./myread
16301 case "$ans" in
16302 [yY]*) d_u32align="$undef" ;;
16303 *) d_u32align="$define" ;;
16304 esac
16305fi
e36b5403 16306$rm -f core core.try.* try.core
dc7b0a4f
JH
16307;;
16308esac
4e0554ec
JH
16309
16310: see if ualarm exists
16311set ualarm d_ualarm
16312eval $inlibc
16313
b4eb6b3d
JH
16314: see if umask exists
16315set umask d_umask
16316eval $inlibc
16317
758a5d79
JH
16318: see if unordered exists
16319set unordered d_unordered
16320eval $inlibc
16321
4e0554ec
JH
16322: see if usleep exists
16323set usleep d_usleep
16324eval $inlibc
16325
2ef53570
JH
16326: see if prototype for usleep is available
16327echo " "
16328set d_usleepproto usleep $i_unistd unistd.h
16329eval $hasproto
16330
b4eb6b3d
JH
16331: see if ustat exists
16332set ustat d_ustat
16333eval $inlibc
16334
16335: backward compatibility for d_hvfork
16336if test X$d_hvfork != X; then
16337 d_vfork="$d_hvfork"
16338 d_hvfork=''
16339fi
16340: see if there is a vfork
16341val=''
16342set vfork val
16343eval $inlibc
16344
16345: Ok, but do we want to use it. vfork is reportedly unreliable in
16346: perl on Solaris 2.x, and probably elsewhere.
16347case "$val" in
16348$define)
16349 echo " "
16350 case "$usevfork" in
16351 false) dflt='n';;
16352 *) dflt='y';;
16353 esac
16354 cat <<'EOM'
16355
16356Perl can only use a vfork() that doesn't suffer from strict
16357restrictions on calling functions or modifying global data in
16358the child. For example, glibc-2.1 contains such a vfork()
16359that is unsuitable. If your system provides a proper fork()
16360call, chances are that you do NOT want perl to use vfork().
16361
16362EOM
16363 rp="Do you still want to use vfork()?"
16364 . ./myread
16365 case "$ans" in
16366 y|Y) ;;
16367 *)
16368 echo "Ok, we won't use vfork()."
16369 val="$undef"
16370 ;;
16371 esac
16372 ;;
16373esac
16374set d_vfork
16375eval $setvar
16376case "$d_vfork" in
16377$define) usevfork='true';;
16378*) usevfork='false';;
16379esac
16380
b4eb6b3d
JH
16381: see if closedir exists
16382set closedir d_closedir
16383eval $inlibc
16384
16385case "$d_closedir" in
16386"$define")
16387 echo " "
16388 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 16389 cat > try.c <<EOM
b4eb6b3d
JH
16390#$i_dirent I_DIRENT /**/
16391#$i_sysdir I_SYS_DIR /**/
16392#$i_sysndir I_SYS_NDIR /**/
16393#$i_systypes I_SYS_TYPES /**/
16394
16395#if defined(I_SYS_TYPES)
16396#include <sys/types.h>
16397#endif
16398#if defined(I_DIRENT)
16399#include <dirent.h>
16400#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16401#include <sys/dir.h>
16402#endif
16403#else
16404#ifdef I_SYS_NDIR
16405#include <sys/ndir.h>
16406#else
16407#ifdef I_SYS_DIR
16408#ifdef hp9000s500
16409#include <ndir.h> /* may be wrong in the future */
16410#else
16411#include <sys/dir.h>
16412#endif
16413#endif
16414#endif
16415#endif
16416int main() { return closedir(opendir(".")); }
16417EOM
5440bc8e 16418 set try
b4eb6b3d 16419 if eval $compile_ok; then
5440bc8e 16420 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
16421 echo "Yes, it does."
16422 val="$undef"
16423 else
16424 echo "No, it doesn't."
16425 val="$define"
16426 fi
16427 else
16428 echo "(I can't seem to compile the test program--assuming it doesn't)"
16429 val="$define"
16430 fi
16431 ;;
16432*)
16433 val="$undef";
16434 ;;
16435esac
16436set d_void_closedir
16437eval $setvar
5440bc8e 16438$rm -f try try.*
b4eb6b3d
JH
16439: see if there is a wait4
16440set wait4 d_wait4
16441eval $inlibc
16442
16443: see if waitpid exists
16444set waitpid d_waitpid
16445eval $inlibc
16446
16447: see if wcstombs exists
16448set wcstombs d_wcstombs
16449eval $inlibc
16450
16451: see if wctomb exists
16452set wctomb d_wctomb
16453eval $inlibc
16454
4e0554ec
JH
16455: see if writev exists
16456set writev d_writev
16457eval $inlibc
16458
b4eb6b3d
JH
16459: preserve RCS keywords in files with variable substitution, grrr
16460Date='$Date'
16461Id='$Id'
16462Log='$Log'
16463RCSfile='$RCSfile'
16464Revision='$Revision'
16465
b4eb6b3d
JH
16466: check for alignment requirements
16467echo " "
5440bc8e 16468case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
16469*$define*)
16470 $cat <<EOM
16471You seem to be either cross-compiling or doing a multiarchitecture build,
16472skipping the memory alignment check.
16473
16474EOM
16475 case "$alignbytes" in
16476 '') alignbytes=8 ;;
16477 esac
16478 ;;
16479*)
16480 case "$alignbytes" in
16481 '') echo "Checking alignment constraints..." >&4
16482 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16483 $cat >try.c <<'EOCP'
16484typedef long double NV;
16485EOCP
16486 else
16487 $cat >try.c <<'EOCP'
16488typedef double NV;
16489EOCP
16490 fi
16491 $cat >>try.c <<'EOCP'
16492#include <stdio.h>
16493struct foobar {
16494 char foo;
16495 NV bar;
16496} try_algn;
16497int main()
16498{
16499 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16500 return(0);
16501}
16502EOCP
16503 set try
16504 if eval $compile_ok; then
5440bc8e 16505 dflt=`$run ./try`
b4eb6b3d
JH
16506 else
16507 dflt='8'
16508 echo "(I can't seem to compile the test program...)"
16509 fi
16510 ;;
16511 *) dflt="$alignbytes"
16512 ;;
16513 esac
16514 rp="Doubles must be aligned on a how-many-byte boundary?"
16515 . ./myread
16516 alignbytes="$ans"
16517 $rm -f try.c try
16518 ;;
16519esac
16520
16521
16522: set the base revision
16523baserev=5.0
16524
b4eb6b3d
JH
16525: how do we catenate cpp tokens here?
16526echo " "
16527echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16528$cat >cpp_stuff.c <<'EOCP'
16529#define RCAT(a,b)a/**/b
16530#define ACAT(a,b)a ## b
16531RCAT(Rei,ser)
16532ACAT(Cir,cus)
16533EOCP
16534$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16535if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16536 echo "Oh! Smells like ANSI's been here." >&4
16537 echo "We can catify or stringify, separately or together!"
16538 cpp_stuff=42
16539elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16540 echo "Ah, yes! The good old days!" >&4
16541 echo "However, in the good old days we don't know how to stringify and"
16542 echo "catify at the same time."
16543 cpp_stuff=1
16544else
16545 $cat >&4 <<EOM
16546Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
16547to have to edit the values of CAT[2-5] in config.h...
16548EOM
16549 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16550fi
16551$rm -f cpp_stuff.*
16552
16553: see if this is a db.h system
16554set db.h i_db
16555eval $inhdr
16556
16557case "$i_db" in
16558$define)
16559 : Check db version.
16560 echo " "
16561 echo "Checking Berkeley DB version ..." >&4
16562 $cat >try.c <<EOCP
16563#$d_const HASCONST
16564#ifndef HASCONST
16565#define const
16566#endif
16567#include <sys/types.h>
16568#include <stdio.h>
16569#include <db.h>
640374d0 16570int main(int argc, char *argv[])
b4eb6b3d
JH
16571{
16572#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16573 int Major, Minor, Patch ;
16574 unsigned long Version ;
16575 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
16576 if (argc == 2) {
16577 printf("%d %d %d %d %d %d\n",
16578 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16579 Major, Minor, Patch);
16580 exit(0);
16581 }
16582 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
16583
16584 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16585 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16586 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16587 Major, Minor, Patch) ;
16588
16589 /* check that db.h & libdb are compatible */
16590 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 16591 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
16592 exit(3);
16593 }
16594
640374d0 16595 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
16596
16597 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16598 + DB_VERSION_PATCH ;
16599
16600 /* needs to be >= 2.3.4 */
16601 if (Version < 2003004) {
16602 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 16603 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
16604 exit(2);
16605 }
16606
16607 exit(0);
16608#else
16609#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
16610 if (argc == 2) {
16611 printf("1 0 0\n");
16612 exit(0);
16613 }
16614 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
16615 exit(0); /* DB version < 2: the coast is clear. */
16616#else
16617 exit(1); /* <db.h> not Berkeley DB? */
16618#endif
16619#endif
16620}
16621EOCP
16622 set try
5440bc8e 16623 if eval $compile_ok && $run ./try; then
b4eb6b3d 16624 echo 'Looks OK.' >&4
5440bc8e 16625 set `$run ./try 1`
640374d0
JH
16626 db_version_major=$1
16627 db_version_minor=$2
16628 db_version_patch=$3
b4eb6b3d
JH
16629 else
16630 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
16631 i_db=$undef
16632 case " $libs " in
16633 *"-ldb "*)
16634 : Remove db from list of libraries to use
16635 echo "Removing unusable -ldb from library list" >&4
16636 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16637 shift
16638 libs="$*"
16639 echo "libs = $libs" >&4
16640 ;;
16641 esac
16642 fi
16643 $rm -f try.*
16644 ;;
16645esac
16646
16647case "$i_db" in
16648define)
16649 : Check the return type needed for hash
16650 echo " "
16651 echo "Checking return type needed for hash for Berkeley DB ..." >&4
16652 $cat >try.c <<EOCP
16653#$d_const HASCONST
16654#ifndef HASCONST
16655#define const
16656#endif
16657#include <sys/types.h>
16658#include <db.h>
16659
16660#ifndef DB_VERSION_MAJOR
16661u_int32_t hash_cb (ptr, size)
16662const void *ptr;
16663size_t size;
16664{
16665}
16666HASHINFO info;
16667int main()
16668{
16669 info.hash = hash_cb;
16670}
16671#endif
16672EOCP
16673 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16674 if $contains warning try.out >>/dev/null 2>&1 ; then
16675 db_hashtype='int'
16676 else
16677 db_hashtype='u_int32_t'
16678 fi
16679 else
16680 : XXX Maybe we should just give up here.
16681 db_hashtype=u_int32_t
16682 $cat try.out >&4
16683 echo "Help: I can't seem to compile the db test program." >&4
16684 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16685 fi
16686 $rm -f try.*
16687 echo "Your version of Berkeley DB uses $db_hashtype for hash."
16688 ;;
16689*) db_hashtype=u_int32_t
16690 ;;
16691esac
16692case "$i_db" in
16693define)
16694 : Check the return type needed for prefix
16695 echo " "
16696 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16697 cat >try.c <<EOCP
16698#$d_const HASCONST
16699#ifndef HASCONST
16700#define const
16701#endif
16702#include <sys/types.h>
16703#include <db.h>
16704
16705#ifndef DB_VERSION_MAJOR
16706size_t prefix_cb (key1, key2)
16707const DBT *key1;
16708const DBT *key2;
16709{
16710}
16711BTREEINFO info;
16712int main()
16713{
16714 info.prefix = prefix_cb;
16715}
16716#endif
16717EOCP
16718 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16719 if $contains warning try.out >>/dev/null 2>&1 ; then
16720 db_prefixtype='int'
16721 else
16722 db_prefixtype='size_t'
16723 fi
16724 else
16725 db_prefixtype='size_t'
16726 : XXX Maybe we should just give up here.
16727 $cat try.out >&4
16728 echo "Help: I can't seem to compile the db test program." >&4
16729 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16730 fi
16731 $rm -f try.*
16732 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16733 ;;
16734*) db_prefixtype='size_t'
16735 ;;
16736esac
16737
b4eb6b3d
JH
16738
16739: How can we generate normalized random numbers ?
16740echo " "
16741echo "Looking for a random number function..." >&4
16742case "$randfunc" in
16743'')
16744 if set drand48 val -f; eval $csym; $val; then
16745 dflt="drand48"
16746 echo "Good, found drand48()." >&4
16747 elif set random val -f; eval $csym; $val; then
16748 dflt="random"
16749 echo "OK, found random()." >&4
16750 else
16751 dflt="rand"
16752 echo "Yick, looks like I have to use rand()." >&4
16753 fi
16754 echo " "
16755 ;;
16756*)
16757 dflt="$randfunc"
16758 ;;
16759esac
16760cont=true
16761
16762case "$ccflags" in
16763*-Dmy_rand=*|*-Dmy_srand=*)
16764 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16765 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16766 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16767 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16768 ;;
16769esac
16770
16771while $test "$cont"; do
16772 rp="Use which function to generate random numbers?"
16773 . ./myread
16774 if $test "$ans" = "$dflt"; then
16775 : null
16776 else
16777 randbits=''
16778 fi
16779 randfunc="$ans"
16780 if set $ans val -f; eval $csym; $val; then
16781 cont=''
16782 else
16783 dflt=y
16784 rp="I cannot find function $ans. Use that name anyway?"
16785 . ./myread
16786 dflt=rand
16787 case "$ans" in
16788 [yY]*) cont='';;
16789 esac
16790 fi
16791 case "$cont" in
16792 '')
16793 case "$randfunc" in
16794 drand48)
16795 drand01="drand48()"
16796 seedfunc="srand48"
16797 randbits=48
16798 randseedtype=long
16799 ;;
16800 rand|random)
16801 case "$randbits" in
16802 '')
16803echo "Checking to see how many bits your $randfunc() function produces..." >&4
16804 $cat >try.c <<EOCP
16805#$i_unistd I_UNISTD
16806#$i_stdlib I_STDLIB
16807#include <stdio.h>
16808#ifdef I_UNISTD
16809# include <unistd.h>
16810#endif
16811#ifdef I_STDLIB
16812# include <stdlib.h>
16813#endif
16814int main()
16815{
16816 register int i;
16817 register unsigned long tmp;
16818 register unsigned long max = 0L;
16819
16820 for (i = 1000; i; i--) {
16821 tmp = (unsigned long) $randfunc();
16822 if (tmp > max) max = tmp;
16823 }
16824 for (i = 0; max; i++)
16825 max /= 2;
16826 printf("%d\n",i);
16827}
16828EOCP
16829 set try
16830 if eval $compile_ok; then
16831 dflt=`try`
16832 else
16833 dflt='?'
16834 echo "(I can't seem to compile the test program...)"
16835 fi
16836 ;;
16837 *)
16838 dflt="$randbits"
16839 ;;
16840 esac
16841 rp="How many bits does your $randfunc() function produce?"
16842 . ./myread
16843 randbits="$ans"
16844 $rm -f try.c try
16845 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16846 seedfunc="s$randfunc"
16847 randseedtype=unsigned
16848 ;;
16849 *)
16850 dflt="31"
16851 rp="How many bits does your $randfunc() function produce?"
16852 . ./myread
16853 randbits="$ans"
16854 seedfunc="s$randfunc"
16855 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16856 if set $seedfunc val -f; eval $csym; $val; then
16857 echo "(Using $seedfunc() to seed random generator)"
16858 else
16859 echo "(Warning: no $seedfunc() to seed random generator)"
16860 seedfunc=rand
16861 fi
16862 randseedtype=unsigned
16863 ;;
16864 esac
16865 ;;
16866 esac
16867done
16868
16869echo " "
16870echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 16871$cat >try.c <<'EOM'
b4eb6b3d
JH
16872int main()
16873{
16874 if ('M'==0xd4) return 0;
16875 return 1;
16876}
16877EOM
16878
16879val=$undef
5440bc8e 16880set try
b4eb6b3d 16881if eval $compile_ok; then
5440bc8e 16882 if $run ./try; then
b4eb6b3d
JH
16883 echo "You seem to speak EBCDIC." >&4
16884 val="$define"
16885 else
5440bc8e 16886 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
16887 fi
16888else
16889 echo "I'm unable to compile the test program." >&4
16890 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16891fi
5440bc8e 16892$rm -f try try.*
b4eb6b3d
JH
16893set ebcdic
16894eval $setvar
16895
16896echo " "
16897$cat >&4 <<EOM
16898Checking how to flush all pending stdio output...
16899EOM
16900# I only know how to find the first 32 possibly open files on SunOS.
16901# See also hints/sunos_4_1.sh and util.c --AD
16902case "$osname" in
16903sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16904esac
16905$cat >>try.c <<EOCP
16906#include <stdio.h>
16907#$i_unistd I_UNISTD
16908#ifdef I_UNISTD
16909# include <unistd.h>
16910#endif
16911#$d_sysconf HAS_SYSCONF
16912#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16913#ifdef HAS_STDIO_STREAM_ARRAY
16914# define STDIO_STREAM_ARRAY $stdio_stream_array
16915#endif
16916int main() {
5440bc8e
JH
16917 FILE* p;
16918 unlink("try.out");
16919 p = fopen("try.out", "w");
b4eb6b3d
JH
16920#ifdef TRY_FPUTC
16921 fputc('x', p);
16922#else
16923# ifdef TRY_FPRINTF
16924 fprintf(p, "x");
16925# endif
16926#endif
16927#ifdef TRY_FFLUSH_NULL
16928 fflush(NULL);
16929#endif
16930#ifdef TRY_FFLUSH_ALL
16931 {
16932 long open_max = -1;
16933# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16934 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16935# else
16936# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16937 open_max = sysconf(_SC_OPEN_MAX);
16938# else
16939# ifdef FOPEN_MAX
16940 open_max = FOPEN_MAX;
16941# else
16942# ifdef OPEN_MAX
16943 open_max = OPEN_MAX;
16944# else
16945# ifdef _NFILE
16946 open_max = _NFILE;
16947# endif
16948# endif
16949# endif
16950# endif
16951# endif
16952# ifdef HAS_STDIO_STREAM_ARRAY
16953 if (open_max > 0) {
16954 long i;
16955 for (i = 0; i < open_max; i++)
16956 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16957 STDIO_STREAM_ARRAY[i]._file < open_max &&
16958 STDIO_STREAM_ARRAY[i]._flag)
16959 fflush(&STDIO_STREAM_ARRAY[i]);
16960 }
16961 }
16962# endif
16963#endif
16964 _exit(42);
16965}
16966EOCP
16967: first we have to find out how _not_ to flush
5440bc8e 16968$to try.c
b4eb6b3d
JH
16969if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16970 output=''
16971 set try -DTRY_FPUTC
16972 if eval $compile; then
fbe73d74 16973 $run ./try 2>/dev/null
28f5ac64 16974 code="$?"
5440bc8e 16975 $from try.out
28f5ac64 16976 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
16977 output=-DTRY_FPUTC
16978 fi
16979 fi
16980 case "$output" in
16981 '')
16982 set try -DTRY_FPRINTF
b4eb6b3d 16983 if eval $compile; then
fbe73d74 16984 $run ./try 2>/dev/null
28f5ac64 16985 code="$?"
5440bc8e 16986 $from try.out
28f5ac64 16987 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
16988 output=-DTRY_FPRINTF
16989 fi
16990 fi
16991 ;;
16992 esac
16993fi
16994: check for fflush NULL behaviour
16995case "$fflushNULL" in
16996'') set try -DTRY_FFLUSH_NULL $output
16997 if eval $compile; then
5440bc8e 16998 $run ./try 2>/dev/null
b4eb6b3d 16999 code="$?"
5440bc8e 17000 $from try.out
b4eb6b3d
JH
17001 if $test -s try.out -a "X$code" = X42; then
17002 fflushNULL="`$cat try.out`"
17003 else
17004 if $test "X$code" != X42; then
17005 $cat >&4 <<EOM
17006(If this test failed, don't worry, we'll try another method shortly.)
17007EOM
17008 fi
17009 fi
17010 fi
17011 $rm -f core try.core core.try.*
17012 case "$fflushNULL" in
17013 x) $cat >&4 <<EOM
17014Your fflush(NULL) works okay for output streams.
17015Let's see if it clobbers input pipes...
17016EOM
17017# As of mid-March 2000 all versions of Solaris appear to have a stdio
17018# bug that improperly flushes the input end of pipes. So we avoid the
17019# autoflush on fork/system/exec support for now. :-(
17020$cat >tryp.c <<EOCP
17021#include <stdio.h>
17022int
17023main(int argc, char **argv)
17024{
17025 char buf[1024];
17026 int i;
17027 char *bp = buf;
17028 while (1) {
17029 while ((i = getc(stdin)) != -1
17030 && (*bp++ = i) != '\n'
17031 && bp < &buf[1024])
17032 /* DO NOTHING */ ;
17033 *bp = '\0';
17034 fprintf(stdout, "%s", buf);
17035 fflush(NULL);
17036 if (i == -1)
17037 return 0;
17038 bp = buf;
17039 }
17040}
17041EOCP
17042 fflushNULL="$define"
17043 set tryp
17044 if eval $compile; then
17045 $rm -f tryp.out
5440bc8e 17046 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17047 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17048 $cat >&4 <<EOM
17049fflush(NULL) seems to behave okay with input streams.
17050EOM
17051 fflushNULL="$define"
17052 else
17053 $cat >&4 <<EOM
17054Ouch, fflush(NULL) clobbers input pipes! We will not use it.
17055EOM
17056 fflushNULL="$undef"
17057 fi
17058 fi
17059 $rm -f core tryp.c tryp.core core.tryp.*
17060 ;;
17061 '') $cat >&4 <<EOM
17062Your fflush(NULL) isn't working (contrary to ANSI C).
17063EOM
17064 fflushNULL="$undef"
17065 ;;
17066 *) $cat >&4 <<EOM
17067Cannot figure out whether your fflush(NULL) works or not.
17068I'm assuming it doesn't (contrary to ANSI C).
17069EOM
17070 fflushNULL="$undef"
17071 ;;
17072 esac
17073 ;;
17074$define|true|[yY]*)
17075 fflushNULL="$define"
17076 ;;
17077*)
17078 fflushNULL="$undef"
17079 ;;
17080esac
17081: check explicit looping only if NULL did not work, and if the pipe
17082: bug does not show up on an explicit flush too
17083case "$fflushNULL" in
17084"$undef")
17085 $cat >tryp.c <<EOCP
17086#include <stdio.h>
17087int
17088main(int argc, char **argv)
17089{
17090 char buf[1024];
17091 int i;
17092 char *bp = buf;
17093 while (1) {
17094 while ((i = getc(stdin)) != -1
17095 && (*bp++ = i) != '\n'
17096 && bp < &buf[1024])
17097 /* DO NOTHING */ ;
17098 *bp = '\0';
17099 fprintf(stdout, "%s", buf);
17100 fflush(stdin);
17101 if (i == -1)
17102 return 0;
17103 bp = buf;
17104 }
17105}
17106EOCP
17107 set tryp
17108 if eval $compile; then
17109 $rm -f tryp.out
5440bc8e 17110 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17111 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17112 $cat >&4 <<EOM
17113Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17114EOM
17115 : now check for fflushall behaviour
17116 case "$fflushall" in
17117 '') set try -DTRY_FFLUSH_ALL $output
17118 if eval $compile; then
17119 $cat >&4 <<EOM
17120(Now testing the other method--but note that this also may fail.)
17121EOM
5440bc8e 17122 $run ./try 2>/dev/null
28f5ac64 17123 code=$?
fbe73d74 17124 $from try.out
28f5ac64 17125 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17126 fflushall="`$cat try.out`"
17127 fi
17128 fi
17129 $rm -f core try.core core.try.*
17130 case "$fflushall" in
17131 x) $cat >&4 <<EOM
17132Whew. Flushing explicitly all the stdio streams works.
17133EOM
17134 fflushall="$define"
17135 ;;
17136 '') $cat >&4 <<EOM
17137Sigh. Flushing explicitly all the stdio streams doesn't work.
17138EOM
17139 fflushall="$undef"
17140 ;;
17141 *) $cat >&4 <<EOM
17142Cannot figure out whether flushing stdio streams explicitly works or not.
17143I'm assuming it doesn't.
17144EOM
17145 fflushall="$undef"
17146 ;;
17147 esac
17148 ;;
17149 "$define"|true|[yY]*)
17150 fflushall="$define"
17151 ;;
17152 *)
17153 fflushall="$undef"
17154 ;;
17155 esac
17156 else
17157 $cat >&4 <<EOM
17158All is futile. Even fflush(stdin) clobbers input pipes!
17159EOM
17160 fflushall="$undef"
17161 fi
17162 else
17163 fflushall="$undef"
17164 fi
17165 $rm -f core tryp.c tryp.core core.tryp.*
17166 ;;
17167*) fflushall="$undef"
17168 ;;
17169esac
17170
17171case "$fflushNULL$fflushall" in
17172undefundef)
17173 $cat <<EOM
17174OK, I give up. I cannot figure out how to flush pending stdio output.
17175We won't be flushing handles at all before fork/exec/popen.
17176EOM
17177 ;;
17178esac
17179$rm -f try.* try$exe_ext
17180
17181: Store the full pathname to the ar program for use in the C program
17182: Respect a hint or command line value for full_ar.
17183case "$full_ar" in
17184'') full_ar=$ar ;;
17185esac
17186
17187: Store the full pathname to the sed program for use in the C program
17188full_sed=$sed
17189
17190: see what type gids are declared as in the kernel
17191echo " "
17192echo "Looking for the type for group ids returned by getgid()."
17193set gid_t gidtype xxx stdio.h sys/types.h
17194eval $typedef
17195case "$gidtype" in
17196xxx)
17197 xxx=`./findhdr sys/user.h`
17198 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17199 case $1 in
17200 unsigned) dflt="$1 $2" ;;
17201 *) dflt="$1" ;;
17202 esac
17203 ;;
17204*) dflt="$gidtype";;
17205esac
17206case "$gidtype" in
17207gid_t) echo "gid_t found." ;;
17208*) rp="What is the type for group ids returned by getgid()?"
17209 . ./myread
17210 gidtype="$ans"
17211 ;;
17212esac
17213
17214echo " "
17215case "$gidtype" in
17216*_t) zzz="$gidtype" ;;
17217*) zzz="gid" ;;
17218esac
17219echo "Checking the size of $zzz..." >&4
17220cat > try.c <<EOCP
17221#include <sys/types.h>
17222#include <stdio.h>
17223int main() {
17224 printf("%d\n", (int)sizeof($gidtype));
17225 exit(0);
17226}
17227EOCP
17228set try
17229if eval $compile_ok; then
5440bc8e 17230 yyy=`$run ./try`
b4eb6b3d
JH
17231 case "$yyy" in
17232 '') gidsize=4
17233 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17234 ;;
17235 *) gidsize=$yyy
17236 echo "Your $zzz is $gidsize bytes long."
17237 ;;
17238 esac
17239else
17240 gidsize=4
17241 echo "(I can't compile the test program--guessing $gidsize.)" >&4
17242fi
17243
17244
17245echo " "
17246case "$gidtype" in
17247*_t) zzz="$gidtype" ;;
17248*) zzz="gid" ;;
17249esac
17250echo "Checking the sign of $zzz..." >&4
17251cat > try.c <<EOCP
17252#include <sys/types.h>
17253#include <stdio.h>
17254int main() {
17255 $gidtype foo = -1;
17256 if (foo < 0)
17257 printf("-1\n");
17258 else
17259 printf("1\n");
17260}
17261EOCP
17262set try
17263if eval $compile; then
5440bc8e 17264 yyy=`$run ./try`
b4eb6b3d
JH
17265 case "$yyy" in
17266 '') gidsign=1
17267 echo "(I can't execute the test program--guessing unsigned.)" >&4
17268 ;;
17269 *) gidsign=$yyy
17270 case "$gidsign" in
17271 1) echo "Your $zzz is unsigned." ;;
17272 -1) echo "Your $zzz is signed." ;;
17273 esac
17274 ;;
17275 esac
17276else
17277 gidsign=1
17278 echo "(I can't compile the test program--guessing unsigned.)" >&4
17279fi
17280
17281
17282echo " "
17283
17284if $test X"$quadtype" != X; then
17285
17286echo "Checking how to print 64-bit integers..." >&4
17287
17288if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17289 $cat >try.c <<'EOCP'
17290#include <sys/types.h>
17291#include <stdio.h>
17292int main() {
17293 int q = 12345678901;
17294 printf("%ld\n", q);
17295}
17296EOCP
17297 set try
17298 if eval $compile; then
5440bc8e 17299 yyy=`$run ./try`
b4eb6b3d
JH
17300 case "$yyy" in
17301 12345678901)
17302 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17303 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17304 echo "We will use %d."
17305 ;;
17306 esac
17307 fi
17308fi
17309
17310if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17311 $cat >try.c <<'EOCP'
17312#include <sys/types.h>
17313#include <stdio.h>
17314int main() {
17315 long q = 12345678901;
17316 printf("%ld\n", q);
17317}
17318EOCP
17319 set try
17320 if eval $compile; then
5440bc8e 17321 yyy=`$run ./try`
b4eb6b3d
JH
17322 case "$yyy" in
17323 12345678901)
17324 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17325 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17326 echo "We will use %ld."
17327 ;;
17328 esac
17329 fi
17330fi
17331
17332if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17333 $cat >try.c <<'EOCP'
17334#include <sys/types.h>
17335#include <inttypes.h>
17336#include <stdio.h>
17337int main() {
17338 int64_t q = 12345678901;
17339 printf("%" PRId64 "\n", q);
17340}
17341EOCP
17342 set try
17343 if eval $compile; then
5440bc8e 17344 yyy=`$run ./try`
b4eb6b3d
JH
17345 case "$yyy" in
17346 12345678901)
17347 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17348 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17349 echo "We will use the C9X style."
17350 ;;
17351 esac
17352 fi
17353fi
17354
2ef53570
JH
17355if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17356 $cat >try.c <<EOCP
b4eb6b3d
JH
17357#include <sys/types.h>
17358#include <stdio.h>
17359int main() {
2ef53570
JH
17360 $quadtype q = 12345678901;
17361 printf("%Ld\n", q);
b4eb6b3d
JH
17362}
17363EOCP
17364 set try
17365 if eval $compile; then
5440bc8e 17366 yyy=`$run ./try`
b4eb6b3d
JH
17367 case "$yyy" in
17368 12345678901)
2ef53570
JH
17369 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17370 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17371 echo "We will use %Ld."
b4eb6b3d
JH
17372 ;;
17373 esac
17374 fi
17375fi
17376
2ef53570
JH
17377if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17378 $cat >try.c <<'EOCP'
b4eb6b3d
JH
17379#include <sys/types.h>
17380#include <stdio.h>
17381int main() {
2ef53570
JH
17382 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17383 printf("%lld\n", q);
b4eb6b3d
JH
17384}
17385EOCP
17386 set try
17387 if eval $compile; then
5440bc8e 17388 yyy=`$run ./try`
b4eb6b3d
JH
17389 case "$yyy" in
17390 12345678901)
2ef53570
JH
17391 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17392 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17393 echo "We will use the %lld style."
b4eb6b3d
JH
17394 ;;
17395 esac
17396 fi
17397fi
17398
17399if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17400 $cat >try.c <<EOCP
17401#include <sys/types.h>
17402#include <stdio.h>
17403int main() {
17404 $quadtype q = 12345678901;
17405 printf("%qd\n", q);
17406}
17407EOCP
17408 set try
17409 if eval $compile; then
5440bc8e 17410 yyy=`$run ./try`
b4eb6b3d
JH
17411 case "$yyy" in
17412 12345678901)
17413 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17414 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17415 echo "We will use %qd."
17416 ;;
17417 esac
17418 fi
17419fi
17420
17421if $test X"$sPRId64" = X; then
17422 echo "Cannot figure out how to print 64-bit integers." >&4
17423fi
17424
17425$rm -f try try.*
17426
17427fi
17428
17429case "$sPRId64" in
17430'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
17431 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
17432 ;;
17433*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
17434 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
17435 ;;
17436esac
17437
17438
17439echo " "
17440$echo "Checking the format strings to be used for Perl's internal types..." >&4
17441
17442if $test X"$ivsize" = X8; then
17443 ivdformat="$sPRId64"
17444 uvuformat="$sPRIu64"
17445 uvoformat="$sPRIo64"
17446 uvxformat="$sPRIx64"
17447 uvXUformat="$sPRIXU64"
17448else
17449 if $test X"$ivsize" = X"$longsize"; then
17450 ivdformat='"ld"'
17451 uvuformat='"lu"'
17452 uvoformat='"lo"'
17453 uvxformat='"lx"'
17454 uvXUformat='"lX"'
17455 else
17456 if $test X"$ivsize" = X"$intsize"; then
17457 ivdformat='"d"'
17458 uvuformat='"u"'
17459 uvoformat='"o"'
17460 uvxformat='"x"'
17461 uvXUformat='"X"'
17462 else
17463 : far out
17464 if $test X"$ivsize" = X"$shortsize"; then
17465 ivdformat='"hd"'
17466 uvuformat='"hu"'
17467 uvoformat='"ho"'
17468 uvxformat='"hx"'
17469 uvXUformat='"hX"'
17470 fi
17471 fi
17472 fi
17473fi
17474
17475if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17476 nveformat="$sPRIeldbl"
17477 nvfformat="$sPRIfldbl"
17478 nvgformat="$sPRIgldbl"
17479 nvEUformat="$sPRIEUldbl"
17480 nvFUformat="$sPRIFUldbl"
17481 nvGUformat="$sPRIGUldbl"
17482else
17483 nveformat='"e"'
17484 nvfformat='"f"'
17485 nvgformat='"g"'
17486 nvEUformat='"E"'
17487 nvFUformat='"F"'
17488 nvGUformat='"G"'
17489fi
17490
17491case "$ivdformat" in
3c728e00 17492'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
17493 exit 1
17494 ;;
17495esac
17496
17497
17498echo " "
17499$echo "Checking the format string to be used for gids..." >&4
17500
17501case "$gidsign" in
17502-1) if $test X"$gidsize" = X"$ivsize"; then
17503 gidformat="$ivdformat"
17504 else
17505 if $test X"$gidsize" = X"$longsize"; then
17506 gidformat='"ld"'
17507 else
17508 if $test X"$gidsize" = X"$intsize"; then
17509 gidformat='"d"'
17510 else
17511 if $test X"$gidsize" = X"$shortsize"; then
17512 gidformat='"hd"'
17513 fi
17514 fi
17515 fi
17516 fi
17517 ;;
17518*) if $test X"$gidsize" = X"$uvsize"; then
17519 gidformat="$uvuformat"
17520 else
17521 if $test X"$gidsize" = X"$longsize"; then
17522 gidformat='"lu"'
17523 else
17524 if $test X"$gidsize" = X"$intsize"; then
17525 gidformat='"u"'
17526 else
17527 if $test X"$gidsize" = X"$shortsize"; then
17528 gidformat='"hu"'
17529 fi
17530 fi
17531 fi
17532 fi
17533 ;;
17534esac
17535
17536: see if getgroups exists
17537set getgroups d_getgrps
17538eval $inlibc
17539
17540: see if setgroups exists
17541set setgroups d_setgrps
17542eval $inlibc
17543
17544
17545: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17546echo " "
17547case "$d_getgrps$d_setgrps" in
17548*define*)
17549 case "$groupstype" in
17550 '') dflt="$gidtype" ;;
17551 *) dflt="$groupstype" ;;
17552 esac
17553 $cat <<EOM
17554What type of pointer is the second argument to getgroups() and setgroups()?
17555Usually this is the same as group ids, $gidtype, but not always.
17556
17557EOM
17558 rp='What type pointer is the second argument to getgroups() and setgroups()?'
17559 . ./myread
17560 groupstype="$ans"
17561 ;;
17562*) groupstype="$gidtype";;
17563esac
17564
17565echo " "
17566echo "Checking if your $make program sets \$(MAKE)..." >&4
17567case "$make_set_make" in
17568'')
17569 $sed 's/^X //' > testmake.mak << 'EOF'
17570Xall:
17571X @echo 'maketemp="$(MAKE)"'
17572EOF
17573 case "`$make -f testmake.mak 2>/dev/null`" in
17574 *maketemp=*) make_set_make='#' ;;
17575 *) make_set_make="MAKE=$make" ;;
17576 esac
17577 $rm -f testmake.mak
17578 ;;
17579esac
17580case "$make_set_make" in
17581'#') echo "Yup, it does.";;
17582*) echo "Nope, it doesn't.";;
17583esac
17584
17585: see what type is used for mode_t
17586rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17587set mode_t modetype int stdio.h sys/types.h
17588eval $typedef_ask
17589
2cc61e15
DD
17590: see if stdarg is available
17591echo " "
17592if $test `./findhdr stdarg.h`; then
17593 echo "<stdarg.h> found." >&4
17594 valstd="$define"
17595else
17596 echo "<stdarg.h> NOT found." >&4
17597 valstd="$undef"
17598fi
17599
17600: see if varags is available
17601echo " "
17602if $test `./findhdr varargs.h`; then
17603 echo "<varargs.h> found." >&4
17604else
17605 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17606fi
17607
17608: set up the varargs testing programs
17609$cat > varargs.c <<EOP
17610#ifdef I_STDARG
17611#include <stdarg.h>
17612#endif
17613#ifdef I_VARARGS
17614#include <varargs.h>
17615#endif
17616
17617#ifdef I_STDARG
17618int f(char *p, ...)
17619#else
17620int f(va_alist)
17621va_dcl
17622#endif
17623{
17624 va_list ap;
17625#ifndef I_STDARG
17626 char *p;
17627#endif
17628#ifdef I_STDARG
17629 va_start(ap,p);
17630#else
17631 va_start(ap);
17632 p = va_arg(ap, char *);
17633#endif
17634 va_end(ap);
17635}
17636EOP
17637$cat > varargs <<EOP
17638$startsh
17639if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17640 echo "true"
17641else
17642 echo "false"
17643fi
17644$rm -f varargs$_o
17645EOP
17646chmod +x varargs
17647
17648: now check which varargs header should be included
17649echo " "
17650i_varhdr=''
17651case "$valstd" in
17652"$define")
17653 if `./varargs I_STDARG`; then
17654 val='stdarg.h'
17655 elif `./varargs I_VARARGS`; then
17656 val='varargs.h'
17657 fi
17658 ;;
17659*)
17660 if `./varargs I_VARARGS`; then
17661 val='varargs.h'
17662 fi
17663 ;;
17664esac
17665case "$val" in
17666'')
17667echo "I could not find the definition for va_dcl... You have problems..." >&4
17668 val="$undef"; set i_stdarg; eval $setvar
17669 val="$undef"; set i_varargs; eval $setvar
17670 ;;
17671*)
17672 set i_varhdr
17673 eval $setvar
17674 case "$i_varhdr" in
17675 stdarg.h)
17676 val="$define"; set i_stdarg; eval $setvar
17677 val="$undef"; set i_varargs; eval $setvar
17678 ;;
17679 varargs.h)
17680 val="$undef"; set i_stdarg; eval $setvar
17681 val="$define"; set i_varargs; eval $setvar
17682 ;;
17683 esac
17684 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17685esac
17686$rm -f varargs*
17687
17688: see if we need va_copy
17689echo " "
17690case "$i_stdarg" in
17691"$define")
17692 $cat >try.c <<EOCP
17693#include <stdarg.h>
17694#include <stdio.h>
85c8a686
DD
17695#$i_stdlib I_STDLIB
17696#ifdef I_STDLIB
17697#include <stdlib.h>
17698#endif
17699#include <signal.h>
2cc61e15
DD
17700
17701int
17702ivfprintf(FILE *f, const char *fmt, va_list *valp)
17703{
17704 return vfprintf(f, fmt, *valp);
17705}
17706
17707int
17708myvfprintf(FILE *f, const char *fmt, va_list val)
17709{
17710 return ivfprintf(f, fmt, &val);
17711}
17712
17713int
17714myprintf(char *fmt, ...)
17715{
17716 va_list val;
17717 va_start(val, fmt);
17718 return myvfprintf(stdout, fmt, val);
17719}
17720
17721int
17722main(int ac, char **av)
17723{
85c8a686
DD
17724 signal(SIGSEGV, exit);
17725
2cc61e15
DD
17726 myprintf("%s%cs all right, then\n", "that", '\'');
17727 exit(0);
17728}
17729EOCP
17730 set try
5440bc8e
JH
17731 if eval $compile && $run ./try 2>&1 >/dev/null; then
17732 case "`$run ./try`" in
2cc61e15
DD
17733 "that's all right, then")
17734 okay=yes
17735 ;;
17736 esac
17737 fi
17738 case "$okay" in
17739 yes) echo "It seems that you don't need va_copy()." >&4
17740 need_va_copy="$undef"
17741 ;;
17742 *) echo "It seems that va_copy() or similar will be needed." >&4
17743 need_va_copy="$define"
17744 ;;
17745 esac
17746 $rm -f try.* core core.* *.core *.core.*
17747 ;;
17748*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17749 ;;
17750esac
17751
b4eb6b3d
JH
17752: see what type is used for size_t
17753rp="What is the type used for the length parameter for string functions?"
17754set size_t sizetype 'unsigned int' stdio.h sys/types.h
17755eval $typedef_ask
17756
17757: check for type of arguments to gethostbyaddr.
17758if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17759 case "$d_gethbyaddr" in
17760 $define)
17761 $cat <<EOM
17762
17763Checking to see what type of arguments are accepted by gethostbyaddr().
17764EOM
17765 hdrs="$define sys/types.h
17766 $d_socket sys/socket.h
17767 $i_niin netinet/in.h
17768 $i_netdb netdb.h
17769 $i_unistd unistd.h"
17770 : The first arg can 'char *' or 'void *'
17771 : The second arg is some of integral type
17772 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17773 for yyy in size_t long int; do
17774 case "$netdb_host_type" in
17775 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17776 if ./protochk "$try" $hdrs; then
17777 echo "Your system accepts $xxx for the first arg."
17778 echo "...and $yyy for the second arg."
17779 netdb_host_type="$xxx"
17780 netdb_hlen_type="$yyy"
17781 fi
17782 ;;
17783 esac
17784 done
17785 done
17786 : In case none of those worked, prompt the user.
17787 case "$netdb_host_type" in
17788 '') rp='What is the type for the 1st argument to gethostbyaddr?'
17789 dflt='char *'
17790 . ./myread
17791 netdb_host_type=$ans
17792 rp='What is the type for the 2nd argument to gethostbyaddr?'
17793 dflt="$sizetype"
17794 . ./myread
17795 netdb_hlen_type=$ans
17796 ;;
17797 esac
17798 ;;
17799 *) : no gethostbyaddr, so pick harmless defaults
17800 netdb_host_type='char *'
17801 netdb_hlen_type="$sizetype"
17802 ;;
17803 esac
17804 # Remove the "const" if needed. -- but then we'll have a
17805 # prototype clash!
17806 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17807fi
17808
17809: check for type of argument to gethostbyname.
17810if test "X$netdb_name_type" = X ; then
17811 case "$d_gethbyname" in
17812 $define)
17813 $cat <<EOM
17814
17815Checking to see what type of argument is accepted by gethostbyname().
17816EOM
17817 hdrs="$define sys/types.h
17818 $d_socket sys/socket.h
17819 $i_niin netinet/in.h
17820 $i_netdb netdb.h
17821 $i_unistd unistd.h"
17822 for xxx in "const char *" "char *"; do
17823 case "$netdb_name_type" in
17824 '') try="extern struct hostent *gethostbyname($xxx);"
17825 if ./protochk "$try" $hdrs; then
17826 echo "Your system accepts $xxx."
17827 netdb_name_type="$xxx"
17828 fi
17829 ;;
17830 esac
17831 done
17832 : In case none of those worked, prompt the user.
17833 case "$netdb_name_type" in
17834 '') rp='What is the type for the 1st argument to gethostbyname?'
17835 dflt='char *'
17836 . ./myread
17837 netdb_name_type=$ans
17838 ;;
17839 esac
17840 ;;
17841 *) : no gethostbyname, so pick harmless default
17842 netdb_name_type='char *'
17843 ;;
17844 esac
17845fi
17846
17847: check for type of 1st argument to getnetbyaddr.
17848if test "X$netdb_net_type" = X ; then
17849 case "$d_getnbyaddr" in
17850 $define)
17851 $cat <<EOM
17852
17853Checking to see what type of 1st argument is accepted by getnetbyaddr().
17854EOM
17855 hdrs="$define sys/types.h
17856 $d_socket sys/socket.h
17857 $i_niin netinet/in.h
17858 $i_netdb netdb.h
17859 $i_unistd unistd.h"
17860 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17861 case "$netdb_net_type" in
17862 '') try="extern struct netent *getnetbyaddr($xxx, int);"
17863 if ./protochk "$try" $hdrs; then
17864 echo "Your system accepts $xxx."
17865 netdb_net_type="$xxx"
17866 fi
17867 ;;
17868 esac
17869 done
17870 : In case none of those worked, prompt the user.
17871 case "$netdb_net_type" in
17872 '') rp='What is the type for the 1st argument to getnetbyaddr?'
17873 dflt='long'
17874 . ./myread
17875 netdb_net_type=$ans
17876 ;;
17877 esac
17878 ;;
17879 *) : no getnetbyaddr, so pick harmless default
17880 netdb_net_type='long'
17881 ;;
17882 esac
17883fi
17884: locate the preferred pager for this system
17885case "$pager" in
17886'')
17887 dflt=''
17888 case "$pg" in
17889 /*) dflt=$pg;;
17890 [a-zA-Z]:/*) dflt=$pg;;
17891 esac
17892 case "$more" in
17893 /*) dflt=$more;;
17894 [a-zA-Z]:/*) dflt=$more;;
17895 esac
17896 case "$less" in
17897 /*) dflt=$less;;
17898 [a-zA-Z]:/*) dflt=$less;;
17899 esac
17900 case "$dflt" in
17901 '') dflt=/usr/ucb/more;;
17902 esac
17903 ;;
17904*) dflt="$pager";;
17905esac
17906echo " "
17907fn=f/
17908rp='What pager is used on your system?'
17909. ./getfile
17910pager="$ans"
17911
17912: see what type pids are declared as in the kernel
17913rp="What is the type of process ids on this system?"
17914set pid_t pidtype int stdio.h sys/types.h
17915eval $typedef_ask
17916
17917: Find earliest binary compatible site_perl subdirectory perl can use.
17918case "$bincompat5005" in
17919"$define") xs_apiversion='5.005' ;;
17920*) xs_apiversion=$version ;; # The current site_perl version.
17921esac
17922: Find earliest pure perl site_perl subdirectory perl can use.
17923: The versioned directories started at 5.005.
17924pm_apiversion='5.005'
17925
b4eb6b3d
JH
17926: see if ar generates random libraries by itself
17927echo " "
17928echo "Checking how to generate random libraries on your machine..." >&4
17929echo 'int bar1() { return bar2(); }' > bar1.c
17930echo 'int bar2() { return 2; }' > bar2.c
17931$cat > foo.c <<'EOP'
17932int main() { printf("%d\n", bar1()); exit(0); }
17933EOP
17934$cc $ccflags -c bar1.c >/dev/null 2>&1
17935$cc $ccflags -c bar2.c >/dev/null 2>&1
17936$cc $ccflags -c foo.c >/dev/null 2>&1
17937$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 17938if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 17939 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
17940 echo "$ar appears to generate random libraries itself."
17941 orderlib=false
17942 ranlib=":"
17943elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 17944 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 17945 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
17946 echo "a table of contents needs to be added with '$ar ts'."
17947 orderlib=false
17948 ranlib="$ar ts"
17949else
17950 case "$ranlib" in
17951 :) ranlib='';;
17952 '')
17953 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17954 $test -f $ranlib || ranlib=''
17955 ;;
17956 esac
17957 if $test -n "$ranlib"; then
17958 echo "your system has '$ranlib'; we'll use that."
17959 orderlib=false
17960 else
17961 echo "your system doesn't seem to support random libraries"
17962 echo "so we'll use lorder and tsort to order the libraries."
17963 orderlib=true
17964 ranlib=":"
17965 fi
17966fi
17967$rm -f foo* bar*
17968
17969: check for type of arguments to select.
17970case "$selecttype" in
17971'') case "$d_select" in
17972 $define)
17973 echo " "
17974 $cat <<EOM
17975Checking to see what type of arguments are accepted by select().
17976EOM
17977 hdrs="$define sys/types.h
17978 $i_systime sys/time.h
17979 $i_sysselct sys/select.h
17980 $d_socket sys/socket.h"
17981 : The first arg can be int, unsigned, or size_t
17982 : The last arg may or may not be 'const'
17983 val=''
17984 : void pointer has been seen but using that
17985 : breaks the selectminbits test
17986 for xxx in 'fd_set *' 'int *'; do
17987 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17988 for tmo in 'struct timeval *' 'const struct timeval *'; do
17989 case "$val" in
17990 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17991 if ./protochk "$try" $hdrs; then
17992 echo "Your system accepts $xxx."
17993 val="$xxx"
17994 fi
17995 ;;
17996 esac
17997 done
17998 done
17999 done
18000 case "$val" in
18001 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18002 case "$d_fd_set" in
18003 $define) dflt="fd_set *" ;;
18004 *) dflt="int *" ;;
18005 esac
18006 . ./myread
18007 val=$ans
18008 ;;
18009 esac
18010 selecttype="$val"
18011 ;;
18012 *) : no select, so pick a harmless default
18013 selecttype='int *'
18014 ;;
18015 esac
18016 ;;
18017esac
18018
18019: check for the select 'width'
18020case "$selectminbits" in
18021'') case "$d_select" in
18022 $define)
18023 $cat <<EOM
18024
18025Checking to see on how many bits at a time your select() operates...
18026EOM
18027 $cat >try.c <<EOCP
18028#include <sys/types.h>
18029#$i_time I_TIME
18030#$i_systime I_SYS_TIME
18031#$i_systimek I_SYS_TIME_KERNEL
18032#ifdef I_TIME
18033# include <time.h>
18034#endif
18035#ifdef I_SYS_TIME
18036# ifdef I_SYS_TIME_KERNEL
18037# define KERNEL
18038# endif
18039# include <sys/time.h>
18040# ifdef I_SYS_TIME_KERNEL
18041# undef KERNEL
18042# endif
18043#endif
18044#$i_sysselct I_SYS_SELECT
18045#ifdef I_SYS_SELECT
18046#include <sys/select.h>
18047#endif
18048#$d_socket HAS_SOCKET
18049#ifdef HAS_SOCKET
18050# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18051#endif
18052#include <stdio.h>
18053$selecttype b;
18054#define S sizeof(*(b))
18055#define MINBITS 64
18056#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18057#define NBITS (NBYTES * 8)
18058int main() {
18059 char s[NBYTES];
18060 struct timeval t;
18061 int i;
18062 FILE* fp;
18063 int fd;
18064
18065 fclose(stdin);
18066 fp = fopen("try.c", "r");
18067 if (fp == 0)
18068 exit(1);
18069 fd = fileno(fp);
18070 if (fd < 0)
18071 exit(2);
18072 b = ($selecttype)s;
18073 for (i = 0; i < NBITS; i++)
18074 FD_SET(i, b);
18075 t.tv_sec = 0;
18076 t.tv_usec = 0;
18077 select(fd + 1, b, 0, 0, &t);
18078 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18079 printf("%d\n", i + 1);
18080 return 0;
18081}
18082EOCP
18083 set try
18084 if eval $compile_ok; then
5440bc8e 18085 selectminbits=`$run ./try`
b4eb6b3d
JH
18086 case "$selectminbits" in
18087 '') cat >&4 <<EOM
18088Cannot figure out on how many bits at a time your select() operates.
18089I'll play safe and guess it is 32 bits.
18090EOM
18091 selectminbits=32
18092 bits="32 bits"
18093 ;;
18094 1) bits="1 bit" ;;
18095 *) bits="$selectminbits bits" ;;
18096 esac
18097 echo "Your select() operates on $bits at a time." >&4
18098 else
18099 rp='What is the minimum number of bits your select() operates on?'
18100 case "$byteorder" in
18101 1234|12345678) dflt=32 ;;
18102 *) dflt=1 ;;
18103 esac
18104 . ./myread
18105 val=$ans
18106 selectminbits="$val"
18107 fi
18108 $rm -f try.* try
18109 ;;
18110 *) : no select, so pick a harmless default
18111 selectminbits='32'
18112 ;;
18113 esac
18114 ;;
18115esac
18116
18117: Trace out the files included by signal.h, then look for SIGxxx names.
18118: Remove SIGARRAYSIZE used by HPUX.
18119: Remove SIGSTKSIZE used by Linux.
18120: Remove SIGSTKSZ used by Posix.
18121: Remove SIGTYP void lines used by OS2.
18122: Some cpps, like os390, dont give the file name anywhere
18123if [ "X$fieldn" = X ]; then
18124 : Just make some guesses. We check them later.
18125 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18126else
18127 xxx=`echo '#include <signal.h>' |
18128 $cppstdin $cppminus $cppflags 2>/dev/null |
18129 $grep '^[ ]*#.*include' |
a938a3bb 18130 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
18131fi
18132: Check this list of files to be sure we have parsed the cpp output ok.
18133: This will also avoid potentially non-existent files, such
18134: as ../foo/bar.h
18135xxxfiles=''
18136for xx in $xxx /dev/null ; do
18137 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18138done
18139: If we have found no files, at least try signal.h
18140case "$xxxfiles" in
18141'') xxxfiles=`./findhdr signal.h` ;;
18142esac
18143xxx=`awk '
18144$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18145 print substr($2, 4, 20)
18146}
18147$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18148 print substr($3, 4, 20)
18149}' $xxxfiles`
18150: Append some common names just in case the awk scan failed.
18151xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18152xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18153xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18154xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18155xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18156
18157: generate a few handy files for later
18158$cat > signal.c <<'EOCP'
18159#include <sys/types.h>
18160#include <signal.h>
18161#include <stdio.h>
18162int main() {
18163
18164/* Strange style to avoid deeply-nested #if/#else/#endif */
18165#ifndef NSIG
18166# ifdef _NSIG
18167# define NSIG (_NSIG)
18168# endif
18169#endif
18170
18171#ifndef NSIG
18172# ifdef SIGMAX
18173# define NSIG (SIGMAX+1)
18174# endif
18175#endif
18176
18177#ifndef NSIG
18178# ifdef SIG_MAX
18179# define NSIG (SIG_MAX+1)
18180# endif
18181#endif
18182
18183#ifndef NSIG
18184# ifdef MAXSIG
18185# define NSIG (MAXSIG+1)
18186# endif
18187#endif
18188
18189#ifndef NSIG
18190# ifdef MAX_SIG
18191# define NSIG (MAX_SIG+1)
18192# endif
18193#endif
18194
18195#ifndef NSIG
18196# ifdef SIGARRAYSIZE
18197# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18198# endif
18199#endif
18200
18201#ifndef NSIG
18202# ifdef _sys_nsig
18203# define NSIG (_sys_nsig) /* Solaris 2.5 */
18204# endif
18205#endif
18206
18207/* Default to some arbitrary number that's big enough to get most
18208 of the common signals.
18209*/
18210#ifndef NSIG
18211# define NSIG 50
18212#endif
18213
18214printf("NSIG %d\n", NSIG);
18215
18216#ifndef JUST_NSIG
18217
18218EOCP
18219
18220echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18221{
18222 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 18223 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
18224 printf $1; printf ");\n"
18225 printf "#endif\n"
18226}
18227END {
18228 printf "#endif /* JUST_NSIG */\n";
18229 printf "exit(0);\n}\n";
18230}
18231' >>signal.c
18232$cat >signal.awk <<'EOP'
18233BEGIN { ndups = 0 }
65197d93
JH
18234$1 ~ /^NSIG$/ { nsig = $2 }
18235($1 !~ /^NSIG$/) && (NF == 2) {
18236 if ($2 > maxsig) { maxsig = $2 }
18237 if (sig_name[$2]) {
18238 dup_name[ndups] = $1
18239 dup_num[ndups] = $2
b4eb6b3d
JH
18240 ndups++
18241 }
18242 else {
65197d93
JH
18243 sig_name[$2] = $1
18244 sig_num[$2] = $2
b4eb6b3d
JH
18245 }
18246}
18247END {
18248 if (nsig == 0) {
18249 nsig = maxsig + 1
18250 }
18251 printf("NSIG %d\n", nsig);
18252 for (n = 1; n < nsig; n++) {
18253 if (sig_name[n]) {
18254 printf("%s %d\n", sig_name[n], sig_num[n])
18255 }
18256 else {
18257 printf("NUM%d %d\n", n, n)
18258 }
18259 }
18260 for (n = 0; n < ndups; n++) {
18261 printf("%s %d\n", dup_name[n], dup_num[n])
18262 }
18263}
18264EOP
18265$cat >signal_cmd <<EOS
18266$startsh
18267if $test -s signal.lst; then
18268 echo "Using your existing signal.lst file"
18269 exit 0
18270fi
18271xxx="$xxx"
18272EOS
18273$cat >>signal_cmd <<'EOS'
18274
18275set signal
18276if eval $compile_ok; then
1eb9ad5b 18277 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18278else
18279 echo "(I can't seem be able to compile the whole test program)" >&4
18280 echo "(I'll try it in little pieces.)" >&4
18281 set signal -DJUST_NSIG
18282 if eval $compile_ok; then
5440bc8e 18283 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
18284 $cat signal.nsg
18285 else
18286 echo "I can't seem to figure out how many signals you have." >&4
18287 echo "Guessing 50." >&4
18288 echo 'NSIG 50' > signal.nsg
18289 fi
18290 : Now look at all the signal names, one at a time.
18291 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18292 $cat > signal.c <<EOCP
18293#include <sys/types.h>
18294#include <signal.h>
18295#include <stdio.h>
18296int main() {
18297printf("$xx %d\n", SIG${xx});
18298return 0;
18299}
18300EOCP
18301 set signal
18302 if eval $compile; then
18303 echo "SIG${xx} found."
5440bc8e 18304 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
18305 else
18306 echo "SIG${xx} NOT found."
18307 fi
18308 done
18309 if $test -s signal.ls1; then
18310 $cat signal.nsg signal.ls1 |
65197d93 18311 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18312 fi
18313
18314fi
18315if $test -s signal.lst; then
18316 :
18317else
18318 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18319 echo 'kill -l' >signal
18320 set X `csh -f <signal`
18321 $rm -f signal
18322 shift
18323 case $# in
18324 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18325 esac
18326 echo $@ | $tr ' ' $trnl | \
18327 $awk '{ printf "%s %d\n", $1, ++s; }
18328 END { printf "NSIG %d\n", ++s }' >signal.lst
18329fi
18330$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18331EOS
18332chmod a+x signal_cmd
18333$eunicefix signal_cmd
18334
18335: generate list of signal names
18336echo " "
18337case "$sig_name_init" in
18338'') doinit=yes ;;
18339*) case "$sig_num_init" in
18340 ''|*,*) doinit=yes ;;
18341 esac ;;
18342esac
18343case "$doinit" in
18344yes)
18345 echo "Generating a list of signal names and numbers..." >&4
18346 . ./signal_cmd
18347 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18348 sig_name=`$awk 'BEGIN { printf "ZERO " }
18349 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18350 sig_num=`$awk 'BEGIN { printf "0 " }
18351 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18352 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
18353 !/^NSIG/ { printf "\"%s\", ", $1 }
18354 END { printf "0\n" }' signal.lst`
18355 sig_num_init=`$awk 'BEGIN { printf "0, " }
18356 !/^NSIG/ { printf "%d, ", $2}
18357 END { printf "0\n"}' signal.lst`
18358 ;;
18359esac
18360echo "The following $sig_count signals are available:"
18361echo " "
18362echo $sig_name | $awk \
18363'BEGIN { linelen = 0 }
18364{
18365 for (i = 1; i <= NF; i++) {
18366 name = "SIG" $i " "
18367 linelen = linelen + length(name)
18368 if (linelen > 70) {
18369 printf "\n"
18370 linelen = length(name)
18371 }
18372 printf "%s", name
18373 }
18374 printf "\n"
18375}'
76d3c696 18376sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
18377$rm -f signal signal.c signal.awk signal.lst signal_cmd
18378
18379echo " "
18380case "$sizetype" in
18381*_t) zzz="$sizetype" ;;
18382*) zzz="filesize" ;;
18383esac
18384echo "Checking the size of $zzz..." >&4
18385cat > try.c <<EOCP
18386#include <sys/types.h>
18387#include <stdio.h>
18388int main() {
18389 printf("%d\n", (int)sizeof($sizetype));
18390 exit(0);
18391}
18392EOCP
18393set try
18394if eval $compile_ok; then
5440bc8e 18395 yyy=`$run ./try`
b4eb6b3d
JH
18396 case "$yyy" in
18397 '') sizesize=4
18398 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18399 ;;
18400 *) sizesize=$yyy
18401 echo "Your $zzz size is $sizesize bytes."
18402 ;;
18403 esac
18404else
18405 sizesize=4
18406 echo "(I can't compile the test program--guessing $sizesize.)" >&4
18407fi
18408
18409
18410: check for socklen_t
18411echo " "
18412echo "Checking to see if you have socklen_t..." >&4
18413$cat >try.c <<EOCP
18414#include <sys/types.h>
18415#$d_socket HAS_SOCKET
18416#ifdef HAS_SOCKET
18417#include <sys/socket.h>
18418#endif
18419int main() { socklen_t x = 16; }
18420EOCP
18421set try
18422if eval $compile; then
18423 val="$define"
18424 echo "You have socklen_t."
18425else
18426 val="$undef"
18427 echo "You do not have socklen_t."
18428 case "$sizetype" in
18429 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18430 esac
18431fi
18432$rm -f try try.*
18433set d_socklen_t
18434eval $setvar
18435
a7710f8d
JH
18436: see if this is a socks.h system
18437set socks.h i_socks
18438eval $inhdr
18439
b4eb6b3d
JH
18440: check for type of the size argument to socket calls
18441case "$d_socket" in
18442"$define")
18443 $cat <<EOM
18444
18445Checking to see what type is the last argument of accept().
18446EOM
b4eb6b3d
JH
18447 yyy=''
18448 case "$d_socklen_t" in
18449 "$define") yyy="$yyy socklen_t"
18450 esac
18451 yyy="$yyy $sizetype int long unsigned"
18452 for xxx in $yyy; do
18453 case "$socksizetype" in
18454 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
18455 case "$usesocks" in
18456 "$define")
18457 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18458 echo "Your system accepts '$xxx *' for the last argument of accept()."
18459 socksizetype="$xxx"
18460 fi
18461 ;;
18462 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
18463 echo "Your system accepts '$xxx *' for the last argument of accept()."
18464 socksizetype="$xxx"
18465 fi
18466 ;;
18467 esac
b4eb6b3d
JH
18468 ;;
18469 esac
18470 done
18471: In case none of those worked, prompt the user.
18472 case "$socksizetype" in
18473 '') rp='What is the type for socket address structure sizes?'
18474 dflt='int'
18475 . ./myread
18476 socksizetype=$ans
18477 ;;
18478 esac
18479 ;;
18480*) : no sockets, so pick relatively harmless default
18481 socksizetype='int'
18482 ;;
18483esac
18484
18485: see what type is used for signed size_t
18486set ssize_t ssizetype int stdio.h sys/types.h
18487eval $typedef
18488dflt="$ssizetype"
5440bc8e 18489$cat > try.c <<EOM
b4eb6b3d
JH
18490#include <stdio.h>
18491#include <sys/types.h>
18492#define Size_t $sizetype
18493#define SSize_t $dflt
18494int main()
18495{
18496 if (sizeof(Size_t) == sizeof(SSize_t))
18497 printf("$dflt\n");
18498 else if (sizeof(Size_t) == sizeof(int))
18499 printf("int\n");
18500 else
18501 printf("long\n");
18502 exit(0);
18503}
18504EOM
18505echo " "
5440bc8e
JH
18506set try
18507if eval $compile_ok && $run ./try > /dev/null; then
18508 ssizetype=`$run ./try`
b4eb6b3d
JH
18509 echo "I'll be using $ssizetype for functions returning a byte count." >&4
18510else
18511 $cat >&4 <<EOM
18512Help! I can't compile and run the ssize_t test program: please enlighten me!
18513(This is probably a misconfiguration in your system or libraries, and
18514you really ought to fix it. Still, I'll try anyway.)
18515
18516I need a type that is the same size as $sizetype, but is guaranteed to
18517be signed. Common values are ssize_t, int and long.
18518
18519EOM
18520 rp="What signed type is the same size as $sizetype?"
18521 . ./myread
18522 ssizetype="$ans"
18523fi
5440bc8e 18524$rm -f try try.*
b4eb6b3d
JH
18525
18526: see what type of char stdio uses.
18527echo " "
aa517f50
JH
18528echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18529if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
18530 echo "Your stdio uses unsigned chars." >&4
18531 stdchar="unsigned char"
18532else
aa517f50
JH
18533 echo "Your stdio uses signed chars." >&4
18534 stdchar="char"
b4eb6b3d 18535fi
aa517f50
JH
18536$rm -f stdioh
18537
18538
b4eb6b3d 18539
b4eb6b3d
JH
18540: see what type uids are declared as in the kernel
18541echo " "
18542echo "Looking for the type for user ids returned by getuid()."
18543set uid_t uidtype xxx stdio.h sys/types.h
18544eval $typedef
18545case "$uidtype" in
18546xxx)
18547 xxx=`./findhdr sys/user.h`
18548 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18549 case $1 in
18550 unsigned) dflt="$1 $2" ;;
18551 *) dflt="$1" ;;
18552 esac
18553 ;;
18554*) dflt="$uidtype";;
18555esac
18556case "$uidtype" in
18557uid_t) echo "uid_t found." ;;
18558*) rp="What is the type for user ids returned by getuid()?"
18559 . ./myread
18560 uidtype="$ans"
18561 ;;
18562esac
18563
18564echo " "
18565case "$uidtype" in
18566*_t) zzz="$uidtype" ;;
18567*) zzz="uid" ;;
18568esac
18569echo "Checking the size of $zzz..." >&4
18570cat > try.c <<EOCP
18571#include <sys/types.h>
18572#include <stdio.h>
18573int main() {
18574 printf("%d\n", (int)sizeof($uidtype));
18575 exit(0);
18576}
18577EOCP
18578set try
18579if eval $compile_ok; then
5440bc8e 18580 yyy=`$run ./try`
b4eb6b3d
JH
18581 case "$yyy" in
18582 '') uidsize=4
18583 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18584 ;;
18585 *) uidsize=$yyy
18586 echo "Your $zzz is $uidsize bytes long."
18587 ;;
18588 esac
18589else
18590 uidsize=4
18591 echo "(I can't compile the test program--guessing $uidsize.)" >&4
18592fi
18593
18594echo " "
18595case "$uidtype" in
18596*_t) zzz="$uidtype" ;;
18597*) zzz="uid" ;;
18598esac
18599echo "Checking the sign of $zzz..." >&4
18600cat > try.c <<EOCP
18601#include <sys/types.h>
18602#include <stdio.h>
18603int main() {
18604 $uidtype foo = -1;
18605 if (foo < 0)
18606 printf("-1\n");
18607 else
18608 printf("1\n");
18609}
18610EOCP
18611set try
18612if eval $compile; then
5440bc8e 18613 yyy=`$run ./try`
b4eb6b3d
JH
18614 case "$yyy" in
18615 '') uidsign=1
18616 echo "(I can't execute the test program--guessing unsigned.)" >&4
18617 ;;
18618 *) uidsign=$yyy
18619 case "$uidsign" in
18620 1) echo "Your $zzz is unsigned." ;;
18621 -1) echo "Your $zzz is signed." ;;
18622 esac
18623 ;;
18624 esac
18625else
18626 uidsign=1
18627 echo "(I can't compile the test program--guessing unsigned.)" >&4
18628fi
18629
18630
18631
18632echo " "
18633$echo "Checking the format string to be used for uids..." >&4
18634
18635case "$uidsign" in
18636-1) if $test X"$uidsize" = X"$ivsize"; then
18637 uidformat="$ivdformat"
18638 else
18639 if $test X"$uidsize" = X"$longsize"; then
18640 uidformat='"ld"'
18641 else
18642 if $test X"$uidsize" = X"$intsize"; then
18643 uidformat='"d"'
18644 else
18645 if $test X"$uidsize" = X"$shortsize"; then
18646 uidformat='"hd"'
18647 fi
18648 fi
18649 fi
18650 fi
18651 ;;
18652*) if $test X"$uidsize" = X"$uvsize"; then
18653 uidformat="$uvuformat"
18654 else
18655 if $test X"$uidsize" = X"$longsize"; then
18656 uidformat='"lu"'
18657 else
18658 if $test X"$uidsize" = X"$intsize"; then
18659 uidformat='"u"'
18660 else
18661 if $test X"$uidsize" = X"$shortsize"; then
18662 uidformat='"hu"'
18663 fi
18664 fi
18665 fi
18666 fi
18667 ;;
18668esac
18669
3659ebf1
JH
18670: determine compiler compiler
18671case "$yacc" in
18672'')
18673 dflt=yacc;;
18674*)
18675 dflt="$yacc";;
18676esac
18677echo " "
18678comp='yacc'
3c728e00 18679if $test -f "$byacc$_exe"; then
3659ebf1
JH
18680 dflt="$byacc"
18681 comp="byacc or $comp"
18682fi
3c728e00 18683if $test -f "$bison$_exe"; then
3659ebf1
JH
18684 comp="$comp or bison -y"
18685fi
18686rp="Which compiler compiler ($comp) shall I use?"
18687. ./myread
18688yacc="$ans"
18689case "$yacc" in
18690*bis*)
18691 case "$yacc" in
18692 *-y*) ;;
18693 *)
18694 yacc="$yacc -y"
18695 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18696 ;;
18697 esac
18698 ;;
18699esac
18700
758a5d79
JH
18701: see if this is a fp.h system
18702set fp.h i_fp
18703eval $inhdr
18704
18705: see if this is a fp_class.h system
18706set fp_class.h i_fp_class
18707eval $inhdr
18708
b4eb6b3d 18709: see if this is a ieeefp.h system
b5b9f165
JH
18710case "$i_ieeefp" in
18711'' ) set ieeefp.h i_ieeefp
18712 eval $inhdr
18713 ;;
18714esac
b4eb6b3d
JH
18715
18716: see if this is a libutil.h system
18717set libutil.h i_libutil
18718eval $inhdr
18719
b4eb6b3d
JH
18720: see if mach cthreads are available
18721if test "X$usethreads" = "X$define"; then
18722 set mach/cthreads.h i_machcthr
18723 eval $inhdr
18724else
18725 i_machcthr="$undef"
18726fi
18727
18728
18729
18730: see if this is a math.h system
18731set math.h i_math
18732eval $inhdr
18733
18734: see if this is a mntent.h system
18735set mntent.h i_mntent
18736eval $inhdr
18737
18738: see if ndbm.h is available
18739set ndbm.h t_ndbm
18740eval $inhdr
1c6861ad
JS
18741
18742case "$t_ndbm" in
18743$undef)
18744 # Some Linux distributions such as RedHat 7.1 put the
18745 # ndbm.h header in /usr/include/gdbm/ndbm.h.
18746 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 18747 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
18748 ccflags="$ccflags -I/usr/include/gdbm"
18749 cppflags="$cppflags -I/usr/include/gdbm"
18750 t_ndbm=$define
18751 fi
18752 ;;
18753esac
18754
b4eb6b3d
JH
18755case "$t_ndbm" in
18756$define)
18757 : see if dbm_open exists
18758 set dbm_open d_dbm_open
18759 eval $inlibc
18760 case "$d_dbm_open" in
18761 $undef)
18762 t_ndbm="$undef"
18763 echo "We won't be including <ndbm.h>"
18764 ;;
18765 esac
18766 ;;
18767esac
18768val="$t_ndbm"
18769set i_ndbm
18770eval $setvar
18771
18772: see if net/errno.h is available
18773val=''
18774set net/errno.h val
18775eval $inhdr
18776
18777: Unfortunately, it causes problems on some systems. Arrgh.
18778case "$val" in
18779$define)
18780 cat > try.c <<'EOM'
18781#include <stdio.h>
18782#include <errno.h>
18783#include <net/errno.h>
18784int func()
18785{
18786 return ENOTSOCK;
18787}
18788EOM
18789 if $cc $ccflags -c try.c >/dev/null 2>&1; then
18790 echo "We'll be including <net/errno.h>." >&4
18791 else
18792 echo "We won't be including <net/errno.h>." >&4
18793 val="$undef"
18794 fi
18795 $rm -f try.* try
18796 ;;
18797esac
18798set i_neterrno
18799eval $setvar
18800
18801: see if netinet/tcp.h is available
18802set netinet/tcp.h i_netinettcp
18803eval $inhdr
18804
18805: see if this is a poll.h system
18806set poll.h i_poll
18807eval $inhdr
18808
18809: see if this is a prot.h system
18810set prot.h i_prot
18811eval $inhdr
18812
18813echo " "
18814$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
18815$cat <<'EOSH' > Cppsym.know
18816a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18817AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
18818alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18819ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18820BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
18821BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18822bull c cadmus clipper CMU COFF COMPILER_VERSION
18823concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18824CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
18825Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18826FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18827GLIBC GLIBC_MINOR
18828GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
18829H3050R H3050RX hbullx20 hcx host_mips
18830hp200 hp300 hp700 HP700 hp800 hp9000
18831hp9000s200 hp9000s300 hp9000s400 hp9000s500
18832hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18833i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 18834IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
18835INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18836LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18837LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18838Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18839LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18840M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18841M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18842M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18843MATH_HAS_NO_SIDE_EFFECTS
18844mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18845mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18846mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18847MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18848mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18849NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 18850news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
18851ns32016 ns32332 ns32k nsc32000
18852OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18853pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18854pc532 pdp11 PGC PIC plexus PORTAR posix
18855POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18856POSIX_C_SOURCE POSIX_SOURCE POWER
18857PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 18858riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
18859SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18860sony sony_news sonyrisc sparc sparclite spectrum
18861stardent stdc STDC_EXT stratos sun sun3 sun386
18862Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18863SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18864SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18865sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 18866TM3200 TM5400 TM5600
b4eb6b3d
JH
18867tower tower32 tower32_200 tower32_600 tower32_700
18868tower32_800 tower32_850 tss
18869u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18870ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
18871unix UNIX95 UNIX99 unixpc unos
18872USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18873USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18874USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18875USGr4 USGr4_2
b4eb6b3d
JH
18876Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18877XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18878XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18879z8000
18880EOSH
18881# Maybe put other stuff here too.
18882cat <<EOSH >>Cppsym.know
18883$osname
18884EOSH
18885./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18886./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18887$cat Cppsym.know > Cppsym.c
381aa1ff 18888$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
18889$rm -f Cppsym.a Cppsym.b Cppsym.c
18890cat <<EOSH > Cppsym
18891$startsh
18892if $test \$# -gt 0; then
18893 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18894 if $test -s Cppsym.got; then
18895 $rm -f Cppsym.got
18896 exit 0
18897 fi
18898 $rm -f Cppsym.got
18899 exit 1
18900else
18901 $tr " " "$trnl" | ./Cppsym.try
18902 exit 0
18903fi
18904EOSH
18905chmod +x Cppsym
18906$eunicefix Cppsym
18907cat <<EOSH > Cppsym.try
18908$startsh
18909cat <<'EOCP' > try.c
18910#include <stdio.h>
18911int main() {
18912EOCP
18913$awk \\
18914EOSH
18915cat <<'EOSH' >> Cppsym.try
18916'length($1) > 0 {
2ef53570
JH
18917 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
18918 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
18919 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
18920 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 18921}' >> try.c
2ef53570 18922echo 'return 0;}' >> try.c
b4eb6b3d
JH
18923EOSH
18924cat <<EOSH >> Cppsym.try
18925ccflags="$ccflags"
18926case "$osname-$gccversion" in
18927irix-) ccflags="\$ccflags -woff 1178" ;;
18928os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18929esac
5440bc8e 18930$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
18931EOSH
18932chmod +x Cppsym.try
18933$eunicefix Cppsym.try
18934./Cppsym < Cppsym.know > Cppsym.true
18935: now check the C compiler for additional symbols
18936postprocess_cc_v=''
18937case "$osname" in
18938aix) postprocess_cc_v="|$tr , ' '" ;;
18939esac
18940$cat >ccsym <<EOS
18941$startsh
18942$cat >tmp.c <<EOF
18943extern int foo;
18944EOF
18945for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18946do
18947 case "\$i" in
18948 -D*) echo "\$i" | $sed 's/^-D//';;
18949 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
18950 esac
18951done
18952$rm -f try.c
18953EOS
18954postprocess_cc_v=''
18955chmod +x ccsym
18956$eunicefix ccsym
18957./ccsym > ccsym1.raw
18958if $test -s ccsym1.raw; then
18959 $sort ccsym1.raw | $uniq >ccsym.raw
18960else
18961 mv ccsym1.raw ccsym.raw
18962fi
18963
18964$awk '/\=/ { print $0; next }
18965 { print $0"=1" }' ccsym.raw >ccsym.list
18966$awk '/\=/ { print $0; next }
18967 { print $0"=1" }' Cppsym.true >ccsym.true
18968$comm -13 ccsym.true ccsym.list >ccsym.own
18969$comm -12 ccsym.true ccsym.list >ccsym.com
18970$comm -23 ccsym.true ccsym.list >ccsym.cpp
18971also=''
18972if $test -z ccsym.raw; then
18973 echo "Your C compiler doesn't seem to define any symbols!" >&4
18974 echo " "
18975 echo "However, your C preprocessor defines the following symbols:"
18976 $cat Cppsym.true
18977 ccsymbols=''
18978 cppsymbols=`$cat Cppsym.true`
18979 cppsymbols=`echo $cppsymbols`
18980 cppccsymbols="$cppsymbols"
18981else
18982 if $test -s ccsym.com; then
18983 echo "Your C compiler and pre-processor define these symbols:"
18984 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18985 also='also '
18986 symbols='ones'
18987 cppccsymbols=`$cat ccsym.com`
18988 cppccsymbols=`echo $cppccsymbols`
18989 $test "$silent" || sleep 1
18990 fi
18991 if $test -s ccsym.cpp; then
18992 $test "$also" && echo " "
18993 echo "Your C pre-processor ${also}defines the following symbols:"
18994 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18995 also='further '
18996 cppsymbols=`$cat ccsym.cpp`
18997 cppsymbols=`echo $cppsymbols`
18998 $test "$silent" || sleep 1
18999 fi
19000 if $test -s ccsym.own; then
19001 $test "$also" && echo " "
19002 echo "Your C compiler ${also}defines the following cpp symbols:"
19003 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19004 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19005 ccsymbols=`$cat ccsym.own`
19006 ccsymbols=`echo $ccsymbols`
19007 $test "$silent" || sleep 1
19008 fi
19009fi
b4eb6b3d
JH
19010
19011: see if this is a termio system
19012val="$undef"
19013val2="$undef"
19014val3="$undef"
19015if $test `./findhdr termios.h`; then
19016 set tcsetattr i_termios
19017 eval $inlibc
19018 val3="$i_termios"
19019fi
19020echo " "
19021case "$val3" in
19022"$define") echo "You have POSIX termios.h... good!" >&4;;
19023*) if ./Cppsym pyr; then
19024 case "`/bin/universe`" in
19025 ucb) if $test `./findhdr sgtty.h`; then
19026 val2="$define"
19027 echo "<sgtty.h> found." >&4
19028 else
19029 echo "System is pyramid with BSD universe."
19030 echo "<sgtty.h> not found--you could have problems." >&4
19031 fi;;
19032 *) if $test `./findhdr termio.h`; then
19033 val="$define"
19034 echo "<termio.h> found." >&4
19035 else
19036 echo "System is pyramid with USG universe."
19037 echo "<termio.h> not found--you could have problems." >&4
19038 fi;;
19039 esac
19040 elif ./usg; then
19041 if $test `./findhdr termio.h`; then
19042 echo "<termio.h> found." >&4
19043 val="$define"
19044 elif $test `./findhdr sgtty.h`; then
19045 echo "<sgtty.h> found." >&4
19046 val2="$define"
19047 else
19048echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19049 fi
19050 else
19051 if $test `./findhdr sgtty.h`; then
19052 echo "<sgtty.h> found." >&4
19053 val2="$define"
19054 elif $test `./findhdr termio.h`; then
19055 echo "<termio.h> found." >&4
19056 val="$define"
19057 else
19058echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19059 fi
19060 fi;;
19061esac
19062set i_termio; eval $setvar
19063val=$val2; set i_sgtty; eval $setvar
19064val=$val3; set i_termios; eval $setvar
19065
b4eb6b3d
JH
19066: see if stddef is available
19067set stddef.h i_stddef
19068eval $inhdr
923fc586 19069
b4eb6b3d
JH
19070: see if this is a sunmath.h system
19071set sunmath.h i_sunmath
19072eval $inhdr
5f80c64f 19073
b4eb6b3d
JH
19074: see if sys/access.h is available
19075set sys/access.h i_sysaccess
19076eval $inhdr
19077
19078: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19079set sys/filio.h i_sysfilio
19080eval $inhdr
19081echo " "
19082if $test `./findhdr sys/ioctl.h`; then
19083 val="$define"
19084 echo '<sys/ioctl.h> found.' >&4
19085else
19086 val="$undef"
19087 if $test $i_sysfilio = "$define"; then
19088 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 19089 else
b4eb6b3d
JH
19090 $test $i_sgtty = "$define" && xxx="sgtty.h"
19091 $test $i_termio = "$define" && xxx="termio.h"
19092 $test $i_termios = "$define" && xxx="termios.h"
19093echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19094 fi
19095fi
19096set i_sysioctl
19097eval $setvar
19098
49a78c82
JH
19099: see if socket ioctl defs are in sys/sockio.h
19100echo " "
19101xxx=`./findhdr sys/sockio.h`
19102if $test "$xxx"; then
19103 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19104 val="$define"
19105 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19106 else
19107 val="$undef"
19108 echo "No socket ioctls found in <sys/sockio.h>." >&4
19109 fi
19110else
19111 val="$undef"
19112 $cat <<EOM
19113<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19114EOM
19115fi
19116set i_syssockio
19117eval $setvar
19118
b4eb6b3d
JH
19119
19120: see if this is a syslog.h system
19121set syslog.h i_syslog
19122eval $inhdr
19123
19124
19125: see if this is a sys/mode.h system
19126set sys/mode.h i_sysmode
19127eval $inhdr
19128
19129: see if sys/resource.h has to be included
19130set sys/resource.h i_sysresrc
19131eval $inhdr
19132
19133: see if sys/security.h is available
19134set sys/security.h i_syssecrt
19135eval $inhdr
19136
19137: see if this is a sys/statvfs.h system
19138set sys/statvfs.h i_sysstatvfs
19139eval $inhdr
19140
b4eb6b3d
JH
19141: see if this is a sys/un.h system
19142set sys/un.h i_sysun
19143eval $inhdr
19144
19145
19146: see if this is a sys/utsname.h system
19147set sys/utsname.h i_sysutsname
19148eval $inhdr
19149
19150: see if this is a syswait system
19151set sys/wait.h i_syswait
19152eval $inhdr
19153
19154: see if this is a ustat.h system
19155set ustat.h i_ustat
19156eval $inhdr
19157
19158: see if this is an utime system
19159set utime.h i_utime
19160eval $inhdr
19161
19162: see if this is a values.h system
19163set values.h i_values
19164eval $inhdr
19165
19166: see if this is a vfork system
19167case "$d_vfork" in
19168"$define")
19169 set vfork.h i_vfork
19170 eval $inhdr
19171 ;;
19172*)
19173 i_vfork="$undef"
19174 ;;
19175esac
19176
19177: see if gdbm.h is available
19178set gdbm.h t_gdbm
19179eval $inhdr
19180case "$t_gdbm" in
19181$define)
19182 : see if gdbm_open exists
19183 set gdbm_open d_gdbm_open
19184 eval $inlibc
19185 case "$d_gdbm_open" in
19186 $undef)
19187 t_gdbm="$undef"
19188 echo "We won't be including <gdbm.h>"
5f80c64f 19189 ;;
b4eb6b3d
JH
19190 esac
19191 ;;
19192esac
19193val="$t_gdbm"
19194set i_gdbm
19195eval $setvar
19196
19197echo " "
19198echo "Looking for extensions..." >&4
19199: If we are using the old config.sh, known_extensions may contain
19200: old or inaccurate or duplicate values.
19201known_extensions=''
19202nonxs_extensions=''
19203: We do not use find because it might not be available.
19204: We do not just use MANIFEST because the user may have dropped
19205: some additional extensions into the source tree and expect them
19206: to be built.
19207
19208: Function to recursively find available extensions, ignoring DynaLoader
19209: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19210find_extensions='
19211 for xxx in *; do
19212 case "$xxx" in
19213 DynaLoader|dynaload) ;;
19214 *)
19215 if $test -f $xxx/$xxx.xs; then
19216 known_extensions="$known_extensions $1$xxx";
19217 elif $test -f $xxx/Makefile.PL; then
19218 nonxs_extensions="$nonxs_extensions $1$xxx";
19219 else
19220 if $test -d $xxx -a $# -lt 10; then
19221 set $1$xxx/ $*;
6904989c 19222 cd "$xxx";
b4eb6b3d
JH
19223 eval $find_extensions;
19224 cd ..;
19225 shift;
19226 fi;
19227 fi
19228 ;;
19229 esac;
19230 done'
19231tdir=`pwd`
6904989c 19232cd "$rsrc/ext"
b4eb6b3d
JH
19233set X
19234shift
19235eval $find_extensions
4e1a6d26
AD
19236# Special case: Add in threads/shared since it is not picked up by the
19237# recursive find above (and adding in general recursive finding breaks
19238# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 19239known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
19240set X $nonxs_extensions
19241shift
19242nonxs_extensions="$*"
19243set X $known_extensions
19244shift
19245known_extensions="$*"
6904989c 19246cd "$tdir"
b4eb6b3d
JH
19247
19248: Now see which are supported on this system.
19249avail_ext=''
19250for xxx in $known_extensions ; do
19251 case "$xxx" in
19252 DB_File|db_file)
19253 case "$i_db" in
19254 $define) avail_ext="$avail_ext $xxx" ;;
19255 esac
19256 ;;
19257 GDBM_File|gdbm_fil)
19258 case "$i_gdbm" in
19259 $define) avail_ext="$avail_ext $xxx" ;;
19260 esac
19261 ;;
1d59c593 19262 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
19263 case "$i_langinfo$d_nl_langinfo" in
19264 $define$define) avail_ext="$avail_ext $xxx" ;;
19265 esac
19266 ;;
b4eb6b3d
JH
19267 NDBM_File|ndbm_fil)
19268 case "$i_ndbm" in
19269 $define)
19270 case "$osname-$use64bitint" in
252f4fb1 19271 cygwin-*|hpux-define)
b4eb6b3d
JH
19272 case "$libs" in
19273 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19274 esac
19275 ;;
19276 *) avail_ext="$avail_ext $xxx" ;;
19277 esac
19278 ;;
19279 esac
19280 ;;
19281 ODBM_File|odbm_fil)
19282 case "${i_dbm}${i_rpcsvcdbm}" in
19283 *"${define}"*)
19284 case "$osname-$use64bitint" in
252f4fb1 19285 cygwin-*|hpux-define)
b4eb6b3d
JH
19286 case "$libs" in
19287 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19288 esac
19289 ;;
19290 *) avail_ext="$avail_ext $xxx" ;;
19291 esac
19292 ;;
19293 esac
19294 ;;
19295 POSIX|posix)
19296 case "$useposix" in
19297 true|define|y) avail_ext="$avail_ext $xxx" ;;
19298 esac
19299 ;;
19300 Opcode|opcode)
19301 case "$useopcode" in
19302 true|define|y) avail_ext="$avail_ext $xxx" ;;
19303 esac
19304 ;;
19305 Socket|socket)
19306 case "$d_socket" in
4a9f028c
JH
19307 true|$define|y)
19308 case "$osname" in
19309 beos) ;; # not unless BONE
19310 *) avail_ext="$avail_ext $xxx" ;;
19311 esac
19312 ;;
b4eb6b3d
JH
19313 esac
19314 ;;
19315 Sys/Syslog|sys/syslog)
19316 : XXX syslog requires socket
19317 case "$d_socket" in
19318 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19319 esac
19320 ;;
19321 Thread|thread)
b00ec89b
AB
19322 case "$usethreads" in
19323 true|$define|y)
19324 case "$useithreads" in
19325 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19326 esac
b4eb6b3d
JH
19327 esac
19328 ;;
7deadc5f 19329 threads|threads/shared)
73e09c8f
JH
19330 # threads and threads::shared are special cases.
19331 # To stop people from asking "Perl 5.8.0 was supposed
19332 # to have this new fancy threads implementation but my
19333 # perl doesn't have it" and from people trying to
19334 # (re)install the threads module using CPAN.pm and
19335 # CPAN.pm then offering to reinstall Perl 5.8.0,
19336 # the threads.pm and threads/shared.pm will always be
19337 # there, croaking informatively ("you need to rebuild
19338 # all of Perl with threads, sorry") when threads haven't
19339 # been compiled in.
19340 # --jhi
19341 avail_ext="$avail_ext $xxx"
1dca008a 19342 ;;
b4eb6b3d
JH
19343 IPC/SysV|ipc/sysv)
19344 : XXX Do we need a useipcsysv variable here
19345 case "${d_msg}${d_sem}${d_shm}" in
19346 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19347 esac
19348 ;;
19349 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
19350 ;;
19351 esac
b4eb6b3d 19352done
5f80c64f 19353
b4eb6b3d
JH
19354set X $avail_ext
19355shift
19356avail_ext="$*"
5f80c64f 19357
b4eb6b3d
JH
19358: Now see which nonxs extensions are supported on this system.
19359: For now assume all are.
19360nonxs_ext=''
19361for xxx in $nonxs_extensions ; do
19362 case "$xxx" in
19363 *) nonxs_ext="$nonxs_ext $xxx"
19364 ;;
19365 esac
19366done
5f80c64f 19367
b4eb6b3d
JH
19368set X $nonxs_ext
19369shift
19370nonxs_ext="$*"
19371
19372case $usedl in
19373$define)
19374 $cat <<EOM
19375A number of extensions are supplied with $package. You may choose to
19376compile these extensions for dynamic loading (the default), compile
19377them into the $package executable (static loading), or not include
19378them at all. Answer "none" to include no extensions.
19379Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
19380
19381EOM
b4eb6b3d
JH
19382 case "$dynamic_ext" in
19383 '') dflt="$avail_ext" ;;
19384 *) dflt="$dynamic_ext"
19385 # Perhaps we are reusing an old out-of-date config.sh.
19386 case "$hint" in
19387 previous)
19388 if test X"$dynamic_ext" != X"$avail_ext"; then
19389 $cat <<EOM
19390NOTICE: Your previous config.sh list may be incorrect.
19391The extensions now available to you are
19392 ${avail_ext}
19393but the default list from your previous config.sh is
19394 ${dynamic_ext}
9c839522 19395
b4eb6b3d
JH
19396EOM
19397 fi
9c839522
PM
19398 ;;
19399 esac
b4eb6b3d
JH
19400 ;;
19401 esac
5f80c64f 19402 case "$dflt" in
b4eb6b3d
JH
19403 '') dflt=none;;
19404 esac
19405 rp="What extensions do you wish to load dynamically?"
19406 . ./myread
19407 case "$ans" in
19408 none) dynamic_ext=' ' ;;
19409 *) dynamic_ext="$ans" ;;
5f80c64f 19410 esac
5f80c64f 19411
b4eb6b3d
JH
19412 case "$static_ext" in
19413 '')
19414 : Exclude those already listed in dynamic linking
19415 dflt=''
19416 for xxx in $avail_ext; do
19417 case " $dynamic_ext " in
19418 *" $xxx "*) ;;
19419 *) dflt="$dflt $xxx" ;;
19420 esac
19421 done
19422 set X $dflt
19423 shift
19424 dflt="$*"
19425 ;;
19426 *) dflt="$static_ext"
19427 ;;
19428 esac
9c839522 19429
b4eb6b3d
JH
19430 case "$dflt" in
19431 '') dflt=none;;
19432 esac
19433 rp="What extensions do you wish to load statically?"
19434 . ./myread
19435 case "$ans" in
19436 none) static_ext=' ' ;;
19437 *) static_ext="$ans" ;;
19438 esac
19439 ;;
19440*)
19441 $cat <<EOM
19442A number of extensions are supplied with $package. Answer "none"
19443to include no extensions.
19444Note that DynaLoader is always built and need not be mentioned here.
9c839522 19445
b4eb6b3d
JH
19446EOM
19447 case "$static_ext" in
19448 '') dflt="$avail_ext" ;;
19449 *) dflt="$static_ext"
19450 # Perhaps we are reusing an old out-of-date config.sh.
19451 case "$hint" in
19452 previous)
19453 if test X"$static_ext" != X"$avail_ext"; then
19454 $cat <<EOM
19455NOTICE: Your previous config.sh list may be incorrect.
19456The extensions now available to you are
19457 ${avail_ext}
19458but the default list from your previous config.sh is
19459 ${static_ext}
5f80c64f
JH
19460
19461EOM
b4eb6b3d
JH
19462 fi
19463 ;;
19464 esac
19465 ;;
19466 esac
19467 : Exclude those that are not xs extensions
19468 case "$dflt" in
19469 '') dflt=none;;
19470 esac
19471 rp="What extensions do you wish to include?"
19472 . ./myread
19473 case "$ans" in
19474 none) static_ext=' ' ;;
19475 *) static_ext="$ans" ;;
19476 esac
19477 ;;
5f80c64f 19478esac
f1f6834f
AD
19479#
19480# Encode is a special case. If we are building Encode as a static
19481# extension, we need to explicitly list its subextensions as well.
19482# For other nested extensions, this is handled automatically by
19483# the appropriate Makefile.PL.
19484case " $static_ext " in
19485 *" Encode "*) # Add the subextensions of Encode
19486 cd "$rsrc/ext"
19487 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19488 static_ext="$static_ext Encode/$xxx"
19489 done
19490 cd "$tdir"
19491 ;;
19492esac
5f80c64f 19493
b4eb6b3d
JH
19494set X $dynamic_ext $static_ext $nonxs_ext
19495shift
19496extensions="$*"
19497
9c839522
PM
19498: Remove libraries needed only for extensions
19499: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
19500: The exception is SunOS 4.x, which needs them.
19501case "${osname}X${osvers}" in
19502sunos*X4*)
19503 perllibs="$libs"
19504 ;;
19505*) case "$usedl" in
19506 $define|true|[yY]*)
19507 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
19508 shift
19509 perllibs="$*"
19510 ;;
19511 *) perllibs="$libs"
19512 ;;
19513 esac
19514 ;;
9c839522 19515esac
5f80c64f
JH
19516
19517: Remove build directory name from cppstdin so it can be used from
19518: either the present location or the final installed location.
19519echo " "
19520: Get out of the UU directory to get correct path name.
19521cd ..
19522case "$cppstdin" in
19523`pwd`/cppstdin)
19524 echo "Stripping down cppstdin path name"
19525 cppstdin=cppstdin
19526 ;;
19527esac
19528cd UU
19529
19530: end of configuration questions
19531echo " "
19532echo "End of configuration questions."
19533echo " "
19534
19535: back to where it started
19536if test -d ../UU; then
19537 cd ..
19538fi
19539
48370efc
JH
19540: configuration may be patched via a 'config.arch' file
19541if $test -f config.arch; then
19542 echo "I see a config.arch file, loading it."
19543 . ./config.arch
19544fi
19545
5f80c64f
JH
19546: configuration may be patched via a 'config.over' file
19547if $test -f config.over; then
19548 echo " "
19549 dflt=y
19550 rp='I see a config.over file. Do you wish to load it?'
19551 . UU/myread
19552 case "$ans" in
19553 n*) echo "OK, I'll ignore it.";;
19554 *) . ./config.over
19555 echo "Configuration override changes have been loaded."
19556 ;;
19557 esac
19558fi
19559
19560: in case they want portability, strip down executable paths
19561case "$d_portable" in
19562"$define")
19563 echo " "
19564 echo "Stripping down executable paths..." >&4
19565 for file in $loclist $trylist; do
534ac15a
JH
19566 eval temp=\$$file
19567 eval $file=`basename $temp`
5f80c64f
JH
19568 done
19569 ;;
19570esac
19571
19572: create config.sh file
19573echo " "
19574echo "Creating config.sh..." >&4
19575$spitshell <<EOT >config.sh
19576$startsh
19577#
19578# This file was produced by running the Configure script. It holds all the
19579# definitions figured out by Configure. Should you modify one of these values,
19580# do not forget to propagate your changes by running "Configure -der". You may
19581# instead choose to run each of the .SH files by yourself, or "Configure -S".
19582#
19583
19584# Package name : $package
19585# Source directory : $src
19586# Configuration time: $cf_time
19587# Configured by : $cf_by
19588# Target system : $myuname
19589
19590Author='$Author'
19591Date='$Date'
19592Header='$Header'
19593Id='$Id'
19594Locker='$Locker'
19595Log='$Log'
19596Mcc='$Mcc'
19597RCSfile='$RCSfile'
19598Revision='$Revision'
19599Source='$Source'
19600State='$State'
19601_a='$_a'
19602_exe='$_exe'
19603_o='$_o'
b4eb6b3d 19604afs='$afs'
a6d26a0d 19605afsroot='$afsroot'
b4eb6b3d
JH
19606alignbytes='$alignbytes'
19607ansi2knr='$ansi2knr'
19608aphostname='$aphostname'
19609api_revision='$api_revision'
19610api_subversion='$api_subversion'
19611api_version='$api_version'
19612api_versionstring='$api_versionstring'
5f80c64f 19613ar='$ar'
b4eb6b3d
JH
19614archlib='$archlib'
19615archlibexp='$archlibexp'
19616archname64='$archname64'
19617archname='$archname'
5f80c64f 19618archobjs='$archobjs'
10bc17b6 19619asctime_r_proto='$asctime_r_proto'
5f80c64f 19620awk='$awk'
b4eb6b3d 19621baserev='$baserev'
5f80c64f 19622bash='$bash'
b4eb6b3d
JH
19623bin='$bin'
19624bincompat5005='$bincompat5005'
19625binexp='$binexp'
5f80c64f
JH
19626bison='$bison'
19627byacc='$byacc'
b4eb6b3d 19628byteorder='$byteorder'
5f80c64f 19629c='$c'
b4eb6b3d 19630castflags='$castflags'
5f80c64f
JH
19631cat='$cat'
19632cc='$cc'
19633cccdlflags='$cccdlflags'
19634ccdlflags='$ccdlflags'
19635ccflags='$ccflags'
b4eb6b3d 19636ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 19637ccname='$ccname'
b4eb6b3d 19638ccsymbols='$ccsymbols'
6b356c8e 19639ccversion='$ccversion'
5f80c64f 19640cf_by='$cf_by'
b4eb6b3d 19641cf_email='$cf_email'
5f80c64f 19642cf_time='$cf_time'
b4eb6b3d 19643charsize='$charsize'
5f80c64f
JH
19644chgrp='$chgrp'
19645chmod='$chmod'
19646chown='$chown'
b4eb6b3d 19647clocktype='$clocktype'
5f80c64f
JH
19648comm='$comm'
19649compress='$compress'
19650contains='$contains'
19651cp='$cp'
19652cpio='$cpio'
19653cpp='$cpp'
b4eb6b3d
JH
19654cpp_stuff='$cpp_stuff'
19655cppccsymbols='$cppccsymbols'
5f80c64f
JH
19656cppflags='$cppflags'
19657cpplast='$cpplast'
19658cppminus='$cppminus'
19659cpprun='$cpprun'
19660cppstdin='$cppstdin'
b4eb6b3d 19661cppsymbols='$cppsymbols'
10bc17b6 19662crypt_r_proto='$crypt_r_proto'
b4eb6b3d 19663cryptlib='$cryptlib'
5f80c64f 19664csh='$csh'
10bc17b6
JH
19665ctermid_r_proto='$ctermid_r_proto'
19666ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
19667d_Gconvert='$d_Gconvert'
19668d_PRIEUldbl='$d_PRIEUldbl'
19669d_PRIFUldbl='$d_PRIFUldbl'
19670d_PRIGUldbl='$d_PRIGUldbl'
19671d_PRIXU64='$d_PRIXU64'
19672d_PRId64='$d_PRId64'
19673d_PRIeldbl='$d_PRIeldbl'
19674d_PRIfldbl='$d_PRIfldbl'
19675d_PRIgldbl='$d_PRIgldbl'
19676d_PRIi64='$d_PRIi64'
19677d_PRIo64='$d_PRIo64'
19678d_PRIu64='$d_PRIu64'
19679d_PRIx64='$d_PRIx64'
19680d_SCNfldbl='$d_SCNfldbl'
74cac757 19681d__fwalk='$d__fwalk'
b4eb6b3d
JH
19682d_access='$d_access'
19683d_accessx='$d_accessx'
19684d_alarm='$d_alarm'
19685d_archlib='$d_archlib'
10bc17b6 19686d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
19687d_atolf='$d_atolf'
19688d_atoll='$d_atoll'
19689d_attribut='$d_attribut'
19690d_bcmp='$d_bcmp'
19691d_bcopy='$d_bcopy'
19692d_bincompat5005='$d_bincompat5005'
5f80c64f 19693d_bsd='$d_bsd'
b4eb6b3d
JH
19694d_bsdgetpgrp='$d_bsdgetpgrp'
19695d_bsdsetpgrp='$d_bsdsetpgrp'
19696d_bzero='$d_bzero'
19697d_casti32='$d_casti32'
19698d_castneg='$d_castneg'
19699d_charvspr='$d_charvspr'
19700d_chown='$d_chown'
19701d_chroot='$d_chroot'
19702d_chsize='$d_chsize'
758a5d79 19703d_class='$d_class'
b4eb6b3d 19704d_closedir='$d_closedir'
4e0554ec 19705d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
19706d_const='$d_const'
19707d_crypt='$d_crypt'
10bc17b6 19708d_crypt_r='$d_crypt_r'
b4eb6b3d 19709d_csh='$d_csh'
10bc17b6
JH
19710d_ctermid_r='$d_ctermid_r'
19711d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
19712d_cuserid='$d_cuserid'
19713d_dbl_dig='$d_dbl_dig'
2ef53570 19714d_dbminitproto='$d_dbminitproto'
b4eb6b3d 19715d_difftime='$d_difftime'
ae0e3d3b 19716d_dirfd='$d_dirfd'
b4eb6b3d
JH
19717d_dirnamlen='$d_dirnamlen'
19718d_dlerror='$d_dlerror'
5f80c64f 19719d_dlopen='$d_dlopen'
b4eb6b3d
JH
19720d_dlsymun='$d_dlsymun'
19721d_dosuid='$d_dosuid'
10bc17b6 19722d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
19723d_drand48proto='$d_drand48proto'
19724d_dup2='$d_dup2'
19725d_eaccess='$d_eaccess'
19726d_endgrent='$d_endgrent'
10bc17b6 19727d_endgrent_r='$d_endgrent_r'
b4eb6b3d 19728d_endhent='$d_endhent'
10bc17b6 19729d_endhostent_r='$d_endhostent_r'
b4eb6b3d 19730d_endnent='$d_endnent'
10bc17b6 19731d_endnetent_r='$d_endnetent_r'
b4eb6b3d 19732d_endpent='$d_endpent'
10bc17b6 19733d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 19734d_endpwent='$d_endpwent'
10bc17b6 19735d_endpwent_r='$d_endpwent_r'
b4eb6b3d 19736d_endsent='$d_endsent'
10bc17b6 19737d_endservent_r='$d_endservent_r'
b4eb6b3d 19738d_eofnblk='$d_eofnblk'
5f80c64f 19739d_eunice='$d_eunice'
b363b713 19740d_fchdir='$d_fchdir'
b4eb6b3d
JH
19741d_fchmod='$d_fchmod'
19742d_fchown='$d_fchown'
19743d_fcntl='$d_fcntl'
9d9004a9 19744d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
19745d_fd_macros='$d_fd_macros'
19746d_fd_set='$d_fd_set'
19747d_fds_bits='$d_fds_bits'
19748d_fgetpos='$d_fgetpos'
758a5d79
JH
19749d_finite='$d_finite'
19750d_finitel='$d_finitel'
b4eb6b3d
JH
19751d_flexfnam='$d_flexfnam'
19752d_flock='$d_flock'
2ef53570 19753d_flockproto='$d_flockproto'
b4eb6b3d 19754d_fork='$d_fork'
758a5d79 19755d_fp_class='$d_fp_class'
b4eb6b3d 19756d_fpathconf='$d_fpathconf'
758a5d79
JH
19757d_fpclass='$d_fpclass'
19758d_fpclassify='$d_fpclassify'
19759d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
19760d_fpos64_t='$d_fpos64_t'
19761d_frexpl='$d_frexpl'
19762d_fs_data_s='$d_fs_data_s'
19763d_fseeko='$d_fseeko'
19764d_fsetpos='$d_fsetpos'
19765d_fstatfs='$d_fstatfs'
19766d_fstatvfs='$d_fstatvfs'
411ab01c 19767d_fsync='$d_fsync'
b4eb6b3d
JH
19768d_ftello='$d_ftello'
19769d_ftime='$d_ftime'
19770d_getcwd='$d_getcwd'
19771d_getespwnam='$d_getespwnam'
19772d_getfsstat='$d_getfsstat'
19773d_getgrent='$d_getgrent'
10bc17b6
JH
19774d_getgrent_r='$d_getgrent_r'
19775d_getgrgid_r='$d_getgrgid_r'
19776d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
19777d_getgrps='$d_getgrps'
19778d_gethbyaddr='$d_gethbyaddr'
19779d_gethbyname='$d_gethbyname'
19780d_gethent='$d_gethent'
19781d_gethname='$d_gethname'
10bc17b6
JH
19782d_gethostbyaddr_r='$d_gethostbyaddr_r'
19783d_gethostbyname_r='$d_gethostbyname_r'
19784d_gethostent_r='$d_gethostent_r'
b4eb6b3d 19785d_gethostprotos='$d_gethostprotos'
4e0554ec 19786d_getitimer='$d_getitimer'
b4eb6b3d 19787d_getlogin='$d_getlogin'
10bc17b6 19788d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
19789d_getmnt='$d_getmnt'
19790d_getmntent='$d_getmntent'
19791d_getnbyaddr='$d_getnbyaddr'
19792d_getnbyname='$d_getnbyname'
19793d_getnent='$d_getnent'
10bc17b6
JH
19794d_getnetbyaddr_r='$d_getnetbyaddr_r'
19795d_getnetbyname_r='$d_getnetbyname_r'
19796d_getnetent_r='$d_getnetent_r'
b4eb6b3d 19797d_getnetprotos='$d_getnetprotos'
0c0643d0 19798d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
19799d_getpbyname='$d_getpbyname'
19800d_getpbynumber='$d_getpbynumber'
19801d_getpent='$d_getpent'
19802d_getpgid='$d_getpgid'
19803d_getpgrp2='$d_getpgrp2'
19804d_getpgrp='$d_getpgrp'
19805d_getppid='$d_getppid'
19806d_getprior='$d_getprior'
10bc17b6
JH
19807d_getprotobyname_r='$d_getprotobyname_r'
19808d_getprotobynumber_r='$d_getprotobynumber_r'
19809d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
19810d_getprotoprotos='$d_getprotoprotos'
19811d_getprpwnam='$d_getprpwnam'
19812d_getpwent='$d_getpwent'
10bc17b6
JH
19813d_getpwent_r='$d_getpwent_r'
19814d_getpwnam_r='$d_getpwnam_r'
19815d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
19816d_getsbyname='$d_getsbyname'
19817d_getsbyport='$d_getsbyport'
19818d_getsent='$d_getsent'
10bc17b6
JH
19819d_getservbyname_r='$d_getservbyname_r'
19820d_getservbyport_r='$d_getservbyport_r'
19821d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
19822d_getservprotos='$d_getservprotos'
19823d_getspnam='$d_getspnam'
10bc17b6 19824d_getspnam_r='$d_getspnam_r'
b4eb6b3d 19825d_gettimeod='$d_gettimeod'
10bc17b6 19826d_gmtime_r='$d_gmtime_r'
5f80c64f 19827d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
19828d_grpasswd='$d_grpasswd'
19829d_hasmntopt='$d_hasmntopt'
19830d_htonl='$d_htonl'
b4eb6b3d
JH
19831d_index='$d_index'
19832d_inetaton='$d_inetaton'
19833d_int64_t='$d_int64_t'
19834d_isascii='$d_isascii'
758a5d79
JH
19835d_isfinite='$d_isfinite'
19836d_isinf='$d_isinf'
b4eb6b3d
JH
19837d_isnan='$d_isnan'
19838d_isnanl='$d_isnanl'
19839d_killpg='$d_killpg'
19840d_lchown='$d_lchown'
19841d_ldbl_dig='$d_ldbl_dig'
19842d_link='$d_link'
10bc17b6 19843d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
19844d_locconv='$d_locconv'
19845d_lockf='$d_lockf'
19846d_longdbl='$d_longdbl'
19847d_longlong='$d_longlong'
19848d_lseekproto='$d_lseekproto'
19849d_lstat='$d_lstat'
19850d_madvise='$d_madvise'
19851d_mblen='$d_mblen'
19852d_mbstowcs='$d_mbstowcs'
19853d_mbtowc='$d_mbtowc'
19854d_memchr='$d_memchr'
19855d_memcmp='$d_memcmp'
19856d_memcpy='$d_memcpy'
19857d_memmove='$d_memmove'
19858d_memset='$d_memset'
19859d_mkdir='$d_mkdir'
19860d_mkdtemp='$d_mkdtemp'
19861d_mkfifo='$d_mkfifo'
19862d_mkstemp='$d_mkstemp'
19863d_mkstemps='$d_mkstemps'
19864d_mktime='$d_mktime'
19865d_mmap='$d_mmap'
19866d_modfl='$d_modfl'
e67aeab1 19867d_modfl_pow32_bug='$d_modfl_pow32_bug'
b4eb6b3d
JH
19868d_mprotect='$d_mprotect'
19869d_msg='$d_msg'
19870d_msg_ctrunc='$d_msg_ctrunc'
19871d_msg_dontroute='$d_msg_dontroute'
19872d_msg_oob='$d_msg_oob'
19873d_msg_peek='$d_msg_peek'
19874d_msg_proxy='$d_msg_proxy'
19875d_msgctl='$d_msgctl'
19876d_msgget='$d_msgget'
4e0554ec 19877d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
19878d_msgrcv='$d_msgrcv'
19879d_msgsnd='$d_msgsnd'
19880d_msync='$d_msync'
19881d_munmap='$d_munmap'
19882d_mymalloc='$d_mymalloc'
19883d_nice='$d_nice'
2765b840 19884d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 19885d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
19886d_off64_t='$d_off64_t'
19887d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19888d_oldpthreads='$d_oldpthreads'
19889d_oldsock='$d_oldsock'
19890d_open3='$d_open3'
19891d_pathconf='$d_pathconf'
19892d_pause='$d_pause'
19893d_perl_otherlibdirs='$d_perl_otherlibdirs'
19894d_phostname='$d_phostname'
19895d_pipe='$d_pipe'
19896d_poll='$d_poll'
5f80c64f 19897d_portable='$d_portable'
c7aff470 19898d_procselfexe='$d_procselfexe'
d6483fcc 19899d_pthread_atfork='$d_pthread_atfork'
b4eb6b3d
JH
19900d_pthread_yield='$d_pthread_yield'
19901d_pwage='$d_pwage'
19902d_pwchange='$d_pwchange'
19903d_pwclass='$d_pwclass'
19904d_pwcomment='$d_pwcomment'
19905d_pwexpire='$d_pwexpire'
19906d_pwgecos='$d_pwgecos'
19907d_pwpasswd='$d_pwpasswd'
19908d_pwquota='$d_pwquota'
19909d_qgcvt='$d_qgcvt'
19910d_quad='$d_quad'
10bc17b6
JH
19911d_random_r='$d_random_r'
19912d_readdir64_r='$d_readdir64_r'
b4eb6b3d 19913d_readdir='$d_readdir'
10bc17b6 19914d_readdir_r='$d_readdir_r'
b4eb6b3d 19915d_readlink='$d_readlink'
4e0554ec
JH
19916d_readv='$d_readv'
19917d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
19918d_rename='$d_rename'
19919d_rewinddir='$d_rewinddir'
19920d_rmdir='$d_rmdir'
19921d_safebcpy='$d_safebcpy'
19922d_safemcpy='$d_safemcpy'
19923d_sanemcmp='$d_sanemcmp'
ef9f17be 19924d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
19925d_sched_yield='$d_sched_yield'
19926d_scm_rights='$d_scm_rights'
19927d_seekdir='$d_seekdir'
19928d_select='$d_select'
19929d_sem='$d_sem'
19930d_semctl='$d_semctl'
19931d_semctl_semid_ds='$d_semctl_semid_ds'
19932d_semctl_semun='$d_semctl_semun'
19933d_semget='$d_semget'
19934d_semop='$d_semop'
4e0554ec 19935d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
19936d_setegid='$d_setegid'
19937d_seteuid='$d_seteuid'
19938d_setgrent='$d_setgrent'
10bc17b6 19939d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
19940d_setgrps='$d_setgrps'
19941d_sethent='$d_sethent'
10bc17b6 19942d_sethostent_r='$d_sethostent_r'
4e0554ec 19943d_setitimer='$d_setitimer'
b4eb6b3d
JH
19944d_setlinebuf='$d_setlinebuf'
19945d_setlocale='$d_setlocale'
10bc17b6 19946d_setlocale_r='$d_setlocale_r'
b4eb6b3d 19947d_setnent='$d_setnent'
10bc17b6 19948d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
19949d_setpent='$d_setpent'
19950d_setpgid='$d_setpgid'
19951d_setpgrp2='$d_setpgrp2'
19952d_setpgrp='$d_setpgrp'
19953d_setprior='$d_setprior'
19954d_setproctitle='$d_setproctitle'
10bc17b6 19955d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 19956d_setpwent='$d_setpwent'
10bc17b6 19957d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
19958d_setregid='$d_setregid'
19959d_setresgid='$d_setresgid'
19960d_setresuid='$d_setresuid'
19961d_setreuid='$d_setreuid'
19962d_setrgid='$d_setrgid'
19963d_setruid='$d_setruid'
19964d_setsent='$d_setsent'
10bc17b6 19965d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
19966d_setsid='$d_setsid'
19967d_setvbuf='$d_setvbuf'
19968d_sfio='$d_sfio'
19969d_shm='$d_shm'
19970d_shmat='$d_shmat'
19971d_shmatprototype='$d_shmatprototype'
19972d_shmctl='$d_shmctl'
19973d_shmdt='$d_shmdt'
19974d_shmget='$d_shmget'
19975d_sigaction='$d_sigaction'
983dbef6 19976d_sigprocmask='$d_sigprocmask'
b4eb6b3d 19977d_sigsetjmp='$d_sigsetjmp'
49a78c82 19978d_sockatmark='$d_sockatmark'
2ef53570 19979d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
19980d_socket='$d_socket'
19981d_socklen_t='$d_socklen_t'
19982d_sockpair='$d_sockpair'
19983d_socks5_init='$d_socks5_init'
19984d_sqrtl='$d_sqrtl'
10bc17b6
JH
19985d_srand48_r='$d_srand48_r'
19986d_srandom_r='$d_srandom_r'
eef837ea 19987d_sresgproto='$d_sresgproto'
640374d0 19988d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
19989d_statblks='$d_statblks'
19990d_statfs_f_flags='$d_statfs_f_flags'
19991d_statfs_s='$d_statfs_s'
19992d_statvfs='$d_statvfs'
19993d_stdio_cnt_lval='$d_stdio_cnt_lval'
19994d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
19995d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19996d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
19997d_stdio_stream_array='$d_stdio_stream_array'
19998d_stdiobase='$d_stdiobase'
19999d_stdstdio='$d_stdstdio'
20000d_strchr='$d_strchr'
20001d_strcoll='$d_strcoll'
20002d_strctcpy='$d_strctcpy'
20003d_strerrm='$d_strerrm'
20004d_strerror='$d_strerror'
10bc17b6 20005d_strerror_r='$d_strerror_r'
b3c85772 20006d_strftime='$d_strftime'
b4eb6b3d
JH
20007d_strtod='$d_strtod'
20008d_strtol='$d_strtol'
20009d_strtold='$d_strtold'
20010d_strtoll='$d_strtoll'
28e5dec8 20011d_strtoq='$d_strtoq'
b4eb6b3d
JH
20012d_strtoul='$d_strtoul'
20013d_strtoull='$d_strtoull'
20014d_strtouq='$d_strtouq'
20015d_strxfrm='$d_strxfrm'
20016d_suidsafe='$d_suidsafe'
20017d_symlink='$d_symlink'
20018d_syscall='$d_syscall'
2ef53570 20019d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
20020d_sysconf='$d_sysconf'
20021d_sysernlst='$d_sysernlst'
20022d_syserrlst='$d_syserrlst'
20023d_system='$d_system'
20024d_tcgetpgrp='$d_tcgetpgrp'
20025d_tcsetpgrp='$d_tcsetpgrp'
20026d_telldir='$d_telldir'
20027d_telldirproto='$d_telldirproto'
20028d_time='$d_time'
20029d_times='$d_times'
14b90194
JH
20030d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20031d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 20032d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 20033d_truncate='$d_truncate'
10bc17b6 20034d_ttyname_r='$d_ttyname_r'
b4eb6b3d 20035d_tzname='$d_tzname'
4e0554ec
JH
20036d_u32align='$d_u32align'
20037d_ualarm='$d_ualarm'
b4eb6b3d
JH
20038d_umask='$d_umask'
20039d_uname='$d_uname'
20040d_union_semun='$d_union_semun'
758a5d79 20041d_unordered='$d_unordered'
4e0554ec 20042d_usleep='$d_usleep'
2ef53570 20043d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
20044d_ustat='$d_ustat'
20045d_vendorarch='$d_vendorarch'
20046d_vendorbin='$d_vendorbin'
20047d_vendorlib='$d_vendorlib'
20048d_vfork='$d_vfork'
20049d_void_closedir='$d_void_closedir'
20050d_voidsig='$d_voidsig'
20051d_voidtty='$d_voidtty'
20052d_volatile='$d_volatile'
20053d_vprintf='$d_vprintf'
20054d_wait4='$d_wait4'
20055d_waitpid='$d_waitpid'
20056d_wcstombs='$d_wcstombs'
20057d_wctomb='$d_wctomb'
4e0554ec 20058d_writev='$d_writev'
5f80c64f
JH
20059d_xenix='$d_xenix'
20060date='$date'
b4eb6b3d
JH
20061db_hashtype='$db_hashtype'
20062db_prefixtype='$db_prefixtype'
640374d0
JH
20063db_version_major='$db_version_major'
20064db_version_minor='$db_version_minor'
20065db_version_patch='$db_version_patch'
b4eb6b3d
JH
20066defvoidused='$defvoidused'
20067direntrytype='$direntrytype'
20068dlext='$dlext'
5f80c64f 20069dlsrc='$dlsrc'
b4eb6b3d
JH
20070doublesize='$doublesize'
20071drand01='$drand01'
10bc17b6 20072drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
20073dynamic_ext='$dynamic_ext'
20074eagain='$eagain'
20075ebcdic='$ebcdic'
5f80c64f
JH
20076echo='$echo'
20077egrep='$egrep'
20078emacs='$emacs'
10bc17b6
JH
20079endgrent_r_proto='$endgrent_r_proto'
20080endhostent_r_proto='$endhostent_r_proto'
20081endnetent_r_proto='$endnetent_r_proto'
20082endprotoent_r_proto='$endprotoent_r_proto'
20083endpwent_r_proto='$endpwent_r_proto'
20084endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
20085eunicefix='$eunicefix'
20086exe_ext='$exe_ext'
20087expr='$expr'
b4eb6b3d 20088extensions='$extensions'
6fcddf3b 20089extras='$extras'
b4eb6b3d
JH
20090fflushNULL='$fflushNULL'
20091fflushall='$fflushall'
5f80c64f
JH
20092find='$find'
20093firstmakefile='$firstmakefile'
20094flex='$flex'
b4eb6b3d
JH
20095fpossize='$fpossize'
20096fpostype='$fpostype'
20097freetype='$freetype'
5440bc8e 20098from='$from'
b4eb6b3d
JH
20099full_ar='$full_ar'
20100full_csh='$full_csh'
20101full_sed='$full_sed'
5b463ca7 20102gccosandvers='$gccosandvers'
5f80c64f 20103gccversion='$gccversion'
10bc17b6
JH
20104getgrent_r_proto='$getgrent_r_proto'
20105getgrgid_r_proto='$getgrgid_r_proto'
20106getgrnam_r_proto='$getgrnam_r_proto'
20107gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20108gethostbyname_r_proto='$gethostbyname_r_proto'
20109gethostent_r_proto='$gethostent_r_proto'
20110getlogin_r_proto='$getlogin_r_proto'
20111getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20112getnetbyname_r_proto='$getnetbyname_r_proto'
20113getnetent_r_proto='$getnetent_r_proto'
20114getprotobyname_r_proto='$getprotobyname_r_proto'
20115getprotobynumber_r_proto='$getprotobynumber_r_proto'
20116getprotoent_r_proto='$getprotoent_r_proto'
20117getpwent_r_proto='$getpwent_r_proto'
20118getpwnam_r_proto='$getpwnam_r_proto'
20119getpwuid_r_proto='$getpwuid_r_proto'
20120getservbyname_r_proto='$getservbyname_r_proto'
20121getservbyport_r_proto='$getservbyport_r_proto'
20122getservent_r_proto='$getservent_r_proto'
20123getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
20124gidformat='$gidformat'
20125gidsign='$gidsign'
20126gidsize='$gidsize'
20127gidtype='$gidtype'
5f80c64f 20128glibpth='$glibpth'
3c728e00 20129gmake='$gmake'
10bc17b6 20130gmtime_r_proto='$gmtime_r_proto'
5f80c64f 20131grep='$grep'
b4eb6b3d
JH
20132groupcat='$groupcat'
20133groupstype='$groupstype'
5f80c64f 20134gzip='$gzip'
b4eb6b3d
JH
20135h_fcntl='$h_fcntl'
20136h_sysfile='$h_sysfile'
5f80c64f 20137hint='$hint'
b4eb6b3d
JH
20138hostcat='$hostcat'
20139i16size='$i16size'
20140i16type='$i16type'
20141i32size='$i32size'
20142i32type='$i32type'
20143i64size='$i64size'
20144i64type='$i64type'
20145i8size='$i8size'
20146i8type='$i8type'
20147i_arpainet='$i_arpainet'
20148i_bsdioctl='$i_bsdioctl'
10bc17b6 20149i_crypt='$i_crypt'
b4eb6b3d
JH
20150i_db='$i_db'
20151i_dbm='$i_dbm'
20152i_dirent='$i_dirent'
5f80c64f 20153i_dld='$i_dld'
b4eb6b3d
JH
20154i_dlfcn='$i_dlfcn'
20155i_fcntl='$i_fcntl'
20156i_float='$i_float'
758a5d79
JH
20157i_fp='$i_fp'
20158i_fp_class='$i_fp_class'
b4eb6b3d
JH
20159i_gdbm='$i_gdbm'
20160i_grp='$i_grp'
b4eb6b3d
JH
20161i_ieeefp='$i_ieeefp'
20162i_inttypes='$i_inttypes'
2765b840 20163i_langinfo='$i_langinfo'
b4eb6b3d
JH
20164i_libutil='$i_libutil'
20165i_limits='$i_limits'
20166i_locale='$i_locale'
20167i_machcthr='$i_machcthr'
20168i_malloc='$i_malloc'
20169i_math='$i_math'
20170i_memory='$i_memory'
20171i_mntent='$i_mntent'
20172i_ndbm='$i_ndbm'
20173i_netdb='$i_netdb'
20174i_neterrno='$i_neterrno'
20175i_netinettcp='$i_netinettcp'
20176i_niin='$i_niin'
20177i_poll='$i_poll'
20178i_prot='$i_prot'
20179i_pthread='$i_pthread'
20180i_pwd='$i_pwd'
20181i_rpcsvcdbm='$i_rpcsvcdbm'
20182i_sfio='$i_sfio'
20183i_sgtty='$i_sgtty'
20184i_shadow='$i_shadow'
20185i_socks='$i_socks'
20186i_stdarg='$i_stdarg'
20187i_stddef='$i_stddef'
20188i_stdlib='$i_stdlib'
20189i_string='$i_string'
20190i_sunmath='$i_sunmath'
20191i_sysaccess='$i_sysaccess'
20192i_sysdir='$i_sysdir'
20193i_sysfile='$i_sysfile'
20194i_sysfilio='$i_sysfilio'
20195i_sysin='$i_sysin'
20196i_sysioctl='$i_sysioctl'
20197i_syslog='$i_syslog'
20198i_sysmman='$i_sysmman'
20199i_sysmode='$i_sysmode'
20200i_sysmount='$i_sysmount'
20201i_sysndir='$i_sysndir'
20202i_sysparam='$i_sysparam'
20203i_sysresrc='$i_sysresrc'
20204i_syssecrt='$i_syssecrt'
20205i_sysselct='$i_sysselct'
20206i_syssockio='$i_syssockio'
20207i_sysstat='$i_sysstat'
20208i_sysstatfs='$i_sysstatfs'
20209i_sysstatvfs='$i_sysstatvfs'
20210i_systime='$i_systime'
20211i_systimek='$i_systimek'
20212i_systimes='$i_systimes'
20213i_systypes='$i_systypes'
20214i_sysuio='$i_sysuio'
20215i_sysun='$i_sysun'
20216i_sysutsname='$i_sysutsname'
20217i_sysvfs='$i_sysvfs'
20218i_syswait='$i_syswait'
20219i_termio='$i_termio'
20220i_termios='$i_termios'
20221i_time='$i_time'
20222i_unistd='$i_unistd'
20223i_ustat='$i_ustat'
20224i_utime='$i_utime'
20225i_values='$i_values'
20226i_varargs='$i_varargs'
20227i_varhdr='$i_varhdr'
20228i_vfork='$i_vfork'
5f80c64f 20229ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
20230inc_version_list='$inc_version_list'
20231inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
20232incpath='$incpath'
20233inews='$inews'
b4eb6b3d
JH
20234installarchlib='$installarchlib'
20235installbin='$installbin'
20236installman1dir='$installman1dir'
20237installman3dir='$installman3dir'
20238installprefix='$installprefix'
20239installprefixexp='$installprefixexp'
20240installprivlib='$installprivlib'
20241installscript='$installscript'
20242installsitearch='$installsitearch'
20243installsitebin='$installsitebin'
20244installsitelib='$installsitelib'
20245installstyle='$installstyle'
20246installusrbinperl='$installusrbinperl'
20247installvendorarch='$installvendorarch'
20248installvendorbin='$installvendorbin'
20249installvendorlib='$installvendorlib'
20250intsize='$intsize'
4b661809 20251issymlink='$issymlink'
b4eb6b3d
JH
20252ivdformat='$ivdformat'
20253ivsize='$ivsize'
20254ivtype='$ivtype'
20255known_extensions='$known_extensions'
5f80c64f 20256ksh='$ksh'
5f80c64f
JH
20257ld='$ld'
20258lddlflags='$lddlflags'
20259ldflags='$ldflags'
b4eb6b3d
JH
20260ldflags_uselargefiles='$ldflags_uselargefiles'
20261ldlibpthname='$ldlibpthname'
5f80c64f
JH
20262less='$less'
20263lib_ext='$lib_ext'
20264libc='$libc'
b4eb6b3d 20265libperl='$libperl'
5f80c64f
JH
20266libpth='$libpth'
20267libs='$libs'
43999f95
JH
20268libsdirs='$libsdirs'
20269libsfiles='$libsfiles'
20270libsfound='$libsfound'
13b3f787 20271libspath='$libspath'
5f80c64f 20272libswanted='$libswanted'
b4eb6b3d 20273libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
20274line='$line'
20275lint='$lint'
20276lkflags='$lkflags'
20277ln='$ln'
20278lns='$lns'
10bc17b6 20279localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
20280locincpth='$locincpth'
20281loclibpth='$loclibpth'
b4eb6b3d
JH
20282longdblsize='$longdblsize'
20283longlongsize='$longlongsize'
20284longsize='$longsize'
5f80c64f
JH
20285lp='$lp'
20286lpr='$lpr'
20287ls='$ls'
b4eb6b3d
JH
20288lseeksize='$lseeksize'
20289lseektype='$lseektype'
5f80c64f
JH
20290mail='$mail'
20291mailx='$mailx'
20292make='$make'
20293make_set_make='$make_set_make'
b4eb6b3d
JH
20294mallocobj='$mallocobj'
20295mallocsrc='$mallocsrc'
20296malloctype='$malloctype'
20297man1dir='$man1dir'
20298man1direxp='$man1direxp'
20299man1ext='$man1ext'
20300man3dir='$man3dir'
20301man3direxp='$man3direxp'
20302man3ext='$man3ext'
5f80c64f
JH
20303mips_type='$mips_type'
20304mkdir='$mkdir'
b4eb6b3d
JH
20305mmaptype='$mmaptype'
20306modetype='$modetype'
5f80c64f 20307more='$more'
b4eb6b3d 20308multiarch='$multiarch'
5f80c64f 20309mv='$mv'
b4eb6b3d
JH
20310myarchname='$myarchname'
20311mydomain='$mydomain'
20312myhostname='$myhostname'
5f80c64f
JH
20313myuname='$myuname'
20314n='$n'
2cc61e15 20315need_va_copy='$need_va_copy'
b4eb6b3d
JH
20316netdb_hlen_type='$netdb_hlen_type'
20317netdb_host_type='$netdb_host_type'
20318netdb_name_type='$netdb_name_type'
20319netdb_net_type='$netdb_net_type'
5f80c64f
JH
20320nm='$nm'
20321nm_opt='$nm_opt'
20322nm_so_opt='$nm_so_opt'
b4eb6b3d 20323nonxs_ext='$nonxs_ext'
5f80c64f 20324nroff='$nroff'
b4eb6b3d
JH
20325nvEUformat='$nvEUformat'
20326nvFUformat='$nvFUformat'
20327nvGUformat='$nvGUformat'
53133ed1 20328nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
20329nveformat='$nveformat'
20330nvfformat='$nvfformat'
20331nvgformat='$nvgformat'
20332nvsize='$nvsize'
20333nvtype='$nvtype'
20334o_nonblock='$o_nonblock'
5f80c64f 20335obj_ext='$obj_ext'
b4eb6b3d 20336old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 20337optimize='$optimize'
b4eb6b3d 20338orderlib='$orderlib'
5f80c64f
JH
20339osname='$osname'
20340osvers='$osvers'
b4eb6b3d 20341otherlibdirs='$otherlibdirs'
5f80c64f 20342package='$package'
b4eb6b3d
JH
20343pager='$pager'
20344passcat='$passcat'
20345patchlevel='$patchlevel'
5f80c64f 20346path_sep='$path_sep'
b4eb6b3d 20347perl5='$perl5'
5f80c64f 20348perl='$perl'
151e6568 20349perl_patchlevel='$perl_patchlevel'
b4eb6b3d 20350perladmin='$perladmin'
9c839522 20351perllibs='$perllibs'
b4eb6b3d 20352perlpath='$perlpath'
5f80c64f 20353pg='$pg'
b4eb6b3d
JH
20354phostname='$phostname'
20355pidtype='$pidtype'
5f80c64f 20356plibpth='$plibpth'
b4eb6b3d 20357pm_apiversion='$pm_apiversion'
5f80c64f
JH
20358pmake='$pmake'
20359pr='$pr'
b4eb6b3d
JH
20360prefix='$prefix'
20361prefixexp='$prefixexp'
20362privlib='$privlib'
20363privlibexp='$privlibexp'
f24dbf84 20364procselfexe='$procselfexe'
b4eb6b3d
JH
20365prototype='$prototype'
20366ptrsize='$ptrsize'
20367quadkind='$quadkind'
20368quadtype='$quadtype'
20369randbits='$randbits'
20370randfunc='$randfunc'
10bc17b6 20371random_r_proto='$random_r_proto'
b4eb6b3d
JH
20372randseedtype='$randseedtype'
20373ranlib='$ranlib'
20374rd_nodata='$rd_nodata'
10bc17b6
JH
20375readdir64_r_proto='$readdir64_r_proto'
20376readdir_r_proto='$readdir_r_proto'
b4eb6b3d 20377revision='$revision'
5f80c64f
JH
20378rm='$rm'
20379rmail='$rmail'
5440bc8e 20380run='$run'
5f80c64f 20381runnm='$runnm'
b4eb6b3d
JH
20382sPRIEUldbl='$sPRIEUldbl'
20383sPRIFUldbl='$sPRIFUldbl'
20384sPRIGUldbl='$sPRIGUldbl'
20385sPRIXU64='$sPRIXU64'
20386sPRId64='$sPRId64'
20387sPRIeldbl='$sPRIeldbl'
20388sPRIfldbl='$sPRIfldbl'
20389sPRIgldbl='$sPRIgldbl'
20390sPRIi64='$sPRIi64'
20391sPRIo64='$sPRIo64'
20392sPRIu64='$sPRIu64'
20393sPRIx64='$sPRIx64'
20394sSCNfldbl='$sSCNfldbl'
20395sched_yield='$sched_yield'
20396scriptdir='$scriptdir'
20397scriptdirexp='$scriptdirexp'
5f80c64f 20398sed='$sed'
b4eb6b3d
JH
20399seedfunc='$seedfunc'
20400selectminbits='$selectminbits'
20401selecttype='$selecttype'
5f80c64f 20402sendmail='$sendmail'
10bc17b6
JH
20403setgrent_r_proto='$setgrent_r_proto'
20404sethostent_r_proto='$sethostent_r_proto'
20405setlocale_r_proto='$setlocale_r_proto'
20406setnetent_r_proto='$setnetent_r_proto'
20407setprotoent_r_proto='$setprotoent_r_proto'
20408setpwent_r_proto='$setpwent_r_proto'
20409setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
20410sh='$sh'
20411shar='$shar'
20412sharpbang='$sharpbang'
b4eb6b3d
JH
20413shmattype='$shmattype'
20414shortsize='$shortsize'
20415shrpenv='$shrpenv'
5f80c64f 20416shsharp='$shsharp'
b4eb6b3d
JH
20417sig_count='$sig_count'
20418sig_name='$sig_name'
20419sig_name_init='$sig_name_init'
20420sig_num='$sig_num'
20421sig_num_init='$sig_num_init'
76d3c696 20422sig_size='$sig_size'
b4eb6b3d
JH
20423signal_t='$signal_t'
20424sitearch='$sitearch'
20425sitearchexp='$sitearchexp'
20426sitebin='$sitebin'
20427sitebinexp='$sitebinexp'
20428sitelib='$sitelib'
20429sitelib_stem='$sitelib_stem'
20430sitelibexp='$sitelibexp'
20431siteprefix='$siteprefix'
20432siteprefixexp='$siteprefixexp'
20433sizesize='$sizesize'
20434sizetype='$sizetype'
5f80c64f
JH
20435sleep='$sleep'
20436smail='$smail'
5f80c64f 20437so='$so'
b4eb6b3d
JH
20438sockethdr='$sockethdr'
20439socketlib='$socketlib'
20440socksizetype='$socksizetype'
5f80c64f
JH
20441sort='$sort'
20442spackage='$spackage'
20443spitshell='$spitshell'
10bc17b6
JH
20444srand48_r_proto='$srand48_r_proto'
20445srandom_r_proto='$srandom_r_proto'
5f80c64f 20446src='$src'
b4eb6b3d
JH
20447ssizetype='$ssizetype'
20448startperl='$startperl'
5f80c64f 20449startsh='$startsh'
b4eb6b3d
JH
20450static_ext='$static_ext'
20451stdchar='$stdchar'
20452stdio_base='$stdio_base'
20453stdio_bufsiz='$stdio_bufsiz'
20454stdio_cnt='$stdio_cnt'
20455stdio_filbuf='$stdio_filbuf'
20456stdio_ptr='$stdio_ptr'
20457stdio_stream_array='$stdio_stream_array'
10bc17b6 20458strerror_r_proto='$strerror_r_proto'
b4eb6b3d 20459strings='$strings'
5f80c64f 20460submit='$submit'
b4eb6b3d
JH
20461subversion='$subversion'
20462sysman='$sysman'
5f80c64f
JH
20463tail='$tail'
20464tar='$tar'
5440bc8e 20465targetarch='$targetarch'
5f80c64f
JH
20466tbl='$tbl'
20467tee='$tee'
20468test='$test'
b4eb6b3d
JH
20469timeincl='$timeincl'
20470timetype='$timetype'
10bc17b6 20471tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 20472to='$to'
5f80c64f
JH
20473touch='$touch'
20474tr='$tr'
20475trnl='$trnl'
20476troff='$troff'
10bc17b6 20477ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
20478u16size='$u16size'
20479u16type='$u16type'
20480u32size='$u32size'
20481u32type='$u32type'
20482u64size='$u64size'
20483u64type='$u64type'
20484u8size='$u8size'
20485u8type='$u8type'
20486uidformat='$uidformat'
20487uidsign='$uidsign'
20488uidsize='$uidsize'
20489uidtype='$uidtype'
5f80c64f
JH
20490uname='$uname'
20491uniq='$uniq'
b4eb6b3d
JH
20492uquadtype='$uquadtype'
20493use5005threads='$use5005threads'
20494use64bitall='$use64bitall'
20495use64bitint='$use64bitint'
5440bc8e 20496usecrosscompile='$usecrosscompile'
5f80c64f 20497usedl='$usedl'
b4eb6b3d
JH
20498useithreads='$useithreads'
20499uselargefiles='$uselargefiles'
20500uselongdouble='$uselongdouble'
20501usemorebits='$usemorebits'
20502usemultiplicity='$usemultiplicity'
20503usemymalloc='$usemymalloc'
5f80c64f 20504usenm='$usenm'
b4eb6b3d
JH
20505useopcode='$useopcode'
20506useperlio='$useperlio'
20507useposix='$useposix'
9514c62b 20508usereentrant='$usereentrant'
b4eb6b3d
JH
20509usesfio='$usesfio'
20510useshrplib='$useshrplib'
29209bc5 20511usesocks='$usesocks'
b4eb6b3d
JH
20512usethreads='$usethreads'
20513usevendorprefix='$usevendorprefix'
20514usevfork='$usevfork'
5f80c64f
JH
20515usrinc='$usrinc'
20516uuname='$uuname'
b4eb6b3d
JH
20517uvXUformat='$uvXUformat'
20518uvoformat='$uvoformat'
20519uvsize='$uvsize'
20520uvtype='$uvtype'
20521uvuformat='$uvuformat'
20522uvxformat='$uvxformat'
20523vendorarch='$vendorarch'
20524vendorarchexp='$vendorarchexp'
20525vendorbin='$vendorbin'
20526vendorbinexp='$vendorbinexp'
20527vendorlib='$vendorlib'
20528vendorlib_stem='$vendorlib_stem'
20529vendorlibexp='$vendorlibexp'
20530vendorprefix='$vendorprefix'
20531vendorprefixexp='$vendorprefixexp'
20532version='$version'
861eb78d 20533version_patchlevel_string='$version_patchlevel_string'
d56c5707 20534versiononly='$versiononly'
5f80c64f 20535vi='$vi'
b4eb6b3d 20536voidflags='$voidflags'
5f80c64f 20537xlibpth='$xlibpth'
b4eb6b3d 20538xs_apiversion='$xs_apiversion'
3659ebf1
JH
20539yacc='$yacc'
20540yaccflags='$yaccflags'
5f80c64f
JH
20541zcat='$zcat'
20542zip='$zip'
20543EOT
20544
20545: Add in command line options if available
20546$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20547
20548: add special variables
20549$test -f $src/patchlevel.h && \
d00b958f 20550awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 20551echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 20552echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
20553
20554: propagate old symbols
20555if $test -f UU/config.sh; then
381aa1ff 20556 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 20557 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 20558 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
20559 set X `cat UU/oldsyms`
20560 shift
20561 case $# in
20562 0) ;;
20563 *)
20564 cat <<EOM
20565Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20566EOM
20567 echo "# Variables propagated from previous config.sh file." >>config.sh
20568 for sym in `cat UU/oldsyms`; do
20569 echo " Propagating $hint variable "'$'"$sym..."
20570 eval 'tmp="$'"${sym}"'"'
20571 echo "$tmp" | \
20572 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20573 done
20574 ;;
20575 esac
20576fi
20577
20578: Finish up by extracting the .SH files
20579case "$alldone" in
20580exit)
20581 $rm -rf UU
24ccb310 20582 echo "Extraction done."
5f80c64f
JH
20583 exit 0
20584 ;;
20585cont)
20586 ;;
20587'')
20588 dflt=''
20589 nostick=true
20590 $cat <<EOM
20591
20592If you'd like to make any changes to the config.sh file before I begin
20593to configure things, do it as a shell escape now (e.g. !vi config.sh).
20594
20595EOM
20596 rp="Press return or use a shell escape to edit config.sh:"
20597 . UU/myread
20598 nostick=''
20599 case "$ans" in
20600 '') ;;
20601 *) : in case they cannot read
20602 sh 1>&4 -c "$ans";;
20603 esac
20604 ;;
20605esac
20606
20607: if this fails, just run all the .SH files by hand
20608. ./config.sh
20609
20610echo " "
20611exec 1>&4
a43e8593 20612pwd=`pwd`
5f80c64f 20613. ./UU/extract
6904989c 20614cd "$pwd"
5f80c64f
JH
20615
20616if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20617 dflt=y
20618 case "$silent" in
20619 true) ;;
20620 *)
20621 $cat <<EOM
20622
20623Now you need to generate make dependencies by running "$make depend".
20624You might prefer to run it in background: "$make depend > makedepend.out &"
20625It can take a while, so you might not want to run it right now.
20626
20627EOM
20628 ;;
20629 esac
20630 rp="Run $make depend now?"
20631 . UU/myread
20632 case "$ans" in
20633 y*)
3d5d58b1 20634 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
20635 ;;
20636 *)
20637 echo "You must run '$make depend' then '$make'."
20638 ;;
20639 esac
20640elif test -f [Mm]akefile; then
20641 echo " "
20642 echo "Now you must run a $make."
20643else
24ccb310 20644 echo "Configure done."
5f80c64f
JH
20645fi
20646
20647if $test -f Policy.sh; then
20648 $cat <<EOM
20649
20650If you compile $package on a different machine or from a different object
20651directory, copy the Policy.sh file from this object directory to the
20652new one before you run Configure -- this will help you with most of
20653the policy defaults.
20654
20655EOM
20656fi
20657if $test -f config.msg; then
20658 echo "Hmm. I also noted the following information while running:"
20659 echo " "
20660 $cat config.msg >&4
20661 $rm -f config.msg
20662fi
20663$rm -f kit*isdone ark*isdone
20664$rm -rf UU
20665
20666: End of Configure
20667