This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make sprintf("%g",...) threadsafe; only taint its result iff the
[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#
ec897fb9 23# Generated on Mon Aug 30 22:33:03 EET DST 1999 [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=''
301contains=''
a0d0e21e 302cpp_stuff=''
2304df62
AD
303cpplast=''
304cppminus=''
305cpprun=''
306cppstdin=''
68c15b6f 307crosscompile=''
2304df62 308d_access=''
5ff3f7a4 309d_accessx=''
a0d0e21e 310d_alarm=''
ecfc5424 311d_attribut=''
2304df62
AD
312d_bcmp=''
313d_bcopy=''
314d_bzero=''
315d_casti32=''
316castflags=''
317d_castneg=''
a0d0e21e
LW
318d_chown=''
319d_chroot=''
2304df62 320d_chsize=''
a0d0e21e
LW
321d_closedir=''
322d_void_closedir=''
2304df62
AD
323d_const=''
324cryptlib=''
325d_crypt=''
326d_csh=''
1aef975c 327full_csh=''
a0d0e21e
LW
328d_cuserid=''
329d_dbl_dig=''
330d_difftime=''
331d_dlerror=''
332d_dlopen=''
333d_dlsymun=''
2304df62 334d_dosuid=''
a0d0e21e 335d_suidsafe=''
85ab1d1d 336d_drand48proto=''
2304df62 337d_dup2=''
5ff3f7a4
GS
338d_eaccess=''
339d_endgrent=''
e5c9fcd0
AD
340d_endhent=''
341d_endnent=''
342d_endpent=''
5ff3f7a4 343d_endpwent=''
e5c9fcd0 344d_endsent=''
f1066039 345d_endspent=''
2304df62
AD
346d_fchmod=''
347d_fchown=''
348d_fcntl=''
a0d0e21e
LW
349d_fd_macros=''
350d_fd_set=''
351d_fds_bits=''
352d_fgetpos=''
2304df62
AD
353d_flexfnam=''
354d_flock=''
a0d0e21e 355d_fork=''
5ff3f7a4 356d_fseeko=''
a0d0e21e 357d_fsetpos=''
5ff3f7a4 358d_ftello=''
5f05dabc 359d_ftime=''
360d_gettimeod=''
a0d0e21e 361d_Gconvert=''
5ff3f7a4 362d_getgrent=''
2304df62 363d_getgrps=''
4599a1de 364d_gethbyaddr=''
4599a1de 365d_gethbyname=''
dfe9444c 366d_gethent=''
2304df62
AD
367aphostname=''
368d_gethname=''
369d_phostname=''
370d_uname=''
dc45a647 371d_gethostprotos=''
a0d0e21e 372d_getlogin=''
ccc7f9b3 373d_getmntent=''
dfe9444c 374d_getnbyaddr=''
693762b4 375d_getnbyname=''
e5c9fcd0 376d_getnent=''
dc45a647 377d_getnetprotos=''
e5c9fcd0 378d_getpent=''
2afac517 379d_getpgid=''
2304df62 380d_getpgrp2=''
2afac517 381d_bsdgetpgrp=''
2304df62 382d_getpgrp=''
a0d0e21e 383d_getppid=''
2304df62 384d_getprior=''
693762b4
AD
385d_getpbyname=''
386d_getpbynumber=''
dc45a647 387d_getprotoprotos=''
5ff3f7a4 388d_getpwent=''
e5c9fcd0 389d_getsent=''
dc45a647 390d_getservprotos=''
f1066039
JH
391d_getspent=''
392d_getspnam=''
693762b4
AD
393d_getsbyname=''
394d_getsbyport=''
a4f3eea9 395d_gnulibc=''
ccc7f9b3 396d_hasmntopt=''
2304df62 397d_htonl=''
7e1af8bc 398d_inetaton=''
2304df62
AD
399d_isascii=''
400d_killpg=''
dd64f1c3 401d_lchown=''
2d4389e4 402d_ldbl_dig=''
2304df62 403d_link=''
a0d0e21e
LW
404d_locconv=''
405d_lockf=''
e5c9fcd0
AD
406d_longdbl=''
407longdblsize=''
dc45a647
MB
408d_longlong=''
409longlongsize=''
2304df62 410d_lstat=''
ff49bff8 411d_madvise=''
a0d0e21e
LW
412d_mblen=''
413d_mbstowcs=''
414d_mbtowc=''
0f27ced1 415d_memchr=''
2304df62
AD
416d_memcmp=''
417d_memcpy=''
418d_memmove=''
419d_memset=''
420d_mkdir=''
a0d0e21e
LW
421d_mkfifo=''
422d_mktime=''
ff49bff8
JH
423d_mmap=''
424mmaptype=''
425d_mprotect=''
2304df62
AD
426d_msg=''
427d_msgctl=''
428d_msgget=''
429d_msgrcv=''
430d_msgsnd=''
ff49bff8
JH
431d_msync=''
432d_munmap=''
a0d0e21e 433d_nice=''
2304df62 434d_open3=''
a0d0e21e
LW
435d_fpathconf=''
436d_pathconf=''
437d_pause=''
438d_pipe=''
8e07c86e 439d_poll=''
2304df62 440d_portable=''
ef4af2be
JH
441d_old_pthread_create_joinable=''
442old_pthread_create_joinable=''
dfe9444c
AD
443d_pthread_yield=''
444d_sched_yield=''
1cfa4ec7 445sched_yield=''
2304df62 446d_readdir=''
85e6fe83
LW
447d_rewinddir=''
448d_seekdir=''
449d_telldir=''
a0d0e21e 450d_readlink=''
de4597cb 451d_readv=''
2304df62
AD
452d_rename=''
453d_rmdir=''
454d_safebcpy=''
455d_safemcpy=''
36477c24 456d_sanemcmp=''
2304df62
AD
457d_select=''
458d_sem=''
459d_semctl=''
460d_semget=''
461d_semop=''
462d_setegid=''
463d_seteuid=''
5ff3f7a4 464d_setgrent=''
dfe9444c 465d_setgrps=''
693762b4 466d_sethent=''
a0d0e21e 467d_setlinebuf=''
2304df62 468d_setlocale=''
e5c9fcd0
AD
469d_setnent=''
470d_setpent=''
2304df62
AD
471d_setpgid=''
472d_setpgrp2=''
2afac517 473d_bsdsetpgrp=''
2304df62
AD
474d_setpgrp=''
475d_setprior=''
5ff3f7a4 476d_setpwent=''
2304df62
AD
477d_setregid=''
478d_setresgid=''
479d_setresuid=''
480d_setreuid=''
481d_setrgid=''
482d_setruid=''
e5c9fcd0 483d_setsent=''
2304df62 484d_setsid=''
f1066039 485d_setspent=''
e5c9fcd0 486d_setvbuf=''
760ac839 487d_sfio=''
8ff267be 488usesfio=''
2304df62
AD
489d_shm=''
490d_shmat=''
a0d0e21e
LW
491d_shmatprototype=''
492shmattype=''
2304df62
AD
493d_shmctl=''
494d_shmdt=''
495d_shmget=''
2c7991dc 496d_sigaction=''
8ff267be 497d_sigsetjmp=''
de4597cb
JH
498d_cmsghdr_s=''
499d_msg_ctrunc=''
500d_msg_dontroute=''
501d_msg_oob=''
502d_msg_peek=''
503d_msg_proxy=''
504d_msghdr_s=''
2304df62 505d_oldsock=''
de4597cb
JH
506d_recvmsg=''
507d_scm_rights=''
508d_sendmsg=''
2304df62
AD
509d_socket=''
510d_sockpair=''
511sockethdr=''
512socketlib=''
513d_statblks=''
104d25b7
JH
514d_fstatfs=''
515d_statfs=''
516d_statfsflags=''
517d_fstatvfs=''
518d_statvfs=''
c2960299
AD
519d_stdio_cnt_lval=''
520d_stdio_ptr_lval=''
16d20bd9 521d_stdiobase=''
2304df62 522d_stdstdio=''
16d20bd9
AD
523stdio_base=''
524stdio_bufsiz=''
525stdio_cnt=''
dfe9444c 526stdio_filbuf=''
16d20bd9 527stdio_ptr=''
2304df62
AD
528d_index=''
529d_strchr=''
a0d0e21e 530d_strcoll=''
2304df62
AD
531d_strctcpy=''
532d_strerrm=''
533d_strerror=''
534d_sysernlst=''
535d_syserrlst=''
a89d8a78
DH
536d_strtod=''
537d_strtol=''
538d_strtoul=''
a0d0e21e 539d_strxfrm=''
2304df62
AD
540d_symlink=''
541d_syscall=''
a0d0e21e 542d_sysconf=''
2304df62 543d_system=''
a0d0e21e
LW
544d_tcgetpgrp=''
545d_tcsetpgrp=''
cb86ce0e 546d_telldirproto=''
85e6fe83
LW
547d_time=''
548timetype=''
2304df62
AD
549clocktype=''
550d_times=''
551d_truncate=''
a0d0e21e
LW
552d_tzname=''
553d_umask=''
bd89102f
AD
554d_semctl_semid_ds=''
555d_semctl_semun=''
556d_union_semun=''
2304df62 557d_vfork=''
a0d0e21e 558usevfork=''
2304df62
AD
559d_voidsig=''
560signal_t=''
561d_volatile=''
562d_charvspr=''
563d_vprintf=''
564d_wait4=''
565d_waitpid=''
a0d0e21e
LW
566d_wcstombs=''
567d_wctomb=''
de4597cb 568d_writev=''
a0d0e21e 569dlext=''
85e6fe83
LW
570cccdlflags=''
571ccdlflags=''
2304df62 572dlsrc=''
232e078e 573ld=''
85e6fe83 574lddlflags=''
2304df62 575usedl=''
693762b4 576doublesize=''
5ff3f7a4 577ebcdic=''
66fe083f 578fflushNULL=''
767df6a1 579fflushall=''
a0d0e21e 580fpostype=''
2304df62
AD
581gidtype=''
582groupstype=''
583h_fcntl=''
584h_sysfile=''
5ff3f7a4 585i_arpainet=''
ecfc5424
AD
586db_hashtype=''
587db_prefixtype=''
a0d0e21e 588i_db=''
2304df62 589i_dbm=''
8e07c86e 590i_rpcsvcdbm=''
2304df62 591d_dirnamlen=''
a0d0e21e 592direntrytype=''
2304df62 593i_dirent=''
a0d0e21e 594i_dld=''
2304df62
AD
595i_dlfcn=''
596i_fcntl=''
a0d0e21e 597i_float=''
2304df62 598i_gdbm=''
28e8609d 599d_grpasswd=''
2304df62 600i_grp=''
5ff3f7a4
GS
601d_int64t=''
602i_inttypes=''
a0d0e21e 603i_limits=''
4633a7c4 604i_locale=''
7f3d1cf1 605i_machcthr=''
a0d0e21e
LW
606i_malloc=''
607i_math=''
85e6fe83 608i_memory=''
e7fb4fcc 609i_mntent=''
2304df62 610i_ndbm=''
3fd537d4 611i_netdb=''
85e6fe83 612i_neterrno=''
9cc6feab 613i_netinettcp=''
2304df62
AD
614i_niin=''
615i_sysin=''
5b34fd99 616i_poll=''
c4747d3e 617i_pthread=''
2304df62
AD
618d_pwage=''
619d_pwchange=''
620d_pwclass=''
621d_pwcomment=''
622d_pwexpire=''
c4f23d77 623d_pwgecos=''
28e8609d 624d_pwpasswd=''
2304df62
AD
625d_pwquota=''
626i_pwd=''
760ac839 627i_sfio=''
f1066039 628i_shadow=''
86959918 629i_socks=''
2304df62 630i_stddef=''
a0d0e21e 631i_stdlib=''
2304df62
AD
632i_string=''
633strings=''
5ff3f7a4 634i_sysaccess=''
2304df62
AD
635i_sysdir=''
636i_sysfile=''
637d_voidtty=''
638i_bsdioctl=''
a0d0e21e 639i_sysfilio=''
2304df62
AD
640i_sysioctl=''
641i_syssockio=''
ff49bff8 642i_sysmman=''
104d25b7 643i_sysmount=''
2304df62 644i_sysndir=''
a0d0e21e 645i_sysparam=''
8ff267be 646i_sysresrc=''
5ff3f7a4 647i_syssecrt=''
2304df62 648i_sysselct=''
1aef975c 649i_sysstat=''
104d25b7 650i_sysstatvfs=''
a0d0e21e 651i_systimes=''
fed7345c 652i_systypes=''
de4597cb
JH
653d_iovec_s=''
654i_sysuio=''
25f94b33 655i_sysun=''
8ff267be 656i_syswait=''
2304df62
AD
657i_sgtty=''
658i_termio=''
659i_termios=''
660i_systime=''
661i_systimek=''
662i_time=''
663timeincl=''
85e6fe83 664i_unistd=''
2304df62 665i_utime=''
760ac839 666i_values=''
a0d0e21e 667i_stdarg=''
2304df62
AD
668i_varargs=''
669i_varhdr=''
670i_vfork=''
dd4e71fd
JH
671installprefix=''
672installprefixexp=''
673installstyle=''
104d25b7 674installusrbinperl=''
2304df62 675intsize=''
24fef2a7
AD
676longsize=''
677shortsize=''
d9b3e12d 678d_fpos64_t=''
2000072c 679d_llseek=''
2000072c 680d_off64_t=''
2304df62 681libc=''
5cf1d1f1 682ldlibpthname=''
8ff267be 683libperl=''
2afac517 684shrpenv=''
8ff267be 685useshrplib=''
a0d0e21e 686glibpth=''
2304df62 687libpth=''
8e07c86e 688loclibpth=''
2304df62
AD
689plibpth=''
690xlibpth=''
1cfa4ec7 691ignore_versioned_solibs=''
2304df62 692libs=''
85e6fe83 693lns=''
cf2093f6
JH
694d_PRIEldbl=''
695d_PRIFldbl=''
696d_PRIGldbl=''
697d_PRIeldbl=''
698d_PRIfldbl=''
699d_PRIgldbl=''
700sPRIEldbl=''
701sPRIFldbl=''
702sPRIGldbl=''
703sPRIeldbl=''
704sPRIfldbl=''
705sPRIgldbl=''
5ff3f7a4 706lseeksize=''
85e6fe83 707lseektype=''
8ff267be 708make_set_make=''
85e6fe83 709d_mymalloc=''
94b6baf5 710freetype=''
2304df62
AD
711mallocobj=''
712mallocsrc=''
713malloctype=''
714usemymalloc=''
16d20bd9
AD
715installman1dir=''
716man1dir=''
717man1direxp=''
718man1ext=''
719installman3dir=''
720man3dir=''
721man3direxp=''
722man3ext=''
2304df62
AD
723huge=''
724large=''
725medium=''
726models=''
727small=''
728split=''
a0d0e21e 729modetype=''
68c15b6f 730multiarch=''
2304df62
AD
731mydomain=''
732myhostname=''
733phostname=''
734c=''
735n=''
8e07c86e
AD
736d_eofnblk=''
737eagain=''
738o_nonblock=''
739rd_nodata=''
dfe9444c
AD
740netdb_hlen_type=''
741netdb_host_type=''
742netdb_name_type=''
743netdb_net_type=''
2304df62
AD
744groupcat=''
745hostcat=''
746passcat=''
85e6fe83
LW
747orderlib=''
748ranlib=''
2304df62
AD
749package=''
750spackage=''
2c7991dc 751pager=''
bfb7748a 752apiversion=''
ecfc5424 753patchlevel=''
760ac839 754subversion=''
bfb7748a 755version=''
8e07c86e 756perladmin=''
4633a7c4 757perlpath=''
dfe9444c 758pidtype=''
a0d0e21e 759prefix=''
1aef975c 760prefixexp=''
2304df62
AD
761installprivlib=''
762privlib=''
763privlibexp=''
764prototype=''
693762b4 765ptrsize=''
cf2093f6
JH
766d_PRIX64=''
767d_PRId64=''
768d_PRIi64=''
769d_PRIo64=''
770d_PRIu64=''
771d_PRIx64=''
772sPRIX64=''
773sPRId64=''
774sPRIi64=''
775sPRIo64=''
776sPRIu64=''
777sPRIx64=''
85ab1d1d 778drand01=''
2304df62 779randbits=''
85ab1d1d
JH
780randfunc=''
781randseedtype=''
782seedfunc=''
2304df62
AD
783installscript=''
784scriptdir=''
785scriptdirexp=''
5ff3f7a4 786selectminbits=''
a0d0e21e 787selecttype=''
8ff267be 788sh=''
af4c28eb 789sig_count=''
2304df62 790sig_name=''
dfe9444c 791sig_name_init=''
8e07c86e 792sig_num=''
824a2ba3 793sig_num_init=''
4633a7c4
LW
794installsitearch=''
795sitearch=''
796sitearchexp=''
25f94b33
AD
797installsitelib=''
798sitelib=''
799sitelibexp=''
dd4e71fd
JH
800siteprefix=''
801siteprefixexp=''
a0d0e21e
LW
802sizetype=''
803so=''
2304df62
AD
804sharpbang=''
805shsharp=''
806spitshell=''
dfe9444c 807src=''
a0d0e21e 808ssizetype=''
4633a7c4 809startperl=''
2304df62
AD
810startsh=''
811stdchar=''
ed39a0f2 812d_stdio_stream_array=''
767df6a1 813stdio_stream_array=''
cf2093f6 814d_strtoull=''
2304df62 815sysman=''
5ff3f7a4 816trnl=''
2304df62 817uidtype=''
85ab1d1d 818archname64=''
5ff3f7a4 819use64bits=''
b0ce926a 820uselongdouble=''
85ab1d1d 821usemultiplicity=''
2304df62 822nm_opt=''
40a7a20a 823nm_so_opt=''
2304df62
AD
824runnm=''
825usenm=''
8ff267be 826useperlio=''
29209bc5 827usesocks=''
693762b4 828d_oldpthreads=''
dfe9444c 829usethreads=''
2304df62
AD
830incpath=''
831mips=''
832mips_type=''
833usrinc=''
a3635516
JH
834d_vendorlib=''
835installvendorlib=''
836vendorlib=''
837vendorlibexp=''
838usevendorprefix=''
839vendorprefix=''
840vendorprefixexp=''
2304df62
AD
841defvoidused=''
842voidflags=''
2304df62
AD
843CONFIG=''
844
ecfc5424
AD
845define='define'
846undef='undef'
847smallmach='pdp11 i8086 z8000 i80286 iAPX286'
848rmlist=''
849
850: We must find out about Eunice early
851eunicefix=':'
852if test -f /etc/unixtovms; then
853 eunicefix=/etc/unixtovms
854fi
855if test -f /etc/unixtovms.exe; then
856 eunicefix=/etc/unixtovms.exe
857fi
858
5ff3f7a4 859i_whoami=''
5ff3f7a4
GS
860: Possible local include directories to search.
861: Set locincpth to "" in a hint file to defeat local include searches.
862locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
863locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
864:
865: no include file wanted by default
866inclwanted=''
867
ecfc5424
AD
868: list of known cpp symbols, sorted alphabetically
869al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
870al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
871al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
872al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
873al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
874al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
875al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
876al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
877al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
878al="$al VMS Xenix286"
5ff3f7a4
GS
879al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
880al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
ecfc5424
AD
881al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
882al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
883al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
884al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
885al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
886al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
887al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
888al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
889al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
890al="$al __SVR4_2__ __UMAXV__"
891al="$al ____386BSD____ __alpha __alpha__ __amiga"
892al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
893al="$al __host_mips__"
894al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
895al="$al __hp9000s500 __hp9000s700 __hp9000s800"
896al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
897al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
898al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
899al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
900al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
901al="$al __mc88100 __mc88100__ __mips __mips__"
902al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
903al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
904al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
905al="$al _host_mips _mips _unix"
906al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
907al="$al apollo ardent att386 att3b"
908al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
909al="$al cadmus clipper concurrent convex cray ctix"
910al="$al dmert encore gcos gcx gimpel gould"
911al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
912al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
913al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
914al="$al i186 i286 i386 i486 i8086"
915al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
916al="$al ksr1 linux luna luna88k m68k m88100 m88k"
917al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
918al="$al mc68040 mc68060 mc68k mc68k32 mc700"
919al="$al mc88000 mc88100 merlin mert mips mvs n16"
920al="$al ncl_el ncl_mr"
921al="$al news1500 news1700 news1800 news1900 news3700"
922al="$al news700 news800 news900 ns16000 ns32000"
923al="$al ns32016 ns32332 ns32k nsc32000 os osf"
924al="$al parisc pc532 pdp11 plexus posix pyr"
925al="$al riscix riscos scs sequent sgi sinix sony sony_news"
926al="$al sonyrisc sparc sparclite spectrum stardent stratos"
927al="$al sun sun3 sun386 svr4 sysV68 sysV88"
928al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
929al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
930al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
931al="$al xenix z8000"
932
dfe9444c 933: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 934_exe=''
dfe9444c
AD
935: Extra object files, if any, needed on this platform.
936archobjs=''
937groupstype=''
732c9516
JH
938: change the next line if compiling for Xenix/286 on Xenix/386
939xlibpth='/usr/lib/386 /lib/386'
940
941: Possible local library directories to search.
942loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
943loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
944
945: general looking path for locating libraries
946glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
947glibpth="$glibpth /lib /usr/lib $xlibpth"
948glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
949glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
950
951: Private path used by Configure to find libraries. Its value
952: is prepended to libpth. This variable takes care of special
953: machines, like the mips. Usually, it should be empty.
954plibpth=''
955
1cfa4ec7
GS
956: default library list
957libswanted=''
921b2963 958: some systems want to use only the non-versioned libso:s
1cfa4ec7 959ignore_versioned_solibs=''
bfb7748a
AD
960: full support for void wanted by default
961defvoidused=15
962
dfe9444c
AD
963: set useposix=false in your hint file to disable the POSIX extension.
964useposix=true
965: set useopcode=false in your hint file to disable the Opcode extension.
966useopcode=true
85ab1d1d 967: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 968: set usesocks on the Configure command line to enable socks.
dfe9444c 969: set usethreads on the Configure command line to enable threads.
ecfc5424 970: List of libraries we want.
693762b4
AD
971: If anyone needs -lnet, put it in a hint file.
972libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 973libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 974libswanted="$libswanted ndir dir crypt sec"
ecfc5424 975libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 976: We probably want to search /usr/shlib before most other libraries.
94b6baf5 977: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
978glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
979glibpth="/usr/shlib $glibpth"
980: Do not use vfork unless overridden by a hint file.
981usevfork=false
982
8ff267be 983: Find the basic shell for Bourne shell scripts
984case "$sh" in
985'')
8ff267be 986 case "$SYSTYPE" in
987 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
988 *) xxx='/bin/sh';;
989 esac
990 if test -f "$xxx"; then
991 sh="$xxx"
992 else
993 : Build up a list and do a single loop so we can 'break' out.
994 pth=`echo $PATH | sed -e "s/$p_/ /g"`
995 for xxx in sh bash ksh pdksh ash; do
996 for p in $pth; do
997 try="$try ${p}/${xxx}"
998 done
999 done
1000 for xxx in $try; do
1001 if test -f "$xxx"; then
1002 sh="$xxx";
8ff267be 1003 break
1004 elif test -f "$xxx.exe"; then
1005 sh="$xxx";
8ff267be 1006 break
1007 fi
1008 done
1009 fi
1010 ;;
1011esac
1012
1013case "$sh" in
1014'') cat <<EOM >&2
1015$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1016
8ff267be 1017Usually it's in /bin/sh. How did you even get this far?
46193409 1018Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 1019we'll try to straighten this all out.
8ff267be 1020EOM
1021 exit 1
1022 ;;
1023esac
1024
760ac839 1025: see if sh knows # comments
8ff267be 1026if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1027 shsharp=true
1028 spitshell=cat
760ac839
LW
1029 xcat=/bin/cat
1030 test -f $xcat || xcat=/usr/bin/cat
1031 echo "#!$xcat" >try
1032 $eunicefix try
1033 chmod +x try
1034 ./try > today
1035 if test -s today; then
760ac839
LW
1036 sharpbang='#!'
1037 else
1038 echo "#! $xcat" > try
1039 $eunicefix try
1040 chmod +x try
1041 ./try > today
1042 if test -s today; then
760ac839
LW
1043 sharpbang='#! '
1044 else
760ac839
LW
1045 sharpbang=': use '
1046 fi
1047 fi
1048else
dfe9444c 1049 echo " "
8ff267be 1050 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1051 shsharp=false
1052 cd ..
1053 echo "exec grep -v '^[ ]*#'" >spitshell
1054 chmod +x spitshell
1055 $eunicefix spitshell
1056 spitshell=`pwd`/spitshell
1057 cd UU
1058 echo "I presume that if # doesn't work, #! won't work either!"
1059 sharpbang=': use '
1060fi
1061rm -f try today
1062
1063: figure out how to guarantee sh startup
8ff267be 1064case "$startsh" in
1065'') startsh=${sharpbang}${sh} ;;
1066*)
760ac839 1067esac
760ac839
LW
1068cat >try <<EOSS
1069$startsh
1070set abc
1071test "$?abc" != 1
1072EOSS
1073
1074chmod +x try
1075$eunicefix try
1076if ./try; then
8ff267be 1077 : echo "Yup, it does."
760ac839 1078else
dfe9444c
AD
1079 echo "Hmm... '$startsh' does not guarantee sh startup..."
1080 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1081fi
1082rm -f try
1083
aebf16e7
AD
1084
1085: Save command line options in file UU/cmdline.opt for later use in
1086: generating config.sh.
1087cat > cmdline.opt <<EOSH
1088# Configure command line arguments.
1089config_arg0='$0'
1090config_args='$*'
1091config_argc=$#
1092EOSH
1093argn=1
1094for arg in "$@"; do
1095 cat >>cmdline.opt <<EOSH
1096config_arg$argn='$arg'
1097EOSH
1098 argn=`expr $argn + 1`
1099done
1100
2304df62
AD
1101: produce awk script to parse command line options
1102cat >options.awk <<'EOF'
1103BEGIN {
16d20bd9 1104 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1105
1106 len = length(optstr);
1107 for (i = 1; i <= len; i++) {
1108 c = substr(optstr, i, 1);
1109 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1110 if (a == ":") {
1111 arg[c] = 1;
1112 i++;
1113 }
1114 opt[c] = 1;
1115 }
1116}
1117{
1118 expect = 0;
1119 str = $0;
1120 if (substr(str, 1, 1) != "-") {
1121 printf("'%s'\n", str);
1122 next;
1123 }
1124 len = length($0);
1125 for (i = 2; i <= len; i++) {
1126 c = substr(str, i, 1);
1127 if (!opt[c]) {
1128 printf("-%s\n", substr(str, i));
1129 next;
1130 }
1131 printf("-%s\n", c);
1132 if (arg[c]) {
1133 if (i < len)
1134 printf("'%s'\n", substr(str, i + 1));
1135 else
1136 expect = 1;
1137 next;
1138 }
1139 }
1140}
1141END {
1142 if (expect)
1143 print "?";
1144}
1145EOF
1146
1147: process the command line options
4633a7c4
LW
1148set X `for arg in "$@"; do echo "X$arg"; done |
1149 sed -e s/X// | awk -f options.awk`
2304df62
AD
1150eval "set $*"
1151shift
1152rm -f options.awk
1153
1154: set up default values
1155fastread=''
1156reuseval=false
1157config_sh=''
1158alldone=''
1159error=''
1160silent=''
1161extractsh=''
ecfc5424 1162override=''
16d20bd9 1163knowitall=''
1aef975c 1164rm -f optdef.sh
28757baa 1165cat >optdef.sh <<EOS
1166$startsh
1167EOS
2304df62 1168
dfe9444c 1169
2304df62
AD
1170: option parsing
1171while test $# -gt 0; do
1172 case "$1" in
1173 -d) shift; fastread=yes;;
1174 -e) shift; alldone=cont;;
1175 -f)
1176 shift
1177 cd ..
1178 if test -r "$1"; then
1179 config_sh="$1"
1180 else
a0d0e21e 1181 echo "$me: cannot read config file $1." >&2
2304df62
AD
1182 error=true
1183 fi
1184 cd UU
1185 shift;;
1186 -h) shift; error=true;;
1187 -r) shift; reuseval=true;;
dfe9444c 1188 -s) shift; silent=true; realsilent=true;;
2304df62 1189 -E) shift; alldone=exit;;
16d20bd9 1190 -K) shift; knowitall=true;;
ecfc5424 1191 -O) shift; override=true;;
dfe9444c 1192 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1193 -D)
1194 shift
1195 case "$1" in
1196 *=)
1197 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1198 echo "$me: ignoring -D $1" >&2
1199 ;;
ecfc5424 1200 *=*) echo "$1" | \
1aef975c
AD
1201 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1202 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1203 esac
1204 shift
1205 ;;
1206 -U)
1207 shift
1208 case "$1" in
1aef975c 1209 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1210 *=*)
1211 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1212 echo "$me: ignoring -U $1" >&2
1213 ;;
1aef975c 1214 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1215 esac
1216 shift
1217 ;;
dfe9444c 1218 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
2304df62
AD
1219 exit 0;;
1220 --) break;;
a0d0e21e 1221 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1222 *) break;;
1223 esac
1224done
1225
1226case "$error" in
1227true)
1228 cat >&2 <<EOM
2afac517 1229Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 1230 [-U symbol] [-U symbol=]
2304df62
AD
1231 -d : use defaults for all answers.
1232 -e : go on without questioning past the production of config.sh.
1233 -f : specify an alternate default configuration file.
1234 -h : print this help message and exit (with an error status).
1235 -r : reuse C symbols value if possible (skips costly nm extraction).
1236 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1237 -D : define symbol to have some value:
1238 -D symbol symbol gets the value 'define'
1239 -D symbol=value symbol gets the value 'value'
2304df62 1240 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1241 -K : do not use unless you know what you are doing.
ecfc5424 1242 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1243 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1244 -U : undefine symbol:
1245 -U symbol symbol gets the value 'undef'
1246 -U symbol= symbol gets completely empty
2304df62
AD
1247 -V : print version number and exit (with a zero status).
1248EOM
1249 exit 1
1250 ;;
1251esac
1252
dfe9444c
AD
1253: Sanity checks
1254case "$fastread$alldone" in
1255yescont|yesexit) ;;
1256*)
1257 if test ! -t 0; then
1258 echo "Say 'sh Configure', not 'sh <Configure'"
1259 exit 1
1260 fi
1261 ;;
1262esac
1263
2304df62
AD
1264exec 4>&1
1265case "$silent" in
1266true) exec 1>/dev/null;;
1267esac
1268
ecfc5424 1269: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1270touch optdef.sh
1271. ./optdef.sh
a0d0e21e 1272
2304df62 1273: set package name
85e6fe83 1274package=perl5
1aef975c
AD
1275first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1276last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1277case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1278ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1279*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1280esac
2304df62 1281
2304df62
AD
1282: Some greps do not return status, grrr.
1283echo "grimblepritz" >grimble
1284if grep blurfldyick grimble >/dev/null 2>&1 ; then
1285 contains=contains
1286elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1287 contains=grep
1288else
1289 contains=contains
1290fi
1291rm -f grimble
1292: the following should work in any shell
1293case "$contains" in
1294contains*)
1295 echo " "
1296 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1297 cat >contains <<'EOSS'
1298grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1299EOSS
1300chmod +x contains
1301esac
1302
dfe9444c
AD
1303: Find the path to the source tree
1304case "$src" in
1305'') case "$0" in
b233458b
JH
1306 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1307 case "$src" in
1308 /*) ;;
1309 *) src=`cd ../$src && pwd` ;;
1310 esac
1311 ;;
dfe9444c
AD
1312 *) src='.';;
1313 esac;;
1314esac
1315case "$src" in
1316'') src=/
1317 rsrc=/
1318 ;;
1319/*) rsrc="$src";;
1320*) rsrc="../$src";;
1321esac
1322if test -f $rsrc/Configure && \
1323 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1324then
1325 : found it, so we are ok.
1326else
1327 rsrc=''
1328 for src in . .. ../.. ../../.. ../../../..; do
1329 if test -f ../$src/Configure && \
1330 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1331 then
1332 rsrc=../$src
1333 break
1334 fi
1335 done
1336fi
1337case "$rsrc" in
1338'')
1339 cat <<EOM >&4
1340
1341Sorry, I can't seem to locate the source dir for $package. Please start
1342Configure with an explicit path -- i.e. /some/path/Configure.
1343
1344EOM
1345 exit 1
1346 ;;
1347../.) rsrc='..';;
1348*)
1349 echo " "
1350 echo "Sources for $package found in \"$src\"." >&4
1351 ;;
1352esac
1353
1354: script used to extract .SH files with variable substitutions
1355cat >extract <<'EOS'
2000072c 1356CONFIGDOTSH=true
dfe9444c
AD
1357echo "Doing variable substitutions on .SH files..."
1358if test -f $src/MANIFEST; then
f7ab18e9 1359 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1360else
1361 echo "(Looking for .SH files under the source directory.)"
1362 set x `(cd $src; find . -name "*.SH" -print)`
1363fi
1364shift
1365case $# in
13660) set x `(cd $src; echo *.SH)`; shift;;
1367esac
1368if test ! -f $src/$1; then
1369 shift
1370fi
1371mkdir_p='
1372name=$1;
1373create="";
1374while test $name; do
1375 if test ! -d "$name"; then
1376 create="$name $create";
1377 name=`echo $name | sed -e "s|^[^/]*$||"`;
1378 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1379 else
1380 name="";
1381 fi;
1382done;
1383for file in $create; do
1384 mkdir $file;
1385done
1386'
1387for file in $*; do
1388 case "$src" in
1389 ".")
1390 case "$file" in
1391 */*)
1392 dir=`expr X$file : 'X\(.*\)/'`
1393 file=`expr X$file : 'X.*/\(.*\)'`
1394 (cd $dir && . ./$file)
1395 ;;
1396 *)
1397 . ./$file
1398 ;;
1399 esac
1400 ;;
1401 *)
1402 case "$file" in
1403 */*)
1404 dir=`expr X$file : 'X\(.*\)/'`
1405 file=`expr X$file : 'X.*/\(.*\)'`
1406 (set x $dir; shift; eval $mkdir_p)
1407 sh <$src/$dir/$file
1408 ;;
1409 *)
1410 sh <$src/$file
1411 ;;
1412 esac
1413 ;;
1414 esac
1415done
1416if test -f $src/config_h.SH; then
1417 if test ! -f config.h; then
1418 : oops, they left it out of MANIFEST, probably, so do it anyway.
1419 . $src/config_h.SH
1420 fi
1421fi
1422EOS
1423
1424: extract files and exit if asked to do so
1425case "$extractsh" in
1426true)
1427 case "$realsilent" in
1428 true) ;;
1429 *) exec 1>&4;;
1430 esac
1431 case "$config_sh" in
1432 '') config_sh='config.sh';;
1433 esac
1434 echo " "
1435 echo "Fetching answers from $config_sh..."
1436 cd ..
1437 . $config_sh
1438 test "$override" && . ./optdef.sh
1439 echo " "
1440 . UU/extract
1441 rm -rf UU
1442 echo "Done."
1443 exit 0
1444 ;;
1445esac
1446
1447: Eunice requires " " instead of "", can you believe it
1448echo " "
1449: Here we go...
1450echo "Beginning of configuration questions for $package."
1451
1452trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1453
2304df62
AD
1454: first determine how to suppress newline on echo command
1455echo " "
1456echo "Checking echo to see how to suppress newlines..."
1457(echo "hi there\c" ; echo " ") >.echotmp
1458if $contains c .echotmp >/dev/null 2>&1 ; then
1459 echo "...using -n."
1460 n='-n'
1461 c=''
1462else
1463 cat <<'EOM'
1464...using \c
1465EOM
1466 n=''
1467 c='\c'
1468fi
1469echo $n "The star should be here-->$c"
1470echo '*'
1471rm -f .echotmp
1472
1473: Now test for existence of everything in MANIFEST
1474echo " "
dfe9444c 1475if test -f $rsrc/MANIFEST; then
2304df62 1476 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1477 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1478 rm -f missing
dfe9444c 1479 tmppwd=`pwd`
2304df62 1480 for filelist in x??; do
dfe9444c 1481 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1482 done
1483 if test -s missing; then
1484 cat missing >&4
1485 cat >&4 <<'EOM'
1486
1487THIS PACKAGE SEEMS TO BE INCOMPLETE.
1488
1489You have the option of continuing the configuration process, despite the
1490distinct possibility that your kit is damaged, by typing 'y'es. If you
1491do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1492and contact the author (perlbug@perl.com).
2304df62
AD
1493
1494EOM
1495 echo $n "Continue? [n] $c" >&4
1496 read ans
1497 case "$ans" in
1498 y*)
1499 echo "Continuing..." >&4
1500 rm -f missing
1501 ;;
1502 *)
1503 echo "ABORTING..." >&4
1504 kill $$
1505 ;;
1506 esac
1507 else
dfe9444c 1508 echo "Looks good..."
2304df62
AD
1509 fi
1510else
1511 echo "There is no MANIFEST file. I hope your kit is complete !"
1512fi
1513rm -f missing x??
1514
5ff3f7a4
GS
1515echo " "
1516: Find the appropriate value for a newline for tr
1517if test -n "$DJGPP"; then
1518 trnl='\012'
1519fi
1520if test X"$trnl" = X; then
1521 case "`echo foo|tr '\n' x 2>/dev/null`" in
1522 foox) trnl='\n' ;;
1523 esac
1524fi
1525if test X"$trnl" = X; then
1526 case "`echo foo|tr '\012' x 2>/dev/null`" in
1527 foox) trnl='\012' ;;
1528 esac
1529fi
1530if test X"$trnl" = X; then
1531 cat <<EOM >&2
1532
1533$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1534
1535EOM
1536 exit 1
1537fi
1538
2304df62
AD
1539: compute the number of columns on the terminal for proper question formatting
1540case "$COLUMNS" in
1541'') COLUMNS='80';;
1542esac
1543
1544: set up the echo used in my read
1545myecho="case \"\$xxxm\" in
1546'') echo $n \"\$rp $c\" >&4;;
1547*) case \"\$rp\" in
1548 '') echo $n \"[\$xxxm] $c\";;
1549 *)
1550 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1551 echo \"\$rp\" >&4
1552 echo $n \"[\$xxxm] $c\" >&4
1553 else
1554 echo $n \"\$rp [\$xxxm] $c\" >&4
1555 fi
1556 ;;
1557 esac;;
1558esac"
1559
1560: now set up to do reads with possible shell escape and default assignment
1561cat <<EOSC >myread
28757baa 1562$startsh
2304df62
AD
1563xxxm=\$dflt
1564$myecho
1565ans='!'
1566case "\$fastread" in
1567yes) case "\$dflt" in
1568 '') ;;
1569 *) ans='';
1570 case "\$silent-\$rp" in
1571 true-) ;;
1572 *) echo " " >&4;;
1573 esac;;
1574 esac;;
1575*) case "\$silent" in
1576 true) case "\$rp" in
1577 '') ans='';;
1578 esac;;
1579 esac;;
1580esac
1581while expr "X\$ans" : "X!" >/dev/null; do
1582 read answ
1583 set x \$xxxm
1584 shift
dfe9444c 1585 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1586 case "\$answ" in
dfe9444c
AD
1587 "!")
1588 sh 1>&4
1589 echo " "
1590 $myecho
1591 ;;
1592 !*)
1593 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1594 shift
1595 sh 1>&4 -c "\$*"
1596 echo " "
1597 $myecho
1598 ;;
2304df62
AD
1599 "\$ans")
1600 case "\$ans" in
ecfc5424
AD
1601 \\&*)
1602 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1603 shift
1604 case "\$1" in
1605 -d)
1606 fastread=yes
40a7a20a 1607 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1608 ;;
1609 -*)
40a7a20a 1610 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1611 ;;
1612 esac
1613 $myecho
1614 ans=!
1615 ;;
2304df62
AD
1616 esac;;
1617 *)
1618 case "\$aok" in
1619 y)
1620 echo "*** Substitution done -- please confirm."
1621 xxxm="\$ans"
c9795ab7 1622 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1623 xxxm="\$ans"
1624 ans=!
1625 ;;
1626 *)
1627 echo "*** Error -- try again."
1628 ans=!
1629 ;;
1630 esac
1631 $myecho
1632 ;;
1633 esac
1634 case "\$ans\$xxxm\$nostick" in
1635 '')
1636 ans=!
1637 $myecho
1638 ;;
1639 esac
1640done
1641case "\$ans" in
1642'') ans="\$xxxm";;
1643esac
1644EOSC
1645
1646: create .config dir to save info across Configure sessions
1647test -d ../.config || mkdir ../.config
1648cat >../.config/README <<EOF
1649This directory created by Configure to save information that should
dfe9444c 1650persist across sessions for $package.
2304df62
AD
1651
1652You may safely delete it if you wish.
1653EOF
1654
1655: general instructions
1656needman=true
1657firsttime=true
760ac839 1658user=`(logname) 2>/dev/null`
dfe9444c
AD
1659case "$user" in
1660'') user=`whoami 2>&1`;;
760ac839 1661esac
2304df62
AD
1662if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1663 firsttime=false
1664 echo " "
1665 rp='Would you like to see the instructions?'
1666 dflt=n
1667 . ./myread
1668 case "$ans" in
1669 [yY]*) ;;
1670 *) needman=false;;
1671 esac
1672fi
1673if $needman; then
1674 cat <<EOH
4e2a5f63 1675
2304df62 1676This installation shell script will examine your system and ask you questions
a0d0e21e 1677to determine how the perl5 package should be installed. If you get
2304df62
AD
1678stuck on a question, you may use a ! shell escape to start a subshell or
1679execute a command. Many of the questions will have default answers in square
1680brackets; typing carriage return will give you the default.
1681
1682On some of the questions which ask for file or directory names you are allowed
1683to use the ~name construct to specify the login directory belonging to "name",
1684even if you don't have a shell which knows about that. Questions where this is
1685allowed will be marked "(~name ok)".
1686
1687EOH
1688 rp=''
1689 dflt='Type carriage return to continue'
1690 . ./myread
1691 cat <<'EOH'
1692
1693The prompter used in this script allows you to use shell variables and
1694backticks in your answers. You may use $1, $2, etc... to refer to the words
1695in the default answer, as if the default line was a set of arguments given to a
1696script shell. This means you may also use $* to repeat the whole default line,
1697so you do not have to re-type everything to add something to the default.
1698
1699Everytime there is a substitution, you will have to confirm. If there is an
1700error (e.g. an unmatched backtick), the default answer will remain unchanged
1701and you will be prompted again.
1702
1703If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1704the questions and use the computed defaults (or the previous answers if there
1705was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1706You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1707on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1708
1709EOH
1710 . ./myread
1711 cat <<EOH
1712
1713Much effort has been expended to ensure that this shell script will run on any
1714Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1715Configure and run it again. If you can't run Configure for some reason,
1716you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1717have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1718
1719This installation script affects things in two ways:
1720
17211) it may do direct variable substitutions on some of the files included
1722 in this kit.
17232) it builds a config.h file for inclusion in C programs. You may edit
1724 any of these files as the need arises after running this script.
1725
1726If you make a mistake on a question, there is no easy way to back up to it
1727currently. The easiest thing to do is to edit config.sh and rerun all the SH
1728files. Configure will offer to let you do this before it runs the SH files.
1729
1730EOH
1731 dflt='Type carriage return to continue'
1732 . ./myread
1733 case "$firsttime" in
1734 true) echo $user >>../.config/instruct;;
1735 esac
1736fi
1737
2304df62
AD
1738: find out where common programs are
1739echo " "
1740echo "Locating common programs..." >&4
1741cat <<EOSC >loc
1742$startsh
1743case \$# in
17440) exit 1;;
1745esac
1746thing=\$1
1747shift
1748dflt=\$1
1749shift
1750for dir in \$*; do
1751 case "\$thing" in
1752 .)
1753 if test -d \$dir/\$thing; then
1754 echo \$dir
1755 exit 0
1756 fi
1757 ;;
1758 *)
a0d0e21e 1759 for thisthing in \$dir/\$thing; do
ecfc5424 1760 : just loop through to pick last item
a0d0e21e 1761 done
25f94b33 1762 if test -f \$thisthing; then
a0d0e21e 1763 echo \$thisthing
2304df62
AD
1764 exit 0
1765 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1766 if test -n "$DJGPP"; then
1767 echo \$dir/\$thing.exe
1768 else
1769 : on Eunice apparently
1770 echo \$dir/\$thing
1771 fi
2304df62
AD
1772 exit 0
1773 fi
1774 ;;
1775 esac
1776done
1777echo \$dflt
1778exit 1
1779EOSC
1780chmod +x loc
1781$eunicefix loc
1782loclist="
1783awk
1784cat
ecfc5424 1785comm
2304df62
AD
1786cp
1787echo
1788expr
1789grep
a0d0e21e 1790ls
dfe9444c 1791make
2304df62 1792mkdir
2304df62
AD
1793rm
1794sed
1795sort
85e6fe83 1796touch
2304df62
AD
1797tr
1798uniq
1799"
1800trylist="
1801Mcc
dfe9444c 1802ar
2304df62
AD
1803byacc
1804cpp
1805csh
1806date
1807egrep
8ff267be 1808gzip
2c7991dc 1809less
8ff267be 1810ln
2c7991dc 1811more
693762b4 1812nm
2304df62 1813nroff
2c7991dc 1814pg
2304df62
AD
1815test
1816uname
8ff267be 1817zip
2304df62 1818"
8e07c86e 1819pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1820pth="$pth /lib /usr/lib"
1821for file in $loclist; do
dfe9444c
AD
1822 eval xxx=\$$file
1823 case "$xxx" in
1824 /*|?:[\\/]*)
1825 if test -f "$xxx"; then
1826 : ok
1827 else
1828 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1829 xxx=`./loc $file $file $pth`
1830 fi
1831 ;;
1832 '') xxx=`./loc $file $file $pth`;;
1833 *) xxx=`./loc $xxx $xxx $pth`;;
1834 esac
2304df62
AD
1835 eval $file=$xxx
1836 eval _$file=$xxx
1837 case "$xxx" in
1838 /*)
1839 echo $file is in $xxx.
1840 ;;
8e07c86e
AD
1841 ?:[\\/]*)
1842 echo $file is in $xxx.
1843 ;;
2304df62 1844 *)
25f94b33
AD
1845 echo "I don't know where '$file' is, and my life depends on it." >&4
1846 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1847 exit 1
2304df62
AD
1848 ;;
1849 esac
1850done
1851echo " "
1852echo "Don't worry if any of the following aren't found..."
1853say=offhand
1854for file in $trylist; do
dfe9444c
AD
1855 eval xxx=\$$file
1856 case "$xxx" in
1857 /*|?:[\\/]*)
1858 if test -f "$xxx"; then
1859 : ok
1860 else
1861 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1862 xxx=`./loc $file $file $pth`
1863 fi
1864 ;;
1865 '') xxx=`./loc $file $file $pth`;;
1866 *) xxx=`./loc $xxx $xxx $pth`;;
1867 esac
2304df62
AD
1868 eval $file=$xxx
1869 eval _$file=$xxx
1870 case "$xxx" in
1871 /*)
1872 echo $file is in $xxx.
1873 ;;
8e07c86e
AD
1874 ?:[\\/]*)
1875 echo $file is in $xxx.
1876 ;;
2304df62
AD
1877 *)
1878 echo "I don't see $file out there, $say."
1879 say=either
1880 ;;
1881 esac
1882done
1883case "$egrep" in
1884egrep)
1885 echo "Substituting grep for egrep."
1886 egrep=$grep
1887 ;;
1888esac
8ff267be 1889case "$ln" in
1890ln)
1891 echo "Substituting cp for ln."
1892 ln=$cp
1893 ;;
1894esac
2304df62
AD
1895case "$test" in
1896test)
1897 echo "Hopefully test is built into your sh."
1898 ;;
1899*)
ecfc5424 1900 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1901 echo "Using the test built into your sh."
1902 test=test
1903 _test=test
1904 fi
1905 ;;
1906esac
1907case "$echo" in
1908echo)
1909 echo "Hopefully echo is built into your sh."
1910 ;;
1911'') ;;
1912*)
1913 echo " "
1914echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1915 $echo $n "hi there$c" >foo1
1916 echo $n "hi there$c" >foo2
1917 if cmp foo1 foo2 >/dev/null 2>&1; then
1918 echo "They are compatible. In fact, they may be identical."
1919 else
1920 case "$n" in
1921 '-n') n='' c='\c';;
1922 *) n='-n' c='';;
1923 esac
1924 cat <<FOO
1925They are not compatible! You are probably running ksh on a non-USG system.
1926I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1927have echo built in and we may have to run some Bourne shell scripts. That
1928means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1929
1930FOO
1931 $echo $n "The star should be here-->$c"
1932 $echo "*"
1933 fi
1934 $rm -f foo1 foo2
1935 ;;
1936esac
1937
a0d0e21e
LW
1938: determine whether symbolic links are supported
1939echo " "
1940$touch blurfl
1941if $ln -s blurfl sym > /dev/null 2>&1 ; then
1942 echo "Symbolic links are supported." >&4
1943 lns="$ln -s"
1944else
1945 echo "Symbolic links are NOT supported." >&4
1946 lns="$ln"
1947fi
1948$rm -f blurfl sym
1949
ecfc5424
AD
1950: see whether [:lower:] and [:upper:] are supported character classes
1951echo " "
ecfc5424
AD
1952case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1953ABYZ)
1954 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1955 up='[:upper:]'
1956 low='[:lower:]'
1957 ;;
28e8609d
JH
1958*) # There is a discontinuity in EBCDIC between 'I' and 'J'
1959 # (0xc9 and 0xd1), therefore that is a nice testing point.
1960 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1961 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
1962 ij) up='[A-Z]'
1963 low='[a-z]'
1964 ;;
1965 esac
1966 fi
1967 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1968 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
1969 ij) up='A-Z'
1970 low='a-z'
1971 ;;
1972 esac
1973 fi
1974 if test "X$up" = X -o "X$low" = X; then
1975 case "`echo IJ | od -x 2>/dev/null`" in
1976 *C9D1*|*c9d1*)
1977 echo "Hey, this might be EBCDIC." >&4
1978 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 1979 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
1980 ij) up='[A-IJ-RS-Z]'
1981 low='[a-ij-rs-z]'
1982 ;;
1983 esac
1984 fi
1985 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 1986 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
1987 ij) up='A-IJ-RS-Z'
1988 low='a-ij-rs-z'
1989 ;;
1990 esac
1991 fi
1992 ;;
1993 esac
1994 fi
1995esac
3eaeeeae 1996case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
1997ij)
1998 echo "Using $up and $low to convert case." >&4
1999 ;;
ecfc5424 2000*)
28e8609d
JH
2001 echo "I don't know how to translate letters from upper to lower case." >&4
2002 echo "Your tr is not acting any way I know of." >&4
2003 exit 1
2004 ;;
ecfc5424
AD
2005esac
2006: set up the translation script tr, must be called with ./tr of course
2007cat >tr <<EOSC
2008$startsh
2009case "\$1\$2" in
2010'[A-Z][a-z]') exec $tr '$up' '$low';;
2011'[a-z][A-Z]') exec $tr '$low' '$up';;
2012esac
2013exec $tr "\$@"
2014EOSC
2015chmod +x tr
2016$eunicefix tr
2017
2304df62
AD
2018: Try to determine whether config.sh was made on this system
2019case "$config_sh" in
2020'')
2021myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
2022# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2023# because the A-Z/a-z are not consecutive.
a0d0e21e 2024myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2025 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2026newmyuname="$myuname"
2304df62 2027dflt=n
16d20bd9
AD
2028case "$knowitall" in
2029'')
2030 if test -f ../config.sh; then
2031 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2032 eval "`grep myuname= ../config.sh`"
2033 fi
2034 if test "X$myuname" = "X$newmyuname"; then
2035 dflt=y
2036 fi
2304df62 2037 fi
16d20bd9
AD
2038 ;;
2039*) dflt=y;;
2040esac
2304df62
AD
2041
2042: Get old answers from old config file if Configure was run on the
2043: same system, otherwise use the hints.
2044hint=default
2045cd ..
2046if test -f config.sh; then
16d20bd9
AD
2047 echo " "
2048 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2049 . UU/myread
2050 case "$ans" in
2051 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2052 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2053 tmp_n="$n"
2054 tmp_c="$c"
85cad39c 2055 tmp_sh="$sh"
2304df62
AD
2056 . ./config.sh
2057 cp config.sh UU
ecfc5424
AD
2058 n="$tmp_n"
2059 c="$tmp_c"
85cad39c 2060 : Older versions did not always set $sh. Catch re-use of such
2061 : an old config.sh.
2062 case "$sh" in
2063 '') sh="$tmp_sh" ;;
2064 esac
2304df62
AD
2065 hint=previous
2066 ;;
2067 esac
2068fi
2069if test ! -f config.sh; then
2070 $cat <<EOM
2071
4e2a5f63
AD
2072First time through, eh? I have some defaults handy for some systems
2073that need some extra help getting the Configure answers right:
2304df62
AD
2074
2075EOM
dfe9444c 2076 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2077 dflt=''
2078 : Half the following guesses are probably wrong... If you have better
46193409 2079 : tests or hints, please send them to perlbug@perl.com
2304df62 2080 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2081 $test -f /irix && osname=irix
85e6fe83
LW
2082 $test -f /xenix && osname=sco_xenix
2083 $test -f /dynix && osname=dynix
2084 $test -f /dnix && osname=dnix
5f05dabc 2085 $test -f /lynx.os && osname=lynxos
2086 $test -f /unicos && osname=unicos && osvers=`$uname -r`
7a4c00b4 2087 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2088 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2089 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2090 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2091 $test -d /usr/apollo/bin && osname=apollo
2092 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2093 $test -d /usr/include/minix && osname=minix
e060872b 2094 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2095 osname=machten
4633a7c4 2096 if $test -x /sbin/version; then
dfe9444c 2097 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2098 $sed -e 's/[A-Za-z]$//'`
2099 elif $test -x /usr/etc/version; then
dfe9444c 2100 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2101 $sed -e 's/[A-Za-z]$//'`
2102 else
2103 osvers="$2.$3"
2104 fi
2105 fi
85ab1d1d
JH
2106 $test -f /sys/posix.dll &&
2107 $test -f /usr/bin/what &&
2108 set X `/usr/bin/what /sys/posix.dll` &&
2109 $test "$3" = UWIN &&
2110 osname=uwin &&
2111 osvers="$5"
2304df62
AD
2112 if $test -f $uname; then
2113 set X $myuname
2114 shift
2115
2304df62 2116 case "$5" in
85e6fe83 2117 fps*) osname=fps ;;
2304df62
AD
2118 mips*)
2119 case "$4" in
85e6fe83
LW
2120 umips) osname=umips ;;
2121 *) osname=mips ;;
2304df62 2122 esac;;
85e6fe83
LW
2123 [23]100) osname=mips ;;
2124 next*) osname=next ;;
ecfc5424 2125 i386*)
c6912327
JH
2126 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2127 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2128 osname='sco'
2129 osvers=$tmp
2130 elif $test -f /etc/kconfig; then
ecfc5424 2131 osname=isc
bd628c73 2132 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2133 osvers=4
2134 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2135 osvers=3
2304df62 2136 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2137 osvers=2
ecfc5424
AD
2138 fi
2139 fi
2000072c 2140 tmp=''
ecfc5424 2141 ;;
c4f23d77
AD
2142 pc*)
2143 if test -n "$DJGPP"; then
2144 osname=dos
2145 osvers=djgpp
2146 fi
2147 ;;
2304df62
AD
2148 esac
2149
2150 case "$1" in
a0d0e21e
LW
2151 aix) osname=aix
2152 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2153 case "$tmp" in
1aef975c 2154 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2155 '<3240'|'<>3240') osvers=3.2.0 ;;
2156 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2157 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2158 *) osvers=$tmp;;
a0d0e21e
LW
2159 esac
2160 ;;
23f87696
SZ
2161 *dc.osx) osname=dcosx
2162 osvers="$3"
2163 ;;
a0d0e21e
LW
2164 dnix) osname=dnix
2165 osvers="$3"
2166 ;;
2167 domainos) osname=apollo
2168 osvers="$3"
2169 ;;
2170 dgux) osname=dgux
2171 osvers="$3"
2172 ;;
760ac839 2173 dynixptx*) osname=dynixptx
e58e581d 2174 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2175 ;;
a0d0e21e
LW
2176 freebsd) osname=freebsd
2177 osvers="$3" ;;
2178 genix) osname=genix ;;
2179 hp*) osname=hpux
bfb7748a 2180 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2181 ;;
a78b0d02 2182 irix*) osname=irix
a0d0e21e
LW
2183 case "$3" in
2184 4*) osvers=4 ;;
2185 5*) osvers=5 ;;
ecfc5424 2186 *) osvers="$3" ;;
a0d0e21e
LW
2187 esac
2188 ;;
2189 linux) osname=linux
2190 case "$3" in
a0d0e21e
LW
2191 *) osvers="$3" ;;
2192 esac
2193 ;;
28e8609d
JH
2194 MiNT) osname=mint
2195 ;;
2196 netbsd*) osname=netbsd
ecfc5424
AD
2197 osvers="$3"
2198 ;;
4e81affe
MM
2199 news-os) osvers="$3"
2200 case "$3" in
2201 4*) osname=newsos4 ;;
2202 *) osname=newsos ;;
2203 esac
2204 ;;
a0d0e21e
LW
2205 bsd386) osname=bsd386
2206 osvers=`$uname -r`
2207 ;;
a1a0e61e
TD
2208 POSIX-BC | posix-bc ) osname=posix-bc
2209 osvers="$3"
2210 ;;
ae3afa4e
TH
2211 powerux | power_ux | powermax_os | powermaxos | \
2212 powerunix | power_unix) osname=powerux
2213 osvers="$3"
2214 ;;
a0d0e21e
LW
2215 next*) osname=next ;;
2216 solaris) osname=solaris
2217 case "$3" in
2218 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2219 *) osvers="$3" ;;
a0d0e21e
LW
2220 esac
2221 ;;
85e6fe83
LW
2222 sunos) osname=sunos
2223 case "$3" in
85e6fe83
LW
2224 5*) osname=solaris
2225 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2226 *) osvers="$3" ;;
2304df62
AD
2227 esac
2228 ;;
a0d0e21e 2229 titanos) osname=titanos
85e6fe83 2230 case "$3" in
a0d0e21e
LW
2231 1*) osvers=1 ;;
2232 2*) osvers=2 ;;
2233 3*) osvers=3 ;;
2234 4*) osvers=4 ;;
ecfc5424 2235 *) osvers="$3" ;;
2304df62
AD
2236 esac
2237 ;;
85e6fe83 2238 ultrix) osname=ultrix
ecfc5424 2239 osvers="$3"
2304df62 2240 ;;
28757baa 2241 osf1|mls+) case "$5" in
fed7345c
AD
2242 alpha)
2243 osname=dec_osf
313489a2 2244 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2245 ;;
2246 hp*) osname=hp_osf1 ;;
2247 mips) osname=mips_osf1 ;;
85e6fe83
LW
2248 esac
2249 ;;
a0d0e21e
LW
2250 uts) osname=uts
2251 osvers="$3"
2252 ;;
ff68c719 2253 qnx) osname=qnx
2254 osvers="$4"
2255 ;;
85e6fe83 2256 $2) case "$osname" in
2304df62 2257 *isc*) ;;
a0d0e21e 2258 *freebsd*) ;;
5f05dabc 2259 svr*)
a0d0e21e
LW
2260 : svr4.x or possibly later
2261 case "svr$3" in
2262 ${osname}*)
2263 osname=svr$3
2264 osvers=$4
2265 ;;
2266 esac
2267 case "$osname" in
2268 svr4.0)
2269 : Check for ESIX
2270 if test -f /stand/boot ; then
2271 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2272 if test -n "$INITPROG" -a -f "$INITPROG"; then
2273 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2274 if test -n "$isesix"; then
a0d0e21e
LW
2275 osname=esix4
2276 fi
2277 fi
2278 fi
2279 ;;
2280 esac
2281 ;;
2304df62 2282 *) if test -f /etc/systemid; then
a0d0e21e
LW
2283 osname=sco
2284 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2285 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2286 osvers=$1.$2.$3
c4f23d77 2287 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2288 osvers=$1.$2
c4f23d77 2289 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2290 osvers=$1
2304df62 2291 fi
a0d0e21e
LW
2292 else
2293 case "$osname" in
2294 '') : Still unknown. Probably a generic Sys V.
2295 osname="sysv"
2296 osvers="$3"
2297 ;;
2298 esac
2304df62
AD
2299 fi
2300 ;;
2301 esac
2302 ;;
a0d0e21e
LW
2303 *) case "$osname" in
2304 '') : Still unknown. Probably a generic BSD.
2305 osname="$1"
2306 osvers="$3"
2307 ;;
2308 esac
2309 ;;
2304df62
AD
2310 esac
2311 else
dfe9444c
AD
2312 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2313 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2314 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2315 osname=news_os
2304df62 2316 fi
dfe9444c 2317 $rm -f UU/kernel.what
8e07c86e
AD
2318 elif test -d c:/.; then
2319 set X $myuname
2320 osname=os2
2321 osvers="$5"
2304df62
AD
2322 fi
2323 fi
85e6fe83 2324
a0d0e21e
LW
2325 : Now look for a hint file osname_osvers, unless one has been
2326 : specified already.
2327 case "$hintfile" in
2328 ''|' ')
ecfc5424 2329 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2330 : Also try without trailing minor version numbers.
ecfc5424
AD
2331 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2332 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2333 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2334 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2335 case "$file" in
2336 '') dflt=none ;;
2337 *) case "$osvers" in
2338 '') dflt=$file
2339 ;;
dfe9444c 2340 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2341 dflt=$file
dfe9444c 2342 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2343 dflt=$xfile
dfe9444c 2344 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2345 dflt=$xxfile
dfe9444c 2346 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2347 dflt=$xxxfile
dfe9444c 2348 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2349 dflt=$xxxxfile
dfe9444c 2350 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2351 dflt="${osname}"
2352 else
2353 dflt=none
2354 fi
2355 ;;
2356 esac
85e6fe83
LW
2357 ;;
2358 esac
4e2a5f63
AD
2359 if $test -f Policy.sh ; then
2360 case "$dflt" in
2361 *Policy*) ;;
2362 none) dflt="Policy" ;;
2363 *) dflt="Policy $dflt" ;;
2364 esac
2365 fi
85e6fe83 2366 ;;
a0d0e21e 2367 *)
ecfc5424 2368 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2369 ;;
2304df62 2370 esac
1aef975c 2371
4e2a5f63
AD
2372 if $test -f Policy.sh ; then
2373 $cat <<EOM
2374
2375There's also a Policy hint file available, which should make the
2376site-specific (policy) questions easier to answer.
2377EOM
2378
2379 fi
2380
2304df62
AD
2381 $cat <<EOM
2382
2383You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2384A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2385is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2386
2387EOM
4e2a5f63 2388
2304df62 2389 rp="Which of these apply, if any?"
dfe9444c 2390 . UU/myread
85e6fe83
LW
2391 tans=$ans
2392 for file in $tans; do
4e2a5f63
AD
2393 if $test X$file = XPolicy -a -f Policy.sh; then
2394 . Policy.sh
2395 $cat Policy.sh >> UU/config.sh
2396 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2397 . $src/hints/$file.sh
2398 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2399 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2400 : nothing
2401 else
85e6fe83
LW
2402 : Give one chance to correct a possible typo.
2403 echo "$file.sh does not exist"
2404 dflt=$file
2405 rp="hint to use instead?"
dfe9444c 2406 . UU/myread
85e6fe83 2407 for file in $ans; do
dfe9444c
AD
2408 if $test -f "$src/hints/$file.sh"; then
2409 . $src/hints/$file.sh
2410 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2411 elif $test X$ans = X -o X$ans = Xnone ; then
2412 : nothing
2413 else
2414 echo "$file.sh does not exist -- ignored."
2415 fi
2416 done
2304df62
AD
2417 fi
2418 done
85e6fe83 2419
2304df62 2420 hint=recommended
85e6fe83 2421 : Remember our hint file for later.
dfe9444c 2422 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2423 hintfile="$file"
85e6fe83 2424 else
a0d0e21e 2425 hintfile=''
85e6fe83 2426 fi
2304df62
AD
2427fi
2428cd UU
2429;;
2430*)
2431 echo " "
2432 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2433 tmp_n="$n"
2434 tmp_c="$c"
2304df62
AD
2435 cd ..
2436 cp $config_sh config.sh 2>/dev/null
a78b0d02 2437 chmod +w config.sh
2304df62
AD
2438 . ./config.sh
2439 cd UU
2440 cp ../config.sh .
ecfc5424
AD
2441 n="$tmp_n"
2442 c="$tmp_c"
2304df62
AD
2443 hint=previous
2444 ;;
2445esac
1aef975c
AD
2446test "$override" && . ./optdef.sh
2447myuname="$newmyuname"
2304df62
AD
2448
2449: Restore computed paths
2450for file in $loclist $trylist; do
2451 eval $file="\$_$file"
2452done
2453
85e6fe83 2454cat << EOM
a0d0e21e 2455
85e6fe83 2456Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2457The default value is probably right if the name rings a bell. Otherwise,
2458since spelling matters for me, either accept the default or answer "none"
2459to leave it blank.
a0d0e21e 2460
85e6fe83 2461EOM
85e6fe83 2462case "$osname" in
a0d0e21e 2463 ''|' ')
85e6fe83 2464 case "$hintfile" in
a0d0e21e 2465 ''|' '|none) dflt=none ;;
ecfc5424 2466 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2467 esac
2468 ;;
2469 *) dflt="$osname" ;;
2470esac
2471rp="Operating system name?"
2472. ./myread
2473case "$ans" in
ecfc5424
AD
2474none) osname='' ;;
2475*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2476esac
8ff267be 2477echo " "
2478case "$osvers" in
2479 ''|' ')
2480 case "$hintfile" in
2481 ''|' '|none) dflt=none ;;
2482 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2483 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2484 case "$dflt" in
2485 ''|' ') dflt=none ;;
2486 esac
2487 ;;
2488 esac
2489 ;;
2490 *) dflt="$osvers" ;;
2491esac
2492rp="Operating system version?"
2493. ./myread
2494case "$ans" in
2495none) osvers='' ;;
2496*) osvers="$ans" ;;
2497esac
2498
2304df62 2499: who configured the system
59b83a6f 2500cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2501cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2502case "$cf_by" in
2503"")
8ff267be 2504 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2505 case "$cf_by" in
2506 "") cf_by=unknown ;;
8ff267be 2507 esac ;;
2508esac
2304df62 2509
dfe9444c
AD
2510: set up the script used to warn in case of inconsistency
2511cat <<EOS >whoa
2512$startsh
2513EOS
2514cat <<'EOSC' >>whoa
2515dflt=y
2516echo " "
2517echo "*** WHOA THERE!!! ***" >&4
2518echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2519rp=" Keep the $hint value?"
2520. ./myread
2521case "$ans" in
2522y) td=$was; tu=$was;;
2523esac
2524EOSC
2525
2526: function used to set $1 to $val
2527setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2528case "$val$was" in
2529$define$undef) . ./whoa; eval "$var=\$td";;
2530$undef$define) . ./whoa; eval "$var=\$tu";;
2531*) eval "$var=$val";;
2532esac'
2533
64e689dc
JH
2534cat <<EOM
2535
2536Perl can be built to take advantage of threads, on some systems.
2537To do so, Configure must be run with -Dusethreads.
d00b958f
JH
2538
2539Note that threading is a highly experimental feature, and
2540some known race conditions still remain. If you choose to try
2541it, be very sure to not actually deploy it for production
2542purposes. README.threads has more details, and is required
2543reading if you enable threads.
64e689dc 2544EOM
dfe9444c 2545case "$usethreads" in
b691c02f 2546$define|true|[yY]*) dflt='y';;
64e689dc
JH
2547*) dflt='n';;
2548esac
2549rp='Build a threading Perl?'
2550. ./myread
2551case "$ans" in
b691c02f 2552y|Y) val="$define" ;;
64e689dc 2553*) val="$undef" ;;
dfe9444c 2554esac
64e689dc
JH
2555set usethreads
2556eval $setvar
104d25b7 2557
693762b4
AD
2558case "$d_oldpthreads" in
2559'') : Configure tests would be welcome here. For now, assume undef.
2560 val="$undef" ;;
2561*) val="$d_oldpthreads" ;;
2562esac
2563set d_oldpthreads
2564eval $setvar
dfe9444c 2565
b691c02f
JH
2566
2567case "$usethreads" in
104d25b7
JH
2568"$define"|true|[yY]*)
2569: Look for a hint-file generated 'call-back-unit'. If the
2570: user has specified that a threading perl is to be built,
2571: we may need to set or change some other defaults.
2572 if $test -f usethreads.cbu; then
e5e20432 2573 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2574 . ./usethreads.cbu
e5e20432
JH
2575 else
2576 $cat <<EOM
2577(Your platform doesn't have any specific hints for threaded builds.
2578 Assuming POSIX threads, then.)
b691c02f 2579EOM
e5e20432 2580 fi
b691c02f 2581 ;;
e5e20432 2582esac
104d25b7 2583
64e689dc
JH
2584cat <<EOM
2585
2586Perl can be built so that multiple Perl interpreters can coexist
2587within the same Perl executable. To do so, Configure must be run with
2588-Dusemultiplicity.
2589
2590Normally you do not need this and you should answer no.
2591
2592EOM
85ab1d1d 2593case "$usemultiplicity" in
64e689dc
JH
2594$define|true|[yY]*) dflt='y';;
2595*) dflt='n';;
85ab1d1d 2596esac
64e689dc
JH
2597rp='Build Perl for multiplicity?'
2598. ./myread
2599case "$ans" in
2600y|Y) val="$define" ;;
2601*) val="$undef" ;;
2602esac
2603set usemultiplicity
2604eval $setvar
2605
e5e20432
JH
2606: determine where manual pages are on this system
2607echo " "
2608case "$sysman" in
2609'')
2610 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2611 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2612 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2613 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2614 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2615 sysman=`./loc . /usr/man/man1 $syspath`
2616 ;;
2617esac
2618if $test -d "$sysman"; then
2619 echo "System manual is in $sysman." >&4
2620else
2621 echo "Could not find manual pages in source form." >&4
2622fi
2623
2624: see what memory models we can support
2625case "$models" in
2626'')
2627 $cat >pdp11.c <<'EOP'
2628int main() {
2629#ifdef pdp11
2630 exit(0);
2631#else
2632 exit(1);
2633#endif
2634}
2635EOP
2636 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2637 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2638 dflt='unsplit split'
2639 else
2640 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2641 case "$tans" in
2642 X) dflt='none';;
2643 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2644 dflt='small'
2645 else
2646 dflt=''
2647 fi
2648 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2649 dflt="$dflt medium"
2650 fi
2651 if $test -d /lib/large || $test -d /usr/lib/large; then
2652 dflt="$dflt large"
2653 fi
2654 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2655 dflt="$dflt huge"
2656 fi
2657 esac
2658 fi;;
2659*) dflt="$models";;
2660esac
2661$cat <<EOM
2662
2663Some systems have different model sizes. On most systems they are called
2664small, medium, large, and huge. On the PDP11 they are called unsplit and
2665split. If your system doesn't support different memory models, say "none".
2666If you wish to force everything to one memory model, say "none" here and
2667put the appropriate flags later when it asks you for other cc and ld flags.
2668Venix systems may wish to put "none" and let the compiler figure things out.
2669(In the following question multiple model names should be space separated.)
2670
2671The default for most systems is "none".
2672
2673EOM
2674rp="Which memory models are supported?"
2675. ./myread
2676models="$ans"
2677
2678case "$models" in
2679none)
2680 small=''
2681 medium=''
2682 large=''
2683 huge=''
2684 unsplit=''
2685 split=''
2686 ;;
2687*split)
2688 case "$split" in
2689 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2690 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2691 dflt='-i'
2692 else
2693 dflt='none'
2694 fi;;
2695 *) dflt="$split";;
2696 esac
2697 rp="What flag indicates separate I and D space?"
2698 . ./myread
2699 tans="$ans"
2700 case "$tans" in
2701 none) tans='';;
2702 esac
2703 split="$tans"
2704 unsplit='';;
2705*large*|*small*|*medium*|*huge*)
2706 case "$models" in
2707 *large*)
2708 case "$large" in
2709 '') dflt='-Ml';;
2710 *) dflt="$large";;
2711 esac
2712 rp="What flag indicates large model?"
2713 . ./myread
2714 tans="$ans"
2715 case "$tans" in
2716 none) tans='';
2717 esac
2718 large="$tans";;
2719 *) large='';;
2720 esac
2721 case "$models" in
2722 *huge*) case "$huge" in
2723 '') dflt='-Mh';;
2724 *) dflt="$huge";;
2725 esac
2726 rp="What flag indicates huge model?"
2727 . ./myread
2728 tans="$ans"
2729 case "$tans" in
2730 none) tans='';
2731 esac
2732 huge="$tans";;
2733 *) huge="$large";;
2734 esac
2735 case "$models" in
2736 *medium*) case "$medium" in
2737 '') dflt='-Mm';;
2738 *) dflt="$medium";;
2739 esac
2740 rp="What flag indicates medium model?"
2741 . ./myread
2742 tans="$ans"
2743 case "$tans" in
2744 none) tans='';
2745 esac
2746 medium="$tans";;
2747 *) medium="$large";;
2748 esac
2749 case "$models" in
2750 *small*) case "$small" in
2751 '') dflt='none';;
2752 *) dflt="$small";;
2753 esac
2754 rp="What flag indicates small model?"
2755 . ./myread
2756 tans="$ans"
2757 case "$tans" in
2758 none) tans='';
2759 esac
2760 small="$tans";;
2761 *) small='';;
2762 esac
2763 ;;
2764*)
2765 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2766 ;;
2767esac
2768$rm -f pdp11.* pdp11
2769
2770: make some quick guesses about what we are up against
2771echo " "
2772$echo $n "Hmm... $c"
2773echo exit 1 >bsd
2774echo exit 1 >usg
2775echo exit 1 >v7
2776echo exit 1 >osf1
2777echo exit 1 >eunice
2778echo exit 1 >xenix
2779echo exit 1 >venix
2780echo exit 1 >os2
2781d_bsd="$undef"
2782$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2783if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2784then
2785 echo "Looks kind of like an OSF/1 system, but we'll see..."
2786 echo exit 0 >osf1
2787elif test `echo abc | tr a-z A-Z` = Abc ; then
2788 xxx=`./loc addbib blurfl $pth`
2789 if $test -f $xxx; then
2790 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2791 echo exit 0 >bsd
2792 echo exit 0 >usg
2793 else
2794 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2795 echo "Looks kind of like an extended USG system, but we'll see..."
2796 else
2797 echo "Looks kind of like a USG system, but we'll see..."
2798 fi
2799 echo exit 0 >usg
2800 fi
2801elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2802 echo "Looks kind of like a BSD system, but we'll see..."
2803 d_bsd="$define"
2804 echo exit 0 >bsd
2805else
2806 echo "Looks kind of like a Version 7 system, but we'll see..."
2807 echo exit 0 >v7
2808fi
2809case "$eunicefix" in
2810*unixtovms*)
2811 $cat <<'EOI'
2812There is, however, a strange, musty smell in the air that reminds me of
2813something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2814EOI
2815 echo exit 0 >eunice
2816 d_eunice="$define"
2817: it so happens the Eunice I know will not run shell scripts in Unix format
2818 ;;
2819*)
2820 echo " "
2821 echo "Congratulations. You aren't running Eunice."
2822 d_eunice="$undef"
2823 ;;
2824esac
2825: Detect OS2. The p_ variable is set above in the Head.U unit.
2826case "$p_" in
2827:) ;;
2828*)
2829 $cat <<'EOI'
2830I have the feeling something is not exactly right, however...don't tell me...
2831lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2832EOI
2833 echo exit 0 >os2
2834 ;;
2835esac
2836if test -f /xenix; then
2837 echo "Actually, this looks more like a XENIX system..."
2838 echo exit 0 >xenix
2839 d_xenix="$define"
2840else
2841 echo " "
2842 echo "It's not Xenix..."
2843 d_xenix="$undef"
2844fi
2845chmod +x xenix
2846$eunicefix xenix
2847if test -f /venix; then
2848 echo "Actually, this looks more like a VENIX system..."
2849 echo exit 0 >venix
2850else
2851 echo " "
2852 if ./xenix; then
2853 : null
2854 else
2855 echo "Nor is it Venix..."
2856 fi
2857fi
2858chmod +x bsd usg v7 osf1 eunice xenix venix os2
2859$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2860$rm -f foo
2861
2862: see if we need a special compiler
2863echo " "
2864if ./usg; then
2865 case "$cc" in
2866 '') case "$Mcc" in
2867 /*) dflt='Mcc';;
2868 *) case "$large" in
2869 -M*) dflt='cc';;
2870 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2871 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2872 dflt='cc'
2873 else
2874 dflt='cc -M'
2875 fi
2876 else
2877 dflt='cc'
2878 fi;;
2879 esac;;
2880 esac;;
2881 *) dflt="$cc";;
2882 esac
2883 case "$dflt" in
2884 *M*) $cat <<'EOM'
2885On some older systems the default C compiler will not resolve multiple global
2886references that happen to have the same name. On some such systems the "Mcc"
2887command may be used to force these to be resolved. On other systems a "cc -M"
2888command is required. (Note that the -M flag on other systems indicates a
2889memory model to use!) If you have the Gnu C compiler, you might wish to use
2890that instead.
2891
2892EOM
2893 ;;
2894 esac
2895 rp="Use which C compiler?"
2896 . ./myread
2897 cc="$ans"
2898else
2899 case "$cc" in
2900 '') dflt=cc;;
2901 *) dflt="$cc";;
2902 esac
2903 rp="Use which C compiler?"
2904 . ./myread
2905 cc="$ans"
2906fi
2907: Look for a hint-file generated 'call-back-unit'. Now that the
2908: user has specified the compiler, we may need to set or change some
2909: other defaults.
2910if $test -f cc.cbu; then
2911 . ./cc.cbu
2912fi
2913echo " "
2914echo "Checking for GNU cc in disguise and/or its version number..." >&4
2915$cat >gccvers.c <<EOM
2916#include <stdio.h>
2917int main() {
2918#ifdef __GNUC__
2919#ifdef __VERSION__
2920 printf("%s\n", __VERSION__);
2921#else
2922 printf("%s\n", "1");
2923#endif
2924#endif
2925 exit(0);
2926}
2927EOM
2928if $cc -o gccvers gccvers.c; then
2929 gccversion=`./gccvers`
2930 case "$gccversion" in
2931 '') echo "You are not using GNU cc." ;;
2932 *) echo "You are using GNU cc $gccversion." ;;
2933 esac
2934else
2935 echo " "
2936 echo "*** WHOA THERE!!! ***" >&4
2937 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
2938 case "$knowitall" in
2939 '')
2940 echo " You'd better start hunting for one and let me know about it." >&4
2941 exit 1
2942 ;;
2943 esac
2944fi
2945$rm -f gccvers*
2946case "$gccversion" in
29471*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2948esac
2949
64e689dc
JH
2950cat <<EOM
2951
2952Perl can be built to take advantage of explicit 64-bit interfaces,
2953on some systems. To do so, Configure must be run with -Duse64bits.
2954
2955If this doesn't make any sense to you, just accept the default 'n'.
2956EOM
85ab1d1d 2957case "$use64bits" in
64e689dc
JH
2958$define|true|[yY]*) dflt='y';;
2959*) dflt='n';;
2960esac
2961rp='Try to use explicit 64-bit interfaces, if available?'
2962. ./myread
2963case "$ans" in
2964y|Y)
2965 val="$define"
2966 ;;
2967*)
2968 val="$undef"
2969 ;;
85ab1d1d 2970esac
64e689dc
JH
2971set use64bits
2972eval $setvar
85ab1d1d 2973
104d25b7
JH
2974case "$archname64" in
2975'') archname64='' ;; # not a typo
2976esac
85ab1d1d 2977
b691c02f 2978case "$use64bits" in
104d25b7
JH
2979"$define"|true|[yY]*)
2980: Look for a hint-file generated 'call-back-unit'. If the
dd4e71fd 2981: user has specified that a 64 bit perl is to be built,
104d25b7
JH
2982: we may need to set or change some other defaults.
2983 if $test -f use64bits.cbu; then
e5e20432 2984 echo "Your platform has some specific hints for 64-bit builds, using them..."
104d25b7 2985 . ./use64bits.cbu
e5e20432
JH
2986 else
2987 $cat <<EOM
2988(Your platform doesn't have any specific hints for 64-bit builds.
2989 This is probably okay, especially if your system is a true 64-bit system.)
b691c02f 2990EOM
e5e20432
JH
2991 case "$gccversion" in
2992 '') ;;
2993 *) $cat <<EOM
2994But since you seem to be using gcc,
2995I will now add -DUSE_LONG_LONG to the compilation flags.
2996EOM
2997 ccflags="$ccflags -DUSE_LONG_LONG"
2998 ;;
2999 esac
3000 fi
b691c02f
JH
3001 ;;
3002esac
104d25b7 3003
4633a7c4 3004: determine the architecture name
2304df62 3005echo " "
4633a7c4
LW
3006if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3007 tarch=`arch`"-$osname"
3008elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3009 if uname -m > tmparch 2>&1 ; then
7e1af8bc 3010 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5f05dabc 3011 -e 's/$/'"-$osname/" tmparch`
4633a7c4
LW
3012 else
3013 tarch="$osname"
3014 fi
3015 $rm -f tmparch
3016else
3017 tarch="$osname"
3018fi
3019case "$myarchname" in
3020''|"$tarch") ;;
3021*)
3022 echo "(Your architecture name used to be $myarchname.)"
3023 archname=''
2304df62
AD
3024 ;;
3025esac
85ab1d1d 3026myarchname="$tarch"
4633a7c4
LW
3027case "$archname" in
3028'') dflt="$tarch";;
3029*) dflt="$archname";;
3030esac
3031rp='What is your architecture name'
3032. ./myread
85ab1d1d 3033archname="$ans"
dc66995c 3034case "$usethreads" in
85ab1d1d
JH
3035$define)
3036 echo "Threads selected." >&4
3037 case "$archname" in
3038 *-thread*) echo "...and architecture name already has -thread." >&4
3039 ;;
3040 *) archname="$archname-thread"
3041 echo "...setting architecture name to $archname." >&4
3042 ;;
3043 esac
3044 ;;
dc66995c 3045esac
85ab1d1d
JH
3046case "$usemultiplicity" in
3047$define)
3048 echo "Multiplicity selected." >&4
3049 case "$archname" in
3050 *-multi*) echo "...and architecture name already has -multi." >&4
3051 ;;
3052 *) archname="$archname-multi"
3053 echo "...setting architecture name to $archname." >&4
3054 ;;
3055 esac
3056 ;;
3057esac
3058case "$use64bits" in
3059$define)
3060 echo "Explicit 64-bitness selected." >&4
3061 case "$archname64" in
3062 '')
3063 ;;
3064 *)
3065 case "$archname" in
3066 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3067 ;;
3068 *) archname="$archname-$archname64"
3069 echo "...setting architecture name to $archname." >&4
3070 ;;
3071 esac
3072 ;;
3073 esac
3074esac
3075
4633a7c4
LW
3076: decide how portable to be. Allow command line overrides.
3077case "$d_portable" in
3078"$undef") ;;
3079*) d_portable="$define" ;;
2304df62 3080esac
2304df62 3081
4633a7c4
LW
3082: set up shell script to do ~ expansion
3083cat >filexp <<EOSS
3084$startsh
3085: expand filename
3086case "\$1" in
3087 ~/*|~)
3088 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 3089 ;;
4633a7c4
LW
3090 ~*)
3091 if $test -f /bin/csh; then
3092 /bin/csh -f -c "glob \$1"
3093 failed=\$?
3094 echo ""
3095 exit \$failed
3096 else
3097 name=\`$expr x\$1 : '..\([^/]*\)'\`
3098 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3099 if $test ! -d "\$dir"; then
3100 me=\`basename \$0\`
3101 echo "\$me: can't locate home directory for: \$name" >&2
3102 exit 1
3103 fi
3104 case "\$1" in
3105 */*)
3106 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3107 ;;
3108 *)
3109 echo \$dir
3110 ;;
2304df62 3111 esac
4633a7c4 3112 fi
2304df62
AD
3113 ;;
3114*)
4633a7c4 3115 echo \$1
2304df62
AD
3116 ;;
3117esac
4633a7c4
LW
3118EOSS
3119chmod +x filexp
3120$eunicefix filexp
2304df62
AD
3121
3122: now set up to get a file name
28757baa 3123cat <<EOS >getfile
3124$startsh
3125EOS
3126cat <<'EOSC' >>getfile
2304df62
AD
3127tilde=''
3128fullpath=''
3129already=''
3130skip=''
3131none_ok=''
3132exp_file=''
a0d0e21e 3133nopath_ok=''
2304df62
AD
3134orig_rp="$rp"
3135orig_dflt="$dflt"
b233458b
JH
3136case "$gfpth" in
3137'') gfpth='.' ;;
3138esac
2304df62
AD
3139
3140case "$fn" in
ecfc5424 3141*\(*)
28e8609d 3142 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3143 fn=`echo $fn | sed 's/(.*)//'`
3144 ;;
3145esac
3146
3147case "$fn" in
a0d0e21e
LW
3148*:*)
3149 loc_file=`expr $fn : '.*:\(.*\)'`
3150 fn=`expr $fn : '\(.*\):.*'`
3151 ;;
3152esac
3153
3154case "$fn" in
2304df62
AD
3155*~*) tilde=true;;
3156esac
3157case "$fn" in
3158*/*) fullpath=true;;
3159esac
3160case "$fn" in
3161*+*) skip=true;;
3162esac
3163case "$fn" in
3164*n*) none_ok=true;;
3165esac
3166case "$fn" in
3167*e*) exp_file=true;;
3168esac
a0d0e21e
LW
3169case "$fn" in
3170*p*) nopath_ok=true;;
3171esac
2304df62
AD
3172
3173case "$fn" in
3174*f*) type='File';;
3175*d*) type='Directory';;
a0d0e21e 3176*l*) type='Locate';;
2304df62
AD
3177esac
3178
3179what="$type"
3180case "$what" in
3181Locate) what='File';;
3182esac
3183
3184case "$exp_file" in
3185'')
3186 case "$d_portable" in
3187 "$define") ;;
3188 *) exp_file=true;;
3189 esac
3190 ;;
3191esac
3192
3193cd ..
3194while test "$type"; do
3195 redo=''
3196 rp="$orig_rp"
3197 dflt="$orig_dflt"
3198 case "$tilde" in
3199 true) rp="$rp (~name ok)";;
3200 esac
3201 . UU/myread
ecfc5424
AD
3202 if test -f UU/getfile.ok && \
3203 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3204 then
3205 value="$ans"
3206 ansexp="$ans"
3207 break
3208 fi
2304df62
AD
3209 case "$ans" in
3210 none)
3211 value=''
3212 ansexp=''
3213 case "$none_ok" in
3214 true) type='';;
3215 esac
3216 ;;
3217 *)
3218 case "$tilde" in
3219 '') value="$ans"
3220 ansexp="$ans";;
3221 *)
3222 value=`UU/filexp $ans`
3223 case $? in
3224 0)
3225 if test "$ans" != "$value"; then
ecfc5424 3226 echo "(That expands to $value on this system.)"
2304df62
AD
3227 fi
3228 ;;
3229 *) value="$ans";;
3230 esac
3231 ansexp="$value"
3232 case "$exp_file" in
3233 '') value="$ans";;
3234 esac
3235 ;;
3236 esac
3237 case "$fullpath" in
3238 true)
3239 case "$ansexp" in
3240 /*) value="$ansexp" ;;
3241 *)
3242 redo=true
3243 case "$already" in
3244 true)
3245 echo "I shall only accept a full path name, as in /bin/ls." >&4
3246 echo "Use a ! shell escape if you wish to check pathnames." >&4
3247 ;;
3248 *)
3249 echo "Please give a full path name, starting with slash." >&4
3250 case "$tilde" in
3251 true)
3252 echo "Note that using ~name is ok provided it expands well." >&4
3253 already=true
3254 ;;
3255 esac
3256 esac
3257 ;;
3258 esac
3259 ;;
3260 esac
3261 case "$redo" in
3262 '')
3263 case "$type" in
3264 File)
b233458b
JH
3265 for fp in $gfpth; do
3266 if test "X$fp" = X.; then
3267 pf="$ansexp"
3268 else
3269 pf="$fp/$ansexp"
3270 fi
3271 if test -f "$pf"; then
3272 type=''
3273 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3274 then
3275 echo "($value is not a plain file, but that's ok.)"
3276 type=''
3277 fi
3278 if test X"$type" = X; then
3279 value="$pf"
3280 break
3281 fi
3282 done
2304df62
AD
3283 ;;
3284 Directory)
b233458b
JH
3285 for fp in $gfpth; do
3286 if test "X$fp" = X.; then
3287 pf="$ansexp"
3288 else
3289 pf="$fp/$ansexp"
3290 fi
3291 if test -d "$pf"; then
3292 type=''
3293 value="$pf"
3294 break
3295 fi
3296 done
2304df62
AD
3297 ;;
3298 Locate)
40000a8c 3299 if test -d "$ansexp"; then
a0d0e21e
LW
3300 echo "(Looking for $loc_file in directory $value.)"
3301 value="$value/$loc_file"
40000a8c 3302 ansexp="$ansexp/$loc_file"
2304df62 3303 fi
40000a8c 3304 if test -f "$ansexp"; then
2304df62
AD
3305 type=''
3306 fi
a0d0e21e
LW
3307 case "$nopath_ok" in
3308 true) case "$value" in
3309 */*) ;;
3310 *) echo "Assuming $value will be in people's path."
3311 type=''
3312 ;;
3313 esac
3314 ;;
3315 esac
2304df62
AD
3316 ;;
3317 esac
3318
3319 case "$skip" in
3320 true) type='';
3321 esac
3322
3323 case "$type" in
3324 '') ;;
3325 *)
3326 if test "$fastread" = yes; then
3327 dflt=y
3328 else
3329 dflt=n
3330 fi
3331 rp="$what $value doesn't exist. Use that name anyway?"
3332 . UU/myread
3333 dflt=''
3334 case "$ans" in
3335 y*) type='';;
3336 *) echo " ";;
3337 esac
3338 ;;
3339 esac
3340 ;;
3341 esac
3342 ;;
3343 esac
3344done
3345cd UU
3346ans="$value"
3347rp="$orig_rp"
3348dflt="$orig_dflt"
ecfc5424 3349rm -f getfile.ok
b233458b 3350test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3351EOSC
3352
4633a7c4
LW
3353: determine root of directory hierarchy where package will be installed.
3354case "$prefix" in
3355'')
3356 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 3357 ;;
4633a7c4
LW
3358*)
3359 dflt="$prefix"
8e07c86e
AD
3360 ;;
3361esac
4633a7c4 3362$cat <<EOM
2304df62 3363
dd4e71fd
JH
3364By default, $package will be installed in $dflt/bin, manual pages
3365under $dflt/man, etc..., i.e. with $dflt as prefix for all
3366installation directories. Typically this is something like /usr/local.
3367If you wish to have binaries under /usr/bin but other parts of the
3368installation under /usr/local, that's ok: you will be prompted
3369separately for each of the installation directories, the prefix being
3370only used to set the defaults.
8e07c86e
AD
3371
3372EOM
3373fn=d~
3374rp='Installation prefix to use?'
3375. ./getfile
3376oldprefix=''
3377case "$prefix" in
a0d0e21e 3378'') ;;
8e07c86e
AD
3379*)
3380 case "$ans" in
3381 "$prefix") ;;
3382 *) oldprefix="$prefix";;
3383 esac
3384 ;;
a0d0e21e 3385esac
8e07c86e
AD
3386prefix="$ans"
3387prefixexp="$ansexp"
a0d0e21e 3388
dd4e71fd
JH
3389: is AFS running?
3390echo " "
3391case "$afs" in
3392$define|true) afs=true ;;
3393$undef|false) afs=false ;;
3394*) if test -d /afs; then
3395 afs=true
3396 else
3397 afs=false
3398 fi
3399 ;;
3400esac
3401if $afs; then
3402 echo "AFS may be running... I'll be extra cautious then..." >&4
3403else
3404 echo "AFS does not seem to be running..." >&4
3405fi
3406
3407: determine installation prefix for where package is to be installed.
3408if $afs; then
3409$cat <<EOM
3410
3411Since you are running AFS, I need to distinguish the directory in which
3412files will reside from the directory in which they are installed (and from
3413which they are presumably copied to the former directory by occult means).
3414
3415EOM
3416 case "$installprefix" in
3417 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3418 *) dflt="$installprefix";;
3419 esac
3420else
3421$cat <<EOM
3422
3423In some special cases, particularly when building $package for distribution,
3424it is convenient to distinguish between the directory in which files should
3425be installed from the directory ($prefix) in which they
3426will eventually reside. For most users, these two directories are the same.
3427
3428EOM
3429 case "$installprefix" in
3430 '') dflt=$prefix ;;
3431 *) dflt=$installprefix;;
3432 esac
3433fi
3434fn=d~
3435rp='What installation prefix should I use for installing files?'
3436. ./getfile
3437installprefix="$ans"
3438installprefixexp="$ansexp"
3439
8e07c86e
AD
3440: set the prefixit variable, to compute a suitable default value
3441prefixit='case "$3" in
3442""|none)
3443 case "$oldprefix" in
3444 "") eval "$1=\"\$$2\"";;
3445 *)
3446 case "$3" in
3447 "") eval "$1=";;
3448 none)
3449 eval "tp=\"\$$2\"";
3450 case "$tp" in
3451 ""|" ") eval "$1=\"\$$2\"";;
3452 *) eval "$1=";;
3453 esac;;
3454 esac;;
3455 esac;;
3456*)
3457 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3458 case "$tp" in
3459 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3460 /*-$oldprefix/*|\~*-$oldprefix/*)
3461 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3462 *) eval "$1=\"\$$2\"";;
3463 esac;;
3464esac'
a0d0e21e 3465
bfb7748a
AD
3466: set the base revision
3467baserev=5.0
3468
3469: get the patchlevel
3470echo " "
3471echo "Getting the current patchlevel..." >&4
3472if $test -r $rsrc/patchlevel.h;then
d00b958f
JH
3473 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3474 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bfb7748a
AD
3475else
3476 patchlevel=0
3477 subversion=0
3478fi
3479$echo $n "(You have $package" $c
3480case "$package" in
3481"*$baserev") ;;
3482*) $echo $n " $baserev" $c ;;
3483esac
3484$echo $n " patchlevel $patchlevel" $c
3485test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3486echo ".)"
3487
3488if test 0 -eq "$subversion"; then
3489 version=`LC_ALL=C; export LC_ALL; \
3490 echo $baserev $patchlevel | \
3491 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3492else
3493 version=`LC_ALL=C; export LC_ALL; \
3494 echo $baserev $patchlevel $subversion | \
3495 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3496fi
3497: Figure out perl API version. Perhaps this should be in patchlevel.h
3498if test "$subversion" -lt 50; then
3499 apiversion=`LC_ALL=C; export LC_ALL; \
59b83a6f 3500 LANGUAGE=C; export LANGUAGE; \
bfb7748a
AD
3501 echo $baserev $patchlevel | \
3502 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3503else
3504 apiversion="$version"
3505fi
3506
dd4e71fd
JH
3507: determine installation style
3508: For now, try to deduce it from prefix unless it is already set.
3509: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3510case "$installstyle" in
3511'') case "$prefix" in
3512 *perl*) dflt='lib';;
3513 *) dflt='lib/perl5' ;;
3514 esac
3515 ;;
3516*) dflt='lib/perl5' ;;
3517esac
3518: Probably not worth prompting for this since we prompt for all
3519: the directories individually, and the prompt would be too long and
3520: confusing anyway.
3521installstyle=$dflt
3522
4633a7c4 3523: determine where private library files go
3a6175e1
AD
3524: Usual default is /usr/local/lib/perl5/$version.
3525: Also allow things like /opt/perl/lib/$version, since
bfb7748a 3526: /opt/perl/lib/perl5... would be redundant.
dd4e71fd
JH
3527: The default "style" setting is made in installstyle.U
3528case "$installstyle" in
3529*lib/perl5*) set dflt privlib lib/$package/$version ;;
3530*) set dflt privlib lib/$version ;;
4633a7c4 3531esac
8e07c86e 3532eval $prefixit
4633a7c4
LW
3533$cat <<EOM
3534
3535There are some auxiliary files for $package that need to be put into a
3536private library directory that is accessible by everyone.
3537
3538EOM
3539fn=d~+
3540rp='Pathname where the private library files will reside?'
8e07c86e 3541. ./getfile
4633a7c4
LW
3542privlib="$ans"
3543privlibexp="$ansexp"
dd4e71fd
JH
3544: Change installation prefix, if necessary.
3545if $test X"$prefix" != X"$installprefix"; then
ec897fb9 3546 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
3547else
3548 installprivlib="$privlibexp"
4633a7c4
LW
3549fi
3550
8e07c86e
AD
3551: set the prefixup variable, to restore leading tilda escape
3552prefixup='case "$prefixexp" in
3553"$prefix") ;;
3554*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3555esac'
3556
4633a7c4
LW
3557: determine where public architecture dependent libraries go
3558set archlib archlib
8e07c86e 3559eval $prefixit
3a6175e1 3560: privlib default is /usr/local/lib/$package/$version
bfb7748a 3561: archlib default is /usr/local/lib/$package/$version/$archname
3a6175e1 3562: privlib may have an optional trailing /share.
bfb7748a
AD
3563tdflt=`echo $privlib | $sed 's,/share$,,'`
3564tdflt=$tdflt/$archname
4633a7c4 3565case "$archlib" in
bfb7748a 3566'') dflt=$tdflt
8e07c86e 3567 ;;
bfb7748a 3568*) dflt="$archlib"
774d564b 3569 ;;
8e07c86e 3570esac
dd4e71fd 3571$cat <<EOM
4633a7c4
LW
3572
3573$spackage contains architecture-dependent library files. If you are
3574sharing libraries in a heterogeneous environment, you might store
3575these files in a separate location. Otherwise, you can just include
3576them with the rest of the public library files.
3577
8e07c86e 3578EOM
4633a7c4
LW
3579fn=d+~
3580rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 3581. ./getfile
4633a7c4
LW
3582archlib="$ans"
3583archlibexp="$ansexp"
4633a7c4
LW
3584if $test X"$archlib" = X"$privlib"; then
3585 d_archlib="$undef"
3586else
3587 d_archlib="$define"
8e07c86e 3588fi
dd4e71fd
JH
3589: Change installation prefix, if necessary.
3590if $test X"$prefix" != X"$installprefix"; then
ec897fb9 3591 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
3592else
3593 installarchlib="$archlibexp"
dd4e71fd 3594fi
8e07c86e 3595
d71b2b6b
JH
3596
3597: Binary compatibility with 5.005 is not possible for builds
3598: with advanced features
3599case "$usethreads$usemultiplicity" in
f0d04425
JH
3600*define*)
3601 bincompat5005="$undef"
3602 d_bincompat5005="$undef"
3603 ;;
d71b2b6b
JH
3604*) $cat <<EOM
3605
3606Perl 5.006 can be compiled for binary compatibility with 5.005.
3607If you decide to do so, you will be able to continue using most
3608of the extensions that were compiled for Perl 5.005.
3609
3610EOM
44dbcf5f
JH
3611 case "$bincompat5005$d_bincompat5005" in
3612 *"$undef"*) dflt=n ;;
d71b2b6b
JH
3613 *) dflt=y ;;
3614 esac
3615 rp='Binary compatibility with Perl 5.005?'
3616 . ./myread
3617 case "$ans" in
3618 y*) val="$define" ;;
3619 *) val="$undef" ;;
3620 esac
3621 set d_bincompat5005
3622 eval $setvar
3623 case "$d_bincompat5005" in
f0d04425
JH
3624 "$define")
3625 bincompat5005="$define"
3626 ;;
3627 *) bincompat5005="$undef"
3628 d_bincompat5005="$undef"
3629 ;;
e5e20432
JH
3630 esac
3631 ;;
3632esac
3633
40a7a20a 3634
3635: see if setuid scripts can be secure
3636$cat <<EOM
3637
3638Some kernels have a bug that prevents setuid #! scripts from being
3639secure. Some sites have disabled setuid #! scripts because of this.
3640
3641First let's decide if your kernel supports secure setuid #! scripts.
3642(If setuid #! scripts would be secure but have been disabled anyway,
3643don't say that they are secure if asked.)
3644
3645EOM
3646
3647val="$undef"
3648if $test -d /dev/fd; then
3649 echo "#!$ls" >reflect
3650 chmod +x,u+s reflect
3651 ./reflect >flect 2>&1
3652 if $contains "/dev/fd" flect >/dev/null; then
3653 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3654 val="$define"
3655 else
3656 $cat <<EOM
3657If you are not sure if they are secure, I can check but I'll need a
3658username and password different from the one you are using right now.
3659If you don't have such a username or don't want me to test, simply
3660enter 'none'.
3661
3662EOM
3663 rp='Other username to test security of setuid scripts with?'
3664 dflt='none'
3665 . ./myread
3666 case "$ans" in
3667 n|none)
3668 case "$d_suidsafe" in
3669 '') echo "I'll assume setuid scripts are *not* secure." >&4
3670 dflt=n;;
3671 "$undef")
3672 echo "Well, the $hint value is *not* secure." >&4
3673 dflt=n;;
3674 *) echo "Well, the $hint value *is* secure." >&4
3675 dflt=y;;
3676 esac
3677 ;;
3678 *)
3679 $rm -f reflect flect
3680 echo "#!$ls" >reflect
3681 chmod +x,u+s reflect
3682 echo >flect
3683 chmod a+w flect
3684 echo '"su" will (probably) prompt you for '"$ans's password."
3685 su $ans -c './reflect >flect'
3686 if $contains "/dev/fd" flect >/dev/null; then
3687 echo "Okay, it looks like setuid scripts are secure." >&4
3688 dflt=y
3689 else
3690 echo "I don't think setuid scripts are secure." >&4
3691 dflt=n
3692 fi
3693 ;;
3694 esac
3695 rp='Does your kernel have *secure* setuid scripts?'
3696 . ./myread
3697 case "$ans" in
3698 [yY]*) val="$define";;
3699 *) val="$undef";;
3700 esac
3701 fi
3702else
3703 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
760ac839 3704 echo "(That's for file descriptors, not floppy disks.)"
40a7a20a 3705 val="$undef"
3706fi
3707set d_suidsafe
3708eval $setvar
3709
3710$rm -f reflect flect
3711
3712: now see if they want to do setuid emulation
3713echo " "
3714val="$undef"
3715case "$d_suidsafe" in
3716"$define")
3717 val="$undef"
3718 echo "No need to emulate SUID scripts since they are secure here." >& 4
3719 ;;
3720*)
3721 $cat <<EOM
3722Some systems have disabled setuid scripts, especially systems where
3723setuid scripts cannot be secure. On systems where setuid scripts have
dfe9444c
AD
3724been disabled, the setuid/setgid bits on scripts are currently
3725useless. It is possible for $package to detect those bits and emulate
3726setuid/setgid in a secure fashion. This emulation will only work if
3727setuid scripts have been disabled in your kernel.
8e07c86e
AD
3728
3729EOM
dfe9444c
AD
3730 case "$d_dosuid" in
3731 "$define") dflt=y ;;
3732 *) dflt=n ;;
3733 esac
3734 rp="Do you want to do setuid/setgid emulation?"
3735 . ./myread
3736 case "$ans" in
3737 [yY]*) val="$define";;
3738 *) val="$undef";;
3739 esac
3740 ;;
4633a7c4 3741esac
dfe9444c 3742set d_dosuid
4633a7c4 3743eval $setvar
8e07c86e 3744
2afac517 3745: What should the include directory be ?
8e07c86e 3746echo " "
2afac517 3747$echo $n "Hmm... $c"
3748dflt='/usr/include'
3749incpath=''
3750mips_type=''
3751if $test -f /bin/mips && /bin/mips; then
3752 echo "Looks like a MIPS system..."
3753 $cat >usr.c <<'EOCP'
3754#ifdef SYSTYPE_BSD43
3755/bsd43
3756#endif
3757EOCP
3758 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3759 dflt='/bsd43/usr/include'
3760 incpath='/bsd43'
3761 mips_type='BSD 4.3'
8e07c86e 3762 else
2afac517 3763 mips_type='System V'
8e07c86e 3764 fi
2afac517 3765 $rm -f usr.c usr.out
3766 echo "and you're compiling with the $mips_type compiler and libraries."
3767 xxx_prompt=y
3768 echo "exit 0" >mips
8e07c86e 3769else
2afac517 3770 echo "Doesn't look like a MIPS system."
3771 xxx_prompt=n
3772 echo "exit 1" >mips
3773fi
3774chmod +x mips
3775$eunicefix mips
2afac517 3776case "$usrinc" in
3777'') ;;
3778*) dflt="$usrinc";;
3779esac
3780case "$xxx_prompt" in
3781y) fn=d/
dfe9444c 3782 echo " "
2afac517 3783 rp='Where are the include files you want to use?'
3784 . ./getfile
3785 usrinc="$ans"
3786 ;;
3787*) usrinc="$dflt"
3788 ;;
3789esac
8e07c86e 3790
c4f23d77
AD
3791: see how we invoke the C preprocessor
3792echo " "
3793echo "Now, how can we feed standard input to your C preprocessor..." >&4
3794cat <<'EOT' >testcpp.c
3795#define ABC abc
3796#define XYZ xyz
3797ABC.XYZ
3798EOT
3799cd ..
1cfa4ec7 3800if test ! -f cppstdin; then
10a23457
JH
3801 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3802 # AIX cc -E doesn't show the absolute headerfile
3803 # locations but we'll cheat by using the -M flag.
3804 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
3805 else
3806 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3807 fi
1cfa4ec7
GS
3808else
3809 echo "Keeping your $hint cppstdin wrapper."
3810fi
c4f23d77
AD
3811chmod 755 cppstdin
3812wrapper=`pwd`/cppstdin
3813ok='false'
3814cd UU
3815
3816if $test "X$cppstdin" != "X" && \
3817 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3818 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3819then
3820 echo "You used to use $cppstdin $cppminus so we'll use that again."
3821 case "$cpprun" in
3822 '') echo "But let's see if we can live without a wrapper..." ;;
3823 *)
3824 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3825 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3826 then
3827 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3828 ok='true'
3829 else
3830 echo "(However, $cpprun $cpplast does not work, let's see...)"
3831 fi
3832 ;;
3833 esac
3834else
3835 case "$cppstdin" in
3836 '') ;;
3837 *)
3838 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3839 ;;
3840 esac
3841fi
3842
3843if $ok; then
3844 : nothing
3845elif echo 'Maybe "'"$cc"' -E" will work...'; \
3846 $cc -E <testcpp.c >testcpp.out 2>&1; \
3847 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3848 echo "Yup, it does."
3849 x_cpp="$cc -E"
3850 x_minus='';
3851elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3852 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3853 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3854 echo "Yup, it does."
3855 x_cpp="$cc -E"
3856 x_minus='-';
3857elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3858 $cc -P <testcpp.c >testcpp.out 2>&1; \
3859 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3860 echo "Yipee, that works!"
3861 x_cpp="$cc -P"
3862 x_minus='';
3863elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3864 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3865 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3866 echo "At long last!"
3867 x_cpp="$cc -P"
3868 x_minus='-';
3869elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3870 $cpp <testcpp.c >testcpp.out 2>&1; \
3871 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3872 echo "It works!"
3873 x_cpp="$cpp"
3874 x_minus='';
3875elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3876 $cpp - <testcpp.c >testcpp.out 2>&1; \
3877 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3878 echo "Hooray, it works! I was beginning to wonder."
3879 x_cpp="$cpp"
3880 x_minus='-';
3881elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3882 $wrapper <testcpp.c >testcpp.out 2>&1; \
3883 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3884 x_cpp="$wrapper"
3885 x_minus=''
3886 echo "Eureka!"
3887else
3888 dflt=''
3889 rp="No dice. I can't find a C preprocessor. Name one:"
3890 . ./myread
3891 x_cpp="$ans"
3892 x_minus=''
3893 $x_cpp <testcpp.c >testcpp.out 2>&1
3894 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3895 echo "OK, that will do." >&4
3896 else
3897echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3898 exit 1
3899 fi
3900fi
3901
3902case "$ok" in
3903false)
3904 cppstdin="$x_cpp"
3905 cppminus="$x_minus"
3906 cpprun="$x_cpp"
3907 cpplast="$x_minus"
3908 set X $x_cpp
3909 shift
3910 case "$1" in
3911 "$cpp")
3912 echo "Perhaps can we force $cc -E using a wrapper..."
3913 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3914 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3915 then
3916 echo "Yup, we can."
3917 cppstdin="$wrapper"
3918 cppminus='';
3919 else
3920 echo "Nope, we'll have to live without it..."
3921 fi
3922 ;;
3923 esac
3924 case "$cpprun" in
3925 "$wrapper")
3926 cpprun=''
3927 cpplast=''
3928 ;;
3929 esac
3930 ;;
3931esac
3932
3933case "$cppstdin" in
def887e8 3934"$wrapper"|'cppstdin') ;;
c4f23d77
AD
3935*) $rm -f $wrapper;;
3936esac
3937$rm -f testcpp.c testcpp.out
3938
2afac517 3939: Set private lib path
3940case "$plibpth" in
3941'') if ./mips; then
3942 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3943 fi;;
3944esac
3945case "$libpth" in
3946' ') dlist='';;
3947'') dlist="$loclibpth $plibpth $glibpth";;
3948*) dlist="$libpth";;
3949esac
8e07c86e 3950
2afac517 3951: Now check and see which directories actually exist, avoiding duplicates
3952libpth=''
3953for xxx in $dlist
3954do
3955 if $test -d $xxx; then
3956 case " $libpth " in
3957 *" $xxx "*) ;;
3958 *) libpth="$libpth $xxx";;
3959 esac
3960 fi
3961done
3962$cat <<'EOM'
8e07c86e 3963
2afac517 3964Some systems have incompatible or broken versions of libraries. Among
3965the directories listed in the question below, please remove any you
3966know not to be holding relevant libraries, and add any that are needed.
3967Say "none" for none.
8e07c86e 3968
8e07c86e 3969EOM
2afac517 3970case "$libpth" in
3971'') dflt='none';;
3972*)
3973 set X $libpth
3974 shift
3975 dflt=${1+"$@"}
4633a7c4 3976 ;;
8e07c86e 3977esac
2afac517 3978rp="Directories to use for library searches?"
3979. ./myread
3980case "$ans" in
3981none) libpth=' ';;
3982*) libpth="$ans";;
3983esac
8e07c86e 3984
2afac517 3985: compute shared library extension
3986case "$so" in
3987'')
3988 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3989 dflt='sl'
3990 else
3991 dflt='so'
3992 fi
3993 ;;
3994*) dflt="$so";;
8e07c86e 3995esac
2afac517 3996$cat <<EOM
8e07c86e 3997
2afac517 3998On some systems, shared libraries may be available. Answer 'none' if
3999you want to suppress searching of shared libraries for the remaining
4000of this configuration.
8e07c86e
AD
4001
4002EOM
2afac517 4003rp='What is the file extension used for shared libraries?'
4004. ./myread
4005so="$ans"
8e07c86e 4006
dfe9444c
AD
4007: Define several unixisms.
4008: Hints files or command line option can be used to override them.
4009: The convoluted testing is in case hints files set either the old
4010: or the new name.
4011case "$_exe" in
4012'') case "$exe_ext" in
4013 '') ;;
4014 *) _exe="$exe_ext" ;;
4015 esac
4016 ;;
4017esac
4018case "$_a" in
4019'') case "$lib_ext" in
4020 '') _a='.a';;
4021 *) _a="$lib_ext" ;;
4022 esac
4023 ;;
4024esac
4025case "$_o" in
4026'') case "$obj_ext" in
4027 '') _o='.o';;
4028 *) _o="$obj_ext";;
4029 esac
4030 ;;
4031esac
4032case "$p_" in
4033'') case "$path_sep" in
4034 '') p_=':';;
4035 *) p_="$path_sep";;
4036 esac
4037 ;;
4038esac
4039exe_ext=$_exe
4040lib_ext=$_a
4041obj_ext=$_o
4042path_sep=$p_
4043
4044: Which makefile gets called first. This is used by make depend.
4045case "$firstmakefile" in
4046'') firstmakefile='makefile';;
4047esac
4048
29209bc5
JH
4049cat <<EOM
4050
4051Perl can be built to use the SOCKS proxy protocol library. To do so,
4052Configure must be run with -Dusesocks.
4053
4054Normally you do not need this and you should answer no.
4055
4056EOM
4057case "$usesocks" in
4058$define|true|[yY]*) dflt='y';;
4059*) dflt='n';;
4060esac
4061rp='Build Perl for SOCKS?'
4062. ./myread
4063case "$ans" in
4064y|Y) val="$define" ;;
4065*) val="$undef" ;;
4066esac
4067set usesocks
4068eval $setvar
4069
2afac517 4070: Looking for optional libraries
4071echo " "
4072echo "Checking for optional libraries..." >&4
4073case "$libs" in
4074' '|'') dflt='';;
4075*) dflt="$libs";;
8e07c86e 4076esac
2afac517 4077case "$libswanted" in
4078'') libswanted='c_s';;
4079esac
29209bc5
JH
4080case "$usesocks" in
4081$define)
4082 libswanted="$libswanted socks5 socks5_sh"
4083 ;;
4084esac
2afac517 4085for thislib in $libswanted; do
4086
1cfa4ec7
GS
4087 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4088 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
2afac517 4089 echo "Found -l$thislib (shared)."
4090 case " $dflt " in
4091 *"-l$thislib "*);;
4092 *) dflt="$dflt -l$thislib";;
4633a7c4 4093 esac
2afac517 4094 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4095 echo "Found -l$thislib (shared)."
4096 case " $dflt " in
4097 *"-l$thislib "*);;
4098 *) dflt="$dflt -l$thislib";;
4099 esac
dfe9444c 4100 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 4101 echo "Found -l$thislib."
4102 case " $dflt " in
4103 *"-l$thislib "*);;
4104 *) dflt="$dflt -l$thislib";;
4105 esac
dfe9444c 4106 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 4107 echo "Found -l$thislib."
4108 case " $dflt " in
4109 *"-l$thislib "*);;
4110 *) dflt="$dflt -l$thislib";;
4111 esac
dfe9444c 4112 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2afac517 4113 echo "Found -l${thislib}_s."
4114 case " $dflt " in
4115 *"-l$thislib "*);;
4116 *) dflt="$dflt -l${thislib}_s";;
4117 esac
dfe9444c 4118 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2afac517 4119 echo "Found -l$thislib."
4120 case " $dflt " in
4121 *"-l$thislib "*);;
4122 *) dflt="$dflt -l$thislib";;
4123 esac
4124 else
4125 echo "No -l$thislib."
4126 fi
4127done
4128set X $dflt
4129shift
4130dflt="$*"
4131case "$libs" in
4132'') dflt="$dflt";;
4133*) dflt="$libs";;
4134esac
4135case "$dflt" in
4136' '|'') dflt='none';;
8e07c86e 4137esac
2afac517 4138
4633a7c4 4139$cat <<EOM
29209bc5
JH
4140
4141In order to compile $package on your machine, a number of libraries
4142are usually needed. Include any other special libraries here as well.
4143Say "none" for none. The default list is almost always right.
4633a7c4 4144EOM
2afac517 4145
4146echo " "
29209bc5 4147rp="What libraries to use?"
8e07c86e 4148. ./myread
2afac517 4149case "$ans" in
4150none) libs=' ';;
4151*) libs="$ans";;
4152esac
8e07c86e 4153
34d1710f 4154: determine optimization, if desired, or use for debug flag also
2afac517 4155case "$optimize" in
2ae324a7 4156' '|$undef) dflt='none';;
2afac517 4157'') dflt='-O';;
4158*) dflt="$optimize";;
4633a7c4 4159esac
2afac517 4160$cat <<EOH
4633a7c4 4161
34d1710f
JH
4162By default, $package compiles with the -O flag to use the optimizer.
4163Alternately, you might want to use the symbolic debugger, which uses
4164the -g flag (on traditional Unix systems). Either flag can be
4165specified here. To use neither flag, specify the word "none".
4633a7c4
LW
4166
4167EOH
4168rp="What optimizer/debugger flag should be used?"
4169. ./myread
4170optimize="$ans"
4171case "$optimize" in
4172'none') optimize=" ";;
4173esac
4174
4175dflt=''
25f94b33
AD
4176: We will not override a previous value, but we might want to
4177: augment a hint file
4178case "$hint" in
34d1710f 4179default|recommended)
4633a7c4
LW
4180 case "$gccversion" in
4181 1*) dflt='-fpcc-struct-return' ;;
4182 esac
4183 case "$optimize" in
4184 *-g*) dflt="$dflt -DDEBUGGING";;
4185 esac
4186 case "$gccversion" in
4187 2*) if test -d /etc/conf/kconfig.d &&
4188 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4189 then
4190 dflt="$dflt -posix"
4191 fi
4192 ;;
4193 esac
34d1710f
JH
4194 case "$gccversion" in
4195 1*) ;;
4196 2.[0-8]*) ;;
4197 *) echo " "
4198 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4199 echo 'int main(void) { return 0; }' > gcctest.c
4200 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4201 echo "Yes, it does." 2>&1
4202 case "$ccflags" in
4203 *strict-aliasing*)
4204 echo "Leaving current flags $ccflags alone." 2>&1
4205 ;;
4206 *) dflt="$dflt -fno-strict-aliasing" ;;
4207 esac
4208 else
4209 echo "Nope, it doesn't, but that's ok." 2>&1
4210 fi
4211 ;;
4212 esac
4633a7c4
LW
4213 ;;
4214esac
4215
a4f3eea9 4216case "$mips_type" in
4217*BSD*|'') inclwanted="$locincpth $usrinc";;
4218*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4219esac
4220for thisincl in $inclwanted; do
4221 if $test -d $thisincl; then
4222 if $test x$thisincl != x$usrinc; then
4223 case "$dflt" in
4224 *$thisincl*);;
4225 *) dflt="$dflt -I$thisincl";;
4226 esac
4227 fi
4228 fi
4229done
4230
4231inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4232 xxx=true;
4233elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4234 xxx=true;
4235else
4236 xxx=false;
4237fi;
4238if $xxx; then
4239 case "$dflt" in
4240 *$2*);;
4241 *) dflt="$dflt -D$2";;
4242 esac;
4243fi'
4244
ccc7f9b3 4245set signal.h LANGUAGE_C; eval $inctest
a4f3eea9 4246
29209bc5
JH
4247case "$usesocks" in
4248$define)
4249 ccflags="$ccflags -DSOCKS"
4250 ;;
4251esac
4252
a4f3eea9 4253case "$hint" in
34d1710f 4254default|recommended) dflt="$ccflags $dflt" ;;
a4f3eea9 4255*) dflt="$ccflags";;
4256esac
4257
4258case "$dflt" in
4259''|' ') dflt=none;;
4260esac
4261$cat <<EOH
4262
4263Your C compiler may want other flags. For this question you should include
4264-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4265but you should NOT include libraries or ld flags like -lwhatever. If you
4266want $package to honor its debug switch, you should include -DDEBUGGING here.
dfe9444c 4267Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
a4f3eea9 4268
4269To use no flags, specify the word "none".
4270
4271EOH
4272set X $dflt
4273shift
4274dflt=${1+"$@"}
4275rp="Any additional cc flags?"
4276. ./myread
4277case "$ans" in
4278none) ccflags='';;
4279*) ccflags="$ans";;
4280esac
4281
4282: the following weeds options from ccflags that are of no interest to cpp
4283cppflags="$ccflags"
4284case "$gccversion" in
42851*) cppflags="$cppflags -D__GNUC__"
4286esac
4287case "$mips_type" in
4288'');;
4289*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4290esac
4291case "$cppflags" in
4292'');;
4293*)
4294 echo " "
4295 echo "Let me guess what the preprocessor flags are..." >&4
4296 set X $cppflags
4297 shift
4298 cppflags=''
4299 $cat >cpp.c <<'EOM'
4300#define BLURFL foo
4301
4302BLURFL xx LFRULB
4303EOM
4304 previous=''
4305 for flag in $*
4306 do
4307 case "$flag" in
4308 -*) ftry="$flag";;
4309 *) ftry="$previous $flag";;
4310 esac
7bac28a0 4311 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
a4f3eea9 4312 >cpp1.out 2>/dev/null && \
dfe9444c 4313 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
a4f3eea9 4314 >cpp2.out 2>/dev/null && \
4315 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4316 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4317 then
4318 cppflags="$cppflags $ftry"
4319 previous=''
4320 else
4321 previous="$flag"
4322 fi
4323 done
4324 set X $cppflags
4325 shift
4326 cppflags=${1+"$@"}
4327 case "$cppflags" in
4328 *-*) echo "They appear to be: $cppflags";;
4329 esac
4330 $rm -f cpp.c cpp?.out
4331 ;;
4332esac
4333
4334: flags used in final linking phase
a4f3eea9 4335case "$ldflags" in
4336'') if ./venix; then
4337 dflt='-i -z'
4338 else
4339 dflt=''
4340 fi
4341 case "$ccflags" in
4342 *-posix*) dflt="$dflt -posix" ;;
4343 esac
4344 ;;
4345*) dflt="$ldflags";;
4346esac
4347
4348: Try to guess additional flags to pick up local libraries.
4349for thislibdir in $libpth; do
4350 case " $loclibpth " in
4351 *" $thislibdir "*)
4352 case "$dflt " in
4353 *"-L$thislibdir "*) ;;
4354 *) dflt="$dflt -L$thislibdir" ;;
4355 esac
4356 ;;
4357 esac
4358done
4359
4360case "$dflt" in
4361'') dflt='none' ;;
4362esac
4363
4364$cat <<EOH
4365
4366Your C linker may need flags. For this question you should
4367include -L/whatever and any other flags used by the C linker, but you
4368should NOT include libraries like -lwhatever.
4369
4370Make sure you include the appropriate -L/path flags if your C linker
4371does not normally search all of the directories you specified above,
4372namely
4373 $libpth
4374To use no flags, specify the word "none".
4375
4376EOH
4377
4378rp="Any additional ld flags (NOT including libraries)?"
4379. ./myread
4380case "$ans" in
4381none) ldflags='';;
4382*) ldflags="$ans";;
4383esac
4384rmlist="$rmlist pdp11"
4385
4386: coherency check
4387echo " "
dfe9444c 4388echo "Checking your choice of C compiler and flags for coherency..." >&4
5ff3f7a4
GS
4389$cat > try.c <<'EOF'
4390#include <stdio.h>
732c9516 4391int main() { printf("Ok\n"); exit(0); }
5ff3f7a4 4392EOF
87563a30 4393set X $cc $optimize $ccflags -o try $ldflags try.c $libs
a4f3eea9 4394shift
5ff3f7a4
GS
4395$cat >try.msg <<'EOM'
4396I've tried to compile and run the following simple program:
4397
4398EOM
a83b1ac8 4399$cat try.c >> try.msg
5ff3f7a4
GS
4400
4401$cat >> try.msg <<EOM
4402
4403I used the command:
a4f3eea9 4404
4405 $*
4406 ./try
4407
4408and I got the following output:
4409
4410EOM
a4f3eea9 4411dflt=y
28e8609d 4412if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
a4f3eea9 4413 if sh -c './try' >>try.msg 2>&1; then
dfe9444c
AD
4414 xxx=`./try`
4415 case "$xxx" in
4416 "Ok") dflt=n ;;
4417 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4418 case " $libs " in
4419 *" -lsfio "*)
4420 cat >> try.msg <<'EOQS'
4421If $libs contains -lsfio, and sfio is mis-configured, then it
4422sometimes (apparently) runs and exits with a 0 status, but with no
4423output! It may have to do with sfio's use of _exit vs. exit.
4424
4425EOQS
4426 rp="You have a big problem. Shall I abort Configure"
4427 dflt=y
4428 ;;
4429 esac
4430 ;;
4431 esac
a4f3eea9 4432 else
4433 echo "The program compiled OK, but exited with status $?." >>try.msg
dfe9444c 4434 rp="You have a problem. Shall I abort Configure"
a4f3eea9 4435 dflt=y
4436 fi
4437else
4438 echo "I can't compile the test program." >>try.msg
dfe9444c 4439 rp="You have a BIG problem. Shall I abort Configure"
a4f3eea9 4440 dflt=y
4441fi
4442case "$dflt" in
4443y)
97286747 4444 $cat try.msg >&4
a4f3eea9 4445 case "$knowitall" in
4446 '')
5ff3f7a4 4447 echo "(The supplied flags or libraries might be incorrect.)"
a4f3eea9 4448 ;;
4449 *) dflt=n;;
4450 esac
4451 echo " "
4452 . ./myread
4453 case "$ans" in
4454 n*|N*) ;;
4455 *) echo "Ok. Stopping Configure." >&4
4456 exit 1
4457 ;;
4458 esac
4459 ;;
4460n) echo "OK, that should do.";;
4461esac
4462$rm -f try try.* core
4463
bfb7748a
AD
4464: determine filename position in cpp output
4465echo " "
4466echo "Computing filename position in cpp output for #include directives..." >&4
4467echo '#include <stdio.h>' > foo.c
4468$cat >fieldn <<EOF
4469$startsh
4470$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4471$grep '^[ ]*#.*stdio\.h' | \
4472while read cline; do
4473 pos=1
4474 set \$cline
4475 while $test \$# -gt 0; do
4476 if $test -r \`echo \$1 | $tr -d '"'\`; then
4477 echo "\$pos"
4478 exit 0
4479 fi
4480 shift
4481 pos=\`expr \$pos + 1\`
4482 done
4483done
4484EOF
4485chmod +x fieldn
4486fieldn=`./fieldn`
4487$rm -f foo.c fieldn
4488case $fieldn in
4489'') pos='???';;
44901) pos=first;;
44912) pos=second;;
44923) pos=third;;
4493*) pos="${fieldn}th";;
4494esac
4495echo "Your cpp writes the filename in the $pos field of the line."
4496
4497: locate header file
4498$cat >findhdr <<EOF
4499$startsh
4500wanted=\$1
9cc6feab 4501name=''
3656fc86
JH
4502for usrincdir in $usrinc
4503do
4504 if test -f \$usrincdir/\$wanted; then
4505 echo "\$usrincdir/\$wanted"
4506 exit 0
4507 fi
4508done
bfb7748a
AD
4509awkprg='{ print \$$fieldn }'
4510echo "#include <\$wanted>" > foo\$\$.c
4511$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4512$grep "^[ ]*#.*\$wanted" | \
4513while read cline; do
4514 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4515 case "\$name" in
4e400192
JH
4516 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4517 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4518 *) exit 2;;
bfb7748a
AD
4519 esac;
4520done;
4e400192
JH
4521#
4522# status = 0: grep returned 0 lines, case statement not executed
4523# status = 1: headerfile found
4524# status = 2: while loop executed, no headerfile found
4525#
4526status=\$?
bfb7748a 4527$rm -f foo\$\$.c;
4e400192
JH
4528if test \$status -eq 1; then
4529 exit 0;
4530fi
4531exit 1
bfb7748a
AD
4532EOF
4533chmod +x findhdr
4534
4535: define an alternate in-header-list? function
4536inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4537cont=true; xxf="echo \"<\$1> found.\" >&4";
4538case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4539*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4540esac;
4541case $# in 4) instead=instead;; *) instead="at last";; esac;
4542while $test "$cont"; do
4543 xxx=`./findhdr $1`
4544 var=$2; eval "was=\$$2";
4545 if $test "$xxx" && $test -r "$xxx";
4546 then eval $xxf;
4547 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4548 cont="";
4549 else eval $xxnf;
4550 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4551 set $yyy; shift; shift; yyy=$@;
4552 case $# in 0) cont="";;
4553 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4554 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4555 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4556 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4557 esac;
4558done;
4559while $test "$yyy";
4560do set $yyy; var=$2; eval "was=\$$2";
4561 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4562 set $yyy; shift; shift; yyy=$@;
4563done'
4564
4565: see if this is a malloc.h system
4566set malloc.h i_malloc
4567eval $inhdr
4568
4569: see if stdlib is available
4570set stdlib.h i_stdlib
4571eval $inhdr
4572
4573: determine which malloc to compile in
4574echo " "
4575case "$usemymalloc" in
5ff3f7a4
GS
4576''|[yY]*|true|$define) dflt='y' ;;
4577*) dflt='n' ;;
bfb7748a
AD
4578esac
4579rp="Do you wish to attempt to use the malloc that comes with $package?"
4580. ./myread
4581usemymalloc="$ans"
4582case "$ans" in
4583y*|true)
4584 usemymalloc='y'
4585 mallocsrc='malloc.c'
4586 mallocobj="malloc$_o"
4587 d_mymalloc="$define"
4588 case "$libs" in
4589 *-lmalloc*)
4590 : Remove malloc from list of libraries to use
4591 echo "Removing unneeded -lmalloc from library list" >&4
4592 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4593 shift
4594 libs="$*"
4595 echo "libs = $libs" >&4
4596 ;;
4597 esac
4598 ;;
4599*)
4600 usemymalloc='n'
4601 mallocsrc=''
4602 mallocobj=''
4603 d_mymalloc="$undef"
4604 ;;
4605esac
4606
4607: compute the return types of malloc and free
4608echo " "
4609$cat >malloc.c <<END
4610#$i_malloc I_MALLOC
4611#$i_stdlib I_STDLIB
4612#include <stdio.h>
4613#include <sys/types.h>
4614#ifdef I_MALLOC
4615#include <malloc.h>
4616#endif
4617#ifdef I_STDLIB
4618#include <stdlib.h>
4619#endif
4620#ifdef TRY_MALLOC
4621void *malloc();
4622#endif
4623#ifdef TRY_FREE
4624void free();
4625#endif
4626END
4627case "$malloctype" in
4628'')
4629 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4630 malloctype='void *'
4631 else
4632 malloctype='char *'
4633 fi
4634 ;;
4635esac
4636echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4637
4638case "$freetype" in
4639'')
4640 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4641 freetype='void'
4642 else
4643 freetype='int'
4644 fi
4645 ;;
4646esac
4647echo "Your system uses $freetype free(), it would seem." >&4
4648$rm -f malloc.[co]
a3635516
JH
4649$cat <<EOM
4650
4651The installation process will also create a directory for
4652vendor-supplied add-ons. Vendors who supply perl with their system
4653may find it convenient to place all vendor-supplied files in this
4654directory rather than in the main distribution directory. This will
4655ease upgrades between binary-compatible maintenance versions of perl.
4656
4657Of course you may also use these directories in whatever way you see
4658fit. For example, you might use them to access modules shared over a
4659company-wide network.
4660
4661The default answer should be fine for most people.
4662This causes further questions about vendor add-ons to be skipped
4663and no vendor-specific directories will be configured for perl.
4664
4665EOM
4666rp='Do you want to configure vendor-specific add-on directories?'
4667case "$usevendorprefix" in
4668define|true|[yY]*) dflt=y ;;
4669*) dflt=n ;;
4670esac
4671. ./myread
4672case "$ans" in
4673[yY]*) fn=d~+
4674 rp='Installation prefix to use for vendor-supplied add-ons?'
4675 case "$vendorprefix" in
4676 '') dflt='' ;;
4677 *) dflt=$vendorprefix ;;
4678 esac
4679 . ./getfile
4680 oldvendorprefix=''
4681 case "$vendorprefix" in
4682 '') ;;
4683 *) case "$ans" in
4684 "$prefix") ;;
4685 *) oldvendorprefix="$prefix";;
4686 esac
4687 ;;
4688 esac
4689 usevendorprefix="$define"
4690 vendorprefix="$ans"
4691 vendorprefixexp="$ansexp"
4692 ;;
4693*) usevendorprefix="$undef"
4694 vendorprefix=''
4695 vendorprefixexp=''
4696 ;;
4697esac
4698
4699case "$vendorprefix" in
4700'') d_vendorlib="$undef"
4701 vendorlib=''
4702 vendorlibexp=''
4703 ;;
4704*) d_vendorlib="$define"
4705 : determine where vendor-supplied modules go.
4706 : Usual default is /usr/local/lib/perl5/vendor_perl
4707 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4708 case "$installstyle" in
4709 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4710 *) dflt=$vendorprefix/lib/vendor_$prog ;;
4711 esac
4712 fn=d~+
4713 rp='Pathname for the vendor-supplied library files?'
4714 . ./getfile
4715 vendorlib="$ans"
4716 vendorlibexp="$ansexp"
4717 : Change installation prefix, if necessary.
4718 if $test X"$prefix" != X"$installprefix"; then
ec897fb9 4719 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
a3635516
JH
4720 else
4721 installvendorlib="$vendorlibexp"
4722 fi
4723 ;;
4724esac
4725
c4f23d77
AD
4726: Cruising for prototypes
4727echo " "
4728echo "Checking out function prototypes..." >&4
4729$cat >prototype.c <<'EOCP'
5a411a32 4730int main(int argc, char *argv[]) {
c4f23d77
AD
4731 exit(0);}
4732EOCP
4733if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4734 echo "Your C compiler appears to support function prototypes."
4735 val="$define"
4736else
4737 echo "Your C compiler doesn't seem to understand function prototypes."
4738 val="$undef"
4739fi
4740set prototype
4741eval $setvar
4742$rm -f prototype*
4743
4744case "$prototype" in
4745"$define") ;;
4746*) ansi2knr='ansi2knr'
4747 echo " "
4748 cat <<EOM >&4
4749
4750$me: FATAL ERROR:
4751This version of $package can only be compiled by a compiler that
4752understands function prototypes. Unfortunately, your C compiler
4753 $cc $ccflags
4754doesn't seem to understand them. Sorry about that.
4755
5ff3f7a4 4756If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
4757
4758Eventually, we hope to support building Perl with pre-ANSI compilers.
4759If you would like to help in that effort, please contact <perlbug@perl.org>.
4760
4761Aborting Configure now.
4762EOM
4763 exit 2
4764 ;;
4765esac
4766
4767: determine where public executables go
4768echo " "
4769set dflt bin bin
4770eval $prefixit
4771fn=d~
4772rp='Pathname where the public executables will reside?'
4773. ./getfile
4774if $test "X$ansexp" != "X$binexp"; then
4775 installbin=''
4776fi
4777bin="$ans"
4778binexp="$ansexp"
dd4e71fd
JH
4779: Change installation prefix, if necessary.
4780: XXX Bug? -- ignores Configure -Dinstallprefix setting.
4781if $test X"$prefix" != X"$installprefix"; then
ec897fb9 4782 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
4783else
4784 installbin="$binexp"
c4f23d77
AD
4785fi
4786
104d25b7
JH
4787: determine whether to install perl also as /usr/bin/perl
4788
4789echo " "
dd4e71fd 4790if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7
JH
4791 $cat <<EOM
4792Many scripts expect to perl to be installed as /usr/bin/perl.
4793I can install the perl you are about to compile also as /usr/bin/perl
4794(in addition to $installbin/perl).
4795EOM
472a4973
JH
4796 case "$installusrbinperl" in
4797 "$undef"|[nN]*) dflt='n';;
4798 *) dflt='y';;
4799 esac
104d25b7
JH
4800 rp="Do you want to install perl as /usr/bin/perl?"
4801 . ./myread
4802 case "$ans" in
4803 [yY]*) val="$define";;
472a4973 4804 *) val="$undef" ;;
104d25b7 4805 esac
472a4973
JH
4806else
4807 val="$undef"
4808fi
104d25b7
JH
4809set installusrbinperl
4810eval $setvar
4811
dfe9444c
AD
4812: define a shorthand compile call
4813compile='
4814mc_file=$1;
4815shift;
c4f23d77 4816$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
dc45a647
MB
4817: define a shorthand compile call for compilations that should be ok.
4818compile_ok='
4819mc_file=$1;
4820shift;
c4f23d77 4821$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
dfe9444c 4822
a4f3eea9 4823echo " "
4824echo "Checking for GNU C Library..." >&4
4825cat >gnulibc.c <<EOM
aebf16e7 4826#include <stdio.h>
5a411a32 4827int main()
a4f3eea9 4828{
aebf16e7
AD
4829#ifdef __GLIBC__
4830 exit(0);
4831#else
4832 exit(1);
4833#endif
a4f3eea9 4834}
4835EOM
dfe9444c 4836set gnulibc
aebf16e7 4837if eval $compile_ok && ./gnulibc; then
a4f3eea9 4838 val="$define"
4839 echo "You are using the GNU C Library"
4633a7c4 4840else
a4f3eea9 4841 val="$undef"
4842 echo "You are not using the GNU C Library"
4633a7c4 4843fi
a4f3eea9 4844$rm -f gnulibc*
4845set d_gnulibc
4846eval $setvar
25f94b33 4847
a4f3eea9 4848: see if nm is to be used to determine whether a symbol is defined or not
4849case "$usenm" in
4850'')
dc45a647 4851 dflt=''
a4f3eea9 4852 case "$d_gnulibc" in
dc45a647
MB
4853 "$define")
4854 echo " "
4855 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 4856 dflt=n
4857 ;;
dc45a647
MB
4858 esac
4859 case "$dflt" in
4860 '')
4861 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4862 echo " "
4863 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4864 echo "'nm' won't be sufficient on this sytem." >&4
4865 dflt=n
4866 fi
4867 ;;
4868 esac
4869 case "$dflt" in
c4f23d77 4870 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 4871 if $test $dflt -gt 20; then
4872 dflt=y
4873 else
4874 dflt=n
4875 fi
4876 ;;
4877 esac
4878 ;;
4879*)
4880 case "$usenm" in
dc45a647 4881 true|$define) dflt=y;;
a4f3eea9 4882 *) dflt=n;;
4883 esac
4884 ;;
25f94b33 4885esac
a4f3eea9 4886$cat <<EOM
4633a7c4 4887
dc45a647
MB
4888I can use $nm to extract the symbols from your C libraries. This
4889is a time consuming task which may generate huge output on the disk (up
4890to 3 megabytes) but that should make the symbols extraction faster. The
4891alternative is to skip the 'nm' extraction part and to compile a small
4892test program instead to determine whether each symbol is present. If
4893you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4894this may be the best solution.
4895
4896You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 4897
a4f3eea9 4898EOM
693762b4 4899rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
4900. ./myread
4901case "$ans" in
dc45a647 4902[Nn]*) usenm=false;;
a4f3eea9 4903*) usenm=true;;
4633a7c4
LW
4904esac
4905
a4f3eea9 4906runnm=$usenm
4907case "$reuseval" in
4908true) runnm=false;;
4633a7c4 4909esac
a4f3eea9 4910
4911: nm options which may be necessary
4912case "$nm_opt" in
4913'') if $test -f /mach_boot; then
1e422769 4914 nm_opt='' # Mach
a4f3eea9 4915 elif $test -d /usr/ccs/lib; then
1e422769 4916 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 4917 elif $test -f /dgux; then
1e422769 4918 nm_opt='-p' # DG-UX
2ae324a7 4919 elif $test -f /lib64/rld; then
1e422769 4920 nm_opt='-p' # 64-bit Irix
a4f3eea9 4921 else
4922 nm_opt=''
4923 fi;;
4633a7c4 4924esac
4633a7c4 4925
a4f3eea9 4926: nm options which may be necessary for shared libraries but illegal
4927: for archive libraries. Thank you, Linux.
4928case "$nm_so_opt" in
4929'') case "$myuname" in
4930 *linux*)
693762b4 4931 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 4932 nm_so_opt='--dynamic'
4633a7c4 4933 fi
a4f3eea9 4934 ;;
4633a7c4 4935 esac
4633a7c4
LW
4936 ;;
4937esac
4938
a4f3eea9 4939case "$runnm" in
4940true)
4941: get list of predefined functions in a handy place
4942echo " "
4943case "$libc" in
4944'') libc=unknown
4945 case "$libs" in
dfe9444c 4946 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 4947 esac
4948 ;;
4949esac
4950libnames='';
4951case "$libs" in
4952'') ;;
4953*) for thislib in $libs; do
4954 case "$thislib" in
4955 -lc|-lc_s)
4956 : Handle C library specially below.
4957 ;;
4958 -l*)
4959 thislib=`echo $thislib | $sed -e 's/^-l//'`
4960 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4961 :
4962 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4963 :
dfe9444c 4964 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 4965 :
dfe9444c 4966 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 4967 :
a4f3eea9 4968 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4969 :
4970 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4971 :
dfe9444c 4972 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 4973 :
4974 else
4975 try=''
4976 fi
4977 libnames="$libnames $try"
4978 ;;
4979 *) libnames="$libnames $thislib" ;;
4980 esac
4981 done
4982 ;;
4983esac
4984xxx=normal
4985case "$libc" in
4986unknown)
4987 set /lib/libc.$so
4988 for xxx in $libpth; do
4989 $test -r $1 || set $xxx/libc.$so
4990 : The messy sed command sorts on library version numbers.
4991 $test -r $1 || \
4992 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 4993 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 4994 h
4995 s/[0-9][0-9]*/0000&/g
4996 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4997 G
4998 s/\n/ /' | \
dfe9444c 4999 sort | $sed -e 's/^.* //'`
a4f3eea9 5000 eval set \$$#
5001 done
5002 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
5003 $test -r $1 || set /lib/libsys_s$_a
5004 ;;
a4f3eea9 5005*)
5006 set blurfl
5007 ;;
5008esac
5009if $test -r "$1"; then
5010 echo "Your (shared) C library seems to be in $1."
5011 libc="$1"
5012elif $test -r /lib/libc && $test -r /lib/clib; then
5013 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5014 xxx=apollo
5015 libc='/lib/clib /lib/libc'
5016 if $test -r /lib/syslib; then
5017 echo "(Your math library is in /lib/syslib.)"
5018 libc="$libc /lib/syslib"
5019 fi
5020elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5021 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
5022elif $test -r $incpath/usr/lib/libc$_a; then
5023 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 5024 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
5025elif $test -r /lib/libc$_a; then
5026 libc=/lib/libc$_a;
a4f3eea9 5027 echo "Your C library seems to be in $libc. You're normal."
5028else
dfe9444c 5029 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 5030 :
5031 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5032 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5033 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5034 :
dfe9444c 5035 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5036 :
dfe9444c 5037 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5038 :
4633a7c4 5039 else
dfe9444c 5040 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 5041 fi
a4f3eea9 5042 if $test -r "$tans"; then
5043 echo "Your C library seems to be in $tans, of all places."
5044 libc=$tans
5045 else
5046 libc='blurfl'
5047 fi
5048fi
5049if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5050 dflt="$libc"
5051 cat <<EOM
4633a7c4 5052
a4f3eea9 5053If the guess above is wrong (which it might be if you're using a strange
5054compiler, or your machine supports multiple models), you can override it here.
4633a7c4 5055
a4f3eea9 5056EOM
5057else
5058 dflt=''
28e8609d 5059 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 5060 cat >&4 <<EOM
5061I can't seem to find your C library. I've looked in the following places:
4633a7c4 5062
a4f3eea9 5063EOM
5064 $sed 's/^/ /' libpath
5065 cat <<EOM
4633a7c4 5066
a4f3eea9 5067None of these seems to contain your C library. I need to get its name...
4633a7c4 5068
a4f3eea9 5069EOM
5070fi
5071fn=f
5072rp='Where is your C library?'
5073. ./getfile
5074libc="$ans"
4633a7c4 5075
4633a7c4 5076echo " "
28e8609d 5077echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 5078set X `cat libnames`
4633a7c4 5079shift
a4f3eea9 5080xxx=files
5081case $# in 1) xxx=file; esac
5082echo "Extracting names from the following $xxx for later perusal:" >&4
5083echo " "
5084$sed 's/^/ /' libnames >&4
5085echo " "
5086$echo $n "This may take a while...$c" >&4
4633a7c4 5087
dfe9444c
AD
5088for file in $*; do
5089 case $file in
693762b4
AD
5090 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5091 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5092 esac
dfe9444c 5093done >libc.tmp
4633a7c4 5094
a4f3eea9 5095$echo $n ".$c"
5096$grep fprintf libc.tmp > libc.ptf
5097xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5098xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5099xxx='[ADTSIW]'
5100if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5101 eval $xscan;\
5102 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5103 eval $xrun
5104elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5105 eval $xscan;\
5106 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5107 eval $xrun
5108elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5109 eval $xscan;\
5110 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5111 eval $xrun
5112elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5113 eval $xscan;\
5114 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5115 eval $xrun
5116elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5117 eval $xscan;\
5118 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5119 eval $xrun
5120elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5121 eval $xscan;\
5122 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5123 eval $xrun
5124elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5125 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5126 eval $xscan;\
5127 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5128 eval $xrun
5129elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5130 eval $xscan;\
5131 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5132 eval $xrun
5133elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5134 eval $xscan;\
5135 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5136 eval $xrun
1e422769 5137elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5138 eval $xscan;\
5139 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5140 eval $xrun
a4f3eea9 5141elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5142 eval $xscan;\
5143 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5144 eval $xrun
5145elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5146 eval $xscan;\
5147 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5148 eval $xrun
44a8e56a 5149elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5150 eval $xscan;\
5151 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5152 eval $xrun
0f502cca
BL
5153elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5154 eval $xscan;\
5155 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5156 eval $xrun
a4f3eea9 5157else
693762b4 5158 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 5159 $grep fprintf libc.tmp > libc.ptf
5160 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5161 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5162 then
5163 nm_opt='-p'
5164 eval $xrun
4633a7c4 5165 else
a4f3eea9 5166 echo " "
e5c9fcd0 5167 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 5168 com=''
dc45a647
MB
5169 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5170 for thisname in $libnames $libc; do
e5c9fcd0 5171 $ar t $thisname >>libc.tmp
a4f3eea9 5172 done
dfe9444c 5173 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 5174 echo "Ok." >&4
dc45a647
MB
5175 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5176 # Repeat libc to extract forwarders to DLL entries too
5177 for thisname in $libnames $libc; do
5178 $ar tv $thisname >>libc.tmp
5179 # Revision 50 of EMX has bug in $ar.
5180 # it will not extract forwarders to DLL entries
5181 # Use emximp which will extract exactly them.
5182 emximp -o tmp.imp $thisname \
5183 2>/dev/null && \
5184 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5185 < tmp.imp >>libc.tmp
5186 $rm tmp.imp
5187 done
5188 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5189 echo "Ok." >&4
a4f3eea9 5190 else
e5c9fcd0 5191 echo "$ar didn't seem to work right." >&4
a4f3eea9 5192 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 5193 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 5194 then
5195 for thisname in $libnames; do
5196 bld t $libnames | \
dfe9444c 5197 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 5198 $ar t $thisname >>libc.tmp
a4f3eea9 5199 done
5200 echo "Ok." >&4
5201 else
5202 echo "That didn't work either. Giving up." >&4
5203 exit 1
5204 fi
5205 fi
4633a7c4 5206 fi
4633a7c4 5207fi
a4f3eea9 5208nm_extract="$com"
5209if $test -f /lib/syscalls.exp; then
4633a7c4 5210 echo " "
a4f3eea9 5211 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 5212 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 5213fi
5214;;
5215esac
5216$rm -f libnames libpath
5217
2afac517 5218: see if dld is available
5219set dld.h i_dld
5220eval $inhdr
4633a7c4 5221
2afac517 5222: is a C symbol defined?
5223csym='tlook=$1;
5224case "$3" in
5225-v) tf=libc.tmp; tc=""; tdc="";;
5226-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5227*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5228esac;
5229tx=yes;
5230case "$reuseval-$4" in
5231true-) ;;
5232true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5233esac;
5234case "$tx" in
5235yes)
5236 case "$runnm" in
5237 true)
5238 if $contains $tlook $tf >/dev/null 2>&1;
5239 then tval=true;
5240 else tval=false;
5241 fi;;
5242 *)
d674cd6d 5243 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 5244 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 5245 then tval=true;
5246 else tval=false;
5247 fi;
5248 $rm -f t t.c;;
5249 esac;;
5250*)
5251 case "$tval" in
5252 $define) tval=true;;
5253 *) tval=false;;
5254 esac;;
5255esac;
5256eval "$2=$tval"'
4633a7c4 5257
2afac517 5258: define an is-in-libc? function
5259inlibc='echo " "; td=$define; tu=$undef;
5260sym=$1; var=$2; eval "was=\$$2";
5261tx=yes;
5262case "$reuseval$was" in
5263true) ;;
5264true*) tx=no;;
5265esac;
5266case "$tx" in
5267yes)
5268 set $sym tres -f;
5269 eval $csym;
5270 case "$tres" in
5271 true)
5272 echo "$sym() found." >&4;
5273 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5274 *)
5275 echo "$sym() NOT found." >&4;
5276 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5277 esac;;
5278*)
5279 case "$was" in
5280 $define) echo "$sym() found." >&4;;
5281 *) echo "$sym() NOT found." >&4;;
5282 esac;;
5283esac'
4633a7c4 5284
2afac517 5285: see if dlopen exists
5286xxx_runnm="$runnm"
5287runnm=false
5288set dlopen d_dlopen
5289eval $inlibc
5290runnm="$xxx_runnm"
40a7a20a 5291
2afac517 5292: determine which dynamic loading, if any, to compile in
4633a7c4 5293echo " "
2afac517 5294dldir="ext/DynaLoader"
5295case "$usedl" in
5296$define|y|true)
5297 dflt='y'
5298 usedl="$define"
5299 ;;
5300$undef|n|false)
5301 dflt='n'
5302 usedl="$undef"
5303 ;;
5304*)
5305 dflt='n'
5306 case "$d_dlopen" in
5307 $define) dflt='y' ;;
5308 esac
5309 case "$i_dld" in
5310 $define) dflt='y' ;;
4633a7c4 5311 esac
2afac517 5312 : Does a dl_xxx.xs file exist for this operating system
dc45a647 5313 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
5314 ;;
5315esac
2afac517 5316rp="Do you wish to use dynamic loading?"
5317. ./myread
5318usedl="$ans"
5319case "$ans" in
5320y*) usedl="$define"
5321 case "$dlsrc" in
5322 '')
dc45a647 5323 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 5324 dflt="$dldir/dl_${osname}.xs"
5325 elif $test "$d_dlopen" = "$define" ; then
5326 dflt="$dldir/dl_dlopen.xs"
5327 elif $test "$i_dld" = "$define" ; then
5328 dflt="$dldir/dl_dld.xs"
4633a7c4 5329 else
2afac517 5330 dflt=''
4633a7c4 5331 fi
4633a7c4 5332 ;;
2afac517 5333 *) dflt="$dldir/$dlsrc"
5334 ;;
4633a7c4 5335 esac
2afac517 5336 echo "The following dynamic loading files are available:"
5337 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
5338 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5339 rp="Source file to use for dynamic loading"
5340 fn="fne"
b233458b 5341 gfpth="$src"
dc45a647 5342 . ./getfile
2afac517 5343 usedl="$define"
5344 : emulate basename
5345 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 5346
dc45a647 5347 $cat << EOM
2304df62 5348
2afac517 5349Some systems may require passing special flags to $cc -c to
5350compile modules that will be used to create a shared library.
5351To use no flags, say "none".
2304df62
AD
5352
5353EOM
2afac517 5354 case "$cccdlflags" in
5355 '') case "$gccversion" in
5356 '') case "$osname" in
5357 hpux) dflt='+z' ;;
5358 next) dflt='none' ;;
8cc95fdb 5359 irix*) dflt='-KPIC' ;;
3a6175e1 5360 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 5361 sunos) dflt='-pic' ;;
5362 *) dflt='none' ;;
dfe9444c
AD
5363 esac
5364 ;;
5365 *) case "$osname" in
3a6175e1 5366 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 5367 *) dflt='-fpic' ;;
81d89818 5368 esac ;;
2afac517 5369 esac ;;
bfb7748a 5370 ' ') dflt='none' ;;
2afac517 5371 *) dflt="$cccdlflags" ;;
5372 esac
5373 rp="Any special flags to pass to $cc -c to compile shared library modules?"
5374 . ./myread
5375 case "$ans" in
5376 none) cccdlflags=' ' ;;
5377 *) cccdlflags="$ans" ;;
5378 esac
2304df62 5379
2afac517 5380 cat << EOM
ecfc5424 5381
2afac517 5382Some systems use ld to create libraries that can be dynamically loaded,
5383while other systems (such as those using ELF) use $cc.
a0f45b59 5384
2afac517 5385EOM
5386 case "$ld" in
5387 '') $cat >try.c <<'EOM'
5388/* Test for whether ELF binaries are produced */
5389#include <fcntl.h>
5390#include <stdlib.h>
5a411a32 5391int main() {
2afac517 5392 char b[4];
5393 int i = open("a.out",O_RDONLY);
5394 if(i == -1)
5395 exit(1); /* fail */
5396 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5397 exit(0); /* succeed (yes, it's ELF) */
2304df62 5398 else
2afac517 5399 exit(1); /* fail */
5400}
5401EOM
5402 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5403 cat <<EOM
5404You appear to have ELF support. I'll use $cc to build dynamic libraries.
5405EOM
5406 dflt="$cc"
2304df62 5407 else
2afac517 5408 echo "I'll use ld to build dynamic libraries."
5409 dflt='ld'
2304df62 5410 fi
2afac517 5411 rm -f try.c a.out
5412 ;;
5413 *) dflt="$ld"
5414 ;;
5415 esac
5416
5417 rp="What command should be used to create dynamic libraries?"
5418 . ./myread
5419 ld="$ans"
5420
5421 cat << EOM
5422
5423Some systems may require passing special flags to $ld to create a
5424library that can be dynamically loaded. If your ld flags include
5425-L/other/path options to locate libraries outside your loader's normal
5426search path, you may need to specify those -L options here as well. To
5427use no flags, say "none".
5428
5429EOM
5430 case "$lddlflags" in
5431 '') case "$osname" in
46193409 5432 beos) dflt='-nostart' ;;
2afac517 5433 hpux) dflt='-b' ;;
5434 linux|irix*) dflt='-shared' ;;
5435 next) dflt='none' ;;
5436 solaris) dflt='-G' ;;
5437 sunos) dflt='-assert nodefinitions' ;;
5438 svr4*|esix*) dflt="-G $ldflags" ;;
5439 *) dflt='none' ;;
5440 esac
5441 ;;
5442 *) dflt="$lddlflags" ;;
5443 esac
5444
bfb7748a 5445 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
5446 : Be careful not to append to a plain 'none'
5447 case "$dflt" in
5448 none) dflt='' ;;
5449 esac
bfb7748a
AD
5450 for thisflag in $ldflags; do
5451 case "$thisflag" in
5452 -L*)
5453 case " $dflt " in
5454 *" $thisflag "*) ;;
5455 *) dflt="$dflt $thisflag" ;;
5456 esac
5457 ;;
2afac517 5458 esac
bfb7748a 5459 done
2afac517 5460
bfb7748a
AD
5461 case "$dflt" in
5462 ''|' ') dflt='none' ;;
5463 esac
2afac517 5464
5465 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5466 . ./myread
5467 case "$ans" in
5468 none) lddlflags=' ' ;;
5469 *) lddlflags="$ans" ;;
5470 esac
5471
5472 cat <<EOM
5473
5474Some systems may require passing special flags to $cc to indicate that
5475the resulting executable will use dynamic linking. To use no flags,
5476say "none".
5477
5478EOM
5479 case "$ccdlflags" in
5480 '') case "$osname" in
5481 hpux) dflt='-Wl,-E' ;;
5482 linux) dflt='-rdynamic' ;;
5483 next) dflt='none' ;;
5484 sunos) dflt='none' ;;
5485 *) dflt='none' ;;
5486 esac ;;
bfb7748a 5487 ' ') dflt='none' ;;
2afac517 5488 *) dflt="$ccdlflags" ;;
5489 esac
5490 rp="Any special flags to pass to $cc to use dynamic loading?"
5491 . ./myread
5492 case "$ans" in
5493 none) ccdlflags=' ' ;;
5494 *) ccdlflags="$ans" ;;
5495 esac
5496 ;;
5497*) usedl="$undef"
5498 ld='ld'
5499 dlsrc='dl_none.xs'
5500 lddlflags=''
5501 ccdlflags=''
5502 ;;
5503esac
5504
5505also=''
5506case "$usedl" in
5507$undef)
5508 # No dynamic loading being used, so don't bother even to prompt.
5509 useshrplib='false'
5510 ;;
5511*) case "$useshrplib" in
5512 '') case "$osname" in
46193409 5513 svr4*|dgux|dynixptx|esix|powerux|beos)
3e3baf6d 5514 dflt=y
2afac517 5515 also='Building a shared libperl is required for dynamic loading to work on your system.'
5516 ;;
5517 next*)
5518 case "$osvers" in
3e3baf6d 5519 4*) dflt=y
2afac517 5520 also='Building a shared libperl is needed for MAB support.'
5521 ;;
3e3baf6d 5522 *) dflt=n
2afac517 5523 ;;
5524 esac
5525 ;;
3e3baf6d 5526 *) dflt=n
2afac517 5527 ;;
5528 esac
5529 ;;
5530 $define|true|[Yy]*)
3e3baf6d 5531 dflt=y
2afac517 5532 ;;
3e3baf6d 5533 *) dflt=n
2afac517 5534 ;;
5535 esac
5536 $cat << EOM
5537
5538The perl executable is normally obtained by linking perlmain.c with
dfe9444c 5539libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 5540any other libraries needed on this system (such as -lm, etc.). Since
5541your system supports dynamic loading, it is probably possible to build
5542a shared libperl.$so. If you will have more than one executable linked
5543to libperl.$so, this will significantly reduce the size of each
5544executable, but it may have a noticeable affect on performance. The
5545default is probably sensible for your system.
5546$also
5547
5548EOM
5549 rp="Build a shared libperl.$so (y/n)"
5550 . ./myread
5551 case "$ans" in
5552 true|$define|[Yy]*)
5cf1d1f1 5553 useshrplib='true' ;;
2afac517 5554 *) useshrplib='false' ;;
5555 esac
5556 ;;
5557esac
5558
5559case "$useshrplib" in
5560true)
5561 case "$libperl" in
5562 '')
5563 # Figure out a good name for libperl.so. Since it gets stored in
5564 # a version-specific architecture-dependent library, the version
5565 # number isn't really that important, except for making cc/ld happy.
5566 #
5567 # A name such as libperl.so.3.1
5568 majmin="libperl.$so.$patchlevel.$subversion"
5569 # A name such as libperl.so.301
5570 majonly=`echo $patchlevel $subversion |
5571 $awk '{printf "%d%02d", $1, $2}'`
5572 majonly=libperl.$so.$majonly
5573 # I'd prefer to keep the os-specific stuff here to a minimum, and
5574 # rely on figuring it out from the naming of libc.
5575 case "${osname}${osvers}" in
5576 next4*)
5577 dflt=libperl.5.$so
5578 # XXX How handle the --version stuff for MAB?
5579 ;;
5580 linux*) # ld won't link with a bare -lperl otherwise.
5581 dflt=libperl.$so
5582 ;;
5583 *) # Try to guess based on whether libc has major.minor.
5584 case "$libc" in
5585 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5586 *libc.$so.[0-9]*) dflt=$majonly ;;
5587 *) dflt=libperl.$so ;;
5588 esac
5589 ;;
5590 esac
5591 ;;
5592 *) dflt=$libperl
5593 ;;
5594 esac
5595 cat << EOM
5596
5597I need to select a good name for the shared libperl. If your system uses
5598library names with major and minor numbers, then you might want something
5599like $majmin. Alternatively, if your system uses a single version
5600number for shared libraries, then you might want to use $majonly.
5601Or, your system might be quite happy with a simple libperl.$so.
5602
5603Since the shared libperl will get installed into a version-specific
5604architecture-dependent directory, the version number of the shared perl
5605library probably isn't important, so the default should be o.k.
5606
5607EOM
5608 rp='What name do you want to give to the shared libperl?'
5609 . ./myread
5610 libperl=$ans
5611 echo "Ok, I'll use $libperl"
5612 ;;
5613*)
dfe9444c 5614 libperl="libperl${_a}"
2afac517 5615 ;;
5616esac
5617
5618# Detect old use of shrpdir via undocumented Configure -Dshrpdir
5619case "$shrpdir" in
5620'') ;;
5621*) $cat >&4 <<EOM
5622WARNING: Use of the shrpdir variable for the installation location of
5623the shared $libperl is not supported. It was never documented and
46193409 5624will not work in this version. Let me (perlbug@perl.com)
dfe9444c 5625know of any problems this may cause.
2afac517 5626
5627EOM
5628 case "$shrpdir" in
5629 "$archlibexp/CORE")
5630 $cat >&4 <<EOM
5631But your current setting of $shrpdir is
5632the default anyway, so it's harmless.
5633EOM
5634 ;;
5635 *)
4e2a5f63
AD
5636 $cat >&4 <<EOM
5637Further, your current attempted setting of $shrpdir
5638conflicts with the value of $archlibexp/CORE
5639that installperl will use.
5640EOM
dc45a647
MB
5641 ;;
5642 esac
5643 ;;
5644esac
5645
5646# How will the perl executable find the installed shared $libperl?
5647# Add $xxx to ccdlflags.
5648# If we can't figure out a command-line option, use $shrpenv to
5649# set env LD_RUN_PATH. The main perl makefile uses this.
5650shrpdir=$archlibexp/CORE
5651xxx=''
5652tmp_shrpenv=''
5653if "$useshrplib"; then
5654 case "$osname" in
5655 aix)
5656 # We'll set it in Makefile.SH...
5657 ;;
5658 solaris|netbsd)
5659 xxx="-R $shrpdir"
5660 ;;
5661 freebsd)
5662 xxx="-Wl,-R$shrpdir"
5663 ;;
5664 linux|irix*|dec_osf)
5665 xxx="-Wl,-rpath,$shrpdir"
5666 ;;
5667 next)
5668 # next doesn't like the default...
5669 ;;
46193409
JH
5670 beos)
5671 # beos doesn't like the default, either.
5672 ;;
3656fc86
JH
5673 hpux*)
5674 # hpux doesn't like the default, either.
5675 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5676 ;;
dc45a647
MB
5677 *)
5678 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5679 ;;
5680 esac
5681 case "$xxx" in
5682 '') ;;
5683 *)
5684 # Only add $xxx if it isn't already in ccdlflags.
5685 case " $ccdlflags " in
5686 *" $xxx "*) ;;
5687 *) ccdlflags="$ccdlflags $xxx"
5688 cat <<EOM >&4
5689
5690Adding $xxx to the flags
5691passed to $ld so that the perl executable will find the
5692installed shared $libperl.
5693
5694EOM
5695 ;;
5696 esac
5697 ;;
5698 esac
5699fi
5cf1d1f1
JH
5700# Fix ccdlflags in AIX for building external extensions.
5701# (For building Perl itself bare -bE:perl.exp is needed,
5702# Makefile.SH takes care of this.)
5f9d9a17 5703case "$osname" in
5cf1d1f1 5704aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5f9d9a17 5705esac
dc45a647
MB
5706# Respect a hint or command-line value.
5707case "$shrpenv" in
5708'') shrpenv="$tmp_shrpenv" ;;
5709esac
5cf1d1f1
JH
5710case "$ldlibpthname" in
5711'') ldlibpthname=LD_LIBRARY_PATH ;;
5712none) ldlibpthname='' ;;
5713esac
dc45a647
MB
5714
5715: determine where manual pages go
5716set man1dir man1dir none
5717eval $prefixit
5718$cat <<EOM
5719
5720$spackage has manual pages available in source form.
5721EOM
5722case "$nroff" in
5723nroff)
5724 echo "However, you don't have nroff, so they're probably useless to you."
5725 case "$man1dir" in
5726 '') man1dir="none";;
5727 esac;;
5728esac
5729echo "If you don't want the manual sources installed, answer 'none'."
5730case "$man1dir" in
5731' ') dflt=none
5732 ;;
5733'')
5734 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5735 lookpath="$lookpath $prefixexp/man/p_man/man1"
5736 lookpath="$lookpath $prefixexp/man/u_man/man1"
5737 lookpath="$lookpath $prefixexp/man/man.1"
5738 case "$sysman" in
5739 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5740 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5741 esac
5742 set dflt
5743 eval $prefixup
5744 ;;
5745*) dflt="$man1dir"
5746 ;;
5747esac
5748echo " "
5749fn=dn+~
5750rp="Where do the main $spackage manual pages (source) go?"
5751. ./getfile
5752if $test "X$man1direxp" != "X$ansexp"; then
5753 installman1dir=''
5754fi
5755man1dir="$ans"
5756man1direxp="$ansexp"
5757case "$man1dir" in
dd4e71fd 5758'') man1dir=' '
dc45a647
MB
5759 installman1dir='';;
5760esac
dc45a647 5761
dd4e71fd
JH
5762: Change installation prefix, if necessary.
5763if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5764 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5765else
5766 installman1dir="$man1direxp"
dc45a647
MB
5767fi
5768
5769: What suffix to use on installed man pages
5770
5771case "$man1dir" in
5772' ')
5773 man1ext='0'
5774 ;;
5775*)
5776 rp="What suffix should be used for the main $spackage man pages?"
5777 case "$man1ext" in
5778 '') case "$man1dir" in
5779 *1) dflt=1 ;;
5780 *1p) dflt=1p ;;
5781 *1pm) dflt=1pm ;;
5782 *l) dflt=l;;
5783 *n) dflt=n;;
5784 *o) dflt=o;;
5785 *p) dflt=p;;
5786 *C) dflt=C;;
5787 *L) dflt=L;;
5788 *L1) dflt=L1;;
5789 *) dflt=1;;
5790 esac
5791 ;;
5792 *) dflt="$man1ext";;
5793 esac
5794 . ./myread
5795 man1ext="$ans"
5796 ;;
5797esac
5798
5799: see if we can have long filenames
5800echo " "
5801rmlist="$rmlist /tmp/cf$$"
5802$test -d /tmp/cf$$ || mkdir /tmp/cf$$
5803first=123456789abcdef
5804second=/tmp/cf$$/$first
5805$rm -f $first $second
5806if (echo hi >$first) 2>/dev/null; then
5807 if $test -f 123456789abcde; then
5808 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
5809 val="$undef"
5810 else
5811 if (echo hi >$second) 2>/dev/null; then
5812 if $test -f /tmp/cf$$/123456789abcde; then
5813 $cat <<'EOM'
5814That's peculiar... You can have filenames longer than 14 characters, but only
5815on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
5816I shall consider your system cannot support long filenames at all.
5817EOM
5818 val="$undef"
5819 else
5820 echo 'You can have filenames longer than 14 characters.' >&4
5821 val="$define"
5822 fi
5823 else
5824 $cat <<'EOM'
5825How confusing! Some of your filesystems are sane enough to allow filenames
5826longer than 14 characters but some others like /tmp can't even think about them.
5827So, for now on, I shall assume your kernel does not allow them at all.
5828EOM
5829 val="$undef"
5830 fi
5831 fi
5832else
5833 $cat <<'EOM'
5834You can't have filenames longer than 14 chars. You can't even think about them!
5835EOM
5836 val="$undef"
5837fi
5838set d_flexfnam
5839eval $setvar
5840$rm -rf /tmp/cf$$ 123456789abcde*
5841
5842: determine where library module manual pages go
5843set man3dir man3dir none
5844eval $prefixit
5845$cat <<EOM
5846
5847$spackage has manual pages for many of the library modules.
5848EOM
5849
5850case "$nroff" in
5851nroff)
5852 $cat <<'EOM'
5853However, you don't have nroff, so they're probably useless to you.
5854EOM
5855 case "$man3dir" in
5856 '') man3dir="none";;
5857 esac;;
5858esac
5859
5860case "$d_flexfnam" in
5861undef)
5862 $cat <<'EOM'
5863However, your system can't handle the long file names like File::Basename.3.
5864EOM
5865 case "$man3dir" in
5866 '') man3dir="none";;
5867 esac;;
5868esac
5869
5870echo "If you don't want the manual sources installed, answer 'none'."
5871prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5872case "$man3dir" in
dd4e71fd
JH
5873'') dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5874 if $test -d "$privlib/man/man3"; then
5875 cat <<EOM >&4
5876
5877WARNING: Previous versions of perl installed man3 pages into
5878$privlib/man/man3. This version will suggest a
5879new default of $dflt.
5880EOM
5881 tdflt=$dflt
5882 dflt='n'
5883 rp='Do you wish to preserve the old behavior?(y/n)'
5884 . ./myread
5885 case "$ans" in
5886 y*) dflt="$privlib/man/man3" ;;
5887 *) dflt=$tdflt ;;
5888 esac
5889 fi
2afac517 5890 ;;
dc45a647
MB
5891' ') dflt=none;;
5892*) dflt="$man3dir" ;;
2afac517 5893esac
dc45a647 5894echo " "
dc45a647
MB
5895fn=dn+~
5896rp="Where do the $package library man pages (source) go?"
5897. ./getfile
dc45a647
MB
5898man3dir="$ans"
5899man3direxp="$ansexp"
dd4e71fd
JH
5900case "$man1dir" in
5901'') man3dir=' '
dc45a647
MB
5902 installman3dir='';;
5903esac
dc45a647 5904
dd4e71fd
JH
5905: Change installation prefix, if necessary.
5906if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5907 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5908else
5909 installman3dir="$man3direxp"
dc45a647
MB
5910fi
5911
5912: What suffix to use on installed man pages
dc45a647
MB
5913case "$man3dir" in
5914' ')
5915 man3ext='0'
5916 ;;
5917*)
5918 rp="What suffix should be used for the $package library man pages?"
5919 case "$man3ext" in
5920 '') case "$man3dir" in
5921 *3) dflt=3 ;;
5922 *3p) dflt=3p ;;
5923 *3pm) dflt=3pm ;;
5924 *l) dflt=l;;
5925 *n) dflt=n;;
5926 *o) dflt=o;;
5927 *p) dflt=p;;
5928 *C) dflt=C;;
5929 *L) dflt=L;;
5930 *L3) dflt=L3;;
5931 *) dflt=3;;
2afac517 5932 esac
5933 ;;
dc45a647 5934 *) dflt="$man3ext";;
2afac517 5935 esac
dc45a647
MB
5936 . ./myread
5937 man3ext="$ans"
5938 ;;
2afac517 5939esac
5940
5941: see if we have to deal with yellow pages, now NIS.
5942if $test -d /usr/etc/yp || $test -d /etc/yp; then
5943 if $test -f /usr/etc/nibindd; then
5944 echo " "
5945 echo "I'm fairly confident you're on a NeXT."
5946 echo " "
5947 rp='Do you get the hosts file via NetInfo?'
5948 dflt=y
5949 case "$hostcat" in
5950 nidump*) ;;
5951 '') ;;
5952 *) dflt=n;;
5953 esac
5954 . ./myread
5955 case "$ans" in
5956 y*) hostcat='nidump hosts .';;
5957 *) case "$hostcat" in
5958 nidump*) hostcat='';;
5959 esac
5960 ;;
5961 esac
5962 fi
5963 case "$hostcat" in
5964 nidump*) ;;
5965 *)
5966 case "$hostcat" in
5967 *ypcat*) dflt=y;;
5968 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5969 dflt=y
5970 else
5971 dflt=n
5972 fi;;
5973 *) dflt=n;;
5974 esac
5975 echo " "
5976 rp='Are you getting the hosts file via yellow pages?'
5977 . ./myread
5978 case "$ans" in
5979 y*) hostcat='ypcat hosts';;
5980 *) hostcat='cat /etc/hosts';;
5981 esac
5982 ;;
5983 esac
5984fi
dfe9444c
AD
5985case "$hostcat" in
5986'') hostcat='cat /etc/hosts';;
5987esac
5988case "$groupcat" in
5989'') groupcat='cat /etc/group';;
5990esac
5991case "$passcat" in
5992'') passcat='cat /etc/passwd';;
5993esac
2afac517 5994
5995: now get the host name
5996echo " "
5997echo "Figuring out host name..." >&4
5998case "$myhostname" in
5999'') cont=true
6000 echo 'Maybe "hostname" will work...'
6001 if tans=`sh -c hostname 2>&1` ; then
6002 myhostname=$tans
6003 phostname=hostname
6004 cont=''
6005 fi
6006 ;;
6007*) cont='';;
6008esac
6009if $test "$cont"; then
6010 if ./xenix; then
6011 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
6012 if tans=`cat /etc/systemid 2>&1` ; then
6013 myhostname=$tans
6014 phostname='cat /etc/systemid'
6015 echo "Whadyaknow. Xenix always was a bit strange..."
6016 cont=''
6017 fi
6018 elif $test -r /etc/systemid; then
6019 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6020 fi
6021fi
6022if $test "$cont"; then
6023 echo 'No, maybe "uuname -l" will work...'
6024 if tans=`sh -c 'uuname -l' 2>&1` ; then
6025 myhostname=$tans
6026 phostname='uuname -l'
6027 else
6028 echo 'Strange. Maybe "uname -n" will work...'
6029 if tans=`sh -c 'uname -n' 2>&1` ; then
6030 myhostname=$tans
6031 phostname='uname -n'
6032 else
6033 echo 'Oh well, maybe I can mine it out of whoami.h...'
6034 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6035 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6036 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6037 else
6038 case "$myhostname" in
6039 '') echo "Does this machine have an identity crisis or something?"
6040 phostname='';;
6041 *)
6042 echo "Well, you said $myhostname before..."
6043 phostname='echo $myhostname';;
6044 esac
6045 fi
6046 fi
6047 fi
6048fi
6049: you do not want to know about this
6050set $myhostname
6051myhostname=$1
6052
6053: verify guess
6054if $test "$myhostname" ; then
6055 dflt=y
6056 rp='Your host name appears to be "'$myhostname'".'" Right?"
6057 . ./myread
6058 case "$ans" in
6059 y*) ;;
6060 *) myhostname='';;
6061 esac
6062fi
6063
6064: bad guess or no guess
6065while $test "X$myhostname" = X ; do
6066 dflt=''
6067 rp="Please type the (one word) name of your host:"
6068 . ./myread
6069 myhostname="$ans"
6070done
6071
6072: translate upper to lower if necessary
6073case "$myhostname" in
6074*[A-Z]*)
6075 echo "(Normalizing case in your host name)"
6076 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6077 ;;
6078esac
6079
6080case "$myhostname" in
6081*.*)
6082 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6083 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6084 echo "(Trimming domain name from host name--host name is now $myhostname)"
6085 ;;
6086*) case "$mydomain" in
6087 '')
6088 {
2afac517 6089 test "X$hostcat" = "Xypcat hosts" &&
6090 ypmatch "$myhostname" hosts 2>/dev/null |\
6091 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
6092 $test -s hosts
6093 } || {
2afac517 6094 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
6095 /[ ]$myhostname[ . ]/p" > hosts
6096 }
6097 tmp_re="[ . ]"
6098 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
6099 END { print sum }" hosts` = x1 || tmp_re="[ ]"
6100 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6101 hosts | $sort | $uniq | \
6102 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6103 case `$echo X$dflt` in
6104 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
6105 dflt=.
6106 ;;
6107 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6108 ;;
6109 esac
6110 case "$dflt" in
6111 .)
6112 tans=`./loc resolv.conf X /etc /usr/etc`
6113 if $test -f "$tans"; then
6114 echo "(Attempting domain name extraction from $tans)"
a6006777 6115 dflt=.`$sed -n -e 's/ / /g' \
28757baa 6116 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 6117 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 6118 case "$dflt" in
a6006777 6119 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 6120 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 6121 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 6122 ;;
2afac517 6123 esac
6124 fi
6125 ;;
6126 esac
6127 case "$dflt" in
6128 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6129 dflt=.`sh -c domainname 2>/dev/null`
6130 case "$dflt" in
6131 '') dflt='.';;
6132 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6133 esac
6134 ;;
6135 esac
6136 case "$dflt" in
6137 .) echo "(Lost all hope -- silly guess then)"
6138 dflt='.uucp'
6139 ;;
6140 esac
6141 $rm -f hosts
6142 ;;
6143 *) dflt="$mydomain";;
6144 esac;;
6145esac
6146echo " "
6147rp="What is your domain name?"
6148. ./myread
6149tans="$ans"
6150case "$ans" in
6151'') ;;
6152.*) ;;
6153*) tans=".$tans";;
6154esac
6155mydomain="$tans"
6156
6157: translate upper to lower if necessary
6158case "$mydomain" in
6159*[A-Z]*)
6160 echo "(Normalizing case in your domain name)"
6161 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6162 ;;
6163esac
6164
6165: a little sanity check here
6166case "$phostname" in
6167'') ;;
6168*)
6169 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6170 $myhostname$mydomain|$myhostname) ;;
6171 *)
6172 case "$phostname" in
6173 sed*)
6174 echo "(That doesn't agree with your whoami.h file, by the way.)"
6175 ;;
6176 *)
6177 echo "(That doesn't agree with your $phostname command, by the way.)"
6178 ;;
6179 esac
6180 ;;
6181 esac
6182 ;;
6183esac
6184
6185$cat <<EOM
6186
6187I need to get your e-mail address in Internet format if possible, i.e.
6188something like user@host.domain. Please answer accurately since I have
6189no easy means to double check it. The default value provided below
6190is most probably close to the reality but may not be valid from outside
6191your organization...
6192
6193EOM
6194cont=x
6195while test "$cont"; do
6196 case "$cf_email" in
6197 '') dflt="$cf_by@$myhostname$mydomain";;
6198 *) dflt="$cf_email";;
6199 esac
6200 rp='What is your e-mail address?'
6201 . ./myread
6202 cf_email="$ans"
6203 case "$cf_email" in
6204 *@*.*) cont='' ;;
6205 *)
6206 rp='Address does not look like an Internet one. Use it anyway?'
6207 case "$fastread" in
6208 yes) dflt=y ;;
6209 *) dflt=n ;;
6210 esac
6211 . ./myread
6212 case "$ans" in
6213 y*) cont='' ;;
6214 *) echo " " ;;
6215 esac
6216 ;;
6217 esac
6218done
6219
6220$cat <<EOM
6221
6222If you or somebody else will be maintaining perl at your site, please
6223fill in the correct e-mail address here so that they may be contacted
6224if necessary. Currently, the "perlbug" program included with perl
6225will send mail to this address in addition to perlbug@perl.com. You may
6226enter "none" for no administrator.
6227
6228EOM
6229case "$perladmin" in
6230'') dflt="$cf_email";;
6231*) dflt="$perladmin";;
6232esac
6233rp='Perl administrator e-mail address'
6234. ./myread
6235perladmin="$ans"
6236
5f05dabc 6237: figure out how to guarantee perl startup
6238case "$startperl" in
6239'')
6240 case "$sharpbang" in
6241 *!)
6242 $cat <<EOH
6243
6244I can use the #! construct to start perl on your system. This will
6245make startup of perl scripts faster, but may cause problems if you
6246want to share those scripts and perl is not in a standard place
6247($binexp/perl) on all your platforms. The alternative is to force
6248a shell by starting the script with a single ':' character.
6249
6250EOH
6251 dflt="$binexp/perl"
6252 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6253 . ./myread
6254 case "$ans" in
68dc0745 6255 none) startperl=": # use perl";;
6256 *) startperl="#!$ans"
3e3baf6d 6257 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 6258 $cat >&4 <<EOM
6259
6260WARNING: Some systems limit the #! command to 32 characters.
6261If you experience difficulty running Perl scripts with #!, try
6262installing Perl in a directory with a shorter pathname.
6263
6264EOM
6265 fi ;;
5f05dabc 6266 esac
6267 ;;
6268 *) startperl=": # use perl"
6269 ;;
6270 esac
6271 ;;
6272esac
6273echo "I'll use $startperl to start perl scripts."
6274
6275: figure best path for perl in scripts
6276case "$perlpath" in
6277'')
6278 perlpath="$binexp/perl"
6279 case "$startperl" in
6280 *!*) ;;
6281 *)
6282 $cat <<EOH
6283
6284I will use the "eval 'exec'" idiom to start Perl on your system.
6285I can use the full path of your Perl binary for this purpose, but
6286doing so may cause problems if you want to share those scripts and
6287Perl is not always in a standard place ($binexp/perl).
6288
6289EOH
6290 dflt="$binexp/perl"
6291 rp="What path shall I use in \"eval 'exec'\"?"
6292 . ./myread
6293 perlpath="$ans"
6294 ;;
6295 esac
6296 ;;
6297esac
6298case "$startperl" in
6299*!*) ;;
6300*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6301esac
6302
dc45a647
MB
6303: determine where public executable scripts go
6304set scriptdir scriptdir
6305eval $prefixit
6306case "$scriptdir" in
6307'')
6308 dflt="$bin"
6309 : guess some guesses
6310 $test -d /usr/share/scripts && dflt=/usr/share/scripts
dd4e71fd
JH
6311 $test -d /usr/share/bin && dflt=/usr/share/bin
6312 $test -d /usr/local/script && dflt=/usr/local/script
6313 $test -d /usr/local/scripts && dflt=/usr/local/scripts
6314 $test -d $prefixexp/script && dflt=$prefixexp/script
dc45a647
MB
6315 set dflt
6316 eval $prefixup
6317 ;;
6318*) dflt="$scriptdir"
6319 ;;
6320esac
6321$cat <<EOM
6322
6323Some installations have a separate directory just for executable scripts so
6324that they can mount it across multiple architectures but keep the scripts in
6325one spot. You might, for example, have a subdirectory of /usr/share for this.
6326Or you might just lump your scripts in with all your other executables.
6327
6328EOM
6329fn=d~
6330rp='Where do you keep publicly executable scripts?'
6331. ./getfile
6332if $test "X$ansexp" != "X$scriptdirexp"; then
6333 installscript=''
6334fi
6335scriptdir="$ans"
6336scriptdirexp="$ansexp"
dd4e71fd
JH
6337: Change installation prefix, if necessary.
6338if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6339 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
dd4e71fd
JH
6340else
6341 installscript="$scriptdirexp"
6342fi
dc45a647 6343
dd4e71fd
JH
6344$cat <<EOM
6345
6346After $package is installed, you may wish to install various
6347add-on modules and utilities. Typically, these add-ons will
6348be installed under $prefix with the rest
6349of this package. However, you may wish to install such add-ons
6350elsewhere under a different prefix.
6351
6352If you do not wish to put everything under a single prefix, that's
6353ok. You will be prompted for the individual locations; this siteprefix
6354is only used to suggest the defaults.
6355
6356The default should be fine for most people.
dc45a647
MB
6357
6358EOM
dd4e71fd
JH
6359fn=d~+
6360rp='Installation prefix to use for add-on modules and utilities?'
6361: XXX Here might be another good place for an installstyle setting.
6362case "$siteprefix" in
6363'') dflt=$prefix ;;
6364*) dflt=$siteprefix ;;
6365esac
6366. ./getfile
6367oldsiteprefix=''
6368case "$siteprefix" in
6369'') ;;
6370*)
6371 case "$ans" in
6372 "$prefix") ;;
6373 *) oldsiteprefix="$prefix";;
dc45a647 6374 esac
dd4e71fd
JH
6375 ;;
6376esac
6377siteprefix="$ans"
6378siteprefixexp="$ansexp"
dc45a647
MB
6379
6380: determine where site specific libraries go.
dd4e71fd
JH
6381: Usual default is /usr/local/lib/perl5/site_perl
6382: The default "style" setting is made in installstyle.U
6383: XXX No longer works with Prefixit stuff.
bfb7748a 6384prog=`echo $package | $sed 's/-*[0-9.]*$//'`
dd4e71fd 6385case "$installstyle" in
a3635516 6386*lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
dd4e71fd 6387*) dflt=$siteprefix/lib/site_$prog ;;
dc45a647
MB
6388esac
6389$cat <<EOM
6390
dd4e71fd
JH
6391The installation process will create a directory for
6392site-specific extensions and modules. Most users find it convenient
68c15b6f
HM
6393to place all site-specific files in this directory rather than in the
6394main distribution directory.
dc45a647
MB
6395
6396EOM
6397fn=d~+
6398rp='Pathname for the site-specific library files?'
6399. ./getfile
dc45a647
MB
6400sitelib="$ans"
6401sitelibexp="$ansexp"
dd4e71fd
JH
6402: Change installation prefix, if necessary.
6403if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6404 installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6405else
6406 installsitelib="$sitelibexp"
dc45a647
MB
6407fi
6408
6409: determine where site specific architecture-dependent libraries go.
dd4e71fd 6410: sitelib default is /usr/local/lib/perl5/site_perl/
bfb7748a 6411: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
3a6175e1 6412: sitelib may have an optional trailing /share.
bfb7748a 6413tdflt=`echo $sitelib | $sed 's,/share$,,'`
dd4e71fd 6414tdflt="$tdflt/$apiversion/$archname"
dc45a647
MB
6415set sitearch sitearch none
6416eval $prefixit
6417case "$sitearch" in
bfb7748a 6418'') dflt="$tdflt" ;;
dc45a647
MB
6419*) dflt="$sitearch" ;;
6420esac
6421$cat <<EOM
6422
6423The installation process will also create a directory for
6424architecture-dependent site-specific extensions and modules.
6425
6426EOM
6427fn=nd~+
6428rp='Pathname for the site-specific architecture-dependent library files?'
6429. ./getfile
dc45a647
MB
6430sitearch="$ans"
6431sitearchexp="$ansexp"
dd4e71fd
JH
6432: Change installation prefix, if necessary.
6433if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6434 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6435else
6436 installsitearch="$sitearchexp"
dc45a647
MB
6437fi
6438
2afac517 6439cat <<EOM
6440
b0ce926a
JH
6441Perl can be built to take advantage of long doubles which
6442(if available) may give more accuracy and range for floating point
6443numbers. To do so, Configure must be run with -Duselongdouble.
6444
6445If this doesn't make any sense to you, just accept the default 'n'.
6446EOM
6447case "$uselongdouble" in
6448$define|true|[yY]*) dflt='y';;
6449*) dflt='n';;
6450esac
6451rp='Try to use long doubles if available?'
6452. ./myread
6453case "$ans" in
309d43cf
JH
6454y|Y) val="$define" ;;
6455*) val="$undef" ;;
b0ce926a
JH
6456esac
6457set uselongdouble
6458eval $setvar
6459
d9b3e12d
JH
6460case "$uselongdouble" in
6461"$define"|true|[yY]*)
6462: Look for a hint-file generated 'call-back-unit'. If the
6463: user has specified that long doubles should be used,
6464: we may need to set or change some other defaults.
6465 if $test -f uselongdouble.cbu; then
6466 echo "Your platform has some specific hints for long doubles, using them..."
6467 . ./uselongdouble.cbu
6468 else
6469 $cat <<EOM
6470(Your platform doesn't have any specific hints for long doubles.)
6471EOM
6472 fi
6473 ;;
6474esac
b0ce926a
JH
6475
6476cat <<EOM
6477
85aff577
CS
6478Previous version of $package used the standard IO mechanisms as defined
6479in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 6480mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
6481the default. This abstraction layer can use AT&T's sfio (if you already
6482have sfio installed) or regular stdio. Using PerlIO with sfio may cause
6483problems with some extension modules. Using PerlIO with stdio is safe,
6484but it is slower than plain stdio and therefore is not the default.
2afac517 6485
6486If this doesn't make any sense to you, just accept the default 'n'.
6487EOM
6488case "$useperlio" in
6489$define|true|[yY]*) dflt='y';;
6490*) dflt='n';;
6491esac
6492rp='Use the experimental PerlIO abstraction layer?'
6493. ./myread
6494case "$ans" in
6495y|Y)
6496 val="$define"
6497 ;;
6498*)
6499 echo "Ok, doing things the stdio way"
6500 val="$undef"
6501 ;;
6502esac
6503set useperlio
6504eval $setvar
2304df62 6505
8e07c86e 6506: Check how to convert floats to strings.
28e8609d 6507if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
6508 echo " "
6509 echo "Checking for an efficient way to convert floats to strings."
6510 $cat >try.c <<'EOP'
8e07c86e
AD
6511#ifdef TRY_gconvert
6512#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 6513char *myname = "gconvert";
8e07c86e
AD
6514#endif
6515#ifdef TRY_gcvt
6516#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 6517char *myname = "gcvt";
8e07c86e
AD
6518#endif
6519#ifdef TRY_sprintf
6520#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 6521char *myname = "sprintf";
8e07c86e 6522#endif
8ff267be 6523
6524#include <stdio.h>
6525
6526int
6527checkit(expect, got)
6528char *expect;
6529char *got;
6530{
6531 if (strcmp(expect, got)) {
6532 printf("%s oddity: Expected %s, got %s\n",
6533 myname, expect, got);
6534 exit(1);
6535 }
6536}
6537
5a411a32 6538int main()
8ff267be 6539{
ecfc5424 6540 char buf[64];
8ff267be 6541 buf[63] = '\0';
6542
6543 /* This must be 1st test on (which?) platform */
6544 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6545 Gconvert(0.1, 8, 0, buf);
6546 checkit("0.1", buf);
6547
8e07c86e 6548 Gconvert(1.0, 8, 0, buf);
8ff267be 6549 checkit("1", buf);
6550
8e07c86e 6551 Gconvert(0.0, 8, 0, buf);
8ff267be 6552 checkit("0", buf);
6553
8e07c86e 6554 Gconvert(-1.0, 8, 0, buf);
8ff267be 6555 checkit("-1", buf);
6556
6557 /* Some Linux gcvt's give 1.e+5 here. */
6558 Gconvert(100000.0, 8, 0, buf);
6559 checkit("100000", buf);
6560
6561 /* Some Linux gcvt's give -1.e+5 here. */
6562 Gconvert(-100000.0, 8, 0, buf);
6563 checkit("-100000", buf);
6564
ecfc5424 6565 exit(0);
a0d0e21e
LW
6566}
6567EOP
5ff3f7a4
GS
6568 case "$d_Gconvert" in
6569 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6570 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6571 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6572 *) xxx_list='gconvert gcvt sprintf' ;;
6573 esac
8e07c86e 6574
5ff3f7a4
GS
6575 for xxx_convert in $xxx_list; do
6576 echo "Trying $xxx_convert"
6577 $rm -f try try$_o
6578 set try -DTRY_$xxx_convert
6579 if eval $compile; then
6580 echo "$xxx_convert" found. >&4
6581 if ./try; then
6582 echo "I'll use $xxx_convert to convert floats into a string." >&4
6583 break;
6584 else
6585 echo "...But $xxx_convert didn't work as I expected."
6586 fi
2304df62 6587 else
5ff3f7a4 6588 echo "$xxx_convert NOT found." >&4
2304df62 6589 fi
5ff3f7a4 6590 done
8e07c86e 6591
5ff3f7a4
GS
6592 case "$xxx_convert" in
6593 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6594 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6595 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6596 esac
28e8609d 6597fi
2304df62 6598
cf2093f6
JH
6599: see if inttypes.h is available
6600: we want a real compile instead of Inhdr because some systems
6601: have an inttypes.h which includes non-existent headers
6602echo " "
6603$cat >try.c <<EOCP
6604#include <inttypes.h>
6605int main() {
6606 static int32_t foo32 = 0x12345678;
6607}
6608EOCP
6609set try
6610if eval $compile; then
6611 echo "<inttypes.h> found." >&4
6612 val="$define"
6613else
6614 echo "<inttypes.h> NOT found." >&4
6615 val="$undef"
6616fi
6617$rm -f try.c try
6618set i_inttypes
6619eval $setvar
6620
6621: check for int64_t
6622case "$use64bits" in
6623"$define" )
6624 echo " "
6625 echo $n "Checking to see if your system supports int64_t...$c" >&4
6626 $cat >try.c <<EOCP
6627#include <sys/types.h>
6628#$i_inttypes I_INTTYPES
6629#ifdef I_INTTYPES
6630#include <inttypes.h>
6631#endif
6632int64_t foo() { int64_t x; x = 7; return x; }
6633EOCP
6634 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6635 val="$define"
6636 echo " Yup, it does." >&4
6637 else
6638 val="$undef"
6639 echo " Nope, it doesn't." >&4
6640 fi
6641 $rm -f try.*
6642 ;;
6643*) val="$undef"
6644 ;;
6645esac
6646set d_int64t
6647eval $setvar
6648
6649
6650: check for lengths of integral types
6651echo " "
6652case "$intsize" in
6653'')
6654 echo "Checking to see how big your integers are..." >&4
6655 $cat >intsize.c <<'EOCP'
6656#include <stdio.h>
6657int main()
6658{
6659 printf("intsize=%d;\n", sizeof(int));
6660 printf("longsize=%d;\n", sizeof(long));
6661 printf("shortsize=%d;\n", sizeof(short));
6662 exit(0);
6663}
6664EOCP
6665 set intsize
6666 if eval $compile_ok && ./intsize > /dev/null; then
6667 eval `./intsize`
6668 echo "Your integers are $intsize bytes long."
6669 echo "Your long integers are $longsize bytes long."
6670 echo "Your short integers are $shortsize bytes long."
6671 else
6672 $cat >&4 <<EOM
6673!
6674Help! I can't compile and run the intsize test program: please enlighten me!
6675(This is probably a misconfiguration in your system or libraries, and
6676you really ought to fix it. Still, I'll try anyway.)
6677!
6678EOM
6679 dflt=4
6680 rp="What is the size of an integer (in bytes)?"
6681 . ./myread
6682 intsize="$ans"
6683 dflt=$intsize
6684 rp="What is the size of a long integer (in bytes)?"
6685 . ./myread
6686 longsize="$ans"
6687 dflt=2
6688 rp="What is the size of a short integer (in bytes)?"
6689 . ./myread
6690 shortsize="$ans"
6691 fi
6692 ;;
6693esac
6694$rm -f intsize intsize.*
6695
6696: check for long long
6697echo " "
6698echo $n "Checking to see if your system supports long long...$c" >&4
6699echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6700if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6701 val="$define"
6702 echo " Yup, it does." >&4
6703else
6704 val="$undef"
6705 echo " Nope, it doesn't." >&4
6706fi
6707$rm try.*
6708set d_longlong
6709eval $setvar
6710
6711: check for length of long long
6712case "${d_longlong}${longlongsize}" in
6713$define)
6714 echo " "
6715 $echo $n "Checking to see how big your long longs are...$c" >&4
6716 $cat >try.c <<'EOCP'
6717#include <stdio.h>
6718int main()
6719{
6720 printf("%d\n", sizeof(long long));
6721}
6722EOCP
6723 set try
6724 if eval $compile_ok; then
6725 longlongsize=`./try`
6726 $echo " $longlongsize bytes." >&4
6727 else
6728 dflt='8'
6729 echo " "
6730 echo "(I can't seem to compile the test program. Guessing...)"
6731 rp="What is the size of a long long (in bytes)?"
6732 . ./myread
6733 longlongsize="$ans"
6734 fi
6735 if $test "X$longsize" = "X$longlongsize"; then
6736 echo "(That isn't any different from an ordinary long.)"
6737 fi
6738 ;;
6739esac
6740$rm -f try.c try
6741
6742echo " "
6743
ea1c3b15 6744if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
cf2093f6
JH
6745
6746echo "Checking how to print 64-bit integers..." >&4
6747
6748if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6749 quad=int
6750 $cat >try.c <<'EOCP'
6751#include <sys/types.h>
6752#include <stdio.h>
6753int main() {
6754 int q = 12345678901;
6755 printf("%ld\n", q);
6756}
6757EOCP
6758 set try
6759 if eval $compile; then
6760 yyy=`./try$exe_ext`
6761 case "$yyy" in
6762 12345678901)
6763 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6764 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6765 echo "We will use %d."
6766 ;;
6767 esac
6768 fi
6769fi
6770
6771if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6772 quad=long
6773 $cat >try.c <<'EOCP'
6774#include <sys/types.h>
6775#include <stdio.h>
6776int main() {
6777 long q = 12345678901;
6778 printf("%ld\n", q);
6779}
6780EOCP
6781 set try
6782 if eval $compile; then
6783 yyy=`./try$exe_ext`
6784 case "$yyy" in
6785 12345678901)
6786 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6787 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6788 echo "We will use %ld."
6789 ;;
6790 esac
6791 fi
6792fi
6793
6794if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6795 quad=int64_t
6796 $cat >try.c <<'EOCP'
6797#include <sys/types.h>
6798#include <inttypes.h>
6799#include <stdio.h>
6800int main() {
6801 int64_t q = 12345678901;
6802 printf("%" PRId64 "\n", q);
6803}
6804EOCP
6805 set try
6806 if eval $compile; then
6807 yyy=`./try$exe_ext`
6808 case "$yyy" in
6809 12345678901)
6810 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6811 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6812 echo "We will use the C9X style."
6813 ;;
6814 esac
6815 fi
6816fi
6817
6818if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6819 quad="long long"
6820 $cat >try.c <<'EOCP'
6821#include <sys/types.h>
6822#include <stdio.h>
6823int main() {
6e58d65c 6824 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
cf2093f6
JH
6825 printf("%lld\n", q);
6826}
6827EOCP
6828 set try
6829 if eval $compile; then
6830 yyy=`./try$exe_ext`
6831 case "$yyy" in
6832 12345678901)
6833 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6834 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6835 echo "We will use the %lld style."
6836 ;;
6837 esac
6838 fi
6839fi
6840
6841if $test X"$sPRId64" = X -a X"$quad" != X; then
6842 $cat >try.c <<EOCP
6843#include <sys/types.h>
6844#include <stdio.h>
6845int main() {
6846 $quad q = 12345678901;
6847 printf("%Ld\n", q);
6848}
6849EOCP
6850 set try
6851 if eval $compile; then
6852 yyy=`./try$exe_ext`
6853 case "$yyy" in
6854 12345678901)
6855 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6856 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6857 echo "We will use %lld."
6858 ;;
6859 esac
6860 fi
6861fi
6862
6863if $test X"$sPRId64" = X -a X"$quad" != X; then
6864 $cat >try.c <<EOCP
6865#include <sys/types.h>
6866#include <stdio.h>
6867int main() {
6868 $quad q = 12345678901;
6869 printf("%qd\n", q);
6870}
6871EOCP
6872 set try
6873 if eval $compile; then
6874 yyy=`./try$exe_ext`
6875 case "$yyy" in
6876 12345678901)
6877 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6878 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6879 echo "We will use %qd."
6880 ;;
6881 esac
6882 fi
6883fi
6884
6885if $test X"$sPRId64" = X; then
6886 echo "Cannot figure out how to print 64-bit integers." >&4
6887fi
6888
ea1c3b15
JH
6889$rm -f try try.*
6890
6891fi # intsize -o longsize -o d_int64t -o d_longlong
cf2093f6
JH
6892
6893case "$sPRId64" in
6894'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
6895 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
6896 ;;
6897*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
6898 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
6899 ;;
6900esac
6901
cf2093f6
JH
6902: check for length of double
6903echo " "
6904case "$doublesize" in
6905'')
6906 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6907 $cat >try.c <<'EOCP'
6908#include <stdio.h>
6909int main()
6910{
6911 printf("%d\n", sizeof(double));
6912}
6913EOCP
6914 set try
6915 if eval $compile_ok; then
6916 doublesize=`./try`
6917 $echo " $doublesize bytes." >&4
6918 else
6919 dflt='8'
6920 echo "(I can't seem to compile the test program. Guessing...)"
6921 rp="What is the size of a double precision number (in bytes)?"
6922 . ./myread
6923 doublesize="$ans"
6924 fi
6925 ;;
6926esac
6927$rm -f try.c try
6928
6929: check for long doubles
6930echo " "
2d4389e4 6931echo $n "Checking to see if your system supports long double...$c" >&4
cf2093f6
JH
6932echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6933if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6934 val="$define"
6935 echo " Yup, it does." >&4
6936else
6937 val="$undef"
6938 echo " Nope, it doesn't." >&4
6939fi
6940$rm try.*
6941set d_longdbl
6942eval $setvar
6943
6944: check for length of long double
6945case "${d_longdbl}${longdblsize}" in
6946$define)
6947 echo " "
6948 $echo $n "Checking to see how big your long doubles are...$c" >&4
6949 $cat >try.c <<'EOCP'
6950#include <stdio.h>
6951int main()
6952{
6953 printf("%d\n", sizeof(long double));
6954}
6955EOCP
6956 set try
6957 if eval $compile; then
6958 longdblsize=`./try`
6959 $echo " $longdblsize bytes." >&4
6960 else
6961 dflt='8'
6962 echo " "
6963 echo "(I can't seem to compile the test program. Guessing...)" >&4
6964 rp="What is the size of a long double (in bytes)?"
6965 . ./myread
6966 longdblsize="$ans"
6967 fi
6968 if $test "X$doublesize" = "X$longdblsize"; then
6969 echo "(That isn't any different from an ordinary double.)"
6970 fi
6971 ;;
6972esac
6973$rm -f try.c try
6974
6975echo " "
6976
ea1c3b15 6977if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
6978
6979echo "Checking how to print long doubles..." >&4
6980
6981if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6982 $cat >try.c <<'EOCP'
6983#include <sys/types.h>
6984#include <stdio.h>
6985int main() {
6986 double d = 123.456;
6987 printf("%.3f\n", d);
6988}
6989EOCP
6990 set try
6991 if eval $compile; then
6992 yyy=`./try$exe_ext`
6993 case "$yyy" in
6994 123.456)
6995 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6996 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6997 echo "We will use %f."
6998 ;;
6999 esac
7000 fi
7001fi
7002
7003if $test X"$sPRIfldbl" = X; then
7004 $cat >try.c <<'EOCP'
7005#include <sys/types.h>
7006#include <stdio.h>
7007int main() {
7008 long double d = 123.456;
ea1c3b15 7009 printf("%.3llf\n", d);
cf2093f6
JH
7010}
7011EOCP
7012 set try
7013 if eval $compile; then
7014 yyy=`./try$exe_ext`
7015 case "$yyy" in
7016 123.456)
ea1c3b15
JH
7017 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7018 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7019 echo "We will use %llf."
cf2093f6
JH
7020 ;;
7021 esac
7022 fi
7023fi
7024
7025if $test X"$sPRIfldbl" = X; then
7026 $cat >try.c <<'EOCP'
7027#include <sys/types.h>
7028#include <stdio.h>
7029int main() {
7030 long double d = 123.456;
ea1c3b15 7031 printf("%.3Lf\n", d);
cf2093f6
JH
7032}
7033EOCP
7034 set try
7035 if eval $compile; then
7036 yyy=`./try$exe_ext`
7037 case "$yyy" in
7038 123.456)
ea1c3b15
JH
7039 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7040 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7041 echo "We will use %Lf."
cf2093f6
JH
7042 ;;
7043 esac
7044 fi
7045fi
7046
11dc3f68 7047if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7048 $cat >try.c <<'EOCP'
7049#include <sys/types.h>
7050#include <stdio.h>
7051int main() {
7052 long double d = 123.456;
ea1c3b15 7053 printf("%.3lf\n", d);
cf2093f6
JH
7054}
7055EOCP
7056 set try
7057 if eval $compile; then
7058 yyy=`./try$exe_ext`
7059 case "$yyy" in
7060 123.456)
ea1c3b15
JH
7061 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7062 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7063 echo "We will use %lf."
cf2093f6
JH
7064 ;;
7065 esac
7066 fi
7067fi
7068
09e3ef00
JH
7069if $test X"$sPRIfldbl" = X; then
7070 echo "Cannot figure out how to print long doubles." >&4
7071fi
7072
ea1c3b15 7073$rm -f try try.*
cf2093f6 7074
ea1c3b15 7075fi # d_longdbl
cf2093f6
JH
7076
7077case "$sPRIfldbl" in
7078'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7079 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7080 ;;
7081*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7082 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7083 ;;
7084esac
7085
a0d0e21e
LW
7086: Initialize h_fcntl
7087h_fcntl=false
7088
7089: Initialize h_sysfile
7090h_sysfile=false
2304df62 7091
2304df62
AD
7092: access call always available on UNIX
7093set access d_access
7094eval $inlibc
7095
7096: locate the flags for 'access()'
7097case "$d_access" in
7098"$define")
7099 echo " "
7100 $cat >access.c <<'EOCP'
7101#include <sys/types.h>
7102#ifdef I_FCNTL
7103#include <fcntl.h>
7104#endif
7105#ifdef I_SYS_FILE
7106#include <sys/file.h>
7107#endif
7108#ifdef I_UNISTD
7109#include <unistd.h>
7110#endif
d674cd6d 7111int main() {
2304df62
AD
7112 exit(R_OK);
7113}
8e07c86e
AD
7114EOCP
7115 : check sys/file.h first, no particular reason here
7116 if $test `./findhdr sys/file.h` && \
dfe9444c 7117 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7118 h_sysfile=true;
7119 echo "<sys/file.h> defines the *_OK access constants." >&4
7120 elif $test `./findhdr fcntl.h` && \
dfe9444c 7121 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7122 h_fcntl=true;
7123 echo "<fcntl.h> defines the *_OK access constants." >&4
7124 elif $test `./findhdr unistd.h` && \
dfe9444c 7125 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7126 echo "<unistd.h> defines the *_OK access constants." >&4
7127 else
7128 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7129 fi
7130 ;;
7131esac
7132$rm -f access*
a0d0e21e 7133
5ff3f7a4
GS
7134: see if accessx exists
7135set accessx d_accessx
7136eval $inlibc
7137
8e07c86e
AD
7138: see if alarm exists
7139set alarm d_alarm
7140eval $inlibc
2304df62 7141
cf2093f6
JH
7142: see if atolf exists
7143set atolf d_atolf
7144eval $inlibc
7145
7146: see if atoll exists
7147set atoll d_atoll
7148eval $inlibc
7149
ecfc5424 7150: Look for GNU-cc style attribute checking
2304df62 7151echo " "
a0d0e21e
LW
7152echo "Checking whether your compiler can handle __attribute__ ..." >&4
7153$cat >attrib.c <<'EOCP'
1aef975c 7154#include <stdio.h>
ecfc5424 7155void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7156EOCP
7157if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7158 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7159 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7160 val="$undef"
7161 else
ecfc5424 7162 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7163 val="$define"
7164 fi
7165else
ecfc5424 7166 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7167 val="$undef"
7168fi
ecfc5424 7169set d_attribut
a0d0e21e
LW
7170eval $setvar
7171$rm -f attrib*
7172
7173: see if bcmp exists
7174set bcmp d_bcmp
7175eval $inlibc
7176
7177: see if bcopy exists
7178set bcopy d_bcopy
7179eval $inlibc
7180
2afac517 7181: see if this is a unistd.h system
7182set unistd.h i_unistd
7183eval $inhdr
7184
7185: see if getpgrp exists
7186set getpgrp d_getpgrp
7187eval $inlibc
7188
2afac517 7189case "$d_getpgrp" in
7190"$define")
7191 echo " "
dfe9444c 7192 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7193 $cat >set.c <<EOP
7194#$i_unistd I_UNISTD
7195#include <sys/types.h>
7196#ifdef I_UNISTD
7197# include <unistd.h>
7198#endif
5a411a32 7199int main()
2afac517 7200{
7201 if (getuid() == 0) {
7202 printf("(I see you are running Configure as super-user...)\n");
7203 setuid(1);
7204 }
7205#ifdef TRY_BSD_PGRP
7206 if (getpgrp(1) == 0)
7207 exit(0);
7208#else
7209 if (getpgrp() > 0)
7210 exit(0);
7211#endif
7212 exit(1);
7213}
7214EOP
7215 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7216 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7217 val="$define"
7218 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7219 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7220 val="$undef"
7221 else
7222 echo "I can't seem to compile and run the test program."
7223 if ./usg; then
7224 xxx="a USG one, i.e. you use getpgrp()."
7225 else
7226 # SVR4 systems can appear rather BSD-ish.
7227 case "$i_unistd" in
7228 $undef)
7229 xxx="a BSD one, i.e. you use getpgrp(pid)."
7230 val="$define"
7231 ;;
7232 $define)
7233 xxx="probably a USG one, i.e. you use getpgrp()."
7234 val="$undef"
7235 ;;
7236 esac
7237 fi
7238 echo "Assuming your getpgrp is $xxx" >&4
7239 fi
7240 ;;
7241*) val="$undef";;
7242esac
7243set d_bsdgetpgrp
7244eval $setvar
7245$rm -f set set.c
7246
a0d0e21e
LW
7247: see if setpgrp exists
7248set setpgrp d_setpgrp
7249eval $inlibc
7250
a0d0e21e
LW
7251case "$d_setpgrp" in
7252"$define")
7253 echo " "
dfe9444c 7254 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7255 $cat >set.c <<EOP
2afac517 7256#$i_unistd I_UNISTD
7257#include <sys/types.h>
7258#ifdef I_UNISTD
7259# include <unistd.h>
7260#endif
5a411a32 7261int main()
a0d0e21e
LW
7262{
7263 if (getuid() == 0) {
7264 printf("(I see you are running Configure as super-user...)\n");
7265 setuid(1);
7266 }
2afac517 7267#ifdef TRY_BSD_PGRP
a0d0e21e 7268 if (-1 == setpgrp(1, 1))
2afac517 7269 exit(0);
7270#else
7271 if (setpgrp() != -1)
7272 exit(0);
7273#endif
7274 exit(1);
a0d0e21e
LW
7275}
7276EOP
2afac517 7277 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7278 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7279 val="$define"
7280 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7281 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7282 val="$undef"
a0d0e21e 7283 else
dfe9444c 7284 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7285 if ./usg; then
2afac517 7286 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7287 else
2afac517 7288 # SVR4 systems can appear rather BSD-ish.
7289 case "$i_unistd" in
7290 $undef)
7291 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7292 val="$define"
7293 ;;
7294 $define)
7295 xxx="probably a USG one, i.e. you use setpgrp()."
7296 val="$undef"
7297 ;;
7298 esac
a0d0e21e 7299 fi
2afac517 7300 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7301 fi
7302 ;;
7303*) val="$undef";;
7304esac
2afac517 7305set d_bsdsetpgrp
a0d0e21e
LW
7306eval $setvar
7307$rm -f set set.c
a0d0e21e
LW
7308: see if bzero exists
7309set bzero d_bzero
7310eval $inlibc
7311
ecfc5424 7312: see if signal is declared as pointer to function returning int or void
a0d0e21e 7313echo " "
ecfc5424
AD
7314xxx=`./findhdr signal.h`
7315$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7316if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7317 echo "You have int (*signal())() instead of void." >&4
7318 val="$undef"
7319elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7320 echo "You have void (*signal())()." >&4
ecfc5424
AD
7321 val="$define"
7322elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7323 echo "You have int (*signal())() instead of void." >&4
7324 val="$undef"
dfe9444c
AD
7325elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7326 echo "You have void (*signal())()." >&4
7327 val="$define"
a0d0e21e 7328else
ecfc5424
AD
7329 case "$d_voidsig" in
7330 '')
7331 echo "I can't determine whether signal handler returns void or int..." >&4
7332 dflt=void
7333 rp="What type does your signal handler return?"
7334 . ./myread
7335 case "$ans" in
7336 v*) val="$define";;
7337 *) val="$undef";;
7338 esac;;
7339 "$define")
dfe9444c
AD
7340 echo "As you already told me, signal handler returns void." >&4
7341 val="$define"
7342 ;;
7343 *) echo "As you already told me, signal handler returns int." >&4
7344 val="$undef"
7345 ;;
ecfc5424
AD
7346 esac
7347fi
7348set d_voidsig
7349eval $setvar
7350case "$d_voidsig" in
7351"$define") signal_t="void";;
7352*) signal_t="int";;
7353esac
7354$rm -f $$.tmp
7355
7356: check for ability to cast large floats to 32-bit ints.
7357echo " "
7358echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7359if $test "$intsize" -ge 4; then
ecfc5424
AD
7360 xxx=int
7361else
7362 xxx=long
7363fi
7364$cat >try.c <<EOCP
e5c9fcd0 7365#include <stdio.h>
ecfc5424
AD
7366#include <sys/types.h>
7367#include <signal.h>
a1896f58 7368$signal_t blech(s) int s; { exit(3); }
d674cd6d 7369int main()
2304df62 7370{
a0d0e21e 7371 $xxx i32;
e5c9fcd0 7372 double f, g;
2304df62 7373 int result = 0;
89434db5 7374 char str[16];
2304df62
AD
7375 signal(SIGFPE, blech);
7376
89434db5
AD
7377 /* Don't let compiler optimize the test away. Store the number
7378 in a writable string for gcc to pass to sscanf under HP/UX.
7379 */
7380 sprintf(str, "2147483647");
7381 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7382 g = 10 * f;
7383 i32 = ($xxx) g;
2304df62 7384
e5c9fcd0
AD
7385 /* x86 processors will probably give 0x8000 0000, which is a
7386 sign change. We don't want that. We want to mimic SPARC
7387 behavior here, which is to preserve the sign and give
7388 back 0x7fff ffff.
7389 */
a0d0e21e 7390 if (i32 != ($xxx) f)
2304df62
AD
7391 result |= 1;
7392 exit(result);
7393}
7394EOCP
dfe9444c 7395set try
dc45a647 7396if eval $compile_ok; then
2304df62
AD
7397 ./try
7398 yyy=$?
7399else
a0d0e21e 7400 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
7401 yyy=1
7402fi
7403case "$yyy" in
74040) val="$define"
7405 echo "Yup, it can."
7406 ;;
7407*) val="$undef"
7408 echo "Nope, it can't."
7409 ;;
7410esac
7411set d_casti32
7412eval $setvar
85e6fe83 7413$rm -f try try.*
a0d0e21e 7414
2304df62
AD
7415: check for ability to cast negative floats to unsigned
7416echo " "
7417echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 7418$cat >try.c <<EOCP
e5c9fcd0 7419#include <stdio.h>
ecfc5424 7420#include <sys/types.h>
2304df62 7421#include <signal.h>
a1896f58
AD
7422$signal_t blech(s) int s; { exit(7); }
7423$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
7424unsigned long dummy_long(p) unsigned long p; { return p; }
7425unsigned int dummy_int(p) unsigned int p; { return p; }
7426unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 7427int main()
2304df62 7428{
e5c9fcd0 7429 double f;
2304df62
AD
7430 unsigned long along;
7431 unsigned int aint;
7432 unsigned short ashort;
7433 int result = 0;
89434db5
AD
7434 char str[16];
7435
e5c9fcd0
AD
7436 /* Frustrate gcc-2.7.2's optimizer which failed this test with
7437 a direct f = -123. assignment. gcc-2.8.0 reportedly
7438 optimized the whole file away
7439 */
89434db5
AD
7440 /* Store the number in a writable string for gcc to pass to
7441 sscanf under HP/UX.
7442 */
7443 sprintf(str, "-123");
7444 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
7445
7446 signal(SIGFPE, blech);
7447 along = (unsigned long)f;
7448 aint = (unsigned int)f;
7449 ashort = (unsigned short)f;
7450 if (along != (unsigned long)-123)
7451 result |= 1;
7452 if (aint != (unsigned int)-123)
7453 result |= 1;
7454 if (ashort != (unsigned short)-123)
7455 result |= 1;
89434db5
AD
7456 sprintf(str, "1073741824.");
7457 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
7458 f = f + f;
7459 along = 0;
7460 along = (unsigned long)f;
7461 if (along != 0x80000000)
7462 result |= 2;
7463 f -= 1.;
7464 along = 0;
7465 along = (unsigned long)f;
7466 if (along != 0x7fffffff)
7467 result |= 1;
7468 f += 2.;
7469 along = 0;
7470 along = (unsigned long)f;
7471 if (along != 0x80000001)
7472 result |= 2;
232e078e
AD
7473 if (result)
7474 exit(result);
7475 signal(SIGFPE, blech_in_list);
89434db5
AD
7476 sprintf(str, "123.");
7477 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
7478 along = dummy_long((unsigned long)f);
7479 aint = dummy_int((unsigned int)f);
7480 ashort = dummy_short((unsigned short)f);
7481 if (along != (unsigned long)123)
7482 result |= 4;
7483 if (aint != (unsigned int)123)
7484 result |= 4;
7485 if (ashort != (unsigned short)123)
7486 result |= 4;
2304df62
AD
7487 exit(result);
7488
7489}
7490EOCP
dfe9444c 7491set try
dc45a647 7492if eval $compile_ok; then
2304df62
AD
7493 ./try
7494 castflags=$?
7495else
ecfc5424 7496 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 7497 castflags=7
2304df62
AD
7498fi
7499case "$castflags" in
75000) val="$define"
7501 echo "Yup, it can."
7502 ;;
7503*) val="$undef"
7504 echo "Nope, it can't."
7505 ;;
7506esac
7507set d_castneg
7508eval $setvar
7509$rm -f try.*
7510
2304df62
AD
7511: see if vprintf exists
7512echo " "
7513if set vprintf val -f d_vprintf; eval $csym; $val; then
7514 echo 'vprintf() found.' >&4
7515 val="$define"
7516 $cat >vprintf.c <<'EOF'
7517#include <varargs.h>
7518
d674cd6d 7519int main() { xxx("foo"); }
2304df62
AD
7520
7521xxx(va_alist)
7522va_dcl
7523{
7524 va_list args;
7525 char buf[10];
7526
7527 va_start(args);
7528 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7529}
7530EOF
dfe9444c
AD
7531 set vprintf
7532 if eval $compile && ./vprintf; then
2304df62
AD
7533 echo "Your vsprintf() returns (int)." >&4
7534 val2="$undef"
7535 else
7536 echo "Your vsprintf() returns (char*)." >&4
7537 val2="$define"
7538 fi
7539else
7540 echo 'vprintf() NOT found.' >&4
7541 val="$undef"
7542 val2="$undef"
7543fi
7544set d_vprintf
7545eval $setvar
7546val=$val2
7547set d_charvspr
7548eval $setvar
7549
a0d0e21e
LW
7550: see if chown exists
7551set chown d_chown
7552eval $inlibc
7553
7554: see if chroot exists
7555set chroot d_chroot
7556eval $inlibc
7557
2304df62
AD
7558: see if chsize exists
7559set chsize d_chsize
7560eval $inlibc
7561
de4597cb
JH
7562hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7563while $test $# -ge 2; do
7564 case "$1" in
7565 $define) echo "#include <$2>";;
7566 esac ;
7567 shift 2;
7568done > try.c;
7569echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
2000072c 7570if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
de4597cb
JH
7571 val="$define";
7572else
7573 val="$undef";
7574fi;
7575set $varname;
7576eval $setvar;
7577$rm -f try.c try.o'
7578
7579: see if this is a sys/uio.h system
7580set sys/uio.h i_sysuio
7581eval $inhdr
7582
7583echo "Checking to see if your system supports struct iovec..." >&4
7584set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7585eval $hasfield
7586case "$d_iovec_s" in
7587"$define") echo "Yup, it does." >&4
7588 ;;
7589*) echo "Nope, it doesn't." >&4
7590 ;;
7591esac
7592
7593socketlib=''
7594sockethdr=''
7595: see whether socket exists
7596echo " "
7597$echo $n "Hmm... $c" >&4
7598if set socket val -f d_socket; eval $csym; $val; then
7599 echo "Looks like you have Berkeley networking support." >&4
7600 d_socket="$define"
7601 if set setsockopt val -f; eval $csym; $val; then
7602 d_oldsock="$undef"
7603 else
7604 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7605 d_oldsock="$define"
7606 fi
7607else
7608 if $contains socklib libc.list >/dev/null 2>&1; then
7609 echo "Looks like you have Berkeley networking support." >&4
7610 d_socket="$define"
7611 : we will have to assume that it supports the 4.2 BSD interface
7612 d_oldsock="$undef"
7613 else
7614 echo "You don't have Berkeley networking in libc$_a..." >&4
7615 if test "X$d_socket" = "X$define"; then
7616 echo "...but you seem to believe that you have sockets." >&4
7617 else
7618 for net in net socket
7619 do
7620 if test -f /usr/lib/lib$net$_a; then
7621 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
7622 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7623 if $contains socket libc.list >/dev/null 2>&1; then
7624 d_socket="$define"
7625 socketlib="-l$net"
7626 case "$net" in
7627 net)
7628 echo "...but the Wollongong group seems to have hacked it in." >&4
7629 sockethdr="-I/usr/netinclude"
7630 ;;
7631 esac
7632 echo "Found Berkeley sockets interface in lib$net." >& 4
7633 if $contains setsockopt libc.list >/dev/null 2>&1; then
7634 d_oldsock="$undef"
7635 else
7636 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7637 d_oldsock="$define"
7638 fi
7639 break
7640 fi
7641 fi
7642 done
7643 if test "X$d_socket" != "X$define"; then
7644 echo "or anywhere else I see." >&4
7645 d_socket="$undef"
7646 d_oldsock="$undef"
7647 fi
7648 fi
7649 fi
7650fi
7651
7652: see if socketpair exists
7653set socketpair d_sockpair
7654eval $inlibc
7655
7656
5b34fd99 7657echo " "
de4597cb
JH
7658echo "Checking the availability of certain socket constants..." >& 4
7659for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7660 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7661 $cat >try.c <<EOF
ac60b016 7662#include <sys/types.h>
de4597cb
JH
7663#include <sys/socket.h>
7664int main() {
7665 int i = $ENUM;
7666}
7667EOF
7668 val="$undef"
7669 set try; if eval $compile; then
7670 val="$define"
7671 fi
7672 set d_${enum}; eval $setvar
7673 $rm -f try.c try
7674done
7675
7676set sendmsg d_sendmsg
7677eval $inlibc
7678
7679set recvmsg d_recvmsg
7680eval $inlibc
7681
7682echo " "
7683$echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7684set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7685eval $hasfield
7686case "$d_msghdr_s" in
7687"$define") echo "Yup, it does." >&4
7688 ;;
7689*) echo "Nope, it doesn't." >&4
7690 ;;
7691esac
7692
7693$echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7694set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7695eval $hasfield
7696case "$d_cmsghdr_s" in
7697"$define") echo "Yup, it does." >&4
7698 ;;
7699*) echo "Nope, it doesn't." >&4
7700 ;;
7701esac
7702
2304df62
AD
7703: check for const keyword
7704echo " "
7705echo 'Checking to see if your C compiler knows about "const"...' >&4
7706$cat >const.c <<'EOCP'
7707typedef struct spug { int drokk; } spug;
5a411a32 7708int main()
2304df62
AD
7709{
7710 const char *foo;
7711 const spug y;
7712}
7713EOCP
7714if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7715 val="$define"
7716 echo "Yup, it does."
7717else
7718 val="$undef"
7719 echo "Nope, it doesn't."
7720fi
7721set d_const
7722eval $setvar
7723
7724: see if crypt exists
7725echo " "
7726if set crypt val -f d_crypt; eval $csym; $val; then
7727 echo 'crypt() found.' >&4
7728 val="$define"
7729 cryptlib=''
7730else
dfe9444c 7731 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 7732 if $test -z "$cryptlib"; then
dfe9444c 7733 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
7734 else
7735 cryptlib=-lcrypt
7736 fi
7737 if $test -z "$cryptlib"; then
dfe9444c 7738 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
7739 else
7740 cryptlib=-lcrypt
7741 fi
7742 if $test -z "$cryptlib"; then
dfe9444c 7743 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
7744 else
7745 cryptlib=-lcrypt
7746 fi
7747 if $test -z "$cryptlib"; then
7748 echo 'crypt() NOT found.' >&4
7749 val="$undef"
7750 else
7751 val="$define"
7752 fi
7753fi
7754set d_crypt
7755eval $setvar
7756
921b2963
JH
7757: get csh whereabouts
7758case "$csh" in
7759'csh') val="$undef" ;;
7760*) val="$define" ;;
7761esac
7762set d_csh
7763eval $setvar
7764: Respect a hint or command line value for full_csh.
7765case "$full_csh" in
7766'') full_csh=$csh ;;
7767esac
7768
a0d0e21e
LW
7769: see if cuserid exists
7770set cuserid d_cuserid
2304df62
AD
7771eval $inlibc
7772
a0d0e21e
LW
7773: see if this is a limits.h system
7774set limits.h i_limits
85e6fe83
LW
7775eval $inhdr
7776
a0d0e21e
LW
7777: see if this is a float.h system
7778set float.h i_float
7779eval $inhdr
7780
7781: See if number of significant digits in a double precision number is known
7782echo " "
7783$cat >dbl_dig.c <<EOM
7784#$i_limits I_LIMITS
7785#$i_float I_FLOAT
7786#ifdef I_LIMITS
7787#include <limits.h>
85e6fe83 7788#endif
a0d0e21e
LW
7789#ifdef I_FLOAT
7790#include <float.h>
7791#endif
7792#ifdef DBL_DIG
7793printf("Contains DBL_DIG");
85e6fe83 7794#endif
85e6fe83 7795EOM
a0d0e21e
LW
7796$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7797if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7798 echo "DBL_DIG found." >&4
7799 val="$define"
2304df62 7800else
a0d0e21e
LW
7801 echo "DBL_DIG NOT found." >&4
7802 val="$undef"
2304df62 7803fi
a0d0e21e
LW
7804$rm -f dbl_dig.?
7805set d_dbl_dig
2304df62 7806eval $setvar
2304df62 7807
a0d0e21e
LW
7808: see if difftime exists
7809set difftime d_difftime
2304df62
AD
7810eval $inlibc
7811
a0d0e21e
LW
7812: see if this is a dirent system
7813echo " "
7814if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7815 val="$define"
7816 echo "<dirent.h> found." >&4
7817else
7818 val="$undef"
7819 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7820 echo "<sys/dir.h> found." >&4
7821 echo " "
7822 else
7823 xinc=`./findhdr sys/ndir.h`
7824 fi
7825 echo "<dirent.h> NOT found." >&4
7826fi
7827set i_dirent
7828eval $setvar
7829
7830: Look for type of directory structure.
7831echo " "
7832$cppstdin $cppflags $cppminus < "$xinc" > try.c
7833
7834case "$direntrytype" in
7835''|' ')
7836 case "$i_dirent" in
7837 $define) guess1='struct dirent' ;;
7838 *) guess1='struct direct' ;;
2afac517 7839 esac
7840 ;;
7841*) guess1="$direntrytype"
7842 ;;
8e07c86e
AD
7843esac
7844
2afac517 7845case "$guess1" in
7846'struct dirent') guess2='struct direct' ;;
7847*) guess2='struct dirent' ;;
7848esac
7849
7850if $contains "$guess1" try.c >/dev/null 2>&1; then
7851 direntrytype="$guess1"
7852 echo "Your directory entries are $direntrytype." >&4
7853elif $contains "$guess2" try.c >/dev/null 2>&1; then
7854 direntrytype="$guess2"
7855 echo "Your directory entries seem to be $direntrytype." >&4
7856else
7857 echo "I don't recognize your system's directory entries." >&4
7858 rp="What type is used for directory entries on this system?"
7859 dflt="$guess1"
7860 . ./myread
7861 direntrytype="$ans"
7862fi
7863$rm -f try.c
a0d0e21e 7864
a0d0e21e 7865
2afac517 7866: see if the directory entry stores field length
7867echo " "
7868$cppstdin $cppflags $cppminus < "$xinc" > try.c
7869if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7870 echo "Good, your directory entry keeps length information in d_namlen." >&4
7871 val="$define"
7872else
7873 echo "Your directory entry does not know about the d_namlen field." >&4
7874 val="$undef"
7875fi
7876set d_dirnamlen
7877eval $setvar
7878$rm -f try.c
a0d0e21e 7879
5ff3f7a4
GS
7880: see if dlerror exists
7881xxx_runnm="$runnm"
7882runnm=false
7883set dlerror d_dlerror
7884eval $inlibc
7885runnm="$xxx_runnm"
7886
7887: see if dlfcn is available
7888set dlfcn.h i_dlfcn
7889eval $inhdr
7890
7891case "$usedl" in
7892$define|y|true)
7893 $cat << EOM
7894
7895On a few systems, the dynamically loaded modules that perl generates and uses
7896will need a different extension than shared libs. The default will probably
7897be appropriate.
7898
7899EOM
7900 case "$dlext" in
7901 '') dflt="$so" ;;
7902 *) dflt="$dlext" ;;
7903 esac
7904 rp='What is the extension of dynamically loaded modules'
7905 . ./myread
7906 dlext="$ans"
7907 ;;
7908*)
7909 dlext="none"
7910 ;;
7911esac
7912
7913: Check if dlsym need a leading underscore
a0d0e21e
LW
7914echo " "
7915val="$undef"
7916
7917case "$dlsrc" in
7918dl_dlopen.xs)
7919 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7920 $cat >dyna.c <<'EOM'
7921fred () { }
7922EOM
7923
7924$cat >fred.c<<EOM
7925
7926#include <stdio.h>
7927#$i_dlfcn I_DLFCN
7928#ifdef I_DLFCN
7929#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
7930#else
7931#include <sys/types.h>
7932#include <nlist.h>
7933#include <link.h>
7934#endif
7935
7936extern int fred() ;
7937
5a411a32 7938int main()
a0d0e21e
LW
7939{
7940 void * handle ;
7941 void * symbol ;
7942#ifndef RTLD_LAZY
7943 int mode = 1 ;
7944#else
7945 int mode = RTLD_LAZY ;
7946#endif
7947 handle = dlopen("./dyna.$dlext", mode) ;
7948 if (handle == NULL) {
5f05dabc 7949 printf ("1\n") ;
7950 fflush (stdout) ;
7951 exit(0);
a0d0e21e
LW
7952 }
7953 symbol = dlsym(handle, "fred") ;
7954 if (symbol == NULL) {
5f05dabc 7955 /* try putting a leading underscore */
7956 symbol = dlsym(handle, "_fred") ;
7957 if (symbol == NULL) {
7958 printf ("2\n") ;
7959 fflush (stdout) ;
7960 exit(0);
7961 }
7962 printf ("3\n") ;
a0d0e21e
LW
7963 }
7964 else
5f05dabc 7965 printf ("4\n") ;
36477c24 7966 fflush (stdout) ;
7967 exit(0);
a0d0e21e
LW
7968}
7969EOM
760ac839 7970 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 7971 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
7972 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7973 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 7974 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
7975 xxx=`./fred`
7976 case $xxx in
7977 1) echo "Test program failed using dlopen." >&4
7978 echo "Perhaps you should not use dynamic loading." >&4;;
7979 2) echo "Test program failed using dlsym." >&4
7980 echo "Perhaps you should not use dynamic loading." >&4;;
7981 3) echo "dlsym needs a leading underscore" >&4
7982 val="$define" ;;
7983 4) echo "dlsym doesn't need a leading underscore." >&4;;
7984 esac
7985 else
7986 echo "I can't compile and run the test program." >&4
88d5303d 7987 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
a0d0e21e
LW
7988 fi
7989 ;;
7990esac
7991
a78b0d02 7992$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
7993
7994set d_dlsymun
7995eval $setvar
7996
85ab1d1d
JH
7997hasproto='varname=$1; func=$2; shift; shift;
7998while $test $# -ge 2; do
7999 case "$1" in
8000 $define) echo "#include <$2>";;
8001 esac ;
8002 shift 2;
8003done > try.c;
8004$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8005if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8006 echo "$func() prototype found.";
8007 val="$define";
8008else
8009 echo "$func() prototype NOT found.";
8010 val="$undef";
8011fi;
8012set $varname;
8013eval $setvar;
8014$rm -f try.c tryout.c'
8015
8016: see if prototype for drand48 is available
8017echo " "
8018set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8019eval $hasproto
8020
a0d0e21e
LW
8021: see if dup2 exists
8022set dup2 d_dup2
8023eval $inlibc
8024
5ff3f7a4
GS
8025: see if eaccess exists
8026set eaccess d_eaccess
8027eval $inlibc
8028
8029: see if endgrent exists
8030set endgrent d_endgrent
8031eval $inlibc
8032
e5c9fcd0
AD
8033: see if endhostent exists
8034set endhostent d_endhent
8035eval $inlibc
8036
8037: see if endnetent exists
8038set endnetent d_endnent
8039eval $inlibc
8040
8041: see if endprotoent exists
8042set endprotoent d_endpent
8043eval $inlibc
8044
5ff3f7a4
GS
8045: see if endpwent exists
8046set endpwent d_endpwent
8047eval $inlibc
8048
e5c9fcd0
AD
8049: see if endservent exists
8050set endservent d_endsent
8051eval $inlibc
8052
f1066039
JH
8053: see if endspent exists
8054set endspent d_endspent
8055eval $inlibc
8056
8e07c86e
AD
8057: Locate the flags for 'open()'
8058echo " "
8059$cat >open3.c <<'EOCP'
8060#include <sys/types.h>
8061#ifdef I_FCNTL
8062#include <fcntl.h>
8063#endif
8064#ifdef I_SYS_FILE
8065#include <sys/file.h>
8066#endif
d674cd6d 8067int main() {
8e07c86e
AD
8068 if(O_RDONLY);
8069#ifdef O_TRUNC
8070 exit(0);
8071#else
8072 exit(1);
8073#endif
8074}
8075EOCP
8076: check sys/file.h first to get FREAD on Sun
8077if $test `./findhdr sys/file.h` && \
dfe9444c 8078 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8079 h_sysfile=true;
8080 echo "<sys/file.h> defines the O_* constants..." >&4
8081 if ./open3; then
8082 echo "and you have the 3 argument form of open()." >&4
8083 val="$define"
8084 else
8085 echo "but not the 3 argument form of open(). Oh, well." >&4
8086 val="$undef"
8087 fi
8088elif $test `./findhdr fcntl.h` && \
dfe9444c 8089 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8090 h_fcntl=true;
8091 echo "<fcntl.h> defines the O_* constants..." >&4
8092 if ./open3; then
8093 echo "and you have the 3 argument form of open()." >&4
8094 val="$define"
8095 else
8096 echo "but not the 3 argument form of open(). Oh, well." >&4
8097 val="$undef"
8098 fi
8099else
8100 val="$undef"
8101 echo "I can't find the O_* constant definitions! You got problems." >&4
8102fi
8103set d_open3
8104eval $setvar
8105$rm -f open3*
8106
8107: check for non-blocking I/O stuff
8108case "$h_sysfile" in
8109true) echo "#include <sys/file.h>" > head.c;;
8110*)
8111 case "$h_fcntl" in
8112 true) echo "#include <fcntl.h>" > head.c;;
8113 *) echo "#include <sys/fcntl.h>" > head.c;;
8114 esac
8115 ;;
8116esac
8117echo " "
8118echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8119case "$o_nonblock" in
8120'')
8121 $cat head.c > try.c
8122 $cat >>try.c <<'EOCP'
d674cd6d 8123int main() {
8e07c86e
AD
8124#ifdef O_NONBLOCK
8125 printf("O_NONBLOCK\n");
8126 exit(0);
8127#endif
8128#ifdef O_NDELAY
8129 printf("O_NDELAY\n");
8130 exit(0);
8131#endif
8132#ifdef FNDELAY
8133 printf("FNDELAY\n");
8134 exit(0);
8135#endif
8136 exit(0);
8137}
8138EOCP
dfe9444c 8139 set try
dc45a647 8140 if eval $compile_ok; then
8e07c86e
AD
8141 o_nonblock=`./try`
8142 case "$o_nonblock" in
8143 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8144 *) echo "Seems like we can use $o_nonblock.";;
8145 esac
8146 else
8147 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8148 fi
8149 ;;
8150*) echo "Using $hint value $o_nonblock.";;
8151esac
8152$rm -f try try.* .out core
8153
8154echo " "
8155echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8156case "$eagain" in
8157'')
8158 $cat head.c > try.c
8159 $cat >>try.c <<EOCP
8160#include <errno.h>
8161#include <sys/types.h>
8162#include <signal.h>
4633a7c4 8163#define MY_O_NONBLOCK $o_nonblock
dc45a647 8164#ifndef errno /* XXX need better Configure test */
8e07c86e 8165extern int errno;
dc45a647 8166#endif
8e07c86e 8167$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8168EOCP
8169 $cat >> try.c <<'EOCP'
d674cd6d 8170int main()
8e07c86e
AD
8171{
8172 int pd[2];
8173 int pu[2];
8174 char buf[1];
8175 char string[100];
8176
8177 pipe(pd); /* Down: child -> parent */
8178 pipe(pu); /* Up: parent -> child */
8179 if (0 != fork()) {
8180 int ret;
8181 close(pd[1]); /* Parent reads from pd[0] */
8182 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8183 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8184 exit(1);
8185 signal(SIGALRM, blech);
8186 alarm(5);
8187 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8188 exit(2);
8189 sprintf(string, "%d\n", ret);
8190 write(2, string, strlen(string));
8191 alarm(0);
8192#ifdef EAGAIN
8193 if (errno == EAGAIN) {
8194 printf("EAGAIN\n");
8195 goto ok;
8196 }
8197#endif
8198#ifdef EWOULDBLOCK
8199 if (errno == EWOULDBLOCK)
8200 printf("EWOULDBLOCK\n");
8201#endif
8202 ok:
8203 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8204 sleep(2); /* Give it time to close our pipe */
8205 alarm(5);
8206 ret = read(pd[0], buf, 1); /* Should read EOF */
8207 alarm(0);
8208 sprintf(string, "%d\n", ret);
8209 write(3, string, strlen(string));
8210 exit(0);
8211 }
8212
8213 close(pd[0]); /* We write to pd[1] */
8214 close(pu[1]); /* We read from pu[0] */
8215 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8216 close(pd[1]); /* Pipe pd is now fully closed! */
8217 exit(0); /* Bye bye, thank you for playing! */
8218}
8219EOCP
dfe9444c 8220 set try
dc45a647 8221 if eval $compile_ok; then
774d564b 8222 echo "$startsh" >mtry
40a7a20a 8223 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8224 chmod +x mtry
8225 ./mtry >/dev/null 2>&1
8226 case $? in
8227 0) eagain=`$cat try.out`;;
8228 1) echo "Could not perform non-blocking setting!";;
8229 2) echo "I did a successful read() for something that was not there!";;
8230 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8231 *) echo "Something terribly wrong happened during testing.";;
8232 esac
8233 rd_nodata=`$cat try.ret`
8234 echo "A read() system call with no data present returns $rd_nodata."
8235 case "$rd_nodata" in
8236 0|-1) ;;
8237 *)
8238 echo "(That's peculiar, fixing that to be -1.)"
8239 rd_nodata=-1
8240 ;;
8241 esac
8242 case "$eagain" in
8243 '')
8244 echo "Forcing errno EAGAIN on read() with no data available."
8245 eagain=EAGAIN
8246 ;;
8247 *)
8248 echo "Your read() sets errno to $eagain when no data is available."
8249 ;;
8250 esac
8251 status=`$cat try.err`
8252 case "$status" in
8253 0) echo "And it correctly returns 0 to signal EOF.";;
8254 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8255 *) echo "However, your read() returns '$status' on EOF??";;
8256 esac
8257 val="$define"
28757baa 8258 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8259 echo "WARNING: you can't distinguish between EOF and no data!"
8260 val="$undef"
8261 fi
8262 else
8263 echo "I can't compile the test program--assuming errno EAGAIN will do."
8264 eagain=EAGAIN
8265 fi
8266 set d_eofnblk
8267 eval $setvar
8268 ;;
8269*)
8270 echo "Using $hint value $eagain."
8271 echo "Your read() returns $rd_nodata when no data is present."
8272 case "$d_eofnblk" in
8273 "$define") echo "And you can see EOF because read() returns 0.";;
8274 "$undef") echo "But you can't see EOF status from read() returned value.";;
8275 *)
8276 echo "(Assuming you can't see EOF status from read anyway.)"
8277 d_eofnblk=$undef
8278 ;;
8279 esac
8280 ;;
8281esac
8282$rm -f try try.* .out core head.c mtry
8283
a0d0e21e
LW
8284: see if fchmod exists
8285set fchmod d_fchmod
8286eval $inlibc
8287
8288: see if fchown exists
8289set fchown d_fchown
8290eval $inlibc
8291
8292: see if this is an fcntl system
8293set fcntl d_fcntl
8294eval $inlibc
8295
921b2963
JH
8296: see if sys/select.h has to be included
8297set sys/select.h i_sysselct
8298eval $inhdr
8299
8300: see if we should include time.h, sys/time.h, or both
8301echo " "
8302if test "X$timeincl" = X; then
8303 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8304 $echo $n "I'm now running the test program...$c"
8305 $cat >try.c <<'EOCP'
8306#include <sys/types.h>
8307#ifdef I_TIME
8308#include <time.h>
8309#endif
8310#ifdef I_SYSTIME
8311#ifdef SYSTIMEKERNEL
8312#define KERNEL
8313#endif
8314#include <sys/time.h>
8315#endif
8316#ifdef I_SYSSELECT
8317#include <sys/select.h>
8318#endif
d674cd6d 8319int main()
921b2963
JH
8320{
8321 struct tm foo;
8322#ifdef S_TIMEVAL
8323 struct timeval bar;
8324#endif
8325#ifdef S_TIMEZONE
8326 struct timezone tzp;
8327#endif
8328 if (foo.tm_sec == foo.tm_sec)
8329 exit(0);
8330#ifdef S_TIMEVAL
8331 if (bar.tv_sec == bar.tv_sec)
8332 exit(0);
8333#endif
8334 exit(1);
8335}
8336EOCP
8337 flags=''
8338 for s_timezone in '-DS_TIMEZONE' ''; do
8339 sysselect=''
8340 for s_timeval in '-DS_TIMEVAL' ''; do
8341 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8342 for i_time in '' '-DI_TIME'; do
8343 for i_systime in '-DI_SYSTIME' ''; do
8344 case "$flags" in
8345 '') $echo $n ".$c"
8346 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8347 if eval $compile; then
8348 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8349 shift
8350 flags="$*"
8351 echo " "
8352 $echo $n "Succeeded with $flags$c"
8353 fi
8354 ;;
8355 esac
8356 done
8357 done
8358 done
8359 done
8360 done
8361 timeincl=''
8362 echo " "
8363 case "$flags" in
8364 *SYSTIMEKERNEL*) i_systimek="$define"
8365 timeincl=`./findhdr sys/time.h`
8366 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8367 *) i_systimek="$undef";;
8368 esac
8369 case "$flags" in
8370 *I_TIME*) i_time="$define"
8371 timeincl=`./findhdr time.h`" $timeincl"
8372 echo "We'll include <time.h>." >&4;;
8373 *) i_time="$undef";;
8374 esac
8375 case "$flags" in
8376 *I_SYSTIME*) i_systime="$define"
8377 timeincl=`./findhdr sys/time.h`" $timeincl"
8378 echo "We'll include <sys/time.h>." >&4;;
8379 *) i_systime="$undef";;
8380 esac
8381 $rm -f try.c try
8382fi
8383
8384: check for fd_set items
8385$cat <<EOM
8386
8387Checking to see how well your C compiler handles fd_set and friends ...
8388EOM
8389$cat >fd_set.c <<EOCP
8390#$i_systime I_SYS_TIME
8391#$i_sysselct I_SYS_SELECT
8392#$d_socket HAS_SOCKET
8393#include <sys/types.h>
8394#ifdef HAS_SOCKET
8395#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8396#endif
8397#ifdef I_SYS_TIME
8398#include <sys/time.h>
8399#endif
8400#ifdef I_SYS_SELECT
8401#include <sys/select.h>
8402#endif
d674cd6d 8403int main() {
921b2963
JH
8404 fd_set fds;
8405
8406#ifdef TRYBITS
8407 if(fds.fds_bits);
8408#endif
8409
8410#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8411 exit(0);
8412#else
8413 exit(1);
8414#endif
8415}
8416EOCP
8417set fd_set -DTRYBITS
8418if eval $compile; then
8419 d_fds_bits="$define"
8420 d_fd_set="$define"
8421 echo "Well, your system knows about the normal fd_set typedef..." >&4
8422 if ./fd_set; then
8423 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8424 d_fd_macros="$define"
8425 else
8426 $cat >&4 <<'EOM'
8427but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8428EOM
8429 d_fd_macros="$undef"
8430 fi
8431else
8432 $cat <<'EOM'
8433Hmm, your compiler has some difficulty with fd_set. Checking further...
8434EOM
8435 set fd_set
8436 if eval $compile; then
8437 d_fds_bits="$undef"
8438 d_fd_set="$define"
8439 echo "Well, your system has some sort of fd_set available..." >&4
8440 if ./fd_set; then
8441 echo "and you have the normal fd_set macros." >&4
8442 d_fd_macros="$define"
8443 else
8444 $cat <<'EOM'
8445but not the normal fd_set macros! Gross! More work for me...
8446EOM
8447 d_fd_macros="$undef"
8448 fi
8449 else
8450 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
8451 d_fd_set="$undef"
8452 d_fds_bits="$undef"
8453 d_fd_macros="$undef"
8454 fi
8455fi
8456$rm -f fd_set*
8457
a0d0e21e
LW
8458: see if fgetpos exists
8459set fgetpos d_fgetpos
8460eval $inlibc
8461
d9b3e12d
JH
8462: see if flock exists
8463set flock d_flock
8464eval $inlibc
8465
8466: see if fork exists
8467set fork d_fork
8468eval $inlibc
8469
8470: see if pathconf exists
8471set pathconf d_pathconf
8472eval $inlibc
8473
8474: see if fpathconf exists
8475set fpathconf d_fpathconf
8476eval $inlibc
8477
8478
8479: see if llseek exists
8480set llseek d_llseek
8481eval $inlibc
8482
8483: check for off64_t
8484echo " "
8485echo $n "Checking to see if your system supports off64_t...$c" >&4
8486$cat >try.c <<EOCP
8487#include <sys/types.h>
8488#include <unistd.h>
8489off64_t foo() { off64_t x; x = 7; return x; }'
8490EOCP
8491if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8492 val="$define"
8493 echo " Yup, it does." >&4
8494else
8495 val="$undef"
8496 echo " Nope, it doesn't." >&4
8497fi
8498$rm -f try.*
8499set d_off64_t
8500eval $setvar
8501
8502: check for fpos64_t
8503echo " "
8504echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8505$cat >try.c <<EOCP
8506#include <sys/stdio.h>
8507fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8508EOCP
8509if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8510 val="$define"
8511 echo " Yup, it does." >&4
8512else
8513 val="$undef"
8514 echo " Nope, it doesn't." >&4
8515fi
8516$rm -f try.*
8517set d_fpos64_t
8518eval $setvar
8519
8520: see if fseeko exists
8521set fseeko d_fseeko
8522eval $inlibc
8523
8524: see if fsetpos exists
8525set fsetpos d_fsetpos
8526eval $inlibc
8527
9b9c89a3
JH
8528: see if this is a sys/param system
8529set sys/param.h i_sysparam
8530eval $inhdr
8531
104d25b7
JH
8532: see if this is a sys/mount.h system
8533set sys/mount.h i_sysmount
8534eval $inhdr
8535
8536
8537: see if statfs exists
8538set statfs d_statfs
8539eval $inlibc
8540
8541: see if fstatfs exists
8542set fstatfs d_fstatfs
8543eval $inlibc
8544
8545: see if statfs knows about mount flags
9b9c89a3 8546set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
104d25b7
JH
8547eval $hasfield
8548
8549
8550: see if statvfs exists
8551set statvfs d_statvfs
8552eval $inlibc
8553
8554: see if fstatvfs exists
8555set fstatvfs d_fstatvfs
8556eval $inlibc
8557
8558
5ff3f7a4
GS
8559: see if ftello exists
8560set ftello d_ftello
8561eval $inlibc
8562
8563: see if getgrent exists
8564set getgrent d_getgrent
8565eval $inlibc
8566
693762b4
AD
8567: see if gethostbyaddr exists
8568set gethostbyaddr d_gethbyaddr
8569eval $inlibc
8570
8571: see if gethostbyname exists
8572set gethostbyname d_gethbyname
8573eval $inlibc
8574
a0d0e21e
LW
8575: see if gethostent exists
8576set gethostent d_gethent
8577eval $inlibc
8578
921b2963
JH
8579: see how we will look up host name
8580echo " "
a63faeb8
JH
8581call=''
8582if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
8583 echo 'gethostname() found.' >&4
8584 d_gethname="$define"
8585 call=gethostname
a63faeb8
JH
8586fi
8587if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
8588 if ./xenix; then
8589 $cat <<'EOM'
8590uname() was found, but you're running xenix, and older versions of xenix
8591have a broken uname(). If you don't really know whether your xenix is old
8592enough to have a broken system call, use the default answer.
8593
8594EOM
8595 dflt=y
8596 case "$d_uname" in
8597 "$define") dflt=n;;
8598 esac
8599 rp='Is your uname() broken?'
8600 . ./myread
8601 case "$ans" in
8602 n*) d_uname="$define"; call=uname;;
8603 esac
8604 else
8605 echo 'uname() found.' >&4
8606 d_uname="$define"
a63faeb8
JH
8607 case "$call" in
8608 '') call=uname ;;
8609 esac
921b2963
JH
8610 fi
8611fi
8612case "$d_gethname" in
8613'') d_gethname="$undef";;
8614esac
8615case "$d_uname" in
8616'') d_uname="$undef";;
8617esac
8618case "$d_uname$d_gethname" in
8619*define*)
8620 dflt=n
8621 cat <<EOM
8622
8623Every now and then someone has a $call() that lies about the hostname
8624but can't be fixed for political or economic reasons. If you wish, I can
8625pretend $call() isn't there and maybe compute hostname at run-time
8626thanks to the '$phostname' command.
8627
8628EOM
8629 rp="Shall I ignore $call() from now on?"
8630 . ./myread
8631 case "$ans" in
8632 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8633 esac;;
8634esac
8635case "$phostname" in
8636'') aphostname='';;
8637*) case "$aphostname" in
8638 /*) ;;
8639 *) set X $phostname
8640 shift
8641 file=$1
8642 shift
8643 file=`./loc $file $file $pth`
8644 aphostname=`echo $file $*`
8645 ;;
8646 esac
8647 ;;
8648esac
8649case "$d_uname$d_gethname" in
8650*define*) ;;
8651*)
8652 case "$phostname" in
8653 '')
8654 echo "There will be no way for $package to get your hostname." >&4;;
8655 *)
8656 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8657 ;;
8658 esac;;
8659esac
8660case "$d_phostname" in
8661'') d_phostname="$undef";;
8662esac
8663
dc45a647
MB
8664: see if this is a netdb.h system
8665set netdb.h i_netdb
8666eval $inhdr
8667
8668: see if prototypes for various gethostxxx netdb.h functions are available
8669echo " "
8670set d_gethostprotos gethostent $i_netdb netdb.h
8671eval $hasproto
8672
a0d0e21e
LW
8673: see if getlogin exists
8674set getlogin d_getlogin
8675eval $inlibc
8676
ccc7f9b3
KS
8677: see if getmntent exists
8678set getmntent d_getmntent
8679eval $inlibc
8680
693762b4
AD
8681: see if getnetbyaddr exists
8682set getnetbyaddr d_getnbyaddr
8683eval $inlibc
8684
8685: see if getnetbyname exists
8686set getnetbyname d_getnbyname
8687eval $inlibc
8688
e5c9fcd0
AD
8689: see if getnetent exists
8690set getnetent d_getnent
8691eval $inlibc
8692
dc45a647
MB
8693: see if prototypes for various getnetxxx netdb.h functions are available
8694echo " "
8695set d_getnetprotos getnetent $i_netdb netdb.h
8696eval $hasproto
8697
693762b4
AD
8698
8699: see if getprotobyname exists
8700set getprotobyname d_getpbyname
8701eval $inlibc
8702
8703: see if getprotobynumber exists
8704set getprotobynumber d_getpbynumber
8705eval $inlibc
e5c9fcd0
AD
8706
8707: see if getprotoent exists
8708set getprotoent d_getpent
8709eval $inlibc
8710
2afac517 8711: see if getpgid exists
8712set getpgid d_getpgid
a0d0e21e
LW
8713eval $inlibc
8714
8715: see if getpgrp2 exists
8716set getpgrp2 d_getpgrp2
8717eval $inlibc
8718
8719: see if getppid exists
8720set getppid d_getppid
8721eval $inlibc
8722
8723: see if getpriority exists
8724set getpriority d_getprior
8725eval $inlibc
8726
dc45a647
MB
8727: see if prototypes for various getprotoxxx netdb.h functions are available
8728echo " "
8729set d_getprotoprotos getprotoent $i_netdb netdb.h
8730eval $hasproto
8731
5ff3f7a4
GS
8732: see if getpwent exists
8733set getpwent d_getpwent
8734eval $inlibc
8735
8736
693762b4
AD
8737: see if getservbyname exists
8738set getservbyname d_getsbyname
8739eval $inlibc
8740
8741: see if getservbyport exists
8742set getservbyport d_getsbyport
8743eval $inlibc
e5c9fcd0
AD
8744
8745: see if getservent exists
8746set getservent d_getsent
8747eval $inlibc
8748
dc45a647
MB
8749: see if prototypes for various getservxxx netdb.h functions are available
8750echo " "
8751set d_getservprotos getservent $i_netdb netdb.h
8752eval $hasproto
8753
f1066039
JH
8754: see if getspent exists
8755set getspent d_getspent
8756eval $inlibc
8757
8758: see if getspnam exists
8759set getspnam d_getspnam
8760eval $inlibc
8761
5f05dabc 8762: see if gettimeofday or ftime exists
8763set gettimeofday d_gettimeod
8764eval $inlibc
8765case "$d_gettimeod" in
8766"$undef")
8767 set ftime d_ftime
8768 eval $inlibc
8769 ;;
8770*)
8771 val="$undef"; set d_ftime; eval $setvar
8772 ;;
8773esac
8774case "$d_gettimeod$d_ftime" in
8775"$undef$undef")
8776 echo " "
8777 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8778 ;;
8779esac
8780
5ff3f7a4
GS
8781: see if this is an grp system
8782set grp.h i_grp
8783eval $inhdr
8784
8785case "$i_grp" in
8786$define)
8787 xxx=`./findhdr grp.h`
8788 $cppstdin $cppflags $cppminus < $xxx >$$.h
8789
8790 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8791 val="$define"
8792 else
8793 val="$undef"
8794 fi
8795 set d_grpasswd
8796 eval $setvar
8797
8798 $rm -f $$.h
8799 ;;
8800*)
8801 val="$undef";
8802 set d_grpasswd; eval $setvar
8803 ;;
8804esac
8805
ccc7f9b3
KS
8806: see if hasmntopt exists
8807set hasmntopt d_hasmntopt
8808eval $inlibc
8809
a0d0e21e
LW
8810: see if this is a netinet/in.h or sys/in.h system
8811set netinet/in.h i_niin sys/in.h i_sysin
8812eval $inhdr
8813
5ff3f7a4 8814: see if arpa/inet.h has to be included
93341792 8815set arpa/inet.h i_arpainet
28e8609d
JH
8816eval $inhdr
8817
a0d0e21e
LW
8818: see if htonl --and friends-- exists
8819val=''
8820set htonl val
8821eval $inlibc
8822
8823: Maybe they are macros.
8824case "$val" in
8825$undef)
8826 $cat >htonl.c <<EOM
8827#include <stdio.h>
8828#include <sys/types.h>
8829#$i_niin I_NETINET_IN
8830#$i_sysin I_SYS_IN
93341792 8831#$i_arpainet I_ARPA_INET
a0d0e21e
LW
8832#ifdef I_NETINET_IN
8833#include <netinet/in.h>
8834#endif
8835#ifdef I_SYS_IN
8836#include <sys/in.h>
8837#endif
28e8609d
JH
8838#ifdef I_ARPA_INET
8839#include <arpa/inet.h>
8840#endif
a0d0e21e
LW
8841#ifdef htonl
8842printf("Defined as a macro.");
8843#endif
8844EOM
8845 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8846 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8847 val="$define"
8848 echo "But it seems to be defined as a macro." >&4
8849 fi
8850 $rm -f htonl.?
8851 ;;
8852esac
8853set d_htonl
8854eval $setvar
8855
8856: see which of string.h or strings.h is needed
8857echo " "
8858strings=`./findhdr string.h`
8859if $test "$strings" && $test -r "$strings"; then
8860 echo "Using <string.h> instead of <strings.h>." >&4
8861 val="$define"
8862else
8863 val="$undef"
8864 strings=`./findhdr strings.h`
8865 if $test "$strings" && $test -r "$strings"; then
8866 echo "Using <strings.h> instead of <string.h>." >&4
8867 else
8868 echo "No string header found -- You'll surely have problems." >&4
8869 fi
8870fi
8871set i_string
8872eval $setvar
8873case "$i_string" in
8874"$undef") strings=`./findhdr strings.h`;;
8875*) strings=`./findhdr string.h`;;
8876esac
8877
8878: index or strchr
8879echo " "
8880if set index val -f; eval $csym; $val; then
8881 if set strchr val -f d_strchr; eval $csym; $val; then
8882 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8883 val="$define"
8884 vali="$undef"
8885 echo "strchr() found." >&4
8886 else
8887 val="$undef"
8888 vali="$define"
8889 echo "index() found." >&4
8890 fi
8891 else
8892 val="$undef"
8893 vali="$define"
8894 echo "index() found." >&4
8895 fi
8896else
8897 if set strchr val -f d_strchr; eval $csym; $val; then
8898 val="$define"
8899 vali="$undef"
8900 echo "strchr() found." >&4
8901 else
8902 echo "No index() or strchr() found!" >&4
8903 val="$undef"
8904 vali="$undef"
8905 fi
8906fi
8907set d_strchr; eval $setvar
8908val="$vali"
8909set d_index; eval $setvar
8910
7e1af8bc 8911: check whether inet_aton exists
8912set inet_aton d_inetaton
8913eval $inlibc
8914
a0d0e21e
LW
8915: Look for isascii
8916echo " "
8917$cat >isascii.c <<'EOCP'
8918#include <stdio.h>
8919#include <ctype.h>
d674cd6d 8920int main() {
a0d0e21e
LW
8921 int c = 'A';
8922 if (isascii(c))
8923 exit(0);
8924 else
8925 exit(1);
8926}
8927EOCP
dfe9444c
AD
8928set isascii
8929if eval $compile; then
a0d0e21e
LW
8930 echo "isascii() found." >&4
8931 val="$define"
8932else
8933 echo "isascii() NOT found." >&4
8934 val="$undef"
8935fi
8936set d_isascii
8937eval $setvar
8938$rm -f isascii*
8939
8940: see if killpg exists
8941set killpg d_killpg
8942eval $inlibc
8943
dd64f1c3
AD
8944: see if lchown exists
8945echo " "
8946$cat > try.c <<'EOCP'
8947/* System header to define __stub macros and hopefully few prototypes,
8948 which can conflict with char lchown(); below. */
8949#include <assert.h>
8950/* Override any gcc2 internal prototype to avoid an error. */
8951/* We use char because int might match the return type of a gcc2
8952 builtin and then its argument prototype would still apply. */
8953char lchown();
8954int main() {
8955 /* The GNU C library defines this for functions which it implements
8956 to always fail with ENOSYS. Some functions are actually named
8957 something starting with __ and the normal name is an alias. */
8958#if defined (__stub_lchown) || defined (__stub___lchown)
8959choke me
8960#else
8961lchown();
8962#endif
8963; return 0; }
8964EOCP
8965set try
8966if eval $compile; then
8967 $echo "lchown() found." >&4
8968 val="$define"
8969else
8970 $echo "lchown() NOT found." >&4
8971 val="$undef"
8972fi
8973set d_lchown
8974eval $setvar
8975
2d4389e4
JH
8976: See if number of significant digits in a double precision number is known
8977echo " "
8978$cat >ldbl_dig.c <<EOM
8979#$i_limits I_LIMITS
8980#$i_float I_FLOAT
8981#ifdef I_LIMITS
8982#include <limits.h>
8983#endif
8984#ifdef I_FLOAT
8985#include <float.h>
8986#endif
8987#ifdef LDBL_DIG
8988printf("Contains LDBL_DIG");
8989#endif
8990EOM
8991$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
8992if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
8993 echo "LDBL_DIG found." >&4
8994 val="$define"
8995else
8996 echo "LDBL_DIG NOT found." >&4
8997 val="$undef"
8998fi
8999$rm -f ldbl_dig.?
9000set d_ldbl_dig
9001eval $setvar
9002
a0d0e21e
LW
9003: see if link exists
9004set link d_link
9005eval $inlibc
9006
a0d0e21e
LW
9007: see if localeconv exists
9008set localeconv d_locconv
9009eval $inlibc
9010
9011: see if lockf exists
9012set lockf d_lockf
9013eval $inlibc
9014
9015: see if lstat exists
9016set lstat d_lstat
9017eval $inlibc
9018
ff49bff8
JH
9019: see if madvise exists
9020set madvise d_madvise
9021eval $inlibc
9022
a0d0e21e
LW
9023: see if mblen exists
9024set mblen d_mblen
9025eval $inlibc
9026
9027: see if mbstowcs exists
9028set mbstowcs d_mbstowcs
9029eval $inlibc
9030
9031: see if mbtowc exists
9032set mbtowc d_mbtowc
9033eval $inlibc
9034
0f27ced1
JH
9035: see if memchr exists
9036set memchr d_memchr
9037eval $inlibc
9038
a0d0e21e
LW
9039: see if memcmp exists
9040set memcmp d_memcmp
9041eval $inlibc
9042
9043: see if memcpy exists
9044set memcpy d_memcpy
9045eval $inlibc
9046
9047: see if memmove exists
9048set memmove d_memmove
2304df62
AD
9049eval $inlibc
9050
9051: see if memset exists
9052set memset d_memset
9053eval $inlibc
9054
9055: see if mkdir exists
9056set mkdir d_mkdir
9057eval $inlibc
9058
a0d0e21e
LW
9059: see if mkfifo exists
9060set mkfifo d_mkfifo
9061eval $inlibc
9062
9063: see if mktime exists
9064set mktime d_mktime
9065eval $inlibc
9066
ff49bff8
JH
9067: see if this is a sys/mman.h system
9068set sys/mman.h i_sysmman
9069eval $inhdr
9070
9071: see if mmap exists
9072set mmap d_mmap
9073eval $inlibc
9074: see what shmat returns
9075: default to something harmless
9076mmaptype='void *'
9077case "$i_sysmman$d_mmap" in
9078"$define$define")
9079 $cat >mmap.c <<'END'
9080#include <sys/mman.h>
9081void *mmap();
9082END
9083 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9084 mmaptype='void *'
9085 else
9086 mmaptype='caddr_t'
9087 fi
9088 echo "and it returns ($mmaptype)." >&4
9089 ;;
9090esac
9091
9092
9093
9094: see if mprotect exists
9095set mprotect d_mprotect
9096eval $inlibc
9097
2304df62
AD
9098: see if msgctl exists
9099set msgctl d_msgctl
9100eval $inlibc
9101
9102: see if msgget exists
9103set msgget d_msgget
9104eval $inlibc
9105
9106: see if msgsnd exists
9107set msgsnd d_msgsnd
9108eval $inlibc
9109
9110: see if msgrcv exists
9111set msgrcv d_msgrcv
9112eval $inlibc
9113
9114: see how much of the 'msg*(2)' library is present.
9115h_msg=true
9116echo " "
9117case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9118*"$undef"*) h_msg=false;;
9119esac
6087ac44
JH
9120case "$osname" in
9121freebsd)
9122 case "`ipcs 2>&1`" in
9123 "SVID messages"*"not configured"*)
5ff3f7a4 9124 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9125 h_msg=false
9126 val="$undef"
9127 set msgctl d_msgctl
9128 eval $setvar
9129 set msgget d_msgget
9130 eval $setvar
9131 set msgsnd d_msgsnd
9132 eval $setvar
9133 set msgrcv d_msgrcv
9134 eval $setvar
9135 ;;
9136 esac
9137 ;;
9138esac
2304df62
AD
9139: we could also check for sys/ipc.h ...
9140if $h_msg && $test `./findhdr sys/msg.h`; then
9141 echo "You have the full msg*(2) library." >&4
9142 val="$define"
9143else
9144 echo "You don't have the full msg*(2) library." >&4
9145 val="$undef"
9146fi
9147set d_msg
9148eval $setvar
9149
ff49bff8
JH
9150: see if msync exists
9151set msync d_msync
9152eval $inlibc
9153
9154: see if munmap exists
9155set munmap d_munmap
9156eval $inlibc
9157
dfe9444c
AD
9158: see if nice exists
9159set nice d_nice
9160eval $inlibc
9161
c4747d3e 9162: see if POSIX threads are available
13666627 9163if test "X$usethreads" = "X$define"; then
c4747d3e
JH
9164 set pthread.h i_pthread
9165 eval $inhdr
9166else
9167 i_pthread="$undef"
9168fi
9169
9170
9171
9172: how to create joinable pthreads
9173if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
9174 echo " "
9175 echo "Checking what constant to use for creating joinable pthreads..." >&4
9176 $cat >try.c <<'EOCP'
9177#include <pthread.h>
9178int main() {
9179 int detachstate = JOINABLE;
9180}
9181EOCP
9182 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9183 if eval $compile; then
c6912327 9184 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
9185 val="$undef" # Yes, undef.
9186 set d_old_pthread_create_joinable
13666627 9187 eval $setvar
ef4af2be
JH
9188 val=""
9189 set old_pthread_create_joinable
13666627
JH
9190 eval $setvar
9191 else
9192 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9193 if eval $compile; then
c6912327 9194 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 9195 val="$define"
ef4af2be 9196 set d_old_pthread_create_joinable
13666627
JH
9197 eval $setvar
9198 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 9199 set old_pthread_create_joinable
13666627
JH
9200 eval $setvar
9201 else
9202 set try -DJOINABLE=__UNDETACHED
9203 if eval $compile; then
c6912327 9204 echo "You seem to use __UNDETACHED." >&4
13666627 9205 val="$define"
ef4af2be 9206 set d_old_pthread_create_joinable
13666627
JH
9207 eval $setvar
9208 val=__UNDETACHED
ef4af2be 9209 set old_pthread_create_joinable
13666627
JH
9210 eval $setvar
9211 else
c6912327 9212 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 9213 val="$define"
ef4af2be 9214 set d_old_pthread_create_joinable
13666627
JH
9215 eval $setvar
9216 val=0
ef4af2be 9217 set old_pthread_create_joinable
13666627
JH
9218 eval $setvar
9219 fi
9220 fi
9221 fi
9222 $rm -f try try.*
9223else
ef4af2be
JH
9224 d_old_pthread_create_joinable="$undef"
9225 old_pthread_create_joinable=""
13666627
JH
9226fi
9227
ef4af2be
JH
9228: see if pause exists
9229set pause d_pause
9230eval $inlibc
9231
9232: see if pipe exists
9233set pipe d_pipe
9234eval $inlibc
9235
9236: see if poll exists
9237set poll d_poll
9238eval $inlibc
9239
31dfa2f6
JH
9240
9241: see whether the various POSIXish _yields exist
9242$cat >try.c <<EOP
9243#include <pthread.h>
9244#include <stdio.h>
5a411a32 9245int main() {
31dfa2f6
JH
9246#ifdef SCHED_YIELD
9247 sched_yield();
9248#else
9249#ifdef PTHREAD_YIELD
9250 pthread_yield();
9251#else
9252#ifdef PTHREAD_YIELD_NULL
9253 pthread_yield(NULL);
9254#endif
9255#endif
9256#endif
9257}
9258EOP
9259: see if sched_yield exists
9260set try -DSCHED_YIELD
9261if eval $compile; then
9262 val="$define"
9263 sched_yield='sched_yield()'
9264else
9265 val="$undef"
9266fi
9267case "$usethreads" in
9268$define)
9269 case "$val" in
9270 $define) echo 'sched_yield() found.' >&4 ;;
9271 *) echo 'sched_yield() NOT found.' >&4 ;;
9272 esac
9273esac
9274set d_sched_yield
9275eval $setvar
9276
9277: see if pthread_yield exists
9278set try -DPTHREAD_YIELD
9279if eval $compile; then
9280 val="$define"
9281 case "$sched_yield" in
9282 '') sched_yield='pthread_yield()' ;;
9283 esac
9284else
9285 set try -DPTHREAD_YIELD_NULL
9286 if eval $compile; then
9287 val="$define"
9288 case "$sched_yield" in
9289 '') sched_yield='pthread_yield(NULL)' ;;
9290 esac
9291 else
9292 val="$undef"
9293 fi
9294fi
9295case "$usethreads" in
9296$define)
9297 case "$val" in
9298 $define) echo 'pthread_yield() found.' >&4 ;;
9299 *) echo 'pthread_yield() NOT found.' >&4 ;;
9300 esac
9301 ;;
9302esac
9303set d_pthread_yield
9304eval $setvar
9305
9306case "$sched_yield" in
9307'') sched_yield=undef ;;
9308esac
9309
9310$rm -f try try.*
9311
4aa0a1f7
AD
9312: see if this is a pwd.h system
9313set pwd.h i_pwd
9314eval $inhdr
9315
9316case "$i_pwd" in
9317$define)
9318 xxx=`./findhdr pwd.h`
85e6fe83 9319 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 9320
2304df62 9321 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 9322 val="$define"
2304df62 9323 else
4aa0a1f7 9324 val="$undef"
2304df62 9325 fi
4aa0a1f7
AD
9326 set d_pwquota
9327 eval $setvar
9328
2304df62 9329 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 9330 val="$define"
2304df62 9331 else
4aa0a1f7 9332 val="$undef"
2304df62 9333 fi
4aa0a1f7
AD
9334 set d_pwage
9335 eval $setvar
9336
2304df62 9337 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 9338 val="$define"
2304df62 9339 else
4aa0a1f7 9340 val="$undef"
2304df62 9341 fi
4aa0a1f7
AD
9342 set d_pwchange
9343 eval $setvar
9344
2304df62 9345 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 9346 val="$define"
2304df62 9347 else
4aa0a1f7 9348 val="$undef"
2304df62 9349 fi
4aa0a1f7
AD
9350 set d_pwclass
9351 eval $setvar
9352
2304df62 9353 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 9354 val="$define"
2304df62 9355 else
4aa0a1f7 9356 val="$undef"
2304df62 9357 fi
4aa0a1f7
AD
9358 set d_pwexpire
9359 eval $setvar
9360
2304df62 9361 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4aa0a1f7 9362 val="$define"
2304df62 9363 else
4aa0a1f7 9364 val="$undef"
2304df62 9365 fi
4aa0a1f7
AD
9366 set d_pwcomment
9367 eval $setvar
9368
c4f23d77
AD
9369 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9370 val="$define"
9371 else
9372 val="$undef"
9373 fi
9374 set d_pwgecos
9375 eval $setvar
9376
28e8609d
JH
9377 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9378 val="$define"
9379 else
9380 val="$undef"
9381 fi
9382 set d_pwpasswd
9383 eval $setvar
9384
2304df62 9385 $rm -f $$.h
4aa0a1f7 9386 ;;
5ff3f7a4 9387*)
4aa0a1f7
AD
9388 val="$undef";
9389 set d_pwquota; eval $setvar
9390 set d_pwage; eval $setvar
9391 set d_pwchange; eval $setvar
9392 set d_pwclass; eval $setvar
9393 set d_pwexpire; eval $setvar
9394 set d_pwcomment; eval $setvar
c4f23d77 9395 set d_pwgecos; eval $setvar
28e8609d 9396 set d_pwpasswd; eval $setvar
4aa0a1f7
AD
9397 ;;
9398esac
2304df62 9399
85e6fe83 9400: see if readdir and friends exist
2304df62
AD
9401set readdir d_readdir
9402eval $inlibc
85e6fe83
LW
9403set seekdir d_seekdir
9404eval $inlibc
9405set telldir d_telldir
9406eval $inlibc
9407set rewinddir d_rewinddir
9408eval $inlibc
2304df62 9409
a0d0e21e
LW
9410: see if readlink exists
9411set readlink d_readlink
9412eval $inlibc
9413
de4597cb
JH
9414: see if readv exists
9415set readv d_readv
9416eval $inlibc
9417
2304df62
AD
9418: see if rename exists
9419set rename d_rename
9420eval $inlibc
9421
9422: see if rmdir exists
9423set rmdir d_rmdir
9424eval $inlibc
9425
8ff267be 9426: see if memory.h is available.
9427val=''
9428set memory.h val
9429eval $inhdr
9430
9431: See if it conflicts with string.h
9432case "$val" in
9433$define)
9434 case "$strings" in
9435 '') ;;
9436 *)
9437 $cppstdin $cppflags $cppminus < $strings > mem.h
9438 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9439 echo " "
9440 echo "We won't be including <memory.h>."
9441 val="$undef"
9442 fi
9443 $rm -f mem.h
9444 ;;
9445 esac
9446esac
9447set i_memory
9448eval $setvar
9449
2304df62
AD
9450: can bcopy handle overlapping blocks?
9451val="$undef"
9452case "$d_bcopy" in
9453"$define")
9454 echo " "
9455 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 9456 $cat >try.c <<EOCP
8ff267be 9457#$i_memory I_MEMORY
9458#$i_stdlib I_STDLIB
9459#$i_string I_STRING
9460#$i_unistd I_UNISTD
9461EOCP
dfe9444c 9462 $cat >>try.c <<'EOCP'
8ff267be 9463#include <stdio.h>
8ff267be 9464#ifdef I_MEMORY
9465# include <memory.h>
9466#endif
9467#ifdef I_STDLIB
9468# include <stdlib.h>
9469#endif
9470#ifdef I_STRING
9471# include <string.h>
9472#else
9473# include <strings.h>
9474#endif
9475#ifdef I_UNISTD
9476# include <unistd.h> /* Needed for NetBSD */
9477#endif
d674cd6d 9478int main()
2304df62 9479{
85e6fe83
LW
9480char buf[128], abc[128];
9481char *b;
9482int len;
9483int off;
9484int align;
a0d0e21e 9485
85e6fe83 9486bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
9487
9488for (align = 7; align >= 0; align--) {
9489 for (len = 36; len; len--) {
9490 b = buf+align;
85e6fe83 9491 bcopy(abc, b, len);
2304df62
AD
9492 for (off = 1; off <= len; off++) {
9493 bcopy(b, b+off, len);
9494 bcopy(b+off, b, len);
85e6fe83 9495 if (bcmp(b, abc, len))
2304df62
AD
9496 exit(1);
9497 }
9498 }
9499}
9500exit(0);
9501}
9502EOCP
dfe9444c 9503 set try
dc45a647 9504 if eval $compile_ok; then
dfe9444c 9505 if ./try 2>/dev/null; then
2304df62
AD
9506 echo "Yes, it can."
9507 val="$define"
9508 else
9509 echo "It can't, sorry."
8ff267be 9510 case "$d_memmove" in
9511 "$define") echo "But that's Ok since you have memmove()." ;;
9512 esac
2304df62
AD
9513 fi
9514 else
9515 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 9516 case "$d_memmove" in
9517 "$define") echo "But that's Ok since you have memmove()." ;;
9518 esac
2304df62
AD
9519 fi
9520 ;;
9521esac
dfe9444c 9522$rm -f try.* try core
2304df62
AD
9523set d_safebcpy
9524eval $setvar
9525
9526: can memcpy handle overlapping blocks?
9527val="$undef"
9528case "$d_memcpy" in
9529"$define")
9530 echo " "
9531 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 9532 $cat >try.c <<EOCP
8ff267be 9533#$i_memory I_MEMORY
9534#$i_stdlib I_STDLIB
9535#$i_string I_STRING
9536#$i_unistd I_UNISTD
9537EOCP
dfe9444c 9538 $cat >>try.c <<'EOCP'
8ff267be 9539#include <stdio.h>
8ff267be 9540#ifdef I_MEMORY
9541# include <memory.h>
9542#endif
9543#ifdef I_STDLIB
9544# include <stdlib.h>
9545#endif
9546#ifdef I_STRING
9547# include <string.h>
9548#else
9549# include <strings.h>
9550#endif
9551#ifdef I_UNISTD
9552# include <unistd.h> /* Needed for NetBSD */
9553#endif
d674cd6d 9554int main()
2304df62 9555{
85e6fe83
LW
9556char buf[128], abc[128];
9557char *b;
9558int len;
9559int off;
9560int align;
9561
8ff267be 9562/* Copy "abcde..." string to char abc[] so that gcc doesn't
9563 try to store the string in read-only memory. */
85e6fe83 9564memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
9565
9566for (align = 7; align >= 0; align--) {
9567 for (len = 36; len; len--) {
9568 b = buf+align;
232e078e 9569 memcpy(b, abc, len);
2304df62 9570 for (off = 1; off <= len; off++) {
2304df62 9571 memcpy(b+off, b, len);
232e078e 9572 memcpy(b, b+off, len);
85e6fe83 9573 if (memcmp(b, abc, len))
2304df62
AD
9574 exit(1);
9575 }
9576 }
9577}
9578exit(0);
9579}
9580EOCP
dfe9444c 9581 set try
dc45a647 9582 if eval $compile_ok; then
dfe9444c 9583 if ./try 2>/dev/null; then
2304df62
AD
9584 echo "Yes, it can."
9585 val="$define"
9586 else
9587 echo "It can't, sorry."
8ff267be 9588 case "$d_memmove" in
9589 "$define") echo "But that's Ok since you have memmove()." ;;
9590 esac
2304df62
AD
9591 fi
9592 else
9593 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 9594 case "$d_memmove" in
9595 "$define") echo "But that's Ok since you have memmove()." ;;
9596 esac
2304df62
AD
9597 fi
9598 ;;
9599esac
dfe9444c 9600$rm -f try.* try core
2304df62
AD
9601set d_safemcpy
9602eval $setvar
9603
36477c24 9604: can memcmp be trusted to compare relative magnitude?
9605val="$undef"
9606case "$d_memcmp" in
9607"$define")
9608 echo " "
dfe9444c
AD
9609 echo "Checking if your memcmp() can compare relative magnitude..." >&4
9610 $cat >try.c <<EOCP
36477c24 9611#$i_memory I_MEMORY
9612#$i_stdlib I_STDLIB
9613#$i_string I_STRING
9614#$i_unistd I_UNISTD
9615EOCP
dfe9444c 9616 $cat >>try.c <<'EOCP'
36477c24 9617#include <stdio.h>
36477c24 9618#ifdef I_MEMORY
9619# include <memory.h>
9620#endif
9621#ifdef I_STDLIB
9622# include <stdlib.h>
9623#endif
9624#ifdef I_STRING
9625# include <string.h>
9626#else
9627# include <strings.h>
9628#endif
9629#ifdef I_UNISTD
9630# include <unistd.h> /* Needed for NetBSD */
9631#endif
d674cd6d 9632int main()
36477c24 9633{
9634char a = -1;
9635char b = 0;
9636if ((a < b) && memcmp(&a, &b, 1) < 0)
9637 exit(1);
9638exit(0);
9639}
9640EOCP
dfe9444c 9641 set try
dc45a647 9642 if eval $compile_ok; then
dfe9444c 9643 if ./try 2>/dev/null; then
36477c24 9644 echo "Yes, it can."
9645 val="$define"
9646 else
9647 echo "No, it can't (it uses signed chars)."
9648 fi
9649 else
9650 echo "(I can't compile the test program, so we'll assume not...)"
9651 fi
9652 ;;
9653esac
dfe9444c 9654$rm -f try.* try core
36477c24 9655set d_sanemcmp
9656eval $setvar
9657
2304df62
AD
9658: see if select exists
9659set select d_select
9660eval $inlibc
9661
9662: see if semctl exists
9663set semctl d_semctl
9664eval $inlibc
9665
9666: see if semget exists
9667set semget d_semget
9668eval $inlibc
9669
9670: see if semop exists
9671set semop d_semop
9672eval $inlibc
9673
9674: see how much of the 'sem*(2)' library is present.
9675h_sem=true
9676echo " "
9677case "$d_semctl$d_semget$d_semop" in
9678*"$undef"*) h_sem=false;;
9679esac
6087ac44
JH
9680case "$osname" in
9681freebsd)
9682 case "`ipcs 2>&1`" in
9683 "SVID messages"*"not configured"*)
5ff3f7a4 9684 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
9685 h_sem=false
9686 val="$undef"
9687 set semctl d_semctl
9688 eval $setvar
9689 set semget d_semget
9690 eval $setvar
9691 set semop d_semop
9692 eval $setvar
9693 ;;
9694 esac
9695 ;;
9696esac
2304df62
AD
9697: we could also check for sys/ipc.h ...
9698if $h_sem && $test `./findhdr sys/sem.h`; then
9699 echo "You have the full sem*(2) library." >&4
9700 val="$define"
9701else
9702 echo "You don't have the full sem*(2) library." >&4
9703 val="$undef"
9704fi
9705set d_sem
9706eval $setvar
9707
bd89102f
AD
9708: see whether sys/sem.h defines union semun
9709echo " "
9710$cat > try.c <<'END'
9711#include <sys/types.h>
9712#include <sys/ipc.h>
9713#include <sys/sem.h>
9714int main () { union semun semun; semun.buf = 0; }
9715END
9716set try
9717if eval $compile; then
9718 echo "You have union semun in <sys/sem.h>." >&4
9719 val="$define"
9720else
9721 echo "You do not have union semun in <sys/sem.h>." >&4
9722 val="$undef"
9723fi
85ab1d1d 9724$rm -f try try.c try.h
bd89102f
AD
9725set d_union_semun
9726eval $setvar
9727
9728: see how to do semctl IPC_STAT
9729case "$d_sem" in
9730$define)
9731 : see whether semctl IPC_STAT can use union semun
9732 echo " "
85ab1d1d
JH
9733 $cat > try.h <<END
9734#ifndef S_IRUSR
9735# ifdef S_IREAD
9736# define S_IRUSR S_IREAD
9737# define S_IWUSR S_IWRITE
9738# define S_IXUSR S_IEXEC
9739# else
9740# define S_IRUSR 0400
9741# define S_IWUSR 0200
9742# define S_IXUSR 0100
9743# endif
9744# define S_IRGRP (S_IRUSR>>3)
9745# define S_IWGRP (S_IWUSR>>3)
9746# define S_IXGRP (S_IXUSR>>3)
9747# define S_IROTH (S_IRUSR>>6)
9748# define S_IWOTH (S_IWUSR>>6)
9749# define S_IXOTH (S_IXUSR>>6)
9750#endif
9751#ifndef S_IRWXU
9752# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9753# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9754# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9755#endif
9756END
9757
bd89102f
AD
9758 $cat > try.c <<END
9759#include <sys/types.h>
9760#include <sys/ipc.h>
9761#include <sys/sem.h>
9762#include <sys/stat.h>
9763#include <stdio.h>
9764#include <errno.h>
85ab1d1d 9765#include "try.h"
bd89102f
AD
9766#ifndef errno
9767extern int errno;
9768#endif
9769#$d_union_semun HAS_UNION_SEMUN
9770int main() {
9771 union semun
9772#ifndef HAS_UNION_SEMUN
9773 {
9774 int val;
9775 struct semid_ds *buf;
9776 unsigned short *array;
9777 }
9778#endif
9779 arg;
9780 int sem, st;
9781
9782#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9783 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9784 if (sem > -1) {
9785 struct semid_ds argbuf;
9786 arg.buf = &argbuf;
9787# ifdef IPC_STAT
9788 st = semctl(sem, 0, IPC_STAT, arg);
9789 if (st == 0)
9790 printf("semun\n");
9791 else
9792# endif /* IPC_STAT */
9793 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9794# ifdef IPC_RMID
9795 if (semctl(sem, 0, IPC_RMID, arg) != 0)
9796# endif /* IPC_RMID */
9797 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9798 } else
9799#endif /* IPC_PRIVATE && ... */
9800 printf("semget failed: errno = %d\n", errno);
9801 return 0;
9802}
9803END
9804 val="$undef"
9805 set try
9806 if eval $compile; then
9807 xxx=`./try`
9808 case "$xxx" in
9809 semun) val="$define" ;;
9810 esac
9811 fi
9812 $rm -f try try.c
9813 set d_semctl_semun
9814 eval $setvar
9815 case "$d_semctl_semun" in
9816 $define)
9817 echo "You can use union semun for semctl IPC_STAT." >&4
9818 also='also'
9819 ;;
9820 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
9821 also=''
9822 ;;
9823 esac
9824
9825 : see whether semctl IPC_STAT can use struct semid_ds pointer
9826 $cat > try.c <<'END'
9827#include <sys/types.h>
9828#include <sys/ipc.h>
9829#include <sys/sem.h>
9830#include <sys/stat.h>
85ab1d1d 9831#include "try.h"
bd89102f
AD
9832#include <stdio.h>
9833#include <errno.h>
9834#ifndef errno
9835extern int errno;
9836#endif
9837int main() {
9838 struct semid_ds arg;
9839 int sem, st;
9840
9841#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9842 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9843 if (sem > -1) {
9844# ifdef IPC_STAT
9845 st = semctl(sem, 0, IPC_STAT, &arg);
9846 if (st == 0)
9847 printf("semid_ds\n");
9848 else
9849# endif /* IPC_STAT */
9850 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9851# ifdef IPC_RMID
9852 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9853# endif /* IPC_RMID */
9854 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9855 } else
9856#endif /* IPC_PRIVATE && ... */
9857 printf("semget failed: errno = %d\n", errno);
9858
9859 return 0;
9860}
9861END
9862 val="$undef"
9863 set try
9864 if eval $compile; then
9865 xxx=`./try`
9866 case "$xxx" in
9867 semid_ds) val="$define" ;;
9868 esac
9869 fi
9870 $rm -f try try.c
9871 set d_semctl_semid_ds
9872 eval $setvar
9873 case "$d_semctl_semid_ds" in
9874 $define)
7f3d1cf1 9875 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 9876 ;;
7f3d1cf1 9877 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
9878 ;;
9879 esac
85ab1d1d 9880 $rm -f try.h
bd89102f
AD
9881 ;;
9882*) val="$undef"
9883
9884 # We do not have the full sem*(2) library, so assume we can not
9885 # use either.
9886
9887 set d_semctl_semun
9888 eval $setvar
9889
9890 set d_semctl_semid_ds
9891 eval $setvar
9892 ;;
9893esac
9894
2304df62
AD
9895: see if setegid exists
9896set setegid d_setegid
9897eval $inlibc
9898
9899: see if seteuid exists
9900set seteuid d_seteuid
9901eval $inlibc
9902
5ff3f7a4
GS
9903: see if setgrent exists
9904set setgrent d_setgrent
9905eval $inlibc
9906
693762b4
AD
9907: see if sethostent exists
9908set sethostent d_sethent
9909eval $inlibc
9910
a0d0e21e
LW
9911: see if setlinebuf exists
9912set setlinebuf d_setlinebuf
9913eval $inlibc
9914
2304df62
AD
9915: see if setlocale exists
9916set setlocale d_setlocale
9917eval $inlibc
a0d0e21e 9918
e5c9fcd0
AD
9919: see if setnetent exists
9920set setnetent d_setnent
9921eval $inlibc
9922
9923: see if setprotoent exists
9924set setprotoent d_setpent
9925eval $inlibc
9926
2304df62
AD
9927: see if setpgid exists
9928set setpgid d_setpgid
9929eval $inlibc
9930
2304df62
AD
9931: see if setpgrp2 exists
9932set setpgrp2 d_setpgrp2
9933eval $inlibc
9934
9935: see if setpriority exists
9936set setpriority d_setprior
9937eval $inlibc
9938
5ff3f7a4
GS
9939: see if setpwent exists
9940set setpwent d_setpwent
9941eval $inlibc
9942
2304df62
AD
9943: see if setregid exists
9944set setregid d_setregid
9945eval $inlibc
9946set setresgid d_setresgid
9947eval $inlibc
9948
9949: see if setreuid exists
9950set setreuid d_setreuid
9951eval $inlibc
9952set setresuid d_setresuid
9953eval $inlibc
9954
9955: see if setrgid exists
9956set setrgid d_setrgid
9957eval $inlibc
9958
9959: see if setruid exists
9960set setruid d_setruid
9961eval $inlibc
9962
e5c9fcd0
AD
9963: see if setservent exists
9964set setservent d_setsent
9965eval $inlibc
9966
2304df62
AD
9967: see if setsid exists
9968set setsid d_setsid
9969eval $inlibc
9970
f1066039
JH
9971: see if setspent exists
9972set setspent d_setspent
9973eval $inlibc
9974
e5c9fcd0
AD
9975: see if setvbuf exists
9976set setvbuf d_setvbuf
9977eval $inlibc
9978
760ac839
LW
9979: see if sfio.h is available
9980set sfio.h i_sfio
9981eval $inhdr
9982
9983
8ff267be 9984: see if sfio library is available
760ac839
LW
9985case "$i_sfio" in
9986$define)
9987 val=''
9988 set sfreserve val
9989 eval $inlibc
9990 ;;
9991*)
9992 val="$undef"
9993 ;;
9994esac
8ff267be 9995: Ok, but do we want to use it.
760ac839
LW
9996case "$val" in
9997$define)
9998 case "$usesfio" in
8ff267be 9999 true|$define|[yY]*) dflt='y';;
760ac839
LW
10000 *) dflt='n';;
10001 esac
8ff267be 10002 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
10003 rp="You seem to have sfio available, do you want to try using it?"
10004 . ./myread
10005 case "$ans" in
8ff267be 10006 y|Y) ;;
10007 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 10008 val="$undef"
ff0cee69 10009 : Remove sfio from list of libraries to use
10010 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10011 shift
10012 libs="$*"
10013 echo "libs = $libs" >&4
760ac839
LW
10014 ;;
10015 esac
10016 ;;
8ff267be 10017*) case "$usesfio" in
10018 true|$define|[yY]*)
10019 echo "Sorry, cannot find sfio on this machine" >&4
10020 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
10021 ;;
10022 esac
10023 ;;
10024esac
8ff267be 10025set d_sfio
10026eval $setvar
760ac839
LW
10027case "$d_sfio" in
10028$define) usesfio='true';;
10029*) usesfio='false';;
10030esac
10031
2304df62
AD
10032: see if shmctl exists
10033set shmctl d_shmctl
10034eval $inlibc
10035
10036: see if shmget exists
10037set shmget d_shmget
10038eval $inlibc
10039
a0d0e21e
LW
10040: see if shmat exists
10041set shmat d_shmat
10042eval $inlibc
10043: see what shmat returns
10044case "$d_shmat" in
10045"$define")
10046 $cat >shmat.c <<'END'
10047#include <sys/shm.h>
10048void *shmat();
10049END
10050 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10051 shmattype='void *'
10052 else
10053 shmattype='char *'
10054 fi
10055 echo "and it returns ($shmattype)." >&4
10056 : see if a prototype for shmat is available
e50aee73
AD
10057 xxx=`./findhdr sys/shm.h`
10058 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
10059 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10060 val="$define"
10061 else
10062 val="$undef"
10063 fi
10064 $rm -f shmat.[co]
10065 ;;
10066*)
10067 val="$undef"
10068 ;;
10069esac
10070set d_shmatprototype
10071eval $setvar
10072
10073: see if shmdt exists
10074set shmdt d_shmdt
10075eval $inlibc
10076
10077: see how much of the 'shm*(2)' library is present.
10078h_shm=true
10079echo " "
10080case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10081*"$undef"*) h_shm=false;;
10082esac
6087ac44
JH
10083case "$osname" in
10084freebsd)
10085 case "`ipcs 2>&1`" in
10086 "SVID shared memory"*"not configured"*)
5ff3f7a4 10087 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
10088 h_shm=false
10089 val="$undef"
10090 set shmctl d_shmctl
10091 evat $setvar
10092 set shmget d_shmget
10093 evat $setvar
10094 set shmat d_shmat
10095 evat $setvar
10096 set shmdt d_shmdt
10097 evat $setvar
10098 ;;
10099 esac
10100 ;;
10101esac
a0d0e21e
LW
10102: we could also check for sys/ipc.h ...
10103if $h_shm && $test `./findhdr sys/shm.h`; then
10104 echo "You have the full shm*(2) library." >&4
10105 val="$define"
10106else
10107 echo "You don't have the full shm*(2) library." >&4
10108 val="$undef"
10109fi
10110set d_shm
10111eval $setvar
10112
2c7991dc 10113echo " "
8ff267be 10114: see if we have sigaction
10115if set sigaction val -f d_sigaction; eval $csym; $val; then
10116 echo 'sigaction() found.' >&4
dc45a647 10117 $cat > try.c <<'EOP'
8ff267be 10118#include <stdio.h>
10119#include <sys/types.h>
10120#include <signal.h>
d674cd6d 10121int main()
8ff267be 10122{
10123 struct sigaction act, oact;
10124}
10125EOP
dc45a647
MB
10126 set try
10127 if eval $compile_ok; then
10128 val="$define"
10129 else
10130 echo "But you don't seem to have a useable struct sigaction." >&4
10131 val="$undef"
10132 fi
8ff267be 10133else
dc45a647 10134 echo 'sigaction NOT found.' >&4
8ff267be 10135 val="$undef"
10136fi
10137set d_sigaction; eval $setvar
dfe9444c 10138$rm -f try try$_o try.c
2c7991dc 10139
a5f75d66
AD
10140: see if sigsetjmp exists
10141echo " "
921b2963
JH
10142case "$d_sigsetjmp" in
10143'')
10144 $cat >try.c <<'EOP'
10145#include <setjmp.h>
10146sigjmp_buf env;
10147int set = 1;
d674cd6d 10148int main()
921b2963
JH
10149{
10150 if (sigsetjmp(env,1))
10151 exit(set);
10152 set = 0;
10153 siglongjmp(env, 1);
10154 exit(1);
10155}
10156EOP
10157 set try
10158 if eval $compile; then
10159 if ./try >/dev/null 2>&1; then
10160 echo "POSIX sigsetjmp found." >&4
10161 val="$define"
10162 else
10163 $cat >&4 <<EOM
10164Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10165I'll ignore them.
10166EOM
10167 val="$undef"
a0d0e21e 10168 fi
921b2963
JH
10169 else
10170 echo "sigsetjmp not found." >&4
10171 val="$undef"
a0d0e21e 10172 fi
921b2963
JH
10173 ;;
10174*) val="$d_sigsetjmp"
10175 case "$d_sigsetjmp" in
10176 $define) echo "POSIX sigsetjmp found." >&4;;
10177 $undef) echo "sigsetjmp not found." >&4;;
10178 esac
10179 ;;
10180esac
10181set d_sigsetjmp
10182eval $setvar
10183$rm -f try.c try
2304df62 10184
d9b3e12d
JH
10185: see if sys/stat.h is available
10186set sys/stat.h i_sysstat
10187eval $inhdr
10188
2304df62
AD
10189: see if stat knows about block sizes
10190echo " "
5ff3f7a4
GS
10191set d_statblks stat st_blocks $i_sysstat sys/stat.h
10192eval $hasfield
2304df62 10193
16d20bd9
AD
10194: see if _ptr and _cnt from stdio act std
10195echo " "
dca663ed 10196if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
10197 echo "(Looks like you have stdio.h from Linux.)"
10198 case "$stdio_ptr" in
c2960299
AD
10199 '') stdio_ptr='((fp)->_IO_read_ptr)'
10200 ptr_lval=$define
10201 ;;
8e07c86e 10202 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10203 esac
10204 case "$stdio_cnt" in
c2960299
AD
10205 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10206 cnt_lval=$undef
10207 ;;
8e07c86e 10208 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10209 esac
10210 case "$stdio_base" in
10211 '') stdio_base='((fp)->_IO_read_base)';;
10212 esac
10213 case "$stdio_bufsiz" in
c2960299 10214 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
10215 esac
10216else
10217 case "$stdio_ptr" in
c2960299
AD
10218 '') stdio_ptr='((fp)->_ptr)'
10219 ptr_lval=$define
10220 ;;
8e07c86e 10221 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10222 esac
10223 case "$stdio_cnt" in
c2960299
AD
10224 '') stdio_cnt='((fp)->_cnt)'
10225 cnt_lval=$define
10226 ;;
8e07c86e 10227 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10228 esac
10229 case "$stdio_base" in
10230 '') stdio_base='((fp)->_base)';;
10231 esac
10232 case "$stdio_bufsiz" in
10233 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10234 esac
10235fi
10236: test whether _ptr and _cnt really work
10237echo "Checking how std your stdio is..." >&4
10238$cat >try.c <<EOP
10239#include <stdio.h>
10240#define FILE_ptr(fp) $stdio_ptr
10241#define FILE_cnt(fp) $stdio_cnt
d674cd6d 10242int main() {
16d20bd9
AD
10243 FILE *fp = fopen("try.c", "r");
10244 char c = getc(fp);
10245 if (
10246 18 <= FILE_cnt(fp) &&
10247 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10248 )
10249 exit(0);
10250 exit(1);
10251}
10252EOP
10253val="$undef"
dfe9444c
AD
10254set try
10255if eval $compile; then
16d20bd9
AD
10256 if ./try; then
10257 echo "Your stdio acts pretty std."
10258 val="$define"
10259 else
10260 echo "Your stdio isn't very std."
10261 fi
10262else
10263 echo "Your stdio doesn't appear very std."
10264fi
10265$rm -f try.c try
10266set d_stdstdio
10267eval $setvar
10268
8e07c86e 10269: Can _ptr be used as an lvalue?
e50aee73
AD
10270case "$d_stdstdio$ptr_lval" in
10271$define$define) val=$define ;;
c2960299
AD
10272*) val=$undef ;;
10273esac
10274set d_stdio_ptr_lval
10275eval $setvar
10276
8e07c86e 10277: Can _cnt be used as an lvalue?
e50aee73
AD
10278case "$d_stdstdio$cnt_lval" in
10279$define$define) val=$define ;;
c2960299
AD
10280*) val=$undef ;;
10281esac
10282set d_stdio_cnt_lval
10283eval $setvar
10284
16d20bd9
AD
10285: see if _base is also standard
10286val="$undef"
10287case "$d_stdstdio" in
10288$define)
10289 $cat >try.c <<EOP
10290#include <stdio.h>
10291#define FILE_base(fp) $stdio_base
10292#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 10293int main() {
16d20bd9
AD
10294 FILE *fp = fopen("try.c", "r");
10295 char c = getc(fp);
10296 if (
10297 19 <= FILE_bufsiz(fp) &&
10298 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10299 )
10300 exit(0);
10301 exit(1);
10302}
10303EOP
dfe9444c
AD
10304 set try
10305 if eval $compile; then
16d20bd9 10306 if ./try; then
8ff267be 10307 echo "And its _base field acts std."
16d20bd9
AD
10308 val="$define"
10309 else
10310 echo "But its _base field isn't std."
10311 fi
10312 else
10313 echo "However, it seems to be lacking the _base field."
10314 fi
10315 $rm -f try.c try
10316 ;;
10317esac
10318set d_stdiobase
10319eval $setvar
10320
ed39a0f2
JH
10321$cat >&4 <<EOM
10322Checking how to access stdio streams by file descriptor number...
10323EOM
10324case "$stdio_stream_array" in
10325'') $cat >try.c <<EOCP
10326#include <stdio.h>
10327int main() {
10328 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10329 printf("yes\n");
10330}
10331EOCP
10332 for s in _iob __iob __sF
10333 do
10334 set try -DSTDIO_STREAM_ARRAY=$s
10335 if eval $compile; then
10336 case "`./try$exe_ext`" in
10337 yes) stdio_stream_array=$s; break ;;
10338 esac
10339 fi
10340 done
10341 $rm -f try.* try$exe_ext
10342esac
10343case "$stdio_stream_array" in
10344'') $cat >&4 <<EOM
10345I can't figure out how to access stdio streams by file descriptor number.
10346EOM
10347 d_stdio_stream_array="$undef"
10348 ;;
10349*) $cat >&4 <<EOM
10350You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10351EOM
10352 d_stdio_stream_array="$define"
10353 ;;
10354esac
10355
a0d0e21e
LW
10356: see if strcoll exists
10357set strcoll d_strcoll
10358eval $inlibc
2304df62
AD
10359
10360: check for structure copying
10361echo " "
10362echo "Checking to see if your C compiler can copy structs..." >&4
10363$cat >try.c <<'EOCP'
5a411a32 10364int main()
2304df62
AD
10365{
10366 struct blurfl {
10367 int dyick;
10368 } foo, bar;
10369
10370 foo = bar;
10371}
10372EOCP
10373if $cc -c try.c >/dev/null 2>&1 ; then
10374 val="$define"
10375 echo "Yup, it can."
10376else
10377 val="$undef"
10378 echo "Nope, it can't."
10379fi
10380set d_strctcpy
10381eval $setvar
10382$rm -f try.*
10383
10384: see if strerror and/or sys_errlist[] exist
10385echo " "
28e8609d
JH
10386if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10387 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
10388 echo 'strerror() found.' >&4
10389 d_strerror="$define"
10390 d_strerrm='strerror(e)'
10391 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10392 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
10393 d_syserrlst="$define"
10394 else
10395 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10396 d_syserrlst="$undef"
10397 fi
28e8609d 10398 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
10399 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10400 echo 'strerror() found in string header.' >&4
10401 d_strerror="$define"
10402 d_strerrm='strerror(e)'
10403 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10404 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10405 d_syserrlst="$define"
10406 else
10407 echo "(You don't appear to have any sys_errlist[], how can this be?)"
10408 d_syserrlst="$undef"
10409 fi
28e8609d 10410 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
10411 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10412 d_strerror="$undef"
10413 d_syserrlst="$define"
10414 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 10415 else
5ff3f7a4
GS
10416 echo 'strerror() and sys_errlist[] NOT found.' >&4
10417 d_strerror="$undef"
10418 d_syserrlst="$undef"
10419 d_strerrm='"unknown"'
28e8609d 10420 fi
2304df62
AD
10421fi
10422
a89d8a78
DH
10423: see if strtod exists
10424set strtod d_strtod
10425eval $inlibc
10426
10427: see if strtol exists
10428set strtol d_strtol
10429eval $inlibc
10430
10431: see if strtoul exists
10432set strtoul d_strtoul
10433eval $inlibc
10434
cf2093f6
JH
10435: see if strtoull exists
10436set strtoull d_strtoull
10437eval $inlibc
10438
a0d0e21e
LW
10439: see if strxfrm exists
10440set strxfrm d_strxfrm
10441eval $inlibc
10442
2304df62
AD
10443: see if symlink exists
10444set symlink d_symlink
10445eval $inlibc
10446
10447: see if syscall exists
10448set syscall d_syscall
10449eval $inlibc
10450
a0d0e21e
LW
10451: see if sysconf exists
10452set sysconf d_sysconf
10453eval $inlibc
10454
2304df62
AD
10455: see if system exists
10456set system d_system
10457eval $inlibc
10458
a0d0e21e
LW
10459: see if tcgetpgrp exists
10460set tcgetpgrp d_tcgetpgrp
10461eval $inlibc
10462
2c7991dc 10463: see if tcsetpgrp exists
10464set tcsetpgrp d_tcsetpgrp
10465eval $inlibc
4633a7c4 10466
cb86ce0e
JH
10467: see if sys/types.h has to be included
10468set sys/types.h i_systypes
10469eval $inhdr
10470
10471: see if prototype for telldir is available
10472echo " "
10473set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10474eval $hasproto
10475
2c7991dc 10476: define an is-a-typedef? function
10477typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10478case "$inclist" in
10479"") inclist="sys/types.h";;
10480esac;
10481eval "varval=\$$var";
10482case "$varval" in
10483"")
10484 $rm -f temp.c;
10485 for inc in $inclist; do
10486 echo "#include <$inc>" >>temp.c;
10487 done;
c4f23d77
AD
10488 echo "#ifdef $type" >> temp.c;
10489 echo "printf(\"We have $type\");" >> temp.c;
10490 echo "#endif" >> temp.c;
2c7991dc 10491 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10492 if $contains $type temp.E >/dev/null 2>&1; then
10493 eval "$var=\$type";
10494 else
10495 eval "$var=\$def";
10496 fi;
10497 $rm -f temp.?;;
10498*) eval "$var=\$varval";;
10499esac'
4633a7c4 10500
dc45a647
MB
10501: define an is-a-typedef? function that prompts if the type is not available.
10502typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10503case "$inclist" in
10504"") inclist="sys/types.h";;
10505esac;
10506eval "varval=\$$var";
10507case "$varval" in
10508"")
10509 $rm -f temp.c;
10510 for inc in $inclist; do
10511 echo "#include <$inc>" >>temp.c;
10512 done;
c4f23d77
AD
10513 echo "#ifdef $type" >> temp.c;
10514 echo "printf(\"We have $type\");" >> temp.c;
10515 echo "#endif" >> temp.c;
dc45a647
MB
10516 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10517 echo " " ;
10518 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10519 if $contains $type temp.E >/dev/null 2>&1; then
10520 echo "$type found." >&4;
10521 eval "$var=\$type";
10522 else
10523 echo "$type NOT found." >&4;
10524 dflt="$def";
10525 . ./myread ;
10526 eval "$var=\$ans";
10527 fi;
10528 $rm -f temp.?;;
10529*) eval "$var=\$varval";;
10530esac'
10531
2c7991dc 10532: see if this is a sys/times.h system
10533set sys/times.h i_systimes
10534eval $inhdr
4633a7c4 10535
2c7991dc 10536: see if times exists
4633a7c4 10537echo " "
2c7991dc 10538if set times val -f d_times; eval $csym; $val; then
10539 echo 'times() found.' >&4
10540 d_times="$define"
10541 inc=''
10542 case "$i_systimes" in
10543 "$define") inc='sys/times.h';;
10544 esac
dc45a647 10545 rp="What is the type returned by times() on this system?"
2c7991dc 10546 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 10547 eval $typedef_ask
2c7991dc 10548else
10549 echo 'times() NOT found, hope that will do.' >&4
10550 d_times="$undef"
10551 clocktype='int'
10552fi
2304df62 10553
2c7991dc 10554: see if truncate exists
10555set truncate d_truncate
10556eval $inlibc
2304df62 10557
2c7991dc 10558: see if tzname[] exists
10559echo " "
10560if set tzname val -a d_tzname; eval $csym; $val; then
10561 val="$define"
10562 echo 'tzname[] found.' >&4
10563else
10564 val="$undef"
10565 echo 'tzname[] NOT found.' >&4
10566fi
10567set d_tzname
10568eval $setvar
10569
10570: see if umask exists
10571set umask d_umask
10572eval $inlibc
85e6fe83 10573
4633a7c4
LW
10574: backward compatibility for d_hvfork
10575if test X$d_hvfork != X; then
10576 d_vfork="$d_hvfork"
10577 d_hvfork=''
10578fi
10579: see if there is a vfork
10580val=''
10581set vfork val
10582eval $inlibc
ecfc5424 10583
4633a7c4
LW
10584: Ok, but do we want to use it. vfork is reportedly unreliable in
10585: perl on Solaris 2.x, and probably elsewhere.
10586case "$val" in
10587$define)
16d20bd9 10588 echo " "
4633a7c4
LW
10589 case "$usevfork" in
10590 false) dflt='n';;
10591 *) dflt='y';;
10592 esac
f10488a3
JH
10593 cat <<'EOM'
10594
10595Perl can only use a vfork() that doesn't suffer from strict
10596restrictions on calling functions or modifying global data in
10597the child. For example, glibc-2.1 contains such a vfork()
10598that is unsuitable. If your system provides a proper fork()
10599call, chances are that you do NOT want perl to use vfork().
10600
10601EOM
10602 rp="Do you still want to use vfork()?"
4633a7c4
LW
10603 . ./myread
10604 case "$ans" in
10605 y|Y) ;;
10606 *)
10607 echo "Ok, we won't use vfork()."
10608 val="$undef"
10609 ;;
10610 esac
ecfc5424
AD
10611 ;;
10612esac
4633a7c4
LW
10613set d_vfork
10614eval $setvar
10615case "$d_vfork" in
10616$define) usevfork='true';;
10617*) usevfork='false';;
10618esac
ecfc5424 10619
4633a7c4
LW
10620: see if this is an sysdir system
10621set sys/dir.h i_sysdir
10622eval $inhdr
10623
10624: see if this is an sysndir system
10625set sys/ndir.h i_sysndir
10626eval $inhdr
10627
10628: see if closedir exists
10629set closedir d_closedir
10630eval $inlibc
10631
10632case "$d_closedir" in
10633"$define")
16d20bd9 10634 echo " "
4633a7c4
LW
10635 echo "Checking whether closedir() returns a status..." >&4
10636 cat > closedir.c <<EOM
10637#$i_dirent I_DIRENT /**/
10638#$i_sysdir I_SYS_DIR /**/
10639#$i_sysndir I_SYS_NDIR /**/
bfb7748a 10640#$i_systypes I_SYS_TYPES /**/
4633a7c4 10641
bfb7748a
AD
10642#if defined(I_SYS_TYPES)
10643#include <sys/types.h>
10644#endif
4633a7c4
LW
10645#if defined(I_DIRENT)
10646#include <dirent.h>
10647#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10648#include <sys/dir.h>
4aa0a1f7 10649#endif
4633a7c4
LW
10650#else
10651#ifdef I_SYS_NDIR
10652#include <sys/ndir.h>
10653#else
10654#ifdef I_SYS_DIR
10655#ifdef hp9000s500
10656#include <ndir.h> /* may be wrong in the future */
10657#else
10658#include <sys/dir.h>
10659#endif
10660#endif
10661#endif
10662#endif
10663int main() { return closedir(opendir(".")); }
10664EOM
dfe9444c 10665 set closedir
dc45a647 10666 if eval $compile_ok; then
4633a7c4
LW
10667 if ./closedir > /dev/null 2>&1 ; then
10668 echo "Yes, it does."
10669 val="$undef"
ecfc5424 10670 else
4633a7c4
LW
10671 echo "No, it doesn't."
10672 val="$define"
ecfc5424
AD
10673 fi
10674 else
4633a7c4
LW
10675 echo "(I can't seem to compile the test program--assuming it doesn't)"
10676 val="$define"
ecfc5424 10677 fi
ecfc5424 10678 ;;
4633a7c4
LW
10679*)
10680 val="$undef";
ecfc5424
AD
10681 ;;
10682esac
4633a7c4
LW
10683set d_void_closedir
10684eval $setvar
10685$rm -f closedir*
10686: check for volatile keyword
ecfc5424 10687echo " "
4633a7c4
LW
10688echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10689$cat >try.c <<'EOCP'
5a411a32 10690int main()
4633a7c4
LW
10691{
10692 typedef struct _goo_struct goo_struct;
10693 goo_struct * volatile goo = ((goo_struct *)0);
10694 struct _goo_struct {
10695 long long_int;
10696 int reg_int;
10697 char char_var;
10698 };
10699 typedef unsigned short foo_t;
10700 char *volatile foo;
10701 volatile int bar;
10702 volatile foo_t blech;
10703 foo = foo;
a0d0e21e
LW
10704}
10705EOCP
4633a7c4
LW
10706if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10707 val="$define"
10708 echo "Yup, it does."
10709else
10710 val="$undef"
10711 echo "Nope, it doesn't."
10712fi
10713set d_volatile
10714eval $setvar
10715$rm -f try.*
a0d0e21e 10716
4633a7c4
LW
10717: see if there is a wait4
10718set wait4 d_wait4
8e07c86e
AD
10719eval $inlibc
10720
4633a7c4
LW
10721: see if waitpid exists
10722set waitpid d_waitpid
10723eval $inlibc
10724
10725: see if wcstombs exists
10726set wcstombs d_wcstombs
10727eval $inlibc
10728
10729: see if wctomb exists
10730set wctomb d_wctomb
10731eval $inlibc
10732
de4597cb
JH
10733: see if writev exists
10734set writev d_writev
10735eval $inlibc
10736
4633a7c4
LW
10737: preserve RCS keywords in files with variable substitution, grrr
10738Date='$Date'
10739Id='$Id'
10740Log='$Log'
10741RCSfile='$RCSfile'
10742Revision='$Revision'
10743
ca8cfa54
JH
10744case "$crosscompile" in
10745''|[nN]*) crosscompile="$undef" ;;
10746esac
10747
10748case "$osname" in
8f1f23e8 10749next|rhapsody) multiarch="$define" ;;
ca8cfa54
JH
10750esac
10751case "$multiarch" in
10752''|[nN]*) multiarch="$undef" ;;
10753esac
10754
4633a7c4
LW
10755: check for alignment requirements
10756echo " "
68c15b6f
HM
10757case "$crosscompile$multiarch" in
10758*$define*)
ca8cfa54
JH
10759 $cat <<EOM
10760You seem to be either cross-compiling or doing a multiarchitecture build,
10761skipping the memory alignment check.
68c15b6f
HM
10762
10763EOM
10764 case "$alignbytes" in
10765 '') alignbytes=8 ;;
10766 esac
10767 ;;
10768*)
10769 case "$alignbytes" in
10770 '') echo "Checking alignment constraints..." >&4
10771 $cat >try.c <<'EOCP'
4633a7c4
LW
10772struct foobar {
10773 char foo;
10774 double bar;
732c9516 10775} try_algn;
d674cd6d 10776int main()
4633a7c4 10777{
732c9516 10778 printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
4633a7c4
LW
10779}
10780EOCP
68c15b6f
HM
10781 set try
10782 if eval $compile_ok; then
10783 dflt=`./try`
10784 else
10785 dflt='8'
10786 echo "(I can't seem to compile the test program...)"
10787 fi
10788 ;;
10789 *) dflt="$alignbytes"
10790 ;;
10791 esac
10792 rp="Doubles must be aligned on a how-many-byte boundary?"
10793 . ./myread
10794 alignbytes="$ans"
10795 $rm -f try.c try
8e07c86e 10796 ;;
ecfc5424 10797esac
68c15b6f 10798
85e6fe83 10799
4633a7c4 10800: check for ordering of bytes in a long
68c15b6f
HM
10801echo " "
10802case "$crosscompile$multiarch" in
10803*$define*)
10804 $cat <<EOM
ca8cfa54
JH
10805You seem to be either cross-compiling or doing a multiarchitecture build,
10806skipping the byteorder check.
68c15b6f
HM
10807
10808EOM
d9b3e12d 10809 byteorder='0xffff'
68c15b6f
HM
10810 ;;
10811*)
10812 case "$byteorder" in
10813 '')
10814 $cat <<'EOM'
4633a7c4
LW
10815In the following, larger digits indicate more significance. A big-endian
10816machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10817little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
d9b3e12d
JH
10818machines may have weird orders like 3412. A Cray will report 87654321,
10819an Alpha will report 12345678. If the test program works the default is
10820probably right.
4633a7c4
LW
10821I'm now running the test program...
10822EOM
68c15b6f 10823 $cat >try.c <<'EOCP'
4633a7c4 10824#include <stdio.h>
d674cd6d 10825int main()
4633a7c4
LW
10826{
10827 int i;
10828 union {
10829 unsigned long l;
10830 char c[sizeof(long)];
10831 } u;
10832
10833 if (sizeof(long) > 4)
10834 u.l = (0x08070605L << 32) | 0x04030201L;
10835 else
10836 u.l = 0x04030201L;
10837 for (i = 0; i < sizeof(long); i++)
10838 printf("%c", u.c[i]+'0');
10839 printf("\n");
10840 exit(0);
10841}
10842EOCP
68c15b6f
HM
10843 xxx_prompt=y
10844 set try
10845 if eval $compile && ./try > /dev/null; then
10846 dflt=`./try`
10847 case "$dflt" in
10848 [1-4][1-4][1-4][1-4]|12345678|87654321)
10849 echo "(The test program ran ok.)"
10850 echo "byteorder=$dflt"
10851 xxx_prompt=n
4633a7c4 10852 ;;
68c15b6f
HM
10853 ????|????????) echo "(The test program ran ok.)" ;;
10854 *) echo "(The test program didn't run right for some reason.)" ;;
10855 esac
10856 else
10857 dflt='4321'
10858 cat <<'EOM'
4633a7c4
LW
10859(I can't seem to compile the test program. Guessing big-endian...)
10860EOM
68c15b6f
HM
10861 fi
10862 case "$xxx_prompt" in
10863 y)
10864 rp="What is the order of bytes in a long?"
10865 . ./myread
10866 byteorder="$ans"
10867 ;;
10868 *) byteorder=$dflt
10869 ;;
10870 esac
ecfc5424
AD
10871 ;;
10872 esac
68c15b6f 10873 $rm -f try.c try
ecfc5424
AD
10874 ;;
10875esac
68c15b6f 10876
85e6fe83 10877
4633a7c4 10878: how do we catenate cpp tokens here?
2304df62 10879echo " "
4633a7c4
LW
10880echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10881$cat >cpp_stuff.c <<'EOCP'
10882#define RCAT(a,b)a/**/b
10883#define ACAT(a,b)a ## b
10884RCAT(Rei,ser)
10885ACAT(Cir,cus)
10886EOCP
10887$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10888if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10889 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
10890 echo "We can catify or stringify, separately or together!"
10891 cpp_stuff=42
10892elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10893 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
10894 echo "However, in the good old days we don't know how to stringify and"
10895 echo "catify at the same time."
10896 cpp_stuff=1
10897else
10898 $cat >&4 <<EOM
10899Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
10900to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 10901EOM
4633a7c4
LW
10902 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10903fi
10904$rm -f cpp_stuff.*
a0d0e21e 10905
4633a7c4
LW
10906: see if this is a db.h system
10907set db.h i_db
10908eval $inhdr
10909
10910case "$i_db" in
68dc0745 10911$define)
1f70e1ea 10912 : Check db version.
68dc0745 10913 echo " "
10914 echo "Checking Berkeley DB version ..." >&4
10915 $cat >try.c <<EOCP
10916#$d_const HASCONST
10917#ifndef HASCONST
10918#define const
10919#endif
10920#include <sys/types.h>
10921#include <stdio.h>
10922#include <db.h>
d674cd6d 10923int main()
68dc0745 10924{
1f70e1ea
PM
10925#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10926 int Major, Minor, Patch ;
ee02776e 10927 unsigned long Version ;
1f70e1ea
PM
10928 (void)db_version(&Major, &Minor, &Patch) ;
10929 printf("You have Berkeley DB Version 2 or greater\n");
10930
10931 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10932 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10933 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10934 Major, Minor, Patch) ;
10935
10936 /* check that db.h & libdb are compatible */
10937 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10938 printf("db.h and libdb are incompatible\n") ;
10939 exit(3);
10940 }
10941
10942 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
10943
10944 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 10945 + DB_VERSION_PATCH ;
ee02776e
PM
10946
10947 /* needs to be >= 2.3.4 */
10948 if (Version < 2003004) {
693762b4 10949 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 10950 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
10951 exit(2);
10952 }
10953
10954 exit(0);
68dc0745 10955#else
6a1b87e5 10956#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 10957 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
10958 exit(0); /* DB version < 2: the coast is clear. */
10959#else
10960 exit(1); /* <db.h> not Berkeley DB? */
10961#endif
68dc0745 10962#endif
10963}
10964EOCP
dfe9444c
AD
10965 set try
10966 if eval $compile && ./try; then
1f70e1ea 10967 echo 'Looks OK.' >&4
68dc0745 10968 else
c90c0ff4 10969 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 10970 i_db=$undef
10971 case " $libs " in
10972 *"-ldb "*)
10973 : Remove db from list of libraries to use
10974 echo "Removing unusable -ldb from library list" >&4
10975 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10976 shift
10977 libs="$*"
10978 echo "libs = $libs" >&4
10979 ;;
10980 esac
10981 fi
10982 $rm -f try.*
10983 ;;
10984esac
10985
10986case "$i_db" in
4633a7c4 10987define)
dc45a647
MB
10988 : Check the return type needed for hash
10989 echo " "
10990 echo "Checking return type needed for hash for Berkeley DB ..." >&4
10991 $cat >try.c <<EOCP
10992#$d_const HASCONST
10993#ifndef HASCONST
10994#define const
10995#endif
10996#include <sys/types.h>
10997#include <db.h>
10998
10999#ifndef DB_VERSION_MAJOR
11000u_int32_t hash_cb (ptr, size)
11001const void *ptr;
11002size_t size;
11003{
11004}
11005HASHINFO info;
d674cd6d 11006int main()
dc45a647
MB
11007{
11008 info.hash = hash_cb;
11009}
11010#endif
11011EOCP
11012 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11013 if $contains warning try.out >>/dev/null 2>&1 ; then
11014 db_hashtype='int'
11015 else
11016 db_hashtype='u_int32_t'
11017 fi
11018 else
11019 : XXX Maybe we should just give up here.
11020 db_hashtype=u_int32_t
11021 $cat try.out >&4
11022 echo "Help: I can't seem to compile the db test program." >&4
11023 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11024 fi
11025 $rm -f try.*
11026 echo "Your version of Berkeley DB uses $db_hashtype for hash."
11027 ;;
11028*) db_hashtype=u_int32_t
11029 ;;
11030esac
11031case "$i_db" in
11032define)
4633a7c4
LW
11033 : Check the return type needed for prefix
11034 echo " "
11035 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11036 cat >try.c <<EOCP
11037#$d_const HASCONST
11038#ifndef HASCONST
11039#define const
11040#endif
11041#include <sys/types.h>
11042#include <db.h>
1f70e1ea
PM
11043
11044#ifndef DB_VERSION_MAJOR
4633a7c4
LW
11045size_t prefix_cb (key1, key2)
11046const DBT *key1;
11047const DBT *key2;
11048{
11049}
11050BTREEINFO info;
d674cd6d 11051int main()
4633a7c4
LW
11052{
11053 info.prefix = prefix_cb;
11054}
1f70e1ea 11055#endif
4633a7c4
LW
11056EOCP
11057 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11058 if $contains warning try.out >>/dev/null 2>&1 ; then
11059 db_prefixtype='int'
11060 else
11061 db_prefixtype='size_t'
11062 fi
11063 else
68dc0745 11064 db_prefixtype='size_t'
11065 : XXX Maybe we should just give up here.
dc45a647 11066 $cat try.out >&4
68dc0745 11067 echo "Help: I can't seem to compile the db test program." >&4
11068 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
11069 fi
11070 $rm -f try.*
11071 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 11072 ;;
68dc0745 11073*) db_prefixtype='size_t'
4633a7c4
LW
11074 ;;
11075esac
a0d0e21e 11076
4633a7c4
LW
11077: check for void type
11078echo " "
11079echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
11080case "$voidflags" in
11081'')
11082 $cat >try.c <<'EOCP'
11083#if TRY & 1
760ac839 11084void sub() {
4633a7c4 11085#else
760ac839 11086sub() {
4633a7c4
LW
11087#endif
11088 extern void moo(); /* function returning void */
11089 void (*goo)(); /* ptr to func returning void */
11090#if TRY & 8
11091 void *hue; /* generic ptr */
11092#endif
11093#if TRY & 2
11094 void (*foo[10])();
11095#endif
a0d0e21e 11096
4633a7c4
LW
11097#if TRY & 4
11098 if(goo == moo) {
11099 exit(0);
11100 }
11101#endif
11102 exit(0);
11103}
d674cd6d 11104int main() { sub(); }
4633a7c4 11105EOCP
760ac839 11106 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 11107 voidflags=$defvoidused
bfb7748a 11108 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
11109 if $contains warning .out >/dev/null 2>&1; then
11110 echo "However, you might get some warnings that look like this:"
11111 $cat .out
11112 fi
11113 else
11114echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 11115 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 11116 echo "It supports 1..."
760ac839 11117 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 11118 echo "It also supports 2..."
760ac839 11119 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
11120 voidflags=7
11121 echo "And it supports 4 but not 8 definitely."
11122 else
11123 echo "It doesn't support 4..."
760ac839 11124 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
11125 voidflags=11
11126 echo "But it supports 8."
11127 else
11128 voidflags=3
11129 echo "Neither does it support 8."
11130 fi
11131 fi
11132 else
11133 echo "It does not support 2..."
760ac839 11134 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
11135 voidflags=13
11136 echo "But it supports 4 and 8."
11137 else
760ac839 11138 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
11139 voidflags=5
11140 echo "And it supports 4 but has not heard about 8."
11141 else
11142 echo "However it supports 8 but not 4."
11143 fi
11144 fi
11145 fi
11146 else
11147 echo "There is no support at all for void."
11148 voidflags=0
11149 fi
11150 fi
11151esac
4633a7c4 11152case "$voidflags" in
2c7991dc 11153"$defvoidused") ;;
bfb7748a
AD
11154*) $cat >&4 <<'EOM'
11155 Support flag bits are:
11156 1: basic void declarations.
11157 2: arrays of pointers to functions returning void.
11158 4: operations between pointers to and addresses of void functions.
11159 8: generic void pointers.
11160EOM
2c7991dc 11161 dflt="$voidflags";
4633a7c4 11162 rp="Your void support flags add up to what?"
a0d0e21e 11163 . ./myread
4633a7c4 11164 voidflags="$ans"
a0d0e21e
LW
11165 ;;
11166esac
4633a7c4 11167$rm -f try.* .out
a0d0e21e 11168
85ab1d1d
JH
11169
11170: How can we generate normalized random numbers ?
693762b4 11171echo " "
de4597cb 11172echo "Looking for a random number function..." >&4
85ab1d1d 11173case "$randfunc" in
693762b4 11174'')
85ab1d1d
JH
11175 if set drand48 val -f; eval $csym; $val; then
11176 dflt="drand48"
11177 echo "Good, found drand48()." >&4
11178 elif set random val -f; eval $csym; $val; then
11179 dflt="random"
11180 echo "OK, found random()." >&4
11181 else
11182 dflt="rand"
11183 echo "Yick, looks like I have to use rand()." >&4
11184 fi
11185 echo " "
11186 ;;
11187*)
11188 dflt="$randfunc"
11189 ;;
11190esac
11191cont=true
11192
11193case "$ccflags" in
11194*-Dmy_rand=*|*-Dmy_srand=*)
11195 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11196 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11197 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11198 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11199 ;;
11200esac
11201
11202while $test "$cont"; do
11203 rp="Use which function to generate random numbers?"
11204 . ./myread
11205 if $test "$ans" = "$dflt"; then
11206 : null
11207 else
11208 randbits=''
11209 fi
11210 randfunc="$ans"
11211 if set $ans val -f; eval $csym; $val; then
11212 cont=''
11213 else
ef4af2be
JH
11214 dflt=y
11215 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
11216 . ./myread
11217 dflt=rand
11218 case "$ans" in
11219 [yY]*) cont='';;
11220 esac
11221 fi
11222 case "$cont" in
11223 '')
11224 case "$randfunc" in
11225 drand48)
11226 drand01="drand48()"
11227 seedfunc="srand48"
11228 randbits=48
11229 randseedtype=long
11230 ;;
11231 rand|random)
11232 case "$randbits" in
11233 '')
11234echo "Checking to see how many bits your $randfunc() function produces..." >&4
11235 $cat >try.c <<EOCP
11236#$i_unistd I_UNISTD
11237#$i_stdlib I_STDLIB
693762b4 11238#include <stdio.h>
85ab1d1d
JH
11239#ifdef I_UNISTD
11240# include <unistd.h>
11241#endif
11242#ifdef I_STDLIB
11243# include <stdlib.h>
11244#endif
d674cd6d 11245int main()
693762b4 11246{
85ab1d1d
JH
11247 register int i;
11248 register unsigned long tmp;
11249 register unsigned long max = 0L;
11250
11251 for (i = 1000; i; i--) {
11252 tmp = (unsigned long) $randfunc();
11253 if (tmp > max) max = tmp;
11254 }
11255 for (i = 0; max; i++)
11256 max /= 2;
11257 printf("%d\n",i);
693762b4
AD
11258}
11259EOCP
85ab1d1d
JH
11260 set try
11261 if eval $compile_ok; then
11262 dflt=`try`
11263 else
11264 dflt='?'
11265 echo "(I can't seem to compile the test program...)"
11266 fi
11267 ;;
11268 *)
11269 dflt="$randbits"
11270 ;;
11271 esac
11272 rp="How many bits does your $randfunc() function produce?"
11273 . ./myread
11274 randbits="$ans"
11275 $rm -f try.c try
11276 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11277 seedfunc="s$randfunc"
11278 randseedtype=unsigned
11279 ;;
11280 *)
11281 dflt="31"
11282 rp="How many bits does your $randfunc() function produce?"
11283 . ./myread
11284 randbits="$ans"
11285 seedfunc="s$randfunc"
11286 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11287 if set $seedfunc val -f; eval $csym; $val; then
11288 echo "(Using $seedfunc() to seed random generator)"
11289 else
11290 echo "(Warning: no $seedfunc() to seed random generator)"
11291 seedfunc=rand
11292 fi
11293 randseedtype=unsigned
11294 ;;
11295 esac
11296 ;;
11297 esac
11298done
693762b4 11299
5ff3f7a4
GS
11300echo " "
11301echo "Determining whether or not we are on an EBCDIC system..." >&4
11302$cat >tebcdic.c <<'EOM'
11303int main()
11304{
11305 if ('M'==0xd4) return 0;
11306 return 1;
11307}
11308EOM
11309
11310val=$undef
11311set tebcdic
11312if eval $compile_ok; then
11313 if ./tebcdic; then
11314 echo "You have EBCDIC." >&4
11315 val="$define"
11316 else
5cf1d1f1 11317 echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin, or UTF." >&4
5ff3f7a4
GS
11318 fi
11319else
5cc3184f 11320 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
11321 echo "I'll assume ASCII or some ISO Latin." >&4
11322fi
11323$rm -f tebcdic.c tebcdic
11324set ebcdic
11325eval $setvar
11326
29209bc5 11327echo " "
767df6a1
JH
11328$cat >&4 <<EOM
11329Checking how to flush all pending stdio output...
66fe083f 11330EOM
d2201af2
AD
11331# I only know how to find the first 32 possibly open files on SunOS.
11332# See also hints/sunos_4_1.sh and util.c --AD
11333case "$osname" in
11334sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11335esac
11336$cat >>try.c <<EOCP
66fe083f 11337#include <stdio.h>
d2201af2 11338#$i_unistd I_UNISTD
767df6a1 11339#ifdef I_UNISTD
a32a45b6 11340# include <unistd.h>
767df6a1
JH
11341#endif
11342#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
11343#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11344#ifdef HAS_STDIO_STREAM_ARRAY
11345# define STDIO_STREAM_ARRAY $stdio_stream_array
11346#endif
66fe083f
JH
11347int main() {
11348 FILE* p = fopen("try.out", "w");
0f27ced1 11349#ifdef TRY_FPUTC
66fe083f 11350 fputc('x', p);
0f27ced1
JH
11351#else
11352# ifdef TRY_FPRINTF
11353 fprintf(p, "x");
11354# endif
11355#endif
767df6a1 11356#ifdef TRY_FFLUSH_NULL
66fe083f 11357 fflush(NULL);
767df6a1
JH
11358#endif
11359#ifdef TRY_FFLUSH_ALL
11360 {
11361 long open_max = -1;
d2201af2
AD
11362# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11363 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 11364# else
d2201af2
AD
11365# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11366 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 11367# else
4b257aef 11368# ifdef FOPEN_MAX
d2201af2 11369 open_max = FOPEN_MAX;
767df6a1 11370# else
d2201af2
AD
11371# ifdef OPEN_MAX
11372 open_max = OPEN_MAX;
11373# else
11374# ifdef _NFILE
11375 open_max = _NFILE;
11376# endif
767df6a1
JH
11377# endif
11378# endif
11379# endif
4b257aef 11380# endif
ed39a0f2 11381# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
11382 if (open_max > 0) {
11383 long i;
11384 for (i = 0; i < open_max; i++)
d2201af2
AD
11385 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11386 STDIO_STREAM_ARRAY[i]._file < open_max &&
11387 STDIO_STREAM_ARRAY[i]._flag)
11388 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
11389 }
11390 }
ed39a0f2 11391# endif
767df6a1
JH
11392#endif
11393 _exit(42);
66fe083f
JH
11394}
11395EOCP
0f27ced1
JH
11396: first we have to find out how _not_ to flush
11397if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11398 output=''
11399 set try -DTRY_FPUTC
6626660c 11400 if eval $compile; then
4b257aef 11401 $rm -f try.out
0f27ced1
JH
11402 ./try$exe_ext 2>/dev/null
11403 if $test ! -s try.out -a "X$?" = X42; then
11404 output=-DTRY_FPUTC
11405 fi
11406 fi
11407 case "$output" in
11408 '')
11409 set try -DTRY_FPRINTF
11410 $rm -f try.out
6626660c 11411 if eval $compile; then
4b257aef 11412 $rm -f try.out
0f27ced1
JH
11413 ./try$exe_ext 2>/dev/null
11414 if $test ! -s try.out -a "X$?" = X42; then
11415 output=-DTRY_FPRINTF
11416 fi
11417 fi
11418 ;;
11419 esac
11420fi
767df6a1
JH
11421: check for fflush NULL behaviour
11422case "$fflushNULL" in
0f27ced1 11423'') set try -DTRY_FFLUSH_NULL $output
6626660c 11424 if eval $compile; then
4b257aef 11425 $rm -f try.out
196fa3d2 11426 ./try$exe_ext 2>/dev/null
a32a45b6
JH
11427 code="$?"
11428 if $test -s try.out -a "X$code" = X42; then
c2fddd50 11429 fflushNULL="`$cat try.out`"
a32a45b6
JH
11430 else
11431 if $test "X$code" != X42; then
11432 $cat >&4 <<EOM
11433(If this test failed, don't worry, we'll try another method shortly.)
11434EOM
11435 fi
c2fddd50
JH
11436 fi
11437 fi
0f27ced1 11438 $rm -f core try.core core.try.*
c2fddd50 11439 case "$fflushNULL" in
6626660c 11440 x) $cat >&4 <<EOM
66fe083f
JH
11441Your fflush(NULL) works okay.
11442EOM
ed39a0f2 11443 fflushNULL="$define"
c2fddd50 11444 ;;
6626660c 11445 '') $cat >&4 <<EOM
66fe083f
JH
11446Your fflush(NULL) isn't working (contrary to ANSI C).
11447EOM
ed39a0f2 11448 fflushNULL="$undef"
c2fddd50 11449 ;;
6626660c 11450 *) $cat >&4 <<EOM
66fe083f
JH
11451Cannot figure out whether your fflush(NULL) works or not.
11452I'm assuming it doesn't (contrary to ANSI C).
11453EOM
ed39a0f2 11454 fflushNULL="$undef"
c2fddd50
JH
11455 ;;
11456 esac
66fe083f
JH
11457 ;;
11458$define|true|[yY]*)
ed39a0f2 11459 fflushNULL="$define"
66fe083f
JH
11460 ;;
11461*)
ed39a0f2 11462 fflushNULL="$undef"
66fe083f
JH
11463 ;;
11464esac
a32a45b6
JH
11465: check explicit looping only if NULL did not work
11466case "$fflushNULL" in
11467"$undef")
11468 : check for fflush all behaviour
11469 case "$fflushall" in
11470 '') set try -DTRY_FFLUSH_ALL $output
a32a45b6 11471 if eval $compile; then
4b257aef 11472 $cat >&4 <<EOM
a32a45b6 11473(Now testing the other method--but note that also this may fail.)
a71cd7cd 11474EOM
4b257aef 11475 $rm -f try.out
a32a45b6
JH
11476 ./try$exe_ext 2>/dev/null
11477 if $test -s try.out -a "X$?" = X42; then
11478 fflushall="`$cat try.out`"
11479 fi
767df6a1 11480 fi
a32a45b6
JH
11481 $rm -f core try.core core.try.*
11482 case "$fflushall" in
11483 x) $cat >&4 <<EOM
11484Whew. Flushing explicitly all the stdio streams works.
767df6a1 11485EOM
a32a45b6
JH
11486 fflushall="$define"
11487 ;;
11488 '') $cat >&4 <<EOM
11489Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 11490EOM
a32a45b6
JH
11491 fflushall="$undef"
11492 ;;
11493 *) $cat >&4 <<EOM
6626660c 11494Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
11495I'm assuming it doesn't.
11496EOM
a32a45b6
JH
11497 fflushall="$undef"
11498 ;;
11499 esac
767df6a1 11500 ;;
a32a45b6
JH
11501 "$define"|true|[yY]*)
11502 fflushall="$define"
11503 ;;
11504 *)
11505 fflushall="$undef"
6626660c
JH
11506 ;;
11507 esac
767df6a1 11508 ;;
a32a45b6 11509*) fflushall="$undef"
767df6a1
JH
11510 ;;
11511esac
11512case "$fflushNULL$fflushall" in
11513undefundef)
6626660c 11514 $cat <<EOM
767df6a1
JH
11515I cannot figure out how to flush pending stdio output.
11516EOM
11517 ;;
11518esac
11519$rm -f try.* try$exe_ext
66fe083f 11520
a0d0e21e 11521: see what type file positions are declared as in the library
a0d0e21e 11522rp="What is the type for file position used by fsetpos()?"
dc45a647
MB
11523set fpos_t fpostype long stdio.h sys/types.h
11524eval $typedef_ask
2304df62 11525
ccc7f9b3
KS
11526: Store the full pathname to the ar program for use in the C program
11527: Respect a hint or command line value for full_ar.
11528case "$full_ar" in
11529'') full_ar=$ar ;;
11530esac
11531
1aef975c
AD
11532: Store the full pathname to the sed program for use in the C program
11533full_sed=$sed
11534
2304df62 11535: see what type gids are declared as in the kernel
dc45a647
MB
11536echo " "
11537echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
11538set gid_t gidtype xxx stdio.h sys/types.h
11539eval $typedef
2304df62 11540case "$gidtype" in
a0d0e21e
LW
11541xxx)
11542 xxx=`./findhdr sys/user.h`
11543 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11544 case $1 in
11545 unsigned) dflt="$1 $2" ;;
11546 *) dflt="$1" ;;
11547 esac
2304df62 11548 ;;
a0d0e21e 11549*) dflt="$gidtype";;
2304df62 11550esac
dc45a647
MB
11551case "$gidtype" in
11552gid_t) echo "gid_t found." ;;
11553*) rp="What is the type for group ids returned by getgid()?"
11554 . ./myread
11555 gidtype="$ans"
11556 ;;
11557esac
a0d0e21e 11558
2304df62
AD
11559: see if getgroups exists
11560set getgroups d_getgrps
11561eval $inlibc
11562
5cd24f17 11563: see if setgroups exists
11564set setgroups d_setgrps
11565eval $inlibc
11566
dfe9444c 11567
8cc95fdb 11568: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
a0d0e21e 11569echo " "
5cd24f17 11570case "$d_getgrps$d_setgrps" in
11571*define*)
a0d0e21e 11572 case "$groupstype" in
2304df62
AD
11573 '') dflt="$gidtype" ;;
11574 *) dflt="$groupstype" ;;
a0d0e21e
LW
11575 esac
11576 $cat <<EOM
dc45a647 11577What type of pointer is the second argument to getgroups() and setgroups()?
5cd24f17 11578Usually this is the same as group ids, $gidtype, but not always.
2304df62
AD
11579
11580EOM
dc45a647 11581 rp='What type pointer is the second argument to getgroups() and setgroups()?'
a0d0e21e
LW
11582 . ./myread
11583 groupstype="$ans"
11584 ;;
11585*) groupstype="$gidtype";;
2304df62 11586esac
2304df62 11587
85e6fe83 11588: see what type lseek is declared as in the kernel
dc45a647 11589rp="What is the type used for lseek's offset on this system?"
a0d0e21e 11590set off_t lseektype long stdio.h sys/types.h
dc45a647 11591eval $typedef_ask
2304df62 11592
8ff267be 11593echo " "
5ff3f7a4
GS
11594$echo $n "Checking to see how big your file offsets are...$c" >&4
11595$cat >try.c <<EOCP
11596#include <sys/types.h>
11597#include <stdio.h>
5a411a32 11598int main()
5ff3f7a4
GS
11599{
11600 printf("%d\n", sizeof($lseektype));
11601}
11602EOCP
11603set try
11604if eval $compile_ok; then
11605 lseeksize=`./try`
11606 $echo " $lseeksize bytes." >&4
11607else
11608 dflt='4'
11609 echo " "
11610 echo "(I can't seem to compile the test program. Guessing...)"
11611 rp="What is the size of your file offsets (in bytes)?"
11612 . ./myread
11613 lseeksize="$ans"
11614fi
11615$rm -f try.c try
11616
11617echo " "
dfe9444c 11618echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 11619case "$make_set_make" in
11620'')
11621 $sed 's/^X //' > testmake.mak << 'EOF'
11622Xall:
dfe9444c 11623X @echo 'maketemp="$(MAKE)"'
8ff267be 11624EOF
8ff267be 11625 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 11626 *maketemp=*) make_set_make='#' ;;
8ff267be 11627 *) make_set_make="MAKE=$make" ;;
11628 esac
dfe9444c
AD
11629 $rm -f testmake.mak
11630 ;;
11631esac
11632case "$make_set_make" in
11633'#') echo "Yup, it does.";;
11634*) echo "Nope, it doesn't.";;
11635esac
11636
11637: see what type is used for mode_t
dc45a647 11638rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 11639set mode_t modetype int stdio.h sys/types.h
dc45a647 11640eval $typedef_ask
dfe9444c 11641
dfe9444c
AD
11642: define a fucntion to check prototypes
11643$cat > protochk <<EOSH
11644$startsh
11645cc="$cc"
11646optimize="$optimize"
11647ccflags="$ccflags"
11648prototype="$prototype"
11649define="$define"
11650rm=$rm
11651EOSH
11652
11653$cat >> protochk <<'EOSH'
11654
11655$rm -f try.c
11656foo="$1"
11657shift
11658while test $# -ge 2; do
11659 case "$1" in
11660 $define) echo "#include <$2>" >> try.c ;;
11661 literal) echo "$2" >> try.c ;;
11662 esac
11663 shift 2
11664done
11665test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
11666cat >> try.c <<'EOCP'
11667#ifdef CAN_PROTOTYPE
11668#define _(args) args
11669#else
11670#define _(args) ()
11671#endif
11672EOCP
11673echo "$foo" >> try.c
11674echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11675$cc $optimize $ccflags -c try.c > /dev/null 2>&1
11676status=$?
11677$rm -f try.[co]
11678exit $status
11679EOSH
11680chmod +x protochk
11681$eunicefix protochk
11682
dfe9444c 11683: see what type is used for size_t
dc45a647 11684rp="What is the type used for the length parameter for string functions?"
dfe9444c 11685set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 11686eval $typedef_ask
dfe9444c
AD
11687
11688: check for type of arguments to gethostbyaddr.
11689if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11690 case "$d_gethbyaddr" in
11691 $define)
11692 $cat <<EOM
11693
11694Checking to see what type of arguments are accepted by gethostbyaddr().
11695EOM
11696 hdrs="$define sys/types.h
11697 $d_socket sys/socket.h
11698 $i_niin netinet/in.h
11699 $i_netdb netdb.h
11700 $i_unistd unistd.h"
11701 : The first arg can 'char *' or 'void *'
11702 : The second arg is some of integral type
11703 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11704 for yyy in size_t long int; do
11705 case "$netdb_host_type" in
11706 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11707 if ./protochk "$try" $hdrs; then
11708 echo "Your system accepts $xxx for the first arg."
11709 echo "...and $yyy for the second arg."
11710 netdb_host_type="$xxx"
11711 netdb_hlen_type="$yyy"
11712 fi
11713 ;;
11714 esac
11715 done
11716 done
11717 : In case none of those worked, prompt the user.
11718 case "$netdb_host_type" in
11719 '') rp='What is the type for the 1st argument to gethostbyaddr?'
11720 dflt='char *'
11721 . ./myread
11722 netdb_host_type=$ans
11723 rp='What is the type for the 2nd argument to gethostbyaddr?'
11724 dflt="$sizetype"
11725 . ./myread
11726 netdb_hlen_type=$ans
11727 ;;
11728 esac
11729 ;;
11730 *) : no gethostbyaddr, so pick harmless defaults
11731 netdb_host_type='char *'
11732 netdb_hlen_type="$sizetype"
11733 ;;
11734 esac
11735 # Remove the "const" if needed. -- but then we'll have a
11736 # prototype clash!
11737 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11738fi
11739
11740: check for type of argument to gethostbyname.
11741if test "X$netdb_name_type" = X ; then
11742 case "$d_gethbyname" in
11743 $define)
11744 $cat <<EOM
11745
11746Checking to see what type of argument is accepted by gethostbyname().
11747EOM
11748 hdrs="$define sys/types.h
11749 $d_socket sys/socket.h
11750 $i_niin netinet/in.h
11751 $i_netdb netdb.h
11752 $i_unistd unistd.h"
11753 for xxx in "const char *" "char *"; do
11754 case "$netdb_name_type" in
11755 '') try="extern struct hostent *gethostbyname($xxx);"
11756 if ./protochk "$try" $hdrs; then
11757 echo "Your system accepts $xxx."
11758 netdb_name_type="$xxx"
11759 fi
11760 ;;
11761 esac
11762 done
11763 : In case none of those worked, prompt the user.
11764 case "$netdb_name_type" in
11765 '') rp='What is the type for the 1st argument to gethostbyname?'
11766 dflt='char *'
11767 . ./myread
11768 netdb_name_type=$ans
11769 ;;
11770 esac
11771 ;;
11772 *) : no gethostbyname, so pick harmless default
11773 netdb_name_type='char *'
11774 ;;
11775 esac
11776fi
8ff267be 11777
dfe9444c
AD
11778: check for type of 1st argument to getnetbyaddr.
11779if test "X$netdb_net_type" = X ; then
11780 case "$d_getnbyaddr" in
11781 $define)
11782 $cat <<EOM
85e6fe83 11783
dfe9444c
AD
11784Checking to see what type of 1st argument is accepted by getnetbyaddr().
11785EOM
11786 hdrs="$define sys/types.h
11787 $d_socket sys/socket.h
11788 $i_niin netinet/in.h
11789 $i_netdb netdb.h
11790 $i_unistd unistd.h"
11791 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11792 case "$netdb_net_type" in
11793 '') try="extern struct netent *getnetbyaddr($xxx, int);"
11794 if ./protochk "$try" $hdrs; then
11795 echo "Your system accepts $xxx."
11796 netdb_net_type="$xxx"
11797 fi
11798 ;;
11799 esac
11800 done
11801 : In case none of those worked, prompt the user.
11802 case "$netdb_net_type" in
11803 '') rp='What is the type for the 1st argument to getnetbyaddr?'
11804 dflt='long'
11805 . ./myread
11806 netdb_net_type=$ans
11807 ;;
11808 esac
11809 ;;
11810 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 11811 netdb_net_type='long'
dfe9444c
AD
11812 ;;
11813 esac
11814fi
2c7991dc 11815: locate the preferred pager for this system
11816case "$pager" in
11817'')
11818 dflt=''
11819 case "$pg" in
11820 /*) dflt=$pg;;
11821 esac
11822 case "$more" in
11823 /*) dflt=$more;;
11824 esac
11825 case "$less" in
11826 /*) dflt=$less;;
11827 esac
11828 case "$dflt" in
11829 '') dflt=/usr/ucb/more;;
11830 esac
11831 ;;
11832*) dflt="$pager";;
11833esac
11834echo " "
11835fn=f/
11836rp='What pager is used on your system?'
11837. ./getfile
11838pager="$ans"
11839
dfe9444c 11840: see what type pids are declared as in the kernel
dc45a647 11841rp="What is the type of process ids on this system?"
dfe9444c 11842set pid_t pidtype int stdio.h sys/types.h
dc45a647 11843eval $typedef_ask
2304df62 11844
693762b4
AD
11845: check for length of pointer
11846echo " "
11847case "$ptrsize" in
11848'')
dc45a647 11849 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
11850 if test "$voidflags" -gt 7; then
11851 echo '#define VOID_PTR char *' > try.c
11852 else
11853 echo '#define VOID_PTR void *' > try.c
11854 fi
11855 $cat >>try.c <<'EOCP'
11856#include <stdio.h>
d674cd6d 11857int main()
693762b4
AD
11858{
11859 printf("%d\n", sizeof(VOID_PTR));
11860 exit(0);
11861}
11862EOCP
11863 set try
dc45a647 11864 if eval $compile_ok; then
693762b4 11865 ptrsize=`./try`
dc45a647 11866 $echo " $ptrsize bytes." >&4
693762b4
AD
11867 else
11868 dflt='4'
11869 echo "(I can't seem to compile the test program. Guessing...)" >&4
11870 rp="What is the size of a pointer (in bytes)?"
11871 . ./myread
11872 ptrsize="$ans"
11873 fi
11874 ;;
11875esac
11876$rm -f try.c try
11877
a0d0e21e
LW
11878: see if ar generates random libraries by itself
11879echo " "
11880echo "Checking how to generate random libraries on your machine..." >&4
11881echo 'int bar1() { return bar2(); }' > bar1.c
11882echo 'int bar2() { return 2; }' > bar2.c
11883$cat > foo.c <<'EOP'
d674cd6d 11884int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
11885EOP
11886$cc $ccflags -c bar1.c >/dev/null 2>&1
11887$cc $ccflags -c bar2.c >/dev/null 2>&1
11888$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
11889$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11890if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 11891 ./foobar >/dev/null 2>&1; then
4e2a5f63 11892 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
11893 orderlib=false
11894 ranlib=":"
dfe9444c
AD
11895elif $ar ts bar$_a >/dev/null 2>&1 &&
11896 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 11897 ./foobar >/dev/null 2>&1; then
4e2a5f63 11898 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 11899 orderlib=false
dfe9444c 11900 ranlib="$ar ts"
a0d0e21e 11901else
ecfc5424
AD
11902 case "$ranlib" in
11903 :) ranlib='';;
11904 '')
11905 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11906 $test -f $ranlib || ranlib=''
11907 ;;
11908 esac
a0d0e21e 11909 if $test -n "$ranlib"; then
ecfc5424 11910 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
11911 orderlib=false
11912 else
11913 echo "your system doesn't seem to support random libraries"
11914 echo "so we'll use lorder and tsort to order the libraries."
11915 orderlib=true
11916 ranlib=":"
11917 fi
11918fi
11919$rm -f foo* bar*
11920
dfe9444c
AD
11921: check for type of arguments to select.
11922case "$selecttype" in
11923'') case "$d_select" in
11924 $define)
11925 $cat <<EOM
11926Checking to see what type of arguments are accepted by select().
11927EOM
11928 hdrs="$define sys/types.h
11929 $i_systime sys/time.h
11930 $i_sysselct sys/select.h
11931 $d_socket sys/socket.h"
11932 : The first arg can be int, unsigned, or size_t
11933 : The last arg may or may not be 'const'
11934 val=''
7f3d1cf1
BH
11935 : void pointer has been seen but using that
11936 : breaks the selectminbits test
11937 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 11938 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
11939 for tmo in 'struct timeval *' 'const struct timeval *'; do
11940 case "$val" in
11941 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11942 if ./protochk "$try" $hdrs; then
11943 echo "Your system accepts $xxx."
11944 val="$xxx"
11945 fi
11946 ;;
11947 esac
11948 done
11949 done
11950 done
11951 case "$val" in
11952 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11953 case "$d_fd_set" in
11954 $define) dflt="fd_set *" ;;
11955 *) dflt="int *" ;;
11956 esac
11957 . ./myread
11958 val=$ans
11959 ;;
a0d0e21e 11960 esac
dfe9444c 11961 selecttype="$val"
a0d0e21e 11962 ;;
dfe9444c
AD
11963 *) : no select, so pick a harmless default
11964 selecttype='int *'
a0d0e21e
LW
11965 ;;
11966 esac
a0d0e21e
LW
11967 ;;
11968esac
2304df62 11969
5ff3f7a4
GS
11970: check for the select 'width'
11971case "$selectminbits" in
11972'') case "$d_select" in
11973 $define)
11974 $cat <<EOM
11975
85ab1d1d 11976Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
11977EOM
11978 $cat >try.c <<EOCP
11979#include <sys/types.h>
11980#$i_time I_TIME
11981#$i_systime I_SYS_TIME
11982#$i_systimek I_SYS_TIME_KERNEL
11983#ifdef I_TIME
11984# include <time.h>
11985#endif
11986#ifdef I_SYS_TIME
11987# ifdef I_SYS_TIME_KERNEL
11988# define KERNEL
11989# endif
11990# include <sys/time.h>
11991# ifdef I_SYS_TIME_KERNEL
11992# undef KERNEL
11993# endif
11994#endif
11995#$i_sysselct I_SYS_SELECT
11996#ifdef I_SYS_SELECT
11997#include <sys/select.h>
11998#endif
bd628c73
AD
11999#$d_socket HAS_SOCKET
12000#ifdef HAS_SOCKET
12001# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12002#endif
5ff3f7a4 12003#include <stdio.h>
fb164848
JH
12004$selecttype b;
12005#define S sizeof(*(b))
5ff3f7a4
GS
12006#define MINBITS 64
12007#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12008#define NBITS (NBYTES * 8)
12009int main() {
12010 char s[NBYTES];
5ff3f7a4
GS
12011 struct timeval t;
12012 int i;
12013 FILE* fp;
12014 int fd;
12015
12016 fclose(stdin);
12017 fp = fopen("try.c", "r");
12018 if (fp == 0)
12019 exit(1);
12020 fd = fileno(fp);
12021 if (fd < 0)
12022 exit(2);
12023 b = ($selecttype)s;
12024 for (i = 0; i < NBITS; i++)
12025 FD_SET(i, b);
12026 t.tv_sec = 0;
12027 t.tv_usec = 0;
12028 select(fd + 1, b, 0, 0, &t);
12029 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12030 printf("%d\n", i + 1);
12031 return 0;
12032}
12033EOCP
12034 set try
12035 if eval $compile_ok; then
12036 selectminbits=`./try`
85ab1d1d 12037 case "$selectminbits" in
fb164848
JH
12038 '') cat >&4 <<EOM
12039Cannot figure out on how many bits at a time your select() operates.
12040I'll play safe and guess it is 32 bits.
12041EOM
12042 selectminbits=32
12043 bits="32 bits"
12044 ;;
85ab1d1d
JH
12045 1) bits="1 bit" ;;
12046 *) bits="$selectminbits bits" ;;
12047 esac
12048 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
12049 else
12050 rp='What is the minimum number of bits your select() operates on?'
12051 case "$byteorder" in
12052 1234|12345678) dflt=32 ;;
12053 *) dflt=1 ;;
12054 esac
12055 . ./myread
12056 val=$ans
12057 selectminbits="$val"
12058 fi
12059 $rm -f try.* try
12060 ;;
12061 *) : no select, so pick a harmless default
12062 selectminbits='32'
12063 ;;
12064 esac
12065 ;;
12066esac
12067
8e07c86e
AD
12068: Trace out the files included by signal.h, then look for SIGxxx names.
12069: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
12070: Remove SIGSTKSIZE used by Linux.
12071: Remove SIGSTKSZ used by Posix.
4633a7c4 12072: Remove SIGTYP void lines used by OS2.
8e07c86e
AD
12073xxx=`echo '#include <signal.h>' |
12074 $cppstdin $cppminus $cppflags 2>/dev/null |
12075 $grep '^[ ]*#.*include' |
12076 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12077: Check this list of files to be sure we have parsed the cpp output ok.
12078: This will also avoid potentially non-existent files, such
12079: as ../foo/bar.h
12080xxxfiles=''
12081for xx in $xxx /dev/null ; do
12082 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12083done
12084: If we have found no files, at least try signal.h
12085case "$xxxfiles" in
12086'') xxxfiles=`./findhdr signal.h` ;;
12087esac
12088xxx=`awk '
af4c28eb 12089$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
12090 print substr($2, 4, 20)
12091}
4633a7c4 12092$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
12093 print substr($3, 4, 20)
12094}' $xxxfiles`
12095: Append some common names just in case the awk scan failed.
12096xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12097xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12098xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12099xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12100: generate a few handy files for later
dc45a647 12101$cat > signal.c <<'EOCP'
4633a7c4
LW
12102#include <sys/types.h>
12103#include <signal.h>
dc45a647 12104#include <stdio.h>
4633a7c4 12105int main() {
760ac839
LW
12106
12107/* Strange style to avoid deeply-nested #if/#else/#endif */
12108#ifndef NSIG
12109# ifdef _NSIG
12110# define NSIG (_NSIG)
12111# endif
12112#endif
12113
12114#ifndef NSIG
12115# ifdef SIGMAX
12116# define NSIG (SIGMAX+1)
12117# endif
12118#endif
12119
12120#ifndef NSIG
12121# ifdef SIG_MAX
12122# define NSIG (SIG_MAX+1)
12123# endif
12124#endif
12125
12126#ifndef NSIG
12127# ifdef MAXSIG
12128# define NSIG (MAXSIG+1)
12129# endif
4633a7c4 12130#endif
760ac839
LW
12131
12132#ifndef NSIG
12133# ifdef MAX_SIG
12134# define NSIG (MAX_SIG+1)
12135# endif
12136#endif
12137
12138#ifndef NSIG
12139# ifdef SIGARRAYSIZE
12140# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12141# endif
12142#endif
12143
12144#ifndef NSIG
12145# ifdef _sys_nsig
12146# define NSIG (_sys_nsig) /* Solaris 2.5 */
12147# endif
12148#endif
12149
12150/* Default to some arbitrary number that's big enough to get most
12151 of the common signals.
12152*/
12153#ifndef NSIG
12154# define NSIG 50
4633a7c4 12155#endif
760ac839
LW
12156
12157printf("NSIG %d\n", NSIG);
12158
dc45a647
MB
12159#ifndef JUST_NSIG
12160
12161EOCP
12162
28e8609d 12163echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
12164{
12165 printf "#ifdef SIG"; printf $1; printf "\n"
12166 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12167 printf $1; printf ");\n"
12168 printf "#endif\n"
2304df62 12169}
2304df62 12170END {
dc45a647 12171 printf "#endif /* JUST_NSIG */\n";
8e07c86e 12172 printf "}\n";
2304df62 12173}
4633a7c4
LW
12174' >>signal.c
12175$cat >signal.awk <<'EOP'
12176BEGIN { ndups = 0 }
12177$1 ~ /^NSIG$/ { nsig = $2 }
12178($1 !~ /^NSIG$/) && (NF == 2) {
12179 if ($2 > maxsig) { maxsig = $2 }
12180 if (sig_name[$2]) {
12181 dup_name[ndups] = $1
12182 dup_num[ndups] = $2
12183 ndups++
12184 }
12185 else {
12186 sig_name[$2] = $1
12187 sig_num[$2] = $2
12188 }
4633a7c4
LW
12189}
12190END {
af4c28eb
CS
12191 if (nsig == 0) {
12192 nsig = maxsig + 1
12193 }
12194 printf("NSIG %d\n", nsig);
12195 for (n = 1; n < nsig; n++) {
12196 if (sig_name[n]) {
12197 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 12198 }
af4c28eb
CS
12199 else {
12200 printf("NUM%d %d\n", n, n)
12201 }
12202 }
4633a7c4 12203 for (n = 0; n < ndups; n++) {
af4c28eb 12204 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
12205 }
12206}
12207EOP
12208$cat >signal_cmd <<EOS
8e07c86e 12209$startsh
dc45a647
MB
12210if $test -s signal.lst; then
12211 echo "Using your existing signal.lst file"
12212 exit 0
12213fi
12214xxx="$xxx"
12215EOS
12216$cat >>signal_cmd <<'EOS'
12217
12218set signal
12219if eval $compile_ok; then
dfe9444c 12220 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 12221else
dc45a647
MB
12222 echo "(I can't seem be able to compile the whole test program)" >&4
12223 echo "(I'll try it in little pieces.)" >&4
12224 set signal -DJUST_NSIG
12225 if eval $compile_ok; then
12226 ./signal$_exe > signal.nsg
12227 $cat signal.nsg
12228 else
12229 echo "I can't seem to figure out how many signals you have." >&4
12230 echo "Guessing 50." >&4
12231 echo 'NSIG 50' > signal.nsg
12232 fi
12233 : Now look at all the signal names, one at a time.
28e8609d 12234 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
12235 $cat > signal.c <<EOCP
12236#include <sys/types.h>
12237#include <signal.h>
12238#include <stdio.h>
12239int main() {
12240printf("$xx %d\n", SIG${xx});
12241return 0;
12242}
12243EOCP
12244 set signal
12245 if eval $compile; then
12246 echo "SIG${xx} found."
12247 ./signal$_exe >> signal.ls1
12248 else
12249 echo "SIG${xx} NOT found."
12250 fi
12251 done
12252 if $test -s signal.ls1; then
12253 $cat signal.nsg signal.ls1 |
12254 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12255 fi
12256
12257fi
12258if $test -s signal.lst; then
12259 :
12260else
12261 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 12262 echo 'kill -l' >signal
dc45a647 12263 set X `csh -f <signal`
8e07c86e 12264 $rm -f signal
2304df62 12265 shift
dc45a647 12266 case $# in
8e07c86e 12267 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 12268 esac
28e8609d 12269 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
12270 $awk '{ printf "%s %d\n", $1, ++s; }
12271 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 12272fi
dc45a647 12273$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 12274EOS
4633a7c4
LW
12275chmod a+x signal_cmd
12276$eunicefix signal_cmd
8e07c86e
AD
12277
12278: generate list of signal names
12279echo " "
dfe9444c 12280case "$sig_name_init" in
6626bf4c
JH
12281'') doinit=yes ;;
12282*) case "$sig_num_init" in
12283 ''|*,*) doinit=yes ;;
12284 esac ;;
12285esac
12286case "$doinit" in
12287yes)
4633a7c4 12288 echo "Generating a list of signal names and numbers..." >&4
dc45a647 12289 . ./signal_cmd
af4c28eb
CS
12290 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12291 sig_name=`$awk 'BEGIN { printf "ZERO " }
12292 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12293 sig_num=`$awk 'BEGIN { printf "0 " }
12294 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12295 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
12296 !/^NSIG/ { printf "\"%s\", ", $1 }
12297 END { printf "0\n" }' signal.lst`
12298 sig_num_init=`$awk 'BEGIN { printf "0, " }
12299 !/^NSIG/ { printf "%d, ", $2}
12300 END { printf "0\n"}' signal.lst`
12301 ;;
12302esac
12303echo "The following $sig_count signals are available:"
a0d0e21e
LW
12304echo " "
12305echo $sig_name | $awk \
12306'BEGIN { linelen = 0 }
12307{
8e07c86e 12308 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
12309 name = "SIG" $i " "
12310 linelen = linelen + length(name)
12311 if (linelen > 70) {
12312 printf "\n"
12313 linelen = length(name)
12314 }
12315 printf "%s", name
12316 }
8e07c86e 12317 printf "\n"
a0d0e21e 12318}'
4633a7c4 12319$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 12320
a0d0e21e
LW
12321: see what type is used for signed size_t
12322set ssize_t ssizetype int stdio.h sys/types.h
12323eval $typedef
12324dflt="$ssizetype"
12325$cat > ssize.c <<EOM
12326#include <stdio.h>
12327#include <sys/types.h>
12328#define Size_t $sizetype
12329#define SSize_t $dflt
d674cd6d 12330int main()
a0d0e21e
LW
12331{
12332 if (sizeof(Size_t) == sizeof(SSize_t))
12333 printf("$dflt\n");
12334 else if (sizeof(Size_t) == sizeof(int))
12335 printf("int\n");
12336 else
12337 printf("long\n");
760ac839 12338 exit(0);
a0d0e21e
LW
12339}
12340EOM
12341echo " "
dfe9444c 12342set ssize
dc45a647 12343if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 12344 ssizetype=`./ssize`
a0d0e21e
LW
12345 echo "I'll be using $ssizetype for functions returning a byte count." >&4
12346else
24fef2a7 12347 $cat >&4 <<EOM
24fef2a7
AD
12348Help! I can't compile and run the ssize_t test program: please enlighten me!
12349(This is probably a misconfiguration in your system or libraries, and
12350you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
12351
12352I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 12353be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
12354
12355EOM
12356 rp="What signed type is the same size as $sizetype?"
12357 . ./myread
12358 ssizetype="$ans"
12359fi
dfe9444c 12360$rm -f ssize ssize.*
3fd537d4 12361
a0d0e21e
LW
12362: see what type of char stdio uses.
12363echo " "
12364if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12365 echo "Your stdio uses unsigned chars." >&4
12366 stdchar="unsigned char"
12367else
12368 echo "Your stdio uses signed chars." >&4
12369 stdchar="char"
12370fi
12371
12372: see if time exists
12373echo " "
28e8609d
JH
12374if test "X$d_time" = X -o X"$timetype" = X; then
12375 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
12376 echo 'time() found.' >&4
12377 val="$define"
12378 rp="What is the type returned by time() on this system?"
12379 set time_t timetype long stdio.h sys/types.h
12380 eval $typedef_ask
28e8609d 12381 else
5ff3f7a4
GS
12382 echo 'time() not found, hope that will do.' >&4
12383 val="$undef"
12384 timetype='int';
28e8609d
JH
12385 fi
12386 set d_time
12387 eval $setvar
a0d0e21e 12388fi
a0d0e21e
LW
12389
12390: see what type uids are declared as in the kernel
dc45a647
MB
12391echo " "
12392echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
12393set uid_t uidtype xxx stdio.h sys/types.h
12394eval $typedef
12395case "$uidtype" in
12396xxx)
12397 xxx=`./findhdr sys/user.h`
12398 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12399 case $1 in
12400 unsigned) dflt="$1 $2" ;;
12401 *) dflt="$1" ;;
12402 esac
12403 ;;
4633a7c4
LW
12404*) dflt="$uidtype";;
12405esac
dc45a647
MB
12406case "$uidtype" in
12407uid_t) echo "uid_t found." ;;
12408*) rp="What is the type for user ids returned by getuid()?"
12409 . ./myread
12410 uidtype="$ans"
12411 ;;
12412esac
4633a7c4
LW
12413
12414: see if dbm.h is available
12415: see if dbmclose exists
12416set dbmclose d_dbmclose
12417eval $inlibc
12418
12419case "$d_dbmclose" in
12420$define)
12421 set dbm.h i_dbm
12422 eval $inhdr
5f80c64f
JH
12423 case "$i_dbm" in
12424 $define)
12425 val="$undef"
12426 set i_rpcsvcdbm
12427 eval $setvar
12428 ;;
12429 *) set rpcsvc/dbm.h i_rpcsvcdbm
12430 eval $inhdr
12431 ;;
12432 esac
12433 ;;
12434*) echo "We won't be including <dbm.h>"
12435 val="$undef"
12436 set i_dbm
12437 eval $setvar
12438 val="$undef"
12439 set i_rpcsvcdbm
12440 eval $setvar
12441 ;;
12442esac
12443
12444: see if this is a sys/file.h system
12445val=''
12446set sys/file.h val
12447eval $inhdr
12448
12449: do we need to include sys/file.h ?
12450case "$val" in
12451"$define")
12452 echo " "
12453 if $h_sysfile; then
12454 val="$define"
12455 echo "We'll be including <sys/file.h>." >&4
12456 else
12457 val="$undef"
12458 echo "We won't be including <sys/file.h>." >&4
12459 fi
12460 ;;
12461*)
12462 h_sysfile=false
12463 ;;
12464esac
12465set i_sysfile
12466eval $setvar
12467
12468: see if fcntl.h is there
12469val=''
12470set fcntl.h val
12471eval $inhdr
12472
12473: see if we can include fcntl.h
12474case "$val" in
12475"$define")
12476 echo " "
12477 if $h_fcntl; then
12478 val="$define"
12479 echo "We'll be including <fcntl.h>." >&4
12480 else
12481 val="$undef"
12482 if $h_sysfile; then
12483 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12484 else
12485 echo "We won't be including <fcntl.h>." >&4
12486 fi
12487 fi
12488 ;;
12489*)
12490 h_fcntl=false
12491 val="$undef"
12492 ;;
12493esac
12494set i_fcntl
12495eval $setvar
12496
12497: see if locale.h is available
12498set locale.h i_locale
12499eval $inhdr
12500
7f3d1cf1 12501: see if mach cthreads are available
13666627
JH
12502if test "X$usethreads" = "X$define"; then
12503 set mach/cthreads.h i_machcthr
12504 eval $inhdr
12505else
12506 i_machcthr="$undef"
12507fi
12508
12509
7f3d1cf1 12510
5f80c64f
JH
12511: see if this is a math.h system
12512set math.h i_math
12513eval $inhdr
12514
e7fb4fcc
JH
12515: see if this is a mntent.h system
12516set mntent.h i_mntent
12517eval $inhdr
12518
5f80c64f
JH
12519: see if ndbm.h is available
12520set ndbm.h t_ndbm
12521eval $inhdr
12522case "$t_ndbm" in
12523$define)
12524 : see if dbm_open exists
12525 set dbm_open d_dbm_open
12526 eval $inlibc
12527 case "$d_dbm_open" in
12528 $undef)
12529 t_ndbm="$undef"
12530 echo "We won't be including <ndbm.h>"
12531 ;;
12532 esac
12533 ;;
12534esac
12535val="$t_ndbm"
12536set i_ndbm
12537eval $setvar
12538
12539: see if net/errno.h is available
12540val=''
12541set net/errno.h val
12542eval $inhdr
12543
12544: Unfortunately, it causes problems on some systems. Arrgh.
12545case "$val" in
12546$define)
12547 cat > try.c <<'EOM'
12548#include <stdio.h>
12549#include <errno.h>
12550#include <net/errno.h>
12551int func()
12552{
12553 return ENOTSOCK;
12554}
12555EOM
12556 if $cc $ccflags -c try.c >/dev/null 2>&1; then
12557 echo "We'll be including <net/errno.h>." >&4
12558 else
12559 echo "We won't be including <net/errno.h>." >&4
12560 val="$undef"
12561 fi
12562 $rm -f try.* try
12563 ;;
12564esac
12565set i_neterrno
12566eval $setvar
12567
9cc6feab
JH
12568: see if netinet/tcp.h is available
12569set netinet/tcp.h i_netinettcp
12570eval $inhdr
12571
5b34fd99
JH
12572: see if this is a poll.h system
12573set poll.h i_poll
12574eval $inhdr
12575
5f80c64f
JH
12576: get C preprocessor symbols handy
12577echo " "
12578$echo $n "Hmm... $c"
12579echo $al | $tr ' ' $trnl >Cppsym.know
12580$cat <<EOSS >Cppsym
12581$startsh
12582case "\$1" in
12583-l) list=true
12584 shift
12585 ;;
12586esac
12587unknown=''
12588case "\$list\$#" in
125891|2)
12590 for sym do
12591 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12592 exit 0
12593 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12594 :
12595 else
12596 unknown="\$unknown \$sym"
12597 fi
12598 done
12599 set X \$unknown
12600 shift
12601 ;;
12602esac
12603case \$# in
126040) exit 1;;
12605esac
12606echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12607#ifdef \1\\
12608exit 0; _ _ _ _\1\\ \1\\
12609#endif\\
12610/' >Cppsym\$\$
12611echo "exit 1; _ _ _" >>Cppsym\$\$
12612$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
12613case "\$list" in
12614true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12615*)
12616 sh Cppsym2\$\$
12617 status=\$?
12618 ;;
12619esac
12620$rm -f Cppsym\$\$ Cppsym2\$\$
12621exit \$status
12622EOSS
12623chmod +x Cppsym
12624$eunicefix Cppsym
12625./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12626
12627: now check the C compiler for additional symbols
c4747d3e
JH
12628postprocess_cc_v=''
12629case "$osname" in
12630aix) postprocess_cc_v="|$tr , ' '" ;;
12631esac
5f80c64f
JH
12632$cat >ccsym <<EOS
12633$startsh
12634$cat >tmp.c <<EOF
12635extern int foo;
12636EOF
c4747d3e 12637for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
12638do
12639 case "\$i" in
12640 -D*) echo "\$i" | $sed 's/^-D//';;
12641 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12642 esac
12643done
12644$rm -f try.c
12645EOS
2000072c 12646postprocess_cc_v=''
5f80c64f
JH
12647chmod +x ccsym
12648$eunicefix ccsym
12649./ccsym > ccsym1.raw
12650if $test -s ccsym1.raw; then
12651 $sort ccsym1.raw | $uniq >ccsym.raw
12652else
12653 mv ccsym1.raw ccsym.raw
12654fi
12655
12656$awk '/\=/ { print $0; next }
12657 { print $0"=1" }' ccsym.raw >ccsym.list
12658$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12659$comm -13 ccsym.true ccsym.list >ccsym.own
12660$comm -12 ccsym.true ccsym.list >ccsym.com
12661$comm -23 ccsym.true ccsym.list >ccsym.cpp
12662also=''
5f80c64f 12663if $test -z ccsym.raw; then
ff49bff8 12664 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 12665 echo " "
ff49bff8 12666 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 12667 $cat Cppsym.true
ff49bff8
JH
12668 ccsymbols=''
12669 cppsymbols=`$cat Cppsym.true`
918c3d21 12670 cppsymbols=`echo $cppsymbols`
ff49bff8 12671 cppccsymbols="$cppsymbols"
5f80c64f
JH
12672else
12673 if $test -s ccsym.com; then
12674 echo "Your C compiler and pre-processor define these symbols:"
12675 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12676 also='also '
12677 symbols='ones'
ff49bff8 12678 cppccsymbols=`$cat ccsym.com`
918c3d21 12679 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
12680 $test "$silent" || sleep 1
12681 fi
12682 if $test -s ccsym.cpp; then
12683 $test "$also" && echo " "
ff49bff8 12684 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
12685 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12686 also='further '
ff49bff8 12687 cppsymbols=`$cat ccsym.cpp`
918c3d21 12688 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
12689 $test "$silent" || sleep 1
12690 fi
12691 if $test -s ccsym.own; then
12692 $test "$also" && echo " "
ff49bff8 12693 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
12694 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12695 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 12696 ccsymbols=`$cat ccsym.own`
918c3d21 12697 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
12698 $test "$silent" || sleep 1
12699 fi
12700fi
12701$rm -f ccsym*
12702
12703: see if this is a termio system
12704val="$undef"
12705val2="$undef"
12706val3="$undef"
12707if $test `./findhdr termios.h`; then
12708 set tcsetattr i_termios
12709 eval $inlibc
12710 val3="$i_termios"
12711fi
12712echo " "
12713case "$val3" in
12714"$define") echo "You have POSIX termios.h... good!" >&4;;
12715*) if ./Cppsym pyr; then
12716 case "`/bin/universe`" in
12717 ucb) if $test `./findhdr sgtty.h`; then
12718 val2="$define"
12719 echo "<sgtty.h> found." >&4
12720 else
12721 echo "System is pyramid with BSD universe."
12722 echo "<sgtty.h> not found--you could have problems." >&4
12723 fi;;
12724 *) if $test `./findhdr termio.h`; then
12725 val="$define"
12726 echo "<termio.h> found." >&4
12727 else
12728 echo "System is pyramid with USG universe."
12729 echo "<termio.h> not found--you could have problems." >&4
12730 fi;;
12731 esac
12732 elif ./usg; then
12733 if $test `./findhdr termio.h`; then
12734 echo "<termio.h> found." >&4
12735 val="$define"
12736 elif $test `./findhdr sgtty.h`; then
12737 echo "<sgtty.h> found." >&4
12738 val2="$define"
12739 else
12740echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12741 fi
12742 else
12743 if $test `./findhdr sgtty.h`; then
12744 echo "<sgtty.h> found." >&4
12745 val2="$define"
12746 elif $test `./findhdr termio.h`; then
12747 echo "<termio.h> found." >&4
12748 val="$define"
12749 else
12750echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12751 fi
12752 fi;;
12753esac
12754set i_termio; eval $setvar
12755val=$val2; set i_sgtty; eval $setvar
12756val=$val3; set i_termios; eval $setvar
12757
f1066039
JH
12758: see if this is a shadow.h system
12759set shadow.h i_shadow
12760eval $inhdr
12761
86959918
JH
12762: see if this is a socks.h system
12763set socks.h i_socks
12764eval $inhdr
12765
5f80c64f
JH
12766: see if stdarg is available
12767echo " "
12768if $test `./findhdr stdarg.h`; then
12769 echo "<stdarg.h> found." >&4
12770 valstd="$define"
12771else
12772 echo "<stdarg.h> NOT found." >&4
12773 valstd="$undef"
12774fi
12775
12776: see if varags is available
12777echo " "
12778if $test `./findhdr varargs.h`; then
12779 echo "<varargs.h> found." >&4
12780else
12781 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12782fi
12783
12784: set up the varargs testing programs
12785$cat > varargs.c <<EOP
12786#ifdef I_STDARG
12787#include <stdarg.h>
12788#endif
12789#ifdef I_VARARGS
12790#include <varargs.h>
12791#endif
12792
12793#ifdef I_STDARG
12794int f(char *p, ...)
12795#else
12796int f(va_alist)
12797va_dcl
12798#endif
12799{
12800 va_list ap;
12801#ifndef I_STDARG
12802 char *p;
12803#endif
12804#ifdef I_STDARG
12805 va_start(ap,p);
12806#else
12807 va_start(ap);
12808 p = va_arg(ap, char *);
12809#endif
12810 va_end(ap);
12811}
12812EOP
12813$cat > varargs <<EOP
12814$startsh
12815if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12816 echo "true"
12817else
12818 echo "false"
12819fi
12820$rm -f varargs$_o
12821EOP
12822chmod +x varargs
12823
12824: now check which varargs header should be included
12825echo " "
12826i_varhdr=''
12827case "$valstd" in
12828"$define")
12829 if `./varargs I_STDARG`; then
12830 val='stdarg.h'
12831 elif `./varargs I_VARARGS`; then
12832 val='varargs.h'
12833 fi
12834 ;;
12835*)
12836 if `./varargs I_VARARGS`; then
12837 val='varargs.h'
12838 fi
12839 ;;
12840esac
12841case "$val" in
12842'')
12843echo "I could not find the definition for va_dcl... You have problems..." >&4
12844 val="$undef"; set i_stdarg; eval $setvar
12845 val="$undef"; set i_varargs; eval $setvar
12846 ;;
12847*)
12848 set i_varhdr
12849 eval $setvar
12850 case "$i_varhdr" in
12851 stdarg.h)
12852 val="$define"; set i_stdarg; eval $setvar
12853 val="$undef"; set i_varargs; eval $setvar
12854 ;;
12855 varargs.h)
12856 val="$undef"; set i_stdarg; eval $setvar
12857 val="$define"; set i_varargs; eval $setvar
12858 ;;
12859 esac
12860 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12861esac
12862$rm -f varargs*
12863
12864: see if stddef is available
12865set stddef.h i_stddef
12866eval $inhdr
12867
12868: see if sys/access.h is available
12869set sys/access.h i_sysaccess
12870eval $inhdr
12871
12872: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12873set sys/filio.h i_sysfilio
12874eval $inhdr
12875echo " "
12876if $test `./findhdr sys/ioctl.h`; then
12877 val="$define"
12878 echo '<sys/ioctl.h> found.' >&4
12879else
12880 val="$undef"
12881 if $test $i_sysfilio = "$define"; then
12882 echo '<sys/ioctl.h> NOT found.' >&4
12883 else
12884 $test $i_sgtty = "$define" && xxx="sgtty.h"
12885 $test $i_termio = "$define" && xxx="termio.h"
12886 $test $i_termios = "$define" && xxx="termios.h"
12887echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12888 fi
12889fi
12890set i_sysioctl
12891eval $setvar
12892
5f80c64f
JH
12893: see if sys/resource.h has to be included
12894set sys/resource.h i_sysresrc
12895eval $inhdr
12896
12897: see if sys/security.h is available
12898set sys/security.h i_syssecrt
12899eval $inhdr
12900
104d25b7
JH
12901: see if this is a sys/statvfs.h system
12902set sys/statvfs.h i_sysstatvfs
12903eval $inhdr
12904
5f80c64f
JH
12905: see if this is a sys/un.h system
12906set sys/un.h i_sysun
12907eval $inhdr
12908
12909: see if this is a syswait system
12910set sys/wait.h i_syswait
12911eval $inhdr
12912
12913: see if this is an utime system
12914set utime.h i_utime
12915eval $inhdr
12916
12917: see if this is a values.h system
12918set values.h i_values
12919eval $inhdr
12920
12921: see if this is a vfork system
12922case "$d_vfork" in
12923"$define")
12924 set vfork.h i_vfork
12925 eval $inhdr
12926 ;;
12927*)
12928 i_vfork="$undef"
12929 ;;
12930esac
12931
12932: see if gdbm.h is available
12933set gdbm.h t_gdbm
12934eval $inhdr
12935case "$t_gdbm" in
12936$define)
12937 : see if gdbm_open exists
12938 set gdbm_open d_gdbm_open
12939 eval $inlibc
12940 case "$d_gdbm_open" in
12941 $undef)
12942 t_gdbm="$undef"
12943 echo "We won't be including <gdbm.h>"
12944 ;;
12945 esac
12946 ;;
12947esac
12948val="$t_gdbm"
12949set i_gdbm
12950eval $setvar
12951
12952echo " "
12953echo "Looking for extensions..." >&4
5f80c64f
JH
12954: If we are using the old config.sh, known_extensions may contain
12955: old or inaccurate or duplicate values.
12956known_extensions=''
12957nonxs_extensions=''
12958: We do not use find because it might not be available.
12959: We do not just use MANIFEST because the user may have dropped
12960: some additional extensions into the source tree and expect them
12961: to be built.
7e791ca9
NK
12962
12963: Function to recursively find available extensions, ignoring DynaLoader
12964: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
12965find_extensions='
12966 for xxx in *; do
12967 case "$xxx" in
12968 DynaLoader|dynaload) ;;
12969 *)
12970 if $test -f $xxx/$xxx.xs; then
12971 known_extensions="$known_extensions $1$xxx";
12972 elif $test -f $xxx/Makefile.PL; then
12973 nonxs_extensions="$nonxs_extensions $1$xxx";
12974 else
12975 if $test -d $xxx -a $# -lt 10; then
12976 set $1$xxx/ $*;
12977 cd $xxx;
12978 eval $find_extensions;
12979 cd ..;
12980 shift;
9f50e519 12981 fi;
7e791ca9
NK
12982 fi
12983 ;;
9f50e519 12984 esac;
7e791ca9
NK
12985 done'
12986tdir=`pwd`
12987cd $rsrc/ext
a3635516 12988set X
efdb23e1 12989shift
7e791ca9 12990eval $find_extensions
5f80c64f
JH
12991set X $nonxs_extensions
12992shift
12993nonxs_extensions="$*"
12994set X $known_extensions
12995shift
12996known_extensions="$*"
12997cd $tdir
12998
12999: Now see which are supported on this system.
13000avail_ext=''
13001for xxx in $known_extensions ; do
13002 case "$xxx" in
13003 DB_File|db_file)
13004 case "$i_db" in
13005 $define) avail_ext="$avail_ext $xxx" ;;
13006 esac
13007 ;;
13008 GDBM_File|gdbm_fil)
13009 case "$i_gdbm" in
13010 $define) avail_ext="$avail_ext $xxx" ;;
13011 esac
13012 ;;
13013 NDBM_File|ndbm_fil)
13014 case "$i_ndbm" in
13015 $define) avail_ext="$avail_ext $xxx" ;;
13016 esac
13017 ;;
13018 ODBM_File|odbm_fil)
13019 case "${i_dbm}${i_rpcsvcdbm}" in
13020 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13021 esac
13022 ;;
13023 POSIX|posix)
13024 case "$useposix" in
13025 true|define|y) avail_ext="$avail_ext $xxx" ;;
13026 esac
13027 ;;
13028 Opcode|opcode)
13029 case "$useopcode" in
13030 true|define|y) avail_ext="$avail_ext $xxx" ;;
13031 esac
13032 ;;
13033 Socket|socket)
13034 case "$d_socket" in
13035 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13036 esac
13037 ;;
13038 Thread|thread)
13039 case "$usethreads" in
13040 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13041 esac
13042 ;;
13043 IPC/SysV|ipc/sysv)
13044 : XXX Do we need a useipcsysv variable here
13045 case "${d_msg}${d_sem}${d_shm}" in
13046 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13047 esac
13048 ;;
13049 *) avail_ext="$avail_ext $xxx"
13050 ;;
13051 esac
13052done
13053
13054set X $avail_ext
13055shift
13056avail_ext="$*"
13057
13058: Now see which nonxs extensions are supported on this system.
13059: For now assume all are.
13060nonxs_ext=''
13061for xxx in $nonxs_extensions ; do
13062 case "$xxx" in
13063 *) nonxs_ext="$nonxs_ext $xxx"
13064 ;;
13065 esac
13066done
13067
13068set X $nonxs_ext
13069shift
13070nonxs_ext="$*"
13071
13072case $usedl in
13073$define)
13074 $cat <<EOM
13075A number of extensions are supplied with $package. You may choose to
13076compile these extensions for dynamic loading (the default), compile
13077them into the $package executable (static loading), or not include
13078them at all. Answer "none" to include no extensions.
13079Note that DynaLoader is always built and need not be mentioned here.
13080
13081EOM
13082 case "$dynamic_ext" in
13083 '') dflt="$avail_ext" ;;
13084 *) dflt="$dynamic_ext"
13085 # Perhaps we are reusing an old out-of-date config.sh.
13086 case "$hint" in
13087 previous)
13088 if test X"$dynamic_ext" != X"$avail_ext"; then
13089 $cat <<EOM
13090NOTICE: Your previous config.sh list may be incorrect.
13091The extensions now available to you are
13092 ${avail_ext}
13093but the default list from your previous config.sh is
13094 ${dynamic_ext}
13095
13096EOM
13097 fi
13098 ;;
13099 esac
13100 ;;
13101 esac
13102 case "$dflt" in
13103 '') dflt=none;;
13104 esac
13105 rp="What extensions do you wish to load dynamically?"
13106 . ./myread
13107 case "$ans" in
13108 none) dynamic_ext=' ' ;;
13109 *) dynamic_ext="$ans" ;;
13110 esac
13111
13112 case "$static_ext" in
13113 '')
13114 : Exclude those already listed in dynamic linking
13115 dflt=''
13116 for xxx in $avail_ext; do
13117 case " $dynamic_ext " in
13118 *" $xxx "*) ;;
13119 *) dflt="$dflt $xxx" ;;
13120 esac
13121 done
13122 set X $dflt
13123 shift
13124 dflt="$*"
13125 ;;
13126 *) dflt="$static_ext"
13127 ;;
13128 esac
13129
13130 case "$dflt" in
13131 '') dflt=none;;
13132 esac
13133 rp="What extensions do you wish to load statically?"
13134 . ./myread
13135 case "$ans" in
13136 none) static_ext=' ' ;;
13137 *) static_ext="$ans" ;;
13138 esac
13139 ;;
13140*)
13141 $cat <<EOM
13142A number of extensions are supplied with $package. Answer "none"
13143to include no extensions.
13144Note that DynaLoader is always built and need not be mentioned here.
13145
13146EOM
13147 case "$static_ext" in
13148 '') dflt="$avail_ext" ;;
13149 *) dflt="$static_ext"
13150 # Perhaps we are reusing an old out-of-date config.sh.
13151 case "$hint" in
13152 previous)
13153 if test X"$static_ext" != X"$avail_ext"; then
13154 $cat <<EOM
13155NOTICE: Your previous config.sh list may be incorrect.
13156The extensions now available to you are
13157 ${avail_ext}
13158but the default list from your previous config.sh is
13159 ${static_ext}
13160
13161EOM
13162 fi
13163 ;;
13164 esac
13165 ;;
13166 esac
13167 : Exclude those that are not xs extensions
13168 case "$dflt" in
13169 '') dflt=none;;
13170 esac
13171 rp="What extensions do you wish to include?"
13172 . ./myread
13173 case "$ans" in
13174 none) static_ext=' ' ;;
13175 *) static_ext="$ans" ;;
13176 esac
13177 ;;
13178esac
13179
13180set X $dynamic_ext $static_ext $nonxs_ext
13181shift
13182extensions="$*"
13183
13184: Remove build directory name from cppstdin so it can be used from
13185: either the present location or the final installed location.
13186echo " "
13187: Get out of the UU directory to get correct path name.
13188cd ..
13189case "$cppstdin" in
13190`pwd`/cppstdin)
13191 echo "Stripping down cppstdin path name"
13192 cppstdin=cppstdin
13193 ;;
13194esac
13195cd UU
13196
13197: end of configuration questions
13198echo " "
13199echo "End of configuration questions."
13200echo " "
13201
13202: back to where it started
13203if test -d ../UU; then
13204 cd ..
13205fi
13206
13207: configuration may be patched via a 'config.over' file
13208if $test -f config.over; then
13209 echo " "
13210 dflt=y
13211 rp='I see a config.over file. Do you wish to load it?'
13212 . UU/myread
13213 case "$ans" in
13214 n*) echo "OK, I'll ignore it.";;
13215 *) . ./config.over
13216 echo "Configuration override changes have been loaded."
13217 ;;
13218 esac
13219fi
13220
13221: in case they want portability, strip down executable paths
13222case "$d_portable" in
13223"$define")
13224 echo " "
13225 echo "Stripping down executable paths..." >&4
13226 for file in $loclist $trylist; do
534ac15a
JH
13227 eval temp=\$$file
13228 eval $file=`basename $temp`
5f80c64f
JH
13229 done
13230 ;;
13231esac
13232
13233: create config.sh file
13234echo " "
13235echo "Creating config.sh..." >&4
13236$spitshell <<EOT >config.sh
13237$startsh
13238#
13239# This file was produced by running the Configure script. It holds all the
13240# definitions figured out by Configure. Should you modify one of these values,
13241# do not forget to propagate your changes by running "Configure -der". You may
13242# instead choose to run each of the .SH files by yourself, or "Configure -S".
13243#
13244
13245# Package name : $package
13246# Source directory : $src
13247# Configuration time: $cf_time
13248# Configured by : $cf_by
13249# Target system : $myuname
13250
13251Author='$Author'
13252Date='$Date'
13253Header='$Header'
13254Id='$Id'
13255Locker='$Locker'
13256Log='$Log'
13257Mcc='$Mcc'
13258RCSfile='$RCSfile'
13259Revision='$Revision'
13260Source='$Source'
13261State='$State'
13262_a='$_a'
13263_exe='$_exe'
13264_o='$_o'
13265afs='$afs'
13266alignbytes='$alignbytes'
13267ansi2knr='$ansi2knr'
13268aphostname='$aphostname'
13269apiversion='$apiversion'
13270ar='$ar'
13271archlib='$archlib'
13272archlibexp='$archlibexp'
13273archname64='$archname64'
13274archname='$archname'
13275archobjs='$archobjs'
13276awk='$awk'
13277baserev='$baserev'
13278bash='$bash'
13279bin='$bin'
d71b2b6b 13280bincompat5005='$bincompat5005'
5f80c64f
JH
13281binexp='$binexp'
13282bison='$bison'
13283byacc='$byacc'
13284byteorder='$byteorder'
13285c='$c'
13286castflags='$castflags'
13287cat='$cat'
13288cc='$cc'
13289cccdlflags='$cccdlflags'
13290ccdlflags='$ccdlflags'
13291ccflags='$ccflags'
ff49bff8 13292ccsymbols='$ccsymbols'
5f80c64f
JH
13293cf_by='$cf_by'
13294cf_email='$cf_email'
13295cf_time='$cf_time'
13296chgrp='$chgrp'
13297chmod='$chmod'
13298chown='$chown'
13299clocktype='$clocktype'
13300comm='$comm'
13301compress='$compress'
13302contains='$contains'
13303cp='$cp'
13304cpio='$cpio'
13305cpp='$cpp'
13306cpp_stuff='$cpp_stuff'
ff49bff8 13307cppccsymbols='$cppccsymbols'
5f80c64f
JH
13308cppflags='$cppflags'
13309cpplast='$cpplast'
13310cppminus='$cppminus'
13311cpprun='$cpprun'
13312cppstdin='$cppstdin'
ff49bff8 13313cppsymbols='$cppsymbols'
68c15b6f 13314crosscompile='$crosscompile'
5f80c64f
JH
13315cryptlib='$cryptlib'
13316csh='$csh'
13317d_Gconvert='$d_Gconvert'
cf2093f6
JH
13318d_PRIEldbl='$d_PRIEldbl'
13319d_PRIFldbl='$d_PRIFldbl'
13320d_PRIGldbl='$d_PRIGldbl'
13321d_PRIX64='$d_PRIX64'
13322d_PRId64='$d_PRId64'
13323d_PRIeldbl='$d_PRIeldbl'
13324d_PRIfldbl='$d_PRIfldbl'
13325d_PRIgldbl='$d_PRIgldbl'
13326d_PRIi64='$d_PRIi64'
13327d_PRIo64='$d_PRIo64'
13328d_PRIu64='$d_PRIu64'
13329d_PRIx64='$d_PRIx64'
5f80c64f
JH
13330d_access='$d_access'
13331d_accessx='$d_accessx'
13332d_alarm='$d_alarm'
13333d_archlib='$d_archlib'
cf2093f6
JH
13334d_atolf='$d_atolf'
13335d_atoll='$d_atoll'
5f80c64f
JH
13336d_attribut='$d_attribut'
13337d_bcmp='$d_bcmp'
13338d_bcopy='$d_bcopy'
d71b2b6b 13339d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
13340d_bsd='$d_bsd'
13341d_bsdgetpgrp='$d_bsdgetpgrp'
13342d_bsdsetpgrp='$d_bsdsetpgrp'
13343d_bzero='$d_bzero'
13344d_casti32='$d_casti32'
13345d_castneg='$d_castneg'
13346d_charvspr='$d_charvspr'
13347d_chown='$d_chown'
13348d_chroot='$d_chroot'
13349d_chsize='$d_chsize'
13350d_closedir='$d_closedir'
de4597cb 13351d_cmsghdr_s='$d_cmsghdr_s'
5f80c64f
JH
13352d_const='$d_const'
13353d_crypt='$d_crypt'
13354d_csh='$d_csh'
13355d_cuserid='$d_cuserid'
13356d_dbl_dig='$d_dbl_dig'
5f80c64f 13357d_difftime='$d_difftime'
5f80c64f
JH
13358d_dirnamlen='$d_dirnamlen'
13359d_dlerror='$d_dlerror'
13360d_dlopen='$d_dlopen'
13361d_dlsymun='$d_dlsymun'
13362d_dosuid='$d_dosuid'
13363d_drand48proto='$d_drand48proto'
13364d_dup2='$d_dup2'
13365d_eaccess='$d_eaccess'
13366d_endgrent='$d_endgrent'
13367d_endhent='$d_endhent'
13368d_endnent='$d_endnent'
13369d_endpent='$d_endpent'
13370d_endpwent='$d_endpwent'
13371d_endsent='$d_endsent'
f1066039 13372d_endspent='$d_endspent'
5f80c64f
JH
13373d_eofnblk='$d_eofnblk'
13374d_eunice='$d_eunice'
13375d_fchmod='$d_fchmod'
13376d_fchown='$d_fchown'
13377d_fcntl='$d_fcntl'
13378d_fd_macros='$d_fd_macros'
13379d_fd_set='$d_fd_set'
13380d_fds_bits='$d_fds_bits'
5f80c64f 13381d_fgetpos='$d_fgetpos'
5f80c64f 13382d_flexfnam='$d_flexfnam'
5f80c64f 13383d_flock='$d_flock'
5f80c64f
JH
13384d_fork='$d_fork'
13385d_fpathconf='$d_fpathconf'
d9b3e12d 13386d_fpos64_t='$d_fpos64_t'
5f80c64f 13387d_fseeko='$d_fseeko'
5f80c64f 13388d_fsetpos='$d_fsetpos'
104d25b7
JH
13389d_fstatfs='$d_fstatfs'
13390d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
13391d_ftello='$d_ftello'
13392d_ftime='$d_ftime'
5f80c64f
JH
13393d_getgrent='$d_getgrent'
13394d_getgrps='$d_getgrps'
13395d_gethbyaddr='$d_gethbyaddr'
13396d_gethbyname='$d_gethbyname'
13397d_gethent='$d_gethent'
13398d_gethname='$d_gethname'
13399d_gethostprotos='$d_gethostprotos'
13400d_getlogin='$d_getlogin'
ccc7f9b3 13401d_getmntent='$d_getmntent'
5f80c64f
JH
13402d_getnbyaddr='$d_getnbyaddr'
13403d_getnbyname='$d_getnbyname'
13404d_getnent='$d_getnent'
13405d_getnetprotos='$d_getnetprotos'
13406d_getpbyname='$d_getpbyname'
13407d_getpbynumber='$d_getpbynumber'
13408d_getpent='$d_getpent'
13409d_getpgid='$d_getpgid'
13410d_getpgrp2='$d_getpgrp2'
13411d_getpgrp='$d_getpgrp'
13412d_getppid='$d_getppid'
13413d_getprior='$d_getprior'
13414d_getprotoprotos='$d_getprotoprotos'
13415d_getpwent='$d_getpwent'
13416d_getsbyname='$d_getsbyname'
13417d_getsbyport='$d_getsbyport'
13418d_getsent='$d_getsent'
13419d_getservprotos='$d_getservprotos'
f1066039
JH
13420d_getspent='$d_getspent'
13421d_getspnam='$d_getspnam'
5f80c64f
JH
13422d_gettimeod='$d_gettimeod'
13423d_gnulibc='$d_gnulibc'
13424d_grpasswd='$d_grpasswd'
ccc7f9b3 13425d_hasmntopt='$d_hasmntopt'
5f80c64f
JH
13426d_htonl='$d_htonl'
13427d_index='$d_index'
13428d_inetaton='$d_inetaton'
5f80c64f 13429d_int64t='$d_int64t'
de4597cb 13430d_iovec_s='$d_iovec_s'
5f80c64f
JH
13431d_isascii='$d_isascii'
13432d_killpg='$d_killpg'
13433d_lchown='$d_lchown'
2d4389e4 13434d_ldbl_dig='$d_ldbl_dig'
5f80c64f 13435d_link='$d_link'
2000072c 13436d_llseek='$d_llseek'
5f80c64f 13437d_locconv='$d_locconv'
5f80c64f
JH
13438d_lockf='$d_lockf'
13439d_longdbl='$d_longdbl'
13440d_longlong='$d_longlong'
5f80c64f 13441d_lstat='$d_lstat'
ff49bff8 13442d_madvise='$d_madvise'
5f80c64f
JH
13443d_mblen='$d_mblen'
13444d_mbstowcs='$d_mbstowcs'
13445d_mbtowc='$d_mbtowc'
0f27ced1 13446d_memchr='$d_memchr'
5f80c64f
JH
13447d_memcmp='$d_memcmp'
13448d_memcpy='$d_memcpy'
13449d_memmove='$d_memmove'
13450d_memset='$d_memset'
13451d_mkdir='$d_mkdir'
13452d_mkfifo='$d_mkfifo'
13453d_mktime='$d_mktime'
ff49bff8
JH
13454d_mmap='$d_mmap'
13455d_mprotect='$d_mprotect'
5f80c64f 13456d_msg='$d_msg'
de4597cb
JH
13457d_msg_ctrunc='$d_msg_ctrunc'
13458d_msg_dontroute='$d_msg_dontroute'
13459d_msg_oob='$d_msg_oob'
13460d_msg_peek='$d_msg_peek'
13461d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
13462d_msgctl='$d_msgctl'
13463d_msgget='$d_msgget'
de4597cb 13464d_msghdr_s='$d_msghdr_s'
5f80c64f
JH
13465d_msgrcv='$d_msgrcv'
13466d_msgsnd='$d_msgsnd'
ff49bff8
JH
13467d_msync='$d_msync'
13468d_munmap='$d_munmap'
5f80c64f 13469d_mymalloc='$d_mymalloc'
5f80c64f 13470d_nice='$d_nice'
2000072c 13471d_off64_t='$d_off64_t'
ef4af2be 13472d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
13473d_oldpthreads='$d_oldpthreads'
13474d_oldsock='$d_oldsock'
13475d_open3='$d_open3'
5f80c64f
JH
13476d_pathconf='$d_pathconf'
13477d_pause='$d_pause'
13478d_phostname='$d_phostname'
13479d_pipe='$d_pipe'
13480d_poll='$d_poll'
13481d_portable='$d_portable'
13482d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
13483d_pwage='$d_pwage'
13484d_pwchange='$d_pwchange'
13485d_pwclass='$d_pwclass'
13486d_pwcomment='$d_pwcomment'
13487d_pwexpire='$d_pwexpire'
13488d_pwgecos='$d_pwgecos'
13489d_pwpasswd='$d_pwpasswd'
13490d_pwquota='$d_pwquota'
5f80c64f
JH
13491d_readdir='$d_readdir'
13492d_readlink='$d_readlink'
de4597cb
JH
13493d_readv='$d_readv'
13494d_recvmsg='$d_recvmsg'
5f80c64f
JH
13495d_rename='$d_rename'
13496d_rewinddir='$d_rewinddir'
13497d_rmdir='$d_rmdir'
13498d_safebcpy='$d_safebcpy'
13499d_safemcpy='$d_safemcpy'
13500d_sanemcmp='$d_sanemcmp'
13501d_sched_yield='$d_sched_yield'
de4597cb 13502d_scm_rights='$d_scm_rights'
5f80c64f
JH
13503d_seekdir='$d_seekdir'
13504d_select='$d_select'
13505d_sem='$d_sem'
13506d_semctl='$d_semctl'
13507d_semctl_semid_ds='$d_semctl_semid_ds'
13508d_semctl_semun='$d_semctl_semun'
13509d_semget='$d_semget'
13510d_semop='$d_semop'
de4597cb 13511d_sendmsg='$d_sendmsg'
5f80c64f
JH
13512d_setegid='$d_setegid'
13513d_seteuid='$d_seteuid'
13514d_setgrent='$d_setgrent'
13515d_setgrps='$d_setgrps'
13516d_sethent='$d_sethent'
13517d_setlinebuf='$d_setlinebuf'
13518d_setlocale='$d_setlocale'
13519d_setnent='$d_setnent'
13520d_setpent='$d_setpent'
13521d_setpgid='$d_setpgid'
13522d_setpgrp2='$d_setpgrp2'
13523d_setpgrp='$d_setpgrp'
13524d_setprior='$d_setprior'
13525d_setpwent='$d_setpwent'
13526d_setregid='$d_setregid'
13527d_setresgid='$d_setresgid'
13528d_setresuid='$d_setresuid'
13529d_setreuid='$d_setreuid'
13530d_setrgid='$d_setrgid'
13531d_setruid='$d_setruid'
13532d_setsent='$d_setsent'
13533d_setsid='$d_setsid'
f1066039 13534d_setspent='$d_setspent'
5f80c64f
JH
13535d_setvbuf='$d_setvbuf'
13536d_sfio='$d_sfio'
13537d_shm='$d_shm'
13538d_shmat='$d_shmat'
13539d_shmatprototype='$d_shmatprototype'
13540d_shmctl='$d_shmctl'
13541d_shmdt='$d_shmdt'
13542d_shmget='$d_shmget'
13543d_sigaction='$d_sigaction'
13544d_sigsetjmp='$d_sigsetjmp'
13545d_socket='$d_socket'
13546d_sockpair='$d_sockpair'
5f80c64f 13547d_statblks='$d_statblks'
104d25b7
JH
13548d_statfs='$d_statfs'
13549d_statfsflags='$d_statfsflags'
13550d_statvfs='$d_statvfs'
5f80c64f
JH
13551d_stdio_cnt_lval='$d_stdio_cnt_lval'
13552d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 13553d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
13554d_stdiobase='$d_stdiobase'
13555d_stdstdio='$d_stdstdio'
5f80c64f
JH
13556d_strchr='$d_strchr'
13557d_strcoll='$d_strcoll'
13558d_strctcpy='$d_strctcpy'
13559d_strerrm='$d_strerrm'
13560d_strerror='$d_strerror'
13561d_strtod='$d_strtod'
13562d_strtol='$d_strtol'
13563d_strtoul='$d_strtoul'
cf2093f6 13564d_strtoull='$d_strtoull'
5f80c64f
JH
13565d_strxfrm='$d_strxfrm'
13566d_suidsafe='$d_suidsafe'
13567d_symlink='$d_symlink'
13568d_syscall='$d_syscall'
13569d_sysconf='$d_sysconf'
13570d_sysernlst='$d_sysernlst'
13571d_syserrlst='$d_syserrlst'
13572d_system='$d_system'
13573d_tcgetpgrp='$d_tcgetpgrp'
13574d_tcsetpgrp='$d_tcsetpgrp'
5f80c64f 13575d_telldir='$d_telldir'
cb86ce0e 13576d_telldirproto='$d_telldirproto'
5f80c64f
JH
13577d_time='$d_time'
13578d_times='$d_times'
5f80c64f
JH
13579d_truncate='$d_truncate'
13580d_tzname='$d_tzname'
13581d_umask='$d_umask'
13582d_uname='$d_uname'
13583d_union_semun='$d_union_semun'
a3635516 13584d_vendorlib='$d_vendorlib'
5f80c64f
JH
13585d_vfork='$d_vfork'
13586d_void_closedir='$d_void_closedir'
13587d_voidsig='$d_voidsig'
13588d_voidtty='$d_voidtty'
13589d_volatile='$d_volatile'
13590d_vprintf='$d_vprintf'
13591d_wait4='$d_wait4'
13592d_waitpid='$d_waitpid'
13593d_wcstombs='$d_wcstombs'
13594d_wctomb='$d_wctomb'
de4597cb 13595d_writev='$d_writev'
5f80c64f
JH
13596d_xenix='$d_xenix'
13597date='$date'
13598db_hashtype='$db_hashtype'
13599db_prefixtype='$db_prefixtype'
13600defvoidused='$defvoidused'
13601direntrytype='$direntrytype'
13602dlext='$dlext'
13603dlsrc='$dlsrc'
13604doublesize='$doublesize'
13605drand01='$drand01'
13606dynamic_ext='$dynamic_ext'
13607eagain='$eagain'
13608ebcdic='$ebcdic'
13609echo='$echo'
13610egrep='$egrep'
13611emacs='$emacs'
13612eunicefix='$eunicefix'
13613exe_ext='$exe_ext'
13614expr='$expr'
13615extensions='$extensions'
66fe083f 13616fflushNULL='$fflushNULL'
767df6a1 13617fflushall='$fflushall'
5f80c64f
JH
13618find='$find'
13619firstmakefile='$firstmakefile'
13620flex='$flex'
13621fpostype='$fpostype'
13622freetype='$freetype'
ccc7f9b3 13623full_ar='$full_ar'
5f80c64f
JH
13624full_csh='$full_csh'
13625full_sed='$full_sed'
13626gccversion='$gccversion'
13627gidtype='$gidtype'
13628glibpth='$glibpth'
13629grep='$grep'
13630groupcat='$groupcat'
13631groupstype='$groupstype'
13632gzip='$gzip'
13633h_fcntl='$h_fcntl'
13634h_sysfile='$h_sysfile'
13635hint='$hint'
13636hostcat='$hostcat'
13637huge='$huge'
13638i_arpainet='$i_arpainet'
13639i_bsdioctl='$i_bsdioctl'
13640i_db='$i_db'
13641i_dbm='$i_dbm'
13642i_dirent='$i_dirent'
13643i_dld='$i_dld'
13644i_dlfcn='$i_dlfcn'
13645i_fcntl='$i_fcntl'
13646i_float='$i_float'
13647i_gdbm='$i_gdbm'
13648i_grp='$i_grp'
13649i_inttypes='$i_inttypes'
13650i_limits='$i_limits'
13651i_locale='$i_locale'
7f3d1cf1 13652i_machcthr='$i_machcthr'
5f80c64f
JH
13653i_malloc='$i_malloc'
13654i_math='$i_math'
13655i_memory='$i_memory'
e7fb4fcc 13656i_mntent='$i_mntent'
5f80c64f
JH
13657i_ndbm='$i_ndbm'
13658i_netdb='$i_netdb'
13659i_neterrno='$i_neterrno'
9cc6feab 13660i_netinettcp='$i_netinettcp'
5f80c64f 13661i_niin='$i_niin'
5b34fd99 13662i_poll='$i_poll'
c4747d3e 13663i_pthread='$i_pthread'
5f80c64f
JH
13664i_pwd='$i_pwd'
13665i_rpcsvcdbm='$i_rpcsvcdbm'
13666i_sfio='$i_sfio'
13667i_sgtty='$i_sgtty'
f1066039 13668i_shadow='$i_shadow'
86959918 13669i_socks='$i_socks'
5f80c64f
JH
13670i_stdarg='$i_stdarg'
13671i_stddef='$i_stddef'
13672i_stdlib='$i_stdlib'
13673i_string='$i_string'
13674i_sysaccess='$i_sysaccess'
13675i_sysdir='$i_sysdir'
13676i_sysfile='$i_sysfile'
13677i_sysfilio='$i_sysfilio'
13678i_sysin='$i_sysin'
13679i_sysioctl='$i_sysioctl'
ff49bff8 13680i_sysmman='$i_sysmman'
104d25b7 13681i_sysmount='$i_sysmount'
5f80c64f
JH
13682i_sysndir='$i_sysndir'
13683i_sysparam='$i_sysparam'
13684i_sysresrc='$i_sysresrc'
13685i_syssecrt='$i_syssecrt'
13686i_sysselct='$i_sysselct'
13687i_syssockio='$i_syssockio'
13688i_sysstat='$i_sysstat'
104d25b7 13689i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
13690i_systime='$i_systime'
13691i_systimek='$i_systimek'
13692i_systimes='$i_systimes'
13693i_systypes='$i_systypes'
de4597cb 13694i_sysuio='$i_sysuio'
5f80c64f
JH
13695i_sysun='$i_sysun'
13696i_syswait='$i_syswait'
13697i_termio='$i_termio'
13698i_termios='$i_termios'
13699i_time='$i_time'
13700i_unistd='$i_unistd'
13701i_utime='$i_utime'
13702i_values='$i_values'
13703i_varargs='$i_varargs'
13704i_varhdr='$i_varhdr'
13705i_vfork='$i_vfork'
13706ignore_versioned_solibs='$ignore_versioned_solibs'
13707incpath='$incpath'
13708inews='$inews'
13709installarchlib='$installarchlib'
13710installbin='$installbin'
13711installman1dir='$installman1dir'
13712installman3dir='$installman3dir'
dd4e71fd
JH
13713installprefix='$installprefix'
13714installprefixexp='$installprefixexp'
5f80c64f
JH
13715installprivlib='$installprivlib'
13716installscript='$installscript'
13717installsitearch='$installsitearch'
13718installsitelib='$installsitelib'
dd4e71fd 13719installstyle='$installstyle'
104d25b7 13720installusrbinperl='$installusrbinperl'
a3635516 13721installvendorlib='$installvendorlib'
5f80c64f
JH
13722intsize='$intsize'
13723known_extensions='$known_extensions'
13724ksh='$ksh'
13725large='$large'
13726ld='$ld'
13727lddlflags='$lddlflags'
13728ldflags='$ldflags'
5cf1d1f1 13729ldlibpthname='$ldlibpthname'
5f80c64f
JH
13730less='$less'
13731lib_ext='$lib_ext'
13732libc='$libc'
13733libperl='$libperl'
13734libpth='$libpth'
13735libs='$libs'
13736libswanted='$libswanted'
13737line='$line'
13738lint='$lint'
13739lkflags='$lkflags'
13740ln='$ln'
13741lns='$lns'
13742locincpth='$locincpth'
13743loclibpth='$loclibpth'
13744longdblsize='$longdblsize'
13745longlongsize='$longlongsize'
13746longsize='$longsize'
13747lp='$lp'
13748lpr='$lpr'
13749ls='$ls'
13750lseeksize='$lseeksize'
13751lseektype='$lseektype'
13752mail='$mail'
13753mailx='$mailx'
13754make='$make'
13755make_set_make='$make_set_make'
13756mallocobj='$mallocobj'
13757mallocsrc='$mallocsrc'
13758malloctype='$malloctype'
13759man1dir='$man1dir'
13760man1direxp='$man1direxp'
13761man1ext='$man1ext'
13762man3dir='$man3dir'
13763man3direxp='$man3direxp'
13764man3ext='$man3ext'
13765medium='$medium'
13766mips='$mips'
13767mips_type='$mips_type'
13768mkdir='$mkdir'
ff49bff8 13769mmaptype='$mmaptype'
5f80c64f
JH
13770models='$models'
13771modetype='$modetype'
13772more='$more'
68c15b6f 13773multiarch='$multiarch'
5f80c64f
JH
13774mv='$mv'
13775myarchname='$myarchname'
13776mydomain='$mydomain'
13777myhostname='$myhostname'
13778myuname='$myuname'
13779n='$n'
13780netdb_hlen_type='$netdb_hlen_type'
13781netdb_host_type='$netdb_host_type'
13782netdb_name_type='$netdb_name_type'
13783netdb_net_type='$netdb_net_type'
13784nm='$nm'
13785nm_opt='$nm_opt'
13786nm_so_opt='$nm_so_opt'
13787nonxs_ext='$nonxs_ext'
13788nroff='$nroff'
13789o_nonblock='$o_nonblock'
13790obj_ext='$obj_ext'
ef4af2be 13791old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
13792optimize='$optimize'
13793orderlib='$orderlib'
13794osname='$osname'
13795osvers='$osvers'
13796package='$package'
13797pager='$pager'
13798passcat='$passcat'
13799patchlevel='$patchlevel'
13800path_sep='$path_sep'
13801perl='$perl'
13802perladmin='$perladmin'
13803perlpath='$perlpath'
13804pg='$pg'
13805phostname='$phostname'
13806pidtype='$pidtype'
13807plibpth='$plibpth'
13808pmake='$pmake'
13809pr='$pr'
13810prefix='$prefix'
13811prefixexp='$prefixexp'
13812privlib='$privlib'
13813privlibexp='$privlibexp'
13814prototype='$prototype'
13815ptrsize='$ptrsize'
13816randbits='$randbits'
13817randfunc='$randfunc'
13818randseedtype='$randseedtype'
13819ranlib='$ranlib'
13820rd_nodata='$rd_nodata'
13821rm='$rm'
13822rmail='$rmail'
13823runnm='$runnm'
cf2093f6
JH
13824sPRIEldbl='$sPRIEldbl'
13825sPRIFldbl='$sPRIFldbl'
13826sPRIGldbl='$sPRIGldbl'
13827sPRIX64='$sPRIX64'
13828sPRId64='$sPRId64'
13829sPRIeldbl='$sPRIeldbl'
13830sPRIfldbl='$sPRIfldbl'
13831sPRIgldbl='$sPRIgldbl'
13832sPRIi64='$sPRIi64'
13833sPRIo64='$sPRIo64'
13834sPRIu64='$sPRIu64'
13835sPRIx64='$sPRIx64'
5f80c64f
JH
13836sched_yield='$sched_yield'
13837scriptdir='$scriptdir'
13838scriptdirexp='$scriptdirexp'
13839sed='$sed'
13840seedfunc='$seedfunc'
13841selectminbits='$selectminbits'
13842selecttype='$selecttype'
13843sendmail='$sendmail'
13844sh='$sh'
13845shar='$shar'
13846sharpbang='$sharpbang'
13847shmattype='$shmattype'
13848shortsize='$shortsize'
13849shrpenv='$shrpenv'
13850shsharp='$shsharp'
af4c28eb 13851sig_count='$sig_count'
5f80c64f
JH
13852sig_name='$sig_name'
13853sig_name_init='$sig_name_init'
13854sig_num='$sig_num'
824a2ba3 13855sig_num_init='$sig_num_init'
5f80c64f
JH
13856signal_t='$signal_t'
13857sitearch='$sitearch'
13858sitearchexp='$sitearchexp'
13859sitelib='$sitelib'
13860sitelibexp='$sitelibexp'
dd4e71fd
JH
13861siteprefix='$siteprefix'
13862siteprefixexp='$siteprefixexp'
5f80c64f
JH
13863sizetype='$sizetype'
13864sleep='$sleep'
13865smail='$smail'
13866small='$small'
13867so='$so'
13868sockethdr='$sockethdr'
13869socketlib='$socketlib'
13870sort='$sort'
13871spackage='$spackage'
13872spitshell='$spitshell'
13873split='$split'
13874src='$src'
13875ssizetype='$ssizetype'
13876startperl='$startperl'
13877startsh='$startsh'
13878static_ext='$static_ext'
13879stdchar='$stdchar'
13880stdio_base='$stdio_base'
13881stdio_bufsiz='$stdio_bufsiz'
13882stdio_cnt='$stdio_cnt'
13883stdio_filbuf='$stdio_filbuf'
13884stdio_ptr='$stdio_ptr'
767df6a1 13885stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
13886strings='$strings'
13887submit='$submit'
13888subversion='$subversion'
13889sysman='$sysman'
13890tail='$tail'
13891tar='$tar'
13892tbl='$tbl'
13893tee='$tee'
13894test='$test'
13895timeincl='$timeincl'
13896timetype='$timetype'
13897touch='$touch'
13898tr='$tr'
13899trnl='$trnl'
13900troff='$troff'
13901uidtype='$uidtype'
13902uname='$uname'
13903uniq='$uniq'
13904use64bits='$use64bits'
13905usedl='$usedl'
b0ce926a 13906uselongdouble='$uselongdouble'
5f80c64f
JH
13907usemultiplicity='$usemultiplicity'
13908usemymalloc='$usemymalloc'
13909usenm='$usenm'
13910useopcode='$useopcode'
13911useperlio='$useperlio'
13912useposix='$useposix'
13913usesfio='$usesfio'
13914useshrplib='$useshrplib'
29209bc5 13915usesocks='$usesocks'
5f80c64f 13916usethreads='$usethreads'
a3635516 13917usevendorprefix='$usevendorprefix'
5f80c64f
JH
13918usevfork='$usevfork'
13919usrinc='$usrinc'
13920uuname='$uuname'
a3635516
JH
13921vendorlib='$vendorlib'
13922vendorlibexp='$vendorlibexp'
13923vendorprefix='$vendorprefix'
13924vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
13925version='$version'
13926vi='$vi'
13927voidflags='$voidflags'
13928xlibpth='$xlibpth'
13929zcat='$zcat'
13930zip='$zip'
13931EOT
13932
13933: Add in command line options if available
13934$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13935
13936: add special variables
13937$test -f $src/patchlevel.h && \
d00b958f 13938awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 13939echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
13940
13941: propagate old symbols
13942if $test -f UU/config.sh; then
13943 <UU/config.sh sort | uniq >UU/oldconfig.sh
13944 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13945 sort | uniq -u >UU/oldsyms
13946 set X `cat UU/oldsyms`
13947 shift
13948 case $# in
13949 0) ;;
13950 *)
13951 cat <<EOM
13952Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13953EOM
13954 echo "# Variables propagated from previous config.sh file." >>config.sh
13955 for sym in `cat UU/oldsyms`; do
13956 echo " Propagating $hint variable "'$'"$sym..."
13957 eval 'tmp="$'"${sym}"'"'
13958 echo "$tmp" | \
13959 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13960 done
13961 ;;
13962 esac
13963fi
13964
13965: Finish up by extracting the .SH files
13966case "$alldone" in
13967exit)
13968 $rm -rf UU
13969 echo "Done."
13970 exit 0
13971 ;;
13972cont)
13973 ;;
13974'')
13975 dflt=''
13976 nostick=true
13977 $cat <<EOM
13978
13979If you'd like to make any changes to the config.sh file before I begin
13980to configure things, do it as a shell escape now (e.g. !vi config.sh).
13981
13982EOM
13983 rp="Press return or use a shell escape to edit config.sh:"
13984 . UU/myread
13985 nostick=''
13986 case "$ans" in
13987 '') ;;
13988 *) : in case they cannot read
13989 sh 1>&4 -c "$ans";;
13990 esac
13991 ;;
13992esac
13993
13994: if this fails, just run all the .SH files by hand
13995. ./config.sh
13996
13997echo " "
13998exec 1>&4
13999. ./UU/extract
14000
14001if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14002 dflt=y
14003 case "$silent" in
14004 true) ;;
14005 *)
14006 $cat <<EOM
14007
14008Now you need to generate make dependencies by running "$make depend".
14009You might prefer to run it in background: "$make depend > makedepend.out &"
14010It can take a while, so you might not want to run it right now.
14011
14012EOM
14013 ;;
14014 esac
14015 rp="Run $make depend now?"
14016 . UU/myread
14017 case "$ans" in
14018 y*)
14019 $make depend && echo "Now you must run a $make."
14020 ;;
14021 *)
14022 echo "You must run '$make depend' then '$make'."
14023 ;;
14024 esac
14025elif test -f [Mm]akefile; then
14026 echo " "
14027 echo "Now you must run a $make."
14028else
14029 echo "Done."
14030fi
14031
14032if $test -f Policy.sh; then
14033 $cat <<EOM
14034
14035If you compile $package on a different machine or from a different object
14036directory, copy the Policy.sh file from this object directory to the
14037new one before you run Configure -- this will help you with most of
14038the policy defaults.
14039
14040EOM
14041fi
14042if $test -f config.msg; then
14043 echo "Hmm. I also noted the following information while running:"
14044 echo " "
14045 $cat config.msg >&4
14046 $rm -f config.msg
14047fi
14048$rm -f kit*isdone ark*isdone
14049$rm -rf UU
14050
14051: End of Configure
14052