This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[patch] one more little step for WinCE
[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#
8be2c24c 23# Generated on Thu May 16 17:03:39 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
8be2c24c
JH
1861 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1862 fooxy) trnl='\n\r' ;;
1863 esac
1864fi
1865if test X"$trnl" = X; then
5ff3f7a4
GS
1866 cat <<EOM >&2
1867
1868$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1869
1870EOM
1871 exit 1
1872fi
1873
2304df62
AD
1874: compute the number of columns on the terminal for proper question formatting
1875case "$COLUMNS" in
1876'') COLUMNS='80';;
1877esac
1878
1879: set up the echo used in my read
1880myecho="case \"\$xxxm\" in
1881'') echo $n \"\$rp $c\" >&4;;
1882*) case \"\$rp\" in
1883 '') echo $n \"[\$xxxm] $c\";;
1884 *)
1885 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1886 echo \"\$rp\" >&4
1887 echo $n \"[\$xxxm] $c\" >&4
1888 else
1889 echo $n \"\$rp [\$xxxm] $c\" >&4
1890 fi
1891 ;;
1892 esac;;
1893esac"
1894
1895: now set up to do reads with possible shell escape and default assignment
1896cat <<EOSC >myread
28757baa 1897$startsh
2304df62
AD
1898xxxm=\$dflt
1899$myecho
1900ans='!'
1901case "\$fastread" in
1902yes) case "\$dflt" in
1903 '') ;;
1904 *) ans='';
1905 case "\$silent-\$rp" in
1906 true-) ;;
1907 *) echo " " >&4;;
1908 esac;;
1909 esac;;
1910*) case "\$silent" in
1911 true) case "\$rp" in
1912 '') ans='';;
1913 esac;;
1914 esac;;
1915esac
1916while expr "X\$ans" : "X!" >/dev/null; do
1917 read answ
1918 set x \$xxxm
1919 shift
dfe9444c 1920 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1921 case "\$answ" in
dfe9444c
AD
1922 "!")
1923 sh 1>&4
1924 echo " "
1925 $myecho
1926 ;;
1927 !*)
1928 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1929 shift
1930 sh 1>&4 -c "\$*"
1931 echo " "
1932 $myecho
1933 ;;
2304df62
AD
1934 "\$ans")
1935 case "\$ans" in
ecfc5424
AD
1936 \\&*)
1937 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1938 shift
1939 case "\$1" in
1940 -d)
1941 fastread=yes
40a7a20a 1942 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1943 ;;
1944 -*)
40a7a20a 1945 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1946 ;;
1947 esac
1948 $myecho
1949 ans=!
1950 ;;
2304df62
AD
1951 esac;;
1952 *)
1953 case "\$aok" in
1954 y)
1955 echo "*** Substitution done -- please confirm."
1956 xxxm="\$ans"
c9795ab7 1957 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1958 xxxm="\$ans"
1959 ans=!
1960 ;;
1961 *)
1962 echo "*** Error -- try again."
1963 ans=!
1964 ;;
1965 esac
1966 $myecho
1967 ;;
1968 esac
1969 case "\$ans\$xxxm\$nostick" in
1970 '')
1971 ans=!
1972 $myecho
1973 ;;
1974 esac
1975done
1976case "\$ans" in
1977'') ans="\$xxxm";;
1978esac
1979EOSC
1980
1981: create .config dir to save info across Configure sessions
1982test -d ../.config || mkdir ../.config
1983cat >../.config/README <<EOF
1984This directory created by Configure to save information that should
dfe9444c 1985persist across sessions for $package.
2304df62
AD
1986
1987You may safely delete it if you wish.
1988EOF
1989
9507cadf 1990xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 1991case "$usedevel" in
0107c034 1992$define|true|[yY]*) ;;
9507cadf 1993*) case "$xversion" in
0107c034
JH
1994 *[13579])
1995 cat >&4 <<EOH
1996*** WHOA THERE!!! ***
1997
1998 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
1999 The version of this $package distribution is $xversion, that is, odd,
2000 (as opposed to even) and that signifies a development release.
3d5d58b1 2001 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2002
2003 Do ***NOT*** install this into production use.
2004 Data corruption and crashes are possible.
2005
2006 It is most seriously suggested that you do not continue any further
2007 unless you want to help in developing and debugging Perl.
2008
6adc6a45
JH
2009 If you *still* want to build perl, you can answer 'y' now,
2010 or pass -Dusedevel to Configure.
2011
0107c034
JH
2012EOH
2013 rp='Do you really want to continue?'
2014 dflt='n'
2015 . ./myread
2016 case "$ans" in
8feeef0e
JH
2017 [yY]) echo >&4 "Okay, continuing."
2018 usedevel="$define" ;;
0107c034
JH
2019 *) echo >&4 "Okay, bye."
2020 exit 1
2021 ;;
2022 esac
2023 ;;
2024 esac
2025 ;;
2026esac
8feeef0e
JH
2027case "$usedevel" in
2028$define|true|[yY]*)
2029 case "$versiononly" in
2030 '') versiononly="$define" ;;
2031 esac
2032 case "$installusrbinperl" in
2033 '') installusrbinperl="$undef" ;;
2034 esac
2035 ;;
2036esac
0107c034 2037
2304df62
AD
2038: general instructions
2039needman=true
2040firsttime=true
760ac839 2041user=`(logname) 2>/dev/null`
dfe9444c
AD
2042case "$user" in
2043'') user=`whoami 2>&1`;;
760ac839 2044esac
2304df62
AD
2045if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2046 firsttime=false
2047 echo " "
2048 rp='Would you like to see the instructions?'
2049 dflt=n
2050 . ./myread
2051 case "$ans" in
2052 [yY]*) ;;
2053 *) needman=false;;
2054 esac
2055fi
2056if $needman; then
2057 cat <<EOH
4e2a5f63 2058
2304df62 2059This installation shell script will examine your system and ask you questions
a0d0e21e 2060to determine how the perl5 package should be installed. If you get
2304df62
AD
2061stuck on a question, you may use a ! shell escape to start a subshell or
2062execute a command. Many of the questions will have default answers in square
2063brackets; typing carriage return will give you the default.
2064
2065On some of the questions which ask for file or directory names you are allowed
2066to use the ~name construct to specify the login directory belonging to "name",
2067even if you don't have a shell which knows about that. Questions where this is
2068allowed will be marked "(~name ok)".
2069
2070EOH
2071 rp=''
2072 dflt='Type carriage return to continue'
2073 . ./myread
2074 cat <<'EOH'
2075
2076The prompter used in this script allows you to use shell variables and
2077backticks in your answers. You may use $1, $2, etc... to refer to the words
2078in the default answer, as if the default line was a set of arguments given to a
2079script shell. This means you may also use $* to repeat the whole default line,
2080so you do not have to re-type everything to add something to the default.
2081
2082Everytime there is a substitution, you will have to confirm. If there is an
2083error (e.g. an unmatched backtick), the default answer will remain unchanged
2084and you will be prompted again.
2085
2086If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2087the questions and use the computed defaults (or the previous answers if there
2088was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2089You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2090on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2091
2092EOH
2093 . ./myread
2094 cat <<EOH
2095
2096Much effort has been expended to ensure that this shell script will run on any
2097Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2098Configure and run it again. If you can't run Configure for some reason,
2099you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2100have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2101
2102This installation script affects things in two ways:
2103
21041) it may do direct variable substitutions on some of the files included
2105 in this kit.
21062) it builds a config.h file for inclusion in C programs. You may edit
2107 any of these files as the need arises after running this script.
2108
2109If you make a mistake on a question, there is no easy way to back up to it
2110currently. The easiest thing to do is to edit config.sh and rerun all the SH
2111files. Configure will offer to let you do this before it runs the SH files.
2112
2113EOH
2114 dflt='Type carriage return to continue'
2115 . ./myread
2116 case "$firsttime" in
2117 true) echo $user >>../.config/instruct;;
2118 esac
2119fi
2120
2304df62
AD
2121: find out where common programs are
2122echo " "
2123echo "Locating common programs..." >&4
2124cat <<EOSC >loc
2125$startsh
2126case \$# in
21270) exit 1;;
2128esac
2129thing=\$1
2130shift
2131dflt=\$1
2132shift
2133for dir in \$*; do
2134 case "\$thing" in
2135 .)
2136 if test -d \$dir/\$thing; then
2137 echo \$dir
2138 exit 0
2139 fi
2140 ;;
2141 *)
a0d0e21e 2142 for thisthing in \$dir/\$thing; do
ecfc5424 2143 : just loop through to pick last item
a0d0e21e 2144 done
25f94b33 2145 if test -f \$thisthing; then
a0d0e21e 2146 echo \$thisthing
2304df62 2147 exit 0
a5a94ea5
JH
2148 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2149 echo \$thisthing
2150 exit 0
2304df62 2151 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2152 if test -n "$DJGPP"; then
2153 echo \$dir/\$thing.exe
2154 else
2155 : on Eunice apparently
2156 echo \$dir/\$thing
2157 fi
2304df62
AD
2158 exit 0
2159 fi
2160 ;;
2161 esac
2162done
2163echo \$dflt
2164exit 1
2165EOSC
2166chmod +x loc
2167$eunicefix loc
2168loclist="
2169awk
2170cat
f8006fac 2171chmod
b4eb6b3d
JH
2172comm
2173cp
2304df62
AD
2174echo
2175expr
2176grep
a0d0e21e 2177ls
b4eb6b3d 2178mkdir
2304df62
AD
2179rm
2180sed
b4eb6b3d 2181sort
85e6fe83 2182touch
2304df62 2183tr
b4eb6b3d 2184uniq
2304df62
AD
2185"
2186trylist="
2187Mcc
dfe9444c 2188ar
3659ebf1 2189bison
b4eb6b3d 2190byacc
2304df62 2191cpp
b4eb6b3d 2192csh
2304df62
AD
2193date
2194egrep
1fef16b3 2195gmake
8ff267be 2196gzip
b4eb6b3d 2197less
8ff267be 2198ln
3c728e00 2199make
b4eb6b3d 2200more
693762b4 2201nm
b4eb6b3d
JH
2202nroff
2203pg
2304df62
AD
2204test
2205uname
8ff267be 2206zip
2304df62 2207"
8e07c86e 2208pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2209pth="$pth /lib /usr/lib"
2210for file in $loclist; do
dfe9444c
AD
2211 eval xxx=\$$file
2212 case "$xxx" in
2213 /*|?:[\\/]*)
2214 if test -f "$xxx"; then
2215 : ok
2216 else
2217 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2218 xxx=`./loc $file $file $pth`
2219 fi
2220 ;;
2221 '') xxx=`./loc $file $file $pth`;;
2222 *) xxx=`./loc $xxx $xxx $pth`;;
2223 esac
a5a94ea5 2224 eval $file=$xxx$_exe
2304df62
AD
2225 eval _$file=$xxx
2226 case "$xxx" in
2227 /*)
2228 echo $file is in $xxx.
2229 ;;
8e07c86e
AD
2230 ?:[\\/]*)
2231 echo $file is in $xxx.
2232 ;;
2304df62 2233 *)
25f94b33
AD
2234 echo "I don't know where '$file' is, and my life depends on it." >&4
2235 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2236 exit 1
2304df62
AD
2237 ;;
2238 esac
2239done
2240echo " "
2241echo "Don't worry if any of the following aren't found..."
2242say=offhand
2243for file in $trylist; do
dfe9444c
AD
2244 eval xxx=\$$file
2245 case "$xxx" in
2246 /*|?:[\\/]*)
2247 if test -f "$xxx"; then
2248 : ok
2249 else
2250 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2251 xxx=`./loc $file $file $pth`
2252 fi
2253 ;;
2254 '') xxx=`./loc $file $file $pth`;;
2255 *) xxx=`./loc $xxx $xxx $pth`;;
2256 esac
306a8474 2257 eval $file=$xxx$_exe
2304df62
AD
2258 eval _$file=$xxx
2259 case "$xxx" in
2260 /*)
2261 echo $file is in $xxx.
2262 ;;
8e07c86e
AD
2263 ?:[\\/]*)
2264 echo $file is in $xxx.
2265 ;;
2304df62
AD
2266 *)
2267 echo "I don't see $file out there, $say."
2268 say=either
2269 ;;
2270 esac
2271done
2272case "$egrep" in
1fef16b3 2273egrep)
2304df62
AD
2274 echo "Substituting grep for egrep."
2275 egrep=$grep
868439a2 2276 _egrep=$grep
2304df62
AD
2277 ;;
2278esac
8ff267be 2279case "$ln" in
1fef16b3 2280ln)
8ff267be 2281 echo "Substituting cp for ln."
2282 ln=$cp
868439a2 2283 _ln=$cp
8ff267be 2284 ;;
2285esac
2e26f1d5
JH
2286case "$make" in
2287make)
2288 case "$gmake" in
2289 gmake)
2290 echo "I can't find make or gmake, and my life depends on it." >&4
2291 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2292 exit 1
2293 ;;
2294 esac
2295 ;;
2296esac
2297case "$gmake" in
2298gmake) ;;
2299*) # We can't have osname yet.
1fef16b3
JH
2300 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2301 # Assume that gmake, if found, is definitely GNU make
2302 # and prefer it over the system make.
2303 echo "Substituting gmake for make."
2304 make=$gmake
868439a2 2305 _make=$gmake
1fef16b3
JH
2306 fi
2307 ;;
a5a94ea5 2308esac
2304df62
AD
2309case "$test" in
2310test)
2311 echo "Hopefully test is built into your sh."
2312 ;;
2313*)
73614538 2314 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2315 echo "Using the test built into your sh."
2304df62
AD
2316 test=test
2317 _test=test
2318 fi
2319 ;;
2320esac
2321case "$echo" in
2322echo)
2323 echo "Hopefully echo is built into your sh."
2324 ;;
2325'') ;;
2326*)
2327 echo " "
2328echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2329 $echo $n "hi there$c" >foo1
2330 echo $n "hi there$c" >foo2
2331 if cmp foo1 foo2 >/dev/null 2>&1; then
2332 echo "They are compatible. In fact, they may be identical."
2333 else
2334 case "$n" in
2335 '-n') n='' c='\c';;
2336 *) n='-n' c='';;
2337 esac
2338 cat <<FOO
2339They are not compatible! You are probably running ksh on a non-USG system.
2340I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2341have echo built in and we may have to run some Bourne shell scripts. That
2342means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2343
2344FOO
2345 $echo $n "The star should be here-->$c"
2346 $echo "*"
2347 fi
2348 $rm -f foo1 foo2
2349 ;;
2350esac
2351
6b769f8f 2352cat <<EOS >trygcc
2573c5f9
JH
2353$startsh
2354EOS
6b769f8f 2355cat <<'EOSC' >>trygcc
2573c5f9
JH
2356case "$cc" in
2357'') ;;
2358*) $rm -f try try.*
2359 $cat >try.c <<EOM
2360int main(int argc, char *argv[]) {
2361 return 0;
2362}
2363EOM
e4778687 2364 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2365 :
2366 else
2367 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2368 despair=yes
2369 trygcc=yes
2370 case "$cc" in
2371 *gcc*) trygcc=no ;;
2372 esac
2373 case "`$cc -v -c try.c 2>&1`" in
2374 *gcc*) trygcc=no ;;
2375 esac
2376 if $test X"$trygcc" = Xyes; then
2377 if gcc -o try -c try.c; then
2378 echo " "
2379 echo "You seem to have a working gcc, though." >&4
2380 rp="Would you like to use it?"
2381 dflt=y
2382 if $test -f myread; then
2383 . ./myread
2384 else
2385 if $test -f UU/myread; then
2386 . ./UU/myread
2387 else
2388 echo "Cannot find myread, sorry. Aborting." >&2
2389 exit 1
2390 fi
2391 fi
2392 case "$ans" in
6371411c
RB
2393 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2394 if $test -f usethreads.cbu; then
2395 $cat >&4 <<EOM
2396
2397*** However, any setting of the C compiler flags (e.g. for thread support)
2398*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2399*** (together with e.g. -Dusethreads).
2400
2401EOM
2402 fi;;
2573c5f9
JH
2403 esac
2404 fi
2405 fi
6b769f8f
RB
2406 fi
2407 $rm -f try try.*
2408 ;;
2409esac
2410EOSC
2411
2412cat <<EOS >checkcc
2413$startsh
2414EOS
2415cat <<'EOSC' >>checkcc
2416case "$cc" in
2417'') ;;
2418*) $rm -f try try.*
2419 $cat >try.c <<EOM
2420int main(int argc, char *argv[]) {
2421 return 0;
2422}
2423EOM
2424 if $cc -o try $ccflags $ldflags try.c; then
2425 :
2426 else
2573c5f9 2427 if $test X"$despair" = Xyes; then
6b769f8f
RB
2428 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2429 fi
2430 $cat >&4 <<EOM
5dd4fbdf
MB
2431You need to find a working C compiler.
2432Either (purchase and) install the C compiler supplied by your OS vendor,
2433or for a free C compiler try http://gcc.gnu.org/
2434I cannot continue any further, aborting.
2435EOM
6b769f8f 2436 exit 1
2573c5f9
JH
2437 fi
2438 $rm -f try try.*
2439 ;;
2440esac
2441EOSC
2442
a0d0e21e
LW
2443: determine whether symbolic links are supported
2444echo " "
2445$touch blurfl
2446if $ln -s blurfl sym > /dev/null 2>&1 ; then
2447 echo "Symbolic links are supported." >&4
818f00be 2448 lns="$ln -s"
a0d0e21e
LW
2449else
2450 echo "Symbolic links are NOT supported." >&4
2451 lns="$ln"
2452fi
2453$rm -f blurfl sym
2454
dafca956
JH
2455: determine whether symbolic links are supported
2456echo " "
2457case "$lns" in
18ea2752 2458*"ln"*" -s")
dafca956
JH
2459 echo "Checking how to test for symbolic links..." >&4
2460 $lns blurfl sym
4b661809 2461 if $test "X$issymlink" = X; then
2e2a97a6
JH
2462 case "$newsh" in
2463 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2464 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2465 esac
5d644a95
MB
2466 if test $? = 0; then
2467 issymlink="test -h"
2e2a97a6
JH
2468 else
2469 echo "Your builtin 'test -h' may be broken." >&4
2470 case "$test" in
2471 /*) ;;
2472 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2473 for p in $pth
2474 do
2475 if test -f "$p/$test"; then
2476 test="$p/$test"
2477 break
2478 fi
2479 done
2480 ;;
2481 esac
2482 case "$test" in
2483 /*)
2484 echo "Trying external '$test -h'." >&4
2485 issymlink="$test -h"
2486 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2487 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2488 issymlink=''
2489 fi
2490 ;;
2491 *) issymlink='' ;;
2492 esac
5d644a95
MB
2493 fi
2494 fi
4b661809 2495 if $test "X$issymlink" = X; then
dafca956 2496 if $test -L sym 2>/dev/null; then
5d644a95 2497 issymlink="$test -L"
2e2a97a6 2498 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2499 fi
2500 fi
4b661809 2501 if $test "X$issymlink" != X; then
5d644a95 2502 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2503 else
2504 echo "I do not know how you can test for symbolic links." >&4
2505 fi
2506 $rm -f blurfl sym
2507 ;;
2508*) echo "No symbolic links, so not testing for their testing..." >&4
2509 ;;
2510esac
2511echo " "
2512
2513
2514case "$mksymlinks" in
2515$define|true|[yY]*)
2516 case "$src" in
2517 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2518 exit 1
2519 ;;
4b661809 2520 *) case "$lns:$issymlink" in
f314eb9f 2521 *"ln"*" -s:"*"test -"?)
dafca956
JH
2522 echo "Creating the symbolic links..." >&4
2523 echo "(First creating the subdirectories...)" >&4
2524 cd ..
2525 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2526 read directory
2527 test -z "$directory" && break
2528 mkdir -p $directory
2529 done
2530 # Sanity check 1.
2531 if test ! -d t/base; then
2532 echo "Failed to create the subdirectories. Aborting." >&4
2533 exit 1
2534 fi
2535 echo "(Then creating the symlinks...)" >&4
2536 awk '{print $1}' $src/MANIFEST | while true; do
2537 read filename
2538 test -z "$filename" && break
2539 if test -f $filename; then
5d644a95 2540 if $issymlink $filename; then
dafca956
JH
2541 rm -f $filename
2542 fi
2543 fi
2544 if test -f $filename; then
2545 echo "$filename already exists, not symlinking."
2546 else
2547 ln -s $src/$filename $filename
2548 fi
2549 done
2550 # Sanity check 2.
a0d24b8a
JH
2551 if test ! -f t/base/lex.t; then
2552 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2553 exit 1
2554 fi
2555 cd UU
2556 ;;
2557 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2558 ;;
2559 esac
2560 ;;
2561 esac
2562 ;;
2563esac
2564
5440bc8e
JH
2565
2566case "$usecrosscompile" in
2567$define|true|[yY]*)
93bc48fa 2568 $echo "Cross-compiling..."
5440bc8e
JH
2569 croak=''
2570 case "$cc" in
2571 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2572 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2573 ar=$targetarch-ar
2574 # leave out ld, choosing it is more complex
2575 nm=$targetarch-nm
2576 ranlib=$targetarch-ranlib
93bc48fa 2577 $echo 'extern int foo;' > try.c
f8006fac 2578 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2579 shift
2580 if $test $# -gt 0; then
2581 incpth="$incpth $*"
f8006fac
JH
2582 incpth="`$echo $incpth|$sed 's/^ //'`"
2583 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2584 for i in $*; do
f8006fac 2585 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2586 if $test -d $j; then
2587 libpth="$libpth $j"
2588 fi
2589 done
f8006fac
JH
2590 libpth="`$echo $libpth|$sed 's/^ //'`"
2591 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2592 fi
2593 $rm -f try.c
5440bc8e
JH
2594 ;;
2595 esac
2596 case "$targetarch" in
93bc48fa
JH
2597 '') echo "Targetarch not defined." >&4; croak=y ;;
2598 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2599 esac
2600 case "$incpth" in
93bc48fa 2601 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2602 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2603 esac
2604 case "$libpth" in
93bc48fa 2605 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2606 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2607 esac
93bc48fa
JH
2608 case "$usrinc" in
2609 '') for i in $incpth; do
2610 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2611 usrinc=$i
2612 echo "Guessing usrinc $usrinc." >&4
2613 break
2614 fi
2615 done
2616 case "$usrinc" in
2617 '') echo "Usrinc not defined." >&4; croak=y ;;
2618 esac
2619 ;;
2620 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2621 esac
93bc48fa
JH
2622 case "$targethost" in
2623 '') echo "Targethost not defined." >&4; croak=y ;;
2624 *) echo "Using targethost $targethost." >&4
5440bc8e 2625 esac
93bc48fa
JH
2626 locincpth=' '
2627 loclibpth=' '
5440bc8e 2628 case "$croak" in
93bc48fa 2629 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2630 esac
2631 case "$src" in
2632 /*) run=$src/Cross/run
93c0359c 2633 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2634 to=$src/Cross/to
2635 from=$src/Cross/from
2636 ;;
93bc48fa 2637 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2638 run=$pwd/Cross/run
f8006fac 2639 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2640 to=$pwd/Cross/to
2641 from=$pwd/Cross/from
2642 ;;
2643 esac
2644 case "$targetrun" in
2645 '') targetrun=ssh ;;
2646 esac
2647 case "$targetto" in
2648 '') targetto=scp ;;
2649 esac
2650 case "$targetfrom" in
2651 '') targetfrom=scp ;;
2652 esac
2653 run=$run-$targetrun
2654 to=$to-$targetto
2655 from=$from-$targetfrom
93bc48fa
JH
2656 case "$targetdir" in
2657 '') targetdir=/tmp
2658 echo "Guessing targetdir $targetdir." >&4
2659 ;;
2660 esac
5440bc8e 2661 case "$targetuser" in
93bc48fa
JH
2662 '') targetuser=root
2663 echo "Guessing targetuser $targetuser." >&4
2664 ;;
5440bc8e
JH
2665 esac
2666 case "$targetfrom" in
2667 scp) q=-q ;;
2668 *) q='' ;;
2669 esac
2670 case "$targetrun" in
2671 ssh|rsh)
2672 cat >$run <<EOF
2673#!/bin/sh
93c0359c
JH
2674case "\$1" in
2675-cwd)
2676 shift
2677 cwd=\$1
2678 shift
2679 ;;
2680esac
2681case "\$cwd" in
2682'') cwd=$targetdir ;;
2683esac
5440bc8e
JH
2684exe=\$1
2685shift
93c0359c
JH
2686if $test ! -f \$exe.xok; then
2687 $to \$exe
2688 $touch \$exe.xok
2689fi
2690$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2691EOF
2692 ;;
93bc48fa 2693 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2694 exit 1
2695 ;;
2696 esac
93c0359c
JH
2697 case "$targetmkdir" in
2698 */Cross/mkdir)
2699 cat >$targetmkdir <<EOF
2700#!/bin/sh
2701$targetrun -l $targetuser $targethost "mkdir -p \$@"
2702EOF
f8006fac 2703 $chmod a+rx $targetmkdir
93c0359c
JH
2704 ;;
2705 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2706 exit 1
2707 ;;
2708 esac
5440bc8e
JH
2709 case "$targetto" in
2710 scp|rcp)
2711 cat >$to <<EOF
2712#!/bin/sh
2713for f in \$@
2714do
93c0359c
JH
2715 case "\$f" in
2716 /*)
2717 $targetmkdir \`dirname \$f\`
2718 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2719 ;;
2720 *)
2721 $targetmkdir $targetdir/\`dirname \$f\`
2722 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2723 ;;
2724 esac
5440bc8e
JH
2725done
2726exit 0
2727EOF
2728 ;;
2729 cp) cat >$to <<EOF
2730#!/bin/sh
93c0359c
JH
2731for f in \$@
2732do
2733 case "\$f" in
2734 /*)
2735 $mkdir -p $targetdir/\`dirname \$f\`
2736 $cp \$f $targetdir/\$f || exit 1
2737 ;;
2738 *)
2739 $targetmkdir $targetdir/\`dirname \$f\`
2740 $cp \$f $targetdir/\$f || exit 1
2741 ;;
2742 esac
2743done
2744exit 0
5440bc8e
JH
2745EOF
2746 ;;
93bc48fa 2747 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2748 exit 1
2749 ;;
2750 esac
2751 case "$targetfrom" in
2752 scp|rcp)
2753 cat >$from <<EOF
2754#!/bin/sh
2755for f in \$@
2756do
93c0359c 2757 $rm -f \$f
5440bc8e
JH
2758 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2759done
2760exit 0
2761EOF
2762 ;;
2763 cp) cat >$from <<EOF
2764#!/bin/sh
2765for f in \$@
2766do
93c0359c 2767 $rm -f \$f
5440bc8e
JH
2768 cp $targetdir/\$f . || exit 1
2769done
2770exit 0
2771EOF
2772 ;;
93bc48fa 2773 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2774 exit 1
2775 ;;
2776 esac
93bc48fa
JH
2777 if $test ! -f $run; then
2778 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2779 else
f8006fac 2780 $chmod a+rx $run
5440bc8e 2781 fi
93bc48fa
JH
2782 if $test ! -f $to; then
2783 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2784 else
f8006fac 2785 $chmod a+rx $to
5440bc8e 2786 fi
93bc48fa
JH
2787 if $test ! -f $from; then
2788 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2789 else
f8006fac 2790 $chmod a+rx $from
5440bc8e 2791 fi
93bc48fa 2792 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2793 exit 1
2794 fi
2795 cat >&4 <<EOF
f8006fac
JH
2796Using '$run' for remote execution,
2797and '$from' and '$to'
93bc48fa 2798for remote file transfer.
5440bc8e
JH
2799EOF
2800 ;;
2801*) run=''
2802 to=:
2803 from=:
2804 usecrosscompile='undef'
2805 targetarch=''
2806 ;;
2807esac
2808
ecfc5424
AD
2809: see whether [:lower:] and [:upper:] are supported character classes
2810echo " "
ecfc5424
AD
2811case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2812ABYZ)
2813 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2814 up='[:upper:]'
2815 low='[:lower:]'
2816 ;;
28e8609d
JH
2817*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2818 # (0xc9 and 0xd1), therefore that is a nice testing point.
2819 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2820 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2821 ij) up='[A-Z]'
2822 low='[a-z]'
2823 ;;
2824 esac
2825 fi
2826 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2827 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2828 ij) up='A-Z'
2829 low='a-z'
2830 ;;
2831 esac
2832 fi
2833 if test "X$up" = X -o "X$low" = X; then
2834 case "`echo IJ | od -x 2>/dev/null`" in
2835 *C9D1*|*c9d1*)
2836 echo "Hey, this might be EBCDIC." >&4
2837 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2838 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2839 ij) up='[A-IJ-RS-Z]'
2840 low='[a-ij-rs-z]'
2841 ;;
2842 esac
2843 fi
2844 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2845 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2846 ij) up='A-IJ-RS-Z'
2847 low='a-ij-rs-z'
2848 ;;
2849 esac
2850 fi
2851 ;;
2852 esac
2853 fi
2854esac
3eaeeeae 2855case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2856ij)
2857 echo "Using $up and $low to convert case." >&4
2858 ;;
ecfc5424 2859*)
28e8609d
JH
2860 echo "I don't know how to translate letters from upper to lower case." >&4
2861 echo "Your tr is not acting any way I know of." >&4
2862 exit 1
2863 ;;
ecfc5424
AD
2864esac
2865: set up the translation script tr, must be called with ./tr of course
2866cat >tr <<EOSC
2867$startsh
2868case "\$1\$2" in
2869'[A-Z][a-z]') exec $tr '$up' '$low';;
2870'[a-z][A-Z]') exec $tr '$low' '$up';;
2871esac
2872exec $tr "\$@"
2873EOSC
2874chmod +x tr
2875$eunicefix tr
2876
2304df62
AD
2877: Try to determine whether config.sh was made on this system
2878case "$config_sh" in
2879'')
43999f95
JH
2880myuname=`$uname -a 2>/dev/null`
2881$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2882# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2883# because the A-Z/a-z are not consecutive.
a0d0e21e 2884myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2885 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2886newmyuname="$myuname"
2304df62 2887dflt=n
16d20bd9
AD
2888case "$knowitall" in
2889'')
2890 if test -f ../config.sh; then
2891 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2892 eval "`grep myuname= ../config.sh`"
2893 fi
2894 if test "X$myuname" = "X$newmyuname"; then
2895 dflt=y
2896 fi
2304df62 2897 fi
16d20bd9
AD
2898 ;;
2899*) dflt=y;;
2900esac
2304df62
AD
2901
2902: Get old answers from old config file if Configure was run on the
2903: same system, otherwise use the hints.
2904hint=default
2905cd ..
2906if test -f config.sh; then
16d20bd9
AD
2907 echo " "
2908 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2909 . UU/myread
2910 case "$ans" in
f83701cd
AD
2911 n*|N*) echo "OK, I'll ignore it."
2912 mv config.sh config.sh.old
2913 myuname="$newmyuname"
2914 ;;
2304df62 2915 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2916 tmp_n="$n"
2917 tmp_c="$c"
85cad39c 2918 tmp_sh="$sh"
2304df62
AD
2919 . ./config.sh
2920 cp config.sh UU
ecfc5424
AD
2921 n="$tmp_n"
2922 c="$tmp_c"
85cad39c 2923 : Older versions did not always set $sh. Catch re-use of such
2924 : an old config.sh.
2925 case "$sh" in
2926 '') sh="$tmp_sh" ;;
2927 esac
2304df62
AD
2928 hint=previous
2929 ;;
2930 esac
2931fi
2573c5f9 2932. ./UU/checkcc
2304df62
AD
2933if test ! -f config.sh; then
2934 $cat <<EOM
2935
4e2a5f63
AD
2936First time through, eh? I have some defaults handy for some systems
2937that need some extra help getting the Configure answers right:
2304df62
AD
2938
2939EOM
dfe9444c 2940 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2941 dflt=''
2942 : Half the following guesses are probably wrong... If you have better
7f2de2d2 2943 : tests or hints, please send them to perlbug@perl.org
2304df62 2944 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2945 $test -f /irix && osname=irix
85e6fe83
LW
2946 $test -f /xenix && osname=sco_xenix
2947 $test -f /dynix && osname=dynix
2948 $test -f /dnix && osname=dnix
5f05dabc 2949 $test -f /lynx.os && osname=lynxos
2950 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2951 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2952 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2953 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2954 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2955 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2956 $test -d /usr/apollo/bin && osname=apollo
2957 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2958 $test -d /usr/include/minix && osname=minix
d54344fc 2959 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 2960 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2961 osname=machten
4633a7c4 2962 if $test -x /sbin/version; then
dfe9444c 2963 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2964 $sed -e 's/[A-Za-z]$//'`
2965 elif $test -x /usr/etc/version; then
dfe9444c 2966 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2967 $sed -e 's/[A-Za-z]$//'`
2968 else
2969 osvers="$2.$3"
2970 fi
2971 fi
aaacdc8b
GS
2972
2973 $test -f /sys/posix.dll &&
2974 $test -f /usr/bin/what &&
2975 set X `/usr/bin/what /sys/posix.dll` &&
2976 $test "$3" = UWIN &&
2977 osname=uwin &&
2978 osvers="$5"
2979
2304df62
AD
2980 if $test -f $uname; then
2981 set X $myuname
2982 shift
2983
2304df62 2984 case "$5" in
85e6fe83 2985 fps*) osname=fps ;;
2304df62
AD
2986 mips*)
2987 case "$4" in
85e6fe83
LW
2988 umips) osname=umips ;;
2989 *) osname=mips ;;
2304df62 2990 esac;;
85e6fe83
LW
2991 [23]100) osname=mips ;;
2992 next*) osname=next ;;
ecfc5424 2993 i386*)
c6912327
JH
2994 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2995 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2996 osname='sco'
2997 osvers=$tmp
2998 elif $test -f /etc/kconfig; then
ecfc5424 2999 osname=isc
bd628c73 3000 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3001 osvers=4
3002 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3003 osvers=3
2304df62 3004 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3005 osvers=2
ecfc5424
AD
3006 fi
3007 fi
2000072c 3008 tmp=''
ecfc5424 3009 ;;
c4f23d77
AD
3010 pc*)
3011 if test -n "$DJGPP"; then
3012 osname=dos
3013 osvers=djgpp
3014 fi
3015 ;;
2304df62
AD
3016 esac
3017
3018 case "$1" in
a0d0e21e
LW
3019 aix) osname=aix
3020 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3021 case "$tmp" in
1aef975c 3022 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
3023 '<3240'|'<>3240') osvers=3.2.0 ;;
3024 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3025 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3026 *) osvers=$tmp;;
a0d0e21e
LW
3027 esac
3028 ;;
aaacdc8b
GS
3029 bsd386) osname=bsd386
3030 osvers=`$uname -r`
3031 ;;
3032 cygwin*) osname=cygwin
3033 osvers="$3"
3034 ;;
23f87696
SZ
3035 *dc.osx) osname=dcosx
3036 osvers="$3"
3037 ;;
a0d0e21e
LW
3038 dnix) osname=dnix
3039 osvers="$3"
3040 ;;
3041 domainos) osname=apollo
3042 osvers="$3"
3043 ;;
3044 dgux) osname=dgux
3045 osvers="$3"
3046 ;;
760ac839 3047 dynixptx*) osname=dynixptx
e58e581d 3048 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3049 ;;
a0d0e21e
LW
3050 freebsd) osname=freebsd
3051 osvers="$3" ;;
3052 genix) osname=genix ;;
3053 hp*) osname=hpux
bfb7748a 3054 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3055 ;;
a78b0d02 3056 irix*) osname=irix
a0d0e21e
LW
3057 case "$3" in
3058 4*) osvers=4 ;;
3059 5*) osvers=5 ;;
ecfc5424 3060 *) osvers="$3" ;;
a0d0e21e
LW
3061 esac
3062 ;;
3063 linux) osname=linux
3064 case "$3" in
a0d0e21e
LW
3065 *) osvers="$3" ;;
3066 esac
3067 ;;
28e8609d
JH
3068 MiNT) osname=mint
3069 ;;
3070 netbsd*) osname=netbsd
ecfc5424
AD
3071 osvers="$3"
3072 ;;
4e81affe
MM
3073 news-os) osvers="$3"
3074 case "$3" in
3075 4*) osname=newsos4 ;;
3076 *) osname=newsos ;;
3077 esac
3078 ;;
aaacdc8b 3079 next*) osname=next ;;
28bb1e2c 3080 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3081 openbsd) osname=openbsd
3082 osvers="$3"
3083 ;;
aaacdc8b
GS
3084 POSIX-BC | posix-bc ) osname=posix-bc
3085 osvers="$3"
a0d0e21e 3086 ;;
ae3afa4e
TH
3087 powerux | power_ux | powermax_os | powermaxos | \
3088 powerunix | power_unix) osname=powerux
3089 osvers="$3"
3090 ;;
aaacdc8b
GS
3091 qnx) osname=qnx
3092 osvers="$4"
3093 ;;
a0d0e21e
LW
3094 solaris) osname=solaris
3095 case "$3" in
3096 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3097 *) osvers="$3" ;;
a0d0e21e
LW
3098 esac
3099 ;;
85e6fe83
LW
3100 sunos) osname=sunos
3101 case "$3" in
85e6fe83
LW
3102 5*) osname=solaris
3103 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3104 *) osvers="$3" ;;
2304df62
AD
3105 esac
3106 ;;
a0d0e21e 3107 titanos) osname=titanos
85e6fe83 3108 case "$3" in
a0d0e21e
LW
3109 1*) osvers=1 ;;
3110 2*) osvers=2 ;;
3111 3*) osvers=3 ;;
3112 4*) osvers=4 ;;
ecfc5424 3113 *) osvers="$3" ;;
2304df62
AD
3114 esac
3115 ;;
85e6fe83 3116 ultrix) osname=ultrix
ecfc5424 3117 osvers="$3"
2304df62 3118 ;;
28757baa 3119 osf1|mls+) case "$5" in
fed7345c
AD
3120 alpha)
3121 osname=dec_osf
2aa76180
JH
3122 osvers=`sizer -v | awk '{print $3}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3123 case "$osvers" in
3124 [1-9].[0-9]*) ;;
3125 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3126 esac
ecfc5424
AD
3127 ;;
3128 hp*) osname=hp_osf1 ;;
3129 mips) osname=mips_osf1 ;;
85e6fe83
LW
3130 esac
3131 ;;
0337d152
BG
3132 unixware) osname=svr5
3133 osvers="$4"
3134 ;;
3c728e00 3135 uts) osname=uts
a0d0e21e
LW
3136 osvers="$3"
3137 ;;
3c728e00
JH
3138 vos) osvers="$3"
3139 ;;
85e6fe83 3140 $2) case "$osname" in
2304df62 3141 *isc*) ;;
a0d0e21e 3142 *freebsd*) ;;
5f05dabc 3143 svr*)
a0d0e21e
LW
3144 : svr4.x or possibly later
3145 case "svr$3" in
3146 ${osname}*)
3147 osname=svr$3
3148 osvers=$4
3149 ;;
3150 esac
3151 case "$osname" in
3152 svr4.0)
3153 : Check for ESIX
3154 if test -f /stand/boot ; then
3155 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3156 if test -n "$INITPROG" -a -f "$INITPROG"; then
3157 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3158 if test -n "$isesix"; then
a0d0e21e
LW
3159 osname=esix4
3160 fi
3161 fi
3162 fi
3163 ;;
3164 esac
3165 ;;
2304df62 3166 *) if test -f /etc/systemid; then
a0d0e21e
LW
3167 osname=sco
3168 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3169 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3170 osvers=$1.$2.$3
c4f23d77 3171 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3172 osvers=$1.$2
c4f23d77 3173 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3174 osvers=$1
2304df62 3175 fi
a0d0e21e
LW
3176 else
3177 case "$osname" in
3178 '') : Still unknown. Probably a generic Sys V.
3179 osname="sysv"
3180 osvers="$3"
3181 ;;
3182 esac
2304df62
AD
3183 fi
3184 ;;
3185 esac
3186 ;;
a0d0e21e
LW
3187 *) case "$osname" in
3188 '') : Still unknown. Probably a generic BSD.
3189 osname="$1"
3190 osvers="$3"
3191 ;;
3192 esac
3193 ;;
2304df62
AD
3194 esac
3195 else
dfe9444c
AD
3196 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3197 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3198 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3199 osname=news_os
2304df62 3200 fi
dfe9444c 3201 $rm -f UU/kernel.what
8e07c86e
AD
3202 elif test -d c:/.; then
3203 set X $myuname
3204 osname=os2
3205 osvers="$5"
2304df62
AD
3206 fi
3207 fi
85e6fe83 3208
5440bc8e
JH
3209 case "$targetarch" in
3210 '') ;;
3211 *) hostarch=$osname
3212 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3213 osvers=''
3214 ;;
3215 esac
3216
a0d0e21e
LW
3217 : Now look for a hint file osname_osvers, unless one has been
3218 : specified already.
3219 case "$hintfile" in
3220 ''|' ')
1e127011 3221 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3222 : Also try without trailing minor version numbers.
1e127011
DD
3223 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3224 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3225 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3226 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3227 case "$file" in
3228 '') dflt=none ;;
3229 *) case "$osvers" in
3230 '') dflt=$file
3231 ;;
dfe9444c 3232 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3233 dflt=$file
dfe9444c 3234 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3235 dflt=$xfile
dfe9444c 3236 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3237 dflt=$xxfile
dfe9444c 3238 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3239 dflt=$xxxfile
dfe9444c 3240 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3241 dflt=$xxxxfile
dfe9444c 3242 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3243 dflt="${osname}"
3244 else
3245 dflt=none
3246 fi
3247 ;;
3248 esac
85e6fe83
LW
3249 ;;
3250 esac
4e2a5f63
AD
3251 if $test -f Policy.sh ; then
3252 case "$dflt" in
3253 *Policy*) ;;
3254 none) dflt="Policy" ;;
3255 *) dflt="Policy $dflt" ;;
3256 esac
3257 fi
85e6fe83 3258 ;;
a0d0e21e 3259 *)
ecfc5424 3260 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3261 ;;
2304df62 3262 esac
1aef975c 3263
4e2a5f63
AD
3264 if $test -f Policy.sh ; then
3265 $cat <<EOM
3266
3267There's also a Policy hint file available, which should make the
3268site-specific (policy) questions easier to answer.
3269EOM
3270
3271 fi
3272
2304df62
AD
3273 $cat <<EOM
3274
3275You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3276A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3277is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3278
3279EOM
4e2a5f63 3280
2304df62 3281 rp="Which of these apply, if any?"
dfe9444c 3282 . UU/myread
85e6fe83
LW
3283 tans=$ans
3284 for file in $tans; do
4e2a5f63
AD
3285 if $test X$file = XPolicy -a -f Policy.sh; then
3286 . Policy.sh
3287 $cat Policy.sh >> UU/config.sh
3288 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3289 . $src/hints/$file.sh
3290 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3291 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3292 : nothing
3293 else
85e6fe83
LW
3294 : Give one chance to correct a possible typo.
3295 echo "$file.sh does not exist"
3296 dflt=$file
3297 rp="hint to use instead?"
dfe9444c 3298 . UU/myread
85e6fe83 3299 for file in $ans; do
dfe9444c
AD
3300 if $test -f "$src/hints/$file.sh"; then
3301 . $src/hints/$file.sh
3302 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3303 elif $test X$ans = X -o X$ans = Xnone ; then
3304 : nothing
3305 else
3306 echo "$file.sh does not exist -- ignored."
3307 fi
3308 done
2304df62
AD
3309 fi
3310 done
85e6fe83 3311
2304df62 3312 hint=recommended
85e6fe83 3313 : Remember our hint file for later.
dfe9444c 3314 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3315 hintfile="$file"
85e6fe83 3316 else
a0d0e21e 3317 hintfile=''
85e6fe83 3318 fi
2304df62
AD
3319fi
3320cd UU
3321;;
3322*)
3323 echo " "
3324 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3325 tmp_n="$n"
3326 tmp_c="$c"
2304df62
AD
3327 cd ..
3328 cp $config_sh config.sh 2>/dev/null
a78b0d02 3329 chmod +w config.sh
2304df62
AD
3330 . ./config.sh
3331 cd UU
3332 cp ../config.sh .
ecfc5424
AD
3333 n="$tmp_n"
3334 c="$tmp_c"
2304df62
AD
3335 hint=previous
3336 ;;
3337esac
1aef975c 3338test "$override" && . ./optdef.sh
2304df62
AD
3339
3340: Restore computed paths
3341for file in $loclist $trylist; do
3342 eval $file="\$_$file"
3343done
3344
85e6fe83 3345cat << EOM
a0d0e21e 3346
85e6fe83 3347Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3348The default value is probably right if the name rings a bell. Otherwise,
3349since spelling matters for me, either accept the default or answer "none"
3350to leave it blank.
a0d0e21e 3351
85e6fe83 3352EOM
85e6fe83 3353case "$osname" in
a0d0e21e 3354 ''|' ')
85e6fe83 3355 case "$hintfile" in
a0d0e21e 3356 ''|' '|none) dflt=none ;;
ecfc5424 3357 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3358 esac
3359 ;;
3360 *) dflt="$osname" ;;
3361esac
3362rp="Operating system name?"
3363. ./myread
3364case "$ans" in
ecfc5424
AD
3365none) osname='' ;;
3366*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3367esac
8ff267be 3368echo " "
3369case "$osvers" in
3370 ''|' ')
3371 case "$hintfile" in
3372 ''|' '|none) dflt=none ;;
3373 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3374 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3375 case "$dflt" in
3376 ''|' ') dflt=none ;;
3377 esac
3378 ;;
3379 esac
3380 ;;
3381 *) dflt="$osvers" ;;
3382esac
3383rp="Operating system version?"
3384. ./myread
3385case "$ans" in
3386none) osvers='' ;;
3387*) osvers="$ans" ;;
3388esac
3389
02e93a22
JH
3390
3391. ./posthint.sh
3392
2304df62 3393: who configured the system
59b83a6f 3394cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3395cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3396case "$cf_by" in
3397"")
8ff267be 3398 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3399 case "$cf_by" in
3400 "") cf_by=unknown ;;
8ff267be 3401 esac ;;
3402esac
2304df62 3403
b4eb6b3d
JH
3404: set up the script used to warn in case of inconsistency
3405cat <<EOS >whoa
3406$startsh
3407EOS
3408cat <<'EOSC' >>whoa
3409dflt=y
3410echo " "
3411echo "*** WHOA THERE!!! ***" >&4
3412echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3413rp=" Keep the $hint value?"
3414. ./myread
3415case "$ans" in
3416y) td=$was; tu=$was;;
3417esac
3418EOSC
3419
3420: function used to set $1 to $val
3421setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3422case "$val$was" in
3423$define$undef) . ./whoa; eval "$var=\$td";;
3424$undef$define) . ./whoa; eval "$var=\$tu";;
3425*) eval "$var=$val";;
3426esac'
3427
3428case "$usethreads" in
3429$define|true|[yY]*) dflt='y';;
8e285145
AD
3430*) # Catch case where user specified ithreads or 5005threads but
3431 # forgot -Dusethreads (A.D. 4/2002)
3432 case "$useithreads$use5005threads" in
3433 *$define*) dflt='y' ;;
3434 *) dflt='n';;
3435 esac
3436 ;;
b4eb6b3d
JH
3437esac
3438cat <<EOM
3439
3440Perl can be built to take advantage of threads on some systems.
3441To do so, Configure can be run with -Dusethreads.
3442
bfce6503
DM
3443Note that Perl built with threading support runs slightly slower
3444and uses more memory than plain Perl. The current implementation
3445is believed to be stable, but it is fairly new, and so should be
3446treated with caution.
b4eb6b3d
JH
3447
3448If this doesn't make any sense to you, just accept the default '$dflt'.
3449EOM
3450rp='Build a threading Perl?'
3451. ./myread
3452case "$ans" in
3453y|Y) val="$define" ;;
3454*) val="$undef" ;;
3455esac
3456set usethreads
3457eval $setvar
3458
3459case "$usethreads" in
3460$define)
3461 $cat <<EOM
3462
bfce6503
DM
3463Since release 5.6, Perl has had two different threading implementations,
3464the newer interpreter-based version (ithreads) with one interpreter per
3465thread, and the older 5.005 version (5005threads).
3466The 5005threads version is effectively unmaintained and will probably be
3467removed in Perl 5.10, so there should be no need to build a Perl using it
3468unless needed for backwards compatibility with some existing 5.005threads
3469code.
b4eb6b3d 3470
b4eb6b3d
JH
3471EOM
3472 : Default to ithreads unless overridden on command line or with
3473 : old config.sh
3474 dflt='y'
3475 case "$use5005threads" in
3476 $define|true|[yY]*) dflt='n';;
3477 esac
3478 case "$useithreads" in
3479 $undef|false|[nN]*) dflt='n';;
3480 esac
bfce6503 3481 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3482 . ./myread
3483 case "$ans" in
3484 y|Y) val="$define" ;;
3485 *) val="$undef" ;;
3486 esac
3487 set useithreads
3488 eval $setvar
3489 : Now set use5005threads to the opposite value.
3490 case "$useithreads" in
3491 $define) val="$undef" ;;
3492 *) val="$define" ;;
3493 esac
3494 set use5005threads
3495 eval $setvar
3496 ;;
3497*)
3498 useithreads="$undef"
3499 use5005threads="$undef"
3500 ;;
3501esac
3502
c915ce7f
JH
3503case "$useithreads$use5005threads" in
3504"$define$define")
3505 $cat >&4 <<EOM
3506
3507You cannot have both the ithreads and the 5.005 threads enabled
3508at the same time. Disabling the 5.005 threads since they are
3509much less stable than the ithreads.
3510
3511EOM
3512 use5005threads="$undef"
3513 ;;
3514esac
3515
b4eb6b3d
JH
3516case "$d_oldpthreads" in
3517'') : Configure tests would be welcome here. For now, assume undef.
3518 val="$undef" ;;
3519*) val="$d_oldpthreads" ;;
3520esac
3521set d_oldpthreads
3522eval $setvar
3523
3524
3525case "$usethreads" in
3526"$define"|true|[yY]*)
3527: Look for a hint-file generated 'call-back-unit'. If the
3528: user has specified that a threading perl is to be built,
3529: we may need to set or change some other defaults.
3530 if $test -f usethreads.cbu; then
3531 echo "Your platform has some specific hints for threaded builds, using them..."
3532 . ./usethreads.cbu
3533 else
3534 $cat <<EOM
3535(Your platform doesn't have any specific hints for threaded builds.
3536 Assuming POSIX threads, then.)
3537EOM
3538 fi
3539 ;;
3540esac
3541
3542cat <<EOM
3543
3544Perl can be built so that multiple Perl interpreters can coexist
3545within the same Perl executable.
3546EOM
3547
3548case "$useithreads" in
3549$define)
3550 cat <<EOM
3551This multiple interpreter support is required for interpreter-based threads.
3552EOM
3553 val="$define"
3554 ;;
3555*) case "$usemultiplicity" in
3556 $define|true|[yY]*) dflt='y';;
3557 *) dflt='n';;
3558 esac
3559 echo " "
3560 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3561 rp='Build Perl for multiplicity?'
3562 . ./myread
3563 case "$ans" in
3564 y|Y) val="$define" ;;
3565 *) val="$undef" ;;
3566 esac
3567 ;;
3568esac
3569set usemultiplicity
3570eval $setvar
3571
96056487
JH
3572
3573case "$usemorebits" in
3574"$define"|true|[yY]*)
3575 use64bitint="$define"
3576 uselongdouble="$define"
3577 usemorebits="$define"
3578 ;;
3579*) usemorebits="$undef"
3580 ;;
3581esac
3582
e5e20432
JH
3583: make some quick guesses about what we are up against
3584echo " "
3585$echo $n "Hmm... $c"
3586echo exit 1 >bsd
3587echo exit 1 >usg
3588echo exit 1 >v7
3589echo exit 1 >osf1
3590echo exit 1 >eunice
3591echo exit 1 >xenix
3592echo exit 1 >venix
3593echo exit 1 >os2
3594d_bsd="$undef"
3595$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3596if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3597then
3598 echo "Looks kind of like an OSF/1 system, but we'll see..."
3599 echo exit 0 >osf1
381aa1ff 3600elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3601 xxx=`./loc addbib blurfl $pth`
3602 if $test -f $xxx; then
3603 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3604 echo exit 0 >bsd
3605 echo exit 0 >usg
3606 else
3607 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3608 echo "Looks kind of like an extended USG system, but we'll see..."
3609 else
3610 echo "Looks kind of like a USG system, but we'll see..."
3611 fi
3612 echo exit 0 >usg
3613 fi
3614elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3615 echo "Looks kind of like a BSD system, but we'll see..."
3616 d_bsd="$define"
3617 echo exit 0 >bsd
3618else
3619 echo "Looks kind of like a Version 7 system, but we'll see..."
3620 echo exit 0 >v7
3621fi
3622case "$eunicefix" in
3623*unixtovms*)
3624 $cat <<'EOI'
3625There is, however, a strange, musty smell in the air that reminds me of
3626something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3627EOI
3628 echo exit 0 >eunice
3629 d_eunice="$define"
3630: it so happens the Eunice I know will not run shell scripts in Unix format
3631 ;;
3632*)
3633 echo " "
3634 echo "Congratulations. You aren't running Eunice."
3635 d_eunice="$undef"
3636 ;;
3637esac
3638: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3639: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3640: semicolon as a patch separator
e5e20432
JH
3641case "$p_" in
3642:) ;;
3643*)
3644 $cat <<'EOI'
3645I have the feeling something is not exactly right, however...don't tell me...
3646lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3647(Or you may be running DOS with DJGPP.)
e5e20432
JH
3648EOI
3649 echo exit 0 >os2
3650 ;;
3651esac
3652if test -f /xenix; then
3653 echo "Actually, this looks more like a XENIX system..."
3654 echo exit 0 >xenix
3655 d_xenix="$define"
3656else
3657 echo " "
3658 echo "It's not Xenix..."
3659 d_xenix="$undef"
3660fi
3661chmod +x xenix
3662$eunicefix xenix
3663if test -f /venix; then
3664 echo "Actually, this looks more like a VENIX system..."
3665 echo exit 0 >venix
3666else
3667 echo " "
3668 if ./xenix; then
3669 : null
3670 else
3671 echo "Nor is it Venix..."
3672 fi
3673fi
3674chmod +x bsd usg v7 osf1 eunice xenix venix os2
3675$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3676$rm -f foo
3677
5869b1f1
JH
3678case "$cc" in
3679'') dflt=cc;;
3680*) dflt="$cc";;
3681esac
3682rp="Use which C compiler?"
3683. ./myread
3684cc="$ans"
6b769f8f
RB
3685
3686: See if they have not cc but they do have gcc
3687. ./trygcc
e5e20432
JH
3688: Look for a hint-file generated 'call-back-unit'. Now that the
3689: user has specified the compiler, we may need to set or change some
3690: other defaults.
3691if $test -f cc.cbu; then
3692 . ./cc.cbu
3693fi
2573c5f9 3694. ./checkcc
8a27cf78 3695
e5e20432
JH
3696echo " "
3697echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3698$cat >try.c <<EOM
e5e20432
JH
3699#include <stdio.h>
3700int main() {
3701#ifdef __GNUC__
3702#ifdef __VERSION__
3703 printf("%s\n", __VERSION__);
3704#else
3705 printf("%s\n", "1");
3706#endif
3707#endif
3708 exit(0);
3709}
3710EOM
5440bc8e
JH
3711if $cc -o try $ccflags $ldflags try.c; then
3712 gccversion=`$run ./try`
e5e20432
JH
3713 case "$gccversion" in
3714 '') echo "You are not using GNU cc." ;;
fc68435e 3715 *) echo "You are using GNU cc $gccversion."
e723fc21 3716 ccname=gcc
fc68435e 3717 ;;
e5e20432
JH
3718 esac
3719else
3720 echo " "
3721 echo "*** WHOA THERE!!! ***" >&4
3722 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3723 case "$knowitall" in
3724 '')
3725 echo " You'd better start hunting for one and let me know about it." >&4
3726 exit 1
3727 ;;
3728 esac
3729fi
5440bc8e 3730$rm -f try try.*
e5e20432
JH
3731case "$gccversion" in
37321*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3733esac
5b463ca7
KS
3734case "$gccversion" in
3735'') gccosandvers='' ;;
10b4ebb5
JH
3736*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3737 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3738 gccshortvers=''
5b463ca7 3739 case "$gccosandvers" in
02903077
JH
3740 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3741 $osname$osvers) ;; # looking good
5b463ca7
KS
3742 $osname*) cat <<EOM >&4
3743
3744*** WHOA THERE!!! ***
3745
3746 Your gcc has not been compiled for the exact release of
3747 your operating system ($gccosandvers versus $osname$osvers).
3748
3749 In general it is a good idea to keep gcc synchronized with
3750 the operating system because otherwise serious problems
3751 may ensue when trying to compile software, like Perl.
3752
3753 I'm trying to be optimistic here, though, and will continue.
3754 If later during the configuration and build icky compilation
02903077
JH
3755 problems appear (headerfile conflicts being the most common
3756 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3757 your operating system release.
3758
3759EOM
3760 ;;
81575342 3761 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3762 esac
3763 ;;
3764esac
e723fc21
JH
3765case "$ccname" in
3766'') ccname="$cc" ;;
3767esac
e5e20432 3768
640374d0 3769
bd9b35c9
JH
3770: decide how portable to be. Allow command line overrides.
3771case "$d_portable" in
3772"$undef") ;;
3773*) d_portable="$define" ;;
104d25b7 3774esac
85ab1d1d 3775
bd9b35c9
JH
3776: set up shell script to do ~ expansion
3777cat >filexp <<EOSS
3778$startsh
3779: expand filename
3780case "\$1" in
3781 ~/*|~)
3782 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3783 ;;
3784 ~*)
3785 if $test -f /bin/csh; then
3786 /bin/csh -f -c "glob \$1"
3787 failed=\$?
3788 echo ""
3789 exit \$failed
e5e20432 3790 else
bd9b35c9
JH
3791 name=\`$expr x\$1 : '..\([^/]*\)'\`
3792 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3793 if $test ! -d "\$dir"; then
3794 me=\`basename \$0\`
3795 echo "\$me: can't locate home directory for: \$name" >&2
3796 exit 1
3797 fi
3798 case "\$1" in
3799 */*)
3800 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3801 ;;
3802 *)
3803 echo \$dir
e5e20432
JH
3804 ;;
3805 esac
3806 fi
b691c02f 3807 ;;
4633a7c4 3808*)
bd9b35c9 3809 echo \$1
2304df62
AD
3810 ;;
3811esac
4633a7c4
LW
3812EOSS
3813chmod +x filexp
3814$eunicefix filexp
2304df62
AD
3815
3816: now set up to get a file name
28757baa 3817cat <<EOS >getfile
3818$startsh
3819EOS
3820cat <<'EOSC' >>getfile
2304df62
AD
3821tilde=''
3822fullpath=''
3823already=''
3824skip=''
3825none_ok=''
3826exp_file=''
a0d0e21e 3827nopath_ok=''
2304df62
AD
3828orig_rp="$rp"
3829orig_dflt="$dflt"
b233458b
JH
3830case "$gfpth" in
3831'') gfpth='.' ;;
3832esac
2304df62
AD
3833
3834case "$fn" in
ecfc5424 3835*\(*)
381aa1ff 3836 expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
3837 fn=`echo $fn | sed 's/(.*)//'`
3838 ;;
3839esac
3840
3841case "$fn" in
a0d0e21e
LW
3842*:*)
3843 loc_file=`expr $fn : '.*:\(.*\)'`
3844 fn=`expr $fn : '\(.*\):.*'`
3845 ;;
3846esac
3847
3848case "$fn" in
2304df62
AD
3849*~*) tilde=true;;
3850esac
3851case "$fn" in
3852*/*) fullpath=true;;
3853esac
3854case "$fn" in
3855*+*) skip=true;;
3856esac
3857case "$fn" in
3858*n*) none_ok=true;;
3859esac
3860case "$fn" in
3861*e*) exp_file=true;;
3862esac
a0d0e21e
LW
3863case "$fn" in
3864*p*) nopath_ok=true;;
3865esac
2304df62
AD
3866
3867case "$fn" in
3868*f*) type='File';;
3869*d*) type='Directory';;
a0d0e21e 3870*l*) type='Locate';;
2304df62
AD
3871esac
3872
3873what="$type"
3874case "$what" in
3875Locate) what='File';;
3876esac
3877
3878case "$exp_file" in
3879'')
3880 case "$d_portable" in
3881 "$define") ;;
3882 *) exp_file=true;;
3883 esac
3884 ;;
3885esac
3886
3887cd ..
3888while test "$type"; do
3889 redo=''
3890 rp="$orig_rp"
3891 dflt="$orig_dflt"
3892 case "$tilde" in
3893 true) rp="$rp (~name ok)";;
3894 esac
3895 . UU/myread
ecfc5424
AD
3896 if test -f UU/getfile.ok && \
3897 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3898 then
3899 value="$ans"
3900 ansexp="$ans"
3901 break
3902 fi
2304df62
AD
3903 case "$ans" in
3904 none)
3905 value=''
3906 ansexp=''
3907 case "$none_ok" in
3908 true) type='';;
3909 esac
3910 ;;
3911 *)
3912 case "$tilde" in
3913 '') value="$ans"
3914 ansexp="$ans";;
3915 *)
3916 value=`UU/filexp $ans`
3917 case $? in
3918 0)
3919 if test "$ans" != "$value"; then
ecfc5424 3920 echo "(That expands to $value on this system.)"
2304df62
AD
3921 fi
3922 ;;
3923 *) value="$ans";;
3924 esac
3925 ansexp="$value"
3926 case "$exp_file" in
3927 '') value="$ans";;
3928 esac
3929 ;;
3930 esac
3931 case "$fullpath" in
3932 true)
3933 case "$ansexp" in
3934 /*) value="$ansexp" ;;
23da6c43 3935 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
3936 *)
3937 redo=true
3938 case "$already" in
3939 true)
3940 echo "I shall only accept a full path name, as in /bin/ls." >&4
3941 echo "Use a ! shell escape if you wish to check pathnames." >&4
3942 ;;
3943 *)
3944 echo "Please give a full path name, starting with slash." >&4
3945 case "$tilde" in
3946 true)
3947 echo "Note that using ~name is ok provided it expands well." >&4
3948 already=true
3949 ;;
3950 esac
3951 esac
3952 ;;
3953 esac
3954 ;;
3955 esac
3956 case "$redo" in
3957 '')
3958 case "$type" in
3959 File)
b233458b
JH
3960 for fp in $gfpth; do
3961 if test "X$fp" = X.; then
3962 pf="$ansexp"
3963 else
3964 pf="$fp/$ansexp"
3965 fi
3966 if test -f "$pf"; then
3967 type=''
3968 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3969 then
3970 echo "($value is not a plain file, but that's ok.)"
3971 type=''
3972 fi
3973 if test X"$type" = X; then
3974 value="$pf"
3975 break
3976 fi
3977 done
2304df62
AD
3978 ;;
3979 Directory)
b233458b
JH
3980 for fp in $gfpth; do
3981 if test "X$fp" = X.; then
f78bfc9c
JH
3982 dir="$ans"
3983 direxp="$ansexp"
b233458b 3984 else
dd858076 3985 dir="$fp/$ansexp"
f78bfc9c 3986 direxp="$fp/$ansexp"
b233458b 3987 fi
f78bfc9c 3988 if test -d "$direxp"; then
b233458b 3989 type=''
f78bfc9c 3990 value="$dir"
b233458b
JH
3991 break
3992 fi
3993 done
2304df62
AD
3994 ;;
3995 Locate)
40000a8c 3996 if test -d "$ansexp"; then
a0d0e21e
LW
3997 echo "(Looking for $loc_file in directory $value.)"
3998 value="$value/$loc_file"
40000a8c 3999 ansexp="$ansexp/$loc_file"
2304df62 4000 fi
40000a8c 4001 if test -f "$ansexp"; then
2304df62
AD
4002 type=''
4003 fi
a0d0e21e
LW
4004 case "$nopath_ok" in
4005 true) case "$value" in
4006 */*) ;;
4007 *) echo "Assuming $value will be in people's path."
4008 type=''
4009 ;;
4010 esac
4011 ;;
4012 esac
2304df62
AD
4013 ;;
4014 esac
4015
4016 case "$skip" in
4017 true) type='';
4018 esac
4019
4020 case "$type" in
4021 '') ;;
4022 *)
4023 if test "$fastread" = yes; then
4024 dflt=y
4025 else
4026 dflt=n
4027 fi
4028 rp="$what $value doesn't exist. Use that name anyway?"
4029 . UU/myread
4030 dflt=''
4031 case "$ans" in
4032 y*) type='';;
4033 *) echo " ";;
4034 esac
4035 ;;
4036 esac
4037 ;;
4038 esac
4039 ;;
4040 esac
4041done
4042cd UU
4043ans="$value"
4044rp="$orig_rp"
4045dflt="$orig_dflt"
ecfc5424 4046rm -f getfile.ok
b233458b 4047test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4048EOSC
4049
bd9b35c9
JH
4050: What should the include directory be ?
4051echo " "
4052$echo $n "Hmm... $c"
4053dflt='/usr/include'
4054incpath=''
4055mips_type=''
4056if $test -f /bin/mips && /bin/mips; then
4057 echo "Looks like a MIPS system..."
4058 $cat >usr.c <<'EOCP'
4059#ifdef SYSTYPE_BSD43
4060/bsd43
4061#endif
4062EOCP
8a27cf78 4063 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4064 dflt='/bsd43/usr/include'
4065 incpath='/bsd43'
4066 mips_type='BSD 4.3'
4067 else
4068 mips_type='System V'
4069 fi
4070 $rm -f usr.c usr.out
4071 echo "and you're compiling with the $mips_type compiler and libraries."
4072 xxx_prompt=y
4073 echo "exit 0" >mips
4074else
4075 echo "Doesn't look like a MIPS system."
4076 xxx_prompt=n
4077 echo "exit 1" >mips
4078fi
4079chmod +x mips
4080$eunicefix mips
4081case "$usrinc" in
4082'') ;;
4083*) dflt="$usrinc";;
4084esac
4085case "$xxx_prompt" in
4086y) fn=d/
4087 echo " "
4088 rp='Where are the include files you want to use?'
4089 . ./getfile
4090 usrinc="$ans"
8e07c86e 4091 ;;
bd9b35c9 4092*) usrinc="$dflt"
8e07c86e
AD
4093 ;;
4094esac
2304df62 4095
96056487
JH
4096: see how we invoke the C preprocessor
4097echo " "
4098echo "Now, how can we feed standard input to your C preprocessor..." >&4
4099cat <<'EOT' >testcpp.c
4100#define ABC abc
4101#define XYZ xyz
4102ABC.XYZ
4103EOT
4104cd ..
4105if test ! -f cppstdin; then
4106 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4107 # AIX cc -E doesn't show the absolute headerfile
4108 # locations but we'll cheat by using the -M flag.
4109 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
4110 else
4111 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4112 fi
4113else
4114 echo "Keeping your $hint cppstdin wrapper."
4115fi
4116chmod 755 cppstdin
4117wrapper=`pwd`/cppstdin
4118ok='false'
4119cd UU
4120
4121if $test "X$cppstdin" != "X" && \
4122 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4123 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4124then
4125 echo "You used to use $cppstdin $cppminus so we'll use that again."
4126 case "$cpprun" in
4127 '') echo "But let's see if we can live without a wrapper..." ;;
4128 *)
4129 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4130 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4131 then
4132 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4133 ok='true'
4134 else
4135 echo "(However, $cpprun $cpplast does not work, let's see...)"
4136 fi
4137 ;;
4138 esac
4139else
4140 case "$cppstdin" in
4141 '') ;;
4142 *)
4143 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4144 ;;
4145 esac
4146fi
4147
4148if $ok; then
4149 : nothing
4150elif echo '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"' -E -" will work...'; \
4157 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4158 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4159 echo "Yup, it does."
4160 x_cpp="$cc -E"
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 "Yipee, that works!"
4166 x_cpp="$cc -P"
4167 x_minus='';
4168elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4169 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4170 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4171 echo "At long last!"
4172 x_cpp="$cc -P"
4173 x_minus='-';
4174elif echo 'No such luck, 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 "It works!"
4178 x_cpp="$cpp"
4179 x_minus='';
4180elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4181 $cpp - <testcpp.c >testcpp.out 2>&1; \
4182 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4183 echo "Hooray, it works! I was beginning to wonder."
4184 x_cpp="$cpp"
4185 x_minus='-';
4186elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4187 $wrapper <testcpp.c >testcpp.out 2>&1; \
4188 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4189 x_cpp="$wrapper"
4190 x_minus=''
4191 echo "Eureka!"
4192else
4193 dflt=''
4194 rp="No dice. I can't find a C preprocessor. Name one:"
4195 . ./myread
4196 x_cpp="$ans"
4197 x_minus=''
4198 $x_cpp <testcpp.c >testcpp.out 2>&1
4199 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4200 echo "OK, that will do." >&4
4201 else
4202echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4203 exit 1
4204 fi
4205fi
4206
4207case "$ok" in
4208false)
4209 cppstdin="$x_cpp"
4210 cppminus="$x_minus"
4211 cpprun="$x_cpp"
4212 cpplast="$x_minus"
4213 set X $x_cpp
4214 shift
4215 case "$1" in
4216 "$cpp")
4217 echo "Perhaps can we force $cc -E using a wrapper..."
4218 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4219 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4220 then
4221 echo "Yup, we can."
4222 cppstdin="$wrapper"
4223 cppminus='';
4224 else
4225 echo "Nope, we'll have to live without it..."
4226 fi
4227 ;;
4228 esac
4229 case "$cpprun" in
4230 "$wrapper")
4231 cpprun=''
4232 cpplast=''
4233 ;;
4234 esac
4235 ;;
4236esac
4237
4238case "$cppstdin" in
4239"$wrapper"|'cppstdin') ;;
4240*) $rm -f $wrapper;;
4241esac
4242$rm -f testcpp.c testcpp.out
4243
bd9b35c9
JH
4244: Set private lib path
4245case "$plibpth" in
4246'') if ./mips; then
4247 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4248 fi;;
4249esac
4250case "$libpth" in
4251' ') dlist='';;
4252'') dlist="$loclibpth $plibpth $glibpth";;
4253*) dlist="$libpth";;
4254esac
4255
4256: Now check and see which directories actually exist, avoiding duplicates
4257libpth=''
4258for xxx in $dlist
4259do
4260 if $test -d $xxx; then
4261 case " $libpth " in
4262 *" $xxx "*) ;;
4263 *) libpth="$libpth $xxx";;
4264 esac
4265 fi
4266done
4267$cat <<'EOM'
4268
4269Some systems have incompatible or broken versions of libraries. Among
4270the directories listed in the question below, please remove any you
4271know not to be holding relevant libraries, and add any that are needed.
4272Say "none" for none.
8e07c86e
AD
4273
4274EOM
bd9b35c9
JH
4275case "$libpth" in
4276'') dflt='none';;
8e07c86e 4277*)
bd9b35c9
JH
4278 set X $libpth
4279 shift
4280 dflt=${1+"$@"}
8e07c86e 4281 ;;
a0d0e21e 4282esac
bd9b35c9
JH
4283rp="Directories to use for library searches?"
4284. ./myread
4285case "$ans" in
4286none) libpth=' ';;
4287*) libpth="$ans";;
4288esac
a0d0e21e 4289
bd9b35c9
JH
4290: compute shared library extension
4291case "$so" in
4292'')
4293 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4294 dflt='sl'
dd4e71fd 4295 else
bd9b35c9 4296 dflt='so'
dd4e71fd
JH
4297 fi
4298 ;;
bd9b35c9 4299*) dflt="$so";;
dd4e71fd 4300esac
dd4e71fd
JH
4301$cat <<EOM
4302
bd9b35c9 4303On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4304you want to suppress searching of shared libraries for the remainder
bd9b35c9 4305of this configuration.
dd4e71fd
JH
4306
4307EOM
bd9b35c9
JH
4308rp='What is the file extension used for shared libraries?'
4309. ./myread
4310so="$ans"
dd4e71fd 4311
bd9b35c9
JH
4312: Define several unixisms.
4313: Hints files or command line option can be used to override them.
4314: The convoluted testing is in case hints files set either the old
4315: or the new name.
4316case "$_exe" in
4317'') case "$exe_ext" in
1fef16b3 4318 '') ;;
bd9b35c9 4319 *) _exe="$exe_ext" ;;
dd4e71fd 4320 esac
bd9b35c9 4321 ;;
bfb7748a 4322esac
bd9b35c9
JH
4323case "$_a" in
4324'') case "$lib_ext" in
4325 '') _a='.a';;
4326 *) _a="$lib_ext" ;;
dd4e71fd
JH
4327 esac
4328 ;;
dd4e71fd 4329esac
bd9b35c9
JH
4330case "$_o" in
4331'') case "$obj_ext" in
4332 '') _o='.o';;
4333 *) _o="$obj_ext";;
4334 esac
4335 ;;
4336esac
4337case "$p_" in
4338'') case "$path_sep" in
4339 '') p_=':';;
4340 *) p_="$path_sep";;
4341 esac
4342 ;;
4343esac
4344exe_ext=$_exe
4345lib_ext=$_a
4346obj_ext=$_o
4347path_sep=$p_
dd4e71fd 4348
b4eb6b3d
JH
4349: Which makefile gets called first. This is used by make depend.
4350case "$firstmakefile" in
4351'') firstmakefile='makefile';;
4633a7c4 4352esac
4633a7c4 4353
0f0995ae
JH
4354case "$usesocks" in
4355$define|true|[yY]*) dflt='y';;
4356*) dflt='n';;
4357esac
bd9b35c9 4358cat <<EOM
4633a7c4 4359
bd9b35c9 4360Perl can be built to use the SOCKS proxy protocol library. To do so,
cf829ab0
JH
4361Configure must be run with -Dusesocks. If you use SOCKS you also need
4362to use the PerlIO abstraction layer, this will be implicitly selected.
4633a7c4 4363
0f0995ae 4364If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4365EOM
bd9b35c9
JH
4366rp='Build Perl for SOCKS?'
4367. ./myread
4368case "$ans" in
4369y|Y) val="$define" ;;
4370*) val="$undef" ;;
4371esac
4372set usesocks
4373eval $setvar
4374
cf829ab0
JH
4375case "$usesocks" in
4376$define|true|[yY]*) useperlio="$define";;
4377esac
4378
bd9b35c9
JH
4379: Looking for optional libraries
4380echo " "
4381echo "Checking for optional libraries..." >&4
4382case "$libs" in
4383' '|'') dflt='';;
4384*) dflt="$libs";;
4385esac
4386case "$libswanted" in
4387'') libswanted='c_s';;
4388esac
4389case "$usesocks" in
923fc586 4390"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4391esac
68435ea7
JH
4392libsfound=''
4393libsfiles=''
4394libsdirs=''
13b3f787
JH
4395libspath=''
4396for thisdir in $libpth $xlibpth; do
4397 test -d $thisdir && libspath="$libspath $thisdir"
4398done
bd9b35c9 4399for thislib in $libswanted; do
13b3f787 4400 for thisdir in $libspath; do
f7dd4e7f
JH
4401 xxx=''
4402 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4403 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4404 $test -f "$xxx" && eval $libscheck
4405 $test -f "$xxx" && libstyle=shared
4406 fi
4407 if test ! -f "$xxx"; then
4408 xxx=$thisdir/lib$thislib.$so
4409 $test -f "$xxx" && eval $libscheck
4410 $test -f "$xxx" && libstyle=shared
4411 fi
4412 if test ! -f "$xxx"; then
4413 xxx=$thisdir/lib$thislib$_a
4414 $test -f "$xxx" && eval $libscheck
4415 $test -f "$xxx" && libstyle=static
4416 fi
4417 if test ! -f "$xxx"; then
4418 xxx=$thisdir/$thislib$_a
4419 $test -f "$xxx" && eval $libscheck
4420 $test -f "$xxx" && libstyle=static
4421 fi
4422 if test ! -f "$xxx"; then
4423 xxx=$thisdir/lib${thislib}_s$_a
4424 $test -f "$xxx" && eval $libscheck
4425 $test -f "$xxx" && libstyle=static
09ea5ba9 4426 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4427 fi
4428 if test ! -f "$xxx"; then
4429 xxx=$thisdir/Slib$thislib$_a
4430 $test -f "$xxx" && eval $libscheck
4431 $test -f "$xxx" && libstyle=static
4432 fi
4433 if $test -f "$xxx"; then
43999f95 4434 case "$libstyle" in
f7dd4e7f
JH
4435 shared) echo "Found -l$thislib (shared)." ;;
4436 static) echo "Found -l$thislib." ;;
4437 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4438 esac
bd9b35c9
JH
4439 case " $dflt " in
4440 *"-l$thislib "*);;
f7dd4e7f 4441 *) dflt="$dflt -l$thislib"
43999f95
JH
4442 libsfound="$libsfound $xxx"
4443 yyy=`basename $xxx`
4444 libsfiles="$libsfiles $yyy"
1e127011 4445 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4446 case " $libsdirs " in
4447 *" $yyy "*) ;;
4448 *) libsdirs="$libsdirs $yyy" ;;
4449 esac
4450 ;;
bd9b35c9 4451 esac
f7dd4e7f
JH
4452 break
4453 fi
4454 done
4455 if $test ! -f "$xxx"; then
4456 echo "No -l$thislib."
bd9b35c9
JH
4457 fi
4458done
4459set X $dflt
4460shift
4461dflt="$*"
4462case "$libs" in
4463'') dflt="$dflt";;
4464*) dflt="$libs";;
4465esac
4466case "$dflt" in
4467' '|'') dflt='none';;
4468esac
4633a7c4 4469
bd9b35c9 4470$cat <<EOM
4633a7c4 4471
bd9b35c9
JH
4472In order to compile $package on your machine, a number of libraries
4473are usually needed. Include any other special libraries here as well.
4474Say "none" for none. The default list is almost always right.
8e07c86e 4475EOM
8e07c86e 4476
bd9b35c9
JH
4477echo " "
4478rp="What libraries to use?"
4479. ./myread
4480case "$ans" in
4481none) libs=' ';;
4482*) libs="$ans";;
4483esac
d71b2b6b 4484
bd9b35c9
JH
4485: determine optimization, if desired, or use for debug flag also
4486case "$optimize" in
4487' '|$undef) dflt='none';;
4488'') dflt='-O';;
4489*) dflt="$optimize";;
4490esac
4491$cat <<EOH
d71b2b6b 4492
bd9b35c9
JH
4493By default, $package compiles with the -O flag to use the optimizer.
4494Alternately, you might want to use the symbolic debugger, which uses
4495the -g flag (on traditional Unix systems). Either flag can be
4496specified here. To use neither flag, specify the word "none".
d71b2b6b 4497
bd9b35c9
JH
4498EOH
4499rp="What optimizer/debugger flag should be used?"
4500. ./myread
4501optimize="$ans"
4502case "$optimize" in
4503'none') optimize=" ";;
4504esac
4505
4506dflt=''
4507: We will not override a previous value, but we might want to
4508: augment a hint file
4509case "$hint" in
4510default|recommended)
4511 case "$gccversion" in
4512 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4513 esac
bd9b35c9
JH
4514 case "$optimize" in
4515 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4516 esac
bd9b35c9
JH
4517 case "$gccversion" in
4518 2*) if test -d /etc/conf/kconfig.d &&
4519 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4520 then
4521 dflt="$dflt -posix"
4522 fi
f0d04425 4523 ;;
bd9b35c9
JH
4524 esac
4525 case "$gccversion" in
4526 1*) ;;
4527 2.[0-8]*) ;;
4528 ?*) echo " "
4529 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4530 echo 'int main(void) { return 0; }' > gcctest.c
4531 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4532 echo "Yes, it does." 2>&1
4533 case "$ccflags" in
4534 *strict-aliasing*)
4535 echo "Leaving current flags $ccflags alone." 2>&1
4536 ;;
4537 *) dflt="$dflt -fno-strict-aliasing" ;;
4538 esac
4539 else
4540 echo "Nope, it doesn't, but that's ok." 2>&1
4541 fi
f0d04425 4542 ;;
e5e20432
JH
4543 esac
4544 ;;
4545esac
4546
bd9b35c9
JH
4547case "$mips_type" in
4548*BSD*|'') inclwanted="$locincpth $usrinc";;
4549*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4550esac
4551for thisincl in $inclwanted; do
4552 if $test -d $thisincl; then
4553 if $test x$thisincl != x$usrinc; then
4554 case "$dflt" in
422af00a
LC
4555 *" -I$thisincl "*);;
4556 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4557 esac
4558 fi
4559 fi
4560done
40a7a20a 4561
bd9b35c9
JH
4562inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4563 xxx=true;
4564elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4565 xxx=true;
4566else
4567 xxx=false;
4568fi;
4569if $xxx; then
4570 case "$dflt" in
4571 *$2*);;
4572 *) dflt="$dflt -D$2";;
4573 esac;
4574fi'
40a7a20a 4575
bd9b35c9 4576set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4577
bd9b35c9
JH
4578case "$usesocks" in
4579$define)
4580 ccflags="$ccflags -DSOCKS"
4581 ;;
4582esac
40a7a20a 4583
bd9b35c9
JH
4584case "$hint" in
4585default|recommended) dflt="$ccflags $dflt" ;;
4586*) dflt="$ccflags";;
4587esac
40a7a20a 4588
bd9b35c9
JH
4589case "$dflt" in
4590''|' ') dflt=none;;
4591esac
422af00a 4592
bd9b35c9 4593$cat <<EOH
40a7a20a 4594
bd9b35c9
JH
4595Your C compiler may want other flags. For this question you should include
4596-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4597but you should NOT include libraries or ld flags like -lwhatever. If you
4598want $package to honor its debug switch, you should include -DDEBUGGING here.
4599Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4600
bd9b35c9 4601To use no flags, specify the word "none".
40a7a20a 4602
bd9b35c9
JH
4603EOH
4604set X $dflt
4605shift
4606dflt=${1+"$@"}
4607rp="Any additional cc flags?"
4608. ./myread
4609case "$ans" in
4610none) ccflags='';;
4611*) ccflags="$ans";;
4612esac
8e07c86e 4613
bd9b35c9 4614: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4615case "$cppflags" in
4616'') cppflags="$ccflags" ;;
4617*) cppflags="$cppflags $ccflags" ;;
4618esac
bd9b35c9
JH
4619case "$gccversion" in
46201*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4621esac
bd9b35c9
JH
4622case "$mips_type" in
4623'');;
4624*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4625esac
4626case "$cppflags" in
4627'');;
4628*)
4629 echo " "
4630 echo "Let me guess what the preprocessor flags are..." >&4
4631 set X $cppflags
4632 shift
4633 cppflags=''
4634 $cat >cpp.c <<'EOM'
4635#define BLURFL foo
8e07c86e 4636
bd9b35c9
JH
4637BLURFL xx LFRULB
4638EOM
4639 previous=''
4640 for flag in $*
4641 do
4642 case "$flag" in
4643 -*) ftry="$flag";;
4644 *) ftry="$previous $flag";;
4645 esac
4646 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4647 >cpp1.out 2>/dev/null && \
4648 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4649 >cpp2.out 2>/dev/null && \
4650 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4651 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4652 then
4653 cppflags="$cppflags $ftry"
4654 previous=''
4655 else
4656 previous="$flag"
4657 fi
4658 done
4659 set X $cppflags
4660 shift
4661 cppflags=${1+"$@"}
4662 case "$cppflags" in
4663 *-*) echo "They appear to be: $cppflags";;
4664 esac
4665 $rm -f cpp.c cpp?.out
2afac517 4666 ;;
4667esac
8e07c86e 4668
bd9b35c9
JH
4669: flags used in final linking phase
4670case "$ldflags" in
4671'') if ./venix; then
4672 dflt='-i -z'
10a23457 4673 else
bd9b35c9 4674 dflt=''
10a23457 4675 fi
bd9b35c9
JH
4676 case "$ccflags" in
4677 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4678 esac
bd9b35c9
JH
4679 ;;
4680*) dflt="$ldflags";;
4681esac
4682
4683: Try to guess additional flags to pick up local libraries.
4684for thislibdir in $libpth; do
4685 case " $loclibpth " in
4686 *" $thislibdir "*)
4687 case "$dflt " in
4688 *"-L$thislibdir "*) ;;
4689 *) dflt="$dflt -L$thislibdir" ;;
4690 esac
c4f23d77
AD
4691 ;;
4692 esac
bd9b35c9 4693done
c4f23d77 4694
bd9b35c9
JH
4695case "$dflt" in
4696'') dflt='none' ;;
4697esac
c4f23d77 4698
bd9b35c9
JH
4699$cat <<EOH
4700
4701Your C linker may need flags. For this question you should
4702include -L/whatever and any other flags used by the C linker, but you
4703should NOT include libraries like -lwhatever.
4704
4705Make sure you include the appropriate -L/path flags if your C linker
4706does not normally search all of the directories you specified above,
4707namely
4708 $libpth
4709To use no flags, specify the word "none".
4710
4711EOH
4712
4713rp="Any additional ld flags (NOT including libraries)?"
4714. ./myread
4715case "$ans" in
4716none) ldflags='';;
4717*) ldflags="$ans";;
4718esac
4719rmlist="$rmlist pdp11"
4720
4721: coherency check
4722echo " "
4723echo "Checking your choice of C compiler and flags for coherency..." >&4
4724$cat > try.c <<'EOF'
4725#include <stdio.h>
4726int main() { printf("Ok\n"); exit(0); }
4727EOF
7a282f6d 4728set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4729shift
4730$cat >try.msg <<'EOM'
4731I've tried to compile and run the following simple program:
4732
4733EOM
4734$cat try.c >> try.msg
4735
4736$cat >> try.msg <<EOM
4737
4738I used the command:
4739
4740 $*
5440bc8e 4741 $run ./try
bd9b35c9
JH
4742
4743and I got the following output:
4744
4745EOM
4746dflt=y
73614538 4747if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4748 if $sh -c "$run ./try" >>try.msg 2>&1; then
4749 xxx=`$run ./try`
bd9b35c9
JH
4750 case "$xxx" in
4751 "Ok") dflt=n ;;
4752 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4753 case " $libs " in
4754 *" -lsfio "*)
4755 cat >> try.msg <<'EOQS'
4756If $libs contains -lsfio, and sfio is mis-configured, then it
4757sometimes (apparently) runs and exits with a 0 status, but with no
4758output! It may have to do with sfio's use of _exit vs. exit.
4759
4760EOQS
4761 rp="You have a big problem. Shall I abort Configure"
4762 dflt=y
4763 ;;
4764 esac
4765 ;;
4766 esac
4767 else
4768 echo "The program compiled OK, but exited with status $?." >>try.msg
4769 rp="You have a problem. Shall I abort Configure"
4770 dflt=y
4771 fi
4772else
4773 echo "I can't compile the test program." >>try.msg
4774 rp="You have a BIG problem. Shall I abort Configure"
4775 dflt=y
4776fi
4777case "$dflt" in
4778y)
4779 $cat try.msg >&4
4780 case "$knowitall" in
4781 '')
4782 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4783 ;;
bd9b35c9 4784 *) dflt=n;;
c4f23d77 4785 esac
bd9b35c9
JH
4786 echo " "
4787 . ./myread
4788 case "$ans" in
4789 n*|N*) ;;
4790 *) echo "Ok. Stopping Configure." >&4
4791 exit 1
c4f23d77
AD
4792 ;;
4793 esac
4794 ;;
bd9b35c9 4795n) echo "OK, that should do.";;
c4f23d77 4796esac
bd9b35c9 4797$rm -f try try.* core
c4f23d77 4798
bd9b35c9
JH
4799: define a shorthand compile call
4800compile='
4801mc_file=$1;
4802shift;
08413ebc 4803$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4804: define a shorthand compile call for compilations that should be ok.
4805compile_ok='
4806mc_file=$1;
4807shift;
7a282f6d 4808$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4809
b4eb6b3d 4810: check for lengths of integral types
bd9b35c9 4811echo " "
b4eb6b3d
JH
4812case "$intsize" in
4813'')
4814 echo "Checking to see how big your integers are..." >&4
5440bc8e 4815 $cat >try.c <<'EOCP'
bd9b35c9
JH
4816#include <stdio.h>
4817int main()
4818{
b4eb6b3d
JH
4819 printf("intsize=%d;\n", (int)sizeof(int));
4820 printf("longsize=%d;\n", (int)sizeof(long));
4821 printf("shortsize=%d;\n", (int)sizeof(short));
4822 exit(0);
bd9b35c9 4823}
b4eb6b3d 4824EOCP
5440bc8e
JH
4825 set try
4826 if eval $compile_ok && $run ./try > /dev/null; then
4827 eval `$run ./try`
b4eb6b3d
JH
4828 echo "Your integers are $intsize bytes long."
4829 echo "Your long integers are $longsize bytes long."
4830 echo "Your short integers are $shortsize bytes long."
4831 else
4832 $cat >&4 <<EOM
4833!
4834Help! I can't compile and run the intsize test program: please enlighten me!
4835(This is probably a misconfiguration in your system or libraries, and
4836you really ought to fix it. Still, I'll try anyway.)
4837!
bd9b35c9 4838EOM
b4eb6b3d
JH
4839 dflt=4
4840 rp="What is the size of an integer (in bytes)?"
96056487
JH
4841 . ./myread
4842 intsize="$ans"
4843 dflt=$intsize
4844 rp="What is the size of a long integer (in bytes)?"
4845 . ./myread
4846 longsize="$ans"
4847 dflt=2
4848 rp="What is the size of a short integer (in bytes)?"
4849 . ./myread
4850 shortsize="$ans"
b4eb6b3d
JH
4851 fi
4852 ;;
4853esac
96056487 4854$rm -f try try.*
b4eb6b3d 4855
8dfa8df9
JH
4856: check for long long
4857echo " "
4858echo "Checking to see if you have long long..." >&4
4859echo 'int main() { long long x = 7; return 0; }' > try.c
4860set try
4861if eval $compile; then
4862 val="$define"
4863 echo "You have long long."
4864else
4865 val="$undef"
4866 echo "You do not have long long."
4867fi
4868$rm try.*
4869set d_longlong
4870eval $setvar
4871
4872: check for length of long long
4873case "${d_longlong}${longlongsize}" in
4874$define)
4875 echo " "
4876 echo "Checking to see how big your long longs are..." >&4
4877 $cat >try.c <<'EOCP'
4878#include <stdio.h>
4879int main()
4880{
4881 printf("%d\n", (int)sizeof(long long));
4882 return(0);
4883}
4884EOCP
4885 set try
4886 if eval $compile_ok; then
5440bc8e 4887 longlongsize=`$run ./try`
8dfa8df9
JH
4888 echo "Your long longs are $longlongsize bytes long."
4889 else
4890 dflt='8'
4891 echo " "
4892 echo "(I can't seem to compile the test program. Guessing...)"
4893 rp="What is the size of a long long (in bytes)?"
4894 . ./myread
4895 longlongsize="$ans"
4896 fi
4897 if $test "X$longsize" = "X$longlongsize"; then
4898 echo "(That isn't any different from an ordinary long.)"
4899 fi
4900 ;;
4901esac
4902$rm -f try.* try
4903
4904: determine filename position in cpp output
4905echo " "
4906echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
4907case "$osname" in
4908vos) testaccess=-e ;;
4909*) testaccess=-r ;;
4910esac
8dfa8df9
JH
4911echo '#include <stdio.h>' > foo.c
4912$cat >fieldn <<EOF
4913$startsh
4914$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4915$grep '^[ ]*#.*stdio\.h' | \
4916while read cline; do
4917 pos=1
4918 set \$cline
4919 while $test \$# -gt 0; do
a5a94ea5 4920 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
4921 echo "\$pos"
4922 exit 0
4923 fi
4924 shift
4925 pos=\`expr \$pos + 1\`
4926 done
4927done
4928EOF
4929chmod +x fieldn
4930fieldn=`./fieldn`
4931$rm -f foo.c fieldn
4932case $fieldn in
4933'') pos='???';;
49341) pos=first;;
49352) pos=second;;
49363) pos=third;;
4937*) pos="${fieldn}th";;
4938esac
4939echo "Your cpp writes the filename in the $pos field of the line."
4940
3c728e00
JH
4941case "$osname" in
4942vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4943*) cppfilter='' ;;
4944esac
8dfa8df9
JH
4945: locate header file
4946$cat >findhdr <<EOF
4947$startsh
4948wanted=\$1
4949name=''
4950for usrincdir in $usrinc
4951do
4952 if test -f \$usrincdir/\$wanted; then
4953 echo "\$usrincdir/\$wanted"
4954 exit 0
4955 fi
4956done
4957awkprg='{ print \$$fieldn }'
4958echo "#include <\$wanted>" > foo\$\$.c
4959$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 4960$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
4961while read cline; do
4962 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4963 case "\$name" in
4964 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4965 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4966 *) exit 2;;
4967 esac;
4968done;
4969#
4970# status = 0: grep returned 0 lines, case statement not executed
4971# status = 1: headerfile found
4972# status = 2: while loop executed, no headerfile found
4973#
4974status=\$?
4975$rm -f foo\$\$.c;
4976if test \$status -eq 1; then
4977 exit 0;
4978fi
4979exit 1
4980EOF
4981chmod +x findhdr
4982
4983: define an alternate in-header-list? function
4984inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4985cont=true; xxf="echo \"<\$1> found.\" >&4";
4986case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4987*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4988esac;
4989case $# in 4) instead=instead;; *) instead="at last";; esac;
4990while $test "$cont"; do
4991 xxx=`./findhdr $1`
4992 var=$2; eval "was=\$$2";
4993 if $test "$xxx" && $test -r "$xxx";
4994 then eval $xxf;
4995 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4996 cont="";
4997 else eval $xxnf;
4998 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4999 set $yyy; shift; shift; yyy=$@;
5000 case $# in 0) cont="";;
5001 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5002 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5003 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5004 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5005 esac;
5006done;
5007while $test "$yyy";
5008do set $yyy; var=$2; eval "was=\$$2";
5009 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5010 set $yyy; shift; shift; yyy=$@;
5011done'
5012
5013: see if inttypes.h is available
5014: we want a real compile instead of Inhdr because some systems
5015: have an inttypes.h which includes non-existent headers
5016echo " "
5017$cat >try.c <<EOCP
5018#include <inttypes.h>
5019int main() {
5020 static int32_t foo32 = 0x12345678;
5021}
5022EOCP
5023set try
5024if eval $compile; then
5025 echo "<inttypes.h> found." >&4
5026 val="$define"
5027else
5028 echo "<inttypes.h> NOT found." >&4
5029 val="$undef"
5030fi
5031$rm -f try.c try
5032set i_inttypes
5033eval $setvar
5034
5035: check for int64_t
5036echo " "
5037echo "Checking to see if you have int64_t..." >&4
5038$cat >try.c <<EOCP
5039#include <sys/types.h>
5040#$i_inttypes I_INTTYPES
5041#ifdef I_INTTYPES
5042#include <inttypes.h>
5043#endif
5044int main() { int64_t x = 7; }
5045EOCP
5046set try
5047if eval $compile; then
5048 val="$define"
5049 echo "You have int64_t."
5050else
5051 val="$undef"
5052 echo "You do not have int64_t."
5053fi
5054$rm -f try try.*
5055set d_int64_t
5056eval $setvar
5057
5058
5059echo " "
5060echo "Checking which 64-bit integer type we could use..." >&4
5061
5062case "$intsize" in
50638) val=int
5064 set quadtype
5065 eval $setvar
5066 val='"unsigned int"'
5067 set uquadtype
5068 eval $setvar
5069 quadkind=1
5070 ;;
5071*) case "$longsize" in
5072 8) val=long
5073 set quadtype
5074 eval $setvar
5075 val='"unsigned long"'
5076 set uquadtype
5077 eval $setvar
5078 quadkind=2
5079 ;;
5080 *) case "$d_longlong:$longlongsize" in
5081 define:8)
5082 val='"long long"'
5083 set quadtype
5084 eval $setvar
5085 val='"unsigned long long"'
5086 set uquadtype
5087 eval $setvar
5088 quadkind=3
5089 ;;
5090 *) case "$d_int64_t" in
5091 define)
5092 val=int64_t
5093 set quadtype
5094 eval $setvar
5095 val=uint64_t
5096 set uquadtype
5097 eval $setvar
5098 quadkind=4
5099 ;;
5100 esac
5101 ;;
5102 esac
5103 ;;
5104 esac
5105 ;;
5106esac
5107
5108case "$quadtype" in
5109'') echo "Alas, no 64-bit integer types in sight." >&4
5110 d_quad="$undef"
5111 ;;
5112*) echo "We could use '$quadtype' for 64-bit integers." >&4
5113 d_quad="$define"
5114 ;;
5115esac
5116
b4eb6b3d
JH
5117
5118case "$uselonglong" in
5119"$define"|true|[yY]*)
5120 cat <<EOM >&4
5121
5122*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5123EOM
5124 use64bitint="$define"
5125 ;;
5126esac
5127case "$use64bits" in
5128"$define"|true|[yY]*)
5129 cat <<EOM >&4
5130
5131*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5132EOM
5133 use64bitint="$define"
5134 ;;
5135esac
5136case "$use64bitints" in
5137"$define"|true|[yY]*)
5138 cat <<EOM >&4
5139
5140*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5141EOM
5142 use64bitint="$define"
5143 ;;
5144esac
5145case "$use64bitsint" in
5146"$define"|true|[yY]*)
5147 cat <<EOM >&4
5148
5149*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5150EOM
5151 use64bitint="$define"
5152 ;;
5153esac
5154case "$uselonglongs" in
5155"$define"|true|[yY]*)
5156 cat <<EOM >&4
5157
5158*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5159EOM
5160 use64bitint="$define"
5161 ;;
5162esac
5163case "$use64bitsall" in
5164"$define"|true|[yY]*)
5165 cat <<EOM >&4
5166
5167*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5168EOM
5169 use64bitall="$define"
5170 ;;
5171esac
5172
5173case "$ccflags" in
5174*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5175esac
5176case "$use64bitall" in
5177"$define"|true|[yY]*) use64bitint="$define" ;;
5178esac
5179
5180case "$longsize" in
51818) cat <<EOM
5182
5183You have natively 64-bit long integers.
5184EOM
5185 val="$define"
5186 ;;
5187*) case "$use64bitint" in
5188 "$define"|true|[yY]*) dflt='y';;
5189 *) dflt='n';;
5190 esac
8dfa8df9
JH
5191 case "$d_quad" in
5192 "$define") ;;
5193 *) dflt='n' ;;
5194 esac
b4eb6b3d
JH
5195 cat <<EOM
5196
5197Perl can be built to take advantage of 64-bit integer types
5198on some systems. To do so, Configure can be run with -Duse64bitint.
5199Choosing this option will most probably introduce binary incompatibilities.
5200
5201If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5202(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5203EOM
5204 rp='Try to use 64-bit integers, if available?'
5205 . ./myread
5206 case "$ans" in
5207 [yY]*) val="$define" ;;
5208 *) val="$undef" ;;
5209 esac
5210 ;;
5211esac
5212set use64bitint
5213eval $setvar
5214
5215case "$use64bitall" in
5216"$define"|true|[yY]*) dflt='y' ;;
5217*) case "$longsize" in
5218 8) dflt='y' ;;
5219 *) dflt='n' ;;
5220 esac
5221 ;;
5222esac
5223cat <<EOM
5224
5225You may also choose to try maximal 64-bitness. It means using as much
522664-bitness as possible on the platform. This in turn means even more
5227binary incompatibilities. On the other hand, your platform may not
5228have any more 64-bitness available than what you already have chosen.
5229
5230If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5231(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5232EOM
5233rp='Try to use maximal 64-bit support, if available?'
5234. ./myread
5235case "$ans" in
5236[yY]*) val="$define" ;;
5237*) val="$undef" ;;
5238esac
5239set use64bitall
5240eval $setvar
5241case "$use64bitall" in
5242"$define")
5243 case "$use64bitint" in
5244 "$undef")
5245 cat <<EOM
5246
5247Since you have chosen a maximally 64-bit build, I'm also turning on
5248the use of 64-bit integers.
5249EOM
5250 use64bitint="$define" ;;
5251 esac
5252 ;;
5253esac
5254
5255case "$use64bitint" in
5256"$define"|true|[yY]*)
5257: Look for a hint-file generated 'call-back-unit'. If the
5258: user has specified that a 64-bit perl is to be built,
5259: we may need to set or change some other defaults.
5260 if $test -f use64bitint.cbu; then
5261 echo "Your platform has some specific hints for 64-bit integers, using them..."
5262 . ./use64bitint.cbu
5263 fi
5264 case "$longsize" in
5265 4) case "$archname64" in
5266 '') archname64=64int ;;
5267 esac
5268 ;;
5269 esac
5270 ;;
5271esac
5272
5273case "$use64bitall" in
5274"$define"|true|[yY]*)
5275: Look for a hint-file generated 'call-back-unit'. If the
5276: user has specified that a maximally 64-bit perl is to be built,
5277: we may need to set or change some other defaults.
5278 if $test -f use64bitall.cbu; then
5279 echo "Your platform has some specific hints for 64-bit builds, using them..."
5280 . ./use64bitall.cbu
5281 fi
5282 case "$longsize" in
5283 4) case "$archname64" in
5284 ''|64int) archname64=64all ;;
5285 esac
5286 ;;
5287 esac
5288 ;;
5289esac
5290
5291echo " "
5292echo "Checking for GNU C Library..." >&4
5440bc8e 5293cat >try.c <<EOM
b4eb6b3d
JH
5294#include <stdio.h>
5295int main()
5296{
5297#ifdef __GLIBC__
5298 exit(0);
5299#else
5300 exit(1);
5301#endif
5302}
5303EOM
5440bc8e
JH
5304set try
5305if eval $compile_ok && $run ./try; then
b4eb6b3d
JH
5306 val="$define"
5307 echo "You are using the GNU C Library"
5308else
5309 val="$undef"
5310 echo "You are not using the GNU C Library"
5311fi
5440bc8e 5312$rm -f try try.*
b4eb6b3d
JH
5313set d_gnulibc
5314eval $setvar
5315
5316: see if nm is to be used to determine whether a symbol is defined or not
5317case "$usenm" in
5318'')
5319 dflt=''
c1a7f87b
JH
5320 case "$d_gnulibc" in
5321 "$define")
5322 echo " "
5323 echo "nm probably won't work on the GNU C Library." >&4
5324 dflt=n
bd9b35c9 5325 ;;
c1a7f87b
JH
5326 esac
5327 case "$dflt" in
5328 '')
5329 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5330 echo " "
5331 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5332 echo "'nm' won't be sufficient on this sytem." >&4
5333 dflt=n
5334 fi
5335 ;;
5336 esac
5337 case "$dflt" in
5338 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5339 if $test $dflt -gt 20; then
5340 dflt=y
5341 else
5342 dflt=n
5343 fi
bd9b35c9
JH
5344 ;;
5345 esac
bd9b35c9
JH
5346 ;;
5347*)
c1a7f87b
JH
5348 case "$usenm" in
5349 true|$define) dflt=y;;
5350 *) dflt=n;;
5351 esac
bd9b35c9
JH
5352 ;;
5353esac
5354$cat <<EOM
5355
c1a7f87b
JH
5356I can use $nm to extract the symbols from your C libraries. This
5357is a time consuming task which may generate huge output on the disk (up
5358to 3 megabytes) but that should make the symbols extraction faster. The
5359alternative is to skip the 'nm' extraction part and to compile a small
5360test program instead to determine whether each symbol is present. If
5361you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5362this may be the best solution.
5363
5364You probably shouldn't let me use 'nm' if you are using the GNU C Library.
bd9b35c9
JH
5365
5366EOM
c1a7f87b
JH
5367rp="Shall I use $nm to extract C symbols from the libraries?"
5368. ./myread
5369case "$ans" in
5370[Nn]*) usenm=false;;
5371*) usenm=true;;
bd9b35c9 5372esac
bd9b35c9 5373
c1a7f87b
JH
5374runnm=$usenm
5375case "$reuseval" in
5376true) runnm=false;;
8e07c86e 5377esac
29209bc5 5378
c1a7f87b
JH
5379: nm options which may be necessary
5380case "$nm_opt" in
5381'') if $test -f /mach_boot; then
5382 nm_opt='' # Mach
5383 elif $test -d /usr/ccs/lib; then
5384 nm_opt='-p' # Solaris (and SunOS?)
5385 elif $test -f /dgux; then
5386 nm_opt='-p' # DG-UX
5387 elif $test -f /lib64/rld; then
5388 nm_opt='-p' # 64-bit Irix
5389 else
5390 nm_opt=''
5391 fi;;
5392esac
bd9b35c9 5393
c1a7f87b
JH
5394: nm options which may be necessary for shared libraries but illegal
5395: for archive libraries. Thank you, Linux.
5396case "$nm_so_opt" in
5397'') case "$myuname" in
5398 *linux*)
5399 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5400 nm_so_opt='--dynamic'
5401 fi
5402 ;;
bd9b35c9 5403 esac
c1a7f87b
JH
5404 ;;
5405esac
8e07c86e 5406
c1a7f87b
JH
5407case "$runnm" in
5408true)
5409: get list of predefined functions in a handy place
5410echo " "
5411case "$libc" in
5412'') libc=unknown
5413 case "$libs" in
5414 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
bd9b35c9 5415 esac
ff935051
JH
5416 ;;
5417esac
c1a7f87b
JH
5418case "$libs" in
5419'') ;;
5420*) for thislib in $libs; do
5421 case "$thislib" in
5422 -lc|-lc_s)
5423 : Handle C library specially below.
5424 ;;
5425 -l*)
5426 thislib=`echo $thislib | $sed -e 's/^-l//'`
5427 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5428 :
5429 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5430 :
5431 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5432 :
5433 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5434 :
5435 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5436 :
5437 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5438 :
5439 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5440 :
5441 else
5442 try=''
5443 fi
5444 libnames="$libnames $try"
5445 ;;
5446 *) libnames="$libnames $thislib" ;;
34d1710f 5447 esac
c1a7f87b 5448 done
4633a7c4
LW
5449 ;;
5450esac
c1a7f87b
JH
5451xxx=normal
5452case "$libc" in
5453unknown)
5454 set /lib/libc.$so
5455 for xxx in $libpth; do
5456 $test -r $1 || set $xxx/libc.$so
5457 : The messy sed command sorts on library version numbers.
5458 $test -r $1 || \
5459 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5460 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5461 h
5462 s/[0-9][0-9]*/0000&/g
5463 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5464 G
5465 s/\n/ /' | \
381aa1ff 5466 $sort | $sed -e 's/^.* //'`
c1a7f87b
JH
5467 eval set \$$#
5468 done
5469 $test -r $1 || set /usr/ccs/lib/libc.$so
5470 $test -r $1 || set /lib/libsys_s$_a
5471 ;;
5472*)
5473 set blurfl
5474 ;;
a4f3eea9 5475esac
c1a7f87b
JH
5476if $test -r "$1"; then
5477 echo "Your (shared) C library seems to be in $1."
5478 libc="$1"
5479elif $test -r /lib/libc && $test -r /lib/clib; then
5480 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5481 xxx=apollo
5482 libc='/lib/clib /lib/libc'
5483 if $test -r /lib/syslib; then
5484 echo "(Your math library is in /lib/syslib.)"
5485 libc="$libc /lib/syslib"
5486 fi
5487elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5488 echo "Your C library seems to be in $libc, as you said before."
5489elif $test -r $incpath/usr/lib/libc$_a; then
5490 libc=$incpath/usr/lib/libc$_a;
5491 echo "Your C library seems to be in $libc. That's fine."
5492elif $test -r /lib/libc$_a; then
5493 libc=/lib/libc$_a;
5494 echo "Your C library seems to be in $libc. You're normal."
5495else
5496 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5497 :
5498 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5499 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5500 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5501 :
5502 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5503 :
5504 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5505 :
5506 else
5507 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5508 fi
5509 if $test -r "$tans"; then
5510 echo "Your C library seems to be in $tans, of all places."
5511 libc=$tans
5512 else
5513 libc='blurfl'
5514 fi
5515fi
5516if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5517 dflt="$libc"
5518 cat <<EOM
a4f3eea9 5519
c1a7f87b
JH
5520If the guess above is wrong (which it might be if you're using a strange
5521compiler, or your machine supports multiple models), you can override it here.
bd9b35c9
JH
5522
5523EOM
a4f3eea9 5524else
c1a7f87b 5525 dflt=''
381aa1ff 5526 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
c1a7f87b
JH
5527 cat >&4 <<EOM
5528I can't seem to find your C library. I've looked in the following places:
a4f3eea9 5529
c1a7f87b
JH
5530EOM
5531 $sed 's/^/ /' libpath
5532 cat <<EOM
29209bc5 5533
c1a7f87b 5534None of these seems to contain your C library. I need to get its name...
a4f3eea9 5535
bd9b35c9 5536EOM
bd9b35c9 5537fi
c1a7f87b
JH
5538fn=f
5539rp='Where is your C library?'
5540. ./getfile
5541libc="$ans"
a4f3eea9 5542
c1a7f87b 5543echo " "
381aa1ff 5544echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
c1a7f87b
JH
5545set X `cat libnames`
5546shift
5547xxx=files
5548case $# in 1) xxx=file; esac
5549echo "Extracting names from the following $xxx for later perusal:" >&4
5550echo " "
5551$sed 's/^/ /' libnames >&4
5552echo " "
5553$echo $n "This may take a while...$c" >&4
a4f3eea9 5554
c1a7f87b
JH
5555for file in $*; do
5556 case $file in
5557 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5558 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5559 esac
c1a7f87b 5560done >libc.tmp
a4f3eea9 5561
c1a7f87b
JH
5562$echo $n ".$c"
5563$grep fprintf libc.tmp > libc.ptf
5564xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
c56d2bdc 5565xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
c1a7f87b
JH
5566xxx='[ADTSIW]'
5567if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5568 eval $xscan;\
5569 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5570 eval $xrun
5571elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5572 eval $xscan;\
5573 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5574 eval $xrun
5575elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5576 eval $xscan;\
5577 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5578 eval $xrun
5579elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5580 eval $xscan;\
5581 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5582 eval $xrun
5583elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5584 eval $xscan;\
5585 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5586 eval $xrun
5587elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5588 eval $xscan;\
5589 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5590 eval $xrun
5591elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5592 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5593 eval $xscan;\
5594 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5595 eval $xrun
5596elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5597 eval $xscan;\
5598 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5599 eval $xrun
5600elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5601 eval $xscan;\
5602 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5603 eval $xrun
5604elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5605 eval $xscan;\
5606 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5607 eval $xrun
5608elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5609 eval $xscan;\
5610 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5611 eval $xrun
5612elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5613 eval $xscan;\
5614 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5615 eval $xrun
5616elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5617 eval $xscan;\
5618 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5619 eval $xrun
5620elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5621 eval $xscan;\
5622 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5623 eval $xrun
5624else
5625 $nm -p $* 2>/dev/null >libc.tmp
5626 $grep fprintf libc.tmp > libc.ptf
5627 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5628 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5629 then
5630 nm_opt='-p'
5631 eval $xrun
bd9b35c9 5632 else
c1a7f87b
JH
5633 echo " "
5634 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5635 com=''
5636 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5637 for thisname in $libnames $libc; do
5638 $ar t $thisname >>libc.tmp
5639 done
5640 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5641 echo "Ok." >&4
5642 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5643 # Repeat libc to extract forwarders to DLL entries too
5644 for thisname in $libnames $libc; do
5645 $ar tv $thisname >>libc.tmp
5646 # Revision 50 of EMX has bug in $ar.
5647 # it will not extract forwarders to DLL entries
5648 # Use emximp which will extract exactly them.
5649 emximp -o tmp.imp $thisname \
5650 2>/dev/null && \
5651 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5652 < tmp.imp >>libc.tmp
5653 $rm tmp.imp
5654 done
5655 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5656 echo "Ok." >&4
5657 else
5658 echo "$ar didn't seem to work right." >&4
5659 echo "Maybe this is a Cray...trying bld instead..." >&4
5660 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5661 then
5662 for thisname in $libnames; do
5663 bld t $libnames | \
5664 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5665 $ar t $thisname >>libc.tmp
5666 done
5667 echo "Ok." >&4
bd9b35c9 5668 else
c1a7f87b
JH
5669 echo "That didn't work either. Giving up." >&4
5670 exit 1
bd9b35c9 5671 fi
c1a7f87b 5672 fi
a4f3eea9 5673 fi
a4f3eea9 5674fi
c1a7f87b
JH
5675nm_extract="$com"
5676if $test -f /lib/syscalls.exp; then
5677 echo " "
5678 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
a8c676c6 5679 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
c1a7f87b
JH
5680fi
5681;;
5682esac
5683$rm -f libnames libpath
bd9b35c9 5684
c1a7f87b
JH
5685: is a C symbol defined?
5686csym='tlook=$1;
5687case "$3" in
5688-v) tf=libc.tmp; tc=""; tdc="";;
5689-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5690*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5691esac;
5692tx=yes;
5693case "$reuseval-$4" in
5694true-) ;;
5695true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5696esac;
5697case "$tx" in
5698yes)
5699 case "$runnm" in
5700 true)
5701 if $contains $tlook $tf >/dev/null 2>&1;
5702 then tval=true;
5703 else tval=false;
5704 fi;;
5705 *)
5706 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7a282f6d 5707 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
c1a7f87b
JH
5708 then tval=true;
5709 else tval=false;
5710 fi;
5711 $rm -f t t.c;;
5712 esac;;
5713*)
5714 case "$tval" in
5715 $define) tval=true;;
5716 *) tval=false;;
5717 esac;;
5718esac;
5719eval "$2=$tval"'
bd9b35c9 5720
c1a7f87b
JH
5721: define an is-in-libc? function
5722inlibc='echo " "; td=$define; tu=$undef;
5723sym=$1; var=$2; eval "was=\$$2";
5724tx=yes;
5725case "$reuseval$was" in
5726true) ;;
5727true*) tx=no;;
5728esac;
5729case "$tx" in
5730yes)
5731 set $sym tres -f;
5732 eval $csym;
5733 case "$tres" in
5734 true)
5735 echo "$sym() found." >&4;
5736 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5737 *)
5738 echo "$sym() NOT found." >&4;
5739 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5740 esac;;
bd9b35c9 5741*)
c1a7f87b
JH
5742 case "$was" in
5743 $define) echo "$sym() found." >&4;;
5744 *) echo "$sym() NOT found." >&4;;
5745 esac;;
5746esac'
5747
b4eb6b3d
JH
5748: see if sqrtl exists
5749set sqrtl d_sqrtl
c1a7f87b
JH
5750eval $inlibc
5751
b4eb6b3d
JH
5752: check for length of double
5753echo " "
5754case "$doublesize" in
5755'')
5756 echo "Checking to see how big your double precision numbers are..." >&4
5757 $cat >try.c <<'EOCP'
5758#include <stdio.h>
5759int main()
5760{
5761 printf("%d\n", (int)sizeof(double));
5762 exit(0);
5763}
5764EOCP
5765 set try
5766 if eval $compile_ok; then
5440bc8e 5767 doublesize=`$run ./try`
b4eb6b3d
JH
5768 echo "Your double is $doublesize bytes long."
5769 else
5770 dflt='8'
5771 echo "(I can't seem to compile the test program. Guessing...)"
5772 rp="What is the size of a double precision number (in bytes)?"
5773 . ./myread
5774 doublesize="$ans"
5775 fi
5776 ;;
5777esac
5778$rm -f try.c try
5779
5780: check for long doubles
5781echo " "
5782echo "Checking to see if you have long double..." >&4
5783echo 'int main() { long double x = 7.0; }' > try.c
5784set try
5785if eval $compile; then
5786 val="$define"
5787 echo "You have long double."
5788else
5789 val="$undef"
5790 echo "You do not have long double."
5791fi
5792$rm try.*
5793set d_longdbl
5794eval $setvar
5795
5796: check for length of long double
5797case "${d_longdbl}${longdblsize}" in
5798$define)
5799 echo " "
5800 echo "Checking to see how big your long doubles are..." >&4
5801 $cat >try.c <<'EOCP'
5802#include <stdio.h>
5803int main()
5804{
5805 printf("%d\n", sizeof(long double));
5806}
5807EOCP
5808 set try
5809 set try
5810 if eval $compile; then
5440bc8e 5811 longdblsize=`$run ./try`
b4eb6b3d
JH
5812 echo "Your long doubles are $longdblsize bytes long."
5813 else
5814 dflt='8'
5815 echo " "
5816 echo "(I can't seem to compile the test program. Guessing...)" >&4
5817 rp="What is the size of a long double (in bytes)?"
5818 . ./myread
5819 longdblsize="$ans"
5820 fi
5821 if $test "X$doublesize" = "X$longdblsize"; then
5822 echo "(That isn't any different from an ordinary double.)"
5823 fi
5824 ;;
5825esac
5826$rm -f try.* try
5827
dc526090
NC
5828echo " "
5829
5830if $test X"$d_longdbl" = X"$define"; then
5831
5832echo "Checking how to print long doubles..." >&4
5833
5834if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5835 $cat >try.c <<'EOCP'
5836#include <sys/types.h>
5837#include <stdio.h>
5838int main() {
5839 double d = 123.456;
5840 printf("%.3f\n", d);
5841}
5842EOCP
5843 set try
5844 if eval $compile; then
5845 yyy=`$run ./try`
5846 case "$yyy" in
5847 123.456)
5848 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5849 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5850 echo "We will use %f."
5851 ;;
5852 esac
5853 fi
5854fi
5855
5856if $test X"$sPRIfldbl" = X; then
5857 $cat >try.c <<'EOCP'
5858#include <sys/types.h>
5859#include <stdio.h>
5860int main() {
5861 long double d = 123.456;
5862 printf("%.3Lf\n", d);
5863}
5864EOCP
5865 set try
5866 if eval $compile; then
5867 yyy=`$run ./try`
5868 case "$yyy" in
5869 123.456)
5870 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5871 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5872 echo "We will use %Lf."
5873 ;;
5874 esac
5875 fi
5876fi
5877
5878if $test X"$sPRIfldbl" = X; then
5879 $cat >try.c <<'EOCP'
5880#include <sys/types.h>
5881#include <stdio.h>
5882int main() {
5883 long double d = 123.456;
5884 printf("%.3llf\n", d);
5885}
5886EOCP
5887 set try
5888 if eval $compile; then
5889 yyy=`$run ./try`
5890 case "$yyy" in
5891 123.456)
5892 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5893 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5894 echo "We will use %llf."
5895 ;;
5896 esac
5897 fi
5898fi
5899
5900if $test X"$sPRIfldbl" = X; then
5901 $cat >try.c <<'EOCP'
5902#include <sys/types.h>
5903#include <stdio.h>
5904int main() {
5905 long double d = 123.456;
5906 printf("%.3lf\n", d);
5907}
5908EOCP
5909 set try
5910 if eval $compile; then
5911 yyy=`$run ./try`
5912 case "$yyy" in
5913 123.456)
5914 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
5915 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
5916 echo "We will use %lf."
5917 ;;
5918 esac
5919 fi
5920fi
5921
5922if $test X"$sPRIfldbl" = X; then
5923 echo "Cannot figure out how to print long doubles." >&4
5924else
5925 sSCNfldbl=$sPRIfldbl # expect consistency
5926fi
5927
5928$rm -f try try.*
5929
5930fi # d_longdbl
5931
5932case "$sPRIfldbl" in
5933'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
5934 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
5935 d_SCNfldbl="$undef";
5936 ;;
5937*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
5938 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
5939 d_SCNfldbl="$define";
5940 ;;
5941esac
5942
5943: see if modfl exists
5944set modfl d_modfl
5945eval $inlibc
5946
5947d_modfl_pow32_bug="$undef"
5948
5949case "$d_longdbl$d_modfl" in
5950$define$define)
5951 $cat <<EOM
5952Checking to see whether your modfl() is okay for large values...
5953EOM
5954$cat >try.c <<EOCP
5955#include <math.h>
5956#include <stdio.h>
5957int main() {
5958 long double nv = 4294967303.15;
5959 long double v, w;
5960 v = modfl(nv, &w);
5961#ifdef __GLIBC__
5962 printf("glibc");
5963#endif
5964 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
5965 return 0;
5966}
5967EOCP
5968 case "$osname:$gccversion" in
5969 aix:) saveccflags="$ccflags"
5970 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
5971 esac
5972 set try
5973 if eval $compile; then
5974 foo=`$run ./try`
5975 case "$foo" in
5976 *" 4294967303.150000 1.150000 4294967302.000000")
5977 echo >&4 "Your modfl() is broken for large values."
5978 d_modfl_pow32_bug="$define"
5979 case "$foo" in
5980 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
5981 ;;
5982 esac
5983 ;;
5984 *" 4294967303.150000 0.150000 4294967303.000000")
5985 echo >&4 "Your modfl() seems okay for large values."
5986 ;;
5987 *) echo >&4 "I don't understand your modfl() at all."
5988 d_modfl="$undef"
5989 ;;
5990 esac
5991 $rm -f try.* try core core.try.*
5992 else
5993 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
5994 d_modfl="$undef"
5995 fi
5996 case "$osname:$gccversion" in
5997 aix:) ccflags="$saveccflags" ;; # restore
5998 esac
5999 ;;
6000esac
6001
6002case "$ccflags" in
6003*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6004esac
6005
6006case "$uselongdouble" in
6007$define|true|[yY]*) dflt='y';;
6008*) dflt='n';;
6009esac
6010cat <<EOM
6011
6012Perl can be built to take advantage of long doubles which
6013(if available) may give more accuracy and range for floating point numbers.
6014
6015If this doesn't make any sense to you, just accept the default '$dflt'.
6016EOM
6017rp='Try to use long doubles if available?'
6018. ./myread
6019case "$ans" in
6020y|Y) val="$define" ;;
6021*) val="$undef" ;;
6022esac
6023set uselongdouble
6024eval $setvar
6025
6026case "$uselongdouble" in
6027true|[yY]*) uselongdouble="$define" ;;
6028esac
6029
6030case "$uselongdouble" in
6031$define)
6032: Look for a hint-file generated 'call-back-unit'. If the
6033: user has specified that long doubles should be used,
6034: we may need to set or change some other defaults.
6035 if $test -f uselongdouble.cbu; then
6036 echo "Your platform has some specific hints for long doubles, using them..."
6037 . ./uselongdouble.cbu
6038 else
6039 $cat <<EOM
6040(Your platform doesn't have any specific hints for long doubles.)
6041EOM
6042 fi
6043 ;;
6044esac
6045
6046message=X
6047case "$uselongdouble:$d_sqrtl:$d_modfl" in
6048$define:$define:$define)
6049 : You have both
6050 ;;
6051$define:$define:$undef)
6052 message="I could not find modfl"
6053 ;;
6054$define:$undef:$define)
6055 message="I could not find sqrtl"
6056 ;;
6057$define:$undef:$undef)
6058 message="I found neither sqrtl nor modfl"
6059 ;;
6060esac
6061
6062if $test "$message" != X; then
6063 $cat <<EOM >&4
6064
6065*** You requested the use of long doubles but you do not seem to have
6066*** the mathematic functions for long doubles.
6067*** ($message)
6068*** I'm disabling the use of long doubles.
6069
6070EOM
6071
6072 uselongdouble=$undef
6073fi
6074
51de783f 6075case "$useperlio" in
5a3a8a02 6076$define|true|[yY]*|'') dflt='y';;
51de783f
JH
6077*) dflt='n';;
6078esac
6079cat <<EOM
6080
6081Previous version of $package used the standard IO mechanisms as
5a3a8a02 6082defined in <stdio.h>. Versions 5.003_02 and later of $package allow
51de783f 6083alternate IO mechanisms via the PerlIO abstraction layer, but the
5a3a8a02
JH
6084stdio mechanism is still available if needed. The abstraction layer
6085can use AT&T's sfio (if you already have sfio installed) or regular stdio.
51de783f
JH
6086Using PerlIO with sfio may cause problems with some extension modules.
6087
6088If this doesn't make any sense to you, just accept the default '$dflt'.
6089EOM
5a3a8a02 6090rp='Use the PerlIO abstraction layer?'
51de783f
JH
6091. ./myread
6092case "$ans" in
6093y|Y)
6094 val="$define"
5a3a8a02 6095 ;;
51de783f
JH
6096*)
6097 echo "Ok, doing things the stdio way."
6098 val="$undef"
6099 ;;
6100esac
6101set useperlio
6102eval $setvar
6103
6104case "$usesocks" in
6105$define|true|[yY]*)
6106 case "$useperlio" in
6107 $define|true|[yY]*) ;;
6108 *) cat >&4 <<EOM
6109
6110You are using the SOCKS proxy protocol library which means that you
6111should also use the PerlIO layer. You may be headed for trouble.
6112
6113EOM
6114 ;;
6115 esac
6116 ;;
6117esac
6118
6119
b4eb6b3d
JH
6120: determine the architecture name
6121echo " "
6122if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6123 tarch=`arch`"-$osname"
6124elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6125 if uname -m > tmparch 2>&1 ; then
6126 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6127 -e 's/$/'"-$osname/" tmparch`
6128 else
6129 tarch="$osname"
6130 fi
6131 $rm -f tmparch
6132else
6133 tarch="$osname"
6134fi
6135case "$myarchname" in
6136''|"$tarch") ;;
6137*)
6138 echo "(Your architecture name used to be $myarchname.)"
6139 archname=''
6140 ;;
6141esac
5440bc8e
JH
6142case "$targetarch" in
6143'') ;;
6144*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6145esac
b4eb6b3d
JH
6146myarchname="$tarch"
6147case "$archname" in
6148'') dflt="$tarch";;
6149*) dflt="$archname";;
6150esac
6151rp='What is your architecture name'
6152. ./myread
6153archname="$ans"
6154case "$usethreads" in
6155$define)
6156 echo "Threads selected." >&4
6157 case "$archname" in
6158 *-thread*) echo "...and architecture name already has -thread." >&4
6159 ;;
6160 *) archname="$archname-thread"
6161 echo "...setting architecture name to $archname." >&4
6162 ;;
6163 esac
6164 ;;
6165esac
6166case "$usemultiplicity" in
6167$define)
6168 echo "Multiplicity selected." >&4
6169 case "$archname" in
6170 *-multi*) echo "...and architecture name already has -multi." >&4
6171 ;;
6172 *) archname="$archname-multi"
6173 echo "...setting architecture name to $archname." >&4
6174 ;;
6175 esac
6176 ;;
6177esac
6178case "$use64bitint$use64bitall" in
6179*"$define"*)
6180 case "$archname64" in
6181 '')
6182 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6183 ;;
6184 *)
6185 case "$use64bitint" in
6186 "$define") echo "64 bit integers selected." >&4 ;;
6187 esac
6188 case "$use64bitall" in
6189 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6190 esac
6191 case "$archname" in
6192 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6193 ;;
6194 *) archname="$archname-$archname64"
6195 echo "...setting architecture name to $archname." >&4
6196 ;;
6197 esac
6198 ;;
6199 esac
6200esac
6201case "$uselongdouble" in
6202$define)
6203 echo "Long doubles selected." >&4
6204 case "$longdblsize" in
6205 $doublesize)
262495b9 6206 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
b4eb6b3d
JH
6207 ;;
6208 *)
6209 case "$archname" in
6210 *-ld*) echo "...and architecture name already has -ld." >&4
6211 ;;
6212 *) archname="$archname-ld"
6213 echo "...setting architecture name to $archname." >&4
6214 ;;
6215 esac
6216 ;;
6217 esac
6218 ;;
6219esac
51de783f
JH
6220case "$useperlio" in
6221$define)
6222 echo "Perlio selected." >&4
d46c9a2d
JH
6223 ;;
6224*)
6225 echo "Perlio not selected, using stdio." >&4
51de783f 6226 case "$archname" in
d46c9a2d 6227 *-stdio*) echo "...and architecture name already has -stdio." >&4
51de783f 6228 ;;
d46c9a2d 6229 *) archname="$archname-stdio"
51de783f
JH
6230 echo "...setting architecture name to $archname." >&4
6231 ;;
6232 esac
6233 ;;
6234esac
b4eb6b3d
JH
6235
6236: determine root of directory hierarchy where package will be installed.
6237case "$prefix" in
6238'')
6239 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6240 ;;
6241*)
6242 dflt="$prefix"
6243 ;;
6244esac
6245$cat <<EOM
6246
6247By default, $package will be installed in $dflt/bin, manual pages
6248under $dflt/man, etc..., i.e. with $dflt as prefix for all
6249installation directories. Typically this is something like /usr/local.
6250If you wish to have binaries under /usr/bin but other parts of the
6251installation under /usr/local, that's ok: you will be prompted
6252separately for each of the installation directories, the prefix being
6253only used to set the defaults.
6254
6255EOM
6256fn=d~
6257rp='Installation prefix to use?'
6258. ./getfile
6259oldprefix=''
6260case "$prefix" in
6261'') ;;
6262*)
6263 case "$ans" in
6264 "$prefix") ;;
6265 *) oldprefix="$prefix";;
6266 esac
6267 ;;
6268esac
6269prefix="$ans"
6270prefixexp="$ansexp"
6271
a6d26a0d
JH
6272case "$afsroot" in
6273'') afsroot=/afs ;;
6274*) afsroot=$afsroot ;;
6275esac
6276
b4eb6b3d
JH
6277: is AFS running?
6278echo " "
6279case "$afs" in
6280$define|true) afs=true ;;
6281$undef|false) afs=false ;;
a6d26a0d 6282*) if test -d $afsroot; then
b4eb6b3d
JH
6283 afs=true
6284 else
6285 afs=false
6286 fi
6287 ;;
6288esac
6289if $afs; then
6290 echo "AFS may be running... I'll be extra cautious then..." >&4
6291else
6292 echo "AFS does not seem to be running..." >&4
6293fi
6294
6295: determine installation prefix for where package is to be installed.
6296if $afs; then
6297$cat <<EOM
6298
6299Since you are running AFS, I need to distinguish the directory in which
6300files will reside from the directory in which they are installed (and from
6301which they are presumably copied to the former directory by occult means).
6302
6303EOM
6304 case "$installprefix" in
6305 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6306 *) dflt="$installprefix";;
6307 esac
6308else
6309$cat <<EOM
6310
6311In some special cases, particularly when building $package for distribution,
6312it is convenient to distinguish between the directory in which files should
6313be installed from the directory ($prefix) in which they
6314will eventually reside. For most users, these two directories are the same.
6315
6316EOM
6317 case "$installprefix" in
6318 '') dflt=$prefix ;;
6319 *) dflt=$installprefix;;
6320 esac
6321fi
6322fn=d~
6323rp='What installation prefix should I use for installing files?'
6324. ./getfile
6325installprefix="$ans"
6326installprefixexp="$ansexp"
6327
6328: set the prefixit variable, to compute a suitable default value
6329prefixit='case "$3" in
6330""|none)
6331 case "$oldprefix" in
6332 "") eval "$1=\"\$$2\"";;
6333 *)
6334 case "$3" in
6335 "") eval "$1=";;
6336 none)
6337 eval "tp=\"\$$2\"";
6338 case "$tp" in
6339 ""|" ") eval "$1=\"\$$2\"";;
6340 *) eval "$1=";;
6341 esac;;
6342 esac;;
6343 esac;;
6344*)
6345 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6346 case "$tp" in
6347 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6348 /*-$oldprefix/*|\~*-$oldprefix/*)
6349 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6350 *) eval "$1=\"\$$2\"";;
6351 esac;;
6352esac'
6353
b4eb6b3d
JH
6354: get the patchlevel
6355echo " "
6356echo "Getting the current patchlevel..." >&4
6357if $test -r $rsrc/patchlevel.h;then
6358 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6359 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6360 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6361 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6362 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6363 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 6364 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
6365else
6366 revision=0
6367 patchlevel=0
6368 subversion=0
6369 api_revision=0
6370 api_version=0
6371 api_subversion=0
151e6568
MB
6372 perl_patchlevel=0
6373 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 6374fi
151e6568
MB
6375if $test -r $rsrc/.patch ; then
6376 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6377 perl_patchlevel=`cat $rsrc/.patch`
6378 fi
6379fi
861eb78d
AD
6380: Define a handy string here to avoid duplication in myconfig.SH and configpm.
6381version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 6382case "$perl_patchlevel" in
861eb78d
AD
63830|'') ;;
6384*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 6385esac
861eb78d
AD
6386
6387$echo "(You have $package $version_patchlevel_string.)"
6388
b4eb6b3d
JH
6389case "$osname" in
6390dos|vms)
6391 : XXX Should be a Configure test for double-dots in filenames.
6392 version=`echo $revision $patchlevel $subversion | \
6393 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6394 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6395 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6396 ;;
6397*)
6398 version=`echo $revision $patchlevel $subversion | \
6399 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6400 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6401 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6402 ;;
6403esac
6404: Special case the 5.005_xx maintenance series, which used 5.005
6405: without any subversion label as a subdirectory in $sitelib
6406if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6407 api_versionstring='5.005'
6408fi
6409
6410: determine installation style
6411: For now, try to deduce it from prefix unless it is already set.
6412: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6413case "$installstyle" in
6414'') case "$prefix" in
6415 *perl*) dflt='lib';;
6416 *) dflt='lib/perl5' ;;
6417 esac
6418 ;;
6419*) dflt="$installstyle" ;;
6420esac
6421: Probably not worth prompting for this since we prompt for all
6422: the directories individually, and the prompt would be too long and
6423: confusing anyway.
6424installstyle=$dflt
6425
6426: determine where private library files go
6427: Usual default is /usr/local/lib/perl5/$version.
6428: Also allow things like /opt/perl/lib/$version, since
6429: /opt/perl/lib/perl5... would be redundant.
6430: The default "style" setting is made in installstyle.U
6431case "$installstyle" in
6432*lib/perl5*) set dflt privlib lib/$package/$version ;;
6433*) set dflt privlib lib/$version ;;
6434esac
6435eval $prefixit
6436$cat <<EOM
6437
6438There are some auxiliary files for $package that need to be put into a
6439private library directory that is accessible by everyone.
6440
6441EOM
6442fn=d~+
6443rp='Pathname where the private library files will reside?'
6444. ./getfile
6445privlib="$ans"
6446privlibexp="$ansexp"
6447: Change installation prefix, if necessary.
6448if $test X"$prefix" != X"$installprefix"; then
6449 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6450else
6451 installprivlib="$privlibexp"
6452fi
6453
6454: set the prefixup variable, to restore leading tilda escape
6455prefixup='case "$prefixexp" in
6456"$prefix") ;;
6457*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6458esac'
6459
6460: determine where public architecture dependent libraries go
6461set archlib archlib
6462eval $prefixit
6463: privlib default is /usr/local/lib/$package/$version
6464: archlib default is /usr/local/lib/$package/$version/$archname
6465: privlib may have an optional trailing /share.
6466tdflt=`echo $privlib | $sed 's,/share$,,'`
6467tdflt=$tdflt/$archname
6468case "$archlib" in
6469'') dflt=$tdflt
6470 ;;
6471*) dflt="$archlib"
6472 ;;
6473esac
6474$cat <<EOM
6475
6476$spackage contains architecture-dependent library files. If you are
6477sharing libraries in a heterogeneous environment, you might store
6478these files in a separate location. Otherwise, you can just include
6479them with the rest of the public library files.
6480
6481EOM
6482fn=d+~
6483rp='Where do you want to put the public architecture-dependent libraries?'
6484. ./getfile
6485archlib="$ans"
6486archlibexp="$ansexp"
6487if $test X"$archlib" = X"$privlib"; then
6488 d_archlib="$undef"
6489else
6490 d_archlib="$define"
6491fi
6492: Change installation prefix, if necessary.
6493if $test X"$prefix" != X"$installprefix"; then
6494 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6495else
6496 installarchlib="$archlibexp"
6497fi
6498
b4eb6b3d
JH
6499: see if setuid scripts can be secure
6500$cat <<EOM
6501
6502Some kernels have a bug that prevents setuid #! scripts from being
6503secure. Some sites have disabled setuid #! scripts because of this.
6504
6505First let's decide if your kernel supports secure setuid #! scripts.
6506(If setuid #! scripts would be secure but have been disabled anyway,
6507don't say that they are secure if asked.)
6508
6509EOM
6510
6511val="$undef"
6512if $test -d /dev/fd; then
6513 echo "#!$ls" >reflect
6514 chmod +x,u+s reflect
6515 ./reflect >flect 2>&1
6516 if $contains "/dev/fd" flect >/dev/null; then
6517 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6518 val="$define"
6519 else
6520 $cat <<EOM
6521If you are not sure if they are secure, I can check but I'll need a
6522username and password different from the one you are using right now.
6523If you don't have such a username or don't want me to test, simply
6524enter 'none'.
6525
6526EOM
6527 rp='Other username to test security of setuid scripts with?'
6528 dflt='none'
6529 . ./myread
6530 case "$ans" in
6531 n|none)
6532 case "$d_suidsafe" in
6533 '') echo "I'll assume setuid scripts are *not* secure." >&4
6534 dflt=n;;
6535 "$undef")
6536 echo "Well, the $hint value is *not* secure." >&4
6537 dflt=n;;
6538 *) echo "Well, the $hint value *is* secure." >&4
6539 dflt=y;;
6540 esac
c1a7f87b 6541 ;;
b4eb6b3d
JH
6542 *)
6543 $rm -f reflect flect
6544 echo "#!$ls" >reflect
6545 chmod +x,u+s reflect
6546 echo >flect
6547 chmod a+w flect
6548 echo '"su" will (probably) prompt you for '"$ans's password."
6549 su $ans -c './reflect >flect'
6550 if $contains "/dev/fd" flect >/dev/null; then
6551 echo "Okay, it looks like setuid scripts are secure." >&4
6552 dflt=y
6553 else
6554 echo "I don't think setuid scripts are secure." >&4
6555 dflt=n
6556 fi
6557 ;;
6558 esac
6559 rp='Does your kernel have *secure* setuid scripts?'
6560 . ./myread
6561 case "$ans" in
6562 [yY]*) val="$define";;
6563 *) val="$undef";;
6564 esac
6565 fi
6566else
6567 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6568 echo "(That's for file descriptors, not floppy disks.)"
6569 val="$undef"
6570fi
6571set d_suidsafe
6572eval $setvar
6573
6574$rm -f reflect flect
6575
6576: now see if they want to do setuid emulation
6577echo " "
6578val="$undef"
6579case "$d_suidsafe" in
6580"$define")
6581 val="$undef"
3c728e00 6582 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6583 ;;
6584*)
6585 $cat <<EOM
6586Some systems have disabled setuid scripts, especially systems where
6587setuid scripts cannot be secure. On systems where setuid scripts have
6588been disabled, the setuid/setgid bits on scripts are currently
6589useless. It is possible for $package to detect those bits and emulate
6590setuid/setgid in a secure fashion. This emulation will only work if
6591setuid scripts have been disabled in your kernel.
6592
6593EOM
6594 case "$d_dosuid" in
6595 "$define") dflt=y ;;
6596 *) dflt=n ;;
6597 esac
6598 rp="Do you want to do setuid/setgid emulation?"
6599 . ./myread
6600 case "$ans" in
6601 [yY]*) val="$define";;
6602 *) val="$undef";;
6603 esac
6604 ;;
6605esac
6606set d_dosuid
6607eval $setvar
6608
b4eb6b3d
JH
6609: see if this is a malloc.h system
6610set malloc.h i_malloc
6611eval $inhdr
6612
6613: see if stdlib is available
6614set stdlib.h i_stdlib
6615eval $inhdr
6616
c8b93cf9
JH
6617: check for void type
6618echo " "
6619echo "Checking to see how well your C compiler groks the void type..." >&4
6620case "$voidflags" in
6621'')
6622 $cat >try.c <<'EOCP'
6623#if TRY & 1
6624void sub() {
6625#else
6626sub() {
6627#endif
6628 extern void moo(); /* function returning void */
6629 void (*goo)(); /* ptr to func returning void */
6630#if TRY & 8
6631 void *hue; /* generic ptr */
6632#endif
6633#if TRY & 2
6634 void (*foo[10])();
6635#endif
6636
6637#if TRY & 4
6638 if(goo == moo) {
6639 exit(0);
6640 }
6641#endif
6642 exit(0);
6643}
6644int main() { sub(); }
6645EOCP
6646 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6647 voidflags=$defvoidused
6648 echo "Good. It appears to support void to the level $package wants.">&4
6649 if $contains warning .out >/dev/null 2>&1; then
6650 echo "However, you might get some warnings that look like this:"
6651 $cat .out
6652 fi
6653 else
6654echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6655 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6656 echo "It supports 1..."
6657 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6658 echo "It also supports 2..."
6659 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6660 voidflags=7
6661 echo "And it supports 4 but not 8 definitely."
6662 else
6663 echo "It doesn't support 4..."
6664 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6665 voidflags=11
6666 echo "But it supports 8."
6667 else
6668 voidflags=3
6669 echo "Neither does it support 8."
6670 fi
6671 fi
6672 else
6673 echo "It does not support 2..."
6674 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6675 voidflags=13
6676 echo "But it supports 4 and 8."
6677 else
6678 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6679 voidflags=5
6680 echo "And it supports 4 but has not heard about 8."
6681 else
6682 echo "However it supports 8 but not 4."
6683 fi
6684 fi
6685 fi
6686 else
6687 echo "There is no support at all for void."
6688 voidflags=0
6689 fi
6690 fi
6691esac
6692case "$voidflags" in
6693"$defvoidused") ;;
6694*) $cat >&4 <<'EOM'
6695 Support flag bits are:
6696 1: basic void declarations.
6697 2: arrays of pointers to functions returning void.
6698 4: operations between pointers to and addresses of void functions.
6699 8: generic void pointers.
6700EOM
6701 dflt="$voidflags";
6702 rp="Your void support flags add up to what?"
6703 . ./myread
6704 voidflags="$ans"
6705 ;;
6706esac
6707$rm -f try.* .out
6708
6709: check for length of pointer
6710echo " "
6711case "$ptrsize" in
6712'')
6713 echo "Checking to see how big your pointers are..." >&4
6714 if test "$voidflags" -gt 7; then
6715 echo '#define VOID_PTR char *' > try.c
6716 else
6717 echo '#define VOID_PTR void *' > try.c
6718 fi
6719 $cat >>try.c <<'EOCP'
6720#include <stdio.h>
6721int main()
6722{
6723 printf("%d\n", (int)sizeof(VOID_PTR));
6724 exit(0);
6725}
6726EOCP
6727 set try
6728 if eval $compile_ok; then
6729 ptrsize=`$run ./try`
6730 echo "Your pointers are $ptrsize bytes long."
6731 else
6732 dflt='4'
6733 echo "(I can't seem to compile the test program. Guessing...)" >&4
6734 rp="What is the size of a pointer (in bytes)?"
6735 . ./myread
6736 ptrsize="$ans"
6737 fi
6738 ;;
6739esac
6740$rm -f try.c try
6741case "$use64bitall" in
6742"$define"|true|[yY]*)
6743 case "$ptrsize" in
6744 4) cat <<EOM >&4
6745
6746*** You have chosen a maximally 64-bit build, but your pointers
6747*** are only 4 bytes wide, disabling maximal 64-bitness.
6748
6749EOM
6750 use64bitall="$undef"
6751 case "$use64bitint" in
6752 "$define"|true|[yY]*) ;;
6753 *) cat <<EOM >&4
6754
6755*** Downgrading from maximal 64-bitness to using 64-bit integers.
6756
6757EOM
6758 use64bitint="$define"
6759 ;;
6760 esac
6761 ;;
6762 esac
6763 ;;
6764esac
6765
6766
b4eb6b3d
JH
6767: determine which malloc to compile in
6768echo " "
6769case "$usemymalloc" in
c4163172
JH
6770[yY]*|true|$define) dflt='y' ;;
6771[nN]*|false|$undef) dflt='n' ;;
6772*) case "$ptrsize" in
6773 4) dflt='y' ;;
6774 *) dflt='n' ;;
6775 esac
6776 ;;
8dfa8df9 6777esac
b4eb6b3d
JH
6778rp="Do you wish to attempt to use the malloc that comes with $package?"
6779. ./myread
6780usemymalloc="$ans"
6781case "$ans" in
6782y*|true)
6783 usemymalloc='y'
6784 mallocsrc='malloc.c'
6785 mallocobj="malloc$_o"
6786 d_mymalloc="$define"
6787 case "$libs" in
6788 *-lmalloc*)
6789 : Remove malloc from list of libraries to use
6790 echo "Removing unneeded -lmalloc from library list" >&4
6791 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6792 shift
6793 libs="$*"
6794 echo "libs = $libs" >&4
6795 ;;
6796 esac
6797 ;;
6798*)
6799 usemymalloc='n'
6800 mallocsrc=''
6801 mallocobj=''
6802 d_mymalloc="$undef"
6803 ;;
6804esac
6805
6806: compute the return types of malloc and free
6807echo " "
6808$cat >malloc.c <<END
6809#$i_malloc I_MALLOC
6810#$i_stdlib I_STDLIB
6811#include <stdio.h>
6812#include <sys/types.h>
6813#ifdef I_MALLOC
6814#include <malloc.h>
6815#endif
6816#ifdef I_STDLIB
6817#include <stdlib.h>
6818#endif
6819#ifdef TRY_MALLOC
6820void *malloc();
6821#endif
6822#ifdef TRY_FREE
6823void free();
6824#endif
6825END
6826case "$malloctype" in
6827'')
6828 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6829 malloctype='void *'
6830 else
6831 malloctype='char *'
6832 fi
6833 ;;
6834esac
6835echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6836
6837case "$freetype" in
6838'')
6839 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6840 freetype='void'
6841 else
6842 freetype='int'
6843 fi
6844 ;;
6845esac
6846echo "Your system uses $freetype free(), it would seem." >&4
6847$rm -f malloc.[co]
6848$cat <<EOM
6849
6850After $package is installed, you may wish to install various
6851add-on modules and utilities. Typically, these add-ons will
6852be installed under $prefix with the rest
6853of this package. However, you may wish to install such add-ons
6854elsewhere under a different prefix.
6855
6856If you do not wish to put everything under a single prefix, that's
6857ok. You will be prompted for the individual locations; this siteprefix
6858is only used to suggest the defaults.
6859
6860The default should be fine for most people.
6861
6862EOM
6863fn=d~+
6864rp='Installation prefix to use for add-on modules and utilities?'
6865: XXX Here might be another good place for an installstyle setting.
6866case "$siteprefix" in
6867'') dflt=$prefix ;;
6868*) dflt=$siteprefix ;;
6869esac
6870. ./getfile
6871: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6872oldsiteprefix=''
6873case "$siteprefix" in
6874'') ;;
6875*) case "$ans" in
6876 "$prefix") ;;
6877 *) oldsiteprefix="$prefix";;
6878 esac
6879 ;;
6880esac
6881siteprefix="$ans"
6882siteprefixexp="$ansexp"
6883
6884: determine where site specific libraries go.
6885: Usual default is /usr/local/lib/perl5/site_perl/$version
6886: The default "style" setting is made in installstyle.U
6887: XXX No longer works with Prefixit stuff.
6888prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6889case "$sitelib" in
6890'') case "$installstyle" in
6891 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6892 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6893 esac
6894 ;;
6895*) dflt="$sitelib"
6896 ;;
6897esac
6898$cat <<EOM
6899
6900The installation process will create a directory for
6901site-specific extensions and modules. Most users find it convenient
6902to place all site-specific files in this directory rather than in the
6903main distribution directory.
6904
6905EOM
6906fn=d~+
6907rp='Pathname for the site-specific library files?'
6908. ./getfile
6909sitelib="$ans"
6910sitelibexp="$ansexp"
6911sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6912: Change installation prefix, if necessary.
6913if $test X"$prefix" != X"$installprefix"; then
6914 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6915else
6916 installsitelib="$sitelibexp"
6917fi
6918
6919: determine where site specific architecture-dependent libraries go.
6920: sitelib default is /usr/local/lib/perl5/site_perl/$version
6921: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6922: sitelib may have an optional trailing /share.
6923case "$sitearch" in
6924'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6925 dflt="$dflt/$archname"
6926 ;;
6927*) dflt="$sitearch"
6928 ;;
6929esac
6930set sitearch sitearch none
6931eval $prefixit
6932$cat <<EOM
6933
6934The installation process will also create a directory for
6935architecture-dependent site-specific extensions and modules.
6936
6937EOM
6938fn=d~+
6939rp='Pathname for the site-specific architecture-dependent library files?'
6940. ./getfile
6941sitearch="$ans"
6942sitearchexp="$ansexp"
6943: Change installation prefix, if necessary.
6944if $test X"$prefix" != X"$installprefix"; then
6945 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6946else
6947 installsitearch="$sitearchexp"
6948fi
6949
6950$cat <<EOM
6951
6952The installation process will also create a directory for
6953vendor-supplied add-ons. Vendors who supply perl with their system
6954may find it convenient to place all vendor-supplied files in this
6955directory rather than in the main distribution directory. This will
6956ease upgrades between binary-compatible maintenance versions of perl.
6957
6958Of course you may also use these directories in whatever way you see
6959fit. For example, you might use them to access modules shared over a
6960company-wide network.
6961
6962The default answer should be fine for most people.
6963This causes further questions about vendor add-ons to be skipped
6964and no vendor-specific directories will be configured for perl.
6965
6966EOM
6967rp='Do you want to configure vendor-specific add-on directories?'
6968case "$usevendorprefix" in
6969define|true|[yY]*) dflt=y ;;
6970*) : User may have set vendorprefix directly on Configure command line.
6971 case "$vendorprefix" in
6972 ''|' ') dflt=n ;;
6973 *) dflt=y ;;
6974 esac
6975 ;;
6976esac
6977. ./myread
6978case "$ans" in
6979[yY]*) fn=d~+
6980 rp='Installation prefix to use for vendor-supplied add-ons?'
6981 case "$vendorprefix" in
6982 '') dflt='' ;;
6983 *) dflt=$vendorprefix ;;
6984 esac
6985 . ./getfile
6986 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6987 oldvendorprefix=''
6988 case "$vendorprefix" in
6989 '') ;;
6990 *) case "$ans" in
6991 "$prefix") ;;
6992 *) oldvendorprefix="$prefix";;
6993 esac
6994 ;;
6995 esac
6996 usevendorprefix="$define"
6997 vendorprefix="$ans"
6998 vendorprefixexp="$ansexp"
6999 ;;
7000*) usevendorprefix="$undef"
7001 vendorprefix=''
7002 vendorprefixexp=''
7003 ;;
7004esac
7005
7006case "$vendorprefix" in
7007'') d_vendorlib="$undef"
7008 vendorlib=''
7009 vendorlibexp=''
7010 ;;
7011*) d_vendorlib="$define"
7012 : determine where vendor-supplied modules go.
7013 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7014 case "$vendorlib" in
7015 '')
7016 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7017 case "$installstyle" in
7018 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7019 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7020 esac
7021 ;;
7022 *) dflt="$vendorlib"
7023 ;;
7024 esac
7025 fn=d~+
7026 rp='Pathname for the vendor-supplied library files?'
7027 . ./getfile
7028 vendorlib="$ans"
7029 vendorlibexp="$ansexp"
7030 ;;
7031esac
7032vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7033: Change installation prefix, if necessary.
7034if $test X"$prefix" != X"$installprefix"; then
7035 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7036else
7037 installvendorlib="$vendorlibexp"
7038fi
7039
7040case "$vendorprefix" in
7041'') d_vendorarch="$undef"
7042 vendorarch=''
7043 vendorarchexp=''
7044 ;;
7045*) d_vendorarch="$define"
7046 : determine where vendor-supplied architecture-dependent libraries go.
7047 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7048 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7049 : vendorlib may have an optional trailing /share.
7050 case "$vendorarch" in
7051 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7052 dflt="$dflt/$archname"
7053 ;;
7054 *) dflt="$vendorarch" ;;
7055 esac
7056 fn=d~+
7057 rp='Pathname for vendor-supplied architecture-dependent files?'
7058 . ./getfile
7059 vendorarch="$ans"
7060 vendorarchexp="$ansexp"
7061 ;;
7062esac
7063: Change installation prefix, if necessary.
7064if $test X"$prefix" != X"$installprefix"; then
7065 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7066else
7067 installvendorarch="$vendorarchexp"
7068fi
7069
7070: Final catch-all directories to search
7071$cat <<EOM
7072
7073Lastly, you can have perl look in other directories for extensions and
7074modules in addition to those already specified.
7075These directories will be searched after
7076 $sitearch
7077 $sitelib
7078EOM
7079test X"$vendorlib" != "X" && echo ' ' $vendorlib
7080test X"$vendorarch" != "X" && echo ' ' $vendorarch
7081echo ' '
7082case "$otherlibdirs" in
7083''|' ') dflt='none' ;;
7084*) dflt="$otherlibdirs" ;;
7085esac
7086$cat <<EOM
7087Enter a colon-separated set of extra paths to include in perl's @INC
7088search path, or enter 'none' for no extra paths.
7089
7090EOM
7091
7092rp='Colon-separated list of additional directories for perl to search?'
7093. ./myread
7094case "$ans" in
7095' '|''|none) otherlibdirs=' ' ;;
7096*) otherlibdirs="$ans" ;;
7097esac
7098case "$otherlibdirs" in
7099' ') val=$undef ;;
7100*) val=$define ;;
7101esac
7102set d_perl_otherlibdirs
7103eval $setvar
7104
7105: Cruising for prototypes
7106echo " "
7107echo "Checking out function prototypes..." >&4
7108$cat >prototype.c <<'EOCP'
7109int main(int argc, char *argv[]) {
7110 exit(0);}
7111EOCP
7112if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7113 echo "Your C compiler appears to support function prototypes."
7114 val="$define"
7115else
7116 echo "Your C compiler doesn't seem to understand function prototypes."
7117 val="$undef"
7118fi
7119set prototype
7120eval $setvar
7121$rm -f prototype*
7122
7123case "$prototype" in
7124"$define") ;;
7125*) ansi2knr='ansi2knr'
7126 echo " "
7127 cat <<EOM >&4
7128
7129$me: FATAL ERROR:
7130This version of $package can only be compiled by a compiler that
7131understands function prototypes. Unfortunately, your C compiler
7132 $cc $ccflags
7133doesn't seem to understand them. Sorry about that.
7134
7135If GNU cc is available for your system, perhaps you could try that instead.
7136
7137Eventually, we hope to support building Perl with pre-ANSI compilers.
7138If you would like to help in that effort, please contact <perlbug@perl.org>.
7139
7140Aborting Configure now.
7141EOM
7142 exit 2
7143 ;;
7144esac
7145
7146: determine where public executables go
7147echo " "
7148set dflt bin bin
7149eval $prefixit
7150fn=d~
7151rp='Pathname where the public executables will reside?'
7152. ./getfile
7153if $test "X$ansexp" != "X$binexp"; then
7154 installbin=''
7155fi
7156bin="$ans"
7157binexp="$ansexp"
7158: Change installation prefix, if necessary.
7159: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7160if $test X"$prefix" != X"$installprefix"; then
7161 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7162else
7163 installbin="$binexp"
7164fi
7165
6fcddf3b 7166echo " "
6fcddf3b 7167case "$extras" in
bf35c3f6
JH
7168'') dflt='n';;
7169*) dflt='y';;
6fcddf3b
JH
7170esac
7171cat <<EOM
7172Perl can be built with extra modules or bundles of modules which
7173will be fetched from the CPAN and installed alongside Perl.
7174
7175Notice that you will need access to the CPAN; either via the Internet,
7176or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7177be asked later to configure the CPAN.pm module which will in turn do
7178the installation of the rest of the extra modules or bundles.)
7179
7180Notice also that if the modules require any external software such as
dd2de242
JH
7181libraries and headers (the libz library and the zlib.h header for the
7182Compress::Zlib module, for example) you MUST have any such software
7183already installed, this configuration process will NOT install such
7184things for you.
6fcddf3b
JH
7185
7186If this doesn't make any sense to you, just accept the default '$dflt'.
7187EOM
dd2de242 7188rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7189. ./myread
7190case "$ans" in
7191y|Y)
7192 cat <<EOM
7193
7194Please list any extra modules or bundles to be installed from CPAN,
7195with spaces between the names. The names can be in any format the
dd2de242
JH
7196'install' command of CPAN.pm will understand. (Answer 'none',
7197without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7198EOM
7199 rp='Extras?'
7200 dflt="$extras"
7201 . ./myread
7202 extras="$ans"
7203esac
7204case "$extras" in
7205''|'none')
7206 val=''
7207 $rm -f ../extras.lst
7208 ;;
7209*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7210 echo "$extras" > ../extras.lst
7211 val="'$extras'"
6fcddf3b
JH
7212 ;;
7213esac
7214set extras
7215eval $setvar
7216echo " "
7217
b4eb6b3d
JH
7218: Find perl5.005 or later.
7219echo "Looking for a previously installed perl5.005 or later... "
7220case "$perl5" in
a938a3bb 7221'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 7222 : Check if this perl is recent and can load a simple module
a938a3bb 7223 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
7224 perl5=$tdir/perl
7225 break;
a938a3bb
IZ
7226 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7227 perl5=$tdir/perl5
b4eb6b3d
JH
7228 break;
7229 fi
7230 done
7231 ;;
7232*) perl5="$perl5"
7233 ;;
7234esac
7235case "$perl5" in
7236'') echo "None found. That's ok.";;
7237*) echo "Using $perl5." ;;
7238esac
7239
7240: Determine list of previous versions to include in @INC
7241$cat > getverlist <<EOPL
7242#!$perl5 -w
7243use File::Basename;
7244\$api_versionstring = "$api_versionstring";
7245\$version = "$version";
7246\$stem = "$sitelib_stem";
7247\$archname = "$archname";
7248EOPL
7249 $cat >> getverlist <<'EOPL'
7250# Can't have leading @ because metaconfig interprets it as a command!
7251;@inc_version_list=();
7252# XXX Redo to do opendir/readdir?
7253if (-d $stem) {
7254 chdir($stem);
7255 ;@candidates = glob("5.*");
7256}
7257else {
7258 ;@candidates = ();
7259}
7260
7261# XXX ToDo: These comparisons must be reworked when two-digit
7262# subversions come along, so that 5.7.10 compares as greater than
7263# 5.7.3! By that time, hope that 5.6.x is sufficiently
7264# widespread that we can use the built-in version vectors rather
7265# than reinventing them here. For 5.6.0, however, we must
7266# assume this script will likely be run by 5.005_0x. --AD 1/2000.
7267foreach $d (@candidates) {
7268 if ($d lt $version) {
7269 if ($d ge $api_versionstring) {
7270 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7271 }
7272 elsif ($d ge "5.005") {
7273 unshift(@inc_version_list, grep { -d } $d);
7274 }
7275 }
7276 else {
7277 # Skip newer version. I.e. don't look in
7278 # 5.7.0 if we're installing 5.6.1.
7279 }
7280}
7281
7282if (@inc_version_list) {
7283 print join(' ', @inc_version_list);
7284}
7285else {
7286 # Blank space to preserve value for next Configure run.
7287 print " ";
7288}
7289EOPL
7290chmod +x getverlist
7291case "$inc_version_list" in
a938a3bb 7292'') if test -x "$perl5$exe_ext"; then
b4eb6b3d
JH
7293 dflt=`$perl5 getverlist`
7294 else
7295 dflt='none'
7296 fi
7297 ;;
7298$undef) dflt='none' ;;
6d1a7737 7299*) eval dflt=\"$inc_version_list\" ;;
b4eb6b3d
JH
7300esac
7301case "$dflt" in
7302''|' ') dflt=none ;;
7303esac
7304case "$dflt" in
d953f698 73055.005) dflt=none ;;
b4eb6b3d
JH
7306esac
7307$cat <<'EOM'
7308
7309In order to ease the process of upgrading, this version of perl
7310can be configured to use modules built and installed with earlier
7311versions of perl that were installed under $prefix. Specify here
7312the list of earlier versions that this version of perl should check.
7313If Configure detected no earlier versions of perl installed under
7314$prefix, then the list will be empty. Answer 'none' to tell perl
7315to not search earlier versions.
7316
7317The default should almost always be sensible, so if you're not sure,
7318just accept the default.
7319EOM
7320
7321rp='List of earlier versions to include in @INC?'
7322. ./myread
7323case "$ans" in
7324[Nn]one|''|' ') inc_version_list=' ' ;;
7325*) inc_version_list="$ans" ;;
7326esac
7327case "$inc_version_list" in
7328''|' ')
7329 inc_version_list_init='0';;
7330*) inc_version_list_init=`echo $inc_version_list |
7331 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7332 ;;
7333esac
7334$rm -f getverlist
7335
7336: determine whether to install perl also as /usr/bin/perl
7337
7338echo " "
7339if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7340 $cat <<EOM
7341Many scripts expect perl to be installed as /usr/bin/perl.
7342I can install the perl you are about to compile also as /usr/bin/perl
7343(in addition to $installbin/perl).
7344EOM
7345 case "$installusrbinperl" in
7346 "$undef"|[nN]*) dflt='n';;
7347 *) dflt='y';;
7348 esac
7349 rp="Do you want to install perl as /usr/bin/perl?"
7350 . ./myread
7351 case "$ans" in
7352 [yY]*) val="$define";;
7353 *) val="$undef" ;;
7354 esac
7355else
7356 val="$undef"
7357fi
7358set installusrbinperl
7359eval $setvar
7360
7361: see if dld is available
7362set dld.h i_dld
7363eval $inhdr
7364
7365: see if dlopen exists
7366xxx_runnm="$runnm"
7367runnm=false
7368set dlopen d_dlopen
7369eval $inlibc
7370runnm="$xxx_runnm"
7371
7372: determine which dynamic loading, if any, to compile in
7373echo " "
7374dldir="ext/DynaLoader"
7375case "$usedl" in
7376$define|y|true)
7377 dflt='y'
7378 usedl="$define"
7379 ;;
7380$undef|n|false)
7381 dflt='n'
7382 usedl="$undef"
7383 ;;
7384*)
7385 dflt='n'
7386 case "$d_dlopen" in
7387 $define) dflt='y' ;;
7388 esac
7389 case "$i_dld" in
7390 $define) dflt='y' ;;
7391 esac
7392 : Does a dl_xxx.xs file exist for this operating system
7393 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7394 ;;
7395esac
7396rp="Do you wish to use dynamic loading?"
7397. ./myread
7398usedl="$ans"
7399case "$ans" in
7400y*) usedl="$define"
7401 case "$dlsrc" in
7402 '')
7403 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7404 dflt="$dldir/dl_${osname}.xs"
7405 elif $test "$d_dlopen" = "$define" ; then
7406 dflt="$dldir/dl_dlopen.xs"
7407 elif $test "$i_dld" = "$define" ; then
7408 dflt="$dldir/dl_dld.xs"
7409 else
7410 dflt=''
7411 fi
7412 ;;
7413 *) dflt="$dldir/$dlsrc"
7414 ;;
7415 esac
7416 echo "The following dynamic loading files are available:"
7417 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7418 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7419 rp="Source file to use for dynamic loading"
7420 fn="fne"
7421 gfpth="$src"
7422 . ./getfile
7423 usedl="$define"
7424 : emulate basename
7425 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7426
7427 $cat << EOM
7428
7429Some systems may require passing special flags to $cc -c to
7430compile modules that will be used to create a shared library.
7431To use no flags, say "none".
7432
7433EOM
7434 case "$cccdlflags" in
7435 '') case "$gccversion" in
7436 '') case "$osname" in
7437 hpux) dflt='+z' ;;
7438 next) dflt='none' ;;
7439 irix*) dflt='-KPIC' ;;
48bcfe03 7440 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7441 sunos) dflt='-pic' ;;
7442 *) dflt='none' ;;
7443 esac
7444 ;;
7445 *) case "$osname" in
b6cc0f4c 7446 darwin) dflt='none' ;;
48bcfe03 7447 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7448 *) dflt='-fpic' ;;
7449 esac ;;
7450 esac ;;
7451 ' ') dflt='none' ;;
7452 *) dflt="$cccdlflags" ;;
7453 esac
7454 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7455 . ./myread
7456 case "$ans" in
7457 none) cccdlflags=' ' ;;
7458 *) cccdlflags="$ans" ;;
7459 esac
7460
7461 cat << EOM
7462
7463Some systems use ld to create libraries that can be dynamically loaded,
7464while other systems (such as those using ELF) use $cc.
7465
7466EOM
7467 case "$ld" in
7468 '') $cat >try.c <<'EOM'
7469/* Test for whether ELF binaries are produced */
7470#include <fcntl.h>
7471#include <stdlib.h>
7472int main() {
7473 char b[4];
7474 int i = open("a.out",O_RDONLY);
7475 if(i == -1)
7476 exit(1); /* fail */
7477 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7478 exit(0); /* succeed (yes, it's ELF) */
7479 else
7480 exit(1); /* fail */
7481}
7482EOM
5440bc8e 7483 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7484 cat <<EOM
7485You appear to have ELF support. I'll use $cc to build dynamic libraries.
7486EOM
7487 dflt="$cc"
7488 else
7489 echo "I'll use ld to build dynamic libraries."
7490 dflt='ld'
7491 fi
7492 rm -f try.c a.out
7493 ;;
7494 *) dflt="$ld"
7495 ;;
7496 esac
7497
7498 rp="What command should be used to create dynamic libraries?"
7499 . ./myread
7500 ld="$ans"
7501
7502 cat << EOM
7503
7504Some systems may require passing special flags to $ld to create a
7505library that can be dynamically loaded. If your ld flags include
7506-L/other/path options to locate libraries outside your loader's normal
7507search path, you may need to specify those -L options here as well. To
7508use no flags, say "none".
7509
7510EOM
7511 case "$lddlflags" in
7512 '') case "$osname" in
7513 beos) dflt='-nostart' ;;
7514 hpux) dflt='-b';
7515 case "$gccversion" in
7516 '') dflt="$dflt +vnocompatwarnings" ;;
7517 esac
7518 ;;
7519 linux|irix*) dflt='-shared' ;;
7520 next) dflt='none' ;;
7521 solaris) dflt='-G' ;;
7522 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7523 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7524 *) dflt='none' ;;
7525 esac
7526 ;;
7527 *) dflt="$lddlflags" ;;
7528 esac
7529
7530 : Try to guess additional flags to pick up local libraries.
7531 : Be careful not to append to a plain 'none'
7532 case "$dflt" in
7533 none) dflt='' ;;
7534 esac
7535 for thisflag in $ldflags; do
7536 case "$thisflag" in
b5b9f165 7537 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7538 case " $dflt " in
7539 *" $thisflag "*) ;;
7540 *) dflt="$dflt $thisflag" ;;
7541 esac
7542 ;;
7543 esac
7544 done
7545
7546 case "$dflt" in
7547 ''|' ') dflt='none' ;;
7548 esac
7549
7550 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7551 . ./myread
7552 case "$ans" in
7553 none) lddlflags=' ' ;;
7554 *) lddlflags="$ans" ;;
7555 esac
7556
7557 cat <<EOM
7558
7559Some systems may require passing special flags to $cc to indicate that
7560the resulting executable will use dynamic linking. To use no flags,
7561say "none".
7562
7563EOM
7564 case "$ccdlflags" in
7565 '') case "$osname" in
7566 hpux) dflt='-Wl,-E' ;;
7567 linux) dflt='-rdynamic' ;;
7568 next) dflt='none' ;;
7569 sunos) dflt='none' ;;
7570 *) dflt='none' ;;
7571 esac ;;
7572 ' ') dflt='none' ;;
7573 *) dflt="$ccdlflags" ;;
7574 esac
7575 rp="Any special flags to pass to $cc to use dynamic linking?"
7576 . ./myread
7577 case "$ans" in
7578 none) ccdlflags=' ' ;;
7579 *) ccdlflags="$ans" ;;
7580 esac
7581 ;;
7582*) usedl="$undef"
7583 ld='ld'
7584 dlsrc='dl_none.xs'
7585 lddlflags=''
7586 ccdlflags=''
7587 ;;
7588esac
7589
7590also=''
7591case "$usedl" in
7592$undef)
7593 # No dynamic loading being used, so don't bother even to prompt.
7594 useshrplib='false'
7595 ;;
7596*) case "$useshrplib" in
7597 '') case "$osname" in
48bcfe03 7598 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7599 dflt=y
7600 also='Building a shared libperl is required for dynamic loading to work on your system.'
7601 ;;
7602 next*)
7603 case "$osvers" in
7604 4*) dflt=y
7605 also='Building a shared libperl is needed for MAB support.'
7606 ;;
7607 *) dflt=n
7608 ;;
7609 esac
7610 ;;
7611 *) dflt=n
7612 ;;
7613 esac
7614 ;;
7615 $define|true|[Yy]*)
7616 dflt=y
7617 ;;
7618 *) dflt=n
7619 ;;
7620 esac
7621 $cat << EOM
7622
7623The perl executable is normally obtained by linking perlmain.c with
7624libperl${_a}, any static extensions (usually just DynaLoader), and
7625any other libraries needed on this system (such as -lm, etc.). Since
7626your system supports dynamic loading, it is probably possible to build
7627a shared libperl.$so. If you will have more than one executable linked
7628to libperl.$so, this will significantly reduce the size of each
7629executable, but it may have a noticeable affect on performance. The
7630default is probably sensible for your system.
7631$also
7632
7633EOM
7634 rp="Build a shared libperl.$so (y/n)"
7635 . ./myread
7636 case "$ans" in
7637 true|$define|[Yy]*)
7638 useshrplib='true' ;;
7639 *) useshrplib='false' ;;
7640 esac
7641 ;;
7642esac
7643
7644case "$useshrplib" in
7645true)
7646 case "$libperl" in
7647 '')
7648 # Figure out a good name for libperl.so. Since it gets stored in
7649 # a version-specific architecture-dependent library, the version
7650 # number isn't really that important, except for making cc/ld happy.
7651 #
7652 # A name such as libperl.so.3.1
7653 majmin="libperl.$so.$patchlevel.$subversion"
7654 # A name such as libperl.so.301
7655 majonly=`echo $patchlevel $subversion |
7656 $awk '{printf "%d%02d", $1, $2}'`
7657 majonly=libperl.$so.$majonly
7658 # I'd prefer to keep the os-specific stuff here to a minimum, and
7659 # rely on figuring it out from the naming of libc.
7660 case "${osname}${osvers}" in
7661 next4*)
7662 dflt=libperl.5.$so
7663 # XXX How handle the --version stuff for MAB?
7664 ;;
7665 linux*) # ld won't link with a bare -lperl otherwise.
7666 dflt=libperl.$so
7667 ;;
b53432e4
GH
7668 cygwin*) # ld links against an importlib
7669 dflt=libperl$lib_ext
b4eb6b3d
JH
7670 ;;
7671 *) # Try to guess based on whether libc has major.minor.
7672 case "$libc" in
7673 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7674 *libc.$so.[0-9]*) dflt=$majonly ;;
7675 *) dflt=libperl.$so ;;
7676 esac
7677 ;;
7678 esac
7679 ;;
7680 *) dflt=$libperl
7681 ;;
7682 esac
7683 cat << EOM
7684
7685I need to select a good name for the shared libperl. If your system uses
7686library names with major and minor numbers, then you might want something
7687like $majmin. Alternatively, if your system uses a single version
7688number for shared libraries, then you might want to use $majonly.
7689Or, your system might be quite happy with a simple libperl.$so.
7690
7691Since the shared libperl will get installed into a version-specific
7692architecture-dependent directory, the version number of the shared perl
7693library probably isn't important, so the default should be o.k.
7694
7695EOM
7696 rp='What name do you want to give to the shared libperl?'
7697 . ./myread
7698 libperl=$ans
7699 echo "Ok, I'll use $libperl"
7700 ;;
7701*)
7702 libperl="libperl${_a}"
7703 ;;
7704esac
7705
7706# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7707case "$shrpdir" in
7708'') ;;
7709*) $cat >&4 <<EOM
7710WARNING: Use of the shrpdir variable for the installation location of
7711the shared $libperl is not supported. It was never documented and
7712will not work in this version. Let me (perlbug@perl.org)
7713know of any problems this may cause.
7714
7715EOM
7716 case "$shrpdir" in
7717 "$archlibexp/CORE")
7718 $cat >&4 <<EOM
7719But your current setting of $shrpdir is
7720the default anyway, so it's harmless.
7721EOM
7722 ;;
7723 *)
7724 $cat >&4 <<EOM
7725Further, your current attempted setting of $shrpdir
7726conflicts with the value of $archlibexp/CORE
7727that installperl will use.
7728EOM
7729 ;;
7730 esac
7731 ;;
7732esac
7733
7734# How will the perl executable find the installed shared $libperl?
7735# Add $xxx to ccdlflags.
7736# If we can't figure out a command-line option, use $shrpenv to
7737# set env LD_RUN_PATH. The main perl makefile uses this.
7738shrpdir=$archlibexp/CORE
7739xxx=''
7740tmp_shrpenv=''
7741if "$useshrplib"; then
7742 case "$osname" in
7743 aix)
7744 # We'll set it in Makefile.SH...
7745 ;;
b5b9f165 7746 solaris)
b4eb6b3d
JH
7747 xxx="-R $shrpdir"
7748 ;;
b5b9f165 7749 freebsd|netbsd)
b4eb6b3d
JH
7750 xxx="-Wl,-R$shrpdir"
7751 ;;
6b20d41b 7752 bsdos|linux|irix*|dec_osf)
b4eb6b3d
JH
7753 xxx="-Wl,-rpath,$shrpdir"
7754 ;;
7755 next)
7756 # next doesn't like the default...
7757 ;;
7758 beos)
7759 # beos doesn't like the default, either.
7760 ;;
7761 hpux*)
7762 # hpux doesn't like the default, either.
7763 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7764 ;;
7765 *)
7766 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7767 ;;
7768 esac
7769 case "$xxx" in
7770 '') ;;
7771 *)
7772 # Only add $xxx if it isn't already in ccdlflags.
7773 case " $ccdlflags " in
7774 *" $xxx "*) ;;
7775 *) ccdlflags="$ccdlflags $xxx"
7776 cat <<EOM >&4
7777
7778Adding $xxx to the flags
7779passed to $ld so that the perl executable will find the
7780installed shared $libperl.
7781
7782EOM
7783 ;;
7784 esac
7785 ;;
7786 esac
7787fi
7788# Fix ccdlflags in AIX for building external extensions.
7789# (For building Perl itself bare -bE:perl.exp is needed,
7790# Makefile.SH takes care of this.)
7791case "$osname" in
7792aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7793esac
7794# Respect a hint or command-line value.
7795case "$shrpenv" in
7796'') shrpenv="$tmp_shrpenv" ;;
7797esac
7798case "$ldlibpthname" in
7799'') ldlibpthname=LD_LIBRARY_PATH ;;
7800none) ldlibpthname='' ;;
7801esac
7802
7803: determine where manual pages are on this system
7804echo " "
7805case "$sysman" in
7806'')
4a0a3829
SD
7807 syspath='/usr/share/man/man1 /usr/man/man1'
7808 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7809 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7810 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7811 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7812 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7813 sysman=`./loc . /usr/man/man1 $syspath`
7814 ;;
7815esac
7816if $test -d "$sysman"; then
7817 echo "System manual is in $sysman." >&4
7818else
7819 echo "Could not find manual pages in source form." >&4
7820fi
7821
7822: determine where manual pages go
7823set man1dir man1dir none
7824eval $prefixit
7825$cat <<EOM
7826
7827$spackage has manual pages available in source form.
7828EOM
7829case "$nroff" in
7830nroff)
7831 echo "However, you don't have nroff, so they're probably useless to you."
7832 case "$man1dir" in
7833 '') man1dir="none";;
7834 esac;;
7835esac
7836echo "If you don't want the manual sources installed, answer 'none'."
7837case "$man1dir" in
7838' ') dflt=none
7839 ;;
7840'')
4a0a3829
SD
7841 lookpath="$prefixexp/share/man/man1"
7842 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7843 lookpath="$lookpath $prefixexp/man/p_man/man1"
7844 lookpath="$lookpath $prefixexp/man/u_man/man1"
7845 lookpath="$lookpath $prefixexp/man/man.1"
7846 case "$sysman" in
7847 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7848 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7849 esac
7850 set dflt
7851 eval $prefixup
7852 ;;
7853*) dflt="$man1dir"
7854 ;;
7855esac
7856echo " "
7857fn=dn+~
7858rp="Where do the main $spackage manual pages (source) go?"
7859. ./getfile
7860if $test "X$man1direxp" != "X$ansexp"; then
7861 installman1dir=''
7862fi
7863man1dir="$ans"
7864man1direxp="$ansexp"
7865case "$man1dir" in
7866'') man1dir=' '
7867 installman1dir='';;
7868esac
7869
7870: Change installation prefix, if necessary.
7871if $test X"$prefix" != X"$installprefix"; then
7872 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7873else
7874 installman1dir="$man1direxp"
7875fi
7876
7877: What suffix to use on installed man pages
7878
7879case "$man1dir" in
7880' ')
7881 man1ext='0'
7882 ;;
7883*)
7884 rp="What suffix should be used for the main $spackage man pages?"
7885 case "$man1ext" in
7886 '') case "$man1dir" in
7887 *1) dflt=1 ;;
7888 *1p) dflt=1p ;;
7889 *1pm) dflt=1pm ;;
7890 *l) dflt=l;;
7891 *n) dflt=n;;
7892 *o) dflt=o;;
7893 *p) dflt=p;;
7894 *C) dflt=C;;
7895 *L) dflt=L;;
7896 *L1) dflt=L1;;
7897 *) dflt=1;;
7898 esac
7899 ;;
7900 *) dflt="$man1ext";;
7901 esac
7902 . ./myread
7903 man1ext="$ans"
7904 ;;
7905esac
7906
7907: see if we can have long filenames
7908echo " "
7909first=123456789abcdef
7910$rm -f $first
7911if (echo hi >$first) 2>/dev/null; then
7912 if $test -f 123456789abcde; then
7913 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7914 val="$undef"
7915 else
7916 echo 'You can have filenames longer than 14 characters.'>&4
7917 val="$define"
7918 fi
7919else
7920 $cat <<'EOM'
7921You can't have filenames longer than 14 chars.
7922You can't even think about them!
7923EOM
7924 val="$undef"
7925fi
7926set d_flexfnam
7927eval $setvar
7928$rm -rf 123456789abcde*
7929
7930: determine where library module manual pages go
7931set man3dir man3dir none
7932eval $prefixit
7933$cat <<EOM
7934
7935$spackage has manual pages for many of the library modules.
7936EOM
7937
7938case "$nroff" in
7939nroff)
7940 $cat <<'EOM'
7941However, you don't have nroff, so they're probably useless to you.
7942EOM
7943 case "$man3dir" in
7944 '') man3dir="none";;
7945 esac;;
7946esac
7947
7948case "$d_flexfnam" in
7949undef)
7950 $cat <<'EOM'
7951However, your system can't handle the long file names like File::Basename.3.
7952EOM
7953 case "$man3dir" in
7954 '') man3dir="none";;
7955 esac;;
7956esac
7957
7958echo "If you don't want the manual sources installed, answer 'none'."
7959prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7960case "$man3dir" in
7961'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7962 if $test -d "$privlib/man/man3"; then
7963 cat <<EOM >&4
7964
7965WARNING: Previous versions of perl installed man3 pages into
7966$privlib/man/man3. This version will suggest a
7967new default of $dflt.
7968EOM
7969 tdflt=$dflt
7970 dflt='n'
7971 rp='Do you wish to preserve the old behavior?(y/n)'
7972 . ./myread
7973 case "$ans" in
7974 y*) dflt="$privlib/man/man3" ;;
7975 *) dflt=$tdflt ;;
7976 esac
7977 fi
7978 ;;
7979*) dflt="$man3dir" ;;
7980esac
7981case "$dflt" in
7982' ') dflt=none ;;
7983esac
7984echo " "
7985fn=dn+~
7986rp="Where do the $package library man pages (source) go?"
7987. ./getfile
7988man3dir="$ans"
7989man3direxp="$ansexp"
7990case "$man3dir" in
7991'') man3dir=' '
7992 installman3dir='';;
7993esac
7994
7995: Change installation prefix, if necessary.
7996if $test X"$prefix" != X"$installprefix"; then
7997 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7998else
7999 installman3dir="$man3direxp"
8000fi
8001
8002: What suffix to use on installed man pages
8003case "$man3dir" in
8004' ')
8005 man3ext='0'
8006 ;;
8007*)
8008 rp="What suffix should be used for the $package library man pages?"
8009 case "$man3ext" in
8010 '') case "$man3dir" in
8011 *3) dflt=3 ;;
8012 *3p) dflt=3p ;;
8013 *3pm) dflt=3pm ;;
8014 *l) dflt=l;;
8015 *n) dflt=n;;
8016 *o) dflt=o;;
8017 *p) dflt=p;;
8018 *C) dflt=C;;
8019 *L) dflt=L;;
8020 *L3) dflt=L3;;
8021 *) dflt=3;;
8022 esac
8023 ;;
8024 *) dflt="$man3ext";;
8025 esac
8026 . ./myread
8027 man3ext="$ans"
8028 ;;
8029esac
8030
8031: see if we have to deal with yellow pages, now NIS.
0384a54a 8032if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8033 if $test -f /usr/etc/nibindd; then
8034 echo " "
8035 echo "I'm fairly confident you're on a NeXT."
8036 echo " "
8037 rp='Do you get the hosts file via NetInfo?'
8038 dflt=y
8039 case "$hostcat" in
8040 nidump*) ;;
8041 '') ;;
8042 *) dflt=n;;
8043 esac
8044 . ./myread
8045 case "$ans" in
8046 y*) hostcat='nidump hosts .';;
8047 *) case "$hostcat" in
8048 nidump*) hostcat='';;
8049 esac
8050 ;;
8051 esac
8052 fi
8053 case "$hostcat" in
8054 nidump*) ;;
8055 *)
8056 case "$hostcat" in
8057 *ypcat*) dflt=y;;
8058 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8059 dflt=y
8060 else
8061 dflt=n
8062 fi;;
8063 *) dflt=n;;
8064 esac
8065 echo " "
8066 rp='Are you getting the hosts file via yellow pages?'
8067 . ./myread
8068 case "$ans" in
8069 y*) hostcat='ypcat hosts';;
8070 *) hostcat='cat /etc/hosts';;
8071 esac
8072 ;;
8073 esac
8074fi
8075case "$hostcat" in
8076'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8077esac
8078case "$groupcat" in
8079'') test -f /etc/group && groupcat='cat /etc/group';;
8080esac
8081case "$passcat" in
8082'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8083esac
8084
8085: now get the host name
8086echo " "
8087echo "Figuring out host name..." >&4
8088case "$myhostname" in
8089'') cont=true
8090 echo 'Maybe "hostname" will work...'
73614538 8091 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8092 myhostname=$tans
8093 phostname=hostname
8094 cont=''
8095 fi
8096 ;;
8097*) cont='';;
8098esac
8099if $test "$cont"; then
8100 if ./xenix; then
8101 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8102 if tans=`cat /etc/systemid 2>&1` ; then
8103 myhostname=$tans
8104 phostname='cat /etc/systemid'
8105 echo "Whadyaknow. Xenix always was a bit strange..."
8106 cont=''
8107 fi
8108 elif $test -r /etc/systemid; then
8109 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8110 fi
8111fi
8112if $test "$cont"; then
8113 echo 'No, maybe "uuname -l" will work...'
73614538 8114 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8115 myhostname=$tans
8116 phostname='uuname -l'
8117 else
8118 echo 'Strange. Maybe "uname -n" will work...'
73614538 8119 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8120 myhostname=$tans
8121 phostname='uname -n'
8122 else
8123 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8124 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8125 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8126 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8127 else
8128 case "$myhostname" in
8129 '') echo "Does this machine have an identity crisis or something?"
8130 phostname='';;
8131 *)
8132 echo "Well, you said $myhostname before..."
8133 phostname='echo $myhostname';;
8134 esac
8135 fi
8136 fi
8137 fi
8138fi
52a549d0
JH
8139case "$myhostname" in
8140'') myhostname=noname ;;
8141esac
b4eb6b3d
JH
8142: you do not want to know about this
8143set $myhostname
8144myhostname=$1
8145
8146: verify guess
8147if $test "$myhostname" ; then
8148 dflt=y
8149 rp='Your host name appears to be "'$myhostname'".'" Right?"
8150 . ./myread
8151 case "$ans" in
8152 y*) ;;
8153 *) myhostname='';;
8154 esac
8155fi
8156
8157: bad guess or no guess
8158while $test "X$myhostname" = X ; do
8159 dflt=''
8160 rp="Please type the (one word) name of your host:"
8161 . ./myread
8162 myhostname="$ans"
8163done
8164
8165: translate upper to lower if necessary
8166case "$myhostname" in
8167*[A-Z]*)
8168 echo "(Normalizing case in your host name)"
8169 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8170 ;;
8171esac
8172
8173case "$myhostname" in
8174*.*)
8175 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8176 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8177 echo "(Trimming domain name from host name--host name is now $myhostname)"
8178 ;;
8179*) case "$mydomain" in
8180 '')
8181 {
8182 test "X$hostcat" = "Xypcat hosts" &&
8183 ypmatch "$myhostname" hosts 2>/dev/null |\
8184 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8185 $test -s hosts
8186 } || {
8187 test "X$hostcat" != "X" &&
8188 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8189 /[ ]$myhostname[ . ]/p" > hosts
8190 }
8191 tmp_re="[ . ]"
f08cbdd1
PP
8192 if $test -f hosts; then
8193 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8194 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8195 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8196 hosts | $sort | $uniq | \
8197 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8198 case `$echo X$dflt` in
8199 X*\ *) echo "(Several hosts in the database matched hostname)"
8200 dflt=.
8201 ;;
8202 X.) echo "(You do not have fully-qualified names in the hosts database)"
8203 ;;
8204 esac
8205 else
8206 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8207 dflt=.
f08cbdd1 8208 fi
b4eb6b3d
JH
8209 case "$dflt" in
8210 .)
8211 tans=`./loc resolv.conf X /etc /usr/etc`
8212 if $test -f "$tans"; then
8213 echo "(Attempting domain name extraction from $tans)"
8214 dflt=.`$sed -n -e 's/ / /g' \
8215 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8216 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8217 case "$dflt" in
8218 .) dflt=.`$sed -n -e 's/ / /g' \
8219 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8220 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8221 ;;
8222 esac
8223 fi
8224 ;;
8225 esac
8226 case "$dflt" in
8227 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8228 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8229 case "$dflt" in
8230 '') dflt='.';;
8231 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8232 esac
8233 ;;
8234 esac
59c9e5d6
PP
8235 case "$dflt$osname" in
8236 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8237 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8238 ;;
8239 esac
b4eb6b3d
JH
8240 case "$dflt" in
8241 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8242 dflt='.nonet'
b4eb6b3d
JH
8243 ;;
8244 esac
8245 $rm -f hosts
8246 ;;
8247 *) dflt="$mydomain";;
8248 esac;;
8249esac
8250echo " "
8251rp="What is your domain name?"
8252. ./myread
8253tans="$ans"
8254case "$ans" in
8255'') ;;
8256.*) ;;
8257*) tans=".$tans";;
8258esac
8259mydomain="$tans"
8260
8261: translate upper to lower if necessary
8262case "$mydomain" in
8263*[A-Z]*)
8264 echo "(Normalizing case in your domain name)"
8265 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8266 ;;
8267esac
8268
8269: a little sanity check here
8270case "$phostname" in
8271'') ;;
8272*)
8273 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8274 $myhostname$mydomain|$myhostname) ;;
8275 *)
8276 case "$phostname" in
8277 sed*)
8278 echo "(That doesn't agree with your whoami.h file, by the way.)"
8279 ;;
8280 *)
8281 echo "(That doesn't agree with your $phostname command, by the way.)"
8282 ;;
8283 esac
8284 ;;
8285 esac
8286 ;;
8287esac
8288
8289$cat <<EOM
8290
8291I need to get your e-mail address in Internet format if possible, i.e.
8292something like user@host.domain. Please answer accurately since I have
8293no easy means to double check it. The default value provided below
8294is most probably close to reality but may not be valid from outside
8295your organization...
8296
8297EOM
8298cont=x
8299while test "$cont"; do
8300 case "$cf_email" in
8301 '') dflt="$cf_by@$myhostname$mydomain";;
8302 *) dflt="$cf_email";;
8303 esac
8304 rp='What is your e-mail address?'
8305 . ./myread
8306 cf_email="$ans"
8307 case "$cf_email" in
8308 *@*.*) cont='' ;;
8309 *)
8310 rp='Address does not look like an Internet one. Use it anyway?'
8311 case "$fastread" in
8312 yes) dflt=y ;;
8313 *) dflt=n ;;
8314 esac
8315 . ./myread
8316 case "$ans" in
8317 y*) cont='' ;;
8318 *) echo " " ;;
8319 esac
8320 ;;
8321 esac
8322done
8323
8324$cat <<EOM
8325
8326If you or somebody else will be maintaining perl at your site, please
8327fill in the correct e-mail address here so that they may be contacted
8328if necessary. Currently, the "perlbug" program included with perl
8329will send mail to this address in addition to perlbug@perl.org. You may
8330enter "none" for no administrator.
8331
8332EOM
8333case "$perladmin" in
8334'') dflt="$cf_email";;
8335*) dflt="$perladmin";;
8336esac
8337rp='Perl administrator e-mail address'
8338. ./myread
8339perladmin="$ans"
8340
674912d7
RB
8341: determine whether to only install version-specific parts.
8342echo " "
8343$cat <<EOM
8344Do you want to install only the version-specific parts of the perl
8345distribution? Usually you do *not* want to do this.
8346EOM
8347case "$versiononly" in
8348"$define"|[Yy]*|true) dflt='y' ;;
8349*) dflt='n';
8350esac
8351rp="Do you want to install only the version-specific parts of perl?"
8352. ./myread
8353case "$ans" in
8354[yY]*) val="$define";;
8355*) val="$undef" ;;
8356esac
8357set versiononly
8358eval $setvar
8359
ad493445
MB
8360case "$versiononly" in
8361"$define") inc_version_list=''
8362 inc_version_list_init=0
8363 ;;
8364esac
8365
b4eb6b3d
JH
8366: figure out how to guarantee perl startup
8367case "$startperl" in
8368'')
8369 case "$sharpbang" in
8370 *!)
8371 $cat <<EOH
8372
8373I can use the #! construct to start perl on your system. This will
8374make startup of perl scripts faster, but may cause problems if you
8375want to share those scripts and perl is not in a standard place
8376($binexp/perl) on all your platforms. The alternative is to force
8377a shell by starting the script with a single ':' character.
8378
8379EOH
674912d7
RB
8380 case "$versiononly" in
8381 "$define") dflt="$binexp/perl$version";;
8382 *) dflt="$binexp/perl";;
8383 esac
b4eb6b3d
JH
8384 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8385 . ./myread
8386 case "$ans" in
8387 none) startperl=": # use perl";;
8388 *) startperl="#!$ans"
8389 if $test 30 -lt `echo "$ans" | wc -c`; then
8390 $cat >&4 <<EOM
8391
8392WARNING: Some systems limit the #! command to 32 characters.
8393If you experience difficulty running Perl scripts with #!, try
8394installing Perl in a directory with a shorter pathname.
8395
8396EOM
8397 fi ;;
8398 esac
8399 ;;
8400 *) startperl=": # use perl"
8401 ;;
8402 esac
8403 ;;
8404esac
8405echo "I'll use $startperl to start perl scripts."
8406
8407: figure best path for perl in scripts
8408case "$perlpath" in
8409'')
5e20a8ca
RGS
8410 case "$versiononly" in
8411 "$define") perlpath="$binexp/perl$version";;
8412 *) perlpath="$binexp/perl";;
8413 esac
b4eb6b3d
JH
8414 case "$startperl" in
8415 *!*) ;;
8416 *)
8417 $cat <<EOH
8418
8419I will use the "eval 'exec'" idiom to start Perl on your system.
8420I can use the full path of your Perl binary for this purpose, but
8421doing so may cause problems if you want to share those scripts and
8422Perl is not always in a standard place ($binexp/perl).
8423
8424EOH
8425 dflt="$binexp/perl"
8426 rp="What path shall I use in \"eval 'exec'\"?"
8427 . ./myread
8428 perlpath="$ans"
8429 ;;
8430 esac
8431 ;;
8432esac
8433case "$startperl" in
8434*!*) ;;
8435*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8436esac
8437
8438: determine where public executable scripts go
8439set scriptdir scriptdir
8440eval $prefixit
8441case "$scriptdir" in
8442'')
8443 dflt="$bin"
8444 : guess some guesses
8445 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8446 $test -d /usr/share/bin && dflt=/usr/share/bin
8447 $test -d /usr/local/script && dflt=/usr/local/script
8448 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8449 $test -d $prefixexp/script && dflt=$prefixexp/script
8450 set dflt
8451 eval $prefixup
8452 ;;
8453*) dflt="$scriptdir"
8454 ;;
8455esac
8456$cat <<EOM
8457
8458Some installations have a separate directory just for executable scripts so
8459that they can mount it across multiple architectures but keep the scripts in
8460one spot. You might, for example, have a subdirectory of /usr/share for this.
8461Or you might just lump your scripts in with all your other executables.
8462
8463EOM
8464fn=d~
8465rp='Where do you keep publicly executable scripts?'
8466. ./getfile
8467if $test "X$ansexp" != "X$scriptdirexp"; then
8468 installscript=''
8469fi
8470scriptdir="$ans"
8471scriptdirexp="$ansexp"
8472: Change installation prefix, if necessary.
8473if $test X"$prefix" != X"$installprefix"; then
8474 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8475else
8476 installscript="$scriptdirexp"
8477fi
8478
8479: determine where add-on public executables go
8480case "$sitebin" in
8481'') dflt=$siteprefix/bin ;;
8482*) dflt=$sitebin ;;
8483esac
8484fn=d~
8485rp='Pathname where the add-on public executables should be installed?'
8486. ./getfile
8487sitebin="$ans"
8488sitebinexp="$ansexp"
8489: Change installation prefix, if necessary.
8490if $test X"$prefix" != X"$installprefix"; then
8491 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8492else
8493 installsitebin="$sitebinexp"
8494fi
8495
96056487
JH
8496: define an is-a-typedef? function
8497typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8498case "$inclist" in
8499"") inclist="sys/types.h";;
8500esac;
8501eval "varval=\$$var";
8502case "$varval" in
8503"")
8504 $rm -f temp.c;
8505 for inc in $inclist; do
8506 echo "#include <$inc>" >>temp.c;
8507 done;
8508 echo "#ifdef $type" >> temp.c;
8509 echo "printf(\"We have $type\");" >> temp.c;
8510 echo "#endif" >> temp.c;
8511 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8512 if $contains $type temp.E >/dev/null 2>&1; then
8513 eval "$var=\$type";
8514 else
8515 eval "$var=\$def";
8516 fi;
8517 $rm -f temp.?;;
8518*) eval "$var=\$varval";;
8519esac'
8520
8521: define an is-a-typedef? function that prompts if the type is not available.
8522typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8523case "$inclist" in
8524"") inclist="sys/types.h";;
8525esac;
8526eval "varval=\$$var";
8527case "$varval" in
8528"")
8529 $rm -f temp.c;
8530 for inc in $inclist; do
8531 echo "#include <$inc>" >>temp.c;
8532 done;
8533 echo "#ifdef $type" >> temp.c;
8534 echo "printf(\"We have $type\");" >> temp.c;
8535 echo "#endif" >> temp.c;
8536 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8537 echo " " ;
8538 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8539 if $contains $type temp.E >/dev/null 2>&1; then
8540 echo "$type found." >&4;
8541 eval "$var=\$type";
8542 else
8543 echo "$type NOT found." >&4;
8544 dflt="$def";
8545 . ./myread ;
8546 eval "$var=\$ans";
8547 fi;
8548 $rm -f temp.?;;
8549*) eval "$var=\$varval";;
8550esac'
8551
8552: see what type lseek is declared as in the kernel
8553rp="What is the type used for lseek's offset on this system?"
8554set off_t lseektype long stdio.h sys/types.h
8555eval $typedef_ask
8556
8557echo " "
8558echo "Checking to see how big your file offsets are..." >&4
8559$cat >try.c <<EOCP
8560#include <sys/types.h>
8561#include <stdio.h>
8562int main()
8563{
8564 printf("%d\n", (int)sizeof($lseektype));
8565 return(0);
8566}
8567EOCP
8568set try
8569if eval $compile_ok; then
8570 lseeksize=`$run ./try`
8571 echo "Your file offsets are $lseeksize bytes long."
8572else
8573 dflt=$longsize
8574 echo " "
8575 echo "(I can't seem to compile the test program. Guessing...)"
8576 rp="What is the size of your file offsets (in bytes)?"
8577 . ./myread
8578 lseeksize="$ans"
8579fi
8580$rm -f try.c try
8581
8582: see what type file positions are declared as in the library
8583rp="What is the type for file position used by fsetpos()?"
8584set fpos_t fpostype long stdio.h sys/types.h
8585eval $typedef_ask
8586
8587echo " "
8588case "$fpostype" in
8589*_t) zzz="$fpostype" ;;
8590*) zzz="fpos_t" ;;
8591esac
8592echo "Checking the size of $zzz..." >&4
8593cat > try.c <<EOCP
8594#include <sys/types.h>
8595#include <stdio.h>
8596int main() {
8597 printf("%d\n", (int)sizeof($fpostype));
8598 exit(0);
8599}
8600EOCP
8601set try
8602if eval $compile_ok; then
8603 yyy=`$run ./try`
8604 case "$yyy" in
8605 '') fpossize=4
8606 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8607 ;;
8608 *) fpossize=$yyy
8609 echo "Your $zzz is $fpossize bytes long."
8610 ;;
8611 esac
8612else
8613 dflt="$longsize"
8614 echo " " >&4
8615 echo "(I can't compile the test program. Guessing...)" >&4
8616 rp="What is the size of your file positions (in bytes)?"
8617 . ./myread
8618 fpossize="$ans"
8619fi
8620
8621
8622
8623# Backward compatibility (uselfs is deprecated).
8624case "$uselfs" in
8625"$define"|true|[yY]*)
8626 cat <<EOM >&4
8627
8628*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8629EOM
8630 uselargefiles="$define"
8631 ;;
8632esac
8633
8634case "$lseeksize:$fpossize" in
86358:8) cat <<EOM
8636
8637You can have files larger than 2 gigabytes.
8638EOM
8639 val="$define" ;;
8640*) case "$uselargefiles" in
8641 "$undef"|false|[nN]*) dflt='n' ;;
8642 *) dflt='y' ;;
8643 esac
8644 cat <<EOM
8645
8646Perl can be built to understand large files (files larger than 2 gigabytes)
8647on some systems. To do so, Configure can be run with -Duselargefiles.
8648
8649If this doesn't make any sense to you, just accept the default '$dflt'.
8650EOM
8651 rp='Try to understand large files, if available?'
8652 . ./myread
8653 case "$ans" in
8654 y|Y) val="$define" ;;
8655 *) val="$undef" ;;
8656 esac
8657 ;;
8658esac
8659set uselargefiles
8660eval $setvar
8661case "$uselargefiles" in
8662"$define")
8663: Look for a hint-file generated 'call-back-unit'. If the
8664: user has specified that a large files perl is to be built,
8665: we may need to set or change some other defaults.
8666 if $test -f uselargefiles.cbu; then
8667 echo "Your platform has some specific hints for large file builds, using them..."
8668 . ./uselargefiles.cbu
8669 echo " "
8670 echo "Rechecking to see how big your file offsets are..." >&4
8671 $cat >try.c <<EOCP
8672#include <sys/types.h>
8673#include <stdio.h>
8674int main()
8675{
8676 printf("%d\n", (int)sizeof($lseektype));
8677 return(0);
8678}
8679EOCP
8680 set try
8681 if eval $compile_ok; then
8682 lseeksize=`$run ./try`
8683 $echo "Your file offsets are now $lseeksize bytes long."
8684 else
8685 dflt="$lseeksize"
8686 echo " "
8687 echo "(I can't seem to compile the test program. Guessing...)"
8688 rp="What is the size of your file offsets (in bytes)?"
8689 . ./myread
8690 lseeksize="$ans"
8691 fi
8692 case "$fpostype" in
8693 *_t) zzz="$fpostype" ;;
8694 *) zzz="fpos_t" ;;
8695 esac
8696 $echo $n "Rechecking the size of $zzz...$c" >&4
8697 $cat > try.c <<EOCP
8698#include <sys/types.h>
8699#include <stdio.h>
8700int main() {
8701 printf("%d\n", (int)sizeof($fpostype));
8702 exit(0);
8703}
8704EOCP
8705 set try
8706 if eval $compile_ok; then
8707 yyy=`$run ./try`
8708 dflt="$lseeksize"
8709 case "$yyy" in
8710 '') echo " "
8711 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8712 ;;
8713 *) fpossize=$yyy
8714 echo " $fpossize bytes." >&4
8715 ;;
8716 esac
8717 else
8718 dflt="$fpossize"
8719 echo " "
8720 echo "(I can't compile the test program. Guessing...)" >&4
8721 rp="What is the size of your file positions (in bytes)?"
8722 . ./myread
8723 fpossize="$ans"
8724 fi
8725 $rm -f try.c try
8726 fi
8727 ;;
8728esac
8729
b4eb6b3d
JH
8730case "$vendorprefix" in
8731'') d_vendorbin="$undef"
8732 vendorbin=''
8733 vendorbinexp=''
8734 ;;
8735*) d_vendorbin="$define"
8736 : determine where vendor-supplied executables go.
8737 case "$vendorbin" in
8738 '') dflt=$vendorprefix/bin ;;
8739 *) dflt="$vendorbin" ;;
8740 esac
8741 fn=d~+
8742 rp='Pathname for the vendor-supplied executables directory?'
8743 . ./getfile
8744 vendorbin="$ans"
8745 vendorbinexp="$ansexp"
8746 ;;
8747esac
8748: Change installation prefix, if necessary.
8749if $test X"$prefix" != X"$installprefix"; then
8750 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8751else
8752 installvendorbin="$vendorbinexp"
8753fi
8754
8755: see if qgcvt exists
8756set qgcvt d_qgcvt
8757eval $inlibc
8758
b4eb6b3d 8759: Check how to convert floats to strings.
a5b10d80
YST
8760
8761if test "X$d_Gconvert" = X; then
8762
b4eb6b3d
JH
8763echo " "
8764echo "Checking for an efficient way to convert floats to strings."
8765echo " " > try.c
8766case "$uselongdouble" in
8767"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8768esac
8769case "$d_longdbl" in
8770"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8771esac
8772case "$d_PRIgldbl" in
8773"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
8774esac
8775$cat >>try.c <<EOP
8776#ifdef TRY_gconvert
8777#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8778char *myname = "gconvert";
8779#endif
8780#ifdef TRY_gcvt
8781#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8782char *myname = "gcvt";
8783#endif
8784#ifdef TRY_qgcvt
8785#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8786char *myname = "qgcvt";
8787#define DOUBLETYPE long double
8788#endif
8789#ifdef TRY_sprintf
a5b10d80
YST
8790#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8791#ifdef HAS_PRIgldbl
b4eb6b3d
JH
8792#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8793#else
a5b10d80
YST
8794#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8795#endif
8796#else
b4eb6b3d
JH
8797#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8798#endif
8799char *myname = "sprintf";
8800#endif
8801
8802#ifndef DOUBLETYPE
8803#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8804#define DOUBLETYPE long double
8805#else
8806#define DOUBLETYPE double
8807#endif
8808#endif
8809
8810#include <stdio.h>
8811
8812#define I_STDLIB $i_stdlib
8813#ifdef I_STDLIB
8814#include <stdlib.h>
8815#endif
8816
8817int
8818checkit(expect, got)
8819char *expect;
8820char *got;
8821{
8822 if (strcmp(expect, got)) {
8823 printf("%s oddity: Expected %s, got %s\n",
8824 myname, expect, got);
8825 exit(1);
8826 }
8827}
8828
8829int main()
8830{
8831 char buf[64];
8832 buf[63] = '\0';
8833
8834 /* This must be 1st test on (which?) platform */
8835 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8836 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8837 checkit("0.1", buf);
8838
a5b10d80
YST
8839 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
8840 checkit("0.01", buf);
8841
8842 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
8843 checkit("0.001", buf);
8844
8845 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
8846 checkit("0.0001", buf);
8847
8848 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8849 if (strlen(buf) > 5)
8850 checkit("9e-005", buf); /* for Microsoft ?? */
8851 else
8852 checkit("9e-05", buf);
8853
b4eb6b3d
JH
8854 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8855 checkit("1", buf);
8856
8857 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
8858 checkit("1.1", buf);
8859
8860 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
8861 checkit("1.01", buf);
8862
8863 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
8864 checkit("1.001", buf);
8865
8866 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
8867 checkit("1.0001", buf);
8868
8869 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
8870 checkit("1.00001", buf);
8871
8872 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
8873 checkit("1.000001", buf);
8874
8875 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8876 checkit("0", buf);
8877
8878 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8879 checkit("-1", buf);
8880
8881 /* Some Linux gcvt's give 1.e+5 here. */
8882 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8883 checkit("100000", buf);
8884
8885 /* Some Linux gcvt's give -1.e+5 here. */
8886 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8887 checkit("-100000", buf);
8888
8889 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
8890 checkit("123.456", buf);
8891
ab6ca9f4 8892 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
8893 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8894 /* 34 should be enough to scare even long double
8895 * places into using the e notation. */
ab6ca9f4 8896 if (strlen(buf) > 5)
94b339ad 8897 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 8898 else
94b339ad 8899 checkit("1e+34", buf);
8e2a5ede 8900
d1eb8299
YST
8901 /* For Perl, if you add additional tests here, also add them to
8902 * t/base/num.t for benefit of platforms not using Configure or
8903 * overriding d_Gconvert */
8904
b4eb6b3d
JH
8905 exit(0);
8906}
8907EOP
ab6ca9f4 8908: first add preferred functions to our list
a5b10d80 8909xxx_list=""
ab6ca9f4 8910for xxx_convert in $gconvert_preference; do
a5b10d80
YST
8911 case $xxx_convert in
8912 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 8913 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
8914 esac
8915done
8916: then add any others
8917for xxx_convert in gconvert gcvt sprintf; do
8918 case "$xxx_list" in
8919 *$xxx_convert*) ;;
8920 *) xxx_list="$xxx_list $xxx_convert" ;;
8921 esac
8922done
8923
8924case "$d_longdbl$uselongdouble" in
8925"$define$define")
8926 : again, add prefered functions to our list first
8927 xxx_ld_list=""
ab6ca9f4 8928 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
8929 case $xxx_convert in
8930 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 8931 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
8932 esac
8933 done
8934 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8935 for xxx_convert in qgcvt sprintf $xxx_list; do
8936 case "$xxx_ld_list" in
8937 $xxx_convert*|*" $xxx_convert"*) ;;
8938 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8939 esac
8940 done
8941 : if sprintf cannot do long doubles, move it to the end
8942 if test "$d_PRIgldbl" != "$define"; then
8943 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8944 fi
8945 : if no qgcvt, remove it
8946 if test "$d_qgcvt" != "$define"; then
8947 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8948 fi
8949 : use the ld_list
8950 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
8951 ;;
8952esac
8953
8954for xxx_convert in $xxx_list; do
8955 echo "Trying $xxx_convert..."
8956 $rm -f try try$_o
8957 set try -DTRY_$xxx_convert
8958 if eval $compile; then
8959 echo "$xxx_convert() found." >&4
5440bc8e 8960 if $run ./try; then
b4eb6b3d
JH
8961 echo "I'll use $xxx_convert to convert floats into a string." >&4
8962 break;
8963 else
8964 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 8965 xxx_convert=''
b4eb6b3d
JH
8966 fi
8967 else
8968 echo "$xxx_convert NOT found." >&4
8969 fi
8970done
ab6ca9f4 8971
a5b10d80
YST
8972if test X$xxx_convert = X; then
8973 echo "*** WHOA THERE!!! ***" >&4
8974 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
8975 xxx_convert=sprintf
8976fi
8977
b4eb6b3d
JH
8978case "$xxx_convert" in
8979gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8980gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8981qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8982*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8983 "$define$define$define")
8984 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
8985 "$define$define$undef")
8986 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
8987 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8988 esac
8989 ;;
8990esac
8991
a5b10d80
YST
8992fi
8993
74cac757
JH
8994: see if _fwalk exists
8995set fwalk d__fwalk
8996eval $inlibc
8997
b4eb6b3d
JH
8998: Initialize h_fcntl
8999h_fcntl=false
9000
9001: Initialize h_sysfile
9002h_sysfile=false
9003
9004: access call always available on UNIX
9005set access d_access
9006eval $inlibc
9007
9008: locate the flags for 'access()'
9009case "$d_access" in
9010"$define")
9011 echo " "
9012 $cat >access.c <<'EOCP'
9013#include <sys/types.h>
9014#ifdef I_FCNTL
9015#include <fcntl.h>
9016#endif
9017#ifdef I_SYS_FILE
9018#include <sys/file.h>
9019#endif
9020#ifdef I_UNISTD
9021#include <unistd.h>
9022#endif
9023int main() {
9024 exit(R_OK);
9025}
9026EOCP
9027 : check sys/file.h first, no particular reason here
9028 if $test `./findhdr sys/file.h` && \
7a282f6d 9029 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9030 h_sysfile=true;
9031 echo "<sys/file.h> defines the *_OK access constants." >&4
9032 elif $test `./findhdr fcntl.h` && \
7a282f6d 9033 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9034 h_fcntl=true;
9035 echo "<fcntl.h> defines the *_OK access constants." >&4
9036 elif $test `./findhdr unistd.h` && \
7a282f6d 9037 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9038 echo "<unistd.h> defines the *_OK access constants." >&4
9039 else
9040 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9041 fi
9042 ;;
9043esac
9044$rm -f access*
9045
9046: see if accessx exists
9047set accessx d_accessx
9048eval $inlibc
9049
9050: see if alarm exists
9051set alarm d_alarm
9052eval $inlibc
9053
a9dade78
JH
9054: see if POSIX threads are available
9055set pthread.h i_pthread
9056eval $inhdr
9057
10bc17b6
JH
9058: define a fucntion to check prototypes
9059$cat > protochk <<EOSH
9060$startsh
9061cc="$cc"
9062optimize="$optimize"
9063ccflags="$ccflags"
9064prototype="$prototype"
9065define="$define"
9066rm=$rm
a9dade78
JH
9067usethreads=$usethreads
9068i_pthread=$i_pthread
9069pthread_h_first=$pthread_h_first
10bc17b6
JH
9070EOSH
9071
9072$cat >> protochk <<'EOSH'
9073
9074$rm -f try.c
9075foo="$1"
9076shift
9077while test $# -ge 2; do
9078 case "$1" in
9079 $define) echo "#include <$2>" >> try.c ;;
9080 literal) echo "$2" >> try.c ;;
9081 esac
cce6a207
MB
9082 # Extra magic for the benefit of systems that need pthread.h
9083 # to be included early to correctly detect threadsafe functions.
9084 # Such functions must guarantee themselves, though, that the usethreads
9085 # and i_pthread have been defined, before calling protochk.
9086 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9087 echo "#include <pthread.h>" >> try.c
9088 pthread_h_done=yes
9089 fi
10bc17b6
JH
9090 shift 2
9091done
9092test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9093cat >> try.c <<'EOCP'
9094#ifdef CAN_PROTOTYPE
9095#define _(args) args
9096#else
9097#define _(args) ()
9098#endif
9099EOCP
9100echo "$foo" >> try.c
9101echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9102$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9103status=$?
9104$rm -f try.[co]
9105exit $status
9106EOSH
9107chmod +x protochk
9108$eunicefix protochk
9109
a48ec845
JH
9110hasproto='varname=$1; func=$2; shift; shift;
9111while $test $# -ge 2; do
9112 case "$1" in
9113 $define) echo "#include <$2>";;
9114 esac ;
9115 shift 2;
9116done > try.c;
9117$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9118if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9119 echo "$func() prototype found.";
9120 val="$define";
9121else
9122 echo "$func() prototype NOT found.";
9123 val="$undef";
9124fi;
9125set $varname;
9126eval $setvar;
9127$rm -f try.c tryout.c'
9128
10bc17b6
JH
9129: see if sys/types.h has to be included
9130set sys/types.h i_systypes
9131eval $inhdr
9132
9133: see if sys/select.h has to be included
9134set sys/select.h i_sysselct
9135eval $inhdr
9136
9137hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9138while $test $# -ge 2; do
9139 case "$1" in
9140 $define) echo "#include <$2>";;
9141 esac ;
9142 shift 2;
9143done > try.c;
9144echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9145set try;
9146if eval $compile; then
9147 val="$define";
9148else
9149 val="$undef";
9150fi;
9151set $varname;
9152eval $setvar;
9153$rm -f try.c try.o'
9154
9155: see if we should include time.h, sys/time.h, or both
9156echo " "
9157if test "X$timeincl" = X; then
9158 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9159 $echo $n "I'm now running the test program...$c"
9160 $cat >try.c <<'EOCP'
9161#include <sys/types.h>
9162#ifdef I_TIME
9163#include <time.h>
9164#endif
9165#ifdef I_SYSTIME
9166#ifdef SYSTIMEKERNEL
9167#define KERNEL
9168#endif
9169#include <sys/time.h>
9170#endif
9171#ifdef I_SYSSELECT
9172#include <sys/select.h>
9173#endif
9174int main()
9175{
9176 struct tm foo;
9177#ifdef S_TIMEVAL
9178 struct timeval bar;
9179#endif
9180#ifdef S_TIMEZONE
9181 struct timezone tzp;
9182#endif
9183 if (foo.tm_sec == foo.tm_sec)
9184 exit(0);
9185#ifdef S_TIMEVAL
9186 if (bar.tv_sec == bar.tv_sec)
9187 exit(0);
9188#endif
9189 exit(1);
9190}
9191EOCP
9192 flags=''
9193 for s_timezone in '-DS_TIMEZONE' ''; do
9194 sysselect=''
9195 for s_timeval in '-DS_TIMEVAL' ''; do
9196 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9197 for i_time in '' '-DI_TIME'; do
9198 for i_systime in '-DI_SYSTIME' ''; do
9199 case "$flags" in
9200 '') $echo $n ".$c"
9201 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9202 if eval $compile; then
9203 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9204 shift
9205 flags="$*"
9206 echo " "
9207 $echo $n "Succeeded with $flags$c"
9208 fi
9209 ;;
9210 esac
9211 done
9212 done
9213 done
9214 done
9215 done
9216 timeincl=''
9217 echo " "
9218 case "$flags" in
9219 *SYSTIMEKERNEL*) i_systimek="$define"
9220 timeincl=`./findhdr sys/time.h`
9221 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9222 *) i_systimek="$undef";;
9223 esac
9224 case "$flags" in
9225 *I_TIME*) i_time="$define"
9226 timeincl=`./findhdr time.h`" $timeincl"
9227 echo "We'll include <time.h>." >&4;;
9228 *) i_time="$undef";;
9229 esac
9230 case "$flags" in
9231 *I_SYSTIME*) i_systime="$define"
9232 timeincl=`./findhdr sys/time.h`" $timeincl"
9233 echo "We'll include <sys/time.h>." >&4;;
9234 *) i_systime="$undef";;
9235 esac
9236 $rm -f try.c try
9237fi
9238: see if struct tm knows about tm_zone
9239case "$i_systime$i_time" in
9240*$define*)
9241 echo " "
9242 echo "Checking to see if your struct tm has tm_zone field..." >&4
9243 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9244 eval $hasfield
9245 ;;
9246*) val="$undef"
9247 set d_tm_tm_zone
9248 eval $setvar
9249 ;;
9250esac
9251case "$d_tm_tm_zone" in
9252"$define") echo "Yes, it does." ;;
9253*) echo "No, it doesn't." ;;
9254esac
9255: see if struct tm knows about tm_gmtoff
9256case "$i_systime$i_time" in
9257*$define*)
9258 echo " "
9259 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9260 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9261 eval $hasfield
9262 ;;
9263*) val="$undef"
9264 set d_tm_tm_gmtoff
9265 eval $setvar
9266 ;;
9267esac
9268case "$d_tm_tm_gmtoff" in
9269"$define") echo "Yes, it does." ;;
9270*) echo "No, it doesn't." ;;
9271esac
9272
9273: see if asctime_r exists
9274set asctime_r d_asctime_r
9275eval $inlibc
9276case "$d_asctime_r" in
9277"$define")
d63eadf0 9278 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9279 case "$d_asctime_r_proto:$usethreads" in
9280 ":define") d_asctime_r_proto=define
a48ec845
JH
9281 set d_asctime_r_proto asctime_r $hdrs
9282 eval $hasproto ;;
9283 *) ;;
9284 esac
9285 case "$d_asctime_r_proto" in
9286 define)
10bc17b6
JH
9287 case "$asctime_r_proto" in
9288 ''|0) try='char* asctime_r(const struct tm*, char*);'
9289 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9290 esac
9291 case "$asctime_r_proto" in
9292 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9293 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9294 esac
9295 case "$asctime_r_proto" in
9296 ''|0) try='int asctime_r(const struct tm*, char*);'
9297 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9298 esac
9299 case "$asctime_r_proto" in
9300 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9301 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9302 esac
9303 case "$asctime_r_proto" in
90e831dc 9304 ''|0) d_asctime_r=undef
10bc17b6 9305 asctime_r_proto=0
a48ec845 9306 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9307 * ) case "$asctime_r_proto" in
9308 REENTRANT_PROTO*) ;;
9309 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9310 esac
9311 echo "Prototype: $try" ;;
9312 esac
9313 ;;
c18e646a
JH
9314 *) case "$usethreads" in
9315 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9316 esac
90e831dc
SB
9317 d_asctime_r=undef
9318 asctime_r_proto=0
c18e646a 9319 ;;
a48ec845
JH
9320 esac
9321 ;;
10bc17b6
JH
9322*) asctime_r_proto=0
9323 ;;
9324esac
9325
b4eb6b3d
JH
9326: see if atolf exists
9327set atolf d_atolf
9328eval $inlibc
9329
9330: see if atoll exists
9331set atoll d_atoll
9332eval $inlibc
9333
9334: Look for GNU-cc style attribute checking
9335echo " "
9336echo "Checking whether your compiler can handle __attribute__ ..." >&4
9337$cat >attrib.c <<'EOCP'
9338#include <stdio.h>
9339void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9340EOCP
9341if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9342 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9343 echo "Your C compiler doesn't fully support __attribute__."
9344 val="$undef"
9345 else
9346 echo "Your C compiler supports __attribute__."
9347 val="$define"
9348 fi
9349else
9350 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9351 val="$undef"
9352fi
9353set d_attribut
9354eval $setvar
9355$rm -f attrib*
9356
9357: see if bcmp exists
9358set bcmp d_bcmp
9359eval $inlibc
9360
9361: see if bcopy exists
9362set bcopy d_bcopy
9363eval $inlibc
9364
9365: see if this is a unistd.h system
9366set unistd.h i_unistd
9367eval $inhdr
9368
9369: see if getpgrp exists
9370set getpgrp d_getpgrp
9371eval $inlibc
9372
9373case "$d_getpgrp" in
9374"$define")
9375 echo " "
9376 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 9377 $cat >try.c <<EOP
b4eb6b3d
JH
9378#$i_unistd I_UNISTD
9379#include <sys/types.h>
9380#ifdef I_UNISTD
9381# include <unistd.h>
9382#endif
9383int main()
9384{
9385 if (getuid() == 0) {
9386 printf("(I see you are running Configure as super-user...)\n");
9387 setuid(1);
9388 }
9389#ifdef TRY_BSD_PGRP
9390 if (getpgrp(1) == 0)
9391 exit(0);
9392#else
9393 if (getpgrp() > 0)
9394 exit(0);
9395#endif
9396 exit(1);
9397}
9398EOP
5440bc8e 9399 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9400 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9401 val="$define"
5440bc8e 9402 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9403 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9404 val="$undef"
9405 else
9406 echo "I can't seem to compile and run the test program."
9407 if ./usg; then
9408 xxx="a USG one, i.e. you use getpgrp()."
9409 else
9410 # SVR4 systems can appear rather BSD-ish.
9411 case "$i_unistd" in
9412 $undef)
9413 xxx="a BSD one, i.e. you use getpgrp(pid)."
9414 val="$define"
9415 ;;
9416 $define)
9417 xxx="probably a USG one, i.e. you use getpgrp()."
9418 val="$undef"
9419 ;;
9420 esac
9421 fi
9422 echo "Assuming your getpgrp is $xxx" >&4
9423 fi
9424 ;;
9425*) val="$undef";;
9426esac
9427set d_bsdgetpgrp
9428eval $setvar
5440bc8e 9429$rm -f try try.*
b4eb6b3d
JH
9430
9431: see if setpgrp exists
9432set setpgrp d_setpgrp
9433eval $inlibc
9434
9435case "$d_setpgrp" in
9436"$define")
9437 echo " "
9438 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 9439 $cat >try.c <<EOP
b4eb6b3d
JH
9440#$i_unistd I_UNISTD
9441#include <sys/types.h>
9442#ifdef I_UNISTD
9443# include <unistd.h>
9444#endif
9445int main()
9446{
9447 if (getuid() == 0) {
9448 printf("(I see you are running Configure as super-user...)\n");
9449 setuid(1);
9450 }
9451#ifdef TRY_BSD_PGRP
9452 if (-1 == setpgrp(1, 1))
9453 exit(0);
9454#else
9455 if (setpgrp() != -1)
9456 exit(0);
9457#endif
9458 exit(1);
9459}
9460EOP
5440bc8e 9461 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9462 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9463 val="$define"
5440bc8e 9464 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9465 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9466 val="$undef"
9467 else
9468 echo "(I can't seem to compile and run the test program.)"
9469 if ./usg; then
9470 xxx="a USG one, i.e. you use setpgrp()."
9471 else
9472 # SVR4 systems can appear rather BSD-ish.
9473 case "$i_unistd" in
9474 $undef)
9475 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9476 val="$define"
9477 ;;
9478 $define)
9479 xxx="probably a USG one, i.e. you use setpgrp()."
9480 val="$undef"
9481 ;;
9482 esac
9483 fi
9484 echo "Assuming your setpgrp is $xxx" >&4
9485 fi
9486 ;;
9487*) val="$undef";;
9488esac
9489set d_bsdsetpgrp
9490eval $setvar
5440bc8e 9491$rm -f try try.*
b4eb6b3d
JH
9492: see if bzero exists
9493set bzero d_bzero
9494eval $inlibc
9495
9496: see if signal is declared as pointer to function returning int or void
9497echo " "
9498xxx=`./findhdr signal.h`
9499$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9500if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9501 echo "You have int (*signal())() instead of void." >&4
9502 val="$undef"
9503elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9504 echo "You have void (*signal())()." >&4
9505 val="$define"
9506elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9507 echo "You have int (*signal())() instead of void." >&4
9508 val="$undef"
9509elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9510 echo "You have void (*signal())()." >&4
9511 val="$define"
9512else
9513 case "$d_voidsig" in
9514 '')
9515 echo "I can't determine whether signal handler returns void or int..." >&4
9516 dflt=void
9517 rp="What type does your signal handler return?"
9518 . ./myread
9519 case "$ans" in
9520 v*) val="$define";;
9521 *) val="$undef";;
9522 esac;;
9523 "$define")
9524 echo "As you already told me, signal handler returns void." >&4
9525 val="$define"
9526 ;;
9527 *) echo "As you already told me, signal handler returns int." >&4
9528 val="$undef"
9529 ;;
9530 esac
9531fi
9532set d_voidsig
9533eval $setvar
9534case "$d_voidsig" in
9535"$define") signal_t="void";;
9536*) signal_t="int";;
9537esac
9538$rm -f $$.tmp
9539
9540: check for ability to cast large floats to 32-bit ints.
9541echo " "
9542echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9543if $test "$intsize" -ge 4; then
9544 xxx=int
9545else
9546 xxx=long
9547fi
9548$cat >try.c <<EOCP
9549#include <stdio.h>
9550#include <sys/types.h>
9551#include <signal.h>
9552$signal_t blech(s) int s; { exit(3); }
9553int main()
9554{
9555 $xxx i32;
9556 double f, g;
9557 int result = 0;
9558 char str[16];
9559 signal(SIGFPE, blech);
9560
9561 /* Don't let compiler optimize the test away. Store the number
9562 in a writable string for gcc to pass to sscanf under HP/UX.
9563 */
9564 sprintf(str, "2147483647");
9565 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9566 g = 10 * f;
9567 i32 = ($xxx) g;
9568
9569 /* x86 processors will probably give 0x8000 0000, which is a
9570 sign change. We don't want that. We want to mimic SPARC
9571 behavior here, which is to preserve the sign and give
9572 back 0x7fff ffff.
9573 */
9574 if (i32 != ($xxx) f)
9575 result |= 1;
9576 exit(result);
9577}
9578EOCP
9579set try
9580if eval $compile_ok; then
5440bc8e 9581 $run ./try
b4eb6b3d
JH
9582 yyy=$?
9583else
9584 echo "(I can't seem to compile the test program--assuming it can't)"
9585 yyy=1
9586fi
9587case "$yyy" in
95880) val="$define"
9589 echo "Yup, it can."
9590 ;;
9591*) val="$undef"
9592 echo "Nope, it can't."
9593 ;;
9594esac
9595set d_casti32
9596eval $setvar
9597$rm -f try try.*
9598
9599: check for ability to cast negative floats to unsigned
9600echo " "
9601echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9602$cat >try.c <<EOCP
9603#include <stdio.h>
9604#include <sys/types.h>
9605#include <signal.h>
9606$signal_t blech(s) int s; { exit(7); }
9607$signal_t blech_in_list(s) int s; { exit(4); }
9608unsigned long dummy_long(p) unsigned long p; { return p; }
9609unsigned int dummy_int(p) unsigned int p; { return p; }
9610unsigned short dummy_short(p) unsigned short p; { return p; }
9611int main()
9612{
9613 double f;
9614 unsigned long along;
9615 unsigned int aint;
9616 unsigned short ashort;
9617 int result = 0;
9618 char str[16];
9619
9620 /* Frustrate gcc-2.7.2's optimizer which failed this test with
9621 a direct f = -123. assignment. gcc-2.8.0 reportedly
9622 optimized the whole file away
9623 */
9624 /* Store the number in a writable string for gcc to pass to
9625 sscanf under HP/UX.
9626 */
9627 sprintf(str, "-123");
9628 sscanf(str, "%lf", &f); /* f = -123.; */
9629
9630 signal(SIGFPE, blech);
9631 along = (unsigned long)f;
9632 aint = (unsigned int)f;
9633 ashort = (unsigned short)f;
9634 if (along != (unsigned long)-123)
9635 result |= 1;
9636 if (aint != (unsigned int)-123)
9637 result |= 1;
9638 if (ashort != (unsigned short)-123)
9639 result |= 1;
9640 sprintf(str, "1073741824.");
9641 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9642 f = f + f;
9643 along = 0;
9644 along = (unsigned long)f;
9645 if (along != 0x80000000)
9646 result |= 2;
9647 f -= 1.;
9648 along = 0;
9649 along = (unsigned long)f;
9650 if (along != 0x7fffffff)
9651 result |= 1;
9652 f += 2.;
9653 along = 0;
9654 along = (unsigned long)f;
9655 if (along != 0x80000001)
9656 result |= 2;
9657 if (result)
9658 exit(result);
9659 signal(SIGFPE, blech_in_list);
9660 sprintf(str, "123.");
9661 sscanf(str, "%lf", &f); /* f = 123.; */
9662 along = dummy_long((unsigned long)f);
9663 aint = dummy_int((unsigned int)f);
9664 ashort = dummy_short((unsigned short)f);
9665 if (along != (unsigned long)123)
9666 result |= 4;
9667 if (aint != (unsigned int)123)
9668 result |= 4;
9669 if (ashort != (unsigned short)123)
9670 result |= 4;
9671 exit(result);
9672
9673}
9674EOCP
9675set try
9676if eval $compile_ok; then
5440bc8e 9677 $run ./try
b4eb6b3d
JH
9678 castflags=$?
9679else
9680 echo "(I can't seem to compile the test program--assuming it can't)"
9681 castflags=7
9682fi
9683case "$castflags" in
96840) val="$define"
9685 echo "Yup, it can."
9686 ;;
9687*) val="$undef"
9688 echo "Nope, it can't."
9689 ;;
9690esac
9691set d_castneg
9692eval $setvar
9693$rm -f try.*
9694
9695: see if vprintf exists
9696echo " "
9697if set vprintf val -f d_vprintf; eval $csym; $val; then
9698 echo 'vprintf() found.' >&4
9699 val="$define"
5440bc8e 9700 $cat >try.c <<'EOF'
b4eb6b3d
JH
9701#include <varargs.h>
9702
9703int main() { xxx("foo"); }
9704
9705xxx(va_alist)
9706va_dcl
9707{
9708 va_list args;
9709 char buf[10];
9710
9711 va_start(args);
9712 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9713}
9714EOF
5440bc8e
JH
9715 set try
9716 if eval $compile && $run ./try; then
b4eb6b3d
JH
9717 echo "Your vsprintf() returns (int)." >&4
9718 val2="$undef"
9719 else
9720 echo "Your vsprintf() returns (char*)." >&4
9721 val2="$define"
9722 fi
9723else
9724 echo 'vprintf() NOT found.' >&4
9725 val="$undef"
9726 val2="$undef"
9727fi
5440bc8e 9728$rm -f try try.*
b4eb6b3d
JH
9729set d_vprintf
9730eval $setvar
9731val=$val2
9732set d_charvspr
9733eval $setvar
9734
9735: see if chown exists
9736set chown d_chown
9737eval $inlibc
9738
9739: see if chroot exists
9740set chroot d_chroot
9741eval $inlibc
9742
9743: see if chsize exists
9744set chsize d_chsize
9745eval $inlibc
9746
758a5d79
JH
9747: see if class exists
9748set class d_class
9749eval $inlibc
9750
4e0554ec
JH
9751hasstruct='varname=$1; struct=$2; shift; shift;
9752while $test $# -ge 2; do
9753 case "$1" in
9754 $define) echo "#include <$2>";;
9755 esac ;
9756 shift 2;
9757done > try.c;
9758echo "int main () { struct $struct foo; }" >> try.c;
9759set try;
9760if eval $compile; then
9761 val="$define";
9762else
9763 val="$undef";
9764fi;
9765set $varname;
9766eval $setvar;
9767$rm -f try.c try.o'
9768
4e0554ec
JH
9769socketlib=''
9770sockethdr=''
9771: see whether socket exists
9772echo " "
9773$echo $n "Hmm... $c" >&4
9774if set socket val -f d_socket; eval $csym; $val; then
9775 echo "Looks like you have Berkeley networking support." >&4
9776 d_socket="$define"
9777 if set setsockopt val -f; eval $csym; $val; then
9778 d_oldsock="$undef"
9779 else
9780 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9781 d_oldsock="$define"
9782 fi
9783else
9784 if $contains socklib libc.list >/dev/null 2>&1; then
9785 echo "Looks like you have Berkeley networking support." >&4
9786 d_socket="$define"
9787 : we will have to assume that it supports the 4.2 BSD interface
9788 d_oldsock="$undef"
9789 else
9790 echo "You don't have Berkeley networking in libc$_a..." >&4
9791 if test "X$d_socket" = "X$define"; then
9792 echo "...but you seem to believe that you have sockets." >&4
9793 else
9794 for net in net socket
9795 do
9796 if test -f /usr/lib/lib$net$_a; then
9797 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
9798 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9799 if $contains socket libc.list >/dev/null 2>&1; then
9800 d_socket="$define"
9801 socketlib="-l$net"
9802 case "$net" in
9803 net)
9804 echo "...but the Wollongong group seems to have hacked it in." >&4
9805 sockethdr="-I/usr/netinclude"
9806 ;;
9807 esac
3c728e00 9808 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
9809 if $contains setsockopt libc.list >/dev/null 2>&1; then
9810 d_oldsock="$undef"
9811 else
9812 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9813 d_oldsock="$define"
9814 fi
9815 break
9816 fi
9817 fi
9818 done
9819 if test "X$d_socket" != "X$define"; then
9820 echo "or anywhere else I see." >&4
9821 d_socket="$undef"
9822 d_oldsock="$undef"
9823 fi
9824 fi
9825 fi
9826fi
9827
9828: see if socketpair exists
9829set socketpair d_sockpair
9830eval $inlibc
9831
9832
9833echo " "
3c728e00 9834echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
9835for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9836 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9837 $cat >try.c <<EOF
9838#include <sys/types.h>
9839#include <sys/socket.h>
9840int main() {
9841 int i = $ENUM;
9842}
9843EOF
9844 val="$undef"
9845 set try; if eval $compile; then
9846 val="$define"
9847 fi
9848 set d_${enum}; eval $setvar
9849 $rm -f try.c try
9850done
9851
9852: see if this is a sys/uio.h system
9853set sys/uio.h i_sysuio
9854eval $inhdr
9855
9856
9857echo " "
9858echo "Checking to see if your system supports struct cmsghdr..." >&4
9859set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9860eval $hasstruct
9861case "$d_cmsghdr_s" in
9862"$define") echo "Yes, it does." ;;
9863*) echo "No, it doesn't." ;;
9864esac
9865
9866
b4eb6b3d
JH
9867: check for const keyword
9868echo " "
9869echo 'Checking to see if your C compiler knows about "const"...' >&4
9870$cat >const.c <<'EOCP'
9871typedef struct spug { int drokk; } spug;
9872int main()
9873{
9874 const char *foo;
9875 const spug y;
9876}
9877EOCP
9878if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9879 val="$define"
9880 echo "Yup, it does."
9881else
9882 val="$undef"
9883 echo "Nope, it doesn't."
9884fi
9885set d_const
9886eval $setvar
9887
9888: see if crypt exists
9889echo " "
a5a94ea5
JH
9890set crypt d_crypt
9891eval $inlibc
9892case "$d_crypt" in
9893$define) cryptlib='' ;;
9894*) if set crypt val -f d_crypt; eval $csym; $val; then
9895 echo 'crypt() found.' >&4
b4eb6b3d 9896 val="$define"
a5a94ea5
JH
9897 cryptlib=''
9898 else
9899 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9900 if $test -z "$cryptlib"; then
9901 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9902 else
9903 cryptlib=-lcrypt
9904 fi
9905 if $test -z "$cryptlib"; then
9906 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9907 else
9908 cryptlib=-lcrypt
9909 fi
9910 if $test -z "$cryptlib"; then
9911 cryptlib=`./loc libcrypt$_a "" $libpth`
9912 else
9913 cryptlib=-lcrypt
9914 fi
9915 if $test -z "$cryptlib"; then
9916 echo 'crypt() NOT found.' >&4
9917 val="$undef"
9918 else
9919 val="$define"
9920 fi
b4eb6b3d 9921 fi
a5a94ea5
JH
9922 set d_crypt
9923 eval $setvar
9924 ;;
9925esac
b4eb6b3d 9926
10bc17b6
JH
9927: see if this is a crypt.h system
9928set crypt.h i_crypt
9929eval $inhdr
9930
9931: see if crypt_r exists
9932set crypt_r d_crypt_r
9933eval $inlibc
9934case "$d_crypt_r" in
9935"$define")
9936 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
9937 case "$d_crypt_r_proto:$usethreads" in
9938 ":define") d_crypt_r_proto=define
a48ec845
JH
9939 set d_crypt_r_proto crypt_r $hdrs
9940 eval $hasproto ;;
9941 *) ;;
9942 esac
9943 case "$d_crypt_r_proto" in
9944 define)
10bc17b6
JH
9945 case "$crypt_r_proto" in
9946 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9947 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9948 esac
9949 case "$crypt_r_proto" in
b430fd04
JH
9950 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9951 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9952 esac
9953 case "$crypt_r_proto" in
90e831dc 9954 ''|0) d_crypt_r=undef
10bc17b6 9955 crypt_r_proto=0
a48ec845 9956 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9957 * ) case "$crypt_r_proto" in
9958 REENTRANT_PROTO*) ;;
9959 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9960 esac
9961 echo "Prototype: $try" ;;
9962 esac
9963 ;;
c18e646a
JH
9964 *) case "$usethreads" in
9965 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9966 esac
90e831dc
SB
9967 d_crypt_r=undef
9968 crypt_r_proto=0
c18e646a 9969 ;;
a48ec845
JH
9970 esac
9971 ;;
10bc17b6
JH
9972*) crypt_r_proto=0
9973 ;;
9974esac
9975
b4eb6b3d
JH
9976: get csh whereabouts
9977case "$csh" in
9978'csh') val="$undef" ;;
9979*) val="$define" ;;
9980esac
9981set d_csh
9982eval $setvar
9983: Respect a hint or command line value for full_csh.
9984case "$full_csh" in
9985'') full_csh=$csh ;;
9986esac
9987
10bc17b6
JH
9988: see if ctermid_r exists
9989set ctermid_r d_ctermid_r
9990eval $inlibc
9991case "$d_ctermid_r" in
9992"$define")
31ee0cb7 9993 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
9994 case "$d_ctermid_r_proto:$usethreads" in
9995 ":define") d_ctermid_r_proto=define
a48ec845
JH
9996 set d_ctermid_r_proto ctermid_r $hdrs
9997 eval $hasproto ;;
9998 *) ;;
9999 esac
10000 case "$d_ctermid_r_proto" in
10001 define)
10bc17b6
JH
10002 case "$ctermid_r_proto" in
10003 ''|0) try='char* ctermid_r(char*);'
10004 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10005 esac
10006 case "$ctermid_r_proto" in
90e831dc 10007 ''|0) d_ctermid_r=undef
10bc17b6 10008 ctermid_r_proto=0
a48ec845 10009 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10010 * ) case "$ctermid_r_proto" in
10011 REENTRANT_PROTO*) ;;
10012 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10013 esac
10014 echo "Prototype: $try" ;;
10015 esac
10016 ;;
c18e646a
JH
10017 *) case "$usethreads" in
10018 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10019 esac
90e831dc
SB
10020 d_ctermid_r=undef
10021 ctermid_r_proto=0
c18e646a 10022 ;;
a48ec845
JH
10023 esac
10024 ;;
10bc17b6
JH
10025*) ctermid_r_proto=0
10026 ;;
10027esac
10028
10029: see if ctime_r exists
10030set ctime_r d_ctime_r
10031eval $inlibc
10032case "$d_ctime_r" in
10033"$define")
d63eadf0 10034 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10035 case "$d_ctime_r_proto:$usethreads" in
10036 ":define") d_ctime_r_proto=define
a48ec845
JH
10037 set d_ctime_r_proto ctime_r $hdrs
10038 eval $hasproto ;;
10039 *) ;;
10040 esac
10041 case "$d_ctime_r_proto" in
10042 define)
10bc17b6
JH
10043 case "$ctime_r_proto" in
10044 ''|0) try='char* ctime_r(const time_t*, char*);'
10045 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10046 esac
10047 case "$ctime_r_proto" in
10048 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10049 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10050 esac
10051 case "$ctime_r_proto" in
10052 ''|0) try='int ctime_r(const time_t*, char*);'
10053 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10054 esac
10055 case "$ctime_r_proto" in
10056 ''|0) try='int ctime_r(const time_t*, char*, int);'
10057 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10058 esac
10059 case "$ctime_r_proto" in
90e831dc 10060 ''|0) d_ctime_r=undef
10bc17b6 10061 ctime_r_proto=0
a48ec845 10062 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10063 * ) case "$ctime_r_proto" in
10064 REENTRANT_PROTO*) ;;
10065 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10066 esac
10067 echo "Prototype: $try" ;;
10068 esac
10069 ;;
c18e646a
JH
10070 *) case "$usethreads" in
10071 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10072 esac
90e831dc
SB
10073 d_ctime_r=undef
10074 ctime_r_proto=0
c18e646a 10075 ;;
a48ec845
JH
10076 esac
10077 ;;
10bc17b6
JH
10078*) ctime_r_proto=0
10079 ;;
10080esac
10081
b4eb6b3d
JH
10082: see if cuserid exists
10083set cuserid d_cuserid
10084eval $inlibc
10085
10086: see if this is a limits.h system
10087set limits.h i_limits
10088eval $inhdr
10089
10090: see if this is a float.h system
10091set float.h i_float
10092eval $inhdr
10093
10094: See if number of significant digits in a double precision number is known
10095echo " "
10096$cat >dbl_dig.c <<EOM
10097#$i_limits I_LIMITS
10098#$i_float I_FLOAT
10099#ifdef I_LIMITS
10100#include <limits.h>
10101#endif
10102#ifdef I_FLOAT
10103#include <float.h>
10104#endif
10105#ifdef DBL_DIG
10106printf("Contains DBL_DIG");
10107#endif
10108EOM
10109$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10110if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10111 echo "DBL_DIG found." >&4
10112 val="$define"
10113else
10114 echo "DBL_DIG NOT found." >&4
10115 val="$undef"
10116fi
10117$rm -f dbl_dig.?
10118set d_dbl_dig
10119eval $setvar
10120
2ef53570
JH
10121: see if dbm.h is available
10122: see if dbmclose exists
10123set dbmclose d_dbmclose
10124eval $inlibc
10125
10126case "$d_dbmclose" in
10127$define)
10128 set dbm.h i_dbm
10129 eval $inhdr
10130 case "$i_dbm" in
10131 $define)
10132 val="$undef"
10133 set i_rpcsvcdbm
10134 eval $setvar
10135 ;;
10136 *) set rpcsvc/dbm.h i_rpcsvcdbm
10137 eval $inhdr
10138 ;;
10139 esac
10140 ;;
10141*) echo "We won't be including <dbm.h>"
10142 val="$undef"
10143 set i_dbm
10144 eval $setvar
10145 val="$undef"
10146 set i_rpcsvcdbm
10147 eval $setvar
10148 ;;
10149esac
10150
10151: see if prototype for dbminit is available
10152echo " "
10153set d_dbminitproto dbminit $i_dbm dbm.h
10154eval $hasproto
10155
b4eb6b3d
JH
10156: see if difftime exists
10157set difftime d_difftime
10158eval $inlibc
10159
10160: see if this is a dirent system
10161echo " "
10162if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10163 val="$define"
10164 echo "<dirent.h> found." >&4
10165else
10166 val="$undef"
10167 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10168 echo "<sys/dir.h> found." >&4
10169 echo " "
10170 else
10171 xinc=`./findhdr sys/ndir.h`
10172 fi
10173 echo "<dirent.h> NOT found." >&4
10174fi
10175set i_dirent
10176eval $setvar
10177
10178: Look for type of directory structure.
10179echo " "
10180$cppstdin $cppflags $cppminus < "$xinc" > try.c
10181
10182case "$direntrytype" in
10183''|' ')
10184 case "$i_dirent" in
10185 $define) guess1='struct dirent' ;;
10186 *) guess1='struct direct' ;;
10187 esac
10188 ;;
10189*) guess1="$direntrytype"
10190 ;;
10191esac
10192
10193case "$guess1" in
10194'struct dirent') guess2='struct direct' ;;
10195*) guess2='struct dirent' ;;
10196esac
10197
10198if $contains "$guess1" try.c >/dev/null 2>&1; then
10199 direntrytype="$guess1"
10200 echo "Your directory entries are $direntrytype." >&4
10201elif $contains "$guess2" try.c >/dev/null 2>&1; then
10202 direntrytype="$guess2"
10203 echo "Your directory entries seem to be $direntrytype." >&4
10204else
10205 echo "I don't recognize your system's directory entries." >&4
10206 rp="What type is used for directory entries on this system?"
10207 dflt="$guess1"
10208 . ./myread
10209 direntrytype="$ans"
10210fi
10211$rm -f try.c
10212
10213
10214: see if the directory entry stores field length
10215echo " "
10216$cppstdin $cppflags $cppminus < "$xinc" > try.c
10217if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10218 echo "Good, your directory entry keeps length information in d_namlen." >&4
10219 val="$define"
10220else
10221 echo "Your directory entry does not know about the d_namlen field." >&4
10222 val="$undef"
10223fi
10224set d_dirnamlen
10225eval $setvar
10226$rm -f try.c
10227
ae0e3d3b
JH
10228: see if this is an sysdir system
10229set sys/dir.h i_sysdir
10230eval $inhdr
10231
10232: see if this is an sysndir system
10233set sys/ndir.h i_sysndir
10234eval $inhdr
10235
10236: Look for dirfd
10237echo " "
10238$cat >dirfd.c <<EOM
10239#include <stdio.h>
10240#$i_dirent I_DIRENT /**/
10241#$i_sysdir I_SYS_DIR /**/
10242#$i_sysndir I_SYS_NDIR /**/
10243#$i_systypes I_SYS_TYPES /**/
10244#if defined(I_SYS_TYPES)
10245#include <sys/types.h>
10246#endif
10247#if defined(I_DIRENT)
10248#include <dirent.h>
10249#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10250#include <sys/dir.h>
10251#endif
10252#else
10253#ifdef I_SYS_NDIR
10254#include <sys/ndir.h>
10255#else
10256#ifdef I_SYS_DIR
10257#ifdef hp9000s500
10258#include <ndir.h> /* may be wrong in the future */
10259#else
10260#include <sys/dir.h>
10261#endif
10262#endif
10263#endif
10264#endif
10265int main() {
10266 DIR *dirp = opendir(".");
10267 if (dirfd(dirp) >= 0)
10268 exit(0);
10269 else
10270 exit(1);
10271}
10272EOM
10273set dirfd
10274if eval $compile; then
10275 val="$define"
10276fi
10277case "$val" in
10278$define) echo "dirfd() found." >&4 ;;
10279*) echo "dirfd() NOT found." >&4 ;;
10280esac
10281set d_dirfd
10282eval $setvar
10283$rm -f dirfd*
10284
b4eb6b3d
JH
10285: see if dlerror exists
10286xxx_runnm="$runnm"
10287runnm=false
10288set dlerror d_dlerror
10289eval $inlibc
10290runnm="$xxx_runnm"
10291
10292: see if dlfcn is available
10293set dlfcn.h i_dlfcn
10294eval $inhdr
10295
10296case "$usedl" in
10297$define|y|true)
10298 $cat << EOM
10299
10300On a few systems, the dynamically loaded modules that perl generates and uses
10301will need a different extension than shared libs. The default will probably
10302be appropriate.
10303
10304EOM
10305 case "$dlext" in
10306 '') dflt="$so" ;;
10307 *) dflt="$dlext" ;;
10308 esac
10309 rp='What is the extension of dynamically loaded modules'
10310 . ./myread
10311 dlext="$ans"
10312 ;;
10313*)
10314 dlext="none"
10315 ;;
10316esac
10317
10318: Check if dlsym need a leading underscore
10319echo " "
10320val="$undef"
10321
10322case "$dlsrc" in
10323dl_dlopen.xs)
10324 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10325 $cat >dyna.c <<'EOM'
10326fred () { }
10327EOM
10328
10329$cat >fred.c<<EOM
10330
10331#include <stdio.h>
10332#$i_dlfcn I_DLFCN
10333#ifdef I_DLFCN
5440bc8e 10334#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
10335#else
10336#include <sys/types.h>
10337#include <nlist.h>
10338#include <link.h>
10339#endif
10340
10341extern int fred() ;
10342
10343int main()
10344{
10345 void * handle ;
10346 void * symbol ;
10347#ifndef RTLD_LAZY
10348 int mode = 1 ;
10349#else
10350 int mode = RTLD_LAZY ;
10351#endif
10352 handle = dlopen("./dyna.$dlext", mode) ;
10353 if (handle == NULL) {
10354 printf ("1\n") ;
10355 fflush (stdout) ;
10356 exit(0);
10357 }
10358 symbol = dlsym(handle, "fred") ;
10359 if (symbol == NULL) {
10360 /* try putting a leading underscore */
10361 symbol = dlsym(handle, "_fred") ;
10362 if (symbol == NULL) {
10363 printf ("2\n") ;
10364 fflush (stdout) ;
10365 exit(0);
10366 }
10367 printf ("3\n") ;
10368 }
10369 else
10370 printf ("4\n") ;
10371 fflush (stdout) ;
10372 exit(0);
10373}
10374EOM
10375 : Call the object file tmp-dyna.o in case dlext=o.
10376 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10377 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 10378 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
10379 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10380 xxx=`$run ./fred`
b4eb6b3d
JH
10381 case $xxx in
10382 1) echo "Test program failed using dlopen." >&4
10383 echo "Perhaps you should not use dynamic loading." >&4;;
10384 2) echo "Test program failed using dlsym." >&4
10385 echo "Perhaps you should not use dynamic loading." >&4;;
10386 3) echo "dlsym needs a leading underscore" >&4
10387 val="$define" ;;
10388 4) echo "dlsym doesn't need a leading underscore." >&4;;
10389 esac
10390 else
10391 echo "I can't compile and run the test program." >&4
10392 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10393 fi
10394 ;;
10395esac
10396
3c728e00 10397$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
10398
10399set d_dlsymun
10400eval $setvar
10401
10bc17b6
JH
10402: see if drand48_r exists
10403set drand48_r d_drand48_r
10404eval $inlibc
10405case "$d_drand48_r" in
10406"$define")
10407 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
10408 case "$d_drand48_r_proto:$usethreads" in
10409 ":define") d_drand48_r_proto=define
a48ec845
JH
10410 set d_drand48_r_proto drand48_r $hdrs
10411 eval $hasproto ;;
10412 *) ;;
10413 esac
10414 case "$d_drand48_r_proto" in
10415 define)
10bc17b6
JH
10416 case "$drand48_r_proto" in
10417 ''|0) try='int drand48_r(struct drand48_data*, double*);'
10418 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10419 esac
10420 case "$drand48_r_proto" in
90e831dc 10421 ''|0) d_drand48_r=undef
10bc17b6 10422 drand48_r_proto=0
a48ec845 10423 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10424 * ) case "$drand48_r_proto" in
10425 REENTRANT_PROTO*) ;;
10426 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10427 esac
10428 echo "Prototype: $try" ;;
10429 esac
10430 ;;
c18e646a
JH
10431 *) case "$usethreads" in
10432 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10433 esac
90e831dc
SB
10434 d_drand48_r=undef
10435 drand48_r_proto=0
c18e646a 10436 ;;
a48ec845
JH
10437 esac
10438 ;;
10bc17b6
JH
10439*) drand48_r_proto=0
10440 ;;
10441esac
10442
10443: see if prototype for drand48 is available
10444echo " "
10445set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10446eval $hasproto
10447
b4eb6b3d
JH
10448: see if dup2 exists
10449set dup2 d_dup2
10450eval $inlibc
10451
10452: see if eaccess exists
10453set eaccess d_eaccess
10454eval $inlibc
10455
10456: see if endgrent exists
10457set endgrent d_endgrent
10458eval $inlibc
10459
10bc17b6
JH
10460: see if this is an grp system
10461set grp.h i_grp
10462eval $inhdr
10463
10464case "$i_grp" in
10465$define)
10466 xxx=`./findhdr grp.h`
10467 $cppstdin $cppflags $cppminus < $xxx >$$.h
10468
10469 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10470 val="$define"
10471 else
10472 val="$undef"
10473 fi
10474 set d_grpasswd
10475 eval $setvar
10476
10477 $rm -f $$.h
10478 ;;
10479*)
10480 val="$undef";
10481 set d_grpasswd; eval $setvar
10482 ;;
10483esac
10484
10485: see if endgrent_r exists
10486set endgrent_r d_endgrent_r
10487eval $inlibc
10488case "$d_endgrent_r" in
10489"$define")
10490 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
10491 case "$d_endgrent_r_proto:$usethreads" in
10492 ":define") d_endgrent_r_proto=define
a48ec845
JH
10493 set d_endgrent_r_proto endgrent_r $hdrs
10494 eval $hasproto ;;
10495 *) ;;
10496 esac
10497 case "$d_endgrent_r_proto" in
10498 define)
10bc17b6
JH
10499 case "$endgrent_r_proto" in
10500 ''|0) try='int endgrent_r(FILE**);'
10501 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10502 esac
10503 case "$endgrent_r_proto" in
10504 ''|0) try='void endgrent_r(FILE**);'
10505 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10506 esac
10507 case "$endgrent_r_proto" in
90e831dc 10508 ''|0) d_endgrent_r=undef
10bc17b6 10509 endgrent_r_proto=0
a48ec845 10510 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10511 * ) case "$endgrent_r_proto" in
10512 REENTRANT_PROTO*) ;;
10513 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10514 esac
10515 echo "Prototype: $try" ;;
10516 esac
10517 ;;
c18e646a
JH
10518 *) case "$usethreads" in
10519 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10520 esac
90e831dc
SB
10521 d_endgrent_r=undef
10522 endgrent_r_proto=0
c18e646a 10523 ;;
a48ec845
JH
10524 esac
10525 ;;
10bc17b6
JH
10526*) endgrent_r_proto=0
10527 ;;
10528esac
10529
b4eb6b3d
JH
10530: see if endhostent exists
10531set endhostent d_endhent
10532eval $inlibc
10533
10bc17b6
JH
10534: see if this is a netdb.h system
10535set netdb.h i_netdb
10536eval $inhdr
10537
10538: see if endhostent_r exists
10539set endhostent_r d_endhostent_r
10540eval $inlibc
10541case "$d_endhostent_r" in
10542"$define")
10543 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10544 case "$d_endhostent_r_proto:$usethreads" in
10545 ":define") d_endhostent_r_proto=define
a48ec845
JH
10546 set d_endhostent_r_proto endhostent_r $hdrs
10547 eval $hasproto ;;
10548 *) ;;
10549 esac
10550 case "$d_endhostent_r_proto" in
10551 define)
10bc17b6
JH
10552 case "$endhostent_r_proto" in
10553 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 10554 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
10555 esac
10556 case "$endhostent_r_proto" in
10557 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 10558 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
10559 esac
10560 case "$endhostent_r_proto" in
90e831dc 10561 ''|0) d_endhostent_r=undef
10bc17b6 10562 endhostent_r_proto=0
a48ec845 10563 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10564 * ) case "$endhostent_r_proto" in
10565 REENTRANT_PROTO*) ;;
10566 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10567 esac
10568 echo "Prototype: $try" ;;
10569 esac
10570 ;;
c18e646a
JH
10571 *) case "$usethreads" in
10572 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10573 esac
90e831dc
SB
10574 d_endhostent_r=undef
10575 endhostent_r_proto=0
c18e646a 10576 ;;
a48ec845
JH
10577 esac
10578 ;;
10bc17b6
JH
10579*) endhostent_r_proto=0
10580 ;;
10581esac
10582
b4eb6b3d
JH
10583: see if endnetent exists
10584set endnetent d_endnent
10585eval $inlibc
10586
10bc17b6
JH
10587: see if endnetent_r exists
10588set endnetent_r d_endnetent_r
10589eval $inlibc
10590case "$d_endnetent_r" in
10591"$define")
10592 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10593 case "$d_endnetent_r_proto:$usethreads" in
10594 ":define") d_endnetent_r_proto=define
a48ec845
JH
10595 set d_endnetent_r_proto endnetent_r $hdrs
10596 eval $hasproto ;;
10597 *) ;;
10598 esac
10599 case "$d_endnetent_r_proto" in
10600 define)
10bc17b6
JH
10601 case "$endnetent_r_proto" in
10602 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 10603 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
10604 esac
10605 case "$endnetent_r_proto" in
10606 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 10607 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
10608 esac
10609 case "$endnetent_r_proto" in
90e831dc 10610 ''|0) d_endnetent_r=undef
10bc17b6 10611 endnetent_r_proto=0
a48ec845 10612 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10613 * ) case "$endnetent_r_proto" in
10614 REENTRANT_PROTO*) ;;
10615 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10616 esac
10617 echo "Prototype: $try" ;;
10618 esac
10619 ;;
c18e646a
JH
10620 *) case "$usethreads" in
10621 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10622 esac
90e831dc
SB
10623 d_endnetent_r=undef
10624 endnetent_r_proto=0
c18e646a 10625 ;;
a48ec845
JH
10626 esac
10627 ;;
10bc17b6
JH
10628*) endnetent_r_proto=0
10629 ;;
10630esac
10631
b4eb6b3d
JH
10632: see if endprotoent exists
10633set endprotoent d_endpent
10634eval $inlibc
10635
10bc17b6
JH
10636: see if endprotoent_r exists
10637set endprotoent_r d_endprotoent_r
10638eval $inlibc
10639case "$d_endprotoent_r" in
10640"$define")
10641 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10642 case "$d_endprotoent_r_proto:$usethreads" in
10643 ":define") d_endprotoent_r_proto=define
a48ec845
JH
10644 set d_endprotoent_r_proto endprotoent_r $hdrs
10645 eval $hasproto ;;
10646 *) ;;
10647 esac
10648 case "$d_endprotoent_r_proto" in
10649 define)
10bc17b6
JH
10650 case "$endprotoent_r_proto" in
10651 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 10652 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
10653 esac
10654 case "$endprotoent_r_proto" in
10655 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 10656 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
10657 esac
10658 case "$endprotoent_r_proto" in
90e831dc 10659 ''|0) d_endprotoent_r=undef
10bc17b6 10660 endprotoent_r_proto=0
a48ec845 10661 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10662 * ) case "$endprotoent_r_proto" in
10663 REENTRANT_PROTO*) ;;
10664 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10665 esac
10666 echo "Prototype: $try" ;;
10667 esac
10668 ;;
c18e646a
JH
10669 *) case "$usethreads" in
10670 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10671 esac
90e831dc
SB
10672 d_endprotoent_r=undef
10673 endprotoent_r_proto=0
c18e646a 10674 ;;
a48ec845
JH
10675 esac
10676 ;;
10bc17b6
JH
10677*) endprotoent_r_proto=0
10678 ;;
10679esac
10680
b4eb6b3d
JH
10681: see if endpwent exists
10682set endpwent d_endpwent
10683eval $inlibc
10684
10bc17b6
JH
10685: see if this is a pwd.h system
10686set pwd.h i_pwd
10687eval $inhdr
10688
10689case "$i_pwd" in
10690$define)
10691 xxx=`./findhdr pwd.h`
10692 $cppstdin $cppflags $cppminus < $xxx >$$.h
10693
10694 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10695 val="$define"
10696 else
10697 val="$undef"
10698 fi
10699 set d_pwquota
10700 eval $setvar
10701
10702 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10703 val="$define"
10704 else
10705 val="$undef"
10706 fi
10707 set d_pwage
10708 eval $setvar
10709
10710 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10711 val="$define"
10712 else
10713 val="$undef"
10714 fi
10715 set d_pwchange
10716 eval $setvar
10717
10718 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10719 val="$define"
10720 else
10721 val="$undef"
10722 fi
10723 set d_pwclass
10724 eval $setvar
10725
10726 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10727 val="$define"
10728 else
10729 val="$undef"
10730 fi
10731 set d_pwexpire
10732 eval $setvar
10733
10734 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10735 val="$define"
10736 else
10737 val="$undef"
10738 fi
10739 set d_pwcomment
10740 eval $setvar
10741
10742 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10743 val="$define"
10744 else
10745 val="$undef"
10746 fi
10747 set d_pwgecos
10748 eval $setvar
10749
10750 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10751 val="$define"
10752 else
10753 val="$undef"
10754 fi
10755 set d_pwpasswd
10756 eval $setvar
10757
10758 $rm -f $$.h
10759 ;;
10760*)
10761 val="$undef";
10762 set d_pwquota; eval $setvar
10763 set d_pwage; eval $setvar
10764 set d_pwchange; eval $setvar
10765 set d_pwclass; eval $setvar
10766 set d_pwexpire; eval $setvar
10767 set d_pwcomment; eval $setvar
10768 set d_pwgecos; eval $setvar
10769 set d_pwpasswd; eval $setvar
10770 ;;
10771esac
10772
10773: see if endpwent_r exists
10774set endpwent_r d_endpwent_r
10775eval $inlibc
10776case "$d_endpwent_r" in
10777"$define")
10778 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
10779 case "$d_endpwent_r_proto:$usethreads" in
10780 ":define") d_endpwent_r_proto=define
a48ec845
JH
10781 set d_endpwent_r_proto endpwent_r $hdrs
10782 eval $hasproto ;;
10783 *) ;;
10784 esac
10785 case "$d_endpwent_r_proto" in
10786 define)
10bc17b6
JH
10787 case "$endpwent_r_proto" in
10788 ''|0) try='int endpwent_r(FILE**);'
10789 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10790 esac
10791 case "$endpwent_r_proto" in
10792 ''|0) try='void endpwent_r(FILE**);'
10793 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10794 esac
10795 case "$endpwent_r_proto" in
90e831dc 10796 ''|0) d_endpwent_r=undef
10bc17b6 10797 endpwent_r_proto=0
a48ec845 10798 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10799 * ) case "$endpwent_r_proto" in
10800 REENTRANT_PROTO*) ;;
10801 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10802 esac
10803 echo "Prototype: $try" ;;
10804 esac
10805 ;;
c18e646a
JH
10806 *) case "$usethreads" in
10807 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10808 esac
90e831dc
SB
10809 d_endpwent_r=undef
10810 endpwent_r_proto=0
c18e646a 10811 ;;
a48ec845
JH
10812 esac
10813 ;;
10bc17b6
JH
10814*) endpwent_r_proto=0
10815 ;;
10816esac
10817
b4eb6b3d
JH
10818: see if endservent exists
10819set endservent d_endsent
10820eval $inlibc
10821
10bc17b6
JH
10822: see if endservent_r exists
10823set endservent_r d_endservent_r
10824eval $inlibc
10825case "$d_endservent_r" in
10826"$define")
10827 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
10828 case "$d_endservent_r_proto:$usethreads" in
10829 ":define") d_endservent_r_proto=define
a48ec845
JH
10830 set d_endservent_r_proto endservent_r $hdrs
10831 eval $hasproto ;;
10832 *) ;;
10833 esac
10834 case "$d_endservent_r_proto" in
10835 define)
10bc17b6
JH
10836 case "$endservent_r_proto" in
10837 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 10838 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
10839 esac
10840 case "$endservent_r_proto" in
10841 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 10842 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
10843 esac
10844 case "$endservent_r_proto" in
90e831dc 10845 ''|0) d_endservent_r=undef
10bc17b6 10846 endservent_r_proto=0
a48ec845 10847 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10848 * ) case "$endservent_r_proto" in
10849 REENTRANT_PROTO*) ;;
10850 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10851 esac
10852 echo "Prototype: $try" ;;
10853 esac
10854 ;;
c18e646a
JH
10855 *) case "$usethreads" in
10856 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10857 esac
90e831dc
SB
10858 d_endservent_r=undef
10859 endservent_r_proto=0
c18e646a 10860 ;;
a48ec845
JH
10861 esac
10862 ;;
10bc17b6
JH
10863*) endservent_r_proto=0
10864 ;;
10865esac
10866
b4eb6b3d
JH
10867: Locate the flags for 'open()'
10868echo " "
5440bc8e 10869$cat >try.c <<'EOCP'
b4eb6b3d
JH
10870#include <sys/types.h>
10871#ifdef I_FCNTL
10872#include <fcntl.h>
10873#endif
10874#ifdef I_SYS_FILE
10875#include <sys/file.h>
10876#endif
10877int main() {
10878 if(O_RDONLY);
10879#ifdef O_TRUNC
10880 exit(0);
10881#else
10882 exit(1);
10883#endif
10884}
10885EOCP
10886: check sys/file.h first to get FREAD on Sun
10887if $test `./findhdr sys/file.h` && \
5440bc8e 10888 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
10889 h_sysfile=true;
10890 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 10891 if $run ./try; then
b4eb6b3d
JH
10892 echo "and you have the 3 argument form of open()." >&4
10893 val="$define"
10894 else
10895 echo "but not the 3 argument form of open(). Oh, well." >&4
10896 val="$undef"
10897 fi
10898elif $test `./findhdr fcntl.h` && \
5440bc8e 10899 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
10900 h_fcntl=true;
10901 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 10902 if $run ./try; then
b4eb6b3d
JH
10903 echo "and you have the 3 argument form of open()." >&4
10904 val="$define"
10905 else
10906 echo "but not the 3 argument form of open(). Oh, well." >&4
10907 val="$undef"
10908 fi
10909else
10910 val="$undef"
10911 echo "I can't find the O_* constant definitions! You got problems." >&4
10912fi
10913set d_open3
10914eval $setvar
5440bc8e 10915$rm -f try try.*
b4eb6b3d
JH
10916
10917: see which of string.h or strings.h is needed
10918echo " "
10919strings=`./findhdr string.h`
10920if $test "$strings" && $test -r "$strings"; then
10921 echo "Using <string.h> instead of <strings.h>." >&4
10922 val="$define"
10923else
10924 val="$undef"
10925 strings=`./findhdr strings.h`
10926 if $test "$strings" && $test -r "$strings"; then
10927 echo "Using <strings.h> instead of <string.h>." >&4
10928 else
10929 echo "No string header found -- You'll surely have problems." >&4
10930 fi
10931fi
10932set i_string
10933eval $setvar
10934case "$i_string" in
10935"$undef") strings=`./findhdr strings.h`;;
10936*) strings=`./findhdr string.h`;;
10937esac
10938
3c728e00
JH
10939: see if this is a sys/file.h system
10940val=''
10941set sys/file.h val
10942eval $inhdr
10943
10944: do we need to include sys/file.h ?
10945case "$val" in
10946"$define")
10947 echo " "
10948 if $h_sysfile; then
10949 val="$define"
10950 echo "We'll be including <sys/file.h>." >&4
10951 else
10952 val="$undef"
10953 echo "We won't be including <sys/file.h>." >&4
10954 fi
10955 ;;
10956*)
10957 h_sysfile=false
10958 ;;
10959esac
10960set i_sysfile
10961eval $setvar
10962
10963: see if fcntl.h is there
10964val=''
10965set fcntl.h val
10966eval $inhdr
10967
10968: see if we can include fcntl.h
10969case "$val" in
10970"$define")
10971 echo " "
10972 if $h_fcntl; then
10973 val="$define"
10974 echo "We'll be including <fcntl.h>." >&4
10975 else
10976 val="$undef"
10977 if $h_sysfile; then
10978 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10979 else
10980 echo "We won't be including <fcntl.h>." >&4
10981 fi
10982 fi
10983 ;;
10984*)
10985 h_fcntl=false
10986 val="$undef"
10987 ;;
10988esac
10989set i_fcntl
10990eval $setvar
10991
b4eb6b3d
JH
10992: check for non-blocking I/O stuff
10993case "$h_sysfile" in
a0acbdc3
JH
10994true) echo "#include <sys/file.h>" > head.c;;
10995*)
10996 case "$h_fcntl" in
10997 true) echo "#include <fcntl.h>" > head.c;;
10998 *) echo "#include <sys/fcntl.h>" > head.c;;
10999 esac
11000 ;;
b4eb6b3d
JH
11001esac
11002echo " "
11003echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11004case "$o_nonblock" in
11005'')
11006 $cat head.c > try.c
3c728e00 11007 $cat >>try.c <<EOCP
b4eb6b3d 11008#include <stdio.h>
80b3ef99 11009#include <stdlib.h>
3c728e00
JH
11010#$i_fcntl I_FCNTL
11011#ifdef I_FCNTL
11012#include <fcntl.h>
11013#endif
b4eb6b3d
JH
11014int main() {
11015#ifdef O_NONBLOCK
11016 printf("O_NONBLOCK\n");
11017 exit(0);
11018#endif
11019#ifdef O_NDELAY
11020 printf("O_NDELAY\n");
11021 exit(0);
11022#endif
11023#ifdef FNDELAY
11024 printf("FNDELAY\n");
11025 exit(0);
11026#endif
11027 exit(0);
11028}
11029EOCP
11030 set try
11031 if eval $compile_ok; then
5440bc8e 11032 o_nonblock=`$run ./try`
b4eb6b3d
JH
11033 case "$o_nonblock" in
11034 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11035 *) echo "Seems like we can use $o_nonblock.";;
11036 esac
11037 else
11038 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11039 fi
11040 ;;
11041*) echo "Using $hint value $o_nonblock.";;
11042esac
11043$rm -f try try.* .out core
11044
11045echo " "
11046echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11047case "$eagain" in
11048'')
11049 $cat head.c > try.c
11050 $cat >>try.c <<EOCP
11051#include <errno.h>
11052#include <sys/types.h>
11053#include <signal.h>
11054#include <stdio.h>
80b3ef99 11055#include <stdlib.h>
1deb0a86
JH
11056#$i_fcntl I_FCNTL
11057#ifdef I_FCNTL
11058#include <fcntl.h>
11059#endif
b4eb6b3d
JH
11060#define MY_O_NONBLOCK $o_nonblock
11061#ifndef errno /* XXX need better Configure test */
11062extern int errno;
11063#endif
11064#$i_unistd I_UNISTD
11065#ifdef I_UNISTD
11066#include <unistd.h>
11067#endif
11068#$i_string I_STRING
11069#ifdef I_STRING
11070#include <string.h>
11071#else
11072#include <strings.h>
11073#endif
11074$signal_t blech(x) int x; { exit(3); }
11075EOCP
11076 $cat >> try.c <<'EOCP'
11077int main()
11078{
11079 int pd[2];
11080 int pu[2];
11081 char buf[1];
11082 char string[100];
11083
11084 pipe(pd); /* Down: child -> parent */
11085 pipe(pu); /* Up: parent -> child */
11086 if (0 != fork()) {
11087 int ret;
11088 close(pd[1]); /* Parent reads from pd[0] */
11089 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11090#ifdef F_SETFL
b4eb6b3d
JH
11091 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11092 exit(1);
a0acbdc3
JH
11093#else
11094 exit(4);
11095#endif
b4eb6b3d
JH
11096 signal(SIGALRM, blech);
11097 alarm(5);
11098 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11099 exit(2);
11100 sprintf(string, "%d\n", ret);
11101 write(2, string, strlen(string));
11102 alarm(0);
11103#ifdef EAGAIN
11104 if (errno == EAGAIN) {
11105 printf("EAGAIN\n");
11106 goto ok;
11107 }
11108#endif
11109#ifdef EWOULDBLOCK
11110 if (errno == EWOULDBLOCK)
11111 printf("EWOULDBLOCK\n");
11112#endif
11113 ok:
11114 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11115 sleep(2); /* Give it time to close our pipe */
11116 alarm(5);
11117 ret = read(pd[0], buf, 1); /* Should read EOF */
11118 alarm(0);
11119 sprintf(string, "%d\n", ret);
868439a2 11120 write(4, string, strlen(string));
b4eb6b3d
JH
11121 exit(0);
11122 }
11123
11124 close(pd[0]); /* We write to pd[1] */
11125 close(pu[1]); /* We read from pu[0] */
11126 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11127 close(pd[1]); /* Pipe pd is now fully closed! */
11128 exit(0); /* Bye bye, thank you for playing! */
11129}
11130EOCP
11131 set try
11132 if eval $compile_ok; then
11133 echo "$startsh" >mtry
868439a2 11134 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11135 chmod +x mtry
11136 ./mtry >/dev/null 2>&1
11137 case $? in
11138 0) eagain=`$cat try.out`;;
11139 1) echo "Could not perform non-blocking setting!";;
11140 2) echo "I did a successful read() for something that was not there!";;
11141 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11142 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11143 *) echo "Something terribly wrong happened during testing.";;
11144 esac
11145 rd_nodata=`$cat try.ret`
11146 echo "A read() system call with no data present returns $rd_nodata."
11147 case "$rd_nodata" in
11148 0|-1) ;;
11149 *)
11150 echo "(That's peculiar, fixing that to be -1.)"
11151 rd_nodata=-1
11152 ;;
11153 esac
11154 case "$eagain" in
11155 '')
11156 echo "Forcing errno EAGAIN on read() with no data available."
11157 eagain=EAGAIN
11158 ;;
11159 *)
11160 echo "Your read() sets errno to $eagain when no data is available."
11161 ;;
11162 esac
11163 status=`$cat try.err`
11164 case "$status" in
11165 0) echo "And it correctly returns 0 to signal EOF.";;
11166 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11167 *) echo "However, your read() returns '$status' on EOF??";;
11168 esac
11169 val="$define"
11170 if test "$status" = "$rd_nodata"; then
11171 echo "WARNING: you can't distinguish between EOF and no data!"
11172 val="$undef"
11173 fi
11174 else
11175 echo "I can't compile the test program--assuming errno EAGAIN will do."
11176 eagain=EAGAIN
11177 fi
11178 set d_eofnblk
11179 eval $setvar
11180 ;;
11181*)
11182 echo "Using $hint value $eagain."
11183 echo "Your read() returns $rd_nodata when no data is present."
11184 case "$d_eofnblk" in
11185 "$define") echo "And you can see EOF because read() returns 0.";;
11186 "$undef") echo "But you can't see EOF status from read() returned value.";;
11187 *)
11188 echo "(Assuming you can't see EOF status from read anyway.)"
11189 d_eofnblk=$undef
11190 ;;
11191 esac
11192 ;;
11193esac
11194$rm -f try try.* .out core head.c mtry
11195
b363b713
JH
11196: see if fchdir exists
11197set fchdir d_fchdir
11198eval $inlibc
11199
b4eb6b3d
JH
11200: see if fchmod exists
11201set fchmod d_fchmod
11202eval $inlibc
11203
11204: see if fchown exists
11205set fchown d_fchown
11206eval $inlibc
11207
11208: see if this is an fcntl system
11209set fcntl d_fcntl
11210eval $inlibc
11211
9d9004a9
AD
11212echo " "
11213: See if fcntl-based locking works.
832492ee 11214$cat >try.c <<EOCP
9d9004a9
AD
11215#include <stdlib.h>
11216#include <unistd.h>
11217#include <fcntl.h>
832492ee 11218#include <signal.h>
832492ee 11219$signal_t blech(x) int x; { exit(3); }
9d9004a9
AD
11220int main() {
11221#if defined(F_SETLK) && defined(F_SETLKW)
11222 struct flock flock;
11223 int retval, fd;
11224 fd = open("try.c", O_RDONLY);
11225 flock.l_type = F_RDLCK;
11226 flock.l_whence = SEEK_SET;
11227 flock.l_start = flock.l_len = 0;
832492ee
JH
11228 signal(SIGALRM, blech);
11229 alarm(10);
9d9004a9
AD
11230 retval = fcntl(fd, F_SETLK, &flock);
11231 close(fd);
11232 (retval < 0 ? exit(2) : exit(0));
11233#else
11234 exit(2);
11235#endif
11236}
11237EOCP
11238echo "Checking if fcntl-based file locking works... "
11239case "$d_fcntl" in
11240"$define")
11241 set try
11242 if eval $compile_ok; then
5440bc8e 11243 if $run ./try; then
9d9004a9
AD
11244 echo "Yes, it seems to work."
11245 val="$define"
11246 else
11247 echo "Nope, it didn't work."
11248 val="$undef"
832492ee
JH
11249 case "$?" in
11250 3) $cat >&4 <<EOM
11251***
11252*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11253*** This is (almost) impossible.
11254*** If your NFS lock daemons are not feeling well, something like
11255*** this may happen, please investigate. Cannot continue, aborting.
11256***
11257EOM
11258 exit 1
11259 ;;
11260 esac
9d9004a9
AD
11261 fi
11262 else
11263 echo "I'm unable to compile the test program, so I'll assume not."
11264 val="$undef"
11265 fi
11266 ;;
11267*) val="$undef";
11268 echo "Nope, since you don't even have fcntl()."
11269 ;;
11270esac
11271set d_fcntl_can_lock
11272eval $setvar
11273$rm -f try*
11274
11275
b4eb6b3d
JH
11276: check for fd_set items
11277$cat <<EOM
11278
11279Checking to see how well your C compiler handles fd_set and friends ...
11280EOM
5440bc8e 11281$cat >try.c <<EOCP
b4eb6b3d
JH
11282#$i_systime I_SYS_TIME
11283#$i_sysselct I_SYS_SELECT
11284#$d_socket HAS_SOCKET
11285#include <sys/types.h>
11286#ifdef HAS_SOCKET
11287#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11288#endif
11289#ifdef I_SYS_TIME
11290#include <sys/time.h>
11291#endif
11292#ifdef I_SYS_SELECT
11293#include <sys/select.h>
11294#endif
11295int main() {
11296 fd_set fds;
11297
11298#ifdef TRYBITS
11299 if(fds.fds_bits);
11300#endif
11301
11302#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11303 exit(0);
11304#else
11305 exit(1);
11306#endif
11307}
11308EOCP
5440bc8e 11309set try -DTRYBITS
b4eb6b3d
JH
11310if eval $compile; then
11311 d_fds_bits="$define"
11312 d_fd_set="$define"
11313 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 11314 if $run ./try; then
b4eb6b3d
JH
11315 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11316 d_fd_macros="$define"
11317 else
11318 $cat >&4 <<'EOM'
11319but not the normal fd_set macros! Gaaack! I'll have to cover for you.
11320EOM
11321 d_fd_macros="$undef"
11322 fi
11323else
11324 $cat <<'EOM'
11325Hmm, your compiler has some difficulty with fd_set. Checking further...
11326EOM
5440bc8e 11327 set try
b4eb6b3d
JH
11328 if eval $compile; then
11329 d_fds_bits="$undef"
11330 d_fd_set="$define"
11331 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 11332 if $run ./try; then
b4eb6b3d
JH
11333 echo "and you have the normal fd_set macros." >&4
11334 d_fd_macros="$define"
11335 else
11336 $cat <<'EOM'
11337but not the normal fd_set macros! Gross! More work for me...
11338EOM
11339 d_fd_macros="$undef"
11340 fi
11341 else
11342 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
11343 d_fd_set="$undef"
11344 d_fds_bits="$undef"
11345 d_fd_macros="$undef"
11346 fi
11347fi
5440bc8e 11348$rm -f try try.*
b4eb6b3d
JH
11349
11350: see if fgetpos exists
11351set fgetpos d_fgetpos
11352eval $inlibc
11353
758a5d79
JH
11354: see if finite exists
11355set finite d_finite
11356eval $inlibc
11357
11358: see if finitel exists
11359set finitel d_finitel
11360eval $inlibc
11361
b4eb6b3d
JH
11362: see if flock exists
11363set flock d_flock
11364eval $inlibc
11365
2ef53570
JH
11366: see if prototype for flock is available
11367echo " "
11368set d_flockproto flock $i_sysfile sys/file.h
11369eval $hasproto
11370
b4eb6b3d
JH
11371: see if fork exists
11372set fork d_fork
11373eval $inlibc
11374
758a5d79
JH
11375: see if fp_class exists
11376set fp_class d_fp_class
11377eval $inlibc
11378
b4eb6b3d
JH
11379: see if pathconf exists
11380set pathconf d_pathconf
11381eval $inlibc
11382
11383: see if fpathconf exists
11384set fpathconf d_fpathconf
11385eval $inlibc
11386
758a5d79
JH
11387: see if fpclass exists
11388set fpclass d_fpclass
11389eval $inlibc
11390
11391: see if fpclassify exists
11392set fpclassify d_fpclassify
11393eval $inlibc
11394
11395: see if fpclassl exists
11396set fpclassl d_fpclassl
11397eval $inlibc
11398
b4eb6b3d
JH
11399
11400: check for fpos64_t
11401echo " "
11402echo "Checking to see if you have fpos64_t..." >&4
11403$cat >try.c <<EOCP
11404#include <stdio.h>
11405int main() { fpos64_t x = 7; }
11406EOCP
11407set try
11408if eval $compile; then
11409 val="$define"
11410 echo "You have fpos64_t."
11411else
11412 val="$undef"
11413 echo "You do not have fpos64_t."
11414 case "$fpossize" in
11415 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11416 esac
11417fi
11418$rm -f try.* try
11419set d_fpos64_t
11420eval $setvar
11421
11422: see if frexpl exists
11423set frexpl d_frexpl
11424eval $inlibc
11425
b4eb6b3d
JH
11426: see if this is a sys/param system
11427set sys/param.h i_sysparam
11428eval $inhdr
11429
11430: see if this is a sys/mount.h system
11431set sys/mount.h i_sysmount
11432eval $inhdr
11433
b4eb6b3d
JH
11434
11435echo " "
11436echo "Checking to see if your system supports struct fs_data..." >&4
11437set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11438eval $hasstruct
11439case "$d_fs_data_s" in
11440"$define") echo "Yes, it does." ;;
11441*) echo "No, it doesn't." ;;
11442esac
11443
11444: see if fseeko exists
11445set fseeko d_fseeko
11446eval $inlibc
11447case "$longsize" in
114488) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11449esac
11450
11451: see if fsetpos exists
11452set fsetpos d_fsetpos
11453eval $inlibc
11454
11455
11456: see if fstatfs exists
11457set fstatfs d_fstatfs
11458eval $inlibc
11459
11460
11461: see if statvfs exists
11462set statvfs d_statvfs
11463eval $inlibc
11464
11465: see if fstatvfs exists
11466set fstatvfs d_fstatvfs
11467eval $inlibc
11468
11469
411ab01c
JH
11470: see if fsync exists
11471set fsync d_fsync
11472eval $inlibc
11473
b4eb6b3d
JH
11474: see if ftello exists
11475set ftello d_ftello
11476eval $inlibc
11477case "$longsize" in
114788) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11479esac
11480
11481: see if getcwd exists
11482set getcwd d_getcwd
11483eval $inlibc
11484
11485: see if getespwnam exists
11486set getespwnam d_getespwnam
11487eval $inlibc
11488
11489
11490: see if getfsstat exists
11491set getfsstat d_getfsstat
11492eval $inlibc
11493
11494: see if getgrent exists
11495set getgrent d_getgrent
11496eval $inlibc
11497
10bc17b6
JH
11498: see if getgrent_r exists
11499set getgrent_r d_getgrent_r
11500eval $inlibc
11501case "$d_getgrent_r" in
11502"$define")
11503 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11504 case "$d_getgrent_r_proto:$usethreads" in
11505 ":define") d_getgrent_r_proto=define
a48ec845
JH
11506 set d_getgrent_r_proto getgrent_r $hdrs
11507 eval $hasproto ;;
11508 *) ;;
11509 esac
11510 case "$d_getgrent_r_proto" in
11511 define)
10bc17b6
JH
11512 case "$getgrent_r_proto" in
11513 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11514 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11515 esac
11516 case "$getgrent_r_proto" in
11517 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11518 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11519 esac
11520 case "$getgrent_r_proto" in
11521 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11522 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11523 esac
11524 case "$getgrent_r_proto" in
11525 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11526 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11527 esac
11528 case "$getgrent_r_proto" in
11529 ''|0) try='int getgrent_r(struct group*, char*, int);'
11530 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11531 esac
11532 case "$getgrent_r_proto" in
11533 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11534 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11535 esac
11536 case "$getgrent_r_proto" in
90e831dc 11537 ''|0) d_getgrent_r=undef
10bc17b6 11538 getgrent_r_proto=0
a48ec845 11539 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11540 * ) case "$getgrent_r_proto" in
11541 REENTRANT_PROTO*) ;;
11542 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11543 esac
11544 echo "Prototype: $try" ;;
11545 esac
11546 ;;
c18e646a
JH
11547 *) case "$usethreads" in
11548 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11549 esac
90e831dc
SB
11550 d_getgrent_r=undef
11551 getgrent_r_proto=0
c18e646a 11552 ;;
a48ec845
JH
11553 esac
11554 ;;
10bc17b6
JH
11555*) getgrent_r_proto=0
11556 ;;
11557esac
11558
11559: see if getgrgid_r exists
11560set getgrgid_r d_getgrgid_r
11561eval $inlibc
11562case "$d_getgrgid_r" in
11563"$define")
11564 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11565 case "$d_getgrgid_r_proto:$usethreads" in
11566 ":define") d_getgrgid_r_proto=define
a48ec845
JH
11567 set d_getgrgid_r_proto getgrgid_r $hdrs
11568 eval $hasproto ;;
11569 *) ;;
11570 esac
11571 case "$d_getgrgid_r_proto" in
11572 define)
10bc17b6
JH
11573 case "$getgrgid_r_proto" in
11574 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11575 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11576 esac
11577 case "$getgrgid_r_proto" in
11578 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11579 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11580 esac
11581 case "$getgrgid_r_proto" in
11582 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11583 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11584 esac
11585 case "$getgrgid_r_proto" in
11586 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11587 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11588 esac
11589 case "$getgrgid_r_proto" in
90e831dc 11590 ''|0) d_getgrgid_r=undef
10bc17b6 11591 getgrgid_r_proto=0
a48ec845 11592 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11593 * ) case "$getgrgid_r_proto" in
11594 REENTRANT_PROTO*) ;;
11595 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11596 esac
11597 echo "Prototype: $try" ;;
11598 esac
11599 ;;
c18e646a
JH
11600 *) case "$usethreads" in
11601 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11602 esac
90e831dc
SB
11603 d_getgrgid_r=undef
11604 getgrgid_r_proto=0
c18e646a 11605 ;;
a48ec845
JH
11606 esac
11607 ;;
10bc17b6
JH
11608*) getgrgid_r_proto=0
11609 ;;
11610esac
11611
11612: see if getgrnam_r exists
11613set getgrnam_r d_getgrnam_r
11614eval $inlibc
11615case "$d_getgrnam_r" in
11616"$define")
11617 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11618 case "$d_getgrnam_r_proto:$usethreads" in
11619 ":define") d_getgrnam_r_proto=define
a48ec845
JH
11620 set d_getgrnam_r_proto getgrnam_r $hdrs
11621 eval $hasproto ;;
11622 *) ;;
11623 esac
11624 case "$d_getgrnam_r_proto" in
11625 define)
10bc17b6
JH
11626 case "$getgrnam_r_proto" in
11627 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11628 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11629 esac
11630 case "$getgrnam_r_proto" in
11631 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11632 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11633 esac
11634 case "$getgrnam_r_proto" in
11635 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11636 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11637 esac
11638 case "$getgrnam_r_proto" in
11639 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11640 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11641 esac
11642 case "$getgrnam_r_proto" in
11643 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11644 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11645 esac
11646 case "$getgrnam_r_proto" in
90e831dc 11647 ''|0) d_getgrnam_r=undef
10bc17b6 11648 getgrnam_r_proto=0
a48ec845 11649 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11650 * ) case "$getgrnam_r_proto" in
11651 REENTRANT_PROTO*) ;;
11652 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11653 esac
11654 echo "Prototype: $try" ;;
11655 esac
11656 ;;
c18e646a
JH
11657 *) case "$usethreads" in
11658 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11659 esac
90e831dc
SB
11660 d_getgrnam_r=undef
11661 getgrnam_r_proto=0
c18e646a 11662 ;;
a48ec845
JH
11663 esac
11664 ;;
10bc17b6
JH
11665*) getgrnam_r_proto=0
11666 ;;
11667esac
11668
b4eb6b3d
JH
11669: see if gethostbyaddr exists
11670set gethostbyaddr d_gethbyaddr
11671eval $inlibc
11672
11673: see if gethostbyname exists
11674set gethostbyname d_gethbyname
11675eval $inlibc
11676
11677: see if gethostent exists
11678set gethostent d_gethent
11679eval $inlibc
11680
11681: see how we will look up host name
11682echo " "
11683call=''
11684if set gethostname val -f d_gethname; eval $csym; $val; then
11685 echo 'gethostname() found.' >&4
11686 d_gethname="$define"
11687 call=gethostname
11688fi
11689if set uname val -f d_uname; eval $csym; $val; then
11690 if ./xenix; then
11691 $cat <<'EOM'
11692uname() was found, but you're running xenix, and older versions of xenix
11693have a broken uname(). If you don't really know whether your xenix is old
11694enough to have a broken system call, use the default answer.
11695
11696EOM
11697 dflt=y
11698 case "$d_uname" in
11699 "$define") dflt=n;;
11700 esac
11701 rp='Is your uname() broken?'
11702 . ./myread
11703 case "$ans" in
11704 n*) d_uname="$define"; call=uname;;
11705 esac
11706 else
11707 echo 'uname() found.' >&4
11708 d_uname="$define"
11709 case "$call" in
11710 '') call=uname ;;
11711 esac
11712 fi
11713fi
11714case "$d_gethname" in
11715'') d_gethname="$undef";;
11716esac
11717case "$d_uname" in
11718'') d_uname="$undef";;
11719esac
11720case "$d_uname$d_gethname" in
11721*define*)
11722 dflt=n
11723 cat <<EOM
11724
11725Every now and then someone has a $call() that lies about the hostname
11726but can't be fixed for political or economic reasons. If you wish, I can
11727pretend $call() isn't there and maybe compute hostname at run-time
11728thanks to the '$phostname' command.
11729
11730EOM
11731 rp="Shall I ignore $call() from now on?"
11732 . ./myread
11733 case "$ans" in
11734 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11735 esac;;
11736esac
11737case "$phostname" in
11738'') aphostname='';;
11739*) case "$aphostname" in
11740 /*) ;;
11741 *) set X $phostname
11742 shift
11743 file=$1
11744 shift
11745 file=`./loc $file $file $pth`
11746 aphostname=`echo $file $*`
11747 ;;
11748 esac
11749 ;;
11750esac
11751case "$d_uname$d_gethname" in
11752*define*) ;;
11753*)
11754 case "$phostname" in
11755 '')
11756 echo "There will be no way for $package to get your hostname." >&4;;
11757 *)
11758 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11759 ;;
11760 esac;;
11761esac
11762case "$d_phostname" in
11763'') d_phostname="$undef";;
11764esac
11765
10bc17b6
JH
11766: see if gethostbyaddr_r exists
11767set gethostbyaddr_r d_gethostbyaddr_r
11768eval $inlibc
11769case "$d_gethostbyaddr_r" in
11770"$define")
11771 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11772 case "$d_gethostbyaddr_r_proto:$usethreads" in
11773 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
11774 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11775 eval $hasproto ;;
11776 *) ;;
11777 esac
11778 case "$d_gethostbyaddr_r_proto" in
11779 define)
10bc17b6
JH
11780 case "$gethostbyaddr_r_proto" in
11781 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11782 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11783 esac
11784 case "$gethostbyaddr_r_proto" in
11785 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11786 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11787 esac
11788 case "$gethostbyaddr_r_proto" in
11789 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11790 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11791 esac
11792 case "$gethostbyaddr_r_proto" in
11793 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11794 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11795 esac
11796 case "$gethostbyaddr_r_proto" in
11797 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11798 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11799 esac
11800 case "$gethostbyaddr_r_proto" in
11801 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11802 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11803 esac
11804 case "$gethostbyaddr_r_proto" in
11805 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11806 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11807 esac
11808 case "$gethostbyaddr_r_proto" in
11809 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11810 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11811 esac
11812 case "$gethostbyaddr_r_proto" in
11813 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11814 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11815 esac
11816 case "$gethostbyaddr_r_proto" in
11817 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11818 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11819 esac
11820 case "$gethostbyaddr_r_proto" in
90e831dc 11821 ''|0) d_gethostbyaddr_r=undef
10bc17b6 11822 gethostbyaddr_r_proto=0
a48ec845 11823 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11824 * ) case "$gethostbyaddr_r_proto" in
11825 REENTRANT_PROTO*) ;;
11826 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11827 esac
11828 echo "Prototype: $try" ;;
11829 esac
11830 ;;
c18e646a
JH
11831 *) case "$usethreads" in
11832 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11833 esac
90e831dc
SB
11834 d_gethostbyaddr_r=undef
11835 gethostbyaddr_r_proto=0
c18e646a 11836 ;;
a48ec845
JH
11837 esac
11838 ;;
10bc17b6
JH
11839*) gethostbyaddr_r_proto=0
11840 ;;
11841esac
11842
11843: see if gethostbyname_r exists
11844set gethostbyname_r d_gethostbyname_r
11845eval $inlibc
11846case "$d_gethostbyname_r" in
11847"$define")
11848 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11849 case "$d_gethostbyname_r_proto:$usethreads" in
11850 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
11851 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11852 eval $hasproto ;;
11853 *) ;;
11854 esac
11855 case "$d_gethostbyname_r_proto" in
11856 define)
10bc17b6
JH
11857 case "$gethostbyname_r_proto" in
11858 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11859 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11860 esac
11861 case "$gethostbyname_r_proto" in
11862 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11863 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11864 esac
11865 case "$gethostbyname_r_proto" in
11866 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11867 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11868 esac
11869 case "$gethostbyname_r_proto" in
90e831dc 11870 ''|0) d_gethostbyname_r=undef
10bc17b6 11871 gethostbyname_r_proto=0
a48ec845 11872 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11873 * ) case "$gethostbyname_r_proto" in
11874 REENTRANT_PROTO*) ;;
11875 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11876 esac
11877 echo "Prototype: $try" ;;
11878 esac
11879 ;;
c18e646a
JH
11880 *) case "$usethreads" in
11881 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11882 esac
90e831dc
SB
11883 d_gethostbyname_r=undef
11884 gethostbyname_r_proto=0
c18e646a 11885 ;;
a48ec845
JH
11886 esac
11887 ;;
10bc17b6
JH
11888*) gethostbyname_r_proto=0
11889 ;;
11890esac
11891
11892: see if gethostent_r exists
11893set gethostent_r d_gethostent_r
11894eval $inlibc
11895case "$d_gethostent_r" in
11896"$define")
11897 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11898 case "$d_gethostent_r_proto:$usethreads" in
11899 ":define") d_gethostent_r_proto=define
a48ec845
JH
11900 set d_gethostent_r_proto gethostent_r $hdrs
11901 eval $hasproto ;;
11902 *) ;;
11903 esac
11904 case "$d_gethostent_r_proto" in
11905 define)
10bc17b6
JH
11906 case "$gethostent_r_proto" in
11907 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11908 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11909 esac
11910 case "$gethostent_r_proto" in
11911 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11912 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11913 esac
11914 case "$gethostent_r_proto" in
11915 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11916 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11917 esac
11918 case "$gethostent_r_proto" in
11919 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11920 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11921 esac
11922 case "$gethostent_r_proto" in
11923 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11924 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11925 esac
11926 case "$gethostent_r_proto" in
11927 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11928 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11929 esac
11930 case "$gethostent_r_proto" in
90e831dc 11931 ''|0) d_gethostent_r=undef
10bc17b6 11932 gethostent_r_proto=0
a48ec845 11933 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11934 * ) case "$gethostent_r_proto" in
11935 REENTRANT_PROTO*) ;;
11936 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11937 esac
11938 echo "Prototype: $try" ;;
11939 esac
11940 ;;
c18e646a
JH
11941 *) case "$usethreads" in
11942 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11943 esac
90e831dc
SB
11944 d_gethostent_r=undef
11945 gethostent_r_proto=0
c18e646a 11946 ;;
a48ec845
JH
11947 esac
11948 ;;
10bc17b6
JH
11949*) gethostent_r_proto=0
11950 ;;
11951esac
b4eb6b3d
JH
11952
11953: see if prototypes for various gethostxxx netdb.h functions are available
11954echo " "
11955set d_gethostprotos gethostent $i_netdb netdb.h
11956eval $hasproto
11957
4e0554ec
JH
11958: see if getitimer exists
11959set getitimer d_getitimer
11960eval $inlibc
11961
b4eb6b3d
JH
11962: see if getlogin exists
11963set getlogin d_getlogin
11964eval $inlibc
11965
10bc17b6
JH
11966: see if getlogin_r exists
11967set getlogin_r d_getlogin_r
11968eval $inlibc
11969case "$d_getlogin_r" in
11970"$define")
11971 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
11972 case "$d_getlogin_r_proto:$usethreads" in
11973 ":define") d_getlogin_r_proto=define
a48ec845
JH
11974 set d_getlogin_r_proto getlogin_r $hdrs
11975 eval $hasproto ;;
11976 *) ;;
11977 esac
11978 case "$d_getlogin_r_proto" in
11979 define)
10bc17b6
JH
11980 case "$getlogin_r_proto" in
11981 ''|0) try='int getlogin_r(char*, size_t);'
11982 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11983 esac
11984 case "$getlogin_r_proto" in
11985 ''|0) try='int getlogin_r(char*, int);'
11986 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11987 esac
11988 case "$getlogin_r_proto" in
11989 ''|0) try='char* getlogin_r(char*, size_t);'
11990 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11991 esac
11992 case "$getlogin_r_proto" in
11993 ''|0) try='char* getlogin_r(char*, int);'
11994 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11995 esac
11996 case "$getlogin_r_proto" in
90e831dc 11997 ''|0) d_getlogin_r=undef
10bc17b6 11998 getlogin_r_proto=0
a48ec845 11999 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12000 * ) case "$getlogin_r_proto" in
12001 REENTRANT_PROTO*) ;;
12002 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12003 esac
12004 echo "Prototype: $try" ;;
12005 esac
12006 ;;
c18e646a
JH
12007 *) case "$usethreads" in
12008 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12009 esac
90e831dc
SB
12010 d_getlogin_r=undef
12011 getlogin_r_proto=0
c18e646a 12012 ;;
a48ec845
JH
12013 esac
12014 ;;
10bc17b6
JH
12015*) getlogin_r_proto=0
12016 ;;
12017esac
12018
b4eb6b3d
JH
12019: see if getmnt exists
12020set getmnt d_getmnt
12021eval $inlibc
12022
12023: see if getmntent exists
12024set getmntent d_getmntent
12025eval $inlibc
12026
12027: see if getnetbyaddr exists
12028set getnetbyaddr d_getnbyaddr
12029eval $inlibc
12030
12031: see if getnetbyname exists
12032set getnetbyname d_getnbyname
12033eval $inlibc
12034
12035: see if getnetent exists
12036set getnetent d_getnent
12037eval $inlibc
12038
10bc17b6
JH
12039: see if getnetbyaddr_r exists
12040set getnetbyaddr_r d_getnetbyaddr_r
12041eval $inlibc
12042case "$d_getnetbyaddr_r" in
12043"$define")
12044 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12045 case "$d_getnetbyaddr_r_proto:$usethreads" in
12046 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
12047 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12048 eval $hasproto ;;
12049 *) ;;
12050 esac
12051 case "$d_getnetbyaddr_r_proto" in
12052 define)
10bc17b6
JH
12053 case "$getnetbyaddr_r_proto" in
12054 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12055 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12056 esac
12057 case "$getnetbyaddr_r_proto" in
12058 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12059 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12060 esac
12061 case "$getnetbyaddr_r_proto" in
12062 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12063 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12064 esac
12065 case "$getnetbyaddr_r_proto" in
12066 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12067 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12068 esac
12069 case "$getnetbyaddr_r_proto" in
12070 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12071 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12072 esac
12073 case "$getnetbyaddr_r_proto" in
12074 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12075 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12076 esac
12077 case "$getnetbyaddr_r_proto" in
12078 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12079 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12080 esac
12081 case "$getnetbyaddr_r_proto" in
90e831dc 12082 ''|0) d_getnetbyaddr_r=undef
10bc17b6 12083 getnetbyaddr_r_proto=0
a48ec845 12084 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12085 * ) case "$getnetbyaddr_r_proto" in
12086 REENTRANT_PROTO*) ;;
12087 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12088 esac
12089 echo "Prototype: $try" ;;
12090 esac
12091 ;;
c18e646a
JH
12092 *) case "$usethreads" in
12093 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12094 esac
90e831dc
SB
12095 d_getnetbyaddr_r=undef
12096 getnetbyaddr_r_proto=0
c18e646a 12097 ;;
a48ec845
JH
12098 esac
12099 ;;
10bc17b6
JH
12100*) getnetbyaddr_r_proto=0
12101 ;;
12102esac
12103
12104: see if getnetbyname_r exists
12105set getnetbyname_r d_getnetbyname_r
12106eval $inlibc
12107case "$d_getnetbyname_r" in
12108"$define")
12109 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12110 case "$d_getnetbyname_r_proto:$usethreads" in
12111 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
12112 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12113 eval $hasproto ;;
12114 *) ;;
12115 esac
12116 case "$d_getnetbyname_r_proto" in
12117 define)
10bc17b6
JH
12118 case "$getnetbyname_r_proto" in
12119 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12120 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12121 esac
12122 case "$getnetbyname_r_proto" in
12123 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12124 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12125 esac
12126 case "$getnetbyname_r_proto" in
12127 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12128 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12129 esac
12130 case "$getnetbyname_r_proto" in
12131 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12132 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12133 esac
12134 case "$getnetbyname_r_proto" in
90e831dc 12135 ''|0) d_getnetbyname_r=undef
10bc17b6 12136 getnetbyname_r_proto=0
a48ec845 12137 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12138 * ) case "$getnetbyname_r_proto" in
12139 REENTRANT_PROTO*) ;;
12140 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12141 esac
12142 echo "Prototype: $try" ;;
12143 esac
12144 ;;
c18e646a
JH
12145 *) case "$usethreads" in
12146 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12147 esac
90e831dc
SB
12148 d_getnetbyname_r=undef
12149 getnetbyname_r_proto=0
c18e646a 12150 ;;
a48ec845
JH
12151 esac
12152 ;;
10bc17b6
JH
12153*) getnetbyname_r_proto=0
12154 ;;
12155esac
12156
12157: see if getnetent_r exists
12158set getnetent_r d_getnetent_r
12159eval $inlibc
12160case "$d_getnetent_r" in
12161"$define")
12162 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12163 case "$d_getnetent_r_proto:$usethreads" in
12164 ":define") d_getnetent_r_proto=define
a48ec845
JH
12165 set d_getnetent_r_proto getnetent_r $hdrs
12166 eval $hasproto ;;
12167 *) ;;
12168 esac
12169 case "$d_getnetent_r_proto" in
12170 define)
10bc17b6
JH
12171 case "$getnetent_r_proto" in
12172 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12173 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12174 esac
12175 case "$getnetent_r_proto" in
12176 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12177 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12178 esac
12179 case "$getnetent_r_proto" in
12180 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12181 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12182 esac
12183 case "$getnetent_r_proto" in
12184 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12185 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12186 esac
12187 case "$getnetent_r_proto" in
12188 ''|0) try='int getnetent_r(struct netent*, char*, int);'
12189 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12190 esac
12191 case "$getnetent_r_proto" in
12192 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12193 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12194 esac
12195 case "$getnetent_r_proto" in
90e831dc 12196 ''|0) d_getnetent_r=undef
10bc17b6 12197 getnetent_r_proto=0
a48ec845 12198 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12199 * ) case "$getnetent_r_proto" in
12200 REENTRANT_PROTO*) ;;
12201 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12202 esac
12203 echo "Prototype: $try" ;;
12204 esac
12205 ;;
c18e646a
JH
12206 *) case "$usethreads" in
12207 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12208 esac
90e831dc
SB
12209 d_getnetent_r=undef
12210 getnetent_r_proto=0
c18e646a 12211 ;;
a48ec845
JH
12212 esac
12213 ;;
10bc17b6
JH
12214*) getnetent_r_proto=0
12215 ;;
12216esac
12217
b4eb6b3d
JH
12218: see if prototypes for various getnetxxx netdb.h functions are available
12219echo " "
12220set d_getnetprotos getnetent $i_netdb netdb.h
12221eval $hasproto
12222
0c0643d0
JH
12223: see if getpagesize exists
12224set getpagesize d_getpagsz
12225eval $inlibc
12226
b4eb6b3d
JH
12227
12228: see if getprotobyname exists
12229set getprotobyname d_getpbyname
12230eval $inlibc
12231
12232: see if getprotobynumber exists
12233set getprotobynumber d_getpbynumber
12234eval $inlibc
12235
12236: see if getprotoent exists
12237set getprotoent d_getpent
12238eval $inlibc
12239
12240: see if getpgid exists
12241set getpgid d_getpgid
12242eval $inlibc
12243
12244: see if getpgrp2 exists
12245set getpgrp2 d_getpgrp2
12246eval $inlibc
12247
12248: see if getppid exists
12249set getppid d_getppid
12250eval $inlibc
12251
12252: see if getpriority exists
12253set getpriority d_getprior
12254eval $inlibc
12255
10bc17b6
JH
12256: see if getprotobyname_r exists
12257set getprotobyname_r d_getprotobyname_r
12258eval $inlibc
12259case "$d_getprotobyname_r" in
12260"$define")
12261 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12262 case "$d_getprotobyname_r_proto:$usethreads" in
12263 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
12264 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12265 eval $hasproto ;;
12266 *) ;;
12267 esac
12268 case "$d_getprotobyname_r_proto" in
12269 define)
10bc17b6
JH
12270 case "$getprotobyname_r_proto" in
12271 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12272 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12273 esac
12274 case "$getprotobyname_r_proto" in
12275 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12276 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12277 esac
12278 case "$getprotobyname_r_proto" in
12279 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12280 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12281 esac
12282 case "$getprotobyname_r_proto" in
90e831dc 12283 ''|0) d_getprotobyname_r=undef
10bc17b6 12284 getprotobyname_r_proto=0
a48ec845 12285 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12286 * ) case "$getprotobyname_r_proto" in
12287 REENTRANT_PROTO*) ;;
12288 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12289 esac
12290 echo "Prototype: $try" ;;
12291 esac
12292 ;;
c18e646a
JH
12293 *) case "$usethreads" in
12294 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12295 esac
90e831dc
SB
12296 d_getprotobyname_r=undef
12297 getprotobyname_r_proto=0
c18e646a 12298 ;;
a48ec845
JH
12299 esac
12300 ;;
10bc17b6
JH
12301*) getprotobyname_r_proto=0
12302 ;;
12303esac
12304
12305: see if getprotobynumber_r exists
12306set getprotobynumber_r d_getprotobynumber_r
12307eval $inlibc
12308case "$d_getprotobynumber_r" in
12309"$define")
12310 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12311 case "$d_getprotobynumber_r_proto:$usethreads" in
12312 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
12313 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12314 eval $hasproto ;;
12315 *) ;;
12316 esac
12317 case "$d_getprotobynumber_r_proto" in
12318 define)
10bc17b6
JH
12319 case "$getprotobynumber_r_proto" in
12320 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12321 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12322 esac
12323 case "$getprotobynumber_r_proto" in
12324 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12325 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12326 esac
12327 case "$getprotobynumber_r_proto" in
12328 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12329 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12330 esac
12331 case "$getprotobynumber_r_proto" in
90e831dc 12332 ''|0) d_getprotobynumber_r=undef
10bc17b6 12333 getprotobynumber_r_proto=0
a48ec845 12334 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12335 * ) case "$getprotobynumber_r_proto" in
12336 REENTRANT_PROTO*) ;;
12337 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12338 esac
12339 echo "Prototype: $try" ;;
12340 esac
12341 ;;
c18e646a
JH
12342 *) case "$usethreads" in
12343 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12344 esac
90e831dc
SB
12345 d_getprotobynumber_r=undef
12346 getprotobynumber_r_proto=0
c18e646a 12347 ;;
a48ec845
JH
12348 esac
12349 ;;
10bc17b6
JH
12350*) getprotobynumber_r_proto=0
12351 ;;
12352esac
12353
12354: see if getprotoent_r exists
12355set getprotoent_r d_getprotoent_r
12356eval $inlibc
12357case "$d_getprotoent_r" in
12358"$define")
12359 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12360 case "$d_getprotoent_r_proto:$usethreads" in
12361 ":define") d_getprotoent_r_proto=define
a48ec845
JH
12362 set d_getprotoent_r_proto getprotoent_r $hdrs
12363 eval $hasproto ;;
12364 *) ;;
12365 esac
12366 case "$d_getprotoent_r_proto" in
12367 define)
10bc17b6
JH
12368 case "$getprotoent_r_proto" in
12369 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12370 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12371 esac
12372 case "$getprotoent_r_proto" in
12373 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12374 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12375 esac
12376 case "$getprotoent_r_proto" in
12377 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12378 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12379 esac
12380 case "$getprotoent_r_proto" in
12381 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12382 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12383 esac
12384 case "$getprotoent_r_proto" in
90e831dc 12385 ''|0) d_getprotoent_r=undef
10bc17b6 12386 getprotoent_r_proto=0
a48ec845 12387 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12388 * ) case "$getprotoent_r_proto" in
12389 REENTRANT_PROTO*) ;;
12390 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12391 esac
12392 echo "Prototype: $try" ;;
12393 esac
12394 ;;
c18e646a
JH
12395 *) case "$usethreads" in
12396 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12397 esac
90e831dc
SB
12398 d_getprotoent_r=undef
12399 getprotoent_r_proto=0
c18e646a 12400 ;;
a48ec845
JH
12401 esac
12402 ;;
10bc17b6
JH
12403*) getprotoent_r_proto=0
12404 ;;
12405esac
12406
b4eb6b3d
JH
12407: see if prototypes for various getprotoxxx netdb.h functions are available
12408echo " "
12409set d_getprotoprotos getprotoent $i_netdb netdb.h
12410eval $hasproto
12411
12412: see if getprpwnam exists
12413set getprpwnam d_getprpwnam
12414eval $inlibc
12415
12416: see if getpwent exists
12417set getpwent d_getpwent
12418eval $inlibc
12419
10bc17b6
JH
12420: see if getpwent_r exists
12421set getpwent_r d_getpwent_r
12422eval $inlibc
12423case "$d_getpwent_r" in
12424"$define")
12425 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12426 case "$d_getpwent_r_proto:$usethreads" in
12427 ":define") d_getpwent_r_proto=define
a48ec845
JH
12428 set d_getpwent_r_proto getpwent_r $hdrs
12429 eval $hasproto ;;
12430 *) ;;
12431 esac
12432 case "$d_getpwent_r_proto" in
12433 define)
10bc17b6
JH
12434 case "$getpwent_r_proto" in
12435 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12436 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12437 esac
12438 case "$getpwent_r_proto" in
12439 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12440 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12441 esac
12442 case "$getpwent_r_proto" in
12443 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12444 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12445 esac
12446 case "$getpwent_r_proto" in
12447 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12448 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12449 esac
12450 case "$getpwent_r_proto" in
12451 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12452 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12453 esac
12454 case "$getpwent_r_proto" in
12455 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12456 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12457 esac
12458 case "$getpwent_r_proto" in
90e831dc 12459 ''|0) d_getpwent_r=undef
10bc17b6 12460 getpwent_r_proto=0
a48ec845 12461 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12462 * ) case "$getpwent_r_proto" in
12463 REENTRANT_PROTO*) ;;
12464 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12465 esac
12466 echo "Prototype: $try" ;;
12467 esac
12468 ;;
c18e646a
JH
12469 *) case "$usethreads" in
12470 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12471 esac
90e831dc
SB
12472 d_getpwent_r=undef
12473 getpwent_r_proto=0
c18e646a 12474 ;;
a48ec845
JH
12475 esac
12476 ;;
10bc17b6
JH
12477*) getpwent_r_proto=0
12478 ;;
12479esac
12480
12481: see if getpwnam_r exists
12482set getpwnam_r d_getpwnam_r
12483eval $inlibc
12484case "$d_getpwnam_r" in
12485"$define")
12486 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12487 case "$d_getpwnam_r_proto:$usethreads" in
12488 ":define") d_getpwnam_r_proto=define
a48ec845
JH
12489 set d_getpwnam_r_proto getpwnam_r $hdrs
12490 eval $hasproto ;;
12491 *) ;;
12492 esac
12493 case "$d_getpwnam_r_proto" in
12494 define)
10bc17b6
JH
12495 case "$getpwnam_r_proto" in
12496 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12497 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12498 esac
12499 case "$getpwnam_r_proto" in
12500 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12501 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12502 esac
12503 case "$getpwnam_r_proto" in
12504 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12505 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12506 esac
12507 case "$getpwnam_r_proto" in
12508 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12509 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12510 esac
12511 case "$getpwnam_r_proto" in
90e831dc 12512 ''|0) d_getpwnam_r=undef
10bc17b6 12513 getpwnam_r_proto=0
a48ec845 12514 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12515 * ) case "$getpwnam_r_proto" in
12516 REENTRANT_PROTO*) ;;
12517 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12518 esac
12519 echo "Prototype: $try" ;;
12520 esac
12521 ;;
c18e646a
JH
12522 *) case "$usethreads" in
12523 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12524 esac
90e831dc
SB
12525 d_getpwnam_r=undef
12526 getpwnam_r_proto=0
c18e646a 12527 ;;
a48ec845
JH
12528 esac
12529 ;;
10bc17b6
JH
12530*) getpwnam_r_proto=0
12531 ;;
12532esac
12533
12534: see if getpwuid_r exists
12535set getpwuid_r d_getpwuid_r
12536eval $inlibc
12537case "$d_getpwuid_r" in
12538"$define")
12539 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12540 case "$d_getpwuid_r_proto:$usethreads" in
12541 ":define") d_getpwuid_r_proto=define
a48ec845
JH
12542 set d_getpwuid_r_proto getpwuid_r $hdrs
12543 eval $hasproto ;;
12544 *) ;;
12545 esac
12546 case "$d_getpwuid_r_proto" in
12547 define)
10bc17b6
JH
12548 case "$getpwuid_r_proto" in
12549 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12550 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12551 esac
12552 case "$getpwuid_r_proto" in
12553 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12554 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12555 esac
12556 case "$getpwuid_r_proto" in
12557 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12558 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12559 esac
12560 case "$getpwuid_r_proto" in
12561 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12562 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12563 esac
12564 case "$getpwuid_r_proto" in
90e831dc 12565 ''|0) d_getpwuid_r=undef
10bc17b6 12566 getpwuid_r_proto=0
a48ec845 12567 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12568 * ) case "$getpwuid_r_proto" in
12569 REENTRANT_PROTO*) ;;
12570 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12571 esac
12572 echo "Prototype: $try" ;;
12573 esac
12574 ;;
c18e646a
JH
12575 *) case "$usethreads" in
12576 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12577 esac
90e831dc
SB
12578 d_getpwuid_r=undef
12579 getpwuid_r_proto=0
c18e646a 12580 ;;
a48ec845
JH
12581 esac
12582 ;;
10bc17b6
JH
12583*) getpwuid_r_proto=0
12584 ;;
12585esac
12586
b4eb6b3d
JH
12587
12588: see if getservbyname exists
12589set getservbyname d_getsbyname
12590eval $inlibc
12591
12592: see if getservbyport exists
12593set getservbyport d_getsbyport
12594eval $inlibc
12595
12596: see if getservent exists
12597set getservent d_getsent
12598eval $inlibc
12599
10bc17b6
JH
12600: see if getservbyname_r exists
12601set getservbyname_r d_getservbyname_r
12602eval $inlibc
12603case "$d_getservbyname_r" in
12604"$define")
12605 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12606 case "$d_getservbyname_r_proto:$usethreads" in
12607 ":define") d_getservbyname_r_proto=define
a48ec845
JH
12608 set d_getservbyname_r_proto getservbyname_r $hdrs
12609 eval $hasproto ;;
12610 *) ;;
12611 esac
12612 case "$d_getservbyname_r_proto" in
12613 define)
10bc17b6
JH
12614 case "$getservbyname_r_proto" in
12615 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12616 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12617 esac
12618 case "$getservbyname_r_proto" in
12619 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12620 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12621 esac
12622 case "$getservbyname_r_proto" in
12623 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12624 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12625 esac
12626 case "$getservbyname_r_proto" in
90e831dc 12627 ''|0) d_getservbyname_r=undef
10bc17b6 12628 getservbyname_r_proto=0
a48ec845 12629 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12630 * ) case "$getservbyname_r_proto" in
12631 REENTRANT_PROTO*) ;;
12632 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12633 esac
12634 echo "Prototype: $try" ;;
12635 esac
12636 ;;
c18e646a
JH
12637 *) case "$usethreads" in
12638 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12639 esac
90e831dc
SB
12640 d_getservbyname_r=undef
12641 getservbyname_r_proto=0
c18e646a 12642 ;;
a48ec845
JH
12643 esac
12644 ;;
10bc17b6
JH
12645*) getservbyname_r_proto=0
12646 ;;
12647esac
12648
12649: see if getservbyport_r exists
12650set getservbyport_r d_getservbyport_r
12651eval $inlibc
12652case "$d_getservbyport_r" in
12653"$define")
12654 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12655 case "$d_getservbyport_r_proto:$usethreads" in
12656 ":define") d_getservbyport_r_proto=define
a48ec845
JH
12657 set d_getservbyport_r_proto getservbyport_r $hdrs
12658 eval $hasproto ;;
12659 *) ;;
12660 esac
12661 case "$d_getservbyport_r_proto" in
12662 define)
10bc17b6
JH
12663 case "$getservbyport_r_proto" in
12664 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12665 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12666 esac
12667 case "$getservbyport_r_proto" in
12668 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12669 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12670 esac
12671 case "$getservbyport_r_proto" in
12672 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12673 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12674 esac
12675 case "$getservbyport_r_proto" in
90e831dc 12676 ''|0) d_getservbyport_r=undef
10bc17b6 12677 getservbyport_r_proto=0
a48ec845 12678 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12679 * ) case "$getservbyport_r_proto" in
12680 REENTRANT_PROTO*) ;;
12681 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12682 esac
12683 echo "Prototype: $try" ;;
12684 esac
12685 ;;
c18e646a
JH
12686 *) case "$usethreads" in
12687 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12688 esac
90e831dc
SB
12689 d_getservbyport_r=undef
12690 getservbyport_r_proto=0
c18e646a 12691 ;;
a48ec845
JH
12692 esac
12693 ;;
10bc17b6
JH
12694*) getservbyport_r_proto=0
12695 ;;
12696esac
12697
12698: see if getservent_r exists
12699set getservent_r d_getservent_r
12700eval $inlibc
12701case "$d_getservent_r" in
12702"$define")
12703 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12704 case "$d_getservent_r_proto:$usethreads" in
12705 ":define") d_getservent_r_proto=define
a48ec845
JH
12706 set d_getservent_r_proto getservent_r $hdrs
12707 eval $hasproto ;;
12708 *) ;;
12709 esac
12710 case "$d_getservent_r_proto" in
12711 define)
10bc17b6
JH
12712 case "$getservent_r_proto" in
12713 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12714 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12715 esac
12716 case "$getservent_r_proto" in
12717 ''|0) try='int getservent_r(struct servent*, char*, int);'
12718 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12719 esac
12720 case "$getservent_r_proto" in
12721 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12722 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12723 esac
12724 case "$getservent_r_proto" in
12725 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12726 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12727 esac
12728 case "$getservent_r_proto" in
90e831dc 12729 ''|0) d_getservent_r=undef
10bc17b6 12730 getservent_r_proto=0
a48ec845 12731 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12732 * ) case "$getservent_r_proto" in
12733 REENTRANT_PROTO*) ;;
12734 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12735 esac
12736 echo "Prototype: $try" ;;
12737 esac
12738 ;;
c18e646a
JH
12739 *) case "$usethreads" in
12740 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12741 esac
90e831dc
SB
12742 d_getservent_r=undef
12743 getservent_r_proto=0
c18e646a 12744 ;;
a48ec845
JH
12745 esac
12746 ;;
10bc17b6
JH
12747*) getservent_r_proto=0
12748 ;;
12749esac
12750
b4eb6b3d
JH
12751: see if prototypes for various getservxxx netdb.h functions are available
12752echo " "
12753set d_getservprotos getservent $i_netdb netdb.h
12754eval $hasproto
12755
12756: see if getspnam exists
12757set getspnam d_getspnam
12758eval $inlibc
12759
10bc17b6
JH
12760: see if this is a shadow.h system
12761set shadow.h i_shadow
12762eval $inhdr
12763
12764: see if getspnam_r exists
12765set getspnam_r d_getspnam_r
12766eval $inlibc
12767case "$d_getspnam_r" in
12768"$define")
12769 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
12770 case "$d_getspnam_r_proto:$usethreads" in
12771 ":define") d_getspnam_r_proto=define
a48ec845
JH
12772 set d_getspnam_r_proto getspnam_r $hdrs
12773 eval $hasproto ;;
12774 *) ;;
12775 esac
12776 case "$d_getspnam_r_proto" in
12777 define)
10bc17b6
JH
12778 case "$getspnam_r_proto" in
12779 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12780 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12781 esac
12782 case "$getspnam_r_proto" in
12783 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12784 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12785 esac
12786 case "$getspnam_r_proto" in
90e831dc 12787 ''|0) d_getspnam_r=undef
10bc17b6 12788 getspnam_r_proto=0
a48ec845 12789 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12790 * ) case "$getspnam_r_proto" in
12791 REENTRANT_PROTO*) ;;
12792 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12793 esac
12794 echo "Prototype: $try" ;;
12795 esac
12796 ;;
c18e646a
JH
12797 *) case "$usethreads" in
12798 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12799 esac
90e831dc
SB
12800 d_getspnam_r=undef
12801 getspnam_r_proto=0
c18e646a 12802 ;;
a48ec845
JH
12803 esac
12804 ;;
10bc17b6
JH
12805*) getspnam_r_proto=0
12806 ;;
12807esac
12808
b4eb6b3d
JH
12809: see if gettimeofday or ftime exists
12810set gettimeofday d_gettimeod
12811eval $inlibc
12812case "$d_gettimeod" in
12813"$undef")
12814 set ftime d_ftime
12815 eval $inlibc
12816 ;;
12817*)
12818 val="$undef"; set d_ftime; eval $setvar
12819 ;;
12820esac
12821case "$d_gettimeod$d_ftime" in
12822"$undef$undef")
12823 echo " "
12824 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12825 ;;
12826esac
12827
10bc17b6
JH
12828: see if gmtime_r exists
12829set gmtime_r d_gmtime_r
12830eval $inlibc
12831case "$d_gmtime_r" in
12832"$define")
d63eadf0 12833 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
12834 case "$d_gmtime_r_proto:$usethreads" in
12835 ":define") d_gmtime_r_proto=define
a48ec845
JH
12836 set d_gmtime_r_proto gmtime_r $hdrs
12837 eval $hasproto ;;
12838 *) ;;
12839 esac
12840 case "$d_gmtime_r_proto" in
12841 define)
10bc17b6
JH
12842 case "$gmtime_r_proto" in
12843 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12844 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12845 esac
12846 case "$gmtime_r_proto" in
12847 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12848 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12849 esac
12850 case "$gmtime_r_proto" in
90e831dc 12851 ''|0) d_gmtime_r=undef
10bc17b6 12852 gmtime_r_proto=0
a48ec845 12853 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12854 * ) case "$gmtime_r_proto" in
12855 REENTRANT_PROTO*) ;;
12856 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12857 esac
12858 echo "Prototype: $try" ;;
12859 esac
b4eb6b3d 12860 ;;
c18e646a
JH
12861 *) case "$usethreads" in
12862 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12863 esac
90e831dc
SB
12864 d_gmtime_r=undef
12865 gmtime_r_proto=0
c18e646a 12866 ;;
a48ec845
JH
12867 esac
12868 ;;
10bc17b6 12869*) gmtime_r_proto=0
b4eb6b3d
JH
12870 ;;
12871esac
12872
12873: see if hasmntopt exists
12874set hasmntopt d_hasmntopt
12875eval $inlibc
12876
12877: see if this is a netinet/in.h or sys/in.h system
12878set netinet/in.h i_niin sys/in.h i_sysin
12879eval $inhdr
12880
12881: see if arpa/inet.h has to be included
12882set arpa/inet.h i_arpainet
12883eval $inhdr
12884
12885: see if htonl --and friends-- exists
12886val=''
12887set htonl val
12888eval $inlibc
12889
12890: Maybe they are macros.
12891case "$val" in
12892$undef)
12893 $cat >htonl.c <<EOM
12894#include <stdio.h>
12895#include <sys/types.h>
12896#$i_niin I_NETINET_IN
12897#$i_sysin I_SYS_IN
12898#$i_arpainet I_ARPA_INET
12899#ifdef I_NETINET_IN
12900#include <netinet/in.h>
12901#endif
12902#ifdef I_SYS_IN
12903#include <sys/in.h>
12904#endif
12905#ifdef I_ARPA_INET
12906#include <arpa/inet.h>
12907#endif
12908#ifdef htonl
12909printf("Defined as a macro.");
12910#endif
12911EOM
12912 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12913 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12914 val="$define"
12915 echo "But it seems to be defined as a macro." >&4
12916 fi
12917 $rm -f htonl.?
12918 ;;
12919esac
12920set d_htonl
12921eval $setvar
12922
b4eb6b3d
JH
12923: index or strchr
12924echo " "
12925if set index val -f; eval $csym; $val; then
12926 if set strchr val -f d_strchr; eval $csym; $val; then
12927 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12928 val="$define"
12929 vali="$undef"
12930 echo "strchr() found." >&4
12931 else
12932 val="$undef"
12933 vali="$define"
12934 echo "index() found." >&4
12935 fi
12936 else
12937 val="$undef"
12938 vali="$define"
8dfa8df9
JH
12939 echo "index() found." >&4
12940 fi
b4eb6b3d 12941else
8dfa8df9
JH
12942 if set strchr val -f d_strchr; eval $csym; $val; then
12943 val="$define"
12944 vali="$undef"
12945 echo "strchr() found." >&4
12946 else
12947 echo "No index() or strchr() found!" >&4
12948 val="$undef"
12949 vali="$undef"
12950 fi
b4eb6b3d 12951fi
8dfa8df9
JH
12952set d_strchr; eval $setvar
12953val="$vali"
12954set d_index; eval $setvar
12955
12956: check whether inet_aton exists
12957set inet_aton d_inetaton
12958eval $inlibc
b4eb6b3d
JH
12959
12960: Look for isascii
12961echo " "
12962$cat >isascii.c <<'EOCP'
12963#include <stdio.h>
12964#include <ctype.h>
12965int main() {
12966 int c = 'A';
12967 if (isascii(c))
12968 exit(0);
12969 else
12970 exit(1);
12971}
12972EOCP
12973set isascii
12974if eval $compile; then
12975 echo "isascii() found." >&4
12976 val="$define"
12977else
12978 echo "isascii() NOT found." >&4
12979 val="$undef"
12980fi
12981set d_isascii
12982eval $setvar
12983$rm -f isascii*
12984
758a5d79
JH
12985: see if isfinite exists
12986set isfinite d_isfinite
12987eval $inlibc
12988
12989: see if isinf exists
12990set isinf d_isinf
12991eval $inlibc
12992
b4eb6b3d
JH
12993: see if isnan exists
12994set isnan d_isnan
12995eval $inlibc
12996
12997: see if isnanl exists
12998set isnanl d_isnanl
12999eval $inlibc
13000
13001: see if killpg exists
13002set killpg d_killpg
13003eval $inlibc
13004
13005: see if lchown exists
13006echo " "
13007$cat > try.c <<'EOCP'
13008/* System header to define __stub macros and hopefully few prototypes,
13009 which can conflict with char lchown(); below. */
13010#include <assert.h>
13011/* Override any gcc2 internal prototype to avoid an error. */
13012/* We use char because int might match the return type of a gcc2
13013 builtin and then its argument prototype would still apply. */
13014char lchown();
13015int main() {
13016 /* The GNU C library defines this for functions which it implements
13017 to always fail with ENOSYS. Some functions are actually named
13018 something starting with __ and the normal name is an alias. */
13019#if defined (__stub_lchown) || defined (__stub___lchown)
13020choke me
13021#else
13022lchown();
13023#endif
13024; return 0; }
13025EOCP
13026set try
13027if eval $compile; then
13028 $echo "lchown() found." >&4
13029 val="$define"
13030else
13031 $echo "lchown() NOT found." >&4
13032 val="$undef"
13033fi
13034set d_lchown
13035eval $setvar
13036
13037: See if number of significant digits in a double precision number is known
13038echo " "
13039$cat >ldbl_dig.c <<EOM
13040#$i_limits I_LIMITS
13041#$i_float I_FLOAT
13042#ifdef I_LIMITS
13043#include <limits.h>
13044#endif
13045#ifdef I_FLOAT
13046#include <float.h>
13047#endif
13048#ifdef LDBL_DIG
13049printf("Contains LDBL_DIG");
13050#endif
13051EOM
13052$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13053if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13054 echo "LDBL_DIG found." >&4
13055 val="$define"
13056else
13057 echo "LDBL_DIG NOT found." >&4
13058 val="$undef"
13059fi
13060$rm -f ldbl_dig.?
13061set d_ldbl_dig
13062eval $setvar
13063
13064: see if link exists
13065set link d_link
13066eval $inlibc
13067
10bc17b6
JH
13068: see if localtime_r exists
13069set localtime_r d_localtime_r
13070eval $inlibc
13071case "$d_localtime_r" in
13072"$define")
d63eadf0 13073 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13074 case "$d_localtime_r_proto:$usethreads" in
13075 ":define") d_localtime_r_proto=define
a48ec845
JH
13076 set d_localtime_r_proto localtime_r $hdrs
13077 eval $hasproto ;;
13078 *) ;;
13079 esac
13080 case "$d_localtime_r_proto" in
13081 define)
10bc17b6
JH
13082 case "$localtime_r_proto" in
13083 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13084 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13085 esac
13086 case "$localtime_r_proto" in
13087 ''|0) try='int localtime_r(const time_t*, struct tm*);'
13088 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13089 esac
13090 case "$localtime_r_proto" in
90e831dc 13091 ''|0) d_localtime_r=undef
10bc17b6 13092 localtime_r_proto=0
a48ec845 13093 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13094 * ) case "$localtime_r_proto" in
13095 REENTRANT_PROTO*) ;;
13096 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13097 esac
13098 echo "Prototype: $try" ;;
13099 esac
13100 ;;
c18e646a
JH
13101 *) case "$usethreads" in
13102 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13103 esac
90e831dc
SB
13104 d_localtime_r=undef
13105 localtime_r_proto=0
c18e646a 13106 ;;
a48ec845
JH
13107 esac
13108 ;;
10bc17b6
JH
13109*) localtime_r_proto=0
13110 ;;
13111esac
13112
b4eb6b3d
JH
13113: see if localeconv exists
13114set localeconv d_locconv
13115eval $inlibc
13116
13117: see if lockf exists
13118set lockf d_lockf
13119eval $inlibc
13120
b4eb6b3d
JH
13121: see if prototype for lseek is available
13122echo " "
4786929f 13123set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
13124eval $hasproto
13125
13126: see if lstat exists
13127set lstat d_lstat
13128eval $inlibc
13129
13130: see if madvise exists
13131set madvise d_madvise
13132eval $inlibc
13133
13134: see if mblen exists
13135set mblen d_mblen
13136eval $inlibc
13137
13138: see if mbstowcs exists
13139set mbstowcs d_mbstowcs
13140eval $inlibc
13141
13142: see if mbtowc exists
13143set mbtowc d_mbtowc
13144eval $inlibc
13145
13146: see if memchr exists
13147set memchr d_memchr
13148eval $inlibc
13149
13150: see if memcmp exists
13151set memcmp d_memcmp
13152eval $inlibc
13153
13154: see if memcpy exists
13155set memcpy d_memcpy
13156eval $inlibc
13157
13158: see if memmove exists
13159set memmove d_memmove
13160eval $inlibc
13161
13162: see if memset exists
13163set memset d_memset
13164eval $inlibc
13165
13166: see if mkdir exists
13167set mkdir d_mkdir
13168eval $inlibc
13169
13170: see if mkdtemp exists
13171set mkdtemp d_mkdtemp
13172eval $inlibc
13173
13174: see if mkfifo exists
13175set mkfifo d_mkfifo
13176eval $inlibc
13177
13178: see if mkstemp exists
13179set mkstemp d_mkstemp
13180eval $inlibc
13181
13182: see if mkstemps exists
13183set mkstemps d_mkstemps
13184eval $inlibc
13185
13186: see if mktime exists
13187set mktime d_mktime
13188eval $inlibc
13189
13190: see if this is a sys/mman.h system
13191set sys/mman.h i_sysmman
13192eval $inhdr
13193
13194: see if mmap exists
13195set mmap d_mmap
13196eval $inlibc
13197: see what shmat returns
13198: default to something harmless
13199mmaptype='void *'
13200case "$i_sysmman$d_mmap" in
13201"$define$define")
13202 $cat >mmap.c <<'END'
13203#include <sys/mman.h>
13204void *mmap();
13205END
13206 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13207 mmaptype='void *'
13208 else
13209 mmaptype='caddr_t'
13210 fi
13211 echo "and it returns ($mmaptype)." >&4
13212 ;;
13213esac
13214
13215
13216
b4eb6b3d
JH
13217: see if mprotect exists
13218set mprotect d_mprotect
13219eval $inlibc
13220
13221: see if msgctl exists
13222set msgctl d_msgctl
13223eval $inlibc
13224
13225: see if msgget exists
13226set msgget d_msgget
13227eval $inlibc
13228
13229: see if msgsnd exists
13230set msgsnd d_msgsnd
13231eval $inlibc
13232
13233: see if msgrcv exists
13234set msgrcv d_msgrcv
13235eval $inlibc
13236
13237: see how much of the 'msg*(2)' library is present.
13238h_msg=true
13239echo " "
13240case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13241*"$undef"*) h_msg=false;;
13242esac
13243case "$osname" in
13244freebsd)
13245 case "`ipcs 2>&1`" in
13246 "SVID messages"*"not configured"*)
13247 echo "Your $osname does not have the msg*(2) configured." >&4
13248 h_msg=false
13249 val="$undef"
13250 set msgctl d_msgctl
13251 eval $setvar
13252 set msgget d_msgget
13253 eval $setvar
13254 set msgsnd d_msgsnd
13255 eval $setvar
13256 set msgrcv d_msgrcv
13257 eval $setvar
13258 ;;
13259 esac
13260 ;;
13261esac
13262: we could also check for sys/ipc.h ...
13263if $h_msg && $test `./findhdr sys/msg.h`; then
13264 echo "You have the full msg*(2) library." >&4
13265 val="$define"
13266else
13267 echo "You don't have the full msg*(2) library." >&4
13268 val="$undef"
13269fi
13270set d_msg
13271eval $setvar
13272
4e0554ec
JH
13273
13274echo " "
13275echo "Checking to see if your system supports struct msghdr..." >&4
13276set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13277eval $hasstruct
13278case "$d_msghdr_s" in
13279"$define") echo "Yes, it does." ;;
13280*) echo "No, it doesn't." ;;
13281esac
13282
13283
b4eb6b3d
JH
13284: see if msync exists
13285set msync d_msync
13286eval $inlibc
13287
13288: see if munmap exists
13289set munmap d_munmap
13290eval $inlibc
13291
13292: see if nice exists
13293set nice d_nice
13294eval $inlibc
13295
2765b840
JH
13296: see if this is a langinfo.h system
13297set langinfo.h i_langinfo
13298eval $inhdr
13299
13300: see if nl_langinfo exists
13301set nl_langinfo d_nl_langinfo
13302eval $inlibc
13303
b4eb6b3d
JH
13304: check for length of character
13305echo " "
13306case "$charsize" in
13307'')
13308 echo "Checking to see how big your characters are (hey, you never know)..." >&4
13309 $cat >try.c <<'EOCP'
13310#include <stdio.h>
13311int main()
13312{
13313 printf("%d\n", (int)sizeof(char));
13314 exit(0);
13315}
13316EOCP
13317 set try
13318 if eval $compile_ok; then
5440bc8e 13319 dflt=`$run ./try`
b4eb6b3d
JH
13320 else
13321 dflt='1'
13322 echo "(I can't seem to compile the test program. Guessing...)"
13323 fi
13324 ;;
13325*)
13326 dflt="$charsize"
13327 ;;
13328esac
13329rp="What is the size of a character (in bytes)?"
13330. ./myread
13331charsize="$ans"
13332$rm -f try.c try
13333
1d1be0dc
NC
13334: check for volatile keyword
13335echo " "
13336echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13337$cat >try.c <<'EOCP'
13338int main()
13339{
13340 typedef struct _goo_struct goo_struct;
13341 goo_struct * volatile goo = ((goo_struct *)0);
13342 struct _goo_struct {
13343 long long_int;
13344 int reg_int;
13345 char char_var;
13346 };
13347 typedef unsigned short foo_t;
13348 char *volatile foo;
13349 volatile int bar;
13350 volatile foo_t blech;
13351 foo = foo;
13352}
13353EOCP
13354if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13355 val="$define"
13356 echo "Yup, it does."
13357else
13358 val="$undef"
13359 echo "Nope, it doesn't."
13360fi
13361set d_volatile
13362eval $setvar
13363$rm -f try.*
13364
b4eb6b3d
JH
13365
13366echo " "
13367$echo "Choosing the C types to be used for Perl's internal types..." >&4
13368
13369case "$use64bitint:$d_quad:$quadtype" in
13370define:define:?*)
13371 ivtype="$quadtype"
13372 uvtype="$uquadtype"
13373 ivsize=8
13374 uvsize=8
13375 ;;
13376*) ivtype="long"
13377 uvtype="unsigned long"
13378 ivsize=$longsize
13379 uvsize=$longsize
13380 ;;
13381esac
13382
13383case "$uselongdouble:$d_longdbl" in
13384define:define)
13385 nvtype="long double"
13386 nvsize=$longdblsize
13387 ;;
13388*) nvtype=double
13389 nvsize=$doublesize
13390 ;;
13391esac
13392
13393$echo "(IV will be "$ivtype", $ivsize bytes)"
13394$echo "(UV will be "$uvtype", $uvsize bytes)"
13395$echo "(NV will be "$nvtype", $nvsize bytes)"
13396
13397$cat >try.c <<EOCP
13398#$i_inttypes I_INTTYPES
13399#ifdef I_INTTYPES
13400#include <inttypes.h>
13401#endif
13402#include <stdio.h>
13403int main() {
13404#ifdef INT8
13405 int8_t i = INT8_MAX;
13406 uint8_t u = UINT8_MAX;
13407 printf("int8_t\n");
13408#endif
13409#ifdef INT16
13410 int16_t i = INT16_MAX;
13411 uint16_t i = UINT16_MAX;
13412 printf("int16_t\n");
13413#endif
13414#ifdef INT32
13415 int32_t i = INT32_MAX;
13416 uint32_t u = UINT32_MAX;
13417 printf("int32_t\n");
13418#endif
13419}
13420EOCP
13421
13422case "$i8type" in
13423'') case "$charsize" in
13424 1) i8type=char
13425 u8type="unsigned char"
13426 i8size=$charsize
13427 u8size=$charsize
13428 ;;
13429 esac
13430 ;;
13431esac
13432case "$i8type" in
13433'') set try -DINT8
13434 if eval $compile; then
5440bc8e 13435 case "`$run ./try`" in
b4eb6b3d
JH
13436 int8_t) i8type=int8_t
13437 u8type=uint8_t
13438 i8size=1
13439 u8size=1
13440 ;;
13441 esac
13442 fi
13443 ;;
13444esac
13445case "$i8type" in
13446'') if $test $charsize -ge 1; then
13447 i8type=char
13448 u8type="unsigned char"
13449 i8size=$charsize
13450 u8size=$charsize
13451 fi
13452 ;;
13453esac
13454
13455case "$i16type" in
13456'') case "$shortsize" in
13457 2) i16type=short
13458 u16type="unsigned short"
13459 i16size=$shortsize
13460 u16size=$shortsize
13461 ;;
13462 esac
13463 ;;
13464esac
13465case "$i16type" in
13466'') set try -DINT16
13467 if eval $compile; then
5440bc8e 13468 case "`$run ./try`" in
b4eb6b3d
JH
13469 int16_t)
13470 i16type=int16_t
13471 u16type=uint16_t
13472 i16size=2
13473 u16size=2
13474 ;;
13475 esac
13476 fi
13477 ;;
13478esac
13479case "$i16type" in
13480'') if $test $shortsize -ge 2; then
13481 i16type=short
13482 u16type="unsigned short"
13483 i16size=$shortsize
13484 u16size=$shortsize
13485 fi
13486 ;;
13487esac
13488
13489case "$i32type" in
13490'') case "$longsize" in
13491 4) i32type=long
13492 u32type="unsigned long"
13493 i32size=$longsize
13494 u32size=$longsize
13495 ;;
13496 *) case "$intsize" in
13497 4) i32type=int
13498 u32type="unsigned int"
13499 i32size=$intsize
13500 u32size=$intsize
13501 ;;
13502 esac
13503 ;;
13504 esac
13505 ;;
13506esac
13507case "$i32type" in
13508'') set try -DINT32
13509 if eval $compile; then
5440bc8e 13510 case "`$run ./try`" in
b4eb6b3d
JH
13511 int32_t)
13512 i32type=int32_t
13513 u32type=uint32_t
13514 i32size=4
13515 u32size=4
13516 ;;
13517 esac
13518 fi
13519 ;;
13520esac
13521case "$i32type" in
13522'') if $test $intsize -ge 4; then
13523 i32type=int
13524 u32type="unsigned int"
13525 i32size=$intsize
13526 u32size=$intsize
13527 fi
13528 ;;
13529esac
13530
13531case "$i64type" in
13532'') case "$d_quad:$quadtype" in
13533 define:?*)
13534 i64type="$quadtype"
13535 u64type="$uquadtype"
13536 i64size=8
13537 u64size=8
13538 ;;
13539 esac
13540 ;;
13541esac
13542
1d1be0dc
NC
13543$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13544: volatile so that the compiler has to store it out to memory.
13545if test X"$d_volatile" = X"$define"; then
13546 volatile=volatile
13547fi
b4eb6b3d
JH
13548$cat <<EOP >try.c
13549#include <stdio.h>
1d1be0dc
NC
13550#include <sys/types.h>
13551#include <signal.h>
13552#ifdef SIGFPE
13553$volatile int bletched = 0;
13554$signal_t blech(s) int s; { bletched = 1; }
13555#endif
b4eb6b3d
JH
13556int main() {
13557 $uvtype u = 0;
1d1be0dc 13558 $nvtype d;
b4eb6b3d
JH
13559 int n = 8 * $uvsize;
13560 int i;
1d1be0dc
NC
13561#ifdef SIGFPE
13562 signal(SIGFPE, blech);
13563#endif
13564
b4eb6b3d
JH
13565 for (i = 0; i < n; i++) {
13566 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
13567 d = ($nvtype)u;
13568 if (($uvtype)d != u)
b4eb6b3d 13569 break;
1d1be0dc
NC
13570 if (d <= 0)
13571 break;
13572 d = ($nvtype)(u - 1);
13573 if (($uvtype)d != (u - 1))
13574 break;
13575#ifdef SIGFPE
13576 if (bletched) {
13577 break;
13578#endif
13579 }
b4eb6b3d 13580 }
efd1522b 13581 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
13582 exit(0);
13583}
13584EOP
1d1be0dc
NC
13585set try
13586
13587d_nv_preserves_uv="$undef"
13588if eval $compile; then
53133ed1 13589 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 13590fi
53133ed1 13591case "$nv_preserves_uv_bits" in
1d1be0dc 13592\-[1-9]*)
53133ed1
NC
13593 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13594 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 13595 d_nv_preserves_uv="$define"
b4eb6b3d 13596 ;;
53133ed1 13597[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
13598 d_nv_preserves_uv="$undef" ;;
13599*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 13600 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
13601esac
13602
1d1be0dc
NC
13603$rm -f try.* try
13604
b4eb6b3d
JH
13605
13606: check for off64_t
13607echo " "
13608echo "Checking to see if you have off64_t..." >&4
13609$cat >try.c <<EOCP
13610#include <sys/types.h>
13611#include <unistd.h>
13612int main() { off64_t x = 7; }
13613EOCP
13614set try
13615if eval $compile; then
13616 val="$define"
13617 echo "You have off64_t."
13618else
13619 val="$undef"
13620 echo "You do not have off64_t."
13621 case "$lseeksize" in
13622 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13623 esac
13624fi
13625$rm -f try.* try
13626set d_off64_t
13627eval $setvar
13628
b4eb6b3d
JH
13629: how to create joinable pthreads
13630if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13631 echo " "
13632 echo "Checking what constant to use for creating joinable pthreads..." >&4
13633 $cat >try.c <<'EOCP'
13634#include <pthread.h>
13635int main() {
13636 int detachstate = JOINABLE;
13637}
13638EOCP
13639 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13640 if eval $compile; then
13641 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13642 val="$undef" # Yes, undef.
13643 set d_old_pthread_create_joinable
13644 eval $setvar
13645 val=""
13646 set old_pthread_create_joinable
13647 eval $setvar
13648 else
13649 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13650 if eval $compile; then
13651 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13652 val="$define"
13653 set d_old_pthread_create_joinable
13654 eval $setvar
13655 val=PTHREAD_CREATE_UNDETACHED
13656 set old_pthread_create_joinable
13657 eval $setvar
13658 else
13659 set try -DJOINABLE=__UNDETACHED
13660 if eval $compile; then
13661 echo "You seem to use __UNDETACHED." >&4
13662 val="$define"
13663 set d_old_pthread_create_joinable
13664 eval $setvar
13665 val=__UNDETACHED
13666 set old_pthread_create_joinable
13667 eval $setvar
13668 else
13669 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13670 val="$define"
13671 set d_old_pthread_create_joinable
13672 eval $setvar
13673 val=0
13674 set old_pthread_create_joinable
13675 eval $setvar
13676 fi
13677 fi
13678 fi
13679 $rm -f try try.*
13680else
13681 d_old_pthread_create_joinable="$undef"
13682 old_pthread_create_joinable=""
13683fi
13684
13685: see if pause exists
13686set pause d_pause
13687eval $inlibc
13688
13689: see if pipe exists
13690set pipe d_pipe
13691eval $inlibc
13692
13693: see if poll exists
13694set poll d_poll
13695eval $inlibc
13696
c7aff470
NIS
13697: see if readlink exists
13698set readlink d_readlink
13699eval $inlibc
13700
13701echo " "
f24dbf84 13702procselfexe=''
c7aff470 13703val="$undef"
a33c94aa
JH
13704case "$d_readlink" in
13705"$define")
c7aff470
NIS
13706 if $issymlink /proc/self/exe ; then
13707 $ls -l /proc/self/exe > reflect
51660ed5 13708 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 13709 echo "You have Linux-like /proc/self/exe."
92236451 13710 procselfexe='"/proc/self/exe"'
f24dbf84 13711 val="$define"
f24dbf84
JH
13712 fi
13713 fi
13714 if $issymlink /proc/curproc/file ; then
13715 $ls -l /proc/curproc/file > reflect
13716 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13717 echo "You have BSD-like /proc/curproc/file."
92236451 13718 procselfexe='"/proc/curproc/file"'
f24dbf84 13719 val="$define"
c7aff470 13720 fi
c7aff470 13721 fi
a33c94aa
JH
13722 ;;
13723esac
428dc699 13724$rm -f reflect
c7aff470
NIS
13725set d_procselfexe
13726eval $setvar
13727
263fee3f
JH
13728: see whether the pthread_atfork exists
13729$cat >try.c <<EOP
13730#include <pthread.h>
13731#include <stdio.h>
13732int main() {
13733#ifdef PTHREAD_ATFORK
13734 pthread_atfork(NULL,NULL,NULL);
13735#endif
13736}
13737EOP
13738
d6483fcc 13739: see if pthread_atfork exists
263fee3f
JH
13740set try -DPTHREAD_ATFORK
13741if eval $compile; then
13742 val="$define"
13743else
13744 val="$undef"
13745fi
13746case "$usethreads" in
13747$define)
13748 case "$val" in
13749 $define) echo 'pthread_atfork found.' >&4 ;;
13750 *) echo 'pthread_atfork NOT found.' >&4 ;;
13751 esac
13752esac
13753set d_pthread_atfork
13754eval $setvar
d6483fcc 13755
b4eb6b3d
JH
13756
13757: see whether the various POSIXish _yields exist
13758$cat >try.c <<EOP
13759#include <pthread.h>
13760#include <stdio.h>
13761int main() {
13762#ifdef SCHED_YIELD
13763 sched_yield();
13764#else
13765#ifdef PTHREAD_YIELD
13766 pthread_yield();
13767#else
13768#ifdef PTHREAD_YIELD_NULL
13769 pthread_yield(NULL);
13770#endif
13771#endif
13772#endif
13773}
13774EOP
13775: see if sched_yield exists
13776set try -DSCHED_YIELD
13777if eval $compile; then
13778 val="$define"
13779 sched_yield='sched_yield()'
13780else
13781 val="$undef"
13782fi
13783case "$usethreads" in
13784$define)
13785 case "$val" in
13786 $define) echo 'sched_yield() found.' >&4 ;;
13787 *) echo 'sched_yield() NOT found.' >&4 ;;
13788 esac
13789esac
10bc17b6
JH
13790set d_sched_yield
13791eval $setvar
b4eb6b3d 13792
10bc17b6
JH
13793: see if pthread_yield exists
13794set try -DPTHREAD_YIELD
13795if eval $compile; then
13796 val="$define"
13797 case "$sched_yield" in
13798 '') sched_yield='pthread_yield()' ;;
13799 esac
13800else
13801 set try -DPTHREAD_YIELD_NULL
13802 if eval $compile; then
13803 val="$define"
13804 case "$sched_yield" in
13805 '') sched_yield='pthread_yield(NULL)' ;;
13806 esac
13807 else
13808 val="$undef"
13809 fi
13810fi
13811case "$usethreads" in
13812$define)
13813 case "$val" in
13814 $define) echo 'pthread_yield() found.' >&4 ;;
13815 *) echo 'pthread_yield() NOT found.' >&4 ;;
13816 esac
13817 ;;
13818esac
13819set d_pthread_yield
13820eval $setvar
b4eb6b3d 13821
10bc17b6
JH
13822case "$sched_yield" in
13823'') sched_yield=undef ;;
13824esac
b4eb6b3d 13825
10bc17b6
JH
13826$rm -f try try.*
13827
13828: see if random_r exists
13829set random_r d_random_r
13830eval $inlibc
13831case "$d_random_r" in
13832"$define")
13833 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
13834 case "$d_random_r_proto:$usethreads" in
13835 ":define") d_random_r_proto=define
a48ec845
JH
13836 set d_random_r_proto random_r $hdrs
13837 eval $hasproto ;;
13838 *) ;;
13839 esac
13840 case "$d_random_r_proto" in
13841 define)
10bc17b6
JH
13842 case "$random_r_proto" in
13843 ''|0) try='int random_r(int*, struct random_data*);'
13844 ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13845 esac
13846 case "$random_r_proto" in
90e831dc 13847 ''|0) d_random_r=undef
10bc17b6 13848 random_r_proto=0
a48ec845 13849 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13850 * ) case "$random_r_proto" in
13851 REENTRANT_PROTO*) ;;
13852 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13853 esac
13854 echo "Prototype: $try" ;;
13855 esac
b4eb6b3d 13856 ;;
c18e646a
JH
13857 *) case "$usethreads" in
13858 define) echo "random_r has no prototype, not using it." >&4 ;;
13859 esac
90e831dc
SB
13860 d_random_r=undef
13861 random_r_proto=0
c18e646a 13862 ;;
a48ec845
JH
13863 esac
13864 ;;
10bc17b6 13865*) random_r_proto=0
b4eb6b3d
JH
13866 ;;
13867esac
13868
13869: see if readdir and friends exist
13870set readdir d_readdir
13871eval $inlibc
13872set seekdir d_seekdir
13873eval $inlibc
13874set telldir d_telldir
13875eval $inlibc
13876set rewinddir d_rewinddir
13877eval $inlibc
13878
10bc17b6
JH
13879: see if readdir64_r exists
13880set readdir64_r d_readdir64_r
13881eval $inlibc
13882case "$d_readdir64_r" in
13883"$define")
13884 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
13885 case "$d_readdir64_r_proto:$usethreads" in
13886 ":define") d_readdir64_r_proto=define
a48ec845
JH
13887 set d_readdir64_r_proto readdir64_r $hdrs
13888 eval $hasproto ;;
13889 *) ;;
13890 esac
13891 case "$d_readdir64_r_proto" in
13892 define)
10bc17b6
JH
13893 case "$readdir64_r_proto" in
13894 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13895 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13896 esac
13897 case "$readdir64_r_proto" in
13898 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13899 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13900 esac
13901 case "$readdir64_r_proto" in
90e831dc 13902 ''|0) d_readdir64_r=undef
10bc17b6 13903 readdir64_r_proto=0
a48ec845 13904 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13905 * ) case "$readdir64_r_proto" in
13906 REENTRANT_PROTO*) ;;
13907 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13908 esac
13909 echo "Prototype: $try" ;;
13910 esac
13911 ;;
c18e646a
JH
13912 *) case "$usethreads" in
13913 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13914 esac
90e831dc
SB
13915 d_readdir64_r=undef
13916 readdir64_r_proto=0
c18e646a 13917 ;;
a48ec845
JH
13918 esac
13919 ;;
10bc17b6
JH
13920*) readdir64_r_proto=0
13921 ;;
13922esac
13923
13924: see if readdir_r exists
13925set readdir_r d_readdir_r
13926eval $inlibc
13927case "$d_readdir_r" in
13928"$define")
13929 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
13930 case "$d_readdir_r_proto:$usethreads" in
13931 ":define") d_readdir_r_proto=define
a48ec845
JH
13932 set d_readdir_r_proto readdir_r $hdrs
13933 eval $hasproto ;;
13934 *) ;;
13935 esac
13936 case "$d_readdir_r_proto" in
13937 define)
10bc17b6
JH
13938 case "$readdir_r_proto" in
13939 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13940 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13941 esac
13942 case "$readdir_r_proto" in
13943 ''|0) try='int readdir_r(DIR*, struct dirent*);'
13944 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13945 esac
13946 case "$readdir_r_proto" in
90e831dc 13947 ''|0) d_readdir_r=undef
10bc17b6 13948 readdir_r_proto=0
a48ec845 13949 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13950 * ) case "$readdir_r_proto" in
13951 REENTRANT_PROTO*) ;;
13952 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13953 esac
13954 echo "Prototype: $try" ;;
13955 esac
13956 ;;
c18e646a
JH
13957 *) case "$usethreads" in
13958 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13959 esac
90e831dc
SB
13960 d_readdir_r=undef
13961 readdir_r_proto=0
c18e646a 13962 ;;
a48ec845
JH
13963 esac
13964 ;;
10bc17b6
JH
13965*) readdir_r_proto=0
13966 ;;
13967esac
13968
4e0554ec
JH
13969: see if readv exists
13970set readv d_readv
13971eval $inlibc
13972
13973: see if recvmsg exists
13974set recvmsg d_recvmsg
13975eval $inlibc
13976
b4eb6b3d
JH
13977: see if rename exists
13978set rename d_rename
13979eval $inlibc
13980
13981: see if rmdir exists
13982set rmdir d_rmdir
13983eval $inlibc
13984
13985: see if memory.h is available.
13986val=''
13987set memory.h val
13988eval $inhdr
13989
13990: See if it conflicts with string.h
13991case "$val" in
13992$define)
13993 case "$strings" in
13994 '') ;;
13995 *)
13996 $cppstdin $cppflags $cppminus < $strings > mem.h
13997 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13998 echo " "
13999 echo "We won't be including <memory.h>."
14000 val="$undef"
14001 fi
14002 $rm -f mem.h
14003 ;;
14004 esac
14005esac
14006set i_memory
14007eval $setvar
14008
14009: can bcopy handle overlapping blocks?
b6cc3bc4 14010echo " "
b4eb6b3d 14011val="$undef"
b6cc3bc4
AD
14012case "$d_memmove" in
14013"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14014*) case "$d_bcopy" in
14015 "$define")
14016 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14017 $cat >try.c <<EOCP
b4eb6b3d
JH
14018#$i_memory I_MEMORY
14019#$i_stdlib I_STDLIB
14020#$i_string I_STRING
14021#$i_unistd I_UNISTD
14022EOCP
14023 $cat >>try.c <<'EOCP'
14024#include <stdio.h>
14025#ifdef I_MEMORY
14026# include <memory.h>
14027#endif
14028#ifdef I_STDLIB
14029# include <stdlib.h>
14030#endif
14031#ifdef I_STRING
14032# include <string.h>
14033#else
14034# include <strings.h>
14035#endif
14036#ifdef I_UNISTD
14037# include <unistd.h> /* Needed for NetBSD */
14038#endif
14039int main()
14040{
14041char buf[128], abc[128];
14042char *b;
14043int len;
14044int off;
14045int align;
14046
b6cc3bc4
AD
14047/* Copy "abcde..." string to char abc[] so that gcc doesn't
14048 try to store the string in read-only memory. */
b4eb6b3d
JH
14049bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14050
14051for (align = 7; align >= 0; align--) {
14052 for (len = 36; len; len--) {
14053 b = buf+align;
14054 bcopy(abc, b, len);
14055 for (off = 1; off <= len; off++) {
14056 bcopy(b, b+off, len);
14057 bcopy(b+off, b, len);
14058 if (bcmp(b, abc, len))
14059 exit(1);
14060 }
14061 }
14062}
14063exit(0);
14064}
14065EOCP
b6cc3bc4
AD
14066 set try
14067 if eval $compile_ok; then
14068 if ./try 2>/dev/null; then
14069 echo "Yes, it can."
14070 val="$define"
14071 else
14072 echo "It can't, sorry."
14073 fi
b4eb6b3d 14074 else
b6cc3bc4 14075 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14076 fi
b6cc3bc4
AD
14077 ;;
14078 esac
14079 $rm -f try.* try core
b4eb6b3d
JH
14080 ;;
14081esac
b4eb6b3d
JH
14082set d_safebcpy
14083eval $setvar
14084
14085: can memcpy handle overlapping blocks?
b6cc3bc4 14086echo " "
b4eb6b3d 14087val="$undef"
b6cc3bc4
AD
14088case "$d_memmove" in
14089"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14090*) case "$d_memcpy" in
14091 "$define")
14092 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14093 $cat >try.c <<EOCP
b4eb6b3d
JH
14094#$i_memory I_MEMORY
14095#$i_stdlib I_STDLIB
14096#$i_string I_STRING
14097#$i_unistd I_UNISTD
14098EOCP
14099 $cat >>try.c <<'EOCP'
14100#include <stdio.h>
14101#ifdef I_MEMORY
14102# include <memory.h>
14103#endif
14104#ifdef I_STDLIB
14105# include <stdlib.h>
14106#endif
14107#ifdef I_STRING
14108# include <string.h>
14109#else
14110# include <strings.h>
14111#endif
14112#ifdef I_UNISTD
14113# include <unistd.h> /* Needed for NetBSD */
14114#endif
14115int main()
14116{
14117char buf[128], abc[128];
14118char *b;
14119int len;
14120int off;
14121int align;
14122
14123/* Copy "abcde..." string to char abc[] so that gcc doesn't
14124 try to store the string in read-only memory. */
14125memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14126
14127for (align = 7; align >= 0; align--) {
14128 for (len = 36; len; len--) {
14129 b = buf+align;
14130 memcpy(b, abc, len);
14131 for (off = 1; off <= len; off++) {
14132 memcpy(b+off, b, len);
14133 memcpy(b, b+off, len);
14134 if (memcmp(b, abc, len))
14135 exit(1);
14136 }
14137 }
14138}
14139exit(0);
14140}
14141EOCP
b6cc3bc4
AD
14142 set try
14143 if eval $compile_ok; then
14144 if ./try 2>/dev/null; then
14145 echo "Yes, it can."
14146 val="$define"
14147 else
14148 echo "It can't, sorry."
14149 fi
b4eb6b3d 14150 else
b6cc3bc4 14151 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 14152 fi
b6cc3bc4
AD
14153 ;;
14154 esac
14155 $rm -f try.* try core
b4eb6b3d
JH
14156 ;;
14157esac
b4eb6b3d
JH
14158set d_safemcpy
14159eval $setvar
14160
14161: can memcmp be trusted to compare relative magnitude?
14162val="$undef"
14163case "$d_memcmp" in
14164"$define")
14165 echo " "
14166 echo "Checking if your memcmp() can compare relative magnitude..." >&4
14167 $cat >try.c <<EOCP
14168#$i_memory I_MEMORY
14169#$i_stdlib I_STDLIB
14170#$i_string I_STRING
14171#$i_unistd I_UNISTD
14172EOCP
14173 $cat >>try.c <<'EOCP'
14174#include <stdio.h>
14175#ifdef I_MEMORY
14176# include <memory.h>
14177#endif
14178#ifdef I_STDLIB
14179# include <stdlib.h>
14180#endif
14181#ifdef I_STRING
14182# include <string.h>
14183#else
14184# include <strings.h>
14185#endif
14186#ifdef I_UNISTD
14187# include <unistd.h> /* Needed for NetBSD */
14188#endif
14189int main()
14190{
14191char a = -1;
14192char b = 0;
14193if ((a < b) && memcmp(&a, &b, 1) < 0)
14194 exit(1);
14195exit(0);
14196}
14197EOCP
14198 set try
14199 if eval $compile_ok; then
5440bc8e 14200 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
14201 echo "Yes, it can."
14202 val="$define"
14203 else
14204 echo "No, it can't (it uses signed chars)."
14205 fi
14206 else
14207 echo "(I can't compile the test program, so we'll assume not...)"
14208 fi
14209 ;;
14210esac
14211$rm -f try.* try core
14212set d_sanemcmp
14213eval $setvar
14214
ef9f17be
JH
14215: see if prototype for sbrk is available
14216echo " "
14217set d_sbrkproto sbrk $i_unistd unistd.h
14218eval $hasproto
14219
b4eb6b3d
JH
14220: see if select exists
14221set select d_select
14222eval $inlibc
14223
14224: see if semctl exists
14225set semctl d_semctl
14226eval $inlibc
14227
14228: see if semget exists
14229set semget d_semget
14230eval $inlibc
14231
14232: see if semop exists
14233set semop d_semop
14234eval $inlibc
14235
14236: see how much of the 'sem*(2)' library is present.
14237h_sem=true
14238echo " "
14239case "$d_semctl$d_semget$d_semop" in
14240*"$undef"*) h_sem=false;;
14241esac
14242case "$osname" in
14243freebsd)
14244 case "`ipcs 2>&1`" in
14245 "SVID messages"*"not configured"*)
14246 echo "Your $osname does not have the sem*(2) configured." >&4
14247 h_sem=false
14248 val="$undef"
14249 set semctl d_semctl
14250 eval $setvar
14251 set semget d_semget
14252 eval $setvar
14253 set semop d_semop
14254 eval $setvar
14255 ;;
14256 esac
14257 ;;
14258esac
14259: we could also check for sys/ipc.h ...
14260if $h_sem && $test `./findhdr sys/sem.h`; then
14261 echo "You have the full sem*(2) library." >&4
14262 val="$define"
14263else
14264 echo "You don't have the full sem*(2) library." >&4
14265 val="$undef"
14266fi
14267set d_sem
14268eval $setvar
14269
14270: see whether sys/sem.h defines union semun
14271echo " "
14272$cat > try.c <<'END'
14273#include <sys/types.h>
14274#include <sys/ipc.h>
14275#include <sys/sem.h>
14276int main () { union semun semun; semun.buf = 0; }
14277END
14278set try
14279if eval $compile; then
14280 echo "You have union semun in <sys/sem.h>." >&4
14281 val="$define"
14282else
14283 echo "You do not have union semun in <sys/sem.h>." >&4
14284 val="$undef"
14285fi
14286$rm -f try try.c try.h
14287set d_union_semun
14288eval $setvar
14289
14290: see how to do semctl IPC_STAT
14291case "$d_sem" in
14292$define)
14293 : see whether semctl IPC_STAT can use union semun
14294 echo " "
14295 $cat > try.h <<END
14296#ifndef S_IRUSR
14297# ifdef S_IREAD
14298# define S_IRUSR S_IREAD
14299# define S_IWUSR S_IWRITE
14300# define S_IXUSR S_IEXEC
14301# else
14302# define S_IRUSR 0400
14303# define S_IWUSR 0200
14304# define S_IXUSR 0100
14305# endif
14306# define S_IRGRP (S_IRUSR>>3)
14307# define S_IWGRP (S_IWUSR>>3)
14308# define S_IXGRP (S_IXUSR>>3)
14309# define S_IROTH (S_IRUSR>>6)
14310# define S_IWOTH (S_IWUSR>>6)
14311# define S_IXOTH (S_IXUSR>>6)
14312#endif
14313#ifndef S_IRWXU
14314# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14315# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14316# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14317#endif
14318END
14319
14320 $cat > try.c <<END
14321#include <sys/types.h>
14322#include <sys/ipc.h>
14323#include <sys/sem.h>
14324#include <sys/stat.h>
14325#include <stdio.h>
14326#include <errno.h>
14327#include "try.h"
14328#ifndef errno
14329extern int errno;
14330#endif
14331#$d_union_semun HAS_UNION_SEMUN
14332int main() {
14333 union semun
14334#ifndef HAS_UNION_SEMUN
14335 {
14336 int val;
14337 struct semid_ds *buf;
14338 unsigned short *array;
14339 }
14340#endif
14341 arg;
14342 int sem, st;
14343
14344#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14345 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14346 if (sem > -1) {
14347 struct semid_ds argbuf;
14348 arg.buf = &argbuf;
14349# ifdef IPC_STAT
14350 st = semctl(sem, 0, IPC_STAT, arg);
14351 if (st == 0)
14352 printf("semun\n");
14353 else
14354# endif /* IPC_STAT */
14355 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14356# ifdef IPC_RMID
14357 if (semctl(sem, 0, IPC_RMID, arg) != 0)
14358# endif /* IPC_RMID */
14359 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14360 } else
14361#endif /* IPC_PRIVATE && ... */
14362 printf("semget failed: errno = %d\n", errno);
14363 return 0;
14364}
14365END
14366 val="$undef"
14367 set try
14368 if eval $compile; then
5440bc8e 14369 xxx=`$run ./try`
b4eb6b3d
JH
14370 case "$xxx" in
14371 semun) val="$define" ;;
14372 esac
14373 fi
14374 $rm -f try try.c
14375 set d_semctl_semun
14376 eval $setvar
14377 case "$d_semctl_semun" in
14378 $define)
14379 echo "You can use union semun for semctl IPC_STAT." >&4
14380 also='also'
14381 ;;
14382 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
14383 also=''
14384 ;;
14385 esac
14386
14387 : see whether semctl IPC_STAT can use struct semid_ds pointer
14388 $cat > try.c <<'END'
14389#include <sys/types.h>
14390#include <sys/ipc.h>
14391#include <sys/sem.h>
14392#include <sys/stat.h>
14393#include "try.h"
14394#include <stdio.h>
14395#include <errno.h>
14396#ifndef errno
14397extern int errno;
14398#endif
14399int main() {
14400 struct semid_ds arg;
14401 int sem, st;
14402
14403#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14404 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14405 if (sem > -1) {
14406# ifdef IPC_STAT
14407 st = semctl(sem, 0, IPC_STAT, &arg);
14408 if (st == 0)
14409 printf("semid_ds\n");
14410 else
14411# endif /* IPC_STAT */
14412 printf("semctl IPC_STAT failed: errno = %d\n", errno);
14413# ifdef IPC_RMID
14414 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14415# endif /* IPC_RMID */
14416 printf("semctl IPC_RMID failed: errno = %d\n", errno);
14417 } else
14418#endif /* IPC_PRIVATE && ... */
14419 printf("semget failed: errno = %d\n", errno);
14420
14421 return 0;
14422}
14423END
14424 val="$undef"
14425 set try
14426 if eval $compile; then
5440bc8e 14427 xxx=`$run ./try`
b4eb6b3d
JH
14428 case "$xxx" in
14429 semid_ds) val="$define" ;;
14430 esac
14431 fi
14432 $rm -f try try.c
14433 set d_semctl_semid_ds
14434 eval $setvar
14435 case "$d_semctl_semid_ds" in
14436 $define)
14437 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14438 ;;
14439 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14440 ;;
14441 esac
14442 $rm -f try.h
14443 ;;
14444*) val="$undef"
14445
14446 # We do not have the full sem*(2) library, so assume we can not
14447 # use either.
14448
14449 set d_semctl_semun
14450 eval $setvar
14451
14452 set d_semctl_semid_ds
14453 eval $setvar
14454 ;;
14455esac
14456
4e0554ec
JH
14457: see if sendmsg exists
14458set sendmsg d_sendmsg
14459eval $inlibc
14460
b4eb6b3d
JH
14461: see if setegid exists
14462set setegid d_setegid
14463eval $inlibc
14464
14465: see if seteuid exists
14466set seteuid d_seteuid
14467eval $inlibc
14468
14469: see if setgrent exists
14470set setgrent d_setgrent
14471eval $inlibc
14472
10bc17b6
JH
14473: see if setgrent_r exists
14474set setgrent_r d_setgrent_r
14475eval $inlibc
14476case "$d_setgrent_r" in
14477"$define")
14478 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
14479 case "$d_setgrent_r_proto:$usethreads" in
14480 ":define") d_setgrent_r_proto=define
a48ec845
JH
14481 set d_setgrent_r_proto setgrent_r $hdrs
14482 eval $hasproto ;;
14483 *) ;;
14484 esac
14485 case "$d_setgrent_r_proto" in
14486 define)
10bc17b6
JH
14487 case "$setgrent_r_proto" in
14488 ''|0) try='int setgrent_r(FILE**);'
14489 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14490 esac
14491 case "$setgrent_r_proto" in
14492 ''|0) try='void setgrent_r(FILE**);'
14493 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14494 esac
14495 case "$setgrent_r_proto" in
90e831dc 14496 ''|0) d_setgrent_r=undef
10bc17b6 14497 setgrent_r_proto=0
a48ec845 14498 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14499 * ) case "$setgrent_r_proto" in
14500 REENTRANT_PROTO*) ;;
14501 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14502 esac
14503 echo "Prototype: $try" ;;
14504 esac
14505 ;;
c18e646a
JH
14506 *) case "$usethreads" in
14507 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14508 esac
90e831dc
SB
14509 d_setgrent_r=undef
14510 setgrent_r_proto=0
c18e646a 14511 ;;
a48ec845
JH
14512 esac
14513 ;;
10bc17b6
JH
14514*) setgrent_r_proto=0
14515 ;;
14516esac
14517
b4eb6b3d
JH
14518: see if sethostent exists
14519set sethostent d_sethent
14520eval $inlibc
14521
10bc17b6
JH
14522: see if sethostent_r exists
14523set sethostent_r d_sethostent_r
14524eval $inlibc
14525case "$d_sethostent_r" in
14526"$define")
14527 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14528 case "$d_sethostent_r_proto:$usethreads" in
14529 ":define") d_sethostent_r_proto=define
a48ec845
JH
14530 set d_sethostent_r_proto sethostent_r $hdrs
14531 eval $hasproto ;;
14532 *) ;;
14533 esac
14534 case "$d_sethostent_r_proto" in
14535 define)
10bc17b6
JH
14536 case "$sethostent_r_proto" in
14537 ''|0) try='int sethostent_r(int, struct hostent_data*);'
14538 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14539 esac
14540 case "$sethostent_r_proto" in
14541 ''|0) try='void sethostent_r(int, struct hostent_data*);'
14542 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14543 esac
14544 case "$sethostent_r_proto" in
90e831dc 14545 ''|0) d_sethostent_r=undef
10bc17b6 14546 sethostent_r_proto=0
a48ec845 14547 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14548 * ) case "$sethostent_r_proto" in
14549 REENTRANT_PROTO*) ;;
14550 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14551 esac
14552 echo "Prototype: $try" ;;
14553 esac
14554 ;;
c18e646a
JH
14555 *) case "$usethreads" in
14556 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14557 esac
90e831dc
SB
14558 d_sethostent_r=undef
14559 sethostent_r_proto=0
c18e646a 14560 ;;
a48ec845
JH
14561 esac
14562 ;;
10bc17b6
JH
14563*) sethostent_r_proto=0
14564 ;;
14565esac
14566
4e0554ec
JH
14567: see if setitimer exists
14568set setitimer d_setitimer
14569eval $inlibc
14570
b4eb6b3d
JH
14571: see if setlinebuf exists
14572set setlinebuf d_setlinebuf
14573eval $inlibc
14574
14575: see if setlocale exists
14576set setlocale d_setlocale
14577eval $inlibc
14578
10bc17b6
JH
14579: see if locale.h is available
14580set locale.h i_locale
14581eval $inhdr
14582
14583: see if setlocale_r exists
14584set setlocale_r d_setlocale_r
14585eval $inlibc
14586case "$d_setlocale_r" in
14587"$define")
14588 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
14589 case "$d_setlocale_r_proto:$usethreads" in
14590 ":define") d_setlocale_r_proto=define
a48ec845
JH
14591 set d_setlocale_r_proto setlocale_r $hdrs
14592 eval $hasproto ;;
14593 *) ;;
14594 esac
14595 case "$d_setlocale_r_proto" in
14596 define)
10bc17b6
JH
14597 case "$setlocale_r_proto" in
14598 ''|0) try='int setlocale_r(int, const char*, char*, int);'
14599 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14600 esac
14601 case "$setlocale_r_proto" in
90e831dc 14602 ''|0) d_setlocale_r=undef
10bc17b6 14603 setlocale_r_proto=0
a48ec845 14604 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14605 * ) case "$setlocale_r_proto" in
14606 REENTRANT_PROTO*) ;;
14607 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14608 esac
14609 echo "Prototype: $try" ;;
14610 esac
14611 ;;
c18e646a
JH
14612 *) case "$usethreads" in
14613 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14614 esac
90e831dc
SB
14615 d_setlocale_r=undef
14616 setlocale_r_proto=0
c18e646a 14617 ;;
a48ec845
JH
14618 esac
14619 ;;
10bc17b6
JH
14620*) setlocale_r_proto=0
14621 ;;
14622esac
14623
b4eb6b3d
JH
14624: see if setnetent exists
14625set setnetent d_setnent
14626eval $inlibc
14627
10bc17b6
JH
14628: see if setnetent_r exists
14629set setnetent_r d_setnetent_r
14630eval $inlibc
14631case "$d_setnetent_r" in
14632"$define")
14633 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14634 case "$d_setnetent_r_proto:$usethreads" in
14635 ":define") d_setnetent_r_proto=define
a48ec845
JH
14636 set d_setnetent_r_proto setnetent_r $hdrs
14637 eval $hasproto ;;
14638 *) ;;
14639 esac
14640 case "$d_setnetent_r_proto" in
14641 define)
10bc17b6
JH
14642 case "$setnetent_r_proto" in
14643 ''|0) try='int setnetent_r(int, struct netent_data*);'
14644 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14645 esac
14646 case "$setnetent_r_proto" in
14647 ''|0) try='void setnetent_r(int, struct netent_data*);'
14648 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14649 esac
14650 case "$setnetent_r_proto" in
90e831dc 14651 ''|0) d_setnetent_r=undef
10bc17b6 14652 setnetent_r_proto=0
a48ec845 14653 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14654 * ) case "$setnetent_r_proto" in
14655 REENTRANT_PROTO*) ;;
14656 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14657 esac
14658 echo "Prototype: $try" ;;
14659 esac
14660 ;;
c18e646a
JH
14661 *) case "$usethreads" in
14662 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14663 esac
90e831dc
SB
14664 d_setnetent_r=undef
14665 setnetent_r_proto=0
c18e646a 14666 ;;
a48ec845
JH
14667 esac
14668 ;;
10bc17b6
JH
14669*) setnetent_r_proto=0
14670 ;;
14671esac
14672
b4eb6b3d
JH
14673: see if setprotoent exists
14674set setprotoent d_setpent
14675eval $inlibc
14676
14677: see if setpgid exists
14678set setpgid d_setpgid
14679eval $inlibc
14680
14681: see if setpgrp2 exists
14682set setpgrp2 d_setpgrp2
14683eval $inlibc
14684
14685: see if setpriority exists
14686set setpriority d_setprior
14687eval $inlibc
14688
14689: see if setproctitle exists
14690set setproctitle d_setproctitle
14691eval $inlibc
14692
10bc17b6
JH
14693: see if setprotoent_r exists
14694set setprotoent_r d_setprotoent_r
14695eval $inlibc
14696case "$d_setprotoent_r" in
14697"$define")
14698 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14699 case "$d_setprotoent_r_proto:$usethreads" in
14700 ":define") d_setprotoent_r_proto=define
a48ec845
JH
14701 set d_setprotoent_r_proto setprotoent_r $hdrs
14702 eval $hasproto ;;
14703 *) ;;
14704 esac
14705 case "$d_setprotoent_r_proto" in
14706 define)
10bc17b6
JH
14707 case "$setprotoent_r_proto" in
14708 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14709 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14710 esac
14711 case "$setprotoent_r_proto" in
14712 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14713 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14714 esac
14715 case "$setprotoent_r_proto" in
90e831dc 14716 ''|0) d_setprotoent_r=undef
10bc17b6 14717 setprotoent_r_proto=0
a48ec845 14718 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14719 * ) case "$setprotoent_r_proto" in
14720 REENTRANT_PROTO*) ;;
14721 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14722 esac
14723 echo "Prototype: $try" ;;
14724 esac
14725 ;;
c18e646a
JH
14726 *) case "$usethreads" in
14727 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14728 esac
90e831dc
SB
14729 d_setprotoent_r=undef
14730 setprotoent_r_proto=0
c18e646a 14731 ;;
a48ec845
JH
14732 esac
14733 ;;
10bc17b6
JH
14734*) setprotoent_r_proto=0
14735 ;;
14736esac
14737
b4eb6b3d
JH
14738: see if setpwent exists
14739set setpwent d_setpwent
14740eval $inlibc
14741
10bc17b6
JH
14742: see if setpwent_r exists
14743set setpwent_r d_setpwent_r
14744eval $inlibc
14745case "$d_setpwent_r" in
14746"$define")
14747 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14748 case "$d_setpwent_r_proto:$usethreads" in
14749 ":define") d_setpwent_r_proto=define
a48ec845
JH
14750 set d_setpwent_r_proto setpwent_r $hdrs
14751 eval $hasproto ;;
14752 *) ;;
14753 esac
14754 case "$d_setpwent_r_proto" in
14755 define)
10bc17b6
JH
14756 case "$setpwent_r_proto" in
14757 ''|0) try='int setpwent_r(FILE**);'
14758 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14759 esac
14760 case "$setpwent_r_proto" in
14761 ''|0) try='void setpwent_r(FILE**);'
14762 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14763 esac
14764 case "$setpwent_r_proto" in
90e831dc 14765 ''|0) d_setpwent_r=undef
10bc17b6 14766 setpwent_r_proto=0
a48ec845 14767 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14768 * ) case "$setpwent_r_proto" in
14769 REENTRANT_PROTO*) ;;
14770 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14771 esac
14772 echo "Prototype: $try" ;;
14773 esac
14774 ;;
c18e646a
JH
14775 *) case "$usethreads" in
14776 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14777 esac
90e831dc
SB
14778 d_setpwent_r=undef
14779 setpwent_r_proto=0
c18e646a 14780 ;;
a48ec845
JH
14781 esac
14782 ;;
10bc17b6
JH
14783*) setpwent_r_proto=0
14784 ;;
14785esac
14786
b4eb6b3d
JH
14787: see if setregid exists
14788set setregid d_setregid
14789eval $inlibc
14790set setresgid d_setresgid
14791eval $inlibc
14792
14793: see if setreuid exists
14794set setreuid d_setreuid
14795eval $inlibc
14796set setresuid d_setresuid
14797eval $inlibc
14798
14799: see if setrgid exists
14800set setrgid d_setrgid
14801eval $inlibc
14802
14803: see if setruid exists
14804set setruid d_setruid
14805eval $inlibc
14806
14807: see if setservent exists
14808set setservent d_setsent
14809eval $inlibc
14810
10bc17b6
JH
14811: see if setservent_r exists
14812set setservent_r d_setservent_r
14813eval $inlibc
14814case "$d_setservent_r" in
14815"$define")
14816 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14817 case "$d_setservent_r_proto:$usethreads" in
14818 ":define") d_setservent_r_proto=define
a48ec845
JH
14819 set d_setservent_r_proto setservent_r $hdrs
14820 eval $hasproto ;;
14821 *) ;;
14822 esac
14823 case "$d_setservent_r_proto" in
14824 define)
10bc17b6
JH
14825 case "$setservent_r_proto" in
14826 ''|0) try='int setservent_r(int, struct servent_data*);'
14827 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14828 esac
14829 case "$setservent_r_proto" in
14830 ''|0) try='void setservent_r(int, struct servent_data*);'
14831 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14832 esac
14833 case "$setservent_r_proto" in
90e831dc 14834 ''|0) d_setservent_r=undef
10bc17b6 14835 setservent_r_proto=0
a48ec845 14836 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14837 * ) case "$setservent_r_proto" in
14838 REENTRANT_PROTO*) ;;
14839 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14840 esac
14841 echo "Prototype: $try" ;;
14842 esac
14843 ;;
c18e646a
JH
14844 *) case "$usethreads" in
14845 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14846 esac
90e831dc
SB
14847 d_setservent_r=undef
14848 setservent_r_proto=0
c18e646a 14849 ;;
a48ec845
JH
14850 esac
14851 ;;
10bc17b6
JH
14852*) setservent_r_proto=0
14853 ;;
14854esac
14855
b4eb6b3d
JH
14856: see if setsid exists
14857set setsid d_setsid
14858eval $inlibc
14859
14860: see if setvbuf exists
14861set setvbuf d_setvbuf
14862eval $inlibc
14863
14864: see if sfio.h is available
14865set sfio.h i_sfio
14866eval $inhdr
14867
14868
14869: see if sfio library is available
14870case "$i_sfio" in
14871$define)
14872 val=''
14873 set sfreserve val
14874 eval $inlibc
14875 ;;
14876*)
14877 val="$undef"
14878 ;;
14879esac
14880: Ok, but do we want to use it.
14881case "$val" in
14882$define)
14883 case "$usesfio" in
14884 true|$define|[yY]*) dflt='y';;
14885 *) dflt='n';;
14886 esac
14887 echo "$package can use the sfio library, but it is experimental."
14888 case "$useperlio" in
14889 "$undef")
14890 echo "For sfio also the PerlIO abstraction layer is needed."
14891 echo "Earlier you said you wouldn't want that."
14892 ;;
14893 esac
14894 rp="You seem to have sfio available, do you want to try using it?"
14895 . ./myread
14896 case "$ans" in
14897 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
14898 useperlio="$define"
14899 val="$define"
14900 ;;
14901 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
14902 val="$undef"
b4eb6b3d
JH
14903 ;;
14904 esac
14905 ;;
14906*) case "$usesfio" in
14907 true|$define|[yY]*)
14908 echo "Sorry, cannot find sfio on this machine." >&4
14909 echo "Ignoring your setting of usesfio=$usesfio." >&4
14910 val="$undef"
14911 ;;
14912 esac
14913 ;;
14914esac
14915set d_sfio
14916eval $setvar
14917case "$d_sfio" in
14918$define) usesfio='true';;
14919*) usesfio='false';;
14920esac
3659ebf1
JH
14921case "$d_sfio" in
14922$define) ;;
14923*) : Remove sfio from list of libraries to use
7483f793
JH
14924 case "$libs" in
14925 *-lsfio*)
14926 echo "Removing unneeded -lsfio from library list" >&4
14927 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14928 shift
14929 libs="$*"
14930 echo "libs = $libs" >&4
14931 ;;
14932 esac
3659ebf1
JH
14933;;
14934esac
14935
b4eb6b3d
JH
14936
14937: see if shmctl exists
14938set shmctl d_shmctl
14939eval $inlibc
14940
14941: see if shmget exists
14942set shmget d_shmget
14943eval $inlibc
14944
14945: see if shmat exists
14946set shmat d_shmat
14947eval $inlibc
14948: see what shmat returns
14949case "$d_shmat" in
14950"$define")
14951 $cat >shmat.c <<'END'
14952#include <sys/shm.h>
14953void *shmat();
14954END
14955 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14956 shmattype='void *'
14957 else
14958 shmattype='char *'
14959 fi
14960 echo "and it returns ($shmattype)." >&4
14961 : see if a prototype for shmat is available
14962 xxx=`./findhdr sys/shm.h`
14963 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14964 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14965 val="$define"
14966 else
14967 val="$undef"
14968 fi
14969 $rm -f shmat.[co]
14970 ;;
14971*)
14972 val="$undef"
14973 ;;
14974esac
14975set d_shmatprototype
14976eval $setvar
14977
14978: see if shmdt exists
14979set shmdt d_shmdt
14980eval $inlibc
14981
14982: see how much of the 'shm*(2)' library is present.
14983h_shm=true
14984echo " "
14985case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14986*"$undef"*) h_shm=false;;
14987esac
14988case "$osname" in
14989freebsd)
14990 case "`ipcs 2>&1`" in
14991 "SVID shared memory"*"not configured"*)
14992 echo "Your $osname does not have the shm*(2) configured." >&4
14993 h_shm=false
14994 val="$undef"
14995 set shmctl d_shmctl
14996 evat $setvar
14997 set shmget d_shmget
14998 evat $setvar
14999 set shmat d_shmat
15000 evat $setvar
15001 set shmdt d_shmdt
15002 evat $setvar
15003 ;;
15004 esac
15005 ;;
15006esac
15007: we could also check for sys/ipc.h ...
15008if $h_shm && $test `./findhdr sys/shm.h`; then
15009 echo "You have the full shm*(2) library." >&4
15010 val="$define"
15011else
15012 echo "You don't have the full shm*(2) library." >&4
15013 val="$undef"
15014fi
15015set d_shm
15016eval $setvar
15017
15018echo " "
15019: see if we have sigaction
15020if set sigaction val -f d_sigaction; eval $csym; $val; then
15021 echo 'sigaction() found.' >&4
15022 $cat > try.c <<'EOP'
15023#include <stdio.h>
15024#include <sys/types.h>
15025#include <signal.h>
15026int main()
15027{
15028 struct sigaction act, oact;
15029 act.sa_flags = 0;
15030 oact.sa_handler = 0;
15031 /* so that act and oact are used */
15032 exit(act.sa_flags == 0 && oact.sa_handler == 0);
15033}
15034EOP
15035 set try
15036 if eval $compile_ok; then
15037 val="$define"
15038 else
15039 echo "But you don't seem to have a useable struct sigaction." >&4
15040 val="$undef"
15041 fi
15042else
15043 echo 'sigaction NOT found.' >&4
15044 val="$undef"
15045fi
15046set d_sigaction; eval $setvar
15047$rm -f try try$_o try.c
15048
983dbef6
JH
15049: see if sigprocmask exists
15050set sigprocmask d_sigprocmask
15051eval $inlibc
15052
b4eb6b3d
JH
15053: see if sigsetjmp exists
15054echo " "
15055case "$d_sigsetjmp" in
15056'')
15057 $cat >try.c <<'EOP'
15058#include <setjmp.h>
15059sigjmp_buf env;
15060int set = 1;
15061int main()
15062{
15063 if (sigsetjmp(env,1))
15064 exit(set);
15065 set = 0;
15066 siglongjmp(env, 1);
15067 exit(1);
15068}
15069EOP
15070 set try
15071 if eval $compile; then
5440bc8e 15072 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
15073 echo "POSIX sigsetjmp found." >&4
15074 val="$define"
15075 else
15076 $cat >&4 <<EOM
15077Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15078I'll ignore them.
15079EOM
15080 val="$undef"
15081 fi
15082 else
15083 echo "sigsetjmp not found." >&4
15084 val="$undef"
15085 fi
15086 ;;
15087*) val="$d_sigsetjmp"
15088 case "$d_sigsetjmp" in
15089 $define) echo "POSIX sigsetjmp found." >&4;;
15090 $undef) echo "sigsetjmp not found." >&4;;
15091 esac
15092 ;;
15093esac
15094set d_sigsetjmp
15095eval $setvar
15096$rm -f try.c try
15097
49a78c82
JH
15098: see if sockatmark exists
15099set sockatmark d_sockatmark
15100eval $inlibc
15101
2ef53570
JH
15102: see if prototype for sockatmark is available
15103echo " "
15104set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15105eval $hasproto
15106
b4eb6b3d
JH
15107: see if socks5_init exists
15108set socks5_init d_socks5_init
15109eval $inlibc
15110
10bc17b6
JH
15111: see if srand48_r exists
15112set srand48_r d_srand48_r
15113eval $inlibc
15114case "$d_srand48_r" in
15115"$define")
15116 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15117 case "$d_srand48_r_proto:$usethreads" in
15118 ":define") d_srand48_r_proto=define
a48ec845
JH
15119 set d_srand48_r_proto srand48_r $hdrs
15120 eval $hasproto ;;
15121 *) ;;
15122 esac
15123 case "$d_srand48_r_proto" in
15124 define)
10bc17b6
JH
15125 case "$srand48_r_proto" in
15126 ''|0) try='int srand48_r(long, struct drand48_data*);'
15127 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15128 esac
15129 case "$srand48_r_proto" in
90e831dc 15130 ''|0) d_srand48_r=undef
10bc17b6 15131 srand48_r_proto=0
a48ec845 15132 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15133 * ) case "$srand48_r_proto" in
15134 REENTRANT_PROTO*) ;;
15135 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15136 esac
15137 echo "Prototype: $try" ;;
15138 esac
15139 ;;
c18e646a
JH
15140 *) case "$usethreads" in
15141 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15142 esac
90e831dc
SB
15143 d_srand48_r=undef
15144 srand48_r_proto=0
c18e646a 15145 ;;
a48ec845
JH
15146 esac
15147 ;;
10bc17b6
JH
15148*) srand48_r_proto=0
15149 ;;
15150esac
15151
15152: see if srandom_r exists
15153set srandom_r d_srandom_r
15154eval $inlibc
15155case "$d_srandom_r" in
15156"$define")
15157 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15158 case "$d_srandom_r_proto:$usethreads" in
15159 ":define") d_srandom_r_proto=define
a48ec845
JH
15160 set d_srandom_r_proto srandom_r $hdrs
15161 eval $hasproto ;;
15162 *) ;;
15163 esac
15164 case "$d_srandom_r_proto" in
15165 define)
10bc17b6
JH
15166 case "$srandom_r_proto" in
15167 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15168 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15169 esac
15170 case "$srandom_r_proto" in
90e831dc 15171 ''|0) d_srandom_r=undef
10bc17b6 15172 srandom_r_proto=0
a48ec845 15173 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15174 * ) case "$srandom_r_proto" in
15175 REENTRANT_PROTO*) ;;
15176 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15177 esac
15178 echo "Prototype: $try" ;;
15179 esac
15180 ;;
c18e646a
JH
15181 *) case "$usethreads" in
15182 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15183 esac
90e831dc
SB
15184 d_srandom_r=undef
15185 srandom_r_proto=0
c18e646a 15186 ;;
a48ec845
JH
15187 esac
15188 ;;
10bc17b6
JH
15189*) srandom_r_proto=0
15190 ;;
15191esac
15192
eef837ea
JH
15193: see if prototype for setresgid is available
15194echo " "
15195set d_sresgproto setresgid $i_unistd unistd.h
15196eval $hasproto
15197
640374d0
JH
15198: see if prototype for setresuid is available
15199echo " "
15200set d_sresuproto setresuid $i_unistd unistd.h
15201eval $hasproto
15202
b4eb6b3d
JH
15203: see if sys/stat.h is available
15204set sys/stat.h i_sysstat
15205eval $inhdr
15206
15207
15208: see if stat knows about block sizes
15209echo " "
15210echo "Checking to see if your struct stat has st_blocks field..." >&4
15211set d_statblks stat st_blocks $i_sysstat sys/stat.h
15212eval $hasfield
15213
15214
15215: see if this is a sys/vfs.h system
15216set sys/vfs.h i_sysvfs
15217eval $inhdr
15218
15219
15220: see if this is a sys/statfs.h system
15221set sys/statfs.h i_sysstatfs
15222eval $inhdr
15223
15224
15225echo " "
15226echo "Checking to see if your system supports struct statfs..." >&4
15227set 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
15228eval $hasstruct
15229case "$d_statfs_s" in
15230"$define") echo "Yes, it does." ;;
15231*) echo "No, it doesn't." ;;
15232esac
15233
15234
15235
15236: see if struct statfs knows about f_flags
15237case "$d_statfs_s" in
15238define)
15239 echo " "
15240 echo "Checking to see if your struct statfs has f_flags field..." >&4
15241 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
15242 eval $hasfield
15243 ;;
15244*) val="$undef"
15245 set d_statfs_f_flags
15246 eval $setvar
15247 ;;
15248esac
15249case "$d_statfs_f_flags" in
15250"$define") echo "Yes, it does." ;;
15251*) echo "No, it doesn't." ;;
15252esac
15253
15254: see if _ptr and _cnt from stdio act std
15255echo " "
80f36755
NC
15256
15257if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15258 echo "(Looks like you have stdio.h from BSD.)"
15259 case "$stdio_ptr" in
15260 '') stdio_ptr='((fp)->_p)'
15261 ptr_lval=$define
15262 ;;
15263 *) ptr_lval=$d_stdio_ptr_lval;;
15264 esac
15265 case "$stdio_cnt" in
15266 '') stdio_cnt='((fp)->_r)'
15267 cnt_lval=$define
15268 ;;
15269 *) cnt_lval=$d_stdio_cnt_lval;;
15270 esac
15271 case "$stdio_base" in
15272 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15273 esac
15274 case "$stdio_bufsiz" in
15275 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15276 esac
15277elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
b4eb6b3d
JH
15278 echo "(Looks like you have stdio.h from Linux.)"
15279 case "$stdio_ptr" in
15280 '') stdio_ptr='((fp)->_IO_read_ptr)'
15281 ptr_lval=$define
15282 ;;
15283 *) ptr_lval=$d_stdio_ptr_lval;;
15284 esac
15285 case "$stdio_cnt" in
15286 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15287 cnt_lval=$undef
15288 ;;
15289 *) cnt_lval=$d_stdio_cnt_lval;;
15290 esac
15291 case "$stdio_base" in
15292 '') stdio_base='((fp)->_IO_read_base)';;
15293 esac
15294 case "$stdio_bufsiz" in
15295 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15296 esac
15297else
15298 case "$stdio_ptr" in
15299 '') stdio_ptr='((fp)->_ptr)'
15300 ptr_lval=$define
15301 ;;
15302 *) ptr_lval=$d_stdio_ptr_lval;;
15303 esac
15304 case "$stdio_cnt" in
15305 '') stdio_cnt='((fp)->_cnt)'
15306 cnt_lval=$define
15307 ;;
15308 *) cnt_lval=$d_stdio_cnt_lval;;
15309 esac
15310 case "$stdio_base" in
15311 '') stdio_base='((fp)->_base)';;
15312 esac
15313 case "$stdio_bufsiz" in
15314 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15315 esac
15316fi
80f36755 15317
b4eb6b3d
JH
15318: test whether _ptr and _cnt really work
15319echo "Checking how std your stdio is..." >&4
15320$cat >try.c <<EOP
15321#include <stdio.h>
15322#define FILE_ptr(fp) $stdio_ptr
15323#define FILE_cnt(fp) $stdio_cnt
15324int main() {
15325 FILE *fp = fopen("try.c", "r");
15326 char c = getc(fp);
15327 if (
15328 18 <= FILE_cnt(fp) &&
15329 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15330 )
15331 exit(0);
15332 exit(1);
15333}
15334EOP
15335val="$undef"
15336set try
5440bc8e
JH
15337if eval $compile && $to try.c; then
15338 if $run ./try; then
b4eb6b3d
JH
15339 echo "Your stdio acts pretty std."
15340 val="$define"
15341 else
15342 echo "Your stdio isn't very std."
15343 fi
15344else
15345 echo "Your stdio doesn't appear very std."
15346fi
15347$rm -f try.c try
15348set d_stdstdio
15349eval $setvar
15350
15351: Can _ptr be used as an lvalue?
15352case "$d_stdstdio$ptr_lval" in
15353$define$define) val=$define ;;
15354*) val=$undef ;;
15355esac
15356set d_stdio_ptr_lval
15357eval $setvar
15358
15359: Can _cnt be used as an lvalue?
15360case "$d_stdstdio$cnt_lval" in
15361$define$define) val=$define ;;
15362*) val=$undef ;;
15363esac
15364set d_stdio_cnt_lval
15365eval $setvar
15366
a7ffa9b9
NC
15367
15368: test whether setting _ptr sets _cnt as a side effect
15369d_stdio_ptr_lval_sets_cnt="$undef"
15370d_stdio_ptr_lval_nochange_cnt="$undef"
15371case "$d_stdio_ptr_lval$d_stdstdio" in
15372$define$define)
15373 echo "Checking to see what happens if we set the stdio ptr..." >&4
15374$cat >try.c <<EOP
15375#include <stdio.h>
15376/* Can we scream? */
15377/* Eat dust sed :-) */
c1d9e6fa 15378/* In the buffer space, no one can hear you scream. */
0bbfc344
JH
15379#define FILE_ptr(fp) $stdio_ptr
15380#define FILE_cnt(fp) $stdio_cnt
c1d9e6fa 15381#include <sys/types.h>
a7ffa9b9
NC
15382int main() {
15383 FILE *fp = fopen("try.c", "r");
c1d9e6fa 15384 int c;
a7ffa9b9
NC
15385 char *ptr;
15386 size_t cnt;
c1d9e6fa
JH
15387 if (!fp) {
15388 puts("Fail even to read");
15389 exit(1);
15390 }
15391 c = getc(fp); /* Read away the first # */
15392 if (c == EOF) {
15393 puts("Fail even to read");
15394 exit(1);
15395 }
a7ffa9b9
NC
15396 if (!(
15397 18 <= FILE_cnt(fp) &&
15398 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15399 )) {
15400 puts("Fail even to read");
15401 exit (1);
15402 }
c1d9e6fa
JH
15403 ptr = (char*) FILE_ptr(fp);
15404 cnt = (size_t)FILE_cnt(fp);
a7ffa9b9 15405
c1d9e6fa 15406 FILE_ptr(fp) += 42;
a7ffa9b9 15407
c1d9e6fa 15408 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
a7ffa9b9
NC
15409 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15410 exit (1);
15411 }
15412 if (FILE_cnt(fp) <= 20) {
15413 printf ("Fail (<20 chars to test)");
15414 exit (1);
15415 }
15416 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15417 puts("Fail compare");
15418 exit (1);
15419 }
15420 if (cnt == FILE_cnt(fp)) {
15421 puts("Pass_unchanged");
15422 exit (0);
15423 }
15424 if (FILE_cnt(fp) == (cnt - 42)) {
15425 puts("Pass_changed");
15426 exit (0);
15427 }
15428 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15429 return 1;
15430
15431}
15432EOP
15433 set try
5440bc8e
JH
15434 if eval $compile && $to try.c; then
15435 case `$run ./try` in
a7ffa9b9 15436 Pass_changed)
2e32dcfe 15437 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
a7ffa9b9
NC
15438 d_stdio_ptr_lval_sets_cnt="$define" ;;
15439 Pass_unchanged)
15440 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
15441 d_stdio_ptr_lval_nochange_cnt="$define" ;;
15442 Fail*)
15443 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
15444 *)
15445 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15446 esac
15447 else
15448 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
15449 fi
15450 $rm -f try.c try
15451 ;;
15452esac
15453
b4eb6b3d
JH
15454: see if _base is also standard
15455val="$undef"
15456case "$d_stdstdio" in
15457$define)
15458 $cat >try.c <<EOP
15459#include <stdio.h>
15460#define FILE_base(fp) $stdio_base
15461#define FILE_bufsiz(fp) $stdio_bufsiz
15462int main() {
15463 FILE *fp = fopen("try.c", "r");
15464 char c = getc(fp);
15465 if (
15466 19 <= FILE_bufsiz(fp) &&
15467 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15468 )
15469 exit(0);
15470 exit(1);
15471}
15472EOP
15473 set try
5440bc8e
JH
15474 if eval $compile && $to try.c; then
15475 if $run ./try; then
b4eb6b3d
JH
15476 echo "And its _base field acts std."
15477 val="$define"
15478 else
15479 echo "But its _base field isn't std."
15480 fi
15481 else
15482 echo "However, it seems to be lacking the _base field."
15483 fi
15484 $rm -f try.c try
15485 ;;
15486esac
15487set d_stdiobase
15488eval $setvar
15489
15490$cat >&4 <<EOM
15491Checking how to access stdio streams by file descriptor number...
15492EOM
15493case "$stdio_stream_array" in
15494'') $cat >try.c <<EOCP
15495#include <stdio.h>
15496int main() {
15497 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15498 printf("yes\n");
15499}
15500EOCP
15501 for s in _iob __iob __sF
15502 do
15503 set try -DSTDIO_STREAM_ARRAY=$s
15504 if eval $compile; then
5440bc8e 15505 case "`$run ./try`" in
b4eb6b3d
JH
15506 yes) stdio_stream_array=$s; break ;;
15507 esac
15508 fi
15509 done
15510 $rm -f try.* try$exe_ext
15511esac
15512case "$stdio_stream_array" in
15513'') $cat >&4 <<EOM
15514I can't figure out how to access stdio streams by file descriptor number.
15515EOM
15516 d_stdio_stream_array="$undef"
15517 ;;
15518*) $cat >&4 <<EOM
15519You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15520EOM
15521 d_stdio_stream_array="$define"
15522 ;;
15523esac
15524
15525: see if strcoll exists
15526set strcoll d_strcoll
15527eval $inlibc
15528
15529: check for structure copying
15530echo " "
15531echo "Checking to see if your C compiler can copy structs..." >&4
15532$cat >try.c <<'EOCP'
15533int main()
15534{
15535 struct blurfl {
15536 int dyick;
15537 } foo, bar;
15538
15539 foo = bar;
15540}
15541EOCP
15542if $cc -c try.c >/dev/null 2>&1 ; then
15543 val="$define"
15544 echo "Yup, it can."
15545else
15546 val="$undef"
15547 echo "Nope, it can't."
15548fi
15549set d_strctcpy
15550eval $setvar
15551$rm -f try.*
15552
15553: see if strerror and/or sys_errlist[] exist
15554echo " "
15555if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15556 if set strerror val -f d_strerror; eval $csym; $val; then
15557 echo 'strerror() found.' >&4
15558 d_strerror="$define"
15559 d_strerrm='strerror(e)'
15560 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15561 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
15562 d_syserrlst="$define"
15563 else
15564 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15565 d_syserrlst="$undef"
15566 fi
15567 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15568 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15569 echo 'strerror() found in string header.' >&4
15570 d_strerror="$define"
15571 d_strerrm='strerror(e)'
15572 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15573 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15574 d_syserrlst="$define"
15575 else
15576 echo "(You don't appear to have any sys_errlist[], how can this be?)"
15577 d_syserrlst="$undef"
15578 fi
15579 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15580 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15581 d_strerror="$undef"
15582 d_syserrlst="$define"
15583 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15584 else
15585 echo 'strerror() and sys_errlist[] NOT found.' >&4
15586 d_strerror="$undef"
15587 d_syserrlst="$undef"
15588 d_strerrm='"unknown"'
15589 fi
15590fi
15591
10bc17b6
JH
15592: see if strerror_r exists
15593set strerror_r d_strerror_r
15594eval $inlibc
15595case "$d_strerror_r" in
15596"$define")
15597 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
15598 case "$d_strerror_r_proto:$usethreads" in
15599 ":define") d_strerror_r_proto=define
a48ec845
JH
15600 set d_strerror_r_proto strerror_r $hdrs
15601 eval $hasproto ;;
15602 *) ;;
15603 esac
15604 case "$d_strerror_r_proto" in
15605 define)
10bc17b6
JH
15606 case "$strerror_r_proto" in
15607 ''|0) try='int strerror_r(int, char*, size_t);'
15608 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15609 esac
15610 case "$strerror_r_proto" in
15611 ''|0) try='int strerror_r(int, char*, int);'
15612 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15613 esac
15614 case "$strerror_r_proto" in
15615 ''|0) try='char* strerror_r(int, char*, size_t);'
15616 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15617 esac
15618 case "$strerror_r_proto" in
90e831dc 15619 ''|0) d_strerror_r=undef
10bc17b6 15620 strerror_r_proto=0
a48ec845 15621 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15622 * ) case "$strerror_r_proto" in
15623 REENTRANT_PROTO*) ;;
15624 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15625 esac
15626 echo "Prototype: $try" ;;
15627 esac
15628 ;;
c18e646a
JH
15629 *) case "$usethreads" in
15630 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15631 esac
90e831dc
SB
15632 d_strerror_r=undef
15633 strerror_r_proto=0
c18e646a 15634 ;;
a48ec845
JH
15635 esac
15636 ;;
10bc17b6
JH
15637*) strerror_r_proto=0
15638 ;;
15639esac
15640
b3c85772
JH
15641: see if strftime exists
15642set strftime d_strftime
15643eval $inlibc
15644
b4eb6b3d
JH
15645: see if strtod exists
15646set strtod d_strtod
15647eval $inlibc
15648
15649: see if strtol exists
15650set strtol d_strtol
15651eval $inlibc
15652
15653: see if strtold exists
15654set strtold d_strtold
15655eval $inlibc
15656
15657: see if strtoll exists
15658set strtoll d_strtoll
15659eval $inlibc
15660
15661case "$d_longlong-$d_strtoll" in
15662"$define-$define")
15663 $cat <<EOM
15664Checking whether your strtoll() works okay...
15665EOM
15666 $cat >try.c <<'EOCP'
15667#include <errno.h>
15668#ifdef __hpux
15669#define strtoll __strtoll
15670#endif
e75931a7
YST
15671#ifdef __EMX__
15672#define strtoll _strtoll
15673#endif
b4eb6b3d
JH
15674#include <stdio.h>
15675extern long long int strtoll(char *s, char **, int);
15676static int bad = 0;
15677int check(char *s, long long ell, int een) {
15678 long long gll;
15679 errno = 0;
15680 gll = strtoll(s, 0, 10);
15681 if (!((gll == ell) && (errno == een)))
15682 bad++;
15683}
15684int main() {
15685 check(" 1", 1LL, 0);
15686 check(" 0", 0LL, 0);
15687 check("-1", -1LL, 0);
15688 check("-9223372036854775808", -9223372036854775808LL, 0);
15689 check("-9223372036854775808", -9223372036854775808LL, 0);
15690 check(" 9223372036854775807", 9223372036854775807LL, 0);
15691 check("-9223372036854775808", -9223372036854775808LL, 0);
15692 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
15693 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15694 if (!bad)
15695 printf("ok\n");
15696}
15697EOCP
15698 set try
15699 if eval $compile; then
5440bc8e 15700 yyy=`$run ./try`
e75931a7 15701 case "$yyy" in
b4eb6b3d
JH
15702 ok) echo "Your strtoll() seems to be working okay." ;;
15703 *) cat <<EOM >&4
15704Your strtoll() doesn't seem to be working okay.
15705EOM
15706 d_strtoll="$undef"
15707 ;;
69eadf66 15708 esac
e75931a7
YST
15709 else
15710 echo "(I can't seem to compile the test program--assuming it doesn't)"
15711 d_strtoll="$undef"
b4eb6b3d
JH
15712 fi
15713 ;;
15714esac
15715
28e5dec8
JH
15716: see if strtoq exists
15717set strtoq d_strtoq
15718eval $inlibc
15719
b4eb6b3d
JH
15720: see if strtoul exists
15721set strtoul d_strtoul
15722eval $inlibc
15723
d0e6d399
NC
15724case "$d_strtoul" in
15725"$define")
15726 $cat <<EOM
15727Checking whether your strtoul() works okay...
15728EOM
15729 $cat >try.c <<'EOCP'
15730#include <errno.h>
15731#include <stdio.h>
15732extern unsigned long int strtoul(char *s, char **, int);
15733static int bad = 0;
15734void check(char *s, unsigned long eul, int een) {
15735 unsigned long gul;
15736 errno = 0;
15737 gul = strtoul(s, 0, 10);
15738 if (!((gul == eul) && (errno == een)))
15739 bad++;
15740}
15741int main() {
15742 check(" 1", 1L, 0);
15743 check(" 0", 0L, 0);
15744EOCP
15745 case "$longsize" in
15746 8)
15747 $cat >>try.c <<'EOCP'
09c0d2c4
JH
15748 check("18446744073709551615", 18446744073709551615UL, 0);
15749 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 15750#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 15751 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
15752 check("-18446744073709551614", 2, 0);
15753 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
15754 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15755 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 15756#endif
d0e6d399
NC
15757EOCP
15758 ;;
15759 4)
15760 $cat >>try.c <<'EOCP'
15761 check("4294967295", 4294967295UL, 0);
15762 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 15763#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
15764 check("-1", 4294967295UL, 0);
15765 check("-4294967294", 2, 0);
15766 check("-4294967295", 1, 0);
15767 check("-4294967296", 4294967295UL, ERANGE);
15768 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 15769#endif
d0e6d399
NC
15770EOCP
15771 ;;
15772 *)
15773: Should we write these tests to be more portable by sprintf-ing
15774: ~0 and then manipulating that char string as input for strtol?
15775 ;;
15776 esac
15777 $cat >>try.c <<'EOCP'
15778 if (!bad)
15779 printf("ok\n");
15780 return 0;
15781}
15782EOCP
15783 set try
15784 if eval $compile; then
5440bc8e 15785 case "`$run ./try`" in
d0e6d399
NC
15786 ok) echo "Your strtoul() seems to be working okay." ;;
15787 *) cat <<EOM >&4
15788Your strtoul() doesn't seem to be working okay.
15789EOM
15790 d_strtoul="$undef"
15791 ;;
15792 esac
15793 fi
15794 ;;
15795esac
15796
b4eb6b3d
JH
15797: see if strtoull exists
15798set strtoull d_strtoull
15799eval $inlibc
15800
15801case "$d_longlong-$d_strtoull" in
15802"$define-$define")
15803 $cat <<EOM
15804Checking whether your strtoull() works okay...
15805EOM
15806 $cat >try.c <<'EOCP'
15807#include <errno.h>
15808#ifdef __hpux
15809#define strtoull __strtoull
15810#endif
15811#include <stdio.h>
15812extern unsigned long long int strtoull(char *s, char **, int);
15813static int bad = 0;
15814int check(char *s, long long eull, int een) {
15815 long long gull;
15816 errno = 0;
15817 gull = strtoull(s, 0, 10);
15818 if (!((gull == eull) && (errno == een)))
15819 bad++;
15820}
15821int main() {
d0e6d399
NC
15822 check(" 1", 1LL, 0);
15823 check(" 0", 0LL, 0);
15824 check("18446744073709551615", 18446744073709551615ULL, 0);
15825 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 15826#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
15827 check("-1", 18446744073709551615ULL, 0);
15828 check("-18446744073709551614", 2LL, 0);
15829 check("-18446744073709551615", 1LL, 0);
15830 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15831 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 15832#endif
b4eb6b3d
JH
15833 if (!bad)
15834 printf("ok\n");
15835}
15836EOCP
15837 set try
15838 if eval $compile; then
5440bc8e 15839 case "`$run ./try`" in
b4eb6b3d
JH
15840 ok) echo "Your strtoull() seems to be working okay." ;;
15841 *) cat <<EOM >&4
15842Your strtoull() doesn't seem to be working okay.
15843EOM
15844 d_strtoull="$undef"
15845 ;;
15846 esac
15847 fi
15848 ;;
15849esac
15850
15851: see if strtouq exists
15852set strtouq d_strtouq
15853eval $inlibc
15854
d0e6d399
NC
15855case "$d_strtouq" in
15856"$define")
15857 $cat <<EOM
15858Checking whether your strtouq() works okay...
15859EOM
15860 $cat >try.c <<'EOCP'
15861#include <errno.h>
15862#include <stdio.h>
15863extern unsigned long long int strtouq(char *s, char **, int);
15864static int bad = 0;
15865void check(char *s, unsigned long long eull, int een) {
15866 unsigned long long gull;
15867 errno = 0;
15868 gull = strtouq(s, 0, 10);
15869 if (!((gull == eull) && (errno == een)))
15870 bad++;
15871}
15872int main() {
15873 check(" 1", 1LL, 0);
15874 check(" 0", 0LL, 0);
15875 check("18446744073709551615", 18446744073709551615ULL, 0);
15876 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 15877#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
15878 check("-1", 18446744073709551615ULL, 0);
15879 check("-18446744073709551614", 2LL, 0);
15880 check("-18446744073709551615", 1LL, 0);
15881 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15882 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 15883#endif
d0e6d399
NC
15884 if (!bad)
15885 printf("ok\n");
15886 return 0;
15887}
15888EOCP
15889 set try
15890 if eval $compile; then
5440bc8e 15891 case "`$run ./try`" in
d0e6d399
NC
15892 ok) echo "Your strtouq() seems to be working okay." ;;
15893 *) cat <<EOM >&4
15894Your strtouq() doesn't seem to be working okay.
15895EOM
15896 d_strtouq="$undef"
15897 ;;
15898 esac
15899 fi
15900 ;;
15901esac
15902
b4eb6b3d
JH
15903: see if strxfrm exists
15904set strxfrm d_strxfrm
15905eval $inlibc
15906
15907: see if symlink exists
15908set symlink d_symlink
15909eval $inlibc
15910
15911: see if syscall exists
15912set syscall d_syscall
15913eval $inlibc
15914
2ef53570
JH
15915: see if prototype for syscall is available
15916echo " "
15917set d_syscallproto syscall $i_unistd unistd.h
15918eval $hasproto
15919
b4eb6b3d
JH
15920: see if sysconf exists
15921set sysconf d_sysconf
15922eval $inlibc
15923
15924: see if system exists
15925set system d_system
15926eval $inlibc
15927
15928: see if tcgetpgrp exists
15929set tcgetpgrp d_tcgetpgrp
15930eval $inlibc
15931
15932: see if tcsetpgrp exists
15933set tcsetpgrp d_tcsetpgrp
15934eval $inlibc
15935
15936: see if prototype for telldir is available
15937echo " "
15938set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15939eval $hasproto
15940
ad493445
MB
15941: see if time exists
15942echo " "
15943if test "X$d_time" = X -o X"$timetype" = X; then
15944 if set time val -f d_time; eval $csym; $val; then
15945 echo 'time() found.' >&4
15946 val="$define"
15947 rp="What is the type returned by time() on this system?"
15948 set time_t timetype long stdio.h sys/types.h
15949 eval $typedef_ask
15950 else
15951 echo 'time() not found, hope that will do.' >&4
15952 val="$undef"
15953 timetype='int';
15954 fi
15955 set d_time
15956 eval $setvar
15957fi
15958
b4eb6b3d
JH
15959: see if this is a sys/times.h system
15960set sys/times.h i_systimes
15961eval $inhdr
15962
15963: see if times exists
15964echo " "
15965if set times val -f d_times; eval $csym; $val; then
15966 echo 'times() found.' >&4
15967 d_times="$define"
15968 inc=''
15969 case "$i_systimes" in
15970 "$define") inc='sys/times.h';;
15971 esac
15972 rp="What is the type returned by times() on this system?"
15973 set clock_t clocktype long stdio.h sys/types.h $inc
15974 eval $typedef_ask
15975else
15976 echo 'times() NOT found, hope that will do.' >&4
15977 d_times="$undef"
15978 clocktype='int'
15979fi
15980
10bc17b6
JH
15981: see if tmpnam_r exists
15982set tmpnam_r d_tmpnam_r
15983eval $inlibc
15984case "$d_tmpnam_r" in
15985"$define")
31ee0cb7 15986 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
15987 case "$d_tmpnam_r_proto:$usethreads" in
15988 ":define") d_tmpnam_r_proto=define
a48ec845
JH
15989 set d_tmpnam_r_proto tmpnam_r $hdrs
15990 eval $hasproto ;;
15991 *) ;;
15992 esac
15993 case "$d_tmpnam_r_proto" in
15994 define)
10bc17b6
JH
15995 case "$tmpnam_r_proto" in
15996 ''|0) try='char* tmpnam_r(char*);'
15997 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15998 esac
15999 case "$tmpnam_r_proto" in
90e831dc 16000 ''|0) d_tmpnam_r=undef
10bc17b6 16001 tmpnam_r_proto=0
a48ec845 16002 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16003 * ) case "$tmpnam_r_proto" in
16004 REENTRANT_PROTO*) ;;
16005 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16006 esac
16007 echo "Prototype: $try" ;;
16008 esac
16009 ;;
c18e646a
JH
16010 *) case "$usethreads" in
16011 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16012 esac
90e831dc
SB
16013 d_tmpnam_r=undef
16014 tmpnam_r_proto=0
c18e646a 16015 ;;
a48ec845
JH
16016 esac
16017 ;;
10bc17b6
JH
16018*) tmpnam_r_proto=0
16019 ;;
16020esac
16021
b4eb6b3d
JH
16022: see if truncate exists
16023set truncate d_truncate
16024eval $inlibc
16025
10bc17b6
JH
16026: see if ttyname_r exists
16027set ttyname_r d_ttyname_r
16028eval $inlibc
16029case "$d_ttyname_r" in
16030"$define")
16031 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
16032 case "$d_ttyname_r_proto:$usethreads" in
16033 ":define") d_ttyname_r_proto=define
a48ec845
JH
16034 set d_ttyname_r_proto ttyname_r $hdrs
16035 eval $hasproto ;;
16036 *) ;;
16037 esac
16038 case "$d_ttyname_r_proto" in
16039 define)
10bc17b6
JH
16040 case "$ttyname_r_proto" in
16041 ''|0) try='int ttyname_r(int, char*, size_t);'
16042 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16043 esac
16044 case "$ttyname_r_proto" in
16045 ''|0) try='int ttyname_r(int, char*, int);'
16046 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16047 esac
16048 case "$ttyname_r_proto" in
16049 ''|0) try='char* ttyname_r(int, char*, int);'
16050 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16051 esac
16052 case "$ttyname_r_proto" in
90e831dc 16053 ''|0) d_ttyname_r=undef
10bc17b6 16054 ttyname_r_proto=0
a48ec845 16055 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16056 * ) case "$ttyname_r_proto" in
16057 REENTRANT_PROTO*) ;;
16058 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16059 esac
16060 echo "Prototype: $try" ;;
16061 esac
16062 ;;
c18e646a
JH
16063 *) case "$usethreads" in
16064 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16065 esac
90e831dc
SB
16066 d_ttyname_r=undef
16067 ttyname_r_proto=0
c18e646a 16068 ;;
a48ec845
JH
16069 esac
16070 ;;
10bc17b6
JH
16071*) ttyname_r_proto=0
16072 ;;
16073esac
16074
b4eb6b3d
JH
16075: see if tzname[] exists
16076echo " "
16077if set tzname val -a d_tzname; eval $csym; $val; then
16078 val="$define"
16079 echo 'tzname[] found.' >&4
16080else
16081 val="$undef"
16082 echo 'tzname[] NOT found.' >&4
16083fi
16084set d_tzname
16085eval $setvar
16086
4e0554ec
JH
16087case "$osname" in
16088next|rhapsody|darwin) multiarch="$define" ;;
16089esac
16090case "$multiarch" in
16091''|[nN]*) multiarch="$undef" ;;
16092esac
16093
24412007 16094: check for ordering of bytes in a UV
4e0554ec 16095echo " "
5440bc8e 16096case "$usecrosscompile$multiarch" in
4e0554ec
JH
16097*$define*)
16098 $cat <<EOM
16099You seem to be either cross-compiling or doing a multiarchitecture build,
16100skipping the byteorder check.
16101
16102EOM
5440bc8e 16103 byteorder='ffff'
4e0554ec
JH
16104 ;;
16105*)
16106 case "$byteorder" in
16107 '')
16108 $cat <<'EOM'
16109In the following, larger digits indicate more significance. A big-endian
16110machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16111little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16112machines may have weird orders like 3412. A Cray will report 87654321,
16113an Alpha will report 12345678. If the test program works the default is
16114probably right.
16115I'm now running the test program...
16116EOM
24412007 16117 $cat >try.c <<EOCP
4e0554ec 16118#include <stdio.h>
24412007
JH
16119#include <sys/types.h>
16120typedef $uvtype UV;
4e0554ec
JH
16121int main()
16122{
16123 int i;
16124 union {
24412007
JH
16125 UV l;
16126 char c[$uvsize];
4e0554ec
JH
16127 } u;
16128
24412007 16129 if ($uvsize > 4)
b5ded3e5 16130 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 16131 else
a4c53327 16132 u.l = (UV)0x04030201;
24412007 16133 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
16134 printf("%c", u.c[i]+'0');
16135 printf("\n");
16136 exit(0);
16137}
16138EOCP
16139 xxx_prompt=y
16140 set try
16141 if eval $compile && ./try > /dev/null; then
5440bc8e 16142 dflt=`$run ./try`
4e0554ec
JH
16143 case "$dflt" in
16144 [1-4][1-4][1-4][1-4]|12345678|87654321)
16145 echo "(The test program ran ok.)"
16146 echo "byteorder=$dflt"
16147 xxx_prompt=n
16148 ;;
16149 ????|????????) echo "(The test program ran ok.)" ;;
16150 *) echo "(The test program didn't run right for some reason.)" ;;
16151 esac
16152 else
16153 dflt='4321'
16154 cat <<'EOM'
16155(I can't seem to compile the test program. Guessing big-endian...)
16156EOM
16157 fi
16158 case "$xxx_prompt" in
16159 y)
24412007 16160 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
16161 . ./myread
16162 byteorder="$ans"
16163 ;;
16164 *) byteorder=$dflt
16165 ;;
16166 esac
16167 ;;
16168 esac
16169 $rm -f try.c try
16170 ;;
16171esac
16172
16173
16174$cat <<EOM
16175
16176Checking to see whether you can access character data unalignedly...
16177EOM
dc7b0a4f
JH
16178case "$d_u32align" in
16179'') $cat >try.c <<EOCP
4e0554ec
JH
16180#include <stdio.h>
16181#define U32 $u32type
d308175a
JH
16182#define BYTEORDER 0x$byteorder
16183#define U8 $u8type
9958dc3c
JH
16184#include <signal.h>
16185#ifdef SIGBUS
16186$signal_t bletch(s) int s; { exit(4); }
16187#endif
4e0554ec
JH
16188int main() {
16189#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 16190 U8 buf[8];
4e0554ec
JH
16191 U32 *up;
16192 int i;
16193
16194 if (sizeof(U32) != 4) {
16195 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16196 exit(1);
16197 }
16198
16199 fflush(stdout);
16200
9958dc3c
JH
16201#ifdef SIGBUS
16202 signal(SIGBUS, bletch);
16203#endif
16204
8906a23e
JH
16205 buf[0] = 0;
16206 buf[1] = 0;
16207 buf[2] = 0;
16208 buf[3] = 1;
16209 buf[5] = 0;
16210 buf[6] = 0;
16211 buf[7] = 0;
16212 buf[8] = 1;
16213
4e0554ec
JH
16214 for (i = 0; i < 4; i++) {
16215 up = (U32*)(buf + i);
16216 if (! ((*up == 1 << (8*i)) || /* big-endian */
16217 (*up == 1 << (8*(3-i))) /* little-endian */
16218 )
16219 )
16220 {
16221 printf("read failed (%x)\n", *up);
16222 exit(2);
16223 }
16224 }
16225
16226 /* write test */
16227 for (i = 0; i < 4; i++) {
16228 up = (U32*)(buf + i);
16229 *up = 0xBeef;
16230 if (*up != 0xBeef) {
16231 printf("write failed (%x)\n", *up);
16232 exit(3);
16233 }
16234 }
16235
16236 exit(0);
16237#else
16238 printf("1\n");
16239 exit(1);
16240#endif
16241 return 0;
16242}
16243EOCP
16244set try
16245if eval $compile_ok; then
d308175a 16246 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 16247 $run ./try 2>&1 >/dev/null
4e0554ec
JH
16248 case "$?" in
16249 0) cat >&4 <<EOM
16250You can access character data pretty unalignedly.
16251EOM
16252 d_u32align="$undef"
16253 ;;
16254 *) cat >&4 <<EOM
16255It seems that you must access character data in an aligned manner.
16256EOM
16257 d_u32align="$define"
16258 ;;
16259 esac
4e0554ec
JH
16260else
16261 rp='Can you access character data at unaligned addresses?'
16262 dflt='n'
16263 . ./myread
16264 case "$ans" in
16265 [yY]*) d_u32align="$undef" ;;
16266 *) d_u32align="$define" ;;
16267 esac
16268fi
e36b5403 16269$rm -f core core.try.* try.core
dc7b0a4f
JH
16270;;
16271esac
4e0554ec
JH
16272
16273: see if ualarm exists
16274set ualarm d_ualarm
16275eval $inlibc
16276
b4eb6b3d
JH
16277: see if umask exists
16278set umask d_umask
16279eval $inlibc
16280
758a5d79
JH
16281: see if unordered exists
16282set unordered d_unordered
16283eval $inlibc
16284
4e0554ec
JH
16285: see if usleep exists
16286set usleep d_usleep
16287eval $inlibc
16288
2ef53570
JH
16289: see if prototype for usleep is available
16290echo " "
16291set d_usleepproto usleep $i_unistd unistd.h
16292eval $hasproto
16293
b4eb6b3d
JH
16294: see if ustat exists
16295set ustat d_ustat
16296eval $inlibc
16297
16298: backward compatibility for d_hvfork
16299if test X$d_hvfork != X; then
16300 d_vfork="$d_hvfork"
16301 d_hvfork=''
16302fi
16303: see if there is a vfork
16304val=''
16305set vfork val
16306eval $inlibc
16307
16308: Ok, but do we want to use it. vfork is reportedly unreliable in
16309: perl on Solaris 2.x, and probably elsewhere.
16310case "$val" in
16311$define)
16312 echo " "
16313 case "$usevfork" in
16314 false) dflt='n';;
16315 *) dflt='y';;
16316 esac
16317 cat <<'EOM'
16318
16319Perl can only use a vfork() that doesn't suffer from strict
16320restrictions on calling functions or modifying global data in
16321the child. For example, glibc-2.1 contains such a vfork()
16322that is unsuitable. If your system provides a proper fork()
16323call, chances are that you do NOT want perl to use vfork().
16324
16325EOM
16326 rp="Do you still want to use vfork()?"
16327 . ./myread
16328 case "$ans" in
16329 y|Y) ;;
16330 *)
16331 echo "Ok, we won't use vfork()."
16332 val="$undef"
16333 ;;
16334 esac
16335 ;;
16336esac
16337set d_vfork
16338eval $setvar
16339case "$d_vfork" in
16340$define) usevfork='true';;
16341*) usevfork='false';;
16342esac
16343
b4eb6b3d
JH
16344: see if closedir exists
16345set closedir d_closedir
16346eval $inlibc
16347
16348case "$d_closedir" in
16349"$define")
16350 echo " "
16351 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 16352 cat > try.c <<EOM
b4eb6b3d
JH
16353#$i_dirent I_DIRENT /**/
16354#$i_sysdir I_SYS_DIR /**/
16355#$i_sysndir I_SYS_NDIR /**/
16356#$i_systypes I_SYS_TYPES /**/
16357
16358#if defined(I_SYS_TYPES)
16359#include <sys/types.h>
16360#endif
16361#if defined(I_DIRENT)
16362#include <dirent.h>
16363#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16364#include <sys/dir.h>
16365#endif
16366#else
16367#ifdef I_SYS_NDIR
16368#include <sys/ndir.h>
16369#else
16370#ifdef I_SYS_DIR
16371#ifdef hp9000s500
16372#include <ndir.h> /* may be wrong in the future */
16373#else
16374#include <sys/dir.h>
16375#endif
16376#endif
16377#endif
16378#endif
16379int main() { return closedir(opendir(".")); }
16380EOM
5440bc8e 16381 set try
b4eb6b3d 16382 if eval $compile_ok; then
5440bc8e 16383 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
16384 echo "Yes, it does."
16385 val="$undef"
16386 else
16387 echo "No, it doesn't."
16388 val="$define"
16389 fi
16390 else
16391 echo "(I can't seem to compile the test program--assuming it doesn't)"
16392 val="$define"
16393 fi
16394 ;;
16395*)
16396 val="$undef";
16397 ;;
16398esac
16399set d_void_closedir
16400eval $setvar
5440bc8e 16401$rm -f try try.*
b4eb6b3d
JH
16402: see if there is a wait4
16403set wait4 d_wait4
16404eval $inlibc
16405
16406: see if waitpid exists
16407set waitpid d_waitpid
16408eval $inlibc
16409
16410: see if wcstombs exists
16411set wcstombs d_wcstombs
16412eval $inlibc
16413
16414: see if wctomb exists
16415set wctomb d_wctomb
16416eval $inlibc
16417
4e0554ec
JH
16418: see if writev exists
16419set writev d_writev
16420eval $inlibc
16421
b4eb6b3d
JH
16422: preserve RCS keywords in files with variable substitution, grrr
16423Date='$Date'
16424Id='$Id'
16425Log='$Log'
16426RCSfile='$RCSfile'
16427Revision='$Revision'
16428
b4eb6b3d
JH
16429: check for alignment requirements
16430echo " "
5440bc8e 16431case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
16432*$define*)
16433 $cat <<EOM
16434You seem to be either cross-compiling or doing a multiarchitecture build,
16435skipping the memory alignment check.
16436
16437EOM
16438 case "$alignbytes" in
16439 '') alignbytes=8 ;;
16440 esac
16441 ;;
16442*)
16443 case "$alignbytes" in
16444 '') echo "Checking alignment constraints..." >&4
16445 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16446 $cat >try.c <<'EOCP'
16447typedef long double NV;
16448EOCP
16449 else
16450 $cat >try.c <<'EOCP'
16451typedef double NV;
16452EOCP
16453 fi
16454 $cat >>try.c <<'EOCP'
16455#include <stdio.h>
16456struct foobar {
16457 char foo;
16458 NV bar;
16459} try_algn;
16460int main()
16461{
16462 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16463 return(0);
16464}
16465EOCP
16466 set try
16467 if eval $compile_ok; then
5440bc8e 16468 dflt=`$run ./try`
b4eb6b3d
JH
16469 else
16470 dflt='8'
16471 echo "(I can't seem to compile the test program...)"
16472 fi
16473 ;;
16474 *) dflt="$alignbytes"
16475 ;;
16476 esac
16477 rp="Doubles must be aligned on a how-many-byte boundary?"
16478 . ./myread
16479 alignbytes="$ans"
16480 $rm -f try.c try
16481 ;;
16482esac
16483
16484
16485: set the base revision
16486baserev=5.0
16487
b4eb6b3d
JH
16488: how do we catenate cpp tokens here?
16489echo " "
16490echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16491$cat >cpp_stuff.c <<'EOCP'
16492#define RCAT(a,b)a/**/b
16493#define ACAT(a,b)a ## b
16494RCAT(Rei,ser)
16495ACAT(Cir,cus)
16496EOCP
16497$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16498if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16499 echo "Oh! Smells like ANSI's been here." >&4
16500 echo "We can catify or stringify, separately or together!"
16501 cpp_stuff=42
16502elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16503 echo "Ah, yes! The good old days!" >&4
16504 echo "However, in the good old days we don't know how to stringify and"
16505 echo "catify at the same time."
16506 cpp_stuff=1
16507else
16508 $cat >&4 <<EOM
16509Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
16510to have to edit the values of CAT[2-5] in config.h...
16511EOM
16512 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16513fi
16514$rm -f cpp_stuff.*
16515
16516: see if this is a db.h system
16517set db.h i_db
16518eval $inhdr
16519
16520case "$i_db" in
16521$define)
16522 : Check db version.
16523 echo " "
16524 echo "Checking Berkeley DB version ..." >&4
16525 $cat >try.c <<EOCP
16526#$d_const HASCONST
16527#ifndef HASCONST
16528#define const
16529#endif
16530#include <sys/types.h>
16531#include <stdio.h>
16532#include <db.h>
640374d0 16533int main(int argc, char *argv[])
b4eb6b3d
JH
16534{
16535#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16536 int Major, Minor, Patch ;
16537 unsigned long Version ;
16538 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
16539 if (argc == 2) {
16540 printf("%d %d %d %d %d %d\n",
16541 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16542 Major, Minor, Patch);
16543 exit(0);
16544 }
16545 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
16546
16547 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16548 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16549 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16550 Major, Minor, Patch) ;
16551
16552 /* check that db.h & libdb are compatible */
16553 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 16554 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
16555 exit(3);
16556 }
16557
640374d0 16558 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
16559
16560 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16561 + DB_VERSION_PATCH ;
16562
16563 /* needs to be >= 2.3.4 */
16564 if (Version < 2003004) {
16565 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 16566 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
16567 exit(2);
16568 }
16569
16570 exit(0);
16571#else
16572#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
16573 if (argc == 2) {
16574 printf("1 0 0\n");
16575 exit(0);
16576 }
16577 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
16578 exit(0); /* DB version < 2: the coast is clear. */
16579#else
16580 exit(1); /* <db.h> not Berkeley DB? */
16581#endif
16582#endif
16583}
16584EOCP
16585 set try
5440bc8e 16586 if eval $compile_ok && $run ./try; then
b4eb6b3d 16587 echo 'Looks OK.' >&4
5440bc8e 16588 set `$run ./try 1`
640374d0
JH
16589 db_version_major=$1
16590 db_version_minor=$2
16591 db_version_patch=$3
b4eb6b3d
JH
16592 else
16593 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
16594 i_db=$undef
16595 case " $libs " in
16596 *"-ldb "*)
16597 : Remove db from list of libraries to use
16598 echo "Removing unusable -ldb from library list" >&4
16599 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16600 shift
16601 libs="$*"
16602 echo "libs = $libs" >&4
16603 ;;
16604 esac
16605 fi
16606 $rm -f try.*
16607 ;;
16608esac
16609
16610case "$i_db" in
16611define)
16612 : Check the return type needed for hash
16613 echo " "
16614 echo "Checking return type needed for hash for Berkeley DB ..." >&4
16615 $cat >try.c <<EOCP
16616#$d_const HASCONST
16617#ifndef HASCONST
16618#define const
16619#endif
16620#include <sys/types.h>
16621#include <db.h>
16622
16623#ifndef DB_VERSION_MAJOR
16624u_int32_t hash_cb (ptr, size)
16625const void *ptr;
16626size_t size;
16627{
16628}
16629HASHINFO info;
16630int main()
16631{
16632 info.hash = hash_cb;
16633}
16634#endif
16635EOCP
16636 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16637 if $contains warning try.out >>/dev/null 2>&1 ; then
16638 db_hashtype='int'
16639 else
16640 db_hashtype='u_int32_t'
16641 fi
16642 else
16643 : XXX Maybe we should just give up here.
16644 db_hashtype=u_int32_t
16645 $cat try.out >&4
16646 echo "Help: I can't seem to compile the db test program." >&4
16647 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16648 fi
16649 $rm -f try.*
16650 echo "Your version of Berkeley DB uses $db_hashtype for hash."
16651 ;;
16652*) db_hashtype=u_int32_t
16653 ;;
16654esac
16655case "$i_db" in
16656define)
16657 : Check the return type needed for prefix
16658 echo " "
16659 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16660 cat >try.c <<EOCP
16661#$d_const HASCONST
16662#ifndef HASCONST
16663#define const
16664#endif
16665#include <sys/types.h>
16666#include <db.h>
16667
16668#ifndef DB_VERSION_MAJOR
16669size_t prefix_cb (key1, key2)
16670const DBT *key1;
16671const DBT *key2;
16672{
16673}
16674BTREEINFO info;
16675int main()
16676{
16677 info.prefix = prefix_cb;
16678}
16679#endif
16680EOCP
16681 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16682 if $contains warning try.out >>/dev/null 2>&1 ; then
16683 db_prefixtype='int'
16684 else
16685 db_prefixtype='size_t'
16686 fi
16687 else
16688 db_prefixtype='size_t'
16689 : XXX Maybe we should just give up here.
16690 $cat try.out >&4
16691 echo "Help: I can't seem to compile the db test program." >&4
16692 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16693 fi
16694 $rm -f try.*
16695 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16696 ;;
16697*) db_prefixtype='size_t'
16698 ;;
16699esac
16700
b4eb6b3d
JH
16701
16702: How can we generate normalized random numbers ?
16703echo " "
16704echo "Looking for a random number function..." >&4
16705case "$randfunc" in
16706'')
16707 if set drand48 val -f; eval $csym; $val; then
16708 dflt="drand48"
16709 echo "Good, found drand48()." >&4
16710 elif set random val -f; eval $csym; $val; then
16711 dflt="random"
16712 echo "OK, found random()." >&4
16713 else
16714 dflt="rand"
16715 echo "Yick, looks like I have to use rand()." >&4
16716 fi
16717 echo " "
16718 ;;
16719*)
16720 dflt="$randfunc"
16721 ;;
16722esac
16723cont=true
16724
16725case "$ccflags" in
16726*-Dmy_rand=*|*-Dmy_srand=*)
16727 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16728 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16729 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16730 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16731 ;;
16732esac
16733
16734while $test "$cont"; do
16735 rp="Use which function to generate random numbers?"
16736 . ./myread
16737 if $test "$ans" = "$dflt"; then
16738 : null
16739 else
16740 randbits=''
16741 fi
16742 randfunc="$ans"
16743 if set $ans val -f; eval $csym; $val; then
16744 cont=''
16745 else
16746 dflt=y
16747 rp="I cannot find function $ans. Use that name anyway?"
16748 . ./myread
16749 dflt=rand
16750 case "$ans" in
16751 [yY]*) cont='';;
16752 esac
16753 fi
16754 case "$cont" in
16755 '')
16756 case "$randfunc" in
16757 drand48)
16758 drand01="drand48()"
16759 seedfunc="srand48"
16760 randbits=48
16761 randseedtype=long
16762 ;;
16763 rand|random)
16764 case "$randbits" in
16765 '')
16766echo "Checking to see how many bits your $randfunc() function produces..." >&4
16767 $cat >try.c <<EOCP
16768#$i_unistd I_UNISTD
16769#$i_stdlib I_STDLIB
16770#include <stdio.h>
16771#ifdef I_UNISTD
16772# include <unistd.h>
16773#endif
16774#ifdef I_STDLIB
16775# include <stdlib.h>
16776#endif
16777int main()
16778{
16779 register int i;
16780 register unsigned long tmp;
16781 register unsigned long max = 0L;
16782
16783 for (i = 1000; i; i--) {
16784 tmp = (unsigned long) $randfunc();
16785 if (tmp > max) max = tmp;
16786 }
16787 for (i = 0; max; i++)
16788 max /= 2;
16789 printf("%d\n",i);
16790}
16791EOCP
16792 set try
16793 if eval $compile_ok; then
16794 dflt=`try`
16795 else
16796 dflt='?'
16797 echo "(I can't seem to compile the test program...)"
16798 fi
16799 ;;
16800 *)
16801 dflt="$randbits"
16802 ;;
16803 esac
16804 rp="How many bits does your $randfunc() function produce?"
16805 . ./myread
16806 randbits="$ans"
16807 $rm -f try.c try
16808 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16809 seedfunc="s$randfunc"
16810 randseedtype=unsigned
16811 ;;
16812 *)
16813 dflt="31"
16814 rp="How many bits does your $randfunc() function produce?"
16815 . ./myread
16816 randbits="$ans"
16817 seedfunc="s$randfunc"
16818 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16819 if set $seedfunc val -f; eval $csym; $val; then
16820 echo "(Using $seedfunc() to seed random generator)"
16821 else
16822 echo "(Warning: no $seedfunc() to seed random generator)"
16823 seedfunc=rand
16824 fi
16825 randseedtype=unsigned
16826 ;;
16827 esac
16828 ;;
16829 esac
16830done
16831
16832echo " "
16833echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 16834$cat >try.c <<'EOM'
b4eb6b3d
JH
16835int main()
16836{
16837 if ('M'==0xd4) return 0;
16838 return 1;
16839}
16840EOM
16841
16842val=$undef
5440bc8e 16843set try
b4eb6b3d 16844if eval $compile_ok; then
5440bc8e 16845 if $run ./try; then
b4eb6b3d
JH
16846 echo "You seem to speak EBCDIC." >&4
16847 val="$define"
16848 else
5440bc8e 16849 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
16850 fi
16851else
16852 echo "I'm unable to compile the test program." >&4
16853 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16854fi
5440bc8e 16855$rm -f try try.*
b4eb6b3d
JH
16856set ebcdic
16857eval $setvar
16858
16859echo " "
16860$cat >&4 <<EOM
16861Checking how to flush all pending stdio output...
16862EOM
16863# I only know how to find the first 32 possibly open files on SunOS.
16864# See also hints/sunos_4_1.sh and util.c --AD
16865case "$osname" in
16866sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16867esac
16868$cat >>try.c <<EOCP
16869#include <stdio.h>
16870#$i_unistd I_UNISTD
16871#ifdef I_UNISTD
16872# include <unistd.h>
16873#endif
16874#$d_sysconf HAS_SYSCONF
16875#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16876#ifdef HAS_STDIO_STREAM_ARRAY
16877# define STDIO_STREAM_ARRAY $stdio_stream_array
16878#endif
16879int main() {
5440bc8e
JH
16880 FILE* p;
16881 unlink("try.out");
16882 p = fopen("try.out", "w");
b4eb6b3d
JH
16883#ifdef TRY_FPUTC
16884 fputc('x', p);
16885#else
16886# ifdef TRY_FPRINTF
16887 fprintf(p, "x");
16888# endif
16889#endif
16890#ifdef TRY_FFLUSH_NULL
16891 fflush(NULL);
16892#endif
16893#ifdef TRY_FFLUSH_ALL
16894 {
16895 long open_max = -1;
16896# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16897 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16898# else
16899# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16900 open_max = sysconf(_SC_OPEN_MAX);
16901# else
16902# ifdef FOPEN_MAX
16903 open_max = FOPEN_MAX;
16904# else
16905# ifdef OPEN_MAX
16906 open_max = OPEN_MAX;
16907# else
16908# ifdef _NFILE
16909 open_max = _NFILE;
16910# endif
16911# endif
16912# endif
16913# endif
16914# endif
16915# ifdef HAS_STDIO_STREAM_ARRAY
16916 if (open_max > 0) {
16917 long i;
16918 for (i = 0; i < open_max; i++)
16919 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16920 STDIO_STREAM_ARRAY[i]._file < open_max &&
16921 STDIO_STREAM_ARRAY[i]._flag)
16922 fflush(&STDIO_STREAM_ARRAY[i]);
16923 }
16924 }
16925# endif
16926#endif
16927 _exit(42);
16928}
16929EOCP
16930: first we have to find out how _not_ to flush
5440bc8e 16931$to try.c
b4eb6b3d
JH
16932if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16933 output=''
16934 set try -DTRY_FPUTC
16935 if eval $compile; then
fbe73d74 16936 $run ./try 2>/dev/null
28f5ac64 16937 code="$?"
5440bc8e 16938 $from try.out
28f5ac64 16939 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
16940 output=-DTRY_FPUTC
16941 fi
16942 fi
16943 case "$output" in
16944 '')
16945 set try -DTRY_FPRINTF
b4eb6b3d 16946 if eval $compile; then
fbe73d74 16947 $run ./try 2>/dev/null
28f5ac64 16948 code="$?"
5440bc8e 16949 $from try.out
28f5ac64 16950 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
16951 output=-DTRY_FPRINTF
16952 fi
16953 fi
16954 ;;
16955 esac
16956fi
16957: check for fflush NULL behaviour
16958case "$fflushNULL" in
16959'') set try -DTRY_FFLUSH_NULL $output
16960 if eval $compile; then
5440bc8e 16961 $run ./try 2>/dev/null
b4eb6b3d 16962 code="$?"
5440bc8e 16963 $from try.out
b4eb6b3d
JH
16964 if $test -s try.out -a "X$code" = X42; then
16965 fflushNULL="`$cat try.out`"
16966 else
16967 if $test "X$code" != X42; then
16968 $cat >&4 <<EOM
16969(If this test failed, don't worry, we'll try another method shortly.)
16970EOM
16971 fi
16972 fi
16973 fi
16974 $rm -f core try.core core.try.*
16975 case "$fflushNULL" in
16976 x) $cat >&4 <<EOM
16977Your fflush(NULL) works okay for output streams.
16978Let's see if it clobbers input pipes...
16979EOM
16980# As of mid-March 2000 all versions of Solaris appear to have a stdio
16981# bug that improperly flushes the input end of pipes. So we avoid the
16982# autoflush on fork/system/exec support for now. :-(
16983$cat >tryp.c <<EOCP
16984#include <stdio.h>
16985int
16986main(int argc, char **argv)
16987{
16988 char buf[1024];
16989 int i;
16990 char *bp = buf;
16991 while (1) {
16992 while ((i = getc(stdin)) != -1
16993 && (*bp++ = i) != '\n'
16994 && bp < &buf[1024])
16995 /* DO NOTHING */ ;
16996 *bp = '\0';
16997 fprintf(stdout, "%s", buf);
16998 fflush(NULL);
16999 if (i == -1)
17000 return 0;
17001 bp = buf;
17002 }
17003}
17004EOCP
17005 fflushNULL="$define"
17006 set tryp
17007 if eval $compile; then
17008 $rm -f tryp.out
5440bc8e 17009 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17010 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17011 $cat >&4 <<EOM
17012fflush(NULL) seems to behave okay with input streams.
17013EOM
17014 fflushNULL="$define"
17015 else
17016 $cat >&4 <<EOM
17017Ouch, fflush(NULL) clobbers input pipes! We will not use it.
17018EOM
17019 fflushNULL="$undef"
17020 fi
17021 fi
17022 $rm -f core tryp.c tryp.core core.tryp.*
17023 ;;
17024 '') $cat >&4 <<EOM
17025Your fflush(NULL) isn't working (contrary to ANSI C).
17026EOM
17027 fflushNULL="$undef"
17028 ;;
17029 *) $cat >&4 <<EOM
17030Cannot figure out whether your fflush(NULL) works or not.
17031I'm assuming it doesn't (contrary to ANSI C).
17032EOM
17033 fflushNULL="$undef"
17034 ;;
17035 esac
17036 ;;
17037$define|true|[yY]*)
17038 fflushNULL="$define"
17039 ;;
17040*)
17041 fflushNULL="$undef"
17042 ;;
17043esac
17044: check explicit looping only if NULL did not work, and if the pipe
17045: bug does not show up on an explicit flush too
17046case "$fflushNULL" in
17047"$undef")
17048 $cat >tryp.c <<EOCP
17049#include <stdio.h>
17050int
17051main(int argc, char **argv)
17052{
17053 char buf[1024];
17054 int i;
17055 char *bp = buf;
17056 while (1) {
17057 while ((i = getc(stdin)) != -1
17058 && (*bp++ = i) != '\n'
17059 && bp < &buf[1024])
17060 /* DO NOTHING */ ;
17061 *bp = '\0';
17062 fprintf(stdout, "%s", buf);
17063 fflush(stdin);
17064 if (i == -1)
17065 return 0;
17066 bp = buf;
17067 }
17068}
17069EOCP
17070 set tryp
17071 if eval $compile; then
17072 $rm -f tryp.out
5440bc8e 17073 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17074 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17075 $cat >&4 <<EOM
17076Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17077EOM
17078 : now check for fflushall behaviour
17079 case "$fflushall" in
17080 '') set try -DTRY_FFLUSH_ALL $output
17081 if eval $compile; then
17082 $cat >&4 <<EOM
17083(Now testing the other method--but note that this also may fail.)
17084EOM
5440bc8e 17085 $run ./try 2>/dev/null
28f5ac64 17086 code=$?
fbe73d74 17087 $from try.out
28f5ac64 17088 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17089 fflushall="`$cat try.out`"
17090 fi
17091 fi
17092 $rm -f core try.core core.try.*
17093 case "$fflushall" in
17094 x) $cat >&4 <<EOM
17095Whew. Flushing explicitly all the stdio streams works.
17096EOM
17097 fflushall="$define"
17098 ;;
17099 '') $cat >&4 <<EOM
17100Sigh. Flushing explicitly all the stdio streams doesn't work.
17101EOM
17102 fflushall="$undef"
17103 ;;
17104 *) $cat >&4 <<EOM
17105Cannot figure out whether flushing stdio streams explicitly works or not.
17106I'm assuming it doesn't.
17107EOM
17108 fflushall="$undef"
17109 ;;
17110 esac
17111 ;;
17112 "$define"|true|[yY]*)
17113 fflushall="$define"
17114 ;;
17115 *)
17116 fflushall="$undef"
17117 ;;
17118 esac
17119 else
17120 $cat >&4 <<EOM
17121All is futile. Even fflush(stdin) clobbers input pipes!
17122EOM
17123 fflushall="$undef"
17124 fi
17125 else
17126 fflushall="$undef"
17127 fi
17128 $rm -f core tryp.c tryp.core core.tryp.*
17129 ;;
17130*) fflushall="$undef"
17131 ;;
17132esac
17133
17134case "$fflushNULL$fflushall" in
17135undefundef)
17136 $cat <<EOM
17137OK, I give up. I cannot figure out how to flush pending stdio output.
17138We won't be flushing handles at all before fork/exec/popen.
17139EOM
17140 ;;
17141esac
17142$rm -f try.* try$exe_ext
17143
17144: Store the full pathname to the ar program for use in the C program
17145: Respect a hint or command line value for full_ar.
17146case "$full_ar" in
17147'') full_ar=$ar ;;
17148esac
17149
17150: Store the full pathname to the sed program for use in the C program
17151full_sed=$sed
17152
17153: see what type gids are declared as in the kernel
17154echo " "
17155echo "Looking for the type for group ids returned by getgid()."
17156set gid_t gidtype xxx stdio.h sys/types.h
17157eval $typedef
17158case "$gidtype" in
17159xxx)
17160 xxx=`./findhdr sys/user.h`
17161 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17162 case $1 in
17163 unsigned) dflt="$1 $2" ;;
17164 *) dflt="$1" ;;
17165 esac
17166 ;;
17167*) dflt="$gidtype";;
17168esac
17169case "$gidtype" in
17170gid_t) echo "gid_t found." ;;
17171*) rp="What is the type for group ids returned by getgid()?"
17172 . ./myread
17173 gidtype="$ans"
17174 ;;
17175esac
17176
17177echo " "
17178case "$gidtype" in
17179*_t) zzz="$gidtype" ;;
17180*) zzz="gid" ;;
17181esac
17182echo "Checking the size of $zzz..." >&4
17183cat > try.c <<EOCP
17184#include <sys/types.h>
17185#include <stdio.h>
17186int main() {
17187 printf("%d\n", (int)sizeof($gidtype));
17188 exit(0);
17189}
17190EOCP
17191set try
17192if eval $compile_ok; then
5440bc8e 17193 yyy=`$run ./try`
b4eb6b3d
JH
17194 case "$yyy" in
17195 '') gidsize=4
17196 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17197 ;;
17198 *) gidsize=$yyy
17199 echo "Your $zzz is $gidsize bytes long."
17200 ;;
17201 esac
17202else
17203 gidsize=4
17204 echo "(I can't compile the test program--guessing $gidsize.)" >&4
17205fi
17206
17207
17208echo " "
17209case "$gidtype" in
17210*_t) zzz="$gidtype" ;;
17211*) zzz="gid" ;;
17212esac
17213echo "Checking the sign of $zzz..." >&4
17214cat > try.c <<EOCP
17215#include <sys/types.h>
17216#include <stdio.h>
17217int main() {
17218 $gidtype foo = -1;
17219 if (foo < 0)
17220 printf("-1\n");
17221 else
17222 printf("1\n");
17223}
17224EOCP
17225set try
17226if eval $compile; then
5440bc8e 17227 yyy=`$run ./try`
b4eb6b3d
JH
17228 case "$yyy" in
17229 '') gidsign=1
17230 echo "(I can't execute the test program--guessing unsigned.)" >&4
17231 ;;
17232 *) gidsign=$yyy
17233 case "$gidsign" in
17234 1) echo "Your $zzz is unsigned." ;;
17235 -1) echo "Your $zzz is signed." ;;
17236 esac
17237 ;;
17238 esac
17239else
17240 gidsign=1
17241 echo "(I can't compile the test program--guessing unsigned.)" >&4
17242fi
17243
17244
17245echo " "
17246
17247if $test X"$quadtype" != X; then
17248
17249echo "Checking how to print 64-bit integers..." >&4
17250
17251if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17252 $cat >try.c <<'EOCP'
17253#include <sys/types.h>
17254#include <stdio.h>
17255int main() {
17256 int q = 12345678901;
17257 printf("%ld\n", q);
17258}
17259EOCP
17260 set try
17261 if eval $compile; then
5440bc8e 17262 yyy=`$run ./try`
b4eb6b3d
JH
17263 case "$yyy" in
17264 12345678901)
17265 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17266 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17267 echo "We will use %d."
17268 ;;
17269 esac
17270 fi
17271fi
17272
17273if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17274 $cat >try.c <<'EOCP'
17275#include <sys/types.h>
17276#include <stdio.h>
17277int main() {
17278 long q = 12345678901;
17279 printf("%ld\n", q);
17280}
17281EOCP
17282 set try
17283 if eval $compile; then
5440bc8e 17284 yyy=`$run ./try`
b4eb6b3d
JH
17285 case "$yyy" in
17286 12345678901)
17287 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17288 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17289 echo "We will use %ld."
17290 ;;
17291 esac
17292 fi
17293fi
17294
17295if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17296 $cat >try.c <<'EOCP'
17297#include <sys/types.h>
17298#include <inttypes.h>
17299#include <stdio.h>
17300int main() {
17301 int64_t q = 12345678901;
17302 printf("%" PRId64 "\n", q);
17303}
17304EOCP
17305 set try
17306 if eval $compile; then
5440bc8e 17307 yyy=`$run ./try`
b4eb6b3d
JH
17308 case "$yyy" in
17309 12345678901)
17310 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17311 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17312 echo "We will use the C9X style."
17313 ;;
17314 esac
17315 fi
17316fi
17317
2ef53570
JH
17318if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17319 $cat >try.c <<EOCP
b4eb6b3d
JH
17320#include <sys/types.h>
17321#include <stdio.h>
17322int main() {
2ef53570
JH
17323 $quadtype q = 12345678901;
17324 printf("%Ld\n", q);
b4eb6b3d
JH
17325}
17326EOCP
17327 set try
17328 if eval $compile; then
5440bc8e 17329 yyy=`$run ./try`
b4eb6b3d
JH
17330 case "$yyy" in
17331 12345678901)
2ef53570
JH
17332 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17333 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17334 echo "We will use %Ld."
b4eb6b3d
JH
17335 ;;
17336 esac
17337 fi
17338fi
17339
2ef53570
JH
17340if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17341 $cat >try.c <<'EOCP'
b4eb6b3d
JH
17342#include <sys/types.h>
17343#include <stdio.h>
17344int main() {
2ef53570
JH
17345 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17346 printf("%lld\n", q);
b4eb6b3d
JH
17347}
17348EOCP
17349 set try
17350 if eval $compile; then
5440bc8e 17351 yyy=`$run ./try`
b4eb6b3d
JH
17352 case "$yyy" in
17353 12345678901)
2ef53570
JH
17354 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17355 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17356 echo "We will use the %lld style."
b4eb6b3d
JH
17357 ;;
17358 esac
17359 fi
17360fi
17361
17362if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17363 $cat >try.c <<EOCP
17364#include <sys/types.h>
17365#include <stdio.h>
17366int main() {
17367 $quadtype q = 12345678901;
17368 printf("%qd\n", q);
17369}
17370EOCP
17371 set try
17372 if eval $compile; then
5440bc8e 17373 yyy=`$run ./try`
b4eb6b3d
JH
17374 case "$yyy" in
17375 12345678901)
17376 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17377 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17378 echo "We will use %qd."
17379 ;;
17380 esac
17381 fi
17382fi
17383
17384if $test X"$sPRId64" = X; then
17385 echo "Cannot figure out how to print 64-bit integers." >&4
17386fi
17387
17388$rm -f try try.*
17389
17390fi
17391
17392case "$sPRId64" in
17393'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
17394 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
17395 ;;
17396*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
17397 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
17398 ;;
17399esac
17400
17401
17402echo " "
17403$echo "Checking the format strings to be used for Perl's internal types..." >&4
17404
17405if $test X"$ivsize" = X8; then
17406 ivdformat="$sPRId64"
17407 uvuformat="$sPRIu64"
17408 uvoformat="$sPRIo64"
17409 uvxformat="$sPRIx64"
17410 uvXUformat="$sPRIXU64"
17411else
17412 if $test X"$ivsize" = X"$longsize"; then
17413 ivdformat='"ld"'
17414 uvuformat='"lu"'
17415 uvoformat='"lo"'
17416 uvxformat='"lx"'
17417 uvXUformat='"lX"'
17418 else
17419 if $test X"$ivsize" = X"$intsize"; then
17420 ivdformat='"d"'
17421 uvuformat='"u"'
17422 uvoformat='"o"'
17423 uvxformat='"x"'
17424 uvXUformat='"X"'
17425 else
17426 : far out
17427 if $test X"$ivsize" = X"$shortsize"; then
17428 ivdformat='"hd"'
17429 uvuformat='"hu"'
17430 uvoformat='"ho"'
17431 uvxformat='"hx"'
17432 uvXUformat='"hX"'
17433 fi
17434 fi
17435 fi
17436fi
17437
17438if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17439 nveformat="$sPRIeldbl"
17440 nvfformat="$sPRIfldbl"
17441 nvgformat="$sPRIgldbl"
17442 nvEUformat="$sPRIEUldbl"
17443 nvFUformat="$sPRIFUldbl"
17444 nvGUformat="$sPRIGUldbl"
17445else
17446 nveformat='"e"'
17447 nvfformat='"f"'
17448 nvgformat='"g"'
17449 nvEUformat='"E"'
17450 nvFUformat='"F"'
17451 nvGUformat='"G"'
17452fi
17453
17454case "$ivdformat" in
3c728e00 17455'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
17456 exit 1
17457 ;;
17458esac
17459
17460
17461echo " "
17462$echo "Checking the format string to be used for gids..." >&4
17463
17464case "$gidsign" in
17465-1) if $test X"$gidsize" = X"$ivsize"; then
17466 gidformat="$ivdformat"
17467 else
17468 if $test X"$gidsize" = X"$longsize"; then
17469 gidformat='"ld"'
17470 else
17471 if $test X"$gidsize" = X"$intsize"; then
17472 gidformat='"d"'
17473 else
17474 if $test X"$gidsize" = X"$shortsize"; then
17475 gidformat='"hd"'
17476 fi
17477 fi
17478 fi
17479 fi
17480 ;;
17481*) if $test X"$gidsize" = X"$uvsize"; then
17482 gidformat="$uvuformat"
17483 else
17484 if $test X"$gidsize" = X"$longsize"; then
17485 gidformat='"lu"'
17486 else
17487 if $test X"$gidsize" = X"$intsize"; then
17488 gidformat='"u"'
17489 else
17490 if $test X"$gidsize" = X"$shortsize"; then
17491 gidformat='"hu"'
17492 fi
17493 fi
17494 fi
17495 fi
17496 ;;
17497esac
17498
17499: see if getgroups exists
17500set getgroups d_getgrps
17501eval $inlibc
17502
17503: see if setgroups exists
17504set setgroups d_setgrps
17505eval $inlibc
17506
17507
17508: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17509echo " "
17510case "$d_getgrps$d_setgrps" in
17511*define*)
17512 case "$groupstype" in
17513 '') dflt="$gidtype" ;;
17514 *) dflt="$groupstype" ;;
17515 esac
17516 $cat <<EOM
17517What type of pointer is the second argument to getgroups() and setgroups()?
17518Usually this is the same as group ids, $gidtype, but not always.
17519
17520EOM
17521 rp='What type pointer is the second argument to getgroups() and setgroups()?'
17522 . ./myread
17523 groupstype="$ans"
17524 ;;
17525*) groupstype="$gidtype";;
17526esac
17527
17528echo " "
17529echo "Checking if your $make program sets \$(MAKE)..." >&4
17530case "$make_set_make" in
17531'')
17532 $sed 's/^X //' > testmake.mak << 'EOF'
17533Xall:
17534X @echo 'maketemp="$(MAKE)"'
17535EOF
17536 case "`$make -f testmake.mak 2>/dev/null`" in
17537 *maketemp=*) make_set_make='#' ;;
17538 *) make_set_make="MAKE=$make" ;;
17539 esac
17540 $rm -f testmake.mak
17541 ;;
17542esac
17543case "$make_set_make" in
17544'#') echo "Yup, it does.";;
17545*) echo "Nope, it doesn't.";;
17546esac
17547
17548: see what type is used for mode_t
17549rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17550set mode_t modetype int stdio.h sys/types.h
17551eval $typedef_ask
17552
2cc61e15
DD
17553: see if stdarg is available
17554echo " "
17555if $test `./findhdr stdarg.h`; then
17556 echo "<stdarg.h> found." >&4
17557 valstd="$define"
17558else
17559 echo "<stdarg.h> NOT found." >&4
17560 valstd="$undef"
17561fi
17562
17563: see if varags is available
17564echo " "
17565if $test `./findhdr varargs.h`; then
17566 echo "<varargs.h> found." >&4
17567else
17568 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17569fi
17570
17571: set up the varargs testing programs
17572$cat > varargs.c <<EOP
17573#ifdef I_STDARG
17574#include <stdarg.h>
17575#endif
17576#ifdef I_VARARGS
17577#include <varargs.h>
17578#endif
17579
17580#ifdef I_STDARG
17581int f(char *p, ...)
17582#else
17583int f(va_alist)
17584va_dcl
17585#endif
17586{
17587 va_list ap;
17588#ifndef I_STDARG
17589 char *p;
17590#endif
17591#ifdef I_STDARG
17592 va_start(ap,p);
17593#else
17594 va_start(ap);
17595 p = va_arg(ap, char *);
17596#endif
17597 va_end(ap);
17598}
17599EOP
17600$cat > varargs <<EOP
17601$startsh
17602if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17603 echo "true"
17604else
17605 echo "false"
17606fi
17607$rm -f varargs$_o
17608EOP
17609chmod +x varargs
17610
17611: now check which varargs header should be included
17612echo " "
17613i_varhdr=''
17614case "$valstd" in
17615"$define")
17616 if `./varargs I_STDARG`; then
17617 val='stdarg.h'
17618 elif `./varargs I_VARARGS`; then
17619 val='varargs.h'
17620 fi
17621 ;;
17622*)
17623 if `./varargs I_VARARGS`; then
17624 val='varargs.h'
17625 fi
17626 ;;
17627esac
17628case "$val" in
17629'')
17630echo "I could not find the definition for va_dcl... You have problems..." >&4
17631 val="$undef"; set i_stdarg; eval $setvar
17632 val="$undef"; set i_varargs; eval $setvar
17633 ;;
17634*)
17635 set i_varhdr
17636 eval $setvar
17637 case "$i_varhdr" in
17638 stdarg.h)
17639 val="$define"; set i_stdarg; eval $setvar
17640 val="$undef"; set i_varargs; eval $setvar
17641 ;;
17642 varargs.h)
17643 val="$undef"; set i_stdarg; eval $setvar
17644 val="$define"; set i_varargs; eval $setvar
17645 ;;
17646 esac
17647 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17648esac
17649$rm -f varargs*
17650
17651: see if we need va_copy
17652echo " "
17653case "$i_stdarg" in
17654"$define")
17655 $cat >try.c <<EOCP
17656#include <stdarg.h>
17657#include <stdio.h>
85c8a686
DD
17658#$i_stdlib I_STDLIB
17659#ifdef I_STDLIB
17660#include <stdlib.h>
17661#endif
17662#include <signal.h>
2cc61e15
DD
17663
17664int
17665ivfprintf(FILE *f, const char *fmt, va_list *valp)
17666{
17667 return vfprintf(f, fmt, *valp);
17668}
17669
17670int
17671myvfprintf(FILE *f, const char *fmt, va_list val)
17672{
17673 return ivfprintf(f, fmt, &val);
17674}
17675
17676int
17677myprintf(char *fmt, ...)
17678{
17679 va_list val;
17680 va_start(val, fmt);
17681 return myvfprintf(stdout, fmt, val);
17682}
17683
17684int
17685main(int ac, char **av)
17686{
85c8a686
DD
17687 signal(SIGSEGV, exit);
17688
2cc61e15
DD
17689 myprintf("%s%cs all right, then\n", "that", '\'');
17690 exit(0);
17691}
17692EOCP
17693 set try
5440bc8e
JH
17694 if eval $compile && $run ./try 2>&1 >/dev/null; then
17695 case "`$run ./try`" in
2cc61e15
DD
17696 "that's all right, then")
17697 okay=yes
17698 ;;
17699 esac
17700 fi
17701 case "$okay" in
17702 yes) echo "It seems that you don't need va_copy()." >&4
17703 need_va_copy="$undef"
17704 ;;
17705 *) echo "It seems that va_copy() or similar will be needed." >&4
17706 need_va_copy="$define"
17707 ;;
17708 esac
17709 $rm -f try.* core core.* *.core *.core.*
17710 ;;
17711*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17712 ;;
17713esac
17714
b4eb6b3d
JH
17715: see what type is used for size_t
17716rp="What is the type used for the length parameter for string functions?"
17717set size_t sizetype 'unsigned int' stdio.h sys/types.h
17718eval $typedef_ask
17719
17720: check for type of arguments to gethostbyaddr.
17721if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17722 case "$d_gethbyaddr" in
17723 $define)
17724 $cat <<EOM
17725
17726Checking to see what type of arguments are accepted by gethostbyaddr().
17727EOM
17728 hdrs="$define sys/types.h
17729 $d_socket sys/socket.h
17730 $i_niin netinet/in.h
17731 $i_netdb netdb.h
17732 $i_unistd unistd.h"
17733 : The first arg can 'char *' or 'void *'
17734 : The second arg is some of integral type
17735 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17736 for yyy in size_t long int; do
17737 case "$netdb_host_type" in
17738 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17739 if ./protochk "$try" $hdrs; then
17740 echo "Your system accepts $xxx for the first arg."
17741 echo "...and $yyy for the second arg."
17742 netdb_host_type="$xxx"
17743 netdb_hlen_type="$yyy"
17744 fi
17745 ;;
17746 esac
17747 done
17748 done
17749 : In case none of those worked, prompt the user.
17750 case "$netdb_host_type" in
17751 '') rp='What is the type for the 1st argument to gethostbyaddr?'
17752 dflt='char *'
17753 . ./myread
17754 netdb_host_type=$ans
17755 rp='What is the type for the 2nd argument to gethostbyaddr?'
17756 dflt="$sizetype"
17757 . ./myread
17758 netdb_hlen_type=$ans
17759 ;;
17760 esac
17761 ;;
17762 *) : no gethostbyaddr, so pick harmless defaults
17763 netdb_host_type='char *'
17764 netdb_hlen_type="$sizetype"
17765 ;;
17766 esac
17767 # Remove the "const" if needed. -- but then we'll have a
17768 # prototype clash!
17769 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17770fi
17771
17772: check for type of argument to gethostbyname.
17773if test "X$netdb_name_type" = X ; then
17774 case "$d_gethbyname" in
17775 $define)
17776 $cat <<EOM
17777
17778Checking to see what type of argument is accepted by gethostbyname().
17779EOM
17780 hdrs="$define sys/types.h
17781 $d_socket sys/socket.h
17782 $i_niin netinet/in.h
17783 $i_netdb netdb.h
17784 $i_unistd unistd.h"
17785 for xxx in "const char *" "char *"; do
17786 case "$netdb_name_type" in
17787 '') try="extern struct hostent *gethostbyname($xxx);"
17788 if ./protochk "$try" $hdrs; then
17789 echo "Your system accepts $xxx."
17790 netdb_name_type="$xxx"
17791 fi
17792 ;;
17793 esac
17794 done
17795 : In case none of those worked, prompt the user.
17796 case "$netdb_name_type" in
17797 '') rp='What is the type for the 1st argument to gethostbyname?'
17798 dflt='char *'
17799 . ./myread
17800 netdb_name_type=$ans
17801 ;;
17802 esac
17803 ;;
17804 *) : no gethostbyname, so pick harmless default
17805 netdb_name_type='char *'
17806 ;;
17807 esac
17808fi
17809
17810: check for type of 1st argument to getnetbyaddr.
17811if test "X$netdb_net_type" = X ; then
17812 case "$d_getnbyaddr" in
17813 $define)
17814 $cat <<EOM
17815
17816Checking to see what type of 1st argument is accepted by getnetbyaddr().
17817EOM
17818 hdrs="$define sys/types.h
17819 $d_socket sys/socket.h
17820 $i_niin netinet/in.h
17821 $i_netdb netdb.h
17822 $i_unistd unistd.h"
17823 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17824 case "$netdb_net_type" in
17825 '') try="extern struct netent *getnetbyaddr($xxx, int);"
17826 if ./protochk "$try" $hdrs; then
17827 echo "Your system accepts $xxx."
17828 netdb_net_type="$xxx"
17829 fi
17830 ;;
17831 esac
17832 done
17833 : In case none of those worked, prompt the user.
17834 case "$netdb_net_type" in
17835 '') rp='What is the type for the 1st argument to getnetbyaddr?'
17836 dflt='long'
17837 . ./myread
17838 netdb_net_type=$ans
17839 ;;
17840 esac
17841 ;;
17842 *) : no getnetbyaddr, so pick harmless default
17843 netdb_net_type='long'
17844 ;;
17845 esac
17846fi
17847: locate the preferred pager for this system
17848case "$pager" in
17849'')
17850 dflt=''
17851 case "$pg" in
17852 /*) dflt=$pg;;
17853 [a-zA-Z]:/*) dflt=$pg;;
17854 esac
17855 case "$more" in
17856 /*) dflt=$more;;
17857 [a-zA-Z]:/*) dflt=$more;;
17858 esac
17859 case "$less" in
17860 /*) dflt=$less;;
17861 [a-zA-Z]:/*) dflt=$less;;
17862 esac
17863 case "$dflt" in
17864 '') dflt=/usr/ucb/more;;
17865 esac
17866 ;;
17867*) dflt="$pager";;
17868esac
17869echo " "
17870fn=f/
17871rp='What pager is used on your system?'
17872. ./getfile
17873pager="$ans"
17874
17875: see what type pids are declared as in the kernel
17876rp="What is the type of process ids on this system?"
17877set pid_t pidtype int stdio.h sys/types.h
17878eval $typedef_ask
17879
17880: Find earliest binary compatible site_perl subdirectory perl can use.
d953f698 17881xs_apiversion=$version # The current site_perl version.
b4eb6b3d
JH
17882: Find earliest pure perl site_perl subdirectory perl can use.
17883: The versioned directories started at 5.005.
17884pm_apiversion='5.005'
17885
b4eb6b3d
JH
17886: see if ar generates random libraries by itself
17887echo " "
17888echo "Checking how to generate random libraries on your machine..." >&4
17889echo 'int bar1() { return bar2(); }' > bar1.c
17890echo 'int bar2() { return 2; }' > bar2.c
17891$cat > foo.c <<'EOP'
17892int main() { printf("%d\n", bar1()); exit(0); }
17893EOP
17894$cc $ccflags -c bar1.c >/dev/null 2>&1
17895$cc $ccflags -c bar2.c >/dev/null 2>&1
17896$cc $ccflags -c foo.c >/dev/null 2>&1
17897$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 17898if $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 "$ar appears to generate random libraries itself."
17901 orderlib=false
17902 ranlib=":"
17903elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 17904 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 17905 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
17906 echo "a table of contents needs to be added with '$ar ts'."
17907 orderlib=false
17908 ranlib="$ar ts"
17909else
17910 case "$ranlib" in
17911 :) ranlib='';;
17912 '')
17913 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17914 $test -f $ranlib || ranlib=''
17915 ;;
17916 esac
17917 if $test -n "$ranlib"; then
17918 echo "your system has '$ranlib'; we'll use that."
17919 orderlib=false
17920 else
17921 echo "your system doesn't seem to support random libraries"
17922 echo "so we'll use lorder and tsort to order the libraries."
17923 orderlib=true
17924 ranlib=":"
17925 fi
17926fi
17927$rm -f foo* bar*
17928
17929: check for type of arguments to select.
17930case "$selecttype" in
17931'') case "$d_select" in
17932 $define)
17933 echo " "
17934 $cat <<EOM
17935Checking to see what type of arguments are accepted by select().
17936EOM
17937 hdrs="$define sys/types.h
17938 $i_systime sys/time.h
17939 $i_sysselct sys/select.h
17940 $d_socket sys/socket.h"
17941 : The first arg can be int, unsigned, or size_t
17942 : The last arg may or may not be 'const'
17943 val=''
17944 : void pointer has been seen but using that
17945 : breaks the selectminbits test
17946 for xxx in 'fd_set *' 'int *'; do
17947 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17948 for tmo in 'struct timeval *' 'const struct timeval *'; do
17949 case "$val" in
17950 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17951 if ./protochk "$try" $hdrs; then
17952 echo "Your system accepts $xxx."
17953 val="$xxx"
17954 fi
17955 ;;
17956 esac
17957 done
17958 done
17959 done
17960 case "$val" in
17961 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17962 case "$d_fd_set" in
17963 $define) dflt="fd_set *" ;;
17964 *) dflt="int *" ;;
17965 esac
17966 . ./myread
17967 val=$ans
17968 ;;
17969 esac
17970 selecttype="$val"
17971 ;;
17972 *) : no select, so pick a harmless default
17973 selecttype='int *'
17974 ;;
17975 esac
17976 ;;
17977esac
17978
17979: check for the select 'width'
17980case "$selectminbits" in
17981'') case "$d_select" in
17982 $define)
17983 $cat <<EOM
17984
17985Checking to see on how many bits at a time your select() operates...
17986EOM
17987 $cat >try.c <<EOCP
17988#include <sys/types.h>
17989#$i_time I_TIME
17990#$i_systime I_SYS_TIME
17991#$i_systimek I_SYS_TIME_KERNEL
17992#ifdef I_TIME
17993# include <time.h>
17994#endif
17995#ifdef I_SYS_TIME
17996# ifdef I_SYS_TIME_KERNEL
17997# define KERNEL
17998# endif
17999# include <sys/time.h>
18000# ifdef I_SYS_TIME_KERNEL
18001# undef KERNEL
18002# endif
18003#endif
18004#$i_sysselct I_SYS_SELECT
18005#ifdef I_SYS_SELECT
18006#include <sys/select.h>
18007#endif
18008#$d_socket HAS_SOCKET
18009#ifdef HAS_SOCKET
18010# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18011#endif
18012#include <stdio.h>
18013$selecttype b;
18014#define S sizeof(*(b))
18015#define MINBITS 64
18016#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18017#define NBITS (NBYTES * 8)
18018int main() {
18019 char s[NBYTES];
18020 struct timeval t;
18021 int i;
18022 FILE* fp;
18023 int fd;
18024
18025 fclose(stdin);
18026 fp = fopen("try.c", "r");
18027 if (fp == 0)
18028 exit(1);
18029 fd = fileno(fp);
18030 if (fd < 0)
18031 exit(2);
18032 b = ($selecttype)s;
18033 for (i = 0; i < NBITS; i++)
18034 FD_SET(i, b);
18035 t.tv_sec = 0;
18036 t.tv_usec = 0;
18037 select(fd + 1, b, 0, 0, &t);
18038 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18039 printf("%d\n", i + 1);
18040 return 0;
18041}
18042EOCP
18043 set try
18044 if eval $compile_ok; then
5440bc8e 18045 selectminbits=`$run ./try`
b4eb6b3d
JH
18046 case "$selectminbits" in
18047 '') cat >&4 <<EOM
18048Cannot figure out on how many bits at a time your select() operates.
18049I'll play safe and guess it is 32 bits.
18050EOM
18051 selectminbits=32
18052 bits="32 bits"
18053 ;;
18054 1) bits="1 bit" ;;
18055 *) bits="$selectminbits bits" ;;
18056 esac
18057 echo "Your select() operates on $bits at a time." >&4
18058 else
18059 rp='What is the minimum number of bits your select() operates on?'
18060 case "$byteorder" in
18061 1234|12345678) dflt=32 ;;
18062 *) dflt=1 ;;
18063 esac
18064 . ./myread
18065 val=$ans
18066 selectminbits="$val"
18067 fi
18068 $rm -f try.* try
18069 ;;
18070 *) : no select, so pick a harmless default
18071 selectminbits='32'
18072 ;;
18073 esac
18074 ;;
18075esac
18076
18077: Trace out the files included by signal.h, then look for SIGxxx names.
18078: Remove SIGARRAYSIZE used by HPUX.
18079: Remove SIGSTKSIZE used by Linux.
18080: Remove SIGSTKSZ used by Posix.
18081: Remove SIGTYP void lines used by OS2.
18082: Some cpps, like os390, dont give the file name anywhere
18083if [ "X$fieldn" = X ]; then
18084 : Just make some guesses. We check them later.
18085 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18086else
18087 xxx=`echo '#include <signal.h>' |
18088 $cppstdin $cppminus $cppflags 2>/dev/null |
18089 $grep '^[ ]*#.*include' |
a938a3bb 18090 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
18091fi
18092: Check this list of files to be sure we have parsed the cpp output ok.
18093: This will also avoid potentially non-existent files, such
18094: as ../foo/bar.h
18095xxxfiles=''
18096for xx in $xxx /dev/null ; do
18097 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18098done
18099: If we have found no files, at least try signal.h
18100case "$xxxfiles" in
18101'') xxxfiles=`./findhdr signal.h` ;;
18102esac
18103xxx=`awk '
18104$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18105 print substr($2, 4, 20)
18106}
18107$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18108 print substr($3, 4, 20)
18109}' $xxxfiles`
18110: Append some common names just in case the awk scan failed.
18111xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18112xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18113xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18114xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18115xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18116
18117: generate a few handy files for later
18118$cat > signal.c <<'EOCP'
18119#include <sys/types.h>
18120#include <signal.h>
18121#include <stdio.h>
18122int main() {
18123
18124/* Strange style to avoid deeply-nested #if/#else/#endif */
18125#ifndef NSIG
18126# ifdef _NSIG
18127# define NSIG (_NSIG)
18128# endif
18129#endif
18130
18131#ifndef NSIG
18132# ifdef SIGMAX
18133# define NSIG (SIGMAX+1)
18134# endif
18135#endif
18136
18137#ifndef NSIG
18138# ifdef SIG_MAX
18139# define NSIG (SIG_MAX+1)
18140# endif
18141#endif
18142
18143#ifndef NSIG
18144# ifdef MAXSIG
18145# define NSIG (MAXSIG+1)
18146# endif
18147#endif
18148
18149#ifndef NSIG
18150# ifdef MAX_SIG
18151# define NSIG (MAX_SIG+1)
18152# endif
18153#endif
18154
18155#ifndef NSIG
18156# ifdef SIGARRAYSIZE
18157# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18158# endif
18159#endif
18160
18161#ifndef NSIG
18162# ifdef _sys_nsig
18163# define NSIG (_sys_nsig) /* Solaris 2.5 */
18164# endif
18165#endif
18166
18167/* Default to some arbitrary number that's big enough to get most
18168 of the common signals.
18169*/
18170#ifndef NSIG
18171# define NSIG 50
18172#endif
18173
18174printf("NSIG %d\n", NSIG);
18175
18176#ifndef JUST_NSIG
18177
18178EOCP
18179
18180echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18181{
18182 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 18183 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
18184 printf $1; printf ");\n"
18185 printf "#endif\n"
18186}
18187END {
18188 printf "#endif /* JUST_NSIG */\n";
18189 printf "exit(0);\n}\n";
18190}
18191' >>signal.c
18192$cat >signal.awk <<'EOP'
18193BEGIN { ndups = 0 }
65197d93
JH
18194$1 ~ /^NSIG$/ { nsig = $2 }
18195($1 !~ /^NSIG$/) && (NF == 2) {
18196 if ($2 > maxsig) { maxsig = $2 }
18197 if (sig_name[$2]) {
18198 dup_name[ndups] = $1
18199 dup_num[ndups] = $2
b4eb6b3d
JH
18200 ndups++
18201 }
18202 else {
65197d93
JH
18203 sig_name[$2] = $1
18204 sig_num[$2] = $2
b4eb6b3d
JH
18205 }
18206}
18207END {
18208 if (nsig == 0) {
18209 nsig = maxsig + 1
18210 }
18211 printf("NSIG %d\n", nsig);
18212 for (n = 1; n < nsig; n++) {
18213 if (sig_name[n]) {
18214 printf("%s %d\n", sig_name[n], sig_num[n])
18215 }
18216 else {
18217 printf("NUM%d %d\n", n, n)
18218 }
18219 }
18220 for (n = 0; n < ndups; n++) {
18221 printf("%s %d\n", dup_name[n], dup_num[n])
18222 }
18223}
18224EOP
18225$cat >signal_cmd <<EOS
18226$startsh
18227if $test -s signal.lst; then
18228 echo "Using your existing signal.lst file"
18229 exit 0
18230fi
18231xxx="$xxx"
18232EOS
18233$cat >>signal_cmd <<'EOS'
18234
18235set signal
18236if eval $compile_ok; then
1eb9ad5b 18237 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18238else
18239 echo "(I can't seem be able to compile the whole test program)" >&4
18240 echo "(I'll try it in little pieces.)" >&4
18241 set signal -DJUST_NSIG
18242 if eval $compile_ok; then
5440bc8e 18243 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
18244 $cat signal.nsg
18245 else
18246 echo "I can't seem to figure out how many signals you have." >&4
18247 echo "Guessing 50." >&4
18248 echo 'NSIG 50' > signal.nsg
18249 fi
18250 : Now look at all the signal names, one at a time.
18251 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18252 $cat > signal.c <<EOCP
18253#include <sys/types.h>
18254#include <signal.h>
18255#include <stdio.h>
18256int main() {
18257printf("$xx %d\n", SIG${xx});
18258return 0;
18259}
18260EOCP
18261 set signal
18262 if eval $compile; then
18263 echo "SIG${xx} found."
5440bc8e 18264 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
18265 else
18266 echo "SIG${xx} NOT found."
18267 fi
18268 done
18269 if $test -s signal.ls1; then
18270 $cat signal.nsg signal.ls1 |
65197d93 18271 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
18272 fi
18273
18274fi
18275if $test -s signal.lst; then
18276 :
18277else
18278 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18279 echo 'kill -l' >signal
18280 set X `csh -f <signal`
18281 $rm -f signal
18282 shift
18283 case $# in
18284 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18285 esac
18286 echo $@ | $tr ' ' $trnl | \
18287 $awk '{ printf "%s %d\n", $1, ++s; }
18288 END { printf "NSIG %d\n", ++s }' >signal.lst
18289fi
18290$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18291EOS
18292chmod a+x signal_cmd
18293$eunicefix signal_cmd
18294
18295: generate list of signal names
18296echo " "
18297case "$sig_name_init" in
18298'') doinit=yes ;;
18299*) case "$sig_num_init" in
18300 ''|*,*) doinit=yes ;;
18301 esac ;;
18302esac
18303case "$doinit" in
18304yes)
18305 echo "Generating a list of signal names and numbers..." >&4
18306 . ./signal_cmd
18307 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18308 sig_name=`$awk 'BEGIN { printf "ZERO " }
18309 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18310 sig_num=`$awk 'BEGIN { printf "0 " }
18311 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18312 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
18313 !/^NSIG/ { printf "\"%s\", ", $1 }
18314 END { printf "0\n" }' signal.lst`
18315 sig_num_init=`$awk 'BEGIN { printf "0, " }
18316 !/^NSIG/ { printf "%d, ", $2}
18317 END { printf "0\n"}' signal.lst`
18318 ;;
18319esac
18320echo "The following $sig_count signals are available:"
18321echo " "
18322echo $sig_name | $awk \
18323'BEGIN { linelen = 0 }
18324{
18325 for (i = 1; i <= NF; i++) {
18326 name = "SIG" $i " "
18327 linelen = linelen + length(name)
18328 if (linelen > 70) {
18329 printf "\n"
18330 linelen = length(name)
18331 }
18332 printf "%s", name
18333 }
18334 printf "\n"
18335}'
76d3c696 18336sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
18337$rm -f signal signal.c signal.awk signal.lst signal_cmd
18338
18339echo " "
18340case "$sizetype" in
18341*_t) zzz="$sizetype" ;;
18342*) zzz="filesize" ;;
18343esac
18344echo "Checking the size of $zzz..." >&4
18345cat > try.c <<EOCP
18346#include <sys/types.h>
18347#include <stdio.h>
18348int main() {
18349 printf("%d\n", (int)sizeof($sizetype));
18350 exit(0);
18351}
18352EOCP
18353set try
18354if eval $compile_ok; then
5440bc8e 18355 yyy=`$run ./try`
b4eb6b3d
JH
18356 case "$yyy" in
18357 '') sizesize=4
18358 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18359 ;;
18360 *) sizesize=$yyy
18361 echo "Your $zzz size is $sizesize bytes."
18362 ;;
18363 esac
18364else
18365 sizesize=4
18366 echo "(I can't compile the test program--guessing $sizesize.)" >&4
18367fi
18368
18369
18370: check for socklen_t
18371echo " "
18372echo "Checking to see if you have socklen_t..." >&4
18373$cat >try.c <<EOCP
18374#include <sys/types.h>
18375#$d_socket HAS_SOCKET
18376#ifdef HAS_SOCKET
18377#include <sys/socket.h>
18378#endif
18379int main() { socklen_t x = 16; }
18380EOCP
18381set try
18382if eval $compile; then
18383 val="$define"
18384 echo "You have socklen_t."
18385else
18386 val="$undef"
18387 echo "You do not have socklen_t."
18388 case "$sizetype" in
18389 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18390 esac
18391fi
18392$rm -f try try.*
18393set d_socklen_t
18394eval $setvar
18395
a7710f8d
JH
18396: see if this is a socks.h system
18397set socks.h i_socks
18398eval $inhdr
18399
b4eb6b3d
JH
18400: check for type of the size argument to socket calls
18401case "$d_socket" in
18402"$define")
18403 $cat <<EOM
18404
18405Checking to see what type is the last argument of accept().
18406EOM
b4eb6b3d
JH
18407 yyy=''
18408 case "$d_socklen_t" in
18409 "$define") yyy="$yyy socklen_t"
18410 esac
18411 yyy="$yyy $sizetype int long unsigned"
18412 for xxx in $yyy; do
18413 case "$socksizetype" in
18414 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
18415 case "$usesocks" in
18416 "$define")
18417 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18418 echo "Your system accepts '$xxx *' for the last argument of accept()."
18419 socksizetype="$xxx"
18420 fi
18421 ;;
18422 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
18423 echo "Your system accepts '$xxx *' for the last argument of accept()."
18424 socksizetype="$xxx"
18425 fi
18426 ;;
18427 esac
b4eb6b3d
JH
18428 ;;
18429 esac
18430 done
18431: In case none of those worked, prompt the user.
18432 case "$socksizetype" in
18433 '') rp='What is the type for socket address structure sizes?'
18434 dflt='int'
18435 . ./myread
18436 socksizetype=$ans
18437 ;;
18438 esac
18439 ;;
18440*) : no sockets, so pick relatively harmless default
18441 socksizetype='int'
18442 ;;
18443esac
18444
18445: see what type is used for signed size_t
18446set ssize_t ssizetype int stdio.h sys/types.h
18447eval $typedef
18448dflt="$ssizetype"
5440bc8e 18449$cat > try.c <<EOM
b4eb6b3d
JH
18450#include <stdio.h>
18451#include <sys/types.h>
18452#define Size_t $sizetype
18453#define SSize_t $dflt
18454int main()
18455{
18456 if (sizeof(Size_t) == sizeof(SSize_t))
18457 printf("$dflt\n");
18458 else if (sizeof(Size_t) == sizeof(int))
18459 printf("int\n");
18460 else
18461 printf("long\n");
18462 exit(0);
18463}
18464EOM
18465echo " "
5440bc8e
JH
18466set try
18467if eval $compile_ok && $run ./try > /dev/null; then
18468 ssizetype=`$run ./try`
b4eb6b3d
JH
18469 echo "I'll be using $ssizetype for functions returning a byte count." >&4
18470else
18471 $cat >&4 <<EOM
18472Help! I can't compile and run the ssize_t test program: please enlighten me!
18473(This is probably a misconfiguration in your system or libraries, and
18474you really ought to fix it. Still, I'll try anyway.)
18475
18476I need a type that is the same size as $sizetype, but is guaranteed to
18477be signed. Common values are ssize_t, int and long.
18478
18479EOM
18480 rp="What signed type is the same size as $sizetype?"
18481 . ./myread
18482 ssizetype="$ans"
18483fi
5440bc8e 18484$rm -f try try.*
b4eb6b3d
JH
18485
18486: see what type of char stdio uses.
18487echo " "
aa517f50
JH
18488echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18489if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
18490 echo "Your stdio uses unsigned chars." >&4
18491 stdchar="unsigned char"
18492else
aa517f50
JH
18493 echo "Your stdio uses signed chars." >&4
18494 stdchar="char"
b4eb6b3d 18495fi
aa517f50
JH
18496$rm -f stdioh
18497
18498
b4eb6b3d 18499
b4eb6b3d
JH
18500: see what type uids are declared as in the kernel
18501echo " "
18502echo "Looking for the type for user ids returned by getuid()."
18503set uid_t uidtype xxx stdio.h sys/types.h
18504eval $typedef
18505case "$uidtype" in
18506xxx)
18507 xxx=`./findhdr sys/user.h`
18508 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18509 case $1 in
18510 unsigned) dflt="$1 $2" ;;
18511 *) dflt="$1" ;;
18512 esac
18513 ;;
18514*) dflt="$uidtype";;
18515esac
18516case "$uidtype" in
18517uid_t) echo "uid_t found." ;;
18518*) rp="What is the type for user ids returned by getuid()?"
18519 . ./myread
18520 uidtype="$ans"
18521 ;;
18522esac
18523
18524echo " "
18525case "$uidtype" in
18526*_t) zzz="$uidtype" ;;
18527*) zzz="uid" ;;
18528esac
18529echo "Checking the size of $zzz..." >&4
18530cat > try.c <<EOCP
18531#include <sys/types.h>
18532#include <stdio.h>
18533int main() {
18534 printf("%d\n", (int)sizeof($uidtype));
18535 exit(0);
18536}
18537EOCP
18538set try
18539if eval $compile_ok; then
5440bc8e 18540 yyy=`$run ./try`
b4eb6b3d
JH
18541 case "$yyy" in
18542 '') uidsize=4
18543 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18544 ;;
18545 *) uidsize=$yyy
18546 echo "Your $zzz is $uidsize bytes long."
18547 ;;
18548 esac
18549else
18550 uidsize=4
18551 echo "(I can't compile the test program--guessing $uidsize.)" >&4
18552fi
18553
18554echo " "
18555case "$uidtype" in
18556*_t) zzz="$uidtype" ;;
18557*) zzz="uid" ;;
18558esac
18559echo "Checking the sign of $zzz..." >&4
18560cat > try.c <<EOCP
18561#include <sys/types.h>
18562#include <stdio.h>
18563int main() {
18564 $uidtype foo = -1;
18565 if (foo < 0)
18566 printf("-1\n");
18567 else
18568 printf("1\n");
18569}
18570EOCP
18571set try
18572if eval $compile; then
5440bc8e 18573 yyy=`$run ./try`
b4eb6b3d
JH
18574 case "$yyy" in
18575 '') uidsign=1
18576 echo "(I can't execute the test program--guessing unsigned.)" >&4
18577 ;;
18578 *) uidsign=$yyy
18579 case "$uidsign" in
18580 1) echo "Your $zzz is unsigned." ;;
18581 -1) echo "Your $zzz is signed." ;;
18582 esac
18583 ;;
18584 esac
18585else
18586 uidsign=1
18587 echo "(I can't compile the test program--guessing unsigned.)" >&4
18588fi
18589
18590
18591
18592echo " "
18593$echo "Checking the format string to be used for uids..." >&4
18594
18595case "$uidsign" in
18596-1) if $test X"$uidsize" = X"$ivsize"; then
18597 uidformat="$ivdformat"
18598 else
18599 if $test X"$uidsize" = X"$longsize"; then
18600 uidformat='"ld"'
18601 else
18602 if $test X"$uidsize" = X"$intsize"; then
18603 uidformat='"d"'
18604 else
18605 if $test X"$uidsize" = X"$shortsize"; then
18606 uidformat='"hd"'
18607 fi
18608 fi
18609 fi
18610 fi
18611 ;;
18612*) if $test X"$uidsize" = X"$uvsize"; then
18613 uidformat="$uvuformat"
18614 else
18615 if $test X"$uidsize" = X"$longsize"; then
18616 uidformat='"lu"'
18617 else
18618 if $test X"$uidsize" = X"$intsize"; then
18619 uidformat='"u"'
18620 else
18621 if $test X"$uidsize" = X"$shortsize"; then
18622 uidformat='"hu"'
18623 fi
18624 fi
18625 fi
18626 fi
18627 ;;
18628esac
18629
3659ebf1
JH
18630: determine compiler compiler
18631case "$yacc" in
18632'')
18633 dflt=yacc;;
18634*)
18635 dflt="$yacc";;
18636esac
18637echo " "
18638comp='yacc'
3c728e00 18639if $test -f "$byacc$_exe"; then
3659ebf1
JH
18640 dflt="$byacc"
18641 comp="byacc or $comp"
18642fi
3c728e00 18643if $test -f "$bison$_exe"; then
3659ebf1
JH
18644 comp="$comp or bison -y"
18645fi
18646rp="Which compiler compiler ($comp) shall I use?"
18647. ./myread
18648yacc="$ans"
18649case "$yacc" in
18650*bis*)
18651 case "$yacc" in
18652 *-y*) ;;
18653 *)
18654 yacc="$yacc -y"
18655 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18656 ;;
18657 esac
18658 ;;
18659esac
18660
758a5d79
JH
18661: see if this is a fp.h system
18662set fp.h i_fp
18663eval $inhdr
18664
18665: see if this is a fp_class.h system
18666set fp_class.h i_fp_class
18667eval $inhdr
18668
b4eb6b3d 18669: see if this is a ieeefp.h system
b5b9f165
JH
18670case "$i_ieeefp" in
18671'' ) set ieeefp.h i_ieeefp
18672 eval $inhdr
18673 ;;
18674esac
b4eb6b3d
JH
18675
18676: see if this is a libutil.h system
18677set libutil.h i_libutil
18678eval $inhdr
18679
b4eb6b3d
JH
18680: see if mach cthreads are available
18681if test "X$usethreads" = "X$define"; then
18682 set mach/cthreads.h i_machcthr
18683 eval $inhdr
18684else
18685 i_machcthr="$undef"
18686fi
18687
18688
18689
18690: see if this is a math.h system
18691set math.h i_math
18692eval $inhdr
18693
18694: see if this is a mntent.h system
18695set mntent.h i_mntent
18696eval $inhdr
18697
18698: see if ndbm.h is available
18699set ndbm.h t_ndbm
18700eval $inhdr
1c6861ad
JS
18701
18702case "$t_ndbm" in
18703$undef)
18704 # Some Linux distributions such as RedHat 7.1 put the
18705 # ndbm.h header in /usr/include/gdbm/ndbm.h.
18706 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 18707 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
18708 ccflags="$ccflags -I/usr/include/gdbm"
18709 cppflags="$cppflags -I/usr/include/gdbm"
18710 t_ndbm=$define
18711 fi
18712 ;;
18713esac
18714
b4eb6b3d
JH
18715case "$t_ndbm" in
18716$define)
18717 : see if dbm_open exists
18718 set dbm_open d_dbm_open
18719 eval $inlibc
18720 case "$d_dbm_open" in
18721 $undef)
18722 t_ndbm="$undef"
18723 echo "We won't be including <ndbm.h>"
18724 ;;
18725 esac
18726 ;;
18727esac
18728val="$t_ndbm"
18729set i_ndbm
18730eval $setvar
18731
18732: see if net/errno.h is available
18733val=''
18734set net/errno.h val
18735eval $inhdr
18736
18737: Unfortunately, it causes problems on some systems. Arrgh.
18738case "$val" in
18739$define)
18740 cat > try.c <<'EOM'
18741#include <stdio.h>
18742#include <errno.h>
18743#include <net/errno.h>
18744int func()
18745{
18746 return ENOTSOCK;
18747}
18748EOM
18749 if $cc $ccflags -c try.c >/dev/null 2>&1; then
18750 echo "We'll be including <net/errno.h>." >&4
18751 else
18752 echo "We won't be including <net/errno.h>." >&4
18753 val="$undef"
18754 fi
18755 $rm -f try.* try
18756 ;;
18757esac
18758set i_neterrno
18759eval $setvar
18760
18761: see if netinet/tcp.h is available
18762set netinet/tcp.h i_netinettcp
18763eval $inhdr
18764
18765: see if this is a poll.h system
18766set poll.h i_poll
18767eval $inhdr
18768
18769: see if this is a prot.h system
18770set prot.h i_prot
18771eval $inhdr
18772
18773echo " "
18774$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
18775$cat <<'EOSH' > Cppsym.know
18776a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18777AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
18778alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18779ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18780BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
18781BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18782bull c cadmus clipper CMU COFF COMPILER_VERSION
18783concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18784CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
18785Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18786FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18787GLIBC GLIBC_MINOR
18788GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
18789H3050R H3050RX hbullx20 hcx host_mips
18790hp200 hp300 hp700 HP700 hp800 hp9000
18791hp9000s200 hp9000s300 hp9000s400 hp9000s500
18792hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18793i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 18794IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
18795INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18796LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18797LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18798Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18799LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18800M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18801M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18802M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18803MATH_HAS_NO_SIDE_EFFECTS
18804mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18805mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18806mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18807MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18808mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18809NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 18810news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
18811ns32016 ns32332 ns32k nsc32000
18812OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18813pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18814pc532 pdp11 PGC PIC plexus PORTAR posix
18815POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18816POSIX_C_SOURCE POSIX_SOURCE POWER
18817PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 18818riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
18819SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18820sony sony_news sonyrisc sparc sparclite spectrum
18821stardent stdc STDC_EXT stratos sun sun3 sun386
18822Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18823SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18824SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18825sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 18826TM3200 TM5400 TM5600
b4eb6b3d
JH
18827tower tower32 tower32_200 tower32_600 tower32_700
18828tower32_800 tower32_850 tss
18829u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18830ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
18831unix UNIX95 UNIX99 unixpc unos
18832USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18833USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18834USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18835USGr4 USGr4_2
b4eb6b3d
JH
18836Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18837XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18838XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18839z8000
18840EOSH
18841# Maybe put other stuff here too.
18842cat <<EOSH >>Cppsym.know
18843$osname
18844EOSH
18845./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18846./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18847$cat Cppsym.know > Cppsym.c
381aa1ff 18848$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
18849$rm -f Cppsym.a Cppsym.b Cppsym.c
18850cat <<EOSH > Cppsym
18851$startsh
18852if $test \$# -gt 0; then
18853 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18854 if $test -s Cppsym.got; then
18855 $rm -f Cppsym.got
18856 exit 0
18857 fi
18858 $rm -f Cppsym.got
18859 exit 1
18860else
18861 $tr " " "$trnl" | ./Cppsym.try
18862 exit 0
18863fi
18864EOSH
18865chmod +x Cppsym
18866$eunicefix Cppsym
18867cat <<EOSH > Cppsym.try
18868$startsh
18869cat <<'EOCP' > try.c
18870#include <stdio.h>
18871int main() {
18872EOCP
18873$awk \\
18874EOSH
18875cat <<'EOSH' >> Cppsym.try
18876'length($1) > 0 {
2ef53570
JH
18877 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
18878 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
18879 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
18880 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 18881}' >> try.c
2ef53570 18882echo 'return 0;}' >> try.c
b4eb6b3d
JH
18883EOSH
18884cat <<EOSH >> Cppsym.try
18885ccflags="$ccflags"
18886case "$osname-$gccversion" in
18887irix-) ccflags="\$ccflags -woff 1178" ;;
18888os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18889esac
5440bc8e 18890$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
18891EOSH
18892chmod +x Cppsym.try
18893$eunicefix Cppsym.try
18894./Cppsym < Cppsym.know > Cppsym.true
18895: now check the C compiler for additional symbols
18896postprocess_cc_v=''
18897case "$osname" in
18898aix) postprocess_cc_v="|$tr , ' '" ;;
18899esac
18900$cat >ccsym <<EOS
18901$startsh
18902$cat >tmp.c <<EOF
18903extern int foo;
18904EOF
18905for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18906do
18907 case "\$i" in
18908 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 18909 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
18910 esac
18911done
18912$rm -f try.c
18913EOS
18914postprocess_cc_v=''
18915chmod +x ccsym
18916$eunicefix ccsym
18917./ccsym > ccsym1.raw
18918if $test -s ccsym1.raw; then
18919 $sort ccsym1.raw | $uniq >ccsym.raw
18920else
18921 mv ccsym1.raw ccsym.raw
18922fi
18923
18924$awk '/\=/ { print $0; next }
18925 { print $0"=1" }' ccsym.raw >ccsym.list
18926$awk '/\=/ { print $0; next }
18927 { print $0"=1" }' Cppsym.true >ccsym.true
18928$comm -13 ccsym.true ccsym.list >ccsym.own
18929$comm -12 ccsym.true ccsym.list >ccsym.com
18930$comm -23 ccsym.true ccsym.list >ccsym.cpp
18931also=''
18932if $test -z ccsym.raw; then
18933 echo "Your C compiler doesn't seem to define any symbols!" >&4
18934 echo " "
18935 echo "However, your C preprocessor defines the following symbols:"
18936 $cat Cppsym.true
18937 ccsymbols=''
18938 cppsymbols=`$cat Cppsym.true`
18939 cppsymbols=`echo $cppsymbols`
18940 cppccsymbols="$cppsymbols"
18941else
18942 if $test -s ccsym.com; then
18943 echo "Your C compiler and pre-processor define these symbols:"
18944 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18945 also='also '
18946 symbols='ones'
18947 cppccsymbols=`$cat ccsym.com`
18948 cppccsymbols=`echo $cppccsymbols`
18949 $test "$silent" || sleep 1
18950 fi
18951 if $test -s ccsym.cpp; then
18952 $test "$also" && echo " "
18953 echo "Your C pre-processor ${also}defines the following symbols:"
18954 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18955 also='further '
18956 cppsymbols=`$cat ccsym.cpp`
18957 cppsymbols=`echo $cppsymbols`
18958 $test "$silent" || sleep 1
18959 fi
18960 if $test -s ccsym.own; then
18961 $test "$also" && echo " "
18962 echo "Your C compiler ${also}defines the following cpp symbols:"
18963 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18964 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18965 ccsymbols=`$cat ccsym.own`
18966 ccsymbols=`echo $ccsymbols`
18967 $test "$silent" || sleep 1
18968 fi
18969fi
b4eb6b3d
JH
18970
18971: see if this is a termio system
18972val="$undef"
18973val2="$undef"
18974val3="$undef"
18975if $test `./findhdr termios.h`; then
18976 set tcsetattr i_termios
18977 eval $inlibc
18978 val3="$i_termios"
18979fi
18980echo " "
18981case "$val3" in
18982"$define") echo "You have POSIX termios.h... good!" >&4;;
18983*) if ./Cppsym pyr; then
18984 case "`/bin/universe`" in
18985 ucb) if $test `./findhdr sgtty.h`; then
18986 val2="$define"
18987 echo "<sgtty.h> found." >&4
18988 else
18989 echo "System is pyramid with BSD universe."
18990 echo "<sgtty.h> not found--you could have problems." >&4
18991 fi;;
18992 *) if $test `./findhdr termio.h`; then
18993 val="$define"
18994 echo "<termio.h> found." >&4
18995 else
18996 echo "System is pyramid with USG universe."
18997 echo "<termio.h> not found--you could have problems." >&4
18998 fi;;
18999 esac
19000 elif ./usg; then
19001 if $test `./findhdr termio.h`; then
19002 echo "<termio.h> found." >&4
19003 val="$define"
19004 elif $test `./findhdr sgtty.h`; then
19005 echo "<sgtty.h> found." >&4
19006 val2="$define"
19007 else
19008echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19009 fi
19010 else
19011 if $test `./findhdr sgtty.h`; then
19012 echo "<sgtty.h> found." >&4
19013 val2="$define"
19014 elif $test `./findhdr termio.h`; then
19015 echo "<termio.h> found." >&4
19016 val="$define"
19017 else
19018echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19019 fi
19020 fi;;
19021esac
19022set i_termio; eval $setvar
19023val=$val2; set i_sgtty; eval $setvar
19024val=$val3; set i_termios; eval $setvar
19025
b4eb6b3d
JH
19026: see if stddef is available
19027set stddef.h i_stddef
19028eval $inhdr
923fc586 19029
b4eb6b3d
JH
19030: see if this is a sunmath.h system
19031set sunmath.h i_sunmath
19032eval $inhdr
5f80c64f 19033
b4eb6b3d
JH
19034: see if sys/access.h is available
19035set sys/access.h i_sysaccess
19036eval $inhdr
19037
19038: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19039set sys/filio.h i_sysfilio
19040eval $inhdr
19041echo " "
19042if $test `./findhdr sys/ioctl.h`; then
19043 val="$define"
19044 echo '<sys/ioctl.h> found.' >&4
19045else
19046 val="$undef"
19047 if $test $i_sysfilio = "$define"; then
19048 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 19049 else
b4eb6b3d
JH
19050 $test $i_sgtty = "$define" && xxx="sgtty.h"
19051 $test $i_termio = "$define" && xxx="termio.h"
19052 $test $i_termios = "$define" && xxx="termios.h"
19053echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19054 fi
19055fi
19056set i_sysioctl
19057eval $setvar
19058
49a78c82
JH
19059: see if socket ioctl defs are in sys/sockio.h
19060echo " "
19061xxx=`./findhdr sys/sockio.h`
19062if $test "$xxx"; then
19063 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19064 val="$define"
19065 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19066 else
19067 val="$undef"
19068 echo "No socket ioctls found in <sys/sockio.h>." >&4
19069 fi
19070else
19071 val="$undef"
19072 $cat <<EOM
19073<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19074EOM
19075fi
19076set i_syssockio
19077eval $setvar
19078
b4eb6b3d
JH
19079
19080: see if this is a syslog.h system
19081set syslog.h i_syslog
19082eval $inhdr
19083
19084
19085: see if this is a sys/mode.h system
19086set sys/mode.h i_sysmode
19087eval $inhdr
19088
19089: see if sys/resource.h has to be included
19090set sys/resource.h i_sysresrc
19091eval $inhdr
19092
19093: see if sys/security.h is available
19094set sys/security.h i_syssecrt
19095eval $inhdr
19096
19097: see if this is a sys/statvfs.h system
19098set sys/statvfs.h i_sysstatvfs
19099eval $inhdr
19100
b4eb6b3d
JH
19101: see if this is a sys/un.h system
19102set sys/un.h i_sysun
19103eval $inhdr
19104
19105
19106: see if this is a sys/utsname.h system
19107set sys/utsname.h i_sysutsname
19108eval $inhdr
19109
19110: see if this is a syswait system
19111set sys/wait.h i_syswait
19112eval $inhdr
19113
19114: see if this is a ustat.h system
19115set ustat.h i_ustat
19116eval $inhdr
19117
19118: see if this is an utime system
19119set utime.h i_utime
19120eval $inhdr
19121
19122: see if this is a values.h system
19123set values.h i_values
19124eval $inhdr
19125
19126: see if this is a vfork system
19127case "$d_vfork" in
19128"$define")
19129 set vfork.h i_vfork
19130 eval $inhdr
19131 ;;
19132*)
19133 i_vfork="$undef"
19134 ;;
19135esac
19136
19137: see if gdbm.h is available
19138set gdbm.h t_gdbm
19139eval $inhdr
19140case "$t_gdbm" in
19141$define)
19142 : see if gdbm_open exists
19143 set gdbm_open d_gdbm_open
19144 eval $inlibc
19145 case "$d_gdbm_open" in
19146 $undef)
19147 t_gdbm="$undef"
19148 echo "We won't be including <gdbm.h>"
5f80c64f 19149 ;;
b4eb6b3d
JH
19150 esac
19151 ;;
19152esac
19153val="$t_gdbm"
19154set i_gdbm
19155eval $setvar
19156
19157echo " "
19158echo "Looking for extensions..." >&4
19159: If we are using the old config.sh, known_extensions may contain
19160: old or inaccurate or duplicate values.
19161known_extensions=''
19162nonxs_extensions=''
19163: We do not use find because it might not be available.
19164: We do not just use MANIFEST because the user may have dropped
19165: some additional extensions into the source tree and expect them
19166: to be built.
19167
19168: Function to recursively find available extensions, ignoring DynaLoader
19169: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19170find_extensions='
19171 for xxx in *; do
19172 case "$xxx" in
19173 DynaLoader|dynaload) ;;
19174 *)
19175 if $test -f $xxx/$xxx.xs; then
19176 known_extensions="$known_extensions $1$xxx";
19177 elif $test -f $xxx/Makefile.PL; then
19178 nonxs_extensions="$nonxs_extensions $1$xxx";
19179 else
19180 if $test -d $xxx -a $# -lt 10; then
19181 set $1$xxx/ $*;
6904989c 19182 cd "$xxx";
b4eb6b3d
JH
19183 eval $find_extensions;
19184 cd ..;
19185 shift;
19186 fi;
19187 fi
19188 ;;
19189 esac;
19190 done'
19191tdir=`pwd`
6904989c 19192cd "$rsrc/ext"
b4eb6b3d
JH
19193set X
19194shift
19195eval $find_extensions
4e1a6d26
AD
19196# Special case: Add in threads/shared since it is not picked up by the
19197# recursive find above (and adding in general recursive finding breaks
19198# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 19199known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
19200set X $nonxs_extensions
19201shift
19202nonxs_extensions="$*"
19203set X $known_extensions
19204shift
19205known_extensions="$*"
6904989c 19206cd "$tdir"
b4eb6b3d
JH
19207
19208: Now see which are supported on this system.
19209avail_ext=''
19210for xxx in $known_extensions ; do
19211 case "$xxx" in
19212 DB_File|db_file)
19213 case "$i_db" in
19214 $define) avail_ext="$avail_ext $xxx" ;;
19215 esac
19216 ;;
19217 GDBM_File|gdbm_fil)
19218 case "$i_gdbm" in
19219 $define) avail_ext="$avail_ext $xxx" ;;
19220 esac
19221 ;;
1d59c593 19222 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
19223 case "$i_langinfo$d_nl_langinfo" in
19224 $define$define) avail_ext="$avail_ext $xxx" ;;
19225 esac
19226 ;;
b4eb6b3d
JH
19227 NDBM_File|ndbm_fil)
19228 case "$i_ndbm" in
19229 $define)
19230 case "$osname-$use64bitint" in
252f4fb1 19231 cygwin-*|hpux-define)
b4eb6b3d
JH
19232 case "$libs" in
19233 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19234 esac
19235 ;;
19236 *) avail_ext="$avail_ext $xxx" ;;
19237 esac
19238 ;;
19239 esac
19240 ;;
19241 ODBM_File|odbm_fil)
19242 case "${i_dbm}${i_rpcsvcdbm}" in
19243 *"${define}"*)
19244 case "$osname-$use64bitint" in
252f4fb1 19245 cygwin-*|hpux-define)
b4eb6b3d
JH
19246 case "$libs" in
19247 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19248 esac
19249 ;;
19250 *) avail_ext="$avail_ext $xxx" ;;
19251 esac
19252 ;;
19253 esac
19254 ;;
19255 POSIX|posix)
19256 case "$useposix" in
19257 true|define|y) avail_ext="$avail_ext $xxx" ;;
19258 esac
19259 ;;
19260 Opcode|opcode)
19261 case "$useopcode" in
19262 true|define|y) avail_ext="$avail_ext $xxx" ;;
19263 esac
19264 ;;
19265 Socket|socket)
19266 case "$d_socket" in
4a9f028c
JH
19267 true|$define|y)
19268 case "$osname" in
19269 beos) ;; # not unless BONE
19270 *) avail_ext="$avail_ext $xxx" ;;
19271 esac
19272 ;;
b4eb6b3d
JH
19273 esac
19274 ;;
19275 Sys/Syslog|sys/syslog)
19276 : XXX syslog requires socket
19277 case "$d_socket" in
19278 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19279 esac
19280 ;;
19281 Thread|thread)
b00ec89b
AB
19282 case "$usethreads" in
19283 true|$define|y)
19284 case "$useithreads" in
19285 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19286 esac
b4eb6b3d
JH
19287 esac
19288 ;;
7deadc5f 19289 threads|threads/shared)
73e09c8f
JH
19290 # threads and threads::shared are special cases.
19291 # To stop people from asking "Perl 5.8.0 was supposed
19292 # to have this new fancy threads implementation but my
19293 # perl doesn't have it" and from people trying to
19294 # (re)install the threads module using CPAN.pm and
19295 # CPAN.pm then offering to reinstall Perl 5.8.0,
19296 # the threads.pm and threads/shared.pm will always be
19297 # there, croaking informatively ("you need to rebuild
19298 # all of Perl with threads, sorry") when threads haven't
19299 # been compiled in.
19300 # --jhi
19301 avail_ext="$avail_ext $xxx"
1dca008a 19302 ;;
b4eb6b3d
JH
19303 IPC/SysV|ipc/sysv)
19304 : XXX Do we need a useipcsysv variable here
19305 case "${d_msg}${d_sem}${d_shm}" in
19306 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19307 esac
19308 ;;
19309 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
19310 ;;
19311 esac
b4eb6b3d 19312done
5f80c64f 19313
b4eb6b3d
JH
19314set X $avail_ext
19315shift
19316avail_ext="$*"
5f80c64f 19317
b4eb6b3d
JH
19318: Now see which nonxs extensions are supported on this system.
19319: For now assume all are.
19320nonxs_ext=''
19321for xxx in $nonxs_extensions ; do
19322 case "$xxx" in
19323 *) nonxs_ext="$nonxs_ext $xxx"
19324 ;;
19325 esac
19326done
5f80c64f 19327
b4eb6b3d
JH
19328set X $nonxs_ext
19329shift
19330nonxs_ext="$*"
19331
19332case $usedl in
19333$define)
19334 $cat <<EOM
19335A number of extensions are supplied with $package. You may choose to
19336compile these extensions for dynamic loading (the default), compile
19337them into the $package executable (static loading), or not include
19338them at all. Answer "none" to include no extensions.
19339Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
19340
19341EOM
b4eb6b3d
JH
19342 case "$dynamic_ext" in
19343 '') dflt="$avail_ext" ;;
19344 *) dflt="$dynamic_ext"
19345 # Perhaps we are reusing an old out-of-date config.sh.
19346 case "$hint" in
19347 previous)
19348 if test X"$dynamic_ext" != X"$avail_ext"; then
19349 $cat <<EOM
19350NOTICE: Your previous config.sh list may be incorrect.
19351The extensions now available to you are
19352 ${avail_ext}
19353but the default list from your previous config.sh is
19354 ${dynamic_ext}
9c839522 19355
b4eb6b3d
JH
19356EOM
19357 fi
9c839522
PM
19358 ;;
19359 esac
b4eb6b3d
JH
19360 ;;
19361 esac
5f80c64f 19362 case "$dflt" in
b4eb6b3d
JH
19363 '') dflt=none;;
19364 esac
19365 rp="What extensions do you wish to load dynamically?"
19366 . ./myread
19367 case "$ans" in
19368 none) dynamic_ext=' ' ;;
19369 *) dynamic_ext="$ans" ;;
5f80c64f 19370 esac
5f80c64f 19371
b4eb6b3d
JH
19372 case "$static_ext" in
19373 '')
19374 : Exclude those already listed in dynamic linking
19375 dflt=''
19376 for xxx in $avail_ext; do
19377 case " $dynamic_ext " in
19378 *" $xxx "*) ;;
19379 *) dflt="$dflt $xxx" ;;
19380 esac
19381 done
19382 set X $dflt
19383 shift
19384 dflt="$*"
19385 ;;
19386 *) dflt="$static_ext"
19387 ;;
19388 esac
9c839522 19389
b4eb6b3d
JH
19390 case "$dflt" in
19391 '') dflt=none;;
19392 esac
19393 rp="What extensions do you wish to load statically?"
19394 . ./myread
19395 case "$ans" in
19396 none) static_ext=' ' ;;
19397 *) static_ext="$ans" ;;
19398 esac
19399 ;;
19400*)
19401 $cat <<EOM
19402A number of extensions are supplied with $package. Answer "none"
19403to include no extensions.
19404Note that DynaLoader is always built and need not be mentioned here.
9c839522 19405
b4eb6b3d
JH
19406EOM
19407 case "$static_ext" in
19408 '') dflt="$avail_ext" ;;
19409 *) dflt="$static_ext"
19410 # Perhaps we are reusing an old out-of-date config.sh.
19411 case "$hint" in
19412 previous)
19413 if test X"$static_ext" != X"$avail_ext"; then
19414 $cat <<EOM
19415NOTICE: Your previous config.sh list may be incorrect.
19416The extensions now available to you are
19417 ${avail_ext}
19418but the default list from your previous config.sh is
19419 ${static_ext}
5f80c64f
JH
19420
19421EOM
b4eb6b3d
JH
19422 fi
19423 ;;
19424 esac
19425 ;;
19426 esac
19427 : Exclude those that are not xs extensions
19428 case "$dflt" in
19429 '') dflt=none;;
19430 esac
19431 rp="What extensions do you wish to include?"
19432 . ./myread
19433 case "$ans" in
19434 none) static_ext=' ' ;;
19435 *) static_ext="$ans" ;;
19436 esac
19437 ;;
5f80c64f 19438esac
f1f6834f
AD
19439#
19440# Encode is a special case. If we are building Encode as a static
19441# extension, we need to explicitly list its subextensions as well.
19442# For other nested extensions, this is handled automatically by
19443# the appropriate Makefile.PL.
19444case " $static_ext " in
19445 *" Encode "*) # Add the subextensions of Encode
19446 cd "$rsrc/ext"
19447 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19448 static_ext="$static_ext Encode/$xxx"
19449 done
19450 cd "$tdir"
19451 ;;
19452esac
5f80c64f 19453
b4eb6b3d
JH
19454set X $dynamic_ext $static_ext $nonxs_ext
19455shift
19456extensions="$*"
19457
9c839522
PM
19458: Remove libraries needed only for extensions
19459: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
19460: The exception is SunOS 4.x, which needs them.
19461case "${osname}X${osvers}" in
19462sunos*X4*)
19463 perllibs="$libs"
19464 ;;
19465*) case "$usedl" in
19466 $define|true|[yY]*)
19467 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
19468 shift
19469 perllibs="$*"
19470 ;;
19471 *) perllibs="$libs"
19472 ;;
19473 esac
19474 ;;
9c839522 19475esac
5f80c64f
JH
19476
19477: Remove build directory name from cppstdin so it can be used from
19478: either the present location or the final installed location.
19479echo " "
19480: Get out of the UU directory to get correct path name.
19481cd ..
19482case "$cppstdin" in
19483`pwd`/cppstdin)
19484 echo "Stripping down cppstdin path name"
19485 cppstdin=cppstdin
19486 ;;
19487esac
19488cd UU
19489
19490: end of configuration questions
19491echo " "
19492echo "End of configuration questions."
19493echo " "
19494
19495: back to where it started
19496if test -d ../UU; then
19497 cd ..
19498fi
19499
48370efc
JH
19500: configuration may be patched via a 'config.arch' file
19501if $test -f config.arch; then
19502 echo "I see a config.arch file, loading it."
19503 . ./config.arch
19504fi
19505
5f80c64f
JH
19506: configuration may be patched via a 'config.over' file
19507if $test -f config.over; then
19508 echo " "
19509 dflt=y
19510 rp='I see a config.over file. Do you wish to load it?'
19511 . UU/myread
19512 case "$ans" in
19513 n*) echo "OK, I'll ignore it.";;
19514 *) . ./config.over
19515 echo "Configuration override changes have been loaded."
19516 ;;
19517 esac
19518fi
19519
19520: in case they want portability, strip down executable paths
19521case "$d_portable" in
19522"$define")
19523 echo " "
19524 echo "Stripping down executable paths..." >&4
19525 for file in $loclist $trylist; do
534ac15a
JH
19526 eval temp=\$$file
19527 eval $file=`basename $temp`
5f80c64f
JH
19528 done
19529 ;;
19530esac
19531
19532: create config.sh file
19533echo " "
19534echo "Creating config.sh..." >&4
19535$spitshell <<EOT >config.sh
19536$startsh
19537#
19538# This file was produced by running the Configure script. It holds all the
19539# definitions figured out by Configure. Should you modify one of these values,
19540# do not forget to propagate your changes by running "Configure -der". You may
19541# instead choose to run each of the .SH files by yourself, or "Configure -S".
19542#
19543
19544# Package name : $package
19545# Source directory : $src
19546# Configuration time: $cf_time
19547# Configured by : $cf_by
19548# Target system : $myuname
19549
19550Author='$Author'
19551Date='$Date'
19552Header='$Header'
19553Id='$Id'
19554Locker='$Locker'
19555Log='$Log'
19556Mcc='$Mcc'
19557RCSfile='$RCSfile'
19558Revision='$Revision'
19559Source='$Source'
19560State='$State'
19561_a='$_a'
19562_exe='$_exe'
19563_o='$_o'
b4eb6b3d 19564afs='$afs'
a6d26a0d 19565afsroot='$afsroot'
b4eb6b3d
JH
19566alignbytes='$alignbytes'
19567ansi2knr='$ansi2knr'
19568aphostname='$aphostname'
19569api_revision='$api_revision'
19570api_subversion='$api_subversion'
19571api_version='$api_version'
19572api_versionstring='$api_versionstring'
5f80c64f 19573ar='$ar'
b4eb6b3d
JH
19574archlib='$archlib'
19575archlibexp='$archlibexp'
19576archname64='$archname64'
19577archname='$archname'
5f80c64f 19578archobjs='$archobjs'
10bc17b6 19579asctime_r_proto='$asctime_r_proto'
5f80c64f 19580awk='$awk'
b4eb6b3d 19581baserev='$baserev'
5f80c64f 19582bash='$bash'
b4eb6b3d 19583bin='$bin'
b4eb6b3d 19584binexp='$binexp'
5f80c64f
JH
19585bison='$bison'
19586byacc='$byacc'
b4eb6b3d 19587byteorder='$byteorder'
5f80c64f 19588c='$c'
b4eb6b3d 19589castflags='$castflags'
5f80c64f
JH
19590cat='$cat'
19591cc='$cc'
19592cccdlflags='$cccdlflags'
19593ccdlflags='$ccdlflags'
19594ccflags='$ccflags'
b4eb6b3d 19595ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 19596ccname='$ccname'
b4eb6b3d 19597ccsymbols='$ccsymbols'
6b356c8e 19598ccversion='$ccversion'
5f80c64f 19599cf_by='$cf_by'
b4eb6b3d 19600cf_email='$cf_email'
5f80c64f 19601cf_time='$cf_time'
b4eb6b3d 19602charsize='$charsize'
5f80c64f
JH
19603chgrp='$chgrp'
19604chmod='$chmod'
19605chown='$chown'
b4eb6b3d 19606clocktype='$clocktype'
5f80c64f
JH
19607comm='$comm'
19608compress='$compress'
19609contains='$contains'
19610cp='$cp'
19611cpio='$cpio'
19612cpp='$cpp'
b4eb6b3d
JH
19613cpp_stuff='$cpp_stuff'
19614cppccsymbols='$cppccsymbols'
5f80c64f
JH
19615cppflags='$cppflags'
19616cpplast='$cpplast'
19617cppminus='$cppminus'
19618cpprun='$cpprun'
19619cppstdin='$cppstdin'
b4eb6b3d 19620cppsymbols='$cppsymbols'
10bc17b6 19621crypt_r_proto='$crypt_r_proto'
b4eb6b3d 19622cryptlib='$cryptlib'
5f80c64f 19623csh='$csh'
10bc17b6
JH
19624ctermid_r_proto='$ctermid_r_proto'
19625ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
19626d_Gconvert='$d_Gconvert'
19627d_PRIEUldbl='$d_PRIEUldbl'
19628d_PRIFUldbl='$d_PRIFUldbl'
19629d_PRIGUldbl='$d_PRIGUldbl'
19630d_PRIXU64='$d_PRIXU64'
19631d_PRId64='$d_PRId64'
19632d_PRIeldbl='$d_PRIeldbl'
19633d_PRIfldbl='$d_PRIfldbl'
19634d_PRIgldbl='$d_PRIgldbl'
19635d_PRIi64='$d_PRIi64'
19636d_PRIo64='$d_PRIo64'
19637d_PRIu64='$d_PRIu64'
19638d_PRIx64='$d_PRIx64'
19639d_SCNfldbl='$d_SCNfldbl'
74cac757 19640d__fwalk='$d__fwalk'
b4eb6b3d
JH
19641d_access='$d_access'
19642d_accessx='$d_accessx'
19643d_alarm='$d_alarm'
19644d_archlib='$d_archlib'
10bc17b6 19645d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
19646d_atolf='$d_atolf'
19647d_atoll='$d_atoll'
19648d_attribut='$d_attribut'
19649d_bcmp='$d_bcmp'
19650d_bcopy='$d_bcopy'
5f80c64f 19651d_bsd='$d_bsd'
b4eb6b3d
JH
19652d_bsdgetpgrp='$d_bsdgetpgrp'
19653d_bsdsetpgrp='$d_bsdsetpgrp'
19654d_bzero='$d_bzero'
19655d_casti32='$d_casti32'
19656d_castneg='$d_castneg'
19657d_charvspr='$d_charvspr'
19658d_chown='$d_chown'
19659d_chroot='$d_chroot'
19660d_chsize='$d_chsize'
758a5d79 19661d_class='$d_class'
b4eb6b3d 19662d_closedir='$d_closedir'
4e0554ec 19663d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d
JH
19664d_const='$d_const'
19665d_crypt='$d_crypt'
10bc17b6 19666d_crypt_r='$d_crypt_r'
b4eb6b3d 19667d_csh='$d_csh'
10bc17b6
JH
19668d_ctermid_r='$d_ctermid_r'
19669d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
19670d_cuserid='$d_cuserid'
19671d_dbl_dig='$d_dbl_dig'
2ef53570 19672d_dbminitproto='$d_dbminitproto'
b4eb6b3d 19673d_difftime='$d_difftime'
ae0e3d3b 19674d_dirfd='$d_dirfd'
b4eb6b3d
JH
19675d_dirnamlen='$d_dirnamlen'
19676d_dlerror='$d_dlerror'
5f80c64f 19677d_dlopen='$d_dlopen'
b4eb6b3d
JH
19678d_dlsymun='$d_dlsymun'
19679d_dosuid='$d_dosuid'
10bc17b6 19680d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
19681d_drand48proto='$d_drand48proto'
19682d_dup2='$d_dup2'
19683d_eaccess='$d_eaccess'
19684d_endgrent='$d_endgrent'
10bc17b6 19685d_endgrent_r='$d_endgrent_r'
b4eb6b3d 19686d_endhent='$d_endhent'
10bc17b6 19687d_endhostent_r='$d_endhostent_r'
b4eb6b3d 19688d_endnent='$d_endnent'
10bc17b6 19689d_endnetent_r='$d_endnetent_r'
b4eb6b3d 19690d_endpent='$d_endpent'
10bc17b6 19691d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 19692d_endpwent='$d_endpwent'
10bc17b6 19693d_endpwent_r='$d_endpwent_r'
b4eb6b3d 19694d_endsent='$d_endsent'
10bc17b6 19695d_endservent_r='$d_endservent_r'
b4eb6b3d 19696d_eofnblk='$d_eofnblk'
5f80c64f 19697d_eunice='$d_eunice'
b363b713 19698d_fchdir='$d_fchdir'
b4eb6b3d
JH
19699d_fchmod='$d_fchmod'
19700d_fchown='$d_fchown'
19701d_fcntl='$d_fcntl'
9d9004a9 19702d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
19703d_fd_macros='$d_fd_macros'
19704d_fd_set='$d_fd_set'
19705d_fds_bits='$d_fds_bits'
19706d_fgetpos='$d_fgetpos'
758a5d79
JH
19707d_finite='$d_finite'
19708d_finitel='$d_finitel'
b4eb6b3d
JH
19709d_flexfnam='$d_flexfnam'
19710d_flock='$d_flock'
2ef53570 19711d_flockproto='$d_flockproto'
b4eb6b3d 19712d_fork='$d_fork'
758a5d79 19713d_fp_class='$d_fp_class'
b4eb6b3d 19714d_fpathconf='$d_fpathconf'
758a5d79
JH
19715d_fpclass='$d_fpclass'
19716d_fpclassify='$d_fpclassify'
19717d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
19718d_fpos64_t='$d_fpos64_t'
19719d_frexpl='$d_frexpl'
19720d_fs_data_s='$d_fs_data_s'
19721d_fseeko='$d_fseeko'
19722d_fsetpos='$d_fsetpos'
19723d_fstatfs='$d_fstatfs'
19724d_fstatvfs='$d_fstatvfs'
411ab01c 19725d_fsync='$d_fsync'
b4eb6b3d
JH
19726d_ftello='$d_ftello'
19727d_ftime='$d_ftime'
19728d_getcwd='$d_getcwd'
19729d_getespwnam='$d_getespwnam'
19730d_getfsstat='$d_getfsstat'
19731d_getgrent='$d_getgrent'
10bc17b6
JH
19732d_getgrent_r='$d_getgrent_r'
19733d_getgrgid_r='$d_getgrgid_r'
19734d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
19735d_getgrps='$d_getgrps'
19736d_gethbyaddr='$d_gethbyaddr'
19737d_gethbyname='$d_gethbyname'
19738d_gethent='$d_gethent'
19739d_gethname='$d_gethname'
10bc17b6
JH
19740d_gethostbyaddr_r='$d_gethostbyaddr_r'
19741d_gethostbyname_r='$d_gethostbyname_r'
19742d_gethostent_r='$d_gethostent_r'
b4eb6b3d 19743d_gethostprotos='$d_gethostprotos'
4e0554ec 19744d_getitimer='$d_getitimer'
b4eb6b3d 19745d_getlogin='$d_getlogin'
10bc17b6 19746d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
19747d_getmnt='$d_getmnt'
19748d_getmntent='$d_getmntent'
19749d_getnbyaddr='$d_getnbyaddr'
19750d_getnbyname='$d_getnbyname'
19751d_getnent='$d_getnent'
10bc17b6
JH
19752d_getnetbyaddr_r='$d_getnetbyaddr_r'
19753d_getnetbyname_r='$d_getnetbyname_r'
19754d_getnetent_r='$d_getnetent_r'
b4eb6b3d 19755d_getnetprotos='$d_getnetprotos'
0c0643d0 19756d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
19757d_getpbyname='$d_getpbyname'
19758d_getpbynumber='$d_getpbynumber'
19759d_getpent='$d_getpent'
19760d_getpgid='$d_getpgid'
19761d_getpgrp2='$d_getpgrp2'
19762d_getpgrp='$d_getpgrp'
19763d_getppid='$d_getppid'
19764d_getprior='$d_getprior'
10bc17b6
JH
19765d_getprotobyname_r='$d_getprotobyname_r'
19766d_getprotobynumber_r='$d_getprotobynumber_r'
19767d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
19768d_getprotoprotos='$d_getprotoprotos'
19769d_getprpwnam='$d_getprpwnam'
19770d_getpwent='$d_getpwent'
10bc17b6
JH
19771d_getpwent_r='$d_getpwent_r'
19772d_getpwnam_r='$d_getpwnam_r'
19773d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
19774d_getsbyname='$d_getsbyname'
19775d_getsbyport='$d_getsbyport'
19776d_getsent='$d_getsent'
10bc17b6
JH
19777d_getservbyname_r='$d_getservbyname_r'
19778d_getservbyport_r='$d_getservbyport_r'
19779d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
19780d_getservprotos='$d_getservprotos'
19781d_getspnam='$d_getspnam'
10bc17b6 19782d_getspnam_r='$d_getspnam_r'
b4eb6b3d 19783d_gettimeod='$d_gettimeod'
10bc17b6 19784d_gmtime_r='$d_gmtime_r'
5f80c64f 19785d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
19786d_grpasswd='$d_grpasswd'
19787d_hasmntopt='$d_hasmntopt'
19788d_htonl='$d_htonl'
b4eb6b3d
JH
19789d_index='$d_index'
19790d_inetaton='$d_inetaton'
19791d_int64_t='$d_int64_t'
19792d_isascii='$d_isascii'
758a5d79
JH
19793d_isfinite='$d_isfinite'
19794d_isinf='$d_isinf'
b4eb6b3d
JH
19795d_isnan='$d_isnan'
19796d_isnanl='$d_isnanl'
19797d_killpg='$d_killpg'
19798d_lchown='$d_lchown'
19799d_ldbl_dig='$d_ldbl_dig'
19800d_link='$d_link'
10bc17b6 19801d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
19802d_locconv='$d_locconv'
19803d_lockf='$d_lockf'
19804d_longdbl='$d_longdbl'
19805d_longlong='$d_longlong'
19806d_lseekproto='$d_lseekproto'
19807d_lstat='$d_lstat'
19808d_madvise='$d_madvise'
19809d_mblen='$d_mblen'
19810d_mbstowcs='$d_mbstowcs'
19811d_mbtowc='$d_mbtowc'
19812d_memchr='$d_memchr'
19813d_memcmp='$d_memcmp'
19814d_memcpy='$d_memcpy'
19815d_memmove='$d_memmove'
19816d_memset='$d_memset'
19817d_mkdir='$d_mkdir'
19818d_mkdtemp='$d_mkdtemp'
19819d_mkfifo='$d_mkfifo'
19820d_mkstemp='$d_mkstemp'
19821d_mkstemps='$d_mkstemps'
19822d_mktime='$d_mktime'
19823d_mmap='$d_mmap'
19824d_modfl='$d_modfl'
e67aeab1 19825d_modfl_pow32_bug='$d_modfl_pow32_bug'
b4eb6b3d
JH
19826d_mprotect='$d_mprotect'
19827d_msg='$d_msg'
19828d_msg_ctrunc='$d_msg_ctrunc'
19829d_msg_dontroute='$d_msg_dontroute'
19830d_msg_oob='$d_msg_oob'
19831d_msg_peek='$d_msg_peek'
19832d_msg_proxy='$d_msg_proxy'
19833d_msgctl='$d_msgctl'
19834d_msgget='$d_msgget'
4e0554ec 19835d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
19836d_msgrcv='$d_msgrcv'
19837d_msgsnd='$d_msgsnd'
19838d_msync='$d_msync'
19839d_munmap='$d_munmap'
19840d_mymalloc='$d_mymalloc'
19841d_nice='$d_nice'
2765b840 19842d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 19843d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
19844d_off64_t='$d_off64_t'
19845d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19846d_oldpthreads='$d_oldpthreads'
19847d_oldsock='$d_oldsock'
19848d_open3='$d_open3'
19849d_pathconf='$d_pathconf'
19850d_pause='$d_pause'
19851d_perl_otherlibdirs='$d_perl_otherlibdirs'
19852d_phostname='$d_phostname'
19853d_pipe='$d_pipe'
19854d_poll='$d_poll'
5f80c64f 19855d_portable='$d_portable'
c7aff470 19856d_procselfexe='$d_procselfexe'
d6483fcc 19857d_pthread_atfork='$d_pthread_atfork'
b4eb6b3d
JH
19858d_pthread_yield='$d_pthread_yield'
19859d_pwage='$d_pwage'
19860d_pwchange='$d_pwchange'
19861d_pwclass='$d_pwclass'
19862d_pwcomment='$d_pwcomment'
19863d_pwexpire='$d_pwexpire'
19864d_pwgecos='$d_pwgecos'
19865d_pwpasswd='$d_pwpasswd'
19866d_pwquota='$d_pwquota'
19867d_qgcvt='$d_qgcvt'
19868d_quad='$d_quad'
10bc17b6
JH
19869d_random_r='$d_random_r'
19870d_readdir64_r='$d_readdir64_r'
b4eb6b3d 19871d_readdir='$d_readdir'
10bc17b6 19872d_readdir_r='$d_readdir_r'
b4eb6b3d 19873d_readlink='$d_readlink'
4e0554ec
JH
19874d_readv='$d_readv'
19875d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
19876d_rename='$d_rename'
19877d_rewinddir='$d_rewinddir'
19878d_rmdir='$d_rmdir'
19879d_safebcpy='$d_safebcpy'
19880d_safemcpy='$d_safemcpy'
19881d_sanemcmp='$d_sanemcmp'
ef9f17be 19882d_sbrkproto='$d_sbrkproto'
b4eb6b3d
JH
19883d_sched_yield='$d_sched_yield'
19884d_scm_rights='$d_scm_rights'
19885d_seekdir='$d_seekdir'
19886d_select='$d_select'
19887d_sem='$d_sem'
19888d_semctl='$d_semctl'
19889d_semctl_semid_ds='$d_semctl_semid_ds'
19890d_semctl_semun='$d_semctl_semun'
19891d_semget='$d_semget'
19892d_semop='$d_semop'
4e0554ec 19893d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
19894d_setegid='$d_setegid'
19895d_seteuid='$d_seteuid'
19896d_setgrent='$d_setgrent'
10bc17b6 19897d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
19898d_setgrps='$d_setgrps'
19899d_sethent='$d_sethent'
10bc17b6 19900d_sethostent_r='$d_sethostent_r'
4e0554ec 19901d_setitimer='$d_setitimer'
b4eb6b3d
JH
19902d_setlinebuf='$d_setlinebuf'
19903d_setlocale='$d_setlocale'
10bc17b6 19904d_setlocale_r='$d_setlocale_r'
b4eb6b3d 19905d_setnent='$d_setnent'
10bc17b6 19906d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
19907d_setpent='$d_setpent'
19908d_setpgid='$d_setpgid'
19909d_setpgrp2='$d_setpgrp2'
19910d_setpgrp='$d_setpgrp'
19911d_setprior='$d_setprior'
19912d_setproctitle='$d_setproctitle'
10bc17b6 19913d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 19914d_setpwent='$d_setpwent'
10bc17b6 19915d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
19916d_setregid='$d_setregid'
19917d_setresgid='$d_setresgid'
19918d_setresuid='$d_setresuid'
19919d_setreuid='$d_setreuid'
19920d_setrgid='$d_setrgid'
19921d_setruid='$d_setruid'
19922d_setsent='$d_setsent'
10bc17b6 19923d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
19924d_setsid='$d_setsid'
19925d_setvbuf='$d_setvbuf'
19926d_sfio='$d_sfio'
19927d_shm='$d_shm'
19928d_shmat='$d_shmat'
19929d_shmatprototype='$d_shmatprototype'
19930d_shmctl='$d_shmctl'
19931d_shmdt='$d_shmdt'
19932d_shmget='$d_shmget'
19933d_sigaction='$d_sigaction'
983dbef6 19934d_sigprocmask='$d_sigprocmask'
b4eb6b3d 19935d_sigsetjmp='$d_sigsetjmp'
49a78c82 19936d_sockatmark='$d_sockatmark'
2ef53570 19937d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
19938d_socket='$d_socket'
19939d_socklen_t='$d_socklen_t'
19940d_sockpair='$d_sockpair'
19941d_socks5_init='$d_socks5_init'
19942d_sqrtl='$d_sqrtl'
10bc17b6
JH
19943d_srand48_r='$d_srand48_r'
19944d_srandom_r='$d_srandom_r'
eef837ea 19945d_sresgproto='$d_sresgproto'
640374d0 19946d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
19947d_statblks='$d_statblks'
19948d_statfs_f_flags='$d_statfs_f_flags'
19949d_statfs_s='$d_statfs_s'
19950d_statvfs='$d_statvfs'
19951d_stdio_cnt_lval='$d_stdio_cnt_lval'
19952d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
19953d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19954d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
19955d_stdio_stream_array='$d_stdio_stream_array'
19956d_stdiobase='$d_stdiobase'
19957d_stdstdio='$d_stdstdio'
19958d_strchr='$d_strchr'
19959d_strcoll='$d_strcoll'
19960d_strctcpy='$d_strctcpy'
19961d_strerrm='$d_strerrm'
19962d_strerror='$d_strerror'
10bc17b6 19963d_strerror_r='$d_strerror_r'
b3c85772 19964d_strftime='$d_strftime'
b4eb6b3d
JH
19965d_strtod='$d_strtod'
19966d_strtol='$d_strtol'
19967d_strtold='$d_strtold'
19968d_strtoll='$d_strtoll'
28e5dec8 19969d_strtoq='$d_strtoq'
b4eb6b3d
JH
19970d_strtoul='$d_strtoul'
19971d_strtoull='$d_strtoull'
19972d_strtouq='$d_strtouq'
19973d_strxfrm='$d_strxfrm'
19974d_suidsafe='$d_suidsafe'
19975d_symlink='$d_symlink'
19976d_syscall='$d_syscall'
2ef53570 19977d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
19978d_sysconf='$d_sysconf'
19979d_sysernlst='$d_sysernlst'
19980d_syserrlst='$d_syserrlst'
19981d_system='$d_system'
19982d_tcgetpgrp='$d_tcgetpgrp'
19983d_tcsetpgrp='$d_tcsetpgrp'
19984d_telldir='$d_telldir'
19985d_telldirproto='$d_telldirproto'
19986d_time='$d_time'
19987d_times='$d_times'
14b90194
JH
19988d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19989d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 19990d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 19991d_truncate='$d_truncate'
10bc17b6 19992d_ttyname_r='$d_ttyname_r'
b4eb6b3d 19993d_tzname='$d_tzname'
4e0554ec
JH
19994d_u32align='$d_u32align'
19995d_ualarm='$d_ualarm'
b4eb6b3d
JH
19996d_umask='$d_umask'
19997d_uname='$d_uname'
19998d_union_semun='$d_union_semun'
758a5d79 19999d_unordered='$d_unordered'
4e0554ec 20000d_usleep='$d_usleep'
2ef53570 20001d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
20002d_ustat='$d_ustat'
20003d_vendorarch='$d_vendorarch'
20004d_vendorbin='$d_vendorbin'
20005d_vendorlib='$d_vendorlib'
20006d_vfork='$d_vfork'
20007d_void_closedir='$d_void_closedir'
20008d_voidsig='$d_voidsig'
20009d_voidtty='$d_voidtty'
20010d_volatile='$d_volatile'
20011d_vprintf='$d_vprintf'
20012d_wait4='$d_wait4'
20013d_waitpid='$d_waitpid'
20014d_wcstombs='$d_wcstombs'
20015d_wctomb='$d_wctomb'
4e0554ec 20016d_writev='$d_writev'
5f80c64f
JH
20017d_xenix='$d_xenix'
20018date='$date'
b4eb6b3d
JH
20019db_hashtype='$db_hashtype'
20020db_prefixtype='$db_prefixtype'
640374d0
JH
20021db_version_major='$db_version_major'
20022db_version_minor='$db_version_minor'
20023db_version_patch='$db_version_patch'
b4eb6b3d
JH
20024defvoidused='$defvoidused'
20025direntrytype='$direntrytype'
20026dlext='$dlext'
5f80c64f 20027dlsrc='$dlsrc'
b4eb6b3d
JH
20028doublesize='$doublesize'
20029drand01='$drand01'
10bc17b6 20030drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
20031dynamic_ext='$dynamic_ext'
20032eagain='$eagain'
20033ebcdic='$ebcdic'
5f80c64f
JH
20034echo='$echo'
20035egrep='$egrep'
20036emacs='$emacs'
10bc17b6
JH
20037endgrent_r_proto='$endgrent_r_proto'
20038endhostent_r_proto='$endhostent_r_proto'
20039endnetent_r_proto='$endnetent_r_proto'
20040endprotoent_r_proto='$endprotoent_r_proto'
20041endpwent_r_proto='$endpwent_r_proto'
20042endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
20043eunicefix='$eunicefix'
20044exe_ext='$exe_ext'
20045expr='$expr'
b4eb6b3d 20046extensions='$extensions'
6fcddf3b 20047extras='$extras'
b4eb6b3d
JH
20048fflushNULL='$fflushNULL'
20049fflushall='$fflushall'
5f80c64f
JH
20050find='$find'
20051firstmakefile='$firstmakefile'
20052flex='$flex'
b4eb6b3d
JH
20053fpossize='$fpossize'
20054fpostype='$fpostype'
20055freetype='$freetype'
5440bc8e 20056from='$from'
b4eb6b3d
JH
20057full_ar='$full_ar'
20058full_csh='$full_csh'
20059full_sed='$full_sed'
5b463ca7 20060gccosandvers='$gccosandvers'
5f80c64f 20061gccversion='$gccversion'
10bc17b6
JH
20062getgrent_r_proto='$getgrent_r_proto'
20063getgrgid_r_proto='$getgrgid_r_proto'
20064getgrnam_r_proto='$getgrnam_r_proto'
20065gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20066gethostbyname_r_proto='$gethostbyname_r_proto'
20067gethostent_r_proto='$gethostent_r_proto'
20068getlogin_r_proto='$getlogin_r_proto'
20069getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20070getnetbyname_r_proto='$getnetbyname_r_proto'
20071getnetent_r_proto='$getnetent_r_proto'
20072getprotobyname_r_proto='$getprotobyname_r_proto'
20073getprotobynumber_r_proto='$getprotobynumber_r_proto'
20074getprotoent_r_proto='$getprotoent_r_proto'
20075getpwent_r_proto='$getpwent_r_proto'
20076getpwnam_r_proto='$getpwnam_r_proto'
20077getpwuid_r_proto='$getpwuid_r_proto'
20078getservbyname_r_proto='$getservbyname_r_proto'
20079getservbyport_r_proto='$getservbyport_r_proto'
20080getservent_r_proto='$getservent_r_proto'
20081getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
20082gidformat='$gidformat'
20083gidsign='$gidsign'
20084gidsize='$gidsize'
20085gidtype='$gidtype'
5f80c64f 20086glibpth='$glibpth'
3c728e00 20087gmake='$gmake'
10bc17b6 20088gmtime_r_proto='$gmtime_r_proto'
5f80c64f 20089grep='$grep'
b4eb6b3d
JH
20090groupcat='$groupcat'
20091groupstype='$groupstype'
5f80c64f 20092gzip='$gzip'
b4eb6b3d
JH
20093h_fcntl='$h_fcntl'
20094h_sysfile='$h_sysfile'
5f80c64f 20095hint='$hint'
b4eb6b3d
JH
20096hostcat='$hostcat'
20097i16size='$i16size'
20098i16type='$i16type'
20099i32size='$i32size'
20100i32type='$i32type'
20101i64size='$i64size'
20102i64type='$i64type'
20103i8size='$i8size'
20104i8type='$i8type'
20105i_arpainet='$i_arpainet'
20106i_bsdioctl='$i_bsdioctl'
10bc17b6 20107i_crypt='$i_crypt'
b4eb6b3d
JH
20108i_db='$i_db'
20109i_dbm='$i_dbm'
20110i_dirent='$i_dirent'
5f80c64f 20111i_dld='$i_dld'
b4eb6b3d
JH
20112i_dlfcn='$i_dlfcn'
20113i_fcntl='$i_fcntl'
20114i_float='$i_float'
758a5d79
JH
20115i_fp='$i_fp'
20116i_fp_class='$i_fp_class'
b4eb6b3d
JH
20117i_gdbm='$i_gdbm'
20118i_grp='$i_grp'
b4eb6b3d
JH
20119i_ieeefp='$i_ieeefp'
20120i_inttypes='$i_inttypes'
2765b840 20121i_langinfo='$i_langinfo'
b4eb6b3d
JH
20122i_libutil='$i_libutil'
20123i_limits='$i_limits'
20124i_locale='$i_locale'
20125i_machcthr='$i_machcthr'
20126i_malloc='$i_malloc'
20127i_math='$i_math'
20128i_memory='$i_memory'
20129i_mntent='$i_mntent'
20130i_ndbm='$i_ndbm'
20131i_netdb='$i_netdb'
20132i_neterrno='$i_neterrno'
20133i_netinettcp='$i_netinettcp'
20134i_niin='$i_niin'
20135i_poll='$i_poll'
20136i_prot='$i_prot'
20137i_pthread='$i_pthread'
20138i_pwd='$i_pwd'
20139i_rpcsvcdbm='$i_rpcsvcdbm'
20140i_sfio='$i_sfio'
20141i_sgtty='$i_sgtty'
20142i_shadow='$i_shadow'
20143i_socks='$i_socks'
20144i_stdarg='$i_stdarg'
20145i_stddef='$i_stddef'
20146i_stdlib='$i_stdlib'
20147i_string='$i_string'
20148i_sunmath='$i_sunmath'
20149i_sysaccess='$i_sysaccess'
20150i_sysdir='$i_sysdir'
20151i_sysfile='$i_sysfile'
20152i_sysfilio='$i_sysfilio'
20153i_sysin='$i_sysin'
20154i_sysioctl='$i_sysioctl'
20155i_syslog='$i_syslog'
20156i_sysmman='$i_sysmman'
20157i_sysmode='$i_sysmode'
20158i_sysmount='$i_sysmount'
20159i_sysndir='$i_sysndir'
20160i_sysparam='$i_sysparam'
20161i_sysresrc='$i_sysresrc'
20162i_syssecrt='$i_syssecrt'
20163i_sysselct='$i_sysselct'
20164i_syssockio='$i_syssockio'
20165i_sysstat='$i_sysstat'
20166i_sysstatfs='$i_sysstatfs'
20167i_sysstatvfs='$i_sysstatvfs'
20168i_systime='$i_systime'
20169i_systimek='$i_systimek'
20170i_systimes='$i_systimes'
20171i_systypes='$i_systypes'
20172i_sysuio='$i_sysuio'
20173i_sysun='$i_sysun'
20174i_sysutsname='$i_sysutsname'
20175i_sysvfs='$i_sysvfs'
20176i_syswait='$i_syswait'
20177i_termio='$i_termio'
20178i_termios='$i_termios'
20179i_time='$i_time'
20180i_unistd='$i_unistd'
20181i_ustat='$i_ustat'
20182i_utime='$i_utime'
20183i_values='$i_values'
20184i_varargs='$i_varargs'
20185i_varhdr='$i_varhdr'
20186i_vfork='$i_vfork'
5f80c64f 20187ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
20188inc_version_list='$inc_version_list'
20189inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
20190incpath='$incpath'
20191inews='$inews'
b4eb6b3d
JH
20192installarchlib='$installarchlib'
20193installbin='$installbin'
20194installman1dir='$installman1dir'
20195installman3dir='$installman3dir'
20196installprefix='$installprefix'
20197installprefixexp='$installprefixexp'
20198installprivlib='$installprivlib'
20199installscript='$installscript'
20200installsitearch='$installsitearch'
20201installsitebin='$installsitebin'
20202installsitelib='$installsitelib'
20203installstyle='$installstyle'
20204installusrbinperl='$installusrbinperl'
20205installvendorarch='$installvendorarch'
20206installvendorbin='$installvendorbin'
20207installvendorlib='$installvendorlib'
20208intsize='$intsize'
4b661809 20209issymlink='$issymlink'
b4eb6b3d
JH
20210ivdformat='$ivdformat'
20211ivsize='$ivsize'
20212ivtype='$ivtype'
20213known_extensions='$known_extensions'
5f80c64f 20214ksh='$ksh'
5f80c64f
JH
20215ld='$ld'
20216lddlflags='$lddlflags'
20217ldflags='$ldflags'
b4eb6b3d
JH
20218ldflags_uselargefiles='$ldflags_uselargefiles'
20219ldlibpthname='$ldlibpthname'
5f80c64f
JH
20220less='$less'
20221lib_ext='$lib_ext'
20222libc='$libc'
b4eb6b3d 20223libperl='$libperl'
5f80c64f
JH
20224libpth='$libpth'
20225libs='$libs'
43999f95
JH
20226libsdirs='$libsdirs'
20227libsfiles='$libsfiles'
20228libsfound='$libsfound'
13b3f787 20229libspath='$libspath'
5f80c64f 20230libswanted='$libswanted'
b4eb6b3d 20231libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
20232line='$line'
20233lint='$lint'
20234lkflags='$lkflags'
20235ln='$ln'
20236lns='$lns'
10bc17b6 20237localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
20238locincpth='$locincpth'
20239loclibpth='$loclibpth'
b4eb6b3d
JH
20240longdblsize='$longdblsize'
20241longlongsize='$longlongsize'
20242longsize='$longsize'
5f80c64f
JH
20243lp='$lp'
20244lpr='$lpr'
20245ls='$ls'
b4eb6b3d
JH
20246lseeksize='$lseeksize'
20247lseektype='$lseektype'
5f80c64f
JH
20248mail='$mail'
20249mailx='$mailx'
20250make='$make'
20251make_set_make='$make_set_make'
b4eb6b3d
JH
20252mallocobj='$mallocobj'
20253mallocsrc='$mallocsrc'
20254malloctype='$malloctype'
20255man1dir='$man1dir'
20256man1direxp='$man1direxp'
20257man1ext='$man1ext'
20258man3dir='$man3dir'
20259man3direxp='$man3direxp'
20260man3ext='$man3ext'
5f80c64f
JH
20261mips_type='$mips_type'
20262mkdir='$mkdir'
b4eb6b3d
JH
20263mmaptype='$mmaptype'
20264modetype='$modetype'
5f80c64f 20265more='$more'
b4eb6b3d 20266multiarch='$multiarch'
5f80c64f 20267mv='$mv'
b4eb6b3d
JH
20268myarchname='$myarchname'
20269mydomain='$mydomain'
20270myhostname='$myhostname'
5f80c64f
JH
20271myuname='$myuname'
20272n='$n'
2cc61e15 20273need_va_copy='$need_va_copy'
b4eb6b3d
JH
20274netdb_hlen_type='$netdb_hlen_type'
20275netdb_host_type='$netdb_host_type'
20276netdb_name_type='$netdb_name_type'
20277netdb_net_type='$netdb_net_type'
5f80c64f
JH
20278nm='$nm'
20279nm_opt='$nm_opt'
20280nm_so_opt='$nm_so_opt'
b4eb6b3d 20281nonxs_ext='$nonxs_ext'
5f80c64f 20282nroff='$nroff'
b4eb6b3d
JH
20283nvEUformat='$nvEUformat'
20284nvFUformat='$nvFUformat'
20285nvGUformat='$nvGUformat'
53133ed1 20286nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
20287nveformat='$nveformat'
20288nvfformat='$nvfformat'
20289nvgformat='$nvgformat'
20290nvsize='$nvsize'
20291nvtype='$nvtype'
20292o_nonblock='$o_nonblock'
5f80c64f 20293obj_ext='$obj_ext'
b4eb6b3d 20294old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 20295optimize='$optimize'
b4eb6b3d 20296orderlib='$orderlib'
5f80c64f
JH
20297osname='$osname'
20298osvers='$osvers'
b4eb6b3d 20299otherlibdirs='$otherlibdirs'
5f80c64f 20300package='$package'
b4eb6b3d
JH
20301pager='$pager'
20302passcat='$passcat'
20303patchlevel='$patchlevel'
5f80c64f 20304path_sep='$path_sep'
b4eb6b3d 20305perl5='$perl5'
5f80c64f 20306perl='$perl'
151e6568 20307perl_patchlevel='$perl_patchlevel'
b4eb6b3d 20308perladmin='$perladmin'
9c839522 20309perllibs='$perllibs'
b4eb6b3d 20310perlpath='$perlpath'
5f80c64f 20311pg='$pg'
b4eb6b3d
JH
20312phostname='$phostname'
20313pidtype='$pidtype'
5f80c64f 20314plibpth='$plibpth'
b4eb6b3d 20315pm_apiversion='$pm_apiversion'
5f80c64f
JH
20316pmake='$pmake'
20317pr='$pr'
b4eb6b3d
JH
20318prefix='$prefix'
20319prefixexp='$prefixexp'
20320privlib='$privlib'
20321privlibexp='$privlibexp'
f24dbf84 20322procselfexe='$procselfexe'
b4eb6b3d
JH
20323prototype='$prototype'
20324ptrsize='$ptrsize'
20325quadkind='$quadkind'
20326quadtype='$quadtype'
20327randbits='$randbits'
20328randfunc='$randfunc'
10bc17b6 20329random_r_proto='$random_r_proto'
b4eb6b3d
JH
20330randseedtype='$randseedtype'
20331ranlib='$ranlib'
20332rd_nodata='$rd_nodata'
10bc17b6
JH
20333readdir64_r_proto='$readdir64_r_proto'
20334readdir_r_proto='$readdir_r_proto'
b4eb6b3d 20335revision='$revision'
5f80c64f
JH
20336rm='$rm'
20337rmail='$rmail'
5440bc8e 20338run='$run'
5f80c64f 20339runnm='$runnm'
b4eb6b3d
JH
20340sPRIEUldbl='$sPRIEUldbl'
20341sPRIFUldbl='$sPRIFUldbl'
20342sPRIGUldbl='$sPRIGUldbl'
20343sPRIXU64='$sPRIXU64'
20344sPRId64='$sPRId64'
20345sPRIeldbl='$sPRIeldbl'
20346sPRIfldbl='$sPRIfldbl'
20347sPRIgldbl='$sPRIgldbl'
20348sPRIi64='$sPRIi64'
20349sPRIo64='$sPRIo64'
20350sPRIu64='$sPRIu64'
20351sPRIx64='$sPRIx64'
20352sSCNfldbl='$sSCNfldbl'
20353sched_yield='$sched_yield'
20354scriptdir='$scriptdir'
20355scriptdirexp='$scriptdirexp'
5f80c64f 20356sed='$sed'
b4eb6b3d
JH
20357seedfunc='$seedfunc'
20358selectminbits='$selectminbits'
20359selecttype='$selecttype'
5f80c64f 20360sendmail='$sendmail'
10bc17b6
JH
20361setgrent_r_proto='$setgrent_r_proto'
20362sethostent_r_proto='$sethostent_r_proto'
20363setlocale_r_proto='$setlocale_r_proto'
20364setnetent_r_proto='$setnetent_r_proto'
20365setprotoent_r_proto='$setprotoent_r_proto'
20366setpwent_r_proto='$setpwent_r_proto'
20367setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
20368sh='$sh'
20369shar='$shar'
20370sharpbang='$sharpbang'
b4eb6b3d
JH
20371shmattype='$shmattype'
20372shortsize='$shortsize'
20373shrpenv='$shrpenv'
5f80c64f 20374shsharp='$shsharp'
b4eb6b3d
JH
20375sig_count='$sig_count'
20376sig_name='$sig_name'
20377sig_name_init='$sig_name_init'
20378sig_num='$sig_num'
20379sig_num_init='$sig_num_init'
76d3c696 20380sig_size='$sig_size'
b4eb6b3d
JH
20381signal_t='$signal_t'
20382sitearch='$sitearch'
20383sitearchexp='$sitearchexp'
20384sitebin='$sitebin'
20385sitebinexp='$sitebinexp'
20386sitelib='$sitelib'
20387sitelib_stem='$sitelib_stem'
20388sitelibexp='$sitelibexp'
20389siteprefix='$siteprefix'
20390siteprefixexp='$siteprefixexp'
20391sizesize='$sizesize'
20392sizetype='$sizetype'
5f80c64f
JH
20393sleep='$sleep'
20394smail='$smail'
5f80c64f 20395so='$so'
b4eb6b3d
JH
20396sockethdr='$sockethdr'
20397socketlib='$socketlib'
20398socksizetype='$socksizetype'
5f80c64f
JH
20399sort='$sort'
20400spackage='$spackage'
20401spitshell='$spitshell'
10bc17b6
JH
20402srand48_r_proto='$srand48_r_proto'
20403srandom_r_proto='$srandom_r_proto'
5f80c64f 20404src='$src'
b4eb6b3d
JH
20405ssizetype='$ssizetype'
20406startperl='$startperl'
5f80c64f 20407startsh='$startsh'
b4eb6b3d
JH
20408static_ext='$static_ext'
20409stdchar='$stdchar'
20410stdio_base='$stdio_base'
20411stdio_bufsiz='$stdio_bufsiz'
20412stdio_cnt='$stdio_cnt'
20413stdio_filbuf='$stdio_filbuf'
20414stdio_ptr='$stdio_ptr'
20415stdio_stream_array='$stdio_stream_array'
10bc17b6 20416strerror_r_proto='$strerror_r_proto'
b4eb6b3d 20417strings='$strings'
5f80c64f 20418submit='$submit'
b4eb6b3d
JH
20419subversion='$subversion'
20420sysman='$sysman'
5f80c64f
JH
20421tail='$tail'
20422tar='$tar'
5440bc8e 20423targetarch='$targetarch'
5f80c64f
JH
20424tbl='$tbl'
20425tee='$tee'
20426test='$test'
b4eb6b3d
JH
20427timeincl='$timeincl'
20428timetype='$timetype'
10bc17b6 20429tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 20430to='$to'
5f80c64f
JH
20431touch='$touch'
20432tr='$tr'
20433trnl='$trnl'
20434troff='$troff'
10bc17b6 20435ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
20436u16size='$u16size'
20437u16type='$u16type'
20438u32size='$u32size'
20439u32type='$u32type'
20440u64size='$u64size'
20441u64type='$u64type'
20442u8size='$u8size'
20443u8type='$u8type'
20444uidformat='$uidformat'
20445uidsign='$uidsign'
20446uidsize='$uidsize'
20447uidtype='$uidtype'
5f80c64f
JH
20448uname='$uname'
20449uniq='$uniq'
b4eb6b3d
JH
20450uquadtype='$uquadtype'
20451use5005threads='$use5005threads'
20452use64bitall='$use64bitall'
20453use64bitint='$use64bitint'
5440bc8e 20454usecrosscompile='$usecrosscompile'
5f80c64f 20455usedl='$usedl'
b4eb6b3d
JH
20456useithreads='$useithreads'
20457uselargefiles='$uselargefiles'
20458uselongdouble='$uselongdouble'
20459usemorebits='$usemorebits'
20460usemultiplicity='$usemultiplicity'
20461usemymalloc='$usemymalloc'
5f80c64f 20462usenm='$usenm'
b4eb6b3d
JH
20463useopcode='$useopcode'
20464useperlio='$useperlio'
20465useposix='$useposix'
9514c62b 20466usereentrant='$usereentrant'
b4eb6b3d
JH
20467usesfio='$usesfio'
20468useshrplib='$useshrplib'
29209bc5 20469usesocks='$usesocks'
b4eb6b3d
JH
20470usethreads='$usethreads'
20471usevendorprefix='$usevendorprefix'
20472usevfork='$usevfork'
5f80c64f
JH
20473usrinc='$usrinc'
20474uuname='$uuname'
b4eb6b3d
JH
20475uvXUformat='$uvXUformat'
20476uvoformat='$uvoformat'
20477uvsize='$uvsize'
20478uvtype='$uvtype'
20479uvuformat='$uvuformat'
20480uvxformat='$uvxformat'
20481vendorarch='$vendorarch'
20482vendorarchexp='$vendorarchexp'
20483vendorbin='$vendorbin'
20484vendorbinexp='$vendorbinexp'
20485vendorlib='$vendorlib'
20486vendorlib_stem='$vendorlib_stem'
20487vendorlibexp='$vendorlibexp'
20488vendorprefix='$vendorprefix'
20489vendorprefixexp='$vendorprefixexp'
20490version='$version'
861eb78d 20491version_patchlevel_string='$version_patchlevel_string'
d56c5707 20492versiononly='$versiononly'
5f80c64f 20493vi='$vi'
b4eb6b3d 20494voidflags='$voidflags'
5f80c64f 20495xlibpth='$xlibpth'
b4eb6b3d 20496xs_apiversion='$xs_apiversion'
3659ebf1
JH
20497yacc='$yacc'
20498yaccflags='$yaccflags'
5f80c64f
JH
20499zcat='$zcat'
20500zip='$zip'
20501EOT
20502
20503: Add in command line options if available
20504$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20505
20506: add special variables
20507$test -f $src/patchlevel.h && \
d00b958f 20508awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 20509echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 20510echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
20511
20512: propagate old symbols
20513if $test -f UU/config.sh; then
381aa1ff 20514 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 20515 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 20516 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
20517 set X `cat UU/oldsyms`
20518 shift
20519 case $# in
20520 0) ;;
20521 *)
20522 cat <<EOM
20523Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20524EOM
20525 echo "# Variables propagated from previous config.sh file." >>config.sh
20526 for sym in `cat UU/oldsyms`; do
20527 echo " Propagating $hint variable "'$'"$sym..."
20528 eval 'tmp="$'"${sym}"'"'
20529 echo "$tmp" | \
20530 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20531 done
20532 ;;
20533 esac
20534fi
20535
20536: Finish up by extracting the .SH files
20537case "$alldone" in
20538exit)
20539 $rm -rf UU
24ccb310 20540 echo "Extraction done."
5f80c64f
JH
20541 exit 0
20542 ;;
20543cont)
20544 ;;
20545'')
20546 dflt=''
20547 nostick=true
20548 $cat <<EOM
20549
20550If you'd like to make any changes to the config.sh file before I begin
20551to configure things, do it as a shell escape now (e.g. !vi config.sh).
20552
20553EOM
20554 rp="Press return or use a shell escape to edit config.sh:"
20555 . UU/myread
20556 nostick=''
20557 case "$ans" in
20558 '') ;;
20559 *) : in case they cannot read
20560 sh 1>&4 -c "$ans";;
20561 esac
20562 ;;
20563esac
20564
20565: if this fails, just run all the .SH files by hand
20566. ./config.sh
20567
20568echo " "
20569exec 1>&4
a43e8593 20570pwd=`pwd`
5f80c64f 20571. ./UU/extract
6904989c 20572cd "$pwd"
5f80c64f
JH
20573
20574if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20575 dflt=y
20576 case "$silent" in
20577 true) ;;
20578 *)
20579 $cat <<EOM
20580
20581Now you need to generate make dependencies by running "$make depend".
20582You might prefer to run it in background: "$make depend > makedepend.out &"
20583It can take a while, so you might not want to run it right now.
20584
20585EOM
20586 ;;
20587 esac
20588 rp="Run $make depend now?"
20589 . UU/myread
20590 case "$ans" in
20591 y*)
3d5d58b1 20592 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
20593 ;;
20594 *)
20595 echo "You must run '$make depend' then '$make'."
20596 ;;
20597 esac
20598elif test -f [Mm]akefile; then
20599 echo " "
20600 echo "Now you must run a $make."
20601else
24ccb310 20602 echo "Configure done."
5f80c64f
JH
20603fi
20604
20605if $test -f Policy.sh; then
20606 $cat <<EOM
20607
20608If you compile $package on a different machine or from a different object
20609directory, copy the Policy.sh file from this object directory to the
20610new one before you run Configure -- this will help you with most of
20611the policy defaults.
20612
20613EOM
20614fi
20615if $test -f config.msg; then
20616 echo "Hmm. I also noted the following information while running:"
20617 echo " "
20618 $cat config.msg >&4
20619 $rm -f config.msg
20620fi
20621$rm -f kit*isdone ark*isdone
20622$rm -rf UU
20623
20624: End of Configure
20625