This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate perlio:
[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#
90f50fa0 23# Generated on Thu May 2 01:39:49 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=''
b4eb6b3d 304byteorder=''
2304df62 305cc=''
2304df62
AD
306ccflags=''
307cppflags=''
308ldflags=''
309lkflags=''
8e07c86e 310locincpth=''
2304df62 311optimize=''
b4eb6b3d 312cf_email=''
2304df62
AD
313cf_by=''
314cf_time=''
b4eb6b3d 315charsize=''
2304df62 316contains=''
b4eb6b3d 317cpp_stuff=''
2304df62
AD
318cpplast=''
319cppminus=''
320cpprun=''
321cppstdin=''
74cac757 322d__fwalk=''
b4eb6b3d
JH
323d_access=''
324d_accessx=''
325d_alarm=''
10bc17b6
JH
326asctime_r_proto=''
327d_asctime_r=''
b4eb6b3d
JH
328d_attribut=''
329d_bcmp=''
330d_bcopy=''
331d_bzero=''
332d_casti32=''
333castflags=''
334d_castneg=''
335d_chown=''
336d_chroot=''
337d_chsize=''
758a5d79 338d_class=''
b4eb6b3d
JH
339d_closedir=''
340d_void_closedir=''
4e0554ec 341d_cmsghdr_s=''
b4eb6b3d
JH
342d_const=''
343cryptlib=''
344d_crypt=''
10bc17b6
JH
345crypt_r_proto=''
346d_crypt_r=''
b4eb6b3d
JH
347d_csh=''
348full_csh=''
10bc17b6
JH
349ctermid_r_proto=''
350d_ctermid_r=''
351ctime_r_proto=''
352d_ctime_r=''
b4eb6b3d
JH
353d_cuserid=''
354d_dbl_dig=''
2ef53570 355d_dbminitproto=''
b4eb6b3d 356d_difftime=''
ae0e3d3b 357d_dirfd=''
b4eb6b3d 358d_dlerror=''
a0d0e21e 359d_dlopen=''
b4eb6b3d
JH
360d_dlsymun=''
361d_dosuid=''
362d_suidsafe=''
10bc17b6
JH
363d_drand48_r=''
364drand48_r_proto=''
b4eb6b3d
JH
365d_drand48proto=''
366d_dup2=''
367d_eaccess=''
368d_endgrent=''
10bc17b6
JH
369d_endgrent_r=''
370endgrent_r_proto=''
b4eb6b3d 371d_endhent=''
10bc17b6
JH
372d_endhostent_r=''
373endhostent_r_proto=''
b4eb6b3d 374d_endnent=''
10bc17b6
JH
375d_endnetent_r=''
376endnetent_r_proto=''
b4eb6b3d 377d_endpent=''
10bc17b6
JH
378d_endprotoent_r=''
379endprotoent_r_proto=''
b4eb6b3d 380d_endpwent=''
10bc17b6
JH
381d_endpwent_r=''
382endpwent_r_proto=''
b4eb6b3d 383d_endsent=''
10bc17b6
JH
384d_endservent_r=''
385endservent_r_proto=''
b363b713 386d_fchdir=''
b4eb6b3d
JH
387d_fchmod=''
388d_fchown=''
389d_fcntl=''
9d9004a9 390d_fcntl_can_lock=''
b4eb6b3d
JH
391d_fd_macros=''
392d_fd_set=''
393d_fds_bits=''
394d_fgetpos=''
758a5d79
JH
395d_finite=''
396d_finitel=''
b4eb6b3d
JH
397d_flexfnam=''
398d_flock=''
2ef53570 399d_flockproto=''
b4eb6b3d 400d_fork=''
758a5d79
JH
401d_fp_class=''
402d_fpclass=''
403d_fpclassify=''
404d_fpclassl=''
b4eb6b3d
JH
405d_fpos64_t=''
406d_frexpl=''
407d_fs_data_s=''
408d_fseeko=''
409d_fsetpos=''
410d_fstatfs=''
411ab01c 411d_fsync=''
b4eb6b3d
JH
412d_ftello=''
413d_ftime=''
414d_gettimeod=''
415d_Gconvert=''
416d_getcwd=''
417d_getespwnam=''
418d_getfsstat=''
419d_getgrent=''
10bc17b6
JH
420d_getgrent_r=''
421getgrent_r_proto=''
422d_getgrgid_r=''
423getgrgid_r_proto=''
424d_getgrnam_r=''
425getgrnam_r_proto=''
b4eb6b3d
JH
426d_getgrps=''
427d_gethbyaddr=''
428d_gethbyname=''
429d_gethent=''
430aphostname=''
431d_gethname=''
432d_phostname=''
433d_uname=''
10bc17b6
JH
434d_gethostbyaddr_r=''
435gethostbyaddr_r_proto=''
436d_gethostbyname_r=''
437gethostbyname_r_proto=''
438d_gethostent_r=''
439gethostent_r_proto=''
b4eb6b3d 440d_gethostprotos=''
4e0554ec 441d_getitimer=''
b4eb6b3d 442d_getlogin=''
10bc17b6
JH
443d_getlogin_r=''
444getlogin_r_proto=''
b4eb6b3d
JH
445d_getmnt=''
446d_getmntent=''
447d_getnbyaddr=''
448d_getnbyname=''
449d_getnent=''
10bc17b6
JH
450d_getnetbyaddr_r=''
451getnetbyaddr_r_proto=''
452d_getnetbyname_r=''
453getnetbyname_r_proto=''
454d_getnetent_r=''
455getnetent_r_proto=''
b4eb6b3d 456d_getnetprotos=''
0c0643d0 457d_getpagsz=''
b4eb6b3d
JH
458d_getpent=''
459d_getpgid=''
460d_getpgrp2=''
461d_bsdgetpgrp=''
462d_getpgrp=''
463d_getppid=''
464d_getprior=''
465d_getpbyname=''
466d_getpbynumber=''
10bc17b6
JH
467d_getprotobyname_r=''
468getprotobyname_r_proto=''
469d_getprotobynumber_r=''
470getprotobynumber_r_proto=''
471d_getprotoent_r=''
472getprotoent_r_proto=''
b4eb6b3d
JH
473d_getprotoprotos=''
474d_getprpwnam=''
475d_getpwent=''
10bc17b6
JH
476d_getpwent_r=''
477getpwent_r_proto=''
478d_getpwnam_r=''
479getpwnam_r_proto=''
480d_getpwuid_r=''
481getpwuid_r_proto=''
b4eb6b3d 482d_getsent=''
10bc17b6
JH
483d_getservbyname_r=''
484getservbyname_r_proto=''
485d_getservbyport_r=''
486getservbyport_r_proto=''
487d_getservent_r=''
488getservent_r_proto=''
b4eb6b3d
JH
489d_getservprotos=''
490d_getspnam=''
10bc17b6
JH
491d_getspnam_r=''
492getspnam_r_proto=''
b4eb6b3d
JH
493d_getsbyname=''
494d_getsbyport=''
10bc17b6
JH
495d_gmtime_r=''
496gmtime_r_proto=''
a4f3eea9 497d_gnulibc=''
b4eb6b3d
JH
498d_hasmntopt=''
499d_htonl=''
b4eb6b3d
JH
500d_inetaton=''
501d_int64_t=''
502d_isascii=''
758a5d79
JH
503d_isfinite=''
504d_isinf=''
b4eb6b3d
JH
505d_isnan=''
506d_isnanl=''
507d_killpg=''
508d_lchown=''
509d_ldbl_dig=''
510d_link=''
10bc17b6
JH
511d_localtime_r=''
512localtime_r_proto=''
b4eb6b3d
JH
513d_locconv=''
514d_lockf=''
515d_longdbl=''
516longdblsize=''
517d_longlong=''
518longlongsize=''
519d_lseekproto=''
520d_lstat=''
521d_madvise=''
522d_mblen=''
523d_mbstowcs=''
524d_mbtowc=''
525d_memchr=''
526d_memcmp=''
527d_memcpy=''
528d_memmove=''
529d_memset=''
530d_mkdir=''
531d_mkdtemp=''
532d_mkfifo=''
533d_mkstemp=''
534d_mkstemps=''
535d_mktime=''
536d_mmap=''
537mmaptype=''
538d_modfl=''
e67aeab1 539d_modfl_pow32_bug=''
b4eb6b3d
JH
540d_mprotect=''
541d_msg=''
542d_msgctl=''
543d_msgget=''
4e0554ec 544d_msghdr_s=''
b4eb6b3d
JH
545d_msgrcv=''
546d_msgsnd=''
547d_msync=''
548d_munmap=''
549d_nice=''
2765b840 550d_nl_langinfo=''
b4eb6b3d
JH
551d_off64_t=''
552d_open3=''
553d_fpathconf=''
554d_pathconf=''
555d_pause=''
556d_pipe=''
557d_poll=''
2304df62 558d_portable=''
a33c94aa 559d_procselfexe=''
f24dbf84 560procselfexe=''
b4eb6b3d
JH
561d_old_pthread_create_joinable=''
562old_pthread_create_joinable=''
d6483fcc 563d_pthread_atfork=''
b4eb6b3d
JH
564d_pthread_yield=''
565d_sched_yield=''
566sched_yield=''
567d_qgcvt=''
10bc17b6
JH
568d_random_r=''
569random_r_proto=''
570d_readdir64_r=''
571readdir64_r_proto=''
b4eb6b3d
JH
572d_readdir=''
573d_rewinddir=''
574d_seekdir=''
575d_telldir=''
10bc17b6
JH
576d_readdir_r=''
577readdir_r_proto=''
b4eb6b3d 578d_readlink=''
4e0554ec
JH
579d_readv=''
580d_recvmsg=''
b4eb6b3d
JH
581d_rename=''
582d_rmdir=''
583d_safebcpy=''
584d_safemcpy=''
585d_sanemcmp=''
ef9f17be 586d_sbrkproto=''
b4eb6b3d
JH
587d_select=''
588d_sem=''
589d_semctl=''
590d_semget=''
591d_semop=''
4e0554ec 592d_sendmsg=''
b4eb6b3d
JH
593d_setegid=''
594d_seteuid=''
595d_setgrent=''
10bc17b6
JH
596d_setgrent_r=''
597setgrent_r_proto=''
b4eb6b3d
JH
598d_setgrps=''
599d_sethent=''
10bc17b6
JH
600d_sethostent_r=''
601sethostent_r_proto=''
4e0554ec 602d_setitimer=''
b4eb6b3d
JH
603d_setlinebuf=''
604d_setlocale=''
10bc17b6
JH
605d_setlocale_r=''
606setlocale_r_proto=''
b4eb6b3d 607d_setnent=''
10bc17b6
JH
608d_setnetent_r=''
609setnetent_r_proto=''
b4eb6b3d
JH
610d_setpent=''
611d_setpgid=''
612d_setpgrp2=''
613d_bsdsetpgrp=''
614d_setpgrp=''
615d_setprior=''
616d_setproctitle=''
10bc17b6
JH
617d_setprotoent_r=''
618setprotoent_r_proto=''
b4eb6b3d 619d_setpwent=''
10bc17b6
JH
620d_setpwent_r=''
621setpwent_r_proto=''
b4eb6b3d
JH
622d_setregid=''
623d_setresgid=''
624d_setresuid=''
625d_setreuid=''
626d_setrgid=''
627d_setruid=''
628d_setsent=''
10bc17b6
JH
629d_setservent_r=''
630setservent_r_proto=''
b4eb6b3d
JH
631d_setsid=''
632d_setvbuf=''
633d_sfio=''
634usesfio=''
635d_shm=''
636d_shmat=''
637d_shmatprototype=''
638shmattype=''
639d_shmctl=''
640d_shmdt=''
641d_shmget=''
642d_sigaction=''
983dbef6 643d_sigprocmask=''
b4eb6b3d 644d_sigsetjmp=''
49a78c82 645d_sockatmark=''
2ef53570 646d_sockatmarkproto=''
b4eb6b3d
JH
647d_msg_ctrunc=''
648d_msg_dontroute=''
649d_msg_oob=''
650d_msg_peek=''
651d_msg_proxy=''
652d_oldsock=''
653d_scm_rights=''
654d_socket=''
655d_sockpair=''
656sockethdr=''
657socketlib=''
658d_socklen_t=''
659d_socks5_init=''
660d_sqrtl=''
10bc17b6
JH
661d_srand48_r=''
662srand48_r_proto=''
663d_srandom_r=''
664srandom_r_proto=''
eef837ea 665d_sresgproto=''
640374d0 666d_sresuproto=''
b4eb6b3d
JH
667d_statblks=''
668d_statfs_f_flags=''
669d_statfs_s=''
670d_fstatvfs=''
671d_statvfs=''
672d_stdio_cnt_lval=''
673d_stdio_ptr_lval=''
a7ffa9b9
NC
674d_stdio_ptr_lval_nochange_cnt=''
675d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
676d_stdiobase=''
677d_stdstdio=''
678stdio_base=''
679stdio_bufsiz=''
680stdio_cnt=''
681stdio_filbuf=''
682stdio_ptr=''
683d_index=''
684d_strchr=''
685d_strcoll=''
686d_strctcpy=''
687d_strerrm=''
688d_strerror=''
689d_sysernlst=''
690d_syserrlst=''
10bc17b6
JH
691d_strerror_r=''
692strerror_r_proto=''
b3c85772 693d_strftime=''
b4eb6b3d
JH
694d_strtod=''
695d_strtol=''
696d_strtold=''
697d_strtoll=''
28e5dec8 698d_strtoq=''
b4eb6b3d
JH
699d_strtoul=''
700d_strtoull=''
701d_strtouq=''
702d_strxfrm=''
703d_symlink=''
704d_syscall=''
2ef53570 705d_syscallproto=''
b4eb6b3d
JH
706d_sysconf=''
707d_system=''
708d_tcgetpgrp=''
709d_tcsetpgrp=''
710d_telldirproto=''
711d_time=''
712timetype=''
713clocktype=''
714d_times=''
10bc17b6
JH
715d_tmpnam_r=''
716tmpnam_r_proto=''
b4eb6b3d 717d_truncate=''
10bc17b6
JH
718d_ttyname_r=''
719ttyname_r_proto=''
b4eb6b3d 720d_tzname=''
4e0554ec
JH
721d_u32align=''
722d_ualarm=''
b4eb6b3d
JH
723d_umask=''
724d_semctl_semid_ds=''
725d_semctl_semun=''
726d_union_semun=''
758a5d79 727d_unordered=''
4e0554ec 728d_usleep=''
2ef53570 729d_usleepproto=''
b4eb6b3d
JH
730d_ustat=''
731d_vfork=''
732usevfork=''
733d_voidsig=''
734signal_t=''
735d_volatile=''
736d_charvspr=''
737d_vprintf=''
738d_wait4=''
739d_waitpid=''
740d_wcstombs=''
741d_wctomb=''
4e0554ec 742d_writev=''
b4eb6b3d 743dlext=''
85e6fe83
LW
744cccdlflags=''
745ccdlflags=''
2304df62 746dlsrc=''
232e078e 747ld=''
85e6fe83 748lddlflags=''
2304df62 749usedl=''
b4eb6b3d
JH
750doublesize=''
751ebcdic=''
752fflushNULL=''
753fflushall=''
754fpossize=''
755fpostype=''
5b463ca7 756gccosandvers=''
8a27cf78 757gccversion=''
b4eb6b3d
JH
758gidformat=''
759gidsign=''
760gidsize=''
761gidtype=''
762groupstype=''
763h_fcntl=''
764h_sysfile=''
765i_arpainet=''
10bc17b6 766i_crypt=''
b4eb6b3d
JH
767db_hashtype=''
768db_prefixtype=''
640374d0
JH
769db_version_major=''
770db_version_minor=''
771db_version_patch=''
b4eb6b3d
JH
772i_db=''
773i_dbm=''
774i_rpcsvcdbm=''
775d_dirnamlen=''
776direntrytype=''
777i_dirent=''
a0d0e21e 778i_dld=''
b4eb6b3d
JH
779i_dlfcn=''
780i_fcntl=''
781i_float=''
758a5d79
JH
782i_fp=''
783i_fp_class=''
b4eb6b3d
JH
784i_gdbm=''
785d_grpasswd=''
786i_grp=''
b4eb6b3d
JH
787i_ieeefp=''
788i_inttypes=''
2765b840 789i_langinfo=''
b4eb6b3d
JH
790i_libutil=''
791i_limits=''
792i_locale=''
793i_machcthr=''
794i_malloc=''
795i_math=''
796i_memory=''
797i_mntent=''
798i_ndbm=''
799i_netdb=''
800i_neterrno=''
801i_netinettcp=''
802i_niin=''
803i_sysin=''
804i_poll=''
805i_prot=''
806i_pthread=''
807d_pwage=''
808d_pwchange=''
809d_pwclass=''
810d_pwcomment=''
811d_pwexpire=''
812d_pwgecos=''
813d_pwpasswd=''
814d_pwquota=''
815i_pwd=''
816i_sfio=''
817i_shadow=''
818i_socks=''
819i_stddef=''
820i_stdlib=''
821i_string=''
822strings=''
823i_sunmath=''
824i_sysaccess=''
825i_sysdir=''
826i_sysfile=''
827d_voidtty=''
828i_bsdioctl=''
829i_sysfilio=''
830i_sysioctl=''
831i_syssockio=''
832i_syslog=''
833i_sysmman=''
834i_sysmode=''
835i_sysmount=''
836i_sysndir=''
837i_sysparam=''
838i_sysresrc=''
839i_syssecrt=''
840i_sysselct=''
841i_sysstat=''
842i_sysstatfs=''
843i_sysstatvfs=''
844i_systimes=''
845i_systypes=''
846i_sysuio=''
847i_sysun=''
848i_sysutsname=''
849i_sysvfs=''
850i_syswait=''
851i_sgtty=''
852i_termio=''
853i_termios=''
14b90194
JH
854d_tm_tm_gmtoff=''
855d_tm_tm_zone=''
b4eb6b3d
JH
856i_systime=''
857i_systimek=''
858i_time=''
859timeincl=''
860i_unistd=''
861i_ustat=''
862i_utime=''
863i_values=''
864i_stdarg=''
865i_varargs=''
866i_varhdr=''
867i_vfork=''
868inc_version_list=''
869inc_version_list_init=''
870installprefix=''
871installprefixexp=''
872installstyle=''
873installusrbinperl=''
874intsize=''
875longsize=''
876shortsize=''
4b661809 877issymlink=''
2304df62 878libc=''
b4eb6b3d
JH
879ldlibpthname=''
880libperl=''
881shrpenv=''
882useshrplib=''
a0d0e21e 883glibpth=''
2304df62 884libpth=''
8e07c86e 885loclibpth=''
2304df62
AD
886plibpth=''
887xlibpth=''
1cfa4ec7 888ignore_versioned_solibs=''
2304df62 889libs=''
43999f95
JH
890libsdirs=''
891libsfiles=''
892libsfound=''
13b3f787 893libspath=''
85e6fe83 894lns=''
b4eb6b3d
JH
895d_PRIEUldbl=''
896d_PRIFUldbl=''
897d_PRIGUldbl=''
898d_PRIeldbl=''
899d_PRIfldbl=''
900d_PRIgldbl=''
901d_SCNfldbl=''
902sPRIEUldbl=''
903sPRIFUldbl=''
904sPRIGUldbl=''
905sPRIeldbl=''
906sPRIfldbl=''
907sPRIgldbl=''
908sSCNfldbl=''
909lseeksize=''
910lseektype=''
8ff267be 911make_set_make=''
b4eb6b3d
JH
912d_mymalloc=''
913freetype=''
914mallocobj=''
915mallocsrc=''
916malloctype=''
917usemymalloc=''
918installman1dir=''
919man1dir=''
920man1direxp=''
921man1ext=''
922installman3dir=''
923man3dir=''
924man3direxp=''
925man3ext=''
926modetype=''
927multiarch=''
928mydomain=''
929myhostname=''
930phostname=''
2304df62
AD
931c=''
932n=''
b4eb6b3d
JH
933d_eofnblk=''
934eagain=''
935o_nonblock=''
936rd_nodata=''
2cc61e15 937need_va_copy=''
b4eb6b3d
JH
938netdb_hlen_type=''
939netdb_host_type=''
940netdb_name_type=''
941netdb_net_type=''
942groupcat=''
943hostcat=''
944passcat=''
945orderlib=''
946ranlib=''
947d_perl_otherlibdirs=''
948otherlibdirs=''
2304df62
AD
949package=''
950spackage=''
b4eb6b3d
JH
951pager=''
952api_revision=''
953api_subversion=''
954api_version=''
955api_versionstring=''
956patchlevel=''
151e6568 957perl_patchlevel=''
b4eb6b3d
JH
958revision=''
959subversion=''
960version=''
861eb78d 961version_patchlevel_string=''
b4eb6b3d
JH
962perl5=''
963perladmin=''
964perlpath=''
965d_nv_preserves_uv=''
b4eb6b3d
JH
966i16size=''
967i16type=''
968i32size=''
969i32type=''
970i64size=''
971i64type=''
972i8size=''
973i8type=''
974ivsize=''
975ivtype=''
53133ed1 976nv_preserves_uv_bits=''
b4eb6b3d
JH
977nvsize=''
978nvtype=''
979u16size=''
980u16type=''
981u32size=''
982u32type=''
983u64size=''
984u64type=''
985u8size=''
986u8type=''
987uvsize=''
988uvtype=''
989ivdformat=''
990nvEUformat=''
991nvFUformat=''
992nvGUformat=''
993nveformat=''
994nvfformat=''
995nvgformat=''
996uvXUformat=''
997uvoformat=''
998uvuformat=''
999uvxformat=''
1000pidtype=''
1001prefix=''
1002prefixexp=''
1003installprivlib=''
1004privlib=''
1005privlibexp=''
1006prototype=''
1007ptrsize=''
1008d_PRIXU64=''
1009d_PRId64=''
1010d_PRIi64=''
1011d_PRIo64=''
1012d_PRIu64=''
1013d_PRIx64=''
1014sPRIXU64=''
1015sPRId64=''
1016sPRIi64=''
1017sPRIo64=''
1018sPRIu64=''
1019sPRIx64=''
1020d_quad=''
1021quadkind=''
1022quadtype=''
1023uquadtype=''
1024drand01=''
1025randbits=''
1026randfunc=''
1027randseedtype=''
1028seedfunc=''
1029installscript=''
1030scriptdir=''
1031scriptdirexp=''
1032selectminbits=''
1033selecttype=''
8ff267be 1034sh=''
b4eb6b3d
JH
1035sig_count=''
1036sig_name=''
1037sig_name_init=''
1038sig_num=''
1039sig_num_init=''
76d3c696 1040sig_size=''
b4eb6b3d
JH
1041installsitearch=''
1042sitearch=''
1043sitearchexp=''
1044installsitebin=''
1045sitebin=''
1046sitebinexp=''
1047installsitelib=''
1048sitelib=''
1049sitelib_stem=''
1050sitelibexp=''
1051siteprefix=''
1052siteprefixexp=''
1053sizesize=''
1054sizetype=''
a0d0e21e 1055so=''
b4eb6b3d 1056socksizetype=''
2304df62
AD
1057sharpbang=''
1058shsharp=''
1059spitshell=''
dfe9444c 1060src=''
b4eb6b3d
JH
1061ssizetype=''
1062startperl=''
2304df62 1063startsh=''
b4eb6b3d
JH
1064stdchar=''
1065d_stdio_stream_array=''
1066stdio_stream_array=''
1067sysman=''
5ff3f7a4 1068trnl=''
b4eb6b3d
JH
1069uidformat=''
1070uidsign=''
1071uidsize=''
1072uidtype=''
1073archname64=''
1074use64bitall=''
1075use64bitint=''
1076ccflags_uselargefiles=''
1077ldflags_uselargefiles=''
1078libswanted_uselargefiles=''
1079uselargefiles=''
1080uselongdouble=''
1081usemorebits=''
1082usemultiplicity=''
2304df62 1083nm_opt=''
40a7a20a 1084nm_so_opt=''
2304df62
AD
1085runnm=''
1086usenm=''
b4eb6b3d 1087useperlio=''
29209bc5 1088usesocks=''
b4eb6b3d
JH
1089d_oldpthreads=''
1090use5005threads=''
1091useithreads=''
9514c62b 1092usereentrant=''
b4eb6b3d 1093usethreads=''
2304df62 1094incpath=''
2304df62
AD
1095mips_type=''
1096usrinc=''
b4eb6b3d
JH
1097d_vendorarch=''
1098installvendorarch=''
1099vendorarch=''
1100vendorarchexp=''
1101d_vendorbin=''
1102installvendorbin=''
1103vendorbin=''
1104vendorbinexp=''
1105d_vendorlib=''
1106installvendorlib=''
1107vendorlib=''
1108vendorlib_stem=''
1109vendorlibexp=''
1110usevendorprefix=''
1111vendorprefix=''
1112vendorprefixexp=''
d56c5707 1113versiononly=''
b4eb6b3d
JH
1114defvoidused=''
1115voidflags=''
1116pm_apiversion=''
1117xs_apiversion=''
3659ebf1
JH
1118yacc=''
1119yaccflags=''
2304df62
AD
1120CONFIG=''
1121
ecfc5424
AD
1122define='define'
1123undef='undef'
1124smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1125rmlist=''
1126
1127: We must find out about Eunice early
1128eunicefix=':'
1129if test -f /etc/unixtovms; then
1130 eunicefix=/etc/unixtovms
1131fi
1132if test -f /etc/unixtovms.exe; then
1133 eunicefix=/etc/unixtovms.exe
1134fi
1135
cfb04860 1136: Set executable suffix now -- needed before hints available
6153ba32
PG
1137if test -f "/libs/version.library"; then
1138: Amiga OS
1139 _exe=""
1140elif test -f "/system/gnu_library/bin/ar.pm"; then
1141: Stratus VOS
cfb04860 1142 _exe=".pm"
6153ba32
PG
1143elif test -n "$DJGPP"; then
1144: DOS DJGPP
cfb04860 1145 _exe=".exe"
6153ba32 1146elif test -d c:/. ; then
506faf56 1147: OS/2 or cygwin
ba863942
JH
1148 _exe=".exe"
1149fi
868439a2 1150
b4eb6b3d 1151i_whoami=''
a33c94aa
JH
1152ccname=''
1153ccversion=''
1154perllibs=''
1155: set useposix=false in your hint file to disable the POSIX extension.
1156useposix=true
1157: set useopcode=false in your hint file to disable the Opcode extension.
1158useopcode=true
1159: Trailing extension. Override this in a hint file, if needed.
a33c94aa
JH
1160: Extra object files, if any, needed on this platform.
1161archobjs=''
1162archname=''
ff935051
JH
1163: Possible local include directories to search.
1164: Set locincpth to "" in a hint file to defeat local include searches.
1165locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1166locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1167:
1168: no include file wanted by default
1169inclwanted=''
1170
b4eb6b3d 1171groupstype=''
64615a5e 1172libnames=''
732c9516
JH
1173: change the next line if compiling for Xenix/286 on Xenix/386
1174xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1175: Possible local library directories to search.
1176loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1177loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1178
1179: general looking path for locating libraries
5869b1f1 1180glibpth="/lib /usr/lib $xlibpth"
732c9516 1181glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1182test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1183test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1184
1185: Private path used by Configure to find libraries. Its value
1186: is prepended to libpth. This variable takes care of special
1187: machines, like the mips. Usually, it should be empty.
1188plibpth=''
1189
1cfa4ec7
GS
1190: default library list
1191libswanted=''
921b2963 1192: some systems want to use only the non-versioned libso:s
1cfa4ec7 1193ignore_versioned_solibs=''
b4eb6b3d
JH
1194archname64=''
1195ccflags_uselargefiles=''
1196ldflags_uselargefiles=''
1197libswanted_uselargefiles=''
1198: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1199: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1200: set usethreads on the Configure command line to enable threads.
cd040c5e 1201usereentrant='undef'
a33c94aa
JH
1202: full support for void wanted by default
1203defvoidused=15
1204
ecfc5424 1205: List of libraries we want.
693762b4 1206: If anyone needs -lnet, put it in a hint file.
997d70a2 1207libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1208libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1209libswanted="$libswanted ndir dir crypt sec"
e61ecf27 1210libswanted="$libswanted ucb bsd BSD PW x util"
1aef975c 1211: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1212: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1213glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1214glibpth="/usr/shlib $glibpth"
1215: Do not use vfork unless overridden by a hint file.
1216usevfork=false
1217
8ff267be 1218: Find the basic shell for Bourne shell scripts
1219case "$sh" in
1220'')
8ff267be 1221 case "$SYSTYPE" in
1222 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1223 *) xxx='/bin/sh';;
1224 esac
1225 if test -f "$xxx"; then
1226 sh="$xxx"
1227 else
1228 : Build up a list and do a single loop so we can 'break' out.
1229 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1230 for xxx in sh bash ksh pdksh ash; do
1231 for p in $pth; do
1232 try="$try ${p}/${xxx}"
1233 done
1234 done
1235 for xxx in $try; do
1236 if test -f "$xxx"; then
1237 sh="$xxx";
8ff267be 1238 break
a5a94ea5
JH
1239 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1240 sh="$xxx";
1241 break
8ff267be 1242 elif test -f "$xxx.exe"; then
1243 sh="$xxx";
8ff267be 1244 break
1245 fi
1246 done
1247 fi
1248 ;;
1249esac
1250
1251case "$sh" in
a33c94aa 1252'') cat >&2 <<EOM
8ff267be 1253$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1254
8ff267be 1255Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1256Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1257we'll try to straighten this all out.
8ff267be 1258EOM
1259 exit 1
1260 ;;
1261esac
1262
760ac839 1263: see if sh knows # comments
73614538 1264if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1265 shsharp=true
1266 spitshell=cat
760ac839 1267 xcat=/bin/cat
a931254c
JH
1268 test -f $xcat$_exe || xcat=/usr/bin/cat
1269 if test ! -f $xcat$_exe; then
4bdb8fb5 1270 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1271 if test -f $p/cat$_exe; then
1deb0a86 1272 xcat=$p/cat
3c728e00
JH
1273 break
1274 fi
1275 done
1deb0a86
JH
1276 if test ! -f $xcat$_exe; then
1277 echo "Can't find cat anywhere!"
3c728e00
JH
1278 exit 1
1279 fi
1280 fi
5440bc8e
JH
1281 echo "#!$xcat" >sharp
1282 $eunicefix sharp
1283 chmod +x sharp
1284 ./sharp > today
760ac839 1285 if test -s today; then
760ac839
LW
1286 sharpbang='#!'
1287 else
5440bc8e
JH
1288 echo "#! $xcat" > sharp
1289 $eunicefix sharp
1290 chmod +x sharp
1291 ./sharp > today
760ac839 1292 if test -s today; then
760ac839
LW
1293 sharpbang='#! '
1294 else
760ac839
LW
1295 sharpbang=': use '
1296 fi
1297 fi
1298else
dfe9444c 1299 echo " "
8ff267be 1300 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1301 shsharp=false
1302 cd ..
1303 echo "exec grep -v '^[ ]*#'" >spitshell
1304 chmod +x spitshell
1305 $eunicefix spitshell
1306 spitshell=`pwd`/spitshell
1307 cd UU
1308 echo "I presume that if # doesn't work, #! won't work either!"
1309 sharpbang=': use '
1310fi
5440bc8e 1311rm -f sharp today
760ac839
LW
1312
1313: figure out how to guarantee sh startup
8ff267be 1314case "$startsh" in
1315'') startsh=${sharpbang}${sh} ;;
1316*)
760ac839 1317esac
5440bc8e 1318cat >sharp <<EOSS
760ac839
LW
1319$startsh
1320set abc
1321test "$?abc" != 1
1322EOSS
1323
5440bc8e
JH
1324chmod +x sharp
1325$eunicefix sharp
1326if ./sharp; then
8ff267be 1327 : echo "Yup, it does."
760ac839 1328else
dfe9444c
AD
1329 echo "Hmm... '$startsh' does not guarantee sh startup..."
1330 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1331fi
5440bc8e 1332rm -f sharp
760ac839 1333
aebf16e7
AD
1334
1335: Save command line options in file UU/cmdline.opt for later use in
1336: generating config.sh.
1337cat > cmdline.opt <<EOSH
1338# Configure command line arguments.
1339config_arg0='$0'
1340config_args='$*'
1341config_argc=$#
1342EOSH
1343argn=1
ee45ea83
IZ
1344args_exp=''
1345args_sep=''
aebf16e7
AD
1346for arg in "$@"; do
1347 cat >>cmdline.opt <<EOSH
1348config_arg$argn='$arg'
1349EOSH
ee45ea83
IZ
1350 # Extreme backslashitis: replace each ' by '"'"'
1351 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1352$arg
1353EOC
1354 arg_exp=`cat cmdl.opt`
1355 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1356 argn=`expr $argn + 1`
ee45ea83 1357 args_sep=' '
aebf16e7 1358done
ee45ea83
IZ
1359# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1360# used by ./hints/os2.sh
1361rm -f cmdl.opt
aebf16e7 1362
2304df62
AD
1363: produce awk script to parse command line options
1364cat >options.awk <<'EOF'
1365BEGIN {
02e93a22 1366 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1367
1368 len = length(optstr);
1369 for (i = 1; i <= len; i++) {
1370 c = substr(optstr, i, 1);
1371 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1372 if (a == ":") {
1373 arg[c] = 1;
1374 i++;
1375 }
1376 opt[c] = 1;
1377 }
1378}
1379{
1380 expect = 0;
1381 str = $0;
1382 if (substr(str, 1, 1) != "-") {
1383 printf("'%s'\n", str);
1384 next;
1385 }
1386 len = length($0);
1387 for (i = 2; i <= len; i++) {
1388 c = substr(str, i, 1);
1389 if (!opt[c]) {
1390 printf("-%s\n", substr(str, i));
1391 next;
1392 }
1393 printf("-%s\n", c);
1394 if (arg[c]) {
1395 if (i < len)
1396 printf("'%s'\n", substr(str, i + 1));
1397 else
1398 expect = 1;
1399 next;
1400 }
1401 }
1402}
1403END {
1404 if (expect)
1405 print "?";
1406}
1407EOF
1408
1409: process the command line options
4633a7c4
LW
1410set X `for arg in "$@"; do echo "X$arg"; done |
1411 sed -e s/X// | awk -f options.awk`
2304df62
AD
1412eval "set $*"
1413shift
1414rm -f options.awk
1415
1416: set up default values
1417fastread=''
1418reuseval=false
1419config_sh=''
1420alldone=''
1421error=''
1422silent=''
1423extractsh=''
ecfc5424 1424override=''
16d20bd9 1425knowitall=''
02e93a22 1426rm -f optdef.sh posthint.sh
28757baa 1427cat >optdef.sh <<EOS
1428$startsh
1429EOS
2304df62 1430
dfe9444c 1431
2304df62
AD
1432: option parsing
1433while test $# -gt 0; do
1434 case "$1" in
1435 -d) shift; fastread=yes;;
1436 -e) shift; alldone=cont;;
1437 -f)
1438 shift
1439 cd ..
1440 if test -r "$1"; then
1441 config_sh="$1"
1442 else
a0d0e21e 1443 echo "$me: cannot read config file $1." >&2
2304df62
AD
1444 error=true
1445 fi
1446 cd UU
1447 shift;;
1448 -h) shift; error=true;;
1449 -r) shift; reuseval=true;;
dfe9444c 1450 -s) shift; silent=true; realsilent=true;;
2304df62 1451 -E) shift; alldone=exit;;
16d20bd9 1452 -K) shift; knowitall=true;;
ecfc5424 1453 -O) shift; override=true;;
dfe9444c 1454 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1455 -D)
1456 shift
1457 case "$1" in
1458 *=)
1459 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1460 echo "$me: ignoring -D $1" >&2
1461 ;;
ecfc5424 1462 *=*) echo "$1" | \
1aef975c
AD
1463 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1464 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1465 esac
1466 shift
1467 ;;
1468 -U)
1469 shift
1470 case "$1" in
1aef975c 1471 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1472 *=*)
1473 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1474 echo "$me: ignoring -U $1" >&2
1475 ;;
1aef975c 1476 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1477 esac
1478 shift
1479 ;;
02e93a22
JH
1480 -A)
1481 shift
1482 xxx=''
1483 yyy="$1"
02e93a22 1484 zzz=''
5f83a3e9 1485 uuu=undef
02e93a22 1486 case "$yyy" in
5f83a3e9
JH
1487 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1488 case "$zzz" in
1489 *:*) zzz='' ;;
1490 *) xxx=append
1491 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1492 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1493 esac
1494 ;;
1495 esac
1496 case "$xxx" in
1497 '') case "$yyy" in
1498 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1499 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1500 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1501 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1502 *) xxx=`echo $yyy|sed 's!:.*!!'`
1503 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1504 esac
1505 ;;
1506 esac
02e93a22
JH
1507 case "$xxx" in
1508 append)
5f83a3e9 1509 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1510 clear)
5f83a3e9 1511 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1512 define)
1513 case "$zzz" in
1514 '') zzz=define ;;
1515 esac
5f83a3e9 1516 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1517 eval)
5f83a3e9 1518 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1519 prepend)
5f83a3e9 1520 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1521 undef)
1522 case "$zzz" in
1523 '') zzz="$uuu" ;;
1524 esac
5f83a3e9
JH
1525 echo "$yyy=$zzz" >> posthint.sh ;;
1526 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1527 esac
bde6b06b 1528 shift
02e93a22 1529 ;;
dfe9444c 1530 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1531 exit 0;;
2304df62 1532 --) break;;
a0d0e21e 1533 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1534 *) break;;
1535 esac
1536done
1537
1538case "$error" in
1539true)
1540 cat >&2 <<EOM
2afac517 1541Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1542 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1543 -d : use defaults for all answers.
1544 -e : go on without questioning past the production of config.sh.
1545 -f : specify an alternate default configuration file.
1546 -h : print this help message and exit (with an error status).
1547 -r : reuse C symbols value if possible (skips costly nm extraction).
1548 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1549 -D : define symbol to have some value:
1550 -D symbol symbol gets the value 'define'
1551 -D symbol=value symbol gets the value 'value'
2304df62 1552 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1553 -K : do not use unless you know what you are doing.
ecfc5424 1554 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1555 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1556 -U : undefine symbol:
1557 -U symbol symbol gets the value 'undef'
1558 -U symbol= symbol gets completely empty
02e93a22 1559 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1560 -A symbol=value append " "value to symbol
02e93a22
JH
1561 -A append:symbol=value append value to symbol
1562 -A define:symbol=value define symbol to have value
02e93a22
JH
1563 -A clear:symbol define symbol to be ''
1564 -A define:symbol define symbol to be 'define'
1565 -A eval:symbol=value define symbol to be eval of value
1566 -A prepend:symbol=value prepend value to symbol
1567 -A undef:symbol define symbol to be 'undef'
1568 -A undef:symbol= define symbol to be ''
2304df62
AD
1569 -V : print version number and exit (with a zero status).
1570EOM
1571 exit 1
1572 ;;
1573esac
1574
dfe9444c
AD
1575: Sanity checks
1576case "$fastread$alldone" in
1577yescont|yesexit) ;;
1578*)
aaeb8e51
GS
1579 case "$extractsh" in
1580 true) ;;
1581 *)
1582 if test ! -t 0; then
1583 echo "Say 'sh Configure', not 'sh <Configure'"
1584 exit 1
1585 fi
1586 ;;
1587 esac
dfe9444c
AD
1588 ;;
1589esac
1590
2304df62
AD
1591exec 4>&1
1592case "$silent" in
1593true) exec 1>/dev/null;;
1594esac
1595
ecfc5424 1596: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1597touch optdef.sh
1598. ./optdef.sh
02e93a22
JH
1599: create the posthint manipulation script and leave the file out there...
1600touch posthint.sh
a0d0e21e 1601
2304df62 1602: set package name
85e6fe83 1603package=perl5
b4eb6b3d
JH
1604first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1605last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1606case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1607ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1608*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1609esac
2304df62 1610
2304df62
AD
1611: Some greps do not return status, grrr.
1612echo "grimblepritz" >grimble
1613if grep blurfldyick grimble >/dev/null 2>&1 ; then
1614 contains=contains
1615elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1616 contains=grep
1617else
1618 contains=contains
1619fi
1620rm -f grimble
1621: the following should work in any shell
1622case "$contains" in
1623contains*)
1624 echo " "
1625 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1626 cat >contains <<'EOSS'
1627grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1628EOSS
1629chmod +x contains
1630esac
1631
dfe9444c
AD
1632: Find the path to the source tree
1633case "$src" in
1634'') case "$0" in
b233458b
JH
1635 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1636 case "$src" in
1637 /*) ;;
8504afb7 1638 .) ;;
b233458b
JH
1639 *) src=`cd ../$src && pwd` ;;
1640 esac
1641 ;;
dfe9444c
AD
1642 *) src='.';;
1643 esac;;
1644esac
1645case "$src" in
1646'') src=/
1647 rsrc=/
1648 ;;
1649/*) rsrc="$src";;
1650*) rsrc="../$src";;
1651esac
1652if test -f $rsrc/Configure && \
1653 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1654then
1655 : found it, so we are ok.
1656else
1657 rsrc=''
1658 for src in . .. ../.. ../../.. ../../../..; do
1659 if test -f ../$src/Configure && \
1660 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1661 then
1662 rsrc=../$src
1663 break
1664 fi
1665 done
1666fi
1667case "$rsrc" in
1668'')
1669 cat <<EOM >&4
1670
1671Sorry, I can't seem to locate the source dir for $package. Please start
1672Configure with an explicit path -- i.e. /some/path/Configure.
1673
1674EOM
1675 exit 1
1676 ;;
1677../.) rsrc='..';;
1678*)
1679 echo " "
1680 echo "Sources for $package found in \"$src\"." >&4
1681 ;;
1682esac
1683
1684: script used to extract .SH files with variable substitutions
1685cat >extract <<'EOS'
a02608de 1686PERL_CONFIG_SH=true
dfe9444c 1687echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1688if test -f MANIFEST; then
1689 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1690else
1691 echo "(Looking for .SH files under the source directory.)"
6904989c 1692 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1693fi
1694shift
1695case $# in
6904989c 16960) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1697esac
6904989c 1698if test ! -f "$src/$1"; then
dfe9444c
AD
1699 shift
1700fi
1701mkdir_p='
1702name=$1;
1703create="";
1704while test $name; do
1705 if test ! -d "$name"; then
1706 create="$name $create";
1707 name=`echo $name | sed -e "s|^[^/]*$||"`;
1708 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1709 else
1710 name="";
1711 fi;
1712done;
1713for file in $create; do
1714 mkdir $file;
1715done
1716'
1717for file in $*; do
1718 case "$src" in
1719 ".")
1720 case "$file" in
1721 */*)
1722 dir=`expr X$file : 'X\(.*\)/'`
1723 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1724 (cd "$dir" && . ./$file)
dfe9444c
AD
1725 ;;
1726 *)
1727 . ./$file
1728 ;;
1729 esac
1730 ;;
1731 *)
1732 case "$file" in
1733 */*)
1734 dir=`expr X$file : 'X\(.*\)/'`
1735 file=`expr X$file : 'X.*/\(.*\)'`
1736 (set x $dir; shift; eval $mkdir_p)
6904989c 1737 sh <"$src/$dir/$file"
dfe9444c
AD
1738 ;;
1739 *)
6904989c 1740 sh <"$src/$file"
dfe9444c
AD
1741 ;;
1742 esac
1743 ;;
1744 esac
1745done
6904989c 1746if test -f "$src/config_h.SH"; then
dfe9444c
AD
1747 if test ! -f config.h; then
1748 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1749 . "$src/config_h.SH"
dfe9444c
AD
1750 fi
1751fi
1752EOS
1753
1754: extract files and exit if asked to do so
1755case "$extractsh" in
1756true)
1757 case "$realsilent" in
1758 true) ;;
1759 *) exec 1>&4;;
1760 esac
1761 case "$config_sh" in
1762 '') config_sh='config.sh';;
1763 esac
1764 echo " "
1765 echo "Fetching answers from $config_sh..."
1766 cd ..
1767 . $config_sh
1768 test "$override" && . ./optdef.sh
1769 echo " "
1770 . UU/extract
1771 rm -rf UU
24ccb310 1772 echo "Extraction done."
dfe9444c
AD
1773 exit 0
1774 ;;
1775esac
1776
1777: Eunice requires " " instead of "", can you believe it
1778echo " "
1779: Here we go...
1780echo "Beginning of configuration questions for $package."
1781
1782trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1783
2304df62
AD
1784: first determine how to suppress newline on echo command
1785echo " "
1786echo "Checking echo to see how to suppress newlines..."
1787(echo "hi there\c" ; echo " ") >.echotmp
1788if $contains c .echotmp >/dev/null 2>&1 ; then
1789 echo "...using -n."
1790 n='-n'
1791 c=''
1792else
1793 cat <<'EOM'
1794...using \c
1795EOM
1796 n=''
1797 c='\c'
1798fi
1799echo $n "The star should be here-->$c"
1800echo '*'
1801rm -f .echotmp
1802
1803: Now test for existence of everything in MANIFEST
1804echo " "
6904989c 1805if test -f "$rsrc/MANIFEST"; then
2304df62 1806 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1807 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1808 rm -f missing
dfe9444c 1809 tmppwd=`pwd`
2304df62 1810 for filelist in x??; do
6904989c 1811 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1812 done
1813 if test -s missing; then
1814 cat missing >&4
1815 cat >&4 <<'EOM'
1816
1817THIS PACKAGE SEEMS TO BE INCOMPLETE.
1818
1819You have the option of continuing the configuration process, despite the
1820distinct possibility that your kit is damaged, by typing 'y'es. If you
1821do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1822and contact the author (perlbug@perl.org).
2304df62
AD
1823
1824EOM
1825 echo $n "Continue? [n] $c" >&4
1826 read ans
1827 case "$ans" in
1828 y*)
1829 echo "Continuing..." >&4
1830 rm -f missing
1831 ;;
1832 *)
1833 echo "ABORTING..." >&4
1834 kill $$
1835 ;;
1836 esac
1837 else
dfe9444c 1838 echo "Looks good..."
2304df62
AD
1839 fi
1840else
1841 echo "There is no MANIFEST file. I hope your kit is complete !"
1842fi
1843rm -f missing x??
1844
5ff3f7a4
GS
1845echo " "
1846: Find the appropriate value for a newline for tr
1847if test -n "$DJGPP"; then
1848 trnl='\012'
1849fi
1850if test X"$trnl" = X; then
1851 case "`echo foo|tr '\n' x 2>/dev/null`" in
1852 foox) trnl='\n' ;;
1853 esac
1854fi
1855if test X"$trnl" = X; then
1856 case "`echo foo|tr '\012' x 2>/dev/null`" in
1857 foox) trnl='\012' ;;
1858 esac
1859fi
1860if test X"$trnl" = X; then
1861 cat <<EOM >&2
1862
1863$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1864
1865EOM
1866 exit 1
1867fi
1868
2304df62
AD
1869: compute the number of columns on the terminal for proper question formatting
1870case "$COLUMNS" in
1871'') COLUMNS='80';;
1872esac
1873
1874: set up the echo used in my read
1875myecho="case \"\$xxxm\" in
1876'') echo $n \"\$rp $c\" >&4;;
1877*) case \"\$rp\" in
1878 '') echo $n \"[\$xxxm] $c\";;
1879 *)
1880 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1881 echo \"\$rp\" >&4
1882 echo $n \"[\$xxxm] $c\" >&4
1883 else
1884 echo $n \"\$rp [\$xxxm] $c\" >&4
1885 fi
1886 ;;
1887 esac;;
1888esac"
1889
1890: now set up to do reads with possible shell escape and default assignment
1891cat <<EOSC >myread
28757baa 1892$startsh
2304df62
AD
1893xxxm=\$dflt
1894$myecho
1895ans='!'
1896case "\$fastread" in
1897yes) case "\$dflt" in
1898 '') ;;
1899 *) ans='';
1900 case "\$silent-\$rp" in
1901 true-) ;;
1902 *) echo " " >&4;;
1903 esac;;
1904 esac;;
1905*) case "\$silent" in
1906 true) case "\$rp" in
1907 '') ans='';;
1908 esac;;
1909 esac;;
1910esac
1911while expr "X\$ans" : "X!" >/dev/null; do
1912 read answ
1913 set x \$xxxm
1914 shift
dfe9444c 1915 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1916 case "\$answ" in
dfe9444c
AD
1917 "!")
1918 sh 1>&4
1919 echo " "
1920 $myecho
1921 ;;
1922 !*)
1923 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1924 shift
1925 sh 1>&4 -c "\$*"
1926 echo " "
1927 $myecho
1928 ;;
2304df62
AD
1929 "\$ans")
1930 case "\$ans" in
ecfc5424
AD
1931 \\&*)
1932 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1933 shift
1934 case "\$1" in
1935 -d)
1936 fastread=yes
40a7a20a 1937 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1938 ;;
1939 -*)
40a7a20a 1940 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1941 ;;
1942 esac
1943 $myecho
1944 ans=!
1945 ;;
2304df62
AD
1946 esac;;
1947 *)
1948 case "\$aok" in
1949 y)
1950 echo "*** Substitution done -- please confirm."
1951 xxxm="\$ans"
c9795ab7 1952 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1953 xxxm="\$ans"
1954 ans=!
1955 ;;
1956 *)
1957 echo "*** Error -- try again."
1958 ans=!
1959 ;;
1960 esac
1961 $myecho
1962 ;;
1963 esac
1964 case "\$ans\$xxxm\$nostick" in
1965 '')
1966 ans=!
1967 $myecho
1968 ;;
1969 esac
1970done
1971case "\$ans" in
1972'') ans="\$xxxm";;
1973esac
1974EOSC
1975
1976: create .config dir to save info across Configure sessions
1977test -d ../.config || mkdir ../.config
1978cat >../.config/README <<EOF
1979This directory created by Configure to save information that should
dfe9444c 1980persist across sessions for $package.
2304df62
AD
1981
1982You may safely delete it if you wish.
1983EOF
1984
9507cadf 1985xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1986case "$usedevel" in
0107c034 1987$define|true|[yY]*) ;;
9507cadf 1988*) case "$xversion" in
0107c034
JH
1989 *[13579])
1990 cat >&4 <<EOH
1991*** WHOA THERE!!! ***
1992
1993 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1994 The version of this $package distribution is $xversion, that is, odd,
1995 (as opposed to even) and that signifies a development release.
3d5d58b1 1996 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
1997
1998 Do ***NOT*** install this into production use.
1999 Data corruption and crashes are possible.
2000
2001 It is most seriously suggested that you do not continue any further
2002 unless you want to help in developing and debugging Perl.
2003
6adc6a45
JH
2004 If you *still* want to build perl, you can answer 'y' now,
2005 or pass -Dusedevel to Configure.
2006
0107c034
JH
2007EOH
2008 rp='Do you really want to continue?'
2009 dflt='n'
2010 . ./myread
2011 case "$ans" in
8feeef0e
JH
2012 [yY]) echo >&4 "Okay, continuing."
2013 usedevel="$define" ;;
0107c034
JH
2014 *) echo >&4 "Okay, bye."
2015 exit 1
2016 ;;
2017 esac
2018 ;;
2019 esac
2020 ;;
2021esac
8feeef0e
JH
2022case "$usedevel" in
2023$define|true|[yY]*)
2024 case "$versiononly" in
2025 '') versiononly="$define" ;;
2026 esac
2027 case "$installusrbinperl" in
2028 '') installusrbinperl="$undef" ;;
2029 esac
2030 ;;
2031esac
0107c034 2032
2304df62
AD
2033: general instructions
2034needman=true
2035firsttime=true
760ac839 2036user=`(logname) 2>/dev/null`
dfe9444c
AD
2037case "$user" in
2038'') user=`whoami 2>&1`;;
760ac839 2039esac
2304df62
AD
2040if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2041 firsttime=false
2042 echo " "
2043 rp='Would you like to see the instructions?'
2044 dflt=n
2045 . ./myread
2046 case "$ans" in
2047 [yY]*) ;;
2048 *) needman=false;;
2049 esac
2050fi
2051if $needman; then
2052 cat <<EOH
4e2a5f63 2053
2304df62 2054This installation shell script will examine your system and ask you questions
a0d0e21e 2055to determine how the perl5 package should be installed. If you get
2304df62
AD
2056stuck on a question, you may use a ! shell escape to start a subshell or
2057execute a command. Many of the questions will have default answers in square
2058brackets; typing carriage return will give you the default.
2059
2060On some of the questions which ask for file or directory names you are allowed
2061to use the ~name construct to specify the login directory belonging to "name",
2062even if you don't have a shell which knows about that. Questions where this is
2063allowed will be marked "(~name ok)".
2064
2065EOH
2066 rp=''
2067 dflt='Type carriage return to continue'
2068 . ./myread
2069 cat <<'EOH'
2070
2071The prompter used in this script allows you to use shell variables and
2072backticks in your answers. You may use $1, $2, etc... to refer to the words
2073in the default answer, as if the default line was a set of arguments given to a
2074script shell. This means you may also use $* to repeat the whole default line,
2075so you do not have to re-type everything to add something to the default.
2076
2077Everytime there is a substitution, you will have to confirm. If there is an
2078error (e.g. an unmatched backtick), the default answer will remain unchanged
2079and you will be prompted again.
2080
2081If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2082the questions and use the computed defaults (or the previous answers if there
2083was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2084You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2085on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2086
2087EOH
2088 . ./myread
2089 cat <<EOH
2090
2091Much effort has been expended to ensure that this shell script will run on any
2092Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2093Configure and run it again. If you can't run Configure for some reason,
2094you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2095have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2096
2097This installation script affects things in two ways:
2098
20991) it may do direct variable substitutions on some of the files included
2100 in this kit.
21012) it builds a config.h file for inclusion in C programs. You may edit
2102 any of these files as the need arises after running this script.
2103
2104If you make a mistake on a question, there is no easy way to back up to it
2105currently. The easiest thing to do is to edit config.sh and rerun all the SH
2106files. Configure will offer to let you do this before it runs the SH files.
2107
2108EOH
2109 dflt='Type carriage return to continue'
2110 . ./myread
2111 case "$firsttime" in
2112 true) echo $user >>../.config/instruct;;
2113 esac
2114fi
2115
2304df62
AD
2116: find out where common programs are
2117echo " "
2118echo "Locating common programs..." >&4
2119cat <<EOSC >loc
2120$startsh
2121case \$# in
21220) exit 1;;
2123esac
2124thing=\$1
2125shift
2126dflt=\$1
2127shift
2128for dir in \$*; do
2129 case "\$thing" in
2130 .)
2131 if test -d \$dir/\$thing; then
2132 echo \$dir
2133 exit 0
2134 fi
2135 ;;
2136 *)
a0d0e21e 2137 for thisthing in \$dir/\$thing; do
ecfc5424 2138 : just loop through to pick last item
a0d0e21e 2139 done
25f94b33 2140 if test -f \$thisthing; then
a0d0e21e 2141 echo \$thisthing
2304df62 2142 exit 0
a5a94ea5
JH
2143 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2144 echo \$thisthing
2145 exit 0
2304df62 2146 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2147 if test -n "$DJGPP"; then
2148 echo \$dir/\$thing.exe
2149 else
2150 : on Eunice apparently
2151 echo \$dir/\$thing
2152 fi
2304df62
AD
2153 exit 0
2154 fi
2155 ;;
2156 esac
2157done
2158echo \$dflt
2159exit 1
2160EOSC
2161chmod +x loc
2162$eunicefix loc
2163loclist="
2164awk
2165cat
f8006fac 2166chmod
b4eb6b3d
JH
2167comm
2168cp
2304df62
AD
2169echo
2170expr
2171grep
a0d0e21e 2172ls
b4eb6b3d 2173mkdir
2304df62
AD
2174rm
2175sed
b4eb6b3d 2176sort
85e6fe83 2177touch
2304df62 2178tr
b4eb6b3d 2179uniq
2304df62
AD
2180"
2181trylist="
2182Mcc
dfe9444c 2183ar
3659ebf1 2184bison
b4eb6b3d 2185byacc
2304df62 2186cpp
b4eb6b3d 2187csh
2304df62
AD
2188date
2189egrep
1fef16b3 2190gmake
8ff267be 2191gzip
b4eb6b3d 2192less
8ff267be 2193ln
3c728e00 2194make
b4eb6b3d 2195more
693762b4 2196nm
b4eb6b3d
JH
2197nroff
2198pg
2304df62
AD
2199test
2200uname
8ff267be 2201zip
2304df62 2202"
8e07c86e 2203pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2204pth="$pth /lib /usr/lib"
2205for file in $loclist; do
dfe9444c
AD
2206 eval xxx=\$$file
2207 case "$xxx" in
2208 /*|?:[\\/]*)
2209 if test -f "$xxx"; then
2210 : ok
2211 else
2212 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2213 xxx=`./loc $file $file $pth`
2214 fi
2215 ;;
2216 '') xxx=`./loc $file $file $pth`;;
2217 *) xxx=`./loc $xxx $xxx $pth`;;
2218 esac
a5a94ea5 2219 eval $file=$xxx$_exe
2304df62
AD
2220 eval _$file=$xxx
2221 case "$xxx" in
2222 /*)
2223 echo $file is in $xxx.
2224 ;;
8e07c86e
AD
2225 ?:[\\/]*)
2226 echo $file is in $xxx.
2227 ;;
2304df62 2228 *)
25f94b33
AD
2229 echo "I don't know where '$file' is, and my life depends on it." >&4
2230 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2231 exit 1
2304df62
AD
2232 ;;
2233 esac
2234done
2235echo " "
2236echo "Don't worry if any of the following aren't found..."
2237say=offhand
2238for file in $trylist; do
dfe9444c
AD
2239 eval xxx=\$$file
2240 case "$xxx" in
2241 /*|?:[\\/]*)
2242 if test -f "$xxx"; then
2243 : ok
2244 else
2245 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2246 xxx=`./loc $file $file $pth`
2247 fi
2248 ;;
2249 '') xxx=`./loc $file $file $pth`;;
2250 *) xxx=`./loc $xxx $xxx $pth`;;
2251 esac
306a8474 2252 eval $file=$xxx$_exe
2304df62
AD
2253 eval _$file=$xxx
2254 case "$xxx" in
2255 /*)
2256 echo $file is in $xxx.
2257 ;;
8e07c86e
AD
2258 ?:[\\/]*)
2259 echo $file is in $xxx.
2260 ;;
2304df62
AD
2261 *)
2262 echo "I don't see $file out there, $say."
2263 say=either
2264 ;;
2265 esac
2266done
2267case "$egrep" in
1fef16b3 2268egrep)
2304df62
AD
2269 echo "Substituting grep for egrep."
2270 egrep=$grep
868439a2 2271 _egrep=$grep
2304df62
AD
2272 ;;
2273esac
8ff267be 2274case "$ln" in
1fef16b3 2275ln)
8ff267be 2276 echo "Substituting cp for ln."
2277 ln=$cp
868439a2 2278 _ln=$cp
8ff267be 2279 ;;
2280esac
2e26f1d5
JH
2281case "$make" in
2282make)
2283 case "$gmake" in
2284 gmake)
2285 echo "I can't find make or gmake, and my life depends on it." >&4
2286 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2287 exit 1
2288 ;;
2289 esac
2290 ;;
2291esac
2292case "$gmake" in
2293gmake) ;;
2294*) # We can't have osname yet.
1fef16b3
JH
2295 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2296 # Assume that gmake, if found, is definitely GNU make
2297 # and prefer it over the system make.
2298 echo "Substituting gmake for make."
2299 make=$gmake
868439a2 2300 _make=$gmake
1fef16b3
JH
2301 fi
2302 ;;
a5a94ea5 2303esac
2304df62
AD
2304case "$test" in
2305test)
2306 echo "Hopefully test is built into your sh."
2307 ;;
2308*)
73614538 2309 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2310 echo "Using the test built into your sh."
2304df62
AD
2311 test=test
2312 _test=test
2313 fi
2314 ;;
2315esac
2316case "$echo" in
2317echo)
2318 echo "Hopefully echo is built into your sh."
2319 ;;
2320'') ;;
2321*)
2322 echo " "
2323echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2324 $echo $n "hi there$c" >foo1
2325 echo $n "hi there$c" >foo2
2326 if cmp foo1 foo2 >/dev/null 2>&1; then
2327 echo "They are compatible. In fact, they may be identical."
2328 else
2329 case "$n" in
2330 '-n') n='' c='\c';;
2331 *) n='-n' c='';;
2332 esac
2333 cat <<FOO
2334They are not compatible! You are probably running ksh on a non-USG system.
2335I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2336have echo built in and we may have to run some Bourne shell scripts. That
2337means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2338
2339FOO
2340 $echo $n "The star should be here-->$c"
2341 $echo "*"
2342 fi
2343 $rm -f foo1 foo2
2344 ;;
2345esac
2346
6b769f8f 2347cat <<EOS >trygcc
2573c5f9
JH
2348$startsh
2349EOS
6b769f8f 2350cat <<'EOSC' >>trygcc
2573c5f9
JH
2351case "$cc" in
2352'') ;;
2353*) $rm -f try try.*
2354 $cat >try.c <<EOM
2355int main(int argc, char *argv[]) {
2356 return 0;
2357}
2358EOM
e4778687 2359 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2360 :
2361 else
2362 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2363 despair=yes
2364 trygcc=yes
2365 case "$cc" in
2366 *gcc*) trygcc=no ;;
2367 esac
2368 case "`$cc -v -c try.c 2>&1`" in
2369 *gcc*) trygcc=no ;;
2370 esac
2371 if $test X"$trygcc" = Xyes; then
2372 if gcc -o try -c try.c; then
2373 echo " "
2374 echo "You seem to have a working gcc, though." >&4
2375 rp="Would you like to use it?"
2376 dflt=y
2377 if $test -f myread; then
2378 . ./myread
2379 else
2380 if $test -f UU/myread; then
2381 . ./UU/myread
2382 else
2383 echo "Cannot find myread, sorry. Aborting." >&2
2384 exit 1
2385 fi
2386 fi
2387 case "$ans" in
6371411c
RB
2388 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2389 if $test -f usethreads.cbu; then
2390 $cat >&4 <<EOM
2391
2392*** However, any setting of the C compiler flags (e.g. for thread support)
2393*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2394*** (together with e.g. -Dusethreads).
2395
2396EOM
2397 fi;;
2573c5f9
JH
2398 esac
2399 fi
2400 fi
6b769f8f
RB
2401 fi
2402 $rm -f try try.*
2403 ;;
2404esac
2405EOSC
2406
2407cat <<EOS >checkcc
2408$startsh
2409EOS
2410cat <<'EOSC' >>checkcc
2411case "$cc" in
2412'') ;;
2413*) $rm -f try try.*
2414 $cat >try.c <<EOM
2415int main(int argc, char *argv[]) {
2416 return 0;
2417}
2418EOM
2419 if $cc -o try $ccflags $ldflags try.c; then
2420 :
2421 else
2573c5f9 2422 if $test X"$despair" = Xyes; then
6b769f8f
RB
2423 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2424 fi
2425 $cat >&4 <<EOM
5dd4fbdf
MB
2426You need to find a working C compiler.
2427Either (purchase and) install the C compiler supplied by your OS vendor,
2428or for a free C compiler try http://gcc.gnu.org/
2429I cannot continue any further, aborting.
2430EOM
6b769f8f 2431 exit 1
2573c5f9
JH
2432 fi
2433 $rm -f try try.*
2434 ;;
2435esac
2436EOSC
2437
a0d0e21e
LW
2438: determine whether symbolic links are supported
2439echo " "
2440$touch blurfl
2441if $ln -s blurfl sym > /dev/null 2>&1 ; then
2442 echo "Symbolic links are supported." >&4
818f00be 2443 lns="$ln -s"
a0d0e21e
LW
2444else
2445 echo "Symbolic links are NOT supported." >&4
2446 lns="$ln"
2447fi
2448$rm -f blurfl sym
2449
dafca956
JH
2450: determine whether symbolic links are supported
2451echo " "
2452case "$lns" in
18ea2752 2453*"ln"*" -s")
dafca956
JH
2454 echo "Checking how to test for symbolic links..." >&4
2455 $lns blurfl sym
4b661809 2456 if $test "X$issymlink" = X; then
2e2a97a6
JH
2457 case "$newsh" in
2458 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2459 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2460 esac
5d644a95
MB
2461 if test $? = 0; then
2462 issymlink="test -h"
2e2a97a6
JH
2463 else
2464 echo "Your builtin 'test -h' may be broken." >&4
2465 case "$test" in
2466 /*) ;;
2467 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2468 for p in $pth
2469 do
2470 if test -f "$p/$test"; then
2471 test="$p/$test"
2472 break
2473 fi
2474 done
2475 ;;
2476 esac
2477 case "$test" in
2478 /*)
2479 echo "Trying external '$test -h'." >&4
2480 issymlink="$test -h"
2481 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2482 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2483 issymlink=''
2484 fi
2485 ;;
2486 *) issymlink='' ;;
2487 esac
5d644a95
MB
2488 fi
2489 fi
4b661809 2490 if $test "X$issymlink" = X; then
dafca956 2491 if $test -L sym 2>/dev/null; then
5d644a95 2492 issymlink="$test -L"
2e2a97a6 2493 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2494 fi
2495 fi
4b661809 2496 if $test "X$issymlink" != X; then
5d644a95 2497 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2498 else
2499 echo "I do not know how you can test for symbolic links." >&4
2500 fi
2501 $rm -f blurfl sym
2502 ;;
2503*) echo "No symbolic links, so not testing for their testing..." >&4
2504 ;;
2505esac
2506echo " "
2507
2508
2509case "$mksymlinks" in
2510$define|true|[yY]*)
2511 case "$src" in
2512 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2513 exit 1
2514 ;;
4b661809 2515 *) case "$lns:$issymlink" in
f314eb9f 2516 *"ln"*" -s:"*"test -"?)
dafca956
JH
2517 echo "Creating the symbolic links..." >&4
2518 echo "(First creating the subdirectories...)" >&4
2519 cd ..
2520 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2521 read directory
2522 test -z "$directory" && break
2523 mkdir -p $directory
2524 done
2525 # Sanity check 1.
2526 if test ! -d t/base; then
2527 echo "Failed to create the subdirectories. Aborting." >&4
2528 exit 1
2529 fi
2530 echo "(Then creating the symlinks...)" >&4
2531 awk '{print $1}' $src/MANIFEST | while true; do
2532 read filename
2533 test -z "$filename" && break
2534 if test -f $filename; then
5d644a95 2535 if $issymlink $filename; then
dafca956
JH
2536 rm -f $filename
2537 fi
2538 fi
2539 if test -f $filename; then
2540 echo "$filename already exists, not symlinking."
2541 else
2542 ln -s $src/$filename $filename
2543 fi
2544 done
2545 # Sanity check 2.
a0d24b8a
JH
2546 if test ! -f t/base/lex.t; then
2547 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2548 exit 1
2549 fi
2550 cd UU
2551 ;;
2552 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2553 ;;
2554 esac
2555 ;;
2556 esac
2557 ;;
2558esac
2559
5440bc8e
JH
2560
2561case "$usecrosscompile" in
2562$define|true|[yY]*)
93bc48fa 2563 $echo "Cross-compiling..."
5440bc8e
JH
2564 croak=''
2565 case "$cc" in
2566 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2567 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2568 ar=$targetarch-ar
2569 # leave out ld, choosing it is more complex
2570 nm=$targetarch-nm
2571 ranlib=$targetarch-ranlib
93bc48fa 2572 $echo 'extern int foo;' > try.c
f8006fac 2573 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2574 shift
2575 if $test $# -gt 0; then
2576 incpth="$incpth $*"
f8006fac
JH
2577 incpth="`$echo $incpth|$sed 's/^ //'`"
2578 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2579 for i in $*; do
f8006fac 2580 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2581 if $test -d $j; then
2582 libpth="$libpth $j"
2583 fi
2584 done
f8006fac
JH
2585 libpth="`$echo $libpth|$sed 's/^ //'`"
2586 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2587 fi
2588 $rm -f try.c
5440bc8e
JH
2589 ;;
2590 esac
2591 case "$targetarch" in
93bc48fa
JH
2592 '') echo "Targetarch not defined." >&4; croak=y ;;
2593 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2594 esac
2595 case "$incpth" in
93bc48fa 2596 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2597 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2598 esac
2599 case "$libpth" in
93bc48fa 2600 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2601 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2602 esac
93bc48fa
JH
2603 case "$usrinc" in
2604 '') for i in $incpth; do
2605 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2606 usrinc=$i
2607 echo "Guessing usrinc $usrinc." >&4
2608 break
2609 fi
2610 done
2611 case "$usrinc" in
2612 '') echo "Usrinc not defined." >&4; croak=y ;;
2613 esac
2614 ;;
2615 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2616 esac
93bc48fa
JH
2617 case "$targethost" in
2618 '') echo "Targethost not defined." >&4; croak=y ;;
2619 *) echo "Using targethost $targethost." >&4
5440bc8e 2620 esac
93bc48fa
JH
2621 locincpth=' '
2622 loclibpth=' '
5440bc8e 2623 case "$croak" in
93bc48fa 2624 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2625 esac
2626 case "$src" in
2627 /*) run=$src/Cross/run
93c0359c 2628 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2629 to=$src/Cross/to
2630 from=$src/Cross/from
2631 ;;
93bc48fa 2632 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2633 run=$pwd/Cross/run
f8006fac 2634 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2635 to=$pwd/Cross/to
2636 from=$pwd/Cross/from
2637 ;;
2638 esac
2639 case "$targetrun" in
2640 '') targetrun=ssh ;;
2641 esac
2642 case "$targetto" in
2643 '') targetto=scp ;;
2644 esac
2645 case "$targetfrom" in
2646 '') targetfrom=scp ;;
2647 esac
2648 run=$run-$targetrun
2649 to=$to-$targetto
2650 from=$from-$targetfrom
93bc48fa
JH
2651 case "$targetdir" in
2652 '') targetdir=/tmp
2653 echo "Guessing targetdir $targetdir." >&4
2654 ;;
2655 esac
5440bc8e 2656 case "$targetuser" in
93bc48fa
JH
2657 '') targetuser=root
2658 echo "Guessing targetuser $targetuser." >&4
2659 ;;
5440bc8e
JH
2660 esac
2661 case "$targetfrom" in
2662 scp) q=-q ;;
2663 *) q='' ;;
2664 esac
2665 case "$targetrun" in
2666 ssh|rsh)
2667 cat >$run <<EOF
2668#!/bin/sh
93c0359c
JH
2669case "\$1" in
2670-cwd)
2671 shift
2672 cwd=\$1
2673 shift
2674 ;;
2675esac
2676case "\$cwd" in
2677'') cwd=$targetdir ;;
2678esac
5440bc8e
JH
2679exe=\$1
2680shift
93c0359c
JH
2681if $test ! -f \$exe.xok; then
2682 $to \$exe
2683 $touch \$exe.xok
2684fi
2685$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2686EOF
2687 ;;
93bc48fa 2688 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2689 exit 1
2690 ;;
2691 esac
93c0359c
JH
2692 case "$targetmkdir" in
2693 */Cross/mkdir)
2694 cat >$targetmkdir <<EOF
2695#!/bin/sh
2696$targetrun -l $targetuser $targethost "mkdir -p \$@"
2697EOF
f8006fac 2698 $chmod a+rx $targetmkdir
93c0359c
JH
2699 ;;
2700 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2701 exit 1
2702 ;;
2703 esac
5440bc8e
JH
2704 case "$targetto" in
2705 scp|rcp)
2706 cat >$to <<EOF
2707#!/bin/sh
2708for f in \$@
2709do
93c0359c
JH
2710 case "\$f" in
2711 /*)
2712 $targetmkdir \`dirname \$f\`
2713 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2714 ;;
2715 *)
2716 $targetmkdir $targetdir/\`dirname \$f\`
2717 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2718 ;;
2719 esac
5440bc8e
JH
2720done
2721exit 0
2722EOF
2723 ;;
2724 cp) cat >$to <<EOF
2725#!/bin/sh
93c0359c
JH
2726for f in \$@
2727do
2728 case "\$f" in
2729 /*)
2730 $mkdir -p $targetdir/\`dirname \$f\`
2731 $cp \$f $targetdir/\$f || exit 1
2732 ;;
2733 *)
2734 $targetmkdir $targetdir/\`dirname \$f\`
2735 $cp \$f $targetdir/\$f || exit 1
2736 ;;
2737 esac
2738done
2739exit 0
5440bc8e
JH
2740EOF
2741 ;;
93bc48fa 2742 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2743 exit 1
2744 ;;
2745 esac
2746 case "$targetfrom" in
2747 scp|rcp)
2748 cat >$from <<EOF
2749#!/bin/sh
2750for f in \$@
2751do
93c0359c 2752 $rm -f \$f
5440bc8e
JH
2753 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2754done
2755exit 0
2756EOF
2757 ;;
2758 cp) cat >$from <<EOF
2759#!/bin/sh
2760for f in \$@
2761do
93c0359c 2762 $rm -f \$f
5440bc8e
JH
2763 cp $targetdir/\$f . || exit 1
2764done
2765exit 0
2766EOF
2767 ;;
93bc48fa 2768 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2769 exit 1
2770 ;;
2771 esac
93bc48fa
JH
2772 if $test ! -f $run; then
2773 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2774 else
f8006fac 2775 $chmod a+rx $run
5440bc8e 2776 fi
93bc48fa
JH
2777 if $test ! -f $to; then
2778 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2779 else
f8006fac 2780 $chmod a+rx $to
5440bc8e 2781 fi
93bc48fa
JH
2782 if $test ! -f $from; then
2783 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2784 else
f8006fac 2785 $chmod a+rx $from
5440bc8e 2786 fi
93bc48fa 2787 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2788 exit 1
2789 fi
2790 cat >&4 <<EOF
f8006fac
JH
2791Using '$run' for remote execution,
2792and '$from' and '$to'
93bc48fa 2793for remote file transfer.
5440bc8e
JH
2794EOF
2795 ;;
2796*) run=''
2797 to=:
2798 from=:
2799 usecrosscompile='undef'
2800 targetarch=''
2801 ;;
2802esac
2803
ecfc5424
AD
2804: see whether [:lower:] and [:upper:] are supported character classes
2805echo " "
ecfc5424
AD
2806case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2807ABYZ)
2808 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2809 up='[:upper:]'
2810 low='[:lower:]'
2811 ;;
28e8609d
JH
2812*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2813 # (0xc9 and 0xd1), therefore that is a nice testing point.
2814 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2815 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2816 ij) up='[A-Z]'
2817 low='[a-z]'
2818 ;;
2819 esac
2820 fi
2821 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2822 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2823 ij) up='A-Z'
2824 low='a-z'
2825 ;;
2826 esac
2827 fi
2828 if test "X$up" = X -o "X$low" = X; then
2829 case "`echo IJ | od -x 2>/dev/null`" in
2830 *C9D1*|*c9d1*)
2831 echo "Hey, this might be EBCDIC." >&4
2832 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2833 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2834 ij) up='[A-IJ-RS-Z]'
2835 low='[a-ij-rs-z]'
2836 ;;
2837 esac
2838 fi
2839 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2840 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2841 ij) up='A-IJ-RS-Z'
2842 low='a-ij-rs-z'
2843 ;;
2844 esac
2845 fi
2846 ;;
2847 esac
2848 fi
2849esac
3eaeeeae 2850case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2851ij)
2852 echo "Using $up and $low to convert case." >&4
2853 ;;
ecfc5424 2854*)
28e8609d
JH
2855 echo "I don't know how to translate letters from upper to lower case." >&4
2856 echo "Your tr is not acting any way I know of." >&4
2857 exit 1
2858 ;;
ecfc5424
AD
2859esac
2860: set up the translation script tr, must be called with ./tr of course
2861cat >tr <<EOSC
2862$startsh
2863case "\$1\$2" in
2864'[A-Z][a-z]') exec $tr '$up' '$low';;
2865'[a-z][A-Z]') exec $tr '$low' '$up';;
2866esac
2867exec $tr "\$@"
2868EOSC
2869chmod +x tr
2870$eunicefix tr
2871
2304df62
AD
2872: Try to determine whether config.sh was made on this system
2873case "$config_sh" in
2874'')
43999f95
JH
2875myuname=`$uname -a 2>/dev/null`
2876$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2877# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2878# because the A-Z/a-z are not consecutive.
a0d0e21e 2879myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2880 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2881newmyuname="$myuname"
2304df62 2882dflt=n
16d20bd9
AD
2883case "$knowitall" in
2884'')
2885 if test -f ../config.sh; then
2886 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2887 eval "`grep myuname= ../config.sh`"
2888 fi
2889 if test "X$myuname" = "X$newmyuname"; then
2890 dflt=y
2891 fi
2304df62 2892 fi
16d20bd9
AD
2893 ;;
2894*) dflt=y;;
2895esac
2304df62
AD
2896
2897: Get old answers from old config file if Configure was run on the
2898: same system, otherwise use the hints.
2899hint=default
2900cd ..
2901if test -f config.sh; then
16d20bd9
AD
2902 echo " "
2903 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2904 . UU/myread
2905 case "$ans" in
f83701cd
AD
2906 n*|N*) echo "OK, I'll ignore it."
2907 mv config.sh config.sh.old
2908 myuname="$newmyuname"
2909 ;;
2304df62 2910 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2911 tmp_n="$n"
2912 tmp_c="$c"
85cad39c 2913 tmp_sh="$sh"
2304df62
AD
2914 . ./config.sh
2915 cp config.sh UU
ecfc5424
AD
2916 n="$tmp_n"
2917 c="$tmp_c"
85cad39c 2918 : Older versions did not always set $sh. Catch re-use of such
2919 : an old config.sh.
2920 case "$sh" in
2921 '') sh="$tmp_sh" ;;
2922 esac
2304df62
AD
2923 hint=previous
2924 ;;
2925 esac
2926fi
2573c5f9 2927. ./UU/checkcc
2304df62
AD
2928if test ! -f config.sh; then
2929 $cat <<EOM
2930
4e2a5f63
AD
2931First time through, eh? I have some defaults handy for some systems
2932that need some extra help getting the Configure answers right:
2304df62
AD
2933
2934EOM
dfe9444c 2935 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2936 dflt=''
2937 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2938 : tests or hints, please send them to perlbug@perl.org
2304df62 2939 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2940 $test -f /irix && osname=irix
85e6fe83
LW
2941 $test -f /xenix && osname=sco_xenix
2942 $test -f /dynix && osname=dynix
2943 $test -f /dnix && osname=dnix
5f05dabc 2944 $test -f /lynx.os && osname=lynxos
2945 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2946 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2947 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2948 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2949 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2950 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2951 $test -d /usr/apollo/bin && osname=apollo
2952 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2953 $test -d /usr/include/minix && osname=minix
d54344fc 2954 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 2955 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2956 osname=machten
4633a7c4 2957 if $test -x /sbin/version; then
dfe9444c 2958 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2959 $sed -e 's/[A-Za-z]$//'`
2960 elif $test -x /usr/etc/version; then
dfe9444c 2961 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2962 $sed -e 's/[A-Za-z]$//'`
2963 else
2964 osvers="$2.$3"
2965 fi
2966 fi
aaacdc8b
GS
2967
2968 $test -f /sys/posix.dll &&
2969 $test -f /usr/bin/what &&
2970 set X `/usr/bin/what /sys/posix.dll` &&
2971 $test "$3" = UWIN &&
2972 osname=uwin &&
2973 osvers="$5"
2974
2304df62
AD
2975 if $test -f $uname; then
2976 set X $myuname
2977 shift
2978
2304df62 2979 case "$5" in
85e6fe83 2980 fps*) osname=fps ;;
2304df62
AD
2981 mips*)
2982 case "$4" in
85e6fe83
LW
2983 umips) osname=umips ;;
2984 *) osname=mips ;;
2304df62 2985 esac;;
85e6fe83
LW
2986 [23]100) osname=mips ;;
2987 next*) osname=next ;;
ecfc5424 2988 i386*)
c6912327
JH
2989 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2990 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2991 osname='sco'
2992 osvers=$tmp
2993 elif $test -f /etc/kconfig; then
ecfc5424 2994 osname=isc
bd628c73 2995 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2996 osvers=4
2997 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2998 osvers=3
2304df62 2999 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3000 osvers=2
ecfc5424
AD
3001 fi
3002 fi
2000072c 3003 tmp=''
ecfc5424 3004 ;;
c4f23d77
AD
3005 pc*)
3006 if test -n "$DJGPP"; then
3007 osname=dos
3008 osvers=djgpp
3009 fi
3010 ;;
2304df62
AD
3011 esac
3012
3013 case "$1" in
a0d0e21e
LW
3014 aix) osname=aix
3015 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3016 case "$tmp" in
1aef975c 3017 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
3018 '<3240'|'<>3240') osvers=3.2.0 ;;
3019 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3020 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3021 *) osvers=$tmp;;
a0d0e21e
LW
3022 esac
3023 ;;
aaacdc8b
GS
3024 bsd386) osname=bsd386
3025 osvers=`$uname -r`
3026 ;;
3027 cygwin*) osname=cygwin
3028 osvers="$3"
3029 ;;
23f87696
SZ
3030 *dc.osx) osname=dcosx
3031 osvers="$3"
3032 ;;
a0d0e21e
LW
3033 dnix) osname=dnix
3034 osvers="$3"
3035 ;;
3036 domainos) osname=apollo
3037 osvers="$3"
3038 ;;
3039 dgux) osname=dgux
3040 osvers="$3"
3041 ;;
760ac839 3042 dynixptx*) osname=dynixptx
e58e581d 3043 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3044 ;;
a0d0e21e
LW
3045 freebsd) osname=freebsd
3046 osvers="$3" ;;
3047 genix) osname=genix ;;
3048 hp*) osname=hpux
bfb7748a 3049 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3050 ;;
a78b0d02 3051 irix*) osname=irix
a0d0e21e
LW
3052 case "$3" in
3053 4*) osvers=4 ;;
3054 5*) osvers=5 ;;
ecfc5424 3055 *) osvers="$3" ;;
a0d0e21e
LW
3056 esac
3057 ;;
3058 linux) osname=linux
3059 case "$3" in
a0d0e21e
LW
3060 *) osvers="$3" ;;
3061 esac
3062 ;;
28e8609d
JH
3063 MiNT) osname=mint
3064 ;;
3065 netbsd*) osname=netbsd
ecfc5424
AD
3066 osvers="$3"
3067 ;;
4e81affe
MM
3068 news-os) osvers="$3"
3069 case "$3" in
3070 4*) osname=newsos4 ;;
3071 *) osname=newsos ;;
3072 esac
3073 ;;
aaacdc8b 3074 next*) osname=next ;;
28bb1e2c 3075 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3076 openbsd) osname=openbsd
3077 osvers="$3"
3078 ;;
aaacdc8b
GS
3079 POSIX-BC | posix-bc ) osname=posix-bc
3080 osvers="$3"
a0d0e21e 3081 ;;
ae3afa4e
TH
3082 powerux | power_ux | powermax_os | powermaxos | \
3083 powerunix | power_unix) osname=powerux
3084 osvers="$3"
3085 ;;
aaacdc8b
GS
3086 qnx) osname=qnx
3087 osvers="$4"
3088 ;;
a0d0e21e
LW
3089 solaris) osname=solaris
3090 case "$3" in
3091 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3092 *) osvers="$3" ;;
a0d0e21e
LW
3093 esac
3094 ;;
85e6fe83
LW
3095 sunos) osname=sunos
3096 case "$3" in
85e6fe83
LW
3097 5*) osname=solaris
3098 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3099 *) osvers="$3" ;;
2304df62
AD
3100 esac
3101 ;;
a0d0e21e 3102 titanos) osname=titanos
85e6fe83 3103 case "$3" in
a0d0e21e
LW
3104 1*) osvers=1 ;;
3105 2*) osvers=2 ;;
3106 3*) osvers=3 ;;
3107 4*) osvers=4 ;;
ecfc5424 3108 *) osvers="$3" ;;
2304df62
AD
3109 esac
3110 ;;
85e6fe83 3111 ultrix) osname=ultrix
ecfc5424 3112 osvers="$3"
2304df62 3113 ;;
28757baa 3114 osf1|mls+) case "$5" in
fed7345c
AD
3115 alpha)
3116 osname=dec_osf
2aa76180
JH
3117 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3118 case "$osvers" in
3119 [1-9].[0-9]*) ;;
3120 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3121 esac
ecfc5424
AD
3122 ;;
3123 hp*) osname=hp_osf1 ;;
3124 mips) osname=mips_osf1 ;;
85e6fe83
LW
3125 esac
3126 ;;
0337d152
BG
3127 unixware) osname=svr5
3128 osvers="$4"
3129 ;;
3c728e00 3130 uts) osname=uts
a0d0e21e
LW
3131 osvers="$3"
3132 ;;
3c728e00
JH
3133 vos) osvers="$3"
3134 ;;
85e6fe83 3135 $2) case "$osname" in
2304df62 3136 *isc*) ;;
a0d0e21e 3137 *freebsd*) ;;
5f05dabc 3138 svr*)
a0d0e21e
LW
3139 : svr4.x or possibly later
3140 case "svr$3" in
3141 ${osname}*)
3142 osname=svr$3
3143 osvers=$4
3144 ;;
3145 esac
3146 case "$osname" in
3147 svr4.0)
3148 : Check for ESIX
3149 if test -f /stand/boot ; then
3150 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3151 if test -n "$INITPROG" -a -f "$INITPROG"; then
3152 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3153 if test -n "$isesix"; then
a0d0e21e
LW
3154 osname=esix4
3155 fi
3156 fi
3157 fi
3158 ;;
3159 esac
3160 ;;
2304df62 3161 *) if test -f /etc/systemid; then
a0d0e21e
LW
3162 osname=sco
3163 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3164 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3165 osvers=$1.$2.$3
c4f23d77 3166 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3167 osvers=$1.$2
c4f23d77 3168 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3169 osvers=$1
2304df62 3170 fi
a0d0e21e
LW
3171 else
3172 case "$osname" in
3173 '') : Still unknown. Probably a generic Sys V.
3174 osname="sysv"
3175 osvers="$3"
3176 ;;
3177 esac
2304df62
AD
3178 fi
3179 ;;
3180 esac
3181 ;;
a0d0e21e
LW
3182 *) case "$osname" in
3183 '') : Still unknown. Probably a generic BSD.
3184 osname="$1"
3185 osvers="$3"
3186 ;;
3187 esac
3188 ;;
2304df62
AD
3189 esac
3190 else
dfe9444c
AD
3191 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3192 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3193 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3194 osname=news_os
2304df62 3195 fi
dfe9444c 3196 $rm -f UU/kernel.what
8e07c86e
AD
3197 elif test -d c:/.; then
3198 set X $myuname
3199 osname=os2
3200 osvers="$5"
2304df62
AD
3201 fi
3202 fi
85e6fe83 3203
5440bc8e
JH
3204 case "$targetarch" in
3205 '') ;;
3206 *) hostarch=$osname
3207 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3208 osvers=''
3209 ;;
3210 esac
3211
a0d0e21e
LW
3212 : Now look for a hint file osname_osvers, unless one has been
3213 : specified already.
3214 case "$hintfile" in
3215 ''|' ')
1e127011 3216 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3217 : Also try without trailing minor version numbers.
1e127011
DD
3218 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3219 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3220 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3221 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3222 case "$file" in
3223 '') dflt=none ;;
3224 *) case "$osvers" in
3225 '') dflt=$file
3226 ;;
dfe9444c 3227 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3228 dflt=$file
dfe9444c 3229 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3230 dflt=$xfile
dfe9444c 3231 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3232 dflt=$xxfile
dfe9444c 3233 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3234 dflt=$xxxfile
dfe9444c 3235 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3236 dflt=$xxxxfile
dfe9444c 3237 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3238 dflt="${osname}"
3239 else
3240 dflt=none
3241 fi
3242 ;;
3243 esac
85e6fe83
LW
3244 ;;
3245 esac
4e2a5f63
AD
3246 if $test -f Policy.sh ; then
3247 case "$dflt" in
3248 *Policy*) ;;
3249 none) dflt="Policy" ;;
3250 *) dflt="Policy $dflt" ;;
3251 esac
3252 fi
85e6fe83 3253 ;;
a0d0e21e 3254 *)
ecfc5424 3255 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3256 ;;
2304df62 3257 esac
1aef975c 3258
4e2a5f63
AD
3259 if $test -f Policy.sh ; then
3260 $cat <<EOM
3261
3262There's also a Policy hint file available, which should make the
3263site-specific (policy) questions easier to answer.
3264EOM
3265
3266 fi
3267
2304df62
AD
3268 $cat <<EOM
3269
3270You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3271A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3272is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3273
3274EOM
4e2a5f63 3275
2304df62 3276 rp="Which of these apply, if any?"
dfe9444c 3277 . UU/myread
85e6fe83
LW
3278 tans=$ans
3279 for file in $tans; do
4e2a5f63
AD
3280 if $test X$file = XPolicy -a -f Policy.sh; then
3281 . Policy.sh
3282 $cat Policy.sh >> UU/config.sh
3283 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3284 . $src/hints/$file.sh
3285 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3286 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3287 : nothing
3288 else
85e6fe83
LW
3289 : Give one chance to correct a possible typo.
3290 echo "$file.sh does not exist"
3291 dflt=$file
3292 rp="hint to use instead?"
dfe9444c 3293 . UU/myread
85e6fe83 3294 for file in $ans; do
dfe9444c
AD
3295 if $test -f "$src/hints/$file.sh"; then
3296 . $src/hints/$file.sh
3297 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3298 elif $test X$ans = X -o X$ans = Xnone ; then
3299 : nothing
3300 else
3301 echo "$file.sh does not exist -- ignored."
3302 fi
3303 done
2304df62
AD
3304 fi
3305 done
85e6fe83 3306
2304df62 3307 hint=recommended
85e6fe83 3308 : Remember our hint file for later.
dfe9444c 3309 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3310 hintfile="$file"
85e6fe83 3311 else
a0d0e21e 3312 hintfile=''
85e6fe83 3313 fi
2304df62
AD
3314fi
3315cd UU
3316;;
3317*)
3318 echo " "
3319 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3320 tmp_n="$n"
3321 tmp_c="$c"
2304df62
AD
3322 cd ..
3323 cp $config_sh config.sh 2>/dev/null
a78b0d02 3324 chmod +w config.sh
2304df62
AD
3325 . ./config.sh
3326 cd UU
3327 cp ../config.sh .
ecfc5424
AD
3328 n="$tmp_n"
3329 c="$tmp_c"
2304df62
AD
3330 hint=previous
3331 ;;
3332esac
1aef975c 3333test "$override" && . ./optdef.sh
2304df62
AD
3334
3335: Restore computed paths
3336for file in $loclist $trylist; do
3337 eval $file="\$_$file"
3338done
3339
85e6fe83 3340cat << EOM
a0d0e21e 3341
85e6fe83 3342Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3343The default value is probably right if the name rings a bell. Otherwise,
3344since spelling matters for me, either accept the default or answer "none"
3345to leave it blank.
a0d0e21e 3346
85e6fe83 3347EOM
85e6fe83 3348case "$osname" in
a0d0e21e 3349 ''|' ')
85e6fe83 3350 case "$hintfile" in
a0d0e21e 3351 ''|' '|none) dflt=none ;;
ecfc5424 3352 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3353 esac
3354 ;;
3355 *) dflt="$osname" ;;
3356esac
3357rp="Operating system name?"
3358. ./myread
3359case "$ans" in
ecfc5424
AD
3360none) osname='' ;;
3361*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3362esac
8ff267be 3363echo " "
3364case "$osvers" in
3365 ''|' ')
3366 case "$hintfile" in
3367 ''|' '|none) dflt=none ;;
3368 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3369 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3370 case "$dflt" in
3371 ''|' ') dflt=none ;;
3372 esac
3373 ;;
3374 esac
3375 ;;
3376 *) dflt="$osvers" ;;
3377esac
3378rp="Operating system version?"
3379. ./myread
3380case "$ans" in
3381none) osvers='' ;;
3382*) osvers="$ans" ;;
3383esac
3384
02e93a22
JH
3385
3386. ./posthint.sh
3387
2304df62 3388: who configured the system
59b83a6f 3389cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3390cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3391case "$cf_by" in
3392"")
8ff267be 3393 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3394 case "$cf_by" in
3395 "") cf_by=unknown ;;
8ff267be 3396 esac ;;
3397esac
2304df62 3398
b4eb6b3d
JH
3399: set up the script used to warn in case of inconsistency
3400cat <<EOS >whoa
3401$startsh
3402EOS
3403cat <<'EOSC' >>whoa
3404dflt=y
3405echo " "
3406echo "*** WHOA THERE!!! ***" >&4
3407echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3408rp=" Keep the $hint value?"
3409. ./myread
3410case "$ans" in
3411y) td=$was; tu=$was;;
3412esac
3413EOSC
3414
3415: function used to set $1 to $val
3416setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3417case "$val$was" in
3418$define$undef) . ./whoa; eval "$var=\$td";;
3419$undef$define) . ./whoa; eval "$var=\$tu";;
3420*) eval "$var=$val";;
3421esac'
3422
3423case "$usethreads" in
3424$define|true|[yY]*) dflt='y';;
8e285145
AD
3425*) # Catch case where user specified ithreads or 5005threads but
3426 # forgot -Dusethreads (A.D. 4/2002)
3427 case "$useithreads$use5005threads" in
3428 *$define*) dflt='y' ;;
3429 *) dflt='n';;
3430 esac
3431 ;;
b4eb6b3d
JH
3432esac
3433cat <<EOM
3434
3435Perl can be built to take advantage of threads on some systems.
3436To do so, Configure can be run with -Dusethreads.
3437
3438Note that threading is a highly experimental feature, and
3439some known race conditions still remain. If you choose to try
3440it, be very sure to not actually deploy it for production
3441purposes. README.threads has more details, and is required
3442reading if you enable threads.
3443
3444If this doesn't make any sense to you, just accept the default '$dflt'.
3445EOM
3446rp='Build a threading Perl?'
3447. ./myread
3448case "$ans" in
3449y|Y) val="$define" ;;
3450*) val="$undef" ;;
3451esac
3452set usethreads
3453eval $setvar
3454
3455case "$usethreads" in
3456$define)
3457 $cat <<EOM
3458
6d5328bc
JH
3459As of release 5.6, Perl has two different threading implementations,
3460an interpreter-based version (ithreads) with one interpreter per
3461thread, and the 5.005 version (5005threads). Both implementations
3462are considered experimental, but since 5.8 ithreads somewhat less so.
3463The 5005threads is effectively unmaintained.
b4eb6b3d 3464
b4eb6b3d
JH
3465EOM
3466 : Default to ithreads unless overridden on command line or with
3467 : old config.sh
3468 dflt='y'
3469 case "$use5005threads" in
3470 $define|true|[yY]*) dflt='n';;
3471 esac
3472 case "$useithreads" in
3473 $undef|false|[nN]*) dflt='n';;
3474 esac
3475 rp='Use interpreter-based ithreads?'
3476 . ./myread
3477 case "$ans" in
3478 y|Y) val="$define" ;;
3479 *) val="$undef" ;;
3480 esac
3481 set useithreads
3482 eval $setvar
3483 : Now set use5005threads to the opposite value.
3484 case "$useithreads" in
3485 $define) val="$undef" ;;
3486 *) val="$define" ;;
3487 esac
3488 set use5005threads
3489 eval $setvar
3490 ;;
3491*)
3492 useithreads="$undef"
3493 use5005threads="$undef"
3494 ;;
3495esac
3496
c915ce7f
JH
3497case "$useithreads$use5005threads" in
3498"$define$define")
3499 $cat >&4 <<EOM
3500
3501You cannot have both the ithreads and the 5.005 threads enabled
3502at the same time. Disabling the 5.005 threads since they are
3503much less stable than the ithreads.
3504
3505EOM
3506 use5005threads="$undef"
3507 ;;
3508esac
3509
b4eb6b3d
JH
3510case "$d_oldpthreads" in
3511'') : Configure tests would be welcome here. For now, assume undef.
3512 val="$undef" ;;
3513*) val="$d_oldpthreads" ;;
3514esac
3515set d_oldpthreads
3516eval $setvar
3517
3518
3519case "$usethreads" in
3520"$define"|true|[yY]*)
3521: Look for a hint-file generated 'call-back-unit'. If the
3522: user has specified that a threading perl is to be built,
3523: we may need to set or change some other defaults.
3524 if $test -f usethreads.cbu; then
3525 echo "Your platform has some specific hints for threaded builds, using them..."
3526 . ./usethreads.cbu
3527 else
3528 $cat <<EOM
3529(Your platform doesn't have any specific hints for threaded builds.
3530 Assuming POSIX threads, then.)
3531EOM
3532 fi
3533 ;;
3534esac
3535
3536cat <<EOM
3537
3538Perl can be built so that multiple Perl interpreters can coexist
3539within the same Perl executable.
3540EOM
3541
3542case "$useithreads" in
3543$define)
3544 cat <<EOM
3545This multiple interpreter support is required for interpreter-based threads.
3546EOM
3547 val="$define"
3548 ;;
3549*) case "$usemultiplicity" in
3550 $define|true|[yY]*) dflt='y';;
3551 *) dflt='n';;
3552 esac
3553 echo " "
3554 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3555 rp='Build Perl for multiplicity?'
3556 . ./myread
3557 case "$ans" in
3558 y|Y) val="$define" ;;
3559 *) val="$undef" ;;
3560 esac
3561 ;;
3562esac
3563set usemultiplicity
3564eval $setvar
3565
96056487
JH
3566
3567case "$usemorebits" in
3568"$define"|true|[yY]*)
3569 use64bitint="$define"
3570 uselongdouble="$define"
3571 usemorebits="$define"
3572 ;;
3573*) usemorebits="$undef"
3574 ;;
3575esac
3576
e5e20432
JH
3577: make some quick guesses about what we are up against
3578echo " "
3579$echo $n "Hmm... $c"
3580echo exit 1 >bsd
3581echo exit 1 >usg
3582echo exit 1 >v7
3583echo exit 1 >osf1
3584echo exit 1 >eunice
3585echo exit 1 >xenix
3586echo exit 1 >venix
3587echo exit 1 >os2
3588d_bsd="$undef"
3589$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3590if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3591then
3592 echo "Looks kind of like an OSF/1 system, but we'll see..."
3593 echo exit 0 >osf1
381aa1ff 3594elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3595 xxx=`./loc addbib blurfl $pth`
3596 if $test -f $xxx; then
3597 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3598 echo exit 0 >bsd
3599 echo exit 0 >usg
3600 else
3601 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3602 echo "Looks kind of like an extended USG system, but we'll see..."
3603 else
3604 echo "Looks kind of like a USG system, but we'll see..."
3605 fi
3606 echo exit 0 >usg
3607 fi
3608elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3609 echo "Looks kind of like a BSD system, but we'll see..."
3610 d_bsd="$define"
3611 echo exit 0 >bsd
3612else
3613 echo "Looks kind of like a Version 7 system, but we'll see..."
3614 echo exit 0 >v7
3615fi
3616case "$eunicefix" in
3617*unixtovms*)
3618 $cat <<'EOI'
3619There is, however, a strange, musty smell in the air that reminds me of
3620something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3621EOI
3622 echo exit 0 >eunice
3623 d_eunice="$define"
3624: it so happens the Eunice I know will not run shell scripts in Unix format
3625 ;;
3626*)
3627 echo " "
3628 echo "Congratulations. You aren't running Eunice."
3629 d_eunice="$undef"
3630 ;;
3631esac
3632: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3633: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3634: semicolon as a patch separator
e5e20432
JH
3635case "$p_" in
3636:) ;;
3637*)
3638 $cat <<'EOI'
3639I have the feeling something is not exactly right, however...don't tell me...
3640lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3641(Or you may be running DOS with DJGPP.)
e5e20432
JH
3642EOI
3643 echo exit 0 >os2
3644 ;;
3645esac
3646if test -f /xenix; then
3647 echo "Actually, this looks more like a XENIX system..."
3648 echo exit 0 >xenix
3649 d_xenix="$define"
3650else
3651 echo " "
3652 echo "It's not Xenix..."
3653 d_xenix="$undef"
3654fi
3655chmod +x xenix
3656$eunicefix xenix
3657if test -f /venix; then
3658 echo "Actually, this looks more like a VENIX system..."
3659 echo exit 0 >venix
3660else
3661 echo " "
3662 if ./xenix; then
3663 : null
3664 else
3665 echo "Nor is it Venix..."
3666 fi
3667fi
3668chmod +x bsd usg v7 osf1 eunice xenix venix os2
3669$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3670$rm -f foo
3671
5869b1f1
JH
3672case "$cc" in
3673'') dflt=cc;;
3674*) dflt="$cc";;
3675esac
3676rp="Use which C compiler?"
3677. ./myread
3678cc="$ans"
6b769f8f
RB
3679
3680: See if they have not cc but they do have gcc
3681. ./trygcc
e5e20432
JH
3682: Look for a hint-file generated 'call-back-unit'. Now that the
3683: user has specified the compiler, we may need to set or change some
3684: other defaults.
3685if $test -f cc.cbu; then
3686 . ./cc.cbu
3687fi
2573c5f9 3688. ./checkcc
8a27cf78 3689
e5e20432
JH
3690echo " "
3691echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3692$cat >try.c <<EOM
e5e20432
JH
3693#include <stdio.h>
3694int main() {
3695#ifdef __GNUC__
3696#ifdef __VERSION__
3697 printf("%s\n", __VERSION__);
3698#else
3699 printf("%s\n", "1");
3700#endif
3701#endif
3702 exit(0);
3703}
3704EOM
5440bc8e
JH
3705if $cc -o try $ccflags $ldflags try.c; then
3706 gccversion=`$run ./try`
e5e20432
JH
3707 case "$gccversion" in
3708 '') echo "You are not using GNU cc." ;;
fc68435e 3709 *) echo "You are using GNU cc $gccversion."
e723fc21 3710 ccname=gcc
fc68435e 3711 ;;
e5e20432
JH
3712 esac
3713else
3714 echo " "
3715 echo "*** WHOA THERE!!! ***" >&4
3716 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3717 case "$knowitall" in
3718 '')
3719 echo " You'd better start hunting for one and let me know about it." >&4
3720 exit 1
3721 ;;
3722 esac
3723fi
5440bc8e 3724$rm -f try try.*
e5e20432
JH
3725case "$gccversion" in
37261*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3727esac
5b463ca7
KS
3728case "$gccversion" in
3729'') gccosandvers='' ;;
10b4ebb5
JH
3730*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3731 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3732 gccshortvers=''
5b463ca7 3733 case "$gccosandvers" in
02903077
JH
3734 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3735 $osname$osvers) ;; # looking good
5b463ca7
KS
3736 $osname*) cat <<EOM >&4
3737
3738*** WHOA THERE!!! ***
3739
3740 Your gcc has not been compiled for the exact release of
3741 your operating system ($gccosandvers versus $osname$osvers).
3742
3743 In general it is a good idea to keep gcc synchronized with
3744 the operating system because otherwise serious problems
3745 may ensue when trying to compile software, like Perl.
3746
3747 I'm trying to be optimistic here, though, and will continue.
3748 If later during the configuration and build icky compilation
02903077
JH
3749 problems appear (headerfile conflicts being the most common
3750 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3751 your operating system release.
3752
3753EOM
3754 ;;
81575342 3755 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3756 esac
3757 ;;
3758esac
e723fc21
JH
3759case "$ccname" in
3760'') ccname="$cc" ;;
3761esac
e5e20432 3762
640374d0 3763
bd9b35c9
JH
3764: decide how portable to be. Allow command line overrides.
3765case "$d_portable" in
3766"$undef") ;;
3767*) d_portable="$define" ;;
104d25b7 3768esac
85ab1d1d 3769
bd9b35c9
JH
3770: set up shell script to do ~ expansion
3771cat >filexp <<EOSS
3772$startsh
3773: expand filename
3774case "\$1" in
3775 ~/*|~)
3776 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3777 ;;
3778 ~*)
3779 if $test -f /bin/csh; then
3780 /bin/csh -f -c "glob \$1"
3781 failed=\$?
3782 echo ""
3783 exit \$failed
e5e20432 3784 else
bd9b35c9
JH
3785 name=\`$expr x\$1 : '..\([^/]*\)'\`
3786 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3787 if $test ! -d "\$dir"; then
3788 me=\`basename \$0\`
3789 echo "\$me: can't locate home directory for: \$name" >&2
3790 exit 1
3791 fi
3792 case "\$1" in
3793 */*)
3794 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3795 ;;
3796 *)
3797 echo \$dir
e5e20432
JH
3798 ;;
3799 esac
3800 fi
b691c02f 3801 ;;
4633a7c4 3802*)
bd9b35c9 3803 echo \$1
2304df62
AD
3804 ;;
3805esac
4633a7c4
LW
3806EOSS
3807chmod +x filexp
3808$eunicefix filexp
2304df62
AD
3809
3810: now set up to get a file name
28757baa 3811cat <<EOS >getfile
3812$startsh
3813EOS
3814cat <<'EOSC' >>getfile
2304df62
AD
3815tilde=''
3816fullpath=''
3817already=''
3818skip=''
3819none_ok=''
3820exp_file=''
a0d0e21e 3821nopath_ok=''
2304df62
AD
3822orig_rp="$rp"
3823orig_dflt="$dflt"
b233458b
JH
3824case "$gfpth" in
3825'') gfpth='.' ;;
3826esac
2304df62
AD
3827
3828case "$fn" in
ecfc5424 3829*\(*)
381aa1ff 3830 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3831 fn=`echo $fn | sed 's/(.*)//'`
3832 ;;
3833esac
3834
3835case "$fn" in
a0d0e21e
LW
3836*:*)
3837 loc_file=`expr $fn : '.*:\(.*\)'`
3838 fn=`expr $fn : '\(.*\):.*'`
3839 ;;
3840esac
3841
3842case "$fn" in
2304df62
AD
3843*~*) tilde=true;;
3844esac
3845case "$fn" in
3846*/*) fullpath=true;;
3847esac
3848case "$fn" in
3849*+*) skip=true;;
3850esac
3851case "$fn" in
3852*n*) none_ok=true;;
3853esac
3854case "$fn" in
3855*e*) exp_file=true;;
3856esac
a0d0e21e
LW
3857case "$fn" in
3858*p*) nopath_ok=true;;
3859esac
2304df62
AD
3860
3861case "$fn" in
3862*f*) type='File';;
3863*d*) type='Directory';;
a0d0e21e 3864*l*) type='Locate';;
2304df62
AD
3865esac
3866
3867what="$type"
3868case "$what" in
3869Locate) what='File';;
3870esac
3871
3872case "$exp_file" in
3873'')
3874 case "$d_portable" in
3875 "$define") ;;
3876 *) exp_file=true;;
3877 esac
3878 ;;
3879esac
3880
3881cd ..
3882while test "$type"; do
3883 redo=''
3884 rp="$orig_rp"
3885 dflt="$orig_dflt"
3886 case "$tilde" in
3887 true) rp="$rp (~name ok)";;
3888 esac
3889 . UU/myread
ecfc5424
AD
3890 if test -f UU/getfile.ok && \
3891 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3892 then
3893 value="$ans"
3894 ansexp="$ans"
3895 break
3896 fi
2304df62
AD
3897 case "$ans" in
3898 none)
3899 value=''
3900 ansexp=''
3901 case "$none_ok" in
3902 true) type='';;
3903 esac
3904 ;;
3905 *)
3906 case "$tilde" in
3907 '') value="$ans"
3908 ansexp="$ans";;
3909 *)
3910 value=`UU/filexp $ans`
3911 case $? in
3912 0)
3913 if test "$ans" != "$value"; then
ecfc5424 3914 echo "(That expands to $value on this system.)"
2304df62
AD
3915 fi
3916 ;;
3917 *) value="$ans";;
3918 esac
3919 ansexp="$value"
3920 case "$exp_file" in
3921 '') value="$ans";;
3922 esac
3923 ;;
3924 esac
3925 case "$fullpath" in
3926 true)
3927 case "$ansexp" in
3928 /*) value="$ansexp" ;;
23da6c43 3929 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3930 *)
3931 redo=true
3932 case "$already" in
3933 true)
3934 echo "I shall only accept a full path name, as in /bin/ls." >&4
3935 echo "Use a ! shell escape if you wish to check pathnames." >&4
3936 ;;
3937 *)
3938 echo "Please give a full path name, starting with slash." >&4
3939 case "$tilde" in
3940 true)
3941 echo "Note that using ~name is ok provided it expands well." >&4
3942 already=true
3943 ;;
3944 esac
3945 esac
3946 ;;
3947 esac
3948 ;;
3949 esac
3950 case "$redo" in
3951 '')
3952 case "$type" in
3953 File)
b233458b
JH
3954 for fp in $gfpth; do
3955 if test "X$fp" = X.; then
3956 pf="$ansexp"
3957 else
3958 pf="$fp/$ansexp"
3959 fi
3960 if test -f "$pf"; then
3961 type=''
3962 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3963 then
3964 echo "($value is not a plain file, but that's ok.)"
3965 type=''
3966 fi
3967 if test X"$type" = X; then
3968 value="$pf"
3969 break
3970 fi
3971 done
2304df62
AD
3972 ;;
3973 Directory)
b233458b
JH
3974 for fp in $gfpth; do
3975 if test "X$fp" = X.; then
f78bfc9c
JH
3976 dir="$ans"
3977 direxp="$ansexp"
b233458b 3978 else
dd858076 3979 dir="$fp/$ansexp"
f78bfc9c 3980 direxp="$fp/$ansexp"
b233458b 3981 fi
f78bfc9c 3982 if test -d "$direxp"; then
b233458b 3983 type=''
f78bfc9c 3984 value="$dir"
b233458b
JH
3985 break
3986 fi
3987 done
2304df62
AD
3988 ;;
3989 Locate)
40000a8c 3990 if test -d "$ansexp"; then
a0d0e21e
LW
3991 echo "(Looking for $loc_file in directory $value.)"
3992 value="$value/$loc_file"
40000a8c 3993 ansexp="$ansexp/$loc_file"
2304df62 3994 fi
40000a8c 3995 if test -f "$ansexp"; then
2304df62
AD
3996 type=''
3997 fi
a0d0e21e
LW
3998 case "$nopath_ok" in
3999 true) case "$value" in
4000 */*) ;;
4001 *) echo "Assuming $value will be in people's path."
4002 type=''
4003 ;;
4004 esac
4005 ;;
4006 esac
2304df62
AD
4007 ;;
4008 esac
4009
4010 case "$skip" in
4011 true) type='';
4012 esac
4013
4014 case "$type" in
4015 '') ;;
4016 *)
4017 if test "$fastread" = yes; then
4018 dflt=y
4019 else
4020 dflt=n
4021 fi
4022 rp="$what $value doesn't exist. Use that name anyway?"
4023 . UU/myread
4024 dflt=''
4025 case "$ans" in
4026 y*) type='';;
4027 *) echo " ";;
4028 esac
4029 ;;
4030 esac
4031 ;;
4032 esac
4033 ;;
4034 esac
4035done
4036cd UU
4037ans="$value"
4038rp="$orig_rp"
4039dflt="$orig_dflt"
ecfc5424 4040rm -f getfile.ok
b233458b 4041test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4042EOSC
4043
bd9b35c9
JH
4044: What should the include directory be ?
4045echo " "
4046$echo $n "Hmm... $c"
4047dflt='/usr/include'
4048incpath=''
4049mips_type=''
4050if $test -f /bin/mips && /bin/mips; then
4051 echo "Looks like a MIPS system..."
4052 $cat >usr.c <<'EOCP'
4053#ifdef SYSTYPE_BSD43
4054/bsd43
4055#endif
4056EOCP
8a27cf78 4057 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4058 dflt='/bsd43/usr/include'
4059 incpath='/bsd43'
4060 mips_type='BSD 4.3'
4061 else
4062 mips_type='System V'
4063 fi
4064 $rm -f usr.c usr.out
4065 echo "and you're compiling with the $mips_type compiler and libraries."
4066 xxx_prompt=y
4067 echo "exit 0" >mips
4068else
4069 echo "Doesn't look like a MIPS system."
4070 xxx_prompt=n
4071 echo "exit 1" >mips
4072fi
4073chmod +x mips
4074$eunicefix mips
4075case "$usrinc" in
4076'') ;;
4077*) dflt="$usrinc";;
4078esac
4079case "$xxx_prompt" in
4080y) fn=d/
4081 echo " "
4082 rp='Where are the include files you want to use?'
4083 . ./getfile
4084 usrinc="$ans"
8e07c86e 4085 ;;
bd9b35c9 4086*) usrinc="$dflt"
8e07c86e
AD
4087 ;;
4088esac
2304df62 4089
96056487
JH
4090: see how we invoke the C preprocessor
4091echo " "
4092echo "Now, how can we feed standard input to your C preprocessor..." >&4
4093cat <<'EOT' >testcpp.c
4094#define ABC abc
4095#define XYZ xyz
4096ABC.XYZ
4097EOT
4098cd ..
4099if test ! -f cppstdin; then
4100 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4101 # AIX cc -E doesn't show the absolute headerfile
4102 # locations but we'll cheat by using the -M flag.
4103 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
4104 else
4105 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4106 fi
4107else
4108 echo "Keeping your $hint cppstdin wrapper."
4109fi
4110chmod 755 cppstdin
4111wrapper=`pwd`/cppstdin
4112ok='false'
4113cd UU
4114
4115if $test "X$cppstdin" != "X" && \
4116 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4117 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4118then
4119 echo "You used to use $cppstdin $cppminus so we'll use that again."
4120 case "$cpprun" in
4121 '') echo "But let's see if we can live without a wrapper..." ;;
4122 *)
4123 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4124 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4125 then
4126 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4127 ok='true'
4128 else
4129 echo "(However, $cpprun $cpplast does not work, let's see...)"
4130 fi
4131 ;;
4132 esac
4133else
4134 case "$cppstdin" in
4135 '') ;;
4136 *)
4137 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4138 ;;
4139 esac
4140fi
4141
4142if $ok; then
4143 : nothing
4144elif echo 'Maybe "'"$cc"' -E" will work...'; \
4145 $cc -E <testcpp.c >testcpp.out 2>&1; \
4146 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4147 echo "Yup, it does."
4148 x_cpp="$cc -E"
4149 x_minus='';
4150elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4151 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4152 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4153 echo "Yup, it does."
4154 x_cpp="$cc -E"
4155 x_minus='-';
4156elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4157 $cc -P <testcpp.c >testcpp.out 2>&1; \
4158 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4159 echo "Yipee, that works!"
4160 x_cpp="$cc -P"
4161 x_minus='';
4162elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4163 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4164 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4165 echo "At long last!"
4166 x_cpp="$cc -P"
4167 x_minus='-';
4168elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4169 $cpp <testcpp.c >testcpp.out 2>&1; \
4170 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4171 echo "It works!"
4172 x_cpp="$cpp"
4173 x_minus='';
4174elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4175 $cpp - <testcpp.c >testcpp.out 2>&1; \
4176 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4177 echo "Hooray, it works! I was beginning to wonder."
4178 x_cpp="$cpp"
4179 x_minus='-';
4180elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4181 $wrapper <testcpp.c >testcpp.out 2>&1; \
4182 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4183 x_cpp="$wrapper"
4184 x_minus=''
4185 echo "Eureka!"
4186else
4187 dflt=''
4188 rp="No dice. I can't find a C preprocessor. Name one:"
4189 . ./myread
4190 x_cpp="$ans"
4191 x_minus=''
4192 $x_cpp <testcpp.c >testcpp.out 2>&1
4193 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4194 echo "OK, that will do." >&4
4195 else
4196echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4197 exit 1
4198 fi
4199fi
4200
4201case "$ok" in
4202false)
4203 cppstdin="$x_cpp"
4204 cppminus="$x_minus"
4205 cpprun="$x_cpp"
4206 cpplast="$x_minus"
4207 set X $x_cpp
4208 shift
4209 case "$1" in
4210 "$cpp")
4211 echo "Perhaps can we force $cc -E using a wrapper..."
4212 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4213 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4214 then
4215 echo "Yup, we can."
4216 cppstdin="$wrapper"
4217 cppminus='';
4218 else
4219 echo "Nope, we'll have to live without it..."
4220 fi
4221 ;;
4222 esac
4223 case "$cpprun" in
4224 "$wrapper")
4225 cpprun=''
4226 cpplast=''
4227 ;;
4228 esac
4229 ;;
4230esac
4231
4232case "$cppstdin" in
4233"$wrapper"|'cppstdin') ;;
4234*) $rm -f $wrapper;;
4235esac
4236$rm -f testcpp.c testcpp.out
4237
bd9b35c9
JH
4238: Set private lib path
4239case "$plibpth" in
4240'') if ./mips; then
4241 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4242 fi;;
4243esac
4244case "$libpth" in
4245' ') dlist='';;
4246'') dlist="$loclibpth $plibpth $glibpth";;
4247*) dlist="$libpth";;
4248esac
4249
4250: Now check and see which directories actually exist, avoiding duplicates
4251libpth=''
4252for xxx in $dlist
4253do
4254 if $test -d $xxx; then
4255 case " $libpth " in
4256 *" $xxx "*) ;;
4257 *) libpth="$libpth $xxx";;
4258 esac
4259 fi
4260done
4261$cat <<'EOM'
4262
4263Some systems have incompatible or broken versions of libraries. Among
4264the directories listed in the question below, please remove any you
4265know not to be holding relevant libraries, and add any that are needed.
4266Say "none" for none.
8e07c86e
AD
4267
4268EOM
bd9b35c9
JH
4269case "$libpth" in
4270'') dflt='none';;
8e07c86e 4271*)
bd9b35c9
JH
4272 set X $libpth
4273 shift
4274 dflt=${1+"$@"}
8e07c86e 4275 ;;
a0d0e21e 4276esac
bd9b35c9
JH
4277rp="Directories to use for library searches?"
4278. ./myread
4279case "$ans" in
4280none) libpth=' ';;
4281*) libpth="$ans";;
4282esac
a0d0e21e 4283
bd9b35c9
JH
4284: compute shared library extension
4285case "$so" in
4286'')
4287 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4288 dflt='sl'
dd4e71fd 4289 else
bd9b35c9 4290 dflt='so'
dd4e71fd
JH
4291 fi
4292 ;;
bd9b35c9 4293*) dflt="$so";;
dd4e71fd 4294esac
dd4e71fd
JH
4295$cat <<EOM
4296
bd9b35c9 4297On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4298you want to suppress searching of shared libraries for the remainder
bd9b35c9 4299of this configuration.
dd4e71fd
JH
4300
4301EOM
bd9b35c9
JH
4302rp='What is the file extension used for shared libraries?'
4303. ./myread
4304so="$ans"
dd4e71fd 4305
bd9b35c9
JH
4306: Define several unixisms.
4307: Hints files or command line option can be used to override them.
4308: The convoluted testing is in case hints files set either the old
4309: or the new name.
4310case "$_exe" in
4311'') case "$exe_ext" in
1fef16b3 4312 '') ;;
bd9b35c9 4313 *) _exe="$exe_ext" ;;
dd4e71fd 4314 esac
bd9b35c9 4315 ;;
bfb7748a 4316esac
bd9b35c9
JH
4317case "$_a" in
4318'') case "$lib_ext" in
4319 '') _a='.a';;
4320 *) _a="$lib_ext" ;;
dd4e71fd
JH
4321 esac
4322 ;;
dd4e71fd 4323esac
bd9b35c9
JH
4324case "$_o" in
4325'') case "$obj_ext" in
4326 '') _o='.o';;
4327 *) _o="$obj_ext";;
4328 esac
4329 ;;
4330esac
4331case "$p_" in
4332'') case "$path_sep" in
4333 '') p_=':';;
4334 *) p_="$path_sep";;
4335 esac
4336 ;;
4337esac
4338exe_ext=$_exe
4339lib_ext=$_a
4340obj_ext=$_o
4341path_sep=$p_
dd4e71fd 4342
b4eb6b3d
JH
4343: Which makefile gets called first. This is used by make depend.
4344case "$firstmakefile" in
4345'') firstmakefile='makefile';;
4633a7c4 4346esac
4633a7c4 4347
0f0995ae
JH
4348case "$usesocks" in
4349$define|true|[yY]*) dflt='y';;
4350*) dflt='n';;
4351esac
bd9b35c9 4352cat <<EOM
4633a7c4 4353
bd9b35c9 4354Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
4355Configure must be run with -Dusesocks. If you use SOCKS you also need
4356to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 4357
0f0995ae 4358If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4359EOM
bd9b35c9
JH
4360rp='Build Perl for SOCKS?'
4361. ./myread
4362case "$ans" in
4363y|Y) val="$define" ;;
4364*) val="$undef" ;;
4365esac
4366set usesocks
4367eval $setvar
4368
cf829ab0
JH
4369case "$usesocks" in
4370$define|true|[yY]*) useperlio="$define";;
4371esac
4372
bd9b35c9
JH
4373: Looking for optional libraries
4374echo " "
4375echo "Checking for optional libraries..." >&4
4376case "$libs" in
4377' '|'') dflt='';;
4378*) dflt="$libs";;
4379esac
4380case "$libswanted" in
4381'') libswanted='c_s';;
4382esac
4383case "$usesocks" in
923fc586 4384"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4385esac
68435ea7
JH
4386libsfound=''
4387libsfiles=''
4388libsdirs=''
13b3f787
JH
4389libspath=''
4390for thisdir in $libpth $xlibpth; do
4391 test -d $thisdir && libspath="$libspath $thisdir"
4392done
bd9b35c9 4393for thislib in $libswanted; do
13b3f787 4394 for thisdir in $libspath; do
f7dd4e7f
JH
4395 xxx=''
4396 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4397 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4398 $test -f "$xxx" && eval $libscheck
4399 $test -f "$xxx" && libstyle=shared
4400 fi
4401 if test ! -f "$xxx"; then
4402 xxx=$thisdir/lib$thislib.$so
4403 $test -f "$xxx" && eval $libscheck
4404 $test -f "$xxx" && libstyle=shared
4405 fi
4406 if test ! -f "$xxx"; then
4407 xxx=$thisdir/lib$thislib$_a
4408 $test -f "$xxx" && eval $libscheck
4409 $test -f "$xxx" && libstyle=static
4410 fi
4411 if test ! -f "$xxx"; then
4412 xxx=$thisdir/$thislib$_a
4413 $test -f "$xxx" && eval $libscheck
4414 $test -f "$xxx" && libstyle=static
4415 fi
4416 if test ! -f "$xxx"; then
4417 xxx=$thisdir/lib${thislib}_s$_a
4418 $test -f "$xxx" && eval $libscheck
4419 $test -f "$xxx" && libstyle=static
09ea5ba9 4420 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4421 fi
4422 if test ! -f "$xxx"; then
4423 xxx=$thisdir/Slib$thislib$_a
4424 $test -f "$xxx" && eval $libscheck
4425 $test -f "$xxx" && libstyle=static
4426 fi
4427 if $test -f "$xxx"; then
43999f95 4428 case "$libstyle" in
f7dd4e7f
JH
4429 shared) echo "Found -l$thislib (shared)." ;;
4430 static) echo "Found -l$thislib." ;;
4431 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4432 esac
bd9b35c9
JH
4433 case " $dflt " in
4434 *"-l$thislib "*);;
f7dd4e7f 4435 *) dflt="$dflt -l$thislib"
43999f95
JH
4436 libsfound="$libsfound $xxx"
4437 yyy=`basename $xxx`
4438 libsfiles="$libsfiles $yyy"
1e127011 4439 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4440 case " $libsdirs " in
4441 *" $yyy "*) ;;
4442 *) libsdirs="$libsdirs $yyy" ;;
4443 esac
4444 ;;
bd9b35c9 4445 esac
f7dd4e7f
JH
4446 break
4447 fi
4448 done
4449 if $test ! -f "$xxx"; then
4450 echo "No -l$thislib."
bd9b35c9
JH
4451 fi
4452done
4453set X $dflt
4454shift
4455dflt="$*"
4456case "$libs" in
4457'') dflt="$dflt";;
4458*) dflt="$libs";;
4459esac
4460case "$dflt" in
4461' '|'') dflt='none';;
4462esac
4633a7c4 4463
bd9b35c9 4464$cat <<EOM
4633a7c4 4465
bd9b35c9
JH
4466In order to compile $package on your machine, a number of libraries
4467are usually needed. Include any other special libraries here as well.
4468Say "none" for none. The default list is almost always right.
8e07c86e 4469EOM
8e07c86e 4470
bd9b35c9
JH
4471echo " "
4472rp="What libraries to use?"
4473. ./myread
4474case "$ans" in
4475none) libs=' ';;
4476*) libs="$ans";;
4477esac
d71b2b6b 4478
bd9b35c9
JH
4479: determine optimization, if desired, or use for debug flag also
4480case "$optimize" in
4481' '|$undef) dflt='none';;
4482'') dflt='-O';;
4483*) dflt="$optimize";;
4484esac
4485$cat <<EOH
d71b2b6b 4486
bd9b35c9
JH
4487By default, $package compiles with the -O flag to use the optimizer.
4488Alternately, you might want to use the symbolic debugger, which uses
4489the -g flag (on traditional Unix systems). Either flag can be
4490specified here. To use neither flag, specify the word "none".
d71b2b6b 4491
bd9b35c9
JH
4492EOH
4493rp="What optimizer/debugger flag should be used?"
4494. ./myread
4495optimize="$ans"
4496case "$optimize" in
4497'none') optimize=" ";;
4498esac
4499
4500dflt=''
4501: We will not override a previous value, but we might want to
4502: augment a hint file
4503case "$hint" in
4504default|recommended)
4505 case "$gccversion" in
4506 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4507 esac
bd9b35c9
JH
4508 case "$optimize" in
4509 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4510 esac
bd9b35c9
JH
4511 case "$gccversion" in
4512 2*) if test -d /etc/conf/kconfig.d &&
4513 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4514 then
4515 dflt="$dflt -posix"
4516 fi
f0d04425 4517 ;;
bd9b35c9
JH
4518 esac
4519 case "$gccversion" in
4520 1*) ;;
4521 2.[0-8]*) ;;
4522 ?*) echo " "
4523 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4524 echo 'int main(void) { return 0; }' > gcctest.c
4525 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4526 echo "Yes, it does." 2>&1
4527 case "$ccflags" in
4528 *strict-aliasing*)
4529 echo "Leaving current flags $ccflags alone." 2>&1
4530 ;;
4531 *) dflt="$dflt -fno-strict-aliasing" ;;
4532 esac
4533 else
4534 echo "Nope, it doesn't, but that's ok." 2>&1
4535 fi
f0d04425 4536 ;;
e5e20432
JH
4537 esac
4538 ;;
4539esac
4540
bd9b35c9
JH
4541case "$mips_type" in
4542*BSD*|'') inclwanted="$locincpth $usrinc";;
4543*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4544esac
4545for thisincl in $inclwanted; do
4546 if $test -d $thisincl; then
4547 if $test x$thisincl != x$usrinc; then
4548 case "$dflt" in
422af00a
LC
4549 *" -I$thisincl "*);;
4550 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4551 esac
4552 fi
4553 fi
4554done
40a7a20a 4555
bd9b35c9
JH
4556inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4557 xxx=true;
4558elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4559 xxx=true;
4560else
4561 xxx=false;
4562fi;
4563if $xxx; then
4564 case "$dflt" in
4565 *$2*);;
4566 *) dflt="$dflt -D$2";;
4567 esac;
4568fi'
40a7a20a 4569
bd9b35c9 4570set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4571
bd9b35c9
JH
4572case "$usesocks" in
4573$define)
4574 ccflags="$ccflags -DSOCKS"
4575 ;;
4576esac
40a7a20a 4577
bd9b35c9
JH
4578case "$hint" in
4579default|recommended) dflt="$ccflags $dflt" ;;
4580*) dflt="$ccflags";;
4581esac
40a7a20a 4582
bd9b35c9
JH
4583case "$dflt" in
4584''|' ') dflt=none;;
4585esac
422af00a 4586
bd9b35c9 4587$cat <<EOH
40a7a20a 4588
bd9b35c9
JH
4589Your C compiler may want other flags. For this question you should include
4590-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4591but you should NOT include libraries or ld flags like -lwhatever. If you
4592want $package to honor its debug switch, you should include -DDEBUGGING here.
4593Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4594
bd9b35c9 4595To use no flags, specify the word "none".
40a7a20a 4596
bd9b35c9
JH
4597EOH
4598set X $dflt
4599shift
4600dflt=${1+"$@"}
4601rp="Any additional cc flags?"
4602. ./myread
4603case "$ans" in
4604none) ccflags='';;
4605*) ccflags="$ans";;
4606esac
8e07c86e 4607
bd9b35c9 4608: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4609case "$cppflags" in
4610'') cppflags="$ccflags" ;;
4611*) cppflags="$cppflags $ccflags" ;;
4612esac
bd9b35c9
JH
4613case "$gccversion" in
46141*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4615esac
bd9b35c9
JH
4616case "$mips_type" in
4617'');;
4618*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4619esac
4620case "$cppflags" in
4621'');;
4622*)
4623 echo " "
4624 echo "Let me guess what the preprocessor flags are..." >&4
4625 set X $cppflags
4626 shift
4627 cppflags=''
4628 $cat >cpp.c <<'EOM'
4629#define BLURFL foo
8e07c86e 4630
bd9b35c9
JH
4631BLURFL xx LFRULB
4632EOM
4633 previous=''
4634 for flag in $*
4635 do
4636 case "$flag" in
4637 -*) ftry="$flag";;
4638 *) ftry="$previous $flag";;
4639 esac
4640 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4641 >cpp1.out 2>/dev/null && \
4642 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4643 >cpp2.out 2>/dev/null && \
4644 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4645 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4646 then
4647 cppflags="$cppflags $ftry"
4648 previous=''
4649 else
4650 previous="$flag"
4651 fi
4652 done
4653 set X $cppflags
4654 shift
4655 cppflags=${1+"$@"}
4656 case "$cppflags" in
4657 *-*) echo "They appear to be: $cppflags";;
4658 esac
4659 $rm -f cpp.c cpp?.out
2afac517 4660 ;;
4661esac
8e07c86e 4662
bd9b35c9
JH
4663: flags used in final linking phase
4664case "$ldflags" in
4665'') if ./venix; then
4666 dflt='-i -z'
10a23457 4667 else
bd9b35c9 4668 dflt=''
10a23457 4669 fi
bd9b35c9
JH
4670 case "$ccflags" in
4671 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4672 esac
bd9b35c9
JH
4673 ;;
4674*) dflt="$ldflags";;
4675esac
4676
4677: Try to guess additional flags to pick up local libraries.
4678for thislibdir in $libpth; do
4679 case " $loclibpth " in
4680 *" $thislibdir "*)
4681 case "$dflt " in
4682 *"-L$thislibdir "*) ;;
4683 *) dflt="$dflt -L$thislibdir" ;;
4684 esac
c4f23d77
AD
4685 ;;
4686 esac
bd9b35c9 4687done
c4f23d77 4688
bd9b35c9
JH
4689case "$dflt" in
4690'') dflt='none' ;;
4691esac
c4f23d77 4692
bd9b35c9
JH
4693$cat <<EOH
4694
4695Your C linker may need flags. For this question you should
4696include -L/whatever and any other flags used by the C linker, but you
4697should NOT include libraries like -lwhatever.
4698
4699Make sure you include the appropriate -L/path flags if your C linker
4700does not normally search all of the directories you specified above,
4701namely
4702 $libpth
4703To use no flags, specify the word "none".
4704
4705EOH
4706
4707rp="Any additional ld flags (NOT including libraries)?"
4708. ./myread
4709case "$ans" in
4710none) ldflags='';;
4711*) ldflags="$ans";;
4712esac
4713rmlist="$rmlist pdp11"
4714
4715: coherency check
4716echo " "
4717echo "Checking your choice of C compiler and flags for coherency..." >&4
4718$cat > try.c <<'EOF'
4719#include <stdio.h>
4720int main() { printf("Ok\n"); exit(0); }
4721EOF
7a282f6d 4722set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4723shift
4724$cat >try.msg <<'EOM'
4725I've tried to compile and run the following simple program:
4726
4727EOM
4728$cat try.c >> try.msg
4729
4730$cat >> try.msg <<EOM
4731
4732I used the command:
4733
4734 $*
5440bc8e 4735 $run ./try
bd9b35c9
JH
4736
4737and I got the following output:
4738
4739EOM
4740dflt=y
73614538 4741if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4742 if $sh -c "$run ./try" >>try.msg 2>&1; then
4743 xxx=`$run ./try`
bd9b35c9
JH
4744 case "$xxx" in
4745 "Ok") dflt=n ;;
4746 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4747 case " $libs " in
4748 *" -lsfio "*)
4749 cat >> try.msg <<'EOQS'
4750If $libs contains -lsfio, and sfio is mis-configured, then it
4751sometimes (apparently) runs and exits with a 0 status, but with no
4752output! It may have to do with sfio's use of _exit vs. exit.
4753
4754EOQS
4755 rp="You have a big problem. Shall I abort Configure"
4756 dflt=y
4757 ;;
4758 esac
4759 ;;
4760 esac
4761 else
4762 echo "The program compiled OK, but exited with status $?." >>try.msg
4763 rp="You have a problem. Shall I abort Configure"
4764 dflt=y
4765 fi
4766else
4767 echo "I can't compile the test program." >>try.msg
4768 rp="You have a BIG problem. Shall I abort Configure"
4769 dflt=y
4770fi
4771case "$dflt" in
4772y)
4773 $cat try.msg >&4
4774 case "$knowitall" in
4775 '')
4776 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4777 ;;
bd9b35c9 4778 *) dflt=n;;
c4f23d77 4779 esac
bd9b35c9
JH
4780 echo " "
4781 . ./myread
4782 case "$ans" in
4783 n*|N*) ;;
4784 *) echo "Ok. Stopping Configure." >&4
4785 exit 1
c4f23d77
AD
4786 ;;
4787 esac
4788 ;;
bd9b35c9 4789n) echo "OK, that should do.";;
c4f23d77 4790esac
bd9b35c9 4791$rm -f try try.* core
c4f23d77 4792
bd9b35c9
JH
4793: define a shorthand compile call
4794compile='
4795mc_file=$1;
4796shift;
08413ebc 4797$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4798: define a shorthand compile call for compilations that should be ok.
4799compile_ok='
4800mc_file=$1;
4801shift;
7a282f6d 4802$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4803
b4eb6b3d 4804: check for lengths of integral types
bd9b35c9 4805echo " "
b4eb6b3d
JH
4806case "$intsize" in
4807'')
4808 echo "Checking to see how big your integers are..." >&4
5440bc8e 4809 $cat >try.c <<'EOCP'
bd9b35c9
JH
4810#include <stdio.h>
4811int main()
4812{
b4eb6b3d
JH
4813 printf("intsize=%d;\n", (int)sizeof(int));
4814 printf("longsize=%d;\n", (int)sizeof(long));
4815 printf("shortsize=%d;\n", (int)sizeof(short));
4816 exit(0);
bd9b35c9 4817}
b4eb6b3d 4818EOCP
5440bc8e
JH
4819 set try
4820 if eval $compile_ok && $run ./try > /dev/null; then
4821 eval `$run ./try`
b4eb6b3d
JH
4822 echo "Your integers are $intsize bytes long."
4823 echo "Your long integers are $longsize bytes long."
4824 echo "Your short integers are $shortsize bytes long."
4825 else
4826 $cat >&4 <<EOM
4827!
4828Help! I can't compile and run the intsize test program: please enlighten me!
4829(This is probably a misconfiguration in your system or libraries, and
4830you really ought to fix it. Still, I'll try anyway.)
4831!
bd9b35c9 4832EOM
b4eb6b3d
JH
4833 dflt=4
4834 rp="What is the size of an integer (in bytes)?"
96056487
JH
4835 . ./myread
4836 intsize="$ans"
4837 dflt=$intsize
4838 rp="What is the size of a long integer (in bytes)?"
4839 . ./myread
4840 longsize="$ans"
4841 dflt=2
4842 rp="What is the size of a short integer (in bytes)?"
4843 . ./myread
4844 shortsize="$ans"
b4eb6b3d
JH
4845 fi
4846 ;;
4847esac
96056487 4848$rm -f try try.*
b4eb6b3d 4849
8dfa8df9
JH
4850: check for void type
4851echo " "
4852echo "Checking to see how well your C compiler groks the void type..." >&4
4853case "$voidflags" in
4854'')
4855 $cat >try.c <<'EOCP'
4856#if TRY & 1
4857void sub() {
4858#else
4859sub() {
4860#endif
4861 extern void moo(); /* function returning void */
4862 void (*goo)(); /* ptr to func returning void */
4863#if TRY & 8
4864 void *hue; /* generic ptr */
4865#endif
4866#if TRY & 2
4867 void (*foo[10])();
4868#endif
4869
4870#if TRY & 4
4871 if(goo == moo) {
4872 exit(0);
4873 }
4874#endif
4875 exit(0);
4876}
4877int main() { sub(); }
4878EOCP
4879 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4880 voidflags=$defvoidused
4881 echo "Good. It appears to support void to the level $package wants.">&4
4882 if $contains warning .out >/dev/null 2>&1; then
4883 echo "However, you might get some warnings that look like this:"
4884 $cat .out
4885 fi
4886 else
4887echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4888 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4889 echo "It supports 1..."
4890 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4891 echo "It also supports 2..."
4892 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4893 voidflags=7
4894 echo "And it supports 4 but not 8 definitely."
4895 else
4896 echo "It doesn't support 4..."
4897 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4898 voidflags=11
4899 echo "But it supports 8."
4900 else
4901 voidflags=3
4902 echo "Neither does it support 8."
4903 fi
4904 fi
4905 else
4906 echo "It does not support 2..."
4907 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4908 voidflags=13
4909 echo "But it supports 4 and 8."
4910 else
4911 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4912 voidflags=5
4913 echo "And it supports 4 but has not heard about 8."
4914 else
4915 echo "However it supports 8 but not 4."
4916 fi
4917 fi
4918 fi
4919 else
4920 echo "There is no support at all for void."
4921 voidflags=0
4922 fi
4923 fi
4924esac
4925case "$voidflags" in
4926"$defvoidused") ;;
4927*) $cat >&4 <<'EOM'
4928 Support flag bits are:
4929 1: basic void declarations.
4930 2: arrays of pointers to functions returning void.
4931 4: operations between pointers to and addresses of void functions.
4932 8: generic void pointers.
4933EOM
4934 dflt="$voidflags";
4935 rp="Your void support flags add up to what?"
4936 . ./myread
4937 voidflags="$ans"
4938 ;;
4939esac
4940$rm -f try.* .out
4941
4942: check for length of pointer
4943echo " "
4944case "$ptrsize" in
4945'')
4946 echo "Checking to see how big your pointers are..." >&4
4947 if test "$voidflags" -gt 7; then
4948 echo '#define VOID_PTR char *' > try.c
4949 else
4950 echo '#define VOID_PTR void *' > try.c
4951 fi
4952 $cat >>try.c <<'EOCP'
4953#include <stdio.h>
4954int main()
4955{
4956 printf("%d\n", (int)sizeof(VOID_PTR));
4957 exit(0);
4958}
4959EOCP
4960 set try
4961 if eval $compile_ok; then
5440bc8e 4962 ptrsize=`$run ./try`
8dfa8df9
JH
4963 echo "Your pointers are $ptrsize bytes long."
4964 else
4965 dflt='4'
4966 echo "(I can't seem to compile the test program. Guessing...)" >&4
4967 rp="What is the size of a pointer (in bytes)?"
4968 . ./myread
4969 ptrsize="$ans"
4970 fi
4971 ;;
4972esac
4973$rm -f try.c try
4974
4975: check for long long
4976echo " "
4977echo "Checking to see if you have long long..." >&4
4978echo 'int main() { long long x = 7; return 0; }' > try.c
4979set try
4980if eval $compile; then
4981 val="$define"
4982 echo "You have long long."
4983else
4984 val="$undef"
4985 echo "You do not have long long."
4986fi
4987$rm try.*
4988set d_longlong
4989eval $setvar
4990
4991: check for length of long long
4992case "${d_longlong}${longlongsize}" in
4993$define)
4994 echo " "
4995 echo "Checking to see how big your long longs are..." >&4
4996 $cat >try.c <<'EOCP'
4997#include <stdio.h>
4998int main()
4999{
5000 printf("%d\n", (int)sizeof(long long));
5001 return(0);
5002}
5003EOCP
5004 set try
5005 if eval $compile_ok; then
5440bc8e 5006 longlongsize=`$run ./try`
8dfa8df9
JH
5007 echo "Your long longs are $longlongsize bytes long."
5008 else
5009 dflt='8'
5010 echo " "
5011 echo "(I can't seem to compile the test program. Guessing...)"
5012 rp="What is the size of a long long (in bytes)?"
5013 . ./myread
5014 longlongsize="$ans"
5015 fi
5016 if $test "X$longsize" = "X$longlongsize"; then
5017 echo "(That isn't any different from an ordinary long.)"
5018 fi
5019 ;;
5020esac
5021$rm -f try.* try
5022
5023: determine filename position in cpp output
5024echo " "
5025echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5026case "$osname" in
5027vos) testaccess=-e ;;
5028*) testaccess=-r ;;
5029esac
8dfa8df9
JH
5030echo '#include <stdio.h>' > foo.c
5031$cat >fieldn <<EOF
5032$startsh
5033$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5034$grep '^[ ]*#.*stdio\.h' | \
5035while read cline; do
5036 pos=1
5037 set \$cline
5038 while $test \$# -gt 0; do
a5a94ea5 5039 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5040 echo "\$pos"
5041 exit 0
5042 fi
5043 shift
5044 pos=\`expr \$pos + 1\`
5045 done
5046done
5047EOF
5048chmod +x fieldn
5049fieldn=`./fieldn`
5050$rm -f foo.c fieldn
5051case $fieldn in
5052'') pos='???';;
50531) pos=first;;
50542) pos=second;;
50553) pos=third;;
5056*) pos="${fieldn}th";;
5057esac
5058echo "Your cpp writes the filename in the $pos field of the line."
5059
3c728e00
JH
5060case "$osname" in
5061vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5062*) cppfilter='' ;;
5063esac
8dfa8df9
JH
5064: locate header file
5065$cat >findhdr <<EOF
5066$startsh
5067wanted=\$1
5068name=''
5069for usrincdir in $usrinc
5070do
5071 if test -f \$usrincdir/\$wanted; then
5072 echo "\$usrincdir/\$wanted"
5073 exit 0
5074 fi
5075done
5076awkprg='{ print \$$fieldn }'
5077echo "#include <\$wanted>" > foo\$\$.c
5078$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5079$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5080while read cline; do
5081 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5082 case "\$name" in
5083 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5084 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5085 *) exit 2;;
5086 esac;
5087done;
5088#
5089# status = 0: grep returned 0 lines, case statement not executed
5090# status = 1: headerfile found
5091# status = 2: while loop executed, no headerfile found
5092#
5093status=\$?
5094$rm -f foo\$\$.c;
5095if test \$status -eq 1; then
5096 exit 0;
5097fi
5098exit 1
5099EOF
5100chmod +x findhdr
5101
5102: define an alternate in-header-list? function
5103inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5104cont=true; xxf="echo \"<\$1> found.\" >&4";
5105case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5106*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5107esac;
5108case $# in 4) instead=instead;; *) instead="at last";; esac;
5109while $test "$cont"; do
5110 xxx=`./findhdr $1`
5111 var=$2; eval "was=\$$2";
5112 if $test "$xxx" && $test -r "$xxx";
5113 then eval $xxf;
5114 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5115 cont="";
5116 else eval $xxnf;
5117 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5118 set $yyy; shift; shift; yyy=$@;
5119 case $# in 0) cont="";;
5120 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5121 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5122 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5123 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5124 esac;
5125done;
5126while $test "$yyy";
5127do set $yyy; var=$2; eval "was=\$$2";
5128 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5129 set $yyy; shift; shift; yyy=$@;
5130done'
5131
5132: see if inttypes.h is available
5133: we want a real compile instead of Inhdr because some systems
5134: have an inttypes.h which includes non-existent headers
5135echo " "
5136$cat >try.c <<EOCP
5137#include <inttypes.h>
5138int main() {
5139 static int32_t foo32 = 0x12345678;
5140}
5141EOCP
5142set try
5143if eval $compile; then
5144 echo "<inttypes.h> found." >&4
5145 val="$define"
5146else
5147 echo "<inttypes.h> NOT found." >&4
5148 val="$undef"
5149fi
5150$rm -f try.c try
5151set i_inttypes
5152eval $setvar
5153
5154: check for int64_t
5155echo " "
5156echo "Checking to see if you have int64_t..." >&4
5157$cat >try.c <<EOCP
5158#include <sys/types.h>
5159#$i_inttypes I_INTTYPES
5160#ifdef I_INTTYPES
5161#include <inttypes.h>
5162#endif
5163int main() { int64_t x = 7; }
5164EOCP
5165set try
5166if eval $compile; then
5167 val="$define"
5168 echo "You have int64_t."
5169else
5170 val="$undef"
5171 echo "You do not have int64_t."
5172fi
5173$rm -f try try.*
5174set d_int64_t
5175eval $setvar
5176
5177
5178echo " "
5179echo "Checking which 64-bit integer type we could use..." >&4
5180
5181case "$intsize" in
51828) val=int
5183 set quadtype
5184 eval $setvar
5185 val='"unsigned int"'
5186 set uquadtype
5187 eval $setvar
5188 quadkind=1
5189 ;;
5190*) case "$longsize" in
5191 8) val=long
5192 set quadtype
5193 eval $setvar
5194 val='"unsigned long"'
5195 set uquadtype
5196 eval $setvar
5197 quadkind=2
5198 ;;
5199 *) case "$d_longlong:$longlongsize" in
5200 define:8)
5201 val='"long long"'
5202 set quadtype
5203 eval $setvar
5204 val='"unsigned long long"'
5205 set uquadtype
5206 eval $setvar
5207 quadkind=3
5208 ;;
5209 *) case "$d_int64_t" in
5210 define)
5211 val=int64_t
5212 set quadtype
5213 eval $setvar
5214 val=uint64_t
5215 set uquadtype
5216 eval $setvar
5217 quadkind=4
5218 ;;
5219 esac
5220 ;;
5221 esac
5222 ;;
5223 esac
5224 ;;
5225esac
5226
5227case "$quadtype" in
5228'') echo "Alas, no 64-bit integer types in sight." >&4
5229 d_quad="$undef"
5230 ;;
5231*) echo "We could use '$quadtype' for 64-bit integers." >&4
5232 d_quad="$define"
5233 ;;
5234esac
5235
b4eb6b3d
JH
5236
5237case "$uselonglong" in
5238"$define"|true|[yY]*)
5239 cat <<EOM >&4
5240
5241*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5242EOM
5243 use64bitint="$define"
5244 ;;
5245esac
5246case "$use64bits" in
5247"$define"|true|[yY]*)
5248 cat <<EOM >&4
5249
5250*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5251EOM
5252 use64bitint="$define"
5253 ;;
5254esac
5255case "$use64bitints" in
5256"$define"|true|[yY]*)
5257 cat <<EOM >&4
5258
5259*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5260EOM
5261 use64bitint="$define"
5262 ;;
5263esac
5264case "$use64bitsint" in
5265"$define"|true|[yY]*)
5266 cat <<EOM >&4
5267
5268*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5269EOM
5270 use64bitint="$define"
5271 ;;
5272esac
5273case "$uselonglongs" in
5274"$define"|true|[yY]*)
5275 cat <<EOM >&4
5276
5277*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5278EOM
5279 use64bitint="$define"
5280 ;;
5281esac
5282case "$use64bitsall" in
5283"$define"|true|[yY]*)
5284 cat <<EOM >&4
5285
5286*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5287EOM
5288 use64bitall="$define"
5289 ;;
5290esac
5291
5292case "$ccflags" in
5293*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5294esac
5295case "$use64bitall" in
5296"$define"|true|[yY]*) use64bitint="$define" ;;
5297esac
5298
5299case "$longsize" in
53008) cat <<EOM
5301
5302You have natively 64-bit long integers.
5303EOM
5304 val="$define"
5305 ;;
5306*) case "$use64bitint" in
5307 "$define"|true|[yY]*) dflt='y';;
5308 *) dflt='n';;
5309 esac
8dfa8df9
JH
5310 case "$d_quad" in
5311 "$define") ;;
5312 *) dflt='n' ;;
5313 esac
b4eb6b3d
JH
5314 cat <<EOM
5315
5316Perl can be built to take advantage of 64-bit integer types
5317on some systems. To do so, Configure can be run with -Duse64bitint.
5318Choosing this option will most probably introduce binary incompatibilities.
5319
5320If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5321(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5322EOM
5323 rp='Try to use 64-bit integers, if available?'
5324 . ./myread
5325 case "$ans" in
5326 [yY]*) val="$define" ;;
5327 *) val="$undef" ;;
5328 esac
5329 ;;
5330esac
5331set use64bitint
5332eval $setvar
5333
5334case "$use64bitall" in
5335"$define"|true|[yY]*) dflt='y' ;;
5336*) case "$longsize" in
5337 8) dflt='y' ;;
5338 *) dflt='n' ;;
5339 esac
5340 ;;
5341esac
5342cat <<EOM
5343
5344You may also choose to try maximal 64-bitness. It means using as much
534564-bitness as possible on the platform. This in turn means even more
5346binary incompatibilities. On the other hand, your platform may not
5347have any more 64-bitness available than what you already have chosen.
5348
5349If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5350(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5351EOM
5352rp='Try to use maximal 64-bit support, if available?'
5353. ./myread
5354case "$ans" in
5355[yY]*) val="$define" ;;
5356*) val="$undef" ;;
5357esac
5358set use64bitall
5359eval $setvar
5360case "$use64bitall" in
5361"$define")
5362 case "$use64bitint" in
5363 "$undef")
5364 cat <<EOM
5365
5366Since you have chosen a maximally 64-bit build, I'm also turning on
5367the use of 64-bit integers.
5368EOM
5369 use64bitint="$define" ;;
5370 esac
5371 ;;
5372esac
5373
8dfa8df9
JH
5374case "$use64bitall" in
5375"$define"|true|[yY]*)
5376 case "$ptrsize" in
5377 4) cat <<EOM >&4
5378
5379*** You have chosen a maximally 64-bit build, but your pointers
5380*** are only 4 bytes wide, disabling maximal 64-bitness.
5381
5382EOM
5383 use64bitall="$undef"
5384 case "$use64bitint" in
5385 "$define"|true|[yY]*) ;;
5386 *) cat <<EOM >&4
5387
5388*** Downgrading from maximal 64-bitness to using 64-bit integers.
5389
5390EOM
5391 use64bitint="$define"
5392 ;;
5393 esac
5394 ;;
5395 esac
5396 ;;
5397esac
5398
b4eb6b3d
JH
5399case "$use64bitint" in
5400"$define"|true|[yY]*)
5401: Look for a hint-file generated 'call-back-unit'. If the
5402: user has specified that a 64-bit perl is to be built,
5403: we may need to set or change some other defaults.
5404 if $test -f use64bitint.cbu; then
5405 echo "Your platform has some specific hints for 64-bit integers, using them..."
5406 . ./use64bitint.cbu
5407 fi
5408 case "$longsize" in
5409 4) case "$archname64" in
5410 '') archname64=64int ;;
5411 esac
5412 ;;
5413 esac
5414 ;;
5415esac
5416
5417case "$use64bitall" in
5418"$define"|true|[yY]*)
5419: Look for a hint-file generated 'call-back-unit'. If the
5420: user has specified that a maximally 64-bit perl is to be built,
5421: we may need to set or change some other defaults.
5422 if $test -f use64bitall.cbu; then
5423 echo "Your platform has some specific hints for 64-bit builds, using them..."
5424 . ./use64bitall.cbu
5425 fi
5426 case "$longsize" in
5427 4) case "$archname64" in
5428 ''|64int) archname64=64all ;;
5429 esac
5430 ;;
5431 esac
5432 ;;
5433esac
5434
5435echo " "
5436echo "Checking for GNU C Library..." >&4
5440bc8e 5437cat >try.c <<EOM
b4eb6b3d
JH
5438#include <stdio.h>
5439int main()
5440{
5441#ifdef __GLIBC__
5442 exit(0);
5443#else
5444 exit(1);
5445#endif
5446}
5447EOM
5440bc8e
JH
5448set try
5449if eval $compile_ok && $run ./try; then
b4eb6b3d
JH
5450 val="$define"
5451 echo "You are using the GNU C Library"
5452else
5453 val="$undef"
5454 echo "You are not using the GNU C Library"
5455fi
5440bc8e 5456$rm -f try try.*
b4eb6b3d
JH
5457set d_gnulibc
5458eval $setvar
5459
5460: see if nm is to be used to determine whether a symbol is defined or not
5461case "$usenm" in
5462'')
5463 dflt=''
c1a7f87b
JH
5464 case "$d_gnulibc" in
5465 "$define")
5466 echo " "
5467 echo "nm probably won't work on the GNU C Library." >&4
5468 dflt=n
bd9b35c9 5469 ;;
c1a7f87b
JH
5470 esac
5471 case "$dflt" in
5472 '')
5473 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5474 echo " "
5475 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5476 echo "'nm' won't be sufficient on this sytem." >&4
5477 dflt=n
5478 fi
5479 ;;
5480 esac
5481 case "$dflt" in
5482 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5483 if $test $dflt -gt 20; then
5484 dflt=y
5485 else
5486 dflt=n
5487 fi
bd9b35c9
JH
5488 ;;
5489 esac
bd9b35c9
JH
5490 ;;
5491*)
c1a7f87b
JH
5492 case "$usenm" in
5493 true|$define) dflt=y;;
5494 *) dflt=n;;
5495 esac
bd9b35c9
JH
5496 ;;
5497esac
5498$cat <<EOM
5499
c1a7f87b
JH
5500I can use $nm to extract the symbols from your C libraries. This
5501is a time consuming task which may generate huge output on the disk (up
5502to 3 megabytes) but that should make the symbols extraction faster. The
5503alternative is to skip the 'nm' extraction part and to compile a small
5504test program instead to determine whether each symbol is present. If
5505you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5506this may be the best solution.
5507
5508You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5509
5510EOM
c1a7f87b
JH
5511rp="Shall I use $nm to extract C symbols from the libraries?"
5512. ./myread
5513case "$ans" in
5514[Nn]*) usenm=false;;
5515*) usenm=true;;
bd9b35c9 5516esac
bd9b35c9 5517
c1a7f87b
JH
5518runnm=$usenm
5519case "$reuseval" in
5520true) runnm=false;;
8e07c86e 5521esac
29209bc5 5522
c1a7f87b
JH
5523: nm options which may be necessary
5524case "$nm_opt" in
5525'') if $test -f /mach_boot; then
5526 nm_opt='' # Mach
5527 elif $test -d /usr/ccs/lib; then
5528 nm_opt='-p' # Solaris (and SunOS?)
5529 elif $test -f /dgux; then
5530 nm_opt='-p' # DG-UX
5531 elif $test -f /lib64/rld; then
5532 nm_opt='-p' # 64-bit Irix
5533 else
5534 nm_opt=''
5535 fi;;
5536esac
bd9b35c9 5537
c1a7f87b
JH
5538: nm options which may be necessary for shared libraries but illegal
5539: for archive libraries. Thank you, Linux.
5540case "$nm_so_opt" in
5541'') case "$myuname" in
5542 *linux*)
5543 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5544 nm_so_opt='--dynamic'
5545 fi
5546 ;;
bd9b35c9 5547 esac
c1a7f87b
JH
5548 ;;
5549esac
8e07c86e 5550
c1a7f87b
JH
5551case "$runnm" in
5552true)
5553: get list of predefined functions in a handy place
5554echo " "
5555case "$libc" in
5556'') libc=unknown
5557 case "$libs" in
5558 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5559 esac
ff935051
JH
5560 ;;
5561esac
c1a7f87b
JH
5562case "$libs" in
5563'') ;;
5564*) for thislib in $libs; do
5565 case "$thislib" in
5566 -lc|-lc_s)
5567 : Handle C library specially below.
5568 ;;
5569 -l*)
5570 thislib=`echo $thislib | $sed -e 's/^-l//'`
5571 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5572 :
5573 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5574 :
5575 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5576 :
5577 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5578 :
5579 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5580 :
5581 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5582 :
5583 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5584 :
5585 else
5586 try=''
5587 fi
5588 libnames="$libnames $try"
5589 ;;
5590 *) libnames="$libnames $thislib" ;;
34d1710f 5591 esac
c1a7f87b 5592 done
4633a7c4
LW
5593 ;;
5594esac
c1a7f87b
JH
5595xxx=normal
5596case "$libc" in
5597unknown)
5598 set /lib/libc.$so
5599 for xxx in $libpth; do
5600 $test -r $1 || set $xxx/libc.$so
5601 : The messy sed command sorts on library version numbers.
5602 $test -r $1 || \
5603 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5604 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5605 h
5606 s/[0-9][0-9]*/0000&/g
5607 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5608 G
5609 s/\n/ /' | \
381aa1ff 5610 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5611 eval set \$$#
5612 done
5613 $test -r $1 || set /usr/ccs/lib/libc.$so
5614 $test -r $1 || set /lib/libsys_s$_a
5615 ;;
5616*)
5617 set blurfl
5618 ;;
a4f3eea9 5619esac
c1a7f87b
JH
5620if $test -r "$1"; then
5621 echo "Your (shared) C library seems to be in $1."
5622 libc="$1"
5623elif $test -r /lib/libc && $test -r /lib/clib; then
5624 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5625 xxx=apollo
5626 libc='/lib/clib /lib/libc'
5627 if $test -r /lib/syslib; then
5628 echo "(Your math library is in /lib/syslib.)"
5629 libc="$libc /lib/syslib"
5630 fi
5631elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5632 echo "Your C library seems to be in $libc, as you said before."
5633elif $test -r $incpath/usr/lib/libc$_a; then
5634 libc=$incpath/usr/lib/libc$_a;
5635 echo "Your C library seems to be in $libc. That's fine."
5636elif $test -r /lib/libc$_a; then
5637 libc=/lib/libc$_a;
5638 echo "Your C library seems to be in $libc. You're normal."
5639else
5640 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5641 :
5642 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5643 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5644 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5645 :
5646 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5647 :
5648 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5649 :
5650 else
5651 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5652 fi
5653 if $test -r "$tans"; then
5654 echo "Your C library seems to be in $tans, of all places."
5655 libc=$tans
5656 else
5657 libc='blurfl'
5658 fi
5659fi
5660if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5661 dflt="$libc"
5662 cat <<EOM
a4f3eea9 5663
c1a7f87b
JH
5664If the guess above is wrong (which it might be if you're using a strange
5665compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5666
5667EOM
a4f3eea9 5668else
c1a7f87b 5669 dflt=''
381aa1ff 5670 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5671 cat >&4 <<EOM
5672I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5673
c1a7f87b
JH
5674EOM
5675 $sed 's/^/ /' libpath
5676 cat <<EOM
29209bc5 5677
c1a7f87b 5678None of these seems to contain your C library. I need to get its name...
a4f3eea9 5679
bd9b35c9 5680EOM
bd9b35c9 5681fi
c1a7f87b
JH
5682fn=f
5683rp='Where is your C library?'
5684. ./getfile
5685libc="$ans"
a4f3eea9 5686
c1a7f87b 5687echo " "
381aa1ff 5688echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5689set X `cat libnames`
5690shift
5691xxx=files
5692case $# in 1) xxx=file; esac
5693echo "Extracting names from the following $xxx for later perusal:" >&4
5694echo " "
5695$sed 's/^/ /' libnames >&4
5696echo " "
5697$echo $n "This may take a while...$c" >&4
a4f3eea9 5698
c1a7f87b
JH
5699for file in $*; do
5700 case $file in
5701 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5702 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5703 esac
c1a7f87b 5704done >libc.tmp
a4f3eea9 5705
c1a7f87b
JH
5706$echo $n ".$c"
5707$grep fprintf libc.tmp > libc.ptf
5708xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
c56d2bdc 5709xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
c1a7f87b
JH
5710xxx='[ADTSIW]'
5711if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5712 eval $xscan;\
5713 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714 eval $xrun
5715elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5716 eval $xscan;\
5717 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718 eval $xrun
5719elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5720 eval $xscan;\
5721 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722 eval $xrun
5723elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5724 eval $xscan;\
5725 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726 eval $xrun
5727elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5728 eval $xscan;\
5729 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730 eval $xrun
5731elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5732 eval $xscan;\
5733 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734 eval $xrun
5735elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5736 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5737 eval $xscan;\
5738 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739 eval $xrun
5740elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5741 eval $xscan;\
5742 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743 eval $xrun
5744elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5745 eval $xscan;\
5746 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747 eval $xrun
5748elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5749 eval $xscan;\
5750 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751 eval $xrun
5752elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5753 eval $xscan;\
5754 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755 eval $xrun
5756elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5757 eval $xscan;\
5758 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5759 eval $xrun
5760elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5761 eval $xscan;\
5762 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5763 eval $xrun
5764elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5765 eval $xscan;\
5766 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5767 eval $xrun
5768else
5769 $nm -p $* 2>/dev/null >libc.tmp
5770 $grep fprintf libc.tmp > libc.ptf
5771 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5772 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5773 then
5774 nm_opt='-p'
5775 eval $xrun
bd9b35c9 5776 else
c1a7f87b
JH
5777 echo " "
5778 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5779 com=''
5780 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5781 for thisname in $libnames $libc; do
5782 $ar t $thisname >>libc.tmp
5783 done
5784 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5785 echo "Ok." >&4
5786 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5787 # Repeat libc to extract forwarders to DLL entries too
5788 for thisname in $libnames $libc; do
5789 $ar tv $thisname >>libc.tmp
5790 # Revision 50 of EMX has bug in $ar.
5791 # it will not extract forwarders to DLL entries
5792 # Use emximp which will extract exactly them.
5793 emximp -o tmp.imp $thisname \
5794 2>/dev/null && \
5795 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5796 < tmp.imp >>libc.tmp
5797 $rm tmp.imp
5798 done
5799 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5800 echo "Ok." >&4
5801 else
5802 echo "$ar didn't seem to work right." >&4
5803 echo "Maybe this is a Cray...trying bld instead..." >&4
5804 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5805 then
5806 for thisname in $libnames; do
5807 bld t $libnames | \
5808 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5809 $ar t $thisname >>libc.tmp
5810 done
5811 echo "Ok." >&4
bd9b35c9 5812 else
c1a7f87b
JH
5813 echo "That didn't work either. Giving up." >&4
5814 exit 1
bd9b35c9 5815 fi
c1a7f87b 5816 fi
a4f3eea9 5817 fi
a4f3eea9 5818fi
c1a7f87b
JH
5819nm_extract="$com"
5820if $test -f /lib/syscalls.exp; then
5821 echo " "
5822 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
a8c676c6 5823 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
c1a7f87b
JH
5824fi
5825;;
5826esac
5827$rm -f libnames libpath
bd9b35c9 5828
c1a7f87b
JH
5829: is a C symbol defined?
5830csym='tlook=$1;
5831case "$3" in
5832-v) tf=libc.tmp; tc=""; tdc="";;
5833-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5834*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5835esac;
5836tx=yes;
5837case "$reuseval-$4" in
5838true-) ;;
5839true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5840esac;
5841case "$tx" in
5842yes)
5843 case "$runnm" in
5844 true)
5845 if $contains $tlook $tf >/dev/null 2>&1;
5846 then tval=true;
5847 else tval=false;
5848 fi;;
5849 *)
5850 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5851 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5852 then tval=true;
5853 else tval=false;
5854 fi;
5855 $rm -f t t.c;;
5856 esac;;
5857*)
5858 case "$tval" in
5859 $define) tval=true;;
5860 *) tval=false;;
5861 esac;;
5862esac;
5863eval "$2=$tval"'
bd9b35c9 5864
c1a7f87b
JH
5865: define an is-in-libc? function
5866inlibc='echo " "; td=$define; tu=$undef;
5867sym=$1; var=$2; eval "was=\$$2";
5868tx=yes;
5869case "$reuseval$was" in
5870true) ;;
5871true*) tx=no;;
5872esac;
5873case "$tx" in
5874yes)
5875 set $sym tres -f;
5876 eval $csym;
5877 case "$tres" in
5878 true)
5879 echo "$sym() found." >&4;
5880 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5881 *)
5882 echo "$sym() NOT found." >&4;
5883 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5884 esac;;
bd9b35c9 5885*)
c1a7f87b
JH
5886 case "$was" in
5887 $define) echo "$sym() found." >&4;;
5888 *) echo "$sym() NOT found." >&4;;
5889 esac;;
5890esac'
5891
b4eb6b3d
JH
5892: see if sqrtl exists
5893set sqrtl d_sqrtl
c1a7f87b
JH
5894eval $inlibc
5895
b4eb6b3d
JH
5896: check for length of double
5897echo " "
5898case "$doublesize" in
5899'')
5900 echo "Checking to see how big your double precision numbers are..." >&4
5901 $cat >try.c <<'EOCP'
5902#include <stdio.h>
5903int main()
5904{
5905 printf("%d\n", (int)sizeof(double));
5906 exit(0);
5907}
5908EOCP
5909 set try
5910 if eval $compile_ok; then
5440bc8e 5911 doublesize=`$run ./try`
b4eb6b3d
JH
5912 echo "Your double is $doublesize bytes long."
5913 else
5914 dflt='8'
5915 echo "(I can't seem to compile the test program. Guessing...)"
5916 rp="What is the size of a double precision number (in bytes)?"
5917 . ./myread
5918 doublesize="$ans"
5919 fi
5920 ;;
5921esac
5922$rm -f try.c try
5923
5924: check for long doubles
5925echo " "
5926echo "Checking to see if you have long double..." >&4
5927echo 'int main() { long double x = 7.0; }' > try.c
5928set try
5929if eval $compile; then
5930 val="$define"
5931 echo "You have long double."
5932else
5933 val="$undef"
5934 echo "You do not have long double."
5935fi
5936$rm try.*
5937set d_longdbl
5938eval $setvar
5939
5940: check for length of long double
5941case "${d_longdbl}${longdblsize}" in
5942$define)
5943 echo " "
5944 echo "Checking to see how big your long doubles are..." >&4
5945 $cat >try.c <<'EOCP'
5946#include <stdio.h>
5947int main()
5948{
5949 printf("%d\n", sizeof(long double));
5950}
5951EOCP
5952 set try
5953 set try
5954 if eval $compile; then
5440bc8e 5955 longdblsize=`$run ./try`
b4eb6b3d
JH
5956 echo "Your long doubles are $longdblsize bytes long."
5957 else
5958 dflt='8'
5959 echo " "
5960 echo "(I can't seem to compile the test program. Guessing...)" >&4
5961 rp="What is the size of a long double (in bytes)?"
5962 . ./myread
5963 longdblsize="$ans"
5964 fi
5965 if $test "X$doublesize" = "X$longdblsize"; then
5966 echo "(That isn't any different from an ordinary double.)"
5967 fi
5968 ;;
5969esac
5970$rm -f try.* try
5971
dc526090
NC
5972echo " "
5973
5974if $test X"$d_longdbl" = X"$define"; then
5975
5976echo "Checking how to print long doubles..." >&4
5977
5978if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5979 $cat >try.c <<'EOCP'
5980#include <sys/types.h>
5981#include <stdio.h>
5982int main() {
5983 double d = 123.456;
5984 printf("%.3f\n", d);
5985}
5986EOCP
5987 set try
5988 if eval $compile; then
5989 yyy=`$run ./try`
5990 case "$yyy" in
5991 123.456)
5992 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5993 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5994 echo "We will use %f."
5995 ;;
5996 esac
5997 fi
5998fi
5999
6000if $test X"$sPRIfldbl" = X; then
6001 $cat >try.c <<'EOCP'
6002#include <sys/types.h>
6003#include <stdio.h>
6004int main() {
6005 long double d = 123.456;
6006 printf("%.3Lf\n", d);
6007}
6008EOCP
6009 set try
6010 if eval $compile; then
6011 yyy=`$run ./try`
6012 case "$yyy" in
6013 123.456)
6014 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6015 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6016 echo "We will use %Lf."
6017 ;;
6018 esac
6019 fi
6020fi
6021
6022if $test X"$sPRIfldbl" = X; then
6023 $cat >try.c <<'EOCP'
6024#include <sys/types.h>
6025#include <stdio.h>
6026int main() {
6027 long double d = 123.456;
6028 printf("%.3llf\n", d);
6029}
6030EOCP
6031 set try
6032 if eval $compile; then
6033 yyy=`$run ./try`
6034 case "$yyy" in
6035 123.456)
6036 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6037 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6038 echo "We will use %llf."
6039 ;;
6040 esac
6041 fi
6042fi
6043
6044if $test X"$sPRIfldbl" = X; then
6045 $cat >try.c <<'EOCP'
6046#include <sys/types.h>
6047#include <stdio.h>
6048int main() {
6049 long double d = 123.456;
6050 printf("%.3lf\n", d);
6051}
6052EOCP
6053 set try
6054 if eval $compile; then
6055 yyy=`$run ./try`
6056 case "$yyy" in
6057 123.456)
6058 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6059 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6060 echo "We will use %lf."
6061 ;;
6062 esac
6063 fi
6064fi
6065
6066if $test X"$sPRIfldbl" = X; then
6067 echo "Cannot figure out how to print long doubles." >&4
6068else
6069 sSCNfldbl=$sPRIfldbl # expect consistency
6070fi
6071
6072$rm -f try try.*
6073
6074fi # d_longdbl
6075
6076case "$sPRIfldbl" in
6077'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
6078 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
6079 d_SCNfldbl="$undef";
6080 ;;
6081*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
6082 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
6083 d_SCNfldbl="$define";
6084 ;;
6085esac
6086
6087: see if modfl exists
6088set modfl d_modfl
6089eval $inlibc
6090
6091d_modfl_pow32_bug="$undef"
6092
6093case "$d_longdbl$d_modfl" in
6094$define$define)
6095 $cat <<EOM
6096Checking to see whether your modfl() is okay for large values...
6097EOM
6098$cat >try.c <<EOCP
6099#include <math.h>
6100#include <stdio.h>
6101int main() {
6102 long double nv = 4294967303.15;
6103 long double v, w;
6104 v = modfl(nv, &w);
6105#ifdef __GLIBC__
6106 printf("glibc");
6107#endif
6108 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6109 return 0;
6110}
6111EOCP
6112 case "$osname:$gccversion" in
6113 aix:) saveccflags="$ccflags"
6114 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6115 esac
6116 set try
6117 if eval $compile; then
6118 foo=`$run ./try`
6119 case "$foo" in
6120 *" 4294967303.150000 1.150000 4294967302.000000")
6121 echo >&4 "Your modfl() is broken for large values."
6122 d_modfl_pow32_bug="$define"
6123 case "$foo" in
6124 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6125 ;;
6126 esac
6127 ;;
6128 *" 4294967303.150000 0.150000 4294967303.000000")
6129 echo >&4 "Your modfl() seems okay for large values."
6130 ;;
6131 *) echo >&4 "I don't understand your modfl() at all."
6132 d_modfl="$undef"
6133 ;;
6134 esac
6135 $rm -f try.* try core core.try.*
6136 else
6137 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6138 d_modfl="$undef"
6139 fi
6140 case "$osname:$gccversion" in
6141 aix:) ccflags="$saveccflags" ;; # restore
6142 esac
6143 ;;
6144esac
6145
6146case "$ccflags" in
6147*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6148esac
6149
6150case "$uselongdouble" in
6151$define|true|[yY]*) dflt='y';;
6152*) dflt='n';;
6153esac
6154cat <<EOM
6155
6156Perl can be built to take advantage of long doubles which
6157(if available) may give more accuracy and range for floating point numbers.
6158
6159If this doesn't make any sense to you, just accept the default '$dflt'.
6160EOM
6161rp='Try to use long doubles if available?'
6162. ./myread
6163case "$ans" in
6164y|Y) val="$define" ;;
6165*) val="$undef" ;;
6166esac
6167set uselongdouble
6168eval $setvar
6169
6170case "$uselongdouble" in
6171true|[yY]*) uselongdouble="$define" ;;
6172esac
6173
6174case "$uselongdouble" in
6175$define)
6176: Look for a hint-file generated 'call-back-unit'. If the
6177: user has specified that long doubles should be used,
6178: we may need to set or change some other defaults.
6179 if $test -f uselongdouble.cbu; then
6180 echo "Your platform has some specific hints for long doubles, using them..."
6181 . ./uselongdouble.cbu
6182 else
6183 $cat <<EOM
6184(Your platform doesn't have any specific hints for long doubles.)
6185EOM
6186 fi
6187 ;;
6188esac
6189
6190message=X
6191case "$uselongdouble:$d_sqrtl:$d_modfl" in
6192$define:$define:$define)
6193 : You have both
6194 ;;
6195$define:$define:$undef)
6196 message="I could not find modfl"
6197 ;;
6198$define:$undef:$define)
6199 message="I could not find sqrtl"
6200 ;;
6201$define:$undef:$undef)
6202 message="I found neither sqrtl nor modfl"
6203 ;;
6204esac
6205
6206if $test "$message" != X; then
6207 $cat <<EOM >&4
6208
6209*** You requested the use of long doubles but you do not seem to have
6210*** the mathematic functions for long doubles.
6211*** ($message)
6212*** I'm disabling the use of long doubles.
6213
6214EOM
6215
6216 uselongdouble=$undef
6217fi
6218
51de783f 6219case "$useperlio" in
5a3a8a02 6220$define|true|[yY]*|'') dflt='y';;
51de783f
JH
6221*) dflt='n';;
6222esac
6223cat <<EOM
6224
6225Previous version of $package used the standard IO mechanisms as
5a3a8a02 6226defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 6227alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
6228stdio mechanism is still available if needed. The abstraction layer
6229can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
6230Using PerlIO with sfio may cause problems with some extension modules.
6231
6232If this doesn't make any sense to you, just accept the default '$dflt'.
6233EOM
5a3a8a02 6234rp='Use the PerlIO abstraction layer?'
51de783f
JH
6235. ./myread
6236case "$ans" in
6237y|Y)
6238 val="$define"
5a3a8a02 6239 ;;
51de783f
JH
6240*)
6241 echo "Ok, doing things the stdio way."
6242 val="$undef"
6243 ;;
6244esac
6245set useperlio
6246eval $setvar
6247
6248case "$usesocks" in
6249$define|true|[yY]*)
6250 case "$useperlio" in
6251 $define|true|[yY]*) ;;
6252 *) cat >&4 <<EOM
6253
6254You are using the SOCKS proxy protocol library which means that you
6255should also use the PerlIO layer. You may be headed for trouble.
6256
6257EOM
6258 ;;
6259 esac
6260 ;;
6261esac
6262
6263
b4eb6b3d
JH
6264: determine the architecture name
6265echo " "
6266if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6267 tarch=`arch`"-$osname"
6268elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6269 if uname -m > tmparch 2>&1 ; then
6270 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6271 -e 's/$/'"-$osname/" tmparch`
6272 else
6273 tarch="$osname"
6274 fi
6275 $rm -f tmparch
6276else
6277 tarch="$osname"
6278fi
6279case "$myarchname" in
6280''|"$tarch") ;;
6281*)
6282 echo "(Your architecture name used to be $myarchname.)"
6283 archname=''
6284 ;;
6285esac
5440bc8e
JH
6286case "$targetarch" in
6287'') ;;
6288*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6289esac
b4eb6b3d
JH
6290myarchname="$tarch"
6291case "$archname" in
6292'') dflt="$tarch";;
6293*) dflt="$archname";;
6294esac
6295rp='What is your architecture name'
6296. ./myread
6297archname="$ans"
6298case "$usethreads" in
6299$define)
6300 echo "Threads selected." >&4
6301 case "$archname" in
6302 *-thread*) echo "...and architecture name already has -thread." >&4
6303 ;;
6304 *) archname="$archname-thread"
6305 echo "...setting architecture name to $archname." >&4
6306 ;;
6307 esac
6308 ;;
6309esac
6310case "$usemultiplicity" in
6311$define)
6312 echo "Multiplicity selected." >&4
6313 case "$archname" in
6314 *-multi*) echo "...and architecture name already has -multi." >&4
6315 ;;
6316 *) archname="$archname-multi"
6317 echo "...setting architecture name to $archname." >&4
6318 ;;
6319 esac
6320 ;;
6321esac
6322case "$use64bitint$use64bitall" in
6323*"$define"*)
6324 case "$archname64" in
6325 '')
6326 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6327 ;;
6328 *)
6329 case "$use64bitint" in
6330 "$define") echo "64 bit integers selected." >&4 ;;
6331 esac
6332 case "$use64bitall" in
6333 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6334 esac
6335 case "$archname" in
6336 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6337 ;;
6338 *) archname="$archname-$archname64"
6339 echo "...setting architecture name to $archname." >&4
6340 ;;
6341 esac
6342 ;;
6343 esac
6344esac
6345case "$uselongdouble" in
6346$define)
6347 echo "Long doubles selected." >&4
6348 case "$longdblsize" in
6349 $doublesize)
262495b9 6350 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
b4eb6b3d
JH
6351 ;;
6352 *)
6353 case "$archname" in
6354 *-ld*) echo "...and architecture name already has -ld." >&4
6355 ;;
6356 *) archname="$archname-ld"
6357 echo "...setting architecture name to $archname." >&4
6358 ;;
6359 esac
6360 ;;
6361 esac
6362 ;;
6363esac
51de783f
JH
6364case "$useperlio" in
6365$define)
6366 echo "Perlio selected." >&4
d46c9a2d
JH
6367 ;;
6368*)
6369 echo "Perlio not selected, using stdio." >&4
51de783f 6370 case "$archname" in
d46c9a2d 6371 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 6372 ;;
d46c9a2d 6373 *) archname="$archname-stdio"
51de783f
JH
6374 echo "...setting architecture name to $archname." >&4
6375 ;;
6376 esac
6377 ;;
6378esac
b4eb6b3d
JH
6379
6380: determine root of directory hierarchy where package will be installed.
6381case "$prefix" in
6382'')
6383 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6384 ;;
6385*)
6386 dflt="$prefix"
6387 ;;
6388esac
6389$cat <<EOM
6390
6391By default, $package will be installed in $dflt/bin, manual pages
6392under $dflt/man, etc..., i.e. with $dflt as prefix for all
6393installation directories. Typically this is something like /usr/local.
6394If you wish to have binaries under /usr/bin but other parts of the
6395installation under /usr/local, that's ok: you will be prompted
6396separately for each of the installation directories, the prefix being
6397only used to set the defaults.
6398
6399EOM
6400fn=d~
6401rp='Installation prefix to use?'
6402. ./getfile
6403oldprefix=''
6404case "$prefix" in
6405'') ;;
6406*)
6407 case "$ans" in
6408 "$prefix") ;;
6409 *) oldprefix="$prefix";;
6410 esac
6411 ;;
6412esac
6413prefix="$ans"
6414prefixexp="$ansexp"
6415
a6d26a0d
JH
6416case "$afsroot" in
6417'') afsroot=/afs ;;
6418*) afsroot=$afsroot ;;
6419esac
6420
b4eb6b3d
JH
6421: is AFS running?
6422echo " "
6423case "$afs" in
6424$define|true) afs=true ;;
6425$undef|false) afs=false ;;
a6d26a0d 6426*) if test -d $afsroot; then
b4eb6b3d
JH
6427 afs=true
6428 else
6429 afs=false
6430 fi
6431 ;;
6432esac
6433if $afs; then
6434 echo "AFS may be running... I'll be extra cautious then..." >&4
6435else
6436 echo "AFS does not seem to be running..." >&4
6437fi
6438
6439: determine installation prefix for where package is to be installed.
6440if $afs; then
6441$cat <<EOM
6442
6443Since you are running AFS, I need to distinguish the directory in which
6444files will reside from the directory in which they are installed (and from
6445which they are presumably copied to the former directory by occult means).
6446
6447EOM
6448 case "$installprefix" in
6449 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6450 *) dflt="$installprefix";;
6451 esac
6452else
6453$cat <<EOM
6454
6455In some special cases, particularly when building $package for distribution,
6456it is convenient to distinguish between the directory in which files should
6457be installed from the directory ($prefix) in which they
6458will eventually reside. For most users, these two directories are the same.
6459
6460EOM
6461 case "$installprefix" in
6462 '') dflt=$prefix ;;
6463 *) dflt=$installprefix;;
6464 esac
6465fi
6466fn=d~
6467rp='What installation prefix should I use for installing files?'
6468. ./getfile
6469installprefix="$ans"
6470installprefixexp="$ansexp"
6471
6472: set the prefixit variable, to compute a suitable default value
6473prefixit='case "$3" in
6474""|none)
6475 case "$oldprefix" in
6476 "") eval "$1=\"\$$2\"";;
6477 *)
6478 case "$3" in
6479 "") eval "$1=";;
6480 none)
6481 eval "tp=\"\$$2\"";
6482 case "$tp" in
6483 ""|" ") eval "$1=\"\$$2\"";;
6484 *) eval "$1=";;
6485 esac;;
6486 esac;;
6487 esac;;
6488*)
6489 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6490 case "$tp" in
6491 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6492 /*-$oldprefix/*|\~*-$oldprefix/*)
6493 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6494 *) eval "$1=\"\$$2\"";;
6495 esac;;
6496esac'
6497
b4eb6b3d
JH
6498: get the patchlevel
6499echo " "
6500echo "Getting the current patchlevel..." >&4
6501if $test -r $rsrc/patchlevel.h;then
6502 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6503 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6504 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6505 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6506 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6507 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6508 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6509else
6510 revision=0
6511 patchlevel=0
6512 subversion=0
6513 api_revision=0
6514 api_version=0
6515 api_subversion=0
151e6568
MB
6516 perl_patchlevel=0
6517 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6518fi
151e6568
MB
6519if $test -r $rsrc/.patch ; then
6520 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6521 perl_patchlevel=`cat $rsrc/.patch`
6522 fi
6523fi
861eb78d
AD
6524: Define a handy string here to avoid duplication in myconfig.SH and configpm.
6525version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 6526case "$perl_patchlevel" in
861eb78d
AD
65270|'') ;;
6528*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 6529esac
861eb78d
AD
6530
6531$echo "(You have $package $version_patchlevel_string.)"
6532
b4eb6b3d
JH
6533case "$osname" in
6534dos|vms)
6535 : XXX Should be a Configure test for double-dots in filenames.
6536 version=`echo $revision $patchlevel $subversion | \
6537 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6538 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6539 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6540 ;;
6541*)
6542 version=`echo $revision $patchlevel $subversion | \
6543 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6544 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6545 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6546 ;;
6547esac
6548: Special case the 5.005_xx maintenance series, which used 5.005
6549: without any subversion label as a subdirectory in $sitelib
6550if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6551 api_versionstring='5.005'
6552fi
6553
6554: determine installation style
6555: For now, try to deduce it from prefix unless it is already set.
6556: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6557case "$installstyle" in
6558'') case "$prefix" in
6559 *perl*) dflt='lib';;
6560 *) dflt='lib/perl5' ;;
6561 esac
6562 ;;
6563*) dflt="$installstyle" ;;
6564esac
6565: Probably not worth prompting for this since we prompt for all
6566: the directories individually, and the prompt would be too long and
6567: confusing anyway.
6568installstyle=$dflt
6569
6570: determine where private library files go
6571: Usual default is /usr/local/lib/perl5/$version.
6572: Also allow things like /opt/perl/lib/$version, since
6573: /opt/perl/lib/perl5... would be redundant.
6574: The default "style" setting is made in installstyle.U
6575case "$installstyle" in
6576*lib/perl5*) set dflt privlib lib/$package/$version ;;
6577*) set dflt privlib lib/$version ;;
6578esac
6579eval $prefixit
6580$cat <<EOM
6581
6582There are some auxiliary files for $package that need to be put into a
6583private library directory that is accessible by everyone.
6584
6585EOM
6586fn=d~+
6587rp='Pathname where the private library files will reside?'
6588. ./getfile
6589privlib="$ans"
6590privlibexp="$ansexp"
6591: Change installation prefix, if necessary.
6592if $test X"$prefix" != X"$installprefix"; then
6593 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6594else
6595 installprivlib="$privlibexp"
6596fi
6597
6598: set the prefixup variable, to restore leading tilda escape
6599prefixup='case "$prefixexp" in
6600"$prefix") ;;
6601*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6602esac'
6603
6604: determine where public architecture dependent libraries go
6605set archlib archlib
6606eval $prefixit
6607: privlib default is /usr/local/lib/$package/$version
6608: archlib default is /usr/local/lib/$package/$version/$archname
6609: privlib may have an optional trailing /share.
6610tdflt=`echo $privlib | $sed 's,/share$,,'`
6611tdflt=$tdflt/$archname
6612case "$archlib" in
6613'') dflt=$tdflt
6614 ;;
6615*) dflt="$archlib"
6616 ;;
6617esac
6618$cat <<EOM
6619
6620$spackage contains architecture-dependent library files. If you are
6621sharing libraries in a heterogeneous environment, you might store
6622these files in a separate location. Otherwise, you can just include
6623them with the rest of the public library files.
6624
6625EOM
6626fn=d+~
6627rp='Where do you want to put the public architecture-dependent libraries?'
6628. ./getfile
6629archlib="$ans"
6630archlibexp="$ansexp"
6631if $test X"$archlib" = X"$privlib"; then
6632 d_archlib="$undef"
6633else
6634 d_archlib="$define"
6635fi
6636: Change installation prefix, if necessary.
6637if $test X"$prefix" != X"$installprefix"; then
6638 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6639else
6640 installarchlib="$archlibexp"
6641fi
6642
b4eb6b3d
JH
6643: see if setuid scripts can be secure
6644$cat <<EOM
6645
6646Some kernels have a bug that prevents setuid #! scripts from being
6647secure. Some sites have disabled setuid #! scripts because of this.
6648
6649First let's decide if your kernel supports secure setuid #! scripts.
6650(If setuid #! scripts would be secure but have been disabled anyway,
6651don't say that they are secure if asked.)
6652
6653EOM
6654
6655val="$undef"
6656if $test -d /dev/fd; then
6657 echo "#!$ls" >reflect
6658 chmod +x,u+s reflect
6659 ./reflect >flect 2>&1
6660 if $contains "/dev/fd" flect >/dev/null; then
6661 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6662 val="$define"
6663 else
6664 $cat <<EOM
6665If you are not sure if they are secure, I can check but I'll need a
6666username and password different from the one you are using right now.
6667If you don't have such a username or don't want me to test, simply
6668enter 'none'.
6669
6670EOM
6671 rp='Other username to test security of setuid scripts with?'
6672 dflt='none'
6673 . ./myread
6674 case "$ans" in
6675 n|none)
6676 case "$d_suidsafe" in
6677 '') echo "I'll assume setuid scripts are *not* secure." >&4
6678 dflt=n;;
6679 "$undef")
6680 echo "Well, the $hint value is *not* secure." >&4
6681 dflt=n;;
6682 *) echo "Well, the $hint value *is* secure." >&4
6683 dflt=y;;
6684 esac
c1a7f87b 6685 ;;
b4eb6b3d
JH
6686 *)
6687 $rm -f reflect flect
6688 echo "#!$ls" >reflect
6689 chmod +x,u+s reflect
6690 echo >flect
6691 chmod a+w flect
6692 echo '"su" will (probably) prompt you for '"$ans's password."
6693 su $ans -c './reflect >flect'
6694 if $contains "/dev/fd" flect >/dev/null; then
6695 echo "Okay, it looks like setuid scripts are secure." >&4
6696 dflt=y
6697 else
6698 echo "I don't think setuid scripts are secure." >&4
6699 dflt=n
6700 fi
6701 ;;
6702 esac
6703 rp='Does your kernel have *secure* setuid scripts?'
6704 . ./myread
6705 case "$ans" in
6706 [yY]*) val="$define";;
6707 *) val="$undef";;
6708 esac
6709 fi
6710else
6711 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6712 echo "(That's for file descriptors, not floppy disks.)"
6713 val="$undef"
6714fi
6715set d_suidsafe
6716eval $setvar
6717
6718$rm -f reflect flect
6719
6720: now see if they want to do setuid emulation
6721echo " "
6722val="$undef"
6723case "$d_suidsafe" in
6724"$define")
6725 val="$undef"
3c728e00 6726 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6727 ;;
6728*)
6729 $cat <<EOM
6730Some systems have disabled setuid scripts, especially systems where
6731setuid scripts cannot be secure. On systems where setuid scripts have
6732been disabled, the setuid/setgid bits on scripts are currently
6733useless. It is possible for $package to detect those bits and emulate
6734setuid/setgid in a secure fashion. This emulation will only work if
6735setuid scripts have been disabled in your kernel.
6736
6737EOM
6738 case "$d_dosuid" in
6739 "$define") dflt=y ;;
6740 *) dflt=n ;;
6741 esac
6742 rp="Do you want to do setuid/setgid emulation?"
6743 . ./myread
6744 case "$ans" in
6745 [yY]*) val="$define";;
6746 *) val="$undef";;
6747 esac
6748 ;;
6749esac
6750set d_dosuid
6751eval $setvar
6752
b4eb6b3d
JH
6753: see if this is a malloc.h system
6754set malloc.h i_malloc
6755eval $inhdr
6756
6757: see if stdlib is available
6758set stdlib.h i_stdlib
6759eval $inhdr
6760
6761: determine which malloc to compile in
6762echo " "
6763case "$usemymalloc" in
c4163172
JH
6764[yY]*|true|$define) dflt='y' ;;
6765[nN]*|false|$undef) dflt='n' ;;
6766*) case "$ptrsize" in
6767 4) dflt='y' ;;
6768 *) dflt='n' ;;
6769 esac
6770 ;;
8dfa8df9 6771esac
b4eb6b3d
JH
6772rp="Do you wish to attempt to use the malloc that comes with $package?"
6773. ./myread
6774usemymalloc="$ans"
6775case "$ans" in
6776y*|true)
6777 usemymalloc='y'
6778 mallocsrc='malloc.c'
6779 mallocobj="malloc$_o"
6780 d_mymalloc="$define"
6781 case "$libs" in
6782 *-lmalloc*)
6783 : Remove malloc from list of libraries to use
6784 echo "Removing unneeded -lmalloc from library list" >&4
6785 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6786 shift
6787 libs="$*"
6788 echo "libs = $libs" >&4
6789 ;;
6790 esac
6791 ;;
6792*)
6793 usemymalloc='n'
6794 mallocsrc=''
6795 mallocobj=''
6796 d_mymalloc="$undef"
6797 ;;
6798esac
6799
6800: compute the return types of malloc and free
6801echo " "
6802$cat >malloc.c <<END
6803#$i_malloc I_MALLOC
6804#$i_stdlib I_STDLIB
6805#include <stdio.h>
6806#include <sys/types.h>
6807#ifdef I_MALLOC
6808#include <malloc.h>
6809#endif
6810#ifdef I_STDLIB
6811#include <stdlib.h>
6812#endif
6813#ifdef TRY_MALLOC
6814void *malloc();
6815#endif
6816#ifdef TRY_FREE
6817void free();
6818#endif
6819END
6820case "$malloctype" in
6821'')
6822 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6823 malloctype='void *'
6824 else
6825 malloctype='char *'
6826 fi
6827 ;;
6828esac
6829echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6830
6831case "$freetype" in
6832'')
6833 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6834 freetype='void'
6835 else
6836 freetype='int'
6837 fi
6838 ;;
6839esac
6840echo "Your system uses $freetype free(), it would seem." >&4
6841$rm -f malloc.[co]
6842$cat <<EOM
6843
6844After $package is installed, you may wish to install various
6845add-on modules and utilities. Typically, these add-ons will
6846be installed under $prefix with the rest
6847of this package. However, you may wish to install such add-ons
6848elsewhere under a different prefix.
6849
6850If you do not wish to put everything under a single prefix, that's
6851ok. You will be prompted for the individual locations; this siteprefix
6852is only used to suggest the defaults.
6853
6854The default should be fine for most people.
6855
6856EOM
6857fn=d~+
6858rp='Installation prefix to use for add-on modules and utilities?'
6859: XXX Here might be another good place for an installstyle setting.
6860case "$siteprefix" in
6861'') dflt=$prefix ;;
6862*) dflt=$siteprefix ;;
6863esac
6864. ./getfile
6865: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6866oldsiteprefix=''
6867case "$siteprefix" in
6868'') ;;
6869*) case "$ans" in
6870 "$prefix") ;;
6871 *) oldsiteprefix="$prefix";;
6872 esac
6873 ;;
6874esac
6875siteprefix="$ans"
6876siteprefixexp="$ansexp"
6877
6878: determine where site specific libraries go.
6879: Usual default is /usr/local/lib/perl5/site_perl/$version
6880: The default "style" setting is made in installstyle.U
6881: XXX No longer works with Prefixit stuff.
6882prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6883case "$sitelib" in
6884'') case "$installstyle" in
6885 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6886 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6887 esac
6888 ;;
6889*) dflt="$sitelib"
6890 ;;
6891esac
6892$cat <<EOM
6893
6894The installation process will create a directory for
6895site-specific extensions and modules. Most users find it convenient
6896to place all site-specific files in this directory rather than in the
6897main distribution directory.
6898
6899EOM
6900fn=d~+
6901rp='Pathname for the site-specific library files?'
6902. ./getfile
6903sitelib="$ans"
6904sitelibexp="$ansexp"
6905sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6906: Change installation prefix, if necessary.
6907if $test X"$prefix" != X"$installprefix"; then
6908 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6909else
6910 installsitelib="$sitelibexp"
6911fi
6912
6913: determine where site specific architecture-dependent libraries go.
6914: sitelib default is /usr/local/lib/perl5/site_perl/$version
6915: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6916: sitelib may have an optional trailing /share.
6917case "$sitearch" in
6918'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6919 dflt="$dflt/$archname"
6920 ;;
6921*) dflt="$sitearch"
6922 ;;
6923esac
6924set sitearch sitearch none
6925eval $prefixit
6926$cat <<EOM
6927
6928The installation process will also create a directory for
6929architecture-dependent site-specific extensions and modules.
6930
6931EOM
6932fn=d~+
6933rp='Pathname for the site-specific architecture-dependent library files?'
6934. ./getfile
6935sitearch="$ans"
6936sitearchexp="$ansexp"
6937: Change installation prefix, if necessary.
6938if $test X"$prefix" != X"$installprefix"; then
6939 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6940else
6941 installsitearch="$sitearchexp"
6942fi
6943
6944$cat <<EOM
6945
6946The installation process will also create a directory for
6947vendor-supplied add-ons. Vendors who supply perl with their system
6948may find it convenient to place all vendor-supplied files in this
6949directory rather than in the main distribution directory. This will
6950ease upgrades between binary-compatible maintenance versions of perl.
6951
6952Of course you may also use these directories in whatever way you see
6953fit. For example, you might use them to access modules shared over a
6954company-wide network.
6955
6956The default answer should be fine for most people.
6957This causes further questions about vendor add-ons to be skipped
6958and no vendor-specific directories will be configured for perl.
6959
6960EOM
6961rp='Do you want to configure vendor-specific add-on directories?'
6962case "$usevendorprefix" in
6963define|true|[yY]*) dflt=y ;;
6964*) : User may have set vendorprefix directly on Configure command line.
6965 case "$vendorprefix" in
6966 ''|' ') dflt=n ;;
6967 *) dflt=y ;;
6968 esac
6969 ;;
6970esac
6971. ./myread
6972case "$ans" in
6973[yY]*) fn=d~+
6974 rp='Installation prefix to use for vendor-supplied add-ons?'
6975 case "$vendorprefix" in
6976 '') dflt='' ;;
6977 *) dflt=$vendorprefix ;;
6978 esac
6979 . ./getfile
6980 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6981 oldvendorprefix=''
6982 case "$vendorprefix" in
6983 '') ;;
6984 *) case "$ans" in
6985 "$prefix") ;;
6986 *) oldvendorprefix="$prefix";;
6987 esac
6988 ;;
6989 esac
6990 usevendorprefix="$define"
6991 vendorprefix="$ans"
6992 vendorprefixexp="$ansexp"
6993 ;;
6994*) usevendorprefix="$undef"
6995 vendorprefix=''
6996 vendorprefixexp=''
6997 ;;
6998esac
6999
7000case "$vendorprefix" in
7001'') d_vendorlib="$undef"
7002 vendorlib=''
7003 vendorlibexp=''
7004 ;;
7005*) d_vendorlib="$define"
7006 : determine where vendor-supplied modules go.
7007 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7008 case "$vendorlib" in
7009 '')
7010 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7011 case "$installstyle" in
7012 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7013 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7014 esac
7015 ;;
7016 *) dflt="$vendorlib"
7017 ;;
7018 esac
7019 fn=d~+
7020 rp='Pathname for the vendor-supplied library files?'
7021 . ./getfile
7022 vendorlib="$ans"
7023 vendorlibexp="$ansexp"
7024 ;;
7025esac
7026vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7027: Change installation prefix, if necessary.
7028if $test X"$prefix" != X"$installprefix"; then
7029 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7030else
7031 installvendorlib="$vendorlibexp"
7032fi
7033
7034case "$vendorprefix" in
7035'') d_vendorarch="$undef"
7036 vendorarch=''
7037 vendorarchexp=''
7038 ;;
7039*) d_vendorarch="$define"
7040 : determine where vendor-supplied architecture-dependent libraries go.
7041 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7042 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7043 : vendorlib may have an optional trailing /share.
7044 case "$vendorarch" in
7045 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7046 dflt="$dflt/$archname"
7047 ;;
7048 *) dflt="$vendorarch" ;;
7049 esac
7050 fn=d~+
7051 rp='Pathname for vendor-supplied architecture-dependent files?'
7052 . ./getfile
7053 vendorarch="$ans"
7054 vendorarchexp="$ansexp"
7055 ;;
7056esac
7057: Change installation prefix, if necessary.
7058if $test X"$prefix" != X"$installprefix"; then
7059 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7060else
7061 installvendorarch="$vendorarchexp"
7062fi
7063
7064: Final catch-all directories to search
7065$cat <<EOM
7066
7067Lastly, you can have perl look in other directories for extensions and
7068modules in addition to those already specified.
7069These directories will be searched after
7070 $sitearch
7071 $sitelib
7072EOM
7073test X"$vendorlib" != "X" && echo ' ' $vendorlib
7074test X"$vendorarch" != "X" && echo ' ' $vendorarch
7075echo ' '
7076case "$otherlibdirs" in
7077''|' ') dflt='none' ;;
7078*) dflt="$otherlibdirs" ;;
7079esac
7080$cat <<EOM
7081Enter a colon-separated set of extra paths to include in perl's @INC
7082search path, or enter 'none' for no extra paths.
7083
7084EOM
7085
7086rp='Colon-separated list of additional directories for perl to search?'
7087. ./myread
7088case "$ans" in
7089' '|''|none) otherlibdirs=' ' ;;
7090*) otherlibdirs="$ans" ;;
7091esac
7092case "$otherlibdirs" in
7093' ') val=$undef ;;
7094*) val=$define ;;
7095esac
7096set d_perl_otherlibdirs
7097eval $setvar
7098
7099: Cruising for prototypes
7100echo " "
7101echo "Checking out function prototypes..." >&4
7102$cat >prototype.c <<'EOCP'
7103int main(int argc, char *argv[]) {
7104 exit(0);}
7105EOCP
7106if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7107 echo "Your C compiler appears to support function prototypes."
7108 val="$define"
7109else
7110 echo "Your C compiler doesn't seem to understand function prototypes."
7111 val="$undef"
7112fi
7113set prototype
7114eval $setvar
7115$rm -f prototype*
7116
7117case "$prototype" in
7118"$define") ;;
7119*) ansi2knr='ansi2knr'
7120 echo " "
7121 cat <<EOM >&4
7122
7123$me: FATAL ERROR:
7124This version of $package can only be compiled by a compiler that
7125understands function prototypes. Unfortunately, your C compiler
7126 $cc $ccflags
7127doesn't seem to understand them. Sorry about that.
7128
7129If GNU cc is available for your system, perhaps you could try that instead.
7130
7131Eventually, we hope to support building Perl with pre-ANSI compilers.
7132If you would like to help in that effort, please contact <perlbug@perl.org>.
7133
7134Aborting Configure now.
7135EOM
7136 exit 2
7137 ;;
7138esac
7139
7140: determine where public executables go
7141echo " "
7142set dflt bin bin
7143eval $prefixit
7144fn=d~
7145rp='Pathname where the public executables will reside?'
7146. ./getfile
7147if $test "X$ansexp" != "X$binexp"; then
7148 installbin=''
7149fi
7150bin="$ans"
7151binexp="$ansexp"
7152: Change installation prefix, if necessary.
7153: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7154if $test X"$prefix" != X"$installprefix"; then
7155 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7156else
7157 installbin="$binexp"
7158fi
7159
6fcddf3b 7160echo " "
6fcddf3b 7161case "$extras" in
bf35c3f6
JH
7162'') dflt='n';;
7163*) dflt='y';;
6fcddf3b
JH
7164esac
7165cat <<EOM
7166Perl can be built with extra modules or bundles of modules which
7167will be fetched from the CPAN and installed alongside Perl.
7168
7169Notice that you will need access to the CPAN; either via the Internet,
7170or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7171be asked later to configure the CPAN.pm module which will in turn do
7172the installation of the rest of the extra modules or bundles.)
7173
7174Notice also that if the modules require any external software such as
dd2de242
JH
7175libraries and headers (the libz library and the zlib.h header for the
7176Compress::Zlib module, for example) you MUST have any such software
7177already installed, this configuration process will NOT install such
7178things for you.
6fcddf3b
JH
7179
7180If this doesn't make any sense to you, just accept the default '$dflt'.
7181EOM
dd2de242 7182rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7183. ./myread
7184case "$ans" in
7185y|Y)
7186 cat <<EOM
7187
7188Please list any extra modules or bundles to be installed from CPAN,
7189with spaces between the names. The names can be in any format the
dd2de242
JH
7190'install' command of CPAN.pm will understand. (Answer 'none',
7191without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7192EOM
7193 rp='Extras?'
7194 dflt="$extras"
7195 . ./myread
7196 extras="$ans"
7197esac
7198case "$extras" in
7199''|'none')
7200 val=''
7201 $rm -f ../extras.lst
7202 ;;
7203*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7204 echo "$extras" > ../extras.lst
7205 val="'$extras'"
6fcddf3b
JH
7206 ;;
7207esac
7208set extras
7209eval $setvar
7210echo " "
7211
b4eb6b3d
JH
7212: Find perl5.005 or later.
7213echo "Looking for a previously installed perl5.005 or later... "
7214case "$perl5" in
a938a3bb 7215'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 7216 : Check if this perl is recent and can load a simple module
a938a3bb 7217 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
7218 perl5=$tdir/perl
7219 break;
a938a3bb
IZ
7220 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7221 perl5=$tdir/perl5
b4eb6b3d
JH
7222 break;
7223 fi
7224 done
7225 ;;
7226*) perl5="$perl5"
7227 ;;
7228esac
7229case "$perl5" in
7230'') echo "None found. That's ok.";;
7231*) echo "Using $perl5." ;;
7232esac
7233
7234: Determine list of previous versions to include in @INC
7235$cat > getverlist <<EOPL
7236#!$perl5 -w
7237use File::Basename;
7238\$api_versionstring = "$api_versionstring";
7239\$version = "$version";
7240\$stem = "$sitelib_stem";
7241\$archname = "$archname";
7242EOPL
7243 $cat >> getverlist <<'EOPL'
7244# Can't have leading @ because metaconfig interprets it as a command!
7245;@inc_version_list=();
7246# XXX Redo to do opendir/readdir?
7247if (-d $stem) {
7248 chdir($stem);
7249 ;@candidates = glob("5.*");
7250}
7251else {
7252 ;@candidates = ();
7253}
7254
7255# XXX ToDo: These comparisons must be reworked when two-digit
7256# subversions come along, so that 5.7.10 compares as greater than
7257# 5.7.3! By that time, hope that 5.6.x is sufficiently
7258# widespread that we can use the built-in version vectors rather
7259# than reinventing them here. For 5.6.0, however, we must
7260# assume this script will likely be run by 5.005_0x. --AD 1/2000.
7261foreach $d (@candidates) {
7262 if ($d lt $version) {
7263 if ($d ge $api_versionstring) {
7264 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7265 }
7266 elsif ($d ge "5.005") {
7267 unshift(@inc_version_list, grep { -d } $d);
7268 }
7269 }
7270 else {
7271 # Skip newer version. I.e. don't look in
7272 # 5.7.0 if we're installing 5.6.1.
7273 }
7274}
7275
7276if (@inc_version_list) {
7277 print join(' ', @inc_version_list);
7278}
7279else {
7280 # Blank space to preserve value for next Configure run.
7281 print " ";
7282}
7283EOPL
7284chmod +x getverlist
7285case "$inc_version_list" in
a938a3bb 7286'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
7287 dflt=`$perl5 getverlist`
7288 else
7289 dflt='none'
7290 fi
7291 ;;
7292$undef) dflt='none' ;;
6d1a7737 7293*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
7294esac
7295case "$dflt" in
7296''|' ') dflt=none ;;
7297esac
7298case "$dflt" in
d953f698 72995.005) dflt=none ;;
b4eb6b3d
JH
7300esac
7301$cat <<'EOM'
7302
7303In order to ease the process of upgrading, this version of perl
7304can be configured to use modules built and installed with earlier
7305versions of perl that were installed under $prefix. Specify here
7306the list of earlier versions that this version of perl should check.
7307If Configure detected no earlier versions of perl installed under
7308$prefix, then the list will be empty. Answer 'none' to tell perl
7309to not search earlier versions.
7310
7311The default should almost always be sensible, so if you're not sure,
7312just accept the default.
7313EOM
7314
7315rp='List of earlier versions to include in @INC?'
7316. ./myread
7317case "$ans" in
7318[Nn]one|''|' ') inc_version_list=' ' ;;
7319*) inc_version_list="$ans" ;;
7320esac
7321case "$inc_version_list" in
7322''|' ')
7323 inc_version_list_init='0';;
7324*) inc_version_list_init=`echo $inc_version_list |
7325 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7326 ;;
7327esac
7328$rm -f getverlist
7329
7330: determine whether to install perl also as /usr/bin/perl
7331
7332echo " "
7333if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7334 $cat <<EOM
7335Many scripts expect perl to be installed as /usr/bin/perl.
7336I can install the perl you are about to compile also as /usr/bin/perl
7337(in addition to $installbin/perl).
7338EOM
7339 case "$installusrbinperl" in
7340 "$undef"|[nN]*) dflt='n';;
7341 *) dflt='y';;
7342 esac
7343 rp="Do you want to install perl as /usr/bin/perl?"
7344 . ./myread
7345 case "$ans" in
7346 [yY]*) val="$define";;
7347 *) val="$undef" ;;
7348 esac
7349else
7350 val="$undef"
7351fi
7352set installusrbinperl
7353eval $setvar
7354
7355: see if dld is available
7356set dld.h i_dld
7357eval $inhdr
7358
7359: see if dlopen exists
7360xxx_runnm="$runnm"
7361runnm=false
7362set dlopen d_dlopen
7363eval $inlibc
7364runnm="$xxx_runnm"
7365
7366: determine which dynamic loading, if any, to compile in
7367echo " "
7368dldir="ext/DynaLoader"
7369case "$usedl" in
7370$define|y|true)
7371 dflt='y'
7372 usedl="$define"
7373 ;;
7374$undef|n|false)
7375 dflt='n'
7376 usedl="$undef"
7377 ;;
7378*)
7379 dflt='n'
7380 case "$d_dlopen" in
7381 $define) dflt='y' ;;
7382 esac
7383 case "$i_dld" in
7384 $define) dflt='y' ;;
7385 esac
7386 : Does a dl_xxx.xs file exist for this operating system
7387 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7388 ;;
7389esac
7390rp="Do you wish to use dynamic loading?"
7391. ./myread
7392usedl="$ans"
7393case "$ans" in
7394y*) usedl="$define"
7395 case "$dlsrc" in
7396 '')
7397 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7398 dflt="$dldir/dl_${osname}.xs"
7399 elif $test "$d_dlopen" = "$define" ; then
7400 dflt="$dldir/dl_dlopen.xs"
7401 elif $test "$i_dld" = "$define" ; then
7402 dflt="$dldir/dl_dld.xs"
7403 else
7404 dflt=''
7405 fi
7406 ;;
7407 *) dflt="$dldir/$dlsrc"
7408 ;;
7409 esac
7410 echo "The following dynamic loading files are available:"
7411 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7412 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7413 rp="Source file to use for dynamic loading"
7414 fn="fne"
7415 gfpth="$src"
7416 . ./getfile
7417 usedl="$define"
7418 : emulate basename
7419 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7420
7421 $cat << EOM
7422
7423Some systems may require passing special flags to $cc -c to
7424compile modules that will be used to create a shared library.
7425To use no flags, say "none".
7426
7427EOM
7428 case "$cccdlflags" in
7429 '') case "$gccversion" in
7430 '') case "$osname" in
7431 hpux) dflt='+z' ;;
7432 next) dflt='none' ;;
7433 irix*) dflt='-KPIC' ;;
48bcfe03 7434 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7435 sunos) dflt='-pic' ;;
7436 *) dflt='none' ;;
7437 esac
7438 ;;
7439 *) case "$osname" in
b6cc0f4c 7440 darwin) dflt='none' ;;
48bcfe03 7441 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7442 *) dflt='-fpic' ;;
7443 esac ;;
7444 esac ;;
7445 ' ') dflt='none' ;;
7446 *) dflt="$cccdlflags" ;;
7447 esac
7448 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7449 . ./myread
7450 case "$ans" in
7451 none) cccdlflags=' ' ;;
7452 *) cccdlflags="$ans" ;;
7453 esac
7454
7455 cat << EOM
7456
7457Some systems use ld to create libraries that can be dynamically loaded,
7458while other systems (such as those using ELF) use $cc.
7459
7460EOM
7461 case "$ld" in
7462 '') $cat >try.c <<'EOM'
7463/* Test for whether ELF binaries are produced */
7464#include <fcntl.h>
7465#include <stdlib.h>
7466int main() {
7467 char b[4];
7468 int i = open("a.out",O_RDONLY);
7469 if(i == -1)
7470 exit(1); /* fail */
7471 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7472 exit(0); /* succeed (yes, it's ELF) */
7473 else
7474 exit(1); /* fail */
7475}
7476EOM
5440bc8e 7477 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7478 cat <<EOM
7479You appear to have ELF support. I'll use $cc to build dynamic libraries.
7480EOM
7481 dflt="$cc"
7482 else
7483 echo "I'll use ld to build dynamic libraries."
7484 dflt='ld'
7485 fi
7486 rm -f try.c a.out
7487 ;;
7488 *) dflt="$ld"
7489 ;;
7490 esac
7491
7492 rp="What command should be used to create dynamic libraries?"
7493 . ./myread
7494 ld="$ans"
7495
7496 cat << EOM
7497
7498Some systems may require passing special flags to $ld to create a
7499library that can be dynamically loaded. If your ld flags include
7500-L/other/path options to locate libraries outside your loader's normal
7501search path, you may need to specify those -L options here as well. To
7502use no flags, say "none".
7503
7504EOM
7505 case "$lddlflags" in
7506 '') case "$osname" in
7507 beos) dflt='-nostart' ;;
7508 hpux) dflt='-b';
7509 case "$gccversion" in
7510 '') dflt="$dflt +vnocompatwarnings" ;;
7511 esac
7512 ;;
7513 linux|irix*) dflt='-shared' ;;
7514 next) dflt='none' ;;
7515 solaris) dflt='-G' ;;
7516 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7517 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7518 *) dflt='none' ;;
7519 esac
7520 ;;
7521 *) dflt="$lddlflags" ;;
7522 esac
7523
7524 : Try to guess additional flags to pick up local libraries.
7525 : Be careful not to append to a plain 'none'
7526 case "$dflt" in
7527 none) dflt='' ;;
7528 esac
7529 for thisflag in $ldflags; do
7530 case "$thisflag" in
b5b9f165 7531 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7532 case " $dflt " in
7533 *" $thisflag "*) ;;
7534 *) dflt="$dflt $thisflag" ;;
7535 esac
7536 ;;
7537 esac
7538 done
7539
7540 case "$dflt" in
7541 ''|' ') dflt='none' ;;
7542 esac
7543
7544 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7545 . ./myread
7546 case "$ans" in
7547 none) lddlflags=' ' ;;
7548 *) lddlflags="$ans" ;;
7549 esac
7550
7551 cat <<EOM
7552
7553Some systems may require passing special flags to $cc to indicate that
7554the resulting executable will use dynamic linking. To use no flags,
7555say "none".
7556
7557EOM
7558 case "$ccdlflags" in
7559 '') case "$osname" in
7560 hpux) dflt='-Wl,-E' ;;
7561 linux) dflt='-rdynamic' ;;
7562 next) dflt='none' ;;
7563 sunos) dflt='none' ;;
7564 *) dflt='none' ;;
7565 esac ;;
7566 ' ') dflt='none' ;;
7567 *) dflt="$ccdlflags" ;;
7568 esac
7569 rp="Any special flags to pass to $cc to use dynamic linking?"
7570 . ./myread
7571 case "$ans" in
7572 none) ccdlflags=' ' ;;
7573 *) ccdlflags="$ans" ;;
7574 esac
7575 ;;
7576*) usedl="$undef"
7577 ld='ld'
7578 dlsrc='dl_none.xs'
7579 lddlflags=''
7580 ccdlflags=''
7581 ;;
7582esac
7583
7584also=''
7585case "$usedl" in
7586$undef)
7587 # No dynamic loading being used, so don't bother even to prompt.
7588 useshrplib='false'
7589 ;;
7590*) case "$useshrplib" in
7591 '') case "$osname" in
48bcfe03 7592 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7593 dflt=y
7594 also='Building a shared libperl is required for dynamic loading to work on your system.'
7595 ;;
7596 next*)
7597 case "$osvers" in
7598 4*) dflt=y
7599 also='Building a shared libperl is needed for MAB support.'
7600 ;;
7601 *) dflt=n
7602 ;;
7603 esac
7604 ;;
7605 *) dflt=n
7606 ;;
7607 esac
7608 ;;
7609 $define|true|[Yy]*)
7610 dflt=y
7611 ;;
7612 *) dflt=n
7613 ;;
7614 esac
7615 $cat << EOM
7616
7617The perl executable is normally obtained by linking perlmain.c with
7618libperl${_a}, any static extensions (usually just DynaLoader), and
7619any other libraries needed on this system (such as -lm, etc.). Since
7620your system supports dynamic loading, it is probably possible to build
7621a shared libperl.$so. If you will have more than one executable linked
7622to libperl.$so, this will significantly reduce the size of each
7623executable, but it may have a noticeable affect on performance. The
7624default is probably sensible for your system.
7625$also
7626
7627EOM
7628 rp="Build a shared libperl.$so (y/n)"
7629 . ./myread
7630 case "$ans" in
7631 true|$define|[Yy]*)
7632 useshrplib='true' ;;
7633 *) useshrplib='false' ;;
7634 esac
7635 ;;
7636esac
7637
7638case "$useshrplib" in
7639true)
7640 case "$libperl" in
7641 '')
7642 # Figure out a good name for libperl.so. Since it gets stored in
7643 # a version-specific architecture-dependent library, the version
7644 # number isn't really that important, except for making cc/ld happy.
7645 #
7646 # A name such as libperl.so.3.1
7647 majmin="libperl.$so.$patchlevel.$subversion"
7648 # A name such as libperl.so.301
7649 majonly=`echo $patchlevel $subversion |
7650 $awk '{printf "%d%02d", $1, $2}'`
7651 majonly=libperl.$so.$majonly
7652 # I'd prefer to keep the os-specific stuff here to a minimum, and
7653 # rely on figuring it out from the naming of libc.
7654 case "${osname}${osvers}" in
7655 next4*)
7656 dflt=libperl.5.$so
7657 # XXX How handle the --version stuff for MAB?
7658 ;;
7659 linux*) # ld won't link with a bare -lperl otherwise.
7660 dflt=libperl.$so
7661 ;;
b53432e4
GH
7662 cygwin*) # ld links against an importlib
7663 dflt=libperl$lib_ext
b4eb6b3d
JH
7664 ;;
7665 *) # Try to guess based on whether libc has major.minor.
7666 case "$libc" in
7667 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7668 *libc.$so.[0-9]*) dflt=$majonly ;;
7669 *) dflt=libperl.$so ;;
7670 esac
7671 ;;
7672 esac
7673 ;;
7674 *) dflt=$libperl
7675 ;;
7676 esac
7677 cat << EOM
7678
7679I need to select a good name for the shared libperl. If your system uses
7680library names with major and minor numbers, then you might want something
7681like $majmin. Alternatively, if your system uses a single version
7682number for shared libraries, then you might want to use $majonly.
7683Or, your system might be quite happy with a simple libperl.$so.
7684
7685Since the shared libperl will get installed into a version-specific
7686architecture-dependent directory, the version number of the shared perl
7687library probably isn't important, so the default should be o.k.
7688
7689EOM
7690 rp='What name do you want to give to the shared libperl?'
7691 . ./myread
7692 libperl=$ans
7693 echo "Ok, I'll use $libperl"
7694 ;;
7695*)
7696 libperl="libperl${_a}"
7697 ;;
7698esac
7699
7700# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7701case "$shrpdir" in
7702'') ;;
7703*) $cat >&4 <<EOM
7704WARNING: Use of the shrpdir variable for the installation location of
7705the shared $libperl is not supported. It was never documented and
7706will not work in this version. Let me (perlbug@perl.org)
7707know of any problems this may cause.
7708
7709EOM
7710 case "$shrpdir" in
7711 "$archlibexp/CORE")
7712 $cat >&4 <<EOM
7713But your current setting of $shrpdir is
7714the default anyway, so it's harmless.
7715EOM
7716 ;;
7717 *)
7718 $cat >&4 <<EOM
7719Further, your current attempted setting of $shrpdir
7720conflicts with the value of $archlibexp/CORE
7721that installperl will use.
7722EOM
7723 ;;
7724 esac
7725 ;;
7726esac
7727
7728# How will the perl executable find the installed shared $libperl?
7729# Add $xxx to ccdlflags.
7730# If we can't figure out a command-line option, use $shrpenv to
7731# set env LD_RUN_PATH. The main perl makefile uses this.
7732shrpdir=$archlibexp/CORE
7733xxx=''
7734tmp_shrpenv=''
7735if "$useshrplib"; then
7736 case "$osname" in
7737 aix)
7738 # We'll set it in Makefile.SH...
7739 ;;
b5b9f165 7740 solaris)
b4eb6b3d
JH
7741 xxx="-R $shrpdir"
7742 ;;
b5b9f165 7743 freebsd|netbsd)
b4eb6b3d
JH
7744 xxx="-Wl,-R$shrpdir"
7745 ;;
6b20d41b 7746 bsdos|linux|irix*|dec_osf)
b4eb6b3d
JH
7747 xxx="-Wl,-rpath,$shrpdir"
7748 ;;
7749 next)
7750 # next doesn't like the default...
7751 ;;
7752 beos)
7753 # beos doesn't like the default, either.
7754 ;;
7755 hpux*)
7756 # hpux doesn't like the default, either.
7757 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7758 ;;
7759 *)
7760 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7761 ;;
7762 esac
7763 case "$xxx" in
7764 '') ;;
7765 *)
7766 # Only add $xxx if it isn't already in ccdlflags.
7767 case " $ccdlflags " in
7768 *" $xxx "*) ;;
7769 *) ccdlflags="$ccdlflags $xxx"
7770 cat <<EOM >&4
7771
7772Adding $xxx to the flags
7773passed to $ld so that the perl executable will find the
7774installed shared $libperl.
7775
7776EOM
7777 ;;
7778 esac
7779 ;;
7780 esac
7781fi
7782# Fix ccdlflags in AIX for building external extensions.
7783# (For building Perl itself bare -bE:perl.exp is needed,
7784# Makefile.SH takes care of this.)
7785case "$osname" in
7786aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7787esac
7788# Respect a hint or command-line value.
7789case "$shrpenv" in
7790'') shrpenv="$tmp_shrpenv" ;;
7791esac
7792case "$ldlibpthname" in
7793'') ldlibpthname=LD_LIBRARY_PATH ;;
7794none) ldlibpthname='' ;;
7795esac
7796
7797: determine where manual pages are on this system
7798echo " "
7799case "$sysman" in
7800'')
4a0a3829
SD
7801 syspath='/usr/share/man/man1 /usr/man/man1'
7802 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7803 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7804 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7805 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7806 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7807 sysman=`./loc . /usr/man/man1 $syspath`
7808 ;;
7809esac
7810if $test -d "$sysman"; then
7811 echo "System manual is in $sysman." >&4
7812else
7813 echo "Could not find manual pages in source form." >&4
7814fi
7815
7816: determine where manual pages go
7817set man1dir man1dir none
7818eval $prefixit
7819$cat <<EOM
7820
7821$spackage has manual pages available in source form.
7822EOM
7823case "$nroff" in
7824nroff)
7825 echo "However, you don't have nroff, so they're probably useless to you."
7826 case "$man1dir" in
7827 '') man1dir="none";;
7828 esac;;
7829esac
7830echo "If you don't want the manual sources installed, answer 'none'."
7831case "$man1dir" in
7832' ') dflt=none
7833 ;;
7834'')
4a0a3829
SD
7835 lookpath="$prefixexp/share/man/man1"
7836 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7837 lookpath="$lookpath $prefixexp/man/p_man/man1"
7838 lookpath="$lookpath $prefixexp/man/u_man/man1"
7839 lookpath="$lookpath $prefixexp/man/man.1"
7840 case "$sysman" in
7841 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7842 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7843 esac
7844 set dflt
7845 eval $prefixup
7846 ;;
7847*) dflt="$man1dir"
7848 ;;
7849esac
7850echo " "
7851fn=dn+~
7852rp="Where do the main $spackage manual pages (source) go?"
7853. ./getfile
7854if $test "X$man1direxp" != "X$ansexp"; then
7855 installman1dir=''
7856fi
7857man1dir="$ans"
7858man1direxp="$ansexp"
7859case "$man1dir" in
7860'') man1dir=' '
7861 installman1dir='';;
7862esac
7863
7864: Change installation prefix, if necessary.
7865if $test X"$prefix" != X"$installprefix"; then
7866 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7867else
7868 installman1dir="$man1direxp"
7869fi
7870
7871: What suffix to use on installed man pages
7872
7873case "$man1dir" in
7874' ')
7875 man1ext='0'
7876 ;;
7877*)
7878 rp="What suffix should be used for the main $spackage man pages?"
7879 case "$man1ext" in
7880 '') case "$man1dir" in
7881 *1) dflt=1 ;;
7882 *1p) dflt=1p ;;
7883 *1pm) dflt=1pm ;;
7884 *l) dflt=l;;
7885 *n) dflt=n;;
7886 *o) dflt=o;;
7887 *p) dflt=p;;
7888 *C) dflt=C;;
7889 *L) dflt=L;;
7890 *L1) dflt=L1;;
7891 *) dflt=1;;
7892 esac
7893 ;;
7894 *) dflt="$man1ext";;
7895 esac
7896 . ./myread
7897 man1ext="$ans"
7898 ;;
7899esac
7900
7901: see if we can have long filenames
7902echo " "
7903first=123456789abcdef
7904$rm -f $first
7905if (echo hi >$first) 2>/dev/null; then
7906 if $test -f 123456789abcde; then
7907 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7908 val="$undef"
7909 else
7910 echo 'You can have filenames longer than 14 characters.'>&4
7911 val="$define"
7912 fi
7913else
7914 $cat <<'EOM'
7915You can't have filenames longer than 14 chars.
7916You can't even think about them!
7917EOM
7918 val="$undef"
7919fi
7920set d_flexfnam
7921eval $setvar
7922$rm -rf 123456789abcde*
7923
7924: determine where library module manual pages go
7925set man3dir man3dir none
7926eval $prefixit
7927$cat <<EOM
7928
7929$spackage has manual pages for many of the library modules.
7930EOM
7931
7932case "$nroff" in
7933nroff)
7934 $cat <<'EOM'
7935However, you don't have nroff, so they're probably useless to you.
7936EOM
7937 case "$man3dir" in
7938 '') man3dir="none";;
7939 esac;;
7940esac
7941
7942case "$d_flexfnam" in
7943undef)
7944 $cat <<'EOM'
7945However, your system can't handle the long file names like File::Basename.3.
7946EOM
7947 case "$man3dir" in
7948 '') man3dir="none";;
7949 esac;;
7950esac
7951
7952echo "If you don't want the manual sources installed, answer 'none'."
7953prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7954case "$man3dir" in
7955'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7956 if $test -d "$privlib/man/man3"; then
7957 cat <<EOM >&4
7958
7959WARNING: Previous versions of perl installed man3 pages into
7960$privlib/man/man3. This version will suggest a
7961new default of $dflt.
7962EOM
7963 tdflt=$dflt
7964 dflt='n'
7965 rp='Do you wish to preserve the old behavior?(y/n)'
7966 . ./myread
7967 case "$ans" in
7968 y*) dflt="$privlib/man/man3" ;;
7969 *) dflt=$tdflt ;;
7970 esac
7971 fi
7972 ;;
7973*) dflt="$man3dir" ;;
7974esac
7975case "$dflt" in
7976' ') dflt=none ;;
7977esac
7978echo " "
7979fn=dn+~
7980rp="Where do the $package library man pages (source) go?"
7981. ./getfile
7982man3dir="$ans"
7983man3direxp="$ansexp"
7984case "$man3dir" in
7985'') man3dir=' '
7986 installman3dir='';;
7987esac
7988
7989: Change installation prefix, if necessary.
7990if $test X"$prefix" != X"$installprefix"; then
7991 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7992else
7993 installman3dir="$man3direxp"
7994fi
7995
7996: What suffix to use on installed man pages
7997case "$man3dir" in
7998' ')
7999 man3ext='0'
8000 ;;
8001*)
8002 rp="What suffix should be used for the $package library man pages?"
8003 case "$man3ext" in
8004 '') case "$man3dir" in
8005 *3) dflt=3 ;;
8006 *3p) dflt=3p ;;
8007 *3pm) dflt=3pm ;;
8008 *l) dflt=l;;
8009 *n) dflt=n;;
8010 *o) dflt=o;;
8011 *p) dflt=p;;
8012 *C) dflt=C;;
8013 *L) dflt=L;;
8014 *L3) dflt=L3;;
8015 *) dflt=3;;
8016 esac
8017 ;;
8018 *) dflt="$man3ext";;
8019 esac
8020 . ./myread
8021 man3ext="$ans"
8022 ;;
8023esac
8024
8025: see if we have to deal with yellow pages, now NIS.
0384a54a 8026if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8027 if $test -f /usr/etc/nibindd; then
8028 echo " "
8029 echo "I'm fairly confident you're on a NeXT."
8030 echo " "
8031 rp='Do you get the hosts file via NetInfo?'
8032 dflt=y
8033 case "$hostcat" in
8034 nidump*) ;;
8035 '') ;;
8036 *) dflt=n;;
8037 esac
8038 . ./myread
8039 case "$ans" in
8040 y*) hostcat='nidump hosts .';;
8041 *) case "$hostcat" in
8042 nidump*) hostcat='';;
8043 esac
8044 ;;
8045 esac
8046 fi
8047 case "$hostcat" in
8048 nidump*) ;;
8049 *)
8050 case "$hostcat" in
8051 *ypcat*) dflt=y;;
8052 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8053 dflt=y
8054 else
8055 dflt=n
8056 fi;;
8057 *) dflt=n;;
8058 esac
8059 echo " "
8060 rp='Are you getting the hosts file via yellow pages?'
8061 . ./myread
8062 case "$ans" in
8063 y*) hostcat='ypcat hosts';;
8064 *) hostcat='cat /etc/hosts';;
8065 esac
8066 ;;
8067 esac
8068fi
8069case "$hostcat" in
8070'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8071esac
8072case "$groupcat" in
8073'') test -f /etc/group && groupcat='cat /etc/group';;
8074esac
8075case "$passcat" in
8076'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8077esac
8078
8079: now get the host name
8080echo " "
8081echo "Figuring out host name..." >&4
8082case "$myhostname" in
8083'') cont=true
8084 echo 'Maybe "hostname" will work...'
73614538 8085 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8086 myhostname=$tans
8087 phostname=hostname
8088 cont=''
8089 fi
8090 ;;
8091*) cont='';;
8092esac
8093if $test "$cont"; then
8094 if ./xenix; then
8095 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8096 if tans=`cat /etc/systemid 2>&1` ; then
8097 myhostname=$tans
8098 phostname='cat /etc/systemid'
8099 echo "Whadyaknow. Xenix always was a bit strange..."
8100 cont=''
8101 fi
8102 elif $test -r /etc/systemid; then
8103 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8104 fi
8105fi
8106if $test "$cont"; then
8107 echo 'No, maybe "uuname -l" will work...'
73614538 8108 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8109 myhostname=$tans
8110 phostname='uuname -l'
8111 else
8112 echo 'Strange. Maybe "uname -n" will work...'
73614538 8113 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8114 myhostname=$tans
8115 phostname='uname -n'
8116 else
8117 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8118 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8119 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8120 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8121 else
8122 case "$myhostname" in
8123 '') echo "Does this machine have an identity crisis or something?"
8124 phostname='';;
8125 *)
8126 echo "Well, you said $myhostname before..."
8127 phostname='echo $myhostname';;
8128 esac
8129 fi
8130 fi
8131 fi
8132fi
52a549d0
JH
8133case "$myhostname" in
8134'') myhostname=noname ;;
8135esac
b4eb6b3d
JH
8136: you do not want to know about this
8137set $myhostname
8138myhostname=$1
8139
8140: verify guess
8141if $test "$myhostname" ; then
8142 dflt=y
8143 rp='Your host name appears to be "'$myhostname'".'" Right?"
8144 . ./myread
8145 case "$ans" in
8146 y*) ;;
8147 *) myhostname='';;
8148 esac
8149fi
8150
8151: bad guess or no guess
8152while $test "X$myhostname" = X ; do
8153 dflt=''
8154 rp="Please type the (one word) name of your host:"
8155 . ./myread
8156 myhostname="$ans"
8157done
8158
8159: translate upper to lower if necessary
8160case "$myhostname" in
8161*[A-Z]*)
8162 echo "(Normalizing case in your host name)"
8163 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8164 ;;
8165esac
8166
8167case "$myhostname" in
8168*.*)
8169 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8170 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8171 echo "(Trimming domain name from host name--host name is now $myhostname)"
8172 ;;
8173*) case "$mydomain" in
8174 '')
8175 {
8176 test "X$hostcat" = "Xypcat hosts" &&
8177 ypmatch "$myhostname" hosts 2>/dev/null |\
8178 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8179 $test -s hosts
8180 } || {
8181 test "X$hostcat" != "X" &&
8182 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8183 /[ ]$myhostname[ . ]/p" > hosts
8184 }
8185 tmp_re="[ . ]"
f08cbdd1
PP
8186 if $test -f hosts; then
8187 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8188 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8189 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8190 hosts | $sort | $uniq | \
8191 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8192 case `$echo X$dflt` in
8193 X*\ *) echo "(Several hosts in the database matched hostname)"
8194 dflt=.
8195 ;;
8196 X.) echo "(You do not have fully-qualified names in the hosts database)"
8197 ;;
8198 esac
8199 else
8200 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8201 dflt=.
f08cbdd1 8202 fi
b4eb6b3d
JH
8203 case "$dflt" in
8204 .)
8205 tans=`./loc resolv.conf X /etc /usr/etc`
8206 if $test -f "$tans"; then
8207 echo "(Attempting domain name extraction from $tans)"
8208 dflt=.`$sed -n -e 's/ / /g' \
8209 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8210 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8211 case "$dflt" in
8212 .) dflt=.`$sed -n -e 's/ / /g' \
8213 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8214 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8215 ;;
8216 esac
8217 fi
8218 ;;
8219 esac
8220 case "$dflt" in
8221 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8222 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8223 case "$dflt" in
8224 '') dflt='.';;
8225 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8226 esac
8227 ;;
8228 esac
59c9e5d6
PP
8229 case "$dflt$osname" in
8230 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8231 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8232 ;;
8233 esac
b4eb6b3d
JH
8234 case "$dflt" in
8235 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8236 dflt='.nonet'
b4eb6b3d
JH
8237 ;;
8238 esac
8239 $rm -f hosts
8240 ;;
8241 *) dflt="$mydomain";;
8242 esac;;
8243esac
8244echo " "
8245rp="What is your domain name?"
8246. ./myread
8247tans="$ans"
8248case "$ans" in
8249'') ;;
8250.*) ;;
8251*) tans=".$tans";;
8252esac
8253mydomain="$tans"
8254
8255: translate upper to lower if necessary
8256case "$mydomain" in
8257*[A-Z]*)
8258 echo "(Normalizing case in your domain name)"
8259 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8260 ;;
8261esac
8262
8263: a little sanity check here
8264case "$phostname" in
8265'') ;;
8266*)
8267 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8268 $myhostname$mydomain|$myhostname) ;;
8269 *)
8270 case "$phostname" in
8271 sed*)
8272 echo "(That doesn't agree with your whoami.h file, by the way.)"
8273 ;;
8274 *)
8275 echo "(That doesn't agree with your $phostname command, by the way.)"
8276 ;;
8277 esac
8278 ;;
8279 esac
8280 ;;
8281esac
8282
8283$cat <<EOM
8284
8285I need to get your e-mail address in Internet format if possible, i.e.
8286something like user@host.domain. Please answer accurately since I have
8287no easy means to double check it. The default value provided below
8288is most probably close to reality but may not be valid from outside
8289your organization...
8290
8291EOM
8292cont=x
8293while test "$cont"; do
8294 case "$cf_email" in
8295 '') dflt="$cf_by@$myhostname$mydomain";;
8296 *) dflt="$cf_email";;
8297 esac
8298 rp='What is your e-mail address?'
8299 . ./myread
8300 cf_email="$ans"
8301 case "$cf_email" in
8302 *@*.*) cont='' ;;
8303 *)
8304 rp='Address does not look like an Internet one. Use it anyway?'
8305 case "$fastread" in
8306 yes) dflt=y ;;
8307 *) dflt=n ;;
8308 esac
8309 . ./myread
8310 case "$ans" in
8311 y*) cont='' ;;
8312 *) echo " " ;;
8313 esac
8314 ;;
8315 esac
8316done
8317
8318$cat <<EOM
8319
8320If you or somebody else will be maintaining perl at your site, please
8321fill in the correct e-mail address here so that they may be contacted
8322if necessary. Currently, the "perlbug" program included with perl
8323will send mail to this address in addition to perlbug@perl.org. You may
8324enter "none" for no administrator.
8325
8326EOM
8327case "$perladmin" in
8328'') dflt="$cf_email";;
8329*) dflt="$perladmin";;
8330esac
8331rp='Perl administrator e-mail address'
8332. ./myread
8333perladmin="$ans"
8334
674912d7
RB
8335: determine whether to only install version-specific parts.
8336echo " "
8337$cat <<EOM
8338Do you want to install only the version-specific parts of the perl
8339distribution? Usually you do *not* want to do this.
8340EOM
8341case "$versiononly" in
8342"$define"|[Yy]*|true) dflt='y' ;;
8343*) dflt='n';
8344esac
8345rp="Do you want to install only the version-specific parts of perl?"
8346. ./myread
8347case "$ans" in
8348[yY]*) val="$define";;
8349*) val="$undef" ;;
8350esac
8351set versiononly
8352eval $setvar
8353
ad493445
MB
8354case "$versiononly" in
8355"$define") inc_version_list=''
8356 inc_version_list_init=0
8357 ;;
8358esac
8359
b4eb6b3d
JH
8360: figure out how to guarantee perl startup
8361case "$startperl" in
8362'')
8363 case "$sharpbang" in
8364 *!)
8365 $cat <<EOH
8366
8367I can use the #! construct to start perl on your system. This will
8368make startup of perl scripts faster, but may cause problems if you
8369want to share those scripts and perl is not in a standard place
8370($binexp/perl) on all your platforms. The alternative is to force
8371a shell by starting the script with a single ':' character.
8372
8373EOH
674912d7
RB
8374 case "$versiononly" in
8375 "$define") dflt="$binexp/perl$version";;
8376 *) dflt="$binexp/perl";;
8377 esac
b4eb6b3d
JH
8378 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8379 . ./myread
8380 case "$ans" in
8381 none) startperl=": # use perl";;
8382 *) startperl="#!$ans"
8383 if $test 30 -lt `echo "$ans" | wc -c`; then
8384 $cat >&4 <<EOM
8385
8386WARNING: Some systems limit the #! command to 32 characters.
8387If you experience difficulty running Perl scripts with #!, try
8388installing Perl in a directory with a shorter pathname.
8389
8390EOM
8391 fi ;;
8392 esac
8393 ;;
8394 *) startperl=": # use perl"
8395 ;;
8396 esac
8397 ;;
8398esac
8399echo "I'll use $startperl to start perl scripts."
8400
8401: figure best path for perl in scripts
8402case "$perlpath" in
8403'')
5e20a8ca
RGS
8404 case "$versiononly" in
8405 "$define") perlpath="$binexp/perl$version";;
8406 *) perlpath="$binexp/perl";;
8407 esac
b4eb6b3d
JH
8408 case "$startperl" in
8409 *!*) ;;
8410 *)
8411 $cat <<EOH
8412
8413I will use the "eval 'exec'" idiom to start Perl on your system.
8414I can use the full path of your Perl binary for this purpose, but
8415doing so may cause problems if you want to share those scripts and
8416Perl is not always in a standard place ($binexp/perl).
8417
8418EOH
8419 dflt="$binexp/perl"
8420 rp="What path shall I use in \"eval 'exec'\"?"
8421 . ./myread
8422 perlpath="$ans"
8423 ;;
8424 esac
8425 ;;
8426esac
8427case "$startperl" in
8428*!*) ;;
8429*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8430esac
8431
8432: determine where public executable scripts go
8433set scriptdir scriptdir
8434eval $prefixit
8435case "$scriptdir" in
8436'')
8437 dflt="$bin"
8438 : guess some guesses
8439 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8440 $test -d /usr/share/bin && dflt=/usr/share/bin
8441 $test -d /usr/local/script && dflt=/usr/local/script
8442 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8443 $test -d $prefixexp/script && dflt=$prefixexp/script
8444 set dflt
8445 eval $prefixup
8446 ;;
8447*) dflt="$scriptdir"
8448 ;;
8449esac
8450$cat <<EOM
8451
8452Some installations have a separate directory just for executable scripts so
8453that they can mount it across multiple architectures but keep the scripts in
8454one spot. You might, for example, have a subdirectory of /usr/share for this.
8455Or you might just lump your scripts in with all your other executables.
8456
8457EOM
8458fn=d~
8459rp='Where do you keep publicly executable scripts?'
8460. ./getfile
8461if $test "X$ansexp" != "X$scriptdirexp"; then
8462 installscript=''
8463fi
8464scriptdir="$ans"
8465scriptdirexp="$ansexp"
8466: Change installation prefix, if necessary.
8467if $test X"$prefix" != X"$installprefix"; then
8468 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8469else
8470 installscript="$scriptdirexp"
8471fi
8472
8473: determine where add-on public executables go
8474case "$sitebin" in
8475'') dflt=$siteprefix/bin ;;
8476*) dflt=$sitebin ;;
8477esac
8478fn=d~
8479rp='Pathname where the add-on public executables should be installed?'
8480. ./getfile
8481sitebin="$ans"
8482sitebinexp="$ansexp"
8483: Change installation prefix, if necessary.
8484if $test X"$prefix" != X"$installprefix"; then
8485 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8486else
8487 installsitebin="$sitebinexp"
8488fi
8489
96056487
JH
8490: define an is-a-typedef? function
8491typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8492case "$inclist" in
8493"") inclist="sys/types.h";;
8494esac;
8495eval "varval=\$$var";
8496case "$varval" in
8497"")
8498 $rm -f temp.c;
8499 for inc in $inclist; do
8500 echo "#include <$inc>" >>temp.c;
8501 done;
8502 echo "#ifdef $type" >> temp.c;
8503 echo "printf(\"We have $type\");" >> temp.c;
8504 echo "#endif" >> temp.c;
8505 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8506 if $contains $type temp.E >/dev/null 2>&1; then
8507 eval "$var=\$type";
8508 else
8509 eval "$var=\$def";
8510 fi;
8511 $rm -f temp.?;;
8512*) eval "$var=\$varval";;
8513esac'
8514
8515: define an is-a-typedef? function that prompts if the type is not available.
8516typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8517case "$inclist" in
8518"") inclist="sys/types.h";;
8519esac;
8520eval "varval=\$$var";
8521case "$varval" in
8522"")
8523 $rm -f temp.c;
8524 for inc in $inclist; do
8525 echo "#include <$inc>" >>temp.c;
8526 done;
8527 echo "#ifdef $type" >> temp.c;
8528 echo "printf(\"We have $type\");" >> temp.c;
8529 echo "#endif" >> temp.c;
8530 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8531 echo " " ;
8532 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8533 if $contains $type temp.E >/dev/null 2>&1; then
8534 echo "$type found." >&4;
8535 eval "$var=\$type";
8536 else
8537 echo "$type NOT found." >&4;
8538 dflt="$def";
8539 . ./myread ;
8540 eval "$var=\$ans";
8541 fi;
8542 $rm -f temp.?;;
8543*) eval "$var=\$varval";;
8544esac'
8545
8546: see what type lseek is declared as in the kernel
8547rp="What is the type used for lseek's offset on this system?"
8548set off_t lseektype long stdio.h sys/types.h
8549eval $typedef_ask
8550
8551echo " "
8552echo "Checking to see how big your file offsets are..." >&4
8553$cat >try.c <<EOCP
8554#include <sys/types.h>
8555#include <stdio.h>
8556int main()
8557{
8558 printf("%d\n", (int)sizeof($lseektype));
8559 return(0);
8560}
8561EOCP
8562set try
8563if eval $compile_ok; then
8564 lseeksize=`$run ./try`
8565 echo "Your file offsets are $lseeksize bytes long."
8566else
8567 dflt=$longsize
8568 echo " "
8569 echo "(I can't seem to compile the test program. Guessing...)"
8570 rp="What is the size of your file offsets (in bytes)?"
8571 . ./myread
8572 lseeksize="$ans"
8573fi
8574$rm -f try.c try
8575
8576: see what type file positions are declared as in the library
8577rp="What is the type for file position used by fsetpos()?"
8578set fpos_t fpostype long stdio.h sys/types.h
8579eval $typedef_ask
8580
8581echo " "
8582case "$fpostype" in
8583*_t) zzz="$fpostype" ;;
8584*) zzz="fpos_t" ;;
8585esac
8586echo "Checking the size of $zzz..." >&4
8587cat > try.c <<EOCP
8588#include <sys/types.h>
8589#include <stdio.h>
8590int main() {
8591 printf("%d\n", (int)sizeof($fpostype));
8592 exit(0);
8593}
8594EOCP
8595set try
8596if eval $compile_ok; then
8597 yyy=`$run ./try`
8598 case "$yyy" in
8599 '') fpossize=4
8600 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8601 ;;
8602 *) fpossize=$yyy
8603 echo "Your $zzz is $fpossize bytes long."
8604 ;;
8605 esac
8606else
8607 dflt="$longsize"
8608 echo " " >&4
8609 echo "(I can't compile the test program. Guessing...)" >&4
8610 rp="What is the size of your file positions (in bytes)?"
8611 . ./myread
8612 fpossize="$ans"
8613fi
8614
8615
8616
8617# Backward compatibility (uselfs is deprecated).
8618case "$uselfs" in
8619"$define"|true|[yY]*)
8620 cat <<EOM >&4
8621
8622*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8623EOM
8624 uselargefiles="$define"
8625 ;;
8626esac
8627
8628case "$lseeksize:$fpossize" in
86298:8) cat <<EOM
8630
8631You can have files larger than 2 gigabytes.
8632EOM
8633 val="$define" ;;
8634*) case "$uselargefiles" in
8635 "$undef"|false|[nN]*) dflt='n' ;;
8636 *) dflt='y' ;;
8637 esac
8638 cat <<EOM
8639
8640Perl can be built to understand large files (files larger than 2 gigabytes)
8641on some systems. To do so, Configure can be run with -Duselargefiles.
8642
8643If this doesn't make any sense to you, just accept the default '$dflt'.
8644EOM
8645 rp='Try to understand large files, if available?'
8646 . ./myread
8647 case "$ans" in
8648 y|Y) val="$define" ;;
8649 *) val="$undef" ;;
8650 esac
8651 ;;
8652esac
8653set uselargefiles
8654eval $setvar
8655case "$uselargefiles" in
8656"$define")
8657: Look for a hint-file generated 'call-back-unit'. If the
8658: user has specified that a large files perl is to be built,
8659: we may need to set or change some other defaults.
8660 if $test -f uselargefiles.cbu; then
8661 echo "Your platform has some specific hints for large file builds, using them..."
8662 . ./uselargefiles.cbu
8663 echo " "
8664 echo "Rechecking to see how big your file offsets are..." >&4
8665 $cat >try.c <<EOCP
8666#include <sys/types.h>
8667#include <stdio.h>
8668int main()
8669{
8670 printf("%d\n", (int)sizeof($lseektype));
8671 return(0);
8672}
8673EOCP
8674 set try
8675 if eval $compile_ok; then
8676 lseeksize=`$run ./try`
8677 $echo "Your file offsets are now $lseeksize bytes long."
8678 else
8679 dflt="$lseeksize"
8680 echo " "
8681 echo "(I can't seem to compile the test program. Guessing...)"
8682 rp="What is the size of your file offsets (in bytes)?"
8683 . ./myread
8684 lseeksize="$ans"
8685 fi
8686 case "$fpostype" in
8687 *_t) zzz="$fpostype" ;;
8688 *) zzz="fpos_t" ;;
8689 esac
8690 $echo $n "Rechecking the size of $zzz...$c" >&4
8691 $cat > try.c <<EOCP
8692#include <sys/types.h>
8693#include <stdio.h>
8694int main() {
8695 printf("%d\n", (int)sizeof($fpostype));
8696 exit(0);
8697}
8698EOCP
8699 set try
8700 if eval $compile_ok; then
8701 yyy=`$run ./try`
8702 dflt="$lseeksize"
8703 case "$yyy" in
8704 '') echo " "
8705 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8706 ;;
8707 *) fpossize=$yyy
8708 echo " $fpossize bytes." >&4
8709 ;;
8710 esac
8711 else
8712 dflt="$fpossize"
8713 echo " "
8714 echo "(I can't compile the test program. Guessing...)" >&4
8715 rp="What is the size of your file positions (in bytes)?"
8716 . ./myread
8717 fpossize="$ans"
8718 fi
8719 $rm -f try.c try
8720 fi
8721 ;;
8722esac
8723
b4eb6b3d
JH
8724case "$vendorprefix" in
8725'') d_vendorbin="$undef"
8726 vendorbin=''
8727 vendorbinexp=''
8728 ;;
8729*) d_vendorbin="$define"
8730 : determine where vendor-supplied executables go.
8731 case "$vendorbin" in
8732 '') dflt=$vendorprefix/bin ;;
8733 *) dflt="$vendorbin" ;;
8734 esac
8735 fn=d~+
8736 rp='Pathname for the vendor-supplied executables directory?'
8737 . ./getfile
8738 vendorbin="$ans"
8739 vendorbinexp="$ansexp"
8740 ;;
8741esac
8742: Change installation prefix, if necessary.
8743if $test X"$prefix" != X"$installprefix"; then
8744 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8745else
8746 installvendorbin="$vendorbinexp"
8747fi
8748
8749: see if qgcvt exists
8750set qgcvt d_qgcvt
8751eval $inlibc
8752
b4eb6b3d 8753: Check how to convert floats to strings.
a5b10d80
YST
8754
8755if test "X$d_Gconvert" = X; then
8756
b4eb6b3d
JH
8757echo " "
8758echo "Checking for an efficient way to convert floats to strings."
8759echo " " > try.c
8760case "$uselongdouble" in
8761"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8762esac
8763case "$d_longdbl" in
8764"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8765esac
8766case "$d_PRIgldbl" in
8767"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8768esac
8769$cat >>try.c <<EOP
8770#ifdef TRY_gconvert
8771#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8772char *myname = "gconvert";
8773#endif
8774#ifdef TRY_gcvt
8775#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8776char *myname = "gcvt";
8777#endif
8778#ifdef TRY_qgcvt
8779#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8780char *myname = "qgcvt";
8781#define DOUBLETYPE long double
8782#endif
8783#ifdef TRY_sprintf
a5b10d80
YST
8784#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8785#ifdef HAS_PRIgldbl
b4eb6b3d
JH
8786#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8787#else
a5b10d80
YST
8788#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8789#endif
8790#else
b4eb6b3d
JH
8791#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8792#endif
8793char *myname = "sprintf";
8794#endif
8795
8796#ifndef DOUBLETYPE
8797#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8798#define DOUBLETYPE long double
8799#else
8800#define DOUBLETYPE double
8801#endif
8802#endif
8803
8804#include <stdio.h>
8805
8806#define I_STDLIB $i_stdlib
8807#ifdef I_STDLIB
8808#include <stdlib.h>
8809#endif
8810
8811int
8812checkit(expect, got)
8813char *expect;
8814char *got;
8815{
8816 if (strcmp(expect, got)) {
8817 printf("%s oddity: Expected %s, got %s\n",
8818 myname, expect, got);
8819 exit(1);
8820 }
8821}
8822
8823int main()
8824{
8825 char buf[64];
8826 buf[63] = '\0';
8827
8828 /* This must be 1st test on (which?) platform */
8829 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8830 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8831 checkit("0.1", buf);
8832
a5b10d80
YST
8833 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
8834 checkit("0.01", buf);
8835
8836 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
8837 checkit("0.001", buf);
8838
8839 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
8840 checkit("0.0001", buf);
8841
8842 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8843 if (strlen(buf) > 5)
8844 checkit("9e-005", buf); /* for Microsoft ?? */
8845 else
8846 checkit("9e-05", buf);
8847
b4eb6b3d
JH
8848 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8849 checkit("1", buf);
8850
8851 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8852 checkit("1.1", buf);
8853
8854 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8855 checkit("1.01", buf);
8856
8857 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8858 checkit("1.001", buf);
8859
8860 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8861 checkit("1.0001", buf);
8862
8863 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8864 checkit("1.00001", buf);
8865
8866 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8867 checkit("1.000001", buf);
8868
8869 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8870 checkit("0", buf);
8871
8872 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8873 checkit("-1", buf);
8874
8875 /* Some Linux gcvt's give 1.e+5 here. */
8876 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8877 checkit("100000", buf);
8878
8879 /* Some Linux gcvt's give -1.e+5 here. */
8880 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8881 checkit("-100000", buf);
8882
8883 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8884 checkit("123.456", buf);
8885
ab6ca9f4 8886 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
8887 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8888 /* 34 should be enough to scare even long double
8889 * places into using the e notation. */
ab6ca9f4 8890 if (strlen(buf) > 5)
94b339ad 8891 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 8892 else
94b339ad 8893 checkit("1e+34", buf);
8e2a5ede 8894
d1eb8299
YST
8895 /* For Perl, if you add additional tests here, also add them to
8896 * t/base/num.t for benefit of platforms not using Configure or
8897 * overriding d_Gconvert */
8898
b4eb6b3d
JH
8899 exit(0);
8900}
8901EOP
ab6ca9f4 8902: first add preferred functions to our list
a5b10d80 8903xxx_list=""
ab6ca9f4 8904for xxx_convert in $gconvert_preference; do
a5b10d80
YST
8905 case $xxx_convert in
8906 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 8907 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
8908 esac
8909done
8910: then add any others
8911for xxx_convert in gconvert gcvt sprintf; do
8912 case "$xxx_list" in
8913 *$xxx_convert*) ;;
8914 *) xxx_list="$xxx_list $xxx_convert" ;;
8915 esac
8916done
8917
8918case "$d_longdbl$uselongdouble" in
8919"$define$define")
8920 : again, add prefered functions to our list first
8921 xxx_ld_list=""
ab6ca9f4 8922 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
8923 case $xxx_convert in
8924 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 8925 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
8926 esac
8927 done
8928 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8929 for xxx_convert in qgcvt sprintf $xxx_list; do
8930 case "$xxx_ld_list" in
8931 $xxx_convert*|*" $xxx_convert"*) ;;
8932 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8933 esac
8934 done
8935 : if sprintf cannot do long doubles, move it to the end
8936 if test "$d_PRIgldbl" != "$define"; then
8937 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8938 fi
8939 : if no qgcvt, remove it
8940 if test "$d_qgcvt" != "$define"; then
8941 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8942 fi
8943 : use the ld_list
8944 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
8945 ;;
8946esac
8947
8948for xxx_convert in $xxx_list; do
8949 echo "Trying $xxx_convert..."
8950 $rm -f try try$_o
8951 set try -DTRY_$xxx_convert
8952 if eval $compile; then
8953 echo "$xxx_convert() found." >&4
5440bc8e 8954 if $run ./try; then
b4eb6b3d
JH
8955 echo "I'll use $xxx_convert to convert floats into a string." >&4
8956 break;
8957 else
8958 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 8959 xxx_convert=''
b4eb6b3d
JH
8960 fi
8961 else
8962 echo "$xxx_convert NOT found." >&4
8963 fi
8964done
ab6ca9f4 8965
a5b10d80
YST
8966if test X$xxx_convert = X; then
8967 echo "*** WHOA THERE!!! ***" >&4
8968 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
8969 xxx_convert=sprintf
8970fi
8971
b4eb6b3d
JH
8972case "$xxx_convert" in
8973gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8974gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8975qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8976*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8977 "$define$define$define")
8978 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
8979 "$define$define$undef")
8980 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
8981 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8982 esac
8983 ;;
8984esac
8985
a5b10d80
YST
8986fi
8987
74cac757
JH
8988: see if _fwalk exists
8989set fwalk d__fwalk
8990eval $inlibc
8991
b4eb6b3d
JH
8992: Initialize h_fcntl
8993h_fcntl=false
8994
8995: Initialize h_sysfile
8996h_sysfile=false
8997
8998: access call always available on UNIX
8999set access d_access
9000eval $inlibc
9001
9002: locate the flags for 'access()'
9003case "$d_access" in
9004"$define")
9005 echo " "
9006 $cat >access.c <<'EOCP'
9007#include <sys/types.h>
9008#ifdef I_FCNTL
9009#include <fcntl.h>
9010#endif
9011#ifdef I_SYS_FILE
9012#include <sys/file.h>
9013#endif
9014#ifdef I_UNISTD
9015#include <unistd.h>
9016#endif
9017int main() {
9018 exit(R_OK);
9019}
9020EOCP
9021 : check sys/file.h first, no particular reason here
9022 if $test `./findhdr sys/file.h` && \
7a282f6d 9023 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9024 h_sysfile=true;
9025 echo "<sys/file.h> defines the *_OK access constants." >&4
9026 elif $test `./findhdr fcntl.h` && \
7a282f6d 9027 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9028 h_fcntl=true;
9029 echo "<fcntl.h> defines the *_OK access constants." >&4
9030 elif $test `./findhdr unistd.h` && \
7a282f6d 9031 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9032 echo "<unistd.h> defines the *_OK access constants." >&4
9033 else
9034 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9035 fi
9036 ;;
9037esac
9038$rm -f access*
9039
9040: see if accessx exists
9041set accessx d_accessx
9042eval $inlibc
9043
9044: see if alarm exists
9045set alarm d_alarm
9046eval $inlibc
9047
a9dade78
JH
9048: see if POSIX threads are available
9049set pthread.h i_pthread
9050eval $inhdr
9051
10bc17b6
JH
9052: define a fucntion to check prototypes
9053$cat > protochk <<EOSH
9054$startsh
9055cc="$cc"
9056optimize="$optimize"
9057ccflags="$ccflags"
9058prototype="$prototype"
9059define="$define"
9060rm=$rm
a9dade78
JH
9061usethreads=$usethreads
9062i_pthread=$i_pthread
9063pthread_h_first=$pthread_h_first
10bc17b6
JH
9064EOSH
9065
9066$cat >> protochk <<'EOSH'
9067
9068$rm -f try.c
9069foo="$1"
9070shift
9071while test $# -ge 2; do
9072 case "$1" in
9073 $define) echo "#include <$2>" >> try.c ;;
9074 literal) echo "$2" >> try.c ;;
9075 esac
cce6a207
MB
9076 # Extra magic for the benefit of systems that need pthread.h
9077 # to be included early to correctly detect threadsafe functions.
9078 # Such functions must guarantee themselves, though, that the usethreads
9079 # and i_pthread have been defined, before calling protochk.
9080 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9081 echo "#include <pthread.h>" >> try.c
9082 pthread_h_done=yes
9083 fi
10bc17b6
JH
9084 shift 2
9085done
9086test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9087cat >> try.c <<'EOCP'
9088#ifdef CAN_PROTOTYPE
9089#define _(args) args
9090#else
9091#define _(args) ()
9092#endif
9093EOCP
9094echo "$foo" >> try.c
9095echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9096$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9097status=$?
9098$rm -f try.[co]
9099exit $status
9100EOSH
9101chmod +x protochk
9102$eunicefix protochk
9103
a48ec845
JH
9104hasproto='varname=$1; func=$2; shift; shift;
9105while $test $# -ge 2; do
9106 case "$1" in
9107 $define) echo "#include <$2>";;
9108 esac ;
9109 shift 2;
9110done > try.c;
9111$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9112if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9113 echo "$func() prototype found.";
9114 val="$define";
9115else
9116 echo "$func() prototype NOT found.";
9117 val="$undef";
9118fi;
9119set $varname;
9120eval $setvar;
9121$rm -f try.c tryout.c'
9122
10bc17b6
JH
9123: see if sys/types.h has to be included
9124set sys/types.h i_systypes
9125eval $inhdr
9126
9127: see if sys/select.h has to be included
9128set sys/select.h i_sysselct
9129eval $inhdr
9130
9131hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9132while $test $# -ge 2; do
9133 case "$1" in
9134 $define) echo "#include <$2>";;
9135 esac ;
9136 shift 2;
9137done > try.c;
9138echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9139set try;
9140if eval $compile; then
9141 val="$define";
9142else
9143 val="$undef";
9144fi;
9145set $varname;
9146eval $setvar;
9147$rm -f try.c try.o'
9148
9149: see if we should include time.h, sys/time.h, or both
9150echo " "
9151if test "X$timeincl" = X; then
9152 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9153 $echo $n "I'm now running the test program...$c"
9154 $cat >try.c <<'EOCP'
9155#include <sys/types.h>
9156#ifdef I_TIME
9157#include <time.h>
9158#endif
9159#ifdef I_SYSTIME
9160#ifdef SYSTIMEKERNEL
9161#define KERNEL
9162#endif
9163#include <sys/time.h>
9164#endif
9165#ifdef I_SYSSELECT
9166#include <sys/select.h>
9167#endif
9168int main()
9169{
9170 struct tm foo;
9171#ifdef S_TIMEVAL
9172 struct timeval bar;
9173#endif
9174#ifdef S_TIMEZONE
9175 struct timezone tzp;
9176#endif
9177 if (foo.tm_sec == foo.tm_sec)
9178 exit(0);
9179#ifdef S_TIMEVAL
9180 if (bar.tv_sec == bar.tv_sec)
9181 exit(0);
9182#endif
9183 exit(1);
9184}
9185EOCP
9186 flags=''
9187 for s_timezone in '-DS_TIMEZONE' ''; do
9188 sysselect=''
9189 for s_timeval in '-DS_TIMEVAL' ''; do
9190 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9191 for i_time in '' '-DI_TIME'; do
9192 for i_systime in '-DI_SYSTIME' ''; do
9193 case "$flags" in
9194 '') $echo $n ".$c"
9195 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9196 if eval $compile; then
9197 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9198 shift
9199 flags="$*"
9200 echo " "
9201 $echo $n "Succeeded with $flags$c"
9202 fi
9203 ;;
9204 esac
9205 done
9206 done
9207 done
9208 done
9209 done
9210 timeincl=''
9211 echo " "
9212 case "$flags" in
9213 *SYSTIMEKERNEL*) i_systimek="$define"
9214 timeincl=`./findhdr sys/time.h`
9215 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9216 *) i_systimek="$undef";;
9217 esac
9218 case "$flags" in
9219 *I_TIME*) i_time="$define"
9220 timeincl=`./findhdr time.h`" $timeincl"
9221 echo "We'll include <time.h>." >&4;;
9222 *) i_time="$undef";;
9223 esac
9224 case "$flags" in
9225 *I_SYSTIME*) i_systime="$define"
9226 timeincl=`./findhdr sys/time.h`" $timeincl"
9227 echo "We'll include <sys/time.h>." >&4;;
9228 *) i_systime="$undef";;
9229 esac
9230 $rm -f try.c try
9231fi
9232: see if struct tm knows about tm_zone
9233case "$i_systime$i_time" in
9234*$define*)
9235 echo " "
9236 echo "Checking to see if your struct tm has tm_zone field..." >&4
9237 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9238 eval $hasfield
9239 ;;
9240*) val="$undef"
9241 set d_tm_tm_zone
9242 eval $setvar
9243 ;;
9244esac
9245case "$d_tm_tm_zone" in
9246"$define") echo "Yes, it does." ;;
9247*) echo "No, it doesn't." ;;
9248esac
9249: see if struct tm knows about tm_gmtoff
9250case "$i_systime$i_time" in
9251*$define*)
9252 echo " "
9253 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9254 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9255 eval $hasfield
9256 ;;
9257*) val="$undef"
9258 set d_tm_tm_gmtoff
9259 eval $setvar
9260 ;;
9261esac
9262case "$d_tm_tm_gmtoff" in
9263"$define") echo "Yes, it does." ;;
9264*) echo "No, it doesn't." ;;
9265esac
9266
9267: see if asctime_r exists
9268set asctime_r d_asctime_r
9269eval $inlibc
9270case "$d_asctime_r" in
9271"$define")
d63eadf0 9272 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9273 case "$d_asctime_r_proto:$usethreads" in
9274 ":define") d_asctime_r_proto=define
a48ec845
JH
9275 set d_asctime_r_proto asctime_r $hdrs
9276 eval $hasproto ;;
9277 *) ;;
9278 esac
9279 case "$d_asctime_r_proto" in
9280 define)
10bc17b6
JH
9281 case "$asctime_r_proto" in
9282 ''|0) try='char* asctime_r(const struct tm*, char*);'
9283 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9284 esac
9285 case "$asctime_r_proto" in
9286 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9287 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9288 esac
9289 case "$asctime_r_proto" in
9290 ''|0) try='int asctime_r(const struct tm*, char*);'
9291 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9292 esac
9293 case "$asctime_r_proto" in
9294 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9295 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9296 esac
9297 case "$asctime_r_proto" in
90e831dc 9298 ''|0) d_asctime_r=undef
10bc17b6 9299 asctime_r_proto=0
a48ec845 9300 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9301 * ) case "$asctime_r_proto" in
9302 REENTRANT_PROTO*) ;;
9303 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9304 esac
9305 echo "Prototype: $try" ;;
9306 esac
9307 ;;
c18e646a
JH
9308 *) case "$usethreads" in
9309 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9310 esac
90e831dc
SB
9311 d_asctime_r=undef
9312 asctime_r_proto=0
c18e646a 9313 ;;
a48ec845
JH
9314 esac
9315 ;;
10bc17b6
JH
9316*) asctime_r_proto=0
9317 ;;
9318esac
9319
b4eb6b3d
JH
9320: see if atolf exists
9321set atolf d_atolf
9322eval $inlibc
9323
9324: see if atoll exists
9325set atoll d_atoll
9326eval $inlibc
9327
9328: Look for GNU-cc style attribute checking
9329echo " "
9330echo "Checking whether your compiler can handle __attribute__ ..." >&4
9331$cat >attrib.c <<'EOCP'
9332#include <stdio.h>
9333void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9334EOCP
9335if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9336 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9337 echo "Your C compiler doesn't fully support __attribute__."
9338 val="$undef"
9339 else
9340 echo "Your C compiler supports __attribute__."
9341 val="$define"
9342 fi
9343else
9344 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9345 val="$undef"
9346fi
9347set d_attribut
9348eval $setvar
9349$rm -f attrib*
9350
9351: see if bcmp exists
9352set bcmp d_bcmp
9353eval $inlibc
9354
9355: see if bcopy exists
9356set bcopy d_bcopy
9357eval $inlibc
9358
9359: see if this is a unistd.h system
9360set unistd.h i_unistd
9361eval $inhdr
9362
9363: see if getpgrp exists
9364set getpgrp d_getpgrp
9365eval $inlibc
9366
9367case "$d_getpgrp" in
9368"$define")
9369 echo " "
9370 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 9371 $cat >try.c <<EOP
b4eb6b3d
JH
9372#$i_unistd I_UNISTD
9373#include <sys/types.h>
9374#ifdef I_UNISTD
9375# include <unistd.h>
9376#endif
9377int main()
9378{
9379 if (getuid() == 0) {
9380 printf("(I see you are running Configure as super-user...)\n");
9381 setuid(1);
9382 }
9383#ifdef TRY_BSD_PGRP
9384 if (getpgrp(1) == 0)
9385 exit(0);
9386#else
9387 if (getpgrp() > 0)
9388 exit(0);
9389#endif
9390 exit(1);
9391}
9392EOP
5440bc8e 9393 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9394 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9395 val="$define"
5440bc8e 9396 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9397 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9398 val="$undef"
9399 else
9400 echo "I can't seem to compile and run the test program."
9401 if ./usg; then
9402 xxx="a USG one, i.e. you use getpgrp()."
9403 else
9404 # SVR4 systems can appear rather BSD-ish.
9405 case "$i_unistd" in
9406 $undef)
9407 xxx="a BSD one, i.e. you use getpgrp(pid)."
9408 val="$define"
9409 ;;
9410 $define)
9411 xxx="probably a USG one, i.e. you use getpgrp()."
9412 val="$undef"
9413 ;;
9414 esac
9415 fi
9416 echo "Assuming your getpgrp is $xxx" >&4
9417 fi
9418 ;;
9419*) val="$undef";;
9420esac
9421set d_bsdgetpgrp
9422eval $setvar
5440bc8e 9423$rm -f try try.*
b4eb6b3d
JH
9424
9425: see if setpgrp exists
9426set setpgrp d_setpgrp
9427eval $inlibc
9428
9429case "$d_setpgrp" in
9430"$define")
9431 echo " "
9432 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 9433 $cat >try.c <<EOP
b4eb6b3d
JH
9434#$i_unistd I_UNISTD
9435#include <sys/types.h>
9436#ifdef I_UNISTD
9437# include <unistd.h>
9438#endif
9439int main()
9440{
9441 if (getuid() == 0) {
9442 printf("(I see you are running Configure as super-user...)\n");
9443 setuid(1);
9444 }
9445#ifdef TRY_BSD_PGRP
9446 if (-1 == setpgrp(1, 1))
9447 exit(0);
9448#else
9449 if (setpgrp() != -1)
9450 exit(0);
9451#endif
9452 exit(1);
9453}
9454EOP
5440bc8e 9455 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9456 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9457 val="$define"
5440bc8e 9458 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9459 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9460 val="$undef"
9461 else
9462 echo "(I can't seem to compile and run the test program.)"
9463 if ./usg; then
9464 xxx="a USG one, i.e. you use setpgrp()."
9465 else
9466 # SVR4 systems can appear rather BSD-ish.
9467 case "$i_unistd" in
9468 $undef)
9469 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9470 val="$define"
9471 ;;
9472 $define)
9473 xxx="probably a USG one, i.e. you use setpgrp()."
9474 val="$undef"
9475 ;;
9476 esac
9477 fi
9478 echo "Assuming your setpgrp is $xxx" >&4
9479 fi
9480 ;;
9481*) val="$undef";;
9482esac
9483set d_bsdsetpgrp
9484eval $setvar
5440bc8e 9485$rm -f try try.*
b4eb6b3d
JH
9486: see if bzero exists
9487set bzero d_bzero
9488eval $inlibc
9489
9490: see if signal is declared as pointer to function returning int or void
9491echo " "
9492xxx=`./findhdr signal.h`
9493$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9494if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9495 echo "You have int (*signal())() instead of void." >&4
9496 val="$undef"
9497elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9498 echo "You have void (*signal())()." >&4
9499 val="$define"
9500elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9501 echo "You have int (*signal())() instead of void." >&4
9502 val="$undef"
9503elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9504 echo "You have void (*signal())()." >&4
9505 val="$define"
9506else
9507 case "$d_voidsig" in
9508 '')
9509 echo "I can't determine whether signal handler returns void or int..." >&4
9510 dflt=void
9511 rp="What type does your signal handler return?"
9512 . ./myread
9513 case "$ans" in
9514 v*) val="$define";;
9515 *) val="$undef";;
9516 esac;;
9517 "$define")
9518 echo "As you already told me, signal handler returns void." >&4
9519 val="$define"
9520 ;;
9521 *) echo "As you already told me, signal handler returns int." >&4
9522 val="$undef"
9523 ;;
9524 esac
9525fi
9526set d_voidsig
9527eval $setvar
9528case "$d_voidsig" in
9529"$define") signal_t="void";;
9530*) signal_t="int";;
9531esac
9532$rm -f $$.tmp
9533
9534: check for ability to cast large floats to 32-bit ints.
9535echo " "
9536echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9537if $test "$intsize" -ge 4; then
9538 xxx=int
9539else
9540 xxx=long
9541fi
9542$cat >try.c <<EOCP
9543#include <stdio.h>
9544#include <sys/types.h>
9545#include <signal.h>
9546$signal_t blech(s) int s; { exit(3); }
9547int main()
9548{
9549 $xxx i32;
9550 double f, g;
9551 int result = 0;
9552 char str[16];
9553 signal(SIGFPE, blech);
9554
9555 /* Don't let compiler optimize the test away. Store the number
9556 in a writable string for gcc to pass to sscanf under HP/UX.
9557 */
9558 sprintf(str, "2147483647");
9559 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9560 g = 10 * f;
9561 i32 = ($xxx) g;
9562
9563 /* x86 processors will probably give 0x8000 0000, which is a
9564 sign change. We don't want that. We want to mimic SPARC
9565 behavior here, which is to preserve the sign and give
9566 back 0x7fff ffff.
9567 */
9568 if (i32 != ($xxx) f)
9569 result |= 1;
9570 exit(result);
9571}
9572EOCP
9573set try
9574if eval $compile_ok; then
5440bc8e 9575 $run ./try
b4eb6b3d
JH
9576 yyy=$?
9577else
9578 echo "(I can't seem to compile the test program--assuming it can't)"
9579 yyy=1
9580fi
9581case "$yyy" in
95820) val="$define"
9583 echo "Yup, it can."
9584 ;;
9585*) val="$undef"
9586 echo "Nope, it can't."
9587 ;;
9588esac
9589set d_casti32
9590eval $setvar
9591$rm -f try try.*
9592
9593: check for ability to cast negative floats to unsigned
9594echo " "
9595echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9596$cat >try.c <<EOCP
9597#include <stdio.h>
9598#include <sys/types.h>
9599#include <signal.h>
9600$signal_t blech(s) int s; { exit(7); }
9601$signal_t blech_in_list(s) int s; { exit(4); }
9602unsigned long dummy_long(p) unsigned long p; { return p; }
9603unsigned int dummy_int(p) unsigned int p; { return p; }
9604unsigned short dummy_short(p) unsigned short p; { return p; }
9605int main()
9606{
9607 double f;
9608 unsigned long along;
9609 unsigned int aint;
9610 unsigned short ashort;
9611 int result = 0;
9612 char str[16];
9613
9614 /* Frustrate gcc-2.7.2's optimizer which failed this test with
9615 a direct f = -123. assignment. gcc-2.8.0 reportedly
9616 optimized the whole file away
9617 */
9618 /* Store the number in a writable string for gcc to pass to
9619 sscanf under HP/UX.
9620 */
9621 sprintf(str, "-123");
9622 sscanf(str, "%lf", &f); /* f = -123.; */
9623
9624 signal(SIGFPE, blech);
9625 along = (unsigned long)f;
9626 aint = (unsigned int)f;
9627 ashort = (unsigned short)f;
9628 if (along != (unsigned long)-123)
9629 result |= 1;
9630 if (aint != (unsigned int)-123)
9631 result |= 1;
9632 if (ashort != (unsigned short)-123)
9633 result |= 1;
9634 sprintf(str, "1073741824.");
9635 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9636 f = f + f;
9637 along = 0;
9638 along = (unsigned long)f;
9639 if (along != 0x80000000)
9640 result |= 2;
9641 f -= 1.;
9642 along = 0;
9643 along = (unsigned long)f;
9644 if (along != 0x7fffffff)
9645 result |= 1;
9646 f += 2.;
9647 along = 0;
9648 along = (unsigned long)f;
9649 if (along != 0x80000001)
9650 result |= 2;
9651 if (result)
9652 exit(result);
9653 signal(SIGFPE, blech_in_list);
9654 sprintf(str, "123.");
9655 sscanf(str, "%lf", &f); /* f = 123.; */
9656 along = dummy_long((unsigned long)f);
9657 aint = dummy_int((unsigned int)f);
9658 ashort = dummy_short((unsigned short)f);
9659 if (along != (unsigned long)123)
9660 result |= 4;
9661 if (aint != (unsigned int)123)
9662 result |= 4;
9663 if (ashort != (unsigned short)123)
9664 result |= 4;
9665 exit(result);
9666
9667}
9668EOCP
9669set try
9670if eval $compile_ok; then
5440bc8e 9671 $run ./try
b4eb6b3d
JH
9672 castflags=$?
9673else
9674 echo "(I can't seem to compile the test program--assuming it can't)"
9675 castflags=7
9676fi
9677case "$castflags" in
96780) val="$define"
9679 echo "Yup, it can."
9680 ;;
9681*) val="$undef"
9682 echo "Nope, it can't."
9683 ;;
9684esac
9685set d_castneg
9686eval $setvar
9687$rm -f try.*
9688
9689: see if vprintf exists
9690echo " "
9691if set vprintf val -f d_vprintf; eval $csym; $val; then
9692 echo 'vprintf() found.' >&4
9693 val="$define"
5440bc8e 9694 $cat >try.c <<'EOF'
b4eb6b3d
JH
9695#include <varargs.h>
9696
9697int main() { xxx("foo"); }
9698
9699xxx(va_alist)
9700va_dcl
9701{
9702 va_list args;
9703 char buf[10];
9704
9705 va_start(args);
9706 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9707}
9708EOF
5440bc8e
JH
9709 set try
9710 if eval $compile && $run ./try; then
b4eb6b3d
JH
9711 echo "Your vsprintf() returns (int)." >&4
9712 val2="$undef"
9713 else
9714 echo "Your vsprintf() returns (char*)." >&4
9715 val2="$define"
9716 fi
9717else
9718 echo 'vprintf() NOT found.' >&4
9719 val="$undef"
9720 val2="$undef"
9721fi
5440bc8e 9722$rm -f try try.*
b4eb6b3d
JH
9723set d_vprintf
9724eval $setvar
9725val=$val2
9726set d_charvspr
9727eval $setvar
9728
9729: see if chown exists
9730set chown d_chown
9731eval $inlibc
9732
9733: see if chroot exists
9734set chroot d_chroot
9735eval $inlibc
9736
9737: see if chsize exists
9738set chsize d_chsize
9739eval $inlibc
9740
758a5d79
JH
9741: see if class exists
9742set class d_class
9743eval $inlibc
9744
4e0554ec
JH
9745hasstruct='varname=$1; struct=$2; shift; shift;
9746while $test $# -ge 2; do
9747 case "$1" in
9748 $define) echo "#include <$2>";;
9749 esac ;
9750 shift 2;
9751done > try.c;
9752echo "int main () { struct $struct foo; }" >> try.c;
9753set try;
9754if eval $compile; then
9755 val="$define";
9756else
9757 val="$undef";
9758fi;
9759set $varname;
9760eval $setvar;
9761$rm -f try.c try.o'
9762
4e0554ec
JH
9763socketlib=''
9764sockethdr=''
9765: see whether socket exists
9766echo " "
9767$echo $n "Hmm... $c" >&4
9768if set socket val -f d_socket; eval $csym; $val; then
9769 echo "Looks like you have Berkeley networking support." >&4
9770 d_socket="$define"
9771 if set setsockopt val -f; eval $csym; $val; then
9772 d_oldsock="$undef"
9773 else
9774 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9775 d_oldsock="$define"
9776 fi
9777else
9778 if $contains socklib libc.list >/dev/null 2>&1; then
9779 echo "Looks like you have Berkeley networking support." >&4
9780 d_socket="$define"
9781 : we will have to assume that it supports the 4.2 BSD interface
9782 d_oldsock="$undef"
9783 else
9784 echo "You don't have Berkeley networking in libc$_a..." >&4
9785 if test "X$d_socket" = "X$define"; then
9786 echo "...but you seem to believe that you have sockets." >&4
9787 else
9788 for net in net socket
9789 do
9790 if test -f /usr/lib/lib$net$_a; then
9791 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
9792 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9793 if $contains socket libc.list >/dev/null 2>&1; then
9794 d_socket="$define"
9795 socketlib="-l$net"
9796 case "$net" in
9797 net)
9798 echo "...but the Wollongong group seems to have hacked it in." >&4
9799 sockethdr="-I/usr/netinclude"
9800 ;;
9801 esac
3c728e00 9802 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
9803 if $contains setsockopt libc.list >/dev/null 2>&1; then
9804 d_oldsock="$undef"
9805 else
9806 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9807 d_oldsock="$define"
9808 fi
9809 break
9810 fi
9811 fi
9812 done
9813 if test "X$d_socket" != "X$define"; then
9814 echo "or anywhere else I see." >&4
9815 d_socket="$undef"
9816 d_oldsock="$undef"
9817 fi
9818 fi
9819 fi
9820fi
9821
9822: see if socketpair exists
9823set socketpair d_sockpair
9824eval $inlibc
9825
9826
9827echo " "
3c728e00 9828echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
9829for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9830 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9831 $cat >try.c <<EOF
9832#include <sys/types.h>
9833#include <sys/socket.h>
9834int main() {
9835 int i = $ENUM;
9836}
9837EOF
9838 val="$undef"
9839 set try; if eval $compile; then
9840 val="$define"
9841 fi
9842 set d_${enum}; eval $setvar
9843 $rm -f try.c try
9844done
9845
9846: see if this is a sys/uio.h system
9847set sys/uio.h i_sysuio
9848eval $inhdr
9849
9850
9851echo " "
9852echo "Checking to see if your system supports struct cmsghdr..." >&4
9853set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9854eval $hasstruct
9855case "$d_cmsghdr_s" in
9856"$define") echo "Yes, it does." ;;
9857*) echo "No, it doesn't." ;;
9858esac
9859
9860
b4eb6b3d
JH
9861: check for const keyword
9862echo " "
9863echo 'Checking to see if your C compiler knows about "const"...' >&4
9864$cat >const.c <<'EOCP'
9865typedef struct spug { int drokk; } spug;
9866int main()
9867{
9868 const char *foo;
9869 const spug y;
9870}
9871EOCP
9872if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9873 val="$define"
9874 echo "Yup, it does."
9875else
9876 val="$undef"
9877 echo "Nope, it doesn't."
9878fi
9879set d_const
9880eval $setvar
9881
9882: see if crypt exists
9883echo " "
a5a94ea5
JH
9884set crypt d_crypt
9885eval $inlibc
9886case "$d_crypt" in
9887$define) cryptlib='' ;;
9888*) if set crypt val -f d_crypt; eval $csym; $val; then
9889 echo 'crypt() found.' >&4
b4eb6b3d 9890 val="$define"
a5a94ea5
JH
9891 cryptlib=''
9892 else
9893 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9894 if $test -z "$cryptlib"; then
9895 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9896 else
9897 cryptlib=-lcrypt
9898 fi
9899 if $test -z "$cryptlib"; then
9900 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9901 else
9902 cryptlib=-lcrypt
9903 fi
9904 if $test -z "$cryptlib"; then
9905 cryptlib=`./loc libcrypt$_a "" $libpth`
9906 else
9907 cryptlib=-lcrypt
9908 fi
9909 if $test -z "$cryptlib"; then
9910 echo 'crypt() NOT found.' >&4
9911 val="$undef"
9912 else
9913 val="$define"
9914 fi
b4eb6b3d 9915 fi
a5a94ea5
JH
9916 set d_crypt
9917 eval $setvar
9918 ;;
9919esac
b4eb6b3d 9920
10bc17b6
JH
9921: see if this is a crypt.h system
9922set crypt.h i_crypt
9923eval $inhdr
9924
9925: see if crypt_r exists
9926set crypt_r d_crypt_r
9927eval $inlibc
9928case "$d_crypt_r" in
9929"$define")
9930 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
9931 case "$d_crypt_r_proto:$usethreads" in
9932 ":define") d_crypt_r_proto=define
a48ec845
JH
9933 set d_crypt_r_proto crypt_r $hdrs
9934 eval $hasproto ;;
9935 *) ;;
9936 esac
9937 case "$d_crypt_r_proto" in
9938 define)
10bc17b6
JH
9939 case "$crypt_r_proto" in
9940 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9941 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9942 esac
9943 case "$crypt_r_proto" in
b430fd04
JH
9944 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9945 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9946 esac
9947 case "$crypt_r_proto" in
90e831dc 9948 ''|0) d_crypt_r=undef
10bc17b6 9949 crypt_r_proto=0
a48ec845 9950 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9951 * ) case "$crypt_r_proto" in
9952 REENTRANT_PROTO*) ;;
9953 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9954 esac
9955 echo "Prototype: $try" ;;
9956 esac
9957 ;;
c18e646a
JH
9958 *) case "$usethreads" in
9959 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9960 esac
90e831dc
SB
9961 d_crypt_r=undef
9962 crypt_r_proto=0
c18e646a 9963 ;;
a48ec845
JH
9964 esac
9965 ;;
10bc17b6
JH
9966*) crypt_r_proto=0
9967 ;;
9968esac
9969
b4eb6b3d
JH
9970: get csh whereabouts
9971case "$csh" in
9972'csh') val="$undef" ;;
9973*) val="$define" ;;
9974esac
9975set d_csh
9976eval $setvar
9977: Respect a hint or command line value for full_csh.
9978case "$full_csh" in
9979'') full_csh=$csh ;;
9980esac
9981
10bc17b6
JH
9982: see if ctermid_r exists
9983set ctermid_r d_ctermid_r
9984eval $inlibc
9985case "$d_ctermid_r" in
9986"$define")
31ee0cb7 9987 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
9988 case "$d_ctermid_r_proto:$usethreads" in
9989 ":define") d_ctermid_r_proto=define
a48ec845
JH
9990 set d_ctermid_r_proto ctermid_r $hdrs
9991 eval $hasproto ;;
9992 *) ;;
9993 esac
9994 case "$d_ctermid_r_proto" in
9995 define)
10bc17b6
JH
9996 case "$ctermid_r_proto" in
9997 ''|0) try='char* ctermid_r(char*);'
9998 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
9999 esac
10000 case "$ctermid_r_proto" in
90e831dc 10001 ''|0) d_ctermid_r=undef
10bc17b6 10002 ctermid_r_proto=0
a48ec845 10003 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10004 * ) case "$ctermid_r_proto" in
10005 REENTRANT_PROTO*) ;;
10006 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10007 esac
10008 echo "Prototype: $try" ;;
10009 esac
10010 ;;
c18e646a
JH
10011 *) case "$usethreads" in
10012 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10013 esac
90e831dc
SB
10014 d_ctermid_r=undef
10015 ctermid_r_proto=0
c18e646a 10016 ;;
a48ec845
JH
10017 esac
10018 ;;
10bc17b6
JH
10019*) ctermid_r_proto=0
10020 ;;
10021esac
10022
10023: see if ctime_r exists
10024set ctime_r d_ctime_r
10025eval $inlibc
10026case "$d_ctime_r" in
10027"$define")
d63eadf0 10028 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10029 case "$d_ctime_r_proto:$usethreads" in
10030 ":define") d_ctime_r_proto=define
a48ec845
JH
10031 set d_ctime_r_proto ctime_r $hdrs
10032 eval $hasproto ;;
10033 *) ;;
10034 esac
10035 case "$d_ctime_r_proto" in
10036 define)
10bc17b6
JH
10037 case "$ctime_r_proto" in
10038 ''|0) try='char* ctime_r(const time_t*, char*);'
10039 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10040 esac
10041 case "$ctime_r_proto" in
10042 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10043 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10044 esac
10045 case "$ctime_r_proto" in
10046 ''|0) try='int ctime_r(const time_t*, char*);'
10047 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10048 esac
10049 case "$ctime_r_proto" in
10050 ''|0) try='int ctime_r(const time_t*, char*, int);'
10051 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10052 esac
10053 case "$ctime_r_proto" in
90e831dc 10054 ''|0) d_ctime_r=undef
10bc17b6 10055 ctime_r_proto=0
a48ec845 10056 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10057 * ) case "$ctime_r_proto" in
10058 REENTRANT_PROTO*) ;;
10059 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10060 esac
10061 echo "Prototype: $try" ;;
10062 esac
10063 ;;
c18e646a
JH
10064 *) case "$usethreads" in
10065 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10066 esac
90e831dc
SB
10067 d_ctime_r=undef
10068 ctime_r_proto=0
c18e646a 10069 ;;
a48ec845
JH
10070 esac
10071 ;;
10bc17b6
JH
10072*) ctime_r_proto=0
10073 ;;
10074esac
10075
b4eb6b3d
JH
10076: see if cuserid exists
10077set cuserid d_cuserid
10078eval $inlibc
10079
10080: see if this is a limits.h system
10081set limits.h i_limits
10082eval $inhdr
10083
10084: see if this is a float.h system
10085set float.h i_float
10086eval $inhdr
10087
10088: See if number of significant digits in a double precision number is known
10089echo " "
10090$cat >dbl_dig.c <<EOM
10091#$i_limits I_LIMITS
10092#$i_float I_FLOAT
10093#ifdef I_LIMITS
10094#include <limits.h>
10095#endif
10096#ifdef I_FLOAT
10097#include <float.h>
10098#endif
10099#ifdef DBL_DIG
10100printf("Contains DBL_DIG");
10101#endif
10102EOM
10103$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10104if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10105 echo "DBL_DIG found." >&4
10106 val="$define"
10107else
10108 echo "DBL_DIG NOT found." >&4
10109 val="$undef"
10110fi
10111$rm -f dbl_dig.?
10112set d_dbl_dig
10113eval $setvar
10114
2ef53570
JH
10115: see if dbm.h is available
10116: see if dbmclose exists
10117set dbmclose d_dbmclose
10118eval $inlibc
10119
10120case "$d_dbmclose" in
10121$define)
10122 set dbm.h i_dbm
10123 eval $inhdr
10124 case "$i_dbm" in
10125 $define)
10126 val="$undef"
10127 set i_rpcsvcdbm
10128 eval $setvar
10129 ;;
10130 *) set rpcsvc/dbm.h i_rpcsvcdbm
10131 eval $inhdr
10132 ;;
10133 esac
10134 ;;
10135*) echo "We won't be including <dbm.h>"
10136 val="$undef"
10137 set i_dbm
10138 eval $setvar
10139 val="$undef"
10140 set i_rpcsvcdbm
10141 eval $setvar
10142 ;;
10143esac
10144
10145: see if prototype for dbminit is available
10146echo " "
10147set d_dbminitproto dbminit $i_dbm dbm.h
10148eval $hasproto
10149
b4eb6b3d
JH
10150: see if difftime exists
10151set difftime d_difftime
10152eval $inlibc
10153
10154: see if this is a dirent system
10155echo " "
10156if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10157 val="$define"
10158 echo "<dirent.h> found." >&4
10159else
10160 val="$undef"
10161 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10162 echo "<sys/dir.h> found." >&4
10163 echo " "
10164 else
10165 xinc=`./findhdr sys/ndir.h`
10166 fi
10167 echo "<dirent.h> NOT found." >&4
10168fi
10169set i_dirent
10170eval $setvar
10171
10172: Look for type of directory structure.
10173echo " "
10174$cppstdin $cppflags $cppminus < "$xinc" > try.c
10175
10176case "$direntrytype" in
10177''|' ')
10178 case "$i_dirent" in
10179 $define) guess1='struct dirent' ;;
10180 *) guess1='struct direct' ;;
10181 esac
10182 ;;
10183*) guess1="$direntrytype"
10184 ;;
10185esac
10186
10187case "$guess1" in
10188'struct dirent') guess2='struct direct' ;;
10189*) guess2='struct dirent' ;;
10190esac
10191
10192if $contains "$guess1" try.c >/dev/null 2>&1; then
10193 direntrytype="$guess1"
10194 echo "Your directory entries are $direntrytype." >&4
10195elif $contains "$guess2" try.c >/dev/null 2>&1; then
10196 direntrytype="$guess2"
10197 echo "Your directory entries seem to be $direntrytype." >&4
10198else
10199 echo "I don't recognize your system's directory entries." >&4
10200 rp="What type is used for directory entries on this system?"
10201 dflt="$guess1"
10202 . ./myread
10203 direntrytype="$ans"
10204fi
10205$rm -f try.c
10206
10207
10208: see if the directory entry stores field length
10209echo " "
10210$cppstdin $cppflags $cppminus < "$xinc" > try.c
10211if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10212 echo "Good, your directory entry keeps length information in d_namlen." >&4
10213 val="$define"
10214else
10215 echo "Your directory entry does not know about the d_namlen field." >&4
10216 val="$undef"
10217fi
10218set d_dirnamlen
10219eval $setvar
10220$rm -f try.c
10221
ae0e3d3b
JH
10222: see if this is an sysdir system
10223set sys/dir.h i_sysdir
10224eval $inhdr
10225
10226: see if this is an sysndir system
10227set sys/ndir.h i_sysndir
10228eval $inhdr
10229
10230: Look for dirfd
10231echo " "
10232$cat >dirfd.c <<EOM
10233#include <stdio.h>
10234#$i_dirent I_DIRENT /**/
10235#$i_sysdir I_SYS_DIR /**/
10236#$i_sysndir I_SYS_NDIR /**/
10237#$i_systypes I_SYS_TYPES /**/
10238#if defined(I_SYS_TYPES)
10239#include <sys/types.h>
10240#endif
10241#if defined(I_DIRENT)
10242#include <dirent.h>
10243#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10244#include <sys/dir.h>
10245#endif
10246#else
10247#ifdef I_SYS_NDIR
10248#include <sys/ndir.h>
10249#else
10250#ifdef I_SYS_DIR
10251#ifdef hp9000s500
10252#include <ndir.h> /* may be wrong in the future */
10253#else
10254#include <sys/dir.h>
10255#endif
10256#endif
10257#endif
10258#endif
10259int main() {
10260 DIR *dirp = opendir(".");
10261 if (dirfd(dirp) >= 0)
10262 exit(0);
10263 else
10264 exit(1);
10265}
10266EOM
10267set dirfd
10268if eval $compile; then
10269 val="$define"
10270fi
10271case "$val" in
10272$define) echo "dirfd() found." >&4 ;;
10273*) echo "dirfd() NOT found." >&4 ;;
10274esac
10275set d_dirfd
10276eval $setvar
10277$rm -f dirfd*
10278
b4eb6b3d
JH
10279: see if dlerror exists
10280xxx_runnm="$runnm"
10281runnm=false
10282set dlerror d_dlerror
10283eval $inlibc
10284runnm="$xxx_runnm"
10285
10286: see if dlfcn is available
10287set dlfcn.h i_dlfcn
10288eval $inhdr
10289
10290case "$usedl" in
10291$define|y|true)
10292 $cat << EOM
10293
10294On a few systems, the dynamically loaded modules that perl generates and uses
10295will need a different extension than shared libs. The default will probably
10296be appropriate.
10297
10298EOM
10299 case "$dlext" in
10300 '') dflt="$so" ;;
10301 *) dflt="$dlext" ;;
10302 esac
10303 rp='What is the extension of dynamically loaded modules'
10304 . ./myread
10305 dlext="$ans"
10306 ;;
10307*)
10308 dlext="none"
10309 ;;
10310esac
10311
10312: Check if dlsym need a leading underscore
10313echo " "
10314val="$undef"
10315
10316case "$dlsrc" in
10317dl_dlopen.xs)
10318 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10319 $cat >dyna.c <<'EOM'
10320fred () { }
10321EOM
10322
10323$cat >fred.c<<EOM
10324
10325#include <stdio.h>
10326#$i_dlfcn I_DLFCN
10327#ifdef I_DLFCN
5440bc8e 10328#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
10329#else
10330#include <sys/types.h>
10331#include <nlist.h>
10332#include <link.h>
10333#endif
10334
10335extern int fred() ;
10336
10337int main()
10338{
10339 void * handle ;
10340 void * symbol ;
10341#ifndef RTLD_LAZY
10342 int mode = 1 ;
10343#else
10344 int mode = RTLD_LAZY ;
10345#endif
10346 handle = dlopen("./dyna.$dlext", mode) ;
10347 if (handle == NULL) {
10348 printf ("1\n") ;
10349 fflush (stdout) ;
10350 exit(0);
10351 }
10352 symbol = dlsym(handle, "fred") ;
10353 if (symbol == NULL) {
10354 /* try putting a leading underscore */
10355 symbol = dlsym(handle, "_fred") ;
10356 if (symbol == NULL) {
10357 printf ("2\n") ;
10358 fflush (stdout) ;
10359 exit(0);
10360 }
10361 printf ("3\n") ;
10362 }
10363 else
10364 printf ("4\n") ;
10365 fflush (stdout) ;
10366 exit(0);
10367}
10368EOM
10369 : Call the object file tmp-dyna.o in case dlext=o.
10370 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10371 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 10372 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
10373 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10374 xxx=`$run ./fred`
b4eb6b3d
JH
10375 case $xxx in
10376 1) echo "Test program failed using dlopen." >&4
10377 echo "Perhaps you should not use dynamic loading." >&4;;
10378 2) echo "Test program failed using dlsym." >&4
10379 echo "Perhaps you should not use dynamic loading." >&4;;
10380 3) echo "dlsym needs a leading underscore" >&4
10381 val="$define" ;;
10382 4) echo "dlsym doesn't need a leading underscore." >&4;;
10383 esac
10384 else
10385 echo "I can't compile and run the test program." >&4
10386 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10387 fi
10388 ;;
10389esac
10390
3c728e00 10391$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
10392
10393set d_dlsymun
10394eval $setvar
10395
10bc17b6
JH
10396: see if drand48_r exists
10397set drand48_r d_drand48_r
10398eval $inlibc
10399case "$d_drand48_r" in
10400"$define")
10401 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
10402 case "$d_drand48_r_proto:$usethreads" in
10403 ":define") d_drand48_r_proto=define
a48ec845
JH
10404 set d_drand48_r_proto drand48_r $hdrs
10405 eval $hasproto ;;
10406 *) ;;
10407 esac
10408 case "$d_drand48_r_proto" in
10409 define)
10bc17b6
JH
10410 case "$drand48_r_proto" in
10411 ''|0) try='int drand48_r(struct drand48_data*, double*);'
10412 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10413 esac
10414 case "$drand48_r_proto" in
90e831dc 10415 ''|0) d_drand48_r=undef
10bc17b6 10416 drand48_r_proto=0
a48ec845 10417 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10418 * ) case "$drand48_r_proto" in
10419 REENTRANT_PROTO*) ;;
10420 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10421 esac
10422 echo "Prototype: $try" ;;
10423 esac
10424 ;;
c18e646a
JH
10425 *) case "$usethreads" in
10426 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10427 esac
90e831dc
SB
10428 d_drand48_r=undef
10429 drand48_r_proto=0
c18e646a 10430 ;;
a48ec845
JH
10431 esac
10432 ;;
10bc17b6
JH
10433*) drand48_r_proto=0
10434 ;;
10435esac
10436
10437: see if prototype for drand48 is available
10438echo " "
10439set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10440eval $hasproto
10441
b4eb6b3d
JH
10442: see if dup2 exists
10443set dup2 d_dup2
10444eval $inlibc
10445
10446: see if eaccess exists
10447set eaccess d_eaccess
10448eval $inlibc
10449
10450: see if endgrent exists
10451set endgrent d_endgrent
10452eval $inlibc
10453
10bc17b6
JH
10454: see if this is an grp system
10455set grp.h i_grp
10456eval $inhdr
10457
10458case "$i_grp" in
10459$define)
10460 xxx=`./findhdr grp.h`
10461 $cppstdin $cppflags $cppminus < $xxx >$$.h
10462
10463 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10464 val="$define"
10465 else
10466 val="$undef"
10467 fi
10468 set d_grpasswd
10469 eval $setvar
10470
10471 $rm -f $$.h
10472 ;;
10473*)
10474 val="$undef";
10475 set d_grpasswd; eval $setvar
10476 ;;
10477esac
10478
10479: see if endgrent_r exists
10480set endgrent_r d_endgrent_r
10481eval $inlibc
10482case "$d_endgrent_r" in
10483"$define")
10484 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
10485 case "$d_endgrent_r_proto:$usethreads" in
10486 ":define") d_endgrent_r_proto=define
a48ec845
JH
10487 set d_endgrent_r_proto endgrent_r $hdrs
10488 eval $hasproto ;;
10489 *) ;;
10490 esac
10491 case "$d_endgrent_r_proto" in
10492 define)
10bc17b6
JH
10493 case "$endgrent_r_proto" in
10494 ''|0) try='int endgrent_r(FILE**);'
10495 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10496 esac
10497 case "$endgrent_r_proto" in
10498 ''|0) try='void endgrent_r(FILE**);'
10499 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10500 esac
10501 case "$endgrent_r_proto" in
90e831dc 10502 ''|0) d_endgrent_r=undef
10bc17b6 10503 endgrent_r_proto=0
a48ec845 10504 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10505 * ) case "$endgrent_r_proto" in
10506 REENTRANT_PROTO*) ;;
10507 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10508 esac
10509 echo "Prototype: $try" ;;
10510 esac
10511 ;;
c18e646a
JH
10512 *) case "$usethreads" in
10513 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10514 esac
90e831dc
SB
10515 d_endgrent_r=undef
10516 endgrent_r_proto=0
c18e646a 10517 ;;
a48ec845
JH
10518 esac
10519 ;;
10bc17b6
JH
10520*) endgrent_r_proto=0
10521 ;;
10522esac
10523
b4eb6b3d
JH
10524: see if endhostent exists
10525set endhostent d_endhent
10526eval $inlibc
10527
10bc17b6
JH
10528: see if this is a netdb.h system
10529set netdb.h i_netdb
10530eval $inhdr
10531
10532: see if endhostent_r exists
10533set endhostent_r d_endhostent_r
10534eval $inlibc
10535case "$d_endhostent_r" in
10536"$define")
10537 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10538 case "$d_endhostent_r_proto:$usethreads" in
10539 ":define") d_endhostent_r_proto=define
a48ec845
JH
10540 set d_endhostent_r_proto endhostent_r $hdrs
10541 eval $hasproto ;;
10542 *) ;;
10543 esac
10544 case "$d_endhostent_r_proto" in
10545 define)
10bc17b6
JH
10546 case "$endhostent_r_proto" in
10547 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 10548 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
10549 esac
10550 case "$endhostent_r_proto" in
10551 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 10552 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
10553 esac
10554 case "$endhostent_r_proto" in
90e831dc 10555 ''|0) d_endhostent_r=undef
10bc17b6 10556 endhostent_r_proto=0
a48ec845 10557 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10558 * ) case "$endhostent_r_proto" in
10559 REENTRANT_PROTO*) ;;
10560 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10561 esac
10562 echo "Prototype: $try" ;;
10563 esac
10564 ;;
c18e646a
JH
10565 *) case "$usethreads" in
10566 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10567 esac
90e831dc
SB
10568 d_endhostent_r=undef
10569 endhostent_r_proto=0
c18e646a 10570 ;;
a48ec845
JH
10571 esac
10572 ;;
10bc17b6
JH
10573*) endhostent_r_proto=0
10574 ;;
10575esac
10576
b4eb6b3d
JH
10577: see if endnetent exists
10578set endnetent d_endnent
10579eval $inlibc
10580
10bc17b6
JH
10581: see if endnetent_r exists
10582set endnetent_r d_endnetent_r
10583eval $inlibc
10584case "$d_endnetent_r" in
10585"$define")
10586 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10587 case "$d_endnetent_r_proto:$usethreads" in
10588 ":define") d_endnetent_r_proto=define
a48ec845
JH
10589 set d_endnetent_r_proto endnetent_r $hdrs
10590 eval $hasproto ;;
10591 *) ;;
10592 esac
10593 case "$d_endnetent_r_proto" in
10594 define)
10bc17b6
JH
10595 case "$endnetent_r_proto" in
10596 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 10597 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
10598 esac
10599 case "$endnetent_r_proto" in
10600 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 10601 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
10602 esac
10603 case "$endnetent_r_proto" in
90e831dc 10604 ''|0) d_endnetent_r=undef
10bc17b6 10605 endnetent_r_proto=0
a48ec845 10606 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10607 * ) case "$endnetent_r_proto" in
10608 REENTRANT_PROTO*) ;;
10609 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10610 esac
10611 echo "Prototype: $try" ;;
10612 esac
10613 ;;
c18e646a
JH
10614 *) case "$usethreads" in
10615 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10616 esac
90e831dc
SB
10617 d_endnetent_r=undef
10618 endnetent_r_proto=0
c18e646a 10619 ;;
a48ec845
JH
10620 esac
10621 ;;
10bc17b6
JH
10622*) endnetent_r_proto=0
10623 ;;
10624esac
10625
b4eb6b3d
JH
10626: see if endprotoent exists
10627set endprotoent d_endpent
10628eval $inlibc
10629
10bc17b6
JH
10630: see if endprotoent_r exists
10631set endprotoent_r d_endprotoent_r
10632eval $inlibc
10633case "$d_endprotoent_r" in
10634"$define")
10635 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10636 case "$d_endprotoent_r_proto:$usethreads" in
10637 ":define") d_endprotoent_r_proto=define
a48ec845
JH
10638 set d_endprotoent_r_proto endprotoent_r $hdrs
10639 eval $hasproto ;;
10640 *) ;;
10641 esac
10642 case "$d_endprotoent_r_proto" in
10643 define)
10bc17b6
JH
10644 case "$endprotoent_r_proto" in
10645 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 10646 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
10647 esac
10648 case "$endprotoent_r_proto" in
10649 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 10650 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
10651 esac
10652 case "$endprotoent_r_proto" in
90e831dc 10653 ''|0) d_endprotoent_r=undef
10bc17b6 10654 endprotoent_r_proto=0
a48ec845 10655 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10656 * ) case "$endprotoent_r_proto" in
10657 REENTRANT_PROTO*) ;;
10658 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10659 esac
10660 echo "Prototype: $try" ;;
10661 esac
10662 ;;
c18e646a
JH
10663 *) case "$usethreads" in
10664 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10665 esac
90e831dc
SB
10666 d_endprotoent_r=undef
10667 endprotoent_r_proto=0
c18e646a 10668 ;;
a48ec845
JH
10669 esac
10670 ;;
10bc17b6
JH
10671*) endprotoent_r_proto=0
10672 ;;
10673esac
10674
b4eb6b3d
JH
10675: see if endpwent exists
10676set endpwent d_endpwent
10677eval $inlibc
10678
10bc17b6
JH
10679: see if this is a pwd.h system
10680set pwd.h i_pwd
10681eval $inhdr
10682
10683case "$i_pwd" in
10684$define)
10685 xxx=`./findhdr pwd.h`
10686 $cppstdin $cppflags $cppminus < $xxx >$$.h
10687
10688 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10689 val="$define"
10690 else
10691 val="$undef"
10692 fi
10693 set d_pwquota
10694 eval $setvar
10695
10696 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10697 val="$define"
10698 else
10699 val="$undef"
10700 fi
10701 set d_pwage
10702 eval $setvar
10703
10704 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10705 val="$define"
10706 else
10707 val="$undef"
10708 fi
10709 set d_pwchange
10710 eval $setvar
10711
10712 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10713 val="$define"
10714 else
10715 val="$undef"
10716 fi
10717 set d_pwclass
10718 eval $setvar
10719
10720 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10721 val="$define"
10722 else
10723 val="$undef"
10724 fi
10725 set d_pwexpire
10726 eval $setvar
10727
10728 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10729 val="$define"
10730 else
10731 val="$undef"
10732 fi
10733 set d_pwcomment
10734 eval $setvar
10735
10736 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10737 val="$define"
10738 else
10739 val="$undef"
10740 fi
10741 set d_pwgecos
10742 eval $setvar
10743
10744 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10745 val="$define"
10746 else
10747 val="$undef"
10748 fi
10749 set d_pwpasswd
10750 eval $setvar
10751
10752 $rm -f $$.h
10753 ;;
10754*)
10755 val="$undef";
10756 set d_pwquota; eval $setvar
10757 set d_pwage; eval $setvar
10758 set d_pwchange; eval $setvar
10759 set d_pwclass; eval $setvar
10760 set d_pwexpire; eval $setvar
10761 set d_pwcomment; eval $setvar
10762 set d_pwgecos; eval $setvar
10763 set d_pwpasswd; eval $setvar
10764 ;;
10765esac
10766
10767: see if endpwent_r exists
10768set endpwent_r d_endpwent_r
10769eval $inlibc
10770case "$d_endpwent_r" in
10771"$define")
10772 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
10773 case "$d_endpwent_r_proto:$usethreads" in
10774 ":define") d_endpwent_r_proto=define
a48ec845
JH
10775 set d_endpwent_r_proto endpwent_r $hdrs
10776 eval $hasproto ;;
10777 *) ;;
10778 esac
10779 case "$d_endpwent_r_proto" in
10780 define)
10bc17b6
JH
10781 case "$endpwent_r_proto" in
10782 ''|0) try='int endpwent_r(FILE**);'
10783 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10784 esac
10785 case "$endpwent_r_proto" in
10786 ''|0) try='void endpwent_r(FILE**);'
10787 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10788 esac
10789 case "$endpwent_r_proto" in
90e831dc 10790 ''|0) d_endpwent_r=undef
10bc17b6 10791 endpwent_r_proto=0
a48ec845 10792 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10793 * ) case "$endpwent_r_proto" in
10794 REENTRANT_PROTO*) ;;
10795 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10796 esac
10797 echo "Prototype: $try" ;;
10798 esac
10799 ;;
c18e646a
JH
10800 *) case "$usethreads" in
10801 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10802 esac
90e831dc
SB
10803 d_endpwent_r=undef
10804 endpwent_r_proto=0
c18e646a 10805 ;;
a48ec845
JH
10806 esac
10807 ;;
10bc17b6
JH
10808*) endpwent_r_proto=0
10809 ;;
10810esac
10811
b4eb6b3d
JH
10812: see if endservent exists
10813set endservent d_endsent
10814eval $inlibc
10815
10bc17b6
JH
10816: see if endservent_r exists
10817set endservent_r d_endservent_r
10818eval $inlibc
10819case "$d_endservent_r" in
10820"$define")
10821 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10822 case "$d_endservent_r_proto:$usethreads" in
10823 ":define") d_endservent_r_proto=define
a48ec845
JH
10824 set d_endservent_r_proto endservent_r $hdrs
10825 eval $hasproto ;;
10826 *) ;;
10827 esac
10828 case "$d_endservent_r_proto" in
10829 define)
10bc17b6
JH
10830 case "$endservent_r_proto" in
10831 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 10832 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
10833 esac
10834 case "$endservent_r_proto" in
10835 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 10836 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
10837 esac
10838 case "$endservent_r_proto" in
90e831dc 10839 ''|0) d_endservent_r=undef
10bc17b6 10840 endservent_r_proto=0
a48ec845 10841 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10842 * ) case "$endservent_r_proto" in
10843 REENTRANT_PROTO*) ;;
10844 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10845 esac
10846 echo "Prototype: $try" ;;
10847 esac
10848 ;;
c18e646a
JH
10849 *) case "$usethreads" in
10850 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10851 esac
90e831dc
SB
10852 d_endservent_r=undef
10853 endservent_r_proto=0
c18e646a 10854 ;;
a48ec845
JH
10855 esac
10856 ;;
10bc17b6
JH
10857*) endservent_r_proto=0
10858 ;;
10859esac
10860
b4eb6b3d
JH
10861: Locate the flags for 'open()'
10862echo " "
5440bc8e 10863$cat >try.c <<'EOCP'
b4eb6b3d
JH
10864#include <sys/types.h>
10865#ifdef I_FCNTL
10866#include <fcntl.h>
10867#endif
10868#ifdef I_SYS_FILE
10869#include <sys/file.h>
10870#endif
10871int main() {
10872 if(O_RDONLY);
10873#ifdef O_TRUNC
10874 exit(0);
10875#else
10876 exit(1);
10877#endif
10878}
10879EOCP
10880: check sys/file.h first to get FREAD on Sun
10881if $test `./findhdr sys/file.h` && \
5440bc8e 10882 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
10883 h_sysfile=true;
10884 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 10885 if $run ./try; then
b4eb6b3d
JH
10886 echo "and you have the 3 argument form of open()." >&4
10887 val="$define"
10888 else
10889 echo "but not the 3 argument form of open(). Oh, well." >&4
10890 val="$undef"
10891 fi
10892elif $test `./findhdr fcntl.h` && \
5440bc8e 10893 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
10894 h_fcntl=true;
10895 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 10896 if $run ./try; then
b4eb6b3d
JH
10897 echo "and you have the 3 argument form of open()." >&4
10898 val="$define"
10899 else
10900 echo "but not the 3 argument form of open(). Oh, well." >&4
10901 val="$undef"
10902 fi
10903else
10904 val="$undef"
10905 echo "I can't find the O_* constant definitions! You got problems." >&4
10906fi
10907set d_open3
10908eval $setvar
5440bc8e 10909$rm -f try try.*
b4eb6b3d
JH
10910
10911: see which of string.h or strings.h is needed
10912echo " "
10913strings=`./findhdr string.h`
10914if $test "$strings" && $test -r "$strings"; then
10915 echo "Using <string.h> instead of <strings.h>." >&4
10916 val="$define"
10917else
10918 val="$undef"
10919 strings=`./findhdr strings.h`
10920 if $test "$strings" && $test -r "$strings"; then
10921 echo "Using <strings.h> instead of <string.h>." >&4
10922 else
10923 echo "No string header found -- You'll surely have problems." >&4
10924 fi
10925fi
10926set i_string
10927eval $setvar
10928case "$i_string" in
10929"$undef") strings=`./findhdr strings.h`;;
10930*) strings=`./findhdr string.h`;;
10931esac
10932
3c728e00
JH
10933: see if this is a sys/file.h system
10934val=''
10935set sys/file.h val
10936eval $inhdr
10937
10938: do we need to include sys/file.h ?
10939case "$val" in
10940"$define")
10941 echo " "
10942 if $h_sysfile; then
10943 val="$define"
10944 echo "We'll be including <sys/file.h>." >&4
10945 else
10946 val="$undef"
10947 echo "We won't be including <sys/file.h>." >&4
10948 fi
10949 ;;
10950*)
10951 h_sysfile=false
10952 ;;
10953esac
10954set i_sysfile
10955eval $setvar
10956
10957: see if fcntl.h is there
10958val=''
10959set fcntl.h val
10960eval $inhdr
10961
10962: see if we can include fcntl.h
10963case "$val" in
10964"$define")
10965 echo " "
10966 if $h_fcntl; then
10967 val="$define"
10968 echo "We'll be including <fcntl.h>." >&4
10969 else
10970 val="$undef"
10971 if $h_sysfile; then
10972 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10973 else
10974 echo "We won't be including <fcntl.h>." >&4
10975 fi
10976 fi
10977 ;;
10978*)
10979 h_fcntl=false
10980 val="$undef"
10981 ;;
10982esac
10983set i_fcntl
10984eval $setvar
10985
b4eb6b3d
JH
10986: check for non-blocking I/O stuff
10987case "$h_sysfile" in
a0acbdc3
JH
10988true) echo "#include <sys/file.h>" > head.c;;
10989*)
10990 case "$h_fcntl" in
10991 true) echo "#include <fcntl.h>" > head.c;;
10992 *) echo "#include <sys/fcntl.h>" > head.c;;
10993 esac
10994 ;;
b4eb6b3d
JH
10995esac
10996echo " "
10997echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
10998case "$o_nonblock" in
10999'')
11000 $cat head.c > try.c
3c728e00 11001 $cat >>try.c <<EOCP
b4eb6b3d 11002#include <stdio.h>
80b3ef99 11003#include <stdlib.h>
3c728e00
JH
11004#$i_fcntl I_FCNTL
11005#ifdef I_FCNTL
11006#include <fcntl.h>
11007#endif
b4eb6b3d
JH
11008int main() {
11009#ifdef O_NONBLOCK
11010 printf("O_NONBLOCK\n");
11011 exit(0);
11012#endif
11013#ifdef O_NDELAY
11014 printf("O_NDELAY\n");
11015 exit(0);
11016#endif
11017#ifdef FNDELAY
11018 printf("FNDELAY\n");
11019 exit(0);
11020#endif
11021 exit(0);
11022}
11023EOCP
11024 set try
11025 if eval $compile_ok; then
5440bc8e 11026 o_nonblock=`$run ./try`
b4eb6b3d
JH
11027 case "$o_nonblock" in
11028 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11029 *) echo "Seems like we can use $o_nonblock.";;
11030 esac
11031 else
11032 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11033 fi
11034 ;;
11035*) echo "Using $hint value $o_nonblock.";;
11036esac
11037$rm -f try try.* .out core
11038
11039echo " "
11040echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11041case "$eagain" in
11042'')
11043 $cat head.c > try.c
11044 $cat >>try.c <<EOCP
11045#include <errno.h>
11046#include <sys/types.h>
11047#include <signal.h>
11048#include <stdio.h>
80b3ef99 11049#include <stdlib.h>
1deb0a86
JH
11050#$i_fcntl I_FCNTL
11051#ifdef I_FCNTL
11052#include <fcntl.h>
11053#endif
b4eb6b3d
JH
11054#define MY_O_NONBLOCK $o_nonblock
11055#ifndef errno /* XXX need better Configure test */
11056extern int errno;
11057#endif
11058#$i_unistd I_UNISTD
11059#ifdef I_UNISTD
11060#include <unistd.h>
11061#endif
11062#$i_string I_STRING
11063#ifdef I_STRING
11064#include <string.h>
11065#else
11066#include <strings.h>
11067#endif
11068$signal_t blech(x) int x; { exit(3); }
11069EOCP
11070 $cat >> try.c <<'EOCP'
11071int main()
11072{
11073 int pd[2];
11074 int pu[2];
11075 char buf[1];
11076 char string[100];
11077
11078 pipe(pd); /* Down: child -> parent */
11079 pipe(pu); /* Up: parent -> child */
11080 if (0 != fork()) {
11081 int ret;
11082 close(pd[1]); /* Parent reads from pd[0] */
11083 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11084#ifdef F_SETFL
b4eb6b3d
JH
11085 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11086 exit(1);
a0acbdc3
JH
11087#else
11088 exit(4);
11089#endif
b4eb6b3d
JH
11090 signal(SIGALRM, blech);
11091 alarm(5);
11092 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11093 exit(2);
11094 sprintf(string, "%d\n", ret);
11095 write(2, string, strlen(string));
11096 alarm(0);
11097#ifdef EAGAIN
11098 if (errno == EAGAIN) {
11099 printf("EAGAIN\n");
11100 goto ok;
11101 }
11102#endif
11103#ifdef EWOULDBLOCK
11104 if (errno == EWOULDBLOCK)
11105 printf("EWOULDBLOCK\n");
11106#endif
11107 ok:
11108 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11109 sleep(2); /* Give it time to close our pipe */
11110 alarm(5);
11111 ret = read(pd[0], buf, 1); /* Should read EOF */
11112 alarm(0);
11113 sprintf(string, "%d\n", ret);
868439a2 11114 write(4, string, strlen(string));
b4eb6b3d
JH
11115 exit(0);
11116 }
11117
11118 close(pd[0]); /* We write to pd[1] */
11119 close(pu[1]); /* We read from pu[0] */
11120 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11121 close(pd[1]); /* Pipe pd is now fully closed! */
11122 exit(0); /* Bye bye, thank you for playing! */
11123}
11124EOCP
11125 set try
11126 if eval $compile_ok; then
11127 echo "$startsh" >mtry
868439a2 11128 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11129 chmod +x mtry
11130 ./mtry >/dev/null 2>&1
11131 case $? in
11132 0) eagain=`$cat try.out`;;
11133 1) echo "Could not perform non-blocking setting!";;
11134 2) echo "I did a successful read() for something that was not there!";;
11135 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11136 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11137 *) echo "Something terribly wrong happened during testing.";;
11138 esac
11139 rd_nodata=`$cat try.ret`
11140 echo "A read() system call with no data present returns $rd_nodata."
11141 case "$rd_nodata" in
11142 0|-1) ;;
11143 *)
11144 echo "(That's peculiar, fixing that to be -1.)"
11145 rd_nodata=-1
11146 ;;
11147 esac
11148 case "$eagain" in
11149 '')
11150 echo "Forcing errno EAGAIN on read() with no data available."
11151 eagain=EAGAIN
11152 ;;
11153 *)
11154 echo "Your read() sets errno to $eagain when no data is available."
11155 ;;
11156 esac
11157 status=`$cat try.err`
11158 case "$status" in
11159 0) echo "And it correctly returns 0 to signal EOF.";;
11160 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11161 *) echo "However, your read() returns '$status' on EOF??";;
11162 esac
11163 val="$define"
11164 if test "$status" = "$rd_nodata"; then
11165 echo "WARNING: you can't distinguish between EOF and no data!"
11166 val="$undef"
11167 fi
11168 else
11169 echo "I can't compile the test program--assuming errno EAGAIN will do."
11170 eagain=EAGAIN
11171 fi
11172 set d_eofnblk
11173 eval $setvar
11174 ;;
11175*)
11176 echo "Using $hint value $eagain."
11177 echo "Your read() returns $rd_nodata when no data is present."
11178 case "$d_eofnblk" in
11179 "$define") echo "And you can see EOF because read() returns 0.";;
11180 "$undef") echo "But you can't see EOF status from read() returned value.";;
11181 *)
11182 echo "(Assuming you can't see EOF status from read anyway.)"
11183 d_eofnblk=$undef
11184 ;;
11185 esac
11186 ;;
11187esac
11188$rm -f try try.* .out core head.c mtry
11189
b363b713
JH
11190: see if fchdir exists
11191set fchdir d_fchdir
11192eval $inlibc
11193
b4eb6b3d
JH
11194: see if fchmod exists
11195set fchmod d_fchmod
11196eval $inlibc
11197
11198: see if fchown exists
11199set fchown d_fchown
11200eval $inlibc
11201
11202: see if this is an fcntl system
11203set fcntl d_fcntl
11204eval $inlibc
11205
9d9004a9
AD
11206echo " "
11207: See if fcntl-based locking works.
832492ee 11208$cat >try.c <<EOCP
9d9004a9
AD
11209#include <stdlib.h>
11210#include <unistd.h>
11211#include <fcntl.h>
832492ee 11212#include <signal.h>
832492ee 11213$signal_t blech(x) int x; { exit(3); }
9d9004a9
AD
11214int main() {
11215#if defined(F_SETLK) && defined(F_SETLKW)
11216 struct flock flock;
11217 int retval, fd;
11218 fd = open("try.c", O_RDONLY);
11219 flock.l_type = F_RDLCK;
11220 flock.l_whence = SEEK_SET;
11221 flock.l_start = flock.l_len = 0;
832492ee
JH
11222 signal(SIGALRM, blech);
11223 alarm(10);
9d9004a9
AD
11224 retval = fcntl(fd, F_SETLK, &flock);
11225 close(fd);
11226 (retval < 0 ? exit(2) : exit(0));
11227#else
11228 exit(2);
11229#endif
11230}
11231EOCP
11232echo "Checking if fcntl-based file locking works... "
11233case "$d_fcntl" in
11234"$define")
11235 set try
11236 if eval $compile_ok; then
5440bc8e 11237 if $run ./try; then
9d9004a9
AD
11238 echo "Yes, it seems to work."
11239 val="$define"
11240 else
11241 echo "Nope, it didn't work."
11242 val="$undef"
832492ee
JH
11243 case "$?" in
11244 3) $cat >&4 <<EOM
11245***
11246*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11247*** This is (almost) impossible.
11248*** If your NFS lock daemons are not feeling well, something like
11249*** this may happen, please investigate. Cannot continue, aborting.
11250***
11251EOM
11252 exit 1
11253 ;;
11254 esac
9d9004a9
AD
11255 fi
11256 else
11257 echo "I'm unable to compile the test program, so I'll assume not."
11258 val="$undef"
11259 fi
11260 ;;
11261*) val="$undef";
11262 echo "Nope, since you don't even have fcntl()."
11263 ;;
11264esac
11265set d_fcntl_can_lock
11266eval $setvar
11267$rm -f try*
11268
11269
b4eb6b3d
JH
11270: check for fd_set items
11271$cat <<EOM
11272
11273Checking to see how well your C compiler handles fd_set and friends ...
11274EOM
5440bc8e 11275$cat >try.c <<EOCP
b4eb6b3d
JH
11276#$i_systime I_SYS_TIME
11277#$i_sysselct I_SYS_SELECT
11278#$d_socket HAS_SOCKET
11279#include <sys/types.h>
11280#ifdef HAS_SOCKET
11281#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11282#endif
11283#ifdef I_SYS_TIME
11284#include <sys/time.h>
11285#endif
11286#ifdef I_SYS_SELECT
11287#include <sys/select.h>
11288#endif
11289int main() {
11290 fd_set fds;
11291
11292#ifdef TRYBITS
11293 if(fds.fds_bits);
11294#endif
11295
11296#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11297 exit(0);
11298#else
11299 exit(1);
11300#endif
11301}
11302EOCP
5440bc8e 11303set try -DTRYBITS
b4eb6b3d
JH
11304if eval $compile; then
11305 d_fds_bits="$define"
11306 d_fd_set="$define"
11307 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 11308 if $run ./try; then
b4eb6b3d
JH
11309 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11310 d_fd_macros="$define"
11311 else
11312 $cat >&4 <<'EOM'
11313but not the normal fd_set macros! Gaaack! I'll have to cover for you.
11314EOM
11315 d_fd_macros="$undef"
11316 fi
11317else
11318 $cat <<'EOM'
11319Hmm, your compiler has some difficulty with fd_set. Checking further...
11320EOM
5440bc8e 11321 set try
b4eb6b3d
JH
11322 if eval $compile; then
11323 d_fds_bits="$undef"
11324 d_fd_set="$define"
11325 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 11326 if $run ./try; then
b4eb6b3d
JH
11327 echo "and you have the normal fd_set macros." >&4
11328 d_fd_macros="$define"
11329 else
11330 $cat <<'EOM'
11331but not the normal fd_set macros! Gross! More work for me...
11332EOM
11333 d_fd_macros="$undef"
11334 fi
11335 else
11336 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
11337 d_fd_set="$undef"
11338 d_fds_bits="$undef"
11339 d_fd_macros="$undef"
11340 fi
11341fi
5440bc8e 11342$rm -f try try.*
b4eb6b3d
JH
11343
11344: see if fgetpos exists
11345set fgetpos d_fgetpos
11346eval $inlibc
11347
758a5d79
JH
11348: see if finite exists
11349set finite d_finite
11350eval $inlibc
11351
11352: see if finitel exists
11353set finitel d_finitel
11354eval $inlibc
11355
b4eb6b3d
JH
11356: see if flock exists
11357set flock d_flock
11358eval $inlibc
11359
2ef53570
JH
11360: see if prototype for flock is available
11361echo " "
11362set d_flockproto flock $i_sysfile sys/file.h
11363eval $hasproto
11364
b4eb6b3d
JH
11365: see if fork exists
11366set fork d_fork
11367eval $inlibc
11368
758a5d79
JH
11369: see if fp_class exists
11370set fp_class d_fp_class
11371eval $inlibc
11372
b4eb6b3d
JH
11373: see if pathconf exists
11374set pathconf d_pathconf
11375eval $inlibc
11376
11377: see if fpathconf exists
11378set fpathconf d_fpathconf
11379eval $inlibc
11380
758a5d79
JH
11381: see if fpclass exists
11382set fpclass d_fpclass
11383eval $inlibc
11384
11385: see if fpclassify exists
11386set fpclassify d_fpclassify
11387eval $inlibc
11388
11389: see if fpclassl exists
11390set fpclassl d_fpclassl
11391eval $inlibc
11392
b4eb6b3d
JH
11393
11394: check for fpos64_t
11395echo " "
11396echo "Checking to see if you have fpos64_t..." >&4
11397$cat >try.c <<EOCP
11398#include <stdio.h>
11399int main() { fpos64_t x = 7; }
11400EOCP
11401set try
11402if eval $compile; then
11403 val="$define"
11404 echo "You have fpos64_t."
11405else
11406 val="$undef"
11407 echo "You do not have fpos64_t."
11408 case "$fpossize" in
11409 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11410 esac
11411fi
11412$rm -f try.* try
11413set d_fpos64_t
11414eval $setvar
11415
11416: see if frexpl exists
11417set frexpl d_frexpl
11418eval $inlibc
11419
b4eb6b3d
JH
11420: see if this is a sys/param system
11421set sys/param.h i_sysparam
11422eval $inhdr
11423
11424: see if this is a sys/mount.h system
11425set sys/mount.h i_sysmount
11426eval $inhdr
11427
b4eb6b3d
JH
11428
11429echo " "
11430echo "Checking to see if your system supports struct fs_data..." >&4
11431set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11432eval $hasstruct
11433case "$d_fs_data_s" in
11434"$define") echo "Yes, it does." ;;
11435*) echo "No, it doesn't." ;;
11436esac
11437
11438: see if fseeko exists
11439set fseeko d_fseeko
11440eval $inlibc
11441case "$longsize" in
114428) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11443esac
11444
11445: see if fsetpos exists
11446set fsetpos d_fsetpos
11447eval $inlibc
11448
11449
11450: see if fstatfs exists
11451set fstatfs d_fstatfs
11452eval $inlibc
11453
11454
11455: see if statvfs exists
11456set statvfs d_statvfs
11457eval $inlibc
11458
11459: see if fstatvfs exists
11460set fstatvfs d_fstatvfs
11461eval $inlibc
11462
11463
411ab01c
JH
11464: see if fsync exists
11465set fsync d_fsync
11466eval $inlibc
11467
b4eb6b3d
JH
11468: see if ftello exists
11469set ftello d_ftello
11470eval $inlibc
11471case "$longsize" in
114728) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11473esac
11474
11475: see if getcwd exists
11476set getcwd d_getcwd
11477eval $inlibc
11478
11479: see if getespwnam exists
11480set getespwnam d_getespwnam
11481eval $inlibc
11482
11483
11484: see if getfsstat exists
11485set getfsstat d_getfsstat
11486eval $inlibc
11487
11488: see if getgrent exists
11489set getgrent d_getgrent
11490eval $inlibc
11491
10bc17b6
JH
11492: see if getgrent_r exists
11493set getgrent_r d_getgrent_r
11494eval $inlibc
11495case "$d_getgrent_r" in
11496"$define")
11497 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11498 case "$d_getgrent_r_proto:$usethreads" in
11499 ":define") d_getgrent_r_proto=define
a48ec845
JH
11500 set d_getgrent_r_proto getgrent_r $hdrs
11501 eval $hasproto ;;
11502 *) ;;
11503 esac
11504 case "$d_getgrent_r_proto" in
11505 define)
10bc17b6
JH
11506 case "$getgrent_r_proto" in
11507 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11508 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11509 esac
11510 case "$getgrent_r_proto" in
11511 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11512 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11513 esac
11514 case "$getgrent_r_proto" in
11515 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11516 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11517 esac
11518 case "$getgrent_r_proto" in
11519 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11520 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11521 esac
11522 case "$getgrent_r_proto" in
11523 ''|0) try='int getgrent_r(struct group*, char*, int);'
11524 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11525 esac
11526 case "$getgrent_r_proto" in
11527 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11528 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11529 esac
11530 case "$getgrent_r_proto" in
90e831dc 11531 ''|0) d_getgrent_r=undef
10bc17b6 11532 getgrent_r_proto=0
a48ec845 11533 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11534 * ) case "$getgrent_r_proto" in
11535 REENTRANT_PROTO*) ;;
11536 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11537 esac
11538 echo "Prototype: $try" ;;
11539 esac
11540 ;;
c18e646a
JH
11541 *) case "$usethreads" in
11542 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11543 esac
90e831dc
SB
11544 d_getgrent_r=undef
11545 getgrent_r_proto=0
c18e646a 11546 ;;
a48ec845
JH
11547 esac
11548 ;;
10bc17b6
JH
11549*) getgrent_r_proto=0
11550 ;;
11551esac
11552
11553: see if getgrgid_r exists
11554set getgrgid_r d_getgrgid_r
11555eval $inlibc
11556case "$d_getgrgid_r" in
11557"$define")
11558 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11559 case "$d_getgrgid_r_proto:$usethreads" in
11560 ":define") d_getgrgid_r_proto=define
a48ec845
JH
11561 set d_getgrgid_r_proto getgrgid_r $hdrs
11562 eval $hasproto ;;
11563 *) ;;
11564 esac
11565 case "$d_getgrgid_r_proto" in
11566 define)
10bc17b6
JH
11567 case "$getgrgid_r_proto" in
11568 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11569 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11570 esac
11571 case "$getgrgid_r_proto" in
11572 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11573 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11574 esac
11575 case "$getgrgid_r_proto" in
11576 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11577 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11578 esac
11579 case "$getgrgid_r_proto" in
11580 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11581 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11582 esac
11583 case "$getgrgid_r_proto" in
90e831dc 11584 ''|0) d_getgrgid_r=undef
10bc17b6 11585 getgrgid_r_proto=0
a48ec845 11586 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11587 * ) case "$getgrgid_r_proto" in
11588 REENTRANT_PROTO*) ;;
11589 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11590 esac
11591 echo "Prototype: $try" ;;
11592 esac
11593 ;;
c18e646a
JH
11594 *) case "$usethreads" in
11595 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11596 esac
90e831dc
SB
11597 d_getgrgid_r=undef
11598 getgrgid_r_proto=0
c18e646a 11599 ;;
a48ec845
JH
11600 esac
11601 ;;
10bc17b6
JH
11602*) getgrgid_r_proto=0
11603 ;;
11604esac
11605
11606: see if getgrnam_r exists
11607set getgrnam_r d_getgrnam_r
11608eval $inlibc
11609case "$d_getgrnam_r" in
11610"$define")
11611 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11612 case "$d_getgrnam_r_proto:$usethreads" in
11613 ":define") d_getgrnam_r_proto=define
a48ec845
JH
11614 set d_getgrnam_r_proto getgrnam_r $hdrs
11615 eval $hasproto ;;
11616 *) ;;
11617 esac
11618 case "$d_getgrnam_r_proto" in
11619 define)
10bc17b6
JH
11620 case "$getgrnam_r_proto" in
11621 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11622 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11623 esac
11624 case "$getgrnam_r_proto" in
11625 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11626 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11627 esac
11628 case "$getgrnam_r_proto" in
11629 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11630 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11631 esac
11632 case "$getgrnam_r_proto" in
11633 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11634 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11635 esac
11636 case "$getgrnam_r_proto" in
11637 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11638 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11639 esac
11640 case "$getgrnam_r_proto" in
90e831dc 11641 ''|0) d_getgrnam_r=undef
10bc17b6 11642 getgrnam_r_proto=0
a48ec845 11643 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11644 * ) case "$getgrnam_r_proto" in
11645 REENTRANT_PROTO*) ;;
11646 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11647 esac
11648 echo "Prototype: $try" ;;
11649 esac
11650 ;;
c18e646a
JH
11651 *) case "$usethreads" in
11652 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11653 esac
90e831dc
SB
11654 d_getgrnam_r=undef
11655 getgrnam_r_proto=0
c18e646a 11656 ;;
a48ec845
JH
11657 esac
11658 ;;
10bc17b6
JH
11659*) getgrnam_r_proto=0
11660 ;;
11661esac
11662
b4eb6b3d
JH
11663: see if gethostbyaddr exists
11664set gethostbyaddr d_gethbyaddr
11665eval $inlibc
11666
11667: see if gethostbyname exists
11668set gethostbyname d_gethbyname
11669eval $inlibc
11670
11671: see if gethostent exists
11672set gethostent d_gethent
11673eval $inlibc
11674
11675: see how we will look up host name
11676echo " "
11677call=''
11678if set gethostname val -f d_gethname; eval $csym; $val; then
11679 echo 'gethostname() found.' >&4
11680 d_gethname="$define"
11681 call=gethostname
11682fi
11683if set uname val -f d_uname; eval $csym; $val; then
11684 if ./xenix; then
11685 $cat <<'EOM'
11686uname() was found, but you're running xenix, and older versions of xenix
11687have a broken uname(). If you don't really know whether your xenix is old
11688enough to have a broken system call, use the default answer.
11689
11690EOM
11691 dflt=y
11692 case "$d_uname" in
11693 "$define") dflt=n;;
11694 esac
11695 rp='Is your uname() broken?'
11696 . ./myread
11697 case "$ans" in
11698 n*) d_uname="$define"; call=uname;;
11699 esac
11700 else
11701 echo 'uname() found.' >&4
11702 d_uname="$define"
11703 case "$call" in
11704 '') call=uname ;;
11705 esac
11706 fi
11707fi
11708case "$d_gethname" in
11709'') d_gethname="$undef";;
11710esac
11711case "$d_uname" in
11712'') d_uname="$undef";;
11713esac
11714case "$d_uname$d_gethname" in
11715*define*)
11716 dflt=n
11717 cat <<EOM
11718
11719Every now and then someone has a $call() that lies about the hostname
11720but can't be fixed for political or economic reasons. If you wish, I can
11721pretend $call() isn't there and maybe compute hostname at run-time
11722thanks to the '$phostname' command.
11723
11724EOM
11725 rp="Shall I ignore $call() from now on?"
11726 . ./myread
11727 case "$ans" in
11728 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11729 esac;;
11730esac
11731case "$phostname" in
11732'') aphostname='';;
11733*) case "$aphostname" in
11734 /*) ;;
11735 *) set X $phostname
11736 shift
11737 file=$1
11738 shift
11739 file=`./loc $file $file $pth`
11740 aphostname=`echo $file $*`
11741 ;;
11742 esac
11743 ;;
11744esac
11745case "$d_uname$d_gethname" in
11746*define*) ;;
11747*)
11748 case "$phostname" in
11749 '')
11750 echo "There will be no way for $package to get your hostname." >&4;;
11751 *)
11752 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11753 ;;
11754 esac;;
11755esac
11756case "$d_phostname" in
11757'') d_phostname="$undef";;
11758esac
11759
10bc17b6
JH
11760: see if gethostbyaddr_r exists
11761set gethostbyaddr_r d_gethostbyaddr_r
11762eval $inlibc
11763case "$d_gethostbyaddr_r" in
11764"$define")
11765 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11766 case "$d_gethostbyaddr_r_proto:$usethreads" in
11767 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
11768 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11769 eval $hasproto ;;
11770 *) ;;
11771 esac
11772 case "$d_gethostbyaddr_r_proto" in
11773 define)
10bc17b6
JH
11774 case "$gethostbyaddr_r_proto" in
11775 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11776 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11777 esac
11778 case "$gethostbyaddr_r_proto" in
11779 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11780 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11781 esac
11782 case "$gethostbyaddr_r_proto" in
11783 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11784 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11785 esac
11786 case "$gethostbyaddr_r_proto" in
11787 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11788 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11789 esac
11790 case "$gethostbyaddr_r_proto" in
11791 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11792 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11793 esac
11794 case "$gethostbyaddr_r_proto" in
11795 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11796 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11797 esac
11798 case "$gethostbyaddr_r_proto" in
11799 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11800 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11801 esac
11802 case "$gethostbyaddr_r_proto" in
11803 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11804 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11805 esac
11806 case "$gethostbyaddr_r_proto" in
11807 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11808 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11809 esac
11810 case "$gethostbyaddr_r_proto" in
11811 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11812 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11813 esac
11814 case "$gethostbyaddr_r_proto" in
90e831dc 11815 ''|0) d_gethostbyaddr_r=undef
10bc17b6 11816 gethostbyaddr_r_proto=0
a48ec845 11817 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11818 * ) case "$gethostbyaddr_r_proto" in
11819 REENTRANT_PROTO*) ;;
11820 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11821 esac
11822 echo "Prototype: $try" ;;
11823 esac
11824 ;;
c18e646a
JH
11825 *) case "$usethreads" in
11826 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11827 esac
90e831dc
SB
11828 d_gethostbyaddr_r=undef
11829 gethostbyaddr_r_proto=0
c18e646a 11830 ;;
a48ec845
JH
11831 esac
11832 ;;
10bc17b6
JH
11833*) gethostbyaddr_r_proto=0
11834 ;;
11835esac
11836
11837: see if gethostbyname_r exists
11838set gethostbyname_r d_gethostbyname_r
11839eval $inlibc
11840case "$d_gethostbyname_r" in
11841"$define")
11842 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11843 case "$d_gethostbyname_r_proto:$usethreads" in
11844 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
11845 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11846 eval $hasproto ;;
11847 *) ;;
11848 esac
11849 case "$d_gethostbyname_r_proto" in
11850 define)
10bc17b6
JH
11851 case "$gethostbyname_r_proto" in
11852 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11853 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11854 esac
11855 case "$gethostbyname_r_proto" in
11856 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11857 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11858 esac
11859 case "$gethostbyname_r_proto" in
11860 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11861 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11862 esac
11863 case "$gethostbyname_r_proto" in
90e831dc 11864 ''|0) d_gethostbyname_r=undef
10bc17b6 11865 gethostbyname_r_proto=0
a48ec845 11866 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11867 * ) case "$gethostbyname_r_proto" in
11868 REENTRANT_PROTO*) ;;
11869 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11870 esac
11871 echo "Prototype: $try" ;;
11872 esac
11873 ;;
c18e646a
JH
11874 *) case "$usethreads" in
11875 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11876 esac
90e831dc
SB
11877 d_gethostbyname_r=undef
11878 gethostbyname_r_proto=0
c18e646a 11879 ;;
a48ec845
JH
11880 esac
11881 ;;
10bc17b6
JH
11882*) gethostbyname_r_proto=0
11883 ;;
11884esac
11885
11886: see if gethostent_r exists
11887set gethostent_r d_gethostent_r
11888eval $inlibc
11889case "$d_gethostent_r" in
11890"$define")
11891 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11892 case "$d_gethostent_r_proto:$usethreads" in
11893 ":define") d_gethostent_r_proto=define
a48ec845
JH
11894 set d_gethostent_r_proto gethostent_r $hdrs
11895 eval $hasproto ;;
11896 *) ;;
11897 esac
11898 case "$d_gethostent_r_proto" in
11899 define)
10bc17b6
JH
11900 case "$gethostent_r_proto" in
11901 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11902 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11903 esac
11904 case "$gethostent_r_proto" in
11905 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11906 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11907 esac
11908 case "$gethostent_r_proto" in
11909 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11910 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11911 esac
11912 case "$gethostent_r_proto" in
11913 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11914 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11915 esac
11916 case "$gethostent_r_proto" in
11917 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11918 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11919 esac
11920 case "$gethostent_r_proto" in
11921 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11922 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11923 esac
11924 case "$gethostent_r_proto" in
90e831dc 11925 ''|0) d_gethostent_r=undef
10bc17b6 11926 gethostent_r_proto=0
a48ec845 11927 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11928 * ) case "$gethostent_r_proto" in
11929 REENTRANT_PROTO*) ;;
11930 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11931 esac
11932 echo "Prototype: $try" ;;
11933 esac
11934 ;;
c18e646a
JH
11935 *) case "$usethreads" in
11936 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11937 esac
90e831dc
SB
11938 d_gethostent_r=undef
11939 gethostent_r_proto=0
c18e646a 11940 ;;
a48ec845
JH
11941 esac
11942 ;;
10bc17b6
JH
11943*) gethostent_r_proto=0
11944 ;;
11945esac
b4eb6b3d
JH
11946
11947: see if prototypes for various gethostxxx netdb.h functions are available
11948echo " "
11949set d_gethostprotos gethostent $i_netdb netdb.h
11950eval $hasproto
11951
4e0554ec
JH
11952: see if getitimer exists
11953set getitimer d_getitimer
11954eval $inlibc
11955
b4eb6b3d
JH
11956: see if getlogin exists
11957set getlogin d_getlogin
11958eval $inlibc
11959
10bc17b6
JH
11960: see if getlogin_r exists
11961set getlogin_r d_getlogin_r
11962eval $inlibc
11963case "$d_getlogin_r" in
11964"$define")
11965 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
11966 case "$d_getlogin_r_proto:$usethreads" in
11967 ":define") d_getlogin_r_proto=define
a48ec845
JH
11968 set d_getlogin_r_proto getlogin_r $hdrs
11969 eval $hasproto ;;
11970 *) ;;
11971 esac
11972 case "$d_getlogin_r_proto" in
11973 define)
10bc17b6
JH
11974 case "$getlogin_r_proto" in
11975 ''|0) try='int getlogin_r(char*, size_t);'
11976 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11977 esac
11978 case "$getlogin_r_proto" in
11979 ''|0) try='int getlogin_r(char*, int);'
11980 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11981 esac
11982 case "$getlogin_r_proto" in
11983 ''|0) try='char* getlogin_r(char*, size_t);'
11984 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11985 esac
11986 case "$getlogin_r_proto" in
11987 ''|0) try='char* getlogin_r(char*, int);'
11988 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11989 esac
11990 case "$getlogin_r_proto" in
90e831dc 11991 ''|0) d_getlogin_r=undef
10bc17b6 11992 getlogin_r_proto=0
a48ec845 11993 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11994 * ) case "$getlogin_r_proto" in
11995 REENTRANT_PROTO*) ;;
11996 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
11997 esac
11998 echo "Prototype: $try" ;;
11999 esac
12000 ;;
c18e646a
JH
12001 *) case "$usethreads" in
12002 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12003 esac
90e831dc
SB
12004 d_getlogin_r=undef
12005 getlogin_r_proto=0
c18e646a 12006 ;;
a48ec845
JH
12007 esac
12008 ;;
10bc17b6
JH
12009*) getlogin_r_proto=0
12010 ;;
12011esac
12012
b4eb6b3d
JH
12013: see if getmnt exists
12014set getmnt d_getmnt
12015eval $inlibc
12016
12017: see if getmntent exists
12018set getmntent d_getmntent
12019eval $inlibc
12020
12021: see if getnetbyaddr exists
12022set getnetbyaddr d_getnbyaddr
12023eval $inlibc
12024
12025: see if getnetbyname exists
12026set getnetbyname d_getnbyname
12027eval $inlibc
12028
12029: see if getnetent exists
12030set getnetent d_getnent
12031eval $inlibc
12032
10bc17b6
JH
12033: see if getnetbyaddr_r exists
12034set getnetbyaddr_r d_getnetbyaddr_r
12035eval $inlibc
12036case "$d_getnetbyaddr_r" in
12037"$define")
12038 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12039 case "$d_getnetbyaddr_r_proto:$usethreads" in
12040 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
12041 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12042 eval $hasproto ;;
12043 *) ;;
12044 esac
12045 case "$d_getnetbyaddr_r_proto" in
12046 define)
10bc17b6
JH
12047 case "$getnetbyaddr_r_proto" in
12048 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12049 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12050 esac
12051 case "$getnetbyaddr_r_proto" in
12052 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12053 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12054 esac
12055 case "$getnetbyaddr_r_proto" in
12056 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12057 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12058 esac
12059 case "$getnetbyaddr_r_proto" in
12060 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12061 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12062 esac
12063 case "$getnetbyaddr_r_proto" in
12064 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12065 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12066 esac
12067 case "$getnetbyaddr_r_proto" in
12068 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12069 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12070 esac
12071 case "$getnetbyaddr_r_proto" in
12072 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12073 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12074 esac
12075 case "$getnetbyaddr_r_proto" in
90e831dc 12076 ''|0) d_getnetbyaddr_r=undef
10bc17b6 12077 getnetbyaddr_r_proto=0
a48ec845 12078 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12079 * ) case "$getnetbyaddr_r_proto" in
12080 REENTRANT_PROTO*) ;;
12081 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12082 esac
12083 echo "Prototype: $try" ;;
12084 esac
12085 ;;
c18e646a
JH
12086 *) case "$usethreads" in
12087 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12088 esac
90e831dc
SB
12089 d_getnetbyaddr_r=undef
12090 getnetbyaddr_r_proto=0
c18e646a 12091 ;;
a48ec845
JH
12092 esac
12093 ;;
10bc17b6
JH
12094*) getnetbyaddr_r_proto=0
12095 ;;
12096esac
12097
12098: see if getnetbyname_r exists
12099set getnetbyname_r d_getnetbyname_r
12100eval $inlibc
12101case "$d_getnetbyname_r" in
12102"$define")
12103 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12104 case "$d_getnetbyname_r_proto:$usethreads" in
12105 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
12106 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12107 eval $hasproto ;;
12108 *) ;;
12109 esac
12110 case "$d_getnetbyname_r_proto" in
12111 define)
10bc17b6
JH
12112 case "$getnetbyname_r_proto" in
12113 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12114 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12115 esac
12116 case "$getnetbyname_r_proto" in
12117 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12118 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12119 esac
12120 case "$getnetbyname_r_proto" in
12121 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12122 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12123 esac
12124 case "$getnetbyname_r_proto" in
12125 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12126 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12127 esac
12128 case "$getnetbyname_r_proto" in
90e831dc 12129 ''|0) d_getnetbyname_r=undef
10bc17b6 12130 getnetbyname_r_proto=0
a48ec845 12131 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12132 * ) case "$getnetbyname_r_proto" in
12133 REENTRANT_PROTO*) ;;
12134 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12135 esac
12136 echo "Prototype: $try" ;;
12137 esac
12138 ;;
c18e646a
JH
12139 *) case "$usethreads" in
12140 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12141 esac
90e831dc
SB
12142 d_getnetbyname_r=undef
12143 getnetbyname_r_proto=0
c18e646a 12144 ;;
a48ec845
JH
12145 esac
12146 ;;
10bc17b6
JH
12147*) getnetbyname_r_proto=0
12148 ;;
12149esac
12150
12151: see if getnetent_r exists
12152set getnetent_r d_getnetent_r
12153eval $inlibc
12154case "$d_getnetent_r" in
12155"$define")
12156 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12157 case "$d_getnetent_r_proto:$usethreads" in
12158 ":define") d_getnetent_r_proto=define
a48ec845
JH
12159 set d_getnetent_r_proto getnetent_r $hdrs
12160 eval $hasproto ;;
12161 *) ;;
12162 esac
12163 case "$d_getnetent_r_proto" in
12164 define)
10bc17b6
JH
12165 case "$getnetent_r_proto" in
12166 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12167 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12168 esac
12169 case "$getnetent_r_proto" in
12170 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12171 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12172 esac
12173 case "$getnetent_r_proto" in
12174 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12175 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12176 esac
12177 case "$getnetent_r_proto" in
12178 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12179 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12180 esac
12181 case "$getnetent_r_proto" in
12182 ''|0) try='int getnetent_r(struct netent*, char*, int);'
12183 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12184 esac
12185 case "$getnetent_r_proto" in
12186 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12187 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12188 esac
12189 case "$getnetent_r_proto" in
90e831dc 12190 ''|0) d_getnetent_r=undef
10bc17b6 12191 getnetent_r_proto=0
a48ec845 12192 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12193 * ) case "$getnetent_r_proto" in
12194 REENTRANT_PROTO*) ;;
12195 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12196 esac
12197 echo "Prototype: $try" ;;
12198 esac
12199 ;;
c18e646a
JH
12200 *) case "$usethreads" in
12201 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12202 esac
90e831dc
SB
12203 d_getnetent_r=undef
12204 getnetent_r_proto=0
c18e646a 12205 ;;
a48ec845
JH
12206 esac
12207 ;;
10bc17b6
JH
12208*) getnetent_r_proto=0
12209 ;;
12210esac
12211
b4eb6b3d
JH
12212: see if prototypes for various getnetxxx netdb.h functions are available
12213echo " "
12214set d_getnetprotos getnetent $i_netdb netdb.h
12215eval $hasproto
12216
0c0643d0
JH
12217: see if getpagesize exists
12218set getpagesize d_getpagsz
12219eval $inlibc
12220
b4eb6b3d
JH
12221
12222: see if getprotobyname exists
12223set getprotobyname d_getpbyname
12224eval $inlibc
12225
12226: see if getprotobynumber exists
12227set getprotobynumber d_getpbynumber
12228eval $inlibc
12229
12230: see if getprotoent exists
12231set getprotoent d_getpent
12232eval $inlibc
12233
12234: see if getpgid exists
12235set getpgid d_getpgid
12236eval $inlibc
12237
12238: see if getpgrp2 exists
12239set getpgrp2 d_getpgrp2
12240eval $inlibc
12241
12242: see if getppid exists
12243set getppid d_getppid
12244eval $inlibc
12245
12246: see if getpriority exists
12247set getpriority d_getprior
12248eval $inlibc
12249
10bc17b6
JH
12250: see if getprotobyname_r exists
12251set getprotobyname_r d_getprotobyname_r
12252eval $inlibc
12253case "$d_getprotobyname_r" in
12254"$define")
12255 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12256 case "$d_getprotobyname_r_proto:$usethreads" in
12257 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
12258 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12259 eval $hasproto ;;
12260 *) ;;
12261 esac
12262 case "$d_getprotobyname_r_proto" in
12263 define)
10bc17b6
JH
12264 case "$getprotobyname_r_proto" in
12265 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12266 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12267 esac
12268 case "$getprotobyname_r_proto" in
12269 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12270 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12271 esac
12272 case "$getprotobyname_r_proto" in
12273 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12274 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12275 esac
12276 case "$getprotobyname_r_proto" in
90e831dc 12277 ''|0) d_getprotobyname_r=undef
10bc17b6 12278 getprotobyname_r_proto=0
a48ec845 12279 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12280 * ) case "$getprotobyname_r_proto" in
12281 REENTRANT_PROTO*) ;;
12282 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12283 esac
12284 echo "Prototype: $try" ;;
12285 esac
12286 ;;
c18e646a
JH
12287 *) case "$usethreads" in
12288 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12289 esac
90e831dc
SB
12290 d_getprotobyname_r=undef
12291 getprotobyname_r_proto=0
c18e646a 12292 ;;
a48ec845
JH
12293 esac
12294 ;;
10bc17b6
JH
12295*) getprotobyname_r_proto=0
12296 ;;
12297esac
12298
12299: see if getprotobynumber_r exists
12300set getprotobynumber_r d_getprotobynumber_r
12301eval $inlibc
12302case "$d_getprotobynumber_r" in
12303"$define")
12304 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12305 case "$d_getprotobynumber_r_proto:$usethreads" in
12306 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
12307 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12308 eval $hasproto ;;
12309 *) ;;
12310 esac
12311 case "$d_getprotobynumber_r_proto" in
12312 define)
10bc17b6
JH
12313 case "$getprotobynumber_r_proto" in
12314 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12315 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12316 esac
12317 case "$getprotobynumber_r_proto" in
12318 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12319 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12320 esac
12321 case "$getprotobynumber_r_proto" in
12322 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12323 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12324 esac
12325 case "$getprotobynumber_r_proto" in
90e831dc 12326 ''|0) d_getprotobynumber_r=undef
10bc17b6 12327 getprotobynumber_r_proto=0
a48ec845 12328 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12329 * ) case "$getprotobynumber_r_proto" in
12330 REENTRANT_PROTO*) ;;
12331 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12332 esac
12333 echo "Prototype: $try" ;;
12334 esac
12335 ;;
c18e646a
JH
12336 *) case "$usethreads" in
12337 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12338 esac
90e831dc
SB
12339 d_getprotobynumber_r=undef
12340 getprotobynumber_r_proto=0
c18e646a 12341 ;;
a48ec845
JH
12342 esac
12343 ;;
10bc17b6
JH
12344*) getprotobynumber_r_proto=0
12345 ;;
12346esac
12347
12348: see if getprotoent_r exists
12349set getprotoent_r d_getprotoent_r
12350eval $inlibc
12351case "$d_getprotoent_r" in
12352"$define")
12353 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12354 case "$d_getprotoent_r_proto:$usethreads" in
12355 ":define") d_getprotoent_r_proto=define
a48ec845
JH
12356 set d_getprotoent_r_proto getprotoent_r $hdrs
12357 eval $hasproto ;;
12358 *) ;;
12359 esac
12360 case "$d_getprotoent_r_proto" in
12361 define)
10bc17b6
JH
12362 case "$getprotoent_r_proto" in
12363 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12364 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12365 esac
12366 case "$getprotoent_r_proto" in
12367 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12368 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12369 esac
12370 case "$getprotoent_r_proto" in
12371 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12372 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12373 esac
12374 case "$getprotoent_r_proto" in
12375 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12376 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12377 esac
12378 case "$getprotoent_r_proto" in
90e831dc 12379 ''|0) d_getprotoent_r=undef
10bc17b6 12380 getprotoent_r_proto=0
a48ec845 12381 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12382 * ) case "$getprotoent_r_proto" in
12383 REENTRANT_PROTO*) ;;
12384 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12385 esac
12386 echo "Prototype: $try" ;;
12387 esac
12388 ;;
c18e646a
JH
12389 *) case "$usethreads" in
12390 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12391 esac
90e831dc
SB
12392 d_getprotoent_r=undef
12393 getprotoent_r_proto=0
c18e646a 12394 ;;
a48ec845
JH
12395 esac
12396 ;;
10bc17b6
JH
12397*) getprotoent_r_proto=0
12398 ;;
12399esac
12400
b4eb6b3d
JH
12401: see if prototypes for various getprotoxxx netdb.h functions are available
12402echo " "
12403set d_getprotoprotos getprotoent $i_netdb netdb.h
12404eval $hasproto
12405
12406: see if getprpwnam exists
12407set getprpwnam d_getprpwnam
12408eval $inlibc
12409
12410: see if getpwent exists
12411set getpwent d_getpwent
12412eval $inlibc
12413
10bc17b6
JH
12414: see if getpwent_r exists
12415set getpwent_r d_getpwent_r
12416eval $inlibc
12417case "$d_getpwent_r" in
12418"$define")
12419 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12420 case "$d_getpwent_r_proto:$usethreads" in
12421 ":define") d_getpwent_r_proto=define
a48ec845
JH
12422 set d_getpwent_r_proto getpwent_r $hdrs
12423 eval $hasproto ;;
12424 *) ;;
12425 esac
12426 case "$d_getpwent_r_proto" in
12427 define)
10bc17b6
JH
12428 case "$getpwent_r_proto" in
12429 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12430 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12431 esac
12432 case "$getpwent_r_proto" in
12433 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12434 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12435 esac
12436 case "$getpwent_r_proto" in
12437 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12438 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12439 esac
12440 case "$getpwent_r_proto" in
12441 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12442 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12443 esac
12444 case "$getpwent_r_proto" in
12445 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12446 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12447 esac
12448 case "$getpwent_r_proto" in
12449 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12450 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12451 esac
12452 case "$getpwent_r_proto" in
90e831dc 12453 ''|0) d_getpwent_r=undef
10bc17b6 12454 getpwent_r_proto=0
a48ec845 12455 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12456 * ) case "$getpwent_r_proto" in
12457 REENTRANT_PROTO*) ;;
12458 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12459 esac
12460 echo "Prototype: $try" ;;
12461 esac
12462 ;;
c18e646a
JH
12463 *) case "$usethreads" in
12464 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12465 esac
90e831dc
SB
12466 d_getpwent_r=undef
12467 getpwent_r_proto=0
c18e646a 12468 ;;
a48ec845
JH
12469 esac
12470 ;;
10bc17b6
JH
12471*) getpwent_r_proto=0
12472 ;;
12473esac
12474
12475: see if getpwnam_r exists
12476set getpwnam_r d_getpwnam_r
12477eval $inlibc
12478case "$d_getpwnam_r" in
12479"$define")
12480 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12481 case "$d_getpwnam_r_proto:$usethreads" in
12482 ":define") d_getpwnam_r_proto=define
a48ec845
JH
12483 set d_getpwnam_r_proto getpwnam_r $hdrs
12484 eval $hasproto ;;
12485 *) ;;
12486 esac
12487 case "$d_getpwnam_r_proto" in
12488 define)
10bc17b6
JH
12489 case "$getpwnam_r_proto" in
12490 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12491 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12492 esac
12493 case "$getpwnam_r_proto" in
12494 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12495 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12496 esac
12497 case "$getpwnam_r_proto" in
12498 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12499 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12500 esac
12501 case "$getpwnam_r_proto" in
12502 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12503 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12504 esac
12505 case "$getpwnam_r_proto" in
90e831dc 12506 ''|0) d_getpwnam_r=undef
10bc17b6 12507 getpwnam_r_proto=0
a48ec845 12508 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12509 * ) case "$getpwnam_r_proto" in
12510 REENTRANT_PROTO*) ;;
12511 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12512 esac
12513 echo "Prototype: $try" ;;
12514 esac
12515 ;;
c18e646a
JH
12516 *) case "$usethreads" in
12517 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12518 esac
90e831dc
SB
12519 d_getpwnam_r=undef
12520 getpwnam_r_proto=0
c18e646a 12521 ;;
a48ec845
JH
12522 esac
12523 ;;
10bc17b6
JH
12524*) getpwnam_r_proto=0
12525 ;;
12526esac
12527
12528: see if getpwuid_r exists
12529set getpwuid_r d_getpwuid_r
12530eval $inlibc
12531case "$d_getpwuid_r" in
12532"$define")
12533 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12534 case "$d_getpwuid_r_proto:$usethreads" in
12535 ":define") d_getpwuid_r_proto=define
a48ec845
JH
12536 set d_getpwuid_r_proto getpwuid_r $hdrs
12537 eval $hasproto ;;
12538 *) ;;
12539 esac
12540 case "$d_getpwuid_r_proto" in
12541 define)
10bc17b6
JH
12542 case "$getpwuid_r_proto" in
12543 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12544 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12545 esac
12546 case "$getpwuid_r_proto" in
12547 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12548 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12549 esac
12550 case "$getpwuid_r_proto" in
12551 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12552 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12553 esac
12554 case "$getpwuid_r_proto" in
12555 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12556 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12557 esac
12558 case "$getpwuid_r_proto" in
90e831dc 12559 ''|0) d_getpwuid_r=undef
10bc17b6 12560 getpwuid_r_proto=0
a48ec845 12561 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12562 * ) case "$getpwuid_r_proto" in
12563 REENTRANT_PROTO*) ;;
12564 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12565 esac
12566 echo "Prototype: $try" ;;
12567 esac
12568 ;;
c18e646a
JH
12569 *) case "$usethreads" in
12570 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12571 esac
90e831dc
SB
12572 d_getpwuid_r=undef
12573 getpwuid_r_proto=0
c18e646a 12574 ;;
a48ec845
JH
12575 esac
12576 ;;
10bc17b6
JH
12577*) getpwuid_r_proto=0
12578 ;;
12579esac
12580
b4eb6b3d
JH
12581
12582: see if getservbyname exists
12583set getservbyname d_getsbyname
12584eval $inlibc
12585
12586: see if getservbyport exists
12587set getservbyport d_getsbyport
12588eval $inlibc
12589
12590: see if getservent exists
12591set getservent d_getsent
12592eval $inlibc
12593
10bc17b6
JH
12594: see if getservbyname_r exists
12595set getservbyname_r d_getservbyname_r
12596eval $inlibc
12597case "$d_getservbyname_r" in
12598"$define")
12599 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12600 case "$d_getservbyname_r_proto:$usethreads" in
12601 ":define") d_getservbyname_r_proto=define
a48ec845
JH
12602 set d_getservbyname_r_proto getservbyname_r $hdrs
12603 eval $hasproto ;;
12604 *) ;;
12605 esac
12606 case "$d_getservbyname_r_proto" in
12607 define)
10bc17b6
JH
12608 case "$getservbyname_r_proto" in
12609 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12610 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12611 esac
12612 case "$getservbyname_r_proto" in
12613 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12614 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12615 esac
12616 case "$getservbyname_r_proto" in
12617 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12618 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12619 esac
12620 case "$getservbyname_r_proto" in
90e831dc 12621 ''|0) d_getservbyname_r=undef
10bc17b6 12622 getservbyname_r_proto=0
a48ec845 12623 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12624 * ) case "$getservbyname_r_proto" in
12625 REENTRANT_PROTO*) ;;
12626 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12627 esac
12628 echo "Prototype: $try" ;;
12629 esac
12630 ;;
c18e646a
JH
12631 *) case "$usethreads" in
12632 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12633 esac
90e831dc
SB
12634 d_getservbyname_r=undef
12635 getservbyname_r_proto=0
c18e646a 12636 ;;
a48ec845
JH
12637 esac
12638 ;;
10bc17b6
JH
12639*) getservbyname_r_proto=0
12640 ;;
12641esac
12642
12643: see if getservbyport_r exists
12644set getservbyport_r d_getservbyport_r
12645eval $inlibc
12646case "$d_getservbyport_r" in
12647"$define")
12648 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12649 case "$d_getservbyport_r_proto:$usethreads" in
12650 ":define") d_getservbyport_r_proto=define
a48ec845
JH
12651 set d_getservbyport_r_proto getservbyport_r $hdrs
12652 eval $hasproto ;;
12653 *) ;;
12654 esac
12655 case "$d_getservbyport_r_proto" in
12656 define)
10bc17b6
JH
12657 case "$getservbyport_r_proto" in
12658 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12659 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12660 esac
12661 case "$getservbyport_r_proto" in
12662 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12663 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12664 esac
12665 case "$getservbyport_r_proto" in
12666 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12667 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12668 esac
12669 case "$getservbyport_r_proto" in
90e831dc 12670 ''|0) d_getservbyport_r=undef
10bc17b6 12671 getservbyport_r_proto=0
a48ec845 12672 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12673 * ) case "$getservbyport_r_proto" in
12674 REENTRANT_PROTO*) ;;
12675 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12676 esac
12677 echo "Prototype: $try" ;;
12678 esac
12679 ;;
c18e646a
JH
12680 *) case "$usethreads" in
12681 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12682 esac
90e831dc
SB
12683 d_getservbyport_r=undef
12684 getservbyport_r_proto=0
c18e646a 12685 ;;
a48ec845
JH
12686 esac
12687 ;;
10bc17b6
JH
12688*) getservbyport_r_proto=0
12689 ;;
12690esac
12691
12692: see if getservent_r exists
12693set getservent_r d_getservent_r
12694eval $inlibc
12695case "$d_getservent_r" in
12696"$define")
12697 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12698 case "$d_getservent_r_proto:$usethreads" in
12699 ":define") d_getservent_r_proto=define
a48ec845
JH
12700 set d_getservent_r_proto getservent_r $hdrs
12701 eval $hasproto ;;
12702 *) ;;
12703 esac
12704 case "$d_getservent_r_proto" in
12705 define)
10bc17b6
JH
12706 case "$getservent_r_proto" in
12707 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12708 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12709 esac
12710 case "$getservent_r_proto" in
12711 ''|0) try='int getservent_r(struct servent*, char*, int);'
12712 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12713 esac
12714 case "$getservent_r_proto" in
12715 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12716 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12717 esac
12718 case "$getservent_r_proto" in
12719 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12720 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12721 esac
12722 case "$getservent_r_proto" in
90e831dc 12723 ''|0) d_getservent_r=undef
10bc17b6 12724 getservent_r_proto=0
a48ec845 12725 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12726 * ) case "$getservent_r_proto" in
12727 REENTRANT_PROTO*) ;;
12728 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12729 esac
12730 echo "Prototype: $try" ;;
12731 esac
12732 ;;
c18e646a
JH
12733 *) case "$usethreads" in
12734 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12735 esac
90e831dc
SB
12736 d_getservent_r=undef
12737 getservent_r_proto=0
c18e646a 12738 ;;
a48ec845
JH
12739 esac
12740 ;;
10bc17b6
JH
12741*) getservent_r_proto=0
12742 ;;
12743esac
12744
b4eb6b3d
JH
12745: see if prototypes for various getservxxx netdb.h functions are available
12746echo " "
12747set d_getservprotos getservent $i_netdb netdb.h
12748eval $hasproto
12749
12750: see if getspnam exists
12751set getspnam d_getspnam
12752eval $inlibc
12753
10bc17b6
JH
12754: see if this is a shadow.h system
12755set shadow.h i_shadow
12756eval $inhdr
12757
12758: see if getspnam_r exists
12759set getspnam_r d_getspnam_r
12760eval $inlibc
12761case "$d_getspnam_r" in
12762"$define")
12763 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
12764 case "$d_getspnam_r_proto:$usethreads" in
12765 ":define") d_getspnam_r_proto=define
a48ec845
JH
12766 set d_getspnam_r_proto getspnam_r $hdrs
12767 eval $hasproto ;;
12768 *) ;;
12769 esac
12770 case "$d_getspnam_r_proto" in
12771 define)
10bc17b6
JH
12772 case "$getspnam_r_proto" in
12773 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12774 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12775 esac
12776 case "$getspnam_r_proto" in
12777 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12778 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12779 esac
12780 case "$getspnam_r_proto" in
90e831dc 12781 ''|0) d_getspnam_r=undef
10bc17b6 12782 getspnam_r_proto=0
a48ec845 12783 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12784 * ) case "$getspnam_r_proto" in
12785 REENTRANT_PROTO*) ;;
12786 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12787 esac
12788 echo "Prototype: $try" ;;
12789 esac
12790 ;;
c18e646a
JH
12791 *) case "$usethreads" in
12792 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12793 esac
90e831dc
SB
12794 d_getspnam_r=undef
12795 getspnam_r_proto=0
c18e646a 12796 ;;
a48ec845
JH
12797 esac
12798 ;;
10bc17b6
JH
12799*) getspnam_r_proto=0
12800 ;;
12801esac
12802
b4eb6b3d
JH
12803: see if gettimeofday or ftime exists
12804set gettimeofday d_gettimeod
12805eval $inlibc
12806case "$d_gettimeod" in
12807"$undef")
12808 set ftime d_ftime
12809 eval $inlibc
12810 ;;
12811*)
12812 val="$undef"; set d_ftime; eval $setvar
12813 ;;
12814esac
12815case "$d_gettimeod$d_ftime" in
12816"$undef$undef")
12817 echo " "
12818 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12819 ;;
12820esac
12821
10bc17b6
JH
12822: see if gmtime_r exists
12823set gmtime_r d_gmtime_r
12824eval $inlibc
12825case "$d_gmtime_r" in
12826"$define")
d63eadf0 12827 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
12828 case "$d_gmtime_r_proto:$usethreads" in
12829 ":define") d_gmtime_r_proto=define
a48ec845
JH
12830 set d_gmtime_r_proto gmtime_r $hdrs
12831 eval $hasproto ;;
12832 *) ;;
12833 esac
12834 case "$d_gmtime_r_proto" in
12835 define)
10bc17b6
JH
12836 case "$gmtime_r_proto" in
12837 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12838 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12839 esac
12840 case "$gmtime_r_proto" in
12841 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12842 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12843 esac
12844 case "$gmtime_r_proto" in
90e831dc 12845 ''|0) d_gmtime_r=undef
10bc17b6 12846 gmtime_r_proto=0
a48ec845 12847 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12848 * ) case "$gmtime_r_proto" in
12849 REENTRANT_PROTO*) ;;
12850 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12851 esac
12852 echo "Prototype: $try" ;;
12853 esac
b4eb6b3d 12854 ;;
c18e646a
JH
12855 *) case "$usethreads" in
12856 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12857 esac
90e831dc
SB
12858 d_gmtime_r=undef
12859 gmtime_r_proto=0
c18e646a 12860 ;;
a48ec845
JH
12861 esac
12862 ;;
10bc17b6 12863*) gmtime_r_proto=0
b4eb6b3d
JH
12864 ;;
12865esac
12866
12867: see if hasmntopt exists
12868set hasmntopt d_hasmntopt
12869eval $inlibc
12870
12871: see if this is a netinet/in.h or sys/in.h system
12872set netinet/in.h i_niin sys/in.h i_sysin
12873eval $inhdr
12874
12875: see if arpa/inet.h has to be included
12876set arpa/inet.h i_arpainet
12877eval $inhdr
12878
12879: see if htonl --and friends-- exists
12880val=''
12881set htonl val
12882eval $inlibc
12883
12884: Maybe they are macros.
12885case "$val" in
12886$undef)
12887 $cat >htonl.c <<EOM
12888#include <stdio.h>
12889#include <sys/types.h>
12890#$i_niin I_NETINET_IN
12891#$i_sysin I_SYS_IN
12892#$i_arpainet I_ARPA_INET
12893#ifdef I_NETINET_IN
12894#include <netinet/in.h>
12895#endif
12896#ifdef I_SYS_IN
12897#include <sys/in.h>
12898#endif
12899#ifdef I_ARPA_INET
12900#include <arpa/inet.h>
12901#endif
12902#ifdef htonl
12903printf("Defined as a macro.");
12904#endif
12905EOM
12906 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12907 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12908 val="$define"
12909 echo "But it seems to be defined as a macro." >&4
12910 fi
12911 $rm -f htonl.?
12912 ;;
12913esac
12914set d_htonl
12915eval $setvar
12916
b4eb6b3d
JH
12917: index or strchr
12918echo " "
12919if set index val -f; eval $csym; $val; then
12920 if set strchr val -f d_strchr; eval $csym; $val; then
12921 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12922 val="$define"
12923 vali="$undef"
12924 echo "strchr() found." >&4
12925 else
12926 val="$undef"
12927 vali="$define"
12928 echo "index() found." >&4
12929 fi
12930 else
12931 val="$undef"
12932 vali="$define"
8dfa8df9
JH
12933 echo "index() found." >&4
12934 fi
b4eb6b3d 12935else
8dfa8df9
JH
12936 if set strchr val -f d_strchr; eval $csym; $val; then
12937 val="$define"
12938 vali="$undef"
12939 echo "strchr() found." >&4
12940 else
12941 echo "No index() or strchr() found!" >&4
12942 val="$undef"
12943 vali="$undef"
12944 fi
b4eb6b3d 12945fi
8dfa8df9
JH
12946set d_strchr; eval $setvar
12947val="$vali"
12948set d_index; eval $setvar
12949
12950: check whether inet_aton exists
12951set inet_aton d_inetaton
12952eval $inlibc
b4eb6b3d
JH
12953
12954: Look for isascii
12955echo " "
12956$cat >isascii.c <<'EOCP'
12957#include <stdio.h>
12958#include <ctype.h>
12959int main() {
12960 int c = 'A';
12961 if (isascii(c))
12962 exit(0);
12963 else
12964 exit(1);
12965}
12966EOCP
12967set isascii
12968if eval $compile; then
12969 echo "isascii() found." >&4
12970 val="$define"
12971else
12972 echo "isascii() NOT found." >&4
12973 val="$undef"
12974fi
12975set d_isascii
12976eval $setvar
12977$rm -f isascii*
12978
758a5d79
JH
12979: see if isfinite exists
12980set isfinite d_isfinite
12981eval $inlibc
12982
12983: see if isinf exists
12984set isinf d_isinf
12985eval $inlibc
12986
b4eb6b3d
JH
12987: see if isnan exists
12988set isnan d_isnan
12989eval $inlibc
12990
12991: see if isnanl exists
12992set isnanl d_isnanl
12993eval $inlibc
12994
12995: see if killpg exists
12996set killpg d_killpg
12997eval $inlibc
12998
12999: see if lchown exists
13000echo " "
13001$cat > try.c <<'EOCP'
13002/* System header to define __stub macros and hopefully few prototypes,
13003 which can conflict with char lchown(); below. */
13004#include <assert.h>
13005/* Override any gcc2 internal prototype to avoid an error. */
13006/* We use char because int might match the return type of a gcc2
13007 builtin and then its argument prototype would still apply. */
13008char lchown();
13009int main() {
13010 /* The GNU C library defines this for functions which it implements
13011 to always fail with ENOSYS. Some functions are actually named
13012 something starting with __ and the normal name is an alias. */
13013#if defined (__stub_lchown) || defined (__stub___lchown)
13014choke me
13015#else
13016lchown();
13017#endif
13018; return 0; }
13019EOCP
13020set try
13021if eval $compile; then
13022 $echo "lchown() found." >&4
13023 val="$define"
13024else
13025 $echo "lchown() NOT found." >&4
13026 val="$undef"
13027fi
13028set d_lchown
13029eval $setvar
13030
13031: See if number of significant digits in a double precision number is known
13032echo " "
13033$cat >ldbl_dig.c <<EOM
13034#$i_limits I_LIMITS
13035#$i_float I_FLOAT
13036#ifdef I_LIMITS
13037#include <limits.h>
13038#endif
13039#ifdef I_FLOAT
13040#include <float.h>
13041#endif
13042#ifdef LDBL_DIG
13043printf("Contains LDBL_DIG");
13044#endif
13045EOM
13046$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13047if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13048 echo "LDBL_DIG found." >&4
13049 val="$define"
13050else
13051 echo "LDBL_DIG NOT found." >&4
13052 val="$undef"
13053fi
13054$rm -f ldbl_dig.?
13055set d_ldbl_dig
13056eval $setvar
13057
13058: see if link exists
13059set link d_link
13060eval $inlibc
13061
10bc17b6
JH
13062: see if localtime_r exists
13063set localtime_r d_localtime_r
13064eval $inlibc
13065case "$d_localtime_r" in
13066"$define")
d63eadf0 13067 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13068 case "$d_localtime_r_proto:$usethreads" in
13069 ":define") d_localtime_r_proto=define
a48ec845
JH
13070 set d_localtime_r_proto localtime_r $hdrs
13071 eval $hasproto ;;
13072 *) ;;
13073 esac
13074 case "$d_localtime_r_proto" in
13075 define)
10bc17b6
JH
13076 case "$localtime_r_proto" in
13077 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13078 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13079 esac
13080 case "$localtime_r_proto" in
13081 ''|0) try='int localtime_r(const time_t*, struct tm*);'
13082 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13083 esac
13084 case "$localtime_r_proto" in
90e831dc 13085 ''|0) d_localtime_r=undef
10bc17b6 13086 localtime_r_proto=0
a48ec845 13087 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13088 * ) case "$localtime_r_proto" in
13089 REENTRANT_PROTO*) ;;
13090 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13091 esac
13092 echo "Prototype: $try" ;;
13093 esac
13094 ;;
c18e646a
JH
13095 *) case "$usethreads" in
13096 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13097 esac
90e831dc
SB
13098 d_localtime_r=undef
13099 localtime_r_proto=0
c18e646a 13100 ;;
a48ec845
JH
13101 esac
13102 ;;
10bc17b6
JH
13103*) localtime_r_proto=0
13104 ;;
13105esac
13106
b4eb6b3d
JH
13107: see if localeconv exists
13108set localeconv d_locconv
13109eval $inlibc
13110
13111: see if lockf exists
13112set lockf d_lockf
13113eval $inlibc
13114
b4eb6b3d
JH
13115: see if prototype for lseek is available
13116echo " "
4786929f 13117set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
13118eval $hasproto
13119
13120: see if lstat exists
13121set lstat d_lstat
13122eval $inlibc
13123
13124: see if madvise exists
13125set madvise d_madvise
13126eval $inlibc
13127
13128: see if mblen exists
13129set mblen d_mblen
13130eval $inlibc
13131
13132: see if mbstowcs exists
13133set mbstowcs d_mbstowcs
13134eval $inlibc
13135
13136: see if mbtowc exists
13137set mbtowc d_mbtowc
13138eval $inlibc
13139
13140: see if memchr exists
13141set memchr d_memchr
13142eval $inlibc
13143
13144: see if memcmp exists
13145set memcmp d_memcmp
13146eval $inlibc
13147
13148: see if memcpy exists
13149set memcpy d_memcpy
13150eval $inlibc
13151
13152: see if memmove exists
13153set memmove d_memmove
13154eval $inlibc
13155
13156: see if memset exists
13157set memset d_memset
13158eval $inlibc
13159
13160: see if mkdir exists
13161set mkdir d_mkdir
13162eval $inlibc
13163
13164: see if mkdtemp exists
13165set mkdtemp d_mkdtemp
13166eval $inlibc
13167
13168: see if mkfifo exists
13169set mkfifo d_mkfifo
13170eval $inlibc
13171
13172: see if mkstemp exists
13173set mkstemp d_mkstemp
13174eval $inlibc
13175
13176: see if mkstemps exists
13177set mkstemps d_mkstemps
13178eval $inlibc
13179
13180: see if mktime exists
13181set mktime d_mktime
13182eval $inlibc
13183
13184: see if this is a sys/mman.h system
13185set sys/mman.h i_sysmman
13186eval $inhdr
13187
13188: see if mmap exists
13189set mmap d_mmap
13190eval $inlibc
13191: see what shmat returns
13192: default to something harmless
13193mmaptype='void *'
13194case "$i_sysmman$d_mmap" in
13195"$define$define")
13196 $cat >mmap.c <<'END'
13197#include <sys/mman.h>
13198void *mmap();
13199END
13200 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13201 mmaptype='void *'
13202 else
13203 mmaptype='caddr_t'
13204 fi
13205 echo "and it returns ($mmaptype)." >&4
13206 ;;
13207esac
13208
13209
13210
b4eb6b3d
JH
13211: see if mprotect exists
13212set mprotect d_mprotect
13213eval $inlibc
13214
13215: see if msgctl exists
13216set msgctl d_msgctl
13217eval $inlibc
13218
13219: see if msgget exists
13220set msgget d_msgget
13221eval $inlibc
13222
13223: see if msgsnd exists
13224set msgsnd d_msgsnd
13225eval $inlibc
13226
13227: see if msgrcv exists
13228set msgrcv d_msgrcv
13229eval $inlibc
13230
13231: see how much of the 'msg*(2)' library is present.
13232h_msg=true
13233echo " "
13234case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13235*"$undef"*) h_msg=false;;
13236esac
13237case "$osname" in
13238freebsd)
13239 case "`ipcs 2>&1`" in
13240 "SVID messages"*"not configured"*)
13241 echo "Your $osname does not have the msg*(2) configured." >&4
13242 h_msg=false
13243 val="$undef"
13244 set msgctl d_msgctl
13245 eval $setvar
13246 set msgget d_msgget
13247 eval $setvar
13248 set msgsnd d_msgsnd
13249 eval $setvar
13250 set msgrcv d_msgrcv
13251 eval $setvar
13252 ;;
13253 esac
13254 ;;
13255esac
13256: we could also check for sys/ipc.h ...
13257if $h_msg && $test `./findhdr sys/msg.h`; then
13258 echo "You have the full msg*(2) library." >&4
13259 val="$define"
13260else
13261 echo "You don't have the full msg*(2) library." >&4
13262 val="$undef"
13263fi
13264set d_msg
13265eval $setvar
13266
4e0554ec
JH
13267
13268echo " "
13269echo "Checking to see if your system supports struct msghdr..." >&4
13270set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13271eval $hasstruct
13272case "$d_msghdr_s" in
13273"$define") echo "Yes, it does." ;;
13274*) echo "No, it doesn't." ;;
13275esac
13276
13277
b4eb6b3d
JH
13278: see if msync exists
13279set msync d_msync
13280eval $inlibc
13281
13282: see if munmap exists
13283set munmap d_munmap
13284eval $inlibc
13285
13286: see if nice exists
13287set nice d_nice
13288eval $inlibc
13289
2765b840
JH
13290: see if this is a langinfo.h system
13291set langinfo.h i_langinfo
13292eval $inhdr
13293
13294: see if nl_langinfo exists
13295set nl_langinfo d_nl_langinfo
13296eval $inlibc
13297
b4eb6b3d
JH
13298: check for length of character
13299echo " "
13300case "$charsize" in
13301'')
13302 echo "Checking to see how big your characters are (hey, you never know)..." >&4
13303 $cat >try.c <<'EOCP'
13304#include <stdio.h>
13305int main()
13306{
13307 printf("%d\n", (int)sizeof(char));
13308 exit(0);
13309}
13310EOCP
13311 set try
13312 if eval $compile_ok; then
5440bc8e 13313 dflt=`$run ./try`
b4eb6b3d
JH
13314 else
13315 dflt='1'
13316 echo "(I can't seem to compile the test program. Guessing...)"
13317 fi
13318 ;;
13319*)
13320 dflt="$charsize"
13321 ;;
13322esac
13323rp="What is the size of a character (in bytes)?"
13324. ./myread
13325charsize="$ans"
13326$rm -f try.c try
13327
1d1be0dc
NC
13328: check for volatile keyword
13329echo " "
13330echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13331$cat >try.c <<'EOCP'
13332int main()
13333{
13334 typedef struct _goo_struct goo_struct;
13335 goo_struct * volatile goo = ((goo_struct *)0);
13336 struct _goo_struct {
13337 long long_int;
13338 int reg_int;
13339 char char_var;
13340 };
13341 typedef unsigned short foo_t;
13342 char *volatile foo;
13343 volatile int bar;
13344 volatile foo_t blech;
13345 foo = foo;
13346}
13347EOCP
13348if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13349 val="$define"
13350 echo "Yup, it does."
13351else
13352 val="$undef"
13353 echo "Nope, it doesn't."
13354fi
13355set d_volatile
13356eval $setvar
13357$rm -f try.*
13358
b4eb6b3d
JH
13359
13360echo " "
13361$echo "Choosing the C types to be used for Perl's internal types..." >&4
13362
13363case "$use64bitint:$d_quad:$quadtype" in
13364define:define:?*)
13365 ivtype="$quadtype"
13366 uvtype="$uquadtype"
13367 ivsize=8
13368 uvsize=8
13369 ;;
13370*) ivtype="long"
13371 uvtype="unsigned long"
13372 ivsize=$longsize
13373 uvsize=$longsize
13374 ;;
13375esac
13376
13377case "$uselongdouble:$d_longdbl" in
13378define:define)
13379 nvtype="long double"
13380 nvsize=$longdblsize
13381 ;;
13382*) nvtype=double
13383 nvsize=$doublesize
13384 ;;
13385esac
13386
13387$echo "(IV will be "$ivtype", $ivsize bytes)"
13388$echo "(UV will be "$uvtype", $uvsize bytes)"
13389$echo "(NV will be "$nvtype", $nvsize bytes)"
13390
13391$cat >try.c <<EOCP
13392#$i_inttypes I_INTTYPES
13393#ifdef I_INTTYPES
13394#include <inttypes.h>
13395#endif
13396#include <stdio.h>
13397int main() {
13398#ifdef INT8
13399 int8_t i = INT8_MAX;
13400 uint8_t u = UINT8_MAX;
13401 printf("int8_t\n");
13402#endif
13403#ifdef INT16
13404 int16_t i = INT16_MAX;
13405 uint16_t i = UINT16_MAX;
13406 printf("int16_t\n");
13407#endif
13408#ifdef INT32
13409 int32_t i = INT32_MAX;
13410 uint32_t u = UINT32_MAX;
13411 printf("int32_t\n");
13412#endif
13413}
13414EOCP
13415
13416case "$i8type" in
13417'') case "$charsize" in
13418 1) i8type=char
13419 u8type="unsigned char"
13420 i8size=$charsize
13421 u8size=$charsize
13422 ;;
13423 esac
13424 ;;
13425esac
13426case "$i8type" in
13427'') set try -DINT8
13428 if eval $compile; then
5440bc8e 13429 case "`$run ./try`" in
b4eb6b3d
JH
13430 int8_t) i8type=int8_t
13431 u8type=uint8_t
13432 i8size=1
13433 u8size=1
13434 ;;
13435 esac
13436 fi
13437 ;;
13438esac
13439case "$i8type" in
13440'') if $test $charsize -ge 1; then
13441 i8type=char
13442 u8type="unsigned char"
13443 i8size=$charsize
13444 u8size=$charsize
13445 fi
13446 ;;
13447esac
13448
13449case "$i16type" in
13450'') case "$shortsize" in
13451 2) i16type=short
13452 u16type="unsigned short"
13453 i16size=$shortsize
13454 u16size=$shortsize
13455 ;;
13456 esac
13457 ;;
13458esac
13459case "$i16type" in
13460'') set try -DINT16
13461 if eval $compile; then
5440bc8e 13462 case "`$run ./try`" in
b4eb6b3d
JH
13463 int16_t)
13464 i16type=int16_t
13465 u16type=uint16_t
13466 i16size=2
13467 u16size=2
13468 ;;
13469 esac
13470 fi
13471 ;;
13472esac
13473case "$i16type" in
13474'') if $test $shortsize -ge 2; then
13475 i16type=short
13476 u16type="unsigned short"
13477 i16size=$shortsize
13478 u16size=$shortsize
13479 fi
13480 ;;
13481esac
13482
13483case "$i32type" in
13484'') case "$longsize" in
13485 4) i32type=long
13486 u32type="unsigned long"
13487 i32size=$longsize
13488 u32size=$longsize
13489 ;;
13490 *) case "$intsize" in
13491 4) i32type=int
13492 u32type="unsigned int"
13493 i32size=$intsize
13494 u32size=$intsize
13495 ;;
13496 esac
13497 ;;
13498 esac
13499 ;;
13500esac
13501case "$i32type" in
13502'') set try -DINT32
13503 if eval $compile; then
5440bc8e 13504 case "`$run ./try`" in
b4eb6b3d
JH
13505 int32_t)
13506 i32type=int32_t
13507 u32type=uint32_t
13508 i32size=4
13509 u32size=4
13510 ;;
13511 esac
13512 fi
13513 ;;
13514esac
13515case "$i32type" in
13516'') if $test $intsize -ge 4; then
13517 i32type=int
13518 u32type="unsigned int"
13519 i32size=$intsize
13520 u32size=$intsize
13521 fi
13522 ;;
13523esac
13524
13525case "$i64type" in
13526'') case "$d_quad:$quadtype" in
13527 define:?*)
13528 i64type="$quadtype"
13529 u64type="$uquadtype"
13530 i64size=8
13531 u64size=8
13532 ;;
13533 esac
13534 ;;
13535esac
13536
1d1be0dc
NC
13537$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13538: volatile so that the compiler has to store it out to memory.
13539if test X"$d_volatile" = X"$define"; then
13540 volatile=volatile
13541fi
b4eb6b3d
JH
13542$cat <<EOP >try.c
13543#include <stdio.h>
1d1be0dc
NC
13544#include <sys/types.h>
13545#include <signal.h>
13546#ifdef SIGFPE
13547$volatile int bletched = 0;
13548$signal_t blech(s) int s; { bletched = 1; }
13549#endif
b4eb6b3d
JH
13550int main() {
13551 $uvtype u = 0;
1d1be0dc 13552 $nvtype d;
b4eb6b3d
JH
13553 int n = 8 * $uvsize;
13554 int i;
1d1be0dc
NC
13555#ifdef SIGFPE
13556 signal(SIGFPE, blech);
13557#endif
13558
b4eb6b3d
JH
13559 for (i = 0; i < n; i++) {
13560 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
13561 d = ($nvtype)u;
13562 if (($uvtype)d != u)
b4eb6b3d 13563 break;
1d1be0dc
NC
13564 if (d <= 0)
13565 break;
13566 d = ($nvtype)(u - 1);
13567 if (($uvtype)d != (u - 1))
13568 break;
13569#ifdef SIGFPE
13570 if (bletched) {
13571 break;
13572#endif
13573 }
b4eb6b3d 13574 }
efd1522b 13575 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
13576 exit(0);
13577}
13578EOP
1d1be0dc
NC
13579set try
13580
13581d_nv_preserves_uv="$undef"
13582if eval $compile; then
53133ed1 13583 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 13584fi
53133ed1 13585case "$nv_preserves_uv_bits" in
1d1be0dc 13586\-[1-9]*)
53133ed1
NC
13587 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13588 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 13589 d_nv_preserves_uv="$define"
b4eb6b3d 13590 ;;
53133ed1 13591[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
13592 d_nv_preserves_uv="$undef" ;;
13593*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 13594 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
13595esac
13596
1d1be0dc
NC
13597$rm -f try.* try
13598
b4eb6b3d
JH
13599
13600: check for off64_t
13601echo " "
13602echo "Checking to see if you have off64_t..." >&4
13603$cat >try.c <<EOCP
13604#include <sys/types.h>
13605#include <unistd.h>
13606int main() { off64_t x = 7; }
13607EOCP
13608set try
13609if eval $compile; then
13610 val="$define"
13611 echo "You have off64_t."
13612else
13613 val="$undef"
13614 echo "You do not have off64_t."
13615 case "$lseeksize" in
13616 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13617 esac
13618fi
13619$rm -f try.* try
13620set d_off64_t
13621eval $setvar
13622
b4eb6b3d
JH
13623: how to create joinable pthreads
13624if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13625 echo " "
13626 echo "Checking what constant to use for creating joinable pthreads..." >&4
13627 $cat >try.c <<'EOCP'
13628#include <pthread.h>
13629int main() {
13630 int detachstate = JOINABLE;
13631}
13632EOCP
13633 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13634 if eval $compile; then
13635 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13636 val="$undef" # Yes, undef.
13637 set d_old_pthread_create_joinable
13638 eval $setvar
13639 val=""
13640 set old_pthread_create_joinable
13641 eval $setvar
13642 else
13643 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13644 if eval $compile; then
13645 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13646 val="$define"
13647 set d_old_pthread_create_joinable
13648 eval $setvar
13649 val=PTHREAD_CREATE_UNDETACHED
13650 set old_pthread_create_joinable
13651 eval $setvar
13652 else
13653 set try -DJOINABLE=__UNDETACHED
13654 if eval $compile; then
13655 echo "You seem to use __UNDETACHED." >&4
13656 val="$define"
13657 set d_old_pthread_create_joinable
13658 eval $setvar
13659 val=__UNDETACHED
13660 set old_pthread_create_joinable
13661 eval $setvar
13662 else
13663 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13664 val="$define"
13665 set d_old_pthread_create_joinable
13666 eval $setvar
13667 val=0
13668 set old_pthread_create_joinable
13669 eval $setvar
13670 fi
13671 fi
13672 fi
13673 $rm -f try try.*
13674else
13675 d_old_pthread_create_joinable="$undef"
13676 old_pthread_create_joinable=""
13677fi
13678
13679: see if pause exists
13680set pause d_pause
13681eval $inlibc
13682
13683: see if pipe exists
13684set pipe d_pipe
13685eval $inlibc
13686
13687: see if poll exists
13688set poll d_poll
13689eval $inlibc
13690
c7aff470
NIS
13691: see if readlink exists
13692set readlink d_readlink
13693eval $inlibc
13694
13695echo " "
f24dbf84 13696procselfexe=''
c7aff470 13697val="$undef"
a33c94aa
JH
13698case "$d_readlink" in
13699"$define")
c7aff470
NIS
13700 if $issymlink /proc/self/exe ; then
13701 $ls -l /proc/self/exe > reflect
51660ed5 13702 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 13703 echo "You have Linux-like /proc/self/exe."
92236451 13704 procselfexe='"/proc/self/exe"'
f24dbf84 13705 val="$define"
f24dbf84
JH
13706 fi
13707 fi
13708 if $issymlink /proc/curproc/file ; then
13709 $ls -l /proc/curproc/file > reflect
13710 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13711 echo "You have BSD-like /proc/curproc/file."
92236451 13712 procselfexe='"/proc/curproc/file"'
f24dbf84 13713 val="$define"
c7aff470 13714 fi
c7aff470 13715 fi
a33c94aa
JH
13716 ;;
13717esac
428dc699 13718$rm -f reflect
c7aff470
NIS
13719set d_procselfexe
13720eval $setvar
13721
263fee3f
JH
13722: see whether the pthread_atfork exists
13723$cat >try.c <<EOP
13724#include <pthread.h>
13725#include <stdio.h>
13726int main() {
13727#ifdef PTHREAD_ATFORK
13728 pthread_atfork(NULL,NULL,NULL);
13729#endif
13730}
13731EOP
13732
d6483fcc 13733: see if pthread_atfork exists
263fee3f
JH
13734set try -DPTHREAD_ATFORK
13735if eval $compile; then
13736 val="$define"
13737else
13738 val="$undef"
13739fi
13740case "$usethreads" in
13741$define)
13742 case "$val" in
13743 $define) echo 'pthread_atfork found.' >&4 ;;
13744 *) echo 'pthread_atfork NOT found.' >&4 ;;
13745 esac
13746esac
13747set d_pthread_atfork
13748eval $setvar
d6483fcc 13749
b4eb6b3d
JH
13750
13751: see whether the various POSIXish _yields exist
13752$cat >try.c <<EOP
13753#include <pthread.h>
13754#include <stdio.h>
13755int main() {
13756#ifdef SCHED_YIELD
13757 sched_yield();
13758#else
13759#ifdef PTHREAD_YIELD
13760 pthread_yield();
13761#else
13762#ifdef PTHREAD_YIELD_NULL
13763 pthread_yield(NULL);
13764#endif
13765#endif
13766#endif
13767}
13768EOP
13769: see if sched_yield exists
13770set try -DSCHED_YIELD
13771if eval $compile; then
13772 val="$define"
13773 sched_yield='sched_yield()'
13774else
13775 val="$undef"
13776fi
13777case "$usethreads" in
13778$define)
13779 case "$val" in
13780 $define) echo 'sched_yield() found.' >&4 ;;
13781 *) echo 'sched_yield() NOT found.' >&4 ;;
13782 esac
13783esac
10bc17b6
JH
13784set d_sched_yield
13785eval $setvar
b4eb6b3d 13786
10bc17b6
JH
13787: see if pthread_yield exists
13788set try -DPTHREAD_YIELD
13789if eval $compile; then
13790 val="$define"
13791 case "$sched_yield" in
13792 '') sched_yield='pthread_yield()' ;;
13793 esac
13794else
13795 set try -DPTHREAD_YIELD_NULL
13796 if eval $compile; then
13797 val="$define"
13798 case "$sched_yield" in
13799 '') sched_yield='pthread_yield(NULL)' ;;
13800 esac
13801 else
13802 val="$undef"
13803 fi
13804fi
13805case "$usethreads" in
13806$define)
13807 case "$val" in
13808 $define) echo 'pthread_yield() found.' >&4 ;;
13809 *) echo 'pthread_yield() NOT found.' >&4 ;;
13810 esac
13811 ;;
13812esac
13813set d_pthread_yield
13814eval $setvar
b4eb6b3d 13815
10bc17b6
JH
13816case "$sched_yield" in
13817'') sched_yield=undef ;;
13818esac
b4eb6b3d 13819
10bc17b6
JH
13820$rm -f try try.*
13821
13822: see if random_r exists
13823set random_r d_random_r
13824eval $inlibc
13825case "$d_random_r" in
13826"$define")
13827 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
13828 case "$d_random_r_proto:$usethreads" in
13829 ":define") d_random_r_proto=define
a48ec845
JH
13830 set d_random_r_proto random_r $hdrs
13831 eval $hasproto ;;
13832 *) ;;
13833 esac
13834 case "$d_random_r_proto" in
13835 define)
10bc17b6
JH
13836 case "$random_r_proto" in
13837 ''|0) try='int random_r(int*, struct random_data*);'
13838 ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13839 esac
13840 case "$random_r_proto" in
90e831dc 13841 ''|0) d_random_r=undef
10bc17b6 13842 random_r_proto=0
a48ec845 13843 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13844 * ) case "$random_r_proto" in
13845 REENTRANT_PROTO*) ;;
13846 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13847 esac
13848 echo "Prototype: $try" ;;
13849 esac
b4eb6b3d 13850 ;;
c18e646a
JH
13851 *) case "$usethreads" in
13852 define) echo "random_r has no prototype, not using it." >&4 ;;
13853 esac
90e831dc
SB
13854 d_random_r=undef
13855 random_r_proto=0
c18e646a 13856 ;;
a48ec845
JH
13857 esac
13858 ;;
10bc17b6 13859*) random_r_proto=0
b4eb6b3d
JH
13860 ;;
13861esac
13862
13863: see if readdir and friends exist
13864set readdir d_readdir
13865eval $inlibc
13866set seekdir d_seekdir
13867eval $inlibc
13868set telldir d_telldir
13869eval $inlibc
13870set rewinddir d_rewinddir
13871eval $inlibc
13872
10bc17b6
JH
13873: see if readdir64_r exists
13874set readdir64_r d_readdir64_r
13875eval $inlibc
13876case "$d_readdir64_r" in
13877"$define")
13878 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
13879 case "$d_readdir64_r_proto:$usethreads" in
13880 ":define") d_readdir64_r_proto=define
a48ec845
JH
13881 set d_readdir64_r_proto readdir64_r $hdrs
13882 eval $hasproto ;;
13883 *) ;;
13884 esac
13885 case "$d_readdir64_r_proto" in
13886 define)
10bc17b6
JH
13887 case "$readdir64_r_proto" in
13888 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13889 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13890 esac
13891 case "$readdir64_r_proto" in
13892 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13893 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13894 esac
13895 case "$readdir64_r_proto" in
90e831dc 13896 ''|0) d_readdir64_r=undef
10bc17b6 13897 readdir64_r_proto=0
a48ec845 13898 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13899 * ) case "$readdir64_r_proto" in
13900 REENTRANT_PROTO*) ;;
13901 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13902 esac
13903 echo "Prototype: $try" ;;
13904 esac
13905 ;;
c18e646a
JH
13906 *) case "$usethreads" in
13907 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13908 esac
90e831dc
SB
13909 d_readdir64_r=undef
13910 readdir64_r_proto=0
c18e646a 13911 ;;
a48ec845
JH
13912 esac
13913 ;;
10bc17b6
JH
13914*) readdir64_r_proto=0
13915 ;;
13916esac
13917
13918: see if readdir_r exists
13919set readdir_r d_readdir_r
13920eval $inlibc
13921case "$d_readdir_r" in
13922"$define")
13923 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
13924 case "$d_readdir_r_proto:$usethreads" in
13925 ":define") d_readdir_r_proto=define
a48ec845
JH
13926 set d_readdir_r_proto readdir_r $hdrs
13927 eval $hasproto ;;
13928 *) ;;
13929 esac
13930 case "$d_readdir_r_proto" in
13931 define)
10bc17b6
JH
13932 case "$readdir_r_proto" in
13933 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13934 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13935 esac
13936 case "$readdir_r_proto" in
13937 ''|0) try='int readdir_r(DIR*, struct dirent*);'
13938 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13939 esac
13940 case "$readdir_r_proto" in
90e831dc 13941 ''|0) d_readdir_r=undef
10bc17b6 13942 readdir_r_proto=0
a48ec845 13943 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13944 * ) case "$readdir_r_proto" in
13945 REENTRANT_PROTO*) ;;
13946 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13947 esac
13948 echo "Prototype: $try" ;;
13949 esac
13950 ;;
c18e646a
JH
13951 *) case "$usethreads" in
13952 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13953 esac
90e831dc
SB
13954 d_readdir_r=undef
13955 readdir_r_proto=0
c18e646a 13956 ;;
a48ec845
JH
13957 esac
13958 ;;
10bc17b6
JH
13959*) readdir_r_proto=0
13960 ;;
13961esac
13962
4e0554ec
JH
13963: see if readv exists
13964set readv d_readv
13965eval $inlibc
13966
13967: see if recvmsg exists
13968set recvmsg d_recvmsg
13969eval $inlibc
13970
b4eb6b3d
JH
13971: see if rename exists
13972set rename d_rename
13973eval $inlibc
13974
13975: see if rmdir exists
13976set rmdir d_rmdir
13977eval $inlibc
13978
13979: see if memory.h is available.
13980val=''
13981set memory.h val
13982eval $inhdr
13983
13984: See if it conflicts with string.h
13985case "$val" in
13986$define)
13987 case "$strings" in
13988 '') ;;
13989 *)
13990 $cppstdin $cppflags $cppminus < $strings > mem.h
13991 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13992 echo " "
13993 echo "We won't be including <memory.h>."
13994 val="$undef"
13995 fi
13996 $rm -f mem.h
13997 ;;
13998 esac
13999esac
14000set i_memory
14001eval $setvar
14002
14003: can bcopy handle overlapping blocks?
b6cc3bc4 14004echo " "
b4eb6b3d 14005val="$undef"
b6cc3bc4
AD
14006case "$d_memmove" in
14007"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14008*) case "$d_bcopy" in
14009 "$define")
14010 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14011 $cat >try.c <<EOCP
b4eb6b3d
JH
14012#$i_memory I_MEMORY
14013#$i_stdlib I_STDLIB
14014#$i_string I_STRING
14015#$i_unistd I_UNISTD
14016EOCP
14017 $cat >>try.c <<'EOCP'
14018#include <stdio.h>
14019#ifdef I_MEMORY
14020# include <memory.h>
14021#endif
14022#ifdef I_STDLIB
14023# include <stdlib.h>
14024#endif
14025#ifdef I_STRING
14026# include <string.h>
14027#else
14028# include <strings.h>
14029#endif
14030#ifdef I_UNISTD
14031# include <unistd.h> /* Needed for NetBSD */
14032#endif
14033int main()
14034{
14035char buf[128], abc[128];
14036char *b;
14037int len;
14038int off;
14039int align;
14040
b6cc3bc4
AD
14041/* Copy "abcde..." string to char abc[] so that gcc doesn't
14042 try to store the string in read-only memory. */
b4eb6b3d
JH
14043bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14044
14045for (align = 7; align >= 0; align--) {
14046 for (len = 36; len; len--) {
14047 b = buf+align;
14048 bcopy(abc, b, len);
14049 for (off = 1; off <= len; off++) {
14050 bcopy(b, b+off, len);
14051 bcopy(b+off, b, len);
14052 if (bcmp(b, abc, len))
14053 exit(1);
14054 }
14055 }
14056}
14057exit(0);
14058}
14059EOCP
b6cc3bc4
AD
14060 set try
14061 if eval $compile_ok; then
14062 if ./try 2>/dev/null; then
14063 echo "Yes, it can."
14064 val="$define"
14065 else
14066 echo "It can't, sorry."
14067 fi
b4eb6b3d 14068 else
b6cc3bc4 14069 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14070 fi
b6cc3bc4
AD
14071 ;;
14072 esac
14073 $rm -f try.* try core
b4eb6b3d
JH
14074 ;;
14075esac
b4eb6b3d
JH
14076set d_safebcpy
14077eval $setvar
14078
14079: can memcpy handle overlapping blocks?
b6cc3bc4 14080echo " "
b4eb6b3d 14081val="$undef"
b6cc3bc4
AD
14082case "$d_memmove" in
14083"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14084*) case "$d_memcpy" in
14085 "$define")
14086 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14087 $cat >try.c <<EOCP
b4eb6b3d
JH
14088#$i_memory I_MEMORY
14089#$i_stdlib I_STDLIB
14090#$i_string I_STRING
14091#$i_unistd I_UNISTD
14092EOCP
14093 $cat >>try.c <<'EOCP'
14094#include <stdio.h>
14095#ifdef I_MEMORY
14096# include <memory.h>
14097#endif
14098#ifdef I_STDLIB
14099# include <stdlib.h>
14100#endif
14101#ifdef I_STRING
14102# include <string.h>
14103#else
14104# include <strings.h>
14105#endif
14106#ifdef I_UNISTD
14107# include <unistd.h> /* Needed for NetBSD */
14108#endif
14109int main()
14110{
14111char buf[128], abc[128];
14112char *b;
14113int len;
14114int off;
14115int align;
14116
14117/* Copy "abcde..." string to char abc[] so that gcc doesn't
14118 try to store the string in read-only memory. */
14119memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14120
14121for (align = 7; align >= 0; align--) {
14122 for (len = 36; len; len--) {
14123 b = buf+align;
14124 memcpy(b, abc, len);
14125 for (off = 1; off <= len; off++) {
14126 memcpy(b+off, b, len);
14127 memcpy(b, b+off, len);
14128 if (memcmp(b, abc, len))
14129 exit(1);
14130 }
14131 }
14132}
14133exit(0);
14134}
14135EOCP
b6cc3bc4
AD
14136 set try
14137 if eval $compile_ok; then
14138 if ./try 2>/dev/null; then
14139 echo "Yes, it can."
14140 val="$define"
14141 else
14142 echo "It can't, sorry."
14143 fi
b4eb6b3d 14144 else
b6cc3bc4 14145 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14146 fi
b6cc3bc4
AD
14147 ;;
14148 esac
14149 $rm -f try.* try core
b4eb6b3d
JH
14150 ;;
14151esac
b4eb6b3d
JH
14152set d_safemcpy
14153eval $setvar
14154
14155: can memcmp be trusted to compare relative magnitude?
14156val="$undef"
14157case "$d_memcmp" in
14158"$define")
14159 echo " "
14160 echo "Checking if your memcmp() can compare relative magnitude..." >&4
14161 $cat >try.c <<EOCP
14162#$i_memory I_MEMORY
14163#$i_stdlib I_STDLIB
14164#$i_string I_STRING
14165#$i_unistd I_UNISTD
14166EOCP
14167 $cat >>try.c <<'EOCP'
14168#include <stdio.h>
14169#ifdef I_MEMORY
14170# include <memory.h>
14171#endif
14172#ifdef I_STDLIB
14173# include <stdlib.h>
14174#endif
14175#ifdef I_STRING
14176# include <string.h>
14177#else
14178# include <strings.h>
14179#endif
14180#ifdef I_UNISTD
14181# include <unistd.h> /* Needed for NetBSD */
14182#endif
14183int main()
14184{
14185char a = -1;
14186char b = 0;
14187if ((a < b) && memcmp(&a, &b, 1) < 0)
14188 exit(1);
14189exit(0);
14190}
14191EOCP
14192 set try
14193 if eval $compile_ok; then
5440bc8e 14194 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
14195 echo "Yes, it can."
14196 val="$define"
14197 else
14198 echo "No, it can't (it uses signed chars)."
14199 fi
14200 else
14201 echo "(I can't compile the test program, so we'll assume not...)"
14202 fi
14203 ;;
14204esac
14205$rm -f try.* try core
14206set d_sanemcmp
14207eval $setvar
14208
ef9f17be
JH
14209: see if prototype for sbrk is available
14210echo " "
14211set d_sbrkproto sbrk $i_unistd unistd.h
14212eval $hasproto
14213
b4eb6b3d
JH
14214: see if select exists
14215set select d_select
14216eval $inlibc
14217
14218: see if semctl exists
14219set semctl d_semctl
14220eval $inlibc
14221
14222: see if semget exists
14223set semget d_semget
14224eval $inlibc
14225
14226: see if semop exists
14227set semop d_semop
14228eval $inlibc
14229
14230: see how much of the 'sem*(2)' library is present.
14231h_sem=true
14232echo " "
14233case "$d_semctl$d_semget$d_semop" in
14234*"$undef"*) h_sem=false;;
14235esac
14236case "$osname" in
14237freebsd)
14238 case "`ipcs 2>&1`" in
14239 "SVID messages"*"not configured"*)
14240 echo "Your $osname does not have the sem*(2) configured." >&4
14241 h_sem=false
14242 val="$undef"
14243 set semctl d_semctl
14244 eval $setvar
14245 set semget d_semget
14246 eval $setvar
14247 set semop d_semop
14248 eval $setvar
14249 ;;
14250 esac
14251 ;;
14252esac
14253: we could also check for sys/ipc.h ...
14254if $h_sem && $test `./findhdr sys/sem.h`; then
14255 echo "You have the full sem*(2) library." >&4
14256 val="$define"
14257else
14258 echo "You don't have the full sem*(2) library." >&4
14259 val="$undef"
14260fi
14261set d_sem
14262eval $setvar
14263
14264: see whether sys/sem.h defines union semun
14265echo " "
14266$cat > try.c <<'END'
14267#include <sys/types.h>
14268#include <sys/ipc.h>
14269#include <sys/sem.h>
14270int main () { union semun semun; semun.buf = 0; }
14271END
14272set try
14273if eval $compile; then
14274 echo "You have union semun in <sys/sem.h>." >&4
14275 val="$define"
14276else
14277 echo "You do not have union semun in <sys/sem.h>." >&4
14278 val="$undef"
14279fi
14280$rm -f try try.c try.h
14281set d_union_semun
14282eval $setvar
14283
14284: see how to do semctl IPC_STAT
14285case "$d_sem" in
14286$define)
14287 : see whether semctl IPC_STAT can use union semun
14288 echo " "
14289 $cat > try.h <<END
14290#ifndef S_IRUSR
14291# ifdef S_IREAD
14292# define S_IRUSR S_IREAD
14293# define S_IWUSR S_IWRITE
14294# define S_IXUSR S_IEXEC
14295# else
14296# define S_IRUSR 0400
14297# define S_IWUSR 0200
14298# define S_IXUSR 0100
14299# endif
14300# define S_IRGRP (S_IRUSR>>3)
14301# define S_IWGRP (S_IWUSR>>3)
14302# define S_IXGRP (S_IXUSR>>3)
14303# define S_IROTH (S_IRUSR>>6)
14304# define S_IWOTH (S_IWUSR>>6)
14305# define S_IXOTH (S_IXUSR>>6)
14306#endif
14307#ifndef S_IRWXU
14308# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14309# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14310# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14311#endif
14312END
14313
14314 $cat > try.c <<END
14315#include <sys/types.h>
14316#include <sys/ipc.h>
14317#include <sys/sem.h>
14318#include <sys/stat.h>
14319#include <stdio.h>
14320#include <errno.h>
14321#include "try.h"
14322#ifndef errno
14323extern int errno;
14324#endif
14325#$d_union_semun HAS_UNION_SEMUN
14326int main() {
14327 union semun
14328#ifndef HAS_UNION_SEMUN
14329 {
14330 int val;
14331 struct semid_ds *buf;
14332 unsigned short *array;
14333 }
14334#endif
14335 arg;
14336 int sem, st;
14337
14338#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14339 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14340 if (sem > -1) {
14341 struct semid_ds argbuf;
14342 arg.buf = &argbuf;
14343# ifdef IPC_STAT
14344 st = semctl(sem, 0, IPC_STAT, arg);
14345 if (st == 0)
14346 printf("semun\n");
14347 else
14348# endif /* IPC_STAT */
14349 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14350# ifdef IPC_RMID
14351 if (semctl(sem, 0, IPC_RMID, arg) != 0)
14352# endif /* IPC_RMID */
14353 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14354 } else
14355#endif /* IPC_PRIVATE && ... */
14356 printf("semget failed: errno = %d\n", errno);
14357 return 0;
14358}
14359END
14360 val="$undef"
14361 set try
14362 if eval $compile; then
5440bc8e 14363 xxx=`$run ./try`
b4eb6b3d
JH
14364 case "$xxx" in
14365 semun) val="$define" ;;
14366 esac
14367 fi
14368 $rm -f try try.c
14369 set d_semctl_semun
14370 eval $setvar
14371 case "$d_semctl_semun" in
14372 $define)
14373 echo "You can use union semun for semctl IPC_STAT." >&4
14374 also='also'
14375 ;;
14376 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
14377 also=''
14378 ;;
14379 esac
14380
14381 : see whether semctl IPC_STAT can use struct semid_ds pointer
14382 $cat > try.c <<'END'
14383#include <sys/types.h>
14384#include <sys/ipc.h>
14385#include <sys/sem.h>
14386#include <sys/stat.h>
14387#include "try.h"
14388#include <stdio.h>
14389#include <errno.h>
14390#ifndef errno
14391extern int errno;
14392#endif
14393int main() {
14394 struct semid_ds arg;
14395 int sem, st;
14396
14397#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14398 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14399 if (sem > -1) {
14400# ifdef IPC_STAT
14401 st = semctl(sem, 0, IPC_STAT, &arg);
14402 if (st == 0)
14403 printf("semid_ds\n");
14404 else
14405# endif /* IPC_STAT */
14406 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14407# ifdef IPC_RMID
14408 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14409# endif /* IPC_RMID */
14410 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14411 } else
14412#endif /* IPC_PRIVATE && ... */
14413 printf("semget failed: errno = %d\n", errno);
14414
14415 return 0;
14416}
14417END
14418 val="$undef"
14419 set try
14420 if eval $compile; then
5440bc8e 14421 xxx=`$run ./try`
b4eb6b3d
JH
14422 case "$xxx" in
14423 semid_ds) val="$define" ;;
14424 esac
14425 fi
14426 $rm -f try try.c
14427 set d_semctl_semid_ds
14428 eval $setvar
14429 case "$d_semctl_semid_ds" in
14430 $define)
14431 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14432 ;;
14433 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14434 ;;
14435 esac
14436 $rm -f try.h
14437 ;;
14438*) val="$undef"
14439
14440 # We do not have the full sem*(2) library, so assume we can not
14441 # use either.
14442
14443 set d_semctl_semun
14444 eval $setvar
14445
14446 set d_semctl_semid_ds
14447 eval $setvar
14448 ;;
14449esac
14450
4e0554ec
JH
14451: see if sendmsg exists
14452set sendmsg d_sendmsg
14453eval $inlibc
14454
b4eb6b3d
JH
14455: see if setegid exists
14456set setegid d_setegid
14457eval $inlibc
14458
14459: see if seteuid exists
14460set seteuid d_seteuid
14461eval $inlibc
14462
14463: see if setgrent exists
14464set setgrent d_setgrent
14465eval $inlibc
14466
10bc17b6
JH
14467: see if setgrent_r exists
14468set setgrent_r d_setgrent_r
14469eval $inlibc
14470case "$d_setgrent_r" in
14471"$define")
14472 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
14473 case "$d_setgrent_r_proto:$usethreads" in
14474 ":define") d_setgrent_r_proto=define
a48ec845
JH
14475 set d_setgrent_r_proto setgrent_r $hdrs
14476 eval $hasproto ;;
14477 *) ;;
14478 esac
14479 case "$d_setgrent_r_proto" in
14480 define)
10bc17b6
JH
14481 case "$setgrent_r_proto" in
14482 ''|0) try='int setgrent_r(FILE**);'
14483 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14484 esac
14485 case "$setgrent_r_proto" in
14486 ''|0) try='void setgrent_r(FILE**);'
14487 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14488 esac
14489 case "$setgrent_r_proto" in
90e831dc 14490 ''|0) d_setgrent_r=undef
10bc17b6 14491 setgrent_r_proto=0
a48ec845 14492 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14493 * ) case "$setgrent_r_proto" in
14494 REENTRANT_PROTO*) ;;
14495 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14496 esac
14497 echo "Prototype: $try" ;;
14498 esac
14499 ;;
c18e646a
JH
14500 *) case "$usethreads" in
14501 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14502 esac
90e831dc
SB
14503 d_setgrent_r=undef
14504 setgrent_r_proto=0
c18e646a 14505 ;;
a48ec845
JH
14506 esac
14507 ;;
10bc17b6
JH
14508*) setgrent_r_proto=0
14509 ;;
14510esac
14511
b4eb6b3d
JH
14512: see if sethostent exists
14513set sethostent d_sethent
14514eval $inlibc
14515
10bc17b6
JH
14516: see if sethostent_r exists
14517set sethostent_r d_sethostent_r
14518eval $inlibc
14519case "$d_sethostent_r" in
14520"$define")
14521 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14522 case "$d_sethostent_r_proto:$usethreads" in
14523 ":define") d_sethostent_r_proto=define
a48ec845
JH
14524 set d_sethostent_r_proto sethostent_r $hdrs
14525 eval $hasproto ;;
14526 *) ;;
14527 esac
14528 case "$d_sethostent_r_proto" in
14529 define)
10bc17b6
JH
14530 case "$sethostent_r_proto" in
14531 ''|0) try='int sethostent_r(int, struct hostent_data*);'
14532 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14533 esac
14534 case "$sethostent_r_proto" in
14535 ''|0) try='void sethostent_r(int, struct hostent_data*);'
14536 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14537 esac
14538 case "$sethostent_r_proto" in
90e831dc 14539 ''|0) d_sethostent_r=undef
10bc17b6 14540 sethostent_r_proto=0
a48ec845 14541 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14542 * ) case "$sethostent_r_proto" in
14543 REENTRANT_PROTO*) ;;
14544 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14545 esac
14546 echo "Prototype: $try" ;;
14547 esac
14548 ;;
c18e646a
JH
14549 *) case "$usethreads" in
14550 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14551 esac
90e831dc
SB
14552 d_sethostent_r=undef
14553 sethostent_r_proto=0
c18e646a 14554 ;;
a48ec845
JH
14555 esac
14556 ;;
10bc17b6
JH
14557*) sethostent_r_proto=0
14558 ;;
14559esac
14560
4e0554ec
JH
14561: see if setitimer exists
14562set setitimer d_setitimer
14563eval $inlibc
14564
b4eb6b3d
JH
14565: see if setlinebuf exists
14566set setlinebuf d_setlinebuf
14567eval $inlibc
14568
14569: see if setlocale exists
14570set setlocale d_setlocale
14571eval $inlibc
14572
10bc17b6
JH
14573: see if locale.h is available
14574set locale.h i_locale
14575eval $inhdr
14576
14577: see if setlocale_r exists
14578set setlocale_r d_setlocale_r
14579eval $inlibc
14580case "$d_setlocale_r" in
14581"$define")
14582 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
14583 case "$d_setlocale_r_proto:$usethreads" in
14584 ":define") d_setlocale_r_proto=define
a48ec845
JH
14585 set d_setlocale_r_proto setlocale_r $hdrs
14586 eval $hasproto ;;
14587 *) ;;
14588 esac
14589 case "$d_setlocale_r_proto" in
14590 define)
10bc17b6
JH
14591 case "$setlocale_r_proto" in
14592 ''|0) try='int setlocale_r(int, const char*, char*, int);'
14593 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14594 esac
14595 case "$setlocale_r_proto" in
90e831dc 14596 ''|0) d_setlocale_r=undef
10bc17b6 14597 setlocale_r_proto=0
a48ec845 14598 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14599 * ) case "$setlocale_r_proto" in
14600 REENTRANT_PROTO*) ;;
14601 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14602 esac
14603 echo "Prototype: $try" ;;
14604 esac
14605 ;;
c18e646a
JH
14606 *) case "$usethreads" in
14607 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14608 esac
90e831dc
SB
14609 d_setlocale_r=undef
14610 setlocale_r_proto=0
c18e646a 14611 ;;
a48ec845
JH
14612 esac
14613 ;;
10bc17b6
JH
14614*) setlocale_r_proto=0
14615 ;;
14616esac
14617
b4eb6b3d
JH
14618: see if setnetent exists
14619set setnetent d_setnent
14620eval $inlibc
14621
10bc17b6
JH
14622: see if setnetent_r exists
14623set setnetent_r d_setnetent_r
14624eval $inlibc
14625case "$d_setnetent_r" in
14626"$define")
14627 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14628 case "$d_setnetent_r_proto:$usethreads" in
14629 ":define") d_setnetent_r_proto=define
a48ec845
JH
14630 set d_setnetent_r_proto setnetent_r $hdrs
14631 eval $hasproto ;;
14632 *) ;;
14633 esac
14634 case "$d_setnetent_r_proto" in
14635 define)
10bc17b6
JH
14636 case "$setnetent_r_proto" in
14637 ''|0) try='int setnetent_r(int, struct netent_data*);'
14638 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14639 esac
14640 case "$setnetent_r_proto" in
14641 ''|0) try='void setnetent_r(int, struct netent_data*);'
14642 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14643 esac
14644 case "$setnetent_r_proto" in
90e831dc 14645 ''|0) d_setnetent_r=undef
10bc17b6 14646 setnetent_r_proto=0
a48ec845 14647 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14648 * ) case "$setnetent_r_proto" in
14649 REENTRANT_PROTO*) ;;
14650 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14651 esac
14652 echo "Prototype: $try" ;;
14653 esac
14654 ;;
c18e646a
JH
14655 *) case "$usethreads" in
14656 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14657 esac
90e831dc
SB
14658 d_setnetent_r=undef
14659 setnetent_r_proto=0
c18e646a 14660 ;;
a48ec845
JH
14661 esac
14662 ;;
10bc17b6
JH
14663*) setnetent_r_proto=0
14664 ;;
14665esac
14666
b4eb6b3d
JH
14667: see if setprotoent exists
14668set setprotoent d_setpent
14669eval $inlibc
14670
14671: see if setpgid exists
14672set setpgid d_setpgid
14673eval $inlibc
14674
14675: see if setpgrp2 exists
14676set setpgrp2 d_setpgrp2
14677eval $inlibc
14678
14679: see if setpriority exists
14680set setpriority d_setprior
14681eval $inlibc
14682
14683: see if setproctitle exists
14684set setproctitle d_setproctitle
14685eval $inlibc
14686
10bc17b6
JH
14687: see if setprotoent_r exists
14688set setprotoent_r d_setprotoent_r
14689eval $inlibc
14690case "$d_setprotoent_r" in
14691"$define")
14692 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14693 case "$d_setprotoent_r_proto:$usethreads" in
14694 ":define") d_setprotoent_r_proto=define
a48ec845
JH
14695 set d_setprotoent_r_proto setprotoent_r $hdrs
14696 eval $hasproto ;;
14697 *) ;;
14698 esac
14699 case "$d_setprotoent_r_proto" in
14700 define)
10bc17b6
JH
14701 case "$setprotoent_r_proto" in
14702 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14703 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14704 esac
14705 case "$setprotoent_r_proto" in
14706 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14707 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14708 esac
14709 case "$setprotoent_r_proto" in
90e831dc 14710 ''|0) d_setprotoent_r=undef
10bc17b6 14711 setprotoent_r_proto=0
a48ec845 14712 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14713 * ) case "$setprotoent_r_proto" in
14714 REENTRANT_PROTO*) ;;
14715 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14716 esac
14717 echo "Prototype: $try" ;;
14718 esac
14719 ;;
c18e646a
JH
14720 *) case "$usethreads" in
14721 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14722 esac
90e831dc
SB
14723 d_setprotoent_r=undef
14724 setprotoent_r_proto=0
c18e646a 14725 ;;
a48ec845
JH
14726 esac
14727 ;;
10bc17b6
JH
14728*) setprotoent_r_proto=0
14729 ;;
14730esac
14731
b4eb6b3d
JH
14732: see if setpwent exists
14733set setpwent d_setpwent
14734eval $inlibc
14735
10bc17b6
JH
14736: see if setpwent_r exists
14737set setpwent_r d_setpwent_r
14738eval $inlibc
14739case "$d_setpwent_r" in
14740"$define")
14741 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14742 case "$d_setpwent_r_proto:$usethreads" in
14743 ":define") d_setpwent_r_proto=define
a48ec845
JH
14744 set d_setpwent_r_proto setpwent_r $hdrs
14745 eval $hasproto ;;
14746 *) ;;
14747 esac
14748 case "$d_setpwent_r_proto" in
14749 define)
10bc17b6
JH
14750 case "$setpwent_r_proto" in
14751 ''|0) try='int setpwent_r(FILE**);'
14752 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14753 esac
14754 case "$setpwent_r_proto" in
14755 ''|0) try='void setpwent_r(FILE**);'
14756 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14757 esac
14758 case "$setpwent_r_proto" in
90e831dc 14759 ''|0) d_setpwent_r=undef
10bc17b6 14760 setpwent_r_proto=0
a48ec845 14761 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14762 * ) case "$setpwent_r_proto" in
14763 REENTRANT_PROTO*) ;;
14764 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14765 esac
14766 echo "Prototype: $try" ;;
14767 esac
14768 ;;
c18e646a
JH
14769 *) case "$usethreads" in
14770 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14771 esac
90e831dc
SB
14772 d_setpwent_r=undef
14773 setpwent_r_proto=0
c18e646a 14774 ;;
a48ec845
JH
14775 esac
14776 ;;
10bc17b6
JH
14777*) setpwent_r_proto=0
14778 ;;
14779esac
14780
b4eb6b3d
JH
14781: see if setregid exists
14782set setregid d_setregid
14783eval $inlibc
14784set setresgid d_setresgid
14785eval $inlibc
14786
14787: see if setreuid exists
14788set setreuid d_setreuid
14789eval $inlibc
14790set setresuid d_setresuid
14791eval $inlibc
14792
14793: see if setrgid exists
14794set setrgid d_setrgid
14795eval $inlibc
14796
14797: see if setruid exists
14798set setruid d_setruid
14799eval $inlibc
14800
14801: see if setservent exists
14802set setservent d_setsent
14803eval $inlibc
14804
10bc17b6
JH
14805: see if setservent_r exists
14806set setservent_r d_setservent_r
14807eval $inlibc
14808case "$d_setservent_r" in
14809"$define")
14810 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14811 case "$d_setservent_r_proto:$usethreads" in
14812 ":define") d_setservent_r_proto=define
a48ec845
JH
14813 set d_setservent_r_proto setservent_r $hdrs
14814 eval $hasproto ;;
14815 *) ;;
14816 esac
14817 case "$d_setservent_r_proto" in
14818 define)
10bc17b6
JH
14819 case "$setservent_r_proto" in
14820 ''|0) try='int setservent_r(int, struct servent_data*);'
14821 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14822 esac
14823 case "$setservent_r_proto" in
14824 ''|0) try='void setservent_r(int, struct servent_data*);'
14825 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14826 esac
14827 case "$setservent_r_proto" in
90e831dc 14828 ''|0) d_setservent_r=undef
10bc17b6 14829 setservent_r_proto=0
a48ec845 14830 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14831 * ) case "$setservent_r_proto" in
14832 REENTRANT_PROTO*) ;;
14833 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14834 esac
14835 echo "Prototype: $try" ;;
14836 esac
14837 ;;
c18e646a
JH
14838 *) case "$usethreads" in
14839 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14840 esac
90e831dc
SB
14841 d_setservent_r=undef
14842 setservent_r_proto=0
c18e646a 14843 ;;
a48ec845
JH
14844 esac
14845 ;;
10bc17b6
JH
14846*) setservent_r_proto=0
14847 ;;
14848esac
14849
b4eb6b3d
JH
14850: see if setsid exists
14851set setsid d_setsid
14852eval $inlibc
14853
14854: see if setvbuf exists
14855set setvbuf d_setvbuf
14856eval $inlibc
14857
14858: see if sfio.h is available
14859set sfio.h i_sfio
14860eval $inhdr
14861
14862
14863: see if sfio library is available
14864case "$i_sfio" in
14865$define)
14866 val=''
14867 set sfreserve val
14868 eval $inlibc
14869 ;;
14870*)
14871 val="$undef"
14872 ;;
14873esac
14874: Ok, but do we want to use it.
14875case "$val" in
14876$define)
14877 case "$usesfio" in
14878 true|$define|[yY]*) dflt='y';;
14879 *) dflt='n';;
14880 esac
14881 echo "$package can use the sfio library, but it is experimental."
14882 case "$useperlio" in
14883 "$undef")
14884 echo "For sfio also the PerlIO abstraction layer is needed."
14885 echo "Earlier you said you wouldn't want that."
14886 ;;
14887 esac
14888 rp="You seem to have sfio available, do you want to try using it?"
14889 . ./myread
14890 case "$ans" in
14891 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
14892 useperlio="$define"
14893 val="$define"
14894 ;;
14895 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
14896 val="$undef"
b4eb6b3d
JH
14897 ;;
14898 esac
14899 ;;
14900*) case "$usesfio" in
14901 true|$define|[yY]*)
14902 echo "Sorry, cannot find sfio on this machine." >&4
14903 echo "Ignoring your setting of usesfio=$usesfio." >&4
14904 val="$undef"
14905 ;;
14906 esac
14907 ;;
14908esac
14909set d_sfio
14910eval $setvar
14911case "$d_sfio" in
14912$define) usesfio='true';;
14913*) usesfio='false';;
14914esac
3659ebf1
JH
14915case "$d_sfio" in
14916$define) ;;
14917*) : Remove sfio from list of libraries to use
7483f793
JH
14918 case "$libs" in
14919 *-lsfio*)
14920 echo "Removing unneeded -lsfio from library list" >&4
14921 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14922 shift
14923 libs="$*"
14924 echo "libs = $libs" >&4
14925 ;;
14926 esac
3659ebf1
JH
14927;;
14928esac
14929
b4eb6b3d
JH
14930
14931: see if shmctl exists
14932set shmctl d_shmctl
14933eval $inlibc
14934
14935: see if shmget exists
14936set shmget d_shmget
14937eval $inlibc
14938
14939: see if shmat exists
14940set shmat d_shmat
14941eval $inlibc
14942: see what shmat returns
14943case "$d_shmat" in
14944"$define")
14945 $cat >shmat.c <<'END'
14946#include <sys/shm.h>
14947void *shmat();
14948END
14949 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14950 shmattype='void *'
14951 else
14952 shmattype='char *'
14953 fi
14954 echo "and it returns ($shmattype)." >&4
14955 : see if a prototype for shmat is available
14956 xxx=`./findhdr sys/shm.h`
14957 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14958 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14959 val="$define"
14960 else
14961 val="$undef"
14962 fi
14963 $rm -f shmat.[co]
14964 ;;
14965*)
14966 val="$undef"
14967 ;;
14968esac
14969set d_shmatprototype
14970eval $setvar
14971
14972: see if shmdt exists
14973set shmdt d_shmdt
14974eval $inlibc
14975
14976: see how much of the 'shm*(2)' library is present.
14977h_shm=true
14978echo " "
14979case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14980*"$undef"*) h_shm=false;;
14981esac
14982case "$osname" in
14983freebsd)
14984 case "`ipcs 2>&1`" in
14985 "SVID shared memory"*"not configured"*)
14986 echo "Your $osname does not have the shm*(2) configured." >&4
14987 h_shm=false
14988 val="$undef"
14989 set shmctl d_shmctl
14990 evat $setvar
14991 set shmget d_shmget
14992 evat $setvar
14993 set shmat d_shmat
14994 evat $setvar
14995 set shmdt d_shmdt
14996 evat $setvar
14997 ;;
14998 esac
14999 ;;
15000esac
15001: we could also check for sys/ipc.h ...
15002if $h_shm && $test `./findhdr sys/shm.h`; then
15003 echo "You have the full shm*(2) library." >&4
15004 val="$define"
15005else
15006 echo "You don't have the full shm*(2) library." >&4
15007 val="$undef"
15008fi
15009set d_shm
15010eval $setvar
15011
15012echo " "
15013: see if we have sigaction
15014if set sigaction val -f d_sigaction; eval $csym; $val; then
15015 echo 'sigaction() found.' >&4
15016 $cat > try.c <<'EOP'
15017#include <stdio.h>
15018#include <sys/types.h>
15019#include <signal.h>
15020int main()
15021{
15022 struct sigaction act, oact;
15023 act.sa_flags = 0;
15024 oact.sa_handler = 0;
15025 /* so that act and oact are used */
15026 exit(act.sa_flags == 0 && oact.sa_handler == 0);
15027}
15028EOP
15029 set try
15030 if eval $compile_ok; then
15031 val="$define"
15032 else
15033 echo "But you don't seem to have a useable struct sigaction." >&4
15034 val="$undef"
15035 fi
15036else
15037 echo 'sigaction NOT found.' >&4
15038 val="$undef"
15039fi
15040set d_sigaction; eval $setvar
15041$rm -f try try$_o try.c
15042
983dbef6
JH
15043: see if sigprocmask exists
15044set sigprocmask d_sigprocmask
15045eval $inlibc
15046
b4eb6b3d
JH
15047: see if sigsetjmp exists
15048echo " "
15049case "$d_sigsetjmp" in
15050'')
15051 $cat >try.c <<'EOP'
15052#include <setjmp.h>
15053sigjmp_buf env;
15054int set = 1;
15055int main()
15056{
15057 if (sigsetjmp(env,1))
15058 exit(set);
15059 set = 0;
15060 siglongjmp(env, 1);
15061 exit(1);
15062}
15063EOP
15064 set try
15065 if eval $compile; then
5440bc8e 15066 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
15067 echo "POSIX sigsetjmp found." >&4
15068 val="$define"
15069 else
15070 $cat >&4 <<EOM
15071Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15072I'll ignore them.
15073EOM
15074 val="$undef"
15075 fi
15076 else
15077 echo "sigsetjmp not found." >&4
15078 val="$undef"
15079 fi
15080 ;;
15081*) val="$d_sigsetjmp"
15082 case "$d_sigsetjmp" in
15083 $define) echo "POSIX sigsetjmp found." >&4;;
15084 $undef) echo "sigsetjmp not found." >&4;;
15085 esac
15086 ;;
15087esac
15088set d_sigsetjmp
15089eval $setvar
15090$rm -f try.c try
15091
49a78c82
JH
15092: see if sockatmark exists
15093set sockatmark d_sockatmark
15094eval $inlibc
15095
2ef53570
JH
15096: see if prototype for sockatmark is available
15097echo " "
15098set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15099eval $hasproto
15100
b4eb6b3d
JH
15101: see if socks5_init exists
15102set socks5_init d_socks5_init
15103eval $inlibc
15104
10bc17b6
JH
15105: see if srand48_r exists
15106set srand48_r d_srand48_r
15107eval $inlibc
15108case "$d_srand48_r" in
15109"$define")
15110 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15111 case "$d_srand48_r_proto:$usethreads" in
15112 ":define") d_srand48_r_proto=define
a48ec845
JH
15113 set d_srand48_r_proto srand48_r $hdrs
15114 eval $hasproto ;;
15115 *) ;;
15116 esac
15117 case "$d_srand48_r_proto" in
15118 define)
10bc17b6
JH
15119 case "$srand48_r_proto" in
15120 ''|0) try='int srand48_r(long, struct drand48_data*);'
15121 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15122 esac
15123 case "$srand48_r_proto" in
90e831dc 15124 ''|0) d_srand48_r=undef
10bc17b6 15125 srand48_r_proto=0
a48ec845 15126 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15127 * ) case "$srand48_r_proto" in
15128 REENTRANT_PROTO*) ;;
15129 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15130 esac
15131 echo "Prototype: $try" ;;
15132 esac
15133 ;;
c18e646a
JH
15134 *) case "$usethreads" in
15135 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15136 esac
90e831dc
SB
15137 d_srand48_r=undef
15138 srand48_r_proto=0
c18e646a 15139 ;;
a48ec845
JH
15140 esac
15141 ;;
10bc17b6
JH
15142*) srand48_r_proto=0
15143 ;;
15144esac
15145
15146: see if srandom_r exists
15147set srandom_r d_srandom_r
15148eval $inlibc
15149case "$d_srandom_r" in
15150"$define")
15151 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15152 case "$d_srandom_r_proto:$usethreads" in
15153 ":define") d_srandom_r_proto=define
a48ec845
JH
15154 set d_srandom_r_proto srandom_r $hdrs
15155 eval $hasproto ;;
15156 *) ;;
15157 esac
15158 case "$d_srandom_r_proto" in
15159 define)
10bc17b6
JH
15160 case "$srandom_r_proto" in
15161 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15162 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15163 esac
15164 case "$srandom_r_proto" in
90e831dc 15165 ''|0) d_srandom_r=undef
10bc17b6 15166 srandom_r_proto=0
a48ec845 15167 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15168 * ) case "$srandom_r_proto" in
15169 REENTRANT_PROTO*) ;;
15170 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15171 esac
15172 echo "Prototype: $try" ;;
15173 esac
15174 ;;
c18e646a
JH
15175 *) case "$usethreads" in
15176 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15177 esac
90e831dc
SB
15178 d_srandom_r=undef
15179 srandom_r_proto=0
c18e646a 15180 ;;
a48ec845
JH
15181 esac
15182 ;;
10bc17b6
JH
15183*) srandom_r_proto=0
15184 ;;
15185esac
15186
eef837ea
JH
15187: see if prototype for setresgid is available
15188echo " "
15189set d_sresgproto setresgid $i_unistd unistd.h
15190eval $hasproto
15191
640374d0
JH
15192: see if prototype for setresuid is available
15193echo " "
15194set d_sresuproto setresuid $i_unistd unistd.h
15195eval $hasproto
15196
b4eb6b3d
JH
15197: see if sys/stat.h is available
15198set sys/stat.h i_sysstat
15199eval $inhdr
15200
15201
15202: see if stat knows about block sizes
15203echo " "
15204echo "Checking to see if your struct stat has st_blocks field..." >&4
15205set d_statblks stat st_blocks $i_sysstat sys/stat.h
15206eval $hasfield
15207
15208
15209: see if this is a sys/vfs.h system
15210set sys/vfs.h i_sysvfs
15211eval $inhdr
15212
15213
15214: see if this is a sys/statfs.h system
15215set sys/statfs.h i_sysstatfs
15216eval $inhdr
15217
15218
15219echo " "
15220echo "Checking to see if your system supports struct statfs..." >&4
15221set 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
15222eval $hasstruct
15223case "$d_statfs_s" in
15224"$define") echo "Yes, it does." ;;
15225*) echo "No, it doesn't." ;;
15226esac
15227
15228
15229
15230: see if struct statfs knows about f_flags
15231case "$d_statfs_s" in
15232define)
15233 echo " "
15234 echo "Checking to see if your struct statfs has f_flags field..." >&4
15235 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
15236 eval $hasfield
15237 ;;
15238*) val="$undef"
15239 set d_statfs_f_flags
15240 eval $setvar
15241 ;;
15242esac
15243case "$d_statfs_f_flags" in
15244"$define") echo "Yes, it does." ;;
15245*) echo "No, it doesn't." ;;
15246esac
15247
15248: see if _ptr and _cnt from stdio act std
15249echo " "
80f36755
NC
15250
15251if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15252 echo "(Looks like you have stdio.h from BSD.)"
15253 case "$stdio_ptr" in
15254 '') stdio_ptr='((fp)->_p)'
15255 ptr_lval=$define
15256 ;;
15257 *) ptr_lval=$d_stdio_ptr_lval;;
15258 esac
15259 case "$stdio_cnt" in
15260 '') stdio_cnt='((fp)->_r)'
15261 cnt_lval=$define
15262 ;;
15263 *) cnt_lval=$d_stdio_cnt_lval;;
15264 esac
15265 case "$stdio_base" in
15266 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15267 esac
15268 case "$stdio_bufsiz" in
15269 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15270 esac
15271elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
15272 echo "(Looks like you have stdio.h from Linux.)"
15273 case "$stdio_ptr" in
15274 '') stdio_ptr='((fp)->_IO_read_ptr)'
15275 ptr_lval=$define
15276 ;;
15277 *) ptr_lval=$d_stdio_ptr_lval;;
15278 esac
15279 case "$stdio_cnt" in
15280 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15281 cnt_lval=$undef
15282 ;;
15283 *) cnt_lval=$d_stdio_cnt_lval;;
15284 esac
15285 case "$stdio_base" in
15286 '') stdio_base='((fp)->_IO_read_base)';;
15287 esac
15288 case "$stdio_bufsiz" in
15289 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15290 esac
15291else
15292 case "$stdio_ptr" in
15293 '') stdio_ptr='((fp)->_ptr)'
15294 ptr_lval=$define
15295 ;;
15296 *) ptr_lval=$d_stdio_ptr_lval;;
15297 esac
15298 case "$stdio_cnt" in
15299 '') stdio_cnt='((fp)->_cnt)'
15300 cnt_lval=$define
15301 ;;
15302 *) cnt_lval=$d_stdio_cnt_lval;;
15303 esac
15304 case "$stdio_base" in
15305 '') stdio_base='((fp)->_base)';;
15306 esac
15307 case "$stdio_bufsiz" in
15308 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15309 esac
15310fi
80f36755 15311
b4eb6b3d
JH
15312: test whether _ptr and _cnt really work
15313echo "Checking how std your stdio is..." >&4
15314$cat >try.c <<EOP
15315#include <stdio.h>
15316#define FILE_ptr(fp) $stdio_ptr
15317#define FILE_cnt(fp) $stdio_cnt
15318int main() {
15319 FILE *fp = fopen("try.c", "r");
15320 char c = getc(fp);
15321 if (
15322 18 <= FILE_cnt(fp) &&
15323 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15324 )
15325 exit(0);
15326 exit(1);
15327}
15328EOP
15329val="$undef"
15330set try
5440bc8e
JH
15331if eval $compile && $to try.c; then
15332 if $run ./try; then
b4eb6b3d
JH
15333 echo "Your stdio acts pretty std."
15334 val="$define"
15335 else
15336 echo "Your stdio isn't very std."
15337 fi
15338else
15339 echo "Your stdio doesn't appear very std."
15340fi
15341$rm -f try.c try
15342set d_stdstdio
15343eval $setvar
15344
15345: Can _ptr be used as an lvalue?
15346case "$d_stdstdio$ptr_lval" in
15347$define$define) val=$define ;;
15348*) val=$undef ;;
15349esac
15350set d_stdio_ptr_lval
15351eval $setvar
15352
15353: Can _cnt be used as an lvalue?
15354case "$d_stdstdio$cnt_lval" in
15355$define$define) val=$define ;;
15356*) val=$undef ;;
15357esac
15358set d_stdio_cnt_lval
15359eval $setvar
15360
a7ffa9b9
NC
15361
15362: test whether setting _ptr sets _cnt as a side effect
15363d_stdio_ptr_lval_sets_cnt="$undef"
15364d_stdio_ptr_lval_nochange_cnt="$undef"
15365case "$d_stdio_ptr_lval$d_stdstdio" in
15366$define$define)
15367 echo "Checking to see what happens if we set the stdio ptr..." >&4
15368$cat >try.c <<EOP
15369#include <stdio.h>
15370/* Can we scream? */
15371/* Eat dust sed :-) */
c1d9e6fa 15372/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
15373#define FILE_ptr(fp) $stdio_ptr
15374#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 15375#include <sys/types.h>
a7ffa9b9
NC
15376int main() {
15377 FILE *fp = fopen("try.c", "r");
c1d9e6fa 15378 int c;
a7ffa9b9
NC
15379 char *ptr;
15380 size_t cnt;
c1d9e6fa
JH
15381 if (!fp) {
15382 puts("Fail even to read");
15383 exit(1);
15384 }
15385 c = getc(fp); /* Read away the first # */
15386 if (c == EOF) {
15387 puts("Fail even to read");
15388 exit(1);
15389 }
a7ffa9b9
NC
15390 if (!(
15391 18 <= FILE_cnt(fp) &&
15392 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15393 )) {
15394 puts("Fail even to read");
15395 exit (1);
15396 }
c1d9e6fa
JH
15397 ptr = (char*) FILE_ptr(fp);
15398 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 15399
c1d9e6fa 15400 FILE_ptr(fp) += 42;
a7ffa9b9 15401
c1d9e6fa 15402 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
15403 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15404 exit (1);
15405 }
15406 if (FILE_cnt(fp) <= 20) {
15407 printf ("Fail (<20 chars to test)");
15408 exit (1);
15409 }
15410 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15411 puts("Fail compare");
15412 exit (1);
15413 }
15414 if (cnt == FILE_cnt(fp)) {
15415 puts("Pass_unchanged");
15416 exit (0);
15417 }
15418 if (FILE_cnt(fp) == (cnt - 42)) {
15419 puts("Pass_changed");
15420 exit (0);
15421 }
15422 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15423 return 1;
15424
15425}
15426EOP
15427 set try
5440bc8e
JH
15428 if eval $compile && $to try.c; then
15429 case `$run ./try` in
a7ffa9b9 15430 Pass_changed)
2e32dcfe 15431 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
15432 d_stdio_ptr_lval_sets_cnt="$define" ;;
15433 Pass_unchanged)
15434 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
15435 d_stdio_ptr_lval_nochange_cnt="$define" ;;
15436 Fail*)
15437 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
15438 *)
15439 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15440 esac
15441 else
15442 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
15443 fi
15444 $rm -f try.c try
15445 ;;
15446esac
15447
b4eb6b3d
JH
15448: see if _base is also standard
15449val="$undef"
15450case "$d_stdstdio" in
15451$define)
15452 $cat >try.c <<EOP
15453#include <stdio.h>
15454#define FILE_base(fp) $stdio_base
15455#define FILE_bufsiz(fp) $stdio_bufsiz
15456int main() {
15457 FILE *fp = fopen("try.c", "r");
15458 char c = getc(fp);
15459 if (
15460 19 <= FILE_bufsiz(fp) &&
15461 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15462 )
15463 exit(0);
15464 exit(1);
15465}
15466EOP
15467 set try
5440bc8e
JH
15468 if eval $compile && $to try.c; then
15469 if $run ./try; then
b4eb6b3d
JH
15470 echo "And its _base field acts std."
15471 val="$define"
15472 else
15473 echo "But its _base field isn't std."
15474 fi
15475 else
15476 echo "However, it seems to be lacking the _base field."
15477 fi
15478 $rm -f try.c try
15479 ;;
15480esac
15481set d_stdiobase
15482eval $setvar
15483
15484$cat >&4 <<EOM
15485Checking how to access stdio streams by file descriptor number...
15486EOM
15487case "$stdio_stream_array" in
15488'') $cat >try.c <<EOCP
15489#include <stdio.h>
15490int main() {
15491 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15492 printf("yes\n");
15493}
15494EOCP
15495 for s in _iob __iob __sF
15496 do
15497 set try -DSTDIO_STREAM_ARRAY=$s
15498 if eval $compile; then
5440bc8e 15499 case "`$run ./try`" in
b4eb6b3d
JH
15500 yes) stdio_stream_array=$s; break ;;
15501 esac
15502 fi
15503 done
15504 $rm -f try.* try$exe_ext
15505esac
15506case "$stdio_stream_array" in
15507'') $cat >&4 <<EOM
15508I can't figure out how to access stdio streams by file descriptor number.
15509EOM
15510 d_stdio_stream_array="$undef"
15511 ;;
15512*) $cat >&4 <<EOM
15513You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15514EOM
15515 d_stdio_stream_array="$define"
15516 ;;
15517esac
15518
15519: see if strcoll exists
15520set strcoll d_strcoll
15521eval $inlibc
15522
15523: check for structure copying
15524echo " "
15525echo "Checking to see if your C compiler can copy structs..." >&4
15526$cat >try.c <<'EOCP'
15527int main()
15528{
15529 struct blurfl {
15530 int dyick;
15531 } foo, bar;
15532
15533 foo = bar;
15534}
15535EOCP
15536if $cc -c try.c >/dev/null 2>&1 ; then
15537 val="$define"
15538 echo "Yup, it can."
15539else
15540 val="$undef"
15541 echo "Nope, it can't."
15542fi
15543set d_strctcpy
15544eval $setvar
15545$rm -f try.*
15546
15547: see if strerror and/or sys_errlist[] exist
15548echo " "
15549if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15550 if set strerror val -f d_strerror; eval $csym; $val; then
15551 echo 'strerror() found.' >&4
15552 d_strerror="$define"
15553 d_strerrm='strerror(e)'
15554 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15555 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
15556 d_syserrlst="$define"
15557 else
15558 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15559 d_syserrlst="$undef"
15560 fi
15561 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15562 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15563 echo 'strerror() found in string header.' >&4
15564 d_strerror="$define"
15565 d_strerrm='strerror(e)'
15566 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15567 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15568 d_syserrlst="$define"
15569 else
15570 echo "(You don't appear to have any sys_errlist[], how can this be?)"
15571 d_syserrlst="$undef"
15572 fi
15573 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15574 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15575 d_strerror="$undef"
15576 d_syserrlst="$define"
15577 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15578 else
15579 echo 'strerror() and sys_errlist[] NOT found.' >&4
15580 d_strerror="$undef"
15581 d_syserrlst="$undef"
15582 d_strerrm='"unknown"'
15583 fi
15584fi
15585
10bc17b6
JH
15586: see if strerror_r exists
15587set strerror_r d_strerror_r
15588eval $inlibc
15589case "$d_strerror_r" in
15590"$define")
15591 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
15592 case "$d_strerror_r_proto:$usethreads" in
15593 ":define") d_strerror_r_proto=define
a48ec845
JH
15594 set d_strerror_r_proto strerror_r $hdrs
15595 eval $hasproto ;;
15596 *) ;;
15597 esac
15598 case "$d_strerror_r_proto" in
15599 define)
10bc17b6
JH
15600 case "$strerror_r_proto" in
15601 ''|0) try='int strerror_r(int, char*, size_t);'
15602 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15603 esac
15604 case "$strerror_r_proto" in
15605 ''|0) try='int strerror_r(int, char*, int);'
15606 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15607 esac
15608 case "$strerror_r_proto" in
15609 ''|0) try='char* strerror_r(int, char*, size_t);'
15610 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15611 esac
15612 case "$strerror_r_proto" in
90e831dc 15613 ''|0) d_strerror_r=undef
10bc17b6 15614 strerror_r_proto=0
a48ec845 15615 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15616 * ) case "$strerror_r_proto" in
15617 REENTRANT_PROTO*) ;;
15618 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15619 esac
15620 echo "Prototype: $try" ;;
15621 esac
15622 ;;
c18e646a
JH
15623 *) case "$usethreads" in
15624 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15625 esac
90e831dc
SB
15626 d_strerror_r=undef
15627 strerror_r_proto=0
c18e646a 15628 ;;
a48ec845
JH
15629 esac
15630 ;;
10bc17b6
JH
15631*) strerror_r_proto=0
15632 ;;
15633esac
15634
b3c85772
JH
15635: see if strftime exists
15636set strftime d_strftime
15637eval $inlibc
15638
b4eb6b3d
JH
15639: see if strtod exists
15640set strtod d_strtod
15641eval $inlibc
15642
15643: see if strtol exists
15644set strtol d_strtol
15645eval $inlibc
15646
15647: see if strtold exists
15648set strtold d_strtold
15649eval $inlibc
15650
15651: see if strtoll exists
15652set strtoll d_strtoll
15653eval $inlibc
15654
15655case "$d_longlong-$d_strtoll" in
15656"$define-$define")
15657 $cat <<EOM
15658Checking whether your strtoll() works okay...
15659EOM
15660 $cat >try.c <<'EOCP'
15661#include <errno.h>
15662#ifdef __hpux
15663#define strtoll __strtoll
15664#endif
e75931a7
YST
15665#ifdef __EMX__
15666#define strtoll _strtoll
15667#endif
b4eb6b3d
JH
15668#include <stdio.h>
15669extern long long int strtoll(char *s, char **, int);
15670static int bad = 0;
15671int check(char *s, long long ell, int een) {
15672 long long gll;
15673 errno = 0;
15674 gll = strtoll(s, 0, 10);
15675 if (!((gll == ell) && (errno == een)))
15676 bad++;
15677}
15678int main() {
15679 check(" 1", 1LL, 0);
15680 check(" 0", 0LL, 0);
15681 check("-1", -1LL, 0);
15682 check("-9223372036854775808", -9223372036854775808LL, 0);
15683 check("-9223372036854775808", -9223372036854775808LL, 0);
15684 check(" 9223372036854775807", 9223372036854775807LL, 0);
15685 check("-9223372036854775808", -9223372036854775808LL, 0);
15686 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
15687 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15688 if (!bad)
15689 printf("ok\n");
15690}
15691EOCP
15692 set try
15693 if eval $compile; then
5440bc8e 15694 yyy=`$run ./try`
e75931a7 15695 case "$yyy" in
b4eb6b3d
JH
15696 ok) echo "Your strtoll() seems to be working okay." ;;
15697 *) cat <<EOM >&4
15698Your strtoll() doesn't seem to be working okay.
15699EOM
15700 d_strtoll="$undef"
15701 ;;
69eadf66 15702 esac
e75931a7
YST
15703 else
15704 echo "(I can't seem to compile the test program--assuming it doesn't)"
15705 d_strtoll="$undef"
b4eb6b3d
JH
15706 fi
15707 ;;
15708esac
15709
28e5dec8
JH
15710: see if strtoq exists
15711set strtoq d_strtoq
15712eval $inlibc
15713
b4eb6b3d
JH
15714: see if strtoul exists
15715set strtoul d_strtoul
15716eval $inlibc
15717
d0e6d399
NC
15718case "$d_strtoul" in
15719"$define")
15720 $cat <<EOM
15721Checking whether your strtoul() works okay...
15722EOM
15723 $cat >try.c <<'EOCP'
15724#include <errno.h>
15725#include <stdio.h>
15726extern unsigned long int strtoul(char *s, char **, int);
15727static int bad = 0;
15728void check(char *s, unsigned long eul, int een) {
15729 unsigned long gul;
15730 errno = 0;
15731 gul = strtoul(s, 0, 10);
15732 if (!((gul == eul) && (errno == een)))
15733 bad++;
15734}
15735int main() {
15736 check(" 1", 1L, 0);
15737 check(" 0", 0L, 0);
15738EOCP
15739 case "$longsize" in
15740 8)
15741 $cat >>try.c <<'EOCP'
09c0d2c4
JH
15742 check("18446744073709551615", 18446744073709551615UL, 0);
15743 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 15744#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 15745 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
15746 check("-18446744073709551614", 2, 0);
15747 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
15748 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15749 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 15750#endif
d0e6d399
NC
15751EOCP
15752 ;;
15753 4)
15754 $cat >>try.c <<'EOCP'
15755 check("4294967295", 4294967295UL, 0);
15756 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 15757#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
15758 check("-1", 4294967295UL, 0);
15759 check("-4294967294", 2, 0);
15760 check("-4294967295", 1, 0);
15761 check("-4294967296", 4294967295UL, ERANGE);
15762 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 15763#endif
d0e6d399
NC
15764EOCP
15765 ;;
15766 *)
15767: Should we write these tests to be more portable by sprintf-ing
15768: ~0 and then manipulating that char string as input for strtol?
15769 ;;
15770 esac
15771 $cat >>try.c <<'EOCP'
15772 if (!bad)
15773 printf("ok\n");
15774 return 0;
15775}
15776EOCP
15777 set try
15778 if eval $compile; then
5440bc8e 15779 case "`$run ./try`" in
d0e6d399
NC
15780 ok) echo "Your strtoul() seems to be working okay." ;;
15781 *) cat <<EOM >&4
15782Your strtoul() doesn't seem to be working okay.
15783EOM
15784 d_strtoul="$undef"
15785 ;;
15786 esac
15787 fi
15788 ;;
15789esac
15790
b4eb6b3d
JH
15791: see if strtoull exists
15792set strtoull d_strtoull
15793eval $inlibc
15794
15795case "$d_longlong-$d_strtoull" in
15796"$define-$define")
15797 $cat <<EOM
15798Checking whether your strtoull() works okay...
15799EOM
15800 $cat >try.c <<'EOCP'
15801#include <errno.h>
15802#ifdef __hpux
15803#define strtoull __strtoull
15804#endif
15805#include <stdio.h>
15806extern unsigned long long int strtoull(char *s, char **, int);
15807static int bad = 0;
15808int check(char *s, long long eull, int een) {
15809 long long gull;
15810 errno = 0;
15811 gull = strtoull(s, 0, 10);
15812 if (!((gull == eull) && (errno == een)))
15813 bad++;
15814}
15815int main() {
d0e6d399
NC
15816 check(" 1", 1LL, 0);
15817 check(" 0", 0LL, 0);
15818 check("18446744073709551615", 18446744073709551615ULL, 0);
15819 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 15820#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
15821 check("-1", 18446744073709551615ULL, 0);
15822 check("-18446744073709551614", 2LL, 0);
15823 check("-18446744073709551615", 1LL, 0);
15824 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15825 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 15826#endif
b4eb6b3d
JH
15827 if (!bad)
15828 printf("ok\n");
15829}
15830EOCP
15831 set try
15832 if eval $compile; then
5440bc8e 15833 case "`$run ./try`" in
b4eb6b3d
JH
15834 ok) echo "Your strtoull() seems to be working okay." ;;
15835 *) cat <<EOM >&4
15836Your strtoull() doesn't seem to be working okay.
15837EOM
15838 d_strtoull="$undef"
15839 ;;
15840 esac
15841 fi
15842 ;;
15843esac
15844
15845: see if strtouq exists
15846set strtouq d_strtouq
15847eval $inlibc
15848
d0e6d399
NC
15849case "$d_strtouq" in
15850"$define")
15851 $cat <<EOM
15852Checking whether your strtouq() works okay...
15853EOM
15854 $cat >try.c <<'EOCP'
15855#include <errno.h>
15856#include <stdio.h>
15857extern unsigned long long int strtouq(char *s, char **, int);
15858static int bad = 0;
15859void check(char *s, unsigned long long eull, int een) {
15860 unsigned long long gull;
15861 errno = 0;
15862 gull = strtouq(s, 0, 10);
15863 if (!((gull == eull) && (errno == een)))
15864 bad++;
15865}
15866int main() {
15867 check(" 1", 1LL, 0);
15868 check(" 0", 0LL, 0);
15869 check("18446744073709551615", 18446744073709551615ULL, 0);
15870 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 15871#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
15872 check("-1", 18446744073709551615ULL, 0);
15873 check("-18446744073709551614", 2LL, 0);
15874 check("-18446744073709551615", 1LL, 0);
15875 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15876 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 15877#endif
d0e6d399
NC
15878 if (!bad)
15879 printf("ok\n");
15880 return 0;
15881}
15882EOCP
15883 set try
15884 if eval $compile; then
5440bc8e 15885 case "`$run ./try`" in
d0e6d399
NC
15886 ok) echo "Your strtouq() seems to be working okay." ;;
15887 *) cat <<EOM >&4
15888Your strtouq() doesn't seem to be working okay.
15889EOM
15890 d_strtouq="$undef"
15891 ;;
15892 esac
15893 fi
15894 ;;
15895esac
15896
b4eb6b3d
JH
15897: see if strxfrm exists
15898set strxfrm d_strxfrm
15899eval $inlibc
15900
15901: see if symlink exists
15902set symlink d_symlink
15903eval $inlibc
15904
15905: see if syscall exists
15906set syscall d_syscall
15907eval $inlibc
15908
2ef53570
JH
15909: see if prototype for syscall is available
15910echo " "
15911set d_syscallproto syscall $i_unistd unistd.h
15912eval $hasproto
15913
b4eb6b3d
JH
15914: see if sysconf exists
15915set sysconf d_sysconf
15916eval $inlibc
15917
15918: see if system exists
15919set system d_system
15920eval $inlibc
15921
15922: see if tcgetpgrp exists
15923set tcgetpgrp d_tcgetpgrp
15924eval $inlibc
15925
15926: see if tcsetpgrp exists
15927set tcsetpgrp d_tcsetpgrp
15928eval $inlibc
15929
15930: see if prototype for telldir is available
15931echo " "
15932set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15933eval $hasproto
15934
ad493445
MB
15935: see if time exists
15936echo " "
15937if test "X$d_time" = X -o X"$timetype" = X; then
15938 if set time val -f d_time; eval $csym; $val; then
15939 echo 'time() found.' >&4
15940 val="$define"
15941 rp="What is the type returned by time() on this system?"
15942 set time_t timetype long stdio.h sys/types.h
15943 eval $typedef_ask
15944 else
15945 echo 'time() not found, hope that will do.' >&4
15946 val="$undef"
15947 timetype='int';
15948 fi
15949 set d_time
15950 eval $setvar
15951fi
15952
b4eb6b3d
JH
15953: see if this is a sys/times.h system
15954set sys/times.h i_systimes
15955eval $inhdr
15956
15957: see if times exists
15958echo " "
15959if set times val -f d_times; eval $csym; $val; then
15960 echo 'times() found.' >&4
15961 d_times="$define"
15962 inc=''
15963 case "$i_systimes" in
15964 "$define") inc='sys/times.h';;
15965 esac
15966 rp="What is the type returned by times() on this system?"
15967 set clock_t clocktype long stdio.h sys/types.h $inc
15968 eval $typedef_ask
15969else
15970 echo 'times() NOT found, hope that will do.' >&4
15971 d_times="$undef"
15972 clocktype='int'
15973fi
15974
10bc17b6
JH
15975: see if tmpnam_r exists
15976set tmpnam_r d_tmpnam_r
15977eval $inlibc
15978case "$d_tmpnam_r" in
15979"$define")
31ee0cb7 15980 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
15981 case "$d_tmpnam_r_proto:$usethreads" in
15982 ":define") d_tmpnam_r_proto=define
a48ec845
JH
15983 set d_tmpnam_r_proto tmpnam_r $hdrs
15984 eval $hasproto ;;
15985 *) ;;
15986 esac
15987 case "$d_tmpnam_r_proto" in
15988 define)
10bc17b6
JH
15989 case "$tmpnam_r_proto" in
15990 ''|0) try='char* tmpnam_r(char*);'
15991 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15992 esac
15993 case "$tmpnam_r_proto" in
90e831dc 15994 ''|0) d_tmpnam_r=undef
10bc17b6 15995 tmpnam_r_proto=0
a48ec845 15996 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15997 * ) case "$tmpnam_r_proto" in
15998 REENTRANT_PROTO*) ;;
15999 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16000 esac
16001 echo "Prototype: $try" ;;
16002 esac
16003 ;;
c18e646a
JH
16004 *) case "$usethreads" in
16005 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16006 esac
90e831dc
SB
16007 d_tmpnam_r=undef
16008 tmpnam_r_proto=0
c18e646a 16009 ;;
a48ec845
JH
16010 esac
16011 ;;
10bc17b6
JH
16012*) tmpnam_r_proto=0
16013 ;;
16014esac
16015
b4eb6b3d
JH
16016: see if truncate exists
16017set truncate d_truncate
16018eval $inlibc
16019
10bc17b6
JH
16020: see if ttyname_r exists
16021set ttyname_r d_ttyname_r
16022eval $inlibc
16023case "$d_ttyname_r" in
16024"$define")
16025 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
16026 case "$d_ttyname_r_proto:$usethreads" in
16027 ":define") d_ttyname_r_proto=define
a48ec845
JH
16028 set d_ttyname_r_proto ttyname_r $hdrs
16029 eval $hasproto ;;
16030 *) ;;
16031 esac
16032 case "$d_ttyname_r_proto" in
16033 define)
10bc17b6
JH
16034 case "$ttyname_r_proto" in
16035 ''|0) try='int ttyname_r(int, char*, size_t);'
16036 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16037 esac
16038 case "$ttyname_r_proto" in
16039 ''|0) try='int ttyname_r(int, char*, int);'
16040 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16041 esac
16042 case "$ttyname_r_proto" in
16043 ''|0) try='char* ttyname_r(int, char*, int);'
16044 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16045 esac
16046 case "$ttyname_r_proto" in
90e831dc 16047 ''|0) d_ttyname_r=undef
10bc17b6 16048 ttyname_r_proto=0
a48ec845 16049 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16050 * ) case "$ttyname_r_proto" in
16051 REENTRANT_PROTO*) ;;
16052 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16053 esac
16054 echo "Prototype: $try" ;;
16055 esac
16056 ;;
c18e646a
JH
16057 *) case "$usethreads" in
16058 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16059 esac
90e831dc
SB
16060 d_ttyname_r=undef
16061 ttyname_r_proto=0
c18e646a 16062 ;;
a48ec845
JH
16063 esac
16064 ;;
10bc17b6
JH
16065*) ttyname_r_proto=0
16066 ;;
16067esac
16068
b4eb6b3d
JH
16069: see if tzname[] exists
16070echo " "
16071if set tzname val -a d_tzname; eval $csym; $val; then
16072 val="$define"
16073 echo 'tzname[] found.' >&4
16074else
16075 val="$undef"
16076 echo 'tzname[] NOT found.' >&4
16077fi
16078set d_tzname
16079eval $setvar
16080
4e0554ec
JH
16081case "$osname" in
16082next|rhapsody|darwin) multiarch="$define" ;;
16083esac
16084case "$multiarch" in
16085''|[nN]*) multiarch="$undef" ;;
16086esac
16087
24412007 16088: check for ordering of bytes in a UV
4e0554ec 16089echo " "
5440bc8e 16090case "$usecrosscompile$multiarch" in
4e0554ec
JH
16091*$define*)
16092 $cat <<EOM
16093You seem to be either cross-compiling or doing a multiarchitecture build,
16094skipping the byteorder check.
16095
16096EOM
5440bc8e 16097 byteorder='ffff'
4e0554ec
JH
16098 ;;
16099*)
16100 case "$byteorder" in
16101 '')
16102 $cat <<'EOM'
16103In the following, larger digits indicate more significance. A big-endian
16104machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16105little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16106machines may have weird orders like 3412. A Cray will report 87654321,
16107an Alpha will report 12345678. If the test program works the default is
16108probably right.
16109I'm now running the test program...
16110EOM
24412007 16111 $cat >try.c <<EOCP
4e0554ec 16112#include <stdio.h>
24412007
JH
16113#include <sys/types.h>
16114typedef $uvtype UV;
4e0554ec
JH
16115int main()
16116{
16117 int i;
16118 union {
24412007
JH
16119 UV l;
16120 char c[$uvsize];
4e0554ec
JH
16121 } u;
16122
24412007 16123 if ($uvsize > 4)
b5ded3e5 16124 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 16125 else
a4c53327 16126 u.l = (UV)0x04030201;
24412007 16127 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
16128 printf("%c", u.c[i]+'0');
16129 printf("\n");
16130 exit(0);
16131}
16132EOCP
16133 xxx_prompt=y
16134 set try
16135 if eval $compile && ./try > /dev/null; then
5440bc8e 16136 dflt=`$run ./try`
4e0554ec
JH
16137 case "$dflt" in
16138 [1-4][1-4][1-4][1-4]|12345678|87654321)
16139 echo "(The test program ran ok.)"
16140 echo "byteorder=$dflt"
16141 xxx_prompt=n
16142 ;;
16143 ????|????????) echo "(The test program ran ok.)" ;;
16144 *) echo "(The test program didn't run right for some reason.)" ;;
16145 esac
16146 else
16147 dflt='4321'
16148 cat <<'EOM'
16149(I can't seem to compile the test program. Guessing big-endian...)
16150EOM
16151 fi
16152 case "$xxx_prompt" in
16153 y)
24412007 16154 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
16155 . ./myread
16156 byteorder="$ans"
16157 ;;
16158 *) byteorder=$dflt
16159 ;;
16160 esac
16161 ;;
16162 esac
16163 $rm -f try.c try
16164 ;;
16165esac
16166
16167
16168$cat <<EOM
16169
16170Checking to see whether you can access character data unalignedly...
16171EOM
dc7b0a4f
JH
16172case "$d_u32align" in
16173'') $cat >try.c <<EOCP
4e0554ec
JH
16174#include <stdio.h>
16175#define U32 $u32type
d308175a
JH
16176#define BYTEORDER 0x$byteorder
16177#define U8 $u8type
9958dc3c
JH
16178#include <signal.h>
16179#ifdef SIGBUS
16180$signal_t bletch(s) int s; { exit(4); }
16181#endif
4e0554ec
JH
16182int main() {
16183#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 16184 U8 buf[8];
4e0554ec
JH
16185 U32 *up;
16186 int i;
16187
16188 if (sizeof(U32) != 4) {
16189 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16190 exit(1);
16191 }
16192
16193 fflush(stdout);
16194
9958dc3c
JH
16195#ifdef SIGBUS
16196 signal(SIGBUS, bletch);
16197#endif
16198
8906a23e
JH
16199 buf[0] = 0;
16200 buf[1] = 0;
16201 buf[2] = 0;
16202 buf[3] = 1;
16203 buf[5] = 0;
16204 buf[6] = 0;
16205 buf[7] = 0;
16206 buf[8] = 1;
16207
4e0554ec
JH
16208 for (i = 0; i < 4; i++) {
16209 up = (U32*)(buf + i);
16210 if (! ((*up == 1 << (8*i)) || /* big-endian */
16211 (*up == 1 << (8*(3-i))) /* little-endian */
16212 )
16213 )
16214 {
16215 printf("read failed (%x)\n", *up);
16216 exit(2);
16217 }
16218 }
16219
16220 /* write test */
16221 for (i = 0; i < 4; i++) {
16222 up = (U32*)(buf + i);
16223 *up = 0xBeef;
16224 if (*up != 0xBeef) {
16225 printf("write failed (%x)\n", *up);
16226 exit(3);
16227 }
16228 }
16229
16230 exit(0);
16231#else
16232 printf("1\n");
16233 exit(1);
16234#endif
16235 return 0;
16236}
16237EOCP
16238set try
16239if eval $compile_ok; then
d308175a 16240 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 16241 $run ./try 2>&1 >/dev/null
4e0554ec
JH
16242 case "$?" in
16243 0) cat >&4 <<EOM
16244You can access character data pretty unalignedly.
16245EOM
16246 d_u32align="$undef"
16247 ;;
16248 *) cat >&4 <<EOM
16249It seems that you must access character data in an aligned manner.
16250EOM
16251 d_u32align="$define"
16252 ;;
16253 esac
4e0554ec
JH
16254else
16255 rp='Can you access character data at unaligned addresses?'
16256 dflt='n'
16257 . ./myread
16258 case "$ans" in
16259 [yY]*) d_u32align="$undef" ;;
16260 *) d_u32align="$define" ;;
16261 esac
16262fi
e36b5403 16263$rm -f core core.try.* try.core
dc7b0a4f
JH
16264;;
16265esac
4e0554ec
JH
16266
16267: see if ualarm exists
16268set ualarm d_ualarm
16269eval $inlibc
16270
b4eb6b3d
JH
16271: see if umask exists
16272set umask d_umask
16273eval $inlibc
16274
758a5d79
JH
16275: see if unordered exists
16276set unordered d_unordered
16277eval $inlibc
16278
4e0554ec
JH
16279: see if usleep exists
16280set usleep d_usleep
16281eval $inlibc
16282
2ef53570
JH
16283: see if prototype for usleep is available
16284echo " "
16285set d_usleepproto usleep $i_unistd unistd.h
16286eval $hasproto
16287
b4eb6b3d
JH
16288: see if ustat exists
16289set ustat d_ustat
16290eval $inlibc
16291
16292: backward compatibility for d_hvfork
16293if test X$d_hvfork != X; then
16294 d_vfork="$d_hvfork"
16295 d_hvfork=''
16296fi
16297: see if there is a vfork
16298val=''
16299set vfork val
16300eval $inlibc
16301
16302: Ok, but do we want to use it. vfork is reportedly unreliable in
16303: perl on Solaris 2.x, and probably elsewhere.
16304case "$val" in
16305$define)
16306 echo " "
16307 case "$usevfork" in
16308 false) dflt='n';;
16309 *) dflt='y';;
16310 esac
16311 cat <<'EOM'
16312
16313Perl can only use a vfork() that doesn't suffer from strict
16314restrictions on calling functions or modifying global data in
16315the child. For example, glibc-2.1 contains such a vfork()
16316that is unsuitable. If your system provides a proper fork()
16317call, chances are that you do NOT want perl to use vfork().
16318
16319EOM
16320 rp="Do you still want to use vfork()?"
16321 . ./myread
16322 case "$ans" in
16323 y|Y) ;;
16324 *)
16325 echo "Ok, we won't use vfork()."
16326 val="$undef"
16327 ;;
16328 esac
16329 ;;
16330esac
16331set d_vfork
16332eval $setvar
16333case "$d_vfork" in
16334$define) usevfork='true';;
16335*) usevfork='false';;
16336esac
16337
b4eb6b3d
JH
16338: see if closedir exists
16339set closedir d_closedir
16340eval $inlibc
16341
16342case "$d_closedir" in
16343"$define")
16344 echo " "
16345 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 16346 cat > try.c <<EOM
b4eb6b3d
JH
16347#$i_dirent I_DIRENT /**/
16348#$i_sysdir I_SYS_DIR /**/
16349#$i_sysndir I_SYS_NDIR /**/
16350#$i_systypes I_SYS_TYPES /**/
16351
16352#if defined(I_SYS_TYPES)
16353#include <sys/types.h>
16354#endif
16355#if defined(I_DIRENT)
16356#include <dirent.h>
16357#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16358#include <sys/dir.h>
16359#endif
16360#else
16361#ifdef I_SYS_NDIR
16362#include <sys/ndir.h>
16363#else
16364#ifdef I_SYS_DIR
16365#ifdef hp9000s500
16366#include <ndir.h> /* may be wrong in the future */
16367#else
16368#include <sys/dir.h>
16369#endif
16370#endif
16371#endif
16372#endif
16373int main() { return closedir(opendir(".")); }
16374EOM
5440bc8e 16375 set try
b4eb6b3d 16376 if eval $compile_ok; then
5440bc8e 16377 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
16378 echo "Yes, it does."
16379 val="$undef"
16380 else
16381 echo "No, it doesn't."
16382 val="$define"
16383 fi
16384 else
16385 echo "(I can't seem to compile the test program--assuming it doesn't)"
16386 val="$define"
16387 fi
16388 ;;
16389*)
16390 val="$undef";
16391 ;;
16392esac
16393set d_void_closedir
16394eval $setvar
5440bc8e 16395$rm -f try try.*
b4eb6b3d
JH
16396: see if there is a wait4
16397set wait4 d_wait4
16398eval $inlibc
16399
16400: see if waitpid exists
16401set waitpid d_waitpid
16402eval $inlibc
16403
16404: see if wcstombs exists
16405set wcstombs d_wcstombs
16406eval $inlibc
16407
16408: see if wctomb exists
16409set wctomb d_wctomb
16410eval $inlibc
16411
4e0554ec
JH
16412: see if writev exists
16413set writev d_writev
16414eval $inlibc
16415
b4eb6b3d
JH
16416: preserve RCS keywords in files with variable substitution, grrr
16417Date='$Date'
16418Id='$Id'
16419Log='$Log'
16420RCSfile='$RCSfile'
16421Revision='$Revision'
16422
b4eb6b3d
JH
16423: check for alignment requirements
16424echo " "
5440bc8e 16425case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
16426*$define*)
16427 $cat <<EOM
16428You seem to be either cross-compiling or doing a multiarchitecture build,
16429skipping the memory alignment check.
16430
16431EOM
16432 case "$alignbytes" in
16433 '') alignbytes=8 ;;
16434 esac
16435 ;;
16436*)
16437 case "$alignbytes" in
16438 '') echo "Checking alignment constraints..." >&4
16439 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16440 $cat >try.c <<'EOCP'
16441typedef long double NV;
16442EOCP
16443 else
16444 $cat >try.c <<'EOCP'
16445typedef double NV;
16446EOCP
16447 fi
16448 $cat >>try.c <<'EOCP'
16449#include <stdio.h>
16450struct foobar {
16451 char foo;
16452 NV bar;
16453} try_algn;
16454int main()
16455{
16456 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16457 return(0);
16458}
16459EOCP
16460 set try
16461 if eval $compile_ok; then
5440bc8e 16462 dflt=`$run ./try`
b4eb6b3d
JH
16463 else
16464 dflt='8'
16465 echo "(I can't seem to compile the test program...)"
16466 fi
16467 ;;
16468 *) dflt="$alignbytes"
16469 ;;
16470 esac
16471 rp="Doubles must be aligned on a how-many-byte boundary?"
16472 . ./myread
16473 alignbytes="$ans"
16474 $rm -f try.c try
16475 ;;
16476esac
16477
16478
16479: set the base revision
16480baserev=5.0
16481
b4eb6b3d
JH
16482: how do we catenate cpp tokens here?
16483echo " "
16484echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16485$cat >cpp_stuff.c <<'EOCP'
16486#define RCAT(a,b)a/**/b
16487#define ACAT(a,b)a ## b
16488RCAT(Rei,ser)
16489ACAT(Cir,cus)
16490EOCP
16491$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16492if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16493 echo "Oh! Smells like ANSI's been here." >&4
16494 echo "We can catify or stringify, separately or together!"
16495 cpp_stuff=42
16496elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16497 echo "Ah, yes! The good old days!" >&4
16498 echo "However, in the good old days we don't know how to stringify and"
16499 echo "catify at the same time."
16500 cpp_stuff=1
16501else
16502 $cat >&4 <<EOM
16503Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
16504to have to edit the values of CAT[2-5] in config.h...
16505EOM
16506 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16507fi
16508$rm -f cpp_stuff.*
16509
16510: see if this is a db.h system
16511set db.h i_db
16512eval $inhdr
16513
16514case "$i_db" in
16515$define)
16516 : Check db version.
16517 echo " "
16518 echo "Checking Berkeley DB version ..." >&4
16519 $cat >try.c <<EOCP
16520#$d_const HASCONST
16521#ifndef HASCONST
16522#define const
16523#endif
16524#include <sys/types.h>
16525#include <stdio.h>
16526#include <db.h>
640374d0 16527int main(int argc, char *argv[])
b4eb6b3d
JH
16528{
16529#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16530 int Major, Minor, Patch ;
16531 unsigned long Version ;
16532 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
16533 if (argc == 2) {
16534 printf("%d %d %d %d %d %d\n",
16535 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16536 Major, Minor, Patch);
16537 exit(0);
16538 }
16539 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
16540
16541 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16542 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16543 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16544 Major, Minor, Patch) ;
16545
16546 /* check that db.h & libdb are compatible */
16547 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 16548 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
16549 exit(3);
16550 }
16551
640374d0 16552 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
16553
16554 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16555 + DB_VERSION_PATCH ;
16556
16557 /* needs to be >= 2.3.4 */
16558 if (Version < 2003004) {
16559 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 16560 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
16561 exit(2);
16562 }
16563
16564 exit(0);
16565#else
16566#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
16567 if (argc == 2) {
16568 printf("1 0 0\n");
16569 exit(0);
16570 }
16571 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
16572 exit(0); /* DB version < 2: the coast is clear. */
16573#else
16574 exit(1); /* <db.h> not Berkeley DB? */
16575#endif
16576#endif
16577}
16578EOCP
16579 set try
5440bc8e 16580 if eval $compile_ok && $run ./try; then
b4eb6b3d 16581 echo 'Looks OK.' >&4
5440bc8e 16582 set `$run ./try 1`
640374d0
JH
16583 db_version_major=$1
16584 db_version_minor=$2
16585 db_version_patch=$3
b4eb6b3d
JH
16586 else
16587 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
16588 i_db=$undef
16589 case " $libs " in
16590 *"-ldb "*)
16591 : Remove db from list of libraries to use
16592 echo "Removing unusable -ldb from library list" >&4
16593 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16594 shift
16595 libs="$*"
16596 echo "libs = $libs" >&4
16597 ;;
16598 esac
16599 fi
16600 $rm -f try.*
16601 ;;
16602esac
16603
16604case "$i_db" in
16605define)
16606 : Check the return type needed for hash
16607 echo " "
16608 echo "Checking return type needed for hash for Berkeley DB ..." >&4
16609 $cat >try.c <<EOCP
16610#$d_const HASCONST
16611#ifndef HASCONST
16612#define const
16613#endif
16614#include <sys/types.h>
16615#include <db.h>
16616
16617#ifndef DB_VERSION_MAJOR
16618u_int32_t hash_cb (ptr, size)
16619const void *ptr;
16620size_t size;
16621{
16622}
16623HASHINFO info;
16624int main()
16625{
16626 info.hash = hash_cb;
16627}
16628#endif
16629EOCP
16630 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16631 if $contains warning try.out >>/dev/null 2>&1 ; then
16632 db_hashtype='int'
16633 else
16634 db_hashtype='u_int32_t'
16635 fi
16636 else
16637 : XXX Maybe we should just give up here.
16638 db_hashtype=u_int32_t
16639 $cat try.out >&4
16640 echo "Help: I can't seem to compile the db test program." >&4
16641 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16642 fi
16643 $rm -f try.*
16644 echo "Your version of Berkeley DB uses $db_hashtype for hash."
16645 ;;
16646*) db_hashtype=u_int32_t
16647 ;;
16648esac
16649case "$i_db" in
16650define)
16651 : Check the return type needed for prefix
16652 echo " "
16653 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16654 cat >try.c <<EOCP
16655#$d_const HASCONST
16656#ifndef HASCONST
16657#define const
16658#endif
16659#include <sys/types.h>
16660#include <db.h>
16661
16662#ifndef DB_VERSION_MAJOR
16663size_t prefix_cb (key1, key2)
16664const DBT *key1;
16665const DBT *key2;
16666{
16667}
16668BTREEINFO info;
16669int main()
16670{
16671 info.prefix = prefix_cb;
16672}
16673#endif
16674EOCP
16675 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16676 if $contains warning try.out >>/dev/null 2>&1 ; then
16677 db_prefixtype='int'
16678 else
16679 db_prefixtype='size_t'
16680 fi
16681 else
16682 db_prefixtype='size_t'
16683 : XXX Maybe we should just give up here.
16684 $cat try.out >&4
16685 echo "Help: I can't seem to compile the db test program." >&4
16686 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16687 fi
16688 $rm -f try.*
16689 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16690 ;;
16691*) db_prefixtype='size_t'
16692 ;;
16693esac
16694
b4eb6b3d
JH
16695
16696: How can we generate normalized random numbers ?
16697echo " "
16698echo "Looking for a random number function..." >&4
16699case "$randfunc" in
16700'')
16701 if set drand48 val -f; eval $csym; $val; then
16702 dflt="drand48"
16703 echo "Good, found drand48()." >&4
16704 elif set random val -f; eval $csym; $val; then
16705 dflt="random"
16706 echo "OK, found random()." >&4
16707 else
16708 dflt="rand"
16709 echo "Yick, looks like I have to use rand()." >&4
16710 fi
16711 echo " "
16712 ;;
16713*)
16714 dflt="$randfunc"
16715 ;;
16716esac
16717cont=true
16718
16719case "$ccflags" in
16720*-Dmy_rand=*|*-Dmy_srand=*)
16721 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16722 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16723 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16724 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16725 ;;
16726esac
16727
16728while $test "$cont"; do
16729 rp="Use which function to generate random numbers?"
16730 . ./myread
16731 if $test "$ans" = "$dflt"; then
16732 : null
16733 else
16734 randbits=''
16735 fi
16736 randfunc="$ans"
16737 if set $ans val -f; eval $csym; $val; then
16738 cont=''
16739 else
16740 dflt=y
16741 rp="I cannot find function $ans. Use that name anyway?"
16742 . ./myread
16743 dflt=rand
16744 case "$ans" in
16745 [yY]*) cont='';;
16746 esac
16747 fi
16748 case "$cont" in
16749 '')
16750 case "$randfunc" in
16751 drand48)
16752 drand01="drand48()"
16753 seedfunc="srand48"
16754 randbits=48
16755 randseedtype=long
16756 ;;
16757 rand|random)
16758 case "$randbits" in
16759 '')
16760echo "Checking to see how many bits your $randfunc() function produces..." >&4
16761 $cat >try.c <<EOCP
16762#$i_unistd I_UNISTD
16763#$i_stdlib I_STDLIB
16764#include <stdio.h>
16765#ifdef I_UNISTD
16766# include <unistd.h>
16767#endif
16768#ifdef I_STDLIB
16769# include <stdlib.h>
16770#endif
16771int main()
16772{
16773 register int i;
16774 register unsigned long tmp;
16775 register unsigned long max = 0L;
16776
16777 for (i = 1000; i; i--) {
16778 tmp = (unsigned long) $randfunc();
16779 if (tmp > max) max = tmp;
16780 }
16781 for (i = 0; max; i++)
16782 max /= 2;
16783 printf("%d\n",i);
16784}
16785EOCP
16786 set try
16787 if eval $compile_ok; then
16788 dflt=`try`
16789 else
16790 dflt='?'
16791 echo "(I can't seem to compile the test program...)"
16792 fi
16793 ;;
16794 *)
16795 dflt="$randbits"
16796 ;;
16797 esac
16798 rp="How many bits does your $randfunc() function produce?"
16799 . ./myread
16800 randbits="$ans"
16801 $rm -f try.c try
16802 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16803 seedfunc="s$randfunc"
16804 randseedtype=unsigned
16805 ;;
16806 *)
16807 dflt="31"
16808 rp="How many bits does your $randfunc() function produce?"
16809 . ./myread
16810 randbits="$ans"
16811 seedfunc="s$randfunc"
16812 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16813 if set $seedfunc val -f; eval $csym; $val; then
16814 echo "(Using $seedfunc() to seed random generator)"
16815 else
16816 echo "(Warning: no $seedfunc() to seed random generator)"
16817 seedfunc=rand
16818 fi
16819 randseedtype=unsigned
16820 ;;
16821 esac
16822 ;;
16823 esac
16824done
16825
16826echo " "
16827echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 16828$cat >try.c <<'EOM'
b4eb6b3d
JH
16829int main()
16830{
16831 if ('M'==0xd4) return 0;
16832 return 1;
16833}
16834EOM
16835
16836val=$undef
5440bc8e 16837set try
b4eb6b3d 16838if eval $compile_ok; then
5440bc8e 16839 if $run ./try; then
b4eb6b3d
JH
16840 echo "You seem to speak EBCDIC." >&4
16841 val="$define"
16842 else
5440bc8e 16843 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
16844 fi
16845else
16846 echo "I'm unable to compile the test program." >&4
16847 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16848fi
5440bc8e 16849$rm -f try try.*
b4eb6b3d
JH
16850set ebcdic
16851eval $setvar
16852
16853echo " "
16854$cat >&4 <<EOM
16855Checking how to flush all pending stdio output...
16856EOM
16857# I only know how to find the first 32 possibly open files on SunOS.
16858# See also hints/sunos_4_1.sh and util.c --AD
16859case "$osname" in
16860sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16861esac
16862$cat >>try.c <<EOCP
16863#include <stdio.h>
16864#$i_unistd I_UNISTD
16865#ifdef I_UNISTD
16866# include <unistd.h>
16867#endif
16868#$d_sysconf HAS_SYSCONF
16869#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16870#ifdef HAS_STDIO_STREAM_ARRAY
16871# define STDIO_STREAM_ARRAY $stdio_stream_array
16872#endif
16873int main() {
5440bc8e
JH
16874 FILE* p;
16875 unlink("try.out");
16876 p = fopen("try.out", "w");
b4eb6b3d
JH
16877#ifdef TRY_FPUTC
16878 fputc('x', p);
16879#else
16880# ifdef TRY_FPRINTF
16881 fprintf(p, "x");
16882# endif
16883#endif
16884#ifdef TRY_FFLUSH_NULL
16885 fflush(NULL);
16886#endif
16887#ifdef TRY_FFLUSH_ALL
16888 {
16889 long open_max = -1;
16890# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16891 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16892# else
16893# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16894 open_max = sysconf(_SC_OPEN_MAX);
16895# else
16896# ifdef FOPEN_MAX
16897 open_max = FOPEN_MAX;
16898# else
16899# ifdef OPEN_MAX
16900 open_max = OPEN_MAX;
16901# else
16902# ifdef _NFILE
16903 open_max = _NFILE;
16904# endif
16905# endif
16906# endif
16907# endif
16908# endif
16909# ifdef HAS_STDIO_STREAM_ARRAY
16910 if (open_max > 0) {
16911 long i;
16912 for (i = 0; i < open_max; i++)
16913 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16914 STDIO_STREAM_ARRAY[i]._file < open_max &&
16915 STDIO_STREAM_ARRAY[i]._flag)
16916 fflush(&STDIO_STREAM_ARRAY[i]);
16917 }
16918 }
16919# endif
16920#endif
16921 _exit(42);
16922}
16923EOCP
16924: first we have to find out how _not_ to flush
5440bc8e 16925$to try.c
b4eb6b3d
JH
16926if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16927 output=''
16928 set try -DTRY_FPUTC
16929 if eval $compile; then
fbe73d74 16930 $run ./try 2>/dev/null
28f5ac64 16931 code="$?"
5440bc8e 16932 $from try.out
28f5ac64 16933 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
16934 output=-DTRY_FPUTC
16935 fi
16936 fi
16937 case "$output" in
16938 '')
16939 set try -DTRY_FPRINTF
b4eb6b3d 16940 if eval $compile; then
fbe73d74 16941 $run ./try 2>/dev/null
28f5ac64 16942 code="$?"
5440bc8e 16943 $from try.out
28f5ac64 16944 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
16945 output=-DTRY_FPRINTF
16946 fi
16947 fi
16948 ;;
16949 esac
16950fi
16951: check for fflush NULL behaviour
16952case "$fflushNULL" in
16953'') set try -DTRY_FFLUSH_NULL $output
16954 if eval $compile; then
5440bc8e 16955 $run ./try 2>/dev/null
b4eb6b3d 16956 code="$?"
5440bc8e 16957 $from try.out
b4eb6b3d
JH
16958 if $test -s try.out -a "X$code" = X42; then
16959 fflushNULL="`$cat try.out`"
16960 else
16961 if $test "X$code" != X42; then
16962 $cat >&4 <<EOM
16963(If this test failed, don't worry, we'll try another method shortly.)
16964EOM
16965 fi
16966 fi
16967 fi
16968 $rm -f core try.core core.try.*
16969 case "$fflushNULL" in
16970 x) $cat >&4 <<EOM
16971Your fflush(NULL) works okay for output streams.
16972Let's see if it clobbers input pipes...
16973EOM
16974# As of mid-March 2000 all versions of Solaris appear to have a stdio
16975# bug that improperly flushes the input end of pipes. So we avoid the
16976# autoflush on fork/system/exec support for now. :-(
16977$cat >tryp.c <<EOCP
16978#include <stdio.h>
16979int
16980main(int argc, char **argv)
16981{
16982 char buf[1024];
16983 int i;
16984 char *bp = buf;
16985 while (1) {
16986 while ((i = getc(stdin)) != -1
16987 && (*bp++ = i) != '\n'
16988 && bp < &buf[1024])
16989 /* DO NOTHING */ ;
16990 *bp = '\0';
16991 fprintf(stdout, "%s", buf);
16992 fflush(NULL);
16993 if (i == -1)
16994 return 0;
16995 bp = buf;
16996 }
16997}
16998EOCP
16999 fflushNULL="$define"
17000 set tryp
17001 if eval $compile; then
17002 $rm -f tryp.out
5440bc8e 17003 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17004 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17005 $cat >&4 <<EOM
17006fflush(NULL) seems to behave okay with input streams.
17007EOM
17008 fflushNULL="$define"
17009 else
17010 $cat >&4 <<EOM
17011Ouch, fflush(NULL) clobbers input pipes! We will not use it.
17012EOM
17013 fflushNULL="$undef"
17014 fi
17015 fi
17016 $rm -f core tryp.c tryp.core core.tryp.*
17017 ;;
17018 '') $cat >&4 <<EOM
17019Your fflush(NULL) isn't working (contrary to ANSI C).
17020EOM
17021 fflushNULL="$undef"
17022 ;;
17023 *) $cat >&4 <<EOM
17024Cannot figure out whether your fflush(NULL) works or not.
17025I'm assuming it doesn't (contrary to ANSI C).
17026EOM
17027 fflushNULL="$undef"
17028 ;;
17029 esac
17030 ;;
17031$define|true|[yY]*)
17032 fflushNULL="$define"
17033 ;;
17034*)
17035 fflushNULL="$undef"
17036 ;;
17037esac
17038: check explicit looping only if NULL did not work, and if the pipe
17039: bug does not show up on an explicit flush too
17040case "$fflushNULL" in
17041"$undef")
17042 $cat >tryp.c <<EOCP
17043#include <stdio.h>
17044int
17045main(int argc, char **argv)
17046{
17047 char buf[1024];
17048 int i;
17049 char *bp = buf;
17050 while (1) {
17051 while ((i = getc(stdin)) != -1
17052 && (*bp++ = i) != '\n'
17053 && bp < &buf[1024])
17054 /* DO NOTHING */ ;
17055 *bp = '\0';
17056 fprintf(stdout, "%s", buf);
17057 fflush(stdin);
17058 if (i == -1)
17059 return 0;
17060 bp = buf;
17061 }
17062}
17063EOCP
17064 set tryp
17065 if eval $compile; then
17066 $rm -f tryp.out
5440bc8e 17067 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17068 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17069 $cat >&4 <<EOM
17070Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17071EOM
17072 : now check for fflushall behaviour
17073 case "$fflushall" in
17074 '') set try -DTRY_FFLUSH_ALL $output
17075 if eval $compile; then
17076 $cat >&4 <<EOM
17077(Now testing the other method--but note that this also may fail.)
17078EOM
5440bc8e 17079 $run ./try 2>/dev/null
28f5ac64 17080 code=$?
fbe73d74 17081 $from try.out
28f5ac64 17082 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17083 fflushall="`$cat try.out`"
17084 fi
17085 fi
17086 $rm -f core try.core core.try.*
17087 case "$fflushall" in
17088 x) $cat >&4 <<EOM
17089Whew. Flushing explicitly all the stdio streams works.
17090EOM
17091 fflushall="$define"
17092 ;;
17093 '') $cat >&4 <<EOM
17094Sigh. Flushing explicitly all the stdio streams doesn't work.
17095EOM
17096 fflushall="$undef"
17097 ;;
17098 *) $cat >&4 <<EOM
17099Cannot figure out whether flushing stdio streams explicitly works or not.
17100I'm assuming it doesn't.
17101EOM
17102 fflushall="$undef"
17103 ;;
17104 esac
17105 ;;
17106 "$define"|true|[yY]*)
17107 fflushall="$define"
17108 ;;
17109 *)
17110 fflushall="$undef"
17111 ;;
17112 esac
17113 else
17114 $cat >&4 <<EOM
17115All is futile. Even fflush(stdin) clobbers input pipes!
17116EOM
17117 fflushall="$undef"
17118 fi
17119 else
17120 fflushall="$undef"
17121 fi
17122 $rm -f core tryp.c tryp.core core.tryp.*
17123 ;;
17124*) fflushall="$undef"
17125 ;;
17126esac
17127
17128case "$fflushNULL$fflushall" in
17129undefundef)
17130 $cat <<EOM
17131OK, I give up. I cannot figure out how to flush pending stdio output.
17132We won't be flushing handles at all before fork/exec/popen.
17133EOM
17134 ;;
17135esac
17136$rm -f try.* try$exe_ext
17137
17138: Store the full pathname to the ar program for use in the C program
17139: Respect a hint or command line value for full_ar.
17140case "$full_ar" in
17141'') full_ar=$ar ;;
17142esac
17143
17144: Store the full pathname to the sed program for use in the C program
17145full_sed=$sed
17146
17147: see what type gids are declared as in the kernel
17148echo " "
17149echo "Looking for the type for group ids returned by getgid()."
17150set gid_t gidtype xxx stdio.h sys/types.h
17151eval $typedef
17152case "$gidtype" in
17153xxx)
17154 xxx=`./findhdr sys/user.h`
17155 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17156 case $1 in
17157 unsigned) dflt="$1 $2" ;;
17158 *) dflt="$1" ;;
17159 esac
17160 ;;
17161*) dflt="$gidtype";;
17162esac
17163case "$gidtype" in
17164gid_t) echo "gid_t found." ;;
17165*) rp="What is the type for group ids returned by getgid()?"
17166 . ./myread
17167 gidtype="$ans"
17168 ;;
17169esac
17170
17171echo " "
17172case "$gidtype" in
17173*_t) zzz="$gidtype" ;;
17174*) zzz="gid" ;;
17175esac
17176echo "Checking the size of $zzz..." >&4
17177cat > try.c <<EOCP
17178#include <sys/types.h>
17179#include <stdio.h>
17180int main() {
17181 printf("%d\n", (int)sizeof($gidtype));
17182 exit(0);
17183}
17184EOCP
17185set try
17186if eval $compile_ok; then
5440bc8e 17187 yyy=`$run ./try`
b4eb6b3d
JH
17188 case "$yyy" in
17189 '') gidsize=4
17190 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17191 ;;
17192 *) gidsize=$yyy
17193 echo "Your $zzz is $gidsize bytes long."
17194 ;;
17195 esac
17196else
17197 gidsize=4
17198 echo "(I can't compile the test program--guessing $gidsize.)" >&4
17199fi
17200
17201
17202echo " "
17203case "$gidtype" in
17204*_t) zzz="$gidtype" ;;
17205*) zzz="gid" ;;
17206esac
17207echo "Checking the sign of $zzz..." >&4
17208cat > try.c <<EOCP
17209#include <sys/types.h>
17210#include <stdio.h>
17211int main() {
17212 $gidtype foo = -1;
17213 if (foo < 0)
17214 printf("-1\n");
17215 else
17216 printf("1\n");
17217}
17218EOCP
17219set try
17220if eval $compile; then
5440bc8e 17221 yyy=`$run ./try`
b4eb6b3d
JH
17222 case "$yyy" in
17223 '') gidsign=1
17224 echo "(I can't execute the test program--guessing unsigned.)" >&4
17225 ;;
17226 *) gidsign=$yyy
17227 case "$gidsign" in
17228 1) echo "Your $zzz is unsigned." ;;
17229 -1) echo "Your $zzz is signed." ;;
17230 esac
17231 ;;
17232 esac
17233else
17234 gidsign=1
17235 echo "(I can't compile the test program--guessing unsigned.)" >&4
17236fi
17237
17238
17239echo " "
17240
17241if $test X"$quadtype" != X; then
17242
17243echo "Checking how to print 64-bit integers..." >&4
17244
17245if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17246 $cat >try.c <<'EOCP'
17247#include <sys/types.h>
17248#include <stdio.h>
17249int main() {
17250 int q = 12345678901;
17251 printf("%ld\n", q);
17252}
17253EOCP
17254 set try
17255 if eval $compile; then
5440bc8e 17256 yyy=`$run ./try`
b4eb6b3d
JH
17257 case "$yyy" in
17258 12345678901)
17259 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17260 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17261 echo "We will use %d."
17262 ;;
17263 esac
17264 fi
17265fi
17266
17267if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17268 $cat >try.c <<'EOCP'
17269#include <sys/types.h>
17270#include <stdio.h>
17271int main() {
17272 long q = 12345678901;
17273 printf("%ld\n", q);
17274}
17275EOCP
17276 set try
17277 if eval $compile; then
5440bc8e 17278 yyy=`$run ./try`
b4eb6b3d
JH
17279 case "$yyy" in
17280 12345678901)
17281 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17282 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17283 echo "We will use %ld."
17284 ;;
17285 esac
17286 fi
17287fi
17288
17289if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17290 $cat >try.c <<'EOCP'
17291#include <sys/types.h>
17292#include <inttypes.h>
17293#include <stdio.h>
17294int main() {
17295 int64_t q = 12345678901;
17296 printf("%" PRId64 "\n", q);
17297}
17298EOCP
17299 set try
17300 if eval $compile; then
5440bc8e 17301 yyy=`$run ./try`
b4eb6b3d
JH
17302 case "$yyy" in
17303 12345678901)
17304 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17305 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17306 echo "We will use the C9X style."
17307 ;;
17308 esac
17309 fi
17310fi
17311
2ef53570
JH
17312if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17313 $cat >try.c <<EOCP
b4eb6b3d
JH
17314#include <sys/types.h>
17315#include <stdio.h>
17316int main() {
2ef53570
JH
17317 $quadtype q = 12345678901;
17318 printf("%Ld\n", q);
b4eb6b3d
JH
17319}
17320EOCP
17321 set try
17322 if eval $compile; then
5440bc8e 17323 yyy=`$run ./try`
b4eb6b3d
JH
17324 case "$yyy" in
17325 12345678901)
2ef53570
JH
17326 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17327 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17328 echo "We will use %Ld."
b4eb6b3d
JH
17329 ;;
17330 esac
17331 fi
17332fi
17333
2ef53570
JH
17334if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17335 $cat >try.c <<'EOCP'
b4eb6b3d
JH
17336#include <sys/types.h>
17337#include <stdio.h>
17338int main() {
2ef53570
JH
17339 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17340 printf("%lld\n", q);
b4eb6b3d
JH
17341}
17342EOCP
17343 set try
17344 if eval $compile; then
5440bc8e 17345 yyy=`$run ./try`
b4eb6b3d
JH
17346 case "$yyy" in
17347 12345678901)
2ef53570
JH
17348 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17349 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17350 echo "We will use the %lld style."
b4eb6b3d
JH
17351 ;;
17352 esac
17353 fi
17354fi
17355
17356if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17357 $cat >try.c <<EOCP
17358#include <sys/types.h>
17359#include <stdio.h>
17360int main() {
17361 $quadtype q = 12345678901;
17362 printf("%qd\n", q);
17363}
17364EOCP
17365 set try
17366 if eval $compile; then
5440bc8e 17367 yyy=`$run ./try`
b4eb6b3d
JH
17368 case "$yyy" in
17369 12345678901)
17370 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17371 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17372 echo "We will use %qd."
17373 ;;
17374 esac
17375 fi
17376fi
17377
17378if $test X"$sPRId64" = X; then
17379 echo "Cannot figure out how to print 64-bit integers." >&4
17380fi
17381
17382$rm -f try try.*
17383
17384fi
17385
17386case "$sPRId64" in
17387'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
17388 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
17389 ;;
17390*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
17391 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
17392 ;;
17393esac
17394
17395
17396echo " "
17397$echo "Checking the format strings to be used for Perl's internal types..." >&4
17398
17399if $test X"$ivsize" = X8; then
17400 ivdformat="$sPRId64"
17401 uvuformat="$sPRIu64"
17402 uvoformat="$sPRIo64"
17403 uvxformat="$sPRIx64"
17404 uvXUformat="$sPRIXU64"
17405else
17406 if $test X"$ivsize" = X"$longsize"; then
17407 ivdformat='"ld"'
17408 uvuformat='"lu"'
17409 uvoformat='"lo"'
17410 uvxformat='"lx"'
17411 uvXUformat='"lX"'
17412 else
17413 if $test X"$ivsize" = X"$intsize"; then
17414 ivdformat='"d"'
17415 uvuformat='"u"'
17416 uvoformat='"o"'
17417 uvxformat='"x"'
17418 uvXUformat='"X"'
17419 else
17420 : far out
17421 if $test X"$ivsize" = X"$shortsize"; then
17422 ivdformat='"hd"'
17423 uvuformat='"hu"'
17424 uvoformat='"ho"'
17425 uvxformat='"hx"'
17426 uvXUformat='"hX"'
17427 fi
17428 fi
17429 fi
17430fi
17431
17432if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17433 nveformat="$sPRIeldbl"
17434 nvfformat="$sPRIfldbl"
17435 nvgformat="$sPRIgldbl"
17436 nvEUformat="$sPRIEUldbl"
17437 nvFUformat="$sPRIFUldbl"
17438 nvGUformat="$sPRIGUldbl"
17439else
17440 nveformat='"e"'
17441 nvfformat='"f"'
17442 nvgformat='"g"'
17443 nvEUformat='"E"'
17444 nvFUformat='"F"'
17445 nvGUformat='"G"'
17446fi
17447
17448case "$ivdformat" in
3c728e00 17449'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
17450 exit 1
17451 ;;
17452esac
17453
17454
17455echo " "
17456$echo "Checking the format string to be used for gids..." >&4
17457
17458case "$gidsign" in
17459-1) if $test X"$gidsize" = X"$ivsize"; then
17460 gidformat="$ivdformat"
17461 else
17462 if $test X"$gidsize" = X"$longsize"; then
17463 gidformat='"ld"'
17464 else
17465 if $test X"$gidsize" = X"$intsize"; then
17466 gidformat='"d"'
17467 else
17468 if $test X"$gidsize" = X"$shortsize"; then
17469 gidformat='"hd"'
17470 fi
17471 fi
17472 fi
17473 fi
17474 ;;
17475*) if $test X"$gidsize" = X"$uvsize"; then
17476 gidformat="$uvuformat"
17477 else
17478 if $test X"$gidsize" = X"$longsize"; then
17479 gidformat='"lu"'
17480 else
17481 if $test X"$gidsize" = X"$intsize"; then
17482 gidformat='"u"'
17483 else
17484 if $test X"$gidsize" = X"$shortsize"; then
17485 gidformat='"hu"'
17486 fi
17487 fi
17488 fi
17489 fi
17490 ;;
17491esac
17492
17493: see if getgroups exists
17494set getgroups d_getgrps
17495eval $inlibc
17496
17497: see if setgroups exists
17498set setgroups d_setgrps
17499eval $inlibc
17500
17501
17502: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17503echo " "
17504case "$d_getgrps$d_setgrps" in
17505*define*)
17506 case "$groupstype" in
17507 '') dflt="$gidtype" ;;
17508 *) dflt="$groupstype" ;;
17509 esac
17510 $cat <<EOM
17511What type of pointer is the second argument to getgroups() and setgroups()?
17512Usually this is the same as group ids, $gidtype, but not always.
17513
17514EOM
17515 rp='What type pointer is the second argument to getgroups() and setgroups()?'
17516 . ./myread
17517 groupstype="$ans"
17518 ;;
17519*) groupstype="$gidtype";;
17520esac
17521
17522echo " "
17523echo "Checking if your $make program sets \$(MAKE)..." >&4
17524case "$make_set_make" in
17525'')
17526 $sed 's/^X //' > testmake.mak << 'EOF'
17527Xall:
17528X @echo 'maketemp="$(MAKE)"'
17529EOF
17530 case "`$make -f testmake.mak 2>/dev/null`" in
17531 *maketemp=*) make_set_make='#' ;;
17532 *) make_set_make="MAKE=$make" ;;
17533 esac
17534 $rm -f testmake.mak
17535 ;;
17536esac
17537case "$make_set_make" in
17538'#') echo "Yup, it does.";;
17539*) echo "Nope, it doesn't.";;
17540esac
17541
17542: see what type is used for mode_t
17543rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17544set mode_t modetype int stdio.h sys/types.h
17545eval $typedef_ask
17546
2cc61e15
DD
17547: see if stdarg is available
17548echo " "
17549if $test `./findhdr stdarg.h`; then
17550 echo "<stdarg.h> found." >&4
17551 valstd="$define"
17552else
17553 echo "<stdarg.h> NOT found." >&4
17554 valstd="$undef"
17555fi
17556
17557: see if varags is available
17558echo " "
17559if $test `./findhdr varargs.h`; then
17560 echo "<varargs.h> found." >&4
17561else
17562 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17563fi
17564
17565: set up the varargs testing programs
17566$cat > varargs.c <<EOP
17567#ifdef I_STDARG
17568#include <stdarg.h>
17569#endif
17570#ifdef I_VARARGS
17571#include <varargs.h>
17572#endif
17573
17574#ifdef I_STDARG
17575int f(char *p, ...)
17576#else
17577int f(va_alist)
17578va_dcl
17579#endif
17580{
17581 va_list ap;
17582#ifndef I_STDARG
17583 char *p;
17584#endif
17585#ifdef I_STDARG
17586 va_start(ap,p);
17587#else
17588 va_start(ap);
17589 p = va_arg(ap, char *);
17590#endif
17591 va_end(ap);
17592}
17593EOP
17594$cat > varargs <<EOP
17595$startsh
17596if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17597 echo "true"
17598else
17599 echo "false"
17600fi
17601$rm -f varargs$_o
17602EOP
17603chmod +x varargs
17604
17605: now check which varargs header should be included
17606echo " "
17607i_varhdr=''
17608case "$valstd" in
17609"$define")
17610 if `./varargs I_STDARG`; then
17611 val='stdarg.h'
17612 elif `./varargs I_VARARGS`; then
17613 val='varargs.h'
17614 fi
17615 ;;
17616*)
17617 if `./varargs I_VARARGS`; then
17618 val='varargs.h'
17619 fi
17620 ;;
17621esac
17622case "$val" in
17623'')
17624echo "I could not find the definition for va_dcl... You have problems..." >&4
17625 val="$undef"; set i_stdarg; eval $setvar
17626 val="$undef"; set i_varargs; eval $setvar
17627 ;;
17628*)
17629 set i_varhdr
17630 eval $setvar
17631 case "$i_varhdr" in
17632 stdarg.h)
17633 val="$define"; set i_stdarg; eval $setvar
17634 val="$undef"; set i_varargs; eval $setvar
17635 ;;
17636 varargs.h)
17637 val="$undef"; set i_stdarg; eval $setvar
17638 val="$define"; set i_varargs; eval $setvar
17639 ;;
17640 esac
17641 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17642esac
17643$rm -f varargs*
17644
17645: see if we need va_copy
17646echo " "
17647case "$i_stdarg" in
17648"$define")
17649 $cat >try.c <<EOCP
17650#include <stdarg.h>
17651#include <stdio.h>
85c8a686
DD
17652#$i_stdlib I_STDLIB
17653#ifdef I_STDLIB
17654#include <stdlib.h>
17655#endif
17656#include <signal.h>
2cc61e15
DD
17657
17658int
17659ivfprintf(FILE *f, const char *fmt, va_list *valp)
17660{
17661 return vfprintf(f, fmt, *valp);
17662}
17663
17664int
17665myvfprintf(FILE *f, const char *fmt, va_list val)
17666{
17667 return ivfprintf(f, fmt, &val);
17668}
17669
17670int
17671myprintf(char *fmt, ...)
17672{
17673 va_list val;
17674 va_start(val, fmt);
17675 return myvfprintf(stdout, fmt, val);
17676}
17677
17678int
17679main(int ac, char **av)
17680{
85c8a686
DD
17681 signal(SIGSEGV, exit);
17682
2cc61e15
DD
17683 myprintf("%s%cs all right, then\n", "that", '\'');
17684 exit(0);
17685}
17686EOCP
17687 set try
5440bc8e
JH
17688 if eval $compile && $run ./try 2>&1 >/dev/null; then
17689 case "`$run ./try`" in
2cc61e15
DD
17690 "that's all right, then")
17691 okay=yes
17692 ;;
17693 esac
17694 fi
17695 case "$okay" in
17696 yes) echo "It seems that you don't need va_copy()." >&4
17697 need_va_copy="$undef"
17698 ;;
17699 *) echo "It seems that va_copy() or similar will be needed." >&4
17700 need_va_copy="$define"
17701 ;;
17702 esac
17703 $rm -f try.* core core.* *.core *.core.*
17704 ;;
17705*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17706 ;;
17707esac
17708
b4eb6b3d
JH
17709: see what type is used for size_t
17710rp="What is the type used for the length parameter for string functions?"
17711set size_t sizetype 'unsigned int' stdio.h sys/types.h
17712eval $typedef_ask
17713
17714: check for type of arguments to gethostbyaddr.
17715if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17716 case "$d_gethbyaddr" in
17717 $define)
17718 $cat <<EOM
17719
17720Checking to see what type of arguments are accepted by gethostbyaddr().
17721EOM
17722 hdrs="$define sys/types.h
17723 $d_socket sys/socket.h
17724 $i_niin netinet/in.h
17725 $i_netdb netdb.h
17726 $i_unistd unistd.h"
17727 : The first arg can 'char *' or 'void *'
17728 : The second arg is some of integral type
17729 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17730 for yyy in size_t long int; do
17731 case "$netdb_host_type" in
17732 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17733 if ./protochk "$try" $hdrs; then
17734 echo "Your system accepts $xxx for the first arg."
17735 echo "...and $yyy for the second arg."
17736 netdb_host_type="$xxx"
17737 netdb_hlen_type="$yyy"
17738 fi
17739 ;;
17740 esac
17741 done
17742 done
17743 : In case none of those worked, prompt the user.
17744 case "$netdb_host_type" in
17745 '') rp='What is the type for the 1st argument to gethostbyaddr?'
17746 dflt='char *'
17747 . ./myread
17748 netdb_host_type=$ans
17749 rp='What is the type for the 2nd argument to gethostbyaddr?'
17750 dflt="$sizetype"
17751 . ./myread
17752 netdb_hlen_type=$ans
17753 ;;
17754 esac
17755 ;;
17756 *) : no gethostbyaddr, so pick harmless defaults
17757 netdb_host_type='char *'
17758 netdb_hlen_type="$sizetype"
17759 ;;
17760 esac
17761 # Remove the "const" if needed. -- but then we'll have a
17762 # prototype clash!
17763 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17764fi
17765
17766: check for type of argument to gethostbyname.
17767if test "X$netdb_name_type" = X ; then
17768 case "$d_gethbyname" in
17769 $define)
17770 $cat <<EOM
17771
17772Checking to see what type of argument is accepted by gethostbyname().
17773EOM
17774 hdrs="$define sys/types.h
17775 $d_socket sys/socket.h
17776 $i_niin netinet/in.h
17777 $i_netdb netdb.h
17778 $i_unistd unistd.h"
17779 for xxx in "const char *" "char *"; do
17780 case "$netdb_name_type" in
17781 '') try="extern struct hostent *gethostbyname($xxx);"
17782 if ./protochk "$try" $hdrs; then
17783 echo "Your system accepts $xxx."
17784 netdb_name_type="$xxx"
17785 fi
17786 ;;
17787 esac
17788 done
17789 : In case none of those worked, prompt the user.
17790 case "$netdb_name_type" in
17791 '') rp='What is the type for the 1st argument to gethostbyname?'
17792 dflt='char *'
17793 . ./myread
17794 netdb_name_type=$ans
17795 ;;
17796 esac
17797 ;;
17798 *) : no gethostbyname, so pick harmless default
17799 netdb_name_type='char *'
17800 ;;
17801 esac
17802fi
17803
17804: check for type of 1st argument to getnetbyaddr.
17805if test "X$netdb_net_type" = X ; then
17806 case "$d_getnbyaddr" in
17807 $define)
17808 $cat <<EOM
17809
17810Checking to see what type of 1st argument is accepted by getnetbyaddr().
17811EOM
17812 hdrs="$define sys/types.h
17813 $d_socket sys/socket.h
17814 $i_niin netinet/in.h
17815 $i_netdb netdb.h
17816 $i_unistd unistd.h"
17817 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17818 case "$netdb_net_type" in
17819 '') try="extern struct netent *getnetbyaddr($xxx, int);"
17820 if ./protochk "$try" $hdrs; then
17821 echo "Your system accepts $xxx."
17822 netdb_net_type="$xxx"
17823 fi
17824 ;;
17825 esac
17826 done
17827 : In case none of those worked, prompt the user.
17828 case "$netdb_net_type" in
17829 '') rp='What is the type for the 1st argument to getnetbyaddr?'
17830 dflt='long'
17831 . ./myread
17832 netdb_net_type=$ans
17833 ;;
17834 esac
17835 ;;
17836 *) : no getnetbyaddr, so pick harmless default
17837 netdb_net_type='long'
17838 ;;
17839 esac
17840fi
17841: locate the preferred pager for this system
17842case "$pager" in
17843'')
17844 dflt=''
17845 case "$pg" in
17846 /*) dflt=$pg;;
17847 [a-zA-Z]:/*) dflt=$pg;;
17848 esac
17849 case "$more" in
17850 /*) dflt=$more;;
17851 [a-zA-Z]:/*) dflt=$more;;
17852 esac
17853 case "$less" in
17854 /*) dflt=$less;;
17855 [a-zA-Z]:/*) dflt=$less;;
17856 esac
17857 case "$dflt" in
17858 '') dflt=/usr/ucb/more;;
17859 esac
17860 ;;
17861*) dflt="$pager";;
17862esac
17863echo " "
17864fn=f/
17865rp='What pager is used on your system?'
17866. ./getfile
17867pager="$ans"
17868
17869: see what type pids are declared as in the kernel
17870rp="What is the type of process ids on this system?"
17871set pid_t pidtype int stdio.h sys/types.h
17872eval $typedef_ask
17873
17874: Find earliest binary compatible site_perl subdirectory perl can use.
d953f698 17875xs_apiversion=$version # The current site_perl version.
b4eb6b3d
JH
17876: Find earliest pure perl site_perl subdirectory perl can use.
17877: The versioned directories started at 5.005.
17878pm_apiversion='5.005'
17879
b4eb6b3d
JH
17880: see if ar generates random libraries by itself
17881echo " "
17882echo "Checking how to generate random libraries on your machine..." >&4
17883echo 'int bar1() { return bar2(); }' > bar1.c
17884echo 'int bar2() { return 2; }' > bar2.c
17885$cat > foo.c <<'EOP'
17886int main() { printf("%d\n", bar1()); exit(0); }
17887EOP
17888$cc $ccflags -c bar1.c >/dev/null 2>&1
17889$cc $ccflags -c bar2.c >/dev/null 2>&1
17890$cc $ccflags -c foo.c >/dev/null 2>&1
17891$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 17892if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 17893 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
17894 echo "$ar appears to generate random libraries itself."
17895 orderlib=false
17896 ranlib=":"
17897elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 17898 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 17899 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
17900 echo "a table of contents needs to be added with '$ar ts'."
17901 orderlib=false
17902 ranlib="$ar ts"
17903else
17904 case "$ranlib" in
17905 :) ranlib='';;
17906 '')
17907 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17908 $test -f $ranlib || ranlib=''
17909 ;;
17910 esac
17911 if $test -n "$ranlib"; then
17912 echo "your system has '$ranlib'; we'll use that."
17913 orderlib=false
17914 else
17915 echo "your system doesn't seem to support random libraries"
17916 echo "so we'll use lorder and tsort to order the libraries."
17917 orderlib=true
17918 ranlib=":"
17919 fi
17920fi
17921$rm -f foo* bar*
17922
17923: check for type of arguments to select.
17924case "$selecttype" in
17925'') case "$d_select" in
17926 $define)
17927 echo " "
17928 $cat <<EOM
17929Checking to see what type of arguments are accepted by select().
17930EOM
17931 hdrs="$define sys/types.h
17932 $i_systime sys/time.h
17933 $i_sysselct sys/select.h
17934 $d_socket sys/socket.h"
17935 : The first arg can be int, unsigned, or size_t
17936 : The last arg may or may not be 'const'
17937 val=''
17938 : void pointer has been seen but using that
17939 : breaks the selectminbits test
17940 for xxx in 'fd_set *' 'int *'; do
17941 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17942 for tmo in 'struct timeval *' 'const struct timeval *'; do
17943 case "$val" in
17944 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17945 if ./protochk "$try" $hdrs; then
17946 echo "Your system accepts $xxx."
17947 val="$xxx"
17948 fi
17949 ;;
17950 esac
17951 done
17952 done
17953 done
17954 case "$val" in
17955 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17956 case "$d_fd_set" in
17957 $define) dflt="fd_set *" ;;
17958 *) dflt="int *" ;;
17959 esac
17960 . ./myread
17961 val=$ans
17962 ;;
17963 esac
17964 selecttype="$val"
17965 ;;
17966 *) : no select, so pick a harmless default
17967 selecttype='int *'
17968 ;;
17969 esac
17970 ;;
17971esac
17972
17973: check for the select 'width'
17974case "$selectminbits" in
17975'') case "$d_select" in
17976 $define)
17977 $cat <<EOM
17978
17979Checking to see on how many bits at a time your select() operates...
17980EOM
17981 $cat >try.c <<EOCP
17982#include <sys/types.h>
17983#$i_time I_TIME
17984#$i_systime I_SYS_TIME
17985#$i_systimek I_SYS_TIME_KERNEL
17986#ifdef I_TIME
17987# include <time.h>
17988#endif
17989#ifdef I_SYS_TIME
17990# ifdef I_SYS_TIME_KERNEL
17991# define KERNEL
17992# endif
17993# include <sys/time.h>
17994# ifdef I_SYS_TIME_KERNEL
17995# undef KERNEL
17996# endif
17997#endif
17998#$i_sysselct I_SYS_SELECT
17999#ifdef I_SYS_SELECT
18000#include <sys/select.h>
18001#endif
18002#$d_socket HAS_SOCKET
18003#ifdef HAS_SOCKET
18004# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18005#endif
18006#include <stdio.h>
18007$selecttype b;
18008#define S sizeof(*(b))
18009#define MINBITS 64
18010#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18011#define NBITS (NBYTES * 8)
18012int main() {
18013 char s[NBYTES];
18014 struct timeval t;
18015 int i;
18016 FILE* fp;
18017 int fd;
18018
18019 fclose(stdin);
18020 fp = fopen("try.c", "r");
18021 if (fp == 0)
18022 exit(1);
18023 fd = fileno(fp);
18024 if (fd < 0)
18025 exit(2);
18026 b = ($selecttype)s;
18027 for (i = 0; i < NBITS; i++)
18028 FD_SET(i, b);
18029 t.tv_sec = 0;
18030 t.tv_usec = 0;
18031 select(fd + 1, b, 0, 0, &t);
18032 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18033 printf("%d\n", i + 1);
18034 return 0;
18035}
18036EOCP
18037 set try
18038 if eval $compile_ok; then
5440bc8e 18039 selectminbits=`$run ./try`
b4eb6b3d
JH
18040 case "$selectminbits" in
18041 '') cat >&4 <<EOM
18042Cannot figure out on how many bits at a time your select() operates.
18043I'll play safe and guess it is 32 bits.
18044EOM
18045 selectminbits=32
18046 bits="32 bits"
18047 ;;
18048 1) bits="1 bit" ;;
18049 *) bits="$selectminbits bits" ;;
18050 esac
18051 echo "Your select() operates on $bits at a time." >&4
18052 else
18053 rp='What is the minimum number of bits your select() operates on?'
18054 case "$byteorder" in
18055 1234|12345678) dflt=32 ;;
18056 *) dflt=1 ;;
18057 esac
18058 . ./myread
18059 val=$ans
18060 selectminbits="$val"
18061 fi
18062 $rm -f try.* try
18063 ;;
18064 *) : no select, so pick a harmless default
18065 selectminbits='32'
18066 ;;
18067 esac
18068 ;;
18069esac
18070
18071: Trace out the files included by signal.h, then look for SIGxxx names.
18072: Remove SIGARRAYSIZE used by HPUX.
18073: Remove SIGSTKSIZE used by Linux.
18074: Remove SIGSTKSZ used by Posix.
18075: Remove SIGTYP void lines used by OS2.
18076: Some cpps, like os390, dont give the file name anywhere
18077if [ "X$fieldn" = X ]; then
18078 : Just make some guesses. We check them later.
18079 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18080else
18081 xxx=`echo '#include <signal.h>' |
18082 $cppstdin $cppminus $cppflags 2>/dev/null |
18083 $grep '^[ ]*#.*include' |
a938a3bb 18084 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
18085fi
18086: Check this list of files to be sure we have parsed the cpp output ok.
18087: This will also avoid potentially non-existent files, such
18088: as ../foo/bar.h
18089xxxfiles=''
18090for xx in $xxx /dev/null ; do
18091 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18092done
18093: If we have found no files, at least try signal.h
18094case "$xxxfiles" in
18095'') xxxfiles=`./findhdr signal.h` ;;
18096esac
18097xxx=`awk '
18098$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18099 print substr($2, 4, 20)
18100}
18101$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18102 print substr($3, 4, 20)
18103}' $xxxfiles`
18104: Append some common names just in case the awk scan failed.
18105xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18106xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18107xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18108xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18109xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18110
18111: generate a few handy files for later
18112$cat > signal.c <<'EOCP'
18113#include <sys/types.h>
18114#include <signal.h>
18115#include <stdio.h>
18116int main() {
18117
18118/* Strange style to avoid deeply-nested #if/#else/#endif */
18119#ifndef NSIG
18120# ifdef _NSIG
18121# define NSIG (_NSIG)
18122# endif
18123#endif
18124
18125#ifndef NSIG
18126# ifdef SIGMAX
18127# define NSIG (SIGMAX+1)
18128# endif
18129#endif
18130
18131#ifndef NSIG
18132# ifdef SIG_MAX
18133# define NSIG (SIG_MAX+1)
18134# endif
18135#endif
18136
18137#ifndef NSIG
18138# ifdef MAXSIG
18139# define NSIG (MAXSIG+1)
18140# endif
18141#endif
18142
18143#ifndef NSIG
18144# ifdef MAX_SIG
18145# define NSIG (MAX_SIG+1)
18146# endif
18147#endif
18148
18149#ifndef NSIG
18150# ifdef SIGARRAYSIZE
18151# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18152# endif
18153#endif
18154
18155#ifndef NSIG
18156# ifdef _sys_nsig
18157# define NSIG (_sys_nsig) /* Solaris 2.5 */
18158# endif
18159#endif
18160
18161/* Default to some arbitrary number that's big enough to get most
18162 of the common signals.
18163*/
18164#ifndef NSIG
18165# define NSIG 50
18166#endif
18167
18168printf("NSIG %d\n", NSIG);
18169
18170#ifndef JUST_NSIG
18171
18172EOCP
18173
18174echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18175{
18176 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 18177 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
18178 printf $1; printf ");\n"
18179 printf "#endif\n"
18180}
18181END {
18182 printf "#endif /* JUST_NSIG */\n";
18183 printf "exit(0);\n}\n";
18184}
18185' >>signal.c
18186$cat >signal.awk <<'EOP'
18187BEGIN { ndups = 0 }
65197d93
JH
18188$1 ~ /^NSIG$/ { nsig = $2 }
18189($1 !~ /^NSIG$/) && (NF == 2) {
18190 if ($2 > maxsig) { maxsig = $2 }
18191 if (sig_name[$2]) {
18192 dup_name[ndups] = $1
18193 dup_num[ndups] = $2
b4eb6b3d
JH
18194 ndups++
18195 }
18196 else {
65197d93
JH
18197 sig_name[$2] = $1
18198 sig_num[$2] = $2
b4eb6b3d
JH
18199 }
18200}
18201END {
18202 if (nsig == 0) {
18203 nsig = maxsig + 1
18204 }
18205 printf("NSIG %d\n", nsig);
18206 for (n = 1; n < nsig; n++) {
18207 if (sig_name[n]) {
18208 printf("%s %d\n", sig_name[n], sig_num[n])
18209 }
18210 else {
18211 printf("NUM%d %d\n", n, n)
18212 }
18213 }
18214 for (n = 0; n < ndups; n++) {
18215 printf("%s %d\n", dup_name[n], dup_num[n])
18216 }
18217}
18218EOP
18219$cat >signal_cmd <<EOS
18220$startsh
18221if $test -s signal.lst; then
18222 echo "Using your existing signal.lst file"
18223 exit 0
18224fi
18225xxx="$xxx"
18226EOS
18227$cat >>signal_cmd <<'EOS'
18228
18229set signal
18230if eval $compile_ok; then
1eb9ad5b 18231 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18232else
18233 echo "(I can't seem be able to compile the whole test program)" >&4
18234 echo "(I'll try it in little pieces.)" >&4
18235 set signal -DJUST_NSIG
18236 if eval $compile_ok; then
5440bc8e 18237 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
18238 $cat signal.nsg
18239 else
18240 echo "I can't seem to figure out how many signals you have." >&4
18241 echo "Guessing 50." >&4
18242 echo 'NSIG 50' > signal.nsg
18243 fi
18244 : Now look at all the signal names, one at a time.
18245 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18246 $cat > signal.c <<EOCP
18247#include <sys/types.h>
18248#include <signal.h>
18249#include <stdio.h>
18250int main() {
18251printf("$xx %d\n", SIG${xx});
18252return 0;
18253}
18254EOCP
18255 set signal
18256 if eval $compile; then
18257 echo "SIG${xx} found."
5440bc8e 18258 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
18259 else
18260 echo "SIG${xx} NOT found."
18261 fi
18262 done
18263 if $test -s signal.ls1; then
18264 $cat signal.nsg signal.ls1 |
65197d93 18265 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18266 fi
18267
18268fi
18269if $test -s signal.lst; then
18270 :
18271else
18272 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18273 echo 'kill -l' >signal
18274 set X `csh -f <signal`
18275 $rm -f signal
18276 shift
18277 case $# in
18278 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18279 esac
18280 echo $@ | $tr ' ' $trnl | \
18281 $awk '{ printf "%s %d\n", $1, ++s; }
18282 END { printf "NSIG %d\n", ++s }' >signal.lst
18283fi
18284$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18285EOS
18286chmod a+x signal_cmd
18287$eunicefix signal_cmd
18288
18289: generate list of signal names
18290echo " "
18291case "$sig_name_init" in
18292'') doinit=yes ;;
18293*) case "$sig_num_init" in
18294 ''|*,*) doinit=yes ;;
18295 esac ;;
18296esac
18297case "$doinit" in
18298yes)
18299 echo "Generating a list of signal names and numbers..." >&4
18300 . ./signal_cmd
18301 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18302 sig_name=`$awk 'BEGIN { printf "ZERO " }
18303 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18304 sig_num=`$awk 'BEGIN { printf "0 " }
18305 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18306 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
18307 !/^NSIG/ { printf "\"%s\", ", $1 }
18308 END { printf "0\n" }' signal.lst`
18309 sig_num_init=`$awk 'BEGIN { printf "0, " }
18310 !/^NSIG/ { printf "%d, ", $2}
18311 END { printf "0\n"}' signal.lst`
18312 ;;
18313esac
18314echo "The following $sig_count signals are available:"
18315echo " "
18316echo $sig_name | $awk \
18317'BEGIN { linelen = 0 }
18318{
18319 for (i = 1; i <= NF; i++) {
18320 name = "SIG" $i " "
18321 linelen = linelen + length(name)
18322 if (linelen > 70) {
18323 printf "\n"
18324 linelen = length(name)
18325 }
18326 printf "%s", name
18327 }
18328 printf "\n"
18329}'
76d3c696 18330sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
18331$rm -f signal signal.c signal.awk signal.lst signal_cmd
18332
18333echo " "
18334case "$sizetype" in
18335*_t) zzz="$sizetype" ;;
18336*) zzz="filesize" ;;
18337esac
18338echo "Checking the size of $zzz..." >&4
18339cat > try.c <<EOCP
18340#include <sys/types.h>
18341#include <stdio.h>
18342int main() {
18343 printf("%d\n", (int)sizeof($sizetype));
18344 exit(0);
18345}
18346EOCP
18347set try
18348if eval $compile_ok; then
5440bc8e 18349 yyy=`$run ./try`
b4eb6b3d
JH
18350 case "$yyy" in
18351 '') sizesize=4
18352 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18353 ;;
18354 *) sizesize=$yyy
18355 echo "Your $zzz size is $sizesize bytes."
18356 ;;
18357 esac
18358else
18359 sizesize=4
18360 echo "(I can't compile the test program--guessing $sizesize.)" >&4
18361fi
18362
18363
18364: check for socklen_t
18365echo " "
18366echo "Checking to see if you have socklen_t..." >&4
18367$cat >try.c <<EOCP
18368#include <sys/types.h>
18369#$d_socket HAS_SOCKET
18370#ifdef HAS_SOCKET
18371#include <sys/socket.h>
18372#endif
18373int main() { socklen_t x = 16; }
18374EOCP
18375set try
18376if eval $compile; then
18377 val="$define"
18378 echo "You have socklen_t."
18379else
18380 val="$undef"
18381 echo "You do not have socklen_t."
18382 case "$sizetype" in
18383 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18384 esac
18385fi
18386$rm -f try try.*
18387set d_socklen_t
18388eval $setvar
18389
a7710f8d
JH
18390: see if this is a socks.h system
18391set socks.h i_socks
18392eval $inhdr
18393
b4eb6b3d
JH
18394: check for type of the size argument to socket calls
18395case "$d_socket" in
18396"$define")
18397 $cat <<EOM
18398
18399Checking to see what type is the last argument of accept().
18400EOM
b4eb6b3d
JH
18401 yyy=''
18402 case "$d_socklen_t" in
18403 "$define") yyy="$yyy socklen_t"
18404 esac
18405 yyy="$yyy $sizetype int long unsigned"
18406 for xxx in $yyy; do
18407 case "$socksizetype" in
18408 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
18409 case "$usesocks" in
18410 "$define")
18411 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18412 echo "Your system accepts '$xxx *' for the last argument of accept()."
18413 socksizetype="$xxx"
18414 fi
18415 ;;
18416 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
18417 echo "Your system accepts '$xxx *' for the last argument of accept()."
18418 socksizetype="$xxx"
18419 fi
18420 ;;
18421 esac
b4eb6b3d
JH
18422 ;;
18423 esac
18424 done
18425: In case none of those worked, prompt the user.
18426 case "$socksizetype" in
18427 '') rp='What is the type for socket address structure sizes?'
18428 dflt='int'
18429 . ./myread
18430 socksizetype=$ans
18431 ;;
18432 esac
18433 ;;
18434*) : no sockets, so pick relatively harmless default
18435 socksizetype='int'
18436 ;;
18437esac
18438
18439: see what type is used for signed size_t
18440set ssize_t ssizetype int stdio.h sys/types.h
18441eval $typedef
18442dflt="$ssizetype"
5440bc8e 18443$cat > try.c <<EOM
b4eb6b3d
JH
18444#include <stdio.h>
18445#include <sys/types.h>
18446#define Size_t $sizetype
18447#define SSize_t $dflt
18448int main()
18449{
18450 if (sizeof(Size_t) == sizeof(SSize_t))
18451 printf("$dflt\n");
18452 else if (sizeof(Size_t) == sizeof(int))
18453 printf("int\n");
18454 else
18455 printf("long\n");
18456 exit(0);
18457}
18458EOM
18459echo " "
5440bc8e
JH
18460set try
18461if eval $compile_ok && $run ./try > /dev/null; then
18462 ssizetype=`$run ./try`
b4eb6b3d
JH
18463 echo "I'll be using $ssizetype for functions returning a byte count." >&4
18464else
18465 $cat >&4 <<EOM
18466Help! I can't compile and run the ssize_t test program: please enlighten me!
18467(This is probably a misconfiguration in your system or libraries, and
18468you really ought to fix it. Still, I'll try anyway.)
18469
18470I need a type that is the same size as $sizetype, but is guaranteed to
18471be signed. Common values are ssize_t, int and long.
18472
18473EOM
18474 rp="What signed type is the same size as $sizetype?"
18475 . ./myread
18476 ssizetype="$ans"
18477fi
5440bc8e 18478$rm -f try try.*
b4eb6b3d
JH
18479
18480: see what type of char stdio uses.
18481echo " "
aa517f50
JH
18482echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18483if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
18484 echo "Your stdio uses unsigned chars." >&4
18485 stdchar="unsigned char"
18486else
aa517f50
JH
18487 echo "Your stdio uses signed chars." >&4
18488 stdchar="char"
b4eb6b3d 18489fi
aa517f50
JH
18490$rm -f stdioh
18491
18492
b4eb6b3d 18493
b4eb6b3d
JH
18494: see what type uids are declared as in the kernel
18495echo " "
18496echo "Looking for the type for user ids returned by getuid()."
18497set uid_t uidtype xxx stdio.h sys/types.h
18498eval $typedef
18499case "$uidtype" in
18500xxx)
18501 xxx=`./findhdr sys/user.h`
18502 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18503 case $1 in
18504 unsigned) dflt="$1 $2" ;;
18505 *) dflt="$1" ;;
18506 esac
18507 ;;
18508*) dflt="$uidtype";;
18509esac
18510case "$uidtype" in
18511uid_t) echo "uid_t found." ;;
18512*) rp="What is the type for user ids returned by getuid()?"
18513 . ./myread
18514 uidtype="$ans"
18515 ;;
18516esac
18517
18518echo " "
18519case "$uidtype" in
18520*_t) zzz="$uidtype" ;;
18521*) zzz="uid" ;;
18522esac
18523echo "Checking the size of $zzz..." >&4
18524cat > try.c <<EOCP
18525#include <sys/types.h>
18526#include <stdio.h>
18527int main() {
18528 printf("%d\n", (int)sizeof($uidtype));
18529 exit(0);
18530}
18531EOCP
18532set try
18533if eval $compile_ok; then
5440bc8e 18534 yyy=`$run ./try`
b4eb6b3d
JH
18535 case "$yyy" in
18536 '') uidsize=4
18537 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18538 ;;
18539 *) uidsize=$yyy
18540 echo "Your $zzz is $uidsize bytes long."
18541 ;;
18542 esac
18543else
18544 uidsize=4
18545 echo "(I can't compile the test program--guessing $uidsize.)" >&4
18546fi
18547
18548echo " "
18549case "$uidtype" in
18550*_t) zzz="$uidtype" ;;
18551*) zzz="uid" ;;
18552esac
18553echo "Checking the sign of $zzz..." >&4
18554cat > try.c <<EOCP
18555#include <sys/types.h>
18556#include <stdio.h>
18557int main() {
18558 $uidtype foo = -1;
18559 if (foo < 0)
18560 printf("-1\n");
18561 else
18562 printf("1\n");
18563}
18564EOCP
18565set try
18566if eval $compile; then
5440bc8e 18567 yyy=`$run ./try`
b4eb6b3d
JH
18568 case "$yyy" in
18569 '') uidsign=1
18570 echo "(I can't execute the test program--guessing unsigned.)" >&4
18571 ;;
18572 *) uidsign=$yyy
18573 case "$uidsign" in
18574 1) echo "Your $zzz is unsigned." ;;
18575 -1) echo "Your $zzz is signed." ;;
18576 esac
18577 ;;
18578 esac
18579else
18580 uidsign=1
18581 echo "(I can't compile the test program--guessing unsigned.)" >&4
18582fi
18583
18584
18585
18586echo " "
18587$echo "Checking the format string to be used for uids..." >&4
18588
18589case "$uidsign" in
18590-1) if $test X"$uidsize" = X"$ivsize"; then
18591 uidformat="$ivdformat"
18592 else
18593 if $test X"$uidsize" = X"$longsize"; then
18594 uidformat='"ld"'
18595 else
18596 if $test X"$uidsize" = X"$intsize"; then
18597 uidformat='"d"'
18598 else
18599 if $test X"$uidsize" = X"$shortsize"; then
18600 uidformat='"hd"'
18601 fi
18602 fi
18603 fi
18604 fi
18605 ;;
18606*) if $test X"$uidsize" = X"$uvsize"; then
18607 uidformat="$uvuformat"
18608 else
18609 if $test X"$uidsize" = X"$longsize"; then
18610 uidformat='"lu"'
18611 else
18612 if $test X"$uidsize" = X"$intsize"; then
18613 uidformat='"u"'
18614 else
18615 if $test X"$uidsize" = X"$shortsize"; then
18616 uidformat='"hu"'
18617 fi
18618 fi
18619 fi
18620 fi
18621 ;;
18622esac
18623
3659ebf1
JH
18624: determine compiler compiler
18625case "$yacc" in
18626'')
18627 dflt=yacc;;
18628*)
18629 dflt="$yacc";;
18630esac
18631echo " "
18632comp='yacc'
3c728e00 18633if $test -f "$byacc$_exe"; then
3659ebf1
JH
18634 dflt="$byacc"
18635 comp="byacc or $comp"
18636fi
3c728e00 18637if $test -f "$bison$_exe"; then
3659ebf1
JH
18638 comp="$comp or bison -y"
18639fi
18640rp="Which compiler compiler ($comp) shall I use?"
18641. ./myread
18642yacc="$ans"
18643case "$yacc" in
18644*bis*)
18645 case "$yacc" in
18646 *-y*) ;;
18647 *)
18648 yacc="$yacc -y"
18649 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18650 ;;
18651 esac
18652 ;;
18653esac
18654
758a5d79
JH
18655: see if this is a fp.h system
18656set fp.h i_fp
18657eval $inhdr
18658
18659: see if this is a fp_class.h system
18660set fp_class.h i_fp_class
18661eval $inhdr
18662
b4eb6b3d 18663: see if this is a ieeefp.h system
b5b9f165
JH
18664case "$i_ieeefp" in
18665'' ) set ieeefp.h i_ieeefp
18666 eval $inhdr
18667 ;;
18668esac
b4eb6b3d
JH
18669
18670: see if this is a libutil.h system
18671set libutil.h i_libutil
18672eval $inhdr
18673
b4eb6b3d
JH
18674: see if mach cthreads are available
18675if test "X$usethreads" = "X$define"; then
18676 set mach/cthreads.h i_machcthr
18677 eval $inhdr
18678else
18679 i_machcthr="$undef"
18680fi
18681
18682
18683
18684: see if this is a math.h system
18685set math.h i_math
18686eval $inhdr
18687
18688: see if this is a mntent.h system
18689set mntent.h i_mntent
18690eval $inhdr
18691
18692: see if ndbm.h is available
18693set ndbm.h t_ndbm
18694eval $inhdr
1c6861ad
JS
18695
18696case "$t_ndbm" in
18697$undef)
18698 # Some Linux distributions such as RedHat 7.1 put the
18699 # ndbm.h header in /usr/include/gdbm/ndbm.h.
18700 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 18701 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
18702 ccflags="$ccflags -I/usr/include/gdbm"
18703 cppflags="$cppflags -I/usr/include/gdbm"
18704 t_ndbm=$define
18705 fi
18706 ;;
18707esac
18708
b4eb6b3d
JH
18709case "$t_ndbm" in
18710$define)
18711 : see if dbm_open exists
18712 set dbm_open d_dbm_open
18713 eval $inlibc
18714 case "$d_dbm_open" in
18715 $undef)
18716 t_ndbm="$undef"
18717 echo "We won't be including <ndbm.h>"
18718 ;;
18719 esac
18720 ;;
18721esac
18722val="$t_ndbm"
18723set i_ndbm
18724eval $setvar
18725
18726: see if net/errno.h is available
18727val=''
18728set net/errno.h val
18729eval $inhdr
18730
18731: Unfortunately, it causes problems on some systems. Arrgh.
18732case "$val" in
18733$define)
18734 cat > try.c <<'EOM'
18735#include <stdio.h>
18736#include <errno.h>
18737#include <net/errno.h>
18738int func()
18739{
18740 return ENOTSOCK;
18741}
18742EOM
18743 if $cc $ccflags -c try.c >/dev/null 2>&1; then
18744 echo "We'll be including <net/errno.h>." >&4
18745 else
18746 echo "We won't be including <net/errno.h>." >&4
18747 val="$undef"
18748 fi
18749 $rm -f try.* try
18750 ;;
18751esac
18752set i_neterrno
18753eval $setvar
18754
18755: see if netinet/tcp.h is available
18756set netinet/tcp.h i_netinettcp
18757eval $inhdr
18758
18759: see if this is a poll.h system
18760set poll.h i_poll
18761eval $inhdr
18762
18763: see if this is a prot.h system
18764set prot.h i_prot
18765eval $inhdr
18766
18767echo " "
18768$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
18769$cat <<'EOSH' > Cppsym.know
18770a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18771AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
18772alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18773ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18774BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
18775BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18776bull c cadmus clipper CMU COFF COMPILER_VERSION
18777concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18778CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
18779Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18780FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18781GLIBC GLIBC_MINOR
18782GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
18783H3050R H3050RX hbullx20 hcx host_mips
18784hp200 hp300 hp700 HP700 hp800 hp9000
18785hp9000s200 hp9000s300 hp9000s400 hp9000s500
18786hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18787i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 18788IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
18789INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18790LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18791LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18792Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18793LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18794M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18795M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18796M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18797MATH_HAS_NO_SIDE_EFFECTS
18798mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18799mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18800mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18801MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18802mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18803NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 18804news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
18805ns32016 ns32332 ns32k nsc32000
18806OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18807pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18808pc532 pdp11 PGC PIC plexus PORTAR posix
18809POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18810POSIX_C_SOURCE POSIX_SOURCE POWER
18811PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 18812riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
18813SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18814sony sony_news sonyrisc sparc sparclite spectrum
18815stardent stdc STDC_EXT stratos sun sun3 sun386
18816Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18817SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18818SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18819sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 18820TM3200 TM5400 TM5600
b4eb6b3d
JH
18821tower tower32 tower32_200 tower32_600 tower32_700
18822tower32_800 tower32_850 tss
18823u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18824ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
18825unix UNIX95 UNIX99 unixpc unos
18826USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18827USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18828USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18829USGr4 USGr4_2
b4eb6b3d
JH
18830Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18831XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18832XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18833z8000
18834EOSH
18835# Maybe put other stuff here too.
18836cat <<EOSH >>Cppsym.know
18837$osname
18838EOSH
18839./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18840./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18841$cat Cppsym.know > Cppsym.c
381aa1ff 18842$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
18843$rm -f Cppsym.a Cppsym.b Cppsym.c
18844cat <<EOSH > Cppsym
18845$startsh
18846if $test \$# -gt 0; then
18847 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18848 if $test -s Cppsym.got; then
18849 $rm -f Cppsym.got
18850 exit 0
18851 fi
18852 $rm -f Cppsym.got
18853 exit 1
18854else
18855 $tr " " "$trnl" | ./Cppsym.try
18856 exit 0
18857fi
18858EOSH
18859chmod +x Cppsym
18860$eunicefix Cppsym
18861cat <<EOSH > Cppsym.try
18862$startsh
18863cat <<'EOCP' > try.c
18864#include <stdio.h>
18865int main() {
18866EOCP
18867$awk \\
18868EOSH
18869cat <<'EOSH' >> Cppsym.try
18870'length($1) > 0 {
2ef53570
JH
18871 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
18872 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
18873 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
18874 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 18875}' >> try.c
2ef53570 18876echo 'return 0;}' >> try.c
b4eb6b3d
JH
18877EOSH
18878cat <<EOSH >> Cppsym.try
18879ccflags="$ccflags"
18880case "$osname-$gccversion" in
18881irix-) ccflags="\$ccflags -woff 1178" ;;
18882os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18883esac
5440bc8e 18884$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
18885EOSH
18886chmod +x Cppsym.try
18887$eunicefix Cppsym.try
18888./Cppsym < Cppsym.know > Cppsym.true
18889: now check the C compiler for additional symbols
18890postprocess_cc_v=''
18891case "$osname" in
18892aix) postprocess_cc_v="|$tr , ' '" ;;
18893esac
18894$cat >ccsym <<EOS
18895$startsh
18896$cat >tmp.c <<EOF
18897extern int foo;
18898EOF
18899for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18900do
18901 case "\$i" in
18902 -D*) echo "\$i" | $sed 's/^-D//';;
18903 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
18904 esac
18905done
18906$rm -f try.c
18907EOS
18908postprocess_cc_v=''
18909chmod +x ccsym
18910$eunicefix ccsym
18911./ccsym > ccsym1.raw
18912if $test -s ccsym1.raw; then
18913 $sort ccsym1.raw | $uniq >ccsym.raw
18914else
18915 mv ccsym1.raw ccsym.raw
18916fi
18917
18918$awk '/\=/ { print $0; next }
18919 { print $0"=1" }' ccsym.raw >ccsym.list
18920$awk '/\=/ { print $0; next }
18921 { print $0"=1" }' Cppsym.true >ccsym.true
18922$comm -13 ccsym.true ccsym.list >ccsym.own
18923$comm -12 ccsym.true ccsym.list >ccsym.com
18924$comm -23 ccsym.true ccsym.list >ccsym.cpp
18925also=''
18926if $test -z ccsym.raw; then
18927 echo "Your C compiler doesn't seem to define any symbols!" >&4
18928 echo " "
18929 echo "However, your C preprocessor defines the following symbols:"
18930 $cat Cppsym.true
18931 ccsymbols=''
18932 cppsymbols=`$cat Cppsym.true`
18933 cppsymbols=`echo $cppsymbols`
18934 cppccsymbols="$cppsymbols"
18935else
18936 if $test -s ccsym.com; then
18937 echo "Your C compiler and pre-processor define these symbols:"
18938 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18939 also='also '
18940 symbols='ones'
18941 cppccsymbols=`$cat ccsym.com`
18942 cppccsymbols=`echo $cppccsymbols`
18943 $test "$silent" || sleep 1
18944 fi
18945 if $test -s ccsym.cpp; then
18946 $test "$also" && echo " "
18947 echo "Your C pre-processor ${also}defines the following symbols:"
18948 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18949 also='further '
18950 cppsymbols=`$cat ccsym.cpp`
18951 cppsymbols=`echo $cppsymbols`
18952 $test "$silent" || sleep 1
18953 fi
18954 if $test -s ccsym.own; then
18955 $test "$also" && echo " "
18956 echo "Your C compiler ${also}defines the following cpp symbols:"
18957 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18958 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18959 ccsymbols=`$cat ccsym.own`
18960 ccsymbols=`echo $ccsymbols`
18961 $test "$silent" || sleep 1
18962 fi
18963fi
b4eb6b3d
JH
18964
18965: see if this is a termio system
18966val="$undef"
18967val2="$undef"
18968val3="$undef"
18969if $test `./findhdr termios.h`; then
18970 set tcsetattr i_termios
18971 eval $inlibc
18972 val3="$i_termios"
18973fi
18974echo " "
18975case "$val3" in
18976"$define") echo "You have POSIX termios.h... good!" >&4;;
18977*) if ./Cppsym pyr; then
18978 case "`/bin/universe`" in
18979 ucb) if $test `./findhdr sgtty.h`; then
18980 val2="$define"
18981 echo "<sgtty.h> found." >&4
18982 else
18983 echo "System is pyramid with BSD universe."
18984 echo "<sgtty.h> not found--you could have problems." >&4
18985 fi;;
18986 *) if $test `./findhdr termio.h`; then
18987 val="$define"
18988 echo "<termio.h> found." >&4
18989 else
18990 echo "System is pyramid with USG universe."
18991 echo "<termio.h> not found--you could have problems." >&4
18992 fi;;
18993 esac
18994 elif ./usg; then
18995 if $test `./findhdr termio.h`; then
18996 echo "<termio.h> found." >&4
18997 val="$define"
18998 elif $test `./findhdr sgtty.h`; then
18999 echo "<sgtty.h> found." >&4
19000 val2="$define"
19001 else
19002echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19003 fi
19004 else
19005 if $test `./findhdr sgtty.h`; then
19006 echo "<sgtty.h> found." >&4
19007 val2="$define"
19008 elif $test `./findhdr termio.h`; then
19009 echo "<termio.h> found." >&4
19010 val="$define"
19011 else
19012echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19013 fi
19014 fi;;
19015esac
19016set i_termio; eval $setvar
19017val=$val2; set i_sgtty; eval $setvar
19018val=$val3; set i_termios; eval $setvar
19019
b4eb6b3d
JH
19020: see if stddef is available
19021set stddef.h i_stddef
19022eval $inhdr
923fc586 19023
b4eb6b3d
JH
19024: see if this is a sunmath.h system
19025set sunmath.h i_sunmath
19026eval $inhdr
5f80c64f 19027
b4eb6b3d
JH
19028: see if sys/access.h is available
19029set sys/access.h i_sysaccess
19030eval $inhdr
19031
19032: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19033set sys/filio.h i_sysfilio
19034eval $inhdr
19035echo " "
19036if $test `./findhdr sys/ioctl.h`; then
19037 val="$define"
19038 echo '<sys/ioctl.h> found.' >&4
19039else
19040 val="$undef"
19041 if $test $i_sysfilio = "$define"; then
19042 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 19043 else
b4eb6b3d
JH
19044 $test $i_sgtty = "$define" && xxx="sgtty.h"
19045 $test $i_termio = "$define" && xxx="termio.h"
19046 $test $i_termios = "$define" && xxx="termios.h"
19047echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19048 fi
19049fi
19050set i_sysioctl
19051eval $setvar
19052
49a78c82
JH
19053: see if socket ioctl defs are in sys/sockio.h
19054echo " "
19055xxx=`./findhdr sys/sockio.h`
19056if $test "$xxx"; then
19057 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19058 val="$define"
19059 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19060 else
19061 val="$undef"
19062 echo "No socket ioctls found in <sys/sockio.h>." >&4
19063 fi
19064else
19065 val="$undef"
19066 $cat <<EOM
19067<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19068EOM
19069fi
19070set i_syssockio
19071eval $setvar
19072
b4eb6b3d
JH
19073
19074: see if this is a syslog.h system
19075set syslog.h i_syslog
19076eval $inhdr
19077
19078
19079: see if this is a sys/mode.h system
19080set sys/mode.h i_sysmode
19081eval $inhdr
19082
19083: see if sys/resource.h has to be included
19084set sys/resource.h i_sysresrc
19085eval $inhdr
19086
19087: see if sys/security.h is available
19088set sys/security.h i_syssecrt
19089eval $inhdr
19090
19091: see if this is a sys/statvfs.h system
19092set sys/statvfs.h i_sysstatvfs
19093eval $inhdr
19094
b4eb6b3d
JH
19095: see if this is a sys/un.h system
19096set sys/un.h i_sysun
19097eval $inhdr
19098
19099
19100: see if this is a sys/utsname.h system
19101set sys/utsname.h i_sysutsname
19102eval $inhdr
19103
19104: see if this is a syswait system
19105set sys/wait.h i_syswait
19106eval $inhdr
19107
19108: see if this is a ustat.h system
19109set ustat.h i_ustat
19110eval $inhdr
19111
19112: see if this is an utime system
19113set utime.h i_utime
19114eval $inhdr
19115
19116: see if this is a values.h system
19117set values.h i_values
19118eval $inhdr
19119
19120: see if this is a vfork system
19121case "$d_vfork" in
19122"$define")
19123 set vfork.h i_vfork
19124 eval $inhdr
19125 ;;
19126*)
19127 i_vfork="$undef"
19128 ;;
19129esac
19130
19131: see if gdbm.h is available
19132set gdbm.h t_gdbm
19133eval $inhdr
19134case "$t_gdbm" in
19135$define)
19136 : see if gdbm_open exists
19137 set gdbm_open d_gdbm_open
19138 eval $inlibc
19139 case "$d_gdbm_open" in
19140 $undef)
19141 t_gdbm="$undef"
19142 echo "We won't be including <gdbm.h>"
5f80c64f 19143 ;;
b4eb6b3d
JH
19144 esac
19145 ;;
19146esac
19147val="$t_gdbm"
19148set i_gdbm
19149eval $setvar
19150
19151echo " "
19152echo "Looking for extensions..." >&4
19153: If we are using the old config.sh, known_extensions may contain
19154: old or inaccurate or duplicate values.
19155known_extensions=''
19156nonxs_extensions=''
19157: We do not use find because it might not be available.
19158: We do not just use MANIFEST because the user may have dropped
19159: some additional extensions into the source tree and expect them
19160: to be built.
19161
19162: Function to recursively find available extensions, ignoring DynaLoader
19163: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19164find_extensions='
19165 for xxx in *; do
19166 case "$xxx" in
19167 DynaLoader|dynaload) ;;
19168 *)
19169 if $test -f $xxx/$xxx.xs; then
19170 known_extensions="$known_extensions $1$xxx";
19171 elif $test -f $xxx/Makefile.PL; then
19172 nonxs_extensions="$nonxs_extensions $1$xxx";
19173 else
19174 if $test -d $xxx -a $# -lt 10; then
19175 set $1$xxx/ $*;
6904989c 19176 cd "$xxx";
b4eb6b3d
JH
19177 eval $find_extensions;
19178 cd ..;
19179 shift;
19180 fi;
19181 fi
19182 ;;
19183 esac;
19184 done'
19185tdir=`pwd`
6904989c 19186cd "$rsrc/ext"
b4eb6b3d
JH
19187set X
19188shift
19189eval $find_extensions
4e1a6d26
AD
19190# Special case: Add in threads/shared since it is not picked up by the
19191# recursive find above (and adding in general recursive finding breaks
19192# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 19193known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
19194set X $nonxs_extensions
19195shift
19196nonxs_extensions="$*"
19197set X $known_extensions
19198shift
19199known_extensions="$*"
6904989c 19200cd "$tdir"
b4eb6b3d
JH
19201
19202: Now see which are supported on this system.
19203avail_ext=''
19204for xxx in $known_extensions ; do
19205 case "$xxx" in
19206 DB_File|db_file)
19207 case "$i_db" in
19208 $define) avail_ext="$avail_ext $xxx" ;;
19209 esac
19210 ;;
19211 GDBM_File|gdbm_fil)
19212 case "$i_gdbm" in
19213 $define) avail_ext="$avail_ext $xxx" ;;
19214 esac
19215 ;;
1d59c593 19216 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
19217 case "$i_langinfo$d_nl_langinfo" in
19218 $define$define) avail_ext="$avail_ext $xxx" ;;
19219 esac
19220 ;;
b4eb6b3d
JH
19221 NDBM_File|ndbm_fil)
19222 case "$i_ndbm" in
19223 $define)
19224 case "$osname-$use64bitint" in
252f4fb1 19225 cygwin-*|hpux-define)
b4eb6b3d
JH
19226 case "$libs" in
19227 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19228 esac
19229 ;;
19230 *) avail_ext="$avail_ext $xxx" ;;
19231 esac
19232 ;;
19233 esac
19234 ;;
19235 ODBM_File|odbm_fil)
19236 case "${i_dbm}${i_rpcsvcdbm}" in
19237 *"${define}"*)
19238 case "$osname-$use64bitint" in
252f4fb1 19239 cygwin-*|hpux-define)
b4eb6b3d
JH
19240 case "$libs" in
19241 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19242 esac
19243 ;;
19244 *) avail_ext="$avail_ext $xxx" ;;
19245 esac
19246 ;;
19247 esac
19248 ;;
19249 POSIX|posix)
19250 case "$useposix" in
19251 true|define|y) avail_ext="$avail_ext $xxx" ;;
19252 esac
19253 ;;
19254 Opcode|opcode)
19255 case "$useopcode" in
19256 true|define|y) avail_ext="$avail_ext $xxx" ;;
19257 esac
19258 ;;
19259 Socket|socket)
19260 case "$d_socket" in
4a9f028c
JH
19261 true|$define|y)
19262 case "$osname" in
19263 beos) ;; # not unless BONE
19264 *) avail_ext="$avail_ext $xxx" ;;
19265 esac
19266 ;;
b4eb6b3d
JH
19267 esac
19268 ;;
19269 Sys/Syslog|sys/syslog)
19270 : XXX syslog requires socket
19271 case "$d_socket" in
19272 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19273 esac
19274 ;;
19275 Thread|thread)
b00ec89b
AB
19276 case "$usethreads" in
19277 true|$define|y)
19278 case "$useithreads" in
19279 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19280 esac
b4eb6b3d
JH
19281 esac
19282 ;;
7deadc5f 19283 threads|threads/shared)
73e09c8f
JH
19284 # threads and threads::shared are special cases.
19285 # To stop people from asking "Perl 5.8.0 was supposed
19286 # to have this new fancy threads implementation but my
19287 # perl doesn't have it" and from people trying to
19288 # (re)install the threads module using CPAN.pm and
19289 # CPAN.pm then offering to reinstall Perl 5.8.0,
19290 # the threads.pm and threads/shared.pm will always be
19291 # there, croaking informatively ("you need to rebuild
19292 # all of Perl with threads, sorry") when threads haven't
19293 # been compiled in.
19294 # --jhi
19295 avail_ext="$avail_ext $xxx"
1dca008a 19296 ;;
b4eb6b3d
JH
19297 IPC/SysV|ipc/sysv)
19298 : XXX Do we need a useipcsysv variable here
19299 case "${d_msg}${d_sem}${d_shm}" in
19300 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19301 esac
19302 ;;
19303 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
19304 ;;
19305 esac
b4eb6b3d 19306done
5f80c64f 19307
b4eb6b3d
JH
19308set X $avail_ext
19309shift
19310avail_ext="$*"
5f80c64f 19311
b4eb6b3d
JH
19312: Now see which nonxs extensions are supported on this system.
19313: For now assume all are.
19314nonxs_ext=''
19315for xxx in $nonxs_extensions ; do
19316 case "$xxx" in
19317 *) nonxs_ext="$nonxs_ext $xxx"
19318 ;;
19319 esac
19320done
5f80c64f 19321
b4eb6b3d
JH
19322set X $nonxs_ext
19323shift
19324nonxs_ext="$*"
19325
19326case $usedl in
19327$define)
19328 $cat <<EOM
19329A number of extensions are supplied with $package. You may choose to
19330compile these extensions for dynamic loading (the default), compile
19331them into the $package executable (static loading), or not include
19332them at all. Answer "none" to include no extensions.
19333Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
19334
19335EOM
b4eb6b3d
JH
19336 case "$dynamic_ext" in
19337 '') dflt="$avail_ext" ;;
19338 *) dflt="$dynamic_ext"
19339 # Perhaps we are reusing an old out-of-date config.sh.
19340 case "$hint" in
19341 previous)
19342 if test X"$dynamic_ext" != X"$avail_ext"; then
19343 $cat <<EOM
19344NOTICE: Your previous config.sh list may be incorrect.
19345The extensions now available to you are
19346 ${avail_ext}
19347but the default list from your previous config.sh is
19348 ${dynamic_ext}
9c839522 19349
b4eb6b3d
JH
19350EOM
19351 fi
9c839522
PM
19352 ;;
19353 esac
b4eb6b3d
JH
19354 ;;
19355 esac
5f80c64f 19356 case "$dflt" in
b4eb6b3d
JH
19357 '') dflt=none;;
19358 esac
19359 rp="What extensions do you wish to load dynamically?"
19360 . ./myread
19361 case "$ans" in
19362 none) dynamic_ext=' ' ;;
19363 *) dynamic_ext="$ans" ;;
5f80c64f 19364 esac
5f80c64f 19365
b4eb6b3d
JH
19366 case "$static_ext" in
19367 '')
19368 : Exclude those already listed in dynamic linking
19369 dflt=''
19370 for xxx in $avail_ext; do
19371 case " $dynamic_ext " in
19372 *" $xxx "*) ;;
19373 *) dflt="$dflt $xxx" ;;
19374 esac
19375 done
19376 set X $dflt
19377 shift
19378 dflt="$*"
19379 ;;
19380 *) dflt="$static_ext"
19381 ;;
19382 esac
9c839522 19383
b4eb6b3d
JH
19384 case "$dflt" in
19385 '') dflt=none;;
19386 esac
19387 rp="What extensions do you wish to load statically?"
19388 . ./myread
19389 case "$ans" in
19390 none) static_ext=' ' ;;
19391 *) static_ext="$ans" ;;
19392 esac
19393 ;;
19394*)
19395 $cat <<EOM
19396A number of extensions are supplied with $package. Answer "none"
19397to include no extensions.
19398Note that DynaLoader is always built and need not be mentioned here.
9c839522 19399
b4eb6b3d
JH
19400EOM
19401 case "$static_ext" in
19402 '') dflt="$avail_ext" ;;
19403 *) dflt="$static_ext"
19404 # Perhaps we are reusing an old out-of-date config.sh.
19405 case "$hint" in
19406 previous)
19407 if test X"$static_ext" != X"$avail_ext"; then
19408 $cat <<EOM
19409NOTICE: Your previous config.sh list may be incorrect.
19410The extensions now available to you are
19411 ${avail_ext}
19412but the default list from your previous config.sh is
19413 ${static_ext}
5f80c64f
JH
19414
19415EOM
b4eb6b3d
JH
19416 fi
19417 ;;
19418 esac
19419 ;;
19420 esac
19421 : Exclude those that are not xs extensions
19422 case "$dflt" in
19423 '') dflt=none;;
19424 esac
19425 rp="What extensions do you wish to include?"
19426 . ./myread
19427 case "$ans" in
19428 none) static_ext=' ' ;;
19429 *) static_ext="$ans" ;;
19430 esac
19431 ;;
5f80c64f 19432esac
f1f6834f
AD
19433#
19434# Encode is a special case. If we are building Encode as a static
19435# extension, we need to explicitly list its subextensions as well.
19436# For other nested extensions, this is handled automatically by
19437# the appropriate Makefile.PL.
19438case " $static_ext " in
19439 *" Encode "*) # Add the subextensions of Encode
19440 cd "$rsrc/ext"
19441 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19442 static_ext="$static_ext Encode/$xxx"
19443 done
19444 cd "$tdir"
19445 ;;
19446esac
5f80c64f 19447
b4eb6b3d
JH
19448set X $dynamic_ext $static_ext $nonxs_ext
19449shift
19450extensions="$*"
19451
9c839522
PM
19452: Remove libraries needed only for extensions
19453: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
19454: The exception is SunOS 4.x, which needs them.
19455case "${osname}X${osvers}" in
19456sunos*X4*)
19457 perllibs="$libs"
19458 ;;
19459*) case "$usedl" in
19460 $define|true|[yY]*)
19461 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
19462 shift
19463 perllibs="$*"
19464 ;;
19465 *) perllibs="$libs"
19466 ;;
19467 esac
19468 ;;
9c839522 19469esac
5f80c64f
JH
19470
19471: Remove build directory name from cppstdin so it can be used from
19472: either the present location or the final installed location.
19473echo " "
19474: Get out of the UU directory to get correct path name.
19475cd ..
19476case "$cppstdin" in
19477`pwd`/cppstdin)
19478 echo "Stripping down cppstdin path name"
19479 cppstdin=cppstdin
19480 ;;
19481esac
19482cd UU
19483
19484: end of configuration questions
19485echo " "
19486echo "End of configuration questions."
19487echo " "
19488
19489: back to where it started
19490if test -d ../UU; then
19491 cd ..
19492fi
19493
48370efc
JH
19494: configuration may be patched via a 'config.arch' file
19495if $test -f config.arch; then
19496 echo "I see a config.arch file, loading it."
19497 . ./config.arch
19498fi
19499
5f80c64f
JH
19500: configuration may be patched via a 'config.over' file
19501if $test -f config.over; then
19502 echo " "
19503 dflt=y
19504 rp='I see a config.over file. Do you wish to load it?'
19505 . UU/myread
19506 case "$ans" in
19507 n*) echo "OK, I'll ignore it.";;
19508 *) . ./config.over
19509 echo "Configuration override changes have been loaded."
19510 ;;
19511 esac
19512fi
19513
19514: in case they want portability, strip down executable paths
19515case "$d_portable" in
19516"$define")
19517 echo " "
19518 echo "Stripping down executable paths..." >&4
19519 for file in $loclist $trylist; do
534ac15a
JH
19520 eval temp=\$$file
19521 eval $file=`basename $temp`
5f80c64f
JH
19522 done
19523 ;;
19524esac
19525
19526: create config.sh file
19527echo " "
19528echo "Creating config.sh..." >&4
19529$spitshell <<EOT >config.sh
19530$startsh
19531#
19532# This file was produced by running the Configure script. It holds all the
19533# definitions figured out by Configure. Should you modify one of these values,
19534# do not forget to propagate your changes by running "Configure -der". You may
19535# instead choose to run each of the .SH files by yourself, or "Configure -S".
19536#
19537
19538# Package name : $package
19539# Source directory : $src
19540# Configuration time: $cf_time
19541# Configured by : $cf_by
19542# Target system : $myuname
19543
19544Author='$Author'
19545Date='$Date'
19546Header='$Header'
19547Id='$Id'
19548Locker='$Locker'
19549Log='$Log'
19550Mcc='$Mcc'
19551RCSfile='$RCSfile'
19552Revision='$Revision'
19553Source='$Source'
19554State='$State'
19555_a='$_a'
19556_exe='$_exe'
19557_o='$_o'
b4eb6b3d 19558afs='$afs'
a6d26a0d 19559afsroot='$afsroot'
b4eb6b3d
JH
19560alignbytes='$alignbytes'
19561ansi2knr='$ansi2knr'
19562aphostname='$aphostname'
19563api_revision='$api_revision'
19564api_subversion='$api_subversion'
19565api_version='$api_version'
19566api_versionstring='$api_versionstring'
5f80c64f 19567ar='$ar'
b4eb6b3d
JH
19568archlib='$archlib'
19569archlibexp='$archlibexp'
19570archname64='$archname64'
19571archname='$archname'
5f80c64f 19572archobjs='$archobjs'
10bc17b6 19573asctime_r_proto='$asctime_r_proto'
5f80c64f 19574awk='$awk'
b4eb6b3d 19575baserev='$baserev'
5f80c64f 19576bash='$bash'
b4eb6b3d 19577bin='$bin'
b4eb6b3d 19578binexp='$binexp'
5f80c64f
JH
19579bison='$bison'
19580byacc='$byacc'
b4eb6b3d 19581byteorder='$byteorder'
5f80c64f 19582c='$c'
b4eb6b3d 19583castflags='$castflags'
5f80c64f
JH
19584cat='$cat'
19585cc='$cc'
19586cccdlflags='$cccdlflags'
19587ccdlflags='$ccdlflags'
19588ccflags='$ccflags'
b4eb6b3d 19589ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 19590ccname='$ccname'
b4eb6b3d 19591ccsymbols='$ccsymbols'
6b356c8e 19592ccversion='$ccversion'
5f80c64f 19593cf_by='$cf_by'
b4eb6b3d 19594cf_email='$cf_email'
5f80c64f 19595cf_time='$cf_time'
b4eb6b3d 19596charsize='$charsize'
5f80c64f
JH
19597chgrp='$chgrp'
19598chmod='$chmod'
19599chown='$chown'
b4eb6b3d 19600clocktype='$clocktype'
5f80c64f
JH
19601comm='$comm'
19602compress='$compress'
19603contains='$contains'
19604cp='$cp'
19605cpio='$cpio'
19606cpp='$cpp'
b4eb6b3d
JH
19607cpp_stuff='$cpp_stuff'
19608cppccsymbols='$cppccsymbols'
5f80c64f
JH
19609cppflags='$cppflags'
19610cpplast='$cpplast'
19611cppminus='$cppminus'
19612cpprun='$cpprun'
19613cppstdin='$cppstdin'
b4eb6b3d 19614cppsymbols='$cppsymbols'
10bc17b6 19615crypt_r_proto='$crypt_r_proto'
b4eb6b3d 19616cryptlib='$cryptlib'
5f80c64f 19617csh='$csh'
10bc17b6
JH
19618ctermid_r_proto='$ctermid_r_proto'
19619ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
19620d_Gconvert='$d_Gconvert'
19621d_PRIEUldbl='$d_PRIEUldbl'
19622d_PRIFUldbl='$d_PRIFUldbl'
19623d_PRIGUldbl='$d_PRIGUldbl'
19624d_PRIXU64='$d_PRIXU64'
19625d_PRId64='$d_PRId64'
19626d_PRIeldbl='$d_PRIeldbl'
19627d_PRIfldbl='$d_PRIfldbl'
19628d_PRIgldbl='$d_PRIgldbl'
19629d_PRIi64='$d_PRIi64'
19630d_PRIo64='$d_PRIo64'
19631d_PRIu64='$d_PRIu64'
19632d_PRIx64='$d_PRIx64'
19633d_SCNfldbl='$d_SCNfldbl'
74cac757 19634d__fwalk='$d__fwalk'
b4eb6b3d
JH
19635d_access='$d_access'
19636d_accessx='$d_accessx'
19637d_alarm='$d_alarm'
19638d_archlib='$d_archlib'
10bc17b6 19639d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
19640d_atolf='$d_atolf'
19641d_atoll='$d_atoll'
19642d_attribut='$d_attribut'
19643d_bcmp='$d_bcmp'
19644d_bcopy='$d_bcopy'
5f80c64f 19645d_bsd='$d_bsd'
b4eb6b3d
JH
19646d_bsdgetpgrp='$d_bsdgetpgrp'
19647d_bsdsetpgrp='$d_bsdsetpgrp'
19648d_bzero='$d_bzero'
19649d_casti32='$d_casti32'
19650d_castneg='$d_castneg'
19651d_charvspr='$d_charvspr'
19652d_chown='$d_chown'
19653d_chroot='$d_chroot'
19654d_chsize='$d_chsize'
758a5d79 19655d_class='$d_class'
b4eb6b3d 19656d_closedir='$d_closedir'
4e0554ec 19657d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
19658d_const='$d_const'
19659d_crypt='$d_crypt'
10bc17b6 19660d_crypt_r='$d_crypt_r'
b4eb6b3d 19661d_csh='$d_csh'
10bc17b6
JH
19662d_ctermid_r='$d_ctermid_r'
19663d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
19664d_cuserid='$d_cuserid'
19665d_dbl_dig='$d_dbl_dig'
2ef53570 19666d_dbminitproto='$d_dbminitproto'
b4eb6b3d 19667d_difftime='$d_difftime'
ae0e3d3b 19668d_dirfd='$d_dirfd'
b4eb6b3d
JH
19669d_dirnamlen='$d_dirnamlen'
19670d_dlerror='$d_dlerror'
5f80c64f 19671d_dlopen='$d_dlopen'
b4eb6b3d
JH
19672d_dlsymun='$d_dlsymun'
19673d_dosuid='$d_dosuid'
10bc17b6 19674d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
19675d_drand48proto='$d_drand48proto'
19676d_dup2='$d_dup2'
19677d_eaccess='$d_eaccess'
19678d_endgrent='$d_endgrent'
10bc17b6 19679d_endgrent_r='$d_endgrent_r'
b4eb6b3d 19680d_endhent='$d_endhent'
10bc17b6 19681d_endhostent_r='$d_endhostent_r'
b4eb6b3d 19682d_endnent='$d_endnent'
10bc17b6 19683d_endnetent_r='$d_endnetent_r'
b4eb6b3d 19684d_endpent='$d_endpent'
10bc17b6 19685d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 19686d_endpwent='$d_endpwent'
10bc17b6 19687d_endpwent_r='$d_endpwent_r'
b4eb6b3d 19688d_endsent='$d_endsent'
10bc17b6 19689d_endservent_r='$d_endservent_r'
b4eb6b3d 19690d_eofnblk='$d_eofnblk'
5f80c64f 19691d_eunice='$d_eunice'
b363b713 19692d_fchdir='$d_fchdir'
b4eb6b3d
JH
19693d_fchmod='$d_fchmod'
19694d_fchown='$d_fchown'
19695d_fcntl='$d_fcntl'
9d9004a9 19696d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
19697d_fd_macros='$d_fd_macros'
19698d_fd_set='$d_fd_set'
19699d_fds_bits='$d_fds_bits'
19700d_fgetpos='$d_fgetpos'
758a5d79
JH
19701d_finite='$d_finite'
19702d_finitel='$d_finitel'
b4eb6b3d
JH
19703d_flexfnam='$d_flexfnam'
19704d_flock='$d_flock'
2ef53570 19705d_flockproto='$d_flockproto'
b4eb6b3d 19706d_fork='$d_fork'
758a5d79 19707d_fp_class='$d_fp_class'
b4eb6b3d 19708d_fpathconf='$d_fpathconf'
758a5d79
JH
19709d_fpclass='$d_fpclass'
19710d_fpclassify='$d_fpclassify'
19711d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
19712d_fpos64_t='$d_fpos64_t'
19713d_frexpl='$d_frexpl'
19714d_fs_data_s='$d_fs_data_s'
19715d_fseeko='$d_fseeko'
19716d_fsetpos='$d_fsetpos'
19717d_fstatfs='$d_fstatfs'
19718d_fstatvfs='$d_fstatvfs'
411ab01c 19719d_fsync='$d_fsync'
b4eb6b3d
JH
19720d_ftello='$d_ftello'
19721d_ftime='$d_ftime'
19722d_getcwd='$d_getcwd'
19723d_getespwnam='$d_getespwnam'
19724d_getfsstat='$d_getfsstat'
19725d_getgrent='$d_getgrent'
10bc17b6
JH
19726d_getgrent_r='$d_getgrent_r'
19727d_getgrgid_r='$d_getgrgid_r'
19728d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
19729d_getgrps='$d_getgrps'
19730d_gethbyaddr='$d_gethbyaddr'
19731d_gethbyname='$d_gethbyname'
19732d_gethent='$d_gethent'
19733d_gethname='$d_gethname'
10bc17b6
JH
19734d_gethostbyaddr_r='$d_gethostbyaddr_r'
19735d_gethostbyname_r='$d_gethostbyname_r'
19736d_gethostent_r='$d_gethostent_r'
b4eb6b3d 19737d_gethostprotos='$d_gethostprotos'
4e0554ec 19738d_getitimer='$d_getitimer'
b4eb6b3d 19739d_getlogin='$d_getlogin'
10bc17b6 19740d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
19741d_getmnt='$d_getmnt'
19742d_getmntent='$d_getmntent'
19743d_getnbyaddr='$d_getnbyaddr'
19744d_getnbyname='$d_getnbyname'
19745d_getnent='$d_getnent'
10bc17b6
JH
19746d_getnetbyaddr_r='$d_getnetbyaddr_r'
19747d_getnetbyname_r='$d_getnetbyname_r'
19748d_getnetent_r='$d_getnetent_r'
b4eb6b3d 19749d_getnetprotos='$d_getnetprotos'
0c0643d0 19750d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
19751d_getpbyname='$d_getpbyname'
19752d_getpbynumber='$d_getpbynumber'
19753d_getpent='$d_getpent'
19754d_getpgid='$d_getpgid'
19755d_getpgrp2='$d_getpgrp2'
19756d_getpgrp='$d_getpgrp'
19757d_getppid='$d_getppid'
19758d_getprior='$d_getprior'
10bc17b6
JH
19759d_getprotobyname_r='$d_getprotobyname_r'
19760d_getprotobynumber_r='$d_getprotobynumber_r'
19761d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
19762d_getprotoprotos='$d_getprotoprotos'
19763d_getprpwnam='$d_getprpwnam'
19764d_getpwent='$d_getpwent'
10bc17b6
JH
19765d_getpwent_r='$d_getpwent_r'
19766d_getpwnam_r='$d_getpwnam_r'
19767d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
19768d_getsbyname='$d_getsbyname'
19769d_getsbyport='$d_getsbyport'
19770d_getsent='$d_getsent'
10bc17b6
JH
19771d_getservbyname_r='$d_getservbyname_r'
19772d_getservbyport_r='$d_getservbyport_r'
19773d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
19774d_getservprotos='$d_getservprotos'
19775d_getspnam='$d_getspnam'
10bc17b6 19776d_getspnam_r='$d_getspnam_r'
b4eb6b3d 19777d_gettimeod='$d_gettimeod'
10bc17b6 19778d_gmtime_r='$d_gmtime_r'
5f80c64f 19779d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
19780d_grpasswd='$d_grpasswd'
19781d_hasmntopt='$d_hasmntopt'
19782d_htonl='$d_htonl'
b4eb6b3d
JH
19783d_index='$d_index'
19784d_inetaton='$d_inetaton'
19785d_int64_t='$d_int64_t'
19786d_isascii='$d_isascii'
758a5d79
JH
19787d_isfinite='$d_isfinite'
19788d_isinf='$d_isinf'
b4eb6b3d
JH
19789d_isnan='$d_isnan'
19790d_isnanl='$d_isnanl'
19791d_killpg='$d_killpg'
19792d_lchown='$d_lchown'
19793d_ldbl_dig='$d_ldbl_dig'
19794d_link='$d_link'
10bc17b6 19795d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
19796d_locconv='$d_locconv'
19797d_lockf='$d_lockf'
19798d_longdbl='$d_longdbl'
19799d_longlong='$d_longlong'
19800d_lseekproto='$d_lseekproto'
19801d_lstat='$d_lstat'
19802d_madvise='$d_madvise'
19803d_mblen='$d_mblen'
19804d_mbstowcs='$d_mbstowcs'
19805d_mbtowc='$d_mbtowc'
19806d_memchr='$d_memchr'
19807d_memcmp='$d_memcmp'
19808d_memcpy='$d_memcpy'
19809d_memmove='$d_memmove'
19810d_memset='$d_memset'
19811d_mkdir='$d_mkdir'
19812d_mkdtemp='$d_mkdtemp'
19813d_mkfifo='$d_mkfifo'
19814d_mkstemp='$d_mkstemp'
19815d_mkstemps='$d_mkstemps'
19816d_mktime='$d_mktime'
19817d_mmap='$d_mmap'
19818d_modfl='$d_modfl'
e67aeab1 19819d_modfl_pow32_bug='$d_modfl_pow32_bug'
b4eb6b3d
JH
19820d_mprotect='$d_mprotect'
19821d_msg='$d_msg'
19822d_msg_ctrunc='$d_msg_ctrunc'
19823d_msg_dontroute='$d_msg_dontroute'
19824d_msg_oob='$d_msg_oob'
19825d_msg_peek='$d_msg_peek'
19826d_msg_proxy='$d_msg_proxy'
19827d_msgctl='$d_msgctl'
19828d_msgget='$d_msgget'
4e0554ec 19829d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
19830d_msgrcv='$d_msgrcv'
19831d_msgsnd='$d_msgsnd'
19832d_msync='$d_msync'
19833d_munmap='$d_munmap'
19834d_mymalloc='$d_mymalloc'
19835d_nice='$d_nice'
2765b840 19836d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 19837d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
19838d_off64_t='$d_off64_t'
19839d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19840d_oldpthreads='$d_oldpthreads'
19841d_oldsock='$d_oldsock'
19842d_open3='$d_open3'
19843d_pathconf='$d_pathconf'
19844d_pause='$d_pause'
19845d_perl_otherlibdirs='$d_perl_otherlibdirs'
19846d_phostname='$d_phostname'
19847d_pipe='$d_pipe'
19848d_poll='$d_poll'
5f80c64f 19849d_portable='$d_portable'
c7aff470 19850d_procselfexe='$d_procselfexe'
d6483fcc 19851d_pthread_atfork='$d_pthread_atfork'
b4eb6b3d
JH
19852d_pthread_yield='$d_pthread_yield'
19853d_pwage='$d_pwage'
19854d_pwchange='$d_pwchange'
19855d_pwclass='$d_pwclass'
19856d_pwcomment='$d_pwcomment'
19857d_pwexpire='$d_pwexpire'
19858d_pwgecos='$d_pwgecos'
19859d_pwpasswd='$d_pwpasswd'
19860d_pwquota='$d_pwquota'
19861d_qgcvt='$d_qgcvt'
19862d_quad='$d_quad'
10bc17b6
JH
19863d_random_r='$d_random_r'
19864d_readdir64_r='$d_readdir64_r'
b4eb6b3d 19865d_readdir='$d_readdir'
10bc17b6 19866d_readdir_r='$d_readdir_r'
b4eb6b3d 19867d_readlink='$d_readlink'
4e0554ec
JH
19868d_readv='$d_readv'
19869d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
19870d_rename='$d_rename'
19871d_rewinddir='$d_rewinddir'
19872d_rmdir='$d_rmdir'
19873d_safebcpy='$d_safebcpy'
19874d_safemcpy='$d_safemcpy'
19875d_sanemcmp='$d_sanemcmp'
ef9f17be 19876d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
19877d_sched_yield='$d_sched_yield'
19878d_scm_rights='$d_scm_rights'
19879d_seekdir='$d_seekdir'
19880d_select='$d_select'
19881d_sem='$d_sem'
19882d_semctl='$d_semctl'
19883d_semctl_semid_ds='$d_semctl_semid_ds'
19884d_semctl_semun='$d_semctl_semun'
19885d_semget='$d_semget'
19886d_semop='$d_semop'
4e0554ec 19887d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
19888d_setegid='$d_setegid'
19889d_seteuid='$d_seteuid'
19890d_setgrent='$d_setgrent'
10bc17b6 19891d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
19892d_setgrps='$d_setgrps'
19893d_sethent='$d_sethent'
10bc17b6 19894d_sethostent_r='$d_sethostent_r'
4e0554ec 19895d_setitimer='$d_setitimer'
b4eb6b3d
JH
19896d_setlinebuf='$d_setlinebuf'
19897d_setlocale='$d_setlocale'
10bc17b6 19898d_setlocale_r='$d_setlocale_r'
b4eb6b3d 19899d_setnent='$d_setnent'
10bc17b6 19900d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
19901d_setpent='$d_setpent'
19902d_setpgid='$d_setpgid'
19903d_setpgrp2='$d_setpgrp2'
19904d_setpgrp='$d_setpgrp'
19905d_setprior='$d_setprior'
19906d_setproctitle='$d_setproctitle'
10bc17b6 19907d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 19908d_setpwent='$d_setpwent'
10bc17b6 19909d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
19910d_setregid='$d_setregid'
19911d_setresgid='$d_setresgid'
19912d_setresuid='$d_setresuid'
19913d_setreuid='$d_setreuid'
19914d_setrgid='$d_setrgid'
19915d_setruid='$d_setruid'
19916d_setsent='$d_setsent'
10bc17b6 19917d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
19918d_setsid='$d_setsid'
19919d_setvbuf='$d_setvbuf'
19920d_sfio='$d_sfio'
19921d_shm='$d_shm'
19922d_shmat='$d_shmat'
19923d_shmatprototype='$d_shmatprototype'
19924d_shmctl='$d_shmctl'
19925d_shmdt='$d_shmdt'
19926d_shmget='$d_shmget'
19927d_sigaction='$d_sigaction'
983dbef6 19928d_sigprocmask='$d_sigprocmask'
b4eb6b3d 19929d_sigsetjmp='$d_sigsetjmp'
49a78c82 19930d_sockatmark='$d_sockatmark'
2ef53570 19931d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
19932d_socket='$d_socket'
19933d_socklen_t='$d_socklen_t'
19934d_sockpair='$d_sockpair'
19935d_socks5_init='$d_socks5_init'
19936d_sqrtl='$d_sqrtl'
10bc17b6
JH
19937d_srand48_r='$d_srand48_r'
19938d_srandom_r='$d_srandom_r'
eef837ea 19939d_sresgproto='$d_sresgproto'
640374d0 19940d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
19941d_statblks='$d_statblks'
19942d_statfs_f_flags='$d_statfs_f_flags'
19943d_statfs_s='$d_statfs_s'
19944d_statvfs='$d_statvfs'
19945d_stdio_cnt_lval='$d_stdio_cnt_lval'
19946d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
19947d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19948d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
19949d_stdio_stream_array='$d_stdio_stream_array'
19950d_stdiobase='$d_stdiobase'
19951d_stdstdio='$d_stdstdio'
19952d_strchr='$d_strchr'
19953d_strcoll='$d_strcoll'
19954d_strctcpy='$d_strctcpy'
19955d_strerrm='$d_strerrm'
19956d_strerror='$d_strerror'
10bc17b6 19957d_strerror_r='$d_strerror_r'
b3c85772 19958d_strftime='$d_strftime'
b4eb6b3d
JH
19959d_strtod='$d_strtod'
19960d_strtol='$d_strtol'
19961d_strtold='$d_strtold'
19962d_strtoll='$d_strtoll'
28e5dec8 19963d_strtoq='$d_strtoq'
b4eb6b3d
JH
19964d_strtoul='$d_strtoul'
19965d_strtoull='$d_strtoull'
19966d_strtouq='$d_strtouq'
19967d_strxfrm='$d_strxfrm'
19968d_suidsafe='$d_suidsafe'
19969d_symlink='$d_symlink'
19970d_syscall='$d_syscall'
2ef53570 19971d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
19972d_sysconf='$d_sysconf'
19973d_sysernlst='$d_sysernlst'
19974d_syserrlst='$d_syserrlst'
19975d_system='$d_system'
19976d_tcgetpgrp='$d_tcgetpgrp'
19977d_tcsetpgrp='$d_tcsetpgrp'
19978d_telldir='$d_telldir'
19979d_telldirproto='$d_telldirproto'
19980d_time='$d_time'
19981d_times='$d_times'
14b90194
JH
19982d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19983d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 19984d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 19985d_truncate='$d_truncate'
10bc17b6 19986d_ttyname_r='$d_ttyname_r'
b4eb6b3d 19987d_tzname='$d_tzname'
4e0554ec
JH
19988d_u32align='$d_u32align'
19989d_ualarm='$d_ualarm'
b4eb6b3d
JH
19990d_umask='$d_umask'
19991d_uname='$d_uname'
19992d_union_semun='$d_union_semun'
758a5d79 19993d_unordered='$d_unordered'
4e0554ec 19994d_usleep='$d_usleep'
2ef53570 19995d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
19996d_ustat='$d_ustat'
19997d_vendorarch='$d_vendorarch'
19998d_vendorbin='$d_vendorbin'
19999d_vendorlib='$d_vendorlib'
20000d_vfork='$d_vfork'
20001d_void_closedir='$d_void_closedir'
20002d_voidsig='$d_voidsig'
20003d_voidtty='$d_voidtty'
20004d_volatile='$d_volatile'
20005d_vprintf='$d_vprintf'
20006d_wait4='$d_wait4'
20007d_waitpid='$d_waitpid'
20008d_wcstombs='$d_wcstombs'
20009d_wctomb='$d_wctomb'
4e0554ec 20010d_writev='$d_writev'
5f80c64f
JH
20011d_xenix='$d_xenix'
20012date='$date'
b4eb6b3d
JH
20013db_hashtype='$db_hashtype'
20014db_prefixtype='$db_prefixtype'
640374d0
JH
20015db_version_major='$db_version_major'
20016db_version_minor='$db_version_minor'
20017db_version_patch='$db_version_patch'
b4eb6b3d
JH
20018defvoidused='$defvoidused'
20019direntrytype='$direntrytype'
20020dlext='$dlext'
5f80c64f 20021dlsrc='$dlsrc'
b4eb6b3d
JH
20022doublesize='$doublesize'
20023drand01='$drand01'
10bc17b6 20024drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
20025dynamic_ext='$dynamic_ext'
20026eagain='$eagain'
20027ebcdic='$ebcdic'
5f80c64f
JH
20028echo='$echo'
20029egrep='$egrep'
20030emacs='$emacs'
10bc17b6
JH
20031endgrent_r_proto='$endgrent_r_proto'
20032endhostent_r_proto='$endhostent_r_proto'
20033endnetent_r_proto='$endnetent_r_proto'
20034endprotoent_r_proto='$endprotoent_r_proto'
20035endpwent_r_proto='$endpwent_r_proto'
20036endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
20037eunicefix='$eunicefix'
20038exe_ext='$exe_ext'
20039expr='$expr'
b4eb6b3d 20040extensions='$extensions'
6fcddf3b 20041extras='$extras'
b4eb6b3d
JH
20042fflushNULL='$fflushNULL'
20043fflushall='$fflushall'
5f80c64f
JH
20044find='$find'
20045firstmakefile='$firstmakefile'
20046flex='$flex'
b4eb6b3d
JH
20047fpossize='$fpossize'
20048fpostype='$fpostype'
20049freetype='$freetype'
5440bc8e 20050from='$from'
b4eb6b3d
JH
20051full_ar='$full_ar'
20052full_csh='$full_csh'
20053full_sed='$full_sed'
5b463ca7 20054gccosandvers='$gccosandvers'
5f80c64f 20055gccversion='$gccversion'
10bc17b6
JH
20056getgrent_r_proto='$getgrent_r_proto'
20057getgrgid_r_proto='$getgrgid_r_proto'
20058getgrnam_r_proto='$getgrnam_r_proto'
20059gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20060gethostbyname_r_proto='$gethostbyname_r_proto'
20061gethostent_r_proto='$gethostent_r_proto'
20062getlogin_r_proto='$getlogin_r_proto'
20063getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20064getnetbyname_r_proto='$getnetbyname_r_proto'
20065getnetent_r_proto='$getnetent_r_proto'
20066getprotobyname_r_proto='$getprotobyname_r_proto'
20067getprotobynumber_r_proto='$getprotobynumber_r_proto'
20068getprotoent_r_proto='$getprotoent_r_proto'
20069getpwent_r_proto='$getpwent_r_proto'
20070getpwnam_r_proto='$getpwnam_r_proto'
20071getpwuid_r_proto='$getpwuid_r_proto'
20072getservbyname_r_proto='$getservbyname_r_proto'
20073getservbyport_r_proto='$getservbyport_r_proto'
20074getservent_r_proto='$getservent_r_proto'
20075getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
20076gidformat='$gidformat'
20077gidsign='$gidsign'
20078gidsize='$gidsize'
20079gidtype='$gidtype'
5f80c64f 20080glibpth='$glibpth'
3c728e00 20081gmake='$gmake'
10bc17b6 20082gmtime_r_proto='$gmtime_r_proto'
5f80c64f 20083grep='$grep'
b4eb6b3d
JH
20084groupcat='$groupcat'
20085groupstype='$groupstype'
5f80c64f 20086gzip='$gzip'
b4eb6b3d
JH
20087h_fcntl='$h_fcntl'
20088h_sysfile='$h_sysfile'
5f80c64f 20089hint='$hint'
b4eb6b3d
JH
20090hostcat='$hostcat'
20091i16size='$i16size'
20092i16type='$i16type'
20093i32size='$i32size'
20094i32type='$i32type'
20095i64size='$i64size'
20096i64type='$i64type'
20097i8size='$i8size'
20098i8type='$i8type'
20099i_arpainet='$i_arpainet'
20100i_bsdioctl='$i_bsdioctl'
10bc17b6 20101i_crypt='$i_crypt'
b4eb6b3d
JH
20102i_db='$i_db'
20103i_dbm='$i_dbm'
20104i_dirent='$i_dirent'
5f80c64f 20105i_dld='$i_dld'
b4eb6b3d
JH
20106i_dlfcn='$i_dlfcn'
20107i_fcntl='$i_fcntl'
20108i_float='$i_float'
758a5d79
JH
20109i_fp='$i_fp'
20110i_fp_class='$i_fp_class'
b4eb6b3d
JH
20111i_gdbm='$i_gdbm'
20112i_grp='$i_grp'
b4eb6b3d
JH
20113i_ieeefp='$i_ieeefp'
20114i_inttypes='$i_inttypes'
2765b840 20115i_langinfo='$i_langinfo'
b4eb6b3d
JH
20116i_libutil='$i_libutil'
20117i_limits='$i_limits'
20118i_locale='$i_locale'
20119i_machcthr='$i_machcthr'
20120i_malloc='$i_malloc'
20121i_math='$i_math'
20122i_memory='$i_memory'
20123i_mntent='$i_mntent'
20124i_ndbm='$i_ndbm'
20125i_netdb='$i_netdb'
20126i_neterrno='$i_neterrno'
20127i_netinettcp='$i_netinettcp'
20128i_niin='$i_niin'
20129i_poll='$i_poll'
20130i_prot='$i_prot'
20131i_pthread='$i_pthread'
20132i_pwd='$i_pwd'
20133i_rpcsvcdbm='$i_rpcsvcdbm'
20134i_sfio='$i_sfio'
20135i_sgtty='$i_sgtty'
20136i_shadow='$i_shadow'
20137i_socks='$i_socks'
20138i_stdarg='$i_stdarg'
20139i_stddef='$i_stddef'
20140i_stdlib='$i_stdlib'
20141i_string='$i_string'
20142i_sunmath='$i_sunmath'
20143i_sysaccess='$i_sysaccess'
20144i_sysdir='$i_sysdir'
20145i_sysfile='$i_sysfile'
20146i_sysfilio='$i_sysfilio'
20147i_sysin='$i_sysin'
20148i_sysioctl='$i_sysioctl'
20149i_syslog='$i_syslog'
20150i_sysmman='$i_sysmman'
20151i_sysmode='$i_sysmode'
20152i_sysmount='$i_sysmount'
20153i_sysndir='$i_sysndir'
20154i_sysparam='$i_sysparam'
20155i_sysresrc='$i_sysresrc'
20156i_syssecrt='$i_syssecrt'
20157i_sysselct='$i_sysselct'
20158i_syssockio='$i_syssockio'
20159i_sysstat='$i_sysstat'
20160i_sysstatfs='$i_sysstatfs'
20161i_sysstatvfs='$i_sysstatvfs'
20162i_systime='$i_systime'
20163i_systimek='$i_systimek'
20164i_systimes='$i_systimes'
20165i_systypes='$i_systypes'
20166i_sysuio='$i_sysuio'
20167i_sysun='$i_sysun'
20168i_sysutsname='$i_sysutsname'
20169i_sysvfs='$i_sysvfs'
20170i_syswait='$i_syswait'
20171i_termio='$i_termio'
20172i_termios='$i_termios'
20173i_time='$i_time'
20174i_unistd='$i_unistd'
20175i_ustat='$i_ustat'
20176i_utime='$i_utime'
20177i_values='$i_values'
20178i_varargs='$i_varargs'
20179i_varhdr='$i_varhdr'
20180i_vfork='$i_vfork'
5f80c64f 20181ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
20182inc_version_list='$inc_version_list'
20183inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
20184incpath='$incpath'
20185inews='$inews'
b4eb6b3d
JH
20186installarchlib='$installarchlib'
20187installbin='$installbin'
20188installman1dir='$installman1dir'
20189installman3dir='$installman3dir'
20190installprefix='$installprefix'
20191installprefixexp='$installprefixexp'
20192installprivlib='$installprivlib'
20193installscript='$installscript'
20194installsitearch='$installsitearch'
20195installsitebin='$installsitebin'
20196installsitelib='$installsitelib'
20197installstyle='$installstyle'
20198installusrbinperl='$installusrbinperl'
20199installvendorarch='$installvendorarch'
20200installvendorbin='$installvendorbin'
20201installvendorlib='$installvendorlib'
20202intsize='$intsize'
4b661809 20203issymlink='$issymlink'
b4eb6b3d
JH
20204ivdformat='$ivdformat'
20205ivsize='$ivsize'
20206ivtype='$ivtype'
20207known_extensions='$known_extensions'
5f80c64f 20208ksh='$ksh'
5f80c64f
JH
20209ld='$ld'
20210lddlflags='$lddlflags'
20211ldflags='$ldflags'
b4eb6b3d
JH
20212ldflags_uselargefiles='$ldflags_uselargefiles'
20213ldlibpthname='$ldlibpthname'
5f80c64f
JH
20214less='$less'
20215lib_ext='$lib_ext'
20216libc='$libc'
b4eb6b3d 20217libperl='$libperl'
5f80c64f
JH
20218libpth='$libpth'
20219libs='$libs'
43999f95
JH
20220libsdirs='$libsdirs'
20221libsfiles='$libsfiles'
20222libsfound='$libsfound'
13b3f787 20223libspath='$libspath'
5f80c64f 20224libswanted='$libswanted'
b4eb6b3d 20225libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
20226line='$line'
20227lint='$lint'
20228lkflags='$lkflags'
20229ln='$ln'
20230lns='$lns'
10bc17b6 20231localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
20232locincpth='$locincpth'
20233loclibpth='$loclibpth'
b4eb6b3d
JH
20234longdblsize='$longdblsize'
20235longlongsize='$longlongsize'
20236longsize='$longsize'
5f80c64f
JH
20237lp='$lp'
20238lpr='$lpr'
20239ls='$ls'
b4eb6b3d
JH
20240lseeksize='$lseeksize'
20241lseektype='$lseektype'
5f80c64f
JH
20242mail='$mail'
20243mailx='$mailx'
20244make='$make'
20245make_set_make='$make_set_make'
b4eb6b3d
JH
20246mallocobj='$mallocobj'
20247mallocsrc='$mallocsrc'
20248malloctype='$malloctype'
20249man1dir='$man1dir'
20250man1direxp='$man1direxp'
20251man1ext='$man1ext'
20252man3dir='$man3dir'
20253man3direxp='$man3direxp'
20254man3ext='$man3ext'
5f80c64f
JH
20255mips_type='$mips_type'
20256mkdir='$mkdir'
b4eb6b3d
JH
20257mmaptype='$mmaptype'
20258modetype='$modetype'
5f80c64f 20259more='$more'
b4eb6b3d 20260multiarch='$multiarch'
5f80c64f 20261mv='$mv'
b4eb6b3d
JH
20262myarchname='$myarchname'
20263mydomain='$mydomain'
20264myhostname='$myhostname'
5f80c64f
JH
20265myuname='$myuname'
20266n='$n'
2cc61e15 20267need_va_copy='$need_va_copy'
b4eb6b3d
JH
20268netdb_hlen_type='$netdb_hlen_type'
20269netdb_host_type='$netdb_host_type'
20270netdb_name_type='$netdb_name_type'
20271netdb_net_type='$netdb_net_type'
5f80c64f
JH
20272nm='$nm'
20273nm_opt='$nm_opt'
20274nm_so_opt='$nm_so_opt'
b4eb6b3d 20275nonxs_ext='$nonxs_ext'
5f80c64f 20276nroff='$nroff'
b4eb6b3d
JH
20277nvEUformat='$nvEUformat'
20278nvFUformat='$nvFUformat'
20279nvGUformat='$nvGUformat'
53133ed1 20280nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
20281nveformat='$nveformat'
20282nvfformat='$nvfformat'
20283nvgformat='$nvgformat'
20284nvsize='$nvsize'
20285nvtype='$nvtype'
20286o_nonblock='$o_nonblock'
5f80c64f 20287obj_ext='$obj_ext'
b4eb6b3d 20288old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 20289optimize='$optimize'
b4eb6b3d 20290orderlib='$orderlib'
5f80c64f
JH
20291osname='$osname'
20292osvers='$osvers'
b4eb6b3d 20293otherlibdirs='$otherlibdirs'
5f80c64f 20294package='$package'
b4eb6b3d
JH
20295pager='$pager'
20296passcat='$passcat'
20297patchlevel='$patchlevel'
5f80c64f 20298path_sep='$path_sep'
b4eb6b3d 20299perl5='$perl5'
5f80c64f 20300perl='$perl'
151e6568 20301perl_patchlevel='$perl_patchlevel'
b4eb6b3d 20302perladmin='$perladmin'
9c839522 20303perllibs='$perllibs'
b4eb6b3d 20304perlpath='$perlpath'
5f80c64f 20305pg='$pg'
b4eb6b3d
JH
20306phostname='$phostname'
20307pidtype='$pidtype'
5f80c64f 20308plibpth='$plibpth'
b4eb6b3d 20309pm_apiversion='$pm_apiversion'
5f80c64f
JH
20310pmake='$pmake'
20311pr='$pr'
b4eb6b3d
JH
20312prefix='$prefix'
20313prefixexp='$prefixexp'
20314privlib='$privlib'
20315privlibexp='$privlibexp'
f24dbf84 20316procselfexe='$procselfexe'
b4eb6b3d
JH
20317prototype='$prototype'
20318ptrsize='$ptrsize'
20319quadkind='$quadkind'
20320quadtype='$quadtype'
20321randbits='$randbits'
20322randfunc='$randfunc'
10bc17b6 20323random_r_proto='$random_r_proto'
b4eb6b3d
JH
20324randseedtype='$randseedtype'
20325ranlib='$ranlib'
20326rd_nodata='$rd_nodata'
10bc17b6
JH
20327readdir64_r_proto='$readdir64_r_proto'
20328readdir_r_proto='$readdir_r_proto'
b4eb6b3d 20329revision='$revision'
5f80c64f
JH
20330rm='$rm'
20331rmail='$rmail'
5440bc8e 20332run='$run'
5f80c64f 20333runnm='$runnm'
b4eb6b3d
JH
20334sPRIEUldbl='$sPRIEUldbl'
20335sPRIFUldbl='$sPRIFUldbl'
20336sPRIGUldbl='$sPRIGUldbl'
20337sPRIXU64='$sPRIXU64'
20338sPRId64='$sPRId64'
20339sPRIeldbl='$sPRIeldbl'
20340sPRIfldbl='$sPRIfldbl'
20341sPRIgldbl='$sPRIgldbl'
20342sPRIi64='$sPRIi64'
20343sPRIo64='$sPRIo64'
20344sPRIu64='$sPRIu64'
20345sPRIx64='$sPRIx64'
20346sSCNfldbl='$sSCNfldbl'
20347sched_yield='$sched_yield'
20348scriptdir='$scriptdir'
20349scriptdirexp='$scriptdirexp'
5f80c64f 20350sed='$sed'
b4eb6b3d
JH
20351seedfunc='$seedfunc'
20352selectminbits='$selectminbits'
20353selecttype='$selecttype'
5f80c64f 20354sendmail='$sendmail'
10bc17b6
JH
20355setgrent_r_proto='$setgrent_r_proto'
20356sethostent_r_proto='$sethostent_r_proto'
20357setlocale_r_proto='$setlocale_r_proto'
20358setnetent_r_proto='$setnetent_r_proto'
20359setprotoent_r_proto='$setprotoent_r_proto'
20360setpwent_r_proto='$setpwent_r_proto'
20361setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
20362sh='$sh'
20363shar='$shar'
20364sharpbang='$sharpbang'
b4eb6b3d
JH
20365shmattype='$shmattype'
20366shortsize='$shortsize'
20367shrpenv='$shrpenv'
5f80c64f 20368shsharp='$shsharp'
b4eb6b3d
JH
20369sig_count='$sig_count'
20370sig_name='$sig_name'
20371sig_name_init='$sig_name_init'
20372sig_num='$sig_num'
20373sig_num_init='$sig_num_init'
76d3c696 20374sig_size='$sig_size'
b4eb6b3d
JH
20375signal_t='$signal_t'
20376sitearch='$sitearch'
20377sitearchexp='$sitearchexp'
20378sitebin='$sitebin'
20379sitebinexp='$sitebinexp'
20380sitelib='$sitelib'
20381sitelib_stem='$sitelib_stem'
20382sitelibexp='$sitelibexp'
20383siteprefix='$siteprefix'
20384siteprefixexp='$siteprefixexp'
20385sizesize='$sizesize'
20386sizetype='$sizetype'
5f80c64f
JH
20387sleep='$sleep'
20388smail='$smail'
5f80c64f 20389so='$so'
b4eb6b3d
JH
20390sockethdr='$sockethdr'
20391socketlib='$socketlib'
20392socksizetype='$socksizetype'
5f80c64f
JH
20393sort='$sort'
20394spackage='$spackage'
20395spitshell='$spitshell'
10bc17b6
JH
20396srand48_r_proto='$srand48_r_proto'
20397srandom_r_proto='$srandom_r_proto'
5f80c64f 20398src='$src'
b4eb6b3d
JH
20399ssizetype='$ssizetype'
20400startperl='$startperl'
5f80c64f 20401startsh='$startsh'
b4eb6b3d
JH
20402static_ext='$static_ext'
20403stdchar='$stdchar'
20404stdio_base='$stdio_base'
20405stdio_bufsiz='$stdio_bufsiz'
20406stdio_cnt='$stdio_cnt'
20407stdio_filbuf='$stdio_filbuf'
20408stdio_ptr='$stdio_ptr'
20409stdio_stream_array='$stdio_stream_array'
10bc17b6 20410strerror_r_proto='$strerror_r_proto'
b4eb6b3d 20411strings='$strings'
5f80c64f 20412submit='$submit'
b4eb6b3d
JH
20413subversion='$subversion'
20414sysman='$sysman'
5f80c64f
JH
20415tail='$tail'
20416tar='$tar'
5440bc8e 20417targetarch='$targetarch'
5f80c64f
JH
20418tbl='$tbl'
20419tee='$tee'
20420test='$test'
b4eb6b3d
JH
20421timeincl='$timeincl'
20422timetype='$timetype'
10bc17b6 20423tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 20424to='$to'
5f80c64f
JH
20425touch='$touch'
20426tr='$tr'
20427trnl='$trnl'
20428troff='$troff'
10bc17b6 20429ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
20430u16size='$u16size'
20431u16type='$u16type'
20432u32size='$u32size'
20433u32type='$u32type'
20434u64size='$u64size'
20435u64type='$u64type'
20436u8size='$u8size'
20437u8type='$u8type'
20438uidformat='$uidformat'
20439uidsign='$uidsign'
20440uidsize='$uidsize'
20441uidtype='$uidtype'
5f80c64f
JH
20442uname='$uname'
20443uniq='$uniq'
b4eb6b3d
JH
20444uquadtype='$uquadtype'
20445use5005threads='$use5005threads'
20446use64bitall='$use64bitall'
20447use64bitint='$use64bitint'
5440bc8e 20448usecrosscompile='$usecrosscompile'
5f80c64f 20449usedl='$usedl'
b4eb6b3d
JH
20450useithreads='$useithreads'
20451uselargefiles='$uselargefiles'
20452uselongdouble='$uselongdouble'
20453usemorebits='$usemorebits'
20454usemultiplicity='$usemultiplicity'
20455usemymalloc='$usemymalloc'
5f80c64f 20456usenm='$usenm'
b4eb6b3d
JH
20457useopcode='$useopcode'
20458useperlio='$useperlio'
20459useposix='$useposix'
9514c62b 20460usereentrant='$usereentrant'
b4eb6b3d
JH
20461usesfio='$usesfio'
20462useshrplib='$useshrplib'
29209bc5 20463usesocks='$usesocks'
b4eb6b3d
JH
20464usethreads='$usethreads'
20465usevendorprefix='$usevendorprefix'
20466usevfork='$usevfork'
5f80c64f
JH
20467usrinc='$usrinc'
20468uuname='$uuname'
b4eb6b3d
JH
20469uvXUformat='$uvXUformat'
20470uvoformat='$uvoformat'
20471uvsize='$uvsize'
20472uvtype='$uvtype'
20473uvuformat='$uvuformat'
20474uvxformat='$uvxformat'
20475vendorarch='$vendorarch'
20476vendorarchexp='$vendorarchexp'
20477vendorbin='$vendorbin'
20478vendorbinexp='$vendorbinexp'
20479vendorlib='$vendorlib'
20480vendorlib_stem='$vendorlib_stem'
20481vendorlibexp='$vendorlibexp'
20482vendorprefix='$vendorprefix'
20483vendorprefixexp='$vendorprefixexp'
20484version='$version'
861eb78d 20485version_patchlevel_string='$version_patchlevel_string'
d56c5707 20486versiononly='$versiononly'
5f80c64f 20487vi='$vi'
b4eb6b3d 20488voidflags='$voidflags'
5f80c64f 20489xlibpth='$xlibpth'
b4eb6b3d 20490xs_apiversion='$xs_apiversion'
3659ebf1
JH
20491yacc='$yacc'
20492yaccflags='$yaccflags'
5f80c64f
JH
20493zcat='$zcat'
20494zip='$zip'
20495EOT
20496
20497: Add in command line options if available
20498$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20499
20500: add special variables
20501$test -f $src/patchlevel.h && \
d00b958f 20502awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 20503echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 20504echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
20505
20506: propagate old symbols
20507if $test -f UU/config.sh; then
381aa1ff 20508 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 20509 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 20510 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
20511 set X `cat UU/oldsyms`
20512 shift
20513 case $# in
20514 0) ;;
20515 *)
20516 cat <<EOM
20517Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20518EOM
20519 echo "# Variables propagated from previous config.sh file." >>config.sh
20520 for sym in `cat UU/oldsyms`; do
20521 echo " Propagating $hint variable "'$'"$sym..."
20522 eval 'tmp="$'"${sym}"'"'
20523 echo "$tmp" | \
20524 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20525 done
20526 ;;
20527 esac
20528fi
20529
20530: Finish up by extracting the .SH files
20531case "$alldone" in
20532exit)
20533 $rm -rf UU
24ccb310 20534 echo "Extraction done."
5f80c64f
JH
20535 exit 0
20536 ;;
20537cont)
20538 ;;
20539'')
20540 dflt=''
20541 nostick=true
20542 $cat <<EOM
20543
20544If you'd like to make any changes to the config.sh file before I begin
20545to configure things, do it as a shell escape now (e.g. !vi config.sh).
20546
20547EOM
20548 rp="Press return or use a shell escape to edit config.sh:"
20549 . UU/myread
20550 nostick=''
20551 case "$ans" in
20552 '') ;;
20553 *) : in case they cannot read
20554 sh 1>&4 -c "$ans";;
20555 esac
20556 ;;
20557esac
20558
20559: if this fails, just run all the .SH files by hand
20560. ./config.sh
20561
20562echo " "
20563exec 1>&4
a43e8593 20564pwd=`pwd`
5f80c64f 20565. ./UU/extract
6904989c 20566cd "$pwd"
5f80c64f
JH
20567
20568if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20569 dflt=y
20570 case "$silent" in
20571 true) ;;
20572 *)
20573 $cat <<EOM
20574
20575Now you need to generate make dependencies by running "$make depend".
20576You might prefer to run it in background: "$make depend > makedepend.out &"
20577It can take a while, so you might not want to run it right now.
20578
20579EOM
20580 ;;
20581 esac
20582 rp="Run $make depend now?"
20583 . UU/myread
20584 case "$ans" in
20585 y*)
3d5d58b1 20586 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
20587 ;;
20588 *)
20589 echo "You must run '$make depend' then '$make'."
20590 ;;
20591 esac
20592elif test -f [Mm]akefile; then
20593 echo " "
20594 echo "Now you must run a $make."
20595else
24ccb310 20596 echo "Configure done."
5f80c64f
JH
20597fi
20598
20599if $test -f Policy.sh; then
20600 $cat <<EOM
20601
20602If you compile $package on a different machine or from a different object
20603directory, copy the Policy.sh file from this object directory to the
20604new one before you run Configure -- this will help you with most of
20605the policy defaults.
20606
20607EOM
20608fi
20609if $test -f config.msg; then
20610 echo "Hmm. I also noted the following information while running:"
20611 echo " "
20612 $cat config.msg >&4
20613 $rm -f config.msg
20614fi
20615$rm -f kit*isdone ark*isdone
20616$rm -rf UU
20617
20618: End of Configure
20619