This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
detypo
[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#
0f0995ae 23# Generated on Thu Feb 17 01:07:48 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=''
bf0c440f 656i_sysmode=''
104d25b7 657i_sysmount=''
2304df62 658i_sysndir=''
a0d0e21e 659i_sysparam=''
8ff267be 660i_sysresrc=''
5ff3f7a4 661i_syssecrt=''
2304df62 662i_sysselct=''
1aef975c 663i_sysstat=''
0545a864 664i_sysstatfs=''
104d25b7 665i_sysstatvfs=''
a0d0e21e 666i_systimes=''
fed7345c 667i_systypes=''
de4597cb 668i_sysuio=''
25f94b33 669i_sysun=''
d4935d7f 670i_sysutsname=''
0545a864 671i_sysvfs=''
8ff267be 672i_syswait=''
2304df62
AD
673i_sgtty=''
674i_termio=''
675i_termios=''
676i_systime=''
677i_systimek=''
678i_time=''
679timeincl=''
85e6fe83 680i_unistd=''
0545a864 681i_ustat=''
2304df62 682i_utime=''
760ac839 683i_values=''
a0d0e21e 684i_stdarg=''
2304df62
AD
685i_varargs=''
686i_varhdr=''
687i_vfork=''
ff935051 688inc_version_list=''
3a096bf3 689inc_version_list_init=''
dd4e71fd
JH
690installprefix=''
691installprefixexp=''
692installstyle=''
104d25b7 693installusrbinperl=''
2304df62 694intsize=''
24fef2a7
AD
695longsize=''
696shortsize=''
d9b3e12d 697d_fpos64_t=''
2000072c 698d_off64_t=''
2304df62 699libc=''
5cf1d1f1 700ldlibpthname=''
8ff267be 701libperl=''
2afac517 702shrpenv=''
8ff267be 703useshrplib=''
a0d0e21e 704glibpth=''
2304df62 705libpth=''
8e07c86e 706loclibpth=''
2304df62
AD
707plibpth=''
708xlibpth=''
1cfa4ec7 709ignore_versioned_solibs=''
2304df62 710libs=''
43999f95
JH
711libsdirs=''
712libsfiles=''
713libsfound=''
85e6fe83 714lns=''
cf2093f6
JH
715d_PRIEldbl=''
716d_PRIFldbl=''
717d_PRIGldbl=''
718d_PRIeldbl=''
719d_PRIfldbl=''
720d_PRIgldbl=''
721sPRIEldbl=''
722sPRIFldbl=''
723sPRIGldbl=''
724sPRIeldbl=''
725sPRIfldbl=''
726sPRIgldbl=''
5ff3f7a4 727lseeksize=''
85e6fe83 728lseektype=''
8ff267be 729make_set_make=''
85e6fe83 730d_mymalloc=''
94b6baf5 731freetype=''
2304df62
AD
732mallocobj=''
733mallocsrc=''
734malloctype=''
735usemymalloc=''
16d20bd9
AD
736installman1dir=''
737man1dir=''
738man1direxp=''
739man1ext=''
740installman3dir=''
741man3dir=''
742man3direxp=''
743man3ext=''
2304df62
AD
744huge=''
745large=''
746medium=''
747models=''
748small=''
749split=''
a0d0e21e 750modetype=''
68c15b6f 751multiarch=''
2304df62
AD
752mydomain=''
753myhostname=''
754phostname=''
755c=''
756n=''
8e07c86e
AD
757d_eofnblk=''
758eagain=''
759o_nonblock=''
760rd_nodata=''
dfe9444c
AD
761netdb_hlen_type=''
762netdb_host_type=''
763netdb_name_type=''
764netdb_net_type=''
2304df62
AD
765groupcat=''
766hostcat=''
767passcat=''
85e6fe83
LW
768orderlib=''
769ranlib=''
2304df62
AD
770package=''
771spackage=''
2c7991dc 772pager=''
ff935051
JH
773api_revision=''
774api_subversion=''
775api_version=''
776api_versionstring=''
ecfc5424 777patchlevel=''
760ac839 778subversion=''
bfb7748a 779version=''
8e07c86e 780perladmin=''
4633a7c4 781perlpath=''
78691af5 782d_nv_preserves_uv=''
8175356b
JH
783i16size=''
784i16type=''
785i32size=''
786i32type=''
787i64size=''
788i64type=''
789i8size=''
790i8type=''
791ivsize=''
792ivtype=''
793nvsize=''
794nvtype=''
795u16size=''
796u16type=''
797u32size=''
798u32type=''
799u64size=''
800u64type=''
801u8size=''
802u8type=''
803uvsize=''
804uvtype=''
805ivdformat=''
806uvoformat=''
807uvuformat=''
808uvxformat=''
dfe9444c 809pidtype=''
a0d0e21e 810prefix=''
1aef975c 811prefixexp=''
2304df62
AD
812installprivlib=''
813privlib=''
814privlibexp=''
815prototype=''
693762b4 816ptrsize=''
cf2093f6
JH
817d_PRIX64=''
818d_PRId64=''
819d_PRIi64=''
820d_PRIo64=''
821d_PRIu64=''
822d_PRIx64=''
823sPRIX64=''
824sPRId64=''
825sPRIi64=''
826sPRIo64=''
827sPRIu64=''
828sPRIx64=''
de1c2614 829d_quad=''
6b8eaf93 830quadkind=''
d7d93a81
JH
831quadtype=''
832uquadtype=''
85ab1d1d 833drand01=''
2304df62 834randbits=''
85ab1d1d
JH
835randfunc=''
836randseedtype=''
837seedfunc=''
2304df62
AD
838installscript=''
839scriptdir=''
840scriptdirexp=''
5ff3f7a4 841selectminbits=''
a0d0e21e 842selecttype=''
8ff267be 843sh=''
af4c28eb 844sig_count=''
2304df62 845sig_name=''
dfe9444c 846sig_name_init=''
8e07c86e 847sig_num=''
824a2ba3 848sig_num_init=''
4633a7c4
LW
849installsitearch=''
850sitearch=''
851sitearchexp=''
717c4fcc
JH
852installsitebin=''
853sitebin=''
854sitebinexp=''
25f94b33
AD
855installsitelib=''
856sitelib=''
857sitelibexp=''
dd4e71fd
JH
858siteprefix=''
859siteprefixexp=''
a0d0e21e
LW
860sizetype=''
861so=''
2304df62
AD
862sharpbang=''
863shsharp=''
864spitshell=''
dfe9444c 865src=''
a0d0e21e 866ssizetype=''
4633a7c4 867startperl=''
2304df62
AD
868startsh=''
869stdchar=''
ed39a0f2 870d_stdio_stream_array=''
767df6a1 871stdio_stream_array=''
2304df62 872sysman=''
5ff3f7a4 873trnl=''
a22e52b9 874uidformat=''
57def98f 875uidsign=''
785fb66b 876uidsize=''
2304df62 877uidtype=''
85ab1d1d 878archname64=''
5ff3f7a4 879use64bits=''
249b38c6 880uselargefiles=''
b0ce926a 881uselongdouble=''
09458382 882usemorebits=''
85ab1d1d 883usemultiplicity=''
2304df62 884nm_opt=''
40a7a20a 885nm_so_opt=''
2304df62
AD
886runnm=''
887usenm=''
8ff267be 888useperlio=''
29209bc5 889usesocks=''
693762b4 890d_oldpthreads=''
aaacdc8b
GS
891use5005threads=''
892useithreads=''
dfe9444c 893usethreads=''
2304df62 894incpath=''
2304df62
AD
895mips_type=''
896usrinc=''
717c4fcc
JH
897d_vendorbin=''
898installvendorbin=''
899vendorbin=''
900vendorbinexp=''
a3635516
JH
901d_vendorlib=''
902installvendorlib=''
903vendorlib=''
904vendorlibexp=''
905usevendorprefix=''
906vendorprefix=''
907vendorprefixexp=''
2304df62
AD
908defvoidused=''
909voidflags=''
fe749a9f
JH
910pm_apiversion=''
911xs_apiversion=''
2304df62
AD
912CONFIG=''
913
ecfc5424
AD
914define='define'
915undef='undef'
916smallmach='pdp11 i8086 z8000 i80286 iAPX286'
917rmlist=''
918
919: We must find out about Eunice early
920eunicefix=':'
921if test -f /etc/unixtovms; then
922 eunicefix=/etc/unixtovms
923fi
924if test -f /etc/unixtovms.exe; then
925 eunicefix=/etc/unixtovms.exe
926fi
927
5ff3f7a4 928i_whoami=''
ff935051
JH
929: set useposix=false in your hint file to disable the POSIX extension.
930useposix=true
931: set useopcode=false in your hint file to disable the Opcode extension.
932useopcode=true
dfe9444c 933: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 934_exe=''
dfe9444c
AD
935: Extra object files, if any, needed on this platform.
936archobjs=''
ff935051
JH
937: Possible local include directories to search.
938: Set locincpth to "" in a hint file to defeat local include searches.
939locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
940locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
941:
942: no include file wanted by default
943inclwanted=''
944
dfe9444c 945groupstype=''
732c9516
JH
946: change the next line if compiling for Xenix/286 on Xenix/386
947xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
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
bf0c440f 953glibpth="/usr/lib/large /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
0f0995ae
JH
2614case "$usethreads" in
2615$define|true|[yY]*) dflt='y';;
2616*) dflt='n';;
2617esac
64e689dc
JH
2618cat <<EOM
2619
3645a519 2620Perl can be built to take advantage of threads on some systems.
0f0995ae 2621To do so, Configure can be run with -Dusethreads.
d00b958f
JH
2622
2623Note that threading is a highly experimental feature, and
2624some known race conditions still remain. If you choose to try
2625it, be very sure to not actually deploy it for production
2626purposes. README.threads has more details, and is required
2627reading if you enable threads.
0f0995ae
JH
2628
2629If this doesn't make any sense to you, just accept the default '$dflt'.
64e689dc 2630EOM
64e689dc
JH
2631rp='Build a threading Perl?'
2632. ./myread
2633case "$ans" in
aaacdc8b 2634y|Y) val="$define" ;;
64e689dc 2635*) val="$undef" ;;
dfe9444c 2636esac
64e689dc 2637set usethreads
aaacdc8b
GS
2638eval $setvar
2639
2640case "$usethreads" in
2641$define)
2642 $cat <<EOM
2643
ff42dc34 2644As of 5.5.640, Perl has two different internal threading implementations,
aaacdc8b
GS
2645the 5.005 version (5005threads) and an interpreter-based version
2646(ithreads) that has one interpreter per thread. Both are very
2647experimental. This arrangement exists to help developers work out
2648which one is better.
3645a519
JH
2649
2650If you're a casual user, you probably don't want interpreter-threads
2651at this time. There doesn't yet exist a way to create threads from
2652within Perl in this model, i.e., "use Thread;" will NOT work.
aaacdc8b
GS
2653EOM
2654 : Default to ithreads unless overridden on command line or with
2655 : old config.sh
2656 dflt='y'
2657 case "$use5005threads" in
2658 $define|true|[yY]*) dflt='n';;
2659 esac
2660 case "$useithreads" in
2661 $undef|false|[nN]*) dflt='n';;
2662 esac
2663 rp='Use interpreter-based ithreads?'
2664 . ./myread
2665 case "$ans" in
2666 y|Y) val="$define" ;;
2667 *) val="$undef" ;;
2668 esac
2669 set useithreads
2670 eval $setvar
2671 : Now set use5005threads to the opposite value.
2672 case "$useithreads" in
2673 $define) val="$undef" ;;
2674 *) val="$define" ;;
2675 esac
2676 set use5005threads
2677 eval $setvar
2678 ;;
2679*)
2680 useithreads="$undef"
2681 use5005threads="$undef"
2682 ;;
2683esac
104d25b7 2684
693762b4
AD
2685case "$d_oldpthreads" in
2686'') : Configure tests would be welcome here. For now, assume undef.
2687 val="$undef" ;;
2688*) val="$d_oldpthreads" ;;
2689esac
2690set d_oldpthreads
2691eval $setvar
dfe9444c 2692
b691c02f
JH
2693
2694case "$usethreads" in
104d25b7
JH
2695"$define"|true|[yY]*)
2696: Look for a hint-file generated 'call-back-unit'. If the
2697: user has specified that a threading perl is to be built,
2698: we may need to set or change some other defaults.
2699 if $test -f usethreads.cbu; then
e5e20432 2700 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2701 . ./usethreads.cbu
e5e20432
JH
2702 else
2703 $cat <<EOM
2704(Your platform doesn't have any specific hints for threaded builds.
2705 Assuming POSIX threads, then.)
b691c02f 2706EOM
e5e20432 2707 fi
aaacdc8b 2708 ;;
e5e20432 2709esac
104d25b7 2710
ff935051 2711cat <<EOM
64e689dc 2712
ff935051
JH
2713Perl can be built so that multiple Perl interpreters can coexist
2714within the same Perl executable.
2715EOM
64e689dc 2716
ff935051
JH
2717case "$useithreads" in
2718$define)
2719 cat <<EOM
2720This multiple interpreter support is required for interpreter-based threads.
64e689dc 2721EOM
ff935051
JH
2722 val="$define"
2723 ;;
0f0995ae 2724*) case "$usemultiplicity" in
ff42dc34
GS
2725 $define|true|[yY]*) dflt='y';;
2726 *) dflt='n';;
2727 esac
0f0995ae 2728 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
ff42dc34
GS
2729 rp='Build Perl for multiplicity?'
2730 . ./myread
2731 case "$ans" in
ff935051 2732 y|Y) val="$define" ;;
ff42dc34
GS
2733 *) val="$undef" ;;
2734 esac
2735 ;;
64e689dc
JH
2736esac
2737set usemultiplicity
ff935051 2738eval $setvar
64e689dc 2739
e5e20432
JH
2740: determine where manual pages are on this system
2741echo " "
2742case "$sysman" in
2743'')
2744 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2745 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2746 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2747 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2748 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2749 sysman=`./loc . /usr/man/man1 $syspath`
2750 ;;
2751esac
2752if $test -d "$sysman"; then
2753 echo "System manual is in $sysman." >&4
2754else
2755 echo "Could not find manual pages in source form." >&4
2756fi
2757
2758: see what memory models we can support
2759case "$models" in
2760'')
2761 $cat >pdp11.c <<'EOP'
2762int main() {
2763#ifdef pdp11
2764 exit(0);
2765#else
2766 exit(1);
2767#endif
2768}
2769EOP
2770 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2771 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2772 dflt='unsplit split'
2773 else
2774 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2775 case "$tans" in
2776 X) dflt='none';;
2777 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2778 dflt='small'
2779 else
2780 dflt=''
2781 fi
2782 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2783 dflt="$dflt medium"
2784 fi
2785 if $test -d /lib/large || $test -d /usr/lib/large; then
2786 dflt="$dflt large"
2787 fi
2788 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2789 dflt="$dflt huge"
2790 fi
2791 esac
2792 fi;;
2793*) dflt="$models";;
2794esac
2795$cat <<EOM
2796
2797Some systems have different model sizes. On most systems they are called
2798small, medium, large, and huge. On the PDP11 they are called unsplit and
2799split. If your system doesn't support different memory models, say "none".
2800If you wish to force everything to one memory model, say "none" here and
2801put the appropriate flags later when it asks you for other cc and ld flags.
2802Venix systems may wish to put "none" and let the compiler figure things out.
2803(In the following question multiple model names should be space separated.)
2804
2805The default for most systems is "none".
2806
2807EOM
2808rp="Which memory models are supported?"
2809. ./myread
2810models="$ans"
2811
2812case "$models" in
2813none)
2814 small=''
2815 medium=''
2816 large=''
2817 huge=''
2818 unsplit=''
2819 split=''
2820 ;;
2821*split)
2822 case "$split" in
2823 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2824 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2825 dflt='-i'
2826 else
2827 dflt='none'
2828 fi;;
2829 *) dflt="$split";;
2830 esac
2831 rp="What flag indicates separate I and D space?"
2832 . ./myread
2833 tans="$ans"
2834 case "$tans" in
2835 none) tans='';;
2836 esac
2837 split="$tans"
2838 unsplit='';;
2839*large*|*small*|*medium*|*huge*)
2840 case "$models" in
2841 *large*)
2842 case "$large" in
2843 '') dflt='-Ml';;
2844 *) dflt="$large";;
2845 esac
2846 rp="What flag indicates large model?"
2847 . ./myread
2848 tans="$ans"
2849 case "$tans" in
2850 none) tans='';
2851 esac
2852 large="$tans";;
2853 *) large='';;
2854 esac
2855 case "$models" in
2856 *huge*) case "$huge" in
2857 '') dflt='-Mh';;
2858 *) dflt="$huge";;
2859 esac
2860 rp="What flag indicates huge model?"
2861 . ./myread
2862 tans="$ans"
2863 case "$tans" in
2864 none) tans='';
2865 esac
2866 huge="$tans";;
2867 *) huge="$large";;
2868 esac
2869 case "$models" in
2870 *medium*) case "$medium" in
2871 '') dflt='-Mm';;
2872 *) dflt="$medium";;
2873 esac
2874 rp="What flag indicates medium model?"
2875 . ./myread
2876 tans="$ans"
2877 case "$tans" in
2878 none) tans='';
2879 esac
2880 medium="$tans";;
2881 *) medium="$large";;
2882 esac
2883 case "$models" in
2884 *small*) case "$small" in
2885 '') dflt='none';;
2886 *) dflt="$small";;
2887 esac
2888 rp="What flag indicates small model?"
2889 . ./myread
2890 tans="$ans"
2891 case "$tans" in
2892 none) tans='';
2893 esac
2894 small="$tans";;
2895 *) small='';;
2896 esac
2897 ;;
2898*)
2899 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2900 ;;
2901esac
2902$rm -f pdp11.* pdp11
2903
2904: make some quick guesses about what we are up against
2905echo " "
2906$echo $n "Hmm... $c"
2907echo exit 1 >bsd
2908echo exit 1 >usg
2909echo exit 1 >v7
2910echo exit 1 >osf1
2911echo exit 1 >eunice
2912echo exit 1 >xenix
2913echo exit 1 >venix
2914echo exit 1 >os2
2915d_bsd="$undef"
2916$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2917if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2918then
2919 echo "Looks kind of like an OSF/1 system, but we'll see..."
2920 echo exit 0 >osf1
2921elif test `echo abc | tr a-z A-Z` = Abc ; then
2922 xxx=`./loc addbib blurfl $pth`
2923 if $test -f $xxx; then
2924 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2925 echo exit 0 >bsd
2926 echo exit 0 >usg
2927 else
2928 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2929 echo "Looks kind of like an extended USG system, but we'll see..."
2930 else
2931 echo "Looks kind of like a USG system, but we'll see..."
2932 fi
2933 echo exit 0 >usg
2934 fi
2935elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2936 echo "Looks kind of like a BSD system, but we'll see..."
2937 d_bsd="$define"
2938 echo exit 0 >bsd
2939else
2940 echo "Looks kind of like a Version 7 system, but we'll see..."
2941 echo exit 0 >v7
2942fi
2943case "$eunicefix" in
2944*unixtovms*)
2945 $cat <<'EOI'
2946There is, however, a strange, musty smell in the air that reminds me of
2947something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2948EOI
2949 echo exit 0 >eunice
2950 d_eunice="$define"
2951: it so happens the Eunice I know will not run shell scripts in Unix format
2952 ;;
2953*)
2954 echo " "
2955 echo "Congratulations. You aren't running Eunice."
2956 d_eunice="$undef"
2957 ;;
2958esac
2959: Detect OS2. The p_ variable is set above in the Head.U unit.
2960case "$p_" in
2961:) ;;
2962*)
2963 $cat <<'EOI'
2964I have the feeling something is not exactly right, however...don't tell me...
2965lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2966EOI
2967 echo exit 0 >os2
2968 ;;
2969esac
2970if test -f /xenix; then
2971 echo "Actually, this looks more like a XENIX system..."
2972 echo exit 0 >xenix
2973 d_xenix="$define"
2974else
2975 echo " "
2976 echo "It's not Xenix..."
2977 d_xenix="$undef"
2978fi
2979chmod +x xenix
2980$eunicefix xenix
2981if test -f /venix; then
2982 echo "Actually, this looks more like a VENIX system..."
2983 echo exit 0 >venix
2984else
2985 echo " "
2986 if ./xenix; then
2987 : null
2988 else
2989 echo "Nor is it Venix..."
2990 fi
2991fi
2992chmod +x bsd usg v7 osf1 eunice xenix venix os2
2993$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2994$rm -f foo
2995
2996: see if we need a special compiler
2997echo " "
2998if ./usg; then
2999 case "$cc" in
3000 '') case "$Mcc" in
3001 /*) dflt='Mcc';;
3002 *) case "$large" in
3003 -M*) dflt='cc';;
3004 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3005 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3006 dflt='cc'
3007 else
3008 dflt='cc -M'
3009 fi
3010 else
3011 dflt='cc'
3012 fi;;
3013 esac;;
3014 esac;;
3015 *) dflt="$cc";;
3016 esac
3017 case "$dflt" in
3018 *M*) $cat <<'EOM'
3019On some older systems the default C compiler will not resolve multiple global
3020references that happen to have the same name. On some such systems the "Mcc"
3021command may be used to force these to be resolved. On other systems a "cc -M"
3022command is required. (Note that the -M flag on other systems indicates a
3023memory model to use!) If you have the Gnu C compiler, you might wish to use
3024that instead.
3025
3026EOM
3027 ;;
3028 esac
3029 rp="Use which C compiler?"
3030 . ./myread
3031 cc="$ans"
3032else
3033 case "$cc" in
3034 '') dflt=cc;;
3035 *) dflt="$cc";;
3036 esac
3037 rp="Use which C compiler?"
3038 . ./myread
3039 cc="$ans"
3040fi
3041: Look for a hint-file generated 'call-back-unit'. Now that the
3042: user has specified the compiler, we may need to set or change some
3043: other defaults.
3044if $test -f cc.cbu; then
3045 . ./cc.cbu
3046fi
3047echo " "
3048echo "Checking for GNU cc in disguise and/or its version number..." >&4
3049$cat >gccvers.c <<EOM
3050#include <stdio.h>
3051int main() {
3052#ifdef __GNUC__
3053#ifdef __VERSION__
3054 printf("%s\n", __VERSION__);
3055#else
3056 printf("%s\n", "1");
3057#endif
3058#endif
3059 exit(0);
3060}
3061EOM
bf0c440f 3062if $cc $ldflags -o gccvers gccvers.c; then
e5e20432
JH
3063 gccversion=`./gccvers`
3064 case "$gccversion" in
3065 '') echo "You are not using GNU cc." ;;
fc68435e 3066 *) echo "You are using GNU cc $gccversion."
fc68435e 3067 ;;
e5e20432
JH
3068 esac
3069else
3070 echo " "
3071 echo "*** WHOA THERE!!! ***" >&4
3072 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3073 case "$knowitall" in
3074 '')
3075 echo " You'd better start hunting for one and let me know about it." >&4
3076 exit 1
3077 ;;
3078 esac
3079fi
3080$rm -f gccvers*
3081case "$gccversion" in
30821*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3083esac
3084
bd9b35c9
JH
3085: decide how portable to be. Allow command line overrides.
3086case "$d_portable" in
3087"$undef") ;;
3088*) d_portable="$define" ;;
104d25b7 3089esac
85ab1d1d 3090
bd9b35c9
JH
3091: set up shell script to do ~ expansion
3092cat >filexp <<EOSS
3093$startsh
3094: expand filename
3095case "\$1" in
3096 ~/*|~)
3097 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3098 ;;
3099 ~*)
3100 if $test -f /bin/csh; then
3101 /bin/csh -f -c "glob \$1"
3102 failed=\$?
3103 echo ""
3104 exit \$failed
e5e20432 3105 else
bd9b35c9
JH
3106 name=\`$expr x\$1 : '..\([^/]*\)'\`
3107 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3108 if $test ! -d "\$dir"; then
3109 me=\`basename \$0\`
3110 echo "\$me: can't locate home directory for: \$name" >&2
3111 exit 1
3112 fi
3113 case "\$1" in
3114 */*)
3115 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3116 ;;
3117 *)
3118 echo \$dir
e5e20432
JH
3119 ;;
3120 esac
3121 fi
b691c02f 3122 ;;
4633a7c4 3123*)
bd9b35c9 3124 echo \$1
2304df62
AD
3125 ;;
3126esac
4633a7c4
LW
3127EOSS
3128chmod +x filexp
3129$eunicefix filexp
2304df62
AD
3130
3131: now set up to get a file name
28757baa 3132cat <<EOS >getfile
3133$startsh
3134EOS
3135cat <<'EOSC' >>getfile
2304df62
AD
3136tilde=''
3137fullpath=''
3138already=''
3139skip=''
3140none_ok=''
3141exp_file=''
a0d0e21e 3142nopath_ok=''
2304df62
AD
3143orig_rp="$rp"
3144orig_dflt="$dflt"
b233458b
JH
3145case "$gfpth" in
3146'') gfpth='.' ;;
3147esac
2304df62
AD
3148
3149case "$fn" in
ecfc5424 3150*\(*)
28e8609d 3151 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3152 fn=`echo $fn | sed 's/(.*)//'`
3153 ;;
3154esac
3155
3156case "$fn" in
a0d0e21e
LW
3157*:*)
3158 loc_file=`expr $fn : '.*:\(.*\)'`
3159 fn=`expr $fn : '\(.*\):.*'`
3160 ;;
3161esac
3162
3163case "$fn" in
2304df62
AD
3164*~*) tilde=true;;
3165esac
3166case "$fn" in
3167*/*) fullpath=true;;
3168esac
3169case "$fn" in
3170*+*) skip=true;;
3171esac
3172case "$fn" in
3173*n*) none_ok=true;;
3174esac
3175case "$fn" in
3176*e*) exp_file=true;;
3177esac
a0d0e21e
LW
3178case "$fn" in
3179*p*) nopath_ok=true;;
3180esac
2304df62
AD
3181
3182case "$fn" in
3183*f*) type='File';;
3184*d*) type='Directory';;
a0d0e21e 3185*l*) type='Locate';;
2304df62
AD
3186esac
3187
3188what="$type"
3189case "$what" in
3190Locate) what='File';;
3191esac
3192
3193case "$exp_file" in
3194'')
3195 case "$d_portable" in
3196 "$define") ;;
3197 *) exp_file=true;;
3198 esac
3199 ;;
3200esac
3201
3202cd ..
3203while test "$type"; do
3204 redo=''
3205 rp="$orig_rp"
3206 dflt="$orig_dflt"
3207 case "$tilde" in
3208 true) rp="$rp (~name ok)";;
3209 esac
3210 . UU/myread
ecfc5424
AD
3211 if test -f UU/getfile.ok && \
3212 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3213 then
3214 value="$ans"
3215 ansexp="$ans"
3216 break
3217 fi
2304df62
AD
3218 case "$ans" in
3219 none)
3220 value=''
3221 ansexp=''
3222 case "$none_ok" in
3223 true) type='';;
3224 esac
3225 ;;
3226 *)
3227 case "$tilde" in
3228 '') value="$ans"
3229 ansexp="$ans";;
3230 *)
3231 value=`UU/filexp $ans`
3232 case $? in
3233 0)
3234 if test "$ans" != "$value"; then
ecfc5424 3235 echo "(That expands to $value on this system.)"
2304df62
AD
3236 fi
3237 ;;
3238 *) value="$ans";;
3239 esac
3240 ansexp="$value"
3241 case "$exp_file" in
3242 '') value="$ans";;
3243 esac
3244 ;;
3245 esac
3246 case "$fullpath" in
3247 true)
3248 case "$ansexp" in
3249 /*) value="$ansexp" ;;
3250 *)
3251 redo=true
3252 case "$already" in
3253 true)
3254 echo "I shall only accept a full path name, as in /bin/ls." >&4
3255 echo "Use a ! shell escape if you wish to check pathnames." >&4
3256 ;;
3257 *)
3258 echo "Please give a full path name, starting with slash." >&4
3259 case "$tilde" in
3260 true)
3261 echo "Note that using ~name is ok provided it expands well." >&4
3262 already=true
3263 ;;
3264 esac
3265 esac
3266 ;;
3267 esac
3268 ;;
3269 esac
3270 case "$redo" in
3271 '')
3272 case "$type" in
3273 File)
b233458b
JH
3274 for fp in $gfpth; do
3275 if test "X$fp" = X.; then
3276 pf="$ansexp"
3277 else
3278 pf="$fp/$ansexp"
3279 fi
3280 if test -f "$pf"; then
3281 type=''
3282 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3283 then
3284 echo "($value is not a plain file, but that's ok.)"
3285 type=''
3286 fi
3287 if test X"$type" = X; then
3288 value="$pf"
3289 break
3290 fi
3291 done
2304df62
AD
3292 ;;
3293 Directory)
b233458b
JH
3294 for fp in $gfpth; do
3295 if test "X$fp" = X.; then
3296 pf="$ansexp"
3297 else
3298 pf="$fp/$ansexp"
3299 fi
3300 if test -d "$pf"; then
3301 type=''
3302 value="$pf"
3303 break
3304 fi
3305 done
2304df62
AD
3306 ;;
3307 Locate)
40000a8c 3308 if test -d "$ansexp"; then
a0d0e21e
LW
3309 echo "(Looking for $loc_file in directory $value.)"
3310 value="$value/$loc_file"
40000a8c 3311 ansexp="$ansexp/$loc_file"
2304df62 3312 fi
40000a8c 3313 if test -f "$ansexp"; then
2304df62
AD
3314 type=''
3315 fi
a0d0e21e
LW
3316 case "$nopath_ok" in
3317 true) case "$value" in
3318 */*) ;;
3319 *) echo "Assuming $value will be in people's path."
3320 type=''
3321 ;;
3322 esac
3323 ;;
3324 esac
2304df62
AD
3325 ;;
3326 esac
3327
3328 case "$skip" in
3329 true) type='';
3330 esac
3331
3332 case "$type" in
3333 '') ;;
3334 *)
3335 if test "$fastread" = yes; then
3336 dflt=y
3337 else
3338 dflt=n
3339 fi
3340 rp="$what $value doesn't exist. Use that name anyway?"
3341 . UU/myread
3342 dflt=''
3343 case "$ans" in
3344 y*) type='';;
3345 *) echo " ";;
3346 esac
3347 ;;
3348 esac
3349 ;;
3350 esac
3351 ;;
3352 esac
3353done
3354cd UU
3355ans="$value"
3356rp="$orig_rp"
3357dflt="$orig_dflt"
ecfc5424 3358rm -f getfile.ok
b233458b 3359test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3360EOSC
3361
bd9b35c9
JH
3362: What should the include directory be ?
3363echo " "
3364$echo $n "Hmm... $c"
3365dflt='/usr/include'
3366incpath=''
3367mips_type=''
3368if $test -f /bin/mips && /bin/mips; then
3369 echo "Looks like a MIPS system..."
3370 $cat >usr.c <<'EOCP'
3371#ifdef SYSTYPE_BSD43
3372/bsd43
3373#endif
3374EOCP
3375 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3376 dflt='/bsd43/usr/include'
3377 incpath='/bsd43'
3378 mips_type='BSD 4.3'
3379 else
3380 mips_type='System V'
3381 fi
3382 $rm -f usr.c usr.out
3383 echo "and you're compiling with the $mips_type compiler and libraries."
3384 xxx_prompt=y
3385 echo "exit 0" >mips
3386else
3387 echo "Doesn't look like a MIPS system."
3388 xxx_prompt=n
3389 echo "exit 1" >mips
3390fi
3391chmod +x mips
3392$eunicefix mips
3393case "$usrinc" in
3394'') ;;
3395*) dflt="$usrinc";;
3396esac
3397case "$xxx_prompt" in
3398y) fn=d/
3399 echo " "
3400 rp='Where are the include files you want to use?'
3401 . ./getfile
3402 usrinc="$ans"
8e07c86e 3403 ;;
bd9b35c9 3404*) usrinc="$dflt"
8e07c86e
AD
3405 ;;
3406esac
2304df62 3407
fc68435e
JH
3408: see how we invoke the C preprocessor
3409echo " "
3410echo "Now, how can we feed standard input to your C preprocessor..." >&4
3411cat <<'EOT' >testcpp.c
3412#define ABC abc
3413#define XYZ xyz
3414ABC.XYZ
3415EOT
3416cd ..
3417if test ! -f cppstdin; then
3418 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3419 # AIX cc -E doesn't show the absolute headerfile
3420 # locations but we'll cheat by using the -M flag.
3421 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
3422 else
3423 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3424 fi
3425else
3426 echo "Keeping your $hint cppstdin wrapper."
3427fi
3428chmod 755 cppstdin
3429wrapper=`pwd`/cppstdin
3430ok='false'
3431cd UU
3432
3433if $test "X$cppstdin" != "X" && \
3434 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3435 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3436then
3437 echo "You used to use $cppstdin $cppminus so we'll use that again."
3438 case "$cpprun" in
3439 '') echo "But let's see if we can live without a wrapper..." ;;
3440 *)
3441 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3442 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3443 then
3444 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3445 ok='true'
3446 else
3447 echo "(However, $cpprun $cpplast does not work, let's see...)"
3448 fi
3449 ;;
3450 esac
3451else
3452 case "$cppstdin" in
3453 '') ;;
3454 *)
3455 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3456 ;;
3457 esac
3458fi
3459
3460if $ok; then
3461 : nothing
3462elif echo 'Maybe "'"$cc"' -E" will work...'; \
3463 $cc -E <testcpp.c >testcpp.out 2>&1; \
3464 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3465 echo "Yup, it does."
3466 x_cpp="$cc -E"
3467 x_minus='';
3468elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3469 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3470 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3471 echo "Yup, it does."
3472 x_cpp="$cc -E"
3473 x_minus='-';
3474elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3475 $cc -P <testcpp.c >testcpp.out 2>&1; \
3476 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3477 echo "Yipee, that works!"
3478 x_cpp="$cc -P"
3479 x_minus='';
3480elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3481 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3482 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3483 echo "At long last!"
3484 x_cpp="$cc -P"
3485 x_minus='-';
3486elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3487 $cpp <testcpp.c >testcpp.out 2>&1; \
3488 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3489 echo "It works!"
3490 x_cpp="$cpp"
3491 x_minus='';
3492elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3493 $cpp - <testcpp.c >testcpp.out 2>&1; \
3494 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3495 echo "Hooray, it works! I was beginning to wonder."
3496 x_cpp="$cpp"
3497 x_minus='-';
3498elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3499 $wrapper <testcpp.c >testcpp.out 2>&1; \
3500 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3501 x_cpp="$wrapper"
3502 x_minus=''
3503 echo "Eureka!"
3504else
3505 dflt=''
3506 rp="No dice. I can't find a C preprocessor. Name one:"
3507 . ./myread
3508 x_cpp="$ans"
3509 x_minus=''
3510 $x_cpp <testcpp.c >testcpp.out 2>&1
3511 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3512 echo "OK, that will do." >&4
3513 else
3514echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3515 exit 1
3516 fi
3517fi
3518
3519case "$ok" in
3520false)
3521 cppstdin="$x_cpp"
3522 cppminus="$x_minus"
3523 cpprun="$x_cpp"
3524 cpplast="$x_minus"
3525 set X $x_cpp
3526 shift
3527 case "$1" in
3528 "$cpp")
3529 echo "Perhaps can we force $cc -E using a wrapper..."
3530 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3531 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3532 then
3533 echo "Yup, we can."
3534 cppstdin="$wrapper"
3535 cppminus='';
3536 else
3537 echo "Nope, we'll have to live without it..."
3538 fi
3539 ;;
3540 esac
3541 case "$cpprun" in
3542 "$wrapper")
3543 cpprun=''
3544 cpplast=''
3545 ;;
3546 esac
3547 ;;
3548esac
3549
3550case "$cppstdin" in
3551"$wrapper"|'cppstdin') ;;
3552*) $rm -f $wrapper;;
3553esac
3554$rm -f testcpp.c testcpp.out
3555
bd9b35c9
JH
3556: Set private lib path
3557case "$plibpth" in
3558'') if ./mips; then
3559 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3560 fi;;
3561esac
3562case "$libpth" in
3563' ') dlist='';;
3564'') dlist="$loclibpth $plibpth $glibpth";;
3565*) dlist="$libpth";;
3566esac
3567
3568: Now check and see which directories actually exist, avoiding duplicates
3569libpth=''
3570for xxx in $dlist
3571do
3572 if $test -d $xxx; then
3573 case " $libpth " in
3574 *" $xxx "*) ;;
3575 *) libpth="$libpth $xxx";;
3576 esac
3577 fi
3578done
3579$cat <<'EOM'
3580
3581Some systems have incompatible or broken versions of libraries. Among
3582the directories listed in the question below, please remove any you
3583know not to be holding relevant libraries, and add any that are needed.
3584Say "none" for none.
8e07c86e
AD
3585
3586EOM
bd9b35c9
JH
3587case "$libpth" in
3588'') dflt='none';;
8e07c86e 3589*)
bd9b35c9
JH
3590 set X $libpth
3591 shift
3592 dflt=${1+"$@"}
8e07c86e 3593 ;;
a0d0e21e 3594esac
bd9b35c9
JH
3595rp="Directories to use for library searches?"
3596. ./myread
3597case "$ans" in
3598none) libpth=' ';;
3599*) libpth="$ans";;
3600esac
a0d0e21e 3601
bd9b35c9
JH
3602: compute shared library extension
3603case "$so" in
3604'')
3605 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3606 dflt='sl'
dd4e71fd 3607 else
bd9b35c9 3608 dflt='so'
dd4e71fd
JH
3609 fi
3610 ;;
bd9b35c9 3611*) dflt="$so";;
dd4e71fd 3612esac
dd4e71fd
JH
3613$cat <<EOM
3614
bd9b35c9 3615On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3616you want to suppress searching of shared libraries for the remainder
bd9b35c9 3617of this configuration.
dd4e71fd
JH
3618
3619EOM
bd9b35c9
JH
3620rp='What is the file extension used for shared libraries?'
3621. ./myread
3622so="$ans"
dd4e71fd 3623
bd9b35c9
JH
3624: Define several unixisms.
3625: Hints files or command line option can be used to override them.
3626: The convoluted testing is in case hints files set either the old
3627: or the new name.
3628case "$_exe" in
3629'') case "$exe_ext" in
3630 '') ;;
3631 *) _exe="$exe_ext" ;;
dd4e71fd 3632 esac
bd9b35c9 3633 ;;
bfb7748a 3634esac
bd9b35c9
JH
3635case "$_a" in
3636'') case "$lib_ext" in
3637 '') _a='.a';;
3638 *) _a="$lib_ext" ;;
dd4e71fd
JH
3639 esac
3640 ;;
dd4e71fd 3641esac
bd9b35c9
JH
3642case "$_o" in
3643'') case "$obj_ext" in
3644 '') _o='.o';;
3645 *) _o="$obj_ext";;
3646 esac
3647 ;;
3648esac
3649case "$p_" in
3650'') case "$path_sep" in
3651 '') p_=':';;
3652 *) p_="$path_sep";;
3653 esac
3654 ;;
3655esac
3656exe_ext=$_exe
3657lib_ext=$_a
3658obj_ext=$_o
3659path_sep=$p_
dd4e71fd 3660
bd9b35c9
JH
3661: Which makefile gets called first. This is used by make depend.
3662case "$firstmakefile" in
3663'') firstmakefile='makefile';;
4633a7c4 3664esac
4633a7c4 3665
0f0995ae
JH
3666case "$usesocks" in
3667$define|true|[yY]*) dflt='y';;
3668*) dflt='n';;
3669esac
bd9b35c9 3670cat <<EOM
4633a7c4 3671
bd9b35c9
JH
3672Perl can be built to use the SOCKS proxy protocol library. To do so,
3673Configure must be run with -Dusesocks.
4633a7c4 3674
0f0995ae 3675If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3676EOM
bd9b35c9
JH
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 4286 val="$define" ;;
0f0995ae
JH
4287*) case "$uselargefiles" in
4288 "$undef"|false|[nN]*) dflt='n' ;;
4289 *) dflt='y' ;;
4290 esac
4291 cat <<EOM
8e07c86e 4292
bd9b35c9 4293Perl can be built to understand large files (files larger than 2 gigabytes)
0f0995ae 4294on some systems. To do so, Configure can be run with -Duselargefiles.
bd9b35c9 4295
0f0995ae 4296If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4297EOM
bd9b35c9
JH
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 4409Perl can be built to take advantage of 64-bit integer types
0f0995ae 4410on some systems. To do so, Configure can 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
d7d93a81
JH
7015case "$ccflags" in
7016*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7017esac
7018
b0ce926a
JH
7019case "$uselongdouble" in
7020$define|true|[yY]*) dflt='y';;
7021*) dflt='n';;
7022esac
0f0995ae
JH
7023cat <<EOM
7024
7025Perl can be built to take advantage of long doubles which
7026(if available) may give more accuracy and range for floating point numbers.
7027
7028If this doesn't make any sense to you, just accept the default '$dflt'.
7029EOM
b0ce926a
JH
7030rp='Try to use long doubles if available?'
7031. ./myread
7032case "$ans" in
309d43cf
JH
7033y|Y) val="$define" ;;
7034*) val="$undef" ;;
b0ce926a
JH
7035esac
7036set uselongdouble
7037eval $setvar
7038
d9b3e12d 7039case "$uselongdouble" in
d7d93a81
JH
7040true|[yY]*) uselongdouble="$define" ;;
7041esac
7042
7043case "$uselongdouble" in
7044$define)
d9b3e12d
JH
7045: Look for a hint-file generated 'call-back-unit'. If the
7046: user has specified that long doubles should be used,
7047: we may need to set or change some other defaults.
7048 if $test -f uselongdouble.cbu; then
7049 echo "Your platform has some specific hints for long doubles, using them..."
7050 . ./uselongdouble.cbu
7051 else
7052 $cat <<EOM
7053(Your platform doesn't have any specific hints for long doubles.)
7054EOM
7055 fi
7056 ;;
7057esac
b0ce926a 7058
43999f95
JH
7059case "$uselongdouble:$d_sqrtl" in
7060$define:$undef)
7061 $cat <<EOM >&4
7062
7063You requested the use of long doubles but you do not seem to have
7064the mathematic functions for long doubles. I'm disabling the use
7065of long doubles.
7066EOM
7067 uselongdouble=$undef
7068 ;;
7069esac
7070
0f0995ae
JH
7071case "$useperlio" in
7072$define|true|[yY]*) dflt='y';;
7073*) dflt='n';;
7074esac
d7d93a81
JH
7075cat <<EOM
7076
85aff577
CS
7077Previous version of $package used the standard IO mechanisms as defined
7078in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 7079mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
7080the default. This abstraction layer can use AT&T's sfio (if you already
7081have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7082problems with some extension modules. Using PerlIO with stdio is safe,
7083but it is slower than plain stdio and therefore is not the default.
2afac517 7084
0f0995ae 7085If this doesn't make any sense to you, just accept the default '$dflt'.
2afac517 7086EOM
2afac517 7087rp='Use the experimental PerlIO abstraction layer?'
7088. ./myread
7089case "$ans" in
7090y|Y)
7091 val="$define"
7092 ;;
7093*)
7094 echo "Ok, doing things the stdio way"
7095 val="$undef"
7096 ;;
7097esac
7098set useperlio
7099eval $setvar
2304df62 7100
717c4fcc
JH
7101case "$vendorprefix" in
7102'') d_vendorbin="$undef"
7103 vendorbin=''
7104 vendorbinexp=''
7105 ;;
7106*) d_vendorbin="$define"
7107 : determine where vendor-supplied executables go.
7108 dflt=$vendorprefix/bin
7109 fn=d~+
7110 rp='Pathname for the vendor-supplied executables directory?'
7111 . ./getfile
7112 vendorbin="$ans"
7113 vendorbinexp="$ansexp"
7114 : Change installation prefix, if necessary.
7115 if $test X"$prefix" != X"$installprefix"; then
7116 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7117 else
7118 installvendorbin="$vendorbinexp"
7119 fi
7120 ;;
7121esac
7122
628e1a40
JH
7123: check for length of double
7124echo " "
7125case "$doublesize" in
7126'')
7127 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7128 $cat >try.c <<'EOCP'
7129#include <stdio.h>
7130int main()
7131{
7132 printf("%d\n", (int)sizeof(double));
7133 exit(0);
7134}
7135EOCP
7136 set try
7137 if eval $compile_ok; then
7138 doublesize=`./try`
7139 $echo " $doublesize bytes." >&4
7140 else
7141 dflt='8'
7142 echo "(I can't seem to compile the test program. Guessing...)"
7143 rp="What is the size of a double precision number (in bytes)?"
7144 . ./myread
7145 doublesize="$ans"
7146 fi
7147 ;;
7148esac
7149$rm -f try.c try
7150
7151: check for long doubles
7152echo " "
7153$echo $n "Checking to see if your system supports long double..." $c >&4
7154echo 'int main() { long double x = 7.0; }' > try.c
7155set try
7156if eval $compile; then
7157 val="$define"
7158 echo " Yes, it does." >&4
7159else
7160 val="$undef"
7161 echo " No, it doesn't." >&4
7162fi
7163$rm try.*
7164set d_longdbl
7165eval $setvar
7166
7167: check for length of long double
7168case "${d_longdbl}${longdblsize}" in
7169$define)
7170 echo " "
7171 $echo $n "Checking to see how big your long doubles are..." $c >&4
7172 $cat >try.c <<'EOCP'
7173#include <stdio.h>
7174int main()
7175{
7176 printf("%d\n", sizeof(long double));
7177}
7178EOCP
7179 set try
7180 set try
7181 if eval $compile; then
7182 longdblsize=`./try$exe_ext`
7183 $echo " $longdblsize bytes." >&4
7184 else
7185 dflt='8'
7186 echo " "
7187 echo "(I can't seem to compile the test program. Guessing...)" >&4
7188 rp="What is the size of a long double (in bytes)?"
7189 . ./myread
7190 longdblsize="$ans"
7191 fi
7192 if $test "X$doublesize" = "X$longdblsize"; then
7193 echo "(That isn't any different from an ordinary double.)"
7194 fi
7195 ;;
7196esac
7197$rm -f try.* try
ff935051 7198
8e07c86e 7199: Check how to convert floats to strings.
28e8609d 7200if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
7201 echo " "
7202 echo "Checking for an efficient way to convert floats to strings."
628e1a40 7203 $cat >try.c <<EOP
8e07c86e
AD
7204#ifdef TRY_gconvert
7205#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 7206char *myname = "gconvert";
8e07c86e
AD
7207#endif
7208#ifdef TRY_gcvt
7209#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 7210char *myname = "gcvt";
8e07c86e 7211#endif
ff935051
JH
7212#ifdef TRY_qgcvt
7213#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7214char *myname = "qgcvt";
628e1a40 7215#define DOUBLETYPE long double
ff935051 7216#endif
8e07c86e
AD
7217#ifdef TRY_sprintf
7218#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 7219char *myname = "sprintf";
8e07c86e 7220#endif
8ff267be 7221
628e1a40
JH
7222#ifndef DOUBLETYPE
7223#define DOUBLETYPE double
7224#endif
7225
8ff267be 7226#include <stdio.h>
7227
43999f95 7228#define I_STDLIB $i_stdlib
628e1a40
JH
7229#ifdef I_STDLIB
7230#include <stdlib.h>
7231#endif
7232
8ff267be 7233int
7234checkit(expect, got)
7235char *expect;
7236char *got;
7237{
7238 if (strcmp(expect, got)) {
7239 printf("%s oddity: Expected %s, got %s\n",
7240 myname, expect, got);
7241 exit(1);
7242 }
7243}
7244
5a411a32 7245int main()
8ff267be 7246{
ecfc5424 7247 char buf[64];
8ff267be 7248 buf[63] = '\0';
7249
7250 /* This must be 1st test on (which?) platform */
7251 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
628e1a40 7252 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8ff267be 7253 checkit("0.1", buf);
7254
628e1a40 7255 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8ff267be 7256 checkit("1", buf);
7257
628e1a40 7258 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8ff267be 7259 checkit("0", buf);
7260
628e1a40 7261 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8ff267be 7262 checkit("-1", buf);
7263
7264 /* Some Linux gcvt's give 1.e+5 here. */
628e1a40 7265 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8ff267be 7266 checkit("100000", buf);
7267
7268 /* Some Linux gcvt's give -1.e+5 here. */
628e1a40 7269 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8ff267be 7270 checkit("-100000", buf);
7271
ecfc5424 7272 exit(0);
a0d0e21e
LW
7273}
7274EOP
5ff3f7a4
GS
7275 case "$d_Gconvert" in
7276 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7277 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7278 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7279 *) xxx_list='gconvert gcvt sprintf' ;;
7280 esac
8e07c86e 7281
628e1a40
JH
7282 case "$d_longdbl$uselongdouble" in
7283 definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
ff935051
JH
7284 esac
7285
5ff3f7a4 7286 for xxx_convert in $xxx_list; do
ff935051 7287 echo "Trying $xxx_convert..."
5ff3f7a4
GS
7288 $rm -f try try$_o
7289 set try -DTRY_$xxx_convert
7290 if eval $compile; then
628e1a40 7291 echo "$xxx_convert() found." >&4
5ff3f7a4
GS
7292 if ./try; then
7293 echo "I'll use $xxx_convert to convert floats into a string." >&4
7294 break;
7295 else
7296 echo "...But $xxx_convert didn't work as I expected."
7297 fi
2304df62 7298 else
5ff3f7a4 7299 echo "$xxx_convert NOT found." >&4
2304df62 7300 fi
5ff3f7a4 7301 done
8e07c86e 7302
5ff3f7a4
GS
7303 case "$xxx_convert" in
7304 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7305 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
ff935051 7306 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
5ff3f7a4
GS
7307 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7308 esac
28e8609d 7309fi
2304df62 7310
cf2093f6
JH
7311echo " "
7312
ea1c3b15 7313if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
7314
7315echo "Checking how to print long doubles..." >&4
7316
7317if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7318 $cat >try.c <<'EOCP'
7319#include <sys/types.h>
7320#include <stdio.h>
7321int main() {
7322 double d = 123.456;
7323 printf("%.3f\n", d);
7324}
7325EOCP
7326 set try
7327 if eval $compile; then
7328 yyy=`./try$exe_ext`
7329 case "$yyy" in
7330 123.456)
7331 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7332 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7333 echo "We will use %f."
7334 ;;
7335 esac
7336 fi
7337fi
7338
7339if $test X"$sPRIfldbl" = X; then
7340 $cat >try.c <<'EOCP'
7341#include <sys/types.h>
7342#include <stdio.h>
7343int main() {
7344 long double d = 123.456;
ea1c3b15 7345 printf("%.3llf\n", d);
cf2093f6
JH
7346}
7347EOCP
7348 set try
7349 if eval $compile; then
7350 yyy=`./try$exe_ext`
7351 case "$yyy" in
7352 123.456)
ea1c3b15
JH
7353 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7354 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7355 echo "We will use %llf."
cf2093f6
JH
7356 ;;
7357 esac
7358 fi
7359fi
7360
7361if $test X"$sPRIfldbl" = X; then
7362 $cat >try.c <<'EOCP'
7363#include <sys/types.h>
7364#include <stdio.h>
7365int main() {
7366 long double d = 123.456;
ea1c3b15 7367 printf("%.3Lf\n", d);
cf2093f6
JH
7368}
7369EOCP
7370 set try
7371 if eval $compile; then
7372 yyy=`./try$exe_ext`
7373 case "$yyy" in
7374 123.456)
ea1c3b15
JH
7375 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7376 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7377 echo "We will use %Lf."
cf2093f6
JH
7378 ;;
7379 esac
7380 fi
7381fi
7382
11dc3f68 7383if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7384 $cat >try.c <<'EOCP'
7385#include <sys/types.h>
7386#include <stdio.h>
7387int main() {
7388 long double d = 123.456;
ea1c3b15 7389 printf("%.3lf\n", d);
cf2093f6
JH
7390}
7391EOCP
7392 set try
7393 if eval $compile; then
7394 yyy=`./try$exe_ext`
7395 case "$yyy" in
7396 123.456)
ea1c3b15
JH
7397 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7398 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7399 echo "We will use %lf."
cf2093f6
JH
7400 ;;
7401 esac
7402 fi
7403fi
7404
09e3ef00
JH
7405if $test X"$sPRIfldbl" = X; then
7406 echo "Cannot figure out how to print long doubles." >&4
7407fi
7408
ea1c3b15 7409$rm -f try try.*
cf2093f6 7410
ea1c3b15 7411fi # d_longdbl
cf2093f6
JH
7412
7413case "$sPRIfldbl" in
7414'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7415 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7416 ;;
7417*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7418 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7419 ;;
7420esac
7421
a0d0e21e
LW
7422: Initialize h_fcntl
7423h_fcntl=false
7424
7425: Initialize h_sysfile
7426h_sysfile=false
2304df62 7427
2304df62
AD
7428: access call always available on UNIX
7429set access d_access
7430eval $inlibc
7431
7432: locate the flags for 'access()'
7433case "$d_access" in
7434"$define")
7435 echo " "
7436 $cat >access.c <<'EOCP'
7437#include <sys/types.h>
7438#ifdef I_FCNTL
7439#include <fcntl.h>
7440#endif
7441#ifdef I_SYS_FILE
7442#include <sys/file.h>
7443#endif
7444#ifdef I_UNISTD
7445#include <unistd.h>
7446#endif
d674cd6d 7447int main() {
2304df62
AD
7448 exit(R_OK);
7449}
8e07c86e
AD
7450EOCP
7451 : check sys/file.h first, no particular reason here
7452 if $test `./findhdr sys/file.h` && \
dfe9444c 7453 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7454 h_sysfile=true;
7455 echo "<sys/file.h> defines the *_OK access constants." >&4
7456 elif $test `./findhdr fcntl.h` && \
dfe9444c 7457 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7458 h_fcntl=true;
7459 echo "<fcntl.h> defines the *_OK access constants." >&4
7460 elif $test `./findhdr unistd.h` && \
dfe9444c 7461 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7462 echo "<unistd.h> defines the *_OK access constants." >&4
7463 else
7464 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7465 fi
7466 ;;
7467esac
7468$rm -f access*
a0d0e21e 7469
5ff3f7a4
GS
7470: see if accessx exists
7471set accessx d_accessx
7472eval $inlibc
7473
8e07c86e
AD
7474: see if alarm exists
7475set alarm d_alarm
7476eval $inlibc
2304df62 7477
cf2093f6
JH
7478: see if atolf exists
7479set atolf d_atolf
7480eval $inlibc
7481
7482: see if atoll exists
7483set atoll d_atoll
7484eval $inlibc
7485
ecfc5424 7486: Look for GNU-cc style attribute checking
2304df62 7487echo " "
a0d0e21e
LW
7488echo "Checking whether your compiler can handle __attribute__ ..." >&4
7489$cat >attrib.c <<'EOCP'
1aef975c 7490#include <stdio.h>
ecfc5424 7491void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7492EOCP
7493if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7494 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7495 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7496 val="$undef"
7497 else
ecfc5424 7498 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7499 val="$define"
7500 fi
7501else
ecfc5424 7502 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7503 val="$undef"
7504fi
ecfc5424 7505set d_attribut
a0d0e21e
LW
7506eval $setvar
7507$rm -f attrib*
7508
7509: see if bcmp exists
7510set bcmp d_bcmp
7511eval $inlibc
7512
7513: see if bcopy exists
7514set bcopy d_bcopy
7515eval $inlibc
7516
2afac517 7517: see if this is a unistd.h system
7518set unistd.h i_unistd
7519eval $inhdr
7520
7521: see if getpgrp exists
7522set getpgrp d_getpgrp
7523eval $inlibc
7524
2afac517 7525case "$d_getpgrp" in
7526"$define")
7527 echo " "
dfe9444c 7528 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7529 $cat >set.c <<EOP
7530#$i_unistd I_UNISTD
7531#include <sys/types.h>
7532#ifdef I_UNISTD
7533# include <unistd.h>
7534#endif
5a411a32 7535int main()
2afac517 7536{
7537 if (getuid() == 0) {
7538 printf("(I see you are running Configure as super-user...)\n");
7539 setuid(1);
7540 }
7541#ifdef TRY_BSD_PGRP
7542 if (getpgrp(1) == 0)
7543 exit(0);
7544#else
7545 if (getpgrp() > 0)
7546 exit(0);
7547#endif
7548 exit(1);
7549}
7550EOP
7551 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7552 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7553 val="$define"
7554 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7555 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7556 val="$undef"
7557 else
7558 echo "I can't seem to compile and run the test program."
7559 if ./usg; then
7560 xxx="a USG one, i.e. you use getpgrp()."
7561 else
7562 # SVR4 systems can appear rather BSD-ish.
7563 case "$i_unistd" in
7564 $undef)
7565 xxx="a BSD one, i.e. you use getpgrp(pid)."
7566 val="$define"
7567 ;;
7568 $define)
7569 xxx="probably a USG one, i.e. you use getpgrp()."
7570 val="$undef"
7571 ;;
7572 esac
7573 fi
7574 echo "Assuming your getpgrp is $xxx" >&4
7575 fi
7576 ;;
7577*) val="$undef";;
7578esac
7579set d_bsdgetpgrp
7580eval $setvar
7581$rm -f set set.c
7582
a0d0e21e
LW
7583: see if setpgrp exists
7584set setpgrp d_setpgrp
7585eval $inlibc
7586
a0d0e21e
LW
7587case "$d_setpgrp" in
7588"$define")
7589 echo " "
dfe9444c 7590 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7591 $cat >set.c <<EOP
2afac517 7592#$i_unistd I_UNISTD
7593#include <sys/types.h>
7594#ifdef I_UNISTD
7595# include <unistd.h>
7596#endif
5a411a32 7597int main()
a0d0e21e
LW
7598{
7599 if (getuid() == 0) {
7600 printf("(I see you are running Configure as super-user...)\n");
7601 setuid(1);
7602 }
2afac517 7603#ifdef TRY_BSD_PGRP
a0d0e21e 7604 if (-1 == setpgrp(1, 1))
2afac517 7605 exit(0);
7606#else
7607 if (setpgrp() != -1)
7608 exit(0);
7609#endif
7610 exit(1);
a0d0e21e
LW
7611}
7612EOP
2afac517 7613 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7614 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7615 val="$define"
7616 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7617 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7618 val="$undef"
a0d0e21e 7619 else
dfe9444c 7620 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7621 if ./usg; then
2afac517 7622 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7623 else
2afac517 7624 # SVR4 systems can appear rather BSD-ish.
7625 case "$i_unistd" in
7626 $undef)
7627 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7628 val="$define"
7629 ;;
7630 $define)
7631 xxx="probably a USG one, i.e. you use setpgrp()."
7632 val="$undef"
7633 ;;
7634 esac
a0d0e21e 7635 fi
2afac517 7636 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7637 fi
7638 ;;
7639*) val="$undef";;
7640esac
2afac517 7641set d_bsdsetpgrp
a0d0e21e
LW
7642eval $setvar
7643$rm -f set set.c
a0d0e21e
LW
7644: see if bzero exists
7645set bzero d_bzero
7646eval $inlibc
7647
ecfc5424 7648: see if signal is declared as pointer to function returning int or void
a0d0e21e 7649echo " "
ecfc5424
AD
7650xxx=`./findhdr signal.h`
7651$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7652if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7653 echo "You have int (*signal())() instead of void." >&4
7654 val="$undef"
7655elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7656 echo "You have void (*signal())()." >&4
ecfc5424
AD
7657 val="$define"
7658elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7659 echo "You have int (*signal())() instead of void." >&4
7660 val="$undef"
dfe9444c
AD
7661elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7662 echo "You have void (*signal())()." >&4
7663 val="$define"
a0d0e21e 7664else
ecfc5424
AD
7665 case "$d_voidsig" in
7666 '')
7667 echo "I can't determine whether signal handler returns void or int..." >&4
7668 dflt=void
7669 rp="What type does your signal handler return?"
7670 . ./myread
7671 case "$ans" in
7672 v*) val="$define";;
7673 *) val="$undef";;
7674 esac;;
7675 "$define")
dfe9444c
AD
7676 echo "As you already told me, signal handler returns void." >&4
7677 val="$define"
7678 ;;
7679 *) echo "As you already told me, signal handler returns int." >&4
7680 val="$undef"
7681 ;;
ecfc5424
AD
7682 esac
7683fi
7684set d_voidsig
7685eval $setvar
7686case "$d_voidsig" in
7687"$define") signal_t="void";;
7688*) signal_t="int";;
7689esac
7690$rm -f $$.tmp
7691
7692: check for ability to cast large floats to 32-bit ints.
7693echo " "
7694echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7695if $test "$intsize" -ge 4; then
ecfc5424
AD
7696 xxx=int
7697else
7698 xxx=long
7699fi
7700$cat >try.c <<EOCP
e5c9fcd0 7701#include <stdio.h>
ecfc5424
AD
7702#include <sys/types.h>
7703#include <signal.h>
a1896f58 7704$signal_t blech(s) int s; { exit(3); }
d674cd6d 7705int main()
2304df62 7706{
a0d0e21e 7707 $xxx i32;
e5c9fcd0 7708 double f, g;
2304df62 7709 int result = 0;
89434db5 7710 char str[16];
2304df62
AD
7711 signal(SIGFPE, blech);
7712
89434db5
AD
7713 /* Don't let compiler optimize the test away. Store the number
7714 in a writable string for gcc to pass to sscanf under HP/UX.
7715 */
7716 sprintf(str, "2147483647");
7717 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7718 g = 10 * f;
7719 i32 = ($xxx) g;
2304df62 7720
e5c9fcd0
AD
7721 /* x86 processors will probably give 0x8000 0000, which is a
7722 sign change. We don't want that. We want to mimic SPARC
7723 behavior here, which is to preserve the sign and give
7724 back 0x7fff ffff.
7725 */
a0d0e21e 7726 if (i32 != ($xxx) f)
2304df62
AD
7727 result |= 1;
7728 exit(result);
7729}
7730EOCP
dfe9444c 7731set try
dc45a647 7732if eval $compile_ok; then
2304df62
AD
7733 ./try
7734 yyy=$?
7735else
a0d0e21e 7736 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
7737 yyy=1
7738fi
7739case "$yyy" in
77400) val="$define"
7741 echo "Yup, it can."
7742 ;;
7743*) val="$undef"
7744 echo "Nope, it can't."
7745 ;;
7746esac
7747set d_casti32
7748eval $setvar
85e6fe83 7749$rm -f try try.*
a0d0e21e 7750
2304df62
AD
7751: check for ability to cast negative floats to unsigned
7752echo " "
7753echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 7754$cat >try.c <<EOCP
e5c9fcd0 7755#include <stdio.h>
ecfc5424 7756#include <sys/types.h>
2304df62 7757#include <signal.h>
a1896f58
AD
7758$signal_t blech(s) int s; { exit(7); }
7759$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
7760unsigned long dummy_long(p) unsigned long p; { return p; }
7761unsigned int dummy_int(p) unsigned int p; { return p; }
7762unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 7763int main()
2304df62 7764{
e5c9fcd0 7765 double f;
2304df62
AD
7766 unsigned long along;
7767 unsigned int aint;
7768 unsigned short ashort;
7769 int result = 0;
89434db5
AD
7770 char str[16];
7771
e5c9fcd0
AD
7772 /* Frustrate gcc-2.7.2's optimizer which failed this test with
7773 a direct f = -123. assignment. gcc-2.8.0 reportedly
7774 optimized the whole file away
7775 */
89434db5
AD
7776 /* Store the number in a writable string for gcc to pass to
7777 sscanf under HP/UX.
7778 */
7779 sprintf(str, "-123");
7780 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
7781
7782 signal(SIGFPE, blech);
7783 along = (unsigned long)f;
7784 aint = (unsigned int)f;
7785 ashort = (unsigned short)f;
7786 if (along != (unsigned long)-123)
7787 result |= 1;
7788 if (aint != (unsigned int)-123)
7789 result |= 1;
7790 if (ashort != (unsigned short)-123)
7791 result |= 1;
89434db5
AD
7792 sprintf(str, "1073741824.");
7793 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
7794 f = f + f;
7795 along = 0;
7796 along = (unsigned long)f;
7797 if (along != 0x80000000)
7798 result |= 2;
7799 f -= 1.;
7800 along = 0;
7801 along = (unsigned long)f;
7802 if (along != 0x7fffffff)
7803 result |= 1;
7804 f += 2.;
7805 along = 0;
7806 along = (unsigned long)f;
7807 if (along != 0x80000001)
7808 result |= 2;
232e078e
AD
7809 if (result)
7810 exit(result);
7811 signal(SIGFPE, blech_in_list);
89434db5
AD
7812 sprintf(str, "123.");
7813 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
7814 along = dummy_long((unsigned long)f);
7815 aint = dummy_int((unsigned int)f);
7816 ashort = dummy_short((unsigned short)f);
7817 if (along != (unsigned long)123)
7818 result |= 4;
7819 if (aint != (unsigned int)123)
7820 result |= 4;
7821 if (ashort != (unsigned short)123)
7822 result |= 4;
2304df62
AD
7823 exit(result);
7824
7825}
7826EOCP
dfe9444c 7827set try
dc45a647 7828if eval $compile_ok; then
2304df62
AD
7829 ./try
7830 castflags=$?
7831else
ecfc5424 7832 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 7833 castflags=7
2304df62
AD
7834fi
7835case "$castflags" in
78360) val="$define"
7837 echo "Yup, it can."
7838 ;;
7839*) val="$undef"
7840 echo "Nope, it can't."
7841 ;;
7842esac
7843set d_castneg
7844eval $setvar
7845$rm -f try.*
7846
2304df62
AD
7847: see if vprintf exists
7848echo " "
7849if set vprintf val -f d_vprintf; eval $csym; $val; then
7850 echo 'vprintf() found.' >&4
7851 val="$define"
7852 $cat >vprintf.c <<'EOF'
7853#include <varargs.h>
7854
d674cd6d 7855int main() { xxx("foo"); }
2304df62
AD
7856
7857xxx(va_alist)
7858va_dcl
7859{
7860 va_list args;
7861 char buf[10];
7862
7863 va_start(args);
7864 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7865}
7866EOF
dfe9444c
AD
7867 set vprintf
7868 if eval $compile && ./vprintf; then
2304df62
AD
7869 echo "Your vsprintf() returns (int)." >&4
7870 val2="$undef"
7871 else
7872 echo "Your vsprintf() returns (char*)." >&4
7873 val2="$define"
7874 fi
7875else
7876 echo 'vprintf() NOT found.' >&4
7877 val="$undef"
7878 val2="$undef"
7879fi
7880set d_vprintf
7881eval $setvar
7882val=$val2
7883set d_charvspr
7884eval $setvar
7885
a0d0e21e
LW
7886: see if chown exists
7887set chown d_chown
7888eval $inlibc
7889
7890: see if chroot exists
7891set chroot d_chroot
7892eval $inlibc
7893
2304df62
AD
7894: see if chsize exists
7895set chsize d_chsize
7896eval $inlibc
7897
7898: check for const keyword
7899echo " "
7900echo 'Checking to see if your C compiler knows about "const"...' >&4
7901$cat >const.c <<'EOCP'
7902typedef struct spug { int drokk; } spug;
5a411a32 7903int main()
2304df62
AD
7904{
7905 const char *foo;
7906 const spug y;
7907}
7908EOCP
7909if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7910 val="$define"
7911 echo "Yup, it does."
7912else
7913 val="$undef"
7914 echo "Nope, it doesn't."
7915fi
7916set d_const
7917eval $setvar
7918
7919: see if crypt exists
7920echo " "
7921if set crypt val -f d_crypt; eval $csym; $val; then
7922 echo 'crypt() found.' >&4
7923 val="$define"
7924 cryptlib=''
7925else
dfe9444c 7926 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 7927 if $test -z "$cryptlib"; then
dfe9444c 7928 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
7929 else
7930 cryptlib=-lcrypt
7931 fi
7932 if $test -z "$cryptlib"; then
dfe9444c 7933 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
7934 else
7935 cryptlib=-lcrypt
7936 fi
7937 if $test -z "$cryptlib"; then
dfe9444c 7938 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
7939 else
7940 cryptlib=-lcrypt
7941 fi
7942 if $test -z "$cryptlib"; then
7943 echo 'crypt() NOT found.' >&4
7944 val="$undef"
7945 else
7946 val="$define"
7947 fi
7948fi
7949set d_crypt
7950eval $setvar
7951
921b2963
JH
7952: get csh whereabouts
7953case "$csh" in
7954'csh') val="$undef" ;;
7955*) val="$define" ;;
7956esac
7957set d_csh
7958eval $setvar
7959: Respect a hint or command line value for full_csh.
7960case "$full_csh" in
7961'') full_csh=$csh ;;
7962esac
7963
a0d0e21e
LW
7964: see if cuserid exists
7965set cuserid d_cuserid
2304df62
AD
7966eval $inlibc
7967
a0d0e21e
LW
7968: see if this is a limits.h system
7969set limits.h i_limits
85e6fe83
LW
7970eval $inhdr
7971
a0d0e21e
LW
7972: see if this is a float.h system
7973set float.h i_float
7974eval $inhdr
7975
7976: See if number of significant digits in a double precision number is known
7977echo " "
7978$cat >dbl_dig.c <<EOM
7979#$i_limits I_LIMITS
7980#$i_float I_FLOAT
7981#ifdef I_LIMITS
7982#include <limits.h>
85e6fe83 7983#endif
a0d0e21e
LW
7984#ifdef I_FLOAT
7985#include <float.h>
7986#endif
7987#ifdef DBL_DIG
7988printf("Contains DBL_DIG");
85e6fe83 7989#endif
85e6fe83 7990EOM
a0d0e21e
LW
7991$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7992if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7993 echo "DBL_DIG found." >&4
7994 val="$define"
2304df62 7995else
a0d0e21e
LW
7996 echo "DBL_DIG NOT found." >&4
7997 val="$undef"
2304df62 7998fi
a0d0e21e
LW
7999$rm -f dbl_dig.?
8000set d_dbl_dig
2304df62 8001eval $setvar
2304df62 8002
a0d0e21e
LW
8003: see if difftime exists
8004set difftime d_difftime
2304df62
AD
8005eval $inlibc
8006
a0d0e21e
LW
8007: see if this is a dirent system
8008echo " "
8009if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8010 val="$define"
8011 echo "<dirent.h> found." >&4
8012else
8013 val="$undef"
8014 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8015 echo "<sys/dir.h> found." >&4
8016 echo " "
8017 else
8018 xinc=`./findhdr sys/ndir.h`
8019 fi
8020 echo "<dirent.h> NOT found." >&4
8021fi
8022set i_dirent
8023eval $setvar
8024
8025: Look for type of directory structure.
8026echo " "
8027$cppstdin $cppflags $cppminus < "$xinc" > try.c
8028
8029case "$direntrytype" in
8030''|' ')
8031 case "$i_dirent" in
8032 $define) guess1='struct dirent' ;;
8033 *) guess1='struct direct' ;;
2afac517 8034 esac
8035 ;;
8036*) guess1="$direntrytype"
8037 ;;
8e07c86e
AD
8038esac
8039
2afac517 8040case "$guess1" in
8041'struct dirent') guess2='struct direct' ;;
8042*) guess2='struct dirent' ;;
8043esac
8044
8045if $contains "$guess1" try.c >/dev/null 2>&1; then
8046 direntrytype="$guess1"
8047 echo "Your directory entries are $direntrytype." >&4
8048elif $contains "$guess2" try.c >/dev/null 2>&1; then
8049 direntrytype="$guess2"
8050 echo "Your directory entries seem to be $direntrytype." >&4
8051else
8052 echo "I don't recognize your system's directory entries." >&4
8053 rp="What type is used for directory entries on this system?"
8054 dflt="$guess1"
8055 . ./myread
8056 direntrytype="$ans"
8057fi
8058$rm -f try.c
a0d0e21e 8059
a0d0e21e 8060
2afac517 8061: see if the directory entry stores field length
8062echo " "
8063$cppstdin $cppflags $cppminus < "$xinc" > try.c
8064if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8065 echo "Good, your directory entry keeps length information in d_namlen." >&4
8066 val="$define"
8067else
8068 echo "Your directory entry does not know about the d_namlen field." >&4
8069 val="$undef"
8070fi
8071set d_dirnamlen
8072eval $setvar
8073$rm -f try.c
a0d0e21e 8074
5ff3f7a4
GS
8075: see if dlerror exists
8076xxx_runnm="$runnm"
8077runnm=false
8078set dlerror d_dlerror
8079eval $inlibc
8080runnm="$xxx_runnm"
8081
8082: see if dlfcn is available
8083set dlfcn.h i_dlfcn
8084eval $inhdr
8085
8086case "$usedl" in
8087$define|y|true)
8088 $cat << EOM
8089
8090On a few systems, the dynamically loaded modules that perl generates and uses
8091will need a different extension than shared libs. The default will probably
8092be appropriate.
8093
8094EOM
8095 case "$dlext" in
8096 '') dflt="$so" ;;
8097 *) dflt="$dlext" ;;
8098 esac
8099 rp='What is the extension of dynamically loaded modules'
8100 . ./myread
8101 dlext="$ans"
8102 ;;
8103*)
8104 dlext="none"
8105 ;;
8106esac
8107
8108: Check if dlsym need a leading underscore
a0d0e21e
LW
8109echo " "
8110val="$undef"
8111
8112case "$dlsrc" in
8113dl_dlopen.xs)
8114 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8115 $cat >dyna.c <<'EOM'
8116fred () { }
8117EOM
8118
8119$cat >fred.c<<EOM
8120
8121#include <stdio.h>
8122#$i_dlfcn I_DLFCN
8123#ifdef I_DLFCN
8124#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8125#else
8126#include <sys/types.h>
8127#include <nlist.h>
8128#include <link.h>
8129#endif
8130
8131extern int fred() ;
8132
5a411a32 8133int main()
a0d0e21e
LW
8134{
8135 void * handle ;
8136 void * symbol ;
8137#ifndef RTLD_LAZY
8138 int mode = 1 ;
8139#else
8140 int mode = RTLD_LAZY ;
8141#endif
8142 handle = dlopen("./dyna.$dlext", mode) ;
8143 if (handle == NULL) {
5f05dabc 8144 printf ("1\n") ;
8145 fflush (stdout) ;
8146 exit(0);
a0d0e21e
LW
8147 }
8148 symbol = dlsym(handle, "fred") ;
8149 if (symbol == NULL) {
5f05dabc 8150 /* try putting a leading underscore */
8151 symbol = dlsym(handle, "_fred") ;
8152 if (symbol == NULL) {
8153 printf ("2\n") ;
8154 fflush (stdout) ;
8155 exit(0);
8156 }
8157 printf ("3\n") ;
a0d0e21e
LW
8158 }
8159 else
5f05dabc 8160 printf ("4\n") ;
36477c24 8161 fflush (stdout) ;
8162 exit(0);
a0d0e21e
LW
8163}
8164EOM
760ac839 8165 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 8166 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
8167 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
8168 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 8169 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
8170 xxx=`./fred`
8171 case $xxx in
8172 1) echo "Test program failed using dlopen." >&4
8173 echo "Perhaps you should not use dynamic loading." >&4;;
8174 2) echo "Test program failed using dlsym." >&4
8175 echo "Perhaps you should not use dynamic loading." >&4;;
8176 3) echo "dlsym needs a leading underscore" >&4
8177 val="$define" ;;
8178 4) echo "dlsym doesn't need a leading underscore." >&4;;
8179 esac
8180 else
8181 echo "I can't compile and run the test program." >&4
88d5303d 8182 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
a0d0e21e
LW
8183 fi
8184 ;;
8185esac
8186
a78b0d02 8187$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
8188
8189set d_dlsymun
8190eval $setvar
8191
85ab1d1d
JH
8192hasproto='varname=$1; func=$2; shift; shift;
8193while $test $# -ge 2; do
8194 case "$1" in
8195 $define) echo "#include <$2>";;
8196 esac ;
8197 shift 2;
8198done > try.c;
8199$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8200if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8201 echo "$func() prototype found.";
8202 val="$define";
8203else
8204 echo "$func() prototype NOT found.";
8205 val="$undef";
8206fi;
8207set $varname;
8208eval $setvar;
8209$rm -f try.c tryout.c'
8210
8211: see if prototype for drand48 is available
8212echo " "
8213set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8214eval $hasproto
8215
a0d0e21e
LW
8216: see if dup2 exists
8217set dup2 d_dup2
8218eval $inlibc
8219
5ff3f7a4
GS
8220: see if eaccess exists
8221set eaccess d_eaccess
8222eval $inlibc
8223
8224: see if endgrent exists
8225set endgrent d_endgrent
8226eval $inlibc
8227
e5c9fcd0
AD
8228: see if endhostent exists
8229set endhostent d_endhent
8230eval $inlibc
8231
8232: see if endnetent exists
8233set endnetent d_endnent
8234eval $inlibc
8235
8236: see if endprotoent exists
8237set endprotoent d_endpent
8238eval $inlibc
8239
5ff3f7a4
GS
8240: see if endpwent exists
8241set endpwent d_endpwent
8242eval $inlibc
8243
e5c9fcd0
AD
8244: see if endservent exists
8245set endservent d_endsent
8246eval $inlibc
8247
f1066039
JH
8248: see if endspent exists
8249set endspent d_endspent
8250eval $inlibc
8251
8e07c86e
AD
8252: Locate the flags for 'open()'
8253echo " "
8254$cat >open3.c <<'EOCP'
8255#include <sys/types.h>
8256#ifdef I_FCNTL
8257#include <fcntl.h>
8258#endif
8259#ifdef I_SYS_FILE
8260#include <sys/file.h>
8261#endif
d674cd6d 8262int main() {
8e07c86e
AD
8263 if(O_RDONLY);
8264#ifdef O_TRUNC
8265 exit(0);
8266#else
8267 exit(1);
8268#endif
8269}
8270EOCP
8271: check sys/file.h first to get FREAD on Sun
8272if $test `./findhdr sys/file.h` && \
dfe9444c 8273 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8274 h_sysfile=true;
8275 echo "<sys/file.h> defines the O_* constants..." >&4
8276 if ./open3; then
8277 echo "and you have the 3 argument form of open()." >&4
8278 val="$define"
8279 else
8280 echo "but not the 3 argument form of open(). Oh, well." >&4
8281 val="$undef"
8282 fi
8283elif $test `./findhdr fcntl.h` && \
dfe9444c 8284 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8285 h_fcntl=true;
8286 echo "<fcntl.h> defines the O_* constants..." >&4
8287 if ./open3; then
8288 echo "and you have the 3 argument form of open()." >&4
8289 val="$define"
8290 else
8291 echo "but not the 3 argument form of open(). Oh, well." >&4
8292 val="$undef"
8293 fi
8294else
8295 val="$undef"
8296 echo "I can't find the O_* constant definitions! You got problems." >&4
8297fi
8298set d_open3
8299eval $setvar
8300$rm -f open3*
8301
213c275f
JH
8302: see which of string.h or strings.h is needed
8303echo " "
8304strings=`./findhdr string.h`
8305if $test "$strings" && $test -r "$strings"; then
8306 echo "Using <string.h> instead of <strings.h>." >&4
8307 val="$define"
8308else
8309 val="$undef"
8310 strings=`./findhdr strings.h`
8311 if $test "$strings" && $test -r "$strings"; then
8312 echo "Using <strings.h> instead of <string.h>." >&4
8313 else
8314 echo "No string header found -- You'll surely have problems." >&4
8315 fi
8316fi
8317set i_string
8318eval $setvar
8319case "$i_string" in
8320"$undef") strings=`./findhdr strings.h`;;
8321*) strings=`./findhdr string.h`;;
8322esac
8323
8e07c86e
AD
8324: check for non-blocking I/O stuff
8325case "$h_sysfile" in
8326true) echo "#include <sys/file.h>" > head.c;;
8327*)
8328 case "$h_fcntl" in
8329 true) echo "#include <fcntl.h>" > head.c;;
8330 *) echo "#include <sys/fcntl.h>" > head.c;;
8331 esac
8332 ;;
8333esac
8334echo " "
8335echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8336case "$o_nonblock" in
8337'')
8338 $cat head.c > try.c
8339 $cat >>try.c <<'EOCP'
213c275f 8340#include <stdio.h>
d674cd6d 8341int main() {
8e07c86e
AD
8342#ifdef O_NONBLOCK
8343 printf("O_NONBLOCK\n");
8344 exit(0);
8345#endif
8346#ifdef O_NDELAY
8347 printf("O_NDELAY\n");
8348 exit(0);
8349#endif
8350#ifdef FNDELAY
8351 printf("FNDELAY\n");
8352 exit(0);
8353#endif
8354 exit(0);
8355}
8356EOCP
dfe9444c 8357 set try
dc45a647 8358 if eval $compile_ok; then
8e07c86e
AD
8359 o_nonblock=`./try`
8360 case "$o_nonblock" in
8361 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8362 *) echo "Seems like we can use $o_nonblock.";;
8363 esac
8364 else
8365 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8366 fi
8367 ;;
8368*) echo "Using $hint value $o_nonblock.";;
8369esac
8370$rm -f try try.* .out core
8371
8372echo " "
8373echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8374case "$eagain" in
8375'')
8376 $cat head.c > try.c
8377 $cat >>try.c <<EOCP
8378#include <errno.h>
8379#include <sys/types.h>
8380#include <signal.h>
213c275f 8381#include <stdio.h>
4633a7c4 8382#define MY_O_NONBLOCK $o_nonblock
dc45a647 8383#ifndef errno /* XXX need better Configure test */
8e07c86e 8384extern int errno;
dc45a647 8385#endif
14e4fe40
JH
8386#$i_unistd I_UNISTD
8387#ifdef I_UNISTD
213c275f
JH
8388#include <unistd.h>
8389#endif
8390#ifdef $i_string
8391#include <string.h>
8392#else
8393#include <strings.h>
8394#endif
8e07c86e 8395$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8396EOCP
8397 $cat >> try.c <<'EOCP'
d674cd6d 8398int main()
8e07c86e
AD
8399{
8400 int pd[2];
8401 int pu[2];
8402 char buf[1];
8403 char string[100];
8404
8405 pipe(pd); /* Down: child -> parent */
8406 pipe(pu); /* Up: parent -> child */
8407 if (0 != fork()) {
8408 int ret;
8409 close(pd[1]); /* Parent reads from pd[0] */
8410 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8411 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8412 exit(1);
8413 signal(SIGALRM, blech);
8414 alarm(5);
8415 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8416 exit(2);
8417 sprintf(string, "%d\n", ret);
8418 write(2, string, strlen(string));
8419 alarm(0);
8420#ifdef EAGAIN
8421 if (errno == EAGAIN) {
8422 printf("EAGAIN\n");
8423 goto ok;
8424 }
8425#endif
8426#ifdef EWOULDBLOCK
8427 if (errno == EWOULDBLOCK)
8428 printf("EWOULDBLOCK\n");
8429#endif
8430 ok:
8431 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8432 sleep(2); /* Give it time to close our pipe */
8433 alarm(5);
8434 ret = read(pd[0], buf, 1); /* Should read EOF */
8435 alarm(0);
8436 sprintf(string, "%d\n", ret);
8437 write(3, string, strlen(string));
8438 exit(0);
8439 }
8440
8441 close(pd[0]); /* We write to pd[1] */
8442 close(pu[1]); /* We read from pu[0] */
8443 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8444 close(pd[1]); /* Pipe pd is now fully closed! */
8445 exit(0); /* Bye bye, thank you for playing! */
8446}
8447EOCP
dfe9444c 8448 set try
dc45a647 8449 if eval $compile_ok; then
774d564b 8450 echo "$startsh" >mtry
40a7a20a 8451 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8452 chmod +x mtry
8453 ./mtry >/dev/null 2>&1
8454 case $? in
8455 0) eagain=`$cat try.out`;;
8456 1) echo "Could not perform non-blocking setting!";;
8457 2) echo "I did a successful read() for something that was not there!";;
8458 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8459 *) echo "Something terribly wrong happened during testing.";;
8460 esac
8461 rd_nodata=`$cat try.ret`
8462 echo "A read() system call with no data present returns $rd_nodata."
8463 case "$rd_nodata" in
8464 0|-1) ;;
8465 *)
8466 echo "(That's peculiar, fixing that to be -1.)"
8467 rd_nodata=-1
8468 ;;
8469 esac
8470 case "$eagain" in
8471 '')
8472 echo "Forcing errno EAGAIN on read() with no data available."
8473 eagain=EAGAIN
8474 ;;
8475 *)
8476 echo "Your read() sets errno to $eagain when no data is available."
8477 ;;
8478 esac
8479 status=`$cat try.err`
8480 case "$status" in
8481 0) echo "And it correctly returns 0 to signal EOF.";;
8482 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8483 *) echo "However, your read() returns '$status' on EOF??";;
8484 esac
8485 val="$define"
28757baa 8486 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8487 echo "WARNING: you can't distinguish between EOF and no data!"
8488 val="$undef"
8489 fi
8490 else
8491 echo "I can't compile the test program--assuming errno EAGAIN will do."
8492 eagain=EAGAIN
8493 fi
8494 set d_eofnblk
8495 eval $setvar
8496 ;;
8497*)
8498 echo "Using $hint value $eagain."
8499 echo "Your read() returns $rd_nodata when no data is present."
8500 case "$d_eofnblk" in
8501 "$define") echo "And you can see EOF because read() returns 0.";;
8502 "$undef") echo "But you can't see EOF status from read() returned value.";;
8503 *)
8504 echo "(Assuming you can't see EOF status from read anyway.)"
8505 d_eofnblk=$undef
8506 ;;
8507 esac
8508 ;;
8509esac
8510$rm -f try try.* .out core head.c mtry
8511
a0d0e21e
LW
8512: see if fchmod exists
8513set fchmod d_fchmod
8514eval $inlibc
8515
8516: see if fchown exists
8517set fchown d_fchown
8518eval $inlibc
8519
8520: see if this is an fcntl system
8521set fcntl d_fcntl
8522eval $inlibc
8523
b7b35fc2
JH
8524hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8525while $test $# -ge 2; do
8526 case "$1" in
8527 $define) echo "#include <$2>";;
8528 esac ;
8529 shift 2;
8530done > try.c;
8531echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8532set try;
8533if eval $compile; then
8534 val="$define";
8535else
8536 val="$undef";
8537fi;
8538set $varname;
8539eval $setvar;
8540$rm -f try.c try.o'
8541
8542socketlib=''
8543sockethdr=''
8544: see whether socket exists
8545echo " "
8546$echo $n "Hmm... $c" >&4
8547if set socket val -f d_socket; eval $csym; $val; then
8548 echo "Looks like you have Berkeley networking support." >&4
8549 d_socket="$define"
8550 if set setsockopt val -f; eval $csym; $val; then
8551 d_oldsock="$undef"
8552 else
8553 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8554 d_oldsock="$define"
8555 fi
8556else
8557 if $contains socklib libc.list >/dev/null 2>&1; then
8558 echo "Looks like you have Berkeley networking support." >&4
8559 d_socket="$define"
8560 : we will have to assume that it supports the 4.2 BSD interface
8561 d_oldsock="$undef"
8562 else
8563 echo "You don't have Berkeley networking in libc$_a..." >&4
8564 if test "X$d_socket" = "X$define"; then
8565 echo "...but you seem to believe that you have sockets." >&4
8566 else
8567 for net in net socket
8568 do
8569 if test -f /usr/lib/lib$net$_a; then
8570 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8571 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8572 if $contains socket libc.list >/dev/null 2>&1; then
8573 d_socket="$define"
8574 socketlib="-l$net"
8575 case "$net" in
8576 net)
8577 echo "...but the Wollongong group seems to have hacked it in." >&4
8578 sockethdr="-I/usr/netinclude"
8579 ;;
8580 esac
8581 echo "Found Berkeley sockets interface in lib$net." >& 4
8582 if $contains setsockopt libc.list >/dev/null 2>&1; then
8583 d_oldsock="$undef"
8584 else
8585 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8586 d_oldsock="$define"
8587 fi
8588 break
8589 fi
8590 fi
8591 done
8592 if test "X$d_socket" != "X$define"; then
8593 echo "or anywhere else I see." >&4
8594 d_socket="$undef"
8595 d_oldsock="$undef"
8596 fi
8597 fi
8598 fi
8599fi
8600
8601: see if socketpair exists
8602set socketpair d_sockpair
8603eval $inlibc
8604
8605
8606echo " "
8607echo "Checking the availability of certain socket constants..." >& 4
8608for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8609 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8610 $cat >try.c <<EOF
8611#include <sys/types.h>
8612#include <sys/socket.h>
8613int main() {
8614 int i = $ENUM;
8615}
8616EOF
8617 val="$undef"
8618 set try; if eval $compile; then
8619 val="$define"
8620 fi
8621 set d_${enum}; eval $setvar
8622 $rm -f try.c try
8623done
8624
921b2963
JH
8625: see if sys/select.h has to be included
8626set sys/select.h i_sysselct
8627eval $inhdr
8628
8629: see if we should include time.h, sys/time.h, or both
8630echo " "
8631if test "X$timeincl" = X; then
8632 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8633 $echo $n "I'm now running the test program...$c"
8634 $cat >try.c <<'EOCP'
8635#include <sys/types.h>
8636#ifdef I_TIME
8637#include <time.h>
8638#endif
8639#ifdef I_SYSTIME
8640#ifdef SYSTIMEKERNEL
8641#define KERNEL
8642#endif
8643#include <sys/time.h>
8644#endif
8645#ifdef I_SYSSELECT
8646#include <sys/select.h>
8647#endif
d674cd6d 8648int main()
921b2963
JH
8649{
8650 struct tm foo;
8651#ifdef S_TIMEVAL
8652 struct timeval bar;
8653#endif
8654#ifdef S_TIMEZONE
8655 struct timezone tzp;
8656#endif
8657 if (foo.tm_sec == foo.tm_sec)
8658 exit(0);
8659#ifdef S_TIMEVAL
8660 if (bar.tv_sec == bar.tv_sec)
8661 exit(0);
8662#endif
8663 exit(1);
8664}
8665EOCP
8666 flags=''
8667 for s_timezone in '-DS_TIMEZONE' ''; do
8668 sysselect=''
8669 for s_timeval in '-DS_TIMEVAL' ''; do
8670 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8671 for i_time in '' '-DI_TIME'; do
8672 for i_systime in '-DI_SYSTIME' ''; do
8673 case "$flags" in
8674 '') $echo $n ".$c"
8675 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8676 if eval $compile; then
8677 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8678 shift
8679 flags="$*"
8680 echo " "
8681 $echo $n "Succeeded with $flags$c"
8682 fi
8683 ;;
8684 esac
8685 done
8686 done
8687 done
8688 done
8689 done
8690 timeincl=''
8691 echo " "
8692 case "$flags" in
8693 *SYSTIMEKERNEL*) i_systimek="$define"
8694 timeincl=`./findhdr sys/time.h`
8695 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8696 *) i_systimek="$undef";;
8697 esac
8698 case "$flags" in
8699 *I_TIME*) i_time="$define"
8700 timeincl=`./findhdr time.h`" $timeincl"
8701 echo "We'll include <time.h>." >&4;;
8702 *) i_time="$undef";;
8703 esac
8704 case "$flags" in
8705 *I_SYSTIME*) i_systime="$define"
8706 timeincl=`./findhdr sys/time.h`" $timeincl"
8707 echo "We'll include <sys/time.h>." >&4;;
8708 *) i_systime="$undef";;
8709 esac
8710 $rm -f try.c try
8711fi
8712
8713: check for fd_set items
8714$cat <<EOM
8715
8716Checking to see how well your C compiler handles fd_set and friends ...
8717EOM
8718$cat >fd_set.c <<EOCP
8719#$i_systime I_SYS_TIME
8720#$i_sysselct I_SYS_SELECT
8721#$d_socket HAS_SOCKET
8722#include <sys/types.h>
8723#ifdef HAS_SOCKET
8724#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8725#endif
8726#ifdef I_SYS_TIME
8727#include <sys/time.h>
8728#endif
8729#ifdef I_SYS_SELECT
8730#include <sys/select.h>
8731#endif
d674cd6d 8732int main() {
921b2963
JH
8733 fd_set fds;
8734
8735#ifdef TRYBITS
8736 if(fds.fds_bits);
8737#endif
8738
8739#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8740 exit(0);
8741#else
8742 exit(1);
8743#endif
8744}
8745EOCP
8746set fd_set -DTRYBITS
8747if eval $compile; then
8748 d_fds_bits="$define"
8749 d_fd_set="$define"
8750 echo "Well, your system knows about the normal fd_set typedef..." >&4
8751 if ./fd_set; then
8752 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8753 d_fd_macros="$define"
8754 else
8755 $cat >&4 <<'EOM'
8756but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8757EOM
8758 d_fd_macros="$undef"
8759 fi
8760else
8761 $cat <<'EOM'
8762Hmm, your compiler has some difficulty with fd_set. Checking further...
8763EOM
8764 set fd_set
8765 if eval $compile; then
8766 d_fds_bits="$undef"
8767 d_fd_set="$define"
8768 echo "Well, your system has some sort of fd_set available..." >&4
8769 if ./fd_set; then
8770 echo "and you have the normal fd_set macros." >&4
8771 d_fd_macros="$define"
8772 else
8773 $cat <<'EOM'
8774but not the normal fd_set macros! Gross! More work for me...
8775EOM
8776 d_fd_macros="$undef"
8777 fi
8778 else
8779 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
8780 d_fd_set="$undef"
8781 d_fds_bits="$undef"
8782 d_fd_macros="$undef"
8783 fi
8784fi
8785$rm -f fd_set*
8786
a0d0e21e
LW
8787: see if fgetpos exists
8788set fgetpos d_fgetpos
8789eval $inlibc
8790
8175356b
JH
8791: see if flock exists
8792set flock d_flock
8793eval $inlibc
8794
8795: see if fork exists
8796set fork d_fork
8797eval $inlibc
8798
8799: see if pathconf exists
8800set pathconf d_pathconf
8801eval $inlibc
8802
8803: see if fpathconf exists
8804set fpathconf d_fpathconf
8805eval $inlibc
8806
d9b3e12d
JH
8807
8808: check for off64_t
8809echo " "
8175356b 8810echo "Checking to see if your system supports off64_t..." >&4
d9b3e12d
JH
8811$cat >try.c <<EOCP
8812#include <sys/types.h>
8813#include <unistd.h>
8175356b 8814int main() { off64_t x = 7; }'
d9b3e12d 8815EOCP
8175356b
JH
8816set try
8817if eval $compile; then
d9b3e12d 8818 val="$define"
a22e52b9 8819 echo "Yes, it does."
d9b3e12d
JH
8820else
8821 val="$undef"
a22e52b9 8822 echo "No, it doesn't."
8175356b 8823 case "$lseeksize" in
1eeb0f31 8824 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8175356b 8825 esac
d9b3e12d 8826fi
8175356b 8827$rm -f try.* try
d9b3e12d
JH
8828set d_off64_t
8829eval $setvar
8830
8831: check for fpos64_t
8832echo " "
8175356b 8833echo "Checking to see if your system supports fpos64_t..." >&4
d9b3e12d
JH
8834$cat >try.c <<EOCP
8835#include <sys/stdio.h>
8175356b 8836int main() { fpos64_t x x = 7; }'
d9b3e12d 8837EOCP
8175356b
JH
8838set try
8839if eval $compile; then
d9b3e12d 8840 val="$define"
a22e52b9 8841 echo "Yes, it does."
d9b3e12d
JH
8842else
8843 val="$undef"
a22e52b9 8844 echo "No, it doesn't."
8175356b 8845 case "$fpossize" in
1eeb0f31 8846 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8175356b 8847 esac
d9b3e12d 8848fi
8175356b 8849$rm -f try.* try
d9b3e12d
JH
8850set d_fpos64_t
8851eval $setvar
8852
0545a864
JH
8853hasstruct='varname=$1; struct=$2; shift; shift;
8854while $test $# -ge 2; do
8855 case "$1" in
8856 $define) echo "#include <$2>";;
8857 esac ;
8858 shift 2;
8859done > try.c;
8860echo "int main () { struct $struct foo; }" >> try.c;
8861set try;
8862if eval $compile; then
8863 val="$define";
8864else
8865 val="$undef";
8866fi;
8867set $varname;
8868eval $setvar;
8869$rm -f try.c try.o'
d9b3e12d 8870
9b9c89a3
JH
8871: see if this is a sys/param system
8872set sys/param.h i_sysparam
8873eval $inhdr
8874
104d25b7
JH
8875: see if this is a sys/mount.h system
8876set sys/mount.h i_sysmount
8877eval $inhdr
8878
0545a864
JH
8879: see if sys/types.h has to be included
8880set sys/types.h i_systypes
8881eval $inhdr
8882
0545a864 8883
ad27e871 8884echo " "
8175356b 8885echo "Checking to see if your system supports struct fs_data..." >&4
0545a864
JH
8886set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8887eval $hasstruct
8888case "$d_fs_data_s" in
a22e52b9
JH
8889"$define") echo "Yes, it does." ;;
8890*) echo "No, it doesn't." ;;
0545a864
JH
8891esac
8892
8893: see if fseeko exists
8894set fseeko d_fseeko
8895eval $inlibc
1eeb0f31 8896case "$longsize" in
43999f95 88978) echo "(Your long is 64 bits, so you could use fseek.)" ;;
1eeb0f31 8898esac
0545a864
JH
8899
8900: see if fsetpos exists
8901set fsetpos d_fsetpos
8902eval $inlibc
8903
8904
8905: see if fstatfs exists
8906set fstatfs d_fstatfs
8907eval $inlibc
104d25b7
JH
8908
8909
8910: see if statvfs exists
8911set statvfs d_statvfs
8912eval $inlibc
8913
8914: see if fstatvfs exists
8915set fstatvfs d_fstatvfs
8916eval $inlibc
8917
8918
5ff3f7a4
GS
8919: see if ftello exists
8920set ftello d_ftello
8921eval $inlibc
1eeb0f31 8922case "$longsize" in
43999f95 89238) echo "(Your long is 64 bits, so you could use ftell.)" ;;
1eeb0f31 8924esac
5ff3f7a4 8925
49dabb45
JH
8926: see if getcwd exists
8927set getcwd d_getcwd
8928eval $inlibc
8929
5ff3f7a4
GS
8930: see if getgrent exists
8931set getgrent d_getgrent
8932eval $inlibc
8933
693762b4
AD
8934: see if gethostbyaddr exists
8935set gethostbyaddr d_gethbyaddr
8936eval $inlibc
8937
8938: see if gethostbyname exists
8939set gethostbyname d_gethbyname
8940eval $inlibc
8941
a0d0e21e
LW
8942: see if gethostent exists
8943set gethostent d_gethent
8944eval $inlibc
8945
921b2963
JH
8946: see how we will look up host name
8947echo " "
a63faeb8
JH
8948call=''
8949if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
8950 echo 'gethostname() found.' >&4
8951 d_gethname="$define"
8952 call=gethostname
a63faeb8
JH
8953fi
8954if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
8955 if ./xenix; then
8956 $cat <<'EOM'
8957uname() was found, but you're running xenix, and older versions of xenix
8958have a broken uname(). If you don't really know whether your xenix is old
8959enough to have a broken system call, use the default answer.
8960
8961EOM
8962 dflt=y
8963 case "$d_uname" in
8964 "$define") dflt=n;;
8965 esac
8966 rp='Is your uname() broken?'
8967 . ./myread
8968 case "$ans" in
8969 n*) d_uname="$define"; call=uname;;
8970 esac
8971 else
8972 echo 'uname() found.' >&4
8973 d_uname="$define"
a63faeb8
JH
8974 case "$call" in
8975 '') call=uname ;;
8976 esac
921b2963
JH
8977 fi
8978fi
8979case "$d_gethname" in
8980'') d_gethname="$undef";;
8981esac
8982case "$d_uname" in
8983'') d_uname="$undef";;
8984esac
8985case "$d_uname$d_gethname" in
8986*define*)
8987 dflt=n
8988 cat <<EOM
8989
8990Every now and then someone has a $call() that lies about the hostname
8991but can't be fixed for political or economic reasons. If you wish, I can
8992pretend $call() isn't there and maybe compute hostname at run-time
8993thanks to the '$phostname' command.
8994
8995EOM
8996 rp="Shall I ignore $call() from now on?"
8997 . ./myread
8998 case "$ans" in
8999 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9000 esac;;
9001esac
9002case "$phostname" in
9003'') aphostname='';;
9004*) case "$aphostname" in
9005 /*) ;;
9006 *) set X $phostname
9007 shift
9008 file=$1
9009 shift
9010 file=`./loc $file $file $pth`
9011 aphostname=`echo $file $*`
9012 ;;
9013 esac
9014 ;;
9015esac
9016case "$d_uname$d_gethname" in
9017*define*) ;;
9018*)
9019 case "$phostname" in
9020 '')
9021 echo "There will be no way for $package to get your hostname." >&4;;
9022 *)
9023 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9024 ;;
9025 esac;;
9026esac
9027case "$d_phostname" in
9028'') d_phostname="$undef";;
9029esac
9030
dc45a647
MB
9031: see if this is a netdb.h system
9032set netdb.h i_netdb
9033eval $inhdr
9034
9035: see if prototypes for various gethostxxx netdb.h functions are available
9036echo " "
9037set d_gethostprotos gethostent $i_netdb netdb.h
9038eval $hasproto
9039
a0d0e21e
LW
9040: see if getlogin exists
9041set getlogin d_getlogin
9042eval $inlibc
9043
ad27e871
JH
9044: see if getmnt exists
9045set getmnt d_getmnt
9046eval $inlibc
9047
ccc7f9b3
KS
9048: see if getmntent exists
9049set getmntent d_getmntent
9050eval $inlibc
9051
693762b4
AD
9052: see if getnetbyaddr exists
9053set getnetbyaddr d_getnbyaddr
9054eval $inlibc
9055
9056: see if getnetbyname exists
9057set getnetbyname d_getnbyname
9058eval $inlibc
9059
e5c9fcd0
AD
9060: see if getnetent exists
9061set getnetent d_getnent
9062eval $inlibc
9063
dc45a647
MB
9064: see if prototypes for various getnetxxx netdb.h functions are available
9065echo " "
9066set d_getnetprotos getnetent $i_netdb netdb.h
9067eval $hasproto
9068
693762b4
AD
9069
9070: see if getprotobyname exists
9071set getprotobyname d_getpbyname
9072eval $inlibc
9073
9074: see if getprotobynumber exists
9075set getprotobynumber d_getpbynumber
9076eval $inlibc
e5c9fcd0
AD
9077
9078: see if getprotoent exists
9079set getprotoent d_getpent
9080eval $inlibc
9081
2afac517 9082: see if getpgid exists
9083set getpgid d_getpgid
a0d0e21e
LW
9084eval $inlibc
9085
9086: see if getpgrp2 exists
9087set getpgrp2 d_getpgrp2
9088eval $inlibc
9089
9090: see if getppid exists
9091set getppid d_getppid
9092eval $inlibc
9093
9094: see if getpriority exists
9095set getpriority d_getprior
9096eval $inlibc
9097
dc45a647
MB
9098: see if prototypes for various getprotoxxx netdb.h functions are available
9099echo " "
9100set d_getprotoprotos getprotoent $i_netdb netdb.h
9101eval $hasproto
9102
5ff3f7a4
GS
9103: see if getpwent exists
9104set getpwent d_getpwent
9105eval $inlibc
9106
9107
693762b4
AD
9108: see if getservbyname exists
9109set getservbyname d_getsbyname
9110eval $inlibc
9111
9112: see if getservbyport exists
9113set getservbyport d_getsbyport
9114eval $inlibc
e5c9fcd0
AD
9115
9116: see if getservent exists
9117set getservent d_getsent
9118eval $inlibc
9119
dc45a647
MB
9120: see if prototypes for various getservxxx netdb.h functions are available
9121echo " "
9122set d_getservprotos getservent $i_netdb netdb.h
9123eval $hasproto
9124
f1066039
JH
9125: see if getspent exists
9126set getspent d_getspent
9127eval $inlibc
9128
9129: see if getspnam exists
9130set getspnam d_getspnam
9131eval $inlibc
9132
5f05dabc 9133: see if gettimeofday or ftime exists
9134set gettimeofday d_gettimeod
9135eval $inlibc
9136case "$d_gettimeod" in
9137"$undef")
9138 set ftime d_ftime
9139 eval $inlibc
9140 ;;
9141*)
9142 val="$undef"; set d_ftime; eval $setvar
9143 ;;
9144esac
9145case "$d_gettimeod$d_ftime" in
9146"$undef$undef")
9147 echo " "
9148 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9149 ;;
9150esac
9151
5ff3f7a4
GS
9152: see if this is an grp system
9153set grp.h i_grp
9154eval $inhdr
9155
9156case "$i_grp" in
9157$define)
9158 xxx=`./findhdr grp.h`
9159 $cppstdin $cppflags $cppminus < $xxx >$$.h
9160
9161 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9162 val="$define"
9163 else
9164 val="$undef"
9165 fi
9166 set d_grpasswd
9167 eval $setvar
9168
9169 $rm -f $$.h
9170 ;;
9171*)
9172 val="$undef";
9173 set d_grpasswd; eval $setvar
9174 ;;
9175esac
9176
ccc7f9b3
KS
9177: see if hasmntopt exists
9178set hasmntopt d_hasmntopt
9179eval $inlibc
9180
a0d0e21e
LW
9181: see if this is a netinet/in.h or sys/in.h system
9182set netinet/in.h i_niin sys/in.h i_sysin
9183eval $inhdr
9184
5ff3f7a4 9185: see if arpa/inet.h has to be included
93341792 9186set arpa/inet.h i_arpainet
28e8609d
JH
9187eval $inhdr
9188
a0d0e21e
LW
9189: see if htonl --and friends-- exists
9190val=''
9191set htonl val
9192eval $inlibc
9193
9194: Maybe they are macros.
9195case "$val" in
9196$undef)
9197 $cat >htonl.c <<EOM
9198#include <stdio.h>
9199#include <sys/types.h>
9200#$i_niin I_NETINET_IN
9201#$i_sysin I_SYS_IN
93341792 9202#$i_arpainet I_ARPA_INET
a0d0e21e
LW
9203#ifdef I_NETINET_IN
9204#include <netinet/in.h>
9205#endif
9206#ifdef I_SYS_IN
9207#include <sys/in.h>
9208#endif
28e8609d
JH
9209#ifdef I_ARPA_INET
9210#include <arpa/inet.h>
9211#endif
a0d0e21e
LW
9212#ifdef htonl
9213printf("Defined as a macro.");
9214#endif
9215EOM
9216 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9217 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9218 val="$define"
9219 echo "But it seems to be defined as a macro." >&4
9220 fi
9221 $rm -f htonl.?
9222 ;;
9223esac
9224set d_htonl
9225eval $setvar
9226
43999f95
JH
9227: see if iconv exists
9228set iconv d_iconv
9229eval $inlibc
9230
a0d0e21e
LW
9231: index or strchr
9232echo " "
9233if set index val -f; eval $csym; $val; then
9234 if set strchr val -f d_strchr; eval $csym; $val; then
9235 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9236 val="$define"
9237 vali="$undef"
9238 echo "strchr() found." >&4
9239 else
9240 val="$undef"
9241 vali="$define"
9242 echo "index() found." >&4
9243 fi
9244 else
9245 val="$undef"
9246 vali="$define"
9247 echo "index() found." >&4
9248 fi
9249else
9250 if set strchr val -f d_strchr; eval $csym; $val; then
9251 val="$define"
9252 vali="$undef"
9253 echo "strchr() found." >&4
9254 else
9255 echo "No index() or strchr() found!" >&4
9256 val="$undef"
9257 vali="$undef"
9258 fi
9259fi
9260set d_strchr; eval $setvar
9261val="$vali"
9262set d_index; eval $setvar
9263
7e1af8bc 9264: check whether inet_aton exists
9265set inet_aton d_inetaton
9266eval $inlibc
9267
fe749a9f
JH
9268: see if inttypes.h is available
9269: we want a real compile instead of Inhdr because some systems
9270: have an inttypes.h which includes non-existent headers
9271echo " "
9272$cat >try.c <<EOCP
9273#include <inttypes.h>
9274int main() {
9275 static int32_t foo32 = 0x12345678;
9276}
9277EOCP
9278set try
9279if eval $compile; then
9280 echo "<inttypes.h> found." >&4
9281 val="$define"
9282else
9283 echo "<inttypes.h> NOT found." >&4
9284 val="$undef"
9285fi
9286$rm -f try.c try
9287set i_inttypes
9288eval $setvar
9289
9290: check for int64_t
9291echo " "
9292$echo $n "Checking to see if your system supports int64_t...$c" >&4
9293$cat >try.c <<EOCP
9294#include <sys/types.h>
9295#$i_inttypes I_INTTYPES
9296#ifdef I_INTTYPES
9297#include <inttypes.h>
9298#endif
9299int main() { int64_t x = 7; }
9300EOCP
9301set try
9302if eval $compile; then
9303 val="$define"
9304 echo " Yes, it does." >&4
9305else
9306 val="$undef"
9307 echo " No, it doesn't." >&4
9308fi
9309$rm -f try try.*
9310set d_int64t
9311eval $setvar
9312
a0d0e21e
LW
9313: Look for isascii
9314echo " "
9315$cat >isascii.c <<'EOCP'
9316#include <stdio.h>
9317#include <ctype.h>
d674cd6d 9318int main() {
a0d0e21e
LW
9319 int c = 'A';
9320 if (isascii(c))
9321 exit(0);
9322 else
9323 exit(1);
9324}
9325EOCP
dfe9444c
AD
9326set isascii
9327if eval $compile; then
a0d0e21e
LW
9328 echo "isascii() found." >&4
9329 val="$define"
9330else
9331 echo "isascii() NOT found." >&4
9332 val="$undef"
9333fi
9334set d_isascii
9335eval $setvar
9336$rm -f isascii*
9337
9338: see if killpg exists
9339set killpg d_killpg
9340eval $inlibc
9341
dd64f1c3
AD
9342: see if lchown exists
9343echo " "
9344$cat > try.c <<'EOCP'
9345/* System header to define __stub macros and hopefully few prototypes,
9346 which can conflict with char lchown(); below. */
9347#include <assert.h>
9348/* Override any gcc2 internal prototype to avoid an error. */
9349/* We use char because int might match the return type of a gcc2
9350 builtin and then its argument prototype would still apply. */
9351char lchown();
9352int main() {
9353 /* The GNU C library defines this for functions which it implements
9354 to always fail with ENOSYS. Some functions are actually named
9355 something starting with __ and the normal name is an alias. */
9356#if defined (__stub_lchown) || defined (__stub___lchown)
9357choke me
9358#else
9359lchown();
9360#endif
9361; return 0; }
9362EOCP
9363set try
9364if eval $compile; then
9365 $echo "lchown() found." >&4
9366 val="$define"
9367else
9368 $echo "lchown() NOT found." >&4
9369 val="$undef"
9370fi
9371set d_lchown
9372eval $setvar
9373
2d4389e4
JH
9374: See if number of significant digits in a double precision number is known
9375echo " "
9376$cat >ldbl_dig.c <<EOM
9377#$i_limits I_LIMITS
9378#$i_float I_FLOAT
9379#ifdef I_LIMITS
9380#include <limits.h>
9381#endif
9382#ifdef I_FLOAT
9383#include <float.h>
9384#endif
9385#ifdef LDBL_DIG
9386printf("Contains LDBL_DIG");
9387#endif
9388EOM
9389$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9390if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9391 echo "LDBL_DIG found." >&4
9392 val="$define"
9393else
9394 echo "LDBL_DIG NOT found." >&4
9395 val="$undef"
9396fi
9397$rm -f ldbl_dig.?
9398set d_ldbl_dig
9399eval $setvar
9400
a0d0e21e
LW
9401: see if link exists
9402set link d_link
9403eval $inlibc
9404
a0d0e21e
LW
9405: see if localeconv exists
9406set localeconv d_locconv
9407eval $inlibc
9408
9409: see if lockf exists
9410set lockf d_lockf
9411eval $inlibc
9412
8175356b
JH
9413: check for long long
9414echo " "
9415$echo $n "Checking to see if your system supports long long..." $c >&4
213c275f 9416echo 'int main() { long long x = 7; return 0; }' > try.c
8175356b
JH
9417set try
9418if eval $compile; then
9419 val="$define"
9420 echo " Yes, it does." >&4
9421else
9422 val="$undef"
9423 echo " No, it doesn't." >&4
9424fi
9425$rm try.*
9426set d_longlong
9427eval $setvar
9428
9429: check for length of long long
9430case "${d_longlong}${longlongsize}" in
9431$define)
9432 echo " "
9433 $echo $n "Checking to see how big your long longs are..." $c >&4
9434 $cat >try.c <<'EOCP'
9435#include <stdio.h>
9436int main()
9437{
213c275f
JH
9438 printf("%d\n", (int)sizeof(long long));
9439 return(0);
8175356b
JH
9440}
9441EOCP
9442 set try
9443 if eval $compile_ok; then
9444 longlongsize=`./try$exe_ext`
9445 $echo " $longlongsize bytes." >&4
9446 else
9447 dflt='8'
9448 echo " "
9449 echo "(I can't seem to compile the test program. Guessing...)"
9450 rp="What is the size of a long long (in bytes)?"
9451 . ./myread
9452 longlongsize="$ans"
9453 fi
9454 if $test "X$longsize" = "X$longlongsize"; then
9455 echo "(That isn't any different from an ordinary long.)"
9456 fi
9457 ;;
9458esac
9459$rm -f try.* try
9460
a0d0e21e
LW
9461: see if lstat exists
9462set lstat d_lstat
9463eval $inlibc
9464
9465: see if mblen exists
9466set mblen d_mblen
9467eval $inlibc
9468
9469: see if mbstowcs exists
9470set mbstowcs d_mbstowcs
9471eval $inlibc
9472
9473: see if mbtowc exists
9474set mbtowc d_mbtowc
9475eval $inlibc
9476
0f27ced1
JH
9477: see if memchr exists
9478set memchr d_memchr
9479eval $inlibc
9480
a0d0e21e
LW
9481: see if memcmp exists
9482set memcmp d_memcmp
9483eval $inlibc
9484
9485: see if memcpy exists
9486set memcpy d_memcpy
9487eval $inlibc
9488
9489: see if memmove exists
9490set memmove d_memmove
2304df62
AD
9491eval $inlibc
9492
9493: see if memset exists
9494set memset d_memset
9495eval $inlibc
9496
9497: see if mkdir exists
9498set mkdir d_mkdir
9499eval $inlibc
9500
fe749a9f
JH
9501: see if mkdtemp exists
9502set mkdtemp d_mkdtemp
9503eval $inlibc
9504
a0d0e21e
LW
9505: see if mkfifo exists
9506set mkfifo d_mkfifo
9507eval $inlibc
9508
fe749a9f
JH
9509: see if mkstemp exists
9510set mkstemp d_mkstemp
9511eval $inlibc
9512
9513: see if mkstemps exists
9514set mkstemps d_mkstemps
9515eval $inlibc
9516
a0d0e21e
LW
9517: see if mktime exists
9518set mktime d_mktime
9519eval $inlibc
9520
fe749a9f
JH
9521: see if mprotect exists
9522set mprotect d_mprotect
9523eval $inlibc
9524
2304df62
AD
9525: see if msgctl exists
9526set msgctl d_msgctl
9527eval $inlibc
9528
9529: see if msgget exists
9530set msgget d_msgget
9531eval $inlibc
9532
9533: see if msgsnd exists
9534set msgsnd d_msgsnd
9535eval $inlibc
9536
9537: see if msgrcv exists
9538set msgrcv d_msgrcv
9539eval $inlibc
9540
9541: see how much of the 'msg*(2)' library is present.
9542h_msg=true
9543echo " "
9544case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9545*"$undef"*) h_msg=false;;
9546esac
6087ac44
JH
9547case "$osname" in
9548freebsd)
9549 case "`ipcs 2>&1`" in
9550 "SVID messages"*"not configured"*)
5ff3f7a4 9551 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9552 h_msg=false
9553 val="$undef"
9554 set msgctl d_msgctl
9555 eval $setvar
9556 set msgget d_msgget
9557 eval $setvar
9558 set msgsnd d_msgsnd
9559 eval $setvar
9560 set msgrcv d_msgrcv
9561 eval $setvar
9562 ;;
9563 esac
9564 ;;
9565esac
2304df62
AD
9566: we could also check for sys/ipc.h ...
9567if $h_msg && $test `./findhdr sys/msg.h`; then
9568 echo "You have the full msg*(2) library." >&4
9569 val="$define"
9570else
9571 echo "You don't have the full msg*(2) library." >&4
9572 val="$undef"
9573fi
9574set d_msg
9575eval $setvar
9576
fe749a9f
JH
9577: see if msync exists
9578set msync d_msync
dfe9444c
AD
9579eval $inlibc
9580
fe749a9f
JH
9581: see if munmap exists
9582set munmap d_munmap
9583eval $inlibc
ff935051 9584
fe749a9f
JH
9585: see if nice exists
9586set nice d_nice
9587eval $inlibc
ff935051 9588
de1c2614
JH
9589
9590echo " "
6b8eaf93 9591echo "Checking which 64-bit integer type we could use..." >&4
de1c2614
JH
9592
9593case "$intsize" in
95948) val=int
9595 set quadtype
9596 eval $setvar
9597 val='"unsigned int"'
9598 set uquadtype
9599 eval $setvar
6b8eaf93 9600 quadkind=1
de1c2614
JH
9601 ;;
9602*) case "$longsize" in
9603 8) val=long
9604 set quadtype
9605 eval $setvar
9606 val='"unsigned long"'
9607 set uquadtype
9608 eval $setvar
6b8eaf93 9609 quadkind=2
de1c2614 9610 ;;
43999f95
JH
9611 *) case "$d_longlong:$longlongsize" in
9612 define:8)
de1c2614
JH
9613 val='"long long"'
9614 set quadtype
9615 eval $setvar
9616 val='"unsigned long long"'
9617 set uquadtype
9618 eval $setvar
6b8eaf93 9619 quadkind=3
de1c2614
JH
9620 ;;
9621 *) case "$d_int64t" in
9622 define)
9623 val=int64_t
9624 set quadtype
9625 eval $setvar
9626 val=uint64_t
9627 set uquadtype
9628 eval $setvar
6b8eaf93 9629 quadkind=4
de1c2614
JH
9630 ;;
9631 esac
9632 ;;
9633 esac
9634 ;;
9635 esac
9636 ;;
9637esac
9638
9639case "$quadtype" in
ad551343 9640'') echo "Alas, no 64-bit integer types in sight." >&4
de1c2614
JH
9641 d_quad="$undef"
9642 ;;
1eeb0f31
JH
9643*) if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9644 verb="will"
9645 else
9646 verb="could"
9647 fi
9648 echo "We $verb use '$quadtype' for 64-bit integers." >&4
de1c2614
JH
9649 d_quad="$define"
9650 ;;
9651esac
9652
cce08f5b
JH
9653: check for length of character
9654echo " "
9655case "$charsize" in
9656'')
9657 echo "Checking to see how big your characters are (hey, you never know)..." >&4
9658 $cat >try.c <<'EOCP'
9659#include <stdio.h>
9660int main()
9661{
9662 printf("%d\n", (int)sizeof(char));
9663 exit(0);
9664}
9665EOCP
9666 set try
9667 if eval $compile_ok; then
9668 dflt=`./try`
9669 else
9670 dflt='1'
9671 echo "(I can't seem to compile the test program. Guessing...)"
9672 fi
9673 ;;
9674*)
9675 dflt="$charsize"
9676 ;;
9677esac
9678rp="What is the size of a character (in bytes)?"
9679. ./myread
9680charsize="$ans"
9681$rm -f try.c try
9682
9683
9684echo " "
9685$echo "Choosing the C types to be used for Perl's internal types..." >&4
9686
9687case "$use64bits:$d_quad:$quadtype" in
9688define:define:?*)
9689 ivtype="$quadtype"
9690 uvtype="$uquadtype"
9691 ivsize=8
9692 uvsize=8
9693 ;;
9694*) ivtype="long"
9695 uvtype="unsigned long"
9696 ivsize=$longsize
9697 uvsize=$longsize
9698 ;;
9699esac
9700
9701case "$uselongdouble:$d_longdbl" in
9702define:define)
9703 nvtype="long double"
9704 nvsize=$longdblsize
9705 ;;
9706*) nvtype=double
9707 nvsize=$doublesize
9708 ;;
9709esac
9710
9711$echo "(IV will be "$ivtype", $ivsize bytes)"
9712$echo "(UV will be "$uvtype", $uvsize bytes)"
9713$echo "(NV will be "$nvtype", $nvsize bytes)"
9714
9715$cat >try.c <<EOCP
9716#$i_inttypes I_INTTYPES
9717#ifdef I_INTTYPES
9718#include <inttypes.h>
9719#endif
9720#include <stdio.h>
9721int main() {
9722#ifdef INT8
9723 int8_t i = INT8_MAX;
9724 uint8_t u = UINT8_MAX;
9725 printf("int8_t\n");
9726#endif
9727#ifdef INT16
9728 int16_t i = INT16_MAX;
9729 uint16_t i = UINT16_MAX;
9730 printf("int16_t\n");
9731#endif
9732#ifdef INT32
9733 int32_t i = INT32_MAX;
9734 uint32_t u = UINT32_MAX;
9735 printf("int32_t\n");
9736#endif
9737}
9738EOCP
9739
9740case "$i8type" in
9741'') case "$charsize" in
9742 1) i8type=char
9743 u8type="unsigned char"
9744 i8size=$charsize
9745 u8size=$charsize
9746 ;;
9747 esac
9748 ;;
9749esac
9750case "$i8type" in
9751'') set try -DINT8
9752 if eval $compile; then
9753 case "`./try$exe_ext`" in
9754 int8_t) i8type=int8_t
9755 u8type=uint8_t
9756 i8size=1
9757 u8size=1
9758 ;;
9759 esac
9760 fi
9761 ;;
9762esac
9763case "$i8type" in
9764'') if $test $charsize -ge 1; then
9765 i8type=char
9766 u8type="unsigned char"
9767 i8size=$charsize
9768 u8size=$charsize
9769 fi
9770 ;;
9771esac
9772
9773case "$i16type" in
9774'') case "$shortsize" in
9775 2) i16type=short
9776 u16type="unsigned short"
9777 i16size=$shortsize
9778 u16size=$shortsize
9779 ;;
9780 esac
9781 ;;
9782esac
9783case "$i16type" in
9784'') set try -DINT16
9785 if eval $compile; then
9786 case "`./try$exe_ext`" in
9787 int16_t)
9788 i16type=int16_t
9789 u16type=uint16_t
9790 i16size=2
9791 u16size=2
9792 ;;
9793 esac
9794 fi
9795 ;;
9796esac
9797case "$i16type" in
9798'') if $test $shortsize -ge 2; then
9799 i16type=short
9800 u16type="unsigned short"
9801 i16size=$shortsize
9802 u16size=$shortsize
9803 fi
9804 ;;
9805esac
9806
9807case "$i32type" in
9808'') case "$longsize" in
9809 4) i32type=long
9810 u32type="unsigned long"
9811 i32size=$longsize
9812 u32size=$longsize
9813 ;;
9814 *) case "$intsize" in
9815 4) i32type=int
9816 u32type="unsigned int"
9817 i32size=$intsize
9818 u32size=$intsize
9819 ;;
9820 esac
9821 ;;
9822 esac
9823 ;;
9824esac
9825case "$i32type" in
9826'') set try -DINT32
9827 if eval $compile; then
9828 case "`./try$exe_ext`" in
9829 int32_t)
9830 i32type=int32_t
9831 u32type=uint32_t
9832 i32size=4
9833 u32size=4
9834 ;;
9835 esac
9836 fi
9837 ;;
9838esac
9839case "$i32type" in
9840'') if $test $intsize -ge 4; then
9841 i32type=int
9842 u32type="unsigned int"
9843 i32size=$intsize
9844 u32size=$intsize
9845 fi
9846 ;;
9847esac
9848
9849case "$i64type" in
9850'') case "$d_quad:$quadtype" in
9851 define:?*)
9852 i64type="$quadtype"
9853 u64type="$uquadtype"
9854 i64size=8
9855 u64size=8
9856 ;;
9857 esac
9858 ;;
9859esac
9860
9861$echo "Checking whether your NVs can preserve your UVs..." >&4
9862$cat <<EOP >try.c
9863#include <stdio.h>
9864int main() {
9865 $uvtype k = ($uvtype)~0, l;
9866 $nvtype d;
9867 l = k;
9868 d = ($nvtype)l;
9869 l = ($uvtype)d;
9870 if (l == k)
9871 printf("preserve\n");
9872 exit(0);
9873}
9874EOP
9875set try
9876if eval $compile; then
9877 case "`./try$exe_ext`" in
78691af5 9878 preserve) d_nv_preserves_uv="$define" ;;
cce08f5b
JH
9879 esac
9880fi
78691af5 9881case "$d_nv_preserves_uv" in
cce08f5b
JH
9882$define) $echo "Yes, they can." 2>&1 ;;
9883*) $echo "No, they can't." 2>&1
78691af5 9884 d_nv_preserves_uv="$undef"
cce08f5b
JH
9885 ;;
9886esac
9887
9888$rm -f try.* try
9889
c4747d3e 9890: see if POSIX threads are available
1f5ae88c
JH
9891set pthread.h i_pthread
9892eval $inhdr
9893
c4747d3e
JH
9894
9895
9896
9897: how to create joinable pthreads
9898if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
9899 echo " "
9900 echo "Checking what constant to use for creating joinable pthreads..." >&4
9901 $cat >try.c <<'EOCP'
9902#include <pthread.h>
9903int main() {
9904 int detachstate = JOINABLE;
9905}
9906EOCP
9907 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9908 if eval $compile; then
c6912327 9909 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
9910 val="$undef" # Yes, undef.
9911 set d_old_pthread_create_joinable
13666627 9912 eval $setvar
ef4af2be
JH
9913 val=""
9914 set old_pthread_create_joinable
13666627
JH
9915 eval $setvar
9916 else
9917 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9918 if eval $compile; then
c6912327 9919 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 9920 val="$define"
ef4af2be 9921 set d_old_pthread_create_joinable
13666627
JH
9922 eval $setvar
9923 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 9924 set old_pthread_create_joinable
13666627
JH
9925 eval $setvar
9926 else
9927 set try -DJOINABLE=__UNDETACHED
9928 if eval $compile; then
c6912327 9929 echo "You seem to use __UNDETACHED." >&4
13666627 9930 val="$define"
ef4af2be 9931 set d_old_pthread_create_joinable
13666627
JH
9932 eval $setvar
9933 val=__UNDETACHED
ef4af2be 9934 set old_pthread_create_joinable
13666627
JH
9935 eval $setvar
9936 else
c6912327 9937 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 9938 val="$define"
ef4af2be 9939 set d_old_pthread_create_joinable
13666627
JH
9940 eval $setvar
9941 val=0
ef4af2be 9942 set old_pthread_create_joinable
13666627
JH
9943 eval $setvar
9944 fi
9945 fi
9946 fi
9947 $rm -f try try.*
9948else
ef4af2be
JH
9949 d_old_pthread_create_joinable="$undef"
9950 old_pthread_create_joinable=""
13666627
JH
9951fi
9952
ef4af2be
JH
9953: see if pause exists
9954set pause d_pause
9955eval $inlibc
9956
9957: see if pipe exists
9958set pipe d_pipe
9959eval $inlibc
9960
9961: see if poll exists
9962set poll d_poll
9963eval $inlibc
9964
31dfa2f6
JH
9965
9966: see whether the various POSIXish _yields exist
9967$cat >try.c <<EOP
9968#include <pthread.h>
9969#include <stdio.h>
5a411a32 9970int main() {
31dfa2f6
JH
9971#ifdef SCHED_YIELD
9972 sched_yield();
9973#else
9974#ifdef PTHREAD_YIELD
9975 pthread_yield();
9976#else
9977#ifdef PTHREAD_YIELD_NULL
9978 pthread_yield(NULL);
9979#endif
9980#endif
9981#endif
9982}
9983EOP
9984: see if sched_yield exists
9985set try -DSCHED_YIELD
9986if eval $compile; then
9987 val="$define"
9988 sched_yield='sched_yield()'
9989else
9990 val="$undef"
9991fi
9992case "$usethreads" in
9993$define)
9994 case "$val" in
9995 $define) echo 'sched_yield() found.' >&4 ;;
9996 *) echo 'sched_yield() NOT found.' >&4 ;;
9997 esac
9998esac
9999set d_sched_yield
10000eval $setvar
10001
10002: see if pthread_yield exists
10003set try -DPTHREAD_YIELD
10004if eval $compile; then
10005 val="$define"
10006 case "$sched_yield" in
10007 '') sched_yield='pthread_yield()' ;;
10008 esac
10009else
10010 set try -DPTHREAD_YIELD_NULL
10011 if eval $compile; then
10012 val="$define"
10013 case "$sched_yield" in
10014 '') sched_yield='pthread_yield(NULL)' ;;
10015 esac
10016 else
10017 val="$undef"
10018 fi
10019fi
10020case "$usethreads" in
10021$define)
10022 case "$val" in
10023 $define) echo 'pthread_yield() found.' >&4 ;;
10024 *) echo 'pthread_yield() NOT found.' >&4 ;;
10025 esac
10026 ;;
10027esac
10028set d_pthread_yield
10029eval $setvar
10030
10031case "$sched_yield" in
10032'') sched_yield=undef ;;
10033esac
10034
10035$rm -f try try.*
10036
4aa0a1f7
AD
10037: see if this is a pwd.h system
10038set pwd.h i_pwd
10039eval $inhdr
10040
10041case "$i_pwd" in
10042$define)
10043 xxx=`./findhdr pwd.h`
85e6fe83 10044 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 10045
2304df62 10046 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 10047 val="$define"
2304df62 10048 else
4aa0a1f7 10049 val="$undef"
2304df62 10050 fi
4aa0a1f7
AD
10051 set d_pwquota
10052 eval $setvar
10053
2304df62 10054 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 10055 val="$define"
2304df62 10056 else
4aa0a1f7 10057 val="$undef"
2304df62 10058 fi
4aa0a1f7
AD
10059 set d_pwage
10060 eval $setvar
10061
2304df62 10062 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 10063 val="$define"
2304df62 10064 else
4aa0a1f7 10065 val="$undef"
2304df62 10066 fi
4aa0a1f7
AD
10067 set d_pwchange
10068 eval $setvar
10069
2304df62 10070 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 10071 val="$define"
2304df62 10072 else
4aa0a1f7 10073 val="$undef"
2304df62 10074 fi
4aa0a1f7
AD
10075 set d_pwclass
10076 eval $setvar
10077
2304df62 10078 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 10079 val="$define"
2304df62 10080 else
4aa0a1f7 10081 val="$undef"
2304df62 10082 fi
4aa0a1f7 10083 set d_pwexpire
cce08f5b 10084 eval $setvar
de1c2614 10085
cce08f5b
JH
10086 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10087 val="$define"
1eeb0f31 10088 else
cce08f5b 10089 val="$undef"
1eeb0f31 10090 fi
cce08f5b
JH
10091 set d_pwcomment
10092 eval $setvar
10093
10094 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10095 val="$define"
10096 else
10097 val="$undef"
10098 fi
10099 set d_pwgecos
10100 eval $setvar
10101
10102 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10103 val="$define"
10104 else
10105 val="$undef"
10106 fi
10107 set d_pwpasswd
10108 eval $setvar
10109
10110 $rm -f $$.h
10111 ;;
10112*)
10113 val="$undef";
10114 set d_pwquota; eval $setvar
10115 set d_pwage; eval $setvar
10116 set d_pwchange; eval $setvar
10117 set d_pwclass; eval $setvar
10118 set d_pwexpire; eval $setvar
10119 set d_pwcomment; eval $setvar
10120 set d_pwgecos; eval $setvar
10121 set d_pwpasswd; eval $setvar
de1c2614
JH
10122 ;;
10123esac
10124
85e6fe83 10125: see if readdir and friends exist
2304df62
AD
10126set readdir d_readdir
10127eval $inlibc
85e6fe83
LW
10128set seekdir d_seekdir
10129eval $inlibc
10130set telldir d_telldir
10131eval $inlibc
10132set rewinddir d_rewinddir
10133eval $inlibc
2304df62 10134
a0d0e21e
LW
10135: see if readlink exists
10136set readlink d_readlink
10137eval $inlibc
10138
2304df62
AD
10139: see if rename exists
10140set rename d_rename
10141eval $inlibc
10142
10143: see if rmdir exists
10144set rmdir d_rmdir
10145eval $inlibc
10146
8ff267be 10147: see if memory.h is available.
10148val=''
10149set memory.h val
10150eval $inhdr
10151
10152: See if it conflicts with string.h
10153case "$val" in
10154$define)
10155 case "$strings" in
10156 '') ;;
10157 *)
10158 $cppstdin $cppflags $cppminus < $strings > mem.h
10159 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10160 echo " "
10161 echo "We won't be including <memory.h>."
10162 val="$undef"
10163 fi
10164 $rm -f mem.h
10165 ;;
10166 esac
10167esac
10168set i_memory
10169eval $setvar
10170
2304df62
AD
10171: can bcopy handle overlapping blocks?
10172val="$undef"
10173case "$d_bcopy" in
10174"$define")
10175 echo " "
10176 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 10177 $cat >try.c <<EOCP
8ff267be 10178#$i_memory I_MEMORY
10179#$i_stdlib I_STDLIB
10180#$i_string I_STRING
10181#$i_unistd I_UNISTD
10182EOCP
dfe9444c 10183 $cat >>try.c <<'EOCP'
8ff267be 10184#include <stdio.h>
8ff267be 10185#ifdef I_MEMORY
10186# include <memory.h>
10187#endif
10188#ifdef I_STDLIB
10189# include <stdlib.h>
10190#endif
10191#ifdef I_STRING
10192# include <string.h>
10193#else
10194# include <strings.h>
10195#endif
10196#ifdef I_UNISTD
10197# include <unistd.h> /* Needed for NetBSD */
10198#endif
d674cd6d 10199int main()
2304df62 10200{
85e6fe83
LW
10201char buf[128], abc[128];
10202char *b;
10203int len;
10204int off;
10205int align;
a0d0e21e 10206
85e6fe83 10207bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
10208
10209for (align = 7; align >= 0; align--) {
10210 for (len = 36; len; len--) {
10211 b = buf+align;
85e6fe83 10212 bcopy(abc, b, len);
2304df62
AD
10213 for (off = 1; off <= len; off++) {
10214 bcopy(b, b+off, len);
10215 bcopy(b+off, b, len);
85e6fe83 10216 if (bcmp(b, abc, len))
2304df62
AD
10217 exit(1);
10218 }
10219 }
10220}
10221exit(0);
10222}
10223EOCP
dfe9444c 10224 set try
dc45a647 10225 if eval $compile_ok; then
dfe9444c 10226 if ./try 2>/dev/null; then
2304df62
AD
10227 echo "Yes, it can."
10228 val="$define"
10229 else
10230 echo "It can't, sorry."
8ff267be 10231 case "$d_memmove" in
10232 "$define") echo "But that's Ok since you have memmove()." ;;
10233 esac
2304df62
AD
10234 fi
10235 else
10236 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10237 case "$d_memmove" in
10238 "$define") echo "But that's Ok since you have memmove()." ;;
10239 esac
2304df62
AD
10240 fi
10241 ;;
10242esac
dfe9444c 10243$rm -f try.* try core
2304df62
AD
10244set d_safebcpy
10245eval $setvar
10246
10247: can memcpy handle overlapping blocks?
10248val="$undef"
10249case "$d_memcpy" in
10250"$define")
10251 echo " "
10252 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 10253 $cat >try.c <<EOCP
8ff267be 10254#$i_memory I_MEMORY
10255#$i_stdlib I_STDLIB
10256#$i_string I_STRING
10257#$i_unistd I_UNISTD
10258EOCP
dfe9444c 10259 $cat >>try.c <<'EOCP'
8ff267be 10260#include <stdio.h>
8ff267be 10261#ifdef I_MEMORY
10262# include <memory.h>
10263#endif
10264#ifdef I_STDLIB
10265# include <stdlib.h>
10266#endif
10267#ifdef I_STRING
10268# include <string.h>
10269#else
10270# include <strings.h>
10271#endif
10272#ifdef I_UNISTD
10273# include <unistd.h> /* Needed for NetBSD */
10274#endif
d674cd6d 10275int main()
2304df62 10276{
85e6fe83
LW
10277char buf[128], abc[128];
10278char *b;
10279int len;
10280int off;
10281int align;
10282
8ff267be 10283/* Copy "abcde..." string to char abc[] so that gcc doesn't
10284 try to store the string in read-only memory. */
85e6fe83 10285memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
10286
10287for (align = 7; align >= 0; align--) {
10288 for (len = 36; len; len--) {
10289 b = buf+align;
232e078e 10290 memcpy(b, abc, len);
2304df62 10291 for (off = 1; off <= len; off++) {
2304df62 10292 memcpy(b+off, b, len);
232e078e 10293 memcpy(b, b+off, len);
85e6fe83 10294 if (memcmp(b, abc, len))
2304df62
AD
10295 exit(1);
10296 }
10297 }
10298}
10299exit(0);
10300}
10301EOCP
dfe9444c 10302 set try
dc45a647 10303 if eval $compile_ok; then
dfe9444c 10304 if ./try 2>/dev/null; then
2304df62
AD
10305 echo "Yes, it can."
10306 val="$define"
10307 else
10308 echo "It can't, sorry."
8ff267be 10309 case "$d_memmove" in
10310 "$define") echo "But that's Ok since you have memmove()." ;;
10311 esac
2304df62
AD
10312 fi
10313 else
10314 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10315 case "$d_memmove" in
10316 "$define") echo "But that's Ok since you have memmove()." ;;
10317 esac
2304df62
AD
10318 fi
10319 ;;
10320esac
dfe9444c 10321$rm -f try.* try core
2304df62
AD
10322set d_safemcpy
10323eval $setvar
10324
36477c24 10325: can memcmp be trusted to compare relative magnitude?
10326val="$undef"
10327case "$d_memcmp" in
10328"$define")
10329 echo " "
dfe9444c
AD
10330 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10331 $cat >try.c <<EOCP
36477c24 10332#$i_memory I_MEMORY
10333#$i_stdlib I_STDLIB
10334#$i_string I_STRING
10335#$i_unistd I_UNISTD
10336EOCP
dfe9444c 10337 $cat >>try.c <<'EOCP'
36477c24 10338#include <stdio.h>
36477c24 10339#ifdef I_MEMORY
10340# include <memory.h>
10341#endif
10342#ifdef I_STDLIB
10343# include <stdlib.h>
10344#endif
10345#ifdef I_STRING
10346# include <string.h>
10347#else
10348# include <strings.h>
10349#endif
10350#ifdef I_UNISTD
10351# include <unistd.h> /* Needed for NetBSD */
10352#endif
d674cd6d 10353int main()
36477c24 10354{
10355char a = -1;
10356char b = 0;
10357if ((a < b) && memcmp(&a, &b, 1) < 0)
10358 exit(1);
10359exit(0);
10360}
10361EOCP
dfe9444c 10362 set try
dc45a647 10363 if eval $compile_ok; then
dfe9444c 10364 if ./try 2>/dev/null; then
36477c24 10365 echo "Yes, it can."
10366 val="$define"
10367 else
10368 echo "No, it can't (it uses signed chars)."
10369 fi
10370 else
10371 echo "(I can't compile the test program, so we'll assume not...)"
10372 fi
10373 ;;
10374esac
dfe9444c 10375$rm -f try.* try core
36477c24 10376set d_sanemcmp
10377eval $setvar
10378
2304df62
AD
10379: see if select exists
10380set select d_select
10381eval $inlibc
10382
10383: see if semctl exists
10384set semctl d_semctl
10385eval $inlibc
10386
10387: see if semget exists
10388set semget d_semget
10389eval $inlibc
10390
10391: see if semop exists
10392set semop d_semop
10393eval $inlibc
10394
10395: see how much of the 'sem*(2)' library is present.
10396h_sem=true
10397echo " "
10398case "$d_semctl$d_semget$d_semop" in
10399*"$undef"*) h_sem=false;;
10400esac
6087ac44
JH
10401case "$osname" in
10402freebsd)
10403 case "`ipcs 2>&1`" in
10404 "SVID messages"*"not configured"*)
5ff3f7a4 10405 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
10406 h_sem=false
10407 val="$undef"
10408 set semctl d_semctl
10409 eval $setvar
10410 set semget d_semget
10411 eval $setvar
10412 set semop d_semop
10413 eval $setvar
10414 ;;
10415 esac
10416 ;;
10417esac
2304df62
AD
10418: we could also check for sys/ipc.h ...
10419if $h_sem && $test `./findhdr sys/sem.h`; then
10420 echo "You have the full sem*(2) library." >&4
10421 val="$define"
10422else
10423 echo "You don't have the full sem*(2) library." >&4
10424 val="$undef"
10425fi
10426set d_sem
10427eval $setvar
10428
bd89102f
AD
10429: see whether sys/sem.h defines union semun
10430echo " "
10431$cat > try.c <<'END'
10432#include <sys/types.h>
10433#include <sys/ipc.h>
10434#include <sys/sem.h>
10435int main () { union semun semun; semun.buf = 0; }
10436END
10437set try
10438if eval $compile; then
10439 echo "You have union semun in <sys/sem.h>." >&4
10440 val="$define"
10441else
10442 echo "You do not have union semun in <sys/sem.h>." >&4
10443 val="$undef"
10444fi
85ab1d1d 10445$rm -f try try.c try.h
bd89102f
AD
10446set d_union_semun
10447eval $setvar
10448
10449: see how to do semctl IPC_STAT
10450case "$d_sem" in
10451$define)
10452 : see whether semctl IPC_STAT can use union semun
10453 echo " "
85ab1d1d
JH
10454 $cat > try.h <<END
10455#ifndef S_IRUSR
10456# ifdef S_IREAD
10457# define S_IRUSR S_IREAD
10458# define S_IWUSR S_IWRITE
10459# define S_IXUSR S_IEXEC
10460# else
10461# define S_IRUSR 0400
10462# define S_IWUSR 0200
10463# define S_IXUSR 0100
10464# endif
10465# define S_IRGRP (S_IRUSR>>3)
10466# define S_IWGRP (S_IWUSR>>3)
10467# define S_IXGRP (S_IXUSR>>3)
10468# define S_IROTH (S_IRUSR>>6)
10469# define S_IWOTH (S_IWUSR>>6)
10470# define S_IXOTH (S_IXUSR>>6)
10471#endif
10472#ifndef S_IRWXU
10473# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10474# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10475# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10476#endif
10477END
10478
bd89102f
AD
10479 $cat > try.c <<END
10480#include <sys/types.h>
10481#include <sys/ipc.h>
10482#include <sys/sem.h>
10483#include <sys/stat.h>
10484#include <stdio.h>
10485#include <errno.h>
85ab1d1d 10486#include "try.h"
bd89102f
AD
10487#ifndef errno
10488extern int errno;
10489#endif
10490#$d_union_semun HAS_UNION_SEMUN
10491int main() {
10492 union semun
10493#ifndef HAS_UNION_SEMUN
10494 {
10495 int val;
10496 struct semid_ds *buf;
10497 unsigned short *array;
10498 }
10499#endif
10500 arg;
10501 int sem, st;
10502
10503#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10504 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10505 if (sem > -1) {
10506 struct semid_ds argbuf;
10507 arg.buf = &argbuf;
10508# ifdef IPC_STAT
10509 st = semctl(sem, 0, IPC_STAT, arg);
10510 if (st == 0)
10511 printf("semun\n");
10512 else
10513# endif /* IPC_STAT */
10514 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10515# ifdef IPC_RMID
10516 if (semctl(sem, 0, IPC_RMID, arg) != 0)
10517# endif /* IPC_RMID */
10518 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10519 } else
10520#endif /* IPC_PRIVATE && ... */
10521 printf("semget failed: errno = %d\n", errno);
10522 return 0;
10523}
10524END
10525 val="$undef"
10526 set try
10527 if eval $compile; then
10528 xxx=`./try`
10529 case "$xxx" in
10530 semun) val="$define" ;;
10531 esac
10532 fi
10533 $rm -f try try.c
10534 set d_semctl_semun
10535 eval $setvar
10536 case "$d_semctl_semun" in
10537 $define)
10538 echo "You can use union semun for semctl IPC_STAT." >&4
10539 also='also'
10540 ;;
10541 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
10542 also=''
10543 ;;
10544 esac
10545
10546 : see whether semctl IPC_STAT can use struct semid_ds pointer
10547 $cat > try.c <<'END'
10548#include <sys/types.h>
10549#include <sys/ipc.h>
10550#include <sys/sem.h>
10551#include <sys/stat.h>
85ab1d1d 10552#include "try.h"
bd89102f
AD
10553#include <stdio.h>
10554#include <errno.h>
10555#ifndef errno
10556extern int errno;
10557#endif
10558int main() {
10559 struct semid_ds arg;
10560 int sem, st;
10561
10562#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10563 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10564 if (sem > -1) {
10565# ifdef IPC_STAT
10566 st = semctl(sem, 0, IPC_STAT, &arg);
10567 if (st == 0)
10568 printf("semid_ds\n");
10569 else
10570# endif /* IPC_STAT */
10571 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10572# ifdef IPC_RMID
10573 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10574# endif /* IPC_RMID */
10575 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10576 } else
10577#endif /* IPC_PRIVATE && ... */
10578 printf("semget failed: errno = %d\n", errno);
10579
10580 return 0;
10581}
10582END
10583 val="$undef"
10584 set try
10585 if eval $compile; then
10586 xxx=`./try`
10587 case "$xxx" in
10588 semid_ds) val="$define" ;;
10589 esac
10590 fi
10591 $rm -f try try.c
10592 set d_semctl_semid_ds
10593 eval $setvar
10594 case "$d_semctl_semid_ds" in
10595 $define)
7f3d1cf1 10596 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 10597 ;;
7f3d1cf1 10598 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
10599 ;;
10600 esac
85ab1d1d 10601 $rm -f try.h
bd89102f
AD
10602 ;;
10603*) val="$undef"
10604
10605 # We do not have the full sem*(2) library, so assume we can not
10606 # use either.
10607
10608 set d_semctl_semun
10609 eval $setvar
10610
10611 set d_semctl_semid_ds
10612 eval $setvar
10613 ;;
10614esac
10615
2304df62
AD
10616: see if setegid exists
10617set setegid d_setegid
10618eval $inlibc
10619
10620: see if seteuid exists
10621set seteuid d_seteuid
10622eval $inlibc
10623
5ff3f7a4
GS
10624: see if setgrent exists
10625set setgrent d_setgrent
10626eval $inlibc
10627
693762b4
AD
10628: see if sethostent exists
10629set sethostent d_sethent
10630eval $inlibc
10631
a0d0e21e
LW
10632: see if setlinebuf exists
10633set setlinebuf d_setlinebuf
10634eval $inlibc
10635
2304df62
AD
10636: see if setlocale exists
10637set setlocale d_setlocale
10638eval $inlibc
a0d0e21e 10639
e5c9fcd0
AD
10640: see if setnetent exists
10641set setnetent d_setnent
10642eval $inlibc
10643
10644: see if setprotoent exists
10645set setprotoent d_setpent
10646eval $inlibc
10647
2304df62
AD
10648: see if setpgid exists
10649set setpgid d_setpgid
10650eval $inlibc
10651
2304df62
AD
10652: see if setpgrp2 exists
10653set setpgrp2 d_setpgrp2
10654eval $inlibc
10655
10656: see if setpriority exists
10657set setpriority d_setprior
10658eval $inlibc
10659
5ff3f7a4
GS
10660: see if setpwent exists
10661set setpwent d_setpwent
10662eval $inlibc
10663
2304df62
AD
10664: see if setregid exists
10665set setregid d_setregid
10666eval $inlibc
10667set setresgid d_setresgid
10668eval $inlibc
10669
10670: see if setreuid exists
10671set setreuid d_setreuid
10672eval $inlibc
10673set setresuid d_setresuid
10674eval $inlibc
10675
10676: see if setrgid exists
10677set setrgid d_setrgid
10678eval $inlibc
10679
10680: see if setruid exists
10681set setruid d_setruid
10682eval $inlibc
10683
e5c9fcd0
AD
10684: see if setservent exists
10685set setservent d_setsent
10686eval $inlibc
10687
2304df62
AD
10688: see if setsid exists
10689set setsid d_setsid
10690eval $inlibc
10691
f1066039
JH
10692: see if setspent exists
10693set setspent d_setspent
10694eval $inlibc
10695
e5c9fcd0
AD
10696: see if setvbuf exists
10697set setvbuf d_setvbuf
10698eval $inlibc
10699
760ac839
LW
10700: see if sfio.h is available
10701set sfio.h i_sfio
10702eval $inhdr
10703
10704
8ff267be 10705: see if sfio library is available
760ac839
LW
10706case "$i_sfio" in
10707$define)
10708 val=''
10709 set sfreserve val
10710 eval $inlibc
10711 ;;
10712*)
10713 val="$undef"
10714 ;;
10715esac
8ff267be 10716: Ok, but do we want to use it.
760ac839
LW
10717case "$val" in
10718$define)
10719 case "$usesfio" in
8ff267be 10720 true|$define|[yY]*) dflt='y';;
760ac839
LW
10721 *) dflt='n';;
10722 esac
8ff267be 10723 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
10724 rp="You seem to have sfio available, do you want to try using it?"
10725 . ./myread
10726 case "$ans" in
8ff267be 10727 y|Y) ;;
10728 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 10729 val="$undef"
ff0cee69 10730 : Remove sfio from list of libraries to use
10731 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10732 shift
10733 libs="$*"
10734 echo "libs = $libs" >&4
760ac839
LW
10735 ;;
10736 esac
10737 ;;
8ff267be 10738*) case "$usesfio" in
10739 true|$define|[yY]*)
10740 echo "Sorry, cannot find sfio on this machine" >&4
10741 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
10742 ;;
10743 esac
10744 ;;
10745esac
8ff267be 10746set d_sfio
10747eval $setvar
760ac839
LW
10748case "$d_sfio" in
10749$define) usesfio='true';;
10750*) usesfio='false';;
10751esac
10752
2304df62
AD
10753: see if shmctl exists
10754set shmctl d_shmctl
10755eval $inlibc
10756
10757: see if shmget exists
10758set shmget d_shmget
10759eval $inlibc
10760
a0d0e21e
LW
10761: see if shmat exists
10762set shmat d_shmat
10763eval $inlibc
10764: see what shmat returns
10765case "$d_shmat" in
10766"$define")
10767 $cat >shmat.c <<'END'
10768#include <sys/shm.h>
10769void *shmat();
10770END
10771 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10772 shmattype='void *'
10773 else
10774 shmattype='char *'
10775 fi
10776 echo "and it returns ($shmattype)." >&4
10777 : see if a prototype for shmat is available
e50aee73
AD
10778 xxx=`./findhdr sys/shm.h`
10779 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
10780 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10781 val="$define"
10782 else
10783 val="$undef"
10784 fi
10785 $rm -f shmat.[co]
10786 ;;
10787*)
10788 val="$undef"
10789 ;;
10790esac
10791set d_shmatprototype
10792eval $setvar
10793
10794: see if shmdt exists
10795set shmdt d_shmdt
10796eval $inlibc
10797
10798: see how much of the 'shm*(2)' library is present.
10799h_shm=true
10800echo " "
10801case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10802*"$undef"*) h_shm=false;;
10803esac
6087ac44
JH
10804case "$osname" in
10805freebsd)
10806 case "`ipcs 2>&1`" in
10807 "SVID shared memory"*"not configured"*)
5ff3f7a4 10808 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
10809 h_shm=false
10810 val="$undef"
10811 set shmctl d_shmctl
10812 evat $setvar
10813 set shmget d_shmget
10814 evat $setvar
10815 set shmat d_shmat
10816 evat $setvar
10817 set shmdt d_shmdt
10818 evat $setvar
10819 ;;
10820 esac
10821 ;;
10822esac
a0d0e21e
LW
10823: we could also check for sys/ipc.h ...
10824if $h_shm && $test `./findhdr sys/shm.h`; then
10825 echo "You have the full shm*(2) library." >&4
10826 val="$define"
10827else
10828 echo "You don't have the full shm*(2) library." >&4
10829 val="$undef"
10830fi
10831set d_shm
10832eval $setvar
10833
2c7991dc 10834echo " "
8ff267be 10835: see if we have sigaction
10836if set sigaction val -f d_sigaction; eval $csym; $val; then
10837 echo 'sigaction() found.' >&4
dc45a647 10838 $cat > try.c <<'EOP'
8ff267be 10839#include <stdio.h>
10840#include <sys/types.h>
10841#include <signal.h>
d674cd6d 10842int main()
8ff267be 10843{
10844 struct sigaction act, oact;
190b66db 10845 act.sa_flags = 0;
48159a0c 10846 oact.sa_handler = 0;
14e4fe40
JH
10847 /* so that act and oact are used */
10848 exit(act.sa_flags == 0 && oact.sa_handler == 0);
8ff267be 10849}
10850EOP
dc45a647
MB
10851 set try
10852 if eval $compile_ok; then
10853 val="$define"
10854 else
10855 echo "But you don't seem to have a useable struct sigaction." >&4
10856 val="$undef"
10857 fi
8ff267be 10858else
dc45a647 10859 echo 'sigaction NOT found.' >&4
8ff267be 10860 val="$undef"
10861fi
10862set d_sigaction; eval $setvar
dfe9444c 10863$rm -f try try$_o try.c
2c7991dc 10864
a5f75d66
AD
10865: see if sigsetjmp exists
10866echo " "
921b2963
JH
10867case "$d_sigsetjmp" in
10868'')
10869 $cat >try.c <<'EOP'
10870#include <setjmp.h>
10871sigjmp_buf env;
10872int set = 1;
d674cd6d 10873int main()
921b2963
JH
10874{
10875 if (sigsetjmp(env,1))
10876 exit(set);
10877 set = 0;
10878 siglongjmp(env, 1);
10879 exit(1);
10880}
10881EOP
10882 set try
10883 if eval $compile; then
10884 if ./try >/dev/null 2>&1; then
10885 echo "POSIX sigsetjmp found." >&4
10886 val="$define"
10887 else
10888 $cat >&4 <<EOM
10889Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10890I'll ignore them.
10891EOM
10892 val="$undef"
a0d0e21e 10893 fi
921b2963
JH
10894 else
10895 echo "sigsetjmp not found." >&4
10896 val="$undef"
a0d0e21e 10897 fi
921b2963
JH
10898 ;;
10899*) val="$d_sigsetjmp"
10900 case "$d_sigsetjmp" in
10901 $define) echo "POSIX sigsetjmp found." >&4;;
10902 $undef) echo "sigsetjmp not found." >&4;;
10903 esac
10904 ;;
10905esac
10906set d_sigsetjmp
10907eval $setvar
10908$rm -f try.c try
2304df62 10909
d9b3e12d
JH
10910: see if sys/stat.h is available
10911set sys/stat.h i_sysstat
10912eval $inhdr
10913
b7b35fc2 10914
2304df62
AD
10915: see if stat knows about block sizes
10916echo " "
b7b35fc2 10917echo "Checking to see if your struct stat has st_blocks field..." >&4
5ff3f7a4
GS
10918set d_statblks stat st_blocks $i_sysstat sys/stat.h
10919eval $hasfield
2304df62 10920
b7b35fc2 10921
ad27e871
JH
10922: see if this is a sys/vfs.h system
10923set sys/vfs.h i_sysvfs
10924eval $inhdr
10925
b7b35fc2 10926
ad27e871
JH
10927: see if this is a sys/statfs.h system
10928set sys/statfs.h i_sysstatfs
10929eval $inhdr
10930
10931
10932echo " "
8175356b 10933echo "Checking to see if your system supports struct statfs..." >&4
ad27e871
JH
10934set 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
10935eval $hasstruct
10936case "$d_statfs_s" in
a22e52b9
JH
10937"$define") echo "Yes, it does." ;;
10938*) echo "No, it doesn't." ;;
ad27e871
JH
10939esac
10940
10941
10942
10943: see if struct statfs knows about f_flags
10944case "$d_statfs_s" in
10945define)
10946 echo " "
8175356b 10947 echo "Checking to see if your struct statfs has f_flags field..." >&4
ad27e871
JH
10948 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
10949 eval $hasfield
10950 ;;
10951*) val="$undef"
10952 set d_statfs_f_flags
10953 eval $setvar
10954 ;;
10955esac
10956case "$d_statfs_f_flags" in
a22e52b9
JH
10957"$define") echo "Yes, it does." ;;
10958*) echo "No, it doesn't." ;;
ad27e871
JH
10959esac
10960
16d20bd9
AD
10961: see if _ptr and _cnt from stdio act std
10962echo " "
dca663ed 10963if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
10964 echo "(Looks like you have stdio.h from Linux.)"
10965 case "$stdio_ptr" in
c2960299
AD
10966 '') stdio_ptr='((fp)->_IO_read_ptr)'
10967 ptr_lval=$define
10968 ;;
8e07c86e 10969 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10970 esac
10971 case "$stdio_cnt" in
c2960299
AD
10972 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10973 cnt_lval=$undef
10974 ;;
8e07c86e 10975 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10976 esac
10977 case "$stdio_base" in
10978 '') stdio_base='((fp)->_IO_read_base)';;
10979 esac
10980 case "$stdio_bufsiz" in
c2960299 10981 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
10982 esac
10983else
10984 case "$stdio_ptr" in
c2960299
AD
10985 '') stdio_ptr='((fp)->_ptr)'
10986 ptr_lval=$define
10987 ;;
8e07c86e 10988 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10989 esac
10990 case "$stdio_cnt" in
c2960299
AD
10991 '') stdio_cnt='((fp)->_cnt)'
10992 cnt_lval=$define
10993 ;;
8e07c86e 10994 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10995 esac
10996 case "$stdio_base" in
10997 '') stdio_base='((fp)->_base)';;
10998 esac
10999 case "$stdio_bufsiz" in
11000 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11001 esac
11002fi
11003: test whether _ptr and _cnt really work
11004echo "Checking how std your stdio is..." >&4
11005$cat >try.c <<EOP
11006#include <stdio.h>
11007#define FILE_ptr(fp) $stdio_ptr
11008#define FILE_cnt(fp) $stdio_cnt
d674cd6d 11009int main() {
16d20bd9
AD
11010 FILE *fp = fopen("try.c", "r");
11011 char c = getc(fp);
11012 if (
11013 18 <= FILE_cnt(fp) &&
11014 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11015 )
11016 exit(0);
11017 exit(1);
11018}
11019EOP
11020val="$undef"
dfe9444c
AD
11021set try
11022if eval $compile; then
16d20bd9
AD
11023 if ./try; then
11024 echo "Your stdio acts pretty std."
11025 val="$define"
11026 else
11027 echo "Your stdio isn't very std."
11028 fi
11029else
11030 echo "Your stdio doesn't appear very std."
11031fi
11032$rm -f try.c try
11033set d_stdstdio
11034eval $setvar
11035
8e07c86e 11036: Can _ptr be used as an lvalue?
e50aee73
AD
11037case "$d_stdstdio$ptr_lval" in
11038$define$define) val=$define ;;
c2960299
AD
11039*) val=$undef ;;
11040esac
11041set d_stdio_ptr_lval
11042eval $setvar
11043
8e07c86e 11044: Can _cnt be used as an lvalue?
e50aee73
AD
11045case "$d_stdstdio$cnt_lval" in
11046$define$define) val=$define ;;
c2960299
AD
11047*) val=$undef ;;
11048esac
11049set d_stdio_cnt_lval
11050eval $setvar
11051
16d20bd9
AD
11052: see if _base is also standard
11053val="$undef"
11054case "$d_stdstdio" in
11055$define)
11056 $cat >try.c <<EOP
11057#include <stdio.h>
11058#define FILE_base(fp) $stdio_base
11059#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 11060int main() {
16d20bd9
AD
11061 FILE *fp = fopen("try.c", "r");
11062 char c = getc(fp);
11063 if (
11064 19 <= FILE_bufsiz(fp) &&
11065 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11066 )
11067 exit(0);
11068 exit(1);
11069}
11070EOP
dfe9444c
AD
11071 set try
11072 if eval $compile; then
16d20bd9 11073 if ./try; then
8ff267be 11074 echo "And its _base field acts std."
16d20bd9
AD
11075 val="$define"
11076 else
11077 echo "But its _base field isn't std."
11078 fi
11079 else
11080 echo "However, it seems to be lacking the _base field."
11081 fi
11082 $rm -f try.c try
11083 ;;
11084esac
11085set d_stdiobase
11086eval $setvar
11087
ed39a0f2
JH
11088$cat >&4 <<EOM
11089Checking how to access stdio streams by file descriptor number...
11090EOM
11091case "$stdio_stream_array" in
11092'') $cat >try.c <<EOCP
11093#include <stdio.h>
11094int main() {
11095 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11096 printf("yes\n");
11097}
11098EOCP
11099 for s in _iob __iob __sF
11100 do
11101 set try -DSTDIO_STREAM_ARRAY=$s
11102 if eval $compile; then
11103 case "`./try$exe_ext`" in
11104 yes) stdio_stream_array=$s; break ;;
11105 esac
11106 fi
11107 done
11108 $rm -f try.* try$exe_ext
11109esac
11110case "$stdio_stream_array" in
11111'') $cat >&4 <<EOM
11112I can't figure out how to access stdio streams by file descriptor number.
11113EOM
11114 d_stdio_stream_array="$undef"
11115 ;;
11116*) $cat >&4 <<EOM
11117You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11118EOM
11119 d_stdio_stream_array="$define"
11120 ;;
11121esac
11122
a0d0e21e
LW
11123: see if strcoll exists
11124set strcoll d_strcoll
11125eval $inlibc
2304df62
AD
11126
11127: check for structure copying
11128echo " "
11129echo "Checking to see if your C compiler can copy structs..." >&4
11130$cat >try.c <<'EOCP'
5a411a32 11131int main()
2304df62
AD
11132{
11133 struct blurfl {
11134 int dyick;
11135 } foo, bar;
11136
11137 foo = bar;
11138}
11139EOCP
11140if $cc -c try.c >/dev/null 2>&1 ; then
11141 val="$define"
11142 echo "Yup, it can."
11143else
11144 val="$undef"
11145 echo "Nope, it can't."
11146fi
11147set d_strctcpy
11148eval $setvar
11149$rm -f try.*
11150
11151: see if strerror and/or sys_errlist[] exist
11152echo " "
28e8609d
JH
11153if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11154 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
11155 echo 'strerror() found.' >&4
11156 d_strerror="$define"
11157 d_strerrm='strerror(e)'
11158 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11159 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11160 d_syserrlst="$define"
11161 else
11162 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11163 d_syserrlst="$undef"
11164 fi
28e8609d 11165 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
11166 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11167 echo 'strerror() found in string header.' >&4
11168 d_strerror="$define"
11169 d_strerrm='strerror(e)'
11170 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11171 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11172 d_syserrlst="$define"
11173 else
11174 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11175 d_syserrlst="$undef"
11176 fi
28e8609d 11177 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
11178 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11179 d_strerror="$undef"
11180 d_syserrlst="$define"
11181 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 11182 else
5ff3f7a4
GS
11183 echo 'strerror() and sys_errlist[] NOT found.' >&4
11184 d_strerror="$undef"
11185 d_syserrlst="$undef"
11186 d_strerrm='"unknown"'
28e8609d 11187 fi
2304df62
AD
11188fi
11189
a89d8a78
DH
11190: see if strtod exists
11191set strtod d_strtod
11192eval $inlibc
11193
11194: see if strtol exists
11195set strtol d_strtol
11196eval $inlibc
11197
ff935051
JH
11198: see if strtold exists
11199set strtold d_strtold
11200eval $inlibc
11201
76d49b1c
JH
11202: see if strtoll exists
11203set strtoll d_strtoll
11204eval $inlibc
11205
a89d8a78
DH
11206: see if strtoul exists
11207set strtoul d_strtoul
11208eval $inlibc
11209
cf2093f6
JH
11210: see if strtoull exists
11211set strtoull d_strtoull
11212eval $inlibc
11213
ff935051
JH
11214: see if strtouq exists
11215set strtouq d_strtouq
11216eval $inlibc
11217
a0d0e21e
LW
11218: see if strxfrm exists
11219set strxfrm d_strxfrm
11220eval $inlibc
11221
8175356b
JH
11222: see if symlink exists
11223set symlink d_symlink
11224eval $inlibc
11225
11226: see if syscall exists
11227set syscall d_syscall
11228eval $inlibc
11229
11230: see if sysconf exists
11231set sysconf d_sysconf
11232eval $inlibc
11233
11234: see if system exists
11235set system d_system
11236eval $inlibc
11237
11238: see if tcgetpgrp exists
11239set tcgetpgrp d_tcgetpgrp
11240eval $inlibc
11241
11242: see if tcsetpgrp exists
11243set tcsetpgrp d_tcsetpgrp
11244eval $inlibc
11245
11246: see if prototype for telldir is available
11247echo " "
11248set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11249eval $hasproto
dc45a647 11250
2c7991dc 11251: see if this is a sys/times.h system
11252set sys/times.h i_systimes
11253eval $inhdr
4633a7c4 11254
2c7991dc 11255: see if times exists
4633a7c4 11256echo " "
2c7991dc 11257if set times val -f d_times; eval $csym; $val; then
11258 echo 'times() found.' >&4
11259 d_times="$define"
11260 inc=''
11261 case "$i_systimes" in
11262 "$define") inc='sys/times.h';;
11263 esac
dc45a647 11264 rp="What is the type returned by times() on this system?"
2c7991dc 11265 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 11266 eval $typedef_ask
2c7991dc 11267else
11268 echo 'times() NOT found, hope that will do.' >&4
11269 d_times="$undef"
11270 clocktype='int'
11271fi
2304df62 11272
2c7991dc 11273: see if truncate exists
11274set truncate d_truncate
11275eval $inlibc
2304df62 11276
2c7991dc 11277: see if tzname[] exists
11278echo " "
11279if set tzname val -a d_tzname; eval $csym; $val; then
11280 val="$define"
11281 echo 'tzname[] found.' >&4
11282else
11283 val="$undef"
11284 echo 'tzname[] NOT found.' >&4
11285fi
11286set d_tzname
11287eval $setvar
11288
11289: see if umask exists
11290set umask d_umask
11291eval $inlibc
85e6fe83 11292
0545a864
JH
11293: see if ustat exists
11294set ustat d_ustat
11295eval $inlibc
11296
4633a7c4
LW
11297: backward compatibility for d_hvfork
11298if test X$d_hvfork != X; then
11299 d_vfork="$d_hvfork"
11300 d_hvfork=''
11301fi
11302: see if there is a vfork
11303val=''
11304set vfork val
11305eval $inlibc
ecfc5424 11306
4633a7c4
LW
11307: Ok, but do we want to use it. vfork is reportedly unreliable in
11308: perl on Solaris 2.x, and probably elsewhere.
11309case "$val" in
11310$define)
16d20bd9 11311 echo " "
4633a7c4
LW
11312 case "$usevfork" in
11313 false) dflt='n';;
11314 *) dflt='y';;
11315 esac
f10488a3
JH
11316 cat <<'EOM'
11317
11318Perl can only use a vfork() that doesn't suffer from strict
11319restrictions on calling functions or modifying global data in
11320the child. For example, glibc-2.1 contains such a vfork()
11321that is unsuitable. If your system provides a proper fork()
11322call, chances are that you do NOT want perl to use vfork().
11323
11324EOM
11325 rp="Do you still want to use vfork()?"
4633a7c4
LW
11326 . ./myread
11327 case "$ans" in
11328 y|Y) ;;
11329 *)
11330 echo "Ok, we won't use vfork()."
11331 val="$undef"
11332 ;;
11333 esac
ecfc5424
AD
11334 ;;
11335esac
4633a7c4
LW
11336set d_vfork
11337eval $setvar
11338case "$d_vfork" in
11339$define) usevfork='true';;
11340*) usevfork='false';;
11341esac
ecfc5424 11342
4633a7c4
LW
11343: see if this is an sysdir system
11344set sys/dir.h i_sysdir
11345eval $inhdr
11346
11347: see if this is an sysndir system
11348set sys/ndir.h i_sysndir
11349eval $inhdr
11350
11351: see if closedir exists
11352set closedir d_closedir
11353eval $inlibc
11354
11355case "$d_closedir" in
11356"$define")
16d20bd9 11357 echo " "
4633a7c4
LW
11358 echo "Checking whether closedir() returns a status..." >&4
11359 cat > closedir.c <<EOM
11360#$i_dirent I_DIRENT /**/
11361#$i_sysdir I_SYS_DIR /**/
11362#$i_sysndir I_SYS_NDIR /**/
bfb7748a 11363#$i_systypes I_SYS_TYPES /**/
4633a7c4 11364
bfb7748a
AD
11365#if defined(I_SYS_TYPES)
11366#include <sys/types.h>
11367#endif
4633a7c4
LW
11368#if defined(I_DIRENT)
11369#include <dirent.h>
11370#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11371#include <sys/dir.h>
4aa0a1f7 11372#endif
4633a7c4
LW
11373#else
11374#ifdef I_SYS_NDIR
11375#include <sys/ndir.h>
11376#else
11377#ifdef I_SYS_DIR
11378#ifdef hp9000s500
11379#include <ndir.h> /* may be wrong in the future */
11380#else
11381#include <sys/dir.h>
11382#endif
11383#endif
11384#endif
11385#endif
11386int main() { return closedir(opendir(".")); }
11387EOM
dfe9444c 11388 set closedir
dc45a647 11389 if eval $compile_ok; then
4633a7c4
LW
11390 if ./closedir > /dev/null 2>&1 ; then
11391 echo "Yes, it does."
11392 val="$undef"
ecfc5424 11393 else
4633a7c4
LW
11394 echo "No, it doesn't."
11395 val="$define"
ecfc5424
AD
11396 fi
11397 else
4633a7c4
LW
11398 echo "(I can't seem to compile the test program--assuming it doesn't)"
11399 val="$define"
ecfc5424 11400 fi
ecfc5424 11401 ;;
4633a7c4
LW
11402*)
11403 val="$undef";
ecfc5424
AD
11404 ;;
11405esac
4633a7c4
LW
11406set d_void_closedir
11407eval $setvar
11408$rm -f closedir*
11409: check for volatile keyword
ecfc5424 11410echo " "
4633a7c4
LW
11411echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11412$cat >try.c <<'EOCP'
5a411a32 11413int main()
4633a7c4
LW
11414{
11415 typedef struct _goo_struct goo_struct;
11416 goo_struct * volatile goo = ((goo_struct *)0);
11417 struct _goo_struct {
11418 long long_int;
11419 int reg_int;
11420 char char_var;
11421 };
11422 typedef unsigned short foo_t;
11423 char *volatile foo;
11424 volatile int bar;
11425 volatile foo_t blech;
11426 foo = foo;
a0d0e21e
LW
11427}
11428EOCP
4633a7c4
LW
11429if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11430 val="$define"
11431 echo "Yup, it does."
11432else
11433 val="$undef"
11434 echo "Nope, it doesn't."
11435fi
11436set d_volatile
11437eval $setvar
11438$rm -f try.*
a0d0e21e 11439
4633a7c4
LW
11440: see if there is a wait4
11441set wait4 d_wait4
8e07c86e
AD
11442eval $inlibc
11443
4633a7c4
LW
11444: see if waitpid exists
11445set waitpid d_waitpid
11446eval $inlibc
11447
11448: see if wcstombs exists
11449set wcstombs d_wcstombs
11450eval $inlibc
11451
11452: see if wctomb exists
11453set wctomb d_wctomb
11454eval $inlibc
11455
11456: preserve RCS keywords in files with variable substitution, grrr
11457Date='$Date'
11458Id='$Id'
11459Log='$Log'
11460RCSfile='$RCSfile'
11461Revision='$Revision'
11462
ca8cfa54
JH
11463case "$crosscompile" in
11464''|[nN]*) crosscompile="$undef" ;;
11465esac
11466
11467case "$osname" in
8f1f23e8 11468next|rhapsody) multiarch="$define" ;;
ca8cfa54
JH
11469esac
11470case "$multiarch" in
11471''|[nN]*) multiarch="$undef" ;;
11472esac
11473
4633a7c4
LW
11474: check for alignment requirements
11475echo " "
68c15b6f
HM
11476case "$crosscompile$multiarch" in
11477*$define*)
ca8cfa54
JH
11478 $cat <<EOM
11479You seem to be either cross-compiling or doing a multiarchitecture build,
11480skipping the memory alignment check.
68c15b6f
HM
11481
11482EOM
11483 case "$alignbytes" in
11484 '') alignbytes=8 ;;
11485 esac
11486 ;;
11487*)
11488 case "$alignbytes" in
11489 '') echo "Checking alignment constraints..." >&4
11490 $cat >try.c <<'EOCP'
14e4fe40 11491#include <stdio.h>
4633a7c4
LW
11492struct foobar {
11493 char foo;
11494 double bar;
732c9516 11495} try_algn;
d674cd6d 11496int main()
4633a7c4 11497{
213c275f
JH
11498 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11499 return(0);
4633a7c4
LW
11500}
11501EOCP
68c15b6f
HM
11502 set try
11503 if eval $compile_ok; then
11504 dflt=`./try`
11505 else
11506 dflt='8'
11507 echo "(I can't seem to compile the test program...)"
11508 fi
11509 ;;
11510 *) dflt="$alignbytes"
11511 ;;
11512 esac
11513 rp="Doubles must be aligned on a how-many-byte boundary?"
11514 . ./myread
11515 alignbytes="$ans"
11516 $rm -f try.c try
8e07c86e 11517 ;;
ecfc5424 11518esac
68c15b6f 11519
85e6fe83 11520
4633a7c4 11521: check for ordering of bytes in a long
68c15b6f
HM
11522echo " "
11523case "$crosscompile$multiarch" in
11524*$define*)
11525 $cat <<EOM
ca8cfa54
JH
11526You seem to be either cross-compiling or doing a multiarchitecture build,
11527skipping the byteorder check.
68c15b6f
HM
11528
11529EOM
d9b3e12d 11530 byteorder='0xffff'
68c15b6f
HM
11531 ;;
11532*)
11533 case "$byteorder" in
11534 '')
11535 $cat <<'EOM'
4633a7c4
LW
11536In the following, larger digits indicate more significance. A big-endian
11537machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11538little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
d9b3e12d
JH
11539machines may have weird orders like 3412. A Cray will report 87654321,
11540an Alpha will report 12345678. If the test program works the default is
11541probably right.
4633a7c4
LW
11542I'm now running the test program...
11543EOM
68c15b6f 11544 $cat >try.c <<'EOCP'
4633a7c4 11545#include <stdio.h>
d674cd6d 11546int main()
4633a7c4
LW
11547{
11548 int i;
11549 union {
11550 unsigned long l;
11551 char c[sizeof(long)];
11552 } u;
11553
11554 if (sizeof(long) > 4)
11555 u.l = (0x08070605L << 32) | 0x04030201L;
11556 else
11557 u.l = 0x04030201L;
11558 for (i = 0; i < sizeof(long); i++)
11559 printf("%c", u.c[i]+'0');
11560 printf("\n");
11561 exit(0);
11562}
11563EOCP
68c15b6f
HM
11564 xxx_prompt=y
11565 set try
11566 if eval $compile && ./try > /dev/null; then
11567 dflt=`./try`
11568 case "$dflt" in
11569 [1-4][1-4][1-4][1-4]|12345678|87654321)
11570 echo "(The test program ran ok.)"
11571 echo "byteorder=$dflt"
11572 xxx_prompt=n
4633a7c4 11573 ;;
68c15b6f
HM
11574 ????|????????) echo "(The test program ran ok.)" ;;
11575 *) echo "(The test program didn't run right for some reason.)" ;;
11576 esac
11577 else
11578 dflt='4321'
11579 cat <<'EOM'
4633a7c4
LW
11580(I can't seem to compile the test program. Guessing big-endian...)
11581EOM
68c15b6f
HM
11582 fi
11583 case "$xxx_prompt" in
11584 y)
11585 rp="What is the order of bytes in a long?"
11586 . ./myread
11587 byteorder="$ans"
11588 ;;
11589 *) byteorder=$dflt
11590 ;;
11591 esac
ecfc5424
AD
11592 ;;
11593 esac
68c15b6f 11594 $rm -f try.c try
ecfc5424
AD
11595 ;;
11596esac
68c15b6f 11597
85e6fe83 11598
4633a7c4 11599: how do we catenate cpp tokens here?
2304df62 11600echo " "
4633a7c4
LW
11601echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11602$cat >cpp_stuff.c <<'EOCP'
11603#define RCAT(a,b)a/**/b
11604#define ACAT(a,b)a ## b
11605RCAT(Rei,ser)
11606ACAT(Cir,cus)
11607EOCP
11608$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11609if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11610 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
11611 echo "We can catify or stringify, separately or together!"
11612 cpp_stuff=42
11613elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11614 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
11615 echo "However, in the good old days we don't know how to stringify and"
11616 echo "catify at the same time."
11617 cpp_stuff=1
11618else
11619 $cat >&4 <<EOM
11620Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
11621to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 11622EOM
4633a7c4
LW
11623 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11624fi
11625$rm -f cpp_stuff.*
a0d0e21e 11626
4633a7c4
LW
11627: see if this is a db.h system
11628set db.h i_db
11629eval $inhdr
11630
11631case "$i_db" in
68dc0745 11632$define)
1f70e1ea 11633 : Check db version.
68dc0745 11634 echo " "
11635 echo "Checking Berkeley DB version ..." >&4
11636 $cat >try.c <<EOCP
11637#$d_const HASCONST
11638#ifndef HASCONST
11639#define const
11640#endif
11641#include <sys/types.h>
11642#include <stdio.h>
11643#include <db.h>
d674cd6d 11644int main()
68dc0745 11645{
1f70e1ea
PM
11646#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11647 int Major, Minor, Patch ;
ee02776e 11648 unsigned long Version ;
1f70e1ea
PM
11649 (void)db_version(&Major, &Minor, &Patch) ;
11650 printf("You have Berkeley DB Version 2 or greater\n");
11651
11652 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11653 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11654 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11655 Major, Minor, Patch) ;
11656
11657 /* check that db.h & libdb are compatible */
11658 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11659 printf("db.h and libdb are incompatible\n") ;
11660 exit(3);
11661 }
11662
11663 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
11664
11665 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 11666 + DB_VERSION_PATCH ;
ee02776e
PM
11667
11668 /* needs to be >= 2.3.4 */
11669 if (Version < 2003004) {
693762b4 11670 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 11671 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
11672 exit(2);
11673 }
11674
11675 exit(0);
68dc0745 11676#else
6a1b87e5 11677#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 11678 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
11679 exit(0); /* DB version < 2: the coast is clear. */
11680#else
11681 exit(1); /* <db.h> not Berkeley DB? */
11682#endif
68dc0745 11683#endif
11684}
11685EOCP
dfe9444c 11686 set try
cf21f3c6 11687 if eval $compile_ok && ./try; then
1f70e1ea 11688 echo 'Looks OK.' >&4
68dc0745 11689 else
c90c0ff4 11690 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 11691 i_db=$undef
11692 case " $libs " in
11693 *"-ldb "*)
11694 : Remove db from list of libraries to use
11695 echo "Removing unusable -ldb from library list" >&4
11696 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11697 shift
11698 libs="$*"
11699 echo "libs = $libs" >&4
11700 ;;
11701 esac
11702 fi
11703 $rm -f try.*
11704 ;;
11705esac
11706
11707case "$i_db" in
4633a7c4 11708define)
dc45a647
MB
11709 : Check the return type needed for hash
11710 echo " "
11711 echo "Checking return type needed for hash for Berkeley DB ..." >&4
11712 $cat >try.c <<EOCP
11713#$d_const HASCONST
11714#ifndef HASCONST
11715#define const
11716#endif
11717#include <sys/types.h>
11718#include <db.h>
11719
11720#ifndef DB_VERSION_MAJOR
11721u_int32_t hash_cb (ptr, size)
11722const void *ptr;
11723size_t size;
11724{
11725}
11726HASHINFO info;
d674cd6d 11727int main()
dc45a647
MB
11728{
11729 info.hash = hash_cb;
11730}
11731#endif
11732EOCP
11733 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11734 if $contains warning try.out >>/dev/null 2>&1 ; then
11735 db_hashtype='int'
11736 else
11737 db_hashtype='u_int32_t'
11738 fi
11739 else
11740 : XXX Maybe we should just give up here.
11741 db_hashtype=u_int32_t
11742 $cat try.out >&4
11743 echo "Help: I can't seem to compile the db test program." >&4
11744 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11745 fi
11746 $rm -f try.*
11747 echo "Your version of Berkeley DB uses $db_hashtype for hash."
11748 ;;
11749*) db_hashtype=u_int32_t
11750 ;;
11751esac
11752case "$i_db" in
11753define)
4633a7c4
LW
11754 : Check the return type needed for prefix
11755 echo " "
11756 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11757 cat >try.c <<EOCP
11758#$d_const HASCONST
11759#ifndef HASCONST
11760#define const
11761#endif
11762#include <sys/types.h>
11763#include <db.h>
1f70e1ea
PM
11764
11765#ifndef DB_VERSION_MAJOR
4633a7c4
LW
11766size_t prefix_cb (key1, key2)
11767const DBT *key1;
11768const DBT *key2;
11769{
11770}
11771BTREEINFO info;
d674cd6d 11772int main()
4633a7c4
LW
11773{
11774 info.prefix = prefix_cb;
11775}
1f70e1ea 11776#endif
4633a7c4
LW
11777EOCP
11778 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11779 if $contains warning try.out >>/dev/null 2>&1 ; then
11780 db_prefixtype='int'
11781 else
11782 db_prefixtype='size_t'
11783 fi
11784 else
68dc0745 11785 db_prefixtype='size_t'
11786 : XXX Maybe we should just give up here.
dc45a647 11787 $cat try.out >&4
68dc0745 11788 echo "Help: I can't seem to compile the db test program." >&4
11789 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
11790 fi
11791 $rm -f try.*
11792 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 11793 ;;
68dc0745 11794*) db_prefixtype='size_t'
4633a7c4
LW
11795 ;;
11796esac
a0d0e21e 11797
4633a7c4
LW
11798: check for void type
11799echo " "
11800echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
11801case "$voidflags" in
11802'')
11803 $cat >try.c <<'EOCP'
11804#if TRY & 1
760ac839 11805void sub() {
4633a7c4 11806#else
760ac839 11807sub() {
4633a7c4
LW
11808#endif
11809 extern void moo(); /* function returning void */
11810 void (*goo)(); /* ptr to func returning void */
11811#if TRY & 8
11812 void *hue; /* generic ptr */
11813#endif
11814#if TRY & 2
11815 void (*foo[10])();
11816#endif
a0d0e21e 11817
4633a7c4
LW
11818#if TRY & 4
11819 if(goo == moo) {
11820 exit(0);
11821 }
11822#endif
11823 exit(0);
11824}
d674cd6d 11825int main() { sub(); }
4633a7c4 11826EOCP
760ac839 11827 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 11828 voidflags=$defvoidused
bfb7748a 11829 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
11830 if $contains warning .out >/dev/null 2>&1; then
11831 echo "However, you might get some warnings that look like this:"
11832 $cat .out
11833 fi
11834 else
11835echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 11836 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 11837 echo "It supports 1..."
760ac839 11838 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 11839 echo "It also supports 2..."
760ac839 11840 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
11841 voidflags=7
11842 echo "And it supports 4 but not 8 definitely."
11843 else
11844 echo "It doesn't support 4..."
760ac839 11845 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
11846 voidflags=11
11847 echo "But it supports 8."
11848 else
11849 voidflags=3
11850 echo "Neither does it support 8."
11851 fi
11852 fi
11853 else
11854 echo "It does not support 2..."
760ac839 11855 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
11856 voidflags=13
11857 echo "But it supports 4 and 8."
11858 else
760ac839 11859 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
11860 voidflags=5
11861 echo "And it supports 4 but has not heard about 8."
11862 else
11863 echo "However it supports 8 but not 4."
11864 fi
11865 fi
11866 fi
11867 else
11868 echo "There is no support at all for void."
11869 voidflags=0
11870 fi
11871 fi
11872esac
4633a7c4 11873case "$voidflags" in
2c7991dc 11874"$defvoidused") ;;
bfb7748a
AD
11875*) $cat >&4 <<'EOM'
11876 Support flag bits are:
11877 1: basic void declarations.
11878 2: arrays of pointers to functions returning void.
11879 4: operations between pointers to and addresses of void functions.
11880 8: generic void pointers.
11881EOM
2c7991dc 11882 dflt="$voidflags";
4633a7c4 11883 rp="Your void support flags add up to what?"
a0d0e21e 11884 . ./myread
4633a7c4 11885 voidflags="$ans"
a0d0e21e
LW
11886 ;;
11887esac
4633a7c4 11888$rm -f try.* .out
a0d0e21e 11889
85ab1d1d
JH
11890
11891: How can we generate normalized random numbers ?
693762b4 11892echo " "
de4597cb 11893echo "Looking for a random number function..." >&4
85ab1d1d 11894case "$randfunc" in
693762b4 11895'')
85ab1d1d
JH
11896 if set drand48 val -f; eval $csym; $val; then
11897 dflt="drand48"
11898 echo "Good, found drand48()." >&4
11899 elif set random val -f; eval $csym; $val; then
11900 dflt="random"
11901 echo "OK, found random()." >&4
11902 else
11903 dflt="rand"
11904 echo "Yick, looks like I have to use rand()." >&4
11905 fi
11906 echo " "
11907 ;;
11908*)
11909 dflt="$randfunc"
11910 ;;
11911esac
11912cont=true
11913
11914case "$ccflags" in
11915*-Dmy_rand=*|*-Dmy_srand=*)
11916 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11917 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11918 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11919 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11920 ;;
11921esac
11922
11923while $test "$cont"; do
11924 rp="Use which function to generate random numbers?"
11925 . ./myread
11926 if $test "$ans" = "$dflt"; then
11927 : null
11928 else
11929 randbits=''
11930 fi
11931 randfunc="$ans"
11932 if set $ans val -f; eval $csym; $val; then
11933 cont=''
11934 else
ef4af2be
JH
11935 dflt=y
11936 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
11937 . ./myread
11938 dflt=rand
11939 case "$ans" in
11940 [yY]*) cont='';;
11941 esac
11942 fi
11943 case "$cont" in
11944 '')
11945 case "$randfunc" in
11946 drand48)
11947 drand01="drand48()"
11948 seedfunc="srand48"
11949 randbits=48
11950 randseedtype=long
11951 ;;
11952 rand|random)
11953 case "$randbits" in
11954 '')
11955echo "Checking to see how many bits your $randfunc() function produces..." >&4
11956 $cat >try.c <<EOCP
11957#$i_unistd I_UNISTD
11958#$i_stdlib I_STDLIB
693762b4 11959#include <stdio.h>
85ab1d1d
JH
11960#ifdef I_UNISTD
11961# include <unistd.h>
11962#endif
11963#ifdef I_STDLIB
11964# include <stdlib.h>
11965#endif
d674cd6d 11966int main()
693762b4 11967{
85ab1d1d
JH
11968 register int i;
11969 register unsigned long tmp;
11970 register unsigned long max = 0L;
11971
11972 for (i = 1000; i; i--) {
11973 tmp = (unsigned long) $randfunc();
11974 if (tmp > max) max = tmp;
11975 }
11976 for (i = 0; max; i++)
11977 max /= 2;
11978 printf("%d\n",i);
693762b4
AD
11979}
11980EOCP
85ab1d1d
JH
11981 set try
11982 if eval $compile_ok; then
11983 dflt=`try`
11984 else
11985 dflt='?'
11986 echo "(I can't seem to compile the test program...)"
11987 fi
11988 ;;
11989 *)
11990 dflt="$randbits"
11991 ;;
11992 esac
11993 rp="How many bits does your $randfunc() function produce?"
11994 . ./myread
11995 randbits="$ans"
11996 $rm -f try.c try
11997 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11998 seedfunc="s$randfunc"
11999 randseedtype=unsigned
12000 ;;
12001 *)
12002 dflt="31"
12003 rp="How many bits does your $randfunc() function produce?"
12004 . ./myread
12005 randbits="$ans"
12006 seedfunc="s$randfunc"
12007 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12008 if set $seedfunc val -f; eval $csym; $val; then
12009 echo "(Using $seedfunc() to seed random generator)"
12010 else
12011 echo "(Warning: no $seedfunc() to seed random generator)"
12012 seedfunc=rand
12013 fi
12014 randseedtype=unsigned
12015 ;;
12016 esac
12017 ;;
12018 esac
12019done
693762b4 12020
5ff3f7a4
GS
12021echo " "
12022echo "Determining whether or not we are on an EBCDIC system..." >&4
12023$cat >tebcdic.c <<'EOM'
12024int main()
12025{
12026 if ('M'==0xd4) return 0;
12027 return 1;
12028}
12029EOM
12030
12031val=$undef
12032set tebcdic
12033if eval $compile_ok; then
12034 if ./tebcdic; then
12035 echo "You have EBCDIC." >&4
12036 val="$define"
12037 else
57def98f 12038 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
5ff3f7a4
GS
12039 fi
12040else
5cc3184f 12041 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
12042 echo "I'll assume ASCII or some ISO Latin." >&4
12043fi
12044$rm -f tebcdic.c tebcdic
12045set ebcdic
12046eval $setvar
12047
29209bc5 12048echo " "
767df6a1
JH
12049$cat >&4 <<EOM
12050Checking how to flush all pending stdio output...
66fe083f 12051EOM
d2201af2
AD
12052# I only know how to find the first 32 possibly open files on SunOS.
12053# See also hints/sunos_4_1.sh and util.c --AD
12054case "$osname" in
12055sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12056esac
12057$cat >>try.c <<EOCP
66fe083f 12058#include <stdio.h>
d2201af2 12059#$i_unistd I_UNISTD
767df6a1 12060#ifdef I_UNISTD
a32a45b6 12061# include <unistd.h>
767df6a1
JH
12062#endif
12063#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
12064#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12065#ifdef HAS_STDIO_STREAM_ARRAY
12066# define STDIO_STREAM_ARRAY $stdio_stream_array
12067#endif
66fe083f
JH
12068int main() {
12069 FILE* p = fopen("try.out", "w");
0f27ced1 12070#ifdef TRY_FPUTC
66fe083f 12071 fputc('x', p);
0f27ced1
JH
12072#else
12073# ifdef TRY_FPRINTF
12074 fprintf(p, "x");
12075# endif
12076#endif
767df6a1 12077#ifdef TRY_FFLUSH_NULL
66fe083f 12078 fflush(NULL);
767df6a1
JH
12079#endif
12080#ifdef TRY_FFLUSH_ALL
12081 {
12082 long open_max = -1;
d2201af2
AD
12083# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12084 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 12085# else
d2201af2
AD
12086# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12087 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 12088# else
4b257aef 12089# ifdef FOPEN_MAX
d2201af2 12090 open_max = FOPEN_MAX;
767df6a1 12091# else
d2201af2
AD
12092# ifdef OPEN_MAX
12093 open_max = OPEN_MAX;
12094# else
12095# ifdef _NFILE
12096 open_max = _NFILE;
12097# endif
767df6a1
JH
12098# endif
12099# endif
12100# endif
4b257aef 12101# endif
ed39a0f2 12102# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
12103 if (open_max > 0) {
12104 long i;
12105 for (i = 0; i < open_max; i++)
d2201af2
AD
12106 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12107 STDIO_STREAM_ARRAY[i]._file < open_max &&
12108 STDIO_STREAM_ARRAY[i]._flag)
12109 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
12110 }
12111 }
ed39a0f2 12112# endif
767df6a1
JH
12113#endif
12114 _exit(42);
66fe083f
JH
12115}
12116EOCP
0f27ced1
JH
12117: first we have to find out how _not_ to flush
12118if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12119 output=''
12120 set try -DTRY_FPUTC
6626660c 12121 if eval $compile; then
4b257aef 12122 $rm -f try.out
0f27ced1
JH
12123 ./try$exe_ext 2>/dev/null
12124 if $test ! -s try.out -a "X$?" = X42; then
12125 output=-DTRY_FPUTC
12126 fi
12127 fi
12128 case "$output" in
12129 '')
12130 set try -DTRY_FPRINTF
12131 $rm -f try.out
6626660c 12132 if eval $compile; then
4b257aef 12133 $rm -f try.out
0f27ced1
JH
12134 ./try$exe_ext 2>/dev/null
12135 if $test ! -s try.out -a "X$?" = X42; then
12136 output=-DTRY_FPRINTF
12137 fi
12138 fi
12139 ;;
12140 esac
12141fi
767df6a1
JH
12142: check for fflush NULL behaviour
12143case "$fflushNULL" in
0f27ced1 12144'') set try -DTRY_FFLUSH_NULL $output
6626660c 12145 if eval $compile; then
4b257aef 12146 $rm -f try.out
196fa3d2 12147 ./try$exe_ext 2>/dev/null
a32a45b6
JH
12148 code="$?"
12149 if $test -s try.out -a "X$code" = X42; then
c2fddd50 12150 fflushNULL="`$cat try.out`"
a32a45b6
JH
12151 else
12152 if $test "X$code" != X42; then
12153 $cat >&4 <<EOM
12154(If this test failed, don't worry, we'll try another method shortly.)
12155EOM
12156 fi
c2fddd50
JH
12157 fi
12158 fi
0f27ced1 12159 $rm -f core try.core core.try.*
c2fddd50 12160 case "$fflushNULL" in
6626660c 12161 x) $cat >&4 <<EOM
66fe083f
JH
12162Your fflush(NULL) works okay.
12163EOM
ed39a0f2 12164 fflushNULL="$define"
c2fddd50 12165 ;;
6626660c 12166 '') $cat >&4 <<EOM
66fe083f
JH
12167Your fflush(NULL) isn't working (contrary to ANSI C).
12168EOM
ed39a0f2 12169 fflushNULL="$undef"
c2fddd50 12170 ;;
6626660c 12171 *) $cat >&4 <<EOM
66fe083f
JH
12172Cannot figure out whether your fflush(NULL) works or not.
12173I'm assuming it doesn't (contrary to ANSI C).
12174EOM
ed39a0f2 12175 fflushNULL="$undef"
c2fddd50
JH
12176 ;;
12177 esac
66fe083f
JH
12178 ;;
12179$define|true|[yY]*)
ed39a0f2 12180 fflushNULL="$define"
66fe083f
JH
12181 ;;
12182*)
ed39a0f2 12183 fflushNULL="$undef"
66fe083f
JH
12184 ;;
12185esac
a32a45b6
JH
12186: check explicit looping only if NULL did not work
12187case "$fflushNULL" in
12188"$undef")
12189 : check for fflush all behaviour
12190 case "$fflushall" in
12191 '') set try -DTRY_FFLUSH_ALL $output
a32a45b6 12192 if eval $compile; then
4b257aef 12193 $cat >&4 <<EOM
a32a45b6 12194(Now testing the other method--but note that also this may fail.)
a71cd7cd 12195EOM
4b257aef 12196 $rm -f try.out
a32a45b6
JH
12197 ./try$exe_ext 2>/dev/null
12198 if $test -s try.out -a "X$?" = X42; then
12199 fflushall="`$cat try.out`"
12200 fi
767df6a1 12201 fi
a32a45b6
JH
12202 $rm -f core try.core core.try.*
12203 case "$fflushall" in
12204 x) $cat >&4 <<EOM
12205Whew. Flushing explicitly all the stdio streams works.
767df6a1 12206EOM
a32a45b6
JH
12207 fflushall="$define"
12208 ;;
12209 '') $cat >&4 <<EOM
12210Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 12211EOM
a32a45b6
JH
12212 fflushall="$undef"
12213 ;;
12214 *) $cat >&4 <<EOM
6626660c 12215Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
12216I'm assuming it doesn't.
12217EOM
a32a45b6
JH
12218 fflushall="$undef"
12219 ;;
12220 esac
767df6a1 12221 ;;
a32a45b6
JH
12222 "$define"|true|[yY]*)
12223 fflushall="$define"
12224 ;;
12225 *)
12226 fflushall="$undef"
6626660c
JH
12227 ;;
12228 esac
767df6a1 12229 ;;
a32a45b6 12230*) fflushall="$undef"
767df6a1
JH
12231 ;;
12232esac
12233case "$fflushNULL$fflushall" in
12234undefundef)
6626660c 12235 $cat <<EOM
767df6a1
JH
12236I cannot figure out how to flush pending stdio output.
12237EOM
12238 ;;
12239esac
12240$rm -f try.* try$exe_ext
66fe083f 12241
ccc7f9b3
KS
12242: Store the full pathname to the ar program for use in the C program
12243: Respect a hint or command line value for full_ar.
12244case "$full_ar" in
12245'') full_ar=$ar ;;
12246esac
12247
1aef975c
AD
12248: Store the full pathname to the sed program for use in the C program
12249full_sed=$sed
12250
2304df62 12251: see what type gids are declared as in the kernel
dc45a647
MB
12252echo " "
12253echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
12254set gid_t gidtype xxx stdio.h sys/types.h
12255eval $typedef
2304df62 12256case "$gidtype" in
a0d0e21e
LW
12257xxx)
12258 xxx=`./findhdr sys/user.h`
12259 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12260 case $1 in
12261 unsigned) dflt="$1 $2" ;;
12262 *) dflt="$1" ;;
12263 esac
2304df62 12264 ;;
8175356b
JH
12265*) dflt="$gidtype";;
12266esac
12267case "$gidtype" in
12268gid_t) echo "gid_t found." ;;
12269*) rp="What is the type for group ids returned by getgid()?"
12270 . ./myread
12271 gidtype="$ans"
12272 ;;
12273esac
12274
12275echo " "
12276case "$gidtype" in
12277*_t) zzz="$gidtype" ;;
12278*) zzz="gid" ;;
12279esac
a22e52b9 12280echo "Checking the size of $zzz..." >&4
8175356b
JH
12281cat > try.c <<EOCP
12282#include <sys/types.h>
12283#include <stdio.h>
12284int main() {
213c275f 12285 printf("%d\n", (int)sizeof($gidtype));
14e4fe40 12286 exit(0);
8175356b
JH
12287}
12288EOCP
12289set try
a22e52b9 12290if eval $compile_ok; then
8175356b
JH
12291 yyy=`./try`
12292 case "$yyy" in
a22e52b9
JH
12293 '') gidsize=4
12294 echo "(I can't execute the test program--guessing $gidsize.)" >&4
8175356b 12295 ;;
a22e52b9
JH
12296 *) gidsize=$yyy
12297 echo "Your $zzz size is $gidsize bytes."
8175356b
JH
12298 ;;
12299 esac
12300else
a22e52b9
JH
12301 gidsize=4
12302 echo "(I can't compile the test program--guessing $gidsize.)" >&4
8175356b
JH
12303fi
12304
12305
12306echo " "
12307case "$gidtype" in
12308*_t) zzz="$gidtype" ;;
12309*) zzz="gid" ;;
12310esac
a22e52b9 12311echo "Checking the sign of $zzz..." >&4
8175356b
JH
12312cat > try.c <<EOCP
12313#include <sys/types.h>
12314#include <stdio.h>
12315int main() {
a22e52b9
JH
12316 $gidtype foo = -1;
12317 if (foo < 0)
12318 printf("-1\n");
12319 else
12320 printf("1\n");
8175356b
JH
12321}
12322EOCP
12323set try
a22e52b9 12324if eval $compile; then
8175356b
JH
12325 yyy=`./try`
12326 case "$yyy" in
a22e52b9
JH
12327 '') gidsign=1
12328 echo "(I can't execute the test program--guessing unsigned.)" >&4
8175356b 12329 ;;
a22e52b9
JH
12330 *) gidsign=$yyy
12331 case "$gidsign" in
12332 1) echo "Your $zzz is unsigned." ;;
12333 -1) echo "Your $zzz is signed." ;;
12334 esac
8175356b
JH
12335 ;;
12336 esac
12337else
a22e52b9
JH
12338 gidsign=1
12339 echo "(I can't compile the test program--guessing unsigned.)" >&4
8175356b
JH
12340fi
12341
12342
785fb66b 12343echo " "
8175356b
JH
12344
12345if $test X"$quadtype" != X; then
12346
12347echo "Checking how to print 64-bit integers..." >&4
12348
12349if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12350 $cat >try.c <<'EOCP'
785fb66b
JH
12351#include <sys/types.h>
12352#include <stdio.h>
12353int main() {
8175356b
JH
12354 int q = 12345678901;
12355 printf("%ld\n", q);
785fb66b
JH
12356}
12357EOCP
8175356b
JH
12358 set try
12359 if eval $compile; then
12360 yyy=`./try$exe_ext`
12361 case "$yyy" in
12362 12345678901)
12363 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12364 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12365 echo "We will use %d."
12366 ;;
785fb66b 12367 esac
8175356b 12368 fi
785fb66b
JH
12369fi
12370
8175356b
JH
12371if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12372 $cat >try.c <<'EOCP'
12373#include <sys/types.h>
12374#include <stdio.h>
12375int main() {
12376 long q = 12345678901;
12377 printf("%ld\n", q);
12378}
12379EOCP
12380 set try
12381 if eval $compile; then
12382 yyy=`./try$exe_ext`
12383 case "$yyy" in
12384 12345678901)
12385 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12386 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12387 echo "We will use %ld."
12388 ;;
12389 esac
12390 fi
12391fi
785fb66b 12392
8afc5b8d 12393if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
8175356b 12394 $cat >try.c <<'EOCP'
785fb66b 12395#include <sys/types.h>
8175356b 12396#include <inttypes.h>
785fb66b
JH
12397#include <stdio.h>
12398int main() {
8175356b
JH
12399 int64_t q = 12345678901;
12400 printf("%" PRId64 "\n", q);
785fb66b
JH
12401}
12402EOCP
8175356b
JH
12403 set try
12404 if eval $compile; then
12405 yyy=`./try$exe_ext`
12406 case "$yyy" in
12407 12345678901)
12408 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12409 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12410 echo "We will use the C9X style."
12411 ;;
12412 esac
12413 fi
12414fi
12415
12416if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12417 $cat >try.c <<'EOCP'
12418#include <sys/types.h>
12419#include <stdio.h>
12420int main() {
12421 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12422 printf("%lld\n", q);
12423}
12424EOCP
12425 set try
12426 if eval $compile; then
12427 yyy=`./try$exe_ext`
12428 case "$yyy" in
12429 12345678901)
12430 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12431 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12432 echo "We will use the %lld style."
12433 ;;
12434 esac
12435 fi
785fb66b
JH
12436fi
12437
8175356b
JH
12438if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12439 $cat >try.c <<EOCP
12440#include <sys/types.h>
12441#include <stdio.h>
12442int main() {
12443 $quadtype q = 12345678901;
12444 printf("%Ld\n", q);
12445}
12446EOCP
12447 set try
12448 if eval $compile; then
12449 yyy=`./try$exe_ext`
12450 case "$yyy" in
12451 12345678901)
12452 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12453 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12454 echo "We will use %Ld."
12455 ;;
12456 esac
12457 fi
12458fi
785fb66b 12459
8175356b
JH
12460if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12461 $cat >try.c <<EOCP
12462#include <sys/types.h>
12463#include <stdio.h>
12464int main() {
12465 $quadtype q = 12345678901;
12466 printf("%qd\n", q);
12467}
12468EOCP
12469 set try
12470 if eval $compile; then
12471 yyy=`./try$exe_ext`
12472 case "$yyy" in
12473 12345678901)
12474 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12475 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12476 echo "We will use %qd."
12477 ;;
12478 esac
12479 fi
12480fi
2304df62 12481
8175356b
JH
12482if $test X"$sPRId64" = X; then
12483 echo "Cannot figure out how to print 64-bit integers." >&4
12484fi
5cd24f17 12485
8175356b 12486$rm -f try try.*
dfe9444c 12487
8175356b 12488fi
2304df62 12489
8175356b
JH
12490case "$sPRId64" in
12491'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
12492 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
12493 ;;
12494*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
12495 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
a0d0e21e 12496 ;;
2304df62 12497esac
2304df62 12498
2304df62 12499
8ff267be 12500echo " "
8175356b
JH
12501$echo "Checking the format strings to be used for Perl's internal types..." >&4
12502
12503if $test X"$ivsize" = X8; then
12504 ivdformat="$sPRId64"
12505 uvuformat="$sPRIu64"
12506 uvoformat="$sPRIo64"
12507 uvxformat="$sPRIx64"
5ff3f7a4 12508else
8175356b
JH
12509 if $test X"$ivsize" = X"$longsize"; then
12510 ivdformat='"ld"'
12511 uvuformat='"lu"'
12512 uvoformat='"lo"'
12513 uvxformat='"lx"'
12514 else
12515 if $test X"$ivsize" = X"$intsize"; then
12516 ivdformat='"d"'
12517 uvuformat='"u"'
12518 uvoformat='"o"'
12519 uvxformat='"x"'
12520 else
12521 : far out
12522 if $test X"$ivsize" = X"$shortsize"; then
12523 ivdformat='"hd"'
12524 uvuformat='"hu"'
12525 uvoformat='"ho"'
12526 uvxformat='"hx"'
12527 fi
12528 fi
12529 fi
5ff3f7a4 12530fi
8175356b
JH
12531
12532case "$ivdformat" in
12533'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12534 exit 1
12535 ;;
12536esac
5ff3f7a4 12537
a22e52b9
JH
12538
12539echo " "
12540$echo "Checking the format string to be used for gids..." >&4
12541
12542case "$gidsign" in
12543-1) if $test X"$gidsize" = X"$ivsize"; then
12544 gidformat="$ivdformat"
12545 else
12546 if $test X"$gidsize" = X"$longsize"; then
12547 gidformat='"ld"'
12548 else
12549 if $test X"$gidsize" = X"$intsize"; then
12550 gidformat='"d"'
12551 else
12552 if $test X"$gidsize" = X"$shortsize"; then
12553 gidformat='"hd"'
12554 fi
12555 fi
12556 fi
12557 fi
12558 ;;
12559*) if $test X"$gidsize" = X"$uvsize"; then
12560 gidformat="$uvuformat"
12561 else
12562 if $test X"$gidsize" = X"$longsize"; then
12563 gidformat='"lu"'
12564 else
12565 if $test X"$gidsize" = X"$intsize"; then
12566 gidformat='"u"'
12567 else
12568 if $test X"$gidsize" = X"$shortsize"; then
12569 gidformat='"hu"'
12570 fi
12571 fi
12572 fi
12573 fi
12574 ;;
12575esac
12576
12577: see if getgroups exists
12578set getgroups d_getgrps
12579eval $inlibc
12580
12581: see if setgroups exists
12582set setgroups d_setgrps
12583eval $inlibc
12584
12585
12586: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12587echo " "
12588case "$d_getgrps$d_setgrps" in
12589*define*)
12590 case "$groupstype" in
12591 '') dflt="$gidtype" ;;
12592 *) dflt="$groupstype" ;;
12593 esac
12594 $cat <<EOM
12595What type of pointer is the second argument to getgroups() and setgroups()?
12596Usually this is the same as group ids, $gidtype, but not always.
12597
12598EOM
12599 rp='What type pointer is the second argument to getgroups() and setgroups()?'
12600 . ./myread
12601 groupstype="$ans"
12602 ;;
12603*) groupstype="$gidtype";;
12604esac
12605
5ff3f7a4 12606echo " "
dfe9444c 12607echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 12608case "$make_set_make" in
12609'')
12610 $sed 's/^X //' > testmake.mak << 'EOF'
12611Xall:
dfe9444c 12612X @echo 'maketemp="$(MAKE)"'
8ff267be 12613EOF
8ff267be 12614 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 12615 *maketemp=*) make_set_make='#' ;;
8ff267be 12616 *) make_set_make="MAKE=$make" ;;
12617 esac
dfe9444c
AD
12618 $rm -f testmake.mak
12619 ;;
12620esac
12621case "$make_set_make" in
12622'#') echo "Yup, it does.";;
12623*) echo "Nope, it doesn't.";;
12624esac
12625
fe749a9f
JH
12626: see if this is a sys/mman.h system
12627set sys/mman.h i_sysmman
12628eval $inhdr
12629
12630: see if mmap exists
12631set mmap d_mmap
12632eval $inlibc
12633: see what shmat returns
12634: default to something harmless
12635mmaptype='void *'
12636case "$i_sysmman$d_mmap" in
12637"$define$define")
12638 $cat >mmap.c <<'END'
12639#include <sys/mman.h>
12640void *mmap();
12641END
12642 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
12643 mmaptype='void *'
12644 else
12645 mmaptype='caddr_t'
12646 fi
12647 echo "and it returns ($mmaptype)." >&4
12648 ;;
12649esac
12650
12651
12652
dfe9444c 12653: see what type is used for mode_t
dc45a647 12654rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 12655set mode_t modetype int stdio.h sys/types.h
dc45a647 12656eval $typedef_ask
dfe9444c 12657
dfe9444c
AD
12658: define a fucntion to check prototypes
12659$cat > protochk <<EOSH
12660$startsh
12661cc="$cc"
12662optimize="$optimize"
12663ccflags="$ccflags"
12664prototype="$prototype"
12665define="$define"
12666rm=$rm
12667EOSH
12668
12669$cat >> protochk <<'EOSH'
12670
12671$rm -f try.c
12672foo="$1"
12673shift
12674while test $# -ge 2; do
12675 case "$1" in
12676 $define) echo "#include <$2>" >> try.c ;;
12677 literal) echo "$2" >> try.c ;;
12678 esac
12679 shift 2
12680done
12681test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
12682cat >> try.c <<'EOCP'
12683#ifdef CAN_PROTOTYPE
12684#define _(args) args
12685#else
12686#define _(args) ()
12687#endif
12688EOCP
12689echo "$foo" >> try.c
12690echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12691$cc $optimize $ccflags -c try.c > /dev/null 2>&1
12692status=$?
12693$rm -f try.[co]
12694exit $status
12695EOSH
12696chmod +x protochk
12697$eunicefix protochk
12698
dfe9444c 12699: see what type is used for size_t
dc45a647 12700rp="What is the type used for the length parameter for string functions?"
dfe9444c 12701set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 12702eval $typedef_ask
dfe9444c
AD
12703
12704: check for type of arguments to gethostbyaddr.
12705if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12706 case "$d_gethbyaddr" in
12707 $define)
12708 $cat <<EOM
12709
12710Checking to see what type of arguments are accepted by gethostbyaddr().
12711EOM
12712 hdrs="$define sys/types.h
12713 $d_socket sys/socket.h
12714 $i_niin netinet/in.h
12715 $i_netdb netdb.h
12716 $i_unistd unistd.h"
12717 : The first arg can 'char *' or 'void *'
12718 : The second arg is some of integral type
12719 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12720 for yyy in size_t long int; do
12721 case "$netdb_host_type" in
12722 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12723 if ./protochk "$try" $hdrs; then
12724 echo "Your system accepts $xxx for the first arg."
12725 echo "...and $yyy for the second arg."
12726 netdb_host_type="$xxx"
12727 netdb_hlen_type="$yyy"
12728 fi
12729 ;;
12730 esac
12731 done
12732 done
12733 : In case none of those worked, prompt the user.
12734 case "$netdb_host_type" in
12735 '') rp='What is the type for the 1st argument to gethostbyaddr?'
12736 dflt='char *'
12737 . ./myread
12738 netdb_host_type=$ans
12739 rp='What is the type for the 2nd argument to gethostbyaddr?'
12740 dflt="$sizetype"
12741 . ./myread
12742 netdb_hlen_type=$ans
12743 ;;
12744 esac
12745 ;;
12746 *) : no gethostbyaddr, so pick harmless defaults
12747 netdb_host_type='char *'
12748 netdb_hlen_type="$sizetype"
12749 ;;
12750 esac
12751 # Remove the "const" if needed. -- but then we'll have a
12752 # prototype clash!
12753 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12754fi
12755
12756: check for type of argument to gethostbyname.
12757if test "X$netdb_name_type" = X ; then
12758 case "$d_gethbyname" in
12759 $define)
12760 $cat <<EOM
12761
12762Checking to see what type of argument is accepted by gethostbyname().
12763EOM
12764 hdrs="$define sys/types.h
12765 $d_socket sys/socket.h
12766 $i_niin netinet/in.h
12767 $i_netdb netdb.h
12768 $i_unistd unistd.h"
12769 for xxx in "const char *" "char *"; do
12770 case "$netdb_name_type" in
12771 '') try="extern struct hostent *gethostbyname($xxx);"
12772 if ./protochk "$try" $hdrs; then
12773 echo "Your system accepts $xxx."
12774 netdb_name_type="$xxx"
12775 fi
12776 ;;
12777 esac
12778 done
12779 : In case none of those worked, prompt the user.
12780 case "$netdb_name_type" in
12781 '') rp='What is the type for the 1st argument to gethostbyname?'
12782 dflt='char *'
12783 . ./myread
12784 netdb_name_type=$ans
12785 ;;
12786 esac
12787 ;;
12788 *) : no gethostbyname, so pick harmless default
12789 netdb_name_type='char *'
12790 ;;
12791 esac
12792fi
8ff267be 12793
dfe9444c
AD
12794: check for type of 1st argument to getnetbyaddr.
12795if test "X$netdb_net_type" = X ; then
12796 case "$d_getnbyaddr" in
12797 $define)
12798 $cat <<EOM
85e6fe83 12799
dfe9444c
AD
12800Checking to see what type of 1st argument is accepted by getnetbyaddr().
12801EOM
12802 hdrs="$define sys/types.h
12803 $d_socket sys/socket.h
12804 $i_niin netinet/in.h
12805 $i_netdb netdb.h
12806 $i_unistd unistd.h"
12807 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12808 case "$netdb_net_type" in
12809 '') try="extern struct netent *getnetbyaddr($xxx, int);"
12810 if ./protochk "$try" $hdrs; then
12811 echo "Your system accepts $xxx."
12812 netdb_net_type="$xxx"
12813 fi
12814 ;;
12815 esac
12816 done
12817 : In case none of those worked, prompt the user.
12818 case "$netdb_net_type" in
12819 '') rp='What is the type for the 1st argument to getnetbyaddr?'
12820 dflt='long'
12821 . ./myread
12822 netdb_net_type=$ans
12823 ;;
12824 esac
12825 ;;
12826 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 12827 netdb_net_type='long'
dfe9444c
AD
12828 ;;
12829 esac
12830fi
2c7991dc 12831: locate the preferred pager for this system
12832case "$pager" in
12833'')
12834 dflt=''
12835 case "$pg" in
12836 /*) dflt=$pg;;
12837 esac
12838 case "$more" in
12839 /*) dflt=$more;;
12840 esac
12841 case "$less" in
12842 /*) dflt=$less;;
12843 esac
12844 case "$dflt" in
12845 '') dflt=/usr/ucb/more;;
12846 esac
12847 ;;
12848*) dflt="$pager";;
12849esac
12850echo " "
12851fn=f/
12852rp='What pager is used on your system?'
12853. ./getfile
12854pager="$ans"
12855
dfe9444c 12856: see what type pids are declared as in the kernel
dc45a647 12857rp="What is the type of process ids on this system?"
dfe9444c 12858set pid_t pidtype int stdio.h sys/types.h
dc45a647 12859eval $typedef_ask
2304df62 12860
fe749a9f
JH
12861: Find earliest binary compatible site_perl subdirectory perl can use.
12862case "$bincompat5005" in
12863"$define") xs_apiversion='5.005' ;;
12864*) xs_apiversion=$version ;; # The current site_perl version.
12865esac
12866: Find earliest pure perl site_perl subdirectory perl can use.
12867: The versioned directories started at 5.005.
12868pm_apiversion='5.005'
12869
693762b4
AD
12870: check for length of pointer
12871echo " "
12872case "$ptrsize" in
12873'')
dc45a647 12874 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
12875 if test "$voidflags" -gt 7; then
12876 echo '#define VOID_PTR char *' > try.c
12877 else
12878 echo '#define VOID_PTR void *' > try.c
12879 fi
12880 $cat >>try.c <<'EOCP'
12881#include <stdio.h>
d674cd6d 12882int main()
693762b4 12883{
213c275f 12884 printf("%d\n", (int)sizeof(VOID_PTR));
14e4fe40 12885 exit(0);
693762b4
AD
12886}
12887EOCP
12888 set try
dc45a647 12889 if eval $compile_ok; then
693762b4 12890 ptrsize=`./try`
dc45a647 12891 $echo " $ptrsize bytes." >&4
693762b4
AD
12892 else
12893 dflt='4'
12894 echo "(I can't seem to compile the test program. Guessing...)" >&4
12895 rp="What is the size of a pointer (in bytes)?"
12896 . ./myread
12897 ptrsize="$ans"
12898 fi
12899 ;;
12900esac
12901$rm -f try.c try
12902
a0d0e21e
LW
12903: see if ar generates random libraries by itself
12904echo " "
12905echo "Checking how to generate random libraries on your machine..." >&4
12906echo 'int bar1() { return bar2(); }' > bar1.c
12907echo 'int bar2() { return 2; }' > bar2.c
12908$cat > foo.c <<'EOP'
d674cd6d 12909int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
12910EOP
12911$cc $ccflags -c bar1.c >/dev/null 2>&1
12912$cc $ccflags -c bar2.c >/dev/null 2>&1
12913$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
12914$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12915if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12916 ./foobar >/dev/null 2>&1; then
4e2a5f63 12917 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
12918 orderlib=false
12919 ranlib=":"
dfe9444c
AD
12920elif $ar ts bar$_a >/dev/null 2>&1 &&
12921 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12922 ./foobar >/dev/null 2>&1; then
4e2a5f63 12923 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 12924 orderlib=false
dfe9444c 12925 ranlib="$ar ts"
a0d0e21e 12926else
ecfc5424
AD
12927 case "$ranlib" in
12928 :) ranlib='';;
12929 '')
12930 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12931 $test -f $ranlib || ranlib=''
12932 ;;
12933 esac
a0d0e21e 12934 if $test -n "$ranlib"; then
ecfc5424 12935 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
12936 orderlib=false
12937 else
12938 echo "your system doesn't seem to support random libraries"
12939 echo "so we'll use lorder and tsort to order the libraries."
12940 orderlib=true
12941 ranlib=":"
12942 fi
12943fi
12944$rm -f foo* bar*
12945
dfe9444c
AD
12946: check for type of arguments to select.
12947case "$selecttype" in
12948'') case "$d_select" in
12949 $define)
cce08f5b 12950 echo " "
dfe9444c
AD
12951 $cat <<EOM
12952Checking to see what type of arguments are accepted by select().
12953EOM
12954 hdrs="$define sys/types.h
12955 $i_systime sys/time.h
12956 $i_sysselct sys/select.h
12957 $d_socket sys/socket.h"
12958 : The first arg can be int, unsigned, or size_t
12959 : The last arg may or may not be 'const'
12960 val=''
7f3d1cf1
BH
12961 : void pointer has been seen but using that
12962 : breaks the selectminbits test
12963 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 12964 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
12965 for tmo in 'struct timeval *' 'const struct timeval *'; do
12966 case "$val" in
12967 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12968 if ./protochk "$try" $hdrs; then
12969 echo "Your system accepts $xxx."
12970 val="$xxx"
12971 fi
12972 ;;
12973 esac
12974 done
12975 done
12976 done
12977 case "$val" in
12978 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12979 case "$d_fd_set" in
12980 $define) dflt="fd_set *" ;;
12981 *) dflt="int *" ;;
12982 esac
12983 . ./myread
12984 val=$ans
12985 ;;
a0d0e21e 12986 esac
dfe9444c 12987 selecttype="$val"
a0d0e21e 12988 ;;
dfe9444c
AD
12989 *) : no select, so pick a harmless default
12990 selecttype='int *'
a0d0e21e
LW
12991 ;;
12992 esac
a0d0e21e
LW
12993 ;;
12994esac
2304df62 12995
5ff3f7a4
GS
12996: check for the select 'width'
12997case "$selectminbits" in
12998'') case "$d_select" in
12999 $define)
13000 $cat <<EOM
13001
85ab1d1d 13002Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
13003EOM
13004 $cat >try.c <<EOCP
13005#include <sys/types.h>
13006#$i_time I_TIME
13007#$i_systime I_SYS_TIME
13008#$i_systimek I_SYS_TIME_KERNEL
13009#ifdef I_TIME
13010# include <time.h>
13011#endif
13012#ifdef I_SYS_TIME
13013# ifdef I_SYS_TIME_KERNEL
13014# define KERNEL
13015# endif
13016# include <sys/time.h>
13017# ifdef I_SYS_TIME_KERNEL
13018# undef KERNEL
13019# endif
13020#endif
13021#$i_sysselct I_SYS_SELECT
13022#ifdef I_SYS_SELECT
13023#include <sys/select.h>
13024#endif
bd628c73
AD
13025#$d_socket HAS_SOCKET
13026#ifdef HAS_SOCKET
13027# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13028#endif
5ff3f7a4 13029#include <stdio.h>
fb164848
JH
13030$selecttype b;
13031#define S sizeof(*(b))
5ff3f7a4
GS
13032#define MINBITS 64
13033#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13034#define NBITS (NBYTES * 8)
13035int main() {
13036 char s[NBYTES];
5ff3f7a4
GS
13037 struct timeval t;
13038 int i;
13039 FILE* fp;
13040 int fd;
13041
13042 fclose(stdin);
13043 fp = fopen("try.c", "r");
13044 if (fp == 0)
13045 exit(1);
13046 fd = fileno(fp);
13047 if (fd < 0)
13048 exit(2);
13049 b = ($selecttype)s;
13050 for (i = 0; i < NBITS; i++)
13051 FD_SET(i, b);
13052 t.tv_sec = 0;
13053 t.tv_usec = 0;
13054 select(fd + 1, b, 0, 0, &t);
13055 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13056 printf("%d\n", i + 1);
13057 return 0;
13058}
13059EOCP
13060 set try
13061 if eval $compile_ok; then
13062 selectminbits=`./try`
85ab1d1d 13063 case "$selectminbits" in
fb164848
JH
13064 '') cat >&4 <<EOM
13065Cannot figure out on how many bits at a time your select() operates.
13066I'll play safe and guess it is 32 bits.
13067EOM
13068 selectminbits=32
13069 bits="32 bits"
13070 ;;
85ab1d1d
JH
13071 1) bits="1 bit" ;;
13072 *) bits="$selectminbits bits" ;;
13073 esac
13074 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
13075 else
13076 rp='What is the minimum number of bits your select() operates on?'
13077 case "$byteorder" in
13078 1234|12345678) dflt=32 ;;
13079 *) dflt=1 ;;
13080 esac
13081 . ./myread
13082 val=$ans
13083 selectminbits="$val"
13084 fi
13085 $rm -f try.* try
13086 ;;
13087 *) : no select, so pick a harmless default
13088 selectminbits='32'
13089 ;;
13090 esac
13091 ;;
13092esac
13093
8e07c86e
AD
13094: Trace out the files included by signal.h, then look for SIGxxx names.
13095: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
13096: Remove SIGSTKSIZE used by Linux.
13097: Remove SIGSTKSZ used by Posix.
4633a7c4 13098: Remove SIGTYP void lines used by OS2.
6764938d 13099: Some cpps, like os390, dont give the file name anywhere
53d4e464 13100if [ "X$fieldn" = X ]; then
6764938d
GS
13101 : Just make some guesses. We check them later.
13102 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
53d4e464 13103else
6764938d 13104 xxx=`echo '#include <signal.h>' |
8e07c86e
AD
13105 $cppstdin $cppminus $cppflags 2>/dev/null |
13106 $grep '^[ ]*#.*include' |
13107 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
53d4e464 13108fi
8e07c86e
AD
13109: Check this list of files to be sure we have parsed the cpp output ok.
13110: This will also avoid potentially non-existent files, such
13111: as ../foo/bar.h
13112xxxfiles=''
13113for xx in $xxx /dev/null ; do
13114 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13115done
13116: If we have found no files, at least try signal.h
13117case "$xxxfiles" in
13118'') xxxfiles=`./findhdr signal.h` ;;
13119esac
13120xxx=`awk '
af4c28eb 13121$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
13122 print substr($2, 4, 20)
13123}
4633a7c4 13124$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
13125 print substr($3, 4, 20)
13126}' $xxxfiles`
13127: Append some common names just in case the awk scan failed.
6764938d
GS
13128xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13129xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13130xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13131xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13132xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13133
8e07c86e 13134: generate a few handy files for later
dc45a647 13135$cat > signal.c <<'EOCP'
4633a7c4
LW
13136#include <sys/types.h>
13137#include <signal.h>
dc45a647 13138#include <stdio.h>
4633a7c4 13139int main() {
760ac839
LW
13140
13141/* Strange style to avoid deeply-nested #if/#else/#endif */
13142#ifndef NSIG
13143# ifdef _NSIG
13144# define NSIG (_NSIG)
13145# endif
13146#endif
13147
13148#ifndef NSIG
13149# ifdef SIGMAX
13150# define NSIG (SIGMAX+1)
13151# endif
13152#endif
13153
13154#ifndef NSIG
13155# ifdef SIG_MAX
13156# define NSIG (SIG_MAX+1)
13157# endif
13158#endif
13159
13160#ifndef NSIG
13161# ifdef MAXSIG
13162# define NSIG (MAXSIG+1)
13163# endif
4633a7c4 13164#endif
760ac839
LW
13165
13166#ifndef NSIG
13167# ifdef MAX_SIG
13168# define NSIG (MAX_SIG+1)
13169# endif
13170#endif
13171
13172#ifndef NSIG
13173# ifdef SIGARRAYSIZE
13174# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13175# endif
13176#endif
13177
13178#ifndef NSIG
13179# ifdef _sys_nsig
13180# define NSIG (_sys_nsig) /* Solaris 2.5 */
13181# endif
13182#endif
13183
13184/* Default to some arbitrary number that's big enough to get most
13185 of the common signals.
13186*/
13187#ifndef NSIG
13188# define NSIG 50
4633a7c4 13189#endif
760ac839
LW
13190
13191printf("NSIG %d\n", NSIG);
13192
dc45a647
MB
13193#ifndef JUST_NSIG
13194
13195EOCP
13196
28e8609d 13197echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
13198{
13199 printf "#ifdef SIG"; printf $1; printf "\n"
13200 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13201 printf $1; printf ");\n"
13202 printf "#endif\n"
2304df62 13203}
2304df62 13204END {
dc45a647 13205 printf "#endif /* JUST_NSIG */\n";
14e4fe40 13206 printf "exit(0);\n}\n";
2304df62 13207}
4633a7c4
LW
13208' >>signal.c
13209$cat >signal.awk <<'EOP'
13210BEGIN { ndups = 0 }
13211$1 ~ /^NSIG$/ { nsig = $2 }
13212($1 !~ /^NSIG$/) && (NF == 2) {
13213 if ($2 > maxsig) { maxsig = $2 }
13214 if (sig_name[$2]) {
13215 dup_name[ndups] = $1
13216 dup_num[ndups] = $2
13217 ndups++
13218 }
13219 else {
13220 sig_name[$2] = $1
13221 sig_num[$2] = $2
13222 }
4633a7c4
LW
13223}
13224END {
af4c28eb
CS
13225 if (nsig == 0) {
13226 nsig = maxsig + 1
13227 }
13228 printf("NSIG %d\n", nsig);
13229 for (n = 1; n < nsig; n++) {
13230 if (sig_name[n]) {
13231 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 13232 }
af4c28eb
CS
13233 else {
13234 printf("NUM%d %d\n", n, n)
13235 }
13236 }
4633a7c4 13237 for (n = 0; n < ndups; n++) {
af4c28eb 13238 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
13239 }
13240}
13241EOP
13242$cat >signal_cmd <<EOS
8e07c86e 13243$startsh
dc45a647
MB
13244if $test -s signal.lst; then
13245 echo "Using your existing signal.lst file"
13246 exit 0
13247fi
13248xxx="$xxx"
13249EOS
13250$cat >>signal_cmd <<'EOS'
13251
13252set signal
13253if eval $compile_ok; then
dfe9444c 13254 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 13255else
dc45a647
MB
13256 echo "(I can't seem be able to compile the whole test program)" >&4
13257 echo "(I'll try it in little pieces.)" >&4
13258 set signal -DJUST_NSIG
13259 if eval $compile_ok; then
13260 ./signal$_exe > signal.nsg
13261 $cat signal.nsg
13262 else
13263 echo "I can't seem to figure out how many signals you have." >&4
13264 echo "Guessing 50." >&4
13265 echo 'NSIG 50' > signal.nsg
13266 fi
13267 : Now look at all the signal names, one at a time.
28e8609d 13268 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
13269 $cat > signal.c <<EOCP
13270#include <sys/types.h>
13271#include <signal.h>
13272#include <stdio.h>
13273int main() {
13274printf("$xx %d\n", SIG${xx});
13275return 0;
13276}
13277EOCP
13278 set signal
13279 if eval $compile; then
13280 echo "SIG${xx} found."
13281 ./signal$_exe >> signal.ls1
13282 else
13283 echo "SIG${xx} NOT found."
13284 fi
13285 done
13286 if $test -s signal.ls1; then
13287 $cat signal.nsg signal.ls1 |
13288 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13289 fi
13290
13291fi
13292if $test -s signal.lst; then
13293 :
13294else
13295 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 13296 echo 'kill -l' >signal
dc45a647 13297 set X `csh -f <signal`
8e07c86e 13298 $rm -f signal
2304df62 13299 shift
dc45a647 13300 case $# in
8e07c86e 13301 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 13302 esac
28e8609d 13303 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
13304 $awk '{ printf "%s %d\n", $1, ++s; }
13305 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 13306fi
dc45a647 13307$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 13308EOS
4633a7c4
LW
13309chmod a+x signal_cmd
13310$eunicefix signal_cmd
8e07c86e
AD
13311
13312: generate list of signal names
13313echo " "
dfe9444c 13314case "$sig_name_init" in
6626bf4c
JH
13315'') doinit=yes ;;
13316*) case "$sig_num_init" in
13317 ''|*,*) doinit=yes ;;
13318 esac ;;
13319esac
13320case "$doinit" in
13321yes)
4633a7c4 13322 echo "Generating a list of signal names and numbers..." >&4
dc45a647 13323 . ./signal_cmd
af4c28eb
CS
13324 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13325 sig_name=`$awk 'BEGIN { printf "ZERO " }
13326 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13327 sig_num=`$awk 'BEGIN { printf "0 " }
13328 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13329 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
13330 !/^NSIG/ { printf "\"%s\", ", $1 }
13331 END { printf "0\n" }' signal.lst`
13332 sig_num_init=`$awk 'BEGIN { printf "0, " }
13333 !/^NSIG/ { printf "%d, ", $2}
13334 END { printf "0\n"}' signal.lst`
13335 ;;
13336esac
13337echo "The following $sig_count signals are available:"
a0d0e21e
LW
13338echo " "
13339echo $sig_name | $awk \
13340'BEGIN { linelen = 0 }
13341{
8e07c86e 13342 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
13343 name = "SIG" $i " "
13344 linelen = linelen + length(name)
13345 if (linelen > 70) {
13346 printf "\n"
13347 linelen = length(name)
13348 }
13349 printf "%s", name
13350 }
8e07c86e 13351 printf "\n"
a0d0e21e 13352}'
4633a7c4 13353$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 13354
a0d0e21e
LW
13355: see what type is used for signed size_t
13356set ssize_t ssizetype int stdio.h sys/types.h
13357eval $typedef
13358dflt="$ssizetype"
13359$cat > ssize.c <<EOM
13360#include <stdio.h>
13361#include <sys/types.h>
13362#define Size_t $sizetype
13363#define SSize_t $dflt
d674cd6d 13364int main()
a0d0e21e
LW
13365{
13366 if (sizeof(Size_t) == sizeof(SSize_t))
13367 printf("$dflt\n");
13368 else if (sizeof(Size_t) == sizeof(int))
13369 printf("int\n");
13370 else
13371 printf("long\n");
760ac839 13372 exit(0);
a0d0e21e
LW
13373}
13374EOM
13375echo " "
dfe9444c 13376set ssize
dc45a647 13377if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 13378 ssizetype=`./ssize`
a0d0e21e
LW
13379 echo "I'll be using $ssizetype for functions returning a byte count." >&4
13380else
24fef2a7 13381 $cat >&4 <<EOM
24fef2a7
AD
13382Help! I can't compile and run the ssize_t test program: please enlighten me!
13383(This is probably a misconfiguration in your system or libraries, and
13384you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
13385
13386I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 13387be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
13388
13389EOM
13390 rp="What signed type is the same size as $sizetype?"
13391 . ./myread
13392 ssizetype="$ans"
13393fi
dfe9444c 13394$rm -f ssize ssize.*
3fd537d4 13395
a0d0e21e
LW
13396: see what type of char stdio uses.
13397echo " "
13398if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13399 echo "Your stdio uses unsigned chars." >&4
13400 stdchar="unsigned char"
13401else
13402 echo "Your stdio uses signed chars." >&4
13403 stdchar="char"
13404fi
13405
13406: see if time exists
13407echo " "
28e8609d
JH
13408if test "X$d_time" = X -o X"$timetype" = X; then
13409 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
13410 echo 'time() found.' >&4
13411 val="$define"
13412 rp="What is the type returned by time() on this system?"
13413 set time_t timetype long stdio.h sys/types.h
13414 eval $typedef_ask
28e8609d 13415 else
5ff3f7a4
GS
13416 echo 'time() not found, hope that will do.' >&4
13417 val="$undef"
13418 timetype='int';
28e8609d
JH
13419 fi
13420 set d_time
13421 eval $setvar
a0d0e21e 13422fi
a0d0e21e
LW
13423
13424: see what type uids are declared as in the kernel
dc45a647
MB
13425echo " "
13426echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
13427set uid_t uidtype xxx stdio.h sys/types.h
13428eval $typedef
13429case "$uidtype" in
13430xxx)
13431 xxx=`./findhdr sys/user.h`
13432 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13433 case $1 in
13434 unsigned) dflt="$1 $2" ;;
13435 *) dflt="$1" ;;
13436 esac
13437 ;;
4633a7c4
LW
13438*) dflt="$uidtype";;
13439esac
dc45a647
MB
13440case "$uidtype" in
13441uid_t) echo "uid_t found." ;;
13442*) rp="What is the type for user ids returned by getuid()?"
13443 . ./myread
13444 uidtype="$ans"
13445 ;;
13446esac
4633a7c4 13447
57def98f
JH
13448echo " "
13449case "$uidtype" in
13450*_t) zzz="$uidtype" ;;
13451*) zzz="uid" ;;
13452esac
a22e52b9 13453echo "Checking the size of $zzz..." >&4
57def98f
JH
13454cat > try.c <<EOCP
13455#include <sys/types.h>
13456#include <stdio.h>
13457int main() {
213c275f 13458 printf("%d\n", (int)sizeof($uidtype));
14e4fe40 13459 exit(0);
57def98f
JH
13460}
13461EOCP
d4265146 13462set try
a22e52b9 13463if eval $compile_ok; then
57def98f
JH
13464 yyy=`./try`
13465 case "$yyy" in
a22e52b9
JH
13466 '') uidsize=4
13467 echo "(I can't execute the test program--guessing $uidsize.)" >&4
57def98f 13468 ;;
a22e52b9
JH
13469 *) uidsize=$yyy
13470 echo "Your $zzz size is $uidsize bytes."
57def98f
JH
13471 ;;
13472 esac
13473else
a22e52b9
JH
13474 uidsize=4
13475 echo "(I can't compile the test program--guessing $uidsize.)" >&4
57def98f
JH
13476fi
13477
785fb66b
JH
13478echo " "
13479case "$uidtype" in
13480*_t) zzz="$uidtype" ;;
13481*) zzz="uid" ;;
13482esac
a22e52b9 13483echo "Checking the sign of $zzz..." >&4
785fb66b
JH
13484cat > try.c <<EOCP
13485#include <sys/types.h>
13486#include <stdio.h>
13487int main() {
a22e52b9
JH
13488 $uidtype foo = -1;
13489 if (foo < 0)
13490 printf("-1\n");
13491 else
13492 printf("1\n");
785fb66b
JH
13493}
13494EOCP
13495set try
a22e52b9 13496if eval $compile; then
785fb66b
JH
13497 yyy=`./try`
13498 case "$yyy" in
a22e52b9
JH
13499 '') uidsign=1
13500 echo "(I can't execute the test program--guessing unsigned.)" >&4
785fb66b 13501 ;;
a22e52b9
JH
13502 *) uidsign=$yyy
13503 case "$uidsign" in
13504 1) echo "Your $zzz is unsigned." ;;
13505 -1) echo "Your $zzz is signed." ;;
13506 esac
785fb66b
JH
13507 ;;
13508 esac
13509else
a22e52b9
JH
13510 uidsign=1
13511 echo "(I can't compile the test program--guessing unsigned.)" >&4
785fb66b
JH
13512fi
13513
a22e52b9
JH
13514
13515
13516echo " "
13517$echo "Checking the format string to be used for uids..." >&4
13518
13519case "$uidsign" in
13520-1) if $test X"$uidsize" = X"$ivsize"; then
13521 uidformat="$ivdformat"
13522 else
13523 if $test X"$uidsize" = X"$longsize"; then
13524 uidformat='"ld"'
13525 else
13526 if $test X"$uidsize" = X"$intsize"; then
13527 uidformat='"d"'
13528 else
13529 if $test X"$uidsize" = X"$shortsize"; then
13530 uidformat='"hd"'
13531 fi
13532 fi
13533 fi
13534 fi
13535 ;;
13536*) if $test X"$uidsize" = X"$uvsize"; then
13537 uidformat="$uvuformat"
13538 else
13539 if $test X"$uidsize" = X"$longsize"; then
13540 uidformat='"lu"'
13541 else
13542 if $test X"$uidsize" = X"$intsize"; then
13543 uidformat='"u"'
13544 else
13545 if $test X"$uidsize" = X"$shortsize"; then
13546 uidformat='"hu"'
13547 fi
13548 fi
13549 fi
13550 fi
13551 ;;
13552esac
13553
4633a7c4
LW
13554: see if dbm.h is available
13555: see if dbmclose exists
13556set dbmclose d_dbmclose
13557eval $inlibc
13558
13559case "$d_dbmclose" in
13560$define)
13561 set dbm.h i_dbm
13562 eval $inhdr
5f80c64f
JH
13563 case "$i_dbm" in
13564 $define)
13565 val="$undef"
13566 set i_rpcsvcdbm
13567 eval $setvar
13568 ;;
13569 *) set rpcsvc/dbm.h i_rpcsvcdbm
13570 eval $inhdr
13571 ;;
13572 esac
13573 ;;
13574*) echo "We won't be including <dbm.h>"
13575 val="$undef"
13576 set i_dbm
13577 eval $setvar
13578 val="$undef"
13579 set i_rpcsvcdbm
13580 eval $setvar
13581 ;;
13582esac
13583
13584: see if this is a sys/file.h system
13585val=''
13586set sys/file.h val
13587eval $inhdr
13588
13589: do we need to include sys/file.h ?
13590case "$val" in
13591"$define")
13592 echo " "
13593 if $h_sysfile; then
13594 val="$define"
13595 echo "We'll be including <sys/file.h>." >&4
13596 else
13597 val="$undef"
13598 echo "We won't be including <sys/file.h>." >&4
13599 fi
13600 ;;
13601*)
13602 h_sysfile=false
13603 ;;
13604esac
13605set i_sysfile
13606eval $setvar
13607
13608: see if fcntl.h is there
13609val=''
13610set fcntl.h val
13611eval $inhdr
13612
13613: see if we can include fcntl.h
13614case "$val" in
13615"$define")
13616 echo " "
13617 if $h_fcntl; then
13618 val="$define"
13619 echo "We'll be including <fcntl.h>." >&4
13620 else
13621 val="$undef"
13622 if $h_sysfile; then
13623 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13624 else
13625 echo "We won't be including <fcntl.h>." >&4
13626 fi
13627 fi
13628 ;;
13629*)
13630 h_fcntl=false
13631 val="$undef"
13632 ;;
13633esac
13634set i_fcntl
13635eval $setvar
13636
43999f95
JH
13637: see if this is a iconv.h system
13638set iconv.h i_iconv
13639eval $inhdr
13640
5f80c64f
JH
13641: see if locale.h is available
13642set locale.h i_locale
13643eval $inhdr
13644
7f3d1cf1 13645: see if mach cthreads are available
13666627
JH
13646if test "X$usethreads" = "X$define"; then
13647 set mach/cthreads.h i_machcthr
13648 eval $inhdr
13649else
13650 i_machcthr="$undef"
13651fi
13652
13653
7f3d1cf1 13654
5f80c64f
JH
13655: see if this is a math.h system
13656set math.h i_math
13657eval $inhdr
13658
e7fb4fcc
JH
13659: see if this is a mntent.h system
13660set mntent.h i_mntent
13661eval $inhdr
13662
5f80c64f
JH
13663: see if ndbm.h is available
13664set ndbm.h t_ndbm
13665eval $inhdr
13666case "$t_ndbm" in
13667$define)
13668 : see if dbm_open exists
13669 set dbm_open d_dbm_open
13670 eval $inlibc
13671 case "$d_dbm_open" in
13672 $undef)
13673 t_ndbm="$undef"
13674 echo "We won't be including <ndbm.h>"
13675 ;;
13676 esac
13677 ;;
13678esac
13679val="$t_ndbm"
13680set i_ndbm
13681eval $setvar
13682
13683: see if net/errno.h is available
13684val=''
13685set net/errno.h val
13686eval $inhdr
13687
13688: Unfortunately, it causes problems on some systems. Arrgh.
13689case "$val" in
13690$define)
13691 cat > try.c <<'EOM'
13692#include <stdio.h>
13693#include <errno.h>
13694#include <net/errno.h>
13695int func()
13696{
13697 return ENOTSOCK;
13698}
13699EOM
13700 if $cc $ccflags -c try.c >/dev/null 2>&1; then
13701 echo "We'll be including <net/errno.h>." >&4
13702 else
13703 echo "We won't be including <net/errno.h>." >&4
13704 val="$undef"
13705 fi
13706 $rm -f try.* try
13707 ;;
13708esac
13709set i_neterrno
13710eval $setvar
13711
9cc6feab
JH
13712: see if netinet/tcp.h is available
13713set netinet/tcp.h i_netinettcp
13714eval $inhdr
13715
5b34fd99
JH
13716: see if this is a poll.h system
13717set poll.h i_poll
13718eval $inhdr
13719
5f80c64f 13720echo " "
78691af5 13721$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
43999f95
JH
13722$cat <<'EOSH' > Cppsym.know
13723a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13724AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13725alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13726ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13727BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13728BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13729bull c cadmus clipper CMU COFF COMPILER_VERSION
13730concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13731CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13732Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13733FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13734GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13735H3050R H3050RX hbullx20 hcx host_mips
13736hp200 hp300 hp700 HP700 hp800 hp9000
13737hp9000s200 hp9000s300 hp9000s400 hp9000s500
13738hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13739i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13740iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13741INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13742LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13743LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13744Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13745LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13746M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13747M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13748M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13749MATH_HAS_NO_SIDE_EFFECTS
13750mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13751mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13752mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13753MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13754mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13755NetBSD news1500 news1700 news1800 news1900 news3700
13756news700 news800 news900 NeXT NLS ns16000 ns32000
13757ns32016 ns32332 ns32k nsc32000
13758OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13759pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13760pc532 pdp11 PGC PIC plexus PORTAR posix
13761POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13762POSIX_C_SOURCE POSIX_SOURCE POWER
13763PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13764riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13765SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13766sony sony_news sonyrisc sparc sparclite spectrum
13767stardent stdc STDC_EXT stratos sun sun3 sun386
13768Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13769SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13770SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13771sysV68 sysV88 Tek4132 Tek4300 titan
13772tower tower32 tower32_200 tower32_600 tower32_700
13773tower32_800 tower32_850 tss
13774u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13775ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13776unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13777Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13778XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13779XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13780z8000
13781EOSH
13782# Maybe put other stuff here too.
13783cat <<EOSH >>Cppsym.know
13784$osname
13785EOSH
9b97abf7
JH
13786./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13787./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
43999f95
JH
13788$cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13789$rm -f Cppsym.a Cppsym.b
13790cat <<EOSH > Cppsym
5f80c64f 13791$startsh
43999f95
JH
13792if $test \$# -gt 0; then
13793 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13794 if $test -s Cppsym.got; then
13795 $rm -f Cppsym.got
13796 exit 0
13797 fi
13798 $rm -f Cppsym.got
13799 exit 1
13800else
13801 $tr " " "$trnl" | ./Cppsym.try
13802 exit 0
13803fi
13804EOSH
5f80c64f
JH
13805chmod +x Cppsym
13806$eunicefix Cppsym
43999f95
JH
13807cat <<EOSH > Cppsym.try
13808$startsh
13809cat <<'EOCP' > try.c
13810#include <stdio.h>
13811int main() {
13812EOCP
13813$awk \\
13814EOSH
13815cat <<'EOSH' >> Cppsym.try
13816'length($1) > 0 {
13817 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
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}' >> try.c
13822echo '}' >> try.c
13823EOSH
13824cat <<EOSH >> Cppsym.try
13825cc="$cc"
13826optimize="$optimize"
13827ccflags="$ccflags"
13828ldflags="$ldflags"
13829libs="$libs"
13830exe_ext="$exe_ext"
a99dda5d 13831$cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
43999f95
JH
13832EOSH
13833chmod +x Cppsym.try
13834$eunicefix Cppsym.try
13835./Cppsym < Cppsym.know > Cppsym.true
5f80c64f 13836: now check the C compiler for additional symbols
c4747d3e
JH
13837postprocess_cc_v=''
13838case "$osname" in
13839aix) postprocess_cc_v="|$tr , ' '" ;;
13840esac
5f80c64f
JH
13841$cat >ccsym <<EOS
13842$startsh
13843$cat >tmp.c <<EOF
13844extern int foo;
13845EOF
c4747d3e 13846for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
13847do
13848 case "\$i" in
13849 -D*) echo "\$i" | $sed 's/^-D//';;
13850 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13851 esac
13852done
13853$rm -f try.c
13854EOS
2000072c 13855postprocess_cc_v=''
5f80c64f
JH
13856chmod +x ccsym
13857$eunicefix ccsym
13858./ccsym > ccsym1.raw
13859if $test -s ccsym1.raw; then
13860 $sort ccsym1.raw | $uniq >ccsym.raw
13861else
13862 mv ccsym1.raw ccsym.raw
13863fi
13864
13865$awk '/\=/ { print $0; next }
13866 { print $0"=1" }' ccsym.raw >ccsym.list
43999f95
JH
13867$awk '/\=/ { print $0; next }
13868 { print $0"=1" }' Cppsym.true >ccsym.true
5f80c64f
JH
13869$comm -13 ccsym.true ccsym.list >ccsym.own
13870$comm -12 ccsym.true ccsym.list >ccsym.com
13871$comm -23 ccsym.true ccsym.list >ccsym.cpp
13872also=''
5f80c64f 13873if $test -z ccsym.raw; then
ff49bff8 13874 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 13875 echo " "
ff49bff8 13876 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 13877 $cat Cppsym.true
ff49bff8
JH
13878 ccsymbols=''
13879 cppsymbols=`$cat Cppsym.true`
918c3d21 13880 cppsymbols=`echo $cppsymbols`
ff49bff8 13881 cppccsymbols="$cppsymbols"
5f80c64f
JH
13882else
13883 if $test -s ccsym.com; then
13884 echo "Your C compiler and pre-processor define these symbols:"
13885 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13886 also='also '
13887 symbols='ones'
ff49bff8 13888 cppccsymbols=`$cat ccsym.com`
918c3d21 13889 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
13890 $test "$silent" || sleep 1
13891 fi
13892 if $test -s ccsym.cpp; then
13893 $test "$also" && echo " "
ff49bff8 13894 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
13895 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13896 also='further '
ff49bff8 13897 cppsymbols=`$cat ccsym.cpp`
918c3d21 13898 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
13899 $test "$silent" || sleep 1
13900 fi
13901 if $test -s ccsym.own; then
13902 $test "$also" && echo " "
ff49bff8 13903 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
13904 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13905 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 13906 ccsymbols=`$cat ccsym.own`
918c3d21 13907 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
13908 $test "$silent" || sleep 1
13909 fi
13910fi
13911$rm -f ccsym*
13912
13913: see if this is a termio system
13914val="$undef"
13915val2="$undef"
13916val3="$undef"
13917if $test `./findhdr termios.h`; then
13918 set tcsetattr i_termios
13919 eval $inlibc
13920 val3="$i_termios"
13921fi
13922echo " "
13923case "$val3" in
13924"$define") echo "You have POSIX termios.h... good!" >&4;;
13925*) if ./Cppsym pyr; then
13926 case "`/bin/universe`" in
13927 ucb) if $test `./findhdr sgtty.h`; then
13928 val2="$define"
13929 echo "<sgtty.h> found." >&4
13930 else
13931 echo "System is pyramid with BSD universe."
13932 echo "<sgtty.h> not found--you could have problems." >&4
13933 fi;;
13934 *) if $test `./findhdr termio.h`; then
13935 val="$define"
13936 echo "<termio.h> found." >&4
13937 else
13938 echo "System is pyramid with USG universe."
13939 echo "<termio.h> not found--you could have problems." >&4
13940 fi;;
13941 esac
13942 elif ./usg; then
13943 if $test `./findhdr termio.h`; then
13944 echo "<termio.h> found." >&4
13945 val="$define"
13946 elif $test `./findhdr sgtty.h`; then
13947 echo "<sgtty.h> found." >&4
13948 val2="$define"
13949 else
13950echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13951 fi
13952 else
13953 if $test `./findhdr sgtty.h`; then
13954 echo "<sgtty.h> found." >&4
13955 val2="$define"
13956 elif $test `./findhdr termio.h`; then
13957 echo "<termio.h> found." >&4
13958 val="$define"
13959 else
13960echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13961 fi
13962 fi;;
13963esac
13964set i_termio; eval $setvar
13965val=$val2; set i_sgtty; eval $setvar
13966val=$val3; set i_termios; eval $setvar
13967
f1066039
JH
13968: see if this is a shadow.h system
13969set shadow.h i_shadow
13970eval $inhdr
13971
86959918
JH
13972: see if this is a socks.h system
13973set socks.h i_socks
13974eval $inhdr
13975
5f80c64f
JH
13976: see if stdarg is available
13977echo " "
13978if $test `./findhdr stdarg.h`; then
13979 echo "<stdarg.h> found." >&4
13980 valstd="$define"
13981else
13982 echo "<stdarg.h> NOT found." >&4
13983 valstd="$undef"
13984fi
13985
13986: see if varags is available
13987echo " "
13988if $test `./findhdr varargs.h`; then
13989 echo "<varargs.h> found." >&4
13990else
13991 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13992fi
13993
13994: set up the varargs testing programs
13995$cat > varargs.c <<EOP
13996#ifdef I_STDARG
13997#include <stdarg.h>
13998#endif
13999#ifdef I_VARARGS
14000#include <varargs.h>
14001#endif
14002
14003#ifdef I_STDARG
14004int f(char *p, ...)
14005#else
14006int f(va_alist)
14007va_dcl
14008#endif
14009{
14010 va_list ap;
14011#ifndef I_STDARG
14012 char *p;
14013#endif
14014#ifdef I_STDARG
14015 va_start(ap,p);
14016#else
14017 va_start(ap);
14018 p = va_arg(ap, char *);
14019#endif
14020 va_end(ap);
14021}
14022EOP
14023$cat > varargs <<EOP
14024$startsh
14025if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14026 echo "true"
14027else
14028 echo "false"
14029fi
14030$rm -f varargs$_o
14031EOP
14032chmod +x varargs
14033
14034: now check which varargs header should be included
14035echo " "
14036i_varhdr=''
14037case "$valstd" in
14038"$define")
14039 if `./varargs I_STDARG`; then
14040 val='stdarg.h'
14041 elif `./varargs I_VARARGS`; then
14042 val='varargs.h'
14043 fi
14044 ;;
14045*)
14046 if `./varargs I_VARARGS`; then
14047 val='varargs.h'
14048 fi
14049 ;;
14050esac
14051case "$val" in
14052'')
14053echo "I could not find the definition for va_dcl... You have problems..." >&4
14054 val="$undef"; set i_stdarg; eval $setvar
14055 val="$undef"; set i_varargs; eval $setvar
14056 ;;
14057*)
14058 set i_varhdr
14059 eval $setvar
14060 case "$i_varhdr" in
14061 stdarg.h)
14062 val="$define"; set i_stdarg; eval $setvar
14063 val="$undef"; set i_varargs; eval $setvar
14064 ;;
14065 varargs.h)
14066 val="$undef"; set i_stdarg; eval $setvar
14067 val="$define"; set i_varargs; eval $setvar
14068 ;;
14069 esac
14070 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14071esac
14072$rm -f varargs*
14073
14074: see if stddef is available
14075set stddef.h i_stddef
14076eval $inhdr
14077
14078: see if sys/access.h is available
14079set sys/access.h i_sysaccess
14080eval $inhdr
14081
14082: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14083set sys/filio.h i_sysfilio
14084eval $inhdr
14085echo " "
14086if $test `./findhdr sys/ioctl.h`; then
14087 val="$define"
14088 echo '<sys/ioctl.h> found.' >&4
14089else
14090 val="$undef"
14091 if $test $i_sysfilio = "$define"; then
14092 echo '<sys/ioctl.h> NOT found.' >&4
14093 else
14094 $test $i_sgtty = "$define" && xxx="sgtty.h"
14095 $test $i_termio = "$define" && xxx="termio.h"
14096 $test $i_termios = "$define" && xxx="termios.h"
14097echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14098 fi
14099fi
14100set i_sysioctl
14101eval $setvar
14102
ca52efda
JH
14103
14104: see if this is a syslog.h system
14105set syslog.h i_syslog
14106eval $inhdr
14107
bf0c440f
JH
14108
14109: see if this is a sys/mode.h system
14110set sys/mode.h i_sysmode
14111eval $inhdr
14112
5f80c64f
JH
14113: see if sys/resource.h has to be included
14114set sys/resource.h i_sysresrc
14115eval $inhdr
14116
14117: see if sys/security.h is available
14118set sys/security.h i_syssecrt
14119eval $inhdr
14120
104d25b7
JH
14121: see if this is a sys/statvfs.h system
14122set sys/statvfs.h i_sysstatvfs
14123eval $inhdr
14124
b7b35fc2
JH
14125: see if this is a sys/uio.h system
14126set sys/uio.h i_sysuio
14127eval $inhdr
14128
5f80c64f
JH
14129: see if this is a sys/un.h system
14130set sys/un.h i_sysun
14131eval $inhdr
14132
d4935d7f
JH
14133
14134: see if this is a sys/utsname.h system
14135set sys/utsname.h i_sysutsname
14136eval $inhdr
14137
5f80c64f
JH
14138: see if this is a syswait system
14139set sys/wait.h i_syswait
14140eval $inhdr
14141
0545a864
JH
14142: see if this is a ustat.h system
14143set ustat.h i_ustat
14144eval $inhdr
14145
5f80c64f
JH
14146: see if this is an utime system
14147set utime.h i_utime
14148eval $inhdr
14149
14150: see if this is a values.h system
14151set values.h i_values
14152eval $inhdr
14153
14154: see if this is a vfork system
14155case "$d_vfork" in
14156"$define")
14157 set vfork.h i_vfork
14158 eval $inhdr
14159 ;;
14160*)
14161 i_vfork="$undef"
14162 ;;
14163esac
14164
14165: see if gdbm.h is available
14166set gdbm.h t_gdbm
14167eval $inhdr
14168case "$t_gdbm" in
14169$define)
14170 : see if gdbm_open exists
14171 set gdbm_open d_gdbm_open
14172 eval $inlibc
14173 case "$d_gdbm_open" in
14174 $undef)
14175 t_gdbm="$undef"
14176 echo "We won't be including <gdbm.h>"
14177 ;;
14178 esac
14179 ;;
14180esac
14181val="$t_gdbm"
14182set i_gdbm
14183eval $setvar
14184
14185echo " "
14186echo "Looking for extensions..." >&4
5f80c64f
JH
14187: If we are using the old config.sh, known_extensions may contain
14188: old or inaccurate or duplicate values.
14189known_extensions=''
14190nonxs_extensions=''
14191: We do not use find because it might not be available.
14192: We do not just use MANIFEST because the user may have dropped
14193: some additional extensions into the source tree and expect them
14194: to be built.
7e791ca9
NK
14195
14196: Function to recursively find available extensions, ignoring DynaLoader
14197: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14198find_extensions='
14199 for xxx in *; do
14200 case "$xxx" in
14201 DynaLoader|dynaload) ;;
14202 *)
14203 if $test -f $xxx/$xxx.xs; then
14204 known_extensions="$known_extensions $1$xxx";
14205 elif $test -f $xxx/Makefile.PL; then
14206 nonxs_extensions="$nonxs_extensions $1$xxx";
14207 else
14208 if $test -d $xxx -a $# -lt 10; then
14209 set $1$xxx/ $*;
14210 cd $xxx;
14211 eval $find_extensions;
14212 cd ..;
14213 shift;
9f50e519 14214 fi;
7e791ca9
NK
14215 fi
14216 ;;
9f50e519 14217 esac;
7e791ca9
NK
14218 done'
14219tdir=`pwd`
14220cd $rsrc/ext
a3635516 14221set X
efdb23e1 14222shift
7e791ca9 14223eval $find_extensions
5f80c64f
JH
14224set X $nonxs_extensions
14225shift
14226nonxs_extensions="$*"
14227set X $known_extensions
14228shift
14229known_extensions="$*"
14230cd $tdir
14231
14232: Now see which are supported on this system.
14233avail_ext=''
14234for xxx in $known_extensions ; do
14235 case "$xxx" in
14236 DB_File|db_file)
14237 case "$i_db" in
14238 $define) avail_ext="$avail_ext $xxx" ;;
14239 esac
14240 ;;
14241 GDBM_File|gdbm_fil)
14242 case "$i_gdbm" in
14243 $define) avail_ext="$avail_ext $xxx" ;;
14244 esac
14245 ;;
14246 NDBM_File|ndbm_fil)
14247 case "$i_ndbm" in
f7dd4e7f
JH
14248 $define)
14249 case "$osname-$use64bits" in
14250 hpux-define)
14251 case "$libs" in
14252 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14253 esac
14254 ;;
14255 *) avail_ext="$avail_ext $xxx" ;;
14256 esac
14257 ;;
5f80c64f
JH
14258 esac
14259 ;;
14260 ODBM_File|odbm_fil)
14261 case "${i_dbm}${i_rpcsvcdbm}" in
f7dd4e7f
JH
14262 *"${define}"*)
14263 case "$osname-$use64bits" in
14264 hpux-define)
14265 case "$libs" in
14266 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14267 esac
14268 ;;
14269 *) avail_ext="$avail_ext $xxx" ;;
14270 esac
14271 ;;
5f80c64f
JH
14272 esac
14273 ;;
14274 POSIX|posix)
14275 case "$useposix" in
14276 true|define|y) avail_ext="$avail_ext $xxx" ;;
14277 esac
14278 ;;
14279 Opcode|opcode)
14280 case "$useopcode" in
14281 true|define|y) avail_ext="$avail_ext $xxx" ;;
14282 esac
14283 ;;
14284 Socket|socket)
14285 case "$d_socket" in
14286 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14287 esac
14288 ;;
14289 Thread|thread)
14290 case "$usethreads" in
14291 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14292 esac
14293 ;;
14294 IPC/SysV|ipc/sysv)
14295 : XXX Do we need a useipcsysv variable here
14296 case "${d_msg}${d_sem}${d_shm}" in
14297 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14298 esac
14299 ;;
14300 *) avail_ext="$avail_ext $xxx"
14301 ;;
14302 esac
14303done
14304
14305set X $avail_ext
14306shift
14307avail_ext="$*"
14308
14309: Now see which nonxs extensions are supported on this system.
14310: For now assume all are.
14311nonxs_ext=''
14312for xxx in $nonxs_extensions ; do
14313 case "$xxx" in
14314 *) nonxs_ext="$nonxs_ext $xxx"
14315 ;;
14316 esac
14317done
14318
14319set X $nonxs_ext
14320shift
14321nonxs_ext="$*"
14322
14323case $usedl in
14324$define)
14325 $cat <<EOM
14326A number of extensions are supplied with $package. You may choose to
14327compile these extensions for dynamic loading (the default), compile
14328them into the $package executable (static loading), or not include
14329them at all. Answer "none" to include no extensions.
14330Note that DynaLoader is always built and need not be mentioned here.
14331
14332EOM
14333 case "$dynamic_ext" in
14334 '') dflt="$avail_ext" ;;
14335 *) dflt="$dynamic_ext"
14336 # Perhaps we are reusing an old out-of-date config.sh.
14337 case "$hint" in
14338 previous)
14339 if test X"$dynamic_ext" != X"$avail_ext"; then
14340 $cat <<EOM
14341NOTICE: Your previous config.sh list may be incorrect.
14342The extensions now available to you are
14343 ${avail_ext}
14344but the default list from your previous config.sh is
14345 ${dynamic_ext}
14346
14347EOM
14348 fi
14349 ;;
14350 esac
14351 ;;
14352 esac
14353 case "$dflt" in
14354 '') dflt=none;;
14355 esac
14356 rp="What extensions do you wish to load dynamically?"
14357 . ./myread
14358 case "$ans" in
14359 none) dynamic_ext=' ' ;;
14360 *) dynamic_ext="$ans" ;;
14361 esac
14362
14363 case "$static_ext" in
14364 '')
14365 : Exclude those already listed in dynamic linking
14366 dflt=''
14367 for xxx in $avail_ext; do
14368 case " $dynamic_ext " in
14369 *" $xxx "*) ;;
14370 *) dflt="$dflt $xxx" ;;
14371 esac
14372 done
14373 set X $dflt
14374 shift
14375 dflt="$*"
14376 ;;
14377 *) dflt="$static_ext"
14378 ;;
14379 esac
14380
14381 case "$dflt" in
14382 '') dflt=none;;
14383 esac
14384 rp="What extensions do you wish to load statically?"
14385 . ./myread
14386 case "$ans" in
14387 none) static_ext=' ' ;;
14388 *) static_ext="$ans" ;;
14389 esac
14390 ;;
14391*)
14392 $cat <<EOM
14393A number of extensions are supplied with $package. Answer "none"
14394to include no extensions.
14395Note that DynaLoader is always built and need not be mentioned here.
14396
14397EOM
14398 case "$static_ext" in
14399 '') dflt="$avail_ext" ;;
14400 *) dflt="$static_ext"
14401 # Perhaps we are reusing an old out-of-date config.sh.
14402 case "$hint" in
14403 previous)
14404 if test X"$static_ext" != X"$avail_ext"; then
14405 $cat <<EOM
14406NOTICE: Your previous config.sh list may be incorrect.
14407The extensions now available to you are
14408 ${avail_ext}
14409but the default list from your previous config.sh is
14410 ${static_ext}
14411
14412EOM
14413 fi
14414 ;;
14415 esac
14416 ;;
14417 esac
14418 : Exclude those that are not xs extensions
14419 case "$dflt" in
14420 '') dflt=none;;
14421 esac
14422 rp="What extensions do you wish to include?"
14423 . ./myread
14424 case "$ans" in
14425 none) static_ext=' ' ;;
14426 *) static_ext="$ans" ;;
14427 esac
14428 ;;
14429esac
14430
14431set X $dynamic_ext $static_ext $nonxs_ext
14432shift
14433extensions="$*"
14434
14435: Remove build directory name from cppstdin so it can be used from
14436: either the present location or the final installed location.
14437echo " "
14438: Get out of the UU directory to get correct path name.
14439cd ..
14440case "$cppstdin" in
14441`pwd`/cppstdin)
14442 echo "Stripping down cppstdin path name"
14443 cppstdin=cppstdin
14444 ;;
14445esac
14446cd UU
14447
14448: end of configuration questions
14449echo " "
14450echo "End of configuration questions."
14451echo " "
14452
14453: back to where it started
14454if test -d ../UU; then
14455 cd ..
14456fi
14457
14458: configuration may be patched via a 'config.over' file
14459if $test -f config.over; then
14460 echo " "
14461 dflt=y
14462 rp='I see a config.over file. Do you wish to load it?'
14463 . UU/myread
14464 case "$ans" in
14465 n*) echo "OK, I'll ignore it.";;
14466 *) . ./config.over
14467 echo "Configuration override changes have been loaded."
14468 ;;
14469 esac
14470fi
14471
14472: in case they want portability, strip down executable paths
14473case "$d_portable" in
14474"$define")
14475 echo " "
14476 echo "Stripping down executable paths..." >&4
14477 for file in $loclist $trylist; do
534ac15a
JH
14478 eval temp=\$$file
14479 eval $file=`basename $temp`
5f80c64f
JH
14480 done
14481 ;;
14482esac
14483
14484: create config.sh file
14485echo " "
14486echo "Creating config.sh..." >&4
14487$spitshell <<EOT >config.sh
14488$startsh
14489#
14490# This file was produced by running the Configure script. It holds all the
14491# definitions figured out by Configure. Should you modify one of these values,
14492# do not forget to propagate your changes by running "Configure -der". You may
14493# instead choose to run each of the .SH files by yourself, or "Configure -S".
14494#
14495
14496# Package name : $package
14497# Source directory : $src
14498# Configuration time: $cf_time
14499# Configured by : $cf_by
14500# Target system : $myuname
14501
14502Author='$Author'
14503Date='$Date'
14504Header='$Header'
14505Id='$Id'
14506Locker='$Locker'
14507Log='$Log'
14508Mcc='$Mcc'
14509RCSfile='$RCSfile'
14510Revision='$Revision'
14511Source='$Source'
14512State='$State'
14513_a='$_a'
14514_exe='$_exe'
14515_o='$_o'
14516afs='$afs'
14517alignbytes='$alignbytes'
14518ansi2knr='$ansi2knr'
14519aphostname='$aphostname'
ff935051
JH
14520api_revision='$api_revision'
14521api_subversion='$api_subversion'
14522api_version='$api_version'
14523api_versionstring='$api_versionstring'
5f80c64f
JH
14524ar='$ar'
14525archlib='$archlib'
14526archlibexp='$archlibexp'
14527archname64='$archname64'
14528archname='$archname'
14529archobjs='$archobjs'
14530awk='$awk'
14531baserev='$baserev'
14532bash='$bash'
14533bin='$bin'
d71b2b6b 14534bincompat5005='$bincompat5005'
5f80c64f
JH
14535binexp='$binexp'
14536bison='$bison'
14537byacc='$byacc'
14538byteorder='$byteorder'
14539c='$c'
14540castflags='$castflags'
14541cat='$cat'
14542cc='$cc'
14543cccdlflags='$cccdlflags'
14544ccdlflags='$ccdlflags'
14545ccflags='$ccflags'
ff49bff8 14546ccsymbols='$ccsymbols'
5f80c64f
JH
14547cf_by='$cf_by'
14548cf_email='$cf_email'
14549cf_time='$cf_time'
8175356b 14550charsize='$charsize'
5f80c64f
JH
14551chgrp='$chgrp'
14552chmod='$chmod'
14553chown='$chown'
14554clocktype='$clocktype'
14555comm='$comm'
14556compress='$compress'
14557contains='$contains'
14558cp='$cp'
14559cpio='$cpio'
14560cpp='$cpp'
14561cpp_stuff='$cpp_stuff'
ff49bff8 14562cppccsymbols='$cppccsymbols'
5f80c64f
JH
14563cppflags='$cppflags'
14564cpplast='$cpplast'
14565cppminus='$cppminus'
14566cpprun='$cpprun'
14567cppstdin='$cppstdin'
ff49bff8 14568cppsymbols='$cppsymbols'
68c15b6f 14569crosscompile='$crosscompile'
5f80c64f
JH
14570cryptlib='$cryptlib'
14571csh='$csh'
14572d_Gconvert='$d_Gconvert'
cf2093f6
JH
14573d_PRIEldbl='$d_PRIEldbl'
14574d_PRIFldbl='$d_PRIFldbl'
14575d_PRIGldbl='$d_PRIGldbl'
14576d_PRIX64='$d_PRIX64'
14577d_PRId64='$d_PRId64'
14578d_PRIeldbl='$d_PRIeldbl'
14579d_PRIfldbl='$d_PRIfldbl'
14580d_PRIgldbl='$d_PRIgldbl'
14581d_PRIi64='$d_PRIi64'
14582d_PRIo64='$d_PRIo64'
14583d_PRIu64='$d_PRIu64'
14584d_PRIx64='$d_PRIx64'
5f80c64f
JH
14585d_access='$d_access'
14586d_accessx='$d_accessx'
14587d_alarm='$d_alarm'
14588d_archlib='$d_archlib'
cf2093f6
JH
14589d_atolf='$d_atolf'
14590d_atoll='$d_atoll'
5f80c64f
JH
14591d_attribut='$d_attribut'
14592d_bcmp='$d_bcmp'
14593d_bcopy='$d_bcopy'
d71b2b6b 14594d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
14595d_bsd='$d_bsd'
14596d_bsdgetpgrp='$d_bsdgetpgrp'
14597d_bsdsetpgrp='$d_bsdsetpgrp'
14598d_bzero='$d_bzero'
14599d_casti32='$d_casti32'
14600d_castneg='$d_castneg'
14601d_charvspr='$d_charvspr'
14602d_chown='$d_chown'
14603d_chroot='$d_chroot'
14604d_chsize='$d_chsize'
14605d_closedir='$d_closedir'
14606d_const='$d_const'
14607d_crypt='$d_crypt'
14608d_csh='$d_csh'
14609d_cuserid='$d_cuserid'
14610d_dbl_dig='$d_dbl_dig'
5f80c64f 14611d_difftime='$d_difftime'
5f80c64f
JH
14612d_dirnamlen='$d_dirnamlen'
14613d_dlerror='$d_dlerror'
14614d_dlopen='$d_dlopen'
14615d_dlsymun='$d_dlsymun'
14616d_dosuid='$d_dosuid'
14617d_drand48proto='$d_drand48proto'
14618d_dup2='$d_dup2'
14619d_eaccess='$d_eaccess'
14620d_endgrent='$d_endgrent'
14621d_endhent='$d_endhent'
14622d_endnent='$d_endnent'
14623d_endpent='$d_endpent'
14624d_endpwent='$d_endpwent'
14625d_endsent='$d_endsent'
f1066039 14626d_endspent='$d_endspent'
5f80c64f
JH
14627d_eofnblk='$d_eofnblk'
14628d_eunice='$d_eunice'
14629d_fchmod='$d_fchmod'
14630d_fchown='$d_fchown'
14631d_fcntl='$d_fcntl'
14632d_fd_macros='$d_fd_macros'
14633d_fd_set='$d_fd_set'
14634d_fds_bits='$d_fds_bits'
5f80c64f 14635d_fgetpos='$d_fgetpos'
5f80c64f 14636d_flexfnam='$d_flexfnam'
5f80c64f 14637d_flock='$d_flock'
5f80c64f
JH
14638d_fork='$d_fork'
14639d_fpathconf='$d_fpathconf'
d9b3e12d 14640d_fpos64_t='$d_fpos64_t'
0545a864 14641d_fs_data_s='$d_fs_data_s'
5f80c64f 14642d_fseeko='$d_fseeko'
5f80c64f 14643d_fsetpos='$d_fsetpos'
104d25b7
JH
14644d_fstatfs='$d_fstatfs'
14645d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
14646d_ftello='$d_ftello'
14647d_ftime='$d_ftime'
49dabb45 14648d_getcwd='$d_getcwd'
5f80c64f
JH
14649d_getgrent='$d_getgrent'
14650d_getgrps='$d_getgrps'
14651d_gethbyaddr='$d_gethbyaddr'
14652d_gethbyname='$d_gethbyname'
14653d_gethent='$d_gethent'
14654d_gethname='$d_gethname'
14655d_gethostprotos='$d_gethostprotos'
14656d_getlogin='$d_getlogin'
ad27e871 14657d_getmnt='$d_getmnt'
ccc7f9b3 14658d_getmntent='$d_getmntent'
5f80c64f
JH
14659d_getnbyaddr='$d_getnbyaddr'
14660d_getnbyname='$d_getnbyname'
14661d_getnent='$d_getnent'
14662d_getnetprotos='$d_getnetprotos'
14663d_getpbyname='$d_getpbyname'
14664d_getpbynumber='$d_getpbynumber'
14665d_getpent='$d_getpent'
14666d_getpgid='$d_getpgid'
14667d_getpgrp2='$d_getpgrp2'
14668d_getpgrp='$d_getpgrp'
14669d_getppid='$d_getppid'
14670d_getprior='$d_getprior'
14671d_getprotoprotos='$d_getprotoprotos'
14672d_getpwent='$d_getpwent'
14673d_getsbyname='$d_getsbyname'
14674d_getsbyport='$d_getsbyport'
14675d_getsent='$d_getsent'
14676d_getservprotos='$d_getservprotos'
f1066039
JH
14677d_getspent='$d_getspent'
14678d_getspnam='$d_getspnam'
5f80c64f
JH
14679d_gettimeod='$d_gettimeod'
14680d_gnulibc='$d_gnulibc'
14681d_grpasswd='$d_grpasswd'
ccc7f9b3 14682d_hasmntopt='$d_hasmntopt'
5f80c64f 14683d_htonl='$d_htonl'
43999f95 14684d_iconv='$d_iconv'
5f80c64f
JH
14685d_index='$d_index'
14686d_inetaton='$d_inetaton'
5f80c64f
JH
14687d_int64t='$d_int64t'
14688d_isascii='$d_isascii'
14689d_killpg='$d_killpg'
14690d_lchown='$d_lchown'
2d4389e4 14691d_ldbl_dig='$d_ldbl_dig'
5f80c64f
JH
14692d_link='$d_link'
14693d_locconv='$d_locconv'
5f80c64f
JH
14694d_lockf='$d_lockf'
14695d_longdbl='$d_longdbl'
14696d_longlong='$d_longlong'
5f80c64f
JH
14697d_lstat='$d_lstat'
14698d_mblen='$d_mblen'
14699d_mbstowcs='$d_mbstowcs'
14700d_mbtowc='$d_mbtowc'
0f27ced1 14701d_memchr='$d_memchr'
5f80c64f
JH
14702d_memcmp='$d_memcmp'
14703d_memcpy='$d_memcpy'
14704d_memmove='$d_memmove'
14705d_memset='$d_memset'
14706d_mkdir='$d_mkdir'
fe749a9f 14707d_mkdtemp='$d_mkdtemp'
5f80c64f 14708d_mkfifo='$d_mkfifo'
fe749a9f
JH
14709d_mkstemp='$d_mkstemp'
14710d_mkstemps='$d_mkstemps'
5f80c64f 14711d_mktime='$d_mktime'
fe749a9f
JH
14712d_mmap='$d_mmap'
14713d_mprotect='$d_mprotect'
5f80c64f 14714d_msg='$d_msg'
de4597cb
JH
14715d_msg_ctrunc='$d_msg_ctrunc'
14716d_msg_dontroute='$d_msg_dontroute'
14717d_msg_oob='$d_msg_oob'
14718d_msg_peek='$d_msg_peek'
14719d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
14720d_msgctl='$d_msgctl'
14721d_msgget='$d_msgget'
14722d_msgrcv='$d_msgrcv'
14723d_msgsnd='$d_msgsnd'
fe749a9f
JH
14724d_msync='$d_msync'
14725d_munmap='$d_munmap'
5f80c64f 14726d_mymalloc='$d_mymalloc'
5f80c64f 14727d_nice='$d_nice'
78691af5 14728d_nv_preserves_uv='$d_nv_preserves_uv'
2000072c 14729d_off64_t='$d_off64_t'
ef4af2be 14730d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
14731d_oldpthreads='$d_oldpthreads'
14732d_oldsock='$d_oldsock'
14733d_open3='$d_open3'
5f80c64f
JH
14734d_pathconf='$d_pathconf'
14735d_pause='$d_pause'
14736d_phostname='$d_phostname'
14737d_pipe='$d_pipe'
14738d_poll='$d_poll'
14739d_portable='$d_portable'
14740d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
14741d_pwage='$d_pwage'
14742d_pwchange='$d_pwchange'
14743d_pwclass='$d_pwclass'
14744d_pwcomment='$d_pwcomment'
14745d_pwexpire='$d_pwexpire'
14746d_pwgecos='$d_pwgecos'
14747d_pwpasswd='$d_pwpasswd'
14748d_pwquota='$d_pwquota'
de1c2614 14749d_quad='$d_quad'
5f80c64f
JH
14750d_readdir='$d_readdir'
14751d_readlink='$d_readlink'
14752d_rename='$d_rename'
14753d_rewinddir='$d_rewinddir'
14754d_rmdir='$d_rmdir'
14755d_safebcpy='$d_safebcpy'
14756d_safemcpy='$d_safemcpy'
14757d_sanemcmp='$d_sanemcmp'
14758d_sched_yield='$d_sched_yield'
de4597cb 14759d_scm_rights='$d_scm_rights'
5f80c64f
JH
14760d_seekdir='$d_seekdir'
14761d_select='$d_select'
14762d_sem='$d_sem'
14763d_semctl='$d_semctl'
14764d_semctl_semid_ds='$d_semctl_semid_ds'
14765d_semctl_semun='$d_semctl_semun'
14766d_semget='$d_semget'
14767d_semop='$d_semop'
14768d_setegid='$d_setegid'
14769d_seteuid='$d_seteuid'
14770d_setgrent='$d_setgrent'
14771d_setgrps='$d_setgrps'
14772d_sethent='$d_sethent'
14773d_setlinebuf='$d_setlinebuf'
14774d_setlocale='$d_setlocale'
14775d_setnent='$d_setnent'
14776d_setpent='$d_setpent'
14777d_setpgid='$d_setpgid'
14778d_setpgrp2='$d_setpgrp2'
14779d_setpgrp='$d_setpgrp'
14780d_setprior='$d_setprior'
14781d_setpwent='$d_setpwent'
14782d_setregid='$d_setregid'
14783d_setresgid='$d_setresgid'
14784d_setresuid='$d_setresuid'
14785d_setreuid='$d_setreuid'
14786d_setrgid='$d_setrgid'
14787d_setruid='$d_setruid'
14788d_setsent='$d_setsent'
14789d_setsid='$d_setsid'
f1066039 14790d_setspent='$d_setspent'
5f80c64f
JH
14791d_setvbuf='$d_setvbuf'
14792d_sfio='$d_sfio'
14793d_shm='$d_shm'
14794d_shmat='$d_shmat'
14795d_shmatprototype='$d_shmatprototype'
14796d_shmctl='$d_shmctl'
14797d_shmdt='$d_shmdt'
14798d_shmget='$d_shmget'
14799d_sigaction='$d_sigaction'
14800d_sigsetjmp='$d_sigsetjmp'
14801d_socket='$d_socket'
14802d_sockpair='$d_sockpair'
68d4903c 14803d_sqrtl='$d_sqrtl'
5f80c64f 14804d_statblks='$d_statblks'
0545a864
JH
14805d_statfs_f_flags='$d_statfs_f_flags'
14806d_statfs_s='$d_statfs_s'
104d25b7 14807d_statvfs='$d_statvfs'
5f80c64f
JH
14808d_stdio_cnt_lval='$d_stdio_cnt_lval'
14809d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 14810d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
14811d_stdiobase='$d_stdiobase'
14812d_stdstdio='$d_stdstdio'
5f80c64f
JH
14813d_strchr='$d_strchr'
14814d_strcoll='$d_strcoll'
14815d_strctcpy='$d_strctcpy'
14816d_strerrm='$d_strerrm'
14817d_strerror='$d_strerror'
14818d_strtod='$d_strtod'
14819d_strtol='$d_strtol'
ff935051 14820d_strtold='$d_strtold'
76d49b1c 14821d_strtoll='$d_strtoll'
5f80c64f 14822d_strtoul='$d_strtoul'
cf2093f6 14823d_strtoull='$d_strtoull'
ff935051 14824d_strtouq='$d_strtouq'
5f80c64f
JH
14825d_strxfrm='$d_strxfrm'
14826d_suidsafe='$d_suidsafe'
14827d_symlink='$d_symlink'
14828d_syscall='$d_syscall'
14829d_sysconf='$d_sysconf'
14830d_sysernlst='$d_sysernlst'
14831d_syserrlst='$d_syserrlst'
14832d_system='$d_system'
14833d_tcgetpgrp='$d_tcgetpgrp'
14834d_tcsetpgrp='$d_tcsetpgrp'
5f80c64f 14835d_telldir='$d_telldir'
cb86ce0e 14836d_telldirproto='$d_telldirproto'
5f80c64f
JH
14837d_time='$d_time'
14838d_times='$d_times'
5f80c64f
JH
14839d_truncate='$d_truncate'
14840d_tzname='$d_tzname'
14841d_umask='$d_umask'
14842d_uname='$d_uname'
14843d_union_semun='$d_union_semun'
0545a864 14844d_ustat='$d_ustat'
717c4fcc 14845d_vendorbin='$d_vendorbin'
a3635516 14846d_vendorlib='$d_vendorlib'
5f80c64f
JH
14847d_vfork='$d_vfork'
14848d_void_closedir='$d_void_closedir'
14849d_voidsig='$d_voidsig'
14850d_voidtty='$d_voidtty'
14851d_volatile='$d_volatile'
14852d_vprintf='$d_vprintf'
14853d_wait4='$d_wait4'
14854d_waitpid='$d_waitpid'
14855d_wcstombs='$d_wcstombs'
14856d_wctomb='$d_wctomb'
14857d_xenix='$d_xenix'
14858date='$date'
14859db_hashtype='$db_hashtype'
14860db_prefixtype='$db_prefixtype'
14861defvoidused='$defvoidused'
14862direntrytype='$direntrytype'
14863dlext='$dlext'
14864dlsrc='$dlsrc'
14865doublesize='$doublesize'
14866drand01='$drand01'
14867dynamic_ext='$dynamic_ext'
14868eagain='$eagain'
14869ebcdic='$ebcdic'
14870echo='$echo'
14871egrep='$egrep'
14872emacs='$emacs'
14873eunicefix='$eunicefix'
14874exe_ext='$exe_ext'
14875expr='$expr'
14876extensions='$extensions'
66fe083f 14877fflushNULL='$fflushNULL'
767df6a1 14878fflushall='$fflushall'
5f80c64f
JH
14879find='$find'
14880firstmakefile='$firstmakefile'
14881flex='$flex'
8175356b 14882fpossize='$fpossize'
5f80c64f
JH
14883fpostype='$fpostype'
14884freetype='$freetype'
ccc7f9b3 14885full_ar='$full_ar'
5f80c64f
JH
14886full_csh='$full_csh'
14887full_sed='$full_sed'
14888gccversion='$gccversion'
a22e52b9 14889gidformat='$gidformat'
785fb66b
JH
14890gidsign='$gidsign'
14891gidsize='$gidsize'
5f80c64f
JH
14892gidtype='$gidtype'
14893glibpth='$glibpth'
14894grep='$grep'
14895groupcat='$groupcat'
14896groupstype='$groupstype'
14897gzip='$gzip'
14898h_fcntl='$h_fcntl'
14899h_sysfile='$h_sysfile'
14900hint='$hint'
14901hostcat='$hostcat'
14902huge='$huge'
8175356b
JH
14903i16size='$i16size'
14904i16type='$i16type'
14905i32size='$i32size'
14906i32type='$i32type'
14907i64size='$i64size'
14908i64type='$i64type'
14909i8size='$i8size'
14910i8type='$i8type'
5f80c64f
JH
14911i_arpainet='$i_arpainet'
14912i_bsdioctl='$i_bsdioctl'
14913i_db='$i_db'
14914i_dbm='$i_dbm'
14915i_dirent='$i_dirent'
14916i_dld='$i_dld'
14917i_dlfcn='$i_dlfcn'
14918i_fcntl='$i_fcntl'
14919i_float='$i_float'
14920i_gdbm='$i_gdbm'
14921i_grp='$i_grp'
43999f95 14922i_iconv='$i_iconv'
5f80c64f
JH
14923i_inttypes='$i_inttypes'
14924i_limits='$i_limits'
14925i_locale='$i_locale'
7f3d1cf1 14926i_machcthr='$i_machcthr'
5f80c64f
JH
14927i_malloc='$i_malloc'
14928i_math='$i_math'
14929i_memory='$i_memory'
e7fb4fcc 14930i_mntent='$i_mntent'
5f80c64f
JH
14931i_ndbm='$i_ndbm'
14932i_netdb='$i_netdb'
14933i_neterrno='$i_neterrno'
9cc6feab 14934i_netinettcp='$i_netinettcp'
5f80c64f 14935i_niin='$i_niin'
5b34fd99 14936i_poll='$i_poll'
c4747d3e 14937i_pthread='$i_pthread'
5f80c64f
JH
14938i_pwd='$i_pwd'
14939i_rpcsvcdbm='$i_rpcsvcdbm'
14940i_sfio='$i_sfio'
14941i_sgtty='$i_sgtty'
f1066039 14942i_shadow='$i_shadow'
86959918 14943i_socks='$i_socks'
5f80c64f
JH
14944i_stdarg='$i_stdarg'
14945i_stddef='$i_stddef'
14946i_stdlib='$i_stdlib'
14947i_string='$i_string'
14948i_sysaccess='$i_sysaccess'
14949i_sysdir='$i_sysdir'
14950i_sysfile='$i_sysfile'
14951i_sysfilio='$i_sysfilio'
14952i_sysin='$i_sysin'
14953i_sysioctl='$i_sysioctl'
ca52efda 14954i_syslog='$i_syslog'
fe749a9f 14955i_sysmman='$i_sysmman'
bf0c440f 14956i_sysmode='$i_sysmode'
104d25b7 14957i_sysmount='$i_sysmount'
5f80c64f
JH
14958i_sysndir='$i_sysndir'
14959i_sysparam='$i_sysparam'
14960i_sysresrc='$i_sysresrc'
14961i_syssecrt='$i_syssecrt'
14962i_sysselct='$i_sysselct'
14963i_syssockio='$i_syssockio'
14964i_sysstat='$i_sysstat'
0545a864 14965i_sysstatfs='$i_sysstatfs'
104d25b7 14966i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
14967i_systime='$i_systime'
14968i_systimek='$i_systimek'
14969i_systimes='$i_systimes'
14970i_systypes='$i_systypes'
de4597cb 14971i_sysuio='$i_sysuio'
5f80c64f 14972i_sysun='$i_sysun'
d4935d7f 14973i_sysutsname='$i_sysutsname'
0545a864 14974i_sysvfs='$i_sysvfs'
5f80c64f
JH
14975i_syswait='$i_syswait'
14976i_termio='$i_termio'
14977i_termios='$i_termios'
14978i_time='$i_time'
14979i_unistd='$i_unistd'
0545a864 14980i_ustat='$i_ustat'
5f80c64f
JH
14981i_utime='$i_utime'
14982i_values='$i_values'
14983i_varargs='$i_varargs'
14984i_varhdr='$i_varhdr'
14985i_vfork='$i_vfork'
14986ignore_versioned_solibs='$ignore_versioned_solibs'
ff935051 14987inc_version_list='$inc_version_list'
3a096bf3 14988inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
14989incpath='$incpath'
14990inews='$inews'
14991installarchlib='$installarchlib'
14992installbin='$installbin'
14993installman1dir='$installman1dir'
14994installman3dir='$installman3dir'
dd4e71fd
JH
14995installprefix='$installprefix'
14996installprefixexp='$installprefixexp'
5f80c64f
JH
14997installprivlib='$installprivlib'
14998installscript='$installscript'
14999installsitearch='$installsitearch'
717c4fcc 15000installsitebin='$installsitebin'
5f80c64f 15001installsitelib='$installsitelib'
dd4e71fd 15002installstyle='$installstyle'
104d25b7 15003installusrbinperl='$installusrbinperl'
717c4fcc 15004installvendorbin='$installvendorbin'
a3635516 15005installvendorlib='$installvendorlib'
5f80c64f 15006intsize='$intsize'
8175356b
JH
15007ivdformat='$ivdformat'
15008ivsize='$ivsize'
15009ivtype='$ivtype'
5f80c64f
JH
15010known_extensions='$known_extensions'
15011ksh='$ksh'
15012large='$large'
15013ld='$ld'
15014lddlflags='$lddlflags'
15015ldflags='$ldflags'
5cf1d1f1 15016ldlibpthname='$ldlibpthname'
5f80c64f
JH
15017less='$less'
15018lib_ext='$lib_ext'
15019libc='$libc'
15020libperl='$libperl'
15021libpth='$libpth'
15022libs='$libs'
43999f95
JH
15023libsdirs='$libsdirs'
15024libsfiles='$libsfiles'
15025libsfound='$libsfound'
5f80c64f
JH
15026libswanted='$libswanted'
15027line='$line'
15028lint='$lint'
15029lkflags='$lkflags'
15030ln='$ln'
15031lns='$lns'
15032locincpth='$locincpth'
15033loclibpth='$loclibpth'
15034longdblsize='$longdblsize'
15035longlongsize='$longlongsize'
15036longsize='$longsize'
15037lp='$lp'
15038lpr='$lpr'
15039ls='$ls'
15040lseeksize='$lseeksize'
15041lseektype='$lseektype'
15042mail='$mail'
15043mailx='$mailx'
15044make='$make'
15045make_set_make='$make_set_make'
15046mallocobj='$mallocobj'
15047mallocsrc='$mallocsrc'
15048malloctype='$malloctype'
15049man1dir='$man1dir'
15050man1direxp='$man1direxp'
15051man1ext='$man1ext'
15052man3dir='$man3dir'
15053man3direxp='$man3direxp'
15054man3ext='$man3ext'
15055medium='$medium'
5f80c64f
JH
15056mips_type='$mips_type'
15057mkdir='$mkdir'
fe749a9f 15058mmaptype='$mmaptype'
5f80c64f
JH
15059models='$models'
15060modetype='$modetype'
15061more='$more'
68c15b6f 15062multiarch='$multiarch'
5f80c64f
JH
15063mv='$mv'
15064myarchname='$myarchname'
15065mydomain='$mydomain'
15066myhostname='$myhostname'
15067myuname='$myuname'
15068n='$n'
15069netdb_hlen_type='$netdb_hlen_type'
15070netdb_host_type='$netdb_host_type'
15071netdb_name_type='$netdb_name_type'
15072netdb_net_type='$netdb_net_type'
15073nm='$nm'
15074nm_opt='$nm_opt'
15075nm_so_opt='$nm_so_opt'
15076nonxs_ext='$nonxs_ext'
15077nroff='$nroff'
8175356b
JH
15078nvsize='$nvsize'
15079nvtype='$nvtype'
5f80c64f
JH
15080o_nonblock='$o_nonblock'
15081obj_ext='$obj_ext'
ef4af2be 15082old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
15083optimize='$optimize'
15084orderlib='$orderlib'
15085osname='$osname'
15086osvers='$osvers'
15087package='$package'
15088pager='$pager'
15089passcat='$passcat'
15090patchlevel='$patchlevel'
15091path_sep='$path_sep'
15092perl='$perl'
15093perladmin='$perladmin'
15094perlpath='$perlpath'
15095pg='$pg'
15096phostname='$phostname'
15097pidtype='$pidtype'
15098plibpth='$plibpth'
fe749a9f 15099pm_apiversion='$pm_apiversion'
5f80c64f
JH
15100pmake='$pmake'
15101pr='$pr'
15102prefix='$prefix'
15103prefixexp='$prefixexp'
15104privlib='$privlib'
15105privlibexp='$privlibexp'
15106prototype='$prototype'
15107ptrsize='$ptrsize'
6b8eaf93 15108quadkind='$quadkind'
d7d93a81 15109quadtype='$quadtype'
5f80c64f
JH
15110randbits='$randbits'
15111randfunc='$randfunc'
15112randseedtype='$randseedtype'
15113ranlib='$ranlib'
15114rd_nodata='$rd_nodata'
15115rm='$rm'
15116rmail='$rmail'
15117runnm='$runnm'
cf2093f6
JH
15118sPRIEldbl='$sPRIEldbl'
15119sPRIFldbl='$sPRIFldbl'
15120sPRIGldbl='$sPRIGldbl'
15121sPRIX64='$sPRIX64'
15122sPRId64='$sPRId64'
15123sPRIeldbl='$sPRIeldbl'
15124sPRIfldbl='$sPRIfldbl'
15125sPRIgldbl='$sPRIgldbl'
15126sPRIi64='$sPRIi64'
15127sPRIo64='$sPRIo64'
15128sPRIu64='$sPRIu64'
15129sPRIx64='$sPRIx64'
5f80c64f
JH
15130sched_yield='$sched_yield'
15131scriptdir='$scriptdir'
15132scriptdirexp='$scriptdirexp'
15133sed='$sed'
15134seedfunc='$seedfunc'
15135selectminbits='$selectminbits'
15136selecttype='$selecttype'
15137sendmail='$sendmail'
15138sh='$sh'
15139shar='$shar'
15140sharpbang='$sharpbang'
15141shmattype='$shmattype'
15142shortsize='$shortsize'
15143shrpenv='$shrpenv'
15144shsharp='$shsharp'
af4c28eb 15145sig_count='$sig_count'
5f80c64f
JH
15146sig_name='$sig_name'
15147sig_name_init='$sig_name_init'
15148sig_num='$sig_num'
824a2ba3 15149sig_num_init='$sig_num_init'
5f80c64f
JH
15150signal_t='$signal_t'
15151sitearch='$sitearch'
15152sitearchexp='$sitearchexp'
717c4fcc
JH
15153sitebin='$sitebin'
15154sitebinexp='$sitebinexp'
5f80c64f
JH
15155sitelib='$sitelib'
15156sitelibexp='$sitelibexp'
dd4e71fd
JH
15157siteprefix='$siteprefix'
15158siteprefixexp='$siteprefixexp'
5f80c64f
JH
15159sizetype='$sizetype'
15160sleep='$sleep'
15161smail='$smail'
15162small='$small'
15163so='$so'
15164sockethdr='$sockethdr'
15165socketlib='$socketlib'
15166sort='$sort'
15167spackage='$spackage'
15168spitshell='$spitshell'
15169split='$split'
15170src='$src'
15171ssizetype='$ssizetype'
15172startperl='$startperl'
15173startsh='$startsh'
15174static_ext='$static_ext'
15175stdchar='$stdchar'
15176stdio_base='$stdio_base'
15177stdio_bufsiz='$stdio_bufsiz'
15178stdio_cnt='$stdio_cnt'
15179stdio_filbuf='$stdio_filbuf'
15180stdio_ptr='$stdio_ptr'
767df6a1 15181stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
15182strings='$strings'
15183submit='$submit'
15184subversion='$subversion'
15185sysman='$sysman'
15186tail='$tail'
15187tar='$tar'
15188tbl='$tbl'
15189tee='$tee'
15190test='$test'
15191timeincl='$timeincl'
15192timetype='$timetype'
15193touch='$touch'
15194tr='$tr'
15195trnl='$trnl'
15196troff='$troff'
8175356b
JH
15197u16size='$u16size'
15198u16type='$u16type'
15199u32size='$u32size'
15200u32type='$u32type'
15201u64size='$u64size'
15202u64type='$u64type'
15203u8size='$u8size'
15204u8type='$u8type'
a22e52b9 15205uidformat='$uidformat'
57def98f 15206uidsign='$uidsign'
785fb66b 15207uidsize='$uidsize'
5f80c64f
JH
15208uidtype='$uidtype'
15209uname='$uname'
15210uniq='$uniq'
d7d93a81 15211uquadtype='$uquadtype'
aaacdc8b 15212use5005threads='$use5005threads'
5f80c64f
JH
15213use64bits='$use64bits'
15214usedl='$usedl'
aaacdc8b 15215useithreads='$useithreads'
249b38c6 15216uselargefiles='$uselargefiles'
b0ce926a 15217uselongdouble='$uselongdouble'
09458382 15218usemorebits='$usemorebits'
5f80c64f
JH
15219usemultiplicity='$usemultiplicity'
15220usemymalloc='$usemymalloc'
15221usenm='$usenm'
15222useopcode='$useopcode'
15223useperlio='$useperlio'
15224useposix='$useposix'
15225usesfio='$usesfio'
15226useshrplib='$useshrplib'
29209bc5 15227usesocks='$usesocks'
5f80c64f 15228usethreads='$usethreads'
a3635516 15229usevendorprefix='$usevendorprefix'
5f80c64f
JH
15230usevfork='$usevfork'
15231usrinc='$usrinc'
15232uuname='$uuname'
8175356b
JH
15233uvoformat='$uvoformat'
15234uvsize='$uvsize'
15235uvtype='$uvtype'
15236uvuformat='$uvuformat'
15237uvxformat='$uvxformat'
717c4fcc
JH
15238vendorbin='$vendorbin'
15239vendorbinexp='$vendorbinexp'
a3635516
JH
15240vendorlib='$vendorlib'
15241vendorlibexp='$vendorlibexp'
15242vendorprefix='$vendorprefix'
15243vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
15244version='$version'
15245vi='$vi'
15246voidflags='$voidflags'
15247xlibpth='$xlibpth'
fe749a9f 15248xs_apiversion='$xs_apiversion'
5f80c64f
JH
15249zcat='$zcat'
15250zip='$zip'
15251EOT
15252
15253: Add in command line options if available
15254$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15255
15256: add special variables
15257$test -f $src/patchlevel.h && \
d00b958f 15258awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 15259echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
15260
15261: propagate old symbols
15262if $test -f UU/config.sh; then
15263 <UU/config.sh sort | uniq >UU/oldconfig.sh
15264 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15265 sort | uniq -u >UU/oldsyms
15266 set X `cat UU/oldsyms`
15267 shift
15268 case $# in
15269 0) ;;
15270 *)
15271 cat <<EOM
15272Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15273EOM
15274 echo "# Variables propagated from previous config.sh file." >>config.sh
15275 for sym in `cat UU/oldsyms`; do
15276 echo " Propagating $hint variable "'$'"$sym..."
15277 eval 'tmp="$'"${sym}"'"'
15278 echo "$tmp" | \
15279 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15280 done
15281 ;;
15282 esac
15283fi
15284
15285: Finish up by extracting the .SH files
15286case "$alldone" in
15287exit)
15288 $rm -rf UU
15289 echo "Done."
15290 exit 0
15291 ;;
15292cont)
15293 ;;
15294'')
15295 dflt=''
15296 nostick=true
15297 $cat <<EOM
15298
15299If you'd like to make any changes to the config.sh file before I begin
15300to configure things, do it as a shell escape now (e.g. !vi config.sh).
15301
15302EOM
15303 rp="Press return or use a shell escape to edit config.sh:"
15304 . UU/myread
15305 nostick=''
15306 case "$ans" in
15307 '') ;;
15308 *) : in case they cannot read
15309 sh 1>&4 -c "$ans";;
15310 esac
15311 ;;
15312esac
15313
15314: if this fails, just run all the .SH files by hand
15315. ./config.sh
15316
15317echo " "
15318exec 1>&4
15319. ./UU/extract
15320
15321if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15322 dflt=y
15323 case "$silent" in
15324 true) ;;
15325 *)
15326 $cat <<EOM
15327
15328Now you need to generate make dependencies by running "$make depend".
15329You might prefer to run it in background: "$make depend > makedepend.out &"
15330It can take a while, so you might not want to run it right now.
15331
15332EOM
15333 ;;
15334 esac
15335 rp="Run $make depend now?"
15336 . UU/myread
15337 case "$ans" in
15338 y*)
15339 $make depend && echo "Now you must run a $make."
15340 ;;
15341 *)
15342 echo "You must run '$make depend' then '$make'."
15343 ;;
15344 esac
15345elif test -f [Mm]akefile; then
15346 echo " "
15347 echo "Now you must run a $make."
15348else
15349 echo "Done."
15350fi
15351
15352if $test -f Policy.sh; then
15353 $cat <<EOM
15354
15355If you compile $package on a different machine or from a different object
15356directory, copy the Policy.sh file from this object directory to the
15357new one before you run Configure -- this will help you with most of
15358the policy defaults.
15359
15360EOM
15361fi
15362if $test -f config.msg; then
15363 echo "Hmm. I also noted the following information while running:"
15364 echo " "
15365 $cat config.msg >&4
15366 $rm -f config.msg
15367fi
15368$rm -f kit*isdone ark*isdone
15369$rm -rf UU
15370
15371: End of Configure
15372