This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add missing flag in change#4892
[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#
c71a9cee 23# Generated on Tue Jan 25 16:35:03 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=''
5ff3f7a4 365d_getgrent=''
2304df62 366d_getgrps=''
4599a1de 367d_gethbyaddr=''
4599a1de 368d_gethbyname=''
dfe9444c 369d_gethent=''
2304df62
AD
370aphostname=''
371d_gethname=''
372d_phostname=''
373d_uname=''
dc45a647 374d_gethostprotos=''
a0d0e21e 375d_getlogin=''
ad27e871 376d_getmnt=''
ccc7f9b3 377d_getmntent=''
dfe9444c 378d_getnbyaddr=''
693762b4 379d_getnbyname=''
e5c9fcd0 380d_getnent=''
dc45a647 381d_getnetprotos=''
e5c9fcd0 382d_getpent=''
2afac517 383d_getpgid=''
2304df62 384d_getpgrp2=''
2afac517 385d_bsdgetpgrp=''
2304df62 386d_getpgrp=''
a0d0e21e 387d_getppid=''
2304df62 388d_getprior=''
693762b4
AD
389d_getpbyname=''
390d_getpbynumber=''
dc45a647 391d_getprotoprotos=''
5ff3f7a4 392d_getpwent=''
e5c9fcd0 393d_getsent=''
dc45a647 394d_getservprotos=''
f1066039
JH
395d_getspent=''
396d_getspnam=''
693762b4
AD
397d_getsbyname=''
398d_getsbyport=''
a4f3eea9 399d_gnulibc=''
ccc7f9b3 400d_hasmntopt=''
2304df62 401d_htonl=''
7e1af8bc 402d_inetaton=''
6b8eaf93 403d_int64t=''
2304df62
AD
404d_isascii=''
405d_killpg=''
dd64f1c3 406d_lchown=''
2d4389e4 407d_ldbl_dig=''
2304df62 408d_link=''
a0d0e21e
LW
409d_locconv=''
410d_lockf=''
e5c9fcd0
AD
411d_longdbl=''
412longdblsize=''
dc45a647
MB
413d_longlong=''
414longlongsize=''
2304df62 415d_lstat=''
a0d0e21e
LW
416d_mblen=''
417d_mbstowcs=''
418d_mbtowc=''
0f27ced1 419d_memchr=''
2304df62
AD
420d_memcmp=''
421d_memcpy=''
422d_memmove=''
423d_memset=''
424d_mkdir=''
a0d0e21e
LW
425d_mkfifo=''
426d_mktime=''
2304df62
AD
427d_msg=''
428d_msgctl=''
429d_msgget=''
430d_msgrcv=''
431d_msgsnd=''
a0d0e21e 432d_nice=''
2304df62 433d_open3=''
a0d0e21e
LW
434d_fpathconf=''
435d_pathconf=''
436d_pause=''
437d_pipe=''
8e07c86e 438d_poll=''
2304df62 439d_portable=''
ef4af2be
JH
440d_old_pthread_create_joinable=''
441old_pthread_create_joinable=''
dfe9444c
AD
442d_pthread_yield=''
443d_sched_yield=''
1cfa4ec7 444sched_yield=''
2304df62 445d_readdir=''
85e6fe83
LW
446d_rewinddir=''
447d_seekdir=''
448d_telldir=''
a0d0e21e 449d_readlink=''
2304df62
AD
450d_rename=''
451d_rmdir=''
452d_safebcpy=''
453d_safemcpy=''
36477c24 454d_sanemcmp=''
2304df62
AD
455d_select=''
456d_sem=''
457d_semctl=''
458d_semget=''
459d_semop=''
460d_setegid=''
461d_seteuid=''
5ff3f7a4 462d_setgrent=''
dfe9444c 463d_setgrps=''
693762b4 464d_sethent=''
a0d0e21e 465d_setlinebuf=''
2304df62 466d_setlocale=''
e5c9fcd0
AD
467d_setnent=''
468d_setpent=''
2304df62
AD
469d_setpgid=''
470d_setpgrp2=''
2afac517 471d_bsdsetpgrp=''
2304df62
AD
472d_setpgrp=''
473d_setprior=''
5ff3f7a4 474d_setpwent=''
2304df62
AD
475d_setregid=''
476d_setresgid=''
477d_setresuid=''
478d_setreuid=''
479d_setrgid=''
480d_setruid=''
e5c9fcd0 481d_setsent=''
2304df62 482d_setsid=''
f1066039 483d_setspent=''
e5c9fcd0 484d_setvbuf=''
760ac839 485d_sfio=''
8ff267be 486usesfio=''
2304df62
AD
487d_shm=''
488d_shmat=''
a0d0e21e
LW
489d_shmatprototype=''
490shmattype=''
2304df62
AD
491d_shmctl=''
492d_shmdt=''
493d_shmget=''
2c7991dc 494d_sigaction=''
8ff267be 495d_sigsetjmp=''
de4597cb
JH
496d_msg_ctrunc=''
497d_msg_dontroute=''
498d_msg_oob=''
499d_msg_peek=''
500d_msg_proxy=''
2304df62 501d_oldsock=''
de4597cb 502d_scm_rights=''
2304df62
AD
503d_socket=''
504d_sockpair=''
505sockethdr=''
506socketlib=''
68d4903c 507d_sqrtl=''
2304df62 508d_statblks=''
0545a864
JH
509d_statfs_f_flags=''
510d_statfs_s=''
104d25b7
JH
511d_fstatvfs=''
512d_statvfs=''
c2960299
AD
513d_stdio_cnt_lval=''
514d_stdio_ptr_lval=''
16d20bd9 515d_stdiobase=''
2304df62 516d_stdstdio=''
16d20bd9
AD
517stdio_base=''
518stdio_bufsiz=''
519stdio_cnt=''
dfe9444c 520stdio_filbuf=''
16d20bd9 521stdio_ptr=''
2304df62
AD
522d_index=''
523d_strchr=''
a0d0e21e 524d_strcoll=''
2304df62
AD
525d_strctcpy=''
526d_strerrm=''
527d_strerror=''
528d_sysernlst=''
529d_syserrlst=''
a89d8a78
DH
530d_strtod=''
531d_strtol=''
ff935051 532d_strtold=''
76d49b1c 533d_strtoll=''
a89d8a78 534d_strtoul=''
ff935051
JH
535d_strtoull=''
536d_strtouq=''
a0d0e21e 537d_strxfrm=''
2304df62
AD
538d_symlink=''
539d_syscall=''
a0d0e21e 540d_sysconf=''
2304df62 541d_system=''
a0d0e21e
LW
542d_tcgetpgrp=''
543d_tcsetpgrp=''
cb86ce0e 544d_telldirproto=''
85e6fe83
LW
545d_time=''
546timetype=''
2304df62
AD
547clocktype=''
548d_times=''
549d_truncate=''
a0d0e21e
LW
550d_tzname=''
551d_umask=''
bd89102f
AD
552d_semctl_semid_ds=''
553d_semctl_semun=''
554d_union_semun=''
0545a864 555d_ustat=''
2304df62 556d_vfork=''
a0d0e21e 557usevfork=''
2304df62
AD
558d_voidsig=''
559signal_t=''
560d_volatile=''
561d_charvspr=''
562d_vprintf=''
563d_wait4=''
564d_waitpid=''
a0d0e21e
LW
565d_wcstombs=''
566d_wctomb=''
567dlext=''
85e6fe83
LW
568cccdlflags=''
569ccdlflags=''
2304df62 570dlsrc=''
232e078e 571ld=''
85e6fe83 572lddlflags=''
2304df62 573usedl=''
693762b4 574doublesize=''
5ff3f7a4 575ebcdic=''
66fe083f 576fflushNULL=''
767df6a1 577fflushall=''
8175356b 578fpossize=''
a0d0e21e 579fpostype=''
a22e52b9 580gidformat=''
785fb66b
JH
581gidsign=''
582gidsize=''
2304df62
AD
583gidtype=''
584groupstype=''
585h_fcntl=''
586h_sysfile=''
5ff3f7a4 587i_arpainet=''
ecfc5424
AD
588db_hashtype=''
589db_prefixtype=''
a0d0e21e 590i_db=''
2304df62 591i_dbm=''
8e07c86e 592i_rpcsvcdbm=''
2304df62 593d_dirnamlen=''
a0d0e21e 594direntrytype=''
2304df62 595i_dirent=''
a0d0e21e 596i_dld=''
2304df62
AD
597i_dlfcn=''
598i_fcntl=''
a0d0e21e 599i_float=''
2304df62 600i_gdbm=''
28e8609d 601d_grpasswd=''
2304df62 602i_grp=''
5ff3f7a4 603i_inttypes=''
a0d0e21e 604i_limits=''
4633a7c4 605i_locale=''
7f3d1cf1 606i_machcthr=''
a0d0e21e
LW
607i_malloc=''
608i_math=''
85e6fe83 609i_memory=''
e7fb4fcc 610i_mntent=''
2304df62 611i_ndbm=''
3fd537d4 612i_netdb=''
85e6fe83 613i_neterrno=''
9cc6feab 614i_netinettcp=''
2304df62
AD
615i_niin=''
616i_sysin=''
5b34fd99 617i_poll=''
c4747d3e 618i_pthread=''
2304df62
AD
619d_pwage=''
620d_pwchange=''
621d_pwclass=''
622d_pwcomment=''
623d_pwexpire=''
c4f23d77 624d_pwgecos=''
28e8609d 625d_pwpasswd=''
2304df62
AD
626d_pwquota=''
627i_pwd=''
760ac839 628i_sfio=''
f1066039 629i_shadow=''
86959918 630i_socks=''
2304df62 631i_stddef=''
a0d0e21e 632i_stdlib=''
2304df62
AD
633i_string=''
634strings=''
5ff3f7a4 635i_sysaccess=''
2304df62
AD
636i_sysdir=''
637i_sysfile=''
638d_voidtty=''
639i_bsdioctl=''
a0d0e21e 640i_sysfilio=''
2304df62
AD
641i_sysioctl=''
642i_syssockio=''
104d25b7 643i_sysmount=''
2304df62 644i_sysndir=''
a0d0e21e 645i_sysparam=''
8ff267be 646i_sysresrc=''
5ff3f7a4 647i_syssecrt=''
2304df62 648i_sysselct=''
1aef975c 649i_sysstat=''
0545a864 650i_sysstatfs=''
104d25b7 651i_sysstatvfs=''
a0d0e21e 652i_systimes=''
fed7345c 653i_systypes=''
de4597cb 654i_sysuio=''
25f94b33 655i_sysun=''
0545a864 656i_sysvfs=''
8ff267be 657i_syswait=''
2304df62
AD
658i_sgtty=''
659i_termio=''
660i_termios=''
661i_systime=''
662i_systimek=''
663i_time=''
664timeincl=''
85e6fe83 665i_unistd=''
0545a864 666i_ustat=''
2304df62 667i_utime=''
760ac839 668i_values=''
a0d0e21e 669i_stdarg=''
2304df62
AD
670i_varargs=''
671i_varhdr=''
672i_vfork=''
ff935051 673inc_version_list=''
3a096bf3 674inc_version_list_init=''
dd4e71fd
JH
675installprefix=''
676installprefixexp=''
677installstyle=''
104d25b7 678installusrbinperl=''
2304df62 679intsize=''
24fef2a7
AD
680longsize=''
681shortsize=''
d9b3e12d 682d_fpos64_t=''
2000072c 683d_off64_t=''
2304df62 684libc=''
5cf1d1f1 685ldlibpthname=''
8ff267be 686libperl=''
2afac517 687shrpenv=''
8ff267be 688useshrplib=''
a0d0e21e 689glibpth=''
2304df62 690libpth=''
8e07c86e 691loclibpth=''
2304df62
AD
692plibpth=''
693xlibpth=''
1cfa4ec7 694ignore_versioned_solibs=''
2304df62 695libs=''
85e6fe83 696lns=''
cf2093f6
JH
697d_PRIEldbl=''
698d_PRIFldbl=''
699d_PRIGldbl=''
700d_PRIeldbl=''
701d_PRIfldbl=''
702d_PRIgldbl=''
703sPRIEldbl=''
704sPRIFldbl=''
705sPRIGldbl=''
706sPRIeldbl=''
707sPRIfldbl=''
708sPRIgldbl=''
5ff3f7a4 709lseeksize=''
85e6fe83 710lseektype=''
8ff267be 711make_set_make=''
85e6fe83 712d_mymalloc=''
94b6baf5 713freetype=''
2304df62
AD
714mallocobj=''
715mallocsrc=''
716malloctype=''
717usemymalloc=''
16d20bd9
AD
718installman1dir=''
719man1dir=''
720man1direxp=''
721man1ext=''
722installman3dir=''
723man3dir=''
724man3direxp=''
725man3ext=''
2304df62
AD
726huge=''
727large=''
728medium=''
729models=''
730small=''
731split=''
a0d0e21e 732modetype=''
68c15b6f 733multiarch=''
2304df62
AD
734mydomain=''
735myhostname=''
736phostname=''
737c=''
738n=''
8e07c86e
AD
739d_eofnblk=''
740eagain=''
741o_nonblock=''
742rd_nodata=''
dfe9444c
AD
743netdb_hlen_type=''
744netdb_host_type=''
745netdb_name_type=''
746netdb_net_type=''
2304df62
AD
747groupcat=''
748hostcat=''
749passcat=''
85e6fe83
LW
750orderlib=''
751ranlib=''
2304df62
AD
752package=''
753spackage=''
2c7991dc 754pager=''
ff935051
JH
755api_revision=''
756api_subversion=''
757api_version=''
758api_versionstring=''
ecfc5424 759patchlevel=''
760ac839 760subversion=''
bfb7748a 761version=''
8e07c86e 762perladmin=''
4633a7c4 763perlpath=''
cce08f5b 764d_nvpresuv=''
8175356b
JH
765i16size=''
766i16type=''
767i32size=''
768i32type=''
769i64size=''
770i64type=''
771i8size=''
772i8type=''
773ivsize=''
774ivtype=''
775nvsize=''
776nvtype=''
777u16size=''
778u16type=''
779u32size=''
780u32type=''
781u64size=''
782u64type=''
783u8size=''
784u8type=''
785uvsize=''
786uvtype=''
787ivdformat=''
788uvoformat=''
789uvuformat=''
790uvxformat=''
dfe9444c 791pidtype=''
a0d0e21e 792prefix=''
1aef975c 793prefixexp=''
2304df62
AD
794installprivlib=''
795privlib=''
796privlibexp=''
797prototype=''
693762b4 798ptrsize=''
cf2093f6
JH
799d_PRIX64=''
800d_PRId64=''
801d_PRIi64=''
802d_PRIo64=''
803d_PRIu64=''
804d_PRIx64=''
805sPRIX64=''
806sPRId64=''
807sPRIi64=''
808sPRIo64=''
809sPRIu64=''
810sPRIx64=''
de1c2614 811d_quad=''
6b8eaf93 812quadkind=''
d7d93a81
JH
813quadtype=''
814uquadtype=''
85ab1d1d 815drand01=''
2304df62 816randbits=''
85ab1d1d
JH
817randfunc=''
818randseedtype=''
819seedfunc=''
2304df62
AD
820installscript=''
821scriptdir=''
822scriptdirexp=''
5ff3f7a4 823selectminbits=''
a0d0e21e 824selecttype=''
8ff267be 825sh=''
af4c28eb 826sig_count=''
2304df62 827sig_name=''
dfe9444c 828sig_name_init=''
8e07c86e 829sig_num=''
824a2ba3 830sig_num_init=''
4633a7c4
LW
831installsitearch=''
832sitearch=''
833sitearchexp=''
717c4fcc
JH
834installsitebin=''
835sitebin=''
836sitebinexp=''
25f94b33
AD
837installsitelib=''
838sitelib=''
839sitelibexp=''
dd4e71fd
JH
840siteprefix=''
841siteprefixexp=''
a0d0e21e
LW
842sizetype=''
843so=''
2304df62
AD
844sharpbang=''
845shsharp=''
846spitshell=''
dfe9444c 847src=''
a0d0e21e 848ssizetype=''
4633a7c4 849startperl=''
2304df62
AD
850startsh=''
851stdchar=''
ed39a0f2 852d_stdio_stream_array=''
767df6a1 853stdio_stream_array=''
2304df62 854sysman=''
5ff3f7a4 855trnl=''
a22e52b9 856uidformat=''
57def98f 857uidsign=''
785fb66b 858uidsize=''
2304df62 859uidtype=''
85ab1d1d 860archname64=''
5ff3f7a4 861use64bits=''
249b38c6 862uselargefiles=''
b0ce926a 863uselongdouble=''
d7d93a81 864uselonglong=''
09458382 865usemorebits=''
85ab1d1d 866usemultiplicity=''
2304df62 867nm_opt=''
40a7a20a 868nm_so_opt=''
2304df62
AD
869runnm=''
870usenm=''
8ff267be 871useperlio=''
29209bc5 872usesocks=''
693762b4 873d_oldpthreads=''
aaacdc8b
GS
874use5005threads=''
875useithreads=''
dfe9444c 876usethreads=''
2304df62 877incpath=''
2304df62
AD
878mips_type=''
879usrinc=''
717c4fcc
JH
880d_vendorbin=''
881installvendorbin=''
882vendorbin=''
883vendorbinexp=''
a3635516
JH
884d_vendorlib=''
885installvendorlib=''
886vendorlib=''
887vendorlibexp=''
888usevendorprefix=''
889vendorprefix=''
890vendorprefixexp=''
2304df62
AD
891defvoidused=''
892voidflags=''
2304df62
AD
893CONFIG=''
894
ecfc5424
AD
895define='define'
896undef='undef'
897smallmach='pdp11 i8086 z8000 i80286 iAPX286'
898rmlist=''
899
900: We must find out about Eunice early
901eunicefix=':'
902if test -f /etc/unixtovms; then
903 eunicefix=/etc/unixtovms
904fi
905if test -f /etc/unixtovms.exe; then
906 eunicefix=/etc/unixtovms.exe
907fi
908
5ff3f7a4 909i_whoami=''
ecfc5424
AD
910: list of known cpp symbols, sorted alphabetically
911al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
912al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
913al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
914al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
915al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
916al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
0337d152 917al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
ecfc5424
AD
918al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
919al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
920al="$al VMS Xenix286"
5ff3f7a4
GS
921al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
922al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
ecfc5424
AD
923al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
924al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
925al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
926al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
927al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
928al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
929al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
930al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
931al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
932al="$al __SVR4_2__ __UMAXV__"
933al="$al ____386BSD____ __alpha __alpha__ __amiga"
934al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
935al="$al __host_mips__"
936al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
937al="$al __hp9000s500 __hp9000s700 __hp9000s800"
938al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
939al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
940al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
941al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
942al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
943al="$al __mc88100 __mc88100__ __mips __mips__"
944al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
945al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
946al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
947al="$al _host_mips _mips _unix"
948al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
949al="$al apollo ardent att386 att3b"
950al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
951al="$al cadmus clipper concurrent convex cray ctix"
952al="$al dmert encore gcos gcx gimpel gould"
953al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
954al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
955al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
956al="$al i186 i286 i386 i486 i8086"
957al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
958al="$al ksr1 linux luna luna88k m68k m88100 m88k"
959al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
960al="$al mc68040 mc68060 mc68k mc68k32 mc700"
961al="$al mc88000 mc88100 merlin mert mips mvs n16"
962al="$al ncl_el ncl_mr"
963al="$al news1500 news1700 news1800 news1900 news3700"
964al="$al news700 news800 news900 ns16000 ns32000"
965al="$al ns32016 ns32332 ns32k nsc32000 os osf"
966al="$al parisc pc532 pdp11 plexus posix pyr"
967al="$al riscix riscos scs sequent sgi sinix sony sony_news"
968al="$al sonyrisc sparc sparclite spectrum stardent stratos"
969al="$al sun sun3 sun386 svr4 sysV68 sysV88"
970al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
971al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
972al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
973al="$al xenix z8000"
974
ff935051
JH
975: set useposix=false in your hint file to disable the POSIX extension.
976useposix=true
977: set useopcode=false in your hint file to disable the Opcode extension.
978useopcode=true
dfe9444c 979: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 980_exe=''
dfe9444c
AD
981: Extra object files, if any, needed on this platform.
982archobjs=''
ff935051
JH
983: Possible local include directories to search.
984: Set locincpth to "" in a hint file to defeat local include searches.
985locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
986locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
987:
988: no include file wanted by default
989inclwanted=''
990
dfe9444c 991groupstype=''
732c9516
JH
992: change the next line if compiling for Xenix/286 on Xenix/386
993xlibpth='/usr/lib/386 /lib/386'
994
995: Possible local library directories to search.
996loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
997loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
998
999: general looking path for locating libraries
1000glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
1001glibpth="$glibpth /lib /usr/lib $xlibpth"
1002glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1003glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1004
1005: Private path used by Configure to find libraries. Its value
1006: is prepended to libpth. This variable takes care of special
1007: machines, like the mips. Usually, it should be empty.
1008plibpth=''
1009
1cfa4ec7
GS
1010: default library list
1011libswanted=''
921b2963 1012: some systems want to use only the non-versioned libso:s
1cfa4ec7 1013ignore_versioned_solibs=''
85ab1d1d 1014: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1015: set usesocks on the Configure command line to enable socks.
dfe9444c 1016: set usethreads on the Configure command line to enable threads.
ff935051
JH
1017: full support for void wanted by default
1018defvoidused=15
1019
ecfc5424 1020: List of libraries we want.
693762b4
AD
1021: If anyone needs -lnet, put it in a hint file.
1022libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 1023libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 1024libswanted="$libswanted ndir dir crypt sec"
ecfc5424 1025libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 1026: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1027: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1028glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1029glibpth="/usr/shlib $glibpth"
1030: Do not use vfork unless overridden by a hint file.
1031usevfork=false
1032
8ff267be 1033: Find the basic shell for Bourne shell scripts
1034case "$sh" in
1035'')
8ff267be 1036 case "$SYSTYPE" in
1037 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1038 *) xxx='/bin/sh';;
1039 esac
1040 if test -f "$xxx"; then
1041 sh="$xxx"
1042 else
1043 : Build up a list and do a single loop so we can 'break' out.
1044 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1045 for xxx in sh bash ksh pdksh ash; do
1046 for p in $pth; do
1047 try="$try ${p}/${xxx}"
1048 done
1049 done
1050 for xxx in $try; do
1051 if test -f "$xxx"; then
1052 sh="$xxx";
8ff267be 1053 break
1054 elif test -f "$xxx.exe"; then
1055 sh="$xxx";
8ff267be 1056 break
1057 fi
1058 done
1059 fi
1060 ;;
1061esac
1062
1063case "$sh" in
1064'') cat <<EOM >&2
1065$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1066
8ff267be 1067Usually it's in /bin/sh. How did you even get this far?
46193409 1068Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 1069we'll try to straighten this all out.
8ff267be 1070EOM
1071 exit 1
1072 ;;
1073esac
1074
760ac839 1075: see if sh knows # comments
8ff267be 1076if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1077 shsharp=true
1078 spitshell=cat
760ac839
LW
1079 xcat=/bin/cat
1080 test -f $xcat || xcat=/usr/bin/cat
1081 echo "#!$xcat" >try
1082 $eunicefix try
1083 chmod +x try
1084 ./try > today
1085 if test -s today; then
760ac839
LW
1086 sharpbang='#!'
1087 else
1088 echo "#! $xcat" > try
1089 $eunicefix try
1090 chmod +x try
1091 ./try > today
1092 if test -s today; then
760ac839
LW
1093 sharpbang='#! '
1094 else
760ac839
LW
1095 sharpbang=': use '
1096 fi
1097 fi
1098else
dfe9444c 1099 echo " "
8ff267be 1100 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1101 shsharp=false
1102 cd ..
1103 echo "exec grep -v '^[ ]*#'" >spitshell
1104 chmod +x spitshell
1105 $eunicefix spitshell
1106 spitshell=`pwd`/spitshell
1107 cd UU
1108 echo "I presume that if # doesn't work, #! won't work either!"
1109 sharpbang=': use '
1110fi
1111rm -f try today
1112
1113: figure out how to guarantee sh startup
8ff267be 1114case "$startsh" in
1115'') startsh=${sharpbang}${sh} ;;
1116*)
760ac839 1117esac
760ac839
LW
1118cat >try <<EOSS
1119$startsh
1120set abc
1121test "$?abc" != 1
1122EOSS
1123
1124chmod +x try
1125$eunicefix try
1126if ./try; then
8ff267be 1127 : echo "Yup, it does."
760ac839 1128else
dfe9444c
AD
1129 echo "Hmm... '$startsh' does not guarantee sh startup..."
1130 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1131fi
1132rm -f try
1133
aebf16e7
AD
1134
1135: Save command line options in file UU/cmdline.opt for later use in
1136: generating config.sh.
1137cat > cmdline.opt <<EOSH
1138# Configure command line arguments.
1139config_arg0='$0'
1140config_args='$*'
1141config_argc=$#
1142EOSH
1143argn=1
1144for arg in "$@"; do
1145 cat >>cmdline.opt <<EOSH
1146config_arg$argn='$arg'
1147EOSH
1148 argn=`expr $argn + 1`
1149done
1150
2304df62
AD
1151: produce awk script to parse command line options
1152cat >options.awk <<'EOF'
1153BEGIN {
02e93a22 1154 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1155
1156 len = length(optstr);
1157 for (i = 1; i <= len; i++) {
1158 c = substr(optstr, i, 1);
1159 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1160 if (a == ":") {
1161 arg[c] = 1;
1162 i++;
1163 }
1164 opt[c] = 1;
1165 }
1166}
1167{
1168 expect = 0;
1169 str = $0;
1170 if (substr(str, 1, 1) != "-") {
1171 printf("'%s'\n", str);
1172 next;
1173 }
1174 len = length($0);
1175 for (i = 2; i <= len; i++) {
1176 c = substr(str, i, 1);
1177 if (!opt[c]) {
1178 printf("-%s\n", substr(str, i));
1179 next;
1180 }
1181 printf("-%s\n", c);
1182 if (arg[c]) {
1183 if (i < len)
1184 printf("'%s'\n", substr(str, i + 1));
1185 else
1186 expect = 1;
1187 next;
1188 }
1189 }
1190}
1191END {
1192 if (expect)
1193 print "?";
1194}
1195EOF
1196
1197: process the command line options
4633a7c4
LW
1198set X `for arg in "$@"; do echo "X$arg"; done |
1199 sed -e s/X// | awk -f options.awk`
2304df62
AD
1200eval "set $*"
1201shift
1202rm -f options.awk
1203
1204: set up default values
1205fastread=''
1206reuseval=false
1207config_sh=''
1208alldone=''
1209error=''
1210silent=''
1211extractsh=''
ecfc5424 1212override=''
16d20bd9 1213knowitall=''
02e93a22 1214rm -f optdef.sh posthint.sh
28757baa 1215cat >optdef.sh <<EOS
1216$startsh
1217EOS
2304df62 1218
dfe9444c 1219
2304df62
AD
1220: option parsing
1221while test $# -gt 0; do
1222 case "$1" in
1223 -d) shift; fastread=yes;;
1224 -e) shift; alldone=cont;;
1225 -f)
1226 shift
1227 cd ..
1228 if test -r "$1"; then
1229 config_sh="$1"
1230 else
a0d0e21e 1231 echo "$me: cannot read config file $1." >&2
2304df62
AD
1232 error=true
1233 fi
1234 cd UU
1235 shift;;
1236 -h) shift; error=true;;
1237 -r) shift; reuseval=true;;
dfe9444c 1238 -s) shift; silent=true; realsilent=true;;
2304df62 1239 -E) shift; alldone=exit;;
16d20bd9 1240 -K) shift; knowitall=true;;
ecfc5424 1241 -O) shift; override=true;;
dfe9444c 1242 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1243 -D)
1244 shift
1245 case "$1" in
1246 *=)
1247 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1248 echo "$me: ignoring -D $1" >&2
1249 ;;
ecfc5424 1250 *=*) echo "$1" | \
1aef975c
AD
1251 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1252 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1253 esac
1254 shift
1255 ;;
1256 -U)
1257 shift
1258 case "$1" in
1aef975c 1259 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1260 *=*)
1261 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1262 echo "$me: ignoring -U $1" >&2
1263 ;;
1aef975c 1264 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1265 esac
1266 shift
1267 ;;
02e93a22
JH
1268 -A)
1269 shift
1270 xxx=''
1271 yyy="$1"
02e93a22 1272 zzz=''
5f83a3e9 1273 uuu=undef
02e93a22 1274 case "$yyy" in
5f83a3e9
JH
1275 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1276 case "$zzz" in
1277 *:*) zzz='' ;;
1278 *) xxx=append
1279 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1280 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1281 esac
1282 ;;
1283 esac
1284 case "$xxx" in
1285 '') case "$yyy" in
1286 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1287 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1288 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1289 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1290 *) xxx=`echo $yyy|sed 's!:.*!!'`
1291 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1292 esac
1293 ;;
1294 esac
02e93a22
JH
1295 case "$xxx" in
1296 append)
5f83a3e9 1297 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1298 clear)
5f83a3e9 1299 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1300 define)
1301 case "$zzz" in
1302 '') zzz=define ;;
1303 esac
5f83a3e9 1304 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1305 eval)
5f83a3e9 1306 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1307 prepend)
5f83a3e9 1308 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1309 undef)
1310 case "$zzz" in
1311 '') zzz="$uuu" ;;
1312 esac
5f83a3e9
JH
1313 echo "$yyy=$zzz" >> posthint.sh ;;
1314 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22
JH
1315 esac
1316 ;;
dfe9444c 1317 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1318 exit 0;;
2304df62 1319 --) break;;
a0d0e21e 1320 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1321 *) break;;
1322 esac
1323done
1324
1325case "$error" in
1326true)
1327 cat >&2 <<EOM
2afac517 1328Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1329 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1330 -d : use defaults for all answers.
1331 -e : go on without questioning past the production of config.sh.
1332 -f : specify an alternate default configuration file.
1333 -h : print this help message and exit (with an error status).
1334 -r : reuse C symbols value if possible (skips costly nm extraction).
1335 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1336 -D : define symbol to have some value:
1337 -D symbol symbol gets the value 'define'
1338 -D symbol=value symbol gets the value 'value'
2304df62 1339 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1340 -K : do not use unless you know what you are doing.
ecfc5424 1341 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1342 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1343 -U : undefine symbol:
1344 -U symbol symbol gets the value 'undef'
1345 -U symbol= symbol gets completely empty
02e93a22 1346 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1347 -A symbol=value append " "value to symbol
02e93a22
JH
1348 -A append:symbol=value append value to symbol
1349 -A define:symbol=value define symbol to have value
02e93a22
JH
1350 -A clear:symbol define symbol to be ''
1351 -A define:symbol define symbol to be 'define'
1352 -A eval:symbol=value define symbol to be eval of value
1353 -A prepend:symbol=value prepend value to symbol
1354 -A undef:symbol define symbol to be 'undef'
1355 -A undef:symbol= define symbol to be ''
2304df62
AD
1356 -V : print version number and exit (with a zero status).
1357EOM
1358 exit 1
1359 ;;
1360esac
1361
dfe9444c
AD
1362: Sanity checks
1363case "$fastread$alldone" in
1364yescont|yesexit) ;;
1365*)
1366 if test ! -t 0; then
1367 echo "Say 'sh Configure', not 'sh <Configure'"
1368 exit 1
1369 fi
1370 ;;
1371esac
1372
2304df62
AD
1373exec 4>&1
1374case "$silent" in
1375true) exec 1>/dev/null;;
1376esac
1377
ecfc5424 1378: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1379touch optdef.sh
1380. ./optdef.sh
02e93a22
JH
1381: create the posthint manipulation script and leave the file out there...
1382touch posthint.sh
a0d0e21e 1383
2304df62 1384: set package name
85e6fe83 1385package=perl5
1aef975c
AD
1386first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1387last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1388case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1389ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1390*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1391esac
2304df62 1392
2304df62
AD
1393: Some greps do not return status, grrr.
1394echo "grimblepritz" >grimble
1395if grep blurfldyick grimble >/dev/null 2>&1 ; then
1396 contains=contains
1397elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1398 contains=grep
1399else
1400 contains=contains
1401fi
1402rm -f grimble
1403: the following should work in any shell
1404case "$contains" in
1405contains*)
1406 echo " "
1407 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1408 cat >contains <<'EOSS'
1409grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1410EOSS
1411chmod +x contains
1412esac
1413
dfe9444c
AD
1414: Find the path to the source tree
1415case "$src" in
1416'') case "$0" in
b233458b
JH
1417 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1418 case "$src" in
1419 /*) ;;
1420 *) src=`cd ../$src && pwd` ;;
1421 esac
1422 ;;
dfe9444c
AD
1423 *) src='.';;
1424 esac;;
1425esac
1426case "$src" in
1427'') src=/
1428 rsrc=/
1429 ;;
1430/*) rsrc="$src";;
1431*) rsrc="../$src";;
1432esac
1433if test -f $rsrc/Configure && \
1434 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1435then
1436 : found it, so we are ok.
1437else
1438 rsrc=''
1439 for src in . .. ../.. ../../.. ../../../..; do
1440 if test -f ../$src/Configure && \
1441 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1442 then
1443 rsrc=../$src
1444 break
1445 fi
1446 done
1447fi
1448case "$rsrc" in
1449'')
1450 cat <<EOM >&4
1451
1452Sorry, I can't seem to locate the source dir for $package. Please start
1453Configure with an explicit path -- i.e. /some/path/Configure.
1454
1455EOM
1456 exit 1
1457 ;;
1458../.) rsrc='..';;
1459*)
1460 echo " "
1461 echo "Sources for $package found in \"$src\"." >&4
1462 ;;
1463esac
1464
1465: script used to extract .SH files with variable substitutions
1466cat >extract <<'EOS'
2000072c 1467CONFIGDOTSH=true
dfe9444c
AD
1468echo "Doing variable substitutions on .SH files..."
1469if test -f $src/MANIFEST; then
f7ab18e9 1470 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1471else
1472 echo "(Looking for .SH files under the source directory.)"
1473 set x `(cd $src; find . -name "*.SH" -print)`
1474fi
1475shift
1476case $# in
14770) set x `(cd $src; echo *.SH)`; shift;;
1478esac
1479if test ! -f $src/$1; then
1480 shift
1481fi
1482mkdir_p='
1483name=$1;
1484create="";
1485while test $name; do
1486 if test ! -d "$name"; then
1487 create="$name $create";
1488 name=`echo $name | sed -e "s|^[^/]*$||"`;
1489 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1490 else
1491 name="";
1492 fi;
1493done;
1494for file in $create; do
1495 mkdir $file;
1496done
1497'
1498for file in $*; do
1499 case "$src" in
1500 ".")
1501 case "$file" in
1502 */*)
1503 dir=`expr X$file : 'X\(.*\)/'`
1504 file=`expr X$file : 'X.*/\(.*\)'`
1505 (cd $dir && . ./$file)
1506 ;;
1507 *)
1508 . ./$file
1509 ;;
1510 esac
1511 ;;
1512 *)
1513 case "$file" in
1514 */*)
1515 dir=`expr X$file : 'X\(.*\)/'`
1516 file=`expr X$file : 'X.*/\(.*\)'`
1517 (set x $dir; shift; eval $mkdir_p)
1518 sh <$src/$dir/$file
1519 ;;
1520 *)
1521 sh <$src/$file
1522 ;;
1523 esac
1524 ;;
1525 esac
1526done
1527if test -f $src/config_h.SH; then
1528 if test ! -f config.h; then
1529 : oops, they left it out of MANIFEST, probably, so do it anyway.
1530 . $src/config_h.SH
1531 fi
1532fi
1533EOS
1534
1535: extract files and exit if asked to do so
1536case "$extractsh" in
1537true)
1538 case "$realsilent" in
1539 true) ;;
1540 *) exec 1>&4;;
1541 esac
1542 case "$config_sh" in
1543 '') config_sh='config.sh';;
1544 esac
1545 echo " "
1546 echo "Fetching answers from $config_sh..."
1547 cd ..
1548 . $config_sh
1549 test "$override" && . ./optdef.sh
1550 echo " "
1551 . UU/extract
1552 rm -rf UU
1553 echo "Done."
1554 exit 0
1555 ;;
1556esac
1557
1558: Eunice requires " " instead of "", can you believe it
1559echo " "
1560: Here we go...
1561echo "Beginning of configuration questions for $package."
1562
1563trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1564
2304df62
AD
1565: first determine how to suppress newline on echo command
1566echo " "
1567echo "Checking echo to see how to suppress newlines..."
1568(echo "hi there\c" ; echo " ") >.echotmp
1569if $contains c .echotmp >/dev/null 2>&1 ; then
1570 echo "...using -n."
1571 n='-n'
1572 c=''
1573else
1574 cat <<'EOM'
1575...using \c
1576EOM
1577 n=''
1578 c='\c'
1579fi
1580echo $n "The star should be here-->$c"
1581echo '*'
1582rm -f .echotmp
1583
1584: Now test for existence of everything in MANIFEST
1585echo " "
dfe9444c 1586if test -f $rsrc/MANIFEST; then
2304df62 1587 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1588 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1589 rm -f missing
dfe9444c 1590 tmppwd=`pwd`
2304df62 1591 for filelist in x??; do
dfe9444c 1592 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1593 done
1594 if test -s missing; then
1595 cat missing >&4
1596 cat >&4 <<'EOM'
1597
1598THIS PACKAGE SEEMS TO BE INCOMPLETE.
1599
1600You have the option of continuing the configuration process, despite the
1601distinct possibility that your kit is damaged, by typing 'y'es. If you
1602do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1603and contact the author (perlbug@perl.com).
2304df62
AD
1604
1605EOM
1606 echo $n "Continue? [n] $c" >&4
1607 read ans
1608 case "$ans" in
1609 y*)
1610 echo "Continuing..." >&4
1611 rm -f missing
1612 ;;
1613 *)
1614 echo "ABORTING..." >&4
1615 kill $$
1616 ;;
1617 esac
1618 else
dfe9444c 1619 echo "Looks good..."
2304df62
AD
1620 fi
1621else
1622 echo "There is no MANIFEST file. I hope your kit is complete !"
1623fi
1624rm -f missing x??
1625
5ff3f7a4
GS
1626echo " "
1627: Find the appropriate value for a newline for tr
1628if test -n "$DJGPP"; then
1629 trnl='\012'
1630fi
1631if test X"$trnl" = X; then
1632 case "`echo foo|tr '\n' x 2>/dev/null`" in
1633 foox) trnl='\n' ;;
1634 esac
1635fi
1636if test X"$trnl" = X; then
1637 case "`echo foo|tr '\012' x 2>/dev/null`" in
1638 foox) trnl='\012' ;;
1639 esac
1640fi
1641if test X"$trnl" = X; then
1642 cat <<EOM >&2
1643
1644$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1645
1646EOM
1647 exit 1
1648fi
1649
2304df62
AD
1650: compute the number of columns on the terminal for proper question formatting
1651case "$COLUMNS" in
1652'') COLUMNS='80';;
1653esac
1654
1655: set up the echo used in my read
1656myecho="case \"\$xxxm\" in
1657'') echo $n \"\$rp $c\" >&4;;
1658*) case \"\$rp\" in
1659 '') echo $n \"[\$xxxm] $c\";;
1660 *)
1661 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1662 echo \"\$rp\" >&4
1663 echo $n \"[\$xxxm] $c\" >&4
1664 else
1665 echo $n \"\$rp [\$xxxm] $c\" >&4
1666 fi
1667 ;;
1668 esac;;
1669esac"
1670
1671: now set up to do reads with possible shell escape and default assignment
1672cat <<EOSC >myread
28757baa 1673$startsh
2304df62
AD
1674xxxm=\$dflt
1675$myecho
1676ans='!'
1677case "\$fastread" in
1678yes) case "\$dflt" in
1679 '') ;;
1680 *) ans='';
1681 case "\$silent-\$rp" in
1682 true-) ;;
1683 *) echo " " >&4;;
1684 esac;;
1685 esac;;
1686*) case "\$silent" in
1687 true) case "\$rp" in
1688 '') ans='';;
1689 esac;;
1690 esac;;
1691esac
1692while expr "X\$ans" : "X!" >/dev/null; do
1693 read answ
1694 set x \$xxxm
1695 shift
dfe9444c 1696 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1697 case "\$answ" in
dfe9444c
AD
1698 "!")
1699 sh 1>&4
1700 echo " "
1701 $myecho
1702 ;;
1703 !*)
1704 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1705 shift
1706 sh 1>&4 -c "\$*"
1707 echo " "
1708 $myecho
1709 ;;
2304df62
AD
1710 "\$ans")
1711 case "\$ans" in
ecfc5424
AD
1712 \\&*)
1713 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1714 shift
1715 case "\$1" in
1716 -d)
1717 fastread=yes
40a7a20a 1718 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1719 ;;
1720 -*)
40a7a20a 1721 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1722 ;;
1723 esac
1724 $myecho
1725 ans=!
1726 ;;
2304df62
AD
1727 esac;;
1728 *)
1729 case "\$aok" in
1730 y)
1731 echo "*** Substitution done -- please confirm."
1732 xxxm="\$ans"
c9795ab7 1733 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1734 xxxm="\$ans"
1735 ans=!
1736 ;;
1737 *)
1738 echo "*** Error -- try again."
1739 ans=!
1740 ;;
1741 esac
1742 $myecho
1743 ;;
1744 esac
1745 case "\$ans\$xxxm\$nostick" in
1746 '')
1747 ans=!
1748 $myecho
1749 ;;
1750 esac
1751done
1752case "\$ans" in
1753'') ans="\$xxxm";;
1754esac
1755EOSC
1756
1757: create .config dir to save info across Configure sessions
1758test -d ../.config || mkdir ../.config
1759cat >../.config/README <<EOF
1760This directory created by Configure to save information that should
dfe9444c 1761persist across sessions for $package.
2304df62
AD
1762
1763You may safely delete it if you wish.
1764EOF
1765
1766: general instructions
1767needman=true
1768firsttime=true
760ac839 1769user=`(logname) 2>/dev/null`
dfe9444c
AD
1770case "$user" in
1771'') user=`whoami 2>&1`;;
760ac839 1772esac
2304df62
AD
1773if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1774 firsttime=false
1775 echo " "
1776 rp='Would you like to see the instructions?'
1777 dflt=n
1778 . ./myread
1779 case "$ans" in
1780 [yY]*) ;;
1781 *) needman=false;;
1782 esac
1783fi
1784if $needman; then
1785 cat <<EOH
4e2a5f63 1786
2304df62 1787This installation shell script will examine your system and ask you questions
a0d0e21e 1788to determine how the perl5 package should be installed. If you get
2304df62
AD
1789stuck on a question, you may use a ! shell escape to start a subshell or
1790execute a command. Many of the questions will have default answers in square
1791brackets; typing carriage return will give you the default.
1792
1793On some of the questions which ask for file or directory names you are allowed
1794to use the ~name construct to specify the login directory belonging to "name",
1795even if you don't have a shell which knows about that. Questions where this is
1796allowed will be marked "(~name ok)".
1797
1798EOH
1799 rp=''
1800 dflt='Type carriage return to continue'
1801 . ./myread
1802 cat <<'EOH'
1803
1804The prompter used in this script allows you to use shell variables and
1805backticks in your answers. You may use $1, $2, etc... to refer to the words
1806in the default answer, as if the default line was a set of arguments given to a
1807script shell. This means you may also use $* to repeat the whole default line,
1808so you do not have to re-type everything to add something to the default.
1809
1810Everytime there is a substitution, you will have to confirm. If there is an
1811error (e.g. an unmatched backtick), the default answer will remain unchanged
1812and you will be prompted again.
1813
1814If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1815the questions and use the computed defaults (or the previous answers if there
1816was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1817You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1818on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1819
1820EOH
1821 . ./myread
1822 cat <<EOH
1823
1824Much effort has been expended to ensure that this shell script will run on any
1825Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1826Configure and run it again. If you can't run Configure for some reason,
1827you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1828have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1829
1830This installation script affects things in two ways:
1831
18321) it may do direct variable substitutions on some of the files included
1833 in this kit.
18342) it builds a config.h file for inclusion in C programs. You may edit
1835 any of these files as the need arises after running this script.
1836
1837If you make a mistake on a question, there is no easy way to back up to it
1838currently. The easiest thing to do is to edit config.sh and rerun all the SH
1839files. Configure will offer to let you do this before it runs the SH files.
1840
1841EOH
1842 dflt='Type carriage return to continue'
1843 . ./myread
1844 case "$firsttime" in
1845 true) echo $user >>../.config/instruct;;
1846 esac
1847fi
1848
2304df62
AD
1849: find out where common programs are
1850echo " "
1851echo "Locating common programs..." >&4
1852cat <<EOSC >loc
1853$startsh
1854case \$# in
18550) exit 1;;
1856esac
1857thing=\$1
1858shift
1859dflt=\$1
1860shift
1861for dir in \$*; do
1862 case "\$thing" in
1863 .)
1864 if test -d \$dir/\$thing; then
1865 echo \$dir
1866 exit 0
1867 fi
1868 ;;
1869 *)
a0d0e21e 1870 for thisthing in \$dir/\$thing; do
ecfc5424 1871 : just loop through to pick last item
a0d0e21e 1872 done
25f94b33 1873 if test -f \$thisthing; then
a0d0e21e 1874 echo \$thisthing
2304df62
AD
1875 exit 0
1876 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1877 if test -n "$DJGPP"; then
1878 echo \$dir/\$thing.exe
1879 else
1880 : on Eunice apparently
1881 echo \$dir/\$thing
1882 fi
2304df62
AD
1883 exit 0
1884 fi
1885 ;;
1886 esac
1887done
1888echo \$dflt
1889exit 1
1890EOSC
1891chmod +x loc
1892$eunicefix loc
1893loclist="
1894awk
1895cat
ecfc5424 1896comm
2304df62
AD
1897cp
1898echo
1899expr
1900grep
a0d0e21e 1901ls
dfe9444c 1902make
2304df62 1903mkdir
2304df62
AD
1904rm
1905sed
1906sort
85e6fe83 1907touch
2304df62
AD
1908tr
1909uniq
1910"
1911trylist="
1912Mcc
dfe9444c 1913ar
2304df62
AD
1914byacc
1915cpp
1916csh
1917date
1918egrep
8ff267be 1919gzip
2c7991dc 1920less
8ff267be 1921ln
2c7991dc 1922more
693762b4 1923nm
2304df62 1924nroff
aaacdc8b 1925perl
2c7991dc 1926pg
2304df62
AD
1927test
1928uname
8ff267be 1929zip
2304df62 1930"
8e07c86e 1931pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1932pth="$pth /lib /usr/lib"
1933for file in $loclist; do
dfe9444c
AD
1934 eval xxx=\$$file
1935 case "$xxx" in
1936 /*|?:[\\/]*)
1937 if test -f "$xxx"; then
1938 : ok
1939 else
1940 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1941 xxx=`./loc $file $file $pth`
1942 fi
1943 ;;
1944 '') xxx=`./loc $file $file $pth`;;
1945 *) xxx=`./loc $xxx $xxx $pth`;;
1946 esac
2304df62
AD
1947 eval $file=$xxx
1948 eval _$file=$xxx
1949 case "$xxx" in
1950 /*)
1951 echo $file is in $xxx.
1952 ;;
8e07c86e
AD
1953 ?:[\\/]*)
1954 echo $file is in $xxx.
1955 ;;
2304df62 1956 *)
25f94b33
AD
1957 echo "I don't know where '$file' is, and my life depends on it." >&4
1958 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1959 exit 1
2304df62
AD
1960 ;;
1961 esac
1962done
1963echo " "
1964echo "Don't worry if any of the following aren't found..."
1965say=offhand
1966for file in $trylist; do
dfe9444c
AD
1967 eval xxx=\$$file
1968 case "$xxx" in
1969 /*|?:[\\/]*)
1970 if test -f "$xxx"; then
1971 : ok
1972 else
1973 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1974 xxx=`./loc $file $file $pth`
1975 fi
1976 ;;
1977 '') xxx=`./loc $file $file $pth`;;
1978 *) xxx=`./loc $xxx $xxx $pth`;;
1979 esac
2304df62
AD
1980 eval $file=$xxx
1981 eval _$file=$xxx
1982 case "$xxx" in
1983 /*)
1984 echo $file is in $xxx.
1985 ;;
8e07c86e
AD
1986 ?:[\\/]*)
1987 echo $file is in $xxx.
1988 ;;
2304df62
AD
1989 *)
1990 echo "I don't see $file out there, $say."
1991 say=either
1992 ;;
1993 esac
1994done
1995case "$egrep" in
1996egrep)
1997 echo "Substituting grep for egrep."
1998 egrep=$grep
1999 ;;
2000esac
8ff267be 2001case "$ln" in
2002ln)
2003 echo "Substituting cp for ln."
2004 ln=$cp
2005 ;;
2006esac
2304df62
AD
2007case "$test" in
2008test)
2009 echo "Hopefully test is built into your sh."
2010 ;;
2011*)
ecfc5424 2012 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
2013 echo "Using the test built into your sh."
2014 test=test
2015 _test=test
2016 fi
2017 ;;
2018esac
2019case "$echo" in
2020echo)
2021 echo "Hopefully echo is built into your sh."
2022 ;;
2023'') ;;
2024*)
2025 echo " "
2026echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2027 $echo $n "hi there$c" >foo1
2028 echo $n "hi there$c" >foo2
2029 if cmp foo1 foo2 >/dev/null 2>&1; then
2030 echo "They are compatible. In fact, they may be identical."
2031 else
2032 case "$n" in
2033 '-n') n='' c='\c';;
2034 *) n='-n' c='';;
2035 esac
2036 cat <<FOO
2037They are not compatible! You are probably running ksh on a non-USG system.
2038I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2039have echo built in and we may have to run some Bourne shell scripts. That
2040means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2041
2042FOO
2043 $echo $n "The star should be here-->$c"
2044 $echo "*"
2045 fi
2046 $rm -f foo1 foo2
2047 ;;
2048esac
2049
a0d0e21e
LW
2050: determine whether symbolic links are supported
2051echo " "
2052$touch blurfl
2053if $ln -s blurfl sym > /dev/null 2>&1 ; then
2054 echo "Symbolic links are supported." >&4
2055 lns="$ln -s"
2056else
2057 echo "Symbolic links are NOT supported." >&4
2058 lns="$ln"
2059fi
2060$rm -f blurfl sym
2061
ecfc5424
AD
2062: see whether [:lower:] and [:upper:] are supported character classes
2063echo " "
ecfc5424
AD
2064case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2065ABYZ)
2066 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2067 up='[:upper:]'
2068 low='[:lower:]'
2069 ;;
28e8609d
JH
2070*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2071 # (0xc9 and 0xd1), therefore that is a nice testing point.
2072 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2073 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2074 ij) up='[A-Z]'
2075 low='[a-z]'
2076 ;;
2077 esac
2078 fi
2079 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2080 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2081 ij) up='A-Z'
2082 low='a-z'
2083 ;;
2084 esac
2085 fi
2086 if test "X$up" = X -o "X$low" = X; then
2087 case "`echo IJ | od -x 2>/dev/null`" in
2088 *C9D1*|*c9d1*)
2089 echo "Hey, this might be EBCDIC." >&4
2090 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2091 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2092 ij) up='[A-IJ-RS-Z]'
2093 low='[a-ij-rs-z]'
2094 ;;
2095 esac
2096 fi
2097 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2098 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2099 ij) up='A-IJ-RS-Z'
2100 low='a-ij-rs-z'
2101 ;;
2102 esac
2103 fi
2104 ;;
2105 esac
2106 fi
2107esac
3eaeeeae 2108case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2109ij)
2110 echo "Using $up and $low to convert case." >&4
2111 ;;
ecfc5424 2112*)
28e8609d
JH
2113 echo "I don't know how to translate letters from upper to lower case." >&4
2114 echo "Your tr is not acting any way I know of." >&4
2115 exit 1
2116 ;;
ecfc5424
AD
2117esac
2118: set up the translation script tr, must be called with ./tr of course
2119cat >tr <<EOSC
2120$startsh
2121case "\$1\$2" in
2122'[A-Z][a-z]') exec $tr '$up' '$low';;
2123'[a-z][A-Z]') exec $tr '$low' '$up';;
2124esac
2125exec $tr "\$@"
2126EOSC
2127chmod +x tr
2128$eunicefix tr
2129
2304df62
AD
2130: Try to determine whether config.sh was made on this system
2131case "$config_sh" in
2132'')
2133myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
2134# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2135# because the A-Z/a-z are not consecutive.
a0d0e21e 2136myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2137 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2138newmyuname="$myuname"
2304df62 2139dflt=n
16d20bd9
AD
2140case "$knowitall" in
2141'')
2142 if test -f ../config.sh; then
2143 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2144 eval "`grep myuname= ../config.sh`"
2145 fi
2146 if test "X$myuname" = "X$newmyuname"; then
2147 dflt=y
2148 fi
2304df62 2149 fi
16d20bd9
AD
2150 ;;
2151*) dflt=y;;
2152esac
2304df62
AD
2153
2154: Get old answers from old config file if Configure was run on the
2155: same system, otherwise use the hints.
2156hint=default
2157cd ..
2158if test -f config.sh; then
16d20bd9
AD
2159 echo " "
2160 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2161 . UU/myread
2162 case "$ans" in
2163 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2164 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2165 tmp_n="$n"
2166 tmp_c="$c"
85cad39c 2167 tmp_sh="$sh"
2304df62
AD
2168 . ./config.sh
2169 cp config.sh UU
ecfc5424
AD
2170 n="$tmp_n"
2171 c="$tmp_c"
85cad39c 2172 : Older versions did not always set $sh. Catch re-use of such
2173 : an old config.sh.
2174 case "$sh" in
2175 '') sh="$tmp_sh" ;;
2176 esac
2304df62
AD
2177 hint=previous
2178 ;;
2179 esac
2180fi
2181if test ! -f config.sh; then
2182 $cat <<EOM
2183
4e2a5f63
AD
2184First time through, eh? I have some defaults handy for some systems
2185that need some extra help getting the Configure answers right:
2304df62
AD
2186
2187EOM
dfe9444c 2188 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2189 dflt=''
2190 : Half the following guesses are probably wrong... If you have better
46193409 2191 : tests or hints, please send them to perlbug@perl.com
2304df62 2192 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2193 $test -f /irix && osname=irix
85e6fe83
LW
2194 $test -f /xenix && osname=sco_xenix
2195 $test -f /dynix && osname=dynix
2196 $test -f /dnix && osname=dnix
5f05dabc 2197 $test -f /lynx.os && osname=lynxos
2198 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2199 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2200 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2201 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2202 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2203 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2204 $test -d /usr/apollo/bin && osname=apollo
2205 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2206 $test -d /usr/include/minix && osname=minix
e060872b 2207 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2208 osname=machten
4633a7c4 2209 if $test -x /sbin/version; then
dfe9444c 2210 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2211 $sed -e 's/[A-Za-z]$//'`
2212 elif $test -x /usr/etc/version; then
dfe9444c 2213 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2214 $sed -e 's/[A-Za-z]$//'`
2215 else
2216 osvers="$2.$3"
2217 fi
2218 fi
aaacdc8b
GS
2219
2220 $test -f /sys/posix.dll &&
2221 $test -f /usr/bin/what &&
2222 set X `/usr/bin/what /sys/posix.dll` &&
2223 $test "$3" = UWIN &&
2224 osname=uwin &&
2225 osvers="$5"
2226
2304df62
AD
2227 if $test -f $uname; then
2228 set X $myuname
2229 shift
2230
2304df62 2231 case "$5" in
85e6fe83 2232 fps*) osname=fps ;;
2304df62
AD
2233 mips*)
2234 case "$4" in
85e6fe83
LW
2235 umips) osname=umips ;;
2236 *) osname=mips ;;
2304df62 2237 esac;;
85e6fe83
LW
2238 [23]100) osname=mips ;;
2239 next*) osname=next ;;
ecfc5424 2240 i386*)
c6912327
JH
2241 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2242 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2243 osname='sco'
2244 osvers=$tmp
2245 elif $test -f /etc/kconfig; then
ecfc5424 2246 osname=isc
bd628c73 2247 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2248 osvers=4
2249 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2250 osvers=3
2304df62 2251 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2252 osvers=2
ecfc5424
AD
2253 fi
2254 fi
2000072c 2255 tmp=''
ecfc5424 2256 ;;
c4f23d77
AD
2257 pc*)
2258 if test -n "$DJGPP"; then
2259 osname=dos
2260 osvers=djgpp
2261 fi
2262 ;;
2304df62
AD
2263 esac
2264
2265 case "$1" in
a0d0e21e
LW
2266 aix) osname=aix
2267 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2268 case "$tmp" in
1aef975c 2269 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2270 '<3240'|'<>3240') osvers=3.2.0 ;;
2271 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2272 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2273 *) osvers=$tmp;;
a0d0e21e
LW
2274 esac
2275 ;;
aaacdc8b
GS
2276 bsd386) osname=bsd386
2277 osvers=`$uname -r`
2278 ;;
2279 cygwin*) osname=cygwin
2280 osvers="$3"
2281 ;;
23f87696
SZ
2282 *dc.osx) osname=dcosx
2283 osvers="$3"
2284 ;;
a0d0e21e
LW
2285 dnix) osname=dnix
2286 osvers="$3"
2287 ;;
2288 domainos) osname=apollo
2289 osvers="$3"
2290 ;;
2291 dgux) osname=dgux
2292 osvers="$3"
2293 ;;
760ac839 2294 dynixptx*) osname=dynixptx
e58e581d 2295 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2296 ;;
a0d0e21e
LW
2297 freebsd) osname=freebsd
2298 osvers="$3" ;;
2299 genix) osname=genix ;;
2300 hp*) osname=hpux
bfb7748a 2301 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2302 ;;
a78b0d02 2303 irix*) osname=irix
a0d0e21e
LW
2304 case "$3" in
2305 4*) osvers=4 ;;
2306 5*) osvers=5 ;;
ecfc5424 2307 *) osvers="$3" ;;
a0d0e21e
LW
2308 esac
2309 ;;
2310 linux) osname=linux
2311 case "$3" in
a0d0e21e
LW
2312 *) osvers="$3" ;;
2313 esac
2314 ;;
28e8609d
JH
2315 MiNT) osname=mint
2316 ;;
2317 netbsd*) osname=netbsd
ecfc5424
AD
2318 osvers="$3"
2319 ;;
4e81affe
MM
2320 news-os) osvers="$3"
2321 case "$3" in
2322 4*) osname=newsos4 ;;
2323 *) osname=newsos ;;
2324 esac
2325 ;;
aaacdc8b
GS
2326 next*) osname=next ;;
2327 POSIX-BC | posix-bc ) osname=posix-bc
2328 osvers="$3"
a0d0e21e 2329 ;;
ae3afa4e
TH
2330 powerux | power_ux | powermax_os | powermaxos | \
2331 powerunix | power_unix) osname=powerux
2332 osvers="$3"
2333 ;;
aaacdc8b
GS
2334 qnx) osname=qnx
2335 osvers="$4"
2336 ;;
a0d0e21e
LW
2337 solaris) osname=solaris
2338 case "$3" in
2339 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2340 *) osvers="$3" ;;
a0d0e21e
LW
2341 esac
2342 ;;
85e6fe83
LW
2343 sunos) osname=sunos
2344 case "$3" in
85e6fe83
LW
2345 5*) osname=solaris
2346 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2347 *) osvers="$3" ;;
2304df62
AD
2348 esac
2349 ;;
a0d0e21e 2350 titanos) osname=titanos
85e6fe83 2351 case "$3" in
a0d0e21e
LW
2352 1*) osvers=1 ;;
2353 2*) osvers=2 ;;
2354 3*) osvers=3 ;;
2355 4*) osvers=4 ;;
ecfc5424 2356 *) osvers="$3" ;;
2304df62
AD
2357 esac
2358 ;;
85e6fe83 2359 ultrix) osname=ultrix
ecfc5424 2360 osvers="$3"
2304df62 2361 ;;
28757baa 2362 osf1|mls+) case "$5" in
fed7345c
AD
2363 alpha)
2364 osname=dec_osf
313489a2 2365 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2366 ;;
2367 hp*) osname=hp_osf1 ;;
2368 mips) osname=mips_osf1 ;;
85e6fe83
LW
2369 esac
2370 ;;
0337d152
BG
2371 unixware) osname=svr5
2372 osvers="$4"
2373 ;;
2374 uts) osname=uts
a0d0e21e
LW
2375 osvers="$3"
2376 ;;
85e6fe83 2377 $2) case "$osname" in
2304df62 2378 *isc*) ;;
a0d0e21e 2379 *freebsd*) ;;
5f05dabc 2380 svr*)
a0d0e21e
LW
2381 : svr4.x or possibly later
2382 case "svr$3" in
2383 ${osname}*)
2384 osname=svr$3
2385 osvers=$4
2386 ;;
2387 esac
2388 case "$osname" in
2389 svr4.0)
2390 : Check for ESIX
2391 if test -f /stand/boot ; then
2392 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2393 if test -n "$INITPROG" -a -f "$INITPROG"; then
2394 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2395 if test -n "$isesix"; then
a0d0e21e
LW
2396 osname=esix4
2397 fi
2398 fi
2399 fi
2400 ;;
2401 esac
2402 ;;
2304df62 2403 *) if test -f /etc/systemid; then
a0d0e21e
LW
2404 osname=sco
2405 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2406 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2407 osvers=$1.$2.$3
c4f23d77 2408 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2409 osvers=$1.$2
c4f23d77 2410 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2411 osvers=$1
2304df62 2412 fi
a0d0e21e
LW
2413 else
2414 case "$osname" in
2415 '') : Still unknown. Probably a generic Sys V.
2416 osname="sysv"
2417 osvers="$3"
2418 ;;
2419 esac
2304df62
AD
2420 fi
2421 ;;
2422 esac
2423 ;;
a0d0e21e
LW
2424 *) case "$osname" in
2425 '') : Still unknown. Probably a generic BSD.
2426 osname="$1"
2427 osvers="$3"
2428 ;;
2429 esac
2430 ;;
2304df62
AD
2431 esac
2432 else
dfe9444c
AD
2433 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2434 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2435 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2436 osname=news_os
2304df62 2437 fi
dfe9444c 2438 $rm -f UU/kernel.what
8e07c86e
AD
2439 elif test -d c:/.; then
2440 set X $myuname
2441 osname=os2
2442 osvers="$5"
2304df62
AD
2443 fi
2444 fi
85e6fe83 2445
a0d0e21e
LW
2446 : Now look for a hint file osname_osvers, unless one has been
2447 : specified already.
2448 case "$hintfile" in
2449 ''|' ')
ecfc5424 2450 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2451 : Also try without trailing minor version numbers.
ecfc5424
AD
2452 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2453 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2454 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2455 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2456 case "$file" in
2457 '') dflt=none ;;
2458 *) case "$osvers" in
2459 '') dflt=$file
2460 ;;
dfe9444c 2461 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2462 dflt=$file
dfe9444c 2463 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2464 dflt=$xfile
dfe9444c 2465 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2466 dflt=$xxfile
dfe9444c 2467 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2468 dflt=$xxxfile
dfe9444c 2469 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2470 dflt=$xxxxfile
dfe9444c 2471 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2472 dflt="${osname}"
2473 else
2474 dflt=none
2475 fi
2476 ;;
2477 esac
85e6fe83
LW
2478 ;;
2479 esac
4e2a5f63
AD
2480 if $test -f Policy.sh ; then
2481 case "$dflt" in
2482 *Policy*) ;;
2483 none) dflt="Policy" ;;
2484 *) dflt="Policy $dflt" ;;
2485 esac
2486 fi
85e6fe83 2487 ;;
a0d0e21e 2488 *)
ecfc5424 2489 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2490 ;;
2304df62 2491 esac
1aef975c 2492
4e2a5f63
AD
2493 if $test -f Policy.sh ; then
2494 $cat <<EOM
2495
2496There's also a Policy hint file available, which should make the
2497site-specific (policy) questions easier to answer.
2498EOM
2499
2500 fi
2501
2304df62
AD
2502 $cat <<EOM
2503
2504You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2505A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2506is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2507
2508EOM
4e2a5f63 2509
2304df62 2510 rp="Which of these apply, if any?"
dfe9444c 2511 . UU/myread
85e6fe83
LW
2512 tans=$ans
2513 for file in $tans; do
4e2a5f63
AD
2514 if $test X$file = XPolicy -a -f Policy.sh; then
2515 . Policy.sh
2516 $cat Policy.sh >> UU/config.sh
2517 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2518 . $src/hints/$file.sh
2519 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2520 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2521 : nothing
2522 else
85e6fe83
LW
2523 : Give one chance to correct a possible typo.
2524 echo "$file.sh does not exist"
2525 dflt=$file
2526 rp="hint to use instead?"
dfe9444c 2527 . UU/myread
85e6fe83 2528 for file in $ans; do
dfe9444c
AD
2529 if $test -f "$src/hints/$file.sh"; then
2530 . $src/hints/$file.sh
2531 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2532 elif $test X$ans = X -o X$ans = Xnone ; then
2533 : nothing
2534 else
2535 echo "$file.sh does not exist -- ignored."
2536 fi
2537 done
2304df62
AD
2538 fi
2539 done
85e6fe83 2540
2304df62 2541 hint=recommended
85e6fe83 2542 : Remember our hint file for later.
dfe9444c 2543 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2544 hintfile="$file"
85e6fe83 2545 else
a0d0e21e 2546 hintfile=''
85e6fe83 2547 fi
2304df62
AD
2548fi
2549cd UU
2550;;
2551*)
2552 echo " "
2553 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2554 tmp_n="$n"
2555 tmp_c="$c"
2304df62
AD
2556 cd ..
2557 cp $config_sh config.sh 2>/dev/null
a78b0d02 2558 chmod +w config.sh
2304df62
AD
2559 . ./config.sh
2560 cd UU
2561 cp ../config.sh .
ecfc5424
AD
2562 n="$tmp_n"
2563 c="$tmp_c"
2304df62
AD
2564 hint=previous
2565 ;;
2566esac
1aef975c
AD
2567test "$override" && . ./optdef.sh
2568myuname="$newmyuname"
2304df62
AD
2569
2570: Restore computed paths
2571for file in $loclist $trylist; do
2572 eval $file="\$_$file"
2573done
2574
85e6fe83 2575cat << EOM
a0d0e21e 2576
85e6fe83 2577Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2578The default value is probably right if the name rings a bell. Otherwise,
2579since spelling matters for me, either accept the default or answer "none"
2580to leave it blank.
a0d0e21e 2581
85e6fe83 2582EOM
85e6fe83 2583case "$osname" in
a0d0e21e 2584 ''|' ')
85e6fe83 2585 case "$hintfile" in
a0d0e21e 2586 ''|' '|none) dflt=none ;;
ecfc5424 2587 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2588 esac
2589 ;;
2590 *) dflt="$osname" ;;
2591esac
2592rp="Operating system name?"
2593. ./myread
2594case "$ans" in
ecfc5424
AD
2595none) osname='' ;;
2596*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2597esac
8ff267be 2598echo " "
2599case "$osvers" in
2600 ''|' ')
2601 case "$hintfile" in
2602 ''|' '|none) dflt=none ;;
2603 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2604 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2605 case "$dflt" in
2606 ''|' ') dflt=none ;;
2607 esac
2608 ;;
2609 esac
2610 ;;
2611 *) dflt="$osvers" ;;
2612esac
2613rp="Operating system version?"
2614. ./myread
2615case "$ans" in
2616none) osvers='' ;;
2617*) osvers="$ans" ;;
2618esac
2619
02e93a22
JH
2620
2621. ./posthint.sh
2622
2304df62 2623: who configured the system
59b83a6f 2624cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2625cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2626case "$cf_by" in
2627"")
8ff267be 2628 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2629 case "$cf_by" in
2630 "") cf_by=unknown ;;
8ff267be 2631 esac ;;
2632esac
2304df62 2633
dfe9444c
AD
2634: set up the script used to warn in case of inconsistency
2635cat <<EOS >whoa
2636$startsh
2637EOS
2638cat <<'EOSC' >>whoa
2639dflt=y
2640echo " "
2641echo "*** WHOA THERE!!! ***" >&4
2642echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2643rp=" Keep the $hint value?"
2644. ./myread
2645case "$ans" in
2646y) td=$was; tu=$was;;
2647esac
2648EOSC
2649
2650: function used to set $1 to $val
2651setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2652case "$val$was" in
2653$define$undef) . ./whoa; eval "$var=\$td";;
2654$undef$define) . ./whoa; eval "$var=\$tu";;
2655*) eval "$var=$val";;
2656esac'
2657
64e689dc
JH
2658cat <<EOM
2659
2660Perl can be built to take advantage of threads, on some systems.
2661To do so, Configure must be run with -Dusethreads.
d00b958f
JH
2662
2663Note that threading is a highly experimental feature, and
2664some known race conditions still remain. If you choose to try
2665it, be very sure to not actually deploy it for production
2666purposes. README.threads has more details, and is required
2667reading if you enable threads.
64e689dc 2668EOM
dfe9444c 2669case "$usethreads" in
b691c02f 2670$define|true|[yY]*) dflt='y';;
64e689dc
JH
2671*) dflt='n';;
2672esac
2673rp='Build a threading Perl?'
2674. ./myread
2675case "$ans" in
aaacdc8b 2676y|Y) val="$define" ;;
64e689dc 2677*) val="$undef" ;;
dfe9444c 2678esac
64e689dc 2679set usethreads
aaacdc8b
GS
2680eval $setvar
2681
2682case "$usethreads" in
2683$define)
2684 $cat <<EOM
2685
ff42dc34 2686As of 5.5.640, Perl has two different internal threading implementations,
aaacdc8b
GS
2687the 5.005 version (5005threads) and an interpreter-based version
2688(ithreads) that has one interpreter per thread. Both are very
2689experimental. This arrangement exists to help developers work out
2690which one is better.
2691EOM
2692 : Default to ithreads unless overridden on command line or with
2693 : old config.sh
2694 dflt='y'
2695 case "$use5005threads" in
2696 $define|true|[yY]*) dflt='n';;
2697 esac
2698 case "$useithreads" in
2699 $undef|false|[nN]*) dflt='n';;
2700 esac
2701 rp='Use interpreter-based ithreads?'
2702 . ./myread
2703 case "$ans" in
2704 y|Y) val="$define" ;;
2705 *) val="$undef" ;;
2706 esac
2707 set useithreads
2708 eval $setvar
2709 : Now set use5005threads to the opposite value.
2710 case "$useithreads" in
2711 $define) val="$undef" ;;
2712 *) val="$define" ;;
2713 esac
2714 set use5005threads
2715 eval $setvar
2716 ;;
2717*)
2718 useithreads="$undef"
2719 use5005threads="$undef"
2720 ;;
2721esac
104d25b7 2722
693762b4
AD
2723case "$d_oldpthreads" in
2724'') : Configure tests would be welcome here. For now, assume undef.
2725 val="$undef" ;;
2726*) val="$d_oldpthreads" ;;
2727esac
2728set d_oldpthreads
2729eval $setvar
dfe9444c 2730
b691c02f
JH
2731
2732case "$usethreads" in
104d25b7
JH
2733"$define"|true|[yY]*)
2734: Look for a hint-file generated 'call-back-unit'. If the
2735: user has specified that a threading perl is to be built,
2736: we may need to set or change some other defaults.
2737 if $test -f usethreads.cbu; then
e5e20432 2738 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2739 . ./usethreads.cbu
e5e20432
JH
2740 else
2741 $cat <<EOM
2742(Your platform doesn't have any specific hints for threaded builds.
2743 Assuming POSIX threads, then.)
b691c02f 2744EOM
e5e20432 2745 fi
aaacdc8b 2746 ;;
e5e20432 2747esac
104d25b7 2748
ff935051 2749cat <<EOM
64e689dc 2750
ff935051
JH
2751Perl can be built so that multiple Perl interpreters can coexist
2752within the same Perl executable.
2753EOM
64e689dc 2754
ff935051
JH
2755case "$useithreads" in
2756$define)
2757 cat <<EOM
2758This multiple interpreter support is required for interpreter-based threads.
64e689dc 2759EOM
ff935051
JH
2760 val="$define"
2761 ;;
2762*)
2763 echo 'Normally you do not need this and you should answer no.'
ff42dc34
GS
2764 case "$usemultiplicity" in
2765 $define|true|[yY]*) dflt='y';;
2766 *) dflt='n';;
2767 esac
2768 rp='Build Perl for multiplicity?'
2769 . ./myread
2770 case "$ans" in
ff935051 2771 y|Y) val="$define" ;;
ff42dc34
GS
2772 *) val="$undef" ;;
2773 esac
2774 ;;
64e689dc
JH
2775esac
2776set usemultiplicity
ff935051 2777eval $setvar
64e689dc 2778
e5e20432
JH
2779: determine where manual pages are on this system
2780echo " "
2781case "$sysman" in
2782'')
2783 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2784 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2785 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2786 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2787 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2788 sysman=`./loc . /usr/man/man1 $syspath`
2789 ;;
2790esac
2791if $test -d "$sysman"; then
2792 echo "System manual is in $sysman." >&4
2793else
2794 echo "Could not find manual pages in source form." >&4
2795fi
2796
2797: see what memory models we can support
2798case "$models" in
2799'')
2800 $cat >pdp11.c <<'EOP'
2801int main() {
2802#ifdef pdp11
2803 exit(0);
2804#else
2805 exit(1);
2806#endif
2807}
2808EOP
2809 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2810 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2811 dflt='unsplit split'
2812 else
2813 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2814 case "$tans" in
2815 X) dflt='none';;
2816 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2817 dflt='small'
2818 else
2819 dflt=''
2820 fi
2821 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2822 dflt="$dflt medium"
2823 fi
2824 if $test -d /lib/large || $test -d /usr/lib/large; then
2825 dflt="$dflt large"
2826 fi
2827 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2828 dflt="$dflt huge"
2829 fi
2830 esac
2831 fi;;
2832*) dflt="$models";;
2833esac
2834$cat <<EOM
2835
2836Some systems have different model sizes. On most systems they are called
2837small, medium, large, and huge. On the PDP11 they are called unsplit and
2838split. If your system doesn't support different memory models, say "none".
2839If you wish to force everything to one memory model, say "none" here and
2840put the appropriate flags later when it asks you for other cc and ld flags.
2841Venix systems may wish to put "none" and let the compiler figure things out.
2842(In the following question multiple model names should be space separated.)
2843
2844The default for most systems is "none".
2845
2846EOM
2847rp="Which memory models are supported?"
2848. ./myread
2849models="$ans"
2850
2851case "$models" in
2852none)
2853 small=''
2854 medium=''
2855 large=''
2856 huge=''
2857 unsplit=''
2858 split=''
2859 ;;
2860*split)
2861 case "$split" in
2862 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2863 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2864 dflt='-i'
2865 else
2866 dflt='none'
2867 fi;;
2868 *) dflt="$split";;
2869 esac
2870 rp="What flag indicates separate I and D space?"
2871 . ./myread
2872 tans="$ans"
2873 case "$tans" in
2874 none) tans='';;
2875 esac
2876 split="$tans"
2877 unsplit='';;
2878*large*|*small*|*medium*|*huge*)
2879 case "$models" in
2880 *large*)
2881 case "$large" in
2882 '') dflt='-Ml';;
2883 *) dflt="$large";;
2884 esac
2885 rp="What flag indicates large model?"
2886 . ./myread
2887 tans="$ans"
2888 case "$tans" in
2889 none) tans='';
2890 esac
2891 large="$tans";;
2892 *) large='';;
2893 esac
2894 case "$models" in
2895 *huge*) case "$huge" in
2896 '') dflt='-Mh';;
2897 *) dflt="$huge";;
2898 esac
2899 rp="What flag indicates huge model?"
2900 . ./myread
2901 tans="$ans"
2902 case "$tans" in
2903 none) tans='';
2904 esac
2905 huge="$tans";;
2906 *) huge="$large";;
2907 esac
2908 case "$models" in
2909 *medium*) case "$medium" in
2910 '') dflt='-Mm';;
2911 *) dflt="$medium";;
2912 esac
2913 rp="What flag indicates medium model?"
2914 . ./myread
2915 tans="$ans"
2916 case "$tans" in
2917 none) tans='';
2918 esac
2919 medium="$tans";;
2920 *) medium="$large";;
2921 esac
2922 case "$models" in
2923 *small*) case "$small" in
2924 '') dflt='none';;
2925 *) dflt="$small";;
2926 esac
2927 rp="What flag indicates small model?"
2928 . ./myread
2929 tans="$ans"
2930 case "$tans" in
2931 none) tans='';
2932 esac
2933 small="$tans";;
2934 *) small='';;
2935 esac
2936 ;;
2937*)
2938 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2939 ;;
2940esac
2941$rm -f pdp11.* pdp11
2942
2943: make some quick guesses about what we are up against
2944echo " "
2945$echo $n "Hmm... $c"
2946echo exit 1 >bsd
2947echo exit 1 >usg
2948echo exit 1 >v7
2949echo exit 1 >osf1
2950echo exit 1 >eunice
2951echo exit 1 >xenix
2952echo exit 1 >venix
2953echo exit 1 >os2
2954d_bsd="$undef"
2955$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2956if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2957then
2958 echo "Looks kind of like an OSF/1 system, but we'll see..."
2959 echo exit 0 >osf1
2960elif test `echo abc | tr a-z A-Z` = Abc ; then
2961 xxx=`./loc addbib blurfl $pth`
2962 if $test -f $xxx; then
2963 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2964 echo exit 0 >bsd
2965 echo exit 0 >usg
2966 else
2967 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2968 echo "Looks kind of like an extended USG system, but we'll see..."
2969 else
2970 echo "Looks kind of like a USG system, but we'll see..."
2971 fi
2972 echo exit 0 >usg
2973 fi
2974elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2975 echo "Looks kind of like a BSD system, but we'll see..."
2976 d_bsd="$define"
2977 echo exit 0 >bsd
2978else
2979 echo "Looks kind of like a Version 7 system, but we'll see..."
2980 echo exit 0 >v7
2981fi
2982case "$eunicefix" in
2983*unixtovms*)
2984 $cat <<'EOI'
2985There is, however, a strange, musty smell in the air that reminds me of
2986something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2987EOI
2988 echo exit 0 >eunice
2989 d_eunice="$define"
2990: it so happens the Eunice I know will not run shell scripts in Unix format
2991 ;;
2992*)
2993 echo " "
2994 echo "Congratulations. You aren't running Eunice."
2995 d_eunice="$undef"
2996 ;;
2997esac
2998: Detect OS2. The p_ variable is set above in the Head.U unit.
2999case "$p_" in
3000:) ;;
3001*)
3002 $cat <<'EOI'
3003I have the feeling something is not exactly right, however...don't tell me...
3004lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3005EOI
3006 echo exit 0 >os2
3007 ;;
3008esac
3009if test -f /xenix; then
3010 echo "Actually, this looks more like a XENIX system..."
3011 echo exit 0 >xenix
3012 d_xenix="$define"
3013else
3014 echo " "
3015 echo "It's not Xenix..."
3016 d_xenix="$undef"
3017fi
3018chmod +x xenix
3019$eunicefix xenix
3020if test -f /venix; then
3021 echo "Actually, this looks more like a VENIX system..."
3022 echo exit 0 >venix
3023else
3024 echo " "
3025 if ./xenix; then
3026 : null
3027 else
3028 echo "Nor is it Venix..."
3029 fi
3030fi
3031chmod +x bsd usg v7 osf1 eunice xenix venix os2
3032$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3033$rm -f foo
3034
3035: see if we need a special compiler
3036echo " "
3037if ./usg; then
3038 case "$cc" in
3039 '') case "$Mcc" in
3040 /*) dflt='Mcc';;
3041 *) case "$large" in
3042 -M*) dflt='cc';;
3043 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3044 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3045 dflt='cc'
3046 else
3047 dflt='cc -M'
3048 fi
3049 else
3050 dflt='cc'
3051 fi;;
3052 esac;;
3053 esac;;
3054 *) dflt="$cc";;
3055 esac
3056 case "$dflt" in
3057 *M*) $cat <<'EOM'
3058On some older systems the default C compiler will not resolve multiple global
3059references that happen to have the same name. On some such systems the "Mcc"
3060command may be used to force these to be resolved. On other systems a "cc -M"
3061command is required. (Note that the -M flag on other systems indicates a
3062memory model to use!) If you have the Gnu C compiler, you might wish to use
3063that instead.
3064
3065EOM
3066 ;;
3067 esac
3068 rp="Use which C compiler?"
3069 . ./myread
3070 cc="$ans"
3071else
3072 case "$cc" in
3073 '') dflt=cc;;
3074 *) dflt="$cc";;
3075 esac
3076 rp="Use which C compiler?"
3077 . ./myread
3078 cc="$ans"
3079fi
3080: Look for a hint-file generated 'call-back-unit'. Now that the
3081: user has specified the compiler, we may need to set or change some
3082: other defaults.
3083if $test -f cc.cbu; then
3084 . ./cc.cbu
3085fi
3086echo " "
3087echo "Checking for GNU cc in disguise and/or its version number..." >&4
3088$cat >gccvers.c <<EOM
3089#include <stdio.h>
3090int main() {
3091#ifdef __GNUC__
3092#ifdef __VERSION__
3093 printf("%s\n", __VERSION__);
3094#else
3095 printf("%s\n", "1");
3096#endif
3097#endif
3098 exit(0);
3099}
3100EOM
3101if $cc -o gccvers gccvers.c; then
3102 gccversion=`./gccvers`
3103 case "$gccversion" in
3104 '') echo "You are not using GNU cc." ;;
fc68435e 3105 *) echo "You are using GNU cc $gccversion."
fc68435e 3106 ;;
e5e20432
JH
3107 esac
3108else
3109 echo " "
3110 echo "*** WHOA THERE!!! ***" >&4
3111 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3112 case "$knowitall" in
3113 '')
3114 echo " You'd better start hunting for one and let me know about it." >&4
3115 exit 1
3116 ;;
3117 esac
3118fi
3119$rm -f gccvers*
3120case "$gccversion" in
31211*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3122esac
3123
bd9b35c9
JH
3124: decide how portable to be. Allow command line overrides.
3125case "$d_portable" in
3126"$undef") ;;
3127*) d_portable="$define" ;;
104d25b7 3128esac
85ab1d1d 3129
bd9b35c9
JH
3130: set up shell script to do ~ expansion
3131cat >filexp <<EOSS
3132$startsh
3133: expand filename
3134case "\$1" in
3135 ~/*|~)
3136 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3137 ;;
3138 ~*)
3139 if $test -f /bin/csh; then
3140 /bin/csh -f -c "glob \$1"
3141 failed=\$?
3142 echo ""
3143 exit \$failed
e5e20432 3144 else
bd9b35c9
JH
3145 name=\`$expr x\$1 : '..\([^/]*\)'\`
3146 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3147 if $test ! -d "\$dir"; then
3148 me=\`basename \$0\`
3149 echo "\$me: can't locate home directory for: \$name" >&2
3150 exit 1
3151 fi
3152 case "\$1" in
3153 */*)
3154 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3155 ;;
3156 *)
3157 echo \$dir
e5e20432
JH
3158 ;;
3159 esac
3160 fi
b691c02f 3161 ;;
4633a7c4 3162*)
bd9b35c9 3163 echo \$1
2304df62
AD
3164 ;;
3165esac
4633a7c4
LW
3166EOSS
3167chmod +x filexp
3168$eunicefix filexp
2304df62
AD
3169
3170: now set up to get a file name
28757baa 3171cat <<EOS >getfile
3172$startsh
3173EOS
3174cat <<'EOSC' >>getfile
2304df62
AD
3175tilde=''
3176fullpath=''
3177already=''
3178skip=''
3179none_ok=''
3180exp_file=''
a0d0e21e 3181nopath_ok=''
2304df62
AD
3182orig_rp="$rp"
3183orig_dflt="$dflt"
b233458b
JH
3184case "$gfpth" in
3185'') gfpth='.' ;;
3186esac
2304df62
AD
3187
3188case "$fn" in
ecfc5424 3189*\(*)
28e8609d 3190 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3191 fn=`echo $fn | sed 's/(.*)//'`
3192 ;;
3193esac
3194
3195case "$fn" in
a0d0e21e
LW
3196*:*)
3197 loc_file=`expr $fn : '.*:\(.*\)'`
3198 fn=`expr $fn : '\(.*\):.*'`
3199 ;;
3200esac
3201
3202case "$fn" in
2304df62
AD
3203*~*) tilde=true;;
3204esac
3205case "$fn" in
3206*/*) fullpath=true;;
3207esac
3208case "$fn" in
3209*+*) skip=true;;
3210esac
3211case "$fn" in
3212*n*) none_ok=true;;
3213esac
3214case "$fn" in
3215*e*) exp_file=true;;
3216esac
a0d0e21e
LW
3217case "$fn" in
3218*p*) nopath_ok=true;;
3219esac
2304df62
AD
3220
3221case "$fn" in
3222*f*) type='File';;
3223*d*) type='Directory';;
a0d0e21e 3224*l*) type='Locate';;
2304df62
AD
3225esac
3226
3227what="$type"
3228case "$what" in
3229Locate) what='File';;
3230esac
3231
3232case "$exp_file" in
3233'')
3234 case "$d_portable" in
3235 "$define") ;;
3236 *) exp_file=true;;
3237 esac
3238 ;;
3239esac
3240
3241cd ..
3242while test "$type"; do
3243 redo=''
3244 rp="$orig_rp"
3245 dflt="$orig_dflt"
3246 case "$tilde" in
3247 true) rp="$rp (~name ok)";;
3248 esac
3249 . UU/myread
ecfc5424
AD
3250 if test -f UU/getfile.ok && \
3251 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3252 then
3253 value="$ans"
3254 ansexp="$ans"
3255 break
3256 fi
2304df62
AD
3257 case "$ans" in
3258 none)
3259 value=''
3260 ansexp=''
3261 case "$none_ok" in
3262 true) type='';;
3263 esac
3264 ;;
3265 *)
3266 case "$tilde" in
3267 '') value="$ans"
3268 ansexp="$ans";;
3269 *)
3270 value=`UU/filexp $ans`
3271 case $? in
3272 0)
3273 if test "$ans" != "$value"; then
ecfc5424 3274 echo "(That expands to $value on this system.)"
2304df62
AD
3275 fi
3276 ;;
3277 *) value="$ans";;
3278 esac
3279 ansexp="$value"
3280 case "$exp_file" in
3281 '') value="$ans";;
3282 esac
3283 ;;
3284 esac
3285 case "$fullpath" in
3286 true)
3287 case "$ansexp" in
3288 /*) value="$ansexp" ;;
3289 *)
3290 redo=true
3291 case "$already" in
3292 true)
3293 echo "I shall only accept a full path name, as in /bin/ls." >&4
3294 echo "Use a ! shell escape if you wish to check pathnames." >&4
3295 ;;
3296 *)
3297 echo "Please give a full path name, starting with slash." >&4
3298 case "$tilde" in
3299 true)
3300 echo "Note that using ~name is ok provided it expands well." >&4
3301 already=true
3302 ;;
3303 esac
3304 esac
3305 ;;
3306 esac
3307 ;;
3308 esac
3309 case "$redo" in
3310 '')
3311 case "$type" in
3312 File)
b233458b
JH
3313 for fp in $gfpth; do
3314 if test "X$fp" = X.; then
3315 pf="$ansexp"
3316 else
3317 pf="$fp/$ansexp"
3318 fi
3319 if test -f "$pf"; then
3320 type=''
3321 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3322 then
3323 echo "($value is not a plain file, but that's ok.)"
3324 type=''
3325 fi
3326 if test X"$type" = X; then
3327 value="$pf"
3328 break
3329 fi
3330 done
2304df62
AD
3331 ;;
3332 Directory)
b233458b
JH
3333 for fp in $gfpth; do
3334 if test "X$fp" = X.; then
3335 pf="$ansexp"
3336 else
3337 pf="$fp/$ansexp"
3338 fi
3339 if test -d "$pf"; then
3340 type=''
3341 value="$pf"
3342 break
3343 fi
3344 done
2304df62
AD
3345 ;;
3346 Locate)
40000a8c 3347 if test -d "$ansexp"; then
a0d0e21e
LW
3348 echo "(Looking for $loc_file in directory $value.)"
3349 value="$value/$loc_file"
40000a8c 3350 ansexp="$ansexp/$loc_file"
2304df62 3351 fi
40000a8c 3352 if test -f "$ansexp"; then
2304df62
AD
3353 type=''
3354 fi
a0d0e21e
LW
3355 case "$nopath_ok" in
3356 true) case "$value" in
3357 */*) ;;
3358 *) echo "Assuming $value will be in people's path."
3359 type=''
3360 ;;
3361 esac
3362 ;;
3363 esac
2304df62
AD
3364 ;;
3365 esac
3366
3367 case "$skip" in
3368 true) type='';
3369 esac
3370
3371 case "$type" in
3372 '') ;;
3373 *)
3374 if test "$fastread" = yes; then
3375 dflt=y
3376 else
3377 dflt=n
3378 fi
3379 rp="$what $value doesn't exist. Use that name anyway?"
3380 . UU/myread
3381 dflt=''
3382 case "$ans" in
3383 y*) type='';;
3384 *) echo " ";;
3385 esac
3386 ;;
3387 esac
3388 ;;
3389 esac
3390 ;;
3391 esac
3392done
3393cd UU
3394ans="$value"
3395rp="$orig_rp"
3396dflt="$orig_dflt"
ecfc5424 3397rm -f getfile.ok
b233458b 3398test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3399EOSC
3400
bd9b35c9
JH
3401: What should the include directory be ?
3402echo " "
3403$echo $n "Hmm... $c"
3404dflt='/usr/include'
3405incpath=''
3406mips_type=''
3407if $test -f /bin/mips && /bin/mips; then
3408 echo "Looks like a MIPS system..."
3409 $cat >usr.c <<'EOCP'
3410#ifdef SYSTYPE_BSD43
3411/bsd43
3412#endif
3413EOCP
3414 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3415 dflt='/bsd43/usr/include'
3416 incpath='/bsd43'
3417 mips_type='BSD 4.3'
3418 else
3419 mips_type='System V'
3420 fi
3421 $rm -f usr.c usr.out
3422 echo "and you're compiling with the $mips_type compiler and libraries."
3423 xxx_prompt=y
3424 echo "exit 0" >mips
3425else
3426 echo "Doesn't look like a MIPS system."
3427 xxx_prompt=n
3428 echo "exit 1" >mips
3429fi
3430chmod +x mips
3431$eunicefix mips
3432case "$usrinc" in
3433'') ;;
3434*) dflt="$usrinc";;
3435esac
3436case "$xxx_prompt" in
3437y) fn=d/
3438 echo " "
3439 rp='Where are the include files you want to use?'
3440 . ./getfile
3441 usrinc="$ans"
8e07c86e 3442 ;;
bd9b35c9 3443*) usrinc="$dflt"
8e07c86e
AD
3444 ;;
3445esac
2304df62 3446
fc68435e
JH
3447: see how we invoke the C preprocessor
3448echo " "
3449echo "Now, how can we feed standard input to your C preprocessor..." >&4
3450cat <<'EOT' >testcpp.c
3451#define ABC abc
3452#define XYZ xyz
3453ABC.XYZ
3454EOT
3455cd ..
3456if test ! -f cppstdin; then
3457 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3458 # AIX cc -E doesn't show the absolute headerfile
3459 # locations but we'll cheat by using the -M flag.
3460 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
3461 else
3462 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3463 fi
3464else
3465 echo "Keeping your $hint cppstdin wrapper."
3466fi
3467chmod 755 cppstdin
3468wrapper=`pwd`/cppstdin
3469ok='false'
3470cd UU
3471
3472if $test "X$cppstdin" != "X" && \
3473 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3474 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3475then
3476 echo "You used to use $cppstdin $cppminus so we'll use that again."
3477 case "$cpprun" in
3478 '') echo "But let's see if we can live without a wrapper..." ;;
3479 *)
3480 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3481 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3482 then
3483 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3484 ok='true'
3485 else
3486 echo "(However, $cpprun $cpplast does not work, let's see...)"
3487 fi
3488 ;;
3489 esac
3490else
3491 case "$cppstdin" in
3492 '') ;;
3493 *)
3494 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3495 ;;
3496 esac
3497fi
3498
3499if $ok; then
3500 : nothing
3501elif echo 'Maybe "'"$cc"' -E" will work...'; \
3502 $cc -E <testcpp.c >testcpp.out 2>&1; \
3503 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3504 echo "Yup, it does."
3505 x_cpp="$cc -E"
3506 x_minus='';
3507elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3508 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3509 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3510 echo "Yup, it does."
3511 x_cpp="$cc -E"
3512 x_minus='-';
3513elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3514 $cc -P <testcpp.c >testcpp.out 2>&1; \
3515 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3516 echo "Yipee, that works!"
3517 x_cpp="$cc -P"
3518 x_minus='';
3519elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3520 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3521 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3522 echo "At long last!"
3523 x_cpp="$cc -P"
3524 x_minus='-';
3525elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3526 $cpp <testcpp.c >testcpp.out 2>&1; \
3527 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3528 echo "It works!"
3529 x_cpp="$cpp"
3530 x_minus='';
3531elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3532 $cpp - <testcpp.c >testcpp.out 2>&1; \
3533 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3534 echo "Hooray, it works! I was beginning to wonder."
3535 x_cpp="$cpp"
3536 x_minus='-';
3537elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3538 $wrapper <testcpp.c >testcpp.out 2>&1; \
3539 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3540 x_cpp="$wrapper"
3541 x_minus=''
3542 echo "Eureka!"
3543else
3544 dflt=''
3545 rp="No dice. I can't find a C preprocessor. Name one:"
3546 . ./myread
3547 x_cpp="$ans"
3548 x_minus=''
3549 $x_cpp <testcpp.c >testcpp.out 2>&1
3550 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3551 echo "OK, that will do." >&4
3552 else
3553echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3554 exit 1
3555 fi
3556fi
3557
3558case "$ok" in
3559false)
3560 cppstdin="$x_cpp"
3561 cppminus="$x_minus"
3562 cpprun="$x_cpp"
3563 cpplast="$x_minus"
3564 set X $x_cpp
3565 shift
3566 case "$1" in
3567 "$cpp")
3568 echo "Perhaps can we force $cc -E using a wrapper..."
3569 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3570 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3571 then
3572 echo "Yup, we can."
3573 cppstdin="$wrapper"
3574 cppminus='';
3575 else
3576 echo "Nope, we'll have to live without it..."
3577 fi
3578 ;;
3579 esac
3580 case "$cpprun" in
3581 "$wrapper")
3582 cpprun=''
3583 cpplast=''
3584 ;;
3585 esac
3586 ;;
3587esac
3588
3589case "$cppstdin" in
3590"$wrapper"|'cppstdin') ;;
3591*) $rm -f $wrapper;;
3592esac
3593$rm -f testcpp.c testcpp.out
3594
bd9b35c9
JH
3595: Set private lib path
3596case "$plibpth" in
3597'') if ./mips; then
3598 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3599 fi;;
3600esac
3601case "$libpth" in
3602' ') dlist='';;
3603'') dlist="$loclibpth $plibpth $glibpth";;
3604*) dlist="$libpth";;
3605esac
3606
3607: Now check and see which directories actually exist, avoiding duplicates
3608libpth=''
3609for xxx in $dlist
3610do
3611 if $test -d $xxx; then
3612 case " $libpth " in
3613 *" $xxx "*) ;;
3614 *) libpth="$libpth $xxx";;
3615 esac
3616 fi
3617done
3618$cat <<'EOM'
3619
3620Some systems have incompatible or broken versions of libraries. Among
3621the directories listed in the question below, please remove any you
3622know not to be holding relevant libraries, and add any that are needed.
3623Say "none" for none.
8e07c86e
AD
3624
3625EOM
bd9b35c9
JH
3626case "$libpth" in
3627'') dflt='none';;
8e07c86e 3628*)
bd9b35c9
JH
3629 set X $libpth
3630 shift
3631 dflt=${1+"$@"}
8e07c86e 3632 ;;
a0d0e21e 3633esac
bd9b35c9
JH
3634rp="Directories to use for library searches?"
3635. ./myread
3636case "$ans" in
3637none) libpth=' ';;
3638*) libpth="$ans";;
3639esac
a0d0e21e 3640
bd9b35c9
JH
3641: compute shared library extension
3642case "$so" in
3643'')
3644 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3645 dflt='sl'
dd4e71fd 3646 else
bd9b35c9 3647 dflt='so'
dd4e71fd
JH
3648 fi
3649 ;;
bd9b35c9 3650*) dflt="$so";;
dd4e71fd 3651esac
dd4e71fd
JH
3652$cat <<EOM
3653
bd9b35c9 3654On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3655you want to suppress searching of shared libraries for the remainder
bd9b35c9 3656of this configuration.
dd4e71fd
JH
3657
3658EOM
bd9b35c9
JH
3659rp='What is the file extension used for shared libraries?'
3660. ./myread
3661so="$ans"
dd4e71fd 3662
bd9b35c9
JH
3663: Define several unixisms.
3664: Hints files or command line option can be used to override them.
3665: The convoluted testing is in case hints files set either the old
3666: or the new name.
3667case "$_exe" in
3668'') case "$exe_ext" in
3669 '') ;;
3670 *) _exe="$exe_ext" ;;
dd4e71fd 3671 esac
bd9b35c9 3672 ;;
bfb7748a 3673esac
bd9b35c9
JH
3674case "$_a" in
3675'') case "$lib_ext" in
3676 '') _a='.a';;
3677 *) _a="$lib_ext" ;;
dd4e71fd
JH
3678 esac
3679 ;;
dd4e71fd 3680esac
bd9b35c9
JH
3681case "$_o" in
3682'') case "$obj_ext" in
3683 '') _o='.o';;
3684 *) _o="$obj_ext";;
3685 esac
3686 ;;
3687esac
3688case "$p_" in
3689'') case "$path_sep" in
3690 '') p_=':';;
3691 *) p_="$path_sep";;
3692 esac
3693 ;;
3694esac
3695exe_ext=$_exe
3696lib_ext=$_a
3697obj_ext=$_o
3698path_sep=$p_
dd4e71fd 3699
bd9b35c9
JH
3700: Which makefile gets called first. This is used by make depend.
3701case "$firstmakefile" in
3702'') firstmakefile='makefile';;
4633a7c4 3703esac
4633a7c4 3704
bd9b35c9 3705cat <<EOM
4633a7c4 3706
bd9b35c9
JH
3707Perl can be built to use the SOCKS proxy protocol library. To do so,
3708Configure must be run with -Dusesocks.
4633a7c4 3709
bd9b35c9 3710Normally you do not need this and you should answer no.
8e07c86e 3711
bd9b35c9
JH
3712EOM
3713case "$usesocks" in
3714$define|true|[yY]*) dflt='y';;
3715*) dflt='n';;
3716esac
3717rp='Build Perl for SOCKS?'
3718. ./myread
3719case "$ans" in
3720y|Y) val="$define" ;;
3721*) val="$undef" ;;
3722esac
3723set usesocks
3724eval $setvar
3725
3726: Looking for optional libraries
3727echo " "
3728echo "Checking for optional libraries..." >&4
3729case "$libs" in
3730' '|'') dflt='';;
3731*) dflt="$libs";;
3732esac
3733case "$libswanted" in
3734'') libswanted='c_s';;
3735esac
3736case "$usesocks" in
3737$define)
3738 libswanted="$libswanted socks5 socks5_sh"
8e07c86e
AD
3739 ;;
3740esac
bd9b35c9
JH
3741for thislib in $libswanted; do
3742
3743 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3744 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3745 echo "Found -l$thislib (shared)."
3746 case " $dflt " in
3747 *"-l$thislib "*);;
3748 *) dflt="$dflt -l$thislib";;
3749 esac
3750 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3751 echo "Found -l$thislib (shared)."
3752 case " $dflt " in
3753 *"-l$thislib "*);;
3754 *) dflt="$dflt -l$thislib";;
3755 esac
3756 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3757 echo "Found -l$thislib."
3758 case " $dflt " in
3759 *"-l$thislib "*);;
3760 *) dflt="$dflt -l$thislib";;
3761 esac
3762 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3763 echo "Found -l$thislib."
3764 case " $dflt " in
3765 *"-l$thislib "*);;
3766 *) dflt="$dflt -l$thislib";;
3767 esac
3768 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3769 echo "Found -l${thislib}_s."
3770 case " $dflt " in
3771 *"-l$thislib "*);;
3772 *) dflt="$dflt -l${thislib}_s";;
3773 esac
3774 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3775 echo "Found -l$thislib."
3776 case " $dflt " in
3777 *"-l$thislib "*);;
3778 *) dflt="$dflt -l$thislib";;
3779 esac
3780 else
3781 echo "No -l$thislib."
3782 fi
3783done
3784set X $dflt
3785shift
3786dflt="$*"
3787case "$libs" in
3788'') dflt="$dflt";;
3789*) dflt="$libs";;
3790esac
3791case "$dflt" in
3792' '|'') dflt='none';;
3793esac
4633a7c4 3794
bd9b35c9 3795$cat <<EOM
4633a7c4 3796
bd9b35c9
JH
3797In order to compile $package on your machine, a number of libraries
3798are usually needed. Include any other special libraries here as well.
3799Say "none" for none. The default list is almost always right.
8e07c86e 3800EOM
8e07c86e 3801
bd9b35c9
JH
3802echo " "
3803rp="What libraries to use?"
3804. ./myread
3805case "$ans" in
3806none) libs=' ';;
3807*) libs="$ans";;
3808esac
d71b2b6b 3809
bd9b35c9
JH
3810: determine optimization, if desired, or use for debug flag also
3811case "$optimize" in
3812' '|$undef) dflt='none';;
3813'') dflt='-O';;
3814*) dflt="$optimize";;
3815esac
3816$cat <<EOH
d71b2b6b 3817
bd9b35c9
JH
3818By default, $package compiles with the -O flag to use the optimizer.
3819Alternately, you might want to use the symbolic debugger, which uses
3820the -g flag (on traditional Unix systems). Either flag can be
3821specified here. To use neither flag, specify the word "none".
d71b2b6b 3822
bd9b35c9
JH
3823EOH
3824rp="What optimizer/debugger flag should be used?"
3825. ./myread
3826optimize="$ans"
3827case "$optimize" in
3828'none') optimize=" ";;
3829esac
3830
3831dflt=''
3832: We will not override a previous value, but we might want to
3833: augment a hint file
3834case "$hint" in
3835default|recommended)
3836 case "$gccversion" in
3837 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3838 esac
bd9b35c9
JH
3839 case "$optimize" in
3840 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3841 esac
bd9b35c9
JH
3842 case "$gccversion" in
3843 2*) if test -d /etc/conf/kconfig.d &&
3844 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3845 then
3846 dflt="$dflt -posix"
3847 fi
f0d04425 3848 ;;
bd9b35c9
JH
3849 esac
3850 case "$gccversion" in
3851 1*) ;;
3852 2.[0-8]*) ;;
3853 ?*) echo " "
3854 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3855 echo 'int main(void) { return 0; }' > gcctest.c
3856 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3857 echo "Yes, it does." 2>&1
3858 case "$ccflags" in
3859 *strict-aliasing*)
3860 echo "Leaving current flags $ccflags alone." 2>&1
3861 ;;
3862 *) dflt="$dflt -fno-strict-aliasing" ;;
3863 esac
3864 else
3865 echo "Nope, it doesn't, but that's ok." 2>&1
3866 fi
f0d04425 3867 ;;
e5e20432
JH
3868 esac
3869 ;;
3870esac
3871
bd9b35c9
JH
3872case "$mips_type" in
3873*BSD*|'') inclwanted="$locincpth $usrinc";;
3874*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3875esac
3876for thisincl in $inclwanted; do
3877 if $test -d $thisincl; then
3878 if $test x$thisincl != x$usrinc; then
3879 case "$dflt" in
3880 *$thisincl*);;
3881 *) dflt="$dflt -I$thisincl";;
3882 esac
3883 fi
3884 fi
3885done
40a7a20a 3886
bd9b35c9
JH
3887inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3888 xxx=true;
3889elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3890 xxx=true;
3891else
3892 xxx=false;
3893fi;
3894if $xxx; then
3895 case "$dflt" in
3896 *$2*);;
3897 *) dflt="$dflt -D$2";;
3898 esac;
3899fi'
40a7a20a 3900
bd9b35c9 3901set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3902
bd9b35c9
JH
3903case "$usesocks" in
3904$define)
3905 ccflags="$ccflags -DSOCKS"
3906 ;;
3907esac
40a7a20a 3908
bd9b35c9
JH
3909case "$hint" in
3910default|recommended) dflt="$ccflags $dflt" ;;
3911*) dflt="$ccflags";;
3912esac
40a7a20a 3913
bd9b35c9
JH
3914case "$dflt" in
3915''|' ') dflt=none;;
3916esac
3917$cat <<EOH
40a7a20a 3918
bd9b35c9
JH
3919Your C compiler may want other flags. For this question you should include
3920-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3921but you should NOT include libraries or ld flags like -lwhatever. If you
3922want $package to honor its debug switch, you should include -DDEBUGGING here.
3923Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3924
bd9b35c9 3925To use no flags, specify the word "none".
40a7a20a 3926
bd9b35c9
JH
3927EOH
3928set X $dflt
3929shift
3930dflt=${1+"$@"}
3931rp="Any additional cc flags?"
3932. ./myread
3933case "$ans" in
3934none) ccflags='';;
3935*) ccflags="$ans";;
3936esac
8e07c86e 3937
bd9b35c9
JH
3938: the following weeds options from ccflags that are of no interest to cpp
3939cppflags="$ccflags"
3940case "$gccversion" in
39411*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3942esac
bd9b35c9
JH
3943case "$mips_type" in
3944'');;
3945*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3946esac
3947case "$cppflags" in
3948'');;
3949*)
3950 echo " "
3951 echo "Let me guess what the preprocessor flags are..." >&4
3952 set X $cppflags
3953 shift
3954 cppflags=''
3955 $cat >cpp.c <<'EOM'
3956#define BLURFL foo
8e07c86e 3957
bd9b35c9
JH
3958BLURFL xx LFRULB
3959EOM
3960 previous=''
3961 for flag in $*
3962 do
3963 case "$flag" in
3964 -*) ftry="$flag";;
3965 *) ftry="$previous $flag";;
3966 esac
3967 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3968 >cpp1.out 2>/dev/null && \
3969 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3970 >cpp2.out 2>/dev/null && \
3971 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3972 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3973 then
3974 cppflags="$cppflags $ftry"
3975 previous=''
3976 else
3977 previous="$flag"
3978 fi
3979 done
3980 set X $cppflags
3981 shift
3982 cppflags=${1+"$@"}
3983 case "$cppflags" in
3984 *-*) echo "They appear to be: $cppflags";;
3985 esac
3986 $rm -f cpp.c cpp?.out
2afac517 3987 ;;
3988esac
8e07c86e 3989
bd9b35c9
JH
3990: flags used in final linking phase
3991case "$ldflags" in
3992'') if ./venix; then
3993 dflt='-i -z'
10a23457 3994 else
bd9b35c9 3995 dflt=''
10a23457 3996 fi
bd9b35c9
JH
3997 case "$ccflags" in
3998 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 3999 esac
bd9b35c9
JH
4000 ;;
4001*) dflt="$ldflags";;
4002esac
4003
4004: Try to guess additional flags to pick up local libraries.
4005for thislibdir in $libpth; do
4006 case " $loclibpth " in
4007 *" $thislibdir "*)
4008 case "$dflt " in
4009 *"-L$thislibdir "*) ;;
4010 *) dflt="$dflt -L$thislibdir" ;;
4011 esac
c4f23d77
AD
4012 ;;
4013 esac
bd9b35c9 4014done
c4f23d77 4015
bd9b35c9
JH
4016case "$dflt" in
4017'') dflt='none' ;;
4018esac
c4f23d77 4019
bd9b35c9
JH
4020$cat <<EOH
4021
4022Your C linker may need flags. For this question you should
4023include -L/whatever and any other flags used by the C linker, but you
4024should NOT include libraries like -lwhatever.
4025
4026Make sure you include the appropriate -L/path flags if your C linker
4027does not normally search all of the directories you specified above,
4028namely
4029 $libpth
4030To use no flags, specify the word "none".
4031
4032EOH
4033
4034rp="Any additional ld flags (NOT including libraries)?"
4035. ./myread
4036case "$ans" in
4037none) ldflags='';;
4038*) ldflags="$ans";;
4039esac
4040rmlist="$rmlist pdp11"
4041
4042: coherency check
4043echo " "
4044echo "Checking your choice of C compiler and flags for coherency..." >&4
4045$cat > try.c <<'EOF'
4046#include <stdio.h>
4047int main() { printf("Ok\n"); exit(0); }
4048EOF
4049set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4050shift
4051$cat >try.msg <<'EOM'
4052I've tried to compile and run the following simple program:
4053
4054EOM
4055$cat try.c >> try.msg
4056
4057$cat >> try.msg <<EOM
4058
4059I used the command:
4060
4061 $*
4062 ./try
4063
4064and I got the following output:
4065
4066EOM
4067dflt=y
4068if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4069 if sh -c './try' >>try.msg 2>&1; then
4070 xxx=`./try`
4071 case "$xxx" in
4072 "Ok") dflt=n ;;
4073 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4074 case " $libs " in
4075 *" -lsfio "*)
4076 cat >> try.msg <<'EOQS'
4077If $libs contains -lsfio, and sfio is mis-configured, then it
4078sometimes (apparently) runs and exits with a 0 status, but with no
4079output! It may have to do with sfio's use of _exit vs. exit.
4080
4081EOQS
4082 rp="You have a big problem. Shall I abort Configure"
4083 dflt=y
4084 ;;
4085 esac
4086 ;;
4087 esac
4088 else
4089 echo "The program compiled OK, but exited with status $?." >>try.msg
4090 rp="You have a problem. Shall I abort Configure"
4091 dflt=y
4092 fi
4093else
4094 echo "I can't compile the test program." >>try.msg
4095 rp="You have a BIG problem. Shall I abort Configure"
4096 dflt=y
4097fi
4098case "$dflt" in
4099y)
4100 $cat try.msg >&4
4101 case "$knowitall" in
4102 '')
4103 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4104 ;;
bd9b35c9 4105 *) dflt=n;;
c4f23d77 4106 esac
bd9b35c9
JH
4107 echo " "
4108 . ./myread
4109 case "$ans" in
4110 n*|N*) ;;
4111 *) echo "Ok. Stopping Configure." >&4
4112 exit 1
c4f23d77
AD
4113 ;;
4114 esac
4115 ;;
bd9b35c9 4116n) echo "OK, that should do.";;
c4f23d77 4117esac
bd9b35c9 4118$rm -f try try.* core
c4f23d77 4119
bd9b35c9
JH
4120: define an is-a-typedef? function
4121typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4122case "$inclist" in
4123"") inclist="sys/types.h";;
4124esac;
4125eval "varval=\$$var";
4126case "$varval" in
4127"")
4128 $rm -f temp.c;
4129 for inc in $inclist; do
4130 echo "#include <$inc>" >>temp.c;
4131 done;
4132 echo "#ifdef $type" >> temp.c;
4133 echo "printf(\"We have $type\");" >> temp.c;
4134 echo "#endif" >> temp.c;
4135 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4136 if $contains $type temp.E >/dev/null 2>&1; then
4137 eval "$var=\$type";
4138 else
4139 eval "$var=\$def";
4140 fi;
4141 $rm -f temp.?;;
4142*) eval "$var=\$varval";;
4143esac'
8e07c86e 4144
bd9b35c9
JH
4145: define an is-a-typedef? function that prompts if the type is not available.
4146typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4147case "$inclist" in
4148"") inclist="sys/types.h";;
4149esac;
4150eval "varval=\$$var";
4151case "$varval" in
4152"")
4153 $rm -f temp.c;
4154 for inc in $inclist; do
4155 echo "#include <$inc>" >>temp.c;
4156 done;
4157 echo "#ifdef $type" >> temp.c;
4158 echo "printf(\"We have $type\");" >> temp.c;
4159 echo "#endif" >> temp.c;
4160 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4161 echo " " ;
4162 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4163 if $contains $type temp.E >/dev/null 2>&1; then
4164 echo "$type found." >&4;
4165 eval "$var=\$type";
4166 else
4167 echo "$type NOT found." >&4;
4168 dflt="$def";
4169 . ./myread ;
4170 eval "$var=\$ans";
4171 fi;
4172 $rm -f temp.?;;
4173*) eval "$var=\$varval";;
4174esac'
8e07c86e 4175
bd9b35c9
JH
4176: define a shorthand compile call
4177compile='
4178mc_file=$1;
4179shift;
4180$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4181: define a shorthand compile call for compilations that should be ok.
4182compile_ok='
4183mc_file=$1;
4184shift;
4185$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
8e07c86e 4186
bd9b35c9
JH
4187: check for lengths of integral types
4188echo " "
4189case "$intsize" in
2afac517 4190'')
bd9b35c9
JH
4191 echo "Checking to see how big your integers are..." >&4
4192 $cat >intsize.c <<'EOCP'
4193#include <stdio.h>
4194int main()
4195{
4196 printf("intsize=%d;\n", (int)sizeof(int));
4197 printf("longsize=%d;\n", (int)sizeof(long));
4198 printf("shortsize=%d;\n", (int)sizeof(short));
4199 exit(0);
4200}
4201EOCP
4202 set intsize
4203 if eval $compile_ok && ./intsize > /dev/null; then
4204 eval `./intsize`
4205 echo "Your integers are $intsize bytes long."
4206 echo "Your long integers are $longsize bytes long."
4207 echo "Your short integers are $shortsize bytes long."
2afac517 4208 else
bd9b35c9
JH
4209 $cat >&4 <<EOM
4210!
4211Help! I can't compile and run the intsize test program: please enlighten me!
4212(This is probably a misconfiguration in your system or libraries, and
4213you really ought to fix it. Still, I'll try anyway.)
4214!
4215EOM
4216 dflt=4
4217 rp="What is the size of an integer (in bytes)?"
4218 . ./myread
4219 intsize="$ans"
4220 dflt=$intsize
4221 rp="What is the size of a long integer (in bytes)?"
4222 . ./myread
4223 longsize="$ans"
4224 dflt=2
4225 rp="What is the size of a short integer (in bytes)?"
4226 . ./myread
4227 shortsize="$ans"
2afac517 4228 fi
4229 ;;
8e07c86e 4230esac
bd9b35c9
JH
4231$rm -f intsize intsize.*
4232
4233: see what type lseek is declared as in the kernel
4234rp="What is the type used for lseek's offset on this system?"
4235set off_t lseektype long stdio.h sys/types.h
4236eval $typedef_ask
4237
4238echo " "
4239$echo $n "Checking to see how big your file offsets are...$c" >&4
4240$cat >try.c <<EOCP
4241#include <sys/types.h>
4242#include <stdio.h>
4243int main()
4244{
4245 printf("%d\n", (int)sizeof($lseektype));
4246 return(0);
4247}
4248EOCP
4249set try
4250if eval $compile_ok; then
4251 lseeksize=`./try`
4252 $echo " $lseeksize bytes." >&4
4253else
4254 dflt=$longsize
4255 echo " "
4256 echo "(I can't seem to compile the test program. Guessing...)"
4257 rp="What is the size of your file offsets (in bytes)?"
4258 . ./myread
4259 lseeksize="$ans"
4260fi
4261$rm -f try.c try
4262
4263: see what type file positions are declared as in the library
4264rp="What is the type for file position used by fsetpos()?"
4265set fpos_t fpostype long stdio.h sys/types.h
4266eval $typedef_ask
4267
4268echo " "
4269case "$fpostype" in
4270*_t) zzz="$fpostype" ;;
4271*) zzz="fpos_t" ;;
4272esac
4273$echo $n "Checking the size of $zzz...$c" >&4
4274cat > try.c <<EOCP
4275#include <sys/types.h>
4276#include <stdio.h>
4277int main() {
4278 printf("%d\n", (int)sizeof($fpostype));
4279 exit(0);
4280}
4281EOCP
4282set try
4283if eval $compile_ok; then
4284 yyy=`./try`
4285 case "$yyy" in
4286 '') fpossize=4
4287 echo " "
4288 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4289 ;;
4290 *) fpossize=$yyy
4291 echo " $fpossize bytes."
4292 ;;
4293 esac
4294else
4295 dflt="$longsize"
4296 echo " "
4297 echo "(I can't compile the test program. Guessing...)" >&4
4298 rp="What is the size of your file positions (in bytes)?"
4299 . ./myread
4300 fpossize="$ans"
4301fi
4302
4303
8e07c86e 4304
bd9b35c9
JH
4305case "$lseeksize:$fpossize" in
43068:8) cat <<EOM
8e07c86e 4307
bd9b35c9 4308You can have files larger than 2 gigabytes.
8e07c86e 4309EOM
bd9b35c9
JH
4310 val="$define" ;;
4311*) cat <<EOM
8e07c86e 4312
bd9b35c9
JH
4313Perl can be built to understand large files (files larger than 2 gigabytes)
4314on some systems. To do so, Configure must be run with -Duselargefiles.
4315
4316If this doesn't make any sense to you, just accept the default 'y'.
4317EOM
4318 case "$uselargefiles" in
4319 "$undef"|false|[nN]*) dflt='n' ;;
4320 *) dflt='y' ;;
4321 esac
4322 rp='Try to understand large files, if available?'
4323 . ./myread
4324 case "$ans" in
4325 y|Y) val="$define" ;;
4326 *) val="$undef" ;;
4327 esac
4328 ;;
dfe9444c 4329esac
bd9b35c9
JH
4330set uselargefiles
4331eval $setvar
4332case "$uselargefiles" in
4333"$define")
4334: Look for a hint-file generated 'call-back-unit'. If the
4335: user has specified that a large files perl is to be built,
4336: we may need to set or change some other defaults.
4337 if $test -f uselfs.cbu; then
4338 echo "Your platform has some specific hints for large file builds, using them..."
4339 . ./uselfs.cbu
4340 echo " "
4341 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4342 $cat >try.c <<EOCP
4343#include <sys/types.h>
4344#include <stdio.h>
4345int main()
4346{
4347 printf("%d\n", (int)sizeof($lseektype));
4348 return(0);
4349}
4350EOCP
4351 set try
4352 if eval $compile_ok; then
4353 lseeksize=`./try`
4354 $echo " $lseeksize bytes." >&4
4355 else
4356 dflt="$lseeksize"
4357 echo " "
4358 echo "(I can't seem to compile the test program. Guessing...)"
4359 rp="What is the size of your file offsets (in bytes)?"
4360 . ./myread
4361 lseeksize="$ans"
4362 fi
4363 case "$fpostype" in
4364 *_t) zzz="$fpostype" ;;
4365 *) zzz="fpos_t" ;;
4366 esac
4367 $echo $n "Rechecking the size of $zzz...$c" >&4
4368 $cat > try.c <<EOCP
4369#include <sys/types.h>
4370#include <stdio.h>
4371int main() {
4372 printf("%d\n", (int)sizeof($fpostype));
4373 exit(0);
4374}
4375EOCP
4376 set try
4377 if eval $compile_ok; then
4378 yyy=`./try`
4379 dflt="$lseeksize"
4380 case "$yyy" in
4381 '') echo " "
4382 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4383 ;;
4384 *) fpossize=$yyy
4385 echo " $fpossize bytes."
4386 ;;
4387 esac
4388 else
4389 dflt="$fpossize"
4390 echo " "
4391 echo "(I can't compile the test program. Guessing...)" >&4
4392 rp="What is the size of your file positions (in bytes)?"
4393 . ./myread
4394 fpossize="$ans"
4395 fi
4396 $rm -f try.c try
4397 fi
dfe9444c
AD
4398 ;;
4399esac
bd9b35c9
JH
4400
4401
4402case "$usemorebits" in
4403"$define"|true|[yY]*)
4404 use64bits="$define"
4405 uselongdouble="$define"
4406 usemorebits="$define"
dfe9444c 4407 ;;
bd9b35c9 4408*) usemorebits="$undef"
dfe9444c
AD
4409 ;;
4410esac
dfe9444c 4411
dfe9444c 4412
bd9b35c9
JH
4413case "$intsize:$longsize" in
44148:*|*:8) cat <<EOM
29209bc5 4415
bd9b35c9
JH
4416You have natively 64-bit integers.
4417EOM
4418 val="$define" ;;
4419*) cat <<EOM
29209bc5 4420
bd9b35c9
JH
4421Perl can be built to take advantage of 64-bit integer types
4422on some systems. To do so, Configure must be run with -Duse64bits.
29209bc5 4423
bd9b35c9 4424If this doesn't make any sense to you, just accept the default.
29209bc5 4425EOM
bd9b35c9
JH
4426 case "$use64bits" in
4427 $define|true|[yY]*) dflt='y';;
4428 *) dflt='n';;
4429 esac
4430 rp='Try to use 64-bit integers, if available?'
4431 . ./myread
4432 case "$ans" in
4433 y|Y) val="$define" ;;
4434 *) val="$undef" ;;
4435 esac
4436 ;;
29209bc5 4437esac
bd9b35c9 4438set use64bits
29209bc5
JH
4439eval $setvar
4440
bd9b35c9
JH
4441case "$archname64" in
4442'') archname64='' ;; # not a typo
4443esac
4444
4445case "$use64bits" in
4446"$define"|true|[yY]*)
4447: Look for a hint-file generated 'call-back-unit'. If the
4448: user has specified that a 64-bit perl is to be built,
4449: we may need to set or change some other defaults.
4450 if $test -f use64bits.cbu; then
4451 echo "Your platform has some specific hints for 64-bit builds, using them..."
4452 . ./use64bits.cbu
4453 else
4454 $cat <<EOM
4455(Your platform doesn't have any specific hints for 64-bit builds.)
4456EOM
4457 case "$intsize:$longsize" in
44588:*|*:8) cat <<EOM
4459(This is probably okay, as your system is a natively 64-bit system.)
4460EOM
4461 ;;
4462 esac
4463 case "$gccversion" in
4464 '') ;;
4465 *) case "$ccflags" in
4466 *-DUSE_LONG_LONG*) ;;
4467 *) $cat <<EOM
4468But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4469to the compilation flags.
4470EOM
4471 ccflags="$ccflags -DUSE_LONG_LONG"
4472 ;;
4473 esac
4474 ;;
4475 esac
4476 fi
4477 ;;
4478esac
4479
4480: determine the architecture name
2afac517 4481echo " "
bd9b35c9
JH
4482if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4483 tarch=`arch`"-$osname"
4484elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4485 if uname -m > tmparch 2>&1 ; then
4486 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4487 -e 's/$/'"-$osname/" tmparch`
4488 else
4489 tarch="$osname"
4490 fi
4491 $rm -f tmparch
4492else
4493 tarch="$osname"
4494fi
4495case "$myarchname" in
4496''|"$tarch") ;;
4497*)
4498 echo "(Your architecture name used to be $myarchname.)"
4499 archname=''
4500 ;;
8e07c86e 4501esac
bd9b35c9
JH
4502myarchname="$tarch"
4503case "$archname" in
4504'') dflt="$tarch";;
4505*) dflt="$archname";;
2afac517 4506esac
bd9b35c9
JH
4507rp='What is your architecture name'
4508. ./myread
4509archname="$ans"
4510case "$usethreads" in
29209bc5 4511$define)
bd9b35c9
JH
4512 echo "Threads selected." >&4
4513 case "$archname" in
4514 *-thread*) echo "...and architecture name already has -thread." >&4
4515 ;;
4516 *) archname="$archname-thread"
4517 echo "...setting architecture name to $archname." >&4
4518 ;;
4519 esac
29209bc5
JH
4520 ;;
4521esac
bd9b35c9
JH
4522case "$usemultiplicity" in
4523$define)
4524 echo "Multiplicity selected." >&4
4525 case "$archname" in
4526 *-multi*) echo "...and architecture name already has -multi." >&4
4527 ;;
4528 *) archname="$archname-multi"
4529 echo "...setting architecture name to $archname." >&4
4530 ;;
4531 esac
4532 ;;
4533esac
4534case "$use64bits" in
4535$define)
4536 case "$archname64" in
4537 '')
4538 ;;
4539 *)
4540 case "$archname" in
4541 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4542 ;;
4543 *) archname="$archname-$archname64"
4544 echo "...setting architecture name to $archname." >&4
4545 ;;
4546 esac
4547 ;;
4548 esac
4549esac
4550
4551: determine root of directory hierarchy where package will be installed.
4552case "$prefix" in
4553'')
4554 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4555 ;;
4556*)
4557 dflt="$prefix"
4558 ;;
4559esac
4560$cat <<EOM
4561
4562By default, $package will be installed in $dflt/bin, manual pages
4563under $dflt/man, etc..., i.e. with $dflt as prefix for all
4564installation directories. Typically this is something like /usr/local.
4565If you wish to have binaries under /usr/bin but other parts of the
4566installation under /usr/local, that's ok: you will be prompted
4567separately for each of the installation directories, the prefix being
4568only used to set the defaults.
4569
4570EOM
4571fn=d~
4572rp='Installation prefix to use?'
4573. ./getfile
4574oldprefix=''
4575case "$prefix" in
4576'') ;;
4577*)
4578 case "$ans" in
4579 "$prefix") ;;
4580 *) oldprefix="$prefix";;
4581 esac
4582 ;;
4583esac
4584prefix="$ans"
4585prefixexp="$ansexp"
4586
4587: is AFS running?
4588echo " "
4589case "$afs" in
4590$define|true) afs=true ;;
4591$undef|false) afs=false ;;
4592*) if test -d /afs; then
4593 afs=true
2afac517 4594 else
bd9b35c9 4595 afs=false
2afac517 4596 fi
bd9b35c9 4597 ;;
8e07c86e 4598esac
bd9b35c9
JH
4599if $afs; then
4600 echo "AFS may be running... I'll be extra cautious then..." >&4
4601else
4602 echo "AFS does not seem to be running..." >&4
4603fi
2afac517 4604
bd9b35c9
JH
4605: determine installation prefix for where package is to be installed.
4606if $afs; then
4633a7c4 4607$cat <<EOM
29209bc5 4608
bd9b35c9
JH
4609Since you are running AFS, I need to distinguish the directory in which
4610files will reside from the directory in which they are installed (and from
4611which they are presumably copied to the former directory by occult means).
4612
4633a7c4 4613EOM
bd9b35c9
JH
4614 case "$installprefix" in
4615 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4616 *) dflt="$installprefix";;
4617 esac
4618else
4619$cat <<EOM
2afac517 4620
bd9b35c9
JH
4621In some special cases, particularly when building $package for distribution,
4622it is convenient to distinguish between the directory in which files should
4623be installed from the directory ($prefix) in which they
4624will eventually reside. For most users, these two directories are the same.
8e07c86e 4625
bd9b35c9
JH
4626EOM
4627 case "$installprefix" in
4628 '') dflt=$prefix ;;
4629 *) dflt=$installprefix;;
4630 esac
4631fi
4632fn=d~
4633rp='What installation prefix should I use for installing files?'
4634. ./getfile
4635installprefix="$ans"
4636installprefixexp="$ansexp"
4633a7c4 4637
bd9b35c9
JH
4638: set the prefixit variable, to compute a suitable default value
4639prefixit='case "$3" in
4640""|none)
4641 case "$oldprefix" in
4642 "") eval "$1=\"\$$2\"";;
4643 *)
4644 case "$3" in
4645 "") eval "$1=";;
4646 none)
4647 eval "tp=\"\$$2\"";
4648 case "$tp" in
4649 ""|" ") eval "$1=\"\$$2\"";;
4650 *) eval "$1=";;
4651 esac;;
4652 esac;;
4653 esac;;
4654*)
4655 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4656 case "$tp" in
4657 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4658 /*-$oldprefix/*|\~*-$oldprefix/*)
4659 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4660 *) eval "$1=\"\$$2\"";;
4661 esac;;
4662esac'
4633a7c4 4663
ff935051
JH
4664: set the base revision
4665baserev=5.0
4666
4667
4668: get the patchlevel
bd9b35c9
JH
4669echo " "
4670echo "Getting the current patchlevel..." >&4
4671if $test -r $rsrc/patchlevel.h;then
4672 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4673 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff935051
JH
4674 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4675 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4676 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bd9b35c9
JH
4677else
4678 patchlevel=0
4679 subversion=0
ff935051
JH
4680 api_revision=0
4681 api_version=0
4682 api_subversion=0
bd9b35c9
JH
4683fi
4684$echo $n "(You have $package" $c
4685case "$package" in
4686"*$baserev") ;;
4687*) $echo $n " $baserev" $c ;;
4633a7c4 4688esac
bd9b35c9
JH
4689$echo $n " patchlevel $patchlevel" $c
4690test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4691echo ".)"
ff935051 4692case "$osname" in
3635cd84 4693dos|vms)
ff935051
JH
4694 : XXX Should be a Configure test for double-dots in filenames.
4695 version=`echo $baserev $patchlevel $subversion | \
273cf8d1 4696 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
ff935051
JH
4697 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4698 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4699 ;;
4700*)
4701 version=`echo $baserev $patchlevel $subversion | \
4702 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4703 api_versionstring=`echo $api_revision $api_version $api_subversion | \
273cf8d1 4704 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
ff935051
JH
4705 ;;
4706esac
4707: Special case the 5.005_xx maintenance series, which used 5.005
4708: without any subversion label as a subdirectory in $sitelib
4709if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4710 api_versionstring='5.005'
273cf8d1 4711fi
bd9b35c9
JH
4712
4713: determine installation style
4714: For now, try to deduce it from prefix unless it is already set.
4715: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4716case "$installstyle" in
4717'') case "$prefix" in
4718 *perl*) dflt='lib';;
4719 *) dflt='lib/perl5' ;;
34d1710f 4720 esac
4633a7c4 4721 ;;
bd9b35c9 4722*) dflt='lib/perl5' ;;
4633a7c4 4723esac
bd9b35c9
JH
4724: Probably not worth prompting for this since we prompt for all
4725: the directories individually, and the prompt would be too long and
4726: confusing anyway.
4727installstyle=$dflt
4633a7c4 4728
bd9b35c9
JH
4729: determine where private library files go
4730: Usual default is /usr/local/lib/perl5/$version.
4731: Also allow things like /opt/perl/lib/$version, since
4732: /opt/perl/lib/perl5... would be redundant.
4733: The default "style" setting is made in installstyle.U
4734case "$installstyle" in
4735*lib/perl5*) set dflt privlib lib/$package/$version ;;
4736*) set dflt privlib lib/$version ;;
a4f3eea9 4737esac
bd9b35c9
JH
4738eval $prefixit
4739$cat <<EOM
a4f3eea9 4740
bd9b35c9
JH
4741There are some auxiliary files for $package that need to be put into a
4742private library directory that is accessible by everyone.
4743
4744EOM
4745fn=d~+
4746rp='Pathname where the private library files will reside?'
4747. ./getfile
4748privlib="$ans"
4749privlibexp="$ansexp"
4750: Change installation prefix, if necessary.
4751if $test X"$prefix" != X"$installprefix"; then
4752 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
a4f3eea9 4753else
bd9b35c9
JH
4754 installprivlib="$privlibexp"
4755fi
a4f3eea9 4756
bd9b35c9
JH
4757: set the prefixup variable, to restore leading tilda escape
4758prefixup='case "$prefixexp" in
4759"$prefix") ;;
4760*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4761esac'
a4f3eea9 4762
bd9b35c9
JH
4763: determine where public architecture dependent libraries go
4764set archlib archlib
4765eval $prefixit
4766: privlib default is /usr/local/lib/$package/$version
4767: archlib default is /usr/local/lib/$package/$version/$archname
4768: privlib may have an optional trailing /share.
4769tdflt=`echo $privlib | $sed 's,/share$,,'`
4770tdflt=$tdflt/$archname
4771case "$archlib" in
4772'') dflt=$tdflt
29209bc5 4773 ;;
bd9b35c9
JH
4774*) dflt="$archlib"
4775 ;;
29209bc5 4776esac
bd9b35c9 4777$cat <<EOM
29209bc5 4778
bd9b35c9
JH
4779$spackage contains architecture-dependent library files. If you are
4780sharing libraries in a heterogeneous environment, you might store
4781these files in a separate location. Otherwise, you can just include
4782them with the rest of the public library files.
a4f3eea9 4783
bd9b35c9
JH
4784EOM
4785fn=d+~
4786rp='Where do you want to put the public architecture-dependent libraries?'
4787. ./getfile
4788archlib="$ans"
4789archlibexp="$ansexp"
4790if $test X"$archlib" = X"$privlib"; then
4791 d_archlib="$undef"
4792else
4793 d_archlib="$define"
4794fi
4795: Change installation prefix, if necessary.
4796if $test X"$prefix" != X"$installprefix"; then
4797 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4798else
4799 installarchlib="$archlibexp"
4800fi
a4f3eea9 4801
a4f3eea9 4802
bd9b35c9
JH
4803: Binary compatibility with 5.005 is not possible for builds
4804: with advanced features
4805case "$usethreads$usemultiplicity" in
4806*define*)
4807 bincompat5005="$undef"
4808 d_bincompat5005="$undef"
4809 ;;
4810*) $cat <<EOM
a4f3eea9 4811
bd9b35c9
JH
4812Perl 5.006 can be compiled for binary compatibility with 5.005.
4813If you decide to do so, you will be able to continue using most
4814of the extensions that were compiled for Perl 5.005.
a4f3eea9 4815
a4f3eea9 4816EOM
bd9b35c9
JH
4817 case "$bincompat5005$d_bincompat5005" in
4818 *"$undef"*) dflt=n ;;
4819 *) dflt=y ;;
a4f3eea9 4820 esac
bd9b35c9
JH
4821 rp='Binary compatibility with Perl 5.005?'
4822 . ./myread
4823 case "$ans" in
4824 y*) val="$define" ;;
4825 *) val="$undef" ;;
a4f3eea9 4826 esac
bd9b35c9
JH
4827 set d_bincompat5005
4828 eval $setvar
4829 case "$d_bincompat5005" in
4830 "$define")
4831 bincompat5005="$define"
4832 ;;
4833 *) bincompat5005="$undef"
4834 d_bincompat5005="$undef"
a4f3eea9 4835 ;;
4836 esac
bd9b35c9 4837 ;;
a4f3eea9 4838esac
4839
a4f3eea9 4840
bd9b35c9
JH
4841: see if setuid scripts can be secure
4842$cat <<EOM
a4f3eea9 4843
bd9b35c9
JH
4844Some kernels have a bug that prevents setuid #! scripts from being
4845secure. Some sites have disabled setuid #! scripts because of this.
a4f3eea9 4846
bd9b35c9
JH
4847First let's decide if your kernel supports secure setuid #! scripts.
4848(If setuid #! scripts would be secure but have been disabled anyway,
4849don't say that they are secure if asked.)
5ff3f7a4
GS
4850
4851EOM
a4f3eea9 4852
bd9b35c9
JH
4853val="$undef"
4854if $test -d /dev/fd; then
4855 echo "#!$ls" >reflect
4856 chmod +x,u+s reflect
4857 ./reflect >flect 2>&1
4858 if $contains "/dev/fd" flect >/dev/null; then
4859 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4860 val="$define"
4861 else
4862 $cat <<EOM
4863If you are not sure if they are secure, I can check but I'll need a
4864username and password different from the one you are using right now.
4865If you don't have such a username or don't want me to test, simply
4866enter 'none'.
a4f3eea9 4867
4868EOM
bd9b35c9
JH
4869 rp='Other username to test security of setuid scripts with?'
4870 dflt='none'
4871 . ./myread
4872 case "$ans" in
4873 n|none)
4874 case "$d_suidsafe" in
4875 '') echo "I'll assume setuid scripts are *not* secure." >&4
4876 dflt=n;;
4877 "$undef")
4878 echo "Well, the $hint value is *not* secure." >&4
4879 dflt=n;;
4880 *) echo "Well, the $hint value *is* secure." >&4
4881 dflt=y;;
dfe9444c
AD
4882 esac
4883 ;;
bd9b35c9
JH
4884 *)
4885 $rm -f reflect flect
4886 echo "#!$ls" >reflect
4887 chmod +x,u+s reflect
4888 echo >flect
4889 chmod a+w flect
4890 echo '"su" will (probably) prompt you for '"$ans's password."
4891 su $ans -c './reflect >flect'
4892 if $contains "/dev/fd" flect >/dev/null; then
4893 echo "Okay, it looks like setuid scripts are secure." >&4
4894 dflt=y
4895 else
4896 echo "I don't think setuid scripts are secure." >&4
4897 dflt=n
4898 fi
4899 ;;
4900 esac
4901 rp='Does your kernel have *secure* setuid scripts?'
4902 . ./myread
4903 case "$ans" in
4904 [yY]*) val="$define";;
4905 *) val="$undef";;
dfe9444c 4906 esac
a4f3eea9 4907 fi
4908else
bd9b35c9
JH
4909 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4910 echo "(That's for file descriptors, not floppy disks.)"
4911 val="$undef"
a4f3eea9 4912fi
bd9b35c9
JH
4913set d_suidsafe
4914eval $setvar
4915
4916$rm -f reflect flect
4917
4918: now see if they want to do setuid emulation
4919echo " "
4920val="$undef"
4921case "$d_suidsafe" in
4922"$define")
4923 val="$undef"
4924 echo "No need to emulate SUID scripts since they are secure here." >& 4
4925 ;;
4926*)
4927 $cat <<EOM
4928Some systems have disabled setuid scripts, especially systems where
4929setuid scripts cannot be secure. On systems where setuid scripts have
4930been disabled, the setuid/setgid bits on scripts are currently
4931useless. It is possible for $package to detect those bits and emulate
4932setuid/setgid in a secure fashion. This emulation will only work if
4933setuid scripts have been disabled in your kernel.
4934
4935EOM
4936 case "$d_dosuid" in
4937 "$define") dflt=y ;;
4938 *) dflt=n ;;
a4f3eea9 4939 esac
bd9b35c9 4940 rp="Do you want to do setuid/setgid emulation?"
a4f3eea9 4941 . ./myread
4942 case "$ans" in
bd9b35c9
JH
4943 [yY]*) val="$define";;
4944 *) val="$undef";;
a4f3eea9 4945 esac
4946 ;;
a4f3eea9 4947esac
bd9b35c9
JH
4948set d_dosuid
4949eval $setvar
a4f3eea9 4950
bfb7748a
AD
4951: determine filename position in cpp output
4952echo " "
4953echo "Computing filename position in cpp output for #include directives..." >&4
4954echo '#include <stdio.h>' > foo.c
4955$cat >fieldn <<EOF
4956$startsh
4957$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4958$grep '^[ ]*#.*stdio\.h' | \
4959while read cline; do
4960 pos=1
4961 set \$cline
4962 while $test \$# -gt 0; do
4963 if $test -r \`echo \$1 | $tr -d '"'\`; then
4964 echo "\$pos"
4965 exit 0
4966 fi
4967 shift
4968 pos=\`expr \$pos + 1\`
4969 done
4970done
4971EOF
4972chmod +x fieldn
4973fieldn=`./fieldn`
4974$rm -f foo.c fieldn
4975case $fieldn in
4976'') pos='???';;
49771) pos=first;;
49782) pos=second;;
49793) pos=third;;
4980*) pos="${fieldn}th";;
4981esac
4982echo "Your cpp writes the filename in the $pos field of the line."
4983
4984: locate header file
4985$cat >findhdr <<EOF
4986$startsh
4987wanted=\$1
9cc6feab 4988name=''
3656fc86
JH
4989for usrincdir in $usrinc
4990do
4991 if test -f \$usrincdir/\$wanted; then
4992 echo "\$usrincdir/\$wanted"
4993 exit 0
4994 fi
4995done
bfb7748a
AD
4996awkprg='{ print \$$fieldn }'
4997echo "#include <\$wanted>" > foo\$\$.c
4998$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4999$grep "^[ ]*#.*\$wanted" | \
5000while read cline; do
5001 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5002 case "\$name" in
4e400192
JH
5003 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5004 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5005 *) exit 2;;
bfb7748a
AD
5006 esac;
5007done;
4e400192
JH
5008#
5009# status = 0: grep returned 0 lines, case statement not executed
5010# status = 1: headerfile found
5011# status = 2: while loop executed, no headerfile found
5012#
5013status=\$?
bfb7748a 5014$rm -f foo\$\$.c;
4e400192
JH
5015if test \$status -eq 1; then
5016 exit 0;
5017fi
5018exit 1
bfb7748a
AD
5019EOF
5020chmod +x findhdr
5021
5022: define an alternate in-header-list? function
5023inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5024cont=true; xxf="echo \"<\$1> found.\" >&4";
5025case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5026*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5027esac;
5028case $# in 4) instead=instead;; *) instead="at last";; esac;
5029while $test "$cont"; do
5030 xxx=`./findhdr $1`
5031 var=$2; eval "was=\$$2";
5032 if $test "$xxx" && $test -r "$xxx";
5033 then eval $xxf;
5034 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5035 cont="";
5036 else eval $xxnf;
5037 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5038 set $yyy; shift; shift; yyy=$@;
5039 case $# in 0) cont="";;
5040 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5041 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5042 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5043 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5044 esac;
5045done;
5046while $test "$yyy";
5047do set $yyy; var=$2; eval "was=\$$2";
5048 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5049 set $yyy; shift; shift; yyy=$@;
5050done'
5051
5052: see if this is a malloc.h system
5053set malloc.h i_malloc
5054eval $inhdr
5055
5056: see if stdlib is available
5057set stdlib.h i_stdlib
5058eval $inhdr
5059
5060: determine which malloc to compile in
5061echo " "
5062case "$usemymalloc" in
5ff3f7a4
GS
5063''|[yY]*|true|$define) dflt='y' ;;
5064*) dflt='n' ;;
bfb7748a
AD
5065esac
5066rp="Do you wish to attempt to use the malloc that comes with $package?"
5067. ./myread
5068usemymalloc="$ans"
5069case "$ans" in
5070y*|true)
5071 usemymalloc='y'
5072 mallocsrc='malloc.c'
5073 mallocobj="malloc$_o"
5074 d_mymalloc="$define"
5075 case "$libs" in
5076 *-lmalloc*)
5077 : Remove malloc from list of libraries to use
5078 echo "Removing unneeded -lmalloc from library list" >&4
5079 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5080 shift
5081 libs="$*"
5082 echo "libs = $libs" >&4
5083 ;;
5084 esac
5085 ;;
5086*)
5087 usemymalloc='n'
5088 mallocsrc=''
5089 mallocobj=''
5090 d_mymalloc="$undef"
5091 ;;
5092esac
5093
5094: compute the return types of malloc and free
5095echo " "
5096$cat >malloc.c <<END
5097#$i_malloc I_MALLOC
5098#$i_stdlib I_STDLIB
5099#include <stdio.h>
5100#include <sys/types.h>
5101#ifdef I_MALLOC
5102#include <malloc.h>
5103#endif
5104#ifdef I_STDLIB
5105#include <stdlib.h>
5106#endif
5107#ifdef TRY_MALLOC
5108void *malloc();
5109#endif
5110#ifdef TRY_FREE
5111void free();
5112#endif
5113END
5114case "$malloctype" in
5115'')
5116 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5117 malloctype='void *'
5118 else
5119 malloctype='char *'
5120 fi
5121 ;;
5122esac
5123echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5124
5125case "$freetype" in
5126'')
5127 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5128 freetype='void'
5129 else
5130 freetype='int'
5131 fi
5132 ;;
5133esac
5134echo "Your system uses $freetype free(), it would seem." >&4
5135$rm -f malloc.[co]
a3635516
JH
5136$cat <<EOM
5137
5138The installation process will also create a directory for
5139vendor-supplied add-ons. Vendors who supply perl with their system
5140may find it convenient to place all vendor-supplied files in this
5141directory rather than in the main distribution directory. This will
5142ease upgrades between binary-compatible maintenance versions of perl.
5143
5144Of course you may also use these directories in whatever way you see
5145fit. For example, you might use them to access modules shared over a
5146company-wide network.
5147
5148The default answer should be fine for most people.
5149This causes further questions about vendor add-ons to be skipped
5150and no vendor-specific directories will be configured for perl.
5151
5152EOM
5153rp='Do you want to configure vendor-specific add-on directories?'
5154case "$usevendorprefix" in
5155define|true|[yY]*) dflt=y ;;
5156*) dflt=n ;;
5157esac
5158. ./myread
5159case "$ans" in
5160[yY]*) fn=d~+
5161 rp='Installation prefix to use for vendor-supplied add-ons?'
5162 case "$vendorprefix" in
5163 '') dflt='' ;;
5164 *) dflt=$vendorprefix ;;
5165 esac
5166 . ./getfile
5167 oldvendorprefix=''
5168 case "$vendorprefix" in
5169 '') ;;
5170 *) case "$ans" in
5171 "$prefix") ;;
5172 *) oldvendorprefix="$prefix";;
5173 esac
5174 ;;
5175 esac
5176 usevendorprefix="$define"
5177 vendorprefix="$ans"
5178 vendorprefixexp="$ansexp"
5179 ;;
5180*) usevendorprefix="$undef"
5181 vendorprefix=''
5182 vendorprefixexp=''
5183 ;;
5184esac
5185
5186case "$vendorprefix" in
5187'') d_vendorlib="$undef"
5188 vendorlib=''
5189 vendorlibexp=''
5190 ;;
5191*) d_vendorlib="$define"
5192 : determine where vendor-supplied modules go.
629ae163 5193 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
a3635516
JH
5194 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5195 case "$installstyle" in
629ae163
GS
5196 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5197 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
a3635516
JH
5198 esac
5199 fn=d~+
5200 rp='Pathname for the vendor-supplied library files?'
5201 . ./getfile
5202 vendorlib="$ans"
5203 vendorlibexp="$ansexp"
5204 : Change installation prefix, if necessary.
5205 if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5206 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
a3635516
JH
5207 else
5208 installvendorlib="$vendorlibexp"
5209 fi
5210 ;;
5211esac
5212
c4f23d77
AD
5213: Cruising for prototypes
5214echo " "
5215echo "Checking out function prototypes..." >&4
5216$cat >prototype.c <<'EOCP'
5a411a32 5217int main(int argc, char *argv[]) {
c4f23d77
AD
5218 exit(0);}
5219EOCP
5220if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5221 echo "Your C compiler appears to support function prototypes."
5222 val="$define"
5223else
5224 echo "Your C compiler doesn't seem to understand function prototypes."
5225 val="$undef"
5226fi
5227set prototype
5228eval $setvar
5229$rm -f prototype*
5230
5231case "$prototype" in
5232"$define") ;;
5233*) ansi2knr='ansi2knr'
5234 echo " "
5235 cat <<EOM >&4
5236
5237$me: FATAL ERROR:
5238This version of $package can only be compiled by a compiler that
5239understands function prototypes. Unfortunately, your C compiler
5240 $cc $ccflags
5241doesn't seem to understand them. Sorry about that.
5242
5ff3f7a4 5243If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
5244
5245Eventually, we hope to support building Perl with pre-ANSI compilers.
5246If you would like to help in that effort, please contact <perlbug@perl.org>.
5247
5248Aborting Configure now.
5249EOM
5250 exit 2
5251 ;;
5252esac
5253
5254: determine where public executables go
5255echo " "
5256set dflt bin bin
5257eval $prefixit
5258fn=d~
5259rp='Pathname where the public executables will reside?'
5260. ./getfile
5261if $test "X$ansexp" != "X$binexp"; then
5262 installbin=''
5263fi
5264bin="$ans"
5265binexp="$ansexp"
dd4e71fd
JH
5266: Change installation prefix, if necessary.
5267: XXX Bug? -- ignores Configure -Dinstallprefix setting.
5268if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5269 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5270else
5271 installbin="$binexp"
c4f23d77
AD
5272fi
5273
ff935051
JH
5274$cat <<EOM
5275
5276After $package is installed, you may wish to install various
5277add-on modules and utilities. Typically, these add-ons will
5278be installed under $prefix with the rest
5279of this package. However, you may wish to install such add-ons
5280elsewhere under a different prefix.
5281
5282If you do not wish to put everything under a single prefix, that's
5283ok. You will be prompted for the individual locations; this siteprefix
5284is only used to suggest the defaults.
5285
5286The default should be fine for most people.
5287
5288EOM
5289fn=d~+
5290rp='Installation prefix to use for add-on modules and utilities?'
5291: XXX Here might be another good place for an installstyle setting.
5292case "$siteprefix" in
5293'') dflt=$prefix ;;
5294*) dflt=$siteprefix ;;
5295esac
5296. ./getfile
5297oldsiteprefix=''
5298case "$siteprefix" in
5299'') ;;
5300*)
5301 case "$ans" in
5302 "$prefix") ;;
5303 *) oldsiteprefix="$prefix";;
5304 esac
5305 ;;
5306esac
5307siteprefix="$ans"
5308siteprefixexp="$ansexp"
5309
5310: determine where site specific libraries go.
5311: Usual default is /usr/local/lib/perl5/site_perl/$version
5312: The default "style" setting is made in installstyle.U
5313: XXX No longer works with Prefixit stuff.
5314prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5315case "$installstyle" in
5316*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5317*) dflt=$siteprefix/lib/site_$prog/$version ;;
5318esac
5319$cat <<EOM
5320
5321The installation process will create a directory for
5322site-specific extensions and modules. Most users find it convenient
5323to place all site-specific files in this directory rather than in the
5324main distribution directory.
5325
5326EOM
5327fn=d~+
5328rp='Pathname for the site-specific library files?'
5329. ./getfile
5330sitelib="$ans"
5331sitelibexp="$ansexp"
5332: Change installation prefix, if necessary.
5333if $test X"$prefix" != X"$installprefix"; then
5334 installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5335else
5336 installsitelib="$sitelibexp"
5337fi
5338
5339: Determine list of previous versions to include in @INC
5340$cat > getverlist <<EOPL
5341#!$perl -w
5342use File::Basename;
5343\$api_versionstring = "$api_versionstring";
5344\$version = "$version";
5345\$sitelib = "$sitelib";
5346\$archname = "$archname";
5347EOPL
5348 $cat >> getverlist <<'EOPL'
5349# Can't have leading @ because metaconfig interprets it as a command!
5350;@inc_version_list=();
5351$stem=dirname($sitelib);
5352# Redo to do opendir/readdir?
5353if (-d $stem) {
5354 chdir($stem);
5355 ;@candidates = glob("5.*");
5356}
5357else {
5358 ;@candidates = ();
5359}
5360
937ac629
JH
5361# XXX ToDo: These comparisons must be reworked when two-digit
5362# subversions come along, so that 5.7.10 compares as greater than
5363# 5.7.3! By that time, hope that 5.6.x is sufficiently
5364# widespread that we can use the built-in version vectors rather
5365# than reinventing them here. For 5.6.0, however, we must
5366# assume this script will likely be run by 5.005_0x. --AD 1/2000.
ff935051
JH
5367foreach $d (@candidates) {
5368 if ($d lt $version) {
5369 if ($d ge $api_versionstring) {
5370 unshift(@inc_version_list, "$d/$archname", $d);
5371 }
5372 elsif ($d ge "5.005") {
5373 unshift(@inc_version_list, $d);
5374 }
5375 }
5376 else {
5377 # Skip newer version. I.e. don't look in
5378 # 5.7.0 if we're installing 5.6.1.
5379 }
5380}
5381
5382if (@inc_version_list) {
3a096bf3 5383 print join(' ', @inc_version_list);
ff935051
JH
5384}
5385else {
5386 # Blank space to preserve value for next Configure run.
5387 print " ";
5388}
5389EOPL
5390chmod +x getverlist
5391case "$inc_version_list" in
5392'') if test -x $perl; then
5393 dflt=`$perl getverlist`
5394 else
3a096bf3 5395 dflt='none'
ff935051
JH
5396 fi
5397 ;;
3a096bf3 5398$undef) dflt='none' ;;
ff935051
JH
5399*) dflt="$inc_version_list" ;;
5400esac
5401$cat <<'EOM'
5402
5403In order to ease the process of upgrading, this version of perl
5404can be configured to use modules built and installed with earlier
5405versions of perl that were installed under $prefix. Specify here
5406the list of earlier versions that this version of perl should check.
5407If Configure detected no earlier versions of perl installed under
3a096bf3
JH
5408$prefix, then the list will be empty. Answer 'none' to tell perl
5409to not search earlier versions.
ff935051
JH
5410
5411The default should almost always be sensible, so if you're not sure,
5412just accept the default.
5413EOM
5414
3a096bf3 5415rp='List of earlier versions to include in @INC?'
ff935051 5416. ./myread
3a096bf3
JH
5417case "$ans" in
5418[Nn]one) inc_version_list=' ' ;;
5419*) inc_version_list="$ans" ;;
5420esac
5421case "$inc_version_list" in
5422''|' ')
5423 inc_version_list_init='""';;
5424*) inc_version_list_init=`echo $inc_version_list |
5425 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/"/'`
5426 ;;
5427esac
ff935051
JH
5428$rm -f getverlist
5429
104d25b7
JH
5430: determine whether to install perl also as /usr/bin/perl
5431
5432echo " "
dd4e71fd 5433if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7
JH
5434 $cat <<EOM
5435Many scripts expect to perl to be installed as /usr/bin/perl.
5436I can install the perl you are about to compile also as /usr/bin/perl
5437(in addition to $installbin/perl).
5438EOM
472a4973
JH
5439 case "$installusrbinperl" in
5440 "$undef"|[nN]*) dflt='n';;
5441 *) dflt='y';;
5442 esac
104d25b7
JH
5443 rp="Do you want to install perl as /usr/bin/perl?"
5444 . ./myread
5445 case "$ans" in
5446 [yY]*) val="$define";;
472a4973 5447 *) val="$undef" ;;
104d25b7 5448 esac
472a4973
JH
5449else
5450 val="$undef"
5451fi
104d25b7
JH
5452set installusrbinperl
5453eval $setvar
5454
a4f3eea9 5455echo " "
5456echo "Checking for GNU C Library..." >&4
5457cat >gnulibc.c <<EOM
aebf16e7 5458#include <stdio.h>
5a411a32 5459int main()
a4f3eea9 5460{
aebf16e7
AD
5461#ifdef __GLIBC__
5462 exit(0);
5463#else
5464 exit(1);
5465#endif
a4f3eea9 5466}
5467EOM
dfe9444c 5468set gnulibc
aebf16e7 5469if eval $compile_ok && ./gnulibc; then
a4f3eea9 5470 val="$define"
5471 echo "You are using the GNU C Library"
4633a7c4 5472else
a4f3eea9 5473 val="$undef"
5474 echo "You are not using the GNU C Library"
4633a7c4 5475fi
a4f3eea9 5476$rm -f gnulibc*
5477set d_gnulibc
5478eval $setvar
25f94b33 5479
a4f3eea9 5480: see if nm is to be used to determine whether a symbol is defined or not
5481case "$usenm" in
5482'')
dc45a647 5483 dflt=''
a4f3eea9 5484 case "$d_gnulibc" in
dc45a647
MB
5485 "$define")
5486 echo " "
5487 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 5488 dflt=n
5489 ;;
dc45a647
MB
5490 esac
5491 case "$dflt" in
5492 '')
5493 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5494 echo " "
5495 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5496 echo "'nm' won't be sufficient on this sytem." >&4
5497 dflt=n
5498 fi
5499 ;;
5500 esac
5501 case "$dflt" in
c4f23d77 5502 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 5503 if $test $dflt -gt 20; then
5504 dflt=y
5505 else
5506 dflt=n
5507 fi
5508 ;;
5509 esac
5510 ;;
5511*)
5512 case "$usenm" in
dc45a647 5513 true|$define) dflt=y;;
a4f3eea9 5514 *) dflt=n;;
5515 esac
5516 ;;
25f94b33 5517esac
a4f3eea9 5518$cat <<EOM
4633a7c4 5519
dc45a647
MB
5520I can use $nm to extract the symbols from your C libraries. This
5521is a time consuming task which may generate huge output on the disk (up
5522to 3 megabytes) but that should make the symbols extraction faster. The
5523alternative is to skip the 'nm' extraction part and to compile a small
5524test program instead to determine whether each symbol is present. If
5525you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5526this may be the best solution.
5527
5528You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 5529
a4f3eea9 5530EOM
693762b4 5531rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
5532. ./myread
5533case "$ans" in
dc45a647 5534[Nn]*) usenm=false;;
a4f3eea9 5535*) usenm=true;;
4633a7c4
LW
5536esac
5537
a4f3eea9 5538runnm=$usenm
5539case "$reuseval" in
5540true) runnm=false;;
4633a7c4 5541esac
a4f3eea9 5542
5543: nm options which may be necessary
5544case "$nm_opt" in
5545'') if $test -f /mach_boot; then
1e422769 5546 nm_opt='' # Mach
a4f3eea9 5547 elif $test -d /usr/ccs/lib; then
1e422769 5548 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 5549 elif $test -f /dgux; then
1e422769 5550 nm_opt='-p' # DG-UX
2ae324a7 5551 elif $test -f /lib64/rld; then
1e422769 5552 nm_opt='-p' # 64-bit Irix
a4f3eea9 5553 else
5554 nm_opt=''
5555 fi;;
4633a7c4 5556esac
4633a7c4 5557
a4f3eea9 5558: nm options which may be necessary for shared libraries but illegal
5559: for archive libraries. Thank you, Linux.
5560case "$nm_so_opt" in
5561'') case "$myuname" in
5562 *linux*)
693762b4 5563 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 5564 nm_so_opt='--dynamic'
4633a7c4 5565 fi
a4f3eea9 5566 ;;
4633a7c4 5567 esac
4633a7c4
LW
5568 ;;
5569esac
5570
a4f3eea9 5571case "$runnm" in
5572true)
5573: get list of predefined functions in a handy place
5574echo " "
5575case "$libc" in
5576'') libc=unknown
5577 case "$libs" in
dfe9444c 5578 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 5579 esac
5580 ;;
5581esac
5582libnames='';
5583case "$libs" in
5584'') ;;
5585*) for thislib in $libs; do
5586 case "$thislib" in
5587 -lc|-lc_s)
5588 : Handle C library specially below.
5589 ;;
5590 -l*)
5591 thislib=`echo $thislib | $sed -e 's/^-l//'`
5592 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5593 :
5594 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5595 :
dfe9444c 5596 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 5597 :
dfe9444c 5598 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 5599 :
a4f3eea9 5600 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5601 :
5602 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5603 :
dfe9444c 5604 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 5605 :
5606 else
5607 try=''
5608 fi
5609 libnames="$libnames $try"
5610 ;;
5611 *) libnames="$libnames $thislib" ;;
5612 esac
5613 done
5614 ;;
5615esac
5616xxx=normal
5617case "$libc" in
5618unknown)
5619 set /lib/libc.$so
5620 for xxx in $libpth; do
5621 $test -r $1 || set $xxx/libc.$so
5622 : The messy sed command sorts on library version numbers.
5623 $test -r $1 || \
5624 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 5625 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 5626 h
5627 s/[0-9][0-9]*/0000&/g
5628 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5629 G
5630 s/\n/ /' | \
dfe9444c 5631 sort | $sed -e 's/^.* //'`
a4f3eea9 5632 eval set \$$#
5633 done
5634 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
5635 $test -r $1 || set /lib/libsys_s$_a
5636 ;;
a4f3eea9 5637*)
5638 set blurfl
5639 ;;
5640esac
5641if $test -r "$1"; then
5642 echo "Your (shared) C library seems to be in $1."
5643 libc="$1"
5644elif $test -r /lib/libc && $test -r /lib/clib; then
5645 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5646 xxx=apollo
5647 libc='/lib/clib /lib/libc'
5648 if $test -r /lib/syslib; then
5649 echo "(Your math library is in /lib/syslib.)"
5650 libc="$libc /lib/syslib"
5651 fi
5652elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5653 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
5654elif $test -r $incpath/usr/lib/libc$_a; then
5655 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 5656 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
5657elif $test -r /lib/libc$_a; then
5658 libc=/lib/libc$_a;
a4f3eea9 5659 echo "Your C library seems to be in $libc. You're normal."
5660else
dfe9444c 5661 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 5662 :
5663 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5664 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5665 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5666 :
dfe9444c 5667 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5668 :
dfe9444c 5669 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5670 :
4633a7c4 5671 else
dfe9444c 5672 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 5673 fi
a4f3eea9 5674 if $test -r "$tans"; then
5675 echo "Your C library seems to be in $tans, of all places."
5676 libc=$tans
5677 else
5678 libc='blurfl'
5679 fi
5680fi
5681if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5682 dflt="$libc"
5683 cat <<EOM
4633a7c4 5684
a4f3eea9 5685If the guess above is wrong (which it might be if you're using a strange
5686compiler, or your machine supports multiple models), you can override it here.
4633a7c4 5687
a4f3eea9 5688EOM
5689else
5690 dflt=''
28e8609d 5691 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 5692 cat >&4 <<EOM
5693I can't seem to find your C library. I've looked in the following places:
4633a7c4 5694
a4f3eea9 5695EOM
5696 $sed 's/^/ /' libpath
5697 cat <<EOM
4633a7c4 5698
a4f3eea9 5699None of these seems to contain your C library. I need to get its name...
4633a7c4 5700
a4f3eea9 5701EOM
5702fi
5703fn=f
5704rp='Where is your C library?'
5705. ./getfile
5706libc="$ans"
4633a7c4 5707
4633a7c4 5708echo " "
28e8609d 5709echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 5710set X `cat libnames`
4633a7c4 5711shift
a4f3eea9 5712xxx=files
5713case $# in 1) xxx=file; esac
5714echo "Extracting names from the following $xxx for later perusal:" >&4
5715echo " "
5716$sed 's/^/ /' libnames >&4
5717echo " "
5718$echo $n "This may take a while...$c" >&4
4633a7c4 5719
dfe9444c
AD
5720for file in $*; do
5721 case $file in
693762b4
AD
5722 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5723 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5724 esac
dfe9444c 5725done >libc.tmp
4633a7c4 5726
a4f3eea9 5727$echo $n ".$c"
5728$grep fprintf libc.tmp > libc.ptf
5729xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5730xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5731xxx='[ADTSIW]'
5732if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5733 eval $xscan;\
5734 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735 eval $xrun
5736elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5737 eval $xscan;\
5738 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739 eval $xrun
5740elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5741 eval $xscan;\
5742 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743 eval $xrun
5744elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5745 eval $xscan;\
5746 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747 eval $xrun
5748elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5749 eval $xscan;\
5750 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751 eval $xrun
5752elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5753 eval $xscan;\
5754 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755 eval $xrun
5756elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5757 -e '/ file/d' -e '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/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5762 eval $xscan;\
5763 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764 eval $xrun
5765elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5766 eval $xscan;\
5767 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768 eval $xrun
1e422769 5769elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5770 eval $xscan;\
5771 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772 eval $xrun
a4f3eea9 5773elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5774 eval $xscan;\
5775 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5776 eval $xrun
5777elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5778 eval $xscan;\
5779 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5780 eval $xrun
44a8e56a 5781elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5782 eval $xscan;\
5783 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5784 eval $xrun
0f502cca
BL
5785elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5786 eval $xscan;\
5787 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5788 eval $xrun
a4f3eea9 5789else
693762b4 5790 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 5791 $grep fprintf libc.tmp > libc.ptf
5792 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5793 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5794 then
5795 nm_opt='-p'
5796 eval $xrun
4633a7c4 5797 else
a4f3eea9 5798 echo " "
e5c9fcd0 5799 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 5800 com=''
dc45a647
MB
5801 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5802 for thisname in $libnames $libc; do
e5c9fcd0 5803 $ar t $thisname >>libc.tmp
a4f3eea9 5804 done
dfe9444c 5805 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 5806 echo "Ok." >&4
dc45a647
MB
5807 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5808 # Repeat libc to extract forwarders to DLL entries too
5809 for thisname in $libnames $libc; do
5810 $ar tv $thisname >>libc.tmp
5811 # Revision 50 of EMX has bug in $ar.
5812 # it will not extract forwarders to DLL entries
5813 # Use emximp which will extract exactly them.
5814 emximp -o tmp.imp $thisname \
5815 2>/dev/null && \
5816 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5817 < tmp.imp >>libc.tmp
5818 $rm tmp.imp
5819 done
5820 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5821 echo "Ok." >&4
a4f3eea9 5822 else
e5c9fcd0 5823 echo "$ar didn't seem to work right." >&4
a4f3eea9 5824 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 5825 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 5826 then
5827 for thisname in $libnames; do
5828 bld t $libnames | \
dfe9444c 5829 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 5830 $ar t $thisname >>libc.tmp
a4f3eea9 5831 done
5832 echo "Ok." >&4
5833 else
5834 echo "That didn't work either. Giving up." >&4
5835 exit 1
5836 fi
5837 fi
4633a7c4 5838 fi
4633a7c4 5839fi
a4f3eea9 5840nm_extract="$com"
5841if $test -f /lib/syscalls.exp; then
4633a7c4 5842 echo " "
a4f3eea9 5843 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 5844 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 5845fi
5846;;
5847esac
5848$rm -f libnames libpath
5849
2afac517 5850: see if dld is available
5851set dld.h i_dld
5852eval $inhdr
4633a7c4 5853
2afac517 5854: is a C symbol defined?
5855csym='tlook=$1;
5856case "$3" in
5857-v) tf=libc.tmp; tc=""; tdc="";;
5858-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5859*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5860esac;
5861tx=yes;
5862case "$reuseval-$4" in
5863true-) ;;
5864true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5865esac;
5866case "$tx" in
5867yes)
5868 case "$runnm" in
5869 true)
5870 if $contains $tlook $tf >/dev/null 2>&1;
5871 then tval=true;
5872 else tval=false;
5873 fi;;
5874 *)
d674cd6d 5875 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 5876 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 5877 then tval=true;
5878 else tval=false;
5879 fi;
5880 $rm -f t t.c;;
5881 esac;;
5882*)
5883 case "$tval" in
5884 $define) tval=true;;
5885 *) tval=false;;
5886 esac;;
5887esac;
5888eval "$2=$tval"'
4633a7c4 5889
2afac517 5890: define an is-in-libc? function
5891inlibc='echo " "; td=$define; tu=$undef;
5892sym=$1; var=$2; eval "was=\$$2";
5893tx=yes;
5894case "$reuseval$was" in
5895true) ;;
5896true*) tx=no;;
5897esac;
5898case "$tx" in
5899yes)
5900 set $sym tres -f;
5901 eval $csym;
5902 case "$tres" in
5903 true)
5904 echo "$sym() found." >&4;
5905 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5906 *)
5907 echo "$sym() NOT found." >&4;
5908 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5909 esac;;
5910*)
5911 case "$was" in
5912 $define) echo "$sym() found." >&4;;
5913 *) echo "$sym() NOT found." >&4;;
5914 esac;;
5915esac'
4633a7c4 5916
2afac517 5917: see if dlopen exists
5918xxx_runnm="$runnm"
5919runnm=false
5920set dlopen d_dlopen
5921eval $inlibc
5922runnm="$xxx_runnm"
40a7a20a 5923
2afac517 5924: determine which dynamic loading, if any, to compile in
4633a7c4 5925echo " "
2afac517 5926dldir="ext/DynaLoader"
5927case "$usedl" in
5928$define|y|true)
5929 dflt='y'
5930 usedl="$define"
5931 ;;
5932$undef|n|false)
5933 dflt='n'
5934 usedl="$undef"
5935 ;;
5936*)
5937 dflt='n'
5938 case "$d_dlopen" in
5939 $define) dflt='y' ;;
5940 esac
5941 case "$i_dld" in
5942 $define) dflt='y' ;;
4633a7c4 5943 esac
2afac517 5944 : Does a dl_xxx.xs file exist for this operating system
dc45a647 5945 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
5946 ;;
5947esac
2afac517 5948rp="Do you wish to use dynamic loading?"
5949. ./myread
5950usedl="$ans"
5951case "$ans" in
5952y*) usedl="$define"
5953 case "$dlsrc" in
5954 '')
dc45a647 5955 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 5956 dflt="$dldir/dl_${osname}.xs"
5957 elif $test "$d_dlopen" = "$define" ; then
5958 dflt="$dldir/dl_dlopen.xs"
5959 elif $test "$i_dld" = "$define" ; then
5960 dflt="$dldir/dl_dld.xs"
4633a7c4 5961 else
2afac517 5962 dflt=''
4633a7c4 5963 fi
4633a7c4 5964 ;;
2afac517 5965 *) dflt="$dldir/$dlsrc"
5966 ;;
4633a7c4 5967 esac
2afac517 5968 echo "The following dynamic loading files are available:"
5969 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
5970 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5971 rp="Source file to use for dynamic loading"
5972 fn="fne"
b233458b 5973 gfpth="$src"
dc45a647 5974 . ./getfile
2afac517 5975 usedl="$define"
5976 : emulate basename
5977 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 5978
dc45a647 5979 $cat << EOM
2304df62 5980
2afac517 5981Some systems may require passing special flags to $cc -c to
5982compile modules that will be used to create a shared library.
5983To use no flags, say "none".
2304df62
AD
5984
5985EOM
2afac517 5986 case "$cccdlflags" in
5987 '') case "$gccversion" in
5988 '') case "$osname" in
5989 hpux) dflt='+z' ;;
5990 next) dflt='none' ;;
8cc95fdb 5991 irix*) dflt='-KPIC' ;;
3a6175e1 5992 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 5993 sunos) dflt='-pic' ;;
5994 *) dflt='none' ;;
dfe9444c
AD
5995 esac
5996 ;;
5997 *) case "$osname" in
3a6175e1 5998 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 5999 *) dflt='-fpic' ;;
81d89818 6000 esac ;;
2afac517 6001 esac ;;
bfb7748a 6002 ' ') dflt='none' ;;
2afac517 6003 *) dflt="$cccdlflags" ;;
6004 esac
6005 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6006 . ./myread
6007 case "$ans" in
6008 none) cccdlflags=' ' ;;
6009 *) cccdlflags="$ans" ;;
6010 esac
2304df62 6011
2afac517 6012 cat << EOM
ecfc5424 6013
2afac517 6014Some systems use ld to create libraries that can be dynamically loaded,
6015while other systems (such as those using ELF) use $cc.
a0f45b59 6016
2afac517 6017EOM
6018 case "$ld" in
6019 '') $cat >try.c <<'EOM'
6020/* Test for whether ELF binaries are produced */
6021#include <fcntl.h>
6022#include <stdlib.h>
5a411a32 6023int main() {
2afac517 6024 char b[4];
6025 int i = open("a.out",O_RDONLY);
6026 if(i == -1)
6027 exit(1); /* fail */
6028 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6029 exit(0); /* succeed (yes, it's ELF) */
2304df62 6030 else
2afac517 6031 exit(1); /* fail */
6032}
6033EOM
6034 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6035 cat <<EOM
6036You appear to have ELF support. I'll use $cc to build dynamic libraries.
6037EOM
6038 dflt="$cc"
2304df62 6039 else
2afac517 6040 echo "I'll use ld to build dynamic libraries."
6041 dflt='ld'
2304df62 6042 fi
2afac517 6043 rm -f try.c a.out
6044 ;;
6045 *) dflt="$ld"
6046 ;;
6047 esac
6048
6049 rp="What command should be used to create dynamic libraries?"
6050 . ./myread
6051 ld="$ans"
6052
6053 cat << EOM
6054
6055Some systems may require passing special flags to $ld to create a
6056library that can be dynamically loaded. If your ld flags include
6057-L/other/path options to locate libraries outside your loader's normal
6058search path, you may need to specify those -L options here as well. To
6059use no flags, say "none".
6060
6061EOM
6062 case "$lddlflags" in
6063 '') case "$osname" in
46193409 6064 beos) dflt='-nostart' ;;
2afac517 6065 hpux) dflt='-b' ;;
6066 linux|irix*) dflt='-shared' ;;
6067 next) dflt='none' ;;
6068 solaris) dflt='-G' ;;
6069 sunos) dflt='-assert nodefinitions' ;;
6070 svr4*|esix*) dflt="-G $ldflags" ;;
6071 *) dflt='none' ;;
6072 esac
6073 ;;
6074 *) dflt="$lddlflags" ;;
6075 esac
6076
bfb7748a 6077 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
6078 : Be careful not to append to a plain 'none'
6079 case "$dflt" in
6080 none) dflt='' ;;
6081 esac
bfb7748a
AD
6082 for thisflag in $ldflags; do
6083 case "$thisflag" in
6084 -L*)
6085 case " $dflt " in
6086 *" $thisflag "*) ;;
6087 *) dflt="$dflt $thisflag" ;;
6088 esac
6089 ;;
2afac517 6090 esac
bfb7748a 6091 done
2afac517 6092
bfb7748a
AD
6093 case "$dflt" in
6094 ''|' ') dflt='none' ;;
6095 esac
2afac517 6096
6097 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6098 . ./myread
6099 case "$ans" in
6100 none) lddlflags=' ' ;;
6101 *) lddlflags="$ans" ;;
6102 esac
6103
6104 cat <<EOM
6105
6106Some systems may require passing special flags to $cc to indicate that
6107the resulting executable will use dynamic linking. To use no flags,
6108say "none".
6109
6110EOM
6111 case "$ccdlflags" in
6112 '') case "$osname" in
6113 hpux) dflt='-Wl,-E' ;;
6114 linux) dflt='-rdynamic' ;;
6115 next) dflt='none' ;;
6116 sunos) dflt='none' ;;
6117 *) dflt='none' ;;
6118 esac ;;
bfb7748a 6119 ' ') dflt='none' ;;
2afac517 6120 *) dflt="$ccdlflags" ;;
6121 esac
7f95ee77 6122 rp="Any special flags to pass to $cc to use dynamic linking?"
2afac517 6123 . ./myread
6124 case "$ans" in
6125 none) ccdlflags=' ' ;;
6126 *) ccdlflags="$ans" ;;
6127 esac
6128 ;;
6129*) usedl="$undef"
6130 ld='ld'
6131 dlsrc='dl_none.xs'
6132 lddlflags=''
6133 ccdlflags=''
6134 ;;
6135esac
6136
6137also=''
6138case "$usedl" in
6139$undef)
6140 # No dynamic loading being used, so don't bother even to prompt.
6141 useshrplib='false'
6142 ;;
6143*) case "$useshrplib" in
6144 '') case "$osname" in
4fabb596 6145 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
3e3baf6d 6146 dflt=y
2afac517 6147 also='Building a shared libperl is required for dynamic loading to work on your system.'
6148 ;;
6149 next*)
6150 case "$osvers" in
3e3baf6d 6151 4*) dflt=y
2afac517 6152 also='Building a shared libperl is needed for MAB support.'
6153 ;;
3e3baf6d 6154 *) dflt=n
2afac517 6155 ;;
6156 esac
6157 ;;
3e3baf6d 6158 *) dflt=n
2afac517 6159 ;;
6160 esac
6161 ;;
6162 $define|true|[Yy]*)
3e3baf6d 6163 dflt=y
2afac517 6164 ;;
3e3baf6d 6165 *) dflt=n
2afac517 6166 ;;
6167 esac
6168 $cat << EOM
6169
6170The perl executable is normally obtained by linking perlmain.c with
dfe9444c 6171libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 6172any other libraries needed on this system (such as -lm, etc.). Since
6173your system supports dynamic loading, it is probably possible to build
6174a shared libperl.$so. If you will have more than one executable linked
6175to libperl.$so, this will significantly reduce the size of each
6176executable, but it may have a noticeable affect on performance. The
6177default is probably sensible for your system.
6178$also
6179
6180EOM
6181 rp="Build a shared libperl.$so (y/n)"
6182 . ./myread
6183 case "$ans" in
6184 true|$define|[Yy]*)
5cf1d1f1 6185 useshrplib='true' ;;
2afac517 6186 *) useshrplib='false' ;;
6187 esac
6188 ;;
6189esac
6190
6191case "$useshrplib" in
6192true)
6193 case "$libperl" in
6194 '')
6195 # Figure out a good name for libperl.so. Since it gets stored in
6196 # a version-specific architecture-dependent library, the version
6197 # number isn't really that important, except for making cc/ld happy.
6198 #
6199 # A name such as libperl.so.3.1
6200 majmin="libperl.$so.$patchlevel.$subversion"
6201 # A name such as libperl.so.301
6202 majonly=`echo $patchlevel $subversion |
6203 $awk '{printf "%d%02d", $1, $2}'`
6204 majonly=libperl.$so.$majonly
6205 # I'd prefer to keep the os-specific stuff here to a minimum, and
6206 # rely on figuring it out from the naming of libc.
6207 case "${osname}${osvers}" in
6208 next4*)
6209 dflt=libperl.5.$so
6210 # XXX How handle the --version stuff for MAB?
6211 ;;
6212 linux*) # ld won't link with a bare -lperl otherwise.
6213 dflt=libperl.$so
6214 ;;
4fabb596
GS
6215 cygwin*) # include version
6216 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6217 ;;
2afac517 6218 *) # Try to guess based on whether libc has major.minor.
6219 case "$libc" in
6220 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6221 *libc.$so.[0-9]*) dflt=$majonly ;;
6222 *) dflt=libperl.$so ;;
6223 esac
6224 ;;
6225 esac
6226 ;;
6227 *) dflt=$libperl
6228 ;;
6229 esac
6230 cat << EOM
6231
6232I need to select a good name for the shared libperl. If your system uses
6233library names with major and minor numbers, then you might want something
6234like $majmin. Alternatively, if your system uses a single version
6235number for shared libraries, then you might want to use $majonly.
6236Or, your system might be quite happy with a simple libperl.$so.
6237
6238Since the shared libperl will get installed into a version-specific
6239architecture-dependent directory, the version number of the shared perl
6240library probably isn't important, so the default should be o.k.
6241
6242EOM
6243 rp='What name do you want to give to the shared libperl?'
6244 . ./myread
6245 libperl=$ans
6246 echo "Ok, I'll use $libperl"
6247 ;;
6248*)
dfe9444c 6249 libperl="libperl${_a}"
2afac517 6250 ;;
6251esac
6252
6253# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6254case "$shrpdir" in
6255'') ;;
6256*) $cat >&4 <<EOM
6257WARNING: Use of the shrpdir variable for the installation location of
6258the shared $libperl is not supported. It was never documented and
46193409 6259will not work in this version. Let me (perlbug@perl.com)
dfe9444c 6260know of any problems this may cause.
2afac517 6261
6262EOM
6263 case "$shrpdir" in
6264 "$archlibexp/CORE")
6265 $cat >&4 <<EOM
6266But your current setting of $shrpdir is
6267the default anyway, so it's harmless.
6268EOM
6269 ;;
6270 *)
4e2a5f63
AD
6271 $cat >&4 <<EOM
6272Further, your current attempted setting of $shrpdir
6273conflicts with the value of $archlibexp/CORE
6274that installperl will use.
6275EOM
dc45a647
MB
6276 ;;
6277 esac
6278 ;;
6279esac
6280
6281# How will the perl executable find the installed shared $libperl?
6282# Add $xxx to ccdlflags.
6283# If we can't figure out a command-line option, use $shrpenv to
6284# set env LD_RUN_PATH. The main perl makefile uses this.
6285shrpdir=$archlibexp/CORE
6286xxx=''
6287tmp_shrpenv=''
6288if "$useshrplib"; then
6289 case "$osname" in
6290 aix)
6291 # We'll set it in Makefile.SH...
6292 ;;
6293 solaris|netbsd)
6294 xxx="-R $shrpdir"
6295 ;;
6296 freebsd)
6297 xxx="-Wl,-R$shrpdir"
6298 ;;
6299 linux|irix*|dec_osf)
6300 xxx="-Wl,-rpath,$shrpdir"
6301 ;;
6302 next)
6303 # next doesn't like the default...
6304 ;;
46193409
JH
6305 beos)
6306 # beos doesn't like the default, either.
6307 ;;
3656fc86
JH
6308 hpux*)
6309 # hpux doesn't like the default, either.
6310 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6311 ;;
dc45a647
MB
6312 *)
6313 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6314 ;;
6315 esac
6316 case "$xxx" in
6317 '') ;;
6318 *)
6319 # Only add $xxx if it isn't already in ccdlflags.
6320 case " $ccdlflags " in
6321 *" $xxx "*) ;;
6322 *) ccdlflags="$ccdlflags $xxx"
6323 cat <<EOM >&4
6324
6325Adding $xxx to the flags
6326passed to $ld so that the perl executable will find the
6327installed shared $libperl.
6328
6329EOM
6330 ;;
6331 esac
6332 ;;
6333 esac
6334fi
5cf1d1f1
JH
6335# Fix ccdlflags in AIX for building external extensions.
6336# (For building Perl itself bare -bE:perl.exp is needed,
6337# Makefile.SH takes care of this.)
5f9d9a17 6338case "$osname" in
5cf1d1f1 6339aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5f9d9a17 6340esac
dc45a647
MB
6341# Respect a hint or command-line value.
6342case "$shrpenv" in
6343'') shrpenv="$tmp_shrpenv" ;;
6344esac
5cf1d1f1
JH
6345case "$ldlibpthname" in
6346'') ldlibpthname=LD_LIBRARY_PATH ;;
6347none) ldlibpthname='' ;;
6348esac
dc45a647
MB
6349
6350: determine where manual pages go
6351set man1dir man1dir none
6352eval $prefixit
6353$cat <<EOM
6354
6355$spackage has manual pages available in source form.
6356EOM
6357case "$nroff" in
6358nroff)
6359 echo "However, you don't have nroff, so they're probably useless to you."
6360 case "$man1dir" in
6361 '') man1dir="none";;
6362 esac;;
6363esac
6364echo "If you don't want the manual sources installed, answer 'none'."
6365case "$man1dir" in
6366' ') dflt=none
6367 ;;
6368'')
6369 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6370 lookpath="$lookpath $prefixexp/man/p_man/man1"
6371 lookpath="$lookpath $prefixexp/man/u_man/man1"
6372 lookpath="$lookpath $prefixexp/man/man.1"
6373 case "$sysman" in
6374 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6375 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6376 esac
6377 set dflt
6378 eval $prefixup
6379 ;;
6380*) dflt="$man1dir"
6381 ;;
6382esac
6383echo " "
6384fn=dn+~
6385rp="Where do the main $spackage manual pages (source) go?"
6386. ./getfile
6387if $test "X$man1direxp" != "X$ansexp"; then
6388 installman1dir=''
6389fi
6390man1dir="$ans"
6391man1direxp="$ansexp"
6392case "$man1dir" in
dd4e71fd 6393'') man1dir=' '
dc45a647
MB
6394 installman1dir='';;
6395esac
dc45a647 6396
dd4e71fd
JH
6397: Change installation prefix, if necessary.
6398if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6399 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6400else
6401 installman1dir="$man1direxp"
dc45a647
MB
6402fi
6403
6404: What suffix to use on installed man pages
6405
6406case "$man1dir" in
6407' ')
6408 man1ext='0'
6409 ;;
6410*)
6411 rp="What suffix should be used for the main $spackage man pages?"
6412 case "$man1ext" in
6413 '') case "$man1dir" in
6414 *1) dflt=1 ;;
6415 *1p) dflt=1p ;;
6416 *1pm) dflt=1pm ;;
6417 *l) dflt=l;;
6418 *n) dflt=n;;
6419 *o) dflt=o;;
6420 *p) dflt=p;;
6421 *C) dflt=C;;
6422 *L) dflt=L;;
6423 *L1) dflt=L1;;
6424 *) dflt=1;;
6425 esac
6426 ;;
6427 *) dflt="$man1ext";;
6428 esac
6429 . ./myread
6430 man1ext="$ans"
6431 ;;
6432esac
6433
6434: see if we can have long filenames
6435echo " "
6436rmlist="$rmlist /tmp/cf$$"
6437$test -d /tmp/cf$$ || mkdir /tmp/cf$$
6438first=123456789abcdef
6439second=/tmp/cf$$/$first
6440$rm -f $first $second
6441if (echo hi >$first) 2>/dev/null; then
6442 if $test -f 123456789abcde; then
6443 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6444 val="$undef"
6445 else
6446 if (echo hi >$second) 2>/dev/null; then
6447 if $test -f /tmp/cf$$/123456789abcde; then
6448 $cat <<'EOM'
6449That's peculiar... You can have filenames longer than 14 characters, but only
6450on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
6451I shall consider your system cannot support long filenames at all.
6452EOM
6453 val="$undef"
6454 else
6455 echo 'You can have filenames longer than 14 characters.' >&4
6456 val="$define"
6457 fi
6458 else
6459 $cat <<'EOM'
6460How confusing! Some of your filesystems are sane enough to allow filenames
6461longer than 14 characters but some others like /tmp can't even think about them.
6462So, for now on, I shall assume your kernel does not allow them at all.
6463EOM
6464 val="$undef"
6465 fi
6466 fi
6467else
6468 $cat <<'EOM'
6469You can't have filenames longer than 14 chars. You can't even think about them!
6470EOM
6471 val="$undef"
6472fi
6473set d_flexfnam
6474eval $setvar
6475$rm -rf /tmp/cf$$ 123456789abcde*
6476
6477: determine where library module manual pages go
6478set man3dir man3dir none
6479eval $prefixit
6480$cat <<EOM
6481
6482$spackage has manual pages for many of the library modules.
6483EOM
6484
6485case "$nroff" in
6486nroff)
6487 $cat <<'EOM'
6488However, you don't have nroff, so they're probably useless to you.
6489EOM
6490 case "$man3dir" in
6491 '') man3dir="none";;
6492 esac;;
6493esac
6494
6495case "$d_flexfnam" in
6496undef)
6497 $cat <<'EOM'
6498However, your system can't handle the long file names like File::Basename.3.
6499EOM
6500 case "$man3dir" in
6501 '') man3dir="none";;
6502 esac;;
6503esac
6504
6505echo "If you don't want the manual sources installed, answer 'none'."
6506prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6507case "$man3dir" in
dd4e71fd
JH
6508'') dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6509 if $test -d "$privlib/man/man3"; then
6510 cat <<EOM >&4
6511
6512WARNING: Previous versions of perl installed man3 pages into
6513$privlib/man/man3. This version will suggest a
6514new default of $dflt.
6515EOM
6516 tdflt=$dflt
6517 dflt='n'
6518 rp='Do you wish to preserve the old behavior?(y/n)'
6519 . ./myread
6520 case "$ans" in
6521 y*) dflt="$privlib/man/man3" ;;
6522 *) dflt=$tdflt ;;
6523 esac
6524 fi
2afac517 6525 ;;
dc45a647
MB
6526' ') dflt=none;;
6527*) dflt="$man3dir" ;;
2afac517 6528esac
dc45a647 6529echo " "
dc45a647
MB
6530fn=dn+~
6531rp="Where do the $package library man pages (source) go?"
6532. ./getfile
dc45a647
MB
6533man3dir="$ans"
6534man3direxp="$ansexp"
dd4e71fd
JH
6535case "$man1dir" in
6536'') man3dir=' '
dc45a647
MB
6537 installman3dir='';;
6538esac
dc45a647 6539
dd4e71fd
JH
6540: Change installation prefix, if necessary.
6541if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6542 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6543else
6544 installman3dir="$man3direxp"
dc45a647
MB
6545fi
6546
6547: What suffix to use on installed man pages
dc45a647
MB
6548case "$man3dir" in
6549' ')
6550 man3ext='0'
6551 ;;
6552*)
6553 rp="What suffix should be used for the $package library man pages?"
6554 case "$man3ext" in
6555 '') case "$man3dir" in
6556 *3) dflt=3 ;;
6557 *3p) dflt=3p ;;
6558 *3pm) dflt=3pm ;;
6559 *l) dflt=l;;
6560 *n) dflt=n;;
6561 *o) dflt=o;;
6562 *p) dflt=p;;
6563 *C) dflt=C;;
6564 *L) dflt=L;;
6565 *L3) dflt=L3;;
6566 *) dflt=3;;
2afac517 6567 esac
6568 ;;
dc45a647 6569 *) dflt="$man3ext";;
2afac517 6570 esac
dc45a647
MB
6571 . ./myread
6572 man3ext="$ans"
6573 ;;
2afac517 6574esac
6575
6576: see if we have to deal with yellow pages, now NIS.
6577if $test -d /usr/etc/yp || $test -d /etc/yp; then
6578 if $test -f /usr/etc/nibindd; then
6579 echo " "
6580 echo "I'm fairly confident you're on a NeXT."
6581 echo " "
6582 rp='Do you get the hosts file via NetInfo?'
6583 dflt=y
6584 case "$hostcat" in
6585 nidump*) ;;
6586 '') ;;
6587 *) dflt=n;;
6588 esac
6589 . ./myread
6590 case "$ans" in
6591 y*) hostcat='nidump hosts .';;
6592 *) case "$hostcat" in
6593 nidump*) hostcat='';;
6594 esac
6595 ;;
6596 esac
6597 fi
6598 case "$hostcat" in
6599 nidump*) ;;
6600 *)
6601 case "$hostcat" in
6602 *ypcat*) dflt=y;;
6603 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6604 dflt=y
6605 else
6606 dflt=n
6607 fi;;
6608 *) dflt=n;;
6609 esac
6610 echo " "
6611 rp='Are you getting the hosts file via yellow pages?'
6612 . ./myread
6613 case "$ans" in
6614 y*) hostcat='ypcat hosts';;
6615 *) hostcat='cat /etc/hosts';;
6616 esac
6617 ;;
6618 esac
6619fi
dfe9444c 6620case "$hostcat" in
7599c0b3 6621'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
dfe9444c
AD
6622esac
6623case "$groupcat" in
7599c0b3 6624'') test -f /etc/group && groupcat='cat /etc/group';;
dfe9444c
AD
6625esac
6626case "$passcat" in
7599c0b3 6627'') test -f /etc/passwd && passcat='cat /etc/passwd';;
dfe9444c 6628esac
2afac517 6629
6630: now get the host name
6631echo " "
6632echo "Figuring out host name..." >&4
6633case "$myhostname" in
6634'') cont=true
6635 echo 'Maybe "hostname" will work...'
6636 if tans=`sh -c hostname 2>&1` ; then
6637 myhostname=$tans
6638 phostname=hostname
6639 cont=''
6640 fi
6641 ;;
6642*) cont='';;
6643esac
6644if $test "$cont"; then
6645 if ./xenix; then
6646 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
6647 if tans=`cat /etc/systemid 2>&1` ; then
6648 myhostname=$tans
6649 phostname='cat /etc/systemid'
6650 echo "Whadyaknow. Xenix always was a bit strange..."
6651 cont=''
6652 fi
6653 elif $test -r /etc/systemid; then
6654 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6655 fi
6656fi
6657if $test "$cont"; then
6658 echo 'No, maybe "uuname -l" will work...'
6659 if tans=`sh -c 'uuname -l' 2>&1` ; then
6660 myhostname=$tans
6661 phostname='uuname -l'
6662 else
6663 echo 'Strange. Maybe "uname -n" will work...'
6664 if tans=`sh -c 'uname -n' 2>&1` ; then
6665 myhostname=$tans
6666 phostname='uname -n'
6667 else
6668 echo 'Oh well, maybe I can mine it out of whoami.h...'
6669 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6670 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6671 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6672 else
6673 case "$myhostname" in
6674 '') echo "Does this machine have an identity crisis or something?"
6675 phostname='';;
6676 *)
6677 echo "Well, you said $myhostname before..."
6678 phostname='echo $myhostname';;
6679 esac
6680 fi
6681 fi
6682 fi
6683fi
6684: you do not want to know about this
6685set $myhostname
6686myhostname=$1
6687
6688: verify guess
6689if $test "$myhostname" ; then
6690 dflt=y
6691 rp='Your host name appears to be "'$myhostname'".'" Right?"
6692 . ./myread
6693 case "$ans" in
6694 y*) ;;
6695 *) myhostname='';;
6696 esac
6697fi
6698
6699: bad guess or no guess
6700while $test "X$myhostname" = X ; do
6701 dflt=''
6702 rp="Please type the (one word) name of your host:"
6703 . ./myread
6704 myhostname="$ans"
6705done
6706
6707: translate upper to lower if necessary
6708case "$myhostname" in
6709*[A-Z]*)
6710 echo "(Normalizing case in your host name)"
6711 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6712 ;;
6713esac
6714
6715case "$myhostname" in
6716*.*)
6717 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6718 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6719 echo "(Trimming domain name from host name--host name is now $myhostname)"
6720 ;;
6721*) case "$mydomain" in
6722 '')
6723 {
2afac517 6724 test "X$hostcat" = "Xypcat hosts" &&
6725 ypmatch "$myhostname" hosts 2>/dev/null |\
6726 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
6727 $test -s hosts
6728 } || {
7599c0b3 6729 test "X$hostcat" != "X" &&
2afac517 6730 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
6731 /[ ]$myhostname[ . ]/p" > hosts
6732 }
6733 tmp_re="[ . ]"
6734 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
6735 END { print sum }" hosts` = x1 || tmp_re="[ ]"
6736 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6737 hosts | $sort | $uniq | \
6738 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6739 case `$echo X$dflt` in
6740 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
6741 dflt=.
6742 ;;
6743 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6744 ;;
6745 esac
6746 case "$dflt" in
6747 .)
6748 tans=`./loc resolv.conf X /etc /usr/etc`
6749 if $test -f "$tans"; then
6750 echo "(Attempting domain name extraction from $tans)"
a6006777 6751 dflt=.`$sed -n -e 's/ / /g' \
28757baa 6752 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 6753 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 6754 case "$dflt" in
a6006777 6755 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 6756 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 6757 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 6758 ;;
2afac517 6759 esac
6760 fi
6761 ;;
6762 esac
6763 case "$dflt" in
6764 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6765 dflt=.`sh -c domainname 2>/dev/null`
6766 case "$dflt" in
6767 '') dflt='.';;
6768 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6769 esac
6770 ;;
6771 esac
6772 case "$dflt" in
6773 .) echo "(Lost all hope -- silly guess then)"
6774 dflt='.uucp'
6775 ;;
6776 esac
6777 $rm -f hosts
6778 ;;
6779 *) dflt="$mydomain";;
6780 esac;;
6781esac
6782echo " "
6783rp="What is your domain name?"
6784. ./myread
6785tans="$ans"
6786case "$ans" in
6787'') ;;
6788.*) ;;
6789*) tans=".$tans";;
6790esac
6791mydomain="$tans"
6792
6793: translate upper to lower if necessary
6794case "$mydomain" in
6795*[A-Z]*)
6796 echo "(Normalizing case in your domain name)"
6797 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6798 ;;
6799esac
6800
6801: a little sanity check here
6802case "$phostname" in
6803'') ;;
6804*)
6805 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6806 $myhostname$mydomain|$myhostname) ;;
6807 *)
6808 case "$phostname" in
6809 sed*)
6810 echo "(That doesn't agree with your whoami.h file, by the way.)"
6811 ;;
6812 *)
6813 echo "(That doesn't agree with your $phostname command, by the way.)"
6814 ;;
6815 esac
6816 ;;
6817 esac
6818 ;;
6819esac
6820
6821$cat <<EOM
6822
6823I need to get your e-mail address in Internet format if possible, i.e.
6824something like user@host.domain. Please answer accurately since I have
6825no easy means to double check it. The default value provided below
7f95ee77 6826is most probably close to reality but may not be valid from outside
2afac517 6827your organization...
6828
6829EOM
6830cont=x
6831while test "$cont"; do
6832 case "$cf_email" in
6833 '') dflt="$cf_by@$myhostname$mydomain";;
6834 *) dflt="$cf_email";;
6835 esac
6836 rp='What is your e-mail address?'
6837 . ./myread
6838 cf_email="$ans"
6839 case "$cf_email" in
6840 *@*.*) cont='' ;;
6841 *)
6842 rp='Address does not look like an Internet one. Use it anyway?'
6843 case "$fastread" in
6844 yes) dflt=y ;;
6845 *) dflt=n ;;
6846 esac
6847 . ./myread
6848 case "$ans" in
6849 y*) cont='' ;;
6850 *) echo " " ;;
6851 esac
6852 ;;
6853 esac
6854done
6855
6856$cat <<EOM
6857
6858If you or somebody else will be maintaining perl at your site, please
6859fill in the correct e-mail address here so that they may be contacted
6860if necessary. Currently, the "perlbug" program included with perl
6861will send mail to this address in addition to perlbug@perl.com. You may
6862enter "none" for no administrator.
6863
6864EOM
6865case "$perladmin" in
6866'') dflt="$cf_email";;
6867*) dflt="$perladmin";;
6868esac
6869rp='Perl administrator e-mail address'
6870. ./myread
6871perladmin="$ans"
6872
5f05dabc 6873: figure out how to guarantee perl startup
6874case "$startperl" in
6875'')
6876 case "$sharpbang" in
6877 *!)
6878 $cat <<EOH
6879
6880I can use the #! construct to start perl on your system. This will
6881make startup of perl scripts faster, but may cause problems if you
6882want to share those scripts and perl is not in a standard place
6883($binexp/perl) on all your platforms. The alternative is to force
6884a shell by starting the script with a single ':' character.
6885
6886EOH
6887 dflt="$binexp/perl"
6888 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6889 . ./myread
6890 case "$ans" in
68dc0745 6891 none) startperl=": # use perl";;
6892 *) startperl="#!$ans"
3e3baf6d 6893 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 6894 $cat >&4 <<EOM
6895
6896WARNING: Some systems limit the #! command to 32 characters.
6897If you experience difficulty running Perl scripts with #!, try
6898installing Perl in a directory with a shorter pathname.
6899
6900EOM
6901 fi ;;
5f05dabc 6902 esac
6903 ;;
6904 *) startperl=": # use perl"
6905 ;;
6906 esac
6907 ;;
6908esac
6909echo "I'll use $startperl to start perl scripts."
6910
6911: figure best path for perl in scripts
6912case "$perlpath" in
6913'')
6914 perlpath="$binexp/perl"
6915 case "$startperl" in
6916 *!*) ;;
6917 *)
6918 $cat <<EOH
6919
6920I will use the "eval 'exec'" idiom to start Perl on your system.
6921I can use the full path of your Perl binary for this purpose, but
6922doing so may cause problems if you want to share those scripts and
6923Perl is not always in a standard place ($binexp/perl).
6924
6925EOH
6926 dflt="$binexp/perl"
6927 rp="What path shall I use in \"eval 'exec'\"?"
6928 . ./myread
6929 perlpath="$ans"
6930 ;;
6931 esac
6932 ;;
6933esac
6934case "$startperl" in
6935*!*) ;;
6936*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6937esac
6938
dc45a647
MB
6939: determine where public executable scripts go
6940set scriptdir scriptdir
6941eval $prefixit
6942case "$scriptdir" in
6943'')
6944 dflt="$bin"
6945 : guess some guesses
6946 $test -d /usr/share/scripts && dflt=/usr/share/scripts
dd4e71fd
JH
6947 $test -d /usr/share/bin && dflt=/usr/share/bin
6948 $test -d /usr/local/script && dflt=/usr/local/script
6949 $test -d /usr/local/scripts && dflt=/usr/local/scripts
6950 $test -d $prefixexp/script && dflt=$prefixexp/script
dc45a647
MB
6951 set dflt
6952 eval $prefixup
6953 ;;
6954*) dflt="$scriptdir"
6955 ;;
6956esac
6957$cat <<EOM
6958
6959Some installations have a separate directory just for executable scripts so
6960that they can mount it across multiple architectures but keep the scripts in
6961one spot. You might, for example, have a subdirectory of /usr/share for this.
6962Or you might just lump your scripts in with all your other executables.
6963
6964EOM
6965fn=d~
6966rp='Where do you keep publicly executable scripts?'
6967. ./getfile
6968if $test "X$ansexp" != "X$scriptdirexp"; then
6969 installscript=''
6970fi
6971scriptdir="$ans"
6972scriptdirexp="$ansexp"
dd4e71fd
JH
6973: Change installation prefix, if necessary.
6974if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6975 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
dd4e71fd
JH
6976else
6977 installscript="$scriptdirexp"
6978fi
dc45a647 6979
dc45a647 6980: determine where site specific architecture-dependent libraries go.
273cf8d1
GS
6981: sitelib default is /usr/local/lib/perl5/site_perl/$version
6982: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
3a6175e1 6983: sitelib may have an optional trailing /share.
bfb7748a 6984tdflt=`echo $sitelib | $sed 's,/share$,,'`
273cf8d1 6985tdflt="$tdflt/$archname"
dc45a647
MB
6986set sitearch sitearch none
6987eval $prefixit
6988case "$sitearch" in
bfb7748a 6989'') dflt="$tdflt" ;;
dc45a647
MB
6990*) dflt="$sitearch" ;;
6991esac
6992$cat <<EOM
6993
6994The installation process will also create a directory for
6995architecture-dependent site-specific extensions and modules.
6996
6997EOM
6998fn=nd~+
6999rp='Pathname for the site-specific architecture-dependent library files?'
7000. ./getfile
dc45a647
MB
7001sitearch="$ans"
7002sitearchexp="$ansexp"
dd4e71fd
JH
7003: Change installation prefix, if necessary.
7004if $test X"$prefix" != X"$installprefix"; then
ec897fb9 7005 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
7006else
7007 installsitearch="$sitearchexp"
dc45a647
MB
7008fi
7009
717c4fcc
JH
7010: determine where add-on public executables go
7011case "$sitebin" in
7012'') dflt=$siteprefix/bin ;;
7013*) dflt=$sitebin ;;
7014esac
7015fn=d~
7016rp='Pathname where the add-on public executables should be installed?'
7017. ./getfile
7018sitebin="$ans"
7019sitebinexp="$ansexp"
7020: Change installation prefix, if necessary.
7021if $test X"$prefix" != X"$installprefix"; then
7022 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7023else
7024 installsitebin="$sitebinexp"
7025fi
7026
2afac517 7027cat <<EOM
7028
b0ce926a 7029Perl can be built to take advantage of long doubles which
d7d93a81 7030(if available) may give more accuracy and range for floating point numbers.
b0ce926a
JH
7031
7032If this doesn't make any sense to you, just accept the default 'n'.
7033EOM
d7d93a81
JH
7034
7035case "$ccflags" in
7036*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7037esac
7038
b0ce926a
JH
7039case "$uselongdouble" in
7040$define|true|[yY]*) dflt='y';;
7041*) dflt='n';;
7042esac
7043rp='Try to use long doubles if available?'
7044. ./myread
7045case "$ans" in
309d43cf
JH
7046y|Y) val="$define" ;;
7047*) val="$undef" ;;
b0ce926a
JH
7048esac
7049set uselongdouble
7050eval $setvar
7051
d9b3e12d 7052case "$uselongdouble" in
d7d93a81
JH
7053true|[yY]*) uselongdouble="$define" ;;
7054esac
7055
7056case "$uselongdouble" in
7057$define)
d9b3e12d
JH
7058: Look for a hint-file generated 'call-back-unit'. If the
7059: user has specified that long doubles should be used,
7060: we may need to set or change some other defaults.
7061 if $test -f uselongdouble.cbu; then
7062 echo "Your platform has some specific hints for long doubles, using them..."
7063 . ./uselongdouble.cbu
7064 else
7065 $cat <<EOM
7066(Your platform doesn't have any specific hints for long doubles.)
7067EOM
7068 fi
7069 ;;
7070esac
b0ce926a
JH
7071
7072cat <<EOM
7073
d7d93a81
JH
7074Perl can be built to take advantage of long longs which
7075(if available) may give more range for integer numbers.
7076
7077If this doesn't make any sense to you, just accept the default 'n'.
7078EOM
7079
7080case "$ccflags" in
7081*-DUSE_LONG_LONG*) uselonglong="$define" ;;
7082esac
7083
7084case "$uselonglong" in
7085$define|true|[yY]*) dflt='y';;
7086*) dflt='n';;
7087esac
7088rp='Try to use long longs if available?'
7089. ./myread
7090case "$ans" in
7091y|Y) val="$define" ;;
7092*) val="$undef" ;;
7093esac
7094set uselonglong
7095eval $setvar
7096
7097case "$uselonglong" in
7098true|[yY]*) uselonglong="$define" ;;
7099esac
7100
7101case "$uselonglong" in
7102$define)
7103: Look for a hint-file generated 'call-back-unit'. If the
7104: user has specified that long longs should be used,
7105: we may need to set or change some other defaults.
7106 if $test -f uselonglong.cbu; then
7107 echo "Your platform has some specific hints for long longs, using them..."
7108 . ./uselonglong.cbu
7109 else
7110 $cat <<EOM
7111(Your platform doesn't have any specific hints for long longs.)
7112EOM
7113 fi
7114 ;;
7115esac
7116
7117cat <<EOM
7118
85aff577
CS
7119Previous version of $package used the standard IO mechanisms as defined
7120in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 7121mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
7122the default. This abstraction layer can use AT&T's sfio (if you already
7123have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7124problems with some extension modules. Using PerlIO with stdio is safe,
7125but it is slower than plain stdio and therefore is not the default.
2afac517 7126
7127If this doesn't make any sense to you, just accept the default 'n'.
7128EOM
7129case "$useperlio" in
7130$define|true|[yY]*) dflt='y';;
7131*) dflt='n';;
7132esac
7133rp='Use the experimental PerlIO abstraction layer?'
7134. ./myread
7135case "$ans" in
7136y|Y)
7137 val="$define"
7138 ;;
7139*)
7140 echo "Ok, doing things the stdio way"
7141 val="$undef"
7142 ;;
7143esac
7144set useperlio
7145eval $setvar
2304df62 7146
717c4fcc
JH
7147case "$vendorprefix" in
7148'') d_vendorbin="$undef"
7149 vendorbin=''
7150 vendorbinexp=''
7151 ;;
7152*) d_vendorbin="$define"
7153 : determine where vendor-supplied executables go.
7154 dflt=$vendorprefix/bin
7155 fn=d~+
7156 rp='Pathname for the vendor-supplied executables directory?'
7157 . ./getfile
7158 vendorbin="$ans"
7159 vendorbinexp="$ansexp"
7160 : Change installation prefix, if necessary.
7161 if $test X"$prefix" != X"$installprefix"; then
7162 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7163 else
7164 installvendorbin="$vendorbinexp"
7165 fi
7166 ;;
7167esac
7168
628e1a40
JH
7169: check for length of double
7170echo " "
7171case "$doublesize" in
7172'')
7173 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7174 $cat >try.c <<'EOCP'
7175#include <stdio.h>
7176int main()
7177{
7178 printf("%d\n", (int)sizeof(double));
7179 exit(0);
7180}
7181EOCP
7182 set try
7183 if eval $compile_ok; then
7184 doublesize=`./try`
7185 $echo " $doublesize bytes." >&4
7186 else
7187 dflt='8'
7188 echo "(I can't seem to compile the test program. Guessing...)"
7189 rp="What is the size of a double precision number (in bytes)?"
7190 . ./myread
7191 doublesize="$ans"
7192 fi
7193 ;;
7194esac
7195$rm -f try.c try
7196
7197: check for long doubles
7198echo " "
7199$echo $n "Checking to see if your system supports long double..." $c >&4
7200echo 'int main() { long double x = 7.0; }' > try.c
7201set try
7202if eval $compile; then
7203 val="$define"
7204 echo " Yes, it does." >&4
7205else
7206 val="$undef"
7207 echo " No, it doesn't." >&4
7208fi
7209$rm try.*
7210set d_longdbl
7211eval $setvar
7212
7213: check for length of long double
7214case "${d_longdbl}${longdblsize}" in
7215$define)
7216 echo " "
7217 $echo $n "Checking to see how big your long doubles are..." $c >&4
7218 $cat >try.c <<'EOCP'
7219#include <stdio.h>
7220int main()
7221{
7222 printf("%d\n", sizeof(long double));
7223}
7224EOCP
7225 set try
7226 set try
7227 if eval $compile; then
7228 longdblsize=`./try$exe_ext`
7229 $echo " $longdblsize bytes." >&4
7230 else
7231 dflt='8'
7232 echo " "
7233 echo "(I can't seem to compile the test program. Guessing...)" >&4
7234 rp="What is the size of a long double (in bytes)?"
7235 . ./myread
7236 longdblsize="$ans"
7237 fi
7238 if $test "X$doublesize" = "X$longdblsize"; then
7239 echo "(That isn't any different from an ordinary double.)"
7240 fi
7241 ;;
7242esac
7243$rm -f try.* try
ff935051 7244
8e07c86e 7245: Check how to convert floats to strings.
28e8609d 7246if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
7247 echo " "
7248 echo "Checking for an efficient way to convert floats to strings."
628e1a40 7249 $cat >try.c <<EOP
8e07c86e
AD
7250#ifdef TRY_gconvert
7251#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 7252char *myname = "gconvert";
8e07c86e
AD
7253#endif
7254#ifdef TRY_gcvt
7255#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 7256char *myname = "gcvt";
8e07c86e 7257#endif
ff935051
JH
7258#ifdef TRY_qgcvt
7259#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7260char *myname = "qgcvt";
628e1a40 7261#define DOUBLETYPE long double
ff935051 7262#endif
8e07c86e
AD
7263#ifdef TRY_sprintf
7264#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 7265char *myname = "sprintf";
8e07c86e 7266#endif
8ff267be 7267
628e1a40
JH
7268#ifndef DOUBLETYPE
7269#define DOUBLETYPE double
7270#endif
7271
8ff267be 7272#include <stdio.h>
7273
628e1a40
JH
7274#ifdef I_STDLIB
7275#include <stdlib.h>
7276#endif
7277
8ff267be 7278int
7279checkit(expect, got)
7280char *expect;
7281char *got;
7282{
7283 if (strcmp(expect, got)) {
7284 printf("%s oddity: Expected %s, got %s\n",
7285 myname, expect, got);
7286 exit(1);
7287 }
7288}
7289
5a411a32 7290int main()
8ff267be 7291{
ecfc5424 7292 char buf[64];
8ff267be 7293 buf[63] = '\0';
7294
7295 /* This must be 1st test on (which?) platform */
7296 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
628e1a40 7297 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8ff267be 7298 checkit("0.1", buf);
7299
628e1a40 7300 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
8ff267be 7301 checkit("1", buf);
7302
628e1a40 7303 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
8ff267be 7304 checkit("0", buf);
7305
628e1a40 7306 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
8ff267be 7307 checkit("-1", buf);
7308
7309 /* Some Linux gcvt's give 1.e+5 here. */
628e1a40 7310 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
8ff267be 7311 checkit("100000", buf);
7312
7313 /* Some Linux gcvt's give -1.e+5 here. */
628e1a40 7314 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
8ff267be 7315 checkit("-100000", buf);
7316
ecfc5424 7317 exit(0);
a0d0e21e
LW
7318}
7319EOP
5ff3f7a4
GS
7320 case "$d_Gconvert" in
7321 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7322 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7323 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7324 *) xxx_list='gconvert gcvt sprintf' ;;
7325 esac
8e07c86e 7326
628e1a40
JH
7327 case "$d_longdbl$uselongdouble" in
7328 definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
ff935051
JH
7329 esac
7330
5ff3f7a4 7331 for xxx_convert in $xxx_list; do
ff935051 7332 echo "Trying $xxx_convert..."
5ff3f7a4
GS
7333 $rm -f try try$_o
7334 set try -DTRY_$xxx_convert
7335 if eval $compile; then
628e1a40 7336 echo "$xxx_convert() found." >&4
5ff3f7a4
GS
7337 if ./try; then
7338 echo "I'll use $xxx_convert to convert floats into a string." >&4
7339 break;
7340 else
7341 echo "...But $xxx_convert didn't work as I expected."
7342 fi
2304df62 7343 else
5ff3f7a4 7344 echo "$xxx_convert NOT found." >&4
2304df62 7345 fi
5ff3f7a4 7346 done
8e07c86e 7347
5ff3f7a4
GS
7348 case "$xxx_convert" in
7349 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7350 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
ff935051 7351 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
5ff3f7a4
GS
7352 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7353 esac
28e8609d 7354fi
2304df62 7355
cf2093f6
JH
7356echo " "
7357
ea1c3b15 7358if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
7359
7360echo "Checking how to print long doubles..." >&4
7361
7362if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7363 $cat >try.c <<'EOCP'
7364#include <sys/types.h>
7365#include <stdio.h>
7366int main() {
7367 double d = 123.456;
7368 printf("%.3f\n", d);
7369}
7370EOCP
7371 set try
7372 if eval $compile; then
7373 yyy=`./try$exe_ext`
7374 case "$yyy" in
7375 123.456)
7376 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7377 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7378 echo "We will use %f."
7379 ;;
7380 esac
7381 fi
7382fi
7383
7384if $test X"$sPRIfldbl" = X; then
7385 $cat >try.c <<'EOCP'
7386#include <sys/types.h>
7387#include <stdio.h>
7388int main() {
7389 long double d = 123.456;
ea1c3b15 7390 printf("%.3llf\n", d);
cf2093f6
JH
7391}
7392EOCP
7393 set try
7394 if eval $compile; then
7395 yyy=`./try$exe_ext`
7396 case "$yyy" in
7397 123.456)
ea1c3b15
JH
7398 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7399 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7400 echo "We will use %llf."
cf2093f6
JH
7401 ;;
7402 esac
7403 fi
7404fi
7405
7406if $test X"$sPRIfldbl" = X; then
7407 $cat >try.c <<'EOCP'
7408#include <sys/types.h>
7409#include <stdio.h>
7410int main() {
7411 long double d = 123.456;
ea1c3b15 7412 printf("%.3Lf\n", d);
cf2093f6
JH
7413}
7414EOCP
7415 set try
7416 if eval $compile; then
7417 yyy=`./try$exe_ext`
7418 case "$yyy" in
7419 123.456)
ea1c3b15
JH
7420 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7421 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7422 echo "We will use %Lf."
cf2093f6
JH
7423 ;;
7424 esac
7425 fi
7426fi
7427
11dc3f68 7428if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7429 $cat >try.c <<'EOCP'
7430#include <sys/types.h>
7431#include <stdio.h>
7432int main() {
7433 long double d = 123.456;
ea1c3b15 7434 printf("%.3lf\n", d);
cf2093f6
JH
7435}
7436EOCP
7437 set try
7438 if eval $compile; then
7439 yyy=`./try$exe_ext`
7440 case "$yyy" in
7441 123.456)
ea1c3b15
JH
7442 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7443 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7444 echo "We will use %lf."
cf2093f6
JH
7445 ;;
7446 esac
7447 fi
7448fi
7449
09e3ef00
JH
7450if $test X"$sPRIfldbl" = X; then
7451 echo "Cannot figure out how to print long doubles." >&4
7452fi
7453
ea1c3b15 7454$rm -f try try.*
cf2093f6 7455
ea1c3b15 7456fi # d_longdbl
cf2093f6
JH
7457
7458case "$sPRIfldbl" in
7459'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7460 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7461 ;;
7462*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7463 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7464 ;;
7465esac
7466
a0d0e21e
LW
7467: Initialize h_fcntl
7468h_fcntl=false
7469
7470: Initialize h_sysfile
7471h_sysfile=false
2304df62 7472
2304df62
AD
7473: access call always available on UNIX
7474set access d_access
7475eval $inlibc
7476
7477: locate the flags for 'access()'
7478case "$d_access" in
7479"$define")
7480 echo " "
7481 $cat >access.c <<'EOCP'
7482#include <sys/types.h>
7483#ifdef I_FCNTL
7484#include <fcntl.h>
7485#endif
7486#ifdef I_SYS_FILE
7487#include <sys/file.h>
7488#endif
7489#ifdef I_UNISTD
7490#include <unistd.h>
7491#endif
d674cd6d 7492int main() {
2304df62
AD
7493 exit(R_OK);
7494}
8e07c86e
AD
7495EOCP
7496 : check sys/file.h first, no particular reason here
7497 if $test `./findhdr sys/file.h` && \
dfe9444c 7498 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7499 h_sysfile=true;
7500 echo "<sys/file.h> defines the *_OK access constants." >&4
7501 elif $test `./findhdr fcntl.h` && \
dfe9444c 7502 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7503 h_fcntl=true;
7504 echo "<fcntl.h> defines the *_OK access constants." >&4
7505 elif $test `./findhdr unistd.h` && \
dfe9444c 7506 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7507 echo "<unistd.h> defines the *_OK access constants." >&4
7508 else
7509 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7510 fi
7511 ;;
7512esac
7513$rm -f access*
a0d0e21e 7514
5ff3f7a4
GS
7515: see if accessx exists
7516set accessx d_accessx
7517eval $inlibc
7518
8e07c86e
AD
7519: see if alarm exists
7520set alarm d_alarm
7521eval $inlibc
2304df62 7522
cf2093f6
JH
7523: see if atolf exists
7524set atolf d_atolf
7525eval $inlibc
7526
7527: see if atoll exists
7528set atoll d_atoll
7529eval $inlibc
7530
ecfc5424 7531: Look for GNU-cc style attribute checking
2304df62 7532echo " "
a0d0e21e
LW
7533echo "Checking whether your compiler can handle __attribute__ ..." >&4
7534$cat >attrib.c <<'EOCP'
1aef975c 7535#include <stdio.h>
ecfc5424 7536void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7537EOCP
7538if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7539 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7540 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7541 val="$undef"
7542 else
ecfc5424 7543 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7544 val="$define"
7545 fi
7546else
ecfc5424 7547 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7548 val="$undef"
7549fi
ecfc5424 7550set d_attribut
a0d0e21e
LW
7551eval $setvar
7552$rm -f attrib*
7553
7554: see if bcmp exists
7555set bcmp d_bcmp
7556eval $inlibc
7557
7558: see if bcopy exists
7559set bcopy d_bcopy
7560eval $inlibc
7561
2afac517 7562: see if this is a unistd.h system
7563set unistd.h i_unistd
7564eval $inhdr
7565
7566: see if getpgrp exists
7567set getpgrp d_getpgrp
7568eval $inlibc
7569
2afac517 7570case "$d_getpgrp" in
7571"$define")
7572 echo " "
dfe9444c 7573 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7574 $cat >set.c <<EOP
7575#$i_unistd I_UNISTD
7576#include <sys/types.h>
7577#ifdef I_UNISTD
7578# include <unistd.h>
7579#endif
5a411a32 7580int main()
2afac517 7581{
7582 if (getuid() == 0) {
7583 printf("(I see you are running Configure as super-user...)\n");
7584 setuid(1);
7585 }
7586#ifdef TRY_BSD_PGRP
7587 if (getpgrp(1) == 0)
7588 exit(0);
7589#else
7590 if (getpgrp() > 0)
7591 exit(0);
7592#endif
7593 exit(1);
7594}
7595EOP
7596 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7597 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7598 val="$define"
7599 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7600 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7601 val="$undef"
7602 else
7603 echo "I can't seem to compile and run the test program."
7604 if ./usg; then
7605 xxx="a USG one, i.e. you use getpgrp()."
7606 else
7607 # SVR4 systems can appear rather BSD-ish.
7608 case "$i_unistd" in
7609 $undef)
7610 xxx="a BSD one, i.e. you use getpgrp(pid)."
7611 val="$define"
7612 ;;
7613 $define)
7614 xxx="probably a USG one, i.e. you use getpgrp()."
7615 val="$undef"
7616 ;;
7617 esac
7618 fi
7619 echo "Assuming your getpgrp is $xxx" >&4
7620 fi
7621 ;;
7622*) val="$undef";;
7623esac
7624set d_bsdgetpgrp
7625eval $setvar
7626$rm -f set set.c
7627
a0d0e21e
LW
7628: see if setpgrp exists
7629set setpgrp d_setpgrp
7630eval $inlibc
7631
a0d0e21e
LW
7632case "$d_setpgrp" in
7633"$define")
7634 echo " "
dfe9444c 7635 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7636 $cat >set.c <<EOP
2afac517 7637#$i_unistd I_UNISTD
7638#include <sys/types.h>
7639#ifdef I_UNISTD
7640# include <unistd.h>
7641#endif
5a411a32 7642int main()
a0d0e21e
LW
7643{
7644 if (getuid() == 0) {
7645 printf("(I see you are running Configure as super-user...)\n");
7646 setuid(1);
7647 }
2afac517 7648#ifdef TRY_BSD_PGRP
a0d0e21e 7649 if (-1 == setpgrp(1, 1))
2afac517 7650 exit(0);
7651#else
7652 if (setpgrp() != -1)
7653 exit(0);
7654#endif
7655 exit(1);
a0d0e21e
LW
7656}
7657EOP
2afac517 7658 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7659 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7660 val="$define"
7661 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7662 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7663 val="$undef"
a0d0e21e 7664 else
dfe9444c 7665 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7666 if ./usg; then
2afac517 7667 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7668 else
2afac517 7669 # SVR4 systems can appear rather BSD-ish.
7670 case "$i_unistd" in
7671 $undef)
7672 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7673 val="$define"
7674 ;;
7675 $define)
7676 xxx="probably a USG one, i.e. you use setpgrp()."
7677 val="$undef"
7678 ;;
7679 esac
a0d0e21e 7680 fi
2afac517 7681 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7682 fi
7683 ;;
7684*) val="$undef";;
7685esac
2afac517 7686set d_bsdsetpgrp
a0d0e21e
LW
7687eval $setvar
7688$rm -f set set.c
a0d0e21e
LW
7689: see if bzero exists
7690set bzero d_bzero
7691eval $inlibc
7692
ecfc5424 7693: see if signal is declared as pointer to function returning int or void
a0d0e21e 7694echo " "
ecfc5424
AD
7695xxx=`./findhdr signal.h`
7696$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7697if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7698 echo "You have int (*signal())() instead of void." >&4
7699 val="$undef"
7700elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7701 echo "You have void (*signal())()." >&4
ecfc5424
AD
7702 val="$define"
7703elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7704 echo "You have int (*signal())() instead of void." >&4
7705 val="$undef"
dfe9444c
AD
7706elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7707 echo "You have void (*signal())()." >&4
7708 val="$define"
a0d0e21e 7709else
ecfc5424
AD
7710 case "$d_voidsig" in
7711 '')
7712 echo "I can't determine whether signal handler returns void or int..." >&4
7713 dflt=void
7714 rp="What type does your signal handler return?"
7715 . ./myread
7716 case "$ans" in
7717 v*) val="$define";;
7718 *) val="$undef";;
7719 esac;;
7720 "$define")
dfe9444c
AD
7721 echo "As you already told me, signal handler returns void." >&4
7722 val="$define"
7723 ;;
7724 *) echo "As you already told me, signal handler returns int." >&4
7725 val="$undef"
7726 ;;
ecfc5424
AD
7727 esac
7728fi
7729set d_voidsig
7730eval $setvar
7731case "$d_voidsig" in
7732"$define") signal_t="void";;
7733*) signal_t="int";;
7734esac
7735$rm -f $$.tmp
7736
7737: check for ability to cast large floats to 32-bit ints.
7738echo " "
7739echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7740if $test "$intsize" -ge 4; then
ecfc5424
AD
7741 xxx=int
7742else
7743 xxx=long
7744fi
7745$cat >try.c <<EOCP
e5c9fcd0 7746#include <stdio.h>
ecfc5424
AD
7747#include <sys/types.h>
7748#include <signal.h>
a1896f58 7749$signal_t blech(s) int s; { exit(3); }
d674cd6d 7750int main()
2304df62 7751{
a0d0e21e 7752 $xxx i32;
e5c9fcd0 7753 double f, g;
2304df62 7754 int result = 0;
89434db5 7755 char str[16];
2304df62
AD
7756 signal(SIGFPE, blech);
7757
89434db5
AD
7758 /* Don't let compiler optimize the test away. Store the number
7759 in a writable string for gcc to pass to sscanf under HP/UX.
7760 */
7761 sprintf(str, "2147483647");
7762 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7763 g = 10 * f;
7764 i32 = ($xxx) g;
2304df62 7765
e5c9fcd0
AD
7766 /* x86 processors will probably give 0x8000 0000, which is a
7767 sign change. We don't want that. We want to mimic SPARC
7768 behavior here, which is to preserve the sign and give
7769 back 0x7fff ffff.
7770 */
a0d0e21e 7771 if (i32 != ($xxx) f)
2304df62
AD
7772 result |= 1;
7773 exit(result);
7774}
7775EOCP
dfe9444c 7776set try
dc45a647 7777if eval $compile_ok; then
2304df62
AD
7778 ./try
7779 yyy=$?
7780else
a0d0e21e 7781 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
7782 yyy=1
7783fi
7784case "$yyy" in
77850) val="$define"
7786 echo "Yup, it can."
7787 ;;
7788*) val="$undef"
7789 echo "Nope, it can't."
7790 ;;
7791esac
7792set d_casti32
7793eval $setvar
85e6fe83 7794$rm -f try try.*
a0d0e21e 7795
2304df62
AD
7796: check for ability to cast negative floats to unsigned
7797echo " "
7798echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 7799$cat >try.c <<EOCP
e5c9fcd0 7800#include <stdio.h>
ecfc5424 7801#include <sys/types.h>
2304df62 7802#include <signal.h>
a1896f58
AD
7803$signal_t blech(s) int s; { exit(7); }
7804$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
7805unsigned long dummy_long(p) unsigned long p; { return p; }
7806unsigned int dummy_int(p) unsigned int p; { return p; }
7807unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 7808int main()
2304df62 7809{
e5c9fcd0 7810 double f;
2304df62
AD
7811 unsigned long along;
7812 unsigned int aint;
7813 unsigned short ashort;
7814 int result = 0;
89434db5
AD
7815 char str[16];
7816
e5c9fcd0
AD
7817 /* Frustrate gcc-2.7.2's optimizer which failed this test with
7818 a direct f = -123. assignment. gcc-2.8.0 reportedly
7819 optimized the whole file away
7820 */
89434db5
AD
7821 /* Store the number in a writable string for gcc to pass to
7822 sscanf under HP/UX.
7823 */
7824 sprintf(str, "-123");
7825 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
7826
7827 signal(SIGFPE, blech);
7828 along = (unsigned long)f;
7829 aint = (unsigned int)f;
7830 ashort = (unsigned short)f;
7831 if (along != (unsigned long)-123)
7832 result |= 1;
7833 if (aint != (unsigned int)-123)
7834 result |= 1;
7835 if (ashort != (unsigned short)-123)
7836 result |= 1;
89434db5
AD
7837 sprintf(str, "1073741824.");
7838 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
7839 f = f + f;
7840 along = 0;
7841 along = (unsigned long)f;
7842 if (along != 0x80000000)
7843 result |= 2;
7844 f -= 1.;
7845 along = 0;
7846 along = (unsigned long)f;
7847 if (along != 0x7fffffff)
7848 result |= 1;
7849 f += 2.;
7850 along = 0;
7851 along = (unsigned long)f;
7852 if (along != 0x80000001)
7853 result |= 2;
232e078e
AD
7854 if (result)
7855 exit(result);
7856 signal(SIGFPE, blech_in_list);
89434db5
AD
7857 sprintf(str, "123.");
7858 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
7859 along = dummy_long((unsigned long)f);
7860 aint = dummy_int((unsigned int)f);
7861 ashort = dummy_short((unsigned short)f);
7862 if (along != (unsigned long)123)
7863 result |= 4;
7864 if (aint != (unsigned int)123)
7865 result |= 4;
7866 if (ashort != (unsigned short)123)
7867 result |= 4;
2304df62
AD
7868 exit(result);
7869
7870}
7871EOCP
dfe9444c 7872set try
dc45a647 7873if eval $compile_ok; then
2304df62
AD
7874 ./try
7875 castflags=$?
7876else
ecfc5424 7877 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 7878 castflags=7
2304df62
AD
7879fi
7880case "$castflags" in
78810) val="$define"
7882 echo "Yup, it can."
7883 ;;
7884*) val="$undef"
7885 echo "Nope, it can't."
7886 ;;
7887esac
7888set d_castneg
7889eval $setvar
7890$rm -f try.*
7891
2304df62
AD
7892: see if vprintf exists
7893echo " "
7894if set vprintf val -f d_vprintf; eval $csym; $val; then
7895 echo 'vprintf() found.' >&4
7896 val="$define"
7897 $cat >vprintf.c <<'EOF'
7898#include <varargs.h>
7899
d674cd6d 7900int main() { xxx("foo"); }
2304df62
AD
7901
7902xxx(va_alist)
7903va_dcl
7904{
7905 va_list args;
7906 char buf[10];
7907
7908 va_start(args);
7909 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7910}
7911EOF
dfe9444c
AD
7912 set vprintf
7913 if eval $compile && ./vprintf; then
2304df62
AD
7914 echo "Your vsprintf() returns (int)." >&4
7915 val2="$undef"
7916 else
7917 echo "Your vsprintf() returns (char*)." >&4
7918 val2="$define"
7919 fi
7920else
7921 echo 'vprintf() NOT found.' >&4
7922 val="$undef"
7923 val2="$undef"
7924fi
7925set d_vprintf
7926eval $setvar
7927val=$val2
7928set d_charvspr
7929eval $setvar
7930
a0d0e21e
LW
7931: see if chown exists
7932set chown d_chown
7933eval $inlibc
7934
7935: see if chroot exists
7936set chroot d_chroot
7937eval $inlibc
7938
2304df62
AD
7939: see if chsize exists
7940set chsize d_chsize
7941eval $inlibc
7942
7943: check for const keyword
7944echo " "
7945echo 'Checking to see if your C compiler knows about "const"...' >&4
7946$cat >const.c <<'EOCP'
7947typedef struct spug { int drokk; } spug;
5a411a32 7948int main()
2304df62
AD
7949{
7950 const char *foo;
7951 const spug y;
7952}
7953EOCP
7954if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7955 val="$define"
7956 echo "Yup, it does."
7957else
7958 val="$undef"
7959 echo "Nope, it doesn't."
7960fi
7961set d_const
7962eval $setvar
7963
7964: see if crypt exists
7965echo " "
7966if set crypt val -f d_crypt; eval $csym; $val; then
7967 echo 'crypt() found.' >&4
7968 val="$define"
7969 cryptlib=''
7970else
dfe9444c 7971 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 7972 if $test -z "$cryptlib"; then
dfe9444c 7973 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
7974 else
7975 cryptlib=-lcrypt
7976 fi
7977 if $test -z "$cryptlib"; then
dfe9444c 7978 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
7979 else
7980 cryptlib=-lcrypt
7981 fi
7982 if $test -z "$cryptlib"; then
dfe9444c 7983 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
7984 else
7985 cryptlib=-lcrypt
7986 fi
7987 if $test -z "$cryptlib"; then
7988 echo 'crypt() NOT found.' >&4
7989 val="$undef"
7990 else
7991 val="$define"
7992 fi
7993fi
7994set d_crypt
7995eval $setvar
7996
921b2963
JH
7997: get csh whereabouts
7998case "$csh" in
7999'csh') val="$undef" ;;
8000*) val="$define" ;;
8001esac
8002set d_csh
8003eval $setvar
8004: Respect a hint or command line value for full_csh.
8005case "$full_csh" in
8006'') full_csh=$csh ;;
8007esac
8008
a0d0e21e
LW
8009: see if cuserid exists
8010set cuserid d_cuserid
2304df62
AD
8011eval $inlibc
8012
a0d0e21e
LW
8013: see if this is a limits.h system
8014set limits.h i_limits
85e6fe83
LW
8015eval $inhdr
8016
a0d0e21e
LW
8017: see if this is a float.h system
8018set float.h i_float
8019eval $inhdr
8020
8021: See if number of significant digits in a double precision number is known
8022echo " "
8023$cat >dbl_dig.c <<EOM
8024#$i_limits I_LIMITS
8025#$i_float I_FLOAT
8026#ifdef I_LIMITS
8027#include <limits.h>
85e6fe83 8028#endif
a0d0e21e
LW
8029#ifdef I_FLOAT
8030#include <float.h>
8031#endif
8032#ifdef DBL_DIG
8033printf("Contains DBL_DIG");
85e6fe83 8034#endif
85e6fe83 8035EOM
a0d0e21e
LW
8036$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8037if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8038 echo "DBL_DIG found." >&4
8039 val="$define"
2304df62 8040else
a0d0e21e
LW
8041 echo "DBL_DIG NOT found." >&4
8042 val="$undef"
2304df62 8043fi
a0d0e21e
LW
8044$rm -f dbl_dig.?
8045set d_dbl_dig
2304df62 8046eval $setvar
2304df62 8047
a0d0e21e
LW
8048: see if difftime exists
8049set difftime d_difftime
2304df62
AD
8050eval $inlibc
8051
a0d0e21e
LW
8052: see if this is a dirent system
8053echo " "
8054if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8055 val="$define"
8056 echo "<dirent.h> found." >&4
8057else
8058 val="$undef"
8059 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8060 echo "<sys/dir.h> found." >&4
8061 echo " "
8062 else
8063 xinc=`./findhdr sys/ndir.h`
8064 fi
8065 echo "<dirent.h> NOT found." >&4
8066fi
8067set i_dirent
8068eval $setvar
8069
8070: Look for type of directory structure.
8071echo " "
8072$cppstdin $cppflags $cppminus < "$xinc" > try.c
8073
8074case "$direntrytype" in
8075''|' ')
8076 case "$i_dirent" in
8077 $define) guess1='struct dirent' ;;
8078 *) guess1='struct direct' ;;
2afac517 8079 esac
8080 ;;
8081*) guess1="$direntrytype"
8082 ;;
8e07c86e
AD
8083esac
8084
2afac517 8085case "$guess1" in
8086'struct dirent') guess2='struct direct' ;;
8087*) guess2='struct dirent' ;;
8088esac
8089
8090if $contains "$guess1" try.c >/dev/null 2>&1; then
8091 direntrytype="$guess1"
8092 echo "Your directory entries are $direntrytype." >&4
8093elif $contains "$guess2" try.c >/dev/null 2>&1; then
8094 direntrytype="$guess2"
8095 echo "Your directory entries seem to be $direntrytype." >&4
8096else
8097 echo "I don't recognize your system's directory entries." >&4
8098 rp="What type is used for directory entries on this system?"
8099 dflt="$guess1"
8100 . ./myread
8101 direntrytype="$ans"
8102fi
8103$rm -f try.c
a0d0e21e 8104
a0d0e21e 8105
2afac517 8106: see if the directory entry stores field length
8107echo " "
8108$cppstdin $cppflags $cppminus < "$xinc" > try.c
8109if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8110 echo "Good, your directory entry keeps length information in d_namlen." >&4
8111 val="$define"
8112else
8113 echo "Your directory entry does not know about the d_namlen field." >&4
8114 val="$undef"
8115fi
8116set d_dirnamlen
8117eval $setvar
8118$rm -f try.c
a0d0e21e 8119
5ff3f7a4
GS
8120: see if dlerror exists
8121xxx_runnm="$runnm"
8122runnm=false
8123set dlerror d_dlerror
8124eval $inlibc
8125runnm="$xxx_runnm"
8126
8127: see if dlfcn is available
8128set dlfcn.h i_dlfcn
8129eval $inhdr
8130
8131case "$usedl" in
8132$define|y|true)
8133 $cat << EOM
8134
8135On a few systems, the dynamically loaded modules that perl generates and uses
8136will need a different extension than shared libs. The default will probably
8137be appropriate.
8138
8139EOM
8140 case "$dlext" in
8141 '') dflt="$so" ;;
8142 *) dflt="$dlext" ;;
8143 esac
8144 rp='What is the extension of dynamically loaded modules'
8145 . ./myread
8146 dlext="$ans"
8147 ;;
8148*)
8149 dlext="none"
8150 ;;
8151esac
8152
8153: Check if dlsym need a leading underscore
a0d0e21e
LW
8154echo " "
8155val="$undef"
8156
8157case "$dlsrc" in
8158dl_dlopen.xs)
8159 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8160 $cat >dyna.c <<'EOM'
8161fred () { }
8162EOM
8163
8164$cat >fred.c<<EOM
8165
8166#include <stdio.h>
8167#$i_dlfcn I_DLFCN
8168#ifdef I_DLFCN
8169#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8170#else
8171#include <sys/types.h>
8172#include <nlist.h>
8173#include <link.h>
8174#endif
8175
8176extern int fred() ;
8177
5a411a32 8178int main()
a0d0e21e
LW
8179{
8180 void * handle ;
8181 void * symbol ;
8182#ifndef RTLD_LAZY
8183 int mode = 1 ;
8184#else
8185 int mode = RTLD_LAZY ;
8186#endif
8187 handle = dlopen("./dyna.$dlext", mode) ;
8188 if (handle == NULL) {
5f05dabc 8189 printf ("1\n") ;
8190 fflush (stdout) ;
8191 exit(0);
a0d0e21e
LW
8192 }
8193 symbol = dlsym(handle, "fred") ;
8194 if (symbol == NULL) {
5f05dabc 8195 /* try putting a leading underscore */
8196 symbol = dlsym(handle, "_fred") ;
8197 if (symbol == NULL) {
8198 printf ("2\n") ;
8199 fflush (stdout) ;
8200 exit(0);
8201 }
8202 printf ("3\n") ;
a0d0e21e
LW
8203 }
8204 else
5f05dabc 8205 printf ("4\n") ;
36477c24 8206 fflush (stdout) ;
8207 exit(0);
a0d0e21e
LW
8208}
8209EOM
760ac839 8210 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 8211 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
8212 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
8213 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 8214 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
8215 xxx=`./fred`
8216 case $xxx in
8217 1) echo "Test program failed using dlopen." >&4
8218 echo "Perhaps you should not use dynamic loading." >&4;;
8219 2) echo "Test program failed using dlsym." >&4
8220 echo "Perhaps you should not use dynamic loading." >&4;;
8221 3) echo "dlsym needs a leading underscore" >&4
8222 val="$define" ;;
8223 4) echo "dlsym doesn't need a leading underscore." >&4;;
8224 esac
8225 else
8226 echo "I can't compile and run the test program." >&4
88d5303d 8227 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
a0d0e21e
LW
8228 fi
8229 ;;
8230esac
8231
a78b0d02 8232$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
8233
8234set d_dlsymun
8235eval $setvar
8236
85ab1d1d
JH
8237hasproto='varname=$1; func=$2; shift; shift;
8238while $test $# -ge 2; do
8239 case "$1" in
8240 $define) echo "#include <$2>";;
8241 esac ;
8242 shift 2;
8243done > try.c;
8244$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8245if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8246 echo "$func() prototype found.";
8247 val="$define";
8248else
8249 echo "$func() prototype NOT found.";
8250 val="$undef";
8251fi;
8252set $varname;
8253eval $setvar;
8254$rm -f try.c tryout.c'
8255
8256: see if prototype for drand48 is available
8257echo " "
8258set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8259eval $hasproto
8260
a0d0e21e
LW
8261: see if dup2 exists
8262set dup2 d_dup2
8263eval $inlibc
8264
5ff3f7a4
GS
8265: see if eaccess exists
8266set eaccess d_eaccess
8267eval $inlibc
8268
8269: see if endgrent exists
8270set endgrent d_endgrent
8271eval $inlibc
8272
e5c9fcd0
AD
8273: see if endhostent exists
8274set endhostent d_endhent
8275eval $inlibc
8276
8277: see if endnetent exists
8278set endnetent d_endnent
8279eval $inlibc
8280
8281: see if endprotoent exists
8282set endprotoent d_endpent
8283eval $inlibc
8284
5ff3f7a4
GS
8285: see if endpwent exists
8286set endpwent d_endpwent
8287eval $inlibc
8288
e5c9fcd0
AD
8289: see if endservent exists
8290set endservent d_endsent
8291eval $inlibc
8292
f1066039
JH
8293: see if endspent exists
8294set endspent d_endspent
8295eval $inlibc
8296
8e07c86e
AD
8297: Locate the flags for 'open()'
8298echo " "
8299$cat >open3.c <<'EOCP'
8300#include <sys/types.h>
8301#ifdef I_FCNTL
8302#include <fcntl.h>
8303#endif
8304#ifdef I_SYS_FILE
8305#include <sys/file.h>
8306#endif
d674cd6d 8307int main() {
8e07c86e
AD
8308 if(O_RDONLY);
8309#ifdef O_TRUNC
8310 exit(0);
8311#else
8312 exit(1);
8313#endif
8314}
8315EOCP
8316: check sys/file.h first to get FREAD on Sun
8317if $test `./findhdr sys/file.h` && \
dfe9444c 8318 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8319 h_sysfile=true;
8320 echo "<sys/file.h> defines the O_* constants..." >&4
8321 if ./open3; then
8322 echo "and you have the 3 argument form of open()." >&4
8323 val="$define"
8324 else
8325 echo "but not the 3 argument form of open(). Oh, well." >&4
8326 val="$undef"
8327 fi
8328elif $test `./findhdr fcntl.h` && \
dfe9444c 8329 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8330 h_fcntl=true;
8331 echo "<fcntl.h> defines the O_* constants..." >&4
8332 if ./open3; then
8333 echo "and you have the 3 argument form of open()." >&4
8334 val="$define"
8335 else
8336 echo "but not the 3 argument form of open(). Oh, well." >&4
8337 val="$undef"
8338 fi
8339else
8340 val="$undef"
8341 echo "I can't find the O_* constant definitions! You got problems." >&4
8342fi
8343set d_open3
8344eval $setvar
8345$rm -f open3*
8346
213c275f
JH
8347: see which of string.h or strings.h is needed
8348echo " "
8349strings=`./findhdr string.h`
8350if $test "$strings" && $test -r "$strings"; then
8351 echo "Using <string.h> instead of <strings.h>." >&4
8352 val="$define"
8353else
8354 val="$undef"
8355 strings=`./findhdr strings.h`
8356 if $test "$strings" && $test -r "$strings"; then
8357 echo "Using <strings.h> instead of <string.h>." >&4
8358 else
8359 echo "No string header found -- You'll surely have problems." >&4
8360 fi
8361fi
8362set i_string
8363eval $setvar
8364case "$i_string" in
8365"$undef") strings=`./findhdr strings.h`;;
8366*) strings=`./findhdr string.h`;;
8367esac
8368
8e07c86e
AD
8369: check for non-blocking I/O stuff
8370case "$h_sysfile" in
8371true) echo "#include <sys/file.h>" > head.c;;
8372*)
8373 case "$h_fcntl" in
8374 true) echo "#include <fcntl.h>" > head.c;;
8375 *) echo "#include <sys/fcntl.h>" > head.c;;
8376 esac
8377 ;;
8378esac
8379echo " "
8380echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8381case "$o_nonblock" in
8382'')
8383 $cat head.c > try.c
8384 $cat >>try.c <<'EOCP'
213c275f 8385#include <stdio.h>
d674cd6d 8386int main() {
8e07c86e
AD
8387#ifdef O_NONBLOCK
8388 printf("O_NONBLOCK\n");
8389 exit(0);
8390#endif
8391#ifdef O_NDELAY
8392 printf("O_NDELAY\n");
8393 exit(0);
8394#endif
8395#ifdef FNDELAY
8396 printf("FNDELAY\n");
8397 exit(0);
8398#endif
8399 exit(0);
8400}
8401EOCP
dfe9444c 8402 set try
dc45a647 8403 if eval $compile_ok; then
8e07c86e
AD
8404 o_nonblock=`./try`
8405 case "$o_nonblock" in
8406 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8407 *) echo "Seems like we can use $o_nonblock.";;
8408 esac
8409 else
8410 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8411 fi
8412 ;;
8413*) echo "Using $hint value $o_nonblock.";;
8414esac
8415$rm -f try try.* .out core
8416
8417echo " "
8418echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8419case "$eagain" in
8420'')
8421 $cat head.c > try.c
8422 $cat >>try.c <<EOCP
8423#include <errno.h>
8424#include <sys/types.h>
8425#include <signal.h>
213c275f 8426#include <stdio.h>
4633a7c4 8427#define MY_O_NONBLOCK $o_nonblock
dc45a647 8428#ifndef errno /* XXX need better Configure test */
8e07c86e 8429extern int errno;
dc45a647 8430#endif
14e4fe40
JH
8431#$i_unistd I_UNISTD
8432#ifdef I_UNISTD
213c275f
JH
8433#include <unistd.h>
8434#endif
8435#ifdef $i_string
8436#include <string.h>
8437#else
8438#include <strings.h>
8439#endif
8e07c86e 8440$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8441EOCP
8442 $cat >> try.c <<'EOCP'
d674cd6d 8443int main()
8e07c86e
AD
8444{
8445 int pd[2];
8446 int pu[2];
8447 char buf[1];
8448 char string[100];
8449
8450 pipe(pd); /* Down: child -> parent */
8451 pipe(pu); /* Up: parent -> child */
8452 if (0 != fork()) {
8453 int ret;
8454 close(pd[1]); /* Parent reads from pd[0] */
8455 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8456 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8457 exit(1);
8458 signal(SIGALRM, blech);
8459 alarm(5);
8460 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8461 exit(2);
8462 sprintf(string, "%d\n", ret);
8463 write(2, string, strlen(string));
8464 alarm(0);
8465#ifdef EAGAIN
8466 if (errno == EAGAIN) {
8467 printf("EAGAIN\n");
8468 goto ok;
8469 }
8470#endif
8471#ifdef EWOULDBLOCK
8472 if (errno == EWOULDBLOCK)
8473 printf("EWOULDBLOCK\n");
8474#endif
8475 ok:
8476 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8477 sleep(2); /* Give it time to close our pipe */
8478 alarm(5);
8479 ret = read(pd[0], buf, 1); /* Should read EOF */
8480 alarm(0);
8481 sprintf(string, "%d\n", ret);
8482 write(3, string, strlen(string));
8483 exit(0);
8484 }
8485
8486 close(pd[0]); /* We write to pd[1] */
8487 close(pu[1]); /* We read from pu[0] */
8488 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8489 close(pd[1]); /* Pipe pd is now fully closed! */
8490 exit(0); /* Bye bye, thank you for playing! */
8491}
8492EOCP
dfe9444c 8493 set try
dc45a647 8494 if eval $compile_ok; then
774d564b 8495 echo "$startsh" >mtry
40a7a20a 8496 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8497 chmod +x mtry
8498 ./mtry >/dev/null 2>&1
8499 case $? in
8500 0) eagain=`$cat try.out`;;
8501 1) echo "Could not perform non-blocking setting!";;
8502 2) echo "I did a successful read() for something that was not there!";;
8503 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8504 *) echo "Something terribly wrong happened during testing.";;
8505 esac
8506 rd_nodata=`$cat try.ret`
8507 echo "A read() system call with no data present returns $rd_nodata."
8508 case "$rd_nodata" in
8509 0|-1) ;;
8510 *)
8511 echo "(That's peculiar, fixing that to be -1.)"
8512 rd_nodata=-1
8513 ;;
8514 esac
8515 case "$eagain" in
8516 '')
8517 echo "Forcing errno EAGAIN on read() with no data available."
8518 eagain=EAGAIN
8519 ;;
8520 *)
8521 echo "Your read() sets errno to $eagain when no data is available."
8522 ;;
8523 esac
8524 status=`$cat try.err`
8525 case "$status" in
8526 0) echo "And it correctly returns 0 to signal EOF.";;
8527 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8528 *) echo "However, your read() returns '$status' on EOF??";;
8529 esac
8530 val="$define"
28757baa 8531 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8532 echo "WARNING: you can't distinguish between EOF and no data!"
8533 val="$undef"
8534 fi
8535 else
8536 echo "I can't compile the test program--assuming errno EAGAIN will do."
8537 eagain=EAGAIN
8538 fi
8539 set d_eofnblk
8540 eval $setvar
8541 ;;
8542*)
8543 echo "Using $hint value $eagain."
8544 echo "Your read() returns $rd_nodata when no data is present."
8545 case "$d_eofnblk" in
8546 "$define") echo "And you can see EOF because read() returns 0.";;
8547 "$undef") echo "But you can't see EOF status from read() returned value.";;
8548 *)
8549 echo "(Assuming you can't see EOF status from read anyway.)"
8550 d_eofnblk=$undef
8551 ;;
8552 esac
8553 ;;
8554esac
8555$rm -f try try.* .out core head.c mtry
8556
a0d0e21e
LW
8557: see if fchmod exists
8558set fchmod d_fchmod
8559eval $inlibc
8560
8561: see if fchown exists
8562set fchown d_fchown
8563eval $inlibc
8564
8565: see if this is an fcntl system
8566set fcntl d_fcntl
8567eval $inlibc
8568
b7b35fc2
JH
8569hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8570while $test $# -ge 2; do
8571 case "$1" in
8572 $define) echo "#include <$2>";;
8573 esac ;
8574 shift 2;
8575done > try.c;
8576echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8577set try;
8578if eval $compile; then
8579 val="$define";
8580else
8581 val="$undef";
8582fi;
8583set $varname;
8584eval $setvar;
8585$rm -f try.c try.o'
8586
8587socketlib=''
8588sockethdr=''
8589: see whether socket exists
8590echo " "
8591$echo $n "Hmm... $c" >&4
8592if set socket val -f d_socket; eval $csym; $val; then
8593 echo "Looks like you have Berkeley networking support." >&4
8594 d_socket="$define"
8595 if set setsockopt val -f; eval $csym; $val; then
8596 d_oldsock="$undef"
8597 else
8598 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8599 d_oldsock="$define"
8600 fi
8601else
8602 if $contains socklib libc.list >/dev/null 2>&1; then
8603 echo "Looks like you have Berkeley networking support." >&4
8604 d_socket="$define"
8605 : we will have to assume that it supports the 4.2 BSD interface
8606 d_oldsock="$undef"
8607 else
8608 echo "You don't have Berkeley networking in libc$_a..." >&4
8609 if test "X$d_socket" = "X$define"; then
8610 echo "...but you seem to believe that you have sockets." >&4
8611 else
8612 for net in net socket
8613 do
8614 if test -f /usr/lib/lib$net$_a; then
8615 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8616 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8617 if $contains socket libc.list >/dev/null 2>&1; then
8618 d_socket="$define"
8619 socketlib="-l$net"
8620 case "$net" in
8621 net)
8622 echo "...but the Wollongong group seems to have hacked it in." >&4
8623 sockethdr="-I/usr/netinclude"
8624 ;;
8625 esac
8626 echo "Found Berkeley sockets interface in lib$net." >& 4
8627 if $contains setsockopt libc.list >/dev/null 2>&1; then
8628 d_oldsock="$undef"
8629 else
8630 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8631 d_oldsock="$define"
8632 fi
8633 break
8634 fi
8635 fi
8636 done
8637 if test "X$d_socket" != "X$define"; then
8638 echo "or anywhere else I see." >&4
8639 d_socket="$undef"
8640 d_oldsock="$undef"
8641 fi
8642 fi
8643 fi
8644fi
8645
8646: see if socketpair exists
8647set socketpair d_sockpair
8648eval $inlibc
8649
8650
8651echo " "
8652echo "Checking the availability of certain socket constants..." >& 4
8653for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8654 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8655 $cat >try.c <<EOF
8656#include <sys/types.h>
8657#include <sys/socket.h>
8658int main() {
8659 int i = $ENUM;
8660}
8661EOF
8662 val="$undef"
8663 set try; if eval $compile; then
8664 val="$define"
8665 fi
8666 set d_${enum}; eval $setvar
8667 $rm -f try.c try
8668done
8669
921b2963
JH
8670: see if sys/select.h has to be included
8671set sys/select.h i_sysselct
8672eval $inhdr
8673
8674: see if we should include time.h, sys/time.h, or both
8675echo " "
8676if test "X$timeincl" = X; then
8677 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8678 $echo $n "I'm now running the test program...$c"
8679 $cat >try.c <<'EOCP'
8680#include <sys/types.h>
8681#ifdef I_TIME
8682#include <time.h>
8683#endif
8684#ifdef I_SYSTIME
8685#ifdef SYSTIMEKERNEL
8686#define KERNEL
8687#endif
8688#include <sys/time.h>
8689#endif
8690#ifdef I_SYSSELECT
8691#include <sys/select.h>
8692#endif
d674cd6d 8693int main()
921b2963
JH
8694{
8695 struct tm foo;
8696#ifdef S_TIMEVAL
8697 struct timeval bar;
8698#endif
8699#ifdef S_TIMEZONE
8700 struct timezone tzp;
8701#endif
8702 if (foo.tm_sec == foo.tm_sec)
8703 exit(0);
8704#ifdef S_TIMEVAL
8705 if (bar.tv_sec == bar.tv_sec)
8706 exit(0);
8707#endif
8708 exit(1);
8709}
8710EOCP
8711 flags=''
8712 for s_timezone in '-DS_TIMEZONE' ''; do
8713 sysselect=''
8714 for s_timeval in '-DS_TIMEVAL' ''; do
8715 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8716 for i_time in '' '-DI_TIME'; do
8717 for i_systime in '-DI_SYSTIME' ''; do
8718 case "$flags" in
8719 '') $echo $n ".$c"
8720 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8721 if eval $compile; then
8722 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8723 shift
8724 flags="$*"
8725 echo " "
8726 $echo $n "Succeeded with $flags$c"
8727 fi
8728 ;;
8729 esac
8730 done
8731 done
8732 done
8733 done
8734 done
8735 timeincl=''
8736 echo " "
8737 case "$flags" in
8738 *SYSTIMEKERNEL*) i_systimek="$define"
8739 timeincl=`./findhdr sys/time.h`
8740 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8741 *) i_systimek="$undef";;
8742 esac
8743 case "$flags" in
8744 *I_TIME*) i_time="$define"
8745 timeincl=`./findhdr time.h`" $timeincl"
8746 echo "We'll include <time.h>." >&4;;
8747 *) i_time="$undef";;
8748 esac
8749 case "$flags" in
8750 *I_SYSTIME*) i_systime="$define"
8751 timeincl=`./findhdr sys/time.h`" $timeincl"
8752 echo "We'll include <sys/time.h>." >&4;;
8753 *) i_systime="$undef";;
8754 esac
8755 $rm -f try.c try
8756fi
8757
8758: check for fd_set items
8759$cat <<EOM
8760
8761Checking to see how well your C compiler handles fd_set and friends ...
8762EOM
8763$cat >fd_set.c <<EOCP
8764#$i_systime I_SYS_TIME
8765#$i_sysselct I_SYS_SELECT
8766#$d_socket HAS_SOCKET
8767#include <sys/types.h>
8768#ifdef HAS_SOCKET
8769#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8770#endif
8771#ifdef I_SYS_TIME
8772#include <sys/time.h>
8773#endif
8774#ifdef I_SYS_SELECT
8775#include <sys/select.h>
8776#endif
d674cd6d 8777int main() {
921b2963
JH
8778 fd_set fds;
8779
8780#ifdef TRYBITS
8781 if(fds.fds_bits);
8782#endif
8783
8784#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8785 exit(0);
8786#else
8787 exit(1);
8788#endif
8789}
8790EOCP
8791set fd_set -DTRYBITS
8792if eval $compile; then
8793 d_fds_bits="$define"
8794 d_fd_set="$define"
8795 echo "Well, your system knows about the normal fd_set typedef..." >&4
8796 if ./fd_set; then
8797 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8798 d_fd_macros="$define"
8799 else
8800 $cat >&4 <<'EOM'
8801but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8802EOM
8803 d_fd_macros="$undef"
8804 fi
8805else
8806 $cat <<'EOM'
8807Hmm, your compiler has some difficulty with fd_set. Checking further...
8808EOM
8809 set fd_set
8810 if eval $compile; then
8811 d_fds_bits="$undef"
8812 d_fd_set="$define"
8813 echo "Well, your system has some sort of fd_set available..." >&4
8814 if ./fd_set; then
8815 echo "and you have the normal fd_set macros." >&4
8816 d_fd_macros="$define"
8817 else
8818 $cat <<'EOM'
8819but not the normal fd_set macros! Gross! More work for me...
8820EOM
8821 d_fd_macros="$undef"
8822 fi
8823 else
8824 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
8825 d_fd_set="$undef"
8826 d_fds_bits="$undef"
8827 d_fd_macros="$undef"
8828 fi
8829fi
8830$rm -f fd_set*
8831
a0d0e21e
LW
8832: see if fgetpos exists
8833set fgetpos d_fgetpos
8834eval $inlibc
8835
8175356b
JH
8836: see if flock exists
8837set flock d_flock
8838eval $inlibc
8839
8840: see if fork exists
8841set fork d_fork
8842eval $inlibc
8843
8844: see if pathconf exists
8845set pathconf d_pathconf
8846eval $inlibc
8847
8848: see if fpathconf exists
8849set fpathconf d_fpathconf
8850eval $inlibc
8851
d9b3e12d
JH
8852
8853: check for off64_t
8854echo " "
8175356b 8855echo "Checking to see if your system supports off64_t..." >&4
d9b3e12d
JH
8856$cat >try.c <<EOCP
8857#include <sys/types.h>
8858#include <unistd.h>
8175356b 8859int main() { off64_t x = 7; }'
d9b3e12d 8860EOCP
8175356b
JH
8861set try
8862if eval $compile; then
d9b3e12d 8863 val="$define"
a22e52b9 8864 echo "Yes, it does."
d9b3e12d
JH
8865else
8866 val="$undef"
a22e52b9 8867 echo "No, it doesn't."
8175356b 8868 case "$lseeksize" in
1eeb0f31 8869 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8175356b 8870 esac
d9b3e12d 8871fi
8175356b 8872$rm -f try.* try
d9b3e12d
JH
8873set d_off64_t
8874eval $setvar
8875
8876: check for fpos64_t
8877echo " "
8175356b 8878echo "Checking to see if your system supports fpos64_t..." >&4
d9b3e12d
JH
8879$cat >try.c <<EOCP
8880#include <sys/stdio.h>
8175356b 8881int main() { fpos64_t x x = 7; }'
d9b3e12d 8882EOCP
8175356b
JH
8883set try
8884if eval $compile; then
d9b3e12d 8885 val="$define"
a22e52b9 8886 echo "Yes, it does."
d9b3e12d
JH
8887else
8888 val="$undef"
a22e52b9 8889 echo "No, it doesn't."
8175356b 8890 case "$fpossize" in
1eeb0f31 8891 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8175356b 8892 esac
d9b3e12d 8893fi
8175356b 8894$rm -f try.* try
d9b3e12d
JH
8895set d_fpos64_t
8896eval $setvar
8897
0545a864
JH
8898hasstruct='varname=$1; struct=$2; shift; shift;
8899while $test $# -ge 2; do
8900 case "$1" in
8901 $define) echo "#include <$2>";;
8902 esac ;
8903 shift 2;
8904done > try.c;
8905echo "int main () { struct $struct foo; }" >> try.c;
8906set try;
8907if eval $compile; then
8908 val="$define";
8909else
8910 val="$undef";
8911fi;
8912set $varname;
8913eval $setvar;
8914$rm -f try.c try.o'
d9b3e12d 8915
9b9c89a3
JH
8916: see if this is a sys/param system
8917set sys/param.h i_sysparam
8918eval $inhdr
8919
104d25b7
JH
8920: see if this is a sys/mount.h system
8921set sys/mount.h i_sysmount
8922eval $inhdr
8923
0545a864
JH
8924: see if sys/types.h has to be included
8925set sys/types.h i_systypes
8926eval $inhdr
8927
0545a864 8928
ad27e871 8929echo " "
8175356b 8930echo "Checking to see if your system supports struct fs_data..." >&4
0545a864
JH
8931set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8932eval $hasstruct
8933case "$d_fs_data_s" in
a22e52b9
JH
8934"$define") echo "Yes, it does." ;;
8935*) echo "No, it doesn't." ;;
0545a864
JH
8936esac
8937
8938: see if fseeko exists
8939set fseeko d_fseeko
8940eval $inlibc
1eeb0f31
JH
8941case "$longsize" in
89428) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8943esac
0545a864
JH
8944
8945: see if fsetpos exists
8946set fsetpos d_fsetpos
8947eval $inlibc
8948
8949
8950: see if fstatfs exists
8951set fstatfs d_fstatfs
8952eval $inlibc
104d25b7
JH
8953
8954
8955: see if statvfs exists
8956set statvfs d_statvfs
8957eval $inlibc
8958
8959: see if fstatvfs exists
8960set fstatvfs d_fstatvfs
8961eval $inlibc
8962
8963
5ff3f7a4
GS
8964: see if ftello exists
8965set ftello d_ftello
8966eval $inlibc
1eeb0f31
JH
8967case "$longsize" in
89688) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8969esac
5ff3f7a4
GS
8970
8971: see if getgrent exists
8972set getgrent d_getgrent
8973eval $inlibc
8974
693762b4
AD
8975: see if gethostbyaddr exists
8976set gethostbyaddr d_gethbyaddr
8977eval $inlibc
8978
8979: see if gethostbyname exists
8980set gethostbyname d_gethbyname
8981eval $inlibc
8982
a0d0e21e
LW
8983: see if gethostent exists
8984set gethostent d_gethent
8985eval $inlibc
8986
921b2963
JH
8987: see how we will look up host name
8988echo " "
a63faeb8
JH
8989call=''
8990if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
8991 echo 'gethostname() found.' >&4
8992 d_gethname="$define"
8993 call=gethostname
a63faeb8
JH
8994fi
8995if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
8996 if ./xenix; then
8997 $cat <<'EOM'
8998uname() was found, but you're running xenix, and older versions of xenix
8999have a broken uname(). If you don't really know whether your xenix is old
9000enough to have a broken system call, use the default answer.
9001
9002EOM
9003 dflt=y
9004 case "$d_uname" in
9005 "$define") dflt=n;;
9006 esac
9007 rp='Is your uname() broken?'
9008 . ./myread
9009 case "$ans" in
9010 n*) d_uname="$define"; call=uname;;
9011 esac
9012 else
9013 echo 'uname() found.' >&4
9014 d_uname="$define"
a63faeb8
JH
9015 case "$call" in
9016 '') call=uname ;;
9017 esac
921b2963
JH
9018 fi
9019fi
9020case "$d_gethname" in
9021'') d_gethname="$undef";;
9022esac
9023case "$d_uname" in
9024'') d_uname="$undef";;
9025esac
9026case "$d_uname$d_gethname" in
9027*define*)
9028 dflt=n
9029 cat <<EOM
9030
9031Every now and then someone has a $call() that lies about the hostname
9032but can't be fixed for political or economic reasons. If you wish, I can
9033pretend $call() isn't there and maybe compute hostname at run-time
9034thanks to the '$phostname' command.
9035
9036EOM
9037 rp="Shall I ignore $call() from now on?"
9038 . ./myread
9039 case "$ans" in
9040 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9041 esac;;
9042esac
9043case "$phostname" in
9044'') aphostname='';;
9045*) case "$aphostname" in
9046 /*) ;;
9047 *) set X $phostname
9048 shift
9049 file=$1
9050 shift
9051 file=`./loc $file $file $pth`
9052 aphostname=`echo $file $*`
9053 ;;
9054 esac
9055 ;;
9056esac
9057case "$d_uname$d_gethname" in
9058*define*) ;;
9059*)
9060 case "$phostname" in
9061 '')
9062 echo "There will be no way for $package to get your hostname." >&4;;
9063 *)
9064 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9065 ;;
9066 esac;;
9067esac
9068case "$d_phostname" in
9069'') d_phostname="$undef";;
9070esac
9071
dc45a647
MB
9072: see if this is a netdb.h system
9073set netdb.h i_netdb
9074eval $inhdr
9075
9076: see if prototypes for various gethostxxx netdb.h functions are available
9077echo " "
9078set d_gethostprotos gethostent $i_netdb netdb.h
9079eval $hasproto
9080
a0d0e21e
LW
9081: see if getlogin exists
9082set getlogin d_getlogin
9083eval $inlibc
9084
ad27e871
JH
9085: see if getmnt exists
9086set getmnt d_getmnt
9087eval $inlibc
9088
ccc7f9b3
KS
9089: see if getmntent exists
9090set getmntent d_getmntent
9091eval $inlibc
9092
693762b4
AD
9093: see if getnetbyaddr exists
9094set getnetbyaddr d_getnbyaddr
9095eval $inlibc
9096
9097: see if getnetbyname exists
9098set getnetbyname d_getnbyname
9099eval $inlibc
9100
e5c9fcd0
AD
9101: see if getnetent exists
9102set getnetent d_getnent
9103eval $inlibc
9104
dc45a647
MB
9105: see if prototypes for various getnetxxx netdb.h functions are available
9106echo " "
9107set d_getnetprotos getnetent $i_netdb netdb.h
9108eval $hasproto
9109
693762b4
AD
9110
9111: see if getprotobyname exists
9112set getprotobyname d_getpbyname
9113eval $inlibc
9114
9115: see if getprotobynumber exists
9116set getprotobynumber d_getpbynumber
9117eval $inlibc
e5c9fcd0
AD
9118
9119: see if getprotoent exists
9120set getprotoent d_getpent
9121eval $inlibc
9122
2afac517 9123: see if getpgid exists
9124set getpgid d_getpgid
a0d0e21e
LW
9125eval $inlibc
9126
9127: see if getpgrp2 exists
9128set getpgrp2 d_getpgrp2
9129eval $inlibc
9130
9131: see if getppid exists
9132set getppid d_getppid
9133eval $inlibc
9134
9135: see if getpriority exists
9136set getpriority d_getprior
9137eval $inlibc
9138
dc45a647
MB
9139: see if prototypes for various getprotoxxx netdb.h functions are available
9140echo " "
9141set d_getprotoprotos getprotoent $i_netdb netdb.h
9142eval $hasproto
9143
5ff3f7a4
GS
9144: see if getpwent exists
9145set getpwent d_getpwent
9146eval $inlibc
9147
9148
693762b4
AD
9149: see if getservbyname exists
9150set getservbyname d_getsbyname
9151eval $inlibc
9152
9153: see if getservbyport exists
9154set getservbyport d_getsbyport
9155eval $inlibc
e5c9fcd0
AD
9156
9157: see if getservent exists
9158set getservent d_getsent
9159eval $inlibc
9160
dc45a647
MB
9161: see if prototypes for various getservxxx netdb.h functions are available
9162echo " "
9163set d_getservprotos getservent $i_netdb netdb.h
9164eval $hasproto
9165
f1066039
JH
9166: see if getspent exists
9167set getspent d_getspent
9168eval $inlibc
9169
9170: see if getspnam exists
9171set getspnam d_getspnam
9172eval $inlibc
9173
5f05dabc 9174: see if gettimeofday or ftime exists
9175set gettimeofday d_gettimeod
9176eval $inlibc
9177case "$d_gettimeod" in
9178"$undef")
9179 set ftime d_ftime
9180 eval $inlibc
9181 ;;
9182*)
9183 val="$undef"; set d_ftime; eval $setvar
9184 ;;
9185esac
9186case "$d_gettimeod$d_ftime" in
9187"$undef$undef")
9188 echo " "
9189 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9190 ;;
9191esac
9192
5ff3f7a4
GS
9193: see if this is an grp system
9194set grp.h i_grp
9195eval $inhdr
9196
9197case "$i_grp" in
9198$define)
9199 xxx=`./findhdr grp.h`
9200 $cppstdin $cppflags $cppminus < $xxx >$$.h
9201
9202 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9203 val="$define"
9204 else
9205 val="$undef"
9206 fi
9207 set d_grpasswd
9208 eval $setvar
9209
9210 $rm -f $$.h
9211 ;;
9212*)
9213 val="$undef";
9214 set d_grpasswd; eval $setvar
9215 ;;
9216esac
9217
ccc7f9b3
KS
9218: see if hasmntopt exists
9219set hasmntopt d_hasmntopt
9220eval $inlibc
9221
a0d0e21e
LW
9222: see if this is a netinet/in.h or sys/in.h system
9223set netinet/in.h i_niin sys/in.h i_sysin
9224eval $inhdr
9225
5ff3f7a4 9226: see if arpa/inet.h has to be included
93341792 9227set arpa/inet.h i_arpainet
28e8609d
JH
9228eval $inhdr
9229
a0d0e21e
LW
9230: see if htonl --and friends-- exists
9231val=''
9232set htonl val
9233eval $inlibc
9234
9235: Maybe they are macros.
9236case "$val" in
9237$undef)
9238 $cat >htonl.c <<EOM
9239#include <stdio.h>
9240#include <sys/types.h>
9241#$i_niin I_NETINET_IN
9242#$i_sysin I_SYS_IN
93341792 9243#$i_arpainet I_ARPA_INET
a0d0e21e
LW
9244#ifdef I_NETINET_IN
9245#include <netinet/in.h>
9246#endif
9247#ifdef I_SYS_IN
9248#include <sys/in.h>
9249#endif
28e8609d
JH
9250#ifdef I_ARPA_INET
9251#include <arpa/inet.h>
9252#endif
a0d0e21e
LW
9253#ifdef htonl
9254printf("Defined as a macro.");
9255#endif
9256EOM
9257 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9258 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9259 val="$define"
9260 echo "But it seems to be defined as a macro." >&4
9261 fi
9262 $rm -f htonl.?
9263 ;;
9264esac
9265set d_htonl
9266eval $setvar
9267
a0d0e21e
LW
9268: index or strchr
9269echo " "
9270if set index val -f; eval $csym; $val; then
9271 if set strchr val -f d_strchr; eval $csym; $val; then
9272 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9273 val="$define"
9274 vali="$undef"
9275 echo "strchr() found." >&4
9276 else
9277 val="$undef"
9278 vali="$define"
9279 echo "index() found." >&4
9280 fi
9281 else
9282 val="$undef"
9283 vali="$define"
9284 echo "index() found." >&4
9285 fi
9286else
9287 if set strchr val -f d_strchr; eval $csym; $val; then
9288 val="$define"
9289 vali="$undef"
9290 echo "strchr() found." >&4
9291 else
9292 echo "No index() or strchr() found!" >&4
9293 val="$undef"
9294 vali="$undef"
9295 fi
9296fi
9297set d_strchr; eval $setvar
9298val="$vali"
9299set d_index; eval $setvar
9300
7e1af8bc 9301: check whether inet_aton exists
9302set inet_aton d_inetaton
9303eval $inlibc
9304
a0d0e21e
LW
9305: Look for isascii
9306echo " "
9307$cat >isascii.c <<'EOCP'
9308#include <stdio.h>
9309#include <ctype.h>
d674cd6d 9310int main() {
a0d0e21e
LW
9311 int c = 'A';
9312 if (isascii(c))
9313 exit(0);
9314 else
9315 exit(1);
9316}
9317EOCP
dfe9444c
AD
9318set isascii
9319if eval $compile; then
a0d0e21e
LW
9320 echo "isascii() found." >&4
9321 val="$define"
9322else
9323 echo "isascii() NOT found." >&4
9324 val="$undef"
9325fi
9326set d_isascii
9327eval $setvar
9328$rm -f isascii*
9329
9330: see if killpg exists
9331set killpg d_killpg
9332eval $inlibc
9333
dd64f1c3
AD
9334: see if lchown exists
9335echo " "
9336$cat > try.c <<'EOCP'
9337/* System header to define __stub macros and hopefully few prototypes,
9338 which can conflict with char lchown(); below. */
9339#include <assert.h>
9340/* Override any gcc2 internal prototype to avoid an error. */
9341/* We use char because int might match the return type of a gcc2
9342 builtin and then its argument prototype would still apply. */
9343char lchown();
9344int main() {
9345 /* The GNU C library defines this for functions which it implements
9346 to always fail with ENOSYS. Some functions are actually named
9347 something starting with __ and the normal name is an alias. */
9348#if defined (__stub_lchown) || defined (__stub___lchown)
9349choke me
9350#else
9351lchown();
9352#endif
9353; return 0; }
9354EOCP
9355set try
9356if eval $compile; then
9357 $echo "lchown() found." >&4
9358 val="$define"
9359else
9360 $echo "lchown() NOT found." >&4
9361 val="$undef"
9362fi
9363set d_lchown
9364eval $setvar
9365
2d4389e4
JH
9366: See if number of significant digits in a double precision number is known
9367echo " "
9368$cat >ldbl_dig.c <<EOM
9369#$i_limits I_LIMITS
9370#$i_float I_FLOAT
9371#ifdef I_LIMITS
9372#include <limits.h>
9373#endif
9374#ifdef I_FLOAT
9375#include <float.h>
9376#endif
9377#ifdef LDBL_DIG
9378printf("Contains LDBL_DIG");
9379#endif
9380EOM
9381$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9382if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9383 echo "LDBL_DIG found." >&4
9384 val="$define"
9385else
9386 echo "LDBL_DIG NOT found." >&4
9387 val="$undef"
9388fi
9389$rm -f ldbl_dig.?
9390set d_ldbl_dig
9391eval $setvar
9392
a0d0e21e
LW
9393: see if link exists
9394set link d_link
9395eval $inlibc
9396
a0d0e21e
LW
9397: see if localeconv exists
9398set localeconv d_locconv
9399eval $inlibc
9400
9401: see if lockf exists
9402set lockf d_lockf
9403eval $inlibc
9404
8175356b
JH
9405: check for long long
9406echo " "
9407$echo $n "Checking to see if your system supports long long..." $c >&4
213c275f 9408echo 'int main() { long long x = 7; return 0; }' > try.c
8175356b
JH
9409set try
9410if eval $compile; then
9411 val="$define"
9412 echo " Yes, it does." >&4
9413else
9414 val="$undef"
9415 echo " No, it doesn't." >&4
9416fi
9417$rm try.*
9418set d_longlong
9419eval $setvar
9420
9421: check for length of long long
9422case "${d_longlong}${longlongsize}" in
9423$define)
9424 echo " "
9425 $echo $n "Checking to see how big your long longs are..." $c >&4
9426 $cat >try.c <<'EOCP'
9427#include <stdio.h>
9428int main()
9429{
213c275f
JH
9430 printf("%d\n", (int)sizeof(long long));
9431 return(0);
8175356b
JH
9432}
9433EOCP
9434 set try
9435 if eval $compile_ok; then
9436 longlongsize=`./try$exe_ext`
9437 $echo " $longlongsize bytes." >&4
9438 else
9439 dflt='8'
9440 echo " "
9441 echo "(I can't seem to compile the test program. Guessing...)"
9442 rp="What is the size of a long long (in bytes)?"
9443 . ./myread
9444 longlongsize="$ans"
9445 fi
9446 if $test "X$longsize" = "X$longlongsize"; then
9447 echo "(That isn't any different from an ordinary long.)"
9448 fi
9449 ;;
9450esac
9451$rm -f try.* try
9452
a0d0e21e
LW
9453: see if lstat exists
9454set lstat d_lstat
9455eval $inlibc
9456
9457: see if mblen exists
9458set mblen d_mblen
9459eval $inlibc
9460
9461: see if mbstowcs exists
9462set mbstowcs d_mbstowcs
9463eval $inlibc
9464
9465: see if mbtowc exists
9466set mbtowc d_mbtowc
9467eval $inlibc
9468
0f27ced1
JH
9469: see if memchr exists
9470set memchr d_memchr
9471eval $inlibc
9472
a0d0e21e
LW
9473: see if memcmp exists
9474set memcmp d_memcmp
9475eval $inlibc
9476
9477: see if memcpy exists
9478set memcpy d_memcpy
9479eval $inlibc
9480
9481: see if memmove exists
9482set memmove d_memmove
2304df62
AD
9483eval $inlibc
9484
9485: see if memset exists
9486set memset d_memset
9487eval $inlibc
9488
9489: see if mkdir exists
9490set mkdir d_mkdir
9491eval $inlibc
9492
a0d0e21e
LW
9493: see if mkfifo exists
9494set mkfifo d_mkfifo
9495eval $inlibc
9496
9497: see if mktime exists
9498set mktime d_mktime
9499eval $inlibc
9500
2304df62
AD
9501: see if msgctl exists
9502set msgctl d_msgctl
9503eval $inlibc
9504
9505: see if msgget exists
9506set msgget d_msgget
9507eval $inlibc
9508
9509: see if msgsnd exists
9510set msgsnd d_msgsnd
9511eval $inlibc
9512
9513: see if msgrcv exists
9514set msgrcv d_msgrcv
9515eval $inlibc
9516
9517: see how much of the 'msg*(2)' library is present.
9518h_msg=true
9519echo " "
9520case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9521*"$undef"*) h_msg=false;;
9522esac
6087ac44
JH
9523case "$osname" in
9524freebsd)
9525 case "`ipcs 2>&1`" in
9526 "SVID messages"*"not configured"*)
5ff3f7a4 9527 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9528 h_msg=false
9529 val="$undef"
9530 set msgctl d_msgctl
9531 eval $setvar
9532 set msgget d_msgget
9533 eval $setvar
9534 set msgsnd d_msgsnd
9535 eval $setvar
9536 set msgrcv d_msgrcv
9537 eval $setvar
9538 ;;
9539 esac
9540 ;;
9541esac
2304df62
AD
9542: we could also check for sys/ipc.h ...
9543if $h_msg && $test `./findhdr sys/msg.h`; then
9544 echo "You have the full msg*(2) library." >&4
9545 val="$define"
9546else
9547 echo "You don't have the full msg*(2) library." >&4
9548 val="$undef"
9549fi
9550set d_msg
9551eval $setvar
9552
dfe9444c
AD
9553: see if nice exists
9554set nice d_nice
9555eval $inlibc
9556
ff935051
JH
9557: see if inttypes.h is available
9558: we want a real compile instead of Inhdr because some systems
9559: have an inttypes.h which includes non-existent headers
9560echo " "
9561$cat >try.c <<EOCP
9562#include <inttypes.h>
9563int main() {
9564 static int32_t foo32 = 0x12345678;
9565}
9566EOCP
9567set try
9568if eval $compile; then
9569 echo "<inttypes.h> found." >&4
9570 val="$define"
9571else
9572 echo "<inttypes.h> NOT found." >&4
9573 val="$undef"
9574fi
9575$rm -f try.c try
9576set i_inttypes
9577eval $setvar
9578
9579: check for int64_t
9580echo " "
9581$echo $n "Checking to see if your system supports int64_t...$c" >&4
9582$cat >try.c <<EOCP
9583#include <sys/types.h>
9584#$i_inttypes I_INTTYPES
9585#ifdef I_INTTYPES
9586#include <inttypes.h>
9587#endif
9588int main() { int64_t x = 7; }
9589EOCP
9590set try
9591if eval $compile; then
9592 val="$define"
9593 echo " Yes, it does." >&4
9594else
9595 val="$undef"
9596 echo " No, it doesn't." >&4
9597fi
9598$rm -f try try.*
9599set d_int64t
9600eval $setvar
9601
de1c2614
JH
9602
9603echo " "
6b8eaf93 9604echo "Checking which 64-bit integer type we could use..." >&4
de1c2614
JH
9605
9606case "$intsize" in
96078) val=int
9608 set quadtype
9609 eval $setvar
9610 val='"unsigned int"'
9611 set uquadtype
9612 eval $setvar
6b8eaf93 9613 quadkind=1
de1c2614
JH
9614 ;;
9615*) case "$longsize" in
9616 8) val=long
9617 set quadtype
9618 eval $setvar
9619 val='"unsigned long"'
9620 set uquadtype
9621 eval $setvar
6b8eaf93 9622 quadkind=2
de1c2614
JH
9623 ;;
9624 *) case "$uselonglong:$d_longlong:$longlongsize" in
9625 define:define:8)
9626 val='"long long"'
9627 set quadtype
9628 eval $setvar
9629 val='"unsigned long long"'
9630 set uquadtype
9631 eval $setvar
6b8eaf93 9632 quadkind=3
de1c2614
JH
9633 ;;
9634 *) case "$d_int64t" in
9635 define)
9636 val=int64_t
9637 set quadtype
9638 eval $setvar
9639 val=uint64_t
9640 set uquadtype
9641 eval $setvar
6b8eaf93 9642 quadkind=4
de1c2614
JH
9643 ;;
9644 esac
9645 ;;
9646 esac
9647 ;;
9648 esac
9649 ;;
9650esac
9651
9652case "$quadtype" in
6b8eaf93
JH
9653'') case "$uselonglong:$d_longlong:$longlongsize" in
9654 undef:define:8)
9655 echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9656 *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9657 esac
de1c2614
JH
9658 d_quad="$undef"
9659 ;;
1eeb0f31
JH
9660*) if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9661 verb="will"
9662 else
9663 verb="could"
9664 fi
9665 echo "We $verb use '$quadtype' for 64-bit integers." >&4
de1c2614
JH
9666 d_quad="$define"
9667 ;;
9668esac
9669
cce08f5b
JH
9670: check for length of character
9671echo " "
9672case "$charsize" in
9673'')
9674 echo "Checking to see how big your characters are (hey, you never know)..." >&4
9675 $cat >try.c <<'EOCP'
9676#include <stdio.h>
9677int main()
9678{
9679 printf("%d\n", (int)sizeof(char));
9680 exit(0);
9681}
9682EOCP
9683 set try
9684 if eval $compile_ok; then
9685 dflt=`./try`
9686 else
9687 dflt='1'
9688 echo "(I can't seem to compile the test program. Guessing...)"
9689 fi
9690 ;;
9691*)
9692 dflt="$charsize"
9693 ;;
9694esac
9695rp="What is the size of a character (in bytes)?"
9696. ./myread
9697charsize="$ans"
9698$rm -f try.c try
9699
9700
9701echo " "
9702$echo "Choosing the C types to be used for Perl's internal types..." >&4
9703
9704case "$use64bits:$d_quad:$quadtype" in
9705define:define:?*)
9706 ivtype="$quadtype"
9707 uvtype="$uquadtype"
9708 ivsize=8
9709 uvsize=8
9710 ;;
9711*) ivtype="long"
9712 uvtype="unsigned long"
9713 ivsize=$longsize
9714 uvsize=$longsize
9715 ;;
9716esac
9717
9718case "$uselongdouble:$d_longdbl" in
9719define:define)
9720 nvtype="long double"
9721 nvsize=$longdblsize
9722 ;;
9723*) nvtype=double
9724 nvsize=$doublesize
9725 ;;
9726esac
9727
9728$echo "(IV will be "$ivtype", $ivsize bytes)"
9729$echo "(UV will be "$uvtype", $uvsize bytes)"
9730$echo "(NV will be "$nvtype", $nvsize bytes)"
9731
9732$cat >try.c <<EOCP
9733#$i_inttypes I_INTTYPES
9734#ifdef I_INTTYPES
9735#include <inttypes.h>
9736#endif
9737#include <stdio.h>
9738int main() {
9739#ifdef INT8
9740 int8_t i = INT8_MAX;
9741 uint8_t u = UINT8_MAX;
9742 printf("int8_t\n");
9743#endif
9744#ifdef INT16
9745 int16_t i = INT16_MAX;
9746 uint16_t i = UINT16_MAX;
9747 printf("int16_t\n");
9748#endif
9749#ifdef INT32
9750 int32_t i = INT32_MAX;
9751 uint32_t u = UINT32_MAX;
9752 printf("int32_t\n");
9753#endif
9754}
9755EOCP
9756
9757case "$i8type" in
9758'') case "$charsize" in
9759 1) i8type=char
9760 u8type="unsigned char"
9761 i8size=$charsize
9762 u8size=$charsize
9763 ;;
9764 esac
9765 ;;
9766esac
9767case "$i8type" in
9768'') set try -DINT8
9769 if eval $compile; then
9770 case "`./try$exe_ext`" in
9771 int8_t) i8type=int8_t
9772 u8type=uint8_t
9773 i8size=1
9774 u8size=1
9775 ;;
9776 esac
9777 fi
9778 ;;
9779esac
9780case "$i8type" in
9781'') if $test $charsize -ge 1; then
9782 i8type=char
9783 u8type="unsigned char"
9784 i8size=$charsize
9785 u8size=$charsize
9786 fi
9787 ;;
9788esac
9789
9790case "$i16type" in
9791'') case "$shortsize" in
9792 2) i16type=short
9793 u16type="unsigned short"
9794 i16size=$shortsize
9795 u16size=$shortsize
9796 ;;
9797 esac
9798 ;;
9799esac
9800case "$i16type" in
9801'') set try -DINT16
9802 if eval $compile; then
9803 case "`./try$exe_ext`" in
9804 int16_t)
9805 i16type=int16_t
9806 u16type=uint16_t
9807 i16size=2
9808 u16size=2
9809 ;;
9810 esac
9811 fi
9812 ;;
9813esac
9814case "$i16type" in
9815'') if $test $shortsize -ge 2; then
9816 i16type=short
9817 u16type="unsigned short"
9818 i16size=$shortsize
9819 u16size=$shortsize
9820 fi
9821 ;;
9822esac
9823
9824case "$i32type" in
9825'') case "$longsize" in
9826 4) i32type=long
9827 u32type="unsigned long"
9828 i32size=$longsize
9829 u32size=$longsize
9830 ;;
9831 *) case "$intsize" in
9832 4) i32type=int
9833 u32type="unsigned int"
9834 i32size=$intsize
9835 u32size=$intsize
9836 ;;
9837 esac
9838 ;;
9839 esac
9840 ;;
9841esac
9842case "$i32type" in
9843'') set try -DINT32
9844 if eval $compile; then
9845 case "`./try$exe_ext`" in
9846 int32_t)
9847 i32type=int32_t
9848 u32type=uint32_t
9849 i32size=4
9850 u32size=4
9851 ;;
9852 esac
9853 fi
9854 ;;
9855esac
9856case "$i32type" in
9857'') if $test $intsize -ge 4; then
9858 i32type=int
9859 u32type="unsigned int"
9860 i32size=$intsize
9861 u32size=$intsize
9862 fi
9863 ;;
9864esac
9865
9866case "$i64type" in
9867'') case "$d_quad:$quadtype" in
9868 define:?*)
9869 i64type="$quadtype"
9870 u64type="$uquadtype"
9871 i64size=8
9872 u64size=8
9873 ;;
9874 esac
9875 ;;
9876esac
9877
9878$echo "Checking whether your NVs can preserve your UVs..." >&4
9879$cat <<EOP >try.c
9880#include <stdio.h>
9881int main() {
9882 $uvtype k = ($uvtype)~0, l;
9883 $nvtype d;
9884 l = k;
9885 d = ($nvtype)l;
9886 l = ($uvtype)d;
9887 if (l == k)
9888 printf("preserve\n");
9889 exit(0);
9890}
9891EOP
9892set try
9893if eval $compile; then
9894 case "`./try$exe_ext`" in
9895 preserve) d_nvpresuv="$define" ;;
9896 esac
9897fi
9898case "$d_nvpresuv" in
9899$define) $echo "Yes, they can." 2>&1 ;;
9900*) $echo "No, they can't." 2>&1
9901 d_nvpresuv="$undef"
9902 ;;
9903esac
9904
9905$rm -f try.* try
9906
c4747d3e 9907: see if POSIX threads are available
1f5ae88c
JH
9908set pthread.h i_pthread
9909eval $inhdr
9910
c4747d3e
JH
9911
9912
9913
9914: how to create joinable pthreads
9915if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
9916 echo " "
9917 echo "Checking what constant to use for creating joinable pthreads..." >&4
9918 $cat >try.c <<'EOCP'
9919#include <pthread.h>
9920int main() {
9921 int detachstate = JOINABLE;
9922}
9923EOCP
9924 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9925 if eval $compile; then
c6912327 9926 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
9927 val="$undef" # Yes, undef.
9928 set d_old_pthread_create_joinable
13666627 9929 eval $setvar
ef4af2be
JH
9930 val=""
9931 set old_pthread_create_joinable
13666627
JH
9932 eval $setvar
9933 else
9934 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9935 if eval $compile; then
c6912327 9936 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 9937 val="$define"
ef4af2be 9938 set d_old_pthread_create_joinable
13666627
JH
9939 eval $setvar
9940 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 9941 set old_pthread_create_joinable
13666627
JH
9942 eval $setvar
9943 else
9944 set try -DJOINABLE=__UNDETACHED
9945 if eval $compile; then
c6912327 9946 echo "You seem to use __UNDETACHED." >&4
13666627 9947 val="$define"
ef4af2be 9948 set d_old_pthread_create_joinable
13666627
JH
9949 eval $setvar
9950 val=__UNDETACHED
ef4af2be 9951 set old_pthread_create_joinable
13666627
JH
9952 eval $setvar
9953 else
c6912327 9954 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 9955 val="$define"
ef4af2be 9956 set d_old_pthread_create_joinable
13666627
JH
9957 eval $setvar
9958 val=0
ef4af2be 9959 set old_pthread_create_joinable
13666627
JH
9960 eval $setvar
9961 fi
9962 fi
9963 fi
9964 $rm -f try try.*
9965else
ef4af2be
JH
9966 d_old_pthread_create_joinable="$undef"
9967 old_pthread_create_joinable=""
13666627
JH
9968fi
9969
ef4af2be
JH
9970: see if pause exists
9971set pause d_pause
9972eval $inlibc
9973
9974: see if pipe exists
9975set pipe d_pipe
9976eval $inlibc
9977
9978: see if poll exists
9979set poll d_poll
9980eval $inlibc
9981
31dfa2f6
JH
9982
9983: see whether the various POSIXish _yields exist
9984$cat >try.c <<EOP
9985#include <pthread.h>
9986#include <stdio.h>
5a411a32 9987int main() {
31dfa2f6
JH
9988#ifdef SCHED_YIELD
9989 sched_yield();
9990#else
9991#ifdef PTHREAD_YIELD
9992 pthread_yield();
9993#else
9994#ifdef PTHREAD_YIELD_NULL
9995 pthread_yield(NULL);
9996#endif
9997#endif
9998#endif
9999}
10000EOP
10001: see if sched_yield exists
10002set try -DSCHED_YIELD
10003if eval $compile; then
10004 val="$define"
10005 sched_yield='sched_yield()'
10006else
10007 val="$undef"
10008fi
10009case "$usethreads" in
10010$define)
10011 case "$val" in
10012 $define) echo 'sched_yield() found.' >&4 ;;
10013 *) echo 'sched_yield() NOT found.' >&4 ;;
10014 esac
10015esac
10016set d_sched_yield
10017eval $setvar
10018
10019: see if pthread_yield exists
10020set try -DPTHREAD_YIELD
10021if eval $compile; then
10022 val="$define"
10023 case "$sched_yield" in
10024 '') sched_yield='pthread_yield()' ;;
10025 esac
10026else
10027 set try -DPTHREAD_YIELD_NULL
10028 if eval $compile; then
10029 val="$define"
10030 case "$sched_yield" in
10031 '') sched_yield='pthread_yield(NULL)' ;;
10032 esac
10033 else
10034 val="$undef"
10035 fi
10036fi
10037case "$usethreads" in
10038$define)
10039 case "$val" in
10040 $define) echo 'pthread_yield() found.' >&4 ;;
10041 *) echo 'pthread_yield() NOT found.' >&4 ;;
10042 esac
10043 ;;
10044esac
10045set d_pthread_yield
10046eval $setvar
10047
10048case "$sched_yield" in
10049'') sched_yield=undef ;;
10050esac
10051
10052$rm -f try try.*
10053
4aa0a1f7
AD
10054: see if this is a pwd.h system
10055set pwd.h i_pwd
10056eval $inhdr
10057
10058case "$i_pwd" in
10059$define)
10060 xxx=`./findhdr pwd.h`
85e6fe83 10061 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 10062
2304df62 10063 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 10064 val="$define"
2304df62 10065 else
4aa0a1f7 10066 val="$undef"
2304df62 10067 fi
4aa0a1f7
AD
10068 set d_pwquota
10069 eval $setvar
10070
2304df62 10071 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 10072 val="$define"
2304df62 10073 else
4aa0a1f7 10074 val="$undef"
2304df62 10075 fi
4aa0a1f7
AD
10076 set d_pwage
10077 eval $setvar
10078
2304df62 10079 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 10080 val="$define"
2304df62 10081 else
4aa0a1f7 10082 val="$undef"
2304df62 10083 fi
4aa0a1f7
AD
10084 set d_pwchange
10085 eval $setvar
10086
2304df62 10087 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 10088 val="$define"
2304df62 10089 else
4aa0a1f7 10090 val="$undef"
2304df62 10091 fi
4aa0a1f7
AD
10092 set d_pwclass
10093 eval $setvar
10094
2304df62 10095 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 10096 val="$define"
2304df62 10097 else
4aa0a1f7 10098 val="$undef"
2304df62 10099 fi
4aa0a1f7 10100 set d_pwexpire
cce08f5b 10101 eval $setvar
de1c2614 10102
cce08f5b
JH
10103 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10104 val="$define"
1eeb0f31 10105 else
cce08f5b 10106 val="$undef"
1eeb0f31 10107 fi
cce08f5b
JH
10108 set d_pwcomment
10109 eval $setvar
10110
10111 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10112 val="$define"
10113 else
10114 val="$undef"
10115 fi
10116 set d_pwgecos
10117 eval $setvar
10118
10119 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10120 val="$define"
10121 else
10122 val="$undef"
10123 fi
10124 set d_pwpasswd
10125 eval $setvar
10126
10127 $rm -f $$.h
10128 ;;
10129*)
10130 val="$undef";
10131 set d_pwquota; eval $setvar
10132 set d_pwage; eval $setvar
10133 set d_pwchange; eval $setvar
10134 set d_pwclass; eval $setvar
10135 set d_pwexpire; eval $setvar
10136 set d_pwcomment; eval $setvar
10137 set d_pwgecos; eval $setvar
10138 set d_pwpasswd; eval $setvar
de1c2614
JH
10139 ;;
10140esac
10141
85e6fe83 10142: see if readdir and friends exist
2304df62
AD
10143set readdir d_readdir
10144eval $inlibc
85e6fe83
LW
10145set seekdir d_seekdir
10146eval $inlibc
10147set telldir d_telldir
10148eval $inlibc
10149set rewinddir d_rewinddir
10150eval $inlibc
2304df62 10151
a0d0e21e
LW
10152: see if readlink exists
10153set readlink d_readlink
10154eval $inlibc
10155
2304df62
AD
10156: see if rename exists
10157set rename d_rename
10158eval $inlibc
10159
10160: see if rmdir exists
10161set rmdir d_rmdir
10162eval $inlibc
10163
8ff267be 10164: see if memory.h is available.
10165val=''
10166set memory.h val
10167eval $inhdr
10168
10169: See if it conflicts with string.h
10170case "$val" in
10171$define)
10172 case "$strings" in
10173 '') ;;
10174 *)
10175 $cppstdin $cppflags $cppminus < $strings > mem.h
10176 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10177 echo " "
10178 echo "We won't be including <memory.h>."
10179 val="$undef"
10180 fi
10181 $rm -f mem.h
10182 ;;
10183 esac
10184esac
10185set i_memory
10186eval $setvar
10187
2304df62
AD
10188: can bcopy handle overlapping blocks?
10189val="$undef"
10190case "$d_bcopy" in
10191"$define")
10192 echo " "
10193 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 10194 $cat >try.c <<EOCP
8ff267be 10195#$i_memory I_MEMORY
10196#$i_stdlib I_STDLIB
10197#$i_string I_STRING
10198#$i_unistd I_UNISTD
10199EOCP
dfe9444c 10200 $cat >>try.c <<'EOCP'
8ff267be 10201#include <stdio.h>
8ff267be 10202#ifdef I_MEMORY
10203# include <memory.h>
10204#endif
10205#ifdef I_STDLIB
10206# include <stdlib.h>
10207#endif
10208#ifdef I_STRING
10209# include <string.h>
10210#else
10211# include <strings.h>
10212#endif
10213#ifdef I_UNISTD
10214# include <unistd.h> /* Needed for NetBSD */
10215#endif
d674cd6d 10216int main()
2304df62 10217{
85e6fe83
LW
10218char buf[128], abc[128];
10219char *b;
10220int len;
10221int off;
10222int align;
a0d0e21e 10223
85e6fe83 10224bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
10225
10226for (align = 7; align >= 0; align--) {
10227 for (len = 36; len; len--) {
10228 b = buf+align;
85e6fe83 10229 bcopy(abc, b, len);
2304df62
AD
10230 for (off = 1; off <= len; off++) {
10231 bcopy(b, b+off, len);
10232 bcopy(b+off, b, len);
85e6fe83 10233 if (bcmp(b, abc, len))
2304df62
AD
10234 exit(1);
10235 }
10236 }
10237}
10238exit(0);
10239}
10240EOCP
dfe9444c 10241 set try
dc45a647 10242 if eval $compile_ok; then
dfe9444c 10243 if ./try 2>/dev/null; then
2304df62
AD
10244 echo "Yes, it can."
10245 val="$define"
10246 else
10247 echo "It can't, sorry."
8ff267be 10248 case "$d_memmove" in
10249 "$define") echo "But that's Ok since you have memmove()." ;;
10250 esac
2304df62
AD
10251 fi
10252 else
10253 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10254 case "$d_memmove" in
10255 "$define") echo "But that's Ok since you have memmove()." ;;
10256 esac
2304df62
AD
10257 fi
10258 ;;
10259esac
dfe9444c 10260$rm -f try.* try core
2304df62
AD
10261set d_safebcpy
10262eval $setvar
10263
10264: can memcpy handle overlapping blocks?
10265val="$undef"
10266case "$d_memcpy" in
10267"$define")
10268 echo " "
10269 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 10270 $cat >try.c <<EOCP
8ff267be 10271#$i_memory I_MEMORY
10272#$i_stdlib I_STDLIB
10273#$i_string I_STRING
10274#$i_unistd I_UNISTD
10275EOCP
dfe9444c 10276 $cat >>try.c <<'EOCP'
8ff267be 10277#include <stdio.h>
8ff267be 10278#ifdef I_MEMORY
10279# include <memory.h>
10280#endif
10281#ifdef I_STDLIB
10282# include <stdlib.h>
10283#endif
10284#ifdef I_STRING
10285# include <string.h>
10286#else
10287# include <strings.h>
10288#endif
10289#ifdef I_UNISTD
10290# include <unistd.h> /* Needed for NetBSD */
10291#endif
d674cd6d 10292int main()
2304df62 10293{
85e6fe83
LW
10294char buf[128], abc[128];
10295char *b;
10296int len;
10297int off;
10298int align;
10299
8ff267be 10300/* Copy "abcde..." string to char abc[] so that gcc doesn't
10301 try to store the string in read-only memory. */
85e6fe83 10302memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
10303
10304for (align = 7; align >= 0; align--) {
10305 for (len = 36; len; len--) {
10306 b = buf+align;
232e078e 10307 memcpy(b, abc, len);
2304df62 10308 for (off = 1; off <= len; off++) {
2304df62 10309 memcpy(b+off, b, len);
232e078e 10310 memcpy(b, b+off, len);
85e6fe83 10311 if (memcmp(b, abc, len))
2304df62
AD
10312 exit(1);
10313 }
10314 }
10315}
10316exit(0);
10317}
10318EOCP
dfe9444c 10319 set try
dc45a647 10320 if eval $compile_ok; then
dfe9444c 10321 if ./try 2>/dev/null; then
2304df62
AD
10322 echo "Yes, it can."
10323 val="$define"
10324 else
10325 echo "It can't, sorry."
8ff267be 10326 case "$d_memmove" in
10327 "$define") echo "But that's Ok since you have memmove()." ;;
10328 esac
2304df62
AD
10329 fi
10330 else
10331 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10332 case "$d_memmove" in
10333 "$define") echo "But that's Ok since you have memmove()." ;;
10334 esac
2304df62
AD
10335 fi
10336 ;;
10337esac
dfe9444c 10338$rm -f try.* try core
2304df62
AD
10339set d_safemcpy
10340eval $setvar
10341
36477c24 10342: can memcmp be trusted to compare relative magnitude?
10343val="$undef"
10344case "$d_memcmp" in
10345"$define")
10346 echo " "
dfe9444c
AD
10347 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10348 $cat >try.c <<EOCP
36477c24 10349#$i_memory I_MEMORY
10350#$i_stdlib I_STDLIB
10351#$i_string I_STRING
10352#$i_unistd I_UNISTD
10353EOCP
dfe9444c 10354 $cat >>try.c <<'EOCP'
36477c24 10355#include <stdio.h>
36477c24 10356#ifdef I_MEMORY
10357# include <memory.h>
10358#endif
10359#ifdef I_STDLIB
10360# include <stdlib.h>
10361#endif
10362#ifdef I_STRING
10363# include <string.h>
10364#else
10365# include <strings.h>
10366#endif
10367#ifdef I_UNISTD
10368# include <unistd.h> /* Needed for NetBSD */
10369#endif
d674cd6d 10370int main()
36477c24 10371{
10372char a = -1;
10373char b = 0;
10374if ((a < b) && memcmp(&a, &b, 1) < 0)
10375 exit(1);
10376exit(0);
10377}
10378EOCP
dfe9444c 10379 set try
dc45a647 10380 if eval $compile_ok; then
dfe9444c 10381 if ./try 2>/dev/null; then
36477c24 10382 echo "Yes, it can."
10383 val="$define"
10384 else
10385 echo "No, it can't (it uses signed chars)."
10386 fi
10387 else
10388 echo "(I can't compile the test program, so we'll assume not...)"
10389 fi
10390 ;;
10391esac
dfe9444c 10392$rm -f try.* try core
36477c24 10393set d_sanemcmp
10394eval $setvar
10395
2304df62
AD
10396: see if select exists
10397set select d_select
10398eval $inlibc
10399
10400: see if semctl exists
10401set semctl d_semctl
10402eval $inlibc
10403
10404: see if semget exists
10405set semget d_semget
10406eval $inlibc
10407
10408: see if semop exists
10409set semop d_semop
10410eval $inlibc
10411
10412: see how much of the 'sem*(2)' library is present.
10413h_sem=true
10414echo " "
10415case "$d_semctl$d_semget$d_semop" in
10416*"$undef"*) h_sem=false;;
10417esac
6087ac44
JH
10418case "$osname" in
10419freebsd)
10420 case "`ipcs 2>&1`" in
10421 "SVID messages"*"not configured"*)
5ff3f7a4 10422 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
10423 h_sem=false
10424 val="$undef"
10425 set semctl d_semctl
10426 eval $setvar
10427 set semget d_semget
10428 eval $setvar
10429 set semop d_semop
10430 eval $setvar
10431 ;;
10432 esac
10433 ;;
10434esac
2304df62
AD
10435: we could also check for sys/ipc.h ...
10436if $h_sem && $test `./findhdr sys/sem.h`; then
10437 echo "You have the full sem*(2) library." >&4
10438 val="$define"
10439else
10440 echo "You don't have the full sem*(2) library." >&4
10441 val="$undef"
10442fi
10443set d_sem
10444eval $setvar
10445
bd89102f
AD
10446: see whether sys/sem.h defines union semun
10447echo " "
10448$cat > try.c <<'END'
10449#include <sys/types.h>
10450#include <sys/ipc.h>
10451#include <sys/sem.h>
10452int main () { union semun semun; semun.buf = 0; }
10453END
10454set try
10455if eval $compile; then
10456 echo "You have union semun in <sys/sem.h>." >&4
10457 val="$define"
10458else
10459 echo "You do not have union semun in <sys/sem.h>." >&4
10460 val="$undef"
10461fi
85ab1d1d 10462$rm -f try try.c try.h
bd89102f
AD
10463set d_union_semun
10464eval $setvar
10465
10466: see how to do semctl IPC_STAT
10467case "$d_sem" in
10468$define)
10469 : see whether semctl IPC_STAT can use union semun
10470 echo " "
85ab1d1d
JH
10471 $cat > try.h <<END
10472#ifndef S_IRUSR
10473# ifdef S_IREAD
10474# define S_IRUSR S_IREAD
10475# define S_IWUSR S_IWRITE
10476# define S_IXUSR S_IEXEC
10477# else
10478# define S_IRUSR 0400
10479# define S_IWUSR 0200
10480# define S_IXUSR 0100
10481# endif
10482# define S_IRGRP (S_IRUSR>>3)
10483# define S_IWGRP (S_IWUSR>>3)
10484# define S_IXGRP (S_IXUSR>>3)
10485# define S_IROTH (S_IRUSR>>6)
10486# define S_IWOTH (S_IWUSR>>6)
10487# define S_IXOTH (S_IXUSR>>6)
10488#endif
10489#ifndef S_IRWXU
10490# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10491# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10492# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10493#endif
10494END
10495
bd89102f
AD
10496 $cat > try.c <<END
10497#include <sys/types.h>
10498#include <sys/ipc.h>
10499#include <sys/sem.h>
10500#include <sys/stat.h>
10501#include <stdio.h>
10502#include <errno.h>
85ab1d1d 10503#include "try.h"
bd89102f
AD
10504#ifndef errno
10505extern int errno;
10506#endif
10507#$d_union_semun HAS_UNION_SEMUN
10508int main() {
10509 union semun
10510#ifndef HAS_UNION_SEMUN
10511 {
10512 int val;
10513 struct semid_ds *buf;
10514 unsigned short *array;
10515 }
10516#endif
10517 arg;
10518 int sem, st;
10519
10520#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10521 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10522 if (sem > -1) {
10523 struct semid_ds argbuf;
10524 arg.buf = &argbuf;
10525# ifdef IPC_STAT
10526 st = semctl(sem, 0, IPC_STAT, arg);
10527 if (st == 0)
10528 printf("semun\n");
10529 else
10530# endif /* IPC_STAT */
10531 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10532# ifdef IPC_RMID
10533 if (semctl(sem, 0, IPC_RMID, arg) != 0)
10534# endif /* IPC_RMID */
10535 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10536 } else
10537#endif /* IPC_PRIVATE && ... */
10538 printf("semget failed: errno = %d\n", errno);
10539 return 0;
10540}
10541END
10542 val="$undef"
10543 set try
10544 if eval $compile; then
10545 xxx=`./try`
10546 case "$xxx" in
10547 semun) val="$define" ;;
10548 esac
10549 fi
10550 $rm -f try try.c
10551 set d_semctl_semun
10552 eval $setvar
10553 case "$d_semctl_semun" in
10554 $define)
10555 echo "You can use union semun for semctl IPC_STAT." >&4
10556 also='also'
10557 ;;
10558 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
10559 also=''
10560 ;;
10561 esac
10562
10563 : see whether semctl IPC_STAT can use struct semid_ds pointer
10564 $cat > try.c <<'END'
10565#include <sys/types.h>
10566#include <sys/ipc.h>
10567#include <sys/sem.h>
10568#include <sys/stat.h>
85ab1d1d 10569#include "try.h"
bd89102f
AD
10570#include <stdio.h>
10571#include <errno.h>
10572#ifndef errno
10573extern int errno;
10574#endif
10575int main() {
10576 struct semid_ds arg;
10577 int sem, st;
10578
10579#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10580 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10581 if (sem > -1) {
10582# ifdef IPC_STAT
10583 st = semctl(sem, 0, IPC_STAT, &arg);
10584 if (st == 0)
10585 printf("semid_ds\n");
10586 else
10587# endif /* IPC_STAT */
10588 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10589# ifdef IPC_RMID
10590 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10591# endif /* IPC_RMID */
10592 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10593 } else
10594#endif /* IPC_PRIVATE && ... */
10595 printf("semget failed: errno = %d\n", errno);
10596
10597 return 0;
10598}
10599END
10600 val="$undef"
10601 set try
10602 if eval $compile; then
10603 xxx=`./try`
10604 case "$xxx" in
10605 semid_ds) val="$define" ;;
10606 esac
10607 fi
10608 $rm -f try try.c
10609 set d_semctl_semid_ds
10610 eval $setvar
10611 case "$d_semctl_semid_ds" in
10612 $define)
7f3d1cf1 10613 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 10614 ;;
7f3d1cf1 10615 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
10616 ;;
10617 esac
85ab1d1d 10618 $rm -f try.h
bd89102f
AD
10619 ;;
10620*) val="$undef"
10621
10622 # We do not have the full sem*(2) library, so assume we can not
10623 # use either.
10624
10625 set d_semctl_semun
10626 eval $setvar
10627
10628 set d_semctl_semid_ds
10629 eval $setvar
10630 ;;
10631esac
10632
2304df62
AD
10633: see if setegid exists
10634set setegid d_setegid
10635eval $inlibc
10636
10637: see if seteuid exists
10638set seteuid d_seteuid
10639eval $inlibc
10640
5ff3f7a4
GS
10641: see if setgrent exists
10642set setgrent d_setgrent
10643eval $inlibc
10644
693762b4
AD
10645: see if sethostent exists
10646set sethostent d_sethent
10647eval $inlibc
10648
a0d0e21e
LW
10649: see if setlinebuf exists
10650set setlinebuf d_setlinebuf
10651eval $inlibc
10652
2304df62
AD
10653: see if setlocale exists
10654set setlocale d_setlocale
10655eval $inlibc
a0d0e21e 10656
e5c9fcd0
AD
10657: see if setnetent exists
10658set setnetent d_setnent
10659eval $inlibc
10660
10661: see if setprotoent exists
10662set setprotoent d_setpent
10663eval $inlibc
10664
2304df62
AD
10665: see if setpgid exists
10666set setpgid d_setpgid
10667eval $inlibc
10668
2304df62
AD
10669: see if setpgrp2 exists
10670set setpgrp2 d_setpgrp2
10671eval $inlibc
10672
10673: see if setpriority exists
10674set setpriority d_setprior
10675eval $inlibc
10676
5ff3f7a4
GS
10677: see if setpwent exists
10678set setpwent d_setpwent
10679eval $inlibc
10680
2304df62
AD
10681: see if setregid exists
10682set setregid d_setregid
10683eval $inlibc
10684set setresgid d_setresgid
10685eval $inlibc
10686
10687: see if setreuid exists
10688set setreuid d_setreuid
10689eval $inlibc
10690set setresuid d_setresuid
10691eval $inlibc
10692
10693: see if setrgid exists
10694set setrgid d_setrgid
10695eval $inlibc
10696
10697: see if setruid exists
10698set setruid d_setruid
10699eval $inlibc
10700
e5c9fcd0
AD
10701: see if setservent exists
10702set setservent d_setsent
10703eval $inlibc
10704
2304df62
AD
10705: see if setsid exists
10706set setsid d_setsid
10707eval $inlibc
10708
f1066039
JH
10709: see if setspent exists
10710set setspent d_setspent
10711eval $inlibc
10712
e5c9fcd0
AD
10713: see if setvbuf exists
10714set setvbuf d_setvbuf
10715eval $inlibc
10716
760ac839
LW
10717: see if sfio.h is available
10718set sfio.h i_sfio
10719eval $inhdr
10720
10721
8ff267be 10722: see if sfio library is available
760ac839
LW
10723case "$i_sfio" in
10724$define)
10725 val=''
10726 set sfreserve val
10727 eval $inlibc
10728 ;;
10729*)
10730 val="$undef"
10731 ;;
10732esac
8ff267be 10733: Ok, but do we want to use it.
760ac839
LW
10734case "$val" in
10735$define)
10736 case "$usesfio" in
8ff267be 10737 true|$define|[yY]*) dflt='y';;
760ac839
LW
10738 *) dflt='n';;
10739 esac
8ff267be 10740 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
10741 rp="You seem to have sfio available, do you want to try using it?"
10742 . ./myread
10743 case "$ans" in
8ff267be 10744 y|Y) ;;
10745 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 10746 val="$undef"
ff0cee69 10747 : Remove sfio from list of libraries to use
10748 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10749 shift
10750 libs="$*"
10751 echo "libs = $libs" >&4
760ac839
LW
10752 ;;
10753 esac
10754 ;;
8ff267be 10755*) case "$usesfio" in
10756 true|$define|[yY]*)
10757 echo "Sorry, cannot find sfio on this machine" >&4
10758 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
10759 ;;
10760 esac
10761 ;;
10762esac
8ff267be 10763set d_sfio
10764eval $setvar
760ac839
LW
10765case "$d_sfio" in
10766$define) usesfio='true';;
10767*) usesfio='false';;
10768esac
10769
2304df62
AD
10770: see if shmctl exists
10771set shmctl d_shmctl
10772eval $inlibc
10773
10774: see if shmget exists
10775set shmget d_shmget
10776eval $inlibc
10777
a0d0e21e
LW
10778: see if shmat exists
10779set shmat d_shmat
10780eval $inlibc
10781: see what shmat returns
10782case "$d_shmat" in
10783"$define")
10784 $cat >shmat.c <<'END'
10785#include <sys/shm.h>
10786void *shmat();
10787END
10788 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10789 shmattype='void *'
10790 else
10791 shmattype='char *'
10792 fi
10793 echo "and it returns ($shmattype)." >&4
10794 : see if a prototype for shmat is available
e50aee73
AD
10795 xxx=`./findhdr sys/shm.h`
10796 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
10797 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10798 val="$define"
10799 else
10800 val="$undef"
10801 fi
10802 $rm -f shmat.[co]
10803 ;;
10804*)
10805 val="$undef"
10806 ;;
10807esac
10808set d_shmatprototype
10809eval $setvar
10810
10811: see if shmdt exists
10812set shmdt d_shmdt
10813eval $inlibc
10814
10815: see how much of the 'shm*(2)' library is present.
10816h_shm=true
10817echo " "
10818case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10819*"$undef"*) h_shm=false;;
10820esac
6087ac44
JH
10821case "$osname" in
10822freebsd)
10823 case "`ipcs 2>&1`" in
10824 "SVID shared memory"*"not configured"*)
5ff3f7a4 10825 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
10826 h_shm=false
10827 val="$undef"
10828 set shmctl d_shmctl
10829 evat $setvar
10830 set shmget d_shmget
10831 evat $setvar
10832 set shmat d_shmat
10833 evat $setvar
10834 set shmdt d_shmdt
10835 evat $setvar
10836 ;;
10837 esac
10838 ;;
10839esac
a0d0e21e
LW
10840: we could also check for sys/ipc.h ...
10841if $h_shm && $test `./findhdr sys/shm.h`; then
10842 echo "You have the full shm*(2) library." >&4
10843 val="$define"
10844else
10845 echo "You don't have the full shm*(2) library." >&4
10846 val="$undef"
10847fi
10848set d_shm
10849eval $setvar
10850
2c7991dc 10851echo " "
8ff267be 10852: see if we have sigaction
10853if set sigaction val -f d_sigaction; eval $csym; $val; then
10854 echo 'sigaction() found.' >&4
dc45a647 10855 $cat > try.c <<'EOP'
8ff267be 10856#include <stdio.h>
10857#include <sys/types.h>
10858#include <signal.h>
d674cd6d 10859int main()
8ff267be 10860{
10861 struct sigaction act, oact;
190b66db 10862 act.sa_flags = 0;
48159a0c 10863 oact.sa_handler = 0;
14e4fe40
JH
10864 /* so that act and oact are used */
10865 exit(act.sa_flags == 0 && oact.sa_handler == 0);
8ff267be 10866}
10867EOP
dc45a647
MB
10868 set try
10869 if eval $compile_ok; then
10870 val="$define"
10871 else
10872 echo "But you don't seem to have a useable struct sigaction." >&4
10873 val="$undef"
10874 fi
8ff267be 10875else
dc45a647 10876 echo 'sigaction NOT found.' >&4
8ff267be 10877 val="$undef"
10878fi
10879set d_sigaction; eval $setvar
dfe9444c 10880$rm -f try try$_o try.c
2c7991dc 10881
a5f75d66
AD
10882: see if sigsetjmp exists
10883echo " "
921b2963
JH
10884case "$d_sigsetjmp" in
10885'')
10886 $cat >try.c <<'EOP'
10887#include <setjmp.h>
10888sigjmp_buf env;
10889int set = 1;
d674cd6d 10890int main()
921b2963
JH
10891{
10892 if (sigsetjmp(env,1))
10893 exit(set);
10894 set = 0;
10895 siglongjmp(env, 1);
10896 exit(1);
10897}
10898EOP
10899 set try
10900 if eval $compile; then
10901 if ./try >/dev/null 2>&1; then
10902 echo "POSIX sigsetjmp found." >&4
10903 val="$define"
10904 else
10905 $cat >&4 <<EOM
10906Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10907I'll ignore them.
10908EOM
10909 val="$undef"
a0d0e21e 10910 fi
921b2963
JH
10911 else
10912 echo "sigsetjmp not found." >&4
10913 val="$undef"
a0d0e21e 10914 fi
921b2963
JH
10915 ;;
10916*) val="$d_sigsetjmp"
10917 case "$d_sigsetjmp" in
10918 $define) echo "POSIX sigsetjmp found." >&4;;
10919 $undef) echo "sigsetjmp not found." >&4;;
10920 esac
10921 ;;
10922esac
10923set d_sigsetjmp
10924eval $setvar
10925$rm -f try.c try
2304df62 10926
68d4903c
JH
10927: see if sqrtl exists
10928set sqrtl d_sqrtl
10929eval $inlibc
10930
d9b3e12d
JH
10931: see if sys/stat.h is available
10932set sys/stat.h i_sysstat
10933eval $inhdr
10934
b7b35fc2 10935
2304df62
AD
10936: see if stat knows about block sizes
10937echo " "
b7b35fc2 10938echo "Checking to see if your struct stat has st_blocks field..." >&4
5ff3f7a4
GS
10939set d_statblks stat st_blocks $i_sysstat sys/stat.h
10940eval $hasfield
2304df62 10941
b7b35fc2 10942
ad27e871
JH
10943: see if this is a sys/vfs.h system
10944set sys/vfs.h i_sysvfs
10945eval $inhdr
10946
b7b35fc2 10947
ad27e871
JH
10948: see if this is a sys/statfs.h system
10949set sys/statfs.h i_sysstatfs
10950eval $inhdr
10951
10952
10953echo " "
8175356b 10954echo "Checking to see if your system supports struct statfs..." >&4
ad27e871
JH
10955set 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
10956eval $hasstruct
10957case "$d_statfs_s" in
a22e52b9
JH
10958"$define") echo "Yes, it does." ;;
10959*) echo "No, it doesn't." ;;
ad27e871
JH
10960esac
10961
10962
10963
10964: see if struct statfs knows about f_flags
10965case "$d_statfs_s" in
10966define)
10967 echo " "
8175356b 10968 echo "Checking to see if your struct statfs has f_flags field..." >&4
ad27e871
JH
10969 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
10970 eval $hasfield
10971 ;;
10972*) val="$undef"
10973 set d_statfs_f_flags
10974 eval $setvar
10975 ;;
10976esac
10977case "$d_statfs_f_flags" in
a22e52b9
JH
10978"$define") echo "Yes, it does." ;;
10979*) echo "No, it doesn't." ;;
ad27e871
JH
10980esac
10981
16d20bd9
AD
10982: see if _ptr and _cnt from stdio act std
10983echo " "
dca663ed 10984if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
10985 echo "(Looks like you have stdio.h from Linux.)"
10986 case "$stdio_ptr" in
c2960299
AD
10987 '') stdio_ptr='((fp)->_IO_read_ptr)'
10988 ptr_lval=$define
10989 ;;
8e07c86e 10990 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10991 esac
10992 case "$stdio_cnt" in
c2960299
AD
10993 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10994 cnt_lval=$undef
10995 ;;
8e07c86e 10996 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10997 esac
10998 case "$stdio_base" in
10999 '') stdio_base='((fp)->_IO_read_base)';;
11000 esac
11001 case "$stdio_bufsiz" in
c2960299 11002 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
11003 esac
11004else
11005 case "$stdio_ptr" in
c2960299
AD
11006 '') stdio_ptr='((fp)->_ptr)'
11007 ptr_lval=$define
11008 ;;
8e07c86e 11009 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
11010 esac
11011 case "$stdio_cnt" in
c2960299
AD
11012 '') stdio_cnt='((fp)->_cnt)'
11013 cnt_lval=$define
11014 ;;
8e07c86e 11015 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
11016 esac
11017 case "$stdio_base" in
11018 '') stdio_base='((fp)->_base)';;
11019 esac
11020 case "$stdio_bufsiz" in
11021 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11022 esac
11023fi
11024: test whether _ptr and _cnt really work
11025echo "Checking how std your stdio is..." >&4
11026$cat >try.c <<EOP
11027#include <stdio.h>
11028#define FILE_ptr(fp) $stdio_ptr
11029#define FILE_cnt(fp) $stdio_cnt
d674cd6d 11030int main() {
16d20bd9
AD
11031 FILE *fp = fopen("try.c", "r");
11032 char c = getc(fp);
11033 if (
11034 18 <= FILE_cnt(fp) &&
11035 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11036 )
11037 exit(0);
11038 exit(1);
11039}
11040EOP
11041val="$undef"
dfe9444c
AD
11042set try
11043if eval $compile; then
16d20bd9
AD
11044 if ./try; then
11045 echo "Your stdio acts pretty std."
11046 val="$define"
11047 else
11048 echo "Your stdio isn't very std."
11049 fi
11050else
11051 echo "Your stdio doesn't appear very std."
11052fi
11053$rm -f try.c try
11054set d_stdstdio
11055eval $setvar
11056
8e07c86e 11057: Can _ptr be used as an lvalue?
e50aee73
AD
11058case "$d_stdstdio$ptr_lval" in
11059$define$define) val=$define ;;
c2960299
AD
11060*) val=$undef ;;
11061esac
11062set d_stdio_ptr_lval
11063eval $setvar
11064
8e07c86e 11065: Can _cnt be used as an lvalue?
e50aee73
AD
11066case "$d_stdstdio$cnt_lval" in
11067$define$define) val=$define ;;
c2960299
AD
11068*) val=$undef ;;
11069esac
11070set d_stdio_cnt_lval
11071eval $setvar
11072
16d20bd9
AD
11073: see if _base is also standard
11074val="$undef"
11075case "$d_stdstdio" in
11076$define)
11077 $cat >try.c <<EOP
11078#include <stdio.h>
11079#define FILE_base(fp) $stdio_base
11080#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 11081int main() {
16d20bd9
AD
11082 FILE *fp = fopen("try.c", "r");
11083 char c = getc(fp);
11084 if (
11085 19 <= FILE_bufsiz(fp) &&
11086 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11087 )
11088 exit(0);
11089 exit(1);
11090}
11091EOP
dfe9444c
AD
11092 set try
11093 if eval $compile; then
16d20bd9 11094 if ./try; then
8ff267be 11095 echo "And its _base field acts std."
16d20bd9
AD
11096 val="$define"
11097 else
11098 echo "But its _base field isn't std."
11099 fi
11100 else
11101 echo "However, it seems to be lacking the _base field."
11102 fi
11103 $rm -f try.c try
11104 ;;
11105esac
11106set d_stdiobase
11107eval $setvar
11108
ed39a0f2
JH
11109$cat >&4 <<EOM
11110Checking how to access stdio streams by file descriptor number...
11111EOM
11112case "$stdio_stream_array" in
11113'') $cat >try.c <<EOCP
11114#include <stdio.h>
11115int main() {
11116 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11117 printf("yes\n");
11118}
11119EOCP
11120 for s in _iob __iob __sF
11121 do
11122 set try -DSTDIO_STREAM_ARRAY=$s
11123 if eval $compile; then
11124 case "`./try$exe_ext`" in
11125 yes) stdio_stream_array=$s; break ;;
11126 esac
11127 fi
11128 done
11129 $rm -f try.* try$exe_ext
11130esac
11131case "$stdio_stream_array" in
11132'') $cat >&4 <<EOM
11133I can't figure out how to access stdio streams by file descriptor number.
11134EOM
11135 d_stdio_stream_array="$undef"
11136 ;;
11137*) $cat >&4 <<EOM
11138You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11139EOM
11140 d_stdio_stream_array="$define"
11141 ;;
11142esac
11143
a0d0e21e
LW
11144: see if strcoll exists
11145set strcoll d_strcoll
11146eval $inlibc
2304df62
AD
11147
11148: check for structure copying
11149echo " "
11150echo "Checking to see if your C compiler can copy structs..." >&4
11151$cat >try.c <<'EOCP'
5a411a32 11152int main()
2304df62
AD
11153{
11154 struct blurfl {
11155 int dyick;
11156 } foo, bar;
11157
11158 foo = bar;
11159}
11160EOCP
11161if $cc -c try.c >/dev/null 2>&1 ; then
11162 val="$define"
11163 echo "Yup, it can."
11164else
11165 val="$undef"
11166 echo "Nope, it can't."
11167fi
11168set d_strctcpy
11169eval $setvar
11170$rm -f try.*
11171
11172: see if strerror and/or sys_errlist[] exist
11173echo " "
28e8609d
JH
11174if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11175 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
11176 echo 'strerror() found.' >&4
11177 d_strerror="$define"
11178 d_strerrm='strerror(e)'
11179 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11180 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11181 d_syserrlst="$define"
11182 else
11183 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11184 d_syserrlst="$undef"
11185 fi
28e8609d 11186 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
11187 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11188 echo 'strerror() found in string header.' >&4
11189 d_strerror="$define"
11190 d_strerrm='strerror(e)'
11191 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11192 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11193 d_syserrlst="$define"
11194 else
11195 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11196 d_syserrlst="$undef"
11197 fi
28e8609d 11198 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
11199 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11200 d_strerror="$undef"
11201 d_syserrlst="$define"
11202 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 11203 else
5ff3f7a4
GS
11204 echo 'strerror() and sys_errlist[] NOT found.' >&4
11205 d_strerror="$undef"
11206 d_syserrlst="$undef"
11207 d_strerrm='"unknown"'
28e8609d 11208 fi
2304df62
AD
11209fi
11210
a89d8a78
DH
11211: see if strtod exists
11212set strtod d_strtod
11213eval $inlibc
11214
11215: see if strtol exists
11216set strtol d_strtol
11217eval $inlibc
11218
ff935051
JH
11219: see if strtold exists
11220set strtold d_strtold
11221eval $inlibc
11222
76d49b1c
JH
11223: see if strtoll exists
11224set strtoll d_strtoll
11225eval $inlibc
11226
a89d8a78
DH
11227: see if strtoul exists
11228set strtoul d_strtoul
11229eval $inlibc
11230
cf2093f6
JH
11231: see if strtoull exists
11232set strtoull d_strtoull
11233eval $inlibc
11234
ff935051
JH
11235: see if strtouq exists
11236set strtouq d_strtouq
11237eval $inlibc
11238
a0d0e21e
LW
11239: see if strxfrm exists
11240set strxfrm d_strxfrm
11241eval $inlibc
11242
8175356b
JH
11243: see if symlink exists
11244set symlink d_symlink
11245eval $inlibc
11246
11247: see if syscall exists
11248set syscall d_syscall
11249eval $inlibc
11250
11251: see if sysconf exists
11252set sysconf d_sysconf
11253eval $inlibc
11254
11255: see if system exists
11256set system d_system
11257eval $inlibc
11258
11259: see if tcgetpgrp exists
11260set tcgetpgrp d_tcgetpgrp
11261eval $inlibc
11262
11263: see if tcsetpgrp exists
11264set tcsetpgrp d_tcsetpgrp
11265eval $inlibc
11266
11267: see if prototype for telldir is available
11268echo " "
11269set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11270eval $hasproto
dc45a647 11271
2c7991dc 11272: see if this is a sys/times.h system
11273set sys/times.h i_systimes
11274eval $inhdr
4633a7c4 11275
2c7991dc 11276: see if times exists
4633a7c4 11277echo " "
2c7991dc 11278if set times val -f d_times; eval $csym; $val; then
11279 echo 'times() found.' >&4
11280 d_times="$define"
11281 inc=''
11282 case "$i_systimes" in
11283 "$define") inc='sys/times.h';;
11284 esac
dc45a647 11285 rp="What is the type returned by times() on this system?"
2c7991dc 11286 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 11287 eval $typedef_ask
2c7991dc 11288else
11289 echo 'times() NOT found, hope that will do.' >&4
11290 d_times="$undef"
11291 clocktype='int'
11292fi
2304df62 11293
2c7991dc 11294: see if truncate exists
11295set truncate d_truncate
11296eval $inlibc
2304df62 11297
2c7991dc 11298: see if tzname[] exists
11299echo " "
11300if set tzname val -a d_tzname; eval $csym; $val; then
11301 val="$define"
11302 echo 'tzname[] found.' >&4
11303else
11304 val="$undef"
11305 echo 'tzname[] NOT found.' >&4
11306fi
11307set d_tzname
11308eval $setvar
11309
11310: see if umask exists
11311set umask d_umask
11312eval $inlibc
85e6fe83 11313
0545a864
JH
11314: see if ustat exists
11315set ustat d_ustat
11316eval $inlibc
11317
4633a7c4
LW
11318: backward compatibility for d_hvfork
11319if test X$d_hvfork != X; then
11320 d_vfork="$d_hvfork"
11321 d_hvfork=''
11322fi
11323: see if there is a vfork
11324val=''
11325set vfork val
11326eval $inlibc
ecfc5424 11327
4633a7c4
LW
11328: Ok, but do we want to use it. vfork is reportedly unreliable in
11329: perl on Solaris 2.x, and probably elsewhere.
11330case "$val" in
11331$define)
16d20bd9 11332 echo " "
4633a7c4
LW
11333 case "$usevfork" in
11334 false) dflt='n';;
11335 *) dflt='y';;
11336 esac
f10488a3
JH
11337 cat <<'EOM'
11338
11339Perl can only use a vfork() that doesn't suffer from strict
11340restrictions on calling functions or modifying global data in
11341the child. For example, glibc-2.1 contains such a vfork()
11342that is unsuitable. If your system provides a proper fork()
11343call, chances are that you do NOT want perl to use vfork().
11344
11345EOM
11346 rp="Do you still want to use vfork()?"
4633a7c4
LW
11347 . ./myread
11348 case "$ans" in
11349 y|Y) ;;
11350 *)
11351 echo "Ok, we won't use vfork()."
11352 val="$undef"
11353 ;;
11354 esac
ecfc5424
AD
11355 ;;
11356esac
4633a7c4
LW
11357set d_vfork
11358eval $setvar
11359case "$d_vfork" in
11360$define) usevfork='true';;
11361*) usevfork='false';;
11362esac
ecfc5424 11363
4633a7c4
LW
11364: see if this is an sysdir system
11365set sys/dir.h i_sysdir
11366eval $inhdr
11367
11368: see if this is an sysndir system
11369set sys/ndir.h i_sysndir
11370eval $inhdr
11371
11372: see if closedir exists
11373set closedir d_closedir
11374eval $inlibc
11375
11376case "$d_closedir" in
11377"$define")
16d20bd9 11378 echo " "
4633a7c4
LW
11379 echo "Checking whether closedir() returns a status..." >&4
11380 cat > closedir.c <<EOM
11381#$i_dirent I_DIRENT /**/
11382#$i_sysdir I_SYS_DIR /**/
11383#$i_sysndir I_SYS_NDIR /**/
bfb7748a 11384#$i_systypes I_SYS_TYPES /**/
4633a7c4 11385
bfb7748a
AD
11386#if defined(I_SYS_TYPES)
11387#include <sys/types.h>
11388#endif
4633a7c4
LW
11389#if defined(I_DIRENT)
11390#include <dirent.h>
11391#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11392#include <sys/dir.h>
4aa0a1f7 11393#endif
4633a7c4
LW
11394#else
11395#ifdef I_SYS_NDIR
11396#include <sys/ndir.h>
11397#else
11398#ifdef I_SYS_DIR
11399#ifdef hp9000s500
11400#include <ndir.h> /* may be wrong in the future */
11401#else
11402#include <sys/dir.h>
11403#endif
11404#endif
11405#endif
11406#endif
11407int main() { return closedir(opendir(".")); }
11408EOM
dfe9444c 11409 set closedir
dc45a647 11410 if eval $compile_ok; then
4633a7c4
LW
11411 if ./closedir > /dev/null 2>&1 ; then
11412 echo "Yes, it does."
11413 val="$undef"
ecfc5424 11414 else
4633a7c4
LW
11415 echo "No, it doesn't."
11416 val="$define"
ecfc5424
AD
11417 fi
11418 else
4633a7c4
LW
11419 echo "(I can't seem to compile the test program--assuming it doesn't)"
11420 val="$define"
ecfc5424 11421 fi
ecfc5424 11422 ;;
4633a7c4
LW
11423*)
11424 val="$undef";
ecfc5424
AD
11425 ;;
11426esac
4633a7c4
LW
11427set d_void_closedir
11428eval $setvar
11429$rm -f closedir*
11430: check for volatile keyword
ecfc5424 11431echo " "
4633a7c4
LW
11432echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11433$cat >try.c <<'EOCP'
5a411a32 11434int main()
4633a7c4
LW
11435{
11436 typedef struct _goo_struct goo_struct;
11437 goo_struct * volatile goo = ((goo_struct *)0);
11438 struct _goo_struct {
11439 long long_int;
11440 int reg_int;
11441 char char_var;
11442 };
11443 typedef unsigned short foo_t;
11444 char *volatile foo;
11445 volatile int bar;
11446 volatile foo_t blech;
11447 foo = foo;
a0d0e21e
LW
11448}
11449EOCP
4633a7c4
LW
11450if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11451 val="$define"
11452 echo "Yup, it does."
11453else
11454 val="$undef"
11455 echo "Nope, it doesn't."
11456fi
11457set d_volatile
11458eval $setvar
11459$rm -f try.*
a0d0e21e 11460
4633a7c4
LW
11461: see if there is a wait4
11462set wait4 d_wait4
8e07c86e
AD
11463eval $inlibc
11464
4633a7c4
LW
11465: see if waitpid exists
11466set waitpid d_waitpid
11467eval $inlibc
11468
11469: see if wcstombs exists
11470set wcstombs d_wcstombs
11471eval $inlibc
11472
11473: see if wctomb exists
11474set wctomb d_wctomb
11475eval $inlibc
11476
11477: preserve RCS keywords in files with variable substitution, grrr
11478Date='$Date'
11479Id='$Id'
11480Log='$Log'
11481RCSfile='$RCSfile'
11482Revision='$Revision'
11483
ca8cfa54
JH
11484case "$crosscompile" in
11485''|[nN]*) crosscompile="$undef" ;;
11486esac
11487
11488case "$osname" in
8f1f23e8 11489next|rhapsody) multiarch="$define" ;;
ca8cfa54
JH
11490esac
11491case "$multiarch" in
11492''|[nN]*) multiarch="$undef" ;;
11493esac
11494
4633a7c4
LW
11495: check for alignment requirements
11496echo " "
68c15b6f
HM
11497case "$crosscompile$multiarch" in
11498*$define*)
ca8cfa54
JH
11499 $cat <<EOM
11500You seem to be either cross-compiling or doing a multiarchitecture build,
11501skipping the memory alignment check.
68c15b6f
HM
11502
11503EOM
11504 case "$alignbytes" in
11505 '') alignbytes=8 ;;
11506 esac
11507 ;;
11508*)
11509 case "$alignbytes" in
11510 '') echo "Checking alignment constraints..." >&4
11511 $cat >try.c <<'EOCP'
14e4fe40 11512#include <stdio.h>
4633a7c4
LW
11513struct foobar {
11514 char foo;
11515 double bar;
732c9516 11516} try_algn;
d674cd6d 11517int main()
4633a7c4 11518{
213c275f
JH
11519 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11520 return(0);
4633a7c4
LW
11521}
11522EOCP
68c15b6f
HM
11523 set try
11524 if eval $compile_ok; then
11525 dflt=`./try`
11526 else
11527 dflt='8'
11528 echo "(I can't seem to compile the test program...)"
11529 fi
11530 ;;
11531 *) dflt="$alignbytes"
11532 ;;
11533 esac
11534 rp="Doubles must be aligned on a how-many-byte boundary?"
11535 . ./myread
11536 alignbytes="$ans"
11537 $rm -f try.c try
8e07c86e 11538 ;;
ecfc5424 11539esac
68c15b6f 11540
85e6fe83 11541
4633a7c4 11542: check for ordering of bytes in a long
68c15b6f
HM
11543echo " "
11544case "$crosscompile$multiarch" in
11545*$define*)
11546 $cat <<EOM
ca8cfa54
JH
11547You seem to be either cross-compiling or doing a multiarchitecture build,
11548skipping the byteorder check.
68c15b6f
HM
11549
11550EOM
d9b3e12d 11551 byteorder='0xffff'
68c15b6f
HM
11552 ;;
11553*)
11554 case "$byteorder" in
11555 '')
11556 $cat <<'EOM'
4633a7c4
LW
11557In the following, larger digits indicate more significance. A big-endian
11558machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11559little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
d9b3e12d
JH
11560machines may have weird orders like 3412. A Cray will report 87654321,
11561an Alpha will report 12345678. If the test program works the default is
11562probably right.
4633a7c4
LW
11563I'm now running the test program...
11564EOM
68c15b6f 11565 $cat >try.c <<'EOCP'
4633a7c4 11566#include <stdio.h>
d674cd6d 11567int main()
4633a7c4
LW
11568{
11569 int i;
11570 union {
11571 unsigned long l;
11572 char c[sizeof(long)];
11573 } u;
11574
11575 if (sizeof(long) > 4)
11576 u.l = (0x08070605L << 32) | 0x04030201L;
11577 else
11578 u.l = 0x04030201L;
11579 for (i = 0; i < sizeof(long); i++)
11580 printf("%c", u.c[i]+'0');
11581 printf("\n");
11582 exit(0);
11583}
11584EOCP
68c15b6f
HM
11585 xxx_prompt=y
11586 set try
11587 if eval $compile && ./try > /dev/null; then
11588 dflt=`./try`
11589 case "$dflt" in
11590 [1-4][1-4][1-4][1-4]|12345678|87654321)
11591 echo "(The test program ran ok.)"
11592 echo "byteorder=$dflt"
11593 xxx_prompt=n
4633a7c4 11594 ;;
68c15b6f
HM
11595 ????|????????) echo "(The test program ran ok.)" ;;
11596 *) echo "(The test program didn't run right for some reason.)" ;;
11597 esac
11598 else
11599 dflt='4321'
11600 cat <<'EOM'
4633a7c4
LW
11601(I can't seem to compile the test program. Guessing big-endian...)
11602EOM
68c15b6f
HM
11603 fi
11604 case "$xxx_prompt" in
11605 y)
11606 rp="What is the order of bytes in a long?"
11607 . ./myread
11608 byteorder="$ans"
11609 ;;
11610 *) byteorder=$dflt
11611 ;;
11612 esac
ecfc5424
AD
11613 ;;
11614 esac
68c15b6f 11615 $rm -f try.c try
ecfc5424
AD
11616 ;;
11617esac
68c15b6f 11618
85e6fe83 11619
4633a7c4 11620: how do we catenate cpp tokens here?
2304df62 11621echo " "
4633a7c4
LW
11622echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11623$cat >cpp_stuff.c <<'EOCP'
11624#define RCAT(a,b)a/**/b
11625#define ACAT(a,b)a ## b
11626RCAT(Rei,ser)
11627ACAT(Cir,cus)
11628EOCP
11629$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11630if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11631 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
11632 echo "We can catify or stringify, separately or together!"
11633 cpp_stuff=42
11634elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11635 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
11636 echo "However, in the good old days we don't know how to stringify and"
11637 echo "catify at the same time."
11638 cpp_stuff=1
11639else
11640 $cat >&4 <<EOM
11641Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
11642to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 11643EOM
4633a7c4
LW
11644 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11645fi
11646$rm -f cpp_stuff.*
a0d0e21e 11647
4633a7c4
LW
11648: see if this is a db.h system
11649set db.h i_db
11650eval $inhdr
11651
11652case "$i_db" in
68dc0745 11653$define)
1f70e1ea 11654 : Check db version.
68dc0745 11655 echo " "
11656 echo "Checking Berkeley DB version ..." >&4
11657 $cat >try.c <<EOCP
11658#$d_const HASCONST
11659#ifndef HASCONST
11660#define const
11661#endif
11662#include <sys/types.h>
11663#include <stdio.h>
11664#include <db.h>
d674cd6d 11665int main()
68dc0745 11666{
1f70e1ea
PM
11667#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11668 int Major, Minor, Patch ;
ee02776e 11669 unsigned long Version ;
1f70e1ea
PM
11670 (void)db_version(&Major, &Minor, &Patch) ;
11671 printf("You have Berkeley DB Version 2 or greater\n");
11672
11673 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11674 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11675 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11676 Major, Minor, Patch) ;
11677
11678 /* check that db.h & libdb are compatible */
11679 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11680 printf("db.h and libdb are incompatible\n") ;
11681 exit(3);
11682 }
11683
11684 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
11685
11686 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 11687 + DB_VERSION_PATCH ;
ee02776e
PM
11688
11689 /* needs to be >= 2.3.4 */
11690 if (Version < 2003004) {
693762b4 11691 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 11692 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
11693 exit(2);
11694 }
11695
11696 exit(0);
68dc0745 11697#else
6a1b87e5 11698#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 11699 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
11700 exit(0); /* DB version < 2: the coast is clear. */
11701#else
11702 exit(1); /* <db.h> not Berkeley DB? */
11703#endif
68dc0745 11704#endif
11705}
11706EOCP
dfe9444c 11707 set try
cf21f3c6 11708 if eval $compile_ok && ./try; then
1f70e1ea 11709 echo 'Looks OK.' >&4
68dc0745 11710 else
c90c0ff4 11711 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 11712 i_db=$undef
11713 case " $libs " in
11714 *"-ldb "*)
11715 : Remove db from list of libraries to use
11716 echo "Removing unusable -ldb from library list" >&4
11717 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11718 shift
11719 libs="$*"
11720 echo "libs = $libs" >&4
11721 ;;
11722 esac
11723 fi
11724 $rm -f try.*
11725 ;;
11726esac
11727
11728case "$i_db" in
4633a7c4 11729define)
dc45a647
MB
11730 : Check the return type needed for hash
11731 echo " "
11732 echo "Checking return type needed for hash for Berkeley DB ..." >&4
11733 $cat >try.c <<EOCP
11734#$d_const HASCONST
11735#ifndef HASCONST
11736#define const
11737#endif
11738#include <sys/types.h>
11739#include <db.h>
11740
11741#ifndef DB_VERSION_MAJOR
11742u_int32_t hash_cb (ptr, size)
11743const void *ptr;
11744size_t size;
11745{
11746}
11747HASHINFO info;
d674cd6d 11748int main()
dc45a647
MB
11749{
11750 info.hash = hash_cb;
11751}
11752#endif
11753EOCP
11754 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11755 if $contains warning try.out >>/dev/null 2>&1 ; then
11756 db_hashtype='int'
11757 else
11758 db_hashtype='u_int32_t'
11759 fi
11760 else
11761 : XXX Maybe we should just give up here.
11762 db_hashtype=u_int32_t
11763 $cat try.out >&4
11764 echo "Help: I can't seem to compile the db test program." >&4
11765 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11766 fi
11767 $rm -f try.*
11768 echo "Your version of Berkeley DB uses $db_hashtype for hash."
11769 ;;
11770*) db_hashtype=u_int32_t
11771 ;;
11772esac
11773case "$i_db" in
11774define)
4633a7c4
LW
11775 : Check the return type needed for prefix
11776 echo " "
11777 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11778 cat >try.c <<EOCP
11779#$d_const HASCONST
11780#ifndef HASCONST
11781#define const
11782#endif
11783#include <sys/types.h>
11784#include <db.h>
1f70e1ea
PM
11785
11786#ifndef DB_VERSION_MAJOR
4633a7c4
LW
11787size_t prefix_cb (key1, key2)
11788const DBT *key1;
11789const DBT *key2;
11790{
11791}
11792BTREEINFO info;
d674cd6d 11793int main()
4633a7c4
LW
11794{
11795 info.prefix = prefix_cb;
11796}
1f70e1ea 11797#endif
4633a7c4
LW
11798EOCP
11799 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11800 if $contains warning try.out >>/dev/null 2>&1 ; then
11801 db_prefixtype='int'
11802 else
11803 db_prefixtype='size_t'
11804 fi
11805 else
68dc0745 11806 db_prefixtype='size_t'
11807 : XXX Maybe we should just give up here.
dc45a647 11808 $cat try.out >&4
68dc0745 11809 echo "Help: I can't seem to compile the db test program." >&4
11810 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
11811 fi
11812 $rm -f try.*
11813 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 11814 ;;
68dc0745 11815*) db_prefixtype='size_t'
4633a7c4
LW
11816 ;;
11817esac
a0d0e21e 11818
4633a7c4
LW
11819: check for void type
11820echo " "
11821echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
11822case "$voidflags" in
11823'')
11824 $cat >try.c <<'EOCP'
11825#if TRY & 1
760ac839 11826void sub() {
4633a7c4 11827#else
760ac839 11828sub() {
4633a7c4
LW
11829#endif
11830 extern void moo(); /* function returning void */
11831 void (*goo)(); /* ptr to func returning void */
11832#if TRY & 8
11833 void *hue; /* generic ptr */
11834#endif
11835#if TRY & 2
11836 void (*foo[10])();
11837#endif
a0d0e21e 11838
4633a7c4
LW
11839#if TRY & 4
11840 if(goo == moo) {
11841 exit(0);
11842 }
11843#endif
11844 exit(0);
11845}
d674cd6d 11846int main() { sub(); }
4633a7c4 11847EOCP
760ac839 11848 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 11849 voidflags=$defvoidused
bfb7748a 11850 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
11851 if $contains warning .out >/dev/null 2>&1; then
11852 echo "However, you might get some warnings that look like this:"
11853 $cat .out
11854 fi
11855 else
11856echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 11857 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 11858 echo "It supports 1..."
760ac839 11859 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 11860 echo "It also supports 2..."
760ac839 11861 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
11862 voidflags=7
11863 echo "And it supports 4 but not 8 definitely."
11864 else
11865 echo "It doesn't support 4..."
760ac839 11866 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
11867 voidflags=11
11868 echo "But it supports 8."
11869 else
11870 voidflags=3
11871 echo "Neither does it support 8."
11872 fi
11873 fi
11874 else
11875 echo "It does not support 2..."
760ac839 11876 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
11877 voidflags=13
11878 echo "But it supports 4 and 8."
11879 else
760ac839 11880 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
11881 voidflags=5
11882 echo "And it supports 4 but has not heard about 8."
11883 else
11884 echo "However it supports 8 but not 4."
11885 fi
11886 fi
11887 fi
11888 else
11889 echo "There is no support at all for void."
11890 voidflags=0
11891 fi
11892 fi
11893esac
4633a7c4 11894case "$voidflags" in
2c7991dc 11895"$defvoidused") ;;
bfb7748a
AD
11896*) $cat >&4 <<'EOM'
11897 Support flag bits are:
11898 1: basic void declarations.
11899 2: arrays of pointers to functions returning void.
11900 4: operations between pointers to and addresses of void functions.
11901 8: generic void pointers.
11902EOM
2c7991dc 11903 dflt="$voidflags";
4633a7c4 11904 rp="Your void support flags add up to what?"
a0d0e21e 11905 . ./myread
4633a7c4 11906 voidflags="$ans"
a0d0e21e
LW
11907 ;;
11908esac
4633a7c4 11909$rm -f try.* .out
a0d0e21e 11910
85ab1d1d
JH
11911
11912: How can we generate normalized random numbers ?
693762b4 11913echo " "
de4597cb 11914echo "Looking for a random number function..." >&4
85ab1d1d 11915case "$randfunc" in
693762b4 11916'')
85ab1d1d
JH
11917 if set drand48 val -f; eval $csym; $val; then
11918 dflt="drand48"
11919 echo "Good, found drand48()." >&4
11920 elif set random val -f; eval $csym; $val; then
11921 dflt="random"
11922 echo "OK, found random()." >&4
11923 else
11924 dflt="rand"
11925 echo "Yick, looks like I have to use rand()." >&4
11926 fi
11927 echo " "
11928 ;;
11929*)
11930 dflt="$randfunc"
11931 ;;
11932esac
11933cont=true
11934
11935case "$ccflags" in
11936*-Dmy_rand=*|*-Dmy_srand=*)
11937 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11938 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11939 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11940 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11941 ;;
11942esac
11943
11944while $test "$cont"; do
11945 rp="Use which function to generate random numbers?"
11946 . ./myread
11947 if $test "$ans" = "$dflt"; then
11948 : null
11949 else
11950 randbits=''
11951 fi
11952 randfunc="$ans"
11953 if set $ans val -f; eval $csym; $val; then
11954 cont=''
11955 else
ef4af2be
JH
11956 dflt=y
11957 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
11958 . ./myread
11959 dflt=rand
11960 case "$ans" in
11961 [yY]*) cont='';;
11962 esac
11963 fi
11964 case "$cont" in
11965 '')
11966 case "$randfunc" in
11967 drand48)
11968 drand01="drand48()"
11969 seedfunc="srand48"
11970 randbits=48
11971 randseedtype=long
11972 ;;
11973 rand|random)
11974 case "$randbits" in
11975 '')
11976echo "Checking to see how many bits your $randfunc() function produces..." >&4
11977 $cat >try.c <<EOCP
11978#$i_unistd I_UNISTD
11979#$i_stdlib I_STDLIB
693762b4 11980#include <stdio.h>
85ab1d1d
JH
11981#ifdef I_UNISTD
11982# include <unistd.h>
11983#endif
11984#ifdef I_STDLIB
11985# include <stdlib.h>
11986#endif
d674cd6d 11987int main()
693762b4 11988{
85ab1d1d
JH
11989 register int i;
11990 register unsigned long tmp;
11991 register unsigned long max = 0L;
11992
11993 for (i = 1000; i; i--) {
11994 tmp = (unsigned long) $randfunc();
11995 if (tmp > max) max = tmp;
11996 }
11997 for (i = 0; max; i++)
11998 max /= 2;
11999 printf("%d\n",i);
693762b4
AD
12000}
12001EOCP
85ab1d1d
JH
12002 set try
12003 if eval $compile_ok; then
12004 dflt=`try`
12005 else
12006 dflt='?'
12007 echo "(I can't seem to compile the test program...)"
12008 fi
12009 ;;
12010 *)
12011 dflt="$randbits"
12012 ;;
12013 esac
12014 rp="How many bits does your $randfunc() function produce?"
12015 . ./myread
12016 randbits="$ans"
12017 $rm -f try.c try
12018 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12019 seedfunc="s$randfunc"
12020 randseedtype=unsigned
12021 ;;
12022 *)
12023 dflt="31"
12024 rp="How many bits does your $randfunc() function produce?"
12025 . ./myread
12026 randbits="$ans"
12027 seedfunc="s$randfunc"
12028 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12029 if set $seedfunc val -f; eval $csym; $val; then
12030 echo "(Using $seedfunc() to seed random generator)"
12031 else
12032 echo "(Warning: no $seedfunc() to seed random generator)"
12033 seedfunc=rand
12034 fi
12035 randseedtype=unsigned
12036 ;;
12037 esac
12038 ;;
12039 esac
12040done
693762b4 12041
5ff3f7a4
GS
12042echo " "
12043echo "Determining whether or not we are on an EBCDIC system..." >&4
12044$cat >tebcdic.c <<'EOM'
12045int main()
12046{
12047 if ('M'==0xd4) return 0;
12048 return 1;
12049}
12050EOM
12051
12052val=$undef
12053set tebcdic
12054if eval $compile_ok; then
12055 if ./tebcdic; then
12056 echo "You have EBCDIC." >&4
12057 val="$define"
12058 else
57def98f 12059 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
5ff3f7a4
GS
12060 fi
12061else
5cc3184f 12062 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
12063 echo "I'll assume ASCII or some ISO Latin." >&4
12064fi
12065$rm -f tebcdic.c tebcdic
12066set ebcdic
12067eval $setvar
12068
29209bc5 12069echo " "
767df6a1
JH
12070$cat >&4 <<EOM
12071Checking how to flush all pending stdio output...
66fe083f 12072EOM
d2201af2
AD
12073# I only know how to find the first 32 possibly open files on SunOS.
12074# See also hints/sunos_4_1.sh and util.c --AD
12075case "$osname" in
12076sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12077esac
12078$cat >>try.c <<EOCP
66fe083f 12079#include <stdio.h>
d2201af2 12080#$i_unistd I_UNISTD
767df6a1 12081#ifdef I_UNISTD
a32a45b6 12082# include <unistd.h>
767df6a1
JH
12083#endif
12084#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
12085#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12086#ifdef HAS_STDIO_STREAM_ARRAY
12087# define STDIO_STREAM_ARRAY $stdio_stream_array
12088#endif
66fe083f
JH
12089int main() {
12090 FILE* p = fopen("try.out", "w");
0f27ced1 12091#ifdef TRY_FPUTC
66fe083f 12092 fputc('x', p);
0f27ced1
JH
12093#else
12094# ifdef TRY_FPRINTF
12095 fprintf(p, "x");
12096# endif
12097#endif
767df6a1 12098#ifdef TRY_FFLUSH_NULL
66fe083f 12099 fflush(NULL);
767df6a1
JH
12100#endif
12101#ifdef TRY_FFLUSH_ALL
12102 {
12103 long open_max = -1;
d2201af2
AD
12104# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12105 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 12106# else
d2201af2
AD
12107# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12108 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 12109# else
4b257aef 12110# ifdef FOPEN_MAX
d2201af2 12111 open_max = FOPEN_MAX;
767df6a1 12112# else
d2201af2
AD
12113# ifdef OPEN_MAX
12114 open_max = OPEN_MAX;
12115# else
12116# ifdef _NFILE
12117 open_max = _NFILE;
12118# endif
767df6a1
JH
12119# endif
12120# endif
12121# endif
4b257aef 12122# endif
ed39a0f2 12123# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
12124 if (open_max > 0) {
12125 long i;
12126 for (i = 0; i < open_max; i++)
d2201af2
AD
12127 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12128 STDIO_STREAM_ARRAY[i]._file < open_max &&
12129 STDIO_STREAM_ARRAY[i]._flag)
12130 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
12131 }
12132 }
ed39a0f2 12133# endif
767df6a1
JH
12134#endif
12135 _exit(42);
66fe083f
JH
12136}
12137EOCP
0f27ced1
JH
12138: first we have to find out how _not_ to flush
12139if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12140 output=''
12141 set try -DTRY_FPUTC
6626660c 12142 if eval $compile; then
4b257aef 12143 $rm -f try.out
0f27ced1
JH
12144 ./try$exe_ext 2>/dev/null
12145 if $test ! -s try.out -a "X$?" = X42; then
12146 output=-DTRY_FPUTC
12147 fi
12148 fi
12149 case "$output" in
12150 '')
12151 set try -DTRY_FPRINTF
12152 $rm -f try.out
6626660c 12153 if eval $compile; then
4b257aef 12154 $rm -f try.out
0f27ced1
JH
12155 ./try$exe_ext 2>/dev/null
12156 if $test ! -s try.out -a "X$?" = X42; then
12157 output=-DTRY_FPRINTF
12158 fi
12159 fi
12160 ;;
12161 esac
12162fi
767df6a1
JH
12163: check for fflush NULL behaviour
12164case "$fflushNULL" in
0f27ced1 12165'') set try -DTRY_FFLUSH_NULL $output
6626660c 12166 if eval $compile; then
4b257aef 12167 $rm -f try.out
196fa3d2 12168 ./try$exe_ext 2>/dev/null
a32a45b6
JH
12169 code="$?"
12170 if $test -s try.out -a "X$code" = X42; then
c2fddd50 12171 fflushNULL="`$cat try.out`"
a32a45b6
JH
12172 else
12173 if $test "X$code" != X42; then
12174 $cat >&4 <<EOM
12175(If this test failed, don't worry, we'll try another method shortly.)
12176EOM
12177 fi
c2fddd50
JH
12178 fi
12179 fi
0f27ced1 12180 $rm -f core try.core core.try.*
c2fddd50 12181 case "$fflushNULL" in
6626660c 12182 x) $cat >&4 <<EOM
66fe083f
JH
12183Your fflush(NULL) works okay.
12184EOM
ed39a0f2 12185 fflushNULL="$define"
c2fddd50 12186 ;;
6626660c 12187 '') $cat >&4 <<EOM
66fe083f
JH
12188Your fflush(NULL) isn't working (contrary to ANSI C).
12189EOM
ed39a0f2 12190 fflushNULL="$undef"
c2fddd50 12191 ;;
6626660c 12192 *) $cat >&4 <<EOM
66fe083f
JH
12193Cannot figure out whether your fflush(NULL) works or not.
12194I'm assuming it doesn't (contrary to ANSI C).
12195EOM
ed39a0f2 12196 fflushNULL="$undef"
c2fddd50
JH
12197 ;;
12198 esac
66fe083f
JH
12199 ;;
12200$define|true|[yY]*)
ed39a0f2 12201 fflushNULL="$define"
66fe083f
JH
12202 ;;
12203*)
ed39a0f2 12204 fflushNULL="$undef"
66fe083f
JH
12205 ;;
12206esac
a32a45b6
JH
12207: check explicit looping only if NULL did not work
12208case "$fflushNULL" in
12209"$undef")
12210 : check for fflush all behaviour
12211 case "$fflushall" in
12212 '') set try -DTRY_FFLUSH_ALL $output
a32a45b6 12213 if eval $compile; then
4b257aef 12214 $cat >&4 <<EOM
a32a45b6 12215(Now testing the other method--but note that also this may fail.)
a71cd7cd 12216EOM
4b257aef 12217 $rm -f try.out
a32a45b6
JH
12218 ./try$exe_ext 2>/dev/null
12219 if $test -s try.out -a "X$?" = X42; then
12220 fflushall="`$cat try.out`"
12221 fi
767df6a1 12222 fi
a32a45b6
JH
12223 $rm -f core try.core core.try.*
12224 case "$fflushall" in
12225 x) $cat >&4 <<EOM
12226Whew. Flushing explicitly all the stdio streams works.
767df6a1 12227EOM
a32a45b6
JH
12228 fflushall="$define"
12229 ;;
12230 '') $cat >&4 <<EOM
12231Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 12232EOM
a32a45b6
JH
12233 fflushall="$undef"
12234 ;;
12235 *) $cat >&4 <<EOM
6626660c 12236Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
12237I'm assuming it doesn't.
12238EOM
a32a45b6
JH
12239 fflushall="$undef"
12240 ;;
12241 esac
767df6a1 12242 ;;
a32a45b6
JH
12243 "$define"|true|[yY]*)
12244 fflushall="$define"
12245 ;;
12246 *)
12247 fflushall="$undef"
6626660c
JH
12248 ;;
12249 esac
767df6a1 12250 ;;
a32a45b6 12251*) fflushall="$undef"
767df6a1
JH
12252 ;;
12253esac
12254case "$fflushNULL$fflushall" in
12255undefundef)
6626660c 12256 $cat <<EOM
767df6a1
JH
12257I cannot figure out how to flush pending stdio output.
12258EOM
12259 ;;
12260esac
12261$rm -f try.* try$exe_ext
66fe083f 12262
ccc7f9b3
KS
12263: Store the full pathname to the ar program for use in the C program
12264: Respect a hint or command line value for full_ar.
12265case "$full_ar" in
12266'') full_ar=$ar ;;
12267esac
12268
1aef975c
AD
12269: Store the full pathname to the sed program for use in the C program
12270full_sed=$sed
12271
2304df62 12272: see what type gids are declared as in the kernel
dc45a647
MB
12273echo " "
12274echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
12275set gid_t gidtype xxx stdio.h sys/types.h
12276eval $typedef
2304df62 12277case "$gidtype" in
a0d0e21e
LW
12278xxx)
12279 xxx=`./findhdr sys/user.h`
12280 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12281 case $1 in
12282 unsigned) dflt="$1 $2" ;;
12283 *) dflt="$1" ;;
12284 esac
2304df62 12285 ;;
8175356b
JH
12286*) dflt="$gidtype";;
12287esac
12288case "$gidtype" in
12289gid_t) echo "gid_t found." ;;
12290*) rp="What is the type for group ids returned by getgid()?"
12291 . ./myread
12292 gidtype="$ans"
12293 ;;
12294esac
12295
12296echo " "
12297case "$gidtype" in
12298*_t) zzz="$gidtype" ;;
12299*) zzz="gid" ;;
12300esac
a22e52b9 12301echo "Checking the size of $zzz..." >&4
8175356b
JH
12302cat > try.c <<EOCP
12303#include <sys/types.h>
12304#include <stdio.h>
12305int main() {
213c275f 12306 printf("%d\n", (int)sizeof($gidtype));
14e4fe40 12307 exit(0);
8175356b
JH
12308}
12309EOCP
12310set try
a22e52b9 12311if eval $compile_ok; then
8175356b
JH
12312 yyy=`./try`
12313 case "$yyy" in
a22e52b9
JH
12314 '') gidsize=4
12315 echo "(I can't execute the test program--guessing $gidsize.)" >&4
8175356b 12316 ;;
a22e52b9
JH
12317 *) gidsize=$yyy
12318 echo "Your $zzz size is $gidsize bytes."
8175356b
JH
12319 ;;
12320 esac
12321else
a22e52b9
JH
12322 gidsize=4
12323 echo "(I can't compile the test program--guessing $gidsize.)" >&4
8175356b
JH
12324fi
12325
12326
12327echo " "
12328case "$gidtype" in
12329*_t) zzz="$gidtype" ;;
12330*) zzz="gid" ;;
12331esac
a22e52b9 12332echo "Checking the sign of $zzz..." >&4
8175356b
JH
12333cat > try.c <<EOCP
12334#include <sys/types.h>
12335#include <stdio.h>
12336int main() {
a22e52b9
JH
12337 $gidtype foo = -1;
12338 if (foo < 0)
12339 printf("-1\n");
12340 else
12341 printf("1\n");
8175356b
JH
12342}
12343EOCP
12344set try
a22e52b9 12345if eval $compile; then
8175356b
JH
12346 yyy=`./try`
12347 case "$yyy" in
a22e52b9
JH
12348 '') gidsign=1
12349 echo "(I can't execute the test program--guessing unsigned.)" >&4
8175356b 12350 ;;
a22e52b9
JH
12351 *) gidsign=$yyy
12352 case "$gidsign" in
12353 1) echo "Your $zzz is unsigned." ;;
12354 -1) echo "Your $zzz is signed." ;;
12355 esac
8175356b
JH
12356 ;;
12357 esac
12358else
a22e52b9
JH
12359 gidsign=1
12360 echo "(I can't compile the test program--guessing unsigned.)" >&4
8175356b
JH
12361fi
12362
12363
785fb66b 12364echo " "
8175356b
JH
12365
12366if $test X"$quadtype" != X; then
12367
12368echo "Checking how to print 64-bit integers..." >&4
12369
12370if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12371 $cat >try.c <<'EOCP'
785fb66b
JH
12372#include <sys/types.h>
12373#include <stdio.h>
12374int main() {
8175356b
JH
12375 int q = 12345678901;
12376 printf("%ld\n", q);
785fb66b
JH
12377}
12378EOCP
8175356b
JH
12379 set try
12380 if eval $compile; then
12381 yyy=`./try$exe_ext`
12382 case "$yyy" in
12383 12345678901)
12384 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12385 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12386 echo "We will use %d."
12387 ;;
785fb66b 12388 esac
8175356b 12389 fi
785fb66b
JH
12390fi
12391
8175356b
JH
12392if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12393 $cat >try.c <<'EOCP'
12394#include <sys/types.h>
12395#include <stdio.h>
12396int main() {
12397 long q = 12345678901;
12398 printf("%ld\n", q);
12399}
12400EOCP
12401 set try
12402 if eval $compile; then
12403 yyy=`./try$exe_ext`
12404 case "$yyy" in
12405 12345678901)
12406 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12407 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12408 echo "We will use %ld."
12409 ;;
12410 esac
12411 fi
12412fi
785fb66b 12413
8175356b
JH
12414if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12415 $cat >try.c <<'EOCP'
785fb66b 12416#include <sys/types.h>
8175356b 12417#include <inttypes.h>
785fb66b
JH
12418#include <stdio.h>
12419int main() {
8175356b
JH
12420 int64_t q = 12345678901;
12421 printf("%" PRId64 "\n", q);
785fb66b
JH
12422}
12423EOCP
8175356b
JH
12424 set try
12425 if eval $compile; then
12426 yyy=`./try$exe_ext`
12427 case "$yyy" in
12428 12345678901)
12429 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12430 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12431 echo "We will use the C9X style."
12432 ;;
12433 esac
12434 fi
12435fi
12436
12437if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12438 $cat >try.c <<'EOCP'
12439#include <sys/types.h>
12440#include <stdio.h>
12441int main() {
12442 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12443 printf("%lld\n", q);
12444}
12445EOCP
12446 set try
12447 if eval $compile; then
12448 yyy=`./try$exe_ext`
12449 case "$yyy" in
12450 12345678901)
12451 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12452 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12453 echo "We will use the %lld style."
12454 ;;
12455 esac
12456 fi
785fb66b
JH
12457fi
12458
8175356b
JH
12459if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12460 $cat >try.c <<EOCP
12461#include <sys/types.h>
12462#include <stdio.h>
12463int main() {
12464 $quadtype q = 12345678901;
12465 printf("%Ld\n", q);
12466}
12467EOCP
12468 set try
12469 if eval $compile; then
12470 yyy=`./try$exe_ext`
12471 case "$yyy" in
12472 12345678901)
12473 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12474 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12475 echo "We will use %Ld."
12476 ;;
12477 esac
12478 fi
12479fi
785fb66b 12480
8175356b
JH
12481if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12482 $cat >try.c <<EOCP
12483#include <sys/types.h>
12484#include <stdio.h>
12485int main() {
12486 $quadtype q = 12345678901;
12487 printf("%qd\n", q);
12488}
12489EOCP
12490 set try
12491 if eval $compile; then
12492 yyy=`./try$exe_ext`
12493 case "$yyy" in
12494 12345678901)
12495 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12496 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12497 echo "We will use %qd."
12498 ;;
12499 esac
12500 fi
12501fi
2304df62 12502
8175356b
JH
12503if $test X"$sPRId64" = X; then
12504 echo "Cannot figure out how to print 64-bit integers." >&4
12505fi
5cd24f17 12506
8175356b 12507$rm -f try try.*
dfe9444c 12508
8175356b 12509fi
2304df62 12510
8175356b
JH
12511case "$sPRId64" in
12512'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
12513 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
12514 ;;
12515*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
12516 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
a0d0e21e 12517 ;;
2304df62 12518esac
2304df62 12519
2304df62 12520
8ff267be 12521echo " "
8175356b
JH
12522$echo "Checking the format strings to be used for Perl's internal types..." >&4
12523
12524if $test X"$ivsize" = X8; then
12525 ivdformat="$sPRId64"
12526 uvuformat="$sPRIu64"
12527 uvoformat="$sPRIo64"
12528 uvxformat="$sPRIx64"
5ff3f7a4 12529else
8175356b
JH
12530 if $test X"$ivsize" = X"$longsize"; then
12531 ivdformat='"ld"'
12532 uvuformat='"lu"'
12533 uvoformat='"lo"'
12534 uvxformat='"lx"'
12535 else
12536 if $test X"$ivsize" = X"$intsize"; then
12537 ivdformat='"d"'
12538 uvuformat='"u"'
12539 uvoformat='"o"'
12540 uvxformat='"x"'
12541 else
12542 : far out
12543 if $test X"$ivsize" = X"$shortsize"; then
12544 ivdformat='"hd"'
12545 uvuformat='"hu"'
12546 uvoformat='"ho"'
12547 uvxformat='"hx"'
12548 fi
12549 fi
12550 fi
5ff3f7a4 12551fi
8175356b
JH
12552
12553case "$ivdformat" in
12554'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12555 exit 1
12556 ;;
12557esac
5ff3f7a4 12558
a22e52b9
JH
12559
12560echo " "
12561$echo "Checking the format string to be used for gids..." >&4
12562
12563case "$gidsign" in
12564-1) if $test X"$gidsize" = X"$ivsize"; then
12565 gidformat="$ivdformat"
12566 else
12567 if $test X"$gidsize" = X"$longsize"; then
12568 gidformat='"ld"'
12569 else
12570 if $test X"$gidsize" = X"$intsize"; then
12571 gidformat='"d"'
12572 else
12573 if $test X"$gidsize" = X"$shortsize"; then
12574 gidformat='"hd"'
12575 fi
12576 fi
12577 fi
12578 fi
12579 ;;
12580*) if $test X"$gidsize" = X"$uvsize"; then
12581 gidformat="$uvuformat"
12582 else
12583 if $test X"$gidsize" = X"$longsize"; then
12584 gidformat='"lu"'
12585 else
12586 if $test X"$gidsize" = X"$intsize"; then
12587 gidformat='"u"'
12588 else
12589 if $test X"$gidsize" = X"$shortsize"; then
12590 gidformat='"hu"'
12591 fi
12592 fi
12593 fi
12594 fi
12595 ;;
12596esac
12597
12598: see if getgroups exists
12599set getgroups d_getgrps
12600eval $inlibc
12601
12602: see if setgroups exists
12603set setgroups d_setgrps
12604eval $inlibc
12605
12606
12607: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12608echo " "
12609case "$d_getgrps$d_setgrps" in
12610*define*)
12611 case "$groupstype" in
12612 '') dflt="$gidtype" ;;
12613 *) dflt="$groupstype" ;;
12614 esac
12615 $cat <<EOM
12616What type of pointer is the second argument to getgroups() and setgroups()?
12617Usually this is the same as group ids, $gidtype, but not always.
12618
12619EOM
12620 rp='What type pointer is the second argument to getgroups() and setgroups()?'
12621 . ./myread
12622 groupstype="$ans"
12623 ;;
12624*) groupstype="$gidtype";;
12625esac
12626
5ff3f7a4 12627echo " "
dfe9444c 12628echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 12629case "$make_set_make" in
12630'')
12631 $sed 's/^X //' > testmake.mak << 'EOF'
12632Xall:
dfe9444c 12633X @echo 'maketemp="$(MAKE)"'
8ff267be 12634EOF
8ff267be 12635 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 12636 *maketemp=*) make_set_make='#' ;;
8ff267be 12637 *) make_set_make="MAKE=$make" ;;
12638 esac
dfe9444c
AD
12639 $rm -f testmake.mak
12640 ;;
12641esac
12642case "$make_set_make" in
12643'#') echo "Yup, it does.";;
12644*) echo "Nope, it doesn't.";;
12645esac
12646
12647: see what type is used for mode_t
dc45a647 12648rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 12649set mode_t modetype int stdio.h sys/types.h
dc45a647 12650eval $typedef_ask
dfe9444c 12651
dfe9444c
AD
12652: define a fucntion to check prototypes
12653$cat > protochk <<EOSH
12654$startsh
12655cc="$cc"
12656optimize="$optimize"
12657ccflags="$ccflags"
12658prototype="$prototype"
12659define="$define"
12660rm=$rm
12661EOSH
12662
12663$cat >> protochk <<'EOSH'
12664
12665$rm -f try.c
12666foo="$1"
12667shift
12668while test $# -ge 2; do
12669 case "$1" in
12670 $define) echo "#include <$2>" >> try.c ;;
12671 literal) echo "$2" >> try.c ;;
12672 esac
12673 shift 2
12674done
12675test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
12676cat >> try.c <<'EOCP'
12677#ifdef CAN_PROTOTYPE
12678#define _(args) args
12679#else
12680#define _(args) ()
12681#endif
12682EOCP
12683echo "$foo" >> try.c
12684echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12685$cc $optimize $ccflags -c try.c > /dev/null 2>&1
12686status=$?
12687$rm -f try.[co]
12688exit $status
12689EOSH
12690chmod +x protochk
12691$eunicefix protochk
12692
dfe9444c 12693: see what type is used for size_t
dc45a647 12694rp="What is the type used for the length parameter for string functions?"
dfe9444c 12695set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 12696eval $typedef_ask
dfe9444c
AD
12697
12698: check for type of arguments to gethostbyaddr.
12699if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12700 case "$d_gethbyaddr" in
12701 $define)
12702 $cat <<EOM
12703
12704Checking to see what type of arguments are accepted by gethostbyaddr().
12705EOM
12706 hdrs="$define sys/types.h
12707 $d_socket sys/socket.h
12708 $i_niin netinet/in.h
12709 $i_netdb netdb.h
12710 $i_unistd unistd.h"
12711 : The first arg can 'char *' or 'void *'
12712 : The second arg is some of integral type
12713 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12714 for yyy in size_t long int; do
12715 case "$netdb_host_type" in
12716 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12717 if ./protochk "$try" $hdrs; then
12718 echo "Your system accepts $xxx for the first arg."
12719 echo "...and $yyy for the second arg."
12720 netdb_host_type="$xxx"
12721 netdb_hlen_type="$yyy"
12722 fi
12723 ;;
12724 esac
12725 done
12726 done
12727 : In case none of those worked, prompt the user.
12728 case "$netdb_host_type" in
12729 '') rp='What is the type for the 1st argument to gethostbyaddr?'
12730 dflt='char *'
12731 . ./myread
12732 netdb_host_type=$ans
12733 rp='What is the type for the 2nd argument to gethostbyaddr?'
12734 dflt="$sizetype"
12735 . ./myread
12736 netdb_hlen_type=$ans
12737 ;;
12738 esac
12739 ;;
12740 *) : no gethostbyaddr, so pick harmless defaults
12741 netdb_host_type='char *'
12742 netdb_hlen_type="$sizetype"
12743 ;;
12744 esac
12745 # Remove the "const" if needed. -- but then we'll have a
12746 # prototype clash!
12747 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12748fi
12749
12750: check for type of argument to gethostbyname.
12751if test "X$netdb_name_type" = X ; then
12752 case "$d_gethbyname" in
12753 $define)
12754 $cat <<EOM
12755
12756Checking to see what type of argument is accepted by gethostbyname().
12757EOM
12758 hdrs="$define sys/types.h
12759 $d_socket sys/socket.h
12760 $i_niin netinet/in.h
12761 $i_netdb netdb.h
12762 $i_unistd unistd.h"
12763 for xxx in "const char *" "char *"; do
12764 case "$netdb_name_type" in
12765 '') try="extern struct hostent *gethostbyname($xxx);"
12766 if ./protochk "$try" $hdrs; then
12767 echo "Your system accepts $xxx."
12768 netdb_name_type="$xxx"
12769 fi
12770 ;;
12771 esac
12772 done
12773 : In case none of those worked, prompt the user.
12774 case "$netdb_name_type" in
12775 '') rp='What is the type for the 1st argument to gethostbyname?'
12776 dflt='char *'
12777 . ./myread
12778 netdb_name_type=$ans
12779 ;;
12780 esac
12781 ;;
12782 *) : no gethostbyname, so pick harmless default
12783 netdb_name_type='char *'
12784 ;;
12785 esac
12786fi
8ff267be 12787
dfe9444c
AD
12788: check for type of 1st argument to getnetbyaddr.
12789if test "X$netdb_net_type" = X ; then
12790 case "$d_getnbyaddr" in
12791 $define)
12792 $cat <<EOM
85e6fe83 12793
dfe9444c
AD
12794Checking to see what type of 1st argument is accepted by getnetbyaddr().
12795EOM
12796 hdrs="$define sys/types.h
12797 $d_socket sys/socket.h
12798 $i_niin netinet/in.h
12799 $i_netdb netdb.h
12800 $i_unistd unistd.h"
12801 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12802 case "$netdb_net_type" in
12803 '') try="extern struct netent *getnetbyaddr($xxx, int);"
12804 if ./protochk "$try" $hdrs; then
12805 echo "Your system accepts $xxx."
12806 netdb_net_type="$xxx"
12807 fi
12808 ;;
12809 esac
12810 done
12811 : In case none of those worked, prompt the user.
12812 case "$netdb_net_type" in
12813 '') rp='What is the type for the 1st argument to getnetbyaddr?'
12814 dflt='long'
12815 . ./myread
12816 netdb_net_type=$ans
12817 ;;
12818 esac
12819 ;;
12820 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 12821 netdb_net_type='long'
dfe9444c
AD
12822 ;;
12823 esac
12824fi
2c7991dc 12825: locate the preferred pager for this system
12826case "$pager" in
12827'')
12828 dflt=''
12829 case "$pg" in
12830 /*) dflt=$pg;;
12831 esac
12832 case "$more" in
12833 /*) dflt=$more;;
12834 esac
12835 case "$less" in
12836 /*) dflt=$less;;
12837 esac
12838 case "$dflt" in
12839 '') dflt=/usr/ucb/more;;
12840 esac
12841 ;;
12842*) dflt="$pager";;
12843esac
12844echo " "
12845fn=f/
12846rp='What pager is used on your system?'
12847. ./getfile
12848pager="$ans"
12849
dfe9444c 12850: see what type pids are declared as in the kernel
dc45a647 12851rp="What is the type of process ids on this system?"
dfe9444c 12852set pid_t pidtype int stdio.h sys/types.h
dc45a647 12853eval $typedef_ask
2304df62 12854
693762b4
AD
12855: check for length of pointer
12856echo " "
12857case "$ptrsize" in
12858'')
dc45a647 12859 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
12860 if test "$voidflags" -gt 7; then
12861 echo '#define VOID_PTR char *' > try.c
12862 else
12863 echo '#define VOID_PTR void *' > try.c
12864 fi
12865 $cat >>try.c <<'EOCP'
12866#include <stdio.h>
d674cd6d 12867int main()
693762b4 12868{
213c275f 12869 printf("%d\n", (int)sizeof(VOID_PTR));
14e4fe40 12870 exit(0);
693762b4
AD
12871}
12872EOCP
12873 set try
dc45a647 12874 if eval $compile_ok; then
693762b4 12875 ptrsize=`./try`
dc45a647 12876 $echo " $ptrsize bytes." >&4
693762b4
AD
12877 else
12878 dflt='4'
12879 echo "(I can't seem to compile the test program. Guessing...)" >&4
12880 rp="What is the size of a pointer (in bytes)?"
12881 . ./myread
12882 ptrsize="$ans"
12883 fi
12884 ;;
12885esac
12886$rm -f try.c try
12887
a0d0e21e
LW
12888: see if ar generates random libraries by itself
12889echo " "
12890echo "Checking how to generate random libraries on your machine..." >&4
12891echo 'int bar1() { return bar2(); }' > bar1.c
12892echo 'int bar2() { return 2; }' > bar2.c
12893$cat > foo.c <<'EOP'
d674cd6d 12894int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
12895EOP
12896$cc $ccflags -c bar1.c >/dev/null 2>&1
12897$cc $ccflags -c bar2.c >/dev/null 2>&1
12898$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
12899$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12900if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12901 ./foobar >/dev/null 2>&1; then
4e2a5f63 12902 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
12903 orderlib=false
12904 ranlib=":"
dfe9444c
AD
12905elif $ar ts bar$_a >/dev/null 2>&1 &&
12906 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12907 ./foobar >/dev/null 2>&1; then
4e2a5f63 12908 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 12909 orderlib=false
dfe9444c 12910 ranlib="$ar ts"
a0d0e21e 12911else
ecfc5424
AD
12912 case "$ranlib" in
12913 :) ranlib='';;
12914 '')
12915 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12916 $test -f $ranlib || ranlib=''
12917 ;;
12918 esac
a0d0e21e 12919 if $test -n "$ranlib"; then
ecfc5424 12920 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
12921 orderlib=false
12922 else
12923 echo "your system doesn't seem to support random libraries"
12924 echo "so we'll use lorder and tsort to order the libraries."
12925 orderlib=true
12926 ranlib=":"
12927 fi
12928fi
12929$rm -f foo* bar*
12930
dfe9444c
AD
12931: check for type of arguments to select.
12932case "$selecttype" in
12933'') case "$d_select" in
12934 $define)
cce08f5b 12935 echo " "
dfe9444c
AD
12936 $cat <<EOM
12937Checking to see what type of arguments are accepted by select().
12938EOM
12939 hdrs="$define sys/types.h
12940 $i_systime sys/time.h
12941 $i_sysselct sys/select.h
12942 $d_socket sys/socket.h"
12943 : The first arg can be int, unsigned, or size_t
12944 : The last arg may or may not be 'const'
12945 val=''
7f3d1cf1
BH
12946 : void pointer has been seen but using that
12947 : breaks the selectminbits test
12948 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 12949 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
12950 for tmo in 'struct timeval *' 'const struct timeval *'; do
12951 case "$val" in
12952 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12953 if ./protochk "$try" $hdrs; then
12954 echo "Your system accepts $xxx."
12955 val="$xxx"
12956 fi
12957 ;;
12958 esac
12959 done
12960 done
12961 done
12962 case "$val" in
12963 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12964 case "$d_fd_set" in
12965 $define) dflt="fd_set *" ;;
12966 *) dflt="int *" ;;
12967 esac
12968 . ./myread
12969 val=$ans
12970 ;;
a0d0e21e 12971 esac
dfe9444c 12972 selecttype="$val"
a0d0e21e 12973 ;;
dfe9444c
AD
12974 *) : no select, so pick a harmless default
12975 selecttype='int *'
a0d0e21e
LW
12976 ;;
12977 esac
a0d0e21e
LW
12978 ;;
12979esac
2304df62 12980
5ff3f7a4
GS
12981: check for the select 'width'
12982case "$selectminbits" in
12983'') case "$d_select" in
12984 $define)
12985 $cat <<EOM
12986
85ab1d1d 12987Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
12988EOM
12989 $cat >try.c <<EOCP
12990#include <sys/types.h>
12991#$i_time I_TIME
12992#$i_systime I_SYS_TIME
12993#$i_systimek I_SYS_TIME_KERNEL
12994#ifdef I_TIME
12995# include <time.h>
12996#endif
12997#ifdef I_SYS_TIME
12998# ifdef I_SYS_TIME_KERNEL
12999# define KERNEL
13000# endif
13001# include <sys/time.h>
13002# ifdef I_SYS_TIME_KERNEL
13003# undef KERNEL
13004# endif
13005#endif
13006#$i_sysselct I_SYS_SELECT
13007#ifdef I_SYS_SELECT
13008#include <sys/select.h>
13009#endif
bd628c73
AD
13010#$d_socket HAS_SOCKET
13011#ifdef HAS_SOCKET
13012# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13013#endif
5ff3f7a4 13014#include <stdio.h>
fb164848
JH
13015$selecttype b;
13016#define S sizeof(*(b))
5ff3f7a4
GS
13017#define MINBITS 64
13018#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13019#define NBITS (NBYTES * 8)
13020int main() {
13021 char s[NBYTES];
5ff3f7a4
GS
13022 struct timeval t;
13023 int i;
13024 FILE* fp;
13025 int fd;
13026
13027 fclose(stdin);
13028 fp = fopen("try.c", "r");
13029 if (fp == 0)
13030 exit(1);
13031 fd = fileno(fp);
13032 if (fd < 0)
13033 exit(2);
13034 b = ($selecttype)s;
13035 for (i = 0; i < NBITS; i++)
13036 FD_SET(i, b);
13037 t.tv_sec = 0;
13038 t.tv_usec = 0;
13039 select(fd + 1, b, 0, 0, &t);
13040 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13041 printf("%d\n", i + 1);
13042 return 0;
13043}
13044EOCP
13045 set try
13046 if eval $compile_ok; then
13047 selectminbits=`./try`
85ab1d1d 13048 case "$selectminbits" in
fb164848
JH
13049 '') cat >&4 <<EOM
13050Cannot figure out on how many bits at a time your select() operates.
13051I'll play safe and guess it is 32 bits.
13052EOM
13053 selectminbits=32
13054 bits="32 bits"
13055 ;;
85ab1d1d
JH
13056 1) bits="1 bit" ;;
13057 *) bits="$selectminbits bits" ;;
13058 esac
13059 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
13060 else
13061 rp='What is the minimum number of bits your select() operates on?'
13062 case "$byteorder" in
13063 1234|12345678) dflt=32 ;;
13064 *) dflt=1 ;;
13065 esac
13066 . ./myread
13067 val=$ans
13068 selectminbits="$val"
13069 fi
13070 $rm -f try.* try
13071 ;;
13072 *) : no select, so pick a harmless default
13073 selectminbits='32'
13074 ;;
13075 esac
13076 ;;
13077esac
13078
8e07c86e
AD
13079: Trace out the files included by signal.h, then look for SIGxxx names.
13080: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
13081: Remove SIGSTKSIZE used by Linux.
13082: Remove SIGSTKSZ used by Posix.
4633a7c4 13083: Remove SIGTYP void lines used by OS2.
6764938d 13084: Some cpps, like os390, dont give the file name anywhere
53d4e464 13085if [ "X$fieldn" = X ]; then
6764938d
GS
13086 : Just make some guesses. We check them later.
13087 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
53d4e464 13088else
6764938d 13089 xxx=`echo '#include <signal.h>' |
8e07c86e
AD
13090 $cppstdin $cppminus $cppflags 2>/dev/null |
13091 $grep '^[ ]*#.*include' |
13092 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
53d4e464 13093fi
8e07c86e
AD
13094: Check this list of files to be sure we have parsed the cpp output ok.
13095: This will also avoid potentially non-existent files, such
13096: as ../foo/bar.h
13097xxxfiles=''
13098for xx in $xxx /dev/null ; do
13099 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13100done
13101: If we have found no files, at least try signal.h
13102case "$xxxfiles" in
13103'') xxxfiles=`./findhdr signal.h` ;;
13104esac
13105xxx=`awk '
af4c28eb 13106$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
13107 print substr($2, 4, 20)
13108}
4633a7c4 13109$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
13110 print substr($3, 4, 20)
13111}' $xxxfiles`
13112: Append some common names just in case the awk scan failed.
6764938d
GS
13113xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13114xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13115xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13116xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13117xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13118
8e07c86e 13119: generate a few handy files for later
dc45a647 13120$cat > signal.c <<'EOCP'
4633a7c4
LW
13121#include <sys/types.h>
13122#include <signal.h>
dc45a647 13123#include <stdio.h>
4633a7c4 13124int main() {
760ac839
LW
13125
13126/* Strange style to avoid deeply-nested #if/#else/#endif */
13127#ifndef NSIG
13128# ifdef _NSIG
13129# define NSIG (_NSIG)
13130# endif
13131#endif
13132
13133#ifndef NSIG
13134# ifdef SIGMAX
13135# define NSIG (SIGMAX+1)
13136# endif
13137#endif
13138
13139#ifndef NSIG
13140# ifdef SIG_MAX
13141# define NSIG (SIG_MAX+1)
13142# endif
13143#endif
13144
13145#ifndef NSIG
13146# ifdef MAXSIG
13147# define NSIG (MAXSIG+1)
13148# endif
4633a7c4 13149#endif
760ac839
LW
13150
13151#ifndef NSIG
13152# ifdef MAX_SIG
13153# define NSIG (MAX_SIG+1)
13154# endif
13155#endif
13156
13157#ifndef NSIG
13158# ifdef SIGARRAYSIZE
13159# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13160# endif
13161#endif
13162
13163#ifndef NSIG
13164# ifdef _sys_nsig
13165# define NSIG (_sys_nsig) /* Solaris 2.5 */
13166# endif
13167#endif
13168
13169/* Default to some arbitrary number that's big enough to get most
13170 of the common signals.
13171*/
13172#ifndef NSIG
13173# define NSIG 50
4633a7c4 13174#endif
760ac839
LW
13175
13176printf("NSIG %d\n", NSIG);
13177
dc45a647
MB
13178#ifndef JUST_NSIG
13179
13180EOCP
13181
28e8609d 13182echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
13183{
13184 printf "#ifdef SIG"; printf $1; printf "\n"
13185 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13186 printf $1; printf ");\n"
13187 printf "#endif\n"
2304df62 13188}
2304df62 13189END {
dc45a647 13190 printf "#endif /* JUST_NSIG */\n";
14e4fe40 13191 printf "exit(0);\n}\n";
2304df62 13192}
4633a7c4
LW
13193' >>signal.c
13194$cat >signal.awk <<'EOP'
13195BEGIN { ndups = 0 }
13196$1 ~ /^NSIG$/ { nsig = $2 }
13197($1 !~ /^NSIG$/) && (NF == 2) {
13198 if ($2 > maxsig) { maxsig = $2 }
13199 if (sig_name[$2]) {
13200 dup_name[ndups] = $1
13201 dup_num[ndups] = $2
13202 ndups++
13203 }
13204 else {
13205 sig_name[$2] = $1
13206 sig_num[$2] = $2
13207 }
4633a7c4
LW
13208}
13209END {
af4c28eb
CS
13210 if (nsig == 0) {
13211 nsig = maxsig + 1
13212 }
13213 printf("NSIG %d\n", nsig);
13214 for (n = 1; n < nsig; n++) {
13215 if (sig_name[n]) {
13216 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 13217 }
af4c28eb
CS
13218 else {
13219 printf("NUM%d %d\n", n, n)
13220 }
13221 }
4633a7c4 13222 for (n = 0; n < ndups; n++) {
af4c28eb 13223 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
13224 }
13225}
13226EOP
13227$cat >signal_cmd <<EOS
8e07c86e 13228$startsh
dc45a647
MB
13229if $test -s signal.lst; then
13230 echo "Using your existing signal.lst file"
13231 exit 0
13232fi
13233xxx="$xxx"
13234EOS
13235$cat >>signal_cmd <<'EOS'
13236
13237set signal
13238if eval $compile_ok; then
dfe9444c 13239 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 13240else
dc45a647
MB
13241 echo "(I can't seem be able to compile the whole test program)" >&4
13242 echo "(I'll try it in little pieces.)" >&4
13243 set signal -DJUST_NSIG
13244 if eval $compile_ok; then
13245 ./signal$_exe > signal.nsg
13246 $cat signal.nsg
13247 else
13248 echo "I can't seem to figure out how many signals you have." >&4
13249 echo "Guessing 50." >&4
13250 echo 'NSIG 50' > signal.nsg
13251 fi
13252 : Now look at all the signal names, one at a time.
28e8609d 13253 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
13254 $cat > signal.c <<EOCP
13255#include <sys/types.h>
13256#include <signal.h>
13257#include <stdio.h>
13258int main() {
13259printf("$xx %d\n", SIG${xx});
13260return 0;
13261}
13262EOCP
13263 set signal
13264 if eval $compile; then
13265 echo "SIG${xx} found."
13266 ./signal$_exe >> signal.ls1
13267 else
13268 echo "SIG${xx} NOT found."
13269 fi
13270 done
13271 if $test -s signal.ls1; then
13272 $cat signal.nsg signal.ls1 |
13273 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13274 fi
13275
13276fi
13277if $test -s signal.lst; then
13278 :
13279else
13280 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 13281 echo 'kill -l' >signal
dc45a647 13282 set X `csh -f <signal`
8e07c86e 13283 $rm -f signal
2304df62 13284 shift
dc45a647 13285 case $# in
8e07c86e 13286 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 13287 esac
28e8609d 13288 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
13289 $awk '{ printf "%s %d\n", $1, ++s; }
13290 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 13291fi
dc45a647 13292$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 13293EOS
4633a7c4
LW
13294chmod a+x signal_cmd
13295$eunicefix signal_cmd
8e07c86e
AD
13296
13297: generate list of signal names
13298echo " "
dfe9444c 13299case "$sig_name_init" in
6626bf4c
JH
13300'') doinit=yes ;;
13301*) case "$sig_num_init" in
13302 ''|*,*) doinit=yes ;;
13303 esac ;;
13304esac
13305case "$doinit" in
13306yes)
4633a7c4 13307 echo "Generating a list of signal names and numbers..." >&4
dc45a647 13308 . ./signal_cmd
af4c28eb
CS
13309 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13310 sig_name=`$awk 'BEGIN { printf "ZERO " }
13311 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13312 sig_num=`$awk 'BEGIN { printf "0 " }
13313 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13314 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
13315 !/^NSIG/ { printf "\"%s\", ", $1 }
13316 END { printf "0\n" }' signal.lst`
13317 sig_num_init=`$awk 'BEGIN { printf "0, " }
13318 !/^NSIG/ { printf "%d, ", $2}
13319 END { printf "0\n"}' signal.lst`
13320 ;;
13321esac
13322echo "The following $sig_count signals are available:"
a0d0e21e
LW
13323echo " "
13324echo $sig_name | $awk \
13325'BEGIN { linelen = 0 }
13326{
8e07c86e 13327 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
13328 name = "SIG" $i " "
13329 linelen = linelen + length(name)
13330 if (linelen > 70) {
13331 printf "\n"
13332 linelen = length(name)
13333 }
13334 printf "%s", name
13335 }
8e07c86e 13336 printf "\n"
a0d0e21e 13337}'
4633a7c4 13338$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 13339
a0d0e21e
LW
13340: see what type is used for signed size_t
13341set ssize_t ssizetype int stdio.h sys/types.h
13342eval $typedef
13343dflt="$ssizetype"
13344$cat > ssize.c <<EOM
13345#include <stdio.h>
13346#include <sys/types.h>
13347#define Size_t $sizetype
13348#define SSize_t $dflt
d674cd6d 13349int main()
a0d0e21e
LW
13350{
13351 if (sizeof(Size_t) == sizeof(SSize_t))
13352 printf("$dflt\n");
13353 else if (sizeof(Size_t) == sizeof(int))
13354 printf("int\n");
13355 else
13356 printf("long\n");
760ac839 13357 exit(0);
a0d0e21e
LW
13358}
13359EOM
13360echo " "
dfe9444c 13361set ssize
dc45a647 13362if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 13363 ssizetype=`./ssize`
a0d0e21e
LW
13364 echo "I'll be using $ssizetype for functions returning a byte count." >&4
13365else
24fef2a7 13366 $cat >&4 <<EOM
24fef2a7
AD
13367Help! I can't compile and run the ssize_t test program: please enlighten me!
13368(This is probably a misconfiguration in your system or libraries, and
13369you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
13370
13371I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 13372be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
13373
13374EOM
13375 rp="What signed type is the same size as $sizetype?"
13376 . ./myread
13377 ssizetype="$ans"
13378fi
dfe9444c 13379$rm -f ssize ssize.*
3fd537d4 13380
a0d0e21e
LW
13381: see what type of char stdio uses.
13382echo " "
13383if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13384 echo "Your stdio uses unsigned chars." >&4
13385 stdchar="unsigned char"
13386else
13387 echo "Your stdio uses signed chars." >&4
13388 stdchar="char"
13389fi
13390
13391: see if time exists
13392echo " "
28e8609d
JH
13393if test "X$d_time" = X -o X"$timetype" = X; then
13394 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
13395 echo 'time() found.' >&4
13396 val="$define"
13397 rp="What is the type returned by time() on this system?"
13398 set time_t timetype long stdio.h sys/types.h
13399 eval $typedef_ask
28e8609d 13400 else
5ff3f7a4
GS
13401 echo 'time() not found, hope that will do.' >&4
13402 val="$undef"
13403 timetype='int';
28e8609d
JH
13404 fi
13405 set d_time
13406 eval $setvar
a0d0e21e 13407fi
a0d0e21e
LW
13408
13409: see what type uids are declared as in the kernel
dc45a647
MB
13410echo " "
13411echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
13412set uid_t uidtype xxx stdio.h sys/types.h
13413eval $typedef
13414case "$uidtype" in
13415xxx)
13416 xxx=`./findhdr sys/user.h`
13417 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13418 case $1 in
13419 unsigned) dflt="$1 $2" ;;
13420 *) dflt="$1" ;;
13421 esac
13422 ;;
4633a7c4
LW
13423*) dflt="$uidtype";;
13424esac
dc45a647
MB
13425case "$uidtype" in
13426uid_t) echo "uid_t found." ;;
13427*) rp="What is the type for user ids returned by getuid()?"
13428 . ./myread
13429 uidtype="$ans"
13430 ;;
13431esac
4633a7c4 13432
57def98f
JH
13433echo " "
13434case "$uidtype" in
13435*_t) zzz="$uidtype" ;;
13436*) zzz="uid" ;;
13437esac
a22e52b9 13438echo "Checking the size of $zzz..." >&4
57def98f
JH
13439cat > try.c <<EOCP
13440#include <sys/types.h>
13441#include <stdio.h>
13442int main() {
213c275f 13443 printf("%d\n", (int)sizeof($uidtype));
14e4fe40 13444 exit(0);
57def98f
JH
13445}
13446EOCP
d4265146 13447set try
a22e52b9 13448if eval $compile_ok; then
57def98f
JH
13449 yyy=`./try`
13450 case "$yyy" in
a22e52b9
JH
13451 '') uidsize=4
13452 echo "(I can't execute the test program--guessing $uidsize.)" >&4
57def98f 13453 ;;
a22e52b9
JH
13454 *) uidsize=$yyy
13455 echo "Your $zzz size is $uidsize bytes."
57def98f
JH
13456 ;;
13457 esac
13458else
a22e52b9
JH
13459 uidsize=4
13460 echo "(I can't compile the test program--guessing $uidsize.)" >&4
57def98f
JH
13461fi
13462
785fb66b
JH
13463echo " "
13464case "$uidtype" in
13465*_t) zzz="$uidtype" ;;
13466*) zzz="uid" ;;
13467esac
a22e52b9 13468echo "Checking the sign of $zzz..." >&4
785fb66b
JH
13469cat > try.c <<EOCP
13470#include <sys/types.h>
13471#include <stdio.h>
13472int main() {
a22e52b9
JH
13473 $uidtype foo = -1;
13474 if (foo < 0)
13475 printf("-1\n");
13476 else
13477 printf("1\n");
785fb66b
JH
13478}
13479EOCP
13480set try
a22e52b9 13481if eval $compile; then
785fb66b
JH
13482 yyy=`./try`
13483 case "$yyy" in
a22e52b9
JH
13484 '') uidsign=1
13485 echo "(I can't execute the test program--guessing unsigned.)" >&4
785fb66b 13486 ;;
a22e52b9
JH
13487 *) uidsign=$yyy
13488 case "$uidsign" in
13489 1) echo "Your $zzz is unsigned." ;;
13490 -1) echo "Your $zzz is signed." ;;
13491 esac
785fb66b
JH
13492 ;;
13493 esac
13494else
a22e52b9
JH
13495 uidsign=1
13496 echo "(I can't compile the test program--guessing unsigned.)" >&4
785fb66b
JH
13497fi
13498
a22e52b9
JH
13499
13500
13501echo " "
13502$echo "Checking the format string to be used for uids..." >&4
13503
13504case "$uidsign" in
13505-1) if $test X"$uidsize" = X"$ivsize"; then
13506 uidformat="$ivdformat"
13507 else
13508 if $test X"$uidsize" = X"$longsize"; then
13509 uidformat='"ld"'
13510 else
13511 if $test X"$uidsize" = X"$intsize"; then
13512 uidformat='"d"'
13513 else
13514 if $test X"$uidsize" = X"$shortsize"; then
13515 uidformat='"hd"'
13516 fi
13517 fi
13518 fi
13519 fi
13520 ;;
13521*) if $test X"$uidsize" = X"$uvsize"; then
13522 uidformat="$uvuformat"
13523 else
13524 if $test X"$uidsize" = X"$longsize"; then
13525 uidformat='"lu"'
13526 else
13527 if $test X"$uidsize" = X"$intsize"; then
13528 uidformat='"u"'
13529 else
13530 if $test X"$uidsize" = X"$shortsize"; then
13531 uidformat='"hu"'
13532 fi
13533 fi
13534 fi
13535 fi
13536 ;;
13537esac
13538
4633a7c4
LW
13539: see if dbm.h is available
13540: see if dbmclose exists
13541set dbmclose d_dbmclose
13542eval $inlibc
13543
13544case "$d_dbmclose" in
13545$define)
13546 set dbm.h i_dbm
13547 eval $inhdr
5f80c64f
JH
13548 case "$i_dbm" in
13549 $define)
13550 val="$undef"
13551 set i_rpcsvcdbm
13552 eval $setvar
13553 ;;
13554 *) set rpcsvc/dbm.h i_rpcsvcdbm
13555 eval $inhdr
13556 ;;
13557 esac
13558 ;;
13559*) echo "We won't be including <dbm.h>"
13560 val="$undef"
13561 set i_dbm
13562 eval $setvar
13563 val="$undef"
13564 set i_rpcsvcdbm
13565 eval $setvar
13566 ;;
13567esac
13568
13569: see if this is a sys/file.h system
13570val=''
13571set sys/file.h val
13572eval $inhdr
13573
13574: do we need to include sys/file.h ?
13575case "$val" in
13576"$define")
13577 echo " "
13578 if $h_sysfile; then
13579 val="$define"
13580 echo "We'll be including <sys/file.h>." >&4
13581 else
13582 val="$undef"
13583 echo "We won't be including <sys/file.h>." >&4
13584 fi
13585 ;;
13586*)
13587 h_sysfile=false
13588 ;;
13589esac
13590set i_sysfile
13591eval $setvar
13592
13593: see if fcntl.h is there
13594val=''
13595set fcntl.h val
13596eval $inhdr
13597
13598: see if we can include fcntl.h
13599case "$val" in
13600"$define")
13601 echo " "
13602 if $h_fcntl; then
13603 val="$define"
13604 echo "We'll be including <fcntl.h>." >&4
13605 else
13606 val="$undef"
13607 if $h_sysfile; then
13608 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13609 else
13610 echo "We won't be including <fcntl.h>." >&4
13611 fi
13612 fi
13613 ;;
13614*)
13615 h_fcntl=false
13616 val="$undef"
13617 ;;
13618esac
13619set i_fcntl
13620eval $setvar
13621
13622: see if locale.h is available
13623set locale.h i_locale
13624eval $inhdr
13625
7f3d1cf1 13626: see if mach cthreads are available
13666627
JH
13627if test "X$usethreads" = "X$define"; then
13628 set mach/cthreads.h i_machcthr
13629 eval $inhdr
13630else
13631 i_machcthr="$undef"
13632fi
13633
13634
7f3d1cf1 13635
5f80c64f
JH
13636: see if this is a math.h system
13637set math.h i_math
13638eval $inhdr
13639
e7fb4fcc
JH
13640: see if this is a mntent.h system
13641set mntent.h i_mntent
13642eval $inhdr
13643
5f80c64f
JH
13644: see if ndbm.h is available
13645set ndbm.h t_ndbm
13646eval $inhdr
13647case "$t_ndbm" in
13648$define)
13649 : see if dbm_open exists
13650 set dbm_open d_dbm_open
13651 eval $inlibc
13652 case "$d_dbm_open" in
13653 $undef)
13654 t_ndbm="$undef"
13655 echo "We won't be including <ndbm.h>"
13656 ;;
13657 esac
13658 ;;
13659esac
13660val="$t_ndbm"
13661set i_ndbm
13662eval $setvar
13663
13664: see if net/errno.h is available
13665val=''
13666set net/errno.h val
13667eval $inhdr
13668
13669: Unfortunately, it causes problems on some systems. Arrgh.
13670case "$val" in
13671$define)
13672 cat > try.c <<'EOM'
13673#include <stdio.h>
13674#include <errno.h>
13675#include <net/errno.h>
13676int func()
13677{
13678 return ENOTSOCK;
13679}
13680EOM
13681 if $cc $ccflags -c try.c >/dev/null 2>&1; then
13682 echo "We'll be including <net/errno.h>." >&4
13683 else
13684 echo "We won't be including <net/errno.h>." >&4
13685 val="$undef"
13686 fi
13687 $rm -f try.* try
13688 ;;
13689esac
13690set i_neterrno
13691eval $setvar
13692
9cc6feab
JH
13693: see if netinet/tcp.h is available
13694set netinet/tcp.h i_netinettcp
13695eval $inhdr
13696
5b34fd99
JH
13697: see if this is a poll.h system
13698set poll.h i_poll
13699eval $inhdr
13700
5f80c64f
JH
13701: get C preprocessor symbols handy
13702echo " "
13703$echo $n "Hmm... $c"
13704echo $al | $tr ' ' $trnl >Cppsym.know
13705$cat <<EOSS >Cppsym
13706$startsh
13707case "\$1" in
13708-l) list=true
13709 shift
13710 ;;
13711esac
13712unknown=''
13713case "\$list\$#" in
137141|2)
13715 for sym do
13716 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13717 exit 0
13718 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13719 :
13720 else
13721 unknown="\$unknown \$sym"
13722 fi
13723 done
13724 set X \$unknown
13725 shift
13726 ;;
13727esac
13728case \$# in
137290) exit 1;;
13730esac
13731echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13732#ifdef \1\\
13733exit 0; _ _ _ _\1\\ \1\\
13734#endif\\
13735/' >Cppsym\$\$
13736echo "exit 1; _ _ _" >>Cppsym\$\$
13737$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
13738case "\$list" in
13739true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13740*)
13741 sh Cppsym2\$\$
13742 status=\$?
13743 ;;
13744esac
13745$rm -f Cppsym\$\$ Cppsym2\$\$
13746exit \$status
13747EOSS
13748chmod +x Cppsym
13749$eunicefix Cppsym
13750./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13751
13752: now check the C compiler for additional symbols
c4747d3e
JH
13753postprocess_cc_v=''
13754case "$osname" in
13755aix) postprocess_cc_v="|$tr , ' '" ;;
13756esac
5f80c64f
JH
13757$cat >ccsym <<EOS
13758$startsh
13759$cat >tmp.c <<EOF
13760extern int foo;
13761EOF
c4747d3e 13762for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
13763do
13764 case "\$i" in
13765 -D*) echo "\$i" | $sed 's/^-D//';;
13766 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13767 esac
13768done
13769$rm -f try.c
13770EOS
2000072c 13771postprocess_cc_v=''
5f80c64f
JH
13772chmod +x ccsym
13773$eunicefix ccsym
13774./ccsym > ccsym1.raw
13775if $test -s ccsym1.raw; then
13776 $sort ccsym1.raw | $uniq >ccsym.raw
13777else
13778 mv ccsym1.raw ccsym.raw
13779fi
13780
13781$awk '/\=/ { print $0; next }
13782 { print $0"=1" }' ccsym.raw >ccsym.list
13783$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13784$comm -13 ccsym.true ccsym.list >ccsym.own
13785$comm -12 ccsym.true ccsym.list >ccsym.com
13786$comm -23 ccsym.true ccsym.list >ccsym.cpp
13787also=''
5f80c64f 13788if $test -z ccsym.raw; then
ff49bff8 13789 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 13790 echo " "
ff49bff8 13791 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 13792 $cat Cppsym.true
ff49bff8
JH
13793 ccsymbols=''
13794 cppsymbols=`$cat Cppsym.true`
918c3d21 13795 cppsymbols=`echo $cppsymbols`
ff49bff8 13796 cppccsymbols="$cppsymbols"
5f80c64f
JH
13797else
13798 if $test -s ccsym.com; then
13799 echo "Your C compiler and pre-processor define these symbols:"
13800 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13801 also='also '
13802 symbols='ones'
ff49bff8 13803 cppccsymbols=`$cat ccsym.com`
918c3d21 13804 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
13805 $test "$silent" || sleep 1
13806 fi
13807 if $test -s ccsym.cpp; then
13808 $test "$also" && echo " "
ff49bff8 13809 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
13810 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13811 also='further '
ff49bff8 13812 cppsymbols=`$cat ccsym.cpp`
918c3d21 13813 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
13814 $test "$silent" || sleep 1
13815 fi
13816 if $test -s ccsym.own; then
13817 $test "$also" && echo " "
ff49bff8 13818 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
13819 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13820 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 13821 ccsymbols=`$cat ccsym.own`
918c3d21 13822 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
13823 $test "$silent" || sleep 1
13824 fi
13825fi
13826$rm -f ccsym*
13827
13828: see if this is a termio system
13829val="$undef"
13830val2="$undef"
13831val3="$undef"
13832if $test `./findhdr termios.h`; then
13833 set tcsetattr i_termios
13834 eval $inlibc
13835 val3="$i_termios"
13836fi
13837echo " "
13838case "$val3" in
13839"$define") echo "You have POSIX termios.h... good!" >&4;;
13840*) if ./Cppsym pyr; then
13841 case "`/bin/universe`" in
13842 ucb) if $test `./findhdr sgtty.h`; then
13843 val2="$define"
13844 echo "<sgtty.h> found." >&4
13845 else
13846 echo "System is pyramid with BSD universe."
13847 echo "<sgtty.h> not found--you could have problems." >&4
13848 fi;;
13849 *) if $test `./findhdr termio.h`; then
13850 val="$define"
13851 echo "<termio.h> found." >&4
13852 else
13853 echo "System is pyramid with USG universe."
13854 echo "<termio.h> not found--you could have problems." >&4
13855 fi;;
13856 esac
13857 elif ./usg; then
13858 if $test `./findhdr termio.h`; then
13859 echo "<termio.h> found." >&4
13860 val="$define"
13861 elif $test `./findhdr sgtty.h`; then
13862 echo "<sgtty.h> found." >&4
13863 val2="$define"
13864 else
13865echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13866 fi
13867 else
13868 if $test `./findhdr sgtty.h`; then
13869 echo "<sgtty.h> found." >&4
13870 val2="$define"
13871 elif $test `./findhdr termio.h`; then
13872 echo "<termio.h> found." >&4
13873 val="$define"
13874 else
13875echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13876 fi
13877 fi;;
13878esac
13879set i_termio; eval $setvar
13880val=$val2; set i_sgtty; eval $setvar
13881val=$val3; set i_termios; eval $setvar
13882
f1066039
JH
13883: see if this is a shadow.h system
13884set shadow.h i_shadow
13885eval $inhdr
13886
86959918
JH
13887: see if this is a socks.h system
13888set socks.h i_socks
13889eval $inhdr
13890
5f80c64f
JH
13891: see if stdarg is available
13892echo " "
13893if $test `./findhdr stdarg.h`; then
13894 echo "<stdarg.h> found." >&4
13895 valstd="$define"
13896else
13897 echo "<stdarg.h> NOT found." >&4
13898 valstd="$undef"
13899fi
13900
13901: see if varags is available
13902echo " "
13903if $test `./findhdr varargs.h`; then
13904 echo "<varargs.h> found." >&4
13905else
13906 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13907fi
13908
13909: set up the varargs testing programs
13910$cat > varargs.c <<EOP
13911#ifdef I_STDARG
13912#include <stdarg.h>
13913#endif
13914#ifdef I_VARARGS
13915#include <varargs.h>
13916#endif
13917
13918#ifdef I_STDARG
13919int f(char *p, ...)
13920#else
13921int f(va_alist)
13922va_dcl
13923#endif
13924{
13925 va_list ap;
13926#ifndef I_STDARG
13927 char *p;
13928#endif
13929#ifdef I_STDARG
13930 va_start(ap,p);
13931#else
13932 va_start(ap);
13933 p = va_arg(ap, char *);
13934#endif
13935 va_end(ap);
13936}
13937EOP
13938$cat > varargs <<EOP
13939$startsh
13940if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13941 echo "true"
13942else
13943 echo "false"
13944fi
13945$rm -f varargs$_o
13946EOP
13947chmod +x varargs
13948
13949: now check which varargs header should be included
13950echo " "
13951i_varhdr=''
13952case "$valstd" in
13953"$define")
13954 if `./varargs I_STDARG`; then
13955 val='stdarg.h'
13956 elif `./varargs I_VARARGS`; then
13957 val='varargs.h'
13958 fi
13959 ;;
13960*)
13961 if `./varargs I_VARARGS`; then
13962 val='varargs.h'
13963 fi
13964 ;;
13965esac
13966case "$val" in
13967'')
13968echo "I could not find the definition for va_dcl... You have problems..." >&4
13969 val="$undef"; set i_stdarg; eval $setvar
13970 val="$undef"; set i_varargs; eval $setvar
13971 ;;
13972*)
13973 set i_varhdr
13974 eval $setvar
13975 case "$i_varhdr" in
13976 stdarg.h)
13977 val="$define"; set i_stdarg; eval $setvar
13978 val="$undef"; set i_varargs; eval $setvar
13979 ;;
13980 varargs.h)
13981 val="$undef"; set i_stdarg; eval $setvar
13982 val="$define"; set i_varargs; eval $setvar
13983 ;;
13984 esac
13985 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13986esac
13987$rm -f varargs*
13988
13989: see if stddef is available
13990set stddef.h i_stddef
13991eval $inhdr
13992
13993: see if sys/access.h is available
13994set sys/access.h i_sysaccess
13995eval $inhdr
13996
13997: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13998set sys/filio.h i_sysfilio
13999eval $inhdr
14000echo " "
14001if $test `./findhdr sys/ioctl.h`; then
14002 val="$define"
14003 echo '<sys/ioctl.h> found.' >&4
14004else
14005 val="$undef"
14006 if $test $i_sysfilio = "$define"; then
14007 echo '<sys/ioctl.h> NOT found.' >&4
14008 else
14009 $test $i_sgtty = "$define" && xxx="sgtty.h"
14010 $test $i_termio = "$define" && xxx="termio.h"
14011 $test $i_termios = "$define" && xxx="termios.h"
14012echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14013 fi
14014fi
14015set i_sysioctl
14016eval $setvar
14017
5f80c64f
JH
14018: see if sys/resource.h has to be included
14019set sys/resource.h i_sysresrc
14020eval $inhdr
14021
14022: see if sys/security.h is available
14023set sys/security.h i_syssecrt
14024eval $inhdr
14025
104d25b7
JH
14026: see if this is a sys/statvfs.h system
14027set sys/statvfs.h i_sysstatvfs
14028eval $inhdr
14029
b7b35fc2
JH
14030: see if this is a sys/uio.h system
14031set sys/uio.h i_sysuio
14032eval $inhdr
14033
5f80c64f
JH
14034: see if this is a sys/un.h system
14035set sys/un.h i_sysun
14036eval $inhdr
14037
14038: see if this is a syswait system
14039set sys/wait.h i_syswait
14040eval $inhdr
14041
0545a864
JH
14042: see if this is a ustat.h system
14043set ustat.h i_ustat
14044eval $inhdr
14045
5f80c64f
JH
14046: see if this is an utime system
14047set utime.h i_utime
14048eval $inhdr
14049
14050: see if this is a values.h system
14051set values.h i_values
14052eval $inhdr
14053
14054: see if this is a vfork system
14055case "$d_vfork" in
14056"$define")
14057 set vfork.h i_vfork
14058 eval $inhdr
14059 ;;
14060*)
14061 i_vfork="$undef"
14062 ;;
14063esac
14064
14065: see if gdbm.h is available
14066set gdbm.h t_gdbm
14067eval $inhdr
14068case "$t_gdbm" in
14069$define)
14070 : see if gdbm_open exists
14071 set gdbm_open d_gdbm_open
14072 eval $inlibc
14073 case "$d_gdbm_open" in
14074 $undef)
14075 t_gdbm="$undef"
14076 echo "We won't be including <gdbm.h>"
14077 ;;
14078 esac
14079 ;;
14080esac
14081val="$t_gdbm"
14082set i_gdbm
14083eval $setvar
14084
14085echo " "
14086echo "Looking for extensions..." >&4
5f80c64f
JH
14087: If we are using the old config.sh, known_extensions may contain
14088: old or inaccurate or duplicate values.
14089known_extensions=''
14090nonxs_extensions=''
14091: We do not use find because it might not be available.
14092: We do not just use MANIFEST because the user may have dropped
14093: some additional extensions into the source tree and expect them
14094: to be built.
7e791ca9
NK
14095
14096: Function to recursively find available extensions, ignoring DynaLoader
14097: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14098find_extensions='
14099 for xxx in *; do
14100 case "$xxx" in
14101 DynaLoader|dynaload) ;;
14102 *)
14103 if $test -f $xxx/$xxx.xs; then
14104 known_extensions="$known_extensions $1$xxx";
14105 elif $test -f $xxx/Makefile.PL; then
14106 nonxs_extensions="$nonxs_extensions $1$xxx";
14107 else
14108 if $test -d $xxx -a $# -lt 10; then
14109 set $1$xxx/ $*;
14110 cd $xxx;
14111 eval $find_extensions;
14112 cd ..;
14113 shift;
9f50e519 14114 fi;
7e791ca9
NK
14115 fi
14116 ;;
9f50e519 14117 esac;
7e791ca9
NK
14118 done'
14119tdir=`pwd`
14120cd $rsrc/ext
a3635516 14121set X
efdb23e1 14122shift
7e791ca9 14123eval $find_extensions
5f80c64f
JH
14124set X $nonxs_extensions
14125shift
14126nonxs_extensions="$*"
14127set X $known_extensions
14128shift
14129known_extensions="$*"
14130cd $tdir
14131
14132: Now see which are supported on this system.
14133avail_ext=''
14134for xxx in $known_extensions ; do
14135 case "$xxx" in
14136 DB_File|db_file)
14137 case "$i_db" in
14138 $define) avail_ext="$avail_ext $xxx" ;;
14139 esac
14140 ;;
14141 GDBM_File|gdbm_fil)
14142 case "$i_gdbm" in
14143 $define) avail_ext="$avail_ext $xxx" ;;
14144 esac
14145 ;;
14146 NDBM_File|ndbm_fil)
14147 case "$i_ndbm" in
14148 $define) avail_ext="$avail_ext $xxx" ;;
14149 esac
14150 ;;
14151 ODBM_File|odbm_fil)
14152 case "${i_dbm}${i_rpcsvcdbm}" in
14153 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14154 esac
14155 ;;
14156 POSIX|posix)
14157 case "$useposix" in
14158 true|define|y) avail_ext="$avail_ext $xxx" ;;
14159 esac
14160 ;;
14161 Opcode|opcode)
14162 case "$useopcode" in
14163 true|define|y) avail_ext="$avail_ext $xxx" ;;
14164 esac
14165 ;;
14166 Socket|socket)
14167 case "$d_socket" in
14168 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14169 esac
14170 ;;
14171 Thread|thread)
14172 case "$usethreads" in
14173 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14174 esac
14175 ;;
14176 IPC/SysV|ipc/sysv)
14177 : XXX Do we need a useipcsysv variable here
14178 case "${d_msg}${d_sem}${d_shm}" in
14179 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14180 esac
14181 ;;
14182 *) avail_ext="$avail_ext $xxx"
14183 ;;
14184 esac
14185done
14186
14187set X $avail_ext
14188shift
14189avail_ext="$*"
14190
14191: Now see which nonxs extensions are supported on this system.
14192: For now assume all are.
14193nonxs_ext=''
14194for xxx in $nonxs_extensions ; do
14195 case "$xxx" in
14196 *) nonxs_ext="$nonxs_ext $xxx"
14197 ;;
14198 esac
14199done
14200
14201set X $nonxs_ext
14202shift
14203nonxs_ext="$*"
14204
14205case $usedl in
14206$define)
14207 $cat <<EOM
14208A number of extensions are supplied with $package. You may choose to
14209compile these extensions for dynamic loading (the default), compile
14210them into the $package executable (static loading), or not include
14211them at all. Answer "none" to include no extensions.
14212Note that DynaLoader is always built and need not be mentioned here.
14213
14214EOM
14215 case "$dynamic_ext" in
14216 '') dflt="$avail_ext" ;;
14217 *) dflt="$dynamic_ext"
14218 # Perhaps we are reusing an old out-of-date config.sh.
14219 case "$hint" in
14220 previous)
14221 if test X"$dynamic_ext" != X"$avail_ext"; then
14222 $cat <<EOM
14223NOTICE: Your previous config.sh list may be incorrect.
14224The extensions now available to you are
14225 ${avail_ext}
14226but the default list from your previous config.sh is
14227 ${dynamic_ext}
14228
14229EOM
14230 fi
14231 ;;
14232 esac
14233 ;;
14234 esac
14235 case "$dflt" in
14236 '') dflt=none;;
14237 esac
14238 rp="What extensions do you wish to load dynamically?"
14239 . ./myread
14240 case "$ans" in
14241 none) dynamic_ext=' ' ;;
14242 *) dynamic_ext="$ans" ;;
14243 esac
14244
14245 case "$static_ext" in
14246 '')
14247 : Exclude those already listed in dynamic linking
14248 dflt=''
14249 for xxx in $avail_ext; do
14250 case " $dynamic_ext " in
14251 *" $xxx "*) ;;
14252 *) dflt="$dflt $xxx" ;;
14253 esac
14254 done
14255 set X $dflt
14256 shift
14257 dflt="$*"
14258 ;;
14259 *) dflt="$static_ext"
14260 ;;
14261 esac
14262
14263 case "$dflt" in
14264 '') dflt=none;;
14265 esac
14266 rp="What extensions do you wish to load statically?"
14267 . ./myread
14268 case "$ans" in
14269 none) static_ext=' ' ;;
14270 *) static_ext="$ans" ;;
14271 esac
14272 ;;
14273*)
14274 $cat <<EOM
14275A number of extensions are supplied with $package. Answer "none"
14276to include no extensions.
14277Note that DynaLoader is always built and need not be mentioned here.
14278
14279EOM
14280 case "$static_ext" in
14281 '') dflt="$avail_ext" ;;
14282 *) dflt="$static_ext"
14283 # Perhaps we are reusing an old out-of-date config.sh.
14284 case "$hint" in
14285 previous)
14286 if test X"$static_ext" != X"$avail_ext"; then
14287 $cat <<EOM
14288NOTICE: Your previous config.sh list may be incorrect.
14289The extensions now available to you are
14290 ${avail_ext}
14291but the default list from your previous config.sh is
14292 ${static_ext}
14293
14294EOM
14295 fi
14296 ;;
14297 esac
14298 ;;
14299 esac
14300 : Exclude those that are not xs extensions
14301 case "$dflt" in
14302 '') dflt=none;;
14303 esac
14304 rp="What extensions do you wish to include?"
14305 . ./myread
14306 case "$ans" in
14307 none) static_ext=' ' ;;
14308 *) static_ext="$ans" ;;
14309 esac
14310 ;;
14311esac
14312
14313set X $dynamic_ext $static_ext $nonxs_ext
14314shift
14315extensions="$*"
14316
14317: Remove build directory name from cppstdin so it can be used from
14318: either the present location or the final installed location.
14319echo " "
14320: Get out of the UU directory to get correct path name.
14321cd ..
14322case "$cppstdin" in
14323`pwd`/cppstdin)
14324 echo "Stripping down cppstdin path name"
14325 cppstdin=cppstdin
14326 ;;
14327esac
14328cd UU
14329
14330: end of configuration questions
14331echo " "
14332echo "End of configuration questions."
14333echo " "
14334
14335: back to where it started
14336if test -d ../UU; then
14337 cd ..
14338fi
14339
14340: configuration may be patched via a 'config.over' file
14341if $test -f config.over; then
14342 echo " "
14343 dflt=y
14344 rp='I see a config.over file. Do you wish to load it?'
14345 . UU/myread
14346 case "$ans" in
14347 n*) echo "OK, I'll ignore it.";;
14348 *) . ./config.over
14349 echo "Configuration override changes have been loaded."
14350 ;;
14351 esac
14352fi
14353
14354: in case they want portability, strip down executable paths
14355case "$d_portable" in
14356"$define")
14357 echo " "
14358 echo "Stripping down executable paths..." >&4
14359 for file in $loclist $trylist; do
534ac15a
JH
14360 eval temp=\$$file
14361 eval $file=`basename $temp`
5f80c64f
JH
14362 done
14363 ;;
14364esac
14365
14366: create config.sh file
14367echo " "
14368echo "Creating config.sh..." >&4
14369$spitshell <<EOT >config.sh
14370$startsh
14371#
14372# This file was produced by running the Configure script. It holds all the
14373# definitions figured out by Configure. Should you modify one of these values,
14374# do not forget to propagate your changes by running "Configure -der". You may
14375# instead choose to run each of the .SH files by yourself, or "Configure -S".
14376#
14377
14378# Package name : $package
14379# Source directory : $src
14380# Configuration time: $cf_time
14381# Configured by : $cf_by
14382# Target system : $myuname
14383
14384Author='$Author'
14385Date='$Date'
14386Header='$Header'
14387Id='$Id'
14388Locker='$Locker'
14389Log='$Log'
14390Mcc='$Mcc'
14391RCSfile='$RCSfile'
14392Revision='$Revision'
14393Source='$Source'
14394State='$State'
14395_a='$_a'
14396_exe='$_exe'
14397_o='$_o'
14398afs='$afs'
14399alignbytes='$alignbytes'
14400ansi2knr='$ansi2knr'
14401aphostname='$aphostname'
ff935051
JH
14402api_revision='$api_revision'
14403api_subversion='$api_subversion'
14404api_version='$api_version'
14405api_versionstring='$api_versionstring'
5f80c64f
JH
14406ar='$ar'
14407archlib='$archlib'
14408archlibexp='$archlibexp'
14409archname64='$archname64'
14410archname='$archname'
14411archobjs='$archobjs'
14412awk='$awk'
14413baserev='$baserev'
14414bash='$bash'
14415bin='$bin'
d71b2b6b 14416bincompat5005='$bincompat5005'
5f80c64f
JH
14417binexp='$binexp'
14418bison='$bison'
14419byacc='$byacc'
14420byteorder='$byteorder'
14421c='$c'
14422castflags='$castflags'
14423cat='$cat'
14424cc='$cc'
14425cccdlflags='$cccdlflags'
14426ccdlflags='$ccdlflags'
14427ccflags='$ccflags'
ff49bff8 14428ccsymbols='$ccsymbols'
5f80c64f
JH
14429cf_by='$cf_by'
14430cf_email='$cf_email'
14431cf_time='$cf_time'
8175356b 14432charsize='$charsize'
5f80c64f
JH
14433chgrp='$chgrp'
14434chmod='$chmod'
14435chown='$chown'
14436clocktype='$clocktype'
14437comm='$comm'
14438compress='$compress'
14439contains='$contains'
14440cp='$cp'
14441cpio='$cpio'
14442cpp='$cpp'
14443cpp_stuff='$cpp_stuff'
ff49bff8 14444cppccsymbols='$cppccsymbols'
5f80c64f
JH
14445cppflags='$cppflags'
14446cpplast='$cpplast'
14447cppminus='$cppminus'
14448cpprun='$cpprun'
14449cppstdin='$cppstdin'
ff49bff8 14450cppsymbols='$cppsymbols'
68c15b6f 14451crosscompile='$crosscompile'
5f80c64f
JH
14452cryptlib='$cryptlib'
14453csh='$csh'
14454d_Gconvert='$d_Gconvert'
cf2093f6
JH
14455d_PRIEldbl='$d_PRIEldbl'
14456d_PRIFldbl='$d_PRIFldbl'
14457d_PRIGldbl='$d_PRIGldbl'
14458d_PRIX64='$d_PRIX64'
14459d_PRId64='$d_PRId64'
14460d_PRIeldbl='$d_PRIeldbl'
14461d_PRIfldbl='$d_PRIfldbl'
14462d_PRIgldbl='$d_PRIgldbl'
14463d_PRIi64='$d_PRIi64'
14464d_PRIo64='$d_PRIo64'
14465d_PRIu64='$d_PRIu64'
14466d_PRIx64='$d_PRIx64'
5f80c64f
JH
14467d_access='$d_access'
14468d_accessx='$d_accessx'
14469d_alarm='$d_alarm'
14470d_archlib='$d_archlib'
cf2093f6
JH
14471d_atolf='$d_atolf'
14472d_atoll='$d_atoll'
5f80c64f
JH
14473d_attribut='$d_attribut'
14474d_bcmp='$d_bcmp'
14475d_bcopy='$d_bcopy'
d71b2b6b 14476d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
14477d_bsd='$d_bsd'
14478d_bsdgetpgrp='$d_bsdgetpgrp'
14479d_bsdsetpgrp='$d_bsdsetpgrp'
14480d_bzero='$d_bzero'
14481d_casti32='$d_casti32'
14482d_castneg='$d_castneg'
14483d_charvspr='$d_charvspr'
14484d_chown='$d_chown'
14485d_chroot='$d_chroot'
14486d_chsize='$d_chsize'
14487d_closedir='$d_closedir'
14488d_const='$d_const'
14489d_crypt='$d_crypt'
14490d_csh='$d_csh'
14491d_cuserid='$d_cuserid'
14492d_dbl_dig='$d_dbl_dig'
5f80c64f 14493d_difftime='$d_difftime'
5f80c64f
JH
14494d_dirnamlen='$d_dirnamlen'
14495d_dlerror='$d_dlerror'
14496d_dlopen='$d_dlopen'
14497d_dlsymun='$d_dlsymun'
14498d_dosuid='$d_dosuid'
14499d_drand48proto='$d_drand48proto'
14500d_dup2='$d_dup2'
14501d_eaccess='$d_eaccess'
14502d_endgrent='$d_endgrent'
14503d_endhent='$d_endhent'
14504d_endnent='$d_endnent'
14505d_endpent='$d_endpent'
14506d_endpwent='$d_endpwent'
14507d_endsent='$d_endsent'
f1066039 14508d_endspent='$d_endspent'
5f80c64f
JH
14509d_eofnblk='$d_eofnblk'
14510d_eunice='$d_eunice'
14511d_fchmod='$d_fchmod'
14512d_fchown='$d_fchown'
14513d_fcntl='$d_fcntl'
14514d_fd_macros='$d_fd_macros'
14515d_fd_set='$d_fd_set'
14516d_fds_bits='$d_fds_bits'
5f80c64f 14517d_fgetpos='$d_fgetpos'
5f80c64f 14518d_flexfnam='$d_flexfnam'
5f80c64f 14519d_flock='$d_flock'
5f80c64f
JH
14520d_fork='$d_fork'
14521d_fpathconf='$d_fpathconf'
d9b3e12d 14522d_fpos64_t='$d_fpos64_t'
0545a864 14523d_fs_data_s='$d_fs_data_s'
5f80c64f 14524d_fseeko='$d_fseeko'
5f80c64f 14525d_fsetpos='$d_fsetpos'
104d25b7
JH
14526d_fstatfs='$d_fstatfs'
14527d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
14528d_ftello='$d_ftello'
14529d_ftime='$d_ftime'
5f80c64f
JH
14530d_getgrent='$d_getgrent'
14531d_getgrps='$d_getgrps'
14532d_gethbyaddr='$d_gethbyaddr'
14533d_gethbyname='$d_gethbyname'
14534d_gethent='$d_gethent'
14535d_gethname='$d_gethname'
14536d_gethostprotos='$d_gethostprotos'
14537d_getlogin='$d_getlogin'
ad27e871 14538d_getmnt='$d_getmnt'
ccc7f9b3 14539d_getmntent='$d_getmntent'
5f80c64f
JH
14540d_getnbyaddr='$d_getnbyaddr'
14541d_getnbyname='$d_getnbyname'
14542d_getnent='$d_getnent'
14543d_getnetprotos='$d_getnetprotos'
14544d_getpbyname='$d_getpbyname'
14545d_getpbynumber='$d_getpbynumber'
14546d_getpent='$d_getpent'
14547d_getpgid='$d_getpgid'
14548d_getpgrp2='$d_getpgrp2'
14549d_getpgrp='$d_getpgrp'
14550d_getppid='$d_getppid'
14551d_getprior='$d_getprior'
14552d_getprotoprotos='$d_getprotoprotos'
14553d_getpwent='$d_getpwent'
14554d_getsbyname='$d_getsbyname'
14555d_getsbyport='$d_getsbyport'
14556d_getsent='$d_getsent'
14557d_getservprotos='$d_getservprotos'
f1066039
JH
14558d_getspent='$d_getspent'
14559d_getspnam='$d_getspnam'
5f80c64f
JH
14560d_gettimeod='$d_gettimeod'
14561d_gnulibc='$d_gnulibc'
14562d_grpasswd='$d_grpasswd'
ccc7f9b3 14563d_hasmntopt='$d_hasmntopt'
5f80c64f
JH
14564d_htonl='$d_htonl'
14565d_index='$d_index'
14566d_inetaton='$d_inetaton'
5f80c64f
JH
14567d_int64t='$d_int64t'
14568d_isascii='$d_isascii'
14569d_killpg='$d_killpg'
14570d_lchown='$d_lchown'
2d4389e4 14571d_ldbl_dig='$d_ldbl_dig'
5f80c64f
JH
14572d_link='$d_link'
14573d_locconv='$d_locconv'
5f80c64f
JH
14574d_lockf='$d_lockf'
14575d_longdbl='$d_longdbl'
14576d_longlong='$d_longlong'
5f80c64f
JH
14577d_lstat='$d_lstat'
14578d_mblen='$d_mblen'
14579d_mbstowcs='$d_mbstowcs'
14580d_mbtowc='$d_mbtowc'
0f27ced1 14581d_memchr='$d_memchr'
5f80c64f
JH
14582d_memcmp='$d_memcmp'
14583d_memcpy='$d_memcpy'
14584d_memmove='$d_memmove'
14585d_memset='$d_memset'
14586d_mkdir='$d_mkdir'
14587d_mkfifo='$d_mkfifo'
14588d_mktime='$d_mktime'
14589d_msg='$d_msg'
de4597cb
JH
14590d_msg_ctrunc='$d_msg_ctrunc'
14591d_msg_dontroute='$d_msg_dontroute'
14592d_msg_oob='$d_msg_oob'
14593d_msg_peek='$d_msg_peek'
14594d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
14595d_msgctl='$d_msgctl'
14596d_msgget='$d_msgget'
14597d_msgrcv='$d_msgrcv'
14598d_msgsnd='$d_msgsnd'
14599d_mymalloc='$d_mymalloc'
5f80c64f 14600d_nice='$d_nice'
cce08f5b 14601d_nvpresuv='$d_nvpresuv'
2000072c 14602d_off64_t='$d_off64_t'
ef4af2be 14603d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
14604d_oldpthreads='$d_oldpthreads'
14605d_oldsock='$d_oldsock'
14606d_open3='$d_open3'
5f80c64f
JH
14607d_pathconf='$d_pathconf'
14608d_pause='$d_pause'
14609d_phostname='$d_phostname'
14610d_pipe='$d_pipe'
14611d_poll='$d_poll'
14612d_portable='$d_portable'
14613d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
14614d_pwage='$d_pwage'
14615d_pwchange='$d_pwchange'
14616d_pwclass='$d_pwclass'
14617d_pwcomment='$d_pwcomment'
14618d_pwexpire='$d_pwexpire'
14619d_pwgecos='$d_pwgecos'
14620d_pwpasswd='$d_pwpasswd'
14621d_pwquota='$d_pwquota'
de1c2614 14622d_quad='$d_quad'
5f80c64f
JH
14623d_readdir='$d_readdir'
14624d_readlink='$d_readlink'
14625d_rename='$d_rename'
14626d_rewinddir='$d_rewinddir'
14627d_rmdir='$d_rmdir'
14628d_safebcpy='$d_safebcpy'
14629d_safemcpy='$d_safemcpy'
14630d_sanemcmp='$d_sanemcmp'
14631d_sched_yield='$d_sched_yield'
de4597cb 14632d_scm_rights='$d_scm_rights'
5f80c64f
JH
14633d_seekdir='$d_seekdir'
14634d_select='$d_select'
14635d_sem='$d_sem'
14636d_semctl='$d_semctl'
14637d_semctl_semid_ds='$d_semctl_semid_ds'
14638d_semctl_semun='$d_semctl_semun'
14639d_semget='$d_semget'
14640d_semop='$d_semop'
14641d_setegid='$d_setegid'
14642d_seteuid='$d_seteuid'
14643d_setgrent='$d_setgrent'
14644d_setgrps='$d_setgrps'
14645d_sethent='$d_sethent'
14646d_setlinebuf='$d_setlinebuf'
14647d_setlocale='$d_setlocale'
14648d_setnent='$d_setnent'
14649d_setpent='$d_setpent'
14650d_setpgid='$d_setpgid'
14651d_setpgrp2='$d_setpgrp2'
14652d_setpgrp='$d_setpgrp'
14653d_setprior='$d_setprior'
14654d_setpwent='$d_setpwent'
14655d_setregid='$d_setregid'
14656d_setresgid='$d_setresgid'
14657d_setresuid='$d_setresuid'
14658d_setreuid='$d_setreuid'
14659d_setrgid='$d_setrgid'
14660d_setruid='$d_setruid'
14661d_setsent='$d_setsent'
14662d_setsid='$d_setsid'
f1066039 14663d_setspent='$d_setspent'
5f80c64f
JH
14664d_setvbuf='$d_setvbuf'
14665d_sfio='$d_sfio'
14666d_shm='$d_shm'
14667d_shmat='$d_shmat'
14668d_shmatprototype='$d_shmatprototype'
14669d_shmctl='$d_shmctl'
14670d_shmdt='$d_shmdt'
14671d_shmget='$d_shmget'
14672d_sigaction='$d_sigaction'
14673d_sigsetjmp='$d_sigsetjmp'
14674d_socket='$d_socket'
14675d_sockpair='$d_sockpair'
68d4903c 14676d_sqrtl='$d_sqrtl'
5f80c64f 14677d_statblks='$d_statblks'
0545a864
JH
14678d_statfs_f_flags='$d_statfs_f_flags'
14679d_statfs_s='$d_statfs_s'
104d25b7 14680d_statvfs='$d_statvfs'
5f80c64f
JH
14681d_stdio_cnt_lval='$d_stdio_cnt_lval'
14682d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 14683d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
14684d_stdiobase='$d_stdiobase'
14685d_stdstdio='$d_stdstdio'
5f80c64f
JH
14686d_strchr='$d_strchr'
14687d_strcoll='$d_strcoll'
14688d_strctcpy='$d_strctcpy'
14689d_strerrm='$d_strerrm'
14690d_strerror='$d_strerror'
14691d_strtod='$d_strtod'
14692d_strtol='$d_strtol'
ff935051 14693d_strtold='$d_strtold'
76d49b1c 14694d_strtoll='$d_strtoll'
5f80c64f 14695d_strtoul='$d_strtoul'
cf2093f6 14696d_strtoull='$d_strtoull'
ff935051 14697d_strtouq='$d_strtouq'
5f80c64f
JH
14698d_strxfrm='$d_strxfrm'
14699d_suidsafe='$d_suidsafe'
14700d_symlink='$d_symlink'
14701d_syscall='$d_syscall'
14702d_sysconf='$d_sysconf'
14703d_sysernlst='$d_sysernlst'
14704d_syserrlst='$d_syserrlst'
14705d_system='$d_system'
14706d_tcgetpgrp='$d_tcgetpgrp'
14707d_tcsetpgrp='$d_tcsetpgrp'
5f80c64f 14708d_telldir='$d_telldir'
cb86ce0e 14709d_telldirproto='$d_telldirproto'
5f80c64f
JH
14710d_time='$d_time'
14711d_times='$d_times'
5f80c64f
JH
14712d_truncate='$d_truncate'
14713d_tzname='$d_tzname'
14714d_umask='$d_umask'
14715d_uname='$d_uname'
14716d_union_semun='$d_union_semun'
0545a864 14717d_ustat='$d_ustat'
717c4fcc 14718d_vendorbin='$d_vendorbin'
a3635516 14719d_vendorlib='$d_vendorlib'
5f80c64f
JH
14720d_vfork='$d_vfork'
14721d_void_closedir='$d_void_closedir'
14722d_voidsig='$d_voidsig'
14723d_voidtty='$d_voidtty'
14724d_volatile='$d_volatile'
14725d_vprintf='$d_vprintf'
14726d_wait4='$d_wait4'
14727d_waitpid='$d_waitpid'
14728d_wcstombs='$d_wcstombs'
14729d_wctomb='$d_wctomb'
14730d_xenix='$d_xenix'
14731date='$date'
14732db_hashtype='$db_hashtype'
14733db_prefixtype='$db_prefixtype'
14734defvoidused='$defvoidused'
14735direntrytype='$direntrytype'
14736dlext='$dlext'
14737dlsrc='$dlsrc'
14738doublesize='$doublesize'
14739drand01='$drand01'
14740dynamic_ext='$dynamic_ext'
14741eagain='$eagain'
14742ebcdic='$ebcdic'
14743echo='$echo'
14744egrep='$egrep'
14745emacs='$emacs'
14746eunicefix='$eunicefix'
14747exe_ext='$exe_ext'
14748expr='$expr'
14749extensions='$extensions'
66fe083f 14750fflushNULL='$fflushNULL'
767df6a1 14751fflushall='$fflushall'
5f80c64f
JH
14752find='$find'
14753firstmakefile='$firstmakefile'
14754flex='$flex'
8175356b 14755fpossize='$fpossize'
5f80c64f
JH
14756fpostype='$fpostype'
14757freetype='$freetype'
ccc7f9b3 14758full_ar='$full_ar'
5f80c64f
JH
14759full_csh='$full_csh'
14760full_sed='$full_sed'
14761gccversion='$gccversion'
a22e52b9 14762gidformat='$gidformat'
785fb66b
JH
14763gidsign='$gidsign'
14764gidsize='$gidsize'
5f80c64f
JH
14765gidtype='$gidtype'
14766glibpth='$glibpth'
14767grep='$grep'
14768groupcat='$groupcat'
14769groupstype='$groupstype'
14770gzip='$gzip'
14771h_fcntl='$h_fcntl'
14772h_sysfile='$h_sysfile'
14773hint='$hint'
14774hostcat='$hostcat'
14775huge='$huge'
8175356b
JH
14776i16size='$i16size'
14777i16type='$i16type'
14778i32size='$i32size'
14779i32type='$i32type'
14780i64size='$i64size'
14781i64type='$i64type'
14782i8size='$i8size'
14783i8type='$i8type'
5f80c64f
JH
14784i_arpainet='$i_arpainet'
14785i_bsdioctl='$i_bsdioctl'
14786i_db='$i_db'
14787i_dbm='$i_dbm'
14788i_dirent='$i_dirent'
14789i_dld='$i_dld'
14790i_dlfcn='$i_dlfcn'
14791i_fcntl='$i_fcntl'
14792i_float='$i_float'
14793i_gdbm='$i_gdbm'
14794i_grp='$i_grp'
14795i_inttypes='$i_inttypes'
14796i_limits='$i_limits'
14797i_locale='$i_locale'
7f3d1cf1 14798i_machcthr='$i_machcthr'
5f80c64f
JH
14799i_malloc='$i_malloc'
14800i_math='$i_math'
14801i_memory='$i_memory'
e7fb4fcc 14802i_mntent='$i_mntent'
5f80c64f
JH
14803i_ndbm='$i_ndbm'
14804i_netdb='$i_netdb'
14805i_neterrno='$i_neterrno'
9cc6feab 14806i_netinettcp='$i_netinettcp'
5f80c64f 14807i_niin='$i_niin'
5b34fd99 14808i_poll='$i_poll'
c4747d3e 14809i_pthread='$i_pthread'
5f80c64f
JH
14810i_pwd='$i_pwd'
14811i_rpcsvcdbm='$i_rpcsvcdbm'
14812i_sfio='$i_sfio'
14813i_sgtty='$i_sgtty'
f1066039 14814i_shadow='$i_shadow'
86959918 14815i_socks='$i_socks'
5f80c64f
JH
14816i_stdarg='$i_stdarg'
14817i_stddef='$i_stddef'
14818i_stdlib='$i_stdlib'
14819i_string='$i_string'
14820i_sysaccess='$i_sysaccess'
14821i_sysdir='$i_sysdir'
14822i_sysfile='$i_sysfile'
14823i_sysfilio='$i_sysfilio'
14824i_sysin='$i_sysin'
14825i_sysioctl='$i_sysioctl'
104d25b7 14826i_sysmount='$i_sysmount'
5f80c64f
JH
14827i_sysndir='$i_sysndir'
14828i_sysparam='$i_sysparam'
14829i_sysresrc='$i_sysresrc'
14830i_syssecrt='$i_syssecrt'
14831i_sysselct='$i_sysselct'
14832i_syssockio='$i_syssockio'
14833i_sysstat='$i_sysstat'
0545a864 14834i_sysstatfs='$i_sysstatfs'
104d25b7 14835i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
14836i_systime='$i_systime'
14837i_systimek='$i_systimek'
14838i_systimes='$i_systimes'
14839i_systypes='$i_systypes'
de4597cb 14840i_sysuio='$i_sysuio'
5f80c64f 14841i_sysun='$i_sysun'
0545a864 14842i_sysvfs='$i_sysvfs'
5f80c64f
JH
14843i_syswait='$i_syswait'
14844i_termio='$i_termio'
14845i_termios='$i_termios'
14846i_time='$i_time'
14847i_unistd='$i_unistd'
0545a864 14848i_ustat='$i_ustat'
5f80c64f
JH
14849i_utime='$i_utime'
14850i_values='$i_values'
14851i_varargs='$i_varargs'
14852i_varhdr='$i_varhdr'
14853i_vfork='$i_vfork'
14854ignore_versioned_solibs='$ignore_versioned_solibs'
ff935051 14855inc_version_list='$inc_version_list'
3a096bf3 14856inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
14857incpath='$incpath'
14858inews='$inews'
14859installarchlib='$installarchlib'
14860installbin='$installbin'
14861installman1dir='$installman1dir'
14862installman3dir='$installman3dir'
dd4e71fd
JH
14863installprefix='$installprefix'
14864installprefixexp='$installprefixexp'
5f80c64f
JH
14865installprivlib='$installprivlib'
14866installscript='$installscript'
14867installsitearch='$installsitearch'
717c4fcc 14868installsitebin='$installsitebin'
5f80c64f 14869installsitelib='$installsitelib'
dd4e71fd 14870installstyle='$installstyle'
104d25b7 14871installusrbinperl='$installusrbinperl'
717c4fcc 14872installvendorbin='$installvendorbin'
a3635516 14873installvendorlib='$installvendorlib'
5f80c64f 14874intsize='$intsize'
8175356b
JH
14875ivdformat='$ivdformat'
14876ivsize='$ivsize'
14877ivtype='$ivtype'
5f80c64f
JH
14878known_extensions='$known_extensions'
14879ksh='$ksh'
14880large='$large'
14881ld='$ld'
14882lddlflags='$lddlflags'
14883ldflags='$ldflags'
5cf1d1f1 14884ldlibpthname='$ldlibpthname'
5f80c64f
JH
14885less='$less'
14886lib_ext='$lib_ext'
14887libc='$libc'
14888libperl='$libperl'
14889libpth='$libpth'
14890libs='$libs'
14891libswanted='$libswanted'
14892line='$line'
14893lint='$lint'
14894lkflags='$lkflags'
14895ln='$ln'
14896lns='$lns'
14897locincpth='$locincpth'
14898loclibpth='$loclibpth'
14899longdblsize='$longdblsize'
14900longlongsize='$longlongsize'
14901longsize='$longsize'
14902lp='$lp'
14903lpr='$lpr'
14904ls='$ls'
14905lseeksize='$lseeksize'
14906lseektype='$lseektype'
14907mail='$mail'
14908mailx='$mailx'
14909make='$make'
14910make_set_make='$make_set_make'
14911mallocobj='$mallocobj'
14912mallocsrc='$mallocsrc'
14913malloctype='$malloctype'
14914man1dir='$man1dir'
14915man1direxp='$man1direxp'
14916man1ext='$man1ext'
14917man3dir='$man3dir'
14918man3direxp='$man3direxp'
14919man3ext='$man3ext'
14920medium='$medium'
5f80c64f
JH
14921mips_type='$mips_type'
14922mkdir='$mkdir'
14923models='$models'
14924modetype='$modetype'
14925more='$more'
68c15b6f 14926multiarch='$multiarch'
5f80c64f
JH
14927mv='$mv'
14928myarchname='$myarchname'
14929mydomain='$mydomain'
14930myhostname='$myhostname'
14931myuname='$myuname'
14932n='$n'
14933netdb_hlen_type='$netdb_hlen_type'
14934netdb_host_type='$netdb_host_type'
14935netdb_name_type='$netdb_name_type'
14936netdb_net_type='$netdb_net_type'
14937nm='$nm'
14938nm_opt='$nm_opt'
14939nm_so_opt='$nm_so_opt'
14940nonxs_ext='$nonxs_ext'
14941nroff='$nroff'
8175356b
JH
14942nvsize='$nvsize'
14943nvtype='$nvtype'
5f80c64f
JH
14944o_nonblock='$o_nonblock'
14945obj_ext='$obj_ext'
ef4af2be 14946old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
14947optimize='$optimize'
14948orderlib='$orderlib'
14949osname='$osname'
14950osvers='$osvers'
14951package='$package'
14952pager='$pager'
14953passcat='$passcat'
14954patchlevel='$patchlevel'
14955path_sep='$path_sep'
14956perl='$perl'
14957perladmin='$perladmin'
14958perlpath='$perlpath'
14959pg='$pg'
14960phostname='$phostname'
14961pidtype='$pidtype'
14962plibpth='$plibpth'
14963pmake='$pmake'
14964pr='$pr'
14965prefix='$prefix'
14966prefixexp='$prefixexp'
14967privlib='$privlib'
14968privlibexp='$privlibexp'
14969prototype='$prototype'
14970ptrsize='$ptrsize'
6b8eaf93 14971quadkind='$quadkind'
d7d93a81 14972quadtype='$quadtype'
5f80c64f
JH
14973randbits='$randbits'
14974randfunc='$randfunc'
14975randseedtype='$randseedtype'
14976ranlib='$ranlib'
14977rd_nodata='$rd_nodata'
14978rm='$rm'
14979rmail='$rmail'
14980runnm='$runnm'
cf2093f6
JH
14981sPRIEldbl='$sPRIEldbl'
14982sPRIFldbl='$sPRIFldbl'
14983sPRIGldbl='$sPRIGldbl'
14984sPRIX64='$sPRIX64'
14985sPRId64='$sPRId64'
14986sPRIeldbl='$sPRIeldbl'
14987sPRIfldbl='$sPRIfldbl'
14988sPRIgldbl='$sPRIgldbl'
14989sPRIi64='$sPRIi64'
14990sPRIo64='$sPRIo64'
14991sPRIu64='$sPRIu64'
14992sPRIx64='$sPRIx64'
5f80c64f
JH
14993sched_yield='$sched_yield'
14994scriptdir='$scriptdir'
14995scriptdirexp='$scriptdirexp'
14996sed='$sed'
14997seedfunc='$seedfunc'
14998selectminbits='$selectminbits'
14999selecttype='$selecttype'
15000sendmail='$sendmail'
15001sh='$sh'
15002shar='$shar'
15003sharpbang='$sharpbang'
15004shmattype='$shmattype'
15005shortsize='$shortsize'
15006shrpenv='$shrpenv'
15007shsharp='$shsharp'
af4c28eb 15008sig_count='$sig_count'
5f80c64f
JH
15009sig_name='$sig_name'
15010sig_name_init='$sig_name_init'
15011sig_num='$sig_num'
824a2ba3 15012sig_num_init='$sig_num_init'
5f80c64f
JH
15013signal_t='$signal_t'
15014sitearch='$sitearch'
15015sitearchexp='$sitearchexp'
717c4fcc
JH
15016sitebin='$sitebin'
15017sitebinexp='$sitebinexp'
5f80c64f
JH
15018sitelib='$sitelib'
15019sitelibexp='$sitelibexp'
dd4e71fd
JH
15020siteprefix='$siteprefix'
15021siteprefixexp='$siteprefixexp'
5f80c64f
JH
15022sizetype='$sizetype'
15023sleep='$sleep'
15024smail='$smail'
15025small='$small'
15026so='$so'
15027sockethdr='$sockethdr'
15028socketlib='$socketlib'
15029sort='$sort'
15030spackage='$spackage'
15031spitshell='$spitshell'
15032split='$split'
15033src='$src'
15034ssizetype='$ssizetype'
15035startperl='$startperl'
15036startsh='$startsh'
15037static_ext='$static_ext'
15038stdchar='$stdchar'
15039stdio_base='$stdio_base'
15040stdio_bufsiz='$stdio_bufsiz'
15041stdio_cnt='$stdio_cnt'
15042stdio_filbuf='$stdio_filbuf'
15043stdio_ptr='$stdio_ptr'
767df6a1 15044stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
15045strings='$strings'
15046submit='$submit'
15047subversion='$subversion'
15048sysman='$sysman'
15049tail='$tail'
15050tar='$tar'
15051tbl='$tbl'
15052tee='$tee'
15053test='$test'
15054timeincl='$timeincl'
15055timetype='$timetype'
15056touch='$touch'
15057tr='$tr'
15058trnl='$trnl'
15059troff='$troff'
8175356b
JH
15060u16size='$u16size'
15061u16type='$u16type'
15062u32size='$u32size'
15063u32type='$u32type'
15064u64size='$u64size'
15065u64type='$u64type'
15066u8size='$u8size'
15067u8type='$u8type'
a22e52b9 15068uidformat='$uidformat'
57def98f 15069uidsign='$uidsign'
785fb66b 15070uidsize='$uidsize'
5f80c64f
JH
15071uidtype='$uidtype'
15072uname='$uname'
15073uniq='$uniq'
d7d93a81 15074uquadtype='$uquadtype'
aaacdc8b 15075use5005threads='$use5005threads'
5f80c64f
JH
15076use64bits='$use64bits'
15077usedl='$usedl'
aaacdc8b 15078useithreads='$useithreads'
249b38c6 15079uselargefiles='$uselargefiles'
b0ce926a 15080uselongdouble='$uselongdouble'
d7d93a81 15081uselonglong='$uselonglong'
09458382 15082usemorebits='$usemorebits'
5f80c64f
JH
15083usemultiplicity='$usemultiplicity'
15084usemymalloc='$usemymalloc'
15085usenm='$usenm'
15086useopcode='$useopcode'
15087useperlio='$useperlio'
15088useposix='$useposix'
15089usesfio='$usesfio'
15090useshrplib='$useshrplib'
29209bc5 15091usesocks='$usesocks'
5f80c64f 15092usethreads='$usethreads'
a3635516 15093usevendorprefix='$usevendorprefix'
5f80c64f
JH
15094usevfork='$usevfork'
15095usrinc='$usrinc'
15096uuname='$uuname'
8175356b
JH
15097uvoformat='$uvoformat'
15098uvsize='$uvsize'
15099uvtype='$uvtype'
15100uvuformat='$uvuformat'
15101uvxformat='$uvxformat'
717c4fcc
JH
15102vendorbin='$vendorbin'
15103vendorbinexp='$vendorbinexp'
a3635516
JH
15104vendorlib='$vendorlib'
15105vendorlibexp='$vendorlibexp'
15106vendorprefix='$vendorprefix'
15107vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
15108version='$version'
15109vi='$vi'
15110voidflags='$voidflags'
15111xlibpth='$xlibpth'
15112zcat='$zcat'
15113zip='$zip'
15114EOT
15115
15116: Add in command line options if available
15117$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15118
15119: add special variables
15120$test -f $src/patchlevel.h && \
d00b958f 15121awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 15122echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
15123
15124: propagate old symbols
15125if $test -f UU/config.sh; then
15126 <UU/config.sh sort | uniq >UU/oldconfig.sh
15127 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15128 sort | uniq -u >UU/oldsyms
15129 set X `cat UU/oldsyms`
15130 shift
15131 case $# in
15132 0) ;;
15133 *)
15134 cat <<EOM
15135Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15136EOM
15137 echo "# Variables propagated from previous config.sh file." >>config.sh
15138 for sym in `cat UU/oldsyms`; do
15139 echo " Propagating $hint variable "'$'"$sym..."
15140 eval 'tmp="$'"${sym}"'"'
15141 echo "$tmp" | \
15142 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15143 done
15144 ;;
15145 esac
15146fi
15147
15148: Finish up by extracting the .SH files
15149case "$alldone" in
15150exit)
15151 $rm -rf UU
15152 echo "Done."
15153 exit 0
15154 ;;
15155cont)
15156 ;;
15157'')
15158 dflt=''
15159 nostick=true
15160 $cat <<EOM
15161
15162If you'd like to make any changes to the config.sh file before I begin
15163to configure things, do it as a shell escape now (e.g. !vi config.sh).
15164
15165EOM
15166 rp="Press return or use a shell escape to edit config.sh:"
15167 . UU/myread
15168 nostick=''
15169 case "$ans" in
15170 '') ;;
15171 *) : in case they cannot read
15172 sh 1>&4 -c "$ans";;
15173 esac
15174 ;;
15175esac
15176
15177: if this fails, just run all the .SH files by hand
15178. ./config.sh
15179
15180echo " "
15181exec 1>&4
15182. ./UU/extract
15183
15184if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15185 dflt=y
15186 case "$silent" in
15187 true) ;;
15188 *)
15189 $cat <<EOM
15190
15191Now you need to generate make dependencies by running "$make depend".
15192You might prefer to run it in background: "$make depend > makedepend.out &"
15193It can take a while, so you might not want to run it right now.
15194
15195EOM
15196 ;;
15197 esac
15198 rp="Run $make depend now?"
15199 . UU/myread
15200 case "$ans" in
15201 y*)
15202 $make depend && echo "Now you must run a $make."
15203 ;;
15204 *)
15205 echo "You must run '$make depend' then '$make'."
15206 ;;
15207 esac
15208elif test -f [Mm]akefile; then
15209 echo " "
15210 echo "Now you must run a $make."
15211else
15212 echo "Done."
15213fi
15214
15215if $test -f Policy.sh; then
15216 $cat <<EOM
15217
15218If you compile $package on a different machine or from a different object
15219directory, copy the Policy.sh file from this object directory to the
15220new one before you run Configure -- this will help you with most of
15221the policy defaults.
15222
15223EOM
15224fi
15225if $test -f config.msg; then
15226 echo "Hmm. I also noted the following information while running:"
15227 echo " "
15228 $cat config.msg >&4
15229 $rm -f config.msg
15230fi
15231$rm -f kit*isdone ark*isdone
15232$rm -rf UU
15233
15234: End of Configure
15235