This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate with Sarathy.
[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#
a3540c92 23# Generated on Mon Apr 24 23:59:43 EET DST 2000 [metaconfig 3.0 PL70]
46193409 24# (with additional metaconfig patches by perlbug@perl.com)
2304df62
AD
25
26cat >/tmp/c1$$ <<EOF
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
37cat >/tmp/c2$$ <<EOF
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
43true || cat /tmp/c1$$ /tmp/c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat /tmp/c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f /tmp/c1$$ /tmp/c2$$
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
dfe9444c
AD
68 p_=\;
69 fi
39e571d4 70fi
a0d0e21e
LW
71
72: Proper PATH setting
73paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 74paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 75paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 76paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
77paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
81
82for p in $paths
83do
8e07c86e
AD
84 case "$p_$PATH$p_" in
85 *$p_$p$p_*) ;;
86 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
87 esac
88done
89
8e07c86e 90PATH=.$p_$PATH
2304df62
AD
91export PATH
92
dfe9444c
AD
93: shall we be using ksh?
94inksh=''
95needksh=''
96avoidksh=''
97newsh=/bin/ksh
98changesh=''
ff0cee69 99if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
100 inksh=true
101fi
102if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
104fi
105if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
108 newsh=/usr/bin/bsh
2304df62 109 fi
dfe9444c 110fi
cf04f91f
JH
111if test -f /osf_boot -a -f /usr/sbin/setld; then
112 if test X`/usr/bin/uname -s` = XOSF1; then
113 avoidksh="to avoid Digital UNIX' ksh"
114 newsh=/bin/sh
115 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116 fi
117fi
dfe9444c
AD
118case "$inksh/$needksh" in
119/[a-z]*)
c4f23d77 120 ENV=''
dfe9444c
AD
121 changesh=true
122 reason="$needksh"
123 ;;
124esac
125case "$inksh/$avoidksh" in
126true/[a-z]*)
127 changesh=true
128 reason="$avoidksh"
129 ;;
130esac
131case "$inksh/$needksh-$avoidksh-" in
132true/--)
a0d0e21e
LW
133 cat <<EOM
134(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 135mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 136EOM
dfe9444c
AD
137 ;;
138esac
139case "$changesh" in
140true)
141 echo "(Feeding myself to $newsh $reason.)"
142 case "$0" in
143 Configure|*/Configure) exec $newsh $0 "$@";;
144 *) exec $newsh Configure "$@";;
145 esac
146 ;;
147esac
2304df62 148
bfb7748a
AD
149: if needed set CDPATH to a harmless value that is not chatty
150: avoid bash 2.02 problems with empty CDPATH.
151case "$CDPATH" in
152'') ;;
153*) case "$SHELL" in
154 *bash*) CDPATH='.' ;;
155 *) CDPATH='' ;;
156 esac
157 ;;
158esac
2304df62
AD
159: Configure runs within the UU subdirectory
160test -d UU || mkdir UU
8e07c86e 161cd UU && rm -f ./*
2304df62 162
ff49bff8
JH
163ccsymbols=''
164cppccsymbols=''
165cppsymbols=''
a0d0e21e 166dynamic_ext=''
2304df62 167extensions=''
a0d0e21e 168known_extensions=''
4318d5a0 169nonxs_ext=''
bfb7748a 170static_ext=''
8ff267be 171useopcode=''
a0d0e21e 172useposix=''
ecfc5424 173d_bsd=''
40a7a20a 174d_eunice=''
2304df62
AD
175d_xenix=''
176eunicefix=''
177Mcc=''
dfe9444c 178ar=''
2304df62
AD
179awk=''
180bash=''
181bison=''
182byacc=''
183cat=''
184chgrp=''
185chmod=''
186chown=''
ecfc5424 187comm=''
2304df62
AD
188compress=''
189cp=''
190cpio=''
191cpp=''
192csh=''
193date=''
194echo=''
195egrep=''
196emacs=''
197expr=''
198find=''
199flex=''
2304df62 200grep=''
8ff267be 201gzip=''
2304df62
AD
202inews=''
203ksh=''
204less=''
205line=''
206lint=''
207ln=''
208lp=''
209lpr=''
210ls=''
211mail=''
212mailx=''
dfe9444c 213make=''
2304df62
AD
214mkdir=''
215more=''
216mv=''
693762b4 217nm=''
2304df62
AD
218nroff=''
219perl=''
220pg=''
221pmake=''
222pr=''
223rm=''
224rmail=''
225sed=''
226sendmail=''
2304df62
AD
227shar=''
228sleep=''
229smail=''
230sort=''
231submit=''
232tail=''
233tar=''
234tbl=''
693762b4 235tee=''
2304df62
AD
236test=''
237touch=''
238tr=''
239troff=''
240uname=''
241uniq=''
242uuname=''
243vi=''
244zcat=''
8ff267be 245zip=''
ccc7f9b3 246full_ar=''
1aef975c 247full_sed=''
a0d0e21e 248libswanted=''
2304df62
AD
249hint=''
250myuname=''
85e6fe83
LW
251osname=''
252osvers=''
2304df62
AD
253Author=''
254Date=''
255Header=''
256Id=''
257Locker=''
258Log=''
259RCSfile=''
260Revision=''
261Source=''
262State=''
dfe9444c
AD
263_a=''
264_exe=''
265_o=''
4633a7c4
LW
266archobjs=''
267exe_ext=''
268firstmakefile=''
269lib_ext=''
270obj_ext=''
271path_sep=''
2304df62 272afs=''
a0d0e21e 273alignbytes=''
c4f23d77 274ansi2knr=''
a0d0e21e
LW
275archlib=''
276archlibexp=''
a0d0e21e
LW
277d_archlib=''
278installarchlib=''
40000a8c
AD
279archname=''
280myarchname=''
cf2093f6
JH
281d_atolf=''
282d_atoll=''
ecfc5424 283baserev=''
2304df62
AD
284bin=''
285binexp=''
286installbin=''
d71b2b6b
JH
287bincompat5005=''
288d_bincompat5005=''
2304df62
AD
289byteorder=''
290cc=''
291gccversion=''
292ccflags=''
293cppflags=''
294ldflags=''
295lkflags=''
8e07c86e 296locincpth=''
2304df62 297optimize=''
8e07c86e 298cf_email=''
2304df62
AD
299cf_by=''
300cf_time=''
8175356b 301charsize=''
2304df62 302contains=''
a0d0e21e 303cpp_stuff=''
2304df62
AD
304cpplast=''
305cppminus=''
306cpprun=''
307cppstdin=''
68c15b6f 308crosscompile=''
2304df62 309d_access=''
5ff3f7a4 310d_accessx=''
a0d0e21e 311d_alarm=''
ecfc5424 312d_attribut=''
2304df62
AD
313d_bcmp=''
314d_bcopy=''
315d_bzero=''
316d_casti32=''
317castflags=''
318d_castneg=''
a0d0e21e
LW
319d_chown=''
320d_chroot=''
2304df62 321d_chsize=''
a0d0e21e
LW
322d_closedir=''
323d_void_closedir=''
2304df62
AD
324d_const=''
325cryptlib=''
326d_crypt=''
327d_csh=''
1aef975c 328full_csh=''
a0d0e21e
LW
329d_cuserid=''
330d_dbl_dig=''
331d_difftime=''
332d_dlerror=''
333d_dlopen=''
334d_dlsymun=''
2304df62 335d_dosuid=''
a0d0e21e 336d_suidsafe=''
85ab1d1d 337d_drand48proto=''
2304df62 338d_dup2=''
5ff3f7a4
GS
339d_eaccess=''
340d_endgrent=''
e5c9fcd0
AD
341d_endhent=''
342d_endnent=''
343d_endpent=''
5ff3f7a4 344d_endpwent=''
e5c9fcd0 345d_endsent=''
f1066039 346d_endspent=''
2304df62
AD
347d_fchmod=''
348d_fchown=''
349d_fcntl=''
a0d0e21e
LW
350d_fd_macros=''
351d_fd_set=''
352d_fds_bits=''
353d_fgetpos=''
2304df62
AD
354d_flexfnam=''
355d_flock=''
a0d0e21e 356d_fork=''
c5f05a91 357d_fpos64_t=''
a3540c92 358d_frexpl=''
ad27e871 359d_fs_data_s=''
5ff3f7a4 360d_fseeko=''
a0d0e21e 361d_fsetpos=''
0545a864 362d_fstatfs=''
5ff3f7a4 363d_ftello=''
5f05dabc 364d_ftime=''
365d_gettimeod=''
a0d0e21e 366d_Gconvert=''
49dabb45 367d_getcwd=''
c890dc6c 368d_getfsstat=''
5ff3f7a4 369d_getgrent=''
2304df62 370d_getgrps=''
4599a1de 371d_gethbyaddr=''
4599a1de 372d_gethbyname=''
dfe9444c 373d_gethent=''
2304df62
AD
374aphostname=''
375d_gethname=''
376d_phostname=''
377d_uname=''
dc45a647 378d_gethostprotos=''
a0d0e21e 379d_getlogin=''
ad27e871 380d_getmnt=''
ccc7f9b3 381d_getmntent=''
dfe9444c 382d_getnbyaddr=''
693762b4 383d_getnbyname=''
e5c9fcd0 384d_getnent=''
dc45a647 385d_getnetprotos=''
e5c9fcd0 386d_getpent=''
2afac517 387d_getpgid=''
2304df62 388d_getpgrp2=''
2afac517 389d_bsdgetpgrp=''
2304df62 390d_getpgrp=''
a0d0e21e 391d_getppid=''
2304df62 392d_getprior=''
693762b4
AD
393d_getpbyname=''
394d_getpbynumber=''
dc45a647 395d_getprotoprotos=''
5ff3f7a4 396d_getpwent=''
e5c9fcd0 397d_getsent=''
dc45a647 398d_getservprotos=''
f1066039
JH
399d_getspent=''
400d_getspnam=''
693762b4
AD
401d_getsbyname=''
402d_getsbyport=''
a4f3eea9 403d_gnulibc=''
ccc7f9b3 404d_hasmntopt=''
2304df62 405d_htonl=''
43999f95 406d_iconv=''
7e1af8bc 407d_inetaton=''
13b3f787 408d_int64_t=''
2304df62 409d_isascii=''
a3540c92
JH
410d_isnan=''
411d_isnanl=''
2304df62 412d_killpg=''
dd64f1c3 413d_lchown=''
2d4389e4 414d_ldbl_dig=''
2304df62 415d_link=''
a0d0e21e
LW
416d_locconv=''
417d_lockf=''
e5c9fcd0
AD
418d_longdbl=''
419longdblsize=''
dc45a647
MB
420d_longlong=''
421longlongsize=''
49c10eea 422d_lseekproto=''
2304df62 423d_lstat=''
1e8c3fde 424d_madvise=''
a0d0e21e
LW
425d_mblen=''
426d_mbstowcs=''
427d_mbtowc=''
0f27ced1 428d_memchr=''
2304df62
AD
429d_memcmp=''
430d_memcpy=''
431d_memmove=''
432d_memset=''
433d_mkdir=''
fe749a9f 434d_mkdtemp=''
a0d0e21e 435d_mkfifo=''
fe749a9f
JH
436d_mkstemp=''
437d_mkstemps=''
a0d0e21e 438d_mktime=''
fe749a9f
JH
439d_mmap=''
440mmaptype=''
a3540c92 441d_modfl=''
fe749a9f 442d_mprotect=''
2304df62
AD
443d_msg=''
444d_msgctl=''
445d_msgget=''
446d_msgrcv=''
447d_msgsnd=''
fe749a9f
JH
448d_msync=''
449d_munmap=''
a0d0e21e 450d_nice=''
c5f05a91 451d_off64_t=''
2304df62 452d_open3=''
a0d0e21e
LW
453d_fpathconf=''
454d_pathconf=''
455d_pause=''
456d_pipe=''
8e07c86e 457d_poll=''
2304df62 458d_portable=''
ef4af2be
JH
459d_old_pthread_create_joinable=''
460old_pthread_create_joinable=''
dfe9444c
AD
461d_pthread_yield=''
462d_sched_yield=''
1cfa4ec7 463sched_yield=''
bbe6c963 464d_qgcvt=''
2304df62 465d_readdir=''
85e6fe83
LW
466d_rewinddir=''
467d_seekdir=''
468d_telldir=''
a0d0e21e 469d_readlink=''
2304df62
AD
470d_rename=''
471d_rmdir=''
472d_safebcpy=''
473d_safemcpy=''
36477c24 474d_sanemcmp=''
2304df62
AD
475d_select=''
476d_sem=''
477d_semctl=''
478d_semget=''
479d_semop=''
480d_setegid=''
481d_seteuid=''
5ff3f7a4 482d_setgrent=''
dfe9444c 483d_setgrps=''
693762b4 484d_sethent=''
a0d0e21e 485d_setlinebuf=''
2304df62 486d_setlocale=''
e5c9fcd0
AD
487d_setnent=''
488d_setpent=''
2304df62
AD
489d_setpgid=''
490d_setpgrp2=''
2afac517 491d_bsdsetpgrp=''
2304df62
AD
492d_setpgrp=''
493d_setprior=''
5ff3f7a4 494d_setpwent=''
2304df62
AD
495d_setregid=''
496d_setresgid=''
497d_setresuid=''
498d_setreuid=''
499d_setrgid=''
500d_setruid=''
e5c9fcd0 501d_setsent=''
2304df62 502d_setsid=''
f1066039 503d_setspent=''
e5c9fcd0 504d_setvbuf=''
760ac839 505d_sfio=''
8ff267be 506usesfio=''
2304df62
AD
507d_shm=''
508d_shmat=''
a0d0e21e
LW
509d_shmatprototype=''
510shmattype=''
2304df62
AD
511d_shmctl=''
512d_shmdt=''
513d_shmget=''
2c7991dc 514d_sigaction=''
8ff267be 515d_sigsetjmp=''
de4597cb
JH
516d_msg_ctrunc=''
517d_msg_dontroute=''
518d_msg_oob=''
519d_msg_peek=''
520d_msg_proxy=''
2304df62 521d_oldsock=''
de4597cb 522d_scm_rights=''
2304df62
AD
523d_socket=''
524d_sockpair=''
525sockethdr=''
526socketlib=''
13b3f787 527d_socklen_t=''
68d4903c 528d_sqrtl=''
2304df62 529d_statblks=''
0545a864
JH
530d_statfs_f_flags=''
531d_statfs_s=''
104d25b7
JH
532d_fstatvfs=''
533d_statvfs=''
c2960299
AD
534d_stdio_cnt_lval=''
535d_stdio_ptr_lval=''
16d20bd9 536d_stdiobase=''
2304df62 537d_stdstdio=''
16d20bd9
AD
538stdio_base=''
539stdio_bufsiz=''
540stdio_cnt=''
dfe9444c 541stdio_filbuf=''
16d20bd9 542stdio_ptr=''
2304df62
AD
543d_index=''
544d_strchr=''
a0d0e21e 545d_strcoll=''
2304df62
AD
546d_strctcpy=''
547d_strerrm=''
548d_strerror=''
549d_sysernlst=''
550d_syserrlst=''
a89d8a78
DH
551d_strtod=''
552d_strtol=''
ff935051 553d_strtold=''
76d49b1c 554d_strtoll=''
a89d8a78 555d_strtoul=''
ff935051
JH
556d_strtoull=''
557d_strtouq=''
a0d0e21e 558d_strxfrm=''
2304df62
AD
559d_symlink=''
560d_syscall=''
a0d0e21e 561d_sysconf=''
2304df62 562d_system=''
a0d0e21e
LW
563d_tcgetpgrp=''
564d_tcsetpgrp=''
cb86ce0e 565d_telldirproto=''
85e6fe83
LW
566d_time=''
567timetype=''
2304df62
AD
568clocktype=''
569d_times=''
570d_truncate=''
a0d0e21e
LW
571d_tzname=''
572d_umask=''
bd89102f
AD
573d_semctl_semid_ds=''
574d_semctl_semun=''
575d_union_semun=''
0545a864 576d_ustat=''
2304df62 577d_vfork=''
a0d0e21e 578usevfork=''
2304df62
AD
579d_voidsig=''
580signal_t=''
581d_volatile=''
582d_charvspr=''
583d_vprintf=''
584d_wait4=''
585d_waitpid=''
a0d0e21e
LW
586d_wcstombs=''
587d_wctomb=''
588dlext=''
85e6fe83
LW
589cccdlflags=''
590ccdlflags=''
2304df62 591dlsrc=''
232e078e 592ld=''
85e6fe83 593lddlflags=''
2304df62 594usedl=''
693762b4 595doublesize=''
5ff3f7a4 596ebcdic=''
66fe083f 597fflushNULL=''
767df6a1 598fflushall=''
8175356b 599fpossize=''
a0d0e21e 600fpostype=''
a22e52b9 601gidformat=''
785fb66b
JH
602gidsign=''
603gidsize=''
2304df62
AD
604gidtype=''
605groupstype=''
606h_fcntl=''
607h_sysfile=''
5ff3f7a4 608i_arpainet=''
ecfc5424
AD
609db_hashtype=''
610db_prefixtype=''
a0d0e21e 611i_db=''
2304df62 612i_dbm=''
8e07c86e 613i_rpcsvcdbm=''
2304df62 614d_dirnamlen=''
a0d0e21e 615direntrytype=''
2304df62 616i_dirent=''
a0d0e21e 617i_dld=''
2304df62
AD
618i_dlfcn=''
619i_fcntl=''
a0d0e21e 620i_float=''
2304df62 621i_gdbm=''
28e8609d 622d_grpasswd=''
2304df62 623i_grp=''
43999f95 624i_iconv=''
792d8dab 625i_ieeefp=''
5ff3f7a4 626i_inttypes=''
a0d0e21e 627i_limits=''
4633a7c4 628i_locale=''
7f3d1cf1 629i_machcthr=''
a0d0e21e
LW
630i_malloc=''
631i_math=''
85e6fe83 632i_memory=''
e7fb4fcc 633i_mntent=''
2304df62 634i_ndbm=''
3fd537d4 635i_netdb=''
85e6fe83 636i_neterrno=''
9cc6feab 637i_netinettcp=''
2304df62
AD
638i_niin=''
639i_sysin=''
5b34fd99 640i_poll=''
c4747d3e 641i_pthread=''
2304df62
AD
642d_pwage=''
643d_pwchange=''
644d_pwclass=''
645d_pwcomment=''
646d_pwexpire=''
c4f23d77 647d_pwgecos=''
28e8609d 648d_pwpasswd=''
2304df62
AD
649d_pwquota=''
650i_pwd=''
760ac839 651i_sfio=''
f1066039 652i_shadow=''
86959918 653i_socks=''
2304df62 654i_stddef=''
a0d0e21e 655i_stdlib=''
2304df62
AD
656i_string=''
657strings=''
923fc586 658i_sunmath=''
5ff3f7a4 659i_sysaccess=''
2304df62
AD
660i_sysdir=''
661i_sysfile=''
662d_voidtty=''
663i_bsdioctl=''
a0d0e21e 664i_sysfilio=''
2304df62
AD
665i_sysioctl=''
666i_syssockio=''
ca52efda 667i_syslog=''
fe749a9f 668i_sysmman=''
bf0c440f 669i_sysmode=''
104d25b7 670i_sysmount=''
2304df62 671i_sysndir=''
a0d0e21e 672i_sysparam=''
8ff267be 673i_sysresrc=''
5ff3f7a4 674i_syssecrt=''
2304df62 675i_sysselct=''
1aef975c 676i_sysstat=''
0545a864 677i_sysstatfs=''
104d25b7 678i_sysstatvfs=''
a0d0e21e 679i_systimes=''
fed7345c 680i_systypes=''
de4597cb 681i_sysuio=''
25f94b33 682i_sysun=''
d4935d7f 683i_sysutsname=''
0545a864 684i_sysvfs=''
8ff267be 685i_syswait=''
2304df62
AD
686i_sgtty=''
687i_termio=''
688i_termios=''
689i_systime=''
690i_systimek=''
691i_time=''
692timeincl=''
85e6fe83 693i_unistd=''
0545a864 694i_ustat=''
2304df62 695i_utime=''
760ac839 696i_values=''
a0d0e21e 697i_stdarg=''
2304df62
AD
698i_varargs=''
699i_varhdr=''
700i_vfork=''
ff935051 701inc_version_list=''
3a096bf3 702inc_version_list_init=''
dd4e71fd
JH
703installprefix=''
704installprefixexp=''
705installstyle=''
104d25b7 706installusrbinperl=''
2304df62 707intsize=''
24fef2a7
AD
708longsize=''
709shortsize=''
2304df62 710libc=''
5cf1d1f1 711ldlibpthname=''
8ff267be 712libperl=''
2afac517 713shrpenv=''
8ff267be 714useshrplib=''
a0d0e21e 715glibpth=''
2304df62 716libpth=''
8e07c86e 717loclibpth=''
2304df62
AD
718plibpth=''
719xlibpth=''
1cfa4ec7 720ignore_versioned_solibs=''
2304df62 721libs=''
43999f95
JH
722libsdirs=''
723libsfiles=''
724libsfound=''
13b3f787 725libspath=''
85e6fe83 726lns=''
cf2093f6
JH
727d_PRIEldbl=''
728d_PRIFldbl=''
729d_PRIGldbl=''
730d_PRIeldbl=''
731d_PRIfldbl=''
732d_PRIgldbl=''
733sPRIEldbl=''
734sPRIFldbl=''
735sPRIGldbl=''
736sPRIeldbl=''
737sPRIfldbl=''
738sPRIgldbl=''
5ff3f7a4 739lseeksize=''
85e6fe83 740lseektype=''
8ff267be 741make_set_make=''
85e6fe83 742d_mymalloc=''
94b6baf5 743freetype=''
2304df62
AD
744mallocobj=''
745mallocsrc=''
746malloctype=''
747usemymalloc=''
16d20bd9
AD
748installman1dir=''
749man1dir=''
750man1direxp=''
751man1ext=''
752installman3dir=''
753man3dir=''
754man3direxp=''
755man3ext=''
2304df62
AD
756huge=''
757large=''
758medium=''
759models=''
760small=''
761split=''
a0d0e21e 762modetype=''
68c15b6f 763multiarch=''
2304df62
AD
764mydomain=''
765myhostname=''
766phostname=''
767c=''
768n=''
8e07c86e
AD
769d_eofnblk=''
770eagain=''
771o_nonblock=''
772rd_nodata=''
dfe9444c
AD
773netdb_hlen_type=''
774netdb_host_type=''
775netdb_name_type=''
776netdb_net_type=''
2304df62
AD
777groupcat=''
778hostcat=''
779passcat=''
85e6fe83
LW
780orderlib=''
781ranlib=''
3b777bb4
GS
782d_perl_otherlibdirs=''
783otherlibdirs=''
2304df62
AD
784package=''
785spackage=''
2c7991dc 786pager=''
ff935051
JH
787api_revision=''
788api_subversion=''
789api_version=''
790api_versionstring=''
ecfc5424 791patchlevel=''
49c10eea 792revision=''
760ac839 793subversion=''
bfb7748a 794version=''
49c10eea 795perl5=''
8e07c86e 796perladmin=''
4633a7c4 797perlpath=''
78691af5 798d_nv_preserves_uv=''
8175356b
JH
799i16size=''
800i16type=''
801i32size=''
802i32type=''
803i64size=''
804i64type=''
805i8size=''
806i8type=''
807ivsize=''
808ivtype=''
809nvsize=''
810nvtype=''
811u16size=''
812u16type=''
813u32size=''
814u32type=''
815u64size=''
816u64type=''
817u8size=''
818u8type=''
819uvsize=''
820uvtype=''
821ivdformat=''
822uvoformat=''
823uvuformat=''
824uvxformat=''
dfe9444c 825pidtype=''
a0d0e21e 826prefix=''
1aef975c 827prefixexp=''
2304df62
AD
828installprivlib=''
829privlib=''
830privlibexp=''
831prototype=''
693762b4 832ptrsize=''
cf2093f6
JH
833d_PRIX64=''
834d_PRId64=''
835d_PRIi64=''
836d_PRIo64=''
837d_PRIu64=''
838d_PRIx64=''
839sPRIX64=''
840sPRId64=''
841sPRIi64=''
842sPRIo64=''
843sPRIu64=''
844sPRIx64=''
de1c2614 845d_quad=''
6b8eaf93 846quadkind=''
d7d93a81
JH
847quadtype=''
848uquadtype=''
85ab1d1d 849drand01=''
2304df62 850randbits=''
85ab1d1d
JH
851randfunc=''
852randseedtype=''
853seedfunc=''
2304df62
AD
854installscript=''
855scriptdir=''
856scriptdirexp=''
5ff3f7a4 857selectminbits=''
a0d0e21e 858selecttype=''
8ff267be 859sh=''
af4c28eb 860sig_count=''
2304df62 861sig_name=''
dfe9444c 862sig_name_init=''
8e07c86e 863sig_num=''
824a2ba3 864sig_num_init=''
4633a7c4
LW
865installsitearch=''
866sitearch=''
867sitearchexp=''
717c4fcc
JH
868installsitebin=''
869sitebin=''
870sitebinexp=''
25f94b33
AD
871installsitelib=''
872sitelib=''
526fdc24 873sitelib_stem=''
25f94b33 874sitelibexp=''
dd4e71fd
JH
875siteprefix=''
876siteprefixexp=''
8c99d73e 877sizesize=''
a0d0e21e
LW
878sizetype=''
879so=''
c890dc6c 880socksizetype=''
2304df62
AD
881sharpbang=''
882shsharp=''
883spitshell=''
dfe9444c 884src=''
a0d0e21e 885ssizetype=''
4633a7c4 886startperl=''
2304df62
AD
887startsh=''
888stdchar=''
ed39a0f2 889d_stdio_stream_array=''
767df6a1 890stdio_stream_array=''
2304df62 891sysman=''
5ff3f7a4 892trnl=''
a22e52b9 893uidformat=''
57def98f 894uidsign=''
785fb66b 895uidsize=''
2304df62 896uidtype=''
85ab1d1d 897archname64=''
10cc9d2a
JH
898use64bitall=''
899use64bitint=''
249b38c6 900uselargefiles=''
b0ce926a 901uselongdouble=''
09458382 902usemorebits=''
85ab1d1d 903usemultiplicity=''
2304df62 904nm_opt=''
40a7a20a 905nm_so_opt=''
2304df62
AD
906runnm=''
907usenm=''
8ff267be 908useperlio=''
29209bc5 909usesocks=''
693762b4 910d_oldpthreads=''
aaacdc8b
GS
911use5005threads=''
912useithreads=''
dfe9444c 913usethreads=''
2304df62 914incpath=''
2304df62
AD
915mips_type=''
916usrinc=''
526fdc24
MS
917d_vendorarch=''
918installvendorarch=''
919vendorarch=''
920vendorarchexp=''
717c4fcc
JH
921d_vendorbin=''
922installvendorbin=''
923vendorbin=''
924vendorbinexp=''
a3635516
JH
925d_vendorlib=''
926installvendorlib=''
927vendorlib=''
526fdc24 928vendorlib_stem=''
a3635516
JH
929vendorlibexp=''
930usevendorprefix=''
931vendorprefix=''
932vendorprefixexp=''
2304df62
AD
933defvoidused=''
934voidflags=''
fe749a9f
JH
935pm_apiversion=''
936xs_apiversion=''
2304df62
AD
937CONFIG=''
938
ecfc5424
AD
939define='define'
940undef='undef'
941smallmach='pdp11 i8086 z8000 i80286 iAPX286'
942rmlist=''
943
944: We must find out about Eunice early
945eunicefix=':'
946if test -f /etc/unixtovms; then
947 eunicefix=/etc/unixtovms
948fi
949if test -f /etc/unixtovms.exe; then
950 eunicefix=/etc/unixtovms.exe
951fi
952
5ff3f7a4 953i_whoami=''
ff935051
JH
954: set useposix=false in your hint file to disable the POSIX extension.
955useposix=true
956: set useopcode=false in your hint file to disable the Opcode extension.
957useopcode=true
dfe9444c 958: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 959_exe=''
dfe9444c
AD
960: Extra object files, if any, needed on this platform.
961archobjs=''
ff935051
JH
962: Possible local include directories to search.
963: Set locincpth to "" in a hint file to defeat local include searches.
964locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
965locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
966:
967: no include file wanted by default
968inclwanted=''
969
dfe9444c 970groupstype=''
732c9516
JH
971: change the next line if compiling for Xenix/286 on Xenix/386
972xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
973: Possible local library directories to search.
974loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
975loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
976
977: general looking path for locating libraries
bf0c440f 978glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
732c9516
JH
979glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
980glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
981test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
982test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
983
984: Private path used by Configure to find libraries. Its value
985: is prepended to libpth. This variable takes care of special
986: machines, like the mips. Usually, it should be empty.
987plibpth=''
988
1cfa4ec7
GS
989: default library list
990libswanted=''
921b2963 991: some systems want to use only the non-versioned libso:s
1cfa4ec7 992ignore_versioned_solibs=''
85ab1d1d 993: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 994: set usesocks on the Configure command line to enable socks.
dfe9444c 995: set usethreads on the Configure command line to enable threads.
ff935051
JH
996: full support for void wanted by default
997defvoidused=15
998
ecfc5424 999: List of libraries we want.
693762b4 1000: If anyone needs -lnet, put it in a hint file.
997d70a2 1001libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1002libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1003libswanted="$libswanted ndir dir crypt sec"
997d70a2 1004libswanted="$libswanted ucb bsd BSD PW x iconv"
1aef975c 1005: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1006: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1007glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1008glibpth="/usr/shlib $glibpth"
1009: Do not use vfork unless overridden by a hint file.
1010usevfork=false
1011
8ff267be 1012: Find the basic shell for Bourne shell scripts
1013case "$sh" in
1014'')
8ff267be 1015 case "$SYSTYPE" in
1016 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1017 *) xxx='/bin/sh';;
1018 esac
1019 if test -f "$xxx"; then
1020 sh="$xxx"
1021 else
1022 : Build up a list and do a single loop so we can 'break' out.
1023 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1024 for xxx in sh bash ksh pdksh ash; do
1025 for p in $pth; do
1026 try="$try ${p}/${xxx}"
1027 done
1028 done
1029 for xxx in $try; do
1030 if test -f "$xxx"; then
1031 sh="$xxx";
8ff267be 1032 break
1033 elif test -f "$xxx.exe"; then
1034 sh="$xxx";
8ff267be 1035 break
1036 fi
1037 done
1038 fi
1039 ;;
1040esac
1041
1042case "$sh" in
1043'') cat <<EOM >&2
1044$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1045
8ff267be 1046Usually it's in /bin/sh. How did you even get this far?
46193409 1047Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 1048we'll try to straighten this all out.
8ff267be 1049EOM
1050 exit 1
1051 ;;
1052esac
1053
760ac839 1054: see if sh knows # comments
8ff267be 1055if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1056 shsharp=true
1057 spitshell=cat
760ac839
LW
1058 xcat=/bin/cat
1059 test -f $xcat || xcat=/usr/bin/cat
1060 echo "#!$xcat" >try
1061 $eunicefix try
1062 chmod +x try
1063 ./try > today
1064 if test -s today; then
760ac839
LW
1065 sharpbang='#!'
1066 else
1067 echo "#! $xcat" > try
1068 $eunicefix try
1069 chmod +x try
1070 ./try > today
1071 if test -s today; then
760ac839
LW
1072 sharpbang='#! '
1073 else
760ac839
LW
1074 sharpbang=': use '
1075 fi
1076 fi
1077else
dfe9444c 1078 echo " "
8ff267be 1079 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1080 shsharp=false
1081 cd ..
1082 echo "exec grep -v '^[ ]*#'" >spitshell
1083 chmod +x spitshell
1084 $eunicefix spitshell
1085 spitshell=`pwd`/spitshell
1086 cd UU
1087 echo "I presume that if # doesn't work, #! won't work either!"
1088 sharpbang=': use '
1089fi
1090rm -f try today
1091
1092: figure out how to guarantee sh startup
8ff267be 1093case "$startsh" in
1094'') startsh=${sharpbang}${sh} ;;
1095*)
760ac839 1096esac
760ac839
LW
1097cat >try <<EOSS
1098$startsh
1099set abc
1100test "$?abc" != 1
1101EOSS
1102
1103chmod +x try
1104$eunicefix try
1105if ./try; then
8ff267be 1106 : echo "Yup, it does."
760ac839 1107else
dfe9444c
AD
1108 echo "Hmm... '$startsh' does not guarantee sh startup..."
1109 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1110fi
1111rm -f try
1112
aebf16e7
AD
1113
1114: Save command line options in file UU/cmdline.opt for later use in
1115: generating config.sh.
1116cat > cmdline.opt <<EOSH
1117# Configure command line arguments.
1118config_arg0='$0'
1119config_args='$*'
1120config_argc=$#
1121EOSH
1122argn=1
1123for arg in "$@"; do
1124 cat >>cmdline.opt <<EOSH
1125config_arg$argn='$arg'
1126EOSH
1127 argn=`expr $argn + 1`
1128done
1129
2304df62
AD
1130: produce awk script to parse command line options
1131cat >options.awk <<'EOF'
1132BEGIN {
02e93a22 1133 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1134
1135 len = length(optstr);
1136 for (i = 1; i <= len; i++) {
1137 c = substr(optstr, i, 1);
1138 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1139 if (a == ":") {
1140 arg[c] = 1;
1141 i++;
1142 }
1143 opt[c] = 1;
1144 }
1145}
1146{
1147 expect = 0;
1148 str = $0;
1149 if (substr(str, 1, 1) != "-") {
1150 printf("'%s'\n", str);
1151 next;
1152 }
1153 len = length($0);
1154 for (i = 2; i <= len; i++) {
1155 c = substr(str, i, 1);
1156 if (!opt[c]) {
1157 printf("-%s\n", substr(str, i));
1158 next;
1159 }
1160 printf("-%s\n", c);
1161 if (arg[c]) {
1162 if (i < len)
1163 printf("'%s'\n", substr(str, i + 1));
1164 else
1165 expect = 1;
1166 next;
1167 }
1168 }
1169}
1170END {
1171 if (expect)
1172 print "?";
1173}
1174EOF
1175
1176: process the command line options
4633a7c4
LW
1177set X `for arg in "$@"; do echo "X$arg"; done |
1178 sed -e s/X// | awk -f options.awk`
2304df62
AD
1179eval "set $*"
1180shift
1181rm -f options.awk
1182
1183: set up default values
1184fastread=''
1185reuseval=false
1186config_sh=''
1187alldone=''
1188error=''
1189silent=''
1190extractsh=''
ecfc5424 1191override=''
16d20bd9 1192knowitall=''
02e93a22 1193rm -f optdef.sh posthint.sh
28757baa 1194cat >optdef.sh <<EOS
1195$startsh
1196EOS
2304df62 1197
dfe9444c 1198
2304df62
AD
1199: option parsing
1200while test $# -gt 0; do
1201 case "$1" in
1202 -d) shift; fastread=yes;;
1203 -e) shift; alldone=cont;;
1204 -f)
1205 shift
1206 cd ..
1207 if test -r "$1"; then
1208 config_sh="$1"
1209 else
a0d0e21e 1210 echo "$me: cannot read config file $1." >&2
2304df62
AD
1211 error=true
1212 fi
1213 cd UU
1214 shift;;
1215 -h) shift; error=true;;
1216 -r) shift; reuseval=true;;
dfe9444c 1217 -s) shift; silent=true; realsilent=true;;
2304df62 1218 -E) shift; alldone=exit;;
16d20bd9 1219 -K) shift; knowitall=true;;
ecfc5424 1220 -O) shift; override=true;;
dfe9444c 1221 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1222 -D)
1223 shift
1224 case "$1" in
1225 *=)
1226 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1227 echo "$me: ignoring -D $1" >&2
1228 ;;
ecfc5424 1229 *=*) echo "$1" | \
1aef975c
AD
1230 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1231 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1232 esac
1233 shift
1234 ;;
1235 -U)
1236 shift
1237 case "$1" in
1aef975c 1238 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1239 *=*)
1240 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1241 echo "$me: ignoring -U $1" >&2
1242 ;;
1aef975c 1243 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1244 esac
1245 shift
1246 ;;
02e93a22
JH
1247 -A)
1248 shift
1249 xxx=''
1250 yyy="$1"
02e93a22 1251 zzz=''
5f83a3e9 1252 uuu=undef
02e93a22 1253 case "$yyy" in
5f83a3e9
JH
1254 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1255 case "$zzz" in
1256 *:*) zzz='' ;;
1257 *) xxx=append
1258 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1259 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1260 esac
1261 ;;
1262 esac
1263 case "$xxx" in
1264 '') case "$yyy" in
1265 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1266 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1267 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1268 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1269 *) xxx=`echo $yyy|sed 's!:.*!!'`
1270 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1271 esac
1272 ;;
1273 esac
02e93a22
JH
1274 case "$xxx" in
1275 append)
5f83a3e9 1276 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1277 clear)
5f83a3e9 1278 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1279 define)
1280 case "$zzz" in
1281 '') zzz=define ;;
1282 esac
5f83a3e9 1283 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1284 eval)
5f83a3e9 1285 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1286 prepend)
5f83a3e9 1287 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1288 undef)
1289 case "$zzz" in
1290 '') zzz="$uuu" ;;
1291 esac
5f83a3e9
JH
1292 echo "$yyy=$zzz" >> posthint.sh ;;
1293 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1294 esac
bde6b06b 1295 shift
02e93a22 1296 ;;
dfe9444c 1297 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1298 exit 0;;
2304df62 1299 --) break;;
a0d0e21e 1300 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1301 *) break;;
1302 esac
1303done
1304
1305case "$error" in
1306true)
1307 cat >&2 <<EOM
2afac517 1308Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1309 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1310 -d : use defaults for all answers.
1311 -e : go on without questioning past the production of config.sh.
1312 -f : specify an alternate default configuration file.
1313 -h : print this help message and exit (with an error status).
1314 -r : reuse C symbols value if possible (skips costly nm extraction).
1315 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1316 -D : define symbol to have some value:
1317 -D symbol symbol gets the value 'define'
1318 -D symbol=value symbol gets the value 'value'
2304df62 1319 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1320 -K : do not use unless you know what you are doing.
ecfc5424 1321 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1322 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1323 -U : undefine symbol:
1324 -U symbol symbol gets the value 'undef'
1325 -U symbol= symbol gets completely empty
02e93a22 1326 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1327 -A symbol=value append " "value to symbol
02e93a22
JH
1328 -A append:symbol=value append value to symbol
1329 -A define:symbol=value define symbol to have value
02e93a22
JH
1330 -A clear:symbol define symbol to be ''
1331 -A define:symbol define symbol to be 'define'
1332 -A eval:symbol=value define symbol to be eval of value
1333 -A prepend:symbol=value prepend value to symbol
1334 -A undef:symbol define symbol to be 'undef'
1335 -A undef:symbol= define symbol to be ''
2304df62
AD
1336 -V : print version number and exit (with a zero status).
1337EOM
1338 exit 1
1339 ;;
1340esac
1341
dfe9444c
AD
1342: Sanity checks
1343case "$fastread$alldone" in
1344yescont|yesexit) ;;
1345*)
aaeb8e51
GS
1346 case "$extractsh" in
1347 true) ;;
1348 *)
1349 if test ! -t 0; then
1350 echo "Say 'sh Configure', not 'sh <Configure'"
1351 exit 1
1352 fi
1353 ;;
1354 esac
dfe9444c
AD
1355 ;;
1356esac
1357
2304df62
AD
1358exec 4>&1
1359case "$silent" in
1360true) exec 1>/dev/null;;
1361esac
1362
ecfc5424 1363: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1364touch optdef.sh
1365. ./optdef.sh
02e93a22
JH
1366: create the posthint manipulation script and leave the file out there...
1367touch posthint.sh
a0d0e21e 1368
2304df62 1369: set package name
85e6fe83 1370package=perl5
1aef975c
AD
1371first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1372last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1373case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1374ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1375*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1376esac
2304df62 1377
2304df62
AD
1378: Some greps do not return status, grrr.
1379echo "grimblepritz" >grimble
1380if grep blurfldyick grimble >/dev/null 2>&1 ; then
1381 contains=contains
1382elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1383 contains=grep
1384else
1385 contains=contains
1386fi
1387rm -f grimble
1388: the following should work in any shell
1389case "$contains" in
1390contains*)
1391 echo " "
1392 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1393 cat >contains <<'EOSS'
1394grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1395EOSS
1396chmod +x contains
1397esac
1398
dfe9444c
AD
1399: Find the path to the source tree
1400case "$src" in
1401'') case "$0" in
b233458b
JH
1402 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1403 case "$src" in
1404 /*) ;;
1405 *) src=`cd ../$src && pwd` ;;
1406 esac
1407 ;;
dfe9444c
AD
1408 *) src='.';;
1409 esac;;
1410esac
1411case "$src" in
1412'') src=/
1413 rsrc=/
1414 ;;
1415/*) rsrc="$src";;
1416*) rsrc="../$src";;
1417esac
1418if test -f $rsrc/Configure && \
1419 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1420then
1421 : found it, so we are ok.
1422else
1423 rsrc=''
1424 for src in . .. ../.. ../../.. ../../../..; do
1425 if test -f ../$src/Configure && \
1426 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1427 then
1428 rsrc=../$src
1429 break
1430 fi
1431 done
1432fi
1433case "$rsrc" in
1434'')
1435 cat <<EOM >&4
1436
1437Sorry, I can't seem to locate the source dir for $package. Please start
1438Configure with an explicit path -- i.e. /some/path/Configure.
1439
1440EOM
1441 exit 1
1442 ;;
1443../.) rsrc='..';;
1444*)
1445 echo " "
1446 echo "Sources for $package found in \"$src\"." >&4
1447 ;;
1448esac
1449
1450: script used to extract .SH files with variable substitutions
1451cat >extract <<'EOS'
2000072c 1452CONFIGDOTSH=true
dfe9444c
AD
1453echo "Doing variable substitutions on .SH files..."
1454if test -f $src/MANIFEST; then
f7ab18e9 1455 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1456else
1457 echo "(Looking for .SH files under the source directory.)"
1458 set x `(cd $src; find . -name "*.SH" -print)`
1459fi
1460shift
1461case $# in
14620) set x `(cd $src; echo *.SH)`; shift;;
1463esac
1464if test ! -f $src/$1; then
1465 shift
1466fi
1467mkdir_p='
1468name=$1;
1469create="";
1470while test $name; do
1471 if test ! -d "$name"; then
1472 create="$name $create";
1473 name=`echo $name | sed -e "s|^[^/]*$||"`;
1474 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1475 else
1476 name="";
1477 fi;
1478done;
1479for file in $create; do
1480 mkdir $file;
1481done
1482'
1483for file in $*; do
1484 case "$src" in
1485 ".")
1486 case "$file" in
1487 */*)
1488 dir=`expr X$file : 'X\(.*\)/'`
1489 file=`expr X$file : 'X.*/\(.*\)'`
1490 (cd $dir && . ./$file)
1491 ;;
1492 *)
1493 . ./$file
1494 ;;
1495 esac
1496 ;;
1497 *)
1498 case "$file" in
1499 */*)
1500 dir=`expr X$file : 'X\(.*\)/'`
1501 file=`expr X$file : 'X.*/\(.*\)'`
1502 (set x $dir; shift; eval $mkdir_p)
1503 sh <$src/$dir/$file
1504 ;;
1505 *)
1506 sh <$src/$file
1507 ;;
1508 esac
1509 ;;
1510 esac
1511done
1512if test -f $src/config_h.SH; then
1513 if test ! -f config.h; then
1514 : oops, they left it out of MANIFEST, probably, so do it anyway.
1515 . $src/config_h.SH
1516 fi
1517fi
1518EOS
1519
1520: extract files and exit if asked to do so
1521case "$extractsh" in
1522true)
1523 case "$realsilent" in
1524 true) ;;
1525 *) exec 1>&4;;
1526 esac
1527 case "$config_sh" in
1528 '') config_sh='config.sh';;
1529 esac
1530 echo " "
1531 echo "Fetching answers from $config_sh..."
1532 cd ..
1533 . $config_sh
1534 test "$override" && . ./optdef.sh
1535 echo " "
1536 . UU/extract
1537 rm -rf UU
1538 echo "Done."
1539 exit 0
1540 ;;
1541esac
1542
1543: Eunice requires " " instead of "", can you believe it
1544echo " "
1545: Here we go...
1546echo "Beginning of configuration questions for $package."
1547
1548trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1549
2304df62
AD
1550: first determine how to suppress newline on echo command
1551echo " "
1552echo "Checking echo to see how to suppress newlines..."
1553(echo "hi there\c" ; echo " ") >.echotmp
1554if $contains c .echotmp >/dev/null 2>&1 ; then
1555 echo "...using -n."
1556 n='-n'
1557 c=''
1558else
1559 cat <<'EOM'
1560...using \c
1561EOM
1562 n=''
1563 c='\c'
1564fi
1565echo $n "The star should be here-->$c"
1566echo '*'
1567rm -f .echotmp
1568
1569: Now test for existence of everything in MANIFEST
1570echo " "
dfe9444c 1571if test -f $rsrc/MANIFEST; then
2304df62 1572 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1573 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1574 rm -f missing
dfe9444c 1575 tmppwd=`pwd`
2304df62 1576 for filelist in x??; do
dfe9444c 1577 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1578 done
1579 if test -s missing; then
1580 cat missing >&4
1581 cat >&4 <<'EOM'
1582
1583THIS PACKAGE SEEMS TO BE INCOMPLETE.
1584
1585You have the option of continuing the configuration process, despite the
1586distinct possibility that your kit is damaged, by typing 'y'es. If you
1587do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1588and contact the author (perlbug@perl.com).
2304df62
AD
1589
1590EOM
1591 echo $n "Continue? [n] $c" >&4
1592 read ans
1593 case "$ans" in
1594 y*)
1595 echo "Continuing..." >&4
1596 rm -f missing
1597 ;;
1598 *)
1599 echo "ABORTING..." >&4
1600 kill $$
1601 ;;
1602 esac
1603 else
dfe9444c 1604 echo "Looks good..."
2304df62
AD
1605 fi
1606else
1607 echo "There is no MANIFEST file. I hope your kit is complete !"
1608fi
1609rm -f missing x??
1610
5ff3f7a4
GS
1611echo " "
1612: Find the appropriate value for a newline for tr
1613if test -n "$DJGPP"; then
1614 trnl='\012'
1615fi
1616if test X"$trnl" = X; then
1617 case "`echo foo|tr '\n' x 2>/dev/null`" in
1618 foox) trnl='\n' ;;
1619 esac
1620fi
1621if test X"$trnl" = X; then
1622 case "`echo foo|tr '\012' x 2>/dev/null`" in
1623 foox) trnl='\012' ;;
1624 esac
1625fi
1626if test X"$trnl" = X; then
1627 cat <<EOM >&2
1628
1629$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1630
1631EOM
1632 exit 1
1633fi
1634
2304df62
AD
1635: compute the number of columns on the terminal for proper question formatting
1636case "$COLUMNS" in
1637'') COLUMNS='80';;
1638esac
1639
1640: set up the echo used in my read
1641myecho="case \"\$xxxm\" in
1642'') echo $n \"\$rp $c\" >&4;;
1643*) case \"\$rp\" in
1644 '') echo $n \"[\$xxxm] $c\";;
1645 *)
1646 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1647 echo \"\$rp\" >&4
1648 echo $n \"[\$xxxm] $c\" >&4
1649 else
1650 echo $n \"\$rp [\$xxxm] $c\" >&4
1651 fi
1652 ;;
1653 esac;;
1654esac"
1655
1656: now set up to do reads with possible shell escape and default assignment
1657cat <<EOSC >myread
28757baa 1658$startsh
2304df62
AD
1659xxxm=\$dflt
1660$myecho
1661ans='!'
1662case "\$fastread" in
1663yes) case "\$dflt" in
1664 '') ;;
1665 *) ans='';
1666 case "\$silent-\$rp" in
1667 true-) ;;
1668 *) echo " " >&4;;
1669 esac;;
1670 esac;;
1671*) case "\$silent" in
1672 true) case "\$rp" in
1673 '') ans='';;
1674 esac;;
1675 esac;;
1676esac
1677while expr "X\$ans" : "X!" >/dev/null; do
1678 read answ
1679 set x \$xxxm
1680 shift
dfe9444c 1681 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1682 case "\$answ" in
dfe9444c
AD
1683 "!")
1684 sh 1>&4
1685 echo " "
1686 $myecho
1687 ;;
1688 !*)
1689 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1690 shift
1691 sh 1>&4 -c "\$*"
1692 echo " "
1693 $myecho
1694 ;;
2304df62
AD
1695 "\$ans")
1696 case "\$ans" in
ecfc5424
AD
1697 \\&*)
1698 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1699 shift
1700 case "\$1" in
1701 -d)
1702 fastread=yes
40a7a20a 1703 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1704 ;;
1705 -*)
40a7a20a 1706 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1707 ;;
1708 esac
1709 $myecho
1710 ans=!
1711 ;;
2304df62
AD
1712 esac;;
1713 *)
1714 case "\$aok" in
1715 y)
1716 echo "*** Substitution done -- please confirm."
1717 xxxm="\$ans"
c9795ab7 1718 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1719 xxxm="\$ans"
1720 ans=!
1721 ;;
1722 *)
1723 echo "*** Error -- try again."
1724 ans=!
1725 ;;
1726 esac
1727 $myecho
1728 ;;
1729 esac
1730 case "\$ans\$xxxm\$nostick" in
1731 '')
1732 ans=!
1733 $myecho
1734 ;;
1735 esac
1736done
1737case "\$ans" in
1738'') ans="\$xxxm";;
1739esac
1740EOSC
1741
1742: create .config dir to save info across Configure sessions
1743test -d ../.config || mkdir ../.config
1744cat >../.config/README <<EOF
1745This directory created by Configure to save information that should
dfe9444c 1746persist across sessions for $package.
2304df62
AD
1747
1748You may safely delete it if you wish.
1749EOF
1750
1751: general instructions
1752needman=true
1753firsttime=true
760ac839 1754user=`(logname) 2>/dev/null`
dfe9444c
AD
1755case "$user" in
1756'') user=`whoami 2>&1`;;
760ac839 1757esac
2304df62
AD
1758if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1759 firsttime=false
1760 echo " "
1761 rp='Would you like to see the instructions?'
1762 dflt=n
1763 . ./myread
1764 case "$ans" in
1765 [yY]*) ;;
1766 *) needman=false;;
1767 esac
1768fi
1769if $needman; then
1770 cat <<EOH
4e2a5f63 1771
2304df62 1772This installation shell script will examine your system and ask you questions
a0d0e21e 1773to determine how the perl5 package should be installed. If you get
2304df62
AD
1774stuck on a question, you may use a ! shell escape to start a subshell or
1775execute a command. Many of the questions will have default answers in square
1776brackets; typing carriage return will give you the default.
1777
1778On some of the questions which ask for file or directory names you are allowed
1779to use the ~name construct to specify the login directory belonging to "name",
1780even if you don't have a shell which knows about that. Questions where this is
1781allowed will be marked "(~name ok)".
1782
1783EOH
1784 rp=''
1785 dflt='Type carriage return to continue'
1786 . ./myread
1787 cat <<'EOH'
1788
1789The prompter used in this script allows you to use shell variables and
1790backticks in your answers. You may use $1, $2, etc... to refer to the words
1791in the default answer, as if the default line was a set of arguments given to a
1792script shell. This means you may also use $* to repeat the whole default line,
1793so you do not have to re-type everything to add something to the default.
1794
1795Everytime there is a substitution, you will have to confirm. If there is an
1796error (e.g. an unmatched backtick), the default answer will remain unchanged
1797and you will be prompted again.
1798
1799If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1800the questions and use the computed defaults (or the previous answers if there
1801was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1802You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1803on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1804
1805EOH
1806 . ./myread
1807 cat <<EOH
1808
1809Much effort has been expended to ensure that this shell script will run on any
1810Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1811Configure and run it again. If you can't run Configure for some reason,
1812you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1813have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1814
1815This installation script affects things in two ways:
1816
18171) it may do direct variable substitutions on some of the files included
1818 in this kit.
18192) it builds a config.h file for inclusion in C programs. You may edit
1820 any of these files as the need arises after running this script.
1821
1822If you make a mistake on a question, there is no easy way to back up to it
1823currently. The easiest thing to do is to edit config.sh and rerun all the SH
1824files. Configure will offer to let you do this before it runs the SH files.
1825
1826EOH
1827 dflt='Type carriage return to continue'
1828 . ./myread
1829 case "$firsttime" in
1830 true) echo $user >>../.config/instruct;;
1831 esac
1832fi
1833
2304df62
AD
1834: find out where common programs are
1835echo " "
1836echo "Locating common programs..." >&4
1837cat <<EOSC >loc
1838$startsh
1839case \$# in
18400) exit 1;;
1841esac
1842thing=\$1
1843shift
1844dflt=\$1
1845shift
1846for dir in \$*; do
1847 case "\$thing" in
1848 .)
1849 if test -d \$dir/\$thing; then
1850 echo \$dir
1851 exit 0
1852 fi
1853 ;;
1854 *)
a0d0e21e 1855 for thisthing in \$dir/\$thing; do
ecfc5424 1856 : just loop through to pick last item
a0d0e21e 1857 done
25f94b33 1858 if test -f \$thisthing; then
a0d0e21e 1859 echo \$thisthing
2304df62
AD
1860 exit 0
1861 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1862 if test -n "$DJGPP"; then
1863 echo \$dir/\$thing.exe
1864 else
1865 : on Eunice apparently
1866 echo \$dir/\$thing
1867 fi
2304df62
AD
1868 exit 0
1869 fi
1870 ;;
1871 esac
1872done
1873echo \$dflt
1874exit 1
1875EOSC
1876chmod +x loc
1877$eunicefix loc
1878loclist="
1879awk
1880cat
ecfc5424 1881comm
2304df62
AD
1882cp
1883echo
1884expr
1885grep
a0d0e21e 1886ls
dfe9444c 1887make
2304df62 1888mkdir
2304df62
AD
1889rm
1890sed
1891sort
85e6fe83 1892touch
2304df62
AD
1893tr
1894uniq
1895"
1896trylist="
1897Mcc
dfe9444c 1898ar
2304df62
AD
1899byacc
1900cpp
1901csh
1902date
1903egrep
8ff267be 1904gzip
2c7991dc 1905less
8ff267be 1906ln
2c7991dc 1907more
693762b4 1908nm
2304df62 1909nroff
2c7991dc 1910pg
2304df62
AD
1911test
1912uname
8ff267be 1913zip
2304df62 1914"
8e07c86e 1915pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1916pth="$pth /lib /usr/lib"
1917for file in $loclist; do
dfe9444c
AD
1918 eval xxx=\$$file
1919 case "$xxx" in
1920 /*|?:[\\/]*)
1921 if test -f "$xxx"; then
1922 : ok
1923 else
1924 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1925 xxx=`./loc $file $file $pth`
1926 fi
1927 ;;
1928 '') xxx=`./loc $file $file $pth`;;
1929 *) xxx=`./loc $xxx $xxx $pth`;;
1930 esac
2304df62
AD
1931 eval $file=$xxx
1932 eval _$file=$xxx
1933 case "$xxx" in
1934 /*)
1935 echo $file is in $xxx.
1936 ;;
8e07c86e
AD
1937 ?:[\\/]*)
1938 echo $file is in $xxx.
1939 ;;
2304df62 1940 *)
25f94b33
AD
1941 echo "I don't know where '$file' is, and my life depends on it." >&4
1942 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1943 exit 1
2304df62
AD
1944 ;;
1945 esac
1946done
1947echo " "
1948echo "Don't worry if any of the following aren't found..."
1949say=offhand
1950for file in $trylist; do
dfe9444c
AD
1951 eval xxx=\$$file
1952 case "$xxx" in
1953 /*|?:[\\/]*)
1954 if test -f "$xxx"; then
1955 : ok
1956 else
1957 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1958 xxx=`./loc $file $file $pth`
1959 fi
1960 ;;
1961 '') xxx=`./loc $file $file $pth`;;
1962 *) xxx=`./loc $xxx $xxx $pth`;;
1963 esac
2304df62
AD
1964 eval $file=$xxx
1965 eval _$file=$xxx
1966 case "$xxx" in
1967 /*)
1968 echo $file is in $xxx.
1969 ;;
8e07c86e
AD
1970 ?:[\\/]*)
1971 echo $file is in $xxx.
1972 ;;
2304df62
AD
1973 *)
1974 echo "I don't see $file out there, $say."
1975 say=either
1976 ;;
1977 esac
1978done
1979case "$egrep" in
1980egrep)
1981 echo "Substituting grep for egrep."
1982 egrep=$grep
1983 ;;
1984esac
8ff267be 1985case "$ln" in
1986ln)
1987 echo "Substituting cp for ln."
1988 ln=$cp
1989 ;;
1990esac
2304df62
AD
1991case "$test" in
1992test)
1993 echo "Hopefully test is built into your sh."
1994 ;;
1995*)
ecfc5424 1996 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1997 echo "Using the test built into your sh."
1998 test=test
1999 _test=test
2000 fi
2001 ;;
2002esac
2003case "$echo" in
2004echo)
2005 echo "Hopefully echo is built into your sh."
2006 ;;
2007'') ;;
2008*)
2009 echo " "
2010echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2011 $echo $n "hi there$c" >foo1
2012 echo $n "hi there$c" >foo2
2013 if cmp foo1 foo2 >/dev/null 2>&1; then
2014 echo "They are compatible. In fact, they may be identical."
2015 else
2016 case "$n" in
2017 '-n') n='' c='\c';;
2018 *) n='-n' c='';;
2019 esac
2020 cat <<FOO
2021They are not compatible! You are probably running ksh on a non-USG system.
2022I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2023have echo built in and we may have to run some Bourne shell scripts. That
2024means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2025
2026FOO
2027 $echo $n "The star should be here-->$c"
2028 $echo "*"
2029 fi
2030 $rm -f foo1 foo2
2031 ;;
2032esac
2033
a0d0e21e
LW
2034: determine whether symbolic links are supported
2035echo " "
2036$touch blurfl
2037if $ln -s blurfl sym > /dev/null 2>&1 ; then
2038 echo "Symbolic links are supported." >&4
2039 lns="$ln -s"
2040else
2041 echo "Symbolic links are NOT supported." >&4
2042 lns="$ln"
2043fi
2044$rm -f blurfl sym
2045
ecfc5424
AD
2046: see whether [:lower:] and [:upper:] are supported character classes
2047echo " "
ecfc5424
AD
2048case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2049ABYZ)
2050 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2051 up='[:upper:]'
2052 low='[:lower:]'
2053 ;;
28e8609d
JH
2054*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2055 # (0xc9 and 0xd1), therefore that is a nice testing point.
2056 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2057 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2058 ij) up='[A-Z]'
2059 low='[a-z]'
2060 ;;
2061 esac
2062 fi
2063 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2064 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2065 ij) up='A-Z'
2066 low='a-z'
2067 ;;
2068 esac
2069 fi
2070 if test "X$up" = X -o "X$low" = X; then
2071 case "`echo IJ | od -x 2>/dev/null`" in
2072 *C9D1*|*c9d1*)
2073 echo "Hey, this might be EBCDIC." >&4
2074 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2075 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2076 ij) up='[A-IJ-RS-Z]'
2077 low='[a-ij-rs-z]'
2078 ;;
2079 esac
2080 fi
2081 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2082 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2083 ij) up='A-IJ-RS-Z'
2084 low='a-ij-rs-z'
2085 ;;
2086 esac
2087 fi
2088 ;;
2089 esac
2090 fi
2091esac
3eaeeeae 2092case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2093ij)
2094 echo "Using $up and $low to convert case." >&4
2095 ;;
ecfc5424 2096*)
28e8609d
JH
2097 echo "I don't know how to translate letters from upper to lower case." >&4
2098 echo "Your tr is not acting any way I know of." >&4
2099 exit 1
2100 ;;
ecfc5424
AD
2101esac
2102: set up the translation script tr, must be called with ./tr of course
2103cat >tr <<EOSC
2104$startsh
2105case "\$1\$2" in
2106'[A-Z][a-z]') exec $tr '$up' '$low';;
2107'[a-z][A-Z]') exec $tr '$low' '$up';;
2108esac
2109exec $tr "\$@"
2110EOSC
2111chmod +x tr
2112$eunicefix tr
2113
2304df62
AD
2114: Try to determine whether config.sh was made on this system
2115case "$config_sh" in
2116'')
43999f95
JH
2117myuname=`$uname -a 2>/dev/null`
2118$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2119# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2120# because the A-Z/a-z are not consecutive.
a0d0e21e 2121myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2122 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2123newmyuname="$myuname"
2304df62 2124dflt=n
16d20bd9
AD
2125case "$knowitall" in
2126'')
2127 if test -f ../config.sh; then
2128 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2129 eval "`grep myuname= ../config.sh`"
2130 fi
2131 if test "X$myuname" = "X$newmyuname"; then
2132 dflt=y
2133 fi
2304df62 2134 fi
16d20bd9
AD
2135 ;;
2136*) dflt=y;;
2137esac
2304df62
AD
2138
2139: Get old answers from old config file if Configure was run on the
2140: same system, otherwise use the hints.
2141hint=default
2142cd ..
2143if test -f config.sh; then
16d20bd9
AD
2144 echo " "
2145 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2146 . UU/myread
2147 case "$ans" in
2148 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2149 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2150 tmp_n="$n"
2151 tmp_c="$c"
85cad39c 2152 tmp_sh="$sh"
2304df62
AD
2153 . ./config.sh
2154 cp config.sh UU
ecfc5424
AD
2155 n="$tmp_n"
2156 c="$tmp_c"
85cad39c 2157 : Older versions did not always set $sh. Catch re-use of such
2158 : an old config.sh.
2159 case "$sh" in
2160 '') sh="$tmp_sh" ;;
2161 esac
2304df62
AD
2162 hint=previous
2163 ;;
2164 esac
2165fi
2166if test ! -f config.sh; then
2167 $cat <<EOM
2168
4e2a5f63
AD
2169First time through, eh? I have some defaults handy for some systems
2170that need some extra help getting the Configure answers right:
2304df62
AD
2171
2172EOM
dfe9444c 2173 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2174 dflt=''
2175 : Half the following guesses are probably wrong... If you have better
46193409 2176 : tests or hints, please send them to perlbug@perl.com
2304df62 2177 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2178 $test -f /irix && osname=irix
85e6fe83
LW
2179 $test -f /xenix && osname=sco_xenix
2180 $test -f /dynix && osname=dynix
2181 $test -f /dnix && osname=dnix
5f05dabc 2182 $test -f /lynx.os && osname=lynxos
2183 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2184 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2185 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2186 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2187 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2188 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2189 $test -d /usr/apollo/bin && osname=apollo
2190 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2191 $test -d /usr/include/minix && osname=minix
e060872b 2192 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2193 osname=machten
4633a7c4 2194 if $test -x /sbin/version; then
dfe9444c 2195 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2196 $sed -e 's/[A-Za-z]$//'`
2197 elif $test -x /usr/etc/version; then
dfe9444c 2198 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2199 $sed -e 's/[A-Za-z]$//'`
2200 else
2201 osvers="$2.$3"
2202 fi
2203 fi
aaacdc8b
GS
2204
2205 $test -f /sys/posix.dll &&
2206 $test -f /usr/bin/what &&
2207 set X `/usr/bin/what /sys/posix.dll` &&
2208 $test "$3" = UWIN &&
2209 osname=uwin &&
2210 osvers="$5"
2211
2304df62
AD
2212 if $test -f $uname; then
2213 set X $myuname
2214 shift
2215
2304df62 2216 case "$5" in
85e6fe83 2217 fps*) osname=fps ;;
2304df62
AD
2218 mips*)
2219 case "$4" in
85e6fe83
LW
2220 umips) osname=umips ;;
2221 *) osname=mips ;;
2304df62 2222 esac;;
85e6fe83
LW
2223 [23]100) osname=mips ;;
2224 next*) osname=next ;;
ecfc5424 2225 i386*)
c6912327
JH
2226 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2227 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2228 osname='sco'
2229 osvers=$tmp
2230 elif $test -f /etc/kconfig; then
ecfc5424 2231 osname=isc
bd628c73 2232 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2233 osvers=4
2234 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2235 osvers=3
2304df62 2236 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2237 osvers=2
ecfc5424
AD
2238 fi
2239 fi
2000072c 2240 tmp=''
ecfc5424 2241 ;;
c4f23d77
AD
2242 pc*)
2243 if test -n "$DJGPP"; then
2244 osname=dos
2245 osvers=djgpp
2246 fi
2247 ;;
2304df62
AD
2248 esac
2249
2250 case "$1" in
a0d0e21e
LW
2251 aix) osname=aix
2252 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2253 case "$tmp" in
1aef975c 2254 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2255 '<3240'|'<>3240') osvers=3.2.0 ;;
2256 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2257 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2258 *) osvers=$tmp;;
a0d0e21e
LW
2259 esac
2260 ;;
aaacdc8b
GS
2261 bsd386) osname=bsd386
2262 osvers=`$uname -r`
2263 ;;
2264 cygwin*) osname=cygwin
2265 osvers="$3"
2266 ;;
23f87696
SZ
2267 *dc.osx) osname=dcosx
2268 osvers="$3"
2269 ;;
a0d0e21e
LW
2270 dnix) osname=dnix
2271 osvers="$3"
2272 ;;
2273 domainos) osname=apollo
2274 osvers="$3"
2275 ;;
2276 dgux) osname=dgux
2277 osvers="$3"
2278 ;;
760ac839 2279 dynixptx*) osname=dynixptx
e58e581d 2280 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2281 ;;
a0d0e21e
LW
2282 freebsd) osname=freebsd
2283 osvers="$3" ;;
2284 genix) osname=genix ;;
2285 hp*) osname=hpux
bfb7748a 2286 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2287 ;;
a78b0d02 2288 irix*) osname=irix
a0d0e21e
LW
2289 case "$3" in
2290 4*) osvers=4 ;;
2291 5*) osvers=5 ;;
ecfc5424 2292 *) osvers="$3" ;;
a0d0e21e
LW
2293 esac
2294 ;;
2295 linux) osname=linux
2296 case "$3" in
a0d0e21e
LW
2297 *) osvers="$3" ;;
2298 esac
2299 ;;
28e8609d
JH
2300 MiNT) osname=mint
2301 ;;
2302 netbsd*) osname=netbsd
ecfc5424
AD
2303 osvers="$3"
2304 ;;
4e81affe
MM
2305 news-os) osvers="$3"
2306 case "$3" in
2307 4*) osname=newsos4 ;;
2308 *) osname=newsos ;;
2309 esac
2310 ;;
aaacdc8b
GS
2311 next*) osname=next ;;
2312 POSIX-BC | posix-bc ) osname=posix-bc
2313 osvers="$3"
a0d0e21e 2314 ;;
ae3afa4e
TH
2315 powerux | power_ux | powermax_os | powermaxos | \
2316 powerunix | power_unix) osname=powerux
2317 osvers="$3"
2318 ;;
aaacdc8b
GS
2319 qnx) osname=qnx
2320 osvers="$4"
2321 ;;
a0d0e21e
LW
2322 solaris) osname=solaris
2323 case "$3" in
2324 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2325 *) osvers="$3" ;;
a0d0e21e
LW
2326 esac
2327 ;;
85e6fe83
LW
2328 sunos) osname=sunos
2329 case "$3" in
85e6fe83
LW
2330 5*) osname=solaris
2331 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2332 *) osvers="$3" ;;
2304df62
AD
2333 esac
2334 ;;
a0d0e21e 2335 titanos) osname=titanos
85e6fe83 2336 case "$3" in
a0d0e21e
LW
2337 1*) osvers=1 ;;
2338 2*) osvers=2 ;;
2339 3*) osvers=3 ;;
2340 4*) osvers=4 ;;
ecfc5424 2341 *) osvers="$3" ;;
2304df62
AD
2342 esac
2343 ;;
85e6fe83 2344 ultrix) osname=ultrix
ecfc5424 2345 osvers="$3"
2304df62 2346 ;;
28757baa 2347 osf1|mls+) case "$5" in
fed7345c
AD
2348 alpha)
2349 osname=dec_osf
313489a2 2350 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2351 ;;
2352 hp*) osname=hp_osf1 ;;
2353 mips) osname=mips_osf1 ;;
85e6fe83
LW
2354 esac
2355 ;;
0337d152
BG
2356 unixware) osname=svr5
2357 osvers="$4"
2358 ;;
2359 uts) osname=uts
a0d0e21e
LW
2360 osvers="$3"
2361 ;;
85e6fe83 2362 $2) case "$osname" in
2304df62 2363 *isc*) ;;
a0d0e21e 2364 *freebsd*) ;;
5f05dabc 2365 svr*)
a0d0e21e
LW
2366 : svr4.x or possibly later
2367 case "svr$3" in
2368 ${osname}*)
2369 osname=svr$3
2370 osvers=$4
2371 ;;
2372 esac
2373 case "$osname" in
2374 svr4.0)
2375 : Check for ESIX
2376 if test -f /stand/boot ; then
2377 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2378 if test -n "$INITPROG" -a -f "$INITPROG"; then
2379 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2380 if test -n "$isesix"; then
a0d0e21e
LW
2381 osname=esix4
2382 fi
2383 fi
2384 fi
2385 ;;
2386 esac
2387 ;;
2304df62 2388 *) if test -f /etc/systemid; then
a0d0e21e
LW
2389 osname=sco
2390 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2391 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2392 osvers=$1.$2.$3
c4f23d77 2393 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2394 osvers=$1.$2
c4f23d77 2395 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2396 osvers=$1
2304df62 2397 fi
a0d0e21e
LW
2398 else
2399 case "$osname" in
2400 '') : Still unknown. Probably a generic Sys V.
2401 osname="sysv"
2402 osvers="$3"
2403 ;;
2404 esac
2304df62
AD
2405 fi
2406 ;;
2407 esac
2408 ;;
a0d0e21e
LW
2409 *) case "$osname" in
2410 '') : Still unknown. Probably a generic BSD.
2411 osname="$1"
2412 osvers="$3"
2413 ;;
2414 esac
2415 ;;
2304df62
AD
2416 esac
2417 else
dfe9444c
AD
2418 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2419 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2420 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2421 osname=news_os
2304df62 2422 fi
dfe9444c 2423 $rm -f UU/kernel.what
8e07c86e
AD
2424 elif test -d c:/.; then
2425 set X $myuname
2426 osname=os2
2427 osvers="$5"
2304df62
AD
2428 fi
2429 fi
85e6fe83 2430
a0d0e21e
LW
2431 : Now look for a hint file osname_osvers, unless one has been
2432 : specified already.
2433 case "$hintfile" in
2434 ''|' ')
1e127011 2435 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2436 : Also try without trailing minor version numbers.
1e127011
DD
2437 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2438 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2439 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2440 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2441 case "$file" in
2442 '') dflt=none ;;
2443 *) case "$osvers" in
2444 '') dflt=$file
2445 ;;
dfe9444c 2446 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2447 dflt=$file
dfe9444c 2448 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2449 dflt=$xfile
dfe9444c 2450 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2451 dflt=$xxfile
dfe9444c 2452 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2453 dflt=$xxxfile
dfe9444c 2454 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2455 dflt=$xxxxfile
dfe9444c 2456 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2457 dflt="${osname}"
2458 else
2459 dflt=none
2460 fi
2461 ;;
2462 esac
85e6fe83
LW
2463 ;;
2464 esac
4e2a5f63
AD
2465 if $test -f Policy.sh ; then
2466 case "$dflt" in
2467 *Policy*) ;;
2468 none) dflt="Policy" ;;
2469 *) dflt="Policy $dflt" ;;
2470 esac
2471 fi
85e6fe83 2472 ;;
a0d0e21e 2473 *)
ecfc5424 2474 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2475 ;;
2304df62 2476 esac
1aef975c 2477
4e2a5f63
AD
2478 if $test -f Policy.sh ; then
2479 $cat <<EOM
2480
2481There's also a Policy hint file available, which should make the
2482site-specific (policy) questions easier to answer.
2483EOM
2484
2485 fi
2486
2304df62
AD
2487 $cat <<EOM
2488
2489You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2490A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2491is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2492
2493EOM
4e2a5f63 2494
2304df62 2495 rp="Which of these apply, if any?"
dfe9444c 2496 . UU/myread
85e6fe83
LW
2497 tans=$ans
2498 for file in $tans; do
4e2a5f63
AD
2499 if $test X$file = XPolicy -a -f Policy.sh; then
2500 . Policy.sh
2501 $cat Policy.sh >> UU/config.sh
2502 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2503 . $src/hints/$file.sh
2504 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2505 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2506 : nothing
2507 else
85e6fe83
LW
2508 : Give one chance to correct a possible typo.
2509 echo "$file.sh does not exist"
2510 dflt=$file
2511 rp="hint to use instead?"
dfe9444c 2512 . UU/myread
85e6fe83 2513 for file in $ans; do
dfe9444c
AD
2514 if $test -f "$src/hints/$file.sh"; then
2515 . $src/hints/$file.sh
2516 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2517 elif $test X$ans = X -o X$ans = Xnone ; then
2518 : nothing
2519 else
2520 echo "$file.sh does not exist -- ignored."
2521 fi
2522 done
2304df62
AD
2523 fi
2524 done
85e6fe83 2525
2304df62 2526 hint=recommended
85e6fe83 2527 : Remember our hint file for later.
dfe9444c 2528 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2529 hintfile="$file"
85e6fe83 2530 else
a0d0e21e 2531 hintfile=''
85e6fe83 2532 fi
2304df62
AD
2533fi
2534cd UU
2535;;
2536*)
2537 echo " "
2538 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2539 tmp_n="$n"
2540 tmp_c="$c"
2304df62
AD
2541 cd ..
2542 cp $config_sh config.sh 2>/dev/null
a78b0d02 2543 chmod +w config.sh
2304df62
AD
2544 . ./config.sh
2545 cd UU
2546 cp ../config.sh .
ecfc5424
AD
2547 n="$tmp_n"
2548 c="$tmp_c"
2304df62
AD
2549 hint=previous
2550 ;;
2551esac
1aef975c
AD
2552test "$override" && . ./optdef.sh
2553myuname="$newmyuname"
2304df62
AD
2554
2555: Restore computed paths
2556for file in $loclist $trylist; do
2557 eval $file="\$_$file"
2558done
2559
85e6fe83 2560cat << EOM
a0d0e21e 2561
85e6fe83 2562Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2563The default value is probably right if the name rings a bell. Otherwise,
2564since spelling matters for me, either accept the default or answer "none"
2565to leave it blank.
a0d0e21e 2566
85e6fe83 2567EOM
85e6fe83 2568case "$osname" in
a0d0e21e 2569 ''|' ')
85e6fe83 2570 case "$hintfile" in
a0d0e21e 2571 ''|' '|none) dflt=none ;;
ecfc5424 2572 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2573 esac
2574 ;;
2575 *) dflt="$osname" ;;
2576esac
2577rp="Operating system name?"
2578. ./myread
2579case "$ans" in
ecfc5424
AD
2580none) osname='' ;;
2581*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2582esac
8ff267be 2583echo " "
2584case "$osvers" in
2585 ''|' ')
2586 case "$hintfile" in
2587 ''|' '|none) dflt=none ;;
2588 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2589 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2590 case "$dflt" in
2591 ''|' ') dflt=none ;;
2592 esac
2593 ;;
2594 esac
2595 ;;
2596 *) dflt="$osvers" ;;
2597esac
2598rp="Operating system version?"
2599. ./myread
2600case "$ans" in
2601none) osvers='' ;;
2602*) osvers="$ans" ;;
2603esac
2604
02e93a22
JH
2605
2606. ./posthint.sh
2607
2304df62 2608: who configured the system
59b83a6f 2609cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2610cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2611case "$cf_by" in
2612"")
8ff267be 2613 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2614 case "$cf_by" in
2615 "") cf_by=unknown ;;
8ff267be 2616 esac ;;
2617esac
2304df62 2618
dfe9444c
AD
2619: set up the script used to warn in case of inconsistency
2620cat <<EOS >whoa
2621$startsh
2622EOS
2623cat <<'EOSC' >>whoa
2624dflt=y
2625echo " "
2626echo "*** WHOA THERE!!! ***" >&4
2627echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2628rp=" Keep the $hint value?"
2629. ./myread
2630case "$ans" in
2631y) td=$was; tu=$was;;
2632esac
2633EOSC
2634
2635: function used to set $1 to $val
2636setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2637case "$val$was" in
2638$define$undef) . ./whoa; eval "$var=\$td";;
2639$undef$define) . ./whoa; eval "$var=\$tu";;
2640*) eval "$var=$val";;
2641esac'
2642
0f0995ae
JH
2643case "$usethreads" in
2644$define|true|[yY]*) dflt='y';;
2645*) dflt='n';;
2646esac
64e689dc
JH
2647cat <<EOM
2648
3645a519 2649Perl can be built to take advantage of threads on some systems.
0f0995ae 2650To do so, Configure can be run with -Dusethreads.
d00b958f
JH
2651
2652Note that threading is a highly experimental feature, and
2653some known race conditions still remain. If you choose to try
2654it, be very sure to not actually deploy it for production
2655purposes. README.threads has more details, and is required
2656reading if you enable threads.
0f0995ae
JH
2657
2658If this doesn't make any sense to you, just accept the default '$dflt'.
64e689dc 2659EOM
64e689dc
JH
2660rp='Build a threading Perl?'
2661. ./myread
2662case "$ans" in
aaacdc8b 2663y|Y) val="$define" ;;
64e689dc 2664*) val="$undef" ;;
dfe9444c 2665esac
64e689dc 2666set usethreads
aaacdc8b
GS
2667eval $setvar
2668
2669case "$usethreads" in
2670$define)
2671 $cat <<EOM
2672
ff42dc34 2673As of 5.5.640, Perl has two different internal threading implementations,
aaacdc8b
GS
2674the 5.005 version (5005threads) and an interpreter-based version
2675(ithreads) that has one interpreter per thread. Both are very
2676experimental. This arrangement exists to help developers work out
2677which one is better.
3645a519
JH
2678
2679If you're a casual user, you probably don't want interpreter-threads
2680at this time. There doesn't yet exist a way to create threads from
2681within Perl in this model, i.e., "use Thread;" will NOT work.
aaacdc8b
GS
2682EOM
2683 : Default to ithreads unless overridden on command line or with
2684 : old config.sh
2685 dflt='y'
2686 case "$use5005threads" in
2687 $define|true|[yY]*) dflt='n';;
2688 esac
2689 case "$useithreads" in
2690 $undef|false|[nN]*) dflt='n';;
2691 esac
2692 rp='Use interpreter-based ithreads?'
2693 . ./myread
2694 case "$ans" in
2695 y|Y) val="$define" ;;
2696 *) val="$undef" ;;
2697 esac
2698 set useithreads
2699 eval $setvar
2700 : Now set use5005threads to the opposite value.
2701 case "$useithreads" in
2702 $define) val="$undef" ;;
2703 *) val="$define" ;;
2704 esac
2705 set use5005threads
2706 eval $setvar
2707 ;;
2708*)
2709 useithreads="$undef"
2710 use5005threads="$undef"
2711 ;;
2712esac
104d25b7 2713
693762b4
AD
2714case "$d_oldpthreads" in
2715'') : Configure tests would be welcome here. For now, assume undef.
2716 val="$undef" ;;
2717*) val="$d_oldpthreads" ;;
2718esac
2719set d_oldpthreads
2720eval $setvar
dfe9444c 2721
b691c02f
JH
2722
2723case "$usethreads" in
104d25b7
JH
2724"$define"|true|[yY]*)
2725: Look for a hint-file generated 'call-back-unit'. If the
2726: user has specified that a threading perl is to be built,
2727: we may need to set or change some other defaults.
2728 if $test -f usethreads.cbu; then
e5e20432 2729 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2730 . ./usethreads.cbu
e5e20432
JH
2731 else
2732 $cat <<EOM
2733(Your platform doesn't have any specific hints for threaded builds.
2734 Assuming POSIX threads, then.)
b691c02f 2735EOM
e5e20432 2736 fi
aaacdc8b 2737 ;;
e5e20432 2738esac
104d25b7 2739
ff935051 2740cat <<EOM
64e689dc 2741
ff935051
JH
2742Perl can be built so that multiple Perl interpreters can coexist
2743within the same Perl executable.
2744EOM
64e689dc 2745
ff935051
JH
2746case "$useithreads" in
2747$define)
2748 cat <<EOM
2749This multiple interpreter support is required for interpreter-based threads.
64e689dc 2750EOM
ff935051
JH
2751 val="$define"
2752 ;;
0f0995ae 2753*) case "$usemultiplicity" in
ff42dc34
GS
2754 $define|true|[yY]*) dflt='y';;
2755 *) dflt='n';;
2756 esac
49c10eea 2757 echo " "
0f0995ae 2758 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
ff42dc34
GS
2759 rp='Build Perl for multiplicity?'
2760 . ./myread
2761 case "$ans" in
ff935051 2762 y|Y) val="$define" ;;
ff42dc34
GS
2763 *) val="$undef" ;;
2764 esac
2765 ;;
64e689dc
JH
2766esac
2767set usemultiplicity
ff935051 2768eval $setvar
64e689dc 2769
e5e20432
JH
2770: determine where manual pages are on this system
2771echo " "
2772case "$sysman" in
2773'')
2774 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2775 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2776 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2777 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2778 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2779 sysman=`./loc . /usr/man/man1 $syspath`
2780 ;;
2781esac
2782if $test -d "$sysman"; then
2783 echo "System manual is in $sysman." >&4
2784else
2785 echo "Could not find manual pages in source form." >&4
2786fi
2787
2788: see what memory models we can support
2789case "$models" in
2790'')
2791 $cat >pdp11.c <<'EOP'
2792int main() {
2793#ifdef pdp11
2794 exit(0);
2795#else
2796 exit(1);
2797#endif
2798}
2799EOP
2800 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2801 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2802 dflt='unsplit split'
2803 else
2804 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2805 case "$tans" in
2806 X) dflt='none';;
2807 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2808 dflt='small'
2809 else
2810 dflt=''
2811 fi
2812 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2813 dflt="$dflt medium"
2814 fi
2815 if $test -d /lib/large || $test -d /usr/lib/large; then
2816 dflt="$dflt large"
2817 fi
2818 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2819 dflt="$dflt huge"
2820 fi
2821 esac
2822 fi;;
2823*) dflt="$models";;
2824esac
2825$cat <<EOM
2826
2827Some systems have different model sizes. On most systems they are called
2828small, medium, large, and huge. On the PDP11 they are called unsplit and
2829split. If your system doesn't support different memory models, say "none".
2830If you wish to force everything to one memory model, say "none" here and
2831put the appropriate flags later when it asks you for other cc and ld flags.
2832Venix systems may wish to put "none" and let the compiler figure things out.
2833(In the following question multiple model names should be space separated.)
2834
2835The default for most systems is "none".
2836
2837EOM
2838rp="Which memory models are supported?"
2839. ./myread
2840models="$ans"
2841
2842case "$models" in
2843none)
2844 small=''
2845 medium=''
2846 large=''
2847 huge=''
2848 unsplit=''
2849 split=''
2850 ;;
2851*split)
2852 case "$split" in
2853 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2854 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2855 dflt='-i'
2856 else
2857 dflt='none'
2858 fi;;
2859 *) dflt="$split";;
2860 esac
2861 rp="What flag indicates separate I and D space?"
2862 . ./myread
2863 tans="$ans"
2864 case "$tans" in
2865 none) tans='';;
2866 esac
2867 split="$tans"
2868 unsplit='';;
2869*large*|*small*|*medium*|*huge*)
2870 case "$models" in
2871 *large*)
2872 case "$large" in
2873 '') dflt='-Ml';;
2874 *) dflt="$large";;
2875 esac
2876 rp="What flag indicates large model?"
2877 . ./myread
2878 tans="$ans"
2879 case "$tans" in
2880 none) tans='';
2881 esac
2882 large="$tans";;
2883 *) large='';;
2884 esac
2885 case "$models" in
2886 *huge*) case "$huge" in
2887 '') dflt='-Mh';;
2888 *) dflt="$huge";;
2889 esac
2890 rp="What flag indicates huge model?"
2891 . ./myread
2892 tans="$ans"
2893 case "$tans" in
2894 none) tans='';
2895 esac
2896 huge="$tans";;
2897 *) huge="$large";;
2898 esac
2899 case "$models" in
2900 *medium*) case "$medium" in
2901 '') dflt='-Mm';;
2902 *) dflt="$medium";;
2903 esac
2904 rp="What flag indicates medium model?"
2905 . ./myread
2906 tans="$ans"
2907 case "$tans" in
2908 none) tans='';
2909 esac
2910 medium="$tans";;
2911 *) medium="$large";;
2912 esac
2913 case "$models" in
2914 *small*) case "$small" in
2915 '') dflt='none';;
2916 *) dflt="$small";;
2917 esac
2918 rp="What flag indicates small model?"
2919 . ./myread
2920 tans="$ans"
2921 case "$tans" in
2922 none) tans='';
2923 esac
2924 small="$tans";;
2925 *) small='';;
2926 esac
2927 ;;
2928*)
2929 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2930 ;;
2931esac
2932$rm -f pdp11.* pdp11
2933
2934: make some quick guesses about what we are up against
2935echo " "
2936$echo $n "Hmm... $c"
2937echo exit 1 >bsd
2938echo exit 1 >usg
2939echo exit 1 >v7
2940echo exit 1 >osf1
2941echo exit 1 >eunice
2942echo exit 1 >xenix
2943echo exit 1 >venix
2944echo exit 1 >os2
2945d_bsd="$undef"
2946$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2947if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2948then
2949 echo "Looks kind of like an OSF/1 system, but we'll see..."
2950 echo exit 0 >osf1
2951elif test `echo abc | tr a-z A-Z` = Abc ; then
2952 xxx=`./loc addbib blurfl $pth`
2953 if $test -f $xxx; then
2954 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2955 echo exit 0 >bsd
2956 echo exit 0 >usg
2957 else
2958 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2959 echo "Looks kind of like an extended USG system, but we'll see..."
2960 else
2961 echo "Looks kind of like a USG system, but we'll see..."
2962 fi
2963 echo exit 0 >usg
2964 fi
2965elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2966 echo "Looks kind of like a BSD system, but we'll see..."
2967 d_bsd="$define"
2968 echo exit 0 >bsd
2969else
2970 echo "Looks kind of like a Version 7 system, but we'll see..."
2971 echo exit 0 >v7
2972fi
2973case "$eunicefix" in
2974*unixtovms*)
2975 $cat <<'EOI'
2976There is, however, a strange, musty smell in the air that reminds me of
2977something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2978EOI
2979 echo exit 0 >eunice
2980 d_eunice="$define"
2981: it so happens the Eunice I know will not run shell scripts in Unix format
2982 ;;
2983*)
2984 echo " "
2985 echo "Congratulations. You aren't running Eunice."
2986 d_eunice="$undef"
2987 ;;
2988esac
2989: Detect OS2. The p_ variable is set above in the Head.U unit.
2990case "$p_" in
2991:) ;;
2992*)
2993 $cat <<'EOI'
2994I have the feeling something is not exactly right, however...don't tell me...
2995lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2996EOI
2997 echo exit 0 >os2
2998 ;;
2999esac
3000if test -f /xenix; then
3001 echo "Actually, this looks more like a XENIX system..."
3002 echo exit 0 >xenix
3003 d_xenix="$define"
3004else
3005 echo " "
3006 echo "It's not Xenix..."
3007 d_xenix="$undef"
3008fi
3009chmod +x xenix
3010$eunicefix xenix
3011if test -f /venix; then
3012 echo "Actually, this looks more like a VENIX system..."
3013 echo exit 0 >venix
3014else
3015 echo " "
3016 if ./xenix; then
3017 : null
3018 else
3019 echo "Nor is it Venix..."
3020 fi
3021fi
3022chmod +x bsd usg v7 osf1 eunice xenix venix os2
3023$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3024$rm -f foo
3025
3026: see if we need a special compiler
3027echo " "
3028if ./usg; then
3029 case "$cc" in
3030 '') case "$Mcc" in
3031 /*) dflt='Mcc';;
3032 *) case "$large" in
3033 -M*) dflt='cc';;
3034 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3035 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3036 dflt='cc'
3037 else
3038 dflt='cc -M'
3039 fi
3040 else
3041 dflt='cc'
3042 fi;;
3043 esac;;
3044 esac;;
3045 *) dflt="$cc";;
3046 esac
3047 case "$dflt" in
3048 *M*) $cat <<'EOM'
3049On some older systems the default C compiler will not resolve multiple global
3050references that happen to have the same name. On some such systems the "Mcc"
3051command may be used to force these to be resolved. On other systems a "cc -M"
3052command is required. (Note that the -M flag on other systems indicates a
3053memory model to use!) If you have the Gnu C compiler, you might wish to use
3054that instead.
3055
3056EOM
3057 ;;
3058 esac
3059 rp="Use which C compiler?"
3060 . ./myread
3061 cc="$ans"
3062else
3063 case "$cc" in
3064 '') dflt=cc;;
3065 *) dflt="$cc";;
3066 esac
3067 rp="Use which C compiler?"
3068 . ./myread
3069 cc="$ans"
3070fi
3071: Look for a hint-file generated 'call-back-unit'. Now that the
3072: user has specified the compiler, we may need to set or change some
3073: other defaults.
3074if $test -f cc.cbu; then
3075 . ./cc.cbu
3076fi
3077echo " "
3078echo "Checking for GNU cc in disguise and/or its version number..." >&4
3079$cat >gccvers.c <<EOM
3080#include <stdio.h>
3081int main() {
3082#ifdef __GNUC__
3083#ifdef __VERSION__
3084 printf("%s\n", __VERSION__);
3085#else
3086 printf("%s\n", "1");
3087#endif
3088#endif
3089 exit(0);
3090}
3091EOM
bf0c440f 3092if $cc $ldflags -o gccvers gccvers.c; then
e5e20432
JH
3093 gccversion=`./gccvers`
3094 case "$gccversion" in
3095 '') echo "You are not using GNU cc." ;;
fc68435e 3096 *) echo "You are using GNU cc $gccversion."
fc68435e 3097 ;;
e5e20432
JH
3098 esac
3099else
3100 echo " "
3101 echo "*** WHOA THERE!!! ***" >&4
3102 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3103 case "$knowitall" in
3104 '')
3105 echo " You'd better start hunting for one and let me know about it." >&4
3106 exit 1
3107 ;;
3108 esac
3109fi
3110$rm -f gccvers*
3111case "$gccversion" in
31121*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3113esac
3114
bd9b35c9
JH
3115: decide how portable to be. Allow command line overrides.
3116case "$d_portable" in
3117"$undef") ;;
3118*) d_portable="$define" ;;
104d25b7 3119esac
85ab1d1d 3120
bd9b35c9
JH
3121: set up shell script to do ~ expansion
3122cat >filexp <<EOSS
3123$startsh
3124: expand filename
3125case "\$1" in
3126 ~/*|~)
3127 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3128 ;;
3129 ~*)
3130 if $test -f /bin/csh; then
3131 /bin/csh -f -c "glob \$1"
3132 failed=\$?
3133 echo ""
3134 exit \$failed
e5e20432 3135 else
bd9b35c9
JH
3136 name=\`$expr x\$1 : '..\([^/]*\)'\`
3137 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3138 if $test ! -d "\$dir"; then
3139 me=\`basename \$0\`
3140 echo "\$me: can't locate home directory for: \$name" >&2
3141 exit 1
3142 fi
3143 case "\$1" in
3144 */*)
3145 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3146 ;;
3147 *)
3148 echo \$dir
e5e20432
JH
3149 ;;
3150 esac
3151 fi
b691c02f 3152 ;;
4633a7c4 3153*)
bd9b35c9 3154 echo \$1
2304df62
AD
3155 ;;
3156esac
4633a7c4
LW
3157EOSS
3158chmod +x filexp
3159$eunicefix filexp
2304df62
AD
3160
3161: now set up to get a file name
28757baa 3162cat <<EOS >getfile
3163$startsh
3164EOS
3165cat <<'EOSC' >>getfile
2304df62
AD
3166tilde=''
3167fullpath=''
3168already=''
3169skip=''
3170none_ok=''
3171exp_file=''
a0d0e21e 3172nopath_ok=''
2304df62
AD
3173orig_rp="$rp"
3174orig_dflt="$dflt"
b233458b
JH
3175case "$gfpth" in
3176'') gfpth='.' ;;
3177esac
2304df62
AD
3178
3179case "$fn" in
ecfc5424 3180*\(*)
28e8609d 3181 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3182 fn=`echo $fn | sed 's/(.*)//'`
3183 ;;
3184esac
3185
3186case "$fn" in
a0d0e21e
LW
3187*:*)
3188 loc_file=`expr $fn : '.*:\(.*\)'`
3189 fn=`expr $fn : '\(.*\):.*'`
3190 ;;
3191esac
3192
3193case "$fn" in
2304df62
AD
3194*~*) tilde=true;;
3195esac
3196case "$fn" in
3197*/*) fullpath=true;;
3198esac
3199case "$fn" in
3200*+*) skip=true;;
3201esac
3202case "$fn" in
3203*n*) none_ok=true;;
3204esac
3205case "$fn" in
3206*e*) exp_file=true;;
3207esac
a0d0e21e
LW
3208case "$fn" in
3209*p*) nopath_ok=true;;
3210esac
2304df62
AD
3211
3212case "$fn" in
3213*f*) type='File';;
3214*d*) type='Directory';;
a0d0e21e 3215*l*) type='Locate';;
2304df62
AD
3216esac
3217
3218what="$type"
3219case "$what" in
3220Locate) what='File';;
3221esac
3222
3223case "$exp_file" in
3224'')
3225 case "$d_portable" in
3226 "$define") ;;
3227 *) exp_file=true;;
3228 esac
3229 ;;
3230esac
3231
3232cd ..
3233while test "$type"; do
3234 redo=''
3235 rp="$orig_rp"
3236 dflt="$orig_dflt"
3237 case "$tilde" in
3238 true) rp="$rp (~name ok)";;
3239 esac
3240 . UU/myread
ecfc5424
AD
3241 if test -f UU/getfile.ok && \
3242 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3243 then
3244 value="$ans"
3245 ansexp="$ans"
3246 break
3247 fi
2304df62
AD
3248 case "$ans" in
3249 none)
3250 value=''
3251 ansexp=''
3252 case "$none_ok" in
3253 true) type='';;
3254 esac
3255 ;;
3256 *)
3257 case "$tilde" in
3258 '') value="$ans"
3259 ansexp="$ans";;
3260 *)
3261 value=`UU/filexp $ans`
3262 case $? in
3263 0)
3264 if test "$ans" != "$value"; then
ecfc5424 3265 echo "(That expands to $value on this system.)"
2304df62
AD
3266 fi
3267 ;;
3268 *) value="$ans";;
3269 esac
3270 ansexp="$value"
3271 case "$exp_file" in
3272 '') value="$ans";;
3273 esac
3274 ;;
3275 esac
3276 case "$fullpath" in
3277 true)
3278 case "$ansexp" in
3279 /*) value="$ansexp" ;;
3280 *)
3281 redo=true
3282 case "$already" in
3283 true)
3284 echo "I shall only accept a full path name, as in /bin/ls." >&4
3285 echo "Use a ! shell escape if you wish to check pathnames." >&4
3286 ;;
3287 *)
3288 echo "Please give a full path name, starting with slash." >&4
3289 case "$tilde" in
3290 true)
3291 echo "Note that using ~name is ok provided it expands well." >&4
3292 already=true
3293 ;;
3294 esac
3295 esac
3296 ;;
3297 esac
3298 ;;
3299 esac
3300 case "$redo" in
3301 '')
3302 case "$type" in
3303 File)
b233458b
JH
3304 for fp in $gfpth; do
3305 if test "X$fp" = X.; then
3306 pf="$ansexp"
3307 else
3308 pf="$fp/$ansexp"
3309 fi
3310 if test -f "$pf"; then
3311 type=''
3312 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3313 then
3314 echo "($value is not a plain file, but that's ok.)"
3315 type=''
3316 fi
3317 if test X"$type" = X; then
3318 value="$pf"
3319 break
3320 fi
3321 done
2304df62
AD
3322 ;;
3323 Directory)
b233458b
JH
3324 for fp in $gfpth; do
3325 if test "X$fp" = X.; then
f78bfc9c
JH
3326 dir="$ans"
3327 direxp="$ansexp"
b233458b 3328 else
dd858076 3329 dir="$fp/$ansexp"
f78bfc9c 3330 direxp="$fp/$ansexp"
b233458b 3331 fi
f78bfc9c 3332 if test -d "$direxp"; then
b233458b 3333 type=''
f78bfc9c 3334 value="$dir"
b233458b
JH
3335 break
3336 fi
3337 done
2304df62
AD
3338 ;;
3339 Locate)
40000a8c 3340 if test -d "$ansexp"; then
a0d0e21e
LW
3341 echo "(Looking for $loc_file in directory $value.)"
3342 value="$value/$loc_file"
40000a8c 3343 ansexp="$ansexp/$loc_file"
2304df62 3344 fi
40000a8c 3345 if test -f "$ansexp"; then
2304df62
AD
3346 type=''
3347 fi
a0d0e21e
LW
3348 case "$nopath_ok" in
3349 true) case "$value" in
3350 */*) ;;
3351 *) echo "Assuming $value will be in people's path."
3352 type=''
3353 ;;
3354 esac
3355 ;;
3356 esac
2304df62
AD
3357 ;;
3358 esac
3359
3360 case "$skip" in
3361 true) type='';
3362 esac
3363
3364 case "$type" in
3365 '') ;;
3366 *)
3367 if test "$fastread" = yes; then
3368 dflt=y
3369 else
3370 dflt=n
3371 fi
3372 rp="$what $value doesn't exist. Use that name anyway?"
3373 . UU/myread
3374 dflt=''
3375 case "$ans" in
3376 y*) type='';;
3377 *) echo " ";;
3378 esac
3379 ;;
3380 esac
3381 ;;
3382 esac
3383 ;;
3384 esac
3385done
3386cd UU
3387ans="$value"
3388rp="$orig_rp"
3389dflt="$orig_dflt"
ecfc5424 3390rm -f getfile.ok
b233458b 3391test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3392EOSC
3393
bd9b35c9
JH
3394: What should the include directory be ?
3395echo " "
3396$echo $n "Hmm... $c"
3397dflt='/usr/include'
3398incpath=''
3399mips_type=''
3400if $test -f /bin/mips && /bin/mips; then
3401 echo "Looks like a MIPS system..."
3402 $cat >usr.c <<'EOCP'
3403#ifdef SYSTYPE_BSD43
3404/bsd43
3405#endif
3406EOCP
3407 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3408 dflt='/bsd43/usr/include'
3409 incpath='/bsd43'
3410 mips_type='BSD 4.3'
3411 else
3412 mips_type='System V'
3413 fi
3414 $rm -f usr.c usr.out
3415 echo "and you're compiling with the $mips_type compiler and libraries."
3416 xxx_prompt=y
3417 echo "exit 0" >mips
3418else
3419 echo "Doesn't look like a MIPS system."
3420 xxx_prompt=n
3421 echo "exit 1" >mips
3422fi
3423chmod +x mips
3424$eunicefix mips
3425case "$usrinc" in
3426'') ;;
3427*) dflt="$usrinc";;
3428esac
3429case "$xxx_prompt" in
3430y) fn=d/
3431 echo " "
3432 rp='Where are the include files you want to use?'
3433 . ./getfile
3434 usrinc="$ans"
8e07c86e 3435 ;;
bd9b35c9 3436*) usrinc="$dflt"
8e07c86e
AD
3437 ;;
3438esac
2304df62 3439
fc68435e
JH
3440: see how we invoke the C preprocessor
3441echo " "
3442echo "Now, how can we feed standard input to your C preprocessor..." >&4
3443cat <<'EOT' >testcpp.c
3444#define ABC abc
3445#define XYZ xyz
3446ABC.XYZ
3447EOT
3448cd ..
3449if test ! -f cppstdin; then
3450 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3451 # AIX cc -E doesn't show the absolute headerfile
3452 # locations but we'll cheat by using the -M flag.
3453 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
3454 else
3455 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3456 fi
3457else
3458 echo "Keeping your $hint cppstdin wrapper."
3459fi
3460chmod 755 cppstdin
3461wrapper=`pwd`/cppstdin
3462ok='false'
3463cd UU
3464
3465if $test "X$cppstdin" != "X" && \
3466 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3467 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3468then
3469 echo "You used to use $cppstdin $cppminus so we'll use that again."
3470 case "$cpprun" in
3471 '') echo "But let's see if we can live without a wrapper..." ;;
3472 *)
3473 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3474 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3475 then
3476 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3477 ok='true'
3478 else
3479 echo "(However, $cpprun $cpplast does not work, let's see...)"
3480 fi
3481 ;;
3482 esac
3483else
3484 case "$cppstdin" in
3485 '') ;;
3486 *)
3487 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3488 ;;
3489 esac
3490fi
3491
3492if $ok; then
3493 : nothing
3494elif echo 'Maybe "'"$cc"' -E" will work...'; \
3495 $cc -E <testcpp.c >testcpp.out 2>&1; \
3496 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497 echo "Yup, it does."
3498 x_cpp="$cc -E"
3499 x_minus='';
3500elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3501 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3502 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503 echo "Yup, it does."
3504 x_cpp="$cc -E"
3505 x_minus='-';
3506elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3507 $cc -P <testcpp.c >testcpp.out 2>&1; \
3508 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509 echo "Yipee, that works!"
3510 x_cpp="$cc -P"
3511 x_minus='';
3512elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3513 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3514 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3515 echo "At long last!"
3516 x_cpp="$cc -P"
3517 x_minus='-';
3518elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3519 $cpp <testcpp.c >testcpp.out 2>&1; \
3520 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3521 echo "It works!"
3522 x_cpp="$cpp"
3523 x_minus='';
3524elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3525 $cpp - <testcpp.c >testcpp.out 2>&1; \
3526 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3527 echo "Hooray, it works! I was beginning to wonder."
3528 x_cpp="$cpp"
3529 x_minus='-';
3530elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3531 $wrapper <testcpp.c >testcpp.out 2>&1; \
3532 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533 x_cpp="$wrapper"
3534 x_minus=''
3535 echo "Eureka!"
3536else
3537 dflt=''
3538 rp="No dice. I can't find a C preprocessor. Name one:"
3539 . ./myread
3540 x_cpp="$ans"
3541 x_minus=''
3542 $x_cpp <testcpp.c >testcpp.out 2>&1
3543 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3544 echo "OK, that will do." >&4
3545 else
3546echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3547 exit 1
3548 fi
3549fi
3550
3551case "$ok" in
3552false)
3553 cppstdin="$x_cpp"
3554 cppminus="$x_minus"
3555 cpprun="$x_cpp"
3556 cpplast="$x_minus"
3557 set X $x_cpp
3558 shift
3559 case "$1" in
3560 "$cpp")
3561 echo "Perhaps can we force $cc -E using a wrapper..."
3562 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3563 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3564 then
3565 echo "Yup, we can."
3566 cppstdin="$wrapper"
3567 cppminus='';
3568 else
3569 echo "Nope, we'll have to live without it..."
3570 fi
3571 ;;
3572 esac
3573 case "$cpprun" in
3574 "$wrapper")
3575 cpprun=''
3576 cpplast=''
3577 ;;
3578 esac
3579 ;;
3580esac
3581
3582case "$cppstdin" in
3583"$wrapper"|'cppstdin') ;;
3584*) $rm -f $wrapper;;
3585esac
3586$rm -f testcpp.c testcpp.out
3587
bd9b35c9
JH
3588: Set private lib path
3589case "$plibpth" in
3590'') if ./mips; then
3591 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3592 fi;;
3593esac
3594case "$libpth" in
3595' ') dlist='';;
3596'') dlist="$loclibpth $plibpth $glibpth";;
3597*) dlist="$libpth";;
3598esac
3599
3600: Now check and see which directories actually exist, avoiding duplicates
3601libpth=''
3602for xxx in $dlist
3603do
3604 if $test -d $xxx; then
3605 case " $libpth " in
3606 *" $xxx "*) ;;
3607 *) libpth="$libpth $xxx";;
3608 esac
3609 fi
3610done
3611$cat <<'EOM'
3612
3613Some systems have incompatible or broken versions of libraries. Among
3614the directories listed in the question below, please remove any you
3615know not to be holding relevant libraries, and add any that are needed.
3616Say "none" for none.
8e07c86e
AD
3617
3618EOM
bd9b35c9
JH
3619case "$libpth" in
3620'') dflt='none';;
8e07c86e 3621*)
bd9b35c9
JH
3622 set X $libpth
3623 shift
3624 dflt=${1+"$@"}
8e07c86e 3625 ;;
a0d0e21e 3626esac
bd9b35c9
JH
3627rp="Directories to use for library searches?"
3628. ./myread
3629case "$ans" in
3630none) libpth=' ';;
3631*) libpth="$ans";;
3632esac
a0d0e21e 3633
bd9b35c9
JH
3634: compute shared library extension
3635case "$so" in
3636'')
3637 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3638 dflt='sl'
dd4e71fd 3639 else
bd9b35c9 3640 dflt='so'
dd4e71fd
JH
3641 fi
3642 ;;
bd9b35c9 3643*) dflt="$so";;
dd4e71fd 3644esac
dd4e71fd
JH
3645$cat <<EOM
3646
bd9b35c9 3647On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3648you want to suppress searching of shared libraries for the remainder
bd9b35c9 3649of this configuration.
dd4e71fd
JH
3650
3651EOM
bd9b35c9
JH
3652rp='What is the file extension used for shared libraries?'
3653. ./myread
3654so="$ans"
dd4e71fd 3655
bd9b35c9
JH
3656: Define several unixisms.
3657: Hints files or command line option can be used to override them.
3658: The convoluted testing is in case hints files set either the old
3659: or the new name.
3660case "$_exe" in
3661'') case "$exe_ext" in
3662 '') ;;
3663 *) _exe="$exe_ext" ;;
dd4e71fd 3664 esac
bd9b35c9 3665 ;;
bfb7748a 3666esac
bd9b35c9
JH
3667case "$_a" in
3668'') case "$lib_ext" in
3669 '') _a='.a';;
3670 *) _a="$lib_ext" ;;
dd4e71fd
JH
3671 esac
3672 ;;
dd4e71fd 3673esac
bd9b35c9
JH
3674case "$_o" in
3675'') case "$obj_ext" in
3676 '') _o='.o';;
3677 *) _o="$obj_ext";;
3678 esac
3679 ;;
3680esac
3681case "$p_" in
3682'') case "$path_sep" in
3683 '') p_=':';;
3684 *) p_="$path_sep";;
3685 esac
3686 ;;
3687esac
3688exe_ext=$_exe
3689lib_ext=$_a
3690obj_ext=$_o
3691path_sep=$p_
dd4e71fd 3692
bd9b35c9
JH
3693: Which makefile gets called first. This is used by make depend.
3694case "$firstmakefile" in
3695'') firstmakefile='makefile';;
4633a7c4 3696esac
4633a7c4 3697
0f0995ae
JH
3698case "$usesocks" in
3699$define|true|[yY]*) dflt='y';;
3700*) dflt='n';;
3701esac
bd9b35c9 3702cat <<EOM
4633a7c4 3703
bd9b35c9
JH
3704Perl can be built to use the SOCKS proxy protocol library. To do so,
3705Configure must be run with -Dusesocks.
4633a7c4 3706
0f0995ae 3707If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3708EOM
bd9b35c9
JH
3709rp='Build Perl for SOCKS?'
3710. ./myread
3711case "$ans" in
3712y|Y) val="$define" ;;
3713*) val="$undef" ;;
3714esac
3715set usesocks
3716eval $setvar
3717
3718: Looking for optional libraries
3719echo " "
3720echo "Checking for optional libraries..." >&4
3721case "$libs" in
3722' '|'') dflt='';;
3723*) dflt="$libs";;
3724esac
3725case "$libswanted" in
3726'') libswanted='c_s';;
3727esac
3728case "$usesocks" in
923fc586 3729"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3730esac
68435ea7
JH
3731libsfound=''
3732libsfiles=''
3733libsdirs=''
13b3f787
JH
3734libspath=''
3735for thisdir in $libpth $xlibpth; do
3736 test -d $thisdir && libspath="$libspath $thisdir"
3737done
bd9b35c9 3738for thislib in $libswanted; do
13b3f787 3739 for thisdir in $libspath; do
f7dd4e7f
JH
3740 xxx=''
3741 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3742 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3743 $test -f "$xxx" && eval $libscheck
3744 $test -f "$xxx" && libstyle=shared
3745 fi
3746 if test ! -f "$xxx"; then
3747 xxx=$thisdir/lib$thislib.$so
3748 $test -f "$xxx" && eval $libscheck
3749 $test -f "$xxx" && libstyle=shared
3750 fi
3751 if test ! -f "$xxx"; then
3752 xxx=$thisdir/lib$thislib$_a
3753 $test -f "$xxx" && eval $libscheck
3754 $test -f "$xxx" && libstyle=static
3755 fi
3756 if test ! -f "$xxx"; then
3757 xxx=$thisdir/$thislib$_a
3758 $test -f "$xxx" && eval $libscheck
3759 $test -f "$xxx" && libstyle=static
3760 fi
3761 if test ! -f "$xxx"; then
3762 xxx=$thisdir/lib${thislib}_s$_a
3763 $test -f "$xxx" && eval $libscheck
3764 $test -f "$xxx" && libstyle=static
09ea5ba9 3765 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3766 fi
3767 if test ! -f "$xxx"; then
3768 xxx=$thisdir/Slib$thislib$_a
3769 $test -f "$xxx" && eval $libscheck
3770 $test -f "$xxx" && libstyle=static
3771 fi
3772 if $test -f "$xxx"; then
43999f95 3773 case "$libstyle" in
f7dd4e7f
JH
3774 shared) echo "Found -l$thislib (shared)." ;;
3775 static) echo "Found -l$thislib." ;;
3776 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3777 esac
bd9b35c9
JH
3778 case " $dflt " in
3779 *"-l$thislib "*);;
f7dd4e7f 3780 *) dflt="$dflt -l$thislib"
43999f95
JH
3781 libsfound="$libsfound $xxx"
3782 yyy=`basename $xxx`
3783 libsfiles="$libsfiles $yyy"
1e127011 3784 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3785 case " $libsdirs " in
3786 *" $yyy "*) ;;
3787 *) libsdirs="$libsdirs $yyy" ;;
3788 esac
3789 ;;
bd9b35c9 3790 esac
f7dd4e7f
JH
3791 break
3792 fi
3793 done
3794 if $test ! -f "$xxx"; then
3795 echo "No -l$thislib."
bd9b35c9
JH
3796 fi
3797done
3798set X $dflt
3799shift
3800dflt="$*"
3801case "$libs" in
3802'') dflt="$dflt";;
3803*) dflt="$libs";;
3804esac
3805case "$dflt" in
3806' '|'') dflt='none';;
3807esac
4633a7c4 3808
bd9b35c9 3809$cat <<EOM
4633a7c4 3810
bd9b35c9
JH
3811In order to compile $package on your machine, a number of libraries
3812are usually needed. Include any other special libraries here as well.
3813Say "none" for none. The default list is almost always right.
8e07c86e 3814EOM
8e07c86e 3815
bd9b35c9
JH
3816echo " "
3817rp="What libraries to use?"
3818. ./myread
3819case "$ans" in
3820none) libs=' ';;
3821*) libs="$ans";;
3822esac
d71b2b6b 3823
bd9b35c9
JH
3824: determine optimization, if desired, or use for debug flag also
3825case "$optimize" in
3826' '|$undef) dflt='none';;
3827'') dflt='-O';;
3828*) dflt="$optimize";;
3829esac
3830$cat <<EOH
d71b2b6b 3831
bd9b35c9
JH
3832By default, $package compiles with the -O flag to use the optimizer.
3833Alternately, you might want to use the symbolic debugger, which uses
3834the -g flag (on traditional Unix systems). Either flag can be
3835specified here. To use neither flag, specify the word "none".
d71b2b6b 3836
bd9b35c9
JH
3837EOH
3838rp="What optimizer/debugger flag should be used?"
3839. ./myread
3840optimize="$ans"
3841case "$optimize" in
3842'none') optimize=" ";;
3843esac
3844
3845dflt=''
3846: We will not override a previous value, but we might want to
3847: augment a hint file
3848case "$hint" in
3849default|recommended)
3850 case "$gccversion" in
3851 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3852 esac
bd9b35c9
JH
3853 case "$optimize" in
3854 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3855 esac
bd9b35c9
JH
3856 case "$gccversion" in
3857 2*) if test -d /etc/conf/kconfig.d &&
3858 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3859 then
3860 dflt="$dflt -posix"
3861 fi
f0d04425 3862 ;;
bd9b35c9
JH
3863 esac
3864 case "$gccversion" in
3865 1*) ;;
3866 2.[0-8]*) ;;
3867 ?*) echo " "
3868 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3869 echo 'int main(void) { return 0; }' > gcctest.c
3870 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3871 echo "Yes, it does." 2>&1
3872 case "$ccflags" in
3873 *strict-aliasing*)
3874 echo "Leaving current flags $ccflags alone." 2>&1
3875 ;;
3876 *) dflt="$dflt -fno-strict-aliasing" ;;
3877 esac
3878 else
3879 echo "Nope, it doesn't, but that's ok." 2>&1
3880 fi
f0d04425 3881 ;;
e5e20432
JH
3882 esac
3883 ;;
3884esac
3885
bd9b35c9
JH
3886case "$mips_type" in
3887*BSD*|'') inclwanted="$locincpth $usrinc";;
3888*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3889esac
3890for thisincl in $inclwanted; do
3891 if $test -d $thisincl; then
3892 if $test x$thisincl != x$usrinc; then
3893 case "$dflt" in
3894 *$thisincl*);;
3895 *) dflt="$dflt -I$thisincl";;
3896 esac
3897 fi
3898 fi
3899done
40a7a20a 3900
bd9b35c9
JH
3901inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3902 xxx=true;
3903elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3904 xxx=true;
3905else
3906 xxx=false;
3907fi;
3908if $xxx; then
3909 case "$dflt" in
3910 *$2*);;
3911 *) dflt="$dflt -D$2";;
3912 esac;
3913fi'
40a7a20a 3914
bd9b35c9 3915set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3916
bd9b35c9
JH
3917case "$usesocks" in
3918$define)
3919 ccflags="$ccflags -DSOCKS"
3920 ;;
3921esac
40a7a20a 3922
bd9b35c9
JH
3923case "$hint" in
3924default|recommended) dflt="$ccflags $dflt" ;;
3925*) dflt="$ccflags";;
3926esac
40a7a20a 3927
bd9b35c9
JH
3928case "$dflt" in
3929''|' ') dflt=none;;
3930esac
3931$cat <<EOH
40a7a20a 3932
bd9b35c9
JH
3933Your C compiler may want other flags. For this question you should include
3934-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3935but you should NOT include libraries or ld flags like -lwhatever. If you
3936want $package to honor its debug switch, you should include -DDEBUGGING here.
3937Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3938
bd9b35c9 3939To use no flags, specify the word "none".
40a7a20a 3940
bd9b35c9
JH
3941EOH
3942set X $dflt
3943shift
3944dflt=${1+"$@"}
3945rp="Any additional cc flags?"
3946. ./myread
3947case "$ans" in
3948none) ccflags='';;
3949*) ccflags="$ans";;
3950esac
8e07c86e 3951
bd9b35c9
JH
3952: the following weeds options from ccflags that are of no interest to cpp
3953cppflags="$ccflags"
3954case "$gccversion" in
39551*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3956esac
bd9b35c9
JH
3957case "$mips_type" in
3958'');;
3959*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3960esac
3961case "$cppflags" in
3962'');;
3963*)
3964 echo " "
3965 echo "Let me guess what the preprocessor flags are..." >&4
3966 set X $cppflags
3967 shift
3968 cppflags=''
3969 $cat >cpp.c <<'EOM'
3970#define BLURFL foo
8e07c86e 3971
bd9b35c9
JH
3972BLURFL xx LFRULB
3973EOM
3974 previous=''
3975 for flag in $*
3976 do
3977 case "$flag" in
3978 -*) ftry="$flag";;
3979 *) ftry="$previous $flag";;
3980 esac
3981 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3982 >cpp1.out 2>/dev/null && \
3983 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3984 >cpp2.out 2>/dev/null && \
3985 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3986 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3987 then
3988 cppflags="$cppflags $ftry"
3989 previous=''
3990 else
3991 previous="$flag"
3992 fi
3993 done
3994 set X $cppflags
3995 shift
3996 cppflags=${1+"$@"}
3997 case "$cppflags" in
3998 *-*) echo "They appear to be: $cppflags";;
3999 esac
4000 $rm -f cpp.c cpp?.out
2afac517 4001 ;;
4002esac
8e07c86e 4003
bd9b35c9
JH
4004: flags used in final linking phase
4005case "$ldflags" in
4006'') if ./venix; then
4007 dflt='-i -z'
10a23457 4008 else
bd9b35c9 4009 dflt=''
10a23457 4010 fi
bd9b35c9
JH
4011 case "$ccflags" in
4012 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4013 esac
bd9b35c9
JH
4014 ;;
4015*) dflt="$ldflags";;
4016esac
4017
4018: Try to guess additional flags to pick up local libraries.
4019for thislibdir in $libpth; do
4020 case " $loclibpth " in
4021 *" $thislibdir "*)
4022 case "$dflt " in
4023 *"-L$thislibdir "*) ;;
4024 *) dflt="$dflt -L$thislibdir" ;;
4025 esac
c4f23d77
AD
4026 ;;
4027 esac
bd9b35c9 4028done
c4f23d77 4029
bd9b35c9
JH
4030case "$dflt" in
4031'') dflt='none' ;;
4032esac
c4f23d77 4033
bd9b35c9
JH
4034$cat <<EOH
4035
4036Your C linker may need flags. For this question you should
4037include -L/whatever and any other flags used by the C linker, but you
4038should NOT include libraries like -lwhatever.
4039
4040Make sure you include the appropriate -L/path flags if your C linker
4041does not normally search all of the directories you specified above,
4042namely
4043 $libpth
4044To use no flags, specify the word "none".
4045
4046EOH
4047
4048rp="Any additional ld flags (NOT including libraries)?"
4049. ./myread
4050case "$ans" in
4051none) ldflags='';;
4052*) ldflags="$ans";;
4053esac
4054rmlist="$rmlist pdp11"
4055
4056: coherency check
4057echo " "
4058echo "Checking your choice of C compiler and flags for coherency..." >&4
4059$cat > try.c <<'EOF'
4060#include <stdio.h>
4061int main() { printf("Ok\n"); exit(0); }
4062EOF
4063set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4064shift
4065$cat >try.msg <<'EOM'
4066I've tried to compile and run the following simple program:
4067
4068EOM
4069$cat try.c >> try.msg
4070
4071$cat >> try.msg <<EOM
4072
4073I used the command:
4074
4075 $*
4076 ./try
4077
4078and I got the following output:
4079
4080EOM
4081dflt=y
4082if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4083 if sh -c './try' >>try.msg 2>&1; then
4084 xxx=`./try`
4085 case "$xxx" in
4086 "Ok") dflt=n ;;
4087 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4088 case " $libs " in
4089 *" -lsfio "*)
4090 cat >> try.msg <<'EOQS'
4091If $libs contains -lsfio, and sfio is mis-configured, then it
4092sometimes (apparently) runs and exits with a 0 status, but with no
4093output! It may have to do with sfio's use of _exit vs. exit.
4094
4095EOQS
4096 rp="You have a big problem. Shall I abort Configure"
4097 dflt=y
4098 ;;
4099 esac
4100 ;;
4101 esac
4102 else
4103 echo "The program compiled OK, but exited with status $?." >>try.msg
4104 rp="You have a problem. Shall I abort Configure"
4105 dflt=y
4106 fi
4107else
4108 echo "I can't compile the test program." >>try.msg
4109 rp="You have a BIG problem. Shall I abort Configure"
4110 dflt=y
4111fi
4112case "$dflt" in
4113y)
4114 $cat try.msg >&4
4115 case "$knowitall" in
4116 '')
4117 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4118 ;;
bd9b35c9 4119 *) dflt=n;;
c4f23d77 4120 esac
bd9b35c9
JH
4121 echo " "
4122 . ./myread
4123 case "$ans" in
4124 n*|N*) ;;
4125 *) echo "Ok. Stopping Configure." >&4
4126 exit 1
c4f23d77
AD
4127 ;;
4128 esac
4129 ;;
bd9b35c9 4130n) echo "OK, that should do.";;
c4f23d77 4131esac
bd9b35c9 4132$rm -f try try.* core
c4f23d77 4133
bd9b35c9
JH
4134: define an is-a-typedef? function
4135typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4136case "$inclist" in
4137"") inclist="sys/types.h";;
4138esac;
4139eval "varval=\$$var";
4140case "$varval" in
4141"")
4142 $rm -f temp.c;
4143 for inc in $inclist; do
4144 echo "#include <$inc>" >>temp.c;
4145 done;
4146 echo "#ifdef $type" >> temp.c;
4147 echo "printf(\"We have $type\");" >> temp.c;
4148 echo "#endif" >> temp.c;
4149 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4150 if $contains $type temp.E >/dev/null 2>&1; then
4151 eval "$var=\$type";
4152 else
4153 eval "$var=\$def";
4154 fi;
4155 $rm -f temp.?;;
4156*) eval "$var=\$varval";;
4157esac'
8e07c86e 4158
bd9b35c9
JH
4159: define an is-a-typedef? function that prompts if the type is not available.
4160typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4161case "$inclist" in
4162"") inclist="sys/types.h";;
4163esac;
4164eval "varval=\$$var";
4165case "$varval" in
4166"")
4167 $rm -f temp.c;
4168 for inc in $inclist; do
4169 echo "#include <$inc>" >>temp.c;
4170 done;
4171 echo "#ifdef $type" >> temp.c;
4172 echo "printf(\"We have $type\");" >> temp.c;
4173 echo "#endif" >> temp.c;
4174 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4175 echo " " ;
4176 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4177 if $contains $type temp.E >/dev/null 2>&1; then
4178 echo "$type found." >&4;
4179 eval "$var=\$type";
4180 else
4181 echo "$type NOT found." >&4;
4182 dflt="$def";
4183 . ./myread ;
4184 eval "$var=\$ans";
4185 fi;
4186 $rm -f temp.?;;
4187*) eval "$var=\$varval";;
4188esac'
8e07c86e 4189
bd9b35c9
JH
4190: define a shorthand compile call
4191compile='
4192mc_file=$1;
4193shift;
4194$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4195: define a shorthand compile call for compilations that should be ok.
4196compile_ok='
4197mc_file=$1;
4198shift;
4199$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
8e07c86e 4200
bd9b35c9
JH
4201: check for lengths of integral types
4202echo " "
4203case "$intsize" in
2afac517 4204'')
bd9b35c9
JH
4205 echo "Checking to see how big your integers are..." >&4
4206 $cat >intsize.c <<'EOCP'
4207#include <stdio.h>
4208int main()
4209{
4210 printf("intsize=%d;\n", (int)sizeof(int));
4211 printf("longsize=%d;\n", (int)sizeof(long));
4212 printf("shortsize=%d;\n", (int)sizeof(short));
4213 exit(0);
4214}
4215EOCP
4216 set intsize
4217 if eval $compile_ok && ./intsize > /dev/null; then
4218 eval `./intsize`
4219 echo "Your integers are $intsize bytes long."
4220 echo "Your long integers are $longsize bytes long."
4221 echo "Your short integers are $shortsize bytes long."
2afac517 4222 else
bd9b35c9
JH
4223 $cat >&4 <<EOM
4224!
4225Help! I can't compile and run the intsize test program: please enlighten me!
4226(This is probably a misconfiguration in your system or libraries, and
4227you really ought to fix it. Still, I'll try anyway.)
4228!
4229EOM
4230 dflt=4
4231 rp="What is the size of an integer (in bytes)?"
4232 . ./myread
4233 intsize="$ans"
4234 dflt=$intsize
4235 rp="What is the size of a long integer (in bytes)?"
4236 . ./myread
4237 longsize="$ans"
4238 dflt=2
4239 rp="What is the size of a short integer (in bytes)?"
4240 . ./myread
4241 shortsize="$ans"
2afac517 4242 fi
4243 ;;
8e07c86e 4244esac
bd9b35c9
JH
4245$rm -f intsize intsize.*
4246
4247: see what type lseek is declared as in the kernel
4248rp="What is the type used for lseek's offset on this system?"
4249set off_t lseektype long stdio.h sys/types.h
4250eval $typedef_ask
4251
4252echo " "
49c10eea 4253echo "Checking to see how big your file offsets are..." >&4
bd9b35c9
JH
4254$cat >try.c <<EOCP
4255#include <sys/types.h>
4256#include <stdio.h>
4257int main()
4258{
4259 printf("%d\n", (int)sizeof($lseektype));
4260 return(0);
4261}
4262EOCP
4263set try
4264if eval $compile_ok; then
4265 lseeksize=`./try`
49c10eea 4266 echo "Your file offsets are $lseeksize bytes long."
bd9b35c9
JH
4267else
4268 dflt=$longsize
4269 echo " "
4270 echo "(I can't seem to compile the test program. Guessing...)"
4271 rp="What is the size of your file offsets (in bytes)?"
4272 . ./myread
4273 lseeksize="$ans"
4274fi
4275$rm -f try.c try
4276
4277: see what type file positions are declared as in the library
4278rp="What is the type for file position used by fsetpos()?"
4279set fpos_t fpostype long stdio.h sys/types.h
4280eval $typedef_ask
4281
4282echo " "
4283case "$fpostype" in
4284*_t) zzz="$fpostype" ;;
4285*) zzz="fpos_t" ;;
4286esac
49c10eea 4287echo "Checking the size of $zzz..." >&4
bd9b35c9
JH
4288cat > try.c <<EOCP
4289#include <sys/types.h>
4290#include <stdio.h>
4291int main() {
4292 printf("%d\n", (int)sizeof($fpostype));
4293 exit(0);
4294}
4295EOCP
4296set try
4297if eval $compile_ok; then
4298 yyy=`./try`
4299 case "$yyy" in
4300 '') fpossize=4
bd9b35c9
JH
4301 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4302 ;;
4303 *) fpossize=$yyy
c890dc6c 4304 echo "Your $zzz is $fpossize bytes long."
bd9b35c9
JH
4305 ;;
4306 esac
4307else
4308 dflt="$longsize"
68435ea7 4309 echo " " >&4
bd9b35c9
JH
4310 echo "(I can't compile the test program. Guessing...)" >&4
4311 rp="What is the size of your file positions (in bytes)?"
4312 . ./myread
4313 fpossize="$ans"
4314fi
4315
4316
8e07c86e 4317
10cc9d2a
JH
4318# Backward compatibility (uselfs is deprecated).
4319case "$uselfs" in
4320"$define"|true|[yY]*)
4321 cat <<EOM >&4
4322
4323*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
10cc9d2a
JH
4324EOM
4325 uselargefiles="$define"
4326 ;;
4327esac
4328
bd9b35c9
JH
4329case "$lseeksize:$fpossize" in
43308:8) cat <<EOM
8e07c86e 4331
bd9b35c9 4332You can have files larger than 2 gigabytes.
8e07c86e 4333EOM
bd9b35c9 4334 val="$define" ;;
0f0995ae
JH
4335*) case "$uselargefiles" in
4336 "$undef"|false|[nN]*) dflt='n' ;;
4337 *) dflt='y' ;;
4338 esac
4339 cat <<EOM
8e07c86e 4340
bd9b35c9 4341Perl can be built to understand large files (files larger than 2 gigabytes)
0f0995ae 4342on some systems. To do so, Configure can be run with -Duselargefiles.
bd9b35c9 4343
0f0995ae 4344If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4345EOM
bd9b35c9
JH
4346 rp='Try to understand large files, if available?'
4347 . ./myread
4348 case "$ans" in
4349 y|Y) val="$define" ;;
4350 *) val="$undef" ;;
4351 esac
4352 ;;
dfe9444c 4353esac
bd9b35c9
JH
4354set uselargefiles
4355eval $setvar
4356case "$uselargefiles" in
4357"$define")
4358: Look for a hint-file generated 'call-back-unit'. If the
4359: user has specified that a large files perl is to be built,
4360: we may need to set or change some other defaults.
8a647129 4361 if $test -f uselargefiles.cbu; then
bd9b35c9 4362 echo "Your platform has some specific hints for large file builds, using them..."
8a647129 4363 . ./uselargefiles.cbu
bd9b35c9 4364 echo " "
49c10eea 4365 echo "Rechecking to see how big your file offsets are..." >&4
bd9b35c9
JH
4366 $cat >try.c <<EOCP
4367#include <sys/types.h>
4368#include <stdio.h>
4369int main()
4370{
4371 printf("%d\n", (int)sizeof($lseektype));
4372 return(0);
4373}
4374EOCP
4375 set try
4376 if eval $compile_ok; then
4377 lseeksize=`./try`
49c10eea 4378 $echo "Your file offsets are now $lseeksize bytes long."
bd9b35c9
JH
4379 else
4380 dflt="$lseeksize"
4381 echo " "
4382 echo "(I can't seem to compile the test program. Guessing...)"
4383 rp="What is the size of your file offsets (in bytes)?"
4384 . ./myread
4385 lseeksize="$ans"
4386 fi
4387 case "$fpostype" in
4388 *_t) zzz="$fpostype" ;;
4389 *) zzz="fpos_t" ;;
4390 esac
4391 $echo $n "Rechecking the size of $zzz...$c" >&4
4392 $cat > try.c <<EOCP
4393#include <sys/types.h>
4394#include <stdio.h>
4395int main() {
4396 printf("%d\n", (int)sizeof($fpostype));
4397 exit(0);
4398}
4399EOCP
4400 set try
4401 if eval $compile_ok; then
4402 yyy=`./try`
4403 dflt="$lseeksize"
4404 case "$yyy" in
4405 '') echo " "
4406 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4407 ;;
4408 *) fpossize=$yyy
49c10eea 4409 echo " $fpossize bytes." >&4
bd9b35c9
JH
4410 ;;
4411 esac
4412 else
4413 dflt="$fpossize"
4414 echo " "
4415 echo "(I can't compile the test program. Guessing...)" >&4
4416 rp="What is the size of your file positions (in bytes)?"
4417 . ./myread
4418 fpossize="$ans"
4419 fi
4420 $rm -f try.c try
4421 fi
dfe9444c
AD
4422 ;;
4423esac
bd9b35c9
JH
4424
4425
4426case "$usemorebits" in
4427"$define"|true|[yY]*)
10cc9d2a 4428 use64bitint="$define"
bd9b35c9
JH
4429 uselongdouble="$define"
4430 usemorebits="$define"
dfe9444c 4431 ;;
bd9b35c9 4432*) usemorebits="$undef"
dfe9444c
AD
4433 ;;
4434esac
dfe9444c 4435
dfe9444c 4436
49c10eea
JH
4437case "$uselonglong" in
4438"$define"|true|[yY]*)
4439 cat <<EOM >&4
4440
10cc9d2a 4441*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
10cc9d2a
JH
4442EOM
4443 use64bitint="$define"
4444 ;;
4445esac
10cc9d2a
JH
4446case "$use64bits" in
4447"$define"|true|[yY]*)
4448 cat <<EOM >&4
4449
4450*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
49c10eea 4451EOM
10cc9d2a 4452 use64bitint="$define"
49c10eea
JH
4453 ;;
4454esac
10cc9d2a
JH
4455case "$use64bitints" in
4456"$define"|true|[yY]*)
4457 cat <<EOM >&4
4458
4459*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
10cc9d2a
JH
4460EOM
4461 use64bitint="$define"
4462 ;;
4463esac
3141530c
JH
4464case "$use64bitsint" in
4465"$define"|true|[yY]*)
4466 cat <<EOM >&4
4467
4468*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4469EOM
4470 use64bitint="$define"
4471 ;;
4472esac
4473case "$uselonglongs" in
4474"$define"|true|[yY]*)
4475 cat <<EOM >&4
4476
4477*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4478EOM
4479 use64bitint="$define"
4480 ;;
4481esac
a1b03cdf
JH
4482case "$use64bitsall" in
4483"$define"|true|[yY]*)
4484 cat <<EOM >&4
4485
4486*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4487EOM
4488 use64bitall="$define"
4489 ;;
4490esac
10cc9d2a 4491
49c10eea 4492case "$ccflags" in
10cc9d2a 4493*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
49c10eea 4494esac
10cc9d2a
JH
4495case "$use64bitall" in
4496"$define"|true|[yY]*) use64bitint="$define" ;;
49c10eea
JH
4497esac
4498
4499case "$longsize" in
45008) cat <<EOM
4501
4502You have natively 64-bit long integers.
bd9b35c9 4503EOM
ad551343
JH
4504 val="$define"
4505 ;;
10cc9d2a 4506*) case "$use64bitint" in
49c10eea 4507 "$define"|true|[yY]*) dflt='y';;
ad551343
JH
4508 *) dflt='n';;
4509 esac
49c10eea 4510 cat <<EOM
29209bc5 4511
bd9b35c9 4512Perl can be built to take advantage of 64-bit integer types
10cc9d2a 4513on some systems. To do so, Configure can be run with -Duse64bitint.
49c10eea 4514Choosing this option will most probably introduce binary incompatibilities.
29209bc5 4515
ad551343 4516If this doesn't make any sense to you, just accept the default '$dflt'.
29209bc5 4517EOM
ad551343
JH
4518 rp='Try to use 64-bit integers, if available?'
4519 . ./myread
4520 case "$ans" in
4521 [yY]*) val="$define" ;;
4522 *) val="$undef" ;;
4523 esac
4524 ;;
29209bc5 4525esac
10cc9d2a 4526set use64bitint
29209bc5
JH
4527eval $setvar
4528
1acc7ade
JH
4529case "$use64bitall" in
4530"$define"|true|[yY]*) dflt='y' ;;
4531*) case "$longsize" in
4532 8) dflt='y' ;;
4533 *) dflt='n' ;;
4534 esac
4535 ;;
4536esac
843b3b0e
JH
4537cat <<EOM
4538
4539You may also choose to try maximal 64-bitness. It means using as much
454064-bitness as possible on the platform. This in turn means even more
4541binary incompatibilities. On the other hand, your platform may not
4542have any more 64-bitness available than what you already have chosen.
4543
4544If this doesn't make any sense to you, just accept the default '$dflt'.
4545EOM
4546rp='Try to use maximal 64-bit support, if available?'
4547. ./myread
4548case "$ans" in
4549[yY]*) val="$define" ;;
4550*) val="$undef" ;;
4551esac
10cc9d2a 4552set use64bitall
49c10eea 4553eval $setvar
843b3b0e
JH
4554case "$use64bitall" in
4555"$define")
4556 case "$use64bitint" in
4557 "$undef")
4558 cat <<EOM
4559
4560Since you have chosen a maximally 64-bit build, I'm also turning on
4561the use of 64-bit integers.
4562EOM
4563 use64bitint="$define" ;;
4564 esac
4565 ;;
4566esac
bd9b35c9 4567
10cc9d2a 4568case "$use64bitint" in
bd9b35c9
JH
4569"$define"|true|[yY]*)
4570: Look for a hint-file generated 'call-back-unit'. If the
4571: user has specified that a 64-bit perl is to be built,
4572: we may need to set or change some other defaults.
10cc9d2a 4573 if $test -f use64bitint.cbu; then
e5788f28 4574 echo "Your platform has some specific hints for 64-bit integers, using them..."
10cc9d2a 4575 . ./use64bitint.cbu
bd9b35c9 4576 fi
49c10eea 4577 case "$longsize" in
701a9a05 4578 4) case "$archname64" in
10cc9d2a 4579 '') archname64=64int ;;
49c10eea
JH
4580 esac
4581 ;;
4582 esac
4583 ;;
4584esac
4585
10cc9d2a 4586case "$use64bitall" in
49c10eea
JH
4587"$define"|true|[yY]*)
4588: Look for a hint-file generated 'call-back-unit'. If the
843b3b0e 4589: user has specified that a maximally 64-bit perl is to be built,
49c10eea 4590: we may need to set or change some other defaults.
10cc9d2a 4591 if $test -f use64bitall.cbu; then
843b3b0e 4592 echo "Your platform has some specific hints for 64-bit builds, using them..."
10cc9d2a 4593 . ./use64bitall.cbu
49c10eea
JH
4594 fi
4595 case "$longsize" in
c6861c9d 4596 4) case "$archname64" in
bab3591f 4597 ''|64int) archname64=64all ;;
49c10eea
JH
4598 esac
4599 ;;
4600 esac
bd9b35c9
JH
4601 ;;
4602esac
4603
4604: determine the architecture name
2afac517 4605echo " "
bd9b35c9
JH
4606if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4607 tarch=`arch`"-$osname"
4608elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4609 if uname -m > tmparch 2>&1 ; then
4610 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4611 -e 's/$/'"-$osname/" tmparch`
4612 else
4613 tarch="$osname"
4614 fi
4615 $rm -f tmparch
4616else
4617 tarch="$osname"
4618fi
4619case "$myarchname" in
4620''|"$tarch") ;;
4621*)
4622 echo "(Your architecture name used to be $myarchname.)"
4623 archname=''
4624 ;;
8e07c86e 4625esac
bd9b35c9
JH
4626myarchname="$tarch"
4627case "$archname" in
4628'') dflt="$tarch";;
4629*) dflt="$archname";;
2afac517 4630esac
bd9b35c9
JH
4631rp='What is your architecture name'
4632. ./myread
4633archname="$ans"
4634case "$usethreads" in
29209bc5 4635$define)
bd9b35c9
JH
4636 echo "Threads selected." >&4
4637 case "$archname" in
4638 *-thread*) echo "...and architecture name already has -thread." >&4
4639 ;;
4640 *) archname="$archname-thread"
4641 echo "...setting architecture name to $archname." >&4
4642 ;;
4643 esac
29209bc5
JH
4644 ;;
4645esac
bd9b35c9
JH
4646case "$usemultiplicity" in
4647$define)
4648 echo "Multiplicity selected." >&4
4649 case "$archname" in
4650 *-multi*) echo "...and architecture name already has -multi." >&4
4651 ;;
4652 *) archname="$archname-multi"
4653 echo "...setting architecture name to $archname." >&4
4654 ;;
4655 esac
4656 ;;
4657esac
10cc9d2a 4658case "$use64bitint" in
bd9b35c9
JH
4659$define)
4660 case "$archname64" in
4661 '')
4662 ;;
4663 *)
4664 case "$archname" in
4665 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4666 ;;
4667 *) archname="$archname-$archname64"
4668 echo "...setting architecture name to $archname." >&4
4669 ;;
4670 esac
4671 ;;
4672 esac
4673esac
4674
4675: determine root of directory hierarchy where package will be installed.
4676case "$prefix" in
4677'')
4678 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4679 ;;
4680*)
4681 dflt="$prefix"
4682 ;;
4683esac
4684$cat <<EOM
4685
4686By default, $package will be installed in $dflt/bin, manual pages
4687under $dflt/man, etc..., i.e. with $dflt as prefix for all
4688installation directories. Typically this is something like /usr/local.
4689If you wish to have binaries under /usr/bin but other parts of the
4690installation under /usr/local, that's ok: you will be prompted
4691separately for each of the installation directories, the prefix being
4692only used to set the defaults.
4693
4694EOM
4695fn=d~
4696rp='Installation prefix to use?'
4697. ./getfile
4698oldprefix=''
4699case "$prefix" in
4700'') ;;
4701*)
4702 case "$ans" in
4703 "$prefix") ;;
4704 *) oldprefix="$prefix";;
4705 esac
4706 ;;
4707esac
4708prefix="$ans"
4709prefixexp="$ansexp"
4710
4711: is AFS running?
4712echo " "
4713case "$afs" in
4714$define|true) afs=true ;;
4715$undef|false) afs=false ;;
4716*) if test -d /afs; then
4717 afs=true
2afac517 4718 else
bd9b35c9 4719 afs=false
2afac517 4720 fi
bd9b35c9 4721 ;;
8e07c86e 4722esac
bd9b35c9
JH
4723if $afs; then
4724 echo "AFS may be running... I'll be extra cautious then..." >&4
4725else
4726 echo "AFS does not seem to be running..." >&4
4727fi
2afac517 4728
bd9b35c9
JH
4729: determine installation prefix for where package is to be installed.
4730if $afs; then
4633a7c4 4731$cat <<EOM
29209bc5 4732
bd9b35c9
JH
4733Since you are running AFS, I need to distinguish the directory in which
4734files will reside from the directory in which they are installed (and from
4735which they are presumably copied to the former directory by occult means).
4736
4633a7c4 4737EOM
bd9b35c9
JH
4738 case "$installprefix" in
4739 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4740 *) dflt="$installprefix";;
4741 esac
4742else
4743$cat <<EOM
2afac517 4744
bd9b35c9
JH
4745In some special cases, particularly when building $package for distribution,
4746it is convenient to distinguish between the directory in which files should
4747be installed from the directory ($prefix) in which they
4748will eventually reside. For most users, these two directories are the same.
8e07c86e 4749
bd9b35c9
JH
4750EOM
4751 case "$installprefix" in
4752 '') dflt=$prefix ;;
4753 *) dflt=$installprefix;;
4754 esac
4755fi
4756fn=d~
4757rp='What installation prefix should I use for installing files?'
4758. ./getfile
4759installprefix="$ans"
4760installprefixexp="$ansexp"
4633a7c4 4761
bd9b35c9
JH
4762: set the prefixit variable, to compute a suitable default value
4763prefixit='case "$3" in
4764""|none)
4765 case "$oldprefix" in
4766 "") eval "$1=\"\$$2\"";;
4767 *)
4768 case "$3" in
4769 "") eval "$1=";;
4770 none)
4771 eval "tp=\"\$$2\"";
4772 case "$tp" in
4773 ""|" ") eval "$1=\"\$$2\"";;
4774 *) eval "$1=";;
4775 esac;;
4776 esac;;
4777 esac;;
4778*)
4779 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4780 case "$tp" in
4781 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4782 /*-$oldprefix/*|\~*-$oldprefix/*)
4783 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4784 *) eval "$1=\"\$$2\"";;
4785 esac;;
4786esac'
4633a7c4 4787
ff935051
JH
4788
4789: get the patchlevel
bd9b35c9
JH
4790echo " "
4791echo "Getting the current patchlevel..." >&4
4792if $test -r $rsrc/patchlevel.h;then
49c10eea 4793 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
bd9b35c9
JH
4794 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4795 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff935051
JH
4796 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4797 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4798 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bd9b35c9 4799else
49c10eea 4800 revision=0
bd9b35c9
JH
4801 patchlevel=0
4802 subversion=0
ff935051
JH
4803 api_revision=0
4804 api_version=0
4805 api_subversion=0
bd9b35c9 4806fi
49c10eea 4807$echo $n "(You have $package revision $revision" $c
bd9b35c9
JH
4808$echo $n " patchlevel $patchlevel" $c
4809test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4810echo ".)"
ff935051 4811case "$osname" in
3645a519 4812dos|vms)
ff935051 4813 : XXX Should be a Configure test for double-dots in filenames.
49c10eea 4814 version=`echo $revision $patchlevel $subversion | \
273cf8d1 4815 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
ff935051
JH
4816 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4817 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4818 ;;
4819*)
49c10eea 4820 version=`echo $revision $patchlevel $subversion | \
ff935051
JH
4821 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4822 api_versionstring=`echo $api_revision $api_version $api_subversion | \
273cf8d1 4823 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
ff935051
JH
4824 ;;
4825esac
4826: Special case the 5.005_xx maintenance series, which used 5.005
4827: without any subversion label as a subdirectory in $sitelib
4828if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4829 api_versionstring='5.005'
273cf8d1 4830fi
bd9b35c9
JH
4831
4832: determine installation style
4833: For now, try to deduce it from prefix unless it is already set.
4834: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4835case "$installstyle" in
4836'') case "$prefix" in
4837 *perl*) dflt='lib';;
4838 *) dflt='lib/perl5' ;;
34d1710f 4839 esac
4633a7c4 4840 ;;
d6c8a45d 4841*) dflt="$installstyle" ;;
4633a7c4 4842esac
bd9b35c9
JH
4843: Probably not worth prompting for this since we prompt for all
4844: the directories individually, and the prompt would be too long and
4845: confusing anyway.
4846installstyle=$dflt
4633a7c4 4847
bd9b35c9
JH
4848: determine where private library files go
4849: Usual default is /usr/local/lib/perl5/$version.
4850: Also allow things like /opt/perl/lib/$version, since
4851: /opt/perl/lib/perl5... would be redundant.
4852: The default "style" setting is made in installstyle.U
4853case "$installstyle" in
4854*lib/perl5*) set dflt privlib lib/$package/$version ;;
4855*) set dflt privlib lib/$version ;;
a4f3eea9 4856esac
bd9b35c9
JH
4857eval $prefixit
4858$cat <<EOM
a4f3eea9 4859
bd9b35c9
JH
4860There are some auxiliary files for $package that need to be put into a
4861private library directory that is accessible by everyone.
4862
4863EOM
4864fn=d~+
4865rp='Pathname where the private library files will reside?'
4866. ./getfile
4867privlib="$ans"
4868privlibexp="$ansexp"
4869: Change installation prefix, if necessary.
4870if $test X"$prefix" != X"$installprefix"; then
4871 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
a4f3eea9 4872else
bd9b35c9
JH
4873 installprivlib="$privlibexp"
4874fi
a4f3eea9 4875
bd9b35c9
JH
4876: set the prefixup variable, to restore leading tilda escape
4877prefixup='case "$prefixexp" in
4878"$prefix") ;;
4879*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4880esac'
a4f3eea9 4881
bd9b35c9
JH
4882: determine where public architecture dependent libraries go
4883set archlib archlib
4884eval $prefixit
4885: privlib default is /usr/local/lib/$package/$version
4886: archlib default is /usr/local/lib/$package/$version/$archname
4887: privlib may have an optional trailing /share.
4888tdflt=`echo $privlib | $sed 's,/share$,,'`
4889tdflt=$tdflt/$archname
4890case "$archlib" in
4891'') dflt=$tdflt
29209bc5 4892 ;;
bd9b35c9
JH
4893*) dflt="$archlib"
4894 ;;
29209bc5 4895esac
bd9b35c9 4896$cat <<EOM
29209bc5 4897
bd9b35c9
JH
4898$spackage contains architecture-dependent library files. If you are
4899sharing libraries in a heterogeneous environment, you might store
4900these files in a separate location. Otherwise, you can just include
4901them with the rest of the public library files.
a4f3eea9 4902
bd9b35c9
JH
4903EOM
4904fn=d+~
4905rp='Where do you want to put the public architecture-dependent libraries?'
4906. ./getfile
4907archlib="$ans"
4908archlibexp="$ansexp"
4909if $test X"$archlib" = X"$privlib"; then
4910 d_archlib="$undef"
4911else
4912 d_archlib="$define"
4913fi
4914: Change installation prefix, if necessary.
4915if $test X"$prefix" != X"$installprefix"; then
4916 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4917else
4918 installarchlib="$archlibexp"
4919fi
a4f3eea9 4920
a4f3eea9 4921
bd9b35c9
JH
4922: Binary compatibility with 5.005 is not possible for builds
4923: with advanced features
4924case "$usethreads$usemultiplicity" in
4925*define*)
4926 bincompat5005="$undef"
4927 d_bincompat5005="$undef"
4928 ;;
4929*) $cat <<EOM
a4f3eea9 4930
ee3551f5
GS
4931This version of Perl can be compiled for binary compatibility with 5.005.
4932If you decide to do so, you will be able to continue using most of the
4933extensions that were compiled for Perl 5.005.
a4f3eea9 4934
a4f3eea9 4935EOM
bd9b35c9
JH
4936 case "$bincompat5005$d_bincompat5005" in
4937 *"$undef"*) dflt=n ;;
4938 *) dflt=y ;;
a4f3eea9 4939 esac
bd9b35c9
JH
4940 rp='Binary compatibility with Perl 5.005?'
4941 . ./myread
4942 case "$ans" in
4943 y*) val="$define" ;;
4944 *) val="$undef" ;;
a4f3eea9 4945 esac
bd9b35c9
JH
4946 set d_bincompat5005
4947 eval $setvar
4948 case "$d_bincompat5005" in
4949 "$define")
4950 bincompat5005="$define"
4951 ;;
4952 *) bincompat5005="$undef"
4953 d_bincompat5005="$undef"
a4f3eea9 4954 ;;
4955 esac
bd9b35c9 4956 ;;
a4f3eea9 4957esac
4958
a4f3eea9 4959
bd9b35c9
JH
4960: see if setuid scripts can be secure
4961$cat <<EOM
a4f3eea9 4962
bd9b35c9
JH
4963Some kernels have a bug that prevents setuid #! scripts from being
4964secure. Some sites have disabled setuid #! scripts because of this.
a4f3eea9 4965
bd9b35c9
JH
4966First let's decide if your kernel supports secure setuid #! scripts.
4967(If setuid #! scripts would be secure but have been disabled anyway,
4968don't say that they are secure if asked.)
5ff3f7a4
GS
4969
4970EOM
a4f3eea9 4971
bd9b35c9
JH
4972val="$undef"
4973if $test -d /dev/fd; then
4974 echo "#!$ls" >reflect
4975 chmod +x,u+s reflect
4976 ./reflect >flect 2>&1
4977 if $contains "/dev/fd" flect >/dev/null; then
4978 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4979 val="$define"
4980 else
4981 $cat <<EOM
4982If you are not sure if they are secure, I can check but I'll need a
4983username and password different from the one you are using right now.
4984If you don't have such a username or don't want me to test, simply
4985enter 'none'.
a4f3eea9 4986
4987EOM
bd9b35c9
JH
4988 rp='Other username to test security of setuid scripts with?'
4989 dflt='none'
4990 . ./myread
4991 case "$ans" in
4992 n|none)
4993 case "$d_suidsafe" in
4994 '') echo "I'll assume setuid scripts are *not* secure." >&4
4995 dflt=n;;
4996 "$undef")
4997 echo "Well, the $hint value is *not* secure." >&4
4998 dflt=n;;
4999 *) echo "Well, the $hint value *is* secure." >&4
5000 dflt=y;;
dfe9444c
AD
5001 esac
5002 ;;
bd9b35c9
JH
5003 *)
5004 $rm -f reflect flect
5005 echo "#!$ls" >reflect
5006 chmod +x,u+s reflect
5007 echo >flect
5008 chmod a+w flect
5009 echo '"su" will (probably) prompt you for '"$ans's password."
5010 su $ans -c './reflect >flect'
5011 if $contains "/dev/fd" flect >/dev/null; then
5012 echo "Okay, it looks like setuid scripts are secure." >&4
5013 dflt=y
5014 else
5015 echo "I don't think setuid scripts are secure." >&4
5016 dflt=n
5017 fi
5018 ;;
5019 esac
5020 rp='Does your kernel have *secure* setuid scripts?'
5021 . ./myread
5022 case "$ans" in
5023 [yY]*) val="$define";;
5024 *) val="$undef";;
dfe9444c 5025 esac
a4f3eea9 5026 fi
5027else
bd9b35c9
JH
5028 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5029 echo "(That's for file descriptors, not floppy disks.)"
5030 val="$undef"
a4f3eea9 5031fi
bd9b35c9
JH
5032set d_suidsafe
5033eval $setvar
5034
5035$rm -f reflect flect
5036
5037: now see if they want to do setuid emulation
5038echo " "
5039val="$undef"
5040case "$d_suidsafe" in
5041"$define")
5042 val="$undef"
5043 echo "No need to emulate SUID scripts since they are secure here." >& 4
5044 ;;
5045*)
5046 $cat <<EOM
5047Some systems have disabled setuid scripts, especially systems where
5048setuid scripts cannot be secure. On systems where setuid scripts have
5049been disabled, the setuid/setgid bits on scripts are currently
5050useless. It is possible for $package to detect those bits and emulate
5051setuid/setgid in a secure fashion. This emulation will only work if
5052setuid scripts have been disabled in your kernel.
5053
5054EOM
5055 case "$d_dosuid" in
5056 "$define") dflt=y ;;
5057 *) dflt=n ;;
a4f3eea9 5058 esac
bd9b35c9 5059 rp="Do you want to do setuid/setgid emulation?"
a4f3eea9 5060 . ./myread
5061 case "$ans" in
bd9b35c9
JH
5062 [yY]*) val="$define";;
5063 *) val="$undef";;
a4f3eea9 5064 esac
5065 ;;
a4f3eea9 5066esac
bd9b35c9
JH
5067set d_dosuid
5068eval $setvar
a4f3eea9 5069
bfb7748a
AD
5070: determine filename position in cpp output
5071echo " "
5072echo "Computing filename position in cpp output for #include directives..." >&4
5073echo '#include <stdio.h>' > foo.c
5074$cat >fieldn <<EOF
5075$startsh
5076$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5077$grep '^[ ]*#.*stdio\.h' | \
5078while read cline; do
5079 pos=1
5080 set \$cline
5081 while $test \$# -gt 0; do
5082 if $test -r \`echo \$1 | $tr -d '"'\`; then
5083 echo "\$pos"
5084 exit 0
5085 fi
5086 shift
5087 pos=\`expr \$pos + 1\`
5088 done
5089done
5090EOF
5091chmod +x fieldn
5092fieldn=`./fieldn`
5093$rm -f foo.c fieldn
5094case $fieldn in
5095'') pos='???';;
50961) pos=first;;
50972) pos=second;;
50983) pos=third;;
5099*) pos="${fieldn}th";;
5100esac
5101echo "Your cpp writes the filename in the $pos field of the line."
5102
5103: locate header file
5104$cat >findhdr <<EOF
5105$startsh
5106wanted=\$1
9cc6feab 5107name=''
3656fc86
JH
5108for usrincdir in $usrinc
5109do
5110 if test -f \$usrincdir/\$wanted; then
5111 echo "\$usrincdir/\$wanted"
5112 exit 0
5113 fi
5114done
bfb7748a
AD
5115awkprg='{ print \$$fieldn }'
5116echo "#include <\$wanted>" > foo\$\$.c
5117$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5118$grep "^[ ]*#.*\$wanted" | \
5119while read cline; do
5120 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5121 case "\$name" in
4e400192
JH
5122 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5123 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5124 *) exit 2;;
bfb7748a
AD
5125 esac;
5126done;
4e400192
JH
5127#
5128# status = 0: grep returned 0 lines, case statement not executed
5129# status = 1: headerfile found
5130# status = 2: while loop executed, no headerfile found
5131#
5132status=\$?
bfb7748a 5133$rm -f foo\$\$.c;
4e400192
JH
5134if test \$status -eq 1; then
5135 exit 0;
5136fi
5137exit 1
bfb7748a
AD
5138EOF
5139chmod +x findhdr
5140
5141: define an alternate in-header-list? function
5142inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5143cont=true; xxf="echo \"<\$1> found.\" >&4";
5144case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5145*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5146esac;
5147case $# in 4) instead=instead;; *) instead="at last";; esac;
5148while $test "$cont"; do
5149 xxx=`./findhdr $1`
5150 var=$2; eval "was=\$$2";
5151 if $test "$xxx" && $test -r "$xxx";
5152 then eval $xxf;
5153 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5154 cont="";
5155 else eval $xxnf;
5156 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5157 set $yyy; shift; shift; yyy=$@;
5158 case $# in 0) cont="";;
5159 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5160 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5161 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5162 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5163 esac;
5164done;
5165while $test "$yyy";
5166do set $yyy; var=$2; eval "was=\$$2";
5167 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5168 set $yyy; shift; shift; yyy=$@;
5169done'
5170
5171: see if this is a malloc.h system
5172set malloc.h i_malloc
5173eval $inhdr
5174
5175: see if stdlib is available
5176set stdlib.h i_stdlib
5177eval $inhdr
5178
5179: determine which malloc to compile in
5180echo " "
5181case "$usemymalloc" in
5ff3f7a4
GS
5182''|[yY]*|true|$define) dflt='y' ;;
5183*) dflt='n' ;;
bfb7748a
AD
5184esac
5185rp="Do you wish to attempt to use the malloc that comes with $package?"
5186. ./myread
5187usemymalloc="$ans"
5188case "$ans" in
5189y*|true)
5190 usemymalloc='y'
5191 mallocsrc='malloc.c'
5192 mallocobj="malloc$_o"
5193 d_mymalloc="$define"
5194 case "$libs" in
5195 *-lmalloc*)
5196 : Remove malloc from list of libraries to use
5197 echo "Removing unneeded -lmalloc from library list" >&4
5198 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5199 shift
5200 libs="$*"
5201 echo "libs = $libs" >&4
5202 ;;
5203 esac
5204 ;;
5205*)
5206 usemymalloc='n'
5207 mallocsrc=''
5208 mallocobj=''
5209 d_mymalloc="$undef"
5210 ;;
5211esac
5212
5213: compute the return types of malloc and free
5214echo " "
5215$cat >malloc.c <<END
5216#$i_malloc I_MALLOC
5217#$i_stdlib I_STDLIB
5218#include <stdio.h>
5219#include <sys/types.h>
5220#ifdef I_MALLOC
5221#include <malloc.h>
5222#endif
5223#ifdef I_STDLIB
5224#include <stdlib.h>
5225#endif
5226#ifdef TRY_MALLOC
5227void *malloc();
5228#endif
5229#ifdef TRY_FREE
5230void free();
5231#endif
5232END
5233case "$malloctype" in
5234'')
5235 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5236 malloctype='void *'
5237 else
5238 malloctype='char *'
5239 fi
5240 ;;
5241esac
5242echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5243
5244case "$freetype" in
5245'')
5246 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5247 freetype='void'
5248 else
5249 freetype='int'
5250 fi
5251 ;;
5252esac
5253echo "Your system uses $freetype free(), it would seem." >&4
5254$rm -f malloc.[co]
a3635516
JH
5255$cat <<EOM
5256
5257The installation process will also create a directory for
5258vendor-supplied add-ons. Vendors who supply perl with their system
5259may find it convenient to place all vendor-supplied files in this
5260directory rather than in the main distribution directory. This will
5261ease upgrades between binary-compatible maintenance versions of perl.
5262
5263Of course you may also use these directories in whatever way you see
5264fit. For example, you might use them to access modules shared over a
5265company-wide network.
5266
5267The default answer should be fine for most people.
5268This causes further questions about vendor add-ons to be skipped
5269and no vendor-specific directories will be configured for perl.
5270
5271EOM
5272rp='Do you want to configure vendor-specific add-on directories?'
5273case "$usevendorprefix" in
5274define|true|[yY]*) dflt=y ;;
49c10eea
JH
5275*) : User may have set vendorprefix directly on Configure command line.
5276 case "$vendorprefix" in
5277 ''|' ') dflt=n ;;
5278 *) dflt=y ;;
5279 esac
5280 ;;
a3635516
JH
5281esac
5282. ./myread
5283case "$ans" in
5284[yY]*) fn=d~+
5285 rp='Installation prefix to use for vendor-supplied add-ons?'
5286 case "$vendorprefix" in
5287 '') dflt='' ;;
5288 *) dflt=$vendorprefix ;;
5289 esac
5290 . ./getfile
49c10eea 5291 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
a3635516
JH
5292 oldvendorprefix=''
5293 case "$vendorprefix" in
5294 '') ;;
5295 *) case "$ans" in
5296 "$prefix") ;;
5297 *) oldvendorprefix="$prefix";;
5298 esac
5299 ;;
5300 esac
5301 usevendorprefix="$define"
5302 vendorprefix="$ans"
5303 vendorprefixexp="$ansexp"
5304 ;;
5305*) usevendorprefix="$undef"
5306 vendorprefix=''
5307 vendorprefixexp=''
5308 ;;
5309esac
5310
5311case "$vendorprefix" in
5312'') d_vendorlib="$undef"
5313 vendorlib=''
5314 vendorlibexp=''
5315 ;;
5316*) d_vendorlib="$define"
5317 : determine where vendor-supplied modules go.
629ae163 5318 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
49c10eea
JH
5319 case "$vendorlib" in
5320 '')
5321 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5322 case "$installstyle" in
5323 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5324 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5325 esac
5326 ;;
5327 *) dflt="$vendorlib"
5328 ;;
a3635516
JH
5329 esac
5330 fn=d~+
5331 rp='Pathname for the vendor-supplied library files?'
5332 . ./getfile
5333 vendorlib="$ans"
5334 vendorlibexp="$ansexp"
a3635516
JH
5335 ;;
5336esac
526fdc24 5337vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
49c10eea
JH
5338: Change installation prefix, if necessary.
5339if $test X"$prefix" != X"$installprefix"; then
5340 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5341else
5342 installvendorlib="$vendorlibexp"
5343fi
a3635516 5344
526fdc24
MS
5345case "$vendorprefix" in
5346'') d_vendorarch="$undef"
5347 vendorarch=''
5348 vendorarchexp=''
5349 ;;
5350*) d_vendorarch="$define"
5351 : determine where vendor-supplied architecture-dependent libraries go.
5352 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
5353 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5354 : vendorlib may have an optional trailing /share.
5355 case "$vendorarch" in
5356 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
5357 dflt="$dflt/$archname"
5358 ;;
5359 *) dflt="$vendorarch" ;;
5360 esac
5361 fn=d~+
5362 rp='Pathname for vendor-supplied architecture-dependent files?'
5363 . ./getfile
5364 vendorarch="$ans"
5365 vendorarchexp="$ansexp"
5366 ;;
5367esac
5368: Change installation prefix, if necessary.
5369if $test X"$prefix" != X"$installprefix"; then
5370 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5371else
5372 installvendorarch="$vendorarchexp"
5373fi
5374
3b777bb4
GS
5375: Final catch-all directories to search
5376$cat <<EOM
5377
5378Lastly, you can have perl look in other directories for extensions and
5379modules in addition to those already specified.
5380These directories will be searched after
5381 $sitearch
5382 $sitelib
5383EOM
5384test X"$vendorlib" != "X" && echo ' ' $vendorlib
5385test X"$vendorarch" != "X" && echo ' ' $vendorarch
5386echo ' '
5387case "$otherlibdirs" in
5388''|' ') dflt='none' ;;
5389*) dflt="$otherlibdirs" ;;
5390esac
5391$cat <<EOM
5392Enter a colon-separated set of extra paths to include in perl's @INC
5393search path, or enter 'none' for no extra paths.
5394
5395EOM
5396
5397rp='Colon-separated list of additional directories for perl to search?'
5398. ./myread
5399case "$ans" in
5400' '|''|none) otherlibdirs=' ' ;;
5401*) otherlibdirs="$ans" ;;
5402esac
5403case "$otherlibdirs" in
5404' ') val=$undef ;;
5405*) val=$define ;;
5406esac
5407set d_perl_otherlibdirs
5408eval $setvar
5409
c4f23d77
AD
5410: Cruising for prototypes
5411echo " "
5412echo "Checking out function prototypes..." >&4
5413$cat >prototype.c <<'EOCP'
5a411a32 5414int main(int argc, char *argv[]) {
c4f23d77
AD
5415 exit(0);}
5416EOCP
5417if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5418 echo "Your C compiler appears to support function prototypes."
5419 val="$define"
5420else
5421 echo "Your C compiler doesn't seem to understand function prototypes."
5422 val="$undef"
5423fi
5424set prototype
5425eval $setvar
5426$rm -f prototype*
5427
5428case "$prototype" in
5429"$define") ;;
5430*) ansi2knr='ansi2knr'
5431 echo " "
5432 cat <<EOM >&4
5433
5434$me: FATAL ERROR:
5435This version of $package can only be compiled by a compiler that
5436understands function prototypes. Unfortunately, your C compiler
5437 $cc $ccflags
5438doesn't seem to understand them. Sorry about that.
5439
5ff3f7a4 5440If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
5441
5442Eventually, we hope to support building Perl with pre-ANSI compilers.
5443If you would like to help in that effort, please contact <perlbug@perl.org>.
5444
5445Aborting Configure now.
5446EOM
5447 exit 2
5448 ;;
5449esac
5450
5451: determine where public executables go
5452echo " "
5453set dflt bin bin
5454eval $prefixit
5455fn=d~
5456rp='Pathname where the public executables will reside?'
5457. ./getfile
5458if $test "X$ansexp" != "X$binexp"; then
5459 installbin=''
5460fi
5461bin="$ans"
5462binexp="$ansexp"
dd4e71fd
JH
5463: Change installation prefix, if necessary.
5464: XXX Bug? -- ignores Configure -Dinstallprefix setting.
5465if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5466 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5467else
5468 installbin="$binexp"
c4f23d77
AD
5469fi
5470
49c10eea
JH
5471: Find perl5.005 or later.
5472echo "Looking for a previously installed perl5.005 or later... "
5473case "$perl5" in
5474'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5475 : Check if this perl is recent and can load a simple module
5476 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5477 perl5=$tdir/perl
5478 break;
5479 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5480 perl5=$tdir/perl
5481 break;
5482 fi
5483 done
5484 ;;
5485*) perl5="$perl5"
5486 ;;
5487esac
5488case "$perl5" in
5489'') echo "None found. That's ok.";;
5490*) echo "Using $perl5." ;;
5491esac
5492
ff935051
JH
5493$cat <<EOM
5494
5495After $package is installed, you may wish to install various
5496add-on modules and utilities. Typically, these add-ons will
5497be installed under $prefix with the rest
5498of this package. However, you may wish to install such add-ons
5499elsewhere under a different prefix.
5500
5501If you do not wish to put everything under a single prefix, that's
5502ok. You will be prompted for the individual locations; this siteprefix
5503is only used to suggest the defaults.
5504
5505The default should be fine for most people.
5506
5507EOM
5508fn=d~+
5509rp='Installation prefix to use for add-on modules and utilities?'
5510: XXX Here might be another good place for an installstyle setting.
5511case "$siteprefix" in
5512'') dflt=$prefix ;;
5513*) dflt=$siteprefix ;;
5514esac
5515. ./getfile
49c10eea 5516: XXX Prefixit unit does not yet support siteprefix and vendorprefix
ff935051
JH
5517oldsiteprefix=''
5518case "$siteprefix" in
5519'') ;;
49c10eea 5520*) case "$ans" in
ff935051
JH
5521 "$prefix") ;;
5522 *) oldsiteprefix="$prefix";;
5523 esac
5524 ;;
5525esac
5526siteprefix="$ans"
5527siteprefixexp="$ansexp"
5528
5529: determine where site specific libraries go.
5530: Usual default is /usr/local/lib/perl5/site_perl/$version
5531: The default "style" setting is made in installstyle.U
5532: XXX No longer works with Prefixit stuff.
5533prog=`echo $package | $sed 's/-*[0-9.]*$//'`
49c10eea
JH
5534case "$sitelib" in
5535'') case "$installstyle" in
5536 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5537 *) dflt=$siteprefix/lib/site_$prog/$version ;;
5538 esac
5539 ;;
5540*) dflt="$sitelib"
5541 ;;
ff935051
JH
5542esac
5543$cat <<EOM
5544
5545The installation process will create a directory for
5546site-specific extensions and modules. Most users find it convenient
5547to place all site-specific files in this directory rather than in the
5548main distribution directory.
5549
5550EOM
5551fn=d~+
5552rp='Pathname for the site-specific library files?'
5553. ./getfile
5554sitelib="$ans"
5555sitelibexp="$ansexp"
526fdc24 5556sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
ff935051
JH
5557: Change installation prefix, if necessary.
5558if $test X"$prefix" != X"$installprefix"; then
49c10eea 5559 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
ff935051
JH
5560else
5561 installsitelib="$sitelibexp"
5562fi
5563
5564: Determine list of previous versions to include in @INC
5565$cat > getverlist <<EOPL
49c10eea 5566#!$perl5 -w
ff935051
JH
5567use File::Basename;
5568\$api_versionstring = "$api_versionstring";
5569\$version = "$version";
92d29cee 5570\$stem = "$sitelib_stem";
ff935051
JH
5571\$archname = "$archname";
5572EOPL
5573 $cat >> getverlist <<'EOPL'
5574# Can't have leading @ because metaconfig interprets it as a command!
5575;@inc_version_list=();
49c10eea 5576# XXX Redo to do opendir/readdir?
ff935051
JH
5577if (-d $stem) {
5578 chdir($stem);
5579 ;@candidates = glob("5.*");
5580}
5581else {
5582 ;@candidates = ();
5583}
5584
937ac629
JH
5585# XXX ToDo: These comparisons must be reworked when two-digit
5586# subversions come along, so that 5.7.10 compares as greater than
5587# 5.7.3! By that time, hope that 5.6.x is sufficiently
5588# widespread that we can use the built-in version vectors rather
5589# than reinventing them here. For 5.6.0, however, we must
5590# assume this script will likely be run by 5.005_0x. --AD 1/2000.
ff935051
JH
5591foreach $d (@candidates) {
5592 if ($d lt $version) {
5593 if ($d ge $api_versionstring) {
9a170fb4 5594 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
ff935051
JH
5595 }
5596 elsif ($d ge "5.005") {
9a170fb4 5597 unshift(@inc_version_list, grep { -d } $d);
ff935051
JH
5598 }
5599 }
5600 else {
5601 # Skip newer version. I.e. don't look in
5602 # 5.7.0 if we're installing 5.6.1.
5603 }
5604}
5605
5606if (@inc_version_list) {
3a096bf3 5607 print join(' ', @inc_version_list);
ff935051
JH
5608}
5609else {
5610 # Blank space to preserve value for next Configure run.
5611 print " ";
5612}
5613EOPL
5614chmod +x getverlist
5615case "$inc_version_list" in
49c10eea
JH
5616'') if test -x "$perl5"; then
5617 dflt=`$perl5 getverlist`
ff935051 5618 else
3a096bf3 5619 dflt='none'
ff935051
JH
5620 fi
5621 ;;
3a096bf3 5622$undef) dflt='none' ;;
ff935051
JH
5623*) dflt="$inc_version_list" ;;
5624esac
49c10eea
JH
5625case "$dflt" in
5626''|' ') dflt=none ;;
5627esac
ff935051
JH
5628$cat <<'EOM'
5629
5630In order to ease the process of upgrading, this version of perl
5631can be configured to use modules built and installed with earlier
5632versions of perl that were installed under $prefix. Specify here
5633the list of earlier versions that this version of perl should check.
5634If Configure detected no earlier versions of perl installed under
3a096bf3
JH
5635$prefix, then the list will be empty. Answer 'none' to tell perl
5636to not search earlier versions.
ff935051
JH
5637
5638The default should almost always be sensible, so if you're not sure,
5639just accept the default.
5640EOM
5641
3a096bf3 5642rp='List of earlier versions to include in @INC?'
ff935051 5643. ./myread
3a096bf3 5644case "$ans" in
49c10eea 5645[Nn]one|''|' ') inc_version_list=' ' ;;
3a096bf3
JH
5646*) inc_version_list="$ans" ;;
5647esac
5648case "$inc_version_list" in
5649''|' ')
82aaaa3c 5650 inc_version_list_init='0';;
3a096bf3 5651*) inc_version_list_init=`echo $inc_version_list |
82aaaa3c 5652 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
3a096bf3
JH
5653 ;;
5654esac
ff935051
JH
5655$rm -f getverlist
5656
104d25b7
JH
5657: determine whether to install perl also as /usr/bin/perl
5658
5659echo " "
dd4e71fd 5660if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7 5661 $cat <<EOM
526fdc24 5662Many scripts expect perl to be installed as /usr/bin/perl.
104d25b7
JH
5663I can install the perl you are about to compile also as /usr/bin/perl
5664(in addition to $installbin/perl).
5665EOM
472a4973
JH
5666 case "$installusrbinperl" in
5667 "$undef"|[nN]*) dflt='n';;
5668 *) dflt='y';;
5669 esac
104d25b7
JH
5670 rp="Do you want to install perl as /usr/bin/perl?"
5671 . ./myread
5672 case "$ans" in
5673 [yY]*) val="$define";;
472a4973 5674 *) val="$undef" ;;
104d25b7 5675 esac
472a4973
JH
5676else
5677 val="$undef"
5678fi
104d25b7
JH
5679set installusrbinperl
5680eval $setvar
5681
a4f3eea9 5682echo " "
5683echo "Checking for GNU C Library..." >&4
5684cat >gnulibc.c <<EOM
aebf16e7 5685#include <stdio.h>
5a411a32 5686int main()
a4f3eea9 5687{
aebf16e7
AD
5688#ifdef __GLIBC__
5689 exit(0);
5690#else
5691 exit(1);
5692#endif
a4f3eea9 5693}
5694EOM
dfe9444c 5695set gnulibc
aebf16e7 5696if eval $compile_ok && ./gnulibc; then
a4f3eea9 5697 val="$define"
5698 echo "You are using the GNU C Library"
4633a7c4 5699else
a4f3eea9 5700 val="$undef"
5701 echo "You are not using the GNU C Library"
4633a7c4 5702fi
a4f3eea9 5703$rm -f gnulibc*
5704set d_gnulibc
5705eval $setvar
25f94b33 5706
a4f3eea9 5707: see if nm is to be used to determine whether a symbol is defined or not
5708case "$usenm" in
5709'')
dc45a647 5710 dflt=''
a4f3eea9 5711 case "$d_gnulibc" in
dc45a647
MB
5712 "$define")
5713 echo " "
5714 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 5715 dflt=n
5716 ;;
dc45a647
MB
5717 esac
5718 case "$dflt" in
5719 '')
5720 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5721 echo " "
5722 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5723 echo "'nm' won't be sufficient on this sytem." >&4
5724 dflt=n
5725 fi
5726 ;;
5727 esac
5728 case "$dflt" in
c4f23d77 5729 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 5730 if $test $dflt -gt 20; then
5731 dflt=y
5732 else
5733 dflt=n
5734 fi
5735 ;;
5736 esac
5737 ;;
5738*)
5739 case "$usenm" in
dc45a647 5740 true|$define) dflt=y;;
a4f3eea9 5741 *) dflt=n;;
5742 esac
5743 ;;
25f94b33 5744esac
a4f3eea9 5745$cat <<EOM
4633a7c4 5746
dc45a647
MB
5747I can use $nm to extract the symbols from your C libraries. This
5748is a time consuming task which may generate huge output on the disk (up
5749to 3 megabytes) but that should make the symbols extraction faster. The
5750alternative is to skip the 'nm' extraction part and to compile a small
5751test program instead to determine whether each symbol is present. If
5752you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5753this may be the best solution.
5754
5755You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 5756
a4f3eea9 5757EOM
693762b4 5758rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
5759. ./myread
5760case "$ans" in
dc45a647 5761[Nn]*) usenm=false;;
a4f3eea9 5762*) usenm=true;;
4633a7c4
LW
5763esac
5764
a4f3eea9 5765runnm=$usenm
5766case "$reuseval" in
5767true) runnm=false;;
4633a7c4 5768esac
a4f3eea9 5769
5770: nm options which may be necessary
5771case "$nm_opt" in
5772'') if $test -f /mach_boot; then
1e422769 5773 nm_opt='' # Mach
a4f3eea9 5774 elif $test -d /usr/ccs/lib; then
1e422769 5775 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 5776 elif $test -f /dgux; then
1e422769 5777 nm_opt='-p' # DG-UX
2ae324a7 5778 elif $test -f /lib64/rld; then
1e422769 5779 nm_opt='-p' # 64-bit Irix
a4f3eea9 5780 else
5781 nm_opt=''
5782 fi;;
4633a7c4 5783esac
4633a7c4 5784
a4f3eea9 5785: nm options which may be necessary for shared libraries but illegal
5786: for archive libraries. Thank you, Linux.
5787case "$nm_so_opt" in
5788'') case "$myuname" in
5789 *linux*)
693762b4 5790 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 5791 nm_so_opt='--dynamic'
4633a7c4 5792 fi
a4f3eea9 5793 ;;
4633a7c4 5794 esac
4633a7c4
LW
5795 ;;
5796esac
5797
a4f3eea9 5798case "$runnm" in
5799true)
5800: get list of predefined functions in a handy place
5801echo " "
5802case "$libc" in
5803'') libc=unknown
5804 case "$libs" in
dfe9444c 5805 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 5806 esac
5807 ;;
5808esac
5809libnames='';
5810case "$libs" in
5811'') ;;
5812*) for thislib in $libs; do
5813 case "$thislib" in
5814 -lc|-lc_s)
5815 : Handle C library specially below.
5816 ;;
5817 -l*)
5818 thislib=`echo $thislib | $sed -e 's/^-l//'`
5819 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5820 :
5821 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5822 :
dfe9444c 5823 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 5824 :
dfe9444c 5825 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 5826 :
a4f3eea9 5827 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5828 :
5829 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5830 :
dfe9444c 5831 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 5832 :
5833 else
5834 try=''
5835 fi
5836 libnames="$libnames $try"
5837 ;;
5838 *) libnames="$libnames $thislib" ;;
5839 esac
5840 done
5841 ;;
5842esac
5843xxx=normal
5844case "$libc" in
5845unknown)
5846 set /lib/libc.$so
5847 for xxx in $libpth; do
5848 $test -r $1 || set $xxx/libc.$so
5849 : The messy sed command sorts on library version numbers.
5850 $test -r $1 || \
5851 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 5852 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 5853 h
5854 s/[0-9][0-9]*/0000&/g
5855 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5856 G
5857 s/\n/ /' | \
dfe9444c 5858 sort | $sed -e 's/^.* //'`
a4f3eea9 5859 eval set \$$#
5860 done
5861 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
5862 $test -r $1 || set /lib/libsys_s$_a
5863 ;;
a4f3eea9 5864*)
5865 set blurfl
5866 ;;
5867esac
5868if $test -r "$1"; then
5869 echo "Your (shared) C library seems to be in $1."
5870 libc="$1"
5871elif $test -r /lib/libc && $test -r /lib/clib; then
5872 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5873 xxx=apollo
5874 libc='/lib/clib /lib/libc'
5875 if $test -r /lib/syslib; then
5876 echo "(Your math library is in /lib/syslib.)"
5877 libc="$libc /lib/syslib"
5878 fi
5879elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5880 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
5881elif $test -r $incpath/usr/lib/libc$_a; then
5882 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 5883 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
5884elif $test -r /lib/libc$_a; then
5885 libc=/lib/libc$_a;
a4f3eea9 5886 echo "Your C library seems to be in $libc. You're normal."
5887else
dfe9444c 5888 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 5889 :
5890 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5891 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5892 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5893 :
dfe9444c 5894 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5895 :
dfe9444c 5896 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5897 :
4633a7c4 5898 else
dfe9444c 5899 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 5900 fi
a4f3eea9 5901 if $test -r "$tans"; then
5902 echo "Your C library seems to be in $tans, of all places."
5903 libc=$tans
5904 else
5905 libc='blurfl'
5906 fi
5907fi
5908if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5909 dflt="$libc"
5910 cat <<EOM
4633a7c4 5911
a4f3eea9 5912If the guess above is wrong (which it might be if you're using a strange
5913compiler, or your machine supports multiple models), you can override it here.
4633a7c4 5914
a4f3eea9 5915EOM
5916else
5917 dflt=''
28e8609d 5918 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 5919 cat >&4 <<EOM
5920I can't seem to find your C library. I've looked in the following places:
4633a7c4 5921
a4f3eea9 5922EOM
5923 $sed 's/^/ /' libpath
5924 cat <<EOM
4633a7c4 5925
a4f3eea9 5926None of these seems to contain your C library. I need to get its name...
4633a7c4 5927
a4f3eea9 5928EOM
5929fi
5930fn=f
5931rp='Where is your C library?'
5932. ./getfile
5933libc="$ans"
4633a7c4 5934
4633a7c4 5935echo " "
28e8609d 5936echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 5937set X `cat libnames`
4633a7c4 5938shift
a4f3eea9 5939xxx=files
5940case $# in 1) xxx=file; esac
5941echo "Extracting names from the following $xxx for later perusal:" >&4
5942echo " "
5943$sed 's/^/ /' libnames >&4
5944echo " "
5945$echo $n "This may take a while...$c" >&4
4633a7c4 5946
dfe9444c
AD
5947for file in $*; do
5948 case $file in
693762b4
AD
5949 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5950 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5951 esac
dfe9444c 5952done >libc.tmp
4633a7c4 5953
a4f3eea9 5954$echo $n ".$c"
5955$grep fprintf libc.tmp > libc.ptf
5956xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5957xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5958xxx='[ADTSIW]'
5959if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5960 eval $xscan;\
5961 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5962 eval $xrun
5963elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5964 eval $xscan;\
5965 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5966 eval $xrun
5967elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5968 eval $xscan;\
5969 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5970 eval $xrun
5971elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5972 eval $xscan;\
5973 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5974 eval $xrun
5975elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5976 eval $xscan;\
5977 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5978 eval $xrun
5979elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5980 eval $xscan;\
5981 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5982 eval $xrun
5983elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5984 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5985 eval $xscan;\
5986 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5987 eval $xrun
5988elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5989 eval $xscan;\
5990 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5991 eval $xrun
5992elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5993 eval $xscan;\
5994 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5995 eval $xrun
1e422769 5996elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5997 eval $xscan;\
5998 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5999 eval $xrun
a4f3eea9 6000elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6001 eval $xscan;\
6002 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6003 eval $xrun
6004elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6005 eval $xscan;\
6006 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6007 eval $xrun
44a8e56a 6008elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6009 eval $xscan;\
6010 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6011 eval $xrun
0f502cca
BL
6012elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
6013 eval $xscan;\
6014 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6015 eval $xrun
a4f3eea9 6016else
693762b4 6017 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 6018 $grep fprintf libc.tmp > libc.ptf
6019 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6020 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6021 then
6022 nm_opt='-p'
6023 eval $xrun
4633a7c4 6024 else
a4f3eea9 6025 echo " "
e5c9fcd0 6026 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 6027 com=''
dc45a647
MB
6028 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6029 for thisname in $libnames $libc; do
e5c9fcd0 6030 $ar t $thisname >>libc.tmp
a4f3eea9 6031 done
dfe9444c 6032 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 6033 echo "Ok." >&4
dc45a647
MB
6034 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6035 # Repeat libc to extract forwarders to DLL entries too
6036 for thisname in $libnames $libc; do
6037 $ar tv $thisname >>libc.tmp
6038 # Revision 50 of EMX has bug in $ar.
6039 # it will not extract forwarders to DLL entries
6040 # Use emximp which will extract exactly them.
6041 emximp -o tmp.imp $thisname \
6042 2>/dev/null && \
6043 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6044 < tmp.imp >>libc.tmp
6045 $rm tmp.imp
6046 done
6047 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6048 echo "Ok." >&4
a4f3eea9 6049 else
e5c9fcd0 6050 echo "$ar didn't seem to work right." >&4
a4f3eea9 6051 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 6052 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 6053 then
6054 for thisname in $libnames; do
6055 bld t $libnames | \
dfe9444c 6056 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 6057 $ar t $thisname >>libc.tmp
a4f3eea9 6058 done
6059 echo "Ok." >&4
6060 else
6061 echo "That didn't work either. Giving up." >&4
6062 exit 1
6063 fi
6064 fi
4633a7c4 6065 fi
4633a7c4 6066fi
a4f3eea9 6067nm_extract="$com"
6068if $test -f /lib/syscalls.exp; then
4633a7c4 6069 echo " "
a4f3eea9 6070 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 6071 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 6072fi
6073;;
6074esac
6075$rm -f libnames libpath
6076
2afac517 6077: see if dld is available
6078set dld.h i_dld
6079eval $inhdr
4633a7c4 6080
2afac517 6081: is a C symbol defined?
6082csym='tlook=$1;
6083case "$3" in
6084-v) tf=libc.tmp; tc=""; tdc="";;
6085-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6086*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6087esac;
6088tx=yes;
6089case "$reuseval-$4" in
6090true-) ;;
6091true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6092esac;
6093case "$tx" in
6094yes)
6095 case "$runnm" in
6096 true)
6097 if $contains $tlook $tf >/dev/null 2>&1;
6098 then tval=true;
6099 else tval=false;
6100 fi;;
6101 *)
d674cd6d 6102 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 6103 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 6104 then tval=true;
6105 else tval=false;
6106 fi;
6107 $rm -f t t.c;;
6108 esac;;
6109*)
6110 case "$tval" in
6111 $define) tval=true;;
6112 *) tval=false;;
6113 esac;;
6114esac;
6115eval "$2=$tval"'
4633a7c4 6116
2afac517 6117: define an is-in-libc? function
6118inlibc='echo " "; td=$define; tu=$undef;
6119sym=$1; var=$2; eval "was=\$$2";
6120tx=yes;
6121case "$reuseval$was" in
6122true) ;;
6123true*) tx=no;;
6124esac;
6125case "$tx" in
6126yes)
6127 set $sym tres -f;
6128 eval $csym;
6129 case "$tres" in
6130 true)
6131 echo "$sym() found." >&4;
6132 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6133 *)
6134 echo "$sym() NOT found." >&4;
6135 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6136 esac;;
6137*)
6138 case "$was" in
6139 $define) echo "$sym() found." >&4;;
6140 *) echo "$sym() NOT found." >&4;;
6141 esac;;
6142esac'
4633a7c4 6143
2afac517 6144: see if dlopen exists
6145xxx_runnm="$runnm"
6146runnm=false
6147set dlopen d_dlopen
6148eval $inlibc
6149runnm="$xxx_runnm"
40a7a20a 6150
2afac517 6151: determine which dynamic loading, if any, to compile in
4633a7c4 6152echo " "
2afac517 6153dldir="ext/DynaLoader"
6154case "$usedl" in
6155$define|y|true)
6156 dflt='y'
6157 usedl="$define"
6158 ;;
6159$undef|n|false)
6160 dflt='n'
6161 usedl="$undef"
6162 ;;
6163*)
6164 dflt='n'
6165 case "$d_dlopen" in
6166 $define) dflt='y' ;;
6167 esac
6168 case "$i_dld" in
6169 $define) dflt='y' ;;
4633a7c4 6170 esac
2afac517 6171 : Does a dl_xxx.xs file exist for this operating system
dc45a647 6172 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
6173 ;;
6174esac
2afac517 6175rp="Do you wish to use dynamic loading?"
6176. ./myread
6177usedl="$ans"
6178case "$ans" in
6179y*) usedl="$define"
6180 case "$dlsrc" in
6181 '')
dc45a647 6182 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 6183 dflt="$dldir/dl_${osname}.xs"
6184 elif $test "$d_dlopen" = "$define" ; then
6185 dflt="$dldir/dl_dlopen.xs"
6186 elif $test "$i_dld" = "$define" ; then
6187 dflt="$dldir/dl_dld.xs"
4633a7c4 6188 else
2afac517 6189 dflt=''
4633a7c4 6190 fi
4633a7c4 6191 ;;
2afac517 6192 *) dflt="$dldir/$dlsrc"
6193 ;;
4633a7c4 6194 esac
2afac517 6195 echo "The following dynamic loading files are available:"
6196 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
6197 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6198 rp="Source file to use for dynamic loading"
6199 fn="fne"
b233458b 6200 gfpth="$src"
dc45a647 6201 . ./getfile
2afac517 6202 usedl="$define"
6203 : emulate basename
1e127011 6204 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
2304df62 6205
dc45a647 6206 $cat << EOM
2304df62 6207
2afac517 6208Some systems may require passing special flags to $cc -c to
6209compile modules that will be used to create a shared library.
6210To use no flags, say "none".
2304df62
AD
6211
6212EOM
2afac517 6213 case "$cccdlflags" in
6214 '') case "$gccversion" in
6215 '') case "$osname" in
6216 hpux) dflt='+z' ;;
6217 next) dflt='none' ;;
8cc95fdb 6218 irix*) dflt='-KPIC' ;;
3a6175e1 6219 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 6220 sunos) dflt='-pic' ;;
6221 *) dflt='none' ;;
dfe9444c
AD
6222 esac
6223 ;;
6224 *) case "$osname" in
3a6175e1 6225 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 6226 *) dflt='-fpic' ;;
81d89818 6227 esac ;;
2afac517 6228 esac ;;
bfb7748a 6229 ' ') dflt='none' ;;
2afac517 6230 *) dflt="$cccdlflags" ;;
6231 esac
6232 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6233 . ./myread
6234 case "$ans" in
6235 none) cccdlflags=' ' ;;
6236 *) cccdlflags="$ans" ;;
6237 esac
2304df62 6238
2afac517 6239 cat << EOM
ecfc5424 6240
2afac517 6241Some systems use ld to create libraries that can be dynamically loaded,
6242while other systems (such as those using ELF) use $cc.
a0f45b59 6243
2afac517 6244EOM
6245 case "$ld" in
6246 '') $cat >try.c <<'EOM'
6247/* Test for whether ELF binaries are produced */
6248#include <fcntl.h>
6249#include <stdlib.h>
5a411a32 6250int main() {
2afac517 6251 char b[4];
6252 int i = open("a.out",O_RDONLY);
6253 if(i == -1)
6254 exit(1); /* fail */
6255 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6256 exit(0); /* succeed (yes, it's ELF) */
2304df62 6257 else
2afac517 6258 exit(1); /* fail */
6259}
6260EOM
6261 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6262 cat <<EOM
6263You appear to have ELF support. I'll use $cc to build dynamic libraries.
6264EOM
6265 dflt="$cc"
2304df62 6266 else
2afac517 6267 echo "I'll use ld to build dynamic libraries."
6268 dflt='ld'
2304df62 6269 fi
2afac517 6270 rm -f try.c a.out
6271 ;;
6272 *) dflt="$ld"
6273 ;;
6274 esac
6275
6276 rp="What command should be used to create dynamic libraries?"
6277 . ./myread
6278 ld="$ans"
6279
6280 cat << EOM
6281
6282Some systems may require passing special flags to $ld to create a
6283library that can be dynamically loaded. If your ld flags include
6284-L/other/path options to locate libraries outside your loader's normal
6285search path, you may need to specify those -L options here as well. To
6286use no flags, say "none".
6287
6288EOM
6289 case "$lddlflags" in
6290 '') case "$osname" in
46193409 6291 beos) dflt='-nostart' ;;
a5f83cbf
JH
6292 hpux) dflt='-b';
6293 case "$gccversion" in
6294 '') dflt="$dflt +vnocompatwarnings" ;;
b36fec95
JH
6295 esac
6296 ;;
2afac517 6297 linux|irix*) dflt='-shared' ;;
6298 next) dflt='none' ;;
6299 solaris) dflt='-G' ;;
6300 sunos) dflt='-assert nodefinitions' ;;
6301 svr4*|esix*) dflt="-G $ldflags" ;;
6302 *) dflt='none' ;;
6303 esac
6304 ;;
6305 *) dflt="$lddlflags" ;;
6306 esac
6307
bfb7748a 6308 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
6309 : Be careful not to append to a plain 'none'
6310 case "$dflt" in
6311 none) dflt='' ;;
6312 esac
bfb7748a
AD
6313 for thisflag in $ldflags; do
6314 case "$thisflag" in
6315 -L*)
6316 case " $dflt " in
6317 *" $thisflag "*) ;;
6318 *) dflt="$dflt $thisflag" ;;
6319 esac
6320 ;;
2afac517 6321 esac
bfb7748a 6322 done
2afac517 6323
bfb7748a
AD
6324 case "$dflt" in
6325 ''|' ') dflt='none' ;;
6326 esac
2afac517 6327
6328 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6329 . ./myread
6330 case "$ans" in
6331 none) lddlflags=' ' ;;
6332 *) lddlflags="$ans" ;;
6333 esac
6334
6335 cat <<EOM
6336
6337Some systems may require passing special flags to $cc to indicate that
6338the resulting executable will use dynamic linking. To use no flags,
6339say "none".
6340
6341EOM
6342 case "$ccdlflags" in
6343 '') case "$osname" in
6344 hpux) dflt='-Wl,-E' ;;
6345 linux) dflt='-rdynamic' ;;
6346 next) dflt='none' ;;
6347 sunos) dflt='none' ;;
6348 *) dflt='none' ;;
6349 esac ;;
bfb7748a 6350 ' ') dflt='none' ;;
2afac517 6351 *) dflt="$ccdlflags" ;;
6352 esac
7f95ee77 6353 rp="Any special flags to pass to $cc to use dynamic linking?"
2afac517 6354 . ./myread
6355 case "$ans" in
6356 none) ccdlflags=' ' ;;
6357 *) ccdlflags="$ans" ;;
6358 esac
6359 ;;
6360*) usedl="$undef"
6361 ld='ld'
6362 dlsrc='dl_none.xs'
6363 lddlflags=''
6364 ccdlflags=''
6365 ;;
6366esac
6367
6368also=''
6369case "$usedl" in
6370$undef)
6371 # No dynamic loading being used, so don't bother even to prompt.
6372 useshrplib='false'
6373 ;;
6374*) case "$useshrplib" in
6375 '') case "$osname" in
4fabb596 6376 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
3e3baf6d 6377 dflt=y
2afac517 6378 also='Building a shared libperl is required for dynamic loading to work on your system.'
6379 ;;
6380 next*)
6381 case "$osvers" in
3e3baf6d 6382 4*) dflt=y
2afac517 6383 also='Building a shared libperl is needed for MAB support.'
6384 ;;
3e3baf6d 6385 *) dflt=n
2afac517 6386 ;;
6387 esac
6388 ;;
3e3baf6d 6389 *) dflt=n
2afac517 6390 ;;
6391 esac
6392 ;;
6393 $define|true|[Yy]*)
3e3baf6d 6394 dflt=y
2afac517 6395 ;;
3e3baf6d 6396 *) dflt=n
2afac517 6397 ;;
6398 esac
6399 $cat << EOM
6400
6401The perl executable is normally obtained by linking perlmain.c with
dfe9444c 6402libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 6403any other libraries needed on this system (such as -lm, etc.). Since
6404your system supports dynamic loading, it is probably possible to build
6405a shared libperl.$so. If you will have more than one executable linked
6406to libperl.$so, this will significantly reduce the size of each
6407executable, but it may have a noticeable affect on performance. The
6408default is probably sensible for your system.
6409$also
6410
6411EOM
6412 rp="Build a shared libperl.$so (y/n)"
6413 . ./myread
6414 case "$ans" in
6415 true|$define|[Yy]*)
5cf1d1f1 6416 useshrplib='true' ;;
2afac517 6417 *) useshrplib='false' ;;
6418 esac
6419 ;;
6420esac
6421
6422case "$useshrplib" in
6423true)
6424 case "$libperl" in
6425 '')
6426 # Figure out a good name for libperl.so. Since it gets stored in
6427 # a version-specific architecture-dependent library, the version
6428 # number isn't really that important, except for making cc/ld happy.
6429 #
6430 # A name such as libperl.so.3.1
6431 majmin="libperl.$so.$patchlevel.$subversion"
6432 # A name such as libperl.so.301
6433 majonly=`echo $patchlevel $subversion |
6434 $awk '{printf "%d%02d", $1, $2}'`
6435 majonly=libperl.$so.$majonly
6436 # I'd prefer to keep the os-specific stuff here to a minimum, and
6437 # rely on figuring it out from the naming of libc.
6438 case "${osname}${osvers}" in
6439 next4*)
6440 dflt=libperl.5.$so
6441 # XXX How handle the --version stuff for MAB?
6442 ;;
6443 linux*) # ld won't link with a bare -lperl otherwise.
6444 dflt=libperl.$so
6445 ;;
4fabb596
GS
6446 cygwin*) # include version
6447 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6448 ;;
2afac517 6449 *) # Try to guess based on whether libc has major.minor.
6450 case "$libc" in
6451 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6452 *libc.$so.[0-9]*) dflt=$majonly ;;
6453 *) dflt=libperl.$so ;;
6454 esac
6455 ;;
6456 esac
6457 ;;
6458 *) dflt=$libperl
6459 ;;
6460 esac
6461 cat << EOM
6462
6463I need to select a good name for the shared libperl. If your system uses
6464library names with major and minor numbers, then you might want something
6465like $majmin. Alternatively, if your system uses a single version
6466number for shared libraries, then you might want to use $majonly.
6467Or, your system might be quite happy with a simple libperl.$so.
6468
6469Since the shared libperl will get installed into a version-specific
6470architecture-dependent directory, the version number of the shared perl
6471library probably isn't important, so the default should be o.k.
6472
6473EOM
6474 rp='What name do you want to give to the shared libperl?'
6475 . ./myread
6476 libperl=$ans
6477 echo "Ok, I'll use $libperl"
6478 ;;
6479*)
dfe9444c 6480 libperl="libperl${_a}"
2afac517 6481 ;;
6482esac
6483
6484# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6485case "$shrpdir" in
6486'') ;;
6487*) $cat >&4 <<EOM
6488WARNING: Use of the shrpdir variable for the installation location of
6489the shared $libperl is not supported. It was never documented and
46193409 6490will not work in this version. Let me (perlbug@perl.com)
dfe9444c 6491know of any problems this may cause.
2afac517 6492
6493EOM
6494 case "$shrpdir" in
6495 "$archlibexp/CORE")
6496 $cat >&4 <<EOM
6497But your current setting of $shrpdir is
6498the default anyway, so it's harmless.
6499EOM
6500 ;;
6501 *)
4e2a5f63
AD
6502 $cat >&4 <<EOM
6503Further, your current attempted setting of $shrpdir
6504conflicts with the value of $archlibexp/CORE
6505that installperl will use.
6506EOM
dc45a647
MB
6507 ;;
6508 esac
6509 ;;
6510esac
6511
6512# How will the perl executable find the installed shared $libperl?
6513# Add $xxx to ccdlflags.
6514# If we can't figure out a command-line option, use $shrpenv to
6515# set env LD_RUN_PATH. The main perl makefile uses this.
6516shrpdir=$archlibexp/CORE
6517xxx=''
6518tmp_shrpenv=''
6519if "$useshrplib"; then
6520 case "$osname" in
6521 aix)
6522 # We'll set it in Makefile.SH...
6523 ;;
6524 solaris|netbsd)
6525 xxx="-R $shrpdir"
6526 ;;
6527 freebsd)
6528 xxx="-Wl,-R$shrpdir"
6529 ;;
6530 linux|irix*|dec_osf)
6531 xxx="-Wl,-rpath,$shrpdir"
6532 ;;
6533 next)
6534 # next doesn't like the default...
6535 ;;
46193409
JH
6536 beos)
6537 # beos doesn't like the default, either.
6538 ;;
3656fc86
JH
6539 hpux*)
6540 # hpux doesn't like the default, either.
6541 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6542 ;;
dc45a647
MB
6543 *)
6544 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6545 ;;
6546 esac
6547 case "$xxx" in
6548 '') ;;
6549 *)
6550 # Only add $xxx if it isn't already in ccdlflags.
6551 case " $ccdlflags " in
6552 *" $xxx "*) ;;
6553 *) ccdlflags="$ccdlflags $xxx"
6554 cat <<EOM >&4
6555
6556Adding $xxx to the flags
6557passed to $ld so that the perl executable will find the
6558installed shared $libperl.
6559
6560EOM
6561 ;;
6562 esac
6563 ;;
6564 esac
6565fi
5cf1d1f1
JH
6566# Fix ccdlflags in AIX for building external extensions.
6567# (For building Perl itself bare -bE:perl.exp is needed,
6568# Makefile.SH takes care of this.)
5f9d9a17 6569case "$osname" in
5cf1d1f1 6570aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5f9d9a17 6571esac
dc45a647
MB
6572# Respect a hint or command-line value.
6573case "$shrpenv" in
6574'') shrpenv="$tmp_shrpenv" ;;
6575esac
5cf1d1f1
JH
6576case "$ldlibpthname" in
6577'') ldlibpthname=LD_LIBRARY_PATH ;;
6578none) ldlibpthname='' ;;
6579esac
dc45a647
MB
6580
6581: determine where manual pages go
6582set man1dir man1dir none
6583eval $prefixit
6584$cat <<EOM
6585
6586$spackage has manual pages available in source form.
6587EOM
6588case "$nroff" in
6589nroff)
6590 echo "However, you don't have nroff, so they're probably useless to you."
6591 case "$man1dir" in
6592 '') man1dir="none";;
6593 esac;;
6594esac
6595echo "If you don't want the manual sources installed, answer 'none'."
6596case "$man1dir" in
6597' ') dflt=none
6598 ;;
6599'')
6600 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6601 lookpath="$lookpath $prefixexp/man/p_man/man1"
6602 lookpath="$lookpath $prefixexp/man/u_man/man1"
6603 lookpath="$lookpath $prefixexp/man/man.1"
6604 case "$sysman" in
6605 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6606 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6607 esac
6608 set dflt
6609 eval $prefixup
6610 ;;
6611*) dflt="$man1dir"
6612 ;;
6613esac
6614echo " "
6615fn=dn+~
6616rp="Where do the main $spackage manual pages (source) go?"
6617. ./getfile
6618if $test "X$man1direxp" != "X$ansexp"; then
6619 installman1dir=''
6620fi
6621man1dir="$ans"
6622man1direxp="$ansexp"
6623case "$man1dir" in
dd4e71fd 6624'') man1dir=' '
dc45a647
MB
6625 installman1dir='';;
6626esac
dc45a647 6627
dd4e71fd
JH
6628: Change installation prefix, if necessary.
6629if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6630 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6631else
6632 installman1dir="$man1direxp"
dc45a647
MB
6633fi
6634
6635: What suffix to use on installed man pages
6636
6637case "$man1dir" in
6638' ')
6639 man1ext='0'
6640 ;;
6641*)
6642 rp="What suffix should be used for the main $spackage man pages?"
6643 case "$man1ext" in
6644 '') case "$man1dir" in
6645 *1) dflt=1 ;;
6646 *1p) dflt=1p ;;
6647 *1pm) dflt=1pm ;;
6648 *l) dflt=l;;
6649 *n) dflt=n;;
6650 *o) dflt=o;;
6651 *p) dflt=p;;
6652 *C) dflt=C;;
6653 *L) dflt=L;;
6654 *L1) dflt=L1;;
6655 *) dflt=1;;
6656 esac
6657 ;;
6658 *) dflt="$man1ext";;
6659 esac
6660 . ./myread
6661 man1ext="$ans"
6662 ;;
6663esac
6664
6665: see if we can have long filenames
6666echo " "
dc45a647 6667first=123456789abcdef
8c99d73e 6668$rm -f $first
dc45a647
MB
6669if (echo hi >$first) 2>/dev/null; then
6670 if $test -f 123456789abcde; then
6671 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6672 val="$undef"
6673 else
8c99d73e
GS
6674 echo 'You can have filenames longer than 14 characters.'>&4
6675 val="$define"
dc45a647
MB
6676 fi
6677else
6678 $cat <<'EOM'
8c99d73e
GS
6679You can't have filenames longer than 14 chars.
6680You can't even think about them!
dc45a647
MB
6681EOM
6682 val="$undef"
6683fi
6684set d_flexfnam
6685eval $setvar
8c99d73e 6686$rm -rf 123456789abcde*
dc45a647
MB
6687
6688: determine where library module manual pages go
6689set man3dir man3dir none
6690eval $prefixit
6691$cat <<EOM
6692
6693$spackage has manual pages for many of the library modules.
6694EOM
6695
6696case "$nroff" in
6697nroff)
6698 $cat <<'EOM'
6699However, you don't have nroff, so they're probably useless to you.
6700EOM
6701 case "$man3dir" in
6702 '') man3dir="none";;
6703 esac;;
6704esac
6705
6706case "$d_flexfnam" in
6707undef)
6708 $cat <<'EOM'
6709However, your system can't handle the long file names like File::Basename.3.
6710EOM
6711 case "$man3dir" in
6712 '') man3dir="none";;
6713 esac;;
6714esac
6715
6716echo "If you don't want the manual sources installed, answer 'none'."
6717prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6718case "$man3dir" in
8c99d73e 6719'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
dd4e71fd
JH
6720 if $test -d "$privlib/man/man3"; then
6721 cat <<EOM >&4
6722
6723WARNING: Previous versions of perl installed man3 pages into
6724$privlib/man/man3. This version will suggest a
6725new default of $dflt.
6726EOM
6727 tdflt=$dflt
6728 dflt='n'
6729 rp='Do you wish to preserve the old behavior?(y/n)'
6730 . ./myread
6731 case "$ans" in
6732 y*) dflt="$privlib/man/man3" ;;
6733 *) dflt=$tdflt ;;
6734 esac
6735 fi
2afac517 6736 ;;
dc45a647 6737*) dflt="$man3dir" ;;
2afac517 6738esac
8c99d73e
GS
6739case "$dflt" in
6740' ') dflt=none ;;
6741esac
dc45a647 6742echo " "
dc45a647
MB
6743fn=dn+~
6744rp="Where do the $package library man pages (source) go?"
6745. ./getfile
dc45a647
MB
6746man3dir="$ans"
6747man3direxp="$ansexp"
8c99d73e 6748case "$man3dir" in
dd4e71fd 6749'') man3dir=' '
dc45a647
MB
6750 installman3dir='';;
6751esac
dc45a647 6752
dd4e71fd
JH
6753: Change installation prefix, if necessary.
6754if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6755 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6756else
6757 installman3dir="$man3direxp"
dc45a647
MB
6758fi
6759
6760: What suffix to use on installed man pages
dc45a647
MB
6761case "$man3dir" in
6762' ')
6763 man3ext='0'
6764 ;;
6765*)
6766 rp="What suffix should be used for the $package library man pages?"
6767 case "$man3ext" in
6768 '') case "$man3dir" in
6769 *3) dflt=3 ;;
6770 *3p) dflt=3p ;;
6771 *3pm) dflt=3pm ;;
6772 *l) dflt=l;;
6773 *n) dflt=n;;
6774 *o) dflt=o;;
6775 *p) dflt=p;;
6776 *C) dflt=C;;
6777 *L) dflt=L;;
6778 *L3) dflt=L3;;
6779 *) dflt=3;;
2afac517 6780 esac
6781 ;;
dc45a647 6782 *) dflt="$man3ext";;
2afac517 6783 esac
dc45a647
MB
6784 . ./myread
6785 man3ext="$ans"
6786 ;;
2afac517 6787esac
6788
6789: see if we have to deal with yellow pages, now NIS.
6790if $test -d /usr/etc/yp || $test -d /etc/yp; then
6791 if $test -f /usr/etc/nibindd; then
6792 echo " "
6793 echo "I'm fairly confident you're on a NeXT."
6794 echo " "
6795 rp='Do you get the hosts file via NetInfo?'
6796 dflt=y
6797 case "$hostcat" in
6798 nidump*) ;;
6799 '') ;;
6800 *) dflt=n;;
6801 esac
6802 . ./myread
6803 case "$ans" in
6804 y*) hostcat='nidump hosts .';;
6805 *) case "$hostcat" in
6806 nidump*) hostcat='';;
6807 esac
6808 ;;
6809 esac
6810 fi
6811 case "$hostcat" in
6812 nidump*) ;;
6813 *)
6814 case "$hostcat" in
6815 *ypcat*) dflt=y;;
6816 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6817 dflt=y
6818 else
6819 dflt=n
6820 fi;;
6821 *) dflt=n;;
6822 esac
6823 echo " "
6824 rp='Are you getting the hosts file via yellow pages?'
6825 . ./myread
6826 case "$ans" in
6827 y*) hostcat='ypcat hosts';;
6828 *) hostcat='cat /etc/hosts';;
6829 esac
6830 ;;
6831 esac
6832fi
dfe9444c 6833case "$hostcat" in
7599c0b3 6834'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
dfe9444c
AD
6835esac
6836case "$groupcat" in
7599c0b3 6837'') test -f /etc/group && groupcat='cat /etc/group';;
dfe9444c
AD
6838esac
6839case "$passcat" in
7599c0b3 6840'') test -f /etc/passwd && passcat='cat /etc/passwd';;
dfe9444c 6841esac
2afac517 6842
6843: now get the host name
6844echo " "
6845echo "Figuring out host name..." >&4
6846case "$myhostname" in
6847'') cont=true
6848 echo 'Maybe "hostname" will work...'
6849 if tans=`sh -c hostname 2>&1` ; then
6850 myhostname=$tans
6851 phostname=hostname
6852 cont=''
6853 fi
6854 ;;
6855*) cont='';;
6856esac
6857if $test "$cont"; then
6858 if ./xenix; then
6859 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
6860 if tans=`cat /etc/systemid 2>&1` ; then
6861 myhostname=$tans
6862 phostname='cat /etc/systemid'
6863 echo "Whadyaknow. Xenix always was a bit strange..."
6864 cont=''
6865 fi
6866 elif $test -r /etc/systemid; then
6867 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6868 fi
6869fi
6870if $test "$cont"; then
6871 echo 'No, maybe "uuname -l" will work...'
6872 if tans=`sh -c 'uuname -l' 2>&1` ; then
6873 myhostname=$tans
6874 phostname='uuname -l'
6875 else
6876 echo 'Strange. Maybe "uname -n" will work...'
6877 if tans=`sh -c 'uname -n' 2>&1` ; then
6878 myhostname=$tans
6879 phostname='uname -n'
6880 else
6881 echo 'Oh well, maybe I can mine it out of whoami.h...'
6882 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6883 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6884 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6885 else
6886 case "$myhostname" in
6887 '') echo "Does this machine have an identity crisis or something?"
6888 phostname='';;
6889 *)
6890 echo "Well, you said $myhostname before..."
6891 phostname='echo $myhostname';;
6892 esac
6893 fi
6894 fi
6895 fi
6896fi
6897: you do not want to know about this
6898set $myhostname
6899myhostname=$1
6900
6901: verify guess
6902if $test "$myhostname" ; then
6903 dflt=y
6904 rp='Your host name appears to be "'$myhostname'".'" Right?"
6905 . ./myread
6906 case "$ans" in
6907 y*) ;;
6908 *) myhostname='';;
6909 esac
6910fi
6911
6912: bad guess or no guess
6913while $test "X$myhostname" = X ; do
6914 dflt=''
6915 rp="Please type the (one word) name of your host:"
6916 . ./myread
6917 myhostname="$ans"
6918done
6919
6920: translate upper to lower if necessary
6921case "$myhostname" in
6922*[A-Z]*)
6923 echo "(Normalizing case in your host name)"
6924 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6925 ;;
6926esac
6927
6928case "$myhostname" in
6929*.*)
6930 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6931 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6932 echo "(Trimming domain name from host name--host name is now $myhostname)"
6933 ;;
6934*) case "$mydomain" in
6935 '')
6936 {
2afac517 6937 test "X$hostcat" = "Xypcat hosts" &&
6938 ypmatch "$myhostname" hosts 2>/dev/null |\
6939 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
6940 $test -s hosts
6941 } || {
7599c0b3 6942 test "X$hostcat" != "X" &&
2afac517 6943 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
6944 /[ ]$myhostname[ . ]/p" > hosts
6945 }
6946 tmp_re="[ . ]"
6947 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
6948 END { print sum }" hosts` = x1 || tmp_re="[ ]"
6949 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6950 hosts | $sort | $uniq | \
6951 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6952 case `$echo X$dflt` in
6953 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
6954 dflt=.
6955 ;;
6956 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6957 ;;
6958 esac
6959 case "$dflt" in
6960 .)
6961 tans=`./loc resolv.conf X /etc /usr/etc`
6962 if $test -f "$tans"; then
6963 echo "(Attempting domain name extraction from $tans)"
a6006777 6964 dflt=.`$sed -n -e 's/ / /g' \
28757baa 6965 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 6966 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 6967 case "$dflt" in
a6006777 6968 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 6969 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 6970 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 6971 ;;
2afac517 6972 esac
6973 fi
6974 ;;
6975 esac
6976 case "$dflt" in
6977 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6978 dflt=.`sh -c domainname 2>/dev/null`
6979 case "$dflt" in
6980 '') dflt='.';;
6981 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6982 esac
6983 ;;
6984 esac
6985 case "$dflt" in
6986 .) echo "(Lost all hope -- silly guess then)"
6987 dflt='.uucp'
6988 ;;
6989 esac
6990 $rm -f hosts
6991 ;;
6992 *) dflt="$mydomain";;
6993 esac;;
6994esac
6995echo " "
6996rp="What is your domain name?"
6997. ./myread
6998tans="$ans"
6999case "$ans" in
7000'') ;;
7001.*) ;;
7002*) tans=".$tans";;
7003esac
7004mydomain="$tans"
7005
7006: translate upper to lower if necessary
7007case "$mydomain" in
7008*[A-Z]*)
7009 echo "(Normalizing case in your domain name)"
7010 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7011 ;;
7012esac
7013
7014: a little sanity check here
7015case "$phostname" in
7016'') ;;
7017*)
7018 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7019 $myhostname$mydomain|$myhostname) ;;
7020 *)
7021 case "$phostname" in
7022 sed*)
7023 echo "(That doesn't agree with your whoami.h file, by the way.)"
7024 ;;
7025 *)
7026 echo "(That doesn't agree with your $phostname command, by the way.)"
7027 ;;
7028 esac
7029 ;;
7030 esac
7031 ;;
7032esac
7033
7034$cat <<EOM
7035
7036I need to get your e-mail address in Internet format if possible, i.e.
7037something like user@host.domain. Please answer accurately since I have
7038no easy means to double check it. The default value provided below
7f95ee77 7039is most probably close to reality but may not be valid from outside
2afac517 7040your organization...
7041
7042EOM
7043cont=x
7044while test "$cont"; do
7045 case "$cf_email" in
7046 '') dflt="$cf_by@$myhostname$mydomain";;
7047 *) dflt="$cf_email";;
7048 esac
7049 rp='What is your e-mail address?'
7050 . ./myread
7051 cf_email="$ans"
7052 case "$cf_email" in
7053 *@*.*) cont='' ;;
7054 *)
7055 rp='Address does not look like an Internet one. Use it anyway?'
7056 case "$fastread" in
7057 yes) dflt=y ;;
7058 *) dflt=n ;;
7059 esac
7060 . ./myread
7061 case "$ans" in
7062 y*) cont='' ;;
7063 *) echo " " ;;
7064 esac
7065 ;;
7066 esac
7067done
7068
7069$cat <<EOM
7070
7071If you or somebody else will be maintaining perl at your site, please
7072fill in the correct e-mail address here so that they may be contacted
7073if necessary. Currently, the "perlbug" program included with perl
7074will send mail to this address in addition to perlbug@perl.com. You may
7075enter "none" for no administrator.
7076
7077EOM
7078case "$perladmin" in
7079'') dflt="$cf_email";;
7080*) dflt="$perladmin";;
7081esac
7082rp='Perl administrator e-mail address'
7083. ./myread
7084perladmin="$ans"
7085
5f05dabc 7086: figure out how to guarantee perl startup
7087case "$startperl" in
7088'')
7089 case "$sharpbang" in
7090 *!)
7091 $cat <<EOH
7092
7093I can use the #! construct to start perl on your system. This will
7094make startup of perl scripts faster, but may cause problems if you
7095want to share those scripts and perl is not in a standard place
7096($binexp/perl) on all your platforms. The alternative is to force
7097a shell by starting the script with a single ':' character.
7098
7099EOH
7100 dflt="$binexp/perl"
7101 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7102 . ./myread
7103 case "$ans" in
68dc0745 7104 none) startperl=": # use perl";;
7105 *) startperl="#!$ans"
3e3baf6d 7106 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 7107 $cat >&4 <<EOM
7108
7109WARNING: Some systems limit the #! command to 32 characters.
7110If you experience difficulty running Perl scripts with #!, try
7111installing Perl in a directory with a shorter pathname.
7112
7113EOM
7114 fi ;;
5f05dabc 7115 esac
7116 ;;
7117 *) startperl=": # use perl"
7118 ;;
7119 esac
7120 ;;
7121esac
7122echo "I'll use $startperl to start perl scripts."
7123
7124: figure best path for perl in scripts
7125case "$perlpath" in
7126'')
7127 perlpath="$binexp/perl"
7128 case "$startperl" in
7129 *!*) ;;
7130 *)
7131 $cat <<EOH
7132
7133I will use the "eval 'exec'" idiom to start Perl on your system.
7134I can use the full path of your Perl binary for this purpose, but
7135doing so may cause problems if you want to share those scripts and
7136Perl is not always in a standard place ($binexp/perl).
7137
7138EOH
7139 dflt="$binexp/perl"
7140 rp="What path shall I use in \"eval 'exec'\"?"
7141 . ./myread
7142 perlpath="$ans"
7143 ;;
7144 esac
7145 ;;
7146esac
7147case "$startperl" in
7148*!*) ;;
7149*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7150esac
7151
dc45a647
MB
7152: determine where public executable scripts go
7153set scriptdir scriptdir
7154eval $prefixit
7155case "$scriptdir" in
7156'')
7157 dflt="$bin"
7158 : guess some guesses
7159 $test -d /usr/share/scripts && dflt=/usr/share/scripts
dd4e71fd
JH
7160 $test -d /usr/share/bin && dflt=/usr/share/bin
7161 $test -d /usr/local/script && dflt=/usr/local/script
7162 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7163 $test -d $prefixexp/script && dflt=$prefixexp/script
dc45a647
MB
7164 set dflt
7165 eval $prefixup
7166 ;;
7167*) dflt="$scriptdir"
7168 ;;
7169esac
7170$cat <<EOM
7171
7172Some installations have a separate directory just for executable scripts so
7173that they can mount it across multiple architectures but keep the scripts in
7174one spot. You might, for example, have a subdirectory of /usr/share for this.
7175Or you might just lump your scripts in with all your other executables.
7176
7177EOM
7178fn=d~
7179rp='Where do you keep publicly executable scripts?'
7180. ./getfile
7181if $test "X$ansexp" != "X$scriptdirexp"; then
7182 installscript=''
7183fi
7184scriptdir="$ans"
7185scriptdirexp="$ansexp"
dd4e71fd
JH
7186: Change installation prefix, if necessary.
7187if $test X"$prefix" != X"$installprefix"; then
ec897fb9 7188 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
dd4e71fd
JH
7189else
7190 installscript="$scriptdirexp"
7191fi
dc45a647 7192
dc45a647 7193: determine where site specific architecture-dependent libraries go.
273cf8d1
GS
7194: sitelib default is /usr/local/lib/perl5/site_perl/$version
7195: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
3a6175e1 7196: sitelib may have an optional trailing /share.
dc45a647 7197case "$sitearch" in
49c10eea
JH
7198'') dflt=`echo $sitelib | $sed 's,/share$,,'`
7199 dflt="$dflt/$archname"
7200 ;;
7201*) dflt="$sitearch"
7202 ;;
dc45a647 7203esac
49c10eea
JH
7204set sitearch sitearch none
7205eval $prefixit
dc45a647
MB
7206$cat <<EOM
7207
7208The installation process will also create a directory for
7209architecture-dependent site-specific extensions and modules.
7210
7211EOM
49c10eea 7212fn=d~+
dc45a647
MB
7213rp='Pathname for the site-specific architecture-dependent library files?'
7214. ./getfile
dc45a647
MB
7215sitearch="$ans"
7216sitearchexp="$ansexp"
dd4e71fd
JH
7217: Change installation prefix, if necessary.
7218if $test X"$prefix" != X"$installprefix"; then
ec897fb9 7219 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
7220else
7221 installsitearch="$sitearchexp"
dc45a647
MB
7222fi
7223
717c4fcc
JH
7224: determine where add-on public executables go
7225case "$sitebin" in
7226'') dflt=$siteprefix/bin ;;
49c10eea 7227*) dflt=$sitebin ;;
717c4fcc
JH
7228esac
7229fn=d~
7230rp='Pathname where the add-on public executables should be installed?'
7231. ./getfile
7232sitebin="$ans"
7233sitebinexp="$ansexp"
7234: Change installation prefix, if necessary.
7235if $test X"$prefix" != X"$installprefix"; then
7236 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7237else
7238 installsitebin="$sitebinexp"
7239fi
7240
43999f95
JH
7241: see if sqrtl exists
7242set sqrtl d_sqrtl
7243eval $inlibc
7244
d7d93a81
JH
7245case "$ccflags" in
7246*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7247esac
7248
b0ce926a
JH
7249case "$uselongdouble" in
7250$define|true|[yY]*) dflt='y';;
7251*) dflt='n';;
7252esac
0f0995ae
JH
7253cat <<EOM
7254
7255Perl can be built to take advantage of long doubles which
7256(if available) may give more accuracy and range for floating point numbers.
7257
7258If this doesn't make any sense to you, just accept the default '$dflt'.
7259EOM
b0ce926a
JH
7260rp='Try to use long doubles if available?'
7261. ./myread
7262case "$ans" in
309d43cf
JH
7263y|Y) val="$define" ;;
7264*) val="$undef" ;;
b0ce926a
JH
7265esac
7266set uselongdouble
7267eval $setvar
7268
d9b3e12d 7269case "$uselongdouble" in
d7d93a81
JH
7270true|[yY]*) uselongdouble="$define" ;;
7271esac
7272
7273case "$uselongdouble" in
7274$define)
d9b3e12d
JH
7275: Look for a hint-file generated 'call-back-unit'. If the
7276: user has specified that long doubles should be used,
7277: we may need to set or change some other defaults.
7278 if $test -f uselongdouble.cbu; then
7279 echo "Your platform has some specific hints for long doubles, using them..."
7280 . ./uselongdouble.cbu
7281 else
7282 $cat <<EOM
7283(Your platform doesn't have any specific hints for long doubles.)
7284EOM
7285 fi
7286 ;;
7287esac
b0ce926a 7288
43999f95
JH
7289case "$uselongdouble:$d_sqrtl" in
7290$define:$undef)
7291 $cat <<EOM >&4
7292
3d68f8d4
JH
7293*** You requested the use of long doubles but you do not seem to have
7294*** the mathematic functions for long doubles. I'm disabling the use
7295*** of long doubles.
7296
43999f95
JH
7297EOM
7298 uselongdouble=$undef
7299 ;;
7300esac
7301
0f0995ae
JH
7302case "$useperlio" in
7303$define|true|[yY]*) dflt='y';;
7304*) dflt='n';;
7305esac
d7d93a81
JH
7306cat <<EOM
7307
85aff577
CS
7308Previous version of $package used the standard IO mechanisms as defined
7309in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 7310mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
7311the default. This abstraction layer can use AT&T's sfio (if you already
7312have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7313problems with some extension modules. Using PerlIO with stdio is safe,
7314but it is slower than plain stdio and therefore is not the default.
2afac517 7315
0f0995ae 7316If this doesn't make any sense to you, just accept the default '$dflt'.
2afac517 7317EOM
2afac517 7318rp='Use the experimental PerlIO abstraction layer?'
7319. ./myread
7320case "$ans" in
7321y|Y)
7322 val="$define"
7323 ;;
7324*)
7325 echo "Ok, doing things the stdio way"
7326 val="$undef"
7327 ;;
7328esac
7329set useperlio
7330eval $setvar
2304df62 7331
717c4fcc
JH
7332case "$vendorprefix" in
7333'') d_vendorbin="$undef"
7334 vendorbin=''
7335 vendorbinexp=''
7336 ;;
7337*) d_vendorbin="$define"
7338 : determine where vendor-supplied executables go.
49c10eea
JH
7339 case "$vendorbin" in
7340 '') dflt=$vendorprefix/bin ;;
7341 *) dflt="$vendorbin" ;;
7342 esac
717c4fcc
JH
7343 fn=d~+
7344 rp='Pathname for the vendor-supplied executables directory?'
7345 . ./getfile
7346 vendorbin="$ans"
7347 vendorbinexp="$ansexp"
717c4fcc
JH
7348 ;;
7349esac
49c10eea
JH
7350: Change installation prefix, if necessary.
7351if $test X"$prefix" != X"$installprefix"; then
7352 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7353else
7354 installvendorbin="$vendorbinexp"
7355fi
717c4fcc 7356
bbe6c963
JH
7357: see if qgcvt exists
7358set qgcvt d_qgcvt
7359eval $inlibc
7360
628e1a40
JH
7361: check for length of double
7362echo " "
7363case "$doublesize" in
7364'')
49c10eea 7365 echo "Checking to see how big your double precision numbers are..." >&4
628e1a40
JH
7366 $cat >try.c <<'EOCP'
7367#include <stdio.h>
7368int main()
7369{
7370 printf("%d\n", (int)sizeof(double));
7371 exit(0);
7372}
7373EOCP
7374 set try
7375 if eval $compile_ok; then
7376 doublesize=`./try`
49c10eea 7377 echo "Your double is $doublesize bytes long."
628e1a40
JH
7378 else
7379 dflt='8'
7380 echo "(I can't seem to compile the test program. Guessing...)"
7381 rp="What is the size of a double precision number (in bytes)?"
7382 . ./myread
7383 doublesize="$ans"
7384 fi
7385 ;;
7386esac
7387$rm -f try.c try
7388
7389: check for long doubles
7390echo " "
c5f05a91 7391echo "Checking to see if you have long double..." >&4
628e1a40
JH
7392echo 'int main() { long double x = 7.0; }' > try.c
7393set try
7394if eval $compile; then
7395 val="$define"
ce65dbcf 7396 echo "You have long double."
628e1a40
JH
7397else
7398 val="$undef"
ce65dbcf 7399 echo "You do not have long double."
628e1a40
JH
7400fi
7401$rm try.*
7402set d_longdbl
7403eval $setvar
7404
7405: check for length of long double
7406case "${d_longdbl}${longdblsize}" in
7407$define)
7408 echo " "
49c10eea 7409 echo "Checking to see how big your long doubles are..." >&4
628e1a40
JH
7410 $cat >try.c <<'EOCP'
7411#include <stdio.h>
7412int main()
7413{
7414 printf("%d\n", sizeof(long double));
7415}
7416EOCP
7417 set try
7418 set try
7419 if eval $compile; then
7420 longdblsize=`./try$exe_ext`
49c10eea 7421 echo "Your long doubles are $longdblsize bytes long."
628e1a40
JH
7422 else
7423 dflt='8'
7424 echo " "
7425 echo "(I can't seem to compile the test program. Guessing...)" >&4
7426 rp="What is the size of a long double (in bytes)?"
7427 . ./myread
7428 longdblsize="$ans"
7429 fi
7430 if $test "X$doublesize" = "X$longdblsize"; then
7431 echo "(That isn't any different from an ordinary double.)"
7432 fi
7433 ;;
7434esac
7435$rm -f try.* try
ff935051 7436
cf2093f6
JH
7437echo " "
7438
ea1c3b15 7439if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
7440
7441echo "Checking how to print long doubles..." >&4
7442
7443if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7444 $cat >try.c <<'EOCP'
7445#include <sys/types.h>
7446#include <stdio.h>
7447int main() {
7448 double d = 123.456;
7449 printf("%.3f\n", d);
7450}
7451EOCP
7452 set try
7453 if eval $compile; then
7454 yyy=`./try$exe_ext`
7455 case "$yyy" in
7456 123.456)
7457 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7458 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7459 echo "We will use %f."
7460 ;;
7461 esac
7462 fi
7463fi
7464
7465if $test X"$sPRIfldbl" = X; then
7466 $cat >try.c <<'EOCP'
7467#include <sys/types.h>
7468#include <stdio.h>
7469int main() {
7470 long double d = 123.456;
ea1c3b15 7471 printf("%.3llf\n", d);
cf2093f6
JH
7472}
7473EOCP
7474 set try
7475 if eval $compile; then
7476 yyy=`./try$exe_ext`
7477 case "$yyy" in
7478 123.456)
ea1c3b15
JH
7479 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7480 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7481 echo "We will use %llf."
cf2093f6
JH
7482 ;;
7483 esac
7484 fi
7485fi
7486
7487if $test X"$sPRIfldbl" = X; then
7488 $cat >try.c <<'EOCP'
7489#include <sys/types.h>
7490#include <stdio.h>
7491int main() {
7492 long double d = 123.456;
ea1c3b15 7493 printf("%.3Lf\n", d);
cf2093f6
JH
7494}
7495EOCP
7496 set try
7497 if eval $compile; then
7498 yyy=`./try$exe_ext`
7499 case "$yyy" in
7500 123.456)
ea1c3b15
JH
7501 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7502 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7503 echo "We will use %Lf."
cf2093f6
JH
7504 ;;
7505 esac
7506 fi
7507fi
7508
11dc3f68 7509if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7510 $cat >try.c <<'EOCP'
7511#include <sys/types.h>
7512#include <stdio.h>
7513int main() {
7514 long double d = 123.456;
ea1c3b15 7515 printf("%.3lf\n", d);
cf2093f6
JH
7516}
7517EOCP
7518 set try
7519 if eval $compile; then
7520 yyy=`./try$exe_ext`
7521 case "$yyy" in
7522 123.456)
ea1c3b15
JH
7523 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7524 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7525 echo "We will use %lf."
cf2093f6
JH
7526 ;;
7527 esac
7528 fi
7529fi
7530
09e3ef00
JH
7531if $test X"$sPRIfldbl" = X; then
7532 echo "Cannot figure out how to print long doubles." >&4
7533fi
7534
ea1c3b15 7535$rm -f try try.*
cf2093f6 7536
ea1c3b15 7537fi # d_longdbl
cf2093f6
JH
7538
7539case "$sPRIfldbl" in
7540'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7541 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7542 ;;
7543*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7544 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7545 ;;
7546esac
7547
bbe6c963
JH
7548: Check how to convert floats to strings.
7549if test "X$d_Gconvert" = X; then
7550 echo " "
7551 echo "Checking for an efficient way to convert floats to strings."
7552 echo " " > try.c
7553 case "$uselongdouble" in
7554 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7555 esac
7556 case "$d_longdbl" in
7557 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7558 esac
7559 case "$d_PRIgldbl" in
7560 "$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7561 esac
7562 $cat >>try.c <<EOP
7563#ifdef TRY_gconvert
7564#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7565char *myname = "gconvert";
7566#endif
7567#ifdef TRY_gcvt
7568#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7569char *myname = "gcvt";
7570#endif
7571#ifdef TRY_qgcvt
7572#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7573char *myname = "qgcvt";
7574#define DOUBLETYPE long double
7575#endif
7576#ifdef TRY_sprintf
7577#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7578#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7579#else
7580#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7581#endif
7582char *myname = "sprintf";
7583#endif
7584
7585#ifndef DOUBLETYPE
7586#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7587#define DOUBLETYPE long double
7588#else
7589#define DOUBLETYPE double
7590#endif
7591#endif
7592
7593#include <stdio.h>
7594
7595#define I_STDLIB $i_stdlib
7596#ifdef I_STDLIB
7597#include <stdlib.h>
7598#endif
7599
7600int
7601checkit(expect, got)
7602char *expect;
7603char *got;
7604{
7605 if (strcmp(expect, got)) {
7606 printf("%s oddity: Expected %s, got %s\n",
7607 myname, expect, got);
7608 exit(1);
7609 }
7610}
7611
7612int main()
7613{
7614 char buf[64];
7615 buf[63] = '\0';
7616
7617 /* This must be 1st test on (which?) platform */
7618 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7619 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7620 checkit("0.1", buf);
7621
7622 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7623 checkit("1", buf);
7624
7625 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7626 checkit("1.1", buf);
7627
7628 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7629 checkit("1.01", buf);
7630
7631 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7632 checkit("1.001", buf);
7633
7634 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7635 checkit("1.0001", buf);
7636
7637 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7638 checkit("1.00001", buf);
7639
7640 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7641 checkit("1.000001", buf);
7642
7643 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7644 checkit("0", buf);
7645
7646 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7647 checkit("-1", buf);
7648
7649 /* Some Linux gcvt's give 1.e+5 here. */
7650 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7651 checkit("100000", buf);
7652
7653 /* Some Linux gcvt's give -1.e+5 here. */
7654 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7655 checkit("-100000", buf);
7656
7657 exit(0);
7658}
7659EOP
7660 case "$d_Gconvert" in
7661 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7662 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7663 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7664 *) xxx_list='gconvert gcvt sprintf' ;;
7665 esac
7666
7667 case "$d_longdbl$uselongdouble$d_qgcvt" in
7668 "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7669 esac
7670
7671 for xxx_convert in $xxx_list; do
7672 echo "Trying $xxx_convert..."
7673 $rm -f try try$_o
7674 set try -DTRY_$xxx_convert
7675 if eval $compile; then
7676 echo "$xxx_convert() found." >&4
7677 if ./try; then
7678 echo "I'll use $xxx_convert to convert floats into a string." >&4
7679 break;
7680 else
7681 echo "...But $xxx_convert didn't work as I expected."
7682 fi
7683 else
7684 echo "$xxx_convert NOT found." >&4
7685 fi
7686 done
7687
7688 case "$xxx_convert" in
7689 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7690 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7691 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7692 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7693 "$define$define$define")
7694 d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7695 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7696 esac
7697 ;;
7698 esac
7699fi
7700
a0d0e21e
LW
7701: Initialize h_fcntl
7702h_fcntl=false
7703
7704: Initialize h_sysfile
7705h_sysfile=false
2304df62 7706
2304df62
AD
7707: access call always available on UNIX
7708set access d_access
7709eval $inlibc
7710
7711: locate the flags for 'access()'
7712case "$d_access" in
7713"$define")
7714 echo " "
7715 $cat >access.c <<'EOCP'
7716#include <sys/types.h>
7717#ifdef I_FCNTL
7718#include <fcntl.h>
7719#endif
7720#ifdef I_SYS_FILE
7721#include <sys/file.h>
7722#endif
7723#ifdef I_UNISTD
7724#include <unistd.h>
7725#endif
d674cd6d 7726int main() {
2304df62
AD
7727 exit(R_OK);
7728}
8e07c86e
AD
7729EOCP
7730 : check sys/file.h first, no particular reason here
7731 if $test `./findhdr sys/file.h` && \
dfe9444c 7732 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7733 h_sysfile=true;
7734 echo "<sys/file.h> defines the *_OK access constants." >&4
7735 elif $test `./findhdr fcntl.h` && \
dfe9444c 7736 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7737 h_fcntl=true;
7738 echo "<fcntl.h> defines the *_OK access constants." >&4
7739 elif $test `./findhdr unistd.h` && \
dfe9444c 7740 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7741 echo "<unistd.h> defines the *_OK access constants." >&4
7742 else
7743 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7744 fi
7745 ;;
7746esac
7747$rm -f access*
a0d0e21e 7748
5ff3f7a4
GS
7749: see if accessx exists
7750set accessx d_accessx
7751eval $inlibc
7752
8e07c86e
AD
7753: see if alarm exists
7754set alarm d_alarm
7755eval $inlibc
2304df62 7756
cf2093f6
JH
7757: see if atolf exists
7758set atolf d_atolf
7759eval $inlibc
7760
7761: see if atoll exists
7762set atoll d_atoll
7763eval $inlibc
7764
ecfc5424 7765: Look for GNU-cc style attribute checking
2304df62 7766echo " "
a0d0e21e
LW
7767echo "Checking whether your compiler can handle __attribute__ ..." >&4
7768$cat >attrib.c <<'EOCP'
1aef975c 7769#include <stdio.h>
ecfc5424 7770void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7771EOCP
7772if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7773 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7774 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7775 val="$undef"
7776 else
ecfc5424 7777 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7778 val="$define"
7779 fi
7780else
ecfc5424 7781 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7782 val="$undef"
7783fi
ecfc5424 7784set d_attribut
a0d0e21e
LW
7785eval $setvar
7786$rm -f attrib*
7787
7788: see if bcmp exists
7789set bcmp d_bcmp
7790eval $inlibc
7791
7792: see if bcopy exists
7793set bcopy d_bcopy
7794eval $inlibc
7795
2afac517 7796: see if this is a unistd.h system
7797set unistd.h i_unistd
7798eval $inhdr
7799
7800: see if getpgrp exists
7801set getpgrp d_getpgrp
7802eval $inlibc
7803
2afac517 7804case "$d_getpgrp" in
7805"$define")
7806 echo " "
dfe9444c 7807 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7808 $cat >set.c <<EOP
7809#$i_unistd I_UNISTD
7810#include <sys/types.h>
7811#ifdef I_UNISTD
7812# include <unistd.h>
7813#endif
5a411a32 7814int main()
2afac517 7815{
7816 if (getuid() == 0) {
7817 printf("(I see you are running Configure as super-user...)\n");
7818 setuid(1);
7819 }
7820#ifdef TRY_BSD_PGRP
7821 if (getpgrp(1) == 0)
7822 exit(0);
7823#else
7824 if (getpgrp() > 0)
7825 exit(0);
7826#endif
7827 exit(1);
7828}
7829EOP
7830 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7831 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7832 val="$define"
7833 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7834 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7835 val="$undef"
7836 else
7837 echo "I can't seem to compile and run the test program."
7838 if ./usg; then
7839 xxx="a USG one, i.e. you use getpgrp()."
7840 else
7841 # SVR4 systems can appear rather BSD-ish.
7842 case "$i_unistd" in
7843 $undef)
7844 xxx="a BSD one, i.e. you use getpgrp(pid)."
7845 val="$define"
7846 ;;
7847 $define)
7848 xxx="probably a USG one, i.e. you use getpgrp()."
7849 val="$undef"
7850 ;;
7851 esac
7852 fi
7853 echo "Assuming your getpgrp is $xxx" >&4
7854 fi
7855 ;;
7856*) val="$undef";;
7857esac
7858set d_bsdgetpgrp
7859eval $setvar
7860$rm -f set set.c
7861
a0d0e21e
LW
7862: see if setpgrp exists
7863set setpgrp d_setpgrp
7864eval $inlibc
7865
a0d0e21e
LW
7866case "$d_setpgrp" in
7867"$define")
7868 echo " "
dfe9444c 7869 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7870 $cat >set.c <<EOP
2afac517 7871#$i_unistd I_UNISTD
7872#include <sys/types.h>
7873#ifdef I_UNISTD
7874# include <unistd.h>
7875#endif
5a411a32 7876int main()
a0d0e21e
LW
7877{
7878 if (getuid() == 0) {
7879 printf("(I see you are running Configure as super-user...)\n");
7880 setuid(1);
7881 }
2afac517 7882#ifdef TRY_BSD_PGRP
a0d0e21e 7883 if (-1 == setpgrp(1, 1))
2afac517 7884 exit(0);
7885#else
7886 if (setpgrp() != -1)
7887 exit(0);
7888#endif
7889 exit(1);
a0d0e21e
LW
7890}
7891EOP
2afac517 7892 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7893 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7894 val="$define"
7895 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7896 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7897 val="$undef"
a0d0e21e 7898 else
dfe9444c 7899 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7900 if ./usg; then
2afac517 7901 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7902 else
2afac517 7903 # SVR4 systems can appear rather BSD-ish.
7904 case "$i_unistd" in
7905 $undef)
7906 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7907 val="$define"
7908 ;;
7909 $define)
7910 xxx="probably a USG one, i.e. you use setpgrp()."
7911 val="$undef"
7912 ;;
7913 esac
a0d0e21e 7914 fi
2afac517 7915 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7916 fi
7917 ;;
7918*) val="$undef";;
7919esac
2afac517 7920set d_bsdsetpgrp
a0d0e21e
LW
7921eval $setvar
7922$rm -f set set.c
a0d0e21e
LW
7923: see if bzero exists
7924set bzero d_bzero
7925eval $inlibc
7926
ecfc5424 7927: see if signal is declared as pointer to function returning int or void
a0d0e21e 7928echo " "
ecfc5424
AD
7929xxx=`./findhdr signal.h`
7930$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7931if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7932 echo "You have int (*signal())() instead of void." >&4
7933 val="$undef"
7934elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7935 echo "You have void (*signal())()." >&4
ecfc5424
AD
7936 val="$define"
7937elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7938 echo "You have int (*signal())() instead of void." >&4
7939 val="$undef"
dfe9444c
AD
7940elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7941 echo "You have void (*signal())()." >&4
7942 val="$define"
a0d0e21e 7943else
ecfc5424
AD
7944 case "$d_voidsig" in
7945 '')
7946 echo "I can't determine whether signal handler returns void or int..." >&4
7947 dflt=void
7948 rp="What type does your signal handler return?"
7949 . ./myread
7950 case "$ans" in
7951 v*) val="$define";;
7952 *) val="$undef";;
7953 esac;;
7954 "$define")
dfe9444c
AD
7955 echo "As you already told me, signal handler returns void." >&4
7956 val="$define"
7957 ;;
7958 *) echo "As you already told me, signal handler returns int." >&4
7959 val="$undef"
7960 ;;
ecfc5424
AD
7961 esac
7962fi
7963set d_voidsig
7964eval $setvar
7965case "$d_voidsig" in
7966"$define") signal_t="void";;
7967*) signal_t="int";;
7968esac
7969$rm -f $$.tmp
7970
7971: check for ability to cast large floats to 32-bit ints.
7972echo " "
7973echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7974if $test "$intsize" -ge 4; then
ecfc5424
AD
7975 xxx=int
7976else
7977 xxx=long
7978fi
7979$cat >try.c <<EOCP
e5c9fcd0 7980#include <stdio.h>
ecfc5424
AD
7981#include <sys/types.h>
7982#include <signal.h>
a1896f58 7983$signal_t blech(s) int s; { exit(3); }
d674cd6d 7984int main()
2304df62 7985{
a0d0e21e 7986 $xxx i32;
e5c9fcd0 7987 double f, g;
2304df62 7988 int result = 0;
89434db5 7989 char str[16];
2304df62
AD
7990 signal(SIGFPE, blech);
7991
89434db5
AD
7992 /* Don't let compiler optimize the test away. Store the number
7993 in a writable string for gcc to pass to sscanf under HP/UX.
7994 */
7995 sprintf(str, "2147483647");
7996 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7997 g = 10 * f;
7998 i32 = ($xxx) g;
2304df62 7999
e5c9fcd0
AD
8000 /* x86 processors will probably give 0x8000 0000, which is a
8001 sign change. We don't want that. We want to mimic SPARC
8002 behavior here, which is to preserve the sign and give
8003 back 0x7fff ffff.
8004 */
a0d0e21e 8005 if (i32 != ($xxx) f)
2304df62
AD
8006 result |= 1;
8007 exit(result);
8008}
8009EOCP
dfe9444c 8010set try
dc45a647 8011if eval $compile_ok; then
2304df62
AD
8012 ./try
8013 yyy=$?
8014else
a0d0e21e 8015 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
8016 yyy=1
8017fi
8018case "$yyy" in
80190) val="$define"
8020 echo "Yup, it can."
8021 ;;
8022*) val="$undef"
8023 echo "Nope, it can't."
8024 ;;
8025esac
8026set d_casti32
8027eval $setvar
85e6fe83 8028$rm -f try try.*
a0d0e21e 8029
2304df62
AD
8030: check for ability to cast negative floats to unsigned
8031echo " "
8032echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 8033$cat >try.c <<EOCP
e5c9fcd0 8034#include <stdio.h>
ecfc5424 8035#include <sys/types.h>
2304df62 8036#include <signal.h>
a1896f58
AD
8037$signal_t blech(s) int s; { exit(7); }
8038$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
8039unsigned long dummy_long(p) unsigned long p; { return p; }
8040unsigned int dummy_int(p) unsigned int p; { return p; }
8041unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 8042int main()
2304df62 8043{
e5c9fcd0 8044 double f;
2304df62
AD
8045 unsigned long along;
8046 unsigned int aint;
8047 unsigned short ashort;
8048 int result = 0;
89434db5
AD
8049 char str[16];
8050
e5c9fcd0
AD
8051 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8052 a direct f = -123. assignment. gcc-2.8.0 reportedly
8053 optimized the whole file away
8054 */
89434db5
AD
8055 /* Store the number in a writable string for gcc to pass to
8056 sscanf under HP/UX.
8057 */
8058 sprintf(str, "-123");
8059 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
8060
8061 signal(SIGFPE, blech);
8062 along = (unsigned long)f;
8063 aint = (unsigned int)f;
8064 ashort = (unsigned short)f;
8065 if (along != (unsigned long)-123)
8066 result |= 1;
8067 if (aint != (unsigned int)-123)
8068 result |= 1;
8069 if (ashort != (unsigned short)-123)
8070 result |= 1;
89434db5
AD
8071 sprintf(str, "1073741824.");
8072 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
8073 f = f + f;
8074 along = 0;
8075 along = (unsigned long)f;
8076 if (along != 0x80000000)
8077 result |= 2;
8078 f -= 1.;
8079 along = 0;
8080 along = (unsigned long)f;
8081 if (along != 0x7fffffff)
8082 result |= 1;
8083 f += 2.;
8084 along = 0;
8085 along = (unsigned long)f;
8086 if (along != 0x80000001)
8087 result |= 2;
232e078e
AD
8088 if (result)
8089 exit(result);
8090 signal(SIGFPE, blech_in_list);
89434db5
AD
8091 sprintf(str, "123.");
8092 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
8093 along = dummy_long((unsigned long)f);
8094 aint = dummy_int((unsigned int)f);
8095 ashort = dummy_short((unsigned short)f);
8096 if (along != (unsigned long)123)
8097 result |= 4;
8098 if (aint != (unsigned int)123)
8099 result |= 4;
8100 if (ashort != (unsigned short)123)
8101 result |= 4;
2304df62
AD
8102 exit(result);
8103
8104}
8105EOCP
dfe9444c 8106set try
dc45a647 8107if eval $compile_ok; then
2304df62
AD
8108 ./try
8109 castflags=$?
8110else
ecfc5424 8111 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 8112 castflags=7
2304df62
AD
8113fi
8114case "$castflags" in
81150) val="$define"
8116 echo "Yup, it can."
8117 ;;
8118*) val="$undef"
8119 echo "Nope, it can't."
8120 ;;
8121esac
8122set d_castneg
8123eval $setvar
8124$rm -f try.*
8125
2304df62
AD
8126: see if vprintf exists
8127echo " "
8128if set vprintf val -f d_vprintf; eval $csym; $val; then
8129 echo 'vprintf() found.' >&4
8130 val="$define"
8131 $cat >vprintf.c <<'EOF'
8132#include <varargs.h>
8133
d674cd6d 8134int main() { xxx("foo"); }
2304df62
AD
8135
8136xxx(va_alist)
8137va_dcl
8138{
8139 va_list args;
8140 char buf[10];
8141
8142 va_start(args);
8143 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8144}
8145EOF
dfe9444c
AD
8146 set vprintf
8147 if eval $compile && ./vprintf; then
2304df62
AD
8148 echo "Your vsprintf() returns (int)." >&4
8149 val2="$undef"
8150 else
8151 echo "Your vsprintf() returns (char*)." >&4
8152 val2="$define"
8153 fi
8154else
8155 echo 'vprintf() NOT found.' >&4
8156 val="$undef"
8157 val2="$undef"
8158fi
8159set d_vprintf
8160eval $setvar
8161val=$val2
8162set d_charvspr
8163eval $setvar
8164
a0d0e21e
LW
8165: see if chown exists
8166set chown d_chown
8167eval $inlibc
8168
8169: see if chroot exists
8170set chroot d_chroot
8171eval $inlibc
8172
2304df62
AD
8173: see if chsize exists
8174set chsize d_chsize
8175eval $inlibc
8176
8177: check for const keyword
8178echo " "
8179echo 'Checking to see if your C compiler knows about "const"...' >&4
8180$cat >const.c <<'EOCP'
8181typedef struct spug { int drokk; } spug;
5a411a32 8182int main()
2304df62
AD
8183{
8184 const char *foo;
8185 const spug y;
8186}
8187EOCP
8188if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8189 val="$define"
8190 echo "Yup, it does."
8191else
8192 val="$undef"
8193 echo "Nope, it doesn't."
8194fi
8195set d_const
8196eval $setvar
8197
8198: see if crypt exists
8199echo " "
8200if set crypt val -f d_crypt; eval $csym; $val; then
8201 echo 'crypt() found.' >&4
8202 val="$define"
8203 cryptlib=''
8204else
dfe9444c 8205 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 8206 if $test -z "$cryptlib"; then
dfe9444c 8207 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
8208 else
8209 cryptlib=-lcrypt
8210 fi
8211 if $test -z "$cryptlib"; then
dfe9444c 8212 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
8213 else
8214 cryptlib=-lcrypt
8215 fi
8216 if $test -z "$cryptlib"; then
dfe9444c 8217 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
8218 else
8219 cryptlib=-lcrypt
8220 fi
8221 if $test -z "$cryptlib"; then
8222 echo 'crypt() NOT found.' >&4
8223 val="$undef"
8224 else
8225 val="$define"
8226 fi
8227fi
8228set d_crypt
8229eval $setvar
8230
921b2963
JH
8231: get csh whereabouts
8232case "$csh" in
8233'csh') val="$undef" ;;
8234*) val="$define" ;;
8235esac
8236set d_csh
8237eval $setvar
8238: Respect a hint or command line value for full_csh.
8239case "$full_csh" in
8240'') full_csh=$csh ;;
8241esac
8242
a0d0e21e
LW
8243: see if cuserid exists
8244set cuserid d_cuserid
2304df62
AD
8245eval $inlibc
8246
a0d0e21e
LW
8247: see if this is a limits.h system
8248set limits.h i_limits
85e6fe83
LW
8249eval $inhdr
8250
a0d0e21e
LW
8251: see if this is a float.h system
8252set float.h i_float
8253eval $inhdr
8254
8255: See if number of significant digits in a double precision number is known
8256echo " "
8257$cat >dbl_dig.c <<EOM
8258#$i_limits I_LIMITS
8259#$i_float I_FLOAT
8260#ifdef I_LIMITS
8261#include <limits.h>
85e6fe83 8262#endif
a0d0e21e
LW
8263#ifdef I_FLOAT
8264#include <float.h>
8265#endif
8266#ifdef DBL_DIG
8267printf("Contains DBL_DIG");
85e6fe83 8268#endif
85e6fe83 8269EOM
a0d0e21e
LW
8270$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8271if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8272 echo "DBL_DIG found." >&4
8273 val="$define"
2304df62 8274else
a0d0e21e
LW
8275 echo "DBL_DIG NOT found." >&4
8276 val="$undef"
2304df62 8277fi
a0d0e21e
LW
8278$rm -f dbl_dig.?
8279set d_dbl_dig
2304df62 8280eval $setvar
2304df62 8281
a0d0e21e
LW
8282: see if difftime exists
8283set difftime d_difftime
2304df62
AD
8284eval $inlibc
8285
a0d0e21e
LW
8286: see if this is a dirent system
8287echo " "
8288if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8289 val="$define"
8290 echo "<dirent.h> found." >&4
8291else
8292 val="$undef"
8293 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8294 echo "<sys/dir.h> found." >&4
8295 echo " "
8296 else
8297 xinc=`./findhdr sys/ndir.h`
8298 fi
8299 echo "<dirent.h> NOT found." >&4
8300fi
8301set i_dirent
8302eval $setvar
8303
8304: Look for type of directory structure.
8305echo " "
8306$cppstdin $cppflags $cppminus < "$xinc" > try.c
8307
8308case "$direntrytype" in
8309''|' ')
8310 case "$i_dirent" in
8311 $define) guess1='struct dirent' ;;
8312 *) guess1='struct direct' ;;
2afac517 8313 esac
8314 ;;
8315*) guess1="$direntrytype"
8316 ;;
8e07c86e
AD
8317esac
8318
2afac517 8319case "$guess1" in
8320'struct dirent') guess2='struct direct' ;;
8321*) guess2='struct dirent' ;;
8322esac
8323
8324if $contains "$guess1" try.c >/dev/null 2>&1; then
8325 direntrytype="$guess1"
8326 echo "Your directory entries are $direntrytype." >&4
8327elif $contains "$guess2" try.c >/dev/null 2>&1; then
8328 direntrytype="$guess2"
8329 echo "Your directory entries seem to be $direntrytype." >&4
8330else
8331 echo "I don't recognize your system's directory entries." >&4
8332 rp="What type is used for directory entries on this system?"
8333 dflt="$guess1"
8334 . ./myread
8335 direntrytype="$ans"
8336fi
8337$rm -f try.c
a0d0e21e 8338
a0d0e21e 8339
2afac517 8340: see if the directory entry stores field length
8341echo " "
8342$cppstdin $cppflags $cppminus < "$xinc" > try.c
8343if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8344 echo "Good, your directory entry keeps length information in d_namlen." >&4
8345 val="$define"
8346else
8347 echo "Your directory entry does not know about the d_namlen field." >&4
8348 val="$undef"
8349fi
8350set d_dirnamlen
8351eval $setvar
8352$rm -f try.c
a0d0e21e 8353
5ff3f7a4
GS
8354: see if dlerror exists
8355xxx_runnm="$runnm"
8356runnm=false
8357set dlerror d_dlerror
8358eval $inlibc
8359runnm="$xxx_runnm"
8360
8361: see if dlfcn is available
8362set dlfcn.h i_dlfcn
8363eval $inhdr
8364
8365case "$usedl" in
8366$define|y|true)
8367 $cat << EOM
8368
8369On a few systems, the dynamically loaded modules that perl generates and uses
8370will need a different extension than shared libs. The default will probably
8371be appropriate.
8372
8373EOM
8374 case "$dlext" in
8375 '') dflt="$so" ;;
8376 *) dflt="$dlext" ;;
8377 esac
8378 rp='What is the extension of dynamically loaded modules'
8379 . ./myread
8380 dlext="$ans"
8381 ;;
8382*)
8383 dlext="none"
8384 ;;
8385esac
8386
8387: Check if dlsym need a leading underscore
a0d0e21e
LW
8388echo " "
8389val="$undef"
8390
8391case "$dlsrc" in
8392dl_dlopen.xs)
8393 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8394 $cat >dyna.c <<'EOM'
8395fred () { }
8396EOM
8397
8398$cat >fred.c<<EOM
8399
8400#include <stdio.h>
8401#$i_dlfcn I_DLFCN
8402#ifdef I_DLFCN
8403#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8404#else
8405#include <sys/types.h>
8406#include <nlist.h>
8407#include <link.h>
8408#endif
8409
8410extern int fred() ;
8411
5a411a32 8412int main()
a0d0e21e
LW
8413{
8414 void * handle ;
8415 void * symbol ;
8416#ifndef RTLD_LAZY
8417 int mode = 1 ;
8418#else
8419 int mode = RTLD_LAZY ;
8420#endif
8421 handle = dlopen("./dyna.$dlext", mode) ;
8422 if (handle == NULL) {
5f05dabc 8423 printf ("1\n") ;
8424 fflush (stdout) ;
8425 exit(0);
a0d0e21e
LW
8426 }
8427 symbol = dlsym(handle, "fred") ;
8428 if (symbol == NULL) {
5f05dabc 8429 /* try putting a leading underscore */
8430 symbol = dlsym(handle, "_fred") ;
8431 if (symbol == NULL) {
8432 printf ("2\n") ;
8433 fflush (stdout) ;
8434 exit(0);
8435 }
8436 printf ("3\n") ;
a0d0e21e
LW
8437 }
8438 else
5f05dabc 8439 printf ("4\n") ;
36477c24 8440 fflush (stdout) ;
8441 exit(0);
a0d0e21e
LW
8442}
8443EOM
760ac839 8444 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 8445 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
8446 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
8447 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 8448 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
8449 xxx=`./fred`
8450 case $xxx in
8451 1) echo "Test program failed using dlopen." >&4
8452 echo "Perhaps you should not use dynamic loading." >&4;;
8453 2) echo "Test program failed using dlsym." >&4
8454 echo "Perhaps you should not use dynamic loading." >&4;;
8455 3) echo "dlsym needs a leading underscore" >&4
8456 val="$define" ;;
8457 4) echo "dlsym doesn't need a leading underscore." >&4;;
8458 esac
8459 else
8460 echo "I can't compile and run the test program." >&4
88d5303d 8461 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
a0d0e21e
LW
8462 fi
8463 ;;
8464esac
8465
a78b0d02 8466$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
8467
8468set d_dlsymun
8469eval $setvar
8470
85ab1d1d
JH
8471hasproto='varname=$1; func=$2; shift; shift;
8472while $test $# -ge 2; do
8473 case "$1" in
8474 $define) echo "#include <$2>";;
8475 esac ;
8476 shift 2;
8477done > try.c;
8478$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8479if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8480 echo "$func() prototype found.";
8481 val="$define";
8482else
8483 echo "$func() prototype NOT found.";
8484 val="$undef";
8485fi;
8486set $varname;
8487eval $setvar;
8488$rm -f try.c tryout.c'
8489
8490: see if prototype for drand48 is available
8491echo " "
8492set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8493eval $hasproto
8494
a0d0e21e
LW
8495: see if dup2 exists
8496set dup2 d_dup2
8497eval $inlibc
8498
5ff3f7a4
GS
8499: see if eaccess exists
8500set eaccess d_eaccess
8501eval $inlibc
8502
8503: see if endgrent exists
8504set endgrent d_endgrent
8505eval $inlibc
8506
e5c9fcd0
AD
8507: see if endhostent exists
8508set endhostent d_endhent
8509eval $inlibc
8510
8511: see if endnetent exists
8512set endnetent d_endnent
8513eval $inlibc
8514
8515: see if endprotoent exists
8516set endprotoent d_endpent
8517eval $inlibc
8518
5ff3f7a4
GS
8519: see if endpwent exists
8520set endpwent d_endpwent
8521eval $inlibc
8522
e5c9fcd0
AD
8523: see if endservent exists
8524set endservent d_endsent
8525eval $inlibc
8526
f1066039
JH
8527: see if endspent exists
8528set endspent d_endspent
8529eval $inlibc
8530
8e07c86e
AD
8531: Locate the flags for 'open()'
8532echo " "
8533$cat >open3.c <<'EOCP'
8534#include <sys/types.h>
8535#ifdef I_FCNTL
8536#include <fcntl.h>
8537#endif
8538#ifdef I_SYS_FILE
8539#include <sys/file.h>
8540#endif
d674cd6d 8541int main() {
8e07c86e
AD
8542 if(O_RDONLY);
8543#ifdef O_TRUNC
8544 exit(0);
8545#else
8546 exit(1);
8547#endif
8548}
8549EOCP
8550: check sys/file.h first to get FREAD on Sun
8551if $test `./findhdr sys/file.h` && \
dfe9444c 8552 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8553 h_sysfile=true;
8554 echo "<sys/file.h> defines the O_* constants..." >&4
8555 if ./open3; then
8556 echo "and you have the 3 argument form of open()." >&4
8557 val="$define"
8558 else
8559 echo "but not the 3 argument form of open(). Oh, well." >&4
8560 val="$undef"
8561 fi
8562elif $test `./findhdr fcntl.h` && \
dfe9444c 8563 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8564 h_fcntl=true;
8565 echo "<fcntl.h> defines the O_* constants..." >&4
8566 if ./open3; then
8567 echo "and you have the 3 argument form of open()." >&4
8568 val="$define"
8569 else
8570 echo "but not the 3 argument form of open(). Oh, well." >&4
8571 val="$undef"
8572 fi
8573else
8574 val="$undef"
8575 echo "I can't find the O_* constant definitions! You got problems." >&4
8576fi
8577set d_open3
8578eval $setvar
8579$rm -f open3*
8580
213c275f
JH
8581: see which of string.h or strings.h is needed
8582echo " "
8583strings=`./findhdr string.h`
8584if $test "$strings" && $test -r "$strings"; then
8585 echo "Using <string.h> instead of <strings.h>." >&4
8586 val="$define"
8587else
8588 val="$undef"
8589 strings=`./findhdr strings.h`
8590 if $test "$strings" && $test -r "$strings"; then
8591 echo "Using <strings.h> instead of <string.h>." >&4
8592 else
8593 echo "No string header found -- You'll surely have problems." >&4
8594 fi
8595fi
8596set i_string
8597eval $setvar
8598case "$i_string" in
8599"$undef") strings=`./findhdr strings.h`;;
8600*) strings=`./findhdr string.h`;;
8601esac
8602
8e07c86e
AD
8603: check for non-blocking I/O stuff
8604case "$h_sysfile" in
8605true) echo "#include <sys/file.h>" > head.c;;
8606*)
8607 case "$h_fcntl" in
8608 true) echo "#include <fcntl.h>" > head.c;;
8609 *) echo "#include <sys/fcntl.h>" > head.c;;
8610 esac
8611 ;;
8612esac
8613echo " "
8614echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8615case "$o_nonblock" in
8616'')
8617 $cat head.c > try.c
8618 $cat >>try.c <<'EOCP'
213c275f 8619#include <stdio.h>
d674cd6d 8620int main() {
8e07c86e
AD
8621#ifdef O_NONBLOCK
8622 printf("O_NONBLOCK\n");
8623 exit(0);
8624#endif
8625#ifdef O_NDELAY
8626 printf("O_NDELAY\n");
8627 exit(0);
8628#endif
8629#ifdef FNDELAY
8630 printf("FNDELAY\n");
8631 exit(0);
8632#endif
8633 exit(0);
8634}
8635EOCP
dfe9444c 8636 set try
dc45a647 8637 if eval $compile_ok; then
8e07c86e
AD
8638 o_nonblock=`./try`
8639 case "$o_nonblock" in
8640 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8641 *) echo "Seems like we can use $o_nonblock.";;
8642 esac
8643 else
8644 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8645 fi
8646 ;;
8647*) echo "Using $hint value $o_nonblock.";;
8648esac
8649$rm -f try try.* .out core
8650
8651echo " "
8652echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8653case "$eagain" in
8654'')
8655 $cat head.c > try.c
8656 $cat >>try.c <<EOCP
8657#include <errno.h>
8658#include <sys/types.h>
8659#include <signal.h>
213c275f 8660#include <stdio.h>
4633a7c4 8661#define MY_O_NONBLOCK $o_nonblock
dc45a647 8662#ifndef errno /* XXX need better Configure test */
8e07c86e 8663extern int errno;
dc45a647 8664#endif
14e4fe40
JH
8665#$i_unistd I_UNISTD
8666#ifdef I_UNISTD
213c275f
JH
8667#include <unistd.h>
8668#endif
1acc7ade
JH
8669#$i_string I_STRING
8670#ifdef I_STRING
213c275f
JH
8671#include <string.h>
8672#else
8673#include <strings.h>
8674#endif
8e07c86e 8675$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8676EOCP
8677 $cat >> try.c <<'EOCP'
d674cd6d 8678int main()
8e07c86e
AD
8679{
8680 int pd[2];
8681 int pu[2];
8682 char buf[1];
8683 char string[100];
8684
8685 pipe(pd); /* Down: child -> parent */
8686 pipe(pu); /* Up: parent -> child */
8687 if (0 != fork()) {
8688 int ret;
8689 close(pd[1]); /* Parent reads from pd[0] */
8690 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8691 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8692 exit(1);
8693 signal(SIGALRM, blech);
8694 alarm(5);
8695 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8696 exit(2);
8697 sprintf(string, "%d\n", ret);
8698 write(2, string, strlen(string));
8699 alarm(0);
8700#ifdef EAGAIN
8701 if (errno == EAGAIN) {
8702 printf("EAGAIN\n");
8703 goto ok;
8704 }
8705#endif
8706#ifdef EWOULDBLOCK
8707 if (errno == EWOULDBLOCK)
8708 printf("EWOULDBLOCK\n");
8709#endif
8710 ok:
8711 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8712 sleep(2); /* Give it time to close our pipe */
8713 alarm(5);
8714 ret = read(pd[0], buf, 1); /* Should read EOF */
8715 alarm(0);
8716 sprintf(string, "%d\n", ret);
8717 write(3, string, strlen(string));
8718 exit(0);
8719 }
8720
8721 close(pd[0]); /* We write to pd[1] */
8722 close(pu[1]); /* We read from pu[0] */
8723 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8724 close(pd[1]); /* Pipe pd is now fully closed! */
8725 exit(0); /* Bye bye, thank you for playing! */
8726}
8727EOCP
dfe9444c 8728 set try
dc45a647 8729 if eval $compile_ok; then
774d564b 8730 echo "$startsh" >mtry
40a7a20a 8731 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8732 chmod +x mtry
8733 ./mtry >/dev/null 2>&1
8734 case $? in
8735 0) eagain=`$cat try.out`;;
8736 1) echo "Could not perform non-blocking setting!";;
8737 2) echo "I did a successful read() for something that was not there!";;
8738 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8739 *) echo "Something terribly wrong happened during testing.";;
8740 esac
8741 rd_nodata=`$cat try.ret`
8742 echo "A read() system call with no data present returns $rd_nodata."
8743 case "$rd_nodata" in
8744 0|-1) ;;
8745 *)
8746 echo "(That's peculiar, fixing that to be -1.)"
8747 rd_nodata=-1
8748 ;;
8749 esac
8750 case "$eagain" in
8751 '')
8752 echo "Forcing errno EAGAIN on read() with no data available."
8753 eagain=EAGAIN
8754 ;;
8755 *)
8756 echo "Your read() sets errno to $eagain when no data is available."
8757 ;;
8758 esac
8759 status=`$cat try.err`
8760 case "$status" in
8761 0) echo "And it correctly returns 0 to signal EOF.";;
8762 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8763 *) echo "However, your read() returns '$status' on EOF??";;
8764 esac
8765 val="$define"
28757baa 8766 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8767 echo "WARNING: you can't distinguish between EOF and no data!"
8768 val="$undef"
8769 fi
8770 else
8771 echo "I can't compile the test program--assuming errno EAGAIN will do."
8772 eagain=EAGAIN
8773 fi
8774 set d_eofnblk
8775 eval $setvar
8776 ;;
8777*)
8778 echo "Using $hint value $eagain."
8779 echo "Your read() returns $rd_nodata when no data is present."
8780 case "$d_eofnblk" in
8781 "$define") echo "And you can see EOF because read() returns 0.";;
8782 "$undef") echo "But you can't see EOF status from read() returned value.";;
8783 *)
8784 echo "(Assuming you can't see EOF status from read anyway.)"
8785 d_eofnblk=$undef
8786 ;;
8787 esac
8788 ;;
8789esac
8790$rm -f try try.* .out core head.c mtry
8791
a0d0e21e
LW
8792: see if fchmod exists
8793set fchmod d_fchmod
8794eval $inlibc
8795
8796: see if fchown exists
8797set fchown d_fchown
8798eval $inlibc
8799
8800: see if this is an fcntl system
8801set fcntl d_fcntl
8802eval $inlibc
8803
b7b35fc2
JH
8804hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8805while $test $# -ge 2; do
8806 case "$1" in
8807 $define) echo "#include <$2>";;
8808 esac ;
8809 shift 2;
8810done > try.c;
8811echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8812set try;
8813if eval $compile; then
8814 val="$define";
8815else
8816 val="$undef";
8817fi;
8818set $varname;
8819eval $setvar;
8820$rm -f try.c try.o'
8821
8822socketlib=''
8823sockethdr=''
8824: see whether socket exists
8825echo " "
8826$echo $n "Hmm... $c" >&4
8827if set socket val -f d_socket; eval $csym; $val; then
8828 echo "Looks like you have Berkeley networking support." >&4
8829 d_socket="$define"
8830 if set setsockopt val -f; eval $csym; $val; then
8831 d_oldsock="$undef"
8832 else
8833 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8834 d_oldsock="$define"
8835 fi
8836else
8837 if $contains socklib libc.list >/dev/null 2>&1; then
8838 echo "Looks like you have Berkeley networking support." >&4
8839 d_socket="$define"
8840 : we will have to assume that it supports the 4.2 BSD interface
8841 d_oldsock="$undef"
8842 else
8843 echo "You don't have Berkeley networking in libc$_a..." >&4
8844 if test "X$d_socket" = "X$define"; then
8845 echo "...but you seem to believe that you have sockets." >&4
8846 else
8847 for net in net socket
8848 do
8849 if test -f /usr/lib/lib$net$_a; then
8850 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8851 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8852 if $contains socket libc.list >/dev/null 2>&1; then
8853 d_socket="$define"
8854 socketlib="-l$net"
8855 case "$net" in
8856 net)
8857 echo "...but the Wollongong group seems to have hacked it in." >&4
8858 sockethdr="-I/usr/netinclude"
8859 ;;
8860 esac
8861 echo "Found Berkeley sockets interface in lib$net." >& 4
8862 if $contains setsockopt libc.list >/dev/null 2>&1; then
8863 d_oldsock="$undef"
8864 else
8865 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8866 d_oldsock="$define"
8867 fi
8868 break
8869 fi
8870 fi
8871 done
8872 if test "X$d_socket" != "X$define"; then
8873 echo "or anywhere else I see." >&4
8874 d_socket="$undef"
8875 d_oldsock="$undef"
8876 fi
8877 fi
8878 fi
8879fi
8880
8881: see if socketpair exists
8882set socketpair d_sockpair
8883eval $inlibc
8884
8885
8886echo " "
8887echo "Checking the availability of certain socket constants..." >& 4
8888for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8889 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8890 $cat >try.c <<EOF
8891#include <sys/types.h>
8892#include <sys/socket.h>
8893int main() {
8894 int i = $ENUM;
8895}
8896EOF
8897 val="$undef"
8898 set try; if eval $compile; then
8899 val="$define"
8900 fi
8901 set d_${enum}; eval $setvar
8902 $rm -f try.c try
8903done
8904
921b2963
JH
8905: see if sys/select.h has to be included
8906set sys/select.h i_sysselct
8907eval $inhdr
8908
8909: see if we should include time.h, sys/time.h, or both
8910echo " "
8911if test "X$timeincl" = X; then
8912 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8913 $echo $n "I'm now running the test program...$c"
8914 $cat >try.c <<'EOCP'
8915#include <sys/types.h>
8916#ifdef I_TIME
8917#include <time.h>
8918#endif
8919#ifdef I_SYSTIME
8920#ifdef SYSTIMEKERNEL
8921#define KERNEL
8922#endif
8923#include <sys/time.h>
8924#endif
8925#ifdef I_SYSSELECT
8926#include <sys/select.h>
8927#endif
d674cd6d 8928int main()
921b2963
JH
8929{
8930 struct tm foo;
8931#ifdef S_TIMEVAL
8932 struct timeval bar;
8933#endif
8934#ifdef S_TIMEZONE
8935 struct timezone tzp;
8936#endif
8937 if (foo.tm_sec == foo.tm_sec)
8938 exit(0);
8939#ifdef S_TIMEVAL
8940 if (bar.tv_sec == bar.tv_sec)
8941 exit(0);
8942#endif
8943 exit(1);
8944}
8945EOCP
8946 flags=''
8947 for s_timezone in '-DS_TIMEZONE' ''; do
8948 sysselect=''
8949 for s_timeval in '-DS_TIMEVAL' ''; do
8950 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8951 for i_time in '' '-DI_TIME'; do
8952 for i_systime in '-DI_SYSTIME' ''; do
8953 case "$flags" in
8954 '') $echo $n ".$c"
8955 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8956 if eval $compile; then
8957 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8958 shift
8959 flags="$*"
8960 echo " "
8961 $echo $n "Succeeded with $flags$c"
8962 fi
8963 ;;
8964 esac
8965 done
8966 done
8967 done
8968 done
8969 done
8970 timeincl=''
8971 echo " "
8972 case "$flags" in
8973 *SYSTIMEKERNEL*) i_systimek="$define"
8974 timeincl=`./findhdr sys/time.h`
8975 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8976 *) i_systimek="$undef";;
8977 esac
8978 case "$flags" in
8979 *I_TIME*) i_time="$define"
8980 timeincl=`./findhdr time.h`" $timeincl"
8981 echo "We'll include <time.h>." >&4;;
8982 *) i_time="$undef";;
8983 esac
8984 case "$flags" in
8985 *I_SYSTIME*) i_systime="$define"
8986 timeincl=`./findhdr sys/time.h`" $timeincl"
8987 echo "We'll include <sys/time.h>." >&4;;
8988 *) i_systime="$undef";;
8989 esac
8990 $rm -f try.c try
8991fi
8992
8993: check for fd_set items
8994$cat <<EOM
8995
8996Checking to see how well your C compiler handles fd_set and friends ...
8997EOM
8998$cat >fd_set.c <<EOCP
8999#$i_systime I_SYS_TIME
9000#$i_sysselct I_SYS_SELECT
9001#$d_socket HAS_SOCKET
9002#include <sys/types.h>
9003#ifdef HAS_SOCKET
9004#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9005#endif
9006#ifdef I_SYS_TIME
9007#include <sys/time.h>
9008#endif
9009#ifdef I_SYS_SELECT
9010#include <sys/select.h>
9011#endif
d674cd6d 9012int main() {
921b2963
JH
9013 fd_set fds;
9014
9015#ifdef TRYBITS
9016 if(fds.fds_bits);
9017#endif
9018
9019#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9020 exit(0);
9021#else
9022 exit(1);
9023#endif
9024}
9025EOCP
9026set fd_set -DTRYBITS
9027if eval $compile; then
9028 d_fds_bits="$define"
9029 d_fd_set="$define"
9030 echo "Well, your system knows about the normal fd_set typedef..." >&4
9031 if ./fd_set; then
9032 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9033 d_fd_macros="$define"
9034 else
9035 $cat >&4 <<'EOM'
9036but not the normal fd_set macros! Gaaack! I'll have to cover for you.
9037EOM
9038 d_fd_macros="$undef"
9039 fi
9040else
9041 $cat <<'EOM'
9042Hmm, your compiler has some difficulty with fd_set. Checking further...
9043EOM
9044 set fd_set
9045 if eval $compile; then
9046 d_fds_bits="$undef"
9047 d_fd_set="$define"
9048 echo "Well, your system has some sort of fd_set available..." >&4
9049 if ./fd_set; then
9050 echo "and you have the normal fd_set macros." >&4
9051 d_fd_macros="$define"
9052 else
9053 $cat <<'EOM'
9054but not the normal fd_set macros! Gross! More work for me...
9055EOM
9056 d_fd_macros="$undef"
9057 fi
9058 else
9059 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9060 d_fd_set="$undef"
9061 d_fds_bits="$undef"
9062 d_fd_macros="$undef"
9063 fi
9064fi
9065$rm -f fd_set*
9066
a0d0e21e
LW
9067: see if fgetpos exists
9068set fgetpos d_fgetpos
9069eval $inlibc
9070
8175356b
JH
9071: see if flock exists
9072set flock d_flock
9073eval $inlibc
9074
9075: see if fork exists
9076set fork d_fork
9077eval $inlibc
9078
9079: see if pathconf exists
9080set pathconf d_pathconf
9081eval $inlibc
9082
9083: see if fpathconf exists
9084set fpathconf d_fpathconf
9085eval $inlibc
9086
d9b3e12d 9087
d9b3e12d
JH
9088: check for fpos64_t
9089echo " "
c5f05a91 9090echo "Checking to see if you have fpos64_t..." >&4
d9b3e12d 9091$cat >try.c <<EOCP
ce65dbcf 9092#include <stdio.h>
3c96ce7f 9093int main() { fpos64_t x = 7; }
d9b3e12d 9094EOCP
8175356b
JH
9095set try
9096if eval $compile; then
d9b3e12d 9097 val="$define"
c5f05a91 9098 echo "You have fpos64_t."
d9b3e12d
JH
9099else
9100 val="$undef"
c5f05a91 9101 echo "You do not have fpos64_t."
8175356b 9102 case "$fpossize" in
1eeb0f31 9103 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8175356b 9104 esac
d9b3e12d 9105fi
8175356b 9106$rm -f try.* try
d9b3e12d
JH
9107set d_fpos64_t
9108eval $setvar
9109
a3540c92
JH
9110: see if frexpl exists
9111set frexpl d_frexpl
9112eval $inlibc
9113
0545a864
JH
9114hasstruct='varname=$1; struct=$2; shift; shift;
9115while $test $# -ge 2; do
9116 case "$1" in
9117 $define) echo "#include <$2>";;
9118 esac ;
9119 shift 2;
9120done > try.c;
9121echo "int main () { struct $struct foo; }" >> try.c;
9122set try;
9123if eval $compile; then
9124 val="$define";
9125else
9126 val="$undef";
9127fi;
9128set $varname;
9129eval $setvar;
9130$rm -f try.c try.o'
d9b3e12d 9131
9b9c89a3
JH
9132: see if this is a sys/param system
9133set sys/param.h i_sysparam
9134eval $inhdr
9135
104d25b7
JH
9136: see if this is a sys/mount.h system
9137set sys/mount.h i_sysmount
9138eval $inhdr
9139
0545a864
JH
9140: see if sys/types.h has to be included
9141set sys/types.h i_systypes
9142eval $inhdr
9143
0545a864 9144
ad27e871 9145echo " "
8175356b 9146echo "Checking to see if your system supports struct fs_data..." >&4
0545a864
JH
9147set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9148eval $hasstruct
9149case "$d_fs_data_s" in
a22e52b9
JH
9150"$define") echo "Yes, it does." ;;
9151*) echo "No, it doesn't." ;;
0545a864
JH
9152esac
9153
9154: see if fseeko exists
9155set fseeko d_fseeko
9156eval $inlibc
1eeb0f31 9157case "$longsize" in
43999f95 91588) echo "(Your long is 64 bits, so you could use fseek.)" ;;
1eeb0f31 9159esac
0545a864
JH
9160
9161: see if fsetpos exists
9162set fsetpos d_fsetpos
9163eval $inlibc
9164
9165
9166: see if fstatfs exists
9167set fstatfs d_fstatfs
9168eval $inlibc
104d25b7
JH
9169
9170
9171: see if statvfs exists
9172set statvfs d_statvfs
9173eval $inlibc
9174
9175: see if fstatvfs exists
9176set fstatvfs d_fstatvfs
9177eval $inlibc
9178
9179
5ff3f7a4
GS
9180: see if ftello exists
9181set ftello d_ftello
9182eval $inlibc
1eeb0f31 9183case "$longsize" in
43999f95 91848) echo "(Your long is 64 bits, so you could use ftell.)" ;;
1eeb0f31 9185esac
5ff3f7a4 9186
49dabb45
JH
9187: see if getcwd exists
9188set getcwd d_getcwd
9189eval $inlibc
9190
c890dc6c
JH
9191
9192: see if getfsstat exists
9193set getfsstat d_getfsstat
9194eval $inlibc
9195
5ff3f7a4
GS
9196: see if getgrent exists
9197set getgrent d_getgrent
9198eval $inlibc
9199
693762b4
AD
9200: see if gethostbyaddr exists
9201set gethostbyaddr d_gethbyaddr
9202eval $inlibc
9203
9204: see if gethostbyname exists
9205set gethostbyname d_gethbyname
9206eval $inlibc
9207
a0d0e21e
LW
9208: see if gethostent exists
9209set gethostent d_gethent
9210eval $inlibc
9211
921b2963
JH
9212: see how we will look up host name
9213echo " "
a63faeb8
JH
9214call=''
9215if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
9216 echo 'gethostname() found.' >&4
9217 d_gethname="$define"
9218 call=gethostname
a63faeb8
JH
9219fi
9220if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
9221 if ./xenix; then
9222 $cat <<'EOM'
9223uname() was found, but you're running xenix, and older versions of xenix
9224have a broken uname(). If you don't really know whether your xenix is old
9225enough to have a broken system call, use the default answer.
9226
9227EOM
9228 dflt=y
9229 case "$d_uname" in
9230 "$define") dflt=n;;
9231 esac
9232 rp='Is your uname() broken?'
9233 . ./myread
9234 case "$ans" in
9235 n*) d_uname="$define"; call=uname;;
9236 esac
9237 else
9238 echo 'uname() found.' >&4
9239 d_uname="$define"
a63faeb8
JH
9240 case "$call" in
9241 '') call=uname ;;
9242 esac
921b2963
JH
9243 fi
9244fi
9245case "$d_gethname" in
9246'') d_gethname="$undef";;
9247esac
9248case "$d_uname" in
9249'') d_uname="$undef";;
9250esac
9251case "$d_uname$d_gethname" in
9252*define*)
9253 dflt=n
9254 cat <<EOM
9255
9256Every now and then someone has a $call() that lies about the hostname
9257but can't be fixed for political or economic reasons. If you wish, I can
9258pretend $call() isn't there and maybe compute hostname at run-time
9259thanks to the '$phostname' command.
9260
9261EOM
9262 rp="Shall I ignore $call() from now on?"
9263 . ./myread
9264 case "$ans" in
9265 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9266 esac;;
9267esac
9268case "$phostname" in
9269'') aphostname='';;
9270*) case "$aphostname" in
9271 /*) ;;
9272 *) set X $phostname
9273 shift
9274 file=$1
9275 shift
9276 file=`./loc $file $file $pth`
9277 aphostname=`echo $file $*`
9278 ;;
9279 esac
9280 ;;
9281esac
9282case "$d_uname$d_gethname" in
9283*define*) ;;
9284*)
9285 case "$phostname" in
9286 '')
9287 echo "There will be no way for $package to get your hostname." >&4;;
9288 *)
9289 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9290 ;;
9291 esac;;
9292esac
9293case "$d_phostname" in
9294'') d_phostname="$undef";;
9295esac
9296
dc45a647
MB
9297: see if this is a netdb.h system
9298set netdb.h i_netdb
9299eval $inhdr
9300
9301: see if prototypes for various gethostxxx netdb.h functions are available
9302echo " "
9303set d_gethostprotos gethostent $i_netdb netdb.h
9304eval $hasproto
9305
a0d0e21e
LW
9306: see if getlogin exists
9307set getlogin d_getlogin
9308eval $inlibc
9309
ad27e871
JH
9310: see if getmnt exists
9311set getmnt d_getmnt
9312eval $inlibc
9313
ccc7f9b3
KS
9314: see if getmntent exists
9315set getmntent d_getmntent
9316eval $inlibc
9317
693762b4
AD
9318: see if getnetbyaddr exists
9319set getnetbyaddr d_getnbyaddr
9320eval $inlibc
9321
9322: see if getnetbyname exists
9323set getnetbyname d_getnbyname
9324eval $inlibc
9325
e5c9fcd0
AD
9326: see if getnetent exists
9327set getnetent d_getnent
9328eval $inlibc
9329
dc45a647
MB
9330: see if prototypes for various getnetxxx netdb.h functions are available
9331echo " "
9332set d_getnetprotos getnetent $i_netdb netdb.h
9333eval $hasproto
9334
693762b4
AD
9335
9336: see if getprotobyname exists
9337set getprotobyname d_getpbyname
9338eval $inlibc
9339
9340: see if getprotobynumber exists
9341set getprotobynumber d_getpbynumber
9342eval $inlibc
e5c9fcd0
AD
9343
9344: see if getprotoent exists
9345set getprotoent d_getpent
9346eval $inlibc
9347
2afac517 9348: see if getpgid exists
9349set getpgid d_getpgid
a0d0e21e
LW
9350eval $inlibc
9351
9352: see if getpgrp2 exists
9353set getpgrp2 d_getpgrp2
9354eval $inlibc
9355
9356: see if getppid exists
9357set getppid d_getppid
9358eval $inlibc
9359
9360: see if getpriority exists
9361set getpriority d_getprior
9362eval $inlibc
9363
dc45a647
MB
9364: see if prototypes for various getprotoxxx netdb.h functions are available
9365echo " "
9366set d_getprotoprotos getprotoent $i_netdb netdb.h
9367eval $hasproto
9368
5ff3f7a4
GS
9369: see if getpwent exists
9370set getpwent d_getpwent
9371eval $inlibc
9372
9373
693762b4
AD
9374: see if getservbyname exists
9375set getservbyname d_getsbyname
9376eval $inlibc
9377
9378: see if getservbyport exists
9379set getservbyport d_getsbyport
9380eval $inlibc
e5c9fcd0
AD
9381
9382: see if getservent exists
9383set getservent d_getsent
9384eval $inlibc
9385
dc45a647
MB
9386: see if prototypes for various getservxxx netdb.h functions are available
9387echo " "
9388set d_getservprotos getservent $i_netdb netdb.h
9389eval $hasproto
9390
f1066039
JH
9391: see if getspent exists
9392set getspent d_getspent
9393eval $inlibc
9394
9395: see if getspnam exists
9396set getspnam d_getspnam
9397eval $inlibc
9398
5f05dabc 9399: see if gettimeofday or ftime exists
9400set gettimeofday d_gettimeod
9401eval $inlibc
9402case "$d_gettimeod" in
9403"$undef")
9404 set ftime d_ftime
9405 eval $inlibc
9406 ;;
9407*)
9408 val="$undef"; set d_ftime; eval $setvar
9409 ;;
9410esac
9411case "$d_gettimeod$d_ftime" in
9412"$undef$undef")
9413 echo " "
9414 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9415 ;;
9416esac
9417
5ff3f7a4
GS
9418: see if this is an grp system
9419set grp.h i_grp
9420eval $inhdr
9421
9422case "$i_grp" in
9423$define)
9424 xxx=`./findhdr grp.h`
9425 $cppstdin $cppflags $cppminus < $xxx >$$.h
9426
9427 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9428 val="$define"
9429 else
9430 val="$undef"
9431 fi
9432 set d_grpasswd
9433 eval $setvar
9434
9435 $rm -f $$.h
9436 ;;
9437*)
9438 val="$undef";
9439 set d_grpasswd; eval $setvar
9440 ;;
9441esac
9442
ccc7f9b3
KS
9443: see if hasmntopt exists
9444set hasmntopt d_hasmntopt
9445eval $inlibc
9446
a0d0e21e
LW
9447: see if this is a netinet/in.h or sys/in.h system
9448set netinet/in.h i_niin sys/in.h i_sysin
9449eval $inhdr
9450
5ff3f7a4 9451: see if arpa/inet.h has to be included
93341792 9452set arpa/inet.h i_arpainet
28e8609d
JH
9453eval $inhdr
9454
a0d0e21e
LW
9455: see if htonl --and friends-- exists
9456val=''
9457set htonl val
9458eval $inlibc
9459
9460: Maybe they are macros.
9461case "$val" in
9462$undef)
9463 $cat >htonl.c <<EOM
9464#include <stdio.h>
9465#include <sys/types.h>
9466#$i_niin I_NETINET_IN
9467#$i_sysin I_SYS_IN
93341792 9468#$i_arpainet I_ARPA_INET
a0d0e21e
LW
9469#ifdef I_NETINET_IN
9470#include <netinet/in.h>
9471#endif
9472#ifdef I_SYS_IN
9473#include <sys/in.h>
9474#endif
28e8609d
JH
9475#ifdef I_ARPA_INET
9476#include <arpa/inet.h>
9477#endif
a0d0e21e
LW
9478#ifdef htonl
9479printf("Defined as a macro.");
9480#endif
9481EOM
9482 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9483 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9484 val="$define"
9485 echo "But it seems to be defined as a macro." >&4
9486 fi
9487 $rm -f htonl.?
9488 ;;
9489esac
9490set d_htonl
9491eval $setvar
9492
43999f95
JH
9493: see if iconv exists
9494set iconv d_iconv
9495eval $inlibc
9496
a0d0e21e
LW
9497: index or strchr
9498echo " "
9499if set index val -f; eval $csym; $val; then
9500 if set strchr val -f d_strchr; eval $csym; $val; then
9501 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9502 val="$define"
9503 vali="$undef"
9504 echo "strchr() found." >&4
9505 else
9506 val="$undef"
9507 vali="$define"
9508 echo "index() found." >&4
9509 fi
9510 else
9511 val="$undef"
9512 vali="$define"
9513 echo "index() found." >&4
9514 fi
9515else
9516 if set strchr val -f d_strchr; eval $csym; $val; then
9517 val="$define"
9518 vali="$undef"
9519 echo "strchr() found." >&4
9520 else
9521 echo "No index() or strchr() found!" >&4
9522 val="$undef"
9523 vali="$undef"
9524 fi
9525fi
9526set d_strchr; eval $setvar
9527val="$vali"
9528set d_index; eval $setvar
9529
7e1af8bc 9530: check whether inet_aton exists
9531set inet_aton d_inetaton
9532eval $inlibc
9533
fe749a9f
JH
9534: see if inttypes.h is available
9535: we want a real compile instead of Inhdr because some systems
9536: have an inttypes.h which includes non-existent headers
9537echo " "
9538$cat >try.c <<EOCP
9539#include <inttypes.h>
9540int main() {
9541 static int32_t foo32 = 0x12345678;
9542}
9543EOCP
9544set try
9545if eval $compile; then
9546 echo "<inttypes.h> found." >&4
9547 val="$define"
9548else
9549 echo "<inttypes.h> NOT found." >&4
9550 val="$undef"
9551fi
9552$rm -f try.c try
9553set i_inttypes
9554eval $setvar
9555
9556: check for int64_t
9557echo " "
c5f05a91 9558echo "Checking to see if you have int64_t..." >&4
fe749a9f
JH
9559$cat >try.c <<EOCP
9560#include <sys/types.h>
9561#$i_inttypes I_INTTYPES
9562#ifdef I_INTTYPES
9563#include <inttypes.h>
9564#endif
9565int main() { int64_t x = 7; }
9566EOCP
9567set try
9568if eval $compile; then
9569 val="$define"
ce65dbcf 9570 echo "You have int64_t."
fe749a9f
JH
9571else
9572 val="$undef"
ce65dbcf 9573 echo "You do not have int64_t."
fe749a9f
JH
9574fi
9575$rm -f try try.*
13b3f787 9576set d_int64_t
fe749a9f
JH
9577eval $setvar
9578
a0d0e21e
LW
9579: Look for isascii
9580echo " "
9581$cat >isascii.c <<'EOCP'
9582#include <stdio.h>
9583#include <ctype.h>
d674cd6d 9584int main() {
a0d0e21e
LW
9585 int c = 'A';
9586 if (isascii(c))
9587 exit(0);
9588 else
9589 exit(1);
9590}
9591EOCP
dfe9444c
AD
9592set isascii
9593if eval $compile; then
a0d0e21e
LW
9594 echo "isascii() found." >&4
9595 val="$define"
9596else
9597 echo "isascii() NOT found." >&4
9598 val="$undef"
9599fi
9600set d_isascii
9601eval $setvar
9602$rm -f isascii*
9603
a3540c92
JH
9604: see if isnan exists
9605set isnan d_isnan
9606eval $inlibc
9607
9608: see if isnanl exists
9609set isnanl d_isnanl
9610eval $inlibc
9611
a0d0e21e
LW
9612: see if killpg exists
9613set killpg d_killpg
9614eval $inlibc
9615
dd64f1c3
AD
9616: see if lchown exists
9617echo " "
9618$cat > try.c <<'EOCP'
9619/* System header to define __stub macros and hopefully few prototypes,
9620 which can conflict with char lchown(); below. */
9621#include <assert.h>
9622/* Override any gcc2 internal prototype to avoid an error. */
9623/* We use char because int might match the return type of a gcc2
9624 builtin and then its argument prototype would still apply. */
9625char lchown();
9626int main() {
9627 /* The GNU C library defines this for functions which it implements
9628 to always fail with ENOSYS. Some functions are actually named
9629 something starting with __ and the normal name is an alias. */
9630#if defined (__stub_lchown) || defined (__stub___lchown)
9631choke me
9632#else
9633lchown();
9634#endif
9635; return 0; }
9636EOCP
9637set try
9638if eval $compile; then
9639 $echo "lchown() found." >&4
9640 val="$define"
9641else
9642 $echo "lchown() NOT found." >&4
9643 val="$undef"
9644fi
9645set d_lchown
9646eval $setvar
9647
2d4389e4
JH
9648: See if number of significant digits in a double precision number is known
9649echo " "
9650$cat >ldbl_dig.c <<EOM
9651#$i_limits I_LIMITS
9652#$i_float I_FLOAT
9653#ifdef I_LIMITS
9654#include <limits.h>
9655#endif
9656#ifdef I_FLOAT
9657#include <float.h>
9658#endif
9659#ifdef LDBL_DIG
9660printf("Contains LDBL_DIG");
9661#endif
9662EOM
9663$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9664if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9665 echo "LDBL_DIG found." >&4
9666 val="$define"
9667else
9668 echo "LDBL_DIG NOT found." >&4
9669 val="$undef"
9670fi
9671$rm -f ldbl_dig.?
9672set d_ldbl_dig
9673eval $setvar
9674
a0d0e21e
LW
9675: see if link exists
9676set link d_link
9677eval $inlibc
9678
a0d0e21e
LW
9679: see if localeconv exists
9680set localeconv d_locconv
9681eval $inlibc
9682
9683: see if lockf exists
9684set lockf d_lockf
9685eval $inlibc
9686
8175356b
JH
9687: check for long long
9688echo " "
c5f05a91 9689echo "Checking to see if you have long long..." >&4
213c275f 9690echo 'int main() { long long x = 7; return 0; }' > try.c
8175356b
JH
9691set try
9692if eval $compile; then
9693 val="$define"
ce65dbcf 9694 echo "You have have long long."
8175356b
JH
9695else
9696 val="$undef"
ce65dbcf 9697 echo "You do not have long long."
8175356b
JH
9698fi
9699$rm try.*
9700set d_longlong
9701eval $setvar
9702
9703: check for length of long long
9704case "${d_longlong}${longlongsize}" in
9705$define)
9706 echo " "
49c10eea 9707 echo "Checking to see how big your long longs are..." >&4
8175356b
JH
9708 $cat >try.c <<'EOCP'
9709#include <stdio.h>
9710int main()
9711{
213c275f
JH
9712 printf("%d\n", (int)sizeof(long long));
9713 return(0);
8175356b
JH
9714}
9715EOCP
9716 set try
9717 if eval $compile_ok; then
9718 longlongsize=`./try$exe_ext`
49c10eea 9719 echo "Your long longs are $longlongsize bytes long."
8175356b
JH
9720 else
9721 dflt='8'
9722 echo " "
9723 echo "(I can't seem to compile the test program. Guessing...)"
9724 rp="What is the size of a long long (in bytes)?"
9725 . ./myread
9726 longlongsize="$ans"
9727 fi
9728 if $test "X$longsize" = "X$longlongsize"; then
9729 echo "(That isn't any different from an ordinary long.)"
9730 fi
9731 ;;
9732esac
9733$rm -f try.* try
9734
49c10eea
JH
9735: see if prototype for lseek is available
9736echo " "
9737set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9738eval $hasproto
9739
a0d0e21e
LW
9740: see if lstat exists
9741set lstat d_lstat
9742eval $inlibc
9743
1e8c3fde
JH
9744: see if madvise exists
9745set madvise d_madvise
9746eval $inlibc
9747
a0d0e21e
LW
9748: see if mblen exists
9749set mblen d_mblen
9750eval $inlibc
9751
9752: see if mbstowcs exists
9753set mbstowcs d_mbstowcs
9754eval $inlibc
9755
9756: see if mbtowc exists
9757set mbtowc d_mbtowc
9758eval $inlibc
9759
0f27ced1
JH
9760: see if memchr exists
9761set memchr d_memchr
9762eval $inlibc
9763
a0d0e21e
LW
9764: see if memcmp exists
9765set memcmp d_memcmp
9766eval $inlibc
9767
9768: see if memcpy exists
9769set memcpy d_memcpy
9770eval $inlibc
9771
9772: see if memmove exists
9773set memmove d_memmove
2304df62
AD
9774eval $inlibc
9775
9776: see if memset exists
9777set memset d_memset
9778eval $inlibc
9779
9780: see if mkdir exists
9781set mkdir d_mkdir
9782eval $inlibc
9783
fe749a9f
JH
9784: see if mkdtemp exists
9785set mkdtemp d_mkdtemp
9786eval $inlibc
9787
a0d0e21e
LW
9788: see if mkfifo exists
9789set mkfifo d_mkfifo
9790eval $inlibc
9791
fe749a9f
JH
9792: see if mkstemp exists
9793set mkstemp d_mkstemp
9794eval $inlibc
9795
9796: see if mkstemps exists
9797set mkstemps d_mkstemps
9798eval $inlibc
9799
a0d0e21e
LW
9800: see if mktime exists
9801set mktime d_mktime
9802eval $inlibc
9803
87b71857
JH
9804: see if this is a sys/mman.h system
9805set sys/mman.h i_sysmman
9806eval $inhdr
9807
9808: see if mmap exists
9809set mmap d_mmap
9810eval $inlibc
9811: see what shmat returns
9812: default to something harmless
9813mmaptype='void *'
9814case "$i_sysmman$d_mmap" in
9815"$define$define")
9816 $cat >mmap.c <<'END'
9817#include <sys/mman.h>
9818void *mmap();
9819END
9820 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9821 mmaptype='void *'
9822 else
9823 mmaptype='caddr_t'
9824 fi
9825 echo "and it returns ($mmaptype)." >&4
9826 ;;
9827esac
9828
9829
9830
a3540c92
JH
9831: see if modfl exists
9832set modfl d_modfl
9833eval $inlibc
9834
fe749a9f
JH
9835: see if mprotect exists
9836set mprotect d_mprotect
9837eval $inlibc
9838
2304df62
AD
9839: see if msgctl exists
9840set msgctl d_msgctl
9841eval $inlibc
9842
9843: see if msgget exists
9844set msgget d_msgget
9845eval $inlibc
9846
9847: see if msgsnd exists
9848set msgsnd d_msgsnd
9849eval $inlibc
9850
9851: see if msgrcv exists
9852set msgrcv d_msgrcv
9853eval $inlibc
9854
9855: see how much of the 'msg*(2)' library is present.
9856h_msg=true
9857echo " "
9858case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9859*"$undef"*) h_msg=false;;
9860esac
6087ac44
JH
9861case "$osname" in
9862freebsd)
9863 case "`ipcs 2>&1`" in
9864 "SVID messages"*"not configured"*)
5ff3f7a4 9865 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9866 h_msg=false
9867 val="$undef"
9868 set msgctl d_msgctl
9869 eval $setvar
9870 set msgget d_msgget
9871 eval $setvar
9872 set msgsnd d_msgsnd
9873 eval $setvar
9874 set msgrcv d_msgrcv
9875 eval $setvar
9876 ;;
9877 esac
9878 ;;
9879esac
2304df62
AD
9880: we could also check for sys/ipc.h ...
9881if $h_msg && $test `./findhdr sys/msg.h`; then
9882 echo "You have the full msg*(2) library." >&4
9883 val="$define"
9884else
9885 echo "You don't have the full msg*(2) library." >&4
9886 val="$undef"
9887fi
9888set d_msg
9889eval $setvar
9890
fe749a9f
JH
9891: see if msync exists
9892set msync d_msync
dfe9444c
AD
9893eval $inlibc
9894
fe749a9f
JH
9895: see if munmap exists
9896set munmap d_munmap
9897eval $inlibc
ff935051 9898
fe749a9f
JH
9899: see if nice exists
9900set nice d_nice
9901eval $inlibc
ff935051 9902
de1c2614
JH
9903
9904echo " "
6b8eaf93 9905echo "Checking which 64-bit integer type we could use..." >&4
de1c2614
JH
9906
9907case "$intsize" in
99088) val=int
9909 set quadtype
9910 eval $setvar
9911 val='"unsigned int"'
9912 set uquadtype
9913 eval $setvar
6b8eaf93 9914 quadkind=1
de1c2614
JH
9915 ;;
9916*) case "$longsize" in
9917 8) val=long
9918 set quadtype
9919 eval $setvar
9920 val='"unsigned long"'
9921 set uquadtype
9922 eval $setvar
6b8eaf93 9923 quadkind=2
de1c2614 9924 ;;
43999f95
JH
9925 *) case "$d_longlong:$longlongsize" in
9926 define:8)
de1c2614
JH
9927 val='"long long"'
9928 set quadtype
9929 eval $setvar
9930 val='"unsigned long long"'
9931 set uquadtype
9932 eval $setvar
6b8eaf93 9933 quadkind=3
de1c2614 9934 ;;
13b3f787 9935 *) case "$d_int64_t" in
de1c2614
JH
9936 define)
9937 val=int64_t
9938 set quadtype
9939 eval $setvar
9940 val=uint64_t
9941 set uquadtype
9942 eval $setvar
6b8eaf93 9943 quadkind=4
de1c2614
JH
9944 ;;
9945 esac
9946 ;;
9947 esac
9948 ;;
9949 esac
9950 ;;
9951esac
9952
9953case "$quadtype" in
ad551343 9954'') echo "Alas, no 64-bit integer types in sight." >&4
de1c2614
JH
9955 d_quad="$undef"
9956 ;;
10cc9d2a 9957*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
1eeb0f31
JH
9958 verb="will"
9959 else
9960 verb="could"
9961 fi
9962 echo "We $verb use '$quadtype' for 64-bit integers." >&4
de1c2614
JH
9963 d_quad="$define"
9964 ;;
9965esac
9966
cce08f5b
JH
9967: check for length of character
9968echo " "
9969case "$charsize" in
9970'')
9971 echo "Checking to see how big your characters are (hey, you never know)..." >&4
9972 $cat >try.c <<'EOCP'
9973#include <stdio.h>
9974int main()
9975{
9976 printf("%d\n", (int)sizeof(char));
9977 exit(0);
9978}
9979EOCP
9980 set try
9981 if eval $compile_ok; then
9982 dflt=`./try`
9983 else
9984 dflt='1'
9985 echo "(I can't seem to compile the test program. Guessing...)"
9986 fi
9987 ;;
9988*)
9989 dflt="$charsize"
9990 ;;
9991esac
9992rp="What is the size of a character (in bytes)?"
9993. ./myread
9994charsize="$ans"
9995$rm -f try.c try
9996
9997
9998echo " "
9999$echo "Choosing the C types to be used for Perl's internal types..." >&4
10000
10cc9d2a 10001case "$use64bitint:$d_quad:$quadtype" in
cce08f5b
JH
10002define:define:?*)
10003 ivtype="$quadtype"
10004 uvtype="$uquadtype"
10005 ivsize=8
10006 uvsize=8
10007 ;;
10008*) ivtype="long"
10009 uvtype="unsigned long"
10010 ivsize=$longsize
10011 uvsize=$longsize
10012 ;;
10013esac
10014
10015case "$uselongdouble:$d_longdbl" in
10016define:define)
10017 nvtype="long double"
10018 nvsize=$longdblsize
10019 ;;
10020*) nvtype=double
10021 nvsize=$doublesize
10022 ;;
10023esac
10024
10025$echo "(IV will be "$ivtype", $ivsize bytes)"
10026$echo "(UV will be "$uvtype", $uvsize bytes)"
10027$echo "(NV will be "$nvtype", $nvsize bytes)"
10028
10029$cat >try.c <<EOCP
10030#$i_inttypes I_INTTYPES
10031#ifdef I_INTTYPES
10032#include <inttypes.h>
10033#endif
10034#include <stdio.h>
10035int main() {
10036#ifdef INT8
10037 int8_t i = INT8_MAX;
10038 uint8_t u = UINT8_MAX;
10039 printf("int8_t\n");
10040#endif
10041#ifdef INT16
10042 int16_t i = INT16_MAX;
10043 uint16_t i = UINT16_MAX;
10044 printf("int16_t\n");
10045#endif
10046#ifdef INT32
10047 int32_t i = INT32_MAX;
10048 uint32_t u = UINT32_MAX;
10049 printf("int32_t\n");
10050#endif
10051}
10052EOCP
10053
10054case "$i8type" in
10055'') case "$charsize" in
10056 1) i8type=char
10057 u8type="unsigned char"
10058 i8size=$charsize
10059 u8size=$charsize
10060 ;;
10061 esac
10062 ;;
10063esac
10064case "$i8type" in
10065'') set try -DINT8
10066 if eval $compile; then
10067 case "`./try$exe_ext`" in
10068 int8_t) i8type=int8_t
10069 u8type=uint8_t
10070 i8size=1
10071 u8size=1
10072 ;;
10073 esac
10074 fi
10075 ;;
10076esac
10077case "$i8type" in
10078'') if $test $charsize -ge 1; then
10079 i8type=char
10080 u8type="unsigned char"
10081 i8size=$charsize
10082 u8size=$charsize
10083 fi
10084 ;;
10085esac
10086
10087case "$i16type" in
10088'') case "$shortsize" in
10089 2) i16type=short
10090 u16type="unsigned short"
10091 i16size=$shortsize
10092 u16size=$shortsize
10093 ;;
10094 esac
10095 ;;
10096esac
10097case "$i16type" in
10098'') set try -DINT16
10099 if eval $compile; then
10100 case "`./try$exe_ext`" in
10101 int16_t)
10102 i16type=int16_t
10103 u16type=uint16_t
10104 i16size=2
10105 u16size=2
10106 ;;
10107 esac
10108 fi
10109 ;;
10110esac
10111case "$i16type" in
10112'') if $test $shortsize -ge 2; then
10113 i16type=short
10114 u16type="unsigned short"
10115 i16size=$shortsize
10116 u16size=$shortsize
10117 fi
10118 ;;
10119esac
10120
10121case "$i32type" in
10122'') case "$longsize" in
10123 4) i32type=long
10124 u32type="unsigned long"
10125 i32size=$longsize
10126 u32size=$longsize
10127 ;;
10128 *) case "$intsize" in
10129 4) i32type=int
10130 u32type="unsigned int"
10131 i32size=$intsize
10132 u32size=$intsize
10133 ;;
10134 esac
10135 ;;
10136 esac
10137 ;;
10138esac
10139case "$i32type" in
10140'') set try -DINT32
10141 if eval $compile; then
10142 case "`./try$exe_ext`" in
10143 int32_t)
10144 i32type=int32_t
10145 u32type=uint32_t
10146 i32size=4
10147 u32size=4
10148 ;;
10149 esac
10150 fi
10151 ;;
10152esac
10153case "$i32type" in
10154'') if $test $intsize -ge 4; then
10155 i32type=int
10156 u32type="unsigned int"
10157 i32size=$intsize
10158 u32size=$intsize
10159 fi
10160 ;;
10161esac
10162
10163case "$i64type" in
10164'') case "$d_quad:$quadtype" in
10165 define:?*)
10166 i64type="$quadtype"
10167 u64type="$uquadtype"
10168 i64size=8
10169 u64size=8
10170 ;;
10171 esac
10172 ;;
10173esac
10174
10175$echo "Checking whether your NVs can preserve your UVs..." >&4
10176$cat <<EOP >try.c
10177#include <stdio.h>
10178int main() {
10179 $uvtype k = ($uvtype)~0, l;
10180 $nvtype d;
10181 l = k;
10182 d = ($nvtype)l;
10183 l = ($uvtype)d;
10184 if (l == k)
10185 printf("preserve\n");
10186 exit(0);
10187}
10188EOP
10189set try
10190if eval $compile; then
10191 case "`./try$exe_ext`" in
78691af5 10192 preserve) d_nv_preserves_uv="$define" ;;
cce08f5b
JH
10193 esac
10194fi
78691af5 10195case "$d_nv_preserves_uv" in
cce08f5b
JH
10196$define) $echo "Yes, they can." 2>&1 ;;
10197*) $echo "No, they can't." 2>&1
78691af5 10198 d_nv_preserves_uv="$undef"
cce08f5b
JH
10199 ;;
10200esac
10201
10202$rm -f try.* try
10203
c5f05a91
JH
10204
10205: check for off64_t
10206echo " "
10207echo "Checking to see if you have off64_t..." >&4
10208$cat >try.c <<EOCP
10209#include <sys/types.h>
10210#include <unistd.h>
10211int main() { off64_t x = 7; }
10212EOCP
10213set try
10214if eval $compile; then
10215 val="$define"
10216 echo "You have off64_t."
10217else
10218 val="$undef"
10219 echo "You do not have off64_t."
10220 case "$lseeksize" in
10221 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10222 esac
10223fi
10224$rm -f try.* try
10225set d_off64_t
10226eval $setvar
10227
c4747d3e 10228: see if POSIX threads are available
1f5ae88c
JH
10229set pthread.h i_pthread
10230eval $inhdr
10231
c4747d3e
JH
10232
10233
10234
10235: how to create joinable pthreads
10236if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
10237 echo " "
10238 echo "Checking what constant to use for creating joinable pthreads..." >&4
10239 $cat >try.c <<'EOCP'
10240#include <pthread.h>
10241int main() {
10242 int detachstate = JOINABLE;
10243}
10244EOCP
10245 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10246 if eval $compile; then
c6912327 10247 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
10248 val="$undef" # Yes, undef.
10249 set d_old_pthread_create_joinable
13666627 10250 eval $setvar
ef4af2be
JH
10251 val=""
10252 set old_pthread_create_joinable
13666627
JH
10253 eval $setvar
10254 else
10255 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10256 if eval $compile; then
c6912327 10257 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 10258 val="$define"
ef4af2be 10259 set d_old_pthread_create_joinable
13666627
JH
10260 eval $setvar
10261 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 10262 set old_pthread_create_joinable
13666627
JH
10263 eval $setvar
10264 else
10265 set try -DJOINABLE=__UNDETACHED
10266 if eval $compile; then
c6912327 10267 echo "You seem to use __UNDETACHED." >&4
13666627 10268 val="$define"
ef4af2be 10269 set d_old_pthread_create_joinable
13666627
JH
10270 eval $setvar
10271 val=__UNDETACHED
ef4af2be 10272 set old_pthread_create_joinable
13666627
JH
10273 eval $setvar
10274 else
c6912327 10275 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 10276 val="$define"
ef4af2be 10277 set d_old_pthread_create_joinable
13666627
JH
10278 eval $setvar
10279 val=0
ef4af2be 10280 set old_pthread_create_joinable
13666627
JH
10281 eval $setvar
10282 fi
10283 fi
10284 fi
10285 $rm -f try try.*
10286else
ef4af2be
JH
10287 d_old_pthread_create_joinable="$undef"
10288 old_pthread_create_joinable=""
13666627
JH
10289fi
10290
ef4af2be
JH
10291: see if pause exists
10292set pause d_pause
10293eval $inlibc
10294
10295: see if pipe exists
10296set pipe d_pipe
10297eval $inlibc
10298
10299: see if poll exists
10300set poll d_poll
10301eval $inlibc
10302
31dfa2f6
JH
10303
10304: see whether the various POSIXish _yields exist
10305$cat >try.c <<EOP
10306#include <pthread.h>
10307#include <stdio.h>
5a411a32 10308int main() {
31dfa2f6
JH
10309#ifdef SCHED_YIELD
10310 sched_yield();
10311#else
10312#ifdef PTHREAD_YIELD
10313 pthread_yield();
10314#else
10315#ifdef PTHREAD_YIELD_NULL
10316 pthread_yield(NULL);
10317#endif
10318#endif
10319#endif
10320}
10321EOP
10322: see if sched_yield exists
10323set try -DSCHED_YIELD
10324if eval $compile; then
10325 val="$define"
10326 sched_yield='sched_yield()'
10327else
10328 val="$undef"
10329fi
10330case "$usethreads" in
10331$define)
10332 case "$val" in
10333 $define) echo 'sched_yield() found.' >&4 ;;
10334 *) echo 'sched_yield() NOT found.' >&4 ;;
10335 esac
10336esac
10337set d_sched_yield
10338eval $setvar
10339
10340: see if pthread_yield exists
10341set try -DPTHREAD_YIELD
10342if eval $compile; then
10343 val="$define"
10344 case "$sched_yield" in
10345 '') sched_yield='pthread_yield()' ;;
10346 esac
10347else
10348 set try -DPTHREAD_YIELD_NULL
10349 if eval $compile; then
10350 val="$define"
10351 case "$sched_yield" in
10352 '') sched_yield='pthread_yield(NULL)' ;;
10353 esac
10354 else
10355 val="$undef"
10356 fi
10357fi
10358case "$usethreads" in
10359$define)
10360 case "$val" in
10361 $define) echo 'pthread_yield() found.' >&4 ;;
10362 *) echo 'pthread_yield() NOT found.' >&4 ;;
10363 esac
10364 ;;
10365esac
10366set d_pthread_yield
10367eval $setvar
10368
10369case "$sched_yield" in
10370'') sched_yield=undef ;;
10371esac
10372
10373$rm -f try try.*
10374
4aa0a1f7
AD
10375: see if this is a pwd.h system
10376set pwd.h i_pwd
10377eval $inhdr
10378
10379case "$i_pwd" in
10380$define)
10381 xxx=`./findhdr pwd.h`
85e6fe83 10382 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 10383
2304df62 10384 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 10385 val="$define"
2304df62 10386 else
4aa0a1f7 10387 val="$undef"
2304df62 10388 fi
4aa0a1f7
AD
10389 set d_pwquota
10390 eval $setvar
10391
2304df62 10392 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 10393 val="$define"
2304df62 10394 else
4aa0a1f7 10395 val="$undef"
2304df62 10396 fi
4aa0a1f7
AD
10397 set d_pwage
10398 eval $setvar
10399
2304df62 10400 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 10401 val="$define"
2304df62 10402 else
4aa0a1f7 10403 val="$undef"
2304df62 10404 fi
4aa0a1f7
AD
10405 set d_pwchange
10406 eval $setvar
10407
2304df62 10408 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 10409 val="$define"
2304df62 10410 else
4aa0a1f7 10411 val="$undef"
2304df62 10412 fi
4aa0a1f7
AD
10413 set d_pwclass
10414 eval $setvar
10415
2304df62 10416 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 10417 val="$define"
2304df62 10418 else
4aa0a1f7 10419 val="$undef"
2304df62 10420 fi
4aa0a1f7 10421 set d_pwexpire
cce08f5b 10422 eval $setvar
de1c2614 10423
cce08f5b
JH
10424 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10425 val="$define"
1eeb0f31 10426 else
cce08f5b 10427 val="$undef"
1eeb0f31 10428 fi
cce08f5b
JH
10429 set d_pwcomment
10430 eval $setvar
10431
10432 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10433 val="$define"
10434 else
10435 val="$undef"
10436 fi
10437 set d_pwgecos
10438 eval $setvar
10439
10440 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10441 val="$define"
10442 else
10443 val="$undef"
10444 fi
10445 set d_pwpasswd
10446 eval $setvar
10447
10448 $rm -f $$.h
10449 ;;
10450*)
10451 val="$undef";
10452 set d_pwquota; eval $setvar
10453 set d_pwage; eval $setvar
10454 set d_pwchange; eval $setvar
10455 set d_pwclass; eval $setvar
10456 set d_pwexpire; eval $setvar
10457 set d_pwcomment; eval $setvar
10458 set d_pwgecos; eval $setvar
10459 set d_pwpasswd; eval $setvar
de1c2614
JH
10460 ;;
10461esac
10462
85e6fe83 10463: see if readdir and friends exist
2304df62
AD
10464set readdir d_readdir
10465eval $inlibc
85e6fe83
LW
10466set seekdir d_seekdir
10467eval $inlibc
10468set telldir d_telldir
10469eval $inlibc
10470set rewinddir d_rewinddir
10471eval $inlibc
2304df62 10472
a0d0e21e
LW
10473: see if readlink exists
10474set readlink d_readlink
10475eval $inlibc
10476
2304df62
AD
10477: see if rename exists
10478set rename d_rename
10479eval $inlibc
10480
10481: see if rmdir exists
10482set rmdir d_rmdir
10483eval $inlibc
10484
8ff267be 10485: see if memory.h is available.
10486val=''
10487set memory.h val
10488eval $inhdr
10489
10490: See if it conflicts with string.h
10491case "$val" in
10492$define)
10493 case "$strings" in
10494 '') ;;
10495 *)
10496 $cppstdin $cppflags $cppminus < $strings > mem.h
10497 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10498 echo " "
10499 echo "We won't be including <memory.h>."
10500 val="$undef"
10501 fi
10502 $rm -f mem.h
10503 ;;
10504 esac
10505esac
10506set i_memory
10507eval $setvar
10508
2304df62
AD
10509: can bcopy handle overlapping blocks?
10510val="$undef"
10511case "$d_bcopy" in
10512"$define")
10513 echo " "
10514 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 10515 $cat >try.c <<EOCP
8ff267be 10516#$i_memory I_MEMORY
10517#$i_stdlib I_STDLIB
10518#$i_string I_STRING
10519#$i_unistd I_UNISTD
10520EOCP
dfe9444c 10521 $cat >>try.c <<'EOCP'
8ff267be 10522#include <stdio.h>
8ff267be 10523#ifdef I_MEMORY
10524# include <memory.h>
10525#endif
10526#ifdef I_STDLIB
10527# include <stdlib.h>
10528#endif
10529#ifdef I_STRING
10530# include <string.h>
10531#else
10532# include <strings.h>
10533#endif
10534#ifdef I_UNISTD
10535# include <unistd.h> /* Needed for NetBSD */
10536#endif
d674cd6d 10537int main()
2304df62 10538{
85e6fe83
LW
10539char buf[128], abc[128];
10540char *b;
10541int len;
10542int off;
10543int align;
a0d0e21e 10544
85e6fe83 10545bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
10546
10547for (align = 7; align >= 0; align--) {
10548 for (len = 36; len; len--) {
10549 b = buf+align;
85e6fe83 10550 bcopy(abc, b, len);
2304df62
AD
10551 for (off = 1; off <= len; off++) {
10552 bcopy(b, b+off, len);
10553 bcopy(b+off, b, len);
85e6fe83 10554 if (bcmp(b, abc, len))
2304df62
AD
10555 exit(1);
10556 }
10557 }
10558}
10559exit(0);
10560}
10561EOCP
dfe9444c 10562 set try
dc45a647 10563 if eval $compile_ok; then
dfe9444c 10564 if ./try 2>/dev/null; then
2304df62
AD
10565 echo "Yes, it can."
10566 val="$define"
10567 else
10568 echo "It can't, sorry."
8ff267be 10569 case "$d_memmove" in
10570 "$define") echo "But that's Ok since you have memmove()." ;;
10571 esac
2304df62
AD
10572 fi
10573 else
10574 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10575 case "$d_memmove" in
10576 "$define") echo "But that's Ok since you have memmove()." ;;
10577 esac
2304df62
AD
10578 fi
10579 ;;
10580esac
dfe9444c 10581$rm -f try.* try core
2304df62
AD
10582set d_safebcpy
10583eval $setvar
10584
10585: can memcpy handle overlapping blocks?
10586val="$undef"
10587case "$d_memcpy" in
10588"$define")
10589 echo " "
10590 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 10591 $cat >try.c <<EOCP
8ff267be 10592#$i_memory I_MEMORY
10593#$i_stdlib I_STDLIB
10594#$i_string I_STRING
10595#$i_unistd I_UNISTD
10596EOCP
dfe9444c 10597 $cat >>try.c <<'EOCP'
8ff267be 10598#include <stdio.h>
8ff267be 10599#ifdef I_MEMORY
10600# include <memory.h>
10601#endif
10602#ifdef I_STDLIB
10603# include <stdlib.h>
10604#endif
10605#ifdef I_STRING
10606# include <string.h>
10607#else
10608# include <strings.h>
10609#endif
10610#ifdef I_UNISTD
10611# include <unistd.h> /* Needed for NetBSD */
10612#endif
d674cd6d 10613int main()
2304df62 10614{
85e6fe83
LW
10615char buf[128], abc[128];
10616char *b;
10617int len;
10618int off;
10619int align;
10620
8ff267be 10621/* Copy "abcde..." string to char abc[] so that gcc doesn't
10622 try to store the string in read-only memory. */
85e6fe83 10623memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
10624
10625for (align = 7; align >= 0; align--) {
10626 for (len = 36; len; len--) {
10627 b = buf+align;
232e078e 10628 memcpy(b, abc, len);
2304df62 10629 for (off = 1; off <= len; off++) {
2304df62 10630 memcpy(b+off, b, len);
232e078e 10631 memcpy(b, b+off, len);
85e6fe83 10632 if (memcmp(b, abc, len))
2304df62
AD
10633 exit(1);
10634 }
10635 }
10636}
10637exit(0);
10638}
10639EOCP
dfe9444c 10640 set try
dc45a647 10641 if eval $compile_ok; then
dfe9444c 10642 if ./try 2>/dev/null; then
2304df62
AD
10643 echo "Yes, it can."
10644 val="$define"
10645 else
10646 echo "It can't, sorry."
8ff267be 10647 case "$d_memmove" in
10648 "$define") echo "But that's Ok since you have memmove()." ;;
10649 esac
2304df62
AD
10650 fi
10651 else
10652 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10653 case "$d_memmove" in
10654 "$define") echo "But that's Ok since you have memmove()." ;;
10655 esac
2304df62
AD
10656 fi
10657 ;;
10658esac
dfe9444c 10659$rm -f try.* try core
2304df62
AD
10660set d_safemcpy
10661eval $setvar
10662
36477c24 10663: can memcmp be trusted to compare relative magnitude?
10664val="$undef"
10665case "$d_memcmp" in
10666"$define")
10667 echo " "
dfe9444c
AD
10668 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10669 $cat >try.c <<EOCP
36477c24 10670#$i_memory I_MEMORY
10671#$i_stdlib I_STDLIB
10672#$i_string I_STRING
10673#$i_unistd I_UNISTD
10674EOCP
dfe9444c 10675 $cat >>try.c <<'EOCP'
36477c24 10676#include <stdio.h>
36477c24 10677#ifdef I_MEMORY
10678# include <memory.h>
10679#endif
10680#ifdef I_STDLIB
10681# include <stdlib.h>
10682#endif
10683#ifdef I_STRING
10684# include <string.h>
10685#else
10686# include <strings.h>
10687#endif
10688#ifdef I_UNISTD
10689# include <unistd.h> /* Needed for NetBSD */
10690#endif
d674cd6d 10691int main()
36477c24 10692{
10693char a = -1;
10694char b = 0;
10695if ((a < b) && memcmp(&a, &b, 1) < 0)
10696 exit(1);
10697exit(0);
10698}
10699EOCP
dfe9444c 10700 set try
dc45a647 10701 if eval $compile_ok; then
dfe9444c 10702 if ./try 2>/dev/null; then
36477c24 10703 echo "Yes, it can."
10704 val="$define"
10705 else
10706 echo "No, it can't (it uses signed chars)."
10707 fi
10708 else
10709 echo "(I can't compile the test program, so we'll assume not...)"
10710 fi
10711 ;;
10712esac
dfe9444c 10713$rm -f try.* try core
36477c24 10714set d_sanemcmp
10715eval $setvar
10716
2304df62
AD
10717: see if select exists
10718set select d_select
10719eval $inlibc
10720
10721: see if semctl exists
10722set semctl d_semctl
10723eval $inlibc
10724
10725: see if semget exists
10726set semget d_semget
10727eval $inlibc
10728
10729: see if semop exists
10730set semop d_semop
10731eval $inlibc
10732
10733: see how much of the 'sem*(2)' library is present.
10734h_sem=true
10735echo " "
10736case "$d_semctl$d_semget$d_semop" in
10737*"$undef"*) h_sem=false;;
10738esac
6087ac44
JH
10739case "$osname" in
10740freebsd)
10741 case "`ipcs 2>&1`" in
10742 "SVID messages"*"not configured"*)
5ff3f7a4 10743 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
10744 h_sem=false
10745 val="$undef"
10746 set semctl d_semctl
10747 eval $setvar
10748 set semget d_semget
10749 eval $setvar
10750 set semop d_semop
10751 eval $setvar
10752 ;;
10753 esac
10754 ;;
10755esac
2304df62
AD
10756: we could also check for sys/ipc.h ...
10757if $h_sem && $test `./findhdr sys/sem.h`; then
10758 echo "You have the full sem*(2) library." >&4
10759 val="$define"
10760else
10761 echo "You don't have the full sem*(2) library." >&4
10762 val="$undef"
10763fi
10764set d_sem
10765eval $setvar
10766
bd89102f
AD
10767: see whether sys/sem.h defines union semun
10768echo " "
10769$cat > try.c <<'END'
10770#include <sys/types.h>
10771#include <sys/ipc.h>
10772#include <sys/sem.h>
10773int main () { union semun semun; semun.buf = 0; }
10774END
10775set try
10776if eval $compile; then
10777 echo "You have union semun in <sys/sem.h>." >&4
10778 val="$define"
10779else
10780 echo "You do not have union semun in <sys/sem.h>." >&4
10781 val="$undef"
10782fi
85ab1d1d 10783$rm -f try try.c try.h
bd89102f
AD
10784set d_union_semun
10785eval $setvar
10786
10787: see how to do semctl IPC_STAT
10788case "$d_sem" in
10789$define)
10790 : see whether semctl IPC_STAT can use union semun
10791 echo " "
85ab1d1d
JH
10792 $cat > try.h <<END
10793#ifndef S_IRUSR
10794# ifdef S_IREAD
10795# define S_IRUSR S_IREAD
10796# define S_IWUSR S_IWRITE
10797# define S_IXUSR S_IEXEC
10798# else
10799# define S_IRUSR 0400
10800# define S_IWUSR 0200
10801# define S_IXUSR 0100
10802# endif
10803# define S_IRGRP (S_IRUSR>>3)
10804# define S_IWGRP (S_IWUSR>>3)
10805# define S_IXGRP (S_IXUSR>>3)
10806# define S_IROTH (S_IRUSR>>6)
10807# define S_IWOTH (S_IWUSR>>6)
10808# define S_IXOTH (S_IXUSR>>6)
10809#endif
10810#ifndef S_IRWXU
10811# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10812# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10813# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10814#endif
10815END
10816
bd89102f
AD
10817 $cat > try.c <<END
10818#include <sys/types.h>
10819#include <sys/ipc.h>
10820#include <sys/sem.h>
10821#include <sys/stat.h>
10822#include <stdio.h>
10823#include <errno.h>
85ab1d1d 10824#include "try.h"
bd89102f
AD
10825#ifndef errno
10826extern int errno;
10827#endif
10828#$d_union_semun HAS_UNION_SEMUN
10829int main() {
10830 union semun
10831#ifndef HAS_UNION_SEMUN
10832 {
10833 int val;
10834 struct semid_ds *buf;
10835 unsigned short *array;
10836 }
10837#endif
10838 arg;
10839 int sem, st;
10840
10841#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10842 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10843 if (sem > -1) {
10844 struct semid_ds argbuf;
10845 arg.buf = &argbuf;
10846# ifdef IPC_STAT
10847 st = semctl(sem, 0, IPC_STAT, arg);
10848 if (st == 0)
10849 printf("semun\n");
10850 else
10851# endif /* IPC_STAT */
10852 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10853# ifdef IPC_RMID
10854 if (semctl(sem, 0, IPC_RMID, arg) != 0)
10855# endif /* IPC_RMID */
10856 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10857 } else
10858#endif /* IPC_PRIVATE && ... */
10859 printf("semget failed: errno = %d\n", errno);
10860 return 0;
10861}
10862END
10863 val="$undef"
10864 set try
10865 if eval $compile; then
10866 xxx=`./try`
10867 case "$xxx" in
10868 semun) val="$define" ;;
10869 esac
10870 fi
10871 $rm -f try try.c
10872 set d_semctl_semun
10873 eval $setvar
10874 case "$d_semctl_semun" in
10875 $define)
10876 echo "You can use union semun for semctl IPC_STAT." >&4
10877 also='also'
10878 ;;
10879 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
10880 also=''
10881 ;;
10882 esac
10883
10884 : see whether semctl IPC_STAT can use struct semid_ds pointer
10885 $cat > try.c <<'END'
10886#include <sys/types.h>
10887#include <sys/ipc.h>
10888#include <sys/sem.h>
10889#include <sys/stat.h>
85ab1d1d 10890#include "try.h"
bd89102f
AD
10891#include <stdio.h>
10892#include <errno.h>
10893#ifndef errno
10894extern int errno;
10895#endif
10896int main() {
10897 struct semid_ds arg;
10898 int sem, st;
10899
10900#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10901 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10902 if (sem > -1) {
10903# ifdef IPC_STAT
10904 st = semctl(sem, 0, IPC_STAT, &arg);
10905 if (st == 0)
10906 printf("semid_ds\n");
10907 else
10908# endif /* IPC_STAT */
10909 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10910# ifdef IPC_RMID
10911 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10912# endif /* IPC_RMID */
10913 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10914 } else
10915#endif /* IPC_PRIVATE && ... */
10916 printf("semget failed: errno = %d\n", errno);
10917
10918 return 0;
10919}
10920END
10921 val="$undef"
10922 set try
10923 if eval $compile; then
10924 xxx=`./try`
10925 case "$xxx" in
10926 semid_ds) val="$define" ;;
10927 esac
10928 fi
10929 $rm -f try try.c
10930 set d_semctl_semid_ds
10931 eval $setvar
10932 case "$d_semctl_semid_ds" in
10933 $define)
7f3d1cf1 10934 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 10935 ;;
7f3d1cf1 10936 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
10937 ;;
10938 esac
85ab1d1d 10939 $rm -f try.h
bd89102f
AD
10940 ;;
10941*) val="$undef"
10942
10943 # We do not have the full sem*(2) library, so assume we can not
10944 # use either.
10945
10946 set d_semctl_semun
10947 eval $setvar
10948
10949 set d_semctl_semid_ds
10950 eval $setvar
10951 ;;
10952esac
10953
2304df62
AD
10954: see if setegid exists
10955set setegid d_setegid
10956eval $inlibc
10957
10958: see if seteuid exists
10959set seteuid d_seteuid
10960eval $inlibc
10961
5ff3f7a4
GS
10962: see if setgrent exists
10963set setgrent d_setgrent
10964eval $inlibc
10965
693762b4
AD
10966: see if sethostent exists
10967set sethostent d_sethent
10968eval $inlibc
10969
a0d0e21e
LW
10970: see if setlinebuf exists
10971set setlinebuf d_setlinebuf
10972eval $inlibc
10973
2304df62
AD
10974: see if setlocale exists
10975set setlocale d_setlocale
10976eval $inlibc
a0d0e21e 10977
e5c9fcd0
AD
10978: see if setnetent exists
10979set setnetent d_setnent
10980eval $inlibc
10981
10982: see if setprotoent exists
10983set setprotoent d_setpent
10984eval $inlibc
10985
2304df62
AD
10986: see if setpgid exists
10987set setpgid d_setpgid
10988eval $inlibc
10989
2304df62
AD
10990: see if setpgrp2 exists
10991set setpgrp2 d_setpgrp2
10992eval $inlibc
10993
10994: see if setpriority exists
10995set setpriority d_setprior
10996eval $inlibc
10997
5ff3f7a4
GS
10998: see if setpwent exists
10999set setpwent d_setpwent
11000eval $inlibc
11001
2304df62
AD
11002: see if setregid exists
11003set setregid d_setregid
11004eval $inlibc
11005set setresgid d_setresgid
11006eval $inlibc
11007
11008: see if setreuid exists
11009set setreuid d_setreuid
11010eval $inlibc
11011set setresuid d_setresuid
11012eval $inlibc
11013
11014: see if setrgid exists
11015set setrgid d_setrgid
11016eval $inlibc
11017
11018: see if setruid exists
11019set setruid d_setruid
11020eval $inlibc
11021
e5c9fcd0
AD
11022: see if setservent exists
11023set setservent d_setsent
11024eval $inlibc
11025
2304df62
AD
11026: see if setsid exists
11027set setsid d_setsid
11028eval $inlibc
11029
f1066039
JH
11030: see if setspent exists
11031set setspent d_setspent
11032eval $inlibc
11033
e5c9fcd0
AD
11034: see if setvbuf exists
11035set setvbuf d_setvbuf
11036eval $inlibc
11037
760ac839
LW
11038: see if sfio.h is available
11039set sfio.h i_sfio
11040eval $inhdr
11041
11042
8ff267be 11043: see if sfio library is available
760ac839
LW
11044case "$i_sfio" in
11045$define)
11046 val=''
11047 set sfreserve val
11048 eval $inlibc
11049 ;;
11050*)
11051 val="$undef"
11052 ;;
11053esac
8ff267be 11054: Ok, but do we want to use it.
760ac839
LW
11055case "$val" in
11056$define)
11057 case "$usesfio" in
8ff267be 11058 true|$define|[yY]*) dflt='y';;
760ac839
LW
11059 *) dflt='n';;
11060 esac
8ff267be 11061 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
11062 rp="You seem to have sfio available, do you want to try using it?"
11063 . ./myread
11064 case "$ans" in
8ff267be 11065 y|Y) ;;
11066 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 11067 val="$undef"
ff0cee69 11068 : Remove sfio from list of libraries to use
11069 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11070 shift
11071 libs="$*"
11072 echo "libs = $libs" >&4
760ac839
LW
11073 ;;
11074 esac
11075 ;;
8ff267be 11076*) case "$usesfio" in
11077 true|$define|[yY]*)
11078 echo "Sorry, cannot find sfio on this machine" >&4
11079 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
11080 ;;
11081 esac
11082 ;;
11083esac
8ff267be 11084set d_sfio
11085eval $setvar
760ac839
LW
11086case "$d_sfio" in
11087$define) usesfio='true';;
11088*) usesfio='false';;
11089esac
11090
2304df62
AD
11091: see if shmctl exists
11092set shmctl d_shmctl
11093eval $inlibc
11094
11095: see if shmget exists
11096set shmget d_shmget
11097eval $inlibc
11098
a0d0e21e
LW
11099: see if shmat exists
11100set shmat d_shmat
11101eval $inlibc
11102: see what shmat returns
11103case "$d_shmat" in
11104"$define")
11105 $cat >shmat.c <<'END'
11106#include <sys/shm.h>
11107void *shmat();
11108END
11109 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11110 shmattype='void *'
11111 else
11112 shmattype='char *'
11113 fi
11114 echo "and it returns ($shmattype)." >&4
11115 : see if a prototype for shmat is available
e50aee73
AD
11116 xxx=`./findhdr sys/shm.h`
11117 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
11118 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11119 val="$define"
11120 else
11121 val="$undef"
11122 fi
11123 $rm -f shmat.[co]
11124 ;;
11125*)
11126 val="$undef"
11127 ;;
11128esac
11129set d_shmatprototype
11130eval $setvar
11131
11132: see if shmdt exists
11133set shmdt d_shmdt
11134eval $inlibc
11135
11136: see how much of the 'shm*(2)' library is present.
11137h_shm=true
11138echo " "
11139case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11140*"$undef"*) h_shm=false;;
11141esac
6087ac44
JH
11142case "$osname" in
11143freebsd)
11144 case "`ipcs 2>&1`" in
11145 "SVID shared memory"*"not configured"*)
5ff3f7a4 11146 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
11147 h_shm=false
11148 val="$undef"
11149 set shmctl d_shmctl
11150 evat $setvar
11151 set shmget d_shmget
11152 evat $setvar
11153 set shmat d_shmat
11154 evat $setvar
11155 set shmdt d_shmdt
11156 evat $setvar
11157 ;;
11158 esac
11159 ;;
11160esac
a0d0e21e
LW
11161: we could also check for sys/ipc.h ...
11162if $h_shm && $test `./findhdr sys/shm.h`; then
11163 echo "You have the full shm*(2) library." >&4
11164 val="$define"
11165else
11166 echo "You don't have the full shm*(2) library." >&4
11167 val="$undef"
11168fi
11169set d_shm
11170eval $setvar
11171
2c7991dc 11172echo " "
8ff267be 11173: see if we have sigaction
11174if set sigaction val -f d_sigaction; eval $csym; $val; then
11175 echo 'sigaction() found.' >&4
dc45a647 11176 $cat > try.c <<'EOP'
8ff267be 11177#include <stdio.h>
11178#include <sys/types.h>
11179#include <signal.h>
d674cd6d 11180int main()
8ff267be 11181{
11182 struct sigaction act, oact;
190b66db 11183 act.sa_flags = 0;
48159a0c 11184 oact.sa_handler = 0;
14e4fe40
JH
11185 /* so that act and oact are used */
11186 exit(act.sa_flags == 0 && oact.sa_handler == 0);
8ff267be 11187}
11188EOP
dc45a647
MB
11189 set try
11190 if eval $compile_ok; then
11191 val="$define"
11192 else
11193 echo "But you don't seem to have a useable struct sigaction." >&4
11194 val="$undef"
11195 fi
8ff267be 11196else
dc45a647 11197 echo 'sigaction NOT found.' >&4
8ff267be 11198 val="$undef"
11199fi
11200set d_sigaction; eval $setvar
dfe9444c 11201$rm -f try try$_o try.c
2c7991dc 11202
a5f75d66
AD
11203: see if sigsetjmp exists
11204echo " "
921b2963
JH
11205case "$d_sigsetjmp" in
11206'')
11207 $cat >try.c <<'EOP'
11208#include <setjmp.h>
11209sigjmp_buf env;
11210int set = 1;
d674cd6d 11211int main()
921b2963
JH
11212{
11213 if (sigsetjmp(env,1))
11214 exit(set);
11215 set = 0;
11216 siglongjmp(env, 1);
11217 exit(1);
11218}
11219EOP
11220 set try
11221 if eval $compile; then
11222 if ./try >/dev/null 2>&1; then
11223 echo "POSIX sigsetjmp found." >&4
11224 val="$define"
11225 else
11226 $cat >&4 <<EOM
11227Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11228I'll ignore them.
11229EOM
11230 val="$undef"
a0d0e21e 11231 fi
921b2963
JH
11232 else
11233 echo "sigsetjmp not found." >&4
11234 val="$undef"
a0d0e21e 11235 fi
921b2963
JH
11236 ;;
11237*) val="$d_sigsetjmp"
11238 case "$d_sigsetjmp" in
11239 $define) echo "POSIX sigsetjmp found." >&4;;
11240 $undef) echo "sigsetjmp not found." >&4;;
11241 esac
11242 ;;
11243esac
11244set d_sigsetjmp
11245eval $setvar
11246$rm -f try.c try
2304df62 11247
d9b3e12d
JH
11248: see if sys/stat.h is available
11249set sys/stat.h i_sysstat
11250eval $inhdr
11251
b7b35fc2 11252
2304df62
AD
11253: see if stat knows about block sizes
11254echo " "
b7b35fc2 11255echo "Checking to see if your struct stat has st_blocks field..." >&4
5ff3f7a4
GS
11256set d_statblks stat st_blocks $i_sysstat sys/stat.h
11257eval $hasfield
2304df62 11258
b7b35fc2 11259
ad27e871
JH
11260: see if this is a sys/vfs.h system
11261set sys/vfs.h i_sysvfs
11262eval $inhdr
11263
b7b35fc2 11264
ad27e871
JH
11265: see if this is a sys/statfs.h system
11266set sys/statfs.h i_sysstatfs
11267eval $inhdr
11268
11269
11270echo " "
8175356b 11271echo "Checking to see if your system supports struct statfs..." >&4
ad27e871
JH
11272set 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
11273eval $hasstruct
11274case "$d_statfs_s" in
a22e52b9
JH
11275"$define") echo "Yes, it does." ;;
11276*) echo "No, it doesn't." ;;
ad27e871
JH
11277esac
11278
11279
11280
11281: see if struct statfs knows about f_flags
11282case "$d_statfs_s" in
11283define)
11284 echo " "
8175356b 11285 echo "Checking to see if your struct statfs has f_flags field..." >&4
ad27e871
JH
11286 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
11287 eval $hasfield
11288 ;;
11289*) val="$undef"
11290 set d_statfs_f_flags
11291 eval $setvar
11292 ;;
11293esac
11294case "$d_statfs_f_flags" in
a22e52b9
JH
11295"$define") echo "Yes, it does." ;;
11296*) echo "No, it doesn't." ;;
ad27e871
JH
11297esac
11298
16d20bd9
AD
11299: see if _ptr and _cnt from stdio act std
11300echo " "
dca663ed 11301if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
11302 echo "(Looks like you have stdio.h from Linux.)"
11303 case "$stdio_ptr" in
c2960299
AD
11304 '') stdio_ptr='((fp)->_IO_read_ptr)'
11305 ptr_lval=$define
11306 ;;
8e07c86e 11307 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
11308 esac
11309 case "$stdio_cnt" in
c2960299
AD
11310 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11311 cnt_lval=$undef
11312 ;;
8e07c86e 11313 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
11314 esac
11315 case "$stdio_base" in
11316 '') stdio_base='((fp)->_IO_read_base)';;
11317 esac
11318 case "$stdio_bufsiz" in
c2960299 11319 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
11320 esac
11321else
11322 case "$stdio_ptr" in
c2960299
AD
11323 '') stdio_ptr='((fp)->_ptr)'
11324 ptr_lval=$define
11325 ;;
8e07c86e 11326 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
11327 esac
11328 case "$stdio_cnt" in
c2960299
AD
11329 '') stdio_cnt='((fp)->_cnt)'
11330 cnt_lval=$define
11331 ;;
8e07c86e 11332 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
11333 esac
11334 case "$stdio_base" in
11335 '') stdio_base='((fp)->_base)';;
11336 esac
11337 case "$stdio_bufsiz" in
11338 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11339 esac
11340fi
11341: test whether _ptr and _cnt really work
11342echo "Checking how std your stdio is..." >&4
11343$cat >try.c <<EOP
11344#include <stdio.h>
11345#define FILE_ptr(fp) $stdio_ptr
11346#define FILE_cnt(fp) $stdio_cnt
d674cd6d 11347int main() {
16d20bd9
AD
11348 FILE *fp = fopen("try.c", "r");
11349 char c = getc(fp);
11350 if (
11351 18 <= FILE_cnt(fp) &&
11352 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11353 )
11354 exit(0);
11355 exit(1);
11356}
11357EOP
11358val="$undef"
dfe9444c
AD
11359set try
11360if eval $compile; then
16d20bd9
AD
11361 if ./try; then
11362 echo "Your stdio acts pretty std."
11363 val="$define"
11364 else
11365 echo "Your stdio isn't very std."
11366 fi
11367else
11368 echo "Your stdio doesn't appear very std."
11369fi
11370$rm -f try.c try
11371set d_stdstdio
11372eval $setvar
11373
8e07c86e 11374: Can _ptr be used as an lvalue?
e50aee73
AD
11375case "$d_stdstdio$ptr_lval" in
11376$define$define) val=$define ;;
c2960299
AD
11377*) val=$undef ;;
11378esac
11379set d_stdio_ptr_lval
11380eval $setvar
11381
8e07c86e 11382: Can _cnt be used as an lvalue?
e50aee73
AD
11383case "$d_stdstdio$cnt_lval" in
11384$define$define) val=$define ;;
c2960299
AD
11385*) val=$undef ;;
11386esac
11387set d_stdio_cnt_lval
11388eval $setvar
11389
16d20bd9
AD
11390: see if _base is also standard
11391val="$undef"
11392case "$d_stdstdio" in
11393$define)
11394 $cat >try.c <<EOP
11395#include <stdio.h>
11396#define FILE_base(fp) $stdio_base
11397#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 11398int main() {
16d20bd9
AD
11399 FILE *fp = fopen("try.c", "r");
11400 char c = getc(fp);
11401 if (
11402 19 <= FILE_bufsiz(fp) &&
11403 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11404 )
11405 exit(0);
11406 exit(1);
11407}
11408EOP
dfe9444c
AD
11409 set try
11410 if eval $compile; then
16d20bd9 11411 if ./try; then
8ff267be 11412 echo "And its _base field acts std."
16d20bd9
AD
11413 val="$define"
11414 else
11415 echo "But its _base field isn't std."
11416 fi
11417 else
11418 echo "However, it seems to be lacking the _base field."
11419 fi
11420 $rm -f try.c try
11421 ;;
11422esac
11423set d_stdiobase
11424eval $setvar
11425
ed39a0f2
JH
11426$cat >&4 <<EOM
11427Checking how to access stdio streams by file descriptor number...
11428EOM
11429case "$stdio_stream_array" in
11430'') $cat >try.c <<EOCP
11431#include <stdio.h>
11432int main() {
11433 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11434 printf("yes\n");
11435}
11436EOCP
11437 for s in _iob __iob __sF
11438 do
11439 set try -DSTDIO_STREAM_ARRAY=$s
11440 if eval $compile; then
11441 case "`./try$exe_ext`" in
11442 yes) stdio_stream_array=$s; break ;;
11443 esac
11444 fi
11445 done
11446 $rm -f try.* try$exe_ext
11447esac
11448case "$stdio_stream_array" in
11449'') $cat >&4 <<EOM
11450I can't figure out how to access stdio streams by file descriptor number.
11451EOM
11452 d_stdio_stream_array="$undef"
11453 ;;
11454*) $cat >&4 <<EOM
11455You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11456EOM
11457 d_stdio_stream_array="$define"
11458 ;;
11459esac
11460
a0d0e21e
LW
11461: see if strcoll exists
11462set strcoll d_strcoll
11463eval $inlibc
2304df62
AD
11464
11465: check for structure copying
11466echo " "
11467echo "Checking to see if your C compiler can copy structs..." >&4
11468$cat >try.c <<'EOCP'
5a411a32 11469int main()
2304df62
AD
11470{
11471 struct blurfl {
11472 int dyick;
11473 } foo, bar;
11474
11475 foo = bar;
11476}
11477EOCP
11478if $cc -c try.c >/dev/null 2>&1 ; then
11479 val="$define"
11480 echo "Yup, it can."
11481else
11482 val="$undef"
11483 echo "Nope, it can't."
11484fi
11485set d_strctcpy
11486eval $setvar
11487$rm -f try.*
11488
11489: see if strerror and/or sys_errlist[] exist
11490echo " "
28e8609d
JH
11491if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11492 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
11493 echo 'strerror() found.' >&4
11494 d_strerror="$define"
11495 d_strerrm='strerror(e)'
11496 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11497 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11498 d_syserrlst="$define"
11499 else
11500 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11501 d_syserrlst="$undef"
11502 fi
28e8609d 11503 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
11504 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11505 echo 'strerror() found in string header.' >&4
11506 d_strerror="$define"
11507 d_strerrm='strerror(e)'
11508 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11509 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11510 d_syserrlst="$define"
11511 else
11512 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11513 d_syserrlst="$undef"
11514 fi
28e8609d 11515 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
11516 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11517 d_strerror="$undef"
11518 d_syserrlst="$define"
11519 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 11520 else
5ff3f7a4
GS
11521 echo 'strerror() and sys_errlist[] NOT found.' >&4
11522 d_strerror="$undef"
11523 d_syserrlst="$undef"
11524 d_strerrm='"unknown"'
28e8609d 11525 fi
2304df62
AD
11526fi
11527
a89d8a78
DH
11528: see if strtod exists
11529set strtod d_strtod
11530eval $inlibc
11531
11532: see if strtol exists
11533set strtol d_strtol
11534eval $inlibc
11535
ff935051
JH
11536: see if strtold exists
11537set strtold d_strtold
11538eval $inlibc
11539
76d49b1c
JH
11540: see if strtoll exists
11541set strtoll d_strtoll
11542eval $inlibc
11543
358a0a84
JH
11544case "$d_longlong-$d_strtoll" in
11545"$define-$define")
11546 $cat <<EOM
11547Checking whether your strtoll() works okay...
11548EOM
11549 $cat >try.c <<'EOCP'
11550#include <errno.h>
11551#ifdef __hpux
11552#define strtoll __strtoll
11553#endif
11554#include <stdio.h>
11555extern long long int strtoll(char *s, char **, int);
11556static int bad = 0;
11557int check(char *s, long long ell, int een) {
11558 long long gll;
11559 errno = 0;
11560 gll = strtoll(s, 0, 10);
11561 if (!((gll == ell) && (errno == een)))
11562 bad++;
11563}
11564int main() {
11565 check(" 1", 1LL, 0);
11566 check(" 0", 0LL, 0);
11567 check("-1", -1LL, 0);
11568 check("-9223372036854775808", -9223372036854775808LL, 0);
11569 check("-9223372036854775808", -9223372036854775808LL, 0);
11570 check(" 9223372036854775807", 9223372036854775807LL, 0);
11571 check("-9223372036854775808", -9223372036854775808LL, 0);
11572 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
11573 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11574 if (!bad)
11575 printf("ok\n");
11576}
11577EOCP
11578 set try
11579 if eval $compile; then
11580 case "`./try`" in
11581 ok) echo "Your strtoll() seems to be working okay." ;;
11582 *) cat <<EOM >&4
11583Your strtoll() doesn't seem to be working okay.
11584EOM
11585 d_strtoll="$undef"
11586 ;;
11587 esac
11588 fi
11589 ;;
11590esac
11591
a89d8a78
DH
11592: see if strtoul exists
11593set strtoul d_strtoul
11594eval $inlibc
11595
cf2093f6
JH
11596: see if strtoull exists
11597set strtoull d_strtoull
11598eval $inlibc
11599
358a0a84
JH
11600case "$d_longlong-$d_strtoull" in
11601"$define-$define")
11602 $cat <<EOM
11603Checking whether your strtoull() works okay...
11604EOM
11605 $cat >try.c <<'EOCP'
11606#include <errno.h>
11607#ifdef __hpux
11608#define strtoull __strtoull
11609#endif
11610#include <stdio.h>
11611extern unsigned long long int strtoull(char *s, char **, int);
11612static int bad = 0;
11613int check(char *s, long long eull, int een) {
11614 long long gull;
11615 errno = 0;
11616 gull = strtoull(s, 0, 10);
11617 if (!((gull == eull) && (errno == een)))
11618 bad++;
11619}
11620int main() {
11621 check(" 1", 1LL, 0);
11622 check(" 0", 0LL, 0);
11623 check("18446744073709551615", 18446744073709551615ULL, 0);
11624 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11625 if (!bad)
11626 printf("ok\n");
11627}
11628EOCP
11629 set try
11630 if eval $compile; then
11631 case "`./try`" in
11632 ok) echo "Your strtoull() seems to be working okay." ;;
11633 *) cat <<EOM >&4
11634Your strtoull() doesn't seem to be working okay.
11635EOM
11636 d_strtoull="$undef"
11637 ;;
11638 esac
11639 fi
11640 ;;
11641esac
11642
ff935051
JH
11643: see if strtouq exists
11644set strtouq d_strtouq
11645eval $inlibc
11646
a0d0e21e
LW
11647: see if strxfrm exists
11648set strxfrm d_strxfrm
11649eval $inlibc
11650
8175356b
JH
11651: see if symlink exists
11652set symlink d_symlink
11653eval $inlibc
11654
11655: see if syscall exists
11656set syscall d_syscall
11657eval $inlibc
11658
11659: see if sysconf exists
11660set sysconf d_sysconf
11661eval $inlibc
11662
11663: see if system exists
11664set system d_system
11665eval $inlibc
11666
11667: see if tcgetpgrp exists
11668set tcgetpgrp d_tcgetpgrp
11669eval $inlibc
11670
11671: see if tcsetpgrp exists
11672set tcsetpgrp d_tcsetpgrp
11673eval $inlibc
11674
11675: see if prototype for telldir is available
11676echo " "
11677set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11678eval $hasproto
dc45a647 11679
2c7991dc 11680: see if this is a sys/times.h system
11681set sys/times.h i_systimes
11682eval $inhdr
4633a7c4 11683
2c7991dc 11684: see if times exists
4633a7c4 11685echo " "
2c7991dc 11686if set times val -f d_times; eval $csym; $val; then
11687 echo 'times() found.' >&4
11688 d_times="$define"
11689 inc=''
11690 case "$i_systimes" in
11691 "$define") inc='sys/times.h';;
11692 esac
dc45a647 11693 rp="What is the type returned by times() on this system?"
2c7991dc 11694 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 11695 eval $typedef_ask
2c7991dc 11696else
11697 echo 'times() NOT found, hope that will do.' >&4
11698 d_times="$undef"
11699 clocktype='int'
11700fi
2304df62 11701
2c7991dc 11702: see if truncate exists
11703set truncate d_truncate
11704eval $inlibc
2304df62 11705
2c7991dc 11706: see if tzname[] exists
11707echo " "
11708if set tzname val -a d_tzname; eval $csym; $val; then
11709 val="$define"
11710 echo 'tzname[] found.' >&4
11711else
11712 val="$undef"
11713 echo 'tzname[] NOT found.' >&4
11714fi
11715set d_tzname
11716eval $setvar
11717
11718: see if umask exists
11719set umask d_umask
11720eval $inlibc
85e6fe83 11721
0545a864
JH
11722: see if ustat exists
11723set ustat d_ustat
11724eval $inlibc
11725
4633a7c4
LW
11726: backward compatibility for d_hvfork
11727if test X$d_hvfork != X; then
11728 d_vfork="$d_hvfork"
11729 d_hvfork=''
11730fi
11731: see if there is a vfork
11732val=''
11733set vfork val
11734eval $inlibc
ecfc5424 11735
4633a7c4
LW
11736: Ok, but do we want to use it. vfork is reportedly unreliable in
11737: perl on Solaris 2.x, and probably elsewhere.
11738case "$val" in
11739$define)
16d20bd9 11740 echo " "
4633a7c4
LW
11741 case "$usevfork" in
11742 false) dflt='n';;
11743 *) dflt='y';;
11744 esac
f10488a3
JH
11745 cat <<'EOM'
11746
11747Perl can only use a vfork() that doesn't suffer from strict
11748restrictions on calling functions or modifying global data in
11749the child. For example, glibc-2.1 contains such a vfork()
11750that is unsuitable. If your system provides a proper fork()
11751call, chances are that you do NOT want perl to use vfork().
11752
11753EOM
11754 rp="Do you still want to use vfork()?"
4633a7c4
LW
11755 . ./myread
11756 case "$ans" in
11757 y|Y) ;;
11758 *)
11759 echo "Ok, we won't use vfork()."
11760 val="$undef"
11761 ;;
11762 esac
ecfc5424
AD
11763 ;;
11764esac
4633a7c4
LW
11765set d_vfork
11766eval $setvar
11767case "$d_vfork" in
11768$define) usevfork='true';;
11769*) usevfork='false';;
11770esac
ecfc5424 11771
4633a7c4
LW
11772: see if this is an sysdir system
11773set sys/dir.h i_sysdir
11774eval $inhdr
11775
11776: see if this is an sysndir system
11777set sys/ndir.h i_sysndir
11778eval $inhdr
11779
11780: see if closedir exists
11781set closedir d_closedir
11782eval $inlibc
11783
11784case "$d_closedir" in
11785"$define")
16d20bd9 11786 echo " "
4633a7c4
LW
11787 echo "Checking whether closedir() returns a status..." >&4
11788 cat > closedir.c <<EOM
11789#$i_dirent I_DIRENT /**/
11790#$i_sysdir I_SYS_DIR /**/
11791#$i_sysndir I_SYS_NDIR /**/
bfb7748a 11792#$i_systypes I_SYS_TYPES /**/
4633a7c4 11793
bfb7748a
AD
11794#if defined(I_SYS_TYPES)
11795#include <sys/types.h>
11796#endif
4633a7c4
LW
11797#if defined(I_DIRENT)
11798#include <dirent.h>
11799#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11800#include <sys/dir.h>
4aa0a1f7 11801#endif
4633a7c4
LW
11802#else
11803#ifdef I_SYS_NDIR
11804#include <sys/ndir.h>
11805#else
11806#ifdef I_SYS_DIR
11807#ifdef hp9000s500
11808#include <ndir.h> /* may be wrong in the future */
11809#else
11810#include <sys/dir.h>
11811#endif
11812#endif
11813#endif
11814#endif
11815int main() { return closedir(opendir(".")); }
11816EOM
dfe9444c 11817 set closedir
dc45a647 11818 if eval $compile_ok; then
4633a7c4
LW
11819 if ./closedir > /dev/null 2>&1 ; then
11820 echo "Yes, it does."
11821 val="$undef"
ecfc5424 11822 else
4633a7c4
LW
11823 echo "No, it doesn't."
11824 val="$define"
ecfc5424
AD
11825 fi
11826 else
4633a7c4
LW
11827 echo "(I can't seem to compile the test program--assuming it doesn't)"
11828 val="$define"
ecfc5424 11829 fi
ecfc5424 11830 ;;
4633a7c4
LW
11831*)
11832 val="$undef";
ecfc5424
AD
11833 ;;
11834esac
4633a7c4
LW
11835set d_void_closedir
11836eval $setvar
11837$rm -f closedir*
11838: check for volatile keyword
ecfc5424 11839echo " "
4633a7c4
LW
11840echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11841$cat >try.c <<'EOCP'
5a411a32 11842int main()
4633a7c4
LW
11843{
11844 typedef struct _goo_struct goo_struct;
11845 goo_struct * volatile goo = ((goo_struct *)0);
11846 struct _goo_struct {
11847 long long_int;
11848 int reg_int;
11849 char char_var;
11850 };
11851 typedef unsigned short foo_t;
11852 char *volatile foo;
11853 volatile int bar;
11854 volatile foo_t blech;
11855 foo = foo;
a0d0e21e
LW
11856}
11857EOCP
4633a7c4
LW
11858if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11859 val="$define"
11860 echo "Yup, it does."
11861else
11862 val="$undef"
11863 echo "Nope, it doesn't."
11864fi
11865set d_volatile
11866eval $setvar
11867$rm -f try.*
a0d0e21e 11868
4633a7c4
LW
11869: see if there is a wait4
11870set wait4 d_wait4
8e07c86e
AD
11871eval $inlibc
11872
4633a7c4
LW
11873: see if waitpid exists
11874set waitpid d_waitpid
11875eval $inlibc
11876
11877: see if wcstombs exists
11878set wcstombs d_wcstombs
11879eval $inlibc
11880
11881: see if wctomb exists
11882set wctomb d_wctomb
11883eval $inlibc
11884
11885: preserve RCS keywords in files with variable substitution, grrr
11886Date='$Date'
11887Id='$Id'
11888Log='$Log'
11889RCSfile='$RCSfile'
11890Revision='$Revision'
11891
ca8cfa54
JH
11892case "$crosscompile" in
11893''|[nN]*) crosscompile="$undef" ;;
11894esac
11895
11896case "$osname" in
f556e5b9 11897next|rhapsody|darwin) multiarch="$define" ;;
ca8cfa54
JH
11898esac
11899case "$multiarch" in
11900''|[nN]*) multiarch="$undef" ;;
11901esac
11902
4633a7c4
LW
11903: check for alignment requirements
11904echo " "
68c15b6f
HM
11905case "$crosscompile$multiarch" in
11906*$define*)
ca8cfa54
JH
11907 $cat <<EOM
11908You seem to be either cross-compiling or doing a multiarchitecture build,
11909skipping the memory alignment check.
68c15b6f
HM
11910
11911EOM
11912 case "$alignbytes" in
11913 '') alignbytes=8 ;;
11914 esac
11915 ;;
11916*)
11917 case "$alignbytes" in
11918 '') echo "Checking alignment constraints..." >&4
87b71857
JH
11919 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11920 $cat >try.c <<'EOCP'
11921typedef long double NV;
11922EOCP
11923 else
11924 $cat >try.c <<'EOCP'
11925typedef double NV;
11926EOCP
11927 fi
11928 $cat >>try.c <<'EOCP'
14e4fe40 11929#include <stdio.h>
4633a7c4
LW
11930struct foobar {
11931 char foo;
87b71857 11932 NV bar;
732c9516 11933} try_algn;
d674cd6d 11934int main()
4633a7c4 11935{
213c275f
JH
11936 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11937 return(0);
4633a7c4
LW
11938}
11939EOCP
68c15b6f
HM
11940 set try
11941 if eval $compile_ok; then
11942 dflt=`./try`
11943 else
11944 dflt='8'
11945 echo "(I can't seem to compile the test program...)"
11946 fi
11947 ;;
11948 *) dflt="$alignbytes"
11949 ;;
11950 esac
11951 rp="Doubles must be aligned on a how-many-byte boundary?"
11952 . ./myread
11953 alignbytes="$ans"
11954 $rm -f try.c try
8e07c86e 11955 ;;
ecfc5424 11956esac
68c15b6f 11957
85e6fe83 11958
49c10eea
JH
11959: set the base revision
11960baserev=5.0
11961
4633a7c4 11962: check for ordering of bytes in a long
68c15b6f
HM
11963echo " "
11964case "$crosscompile$multiarch" in
11965*$define*)
11966 $cat <<EOM
ca8cfa54
JH
11967You seem to be either cross-compiling or doing a multiarchitecture build,
11968skipping the byteorder check.
68c15b6f
HM
11969
11970EOM
d9b3e12d 11971 byteorder='0xffff'
68c15b6f
HM
11972 ;;
11973*)
11974 case "$byteorder" in
11975 '')
11976 $cat <<'EOM'
4633a7c4
LW
11977In the following, larger digits indicate more significance. A big-endian
11978machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11979little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
d9b3e12d
JH
11980machines may have weird orders like 3412. A Cray will report 87654321,
11981an Alpha will report 12345678. If the test program works the default is
11982probably right.
4633a7c4
LW
11983I'm now running the test program...
11984EOM
68c15b6f 11985 $cat >try.c <<'EOCP'
4633a7c4 11986#include <stdio.h>
d674cd6d 11987int main()
4633a7c4
LW
11988{
11989 int i;
11990 union {
11991 unsigned long l;
11992 char c[sizeof(long)];
11993 } u;
11994
11995 if (sizeof(long) > 4)
11996 u.l = (0x08070605L << 32) | 0x04030201L;
11997 else
11998 u.l = 0x04030201L;
11999 for (i = 0; i < sizeof(long); i++)
12000 printf("%c", u.c[i]+'0');
12001 printf("\n");
12002 exit(0);
12003}
12004EOCP
68c15b6f
HM
12005 xxx_prompt=y
12006 set try
12007 if eval $compile && ./try > /dev/null; then
12008 dflt=`./try`
12009 case "$dflt" in
12010 [1-4][1-4][1-4][1-4]|12345678|87654321)
12011 echo "(The test program ran ok.)"
12012 echo "byteorder=$dflt"
12013 xxx_prompt=n
4633a7c4 12014 ;;
68c15b6f
HM
12015 ????|????????) echo "(The test program ran ok.)" ;;
12016 *) echo "(The test program didn't run right for some reason.)" ;;
12017 esac
12018 else
12019 dflt='4321'
12020 cat <<'EOM'
4633a7c4
LW
12021(I can't seem to compile the test program. Guessing big-endian...)
12022EOM
68c15b6f
HM
12023 fi
12024 case "$xxx_prompt" in
12025 y)
12026 rp="What is the order of bytes in a long?"
12027 . ./myread
12028 byteorder="$ans"
12029 ;;
12030 *) byteorder=$dflt
12031 ;;
12032 esac
ecfc5424
AD
12033 ;;
12034 esac
68c15b6f 12035 $rm -f try.c try
ecfc5424
AD
12036 ;;
12037esac
68c15b6f 12038
85e6fe83 12039
4633a7c4 12040: how do we catenate cpp tokens here?
2304df62 12041echo " "
4633a7c4
LW
12042echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12043$cat >cpp_stuff.c <<'EOCP'
12044#define RCAT(a,b)a/**/b
12045#define ACAT(a,b)a ## b
12046RCAT(Rei,ser)
12047ACAT(Cir,cus)
12048EOCP
12049$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12050if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 12051 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
12052 echo "We can catify or stringify, separately or together!"
12053 cpp_stuff=42
12054elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 12055 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
12056 echo "However, in the good old days we don't know how to stringify and"
12057 echo "catify at the same time."
12058 cpp_stuff=1
12059else
12060 $cat >&4 <<EOM
12061Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12062to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 12063EOM
4633a7c4
LW
12064 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12065fi
12066$rm -f cpp_stuff.*
a0d0e21e 12067
4633a7c4
LW
12068: see if this is a db.h system
12069set db.h i_db
12070eval $inhdr
12071
12072case "$i_db" in
68dc0745 12073$define)
1f70e1ea 12074 : Check db version.
68dc0745 12075 echo " "
12076 echo "Checking Berkeley DB version ..." >&4
12077 $cat >try.c <<EOCP
12078#$d_const HASCONST
12079#ifndef HASCONST
12080#define const
12081#endif
12082#include <sys/types.h>
12083#include <stdio.h>
12084#include <db.h>
d674cd6d 12085int main()
68dc0745 12086{
1f70e1ea
PM
12087#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12088 int Major, Minor, Patch ;
ee02776e 12089 unsigned long Version ;
1f70e1ea
PM
12090 (void)db_version(&Major, &Minor, &Patch) ;
12091 printf("You have Berkeley DB Version 2 or greater\n");
12092
12093 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12094 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12095 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12096 Major, Minor, Patch) ;
12097
12098 /* check that db.h & libdb are compatible */
12099 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12100 printf("db.h and libdb are incompatible\n") ;
12101 exit(3);
12102 }
12103
12104 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
12105
12106 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 12107 + DB_VERSION_PATCH ;
ee02776e
PM
12108
12109 /* needs to be >= 2.3.4 */
12110 if (Version < 2003004) {
693762b4 12111 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 12112 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
12113 exit(2);
12114 }
12115
12116 exit(0);
68dc0745 12117#else
6a1b87e5 12118#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 12119 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
12120 exit(0); /* DB version < 2: the coast is clear. */
12121#else
12122 exit(1); /* <db.h> not Berkeley DB? */
12123#endif
68dc0745 12124#endif
12125}
12126EOCP
dfe9444c 12127 set try
cf21f3c6 12128 if eval $compile_ok && ./try; then
1f70e1ea 12129 echo 'Looks OK.' >&4
68dc0745 12130 else
c90c0ff4 12131 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 12132 i_db=$undef
12133 case " $libs " in
12134 *"-ldb "*)
12135 : Remove db from list of libraries to use
12136 echo "Removing unusable -ldb from library list" >&4
12137 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12138 shift
12139 libs="$*"
12140 echo "libs = $libs" >&4
12141 ;;
12142 esac
12143 fi
12144 $rm -f try.*
12145 ;;
12146esac
12147
12148case "$i_db" in
4633a7c4 12149define)
dc45a647
MB
12150 : Check the return type needed for hash
12151 echo " "
12152 echo "Checking return type needed for hash for Berkeley DB ..." >&4
12153 $cat >try.c <<EOCP
12154#$d_const HASCONST
12155#ifndef HASCONST
12156#define const
12157#endif
12158#include <sys/types.h>
12159#include <db.h>
12160
12161#ifndef DB_VERSION_MAJOR
12162u_int32_t hash_cb (ptr, size)
12163const void *ptr;
12164size_t size;
12165{
12166}
12167HASHINFO info;
d674cd6d 12168int main()
dc45a647
MB
12169{
12170 info.hash = hash_cb;
12171}
12172#endif
12173EOCP
12174 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12175 if $contains warning try.out >>/dev/null 2>&1 ; then
12176 db_hashtype='int'
12177 else
12178 db_hashtype='u_int32_t'
12179 fi
12180 else
12181 : XXX Maybe we should just give up here.
12182 db_hashtype=u_int32_t
12183 $cat try.out >&4
12184 echo "Help: I can't seem to compile the db test program." >&4
12185 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12186 fi
12187 $rm -f try.*
12188 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12189 ;;
12190*) db_hashtype=u_int32_t
12191 ;;
12192esac
12193case "$i_db" in
12194define)
4633a7c4
LW
12195 : Check the return type needed for prefix
12196 echo " "
12197 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12198 cat >try.c <<EOCP
12199#$d_const HASCONST
12200#ifndef HASCONST
12201#define const
12202#endif
12203#include <sys/types.h>
12204#include <db.h>
1f70e1ea
PM
12205
12206#ifndef DB_VERSION_MAJOR
4633a7c4
LW
12207size_t prefix_cb (key1, key2)
12208const DBT *key1;
12209const DBT *key2;
12210{
12211}
12212BTREEINFO info;
d674cd6d 12213int main()
4633a7c4
LW
12214{
12215 info.prefix = prefix_cb;
12216}
1f70e1ea 12217#endif
4633a7c4
LW
12218EOCP
12219 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12220 if $contains warning try.out >>/dev/null 2>&1 ; then
12221 db_prefixtype='int'
12222 else
12223 db_prefixtype='size_t'
12224 fi
12225 else
68dc0745 12226 db_prefixtype='size_t'
12227 : XXX Maybe we should just give up here.
dc45a647 12228 $cat try.out >&4
68dc0745 12229 echo "Help: I can't seem to compile the db test program." >&4
12230 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
12231 fi
12232 $rm -f try.*
12233 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 12234 ;;
68dc0745 12235*) db_prefixtype='size_t'
4633a7c4
LW
12236 ;;
12237esac
a0d0e21e 12238
4633a7c4
LW
12239: check for void type
12240echo " "
12241echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
12242case "$voidflags" in
12243'')
12244 $cat >try.c <<'EOCP'
12245#if TRY & 1
760ac839 12246void sub() {
4633a7c4 12247#else
760ac839 12248sub() {
4633a7c4
LW
12249#endif
12250 extern void moo(); /* function returning void */
12251 void (*goo)(); /* ptr to func returning void */
12252#if TRY & 8
12253 void *hue; /* generic ptr */
12254#endif
12255#if TRY & 2
12256 void (*foo[10])();
12257#endif
a0d0e21e 12258
4633a7c4
LW
12259#if TRY & 4
12260 if(goo == moo) {
12261 exit(0);
12262 }
12263#endif
12264 exit(0);
12265}
d674cd6d 12266int main() { sub(); }
4633a7c4 12267EOCP
760ac839 12268 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 12269 voidflags=$defvoidused
bfb7748a 12270 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
12271 if $contains warning .out >/dev/null 2>&1; then
12272 echo "However, you might get some warnings that look like this:"
12273 $cat .out
12274 fi
12275 else
12276echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 12277 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 12278 echo "It supports 1..."
760ac839 12279 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 12280 echo "It also supports 2..."
760ac839 12281 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
12282 voidflags=7
12283 echo "And it supports 4 but not 8 definitely."
12284 else
12285 echo "It doesn't support 4..."
760ac839 12286 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
12287 voidflags=11
12288 echo "But it supports 8."
12289 else
12290 voidflags=3
12291 echo "Neither does it support 8."
12292 fi
12293 fi
12294 else
12295 echo "It does not support 2..."
760ac839 12296 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
12297 voidflags=13
12298 echo "But it supports 4 and 8."
12299 else
760ac839 12300 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
12301 voidflags=5
12302 echo "And it supports 4 but has not heard about 8."
12303 else
12304 echo "However it supports 8 but not 4."
12305 fi
12306 fi
12307 fi
12308 else
12309 echo "There is no support at all for void."
12310 voidflags=0
12311 fi
12312 fi
12313esac
4633a7c4 12314case "$voidflags" in
2c7991dc 12315"$defvoidused") ;;
bfb7748a
AD
12316*) $cat >&4 <<'EOM'
12317 Support flag bits are:
12318 1: basic void declarations.
12319 2: arrays of pointers to functions returning void.
12320 4: operations between pointers to and addresses of void functions.
12321 8: generic void pointers.
12322EOM
2c7991dc 12323 dflt="$voidflags";
4633a7c4 12324 rp="Your void support flags add up to what?"
a0d0e21e 12325 . ./myread
4633a7c4 12326 voidflags="$ans"
a0d0e21e
LW
12327 ;;
12328esac
4633a7c4 12329$rm -f try.* .out
a0d0e21e 12330
85ab1d1d
JH
12331
12332: How can we generate normalized random numbers ?
693762b4 12333echo " "
de4597cb 12334echo "Looking for a random number function..." >&4
85ab1d1d 12335case "$randfunc" in
693762b4 12336'')
85ab1d1d
JH
12337 if set drand48 val -f; eval $csym; $val; then
12338 dflt="drand48"
12339 echo "Good, found drand48()." >&4
12340 elif set random val -f; eval $csym; $val; then
12341 dflt="random"
12342 echo "OK, found random()." >&4
12343 else
12344 dflt="rand"
12345 echo "Yick, looks like I have to use rand()." >&4
12346 fi
12347 echo " "
12348 ;;
12349*)
12350 dflt="$randfunc"
12351 ;;
12352esac
12353cont=true
12354
12355case "$ccflags" in
12356*-Dmy_rand=*|*-Dmy_srand=*)
12357 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12358 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12359 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12360 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12361 ;;
12362esac
12363
12364while $test "$cont"; do
12365 rp="Use which function to generate random numbers?"
12366 . ./myread
12367 if $test "$ans" = "$dflt"; then
12368 : null
12369 else
12370 randbits=''
12371 fi
12372 randfunc="$ans"
12373 if set $ans val -f; eval $csym; $val; then
12374 cont=''
12375 else
ef4af2be
JH
12376 dflt=y
12377 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
12378 . ./myread
12379 dflt=rand
12380 case "$ans" in
12381 [yY]*) cont='';;
12382 esac
12383 fi
12384 case "$cont" in
12385 '')
12386 case "$randfunc" in
12387 drand48)
12388 drand01="drand48()"
12389 seedfunc="srand48"
12390 randbits=48
12391 randseedtype=long
12392 ;;
12393 rand|random)
12394 case "$randbits" in
12395 '')
12396echo "Checking to see how many bits your $randfunc() function produces..." >&4
12397 $cat >try.c <<EOCP
12398#$i_unistd I_UNISTD
12399#$i_stdlib I_STDLIB
693762b4 12400#include <stdio.h>
85ab1d1d
JH
12401#ifdef I_UNISTD
12402# include <unistd.h>
12403#endif
12404#ifdef I_STDLIB
12405# include <stdlib.h>
12406#endif
d674cd6d 12407int main()
693762b4 12408{
85ab1d1d
JH
12409 register int i;
12410 register unsigned long tmp;
12411 register unsigned long max = 0L;
12412
12413 for (i = 1000; i; i--) {
12414 tmp = (unsigned long) $randfunc();
12415 if (tmp > max) max = tmp;
12416 }
12417 for (i = 0; max; i++)
12418 max /= 2;
12419 printf("%d\n",i);
693762b4
AD
12420}
12421EOCP
85ab1d1d
JH
12422 set try
12423 if eval $compile_ok; then
12424 dflt=`try`
12425 else
12426 dflt='?'
12427 echo "(I can't seem to compile the test program...)"
12428 fi
12429 ;;
12430 *)
12431 dflt="$randbits"
12432 ;;
12433 esac
12434 rp="How many bits does your $randfunc() function produce?"
12435 . ./myread
12436 randbits="$ans"
12437 $rm -f try.c try
12438 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12439 seedfunc="s$randfunc"
12440 randseedtype=unsigned
12441 ;;
12442 *)
12443 dflt="31"
12444 rp="How many bits does your $randfunc() function produce?"
12445 . ./myread
12446 randbits="$ans"
12447 seedfunc="s$randfunc"
12448 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12449 if set $seedfunc val -f; eval $csym; $val; then
12450 echo "(Using $seedfunc() to seed random generator)"
12451 else
12452 echo "(Warning: no $seedfunc() to seed random generator)"
12453 seedfunc=rand
12454 fi
12455 randseedtype=unsigned
12456 ;;
12457 esac
12458 ;;
12459 esac
12460done
693762b4 12461
5ff3f7a4
GS
12462echo " "
12463echo "Determining whether or not we are on an EBCDIC system..." >&4
12464$cat >tebcdic.c <<'EOM'
12465int main()
12466{
12467 if ('M'==0xd4) return 0;
12468 return 1;
12469}
12470EOM
12471
12472val=$undef
12473set tebcdic
12474if eval $compile_ok; then
12475 if ./tebcdic; then
12476 echo "You have EBCDIC." >&4
12477 val="$define"
12478 else
57def98f 12479 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
5ff3f7a4
GS
12480 fi
12481else
5cc3184f 12482 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
12483 echo "I'll assume ASCII or some ISO Latin." >&4
12484fi
12485$rm -f tebcdic.c tebcdic
12486set ebcdic
12487eval $setvar
12488
29209bc5 12489echo " "
767df6a1
JH
12490$cat >&4 <<EOM
12491Checking how to flush all pending stdio output...
66fe083f 12492EOM
d2201af2
AD
12493# I only know how to find the first 32 possibly open files on SunOS.
12494# See also hints/sunos_4_1.sh and util.c --AD
12495case "$osname" in
12496sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12497esac
12498$cat >>try.c <<EOCP
66fe083f 12499#include <stdio.h>
d2201af2 12500#$i_unistd I_UNISTD
767df6a1 12501#ifdef I_UNISTD
a32a45b6 12502# include <unistd.h>
767df6a1
JH
12503#endif
12504#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
12505#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12506#ifdef HAS_STDIO_STREAM_ARRAY
12507# define STDIO_STREAM_ARRAY $stdio_stream_array
12508#endif
66fe083f
JH
12509int main() {
12510 FILE* p = fopen("try.out", "w");
0f27ced1 12511#ifdef TRY_FPUTC
66fe083f 12512 fputc('x', p);
0f27ced1
JH
12513#else
12514# ifdef TRY_FPRINTF
12515 fprintf(p, "x");
12516# endif
12517#endif
767df6a1 12518#ifdef TRY_FFLUSH_NULL
66fe083f 12519 fflush(NULL);
767df6a1
JH
12520#endif
12521#ifdef TRY_FFLUSH_ALL
12522 {
12523 long open_max = -1;
d2201af2
AD
12524# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12525 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 12526# else
d2201af2
AD
12527# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12528 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 12529# else
4b257aef 12530# ifdef FOPEN_MAX
d2201af2 12531 open_max = FOPEN_MAX;
767df6a1 12532# else
d2201af2
AD
12533# ifdef OPEN_MAX
12534 open_max = OPEN_MAX;
12535# else
12536# ifdef _NFILE
12537 open_max = _NFILE;
12538# endif
767df6a1
JH
12539# endif
12540# endif
12541# endif
4b257aef 12542# endif
ed39a0f2 12543# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
12544 if (open_max > 0) {
12545 long i;
12546 for (i = 0; i < open_max; i++)
d2201af2
AD
12547 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12548 STDIO_STREAM_ARRAY[i]._file < open_max &&
12549 STDIO_STREAM_ARRAY[i]._flag)
12550 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
12551 }
12552 }
ed39a0f2 12553# endif
767df6a1
JH
12554#endif
12555 _exit(42);
66fe083f
JH
12556}
12557EOCP
0f27ced1
JH
12558: first we have to find out how _not_ to flush
12559if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12560 output=''
12561 set try -DTRY_FPUTC
6626660c 12562 if eval $compile; then
4b257aef 12563 $rm -f try.out
0f27ced1
JH
12564 ./try$exe_ext 2>/dev/null
12565 if $test ! -s try.out -a "X$?" = X42; then
12566 output=-DTRY_FPUTC
12567 fi
12568 fi
12569 case "$output" in
12570 '')
12571 set try -DTRY_FPRINTF
12572 $rm -f try.out
6626660c 12573 if eval $compile; then
4b257aef 12574 $rm -f try.out
0f27ced1
JH
12575 ./try$exe_ext 2>/dev/null
12576 if $test ! -s try.out -a "X$?" = X42; then
12577 output=-DTRY_FPRINTF
12578 fi
12579 fi
12580 ;;
12581 esac
12582fi
767df6a1
JH
12583: check for fflush NULL behaviour
12584case "$fflushNULL" in
0f27ced1 12585'') set try -DTRY_FFLUSH_NULL $output
6626660c 12586 if eval $compile; then
4b257aef 12587 $rm -f try.out
196fa3d2 12588 ./try$exe_ext 2>/dev/null
a32a45b6
JH
12589 code="$?"
12590 if $test -s try.out -a "X$code" = X42; then
c2fddd50 12591 fflushNULL="`$cat try.out`"
a32a45b6
JH
12592 else
12593 if $test "X$code" != X42; then
12594 $cat >&4 <<EOM
12595(If this test failed, don't worry, we'll try another method shortly.)
12596EOM
12597 fi
c2fddd50
JH
12598 fi
12599 fi
0f27ced1 12600 $rm -f core try.core core.try.*
c2fddd50 12601 case "$fflushNULL" in
6626660c 12602 x) $cat >&4 <<EOM
2b8ee124
JH
12603Your fflush(NULL) works okay for output streams.
12604Let's see if it clobbers input pipes...
66fe083f 12605EOM
2b8ee124
JH
12606# As of mid-March 2000 all versions of Solaris appear to have a stdio
12607# bug that improperly flushes the input end of pipes. So we avoid the
12608# autoflush on fork/system/exec support for now. :-(
12609$cat >tryp.c <<EOCP
12610#include <stdio.h>
12611int
12612main(int argc, char **argv)
12613{
12614 char buf[1024];
12615 int i;
12616 char *bp = buf;
12617 while (1) {
12618 while ((i = getc(stdin)) != -1
12619 && (*bp++ = i) != '\n'
12620 && bp < &buf[1024])
12621 /* DO NOTHING */ ;
12622 *bp = '\0';
12623 fprintf(stdout, "%s", buf);
12624 fflush(NULL);
12625 if (i == -1)
b354742d 12626 return 0;
2b8ee124
JH
12627 bp = buf;
12628 }
12629}
12630EOCP
12631 fflushNULL="$define"
12632 set tryp
12633 if eval $compile; then
12634 $rm -f tryp.out
12635 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12636 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12637 $cat >&4 <<EOM
12638fflush(NULL) seems to behave okay with input streams.
12639EOM
12640 fflushNULL="$define"
12641 else
12642 $cat >&4 <<EOM
12643Ouch, fflush(NULL) clobbers input pipes! We will not use it.
12644EOM
12645 fflushNULL="$undef"
12646 fi
12647 fi
b354742d 12648 $rm -f core tryp.c tryp.core core.tryp.*
c2fddd50 12649 ;;
6626660c 12650 '') $cat >&4 <<EOM
66fe083f
JH
12651Your fflush(NULL) isn't working (contrary to ANSI C).
12652EOM
ed39a0f2 12653 fflushNULL="$undef"
c2fddd50 12654 ;;
6626660c 12655 *) $cat >&4 <<EOM
66fe083f
JH
12656Cannot figure out whether your fflush(NULL) works or not.
12657I'm assuming it doesn't (contrary to ANSI C).
12658EOM
ed39a0f2 12659 fflushNULL="$undef"
c2fddd50
JH
12660 ;;
12661 esac
66fe083f
JH
12662 ;;
12663$define|true|[yY]*)
ed39a0f2 12664 fflushNULL="$define"
66fe083f
JH
12665 ;;
12666*)
ed39a0f2 12667 fflushNULL="$undef"
66fe083f
JH
12668 ;;
12669esac
b354742d
GS
12670: check explicit looping only if NULL did not work, and if the pipe
12671: bug does not show up on an explicit flush too
a32a45b6
JH
12672case "$fflushNULL" in
12673"$undef")
b354742d
GS
12674 $cat >tryp.c <<EOCP
12675#include <stdio.h>
12676int
12677main(int argc, char **argv)
12678{
12679 char buf[1024];
12680 int i;
12681 char *bp = buf;
12682 while (1) {
12683 while ((i = getc(stdin)) != -1
12684 && (*bp++ = i) != '\n'
12685 && bp < &buf[1024])
12686 /* DO NOTHING */ ;
12687 *bp = '\0';
12688 fprintf(stdout, "%s", buf);
12689 fflush(stdin);
12690 if (i == -1)
12691 return 0;
12692 bp = buf;
12693 }
12694}
12695EOCP
12696 set tryp
12697 if eval $compile; then
12698 $rm -f tryp.out
12699 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12700 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12701 $cat >&4 <<EOM
12702Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
a71cd7cd 12703EOM
b354742d 12704 : now check for fflushall behaviour
a32a45b6 12705 case "$fflushall" in
b354742d
GS
12706 '') set try -DTRY_FFLUSH_ALL $output
12707 if eval $compile; then
12708 $cat >&4 <<EOM
12709(Now testing the other method--but note that this also may fail.)
12710EOM
12711 $rm -f try.out
12712 ./try$exe_ext 2>/dev/null
12713 if $test -s try.out -a "X$?" = X42; then
12714 fflushall="`$cat try.out`"
12715 fi
12716 fi
12717 $rm -f core try.core core.try.*
12718 case "$fflushall" in
12719 x) $cat >&4 <<EOM
a32a45b6 12720Whew. Flushing explicitly all the stdio streams works.
767df6a1 12721EOM
b354742d
GS
12722 fflushall="$define"
12723 ;;
12724 '') $cat >&4 <<EOM
a32a45b6 12725Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 12726EOM
b354742d
GS
12727 fflushall="$undef"
12728 ;;
12729 *) $cat >&4 <<EOM
6626660c 12730Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
12731I'm assuming it doesn't.
12732EOM
b354742d
GS
12733 fflushall="$undef"
12734 ;;
12735 esac
12736 ;;
12737 "$define"|true|[yY]*)
12738 fflushall="$define"
12739 ;;
12740 *)
a32a45b6
JH
12741 fflushall="$undef"
12742 ;;
12743 esac
b354742d
GS
12744 else
12745 $cat >&4 <<EOM
12746All is futile. Even fflush(stdin) clobbers input pipes!
12747EOM
a32a45b6 12748 fflushall="$undef"
b354742d
GS
12749 fi
12750 else
12751 fflushall="$undef"
12752 fi
12753 $rm -f core tryp.c tryp.core core.tryp.*
767df6a1 12754 ;;
b354742d 12755*) fflushall="$undef"
767df6a1
JH
12756 ;;
12757esac
b354742d 12758
767df6a1
JH
12759case "$fflushNULL$fflushall" in
12760undefundef)
6626660c 12761 $cat <<EOM
b354742d
GS
12762OK, I give up. I cannot figure out how to flush pending stdio output.
12763We won't be flushing handles at all before fork/exec/popen.
767df6a1
JH
12764EOM
12765 ;;
12766esac
12767$rm -f try.* try$exe_ext
66fe083f 12768
ccc7f9b3
KS
12769: Store the full pathname to the ar program for use in the C program
12770: Respect a hint or command line value for full_ar.
12771case "$full_ar" in
12772'') full_ar=$ar ;;
12773esac
12774
1aef975c
AD
12775: Store the full pathname to the sed program for use in the C program
12776full_sed=$sed
12777
2304df62 12778: see what type gids are declared as in the kernel
dc45a647
MB
12779echo " "
12780echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
12781set gid_t gidtype xxx stdio.h sys/types.h
12782eval $typedef
2304df62 12783case "$gidtype" in
a0d0e21e
LW
12784xxx)
12785 xxx=`./findhdr sys/user.h`
12786 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12787 case $1 in
12788 unsigned) dflt="$1 $2" ;;
12789 *) dflt="$1" ;;
12790 esac
2304df62 12791 ;;
8175356b
JH
12792*) dflt="$gidtype";;
12793esac
12794case "$gidtype" in
12795gid_t) echo "gid_t found." ;;
12796*) rp="What is the type for group ids returned by getgid()?"
12797 . ./myread
12798 gidtype="$ans"
12799 ;;
12800esac
12801
12802echo " "
12803case "$gidtype" in
12804*_t) zzz="$gidtype" ;;
12805*) zzz="gid" ;;
12806esac
a22e52b9 12807echo "Checking the size of $zzz..." >&4
8175356b
JH
12808cat > try.c <<EOCP
12809#include <sys/types.h>
12810#include <stdio.h>
12811int main() {
213c275f 12812 printf("%d\n", (int)sizeof($gidtype));
14e4fe40 12813 exit(0);
8175356b
JH
12814}
12815EOCP
12816set try
a22e52b9 12817if eval $compile_ok; then
8175356b
JH
12818 yyy=`./try`
12819 case "$yyy" in
a22e52b9
JH
12820 '') gidsize=4
12821 echo "(I can't execute the test program--guessing $gidsize.)" >&4
8175356b 12822 ;;
a22e52b9 12823 *) gidsize=$yyy
49c10eea 12824 echo "Your $zzz is $gidsize bytes long."
8175356b
JH
12825 ;;
12826 esac
12827else
a22e52b9
JH
12828 gidsize=4
12829 echo "(I can't compile the test program--guessing $gidsize.)" >&4
8175356b
JH
12830fi
12831
12832
12833echo " "
12834case "$gidtype" in
12835*_t) zzz="$gidtype" ;;
12836*) zzz="gid" ;;
12837esac
a22e52b9 12838echo "Checking the sign of $zzz..." >&4
8175356b
JH
12839cat > try.c <<EOCP
12840#include <sys/types.h>
12841#include <stdio.h>
12842int main() {
a22e52b9
JH
12843 $gidtype foo = -1;
12844 if (foo < 0)
12845 printf("-1\n");
12846 else
12847 printf("1\n");
8175356b
JH
12848}
12849EOCP
12850set try
a22e52b9 12851if eval $compile; then
8175356b
JH
12852 yyy=`./try`
12853 case "$yyy" in
a22e52b9
JH
12854 '') gidsign=1
12855 echo "(I can't execute the test program--guessing unsigned.)" >&4
8175356b 12856 ;;
a22e52b9
JH
12857 *) gidsign=$yyy
12858 case "$gidsign" in
12859 1) echo "Your $zzz is unsigned." ;;
12860 -1) echo "Your $zzz is signed." ;;
12861 esac
8175356b
JH
12862 ;;
12863 esac
12864else
a22e52b9
JH
12865 gidsign=1
12866 echo "(I can't compile the test program--guessing unsigned.)" >&4
8175356b
JH
12867fi
12868
12869
785fb66b 12870echo " "
8175356b
JH
12871
12872if $test X"$quadtype" != X; then
12873
12874echo "Checking how to print 64-bit integers..." >&4
12875
12876if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12877 $cat >try.c <<'EOCP'
785fb66b
JH
12878#include <sys/types.h>
12879#include <stdio.h>
12880int main() {
8175356b
JH
12881 int q = 12345678901;
12882 printf("%ld\n", q);
785fb66b
JH
12883}
12884EOCP
8175356b
JH
12885 set try
12886 if eval $compile; then
12887 yyy=`./try$exe_ext`
12888 case "$yyy" in
12889 12345678901)
12890 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12891 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12892 echo "We will use %d."
12893 ;;
785fb66b 12894 esac
8175356b 12895 fi
785fb66b
JH
12896fi
12897
8175356b
JH
12898if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12899 $cat >try.c <<'EOCP'
12900#include <sys/types.h>
12901#include <stdio.h>
12902int main() {
12903 long q = 12345678901;
12904 printf("%ld\n", q);
12905}
12906EOCP
12907 set try
12908 if eval $compile; then
12909 yyy=`./try$exe_ext`
12910 case "$yyy" in
12911 12345678901)
12912 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12913 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12914 echo "We will use %ld."
12915 ;;
12916 esac
12917 fi
12918fi
785fb66b 12919
8afc5b8d 12920if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
8175356b 12921 $cat >try.c <<'EOCP'
785fb66b 12922#include <sys/types.h>
8175356b 12923#include <inttypes.h>
785fb66b
JH
12924#include <stdio.h>
12925int main() {
8175356b
JH
12926 int64_t q = 12345678901;
12927 printf("%" PRId64 "\n", q);
785fb66b
JH
12928}
12929EOCP
8175356b
JH
12930 set try
12931 if eval $compile; then
12932 yyy=`./try$exe_ext`
12933 case "$yyy" in
12934 12345678901)
12935 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12936 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12937 echo "We will use the C9X style."
12938 ;;
12939 esac
12940 fi
12941fi
12942
12943if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12944 $cat >try.c <<'EOCP'
12945#include <sys/types.h>
12946#include <stdio.h>
12947int main() {
12948 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12949 printf("%lld\n", q);
12950}
12951EOCP
12952 set try
12953 if eval $compile; then
12954 yyy=`./try$exe_ext`
12955 case "$yyy" in
12956 12345678901)
12957 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12958 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12959 echo "We will use the %lld style."
12960 ;;
12961 esac
12962 fi
785fb66b
JH
12963fi
12964
8175356b
JH
12965if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12966 $cat >try.c <<EOCP
12967#include <sys/types.h>
12968#include <stdio.h>
12969int main() {
12970 $quadtype q = 12345678901;
12971 printf("%Ld\n", q);
12972}
12973EOCP
12974 set try
12975 if eval $compile; then
12976 yyy=`./try$exe_ext`
12977 case "$yyy" in
12978 12345678901)
12979 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12980 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12981 echo "We will use %Ld."
12982 ;;
12983 esac
12984 fi
12985fi
785fb66b 12986
8175356b
JH
12987if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12988 $cat >try.c <<EOCP
12989#include <sys/types.h>
12990#include <stdio.h>
12991int main() {
12992 $quadtype q = 12345678901;
12993 printf("%qd\n", q);
12994}
12995EOCP
12996 set try
12997 if eval $compile; then
12998 yyy=`./try$exe_ext`
12999 case "$yyy" in
13000 12345678901)
13001 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13002 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13003 echo "We will use %qd."
13004 ;;
13005 esac
13006 fi
13007fi
2304df62 13008
8175356b
JH
13009if $test X"$sPRId64" = X; then
13010 echo "Cannot figure out how to print 64-bit integers." >&4
13011fi
5cd24f17 13012
8175356b 13013$rm -f try try.*
dfe9444c 13014
8175356b 13015fi
2304df62 13016
8175356b
JH
13017case "$sPRId64" in
13018'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
13019 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
13020 ;;
13021*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
13022 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
a0d0e21e 13023 ;;
2304df62 13024esac
2304df62 13025
2304df62 13026
8ff267be 13027echo " "
8175356b
JH
13028$echo "Checking the format strings to be used for Perl's internal types..." >&4
13029
13030if $test X"$ivsize" = X8; then
13031 ivdformat="$sPRId64"
13032 uvuformat="$sPRIu64"
13033 uvoformat="$sPRIo64"
13034 uvxformat="$sPRIx64"
5ff3f7a4 13035else
8175356b
JH
13036 if $test X"$ivsize" = X"$longsize"; then
13037 ivdformat='"ld"'
13038 uvuformat='"lu"'
13039 uvoformat='"lo"'
13040 uvxformat='"lx"'
13041 else
13042 if $test X"$ivsize" = X"$intsize"; then
13043 ivdformat='"d"'
13044 uvuformat='"u"'
13045 uvoformat='"o"'
13046 uvxformat='"x"'
13047 else
13048 : far out
13049 if $test X"$ivsize" = X"$shortsize"; then
13050 ivdformat='"hd"'
13051 uvuformat='"hu"'
13052 uvoformat='"ho"'
13053 uvxformat='"hx"'
13054 fi
13055 fi
13056 fi
5ff3f7a4 13057fi
8175356b
JH
13058
13059case "$ivdformat" in
13060'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13061 exit 1
13062 ;;
13063esac
5ff3f7a4 13064
a22e52b9
JH
13065
13066echo " "
13067$echo "Checking the format string to be used for gids..." >&4
13068
13069case "$gidsign" in
13070-1) if $test X"$gidsize" = X"$ivsize"; then
13071 gidformat="$ivdformat"
13072 else
13073 if $test X"$gidsize" = X"$longsize"; then
13074 gidformat='"ld"'
13075 else
13076 if $test X"$gidsize" = X"$intsize"; then
13077 gidformat='"d"'
13078 else
13079 if $test X"$gidsize" = X"$shortsize"; then
13080 gidformat='"hd"'
13081 fi
13082 fi
13083 fi
13084 fi
13085 ;;
13086*) if $test X"$gidsize" = X"$uvsize"; then
13087 gidformat="$uvuformat"
13088 else
13089 if $test X"$gidsize" = X"$longsize"; then
13090 gidformat='"lu"'
13091 else
13092 if $test X"$gidsize" = X"$intsize"; then
13093 gidformat='"u"'
13094 else
13095 if $test X"$gidsize" = X"$shortsize"; then
13096 gidformat='"hu"'
13097 fi
13098 fi
13099 fi
13100 fi
13101 ;;
13102esac
13103
13104: see if getgroups exists
13105set getgroups d_getgrps
13106eval $inlibc
13107
13108: see if setgroups exists
13109set setgroups d_setgrps
13110eval $inlibc
13111
13112
13113: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13114echo " "
13115case "$d_getgrps$d_setgrps" in
13116*define*)
13117 case "$groupstype" in
13118 '') dflt="$gidtype" ;;
13119 *) dflt="$groupstype" ;;
13120 esac
13121 $cat <<EOM
13122What type of pointer is the second argument to getgroups() and setgroups()?
13123Usually this is the same as group ids, $gidtype, but not always.
13124
13125EOM
13126 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13127 . ./myread
13128 groupstype="$ans"
13129 ;;
13130*) groupstype="$gidtype";;
13131esac
13132
5ff3f7a4 13133echo " "
dfe9444c 13134echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 13135case "$make_set_make" in
13136'')
13137 $sed 's/^X //' > testmake.mak << 'EOF'
13138Xall:
dfe9444c 13139X @echo 'maketemp="$(MAKE)"'
8ff267be 13140EOF
8ff267be 13141 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 13142 *maketemp=*) make_set_make='#' ;;
8ff267be 13143 *) make_set_make="MAKE=$make" ;;
13144 esac
dfe9444c
AD
13145 $rm -f testmake.mak
13146 ;;
13147esac
13148case "$make_set_make" in
13149'#') echo "Yup, it does.";;
13150*) echo "Nope, it doesn't.";;
13151esac
13152
13153: see what type is used for mode_t
dc45a647 13154rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 13155set mode_t modetype int stdio.h sys/types.h
dc45a647 13156eval $typedef_ask
dfe9444c 13157
dfe9444c
AD
13158: define a fucntion to check prototypes
13159$cat > protochk <<EOSH
13160$startsh
13161cc="$cc"
13162optimize="$optimize"
13163ccflags="$ccflags"
13164prototype="$prototype"
13165define="$define"
13166rm=$rm
13167EOSH
13168
13169$cat >> protochk <<'EOSH'
13170
13171$rm -f try.c
13172foo="$1"
13173shift
13174while test $# -ge 2; do
13175 case "$1" in
13176 $define) echo "#include <$2>" >> try.c ;;
13177 literal) echo "$2" >> try.c ;;
13178 esac
13179 shift 2
13180done
13181test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13182cat >> try.c <<'EOCP'
13183#ifdef CAN_PROTOTYPE
13184#define _(args) args
13185#else
13186#define _(args) ()
13187#endif
13188EOCP
13189echo "$foo" >> try.c
13190echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13191$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13192status=$?
13193$rm -f try.[co]
13194exit $status
13195EOSH
13196chmod +x protochk
13197$eunicefix protochk
13198
c890dc6c
JH
13199: see what type is used for size_t
13200rp="What is the type used for the length parameter for string functions?"
13201set size_t sizetype 'unsigned int' stdio.h sys/types.h
13202eval $typedef_ask
13203
dfe9444c
AD
13204: check for type of arguments to gethostbyaddr.
13205if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13206 case "$d_gethbyaddr" in
13207 $define)
13208 $cat <<EOM
13209
13210Checking to see what type of arguments are accepted by gethostbyaddr().
13211EOM
13212 hdrs="$define sys/types.h
13213 $d_socket sys/socket.h
13214 $i_niin netinet/in.h
13215 $i_netdb netdb.h
13216 $i_unistd unistd.h"
13217 : The first arg can 'char *' or 'void *'
13218 : The second arg is some of integral type
13219 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13220 for yyy in size_t long int; do
13221 case "$netdb_host_type" in
13222 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13223 if ./protochk "$try" $hdrs; then
13224 echo "Your system accepts $xxx for the first arg."
13225 echo "...and $yyy for the second arg."
13226 netdb_host_type="$xxx"
13227 netdb_hlen_type="$yyy"
13228 fi
13229 ;;
13230 esac
13231 done
13232 done
13233 : In case none of those worked, prompt the user.
13234 case "$netdb_host_type" in
13235 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13236 dflt='char *'
13237 . ./myread
13238 netdb_host_type=$ans
13239 rp='What is the type for the 2nd argument to gethostbyaddr?'
13240 dflt="$sizetype"
13241 . ./myread
13242 netdb_hlen_type=$ans
13243 ;;
13244 esac
13245 ;;
13246 *) : no gethostbyaddr, so pick harmless defaults
13247 netdb_host_type='char *'
13248 netdb_hlen_type="$sizetype"
13249 ;;
13250 esac
13251 # Remove the "const" if needed. -- but then we'll have a
13252 # prototype clash!
13253 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13254fi
13255
13256: check for type of argument to gethostbyname.
13257if test "X$netdb_name_type" = X ; then
13258 case "$d_gethbyname" in
13259 $define)
13260 $cat <<EOM
13261
13262Checking to see what type of argument is accepted by gethostbyname().
13263EOM
13264 hdrs="$define sys/types.h
13265 $d_socket sys/socket.h
13266 $i_niin netinet/in.h
13267 $i_netdb netdb.h
13268 $i_unistd unistd.h"
13269 for xxx in "const char *" "char *"; do
13270 case "$netdb_name_type" in
13271 '') try="extern struct hostent *gethostbyname($xxx);"
13272 if ./protochk "$try" $hdrs; then
13273 echo "Your system accepts $xxx."
13274 netdb_name_type="$xxx"
13275 fi
13276 ;;
13277 esac
13278 done
13279 : In case none of those worked, prompt the user.
13280 case "$netdb_name_type" in
13281 '') rp='What is the type for the 1st argument to gethostbyname?'
13282 dflt='char *'
13283 . ./myread
13284 netdb_name_type=$ans
13285 ;;
13286 esac
13287 ;;
13288 *) : no gethostbyname, so pick harmless default
13289 netdb_name_type='char *'
13290 ;;
13291 esac
13292fi
8ff267be 13293
dfe9444c
AD
13294: check for type of 1st argument to getnetbyaddr.
13295if test "X$netdb_net_type" = X ; then
13296 case "$d_getnbyaddr" in
13297 $define)
13298 $cat <<EOM
85e6fe83 13299
dfe9444c
AD
13300Checking to see what type of 1st argument is accepted by getnetbyaddr().
13301EOM
13302 hdrs="$define sys/types.h
13303 $d_socket sys/socket.h
13304 $i_niin netinet/in.h
13305 $i_netdb netdb.h
13306 $i_unistd unistd.h"
13307 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13308 case "$netdb_net_type" in
13309 '') try="extern struct netent *getnetbyaddr($xxx, int);"
13310 if ./protochk "$try" $hdrs; then
13311 echo "Your system accepts $xxx."
13312 netdb_net_type="$xxx"
13313 fi
13314 ;;
13315 esac
13316 done
13317 : In case none of those worked, prompt the user.
13318 case "$netdb_net_type" in
13319 '') rp='What is the type for the 1st argument to getnetbyaddr?'
13320 dflt='long'
13321 . ./myread
13322 netdb_net_type=$ans
13323 ;;
13324 esac
13325 ;;
13326 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 13327 netdb_net_type='long'
dfe9444c
AD
13328 ;;
13329 esac
13330fi
2c7991dc 13331: locate the preferred pager for this system
13332case "$pager" in
13333'')
13334 dflt=''
13335 case "$pg" in
13336 /*) dflt=$pg;;
13337 esac
13338 case "$more" in
13339 /*) dflt=$more;;
13340 esac
13341 case "$less" in
13342 /*) dflt=$less;;
13343 esac
13344 case "$dflt" in
13345 '') dflt=/usr/ucb/more;;
13346 esac
13347 ;;
13348*) dflt="$pager";;
13349esac
13350echo " "
13351fn=f/
13352rp='What pager is used on your system?'
13353. ./getfile
13354pager="$ans"
13355
dfe9444c 13356: see what type pids are declared as in the kernel
dc45a647 13357rp="What is the type of process ids on this system?"
dfe9444c 13358set pid_t pidtype int stdio.h sys/types.h
dc45a647 13359eval $typedef_ask
2304df62 13360
fe749a9f
JH
13361: Find earliest binary compatible site_perl subdirectory perl can use.
13362case "$bincompat5005" in
13363"$define") xs_apiversion='5.005' ;;
13364*) xs_apiversion=$version ;; # The current site_perl version.
13365esac
13366: Find earliest pure perl site_perl subdirectory perl can use.
13367: The versioned directories started at 5.005.
13368pm_apiversion='5.005'
13369
693762b4
AD
13370: check for length of pointer
13371echo " "
13372case "$ptrsize" in
13373'')
49c10eea 13374 echo "Checking to see how big your pointers are..." >&4
693762b4
AD
13375 if test "$voidflags" -gt 7; then
13376 echo '#define VOID_PTR char *' > try.c
13377 else
13378 echo '#define VOID_PTR void *' > try.c
13379 fi
13380 $cat >>try.c <<'EOCP'
13381#include <stdio.h>
d674cd6d 13382int main()
693762b4 13383{
213c275f 13384 printf("%d\n", (int)sizeof(VOID_PTR));
14e4fe40 13385 exit(0);
693762b4
AD
13386}
13387EOCP
13388 set try
dc45a647 13389 if eval $compile_ok; then
693762b4 13390 ptrsize=`./try`
49c10eea 13391 echo "Your pointers are $ptrsize bytes long."
693762b4
AD
13392 else
13393 dflt='4'
13394 echo "(I can't seem to compile the test program. Guessing...)" >&4
13395 rp="What is the size of a pointer (in bytes)?"
13396 . ./myread
13397 ptrsize="$ans"
13398 fi
13399 ;;
13400esac
13401$rm -f try.c try
13402
a0d0e21e
LW
13403: see if ar generates random libraries by itself
13404echo " "
13405echo "Checking how to generate random libraries on your machine..." >&4
13406echo 'int bar1() { return bar2(); }' > bar1.c
13407echo 'int bar2() { return 2; }' > bar2.c
13408$cat > foo.c <<'EOP'
d674cd6d 13409int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
13410EOP
13411$cc $ccflags -c bar1.c >/dev/null 2>&1
13412$cc $ccflags -c bar2.c >/dev/null 2>&1
13413$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
13414$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13415if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 13416 ./foobar >/dev/null 2>&1; then
4e2a5f63 13417 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
13418 orderlib=false
13419 ranlib=":"
dfe9444c
AD
13420elif $ar ts bar$_a >/dev/null 2>&1 &&
13421 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 13422 ./foobar >/dev/null 2>&1; then
4e2a5f63 13423 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 13424 orderlib=false
dfe9444c 13425 ranlib="$ar ts"
a0d0e21e 13426else
ecfc5424
AD
13427 case "$ranlib" in
13428 :) ranlib='';;
13429 '')
13430 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13431 $test -f $ranlib || ranlib=''
13432 ;;
13433 esac
a0d0e21e 13434 if $test -n "$ranlib"; then
ecfc5424 13435 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
13436 orderlib=false
13437 else
13438 echo "your system doesn't seem to support random libraries"
13439 echo "so we'll use lorder and tsort to order the libraries."
13440 orderlib=true
13441 ranlib=":"
13442 fi
13443fi
13444$rm -f foo* bar*
13445
dfe9444c
AD
13446: check for type of arguments to select.
13447case "$selecttype" in
13448'') case "$d_select" in
13449 $define)
cce08f5b 13450 echo " "
dfe9444c
AD
13451 $cat <<EOM
13452Checking to see what type of arguments are accepted by select().
13453EOM
13454 hdrs="$define sys/types.h
13455 $i_systime sys/time.h
13456 $i_sysselct sys/select.h
13457 $d_socket sys/socket.h"
13458 : The first arg can be int, unsigned, or size_t
13459 : The last arg may or may not be 'const'
13460 val=''
7f3d1cf1
BH
13461 : void pointer has been seen but using that
13462 : breaks the selectminbits test
13463 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 13464 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
13465 for tmo in 'struct timeval *' 'const struct timeval *'; do
13466 case "$val" in
13467 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13468 if ./protochk "$try" $hdrs; then
13469 echo "Your system accepts $xxx."
13470 val="$xxx"
13471 fi
13472 ;;
13473 esac
13474 done
13475 done
13476 done
13477 case "$val" in
13478 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13479 case "$d_fd_set" in
13480 $define) dflt="fd_set *" ;;
13481 *) dflt="int *" ;;
13482 esac
13483 . ./myread
13484 val=$ans
13485 ;;
a0d0e21e 13486 esac
dfe9444c 13487 selecttype="$val"
a0d0e21e 13488 ;;
dfe9444c
AD
13489 *) : no select, so pick a harmless default
13490 selecttype='int *'
a0d0e21e
LW
13491 ;;
13492 esac
a0d0e21e
LW
13493 ;;
13494esac
2304df62 13495
5ff3f7a4
GS
13496: check for the select 'width'
13497case "$selectminbits" in
13498'') case "$d_select" in
13499 $define)
13500 $cat <<EOM
13501
85ab1d1d 13502Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
13503EOM
13504 $cat >try.c <<EOCP
13505#include <sys/types.h>
13506#$i_time I_TIME
13507#$i_systime I_SYS_TIME
13508#$i_systimek I_SYS_TIME_KERNEL
13509#ifdef I_TIME
13510# include <time.h>
13511#endif
13512#ifdef I_SYS_TIME
13513# ifdef I_SYS_TIME_KERNEL
13514# define KERNEL
13515# endif
13516# include <sys/time.h>
13517# ifdef I_SYS_TIME_KERNEL
13518# undef KERNEL
13519# endif
13520#endif
13521#$i_sysselct I_SYS_SELECT
13522#ifdef I_SYS_SELECT
13523#include <sys/select.h>
13524#endif
bd628c73
AD
13525#$d_socket HAS_SOCKET
13526#ifdef HAS_SOCKET
13527# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13528#endif
5ff3f7a4 13529#include <stdio.h>
fb164848
JH
13530$selecttype b;
13531#define S sizeof(*(b))
5ff3f7a4
GS
13532#define MINBITS 64
13533#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13534#define NBITS (NBYTES * 8)
13535int main() {
13536 char s[NBYTES];
5ff3f7a4
GS
13537 struct timeval t;
13538 int i;
13539 FILE* fp;
13540 int fd;
13541
13542 fclose(stdin);
13543 fp = fopen("try.c", "r");
13544 if (fp == 0)
13545 exit(1);
13546 fd = fileno(fp);
13547 if (fd < 0)
13548 exit(2);
13549 b = ($selecttype)s;
13550 for (i = 0; i < NBITS; i++)
13551 FD_SET(i, b);
13552 t.tv_sec = 0;
13553 t.tv_usec = 0;
13554 select(fd + 1, b, 0, 0, &t);
13555 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13556 printf("%d\n", i + 1);
13557 return 0;
13558}
13559EOCP
13560 set try
13561 if eval $compile_ok; then
13562 selectminbits=`./try`
85ab1d1d 13563 case "$selectminbits" in
fb164848
JH
13564 '') cat >&4 <<EOM
13565Cannot figure out on how many bits at a time your select() operates.
13566I'll play safe and guess it is 32 bits.
13567EOM
13568 selectminbits=32
13569 bits="32 bits"
13570 ;;
85ab1d1d
JH
13571 1) bits="1 bit" ;;
13572 *) bits="$selectminbits bits" ;;
13573 esac
13574 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
13575 else
13576 rp='What is the minimum number of bits your select() operates on?'
13577 case "$byteorder" in
13578 1234|12345678) dflt=32 ;;
13579 *) dflt=1 ;;
13580 esac
13581 . ./myread
13582 val=$ans
13583 selectminbits="$val"
13584 fi
13585 $rm -f try.* try
13586 ;;
13587 *) : no select, so pick a harmless default
13588 selectminbits='32'
13589 ;;
13590 esac
13591 ;;
13592esac
13593
8e07c86e
AD
13594: Trace out the files included by signal.h, then look for SIGxxx names.
13595: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
13596: Remove SIGSTKSIZE used by Linux.
13597: Remove SIGSTKSZ used by Posix.
4633a7c4 13598: Remove SIGTYP void lines used by OS2.
6764938d 13599: Some cpps, like os390, dont give the file name anywhere
53d4e464 13600if [ "X$fieldn" = X ]; then
6764938d
GS
13601 : Just make some guesses. We check them later.
13602 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
53d4e464 13603else
6764938d 13604 xxx=`echo '#include <signal.h>' |
8e07c86e
AD
13605 $cppstdin $cppminus $cppflags 2>/dev/null |
13606 $grep '^[ ]*#.*include' |
13607 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
53d4e464 13608fi
8e07c86e
AD
13609: Check this list of files to be sure we have parsed the cpp output ok.
13610: This will also avoid potentially non-existent files, such
13611: as ../foo/bar.h
13612xxxfiles=''
13613for xx in $xxx /dev/null ; do
13614 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13615done
13616: If we have found no files, at least try signal.h
13617case "$xxxfiles" in
13618'') xxxfiles=`./findhdr signal.h` ;;
13619esac
13620xxx=`awk '
af4c28eb 13621$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
13622 print substr($2, 4, 20)
13623}
4633a7c4 13624$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
13625 print substr($3, 4, 20)
13626}' $xxxfiles`
13627: Append some common names just in case the awk scan failed.
6764938d
GS
13628xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13629xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13630xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13631xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13632xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13633
8e07c86e 13634: generate a few handy files for later
dc45a647 13635$cat > signal.c <<'EOCP'
4633a7c4
LW
13636#include <sys/types.h>
13637#include <signal.h>
dc45a647 13638#include <stdio.h>
4633a7c4 13639int main() {
760ac839
LW
13640
13641/* Strange style to avoid deeply-nested #if/#else/#endif */
13642#ifndef NSIG
13643# ifdef _NSIG
13644# define NSIG (_NSIG)
13645# endif
13646#endif
13647
13648#ifndef NSIG
13649# ifdef SIGMAX
13650# define NSIG (SIGMAX+1)
13651# endif
13652#endif
13653
13654#ifndef NSIG
13655# ifdef SIG_MAX
13656# define NSIG (SIG_MAX+1)
13657# endif
13658#endif
13659
13660#ifndef NSIG
13661# ifdef MAXSIG
13662# define NSIG (MAXSIG+1)
13663# endif
4633a7c4 13664#endif
760ac839
LW
13665
13666#ifndef NSIG
13667# ifdef MAX_SIG
13668# define NSIG (MAX_SIG+1)
13669# endif
13670#endif
13671
13672#ifndef NSIG
13673# ifdef SIGARRAYSIZE
13674# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13675# endif
13676#endif
13677
13678#ifndef NSIG
13679# ifdef _sys_nsig
13680# define NSIG (_sys_nsig) /* Solaris 2.5 */
13681# endif
13682#endif
13683
13684/* Default to some arbitrary number that's big enough to get most
13685 of the common signals.
13686*/
13687#ifndef NSIG
13688# define NSIG 50
4633a7c4 13689#endif
760ac839
LW
13690
13691printf("NSIG %d\n", NSIG);
13692
dc45a647
MB
13693#ifndef JUST_NSIG
13694
13695EOCP
13696
28e8609d 13697echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
13698{
13699 printf "#ifdef SIG"; printf $1; printf "\n"
13700 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13701 printf $1; printf ");\n"
13702 printf "#endif\n"
2304df62 13703}
2304df62 13704END {
dc45a647 13705 printf "#endif /* JUST_NSIG */\n";
14e4fe40 13706 printf "exit(0);\n}\n";
2304df62 13707}
4633a7c4
LW
13708' >>signal.c
13709$cat >signal.awk <<'EOP'
13710BEGIN { ndups = 0 }
13711$1 ~ /^NSIG$/ { nsig = $2 }
13712($1 !~ /^NSIG$/) && (NF == 2) {
13713 if ($2 > maxsig) { maxsig = $2 }
13714 if (sig_name[$2]) {
13715 dup_name[ndups] = $1
13716 dup_num[ndups] = $2
13717 ndups++
13718 }
13719 else {
13720 sig_name[$2] = $1
13721 sig_num[$2] = $2
13722 }
4633a7c4
LW
13723}
13724END {
af4c28eb
CS
13725 if (nsig == 0) {
13726 nsig = maxsig + 1
13727 }
13728 printf("NSIG %d\n", nsig);
13729 for (n = 1; n < nsig; n++) {
13730 if (sig_name[n]) {
13731 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 13732 }
af4c28eb
CS
13733 else {
13734 printf("NUM%d %d\n", n, n)
13735 }
13736 }
4633a7c4 13737 for (n = 0; n < ndups; n++) {
af4c28eb 13738 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
13739 }
13740}
13741EOP
13742$cat >signal_cmd <<EOS
8e07c86e 13743$startsh
dc45a647
MB
13744if $test -s signal.lst; then
13745 echo "Using your existing signal.lst file"
13746 exit 0
13747fi
13748xxx="$xxx"
13749EOS
13750$cat >>signal_cmd <<'EOS'
13751
13752set signal
13753if eval $compile_ok; then
dfe9444c 13754 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 13755else
dc45a647
MB
13756 echo "(I can't seem be able to compile the whole test program)" >&4
13757 echo "(I'll try it in little pieces.)" >&4
13758 set signal -DJUST_NSIG
13759 if eval $compile_ok; then
13760 ./signal$_exe > signal.nsg
13761 $cat signal.nsg
13762 else
13763 echo "I can't seem to figure out how many signals you have." >&4
13764 echo "Guessing 50." >&4
13765 echo 'NSIG 50' > signal.nsg
13766 fi
13767 : Now look at all the signal names, one at a time.
28e8609d 13768 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
13769 $cat > signal.c <<EOCP
13770#include <sys/types.h>
13771#include <signal.h>
13772#include <stdio.h>
13773int main() {
13774printf("$xx %d\n", SIG${xx});
13775return 0;
13776}
13777EOCP
13778 set signal
13779 if eval $compile; then
13780 echo "SIG${xx} found."
13781 ./signal$_exe >> signal.ls1
13782 else
13783 echo "SIG${xx} NOT found."
13784 fi
13785 done
13786 if $test -s signal.ls1; then
13787 $cat signal.nsg signal.ls1 |
13788 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13789 fi
13790
13791fi
13792if $test -s signal.lst; then
13793 :
13794else
13795 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 13796 echo 'kill -l' >signal
dc45a647 13797 set X `csh -f <signal`
8e07c86e 13798 $rm -f signal
2304df62 13799 shift
dc45a647 13800 case $# in
8e07c86e 13801 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 13802 esac
28e8609d 13803 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
13804 $awk '{ printf "%s %d\n", $1, ++s; }
13805 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 13806fi
dc45a647 13807$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 13808EOS
4633a7c4
LW
13809chmod a+x signal_cmd
13810$eunicefix signal_cmd
8e07c86e
AD
13811
13812: generate list of signal names
13813echo " "
dfe9444c 13814case "$sig_name_init" in
6626bf4c
JH
13815'') doinit=yes ;;
13816*) case "$sig_num_init" in
13817 ''|*,*) doinit=yes ;;
13818 esac ;;
13819esac
13820case "$doinit" in
13821yes)
4633a7c4 13822 echo "Generating a list of signal names and numbers..." >&4
dc45a647 13823 . ./signal_cmd
af4c28eb
CS
13824 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13825 sig_name=`$awk 'BEGIN { printf "ZERO " }
13826 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13827 sig_num=`$awk 'BEGIN { printf "0 " }
13828 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13829 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
13830 !/^NSIG/ { printf "\"%s\", ", $1 }
13831 END { printf "0\n" }' signal.lst`
13832 sig_num_init=`$awk 'BEGIN { printf "0, " }
13833 !/^NSIG/ { printf "%d, ", $2}
13834 END { printf "0\n"}' signal.lst`
13835 ;;
13836esac
13837echo "The following $sig_count signals are available:"
a0d0e21e
LW
13838echo " "
13839echo $sig_name | $awk \
13840'BEGIN { linelen = 0 }
13841{
8e07c86e 13842 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
13843 name = "SIG" $i " "
13844 linelen = linelen + length(name)
13845 if (linelen > 70) {
13846 printf "\n"
13847 linelen = length(name)
13848 }
13849 printf "%s", name
13850 }
8e07c86e 13851 printf "\n"
a0d0e21e 13852}'
4633a7c4 13853$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 13854
8c99d73e
GS
13855echo " "
13856case "$sizetype" in
13857*_t) zzz="$sizetype" ;;
13858*) zzz="filesize" ;;
13859esac
13860echo "Checking the size of $zzz..." >&4
13861cat > try.c <<EOCP
13862#include <sys/types.h>
13863#include <stdio.h>
13864int main() {
13865 printf("%d\n", (int)sizeof($sizetype));
13866 exit(0);
13867}
13868EOCP
13869set try
13870if eval $compile_ok; then
13871 yyy=`./try`
13872 case "$yyy" in
13873 '') sizesize=4
13874 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13875 ;;
13876 *) sizesize=$yyy
13877 echo "Your $zzz size is $sizesize bytes."
13878 ;;
13879 esac
13880else
13881 sizesize=4
13882 echo "(I can't compile the test program--guessing $sizesize.)" >&4
13883fi
13884
13885
c890dc6c
JH
13886: check for socklen_t
13887echo " "
13888echo "Checking to see if you have socklen_t..." >&4
13889$cat >try.c <<EOCP
13890#include <sys/types.h>
13891#$d_socket HAS_SOCKET
13892#ifdef HAS_SOCKET
13893#include <sys/socket.h>
13894#endif
13895int main() { socklen_t x = 16; }
13896EOCP
13897set try
13898if eval $compile; then
13899 val="$define"
13900 echo "You have socklen_t."
13901else
13902 val="$undef"
13903 echo "You do not have socklen_t."
13904 case "$sizetype" in
8c99d73e 13905 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
c890dc6c
JH
13906 esac
13907fi
13908$rm -f try try.*
13909set d_socklen_t
13910eval $setvar
13911
13912: check for type of the size argument to socket calls
13913case "$d_socket" in
13914"$define")
13915 $cat <<EOM
13916
13917Checking to see what type is the last argument of accept().
13918EOM
13919 hdrs="$define sys/types.h $d_socket sys/socket.h"
13920 yyy=''
13921 case "$d_socklen_t" in
13922 "$define") yyy="$yyy socklen_t"
13923 esac
6c85e8b0 13924 yyy="$yyy $sizetype int long unsigned"
c890dc6c
JH
13925 for xxx in $yyy; do
13926 case "$socksizetype" in
13927 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
13928 if ./protochk "$try" $hdrs; then
13929 echo "Your system accepts '$xxx *' for the last argument of accept()."
10cc9d2a 13930 socksizetype="$xxx"
c890dc6c
JH
13931 fi
13932 ;;
13933 esac
13934 done
13935: In case none of those worked, prompt the user.
13936 case "$socksizetype" in
4f309e22 13937 '') rp='What is the type for socket address structure sizes?'
10cc9d2a 13938 dflt='int'
c890dc6c
JH
13939 . ./myread
13940 socksizetype=$ans
13941 ;;
13942 esac
13943 ;;
6c85e8b0
JH
13944*) : no sockets, so pick relatively harmless default
13945 socksizetype='int'
c890dc6c
JH
13946 ;;
13947esac
13948
a0d0e21e
LW
13949: see what type is used for signed size_t
13950set ssize_t ssizetype int stdio.h sys/types.h
13951eval $typedef
13952dflt="$ssizetype"
13953$cat > ssize.c <<EOM
13954#include <stdio.h>
13955#include <sys/types.h>
13956#define Size_t $sizetype
13957#define SSize_t $dflt
d674cd6d 13958int main()
a0d0e21e
LW
13959{
13960 if (sizeof(Size_t) == sizeof(SSize_t))
13961 printf("$dflt\n");
13962 else if (sizeof(Size_t) == sizeof(int))
13963 printf("int\n");
13964 else
13965 printf("long\n");
760ac839 13966 exit(0);
a0d0e21e
LW
13967}
13968EOM
13969echo " "
dfe9444c 13970set ssize
dc45a647 13971if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 13972 ssizetype=`./ssize`
a0d0e21e
LW
13973 echo "I'll be using $ssizetype for functions returning a byte count." >&4
13974else
24fef2a7 13975 $cat >&4 <<EOM
24fef2a7
AD
13976Help! I can't compile and run the ssize_t test program: please enlighten me!
13977(This is probably a misconfiguration in your system or libraries, and
13978you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
13979
13980I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 13981be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
13982
13983EOM
13984 rp="What signed type is the same size as $sizetype?"
13985 . ./myread
13986 ssizetype="$ans"
13987fi
dfe9444c 13988$rm -f ssize ssize.*
3fd537d4 13989
a0d0e21e
LW
13990: see what type of char stdio uses.
13991echo " "
13992if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13993 echo "Your stdio uses unsigned chars." >&4
13994 stdchar="unsigned char"
13995else
13996 echo "Your stdio uses signed chars." >&4
13997 stdchar="char"
13998fi
13999
14000: see if time exists
14001echo " "
28e8609d
JH
14002if test "X$d_time" = X -o X"$timetype" = X; then
14003 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
14004 echo 'time() found.' >&4
14005 val="$define"
14006 rp="What is the type returned by time() on this system?"
14007 set time_t timetype long stdio.h sys/types.h
14008 eval $typedef_ask
28e8609d 14009 else
5ff3f7a4
GS
14010 echo 'time() not found, hope that will do.' >&4
14011 val="$undef"
14012 timetype='int';
28e8609d
JH
14013 fi
14014 set d_time
14015 eval $setvar
a0d0e21e 14016fi
a0d0e21e
LW
14017
14018: see what type uids are declared as in the kernel
dc45a647
MB
14019echo " "
14020echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
14021set uid_t uidtype xxx stdio.h sys/types.h
14022eval $typedef
14023case "$uidtype" in
14024xxx)
14025 xxx=`./findhdr sys/user.h`
14026 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14027 case $1 in
14028 unsigned) dflt="$1 $2" ;;
14029 *) dflt="$1" ;;
14030 esac
14031 ;;
4633a7c4
LW
14032*) dflt="$uidtype";;
14033esac
dc45a647
MB
14034case "$uidtype" in
14035uid_t) echo "uid_t found." ;;
14036*) rp="What is the type for user ids returned by getuid()?"
14037 . ./myread
14038 uidtype="$ans"
14039 ;;
14040esac
4633a7c4 14041
57def98f
JH
14042echo " "
14043case "$uidtype" in
14044*_t) zzz="$uidtype" ;;
14045*) zzz="uid" ;;
14046esac
a22e52b9 14047echo "Checking the size of $zzz..." >&4
57def98f
JH
14048cat > try.c <<EOCP
14049#include <sys/types.h>
14050#include <stdio.h>
14051int main() {
213c275f 14052 printf("%d\n", (int)sizeof($uidtype));
14e4fe40 14053 exit(0);
57def98f
JH
14054}
14055EOCP
d4265146 14056set try
a22e52b9 14057if eval $compile_ok; then
57def98f
JH
14058 yyy=`./try`
14059 case "$yyy" in
a22e52b9
JH
14060 '') uidsize=4
14061 echo "(I can't execute the test program--guessing $uidsize.)" >&4
57def98f 14062 ;;
a22e52b9 14063 *) uidsize=$yyy
49c10eea 14064 echo "Your $zzz is $uidsize bytes long."
57def98f
JH
14065 ;;
14066 esac
14067else
a22e52b9
JH
14068 uidsize=4
14069 echo "(I can't compile the test program--guessing $uidsize.)" >&4
57def98f
JH
14070fi
14071
785fb66b
JH
14072echo " "
14073case "$uidtype" in
14074*_t) zzz="$uidtype" ;;
14075*) zzz="uid" ;;
14076esac
a22e52b9 14077echo "Checking the sign of $zzz..." >&4
785fb66b
JH
14078cat > try.c <<EOCP
14079#include <sys/types.h>
14080#include <stdio.h>
14081int main() {
a22e52b9
JH
14082 $uidtype foo = -1;
14083 if (foo < 0)
14084 printf("-1\n");
14085 else
14086 printf("1\n");
785fb66b
JH
14087}
14088EOCP
14089set try
a22e52b9 14090if eval $compile; then
785fb66b
JH
14091 yyy=`./try`
14092 case "$yyy" in
a22e52b9
JH
14093 '') uidsign=1
14094 echo "(I can't execute the test program--guessing unsigned.)" >&4
785fb66b 14095 ;;
a22e52b9
JH
14096 *) uidsign=$yyy
14097 case "$uidsign" in
14098 1) echo "Your $zzz is unsigned." ;;
14099 -1) echo "Your $zzz is signed." ;;
14100 esac
785fb66b
JH
14101 ;;
14102 esac
14103else
a22e52b9
JH
14104 uidsign=1
14105 echo "(I can't compile the test program--guessing unsigned.)" >&4
785fb66b
JH
14106fi
14107
a22e52b9
JH
14108
14109
14110echo " "
14111$echo "Checking the format string to be used for uids..." >&4
14112
14113case "$uidsign" in
14114-1) if $test X"$uidsize" = X"$ivsize"; then
14115 uidformat="$ivdformat"
14116 else
14117 if $test X"$uidsize" = X"$longsize"; then
14118 uidformat='"ld"'
14119 else
14120 if $test X"$uidsize" = X"$intsize"; then
14121 uidformat='"d"'
14122 else
14123 if $test X"$uidsize" = X"$shortsize"; then
14124 uidformat='"hd"'
14125 fi
14126 fi
14127 fi
14128 fi
14129 ;;
14130*) if $test X"$uidsize" = X"$uvsize"; then
14131 uidformat="$uvuformat"
14132 else
14133 if $test X"$uidsize" = X"$longsize"; then
14134 uidformat='"lu"'
14135 else
14136 if $test X"$uidsize" = X"$intsize"; then
14137 uidformat='"u"'
14138 else
14139 if $test X"$uidsize" = X"$shortsize"; then
14140 uidformat='"hu"'
14141 fi
14142 fi
14143 fi
14144 fi
14145 ;;
14146esac
14147
4633a7c4
LW
14148: see if dbm.h is available
14149: see if dbmclose exists
14150set dbmclose d_dbmclose
14151eval $inlibc
14152
14153case "$d_dbmclose" in
14154$define)
14155 set dbm.h i_dbm
14156 eval $inhdr
5f80c64f
JH
14157 case "$i_dbm" in
14158 $define)
14159 val="$undef"
14160 set i_rpcsvcdbm
14161 eval $setvar
14162 ;;
14163 *) set rpcsvc/dbm.h i_rpcsvcdbm
14164 eval $inhdr
14165 ;;
14166 esac
14167 ;;
14168*) echo "We won't be including <dbm.h>"
14169 val="$undef"
14170 set i_dbm
14171 eval $setvar
14172 val="$undef"
14173 set i_rpcsvcdbm
14174 eval $setvar
14175 ;;
14176esac
14177
14178: see if this is a sys/file.h system
14179val=''
14180set sys/file.h val
14181eval $inhdr
14182
14183: do we need to include sys/file.h ?
14184case "$val" in
14185"$define")
14186 echo " "
14187 if $h_sysfile; then
14188 val="$define"
14189 echo "We'll be including <sys/file.h>." >&4
14190 else
14191 val="$undef"
14192 echo "We won't be including <sys/file.h>." >&4
14193 fi
14194 ;;
14195*)
14196 h_sysfile=false
14197 ;;
14198esac
14199set i_sysfile
14200eval $setvar
14201
14202: see if fcntl.h is there
14203val=''
14204set fcntl.h val
14205eval $inhdr
14206
14207: see if we can include fcntl.h
14208case "$val" in
14209"$define")
14210 echo " "
14211 if $h_fcntl; then
14212 val="$define"
14213 echo "We'll be including <fcntl.h>." >&4
14214 else
14215 val="$undef"
14216 if $h_sysfile; then
14217 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14218 else
14219 echo "We won't be including <fcntl.h>." >&4
14220 fi
14221 fi
14222 ;;
14223*)
14224 h_fcntl=false
14225 val="$undef"
14226 ;;
14227esac
14228set i_fcntl
14229eval $setvar
14230
43999f95
JH
14231: see if this is a iconv.h system
14232set iconv.h i_iconv
14233eval $inhdr
14234
792d8dab
JH
14235: see if this is a ieeefp.h system
14236set ieeefp.h i_ieeefp
14237eval $inhdr
14238
5f80c64f
JH
14239: see if locale.h is available
14240set locale.h i_locale
14241eval $inhdr
14242
7f3d1cf1 14243: see if mach cthreads are available
13666627
JH
14244if test "X$usethreads" = "X$define"; then
14245 set mach/cthreads.h i_machcthr
14246 eval $inhdr
14247else
14248 i_machcthr="$undef"
14249fi
14250
14251
7f3d1cf1 14252
5f80c64f
JH
14253: see if this is a math.h system
14254set math.h i_math
14255eval $inhdr
14256
e7fb4fcc
JH
14257: see if this is a mntent.h system
14258set mntent.h i_mntent
14259eval $inhdr
14260
5f80c64f
JH
14261: see if ndbm.h is available
14262set ndbm.h t_ndbm
14263eval $inhdr
14264case "$t_ndbm" in
14265$define)
14266 : see if dbm_open exists
14267 set dbm_open d_dbm_open
14268 eval $inlibc
14269 case "$d_dbm_open" in
14270 $undef)
14271 t_ndbm="$undef"
14272 echo "We won't be including <ndbm.h>"
14273 ;;
14274 esac
14275 ;;
14276esac
14277val="$t_ndbm"
14278set i_ndbm
14279eval $setvar
14280
14281: see if net/errno.h is available
14282val=''
14283set net/errno.h val
14284eval $inhdr
14285
14286: Unfortunately, it causes problems on some systems. Arrgh.
14287case "$val" in
14288$define)
14289 cat > try.c <<'EOM'
14290#include <stdio.h>
14291#include <errno.h>
14292#include <net/errno.h>
14293int func()
14294{
14295 return ENOTSOCK;
14296}
14297EOM
14298 if $cc $ccflags -c try.c >/dev/null 2>&1; then
14299 echo "We'll be including <net/errno.h>." >&4
14300 else
14301 echo "We won't be including <net/errno.h>." >&4
14302 val="$undef"
14303 fi
14304 $rm -f try.* try
14305 ;;
14306esac
14307set i_neterrno
14308eval $setvar
14309
9cc6feab
JH
14310: see if netinet/tcp.h is available
14311set netinet/tcp.h i_netinettcp
14312eval $inhdr
14313
5b34fd99
JH
14314: see if this is a poll.h system
14315set poll.h i_poll
14316eval $inhdr
14317
5f80c64f 14318echo " "
78691af5 14319$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
43999f95
JH
14320$cat <<'EOSH' > Cppsym.know
14321a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14322AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14323alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14324ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14325BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14326BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14327bull c cadmus clipper CMU COFF COMPILER_VERSION
14328concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14329CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14330Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14331FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14332GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14333H3050R H3050RX hbullx20 hcx host_mips
14334hp200 hp300 hp700 HP700 hp800 hp9000
14335hp9000s200 hp9000s300 hp9000s400 hp9000s500
14336hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14337i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14338iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14339INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14340LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14341LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14342Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14343LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14344M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14345M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14346M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14347MATH_HAS_NO_SIDE_EFFECTS
14348mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14349mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14350mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14351MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14352mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14353NetBSD news1500 news1700 news1800 news1900 news3700
14354news700 news800 news900 NeXT NLS ns16000 ns32000
14355ns32016 ns32332 ns32k nsc32000
14356OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14357pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14358pc532 pdp11 PGC PIC plexus PORTAR posix
14359POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14360POSIX_C_SOURCE POSIX_SOURCE POWER
14361PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14362riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14363SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14364sony sony_news sonyrisc sparc sparclite spectrum
14365stardent stdc STDC_EXT stratos sun sun3 sun386
14366Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14367SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14368SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14369sysV68 sysV88 Tek4132 Tek4300 titan
14370tower tower32 tower32_200 tower32_600 tower32_700
14371tower32_800 tower32_850 tss
14372u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14373ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14374unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14375Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14376XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14377XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14378z8000
14379EOSH
14380# Maybe put other stuff here too.
14381cat <<EOSH >>Cppsym.know
14382$osname
14383EOSH
9b97abf7
JH
14384./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14385./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
43999f95
JH
14386$cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14387$rm -f Cppsym.a Cppsym.b
14388cat <<EOSH > Cppsym
5f80c64f 14389$startsh
43999f95
JH
14390if $test \$# -gt 0; then
14391 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14392 if $test -s Cppsym.got; then
14393 $rm -f Cppsym.got
14394 exit 0
14395 fi
14396 $rm -f Cppsym.got
14397 exit 1
14398else
14399 $tr " " "$trnl" | ./Cppsym.try
14400 exit 0
14401fi
14402EOSH
5f80c64f
JH
14403chmod +x Cppsym
14404$eunicefix Cppsym
43999f95
JH
14405cat <<EOSH > Cppsym.try
14406$startsh
14407cat <<'EOCP' > try.c
14408#include <stdio.h>
14409int main() {
14410EOCP
14411$awk \\
14412EOSH
14413cat <<'EOSH' >> Cppsym.try
14414'length($1) > 0 {
14415 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14416 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14417 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14418 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14419}' >> try.c
14420echo '}' >> try.c
14421EOSH
14422cat <<EOSH >> Cppsym.try
43999f95 14423ccflags="$ccflags"
a3489f11
JH
14424case "$osname-$gccversion" in
14425irix-) ccflags="\$ccflags -woff 1178" ;;
14426esac
14427$cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
43999f95
JH
14428EOSH
14429chmod +x Cppsym.try
14430$eunicefix Cppsym.try
14431./Cppsym < Cppsym.know > Cppsym.true
5f80c64f 14432: now check the C compiler for additional symbols
c4747d3e
JH
14433postprocess_cc_v=''
14434case "$osname" in
14435aix) postprocess_cc_v="|$tr , ' '" ;;
14436esac
5f80c64f
JH
14437$cat >ccsym <<EOS
14438$startsh
14439$cat >tmp.c <<EOF
14440extern int foo;
14441EOF
c4747d3e 14442for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
14443do
14444 case "\$i" in
14445 -D*) echo "\$i" | $sed 's/^-D//';;
14446 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14447 esac
14448done
14449$rm -f try.c
14450EOS
2000072c 14451postprocess_cc_v=''
5f80c64f
JH
14452chmod +x ccsym
14453$eunicefix ccsym
14454./ccsym > ccsym1.raw
14455if $test -s ccsym1.raw; then
14456 $sort ccsym1.raw | $uniq >ccsym.raw
14457else
14458 mv ccsym1.raw ccsym.raw
14459fi
14460
14461$awk '/\=/ { print $0; next }
14462 { print $0"=1" }' ccsym.raw >ccsym.list
43999f95
JH
14463$awk '/\=/ { print $0; next }
14464 { print $0"=1" }' Cppsym.true >ccsym.true
5f80c64f
JH
14465$comm -13 ccsym.true ccsym.list >ccsym.own
14466$comm -12 ccsym.true ccsym.list >ccsym.com
14467$comm -23 ccsym.true ccsym.list >ccsym.cpp
14468also=''
5f80c64f 14469if $test -z ccsym.raw; then
ff49bff8 14470 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 14471 echo " "
ff49bff8 14472 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 14473 $cat Cppsym.true
ff49bff8
JH
14474 ccsymbols=''
14475 cppsymbols=`$cat Cppsym.true`
918c3d21 14476 cppsymbols=`echo $cppsymbols`
ff49bff8 14477 cppccsymbols="$cppsymbols"
5f80c64f
JH
14478else
14479 if $test -s ccsym.com; then
14480 echo "Your C compiler and pre-processor define these symbols:"
14481 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14482 also='also '
14483 symbols='ones'
ff49bff8 14484 cppccsymbols=`$cat ccsym.com`
918c3d21 14485 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
14486 $test "$silent" || sleep 1
14487 fi
14488 if $test -s ccsym.cpp; then
14489 $test "$also" && echo " "
ff49bff8 14490 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
14491 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14492 also='further '
ff49bff8 14493 cppsymbols=`$cat ccsym.cpp`
918c3d21 14494 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
14495 $test "$silent" || sleep 1
14496 fi
14497 if $test -s ccsym.own; then
14498 $test "$also" && echo " "
ff49bff8 14499 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
14500 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14501 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 14502 ccsymbols=`$cat ccsym.own`
918c3d21 14503 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
14504 $test "$silent" || sleep 1
14505 fi
14506fi
14507$rm -f ccsym*
14508
14509: see if this is a termio system
14510val="$undef"
14511val2="$undef"
14512val3="$undef"
14513if $test `./findhdr termios.h`; then
14514 set tcsetattr i_termios
14515 eval $inlibc
14516 val3="$i_termios"
14517fi
14518echo " "
14519case "$val3" in
14520"$define") echo "You have POSIX termios.h... good!" >&4;;
14521*) if ./Cppsym pyr; then
14522 case "`/bin/universe`" in
14523 ucb) if $test `./findhdr sgtty.h`; then
14524 val2="$define"
14525 echo "<sgtty.h> found." >&4
14526 else
14527 echo "System is pyramid with BSD universe."
14528 echo "<sgtty.h> not found--you could have problems." >&4
14529 fi;;
14530 *) if $test `./findhdr termio.h`; then
14531 val="$define"
14532 echo "<termio.h> found." >&4
14533 else
14534 echo "System is pyramid with USG universe."
14535 echo "<termio.h> not found--you could have problems." >&4
14536 fi;;
14537 esac
14538 elif ./usg; then
14539 if $test `./findhdr termio.h`; then
14540 echo "<termio.h> found." >&4
14541 val="$define"
14542 elif $test `./findhdr sgtty.h`; then
14543 echo "<sgtty.h> found." >&4
14544 val2="$define"
14545 else
14546echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14547 fi
14548 else
14549 if $test `./findhdr sgtty.h`; then
14550 echo "<sgtty.h> found." >&4
14551 val2="$define"
14552 elif $test `./findhdr termio.h`; then
14553 echo "<termio.h> found." >&4
14554 val="$define"
14555 else
14556echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14557 fi
14558 fi;;
14559esac
14560set i_termio; eval $setvar
14561val=$val2; set i_sgtty; eval $setvar
14562val=$val3; set i_termios; eval $setvar
14563
f1066039
JH
14564: see if this is a shadow.h system
14565set shadow.h i_shadow
14566eval $inhdr
14567
86959918
JH
14568: see if this is a socks.h system
14569set socks.h i_socks
14570eval $inhdr
14571
5f80c64f
JH
14572: see if stdarg is available
14573echo " "
14574if $test `./findhdr stdarg.h`; then
14575 echo "<stdarg.h> found." >&4
14576 valstd="$define"
14577else
14578 echo "<stdarg.h> NOT found." >&4
14579 valstd="$undef"
14580fi
14581
14582: see if varags is available
14583echo " "
14584if $test `./findhdr varargs.h`; then
14585 echo "<varargs.h> found." >&4
14586else
14587 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14588fi
14589
14590: set up the varargs testing programs
14591$cat > varargs.c <<EOP
14592#ifdef I_STDARG
14593#include <stdarg.h>
14594#endif
14595#ifdef I_VARARGS
14596#include <varargs.h>
14597#endif
14598
14599#ifdef I_STDARG
14600int f(char *p, ...)
14601#else
14602int f(va_alist)
14603va_dcl
14604#endif
14605{
14606 va_list ap;
14607#ifndef I_STDARG
14608 char *p;
14609#endif
14610#ifdef I_STDARG
14611 va_start(ap,p);
14612#else
14613 va_start(ap);
14614 p = va_arg(ap, char *);
14615#endif
14616 va_end(ap);
14617}
14618EOP
14619$cat > varargs <<EOP
14620$startsh
14621if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14622 echo "true"
14623else
14624 echo "false"
14625fi
14626$rm -f varargs$_o
14627EOP
14628chmod +x varargs
14629
14630: now check which varargs header should be included
14631echo " "
14632i_varhdr=''
14633case "$valstd" in
14634"$define")
14635 if `./varargs I_STDARG`; then
14636 val='stdarg.h'
14637 elif `./varargs I_VARARGS`; then
14638 val='varargs.h'
14639 fi
14640 ;;
14641*)
14642 if `./varargs I_VARARGS`; then
14643 val='varargs.h'
14644 fi
14645 ;;
14646esac
14647case "$val" in
14648'')
14649echo "I could not find the definition for va_dcl... You have problems..." >&4
14650 val="$undef"; set i_stdarg; eval $setvar
14651 val="$undef"; set i_varargs; eval $setvar
14652 ;;
14653*)
14654 set i_varhdr
14655 eval $setvar
14656 case "$i_varhdr" in
14657 stdarg.h)
14658 val="$define"; set i_stdarg; eval $setvar
14659 val="$undef"; set i_varargs; eval $setvar
14660 ;;
14661 varargs.h)
14662 val="$undef"; set i_stdarg; eval $setvar
14663 val="$define"; set i_varargs; eval $setvar
14664 ;;
14665 esac
14666 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14667esac
14668$rm -f varargs*
14669
14670: see if stddef is available
14671set stddef.h i_stddef
14672eval $inhdr
14673
923fc586
JH
14674: see if this is a sunmath.h system
14675set sunmath.h i_sunmath
14676eval $inhdr
14677
5f80c64f
JH
14678: see if sys/access.h is available
14679set sys/access.h i_sysaccess
14680eval $inhdr
14681
14682: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14683set sys/filio.h i_sysfilio
14684eval $inhdr
14685echo " "
14686if $test `./findhdr sys/ioctl.h`; then
14687 val="$define"
14688 echo '<sys/ioctl.h> found.' >&4
14689else
14690 val="$undef"
14691 if $test $i_sysfilio = "$define"; then
14692 echo '<sys/ioctl.h> NOT found.' >&4
14693 else
14694 $test $i_sgtty = "$define" && xxx="sgtty.h"
14695 $test $i_termio = "$define" && xxx="termio.h"
14696 $test $i_termios = "$define" && xxx="termios.h"
14697echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14698 fi
14699fi
14700set i_sysioctl
14701eval $setvar
14702
ca52efda
JH
14703
14704: see if this is a syslog.h system
14705set syslog.h i_syslog
14706eval $inhdr
14707
bf0c440f
JH
14708
14709: see if this is a sys/mode.h system
14710set sys/mode.h i_sysmode
14711eval $inhdr
14712
5f80c64f
JH
14713: see if sys/resource.h has to be included
14714set sys/resource.h i_sysresrc
14715eval $inhdr
14716
14717: see if sys/security.h is available
14718set sys/security.h i_syssecrt
14719eval $inhdr
14720
104d25b7
JH
14721: see if this is a sys/statvfs.h system
14722set sys/statvfs.h i_sysstatvfs
14723eval $inhdr
14724
b7b35fc2
JH
14725: see if this is a sys/uio.h system
14726set sys/uio.h i_sysuio
14727eval $inhdr
14728
5f80c64f
JH
14729: see if this is a sys/un.h system
14730set sys/un.h i_sysun
14731eval $inhdr
14732
d4935d7f
JH
14733
14734: see if this is a sys/utsname.h system
14735set sys/utsname.h i_sysutsname
14736eval $inhdr
14737
5f80c64f
JH
14738: see if this is a syswait system
14739set sys/wait.h i_syswait
14740eval $inhdr
14741
0545a864
JH
14742: see if this is a ustat.h system
14743set ustat.h i_ustat
14744eval $inhdr
14745
5f80c64f
JH
14746: see if this is an utime system
14747set utime.h i_utime
14748eval $inhdr
14749
14750: see if this is a values.h system
14751set values.h i_values
14752eval $inhdr
14753
14754: see if this is a vfork system
14755case "$d_vfork" in
14756"$define")
14757 set vfork.h i_vfork
14758 eval $inhdr
14759 ;;
14760*)
14761 i_vfork="$undef"
14762 ;;
14763esac
14764
14765: see if gdbm.h is available
14766set gdbm.h t_gdbm
14767eval $inhdr
14768case "$t_gdbm" in
14769$define)
14770 : see if gdbm_open exists
14771 set gdbm_open d_gdbm_open
14772 eval $inlibc
14773 case "$d_gdbm_open" in
14774 $undef)
14775 t_gdbm="$undef"
14776 echo "We won't be including <gdbm.h>"
14777 ;;
14778 esac
14779 ;;
14780esac
14781val="$t_gdbm"
14782set i_gdbm
14783eval $setvar
14784
14785echo " "
14786echo "Looking for extensions..." >&4
5f80c64f
JH
14787: If we are using the old config.sh, known_extensions may contain
14788: old or inaccurate or duplicate values.
14789known_extensions=''
14790nonxs_extensions=''
14791: We do not use find because it might not be available.
14792: We do not just use MANIFEST because the user may have dropped
14793: some additional extensions into the source tree and expect them
14794: to be built.
7e791ca9
NK
14795
14796: Function to recursively find available extensions, ignoring DynaLoader
14797: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14798find_extensions='
14799 for xxx in *; do
14800 case "$xxx" in
14801 DynaLoader|dynaload) ;;
14802 *)
14803 if $test -f $xxx/$xxx.xs; then
14804 known_extensions="$known_extensions $1$xxx";
14805 elif $test -f $xxx/Makefile.PL; then
14806 nonxs_extensions="$nonxs_extensions $1$xxx";
14807 else
14808 if $test -d $xxx -a $# -lt 10; then
14809 set $1$xxx/ $*;
14810 cd $xxx;
14811 eval $find_extensions;
14812 cd ..;
14813 shift;
9f50e519 14814 fi;
7e791ca9
NK
14815 fi
14816 ;;
9f50e519 14817 esac;
7e791ca9
NK
14818 done'
14819tdir=`pwd`
14820cd $rsrc/ext
a3635516 14821set X
efdb23e1 14822shift
7e791ca9 14823eval $find_extensions
5f80c64f
JH
14824set X $nonxs_extensions
14825shift
14826nonxs_extensions="$*"
14827set X $known_extensions
14828shift
14829known_extensions="$*"
14830cd $tdir
14831
14832: Now see which are supported on this system.
14833avail_ext=''
14834for xxx in $known_extensions ; do
14835 case "$xxx" in
14836 DB_File|db_file)
14837 case "$i_db" in
14838 $define) avail_ext="$avail_ext $xxx" ;;
14839 esac
14840 ;;
14841 GDBM_File|gdbm_fil)
14842 case "$i_gdbm" in
14843 $define) avail_ext="$avail_ext $xxx" ;;
14844 esac
14845 ;;
14846 NDBM_File|ndbm_fil)
14847 case "$i_ndbm" in
f7dd4e7f 14848 $define)
10cc9d2a 14849 case "$osname-$use64bitint" in
f7dd4e7f
JH
14850 hpux-define)
14851 case "$libs" in
14852 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14853 esac
14854 ;;
14855 *) avail_ext="$avail_ext $xxx" ;;
14856 esac
14857 ;;
5f80c64f
JH
14858 esac
14859 ;;
14860 ODBM_File|odbm_fil)
14861 case "${i_dbm}${i_rpcsvcdbm}" in
f7dd4e7f 14862 *"${define}"*)
10cc9d2a 14863 case "$osname-$use64bitint" in
f7dd4e7f
JH
14864 hpux-define)
14865 case "$libs" in
14866 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14867 esac
14868 ;;
14869 *) avail_ext="$avail_ext $xxx" ;;
14870 esac
14871 ;;
5f80c64f
JH
14872 esac
14873 ;;
14874 POSIX|posix)
14875 case "$useposix" in
14876 true|define|y) avail_ext="$avail_ext $xxx" ;;
14877 esac
14878 ;;
14879 Opcode|opcode)
14880 case "$useopcode" in
14881 true|define|y) avail_ext="$avail_ext $xxx" ;;
14882 esac
14883 ;;
14884 Socket|socket)
14885 case "$d_socket" in
14886 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14887 esac
14888 ;;
14889 Thread|thread)
14890 case "$usethreads" in
14891 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14892 esac
14893 ;;
14894 IPC/SysV|ipc/sysv)
14895 : XXX Do we need a useipcsysv variable here
14896 case "${d_msg}${d_sem}${d_shm}" in
14897 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14898 esac
14899 ;;
14900 *) avail_ext="$avail_ext $xxx"
14901 ;;
14902 esac
14903done
14904
14905set X $avail_ext
14906shift
14907avail_ext="$*"
14908
14909: Now see which nonxs extensions are supported on this system.
14910: For now assume all are.
14911nonxs_ext=''
14912for xxx in $nonxs_extensions ; do
14913 case "$xxx" in
14914 *) nonxs_ext="$nonxs_ext $xxx"
14915 ;;
14916 esac
14917done
14918
14919set X $nonxs_ext
14920shift
14921nonxs_ext="$*"
14922
14923case $usedl in
14924$define)
14925 $cat <<EOM
14926A number of extensions are supplied with $package. You may choose to
14927compile these extensions for dynamic loading (the default), compile
14928them into the $package executable (static loading), or not include
14929them at all. Answer "none" to include no extensions.
14930Note that DynaLoader is always built and need not be mentioned here.
14931
14932EOM
14933 case "$dynamic_ext" in
14934 '') dflt="$avail_ext" ;;
14935 *) dflt="$dynamic_ext"
14936 # Perhaps we are reusing an old out-of-date config.sh.
14937 case "$hint" in
14938 previous)
14939 if test X"$dynamic_ext" != X"$avail_ext"; then
14940 $cat <<EOM
14941NOTICE: Your previous config.sh list may be incorrect.
14942The extensions now available to you are
14943 ${avail_ext}
14944but the default list from your previous config.sh is
14945 ${dynamic_ext}
14946
14947EOM
14948 fi
14949 ;;
14950 esac
14951 ;;
14952 esac
14953 case "$dflt" in
14954 '') dflt=none;;
14955 esac
14956 rp="What extensions do you wish to load dynamically?"
14957 . ./myread
14958 case "$ans" in
14959 none) dynamic_ext=' ' ;;
14960 *) dynamic_ext="$ans" ;;
14961 esac
14962
14963 case "$static_ext" in
14964 '')
14965 : Exclude those already listed in dynamic linking
14966 dflt=''
14967 for xxx in $avail_ext; do
14968 case " $dynamic_ext " in
14969 *" $xxx "*) ;;
14970 *) dflt="$dflt $xxx" ;;
14971 esac
14972 done
14973 set X $dflt
14974 shift
14975 dflt="$*"
14976 ;;
14977 *) dflt="$static_ext"
14978 ;;
14979 esac
14980
14981 case "$dflt" in
14982 '') dflt=none;;
14983 esac
14984 rp="What extensions do you wish to load statically?"
14985 . ./myread
14986 case "$ans" in
14987 none) static_ext=' ' ;;
14988 *) static_ext="$ans" ;;
14989 esac
14990 ;;
14991*)
14992 $cat <<EOM
14993A number of extensions are supplied with $package. Answer "none"
14994to include no extensions.
14995Note that DynaLoader is always built and need not be mentioned here.
14996
14997EOM
14998 case "$static_ext" in
14999 '') dflt="$avail_ext" ;;
15000 *) dflt="$static_ext"
15001 # Perhaps we are reusing an old out-of-date config.sh.
15002 case "$hint" in
15003 previous)
15004 if test X"$static_ext" != X"$avail_ext"; then
15005 $cat <<EOM
15006NOTICE: Your previous config.sh list may be incorrect.
15007The extensions now available to you are
15008 ${avail_ext}
15009but the default list from your previous config.sh is
15010 ${static_ext}
15011
15012EOM
15013 fi
15014 ;;
15015 esac
15016 ;;
15017 esac
15018 : Exclude those that are not xs extensions
15019 case "$dflt" in
15020 '') dflt=none;;
15021 esac
15022 rp="What extensions do you wish to include?"
15023 . ./myread
15024 case "$ans" in
15025 none) static_ext=' ' ;;
15026 *) static_ext="$ans" ;;
15027 esac
15028 ;;
15029esac
15030
15031set X $dynamic_ext $static_ext $nonxs_ext
15032shift
15033extensions="$*"
15034
15035: Remove build directory name from cppstdin so it can be used from
15036: either the present location or the final installed location.
15037echo " "
15038: Get out of the UU directory to get correct path name.
15039cd ..
15040case "$cppstdin" in
15041`pwd`/cppstdin)
15042 echo "Stripping down cppstdin path name"
15043 cppstdin=cppstdin
15044 ;;
15045esac
15046cd UU
15047
15048: end of configuration questions
15049echo " "
15050echo "End of configuration questions."
15051echo " "
15052
15053: back to where it started
15054if test -d ../UU; then
15055 cd ..
15056fi
15057
15058: configuration may be patched via a 'config.over' file
15059if $test -f config.over; then
15060 echo " "
15061 dflt=y
15062 rp='I see a config.over file. Do you wish to load it?'
15063 . UU/myread
15064 case "$ans" in
15065 n*) echo "OK, I'll ignore it.";;
15066 *) . ./config.over
15067 echo "Configuration override changes have been loaded."
15068 ;;
15069 esac
15070fi
15071
15072: in case they want portability, strip down executable paths
15073case "$d_portable" in
15074"$define")
15075 echo " "
15076 echo "Stripping down executable paths..." >&4
15077 for file in $loclist $trylist; do
534ac15a
JH
15078 eval temp=\$$file
15079 eval $file=`basename $temp`
5f80c64f
JH
15080 done
15081 ;;
15082esac
15083
15084: create config.sh file
15085echo " "
15086echo "Creating config.sh..." >&4
15087$spitshell <<EOT >config.sh
15088$startsh
15089#
15090# This file was produced by running the Configure script. It holds all the
15091# definitions figured out by Configure. Should you modify one of these values,
15092# do not forget to propagate your changes by running "Configure -der". You may
15093# instead choose to run each of the .SH files by yourself, or "Configure -S".
15094#
15095
15096# Package name : $package
15097# Source directory : $src
15098# Configuration time: $cf_time
15099# Configured by : $cf_by
15100# Target system : $myuname
15101
15102Author='$Author'
15103Date='$Date'
15104Header='$Header'
15105Id='$Id'
15106Locker='$Locker'
15107Log='$Log'
15108Mcc='$Mcc'
15109RCSfile='$RCSfile'
15110Revision='$Revision'
15111Source='$Source'
15112State='$State'
15113_a='$_a'
15114_exe='$_exe'
15115_o='$_o'
15116afs='$afs'
15117alignbytes='$alignbytes'
15118ansi2knr='$ansi2knr'
15119aphostname='$aphostname'
ff935051
JH
15120api_revision='$api_revision'
15121api_subversion='$api_subversion'
15122api_version='$api_version'
15123api_versionstring='$api_versionstring'
5f80c64f
JH
15124ar='$ar'
15125archlib='$archlib'
15126archlibexp='$archlibexp'
15127archname64='$archname64'
15128archname='$archname'
15129archobjs='$archobjs'
15130awk='$awk'
15131baserev='$baserev'
15132bash='$bash'
15133bin='$bin'
d71b2b6b 15134bincompat5005='$bincompat5005'
5f80c64f
JH
15135binexp='$binexp'
15136bison='$bison'
15137byacc='$byacc'
15138byteorder='$byteorder'
15139c='$c'
15140castflags='$castflags'
15141cat='$cat'
15142cc='$cc'
15143cccdlflags='$cccdlflags'
15144ccdlflags='$ccdlflags'
15145ccflags='$ccflags'
ff49bff8 15146ccsymbols='$ccsymbols'
5f80c64f
JH
15147cf_by='$cf_by'
15148cf_email='$cf_email'
15149cf_time='$cf_time'
8175356b 15150charsize='$charsize'
5f80c64f
JH
15151chgrp='$chgrp'
15152chmod='$chmod'
15153chown='$chown'
15154clocktype='$clocktype'
15155comm='$comm'
15156compress='$compress'
15157contains='$contains'
15158cp='$cp'
15159cpio='$cpio'
15160cpp='$cpp'
15161cpp_stuff='$cpp_stuff'
ff49bff8 15162cppccsymbols='$cppccsymbols'
5f80c64f
JH
15163cppflags='$cppflags'
15164cpplast='$cpplast'
15165cppminus='$cppminus'
15166cpprun='$cpprun'
15167cppstdin='$cppstdin'
ff49bff8 15168cppsymbols='$cppsymbols'
68c15b6f 15169crosscompile='$crosscompile'
5f80c64f
JH
15170cryptlib='$cryptlib'
15171csh='$csh'
15172d_Gconvert='$d_Gconvert'
cf2093f6
JH
15173d_PRIEldbl='$d_PRIEldbl'
15174d_PRIFldbl='$d_PRIFldbl'
15175d_PRIGldbl='$d_PRIGldbl'
15176d_PRIX64='$d_PRIX64'
15177d_PRId64='$d_PRId64'
15178d_PRIeldbl='$d_PRIeldbl'
15179d_PRIfldbl='$d_PRIfldbl'
15180d_PRIgldbl='$d_PRIgldbl'
15181d_PRIi64='$d_PRIi64'
15182d_PRIo64='$d_PRIo64'
15183d_PRIu64='$d_PRIu64'
15184d_PRIx64='$d_PRIx64'
5f80c64f
JH
15185d_access='$d_access'
15186d_accessx='$d_accessx'
15187d_alarm='$d_alarm'
15188d_archlib='$d_archlib'
cf2093f6
JH
15189d_atolf='$d_atolf'
15190d_atoll='$d_atoll'
5f80c64f
JH
15191d_attribut='$d_attribut'
15192d_bcmp='$d_bcmp'
15193d_bcopy='$d_bcopy'
d71b2b6b 15194d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
15195d_bsd='$d_bsd'
15196d_bsdgetpgrp='$d_bsdgetpgrp'
15197d_bsdsetpgrp='$d_bsdsetpgrp'
15198d_bzero='$d_bzero'
15199d_casti32='$d_casti32'
15200d_castneg='$d_castneg'
15201d_charvspr='$d_charvspr'
15202d_chown='$d_chown'
15203d_chroot='$d_chroot'
15204d_chsize='$d_chsize'
15205d_closedir='$d_closedir'
15206d_const='$d_const'
15207d_crypt='$d_crypt'
15208d_csh='$d_csh'
15209d_cuserid='$d_cuserid'
15210d_dbl_dig='$d_dbl_dig'
5f80c64f 15211d_difftime='$d_difftime'
5f80c64f
JH
15212d_dirnamlen='$d_dirnamlen'
15213d_dlerror='$d_dlerror'
15214d_dlopen='$d_dlopen'
15215d_dlsymun='$d_dlsymun'
15216d_dosuid='$d_dosuid'
15217d_drand48proto='$d_drand48proto'
15218d_dup2='$d_dup2'
15219d_eaccess='$d_eaccess'
15220d_endgrent='$d_endgrent'
15221d_endhent='$d_endhent'
15222d_endnent='$d_endnent'
15223d_endpent='$d_endpent'
15224d_endpwent='$d_endpwent'
15225d_endsent='$d_endsent'
f1066039 15226d_endspent='$d_endspent'
5f80c64f
JH
15227d_eofnblk='$d_eofnblk'
15228d_eunice='$d_eunice'
15229d_fchmod='$d_fchmod'
15230d_fchown='$d_fchown'
15231d_fcntl='$d_fcntl'
15232d_fd_macros='$d_fd_macros'
15233d_fd_set='$d_fd_set'
15234d_fds_bits='$d_fds_bits'
5f80c64f 15235d_fgetpos='$d_fgetpos'
5f80c64f 15236d_flexfnam='$d_flexfnam'
5f80c64f 15237d_flock='$d_flock'
5f80c64f
JH
15238d_fork='$d_fork'
15239d_fpathconf='$d_fpathconf'
d9b3e12d 15240d_fpos64_t='$d_fpos64_t'
a3540c92 15241d_frexpl='$d_frexpl'
0545a864 15242d_fs_data_s='$d_fs_data_s'
5f80c64f 15243d_fseeko='$d_fseeko'
5f80c64f 15244d_fsetpos='$d_fsetpos'
104d25b7
JH
15245d_fstatfs='$d_fstatfs'
15246d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
15247d_ftello='$d_ftello'
15248d_ftime='$d_ftime'
49dabb45 15249d_getcwd='$d_getcwd'
c890dc6c 15250d_getfsstat='$d_getfsstat'
5f80c64f
JH
15251d_getgrent='$d_getgrent'
15252d_getgrps='$d_getgrps'
15253d_gethbyaddr='$d_gethbyaddr'
15254d_gethbyname='$d_gethbyname'
15255d_gethent='$d_gethent'
15256d_gethname='$d_gethname'
15257d_gethostprotos='$d_gethostprotos'
15258d_getlogin='$d_getlogin'
ad27e871 15259d_getmnt='$d_getmnt'
ccc7f9b3 15260d_getmntent='$d_getmntent'
5f80c64f
JH
15261d_getnbyaddr='$d_getnbyaddr'
15262d_getnbyname='$d_getnbyname'
15263d_getnent='$d_getnent'
15264d_getnetprotos='$d_getnetprotos'
15265d_getpbyname='$d_getpbyname'
15266d_getpbynumber='$d_getpbynumber'
15267d_getpent='$d_getpent'
15268d_getpgid='$d_getpgid'
15269d_getpgrp2='$d_getpgrp2'
15270d_getpgrp='$d_getpgrp'
15271d_getppid='$d_getppid'
15272d_getprior='$d_getprior'
15273d_getprotoprotos='$d_getprotoprotos'
15274d_getpwent='$d_getpwent'
15275d_getsbyname='$d_getsbyname'
15276d_getsbyport='$d_getsbyport'
15277d_getsent='$d_getsent'
15278d_getservprotos='$d_getservprotos'
f1066039
JH
15279d_getspent='$d_getspent'
15280d_getspnam='$d_getspnam'
5f80c64f
JH
15281d_gettimeod='$d_gettimeod'
15282d_gnulibc='$d_gnulibc'
15283d_grpasswd='$d_grpasswd'
ccc7f9b3 15284d_hasmntopt='$d_hasmntopt'
5f80c64f 15285d_htonl='$d_htonl'
43999f95 15286d_iconv='$d_iconv'
5f80c64f
JH
15287d_index='$d_index'
15288d_inetaton='$d_inetaton'
13b3f787 15289d_int64_t='$d_int64_t'
5f80c64f 15290d_isascii='$d_isascii'
a3540c92
JH
15291d_isnan='$d_isnan'
15292d_isnanl='$d_isnanl'
5f80c64f
JH
15293d_killpg='$d_killpg'
15294d_lchown='$d_lchown'
2d4389e4 15295d_ldbl_dig='$d_ldbl_dig'
5f80c64f
JH
15296d_link='$d_link'
15297d_locconv='$d_locconv'
5f80c64f
JH
15298d_lockf='$d_lockf'
15299d_longdbl='$d_longdbl'
15300d_longlong='$d_longlong'
49c10eea 15301d_lseekproto='$d_lseekproto'
5f80c64f 15302d_lstat='$d_lstat'
1e8c3fde 15303d_madvise='$d_madvise'
5f80c64f
JH
15304d_mblen='$d_mblen'
15305d_mbstowcs='$d_mbstowcs'
15306d_mbtowc='$d_mbtowc'
0f27ced1 15307d_memchr='$d_memchr'
5f80c64f
JH
15308d_memcmp='$d_memcmp'
15309d_memcpy='$d_memcpy'
15310d_memmove='$d_memmove'
15311d_memset='$d_memset'
15312d_mkdir='$d_mkdir'
fe749a9f 15313d_mkdtemp='$d_mkdtemp'
5f80c64f 15314d_mkfifo='$d_mkfifo'
fe749a9f
JH
15315d_mkstemp='$d_mkstemp'
15316d_mkstemps='$d_mkstemps'
5f80c64f 15317d_mktime='$d_mktime'
fe749a9f 15318d_mmap='$d_mmap'
a3540c92 15319d_modfl='$d_modfl'
fe749a9f 15320d_mprotect='$d_mprotect'
5f80c64f 15321d_msg='$d_msg'
de4597cb
JH
15322d_msg_ctrunc='$d_msg_ctrunc'
15323d_msg_dontroute='$d_msg_dontroute'
15324d_msg_oob='$d_msg_oob'
15325d_msg_peek='$d_msg_peek'
15326d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
15327d_msgctl='$d_msgctl'
15328d_msgget='$d_msgget'
15329d_msgrcv='$d_msgrcv'
15330d_msgsnd='$d_msgsnd'
fe749a9f
JH
15331d_msync='$d_msync'
15332d_munmap='$d_munmap'
5f80c64f 15333d_mymalloc='$d_mymalloc'
5f80c64f 15334d_nice='$d_nice'
78691af5 15335d_nv_preserves_uv='$d_nv_preserves_uv'
2000072c 15336d_off64_t='$d_off64_t'
ef4af2be 15337d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
15338d_oldpthreads='$d_oldpthreads'
15339d_oldsock='$d_oldsock'
15340d_open3='$d_open3'
5f80c64f
JH
15341d_pathconf='$d_pathconf'
15342d_pause='$d_pause'
3b777bb4 15343d_perl_otherlibdirs='$d_perl_otherlibdirs'
5f80c64f
JH
15344d_phostname='$d_phostname'
15345d_pipe='$d_pipe'
15346d_poll='$d_poll'
15347d_portable='$d_portable'
15348d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
15349d_pwage='$d_pwage'
15350d_pwchange='$d_pwchange'
15351d_pwclass='$d_pwclass'
15352d_pwcomment='$d_pwcomment'
15353d_pwexpire='$d_pwexpire'
15354d_pwgecos='$d_pwgecos'
15355d_pwpasswd='$d_pwpasswd'
15356d_pwquota='$d_pwquota'
bbe6c963 15357d_qgcvt='$d_qgcvt'
de1c2614 15358d_quad='$d_quad'
5f80c64f
JH
15359d_readdir='$d_readdir'
15360d_readlink='$d_readlink'
15361d_rename='$d_rename'
15362d_rewinddir='$d_rewinddir'
15363d_rmdir='$d_rmdir'
15364d_safebcpy='$d_safebcpy'
15365d_safemcpy='$d_safemcpy'
15366d_sanemcmp='$d_sanemcmp'
15367d_sched_yield='$d_sched_yield'
de4597cb 15368d_scm_rights='$d_scm_rights'
5f80c64f
JH
15369d_seekdir='$d_seekdir'
15370d_select='$d_select'
15371d_sem='$d_sem'
15372d_semctl='$d_semctl'
15373d_semctl_semid_ds='$d_semctl_semid_ds'
15374d_semctl_semun='$d_semctl_semun'
15375d_semget='$d_semget'
15376d_semop='$d_semop'
15377d_setegid='$d_setegid'
15378d_seteuid='$d_seteuid'
15379d_setgrent='$d_setgrent'
15380d_setgrps='$d_setgrps'
15381d_sethent='$d_sethent'
15382d_setlinebuf='$d_setlinebuf'
15383d_setlocale='$d_setlocale'
15384d_setnent='$d_setnent'
15385d_setpent='$d_setpent'
15386d_setpgid='$d_setpgid'
15387d_setpgrp2='$d_setpgrp2'
15388d_setpgrp='$d_setpgrp'
15389d_setprior='$d_setprior'
15390d_setpwent='$d_setpwent'
15391d_setregid='$d_setregid'
15392d_setresgid='$d_setresgid'
15393d_setresuid='$d_setresuid'
15394d_setreuid='$d_setreuid'
15395d_setrgid='$d_setrgid'
15396d_setruid='$d_setruid'
15397d_setsent='$d_setsent'
15398d_setsid='$d_setsid'
f1066039 15399d_setspent='$d_setspent'
5f80c64f
JH
15400d_setvbuf='$d_setvbuf'
15401d_sfio='$d_sfio'
15402d_shm='$d_shm'
15403d_shmat='$d_shmat'
15404d_shmatprototype='$d_shmatprototype'
15405d_shmctl='$d_shmctl'
15406d_shmdt='$d_shmdt'
15407d_shmget='$d_shmget'
15408d_sigaction='$d_sigaction'
15409d_sigsetjmp='$d_sigsetjmp'
15410d_socket='$d_socket'
13b3f787 15411d_socklen_t='$d_socklen_t'
5f80c64f 15412d_sockpair='$d_sockpair'
68d4903c 15413d_sqrtl='$d_sqrtl'
5f80c64f 15414d_statblks='$d_statblks'
0545a864
JH
15415d_statfs_f_flags='$d_statfs_f_flags'
15416d_statfs_s='$d_statfs_s'
104d25b7 15417d_statvfs='$d_statvfs'
5f80c64f
JH
15418d_stdio_cnt_lval='$d_stdio_cnt_lval'
15419d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 15420d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
15421d_stdiobase='$d_stdiobase'
15422d_stdstdio='$d_stdstdio'
5f80c64f
JH
15423d_strchr='$d_strchr'
15424d_strcoll='$d_strcoll'
15425d_strctcpy='$d_strctcpy'
15426d_strerrm='$d_strerrm'
15427d_strerror='$d_strerror'
15428d_strtod='$d_strtod'
15429d_strtol='$d_strtol'
ff935051 15430d_strtold='$d_strtold'
76d49b1c 15431d_strtoll='$d_strtoll'
5f80c64f 15432d_strtoul='$d_strtoul'
cf2093f6 15433d_strtoull='$d_strtoull'
ff935051 15434d_strtouq='$d_strtouq'
5f80c64f
JH
15435d_strxfrm='$d_strxfrm'
15436d_suidsafe='$d_suidsafe'
15437d_symlink='$d_symlink'
15438d_syscall='$d_syscall'
15439d_sysconf='$d_sysconf'
15440d_sysernlst='$d_sysernlst'
15441d_syserrlst='$d_syserrlst'
15442d_system='$d_system'
15443d_tcgetpgrp='$d_tcgetpgrp'
15444d_tcsetpgrp='$d_tcsetpgrp'
5f80c64f 15445d_telldir='$d_telldir'
cb86ce0e 15446d_telldirproto='$d_telldirproto'
5f80c64f
JH
15447d_time='$d_time'
15448d_times='$d_times'
5f80c64f
JH
15449d_truncate='$d_truncate'
15450d_tzname='$d_tzname'
15451d_umask='$d_umask'
15452d_uname='$d_uname'
15453d_union_semun='$d_union_semun'
0545a864 15454d_ustat='$d_ustat'
526fdc24 15455d_vendorarch='$d_vendorarch'
717c4fcc 15456d_vendorbin='$d_vendorbin'
a3635516 15457d_vendorlib='$d_vendorlib'
5f80c64f
JH
15458d_vfork='$d_vfork'
15459d_void_closedir='$d_void_closedir'
15460d_voidsig='$d_voidsig'
15461d_voidtty='$d_voidtty'
15462d_volatile='$d_volatile'
15463d_vprintf='$d_vprintf'
15464d_wait4='$d_wait4'
15465d_waitpid='$d_waitpid'
15466d_wcstombs='$d_wcstombs'
15467d_wctomb='$d_wctomb'
15468d_xenix='$d_xenix'
15469date='$date'
15470db_hashtype='$db_hashtype'
15471db_prefixtype='$db_prefixtype'
15472defvoidused='$defvoidused'
15473direntrytype='$direntrytype'
15474dlext='$dlext'
15475dlsrc='$dlsrc'
15476doublesize='$doublesize'
15477drand01='$drand01'
15478dynamic_ext='$dynamic_ext'
15479eagain='$eagain'
15480ebcdic='$ebcdic'
15481echo='$echo'
15482egrep='$egrep'
15483emacs='$emacs'
15484eunicefix='$eunicefix'
15485exe_ext='$exe_ext'
15486expr='$expr'
15487extensions='$extensions'
66fe083f 15488fflushNULL='$fflushNULL'
767df6a1 15489fflushall='$fflushall'
5f80c64f
JH
15490find='$find'
15491firstmakefile='$firstmakefile'
15492flex='$flex'
8175356b 15493fpossize='$fpossize'
5f80c64f
JH
15494fpostype='$fpostype'
15495freetype='$freetype'
ccc7f9b3 15496full_ar='$full_ar'
5f80c64f
JH
15497full_csh='$full_csh'
15498full_sed='$full_sed'
15499gccversion='$gccversion'
a22e52b9 15500gidformat='$gidformat'
785fb66b
JH
15501gidsign='$gidsign'
15502gidsize='$gidsize'
5f80c64f
JH
15503gidtype='$gidtype'
15504glibpth='$glibpth'
15505grep='$grep'
15506groupcat='$groupcat'
15507groupstype='$groupstype'
15508gzip='$gzip'
15509h_fcntl='$h_fcntl'
15510h_sysfile='$h_sysfile'
15511hint='$hint'
15512hostcat='$hostcat'
15513huge='$huge'
8175356b
JH
15514i16size='$i16size'
15515i16type='$i16type'
15516i32size='$i32size'
15517i32type='$i32type'
15518i64size='$i64size'
15519i64type='$i64type'
15520i8size='$i8size'
15521i8type='$i8type'
5f80c64f
JH
15522i_arpainet='$i_arpainet'
15523i_bsdioctl='$i_bsdioctl'
15524i_db='$i_db'
15525i_dbm='$i_dbm'
15526i_dirent='$i_dirent'
15527i_dld='$i_dld'
15528i_dlfcn='$i_dlfcn'
15529i_fcntl='$i_fcntl'
15530i_float='$i_float'
15531i_gdbm='$i_gdbm'
15532i_grp='$i_grp'
43999f95 15533i_iconv='$i_iconv'
792d8dab 15534i_ieeefp='$i_ieeefp'
5f80c64f
JH
15535i_inttypes='$i_inttypes'
15536i_limits='$i_limits'
15537i_locale='$i_locale'
7f3d1cf1 15538i_machcthr='$i_machcthr'
5f80c64f
JH
15539i_malloc='$i_malloc'
15540i_math='$i_math'
15541i_memory='$i_memory'
e7fb4fcc 15542i_mntent='$i_mntent'
5f80c64f
JH
15543i_ndbm='$i_ndbm'
15544i_netdb='$i_netdb'
15545i_neterrno='$i_neterrno'
9cc6feab 15546i_netinettcp='$i_netinettcp'
5f80c64f 15547i_niin='$i_niin'
5b34fd99 15548i_poll='$i_poll'
c4747d3e 15549i_pthread='$i_pthread'
5f80c64f
JH
15550i_pwd='$i_pwd'
15551i_rpcsvcdbm='$i_rpcsvcdbm'
15552i_sfio='$i_sfio'
15553i_sgtty='$i_sgtty'
f1066039 15554i_shadow='$i_shadow'
86959918 15555i_socks='$i_socks'
5f80c64f
JH
15556i_stdarg='$i_stdarg'
15557i_stddef='$i_stddef'
15558i_stdlib='$i_stdlib'
15559i_string='$i_string'
923fc586 15560i_sunmath='$i_sunmath'
5f80c64f
JH
15561i_sysaccess='$i_sysaccess'
15562i_sysdir='$i_sysdir'
15563i_sysfile='$i_sysfile'
15564i_sysfilio='$i_sysfilio'
15565i_sysin='$i_sysin'
15566i_sysioctl='$i_sysioctl'
ca52efda 15567i_syslog='$i_syslog'
fe749a9f 15568i_sysmman='$i_sysmman'
bf0c440f 15569i_sysmode='$i_sysmode'
104d25b7 15570i_sysmount='$i_sysmount'
5f80c64f
JH
15571i_sysndir='$i_sysndir'
15572i_sysparam='$i_sysparam'
15573i_sysresrc='$i_sysresrc'
15574i_syssecrt='$i_syssecrt'
15575i_sysselct='$i_sysselct'
15576i_syssockio='$i_syssockio'
15577i_sysstat='$i_sysstat'
0545a864 15578i_sysstatfs='$i_sysstatfs'
104d25b7 15579i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
15580i_systime='$i_systime'
15581i_systimek='$i_systimek'
15582i_systimes='$i_systimes'
15583i_systypes='$i_systypes'
de4597cb 15584i_sysuio='$i_sysuio'
5f80c64f 15585i_sysun='$i_sysun'
d4935d7f 15586i_sysutsname='$i_sysutsname'
0545a864 15587i_sysvfs='$i_sysvfs'
5f80c64f
JH
15588i_syswait='$i_syswait'
15589i_termio='$i_termio'
15590i_termios='$i_termios'
15591i_time='$i_time'
15592i_unistd='$i_unistd'
0545a864 15593i_ustat='$i_ustat'
5f80c64f
JH
15594i_utime='$i_utime'
15595i_values='$i_values'
15596i_varargs='$i_varargs'
15597i_varhdr='$i_varhdr'
15598i_vfork='$i_vfork'
15599ignore_versioned_solibs='$ignore_versioned_solibs'
ff935051 15600inc_version_list='$inc_version_list'
3a096bf3 15601inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
15602incpath='$incpath'
15603inews='$inews'
15604installarchlib='$installarchlib'
15605installbin='$installbin'
15606installman1dir='$installman1dir'
15607installman3dir='$installman3dir'
dd4e71fd
JH
15608installprefix='$installprefix'
15609installprefixexp='$installprefixexp'
5f80c64f
JH
15610installprivlib='$installprivlib'
15611installscript='$installscript'
15612installsitearch='$installsitearch'
717c4fcc 15613installsitebin='$installsitebin'
5f80c64f 15614installsitelib='$installsitelib'
dd4e71fd 15615installstyle='$installstyle'
104d25b7 15616installusrbinperl='$installusrbinperl'
526fdc24 15617installvendorarch='$installvendorarch'
717c4fcc 15618installvendorbin='$installvendorbin'
a3635516 15619installvendorlib='$installvendorlib'
5f80c64f 15620intsize='$intsize'
8175356b
JH
15621ivdformat='$ivdformat'
15622ivsize='$ivsize'
15623ivtype='$ivtype'
5f80c64f
JH
15624known_extensions='$known_extensions'
15625ksh='$ksh'
15626large='$large'
15627ld='$ld'
15628lddlflags='$lddlflags'
15629ldflags='$ldflags'
5cf1d1f1 15630ldlibpthname='$ldlibpthname'
5f80c64f
JH
15631less='$less'
15632lib_ext='$lib_ext'
15633libc='$libc'
15634libperl='$libperl'
15635libpth='$libpth'
15636libs='$libs'
43999f95
JH
15637libsdirs='$libsdirs'
15638libsfiles='$libsfiles'
15639libsfound='$libsfound'
13b3f787 15640libspath='$libspath'
5f80c64f
JH
15641libswanted='$libswanted'
15642line='$line'
15643lint='$lint'
15644lkflags='$lkflags'
15645ln='$ln'
15646lns='$lns'
15647locincpth='$locincpth'
15648loclibpth='$loclibpth'
15649longdblsize='$longdblsize'
15650longlongsize='$longlongsize'
15651longsize='$longsize'
15652lp='$lp'
15653lpr='$lpr'
15654ls='$ls'
15655lseeksize='$lseeksize'
15656lseektype='$lseektype'
15657mail='$mail'
15658mailx='$mailx'
15659make='$make'
15660make_set_make='$make_set_make'
15661mallocobj='$mallocobj'
15662mallocsrc='$mallocsrc'
15663malloctype='$malloctype'
15664man1dir='$man1dir'
15665man1direxp='$man1direxp'
15666man1ext='$man1ext'
15667man3dir='$man3dir'
15668man3direxp='$man3direxp'
15669man3ext='$man3ext'
15670medium='$medium'
5f80c64f
JH
15671mips_type='$mips_type'
15672mkdir='$mkdir'
fe749a9f 15673mmaptype='$mmaptype'
5f80c64f
JH
15674models='$models'
15675modetype='$modetype'
15676more='$more'
68c15b6f 15677multiarch='$multiarch'
5f80c64f
JH
15678mv='$mv'
15679myarchname='$myarchname'
15680mydomain='$mydomain'
15681myhostname='$myhostname'
15682myuname='$myuname'
15683n='$n'
15684netdb_hlen_type='$netdb_hlen_type'
15685netdb_host_type='$netdb_host_type'
15686netdb_name_type='$netdb_name_type'
15687netdb_net_type='$netdb_net_type'
15688nm='$nm'
15689nm_opt='$nm_opt'
15690nm_so_opt='$nm_so_opt'
15691nonxs_ext='$nonxs_ext'
15692nroff='$nroff'
8175356b
JH
15693nvsize='$nvsize'
15694nvtype='$nvtype'
5f80c64f
JH
15695o_nonblock='$o_nonblock'
15696obj_ext='$obj_ext'
ef4af2be 15697old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
15698optimize='$optimize'
15699orderlib='$orderlib'
15700osname='$osname'
15701osvers='$osvers'
3b777bb4 15702otherlibdirs='$otherlibdirs'
5f80c64f
JH
15703package='$package'
15704pager='$pager'
15705passcat='$passcat'
15706patchlevel='$patchlevel'
15707path_sep='$path_sep'
49c10eea 15708perl5='$perl5'
5f80c64f
JH
15709perl='$perl'
15710perladmin='$perladmin'
15711perlpath='$perlpath'
15712pg='$pg'
15713phostname='$phostname'
15714pidtype='$pidtype'
15715plibpth='$plibpth'
fe749a9f 15716pm_apiversion='$pm_apiversion'
5f80c64f
JH
15717pmake='$pmake'
15718pr='$pr'
15719prefix='$prefix'
15720prefixexp='$prefixexp'
15721privlib='$privlib'
15722privlibexp='$privlibexp'
15723prototype='$prototype'
15724ptrsize='$ptrsize'
6b8eaf93 15725quadkind='$quadkind'
d7d93a81 15726quadtype='$quadtype'
5f80c64f
JH
15727randbits='$randbits'
15728randfunc='$randfunc'
15729randseedtype='$randseedtype'
15730ranlib='$ranlib'
15731rd_nodata='$rd_nodata'
49c10eea 15732revision='$revision'
5f80c64f
JH
15733rm='$rm'
15734rmail='$rmail'
15735runnm='$runnm'
cf2093f6
JH
15736sPRIEldbl='$sPRIEldbl'
15737sPRIFldbl='$sPRIFldbl'
15738sPRIGldbl='$sPRIGldbl'
15739sPRIX64='$sPRIX64'
15740sPRId64='$sPRId64'
15741sPRIeldbl='$sPRIeldbl'
15742sPRIfldbl='$sPRIfldbl'
15743sPRIgldbl='$sPRIgldbl'
15744sPRIi64='$sPRIi64'
15745sPRIo64='$sPRIo64'
15746sPRIu64='$sPRIu64'
15747sPRIx64='$sPRIx64'
5f80c64f
JH
15748sched_yield='$sched_yield'
15749scriptdir='$scriptdir'
15750scriptdirexp='$scriptdirexp'
15751sed='$sed'
15752seedfunc='$seedfunc'
15753selectminbits='$selectminbits'
15754selecttype='$selecttype'
15755sendmail='$sendmail'
15756sh='$sh'
15757shar='$shar'
15758sharpbang='$sharpbang'
15759shmattype='$shmattype'
15760shortsize='$shortsize'
15761shrpenv='$shrpenv'
15762shsharp='$shsharp'
af4c28eb 15763sig_count='$sig_count'
5f80c64f
JH
15764sig_name='$sig_name'
15765sig_name_init='$sig_name_init'
15766sig_num='$sig_num'
824a2ba3 15767sig_num_init='$sig_num_init'
5f80c64f
JH
15768signal_t='$signal_t'
15769sitearch='$sitearch'
15770sitearchexp='$sitearchexp'
717c4fcc
JH
15771sitebin='$sitebin'
15772sitebinexp='$sitebinexp'
5f80c64f 15773sitelib='$sitelib'
526fdc24 15774sitelib_stem='$sitelib_stem'
5f80c64f 15775sitelibexp='$sitelibexp'
dd4e71fd
JH
15776siteprefix='$siteprefix'
15777siteprefixexp='$siteprefixexp'
8c99d73e 15778sizesize='$sizesize'
5f80c64f
JH
15779sizetype='$sizetype'
15780sleep='$sleep'
15781smail='$smail'
15782small='$small'
15783so='$so'
15784sockethdr='$sockethdr'
15785socketlib='$socketlib'
c890dc6c 15786socksizetype='$socksizetype'
5f80c64f
JH
15787sort='$sort'
15788spackage='$spackage'
15789spitshell='$spitshell'
15790split='$split'
15791src='$src'
15792ssizetype='$ssizetype'
15793startperl='$startperl'
15794startsh='$startsh'
15795static_ext='$static_ext'
15796stdchar='$stdchar'
15797stdio_base='$stdio_base'
15798stdio_bufsiz='$stdio_bufsiz'
15799stdio_cnt='$stdio_cnt'
15800stdio_filbuf='$stdio_filbuf'
15801stdio_ptr='$stdio_ptr'
767df6a1 15802stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
15803strings='$strings'
15804submit='$submit'
15805subversion='$subversion'
15806sysman='$sysman'
15807tail='$tail'
15808tar='$tar'
15809tbl='$tbl'
15810tee='$tee'
15811test='$test'
15812timeincl='$timeincl'
15813timetype='$timetype'
15814touch='$touch'
15815tr='$tr'
15816trnl='$trnl'
15817troff='$troff'
8175356b
JH
15818u16size='$u16size'
15819u16type='$u16type'
15820u32size='$u32size'
15821u32type='$u32type'
15822u64size='$u64size'
15823u64type='$u64type'
15824u8size='$u8size'
15825u8type='$u8type'
a22e52b9 15826uidformat='$uidformat'
57def98f 15827uidsign='$uidsign'
785fb66b 15828uidsize='$uidsize'
5f80c64f
JH
15829uidtype='$uidtype'
15830uname='$uname'
15831uniq='$uniq'
d7d93a81 15832uquadtype='$uquadtype'
aaacdc8b 15833use5005threads='$use5005threads'
10cc9d2a
JH
15834use64bitall='$use64bitall'
15835use64bitint='$use64bitint'
5f80c64f 15836usedl='$usedl'
aaacdc8b 15837useithreads='$useithreads'
249b38c6 15838uselargefiles='$uselargefiles'
b0ce926a 15839uselongdouble='$uselongdouble'
09458382 15840usemorebits='$usemorebits'
5f80c64f
JH
15841usemultiplicity='$usemultiplicity'
15842usemymalloc='$usemymalloc'
15843usenm='$usenm'
15844useopcode='$useopcode'
15845useperlio='$useperlio'
15846useposix='$useposix'
15847usesfio='$usesfio'
15848useshrplib='$useshrplib'
29209bc5 15849usesocks='$usesocks'
5f80c64f 15850usethreads='$usethreads'
a3635516 15851usevendorprefix='$usevendorprefix'
5f80c64f
JH
15852usevfork='$usevfork'
15853usrinc='$usrinc'
15854uuname='$uuname'
8175356b
JH
15855uvoformat='$uvoformat'
15856uvsize='$uvsize'
15857uvtype='$uvtype'
15858uvuformat='$uvuformat'
15859uvxformat='$uvxformat'
526fdc24
MS
15860vendorarch='$vendorarch'
15861vendorarchexp='$vendorarchexp'
717c4fcc
JH
15862vendorbin='$vendorbin'
15863vendorbinexp='$vendorbinexp'
a3635516 15864vendorlib='$vendorlib'
526fdc24 15865vendorlib_stem='$vendorlib_stem'
a3635516
JH
15866vendorlibexp='$vendorlibexp'
15867vendorprefix='$vendorprefix'
15868vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
15869version='$version'
15870vi='$vi'
15871voidflags='$voidflags'
15872xlibpth='$xlibpth'
fe749a9f 15873xs_apiversion='$xs_apiversion'
5f80c64f
JH
15874zcat='$zcat'
15875zip='$zip'
15876EOT
15877
15878: Add in command line options if available
15879$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15880
15881: add special variables
15882$test -f $src/patchlevel.h && \
d00b958f 15883awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 15884echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
15885
15886: propagate old symbols
15887if $test -f UU/config.sh; then
15888 <UU/config.sh sort | uniq >UU/oldconfig.sh
15889 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15890 sort | uniq -u >UU/oldsyms
15891 set X `cat UU/oldsyms`
15892 shift
15893 case $# in
15894 0) ;;
15895 *)
15896 cat <<EOM
15897Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15898EOM
15899 echo "# Variables propagated from previous config.sh file." >>config.sh
15900 for sym in `cat UU/oldsyms`; do
15901 echo " Propagating $hint variable "'$'"$sym..."
15902 eval 'tmp="$'"${sym}"'"'
15903 echo "$tmp" | \
15904 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15905 done
15906 ;;
15907 esac
15908fi
15909
15910: Finish up by extracting the .SH files
15911case "$alldone" in
15912exit)
15913 $rm -rf UU
15914 echo "Done."
15915 exit 0
15916 ;;
15917cont)
15918 ;;
15919'')
15920 dflt=''
15921 nostick=true
15922 $cat <<EOM
15923
15924If you'd like to make any changes to the config.sh file before I begin
15925to configure things, do it as a shell escape now (e.g. !vi config.sh).
15926
15927EOM
15928 rp="Press return or use a shell escape to edit config.sh:"
15929 . UU/myread
15930 nostick=''
15931 case "$ans" in
15932 '') ;;
15933 *) : in case they cannot read
15934 sh 1>&4 -c "$ans";;
15935 esac
15936 ;;
15937esac
15938
15939: if this fails, just run all the .SH files by hand
15940. ./config.sh
15941
15942echo " "
15943exec 1>&4
15944. ./UU/extract
15945
15946if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15947 dflt=y
15948 case "$silent" in
15949 true) ;;
15950 *)
15951 $cat <<EOM
15952
15953Now you need to generate make dependencies by running "$make depend".
15954You might prefer to run it in background: "$make depend > makedepend.out &"
15955It can take a while, so you might not want to run it right now.
15956
15957EOM
15958 ;;
15959 esac
15960 rp="Run $make depend now?"
15961 . UU/myread
15962 case "$ans" in
15963 y*)
15964 $make depend && echo "Now you must run a $make."
15965 ;;
15966 *)
15967 echo "You must run '$make depend' then '$make'."
15968 ;;
15969 esac
15970elif test -f [Mm]akefile; then
15971 echo " "
15972 echo "Now you must run a $make."
15973else
15974 echo "Done."
15975fi
15976
15977if $test -f Policy.sh; then
15978 $cat <<EOM
15979
15980If you compile $package on a different machine or from a different object
15981directory, copy the Policy.sh file from this object directory to the
15982new one before you run Configure -- this will help you with most of
15983the policy defaults.
15984
15985EOM
15986fi
15987if $test -f config.msg; then
15988 echo "Hmm. I also noted the following information while running:"
15989 echo " "
15990 $cat config.msg >&4
15991 $rm -f config.msg
15992fi
15993$rm -f kit*isdone ark*isdone
15994$rm -rf UU
15995
15996: End of Configure
15997