This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
s/croak/Perl_croak/
[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#
d4935d7f 23# Generated on Wed Feb 16 01:07:15 EET 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=''
ad27e871 357d_fs_data_s=''
5ff3f7a4 358d_fseeko=''
a0d0e21e 359d_fsetpos=''
0545a864 360d_fstatfs=''
5ff3f7a4 361d_ftello=''
5f05dabc 362d_ftime=''
363d_gettimeod=''
a0d0e21e 364d_Gconvert=''
49dabb45 365d_getcwd=''
5ff3f7a4 366d_getgrent=''
2304df62 367d_getgrps=''
4599a1de 368d_gethbyaddr=''
4599a1de 369d_gethbyname=''
dfe9444c 370d_gethent=''
2304df62
AD
371aphostname=''
372d_gethname=''
373d_phostname=''
374d_uname=''
dc45a647 375d_gethostprotos=''
a0d0e21e 376d_getlogin=''
ad27e871 377d_getmnt=''
ccc7f9b3 378d_getmntent=''
dfe9444c 379d_getnbyaddr=''
693762b4 380d_getnbyname=''
e5c9fcd0 381d_getnent=''
dc45a647 382d_getnetprotos=''
e5c9fcd0 383d_getpent=''
2afac517 384d_getpgid=''
2304df62 385d_getpgrp2=''
2afac517 386d_bsdgetpgrp=''
2304df62 387d_getpgrp=''
a0d0e21e 388d_getppid=''
2304df62 389d_getprior=''
693762b4
AD
390d_getpbyname=''
391d_getpbynumber=''
dc45a647 392d_getprotoprotos=''
5ff3f7a4 393d_getpwent=''
e5c9fcd0 394d_getsent=''
dc45a647 395d_getservprotos=''
f1066039
JH
396d_getspent=''
397d_getspnam=''
693762b4
AD
398d_getsbyname=''
399d_getsbyport=''
a4f3eea9 400d_gnulibc=''
ccc7f9b3 401d_hasmntopt=''
2304df62 402d_htonl=''
43999f95 403d_iconv=''
7e1af8bc 404d_inetaton=''
6b8eaf93 405d_int64t=''
2304df62
AD
406d_isascii=''
407d_killpg=''
dd64f1c3 408d_lchown=''
2d4389e4 409d_ldbl_dig=''
2304df62 410d_link=''
a0d0e21e
LW
411d_locconv=''
412d_lockf=''
e5c9fcd0
AD
413d_longdbl=''
414longdblsize=''
dc45a647
MB
415d_longlong=''
416longlongsize=''
2304df62 417d_lstat=''
a0d0e21e
LW
418d_mblen=''
419d_mbstowcs=''
420d_mbtowc=''
0f27ced1 421d_memchr=''
2304df62
AD
422d_memcmp=''
423d_memcpy=''
424d_memmove=''
425d_memset=''
426d_mkdir=''
fe749a9f 427d_mkdtemp=''
a0d0e21e 428d_mkfifo=''
fe749a9f
JH
429d_mkstemp=''
430d_mkstemps=''
a0d0e21e 431d_mktime=''
fe749a9f
JH
432d_mmap=''
433mmaptype=''
434d_mprotect=''
2304df62
AD
435d_msg=''
436d_msgctl=''
437d_msgget=''
438d_msgrcv=''
439d_msgsnd=''
fe749a9f
JH
440d_msync=''
441d_munmap=''
a0d0e21e 442d_nice=''
2304df62 443d_open3=''
a0d0e21e
LW
444d_fpathconf=''
445d_pathconf=''
446d_pause=''
447d_pipe=''
8e07c86e 448d_poll=''
2304df62 449d_portable=''
ef4af2be
JH
450d_old_pthread_create_joinable=''
451old_pthread_create_joinable=''
dfe9444c
AD
452d_pthread_yield=''
453d_sched_yield=''
1cfa4ec7 454sched_yield=''
2304df62 455d_readdir=''
85e6fe83
LW
456d_rewinddir=''
457d_seekdir=''
458d_telldir=''
a0d0e21e 459d_readlink=''
2304df62
AD
460d_rename=''
461d_rmdir=''
462d_safebcpy=''
463d_safemcpy=''
36477c24 464d_sanemcmp=''
2304df62
AD
465d_select=''
466d_sem=''
467d_semctl=''
468d_semget=''
469d_semop=''
470d_setegid=''
471d_seteuid=''
5ff3f7a4 472d_setgrent=''
dfe9444c 473d_setgrps=''
693762b4 474d_sethent=''
a0d0e21e 475d_setlinebuf=''
2304df62 476d_setlocale=''
e5c9fcd0
AD
477d_setnent=''
478d_setpent=''
2304df62
AD
479d_setpgid=''
480d_setpgrp2=''
2afac517 481d_bsdsetpgrp=''
2304df62
AD
482d_setpgrp=''
483d_setprior=''
5ff3f7a4 484d_setpwent=''
2304df62
AD
485d_setregid=''
486d_setresgid=''
487d_setresuid=''
488d_setreuid=''
489d_setrgid=''
490d_setruid=''
e5c9fcd0 491d_setsent=''
2304df62 492d_setsid=''
f1066039 493d_setspent=''
e5c9fcd0 494d_setvbuf=''
760ac839 495d_sfio=''
8ff267be 496usesfio=''
2304df62
AD
497d_shm=''
498d_shmat=''
a0d0e21e
LW
499d_shmatprototype=''
500shmattype=''
2304df62
AD
501d_shmctl=''
502d_shmdt=''
503d_shmget=''
2c7991dc 504d_sigaction=''
8ff267be 505d_sigsetjmp=''
de4597cb
JH
506d_msg_ctrunc=''
507d_msg_dontroute=''
508d_msg_oob=''
509d_msg_peek=''
510d_msg_proxy=''
2304df62 511d_oldsock=''
de4597cb 512d_scm_rights=''
2304df62
AD
513d_socket=''
514d_sockpair=''
515sockethdr=''
516socketlib=''
68d4903c 517d_sqrtl=''
2304df62 518d_statblks=''
0545a864
JH
519d_statfs_f_flags=''
520d_statfs_s=''
104d25b7
JH
521d_fstatvfs=''
522d_statvfs=''
c2960299
AD
523d_stdio_cnt_lval=''
524d_stdio_ptr_lval=''
16d20bd9 525d_stdiobase=''
2304df62 526d_stdstdio=''
16d20bd9
AD
527stdio_base=''
528stdio_bufsiz=''
529stdio_cnt=''
dfe9444c 530stdio_filbuf=''
16d20bd9 531stdio_ptr=''
2304df62
AD
532d_index=''
533d_strchr=''
a0d0e21e 534d_strcoll=''
2304df62
AD
535d_strctcpy=''
536d_strerrm=''
537d_strerror=''
538d_sysernlst=''
539d_syserrlst=''
a89d8a78
DH
540d_strtod=''
541d_strtol=''
ff935051 542d_strtold=''
76d49b1c 543d_strtoll=''
a89d8a78 544d_strtoul=''
ff935051
JH
545d_strtoull=''
546d_strtouq=''
a0d0e21e 547d_strxfrm=''
2304df62
AD
548d_symlink=''
549d_syscall=''
a0d0e21e 550d_sysconf=''
2304df62 551d_system=''
a0d0e21e
LW
552d_tcgetpgrp=''
553d_tcsetpgrp=''
cb86ce0e 554d_telldirproto=''
85e6fe83
LW
555d_time=''
556timetype=''
2304df62
AD
557clocktype=''
558d_times=''
559d_truncate=''
a0d0e21e
LW
560d_tzname=''
561d_umask=''
bd89102f
AD
562d_semctl_semid_ds=''
563d_semctl_semun=''
564d_union_semun=''
0545a864 565d_ustat=''
2304df62 566d_vfork=''
a0d0e21e 567usevfork=''
2304df62
AD
568d_voidsig=''
569signal_t=''
570d_volatile=''
571d_charvspr=''
572d_vprintf=''
573d_wait4=''
574d_waitpid=''
a0d0e21e
LW
575d_wcstombs=''
576d_wctomb=''
577dlext=''
85e6fe83
LW
578cccdlflags=''
579ccdlflags=''
2304df62 580dlsrc=''
232e078e 581ld=''
85e6fe83 582lddlflags=''
2304df62 583usedl=''
693762b4 584doublesize=''
5ff3f7a4 585ebcdic=''
66fe083f 586fflushNULL=''
767df6a1 587fflushall=''
8175356b 588fpossize=''
a0d0e21e 589fpostype=''
a22e52b9 590gidformat=''
785fb66b
JH
591gidsign=''
592gidsize=''
2304df62
AD
593gidtype=''
594groupstype=''
595h_fcntl=''
596h_sysfile=''
5ff3f7a4 597i_arpainet=''
ecfc5424
AD
598db_hashtype=''
599db_prefixtype=''
a0d0e21e 600i_db=''
2304df62 601i_dbm=''
8e07c86e 602i_rpcsvcdbm=''
2304df62 603d_dirnamlen=''
a0d0e21e 604direntrytype=''
2304df62 605i_dirent=''
a0d0e21e 606i_dld=''
2304df62
AD
607i_dlfcn=''
608i_fcntl=''
a0d0e21e 609i_float=''
2304df62 610i_gdbm=''
28e8609d 611d_grpasswd=''
2304df62 612i_grp=''
43999f95 613i_iconv=''
5ff3f7a4 614i_inttypes=''
a0d0e21e 615i_limits=''
4633a7c4 616i_locale=''
7f3d1cf1 617i_machcthr=''
a0d0e21e
LW
618i_malloc=''
619i_math=''
85e6fe83 620i_memory=''
e7fb4fcc 621i_mntent=''
2304df62 622i_ndbm=''
3fd537d4 623i_netdb=''
85e6fe83 624i_neterrno=''
9cc6feab 625i_netinettcp=''
2304df62
AD
626i_niin=''
627i_sysin=''
5b34fd99 628i_poll=''
c4747d3e 629i_pthread=''
2304df62
AD
630d_pwage=''
631d_pwchange=''
632d_pwclass=''
633d_pwcomment=''
634d_pwexpire=''
c4f23d77 635d_pwgecos=''
28e8609d 636d_pwpasswd=''
2304df62
AD
637d_pwquota=''
638i_pwd=''
760ac839 639i_sfio=''
f1066039 640i_shadow=''
86959918 641i_socks=''
2304df62 642i_stddef=''
a0d0e21e 643i_stdlib=''
2304df62
AD
644i_string=''
645strings=''
5ff3f7a4 646i_sysaccess=''
2304df62
AD
647i_sysdir=''
648i_sysfile=''
649d_voidtty=''
650i_bsdioctl=''
a0d0e21e 651i_sysfilio=''
2304df62
AD
652i_sysioctl=''
653i_syssockio=''
ca52efda 654i_syslog=''
fe749a9f 655i_sysmman=''
104d25b7 656i_sysmount=''
2304df62 657i_sysndir=''
a0d0e21e 658i_sysparam=''
8ff267be 659i_sysresrc=''
5ff3f7a4 660i_syssecrt=''
2304df62 661i_sysselct=''
1aef975c 662i_sysstat=''
0545a864 663i_sysstatfs=''
104d25b7 664i_sysstatvfs=''
a0d0e21e 665i_systimes=''
fed7345c 666i_systypes=''
de4597cb 667i_sysuio=''
25f94b33 668i_sysun=''
d4935d7f 669i_sysutsname=''
0545a864 670i_sysvfs=''
8ff267be 671i_syswait=''
2304df62
AD
672i_sgtty=''
673i_termio=''
674i_termios=''
675i_systime=''
676i_systimek=''
677i_time=''
678timeincl=''
85e6fe83 679i_unistd=''
0545a864 680i_ustat=''
2304df62 681i_utime=''
760ac839 682i_values=''
a0d0e21e 683i_stdarg=''
2304df62
AD
684i_varargs=''
685i_varhdr=''
686i_vfork=''
ff935051 687inc_version_list=''
3a096bf3 688inc_version_list_init=''
dd4e71fd
JH
689installprefix=''
690installprefixexp=''
691installstyle=''
104d25b7 692installusrbinperl=''
2304df62 693intsize=''
24fef2a7
AD
694longsize=''
695shortsize=''
d9b3e12d 696d_fpos64_t=''
2000072c 697d_off64_t=''
2304df62 698libc=''
5cf1d1f1 699ldlibpthname=''
8ff267be 700libperl=''
2afac517 701shrpenv=''
8ff267be 702useshrplib=''
a0d0e21e 703glibpth=''
2304df62 704libpth=''
8e07c86e 705loclibpth=''
2304df62
AD
706plibpth=''
707xlibpth=''
1cfa4ec7 708ignore_versioned_solibs=''
2304df62 709libs=''
43999f95
JH
710libsdirs=''
711libsfiles=''
712libsfound=''
85e6fe83 713lns=''
cf2093f6
JH
714d_PRIEldbl=''
715d_PRIFldbl=''
716d_PRIGldbl=''
717d_PRIeldbl=''
718d_PRIfldbl=''
719d_PRIgldbl=''
720sPRIEldbl=''
721sPRIFldbl=''
722sPRIGldbl=''
723sPRIeldbl=''
724sPRIfldbl=''
725sPRIgldbl=''
5ff3f7a4 726lseeksize=''
85e6fe83 727lseektype=''
8ff267be 728make_set_make=''
85e6fe83 729d_mymalloc=''
94b6baf5 730freetype=''
2304df62
AD
731mallocobj=''
732mallocsrc=''
733malloctype=''
734usemymalloc=''
16d20bd9
AD
735installman1dir=''
736man1dir=''
737man1direxp=''
738man1ext=''
739installman3dir=''
740man3dir=''
741man3direxp=''
742man3ext=''
2304df62
AD
743huge=''
744large=''
745medium=''
746models=''
747small=''
748split=''
a0d0e21e 749modetype=''
68c15b6f 750multiarch=''
2304df62
AD
751mydomain=''
752myhostname=''
753phostname=''
754c=''
755n=''
8e07c86e
AD
756d_eofnblk=''
757eagain=''
758o_nonblock=''
759rd_nodata=''
dfe9444c
AD
760netdb_hlen_type=''
761netdb_host_type=''
762netdb_name_type=''
763netdb_net_type=''
2304df62
AD
764groupcat=''
765hostcat=''
766passcat=''
85e6fe83
LW
767orderlib=''
768ranlib=''
2304df62
AD
769package=''
770spackage=''
2c7991dc 771pager=''
ff935051
JH
772api_revision=''
773api_subversion=''
774api_version=''
775api_versionstring=''
ecfc5424 776patchlevel=''
760ac839 777subversion=''
bfb7748a 778version=''
8e07c86e 779perladmin=''
4633a7c4 780perlpath=''
78691af5 781d_nv_preserves_uv=''
8175356b
JH
782i16size=''
783i16type=''
784i32size=''
785i32type=''
786i64size=''
787i64type=''
788i8size=''
789i8type=''
790ivsize=''
791ivtype=''
792nvsize=''
793nvtype=''
794u16size=''
795u16type=''
796u32size=''
797u32type=''
798u64size=''
799u64type=''
800u8size=''
801u8type=''
802uvsize=''
803uvtype=''
804ivdformat=''
805uvoformat=''
806uvuformat=''
807uvxformat=''
dfe9444c 808pidtype=''
a0d0e21e 809prefix=''
1aef975c 810prefixexp=''
2304df62
AD
811installprivlib=''
812privlib=''
813privlibexp=''
814prototype=''
693762b4 815ptrsize=''
cf2093f6
JH
816d_PRIX64=''
817d_PRId64=''
818d_PRIi64=''
819d_PRIo64=''
820d_PRIu64=''
821d_PRIx64=''
822sPRIX64=''
823sPRId64=''
824sPRIi64=''
825sPRIo64=''
826sPRIu64=''
827sPRIx64=''
de1c2614 828d_quad=''
6b8eaf93 829quadkind=''
d7d93a81
JH
830quadtype=''
831uquadtype=''
85ab1d1d 832drand01=''
2304df62 833randbits=''
85ab1d1d
JH
834randfunc=''
835randseedtype=''
836seedfunc=''
2304df62
AD
837installscript=''
838scriptdir=''
839scriptdirexp=''
5ff3f7a4 840selectminbits=''
a0d0e21e 841selecttype=''
8ff267be 842sh=''
af4c28eb 843sig_count=''
2304df62 844sig_name=''
dfe9444c 845sig_name_init=''
8e07c86e 846sig_num=''
824a2ba3 847sig_num_init=''
4633a7c4
LW
848installsitearch=''
849sitearch=''
850sitearchexp=''
717c4fcc
JH
851installsitebin=''
852sitebin=''
853sitebinexp=''
25f94b33
AD
854installsitelib=''
855sitelib=''
856sitelibexp=''
dd4e71fd
JH
857siteprefix=''
858siteprefixexp=''
a0d0e21e
LW
859sizetype=''
860so=''
2304df62
AD
861sharpbang=''
862shsharp=''
863spitshell=''
dfe9444c 864src=''
a0d0e21e 865ssizetype=''
4633a7c4 866startperl=''
2304df62
AD
867startsh=''
868stdchar=''
ed39a0f2 869d_stdio_stream_array=''
767df6a1 870stdio_stream_array=''
2304df62 871sysman=''
5ff3f7a4 872trnl=''
a22e52b9 873uidformat=''
57def98f 874uidsign=''
785fb66b 875uidsize=''
2304df62 876uidtype=''
85ab1d1d 877archname64=''
5ff3f7a4 878use64bits=''
249b38c6 879uselargefiles=''
b0ce926a 880uselongdouble=''
09458382 881usemorebits=''
85ab1d1d 882usemultiplicity=''
2304df62 883nm_opt=''
40a7a20a 884nm_so_opt=''
2304df62
AD
885runnm=''
886usenm=''
8ff267be 887useperlio=''
29209bc5 888usesocks=''
693762b4 889d_oldpthreads=''
aaacdc8b
GS
890use5005threads=''
891useithreads=''
dfe9444c 892usethreads=''
2304df62 893incpath=''
2304df62
AD
894mips_type=''
895usrinc=''
717c4fcc
JH
896d_vendorbin=''
897installvendorbin=''
898vendorbin=''
899vendorbinexp=''
a3635516
JH
900d_vendorlib=''
901installvendorlib=''
902vendorlib=''
903vendorlibexp=''
904usevendorprefix=''
905vendorprefix=''
906vendorprefixexp=''
2304df62
AD
907defvoidused=''
908voidflags=''
fe749a9f
JH
909pm_apiversion=''
910xs_apiversion=''
2304df62
AD
911CONFIG=''
912
ecfc5424
AD
913define='define'
914undef='undef'
915smallmach='pdp11 i8086 z8000 i80286 iAPX286'
916rmlist=''
917
918: We must find out about Eunice early
919eunicefix=':'
920if test -f /etc/unixtovms; then
921 eunicefix=/etc/unixtovms
922fi
923if test -f /etc/unixtovms.exe; then
924 eunicefix=/etc/unixtovms.exe
925fi
926
5ff3f7a4 927i_whoami=''
ff935051
JH
928: set useposix=false in your hint file to disable the POSIX extension.
929useposix=true
930: set useopcode=false in your hint file to disable the Opcode extension.
931useopcode=true
dfe9444c 932: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 933_exe=''
dfe9444c
AD
934: Extra object files, if any, needed on this platform.
935archobjs=''
ff935051
JH
936: Possible local include directories to search.
937: Set locincpth to "" in a hint file to defeat local include searches.
938locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
939locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
940:
941: no include file wanted by default
942inclwanted=''
943
dfe9444c 944groupstype=''
732c9516
JH
945: change the next line if compiling for Xenix/286 on Xenix/386
946xlibpth='/usr/lib/386 /lib/386'
947
948: Possible local library directories to search.
949loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
950loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
951
952: general looking path for locating libraries
f7dd4e7f 953glibpth="/usr/lib/large /lib/pa1.1 /lib /usr/lib $xlibpth"
732c9516
JH
954glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
955glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
956test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
957test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
958
959: Private path used by Configure to find libraries. Its value
960: is prepended to libpth. This variable takes care of special
961: machines, like the mips. Usually, it should be empty.
962plibpth=''
963
1cfa4ec7
GS
964: default library list
965libswanted=''
921b2963 966: some systems want to use only the non-versioned libso:s
1cfa4ec7 967ignore_versioned_solibs=''
85ab1d1d 968: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 969: set usesocks on the Configure command line to enable socks.
dfe9444c 970: set usethreads on the Configure command line to enable threads.
ff935051
JH
971: full support for void wanted by default
972defvoidused=15
973
ecfc5424 974: List of libraries we want.
693762b4
AD
975: If anyone needs -lnet, put it in a hint file.
976libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 977libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 978libswanted="$libswanted ndir dir crypt sec"
ecfc5424 979libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 980: We probably want to search /usr/shlib before most other libraries.
94b6baf5 981: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
982glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
983glibpth="/usr/shlib $glibpth"
984: Do not use vfork unless overridden by a hint file.
985usevfork=false
986
8ff267be 987: Find the basic shell for Bourne shell scripts
988case "$sh" in
989'')
8ff267be 990 case "$SYSTYPE" in
991 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
992 *) xxx='/bin/sh';;
993 esac
994 if test -f "$xxx"; then
995 sh="$xxx"
996 else
997 : Build up a list and do a single loop so we can 'break' out.
998 pth=`echo $PATH | sed -e "s/$p_/ /g"`
999 for xxx in sh bash ksh pdksh ash; do
1000 for p in $pth; do
1001 try="$try ${p}/${xxx}"
1002 done
1003 done
1004 for xxx in $try; do
1005 if test -f "$xxx"; then
1006 sh="$xxx";
8ff267be 1007 break
1008 elif test -f "$xxx.exe"; then
1009 sh="$xxx";
8ff267be 1010 break
1011 fi
1012 done
1013 fi
1014 ;;
1015esac
1016
1017case "$sh" in
1018'') cat <<EOM >&2
1019$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1020
8ff267be 1021Usually it's in /bin/sh. How did you even get this far?
46193409 1022Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 1023we'll try to straighten this all out.
8ff267be 1024EOM
1025 exit 1
1026 ;;
1027esac
1028
760ac839 1029: see if sh knows # comments
8ff267be 1030if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1031 shsharp=true
1032 spitshell=cat
760ac839
LW
1033 xcat=/bin/cat
1034 test -f $xcat || xcat=/usr/bin/cat
1035 echo "#!$xcat" >try
1036 $eunicefix try
1037 chmod +x try
1038 ./try > today
1039 if test -s today; then
760ac839
LW
1040 sharpbang='#!'
1041 else
1042 echo "#! $xcat" > try
1043 $eunicefix try
1044 chmod +x try
1045 ./try > today
1046 if test -s today; then
760ac839
LW
1047 sharpbang='#! '
1048 else
760ac839
LW
1049 sharpbang=': use '
1050 fi
1051 fi
1052else
dfe9444c 1053 echo " "
8ff267be 1054 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1055 shsharp=false
1056 cd ..
1057 echo "exec grep -v '^[ ]*#'" >spitshell
1058 chmod +x spitshell
1059 $eunicefix spitshell
1060 spitshell=`pwd`/spitshell
1061 cd UU
1062 echo "I presume that if # doesn't work, #! won't work either!"
1063 sharpbang=': use '
1064fi
1065rm -f try today
1066
1067: figure out how to guarantee sh startup
8ff267be 1068case "$startsh" in
1069'') startsh=${sharpbang}${sh} ;;
1070*)
760ac839 1071esac
760ac839
LW
1072cat >try <<EOSS
1073$startsh
1074set abc
1075test "$?abc" != 1
1076EOSS
1077
1078chmod +x try
1079$eunicefix try
1080if ./try; then
8ff267be 1081 : echo "Yup, it does."
760ac839 1082else
dfe9444c
AD
1083 echo "Hmm... '$startsh' does not guarantee sh startup..."
1084 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1085fi
1086rm -f try
1087
aebf16e7
AD
1088
1089: Save command line options in file UU/cmdline.opt for later use in
1090: generating config.sh.
1091cat > cmdline.opt <<EOSH
1092# Configure command line arguments.
1093config_arg0='$0'
1094config_args='$*'
1095config_argc=$#
1096EOSH
1097argn=1
1098for arg in "$@"; do
1099 cat >>cmdline.opt <<EOSH
1100config_arg$argn='$arg'
1101EOSH
1102 argn=`expr $argn + 1`
1103done
1104
2304df62
AD
1105: produce awk script to parse command line options
1106cat >options.awk <<'EOF'
1107BEGIN {
02e93a22 1108 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1109
1110 len = length(optstr);
1111 for (i = 1; i <= len; i++) {
1112 c = substr(optstr, i, 1);
1113 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1114 if (a == ":") {
1115 arg[c] = 1;
1116 i++;
1117 }
1118 opt[c] = 1;
1119 }
1120}
1121{
1122 expect = 0;
1123 str = $0;
1124 if (substr(str, 1, 1) != "-") {
1125 printf("'%s'\n", str);
1126 next;
1127 }
1128 len = length($0);
1129 for (i = 2; i <= len; i++) {
1130 c = substr(str, i, 1);
1131 if (!opt[c]) {
1132 printf("-%s\n", substr(str, i));
1133 next;
1134 }
1135 printf("-%s\n", c);
1136 if (arg[c]) {
1137 if (i < len)
1138 printf("'%s'\n", substr(str, i + 1));
1139 else
1140 expect = 1;
1141 next;
1142 }
1143 }
1144}
1145END {
1146 if (expect)
1147 print "?";
1148}
1149EOF
1150
1151: process the command line options
4633a7c4
LW
1152set X `for arg in "$@"; do echo "X$arg"; done |
1153 sed -e s/X// | awk -f options.awk`
2304df62
AD
1154eval "set $*"
1155shift
1156rm -f options.awk
1157
1158: set up default values
1159fastread=''
1160reuseval=false
1161config_sh=''
1162alldone=''
1163error=''
1164silent=''
1165extractsh=''
ecfc5424 1166override=''
16d20bd9 1167knowitall=''
02e93a22 1168rm -f optdef.sh posthint.sh
28757baa 1169cat >optdef.sh <<EOS
1170$startsh
1171EOS
2304df62 1172
dfe9444c 1173
2304df62
AD
1174: option parsing
1175while test $# -gt 0; do
1176 case "$1" in
1177 -d) shift; fastread=yes;;
1178 -e) shift; alldone=cont;;
1179 -f)
1180 shift
1181 cd ..
1182 if test -r "$1"; then
1183 config_sh="$1"
1184 else
a0d0e21e 1185 echo "$me: cannot read config file $1." >&2
2304df62
AD
1186 error=true
1187 fi
1188 cd UU
1189 shift;;
1190 -h) shift; error=true;;
1191 -r) shift; reuseval=true;;
dfe9444c 1192 -s) shift; silent=true; realsilent=true;;
2304df62 1193 -E) shift; alldone=exit;;
16d20bd9 1194 -K) shift; knowitall=true;;
ecfc5424 1195 -O) shift; override=true;;
dfe9444c 1196 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1197 -D)
1198 shift
1199 case "$1" in
1200 *=)
1201 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1202 echo "$me: ignoring -D $1" >&2
1203 ;;
ecfc5424 1204 *=*) echo "$1" | \
1aef975c
AD
1205 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1206 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1207 esac
1208 shift
1209 ;;
1210 -U)
1211 shift
1212 case "$1" in
1aef975c 1213 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1214 *=*)
1215 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1216 echo "$me: ignoring -U $1" >&2
1217 ;;
1aef975c 1218 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1219 esac
1220 shift
1221 ;;
02e93a22
JH
1222 -A)
1223 shift
1224 xxx=''
1225 yyy="$1"
02e93a22 1226 zzz=''
5f83a3e9 1227 uuu=undef
02e93a22 1228 case "$yyy" in
5f83a3e9
JH
1229 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1230 case "$zzz" in
1231 *:*) zzz='' ;;
1232 *) xxx=append
1233 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1234 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1235 esac
1236 ;;
1237 esac
1238 case "$xxx" in
1239 '') case "$yyy" in
1240 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1241 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1242 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1243 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1244 *) xxx=`echo $yyy|sed 's!:.*!!'`
1245 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1246 esac
1247 ;;
1248 esac
02e93a22
JH
1249 case "$xxx" in
1250 append)
5f83a3e9 1251 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1252 clear)
5f83a3e9 1253 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1254 define)
1255 case "$zzz" in
1256 '') zzz=define ;;
1257 esac
5f83a3e9 1258 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1259 eval)
5f83a3e9 1260 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1261 prepend)
5f83a3e9 1262 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1263 undef)
1264 case "$zzz" in
1265 '') zzz="$uuu" ;;
1266 esac
5f83a3e9
JH
1267 echo "$yyy=$zzz" >> posthint.sh ;;
1268 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1269 esac
bde6b06b 1270 shift
02e93a22 1271 ;;
dfe9444c 1272 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1273 exit 0;;
2304df62 1274 --) break;;
a0d0e21e 1275 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1276 *) break;;
1277 esac
1278done
1279
1280case "$error" in
1281true)
1282 cat >&2 <<EOM
2afac517 1283Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1284 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1285 -d : use defaults for all answers.
1286 -e : go on without questioning past the production of config.sh.
1287 -f : specify an alternate default configuration file.
1288 -h : print this help message and exit (with an error status).
1289 -r : reuse C symbols value if possible (skips costly nm extraction).
1290 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1291 -D : define symbol to have some value:
1292 -D symbol symbol gets the value 'define'
1293 -D symbol=value symbol gets the value 'value'
2304df62 1294 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1295 -K : do not use unless you know what you are doing.
ecfc5424 1296 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1297 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1298 -U : undefine symbol:
1299 -U symbol symbol gets the value 'undef'
1300 -U symbol= symbol gets completely empty
02e93a22 1301 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1302 -A symbol=value append " "value to symbol
02e93a22
JH
1303 -A append:symbol=value append value to symbol
1304 -A define:symbol=value define symbol to have value
02e93a22
JH
1305 -A clear:symbol define symbol to be ''
1306 -A define:symbol define symbol to be 'define'
1307 -A eval:symbol=value define symbol to be eval of value
1308 -A prepend:symbol=value prepend value to symbol
1309 -A undef:symbol define symbol to be 'undef'
1310 -A undef:symbol= define symbol to be ''
2304df62
AD
1311 -V : print version number and exit (with a zero status).
1312EOM
1313 exit 1
1314 ;;
1315esac
1316
dfe9444c
AD
1317: Sanity checks
1318case "$fastread$alldone" in
1319yescont|yesexit) ;;
1320*)
1321 if test ! -t 0; then
1322 echo "Say 'sh Configure', not 'sh <Configure'"
1323 exit 1
1324 fi
1325 ;;
1326esac
1327
2304df62
AD
1328exec 4>&1
1329case "$silent" in
1330true) exec 1>/dev/null;;
1331esac
1332
ecfc5424 1333: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1334touch optdef.sh
1335. ./optdef.sh
02e93a22
JH
1336: create the posthint manipulation script and leave the file out there...
1337touch posthint.sh
a0d0e21e 1338
2304df62 1339: set package name
85e6fe83 1340package=perl5
1aef975c
AD
1341first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1342last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1343case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1344ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1345*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1346esac
2304df62 1347
2304df62
AD
1348: Some greps do not return status, grrr.
1349echo "grimblepritz" >grimble
1350if grep blurfldyick grimble >/dev/null 2>&1 ; then
1351 contains=contains
1352elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1353 contains=grep
1354else
1355 contains=contains
1356fi
1357rm -f grimble
1358: the following should work in any shell
1359case "$contains" in
1360contains*)
1361 echo " "
1362 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1363 cat >contains <<'EOSS'
1364grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1365EOSS
1366chmod +x contains
1367esac
1368
dfe9444c
AD
1369: Find the path to the source tree
1370case "$src" in
1371'') case "$0" in
b233458b
JH
1372 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1373 case "$src" in
1374 /*) ;;
1375 *) src=`cd ../$src && pwd` ;;
1376 esac
1377 ;;
dfe9444c
AD
1378 *) src='.';;
1379 esac;;
1380esac
1381case "$src" in
1382'') src=/
1383 rsrc=/
1384 ;;
1385/*) rsrc="$src";;
1386*) rsrc="../$src";;
1387esac
1388if test -f $rsrc/Configure && \
1389 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1390then
1391 : found it, so we are ok.
1392else
1393 rsrc=''
1394 for src in . .. ../.. ../../.. ../../../..; do
1395 if test -f ../$src/Configure && \
1396 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1397 then
1398 rsrc=../$src
1399 break
1400 fi
1401 done
1402fi
1403case "$rsrc" in
1404'')
1405 cat <<EOM >&4
1406
1407Sorry, I can't seem to locate the source dir for $package. Please start
1408Configure with an explicit path -- i.e. /some/path/Configure.
1409
1410EOM
1411 exit 1
1412 ;;
1413../.) rsrc='..';;
1414*)
1415 echo " "
1416 echo "Sources for $package found in \"$src\"." >&4
1417 ;;
1418esac
1419
1420: script used to extract .SH files with variable substitutions
1421cat >extract <<'EOS'
2000072c 1422CONFIGDOTSH=true
dfe9444c
AD
1423echo "Doing variable substitutions on .SH files..."
1424if test -f $src/MANIFEST; then
f7ab18e9 1425 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1426else
1427 echo "(Looking for .SH files under the source directory.)"
1428 set x `(cd $src; find . -name "*.SH" -print)`
1429fi
1430shift
1431case $# in
14320) set x `(cd $src; echo *.SH)`; shift;;
1433esac
1434if test ! -f $src/$1; then
1435 shift
1436fi
1437mkdir_p='
1438name=$1;
1439create="";
1440while test $name; do
1441 if test ! -d "$name"; then
1442 create="$name $create";
1443 name=`echo $name | sed -e "s|^[^/]*$||"`;
1444 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1445 else
1446 name="";
1447 fi;
1448done;
1449for file in $create; do
1450 mkdir $file;
1451done
1452'
1453for file in $*; do
1454 case "$src" in
1455 ".")
1456 case "$file" in
1457 */*)
1458 dir=`expr X$file : 'X\(.*\)/'`
1459 file=`expr X$file : 'X.*/\(.*\)'`
1460 (cd $dir && . ./$file)
1461 ;;
1462 *)
1463 . ./$file
1464 ;;
1465 esac
1466 ;;
1467 *)
1468 case "$file" in
1469 */*)
1470 dir=`expr X$file : 'X\(.*\)/'`
1471 file=`expr X$file : 'X.*/\(.*\)'`
1472 (set x $dir; shift; eval $mkdir_p)
1473 sh <$src/$dir/$file
1474 ;;
1475 *)
1476 sh <$src/$file
1477 ;;
1478 esac
1479 ;;
1480 esac
1481done
1482if test -f $src/config_h.SH; then
1483 if test ! -f config.h; then
1484 : oops, they left it out of MANIFEST, probably, so do it anyway.
1485 . $src/config_h.SH
1486 fi
1487fi
1488EOS
1489
1490: extract files and exit if asked to do so
1491case "$extractsh" in
1492true)
1493 case "$realsilent" in
1494 true) ;;
1495 *) exec 1>&4;;
1496 esac
1497 case "$config_sh" in
1498 '') config_sh='config.sh';;
1499 esac
1500 echo " "
1501 echo "Fetching answers from $config_sh..."
1502 cd ..
1503 . $config_sh
1504 test "$override" && . ./optdef.sh
1505 echo " "
1506 . UU/extract
1507 rm -rf UU
1508 echo "Done."
1509 exit 0
1510 ;;
1511esac
1512
1513: Eunice requires " " instead of "", can you believe it
1514echo " "
1515: Here we go...
1516echo "Beginning of configuration questions for $package."
1517
1518trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1519
2304df62
AD
1520: first determine how to suppress newline on echo command
1521echo " "
1522echo "Checking echo to see how to suppress newlines..."
1523(echo "hi there\c" ; echo " ") >.echotmp
1524if $contains c .echotmp >/dev/null 2>&1 ; then
1525 echo "...using -n."
1526 n='-n'
1527 c=''
1528else
1529 cat <<'EOM'
1530...using \c
1531EOM
1532 n=''
1533 c='\c'
1534fi
1535echo $n "The star should be here-->$c"
1536echo '*'
1537rm -f .echotmp
1538
1539: Now test for existence of everything in MANIFEST
1540echo " "
dfe9444c 1541if test -f $rsrc/MANIFEST; then
2304df62 1542 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1543 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1544 rm -f missing
dfe9444c 1545 tmppwd=`pwd`
2304df62 1546 for filelist in x??; do
dfe9444c 1547 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1548 done
1549 if test -s missing; then
1550 cat missing >&4
1551 cat >&4 <<'EOM'
1552
1553THIS PACKAGE SEEMS TO BE INCOMPLETE.
1554
1555You have the option of continuing the configuration process, despite the
1556distinct possibility that your kit is damaged, by typing 'y'es. If you
1557do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1558and contact the author (perlbug@perl.com).
2304df62
AD
1559
1560EOM
1561 echo $n "Continue? [n] $c" >&4
1562 read ans
1563 case "$ans" in
1564 y*)
1565 echo "Continuing..." >&4
1566 rm -f missing
1567 ;;
1568 *)
1569 echo "ABORTING..." >&4
1570 kill $$
1571 ;;
1572 esac
1573 else
dfe9444c 1574 echo "Looks good..."
2304df62
AD
1575 fi
1576else
1577 echo "There is no MANIFEST file. I hope your kit is complete !"
1578fi
1579rm -f missing x??
1580
5ff3f7a4
GS
1581echo " "
1582: Find the appropriate value for a newline for tr
1583if test -n "$DJGPP"; then
1584 trnl='\012'
1585fi
1586if test X"$trnl" = X; then
1587 case "`echo foo|tr '\n' x 2>/dev/null`" in
1588 foox) trnl='\n' ;;
1589 esac
1590fi
1591if test X"$trnl" = X; then
1592 case "`echo foo|tr '\012' x 2>/dev/null`" in
1593 foox) trnl='\012' ;;
1594 esac
1595fi
1596if test X"$trnl" = X; then
1597 cat <<EOM >&2
1598
1599$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1600
1601EOM
1602 exit 1
1603fi
1604
2304df62
AD
1605: compute the number of columns on the terminal for proper question formatting
1606case "$COLUMNS" in
1607'') COLUMNS='80';;
1608esac
1609
1610: set up the echo used in my read
1611myecho="case \"\$xxxm\" in
1612'') echo $n \"\$rp $c\" >&4;;
1613*) case \"\$rp\" in
1614 '') echo $n \"[\$xxxm] $c\";;
1615 *)
1616 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1617 echo \"\$rp\" >&4
1618 echo $n \"[\$xxxm] $c\" >&4
1619 else
1620 echo $n \"\$rp [\$xxxm] $c\" >&4
1621 fi
1622 ;;
1623 esac;;
1624esac"
1625
1626: now set up to do reads with possible shell escape and default assignment
1627cat <<EOSC >myread
28757baa 1628$startsh
2304df62
AD
1629xxxm=\$dflt
1630$myecho
1631ans='!'
1632case "\$fastread" in
1633yes) case "\$dflt" in
1634 '') ;;
1635 *) ans='';
1636 case "\$silent-\$rp" in
1637 true-) ;;
1638 *) echo " " >&4;;
1639 esac;;
1640 esac;;
1641*) case "\$silent" in
1642 true) case "\$rp" in
1643 '') ans='';;
1644 esac;;
1645 esac;;
1646esac
1647while expr "X\$ans" : "X!" >/dev/null; do
1648 read answ
1649 set x \$xxxm
1650 shift
dfe9444c 1651 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1652 case "\$answ" in
dfe9444c
AD
1653 "!")
1654 sh 1>&4
1655 echo " "
1656 $myecho
1657 ;;
1658 !*)
1659 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1660 shift
1661 sh 1>&4 -c "\$*"
1662 echo " "
1663 $myecho
1664 ;;
2304df62
AD
1665 "\$ans")
1666 case "\$ans" in
ecfc5424
AD
1667 \\&*)
1668 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1669 shift
1670 case "\$1" in
1671 -d)
1672 fastread=yes
40a7a20a 1673 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1674 ;;
1675 -*)
40a7a20a 1676 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1677 ;;
1678 esac
1679 $myecho
1680 ans=!
1681 ;;
2304df62
AD
1682 esac;;
1683 *)
1684 case "\$aok" in
1685 y)
1686 echo "*** Substitution done -- please confirm."
1687 xxxm="\$ans"
c9795ab7 1688 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1689 xxxm="\$ans"
1690 ans=!
1691 ;;
1692 *)
1693 echo "*** Error -- try again."
1694 ans=!
1695 ;;
1696 esac
1697 $myecho
1698 ;;
1699 esac
1700 case "\$ans\$xxxm\$nostick" in
1701 '')
1702 ans=!
1703 $myecho
1704 ;;
1705 esac
1706done
1707case "\$ans" in
1708'') ans="\$xxxm";;
1709esac
1710EOSC
1711
1712: create .config dir to save info across Configure sessions
1713test -d ../.config || mkdir ../.config
1714cat >../.config/README <<EOF
1715This directory created by Configure to save information that should
dfe9444c 1716persist across sessions for $package.
2304df62
AD
1717
1718You may safely delete it if you wish.
1719EOF
1720
1721: general instructions
1722needman=true
1723firsttime=true
760ac839 1724user=`(logname) 2>/dev/null`
dfe9444c
AD
1725case "$user" in
1726'') user=`whoami 2>&1`;;
760ac839 1727esac
2304df62
AD
1728if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1729 firsttime=false
1730 echo " "
1731 rp='Would you like to see the instructions?'
1732 dflt=n
1733 . ./myread
1734 case "$ans" in
1735 [yY]*) ;;
1736 *) needman=false;;
1737 esac
1738fi
1739if $needman; then
1740 cat <<EOH
4e2a5f63 1741
2304df62 1742This installation shell script will examine your system and ask you questions
a0d0e21e 1743to determine how the perl5 package should be installed. If you get
2304df62
AD
1744stuck on a question, you may use a ! shell escape to start a subshell or
1745execute a command. Many of the questions will have default answers in square
1746brackets; typing carriage return will give you the default.
1747
1748On some of the questions which ask for file or directory names you are allowed
1749to use the ~name construct to specify the login directory belonging to "name",
1750even if you don't have a shell which knows about that. Questions where this is
1751allowed will be marked "(~name ok)".
1752
1753EOH
1754 rp=''
1755 dflt='Type carriage return to continue'
1756 . ./myread
1757 cat <<'EOH'
1758
1759The prompter used in this script allows you to use shell variables and
1760backticks in your answers. You may use $1, $2, etc... to refer to the words
1761in the default answer, as if the default line was a set of arguments given to a
1762script shell. This means you may also use $* to repeat the whole default line,
1763so you do not have to re-type everything to add something to the default.
1764
1765Everytime there is a substitution, you will have to confirm. If there is an
1766error (e.g. an unmatched backtick), the default answer will remain unchanged
1767and you will be prompted again.
1768
1769If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1770the questions and use the computed defaults (or the previous answers if there
1771was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1772You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1773on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1774
1775EOH
1776 . ./myread
1777 cat <<EOH
1778
1779Much effort has been expended to ensure that this shell script will run on any
1780Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1781Configure and run it again. If you can't run Configure for some reason,
1782you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1783have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1784
1785This installation script affects things in two ways:
1786
17871) it may do direct variable substitutions on some of the files included
1788 in this kit.
17892) it builds a config.h file for inclusion in C programs. You may edit
1790 any of these files as the need arises after running this script.
1791
1792If you make a mistake on a question, there is no easy way to back up to it
1793currently. The easiest thing to do is to edit config.sh and rerun all the SH
1794files. Configure will offer to let you do this before it runs the SH files.
1795
1796EOH
1797 dflt='Type carriage return to continue'
1798 . ./myread
1799 case "$firsttime" in
1800 true) echo $user >>../.config/instruct;;
1801 esac
1802fi
1803
2304df62
AD
1804: find out where common programs are
1805echo " "
1806echo "Locating common programs..." >&4
1807cat <<EOSC >loc
1808$startsh
1809case \$# in
18100) exit 1;;
1811esac
1812thing=\$1
1813shift
1814dflt=\$1
1815shift
1816for dir in \$*; do
1817 case "\$thing" in
1818 .)
1819 if test -d \$dir/\$thing; then
1820 echo \$dir
1821 exit 0
1822 fi
1823 ;;
1824 *)
a0d0e21e 1825 for thisthing in \$dir/\$thing; do
ecfc5424 1826 : just loop through to pick last item
a0d0e21e 1827 done
25f94b33 1828 if test -f \$thisthing; then
a0d0e21e 1829 echo \$thisthing
2304df62
AD
1830 exit 0
1831 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1832 if test -n "$DJGPP"; then
1833 echo \$dir/\$thing.exe
1834 else
1835 : on Eunice apparently
1836 echo \$dir/\$thing
1837 fi
2304df62
AD
1838 exit 0
1839 fi
1840 ;;
1841 esac
1842done
1843echo \$dflt
1844exit 1
1845EOSC
1846chmod +x loc
1847$eunicefix loc
1848loclist="
1849awk
1850cat
ecfc5424 1851comm
2304df62
AD
1852cp
1853echo
1854expr
1855grep
a0d0e21e 1856ls
dfe9444c 1857make
2304df62 1858mkdir
2304df62
AD
1859rm
1860sed
1861sort
85e6fe83 1862touch
2304df62
AD
1863tr
1864uniq
1865"
1866trylist="
1867Mcc
dfe9444c 1868ar
2304df62
AD
1869byacc
1870cpp
1871csh
1872date
1873egrep
8ff267be 1874gzip
2c7991dc 1875less
8ff267be 1876ln
2c7991dc 1877more
693762b4 1878nm
2304df62 1879nroff
aaacdc8b 1880perl
2c7991dc 1881pg
2304df62
AD
1882test
1883uname
8ff267be 1884zip
2304df62 1885"
8e07c86e 1886pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1887pth="$pth /lib /usr/lib"
1888for file in $loclist; do
dfe9444c
AD
1889 eval xxx=\$$file
1890 case "$xxx" in
1891 /*|?:[\\/]*)
1892 if test -f "$xxx"; then
1893 : ok
1894 else
1895 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1896 xxx=`./loc $file $file $pth`
1897 fi
1898 ;;
1899 '') xxx=`./loc $file $file $pth`;;
1900 *) xxx=`./loc $xxx $xxx $pth`;;
1901 esac
2304df62
AD
1902 eval $file=$xxx
1903 eval _$file=$xxx
1904 case "$xxx" in
1905 /*)
1906 echo $file is in $xxx.
1907 ;;
8e07c86e
AD
1908 ?:[\\/]*)
1909 echo $file is in $xxx.
1910 ;;
2304df62 1911 *)
25f94b33
AD
1912 echo "I don't know where '$file' is, and my life depends on it." >&4
1913 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1914 exit 1
2304df62
AD
1915 ;;
1916 esac
1917done
1918echo " "
1919echo "Don't worry if any of the following aren't found..."
1920say=offhand
1921for file in $trylist; do
dfe9444c
AD
1922 eval xxx=\$$file
1923 case "$xxx" in
1924 /*|?:[\\/]*)
1925 if test -f "$xxx"; then
1926 : ok
1927 else
1928 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1929 xxx=`./loc $file $file $pth`
1930 fi
1931 ;;
1932 '') xxx=`./loc $file $file $pth`;;
1933 *) xxx=`./loc $xxx $xxx $pth`;;
1934 esac
2304df62
AD
1935 eval $file=$xxx
1936 eval _$file=$xxx
1937 case "$xxx" in
1938 /*)
1939 echo $file is in $xxx.
1940 ;;
8e07c86e
AD
1941 ?:[\\/]*)
1942 echo $file is in $xxx.
1943 ;;
2304df62
AD
1944 *)
1945 echo "I don't see $file out there, $say."
1946 say=either
1947 ;;
1948 esac
1949done
1950case "$egrep" in
1951egrep)
1952 echo "Substituting grep for egrep."
1953 egrep=$grep
1954 ;;
1955esac
8ff267be 1956case "$ln" in
1957ln)
1958 echo "Substituting cp for ln."
1959 ln=$cp
1960 ;;
1961esac
2304df62
AD
1962case "$test" in
1963test)
1964 echo "Hopefully test is built into your sh."
1965 ;;
1966*)
ecfc5424 1967 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1968 echo "Using the test built into your sh."
1969 test=test
1970 _test=test
1971 fi
1972 ;;
1973esac
1974case "$echo" in
1975echo)
1976 echo "Hopefully echo is built into your sh."
1977 ;;
1978'') ;;
1979*)
1980 echo " "
1981echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1982 $echo $n "hi there$c" >foo1
1983 echo $n "hi there$c" >foo2
1984 if cmp foo1 foo2 >/dev/null 2>&1; then
1985 echo "They are compatible. In fact, they may be identical."
1986 else
1987 case "$n" in
1988 '-n') n='' c='\c';;
1989 *) n='-n' c='';;
1990 esac
1991 cat <<FOO
1992They are not compatible! You are probably running ksh on a non-USG system.
1993I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1994have echo built in and we may have to run some Bourne shell scripts. That
1995means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1996
1997FOO
1998 $echo $n "The star should be here-->$c"
1999 $echo "*"
2000 fi
2001 $rm -f foo1 foo2
2002 ;;
2003esac
2004
a0d0e21e
LW
2005: determine whether symbolic links are supported
2006echo " "
2007$touch blurfl
2008if $ln -s blurfl sym > /dev/null 2>&1 ; then
2009 echo "Symbolic links are supported." >&4
2010 lns="$ln -s"
2011else
2012 echo "Symbolic links are NOT supported." >&4
2013 lns="$ln"
2014fi
2015$rm -f blurfl sym
2016
ecfc5424
AD
2017: see whether [:lower:] and [:upper:] are supported character classes
2018echo " "
ecfc5424
AD
2019case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2020ABYZ)
2021 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2022 up='[:upper:]'
2023 low='[:lower:]'
2024 ;;
28e8609d
JH
2025*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2026 # (0xc9 and 0xd1), therefore that is a nice testing point.
2027 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2028 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2029 ij) up='[A-Z]'
2030 low='[a-z]'
2031 ;;
2032 esac
2033 fi
2034 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2035 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2036 ij) up='A-Z'
2037 low='a-z'
2038 ;;
2039 esac
2040 fi
2041 if test "X$up" = X -o "X$low" = X; then
2042 case "`echo IJ | od -x 2>/dev/null`" in
2043 *C9D1*|*c9d1*)
2044 echo "Hey, this might be EBCDIC." >&4
2045 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2046 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2047 ij) up='[A-IJ-RS-Z]'
2048 low='[a-ij-rs-z]'
2049 ;;
2050 esac
2051 fi
2052 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2053 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2054 ij) up='A-IJ-RS-Z'
2055 low='a-ij-rs-z'
2056 ;;
2057 esac
2058 fi
2059 ;;
2060 esac
2061 fi
2062esac
3eaeeeae 2063case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2064ij)
2065 echo "Using $up and $low to convert case." >&4
2066 ;;
ecfc5424 2067*)
28e8609d
JH
2068 echo "I don't know how to translate letters from upper to lower case." >&4
2069 echo "Your tr is not acting any way I know of." >&4
2070 exit 1
2071 ;;
ecfc5424
AD
2072esac
2073: set up the translation script tr, must be called with ./tr of course
2074cat >tr <<EOSC
2075$startsh
2076case "\$1\$2" in
2077'[A-Z][a-z]') exec $tr '$up' '$low';;
2078'[a-z][A-Z]') exec $tr '$low' '$up';;
2079esac
2080exec $tr "\$@"
2081EOSC
2082chmod +x tr
2083$eunicefix tr
2084
2304df62
AD
2085: Try to determine whether config.sh was made on this system
2086case "$config_sh" in
2087'')
43999f95
JH
2088myuname=`$uname -a 2>/dev/null`
2089$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2090# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2091# because the A-Z/a-z are not consecutive.
a0d0e21e 2092myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2093 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2094newmyuname="$myuname"
2304df62 2095dflt=n
16d20bd9
AD
2096case "$knowitall" in
2097'')
2098 if test -f ../config.sh; then
2099 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2100 eval "`grep myuname= ../config.sh`"
2101 fi
2102 if test "X$myuname" = "X$newmyuname"; then
2103 dflt=y
2104 fi
2304df62 2105 fi
16d20bd9
AD
2106 ;;
2107*) dflt=y;;
2108esac
2304df62
AD
2109
2110: Get old answers from old config file if Configure was run on the
2111: same system, otherwise use the hints.
2112hint=default
2113cd ..
2114if test -f config.sh; then
16d20bd9
AD
2115 echo " "
2116 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2117 . UU/myread
2118 case "$ans" in
2119 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2120 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2121 tmp_n="$n"
2122 tmp_c="$c"
85cad39c 2123 tmp_sh="$sh"
2304df62
AD
2124 . ./config.sh
2125 cp config.sh UU
ecfc5424
AD
2126 n="$tmp_n"
2127 c="$tmp_c"
85cad39c 2128 : Older versions did not always set $sh. Catch re-use of such
2129 : an old config.sh.
2130 case "$sh" in
2131 '') sh="$tmp_sh" ;;
2132 esac
2304df62
AD
2133 hint=previous
2134 ;;
2135 esac
2136fi
2137if test ! -f config.sh; then
2138 $cat <<EOM
2139
4e2a5f63
AD
2140First time through, eh? I have some defaults handy for some systems
2141that need some extra help getting the Configure answers right:
2304df62
AD
2142
2143EOM
dfe9444c 2144 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2145 dflt=''
2146 : Half the following guesses are probably wrong... If you have better
46193409 2147 : tests or hints, please send them to perlbug@perl.com
2304df62 2148 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2149 $test -f /irix && osname=irix
85e6fe83
LW
2150 $test -f /xenix && osname=sco_xenix
2151 $test -f /dynix && osname=dynix
2152 $test -f /dnix && osname=dnix
5f05dabc 2153 $test -f /lynx.os && osname=lynxos
2154 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2155 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2156 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2157 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2158 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2159 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2160 $test -d /usr/apollo/bin && osname=apollo
2161 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2162 $test -d /usr/include/minix && osname=minix
e060872b 2163 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2164 osname=machten
4633a7c4 2165 if $test -x /sbin/version; then
dfe9444c 2166 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2167 $sed -e 's/[A-Za-z]$//'`
2168 elif $test -x /usr/etc/version; then
dfe9444c 2169 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2170 $sed -e 's/[A-Za-z]$//'`
2171 else
2172 osvers="$2.$3"
2173 fi
2174 fi
aaacdc8b
GS
2175
2176 $test -f /sys/posix.dll &&
2177 $test -f /usr/bin/what &&
2178 set X `/usr/bin/what /sys/posix.dll` &&
2179 $test "$3" = UWIN &&
2180 osname=uwin &&
2181 osvers="$5"
2182
2304df62
AD
2183 if $test -f $uname; then
2184 set X $myuname
2185 shift
2186
2304df62 2187 case "$5" in
85e6fe83 2188 fps*) osname=fps ;;
2304df62
AD
2189 mips*)
2190 case "$4" in
85e6fe83
LW
2191 umips) osname=umips ;;
2192 *) osname=mips ;;
2304df62 2193 esac;;
85e6fe83
LW
2194 [23]100) osname=mips ;;
2195 next*) osname=next ;;
ecfc5424 2196 i386*)
c6912327
JH
2197 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2198 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2199 osname='sco'
2200 osvers=$tmp
2201 elif $test -f /etc/kconfig; then
ecfc5424 2202 osname=isc
bd628c73 2203 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2204 osvers=4
2205 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2206 osvers=3
2304df62 2207 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2208 osvers=2
ecfc5424
AD
2209 fi
2210 fi
2000072c 2211 tmp=''
ecfc5424 2212 ;;
c4f23d77
AD
2213 pc*)
2214 if test -n "$DJGPP"; then
2215 osname=dos
2216 osvers=djgpp
2217 fi
2218 ;;
2304df62
AD
2219 esac
2220
2221 case "$1" in
a0d0e21e
LW
2222 aix) osname=aix
2223 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2224 case "$tmp" in
1aef975c 2225 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2226 '<3240'|'<>3240') osvers=3.2.0 ;;
2227 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2228 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2229 *) osvers=$tmp;;
a0d0e21e
LW
2230 esac
2231 ;;
aaacdc8b
GS
2232 bsd386) osname=bsd386
2233 osvers=`$uname -r`
2234 ;;
2235 cygwin*) osname=cygwin
2236 osvers="$3"
2237 ;;
23f87696
SZ
2238 *dc.osx) osname=dcosx
2239 osvers="$3"
2240 ;;
a0d0e21e
LW
2241 dnix) osname=dnix
2242 osvers="$3"
2243 ;;
2244 domainos) osname=apollo
2245 osvers="$3"
2246 ;;
2247 dgux) osname=dgux
2248 osvers="$3"
2249 ;;
760ac839 2250 dynixptx*) osname=dynixptx
e58e581d 2251 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2252 ;;
a0d0e21e
LW
2253 freebsd) osname=freebsd
2254 osvers="$3" ;;
2255 genix) osname=genix ;;
2256 hp*) osname=hpux
bfb7748a 2257 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2258 ;;
a78b0d02 2259 irix*) osname=irix
a0d0e21e
LW
2260 case "$3" in
2261 4*) osvers=4 ;;
2262 5*) osvers=5 ;;
ecfc5424 2263 *) osvers="$3" ;;
a0d0e21e
LW
2264 esac
2265 ;;
2266 linux) osname=linux
2267 case "$3" in
a0d0e21e
LW
2268 *) osvers="$3" ;;
2269 esac
2270 ;;
28e8609d
JH
2271 MiNT) osname=mint
2272 ;;
2273 netbsd*) osname=netbsd
ecfc5424
AD
2274 osvers="$3"
2275 ;;
4e81affe
MM
2276 news-os) osvers="$3"
2277 case "$3" in
2278 4*) osname=newsos4 ;;
2279 *) osname=newsos ;;
2280 esac
2281 ;;
aaacdc8b
GS
2282 next*) osname=next ;;
2283 POSIX-BC | posix-bc ) osname=posix-bc
2284 osvers="$3"
a0d0e21e 2285 ;;
ae3afa4e
TH
2286 powerux | power_ux | powermax_os | powermaxos | \
2287 powerunix | power_unix) osname=powerux
2288 osvers="$3"
2289 ;;
aaacdc8b
GS
2290 qnx) osname=qnx
2291 osvers="$4"
2292 ;;
a0d0e21e
LW
2293 solaris) osname=solaris
2294 case "$3" in
2295 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2296 *) osvers="$3" ;;
a0d0e21e
LW
2297 esac
2298 ;;
85e6fe83
LW
2299 sunos) osname=sunos
2300 case "$3" in
85e6fe83
LW
2301 5*) osname=solaris
2302 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2303 *) osvers="$3" ;;
2304df62
AD
2304 esac
2305 ;;
a0d0e21e 2306 titanos) osname=titanos
85e6fe83 2307 case "$3" in
a0d0e21e
LW
2308 1*) osvers=1 ;;
2309 2*) osvers=2 ;;
2310 3*) osvers=3 ;;
2311 4*) osvers=4 ;;
ecfc5424 2312 *) osvers="$3" ;;
2304df62
AD
2313 esac
2314 ;;
85e6fe83 2315 ultrix) osname=ultrix
ecfc5424 2316 osvers="$3"
2304df62 2317 ;;
28757baa 2318 osf1|mls+) case "$5" in
fed7345c
AD
2319 alpha)
2320 osname=dec_osf
313489a2 2321 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2322 ;;
2323 hp*) osname=hp_osf1 ;;
2324 mips) osname=mips_osf1 ;;
85e6fe83
LW
2325 esac
2326 ;;
0337d152
BG
2327 unixware) osname=svr5
2328 osvers="$4"
2329 ;;
2330 uts) osname=uts
a0d0e21e
LW
2331 osvers="$3"
2332 ;;
85e6fe83 2333 $2) case "$osname" in
2304df62 2334 *isc*) ;;
a0d0e21e 2335 *freebsd*) ;;
5f05dabc 2336 svr*)
a0d0e21e
LW
2337 : svr4.x or possibly later
2338 case "svr$3" in
2339 ${osname}*)
2340 osname=svr$3
2341 osvers=$4
2342 ;;
2343 esac
2344 case "$osname" in
2345 svr4.0)
2346 : Check for ESIX
2347 if test -f /stand/boot ; then
2348 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2349 if test -n "$INITPROG" -a -f "$INITPROG"; then
2350 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2351 if test -n "$isesix"; then
a0d0e21e
LW
2352 osname=esix4
2353 fi
2354 fi
2355 fi
2356 ;;
2357 esac
2358 ;;
2304df62 2359 *) if test -f /etc/systemid; then
a0d0e21e
LW
2360 osname=sco
2361 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2362 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2363 osvers=$1.$2.$3
c4f23d77 2364 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2365 osvers=$1.$2
c4f23d77 2366 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2367 osvers=$1
2304df62 2368 fi
a0d0e21e
LW
2369 else
2370 case "$osname" in
2371 '') : Still unknown. Probably a generic Sys V.
2372 osname="sysv"
2373 osvers="$3"
2374 ;;
2375 esac
2304df62
AD
2376 fi
2377 ;;
2378 esac
2379 ;;
a0d0e21e
LW
2380 *) case "$osname" in
2381 '') : Still unknown. Probably a generic BSD.
2382 osname="$1"
2383 osvers="$3"
2384 ;;
2385 esac
2386 ;;
2304df62
AD
2387 esac
2388 else
dfe9444c
AD
2389 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2390 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2391 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2392 osname=news_os
2304df62 2393 fi
dfe9444c 2394 $rm -f UU/kernel.what
8e07c86e
AD
2395 elif test -d c:/.; then
2396 set X $myuname
2397 osname=os2
2398 osvers="$5"
2304df62
AD
2399 fi
2400 fi
85e6fe83 2401
a0d0e21e
LW
2402 : Now look for a hint file osname_osvers, unless one has been
2403 : specified already.
2404 case "$hintfile" in
2405 ''|' ')
ecfc5424 2406 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2407 : Also try without trailing minor version numbers.
ecfc5424
AD
2408 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2409 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2410 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2411 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2412 case "$file" in
2413 '') dflt=none ;;
2414 *) case "$osvers" in
2415 '') dflt=$file
2416 ;;
dfe9444c 2417 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2418 dflt=$file
dfe9444c 2419 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2420 dflt=$xfile
dfe9444c 2421 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2422 dflt=$xxfile
dfe9444c 2423 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2424 dflt=$xxxfile
dfe9444c 2425 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2426 dflt=$xxxxfile
dfe9444c 2427 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2428 dflt="${osname}"
2429 else
2430 dflt=none
2431 fi
2432 ;;
2433 esac
85e6fe83
LW
2434 ;;
2435 esac
4e2a5f63
AD
2436 if $test -f Policy.sh ; then
2437 case "$dflt" in
2438 *Policy*) ;;
2439 none) dflt="Policy" ;;
2440 *) dflt="Policy $dflt" ;;
2441 esac
2442 fi
85e6fe83 2443 ;;
a0d0e21e 2444 *)
ecfc5424 2445 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2446 ;;
2304df62 2447 esac
1aef975c 2448
4e2a5f63
AD
2449 if $test -f Policy.sh ; then
2450 $cat <<EOM
2451
2452There's also a Policy hint file available, which should make the
2453site-specific (policy) questions easier to answer.
2454EOM
2455
2456 fi
2457
2304df62
AD
2458 $cat <<EOM
2459
2460You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2461A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2462is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2463
2464EOM
4e2a5f63 2465
2304df62 2466 rp="Which of these apply, if any?"
dfe9444c 2467 . UU/myread
85e6fe83
LW
2468 tans=$ans
2469 for file in $tans; do
4e2a5f63
AD
2470 if $test X$file = XPolicy -a -f Policy.sh; then
2471 . Policy.sh
2472 $cat Policy.sh >> UU/config.sh
2473 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2474 . $src/hints/$file.sh
2475 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2476 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2477 : nothing
2478 else
85e6fe83
LW
2479 : Give one chance to correct a possible typo.
2480 echo "$file.sh does not exist"
2481 dflt=$file
2482 rp="hint to use instead?"
dfe9444c 2483 . UU/myread
85e6fe83 2484 for file in $ans; do
dfe9444c
AD
2485 if $test -f "$src/hints/$file.sh"; then
2486 . $src/hints/$file.sh
2487 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2488 elif $test X$ans = X -o X$ans = Xnone ; then
2489 : nothing
2490 else
2491 echo "$file.sh does not exist -- ignored."
2492 fi
2493 done
2304df62
AD
2494 fi
2495 done
85e6fe83 2496
2304df62 2497 hint=recommended
85e6fe83 2498 : Remember our hint file for later.
dfe9444c 2499 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2500 hintfile="$file"
85e6fe83 2501 else
a0d0e21e 2502 hintfile=''
85e6fe83 2503 fi
2304df62
AD
2504fi
2505cd UU
2506;;
2507*)
2508 echo " "
2509 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2510 tmp_n="$n"
2511 tmp_c="$c"
2304df62
AD
2512 cd ..
2513 cp $config_sh config.sh 2>/dev/null
a78b0d02 2514 chmod +w config.sh
2304df62
AD
2515 . ./config.sh
2516 cd UU
2517 cp ../config.sh .
ecfc5424
AD
2518 n="$tmp_n"
2519 c="$tmp_c"
2304df62
AD
2520 hint=previous
2521 ;;
2522esac
1aef975c
AD
2523test "$override" && . ./optdef.sh
2524myuname="$newmyuname"
2304df62
AD
2525
2526: Restore computed paths
2527for file in $loclist $trylist; do
2528 eval $file="\$_$file"
2529done
2530
85e6fe83 2531cat << EOM
a0d0e21e 2532
85e6fe83 2533Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2534The default value is probably right if the name rings a bell. Otherwise,
2535since spelling matters for me, either accept the default or answer "none"
2536to leave it blank.
a0d0e21e 2537
85e6fe83 2538EOM
85e6fe83 2539case "$osname" in
a0d0e21e 2540 ''|' ')
85e6fe83 2541 case "$hintfile" in
a0d0e21e 2542 ''|' '|none) dflt=none ;;
ecfc5424 2543 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2544 esac
2545 ;;
2546 *) dflt="$osname" ;;
2547esac
2548rp="Operating system name?"
2549. ./myread
2550case "$ans" in
ecfc5424
AD
2551none) osname='' ;;
2552*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2553esac
8ff267be 2554echo " "
2555case "$osvers" in
2556 ''|' ')
2557 case "$hintfile" in
2558 ''|' '|none) dflt=none ;;
2559 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2560 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2561 case "$dflt" in
2562 ''|' ') dflt=none ;;
2563 esac
2564 ;;
2565 esac
2566 ;;
2567 *) dflt="$osvers" ;;
2568esac
2569rp="Operating system version?"
2570. ./myread
2571case "$ans" in
2572none) osvers='' ;;
2573*) osvers="$ans" ;;
2574esac
2575
02e93a22
JH
2576
2577. ./posthint.sh
2578
2304df62 2579: who configured the system
59b83a6f 2580cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2581cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2582case "$cf_by" in
2583"")
8ff267be 2584 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2585 case "$cf_by" in
2586 "") cf_by=unknown ;;
8ff267be 2587 esac ;;
2588esac
2304df62 2589
dfe9444c
AD
2590: set up the script used to warn in case of inconsistency
2591cat <<EOS >whoa
2592$startsh
2593EOS
2594cat <<'EOSC' >>whoa
2595dflt=y
2596echo " "
2597echo "*** WHOA THERE!!! ***" >&4
2598echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2599rp=" Keep the $hint value?"
2600. ./myread
2601case "$ans" in
2602y) td=$was; tu=$was;;
2603esac
2604EOSC
2605
2606: function used to set $1 to $val
2607setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2608case "$val$was" in
2609$define$undef) . ./whoa; eval "$var=\$td";;
2610$undef$define) . ./whoa; eval "$var=\$tu";;
2611*) eval "$var=$val";;
2612esac'
2613
64e689dc
JH
2614cat <<EOM
2615
3645a519 2616Perl can be built to take advantage of threads on some systems.
64e689dc 2617To do so, Configure must be run with -Dusethreads.
d00b958f
JH
2618
2619Note that threading is a highly experimental feature, and
2620some known race conditions still remain. If you choose to try
2621it, be very sure to not actually deploy it for production
2622purposes. README.threads has more details, and is required
2623reading if you enable threads.
64e689dc 2624EOM
dfe9444c 2625case "$usethreads" in
b691c02f 2626$define|true|[yY]*) dflt='y';;
64e689dc
JH
2627*) dflt='n';;
2628esac
2629rp='Build a threading Perl?'
2630. ./myread
2631case "$ans" in
aaacdc8b 2632y|Y) val="$define" ;;
64e689dc 2633*) val="$undef" ;;
dfe9444c 2634esac
64e689dc 2635set usethreads
aaacdc8b
GS
2636eval $setvar
2637
2638case "$usethreads" in
2639$define)
2640 $cat <<EOM
2641
ff42dc34 2642As of 5.5.640, Perl has two different internal threading implementations,
aaacdc8b
GS
2643the 5.005 version (5005threads) and an interpreter-based version
2644(ithreads) that has one interpreter per thread. Both are very
2645experimental. This arrangement exists to help developers work out
2646which one is better.
3645a519
JH
2647
2648If you're a casual user, you probably don't want interpreter-threads
2649at this time. There doesn't yet exist a way to create threads from
2650within Perl in this model, i.e., "use Thread;" will NOT work.
aaacdc8b
GS
2651EOM
2652 : Default to ithreads unless overridden on command line or with
2653 : old config.sh
2654 dflt='y'
2655 case "$use5005threads" in
2656 $define|true|[yY]*) dflt='n';;
2657 esac
2658 case "$useithreads" in
2659 $undef|false|[nN]*) dflt='n';;
2660 esac
2661 rp='Use interpreter-based ithreads?'
2662 . ./myread
2663 case "$ans" in
2664 y|Y) val="$define" ;;
2665 *) val="$undef" ;;
2666 esac
2667 set useithreads
2668 eval $setvar
2669 : Now set use5005threads to the opposite value.
2670 case "$useithreads" in
2671 $define) val="$undef" ;;
2672 *) val="$define" ;;
2673 esac
2674 set use5005threads
2675 eval $setvar
2676 ;;
2677*)
2678 useithreads="$undef"
2679 use5005threads="$undef"
2680 ;;
2681esac
104d25b7 2682
693762b4
AD
2683case "$d_oldpthreads" in
2684'') : Configure tests would be welcome here. For now, assume undef.
2685 val="$undef" ;;
2686*) val="$d_oldpthreads" ;;
2687esac
2688set d_oldpthreads
2689eval $setvar
dfe9444c 2690
b691c02f
JH
2691
2692case "$usethreads" in
104d25b7
JH
2693"$define"|true|[yY]*)
2694: Look for a hint-file generated 'call-back-unit'. If the
2695: user has specified that a threading perl is to be built,
2696: we may need to set or change some other defaults.
2697 if $test -f usethreads.cbu; then
e5e20432 2698 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2699 . ./usethreads.cbu
e5e20432
JH
2700 else
2701 $cat <<EOM
2702(Your platform doesn't have any specific hints for threaded builds.
2703 Assuming POSIX threads, then.)
b691c02f 2704EOM
e5e20432 2705 fi
aaacdc8b 2706 ;;
e5e20432 2707esac
104d25b7 2708
ff935051 2709cat <<EOM
64e689dc 2710
ff935051
JH
2711Perl can be built so that multiple Perl interpreters can coexist
2712within the same Perl executable.
2713EOM
64e689dc 2714
ff935051
JH
2715case "$useithreads" in
2716$define)
2717 cat <<EOM
2718This multiple interpreter support is required for interpreter-based threads.
64e689dc 2719EOM
ff935051
JH
2720 val="$define"
2721 ;;
2722*)
2723 echo 'Normally you do not need this and you should answer no.'
ff42dc34
GS
2724 case "$usemultiplicity" in
2725 $define|true|[yY]*) dflt='y';;
2726 *) dflt='n';;
2727 esac
2728 rp='Build Perl for multiplicity?'
2729 . ./myread
2730 case "$ans" in
ff935051 2731 y|Y) val="$define" ;;
ff42dc34
GS
2732 *) val="$undef" ;;
2733 esac
2734 ;;
64e689dc
JH
2735esac
2736set usemultiplicity
ff935051 2737eval $setvar
64e689dc 2738
e5e20432
JH
2739: determine where manual pages are on this system
2740echo " "
2741case "$sysman" in
2742'')
2743 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2744 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2745 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2746 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2747 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2748 sysman=`./loc . /usr/man/man1 $syspath`
2749 ;;
2750esac
2751if $test -d "$sysman"; then
2752 echo "System manual is in $sysman." >&4
2753else
2754 echo "Could not find manual pages in source form." >&4
2755fi
2756
2757: see what memory models we can support
2758case "$models" in
2759'')
2760 $cat >pdp11.c <<'EOP'
2761int main() {
2762#ifdef pdp11
2763 exit(0);
2764#else
2765 exit(1);
2766#endif
2767}
2768EOP
2769 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2770 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2771 dflt='unsplit split'
2772 else
2773 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2774 case "$tans" in
2775 X) dflt='none';;
2776 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2777 dflt='small'
2778 else
2779 dflt=''
2780 fi
2781 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2782 dflt="$dflt medium"
2783 fi
2784 if $test -d /lib/large || $test -d /usr/lib/large; then
2785 dflt="$dflt large"
2786 fi
2787 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2788 dflt="$dflt huge"
2789 fi
2790 esac
2791 fi;;
2792*) dflt="$models";;
2793esac
2794$cat <<EOM
2795
2796Some systems have different model sizes. On most systems they are called
2797small, medium, large, and huge. On the PDP11 they are called unsplit and
2798split. If your system doesn't support different memory models, say "none".
2799If you wish to force everything to one memory model, say "none" here and
2800put the appropriate flags later when it asks you for other cc and ld flags.
2801Venix systems may wish to put "none" and let the compiler figure things out.
2802(In the following question multiple model names should be space separated.)
2803
2804The default for most systems is "none".
2805
2806EOM
2807rp="Which memory models are supported?"
2808. ./myread
2809models="$ans"
2810
2811case "$models" in
2812none)
2813 small=''
2814 medium=''
2815 large=''
2816 huge=''
2817 unsplit=''
2818 split=''
2819 ;;
2820*split)
2821 case "$split" in
2822 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2823 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2824 dflt='-i'
2825 else
2826 dflt='none'
2827 fi;;
2828 *) dflt="$split";;
2829 esac
2830 rp="What flag indicates separate I and D space?"
2831 . ./myread
2832 tans="$ans"
2833 case "$tans" in
2834 none) tans='';;
2835 esac
2836 split="$tans"
2837 unsplit='';;
2838*large*|*small*|*medium*|*huge*)
2839 case "$models" in
2840 *large*)
2841 case "$large" in
2842 '') dflt='-Ml';;
2843 *) dflt="$large";;
2844 esac
2845 rp="What flag indicates large model?"
2846 . ./myread
2847 tans="$ans"
2848 case "$tans" in
2849 none) tans='';
2850 esac
2851 large="$tans";;
2852 *) large='';;
2853 esac
2854 case "$models" in
2855 *huge*) case "$huge" in
2856 '') dflt='-Mh';;
2857 *) dflt="$huge";;
2858 esac
2859 rp="What flag indicates huge model?"
2860 . ./myread
2861 tans="$ans"
2862 case "$tans" in
2863 none) tans='';
2864 esac
2865 huge="$tans";;
2866 *) huge="$large";;
2867 esac
2868 case "$models" in
2869 *medium*) case "$medium" in
2870 '') dflt='-Mm';;
2871 *) dflt="$medium";;
2872 esac
2873 rp="What flag indicates medium model?"
2874 . ./myread
2875 tans="$ans"
2876 case "$tans" in
2877 none) tans='';
2878 esac
2879 medium="$tans";;
2880 *) medium="$large";;
2881 esac
2882 case "$models" in
2883 *small*) case "$small" in
2884 '') dflt='none';;
2885 *) dflt="$small";;
2886 esac
2887 rp="What flag indicates small model?"
2888 . ./myread
2889 tans="$ans"
2890 case "$tans" in
2891 none) tans='';
2892 esac
2893 small="$tans";;
2894 *) small='';;
2895 esac
2896 ;;
2897*)
2898 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2899 ;;
2900esac
2901$rm -f pdp11.* pdp11
2902
2903: make some quick guesses about what we are up against
2904echo " "
2905$echo $n "Hmm... $c"
2906echo exit 1 >bsd
2907echo exit 1 >usg
2908echo exit 1 >v7
2909echo exit 1 >osf1
2910echo exit 1 >eunice
2911echo exit 1 >xenix
2912echo exit 1 >venix
2913echo exit 1 >os2
2914d_bsd="$undef"
2915$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2916if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2917then
2918 echo "Looks kind of like an OSF/1 system, but we'll see..."
2919 echo exit 0 >osf1
2920elif test `echo abc | tr a-z A-Z` = Abc ; then
2921 xxx=`./loc addbib blurfl $pth`
2922 if $test -f $xxx; then
2923 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2924 echo exit 0 >bsd
2925 echo exit 0 >usg
2926 else
2927 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2928 echo "Looks kind of like an extended USG system, but we'll see..."
2929 else
2930 echo "Looks kind of like a USG system, but we'll see..."
2931 fi
2932 echo exit 0 >usg
2933 fi
2934elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2935 echo "Looks kind of like a BSD system, but we'll see..."
2936 d_bsd="$define"
2937 echo exit 0 >bsd
2938else
2939 echo "Looks kind of like a Version 7 system, but we'll see..."
2940 echo exit 0 >v7
2941fi
2942case "$eunicefix" in
2943*unixtovms*)
2944 $cat <<'EOI'
2945There is, however, a strange, musty smell in the air that reminds me of
2946something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2947EOI
2948 echo exit 0 >eunice
2949 d_eunice="$define"
2950: it so happens the Eunice I know will not run shell scripts in Unix format
2951 ;;
2952*)
2953 echo " "
2954 echo "Congratulations. You aren't running Eunice."
2955 d_eunice="$undef"
2956 ;;
2957esac
2958: Detect OS2. The p_ variable is set above in the Head.U unit.
2959case "$p_" in
2960:) ;;
2961*)
2962 $cat <<'EOI'
2963I have the feeling something is not exactly right, however...don't tell me...
2964lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2965EOI
2966 echo exit 0 >os2
2967 ;;
2968esac
2969if test -f /xenix; then
2970 echo "Actually, this looks more like a XENIX system..."
2971 echo exit 0 >xenix
2972 d_xenix="$define"
2973else
2974 echo " "
2975 echo "It's not Xenix..."
2976 d_xenix="$undef"
2977fi
2978chmod +x xenix
2979$eunicefix xenix
2980if test -f /venix; then
2981 echo "Actually, this looks more like a VENIX system..."
2982 echo exit 0 >venix
2983else
2984 echo " "
2985 if ./xenix; then
2986 : null
2987 else
2988 echo "Nor is it Venix..."
2989 fi
2990fi
2991chmod +x bsd usg v7 osf1 eunice xenix venix os2
2992$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2993$rm -f foo
2994
2995: see if we need a special compiler
2996echo " "
2997if ./usg; then
2998 case "$cc" in
2999 '') case "$Mcc" in
3000 /*) dflt='Mcc';;
3001 *) case "$large" in
3002 -M*) dflt='cc';;
3003 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3004 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3005 dflt='cc'
3006 else
3007 dflt='cc -M'
3008 fi
3009 else
3010 dflt='cc'
3011 fi;;
3012 esac;;
3013 esac;;
3014 *) dflt="$cc";;
3015 esac
3016 case "$dflt" in
3017 *M*) $cat <<'EOM'
3018On some older systems the default C compiler will not resolve multiple global
3019references that happen to have the same name. On some such systems the "Mcc"
3020command may be used to force these to be resolved. On other systems a "cc -M"
3021command is required. (Note that the -M flag on other systems indicates a
3022memory model to use!) If you have the Gnu C compiler, you might wish to use
3023that instead.
3024
3025EOM
3026 ;;
3027 esac
3028 rp="Use which C compiler?"
3029 . ./myread
3030 cc="$ans"
3031else
3032 case "$cc" in
3033 '') dflt=cc;;
3034 *) dflt="$cc";;
3035 esac
3036 rp="Use which C compiler?"
3037 . ./myread
3038 cc="$ans"
3039fi
3040: Look for a hint-file generated 'call-back-unit'. Now that the
3041: user has specified the compiler, we may need to set or change some
3042: other defaults.
3043if $test -f cc.cbu; then
3044 . ./cc.cbu
3045fi
3046echo " "
3047echo "Checking for GNU cc in disguise and/or its version number..." >&4
3048$cat >gccvers.c <<EOM
3049#include <stdio.h>
3050int main() {
3051#ifdef __GNUC__
3052#ifdef __VERSION__
3053 printf("%s\n", __VERSION__);
3054#else
3055 printf("%s\n", "1");
3056#endif
3057#endif
3058 exit(0);
3059}
3060EOM
3061if $cc -o gccvers gccvers.c; then
3062 gccversion=`./gccvers`
3063 case "$gccversion" in
3064 '') echo "You are not using GNU cc." ;;
fc68435e 3065 *) echo "You are using GNU cc $gccversion."
fc68435e 3066 ;;
e5e20432
JH
3067 esac
3068else
3069 echo " "
3070 echo "*** WHOA THERE!!! ***" >&4
3071 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3072 case "$knowitall" in
3073 '')
3074 echo " You'd better start hunting for one and let me know about it." >&4
3075 exit 1
3076 ;;
3077 esac
3078fi
3079$rm -f gccvers*
3080case "$gccversion" in
30811*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3082esac
3083
bd9b35c9
JH
3084: decide how portable to be. Allow command line overrides.
3085case "$d_portable" in
3086"$undef") ;;
3087*) d_portable="$define" ;;
104d25b7 3088esac
85ab1d1d 3089
bd9b35c9
JH
3090: set up shell script to do ~ expansion
3091cat >filexp <<EOSS
3092$startsh
3093: expand filename
3094case "\$1" in
3095 ~/*|~)
3096 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3097 ;;
3098 ~*)
3099 if $test -f /bin/csh; then
3100 /bin/csh -f -c "glob \$1"
3101 failed=\$?
3102 echo ""
3103 exit \$failed
e5e20432 3104 else
bd9b35c9
JH
3105 name=\`$expr x\$1 : '..\([^/]*\)'\`
3106 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3107 if $test ! -d "\$dir"; then
3108 me=\`basename \$0\`
3109 echo "\$me: can't locate home directory for: \$name" >&2
3110 exit 1
3111 fi
3112 case "\$1" in
3113 */*)
3114 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3115 ;;
3116 *)
3117 echo \$dir
e5e20432
JH
3118 ;;
3119 esac
3120 fi
b691c02f 3121 ;;
4633a7c4 3122*)
bd9b35c9 3123 echo \$1
2304df62
AD
3124 ;;
3125esac
4633a7c4
LW
3126EOSS
3127chmod +x filexp
3128$eunicefix filexp
2304df62
AD
3129
3130: now set up to get a file name
28757baa 3131cat <<EOS >getfile
3132$startsh
3133EOS
3134cat <<'EOSC' >>getfile
2304df62
AD
3135tilde=''
3136fullpath=''
3137already=''
3138skip=''
3139none_ok=''
3140exp_file=''
a0d0e21e 3141nopath_ok=''
2304df62
AD
3142orig_rp="$rp"
3143orig_dflt="$dflt"
b233458b
JH
3144case "$gfpth" in
3145'') gfpth='.' ;;
3146esac
2304df62
AD
3147
3148case "$fn" in
ecfc5424 3149*\(*)
28e8609d 3150 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3151 fn=`echo $fn | sed 's/(.*)//'`
3152 ;;
3153esac
3154
3155case "$fn" in
a0d0e21e
LW
3156*:*)
3157 loc_file=`expr $fn : '.*:\(.*\)'`
3158 fn=`expr $fn : '\(.*\):.*'`
3159 ;;
3160esac
3161
3162case "$fn" in
2304df62
AD
3163*~*) tilde=true;;
3164esac
3165case "$fn" in
3166*/*) fullpath=true;;
3167esac
3168case "$fn" in
3169*+*) skip=true;;
3170esac
3171case "$fn" in
3172*n*) none_ok=true;;
3173esac
3174case "$fn" in
3175*e*) exp_file=true;;
3176esac
a0d0e21e
LW
3177case "$fn" in
3178*p*) nopath_ok=true;;
3179esac
2304df62
AD
3180
3181case "$fn" in
3182*f*) type='File';;
3183*d*) type='Directory';;
a0d0e21e 3184*l*) type='Locate';;
2304df62
AD
3185esac
3186
3187what="$type"
3188case "$what" in
3189Locate) what='File';;
3190esac
3191
3192case "$exp_file" in
3193'')
3194 case "$d_portable" in
3195 "$define") ;;
3196 *) exp_file=true;;
3197 esac
3198 ;;
3199esac
3200
3201cd ..
3202while test "$type"; do
3203 redo=''
3204 rp="$orig_rp"
3205 dflt="$orig_dflt"
3206 case "$tilde" in
3207 true) rp="$rp (~name ok)";;
3208 esac
3209 . UU/myread
ecfc5424
AD
3210 if test -f UU/getfile.ok && \
3211 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3212 then
3213 value="$ans"
3214 ansexp="$ans"
3215 break
3216 fi
2304df62
AD
3217 case "$ans" in
3218 none)
3219 value=''
3220 ansexp=''
3221 case "$none_ok" in
3222 true) type='';;
3223 esac
3224 ;;
3225 *)
3226 case "$tilde" in
3227 '') value="$ans"
3228 ansexp="$ans";;
3229 *)
3230 value=`UU/filexp $ans`
3231 case $? in
3232 0)
3233 if test "$ans" != "$value"; then
ecfc5424 3234 echo "(That expands to $value on this system.)"
2304df62
AD
3235 fi
3236 ;;
3237 *) value="$ans";;
3238 esac
3239 ansexp="$value"
3240 case "$exp_file" in
3241 '') value="$ans";;
3242 esac
3243 ;;
3244 esac
3245 case "$fullpath" in
3246 true)
3247 case "$ansexp" in
3248 /*) value="$ansexp" ;;
3249 *)
3250 redo=true
3251 case "$already" in
3252 true)
3253 echo "I shall only accept a full path name, as in /bin/ls." >&4
3254 echo "Use a ! shell escape if you wish to check pathnames." >&4
3255 ;;
3256 *)
3257 echo "Please give a full path name, starting with slash." >&4
3258 case "$tilde" in
3259 true)
3260 echo "Note that using ~name is ok provided it expands well." >&4
3261 already=true
3262 ;;
3263 esac
3264 esac
3265 ;;
3266 esac
3267 ;;
3268 esac
3269 case "$redo" in
3270 '')
3271 case "$type" in
3272 File)
b233458b
JH
3273 for fp in $gfpth; do
3274 if test "X$fp" = X.; then
3275 pf="$ansexp"
3276 else
3277 pf="$fp/$ansexp"
3278 fi
3279 if test -f "$pf"; then
3280 type=''
3281 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3282 then
3283 echo "($value is not a plain file, but that's ok.)"
3284 type=''
3285 fi
3286 if test X"$type" = X; then
3287 value="$pf"
3288 break
3289 fi
3290 done
2304df62
AD
3291 ;;
3292 Directory)
b233458b
JH
3293 for fp in $gfpth; do
3294 if test "X$fp" = X.; then
3295 pf="$ansexp"
3296 else
3297 pf="$fp/$ansexp"
3298 fi
3299 if test -d "$pf"; then
3300 type=''
3301 value="$pf"
3302 break
3303 fi
3304 done
2304df62
AD
3305 ;;
3306 Locate)
40000a8c 3307 if test -d "$ansexp"; then
a0d0e21e
LW
3308 echo "(Looking for $loc_file in directory $value.)"
3309 value="$value/$loc_file"
40000a8c 3310 ansexp="$ansexp/$loc_file"
2304df62 3311 fi
40000a8c 3312 if test -f "$ansexp"; then
2304df62
AD
3313 type=''
3314 fi
a0d0e21e
LW
3315 case "$nopath_ok" in
3316 true) case "$value" in
3317 */*) ;;
3318 *) echo "Assuming $value will be in people's path."
3319 type=''
3320 ;;
3321 esac
3322 ;;
3323 esac
2304df62
AD
3324 ;;
3325 esac
3326
3327 case "$skip" in
3328 true) type='';
3329 esac
3330
3331 case "$type" in
3332 '') ;;
3333 *)
3334 if test "$fastread" = yes; then
3335 dflt=y
3336 else
3337 dflt=n
3338 fi
3339 rp="$what $value doesn't exist. Use that name anyway?"
3340 . UU/myread
3341 dflt=''
3342 case "$ans" in
3343 y*) type='';;
3344 *) echo " ";;
3345 esac
3346 ;;
3347 esac
3348 ;;
3349 esac
3350 ;;
3351 esac
3352done
3353cd UU
3354ans="$value"
3355rp="$orig_rp"
3356dflt="$orig_dflt"
ecfc5424 3357rm -f getfile.ok
b233458b 3358test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3359EOSC
3360
bd9b35c9
JH
3361: What should the include directory be ?
3362echo " "
3363$echo $n "Hmm... $c"
3364dflt='/usr/include'
3365incpath=''
3366mips_type=''
3367if $test -f /bin/mips && /bin/mips; then
3368 echo "Looks like a MIPS system..."
3369 $cat >usr.c <<'EOCP'
3370#ifdef SYSTYPE_BSD43
3371/bsd43
3372#endif
3373EOCP
3374 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3375 dflt='/bsd43/usr/include'
3376 incpath='/bsd43'
3377 mips_type='BSD 4.3'
3378 else
3379 mips_type='System V'
3380 fi
3381 $rm -f usr.c usr.out
3382 echo "and you're compiling with the $mips_type compiler and libraries."
3383 xxx_prompt=y
3384 echo "exit 0" >mips
3385else
3386 echo "Doesn't look like a MIPS system."
3387 xxx_prompt=n
3388 echo "exit 1" >mips
3389fi
3390chmod +x mips
3391$eunicefix mips
3392case "$usrinc" in
3393'') ;;
3394*) dflt="$usrinc";;
3395esac
3396case "$xxx_prompt" in
3397y) fn=d/
3398 echo " "
3399 rp='Where are the include files you want to use?'
3400 . ./getfile
3401 usrinc="$ans"
8e07c86e 3402 ;;
bd9b35c9 3403*) usrinc="$dflt"
8e07c86e
AD
3404 ;;
3405esac
2304df62 3406
fc68435e
JH
3407: see how we invoke the C preprocessor
3408echo " "
3409echo "Now, how can we feed standard input to your C preprocessor..." >&4
3410cat <<'EOT' >testcpp.c
3411#define ABC abc
3412#define XYZ xyz
3413ABC.XYZ
3414EOT
3415cd ..
3416if test ! -f cppstdin; then
3417 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3418 # AIX cc -E doesn't show the absolute headerfile
3419 # locations but we'll cheat by using the -M flag.
3420 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
3421 else
3422 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3423 fi
3424else
3425 echo "Keeping your $hint cppstdin wrapper."
3426fi
3427chmod 755 cppstdin
3428wrapper=`pwd`/cppstdin
3429ok='false'
3430cd UU
3431
3432if $test "X$cppstdin" != "X" && \
3433 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3434 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3435then
3436 echo "You used to use $cppstdin $cppminus so we'll use that again."
3437 case "$cpprun" in
3438 '') echo "But let's see if we can live without a wrapper..." ;;
3439 *)
3440 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3441 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3442 then
3443 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3444 ok='true'
3445 else
3446 echo "(However, $cpprun $cpplast does not work, let's see...)"
3447 fi
3448 ;;
3449 esac
3450else
3451 case "$cppstdin" in
3452 '') ;;
3453 *)
3454 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3455 ;;
3456 esac
3457fi
3458
3459if $ok; then
3460 : nothing
3461elif echo 'Maybe "'"$cc"' -E" will work...'; \
3462 $cc -E <testcpp.c >testcpp.out 2>&1; \
3463 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3464 echo "Yup, it does."
3465 x_cpp="$cc -E"
3466 x_minus='';
3467elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3468 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3469 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3470 echo "Yup, it does."
3471 x_cpp="$cc -E"
3472 x_minus='-';
3473elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3474 $cc -P <testcpp.c >testcpp.out 2>&1; \
3475 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3476 echo "Yipee, that works!"
3477 x_cpp="$cc -P"
3478 x_minus='';
3479elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3480 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3481 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3482 echo "At long last!"
3483 x_cpp="$cc -P"
3484 x_minus='-';
3485elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3486 $cpp <testcpp.c >testcpp.out 2>&1; \
3487 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3488 echo "It works!"
3489 x_cpp="$cpp"
3490 x_minus='';
3491elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3492 $cpp - <testcpp.c >testcpp.out 2>&1; \
3493 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3494 echo "Hooray, it works! I was beginning to wonder."
3495 x_cpp="$cpp"
3496 x_minus='-';
3497elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3498 $wrapper <testcpp.c >testcpp.out 2>&1; \
3499 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3500 x_cpp="$wrapper"
3501 x_minus=''
3502 echo "Eureka!"
3503else
3504 dflt=''
3505 rp="No dice. I can't find a C preprocessor. Name one:"
3506 . ./myread
3507 x_cpp="$ans"
3508 x_minus=''
3509 $x_cpp <testcpp.c >testcpp.out 2>&1
3510 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3511 echo "OK, that will do." >&4
3512 else
3513echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3514 exit 1
3515 fi
3516fi
3517
3518case "$ok" in
3519false)
3520 cppstdin="$x_cpp"
3521 cppminus="$x_minus"
3522 cpprun="$x_cpp"
3523 cpplast="$x_minus"
3524 set X $x_cpp
3525 shift
3526 case "$1" in
3527 "$cpp")
3528 echo "Perhaps can we force $cc -E using a wrapper..."
3529 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3530 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3531 then
3532 echo "Yup, we can."
3533 cppstdin="$wrapper"
3534 cppminus='';
3535 else
3536 echo "Nope, we'll have to live without it..."
3537 fi
3538 ;;
3539 esac
3540 case "$cpprun" in
3541 "$wrapper")
3542 cpprun=''
3543 cpplast=''
3544 ;;
3545 esac
3546 ;;
3547esac
3548
3549case "$cppstdin" in
3550"$wrapper"|'cppstdin') ;;
3551*) $rm -f $wrapper;;
3552esac
3553$rm -f testcpp.c testcpp.out
3554
bd9b35c9
JH
3555: Set private lib path
3556case "$plibpth" in
3557'') if ./mips; then
3558 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3559 fi;;
3560esac
3561case "$libpth" in
3562' ') dlist='';;
3563'') dlist="$loclibpth $plibpth $glibpth";;
3564*) dlist="$libpth";;
3565esac
3566
3567: Now check and see which directories actually exist, avoiding duplicates
3568libpth=''
3569for xxx in $dlist
3570do
3571 if $test -d $xxx; then
3572 case " $libpth " in
3573 *" $xxx "*) ;;
3574 *) libpth="$libpth $xxx";;
3575 esac
3576 fi
3577done
3578$cat <<'EOM'
3579
3580Some systems have incompatible or broken versions of libraries. Among
3581the directories listed in the question below, please remove any you
3582know not to be holding relevant libraries, and add any that are needed.
3583Say "none" for none.
8e07c86e
AD
3584
3585EOM
bd9b35c9
JH
3586case "$libpth" in
3587'') dflt='none';;
8e07c86e 3588*)
bd9b35c9
JH
3589 set X $libpth
3590 shift
3591 dflt=${1+"$@"}
8e07c86e 3592 ;;
a0d0e21e 3593esac
bd9b35c9
JH
3594rp="Directories to use for library searches?"
3595. ./myread
3596case "$ans" in
3597none) libpth=' ';;
3598*) libpth="$ans";;
3599esac
a0d0e21e 3600
bd9b35c9
JH
3601: compute shared library extension
3602case "$so" in
3603'')
3604 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3605 dflt='sl'
dd4e71fd 3606 else
bd9b35c9 3607 dflt='so'
dd4e71fd
JH
3608 fi
3609 ;;
bd9b35c9 3610*) dflt="$so";;
dd4e71fd 3611esac
dd4e71fd
JH
3612$cat <<EOM
3613
bd9b35c9 3614On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3615you want to suppress searching of shared libraries for the remainder
bd9b35c9 3616of this configuration.
dd4e71fd
JH
3617
3618EOM
bd9b35c9
JH
3619rp='What is the file extension used for shared libraries?'
3620. ./myread
3621so="$ans"
dd4e71fd 3622
bd9b35c9
JH
3623: Define several unixisms.
3624: Hints files or command line option can be used to override them.
3625: The convoluted testing is in case hints files set either the old
3626: or the new name.
3627case "$_exe" in
3628'') case "$exe_ext" in
3629 '') ;;
3630 *) _exe="$exe_ext" ;;
dd4e71fd 3631 esac
bd9b35c9 3632 ;;
bfb7748a 3633esac
bd9b35c9
JH
3634case "$_a" in
3635'') case "$lib_ext" in
3636 '') _a='.a';;
3637 *) _a="$lib_ext" ;;
dd4e71fd
JH
3638 esac
3639 ;;
dd4e71fd 3640esac
bd9b35c9
JH
3641case "$_o" in
3642'') case "$obj_ext" in
3643 '') _o='.o';;
3644 *) _o="$obj_ext";;
3645 esac
3646 ;;
3647esac
3648case "$p_" in
3649'') case "$path_sep" in
3650 '') p_=':';;
3651 *) p_="$path_sep";;
3652 esac
3653 ;;
3654esac
3655exe_ext=$_exe
3656lib_ext=$_a
3657obj_ext=$_o
3658path_sep=$p_
dd4e71fd 3659
bd9b35c9
JH
3660: Which makefile gets called first. This is used by make depend.
3661case "$firstmakefile" in
3662'') firstmakefile='makefile';;
4633a7c4 3663esac
4633a7c4 3664
bd9b35c9 3665cat <<EOM
4633a7c4 3666
bd9b35c9
JH
3667Perl can be built to use the SOCKS proxy protocol library. To do so,
3668Configure must be run with -Dusesocks.
4633a7c4 3669
bd9b35c9 3670Normally you do not need this and you should answer no.
8e07c86e 3671
bd9b35c9
JH
3672EOM
3673case "$usesocks" in
3674$define|true|[yY]*) dflt='y';;
3675*) dflt='n';;
3676esac
3677rp='Build Perl for SOCKS?'
3678. ./myread
3679case "$ans" in
3680y|Y) val="$define" ;;
3681*) val="$undef" ;;
3682esac
3683set usesocks
3684eval $setvar
3685
3686: Looking for optional libraries
3687echo " "
3688echo "Checking for optional libraries..." >&4
3689case "$libs" in
3690' '|'') dflt='';;
3691*) dflt="$libs";;
3692esac
3693case "$libswanted" in
3694'') libswanted='c_s';;
3695esac
3696case "$usesocks" in
3697$define)
3698 libswanted="$libswanted socks5 socks5_sh"
8e07c86e
AD
3699 ;;
3700esac
bd9b35c9 3701for thislib in $libswanted; do
f7dd4e7f
JH
3702 for thisdir in $libpth; do
3703 xxx=''
3704 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3705 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3706 $test -f "$xxx" && eval $libscheck
3707 $test -f "$xxx" && libstyle=shared
3708 fi
3709 if test ! -f "$xxx"; then
3710 xxx=$thisdir/lib$thislib.$so
3711 $test -f "$xxx" && eval $libscheck
3712 $test -f "$xxx" && libstyle=shared
3713 fi
3714 if test ! -f "$xxx"; then
3715 xxx=$thisdir/lib$thislib$_a
3716 $test -f "$xxx" && eval $libscheck
3717 $test -f "$xxx" && libstyle=static
3718 fi
3719 if test ! -f "$xxx"; then
3720 xxx=$thisdir/$thislib$_a
3721 $test -f "$xxx" && eval $libscheck
3722 $test -f "$xxx" && libstyle=static
3723 fi
3724 if test ! -f "$xxx"; then
3725 xxx=$thisdir/lib${thislib}_s$_a
3726 $test -f "$xxx" && eval $libscheck
3727 $test -f "$xxx" && libstyle=static
3728 fi
3729 if test ! -f "$xxx"; then
3730 xxx=$thisdir/Slib$thislib$_a
3731 $test -f "$xxx" && eval $libscheck
3732 $test -f "$xxx" && libstyle=static
3733 fi
3734 if $test -f "$xxx"; then
43999f95 3735 case "$libstyle" in
f7dd4e7f
JH
3736 shared) echo "Found -l$thislib (shared)." ;;
3737 static) echo "Found -l$thislib." ;;
3738 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3739 esac
bd9b35c9
JH
3740 case " $dflt " in
3741 *"-l$thislib "*);;
f7dd4e7f 3742 *) dflt="$dflt -l$thislib"
43999f95
JH
3743 libsfound="$libsfound $xxx"
3744 yyy=`basename $xxx`
3745 libsfiles="$libsfiles $yyy"
3746 yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3747 case " $libsdirs " in
3748 *" $yyy "*) ;;
3749 *) libsdirs="$libsdirs $yyy" ;;
3750 esac
3751 ;;
bd9b35c9 3752 esac
f7dd4e7f
JH
3753 break
3754 fi
3755 done
3756 if $test ! -f "$xxx"; then
3757 echo "No -l$thislib."
bd9b35c9
JH
3758 fi
3759done
3760set X $dflt
3761shift
3762dflt="$*"
3763case "$libs" in
3764'') dflt="$dflt";;
3765*) dflt="$libs";;
3766esac
3767case "$dflt" in
3768' '|'') dflt='none';;
3769esac
4633a7c4 3770
bd9b35c9 3771$cat <<EOM
4633a7c4 3772
bd9b35c9
JH
3773In order to compile $package on your machine, a number of libraries
3774are usually needed. Include any other special libraries here as well.
3775Say "none" for none. The default list is almost always right.
8e07c86e 3776EOM
8e07c86e 3777
bd9b35c9
JH
3778echo " "
3779rp="What libraries to use?"
3780. ./myread
3781case "$ans" in
3782none) libs=' ';;
3783*) libs="$ans";;
3784esac
d71b2b6b 3785
bd9b35c9
JH
3786: determine optimization, if desired, or use for debug flag also
3787case "$optimize" in
3788' '|$undef) dflt='none';;
3789'') dflt='-O';;
3790*) dflt="$optimize";;
3791esac
3792$cat <<EOH
d71b2b6b 3793
bd9b35c9
JH
3794By default, $package compiles with the -O flag to use the optimizer.
3795Alternately, you might want to use the symbolic debugger, which uses
3796the -g flag (on traditional Unix systems). Either flag can be
3797specified here. To use neither flag, specify the word "none".
d71b2b6b 3798
bd9b35c9
JH
3799EOH
3800rp="What optimizer/debugger flag should be used?"
3801. ./myread
3802optimize="$ans"
3803case "$optimize" in
3804'none') optimize=" ";;
3805esac
3806
3807dflt=''
3808: We will not override a previous value, but we might want to
3809: augment a hint file
3810case "$hint" in
3811default|recommended)
3812 case "$gccversion" in
3813 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3814 esac
bd9b35c9
JH
3815 case "$optimize" in
3816 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3817 esac
bd9b35c9
JH
3818 case "$gccversion" in
3819 2*) if test -d /etc/conf/kconfig.d &&
3820 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3821 then
3822 dflt="$dflt -posix"
3823 fi
f0d04425 3824 ;;
bd9b35c9
JH
3825 esac
3826 case "$gccversion" in
3827 1*) ;;
3828 2.[0-8]*) ;;
3829 ?*) echo " "
3830 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3831 echo 'int main(void) { return 0; }' > gcctest.c
3832 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3833 echo "Yes, it does." 2>&1
3834 case "$ccflags" in
3835 *strict-aliasing*)
3836 echo "Leaving current flags $ccflags alone." 2>&1
3837 ;;
3838 *) dflt="$dflt -fno-strict-aliasing" ;;
3839 esac
3840 else
3841 echo "Nope, it doesn't, but that's ok." 2>&1
3842 fi
f0d04425 3843 ;;
e5e20432
JH
3844 esac
3845 ;;
3846esac
3847
bd9b35c9
JH
3848case "$mips_type" in
3849*BSD*|'') inclwanted="$locincpth $usrinc";;
3850*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3851esac
3852for thisincl in $inclwanted; do
3853 if $test -d $thisincl; then
3854 if $test x$thisincl != x$usrinc; then
3855 case "$dflt" in
3856 *$thisincl*);;
3857 *) dflt="$dflt -I$thisincl";;
3858 esac
3859 fi
3860 fi
3861done
40a7a20a 3862
bd9b35c9
JH
3863inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3864 xxx=true;
3865elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3866 xxx=true;
3867else
3868 xxx=false;
3869fi;
3870if $xxx; then
3871 case "$dflt" in
3872 *$2*);;
3873 *) dflt="$dflt -D$2";;
3874 esac;
3875fi'
40a7a20a 3876
bd9b35c9 3877set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3878
bd9b35c9
JH
3879case "$usesocks" in
3880$define)
3881 ccflags="$ccflags -DSOCKS"
3882 ;;
3883esac
40a7a20a 3884
bd9b35c9
JH
3885case "$hint" in
3886default|recommended) dflt="$ccflags $dflt" ;;
3887*) dflt="$ccflags";;
3888esac
40a7a20a 3889
bd9b35c9
JH
3890case "$dflt" in
3891''|' ') dflt=none;;
3892esac
3893$cat <<EOH
40a7a20a 3894
bd9b35c9
JH
3895Your C compiler may want other flags. For this question you should include
3896-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3897but you should NOT include libraries or ld flags like -lwhatever. If you
3898want $package to honor its debug switch, you should include -DDEBUGGING here.
3899Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3900
bd9b35c9 3901To use no flags, specify the word "none".
40a7a20a 3902
bd9b35c9
JH
3903EOH
3904set X $dflt
3905shift
3906dflt=${1+"$@"}
3907rp="Any additional cc flags?"
3908. ./myread
3909case "$ans" in
3910none) ccflags='';;
3911*) ccflags="$ans";;
3912esac
8e07c86e 3913
bd9b35c9
JH
3914: the following weeds options from ccflags that are of no interest to cpp
3915cppflags="$ccflags"
3916case "$gccversion" in
39171*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3918esac
bd9b35c9
JH
3919case "$mips_type" in
3920'');;
3921*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3922esac
3923case "$cppflags" in
3924'');;
3925*)
3926 echo " "
3927 echo "Let me guess what the preprocessor flags are..." >&4
3928 set X $cppflags
3929 shift
3930 cppflags=''
3931 $cat >cpp.c <<'EOM'
3932#define BLURFL foo
8e07c86e 3933
bd9b35c9
JH
3934BLURFL xx LFRULB
3935EOM
3936 previous=''
3937 for flag in $*
3938 do
3939 case "$flag" in
3940 -*) ftry="$flag";;
3941 *) ftry="$previous $flag";;
3942 esac
3943 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3944 >cpp1.out 2>/dev/null && \
3945 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3946 >cpp2.out 2>/dev/null && \
3947 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3948 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3949 then
3950 cppflags="$cppflags $ftry"
3951 previous=''
3952 else
3953 previous="$flag"
3954 fi
3955 done
3956 set X $cppflags
3957 shift
3958 cppflags=${1+"$@"}
3959 case "$cppflags" in
3960 *-*) echo "They appear to be: $cppflags";;
3961 esac
3962 $rm -f cpp.c cpp?.out
2afac517 3963 ;;
3964esac
8e07c86e 3965
bd9b35c9
JH
3966: flags used in final linking phase
3967case "$ldflags" in
3968'') if ./venix; then
3969 dflt='-i -z'
10a23457 3970 else
bd9b35c9 3971 dflt=''
10a23457 3972 fi
bd9b35c9
JH
3973 case "$ccflags" in
3974 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 3975 esac
bd9b35c9
JH
3976 ;;
3977*) dflt="$ldflags";;
3978esac
3979
3980: Try to guess additional flags to pick up local libraries.
3981for thislibdir in $libpth; do
3982 case " $loclibpth " in
3983 *" $thislibdir "*)
3984 case "$dflt " in
3985 *"-L$thislibdir "*) ;;
3986 *) dflt="$dflt -L$thislibdir" ;;
3987 esac
c4f23d77
AD
3988 ;;
3989 esac
bd9b35c9 3990done
c4f23d77 3991
bd9b35c9
JH
3992case "$dflt" in
3993'') dflt='none' ;;
3994esac
c4f23d77 3995
bd9b35c9
JH
3996$cat <<EOH
3997
3998Your C linker may need flags. For this question you should
3999include -L/whatever and any other flags used by the C linker, but you
4000should NOT include libraries like -lwhatever.
4001
4002Make sure you include the appropriate -L/path flags if your C linker
4003does not normally search all of the directories you specified above,
4004namely
4005 $libpth
4006To use no flags, specify the word "none".
4007
4008EOH
4009
4010rp="Any additional ld flags (NOT including libraries)?"
4011. ./myread
4012case "$ans" in
4013none) ldflags='';;
4014*) ldflags="$ans";;
4015esac
4016rmlist="$rmlist pdp11"
4017
4018: coherency check
4019echo " "
4020echo "Checking your choice of C compiler and flags for coherency..." >&4
4021$cat > try.c <<'EOF'
4022#include <stdio.h>
4023int main() { printf("Ok\n"); exit(0); }
4024EOF
4025set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4026shift
4027$cat >try.msg <<'EOM'
4028I've tried to compile and run the following simple program:
4029
4030EOM
4031$cat try.c >> try.msg
4032
4033$cat >> try.msg <<EOM
4034
4035I used the command:
4036
4037 $*
4038 ./try
4039
4040and I got the following output:
4041
4042EOM
4043dflt=y
4044if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4045 if sh -c './try' >>try.msg 2>&1; then
4046 xxx=`./try`
4047 case "$xxx" in
4048 "Ok") dflt=n ;;
4049 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4050 case " $libs " in
4051 *" -lsfio "*)
4052 cat >> try.msg <<'EOQS'
4053If $libs contains -lsfio, and sfio is mis-configured, then it
4054sometimes (apparently) runs and exits with a 0 status, but with no
4055output! It may have to do with sfio's use of _exit vs. exit.
4056
4057EOQS
4058 rp="You have a big problem. Shall I abort Configure"
4059 dflt=y
4060 ;;
4061 esac
4062 ;;
4063 esac
4064 else
4065 echo "The program compiled OK, but exited with status $?." >>try.msg
4066 rp="You have a problem. Shall I abort Configure"
4067 dflt=y
4068 fi
4069else
4070 echo "I can't compile the test program." >>try.msg
4071 rp="You have a BIG problem. Shall I abort Configure"
4072 dflt=y
4073fi
4074case "$dflt" in
4075y)
4076 $cat try.msg >&4
4077 case "$knowitall" in
4078 '')
4079 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4080 ;;
bd9b35c9 4081 *) dflt=n;;
c4f23d77 4082 esac
bd9b35c9
JH
4083 echo " "
4084 . ./myread
4085 case "$ans" in
4086 n*|N*) ;;
4087 *) echo "Ok. Stopping Configure." >&4
4088 exit 1
c4f23d77
AD
4089 ;;
4090 esac
4091 ;;
bd9b35c9 4092n) echo "OK, that should do.";;
c4f23d77 4093esac
bd9b35c9 4094$rm -f try try.* core
c4f23d77 4095
bd9b35c9
JH
4096: define an is-a-typedef? function
4097typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4098case "$inclist" in
4099"") inclist="sys/types.h";;
4100esac;
4101eval "varval=\$$var";
4102case "$varval" in
4103"")
4104 $rm -f temp.c;
4105 for inc in $inclist; do
4106 echo "#include <$inc>" >>temp.c;
4107 done;
4108 echo "#ifdef $type" >> temp.c;
4109 echo "printf(\"We have $type\");" >> temp.c;
4110 echo "#endif" >> temp.c;
4111 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4112 if $contains $type temp.E >/dev/null 2>&1; then
4113 eval "$var=\$type";
4114 else
4115 eval "$var=\$def";
4116 fi;
4117 $rm -f temp.?;;
4118*) eval "$var=\$varval";;
4119esac'
8e07c86e 4120
bd9b35c9
JH
4121: define an is-a-typedef? function that prompts if the type is not available.
4122typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4123case "$inclist" in
4124"") inclist="sys/types.h";;
4125esac;
4126eval "varval=\$$var";
4127case "$varval" in
4128"")
4129 $rm -f temp.c;
4130 for inc in $inclist; do
4131 echo "#include <$inc>" >>temp.c;
4132 done;
4133 echo "#ifdef $type" >> temp.c;
4134 echo "printf(\"We have $type\");" >> temp.c;
4135 echo "#endif" >> temp.c;
4136 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4137 echo " " ;
4138 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4139 if $contains $type temp.E >/dev/null 2>&1; then
4140 echo "$type found." >&4;
4141 eval "$var=\$type";
4142 else
4143 echo "$type NOT found." >&4;
4144 dflt="$def";
4145 . ./myread ;
4146 eval "$var=\$ans";
4147 fi;
4148 $rm -f temp.?;;
4149*) eval "$var=\$varval";;
4150esac'
8e07c86e 4151
bd9b35c9
JH
4152: define a shorthand compile call
4153compile='
4154mc_file=$1;
4155shift;
4156$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4157: define a shorthand compile call for compilations that should be ok.
4158compile_ok='
4159mc_file=$1;
4160shift;
4161$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
8e07c86e 4162
bd9b35c9
JH
4163: check for lengths of integral types
4164echo " "
4165case "$intsize" in
2afac517 4166'')
bd9b35c9
JH
4167 echo "Checking to see how big your integers are..." >&4
4168 $cat >intsize.c <<'EOCP'
4169#include <stdio.h>
4170int main()
4171{
4172 printf("intsize=%d;\n", (int)sizeof(int));
4173 printf("longsize=%d;\n", (int)sizeof(long));
4174 printf("shortsize=%d;\n", (int)sizeof(short));
4175 exit(0);
4176}
4177EOCP
4178 set intsize
4179 if eval $compile_ok && ./intsize > /dev/null; then
4180 eval `./intsize`
4181 echo "Your integers are $intsize bytes long."
4182 echo "Your long integers are $longsize bytes long."
4183 echo "Your short integers are $shortsize bytes long."
2afac517 4184 else
bd9b35c9
JH
4185 $cat >&4 <<EOM
4186!
4187Help! I can't compile and run the intsize test program: please enlighten me!
4188(This is probably a misconfiguration in your system or libraries, and
4189you really ought to fix it. Still, I'll try anyway.)
4190!
4191EOM
4192 dflt=4
4193 rp="What is the size of an integer (in bytes)?"
4194 . ./myread
4195 intsize="$ans"
4196 dflt=$intsize
4197 rp="What is the size of a long integer (in bytes)?"
4198 . ./myread
4199 longsize="$ans"
4200 dflt=2
4201 rp="What is the size of a short integer (in bytes)?"
4202 . ./myread
4203 shortsize="$ans"
2afac517 4204 fi
4205 ;;
8e07c86e 4206esac
bd9b35c9
JH
4207$rm -f intsize intsize.*
4208
4209: see what type lseek is declared as in the kernel
4210rp="What is the type used for lseek's offset on this system?"
4211set off_t lseektype long stdio.h sys/types.h
4212eval $typedef_ask
4213
4214echo " "
4215$echo $n "Checking to see how big your file offsets are...$c" >&4
4216$cat >try.c <<EOCP
4217#include <sys/types.h>
4218#include <stdio.h>
4219int main()
4220{
4221 printf("%d\n", (int)sizeof($lseektype));
4222 return(0);
4223}
4224EOCP
4225set try
4226if eval $compile_ok; then
4227 lseeksize=`./try`
4228 $echo " $lseeksize bytes." >&4
4229else
4230 dflt=$longsize
4231 echo " "
4232 echo "(I can't seem to compile the test program. Guessing...)"
4233 rp="What is the size of your file offsets (in bytes)?"
4234 . ./myread
4235 lseeksize="$ans"
4236fi
4237$rm -f try.c try
4238
4239: see what type file positions are declared as in the library
4240rp="What is the type for file position used by fsetpos()?"
4241set fpos_t fpostype long stdio.h sys/types.h
4242eval $typedef_ask
4243
4244echo " "
4245case "$fpostype" in
4246*_t) zzz="$fpostype" ;;
4247*) zzz="fpos_t" ;;
4248esac
4249$echo $n "Checking the size of $zzz...$c" >&4
4250cat > try.c <<EOCP
4251#include <sys/types.h>
4252#include <stdio.h>
4253int main() {
4254 printf("%d\n", (int)sizeof($fpostype));
4255 exit(0);
4256}
4257EOCP
4258set try
4259if eval $compile_ok; then
4260 yyy=`./try`
4261 case "$yyy" in
4262 '') fpossize=4
4263 echo " "
4264 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4265 ;;
4266 *) fpossize=$yyy
4267 echo " $fpossize bytes."
4268 ;;
4269 esac
4270else
4271 dflt="$longsize"
4272 echo " "
4273 echo "(I can't compile the test program. Guessing...)" >&4
4274 rp="What is the size of your file positions (in bytes)?"
4275 . ./myread
4276 fpossize="$ans"
4277fi
4278
4279
8e07c86e 4280
bd9b35c9
JH
4281case "$lseeksize:$fpossize" in
42828:8) cat <<EOM
8e07c86e 4283
bd9b35c9 4284You can have files larger than 2 gigabytes.
8e07c86e 4285EOM
bd9b35c9
JH
4286 val="$define" ;;
4287*) cat <<EOM
8e07c86e 4288
bd9b35c9
JH
4289Perl can be built to understand large files (files larger than 2 gigabytes)
4290on some systems. To do so, Configure must be run with -Duselargefiles.
4291
4292If this doesn't make any sense to you, just accept the default 'y'.
4293EOM
4294 case "$uselargefiles" in
4295 "$undef"|false|[nN]*) dflt='n' ;;
4296 *) dflt='y' ;;
4297 esac
4298 rp='Try to understand large files, if available?'
4299 . ./myread
4300 case "$ans" in
4301 y|Y) val="$define" ;;
4302 *) val="$undef" ;;
4303 esac
4304 ;;
dfe9444c 4305esac
bd9b35c9
JH
4306set uselargefiles
4307eval $setvar
4308case "$uselargefiles" in
4309"$define")
4310: Look for a hint-file generated 'call-back-unit'. If the
4311: user has specified that a large files perl is to be built,
4312: we may need to set or change some other defaults.
4313 if $test -f uselfs.cbu; then
4314 echo "Your platform has some specific hints for large file builds, using them..."
4315 . ./uselfs.cbu
4316 echo " "
4317 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4318 $cat >try.c <<EOCP
4319#include <sys/types.h>
4320#include <stdio.h>
4321int main()
4322{
4323 printf("%d\n", (int)sizeof($lseektype));
4324 return(0);
4325}
4326EOCP
4327 set try
4328 if eval $compile_ok; then
4329 lseeksize=`./try`
4330 $echo " $lseeksize bytes." >&4
4331 else
4332 dflt="$lseeksize"
4333 echo " "
4334 echo "(I can't seem to compile the test program. Guessing...)"
4335 rp="What is the size of your file offsets (in bytes)?"
4336 . ./myread
4337 lseeksize="$ans"
4338 fi
4339 case "$fpostype" in
4340 *_t) zzz="$fpostype" ;;
4341 *) zzz="fpos_t" ;;
4342 esac
4343 $echo $n "Rechecking the size of $zzz...$c" >&4
4344 $cat > try.c <<EOCP
4345#include <sys/types.h>
4346#include <stdio.h>
4347int main() {
4348 printf("%d\n", (int)sizeof($fpostype));
4349 exit(0);
4350}
4351EOCP
4352 set try
4353 if eval $compile_ok; then
4354 yyy=`./try`
4355 dflt="$lseeksize"
4356 case "$yyy" in
4357 '') echo " "
4358 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4359 ;;
4360 *) fpossize=$yyy
4361 echo " $fpossize bytes."
4362 ;;
4363 esac
4364 else
4365 dflt="$fpossize"
4366 echo " "
4367 echo "(I can't compile the test program. Guessing...)" >&4
4368 rp="What is the size of your file positions (in bytes)?"
4369 . ./myread
4370 fpossize="$ans"
4371 fi
4372 $rm -f try.c try
4373 fi
dfe9444c
AD
4374 ;;
4375esac
bd9b35c9
JH
4376
4377
4378case "$usemorebits" in
4379"$define"|true|[yY]*)
4380 use64bits="$define"
4381 uselongdouble="$define"
4382 usemorebits="$define"
dfe9444c 4383 ;;
bd9b35c9 4384*) usemorebits="$undef"
dfe9444c
AD
4385 ;;
4386esac
dfe9444c 4387
dfe9444c 4388
bd9b35c9
JH
4389case "$intsize:$longsize" in
43908:*|*:8) cat <<EOM
29209bc5 4391
bd9b35c9
JH
4392You have natively 64-bit integers.
4393EOM
ad551343
JH
4394 val="$define"
4395 ;;
4396*) case "$ccflags" in
4397 *-DUSE_64_BITS*|*-DUSE_LONG_LONG*) use64bits="$define";;
4398 *) case "$uselonglong" in
4399 $define|true|[yY]*) use64bits="$define";;
4400 esac
4401 ;;
4402 esac
4403 case "$use64bits" in
4404 $define|true|[yY]*) dflt='y';;
4405 *) dflt='n';;
4406 esac
4407cat <<EOM
29209bc5 4408
bd9b35c9
JH
4409Perl can be built to take advantage of 64-bit integer types
4410on some systems. To do so, Configure must be run with -Duse64bits.
29209bc5 4411
ad551343 4412If this doesn't make any sense to you, just accept the default '$dflt'.
29209bc5 4413EOM
ad551343
JH
4414 rp='Try to use 64-bit integers, if available?'
4415 . ./myread
4416 case "$ans" in
4417 [yY]*) val="$define" ;;
4418 *) val="$undef" ;;
4419 esac
4420 ;;
29209bc5 4421esac
bd9b35c9 4422set use64bits
29209bc5
JH
4423eval $setvar
4424
bd9b35c9
JH
4425case "$archname64" in
4426'') archname64='' ;; # not a typo
4427esac
4428
4429case "$use64bits" in
4430"$define"|true|[yY]*)
4431: Look for a hint-file generated 'call-back-unit'. If the
4432: user has specified that a 64-bit perl is to be built,
4433: we may need to set or change some other defaults.
4434 if $test -f use64bits.cbu; then
4435 echo "Your platform has some specific hints for 64-bit builds, using them..."
4436 . ./use64bits.cbu
4437 else
4438 $cat <<EOM
4439(Your platform doesn't have any specific hints for 64-bit builds.)
4440EOM
4441 case "$intsize:$longsize" in
44428:*|*:8) cat <<EOM
4443(This is probably okay, as your system is a natively 64-bit system.)
4444EOM
4445 ;;
4446 esac
4447 case "$gccversion" in
4448 '') ;;
4449 *) case "$ccflags" in
94df4d2a 4450 *-DUSE_64_BITS*) ;;
bd9b35c9 4451 *) $cat <<EOM
94df4d2a
JH
4452But since you seem to be using gcc, I will now add -DUSE_64_BITS
4453to the compilation flags to get long longs.
bd9b35c9 4454EOM
94df4d2a 4455 ccflags="$ccflags -DUSE_64_BITS"
bd9b35c9
JH
4456 ;;
4457 esac
4458 ;;
4459 esac
4460 fi
4461 ;;
4462esac
4463
4464: determine the architecture name
2afac517 4465echo " "
bd9b35c9
JH
4466if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4467 tarch=`arch`"-$osname"
4468elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4469 if uname -m > tmparch 2>&1 ; then
4470 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4471 -e 's/$/'"-$osname/" tmparch`
4472 else
4473 tarch="$osname"
4474 fi
4475 $rm -f tmparch
4476else
4477 tarch="$osname"
4478fi
4479case "$myarchname" in
4480''|"$tarch") ;;
4481*)
4482 echo "(Your architecture name used to be $myarchname.)"
4483 archname=''
4484 ;;
8e07c86e 4485esac
bd9b35c9
JH
4486myarchname="$tarch"
4487case "$archname" in
4488'') dflt="$tarch";;
4489*) dflt="$archname";;
2afac517 4490esac
bd9b35c9
JH
4491rp='What is your architecture name'
4492. ./myread
4493archname="$ans"
4494case "$usethreads" in
29209bc5 4495$define)
bd9b35c9
JH
4496 echo "Threads selected." >&4
4497 case "$archname" in
4498 *-thread*) echo "...and architecture name already has -thread." >&4
4499 ;;
4500 *) archname="$archname-thread"
4501 echo "...setting architecture name to $archname." >&4
4502 ;;
4503 esac
29209bc5
JH
4504 ;;
4505esac
bd9b35c9
JH
4506case "$usemultiplicity" in
4507$define)
4508 echo "Multiplicity selected." >&4
4509 case "$archname" in
4510 *-multi*) echo "...and architecture name already has -multi." >&4
4511 ;;
4512 *) archname="$archname-multi"
4513 echo "...setting architecture name to $archname." >&4
4514 ;;
4515 esac
4516 ;;
4517esac
4518case "$use64bits" in
4519$define)
4520 case "$archname64" in
4521 '')
4522 ;;
4523 *)
4524 case "$archname" in
4525 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4526 ;;
4527 *) archname="$archname-$archname64"
4528 echo "...setting architecture name to $archname." >&4
4529 ;;
4530 esac
4531 ;;
4532 esac
4533esac
4534
4535: determine root of directory hierarchy where package will be installed.
4536case "$prefix" in
4537'')
4538 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4539 ;;
4540*)
4541 dflt="$prefix"
4542 ;;
4543esac
4544$cat <<EOM
4545
4546By default, $package will be installed in $dflt/bin, manual pages
4547under $dflt/man, etc..., i.e. with $dflt as prefix for all
4548installation directories. Typically this is something like /usr/local.
4549If you wish to have binaries under /usr/bin but other parts of the
4550installation under /usr/local, that's ok: you will be prompted
4551separately for each of the installation directories, the prefix being
4552only used to set the defaults.
4553
4554EOM
4555fn=d~
4556rp='Installation prefix to use?'
4557. ./getfile
4558oldprefix=''
4559case "$prefix" in
4560'') ;;
4561*)
4562 case "$ans" in
4563 "$prefix") ;;
4564 *) oldprefix="$prefix";;
4565 esac
4566 ;;
4567esac
4568prefix="$ans"
4569prefixexp="$ansexp"
4570
4571: is AFS running?
4572echo " "
4573case "$afs" in
4574$define|true) afs=true ;;
4575$undef|false) afs=false ;;
4576*) if test -d /afs; then
4577 afs=true
2afac517 4578 else
bd9b35c9 4579 afs=false
2afac517 4580 fi
bd9b35c9 4581 ;;
8e07c86e 4582esac
bd9b35c9
JH
4583if $afs; then
4584 echo "AFS may be running... I'll be extra cautious then..." >&4
4585else
4586 echo "AFS does not seem to be running..." >&4
4587fi
2afac517 4588
bd9b35c9
JH
4589: determine installation prefix for where package is to be installed.
4590if $afs; then
4633a7c4 4591$cat <<EOM
29209bc5 4592
bd9b35c9
JH
4593Since you are running AFS, I need to distinguish the directory in which
4594files will reside from the directory in which they are installed (and from
4595which they are presumably copied to the former directory by occult means).
4596
4633a7c4 4597EOM
bd9b35c9
JH
4598 case "$installprefix" in
4599 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4600 *) dflt="$installprefix";;
4601 esac
4602else
4603$cat <<EOM
2afac517 4604
bd9b35c9
JH
4605In some special cases, particularly when building $package for distribution,
4606it is convenient to distinguish between the directory in which files should
4607be installed from the directory ($prefix) in which they
4608will eventually reside. For most users, these two directories are the same.
8e07c86e 4609
bd9b35c9
JH
4610EOM
4611 case "$installprefix" in
4612 '') dflt=$prefix ;;
4613 *) dflt=$installprefix;;
4614 esac
4615fi
4616fn=d~
4617rp='What installation prefix should I use for installing files?'
4618. ./getfile
4619installprefix="$ans"
4620installprefixexp="$ansexp"
4633a7c4 4621
bd9b35c9
JH
4622: set the prefixit variable, to compute a suitable default value
4623prefixit='case "$3" in
4624""|none)
4625 case "$oldprefix" in
4626 "") eval "$1=\"\$$2\"";;
4627 *)
4628 case "$3" in
4629 "") eval "$1=";;
4630 none)
4631 eval "tp=\"\$$2\"";
4632 case "$tp" in
4633 ""|" ") eval "$1=\"\$$2\"";;
4634 *) eval "$1=";;
4635 esac;;
4636 esac;;
4637 esac;;
4638*)
4639 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4640 case "$tp" in
4641 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4642 /*-$oldprefix/*|\~*-$oldprefix/*)
4643 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4644 *) eval "$1=\"\$$2\"";;
4645 esac;;
4646esac'
4633a7c4 4647
ff935051
JH
4648: set the base revision
4649baserev=5.0
4650
4651
4652: get the patchlevel
bd9b35c9
JH
4653echo " "
4654echo "Getting the current patchlevel..." >&4
4655if $test -r $rsrc/patchlevel.h;then
4656 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4657 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff935051
JH
4658 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4659 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4660 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bd9b35c9
JH
4661else
4662 patchlevel=0
4663 subversion=0
ff935051
JH
4664 api_revision=0
4665 api_version=0
4666 api_subversion=0
bd9b35c9
JH
4667fi
4668$echo $n "(You have $package" $c
4669case "$package" in
4670"*$baserev") ;;
4671*) $echo $n " $baserev" $c ;;
4633a7c4 4672esac
bd9b35c9
JH
4673$echo $n " patchlevel $patchlevel" $c
4674test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4675echo ".)"
ff935051 4676case "$osname" in
3645a519 4677dos|vms)
ff935051
JH
4678 : XXX Should be a Configure test for double-dots in filenames.
4679 version=`echo $baserev $patchlevel $subversion | \
273cf8d1 4680 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
ff935051
JH
4681 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4682 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4683 ;;
4684*)
4685 version=`echo $baserev $patchlevel $subversion | \
4686 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4687 api_versionstring=`echo $api_revision $api_version $api_subversion | \
273cf8d1 4688 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
ff935051
JH
4689 ;;
4690esac
4691: Special case the 5.005_xx maintenance series, which used 5.005
4692: without any subversion label as a subdirectory in $sitelib
4693if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4694 api_versionstring='5.005'
273cf8d1 4695fi
bd9b35c9
JH
4696
4697: determine installation style
4698: For now, try to deduce it from prefix unless it is already set.
4699: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4700case "$installstyle" in
4701'') case "$prefix" in
4702 *perl*) dflt='lib';;
4703 *) dflt='lib/perl5' ;;
34d1710f 4704 esac
4633a7c4 4705 ;;
bd9b35c9 4706*) dflt='lib/perl5' ;;
4633a7c4 4707esac
bd9b35c9
JH
4708: Probably not worth prompting for this since we prompt for all
4709: the directories individually, and the prompt would be too long and
4710: confusing anyway.
4711installstyle=$dflt
4633a7c4 4712
bd9b35c9
JH
4713: determine where private library files go
4714: Usual default is /usr/local/lib/perl5/$version.
4715: Also allow things like /opt/perl/lib/$version, since
4716: /opt/perl/lib/perl5... would be redundant.
4717: The default "style" setting is made in installstyle.U
4718case "$installstyle" in
4719*lib/perl5*) set dflt privlib lib/$package/$version ;;
4720*) set dflt privlib lib/$version ;;
a4f3eea9 4721esac
bd9b35c9
JH
4722eval $prefixit
4723$cat <<EOM
a4f3eea9 4724
bd9b35c9
JH
4725There are some auxiliary files for $package that need to be put into a
4726private library directory that is accessible by everyone.
4727
4728EOM
4729fn=d~+
4730rp='Pathname where the private library files will reside?'
4731. ./getfile
4732privlib="$ans"
4733privlibexp="$ansexp"
4734: Change installation prefix, if necessary.
4735if $test X"$prefix" != X"$installprefix"; then
4736 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
a4f3eea9 4737else
bd9b35c9
JH
4738 installprivlib="$privlibexp"
4739fi
a4f3eea9 4740
bd9b35c9
JH
4741: set the prefixup variable, to restore leading tilda escape
4742prefixup='case "$prefixexp" in
4743"$prefix") ;;
4744*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4745esac'
a4f3eea9 4746
bd9b35c9
JH
4747: determine where public architecture dependent libraries go
4748set archlib archlib
4749eval $prefixit
4750: privlib default is /usr/local/lib/$package/$version
4751: archlib default is /usr/local/lib/$package/$version/$archname
4752: privlib may have an optional trailing /share.
4753tdflt=`echo $privlib | $sed 's,/share$,,'`
4754tdflt=$tdflt/$archname
4755case "$archlib" in
4756'') dflt=$tdflt
29209bc5 4757 ;;
bd9b35c9
JH
4758*) dflt="$archlib"
4759 ;;
29209bc5 4760esac
bd9b35c9 4761$cat <<EOM
29209bc5 4762
bd9b35c9
JH
4763$spackage contains architecture-dependent library files. If you are
4764sharing libraries in a heterogeneous environment, you might store
4765these files in a separate location. Otherwise, you can just include
4766them with the rest of the public library files.
a4f3eea9 4767
bd9b35c9
JH
4768EOM
4769fn=d+~
4770rp='Where do you want to put the public architecture-dependent libraries?'
4771. ./getfile
4772archlib="$ans"
4773archlibexp="$ansexp"
4774if $test X"$archlib" = X"$privlib"; then
4775 d_archlib="$undef"
4776else
4777 d_archlib="$define"
4778fi
4779: Change installation prefix, if necessary.
4780if $test X"$prefix" != X"$installprefix"; then
4781 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4782else
4783 installarchlib="$archlibexp"
4784fi
a4f3eea9 4785
a4f3eea9 4786
bd9b35c9
JH
4787: Binary compatibility with 5.005 is not possible for builds
4788: with advanced features
4789case "$usethreads$usemultiplicity" in
4790*define*)
4791 bincompat5005="$undef"
4792 d_bincompat5005="$undef"
4793 ;;
4794*) $cat <<EOM
a4f3eea9 4795
bd9b35c9
JH
4796Perl 5.006 can be compiled for binary compatibility with 5.005.
4797If you decide to do so, you will be able to continue using most
4798of the extensions that were compiled for Perl 5.005.
a4f3eea9 4799
a4f3eea9 4800EOM
bd9b35c9
JH
4801 case "$bincompat5005$d_bincompat5005" in
4802 *"$undef"*) dflt=n ;;
4803 *) dflt=y ;;
a4f3eea9 4804 esac
bd9b35c9
JH
4805 rp='Binary compatibility with Perl 5.005?'
4806 . ./myread
4807 case "$ans" in
4808 y*) val="$define" ;;
4809 *) val="$undef" ;;
a4f3eea9 4810 esac
bd9b35c9
JH
4811 set d_bincompat5005
4812 eval $setvar
4813 case "$d_bincompat5005" in
4814 "$define")
4815 bincompat5005="$define"
4816 ;;
4817 *) bincompat5005="$undef"
4818 d_bincompat5005="$undef"
a4f3eea9 4819 ;;
4820 esac
bd9b35c9 4821 ;;
a4f3eea9 4822esac
4823
a4f3eea9 4824
bd9b35c9
JH
4825: see if setuid scripts can be secure
4826$cat <<EOM
a4f3eea9 4827
bd9b35c9
JH
4828Some kernels have a bug that prevents setuid #! scripts from being
4829secure. Some sites have disabled setuid #! scripts because of this.
a4f3eea9 4830
bd9b35c9
JH
4831First let's decide if your kernel supports secure setuid #! scripts.
4832(If setuid #! scripts would be secure but have been disabled anyway,
4833don't say that they are secure if asked.)
5ff3f7a4
GS
4834
4835EOM
a4f3eea9 4836
bd9b35c9
JH
4837val="$undef"
4838if $test -d /dev/fd; then
4839 echo "#!$ls" >reflect
4840 chmod +x,u+s reflect
4841 ./reflect >flect 2>&1
4842 if $contains "/dev/fd" flect >/dev/null; then
4843 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4844 val="$define"
4845 else
4846 $cat <<EOM
4847If you are not sure if they are secure, I can check but I'll need a
4848username and password different from the one you are using right now.
4849If you don't have such a username or don't want me to test, simply
4850enter 'none'.
a4f3eea9 4851
4852EOM
bd9b35c9
JH
4853 rp='Other username to test security of setuid scripts with?'
4854 dflt='none'
4855 . ./myread
4856 case "$ans" in
4857 n|none)
4858 case "$d_suidsafe" in
4859 '') echo "I'll assume setuid scripts are *not* secure." >&4
4860 dflt=n;;
4861 "$undef")
4862 echo "Well, the $hint value is *not* secure." >&4
4863 dflt=n;;
4864 *) echo "Well, the $hint value *is* secure." >&4
4865 dflt=y;;
dfe9444c
AD
4866 esac
4867 ;;
bd9b35c9
JH
4868 *)
4869 $rm -f reflect flect
4870 echo "#!$ls" >reflect
4871 chmod +x,u+s reflect
4872 echo >flect
4873 chmod a+w flect
4874 echo '"su" will (probably) prompt you for '"$ans's password."
4875 su $ans -c './reflect >flect'
4876 if $contains "/dev/fd" flect >/dev/null; then
4877 echo "Okay, it looks like setuid scripts are secure." >&4
4878 dflt=y
4879 else
4880 echo "I don't think setuid scripts are secure." >&4
4881 dflt=n
4882 fi
4883 ;;
4884 esac
4885 rp='Does your kernel have *secure* setuid scripts?'
4886 . ./myread
4887 case "$ans" in
4888 [yY]*) val="$define";;
4889 *) val="$undef";;
dfe9444c 4890 esac
a4f3eea9 4891 fi
4892else
bd9b35c9
JH
4893 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4894 echo "(That's for file descriptors, not floppy disks.)"
4895 val="$undef"
a4f3eea9 4896fi
bd9b35c9
JH
4897set d_suidsafe
4898eval $setvar
4899
4900$rm -f reflect flect
4901
4902: now see if they want to do setuid emulation
4903echo " "
4904val="$undef"
4905case "$d_suidsafe" in
4906"$define")
4907 val="$undef"
4908 echo "No need to emulate SUID scripts since they are secure here." >& 4
4909 ;;
4910*)
4911 $cat <<EOM
4912Some systems have disabled setuid scripts, especially systems where
4913setuid scripts cannot be secure. On systems where setuid scripts have
4914been disabled, the setuid/setgid bits on scripts are currently
4915useless. It is possible for $package to detect those bits and emulate
4916setuid/setgid in a secure fashion. This emulation will only work if
4917setuid scripts have been disabled in your kernel.
4918
4919EOM
4920 case "$d_dosuid" in
4921 "$define") dflt=y ;;
4922 *) dflt=n ;;
a4f3eea9 4923 esac
bd9b35c9 4924 rp="Do you want to do setuid/setgid emulation?"
a4f3eea9 4925 . ./myread
4926 case "$ans" in
bd9b35c9
JH
4927 [yY]*) val="$define";;
4928 *) val="$undef";;
a4f3eea9 4929 esac
4930 ;;
a4f3eea9 4931esac
bd9b35c9
JH
4932set d_dosuid
4933eval $setvar
a4f3eea9 4934
bfb7748a
AD
4935: determine filename position in cpp output
4936echo " "
4937echo "Computing filename position in cpp output for #include directives..." >&4
4938echo '#include <stdio.h>' > foo.c
4939$cat >fieldn <<EOF
4940$startsh
4941$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4942$grep '^[ ]*#.*stdio\.h' | \
4943while read cline; do
4944 pos=1
4945 set \$cline
4946 while $test \$# -gt 0; do
4947 if $test -r \`echo \$1 | $tr -d '"'\`; then
4948 echo "\$pos"
4949 exit 0
4950 fi
4951 shift
4952 pos=\`expr \$pos + 1\`
4953 done
4954done
4955EOF
4956chmod +x fieldn
4957fieldn=`./fieldn`
4958$rm -f foo.c fieldn
4959case $fieldn in
4960'') pos='???';;
49611) pos=first;;
49622) pos=second;;
49633) pos=third;;
4964*) pos="${fieldn}th";;
4965esac
4966echo "Your cpp writes the filename in the $pos field of the line."
4967
4968: locate header file
4969$cat >findhdr <<EOF
4970$startsh
4971wanted=\$1
9cc6feab 4972name=''
3656fc86
JH
4973for usrincdir in $usrinc
4974do
4975 if test -f \$usrincdir/\$wanted; then
4976 echo "\$usrincdir/\$wanted"
4977 exit 0
4978 fi
4979done
bfb7748a
AD
4980awkprg='{ print \$$fieldn }'
4981echo "#include <\$wanted>" > foo\$\$.c
4982$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4983$grep "^[ ]*#.*\$wanted" | \
4984while read cline; do
4985 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4986 case "\$name" in
4e400192
JH
4987 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4988 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4989 *) exit 2;;
bfb7748a
AD
4990 esac;
4991done;
4e400192
JH
4992#
4993# status = 0: grep returned 0 lines, case statement not executed
4994# status = 1: headerfile found
4995# status = 2: while loop executed, no headerfile found
4996#
4997status=\$?
bfb7748a 4998$rm -f foo\$\$.c;
4e400192
JH
4999if test \$status -eq 1; then
5000 exit 0;
5001fi
5002exit 1
bfb7748a
AD
5003EOF
5004chmod +x findhdr
5005
5006: define an alternate in-header-list? function
5007inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5008cont=true; xxf="echo \"<\$1> found.\" >&4";
5009case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5010*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5011esac;
5012case $# in 4) instead=instead;; *) instead="at last";; esac;
5013while $test "$cont"; do
5014 xxx=`./findhdr $1`
5015 var=$2; eval "was=\$$2";
5016 if $test "$xxx" && $test -r "$xxx";
5017 then eval $xxf;
5018 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5019 cont="";
5020 else eval $xxnf;
5021 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5022 set $yyy; shift; shift; yyy=$@;
5023 case $# in 0) cont="";;
5024 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5025 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5026 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5027 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5028 esac;
5029done;
5030while $test "$yyy";
5031do set $yyy; var=$2; eval "was=\$$2";
5032 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5033 set $yyy; shift; shift; yyy=$@;
5034done'
5035
5036: see if this is a malloc.h system
5037set malloc.h i_malloc
5038eval $inhdr
5039
5040: see if stdlib is available
5041set stdlib.h i_stdlib
5042eval $inhdr
5043
5044: determine which malloc to compile in
5045echo " "
5046case "$usemymalloc" in
5ff3f7a4
GS
5047''|[yY]*|true|$define) dflt='y' ;;
5048*) dflt='n' ;;
bfb7748a
AD
5049esac
5050rp="Do you wish to attempt to use the malloc that comes with $package?"
5051. ./myread
5052usemymalloc="$ans"
5053case "$ans" in
5054y*|true)
5055 usemymalloc='y'
5056 mallocsrc='malloc.c'
5057 mallocobj="malloc$_o"
5058 d_mymalloc="$define"
5059 case "$libs" in
5060 *-lmalloc*)
5061 : Remove malloc from list of libraries to use
5062 echo "Removing unneeded -lmalloc from library list" >&4
5063 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5064 shift
5065 libs="$*"
5066 echo "libs = $libs" >&4
5067 ;;
5068 esac
5069 ;;
5070*)
5071 usemymalloc='n'
5072 mallocsrc=''
5073 mallocobj=''
5074 d_mymalloc="$undef"
5075 ;;
5076esac
5077
5078: compute the return types of malloc and free
5079echo " "
5080$cat >malloc.c <<END
5081#$i_malloc I_MALLOC
5082#$i_stdlib I_STDLIB
5083#include <stdio.h>
5084#include <sys/types.h>
5085#ifdef I_MALLOC
5086#include <malloc.h>
5087#endif
5088#ifdef I_STDLIB
5089#include <stdlib.h>
5090#endif
5091#ifdef TRY_MALLOC
5092void *malloc();
5093#endif
5094#ifdef TRY_FREE
5095void free();
5096#endif
5097END
5098case "$malloctype" in
5099'')
5100 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5101 malloctype='void *'
5102 else
5103 malloctype='char *'
5104 fi
5105 ;;
5106esac
5107echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5108
5109case "$freetype" in
5110'')
5111 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5112 freetype='void'
5113 else
5114 freetype='int'
5115 fi
5116 ;;
5117esac
5118echo "Your system uses $freetype free(), it would seem." >&4
5119$rm -f malloc.[co]
a3635516
JH
5120$cat <<EOM
5121
5122The installation process will also create a directory for
5123vendor-supplied add-ons. Vendors who supply perl with their system
5124may find it convenient to place all vendor-supplied files in this
5125directory rather than in the main distribution directory. This will
5126ease upgrades between binary-compatible maintenance versions of perl.
5127
5128Of course you may also use these directories in whatever way you see
5129fit. For example, you might use them to access modules shared over a
5130company-wide network.
5131
5132The default answer should be fine for most people.
5133This causes further questions about vendor add-ons to be skipped
5134and no vendor-specific directories will be configured for perl.
5135
5136EOM
5137rp='Do you want to configure vendor-specific add-on directories?'
5138case "$usevendorprefix" in
5139define|true|[yY]*) dflt=y ;;
5140*) dflt=n ;;
5141esac
5142. ./myread
5143case "$ans" in
5144[yY]*) fn=d~+
5145 rp='Installation prefix to use for vendor-supplied add-ons?'
5146 case "$vendorprefix" in
5147 '') dflt='' ;;
5148 *) dflt=$vendorprefix ;;
5149 esac
5150 . ./getfile
5151 oldvendorprefix=''
5152 case "$vendorprefix" in
5153 '') ;;
5154 *) case "$ans" in
5155 "$prefix") ;;
5156 *) oldvendorprefix="$prefix";;
5157 esac
5158 ;;
5159 esac
5160 usevendorprefix="$define"
5161 vendorprefix="$ans"
5162 vendorprefixexp="$ansexp"
5163 ;;
5164*) usevendorprefix="$undef"
5165 vendorprefix=''
5166 vendorprefixexp=''
5167 ;;
5168esac
5169
5170case "$vendorprefix" in
5171'') d_vendorlib="$undef"
5172 vendorlib=''
5173 vendorlibexp=''
5174 ;;
5175*) d_vendorlib="$define"
5176 : determine where vendor-supplied modules go.
629ae163 5177 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
a3635516
JH
5178 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5179 case "$installstyle" in
629ae163
GS
5180 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5181 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
a3635516
JH
5182 esac
5183 fn=d~+
5184 rp='Pathname for the vendor-supplied library files?'
5185 . ./getfile
5186 vendorlib="$ans"
5187 vendorlibexp="$ansexp"
5188 : Change installation prefix, if necessary.
5189 if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5190 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
a3635516
JH
5191 else
5192 installvendorlib="$vendorlibexp"
5193 fi
5194 ;;
5195esac
5196
c4f23d77
AD
5197: Cruising for prototypes
5198echo " "
5199echo "Checking out function prototypes..." >&4
5200$cat >prototype.c <<'EOCP'
5a411a32 5201int main(int argc, char *argv[]) {
c4f23d77
AD
5202 exit(0);}
5203EOCP
5204if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5205 echo "Your C compiler appears to support function prototypes."
5206 val="$define"
5207else
5208 echo "Your C compiler doesn't seem to understand function prototypes."
5209 val="$undef"
5210fi
5211set prototype
5212eval $setvar
5213$rm -f prototype*
5214
5215case "$prototype" in
5216"$define") ;;
5217*) ansi2knr='ansi2knr'
5218 echo " "
5219 cat <<EOM >&4
5220
5221$me: FATAL ERROR:
5222This version of $package can only be compiled by a compiler that
5223understands function prototypes. Unfortunately, your C compiler
5224 $cc $ccflags
5225doesn't seem to understand them. Sorry about that.
5226
5ff3f7a4 5227If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
5228
5229Eventually, we hope to support building Perl with pre-ANSI compilers.
5230If you would like to help in that effort, please contact <perlbug@perl.org>.
5231
5232Aborting Configure now.
5233EOM
5234 exit 2
5235 ;;
5236esac
5237
5238: determine where public executables go
5239echo " "
5240set dflt bin bin
5241eval $prefixit
5242fn=d~
5243rp='Pathname where the public executables will reside?'
5244. ./getfile
5245if $test "X$ansexp" != "X$binexp"; then
5246 installbin=''
5247fi
5248bin="$ans"
5249binexp="$ansexp"
dd4e71fd
JH
5250: Change installation prefix, if necessary.
5251: XXX Bug? -- ignores Configure -Dinstallprefix setting.
5252if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5253 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5254else
5255 installbin="$binexp"
c4f23d77
AD
5256fi
5257
ff935051
JH
5258$cat <<EOM
5259
5260After $package is installed, you may wish to install various
5261add-on modules and utilities. Typically, these add-ons will
5262be installed under $prefix with the rest
5263of this package. However, you may wish to install such add-ons
5264elsewhere under a different prefix.
5265
5266If you do not wish to put everything under a single prefix, that's
5267ok. You will be prompted for the individual locations; this siteprefix
5268is only used to suggest the defaults.
5269
5270The default should be fine for most people.
5271
5272EOM
5273fn=d~+
5274rp='Installation prefix to use for add-on modules and utilities?'
5275: XXX Here might be another good place for an installstyle setting.
5276case "$siteprefix" in
5277'') dflt=$prefix ;;
5278*) dflt=$siteprefix ;;
5279esac
5280. ./getfile
5281oldsiteprefix=''
5282case "$siteprefix" in
5283'') ;;
5284*)
5285 case "$ans" in
5286 "$prefix") ;;
5287 *) oldsiteprefix="$prefix";;
5288 esac
5289 ;;
5290esac
5291siteprefix="$ans"
5292siteprefixexp="$ansexp"
5293
5294: determine where site specific libraries go.
5295: Usual default is /usr/local/lib/perl5/site_perl/$version
5296: The default "style" setting is made in installstyle.U
5297: XXX No longer works with Prefixit stuff.
5298prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5299case "$installstyle" in
5300*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5301*) dflt=$siteprefix/lib/site_$prog/$version ;;
5302esac
5303$cat <<EOM
5304
5305The installation process will create a directory for
5306site-specific extensions and modules. Most users find it convenient
5307to place all site-specific files in this directory rather than in the
5308main distribution directory.
5309
5310EOM
5311fn=d~+
5312rp='Pathname for the site-specific library files?'
5313. ./getfile
5314sitelib="$ans"
5315sitelibexp="$ansexp"
5316: Change installation prefix, if necessary.
5317if $test X"$prefix" != X"$installprefix"; then
5318 installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5319else
5320 installsitelib="$sitelibexp"
5321fi
5322
5323: Determine list of previous versions to include in @INC
5324$cat > getverlist <<EOPL
5325#!$perl -w
5326use File::Basename;
5327\$api_versionstring = "$api_versionstring";
5328\$version = "$version";
5329\$sitelib = "$sitelib";
5330\$archname = "$archname";
5331EOPL
5332 $cat >> getverlist <<'EOPL'
5333# Can't have leading @ because metaconfig interprets it as a command!
5334;@inc_version_list=();
5335$stem=dirname($sitelib);
5336# Redo to do opendir/readdir?
5337if (-d $stem) {
5338 chdir($stem);
5339 ;@candidates = glob("5.*");
5340}
5341else {
5342 ;@candidates = ();
5343}
5344
937ac629
JH
5345# XXX ToDo: These comparisons must be reworked when two-digit
5346# subversions come along, so that 5.7.10 compares as greater than
5347# 5.7.3! By that time, hope that 5.6.x is sufficiently
5348# widespread that we can use the built-in version vectors rather
5349# than reinventing them here. For 5.6.0, however, we must
5350# assume this script will likely be run by 5.005_0x. --AD 1/2000.
ff935051
JH
5351foreach $d (@candidates) {
5352 if ($d lt $version) {
5353 if ($d ge $api_versionstring) {
5354 unshift(@inc_version_list, "$d/$archname", $d);
5355 }
5356 elsif ($d ge "5.005") {
5357 unshift(@inc_version_list, $d);
5358 }
5359 }
5360 else {
5361 # Skip newer version. I.e. don't look in
5362 # 5.7.0 if we're installing 5.6.1.
5363 }
5364}
5365
5366if (@inc_version_list) {
3a096bf3 5367 print join(' ', @inc_version_list);
ff935051
JH
5368}
5369else {
5370 # Blank space to preserve value for next Configure run.
5371 print " ";
5372}
5373EOPL
5374chmod +x getverlist
5375case "$inc_version_list" in
5376'') if test -x $perl; then
5377 dflt=`$perl getverlist`
5378 else
3a096bf3 5379 dflt='none'
ff935051
JH
5380 fi
5381 ;;
3a096bf3 5382$undef) dflt='none' ;;
ff935051
JH
5383*) dflt="$inc_version_list" ;;
5384esac
5385$cat <<'EOM'
5386
5387In order to ease the process of upgrading, this version of perl
5388can be configured to use modules built and installed with earlier
5389versions of perl that were installed under $prefix. Specify here
5390the list of earlier versions that this version of perl should check.
5391If Configure detected no earlier versions of perl installed under
3a096bf3
JH
5392$prefix, then the list will be empty. Answer 'none' to tell perl
5393to not search earlier versions.
ff935051
JH
5394
5395The default should almost always be sensible, so if you're not sure,
5396just accept the default.
5397EOM
5398
3a096bf3 5399rp='List of earlier versions to include in @INC?'
ff935051 5400. ./myread
3a096bf3
JH
5401case "$ans" in
5402[Nn]one) inc_version_list=' ' ;;
5403*) inc_version_list="$ans" ;;
5404esac
5405case "$inc_version_list" in
5406''|' ')
82aaaa3c 5407 inc_version_list_init='0';;
3a096bf3 5408*) inc_version_list_init=`echo $inc_version_list |
82aaaa3c 5409 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
3a096bf3
JH
5410 ;;
5411esac
ff935051
JH
5412$rm -f getverlist
5413
104d25b7
JH
5414: determine whether to install perl also as /usr/bin/perl
5415
5416echo " "
dd4e71fd 5417if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7
JH
5418 $cat <<EOM
5419Many scripts expect to perl to be installed as /usr/bin/perl.
5420I can install the perl you are about to compile also as /usr/bin/perl
5421(in addition to $installbin/perl).
5422EOM
472a4973
JH
5423 case "$installusrbinperl" in
5424 "$undef"|[nN]*) dflt='n';;
5425 *) dflt='y';;
5426 esac
104d25b7
JH
5427 rp="Do you want to install perl as /usr/bin/perl?"
5428 . ./myread
5429 case "$ans" in
5430 [yY]*) val="$define";;
472a4973 5431 *) val="$undef" ;;
104d25b7 5432 esac
472a4973
JH
5433else
5434 val="$undef"
5435fi
104d25b7
JH
5436set installusrbinperl
5437eval $setvar
5438
a4f3eea9 5439echo " "
5440echo "Checking for GNU C Library..." >&4
5441cat >gnulibc.c <<EOM
aebf16e7 5442#include <stdio.h>
5a411a32 5443int main()
a4f3eea9 5444{
aebf16e7
AD
5445#ifdef __GLIBC__
5446 exit(0);
5447#else
5448 exit(1);
5449#endif
a4f3eea9 5450}
5451EOM
dfe9444c 5452set gnulibc
aebf16e7 5453if eval $compile_ok && ./gnulibc; then
a4f3eea9 5454 val="$define"
5455 echo "You are using the GNU C Library"
4633a7c4 5456else
a4f3eea9 5457 val="$undef"
5458 echo "You are not using the GNU C Library"
4633a7c4 5459fi
a4f3eea9 5460$rm -f gnulibc*
5461set d_gnulibc
5462eval $setvar
25f94b33 5463
a4f3eea9 5464: see if nm is to be used to determine whether a symbol is defined or not
5465case "$usenm" in
5466'')
dc45a647 5467 dflt=''
a4f3eea9 5468 case "$d_gnulibc" in
dc45a647
MB
5469 "$define")
5470 echo " "
5471 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 5472 dflt=n
5473 ;;
dc45a647
MB
5474 esac
5475 case "$dflt" in
5476 '')
5477 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5478 echo " "
5479 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5480 echo "'nm' won't be sufficient on this sytem." >&4
5481 dflt=n
5482 fi
5483 ;;
5484 esac
5485 case "$dflt" in
c4f23d77 5486 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 5487 if $test $dflt -gt 20; then
5488 dflt=y
5489 else
5490 dflt=n
5491 fi
5492 ;;
5493 esac
5494 ;;
5495*)
5496 case "$usenm" in
dc45a647 5497 true|$define) dflt=y;;
a4f3eea9 5498 *) dflt=n;;
5499 esac
5500 ;;
25f94b33 5501esac
a4f3eea9 5502$cat <<EOM
4633a7c4 5503
dc45a647
MB
5504I can use $nm to extract the symbols from your C libraries. This
5505is a time consuming task which may generate huge output on the disk (up
5506to 3 megabytes) but that should make the symbols extraction faster. The
5507alternative is to skip the 'nm' extraction part and to compile a small
5508test program instead to determine whether each symbol is present. If
5509you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5510this may be the best solution.
5511
5512You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 5513
a4f3eea9 5514EOM
693762b4 5515rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
5516. ./myread
5517case "$ans" in
dc45a647 5518[Nn]*) usenm=false;;
a4f3eea9 5519*) usenm=true;;
4633a7c4
LW
5520esac
5521
a4f3eea9 5522runnm=$usenm
5523case "$reuseval" in
5524true) runnm=false;;
4633a7c4 5525esac
a4f3eea9 5526
5527: nm options which may be necessary
5528case "$nm_opt" in
5529'') if $test -f /mach_boot; then
1e422769 5530 nm_opt='' # Mach
a4f3eea9 5531 elif $test -d /usr/ccs/lib; then
1e422769 5532 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 5533 elif $test -f /dgux; then
1e422769 5534 nm_opt='-p' # DG-UX
2ae324a7 5535 elif $test -f /lib64/rld; then
1e422769 5536 nm_opt='-p' # 64-bit Irix
a4f3eea9 5537 else
5538 nm_opt=''
5539 fi;;
4633a7c4 5540esac
4633a7c4 5541
a4f3eea9 5542: nm options which may be necessary for shared libraries but illegal
5543: for archive libraries. Thank you, Linux.
5544case "$nm_so_opt" in
5545'') case "$myuname" in
5546 *linux*)
693762b4 5547 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 5548 nm_so_opt='--dynamic'
4633a7c4 5549 fi
a4f3eea9 5550 ;;
4633a7c4 5551 esac
4633a7c4
LW
5552 ;;
5553esac
5554
a4f3eea9 5555case "$runnm" in
5556true)
5557: get list of predefined functions in a handy place
5558echo " "
5559case "$libc" in
5560'') libc=unknown
5561 case "$libs" in
dfe9444c 5562 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 5563 esac
5564 ;;
5565esac
5566libnames='';
5567case "$libs" in
5568'') ;;
5569*) for thislib in $libs; do
5570 case "$thislib" in
5571 -lc|-lc_s)
5572 : Handle C library specially below.
5573 ;;
5574 -l*)
5575 thislib=`echo $thislib | $sed -e 's/^-l//'`
5576 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5577 :
5578 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5579 :
dfe9444c 5580 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 5581 :
dfe9444c 5582 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 5583 :
a4f3eea9 5584 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5585 :
5586 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5587 :
dfe9444c 5588 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 5589 :
5590 else
5591 try=''
5592 fi
5593 libnames="$libnames $try"
5594 ;;
5595 *) libnames="$libnames $thislib" ;;
5596 esac
5597 done
5598 ;;
5599esac
5600xxx=normal
5601case "$libc" in
5602unknown)
5603 set /lib/libc.$so
5604 for xxx in $libpth; do
5605 $test -r $1 || set $xxx/libc.$so
5606 : The messy sed command sorts on library version numbers.
5607 $test -r $1 || \
5608 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 5609 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 5610 h
5611 s/[0-9][0-9]*/0000&/g
5612 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5613 G
5614 s/\n/ /' | \
dfe9444c 5615 sort | $sed -e 's/^.* //'`
a4f3eea9 5616 eval set \$$#
5617 done
5618 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
5619 $test -r $1 || set /lib/libsys_s$_a
5620 ;;
a4f3eea9 5621*)
5622 set blurfl
5623 ;;
5624esac
5625if $test -r "$1"; then
5626 echo "Your (shared) C library seems to be in $1."
5627 libc="$1"
5628elif $test -r /lib/libc && $test -r /lib/clib; then
5629 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5630 xxx=apollo
5631 libc='/lib/clib /lib/libc'
5632 if $test -r /lib/syslib; then
5633 echo "(Your math library is in /lib/syslib.)"
5634 libc="$libc /lib/syslib"
5635 fi
5636elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5637 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
5638elif $test -r $incpath/usr/lib/libc$_a; then
5639 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 5640 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
5641elif $test -r /lib/libc$_a; then
5642 libc=/lib/libc$_a;
a4f3eea9 5643 echo "Your C library seems to be in $libc. You're normal."
5644else
dfe9444c 5645 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 5646 :
5647 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5648 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5649 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5650 :
dfe9444c 5651 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5652 :
dfe9444c 5653 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5654 :
4633a7c4 5655 else
dfe9444c 5656 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 5657 fi
a4f3eea9 5658 if $test -r "$tans"; then
5659 echo "Your C library seems to be in $tans, of all places."
5660 libc=$tans
5661 else
5662 libc='blurfl'
5663 fi
5664fi
5665if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5666 dflt="$libc"
5667 cat <<EOM
4633a7c4 5668
a4f3eea9 5669If the guess above is wrong (which it might be if you're using a strange
5670compiler, or your machine supports multiple models), you can override it here.
4633a7c4 5671
a4f3eea9 5672EOM
5673else
5674 dflt=''
28e8609d 5675 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 5676 cat >&4 <<EOM
5677I can't seem to find your C library. I've looked in the following places:
4633a7c4 5678
a4f3eea9 5679EOM
5680 $sed 's/^/ /' libpath
5681 cat <<EOM
4633a7c4 5682
a4f3eea9 5683None of these seems to contain your C library. I need to get its name...
4633a7c4 5684
a4f3eea9 5685EOM
5686fi
5687fn=f
5688rp='Where is your C library?'
5689. ./getfile
5690libc="$ans"
4633a7c4 5691
4633a7c4 5692echo " "
28e8609d 5693echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 5694set X `cat libnames`
4633a7c4 5695shift
a4f3eea9 5696xxx=files
5697case $# in 1) xxx=file; esac
5698echo "Extracting names from the following $xxx for later perusal:" >&4
5699echo " "
5700$sed 's/^/ /' libnames >&4
5701echo " "
5702$echo $n "This may take a while...$c" >&4
4633a7c4 5703
dfe9444c
AD
5704for file in $*; do
5705 case $file in
693762b4
AD
5706 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5707 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5708 esac
dfe9444c 5709done >libc.tmp
4633a7c4 5710
a4f3eea9 5711$echo $n ".$c"
5712$grep fprintf libc.tmp > libc.ptf
5713xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5714xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5715xxx='[ADTSIW]'
5716if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5717 eval $xscan;\
5718 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719 eval $xrun
5720elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5721 eval $xscan;\
5722 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723 eval $xrun
5724elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5725 eval $xscan;\
5726 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727 eval $xrun
5728elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5729 eval $xscan;\
5730 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731 eval $xrun
5732elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5733 eval $xscan;\
5734 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735 eval $xrun
5736elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5737 eval $xscan;\
5738 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739 eval $xrun
5740elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5741 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5742 eval $xscan;\
5743 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744 eval $xrun
5745elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5746 eval $xscan;\
5747 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748 eval $xrun
5749elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5750 eval $xscan;\
5751 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752 eval $xrun
1e422769 5753elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5754 eval $xscan;\
5755 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756 eval $xrun
a4f3eea9 5757elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5758 eval $xscan;\
5759 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760 eval $xrun
5761elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5762 eval $xscan;\
5763 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764 eval $xrun
44a8e56a 5765elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5766 eval $xscan;\
5767 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768 eval $xrun
0f502cca
BL
5769elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5770 eval $xscan;\
5771 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772 eval $xrun
a4f3eea9 5773else
693762b4 5774 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 5775 $grep fprintf libc.tmp > libc.ptf
5776 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5777 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5778 then
5779 nm_opt='-p'
5780 eval $xrun
4633a7c4 5781 else
a4f3eea9 5782 echo " "
e5c9fcd0 5783 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 5784 com=''
dc45a647
MB
5785 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5786 for thisname in $libnames $libc; do
e5c9fcd0 5787 $ar t $thisname >>libc.tmp
a4f3eea9 5788 done
dfe9444c 5789 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 5790 echo "Ok." >&4
dc45a647
MB
5791 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5792 # Repeat libc to extract forwarders to DLL entries too
5793 for thisname in $libnames $libc; do
5794 $ar tv $thisname >>libc.tmp
5795 # Revision 50 of EMX has bug in $ar.
5796 # it will not extract forwarders to DLL entries
5797 # Use emximp which will extract exactly them.
5798 emximp -o tmp.imp $thisname \
5799 2>/dev/null && \
5800 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5801 < tmp.imp >>libc.tmp
5802 $rm tmp.imp
5803 done
5804 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5805 echo "Ok." >&4
a4f3eea9 5806 else
e5c9fcd0 5807 echo "$ar didn't seem to work right." >&4
a4f3eea9 5808 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 5809 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 5810 then
5811 for thisname in $libnames; do
5812 bld t $libnames | \
dfe9444c 5813 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 5814 $ar t $thisname >>libc.tmp
a4f3eea9 5815 done
5816 echo "Ok." >&4
5817 else
5818 echo "That didn't work either. Giving up." >&4
5819 exit 1
5820 fi
5821 fi
4633a7c4 5822 fi
4633a7c4 5823fi
a4f3eea9 5824nm_extract="$com"
5825if $test -f /lib/syscalls.exp; then
4633a7c4 5826 echo " "
a4f3eea9 5827 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 5828 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 5829fi
5830;;
5831esac
5832$rm -f libnames libpath
5833
2afac517 5834: see if dld is available
5835set dld.h i_dld
5836eval $inhdr
4633a7c4 5837
2afac517 5838: is a C symbol defined?
5839csym='tlook=$1;
5840case "$3" in
5841-v) tf=libc.tmp; tc=""; tdc="";;
5842-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5843*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5844esac;
5845tx=yes;
5846case "$reuseval-$4" in
5847true-) ;;
5848true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5849esac;
5850case "$tx" in
5851yes)
5852 case "$runnm" in
5853 true)
5854 if $contains $tlook $tf >/dev/null 2>&1;
5855 then tval=true;
5856 else tval=false;
5857 fi;;
5858 *)
d674cd6d 5859 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 5860 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 5861 then tval=true;
5862 else tval=false;
5863 fi;
5864 $rm -f t t.c;;
5865 esac;;
5866*)
5867 case "$tval" in
5868 $define) tval=true;;
5869 *) tval=false;;
5870 esac;;
5871esac;
5872eval "$2=$tval"'
4633a7c4 5873
2afac517 5874: define an is-in-libc? function
5875inlibc='echo " "; td=$define; tu=$undef;
5876sym=$1; var=$2; eval "was=\$$2";
5877tx=yes;
5878case "$reuseval$was" in
5879true) ;;
5880true*) tx=no;;
5881esac;
5882case "$tx" in
5883yes)
5884 set $sym tres -f;
5885 eval $csym;
5886 case "$tres" in
5887 true)
5888 echo "$sym() found." >&4;
5889 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5890 *)
5891 echo "$sym() NOT found." >&4;
5892 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5893 esac;;
5894*)
5895 case "$was" in
5896 $define) echo "$sym() found." >&4;;
5897 *) echo "$sym() NOT found." >&4;;
5898 esac;;
5899esac'
4633a7c4 5900
2afac517 5901: see if dlopen exists
5902xxx_runnm="$runnm"
5903runnm=false
5904set dlopen d_dlopen
5905eval $inlibc
5906runnm="$xxx_runnm"
40a7a20a 5907
2afac517 5908: determine which dynamic loading, if any, to compile in
4633a7c4 5909echo " "
2afac517 5910dldir="ext/DynaLoader"
5911case "$usedl" in
5912$define|y|true)
5913 dflt='y'
5914 usedl="$define"
5915 ;;
5916$undef|n|false)
5917 dflt='n'
5918 usedl="$undef"
5919 ;;
5920*)
5921 dflt='n'
5922 case "$d_dlopen" in
5923 $define) dflt='y' ;;
5924 esac
5925 case "$i_dld" in
5926 $define) dflt='y' ;;
4633a7c4 5927 esac
2afac517 5928 : Does a dl_xxx.xs file exist for this operating system
dc45a647 5929 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
5930 ;;
5931esac
2afac517 5932rp="Do you wish to use dynamic loading?"
5933. ./myread
5934usedl="$ans"
5935case "$ans" in
5936y*) usedl="$define"
5937 case "$dlsrc" in
5938 '')
dc45a647 5939 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 5940 dflt="$dldir/dl_${osname}.xs"
5941 elif $test "$d_dlopen" = "$define" ; then
5942 dflt="$dldir/dl_dlopen.xs"
5943 elif $test "$i_dld" = "$define" ; then
5944 dflt="$dldir/dl_dld.xs"
4633a7c4 5945 else
2afac517 5946 dflt=''
4633a7c4 5947 fi
4633a7c4 5948 ;;
2afac517 5949 *) dflt="$dldir/$dlsrc"
5950 ;;
4633a7c4 5951 esac
2afac517 5952 echo "The following dynamic loading files are available:"
5953 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
5954 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5955 rp="Source file to use for dynamic loading"
5956 fn="fne"
b233458b 5957 gfpth="$src"
dc45a647 5958 . ./getfile
2afac517 5959 usedl="$define"
5960 : emulate basename
5961 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 5962
dc45a647 5963 $cat << EOM
2304df62 5964
2afac517 5965Some systems may require passing special flags to $cc -c to
5966compile modules that will be used to create a shared library.
5967To use no flags, say "none".
2304df62
AD
5968
5969EOM
2afac517 5970 case "$cccdlflags" in
5971 '') case "$gccversion" in
5972 '') case "$osname" in
5973 hpux) dflt='+z' ;;
5974 next) dflt='none' ;;
8cc95fdb 5975 irix*) dflt='-KPIC' ;;
3a6175e1 5976 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 5977 sunos) dflt='-pic' ;;
5978 *) dflt='none' ;;
dfe9444c
AD
5979 esac
5980 ;;
5981 *) case "$osname" in
3a6175e1 5982 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 5983 *) dflt='-fpic' ;;
81d89818 5984 esac ;;
2afac517 5985 esac ;;
bfb7748a 5986 ' ') dflt='none' ;;
2afac517 5987 *) dflt="$cccdlflags" ;;
5988 esac
5989 rp="Any special flags to pass to $cc -c to compile shared library modules?"
5990 . ./myread
5991 case "$ans" in
5992 none) cccdlflags=' ' ;;
5993 *) cccdlflags="$ans" ;;
5994 esac
2304df62 5995
2afac517 5996 cat << EOM
ecfc5424 5997
2afac517 5998Some systems use ld to create libraries that can be dynamically loaded,
5999while other systems (such as those using ELF) use $cc.
a0f45b59 6000
2afac517 6001EOM
6002 case "$ld" in
6003 '') $cat >try.c <<'EOM'
6004/* Test for whether ELF binaries are produced */
6005#include <fcntl.h>
6006#include <stdlib.h>
5a411a32 6007int main() {
2afac517 6008 char b[4];
6009 int i = open("a.out",O_RDONLY);
6010 if(i == -1)
6011 exit(1); /* fail */
6012 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6013 exit(0); /* succeed (yes, it's ELF) */
2304df62 6014 else
2afac517 6015 exit(1); /* fail */
6016}
6017EOM
6018 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6019 cat <<EOM
6020You appear to have ELF support. I'll use $cc to build dynamic libraries.
6021EOM
6022 dflt="$cc"
2304df62 6023 else
2afac517 6024 echo "I'll use ld to build dynamic libraries."
6025 dflt='ld'
2304df62 6026 fi
2afac517 6027 rm -f try.c a.out
6028 ;;
6029 *) dflt="$ld"
6030 ;;
6031 esac
6032
6033 rp="What command should be used to create dynamic libraries?"
6034 . ./myread
6035 ld="$ans"
6036
6037 cat << EOM
6038
6039Some systems may require passing special flags to $ld to create a
6040library that can be dynamically loaded. If your ld flags include
6041-L/other/path options to locate libraries outside your loader's normal
6042search path, you may need to specify those -L options here as well. To
6043use no flags, say "none".
6044
6045EOM
6046 case "$lddlflags" in
6047 '') case "$osname" in
46193409 6048 beos) dflt='-nostart' ;;
f7dd4e7f 6049 hpux) dflt='-b +vnocompatwarnings' ;;
2afac517 6050 linux|irix*) dflt='-shared' ;;
6051 next) dflt='none' ;;
6052 solaris) dflt='-G' ;;
6053 sunos) dflt='-assert nodefinitions' ;;
6054 svr4*|esix*) dflt="-G $ldflags" ;;
6055 *) dflt='none' ;;
6056 esac
6057 ;;
6058 *) dflt="$lddlflags" ;;
6059 esac
6060
bfb7748a 6061 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
6062 : Be careful not to append to a plain 'none'
6063 case "$dflt" in
6064 none) dflt='' ;;
6065 esac
bfb7748a
AD
6066 for thisflag in $ldflags; do
6067 case "$thisflag" in
6068 -L*)
6069 case " $dflt " in
6070 *" $thisflag "*) ;;
6071 *) dflt="$dflt $thisflag" ;;
6072 esac
6073 ;;
2afac517 6074 esac
bfb7748a 6075 done
2afac517 6076
bfb7748a
AD
6077 case "$dflt" in
6078 ''|' ') dflt='none' ;;
6079 esac
2afac517 6080
6081 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6082 . ./myread
6083 case "$ans" in
6084 none) lddlflags=' ' ;;
6085 *) lddlflags="$ans" ;;
6086 esac
6087
6088 cat <<EOM
6089
6090Some systems may require passing special flags to $cc to indicate that
6091the resulting executable will use dynamic linking. To use no flags,
6092say "none".
6093
6094EOM
6095 case "$ccdlflags" in
6096 '') case "$osname" in
6097 hpux) dflt='-Wl,-E' ;;
6098 linux) dflt='-rdynamic' ;;
6099 next) dflt='none' ;;
6100 sunos) dflt='none' ;;
6101 *) dflt='none' ;;
6102 esac ;;
bfb7748a 6103 ' ') dflt='none' ;;
2afac517 6104 *) dflt="$ccdlflags" ;;
6105 esac
7f95ee77 6106 rp="Any special flags to pass to $cc to use dynamic linking?"
2afac517 6107 . ./myread
6108 case "$ans" in
6109 none) ccdlflags=' ' ;;
6110 *) ccdlflags="$ans" ;;
6111 esac
6112 ;;
6113*) usedl="$undef"
6114 ld='ld'
6115 dlsrc='dl_none.xs'
6116 lddlflags=''
6117 ccdlflags=''
6118 ;;
6119esac
6120
6121also=''
6122case "$usedl" in
6123$undef)
6124 # No dynamic loading being used, so don't bother even to prompt.
6125 useshrplib='false'
6126 ;;
6127*) case "$useshrplib" in
6128 '') case "$osname" in
4fabb596 6129 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
3e3baf6d 6130 dflt=y
2afac517 6131 also='Building a shared libperl is required for dynamic loading to work on your system.'
6132 ;;
6133 next*)
6134 case "$osvers" in
3e3baf6d 6135 4*) dflt=y
2afac517 6136 also='Building a shared libperl is needed for MAB support.'
6137 ;;
3e3baf6d 6138 *) dflt=n
2afac517 6139 ;;
6140 esac
6141 ;;
3e3baf6d 6142 *) dflt=n
2afac517 6143 ;;
6144 esac
6145 ;;
6146 $define|true|[Yy]*)
3e3baf6d 6147 dflt=y
2afac517 6148 ;;
3e3baf6d 6149 *) dflt=n
2afac517 6150 ;;
6151 esac
6152 $cat << EOM
6153
6154The perl executable is normally obtained by linking perlmain.c with
dfe9444c 6155libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 6156any other libraries needed on this system (such as -lm, etc.). Since
6157your system supports dynamic loading, it is probably possible to build
6158a shared libperl.$so. If you will have more than one executable linked
6159to libperl.$so, this will significantly reduce the size of each
6160executable, but it may have a noticeable affect on performance. The
6161default is probably sensible for your system.
6162$also
6163
6164EOM
6165 rp="Build a shared libperl.$so (y/n)"
6166 . ./myread
6167 case "$ans" in
6168 true|$define|[Yy]*)
5cf1d1f1 6169 useshrplib='true' ;;
2afac517 6170 *) useshrplib='false' ;;
6171 esac
6172 ;;
6173esac
6174
6175case "$useshrplib" in
6176true)
6177 case "$libperl" in
6178 '')
6179 # Figure out a good name for libperl.so. Since it gets stored in
6180 # a version-specific architecture-dependent library, the version
6181 # number isn't really that important, except for making cc/ld happy.
6182 #
6183 # A name such as libperl.so.3.1
6184 majmin="libperl.$so.$patchlevel.$subversion"
6185 # A name such as libperl.so.301
6186 majonly=`echo $patchlevel $subversion |
6187 $awk '{printf "%d%02d", $1, $2}'`
6188 majonly=libperl.$so.$majonly
6189 # I'd prefer to keep the os-specific stuff here to a minimum, and
6190 # rely on figuring it out from the naming of libc.
6191 case "${osname}${osvers}" in
6192 next4*)
6193 dflt=libperl.5.$so
6194 # XXX How handle the --version stuff for MAB?
6195 ;;
6196 linux*) # ld won't link with a bare -lperl otherwise.
6197 dflt=libperl.$so
6198 ;;
4fabb596
GS
6199 cygwin*) # include version
6200 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6201 ;;
2afac517 6202 *) # Try to guess based on whether libc has major.minor.
6203 case "$libc" in
6204 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6205 *libc.$so.[0-9]*) dflt=$majonly ;;
6206 *) dflt=libperl.$so ;;
6207 esac
6208 ;;
6209 esac
6210 ;;
6211 *) dflt=$libperl
6212 ;;
6213 esac
6214 cat << EOM
6215
6216I need to select a good name for the shared libperl. If your system uses
6217library names with major and minor numbers, then you might want something
6218like $majmin. Alternatively, if your system uses a single version
6219number for shared libraries, then you might want to use $majonly.
6220Or, your system might be quite happy with a simple libperl.$so.
6221
6222Since the shared libperl will get installed into a version-specific
6223architecture-dependent directory, the version number of the shared perl
6224library probably isn't important, so the default should be o.k.
6225
6226EOM
6227 rp='What name do you want to give to the shared libperl?'
6228 . ./myread
6229 libperl=$ans
6230 echo "Ok, I'll use $libperl"
6231 ;;
6232*)
dfe9444c 6233 libperl="libperl${_a}"
2afac517 6234 ;;
6235esac
6236
6237# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6238case "$shrpdir" in
6239'') ;;
6240*) $cat >&4 <<EOM
6241WARNING: Use of the shrpdir variable for the installation location of
6242the shared $libperl is not supported. It was never documented and
46193409 6243will not work in this version. Let me (perlbug@perl.com)
dfe9444c 6244know of any problems this may cause.
2afac517 6245
6246EOM
6247 case "$shrpdir" in
6248 "$archlibexp/CORE")
6249 $cat >&4 <<EOM
6250But your current setting of $shrpdir is
6251the default anyway, so it's harmless.
6252EOM
6253 ;;
6254 *)
4e2a5f63
AD
6255 $cat >&4 <<EOM
6256Further, your current attempted setting of $shrpdir
6257conflicts with the value of $archlibexp/CORE
6258that installperl will use.
6259EOM
dc45a647
MB
6260 ;;
6261 esac
6262 ;;
6263esac
6264
6265# How will the perl executable find the installed shared $libperl?
6266# Add $xxx to ccdlflags.
6267# If we can't figure out a command-line option, use $shrpenv to
6268# set env LD_RUN_PATH. The main perl makefile uses this.
6269shrpdir=$archlibexp/CORE
6270xxx=''
6271tmp_shrpenv=''
6272if "$useshrplib"; then
6273 case "$osname" in
6274 aix)
6275 # We'll set it in Makefile.SH...
6276 ;;
6277 solaris|netbsd)
6278 xxx="-R $shrpdir"
6279 ;;
6280 freebsd)
6281 xxx="-Wl,-R$shrpdir"
6282 ;;
6283 linux|irix*|dec_osf)
6284 xxx="-Wl,-rpath,$shrpdir"
6285 ;;
6286 next)
6287 # next doesn't like the default...
6288 ;;
46193409
JH
6289 beos)
6290 # beos doesn't like the default, either.
6291 ;;
3656fc86
JH
6292 hpux*)
6293 # hpux doesn't like the default, either.
6294 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6295 ;;
dc45a647
MB
6296 *)
6297 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6298 ;;
6299 esac
6300 case "$xxx" in
6301 '') ;;
6302 *)
6303 # Only add $xxx if it isn't already in ccdlflags.
6304 case " $ccdlflags " in
6305 *" $xxx "*) ;;
6306 *) ccdlflags="$ccdlflags $xxx"
6307 cat <<EOM >&4
6308
6309Adding $xxx to the flags
6310passed to $ld so that the perl executable will find the
6311installed shared $libperl.
6312
6313EOM
6314 ;;
6315 esac
6316 ;;
6317 esac
6318fi
5cf1d1f1
JH
6319# Fix ccdlflags in AIX for building external extensions.
6320# (For building Perl itself bare -bE:perl.exp is needed,
6321# Makefile.SH takes care of this.)
5f9d9a17 6322case "$osname" in
5cf1d1f1 6323aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5f9d9a17 6324esac
dc45a647
MB
6325# Respect a hint or command-line value.
6326case "$shrpenv" in
6327'') shrpenv="$tmp_shrpenv" ;;
6328esac
5cf1d1f1
JH
6329case "$ldlibpthname" in
6330'') ldlibpthname=LD_LIBRARY_PATH ;;
6331none) ldlibpthname='' ;;
6332esac
dc45a647
MB
6333
6334: determine where manual pages go
6335set man1dir man1dir none
6336eval $prefixit
6337$cat <<EOM
6338
6339$spackage has manual pages available in source form.
6340EOM
6341case "$nroff" in
6342nroff)
6343 echo "However, you don't have nroff, so they're probably useless to you."
6344 case "$man1dir" in
6345 '') man1dir="none";;
6346 esac;;
6347esac
6348echo "If you don't want the manual sources installed, answer 'none'."
6349case "$man1dir" in
6350' ') dflt=none
6351 ;;
6352'')
6353 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6354 lookpath="$lookpath $prefixexp/man/p_man/man1"
6355 lookpath="$lookpath $prefixexp/man/u_man/man1"
6356 lookpath="$lookpath $prefixexp/man/man.1"
6357 case "$sysman" in
6358 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6359 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6360 esac
6361 set dflt
6362 eval $prefixup
6363 ;;
6364*) dflt="$man1dir"
6365 ;;
6366esac
6367echo " "
6368fn=dn+~
6369rp="Where do the main $spackage manual pages (source) go?"
6370. ./getfile
6371if $test "X$man1direxp" != "X$ansexp"; then
6372 installman1dir=''
6373fi
6374man1dir="$ans"
6375man1direxp="$ansexp"
6376case "$man1dir" in
dd4e71fd 6377'') man1dir=' '
dc45a647
MB
6378 installman1dir='';;
6379esac
dc45a647 6380
dd4e71fd
JH
6381: Change installation prefix, if necessary.
6382if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6383 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6384else
6385 installman1dir="$man1direxp"
dc45a647
MB
6386fi
6387
6388: What suffix to use on installed man pages
6389
6390case "$man1dir" in
6391' ')
6392 man1ext='0'
6393 ;;
6394*)
6395 rp="What suffix should be used for the main $spackage man pages?"
6396 case "$man1ext" in
6397 '') case "$man1dir" in
6398 *1) dflt=1 ;;
6399 *1p) dflt=1p ;;
6400 *1pm) dflt=1pm ;;
6401 *l) dflt=l;;
6402 *n) dflt=n;;
6403 *o) dflt=o;;
6404 *p) dflt=p;;
6405 *C) dflt=C;;
6406 *L) dflt=L;;
6407 *L1) dflt=L1;;
6408 *) dflt=1;;
6409 esac
6410 ;;
6411 *) dflt="$man1ext";;
6412 esac
6413 . ./myread
6414 man1ext="$ans"
6415 ;;
6416esac
6417
6418: see if we can have long filenames
6419echo " "
6420rmlist="$rmlist /tmp/cf$$"
6421$test -d /tmp/cf$$ || mkdir /tmp/cf$$
6422first=123456789abcdef
6423second=/tmp/cf$$/$first
6424$rm -f $first $second
6425if (echo hi >$first) 2>/dev/null; then
6426 if $test -f 123456789abcde; then
6427 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6428 val="$undef"
6429 else
6430 if (echo hi >$second) 2>/dev/null; then
6431 if $test -f /tmp/cf$$/123456789abcde; then
6432 $cat <<'EOM'
6433That's peculiar... You can have filenames longer than 14 characters, but only
6434on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
6435I shall consider your system cannot support long filenames at all.
6436EOM
6437 val="$undef"
6438 else
6439 echo 'You can have filenames longer than 14 characters.' >&4
6440 val="$define"
6441 fi
6442 else
6443 $cat <<'EOM'
6444How confusing! Some of your filesystems are sane enough to allow filenames
6445longer than 14 characters but some others like /tmp can't even think about them.
6446So, for now on, I shall assume your kernel does not allow them at all.
6447EOM
6448 val="$undef"
6449 fi
6450 fi
6451else
6452 $cat <<'EOM'
6453You can't have filenames longer than 14 chars. You can't even think about them!
6454EOM
6455 val="$undef"
6456fi
6457set d_flexfnam
6458eval $setvar
6459$rm -rf /tmp/cf$$ 123456789abcde*
6460
6461: determine where library module manual pages go
6462set man3dir man3dir none
6463eval $prefixit
6464$cat <<EOM
6465
6466$spackage has manual pages for many of the library modules.
6467EOM
6468
6469case "$nroff" in
6470nroff)
6471 $cat <<'EOM'
6472However, you don't have nroff, so they're probably useless to you.
6473EOM
6474 case "$man3dir" in
6475 '') man3dir="none";;
6476 esac;;
6477esac
6478
6479case "$d_flexfnam" in
6480undef)
6481 $cat <<'EOM'
6482However, your system can't handle the long file names like File::Basename.3.
6483EOM
6484 case "$man3dir" in
6485 '') man3dir="none";;
6486 esac;;
6487esac
6488
6489echo "If you don't want the manual sources installed, answer 'none'."
6490prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6491case "$man3dir" in
dd4e71fd
JH
6492'') dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6493 if $test -d "$privlib/man/man3"; then
6494 cat <<EOM >&4
6495
6496WARNING: Previous versions of perl installed man3 pages into
6497$privlib/man/man3. This version will suggest a
6498new default of $dflt.
6499EOM
6500 tdflt=$dflt
6501 dflt='n'
6502 rp='Do you wish to preserve the old behavior?(y/n)'
6503 . ./myread
6504 case "$ans" in
6505 y*) dflt="$privlib/man/man3" ;;
6506 *) dflt=$tdflt ;;
6507 esac
6508 fi
2afac517 6509 ;;
dc45a647
MB
6510' ') dflt=none;;
6511*) dflt="$man3dir" ;;
2afac517 6512esac
dc45a647 6513echo " "
dc45a647
MB
6514fn=dn+~
6515rp="Where do the $package library man pages (source) go?"
6516. ./getfile
dc45a647
MB
6517man3dir="$ans"
6518man3direxp="$ansexp"
dd4e71fd
JH
6519case "$man1dir" in
6520'') man3dir=' '
dc45a647
MB
6521 installman3dir='';;
6522esac
dc45a647 6523
dd4e71fd
JH
6524: Change installation prefix, if necessary.
6525if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6526 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6527else
6528 installman3dir="$man3direxp"
dc45a647
MB
6529fi
6530
6531: What suffix to use on installed man pages
dc45a647
MB
6532case "$man3dir" in
6533' ')
6534 man3ext='0'
6535 ;;
6536*)
6537 rp="What suffix should be used for the $package library man pages?"
6538 case "$man3ext" in
6539 '') case "$man3dir" in
6540 *3) dflt=3 ;;
6541 *3p) dflt=3p ;;
6542 *3pm) dflt=3pm ;;
6543 *l) dflt=l;;
6544 *n) dflt=n;;
6545 *o) dflt=o;;
6546 *p) dflt=p;;
6547 *C) dflt=C;;
6548 *L) dflt=L;;
6549 *L3) dflt=L3;;
6550 *) dflt=3;;
2afac517 6551 esac
6552 ;;
dc45a647 6553 *) dflt="$man3ext";;
2afac517 6554 esac
dc45a647
MB
6555 . ./myread
6556 man3ext="$ans"
6557 ;;
2afac517 6558esac
6559
6560: see if we have to deal with yellow pages, now NIS.
6561if $test -d /usr/etc/yp || $test -d /etc/yp; then
6562 if $test -f /usr/etc/nibindd; then
6563 echo " "
6564 echo "I'm fairly confident you're on a NeXT."
6565 echo " "
6566 rp='Do you get the hosts file via NetInfo?'
6567 dflt=y
6568 case "$hostcat" in
6569 nidump*) ;;
6570 '') ;;
6571 *) dflt=n;;
6572 esac
6573 . ./myread
6574 case "$ans" in
6575 y*) hostcat='nidump hosts .';;
6576 *) case "$hostcat" in
6577 nidump*) hostcat='';;
6578 esac
6579 ;;
6580 esac
6581 fi
6582 case "$hostcat" in
6583 nidump*) ;;
6584 *)
6585 case "$hostcat" in
6586 *ypcat*) dflt=y;;
6587 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6588 dflt=y
6589 else
6590 dflt=n
6591 fi;;
6592 *) dflt=n;;
6593 esac
6594 echo " "
6595 rp='Are you getting the hosts file via yellow pages?'
6596 . ./myread
6597 case "$ans" in
6598 y*) hostcat='ypcat hosts';;
6599 *) hostcat='cat /etc/hosts';;
6600 esac
6601 ;;
6602 esac
6603fi
dfe9444c 6604case "$hostcat" in
7599c0b3 6605'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
dfe9444c
AD
6606esac
6607case "$groupcat" in
7599c0b3 6608'') test -f /etc/group && groupcat='cat /etc/group';;
dfe9444c
AD
6609esac
6610case "$passcat" in
7599c0b3 6611'') test -f /etc/passwd && passcat='cat /etc/passwd';;
dfe9444c 6612esac
2afac517 6613
6614: now get the host name
6615echo " "
6616echo "Figuring out host name..." >&4
6617case "$myhostname" in
6618'') cont=true
6619 echo 'Maybe "hostname" will work...'
6620 if tans=`sh -c hostname 2>&1` ; then
6621 myhostname=$tans
6622 phostname=hostname
6623 cont=''
6624 fi
6625 ;;
6626*) cont='';;
6627esac
6628if $test "$cont"; then
6629 if ./xenix; then
6630 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
6631 if tans=`cat /etc/systemid 2>&1` ; then
6632 myhostname=$tans
6633 phostname='cat /etc/systemid'
6634 echo "Whadyaknow. Xenix always was a bit strange..."
6635 cont=''
6636 fi
6637 elif $test -r /etc/systemid; then
6638 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6639 fi
6640fi
6641if $test "$cont"; then
6642 echo 'No, maybe "uuname -l" will work...'
6643 if tans=`sh -c 'uuname -l' 2>&1` ; then
6644 myhostname=$tans
6645 phostname='uuname -l'
6646 else
6647 echo 'Strange. Maybe "uname -n" will work...'
6648 if tans=`sh -c 'uname -n' 2>&1` ; then
6649 myhostname=$tans
6650 phostname='uname -n'
6651 else
6652 echo 'Oh well, maybe I can mine it out of whoami.h...'
6653 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6654 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6655 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6656 else
6657 case "$myhostname" in
6658 '') echo "Does this machine have an identity crisis or something?"
6659 phostname='';;
6660 *)
6661 echo "Well, you said $myhostname before..."
6662 phostname='echo $myhostname';;
6663 esac
6664 fi
6665 fi
6666 fi
6667fi
6668: you do not want to know about this
6669set $myhostname
6670myhostname=$1
6671
6672: verify guess
6673if $test "$myhostname" ; then
6674 dflt=y
6675 rp='Your host name appears to be "'$myhostname'".'" Right?"
6676 . ./myread
6677 case "$ans" in
6678 y*) ;;
6679 *) myhostname='';;
6680 esac
6681fi
6682
6683: bad guess or no guess
6684while $test "X$myhostname" = X ; do
6685 dflt=''
6686 rp="Please type the (one word) name of your host:"
6687 . ./myread
6688 myhostname="$ans"
6689done
6690
6691: translate upper to lower if necessary
6692case "$myhostname" in
6693*[A-Z]*)
6694 echo "(Normalizing case in your host name)"
6695 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6696 ;;
6697esac
6698
6699case "$myhostname" in
6700*.*)
6701 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6702 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6703 echo "(Trimming domain name from host name--host name is now $myhostname)"
6704 ;;
6705*) case "$mydomain" in
6706 '')
6707 {
2afac517 6708 test "X$hostcat" = "Xypcat hosts" &&
6709 ypmatch "$myhostname" hosts 2>/dev/null |\
6710 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
6711 $test -s hosts
6712 } || {
7599c0b3 6713 test "X$hostcat" != "X" &&
2afac517 6714 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
6715 /[ ]$myhostname[ . ]/p" > hosts
6716 }
6717 tmp_re="[ . ]"
6718 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
6719 END { print sum }" hosts` = x1 || tmp_re="[ ]"
6720 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6721 hosts | $sort | $uniq | \
6722 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6723 case `$echo X$dflt` in
6724 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
6725 dflt=.
6726 ;;
6727 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6728 ;;
6729 esac
6730 case "$dflt" in
6731 .)
6732 tans=`./loc resolv.conf X /etc /usr/etc`
6733 if $test -f "$tans"; then
6734 echo "(Attempting domain name extraction from $tans)"
a6006777 6735 dflt=.`$sed -n -e 's/ / /g' \
28757baa 6736 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 6737 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 6738 case "$dflt" in
a6006777 6739 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 6740 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 6741 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 6742 ;;
2afac517 6743 esac
6744 fi
6745 ;;
6746 esac
6747 case "$dflt" in
6748 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6749 dflt=.`sh -c domainname 2>/dev/null`
6750 case "$dflt" in
6751 '') dflt='.';;
6752 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6753 esac
6754 ;;
6755 esac
6756 case "$dflt" in
6757 .) echo "(Lost all hope -- silly guess then)"
6758 dflt='.uucp'
6759 ;;
6760 esac
6761 $rm -f hosts
6762 ;;
6763 *) dflt="$mydomain";;
6764 esac;;
6765esac
6766echo " "
6767rp="What is your domain name?"
6768. ./myread
6769tans="$ans"
6770case "$ans" in
6771'') ;;
6772.*) ;;
6773*) tans=".$tans";;
6774esac
6775mydomain="$tans"
6776
6777: translate upper to lower if necessary
6778case "$mydomain" in
6779*[A-Z]*)
6780 echo "(Normalizing case in your domain name)"
6781 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6782 ;;
6783esac
6784
6785: a little sanity check here
6786case "$phostname" in
6787'') ;;
6788*)
6789 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6790 $myhostname$mydomain|$myhostname) ;;
6791 *)
6792 case "$phostname" in
6793 sed*)
6794 echo "(That doesn't agree with your whoami.h file, by the way.)"
6795 ;;
6796 *)
6797 echo "(That doesn't agree with your $phostname command, by the way.)"
6798 ;;
6799 esac
6800 ;;
6801 esac
6802 ;;
6803esac
6804
6805$cat <<EOM
6806
6807I need to get your e-mail address in Internet format if possible, i.e.
6808something like user@host.domain. Please answer accurately since I have
6809no easy means to double check it. The default value provided below
7f95ee77 6810is most probably close to reality but may not be valid from outside
2afac517 6811your organization...
6812
6813EOM
6814cont=x
6815while test "$cont"; do
6816 case "$cf_email" in
6817 '') dflt="$cf_by@$myhostname$mydomain";;
6818 *) dflt="$cf_email";;
6819 esac
6820 rp='What is your e-mail address?'
6821 . ./myread
6822 cf_email="$ans"
6823 case "$cf_email" in
6824 *@*.*) cont='' ;;
6825 *)
6826 rp='Address does not look like an Internet one. Use it anyway?'
6827 case "$fastread" in
6828 yes) dflt=y ;;
6829 *) dflt=n ;;
6830 esac
6831 . ./myread
6832 case "$ans" in
6833 y*) cont='' ;;
6834 *) echo " " ;;
6835 esac
6836 ;;
6837 esac
6838done
6839
6840$cat <<EOM
6841
6842If you or somebody else will be maintaining perl at your site, please
6843fill in the correct e-mail address here so that they may be contacted
6844if necessary. Currently, the "perlbug" program included with perl
6845will send mail to this address in addition to perlbug@perl.com. You may
6846enter "none" for no administrator.
6847
6848EOM
6849case "$perladmin" in
6850'') dflt="$cf_email";;
6851*) dflt="$perladmin";;
6852esac
6853rp='Perl administrator e-mail address'
6854. ./myread
6855perladmin="$ans"
6856
5f05dabc 6857: figure out how to guarantee perl startup
6858case "$startperl" in
6859'')
6860 case "$sharpbang" in
6861 *!)
6862 $cat <<EOH
6863
6864I can use the #! construct to start perl on your system. This will
6865make startup of perl scripts faster, but may cause problems if you
6866want to share those scripts and perl is not in a standard place
6867($binexp/perl) on all your platforms. The alternative is to force
6868a shell by starting the script with a single ':' character.
6869
6870EOH
6871 dflt="$binexp/perl"
6872 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6873 . ./myread
6874 case "$ans" in
68dc0745 6875 none) startperl=": # use perl";;
6876 *) startperl="#!$ans"
3e3baf6d 6877 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 6878 $cat >&4 <<EOM
6879
6880WARNING: Some systems limit the #! command to 32 characters.
6881If you experience difficulty running Perl scripts with #!, try
6882installing Perl in a directory with a shorter pathname.
6883
6884EOM
6885 fi ;;
5f05dabc 6886 esac
6887 ;;
6888 *) startperl=": # use perl"
6889 ;;
6890 esac
6891 ;;
6892esac
6893echo "I'll use $startperl to start perl scripts."
6894
6895: figure best path for perl in scripts
6896case "$perlpath" in
6897'')
6898 perlpath="$binexp/perl"
6899 case "$startperl" in
6900 *!*) ;;
6901 *)
6902 $cat <<EOH
6903
6904I will use the "eval 'exec'" idiom to start Perl on your system.
6905I can use the full path of your Perl binary for this purpose, but
6906doing so may cause problems if you want to share those scripts and
6907Perl is not always in a standard place ($binexp/perl).
6908
6909EOH
6910 dflt="$binexp/perl"
6911 rp="What path shall I use in \"eval 'exec'\"?"
6912 . ./myread
6913 perlpath="$ans"
6914 ;;
6915 esac
6916 ;;
6917esac
6918case "$startperl" in
6919*!*) ;;
6920*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6921esac
6922
dc45a647
MB
6923: determine where public executable scripts go
6924set scriptdir scriptdir
6925eval $prefixit
6926case "$scriptdir" in
6927'')
6928 dflt="$bin"
6929 : guess some guesses
6930 $test -d /usr/share/scripts && dflt=/usr/share/scripts
dd4e71fd
JH
6931 $test -d /usr/share/bin && dflt=/usr/share/bin
6932 $test -d /usr/local/script && dflt=/usr/local/script
6933 $test -d /usr/local/scripts && dflt=/usr/local/scripts
6934 $test -d $prefixexp/script && dflt=$prefixexp/script
dc45a647
MB
6935 set dflt
6936 eval $prefixup
6937 ;;
6938*) dflt="$scriptdir"
6939 ;;
6940esac
6941$cat <<EOM
6942
6943Some installations have a separate directory just for executable scripts so
6944that they can mount it across multiple architectures but keep the scripts in
6945one spot. You might, for example, have a subdirectory of /usr/share for this.
6946Or you might just lump your scripts in with all your other executables.
6947
6948EOM
6949fn=d~
6950rp='Where do you keep publicly executable scripts?'
6951. ./getfile
6952if $test "X$ansexp" != "X$scriptdirexp"; then
6953 installscript=''
6954fi
6955scriptdir="$ans"
6956scriptdirexp="$ansexp"
dd4e71fd
JH
6957: Change installation prefix, if necessary.
6958if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6959 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
dd4e71fd
JH
6960else
6961 installscript="$scriptdirexp"
6962fi
dc45a647 6963
dc45a647 6964: determine where site specific architecture-dependent libraries go.
273cf8d1
GS
6965: sitelib default is /usr/local/lib/perl5/site_perl/$version
6966: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
3a6175e1 6967: sitelib may have an optional trailing /share.
bfb7748a 6968tdflt=`echo $sitelib | $sed 's,/share$,,'`
273cf8d1 6969tdflt="$tdflt/$archname"
dc45a647
MB
6970set sitearch sitearch none
6971eval $prefixit
6972case "$sitearch" in
bfb7748a 6973'') dflt="$tdflt" ;;
dc45a647
MB
6974*) dflt="$sitearch" ;;
6975esac
6976$cat <<EOM
6977
6978The installation process will also create a directory for
6979architecture-dependent site-specific extensions and modules.
6980
6981EOM
6982fn=nd~+
6983rp='Pathname for the site-specific architecture-dependent library files?'
6984. ./getfile
dc45a647
MB
6985sitearch="$ans"
6986sitearchexp="$ansexp"
dd4e71fd
JH
6987: Change installation prefix, if necessary.
6988if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6989 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6990else
6991 installsitearch="$sitearchexp"
dc45a647
MB
6992fi
6993
717c4fcc
JH
6994: determine where add-on public executables go
6995case "$sitebin" in
6996'') dflt=$siteprefix/bin ;;
6997*) dflt=$sitebin ;;
6998esac
6999fn=d~
7000rp='Pathname where the add-on public executables should be installed?'
7001. ./getfile
7002sitebin="$ans"
7003sitebinexp="$ansexp"
7004: Change installation prefix, if necessary.
7005if $test X"$prefix" != X"$installprefix"; then
7006 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7007else
7008 installsitebin="$sitebinexp"
7009fi
7010
43999f95
JH
7011: see if sqrtl exists
7012set sqrtl d_sqrtl
7013eval $inlibc
7014
2afac517 7015cat <<EOM
7016
b0ce926a 7017Perl can be built to take advantage of long doubles which
d7d93a81 7018(if available) may give more accuracy and range for floating point numbers.
b0ce926a
JH
7019
7020If this doesn't make any sense to you, just accept the default 'n'.
7021EOM
d7d93a81
JH
7022
7023case "$ccflags" in
7024*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7025esac
7026
b0ce926a
JH
7027case "$uselongdouble" in
7028$define|true|[yY]*) dflt='y';;
7029*) dflt='n';;
7030esac
7031rp='Try to use long doubles if available?'
7032. ./myread
7033case "$ans" in
309d43cf
JH
7034y|Y) val="$define" ;;
7035*) val="$undef" ;;
b0ce926a
JH
7036esac
7037set uselongdouble
7038eval $setvar
7039
d9b3e12d 7040case "$uselongdouble" in
d7d93a81
JH
7041true|[yY]*) uselongdouble="$define" ;;
7042esac
7043
7044case "$uselongdouble" in
7045$define)
d9b3e12d
JH
7046: Look for a hint-file generated 'call-back-unit'. If the
7047: user has specified that long doubles should be used,
7048: we may need to set or change some other defaults.
7049 if $test -f uselongdouble.cbu; then
7050 echo "Your platform has some specific hints for long doubles, using them..."
7051 . ./uselongdouble.cbu
7052 else
7053 $cat <<EOM
7054(Your platform doesn't have any specific hints for long doubles.)
7055EOM
7056 fi
7057 ;;
7058esac
b0ce926a 7059
43999f95
JH
7060case "$uselongdouble:$d_sqrtl" in
7061$define:$undef)
7062 $cat <<EOM >&4
7063
7064You requested the use of long doubles but you do not seem to have
7065the mathematic functions for long doubles. I'm disabling the use
7066of long doubles.
7067EOM
7068 uselongdouble=$undef
7069 ;;
7070esac
7071
d7d93a81
JH
7072cat <<EOM
7073
85aff577
CS
7074Previous version of $package used the standard IO mechanisms as defined
7075in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 7076mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
7077the default. This abstraction layer can use AT&T's sfio (if you already
7078have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7079problems with some extension modules. Using PerlIO with stdio is safe,
7080but it is slower than plain stdio and therefore is not the default.
2afac517 7081
7082If this doesn't make any sense to you, just accept the default 'n'.
7083EOM
7084case "$useperlio" in
7085$define|true|[yY]*) dflt='y';;
7086*) dflt='n';;
7087esac
7088rp='Use the experimental PerlIO abstraction layer?'
7089. ./myread
7090case "$ans" in
7091y|Y)
7092 val="$define"
7093 ;;
7094*)
7095 echo "Ok, doing things the stdio way"
7096 val="$undef"
7097 ;;
7098esac
7099set useperlio
7100eval $setvar
2304df62 7101
717c4fcc
JH
7102case "$vendorprefix" in
7103'') d_vendorbin="$undef"
7104 vendorbin=''
7105 vendorbinexp=''
7106 ;;
7107*) d_vendorbin="$define"
7108 : determine where vendor-supplied executables go.
7109 dflt=$vendorprefix/bin
7110 fn=d~+
7111 rp='Pathname for the vendor-supplied executables directory?'
7112 . ./getfile
7113 vendorbin="$ans"
7114 vendorbinexp="$ansexp"
7115 : Change installation prefix, if necessary.
7116 if $test X"$prefix" != X"$installprefix"; then
7117 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7118 else
7119 installvendorbin="$vendorbinexp"
7120 fi
7121 ;;
7122esac
7123
628e1a40
JH
7124: check for length of double
7125echo " "
7126case "$doublesize" in
7127'')
7128 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7129 $cat >try.c <<'EOCP'
7130#include <stdio.h>
7131int main()
7132{
7133 printf("%d\n", (int)sizeof(double));
7134 exit(0);
7135}
7136EOCP
7137 set try
7138 if eval $compile_ok; then
7139 doublesize=`./try`
7140 $echo " $doublesize bytes." >&4
7141 else
7142 dflt='8'
7143 echo "(I can't seem to compile the test program. Guessing...)"
7144 rp="What is the size of a double precision number (in bytes)?"
7145 . ./myread
7146 doublesize="$ans"
7147 fi
7148 ;;
7149esac
7150$rm -f try.c try
7151
7152: check for long doubles
7153echo " "
7154$echo $n "Checking to see if your system supports long double..." $c >&4
7155echo 'int main() { long double x = 7.0; }' > try.c
7156set try
7157if eval $compile; then
7158 val="$define"
7159 echo " Yes, it does." >&4
7160else
7161 val="$undef"
7162 echo " No, it doesn't." >&4
7163fi
7164$rm try.*
7165set d_longdbl
7166eval $setvar
7167
7168: check for length of long double
7169case "${d_longdbl}${longdblsize}" in
7170$define)
7171 echo " "
7172 $echo $n "Checking to see how big your long doubles are..." $c >&4
7173 $cat >try.c <<'EOCP'
7174#include <stdio.h>
7175int main()
7176{
7177 printf("%d\n", sizeof(long double));
7178}
7179EOCP
7180 set try
7181 set try
7182 if eval $compile; then
7183 longdblsize=`./try$exe_ext`
7184 $echo " $longdblsize bytes." >&4
7185 else
7186 dflt='8'
7187 echo " "
7188 echo "(I can't seem to compile the test program. Guessing...)" >&4
7189 rp="What is the size of a long double (in bytes)?"
7190 . ./myread
7191 longdblsize="$ans"
7192 fi
7193 if $test "X$doublesize" = "X$longdblsize"; then
7194 echo "(That isn't any different from an ordinary double.)"
7195 fi
7196 ;;
7197esac
7198$rm -f try.* try
ff935051 7199
8e07c86e 7200: Check how to convert floats to strings.
28e8609d 7201if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
7202 echo " "
7203 echo "Checking for an efficient way to convert floats to strings."
628e1a40 7204 $cat >try.c <<EOP
8e07c86e
AD
7205#ifdef TRY_gconvert
7206#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 7207char *myname = "gconvert";
8e07c86e
AD
7208#endif
7209#ifdef TRY_gcvt
7210#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 7211char *myname = "gcvt";
8e07c86e 7212#endif
ff935051
JH
7213#ifdef TRY_qgcvt
7214#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7215char *myname = "qgcvt";
628e1a40 7216#define DOUBLETYPE long double
ff935051 7217#endif
8e07c86e
AD
7218#ifdef TRY_sprintf
7219#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 7220char *myname = "sprintf";
8e07c86e 7221#endif
8ff267be 7222
628e1a40
JH
7223#ifndef DOUBLETYPE
7224#define DOUBLETYPE double
7225#endif
7226
8ff267be 7227#include <stdio.h>
7228
43999f95 7229#define I_STDLIB $i_stdlib
628e1a40
JH
7230#ifdef I_STDLIB
7231#include <stdlib.h>
7232#endif
7233
8ff267be 7234int
7235checkit(expect, got)
7236char *expect;
7237char *got;
7238{
7239 if (strcmp(expect, got)) {
7240 printf("%s oddity: Expected %s, got %s\n",
7241 myname, expect, got);
7242 exit(1);
7243 }
7244}
7245
5a411a32 7246int main()
8ff267be 7247{
ecfc5424 7248 char buf[64];
8ff267be 7249 buf[63] = '\0';
7250
7251 /* This must be 1st test on (which?) platform */
7252 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
628e1a40 7253 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8ff267be 7254 checkit("0.1", buf);
7255
628e1a40 7256 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8ff267be 7257 checkit("1", buf);
7258
628e1a40 7259 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8ff267be 7260 checkit("0", buf);
7261
628e1a40 7262 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8ff267be 7263 checkit("-1", buf);
7264
7265 /* Some Linux gcvt's give 1.e+5 here. */
628e1a40 7266 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8ff267be 7267 checkit("100000", buf);
7268
7269 /* Some Linux gcvt's give -1.e+5 here. */
628e1a40 7270 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8ff267be 7271 checkit("-100000", buf);
7272
ecfc5424 7273 exit(0);
a0d0e21e
LW
7274}
7275EOP
5ff3f7a4
GS
7276 case "$d_Gconvert" in
7277 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7278 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7279 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7280 *) xxx_list='gconvert gcvt sprintf' ;;
7281 esac
8e07c86e 7282
628e1a40
JH
7283 case "$d_longdbl$uselongdouble" in
7284 definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
ff935051
JH
7285 esac
7286
5ff3f7a4 7287 for xxx_convert in $xxx_list; do
ff935051 7288 echo "Trying $xxx_convert..."
5ff3f7a4
GS
7289 $rm -f try try$_o
7290 set try -DTRY_$xxx_convert
7291 if eval $compile; then
628e1a40 7292 echo "$xxx_convert() found." >&4
5ff3f7a4
GS
7293 if ./try; then
7294 echo "I'll use $xxx_convert to convert floats into a string." >&4
7295 break;
7296 else
7297 echo "...But $xxx_convert didn't work as I expected."
7298 fi
2304df62 7299 else
5ff3f7a4 7300 echo "$xxx_convert NOT found." >&4
2304df62 7301 fi
5ff3f7a4 7302 done
8e07c86e 7303
5ff3f7a4
GS
7304 case "$xxx_convert" in
7305 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7306 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
ff935051 7307 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
5ff3f7a4
GS
7308 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7309 esac
28e8609d 7310fi
2304df62 7311
cf2093f6
JH
7312echo " "
7313
ea1c3b15 7314if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
7315
7316echo "Checking how to print long doubles..." >&4
7317
7318if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7319 $cat >try.c <<'EOCP'
7320#include <sys/types.h>
7321#include <stdio.h>
7322int main() {
7323 double d = 123.456;
7324 printf("%.3f\n", d);
7325}
7326EOCP
7327 set try
7328 if eval $compile; then
7329 yyy=`./try$exe_ext`
7330 case "$yyy" in
7331 123.456)
7332 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7333 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7334 echo "We will use %f."
7335 ;;
7336 esac
7337 fi
7338fi
7339
7340if $test X"$sPRIfldbl" = X; then
7341 $cat >try.c <<'EOCP'
7342#include <sys/types.h>
7343#include <stdio.h>
7344int main() {
7345 long double d = 123.456;
ea1c3b15 7346 printf("%.3llf\n", d);
cf2093f6
JH
7347}
7348EOCP
7349 set try
7350 if eval $compile; then
7351 yyy=`./try$exe_ext`
7352 case "$yyy" in
7353 123.456)
ea1c3b15
JH
7354 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7355 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7356 echo "We will use %llf."
cf2093f6
JH
7357 ;;
7358 esac
7359 fi
7360fi
7361
7362if $test X"$sPRIfldbl" = X; then
7363 $cat >try.c <<'EOCP'
7364#include <sys/types.h>
7365#include <stdio.h>
7366int main() {
7367 long double d = 123.456;
ea1c3b15 7368 printf("%.3Lf\n", d);
cf2093f6
JH
7369}
7370EOCP
7371 set try
7372 if eval $compile; then
7373 yyy=`./try$exe_ext`
7374 case "$yyy" in
7375 123.456)
ea1c3b15
JH
7376 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7377 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7378 echo "We will use %Lf."
cf2093f6
JH
7379 ;;
7380 esac
7381 fi
7382fi
7383
11dc3f68 7384if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7385 $cat >try.c <<'EOCP'
7386#include <sys/types.h>
7387#include <stdio.h>
7388int main() {
7389 long double d = 123.456;
ea1c3b15 7390 printf("%.3lf\n", d);
cf2093f6
JH
7391}
7392EOCP
7393 set try
7394 if eval $compile; then
7395 yyy=`./try$exe_ext`
7396 case "$yyy" in
7397 123.456)
ea1c3b15
JH
7398 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7399 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7400 echo "We will use %lf."
cf2093f6
JH
7401 ;;
7402 esac
7403 fi
7404fi
7405
09e3ef00
JH
7406if $test X"$sPRIfldbl" = X; then
7407 echo "Cannot figure out how to print long doubles." >&4
7408fi
7409
ea1c3b15 7410$rm -f try try.*
cf2093f6 7411
ea1c3b15 7412fi # d_longdbl
cf2093f6
JH
7413
7414case "$sPRIfldbl" in
7415'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7416 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7417 ;;
7418*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7419 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7420 ;;
7421esac
7422
a0d0e21e
LW
7423: Initialize h_fcntl
7424h_fcntl=false
7425
7426: Initialize h_sysfile
7427h_sysfile=false
2304df62 7428
2304df62
AD
7429: access call always available on UNIX
7430set access d_access
7431eval $inlibc
7432
7433: locate the flags for 'access()'
7434case "$d_access" in
7435"$define")
7436 echo " "
7437 $cat >access.c <<'EOCP'
7438#include <sys/types.h>
7439#ifdef I_FCNTL
7440#include <fcntl.h>
7441#endif
7442#ifdef I_SYS_FILE
7443#include <sys/file.h>
7444#endif
7445#ifdef I_UNISTD
7446#include <unistd.h>
7447#endif
d674cd6d 7448int main() {
2304df62
AD
7449 exit(R_OK);
7450}
8e07c86e
AD
7451EOCP
7452 : check sys/file.h first, no particular reason here
7453 if $test `./findhdr sys/file.h` && \
dfe9444c 7454 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7455 h_sysfile=true;
7456 echo "<sys/file.h> defines the *_OK access constants." >&4
7457 elif $test `./findhdr fcntl.h` && \
dfe9444c 7458 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7459 h_fcntl=true;
7460 echo "<fcntl.h> defines the *_OK access constants." >&4
7461 elif $test `./findhdr unistd.h` && \
dfe9444c 7462 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7463 echo "<unistd.h> defines the *_OK access constants." >&4
7464 else
7465 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7466 fi
7467 ;;
7468esac
7469$rm -f access*
a0d0e21e 7470
5ff3f7a4
GS
7471: see if accessx exists
7472set accessx d_accessx
7473eval $inlibc
7474
8e07c86e
AD
7475: see if alarm exists
7476set alarm d_alarm
7477eval $inlibc
2304df62 7478
cf2093f6
JH
7479: see if atolf exists
7480set atolf d_atolf
7481eval $inlibc
7482
7483: see if atoll exists
7484set atoll d_atoll
7485eval $inlibc
7486
ecfc5424 7487: Look for GNU-cc style attribute checking
2304df62 7488echo " "
a0d0e21e
LW
7489echo "Checking whether your compiler can handle __attribute__ ..." >&4
7490$cat >attrib.c <<'EOCP'
1aef975c 7491#include <stdio.h>
ecfc5424 7492void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7493EOCP
7494if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7495 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7496 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7497 val="$undef"
7498 else
ecfc5424 7499 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7500 val="$define"
7501 fi
7502else
ecfc5424 7503 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7504 val="$undef"
7505fi
ecfc5424 7506set d_attribut
a0d0e21e
LW
7507eval $setvar
7508$rm -f attrib*
7509
7510: see if bcmp exists
7511set bcmp d_bcmp
7512eval $inlibc
7513
7514: see if bcopy exists
7515set bcopy d_bcopy
7516eval $inlibc
7517
2afac517 7518: see if this is a unistd.h system
7519set unistd.h i_unistd
7520eval $inhdr
7521
7522: see if getpgrp exists
7523set getpgrp d_getpgrp
7524eval $inlibc
7525
2afac517 7526case "$d_getpgrp" in
7527"$define")
7528 echo " "
dfe9444c 7529 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7530 $cat >set.c <<EOP
7531#$i_unistd I_UNISTD
7532#include <sys/types.h>
7533#ifdef I_UNISTD
7534# include <unistd.h>
7535#endif
5a411a32 7536int main()
2afac517 7537{
7538 if (getuid() == 0) {
7539 printf("(I see you are running Configure as super-user...)\n");
7540 setuid(1);
7541 }
7542#ifdef TRY_BSD_PGRP
7543 if (getpgrp(1) == 0)
7544 exit(0);
7545#else
7546 if (getpgrp() > 0)
7547 exit(0);
7548#endif
7549 exit(1);
7550}
7551EOP
7552 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7553 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7554 val="$define"
7555 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7556 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7557 val="$undef"
7558 else
7559 echo "I can't seem to compile and run the test program."
7560 if ./usg; then
7561 xxx="a USG one, i.e. you use getpgrp()."
7562 else
7563 # SVR4 systems can appear rather BSD-ish.
7564 case "$i_unistd" in
7565 $undef)
7566 xxx="a BSD one, i.e. you use getpgrp(pid)."
7567 val="$define"
7568 ;;
7569 $define)
7570 xxx="probably a USG one, i.e. you use getpgrp()."
7571 val="$undef"
7572 ;;
7573 esac
7574 fi
7575 echo "Assuming your getpgrp is $xxx" >&4
7576 fi
7577 ;;
7578*) val="$undef";;
7579esac
7580set d_bsdgetpgrp
7581eval $setvar
7582$rm -f set set.c
7583
a0d0e21e
LW
7584: see if setpgrp exists
7585set setpgrp d_setpgrp
7586eval $inlibc
7587
a0d0e21e
LW
7588case "$d_setpgrp" in
7589"$define")
7590 echo " "
dfe9444c 7591 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7592 $cat >set.c <<EOP
2afac517 7593#$i_unistd I_UNISTD
7594#include <sys/types.h>
7595#ifdef I_UNISTD
7596# include <unistd.h>
7597#endif
5a411a32 7598int main()
a0d0e21e
LW
7599{
7600 if (getuid() == 0) {
7601 printf("(I see you are running Configure as super-user...)\n");
7602 setuid(1);
7603 }
2afac517 7604#ifdef TRY_BSD_PGRP
a0d0e21e 7605 if (-1 == setpgrp(1, 1))
2afac517 7606 exit(0);
7607#else
7608 if (setpgrp() != -1)
7609 exit(0);
7610#endif
7611 exit(1);
a0d0e21e
LW
7612}
7613EOP
2afac517 7614 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7615 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7616 val="$define"
7617 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7618 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7619 val="$undef"
a0d0e21e 7620 else
dfe9444c 7621 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7622 if ./usg; then
2afac517 7623 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7624 else
2afac517 7625 # SVR4 systems can appear rather BSD-ish.
7626 case "$i_unistd" in
7627 $undef)
7628 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7629 val="$define"
7630 ;;
7631 $define)
7632 xxx="probably a USG one, i.e. you use setpgrp()."
7633 val="$undef"
7634 ;;
7635 esac
a0d0e21e 7636 fi
2afac517 7637 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7638 fi
7639 ;;
7640*) val="$undef";;
7641esac
2afac517 7642set d_bsdsetpgrp
a0d0e21e
LW
7643eval $setvar
7644$rm -f set set.c
a0d0e21e
LW
7645: see if bzero exists
7646set bzero d_bzero
7647eval $inlibc
7648
ecfc5424 7649: see if signal is declared as pointer to function returning int or void
a0d0e21e 7650echo " "
ecfc5424
AD
7651xxx=`./findhdr signal.h`
7652$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7653if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7654 echo "You have int (*signal())() instead of void." >&4
7655 val="$undef"
7656elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7657 echo "You have void (*signal())()." >&4
ecfc5424
AD
7658 val="$define"
7659elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7660 echo "You have int (*signal())() instead of void." >&4
7661 val="$undef"
dfe9444c
AD
7662elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7663 echo "You have void (*signal())()." >&4
7664 val="$define"
a0d0e21e 7665else
ecfc5424
AD
7666 case "$d_voidsig" in
7667 '')
7668 echo "I can't determine whether signal handler returns void or int..." >&4
7669 dflt=void
7670 rp="What type does your signal handler return?"
7671 . ./myread
7672 case "$ans" in
7673 v*) val="$define";;
7674 *) val="$undef";;
7675 esac;;
7676 "$define")
dfe9444c
AD
7677 echo "As you already told me, signal handler returns void." >&4
7678 val="$define"
7679 ;;
7680 *) echo "As you already told me, signal handler returns int." >&4
7681 val="$undef"
7682 ;;
ecfc5424
AD
7683 esac
7684fi
7685set d_voidsig
7686eval $setvar
7687case "$d_voidsig" in
7688"$define") signal_t="void";;
7689*) signal_t="int";;
7690esac
7691$rm -f $$.tmp
7692
7693: check for ability to cast large floats to 32-bit ints.
7694echo " "
7695echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7696if $test "$intsize" -ge 4; then
ecfc5424
AD
7697 xxx=int
7698else
7699 xxx=long
7700fi
7701$cat >try.c <<EOCP
e5c9fcd0 7702#include <stdio.h>
ecfc5424
AD
7703#include <sys/types.h>
7704#include <signal.h>
a1896f58 7705$signal_t blech(s) int s; { exit(3); }
d674cd6d 7706int main()
2304df62 7707{
a0d0e21e 7708 $xxx i32;
e5c9fcd0 7709 double f, g;
2304df62 7710 int result = 0;
89434db5 7711 char str[16];
2304df62
AD
7712 signal(SIGFPE, blech);
7713
89434db5
AD
7714 /* Don't let compiler optimize the test away. Store the number
7715 in a writable string for gcc to pass to sscanf under HP/UX.
7716 */
7717 sprintf(str, "2147483647");
7718 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7719 g = 10 * f;
7720 i32 = ($xxx) g;
2304df62 7721
e5c9fcd0
AD
7722 /* x86 processors will probably give 0x8000 0000, which is a
7723 sign change. We don't want that. We want to mimic SPARC
7724 behavior here, which is to preserve the sign and give
7725 back 0x7fff ffff.
7726 */
a0d0e21e 7727 if (i32 != ($xxx) f)
2304df62
AD
7728 result |= 1;
7729 exit(result);
7730}
7731EOCP
dfe9444c 7732set try
dc45a647 7733if eval $compile_ok; then
2304df62
AD
7734 ./try
7735 yyy=$?
7736else
a0d0e21e 7737 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
7738 yyy=1
7739fi
7740case "$yyy" in
77410) val="$define"
7742 echo "Yup, it can."
7743 ;;
7744*) val="$undef"
7745 echo "Nope, it can't."
7746 ;;
7747esac
7748set d_casti32
7749eval $setvar
85e6fe83 7750$rm -f try try.*
a0d0e21e 7751
2304df62
AD
7752: check for ability to cast negative floats to unsigned
7753echo " "
7754echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 7755$cat >try.c <<EOCP
e5c9fcd0 7756#include <stdio.h>
ecfc5424 7757#include <sys/types.h>
2304df62 7758#include <signal.h>
a1896f58
AD
7759$signal_t blech(s) int s; { exit(7); }
7760$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
7761unsigned long dummy_long(p) unsigned long p; { return p; }
7762unsigned int dummy_int(p) unsigned int p; { return p; }
7763unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 7764int main()
2304df62 7765{
e5c9fcd0 7766 double f;
2304df62
AD
7767 unsigned long along;
7768 unsigned int aint;
7769 unsigned short ashort;
7770 int result = 0;
89434db5
AD
7771 char str[16];
7772
e5c9fcd0
AD
7773 /* Frustrate gcc-2.7.2's optimizer which failed this test with
7774 a direct f = -123. assignment. gcc-2.8.0 reportedly
7775 optimized the whole file away
7776 */
89434db5
AD
7777 /* Store the number in a writable string for gcc to pass to
7778 sscanf under HP/UX.
7779 */
7780 sprintf(str, "-123");
7781 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
7782
7783 signal(SIGFPE, blech);
7784 along = (unsigned long)f;
7785 aint = (unsigned int)f;
7786 ashort = (unsigned short)f;
7787 if (along != (unsigned long)-123)
7788 result |= 1;
7789 if (aint != (unsigned int)-123)
7790 result |= 1;
7791 if (ashort != (unsigned short)-123)
7792 result |= 1;
89434db5
AD
7793 sprintf(str, "1073741824.");
7794 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
7795 f = f + f;
7796 along = 0;
7797 along = (unsigned long)f;
7798 if (along != 0x80000000)
7799 result |= 2;
7800 f -= 1.;
7801 along = 0;
7802 along = (unsigned long)f;
7803 if (along != 0x7fffffff)
7804 result |= 1;
7805 f += 2.;
7806 along = 0;
7807 along = (unsigned long)f;
7808 if (along != 0x80000001)
7809 result |= 2;
232e078e
AD
7810 if (result)
7811 exit(result);
7812 signal(SIGFPE, blech_in_list);
89434db5
AD
7813 sprintf(str, "123.");
7814 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
7815 along = dummy_long((unsigned long)f);
7816 aint = dummy_int((unsigned int)f);
7817 ashort = dummy_short((unsigned short)f);
7818 if (along != (unsigned long)123)
7819 result |= 4;
7820 if (aint != (unsigned int)123)
7821 result |= 4;
7822 if (ashort != (unsigned short)123)
7823 result |= 4;
2304df62
AD
7824 exit(result);
7825
7826}
7827EOCP
dfe9444c 7828set try
dc45a647 7829if eval $compile_ok; then
2304df62
AD
7830 ./try
7831 castflags=$?
7832else
ecfc5424 7833 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 7834 castflags=7
2304df62
AD
7835fi
7836case "$castflags" in
78370) val="$define"
7838 echo "Yup, it can."
7839 ;;
7840*) val="$undef"
7841 echo "Nope, it can't."
7842 ;;
7843esac
7844set d_castneg
7845eval $setvar
7846$rm -f try.*
7847
2304df62
AD
7848: see if vprintf exists
7849echo " "
7850if set vprintf val -f d_vprintf; eval $csym; $val; then
7851 echo 'vprintf() found.' >&4
7852 val="$define"
7853 $cat >vprintf.c <<'EOF'
7854#include <varargs.h>
7855
d674cd6d 7856int main() { xxx("foo"); }
2304df62
AD
7857
7858xxx(va_alist)
7859va_dcl
7860{
7861 va_list args;
7862 char buf[10];
7863
7864 va_start(args);
7865 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7866}
7867EOF
dfe9444c
AD
7868 set vprintf
7869 if eval $compile && ./vprintf; then
2304df62
AD
7870 echo "Your vsprintf() returns (int)." >&4
7871 val2="$undef"
7872 else
7873 echo "Your vsprintf() returns (char*)." >&4
7874 val2="$define"
7875 fi
7876else
7877 echo 'vprintf() NOT found.' >&4
7878 val="$undef"
7879 val2="$undef"
7880fi
7881set d_vprintf
7882eval $setvar
7883val=$val2
7884set d_charvspr
7885eval $setvar
7886
a0d0e21e
LW
7887: see if chown exists
7888set chown d_chown
7889eval $inlibc
7890
7891: see if chroot exists
7892set chroot d_chroot
7893eval $inlibc
7894
2304df62
AD
7895: see if chsize exists
7896set chsize d_chsize
7897eval $inlibc
7898
7899: check for const keyword
7900echo " "
7901echo 'Checking to see if your C compiler knows about "const"...' >&4
7902$cat >const.c <<'EOCP'
7903typedef struct spug { int drokk; } spug;
5a411a32 7904int main()
2304df62
AD
7905{
7906 const char *foo;
7907 const spug y;
7908}
7909EOCP
7910if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7911 val="$define"
7912 echo "Yup, it does."
7913else
7914 val="$undef"
7915 echo "Nope, it doesn't."
7916fi
7917set d_const
7918eval $setvar
7919
7920: see if crypt exists
7921echo " "
7922if set crypt val -f d_crypt; eval $csym; $val; then
7923 echo 'crypt() found.' >&4
7924 val="$define"
7925 cryptlib=''
7926else
dfe9444c 7927 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 7928 if $test -z "$cryptlib"; then
dfe9444c 7929 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
7930 else
7931 cryptlib=-lcrypt
7932 fi
7933 if $test -z "$cryptlib"; then
dfe9444c 7934 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
7935 else
7936 cryptlib=-lcrypt
7937 fi
7938 if $test -z "$cryptlib"; then
dfe9444c 7939 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
7940 else
7941 cryptlib=-lcrypt
7942 fi
7943 if $test -z "$cryptlib"; then
7944 echo 'crypt() NOT found.' >&4
7945 val="$undef"
7946 else
7947 val="$define"
7948 fi
7949fi
7950set d_crypt
7951eval $setvar
7952
921b2963
JH
7953: get csh whereabouts
7954case "$csh" in
7955'csh') val="$undef" ;;
7956*) val="$define" ;;
7957esac
7958set d_csh
7959eval $setvar
7960: Respect a hint or command line value for full_csh.
7961case "$full_csh" in
7962'') full_csh=$csh ;;
7963esac
7964
a0d0e21e
LW
7965: see if cuserid exists
7966set cuserid d_cuserid
2304df62
AD
7967eval $inlibc
7968
a0d0e21e
LW
7969: see if this is a limits.h system
7970set limits.h i_limits
85e6fe83
LW
7971eval $inhdr
7972
a0d0e21e
LW
7973: see if this is a float.h system
7974set float.h i_float
7975eval $inhdr
7976
7977: See if number of significant digits in a double precision number is known
7978echo " "
7979$cat >dbl_dig.c <<EOM
7980#$i_limits I_LIMITS
7981#$i_float I_FLOAT
7982#ifdef I_LIMITS
7983#include <limits.h>
85e6fe83 7984#endif
a0d0e21e
LW
7985#ifdef I_FLOAT
7986#include <float.h>
7987#endif
7988#ifdef DBL_DIG
7989printf("Contains DBL_DIG");
85e6fe83 7990#endif
85e6fe83 7991EOM
a0d0e21e
LW
7992$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7993if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7994 echo "DBL_DIG found." >&4
7995 val="$define"
2304df62 7996else
a0d0e21e
LW
7997 echo "DBL_DIG NOT found." >&4
7998 val="$undef"
2304df62 7999fi
a0d0e21e
LW
8000$rm -f dbl_dig.?
8001set d_dbl_dig
2304df62 8002eval $setvar
2304df62 8003
a0d0e21e
LW
8004: see if difftime exists
8005set difftime d_difftime
2304df62
AD
8006eval $inlibc
8007
a0d0e21e
LW
8008: see if this is a dirent system
8009echo " "
8010if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8011 val="$define"
8012 echo "<dirent.h> found." >&4
8013else
8014 val="$undef"
8015 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8016 echo "<sys/dir.h> found." >&4
8017 echo " "
8018 else
8019 xinc=`./findhdr sys/ndir.h`
8020 fi
8021 echo "<dirent.h> NOT found." >&4
8022fi
8023set i_dirent
8024eval $setvar
8025
8026: Look for type of directory structure.
8027echo " "
8028$cppstdin $cppflags $cppminus < "$xinc" > try.c
8029
8030case "$direntrytype" in
8031''|' ')
8032 case "$i_dirent" in
8033 $define) guess1='struct dirent' ;;
8034 *) guess1='struct direct' ;;
2afac517 8035 esac
8036 ;;
8037*) guess1="$direntrytype"
8038 ;;
8e07c86e
AD
8039esac
8040
2afac517 8041case "$guess1" in
8042'struct dirent') guess2='struct direct' ;;
8043*) guess2='struct dirent' ;;
8044esac
8045
8046if $contains "$guess1" try.c >/dev/null 2>&1; then
8047 direntrytype="$guess1"
8048 echo "Your directory entries are $direntrytype." >&4
8049elif $contains "$guess2" try.c >/dev/null 2>&1; then
8050 direntrytype="$guess2"
8051 echo "Your directory entries seem to be $direntrytype." >&4
8052else
8053 echo "I don't recognize your system's directory entries." >&4
8054 rp="What type is used for directory entries on this system?"
8055 dflt="$guess1"
8056 . ./myread
8057 direntrytype="$ans"
8058fi
8059$rm -f try.c
a0d0e21e 8060
a0d0e21e 8061
2afac517 8062: see if the directory entry stores field length
8063echo " "
8064$cppstdin $cppflags $cppminus < "$xinc" > try.c
8065if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8066 echo "Good, your directory entry keeps length information in d_namlen." >&4
8067 val="$define"
8068else
8069 echo "Your directory entry does not know about the d_namlen field." >&4
8070 val="$undef"
8071fi
8072set d_dirnamlen
8073eval $setvar
8074$rm -f try.c
a0d0e21e 8075
5ff3f7a4
GS
8076: see if dlerror exists
8077xxx_runnm="$runnm"
8078runnm=false
8079set dlerror d_dlerror
8080eval $inlibc
8081runnm="$xxx_runnm"
8082
8083: see if dlfcn is available
8084set dlfcn.h i_dlfcn
8085eval $inhdr
8086
8087case "$usedl" in
8088$define|y|true)
8089 $cat << EOM
8090
8091On a few systems, the dynamically loaded modules that perl generates and uses
8092will need a different extension than shared libs. The default will probably
8093be appropriate.
8094
8095EOM
8096 case "$dlext" in
8097 '') dflt="$so" ;;
8098 *) dflt="$dlext" ;;
8099 esac
8100 rp='What is the extension of dynamically loaded modules'
8101 . ./myread
8102 dlext="$ans"
8103 ;;
8104*)
8105 dlext="none"
8106 ;;
8107esac
8108
8109: Check if dlsym need a leading underscore
a0d0e21e
LW
8110echo " "
8111val="$undef"
8112
8113case "$dlsrc" in
8114dl_dlopen.xs)
8115 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8116 $cat >dyna.c <<'EOM'
8117fred () { }
8118EOM
8119
8120$cat >fred.c<<EOM
8121
8122#include <stdio.h>
8123#$i_dlfcn I_DLFCN
8124#ifdef I_DLFCN
8125#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8126#else
8127#include <sys/types.h>
8128#include <nlist.h>
8129#include <link.h>
8130#endif
8131
8132extern int fred() ;
8133
5a411a32 8134int main()
a0d0e21e
LW
8135{
8136 void * handle ;
8137 void * symbol ;
8138#ifndef RTLD_LAZY
8139 int mode = 1 ;
8140#else
8141 int mode = RTLD_LAZY ;
8142#endif
8143 handle = dlopen("./dyna.$dlext", mode) ;
8144 if (handle == NULL) {
5f05dabc 8145 printf ("1\n") ;
8146 fflush (stdout) ;
8147 exit(0);
a0d0e21e
LW
8148 }
8149 symbol = dlsym(handle, "fred") ;
8150 if (symbol == NULL) {
5f05dabc 8151 /* try putting a leading underscore */
8152 symbol = dlsym(handle, "_fred") ;
8153 if (symbol == NULL) {
8154 printf ("2\n") ;
8155 fflush (stdout) ;
8156 exit(0);
8157 }
8158 printf ("3\n") ;
a0d0e21e
LW
8159 }
8160 else
5f05dabc 8161 printf ("4\n") ;
36477c24 8162 fflush (stdout) ;
8163 exit(0);
a0d0e21e
LW
8164}
8165EOM
760ac839 8166 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 8167 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
8168 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
8169 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 8170 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
8171 xxx=`./fred`
8172 case $xxx in
8173 1) echo "Test program failed using dlopen." >&4
8174 echo "Perhaps you should not use dynamic loading." >&4;;
8175 2) echo "Test program failed using dlsym." >&4
8176 echo "Perhaps you should not use dynamic loading." >&4;;
8177 3) echo "dlsym needs a leading underscore" >&4
8178 val="$define" ;;
8179 4) echo "dlsym doesn't need a leading underscore." >&4;;
8180 esac
8181 else
8182 echo "I can't compile and run the test program." >&4
88d5303d 8183 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
a0d0e21e
LW
8184 fi
8185 ;;
8186esac
8187
a78b0d02 8188$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
8189
8190set d_dlsymun
8191eval $setvar
8192
85ab1d1d
JH
8193hasproto='varname=$1; func=$2; shift; shift;
8194while $test $# -ge 2; do
8195 case "$1" in
8196 $define) echo "#include <$2>";;
8197 esac ;
8198 shift 2;
8199done > try.c;
8200$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8201if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8202 echo "$func() prototype found.";
8203 val="$define";
8204else
8205 echo "$func() prototype NOT found.";
8206 val="$undef";
8207fi;
8208set $varname;
8209eval $setvar;
8210$rm -f try.c tryout.c'
8211
8212: see if prototype for drand48 is available
8213echo " "
8214set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8215eval $hasproto
8216
a0d0e21e
LW
8217: see if dup2 exists
8218set dup2 d_dup2
8219eval $inlibc
8220
5ff3f7a4
GS
8221: see if eaccess exists
8222set eaccess d_eaccess
8223eval $inlibc
8224
8225: see if endgrent exists
8226set endgrent d_endgrent
8227eval $inlibc
8228
e5c9fcd0
AD
8229: see if endhostent exists
8230set endhostent d_endhent
8231eval $inlibc
8232
8233: see if endnetent exists
8234set endnetent d_endnent
8235eval $inlibc
8236
8237: see if endprotoent exists
8238set endprotoent d_endpent
8239eval $inlibc
8240
5ff3f7a4
GS
8241: see if endpwent exists
8242set endpwent d_endpwent
8243eval $inlibc
8244
e5c9fcd0
AD
8245: see if endservent exists
8246set endservent d_endsent
8247eval $inlibc
8248
f1066039
JH
8249: see if endspent exists
8250set endspent d_endspent
8251eval $inlibc
8252
8e07c86e
AD
8253: Locate the flags for 'open()'
8254echo " "
8255$cat >open3.c <<'EOCP'
8256#include <sys/types.h>
8257#ifdef I_FCNTL
8258#include <fcntl.h>
8259#endif
8260#ifdef I_SYS_FILE
8261#include <sys/file.h>
8262#endif
d674cd6d 8263int main() {
8e07c86e
AD
8264 if(O_RDONLY);
8265#ifdef O_TRUNC
8266 exit(0);
8267#else
8268 exit(1);
8269#endif
8270}
8271EOCP
8272: check sys/file.h first to get FREAD on Sun
8273if $test `./findhdr sys/file.h` && \
dfe9444c 8274 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8275 h_sysfile=true;
8276 echo "<sys/file.h> defines the O_* constants..." >&4
8277 if ./open3; then
8278 echo "and you have the 3 argument form of open()." >&4
8279 val="$define"
8280 else
8281 echo "but not the 3 argument form of open(). Oh, well." >&4
8282 val="$undef"
8283 fi
8284elif $test `./findhdr fcntl.h` && \
dfe9444c 8285 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8286 h_fcntl=true;
8287 echo "<fcntl.h> defines the O_* constants..." >&4
8288 if ./open3; then
8289 echo "and you have the 3 argument form of open()." >&4
8290 val="$define"
8291 else
8292 echo "but not the 3 argument form of open(). Oh, well." >&4
8293 val="$undef"
8294 fi
8295else
8296 val="$undef"
8297 echo "I can't find the O_* constant definitions! You got problems." >&4
8298fi
8299set d_open3
8300eval $setvar
8301$rm -f open3*
8302
213c275f
JH
8303: see which of string.h or strings.h is needed
8304echo " "
8305strings=`./findhdr string.h`
8306if $test "$strings" && $test -r "$strings"; then
8307 echo "Using <string.h> instead of <strings.h>." >&4
8308 val="$define"
8309else
8310 val="$undef"
8311 strings=`./findhdr strings.h`
8312 if $test "$strings" && $test -r "$strings"; then
8313 echo "Using <strings.h> instead of <string.h>." >&4
8314 else
8315 echo "No string header found -- You'll surely have problems." >&4
8316 fi
8317fi
8318set i_string
8319eval $setvar
8320case "$i_string" in
8321"$undef") strings=`./findhdr strings.h`;;
8322*) strings=`./findhdr string.h`;;
8323esac
8324
8e07c86e
AD
8325: check for non-blocking I/O stuff
8326case "$h_sysfile" in
8327true) echo "#include <sys/file.h>" > head.c;;
8328*)
8329 case "$h_fcntl" in
8330 true) echo "#include <fcntl.h>" > head.c;;
8331 *) echo "#include <sys/fcntl.h>" > head.c;;
8332 esac
8333 ;;
8334esac
8335echo " "
8336echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8337case "$o_nonblock" in
8338'')
8339 $cat head.c > try.c
8340 $cat >>try.c <<'EOCP'
213c275f 8341#include <stdio.h>
d674cd6d 8342int main() {
8e07c86e
AD
8343#ifdef O_NONBLOCK
8344 printf("O_NONBLOCK\n");
8345 exit(0);
8346#endif
8347#ifdef O_NDELAY
8348 printf("O_NDELAY\n");
8349 exit(0);
8350#endif
8351#ifdef FNDELAY
8352 printf("FNDELAY\n");
8353 exit(0);
8354#endif
8355 exit(0);
8356}
8357EOCP
dfe9444c 8358 set try
dc45a647 8359 if eval $compile_ok; then
8e07c86e
AD
8360 o_nonblock=`./try`
8361 case "$o_nonblock" in
8362 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8363 *) echo "Seems like we can use $o_nonblock.";;
8364 esac
8365 else
8366 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8367 fi
8368 ;;
8369*) echo "Using $hint value $o_nonblock.";;
8370esac
8371$rm -f try try.* .out core
8372
8373echo " "
8374echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8375case "$eagain" in
8376'')
8377 $cat head.c > try.c
8378 $cat >>try.c <<EOCP
8379#include <errno.h>
8380#include <sys/types.h>
8381#include <signal.h>
213c275f 8382#include <stdio.h>
4633a7c4 8383#define MY_O_NONBLOCK $o_nonblock
dc45a647 8384#ifndef errno /* XXX need better Configure test */
8e07c86e 8385extern int errno;
dc45a647 8386#endif
14e4fe40
JH
8387#$i_unistd I_UNISTD
8388#ifdef I_UNISTD
213c275f
JH
8389#include <unistd.h>
8390#endif
8391#ifdef $i_string
8392#include <string.h>
8393#else
8394#include <strings.h>
8395#endif
8e07c86e 8396$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8397EOCP
8398 $cat >> try.c <<'EOCP'
d674cd6d 8399int main()
8e07c86e
AD
8400{
8401 int pd[2];
8402 int pu[2];
8403 char buf[1];
8404 char string[100];
8405
8406 pipe(pd); /* Down: child -> parent */
8407 pipe(pu); /* Up: parent -> child */
8408 if (0 != fork()) {
8409 int ret;
8410 close(pd[1]); /* Parent reads from pd[0] */
8411 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8412 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8413 exit(1);
8414 signal(SIGALRM, blech);
8415 alarm(5);
8416 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8417 exit(2);
8418 sprintf(string, "%d\n", ret);
8419 write(2, string, strlen(string));
8420 alarm(0);
8421#ifdef EAGAIN
8422 if (errno == EAGAIN) {
8423 printf("EAGAIN\n");
8424 goto ok;
8425 }
8426#endif
8427#ifdef EWOULDBLOCK
8428 if (errno == EWOULDBLOCK)
8429 printf("EWOULDBLOCK\n");
8430#endif
8431 ok:
8432 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8433 sleep(2); /* Give it time to close our pipe */
8434 alarm(5);
8435 ret = read(pd[0], buf, 1); /* Should read EOF */
8436 alarm(0);
8437 sprintf(string, "%d\n", ret);
8438 write(3, string, strlen(string));
8439 exit(0);
8440 }
8441
8442 close(pd[0]); /* We write to pd[1] */
8443 close(pu[1]); /* We read from pu[0] */
8444 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8445 close(pd[1]); /* Pipe pd is now fully closed! */
8446 exit(0); /* Bye bye, thank you for playing! */
8447}
8448EOCP
dfe9444c 8449 set try
dc45a647 8450 if eval $compile_ok; then
774d564b 8451 echo "$startsh" >mtry
40a7a20a 8452 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8453 chmod +x mtry
8454 ./mtry >/dev/null 2>&1
8455 case $? in
8456 0) eagain=`$cat try.out`;;
8457 1) echo "Could not perform non-blocking setting!";;
8458 2) echo "I did a successful read() for something that was not there!";;
8459 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8460 *) echo "Something terribly wrong happened during testing.";;
8461 esac
8462 rd_nodata=`$cat try.ret`
8463 echo "A read() system call with no data present returns $rd_nodata."
8464 case "$rd_nodata" in
8465 0|-1) ;;
8466 *)
8467 echo "(That's peculiar, fixing that to be -1.)"
8468 rd_nodata=-1
8469 ;;
8470 esac
8471 case "$eagain" in
8472 '')
8473 echo "Forcing errno EAGAIN on read() with no data available."
8474 eagain=EAGAIN
8475 ;;
8476 *)
8477 echo "Your read() sets errno to $eagain when no data is available."
8478 ;;
8479 esac
8480 status=`$cat try.err`
8481 case "$status" in
8482 0) echo "And it correctly returns 0 to signal EOF.";;
8483 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8484 *) echo "However, your read() returns '$status' on EOF??";;
8485 esac
8486 val="$define"
28757baa 8487 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8488 echo "WARNING: you can't distinguish between EOF and no data!"
8489 val="$undef"
8490 fi
8491 else
8492 echo "I can't compile the test program--assuming errno EAGAIN will do."
8493 eagain=EAGAIN
8494 fi
8495 set d_eofnblk
8496 eval $setvar
8497 ;;
8498*)
8499 echo "Using $hint value $eagain."
8500 echo "Your read() returns $rd_nodata when no data is present."
8501 case "$d_eofnblk" in
8502 "$define") echo "And you can see EOF because read() returns 0.";;
8503 "$undef") echo "But you can't see EOF status from read() returned value.";;
8504 *)
8505 echo "(Assuming you can't see EOF status from read anyway.)"
8506 d_eofnblk=$undef
8507 ;;
8508 esac
8509 ;;
8510esac
8511$rm -f try try.* .out core head.c mtry
8512
a0d0e21e
LW
8513: see if fchmod exists
8514set fchmod d_fchmod
8515eval $inlibc
8516
8517: see if fchown exists
8518set fchown d_fchown
8519eval $inlibc
8520
8521: see if this is an fcntl system
8522set fcntl d_fcntl
8523eval $inlibc
8524
b7b35fc2
JH
8525hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8526while $test $# -ge 2; do
8527 case "$1" in
8528 $define) echo "#include <$2>";;
8529 esac ;
8530 shift 2;
8531done > try.c;
8532echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8533set try;
8534if eval $compile; then
8535 val="$define";
8536else
8537 val="$undef";
8538fi;
8539set $varname;
8540eval $setvar;
8541$rm -f try.c try.o'
8542
8543socketlib=''
8544sockethdr=''
8545: see whether socket exists
8546echo " "
8547$echo $n "Hmm... $c" >&4
8548if set socket val -f d_socket; eval $csym; $val; then
8549 echo "Looks like you have Berkeley networking support." >&4
8550 d_socket="$define"
8551 if set setsockopt val -f; eval $csym; $val; then
8552 d_oldsock="$undef"
8553 else
8554 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8555 d_oldsock="$define"
8556 fi
8557else
8558 if $contains socklib libc.list >/dev/null 2>&1; then
8559 echo "Looks like you have Berkeley networking support." >&4
8560 d_socket="$define"
8561 : we will have to assume that it supports the 4.2 BSD interface
8562 d_oldsock="$undef"
8563 else
8564 echo "You don't have Berkeley networking in libc$_a..." >&4
8565 if test "X$d_socket" = "X$define"; then
8566 echo "...but you seem to believe that you have sockets." >&4
8567 else
8568 for net in net socket
8569 do
8570 if test -f /usr/lib/lib$net$_a; then
8571 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8572 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8573 if $contains socket libc.list >/dev/null 2>&1; then
8574 d_socket="$define"
8575 socketlib="-l$net"
8576 case "$net" in
8577 net)
8578 echo "...but the Wollongong group seems to have hacked it in." >&4
8579 sockethdr="-I/usr/netinclude"
8580 ;;
8581 esac
8582 echo "Found Berkeley sockets interface in lib$net." >& 4
8583 if $contains setsockopt libc.list >/dev/null 2>&1; then
8584 d_oldsock="$undef"
8585 else
8586 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8587 d_oldsock="$define"
8588 fi
8589 break
8590 fi
8591 fi
8592 done
8593 if test "X$d_socket" != "X$define"; then
8594 echo "or anywhere else I see." >&4
8595 d_socket="$undef"
8596 d_oldsock="$undef"
8597 fi
8598 fi
8599 fi
8600fi
8601
8602: see if socketpair exists
8603set socketpair d_sockpair
8604eval $inlibc
8605
8606
8607echo " "
8608echo "Checking the availability of certain socket constants..." >& 4
8609for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8610 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8611 $cat >try.c <<EOF
8612#include <sys/types.h>
8613#include <sys/socket.h>
8614int main() {
8615 int i = $ENUM;
8616}
8617EOF
8618 val="$undef"
8619 set try; if eval $compile; then
8620 val="$define"
8621 fi
8622 set d_${enum}; eval $setvar
8623 $rm -f try.c try
8624done
8625
921b2963
JH
8626: see if sys/select.h has to be included
8627set sys/select.h i_sysselct
8628eval $inhdr
8629
8630: see if we should include time.h, sys/time.h, or both
8631echo " "
8632if test "X$timeincl" = X; then
8633 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8634 $echo $n "I'm now running the test program...$c"
8635 $cat >try.c <<'EOCP'
8636#include <sys/types.h>
8637#ifdef I_TIME
8638#include <time.h>
8639#endif
8640#ifdef I_SYSTIME
8641#ifdef SYSTIMEKERNEL
8642#define KERNEL
8643#endif
8644#include <sys/time.h>
8645#endif
8646#ifdef I_SYSSELECT
8647#include <sys/select.h>
8648#endif
d674cd6d 8649int main()
921b2963
JH
8650{
8651 struct tm foo;
8652#ifdef S_TIMEVAL
8653 struct timeval bar;
8654#endif
8655#ifdef S_TIMEZONE
8656 struct timezone tzp;
8657#endif
8658 if (foo.tm_sec == foo.tm_sec)
8659 exit(0);
8660#ifdef S_TIMEVAL
8661 if (bar.tv_sec == bar.tv_sec)
8662 exit(0);
8663#endif
8664 exit(1);
8665}
8666EOCP
8667 flags=''
8668 for s_timezone in '-DS_TIMEZONE' ''; do
8669 sysselect=''
8670 for s_timeval in '-DS_TIMEVAL' ''; do
8671 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8672 for i_time in '' '-DI_TIME'; do
8673 for i_systime in '-DI_SYSTIME' ''; do
8674 case "$flags" in
8675 '') $echo $n ".$c"
8676 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8677 if eval $compile; then
8678 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8679 shift
8680 flags="$*"
8681 echo " "
8682 $echo $n "Succeeded with $flags$c"
8683 fi
8684 ;;
8685 esac
8686 done
8687 done
8688 done
8689 done
8690 done
8691 timeincl=''
8692 echo " "
8693 case "$flags" in
8694 *SYSTIMEKERNEL*) i_systimek="$define"
8695 timeincl=`./findhdr sys/time.h`
8696 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8697 *) i_systimek="$undef";;
8698 esac
8699 case "$flags" in
8700 *I_TIME*) i_time="$define"
8701 timeincl=`./findhdr time.h`" $timeincl"
8702 echo "We'll include <time.h>." >&4;;
8703 *) i_time="$undef";;
8704 esac
8705 case "$flags" in
8706 *I_SYSTIME*) i_systime="$define"
8707 timeincl=`./findhdr sys/time.h`" $timeincl"
8708 echo "We'll include <sys/time.h>." >&4;;
8709 *) i_systime="$undef";;
8710 esac
8711 $rm -f try.c try
8712fi
8713
8714: check for fd_set items
8715$cat <<EOM
8716
8717Checking to see how well your C compiler handles fd_set and friends ...
8718EOM
8719$cat >fd_set.c <<EOCP
8720#$i_systime I_SYS_TIME
8721#$i_sysselct I_SYS_SELECT
8722#$d_socket HAS_SOCKET
8723#include <sys/types.h>
8724#ifdef HAS_SOCKET
8725#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8726#endif
8727#ifdef I_SYS_TIME
8728#include <sys/time.h>
8729#endif
8730#ifdef I_SYS_SELECT
8731#include <sys/select.h>
8732#endif
d674cd6d 8733int main() {
921b2963
JH
8734 fd_set fds;
8735
8736#ifdef TRYBITS
8737 if(fds.fds_bits);
8738#endif
8739
8740#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8741 exit(0);
8742#else
8743 exit(1);
8744#endif
8745}
8746EOCP
8747set fd_set -DTRYBITS
8748if eval $compile; then
8749 d_fds_bits="$define"
8750 d_fd_set="$define"
8751 echo "Well, your system knows about the normal fd_set typedef..." >&4
8752 if ./fd_set; then
8753 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8754 d_fd_macros="$define"
8755 else
8756 $cat >&4 <<'EOM'
8757but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8758EOM
8759 d_fd_macros="$undef"
8760 fi
8761else
8762 $cat <<'EOM'
8763Hmm, your compiler has some difficulty with fd_set. Checking further...
8764EOM
8765 set fd_set
8766 if eval $compile; then
8767 d_fds_bits="$undef"
8768 d_fd_set="$define"
8769 echo "Well, your system has some sort of fd_set available..." >&4
8770 if ./fd_set; then
8771 echo "and you have the normal fd_set macros." >&4
8772 d_fd_macros="$define"
8773 else
8774 $cat <<'EOM'
8775but not the normal fd_set macros! Gross! More work for me...
8776EOM
8777 d_fd_macros="$undef"
8778 fi
8779 else
8780 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
8781 d_fd_set="$undef"
8782 d_fds_bits="$undef"
8783 d_fd_macros="$undef"
8784 fi
8785fi
8786$rm -f fd_set*
8787
a0d0e21e
LW
8788: see if fgetpos exists
8789set fgetpos d_fgetpos
8790eval $inlibc
8791
8175356b
JH
8792: see if flock exists
8793set flock d_flock
8794eval $inlibc
8795
8796: see if fork exists
8797set fork d_fork
8798eval $inlibc
8799
8800: see if pathconf exists
8801set pathconf d_pathconf
8802eval $inlibc
8803
8804: see if fpathconf exists
8805set fpathconf d_fpathconf
8806eval $inlibc
8807
d9b3e12d
JH
8808
8809: check for off64_t
8810echo " "
8175356b 8811echo "Checking to see if your system supports off64_t..." >&4
d9b3e12d
JH
8812$cat >try.c <<EOCP
8813#include <sys/types.h>
8814#include <unistd.h>
8175356b 8815int main() { off64_t x = 7; }'
d9b3e12d 8816EOCP
8175356b
JH
8817set try
8818if eval $compile; then
d9b3e12d 8819 val="$define"
a22e52b9 8820 echo "Yes, it does."
d9b3e12d
JH
8821else
8822 val="$undef"
a22e52b9 8823 echo "No, it doesn't."
8175356b 8824 case "$lseeksize" in
1eeb0f31 8825 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8175356b 8826 esac
d9b3e12d 8827fi
8175356b 8828$rm -f try.* try
d9b3e12d
JH
8829set d_off64_t
8830eval $setvar
8831
8832: check for fpos64_t
8833echo " "
8175356b 8834echo "Checking to see if your system supports fpos64_t..." >&4
d9b3e12d
JH
8835$cat >try.c <<EOCP
8836#include <sys/stdio.h>
8175356b 8837int main() { fpos64_t x x = 7; }'
d9b3e12d 8838EOCP
8175356b
JH
8839set try
8840if eval $compile; then
d9b3e12d 8841 val="$define"
a22e52b9 8842 echo "Yes, it does."
d9b3e12d
JH
8843else
8844 val="$undef"
a22e52b9 8845 echo "No, it doesn't."
8175356b 8846 case "$fpossize" in
1eeb0f31 8847 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8175356b 8848 esac
d9b3e12d 8849fi
8175356b 8850$rm -f try.* try
d9b3e12d
JH
8851set d_fpos64_t
8852eval $setvar
8853
0545a864
JH
8854hasstruct='varname=$1; struct=$2; shift; shift;
8855while $test $# -ge 2; do
8856 case "$1" in
8857 $define) echo "#include <$2>";;
8858 esac ;
8859 shift 2;
8860done > try.c;
8861echo "int main () { struct $struct foo; }" >> try.c;
8862set try;
8863if eval $compile; then
8864 val="$define";
8865else
8866 val="$undef";
8867fi;
8868set $varname;
8869eval $setvar;
8870$rm -f try.c try.o'
d9b3e12d 8871
9b9c89a3
JH
8872: see if this is a sys/param system
8873set sys/param.h i_sysparam
8874eval $inhdr
8875
104d25b7
JH
8876: see if this is a sys/mount.h system
8877set sys/mount.h i_sysmount
8878eval $inhdr
8879
0545a864
JH
8880: see if sys/types.h has to be included
8881set sys/types.h i_systypes
8882eval $inhdr
8883
0545a864 8884
ad27e871 8885echo " "
8175356b 8886echo "Checking to see if your system supports struct fs_data..." >&4
0545a864
JH
8887set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8888eval $hasstruct
8889case "$d_fs_data_s" in
a22e52b9
JH
8890"$define") echo "Yes, it does." ;;
8891*) echo "No, it doesn't." ;;
0545a864
JH
8892esac
8893
8894: see if fseeko exists
8895set fseeko d_fseeko
8896eval $inlibc
1eeb0f31 8897case "$longsize" in
43999f95 88988) echo "(Your long is 64 bits, so you could use fseek.)" ;;
1eeb0f31 8899esac
0545a864
JH
8900
8901: see if fsetpos exists
8902set fsetpos d_fsetpos
8903eval $inlibc
8904
8905
8906: see if fstatfs exists
8907set fstatfs d_fstatfs
8908eval $inlibc
104d25b7
JH
8909
8910
8911: see if statvfs exists
8912set statvfs d_statvfs
8913eval $inlibc
8914
8915: see if fstatvfs exists
8916set fstatvfs d_fstatvfs
8917eval $inlibc
8918
8919
5ff3f7a4
GS
8920: see if ftello exists
8921set ftello d_ftello
8922eval $inlibc
1eeb0f31 8923case "$longsize" in
43999f95 89248) echo "(Your long is 64 bits, so you could use ftell.)" ;;
1eeb0f31 8925esac
5ff3f7a4 8926
49dabb45
JH
8927: see if getcwd exists
8928set getcwd d_getcwd
8929eval $inlibc
8930
5ff3f7a4
GS
8931: see if getgrent exists
8932set getgrent d_getgrent
8933eval $inlibc
8934
693762b4
AD
8935: see if gethostbyaddr exists
8936set gethostbyaddr d_gethbyaddr
8937eval $inlibc
8938
8939: see if gethostbyname exists
8940set gethostbyname d_gethbyname
8941eval $inlibc
8942
a0d0e21e
LW
8943: see if gethostent exists
8944set gethostent d_gethent
8945eval $inlibc
8946
921b2963
JH
8947: see how we will look up host name
8948echo " "
a63faeb8
JH
8949call=''
8950if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
8951 echo 'gethostname() found.' >&4
8952 d_gethname="$define"
8953 call=gethostname
a63faeb8
JH
8954fi
8955if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
8956 if ./xenix; then
8957 $cat <<'EOM'
8958uname() was found, but you're running xenix, and older versions of xenix
8959have a broken uname(). If you don't really know whether your xenix is old
8960enough to have a broken system call, use the default answer.
8961
8962EOM
8963 dflt=y
8964 case "$d_uname" in
8965 "$define") dflt=n;;
8966 esac
8967 rp='Is your uname() broken?'
8968 . ./myread
8969 case "$ans" in
8970 n*) d_uname="$define"; call=uname;;
8971 esac
8972 else
8973 echo 'uname() found.' >&4
8974 d_uname="$define"
a63faeb8
JH
8975 case "$call" in
8976 '') call=uname ;;
8977 esac
921b2963
JH
8978 fi
8979fi
8980case "$d_gethname" in
8981'') d_gethname="$undef";;
8982esac
8983case "$d_uname" in
8984'') d_uname="$undef";;
8985esac
8986case "$d_uname$d_gethname" in
8987*define*)
8988 dflt=n
8989 cat <<EOM
8990
8991Every now and then someone has a $call() that lies about the hostname
8992but can't be fixed for political or economic reasons. If you wish, I can
8993pretend $call() isn't there and maybe compute hostname at run-time
8994thanks to the '$phostname' command.
8995
8996EOM
8997 rp="Shall I ignore $call() from now on?"
8998 . ./myread
8999 case "$ans" in
9000 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9001 esac;;
9002esac
9003case "$phostname" in
9004'') aphostname='';;
9005*) case "$aphostname" in
9006 /*) ;;
9007 *) set X $phostname
9008 shift
9009 file=$1
9010 shift
9011 file=`./loc $file $file $pth`
9012 aphostname=`echo $file $*`
9013 ;;
9014 esac
9015 ;;
9016esac
9017case "$d_uname$d_gethname" in
9018*define*) ;;
9019*)
9020 case "$phostname" in
9021 '')
9022 echo "There will be no way for $package to get your hostname." >&4;;
9023 *)
9024 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9025 ;;
9026 esac;;
9027esac
9028case "$d_phostname" in
9029'') d_phostname="$undef";;
9030esac
9031
dc45a647
MB
9032: see if this is a netdb.h system
9033set netdb.h i_netdb
9034eval $inhdr
9035
9036: see if prototypes for various gethostxxx netdb.h functions are available
9037echo " "
9038set d_gethostprotos gethostent $i_netdb netdb.h
9039eval $hasproto
9040
a0d0e21e
LW
9041: see if getlogin exists
9042set getlogin d_getlogin
9043eval $inlibc
9044
ad27e871
JH
9045: see if getmnt exists
9046set getmnt d_getmnt
9047eval $inlibc
9048
ccc7f9b3
KS
9049: see if getmntent exists
9050set getmntent d_getmntent
9051eval $inlibc
9052
693762b4
AD
9053: see if getnetbyaddr exists
9054set getnetbyaddr d_getnbyaddr
9055eval $inlibc
9056
9057: see if getnetbyname exists
9058set getnetbyname d_getnbyname
9059eval $inlibc
9060
e5c9fcd0
AD
9061: see if getnetent exists
9062set getnetent d_getnent
9063eval $inlibc
9064
dc45a647
MB
9065: see if prototypes for various getnetxxx netdb.h functions are available
9066echo " "
9067set d_getnetprotos getnetent $i_netdb netdb.h
9068eval $hasproto
9069
693762b4
AD
9070
9071: see if getprotobyname exists
9072set getprotobyname d_getpbyname
9073eval $inlibc
9074
9075: see if getprotobynumber exists
9076set getprotobynumber d_getpbynumber
9077eval $inlibc
e5c9fcd0
AD
9078
9079: see if getprotoent exists
9080set getprotoent d_getpent
9081eval $inlibc
9082
2afac517 9083: see if getpgid exists
9084set getpgid d_getpgid
a0d0e21e
LW
9085eval $inlibc
9086
9087: see if getpgrp2 exists
9088set getpgrp2 d_getpgrp2
9089eval $inlibc
9090
9091: see if getppid exists
9092set getppid d_getppid
9093eval $inlibc
9094
9095: see if getpriority exists
9096set getpriority d_getprior
9097eval $inlibc
9098
dc45a647
MB
9099: see if prototypes for various getprotoxxx netdb.h functions are available
9100echo " "
9101set d_getprotoprotos getprotoent $i_netdb netdb.h
9102eval $hasproto
9103
5ff3f7a4
GS
9104: see if getpwent exists
9105set getpwent d_getpwent
9106eval $inlibc
9107
9108
693762b4
AD
9109: see if getservbyname exists
9110set getservbyname d_getsbyname
9111eval $inlibc
9112
9113: see if getservbyport exists
9114set getservbyport d_getsbyport
9115eval $inlibc
e5c9fcd0
AD
9116
9117: see if getservent exists
9118set getservent d_getsent
9119eval $inlibc
9120
dc45a647
MB
9121: see if prototypes for various getservxxx netdb.h functions are available
9122echo " "
9123set d_getservprotos getservent $i_netdb netdb.h
9124eval $hasproto
9125
f1066039
JH
9126: see if getspent exists
9127set getspent d_getspent
9128eval $inlibc
9129
9130: see if getspnam exists
9131set getspnam d_getspnam
9132eval $inlibc
9133
5f05dabc 9134: see if gettimeofday or ftime exists
9135set gettimeofday d_gettimeod
9136eval $inlibc
9137case "$d_gettimeod" in
9138"$undef")
9139 set ftime d_ftime
9140 eval $inlibc
9141 ;;
9142*)
9143 val="$undef"; set d_ftime; eval $setvar
9144 ;;
9145esac
9146case "$d_gettimeod$d_ftime" in
9147"$undef$undef")
9148 echo " "
9149 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9150 ;;
9151esac
9152
5ff3f7a4
GS
9153: see if this is an grp system
9154set grp.h i_grp
9155eval $inhdr
9156
9157case "$i_grp" in
9158$define)
9159 xxx=`./findhdr grp.h`
9160 $cppstdin $cppflags $cppminus < $xxx >$$.h
9161
9162 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9163 val="$define"
9164 else
9165 val="$undef"
9166 fi
9167 set d_grpasswd
9168 eval $setvar
9169
9170 $rm -f $$.h
9171 ;;
9172*)
9173 val="$undef";
9174 set d_grpasswd; eval $setvar
9175 ;;
9176esac
9177
ccc7f9b3
KS
9178: see if hasmntopt exists
9179set hasmntopt d_hasmntopt
9180eval $inlibc
9181
a0d0e21e
LW
9182: see if this is a netinet/in.h or sys/in.h system
9183set netinet/in.h i_niin sys/in.h i_sysin
9184eval $inhdr
9185
5ff3f7a4 9186: see if arpa/inet.h has to be included
93341792 9187set arpa/inet.h i_arpainet
28e8609d
JH
9188eval $inhdr
9189
a0d0e21e
LW
9190: see if htonl --and friends-- exists
9191val=''
9192set htonl val
9193eval $inlibc
9194
9195: Maybe they are macros.
9196case "$val" in
9197$undef)
9198 $cat >htonl.c <<EOM
9199#include <stdio.h>
9200#include <sys/types.h>
9201#$i_niin I_NETINET_IN
9202#$i_sysin I_SYS_IN
93341792 9203#$i_arpainet I_ARPA_INET
a0d0e21e
LW
9204#ifdef I_NETINET_IN
9205#include <netinet/in.h>
9206#endif
9207#ifdef I_SYS_IN
9208#include <sys/in.h>
9209#endif
28e8609d
JH
9210#ifdef I_ARPA_INET
9211#include <arpa/inet.h>
9212#endif
a0d0e21e
LW
9213#ifdef htonl
9214printf("Defined as a macro.");
9215#endif
9216EOM
9217 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9218 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9219 val="$define"
9220 echo "But it seems to be defined as a macro." >&4
9221 fi
9222 $rm -f htonl.?
9223 ;;
9224esac
9225set d_htonl
9226eval $setvar
9227
43999f95
JH
9228: see if iconv exists
9229set iconv d_iconv
9230eval $inlibc
9231
a0d0e21e
LW
9232: index or strchr
9233echo " "
9234if set index val -f; eval $csym; $val; then
9235 if set strchr val -f d_strchr; eval $csym; $val; then
9236 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9237 val="$define"
9238 vali="$undef"
9239 echo "strchr() found." >&4
9240 else
9241 val="$undef"
9242 vali="$define"
9243 echo "index() found." >&4
9244 fi
9245 else
9246 val="$undef"
9247 vali="$define"
9248 echo "index() found." >&4
9249 fi
9250else
9251 if set strchr val -f d_strchr; eval $csym; $val; then
9252 val="$define"
9253 vali="$undef"
9254 echo "strchr() found." >&4
9255 else
9256 echo "No index() or strchr() found!" >&4
9257 val="$undef"
9258 vali="$undef"
9259 fi
9260fi
9261set d_strchr; eval $setvar
9262val="$vali"
9263set d_index; eval $setvar
9264
7e1af8bc 9265: check whether inet_aton exists
9266set inet_aton d_inetaton
9267eval $inlibc
9268
fe749a9f
JH
9269: see if inttypes.h is available
9270: we want a real compile instead of Inhdr because some systems
9271: have an inttypes.h which includes non-existent headers
9272echo " "
9273$cat >try.c <<EOCP
9274#include <inttypes.h>
9275int main() {
9276 static int32_t foo32 = 0x12345678;
9277}
9278EOCP
9279set try
9280if eval $compile; then
9281 echo "<inttypes.h> found." >&4
9282 val="$define"
9283else
9284 echo "<inttypes.h> NOT found." >&4
9285 val="$undef"
9286fi
9287$rm -f try.c try
9288set i_inttypes
9289eval $setvar
9290
9291: check for int64_t
9292echo " "
9293$echo $n "Checking to see if your system supports int64_t...$c" >&4
9294$cat >try.c <<EOCP
9295#include <sys/types.h>
9296#$i_inttypes I_INTTYPES
9297#ifdef I_INTTYPES
9298#include <inttypes.h>
9299#endif
9300int main() { int64_t x = 7; }
9301EOCP
9302set try
9303if eval $compile; then
9304 val="$define"
9305 echo " Yes, it does." >&4
9306else
9307 val="$undef"
9308 echo " No, it doesn't." >&4
9309fi
9310$rm -f try try.*
9311set d_int64t
9312eval $setvar
9313
a0d0e21e
LW
9314: Look for isascii
9315echo " "
9316$cat >isascii.c <<'EOCP'
9317#include <stdio.h>
9318#include <ctype.h>
d674cd6d 9319int main() {
a0d0e21e
LW
9320 int c = 'A';
9321 if (isascii(c))
9322 exit(0);
9323 else
9324 exit(1);
9325}
9326EOCP
dfe9444c
AD
9327set isascii
9328if eval $compile; then
a0d0e21e
LW
9329 echo "isascii() found." >&4
9330 val="$define"
9331else
9332 echo "isascii() NOT found." >&4
9333 val="$undef"
9334fi
9335set d_isascii
9336eval $setvar
9337$rm -f isascii*
9338
9339: see if killpg exists
9340set killpg d_killpg
9341eval $inlibc
9342
dd64f1c3
AD
9343: see if lchown exists
9344echo " "
9345$cat > try.c <<'EOCP'
9346/* System header to define __stub macros and hopefully few prototypes,
9347 which can conflict with char lchown(); below. */
9348#include <assert.h>
9349/* Override any gcc2 internal prototype to avoid an error. */
9350/* We use char because int might match the return type of a gcc2
9351 builtin and then its argument prototype would still apply. */
9352char lchown();
9353int main() {
9354 /* The GNU C library defines this for functions which it implements
9355 to always fail with ENOSYS. Some functions are actually named
9356 something starting with __ and the normal name is an alias. */
9357#if defined (__stub_lchown) || defined (__stub___lchown)
9358choke me
9359#else
9360lchown();
9361#endif
9362; return 0; }
9363EOCP
9364set try
9365if eval $compile; then
9366 $echo "lchown() found." >&4
9367 val="$define"
9368else
9369 $echo "lchown() NOT found." >&4
9370 val="$undef"
9371fi
9372set d_lchown
9373eval $setvar
9374
2d4389e4
JH
9375: See if number of significant digits in a double precision number is known
9376echo " "
9377$cat >ldbl_dig.c <<EOM
9378#$i_limits I_LIMITS
9379#$i_float I_FLOAT
9380#ifdef I_LIMITS
9381#include <limits.h>
9382#endif
9383#ifdef I_FLOAT
9384#include <float.h>
9385#endif
9386#ifdef LDBL_DIG
9387printf("Contains LDBL_DIG");
9388#endif
9389EOM
9390$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9391if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9392 echo "LDBL_DIG found." >&4
9393 val="$define"
9394else
9395 echo "LDBL_DIG NOT found." >&4
9396 val="$undef"
9397fi
9398$rm -f ldbl_dig.?
9399set d_ldbl_dig
9400eval $setvar
9401
a0d0e21e
LW
9402: see if link exists
9403set link d_link
9404eval $inlibc
9405
a0d0e21e
LW
9406: see if localeconv exists
9407set localeconv d_locconv
9408eval $inlibc
9409
9410: see if lockf exists
9411set lockf d_lockf
9412eval $inlibc
9413
8175356b
JH
9414: check for long long
9415echo " "
9416$echo $n "Checking to see if your system supports long long..." $c >&4
213c275f 9417echo 'int main() { long long x = 7; return 0; }' > try.c
8175356b
JH
9418set try
9419if eval $compile; then
9420 val="$define"
9421 echo " Yes, it does." >&4
9422else
9423 val="$undef"
9424 echo " No, it doesn't." >&4
9425fi
9426$rm try.*
9427set d_longlong
9428eval $setvar
9429
9430: check for length of long long
9431case "${d_longlong}${longlongsize}" in
9432$define)
9433 echo " "
9434 $echo $n "Checking to see how big your long longs are..." $c >&4
9435 $cat >try.c <<'EOCP'
9436#include <stdio.h>
9437int main()
9438{
213c275f
JH
9439 printf("%d\n", (int)sizeof(long long));
9440 return(0);
8175356b
JH
9441}
9442EOCP
9443 set try
9444 if eval $compile_ok; then
9445 longlongsize=`./try$exe_ext`
9446 $echo " $longlongsize bytes." >&4
9447 else
9448 dflt='8'
9449 echo " "
9450 echo "(I can't seem to compile the test program. Guessing...)"
9451 rp="What is the size of a long long (in bytes)?"
9452 . ./myread
9453 longlongsize="$ans"
9454 fi
9455 if $test "X$longsize" = "X$longlongsize"; then
9456 echo "(That isn't any different from an ordinary long.)"
9457 fi
9458 ;;
9459esac
9460$rm -f try.* try
9461
a0d0e21e
LW
9462: see if lstat exists
9463set lstat d_lstat
9464eval $inlibc
9465
9466: see if mblen exists
9467set mblen d_mblen
9468eval $inlibc
9469
9470: see if mbstowcs exists
9471set mbstowcs d_mbstowcs
9472eval $inlibc
9473
9474: see if mbtowc exists
9475set mbtowc d_mbtowc
9476eval $inlibc
9477
0f27ced1
JH
9478: see if memchr exists
9479set memchr d_memchr
9480eval $inlibc
9481
a0d0e21e
LW
9482: see if memcmp exists
9483set memcmp d_memcmp
9484eval $inlibc
9485
9486: see if memcpy exists
9487set memcpy d_memcpy
9488eval $inlibc
9489
9490: see if memmove exists
9491set memmove d_memmove
2304df62
AD
9492eval $inlibc
9493
9494: see if memset exists
9495set memset d_memset
9496eval $inlibc
9497
9498: see if mkdir exists
9499set mkdir d_mkdir
9500eval $inlibc
9501
fe749a9f
JH
9502: see if mkdtemp exists
9503set mkdtemp d_mkdtemp
9504eval $inlibc
9505
a0d0e21e
LW
9506: see if mkfifo exists
9507set mkfifo d_mkfifo
9508eval $inlibc
9509
fe749a9f
JH
9510: see if mkstemp exists
9511set mkstemp d_mkstemp
9512eval $inlibc
9513
9514: see if mkstemps exists
9515set mkstemps d_mkstemps
9516eval $inlibc
9517
a0d0e21e
LW
9518: see if mktime exists
9519set mktime d_mktime
9520eval $inlibc
9521
fe749a9f
JH
9522: see if mprotect exists
9523set mprotect d_mprotect
9524eval $inlibc
9525
2304df62
AD
9526: see if msgctl exists
9527set msgctl d_msgctl
9528eval $inlibc
9529
9530: see if msgget exists
9531set msgget d_msgget
9532eval $inlibc
9533
9534: see if msgsnd exists
9535set msgsnd d_msgsnd
9536eval $inlibc
9537
9538: see if msgrcv exists
9539set msgrcv d_msgrcv
9540eval $inlibc
9541
9542: see how much of the 'msg*(2)' library is present.
9543h_msg=true
9544echo " "
9545case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9546*"$undef"*) h_msg=false;;
9547esac
6087ac44
JH
9548case "$osname" in
9549freebsd)
9550 case "`ipcs 2>&1`" in
9551 "SVID messages"*"not configured"*)
5ff3f7a4 9552 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9553 h_msg=false
9554 val="$undef"
9555 set msgctl d_msgctl
9556 eval $setvar
9557 set msgget d_msgget
9558 eval $setvar
9559 set msgsnd d_msgsnd
9560 eval $setvar
9561 set msgrcv d_msgrcv
9562 eval $setvar
9563 ;;
9564 esac
9565 ;;
9566esac
2304df62
AD
9567: we could also check for sys/ipc.h ...
9568if $h_msg && $test `./findhdr sys/msg.h`; then
9569 echo "You have the full msg*(2) library." >&4
9570 val="$define"
9571else
9572 echo "You don't have the full msg*(2) library." >&4
9573 val="$undef"
9574fi
9575set d_msg
9576eval $setvar
9577
fe749a9f
JH
9578: see if msync exists
9579set msync d_msync
dfe9444c
AD
9580eval $inlibc
9581
fe749a9f
JH
9582: see if munmap exists
9583set munmap d_munmap
9584eval $inlibc
ff935051 9585
fe749a9f
JH
9586: see if nice exists
9587set nice d_nice
9588eval $inlibc
ff935051 9589
de1c2614
JH
9590
9591echo " "
6b8eaf93 9592echo "Checking which 64-bit integer type we could use..." >&4
de1c2614
JH
9593
9594case "$intsize" in
95958) val=int
9596 set quadtype
9597 eval $setvar
9598 val='"unsigned int"'
9599 set uquadtype
9600 eval $setvar
6b8eaf93 9601 quadkind=1
de1c2614
JH
9602 ;;
9603*) case "$longsize" in
9604 8) val=long
9605 set quadtype
9606 eval $setvar
9607 val='"unsigned long"'
9608 set uquadtype
9609 eval $setvar
6b8eaf93 9610 quadkind=2
de1c2614 9611 ;;
43999f95
JH
9612 *) case "$d_longlong:$longlongsize" in
9613 define:8)
de1c2614
JH
9614 val='"long long"'
9615 set quadtype
9616 eval $setvar
9617 val='"unsigned long long"'
9618 set uquadtype
9619 eval $setvar
6b8eaf93 9620 quadkind=3
de1c2614
JH
9621 ;;
9622 *) case "$d_int64t" in
9623 define)
9624 val=int64_t
9625 set quadtype
9626 eval $setvar
9627 val=uint64_t
9628 set uquadtype
9629 eval $setvar
6b8eaf93 9630 quadkind=4
de1c2614
JH
9631 ;;
9632 esac
9633 ;;
9634 esac
9635 ;;
9636 esac
9637 ;;
9638esac
9639
9640case "$quadtype" in
ad551343 9641'') echo "Alas, no 64-bit integer types in sight." >&4
de1c2614
JH
9642 d_quad="$undef"
9643 ;;
1eeb0f31
JH
9644*) if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9645 verb="will"
9646 else
9647 verb="could"
9648 fi
9649 echo "We $verb use '$quadtype' for 64-bit integers." >&4
de1c2614
JH
9650 d_quad="$define"
9651 ;;
9652esac
9653
cce08f5b
JH
9654: check for length of character
9655echo " "
9656case "$charsize" in
9657'')
9658 echo "Checking to see how big your characters are (hey, you never know)..." >&4
9659 $cat >try.c <<'EOCP'
9660#include <stdio.h>
9661int main()
9662{
9663 printf("%d\n", (int)sizeof(char));
9664 exit(0);
9665}
9666EOCP
9667 set try
9668 if eval $compile_ok; then
9669 dflt=`./try`
9670 else
9671 dflt='1'
9672 echo "(I can't seem to compile the test program. Guessing...)"
9673 fi
9674 ;;
9675*)
9676 dflt="$charsize"
9677 ;;
9678esac
9679rp="What is the size of a character (in bytes)?"
9680. ./myread
9681charsize="$ans"
9682$rm -f try.c try
9683
9684
9685echo " "
9686$echo "Choosing the C types to be used for Perl's internal types..." >&4
9687
9688case "$use64bits:$d_quad:$quadtype" in
9689define:define:?*)
9690 ivtype="$quadtype"
9691 uvtype="$uquadtype"
9692 ivsize=8
9693 uvsize=8
9694 ;;
9695*) ivtype="long"
9696 uvtype="unsigned long"
9697 ivsize=$longsize
9698 uvsize=$longsize
9699 ;;
9700esac
9701
9702case "$uselongdouble:$d_longdbl" in
9703define:define)
9704 nvtype="long double"
9705 nvsize=$longdblsize
9706 ;;
9707*) nvtype=double
9708 nvsize=$doublesize
9709 ;;
9710esac
9711
9712$echo "(IV will be "$ivtype", $ivsize bytes)"
9713$echo "(UV will be "$uvtype", $uvsize bytes)"
9714$echo "(NV will be "$nvtype", $nvsize bytes)"
9715
9716$cat >try.c <<EOCP
9717#$i_inttypes I_INTTYPES
9718#ifdef I_INTTYPES
9719#include <inttypes.h>
9720#endif
9721#include <stdio.h>
9722int main() {
9723#ifdef INT8
9724 int8_t i = INT8_MAX;
9725 uint8_t u = UINT8_MAX;
9726 printf("int8_t\n");
9727#endif
9728#ifdef INT16
9729 int16_t i = INT16_MAX;
9730 uint16_t i = UINT16_MAX;
9731 printf("int16_t\n");
9732#endif
9733#ifdef INT32
9734 int32_t i = INT32_MAX;
9735 uint32_t u = UINT32_MAX;
9736 printf("int32_t\n");
9737#endif
9738}
9739EOCP
9740
9741case "$i8type" in
9742'') case "$charsize" in
9743 1) i8type=char
9744 u8type="unsigned char"
9745 i8size=$charsize
9746 u8size=$charsize
9747 ;;
9748 esac
9749 ;;
9750esac
9751case "$i8type" in
9752'') set try -DINT8
9753 if eval $compile; then
9754 case "`./try$exe_ext`" in
9755 int8_t) i8type=int8_t
9756 u8type=uint8_t
9757 i8size=1
9758 u8size=1
9759 ;;
9760 esac
9761 fi
9762 ;;
9763esac
9764case "$i8type" in
9765'') if $test $charsize -ge 1; then
9766 i8type=char
9767 u8type="unsigned char"
9768 i8size=$charsize
9769 u8size=$charsize
9770 fi
9771 ;;
9772esac
9773
9774case "$i16type" in
9775'') case "$shortsize" in
9776 2) i16type=short
9777 u16type="unsigned short"
9778 i16size=$shortsize
9779 u16size=$shortsize
9780 ;;
9781 esac
9782 ;;
9783esac
9784case "$i16type" in
9785'') set try -DINT16
9786 if eval $compile; then
9787 case "`./try$exe_ext`" in
9788 int16_t)
9789 i16type=int16_t
9790 u16type=uint16_t
9791 i16size=2
9792 u16size=2
9793 ;;
9794 esac
9795 fi
9796 ;;
9797esac
9798case "$i16type" in
9799'') if $test $shortsize -ge 2; then
9800 i16type=short
9801 u16type="unsigned short"
9802 i16size=$shortsize
9803 u16size=$shortsize
9804 fi
9805 ;;
9806esac
9807
9808case "$i32type" in
9809'') case "$longsize" in
9810 4) i32type=long
9811 u32type="unsigned long"
9812 i32size=$longsize
9813 u32size=$longsize
9814 ;;
9815 *) case "$intsize" in
9816 4) i32type=int
9817 u32type="unsigned int"
9818 i32size=$intsize
9819 u32size=$intsize
9820 ;;
9821 esac
9822 ;;
9823 esac
9824 ;;
9825esac
9826case "$i32type" in
9827'') set try -DINT32
9828 if eval $compile; then
9829 case "`./try$exe_ext`" in
9830 int32_t)
9831 i32type=int32_t
9832 u32type=uint32_t
9833 i32size=4
9834 u32size=4
9835 ;;
9836 esac
9837 fi
9838 ;;
9839esac
9840case "$i32type" in
9841'') if $test $intsize -ge 4; then
9842 i32type=int
9843 u32type="unsigned int"
9844 i32size=$intsize
9845 u32size=$intsize
9846 fi
9847 ;;
9848esac
9849
9850case "$i64type" in
9851'') case "$d_quad:$quadtype" in
9852 define:?*)
9853 i64type="$quadtype"
9854 u64type="$uquadtype"
9855 i64size=8
9856 u64size=8
9857 ;;
9858 esac
9859 ;;
9860esac
9861
9862$echo "Checking whether your NVs can preserve your UVs..." >&4
9863$cat <<EOP >try.c
9864#include <stdio.h>
9865int main() {
9866 $uvtype k = ($uvtype)~0, l;
9867 $nvtype d;
9868 l = k;
9869 d = ($nvtype)l;
9870 l = ($uvtype)d;
9871 if (l == k)
9872 printf("preserve\n");
9873 exit(0);
9874}
9875EOP
9876set try
9877if eval $compile; then
9878 case "`./try$exe_ext`" in
78691af5 9879 preserve) d_nv_preserves_uv="$define" ;;
cce08f5b
JH
9880 esac
9881fi
78691af5 9882case "$d_nv_preserves_uv" in
cce08f5b
JH
9883$define) $echo "Yes, they can." 2>&1 ;;
9884*) $echo "No, they can't." 2>&1
78691af5 9885 d_nv_preserves_uv="$undef"
cce08f5b
JH
9886 ;;
9887esac
9888
9889$rm -f try.* try
9890
c4747d3e 9891: see if POSIX threads are available
1f5ae88c
JH
9892set pthread.h i_pthread
9893eval $inhdr
9894
c4747d3e
JH
9895
9896
9897
9898: how to create joinable pthreads
9899if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
9900 echo " "
9901 echo "Checking what constant to use for creating joinable pthreads..." >&4
9902 $cat >try.c <<'EOCP'
9903#include <pthread.h>
9904int main() {
9905 int detachstate = JOINABLE;
9906}
9907EOCP
9908 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9909 if eval $compile; then
c6912327 9910 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
9911 val="$undef" # Yes, undef.
9912 set d_old_pthread_create_joinable
13666627 9913 eval $setvar
ef4af2be
JH
9914 val=""
9915 set old_pthread_create_joinable
13666627
JH
9916 eval $setvar
9917 else
9918 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9919 if eval $compile; then
c6912327 9920 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 9921 val="$define"
ef4af2be 9922 set d_old_pthread_create_joinable
13666627
JH
9923 eval $setvar
9924 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 9925 set old_pthread_create_joinable
13666627
JH
9926 eval $setvar
9927 else
9928 set try -DJOINABLE=__UNDETACHED
9929 if eval $compile; then
c6912327 9930 echo "You seem to use __UNDETACHED." >&4
13666627 9931 val="$define"
ef4af2be 9932 set d_old_pthread_create_joinable
13666627
JH
9933 eval $setvar
9934 val=__UNDETACHED
ef4af2be 9935 set old_pthread_create_joinable
13666627
JH
9936 eval $setvar
9937 else
c6912327 9938 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 9939 val="$define"
ef4af2be 9940 set d_old_pthread_create_joinable
13666627
JH
9941 eval $setvar
9942 val=0
ef4af2be 9943 set old_pthread_create_joinable
13666627
JH
9944 eval $setvar
9945 fi
9946 fi
9947 fi
9948 $rm -f try try.*
9949else
ef4af2be
JH
9950 d_old_pthread_create_joinable="$undef"
9951 old_pthread_create_joinable=""
13666627
JH
9952fi
9953
ef4af2be
JH
9954: see if pause exists
9955set pause d_pause
9956eval $inlibc
9957
9958: see if pipe exists
9959set pipe d_pipe
9960eval $inlibc
9961
9962: see if poll exists
9963set poll d_poll
9964eval $inlibc
9965
31dfa2f6
JH
9966
9967: see whether the various POSIXish _yields exist
9968$cat >try.c <<EOP
9969#include <pthread.h>
9970#include <stdio.h>
5a411a32 9971int main() {
31dfa2f6
JH
9972#ifdef SCHED_YIELD
9973 sched_yield();
9974#else
9975#ifdef PTHREAD_YIELD
9976 pthread_yield();
9977#else
9978#ifdef PTHREAD_YIELD_NULL
9979 pthread_yield(NULL);
9980#endif
9981#endif
9982#endif
9983}
9984EOP
9985: see if sched_yield exists
9986set try -DSCHED_YIELD
9987if eval $compile; then
9988 val="$define"
9989 sched_yield='sched_yield()'
9990else
9991 val="$undef"
9992fi
9993case "$usethreads" in
9994$define)
9995 case "$val" in
9996 $define) echo 'sched_yield() found.' >&4 ;;
9997 *) echo 'sched_yield() NOT found.' >&4 ;;
9998 esac
9999esac
10000set d_sched_yield
10001eval $setvar
10002
10003: see if pthread_yield exists
10004set try -DPTHREAD_YIELD
10005if eval $compile; then
10006 val="$define"
10007 case "$sched_yield" in
10008 '') sched_yield='pthread_yield()' ;;
10009 esac
10010else
10011 set try -DPTHREAD_YIELD_NULL
10012 if eval $compile; then
10013 val="$define"
10014 case "$sched_yield" in
10015 '') sched_yield='pthread_yield(NULL)' ;;
10016 esac
10017 else
10018 val="$undef"
10019 fi
10020fi
10021case "$usethreads" in
10022$define)
10023 case "$val" in
10024 $define) echo 'pthread_yield() found.' >&4 ;;
10025 *) echo 'pthread_yield() NOT found.' >&4 ;;
10026 esac
10027 ;;
10028esac
10029set d_pthread_yield
10030eval $setvar
10031
10032case "$sched_yield" in
10033'') sched_yield=undef ;;
10034esac
10035
10036$rm -f try try.*
10037
4aa0a1f7
AD
10038: see if this is a pwd.h system
10039set pwd.h i_pwd
10040eval $inhdr
10041
10042case "$i_pwd" in
10043$define)
10044 xxx=`./findhdr pwd.h`
85e6fe83 10045 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 10046
2304df62 10047 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 10048 val="$define"
2304df62 10049 else
4aa0a1f7 10050 val="$undef"
2304df62 10051 fi
4aa0a1f7
AD
10052 set d_pwquota
10053 eval $setvar
10054
2304df62 10055 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 10056 val="$define"
2304df62 10057 else
4aa0a1f7 10058 val="$undef"
2304df62 10059 fi
4aa0a1f7
AD
10060 set d_pwage
10061 eval $setvar
10062
2304df62 10063 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 10064 val="$define"
2304df62 10065 else
4aa0a1f7 10066 val="$undef"
2304df62 10067 fi
4aa0a1f7
AD
10068 set d_pwchange
10069 eval $setvar
10070
2304df62 10071 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 10072 val="$define"
2304df62 10073 else
4aa0a1f7 10074 val="$undef"
2304df62 10075 fi
4aa0a1f7
AD
10076 set d_pwclass
10077 eval $setvar
10078
2304df62 10079 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 10080 val="$define"
2304df62 10081 else
4aa0a1f7 10082 val="$undef"
2304df62 10083 fi
4aa0a1f7 10084 set d_pwexpire
cce08f5b 10085 eval $setvar
de1c2614 10086
cce08f5b
JH
10087 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10088 val="$define"
1eeb0f31 10089 else
cce08f5b 10090 val="$undef"
1eeb0f31 10091 fi
cce08f5b
JH
10092 set d_pwcomment
10093 eval $setvar
10094
10095 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10096 val="$define"
10097 else
10098 val="$undef"
10099 fi
10100 set d_pwgecos
10101 eval $setvar
10102
10103 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10104 val="$define"
10105 else
10106 val="$undef"
10107 fi
10108 set d_pwpasswd
10109 eval $setvar
10110
10111 $rm -f $$.h
10112 ;;
10113*)
10114 val="$undef";
10115 set d_pwquota; eval $setvar
10116 set d_pwage; eval $setvar
10117 set d_pwchange; eval $setvar
10118 set d_pwclass; eval $setvar
10119 set d_pwexpire; eval $setvar
10120 set d_pwcomment; eval $setvar
10121 set d_pwgecos; eval $setvar
10122 set d_pwpasswd; eval $setvar
de1c2614
JH
10123 ;;
10124esac
10125
85e6fe83 10126: see if readdir and friends exist
2304df62
AD
10127set readdir d_readdir
10128eval $inlibc
85e6fe83
LW
10129set seekdir d_seekdir
10130eval $inlibc
10131set telldir d_telldir
10132eval $inlibc
10133set rewinddir d_rewinddir
10134eval $inlibc
2304df62 10135
a0d0e21e
LW
10136: see if readlink exists
10137set readlink d_readlink
10138eval $inlibc
10139
2304df62
AD
10140: see if rename exists
10141set rename d_rename
10142eval $inlibc
10143
10144: see if rmdir exists
10145set rmdir d_rmdir
10146eval $inlibc
10147
8ff267be 10148: see if memory.h is available.
10149val=''
10150set memory.h val
10151eval $inhdr
10152
10153: See if it conflicts with string.h
10154case "$val" in
10155$define)
10156 case "$strings" in
10157 '') ;;
10158 *)
10159 $cppstdin $cppflags $cppminus < $strings > mem.h
10160 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10161 echo " "
10162 echo "We won't be including <memory.h>."
10163 val="$undef"
10164 fi
10165 $rm -f mem.h
10166 ;;
10167 esac
10168esac
10169set i_memory
10170eval $setvar
10171
2304df62
AD
10172: can bcopy handle overlapping blocks?
10173val="$undef"
10174case "$d_bcopy" in
10175"$define")
10176 echo " "
10177 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 10178 $cat >try.c <<EOCP
8ff267be 10179#$i_memory I_MEMORY
10180#$i_stdlib I_STDLIB
10181#$i_string I_STRING
10182#$i_unistd I_UNISTD
10183EOCP
dfe9444c 10184 $cat >>try.c <<'EOCP'
8ff267be 10185#include <stdio.h>
8ff267be 10186#ifdef I_MEMORY
10187# include <memory.h>
10188#endif
10189#ifdef I_STDLIB
10190# include <stdlib.h>
10191#endif
10192#ifdef I_STRING
10193# include <string.h>
10194#else
10195# include <strings.h>
10196#endif
10197#ifdef I_UNISTD
10198# include <unistd.h> /* Needed for NetBSD */
10199#endif
d674cd6d 10200int main()
2304df62 10201{
85e6fe83
LW
10202char buf[128], abc[128];
10203char *b;
10204int len;
10205int off;
10206int align;
a0d0e21e 10207
85e6fe83 10208bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
10209
10210for (align = 7; align >= 0; align--) {
10211 for (len = 36; len; len--) {
10212 b = buf+align;
85e6fe83 10213 bcopy(abc, b, len);
2304df62
AD
10214 for (off = 1; off <= len; off++) {
10215 bcopy(b, b+off, len);
10216 bcopy(b+off, b, len);
85e6fe83 10217 if (bcmp(b, abc, len))
2304df62
AD
10218 exit(1);
10219 }
10220 }
10221}
10222exit(0);
10223}
10224EOCP
dfe9444c 10225 set try
dc45a647 10226 if eval $compile_ok; then
dfe9444c 10227 if ./try 2>/dev/null; then
2304df62
AD
10228 echo "Yes, it can."
10229 val="$define"
10230 else
10231 echo "It can't, sorry."
8ff267be 10232 case "$d_memmove" in
10233 "$define") echo "But that's Ok since you have memmove()." ;;
10234 esac
2304df62
AD
10235 fi
10236 else
10237 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10238 case "$d_memmove" in
10239 "$define") echo "But that's Ok since you have memmove()." ;;
10240 esac
2304df62
AD
10241 fi
10242 ;;
10243esac
dfe9444c 10244$rm -f try.* try core
2304df62
AD
10245set d_safebcpy
10246eval $setvar
10247
10248: can memcpy handle overlapping blocks?
10249val="$undef"
10250case "$d_memcpy" in
10251"$define")
10252 echo " "
10253 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 10254 $cat >try.c <<EOCP
8ff267be 10255#$i_memory I_MEMORY
10256#$i_stdlib I_STDLIB
10257#$i_string I_STRING
10258#$i_unistd I_UNISTD
10259EOCP
dfe9444c 10260 $cat >>try.c <<'EOCP'
8ff267be 10261#include <stdio.h>
8ff267be 10262#ifdef I_MEMORY
10263# include <memory.h>
10264#endif
10265#ifdef I_STDLIB
10266# include <stdlib.h>
10267#endif
10268#ifdef I_STRING
10269# include <string.h>
10270#else
10271# include <strings.h>
10272#endif
10273#ifdef I_UNISTD
10274# include <unistd.h> /* Needed for NetBSD */
10275#endif
d674cd6d 10276int main()
2304df62 10277{
85e6fe83
LW
10278char buf[128], abc[128];
10279char *b;
10280int len;
10281int off;
10282int align;
10283
8ff267be 10284/* Copy "abcde..." string to char abc[] so that gcc doesn't
10285 try to store the string in read-only memory. */
85e6fe83 10286memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
10287
10288for (align = 7; align >= 0; align--) {
10289 for (len = 36; len; len--) {
10290 b = buf+align;
232e078e 10291 memcpy(b, abc, len);
2304df62 10292 for (off = 1; off <= len; off++) {
2304df62 10293 memcpy(b+off, b, len);
232e078e 10294 memcpy(b, b+off, len);
85e6fe83 10295 if (memcmp(b, abc, len))
2304df62
AD
10296 exit(1);
10297 }
10298 }
10299}
10300exit(0);
10301}
10302EOCP
dfe9444c 10303 set try
dc45a647 10304 if eval $compile_ok; then
dfe9444c 10305 if ./try 2>/dev/null; then
2304df62
AD
10306 echo "Yes, it can."
10307 val="$define"
10308 else
10309 echo "It can't, sorry."
8ff267be 10310 case "$d_memmove" in
10311 "$define") echo "But that's Ok since you have memmove()." ;;
10312 esac
2304df62
AD
10313 fi
10314 else
10315 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10316 case "$d_memmove" in
10317 "$define") echo "But that's Ok since you have memmove()." ;;
10318 esac
2304df62
AD
10319 fi
10320 ;;
10321esac
dfe9444c 10322$rm -f try.* try core
2304df62
AD
10323set d_safemcpy
10324eval $setvar
10325
36477c24 10326: can memcmp be trusted to compare relative magnitude?
10327val="$undef"
10328case "$d_memcmp" in
10329"$define")
10330 echo " "
dfe9444c
AD
10331 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10332 $cat >try.c <<EOCP
36477c24 10333#$i_memory I_MEMORY
10334#$i_stdlib I_STDLIB
10335#$i_string I_STRING
10336#$i_unistd I_UNISTD
10337EOCP
dfe9444c 10338 $cat >>try.c <<'EOCP'
36477c24 10339#include <stdio.h>
36477c24 10340#ifdef I_MEMORY
10341# include <memory.h>
10342#endif
10343#ifdef I_STDLIB
10344# include <stdlib.h>
10345#endif
10346#ifdef I_STRING
10347# include <string.h>
10348#else
10349# include <strings.h>
10350#endif
10351#ifdef I_UNISTD
10352# include <unistd.h> /* Needed for NetBSD */
10353#endif
d674cd6d 10354int main()
36477c24 10355{
10356char a = -1;
10357char b = 0;
10358if ((a < b) && memcmp(&a, &b, 1) < 0)
10359 exit(1);
10360exit(0);
10361}
10362EOCP
dfe9444c 10363 set try
dc45a647 10364 if eval $compile_ok; then
dfe9444c 10365 if ./try 2>/dev/null; then
36477c24 10366 echo "Yes, it can."
10367 val="$define"
10368 else
10369 echo "No, it can't (it uses signed chars)."
10370 fi
10371 else
10372 echo "(I can't compile the test program, so we'll assume not...)"
10373 fi
10374 ;;
10375esac
dfe9444c 10376$rm -f try.* try core
36477c24 10377set d_sanemcmp
10378eval $setvar
10379
2304df62
AD
10380: see if select exists
10381set select d_select
10382eval $inlibc
10383
10384: see if semctl exists
10385set semctl d_semctl
10386eval $inlibc
10387
10388: see if semget exists
10389set semget d_semget
10390eval $inlibc
10391
10392: see if semop exists
10393set semop d_semop
10394eval $inlibc
10395
10396: see how much of the 'sem*(2)' library is present.
10397h_sem=true
10398echo " "
10399case "$d_semctl$d_semget$d_semop" in
10400*"$undef"*) h_sem=false;;
10401esac
6087ac44
JH
10402case "$osname" in
10403freebsd)
10404 case "`ipcs 2>&1`" in
10405 "SVID messages"*"not configured"*)
5ff3f7a4 10406 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
10407 h_sem=false
10408 val="$undef"
10409 set semctl d_semctl
10410 eval $setvar
10411 set semget d_semget
10412 eval $setvar
10413 set semop d_semop
10414 eval $setvar
10415 ;;
10416 esac
10417 ;;
10418esac
2304df62
AD
10419: we could also check for sys/ipc.h ...
10420if $h_sem && $test `./findhdr sys/sem.h`; then
10421 echo "You have the full sem*(2) library." >&4
10422 val="$define"
10423else
10424 echo "You don't have the full sem*(2) library." >&4
10425 val="$undef"
10426fi
10427set d_sem
10428eval $setvar
10429
bd89102f
AD
10430: see whether sys/sem.h defines union semun
10431echo " "
10432$cat > try.c <<'END'
10433#include <sys/types.h>
10434#include <sys/ipc.h>
10435#include <sys/sem.h>
10436int main () { union semun semun; semun.buf = 0; }
10437END
10438set try
10439if eval $compile; then
10440 echo "You have union semun in <sys/sem.h>." >&4
10441 val="$define"
10442else
10443 echo "You do not have union semun in <sys/sem.h>." >&4
10444 val="$undef"
10445fi
85ab1d1d 10446$rm -f try try.c try.h
bd89102f
AD
10447set d_union_semun
10448eval $setvar
10449
10450: see how to do semctl IPC_STAT
10451case "$d_sem" in
10452$define)
10453 : see whether semctl IPC_STAT can use union semun
10454 echo " "
85ab1d1d
JH
10455 $cat > try.h <<END
10456#ifndef S_IRUSR
10457# ifdef S_IREAD
10458# define S_IRUSR S_IREAD
10459# define S_IWUSR S_IWRITE
10460# define S_IXUSR S_IEXEC
10461# else
10462# define S_IRUSR 0400
10463# define S_IWUSR 0200
10464# define S_IXUSR 0100
10465# endif
10466# define S_IRGRP (S_IRUSR>>3)
10467# define S_IWGRP (S_IWUSR>>3)
10468# define S_IXGRP (S_IXUSR>>3)
10469# define S_IROTH (S_IRUSR>>6)
10470# define S_IWOTH (S_IWUSR>>6)
10471# define S_IXOTH (S_IXUSR>>6)
10472#endif
10473#ifndef S_IRWXU
10474# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10475# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10476# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10477#endif
10478END
10479
bd89102f
AD
10480 $cat > try.c <<END
10481#include <sys/types.h>
10482#include <sys/ipc.h>
10483#include <sys/sem.h>
10484#include <sys/stat.h>
10485#include <stdio.h>
10486#include <errno.h>
85ab1d1d 10487#include "try.h"
bd89102f
AD
10488#ifndef errno
10489extern int errno;
10490#endif
10491#$d_union_semun HAS_UNION_SEMUN
10492int main() {
10493 union semun
10494#ifndef HAS_UNION_SEMUN
10495 {
10496 int val;
10497 struct semid_ds *buf;
10498 unsigned short *array;
10499 }
10500#endif
10501 arg;
10502 int sem, st;
10503
10504#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10505 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10506 if (sem > -1) {
10507 struct semid_ds argbuf;
10508 arg.buf = &argbuf;
10509# ifdef IPC_STAT
10510 st = semctl(sem, 0, IPC_STAT, arg);
10511 if (st == 0)
10512 printf("semun\n");
10513 else
10514# endif /* IPC_STAT */
10515 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10516# ifdef IPC_RMID
10517 if (semctl(sem, 0, IPC_RMID, arg) != 0)
10518# endif /* IPC_RMID */
10519 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10520 } else
10521#endif /* IPC_PRIVATE && ... */
10522 printf("semget failed: errno = %d\n", errno);
10523 return 0;
10524}
10525END
10526 val="$undef"
10527 set try
10528 if eval $compile; then
10529 xxx=`./try`
10530 case "$xxx" in
10531 semun) val="$define" ;;
10532 esac
10533 fi
10534 $rm -f try try.c
10535 set d_semctl_semun
10536 eval $setvar
10537 case "$d_semctl_semun" in
10538 $define)
10539 echo "You can use union semun for semctl IPC_STAT." >&4
10540 also='also'
10541 ;;
10542 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
10543 also=''
10544 ;;
10545 esac
10546
10547 : see whether semctl IPC_STAT can use struct semid_ds pointer
10548 $cat > try.c <<'END'
10549#include <sys/types.h>
10550#include <sys/ipc.h>
10551#include <sys/sem.h>
10552#include <sys/stat.h>
85ab1d1d 10553#include "try.h"
bd89102f
AD
10554#include <stdio.h>
10555#include <errno.h>
10556#ifndef errno
10557extern int errno;
10558#endif
10559int main() {
10560 struct semid_ds arg;
10561 int sem, st;
10562
10563#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10564 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10565 if (sem > -1) {
10566# ifdef IPC_STAT
10567 st = semctl(sem, 0, IPC_STAT, &arg);
10568 if (st == 0)
10569 printf("semid_ds\n");
10570 else
10571# endif /* IPC_STAT */
10572 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10573# ifdef IPC_RMID
10574 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10575# endif /* IPC_RMID */
10576 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10577 } else
10578#endif /* IPC_PRIVATE && ... */
10579 printf("semget failed: errno = %d\n", errno);
10580
10581 return 0;
10582}
10583END
10584 val="$undef"
10585 set try
10586 if eval $compile; then
10587 xxx=`./try`
10588 case "$xxx" in
10589 semid_ds) val="$define" ;;
10590 esac
10591 fi
10592 $rm -f try try.c
10593 set d_semctl_semid_ds
10594 eval $setvar
10595 case "$d_semctl_semid_ds" in
10596 $define)
7f3d1cf1 10597 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 10598 ;;
7f3d1cf1 10599 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
10600 ;;
10601 esac
85ab1d1d 10602 $rm -f try.h
bd89102f
AD
10603 ;;
10604*) val="$undef"
10605
10606 # We do not have the full sem*(2) library, so assume we can not
10607 # use either.
10608
10609 set d_semctl_semun
10610 eval $setvar
10611
10612 set d_semctl_semid_ds
10613 eval $setvar
10614 ;;
10615esac
10616
2304df62
AD
10617: see if setegid exists
10618set setegid d_setegid
10619eval $inlibc
10620
10621: see if seteuid exists
10622set seteuid d_seteuid
10623eval $inlibc
10624
5ff3f7a4
GS
10625: see if setgrent exists
10626set setgrent d_setgrent
10627eval $inlibc
10628
693762b4
AD
10629: see if sethostent exists
10630set sethostent d_sethent
10631eval $inlibc
10632
a0d0e21e
LW
10633: see if setlinebuf exists
10634set setlinebuf d_setlinebuf
10635eval $inlibc
10636
2304df62
AD
10637: see if setlocale exists
10638set setlocale d_setlocale
10639eval $inlibc
a0d0e21e 10640
e5c9fcd0
AD
10641: see if setnetent exists
10642set setnetent d_setnent
10643eval $inlibc
10644
10645: see if setprotoent exists
10646set setprotoent d_setpent
10647eval $inlibc
10648
2304df62
AD
10649: see if setpgid exists
10650set setpgid d_setpgid
10651eval $inlibc
10652
2304df62
AD
10653: see if setpgrp2 exists
10654set setpgrp2 d_setpgrp2
10655eval $inlibc
10656
10657: see if setpriority exists
10658set setpriority d_setprior
10659eval $inlibc
10660
5ff3f7a4
GS
10661: see if setpwent exists
10662set setpwent d_setpwent
10663eval $inlibc
10664
2304df62
AD
10665: see if setregid exists
10666set setregid d_setregid
10667eval $inlibc
10668set setresgid d_setresgid
10669eval $inlibc
10670
10671: see if setreuid exists
10672set setreuid d_setreuid
10673eval $inlibc
10674set setresuid d_setresuid
10675eval $inlibc
10676
10677: see if setrgid exists
10678set setrgid d_setrgid
10679eval $inlibc
10680
10681: see if setruid exists
10682set setruid d_setruid
10683eval $inlibc
10684
e5c9fcd0
AD
10685: see if setservent exists
10686set setservent d_setsent
10687eval $inlibc
10688
2304df62
AD
10689: see if setsid exists
10690set setsid d_setsid
10691eval $inlibc
10692
f1066039
JH
10693: see if setspent exists
10694set setspent d_setspent
10695eval $inlibc
10696
e5c9fcd0
AD
10697: see if setvbuf exists
10698set setvbuf d_setvbuf
10699eval $inlibc
10700
760ac839
LW
10701: see if sfio.h is available
10702set sfio.h i_sfio
10703eval $inhdr
10704
10705
8ff267be 10706: see if sfio library is available
760ac839
LW
10707case "$i_sfio" in
10708$define)
10709 val=''
10710 set sfreserve val
10711 eval $inlibc
10712 ;;
10713*)
10714 val="$undef"
10715 ;;
10716esac
8ff267be 10717: Ok, but do we want to use it.
760ac839
LW
10718case "$val" in
10719$define)
10720 case "$usesfio" in
8ff267be 10721 true|$define|[yY]*) dflt='y';;
760ac839
LW
10722 *) dflt='n';;
10723 esac
8ff267be 10724 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
10725 rp="You seem to have sfio available, do you want to try using it?"
10726 . ./myread
10727 case "$ans" in
8ff267be 10728 y|Y) ;;
10729 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 10730 val="$undef"
ff0cee69 10731 : Remove sfio from list of libraries to use
10732 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10733 shift
10734 libs="$*"
10735 echo "libs = $libs" >&4
760ac839
LW
10736 ;;
10737 esac
10738 ;;
8ff267be 10739*) case "$usesfio" in
10740 true|$define|[yY]*)
10741 echo "Sorry, cannot find sfio on this machine" >&4
10742 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
10743 ;;
10744 esac
10745 ;;
10746esac
8ff267be 10747set d_sfio
10748eval $setvar
760ac839
LW
10749case "$d_sfio" in
10750$define) usesfio='true';;
10751*) usesfio='false';;
10752esac
10753
2304df62
AD
10754: see if shmctl exists
10755set shmctl d_shmctl
10756eval $inlibc
10757
10758: see if shmget exists
10759set shmget d_shmget
10760eval $inlibc
10761
a0d0e21e
LW
10762: see if shmat exists
10763set shmat d_shmat
10764eval $inlibc
10765: see what shmat returns
10766case "$d_shmat" in
10767"$define")
10768 $cat >shmat.c <<'END'
10769#include <sys/shm.h>
10770void *shmat();
10771END
10772 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10773 shmattype='void *'
10774 else
10775 shmattype='char *'
10776 fi
10777 echo "and it returns ($shmattype)." >&4
10778 : see if a prototype for shmat is available
e50aee73
AD
10779 xxx=`./findhdr sys/shm.h`
10780 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
10781 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10782 val="$define"
10783 else
10784 val="$undef"
10785 fi
10786 $rm -f shmat.[co]
10787 ;;
10788*)
10789 val="$undef"
10790 ;;
10791esac
10792set d_shmatprototype
10793eval $setvar
10794
10795: see if shmdt exists
10796set shmdt d_shmdt
10797eval $inlibc
10798
10799: see how much of the 'shm*(2)' library is present.
10800h_shm=true
10801echo " "
10802case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10803*"$undef"*) h_shm=false;;
10804esac
6087ac44
JH
10805case "$osname" in
10806freebsd)
10807 case "`ipcs 2>&1`" in
10808 "SVID shared memory"*"not configured"*)
5ff3f7a4 10809 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
10810 h_shm=false
10811 val="$undef"
10812 set shmctl d_shmctl
10813 evat $setvar
10814 set shmget d_shmget
10815 evat $setvar
10816 set shmat d_shmat
10817 evat $setvar
10818 set shmdt d_shmdt
10819 evat $setvar
10820 ;;
10821 esac
10822 ;;
10823esac
a0d0e21e
LW
10824: we could also check for sys/ipc.h ...
10825if $h_shm && $test `./findhdr sys/shm.h`; then
10826 echo "You have the full shm*(2) library." >&4
10827 val="$define"
10828else
10829 echo "You don't have the full shm*(2) library." >&4
10830 val="$undef"
10831fi
10832set d_shm
10833eval $setvar
10834
2c7991dc 10835echo " "
8ff267be 10836: see if we have sigaction
10837if set sigaction val -f d_sigaction; eval $csym; $val; then
10838 echo 'sigaction() found.' >&4
dc45a647 10839 $cat > try.c <<'EOP'
8ff267be 10840#include <stdio.h>
10841#include <sys/types.h>
10842#include <signal.h>
d674cd6d 10843int main()
8ff267be 10844{
10845 struct sigaction act, oact;
190b66db 10846 act.sa_flags = 0;
48159a0c 10847 oact.sa_handler = 0;
14e4fe40
JH
10848 /* so that act and oact are used */
10849 exit(act.sa_flags == 0 && oact.sa_handler == 0);
8ff267be 10850}
10851EOP
dc45a647
MB
10852 set try
10853 if eval $compile_ok; then
10854 val="$define"
10855 else
10856 echo "But you don't seem to have a useable struct sigaction." >&4
10857 val="$undef"
10858 fi
8ff267be 10859else
dc45a647 10860 echo 'sigaction NOT found.' >&4
8ff267be 10861 val="$undef"
10862fi
10863set d_sigaction; eval $setvar
dfe9444c 10864$rm -f try try$_o try.c
2c7991dc 10865
a5f75d66
AD
10866: see if sigsetjmp exists
10867echo " "
921b2963
JH
10868case "$d_sigsetjmp" in
10869'')
10870 $cat >try.c <<'EOP'
10871#include <setjmp.h>
10872sigjmp_buf env;
10873int set = 1;
d674cd6d 10874int main()
921b2963
JH
10875{
10876 if (sigsetjmp(env,1))
10877 exit(set);
10878 set = 0;
10879 siglongjmp(env, 1);
10880 exit(1);
10881}
10882EOP
10883 set try
10884 if eval $compile; then
10885 if ./try >/dev/null 2>&1; then
10886 echo "POSIX sigsetjmp found." >&4
10887 val="$define"
10888 else
10889 $cat >&4 <<EOM
10890Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10891I'll ignore them.
10892EOM
10893 val="$undef"
a0d0e21e 10894 fi
921b2963
JH
10895 else
10896 echo "sigsetjmp not found." >&4
10897 val="$undef"
a0d0e21e 10898 fi
921b2963
JH
10899 ;;
10900*) val="$d_sigsetjmp"
10901 case "$d_sigsetjmp" in
10902 $define) echo "POSIX sigsetjmp found." >&4;;
10903 $undef) echo "sigsetjmp not found." >&4;;
10904 esac
10905 ;;
10906esac
10907set d_sigsetjmp
10908eval $setvar
10909$rm -f try.c try
2304df62 10910
d9b3e12d
JH
10911: see if sys/stat.h is available
10912set sys/stat.h i_sysstat
10913eval $inhdr
10914
b7b35fc2 10915
2304df62
AD
10916: see if stat knows about block sizes
10917echo " "
b7b35fc2 10918echo "Checking to see if your struct stat has st_blocks field..." >&4
5ff3f7a4
GS
10919set d_statblks stat st_blocks $i_sysstat sys/stat.h
10920eval $hasfield
2304df62 10921
b7b35fc2 10922
ad27e871
JH
10923: see if this is a sys/vfs.h system
10924set sys/vfs.h i_sysvfs
10925eval $inhdr
10926
b7b35fc2 10927
ad27e871
JH
10928: see if this is a sys/statfs.h system
10929set sys/statfs.h i_sysstatfs
10930eval $inhdr
10931
10932
10933echo " "
8175356b 10934echo "Checking to see if your system supports struct statfs..." >&4
ad27e871
JH
10935set 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
10936eval $hasstruct
10937case "$d_statfs_s" in
a22e52b9
JH
10938"$define") echo "Yes, it does." ;;
10939*) echo "No, it doesn't." ;;
ad27e871
JH
10940esac
10941
10942
10943
10944: see if struct statfs knows about f_flags
10945case "$d_statfs_s" in
10946define)
10947 echo " "
8175356b 10948 echo "Checking to see if your struct statfs has f_flags field..." >&4
ad27e871
JH
10949 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
10950 eval $hasfield
10951 ;;
10952*) val="$undef"
10953 set d_statfs_f_flags
10954 eval $setvar
10955 ;;
10956esac
10957case "$d_statfs_f_flags" in
a22e52b9
JH
10958"$define") echo "Yes, it does." ;;
10959*) echo "No, it doesn't." ;;
ad27e871
JH
10960esac
10961
16d20bd9
AD
10962: see if _ptr and _cnt from stdio act std
10963echo " "
dca663ed 10964if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
10965 echo "(Looks like you have stdio.h from Linux.)"
10966 case "$stdio_ptr" in
c2960299
AD
10967 '') stdio_ptr='((fp)->_IO_read_ptr)'
10968 ptr_lval=$define
10969 ;;
8e07c86e 10970 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10971 esac
10972 case "$stdio_cnt" in
c2960299
AD
10973 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10974 cnt_lval=$undef
10975 ;;
8e07c86e 10976 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10977 esac
10978 case "$stdio_base" in
10979 '') stdio_base='((fp)->_IO_read_base)';;
10980 esac
10981 case "$stdio_bufsiz" in
c2960299 10982 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
10983 esac
10984else
10985 case "$stdio_ptr" in
c2960299
AD
10986 '') stdio_ptr='((fp)->_ptr)'
10987 ptr_lval=$define
10988 ;;
8e07c86e 10989 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10990 esac
10991 case "$stdio_cnt" in
c2960299
AD
10992 '') stdio_cnt='((fp)->_cnt)'
10993 cnt_lval=$define
10994 ;;
8e07c86e 10995 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10996 esac
10997 case "$stdio_base" in
10998 '') stdio_base='((fp)->_base)';;
10999 esac
11000 case "$stdio_bufsiz" in
11001 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11002 esac
11003fi
11004: test whether _ptr and _cnt really work
11005echo "Checking how std your stdio is..." >&4
11006$cat >try.c <<EOP
11007#include <stdio.h>
11008#define FILE_ptr(fp) $stdio_ptr
11009#define FILE_cnt(fp) $stdio_cnt
d674cd6d 11010int main() {
16d20bd9
AD
11011 FILE *fp = fopen("try.c", "r");
11012 char c = getc(fp);
11013 if (
11014 18 <= FILE_cnt(fp) &&
11015 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11016 )
11017 exit(0);
11018 exit(1);
11019}
11020EOP
11021val="$undef"
dfe9444c
AD
11022set try
11023if eval $compile; then
16d20bd9
AD
11024 if ./try; then
11025 echo "Your stdio acts pretty std."
11026 val="$define"
11027 else
11028 echo "Your stdio isn't very std."
11029 fi
11030else
11031 echo "Your stdio doesn't appear very std."
11032fi
11033$rm -f try.c try
11034set d_stdstdio
11035eval $setvar
11036
8e07c86e 11037: Can _ptr be used as an lvalue?
e50aee73
AD
11038case "$d_stdstdio$ptr_lval" in
11039$define$define) val=$define ;;
c2960299
AD
11040*) val=$undef ;;
11041esac
11042set d_stdio_ptr_lval
11043eval $setvar
11044
8e07c86e 11045: Can _cnt be used as an lvalue?
e50aee73
AD
11046case "$d_stdstdio$cnt_lval" in
11047$define$define) val=$define ;;
c2960299
AD
11048*) val=$undef ;;
11049esac
11050set d_stdio_cnt_lval
11051eval $setvar
11052
16d20bd9
AD
11053: see if _base is also standard
11054val="$undef"
11055case "$d_stdstdio" in
11056$define)
11057 $cat >try.c <<EOP
11058#include <stdio.h>
11059#define FILE_base(fp) $stdio_base
11060#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 11061int main() {
16d20bd9
AD
11062 FILE *fp = fopen("try.c", "r");
11063 char c = getc(fp);
11064 if (
11065 19 <= FILE_bufsiz(fp) &&
11066 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11067 )
11068 exit(0);
11069 exit(1);
11070}
11071EOP
dfe9444c
AD
11072 set try
11073 if eval $compile; then
16d20bd9 11074 if ./try; then
8ff267be 11075 echo "And its _base field acts std."
16d20bd9
AD
11076 val="$define"
11077 else
11078 echo "But its _base field isn't std."
11079 fi
11080 else
11081 echo "However, it seems to be lacking the _base field."
11082 fi
11083 $rm -f try.c try
11084 ;;
11085esac
11086set d_stdiobase
11087eval $setvar
11088
ed39a0f2
JH
11089$cat >&4 <<EOM
11090Checking how to access stdio streams by file descriptor number...
11091EOM
11092case "$stdio_stream_array" in
11093'') $cat >try.c <<EOCP
11094#include <stdio.h>
11095int main() {
11096 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11097 printf("yes\n");
11098}
11099EOCP
11100 for s in _iob __iob __sF
11101 do
11102 set try -DSTDIO_STREAM_ARRAY=$s
11103 if eval $compile; then
11104 case "`./try$exe_ext`" in
11105 yes) stdio_stream_array=$s; break ;;
11106 esac
11107 fi
11108 done
11109 $rm -f try.* try$exe_ext
11110esac
11111case "$stdio_stream_array" in
11112'') $cat >&4 <<EOM
11113I can't figure out how to access stdio streams by file descriptor number.
11114EOM
11115 d_stdio_stream_array="$undef"
11116 ;;
11117*) $cat >&4 <<EOM
11118You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11119EOM
11120 d_stdio_stream_array="$define"
11121 ;;
11122esac
11123
a0d0e21e
LW
11124: see if strcoll exists
11125set strcoll d_strcoll
11126eval $inlibc
2304df62
AD
11127
11128: check for structure copying
11129echo " "
11130echo "Checking to see if your C compiler can copy structs..." >&4
11131$cat >try.c <<'EOCP'
5a411a32 11132int main()
2304df62
AD
11133{
11134 struct blurfl {
11135 int dyick;
11136 } foo, bar;
11137
11138 foo = bar;
11139}
11140EOCP
11141if $cc -c try.c >/dev/null 2>&1 ; then
11142 val="$define"
11143 echo "Yup, it can."
11144else
11145 val="$undef"
11146 echo "Nope, it can't."
11147fi
11148set d_strctcpy
11149eval $setvar
11150$rm -f try.*
11151
11152: see if strerror and/or sys_errlist[] exist
11153echo " "
28e8609d
JH
11154if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11155 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
11156 echo 'strerror() found.' >&4
11157 d_strerror="$define"
11158 d_strerrm='strerror(e)'
11159 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11160 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11161 d_syserrlst="$define"
11162 else
11163 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11164 d_syserrlst="$undef"
11165 fi
28e8609d 11166 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
11167 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11168 echo 'strerror() found in string header.' >&4
11169 d_strerror="$define"
11170 d_strerrm='strerror(e)'
11171 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11172 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11173 d_syserrlst="$define"
11174 else
11175 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11176 d_syserrlst="$undef"
11177 fi
28e8609d 11178 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
11179 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11180 d_strerror="$undef"
11181 d_syserrlst="$define"
11182 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 11183 else
5ff3f7a4
GS
11184 echo 'strerror() and sys_errlist[] NOT found.' >&4
11185 d_strerror="$undef"
11186 d_syserrlst="$undef"
11187 d_strerrm='"unknown"'
28e8609d 11188 fi
2304df62
AD
11189fi
11190
a89d8a78
DH
11191: see if strtod exists
11192set strtod d_strtod
11193eval $inlibc
11194
11195: see if strtol exists
11196set strtol d_strtol
11197eval $inlibc
11198
ff935051
JH
11199: see if strtold exists
11200set strtold d_strtold
11201eval $inlibc
11202
76d49b1c
JH
11203: see if strtoll exists
11204set strtoll d_strtoll
11205eval $inlibc
11206
a89d8a78
DH
11207: see if strtoul exists
11208set strtoul d_strtoul
11209eval $inlibc
11210
cf2093f6
JH
11211: see if strtoull exists
11212set strtoull d_strtoull
11213eval $inlibc
11214
ff935051
JH
11215: see if strtouq exists
11216set strtouq d_strtouq
11217eval $inlibc
11218
a0d0e21e
LW
11219: see if strxfrm exists
11220set strxfrm d_strxfrm
11221eval $inlibc
11222
8175356b
JH
11223: see if symlink exists
11224set symlink d_symlink
11225eval $inlibc
11226
11227: see if syscall exists
11228set syscall d_syscall
11229eval $inlibc
11230
11231: see if sysconf exists
11232set sysconf d_sysconf
11233eval $inlibc
11234
11235: see if system exists
11236set system d_system
11237eval $inlibc
11238
11239: see if tcgetpgrp exists
11240set tcgetpgrp d_tcgetpgrp
11241eval $inlibc
11242
11243: see if tcsetpgrp exists
11244set tcsetpgrp d_tcsetpgrp
11245eval $inlibc
11246
11247: see if prototype for telldir is available
11248echo " "
11249set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11250eval $hasproto
dc45a647 11251
2c7991dc 11252: see if this is a sys/times.h system
11253set sys/times.h i_systimes
11254eval $inhdr
4633a7c4 11255
2c7991dc 11256: see if times exists
4633a7c4 11257echo " "
2c7991dc 11258if set times val -f d_times; eval $csym; $val; then
11259 echo 'times() found.' >&4
11260 d_times="$define"
11261 inc=''
11262 case "$i_systimes" in
11263 "$define") inc='sys/times.h';;
11264 esac
dc45a647 11265 rp="What is the type returned by times() on this system?"
2c7991dc 11266 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 11267 eval $typedef_ask
2c7991dc 11268else
11269 echo 'times() NOT found, hope that will do.' >&4
11270 d_times="$undef"
11271 clocktype='int'
11272fi
2304df62 11273
2c7991dc 11274: see if truncate exists
11275set truncate d_truncate
11276eval $inlibc
2304df62 11277
2c7991dc 11278: see if tzname[] exists
11279echo " "
11280if set tzname val -a d_tzname; eval $csym; $val; then
11281 val="$define"
11282 echo 'tzname[] found.' >&4
11283else
11284 val="$undef"
11285 echo 'tzname[] NOT found.' >&4
11286fi
11287set d_tzname
11288eval $setvar
11289
11290: see if umask exists
11291set umask d_umask
11292eval $inlibc
85e6fe83 11293
0545a864
JH
11294: see if ustat exists
11295set ustat d_ustat
11296eval $inlibc
11297
4633a7c4
LW
11298: backward compatibility for d_hvfork
11299if test X$d_hvfork != X; then
11300 d_vfork="$d_hvfork"
11301 d_hvfork=''
11302fi
11303: see if there is a vfork
11304val=''
11305set vfork val
11306eval $inlibc
ecfc5424 11307
4633a7c4
LW
11308: Ok, but do we want to use it. vfork is reportedly unreliable in
11309: perl on Solaris 2.x, and probably elsewhere.
11310case "$val" in
11311$define)
16d20bd9 11312 echo " "
4633a7c4
LW
11313 case "$usevfork" in
11314 false) dflt='n';;
11315 *) dflt='y';;
11316 esac
f10488a3
JH
11317 cat <<'EOM'
11318
11319Perl can only use a vfork() that doesn't suffer from strict
11320restrictions on calling functions or modifying global data in
11321the child. For example, glibc-2.1 contains such a vfork()
11322that is unsuitable. If your system provides a proper fork()
11323call, chances are that you do NOT want perl to use vfork().
11324
11325EOM
11326 rp="Do you still want to use vfork()?"
4633a7c4
LW
11327 . ./myread
11328 case "$ans" in
11329 y|Y) ;;
11330 *)
11331 echo "Ok, we won't use vfork()."
11332 val="$undef"
11333 ;;
11334 esac
ecfc5424
AD
11335 ;;
11336esac
4633a7c4
LW
11337set d_vfork
11338eval $setvar
11339case "$d_vfork" in
11340$define) usevfork='true';;
11341*) usevfork='false';;
11342esac
ecfc5424 11343
4633a7c4
LW
11344: see if this is an sysdir system
11345set sys/dir.h i_sysdir
11346eval $inhdr
11347
11348: see if this is an sysndir system
11349set sys/ndir.h i_sysndir
11350eval $inhdr
11351
11352: see if closedir exists
11353set closedir d_closedir
11354eval $inlibc
11355
11356case "$d_closedir" in
11357"$define")
16d20bd9 11358 echo " "
4633a7c4
LW
11359 echo "Checking whether closedir() returns a status..." >&4
11360 cat > closedir.c <<EOM
11361#$i_dirent I_DIRENT /**/
11362#$i_sysdir I_SYS_DIR /**/
11363#$i_sysndir I_SYS_NDIR /**/
bfb7748a 11364#$i_systypes I_SYS_TYPES /**/
4633a7c4 11365
bfb7748a
AD
11366#if defined(I_SYS_TYPES)
11367#include <sys/types.h>
11368#endif
4633a7c4
LW
11369#if defined(I_DIRENT)
11370#include <dirent.h>
11371#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11372#include <sys/dir.h>
4aa0a1f7 11373#endif
4633a7c4
LW
11374#else
11375#ifdef I_SYS_NDIR
11376#include <sys/ndir.h>
11377#else
11378#ifdef I_SYS_DIR
11379#ifdef hp9000s500
11380#include <ndir.h> /* may be wrong in the future */
11381#else
11382#include <sys/dir.h>
11383#endif
11384#endif
11385#endif
11386#endif
11387int main() { return closedir(opendir(".")); }
11388EOM
dfe9444c 11389 set closedir
dc45a647 11390 if eval $compile_ok; then
4633a7c4
LW
11391 if ./closedir > /dev/null 2>&1 ; then
11392 echo "Yes, it does."
11393 val="$undef"
ecfc5424 11394 else
4633a7c4
LW
11395 echo "No, it doesn't."
11396 val="$define"
ecfc5424
AD
11397 fi
11398 else
4633a7c4
LW
11399 echo "(I can't seem to compile the test program--assuming it doesn't)"
11400 val="$define"
ecfc5424 11401 fi
ecfc5424 11402 ;;
4633a7c4
LW
11403*)
11404 val="$undef";
ecfc5424
AD
11405 ;;
11406esac
4633a7c4
LW
11407set d_void_closedir
11408eval $setvar
11409$rm -f closedir*
11410: check for volatile keyword
ecfc5424 11411echo " "
4633a7c4
LW
11412echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11413$cat >try.c <<'EOCP'
5a411a32 11414int main()
4633a7c4
LW
11415{
11416 typedef struct _goo_struct goo_struct;
11417 goo_struct * volatile goo = ((goo_struct *)0);
11418 struct _goo_struct {
11419 long long_int;
11420 int reg_int;
11421 char char_var;
11422 };
11423 typedef unsigned short foo_t;
11424 char *volatile foo;
11425 volatile int bar;
11426 volatile foo_t blech;
11427 foo = foo;
a0d0e21e
LW
11428}
11429EOCP
4633a7c4
LW
11430if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11431 val="$define"
11432 echo "Yup, it does."
11433else
11434 val="$undef"
11435 echo "Nope, it doesn't."
11436fi
11437set d_volatile
11438eval $setvar
11439$rm -f try.*
a0d0e21e 11440
4633a7c4
LW
11441: see if there is a wait4
11442set wait4 d_wait4
8e07c86e
AD
11443eval $inlibc
11444
4633a7c4
LW
11445: see if waitpid exists
11446set waitpid d_waitpid
11447eval $inlibc
11448
11449: see if wcstombs exists
11450set wcstombs d_wcstombs
11451eval $inlibc
11452
11453: see if wctomb exists
11454set wctomb d_wctomb
11455eval $inlibc
11456
11457: preserve RCS keywords in files with variable substitution, grrr
11458Date='$Date'
11459Id='$Id'
11460Log='$Log'
11461RCSfile='$RCSfile'
11462Revision='$Revision'
11463
ca8cfa54
JH
11464case "$crosscompile" in
11465''|[nN]*) crosscompile="$undef" ;;
11466esac
11467
11468case "$osname" in
8f1f23e8 11469next|rhapsody) multiarch="$define" ;;
ca8cfa54
JH
11470esac
11471case "$multiarch" in
11472''|[nN]*) multiarch="$undef" ;;
11473esac
11474
4633a7c4
LW
11475: check for alignment requirements
11476echo " "
68c15b6f
HM
11477case "$crosscompile$multiarch" in
11478*$define*)
ca8cfa54
JH
11479 $cat <<EOM
11480You seem to be either cross-compiling or doing a multiarchitecture build,
11481skipping the memory alignment check.
68c15b6f
HM
11482
11483EOM
11484 case "$alignbytes" in
11485 '') alignbytes=8 ;;
11486 esac
11487 ;;
11488*)
11489 case "$alignbytes" in
11490 '') echo "Checking alignment constraints..." >&4
11491 $cat >try.c <<'EOCP'
14e4fe40 11492#include <stdio.h>
4633a7c4
LW
11493struct foobar {
11494 char foo;
11495 double bar;
732c9516 11496} try_algn;
d674cd6d 11497int main()
4633a7c4 11498{
213c275f
JH
11499 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11500 return(0);
4633a7c4
LW
11501}
11502EOCP
68c15b6f
HM
11503 set try
11504 if eval $compile_ok; then
11505 dflt=`./try`
11506 else
11507 dflt='8'
11508 echo "(I can't seem to compile the test program...)"
11509 fi
11510 ;;
11511 *) dflt="$alignbytes"
11512 ;;
11513 esac
11514 rp="Doubles must be aligned on a how-many-byte boundary?"
11515 . ./myread
11516 alignbytes="$ans"
11517 $rm -f try.c try
8e07c86e 11518 ;;
ecfc5424 11519esac
68c15b6f 11520
85e6fe83 11521
4633a7c4 11522: check for ordering of bytes in a long
68c15b6f
HM
11523echo " "
11524case "$crosscompile$multiarch" in
11525*$define*)
11526 $cat <<EOM
ca8cfa54
JH
11527You seem to be either cross-compiling or doing a multiarchitecture build,
11528skipping the byteorder check.
68c15b6f
HM
11529
11530EOM
d9b3e12d 11531 byteorder='0xffff'
68c15b6f
HM
11532 ;;
11533*)
11534 case "$byteorder" in
11535 '')
11536 $cat <<'EOM'
4633a7c4
LW
11537In the following, larger digits indicate more significance. A big-endian
11538machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11539little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
d9b3e12d
JH
11540machines may have weird orders like 3412. A Cray will report 87654321,
11541an Alpha will report 12345678. If the test program works the default is
11542probably right.
4633a7c4
LW
11543I'm now running the test program...
11544EOM
68c15b6f 11545 $cat >try.c <<'EOCP'
4633a7c4 11546#include <stdio.h>
d674cd6d 11547int main()
4633a7c4
LW
11548{
11549 int i;
11550 union {
11551 unsigned long l;
11552 char c[sizeof(long)];
11553 } u;
11554
11555 if (sizeof(long) > 4)
11556 u.l = (0x08070605L << 32) | 0x04030201L;
11557 else
11558 u.l = 0x04030201L;
11559 for (i = 0; i < sizeof(long); i++)
11560 printf("%c", u.c[i]+'0');
11561 printf("\n");
11562 exit(0);
11563}
11564EOCP
68c15b6f
HM
11565 xxx_prompt=y
11566 set try
11567 if eval $compile && ./try > /dev/null; then
11568 dflt=`./try`
11569 case "$dflt" in
11570 [1-4][1-4][1-4][1-4]|12345678|87654321)
11571 echo "(The test program ran ok.)"
11572 echo "byteorder=$dflt"
11573 xxx_prompt=n
4633a7c4 11574 ;;
68c15b6f
HM
11575 ????|????????) echo "(The test program ran ok.)" ;;
11576 *) echo "(The test program didn't run right for some reason.)" ;;
11577 esac
11578 else
11579 dflt='4321'
11580 cat <<'EOM'
4633a7c4
LW
11581(I can't seem to compile the test program. Guessing big-endian...)
11582EOM
68c15b6f
HM
11583 fi
11584 case "$xxx_prompt" in
11585 y)
11586 rp="What is the order of bytes in a long?"
11587 . ./myread
11588 byteorder="$ans"
11589 ;;
11590 *) byteorder=$dflt
11591 ;;
11592 esac
ecfc5424
AD
11593 ;;
11594 esac
68c15b6f 11595 $rm -f try.c try
ecfc5424
AD
11596 ;;
11597esac
68c15b6f 11598
85e6fe83 11599
4633a7c4 11600: how do we catenate cpp tokens here?
2304df62 11601echo " "
4633a7c4
LW
11602echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11603$cat >cpp_stuff.c <<'EOCP'
11604#define RCAT(a,b)a/**/b
11605#define ACAT(a,b)a ## b
11606RCAT(Rei,ser)
11607ACAT(Cir,cus)
11608EOCP
11609$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11610if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11611 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
11612 echo "We can catify or stringify, separately or together!"
11613 cpp_stuff=42
11614elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11615 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
11616 echo "However, in the good old days we don't know how to stringify and"
11617 echo "catify at the same time."
11618 cpp_stuff=1
11619else
11620 $cat >&4 <<EOM
11621Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
11622to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 11623EOM
4633a7c4
LW
11624 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11625fi
11626$rm -f cpp_stuff.*
a0d0e21e 11627
4633a7c4
LW
11628: see if this is a db.h system
11629set db.h i_db
11630eval $inhdr
11631
11632case "$i_db" in
68dc0745 11633$define)
1f70e1ea 11634 : Check db version.
68dc0745 11635 echo " "
11636 echo "Checking Berkeley DB version ..." >&4
11637 $cat >try.c <<EOCP
11638#$d_const HASCONST
11639#ifndef HASCONST
11640#define const
11641#endif
11642#include <sys/types.h>
11643#include <stdio.h>
11644#include <db.h>
d674cd6d 11645int main()
68dc0745 11646{
1f70e1ea
PM
11647#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11648 int Major, Minor, Patch ;
ee02776e 11649 unsigned long Version ;
1f70e1ea
PM
11650 (void)db_version(&Major, &Minor, &Patch) ;
11651 printf("You have Berkeley DB Version 2 or greater\n");
11652
11653 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11654 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11655 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11656 Major, Minor, Patch) ;
11657
11658 /* check that db.h & libdb are compatible */
11659 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11660 printf("db.h and libdb are incompatible\n") ;
11661 exit(3);
11662 }
11663
11664 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
11665
11666 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 11667 + DB_VERSION_PATCH ;
ee02776e
PM
11668
11669 /* needs to be >= 2.3.4 */
11670 if (Version < 2003004) {
693762b4 11671 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 11672 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
11673 exit(2);
11674 }
11675
11676 exit(0);
68dc0745 11677#else
6a1b87e5 11678#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 11679 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
11680 exit(0); /* DB version < 2: the coast is clear. */
11681#else
11682 exit(1); /* <db.h> not Berkeley DB? */
11683#endif
68dc0745 11684#endif
11685}
11686EOCP
dfe9444c 11687 set try
cf21f3c6 11688 if eval $compile_ok && ./try; then
1f70e1ea 11689 echo 'Looks OK.' >&4
68dc0745 11690 else
c90c0ff4 11691 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 11692 i_db=$undef
11693 case " $libs " in
11694 *"-ldb "*)
11695 : Remove db from list of libraries to use
11696 echo "Removing unusable -ldb from library list" >&4
11697 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11698 shift
11699 libs="$*"
11700 echo "libs = $libs" >&4
11701 ;;
11702 esac
11703 fi
11704 $rm -f try.*
11705 ;;
11706esac
11707
11708case "$i_db" in
4633a7c4 11709define)
dc45a647
MB
11710 : Check the return type needed for hash
11711 echo " "
11712 echo "Checking return type needed for hash for Berkeley DB ..." >&4
11713 $cat >try.c <<EOCP
11714#$d_const HASCONST
11715#ifndef HASCONST
11716#define const
11717#endif
11718#include <sys/types.h>
11719#include <db.h>
11720
11721#ifndef DB_VERSION_MAJOR
11722u_int32_t hash_cb (ptr, size)
11723const void *ptr;
11724size_t size;
11725{
11726}
11727HASHINFO info;
d674cd6d 11728int main()
dc45a647
MB
11729{
11730 info.hash = hash_cb;
11731}
11732#endif
11733EOCP
11734 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11735 if $contains warning try.out >>/dev/null 2>&1 ; then
11736 db_hashtype='int'
11737 else
11738 db_hashtype='u_int32_t'
11739 fi
11740 else
11741 : XXX Maybe we should just give up here.
11742 db_hashtype=u_int32_t
11743 $cat try.out >&4
11744 echo "Help: I can't seem to compile the db test program." >&4
11745 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11746 fi
11747 $rm -f try.*
11748 echo "Your version of Berkeley DB uses $db_hashtype for hash."
11749 ;;
11750*) db_hashtype=u_int32_t
11751 ;;
11752esac
11753case "$i_db" in
11754define)
4633a7c4
LW
11755 : Check the return type needed for prefix
11756 echo " "
11757 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11758 cat >try.c <<EOCP
11759#$d_const HASCONST
11760#ifndef HASCONST
11761#define const
11762#endif
11763#include <sys/types.h>
11764#include <db.h>
1f70e1ea
PM
11765
11766#ifndef DB_VERSION_MAJOR
4633a7c4
LW
11767size_t prefix_cb (key1, key2)
11768const DBT *key1;
11769const DBT *key2;
11770{
11771}
11772BTREEINFO info;
d674cd6d 11773int main()
4633a7c4
LW
11774{
11775 info.prefix = prefix_cb;
11776}
1f70e1ea 11777#endif
4633a7c4
LW
11778EOCP
11779 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11780 if $contains warning try.out >>/dev/null 2>&1 ; then
11781 db_prefixtype='int'
11782 else
11783 db_prefixtype='size_t'
11784 fi
11785 else
68dc0745 11786 db_prefixtype='size_t'
11787 : XXX Maybe we should just give up here.
dc45a647 11788 $cat try.out >&4
68dc0745 11789 echo "Help: I can't seem to compile the db test program." >&4
11790 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
11791 fi
11792 $rm -f try.*
11793 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 11794 ;;
68dc0745 11795*) db_prefixtype='size_t'
4633a7c4
LW
11796 ;;
11797esac
a0d0e21e 11798
4633a7c4
LW
11799: check for void type
11800echo " "
11801echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
11802case "$voidflags" in
11803'')
11804 $cat >try.c <<'EOCP'
11805#if TRY & 1
760ac839 11806void sub() {
4633a7c4 11807#else
760ac839 11808sub() {
4633a7c4
LW
11809#endif
11810 extern void moo(); /* function returning void */
11811 void (*goo)(); /* ptr to func returning void */
11812#if TRY & 8
11813 void *hue; /* generic ptr */
11814#endif
11815#if TRY & 2
11816 void (*foo[10])();
11817#endif
a0d0e21e 11818
4633a7c4
LW
11819#if TRY & 4
11820 if(goo == moo) {
11821 exit(0);
11822 }
11823#endif
11824 exit(0);
11825}
d674cd6d 11826int main() { sub(); }
4633a7c4 11827EOCP
760ac839 11828 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 11829 voidflags=$defvoidused
bfb7748a 11830 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
11831 if $contains warning .out >/dev/null 2>&1; then
11832 echo "However, you might get some warnings that look like this:"
11833 $cat .out
11834 fi
11835 else
11836echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 11837 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 11838 echo "It supports 1..."
760ac839 11839 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 11840 echo "It also supports 2..."
760ac839 11841 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
11842 voidflags=7
11843 echo "And it supports 4 but not 8 definitely."
11844 else
11845 echo "It doesn't support 4..."
760ac839 11846 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
11847 voidflags=11
11848 echo "But it supports 8."
11849 else
11850 voidflags=3
11851 echo "Neither does it support 8."
11852 fi
11853 fi
11854 else
11855 echo "It does not support 2..."
760ac839 11856 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
11857 voidflags=13
11858 echo "But it supports 4 and 8."
11859 else
760ac839 11860 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
11861 voidflags=5
11862 echo "And it supports 4 but has not heard about 8."
11863 else
11864 echo "However it supports 8 but not 4."
11865 fi
11866 fi
11867 fi
11868 else
11869 echo "There is no support at all for void."
11870 voidflags=0
11871 fi
11872 fi
11873esac
4633a7c4 11874case "$voidflags" in
2c7991dc 11875"$defvoidused") ;;
bfb7748a
AD
11876*) $cat >&4 <<'EOM'
11877 Support flag bits are:
11878 1: basic void declarations.
11879 2: arrays of pointers to functions returning void.
11880 4: operations between pointers to and addresses of void functions.
11881 8: generic void pointers.
11882EOM
2c7991dc 11883 dflt="$voidflags";
4633a7c4 11884 rp="Your void support flags add up to what?"
a0d0e21e 11885 . ./myread
4633a7c4 11886 voidflags="$ans"
a0d0e21e
LW
11887 ;;
11888esac
4633a7c4 11889$rm -f try.* .out
a0d0e21e 11890
85ab1d1d
JH
11891
11892: How can we generate normalized random numbers ?
693762b4 11893echo " "
de4597cb 11894echo "Looking for a random number function..." >&4
85ab1d1d 11895case "$randfunc" in
693762b4 11896'')
85ab1d1d
JH
11897 if set drand48 val -f; eval $csym; $val; then
11898 dflt="drand48"
11899 echo "Good, found drand48()." >&4
11900 elif set random val -f; eval $csym; $val; then
11901 dflt="random"
11902 echo "OK, found random()." >&4
11903 else
11904 dflt="rand"
11905 echo "Yick, looks like I have to use rand()." >&4
11906 fi
11907 echo " "
11908 ;;
11909*)
11910 dflt="$randfunc"
11911 ;;
11912esac
11913cont=true
11914
11915case "$ccflags" in
11916*-Dmy_rand=*|*-Dmy_srand=*)
11917 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11918 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11919 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11920 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11921 ;;
11922esac
11923
11924while $test "$cont"; do
11925 rp="Use which function to generate random numbers?"
11926 . ./myread
11927 if $test "$ans" = "$dflt"; then
11928 : null
11929 else
11930 randbits=''
11931 fi
11932 randfunc="$ans"
11933 if set $ans val -f; eval $csym; $val; then
11934 cont=''
11935 else
ef4af2be
JH
11936 dflt=y
11937 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
11938 . ./myread
11939 dflt=rand
11940 case "$ans" in
11941 [yY]*) cont='';;
11942 esac
11943 fi
11944 case "$cont" in
11945 '')
11946 case "$randfunc" in
11947 drand48)
11948 drand01="drand48()"
11949 seedfunc="srand48"
11950 randbits=48
11951 randseedtype=long
11952 ;;
11953 rand|random)
11954 case "$randbits" in
11955 '')
11956echo "Checking to see how many bits your $randfunc() function produces..." >&4
11957 $cat >try.c <<EOCP
11958#$i_unistd I_UNISTD
11959#$i_stdlib I_STDLIB
693762b4 11960#include <stdio.h>
85ab1d1d
JH
11961#ifdef I_UNISTD
11962# include <unistd.h>
11963#endif
11964#ifdef I_STDLIB
11965# include <stdlib.h>
11966#endif
d674cd6d 11967int main()
693762b4 11968{
85ab1d1d
JH
11969 register int i;
11970 register unsigned long tmp;
11971 register unsigned long max = 0L;
11972
11973 for (i = 1000; i; i--) {
11974 tmp = (unsigned long) $randfunc();
11975 if (tmp > max) max = tmp;
11976 }
11977 for (i = 0; max; i++)
11978 max /= 2;
11979 printf("%d\n",i);
693762b4
AD
11980}
11981EOCP
85ab1d1d
JH
11982 set try
11983 if eval $compile_ok; then
11984 dflt=`try`
11985 else
11986 dflt='?'
11987 echo "(I can't seem to compile the test program...)"
11988 fi
11989 ;;
11990 *)
11991 dflt="$randbits"
11992 ;;
11993 esac
11994 rp="How many bits does your $randfunc() function produce?"
11995 . ./myread
11996 randbits="$ans"
11997 $rm -f try.c try
11998 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11999 seedfunc="s$randfunc"
12000 randseedtype=unsigned
12001 ;;
12002 *)
12003 dflt="31"
12004 rp="How many bits does your $randfunc() function produce?"
12005 . ./myread
12006 randbits="$ans"
12007 seedfunc="s$randfunc"
12008 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12009 if set $seedfunc val -f; eval $csym; $val; then
12010 echo "(Using $seedfunc() to seed random generator)"
12011 else
12012 echo "(Warning: no $seedfunc() to seed random generator)"
12013 seedfunc=rand
12014 fi
12015 randseedtype=unsigned
12016 ;;
12017 esac
12018 ;;
12019 esac
12020done
693762b4 12021
5ff3f7a4
GS
12022echo " "
12023echo "Determining whether or not we are on an EBCDIC system..." >&4
12024$cat >tebcdic.c <<'EOM'
12025int main()
12026{
12027 if ('M'==0xd4) return 0;
12028 return 1;
12029}
12030EOM
12031
12032val=$undef
12033set tebcdic
12034if eval $compile_ok; then
12035 if ./tebcdic; then
12036 echo "You have EBCDIC." >&4
12037 val="$define"
12038 else
57def98f 12039 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
5ff3f7a4
GS
12040 fi
12041else
5cc3184f 12042 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
12043 echo "I'll assume ASCII or some ISO Latin." >&4
12044fi
12045$rm -f tebcdic.c tebcdic
12046set ebcdic
12047eval $setvar
12048
29209bc5 12049echo " "
767df6a1
JH
12050$cat >&4 <<EOM
12051Checking how to flush all pending stdio output...
66fe083f 12052EOM
d2201af2
AD
12053# I only know how to find the first 32 possibly open files on SunOS.
12054# See also hints/sunos_4_1.sh and util.c --AD
12055case "$osname" in
12056sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12057esac
12058$cat >>try.c <<EOCP
66fe083f 12059#include <stdio.h>
d2201af2 12060#$i_unistd I_UNISTD
767df6a1 12061#ifdef I_UNISTD
a32a45b6 12062# include <unistd.h>
767df6a1
JH
12063#endif
12064#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
12065#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12066#ifdef HAS_STDIO_STREAM_ARRAY
12067# define STDIO_STREAM_ARRAY $stdio_stream_array
12068#endif
66fe083f
JH
12069int main() {
12070 FILE* p = fopen("try.out", "w");
0f27ced1 12071#ifdef TRY_FPUTC
66fe083f 12072 fputc('x', p);
0f27ced1
JH
12073#else
12074# ifdef TRY_FPRINTF
12075 fprintf(p, "x");
12076# endif
12077#endif
767df6a1 12078#ifdef TRY_FFLUSH_NULL
66fe083f 12079 fflush(NULL);
767df6a1
JH
12080#endif
12081#ifdef TRY_FFLUSH_ALL
12082 {
12083 long open_max = -1;
d2201af2
AD
12084# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12085 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 12086# else
d2201af2
AD
12087# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12088 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 12089# else
4b257aef 12090# ifdef FOPEN_MAX
d2201af2 12091 open_max = FOPEN_MAX;
767df6a1 12092# else
d2201af2
AD
12093# ifdef OPEN_MAX
12094 open_max = OPEN_MAX;
12095# else
12096# ifdef _NFILE
12097 open_max = _NFILE;
12098# endif
767df6a1
JH
12099# endif
12100# endif
12101# endif
4b257aef 12102# endif
ed39a0f2 12103# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
12104 if (open_max > 0) {
12105 long i;
12106 for (i = 0; i < open_max; i++)
d2201af2
AD
12107 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12108 STDIO_STREAM_ARRAY[i]._file < open_max &&
12109 STDIO_STREAM_ARRAY[i]._flag)
12110 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
12111 }
12112 }
ed39a0f2 12113# endif
767df6a1
JH
12114#endif
12115 _exit(42);
66fe083f
JH
12116}
12117EOCP
0f27ced1
JH
12118: first we have to find out how _not_ to flush
12119if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12120 output=''
12121 set try -DTRY_FPUTC
6626660c 12122 if eval $compile; then
4b257aef 12123 $rm -f try.out
0f27ced1
JH
12124 ./try$exe_ext 2>/dev/null
12125 if $test ! -s try.out -a "X$?" = X42; then
12126 output=-DTRY_FPUTC
12127 fi
12128 fi
12129 case "$output" in
12130 '')
12131 set try -DTRY_FPRINTF
12132 $rm -f try.out
6626660c 12133 if eval $compile; then
4b257aef 12134 $rm -f try.out
0f27ced1
JH
12135 ./try$exe_ext 2>/dev/null
12136 if $test ! -s try.out -a "X$?" = X42; then
12137 output=-DTRY_FPRINTF
12138 fi
12139 fi
12140 ;;
12141 esac
12142fi
767df6a1
JH
12143: check for fflush NULL behaviour
12144case "$fflushNULL" in
0f27ced1 12145'') set try -DTRY_FFLUSH_NULL $output
6626660c 12146 if eval $compile; then
4b257aef 12147 $rm -f try.out
196fa3d2 12148 ./try$exe_ext 2>/dev/null
a32a45b6
JH
12149 code="$?"
12150 if $test -s try.out -a "X$code" = X42; then
c2fddd50 12151 fflushNULL="`$cat try.out`"
a32a45b6
JH
12152 else
12153 if $test "X$code" != X42; then
12154 $cat >&4 <<EOM
12155(If this test failed, don't worry, we'll try another method shortly.)
12156EOM
12157 fi
c2fddd50
JH
12158 fi
12159 fi
0f27ced1 12160 $rm -f core try.core core.try.*
c2fddd50 12161 case "$fflushNULL" in
6626660c 12162 x) $cat >&4 <<EOM
66fe083f
JH
12163Your fflush(NULL) works okay.
12164EOM
ed39a0f2 12165 fflushNULL="$define"
c2fddd50 12166 ;;
6626660c 12167 '') $cat >&4 <<EOM
66fe083f
JH
12168Your fflush(NULL) isn't working (contrary to ANSI C).
12169EOM
ed39a0f2 12170 fflushNULL="$undef"
c2fddd50 12171 ;;
6626660c 12172 *) $cat >&4 <<EOM
66fe083f
JH
12173Cannot figure out whether your fflush(NULL) works or not.
12174I'm assuming it doesn't (contrary to ANSI C).
12175EOM
ed39a0f2 12176 fflushNULL="$undef"
c2fddd50
JH
12177 ;;
12178 esac
66fe083f
JH
12179 ;;
12180$define|true|[yY]*)
ed39a0f2 12181 fflushNULL="$define"
66fe083f
JH
12182 ;;
12183*)
ed39a0f2 12184 fflushNULL="$undef"
66fe083f
JH
12185 ;;
12186esac
a32a45b6
JH
12187: check explicit looping only if NULL did not work
12188case "$fflushNULL" in
12189"$undef")
12190 : check for fflush all behaviour
12191 case "$fflushall" in
12192 '') set try -DTRY_FFLUSH_ALL $output
a32a45b6 12193 if eval $compile; then
4b257aef 12194 $cat >&4 <<EOM
a32a45b6 12195(Now testing the other method--but note that also this may fail.)
a71cd7cd 12196EOM
4b257aef 12197 $rm -f try.out
a32a45b6
JH
12198 ./try$exe_ext 2>/dev/null
12199 if $test -s try.out -a "X$?" = X42; then
12200 fflushall="`$cat try.out`"
12201 fi
767df6a1 12202 fi
a32a45b6
JH
12203 $rm -f core try.core core.try.*
12204 case "$fflushall" in
12205 x) $cat >&4 <<EOM
12206Whew. Flushing explicitly all the stdio streams works.
767df6a1 12207EOM
a32a45b6
JH
12208 fflushall="$define"
12209 ;;
12210 '') $cat >&4 <<EOM
12211Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 12212EOM
a32a45b6
JH
12213 fflushall="$undef"
12214 ;;
12215 *) $cat >&4 <<EOM
6626660c 12216Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
12217I'm assuming it doesn't.
12218EOM
a32a45b6
JH
12219 fflushall="$undef"
12220 ;;
12221 esac
767df6a1 12222 ;;
a32a45b6
JH
12223 "$define"|true|[yY]*)
12224 fflushall="$define"
12225 ;;
12226 *)
12227 fflushall="$undef"
6626660c
JH
12228 ;;
12229 esac
767df6a1 12230 ;;
a32a45b6 12231*) fflushall="$undef"
767df6a1
JH
12232 ;;
12233esac
12234case "$fflushNULL$fflushall" in
12235undefundef)
6626660c 12236 $cat <<EOM
767df6a1
JH
12237I cannot figure out how to flush pending stdio output.
12238EOM
12239 ;;
12240esac
12241$rm -f try.* try$exe_ext
66fe083f 12242
ccc7f9b3
KS
12243: Store the full pathname to the ar program for use in the C program
12244: Respect a hint or command line value for full_ar.
12245case "$full_ar" in
12246'') full_ar=$ar ;;
12247esac
12248
1aef975c
AD
12249: Store the full pathname to the sed program for use in the C program
12250full_sed=$sed
12251
2304df62 12252: see what type gids are declared as in the kernel
dc45a647
MB
12253echo " "
12254echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
12255set gid_t gidtype xxx stdio.h sys/types.h
12256eval $typedef
2304df62 12257case "$gidtype" in
a0d0e21e
LW
12258xxx)
12259 xxx=`./findhdr sys/user.h`
12260 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12261 case $1 in
12262 unsigned) dflt="$1 $2" ;;
12263 *) dflt="$1" ;;
12264 esac
2304df62 12265 ;;
8175356b
JH
12266*) dflt="$gidtype";;
12267esac
12268case "$gidtype" in
12269gid_t) echo "gid_t found." ;;
12270*) rp="What is the type for group ids returned by getgid()?"
12271 . ./myread
12272 gidtype="$ans"
12273 ;;
12274esac
12275
12276echo " "
12277case "$gidtype" in
12278*_t) zzz="$gidtype" ;;
12279*) zzz="gid" ;;
12280esac
a22e52b9 12281echo "Checking the size of $zzz..." >&4
8175356b
JH
12282cat > try.c <<EOCP
12283#include <sys/types.h>
12284#include <stdio.h>
12285int main() {
213c275f 12286 printf("%d\n", (int)sizeof($gidtype));
14e4fe40 12287 exit(0);
8175356b
JH
12288}
12289EOCP
12290set try
a22e52b9 12291if eval $compile_ok; then
8175356b
JH
12292 yyy=`./try`
12293 case "$yyy" in
a22e52b9
JH
12294 '') gidsize=4
12295 echo "(I can't execute the test program--guessing $gidsize.)" >&4
8175356b 12296 ;;
a22e52b9
JH
12297 *) gidsize=$yyy
12298 echo "Your $zzz size is $gidsize bytes."
8175356b
JH
12299 ;;
12300 esac
12301else
a22e52b9
JH
12302 gidsize=4
12303 echo "(I can't compile the test program--guessing $gidsize.)" >&4
8175356b
JH
12304fi
12305
12306
12307echo " "
12308case "$gidtype" in
12309*_t) zzz="$gidtype" ;;
12310*) zzz="gid" ;;
12311esac
a22e52b9 12312echo "Checking the sign of $zzz..." >&4
8175356b
JH
12313cat > try.c <<EOCP
12314#include <sys/types.h>
12315#include <stdio.h>
12316int main() {
a22e52b9
JH
12317 $gidtype foo = -1;
12318 if (foo < 0)
12319 printf("-1\n");
12320 else
12321 printf("1\n");
8175356b
JH
12322}
12323EOCP
12324set try
a22e52b9 12325if eval $compile; then
8175356b
JH
12326 yyy=`./try`
12327 case "$yyy" in
a22e52b9
JH
12328 '') gidsign=1
12329 echo "(I can't execute the test program--guessing unsigned.)" >&4
8175356b 12330 ;;
a22e52b9
JH
12331 *) gidsign=$yyy
12332 case "$gidsign" in
12333 1) echo "Your $zzz is unsigned." ;;
12334 -1) echo "Your $zzz is signed." ;;
12335 esac
8175356b
JH
12336 ;;
12337 esac
12338else
a22e52b9
JH
12339 gidsign=1
12340 echo "(I can't compile the test program--guessing unsigned.)" >&4
8175356b
JH
12341fi
12342
12343
785fb66b 12344echo " "
8175356b
JH
12345
12346if $test X"$quadtype" != X; then
12347
12348echo "Checking how to print 64-bit integers..." >&4
12349
12350if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12351 $cat >try.c <<'EOCP'
785fb66b
JH
12352#include <sys/types.h>
12353#include <stdio.h>
12354int main() {
8175356b
JH
12355 int q = 12345678901;
12356 printf("%ld\n", q);
785fb66b
JH
12357}
12358EOCP
8175356b
JH
12359 set try
12360 if eval $compile; then
12361 yyy=`./try$exe_ext`
12362 case "$yyy" in
12363 12345678901)
12364 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12365 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12366 echo "We will use %d."
12367 ;;
785fb66b 12368 esac
8175356b 12369 fi
785fb66b
JH
12370fi
12371
8175356b
JH
12372if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12373 $cat >try.c <<'EOCP'
12374#include <sys/types.h>
12375#include <stdio.h>
12376int main() {
12377 long q = 12345678901;
12378 printf("%ld\n", q);
12379}
12380EOCP
12381 set try
12382 if eval $compile; then
12383 yyy=`./try$exe_ext`
12384 case "$yyy" in
12385 12345678901)
12386 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12387 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12388 echo "We will use %ld."
12389 ;;
12390 esac
12391 fi
12392fi
785fb66b 12393
8afc5b8d 12394if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
8175356b 12395 $cat >try.c <<'EOCP'
785fb66b 12396#include <sys/types.h>
8175356b 12397#include <inttypes.h>
785fb66b
JH
12398#include <stdio.h>
12399int main() {
8175356b
JH
12400 int64_t q = 12345678901;
12401 printf("%" PRId64 "\n", q);
785fb66b
JH
12402}
12403EOCP
8175356b
JH
12404 set try
12405 if eval $compile; then
12406 yyy=`./try$exe_ext`
12407 case "$yyy" in
12408 12345678901)
12409 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12410 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12411 echo "We will use the C9X style."
12412 ;;
12413 esac
12414 fi
12415fi
12416
12417if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12418 $cat >try.c <<'EOCP'
12419#include <sys/types.h>
12420#include <stdio.h>
12421int main() {
12422 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12423 printf("%lld\n", q);
12424}
12425EOCP
12426 set try
12427 if eval $compile; then
12428 yyy=`./try$exe_ext`
12429 case "$yyy" in
12430 12345678901)
12431 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12432 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12433 echo "We will use the %lld style."
12434 ;;
12435 esac
12436 fi
785fb66b
JH
12437fi
12438
8175356b
JH
12439if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12440 $cat >try.c <<EOCP
12441#include <sys/types.h>
12442#include <stdio.h>
12443int main() {
12444 $quadtype q = 12345678901;
12445 printf("%Ld\n", q);
12446}
12447EOCP
12448 set try
12449 if eval $compile; then
12450 yyy=`./try$exe_ext`
12451 case "$yyy" in
12452 12345678901)
12453 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12454 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12455 echo "We will use %Ld."
12456 ;;
12457 esac
12458 fi
12459fi
785fb66b 12460
8175356b
JH
12461if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12462 $cat >try.c <<EOCP
12463#include <sys/types.h>
12464#include <stdio.h>
12465int main() {
12466 $quadtype q = 12345678901;
12467 printf("%qd\n", q);
12468}
12469EOCP
12470 set try
12471 if eval $compile; then
12472 yyy=`./try$exe_ext`
12473 case "$yyy" in
12474 12345678901)
12475 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12476 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12477 echo "We will use %qd."
12478 ;;
12479 esac
12480 fi
12481fi
2304df62 12482
8175356b
JH
12483if $test X"$sPRId64" = X; then
12484 echo "Cannot figure out how to print 64-bit integers." >&4
12485fi
5cd24f17 12486
8175356b 12487$rm -f try try.*
dfe9444c 12488
8175356b 12489fi
2304df62 12490
8175356b
JH
12491case "$sPRId64" in
12492'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
12493 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
12494 ;;
12495*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
12496 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
a0d0e21e 12497 ;;
2304df62 12498esac
2304df62 12499
2304df62 12500
8ff267be 12501echo " "
8175356b
JH
12502$echo "Checking the format strings to be used for Perl's internal types..." >&4
12503
12504if $test X"$ivsize" = X8; then
12505 ivdformat="$sPRId64"
12506 uvuformat="$sPRIu64"
12507 uvoformat="$sPRIo64"
12508 uvxformat="$sPRIx64"
5ff3f7a4 12509else
8175356b
JH
12510 if $test X"$ivsize" = X"$longsize"; then
12511 ivdformat='"ld"'
12512 uvuformat='"lu"'
12513 uvoformat='"lo"'
12514 uvxformat='"lx"'
12515 else
12516 if $test X"$ivsize" = X"$intsize"; then
12517 ivdformat='"d"'
12518 uvuformat='"u"'
12519 uvoformat='"o"'
12520 uvxformat='"x"'
12521 else
12522 : far out
12523 if $test X"$ivsize" = X"$shortsize"; then
12524 ivdformat='"hd"'
12525 uvuformat='"hu"'
12526 uvoformat='"ho"'
12527 uvxformat='"hx"'
12528 fi
12529 fi
12530 fi
5ff3f7a4 12531fi
8175356b
JH
12532
12533case "$ivdformat" in
12534'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12535 exit 1
12536 ;;
12537esac
5ff3f7a4 12538
a22e52b9
JH
12539
12540echo " "
12541$echo "Checking the format string to be used for gids..." >&4
12542
12543case "$gidsign" in
12544-1) if $test X"$gidsize" = X"$ivsize"; then
12545 gidformat="$ivdformat"
12546 else
12547 if $test X"$gidsize" = X"$longsize"; then
12548 gidformat='"ld"'
12549 else
12550 if $test X"$gidsize" = X"$intsize"; then
12551 gidformat='"d"'
12552 else
12553 if $test X"$gidsize" = X"$shortsize"; then
12554 gidformat='"hd"'
12555 fi
12556 fi
12557 fi
12558 fi
12559 ;;
12560*) if $test X"$gidsize" = X"$uvsize"; then
12561 gidformat="$uvuformat"
12562 else
12563 if $test X"$gidsize" = X"$longsize"; then
12564 gidformat='"lu"'
12565 else
12566 if $test X"$gidsize" = X"$intsize"; then
12567 gidformat='"u"'
12568 else
12569 if $test X"$gidsize" = X"$shortsize"; then
12570 gidformat='"hu"'
12571 fi
12572 fi
12573 fi
12574 fi
12575 ;;
12576esac
12577
12578: see if getgroups exists
12579set getgroups d_getgrps
12580eval $inlibc
12581
12582: see if setgroups exists
12583set setgroups d_setgrps
12584eval $inlibc
12585
12586
12587: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12588echo " "
12589case "$d_getgrps$d_setgrps" in
12590*define*)
12591 case "$groupstype" in
12592 '') dflt="$gidtype" ;;
12593 *) dflt="$groupstype" ;;
12594 esac
12595 $cat <<EOM
12596What type of pointer is the second argument to getgroups() and setgroups()?
12597Usually this is the same as group ids, $gidtype, but not always.
12598
12599EOM
12600 rp='What type pointer is the second argument to getgroups() and setgroups()?'
12601 . ./myread
12602 groupstype="$ans"
12603 ;;
12604*) groupstype="$gidtype";;
12605esac
12606
5ff3f7a4 12607echo " "
dfe9444c 12608echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 12609case "$make_set_make" in
12610'')
12611 $sed 's/^X //' > testmake.mak << 'EOF'
12612Xall:
dfe9444c 12613X @echo 'maketemp="$(MAKE)"'
8ff267be 12614EOF
8ff267be 12615 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 12616 *maketemp=*) make_set_make='#' ;;
8ff267be 12617 *) make_set_make="MAKE=$make" ;;
12618 esac
dfe9444c
AD
12619 $rm -f testmake.mak
12620 ;;
12621esac
12622case "$make_set_make" in
12623'#') echo "Yup, it does.";;
12624*) echo "Nope, it doesn't.";;
12625esac
12626
fe749a9f
JH
12627: see if this is a sys/mman.h system
12628set sys/mman.h i_sysmman
12629eval $inhdr
12630
12631: see if mmap exists
12632set mmap d_mmap
12633eval $inlibc
12634: see what shmat returns
12635: default to something harmless
12636mmaptype='void *'
12637case "$i_sysmman$d_mmap" in
12638"$define$define")
12639 $cat >mmap.c <<'END'
12640#include <sys/mman.h>
12641void *mmap();
12642END
12643 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
12644 mmaptype='void *'
12645 else
12646 mmaptype='caddr_t'
12647 fi
12648 echo "and it returns ($mmaptype)." >&4
12649 ;;
12650esac
12651
12652
12653
dfe9444c 12654: see what type is used for mode_t
dc45a647 12655rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 12656set mode_t modetype int stdio.h sys/types.h
dc45a647 12657eval $typedef_ask
dfe9444c 12658
dfe9444c
AD
12659: define a fucntion to check prototypes
12660$cat > protochk <<EOSH
12661$startsh
12662cc="$cc"
12663optimize="$optimize"
12664ccflags="$ccflags"
12665prototype="$prototype"
12666define="$define"
12667rm=$rm
12668EOSH
12669
12670$cat >> protochk <<'EOSH'
12671
12672$rm -f try.c
12673foo="$1"
12674shift
12675while test $# -ge 2; do
12676 case "$1" in
12677 $define) echo "#include <$2>" >> try.c ;;
12678 literal) echo "$2" >> try.c ;;
12679 esac
12680 shift 2
12681done
12682test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
12683cat >> try.c <<'EOCP'
12684#ifdef CAN_PROTOTYPE
12685#define _(args) args
12686#else
12687#define _(args) ()
12688#endif
12689EOCP
12690echo "$foo" >> try.c
12691echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12692$cc $optimize $ccflags -c try.c > /dev/null 2>&1
12693status=$?
12694$rm -f try.[co]
12695exit $status
12696EOSH
12697chmod +x protochk
12698$eunicefix protochk
12699
dfe9444c 12700: see what type is used for size_t
dc45a647 12701rp="What is the type used for the length parameter for string functions?"
dfe9444c 12702set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 12703eval $typedef_ask
dfe9444c
AD
12704
12705: check for type of arguments to gethostbyaddr.
12706if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12707 case "$d_gethbyaddr" in
12708 $define)
12709 $cat <<EOM
12710
12711Checking to see what type of arguments are accepted by gethostbyaddr().
12712EOM
12713 hdrs="$define sys/types.h
12714 $d_socket sys/socket.h
12715 $i_niin netinet/in.h
12716 $i_netdb netdb.h
12717 $i_unistd unistd.h"
12718 : The first arg can 'char *' or 'void *'
12719 : The second arg is some of integral type
12720 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12721 for yyy in size_t long int; do
12722 case "$netdb_host_type" in
12723 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12724 if ./protochk "$try" $hdrs; then
12725 echo "Your system accepts $xxx for the first arg."
12726 echo "...and $yyy for the second arg."
12727 netdb_host_type="$xxx"
12728 netdb_hlen_type="$yyy"
12729 fi
12730 ;;
12731 esac
12732 done
12733 done
12734 : In case none of those worked, prompt the user.
12735 case "$netdb_host_type" in
12736 '') rp='What is the type for the 1st argument to gethostbyaddr?'
12737 dflt='char *'
12738 . ./myread
12739 netdb_host_type=$ans
12740 rp='What is the type for the 2nd argument to gethostbyaddr?'
12741 dflt="$sizetype"
12742 . ./myread
12743 netdb_hlen_type=$ans
12744 ;;
12745 esac
12746 ;;
12747 *) : no gethostbyaddr, so pick harmless defaults
12748 netdb_host_type='char *'
12749 netdb_hlen_type="$sizetype"
12750 ;;
12751 esac
12752 # Remove the "const" if needed. -- but then we'll have a
12753 # prototype clash!
12754 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12755fi
12756
12757: check for type of argument to gethostbyname.
12758if test "X$netdb_name_type" = X ; then
12759 case "$d_gethbyname" in
12760 $define)
12761 $cat <<EOM
12762
12763Checking to see what type of argument is accepted by gethostbyname().
12764EOM
12765 hdrs="$define sys/types.h
12766 $d_socket sys/socket.h
12767 $i_niin netinet/in.h
12768 $i_netdb netdb.h
12769 $i_unistd unistd.h"
12770 for xxx in "const char *" "char *"; do
12771 case "$netdb_name_type" in
12772 '') try="extern struct hostent *gethostbyname($xxx);"
12773 if ./protochk "$try" $hdrs; then
12774 echo "Your system accepts $xxx."
12775 netdb_name_type="$xxx"
12776 fi
12777 ;;
12778 esac
12779 done
12780 : In case none of those worked, prompt the user.
12781 case "$netdb_name_type" in
12782 '') rp='What is the type for the 1st argument to gethostbyname?'
12783 dflt='char *'
12784 . ./myread
12785 netdb_name_type=$ans
12786 ;;
12787 esac
12788 ;;
12789 *) : no gethostbyname, so pick harmless default
12790 netdb_name_type='char *'
12791 ;;
12792 esac
12793fi
8ff267be 12794
dfe9444c
AD
12795: check for type of 1st argument to getnetbyaddr.
12796if test "X$netdb_net_type" = X ; then
12797 case "$d_getnbyaddr" in
12798 $define)
12799 $cat <<EOM
85e6fe83 12800
dfe9444c
AD
12801Checking to see what type of 1st argument is accepted by getnetbyaddr().
12802EOM
12803 hdrs="$define sys/types.h
12804 $d_socket sys/socket.h
12805 $i_niin netinet/in.h
12806 $i_netdb netdb.h
12807 $i_unistd unistd.h"
12808 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12809 case "$netdb_net_type" in
12810 '') try="extern struct netent *getnetbyaddr($xxx, int);"
12811 if ./protochk "$try" $hdrs; then
12812 echo "Your system accepts $xxx."
12813 netdb_net_type="$xxx"
12814 fi
12815 ;;
12816 esac
12817 done
12818 : In case none of those worked, prompt the user.
12819 case "$netdb_net_type" in
12820 '') rp='What is the type for the 1st argument to getnetbyaddr?'
12821 dflt='long'
12822 . ./myread
12823 netdb_net_type=$ans
12824 ;;
12825 esac
12826 ;;
12827 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 12828 netdb_net_type='long'
dfe9444c
AD
12829 ;;
12830 esac
12831fi
2c7991dc 12832: locate the preferred pager for this system
12833case "$pager" in
12834'')
12835 dflt=''
12836 case "$pg" in
12837 /*) dflt=$pg;;
12838 esac
12839 case "$more" in
12840 /*) dflt=$more;;
12841 esac
12842 case "$less" in
12843 /*) dflt=$less;;
12844 esac
12845 case "$dflt" in
12846 '') dflt=/usr/ucb/more;;
12847 esac
12848 ;;
12849*) dflt="$pager";;
12850esac
12851echo " "
12852fn=f/
12853rp='What pager is used on your system?'
12854. ./getfile
12855pager="$ans"
12856
dfe9444c 12857: see what type pids are declared as in the kernel
dc45a647 12858rp="What is the type of process ids on this system?"
dfe9444c 12859set pid_t pidtype int stdio.h sys/types.h
dc45a647 12860eval $typedef_ask
2304df62 12861
fe749a9f
JH
12862: Find earliest binary compatible site_perl subdirectory perl can use.
12863case "$bincompat5005" in
12864"$define") xs_apiversion='5.005' ;;
12865*) xs_apiversion=$version ;; # The current site_perl version.
12866esac
12867: Find earliest pure perl site_perl subdirectory perl can use.
12868: The versioned directories started at 5.005.
12869pm_apiversion='5.005'
12870
693762b4
AD
12871: check for length of pointer
12872echo " "
12873case "$ptrsize" in
12874'')
dc45a647 12875 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
12876 if test "$voidflags" -gt 7; then
12877 echo '#define VOID_PTR char *' > try.c
12878 else
12879 echo '#define VOID_PTR void *' > try.c
12880 fi
12881 $cat >>try.c <<'EOCP'
12882#include <stdio.h>
d674cd6d 12883int main()
693762b4 12884{
213c275f 12885 printf("%d\n", (int)sizeof(VOID_PTR));
14e4fe40 12886 exit(0);
693762b4
AD
12887}
12888EOCP
12889 set try
dc45a647 12890 if eval $compile_ok; then
693762b4 12891 ptrsize=`./try`
dc45a647 12892 $echo " $ptrsize bytes." >&4
693762b4
AD
12893 else
12894 dflt='4'
12895 echo "(I can't seem to compile the test program. Guessing...)" >&4
12896 rp="What is the size of a pointer (in bytes)?"
12897 . ./myread
12898 ptrsize="$ans"
12899 fi
12900 ;;
12901esac
12902$rm -f try.c try
12903
a0d0e21e
LW
12904: see if ar generates random libraries by itself
12905echo " "
12906echo "Checking how to generate random libraries on your machine..." >&4
12907echo 'int bar1() { return bar2(); }' > bar1.c
12908echo 'int bar2() { return 2; }' > bar2.c
12909$cat > foo.c <<'EOP'
d674cd6d 12910int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
12911EOP
12912$cc $ccflags -c bar1.c >/dev/null 2>&1
12913$cc $ccflags -c bar2.c >/dev/null 2>&1
12914$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
12915$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12916if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12917 ./foobar >/dev/null 2>&1; then
4e2a5f63 12918 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
12919 orderlib=false
12920 ranlib=":"
dfe9444c
AD
12921elif $ar ts bar$_a >/dev/null 2>&1 &&
12922 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12923 ./foobar >/dev/null 2>&1; then
4e2a5f63 12924 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 12925 orderlib=false
dfe9444c 12926 ranlib="$ar ts"
a0d0e21e 12927else
ecfc5424
AD
12928 case "$ranlib" in
12929 :) ranlib='';;
12930 '')
12931 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12932 $test -f $ranlib || ranlib=''
12933 ;;
12934 esac
a0d0e21e 12935 if $test -n "$ranlib"; then
ecfc5424 12936 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
12937 orderlib=false
12938 else
12939 echo "your system doesn't seem to support random libraries"
12940 echo "so we'll use lorder and tsort to order the libraries."
12941 orderlib=true
12942 ranlib=":"
12943 fi
12944fi
12945$rm -f foo* bar*
12946
dfe9444c
AD
12947: check for type of arguments to select.
12948case "$selecttype" in
12949'') case "$d_select" in
12950 $define)
cce08f5b 12951 echo " "
dfe9444c
AD
12952 $cat <<EOM
12953Checking to see what type of arguments are accepted by select().
12954EOM
12955 hdrs="$define sys/types.h
12956 $i_systime sys/time.h
12957 $i_sysselct sys/select.h
12958 $d_socket sys/socket.h"
12959 : The first arg can be int, unsigned, or size_t
12960 : The last arg may or may not be 'const'
12961 val=''
7f3d1cf1
BH
12962 : void pointer has been seen but using that
12963 : breaks the selectminbits test
12964 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 12965 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
12966 for tmo in 'struct timeval *' 'const struct timeval *'; do
12967 case "$val" in
12968 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12969 if ./protochk "$try" $hdrs; then
12970 echo "Your system accepts $xxx."
12971 val="$xxx"
12972 fi
12973 ;;
12974 esac
12975 done
12976 done
12977 done
12978 case "$val" in
12979 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12980 case "$d_fd_set" in
12981 $define) dflt="fd_set *" ;;
12982 *) dflt="int *" ;;
12983 esac
12984 . ./myread
12985 val=$ans
12986 ;;
a0d0e21e 12987 esac
dfe9444c 12988 selecttype="$val"
a0d0e21e 12989 ;;
dfe9444c
AD
12990 *) : no select, so pick a harmless default
12991 selecttype='int *'
a0d0e21e
LW
12992 ;;
12993 esac
a0d0e21e
LW
12994 ;;
12995esac
2304df62 12996
5ff3f7a4
GS
12997: check for the select 'width'
12998case "$selectminbits" in
12999'') case "$d_select" in
13000 $define)
13001 $cat <<EOM
13002
85ab1d1d 13003Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
13004EOM
13005 $cat >try.c <<EOCP
13006#include <sys/types.h>
13007#$i_time I_TIME
13008#$i_systime I_SYS_TIME
13009#$i_systimek I_SYS_TIME_KERNEL
13010#ifdef I_TIME
13011# include <time.h>
13012#endif
13013#ifdef I_SYS_TIME
13014# ifdef I_SYS_TIME_KERNEL
13015# define KERNEL
13016# endif
13017# include <sys/time.h>
13018# ifdef I_SYS_TIME_KERNEL
13019# undef KERNEL
13020# endif
13021#endif
13022#$i_sysselct I_SYS_SELECT
13023#ifdef I_SYS_SELECT
13024#include <sys/select.h>
13025#endif
bd628c73
AD
13026#$d_socket HAS_SOCKET
13027#ifdef HAS_SOCKET
13028# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13029#endif
5ff3f7a4 13030#include <stdio.h>
fb164848
JH
13031$selecttype b;
13032#define S sizeof(*(b))
5ff3f7a4
GS
13033#define MINBITS 64
13034#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13035#define NBITS (NBYTES * 8)
13036int main() {
13037 char s[NBYTES];
5ff3f7a4
GS
13038 struct timeval t;
13039 int i;
13040 FILE* fp;
13041 int fd;
13042
13043 fclose(stdin);
13044 fp = fopen("try.c", "r");
13045 if (fp == 0)
13046 exit(1);
13047 fd = fileno(fp);
13048 if (fd < 0)
13049 exit(2);
13050 b = ($selecttype)s;
13051 for (i = 0; i < NBITS; i++)
13052 FD_SET(i, b);
13053 t.tv_sec = 0;
13054 t.tv_usec = 0;
13055 select(fd + 1, b, 0, 0, &t);
13056 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13057 printf("%d\n", i + 1);
13058 return 0;
13059}
13060EOCP
13061 set try
13062 if eval $compile_ok; then
13063 selectminbits=`./try`
85ab1d1d 13064 case "$selectminbits" in
fb164848
JH
13065 '') cat >&4 <<EOM
13066Cannot figure out on how many bits at a time your select() operates.
13067I'll play safe and guess it is 32 bits.
13068EOM
13069 selectminbits=32
13070 bits="32 bits"
13071 ;;
85ab1d1d
JH
13072 1) bits="1 bit" ;;
13073 *) bits="$selectminbits bits" ;;
13074 esac
13075 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
13076 else
13077 rp='What is the minimum number of bits your select() operates on?'
13078 case "$byteorder" in
13079 1234|12345678) dflt=32 ;;
13080 *) dflt=1 ;;
13081 esac
13082 . ./myread
13083 val=$ans
13084 selectminbits="$val"
13085 fi
13086 $rm -f try.* try
13087 ;;
13088 *) : no select, so pick a harmless default
13089 selectminbits='32'
13090 ;;
13091 esac
13092 ;;
13093esac
13094
8e07c86e
AD
13095: Trace out the files included by signal.h, then look for SIGxxx names.
13096: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
13097: Remove SIGSTKSIZE used by Linux.
13098: Remove SIGSTKSZ used by Posix.
4633a7c4 13099: Remove SIGTYP void lines used by OS2.
6764938d 13100: Some cpps, like os390, dont give the file name anywhere
53d4e464 13101if [ "X$fieldn" = X ]; then
6764938d
GS
13102 : Just make some guesses. We check them later.
13103 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
53d4e464 13104else
6764938d 13105 xxx=`echo '#include <signal.h>' |
8e07c86e
AD
13106 $cppstdin $cppminus $cppflags 2>/dev/null |
13107 $grep '^[ ]*#.*include' |
13108 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
53d4e464 13109fi
8e07c86e
AD
13110: Check this list of files to be sure we have parsed the cpp output ok.
13111: This will also avoid potentially non-existent files, such
13112: as ../foo/bar.h
13113xxxfiles=''
13114for xx in $xxx /dev/null ; do
13115 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13116done
13117: If we have found no files, at least try signal.h
13118case "$xxxfiles" in
13119'') xxxfiles=`./findhdr signal.h` ;;
13120esac
13121xxx=`awk '
af4c28eb 13122$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
13123 print substr($2, 4, 20)
13124}
4633a7c4 13125$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
13126 print substr($3, 4, 20)
13127}' $xxxfiles`
13128: Append some common names just in case the awk scan failed.
6764938d
GS
13129xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13130xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13131xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13132xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13133xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13134
8e07c86e 13135: generate a few handy files for later
dc45a647 13136$cat > signal.c <<'EOCP'
4633a7c4
LW
13137#include <sys/types.h>
13138#include <signal.h>
dc45a647 13139#include <stdio.h>
4633a7c4 13140int main() {
760ac839
LW
13141
13142/* Strange style to avoid deeply-nested #if/#else/#endif */
13143#ifndef NSIG
13144# ifdef _NSIG
13145# define NSIG (_NSIG)
13146# endif
13147#endif
13148
13149#ifndef NSIG
13150# ifdef SIGMAX
13151# define NSIG (SIGMAX+1)
13152# endif
13153#endif
13154
13155#ifndef NSIG
13156# ifdef SIG_MAX
13157# define NSIG (SIG_MAX+1)
13158# endif
13159#endif
13160
13161#ifndef NSIG
13162# ifdef MAXSIG
13163# define NSIG (MAXSIG+1)
13164# endif
4633a7c4 13165#endif
760ac839
LW
13166
13167#ifndef NSIG
13168# ifdef MAX_SIG
13169# define NSIG (MAX_SIG+1)
13170# endif
13171#endif
13172
13173#ifndef NSIG
13174# ifdef SIGARRAYSIZE
13175# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13176# endif
13177#endif
13178
13179#ifndef NSIG
13180# ifdef _sys_nsig
13181# define NSIG (_sys_nsig) /* Solaris 2.5 */
13182# endif
13183#endif
13184
13185/* Default to some arbitrary number that's big enough to get most
13186 of the common signals.
13187*/
13188#ifndef NSIG
13189# define NSIG 50
4633a7c4 13190#endif
760ac839
LW
13191
13192printf("NSIG %d\n", NSIG);
13193
dc45a647
MB
13194#ifndef JUST_NSIG
13195
13196EOCP
13197
28e8609d 13198echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
13199{
13200 printf "#ifdef SIG"; printf $1; printf "\n"
13201 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13202 printf $1; printf ");\n"
13203 printf "#endif\n"
2304df62 13204}
2304df62 13205END {
dc45a647 13206 printf "#endif /* JUST_NSIG */\n";
14e4fe40 13207 printf "exit(0);\n}\n";
2304df62 13208}
4633a7c4
LW
13209' >>signal.c
13210$cat >signal.awk <<'EOP'
13211BEGIN { ndups = 0 }
13212$1 ~ /^NSIG$/ { nsig = $2 }
13213($1 !~ /^NSIG$/) && (NF == 2) {
13214 if ($2 > maxsig) { maxsig = $2 }
13215 if (sig_name[$2]) {
13216 dup_name[ndups] = $1
13217 dup_num[ndups] = $2
13218 ndups++
13219 }
13220 else {
13221 sig_name[$2] = $1
13222 sig_num[$2] = $2
13223 }
4633a7c4
LW
13224}
13225END {
af4c28eb
CS
13226 if (nsig == 0) {
13227 nsig = maxsig + 1
13228 }
13229 printf("NSIG %d\n", nsig);
13230 for (n = 1; n < nsig; n++) {
13231 if (sig_name[n]) {
13232 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 13233 }
af4c28eb
CS
13234 else {
13235 printf("NUM%d %d\n", n, n)
13236 }
13237 }
4633a7c4 13238 for (n = 0; n < ndups; n++) {
af4c28eb 13239 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
13240 }
13241}
13242EOP
13243$cat >signal_cmd <<EOS
8e07c86e 13244$startsh
dc45a647
MB
13245if $test -s signal.lst; then
13246 echo "Using your existing signal.lst file"
13247 exit 0
13248fi
13249xxx="$xxx"
13250EOS
13251$cat >>signal_cmd <<'EOS'
13252
13253set signal
13254if eval $compile_ok; then
dfe9444c 13255 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 13256else
dc45a647
MB
13257 echo "(I can't seem be able to compile the whole test program)" >&4
13258 echo "(I'll try it in little pieces.)" >&4
13259 set signal -DJUST_NSIG
13260 if eval $compile_ok; then
13261 ./signal$_exe > signal.nsg
13262 $cat signal.nsg
13263 else
13264 echo "I can't seem to figure out how many signals you have." >&4
13265 echo "Guessing 50." >&4
13266 echo 'NSIG 50' > signal.nsg
13267 fi
13268 : Now look at all the signal names, one at a time.
28e8609d 13269 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
13270 $cat > signal.c <<EOCP
13271#include <sys/types.h>
13272#include <signal.h>
13273#include <stdio.h>
13274int main() {
13275printf("$xx %d\n", SIG${xx});
13276return 0;
13277}
13278EOCP
13279 set signal
13280 if eval $compile; then
13281 echo "SIG${xx} found."
13282 ./signal$_exe >> signal.ls1
13283 else
13284 echo "SIG${xx} NOT found."
13285 fi
13286 done
13287 if $test -s signal.ls1; then
13288 $cat signal.nsg signal.ls1 |
13289 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13290 fi
13291
13292fi
13293if $test -s signal.lst; then
13294 :
13295else
13296 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 13297 echo 'kill -l' >signal
dc45a647 13298 set X `csh -f <signal`
8e07c86e 13299 $rm -f signal
2304df62 13300 shift
dc45a647 13301 case $# in
8e07c86e 13302 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 13303 esac
28e8609d 13304 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
13305 $awk '{ printf "%s %d\n", $1, ++s; }
13306 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 13307fi
dc45a647 13308$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 13309EOS
4633a7c4
LW
13310chmod a+x signal_cmd
13311$eunicefix signal_cmd
8e07c86e
AD
13312
13313: generate list of signal names
13314echo " "
dfe9444c 13315case "$sig_name_init" in
6626bf4c
JH
13316'') doinit=yes ;;
13317*) case "$sig_num_init" in
13318 ''|*,*) doinit=yes ;;
13319 esac ;;
13320esac
13321case "$doinit" in
13322yes)
4633a7c4 13323 echo "Generating a list of signal names and numbers..." >&4
dc45a647 13324 . ./signal_cmd
af4c28eb
CS
13325 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13326 sig_name=`$awk 'BEGIN { printf "ZERO " }
13327 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13328 sig_num=`$awk 'BEGIN { printf "0 " }
13329 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13330 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
13331 !/^NSIG/ { printf "\"%s\", ", $1 }
13332 END { printf "0\n" }' signal.lst`
13333 sig_num_init=`$awk 'BEGIN { printf "0, " }
13334 !/^NSIG/ { printf "%d, ", $2}
13335 END { printf "0\n"}' signal.lst`
13336 ;;
13337esac
13338echo "The following $sig_count signals are available:"
a0d0e21e
LW
13339echo " "
13340echo $sig_name | $awk \
13341'BEGIN { linelen = 0 }
13342{
8e07c86e 13343 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
13344 name = "SIG" $i " "
13345 linelen = linelen + length(name)
13346 if (linelen > 70) {
13347 printf "\n"
13348 linelen = length(name)
13349 }
13350 printf "%s", name
13351 }
8e07c86e 13352 printf "\n"
a0d0e21e 13353}'
4633a7c4 13354$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 13355
a0d0e21e
LW
13356: see what type is used for signed size_t
13357set ssize_t ssizetype int stdio.h sys/types.h
13358eval $typedef
13359dflt="$ssizetype"
13360$cat > ssize.c <<EOM
13361#include <stdio.h>
13362#include <sys/types.h>
13363#define Size_t $sizetype
13364#define SSize_t $dflt
d674cd6d 13365int main()
a0d0e21e
LW
13366{
13367 if (sizeof(Size_t) == sizeof(SSize_t))
13368 printf("$dflt\n");
13369 else if (sizeof(Size_t) == sizeof(int))
13370 printf("int\n");
13371 else
13372 printf("long\n");
760ac839 13373 exit(0);
a0d0e21e
LW
13374}
13375EOM
13376echo " "
dfe9444c 13377set ssize
dc45a647 13378if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 13379 ssizetype=`./ssize`
a0d0e21e
LW
13380 echo "I'll be using $ssizetype for functions returning a byte count." >&4
13381else
24fef2a7 13382 $cat >&4 <<EOM
24fef2a7
AD
13383Help! I can't compile and run the ssize_t test program: please enlighten me!
13384(This is probably a misconfiguration in your system or libraries, and
13385you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
13386
13387I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 13388be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
13389
13390EOM
13391 rp="What signed type is the same size as $sizetype?"
13392 . ./myread
13393 ssizetype="$ans"
13394fi
dfe9444c 13395$rm -f ssize ssize.*
3fd537d4 13396
a0d0e21e
LW
13397: see what type of char stdio uses.
13398echo " "
13399if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13400 echo "Your stdio uses unsigned chars." >&4
13401 stdchar="unsigned char"
13402else
13403 echo "Your stdio uses signed chars." >&4
13404 stdchar="char"
13405fi
13406
13407: see if time exists
13408echo " "
28e8609d
JH
13409if test "X$d_time" = X -o X"$timetype" = X; then
13410 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
13411 echo 'time() found.' >&4
13412 val="$define"
13413 rp="What is the type returned by time() on this system?"
13414 set time_t timetype long stdio.h sys/types.h
13415 eval $typedef_ask
28e8609d 13416 else
5ff3f7a4
GS
13417 echo 'time() not found, hope that will do.' >&4
13418 val="$undef"
13419 timetype='int';
28e8609d
JH
13420 fi
13421 set d_time
13422 eval $setvar
a0d0e21e 13423fi
a0d0e21e
LW
13424
13425: see what type uids are declared as in the kernel
dc45a647
MB
13426echo " "
13427echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
13428set uid_t uidtype xxx stdio.h sys/types.h
13429eval $typedef
13430case "$uidtype" in
13431xxx)
13432 xxx=`./findhdr sys/user.h`
13433 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13434 case $1 in
13435 unsigned) dflt="$1 $2" ;;
13436 *) dflt="$1" ;;
13437 esac
13438 ;;
4633a7c4
LW
13439*) dflt="$uidtype";;
13440esac
dc45a647
MB
13441case "$uidtype" in
13442uid_t) echo "uid_t found." ;;
13443*) rp="What is the type for user ids returned by getuid()?"
13444 . ./myread
13445 uidtype="$ans"
13446 ;;
13447esac
4633a7c4 13448
57def98f
JH
13449echo " "
13450case "$uidtype" in
13451*_t) zzz="$uidtype" ;;
13452*) zzz="uid" ;;
13453esac
a22e52b9 13454echo "Checking the size of $zzz..." >&4
57def98f
JH
13455cat > try.c <<EOCP
13456#include <sys/types.h>
13457#include <stdio.h>
13458int main() {
213c275f 13459 printf("%d\n", (int)sizeof($uidtype));
14e4fe40 13460 exit(0);
57def98f
JH
13461}
13462EOCP
d4265146 13463set try
a22e52b9 13464if eval $compile_ok; then
57def98f
JH
13465 yyy=`./try`
13466 case "$yyy" in
a22e52b9
JH
13467 '') uidsize=4
13468 echo "(I can't execute the test program--guessing $uidsize.)" >&4
57def98f 13469 ;;
a22e52b9
JH
13470 *) uidsize=$yyy
13471 echo "Your $zzz size is $uidsize bytes."
57def98f
JH
13472 ;;
13473 esac
13474else
a22e52b9
JH
13475 uidsize=4
13476 echo "(I can't compile the test program--guessing $uidsize.)" >&4
57def98f
JH
13477fi
13478
785fb66b
JH
13479echo " "
13480case "$uidtype" in
13481*_t) zzz="$uidtype" ;;
13482*) zzz="uid" ;;
13483esac
a22e52b9 13484echo "Checking the sign of $zzz..." >&4
785fb66b
JH
13485cat > try.c <<EOCP
13486#include <sys/types.h>
13487#include <stdio.h>
13488int main() {
a22e52b9
JH
13489 $uidtype foo = -1;
13490 if (foo < 0)
13491 printf("-1\n");
13492 else
13493 printf("1\n");
785fb66b
JH
13494}
13495EOCP
13496set try
a22e52b9 13497if eval $compile; then
785fb66b
JH
13498 yyy=`./try`
13499 case "$yyy" in
a22e52b9
JH
13500 '') uidsign=1
13501 echo "(I can't execute the test program--guessing unsigned.)" >&4
785fb66b 13502 ;;
a22e52b9
JH
13503 *) uidsign=$yyy
13504 case "$uidsign" in
13505 1) echo "Your $zzz is unsigned." ;;
13506 -1) echo "Your $zzz is signed." ;;
13507 esac
785fb66b
JH
13508 ;;
13509 esac
13510else
a22e52b9
JH
13511 uidsign=1
13512 echo "(I can't compile the test program--guessing unsigned.)" >&4
785fb66b
JH
13513fi
13514
a22e52b9
JH
13515
13516
13517echo " "
13518$echo "Checking the format string to be used for uids..." >&4
13519
13520case "$uidsign" in
13521-1) if $test X"$uidsize" = X"$ivsize"; then
13522 uidformat="$ivdformat"
13523 else
13524 if $test X"$uidsize" = X"$longsize"; then
13525 uidformat='"ld"'
13526 else
13527 if $test X"$uidsize" = X"$intsize"; then
13528 uidformat='"d"'
13529 else
13530 if $test X"$uidsize" = X"$shortsize"; then
13531 uidformat='"hd"'
13532 fi
13533 fi
13534 fi
13535 fi
13536 ;;
13537*) if $test X"$uidsize" = X"$uvsize"; then
13538 uidformat="$uvuformat"
13539 else
13540 if $test X"$uidsize" = X"$longsize"; then
13541 uidformat='"lu"'
13542 else
13543 if $test X"$uidsize" = X"$intsize"; then
13544 uidformat='"u"'
13545 else
13546 if $test X"$uidsize" = X"$shortsize"; then
13547 uidformat='"hu"'
13548 fi
13549 fi
13550 fi
13551 fi
13552 ;;
13553esac
13554
4633a7c4
LW
13555: see if dbm.h is available
13556: see if dbmclose exists
13557set dbmclose d_dbmclose
13558eval $inlibc
13559
13560case "$d_dbmclose" in
13561$define)
13562 set dbm.h i_dbm
13563 eval $inhdr
5f80c64f
JH
13564 case "$i_dbm" in
13565 $define)
13566 val="$undef"
13567 set i_rpcsvcdbm
13568 eval $setvar
13569 ;;
13570 *) set rpcsvc/dbm.h i_rpcsvcdbm
13571 eval $inhdr
13572 ;;
13573 esac
13574 ;;
13575*) echo "We won't be including <dbm.h>"
13576 val="$undef"
13577 set i_dbm
13578 eval $setvar
13579 val="$undef"
13580 set i_rpcsvcdbm
13581 eval $setvar
13582 ;;
13583esac
13584
13585: see if this is a sys/file.h system
13586val=''
13587set sys/file.h val
13588eval $inhdr
13589
13590: do we need to include sys/file.h ?
13591case "$val" in
13592"$define")
13593 echo " "
13594 if $h_sysfile; then
13595 val="$define"
13596 echo "We'll be including <sys/file.h>." >&4
13597 else
13598 val="$undef"
13599 echo "We won't be including <sys/file.h>." >&4
13600 fi
13601 ;;
13602*)
13603 h_sysfile=false
13604 ;;
13605esac
13606set i_sysfile
13607eval $setvar
13608
13609: see if fcntl.h is there
13610val=''
13611set fcntl.h val
13612eval $inhdr
13613
13614: see if we can include fcntl.h
13615case "$val" in
13616"$define")
13617 echo " "
13618 if $h_fcntl; then
13619 val="$define"
13620 echo "We'll be including <fcntl.h>." >&4
13621 else
13622 val="$undef"
13623 if $h_sysfile; then
13624 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13625 else
13626 echo "We won't be including <fcntl.h>." >&4
13627 fi
13628 fi
13629 ;;
13630*)
13631 h_fcntl=false
13632 val="$undef"
13633 ;;
13634esac
13635set i_fcntl
13636eval $setvar
13637
43999f95
JH
13638: see if this is a iconv.h system
13639set iconv.h i_iconv
13640eval $inhdr
13641
5f80c64f
JH
13642: see if locale.h is available
13643set locale.h i_locale
13644eval $inhdr
13645
7f3d1cf1 13646: see if mach cthreads are available
13666627
JH
13647if test "X$usethreads" = "X$define"; then
13648 set mach/cthreads.h i_machcthr
13649 eval $inhdr
13650else
13651 i_machcthr="$undef"
13652fi
13653
13654
7f3d1cf1 13655
5f80c64f
JH
13656: see if this is a math.h system
13657set math.h i_math
13658eval $inhdr
13659
e7fb4fcc
JH
13660: see if this is a mntent.h system
13661set mntent.h i_mntent
13662eval $inhdr
13663
5f80c64f
JH
13664: see if ndbm.h is available
13665set ndbm.h t_ndbm
13666eval $inhdr
13667case "$t_ndbm" in
13668$define)
13669 : see if dbm_open exists
13670 set dbm_open d_dbm_open
13671 eval $inlibc
13672 case "$d_dbm_open" in
13673 $undef)
13674 t_ndbm="$undef"
13675 echo "We won't be including <ndbm.h>"
13676 ;;
13677 esac
13678 ;;
13679esac
13680val="$t_ndbm"
13681set i_ndbm
13682eval $setvar
13683
13684: see if net/errno.h is available
13685val=''
13686set net/errno.h val
13687eval $inhdr
13688
13689: Unfortunately, it causes problems on some systems. Arrgh.
13690case "$val" in
13691$define)
13692 cat > try.c <<'EOM'
13693#include <stdio.h>
13694#include <errno.h>
13695#include <net/errno.h>
13696int func()
13697{
13698 return ENOTSOCK;
13699}
13700EOM
13701 if $cc $ccflags -c try.c >/dev/null 2>&1; then
13702 echo "We'll be including <net/errno.h>." >&4
13703 else
13704 echo "We won't be including <net/errno.h>." >&4
13705 val="$undef"
13706 fi
13707 $rm -f try.* try
13708 ;;
13709esac
13710set i_neterrno
13711eval $setvar
13712
9cc6feab
JH
13713: see if netinet/tcp.h is available
13714set netinet/tcp.h i_netinettcp
13715eval $inhdr
13716
5b34fd99
JH
13717: see if this is a poll.h system
13718set poll.h i_poll
13719eval $inhdr
13720
5f80c64f 13721echo " "
78691af5 13722$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
43999f95
JH
13723$cat <<'EOSH' > Cppsym.know
13724a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13725AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13726alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13727ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13728BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13729BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13730bull c cadmus clipper CMU COFF COMPILER_VERSION
13731concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13732CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13733Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13734FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13735GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13736H3050R H3050RX hbullx20 hcx host_mips
13737hp200 hp300 hp700 HP700 hp800 hp9000
13738hp9000s200 hp9000s300 hp9000s400 hp9000s500
13739hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13740i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13741iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13742INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13743LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13744LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13745Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13746LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13747M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13748M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13749M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13750MATH_HAS_NO_SIDE_EFFECTS
13751mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13752mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13753mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13754MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13755mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13756NetBSD news1500 news1700 news1800 news1900 news3700
13757news700 news800 news900 NeXT NLS ns16000 ns32000
13758ns32016 ns32332 ns32k nsc32000
13759OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13760pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13761pc532 pdp11 PGC PIC plexus PORTAR posix
13762POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13763POSIX_C_SOURCE POSIX_SOURCE POWER
13764PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13765riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13766SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13767sony sony_news sonyrisc sparc sparclite spectrum
13768stardent stdc STDC_EXT stratos sun sun3 sun386
13769Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13770SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13771SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13772sysV68 sysV88 Tek4132 Tek4300 titan
13773tower tower32 tower32_200 tower32_600 tower32_700
13774tower32_800 tower32_850 tss
13775u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13776ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13777unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13778Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13779XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13780XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13781z8000
13782EOSH
13783# Maybe put other stuff here too.
13784cat <<EOSH >>Cppsym.know
13785$osname
13786EOSH
9b97abf7
JH
13787./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13788./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
43999f95
JH
13789$cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13790$rm -f Cppsym.a Cppsym.b
13791cat <<EOSH > Cppsym
5f80c64f 13792$startsh
43999f95
JH
13793if $test \$# -gt 0; then
13794 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13795 if $test -s Cppsym.got; then
13796 $rm -f Cppsym.got
13797 exit 0
13798 fi
13799 $rm -f Cppsym.got
13800 exit 1
13801else
13802 $tr " " "$trnl" | ./Cppsym.try
13803 exit 0
13804fi
13805EOSH
5f80c64f
JH
13806chmod +x Cppsym
13807$eunicefix Cppsym
43999f95
JH
13808cat <<EOSH > Cppsym.try
13809$startsh
13810cat <<'EOCP' > try.c
13811#include <stdio.h>
13812int main() {
13813EOCP
13814$awk \\
13815EOSH
13816cat <<'EOSH' >> Cppsym.try
13817'length($1) > 0 {
13818 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
13819 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
13820 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
13821 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
13822}' >> try.c
13823echo '}' >> try.c
13824EOSH
13825cat <<EOSH >> Cppsym.try
13826cc="$cc"
13827optimize="$optimize"
13828ccflags="$ccflags"
13829ldflags="$ldflags"
13830libs="$libs"
13831exe_ext="$exe_ext"
a99dda5d 13832$cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
43999f95
JH
13833EOSH
13834chmod +x Cppsym.try
13835$eunicefix Cppsym.try
13836./Cppsym < Cppsym.know > Cppsym.true
5f80c64f 13837: now check the C compiler for additional symbols
c4747d3e
JH
13838postprocess_cc_v=''
13839case "$osname" in
13840aix) postprocess_cc_v="|$tr , ' '" ;;
13841esac
5f80c64f
JH
13842$cat >ccsym <<EOS
13843$startsh
13844$cat >tmp.c <<EOF
13845extern int foo;
13846EOF
c4747d3e 13847for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
13848do
13849 case "\$i" in
13850 -D*) echo "\$i" | $sed 's/^-D//';;
13851 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13852 esac
13853done
13854$rm -f try.c
13855EOS
2000072c 13856postprocess_cc_v=''
5f80c64f
JH
13857chmod +x ccsym
13858$eunicefix ccsym
13859./ccsym > ccsym1.raw
13860if $test -s ccsym1.raw; then
13861 $sort ccsym1.raw | $uniq >ccsym.raw
13862else
13863 mv ccsym1.raw ccsym.raw
13864fi
13865
13866$awk '/\=/ { print $0; next }
13867 { print $0"=1" }' ccsym.raw >ccsym.list
43999f95
JH
13868$awk '/\=/ { print $0; next }
13869 { print $0"=1" }' Cppsym.true >ccsym.true
5f80c64f
JH
13870$comm -13 ccsym.true ccsym.list >ccsym.own
13871$comm -12 ccsym.true ccsym.list >ccsym.com
13872$comm -23 ccsym.true ccsym.list >ccsym.cpp
13873also=''
5f80c64f 13874if $test -z ccsym.raw; then
ff49bff8 13875 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 13876 echo " "
ff49bff8 13877 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 13878 $cat Cppsym.true
ff49bff8
JH
13879 ccsymbols=''
13880 cppsymbols=`$cat Cppsym.true`
918c3d21 13881 cppsymbols=`echo $cppsymbols`
ff49bff8 13882 cppccsymbols="$cppsymbols"
5f80c64f
JH
13883else
13884 if $test -s ccsym.com; then
13885 echo "Your C compiler and pre-processor define these symbols:"
13886 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13887 also='also '
13888 symbols='ones'
ff49bff8 13889 cppccsymbols=`$cat ccsym.com`
918c3d21 13890 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
13891 $test "$silent" || sleep 1
13892 fi
13893 if $test -s ccsym.cpp; then
13894 $test "$also" && echo " "
ff49bff8 13895 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
13896 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13897 also='further '
ff49bff8 13898 cppsymbols=`$cat ccsym.cpp`
918c3d21 13899 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
13900 $test "$silent" || sleep 1
13901 fi
13902 if $test -s ccsym.own; then
13903 $test "$also" && echo " "
ff49bff8 13904 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
13905 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13906 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 13907 ccsymbols=`$cat ccsym.own`
918c3d21 13908 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
13909 $test "$silent" || sleep 1
13910 fi
13911fi
13912$rm -f ccsym*
13913
13914: see if this is a termio system
13915val="$undef"
13916val2="$undef"
13917val3="$undef"
13918if $test `./findhdr termios.h`; then
13919 set tcsetattr i_termios
13920 eval $inlibc
13921 val3="$i_termios"
13922fi
13923echo " "
13924case "$val3" in
13925"$define") echo "You have POSIX termios.h... good!" >&4;;
13926*) if ./Cppsym pyr; then
13927 case "`/bin/universe`" in
13928 ucb) if $test `./findhdr sgtty.h`; then
13929 val2="$define"
13930 echo "<sgtty.h> found." >&4
13931 else
13932 echo "System is pyramid with BSD universe."
13933 echo "<sgtty.h> not found--you could have problems." >&4
13934 fi;;
13935 *) if $test `./findhdr termio.h`; then
13936 val="$define"
13937 echo "<termio.h> found." >&4
13938 else
13939 echo "System is pyramid with USG universe."
13940 echo "<termio.h> not found--you could have problems." >&4
13941 fi;;
13942 esac
13943 elif ./usg; then
13944 if $test `./findhdr termio.h`; then
13945 echo "<termio.h> found." >&4
13946 val="$define"
13947 elif $test `./findhdr sgtty.h`; then
13948 echo "<sgtty.h> found." >&4
13949 val2="$define"
13950 else
13951echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13952 fi
13953 else
13954 if $test `./findhdr sgtty.h`; then
13955 echo "<sgtty.h> found." >&4
13956 val2="$define"
13957 elif $test `./findhdr termio.h`; then
13958 echo "<termio.h> found." >&4
13959 val="$define"
13960 else
13961echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13962 fi
13963 fi;;
13964esac
13965set i_termio; eval $setvar
13966val=$val2; set i_sgtty; eval $setvar
13967val=$val3; set i_termios; eval $setvar
13968
f1066039
JH
13969: see if this is a shadow.h system
13970set shadow.h i_shadow
13971eval $inhdr
13972
86959918
JH
13973: see if this is a socks.h system
13974set socks.h i_socks
13975eval $inhdr
13976
5f80c64f
JH
13977: see if stdarg is available
13978echo " "
13979if $test `./findhdr stdarg.h`; then
13980 echo "<stdarg.h> found." >&4
13981 valstd="$define"
13982else
13983 echo "<stdarg.h> NOT found." >&4
13984 valstd="$undef"
13985fi
13986
13987: see if varags is available
13988echo " "
13989if $test `./findhdr varargs.h`; then
13990 echo "<varargs.h> found." >&4
13991else
13992 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13993fi
13994
13995: set up the varargs testing programs
13996$cat > varargs.c <<EOP
13997#ifdef I_STDARG
13998#include <stdarg.h>
13999#endif
14000#ifdef I_VARARGS
14001#include <varargs.h>
14002#endif
14003
14004#ifdef I_STDARG
14005int f(char *p, ...)
14006#else
14007int f(va_alist)
14008va_dcl
14009#endif
14010{
14011 va_list ap;
14012#ifndef I_STDARG
14013 char *p;
14014#endif
14015#ifdef I_STDARG
14016 va_start(ap,p);
14017#else
14018 va_start(ap);
14019 p = va_arg(ap, char *);
14020#endif
14021 va_end(ap);
14022}
14023EOP
14024$cat > varargs <<EOP
14025$startsh
14026if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14027 echo "true"
14028else
14029 echo "false"
14030fi
14031$rm -f varargs$_o
14032EOP
14033chmod +x varargs
14034
14035: now check which varargs header should be included
14036echo " "
14037i_varhdr=''
14038case "$valstd" in
14039"$define")
14040 if `./varargs I_STDARG`; then
14041 val='stdarg.h'
14042 elif `./varargs I_VARARGS`; then
14043 val='varargs.h'
14044 fi
14045 ;;
14046*)
14047 if `./varargs I_VARARGS`; then
14048 val='varargs.h'
14049 fi
14050 ;;
14051esac
14052case "$val" in
14053'')
14054echo "I could not find the definition for va_dcl... You have problems..." >&4
14055 val="$undef"; set i_stdarg; eval $setvar
14056 val="$undef"; set i_varargs; eval $setvar
14057 ;;
14058*)
14059 set i_varhdr
14060 eval $setvar
14061 case "$i_varhdr" in
14062 stdarg.h)
14063 val="$define"; set i_stdarg; eval $setvar
14064 val="$undef"; set i_varargs; eval $setvar
14065 ;;
14066 varargs.h)
14067 val="$undef"; set i_stdarg; eval $setvar
14068 val="$define"; set i_varargs; eval $setvar
14069 ;;
14070 esac
14071 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14072esac
14073$rm -f varargs*
14074
14075: see if stddef is available
14076set stddef.h i_stddef
14077eval $inhdr
14078
14079: see if sys/access.h is available
14080set sys/access.h i_sysaccess
14081eval $inhdr
14082
14083: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14084set sys/filio.h i_sysfilio
14085eval $inhdr
14086echo " "
14087if $test `./findhdr sys/ioctl.h`; then
14088 val="$define"
14089 echo '<sys/ioctl.h> found.' >&4
14090else
14091 val="$undef"
14092 if $test $i_sysfilio = "$define"; then
14093 echo '<sys/ioctl.h> NOT found.' >&4
14094 else
14095 $test $i_sgtty = "$define" && xxx="sgtty.h"
14096 $test $i_termio = "$define" && xxx="termio.h"
14097 $test $i_termios = "$define" && xxx="termios.h"
14098echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14099 fi
14100fi
14101set i_sysioctl
14102eval $setvar
14103
ca52efda
JH
14104
14105: see if this is a syslog.h system
14106set syslog.h i_syslog
14107eval $inhdr
14108
5f80c64f
JH
14109: see if sys/resource.h has to be included
14110set sys/resource.h i_sysresrc
14111eval $inhdr
14112
14113: see if sys/security.h is available
14114set sys/security.h i_syssecrt
14115eval $inhdr
14116
104d25b7
JH
14117: see if this is a sys/statvfs.h system
14118set sys/statvfs.h i_sysstatvfs
14119eval $inhdr
14120
b7b35fc2
JH
14121: see if this is a sys/uio.h system
14122set sys/uio.h i_sysuio
14123eval $inhdr
14124
5f80c64f
JH
14125: see if this is a sys/un.h system
14126set sys/un.h i_sysun
14127eval $inhdr
14128
d4935d7f
JH
14129
14130: see if this is a sys/utsname.h system
14131set sys/utsname.h i_sysutsname
14132eval $inhdr
14133
5f80c64f
JH
14134: see if this is a syswait system
14135set sys/wait.h i_syswait
14136eval $inhdr
14137
0545a864
JH
14138: see if this is a ustat.h system
14139set ustat.h i_ustat
14140eval $inhdr
14141
5f80c64f
JH
14142: see if this is an utime system
14143set utime.h i_utime
14144eval $inhdr
14145
14146: see if this is a values.h system
14147set values.h i_values
14148eval $inhdr
14149
14150: see if this is a vfork system
14151case "$d_vfork" in
14152"$define")
14153 set vfork.h i_vfork
14154 eval $inhdr
14155 ;;
14156*)
14157 i_vfork="$undef"
14158 ;;
14159esac
14160
14161: see if gdbm.h is available
14162set gdbm.h t_gdbm
14163eval $inhdr
14164case "$t_gdbm" in
14165$define)
14166 : see if gdbm_open exists
14167 set gdbm_open d_gdbm_open
14168 eval $inlibc
14169 case "$d_gdbm_open" in
14170 $undef)
14171 t_gdbm="$undef"
14172 echo "We won't be including <gdbm.h>"
14173 ;;
14174 esac
14175 ;;
14176esac
14177val="$t_gdbm"
14178set i_gdbm
14179eval $setvar
14180
14181echo " "
14182echo "Looking for extensions..." >&4
5f80c64f
JH
14183: If we are using the old config.sh, known_extensions may contain
14184: old or inaccurate or duplicate values.
14185known_extensions=''
14186nonxs_extensions=''
14187: We do not use find because it might not be available.
14188: We do not just use MANIFEST because the user may have dropped
14189: some additional extensions into the source tree and expect them
14190: to be built.
7e791ca9
NK
14191
14192: Function to recursively find available extensions, ignoring DynaLoader
14193: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14194find_extensions='
14195 for xxx in *; do
14196 case "$xxx" in
14197 DynaLoader|dynaload) ;;
14198 *)
14199 if $test -f $xxx/$xxx.xs; then
14200 known_extensions="$known_extensions $1$xxx";
14201 elif $test -f $xxx/Makefile.PL; then
14202 nonxs_extensions="$nonxs_extensions $1$xxx";
14203 else
14204 if $test -d $xxx -a $# -lt 10; then
14205 set $1$xxx/ $*;
14206 cd $xxx;
14207 eval $find_extensions;
14208 cd ..;
14209 shift;
9f50e519 14210 fi;
7e791ca9
NK
14211 fi
14212 ;;
9f50e519 14213 esac;
7e791ca9
NK
14214 done'
14215tdir=`pwd`
14216cd $rsrc/ext
a3635516 14217set X
efdb23e1 14218shift
7e791ca9 14219eval $find_extensions
5f80c64f
JH
14220set X $nonxs_extensions
14221shift
14222nonxs_extensions="$*"
14223set X $known_extensions
14224shift
14225known_extensions="$*"
14226cd $tdir
14227
14228: Now see which are supported on this system.
14229avail_ext=''
14230for xxx in $known_extensions ; do
14231 case "$xxx" in
14232 DB_File|db_file)
14233 case "$i_db" in
14234 $define) avail_ext="$avail_ext $xxx" ;;
14235 esac
14236 ;;
14237 GDBM_File|gdbm_fil)
14238 case "$i_gdbm" in
14239 $define) avail_ext="$avail_ext $xxx" ;;
14240 esac
14241 ;;
14242 NDBM_File|ndbm_fil)
14243 case "$i_ndbm" in
f7dd4e7f
JH
14244 $define)
14245 case "$osname-$use64bits" in
14246 hpux-define)
14247 case "$libs" in
14248 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14249 esac
14250 ;;
14251 *) avail_ext="$avail_ext $xxx" ;;
14252 esac
14253 ;;
5f80c64f
JH
14254 esac
14255 ;;
14256 ODBM_File|odbm_fil)
14257 case "${i_dbm}${i_rpcsvcdbm}" in
f7dd4e7f
JH
14258 *"${define}"*)
14259 case "$osname-$use64bits" in
14260 hpux-define)
14261 case "$libs" in
14262 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14263 esac
14264 ;;
14265 *) avail_ext="$avail_ext $xxx" ;;
14266 esac
14267 ;;
5f80c64f
JH
14268 esac
14269 ;;
14270 POSIX|posix)
14271 case "$useposix" in
14272 true|define|y) avail_ext="$avail_ext $xxx" ;;
14273 esac
14274 ;;
14275 Opcode|opcode)
14276 case "$useopcode" in
14277 true|define|y) avail_ext="$avail_ext $xxx" ;;
14278 esac
14279 ;;
14280 Socket|socket)
14281 case "$d_socket" in
14282 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14283 esac
14284 ;;
14285 Thread|thread)
14286 case "$usethreads" in
14287 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14288 esac
14289 ;;
14290 IPC/SysV|ipc/sysv)
14291 : XXX Do we need a useipcsysv variable here
14292 case "${d_msg}${d_sem}${d_shm}" in
14293 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14294 esac
14295 ;;
14296 *) avail_ext="$avail_ext $xxx"
14297 ;;
14298 esac
14299done
14300
14301set X $avail_ext
14302shift
14303avail_ext="$*"
14304
14305: Now see which nonxs extensions are supported on this system.
14306: For now assume all are.
14307nonxs_ext=''
14308for xxx in $nonxs_extensions ; do
14309 case "$xxx" in
14310 *) nonxs_ext="$nonxs_ext $xxx"
14311 ;;
14312 esac
14313done
14314
14315set X $nonxs_ext
14316shift
14317nonxs_ext="$*"
14318
14319case $usedl in
14320$define)
14321 $cat <<EOM
14322A number of extensions are supplied with $package. You may choose to
14323compile these extensions for dynamic loading (the default), compile
14324them into the $package executable (static loading), or not include
14325them at all. Answer "none" to include no extensions.
14326Note that DynaLoader is always built and need not be mentioned here.
14327
14328EOM
14329 case "$dynamic_ext" in
14330 '') dflt="$avail_ext" ;;
14331 *) dflt="$dynamic_ext"
14332 # Perhaps we are reusing an old out-of-date config.sh.
14333 case "$hint" in
14334 previous)
14335 if test X"$dynamic_ext" != X"$avail_ext"; then
14336 $cat <<EOM
14337NOTICE: Your previous config.sh list may be incorrect.
14338The extensions now available to you are
14339 ${avail_ext}
14340but the default list from your previous config.sh is
14341 ${dynamic_ext}
14342
14343EOM
14344 fi
14345 ;;
14346 esac
14347 ;;
14348 esac
14349 case "$dflt" in
14350 '') dflt=none;;
14351 esac
14352 rp="What extensions do you wish to load dynamically?"
14353 . ./myread
14354 case "$ans" in
14355 none) dynamic_ext=' ' ;;
14356 *) dynamic_ext="$ans" ;;
14357 esac
14358
14359 case "$static_ext" in
14360 '')
14361 : Exclude those already listed in dynamic linking
14362 dflt=''
14363 for xxx in $avail_ext; do
14364 case " $dynamic_ext " in
14365 *" $xxx "*) ;;
14366 *) dflt="$dflt $xxx" ;;
14367 esac
14368 done
14369 set X $dflt
14370 shift
14371 dflt="$*"
14372 ;;
14373 *) dflt="$static_ext"
14374 ;;
14375 esac
14376
14377 case "$dflt" in
14378 '') dflt=none;;
14379 esac
14380 rp="What extensions do you wish to load statically?"
14381 . ./myread
14382 case "$ans" in
14383 none) static_ext=' ' ;;
14384 *) static_ext="$ans" ;;
14385 esac
14386 ;;
14387*)
14388 $cat <<EOM
14389A number of extensions are supplied with $package. Answer "none"
14390to include no extensions.
14391Note that DynaLoader is always built and need not be mentioned here.
14392
14393EOM
14394 case "$static_ext" in
14395 '') dflt="$avail_ext" ;;
14396 *) dflt="$static_ext"
14397 # Perhaps we are reusing an old out-of-date config.sh.
14398 case "$hint" in
14399 previous)
14400 if test X"$static_ext" != X"$avail_ext"; then
14401 $cat <<EOM
14402NOTICE: Your previous config.sh list may be incorrect.
14403The extensions now available to you are
14404 ${avail_ext}
14405but the default list from your previous config.sh is
14406 ${static_ext}
14407
14408EOM
14409 fi
14410 ;;
14411 esac
14412 ;;
14413 esac
14414 : Exclude those that are not xs extensions
14415 case "$dflt" in
14416 '') dflt=none;;
14417 esac
14418 rp="What extensions do you wish to include?"
14419 . ./myread
14420 case "$ans" in
14421 none) static_ext=' ' ;;
14422 *) static_ext="$ans" ;;
14423 esac
14424 ;;
14425esac
14426
14427set X $dynamic_ext $static_ext $nonxs_ext
14428shift
14429extensions="$*"
14430
14431: Remove build directory name from cppstdin so it can be used from
14432: either the present location or the final installed location.
14433echo " "
14434: Get out of the UU directory to get correct path name.
14435cd ..
14436case "$cppstdin" in
14437`pwd`/cppstdin)
14438 echo "Stripping down cppstdin path name"
14439 cppstdin=cppstdin
14440 ;;
14441esac
14442cd UU
14443
14444: end of configuration questions
14445echo " "
14446echo "End of configuration questions."
14447echo " "
14448
14449: back to where it started
14450if test -d ../UU; then
14451 cd ..
14452fi
14453
14454: configuration may be patched via a 'config.over' file
14455if $test -f config.over; then
14456 echo " "
14457 dflt=y
14458 rp='I see a config.over file. Do you wish to load it?'
14459 . UU/myread
14460 case "$ans" in
14461 n*) echo "OK, I'll ignore it.";;
14462 *) . ./config.over
14463 echo "Configuration override changes have been loaded."
14464 ;;
14465 esac
14466fi
14467
14468: in case they want portability, strip down executable paths
14469case "$d_portable" in
14470"$define")
14471 echo " "
14472 echo "Stripping down executable paths..." >&4
14473 for file in $loclist $trylist; do
534ac15a
JH
14474 eval temp=\$$file
14475 eval $file=`basename $temp`
5f80c64f
JH
14476 done
14477 ;;
14478esac
14479
14480: create config.sh file
14481echo " "
14482echo "Creating config.sh..." >&4
14483$spitshell <<EOT >config.sh
14484$startsh
14485#
14486# This file was produced by running the Configure script. It holds all the
14487# definitions figured out by Configure. Should you modify one of these values,
14488# do not forget to propagate your changes by running "Configure -der". You may
14489# instead choose to run each of the .SH files by yourself, or "Configure -S".
14490#
14491
14492# Package name : $package
14493# Source directory : $src
14494# Configuration time: $cf_time
14495# Configured by : $cf_by
14496# Target system : $myuname
14497
14498Author='$Author'
14499Date='$Date'
14500Header='$Header'
14501Id='$Id'
14502Locker='$Locker'
14503Log='$Log'
14504Mcc='$Mcc'
14505RCSfile='$RCSfile'
14506Revision='$Revision'
14507Source='$Source'
14508State='$State'
14509_a='$_a'
14510_exe='$_exe'
14511_o='$_o'
14512afs='$afs'
14513alignbytes='$alignbytes'
14514ansi2knr='$ansi2knr'
14515aphostname='$aphostname'
ff935051
JH
14516api_revision='$api_revision'
14517api_subversion='$api_subversion'
14518api_version='$api_version'
14519api_versionstring='$api_versionstring'
5f80c64f
JH
14520ar='$ar'
14521archlib='$archlib'
14522archlibexp='$archlibexp'
14523archname64='$archname64'
14524archname='$archname'
14525archobjs='$archobjs'
14526awk='$awk'
14527baserev='$baserev'
14528bash='$bash'
14529bin='$bin'
d71b2b6b 14530bincompat5005='$bincompat5005'
5f80c64f
JH
14531binexp='$binexp'
14532bison='$bison'
14533byacc='$byacc'
14534byteorder='$byteorder'
14535c='$c'
14536castflags='$castflags'
14537cat='$cat'
14538cc='$cc'
14539cccdlflags='$cccdlflags'
14540ccdlflags='$ccdlflags'
14541ccflags='$ccflags'
ff49bff8 14542ccsymbols='$ccsymbols'
5f80c64f
JH
14543cf_by='$cf_by'
14544cf_email='$cf_email'
14545cf_time='$cf_time'
8175356b 14546charsize='$charsize'
5f80c64f
JH
14547chgrp='$chgrp'
14548chmod='$chmod'
14549chown='$chown'
14550clocktype='$clocktype'
14551comm='$comm'
14552compress='$compress'
14553contains='$contains'
14554cp='$cp'
14555cpio='$cpio'
14556cpp='$cpp'
14557cpp_stuff='$cpp_stuff'
ff49bff8 14558cppccsymbols='$cppccsymbols'
5f80c64f
JH
14559cppflags='$cppflags'
14560cpplast='$cpplast'
14561cppminus='$cppminus'
14562cpprun='$cpprun'
14563cppstdin='$cppstdin'
ff49bff8 14564cppsymbols='$cppsymbols'
68c15b6f 14565crosscompile='$crosscompile'
5f80c64f
JH
14566cryptlib='$cryptlib'
14567csh='$csh'
14568d_Gconvert='$d_Gconvert'
cf2093f6
JH
14569d_PRIEldbl='$d_PRIEldbl'
14570d_PRIFldbl='$d_PRIFldbl'
14571d_PRIGldbl='$d_PRIGldbl'
14572d_PRIX64='$d_PRIX64'
14573d_PRId64='$d_PRId64'
14574d_PRIeldbl='$d_PRIeldbl'
14575d_PRIfldbl='$d_PRIfldbl'
14576d_PRIgldbl='$d_PRIgldbl'
14577d_PRIi64='$d_PRIi64'
14578d_PRIo64='$d_PRIo64'
14579d_PRIu64='$d_PRIu64'
14580d_PRIx64='$d_PRIx64'
5f80c64f
JH
14581d_access='$d_access'
14582d_accessx='$d_accessx'
14583d_alarm='$d_alarm'
14584d_archlib='$d_archlib'
cf2093f6
JH
14585d_atolf='$d_atolf'
14586d_atoll='$d_atoll'
5f80c64f
JH
14587d_attribut='$d_attribut'
14588d_bcmp='$d_bcmp'
14589d_bcopy='$d_bcopy'
d71b2b6b 14590d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
14591d_bsd='$d_bsd'
14592d_bsdgetpgrp='$d_bsdgetpgrp'
14593d_bsdsetpgrp='$d_bsdsetpgrp'
14594d_bzero='$d_bzero'
14595d_casti32='$d_casti32'
14596d_castneg='$d_castneg'
14597d_charvspr='$d_charvspr'
14598d_chown='$d_chown'
14599d_chroot='$d_chroot'
14600d_chsize='$d_chsize'
14601d_closedir='$d_closedir'
14602d_const='$d_const'
14603d_crypt='$d_crypt'
14604d_csh='$d_csh'
14605d_cuserid='$d_cuserid'
14606d_dbl_dig='$d_dbl_dig'
5f80c64f 14607d_difftime='$d_difftime'
5f80c64f
JH
14608d_dirnamlen='$d_dirnamlen'
14609d_dlerror='$d_dlerror'
14610d_dlopen='$d_dlopen'
14611d_dlsymun='$d_dlsymun'
14612d_dosuid='$d_dosuid'
14613d_drand48proto='$d_drand48proto'
14614d_dup2='$d_dup2'
14615d_eaccess='$d_eaccess'
14616d_endgrent='$d_endgrent'
14617d_endhent='$d_endhent'
14618d_endnent='$d_endnent'
14619d_endpent='$d_endpent'
14620d_endpwent='$d_endpwent'
14621d_endsent='$d_endsent'
f1066039 14622d_endspent='$d_endspent'
5f80c64f
JH
14623d_eofnblk='$d_eofnblk'
14624d_eunice='$d_eunice'
14625d_fchmod='$d_fchmod'
14626d_fchown='$d_fchown'
14627d_fcntl='$d_fcntl'
14628d_fd_macros='$d_fd_macros'
14629d_fd_set='$d_fd_set'
14630d_fds_bits='$d_fds_bits'
5f80c64f 14631d_fgetpos='$d_fgetpos'
5f80c64f 14632d_flexfnam='$d_flexfnam'
5f80c64f 14633d_flock='$d_flock'
5f80c64f
JH
14634d_fork='$d_fork'
14635d_fpathconf='$d_fpathconf'
d9b3e12d 14636d_fpos64_t='$d_fpos64_t'
0545a864 14637d_fs_data_s='$d_fs_data_s'
5f80c64f 14638d_fseeko='$d_fseeko'
5f80c64f 14639d_fsetpos='$d_fsetpos'
104d25b7
JH
14640d_fstatfs='$d_fstatfs'
14641d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
14642d_ftello='$d_ftello'
14643d_ftime='$d_ftime'
49dabb45 14644d_getcwd='$d_getcwd'
5f80c64f
JH
14645d_getgrent='$d_getgrent'
14646d_getgrps='$d_getgrps'
14647d_gethbyaddr='$d_gethbyaddr'
14648d_gethbyname='$d_gethbyname'
14649d_gethent='$d_gethent'
14650d_gethname='$d_gethname'
14651d_gethostprotos='$d_gethostprotos'
14652d_getlogin='$d_getlogin'
ad27e871 14653d_getmnt='$d_getmnt'
ccc7f9b3 14654d_getmntent='$d_getmntent'
5f80c64f
JH
14655d_getnbyaddr='$d_getnbyaddr'
14656d_getnbyname='$d_getnbyname'
14657d_getnent='$d_getnent'
14658d_getnetprotos='$d_getnetprotos'
14659d_getpbyname='$d_getpbyname'
14660d_getpbynumber='$d_getpbynumber'
14661d_getpent='$d_getpent'
14662d_getpgid='$d_getpgid'
14663d_getpgrp2='$d_getpgrp2'
14664d_getpgrp='$d_getpgrp'
14665d_getppid='$d_getppid'
14666d_getprior='$d_getprior'
14667d_getprotoprotos='$d_getprotoprotos'
14668d_getpwent='$d_getpwent'
14669d_getsbyname='$d_getsbyname'
14670d_getsbyport='$d_getsbyport'
14671d_getsent='$d_getsent'
14672d_getservprotos='$d_getservprotos'
f1066039
JH
14673d_getspent='$d_getspent'
14674d_getspnam='$d_getspnam'
5f80c64f
JH
14675d_gettimeod='$d_gettimeod'
14676d_gnulibc='$d_gnulibc'
14677d_grpasswd='$d_grpasswd'
ccc7f9b3 14678d_hasmntopt='$d_hasmntopt'
5f80c64f 14679d_htonl='$d_htonl'
43999f95 14680d_iconv='$d_iconv'
5f80c64f
JH
14681d_index='$d_index'
14682d_inetaton='$d_inetaton'
5f80c64f
JH
14683d_int64t='$d_int64t'
14684d_isascii='$d_isascii'
14685d_killpg='$d_killpg'
14686d_lchown='$d_lchown'
2d4389e4 14687d_ldbl_dig='$d_ldbl_dig'
5f80c64f
JH
14688d_link='$d_link'
14689d_locconv='$d_locconv'
5f80c64f
JH
14690d_lockf='$d_lockf'
14691d_longdbl='$d_longdbl'
14692d_longlong='$d_longlong'
5f80c64f
JH
14693d_lstat='$d_lstat'
14694d_mblen='$d_mblen'
14695d_mbstowcs='$d_mbstowcs'
14696d_mbtowc='$d_mbtowc'
0f27ced1 14697d_memchr='$d_memchr'
5f80c64f
JH
14698d_memcmp='$d_memcmp'
14699d_memcpy='$d_memcpy'
14700d_memmove='$d_memmove'
14701d_memset='$d_memset'
14702d_mkdir='$d_mkdir'
fe749a9f 14703d_mkdtemp='$d_mkdtemp'
5f80c64f 14704d_mkfifo='$d_mkfifo'
fe749a9f
JH
14705d_mkstemp='$d_mkstemp'
14706d_mkstemps='$d_mkstemps'
5f80c64f 14707d_mktime='$d_mktime'
fe749a9f
JH
14708d_mmap='$d_mmap'
14709d_mprotect='$d_mprotect'
5f80c64f 14710d_msg='$d_msg'
de4597cb
JH
14711d_msg_ctrunc='$d_msg_ctrunc'
14712d_msg_dontroute='$d_msg_dontroute'
14713d_msg_oob='$d_msg_oob'
14714d_msg_peek='$d_msg_peek'
14715d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
14716d_msgctl='$d_msgctl'
14717d_msgget='$d_msgget'
14718d_msgrcv='$d_msgrcv'
14719d_msgsnd='$d_msgsnd'
fe749a9f
JH
14720d_msync='$d_msync'
14721d_munmap='$d_munmap'
5f80c64f 14722d_mymalloc='$d_mymalloc'
5f80c64f 14723d_nice='$d_nice'
78691af5 14724d_nv_preserves_uv='$d_nv_preserves_uv'
2000072c 14725d_off64_t='$d_off64_t'
ef4af2be 14726d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
14727d_oldpthreads='$d_oldpthreads'
14728d_oldsock='$d_oldsock'
14729d_open3='$d_open3'
5f80c64f
JH
14730d_pathconf='$d_pathconf'
14731d_pause='$d_pause'
14732d_phostname='$d_phostname'
14733d_pipe='$d_pipe'
14734d_poll='$d_poll'
14735d_portable='$d_portable'
14736d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
14737d_pwage='$d_pwage'
14738d_pwchange='$d_pwchange'
14739d_pwclass='$d_pwclass'
14740d_pwcomment='$d_pwcomment'
14741d_pwexpire='$d_pwexpire'
14742d_pwgecos='$d_pwgecos'
14743d_pwpasswd='$d_pwpasswd'
14744d_pwquota='$d_pwquota'
de1c2614 14745d_quad='$d_quad'
5f80c64f
JH
14746d_readdir='$d_readdir'
14747d_readlink='$d_readlink'
14748d_rename='$d_rename'
14749d_rewinddir='$d_rewinddir'
14750d_rmdir='$d_rmdir'
14751d_safebcpy='$d_safebcpy'
14752d_safemcpy='$d_safemcpy'
14753d_sanemcmp='$d_sanemcmp'
14754d_sched_yield='$d_sched_yield'
de4597cb 14755d_scm_rights='$d_scm_rights'
5f80c64f
JH
14756d_seekdir='$d_seekdir'
14757d_select='$d_select'
14758d_sem='$d_sem'
14759d_semctl='$d_semctl'
14760d_semctl_semid_ds='$d_semctl_semid_ds'
14761d_semctl_semun='$d_semctl_semun'
14762d_semget='$d_semget'
14763d_semop='$d_semop'
14764d_setegid='$d_setegid'
14765d_seteuid='$d_seteuid'
14766d_setgrent='$d_setgrent'
14767d_setgrps='$d_setgrps'
14768d_sethent='$d_sethent'
14769d_setlinebuf='$d_setlinebuf'
14770d_setlocale='$d_setlocale'
14771d_setnent='$d_setnent'
14772d_setpent='$d_setpent'
14773d_setpgid='$d_setpgid'
14774d_setpgrp2='$d_setpgrp2'
14775d_setpgrp='$d_setpgrp'
14776d_setprior='$d_setprior'
14777d_setpwent='$d_setpwent'
14778d_setregid='$d_setregid'
14779d_setresgid='$d_setresgid'
14780d_setresuid='$d_setresuid'
14781d_setreuid='$d_setreuid'
14782d_setrgid='$d_setrgid'
14783d_setruid='$d_setruid'
14784d_setsent='$d_setsent'
14785d_setsid='$d_setsid'
f1066039 14786d_setspent='$d_setspent'
5f80c64f
JH
14787d_setvbuf='$d_setvbuf'
14788d_sfio='$d_sfio'
14789d_shm='$d_shm'
14790d_shmat='$d_shmat'
14791d_shmatprototype='$d_shmatprototype'
14792d_shmctl='$d_shmctl'
14793d_shmdt='$d_shmdt'
14794d_shmget='$d_shmget'
14795d_sigaction='$d_sigaction'
14796d_sigsetjmp='$d_sigsetjmp'
14797d_socket='$d_socket'
14798d_sockpair='$d_sockpair'
68d4903c 14799d_sqrtl='$d_sqrtl'
5f80c64f 14800d_statblks='$d_statblks'
0545a864
JH
14801d_statfs_f_flags='$d_statfs_f_flags'
14802d_statfs_s='$d_statfs_s'
104d25b7 14803d_statvfs='$d_statvfs'
5f80c64f
JH
14804d_stdio_cnt_lval='$d_stdio_cnt_lval'
14805d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 14806d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
14807d_stdiobase='$d_stdiobase'
14808d_stdstdio='$d_stdstdio'
5f80c64f
JH
14809d_strchr='$d_strchr'
14810d_strcoll='$d_strcoll'
14811d_strctcpy='$d_strctcpy'
14812d_strerrm='$d_strerrm'
14813d_strerror='$d_strerror'
14814d_strtod='$d_strtod'
14815d_strtol='$d_strtol'
ff935051 14816d_strtold='$d_strtold'
76d49b1c 14817d_strtoll='$d_strtoll'
5f80c64f 14818d_strtoul='$d_strtoul'
cf2093f6 14819d_strtoull='$d_strtoull'
ff935051 14820d_strtouq='$d_strtouq'
5f80c64f
JH
14821d_strxfrm='$d_strxfrm'
14822d_suidsafe='$d_suidsafe'
14823d_symlink='$d_symlink'
14824d_syscall='$d_syscall'
14825d_sysconf='$d_sysconf'
14826d_sysernlst='$d_sysernlst'
14827d_syserrlst='$d_syserrlst'
14828d_system='$d_system'
14829d_tcgetpgrp='$d_tcgetpgrp'
14830d_tcsetpgrp='$d_tcsetpgrp'
5f80c64f 14831d_telldir='$d_telldir'
cb86ce0e 14832d_telldirproto='$d_telldirproto'
5f80c64f
JH
14833d_time='$d_time'
14834d_times='$d_times'
5f80c64f
JH
14835d_truncate='$d_truncate'
14836d_tzname='$d_tzname'
14837d_umask='$d_umask'
14838d_uname='$d_uname'
14839d_union_semun='$d_union_semun'
0545a864 14840d_ustat='$d_ustat'
717c4fcc 14841d_vendorbin='$d_vendorbin'
a3635516 14842d_vendorlib='$d_vendorlib'
5f80c64f
JH
14843d_vfork='$d_vfork'
14844d_void_closedir='$d_void_closedir'
14845d_voidsig='$d_voidsig'
14846d_voidtty='$d_voidtty'
14847d_volatile='$d_volatile'
14848d_vprintf='$d_vprintf'
14849d_wait4='$d_wait4'
14850d_waitpid='$d_waitpid'
14851d_wcstombs='$d_wcstombs'
14852d_wctomb='$d_wctomb'
14853d_xenix='$d_xenix'
14854date='$date'
14855db_hashtype='$db_hashtype'
14856db_prefixtype='$db_prefixtype'
14857defvoidused='$defvoidused'
14858direntrytype='$direntrytype'
14859dlext='$dlext'
14860dlsrc='$dlsrc'
14861doublesize='$doublesize'
14862drand01='$drand01'
14863dynamic_ext='$dynamic_ext'
14864eagain='$eagain'
14865ebcdic='$ebcdic'
14866echo='$echo'
14867egrep='$egrep'
14868emacs='$emacs'
14869eunicefix='$eunicefix'
14870exe_ext='$exe_ext'
14871expr='$expr'
14872extensions='$extensions'
66fe083f 14873fflushNULL='$fflushNULL'
767df6a1 14874fflushall='$fflushall'
5f80c64f
JH
14875find='$find'
14876firstmakefile='$firstmakefile'
14877flex='$flex'
8175356b 14878fpossize='$fpossize'
5f80c64f
JH
14879fpostype='$fpostype'
14880freetype='$freetype'
ccc7f9b3 14881full_ar='$full_ar'
5f80c64f
JH
14882full_csh='$full_csh'
14883full_sed='$full_sed'
14884gccversion='$gccversion'
a22e52b9 14885gidformat='$gidformat'
785fb66b
JH
14886gidsign='$gidsign'
14887gidsize='$gidsize'
5f80c64f
JH
14888gidtype='$gidtype'
14889glibpth='$glibpth'
14890grep='$grep'
14891groupcat='$groupcat'
14892groupstype='$groupstype'
14893gzip='$gzip'
14894h_fcntl='$h_fcntl'
14895h_sysfile='$h_sysfile'
14896hint='$hint'
14897hostcat='$hostcat'
14898huge='$huge'
8175356b
JH
14899i16size='$i16size'
14900i16type='$i16type'
14901i32size='$i32size'
14902i32type='$i32type'
14903i64size='$i64size'
14904i64type='$i64type'
14905i8size='$i8size'
14906i8type='$i8type'
5f80c64f
JH
14907i_arpainet='$i_arpainet'
14908i_bsdioctl='$i_bsdioctl'
14909i_db='$i_db'
14910i_dbm='$i_dbm'
14911i_dirent='$i_dirent'
14912i_dld='$i_dld'
14913i_dlfcn='$i_dlfcn'
14914i_fcntl='$i_fcntl'
14915i_float='$i_float'
14916i_gdbm='$i_gdbm'
14917i_grp='$i_grp'
43999f95 14918i_iconv='$i_iconv'
5f80c64f
JH
14919i_inttypes='$i_inttypes'
14920i_limits='$i_limits'
14921i_locale='$i_locale'
7f3d1cf1 14922i_machcthr='$i_machcthr'
5f80c64f
JH
14923i_malloc='$i_malloc'
14924i_math='$i_math'
14925i_memory='$i_memory'
e7fb4fcc 14926i_mntent='$i_mntent'
5f80c64f
JH
14927i_ndbm='$i_ndbm'
14928i_netdb='$i_netdb'
14929i_neterrno='$i_neterrno'
9cc6feab 14930i_netinettcp='$i_netinettcp'
5f80c64f 14931i_niin='$i_niin'
5b34fd99 14932i_poll='$i_poll'
c4747d3e 14933i_pthread='$i_pthread'
5f80c64f
JH
14934i_pwd='$i_pwd'
14935i_rpcsvcdbm='$i_rpcsvcdbm'
14936i_sfio='$i_sfio'
14937i_sgtty='$i_sgtty'
f1066039 14938i_shadow='$i_shadow'
86959918 14939i_socks='$i_socks'
5f80c64f
JH
14940i_stdarg='$i_stdarg'
14941i_stddef='$i_stddef'
14942i_stdlib='$i_stdlib'
14943i_string='$i_string'
14944i_sysaccess='$i_sysaccess'
14945i_sysdir='$i_sysdir'
14946i_sysfile='$i_sysfile'
14947i_sysfilio='$i_sysfilio'
14948i_sysin='$i_sysin'
14949i_sysioctl='$i_sysioctl'
ca52efda 14950i_syslog='$i_syslog'
fe749a9f 14951i_sysmman='$i_sysmman'
104d25b7 14952i_sysmount='$i_sysmount'
5f80c64f
JH
14953i_sysndir='$i_sysndir'
14954i_sysparam='$i_sysparam'
14955i_sysresrc='$i_sysresrc'
14956i_syssecrt='$i_syssecrt'
14957i_sysselct='$i_sysselct'
14958i_syssockio='$i_syssockio'
14959i_sysstat='$i_sysstat'
0545a864 14960i_sysstatfs='$i_sysstatfs'
104d25b7 14961i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
14962i_systime='$i_systime'
14963i_systimek='$i_systimek'
14964i_systimes='$i_systimes'
14965i_systypes='$i_systypes'
de4597cb 14966i_sysuio='$i_sysuio'
5f80c64f 14967i_sysun='$i_sysun'
d4935d7f 14968i_sysutsname='$i_sysutsname'
0545a864 14969i_sysvfs='$i_sysvfs'
5f80c64f
JH
14970i_syswait='$i_syswait'
14971i_termio='$i_termio'
14972i_termios='$i_termios'
14973i_time='$i_time'
14974i_unistd='$i_unistd'
0545a864 14975i_ustat='$i_ustat'
5f80c64f
JH
14976i_utime='$i_utime'
14977i_values='$i_values'
14978i_varargs='$i_varargs'
14979i_varhdr='$i_varhdr'
14980i_vfork='$i_vfork'
14981ignore_versioned_solibs='$ignore_versioned_solibs'
ff935051 14982inc_version_list='$inc_version_list'
3a096bf3 14983inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
14984incpath='$incpath'
14985inews='$inews'
14986installarchlib='$installarchlib'
14987installbin='$installbin'
14988installman1dir='$installman1dir'
14989installman3dir='$installman3dir'
dd4e71fd
JH
14990installprefix='$installprefix'
14991installprefixexp='$installprefixexp'
5f80c64f
JH
14992installprivlib='$installprivlib'
14993installscript='$installscript'
14994installsitearch='$installsitearch'
717c4fcc 14995installsitebin='$installsitebin'
5f80c64f 14996installsitelib='$installsitelib'
dd4e71fd 14997installstyle='$installstyle'
104d25b7 14998installusrbinperl='$installusrbinperl'
717c4fcc 14999installvendorbin='$installvendorbin'
a3635516 15000installvendorlib='$installvendorlib'
5f80c64f 15001intsize='$intsize'
8175356b
JH
15002ivdformat='$ivdformat'
15003ivsize='$ivsize'
15004ivtype='$ivtype'
5f80c64f
JH
15005known_extensions='$known_extensions'
15006ksh='$ksh'
15007large='$large'
15008ld='$ld'
15009lddlflags='$lddlflags'
15010ldflags='$ldflags'
5cf1d1f1 15011ldlibpthname='$ldlibpthname'
5f80c64f
JH
15012less='$less'
15013lib_ext='$lib_ext'
15014libc='$libc'
15015libperl='$libperl'
15016libpth='$libpth'
15017libs='$libs'
43999f95
JH
15018libsdirs='$libsdirs'
15019libsfiles='$libsfiles'
15020libsfound='$libsfound'
5f80c64f
JH
15021libswanted='$libswanted'
15022line='$line'
15023lint='$lint'
15024lkflags='$lkflags'
15025ln='$ln'
15026lns='$lns'
15027locincpth='$locincpth'
15028loclibpth='$loclibpth'
15029longdblsize='$longdblsize'
15030longlongsize='$longlongsize'
15031longsize='$longsize'
15032lp='$lp'
15033lpr='$lpr'
15034ls='$ls'
15035lseeksize='$lseeksize'
15036lseektype='$lseektype'
15037mail='$mail'
15038mailx='$mailx'
15039make='$make'
15040make_set_make='$make_set_make'
15041mallocobj='$mallocobj'
15042mallocsrc='$mallocsrc'
15043malloctype='$malloctype'
15044man1dir='$man1dir'
15045man1direxp='$man1direxp'
15046man1ext='$man1ext'
15047man3dir='$man3dir'
15048man3direxp='$man3direxp'
15049man3ext='$man3ext'
15050medium='$medium'
5f80c64f
JH
15051mips_type='$mips_type'
15052mkdir='$mkdir'
fe749a9f 15053mmaptype='$mmaptype'
5f80c64f
JH
15054models='$models'
15055modetype='$modetype'
15056more='$more'
68c15b6f 15057multiarch='$multiarch'
5f80c64f
JH
15058mv='$mv'
15059myarchname='$myarchname'
15060mydomain='$mydomain'
15061myhostname='$myhostname'
15062myuname='$myuname'
15063n='$n'
15064netdb_hlen_type='$netdb_hlen_type'
15065netdb_host_type='$netdb_host_type'
15066netdb_name_type='$netdb_name_type'
15067netdb_net_type='$netdb_net_type'
15068nm='$nm'
15069nm_opt='$nm_opt'
15070nm_so_opt='$nm_so_opt'
15071nonxs_ext='$nonxs_ext'
15072nroff='$nroff'
8175356b
JH
15073nvsize='$nvsize'
15074nvtype='$nvtype'
5f80c64f
JH
15075o_nonblock='$o_nonblock'
15076obj_ext='$obj_ext'
ef4af2be 15077old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
15078optimize='$optimize'
15079orderlib='$orderlib'
15080osname='$osname'
15081osvers='$osvers'
15082package='$package'
15083pager='$pager'
15084passcat='$passcat'
15085patchlevel='$patchlevel'
15086path_sep='$path_sep'
15087perl='$perl'
15088perladmin='$perladmin'
15089perlpath='$perlpath'
15090pg='$pg'
15091phostname='$phostname'
15092pidtype='$pidtype'
15093plibpth='$plibpth'
fe749a9f 15094pm_apiversion='$pm_apiversion'
5f80c64f
JH
15095pmake='$pmake'
15096pr='$pr'
15097prefix='$prefix'
15098prefixexp='$prefixexp'
15099privlib='$privlib'
15100privlibexp='$privlibexp'
15101prototype='$prototype'
15102ptrsize='$ptrsize'
6b8eaf93 15103quadkind='$quadkind'
d7d93a81 15104quadtype='$quadtype'
5f80c64f
JH
15105randbits='$randbits'
15106randfunc='$randfunc'
15107randseedtype='$randseedtype'
15108ranlib='$ranlib'
15109rd_nodata='$rd_nodata'
15110rm='$rm'
15111rmail='$rmail'
15112runnm='$runnm'
cf2093f6
JH
15113sPRIEldbl='$sPRIEldbl'
15114sPRIFldbl='$sPRIFldbl'
15115sPRIGldbl='$sPRIGldbl'
15116sPRIX64='$sPRIX64'
15117sPRId64='$sPRId64'
15118sPRIeldbl='$sPRIeldbl'
15119sPRIfldbl='$sPRIfldbl'
15120sPRIgldbl='$sPRIgldbl'
15121sPRIi64='$sPRIi64'
15122sPRIo64='$sPRIo64'
15123sPRIu64='$sPRIu64'
15124sPRIx64='$sPRIx64'
5f80c64f
JH
15125sched_yield='$sched_yield'
15126scriptdir='$scriptdir'
15127scriptdirexp='$scriptdirexp'
15128sed='$sed'
15129seedfunc='$seedfunc'
15130selectminbits='$selectminbits'
15131selecttype='$selecttype'
15132sendmail='$sendmail'
15133sh='$sh'
15134shar='$shar'
15135sharpbang='$sharpbang'
15136shmattype='$shmattype'
15137shortsize='$shortsize'
15138shrpenv='$shrpenv'
15139shsharp='$shsharp'
af4c28eb 15140sig_count='$sig_count'
5f80c64f
JH
15141sig_name='$sig_name'
15142sig_name_init='$sig_name_init'
15143sig_num='$sig_num'
824a2ba3 15144sig_num_init='$sig_num_init'
5f80c64f
JH
15145signal_t='$signal_t'
15146sitearch='$sitearch'
15147sitearchexp='$sitearchexp'
717c4fcc
JH
15148sitebin='$sitebin'
15149sitebinexp='$sitebinexp'
5f80c64f
JH
15150sitelib='$sitelib'
15151sitelibexp='$sitelibexp'
dd4e71fd
JH
15152siteprefix='$siteprefix'
15153siteprefixexp='$siteprefixexp'
5f80c64f
JH
15154sizetype='$sizetype'
15155sleep='$sleep'
15156smail='$smail'
15157small='$small'
15158so='$so'
15159sockethdr='$sockethdr'
15160socketlib='$socketlib'
15161sort='$sort'
15162spackage='$spackage'
15163spitshell='$spitshell'
15164split='$split'
15165src='$src'
15166ssizetype='$ssizetype'
15167startperl='$startperl'
15168startsh='$startsh'
15169static_ext='$static_ext'
15170stdchar='$stdchar'
15171stdio_base='$stdio_base'
15172stdio_bufsiz='$stdio_bufsiz'
15173stdio_cnt='$stdio_cnt'
15174stdio_filbuf='$stdio_filbuf'
15175stdio_ptr='$stdio_ptr'
767df6a1 15176stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
15177strings='$strings'
15178submit='$submit'
15179subversion='$subversion'
15180sysman='$sysman'
15181tail='$tail'
15182tar='$tar'
15183tbl='$tbl'
15184tee='$tee'
15185test='$test'
15186timeincl='$timeincl'
15187timetype='$timetype'
15188touch='$touch'
15189tr='$tr'
15190trnl='$trnl'
15191troff='$troff'
8175356b
JH
15192u16size='$u16size'
15193u16type='$u16type'
15194u32size='$u32size'
15195u32type='$u32type'
15196u64size='$u64size'
15197u64type='$u64type'
15198u8size='$u8size'
15199u8type='$u8type'
a22e52b9 15200uidformat='$uidformat'
57def98f 15201uidsign='$uidsign'
785fb66b 15202uidsize='$uidsize'
5f80c64f
JH
15203uidtype='$uidtype'
15204uname='$uname'
15205uniq='$uniq'
d7d93a81 15206uquadtype='$uquadtype'
aaacdc8b 15207use5005threads='$use5005threads'
5f80c64f
JH
15208use64bits='$use64bits'
15209usedl='$usedl'
aaacdc8b 15210useithreads='$useithreads'
249b38c6 15211uselargefiles='$uselargefiles'
b0ce926a 15212uselongdouble='$uselongdouble'
09458382 15213usemorebits='$usemorebits'
5f80c64f
JH
15214usemultiplicity='$usemultiplicity'
15215usemymalloc='$usemymalloc'
15216usenm='$usenm'
15217useopcode='$useopcode'
15218useperlio='$useperlio'
15219useposix='$useposix'
15220usesfio='$usesfio'
15221useshrplib='$useshrplib'
29209bc5 15222usesocks='$usesocks'
5f80c64f 15223usethreads='$usethreads'
a3635516 15224usevendorprefix='$usevendorprefix'
5f80c64f
JH
15225usevfork='$usevfork'
15226usrinc='$usrinc'
15227uuname='$uuname'
8175356b
JH
15228uvoformat='$uvoformat'
15229uvsize='$uvsize'
15230uvtype='$uvtype'
15231uvuformat='$uvuformat'
15232uvxformat='$uvxformat'
717c4fcc
JH
15233vendorbin='$vendorbin'
15234vendorbinexp='$vendorbinexp'
a3635516
JH
15235vendorlib='$vendorlib'
15236vendorlibexp='$vendorlibexp'
15237vendorprefix='$vendorprefix'
15238vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
15239version='$version'
15240vi='$vi'
15241voidflags='$voidflags'
15242xlibpth='$xlibpth'
fe749a9f 15243xs_apiversion='$xs_apiversion'
5f80c64f
JH
15244zcat='$zcat'
15245zip='$zip'
15246EOT
15247
15248: Add in command line options if available
15249$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15250
15251: add special variables
15252$test -f $src/patchlevel.h && \
d00b958f 15253awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 15254echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
15255
15256: propagate old symbols
15257if $test -f UU/config.sh; then
15258 <UU/config.sh sort | uniq >UU/oldconfig.sh
15259 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15260 sort | uniq -u >UU/oldsyms
15261 set X `cat UU/oldsyms`
15262 shift
15263 case $# in
15264 0) ;;
15265 *)
15266 cat <<EOM
15267Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15268EOM
15269 echo "# Variables propagated from previous config.sh file." >>config.sh
15270 for sym in `cat UU/oldsyms`; do
15271 echo " Propagating $hint variable "'$'"$sym..."
15272 eval 'tmp="$'"${sym}"'"'
15273 echo "$tmp" | \
15274 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15275 done
15276 ;;
15277 esac
15278fi
15279
15280: Finish up by extracting the .SH files
15281case "$alldone" in
15282exit)
15283 $rm -rf UU
15284 echo "Done."
15285 exit 0
15286 ;;
15287cont)
15288 ;;
15289'')
15290 dflt=''
15291 nostick=true
15292 $cat <<EOM
15293
15294If you'd like to make any changes to the config.sh file before I begin
15295to configure things, do it as a shell escape now (e.g. !vi config.sh).
15296
15297EOM
15298 rp="Press return or use a shell escape to edit config.sh:"
15299 . UU/myread
15300 nostick=''
15301 case "$ans" in
15302 '') ;;
15303 *) : in case they cannot read
15304 sh 1>&4 -c "$ans";;
15305 esac
15306 ;;
15307esac
15308
15309: if this fails, just run all the .SH files by hand
15310. ./config.sh
15311
15312echo " "
15313exec 1>&4
15314. ./UU/extract
15315
15316if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15317 dflt=y
15318 case "$silent" in
15319 true) ;;
15320 *)
15321 $cat <<EOM
15322
15323Now you need to generate make dependencies by running "$make depend".
15324You might prefer to run it in background: "$make depend > makedepend.out &"
15325It can take a while, so you might not want to run it right now.
15326
15327EOM
15328 ;;
15329 esac
15330 rp="Run $make depend now?"
15331 . UU/myread
15332 case "$ans" in
15333 y*)
15334 $make depend && echo "Now you must run a $make."
15335 ;;
15336 *)
15337 echo "You must run '$make depend' then '$make'."
15338 ;;
15339 esac
15340elif test -f [Mm]akefile; then
15341 echo " "
15342 echo "Now you must run a $make."
15343else
15344 echo "Done."
15345fi
15346
15347if $test -f Policy.sh; then
15348 $cat <<EOM
15349
15350If you compile $package on a different machine or from a different object
15351directory, copy the Policy.sh file from this object directory to the
15352new one before you run Configure -- this will help you with most of
15353the policy defaults.
15354
15355EOM
15356fi
15357if $test -f config.msg; then
15358 echo "Hmm. I also noted the following information while running:"
15359 echo " "
15360 $cat config.msg >&4
15361 $rm -f config.msg
15362fi
15363$rm -f kit*isdone ark*isdone
15364$rm -rf UU
15365
15366: End of Configure
15367