This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Todo update.
[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#
6e58d65c 23# Generated on Mon Aug 2 17:42:55 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=''
2304df62 402d_link=''
a0d0e21e
LW
403d_locconv=''
404d_lockf=''
e5c9fcd0
AD
405d_longdbl=''
406longdblsize=''
dc45a647
MB
407d_longlong=''
408longlongsize=''
2304df62 409d_lstat=''
ff49bff8 410d_madvise=''
a0d0e21e
LW
411d_mblen=''
412d_mbstowcs=''
413d_mbtowc=''
0f27ced1 414d_memchr=''
2304df62
AD
415d_memcmp=''
416d_memcpy=''
417d_memmove=''
418d_memset=''
419d_mkdir=''
a0d0e21e
LW
420d_mkfifo=''
421d_mktime=''
ff49bff8
JH
422d_mmap=''
423mmaptype=''
424d_mprotect=''
2304df62
AD
425d_msg=''
426d_msgctl=''
427d_msgget=''
428d_msgrcv=''
429d_msgsnd=''
ff49bff8
JH
430d_msync=''
431d_munmap=''
a0d0e21e 432d_nice=''
2304df62 433d_open3=''
a0d0e21e
LW
434d_fpathconf=''
435d_pathconf=''
436d_pause=''
437d_pipe=''
8e07c86e 438d_poll=''
2304df62 439d_portable=''
ef4af2be
JH
440d_old_pthread_create_joinable=''
441old_pthread_create_joinable=''
dfe9444c
AD
442d_pthread_yield=''
443d_sched_yield=''
1cfa4ec7 444sched_yield=''
2304df62 445d_readdir=''
85e6fe83
LW
446d_rewinddir=''
447d_seekdir=''
448d_telldir=''
a0d0e21e 449d_readlink=''
de4597cb 450d_readv=''
2304df62
AD
451d_rename=''
452d_rmdir=''
453d_safebcpy=''
454d_safemcpy=''
36477c24 455d_sanemcmp=''
2304df62
AD
456d_select=''
457d_sem=''
458d_semctl=''
459d_semget=''
460d_semop=''
461d_setegid=''
462d_seteuid=''
5ff3f7a4 463d_setgrent=''
dfe9444c 464d_setgrps=''
693762b4 465d_sethent=''
a0d0e21e 466d_setlinebuf=''
2304df62 467d_setlocale=''
e5c9fcd0
AD
468d_setnent=''
469d_setpent=''
2304df62
AD
470d_setpgid=''
471d_setpgrp2=''
2afac517 472d_bsdsetpgrp=''
2304df62
AD
473d_setpgrp=''
474d_setprior=''
5ff3f7a4 475d_setpwent=''
2304df62
AD
476d_setregid=''
477d_setresgid=''
478d_setresuid=''
479d_setreuid=''
480d_setrgid=''
481d_setruid=''
e5c9fcd0 482d_setsent=''
2304df62 483d_setsid=''
f1066039 484d_setspent=''
e5c9fcd0 485d_setvbuf=''
760ac839 486d_sfio=''
8ff267be 487usesfio=''
2304df62
AD
488d_shm=''
489d_shmat=''
a0d0e21e
LW
490d_shmatprototype=''
491shmattype=''
2304df62
AD
492d_shmctl=''
493d_shmdt=''
494d_shmget=''
2c7991dc 495d_sigaction=''
8ff267be 496d_sigsetjmp=''
de4597cb
JH
497d_cmsghdr_s=''
498d_msg_ctrunc=''
499d_msg_dontroute=''
500d_msg_oob=''
501d_msg_peek=''
502d_msg_proxy=''
503d_msghdr_s=''
2304df62 504d_oldsock=''
de4597cb
JH
505d_recvmsg=''
506d_scm_rights=''
507d_sendmsg=''
2304df62
AD
508d_socket=''
509d_sockpair=''
510sockethdr=''
511socketlib=''
512d_statblks=''
104d25b7
JH
513d_fstatfs=''
514d_statfs=''
515d_statfsflags=''
516d_fstatvfs=''
517d_statvfs=''
c2960299
AD
518d_stdio_cnt_lval=''
519d_stdio_ptr_lval=''
16d20bd9 520d_stdiobase=''
2304df62 521d_stdstdio=''
16d20bd9
AD
522stdio_base=''
523stdio_bufsiz=''
524stdio_cnt=''
dfe9444c 525stdio_filbuf=''
16d20bd9 526stdio_ptr=''
2304df62
AD
527d_index=''
528d_strchr=''
a0d0e21e 529d_strcoll=''
2304df62
AD
530d_strctcpy=''
531d_strerrm=''
532d_strerror=''
533d_sysernlst=''
534d_syserrlst=''
a89d8a78
DH
535d_strtod=''
536d_strtol=''
537d_strtoul=''
a0d0e21e 538d_strxfrm=''
2304df62
AD
539d_symlink=''
540d_syscall=''
a0d0e21e 541d_sysconf=''
2304df62 542d_system=''
a0d0e21e
LW
543d_tcgetpgrp=''
544d_tcsetpgrp=''
cb86ce0e 545d_telldirproto=''
85e6fe83
LW
546d_time=''
547timetype=''
2304df62
AD
548clocktype=''
549d_times=''
550d_truncate=''
a0d0e21e
LW
551d_tzname=''
552d_umask=''
bd89102f
AD
553d_semctl_semid_ds=''
554d_semctl_semun=''
555d_union_semun=''
2304df62 556d_vfork=''
a0d0e21e 557usevfork=''
2304df62
AD
558d_voidsig=''
559signal_t=''
560d_volatile=''
561d_charvspr=''
562d_vprintf=''
563d_wait4=''
564d_waitpid=''
a0d0e21e
LW
565d_wcstombs=''
566d_wctomb=''
de4597cb 567d_writev=''
5ff3f7a4
GS
568d_dbmclose64=''
569d_dbminit64=''
570d_delete64=''
571d_fetch64=''
572d_firstkey64=''
573d_nextkey64=''
574d_store64=''
a0d0e21e 575dlext=''
85e6fe83
LW
576cccdlflags=''
577ccdlflags=''
2304df62 578dlsrc=''
232e078e 579ld=''
85e6fe83 580lddlflags=''
2304df62 581usedl=''
693762b4 582doublesize=''
5ff3f7a4 583ebcdic=''
66fe083f 584fflushNULL=''
767df6a1 585fflushall=''
a0d0e21e 586fpostype=''
2304df62
AD
587gidtype=''
588groupstype=''
589h_fcntl=''
590h_sysfile=''
5ff3f7a4 591i_arpainet=''
ecfc5424
AD
592db_hashtype=''
593db_prefixtype=''
a0d0e21e 594i_db=''
2304df62 595i_dbm=''
8e07c86e 596i_rpcsvcdbm=''
2304df62 597d_dirnamlen=''
a0d0e21e 598direntrytype=''
2304df62 599i_dirent=''
a0d0e21e 600i_dld=''
2304df62
AD
601i_dlfcn=''
602i_fcntl=''
a0d0e21e 603i_float=''
2304df62 604i_gdbm=''
28e8609d 605d_grpasswd=''
2304df62 606i_grp=''
5ff3f7a4
GS
607d_int64t=''
608i_inttypes=''
a0d0e21e 609i_limits=''
4633a7c4 610i_locale=''
7f3d1cf1 611i_machcthr=''
a0d0e21e
LW
612i_malloc=''
613i_math=''
85e6fe83 614i_memory=''
e7fb4fcc 615i_mntent=''
2304df62 616i_ndbm=''
3fd537d4 617i_netdb=''
85e6fe83 618i_neterrno=''
9cc6feab 619i_netinettcp=''
2304df62
AD
620i_niin=''
621i_sysin=''
5b34fd99 622i_poll=''
c4747d3e 623i_pthread=''
2304df62
AD
624d_pwage=''
625d_pwchange=''
626d_pwclass=''
627d_pwcomment=''
628d_pwexpire=''
c4f23d77 629d_pwgecos=''
28e8609d 630d_pwpasswd=''
2304df62
AD
631d_pwquota=''
632i_pwd=''
760ac839 633i_sfio=''
f1066039 634i_shadow=''
86959918 635i_socks=''
2304df62 636i_stddef=''
a0d0e21e 637i_stdlib=''
2304df62
AD
638i_string=''
639strings=''
5ff3f7a4 640i_sysaccess=''
2304df62
AD
641i_sysdir=''
642i_sysfile=''
643d_voidtty=''
644i_bsdioctl=''
a0d0e21e 645i_sysfilio=''
2304df62
AD
646i_sysioctl=''
647i_syssockio=''
ff49bff8 648i_sysmman=''
104d25b7 649i_sysmount=''
2304df62 650i_sysndir=''
a0d0e21e 651i_sysparam=''
8ff267be 652i_sysresrc=''
5ff3f7a4 653i_syssecrt=''
2304df62 654i_sysselct=''
1aef975c 655i_sysstat=''
104d25b7 656i_sysstatvfs=''
a0d0e21e 657i_systimes=''
fed7345c 658i_systypes=''
de4597cb
JH
659d_iovec_s=''
660i_sysuio=''
25f94b33 661i_sysun=''
8ff267be 662i_syswait=''
2304df62
AD
663i_sgtty=''
664i_termio=''
665i_termios=''
666i_systime=''
667i_systimek=''
668i_time=''
669timeincl=''
85e6fe83 670i_unistd=''
2304df62 671i_utime=''
760ac839 672i_values=''
a0d0e21e 673i_stdarg=''
2304df62
AD
674i_varargs=''
675i_varhdr=''
676i_vfork=''
dd4e71fd
JH
677installprefix=''
678installprefixexp=''
679installstyle=''
104d25b7 680installusrbinperl=''
2304df62 681intsize=''
24fef2a7
AD
682longsize=''
683shortsize=''
de4597cb
JH
684d_dirent64_s=''
685d_flock64_s=''
5ff3f7a4
GS
686d_fstat64=''
687d_ftruncate64=''
2000072c
JH
688d_ino64_t=''
689d_llseek=''
5ff3f7a4
GS
690d_lockf64=''
691d_lseek64=''
692d_lstat64=''
2000072c
JH
693d_off64_t=''
694d_offset_t=''
5ff3f7a4
GS
695d_open64=''
696d_opendir64=''
697d_readdir64=''
698d_seekdir64=''
699d_stat64=''
700d_telldir64=''
701d_truncate64=''
2304df62 702libc=''
5cf1d1f1 703ldlibpthname=''
8ff267be 704libperl=''
2afac517 705shrpenv=''
8ff267be 706useshrplib=''
a0d0e21e 707glibpth=''
2304df62 708libpth=''
8e07c86e 709loclibpth=''
2304df62
AD
710plibpth=''
711xlibpth=''
1cfa4ec7 712ignore_versioned_solibs=''
2304df62 713libs=''
85e6fe83 714lns=''
cf2093f6
JH
715d_PRIEldbl=''
716d_PRIFldbl=''
717d_PRIGldbl=''
718d_PRIeldbl=''
719d_PRIfldbl=''
720d_PRIgldbl=''
721sPRIEldbl=''
722sPRIFldbl=''
723sPRIGldbl=''
724sPRIeldbl=''
725sPRIfldbl=''
726sPRIgldbl=''
5ff3f7a4 727lseeksize=''
85e6fe83 728lseektype=''
8ff267be 729make_set_make=''
85e6fe83 730d_mymalloc=''
94b6baf5 731freetype=''
2304df62
AD
732mallocobj=''
733mallocsrc=''
734malloctype=''
735usemymalloc=''
16d20bd9
AD
736installman1dir=''
737man1dir=''
738man1direxp=''
739man1ext=''
740installman3dir=''
741man3dir=''
742man3direxp=''
743man3ext=''
2304df62
AD
744huge=''
745large=''
746medium=''
747models=''
748small=''
749split=''
a0d0e21e 750modetype=''
68c15b6f 751multiarch=''
2304df62
AD
752mydomain=''
753myhostname=''
754phostname=''
755c=''
756n=''
8e07c86e
AD
757d_eofnblk=''
758eagain=''
759o_nonblock=''
760rd_nodata=''
dfe9444c
AD
761netdb_hlen_type=''
762netdb_host_type=''
763netdb_name_type=''
764netdb_net_type=''
2304df62
AD
765groupcat=''
766hostcat=''
767passcat=''
85e6fe83
LW
768orderlib=''
769ranlib=''
2304df62
AD
770package=''
771spackage=''
2c7991dc 772pager=''
bfb7748a 773apiversion=''
ecfc5424 774patchlevel=''
760ac839 775subversion=''
bfb7748a 776version=''
8e07c86e 777perladmin=''
4633a7c4 778perlpath=''
dfe9444c 779pidtype=''
a0d0e21e 780prefix=''
1aef975c 781prefixexp=''
2304df62
AD
782installprivlib=''
783privlib=''
784privlibexp=''
785prototype=''
693762b4 786ptrsize=''
cf2093f6
JH
787d_PRIX64=''
788d_PRId64=''
789d_PRIi64=''
790d_PRIo64=''
791d_PRIu64=''
792d_PRIx64=''
793sPRIX64=''
794sPRId64=''
795sPRIi64=''
796sPRIo64=''
797sPRIu64=''
798sPRIx64=''
85ab1d1d 799drand01=''
2304df62 800randbits=''
85ab1d1d
JH
801randfunc=''
802randseedtype=''
803seedfunc=''
2304df62
AD
804installscript=''
805scriptdir=''
806scriptdirexp=''
5ff3f7a4 807selectminbits=''
a0d0e21e 808selecttype=''
8ff267be 809sh=''
af4c28eb 810sig_count=''
2304df62 811sig_name=''
dfe9444c 812sig_name_init=''
8e07c86e 813sig_num=''
824a2ba3 814sig_num_init=''
4633a7c4
LW
815installsitearch=''
816sitearch=''
817sitearchexp=''
25f94b33
AD
818installsitelib=''
819sitelib=''
820sitelibexp=''
dd4e71fd
JH
821siteprefix=''
822siteprefixexp=''
a0d0e21e
LW
823sizetype=''
824so=''
2304df62
AD
825sharpbang=''
826shsharp=''
827spitshell=''
dfe9444c 828src=''
a0d0e21e 829ssizetype=''
4633a7c4 830startperl=''
2304df62
AD
831startsh=''
832stdchar=''
5ff3f7a4
GS
833d_fgetpos64=''
834d_fopen64=''
835d_freopen64=''
836d_fseek64=''
837d_fseeko64=''
838d_fsetpos64=''
839d_ftell64=''
840d_ftello64=''
841d_tmpfile64=''
ed39a0f2 842d_stdio_stream_array=''
767df6a1 843stdio_stream_array=''
cf2093f6 844d_strtoull=''
2304df62 845sysman=''
5ff3f7a4 846trnl=''
2304df62 847uidtype=''
85ab1d1d 848archname64=''
5ff3f7a4 849use64bits=''
85ab1d1d 850usemultiplicity=''
2304df62 851nm_opt=''
40a7a20a 852nm_so_opt=''
2304df62
AD
853runnm=''
854usenm=''
8ff267be 855useperlio=''
29209bc5 856usesocks=''
693762b4 857d_oldpthreads=''
dfe9444c 858usethreads=''
2304df62
AD
859incpath=''
860mips=''
861mips_type=''
862usrinc=''
a3635516
JH
863d_vendorlib=''
864installvendorlib=''
865vendorlib=''
866vendorlibexp=''
867usevendorprefix=''
868vendorprefix=''
869vendorprefixexp=''
2304df62
AD
870defvoidused=''
871voidflags=''
2304df62
AD
872CONFIG=''
873
ecfc5424
AD
874define='define'
875undef='undef'
876smallmach='pdp11 i8086 z8000 i80286 iAPX286'
877rmlist=''
878
879: We must find out about Eunice early
880eunicefix=':'
881if test -f /etc/unixtovms; then
882 eunicefix=/etc/unixtovms
883fi
884if test -f /etc/unixtovms.exe; then
885 eunicefix=/etc/unixtovms.exe
886fi
887
5ff3f7a4 888i_whoami=''
5ff3f7a4
GS
889: Possible local include directories to search.
890: Set locincpth to "" in a hint file to defeat local include searches.
891locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
892locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
893:
894: no include file wanted by default
895inclwanted=''
896
ecfc5424
AD
897: list of known cpp symbols, sorted alphabetically
898al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
899al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
900al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
901al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
902al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
903al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
904al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
905al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
906al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
907al="$al VMS Xenix286"
5ff3f7a4
GS
908al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
909al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
ecfc5424
AD
910al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
911al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
912al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
913al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
914al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
915al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
916al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
917al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
918al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
919al="$al __SVR4_2__ __UMAXV__"
920al="$al ____386BSD____ __alpha __alpha__ __amiga"
921al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
922al="$al __host_mips__"
923al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
924al="$al __hp9000s500 __hp9000s700 __hp9000s800"
925al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
926al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
927al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
928al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
929al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
930al="$al __mc88100 __mc88100__ __mips __mips__"
931al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
932al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
933al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
934al="$al _host_mips _mips _unix"
935al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
936al="$al apollo ardent att386 att3b"
937al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
938al="$al cadmus clipper concurrent convex cray ctix"
939al="$al dmert encore gcos gcx gimpel gould"
940al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
941al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
942al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
943al="$al i186 i286 i386 i486 i8086"
944al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
945al="$al ksr1 linux luna luna88k m68k m88100 m88k"
946al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
947al="$al mc68040 mc68060 mc68k mc68k32 mc700"
948al="$al mc88000 mc88100 merlin mert mips mvs n16"
949al="$al ncl_el ncl_mr"
950al="$al news1500 news1700 news1800 news1900 news3700"
951al="$al news700 news800 news900 ns16000 ns32000"
952al="$al ns32016 ns32332 ns32k nsc32000 os osf"
953al="$al parisc pc532 pdp11 plexus posix pyr"
954al="$al riscix riscos scs sequent sgi sinix sony sony_news"
955al="$al sonyrisc sparc sparclite spectrum stardent stratos"
956al="$al sun sun3 sun386 svr4 sysV68 sysV88"
957al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
958al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
959al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
960al="$al xenix z8000"
961
dfe9444c 962: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 963_exe=''
dfe9444c
AD
964: Extra object files, if any, needed on this platform.
965archobjs=''
966groupstype=''
732c9516
JH
967: change the next line if compiling for Xenix/286 on Xenix/386
968xlibpth='/usr/lib/386 /lib/386'
969
970: Possible local library directories to search.
971loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
972loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
973
974: general looking path for locating libraries
975glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
976glibpth="$glibpth /lib /usr/lib $xlibpth"
977glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
978glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
979
980: Private path used by Configure to find libraries. Its value
981: is prepended to libpth. This variable takes care of special
982: machines, like the mips. Usually, it should be empty.
983plibpth=''
984
1cfa4ec7
GS
985: default library list
986libswanted=''
921b2963 987: some systems want to use only the non-versioned libso:s
1cfa4ec7 988ignore_versioned_solibs=''
bfb7748a
AD
989: full support for void wanted by default
990defvoidused=15
991
dfe9444c
AD
992: set useposix=false in your hint file to disable the POSIX extension.
993useposix=true
994: set useopcode=false in your hint file to disable the Opcode extension.
995useopcode=true
85ab1d1d 996: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 997: set usesocks on the Configure command line to enable socks.
dfe9444c 998: set usethreads on the Configure command line to enable threads.
ecfc5424 999: List of libraries we want.
693762b4
AD
1000: If anyone needs -lnet, put it in a hint file.
1001libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
ca8cfa54 1002libswanted="$libswanted dld ld sun m rt c cposix posix"
f1066039 1003libswanted="$libswanted ndir dir crypt sec"
ecfc5424 1004libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 1005: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1006: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1007glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1008glibpth="/usr/shlib $glibpth"
1009: Do not use vfork unless overridden by a hint file.
1010usevfork=false
1011
8ff267be 1012: Find the basic shell for Bourne shell scripts
1013case "$sh" in
1014'')
8ff267be 1015 case "$SYSTYPE" in
1016 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1017 *) xxx='/bin/sh';;
1018 esac
1019 if test -f "$xxx"; then
1020 sh="$xxx"
1021 else
1022 : Build up a list and do a single loop so we can 'break' out.
1023 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1024 for xxx in sh bash ksh pdksh ash; do
1025 for p in $pth; do
1026 try="$try ${p}/${xxx}"
1027 done
1028 done
1029 for xxx in $try; do
1030 if test -f "$xxx"; then
1031 sh="$xxx";
8ff267be 1032 break
1033 elif test -f "$xxx.exe"; then
1034 sh="$xxx";
8ff267be 1035 break
1036 fi
1037 done
1038 fi
1039 ;;
1040esac
1041
1042case "$sh" in
1043'') cat <<EOM >&2
1044$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1045
8ff267be 1046Usually it's in /bin/sh. How did you even get this far?
46193409 1047Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 1048we'll try to straighten this all out.
8ff267be 1049EOM
1050 exit 1
1051 ;;
1052esac
1053
760ac839 1054: see if sh knows # comments
8ff267be 1055if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1056 shsharp=true
1057 spitshell=cat
760ac839
LW
1058 xcat=/bin/cat
1059 test -f $xcat || xcat=/usr/bin/cat
1060 echo "#!$xcat" >try
1061 $eunicefix try
1062 chmod +x try
1063 ./try > today
1064 if test -s today; then
760ac839
LW
1065 sharpbang='#!'
1066 else
1067 echo "#! $xcat" > try
1068 $eunicefix try
1069 chmod +x try
1070 ./try > today
1071 if test -s today; then
760ac839
LW
1072 sharpbang='#! '
1073 else
760ac839
LW
1074 sharpbang=': use '
1075 fi
1076 fi
1077else
dfe9444c 1078 echo " "
8ff267be 1079 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1080 shsharp=false
1081 cd ..
1082 echo "exec grep -v '^[ ]*#'" >spitshell
1083 chmod +x spitshell
1084 $eunicefix spitshell
1085 spitshell=`pwd`/spitshell
1086 cd UU
1087 echo "I presume that if # doesn't work, #! won't work either!"
1088 sharpbang=': use '
1089fi
1090rm -f try today
1091
1092: figure out how to guarantee sh startup
8ff267be 1093case "$startsh" in
1094'') startsh=${sharpbang}${sh} ;;
1095*)
760ac839 1096esac
760ac839
LW
1097cat >try <<EOSS
1098$startsh
1099set abc
1100test "$?abc" != 1
1101EOSS
1102
1103chmod +x try
1104$eunicefix try
1105if ./try; then
8ff267be 1106 : echo "Yup, it does."
760ac839 1107else
dfe9444c
AD
1108 echo "Hmm... '$startsh' does not guarantee sh startup..."
1109 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1110fi
1111rm -f try
1112
aebf16e7
AD
1113
1114: Save command line options in file UU/cmdline.opt for later use in
1115: generating config.sh.
1116cat > cmdline.opt <<EOSH
1117# Configure command line arguments.
1118config_arg0='$0'
1119config_args='$*'
1120config_argc=$#
1121EOSH
1122argn=1
1123for arg in "$@"; do
1124 cat >>cmdline.opt <<EOSH
1125config_arg$argn='$arg'
1126EOSH
1127 argn=`expr $argn + 1`
1128done
1129
2304df62
AD
1130: produce awk script to parse command line options
1131cat >options.awk <<'EOF'
1132BEGIN {
16d20bd9 1133 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1134
1135 len = length(optstr);
1136 for (i = 1; i <= len; i++) {
1137 c = substr(optstr, i, 1);
1138 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1139 if (a == ":") {
1140 arg[c] = 1;
1141 i++;
1142 }
1143 opt[c] = 1;
1144 }
1145}
1146{
1147 expect = 0;
1148 str = $0;
1149 if (substr(str, 1, 1) != "-") {
1150 printf("'%s'\n", str);
1151 next;
1152 }
1153 len = length($0);
1154 for (i = 2; i <= len; i++) {
1155 c = substr(str, i, 1);
1156 if (!opt[c]) {
1157 printf("-%s\n", substr(str, i));
1158 next;
1159 }
1160 printf("-%s\n", c);
1161 if (arg[c]) {
1162 if (i < len)
1163 printf("'%s'\n", substr(str, i + 1));
1164 else
1165 expect = 1;
1166 next;
1167 }
1168 }
1169}
1170END {
1171 if (expect)
1172 print "?";
1173}
1174EOF
1175
1176: process the command line options
4633a7c4
LW
1177set X `for arg in "$@"; do echo "X$arg"; done |
1178 sed -e s/X// | awk -f options.awk`
2304df62
AD
1179eval "set $*"
1180shift
1181rm -f options.awk
1182
1183: set up default values
1184fastread=''
1185reuseval=false
1186config_sh=''
1187alldone=''
1188error=''
1189silent=''
1190extractsh=''
ecfc5424 1191override=''
16d20bd9 1192knowitall=''
1aef975c 1193rm -f optdef.sh
28757baa 1194cat >optdef.sh <<EOS
1195$startsh
1196EOS
2304df62 1197
dfe9444c 1198
2304df62
AD
1199: option parsing
1200while test $# -gt 0; do
1201 case "$1" in
1202 -d) shift; fastread=yes;;
1203 -e) shift; alldone=cont;;
1204 -f)
1205 shift
1206 cd ..
1207 if test -r "$1"; then
1208 config_sh="$1"
1209 else
a0d0e21e 1210 echo "$me: cannot read config file $1." >&2
2304df62
AD
1211 error=true
1212 fi
1213 cd UU
1214 shift;;
1215 -h) shift; error=true;;
1216 -r) shift; reuseval=true;;
dfe9444c 1217 -s) shift; silent=true; realsilent=true;;
2304df62 1218 -E) shift; alldone=exit;;
16d20bd9 1219 -K) shift; knowitall=true;;
ecfc5424 1220 -O) shift; override=true;;
dfe9444c 1221 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1222 -D)
1223 shift
1224 case "$1" in
1225 *=)
1226 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1227 echo "$me: ignoring -D $1" >&2
1228 ;;
ecfc5424 1229 *=*) echo "$1" | \
1aef975c
AD
1230 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1231 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1232 esac
1233 shift
1234 ;;
1235 -U)
1236 shift
1237 case "$1" in
1aef975c 1238 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1239 *=*)
1240 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1241 echo "$me: ignoring -U $1" >&2
1242 ;;
1aef975c 1243 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1244 esac
1245 shift
1246 ;;
dfe9444c 1247 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
2304df62
AD
1248 exit 0;;
1249 --) break;;
a0d0e21e 1250 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1251 *) break;;
1252 esac
1253done
1254
1255case "$error" in
1256true)
1257 cat >&2 <<EOM
2afac517 1258Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 1259 [-U symbol] [-U symbol=]
2304df62
AD
1260 -d : use defaults for all answers.
1261 -e : go on without questioning past the production of config.sh.
1262 -f : specify an alternate default configuration file.
1263 -h : print this help message and exit (with an error status).
1264 -r : reuse C symbols value if possible (skips costly nm extraction).
1265 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1266 -D : define symbol to have some value:
1267 -D symbol symbol gets the value 'define'
1268 -D symbol=value symbol gets the value 'value'
2304df62 1269 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1270 -K : do not use unless you know what you are doing.
ecfc5424 1271 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1272 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1273 -U : undefine symbol:
1274 -U symbol symbol gets the value 'undef'
1275 -U symbol= symbol gets completely empty
2304df62
AD
1276 -V : print version number and exit (with a zero status).
1277EOM
1278 exit 1
1279 ;;
1280esac
1281
dfe9444c
AD
1282: Sanity checks
1283case "$fastread$alldone" in
1284yescont|yesexit) ;;
1285*)
1286 if test ! -t 0; then
1287 echo "Say 'sh Configure', not 'sh <Configure'"
1288 exit 1
1289 fi
1290 ;;
1291esac
1292
2304df62
AD
1293exec 4>&1
1294case "$silent" in
1295true) exec 1>/dev/null;;
1296esac
1297
ecfc5424 1298: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1299touch optdef.sh
1300. ./optdef.sh
a0d0e21e 1301
2304df62 1302: set package name
85e6fe83 1303package=perl5
1aef975c
AD
1304first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1305last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1306case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1307ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1308*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1309esac
2304df62 1310
2304df62
AD
1311: Some greps do not return status, grrr.
1312echo "grimblepritz" >grimble
1313if grep blurfldyick grimble >/dev/null 2>&1 ; then
1314 contains=contains
1315elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1316 contains=grep
1317else
1318 contains=contains
1319fi
1320rm -f grimble
1321: the following should work in any shell
1322case "$contains" in
1323contains*)
1324 echo " "
1325 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1326 cat >contains <<'EOSS'
1327grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1328EOSS
1329chmod +x contains
1330esac
1331
dfe9444c
AD
1332: Find the path to the source tree
1333case "$src" in
1334'') case "$0" in
b233458b
JH
1335 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1336 case "$src" in
1337 /*) ;;
1338 *) src=`cd ../$src && pwd` ;;
1339 esac
1340 ;;
dfe9444c
AD
1341 *) src='.';;
1342 esac;;
1343esac
1344case "$src" in
1345'') src=/
1346 rsrc=/
1347 ;;
1348/*) rsrc="$src";;
1349*) rsrc="../$src";;
1350esac
1351if test -f $rsrc/Configure && \
1352 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1353then
1354 : found it, so we are ok.
1355else
1356 rsrc=''
1357 for src in . .. ../.. ../../.. ../../../..; do
1358 if test -f ../$src/Configure && \
1359 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1360 then
1361 rsrc=../$src
1362 break
1363 fi
1364 done
1365fi
1366case "$rsrc" in
1367'')
1368 cat <<EOM >&4
1369
1370Sorry, I can't seem to locate the source dir for $package. Please start
1371Configure with an explicit path -- i.e. /some/path/Configure.
1372
1373EOM
1374 exit 1
1375 ;;
1376../.) rsrc='..';;
1377*)
1378 echo " "
1379 echo "Sources for $package found in \"$src\"." >&4
1380 ;;
1381esac
1382
1383: script used to extract .SH files with variable substitutions
1384cat >extract <<'EOS'
2000072c 1385CONFIGDOTSH=true
dfe9444c
AD
1386echo "Doing variable substitutions on .SH files..."
1387if test -f $src/MANIFEST; then
f7ab18e9 1388 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1389else
1390 echo "(Looking for .SH files under the source directory.)"
1391 set x `(cd $src; find . -name "*.SH" -print)`
1392fi
1393shift
1394case $# in
13950) set x `(cd $src; echo *.SH)`; shift;;
1396esac
1397if test ! -f $src/$1; then
1398 shift
1399fi
1400mkdir_p='
1401name=$1;
1402create="";
1403while test $name; do
1404 if test ! -d "$name"; then
1405 create="$name $create";
1406 name=`echo $name | sed -e "s|^[^/]*$||"`;
1407 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1408 else
1409 name="";
1410 fi;
1411done;
1412for file in $create; do
1413 mkdir $file;
1414done
1415'
1416for file in $*; do
1417 case "$src" in
1418 ".")
1419 case "$file" in
1420 */*)
1421 dir=`expr X$file : 'X\(.*\)/'`
1422 file=`expr X$file : 'X.*/\(.*\)'`
1423 (cd $dir && . ./$file)
1424 ;;
1425 *)
1426 . ./$file
1427 ;;
1428 esac
1429 ;;
1430 *)
1431 case "$file" in
1432 */*)
1433 dir=`expr X$file : 'X\(.*\)/'`
1434 file=`expr X$file : 'X.*/\(.*\)'`
1435 (set x $dir; shift; eval $mkdir_p)
1436 sh <$src/$dir/$file
1437 ;;
1438 *)
1439 sh <$src/$file
1440 ;;
1441 esac
1442 ;;
1443 esac
1444done
1445if test -f $src/config_h.SH; then
1446 if test ! -f config.h; then
1447 : oops, they left it out of MANIFEST, probably, so do it anyway.
1448 . $src/config_h.SH
1449 fi
1450fi
1451EOS
1452
1453: extract files and exit if asked to do so
1454case "$extractsh" in
1455true)
1456 case "$realsilent" in
1457 true) ;;
1458 *) exec 1>&4;;
1459 esac
1460 case "$config_sh" in
1461 '') config_sh='config.sh';;
1462 esac
1463 echo " "
1464 echo "Fetching answers from $config_sh..."
1465 cd ..
1466 . $config_sh
1467 test "$override" && . ./optdef.sh
1468 echo " "
1469 . UU/extract
1470 rm -rf UU
1471 echo "Done."
1472 exit 0
1473 ;;
1474esac
1475
1476: Eunice requires " " instead of "", can you believe it
1477echo " "
1478: Here we go...
1479echo "Beginning of configuration questions for $package."
1480
1481trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1482
2304df62
AD
1483: first determine how to suppress newline on echo command
1484echo " "
1485echo "Checking echo to see how to suppress newlines..."
1486(echo "hi there\c" ; echo " ") >.echotmp
1487if $contains c .echotmp >/dev/null 2>&1 ; then
1488 echo "...using -n."
1489 n='-n'
1490 c=''
1491else
1492 cat <<'EOM'
1493...using \c
1494EOM
1495 n=''
1496 c='\c'
1497fi
1498echo $n "The star should be here-->$c"
1499echo '*'
1500rm -f .echotmp
1501
1502: Now test for existence of everything in MANIFEST
1503echo " "
dfe9444c 1504if test -f $rsrc/MANIFEST; then
2304df62 1505 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1506 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1507 rm -f missing
dfe9444c 1508 tmppwd=`pwd`
2304df62 1509 for filelist in x??; do
dfe9444c 1510 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1511 done
1512 if test -s missing; then
1513 cat missing >&4
1514 cat >&4 <<'EOM'
1515
1516THIS PACKAGE SEEMS TO BE INCOMPLETE.
1517
1518You have the option of continuing the configuration process, despite the
1519distinct possibility that your kit is damaged, by typing 'y'es. If you
1520do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1521and contact the author (perlbug@perl.com).
2304df62
AD
1522
1523EOM
1524 echo $n "Continue? [n] $c" >&4
1525 read ans
1526 case "$ans" in
1527 y*)
1528 echo "Continuing..." >&4
1529 rm -f missing
1530 ;;
1531 *)
1532 echo "ABORTING..." >&4
1533 kill $$
1534 ;;
1535 esac
1536 else
dfe9444c 1537 echo "Looks good..."
2304df62
AD
1538 fi
1539else
1540 echo "There is no MANIFEST file. I hope your kit is complete !"
1541fi
1542rm -f missing x??
1543
5ff3f7a4
GS
1544echo " "
1545: Find the appropriate value for a newline for tr
1546if test -n "$DJGPP"; then
1547 trnl='\012'
1548fi
1549if test X"$trnl" = X; then
1550 case "`echo foo|tr '\n' x 2>/dev/null`" in
1551 foox) trnl='\n' ;;
1552 esac
1553fi
1554if test X"$trnl" = X; then
1555 case "`echo foo|tr '\012' x 2>/dev/null`" in
1556 foox) trnl='\012' ;;
1557 esac
1558fi
1559if test X"$trnl" = X; then
1560 cat <<EOM >&2
1561
1562$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1563
1564EOM
1565 exit 1
1566fi
1567
2304df62
AD
1568: compute the number of columns on the terminal for proper question formatting
1569case "$COLUMNS" in
1570'') COLUMNS='80';;
1571esac
1572
1573: set up the echo used in my read
1574myecho="case \"\$xxxm\" in
1575'') echo $n \"\$rp $c\" >&4;;
1576*) case \"\$rp\" in
1577 '') echo $n \"[\$xxxm] $c\";;
1578 *)
1579 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1580 echo \"\$rp\" >&4
1581 echo $n \"[\$xxxm] $c\" >&4
1582 else
1583 echo $n \"\$rp [\$xxxm] $c\" >&4
1584 fi
1585 ;;
1586 esac;;
1587esac"
1588
1589: now set up to do reads with possible shell escape and default assignment
1590cat <<EOSC >myread
28757baa 1591$startsh
2304df62
AD
1592xxxm=\$dflt
1593$myecho
1594ans='!'
1595case "\$fastread" in
1596yes) case "\$dflt" in
1597 '') ;;
1598 *) ans='';
1599 case "\$silent-\$rp" in
1600 true-) ;;
1601 *) echo " " >&4;;
1602 esac;;
1603 esac;;
1604*) case "\$silent" in
1605 true) case "\$rp" in
1606 '') ans='';;
1607 esac;;
1608 esac;;
1609esac
1610while expr "X\$ans" : "X!" >/dev/null; do
1611 read answ
1612 set x \$xxxm
1613 shift
dfe9444c 1614 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1615 case "\$answ" in
dfe9444c
AD
1616 "!")
1617 sh 1>&4
1618 echo " "
1619 $myecho
1620 ;;
1621 !*)
1622 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1623 shift
1624 sh 1>&4 -c "\$*"
1625 echo " "
1626 $myecho
1627 ;;
2304df62
AD
1628 "\$ans")
1629 case "\$ans" in
ecfc5424
AD
1630 \\&*)
1631 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1632 shift
1633 case "\$1" in
1634 -d)
1635 fastread=yes
40a7a20a 1636 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1637 ;;
1638 -*)
40a7a20a 1639 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1640 ;;
1641 esac
1642 $myecho
1643 ans=!
1644 ;;
2304df62
AD
1645 esac;;
1646 *)
1647 case "\$aok" in
1648 y)
1649 echo "*** Substitution done -- please confirm."
1650 xxxm="\$ans"
c9795ab7 1651 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1652 xxxm="\$ans"
1653 ans=!
1654 ;;
1655 *)
1656 echo "*** Error -- try again."
1657 ans=!
1658 ;;
1659 esac
1660 $myecho
1661 ;;
1662 esac
1663 case "\$ans\$xxxm\$nostick" in
1664 '')
1665 ans=!
1666 $myecho
1667 ;;
1668 esac
1669done
1670case "\$ans" in
1671'') ans="\$xxxm";;
1672esac
1673EOSC
1674
1675: create .config dir to save info across Configure sessions
1676test -d ../.config || mkdir ../.config
1677cat >../.config/README <<EOF
1678This directory created by Configure to save information that should
dfe9444c 1679persist across sessions for $package.
2304df62
AD
1680
1681You may safely delete it if you wish.
1682EOF
1683
1684: general instructions
1685needman=true
1686firsttime=true
760ac839 1687user=`(logname) 2>/dev/null`
dfe9444c
AD
1688case "$user" in
1689'') user=`whoami 2>&1`;;
760ac839 1690esac
2304df62
AD
1691if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1692 firsttime=false
1693 echo " "
1694 rp='Would you like to see the instructions?'
1695 dflt=n
1696 . ./myread
1697 case "$ans" in
1698 [yY]*) ;;
1699 *) needman=false;;
1700 esac
1701fi
1702if $needman; then
1703 cat <<EOH
4e2a5f63 1704
2304df62 1705This installation shell script will examine your system and ask you questions
a0d0e21e 1706to determine how the perl5 package should be installed. If you get
2304df62
AD
1707stuck on a question, you may use a ! shell escape to start a subshell or
1708execute a command. Many of the questions will have default answers in square
1709brackets; typing carriage return will give you the default.
1710
1711On some of the questions which ask for file or directory names you are allowed
1712to use the ~name construct to specify the login directory belonging to "name",
1713even if you don't have a shell which knows about that. Questions where this is
1714allowed will be marked "(~name ok)".
1715
1716EOH
1717 rp=''
1718 dflt='Type carriage return to continue'
1719 . ./myread
1720 cat <<'EOH'
1721
1722The prompter used in this script allows you to use shell variables and
1723backticks in your answers. You may use $1, $2, etc... to refer to the words
1724in the default answer, as if the default line was a set of arguments given to a
1725script shell. This means you may also use $* to repeat the whole default line,
1726so you do not have to re-type everything to add something to the default.
1727
1728Everytime there is a substitution, you will have to confirm. If there is an
1729error (e.g. an unmatched backtick), the default answer will remain unchanged
1730and you will be prompted again.
1731
1732If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1733the questions and use the computed defaults (or the previous answers if there
1734was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1735You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1736on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1737
1738EOH
1739 . ./myread
1740 cat <<EOH
1741
1742Much effort has been expended to ensure that this shell script will run on any
1743Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1744Configure and run it again. If you can't run Configure for some reason,
1745you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1746have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1747
1748This installation script affects things in two ways:
1749
17501) it may do direct variable substitutions on some of the files included
1751 in this kit.
17522) it builds a config.h file for inclusion in C programs. You may edit
1753 any of these files as the need arises after running this script.
1754
1755If you make a mistake on a question, there is no easy way to back up to it
1756currently. The easiest thing to do is to edit config.sh and rerun all the SH
1757files. Configure will offer to let you do this before it runs the SH files.
1758
1759EOH
1760 dflt='Type carriage return to continue'
1761 . ./myread
1762 case "$firsttime" in
1763 true) echo $user >>../.config/instruct;;
1764 esac
1765fi
1766
2304df62
AD
1767: find out where common programs are
1768echo " "
1769echo "Locating common programs..." >&4
1770cat <<EOSC >loc
1771$startsh
1772case \$# in
17730) exit 1;;
1774esac
1775thing=\$1
1776shift
1777dflt=\$1
1778shift
1779for dir in \$*; do
1780 case "\$thing" in
1781 .)
1782 if test -d \$dir/\$thing; then
1783 echo \$dir
1784 exit 0
1785 fi
1786 ;;
1787 *)
a0d0e21e 1788 for thisthing in \$dir/\$thing; do
ecfc5424 1789 : just loop through to pick last item
a0d0e21e 1790 done
25f94b33 1791 if test -f \$thisthing; then
a0d0e21e 1792 echo \$thisthing
2304df62
AD
1793 exit 0
1794 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1795 if test -n "$DJGPP"; then
1796 echo \$dir/\$thing.exe
1797 else
1798 : on Eunice apparently
1799 echo \$dir/\$thing
1800 fi
2304df62
AD
1801 exit 0
1802 fi
1803 ;;
1804 esac
1805done
1806echo \$dflt
1807exit 1
1808EOSC
1809chmod +x loc
1810$eunicefix loc
1811loclist="
1812awk
1813cat
ecfc5424 1814comm
2304df62
AD
1815cp
1816echo
1817expr
1818grep
a0d0e21e 1819ls
dfe9444c 1820make
2304df62 1821mkdir
2304df62
AD
1822rm
1823sed
1824sort
85e6fe83 1825touch
2304df62
AD
1826tr
1827uniq
1828"
1829trylist="
1830Mcc
dfe9444c 1831ar
2304df62
AD
1832byacc
1833cpp
1834csh
1835date
1836egrep
8ff267be 1837gzip
2c7991dc 1838less
8ff267be 1839ln
2c7991dc 1840more
693762b4 1841nm
2304df62 1842nroff
2c7991dc 1843pg
2304df62
AD
1844test
1845uname
8ff267be 1846zip
2304df62 1847"
8e07c86e 1848pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1849pth="$pth /lib /usr/lib"
1850for file in $loclist; do
dfe9444c
AD
1851 eval xxx=\$$file
1852 case "$xxx" in
1853 /*|?:[\\/]*)
1854 if test -f "$xxx"; then
1855 : ok
1856 else
1857 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1858 xxx=`./loc $file $file $pth`
1859 fi
1860 ;;
1861 '') xxx=`./loc $file $file $pth`;;
1862 *) xxx=`./loc $xxx $xxx $pth`;;
1863 esac
2304df62
AD
1864 eval $file=$xxx
1865 eval _$file=$xxx
1866 case "$xxx" in
1867 /*)
1868 echo $file is in $xxx.
1869 ;;
8e07c86e
AD
1870 ?:[\\/]*)
1871 echo $file is in $xxx.
1872 ;;
2304df62 1873 *)
25f94b33
AD
1874 echo "I don't know where '$file' is, and my life depends on it." >&4
1875 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1876 exit 1
2304df62
AD
1877 ;;
1878 esac
1879done
1880echo " "
1881echo "Don't worry if any of the following aren't found..."
1882say=offhand
1883for file in $trylist; do
dfe9444c
AD
1884 eval xxx=\$$file
1885 case "$xxx" in
1886 /*|?:[\\/]*)
1887 if test -f "$xxx"; then
1888 : ok
1889 else
1890 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1891 xxx=`./loc $file $file $pth`
1892 fi
1893 ;;
1894 '') xxx=`./loc $file $file $pth`;;
1895 *) xxx=`./loc $xxx $xxx $pth`;;
1896 esac
2304df62
AD
1897 eval $file=$xxx
1898 eval _$file=$xxx
1899 case "$xxx" in
1900 /*)
1901 echo $file is in $xxx.
1902 ;;
8e07c86e
AD
1903 ?:[\\/]*)
1904 echo $file is in $xxx.
1905 ;;
2304df62
AD
1906 *)
1907 echo "I don't see $file out there, $say."
1908 say=either
1909 ;;
1910 esac
1911done
1912case "$egrep" in
1913egrep)
1914 echo "Substituting grep for egrep."
1915 egrep=$grep
1916 ;;
1917esac
8ff267be 1918case "$ln" in
1919ln)
1920 echo "Substituting cp for ln."
1921 ln=$cp
1922 ;;
1923esac
2304df62
AD
1924case "$test" in
1925test)
1926 echo "Hopefully test is built into your sh."
1927 ;;
1928*)
ecfc5424 1929 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1930 echo "Using the test built into your sh."
1931 test=test
1932 _test=test
1933 fi
1934 ;;
1935esac
1936case "$echo" in
1937echo)
1938 echo "Hopefully echo is built into your sh."
1939 ;;
1940'') ;;
1941*)
1942 echo " "
1943echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1944 $echo $n "hi there$c" >foo1
1945 echo $n "hi there$c" >foo2
1946 if cmp foo1 foo2 >/dev/null 2>&1; then
1947 echo "They are compatible. In fact, they may be identical."
1948 else
1949 case "$n" in
1950 '-n') n='' c='\c';;
1951 *) n='-n' c='';;
1952 esac
1953 cat <<FOO
1954They are not compatible! You are probably running ksh on a non-USG system.
1955I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1956have echo built in and we may have to run some Bourne shell scripts. That
1957means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1958
1959FOO
1960 $echo $n "The star should be here-->$c"
1961 $echo "*"
1962 fi
1963 $rm -f foo1 foo2
1964 ;;
1965esac
1966
a0d0e21e
LW
1967: determine whether symbolic links are supported
1968echo " "
1969$touch blurfl
1970if $ln -s blurfl sym > /dev/null 2>&1 ; then
1971 echo "Symbolic links are supported." >&4
1972 lns="$ln -s"
1973else
1974 echo "Symbolic links are NOT supported." >&4
1975 lns="$ln"
1976fi
1977$rm -f blurfl sym
1978
ecfc5424
AD
1979: see whether [:lower:] and [:upper:] are supported character classes
1980echo " "
ecfc5424
AD
1981case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1982ABYZ)
1983 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1984 up='[:upper:]'
1985 low='[:lower:]'
1986 ;;
28e8609d
JH
1987*) # There is a discontinuity in EBCDIC between 'I' and 'J'
1988 # (0xc9 and 0xd1), therefore that is a nice testing point.
1989 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1990 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
1991 ij) up='[A-Z]'
1992 low='[a-z]'
1993 ;;
1994 esac
1995 fi
1996 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1997 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
1998 ij) up='A-Z'
1999 low='a-z'
2000 ;;
2001 esac
2002 fi
2003 if test "X$up" = X -o "X$low" = X; then
2004 case "`echo IJ | od -x 2>/dev/null`" in
2005 *C9D1*|*c9d1*)
2006 echo "Hey, this might be EBCDIC." >&4
2007 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2008 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2009 ij) up='[A-IJ-RS-Z]'
2010 low='[a-ij-rs-z]'
2011 ;;
2012 esac
2013 fi
2014 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2015 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2016 ij) up='A-IJ-RS-Z'
2017 low='a-ij-rs-z'
2018 ;;
2019 esac
2020 fi
2021 ;;
2022 esac
2023 fi
2024esac
3eaeeeae 2025case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2026ij)
2027 echo "Using $up and $low to convert case." >&4
2028 ;;
ecfc5424 2029*)
28e8609d
JH
2030 echo "I don't know how to translate letters from upper to lower case." >&4
2031 echo "Your tr is not acting any way I know of." >&4
2032 exit 1
2033 ;;
ecfc5424
AD
2034esac
2035: set up the translation script tr, must be called with ./tr of course
2036cat >tr <<EOSC
2037$startsh
2038case "\$1\$2" in
2039'[A-Z][a-z]') exec $tr '$up' '$low';;
2040'[a-z][A-Z]') exec $tr '$low' '$up';;
2041esac
2042exec $tr "\$@"
2043EOSC
2044chmod +x tr
2045$eunicefix tr
2046
2304df62
AD
2047: Try to determine whether config.sh was made on this system
2048case "$config_sh" in
2049'')
2050myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
2051# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2052# because the A-Z/a-z are not consecutive.
a0d0e21e 2053myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2054 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2055newmyuname="$myuname"
2304df62 2056dflt=n
16d20bd9
AD
2057case "$knowitall" in
2058'')
2059 if test -f ../config.sh; then
2060 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2061 eval "`grep myuname= ../config.sh`"
2062 fi
2063 if test "X$myuname" = "X$newmyuname"; then
2064 dflt=y
2065 fi
2304df62 2066 fi
16d20bd9
AD
2067 ;;
2068*) dflt=y;;
2069esac
2304df62
AD
2070
2071: Get old answers from old config file if Configure was run on the
2072: same system, otherwise use the hints.
2073hint=default
2074cd ..
2075if test -f config.sh; then
16d20bd9
AD
2076 echo " "
2077 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2078 . UU/myread
2079 case "$ans" in
2080 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2081 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2082 tmp_n="$n"
2083 tmp_c="$c"
85cad39c 2084 tmp_sh="$sh"
2304df62
AD
2085 . ./config.sh
2086 cp config.sh UU
ecfc5424
AD
2087 n="$tmp_n"
2088 c="$tmp_c"
85cad39c 2089 : Older versions did not always set $sh. Catch re-use of such
2090 : an old config.sh.
2091 case "$sh" in
2092 '') sh="$tmp_sh" ;;
2093 esac
2304df62
AD
2094 hint=previous
2095 ;;
2096 esac
2097fi
2098if test ! -f config.sh; then
2099 $cat <<EOM
2100
4e2a5f63
AD
2101First time through, eh? I have some defaults handy for some systems
2102that need some extra help getting the Configure answers right:
2304df62
AD
2103
2104EOM
dfe9444c 2105 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2106 dflt=''
2107 : Half the following guesses are probably wrong... If you have better
46193409 2108 : tests or hints, please send them to perlbug@perl.com
2304df62 2109 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2110 $test -f /irix && osname=irix
85e6fe83
LW
2111 $test -f /xenix && osname=sco_xenix
2112 $test -f /dynix && osname=dynix
2113 $test -f /dnix && osname=dnix
5f05dabc 2114 $test -f /lynx.os && osname=lynxos
2115 $test -f /unicos && osname=unicos && osvers=`$uname -r`
7a4c00b4 2116 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2117 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2118 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2119 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2120 $test -d /usr/apollo/bin && osname=apollo
2121 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2122 $test -d /usr/include/minix && osname=minix
e060872b 2123 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2124 osname=machten
4633a7c4 2125 if $test -x /sbin/version; then
dfe9444c 2126 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2127 $sed -e 's/[A-Za-z]$//'`
2128 elif $test -x /usr/etc/version; then
dfe9444c 2129 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2130 $sed -e 's/[A-Za-z]$//'`
2131 else
2132 osvers="$2.$3"
2133 fi
2134 fi
85ab1d1d
JH
2135 $test -f /sys/posix.dll &&
2136 $test -f /usr/bin/what &&
2137 set X `/usr/bin/what /sys/posix.dll` &&
2138 $test "$3" = UWIN &&
2139 osname=uwin &&
2140 osvers="$5"
2304df62
AD
2141 if $test -f $uname; then
2142 set X $myuname
2143 shift
2144
2304df62 2145 case "$5" in
85e6fe83 2146 fps*) osname=fps ;;
2304df62
AD
2147 mips*)
2148 case "$4" in
85e6fe83
LW
2149 umips) osname=umips ;;
2150 *) osname=mips ;;
2304df62 2151 esac;;
85e6fe83
LW
2152 [23]100) osname=mips ;;
2153 next*) osname=next ;;
ecfc5424 2154 i386*)
c6912327
JH
2155 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2156 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2157 osname='sco'
2158 osvers=$tmp
2159 elif $test -f /etc/kconfig; then
ecfc5424 2160 osname=isc
bd628c73 2161 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2162 osvers=4
2163 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2164 osvers=3
2304df62 2165 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2166 osvers=2
ecfc5424
AD
2167 fi
2168 fi
2000072c 2169 tmp=''
ecfc5424 2170 ;;
c4f23d77
AD
2171 pc*)
2172 if test -n "$DJGPP"; then
2173 osname=dos
2174 osvers=djgpp
2175 fi
2176 ;;
2304df62
AD
2177 esac
2178
2179 case "$1" in
a0d0e21e
LW
2180 aix) osname=aix
2181 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2182 case "$tmp" in
1aef975c 2183 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2184 '<3240'|'<>3240') osvers=3.2.0 ;;
2185 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2186 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2187 *) osvers=$tmp;;
a0d0e21e
LW
2188 esac
2189 ;;
23f87696
SZ
2190 *dc.osx) osname=dcosx
2191 osvers="$3"
2192 ;;
a0d0e21e
LW
2193 dnix) osname=dnix
2194 osvers="$3"
2195 ;;
2196 domainos) osname=apollo
2197 osvers="$3"
2198 ;;
2199 dgux) osname=dgux
2200 osvers="$3"
2201 ;;
760ac839 2202 dynixptx*) osname=dynixptx
e58e581d 2203 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2204 ;;
a0d0e21e
LW
2205 freebsd) osname=freebsd
2206 osvers="$3" ;;
2207 genix) osname=genix ;;
2208 hp*) osname=hpux
bfb7748a 2209 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2210 ;;
a78b0d02 2211 irix*) osname=irix
a0d0e21e
LW
2212 case "$3" in
2213 4*) osvers=4 ;;
2214 5*) osvers=5 ;;
ecfc5424 2215 *) osvers="$3" ;;
a0d0e21e
LW
2216 esac
2217 ;;
2218 linux) osname=linux
2219 case "$3" in
a0d0e21e
LW
2220 *) osvers="$3" ;;
2221 esac
2222 ;;
28e8609d
JH
2223 MiNT) osname=mint
2224 ;;
2225 netbsd*) osname=netbsd
ecfc5424
AD
2226 osvers="$3"
2227 ;;
4e81affe
MM
2228 news-os) osvers="$3"
2229 case "$3" in
2230 4*) osname=newsos4 ;;
2231 *) osname=newsos ;;
2232 esac
2233 ;;
a0d0e21e
LW
2234 bsd386) osname=bsd386
2235 osvers=`$uname -r`
2236 ;;
a1a0e61e
TD
2237 POSIX-BC | posix-bc ) osname=posix-bc
2238 osvers="$3"
2239 ;;
ae3afa4e
TH
2240 powerux | power_ux | powermax_os | powermaxos | \
2241 powerunix | power_unix) osname=powerux
2242 osvers="$3"
2243 ;;
a0d0e21e
LW
2244 next*) osname=next ;;
2245 solaris) osname=solaris
2246 case "$3" in
2247 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2248 *) osvers="$3" ;;
a0d0e21e
LW
2249 esac
2250 ;;
85e6fe83
LW
2251 sunos) osname=sunos
2252 case "$3" in
85e6fe83
LW
2253 5*) osname=solaris
2254 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2255 *) osvers="$3" ;;
2304df62
AD
2256 esac
2257 ;;
a0d0e21e 2258 titanos) osname=titanos
85e6fe83 2259 case "$3" in
a0d0e21e
LW
2260 1*) osvers=1 ;;
2261 2*) osvers=2 ;;
2262 3*) osvers=3 ;;
2263 4*) osvers=4 ;;
ecfc5424 2264 *) osvers="$3" ;;
2304df62
AD
2265 esac
2266 ;;
85e6fe83 2267 ultrix) osname=ultrix
ecfc5424 2268 osvers="$3"
2304df62 2269 ;;
28757baa 2270 osf1|mls+) case "$5" in
fed7345c
AD
2271 alpha)
2272 osname=dec_osf
313489a2 2273 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2274 ;;
2275 hp*) osname=hp_osf1 ;;
2276 mips) osname=mips_osf1 ;;
85e6fe83
LW
2277 esac
2278 ;;
a0d0e21e
LW
2279 uts) osname=uts
2280 osvers="$3"
2281 ;;
ff68c719 2282 qnx) osname=qnx
2283 osvers="$4"
2284 ;;
85e6fe83 2285 $2) case "$osname" in
2304df62 2286 *isc*) ;;
a0d0e21e 2287 *freebsd*) ;;
5f05dabc 2288 svr*)
a0d0e21e
LW
2289 : svr4.x or possibly later
2290 case "svr$3" in
2291 ${osname}*)
2292 osname=svr$3
2293 osvers=$4
2294 ;;
2295 esac
2296 case "$osname" in
2297 svr4.0)
2298 : Check for ESIX
2299 if test -f /stand/boot ; then
2300 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2301 if test -n "$INITPROG" -a -f "$INITPROG"; then
2302 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2303 if test -n "$isesix"; then
a0d0e21e
LW
2304 osname=esix4
2305 fi
2306 fi
2307 fi
2308 ;;
2309 esac
2310 ;;
2304df62 2311 *) if test -f /etc/systemid; then
a0d0e21e
LW
2312 osname=sco
2313 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2314 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2315 osvers=$1.$2.$3
c4f23d77 2316 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2317 osvers=$1.$2
c4f23d77 2318 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2319 osvers=$1
2304df62 2320 fi
a0d0e21e
LW
2321 else
2322 case "$osname" in
2323 '') : Still unknown. Probably a generic Sys V.
2324 osname="sysv"
2325 osvers="$3"
2326 ;;
2327 esac
2304df62
AD
2328 fi
2329 ;;
2330 esac
2331 ;;
a0d0e21e
LW
2332 *) case "$osname" in
2333 '') : Still unknown. Probably a generic BSD.
2334 osname="$1"
2335 osvers="$3"
2336 ;;
2337 esac
2338 ;;
2304df62
AD
2339 esac
2340 else
dfe9444c
AD
2341 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2342 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2343 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2344 osname=news_os
2304df62 2345 fi
dfe9444c 2346 $rm -f UU/kernel.what
8e07c86e
AD
2347 elif test -d c:/.; then
2348 set X $myuname
2349 osname=os2
2350 osvers="$5"
2304df62
AD
2351 fi
2352 fi
85e6fe83 2353
a0d0e21e
LW
2354 : Now look for a hint file osname_osvers, unless one has been
2355 : specified already.
2356 case "$hintfile" in
2357 ''|' ')
ecfc5424 2358 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2359 : Also try without trailing minor version numbers.
ecfc5424
AD
2360 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2361 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2362 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2363 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2364 case "$file" in
2365 '') dflt=none ;;
2366 *) case "$osvers" in
2367 '') dflt=$file
2368 ;;
dfe9444c 2369 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2370 dflt=$file
dfe9444c 2371 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2372 dflt=$xfile
dfe9444c 2373 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2374 dflt=$xxfile
dfe9444c 2375 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2376 dflt=$xxxfile
dfe9444c 2377 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2378 dflt=$xxxxfile
dfe9444c 2379 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2380 dflt="${osname}"
2381 else
2382 dflt=none
2383 fi
2384 ;;
2385 esac
85e6fe83
LW
2386 ;;
2387 esac
4e2a5f63
AD
2388 if $test -f Policy.sh ; then
2389 case "$dflt" in
2390 *Policy*) ;;
2391 none) dflt="Policy" ;;
2392 *) dflt="Policy $dflt" ;;
2393 esac
2394 fi
85e6fe83 2395 ;;
a0d0e21e 2396 *)
ecfc5424 2397 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2398 ;;
2304df62 2399 esac
1aef975c 2400
4e2a5f63
AD
2401 if $test -f Policy.sh ; then
2402 $cat <<EOM
2403
2404There's also a Policy hint file available, which should make the
2405site-specific (policy) questions easier to answer.
2406EOM
2407
2408 fi
2409
2304df62
AD
2410 $cat <<EOM
2411
2412You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2413A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2414is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2415
2416EOM
4e2a5f63 2417
2304df62 2418 rp="Which of these apply, if any?"
dfe9444c 2419 . UU/myread
85e6fe83
LW
2420 tans=$ans
2421 for file in $tans; do
4e2a5f63
AD
2422 if $test X$file = XPolicy -a -f Policy.sh; then
2423 . Policy.sh
2424 $cat Policy.sh >> UU/config.sh
2425 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2426 . $src/hints/$file.sh
2427 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2428 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2429 : nothing
2430 else
85e6fe83
LW
2431 : Give one chance to correct a possible typo.
2432 echo "$file.sh does not exist"
2433 dflt=$file
2434 rp="hint to use instead?"
dfe9444c 2435 . UU/myread
85e6fe83 2436 for file in $ans; do
dfe9444c
AD
2437 if $test -f "$src/hints/$file.sh"; then
2438 . $src/hints/$file.sh
2439 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2440 elif $test X$ans = X -o X$ans = Xnone ; then
2441 : nothing
2442 else
2443 echo "$file.sh does not exist -- ignored."
2444 fi
2445 done
2304df62
AD
2446 fi
2447 done
85e6fe83 2448
2304df62 2449 hint=recommended
85e6fe83 2450 : Remember our hint file for later.
dfe9444c 2451 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2452 hintfile="$file"
85e6fe83 2453 else
a0d0e21e 2454 hintfile=''
85e6fe83 2455 fi
2304df62
AD
2456fi
2457cd UU
2458;;
2459*)
2460 echo " "
2461 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2462 tmp_n="$n"
2463 tmp_c="$c"
2304df62
AD
2464 cd ..
2465 cp $config_sh config.sh 2>/dev/null
a78b0d02 2466 chmod +w config.sh
2304df62
AD
2467 . ./config.sh
2468 cd UU
2469 cp ../config.sh .
ecfc5424
AD
2470 n="$tmp_n"
2471 c="$tmp_c"
2304df62
AD
2472 hint=previous
2473 ;;
2474esac
1aef975c
AD
2475test "$override" && . ./optdef.sh
2476myuname="$newmyuname"
2304df62
AD
2477
2478: Restore computed paths
2479for file in $loclist $trylist; do
2480 eval $file="\$_$file"
2481done
2482
85e6fe83 2483cat << EOM
a0d0e21e 2484
85e6fe83 2485Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2486The default value is probably right if the name rings a bell. Otherwise,
2487since spelling matters for me, either accept the default or answer "none"
2488to leave it blank.
a0d0e21e 2489
85e6fe83 2490EOM
85e6fe83 2491case "$osname" in
a0d0e21e 2492 ''|' ')
85e6fe83 2493 case "$hintfile" in
a0d0e21e 2494 ''|' '|none) dflt=none ;;
ecfc5424 2495 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2496 esac
2497 ;;
2498 *) dflt="$osname" ;;
2499esac
2500rp="Operating system name?"
2501. ./myread
2502case "$ans" in
ecfc5424
AD
2503none) osname='' ;;
2504*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2505esac
8ff267be 2506echo " "
2507case "$osvers" in
2508 ''|' ')
2509 case "$hintfile" in
2510 ''|' '|none) dflt=none ;;
2511 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2512 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2513 case "$dflt" in
2514 ''|' ') dflt=none ;;
2515 esac
2516 ;;
2517 esac
2518 ;;
2519 *) dflt="$osvers" ;;
2520esac
2521rp="Operating system version?"
2522. ./myread
2523case "$ans" in
2524none) osvers='' ;;
2525*) osvers="$ans" ;;
2526esac
2527
2304df62 2528: who configured the system
59b83a6f 2529cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2530cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2531case "$cf_by" in
2532"")
8ff267be 2533 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2534 case "$cf_by" in
2535 "") cf_by=unknown ;;
8ff267be 2536 esac ;;
2537esac
2304df62 2538
dfe9444c
AD
2539: set up the script used to warn in case of inconsistency
2540cat <<EOS >whoa
2541$startsh
2542EOS
2543cat <<'EOSC' >>whoa
2544dflt=y
2545echo " "
2546echo "*** WHOA THERE!!! ***" >&4
2547echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2548rp=" Keep the $hint value?"
2549. ./myread
2550case "$ans" in
2551y) td=$was; tu=$was;;
2552esac
2553EOSC
2554
2555: function used to set $1 to $val
2556setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2557case "$val$was" in
2558$define$undef) . ./whoa; eval "$var=\$td";;
2559$undef$define) . ./whoa; eval "$var=\$tu";;
2560*) eval "$var=$val";;
2561esac'
2562
64e689dc
JH
2563cat <<EOM
2564
2565Perl can be built to take advantage of threads, on some systems.
2566To do so, Configure must be run with -Dusethreads.
d00b958f
JH
2567
2568Note that threading is a highly experimental feature, and
2569some known race conditions still remain. If you choose to try
2570it, be very sure to not actually deploy it for production
2571purposes. README.threads has more details, and is required
2572reading if you enable threads.
64e689dc 2573EOM
dfe9444c 2574case "$usethreads" in
b691c02f 2575$define|true|[yY]*) dflt='y';;
64e689dc
JH
2576*) dflt='n';;
2577esac
2578rp='Build a threading Perl?'
2579. ./myread
2580case "$ans" in
b691c02f 2581y|Y) val="$define" ;;
64e689dc 2582*) val="$undef" ;;
dfe9444c 2583esac
64e689dc
JH
2584set usethreads
2585eval $setvar
104d25b7 2586
693762b4
AD
2587case "$d_oldpthreads" in
2588'') : Configure tests would be welcome here. For now, assume undef.
2589 val="$undef" ;;
2590*) val="$d_oldpthreads" ;;
2591esac
2592set d_oldpthreads
2593eval $setvar
dfe9444c 2594
b691c02f
JH
2595
2596case "$usethreads" in
104d25b7
JH
2597"$define"|true|[yY]*)
2598: Look for a hint-file generated 'call-back-unit'. If the
2599: user has specified that a threading perl is to be built,
2600: we may need to set or change some other defaults.
2601 if $test -f usethreads.cbu; then
e5e20432 2602 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2603 . ./usethreads.cbu
e5e20432
JH
2604 else
2605 $cat <<EOM
2606(Your platform doesn't have any specific hints for threaded builds.
2607 Assuming POSIX threads, then.)
b691c02f 2608EOM
e5e20432 2609 fi
b691c02f 2610 ;;
e5e20432 2611esac
104d25b7 2612
64e689dc
JH
2613cat <<EOM
2614
2615Perl can be built so that multiple Perl interpreters can coexist
2616within the same Perl executable. To do so, Configure must be run with
2617-Dusemultiplicity.
2618
2619Normally you do not need this and you should answer no.
2620
2621EOM
85ab1d1d 2622case "$usemultiplicity" in
64e689dc
JH
2623$define|true|[yY]*) dflt='y';;
2624*) dflt='n';;
85ab1d1d 2625esac
64e689dc
JH
2626rp='Build Perl for multiplicity?'
2627. ./myread
2628case "$ans" in
2629y|Y) val="$define" ;;
2630*) val="$undef" ;;
2631esac
2632set usemultiplicity
2633eval $setvar
2634
e5e20432
JH
2635: determine where manual pages are on this system
2636echo " "
2637case "$sysman" in
2638'')
2639 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2640 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2641 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2642 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2643 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2644 sysman=`./loc . /usr/man/man1 $syspath`
2645 ;;
2646esac
2647if $test -d "$sysman"; then
2648 echo "System manual is in $sysman." >&4
2649else
2650 echo "Could not find manual pages in source form." >&4
2651fi
2652
2653: see what memory models we can support
2654case "$models" in
2655'')
2656 $cat >pdp11.c <<'EOP'
2657int main() {
2658#ifdef pdp11
2659 exit(0);
2660#else
2661 exit(1);
2662#endif
2663}
2664EOP
2665 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2666 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2667 dflt='unsplit split'
2668 else
2669 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2670 case "$tans" in
2671 X) dflt='none';;
2672 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2673 dflt='small'
2674 else
2675 dflt=''
2676 fi
2677 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2678 dflt="$dflt medium"
2679 fi
2680 if $test -d /lib/large || $test -d /usr/lib/large; then
2681 dflt="$dflt large"
2682 fi
2683 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2684 dflt="$dflt huge"
2685 fi
2686 esac
2687 fi;;
2688*) dflt="$models";;
2689esac
2690$cat <<EOM
2691
2692Some systems have different model sizes. On most systems they are called
2693small, medium, large, and huge. On the PDP11 they are called unsplit and
2694split. If your system doesn't support different memory models, say "none".
2695If you wish to force everything to one memory model, say "none" here and
2696put the appropriate flags later when it asks you for other cc and ld flags.
2697Venix systems may wish to put "none" and let the compiler figure things out.
2698(In the following question multiple model names should be space separated.)
2699
2700The default for most systems is "none".
2701
2702EOM
2703rp="Which memory models are supported?"
2704. ./myread
2705models="$ans"
2706
2707case "$models" in
2708none)
2709 small=''
2710 medium=''
2711 large=''
2712 huge=''
2713 unsplit=''
2714 split=''
2715 ;;
2716*split)
2717 case "$split" in
2718 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2719 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2720 dflt='-i'
2721 else
2722 dflt='none'
2723 fi;;
2724 *) dflt="$split";;
2725 esac
2726 rp="What flag indicates separate I and D space?"
2727 . ./myread
2728 tans="$ans"
2729 case "$tans" in
2730 none) tans='';;
2731 esac
2732 split="$tans"
2733 unsplit='';;
2734*large*|*small*|*medium*|*huge*)
2735 case "$models" in
2736 *large*)
2737 case "$large" in
2738 '') dflt='-Ml';;
2739 *) dflt="$large";;
2740 esac
2741 rp="What flag indicates large model?"
2742 . ./myread
2743 tans="$ans"
2744 case "$tans" in
2745 none) tans='';
2746 esac
2747 large="$tans";;
2748 *) large='';;
2749 esac
2750 case "$models" in
2751 *huge*) case "$huge" in
2752 '') dflt='-Mh';;
2753 *) dflt="$huge";;
2754 esac
2755 rp="What flag indicates huge model?"
2756 . ./myread
2757 tans="$ans"
2758 case "$tans" in
2759 none) tans='';
2760 esac
2761 huge="$tans";;
2762 *) huge="$large";;
2763 esac
2764 case "$models" in
2765 *medium*) case "$medium" in
2766 '') dflt='-Mm';;
2767 *) dflt="$medium";;
2768 esac
2769 rp="What flag indicates medium model?"
2770 . ./myread
2771 tans="$ans"
2772 case "$tans" in
2773 none) tans='';
2774 esac
2775 medium="$tans";;
2776 *) medium="$large";;
2777 esac
2778 case "$models" in
2779 *small*) case "$small" in
2780 '') dflt='none';;
2781 *) dflt="$small";;
2782 esac
2783 rp="What flag indicates small model?"
2784 . ./myread
2785 tans="$ans"
2786 case "$tans" in
2787 none) tans='';
2788 esac
2789 small="$tans";;
2790 *) small='';;
2791 esac
2792 ;;
2793*)
2794 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2795 ;;
2796esac
2797$rm -f pdp11.* pdp11
2798
2799: make some quick guesses about what we are up against
2800echo " "
2801$echo $n "Hmm... $c"
2802echo exit 1 >bsd
2803echo exit 1 >usg
2804echo exit 1 >v7
2805echo exit 1 >osf1
2806echo exit 1 >eunice
2807echo exit 1 >xenix
2808echo exit 1 >venix
2809echo exit 1 >os2
2810d_bsd="$undef"
2811$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2812if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2813then
2814 echo "Looks kind of like an OSF/1 system, but we'll see..."
2815 echo exit 0 >osf1
2816elif test `echo abc | tr a-z A-Z` = Abc ; then
2817 xxx=`./loc addbib blurfl $pth`
2818 if $test -f $xxx; then
2819 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2820 echo exit 0 >bsd
2821 echo exit 0 >usg
2822 else
2823 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2824 echo "Looks kind of like an extended USG system, but we'll see..."
2825 else
2826 echo "Looks kind of like a USG system, but we'll see..."
2827 fi
2828 echo exit 0 >usg
2829 fi
2830elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2831 echo "Looks kind of like a BSD system, but we'll see..."
2832 d_bsd="$define"
2833 echo exit 0 >bsd
2834else
2835 echo "Looks kind of like a Version 7 system, but we'll see..."
2836 echo exit 0 >v7
2837fi
2838case "$eunicefix" in
2839*unixtovms*)
2840 $cat <<'EOI'
2841There is, however, a strange, musty smell in the air that reminds me of
2842something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2843EOI
2844 echo exit 0 >eunice
2845 d_eunice="$define"
2846: it so happens the Eunice I know will not run shell scripts in Unix format
2847 ;;
2848*)
2849 echo " "
2850 echo "Congratulations. You aren't running Eunice."
2851 d_eunice="$undef"
2852 ;;
2853esac
2854: Detect OS2. The p_ variable is set above in the Head.U unit.
2855case "$p_" in
2856:) ;;
2857*)
2858 $cat <<'EOI'
2859I have the feeling something is not exactly right, however...don't tell me...
2860lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2861EOI
2862 echo exit 0 >os2
2863 ;;
2864esac
2865if test -f /xenix; then
2866 echo "Actually, this looks more like a XENIX system..."
2867 echo exit 0 >xenix
2868 d_xenix="$define"
2869else
2870 echo " "
2871 echo "It's not Xenix..."
2872 d_xenix="$undef"
2873fi
2874chmod +x xenix
2875$eunicefix xenix
2876if test -f /venix; then
2877 echo "Actually, this looks more like a VENIX system..."
2878 echo exit 0 >venix
2879else
2880 echo " "
2881 if ./xenix; then
2882 : null
2883 else
2884 echo "Nor is it Venix..."
2885 fi
2886fi
2887chmod +x bsd usg v7 osf1 eunice xenix venix os2
2888$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2889$rm -f foo
2890
2891: see if we need a special compiler
2892echo " "
2893if ./usg; then
2894 case "$cc" in
2895 '') case "$Mcc" in
2896 /*) dflt='Mcc';;
2897 *) case "$large" in
2898 -M*) dflt='cc';;
2899 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2900 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2901 dflt='cc'
2902 else
2903 dflt='cc -M'
2904 fi
2905 else
2906 dflt='cc'
2907 fi;;
2908 esac;;
2909 esac;;
2910 *) dflt="$cc";;
2911 esac
2912 case "$dflt" in
2913 *M*) $cat <<'EOM'
2914On some older systems the default C compiler will not resolve multiple global
2915references that happen to have the same name. On some such systems the "Mcc"
2916command may be used to force these to be resolved. On other systems a "cc -M"
2917command is required. (Note that the -M flag on other systems indicates a
2918memory model to use!) If you have the Gnu C compiler, you might wish to use
2919that instead.
2920
2921EOM
2922 ;;
2923 esac
2924 rp="Use which C compiler?"
2925 . ./myread
2926 cc="$ans"
2927else
2928 case "$cc" in
2929 '') dflt=cc;;
2930 *) dflt="$cc";;
2931 esac
2932 rp="Use which C compiler?"
2933 . ./myread
2934 cc="$ans"
2935fi
2936: Look for a hint-file generated 'call-back-unit'. Now that the
2937: user has specified the compiler, we may need to set or change some
2938: other defaults.
2939if $test -f cc.cbu; then
2940 . ./cc.cbu
2941fi
2942echo " "
2943echo "Checking for GNU cc in disguise and/or its version number..." >&4
2944$cat >gccvers.c <<EOM
2945#include <stdio.h>
2946int main() {
2947#ifdef __GNUC__
2948#ifdef __VERSION__
2949 printf("%s\n", __VERSION__);
2950#else
2951 printf("%s\n", "1");
2952#endif
2953#endif
2954 exit(0);
2955}
2956EOM
2957if $cc -o gccvers gccvers.c; then
2958 gccversion=`./gccvers`
2959 case "$gccversion" in
2960 '') echo "You are not using GNU cc." ;;
2961 *) echo "You are using GNU cc $gccversion." ;;
2962 esac
2963else
2964 echo " "
2965 echo "*** WHOA THERE!!! ***" >&4
2966 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
2967 case "$knowitall" in
2968 '')
2969 echo " You'd better start hunting for one and let me know about it." >&4
2970 exit 1
2971 ;;
2972 esac
2973fi
2974$rm -f gccvers*
2975case "$gccversion" in
29761*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2977esac
2978
64e689dc
JH
2979cat <<EOM
2980
2981Perl can be built to take advantage of explicit 64-bit interfaces,
2982on some systems. To do so, Configure must be run with -Duse64bits.
2983
2984If this doesn't make any sense to you, just accept the default 'n'.
2985EOM
85ab1d1d 2986case "$use64bits" in
64e689dc
JH
2987$define|true|[yY]*) dflt='y';;
2988*) dflt='n';;
2989esac
2990rp='Try to use explicit 64-bit interfaces, if available?'
2991. ./myread
2992case "$ans" in
2993y|Y)
2994 val="$define"
2995 ;;
2996*)
2997 val="$undef"
2998 ;;
85ab1d1d 2999esac
64e689dc
JH
3000set use64bits
3001eval $setvar
85ab1d1d 3002
104d25b7
JH
3003case "$archname64" in
3004'') archname64='' ;; # not a typo
3005esac
85ab1d1d 3006
b691c02f 3007case "$use64bits" in
104d25b7
JH
3008"$define"|true|[yY]*)
3009: Look for a hint-file generated 'call-back-unit'. If the
dd4e71fd 3010: user has specified that a 64 bit perl is to be built,
104d25b7
JH
3011: we may need to set or change some other defaults.
3012 if $test -f use64bits.cbu; then
e5e20432 3013 echo "Your platform has some specific hints for 64-bit builds, using them..."
104d25b7 3014 . ./use64bits.cbu
e5e20432
JH
3015 else
3016 $cat <<EOM
3017(Your platform doesn't have any specific hints for 64-bit builds.
3018 This is probably okay, especially if your system is a true 64-bit system.)
b691c02f 3019EOM
e5e20432
JH
3020 case "$gccversion" in
3021 '') ;;
3022 *) $cat <<EOM
3023But since you seem to be using gcc,
3024I will now add -DUSE_LONG_LONG to the compilation flags.
3025EOM
3026 ccflags="$ccflags -DUSE_LONG_LONG"
3027 ;;
3028 esac
3029 fi
b691c02f
JH
3030 ;;
3031esac
104d25b7 3032
4633a7c4 3033: determine the architecture name
2304df62 3034echo " "
4633a7c4
LW
3035if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3036 tarch=`arch`"-$osname"
3037elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3038 if uname -m > tmparch 2>&1 ; then
7e1af8bc 3039 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5f05dabc 3040 -e 's/$/'"-$osname/" tmparch`
4633a7c4
LW
3041 else
3042 tarch="$osname"
3043 fi
3044 $rm -f tmparch
3045else
3046 tarch="$osname"
3047fi
3048case "$myarchname" in
3049''|"$tarch") ;;
3050*)
3051 echo "(Your architecture name used to be $myarchname.)"
3052 archname=''
2304df62
AD
3053 ;;
3054esac
85ab1d1d 3055myarchname="$tarch"
4633a7c4
LW
3056case "$archname" in
3057'') dflt="$tarch";;
3058*) dflt="$archname";;
3059esac
3060rp='What is your architecture name'
3061. ./myread
85ab1d1d 3062archname="$ans"
dc66995c 3063case "$usethreads" in
85ab1d1d
JH
3064$define)
3065 echo "Threads selected." >&4
3066 case "$archname" in
3067 *-thread*) echo "...and architecture name already has -thread." >&4
3068 ;;
3069 *) archname="$archname-thread"
3070 echo "...setting architecture name to $archname." >&4
3071 ;;
3072 esac
3073 ;;
dc66995c 3074esac
85ab1d1d
JH
3075case "$usemultiplicity" in
3076$define)
3077 echo "Multiplicity selected." >&4
3078 case "$archname" in
3079 *-multi*) echo "...and architecture name already has -multi." >&4
3080 ;;
3081 *) archname="$archname-multi"
3082 echo "...setting architecture name to $archname." >&4
3083 ;;
3084 esac
3085 ;;
3086esac
3087case "$use64bits" in
3088$define)
3089 echo "Explicit 64-bitness selected." >&4
3090 case "$archname64" in
3091 '')
3092 ;;
3093 *)
3094 case "$archname" in
3095 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3096 ;;
3097 *) archname="$archname-$archname64"
3098 echo "...setting architecture name to $archname." >&4
3099 ;;
3100 esac
3101 ;;
3102 esac
3103esac
3104
4633a7c4
LW
3105: decide how portable to be. Allow command line overrides.
3106case "$d_portable" in
3107"$undef") ;;
3108*) d_portable="$define" ;;
2304df62 3109esac
2304df62 3110
4633a7c4
LW
3111: set up shell script to do ~ expansion
3112cat >filexp <<EOSS
3113$startsh
3114: expand filename
3115case "\$1" in
3116 ~/*|~)
3117 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 3118 ;;
4633a7c4
LW
3119 ~*)
3120 if $test -f /bin/csh; then
3121 /bin/csh -f -c "glob \$1"
3122 failed=\$?
3123 echo ""
3124 exit \$failed
3125 else
3126 name=\`$expr x\$1 : '..\([^/]*\)'\`
3127 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3128 if $test ! -d "\$dir"; then
3129 me=\`basename \$0\`
3130 echo "\$me: can't locate home directory for: \$name" >&2
3131 exit 1
3132 fi
3133 case "\$1" in
3134 */*)
3135 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3136 ;;
3137 *)
3138 echo \$dir
3139 ;;
2304df62 3140 esac
4633a7c4 3141 fi
2304df62
AD
3142 ;;
3143*)
4633a7c4 3144 echo \$1
2304df62
AD
3145 ;;
3146esac
4633a7c4
LW
3147EOSS
3148chmod +x filexp
3149$eunicefix filexp
2304df62
AD
3150
3151: now set up to get a file name
28757baa 3152cat <<EOS >getfile
3153$startsh
3154EOS
3155cat <<'EOSC' >>getfile
2304df62
AD
3156tilde=''
3157fullpath=''
3158already=''
3159skip=''
3160none_ok=''
3161exp_file=''
a0d0e21e 3162nopath_ok=''
2304df62
AD
3163orig_rp="$rp"
3164orig_dflt="$dflt"
b233458b
JH
3165case "$gfpth" in
3166'') gfpth='.' ;;
3167esac
2304df62
AD
3168
3169case "$fn" in
ecfc5424 3170*\(*)
28e8609d 3171 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3172 fn=`echo $fn | sed 's/(.*)//'`
3173 ;;
3174esac
3175
3176case "$fn" in
a0d0e21e
LW
3177*:*)
3178 loc_file=`expr $fn : '.*:\(.*\)'`
3179 fn=`expr $fn : '\(.*\):.*'`
3180 ;;
3181esac
3182
3183case "$fn" in
2304df62
AD
3184*~*) tilde=true;;
3185esac
3186case "$fn" in
3187*/*) fullpath=true;;
3188esac
3189case "$fn" in
3190*+*) skip=true;;
3191esac
3192case "$fn" in
3193*n*) none_ok=true;;
3194esac
3195case "$fn" in
3196*e*) exp_file=true;;
3197esac
a0d0e21e
LW
3198case "$fn" in
3199*p*) nopath_ok=true;;
3200esac
2304df62
AD
3201
3202case "$fn" in
3203*f*) type='File';;
3204*d*) type='Directory';;
a0d0e21e 3205*l*) type='Locate';;
2304df62
AD
3206esac
3207
3208what="$type"
3209case "$what" in
3210Locate) what='File';;
3211esac
3212
3213case "$exp_file" in
3214'')
3215 case "$d_portable" in
3216 "$define") ;;
3217 *) exp_file=true;;
3218 esac
3219 ;;
3220esac
3221
3222cd ..
3223while test "$type"; do
3224 redo=''
3225 rp="$orig_rp"
3226 dflt="$orig_dflt"
3227 case "$tilde" in
3228 true) rp="$rp (~name ok)";;
3229 esac
3230 . UU/myread
ecfc5424
AD
3231 if test -f UU/getfile.ok && \
3232 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3233 then
3234 value="$ans"
3235 ansexp="$ans"
3236 break
3237 fi
2304df62
AD
3238 case "$ans" in
3239 none)
3240 value=''
3241 ansexp=''
3242 case "$none_ok" in
3243 true) type='';;
3244 esac
3245 ;;
3246 *)
3247 case "$tilde" in
3248 '') value="$ans"
3249 ansexp="$ans";;
3250 *)
3251 value=`UU/filexp $ans`
3252 case $? in
3253 0)
3254 if test "$ans" != "$value"; then
ecfc5424 3255 echo "(That expands to $value on this system.)"
2304df62
AD
3256 fi
3257 ;;
3258 *) value="$ans";;
3259 esac
3260 ansexp="$value"
3261 case "$exp_file" in
3262 '') value="$ans";;
3263 esac
3264 ;;
3265 esac
3266 case "$fullpath" in
3267 true)
3268 case "$ansexp" in
3269 /*) value="$ansexp" ;;
3270 *)
3271 redo=true
3272 case "$already" in
3273 true)
3274 echo "I shall only accept a full path name, as in /bin/ls." >&4
3275 echo "Use a ! shell escape if you wish to check pathnames." >&4
3276 ;;
3277 *)
3278 echo "Please give a full path name, starting with slash." >&4
3279 case "$tilde" in
3280 true)
3281 echo "Note that using ~name is ok provided it expands well." >&4
3282 already=true
3283 ;;
3284 esac
3285 esac
3286 ;;
3287 esac
3288 ;;
3289 esac
3290 case "$redo" in
3291 '')
3292 case "$type" in
3293 File)
b233458b
JH
3294 for fp in $gfpth; do
3295 if test "X$fp" = X.; then
3296 pf="$ansexp"
3297 else
3298 pf="$fp/$ansexp"
3299 fi
3300 if test -f "$pf"; then
3301 type=''
3302 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3303 then
3304 echo "($value is not a plain file, but that's ok.)"
3305 type=''
3306 fi
3307 if test X"$type" = X; then
3308 value="$pf"
3309 break
3310 fi
3311 done
2304df62
AD
3312 ;;
3313 Directory)
b233458b
JH
3314 for fp in $gfpth; do
3315 if test "X$fp" = X.; then
3316 pf="$ansexp"
3317 else
3318 pf="$fp/$ansexp"
3319 fi
3320 if test -d "$pf"; then
3321 type=''
3322 value="$pf"
3323 break
3324 fi
3325 done
2304df62
AD
3326 ;;
3327 Locate)
40000a8c 3328 if test -d "$ansexp"; then
a0d0e21e
LW
3329 echo "(Looking for $loc_file in directory $value.)"
3330 value="$value/$loc_file"
40000a8c 3331 ansexp="$ansexp/$loc_file"
2304df62 3332 fi
40000a8c 3333 if test -f "$ansexp"; then
2304df62
AD
3334 type=''
3335 fi
a0d0e21e
LW
3336 case "$nopath_ok" in
3337 true) case "$value" in
3338 */*) ;;
3339 *) echo "Assuming $value will be in people's path."
3340 type=''
3341 ;;
3342 esac
3343 ;;
3344 esac
2304df62
AD
3345 ;;
3346 esac
3347
3348 case "$skip" in
3349 true) type='';
3350 esac
3351
3352 case "$type" in
3353 '') ;;
3354 *)
3355 if test "$fastread" = yes; then
3356 dflt=y
3357 else
3358 dflt=n
3359 fi
3360 rp="$what $value doesn't exist. Use that name anyway?"
3361 . UU/myread
3362 dflt=''
3363 case "$ans" in
3364 y*) type='';;
3365 *) echo " ";;
3366 esac
3367 ;;
3368 esac
3369 ;;
3370 esac
3371 ;;
3372 esac
3373done
3374cd UU
3375ans="$value"
3376rp="$orig_rp"
3377dflt="$orig_dflt"
ecfc5424 3378rm -f getfile.ok
b233458b 3379test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3380EOSC
3381
4633a7c4
LW
3382: determine root of directory hierarchy where package will be installed.
3383case "$prefix" in
3384'')
3385 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 3386 ;;
4633a7c4
LW
3387*)
3388 dflt="$prefix"
8e07c86e
AD
3389 ;;
3390esac
4633a7c4 3391$cat <<EOM
2304df62 3392
dd4e71fd
JH
3393By default, $package will be installed in $dflt/bin, manual pages
3394under $dflt/man, etc..., i.e. with $dflt as prefix for all
3395installation directories. Typically this is something like /usr/local.
3396If you wish to have binaries under /usr/bin but other parts of the
3397installation under /usr/local, that's ok: you will be prompted
3398separately for each of the installation directories, the prefix being
3399only used to set the defaults.
8e07c86e
AD
3400
3401EOM
3402fn=d~
3403rp='Installation prefix to use?'
3404. ./getfile
3405oldprefix=''
3406case "$prefix" in
a0d0e21e 3407'') ;;
8e07c86e
AD
3408*)
3409 case "$ans" in
3410 "$prefix") ;;
3411 *) oldprefix="$prefix";;
3412 esac
3413 ;;
a0d0e21e 3414esac
8e07c86e
AD
3415prefix="$ans"
3416prefixexp="$ansexp"
a0d0e21e 3417
dd4e71fd
JH
3418: is AFS running?
3419echo " "
3420case "$afs" in
3421$define|true) afs=true ;;
3422$undef|false) afs=false ;;
3423*) if test -d /afs; then
3424 afs=true
3425 else
3426 afs=false
3427 fi
3428 ;;
3429esac
3430if $afs; then
3431 echo "AFS may be running... I'll be extra cautious then..." >&4
3432else
3433 echo "AFS does not seem to be running..." >&4
3434fi
3435
3436: determine installation prefix for where package is to be installed.
3437if $afs; then
3438$cat <<EOM
3439
3440Since you are running AFS, I need to distinguish the directory in which
3441files will reside from the directory in which they are installed (and from
3442which they are presumably copied to the former directory by occult means).
3443
3444EOM
3445 case "$installprefix" in
3446 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3447 *) dflt="$installprefix";;
3448 esac
3449else
3450$cat <<EOM
3451
3452In some special cases, particularly when building $package for distribution,
3453it is convenient to distinguish between the directory in which files should
3454be installed from the directory ($prefix) in which they
3455will eventually reside. For most users, these two directories are the same.
3456
3457EOM
3458 case "$installprefix" in
3459 '') dflt=$prefix ;;
3460 *) dflt=$installprefix;;
3461 esac
3462fi
3463fn=d~
3464rp='What installation prefix should I use for installing files?'
3465. ./getfile
3466installprefix="$ans"
3467installprefixexp="$ansexp"
3468
8e07c86e
AD
3469: set the prefixit variable, to compute a suitable default value
3470prefixit='case "$3" in
3471""|none)
3472 case "$oldprefix" in
3473 "") eval "$1=\"\$$2\"";;
3474 *)
3475 case "$3" in
3476 "") eval "$1=";;
3477 none)
3478 eval "tp=\"\$$2\"";
3479 case "$tp" in
3480 ""|" ") eval "$1=\"\$$2\"";;
3481 *) eval "$1=";;
3482 esac;;
3483 esac;;
3484 esac;;
3485*)
3486 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3487 case "$tp" in
3488 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3489 /*-$oldprefix/*|\~*-$oldprefix/*)
3490 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3491 *) eval "$1=\"\$$2\"";;
3492 esac;;
3493esac'
a0d0e21e 3494
bfb7748a
AD
3495: set the base revision
3496baserev=5.0
3497
3498: get the patchlevel
3499echo " "
3500echo "Getting the current patchlevel..." >&4
3501if $test -r $rsrc/patchlevel.h;then
d00b958f
JH
3502 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3503 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bfb7748a
AD
3504else
3505 patchlevel=0
3506 subversion=0
3507fi
3508$echo $n "(You have $package" $c
3509case "$package" in
3510"*$baserev") ;;
3511*) $echo $n " $baserev" $c ;;
3512esac
3513$echo $n " patchlevel $patchlevel" $c
3514test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3515echo ".)"
3516
3517if test 0 -eq "$subversion"; then
3518 version=`LC_ALL=C; export LC_ALL; \
3519 echo $baserev $patchlevel | \
3520 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3521else
3522 version=`LC_ALL=C; export LC_ALL; \
3523 echo $baserev $patchlevel $subversion | \
3524 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3525fi
3526: Figure out perl API version. Perhaps this should be in patchlevel.h
3527if test "$subversion" -lt 50; then
3528 apiversion=`LC_ALL=C; export LC_ALL; \
59b83a6f 3529 LANGUAGE=C; export LANGUAGE; \
bfb7748a
AD
3530 echo $baserev $patchlevel | \
3531 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3532else
3533 apiversion="$version"
3534fi
3535
dd4e71fd
JH
3536: determine installation style
3537: For now, try to deduce it from prefix unless it is already set.
3538: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3539case "$installstyle" in
3540'') case "$prefix" in
3541 *perl*) dflt='lib';;
3542 *) dflt='lib/perl5' ;;
3543 esac
3544 ;;
3545*) dflt='lib/perl5' ;;
3546esac
3547: Probably not worth prompting for this since we prompt for all
3548: the directories individually, and the prompt would be too long and
3549: confusing anyway.
3550installstyle=$dflt
3551
4633a7c4 3552: determine where private library files go
3a6175e1
AD
3553: Usual default is /usr/local/lib/perl5/$version.
3554: Also allow things like /opt/perl/lib/$version, since
bfb7748a 3555: /opt/perl/lib/perl5... would be redundant.
dd4e71fd
JH
3556: The default "style" setting is made in installstyle.U
3557case "$installstyle" in
3558*lib/perl5*) set dflt privlib lib/$package/$version ;;
3559*) set dflt privlib lib/$version ;;
4633a7c4 3560esac
8e07c86e 3561eval $prefixit
4633a7c4
LW
3562$cat <<EOM
3563
3564There are some auxiliary files for $package that need to be put into a
3565private library directory that is accessible by everyone.
3566
3567EOM
3568fn=d~+
3569rp='Pathname where the private library files will reside?'
8e07c86e 3570. ./getfile
4633a7c4
LW
3571privlib="$ans"
3572privlibexp="$ansexp"
dd4e71fd
JH
3573: Change installation prefix, if necessary.
3574if $test X"$prefix" != X"$installprefix"; then
3575 installprivlib=`echo $privlibexp | sed 's#^$prefix#$installprefix#'`
71c4afb4
JH
3576else
3577 installprivlib="$privlibexp"
4633a7c4
LW
3578fi
3579
8e07c86e
AD
3580: set the prefixup variable, to restore leading tilda escape
3581prefixup='case "$prefixexp" in
3582"$prefix") ;;
3583*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3584esac'
3585
4633a7c4
LW
3586: determine where public architecture dependent libraries go
3587set archlib archlib
8e07c86e 3588eval $prefixit
3a6175e1 3589: privlib default is /usr/local/lib/$package/$version
bfb7748a 3590: archlib default is /usr/local/lib/$package/$version/$archname
3a6175e1 3591: privlib may have an optional trailing /share.
bfb7748a
AD
3592tdflt=`echo $privlib | $sed 's,/share$,,'`
3593tdflt=$tdflt/$archname
4633a7c4 3594case "$archlib" in
bfb7748a 3595'') dflt=$tdflt
8e07c86e 3596 ;;
bfb7748a 3597*) dflt="$archlib"
774d564b 3598 ;;
8e07c86e 3599esac
dd4e71fd 3600$cat <<EOM
4633a7c4
LW
3601
3602$spackage contains architecture-dependent library files. If you are
3603sharing libraries in a heterogeneous environment, you might store
3604these files in a separate location. Otherwise, you can just include
3605them with the rest of the public library files.
3606
8e07c86e 3607EOM
4633a7c4
LW
3608fn=d+~
3609rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 3610. ./getfile
4633a7c4
LW
3611archlib="$ans"
3612archlibexp="$ansexp"
4633a7c4
LW
3613if $test X"$archlib" = X"$privlib"; then
3614 d_archlib="$undef"
3615else
3616 d_archlib="$define"
8e07c86e 3617fi
dd4e71fd
JH
3618: Change installation prefix, if necessary.
3619if $test X"$prefix" != X"$installprefix"; then
3620 installarchlib=`echo $archlibexp | sed 's#^$prefix#$installprefix#'`
71c4afb4
JH
3621else
3622 installarchlib="$archlibexp"
dd4e71fd 3623fi
8e07c86e 3624
d71b2b6b
JH
3625
3626: Binary compatibility with 5.005 is not possible for builds
3627: with advanced features
3628case "$usethreads$usemultiplicity" in
f0d04425
JH
3629*define*)
3630 bincompat5005="$undef"
3631 d_bincompat5005="$undef"
3632 ;;
d71b2b6b
JH
3633*) $cat <<EOM
3634
3635Perl 5.006 can be compiled for binary compatibility with 5.005.
3636If you decide to do so, you will be able to continue using most
3637of the extensions that were compiled for Perl 5.005.
3638
3639EOM
44dbcf5f
JH
3640 case "$bincompat5005$d_bincompat5005" in
3641 *"$undef"*) dflt=n ;;
d71b2b6b
JH
3642 *) dflt=y ;;
3643 esac
3644 rp='Binary compatibility with Perl 5.005?'
3645 . ./myread
3646 case "$ans" in
3647 y*) val="$define" ;;
3648 *) val="$undef" ;;
3649 esac
3650 set d_bincompat5005
3651 eval $setvar
3652 case "$d_bincompat5005" in
f0d04425
JH
3653 "$define")
3654 bincompat5005="$define"
3655 ;;
3656 *) bincompat5005="$undef"
3657 d_bincompat5005="$undef"
3658 ;;
e5e20432
JH
3659 esac
3660 ;;
3661esac
3662
40a7a20a 3663
3664: see if setuid scripts can be secure
3665$cat <<EOM
3666
3667Some kernels have a bug that prevents setuid #! scripts from being
3668secure. Some sites have disabled setuid #! scripts because of this.
3669
3670First let's decide if your kernel supports secure setuid #! scripts.
3671(If setuid #! scripts would be secure but have been disabled anyway,
3672don't say that they are secure if asked.)
3673
3674EOM
3675
3676val="$undef"
3677if $test -d /dev/fd; then
3678 echo "#!$ls" >reflect
3679 chmod +x,u+s reflect
3680 ./reflect >flect 2>&1
3681 if $contains "/dev/fd" flect >/dev/null; then
3682 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3683 val="$define"
3684 else
3685 $cat <<EOM
3686If you are not sure if they are secure, I can check but I'll need a
3687username and password different from the one you are using right now.
3688If you don't have such a username or don't want me to test, simply
3689enter 'none'.
3690
3691EOM
3692 rp='Other username to test security of setuid scripts with?'
3693 dflt='none'
3694 . ./myread
3695 case "$ans" in
3696 n|none)
3697 case "$d_suidsafe" in
3698 '') echo "I'll assume setuid scripts are *not* secure." >&4
3699 dflt=n;;
3700 "$undef")
3701 echo "Well, the $hint value is *not* secure." >&4
3702 dflt=n;;
3703 *) echo "Well, the $hint value *is* secure." >&4
3704 dflt=y;;
3705 esac
3706 ;;
3707 *)
3708 $rm -f reflect flect
3709 echo "#!$ls" >reflect
3710 chmod +x,u+s reflect
3711 echo >flect
3712 chmod a+w flect
3713 echo '"su" will (probably) prompt you for '"$ans's password."
3714 su $ans -c './reflect >flect'
3715 if $contains "/dev/fd" flect >/dev/null; then
3716 echo "Okay, it looks like setuid scripts are secure." >&4
3717 dflt=y
3718 else
3719 echo "I don't think setuid scripts are secure." >&4
3720 dflt=n
3721 fi
3722 ;;
3723 esac
3724 rp='Does your kernel have *secure* setuid scripts?'
3725 . ./myread
3726 case "$ans" in
3727 [yY]*) val="$define";;
3728 *) val="$undef";;
3729 esac
3730 fi
3731else
3732 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
760ac839 3733 echo "(That's for file descriptors, not floppy disks.)"
40a7a20a 3734 val="$undef"
3735fi
3736set d_suidsafe
3737eval $setvar
3738
3739$rm -f reflect flect
3740
3741: now see if they want to do setuid emulation
3742echo " "
3743val="$undef"
3744case "$d_suidsafe" in
3745"$define")
3746 val="$undef"
3747 echo "No need to emulate SUID scripts since they are secure here." >& 4
3748 ;;
3749*)
3750 $cat <<EOM
3751Some systems have disabled setuid scripts, especially systems where
3752setuid scripts cannot be secure. On systems where setuid scripts have
dfe9444c
AD
3753been disabled, the setuid/setgid bits on scripts are currently
3754useless. It is possible for $package to detect those bits and emulate
3755setuid/setgid in a secure fashion. This emulation will only work if
3756setuid scripts have been disabled in your kernel.
8e07c86e
AD
3757
3758EOM
dfe9444c
AD
3759 case "$d_dosuid" in
3760 "$define") dflt=y ;;
3761 *) dflt=n ;;
3762 esac
3763 rp="Do you want to do setuid/setgid emulation?"
3764 . ./myread
3765 case "$ans" in
3766 [yY]*) val="$define";;
3767 *) val="$undef";;
3768 esac
3769 ;;
4633a7c4 3770esac
dfe9444c 3771set d_dosuid
4633a7c4 3772eval $setvar
8e07c86e 3773
2afac517 3774: What should the include directory be ?
8e07c86e 3775echo " "
2afac517 3776$echo $n "Hmm... $c"
3777dflt='/usr/include'
3778incpath=''
3779mips_type=''
3780if $test -f /bin/mips && /bin/mips; then
3781 echo "Looks like a MIPS system..."
3782 $cat >usr.c <<'EOCP'
3783#ifdef SYSTYPE_BSD43
3784/bsd43
3785#endif
3786EOCP
3787 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3788 dflt='/bsd43/usr/include'
3789 incpath='/bsd43'
3790 mips_type='BSD 4.3'
8e07c86e 3791 else
2afac517 3792 mips_type='System V'
8e07c86e 3793 fi
2afac517 3794 $rm -f usr.c usr.out
3795 echo "and you're compiling with the $mips_type compiler and libraries."
3796 xxx_prompt=y
3797 echo "exit 0" >mips
8e07c86e 3798else
2afac517 3799 echo "Doesn't look like a MIPS system."
3800 xxx_prompt=n
3801 echo "exit 1" >mips
3802fi
3803chmod +x mips
3804$eunicefix mips
2afac517 3805case "$usrinc" in
3806'') ;;
3807*) dflt="$usrinc";;
3808esac
3809case "$xxx_prompt" in
3810y) fn=d/
dfe9444c 3811 echo " "
2afac517 3812 rp='Where are the include files you want to use?'
3813 . ./getfile
3814 usrinc="$ans"
3815 ;;
3816*) usrinc="$dflt"
3817 ;;
3818esac
8e07c86e 3819
c4f23d77
AD
3820: see how we invoke the C preprocessor
3821echo " "
3822echo "Now, how can we feed standard input to your C preprocessor..." >&4
3823cat <<'EOT' >testcpp.c
3824#define ABC abc
3825#define XYZ xyz
3826ABC.XYZ
3827EOT
3828cd ..
1cfa4ec7
GS
3829if test ! -f cppstdin; then
3830 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3831else
3832 echo "Keeping your $hint cppstdin wrapper."
3833fi
c4f23d77
AD
3834chmod 755 cppstdin
3835wrapper=`pwd`/cppstdin
3836ok='false'
3837cd UU
3838
3839if $test "X$cppstdin" != "X" && \
3840 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3841 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3842then
3843 echo "You used to use $cppstdin $cppminus so we'll use that again."
3844 case "$cpprun" in
3845 '') echo "But let's see if we can live without a wrapper..." ;;
3846 *)
3847 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3848 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3849 then
3850 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3851 ok='true'
3852 else
3853 echo "(However, $cpprun $cpplast does not work, let's see...)"
3854 fi
3855 ;;
3856 esac
3857else
3858 case "$cppstdin" in
3859 '') ;;
3860 *)
3861 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3862 ;;
3863 esac
3864fi
3865
3866if $ok; then
3867 : nothing
3868elif echo 'Maybe "'"$cc"' -E" will work...'; \
3869 $cc -E <testcpp.c >testcpp.out 2>&1; \
3870 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3871 echo "Yup, it does."
3872 x_cpp="$cc -E"
3873 x_minus='';
3874elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3875 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3876 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3877 echo "Yup, it does."
3878 x_cpp="$cc -E"
3879 x_minus='-';
3880elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3881 $cc -P <testcpp.c >testcpp.out 2>&1; \
3882 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3883 echo "Yipee, that works!"
3884 x_cpp="$cc -P"
3885 x_minus='';
3886elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3887 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3888 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3889 echo "At long last!"
3890 x_cpp="$cc -P"
3891 x_minus='-';
3892elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3893 $cpp <testcpp.c >testcpp.out 2>&1; \
3894 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3895 echo "It works!"
3896 x_cpp="$cpp"
3897 x_minus='';
3898elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3899 $cpp - <testcpp.c >testcpp.out 2>&1; \
3900 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3901 echo "Hooray, it works! I was beginning to wonder."
3902 x_cpp="$cpp"
3903 x_minus='-';
3904elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3905 $wrapper <testcpp.c >testcpp.out 2>&1; \
3906 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3907 x_cpp="$wrapper"
3908 x_minus=''
3909 echo "Eureka!"
3910else
3911 dflt=''
3912 rp="No dice. I can't find a C preprocessor. Name one:"
3913 . ./myread
3914 x_cpp="$ans"
3915 x_minus=''
3916 $x_cpp <testcpp.c >testcpp.out 2>&1
3917 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3918 echo "OK, that will do." >&4
3919 else
3920echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3921 exit 1
3922 fi
3923fi
3924
3925case "$ok" in
3926false)
3927 cppstdin="$x_cpp"
3928 cppminus="$x_minus"
3929 cpprun="$x_cpp"
3930 cpplast="$x_minus"
3931 set X $x_cpp
3932 shift
3933 case "$1" in
3934 "$cpp")
3935 echo "Perhaps can we force $cc -E using a wrapper..."
3936 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3937 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3938 then
3939 echo "Yup, we can."
3940 cppstdin="$wrapper"
3941 cppminus='';
3942 else
3943 echo "Nope, we'll have to live without it..."
3944 fi
3945 ;;
3946 esac
3947 case "$cpprun" in
3948 "$wrapper")
3949 cpprun=''
3950 cpplast=''
3951 ;;
3952 esac
3953 ;;
3954esac
3955
3956case "$cppstdin" in
def887e8 3957"$wrapper"|'cppstdin') ;;
c4f23d77
AD
3958*) $rm -f $wrapper;;
3959esac
3960$rm -f testcpp.c testcpp.out
3961
2afac517 3962: Set private lib path
3963case "$plibpth" in
3964'') if ./mips; then
3965 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3966 fi;;
3967esac
3968case "$libpth" in
3969' ') dlist='';;
3970'') dlist="$loclibpth $plibpth $glibpth";;
3971*) dlist="$libpth";;
3972esac
8e07c86e 3973
2afac517 3974: Now check and see which directories actually exist, avoiding duplicates
3975libpth=''
3976for xxx in $dlist
3977do
3978 if $test -d $xxx; then
3979 case " $libpth " in
3980 *" $xxx "*) ;;
3981 *) libpth="$libpth $xxx";;
3982 esac
3983 fi
3984done
3985$cat <<'EOM'
8e07c86e 3986
2afac517 3987Some systems have incompatible or broken versions of libraries. Among
3988the directories listed in the question below, please remove any you
3989know not to be holding relevant libraries, and add any that are needed.
3990Say "none" for none.
8e07c86e 3991
8e07c86e 3992EOM
2afac517 3993case "$libpth" in
3994'') dflt='none';;
3995*)
3996 set X $libpth
3997 shift
3998 dflt=${1+"$@"}
4633a7c4 3999 ;;
8e07c86e 4000esac
2afac517 4001rp="Directories to use for library searches?"
4002. ./myread
4003case "$ans" in
4004none) libpth=' ';;
4005*) libpth="$ans";;
4006esac
8e07c86e 4007
2afac517 4008: compute shared library extension
4009case "$so" in
4010'')
4011 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4012 dflt='sl'
4013 else
4014 dflt='so'
4015 fi
4016 ;;
4017*) dflt="$so";;
8e07c86e 4018esac
2afac517 4019$cat <<EOM
8e07c86e 4020
2afac517 4021On some systems, shared libraries may be available. Answer 'none' if
4022you want to suppress searching of shared libraries for the remaining
4023of this configuration.
8e07c86e
AD
4024
4025EOM
2afac517 4026rp='What is the file extension used for shared libraries?'
4027. ./myread
4028so="$ans"
8e07c86e 4029
dfe9444c
AD
4030: Define several unixisms.
4031: Hints files or command line option can be used to override them.
4032: The convoluted testing is in case hints files set either the old
4033: or the new name.
4034case "$_exe" in
4035'') case "$exe_ext" in
4036 '') ;;
4037 *) _exe="$exe_ext" ;;
4038 esac
4039 ;;
4040esac
4041case "$_a" in
4042'') case "$lib_ext" in
4043 '') _a='.a';;
4044 *) _a="$lib_ext" ;;
4045 esac
4046 ;;
4047esac
4048case "$_o" in
4049'') case "$obj_ext" in
4050 '') _o='.o';;
4051 *) _o="$obj_ext";;
4052 esac
4053 ;;
4054esac
4055case "$p_" in
4056'') case "$path_sep" in
4057 '') p_=':';;
4058 *) p_="$path_sep";;
4059 esac
4060 ;;
4061esac
4062exe_ext=$_exe
4063lib_ext=$_a
4064obj_ext=$_o
4065path_sep=$p_
4066
4067: Which makefile gets called first. This is used by make depend.
4068case "$firstmakefile" in
4069'') firstmakefile='makefile';;
4070esac
4071
29209bc5
JH
4072cat <<EOM
4073
4074Perl can be built to use the SOCKS proxy protocol library. To do so,
4075Configure must be run with -Dusesocks.
4076
4077Normally you do not need this and you should answer no.
4078
4079EOM
4080case "$usesocks" in
4081$define|true|[yY]*) dflt='y';;
4082*) dflt='n';;
4083esac
4084rp='Build Perl for SOCKS?'
4085. ./myread
4086case "$ans" in
4087y|Y) val="$define" ;;
4088*) val="$undef" ;;
4089esac
4090set usesocks
4091eval $setvar
4092
2afac517 4093: Looking for optional libraries
4094echo " "
4095echo "Checking for optional libraries..." >&4
4096case "$libs" in
4097' '|'') dflt='';;
4098*) dflt="$libs";;
8e07c86e 4099esac
2afac517 4100case "$libswanted" in
4101'') libswanted='c_s';;
4102esac
29209bc5
JH
4103case "$usesocks" in
4104$define)
4105 libswanted="$libswanted socks5 socks5_sh"
4106 ;;
4107esac
2afac517 4108for thislib in $libswanted; do
4109
1cfa4ec7
GS
4110 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4111 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
2afac517 4112 echo "Found -l$thislib (shared)."
4113 case " $dflt " in
4114 *"-l$thislib "*);;
4115 *) dflt="$dflt -l$thislib";;
4633a7c4 4116 esac
2afac517 4117 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4118 echo "Found -l$thislib (shared)."
4119 case " $dflt " in
4120 *"-l$thislib "*);;
4121 *) dflt="$dflt -l$thislib";;
4122 esac
dfe9444c 4123 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 4124 echo "Found -l$thislib."
4125 case " $dflt " in
4126 *"-l$thislib "*);;
4127 *) dflt="$dflt -l$thislib";;
4128 esac
dfe9444c 4129 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 4130 echo "Found -l$thislib."
4131 case " $dflt " in
4132 *"-l$thislib "*);;
4133 *) dflt="$dflt -l$thislib";;
4134 esac
dfe9444c 4135 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2afac517 4136 echo "Found -l${thislib}_s."
4137 case " $dflt " in
4138 *"-l$thislib "*);;
4139 *) dflt="$dflt -l${thislib}_s";;
4140 esac
dfe9444c 4141 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2afac517 4142 echo "Found -l$thislib."
4143 case " $dflt " in
4144 *"-l$thislib "*);;
4145 *) dflt="$dflt -l$thislib";;
4146 esac
4147 else
4148 echo "No -l$thislib."
4149 fi
4150done
4151set X $dflt
4152shift
4153dflt="$*"
4154case "$libs" in
4155'') dflt="$dflt";;
4156*) dflt="$libs";;
4157esac
4158case "$dflt" in
4159' '|'') dflt='none';;
8e07c86e 4160esac
2afac517 4161
4633a7c4 4162$cat <<EOM
29209bc5
JH
4163
4164In order to compile $package on your machine, a number of libraries
4165are usually needed. Include any other special libraries here as well.
4166Say "none" for none. The default list is almost always right.
4633a7c4 4167EOM
2afac517 4168
4169echo " "
29209bc5 4170rp="What libraries to use?"
8e07c86e 4171. ./myread
2afac517 4172case "$ans" in
4173none) libs=' ';;
4174*) libs="$ans";;
4175esac
8e07c86e 4176
2afac517 4177: determine optimize, if desired, or use for debug flag also
4178case "$optimize" in
2ae324a7 4179' '|$undef) dflt='none';;
2afac517 4180'') dflt='-O';;
4181*) dflt="$optimize";;
4633a7c4 4182esac
2afac517 4183$cat <<EOH
4633a7c4 4184
760ac839 4185Some C compilers have problems with their optimizers. By default, $package
4633a7c4
LW
4186compiles with the -O flag to use the optimizer. Alternately, you might want
4187to use the symbolic debugger, which uses the -g flag (on traditional Unix
4188systems). Either flag can be specified here. To use neither flag, specify
4189the word "none".
4190
4191EOH
4192rp="What optimizer/debugger flag should be used?"
4193. ./myread
4194optimize="$ans"
4195case "$optimize" in
4196'none') optimize=" ";;
4197esac
4198
4199dflt=''
25f94b33
AD
4200: We will not override a previous value, but we might want to
4201: augment a hint file
4202case "$hint" in
4203none|recommended)
4633a7c4
LW
4204 case "$gccversion" in
4205 1*) dflt='-fpcc-struct-return' ;;
4206 esac
4207 case "$optimize" in
4208 *-g*) dflt="$dflt -DDEBUGGING";;
4209 esac
4210 case "$gccversion" in
4211 2*) if test -d /etc/conf/kconfig.d &&
4212 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4213 then
4214 dflt="$dflt -posix"
4215 fi
4216 ;;
4217 esac
4218 ;;
4219esac
4220
a4f3eea9 4221case "$mips_type" in
4222*BSD*|'') inclwanted="$locincpth $usrinc";;
4223*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4224esac
4225for thisincl in $inclwanted; do
4226 if $test -d $thisincl; then
4227 if $test x$thisincl != x$usrinc; then
4228 case "$dflt" in
4229 *$thisincl*);;
4230 *) dflt="$dflt -I$thisincl";;
4231 esac
4232 fi
4233 fi
4234done
4235
4236inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4237 xxx=true;
4238elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4239 xxx=true;
4240else
4241 xxx=false;
4242fi;
4243if $xxx; then
4244 case "$dflt" in
4245 *$2*);;
4246 *) dflt="$dflt -D$2";;
4247 esac;
4248fi'
4249
ccc7f9b3 4250set signal.h LANGUAGE_C; eval $inctest
a4f3eea9 4251
29209bc5
JH
4252case "$usesocks" in
4253$define)
4254 ccflags="$ccflags -DSOCKS"
4255 ;;
4256esac
4257
a4f3eea9 4258case "$hint" in
4259none|recommended) dflt="$ccflags $dflt" ;;
4260*) dflt="$ccflags";;
4261esac
4262
4263case "$dflt" in
4264''|' ') dflt=none;;
4265esac
4266$cat <<EOH
4267
4268Your C compiler may want other flags. For this question you should include
4269-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4270but you should NOT include libraries or ld flags like -lwhatever. If you
4271want $package to honor its debug switch, you should include -DDEBUGGING here.
dfe9444c 4272Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
a4f3eea9 4273
4274To use no flags, specify the word "none".
4275
4276EOH
4277set X $dflt
4278shift
4279dflt=${1+"$@"}
4280rp="Any additional cc flags?"
4281. ./myread
4282case "$ans" in
4283none) ccflags='';;
4284*) ccflags="$ans";;
4285esac
4286
4287: the following weeds options from ccflags that are of no interest to cpp
4288cppflags="$ccflags"
4289case "$gccversion" in
42901*) cppflags="$cppflags -D__GNUC__"
4291esac
4292case "$mips_type" in
4293'');;
4294*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4295esac
4296case "$cppflags" in
4297'');;
4298*)
4299 echo " "
4300 echo "Let me guess what the preprocessor flags are..." >&4
4301 set X $cppflags
4302 shift
4303 cppflags=''
4304 $cat >cpp.c <<'EOM'
4305#define BLURFL foo
4306
4307BLURFL xx LFRULB
4308EOM
4309 previous=''
4310 for flag in $*
4311 do
4312 case "$flag" in
4313 -*) ftry="$flag";;
4314 *) ftry="$previous $flag";;
4315 esac
7bac28a0 4316 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
a4f3eea9 4317 >cpp1.out 2>/dev/null && \
dfe9444c 4318 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
a4f3eea9 4319 >cpp2.out 2>/dev/null && \
4320 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4321 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4322 then
4323 cppflags="$cppflags $ftry"
4324 previous=''
4325 else
4326 previous="$flag"
4327 fi
4328 done
4329 set X $cppflags
4330 shift
4331 cppflags=${1+"$@"}
4332 case "$cppflags" in
4333 *-*) echo "They appear to be: $cppflags";;
4334 esac
4335 $rm -f cpp.c cpp?.out
4336 ;;
4337esac
4338
4339: flags used in final linking phase
a4f3eea9 4340case "$ldflags" in
4341'') if ./venix; then
4342 dflt='-i -z'
4343 else
4344 dflt=''
4345 fi
4346 case "$ccflags" in
4347 *-posix*) dflt="$dflt -posix" ;;
4348 esac
4349 ;;
4350*) dflt="$ldflags";;
4351esac
4352
4353: Try to guess additional flags to pick up local libraries.
4354for thislibdir in $libpth; do
4355 case " $loclibpth " in
4356 *" $thislibdir "*)
4357 case "$dflt " in
4358 *"-L$thislibdir "*) ;;
4359 *) dflt="$dflt -L$thislibdir" ;;
4360 esac
4361 ;;
4362 esac
4363done
4364
4365case "$dflt" in
4366'') dflt='none' ;;
4367esac
4368
4369$cat <<EOH
4370
4371Your C linker may need flags. For this question you should
4372include -L/whatever and any other flags used by the C linker, but you
4373should NOT include libraries like -lwhatever.
4374
4375Make sure you include the appropriate -L/path flags if your C linker
4376does not normally search all of the directories you specified above,
4377namely
4378 $libpth
4379To use no flags, specify the word "none".
4380
4381EOH
4382
4383rp="Any additional ld flags (NOT including libraries)?"
4384. ./myread
4385case "$ans" in
4386none) ldflags='';;
4387*) ldflags="$ans";;
4388esac
4389rmlist="$rmlist pdp11"
4390
4391: coherency check
4392echo " "
dfe9444c 4393echo "Checking your choice of C compiler and flags for coherency..." >&4
5ff3f7a4
GS
4394$cat > try.c <<'EOF'
4395#include <stdio.h>
732c9516 4396int main() { printf("Ok\n"); exit(0); }
5ff3f7a4 4397EOF
87563a30 4398set X $cc $optimize $ccflags -o try $ldflags try.c $libs
a4f3eea9 4399shift
5ff3f7a4
GS
4400$cat >try.msg <<'EOM'
4401I've tried to compile and run the following simple program:
4402
4403EOM
a83b1ac8 4404$cat try.c >> try.msg
5ff3f7a4
GS
4405
4406$cat >> try.msg <<EOM
4407
4408I used the command:
a4f3eea9 4409
4410 $*
4411 ./try
4412
4413and I got the following output:
4414
4415EOM
a4f3eea9 4416dflt=y
28e8609d 4417if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
a4f3eea9 4418 if sh -c './try' >>try.msg 2>&1; then
dfe9444c
AD
4419 xxx=`./try`
4420 case "$xxx" in
4421 "Ok") dflt=n ;;
4422 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4423 case " $libs " in
4424 *" -lsfio "*)
4425 cat >> try.msg <<'EOQS'
4426If $libs contains -lsfio, and sfio is mis-configured, then it
4427sometimes (apparently) runs and exits with a 0 status, but with no
4428output! It may have to do with sfio's use of _exit vs. exit.
4429
4430EOQS
4431 rp="You have a big problem. Shall I abort Configure"
4432 dflt=y
4433 ;;
4434 esac
4435 ;;
4436 esac
a4f3eea9 4437 else
4438 echo "The program compiled OK, but exited with status $?." >>try.msg
dfe9444c 4439 rp="You have a problem. Shall I abort Configure"
a4f3eea9 4440 dflt=y
4441 fi
4442else
4443 echo "I can't compile the test program." >>try.msg
dfe9444c 4444 rp="You have a BIG problem. Shall I abort Configure"
a4f3eea9 4445 dflt=y
4446fi
4447case "$dflt" in
4448y)
97286747 4449 $cat try.msg >&4
a4f3eea9 4450 case "$knowitall" in
4451 '')
5ff3f7a4 4452 echo "(The supplied flags or libraries might be incorrect.)"
a4f3eea9 4453 ;;
4454 *) dflt=n;;
4455 esac
4456 echo " "
4457 . ./myread
4458 case "$ans" in
4459 n*|N*) ;;
4460 *) echo "Ok. Stopping Configure." >&4
4461 exit 1
4462 ;;
4463 esac
4464 ;;
4465n) echo "OK, that should do.";;
4466esac
4467$rm -f try try.* core
4468
bfb7748a
AD
4469: determine filename position in cpp output
4470echo " "
4471echo "Computing filename position in cpp output for #include directives..." >&4
4472echo '#include <stdio.h>' > foo.c
4473$cat >fieldn <<EOF
4474$startsh
4475$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4476$grep '^[ ]*#.*stdio\.h' | \
4477while read cline; do
4478 pos=1
4479 set \$cline
4480 while $test \$# -gt 0; do
4481 if $test -r \`echo \$1 | $tr -d '"'\`; then
4482 echo "\$pos"
4483 exit 0
4484 fi
4485 shift
4486 pos=\`expr \$pos + 1\`
4487 done
4488done
4489EOF
4490chmod +x fieldn
4491fieldn=`./fieldn`
4492$rm -f foo.c fieldn
4493case $fieldn in
4494'') pos='???';;
44951) pos=first;;
44962) pos=second;;
44973) pos=third;;
4498*) pos="${fieldn}th";;
4499esac
4500echo "Your cpp writes the filename in the $pos field of the line."
4501
4502: locate header file
4503$cat >findhdr <<EOF
4504$startsh
4505wanted=\$1
9cc6feab 4506name=''
3656fc86
JH
4507for usrincdir in $usrinc
4508do
4509 if test -f \$usrincdir/\$wanted; then
4510 echo "\$usrincdir/\$wanted"
4511 exit 0
4512 fi
4513done
bfb7748a
AD
4514awkprg='{ print \$$fieldn }'
4515echo "#include <\$wanted>" > foo\$\$.c
4516$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4517$grep "^[ ]*#.*\$wanted" | \
4518while read cline; do
4519 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4520 case "\$name" in
4e400192
JH
4521 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4522 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4523 *) exit 2;;
bfb7748a
AD
4524 esac;
4525done;
4e400192
JH
4526#
4527# status = 0: grep returned 0 lines, case statement not executed
4528# status = 1: headerfile found
4529# status = 2: while loop executed, no headerfile found
4530#
4531status=\$?
bfb7748a 4532$rm -f foo\$\$.c;
4e400192
JH
4533if test \$status -eq 1; then
4534 exit 0;
4535fi
4536exit 1
bfb7748a
AD
4537EOF
4538chmod +x findhdr
4539
4540: define an alternate in-header-list? function
4541inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4542cont=true; xxf="echo \"<\$1> found.\" >&4";
4543case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4544*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4545esac;
4546case $# in 4) instead=instead;; *) instead="at last";; esac;
4547while $test "$cont"; do
4548 xxx=`./findhdr $1`
4549 var=$2; eval "was=\$$2";
4550 if $test "$xxx" && $test -r "$xxx";
4551 then eval $xxf;
4552 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4553 cont="";
4554 else eval $xxnf;
4555 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4556 set $yyy; shift; shift; yyy=$@;
4557 case $# in 0) cont="";;
4558 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4559 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4560 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4561 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4562 esac;
4563done;
4564while $test "$yyy";
4565do set $yyy; var=$2; eval "was=\$$2";
4566 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4567 set $yyy; shift; shift; yyy=$@;
4568done'
4569
4570: see if this is a malloc.h system
4571set malloc.h i_malloc
4572eval $inhdr
4573
4574: see if stdlib is available
4575set stdlib.h i_stdlib
4576eval $inhdr
4577
4578: determine which malloc to compile in
4579echo " "
4580case "$usemymalloc" in
5ff3f7a4
GS
4581''|[yY]*|true|$define) dflt='y' ;;
4582*) dflt='n' ;;
bfb7748a
AD
4583esac
4584rp="Do you wish to attempt to use the malloc that comes with $package?"
4585. ./myread
4586usemymalloc="$ans"
4587case "$ans" in
4588y*|true)
4589 usemymalloc='y'
4590 mallocsrc='malloc.c'
4591 mallocobj="malloc$_o"
4592 d_mymalloc="$define"
4593 case "$libs" in
4594 *-lmalloc*)
4595 : Remove malloc from list of libraries to use
4596 echo "Removing unneeded -lmalloc from library list" >&4
4597 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4598 shift
4599 libs="$*"
4600 echo "libs = $libs" >&4
4601 ;;
4602 esac
4603 ;;
4604*)
4605 usemymalloc='n'
4606 mallocsrc=''
4607 mallocobj=''
4608 d_mymalloc="$undef"
4609 ;;
4610esac
4611
4612: compute the return types of malloc and free
4613echo " "
4614$cat >malloc.c <<END
4615#$i_malloc I_MALLOC
4616#$i_stdlib I_STDLIB
4617#include <stdio.h>
4618#include <sys/types.h>
4619#ifdef I_MALLOC
4620#include <malloc.h>
4621#endif
4622#ifdef I_STDLIB
4623#include <stdlib.h>
4624#endif
4625#ifdef TRY_MALLOC
4626void *malloc();
4627#endif
4628#ifdef TRY_FREE
4629void free();
4630#endif
4631END
4632case "$malloctype" in
4633'')
4634 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4635 malloctype='void *'
4636 else
4637 malloctype='char *'
4638 fi
4639 ;;
4640esac
4641echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4642
4643case "$freetype" in
4644'')
4645 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4646 freetype='void'
4647 else
4648 freetype='int'
4649 fi
4650 ;;
4651esac
4652echo "Your system uses $freetype free(), it would seem." >&4
4653$rm -f malloc.[co]
a3635516
JH
4654$cat <<EOM
4655
4656The installation process will also create a directory for
4657vendor-supplied add-ons. Vendors who supply perl with their system
4658may find it convenient to place all vendor-supplied files in this
4659directory rather than in the main distribution directory. This will
4660ease upgrades between binary-compatible maintenance versions of perl.
4661
4662Of course you may also use these directories in whatever way you see
4663fit. For example, you might use them to access modules shared over a
4664company-wide network.
4665
4666The default answer should be fine for most people.
4667This causes further questions about vendor add-ons to be skipped
4668and no vendor-specific directories will be configured for perl.
4669
4670EOM
4671rp='Do you want to configure vendor-specific add-on directories?'
4672case "$usevendorprefix" in
4673define|true|[yY]*) dflt=y ;;
4674*) dflt=n ;;
4675esac
4676. ./myread
4677case "$ans" in
4678[yY]*) fn=d~+
4679 rp='Installation prefix to use for vendor-supplied add-ons?'
4680 case "$vendorprefix" in
4681 '') dflt='' ;;
4682 *) dflt=$vendorprefix ;;
4683 esac
4684 . ./getfile
4685 oldvendorprefix=''
4686 case "$vendorprefix" in
4687 '') ;;
4688 *) case "$ans" in
4689 "$prefix") ;;
4690 *) oldvendorprefix="$prefix";;
4691 esac
4692 ;;
4693 esac
4694 usevendorprefix="$define"
4695 vendorprefix="$ans"
4696 vendorprefixexp="$ansexp"
4697 ;;
4698*) usevendorprefix="$undef"
4699 vendorprefix=''
4700 vendorprefixexp=''
4701 ;;
4702esac
4703
4704case "$vendorprefix" in
4705'') d_vendorlib="$undef"
4706 vendorlib=''
4707 vendorlibexp=''
4708 ;;
4709*) d_vendorlib="$define"
4710 : determine where vendor-supplied modules go.
4711 : Usual default is /usr/local/lib/perl5/vendor_perl
4712 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4713 case "$installstyle" in
4714 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4715 *) dflt=$vendorprefix/lib/vendor_$prog ;;
4716 esac
4717 fn=d~+
4718 rp='Pathname for the vendor-supplied library files?'
4719 . ./getfile
4720 vendorlib="$ans"
4721 vendorlibexp="$ansexp"
4722 : Change installation prefix, if necessary.
4723 if $test X"$prefix" != X"$installprefix"; then
4724 installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
4725 else
4726 installvendorlib="$vendorlibexp"
4727 fi
4728 ;;
4729esac
4730
c4f23d77
AD
4731: Cruising for prototypes
4732echo " "
4733echo "Checking out function prototypes..." >&4
4734$cat >prototype.c <<'EOCP'
5a411a32 4735int main(int argc, char *argv[]) {
c4f23d77
AD
4736 exit(0);}
4737EOCP
4738if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4739 echo "Your C compiler appears to support function prototypes."
4740 val="$define"
4741else
4742 echo "Your C compiler doesn't seem to understand function prototypes."
4743 val="$undef"
4744fi
4745set prototype
4746eval $setvar
4747$rm -f prototype*
4748
4749case "$prototype" in
4750"$define") ;;
4751*) ansi2knr='ansi2knr'
4752 echo " "
4753 cat <<EOM >&4
4754
4755$me: FATAL ERROR:
4756This version of $package can only be compiled by a compiler that
4757understands function prototypes. Unfortunately, your C compiler
4758 $cc $ccflags
4759doesn't seem to understand them. Sorry about that.
4760
5ff3f7a4 4761If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
4762
4763Eventually, we hope to support building Perl with pre-ANSI compilers.
4764If you would like to help in that effort, please contact <perlbug@perl.org>.
4765
4766Aborting Configure now.
4767EOM
4768 exit 2
4769 ;;
4770esac
4771
4772: determine where public executables go
4773echo " "
4774set dflt bin bin
4775eval $prefixit
4776fn=d~
4777rp='Pathname where the public executables will reside?'
4778. ./getfile
4779if $test "X$ansexp" != "X$binexp"; then
4780 installbin=''
4781fi
4782bin="$ans"
4783binexp="$ansexp"
dd4e71fd
JH
4784: Change installation prefix, if necessary.
4785: XXX Bug? -- ignores Configure -Dinstallprefix setting.
4786if $test X"$prefix" != X"$installprefix"; then
71c4afb4
JH
4787 installbin=`echo $binexp | sed 's#^$prefix#$installprefix#'`
4788else
4789 installbin="$binexp"
c4f23d77
AD
4790fi
4791
104d25b7
JH
4792: determine whether to install perl also as /usr/bin/perl
4793
4794echo " "
dd4e71fd 4795if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7
JH
4796 $cat <<EOM
4797Many scripts expect to perl to be installed as /usr/bin/perl.
4798I can install the perl you are about to compile also as /usr/bin/perl
4799(in addition to $installbin/perl).
4800EOM
472a4973
JH
4801 case "$installusrbinperl" in
4802 "$undef"|[nN]*) dflt='n';;
4803 *) dflt='y';;
4804 esac
104d25b7
JH
4805 rp="Do you want to install perl as /usr/bin/perl?"
4806 . ./myread
4807 case "$ans" in
4808 [yY]*) val="$define";;
472a4973 4809 *) val="$undef" ;;
104d25b7 4810 esac
472a4973
JH
4811else
4812 val="$undef"
4813fi
104d25b7
JH
4814set installusrbinperl
4815eval $setvar
4816
dfe9444c
AD
4817: define a shorthand compile call
4818compile='
4819mc_file=$1;
4820shift;
c4f23d77 4821$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
dc45a647
MB
4822: define a shorthand compile call for compilations that should be ok.
4823compile_ok='
4824mc_file=$1;
4825shift;
c4f23d77 4826$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
dfe9444c 4827
a4f3eea9 4828echo " "
4829echo "Checking for GNU C Library..." >&4
4830cat >gnulibc.c <<EOM
aebf16e7 4831#include <stdio.h>
5a411a32 4832int main()
a4f3eea9 4833{
aebf16e7
AD
4834#ifdef __GLIBC__
4835 exit(0);
4836#else
4837 exit(1);
4838#endif
a4f3eea9 4839}
4840EOM
dfe9444c 4841set gnulibc
aebf16e7 4842if eval $compile_ok && ./gnulibc; then
a4f3eea9 4843 val="$define"
4844 echo "You are using the GNU C Library"
4633a7c4 4845else
a4f3eea9 4846 val="$undef"
4847 echo "You are not using the GNU C Library"
4633a7c4 4848fi
a4f3eea9 4849$rm -f gnulibc*
4850set d_gnulibc
4851eval $setvar
25f94b33 4852
a4f3eea9 4853: see if nm is to be used to determine whether a symbol is defined or not
4854case "$usenm" in
4855'')
dc45a647 4856 dflt=''
a4f3eea9 4857 case "$d_gnulibc" in
dc45a647
MB
4858 "$define")
4859 echo " "
4860 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 4861 dflt=n
4862 ;;
dc45a647
MB
4863 esac
4864 case "$dflt" in
4865 '')
4866 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4867 echo " "
4868 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4869 echo "'nm' won't be sufficient on this sytem." >&4
4870 dflt=n
4871 fi
4872 ;;
4873 esac
4874 case "$dflt" in
c4f23d77 4875 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 4876 if $test $dflt -gt 20; then
4877 dflt=y
4878 else
4879 dflt=n
4880 fi
4881 ;;
4882 esac
4883 ;;
4884*)
4885 case "$usenm" in
dc45a647 4886 true|$define) dflt=y;;
a4f3eea9 4887 *) dflt=n;;
4888 esac
4889 ;;
25f94b33 4890esac
a4f3eea9 4891$cat <<EOM
4633a7c4 4892
dc45a647
MB
4893I can use $nm to extract the symbols from your C libraries. This
4894is a time consuming task which may generate huge output on the disk (up
4895to 3 megabytes) but that should make the symbols extraction faster. The
4896alternative is to skip the 'nm' extraction part and to compile a small
4897test program instead to determine whether each symbol is present. If
4898you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4899this may be the best solution.
4900
4901You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 4902
a4f3eea9 4903EOM
693762b4 4904rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
4905. ./myread
4906case "$ans" in
dc45a647 4907[Nn]*) usenm=false;;
a4f3eea9 4908*) usenm=true;;
4633a7c4
LW
4909esac
4910
a4f3eea9 4911runnm=$usenm
4912case "$reuseval" in
4913true) runnm=false;;
4633a7c4 4914esac
a4f3eea9 4915
4916: nm options which may be necessary
4917case "$nm_opt" in
4918'') if $test -f /mach_boot; then
1e422769 4919 nm_opt='' # Mach
a4f3eea9 4920 elif $test -d /usr/ccs/lib; then
1e422769 4921 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 4922 elif $test -f /dgux; then
1e422769 4923 nm_opt='-p' # DG-UX
2ae324a7 4924 elif $test -f /lib64/rld; then
1e422769 4925 nm_opt='-p' # 64-bit Irix
a4f3eea9 4926 else
4927 nm_opt=''
4928 fi;;
4633a7c4 4929esac
4633a7c4 4930
a4f3eea9 4931: nm options which may be necessary for shared libraries but illegal
4932: for archive libraries. Thank you, Linux.
4933case "$nm_so_opt" in
4934'') case "$myuname" in
4935 *linux*)
693762b4 4936 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 4937 nm_so_opt='--dynamic'
4633a7c4 4938 fi
a4f3eea9 4939 ;;
4633a7c4 4940 esac
4633a7c4
LW
4941 ;;
4942esac
4943
a4f3eea9 4944case "$runnm" in
4945true)
4946: get list of predefined functions in a handy place
4947echo " "
4948case "$libc" in
4949'') libc=unknown
4950 case "$libs" in
dfe9444c 4951 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 4952 esac
4953 ;;
4954esac
4955libnames='';
4956case "$libs" in
4957'') ;;
4958*) for thislib in $libs; do
4959 case "$thislib" in
4960 -lc|-lc_s)
4961 : Handle C library specially below.
4962 ;;
4963 -l*)
4964 thislib=`echo $thislib | $sed -e 's/^-l//'`
4965 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4966 :
4967 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4968 :
dfe9444c 4969 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 4970 :
dfe9444c 4971 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 4972 :
a4f3eea9 4973 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4974 :
4975 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4976 :
dfe9444c 4977 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 4978 :
4979 else
4980 try=''
4981 fi
4982 libnames="$libnames $try"
4983 ;;
4984 *) libnames="$libnames $thislib" ;;
4985 esac
4986 done
4987 ;;
4988esac
4989xxx=normal
4990case "$libc" in
4991unknown)
4992 set /lib/libc.$so
4993 for xxx in $libpth; do
4994 $test -r $1 || set $xxx/libc.$so
4995 : The messy sed command sorts on library version numbers.
4996 $test -r $1 || \
4997 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 4998 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 4999 h
5000 s/[0-9][0-9]*/0000&/g
5001 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5002 G
5003 s/\n/ /' | \
dfe9444c 5004 sort | $sed -e 's/^.* //'`
a4f3eea9 5005 eval set \$$#
5006 done
5007 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
5008 $test -r $1 || set /lib/libsys_s$_a
5009 ;;
a4f3eea9 5010*)
5011 set blurfl
5012 ;;
5013esac
5014if $test -r "$1"; then
5015 echo "Your (shared) C library seems to be in $1."
5016 libc="$1"
5017elif $test -r /lib/libc && $test -r /lib/clib; then
5018 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5019 xxx=apollo
5020 libc='/lib/clib /lib/libc'
5021 if $test -r /lib/syslib; then
5022 echo "(Your math library is in /lib/syslib.)"
5023 libc="$libc /lib/syslib"
5024 fi
5025elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5026 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
5027elif $test -r $incpath/usr/lib/libc$_a; then
5028 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 5029 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
5030elif $test -r /lib/libc$_a; then
5031 libc=/lib/libc$_a;
a4f3eea9 5032 echo "Your C library seems to be in $libc. You're normal."
5033else
dfe9444c 5034 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 5035 :
5036 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5037 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5038 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5039 :
dfe9444c 5040 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5041 :
dfe9444c 5042 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5043 :
4633a7c4 5044 else
dfe9444c 5045 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 5046 fi
a4f3eea9 5047 if $test -r "$tans"; then
5048 echo "Your C library seems to be in $tans, of all places."
5049 libc=$tans
5050 else
5051 libc='blurfl'
5052 fi
5053fi
5054if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5055 dflt="$libc"
5056 cat <<EOM
4633a7c4 5057
a4f3eea9 5058If the guess above is wrong (which it might be if you're using a strange
5059compiler, or your machine supports multiple models), you can override it here.
4633a7c4 5060
a4f3eea9 5061EOM
5062else
5063 dflt=''
28e8609d 5064 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 5065 cat >&4 <<EOM
5066I can't seem to find your C library. I've looked in the following places:
4633a7c4 5067
a4f3eea9 5068EOM
5069 $sed 's/^/ /' libpath
5070 cat <<EOM
4633a7c4 5071
a4f3eea9 5072None of these seems to contain your C library. I need to get its name...
4633a7c4 5073
a4f3eea9 5074EOM
5075fi
5076fn=f
5077rp='Where is your C library?'
5078. ./getfile
5079libc="$ans"
4633a7c4 5080
4633a7c4 5081echo " "
28e8609d 5082echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 5083set X `cat libnames`
4633a7c4 5084shift
a4f3eea9 5085xxx=files
5086case $# in 1) xxx=file; esac
5087echo "Extracting names from the following $xxx for later perusal:" >&4
5088echo " "
5089$sed 's/^/ /' libnames >&4
5090echo " "
5091$echo $n "This may take a while...$c" >&4
4633a7c4 5092
dfe9444c
AD
5093for file in $*; do
5094 case $file in
693762b4
AD
5095 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5096 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5097 esac
dfe9444c 5098done >libc.tmp
4633a7c4 5099
a4f3eea9 5100$echo $n ".$c"
5101$grep fprintf libc.tmp > libc.ptf
5102xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5103xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5104xxx='[ADTSIW]'
5105if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5106 eval $xscan;\
5107 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5108 eval $xrun
5109elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5110 eval $xscan;\
5111 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5112 eval $xrun
5113elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5114 eval $xscan;\
5115 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5116 eval $xrun
5117elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5118 eval $xscan;\
5119 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5120 eval $xrun
5121elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5122 eval $xscan;\
5123 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5124 eval $xrun
5125elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5126 eval $xscan;\
5127 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5128 eval $xrun
5129elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5130 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5131 eval $xscan;\
5132 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5133 eval $xrun
5134elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5135 eval $xscan;\
5136 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5137 eval $xrun
5138elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5139 eval $xscan;\
5140 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5141 eval $xrun
1e422769 5142elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5143 eval $xscan;\
5144 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5145 eval $xrun
a4f3eea9 5146elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5147 eval $xscan;\
5148 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5149 eval $xrun
5150elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5151 eval $xscan;\
5152 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5153 eval $xrun
44a8e56a 5154elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5155 eval $xscan;\
5156 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5157 eval $xrun
0f502cca
BL
5158elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5159 eval $xscan;\
5160 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5161 eval $xrun
a4f3eea9 5162else
693762b4 5163 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 5164 $grep fprintf libc.tmp > libc.ptf
5165 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5166 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5167 then
5168 nm_opt='-p'
5169 eval $xrun
4633a7c4 5170 else
a4f3eea9 5171 echo " "
e5c9fcd0 5172 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 5173 com=''
dc45a647
MB
5174 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5175 for thisname in $libnames $libc; do
e5c9fcd0 5176 $ar t $thisname >>libc.tmp
a4f3eea9 5177 done
dfe9444c 5178 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 5179 echo "Ok." >&4
dc45a647
MB
5180 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5181 # Repeat libc to extract forwarders to DLL entries too
5182 for thisname in $libnames $libc; do
5183 $ar tv $thisname >>libc.tmp
5184 # Revision 50 of EMX has bug in $ar.
5185 # it will not extract forwarders to DLL entries
5186 # Use emximp which will extract exactly them.
5187 emximp -o tmp.imp $thisname \
5188 2>/dev/null && \
5189 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5190 < tmp.imp >>libc.tmp
5191 $rm tmp.imp
5192 done
5193 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5194 echo "Ok." >&4
a4f3eea9 5195 else
e5c9fcd0 5196 echo "$ar didn't seem to work right." >&4
a4f3eea9 5197 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 5198 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 5199 then
5200 for thisname in $libnames; do
5201 bld t $libnames | \
dfe9444c 5202 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 5203 $ar t $thisname >>libc.tmp
a4f3eea9 5204 done
5205 echo "Ok." >&4
5206 else
5207 echo "That didn't work either. Giving up." >&4
5208 exit 1
5209 fi
5210 fi
4633a7c4 5211 fi
4633a7c4 5212fi
a4f3eea9 5213nm_extract="$com"
5214if $test -f /lib/syscalls.exp; then
4633a7c4 5215 echo " "
a4f3eea9 5216 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 5217 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 5218fi
5219;;
5220esac
5221$rm -f libnames libpath
5222
2afac517 5223: see if dld is available
5224set dld.h i_dld
5225eval $inhdr
4633a7c4 5226
2afac517 5227: is a C symbol defined?
5228csym='tlook=$1;
5229case "$3" in
5230-v) tf=libc.tmp; tc=""; tdc="";;
5231-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5232*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5233esac;
5234tx=yes;
5235case "$reuseval-$4" in
5236true-) ;;
5237true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5238esac;
5239case "$tx" in
5240yes)
5241 case "$runnm" in
5242 true)
5243 if $contains $tlook $tf >/dev/null 2>&1;
5244 then tval=true;
5245 else tval=false;
5246 fi;;
5247 *)
d674cd6d 5248 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 5249 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 5250 then tval=true;
5251 else tval=false;
5252 fi;
5253 $rm -f t t.c;;
5254 esac;;
5255*)
5256 case "$tval" in
5257 $define) tval=true;;
5258 *) tval=false;;
5259 esac;;
5260esac;
5261eval "$2=$tval"'
4633a7c4 5262
2afac517 5263: define an is-in-libc? function
5264inlibc='echo " "; td=$define; tu=$undef;
5265sym=$1; var=$2; eval "was=\$$2";
5266tx=yes;
5267case "$reuseval$was" in
5268true) ;;
5269true*) tx=no;;
5270esac;
5271case "$tx" in
5272yes)
5273 set $sym tres -f;
5274 eval $csym;
5275 case "$tres" in
5276 true)
5277 echo "$sym() found." >&4;
5278 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5279 *)
5280 echo "$sym() NOT found." >&4;
5281 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5282 esac;;
5283*)
5284 case "$was" in
5285 $define) echo "$sym() found." >&4;;
5286 *) echo "$sym() NOT found." >&4;;
5287 esac;;
5288esac'
4633a7c4 5289
2afac517 5290: see if dlopen exists
5291xxx_runnm="$runnm"
5292runnm=false
5293set dlopen d_dlopen
5294eval $inlibc
5295runnm="$xxx_runnm"
40a7a20a 5296
2afac517 5297: determine which dynamic loading, if any, to compile in
4633a7c4 5298echo " "
2afac517 5299dldir="ext/DynaLoader"
5300case "$usedl" in
5301$define|y|true)
5302 dflt='y'
5303 usedl="$define"
5304 ;;
5305$undef|n|false)
5306 dflt='n'
5307 usedl="$undef"
5308 ;;
5309*)
5310 dflt='n'
5311 case "$d_dlopen" in
5312 $define) dflt='y' ;;
5313 esac
5314 case "$i_dld" in
5315 $define) dflt='y' ;;
4633a7c4 5316 esac
2afac517 5317 : Does a dl_xxx.xs file exist for this operating system
dc45a647 5318 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
5319 ;;
5320esac
2afac517 5321rp="Do you wish to use dynamic loading?"
5322. ./myread
5323usedl="$ans"
5324case "$ans" in
5325y*) usedl="$define"
5326 case "$dlsrc" in
5327 '')
dc45a647 5328 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 5329 dflt="$dldir/dl_${osname}.xs"
5330 elif $test "$d_dlopen" = "$define" ; then
5331 dflt="$dldir/dl_dlopen.xs"
5332 elif $test "$i_dld" = "$define" ; then
5333 dflt="$dldir/dl_dld.xs"
4633a7c4 5334 else
2afac517 5335 dflt=''
4633a7c4 5336 fi
4633a7c4 5337 ;;
2afac517 5338 *) dflt="$dldir/$dlsrc"
5339 ;;
4633a7c4 5340 esac
2afac517 5341 echo "The following dynamic loading files are available:"
5342 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
5343 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5344 rp="Source file to use for dynamic loading"
5345 fn="fne"
b233458b 5346 gfpth="$src"
dc45a647 5347 . ./getfile
2afac517 5348 usedl="$define"
5349 : emulate basename
5350 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 5351
dc45a647 5352 $cat << EOM
2304df62 5353
2afac517 5354Some systems may require passing special flags to $cc -c to
5355compile modules that will be used to create a shared library.
5356To use no flags, say "none".
2304df62
AD
5357
5358EOM
2afac517 5359 case "$cccdlflags" in
5360 '') case "$gccversion" in
5361 '') case "$osname" in
5362 hpux) dflt='+z' ;;
5363 next) dflt='none' ;;
8cc95fdb 5364 irix*) dflt='-KPIC' ;;
3a6175e1 5365 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 5366 sunos) dflt='-pic' ;;
5367 *) dflt='none' ;;
dfe9444c
AD
5368 esac
5369 ;;
5370 *) case "$osname" in
3a6175e1 5371 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 5372 *) dflt='-fpic' ;;
81d89818 5373 esac ;;
2afac517 5374 esac ;;
bfb7748a 5375 ' ') dflt='none' ;;
2afac517 5376 *) dflt="$cccdlflags" ;;
5377 esac
5378 rp="Any special flags to pass to $cc -c to compile shared library modules?"
5379 . ./myread
5380 case "$ans" in
5381 none) cccdlflags=' ' ;;
5382 *) cccdlflags="$ans" ;;
5383 esac
2304df62 5384
2afac517 5385 cat << EOM
ecfc5424 5386
2afac517 5387Some systems use ld to create libraries that can be dynamically loaded,
5388while other systems (such as those using ELF) use $cc.
a0f45b59 5389
2afac517 5390EOM
5391 case "$ld" in
5392 '') $cat >try.c <<'EOM'
5393/* Test for whether ELF binaries are produced */
5394#include <fcntl.h>
5395#include <stdlib.h>
5a411a32 5396int main() {
2afac517 5397 char b[4];
5398 int i = open("a.out",O_RDONLY);
5399 if(i == -1)
5400 exit(1); /* fail */
5401 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5402 exit(0); /* succeed (yes, it's ELF) */
2304df62 5403 else
2afac517 5404 exit(1); /* fail */
5405}
5406EOM
5407 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5408 cat <<EOM
5409You appear to have ELF support. I'll use $cc to build dynamic libraries.
5410EOM
5411 dflt="$cc"
2304df62 5412 else
2afac517 5413 echo "I'll use ld to build dynamic libraries."
5414 dflt='ld'
2304df62 5415 fi
2afac517 5416 rm -f try.c a.out
5417 ;;
5418 *) dflt="$ld"
5419 ;;
5420 esac
5421
5422 rp="What command should be used to create dynamic libraries?"
5423 . ./myread
5424 ld="$ans"
5425
5426 cat << EOM
5427
5428Some systems may require passing special flags to $ld to create a
5429library that can be dynamically loaded. If your ld flags include
5430-L/other/path options to locate libraries outside your loader's normal
5431search path, you may need to specify those -L options here as well. To
5432use no flags, say "none".
5433
5434EOM
5435 case "$lddlflags" in
5436 '') case "$osname" in
46193409 5437 beos) dflt='-nostart' ;;
2afac517 5438 hpux) dflt='-b' ;;
5439 linux|irix*) dflt='-shared' ;;
5440 next) dflt='none' ;;
5441 solaris) dflt='-G' ;;
5442 sunos) dflt='-assert nodefinitions' ;;
5443 svr4*|esix*) dflt="-G $ldflags" ;;
5444 *) dflt='none' ;;
5445 esac
5446 ;;
5447 *) dflt="$lddlflags" ;;
5448 esac
5449
bfb7748a 5450 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
5451 : Be careful not to append to a plain 'none'
5452 case "$dflt" in
5453 none) dflt='' ;;
5454 esac
bfb7748a
AD
5455 for thisflag in $ldflags; do
5456 case "$thisflag" in
5457 -L*)
5458 case " $dflt " in
5459 *" $thisflag "*) ;;
5460 *) dflt="$dflt $thisflag" ;;
5461 esac
5462 ;;
2afac517 5463 esac
bfb7748a 5464 done
2afac517 5465
bfb7748a
AD
5466 case "$dflt" in
5467 ''|' ') dflt='none' ;;
5468 esac
2afac517 5469
5470 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5471 . ./myread
5472 case "$ans" in
5473 none) lddlflags=' ' ;;
5474 *) lddlflags="$ans" ;;
5475 esac
5476
5477 cat <<EOM
5478
5479Some systems may require passing special flags to $cc to indicate that
5480the resulting executable will use dynamic linking. To use no flags,
5481say "none".
5482
5483EOM
5484 case "$ccdlflags" in
5485 '') case "$osname" in
5486 hpux) dflt='-Wl,-E' ;;
5487 linux) dflt='-rdynamic' ;;
5488 next) dflt='none' ;;
5489 sunos) dflt='none' ;;
5490 *) dflt='none' ;;
5491 esac ;;
bfb7748a 5492 ' ') dflt='none' ;;
2afac517 5493 *) dflt="$ccdlflags" ;;
5494 esac
5495 rp="Any special flags to pass to $cc to use dynamic loading?"
5496 . ./myread
5497 case "$ans" in
5498 none) ccdlflags=' ' ;;
5499 *) ccdlflags="$ans" ;;
5500 esac
5501 ;;
5502*) usedl="$undef"
5503 ld='ld'
5504 dlsrc='dl_none.xs'
5505 lddlflags=''
5506 ccdlflags=''
5507 ;;
5508esac
5509
5510also=''
5511case "$usedl" in
5512$undef)
5513 # No dynamic loading being used, so don't bother even to prompt.
5514 useshrplib='false'
5515 ;;
5516*) case "$useshrplib" in
5517 '') case "$osname" in
46193409 5518 svr4*|dgux|dynixptx|esix|powerux|beos)
3e3baf6d 5519 dflt=y
2afac517 5520 also='Building a shared libperl is required for dynamic loading to work on your system.'
5521 ;;
5522 next*)
5523 case "$osvers" in
3e3baf6d 5524 4*) dflt=y
2afac517 5525 also='Building a shared libperl is needed for MAB support.'
5526 ;;
3e3baf6d 5527 *) dflt=n
2afac517 5528 ;;
5529 esac
5530 ;;
3e3baf6d 5531 *) dflt=n
2afac517 5532 ;;
5533 esac
5534 ;;
5535 $define|true|[Yy]*)
3e3baf6d 5536 dflt=y
2afac517 5537 ;;
3e3baf6d 5538 *) dflt=n
2afac517 5539 ;;
5540 esac
5541 $cat << EOM
5542
5543The perl executable is normally obtained by linking perlmain.c with
dfe9444c 5544libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 5545any other libraries needed on this system (such as -lm, etc.). Since
5546your system supports dynamic loading, it is probably possible to build
5547a shared libperl.$so. If you will have more than one executable linked
5548to libperl.$so, this will significantly reduce the size of each
5549executable, but it may have a noticeable affect on performance. The
5550default is probably sensible for your system.
5551$also
5552
5553EOM
5554 rp="Build a shared libperl.$so (y/n)"
5555 . ./myread
5556 case "$ans" in
5557 true|$define|[Yy]*)
5cf1d1f1 5558 useshrplib='true' ;;
2afac517 5559 *) useshrplib='false' ;;
5560 esac
5561 ;;
5562esac
5563
5564case "$useshrplib" in
5565true)
5566 case "$libperl" in
5567 '')
5568 # Figure out a good name for libperl.so. Since it gets stored in
5569 # a version-specific architecture-dependent library, the version
5570 # number isn't really that important, except for making cc/ld happy.
5571 #
5572 # A name such as libperl.so.3.1
5573 majmin="libperl.$so.$patchlevel.$subversion"
5574 # A name such as libperl.so.301
5575 majonly=`echo $patchlevel $subversion |
5576 $awk '{printf "%d%02d", $1, $2}'`
5577 majonly=libperl.$so.$majonly
5578 # I'd prefer to keep the os-specific stuff here to a minimum, and
5579 # rely on figuring it out from the naming of libc.
5580 case "${osname}${osvers}" in
5581 next4*)
5582 dflt=libperl.5.$so
5583 # XXX How handle the --version stuff for MAB?
5584 ;;
5585 linux*) # ld won't link with a bare -lperl otherwise.
5586 dflt=libperl.$so
5587 ;;
5588 *) # Try to guess based on whether libc has major.minor.
5589 case "$libc" in
5590 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5591 *libc.$so.[0-9]*) dflt=$majonly ;;
5592 *) dflt=libperl.$so ;;
5593 esac
5594 ;;
5595 esac
5596 ;;
5597 *) dflt=$libperl
5598 ;;
5599 esac
5600 cat << EOM
5601
5602I need to select a good name for the shared libperl. If your system uses
5603library names with major and minor numbers, then you might want something
5604like $majmin. Alternatively, if your system uses a single version
5605number for shared libraries, then you might want to use $majonly.
5606Or, your system might be quite happy with a simple libperl.$so.
5607
5608Since the shared libperl will get installed into a version-specific
5609architecture-dependent directory, the version number of the shared perl
5610library probably isn't important, so the default should be o.k.
5611
5612EOM
5613 rp='What name do you want to give to the shared libperl?'
5614 . ./myread
5615 libperl=$ans
5616 echo "Ok, I'll use $libperl"
5617 ;;
5618*)
dfe9444c 5619 libperl="libperl${_a}"
2afac517 5620 ;;
5621esac
5622
5623# Detect old use of shrpdir via undocumented Configure -Dshrpdir
5624case "$shrpdir" in
5625'') ;;
5626*) $cat >&4 <<EOM
5627WARNING: Use of the shrpdir variable for the installation location of
5628the shared $libperl is not supported. It was never documented and
46193409 5629will not work in this version. Let me (perlbug@perl.com)
dfe9444c 5630know of any problems this may cause.
2afac517 5631
5632EOM
5633 case "$shrpdir" in
5634 "$archlibexp/CORE")
5635 $cat >&4 <<EOM
5636But your current setting of $shrpdir is
5637the default anyway, so it's harmless.
5638EOM
5639 ;;
5640 *)
4e2a5f63
AD
5641 $cat >&4 <<EOM
5642Further, your current attempted setting of $shrpdir
5643conflicts with the value of $archlibexp/CORE
5644that installperl will use.
5645EOM
dc45a647
MB
5646 ;;
5647 esac
5648 ;;
5649esac
5650
5651# How will the perl executable find the installed shared $libperl?
5652# Add $xxx to ccdlflags.
5653# If we can't figure out a command-line option, use $shrpenv to
5654# set env LD_RUN_PATH. The main perl makefile uses this.
5655shrpdir=$archlibexp/CORE
5656xxx=''
5657tmp_shrpenv=''
5658if "$useshrplib"; then
5659 case "$osname" in
5660 aix)
5661 # We'll set it in Makefile.SH...
5662 ;;
5663 solaris|netbsd)
5664 xxx="-R $shrpdir"
5665 ;;
5666 freebsd)
5667 xxx="-Wl,-R$shrpdir"
5668 ;;
5669 linux|irix*|dec_osf)
5670 xxx="-Wl,-rpath,$shrpdir"
5671 ;;
5672 next)
5673 # next doesn't like the default...
5674 ;;
46193409
JH
5675 beos)
5676 # beos doesn't like the default, either.
5677 ;;
3656fc86
JH
5678 hpux*)
5679 # hpux doesn't like the default, either.
5680 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5681 ;;
dc45a647
MB
5682 *)
5683 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5684 ;;
5685 esac
5686 case "$xxx" in
5687 '') ;;
5688 *)
5689 # Only add $xxx if it isn't already in ccdlflags.
5690 case " $ccdlflags " in
5691 *" $xxx "*) ;;
5692 *) ccdlflags="$ccdlflags $xxx"
5693 cat <<EOM >&4
5694
5695Adding $xxx to the flags
5696passed to $ld so that the perl executable will find the
5697installed shared $libperl.
5698
5699EOM
5700 ;;
5701 esac
5702 ;;
5703 esac
5704fi
5cf1d1f1
JH
5705# Fix ccdlflags in AIX for building external extensions.
5706# (For building Perl itself bare -bE:perl.exp is needed,
5707# Makefile.SH takes care of this.)
5f9d9a17 5708case "$osname" in
5cf1d1f1 5709aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5f9d9a17 5710esac
dc45a647
MB
5711# Respect a hint or command-line value.
5712case "$shrpenv" in
5713'') shrpenv="$tmp_shrpenv" ;;
5714esac
5cf1d1f1
JH
5715case "$ldlibpthname" in
5716'') ldlibpthname=LD_LIBRARY_PATH ;;
5717none) ldlibpthname='' ;;
5718esac
dc45a647
MB
5719
5720: determine where manual pages go
5721set man1dir man1dir none
5722eval $prefixit
5723$cat <<EOM
5724
5725$spackage has manual pages available in source form.
5726EOM
5727case "$nroff" in
5728nroff)
5729 echo "However, you don't have nroff, so they're probably useless to you."
5730 case "$man1dir" in
5731 '') man1dir="none";;
5732 esac;;
5733esac
5734echo "If you don't want the manual sources installed, answer 'none'."
5735case "$man1dir" in
5736' ') dflt=none
5737 ;;
5738'')
5739 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5740 lookpath="$lookpath $prefixexp/man/p_man/man1"
5741 lookpath="$lookpath $prefixexp/man/u_man/man1"
5742 lookpath="$lookpath $prefixexp/man/man.1"
5743 case "$sysman" in
5744 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5745 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5746 esac
5747 set dflt
5748 eval $prefixup
5749 ;;
5750*) dflt="$man1dir"
5751 ;;
5752esac
5753echo " "
5754fn=dn+~
5755rp="Where do the main $spackage manual pages (source) go?"
5756. ./getfile
5757if $test "X$man1direxp" != "X$ansexp"; then
5758 installman1dir=''
5759fi
5760man1dir="$ans"
5761man1direxp="$ansexp"
5762case "$man1dir" in
dd4e71fd 5763'') man1dir=' '
dc45a647
MB
5764 installman1dir='';;
5765esac
dc45a647 5766
dd4e71fd
JH
5767: Change installation prefix, if necessary.
5768if $test X"$prefix" != X"$installprefix"; then
5769 installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
71c4afb4
JH
5770else
5771 installman1dir="$man1direxp"
dc45a647
MB
5772fi
5773
5774: What suffix to use on installed man pages
5775
5776case "$man1dir" in
5777' ')
5778 man1ext='0'
5779 ;;
5780*)
5781 rp="What suffix should be used for the main $spackage man pages?"
5782 case "$man1ext" in
5783 '') case "$man1dir" in
5784 *1) dflt=1 ;;
5785 *1p) dflt=1p ;;
5786 *1pm) dflt=1pm ;;
5787 *l) dflt=l;;
5788 *n) dflt=n;;
5789 *o) dflt=o;;
5790 *p) dflt=p;;
5791 *C) dflt=C;;
5792 *L) dflt=L;;
5793 *L1) dflt=L1;;
5794 *) dflt=1;;
5795 esac
5796 ;;
5797 *) dflt="$man1ext";;
5798 esac
5799 . ./myread
5800 man1ext="$ans"
5801 ;;
5802esac
5803
5804: see if we can have long filenames
5805echo " "
5806rmlist="$rmlist /tmp/cf$$"
5807$test -d /tmp/cf$$ || mkdir /tmp/cf$$
5808first=123456789abcdef
5809second=/tmp/cf$$/$first
5810$rm -f $first $second
5811if (echo hi >$first) 2>/dev/null; then
5812 if $test -f 123456789abcde; then
5813 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
5814 val="$undef"
5815 else
5816 if (echo hi >$second) 2>/dev/null; then
5817 if $test -f /tmp/cf$$/123456789abcde; then
5818 $cat <<'EOM'
5819That's peculiar... You can have filenames longer than 14 characters, but only
5820on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
5821I shall consider your system cannot support long filenames at all.
5822EOM
5823 val="$undef"
5824 else
5825 echo 'You can have filenames longer than 14 characters.' >&4
5826 val="$define"
5827 fi
5828 else
5829 $cat <<'EOM'
5830How confusing! Some of your filesystems are sane enough to allow filenames
5831longer than 14 characters but some others like /tmp can't even think about them.
5832So, for now on, I shall assume your kernel does not allow them at all.
5833EOM
5834 val="$undef"
5835 fi
5836 fi
5837else
5838 $cat <<'EOM'
5839You can't have filenames longer than 14 chars. You can't even think about them!
5840EOM
5841 val="$undef"
5842fi
5843set d_flexfnam
5844eval $setvar
5845$rm -rf /tmp/cf$$ 123456789abcde*
5846
5847: determine where library module manual pages go
5848set man3dir man3dir none
5849eval $prefixit
5850$cat <<EOM
5851
5852$spackage has manual pages for many of the library modules.
5853EOM
5854
5855case "$nroff" in
5856nroff)
5857 $cat <<'EOM'
5858However, you don't have nroff, so they're probably useless to you.
5859EOM
5860 case "$man3dir" in
5861 '') man3dir="none";;
5862 esac;;
5863esac
5864
5865case "$d_flexfnam" in
5866undef)
5867 $cat <<'EOM'
5868However, your system can't handle the long file names like File::Basename.3.
5869EOM
5870 case "$man3dir" in
5871 '') man3dir="none";;
5872 esac;;
5873esac
5874
5875echo "If you don't want the manual sources installed, answer 'none'."
5876prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5877case "$man3dir" in
dd4e71fd
JH
5878'') dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5879 if $test -d "$privlib/man/man3"; then
5880 cat <<EOM >&4
5881
5882WARNING: Previous versions of perl installed man3 pages into
5883$privlib/man/man3. This version will suggest a
5884new default of $dflt.
5885EOM
5886 tdflt=$dflt
5887 dflt='n'
5888 rp='Do you wish to preserve the old behavior?(y/n)'
5889 . ./myread
5890 case "$ans" in
5891 y*) dflt="$privlib/man/man3" ;;
5892 *) dflt=$tdflt ;;
5893 esac
5894 fi
2afac517 5895 ;;
dc45a647
MB
5896' ') dflt=none;;
5897*) dflt="$man3dir" ;;
2afac517 5898esac
dc45a647 5899echo " "
dc45a647
MB
5900fn=dn+~
5901rp="Where do the $package library man pages (source) go?"
5902. ./getfile
dc45a647
MB
5903man3dir="$ans"
5904man3direxp="$ansexp"
dd4e71fd
JH
5905case "$man1dir" in
5906'') man3dir=' '
dc45a647
MB
5907 installman3dir='';;
5908esac
dc45a647 5909
dd4e71fd
JH
5910: Change installation prefix, if necessary.
5911if $test X"$prefix" != X"$installprefix"; then
5912 installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
71c4afb4
JH
5913else
5914 installman3dir="$man3direxp"
dc45a647
MB
5915fi
5916
5917: What suffix to use on installed man pages
dc45a647
MB
5918case "$man3dir" in
5919' ')
5920 man3ext='0'
5921 ;;
5922*)
5923 rp="What suffix should be used for the $package library man pages?"
5924 case "$man3ext" in
5925 '') case "$man3dir" in
5926 *3) dflt=3 ;;
5927 *3p) dflt=3p ;;
5928 *3pm) dflt=3pm ;;
5929 *l) dflt=l;;
5930 *n) dflt=n;;
5931 *o) dflt=o;;
5932 *p) dflt=p;;
5933 *C) dflt=C;;
5934 *L) dflt=L;;
5935 *L3) dflt=L3;;
5936 *) dflt=3;;
2afac517 5937 esac
5938 ;;
dc45a647 5939 *) dflt="$man3ext";;
2afac517 5940 esac
dc45a647
MB
5941 . ./myread
5942 man3ext="$ans"
5943 ;;
2afac517 5944esac
5945
5946: see if we have to deal with yellow pages, now NIS.
5947if $test -d /usr/etc/yp || $test -d /etc/yp; then
5948 if $test -f /usr/etc/nibindd; then
5949 echo " "
5950 echo "I'm fairly confident you're on a NeXT."
5951 echo " "
5952 rp='Do you get the hosts file via NetInfo?'
5953 dflt=y
5954 case "$hostcat" in
5955 nidump*) ;;
5956 '') ;;
5957 *) dflt=n;;
5958 esac
5959 . ./myread
5960 case "$ans" in
5961 y*) hostcat='nidump hosts .';;
5962 *) case "$hostcat" in
5963 nidump*) hostcat='';;
5964 esac
5965 ;;
5966 esac
5967 fi
5968 case "$hostcat" in
5969 nidump*) ;;
5970 *)
5971 case "$hostcat" in
5972 *ypcat*) dflt=y;;
5973 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5974 dflt=y
5975 else
5976 dflt=n
5977 fi;;
5978 *) dflt=n;;
5979 esac
5980 echo " "
5981 rp='Are you getting the hosts file via yellow pages?'
5982 . ./myread
5983 case "$ans" in
5984 y*) hostcat='ypcat hosts';;
5985 *) hostcat='cat /etc/hosts';;
5986 esac
5987 ;;
5988 esac
5989fi
dfe9444c
AD
5990case "$hostcat" in
5991'') hostcat='cat /etc/hosts';;
5992esac
5993case "$groupcat" in
5994'') groupcat='cat /etc/group';;
5995esac
5996case "$passcat" in
5997'') passcat='cat /etc/passwd';;
5998esac
2afac517 5999
6000: now get the host name
6001echo " "
6002echo "Figuring out host name..." >&4
6003case "$myhostname" in
6004'') cont=true
6005 echo 'Maybe "hostname" will work...'
6006 if tans=`sh -c hostname 2>&1` ; then
6007 myhostname=$tans
6008 phostname=hostname
6009 cont=''
6010 fi
6011 ;;
6012*) cont='';;
6013esac
6014if $test "$cont"; then
6015 if ./xenix; then
6016 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
6017 if tans=`cat /etc/systemid 2>&1` ; then
6018 myhostname=$tans
6019 phostname='cat /etc/systemid'
6020 echo "Whadyaknow. Xenix always was a bit strange..."
6021 cont=''
6022 fi
6023 elif $test -r /etc/systemid; then
6024 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6025 fi
6026fi
6027if $test "$cont"; then
6028 echo 'No, maybe "uuname -l" will work...'
6029 if tans=`sh -c 'uuname -l' 2>&1` ; then
6030 myhostname=$tans
6031 phostname='uuname -l'
6032 else
6033 echo 'Strange. Maybe "uname -n" will work...'
6034 if tans=`sh -c 'uname -n' 2>&1` ; then
6035 myhostname=$tans
6036 phostname='uname -n'
6037 else
6038 echo 'Oh well, maybe I can mine it out of whoami.h...'
6039 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6040 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6041 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6042 else
6043 case "$myhostname" in
6044 '') echo "Does this machine have an identity crisis or something?"
6045 phostname='';;
6046 *)
6047 echo "Well, you said $myhostname before..."
6048 phostname='echo $myhostname';;
6049 esac
6050 fi
6051 fi
6052 fi
6053fi
6054: you do not want to know about this
6055set $myhostname
6056myhostname=$1
6057
6058: verify guess
6059if $test "$myhostname" ; then
6060 dflt=y
6061 rp='Your host name appears to be "'$myhostname'".'" Right?"
6062 . ./myread
6063 case "$ans" in
6064 y*) ;;
6065 *) myhostname='';;
6066 esac
6067fi
6068
6069: bad guess or no guess
6070while $test "X$myhostname" = X ; do
6071 dflt=''
6072 rp="Please type the (one word) name of your host:"
6073 . ./myread
6074 myhostname="$ans"
6075done
6076
6077: translate upper to lower if necessary
6078case "$myhostname" in
6079*[A-Z]*)
6080 echo "(Normalizing case in your host name)"
6081 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6082 ;;
6083esac
6084
6085case "$myhostname" in
6086*.*)
6087 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6088 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6089 echo "(Trimming domain name from host name--host name is now $myhostname)"
6090 ;;
6091*) case "$mydomain" in
6092 '')
6093 {
2afac517 6094 test "X$hostcat" = "Xypcat hosts" &&
6095 ypmatch "$myhostname" hosts 2>/dev/null |\
6096 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
6097 $test -s hosts
6098 } || {
2afac517 6099 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
6100 /[ ]$myhostname[ . ]/p" > hosts
6101 }
6102 tmp_re="[ . ]"
6103 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
6104 END { print sum }" hosts` = x1 || tmp_re="[ ]"
6105 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6106 hosts | $sort | $uniq | \
6107 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6108 case `$echo X$dflt` in
6109 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
6110 dflt=.
6111 ;;
6112 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6113 ;;
6114 esac
6115 case "$dflt" in
6116 .)
6117 tans=`./loc resolv.conf X /etc /usr/etc`
6118 if $test -f "$tans"; then
6119 echo "(Attempting domain name extraction from $tans)"
a6006777 6120 dflt=.`$sed -n -e 's/ / /g' \
28757baa 6121 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 6122 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 6123 case "$dflt" in
a6006777 6124 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 6125 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 6126 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 6127 ;;
2afac517 6128 esac
6129 fi
6130 ;;
6131 esac
6132 case "$dflt" in
6133 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6134 dflt=.`sh -c domainname 2>/dev/null`
6135 case "$dflt" in
6136 '') dflt='.';;
6137 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6138 esac
6139 ;;
6140 esac
6141 case "$dflt" in
6142 .) echo "(Lost all hope -- silly guess then)"
6143 dflt='.uucp'
6144 ;;
6145 esac
6146 $rm -f hosts
6147 ;;
6148 *) dflt="$mydomain";;
6149 esac;;
6150esac
6151echo " "
6152rp="What is your domain name?"
6153. ./myread
6154tans="$ans"
6155case "$ans" in
6156'') ;;
6157.*) ;;
6158*) tans=".$tans";;
6159esac
6160mydomain="$tans"
6161
6162: translate upper to lower if necessary
6163case "$mydomain" in
6164*[A-Z]*)
6165 echo "(Normalizing case in your domain name)"
6166 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6167 ;;
6168esac
6169
6170: a little sanity check here
6171case "$phostname" in
6172'') ;;
6173*)
6174 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6175 $myhostname$mydomain|$myhostname) ;;
6176 *)
6177 case "$phostname" in
6178 sed*)
6179 echo "(That doesn't agree with your whoami.h file, by the way.)"
6180 ;;
6181 *)
6182 echo "(That doesn't agree with your $phostname command, by the way.)"
6183 ;;
6184 esac
6185 ;;
6186 esac
6187 ;;
6188esac
6189
6190$cat <<EOM
6191
6192I need to get your e-mail address in Internet format if possible, i.e.
6193something like user@host.domain. Please answer accurately since I have
6194no easy means to double check it. The default value provided below
6195is most probably close to the reality but may not be valid from outside
6196your organization...
6197
6198EOM
6199cont=x
6200while test "$cont"; do
6201 case "$cf_email" in
6202 '') dflt="$cf_by@$myhostname$mydomain";;
6203 *) dflt="$cf_email";;
6204 esac
6205 rp='What is your e-mail address?'
6206 . ./myread
6207 cf_email="$ans"
6208 case "$cf_email" in
6209 *@*.*) cont='' ;;
6210 *)
6211 rp='Address does not look like an Internet one. Use it anyway?'
6212 case "$fastread" in
6213 yes) dflt=y ;;
6214 *) dflt=n ;;
6215 esac
6216 . ./myread
6217 case "$ans" in
6218 y*) cont='' ;;
6219 *) echo " " ;;
6220 esac
6221 ;;
6222 esac
6223done
6224
6225$cat <<EOM
6226
6227If you or somebody else will be maintaining perl at your site, please
6228fill in the correct e-mail address here so that they may be contacted
6229if necessary. Currently, the "perlbug" program included with perl
6230will send mail to this address in addition to perlbug@perl.com. You may
6231enter "none" for no administrator.
6232
6233EOM
6234case "$perladmin" in
6235'') dflt="$cf_email";;
6236*) dflt="$perladmin";;
6237esac
6238rp='Perl administrator e-mail address'
6239. ./myread
6240perladmin="$ans"
6241
5f05dabc 6242: figure out how to guarantee perl startup
6243case "$startperl" in
6244'')
6245 case "$sharpbang" in
6246 *!)
6247 $cat <<EOH
6248
6249I can use the #! construct to start perl on your system. This will
6250make startup of perl scripts faster, but may cause problems if you
6251want to share those scripts and perl is not in a standard place
6252($binexp/perl) on all your platforms. The alternative is to force
6253a shell by starting the script with a single ':' character.
6254
6255EOH
6256 dflt="$binexp/perl"
6257 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6258 . ./myread
6259 case "$ans" in
68dc0745 6260 none) startperl=": # use perl";;
6261 *) startperl="#!$ans"
3e3baf6d 6262 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 6263 $cat >&4 <<EOM
6264
6265WARNING: Some systems limit the #! command to 32 characters.
6266If you experience difficulty running Perl scripts with #!, try
6267installing Perl in a directory with a shorter pathname.
6268
6269EOM
6270 fi ;;
5f05dabc 6271 esac
6272 ;;
6273 *) startperl=": # use perl"
6274 ;;
6275 esac
6276 ;;
6277esac
6278echo "I'll use $startperl to start perl scripts."
6279
6280: figure best path for perl in scripts
6281case "$perlpath" in
6282'')
6283 perlpath="$binexp/perl"
6284 case "$startperl" in
6285 *!*) ;;
6286 *)
6287 $cat <<EOH
6288
6289I will use the "eval 'exec'" idiom to start Perl on your system.
6290I can use the full path of your Perl binary for this purpose, but
6291doing so may cause problems if you want to share those scripts and
6292Perl is not always in a standard place ($binexp/perl).
6293
6294EOH
6295 dflt="$binexp/perl"
6296 rp="What path shall I use in \"eval 'exec'\"?"
6297 . ./myread
6298 perlpath="$ans"
6299 ;;
6300 esac
6301 ;;
6302esac
6303case "$startperl" in
6304*!*) ;;
6305*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6306esac
6307
dc45a647
MB
6308: determine where public executable scripts go
6309set scriptdir scriptdir
6310eval $prefixit
6311case "$scriptdir" in
6312'')
6313 dflt="$bin"
6314 : guess some guesses
6315 $test -d /usr/share/scripts && dflt=/usr/share/scripts
dd4e71fd
JH
6316 $test -d /usr/share/bin && dflt=/usr/share/bin
6317 $test -d /usr/local/script && dflt=/usr/local/script
6318 $test -d /usr/local/scripts && dflt=/usr/local/scripts
6319 $test -d $prefixexp/script && dflt=$prefixexp/script
dc45a647
MB
6320 set dflt
6321 eval $prefixup
6322 ;;
6323*) dflt="$scriptdir"
6324 ;;
6325esac
6326$cat <<EOM
6327
6328Some installations have a separate directory just for executable scripts so
6329that they can mount it across multiple architectures but keep the scripts in
6330one spot. You might, for example, have a subdirectory of /usr/share for this.
6331Or you might just lump your scripts in with all your other executables.
6332
6333EOM
6334fn=d~
6335rp='Where do you keep publicly executable scripts?'
6336. ./getfile
6337if $test "X$ansexp" != "X$scriptdirexp"; then
6338 installscript=''
6339fi
6340scriptdir="$ans"
6341scriptdirexp="$ansexp"
dd4e71fd
JH
6342: Change installation prefix, if necessary.
6343if $test X"$prefix" != X"$installprefix"; then
6344 installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
6345else
6346 installscript="$scriptdirexp"
6347fi
dc45a647 6348
dd4e71fd
JH
6349$cat <<EOM
6350
6351After $package is installed, you may wish to install various
6352add-on modules and utilities. Typically, these add-ons will
6353be installed under $prefix with the rest
6354of this package. However, you may wish to install such add-ons
6355elsewhere under a different prefix.
6356
6357If you do not wish to put everything under a single prefix, that's
6358ok. You will be prompted for the individual locations; this siteprefix
6359is only used to suggest the defaults.
6360
6361The default should be fine for most people.
dc45a647
MB
6362
6363EOM
dd4e71fd
JH
6364fn=d~+
6365rp='Installation prefix to use for add-on modules and utilities?'
6366: XXX Here might be another good place for an installstyle setting.
6367case "$siteprefix" in
6368'') dflt=$prefix ;;
6369*) dflt=$siteprefix ;;
6370esac
6371. ./getfile
6372oldsiteprefix=''
6373case "$siteprefix" in
6374'') ;;
6375*)
6376 case "$ans" in
6377 "$prefix") ;;
6378 *) oldsiteprefix="$prefix";;
dc45a647 6379 esac
dd4e71fd
JH
6380 ;;
6381esac
6382siteprefix="$ans"
6383siteprefixexp="$ansexp"
dc45a647
MB
6384
6385: determine where site specific libraries go.
dd4e71fd
JH
6386: Usual default is /usr/local/lib/perl5/site_perl
6387: The default "style" setting is made in installstyle.U
6388: XXX No longer works with Prefixit stuff.
bfb7748a 6389prog=`echo $package | $sed 's/-*[0-9.]*$//'`
dd4e71fd 6390case "$installstyle" in
a3635516 6391*lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
dd4e71fd 6392*) dflt=$siteprefix/lib/site_$prog ;;
dc45a647
MB
6393esac
6394$cat <<EOM
6395
dd4e71fd
JH
6396The installation process will create a directory for
6397site-specific extensions and modules. Most users find it convenient
68c15b6f
HM
6398to place all site-specific files in this directory rather than in the
6399main distribution directory.
dc45a647
MB
6400
6401EOM
6402fn=d~+
6403rp='Pathname for the site-specific library files?'
6404. ./getfile
dc45a647
MB
6405sitelib="$ans"
6406sitelibexp="$ansexp"
dd4e71fd
JH
6407: Change installation prefix, if necessary.
6408if $test X"$prefix" != X"$installprefix"; then
6409 installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
71c4afb4
JH
6410else
6411 installsitelib="$sitelibexp"
dc45a647
MB
6412fi
6413
6414: determine where site specific architecture-dependent libraries go.
dd4e71fd 6415: sitelib default is /usr/local/lib/perl5/site_perl/
bfb7748a 6416: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
3a6175e1 6417: sitelib may have an optional trailing /share.
bfb7748a 6418tdflt=`echo $sitelib | $sed 's,/share$,,'`
dd4e71fd 6419tdflt="$tdflt/$apiversion/$archname"
dc45a647
MB
6420set sitearch sitearch none
6421eval $prefixit
6422case "$sitearch" in
bfb7748a 6423'') dflt="$tdflt" ;;
dc45a647
MB
6424*) dflt="$sitearch" ;;
6425esac
6426$cat <<EOM
6427
6428The installation process will also create a directory for
6429architecture-dependent site-specific extensions and modules.
6430
6431EOM
6432fn=nd~+
6433rp='Pathname for the site-specific architecture-dependent library files?'
6434. ./getfile
dc45a647
MB
6435sitearch="$ans"
6436sitearchexp="$ansexp"
dd4e71fd
JH
6437: Change installation prefix, if necessary.
6438if $test X"$prefix" != X"$installprefix"; then
6439 installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
71c4afb4
JH
6440else
6441 installsitearch="$sitearchexp"
dc45a647
MB
6442fi
6443
2afac517 6444cat <<EOM
6445
85aff577
CS
6446Previous version of $package used the standard IO mechanisms as defined
6447in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 6448mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
6449the default. This abstraction layer can use AT&T's sfio (if you already
6450have sfio installed) or regular stdio. Using PerlIO with sfio may cause
6451problems with some extension modules. Using PerlIO with stdio is safe,
6452but it is slower than plain stdio and therefore is not the default.
2afac517 6453
6454If this doesn't make any sense to you, just accept the default 'n'.
6455EOM
6456case "$useperlio" in
6457$define|true|[yY]*) dflt='y';;
6458*) dflt='n';;
6459esac
6460rp='Use the experimental PerlIO abstraction layer?'
6461. ./myread
6462case "$ans" in
6463y|Y)
6464 val="$define"
6465 ;;
6466*)
6467 echo "Ok, doing things the stdio way"
6468 val="$undef"
6469 ;;
6470esac
6471set useperlio
6472eval $setvar
2304df62 6473
8e07c86e 6474: Check how to convert floats to strings.
28e8609d 6475if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
6476 echo " "
6477 echo "Checking for an efficient way to convert floats to strings."
6478 $cat >try.c <<'EOP'
8e07c86e
AD
6479#ifdef TRY_gconvert
6480#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 6481char *myname = "gconvert";
8e07c86e
AD
6482#endif
6483#ifdef TRY_gcvt
6484#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 6485char *myname = "gcvt";
8e07c86e
AD
6486#endif
6487#ifdef TRY_sprintf
6488#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 6489char *myname = "sprintf";
8e07c86e 6490#endif
8ff267be 6491
6492#include <stdio.h>
6493
6494int
6495checkit(expect, got)
6496char *expect;
6497char *got;
6498{
6499 if (strcmp(expect, got)) {
6500 printf("%s oddity: Expected %s, got %s\n",
6501 myname, expect, got);
6502 exit(1);
6503 }
6504}
6505
5a411a32 6506int main()
8ff267be 6507{
ecfc5424 6508 char buf[64];
8ff267be 6509 buf[63] = '\0';
6510
6511 /* This must be 1st test on (which?) platform */
6512 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6513 Gconvert(0.1, 8, 0, buf);
6514 checkit("0.1", buf);
6515
8e07c86e 6516 Gconvert(1.0, 8, 0, buf);
8ff267be 6517 checkit("1", buf);
6518
8e07c86e 6519 Gconvert(0.0, 8, 0, buf);
8ff267be 6520 checkit("0", buf);
6521
8e07c86e 6522 Gconvert(-1.0, 8, 0, buf);
8ff267be 6523 checkit("-1", buf);
6524
6525 /* Some Linux gcvt's give 1.e+5 here. */
6526 Gconvert(100000.0, 8, 0, buf);
6527 checkit("100000", buf);
6528
6529 /* Some Linux gcvt's give -1.e+5 here. */
6530 Gconvert(-100000.0, 8, 0, buf);
6531 checkit("-100000", buf);
6532
ecfc5424 6533 exit(0);
a0d0e21e
LW
6534}
6535EOP
5ff3f7a4
GS
6536 case "$d_Gconvert" in
6537 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6538 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6539 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6540 *) xxx_list='gconvert gcvt sprintf' ;;
6541 esac
8e07c86e 6542
5ff3f7a4
GS
6543 for xxx_convert in $xxx_list; do
6544 echo "Trying $xxx_convert"
6545 $rm -f try try$_o
6546 set try -DTRY_$xxx_convert
6547 if eval $compile; then
6548 echo "$xxx_convert" found. >&4
6549 if ./try; then
6550 echo "I'll use $xxx_convert to convert floats into a string." >&4
6551 break;
6552 else
6553 echo "...But $xxx_convert didn't work as I expected."
6554 fi
2304df62 6555 else
5ff3f7a4 6556 echo "$xxx_convert NOT found." >&4
2304df62 6557 fi
5ff3f7a4 6558 done
8e07c86e 6559
5ff3f7a4
GS
6560 case "$xxx_convert" in
6561 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6562 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6563 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6564 esac
28e8609d 6565fi
2304df62 6566
cf2093f6
JH
6567: see if inttypes.h is available
6568: we want a real compile instead of Inhdr because some systems
6569: have an inttypes.h which includes non-existent headers
6570echo " "
6571$cat >try.c <<EOCP
6572#include <inttypes.h>
6573int main() {
6574 static int32_t foo32 = 0x12345678;
6575}
6576EOCP
6577set try
6578if eval $compile; then
6579 echo "<inttypes.h> found." >&4
6580 val="$define"
6581else
6582 echo "<inttypes.h> NOT found." >&4
6583 val="$undef"
6584fi
6585$rm -f try.c try
6586set i_inttypes
6587eval $setvar
6588
6589: check for int64_t
6590case "$use64bits" in
6591"$define" )
6592 echo " "
6593 echo $n "Checking to see if your system supports int64_t...$c" >&4
6594 $cat >try.c <<EOCP
6595#include <sys/types.h>
6596#$i_inttypes I_INTTYPES
6597#ifdef I_INTTYPES
6598#include <inttypes.h>
6599#endif
6600int64_t foo() { int64_t x; x = 7; return x; }
6601EOCP
6602 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6603 val="$define"
6604 echo " Yup, it does." >&4
6605 else
6606 val="$undef"
6607 echo " Nope, it doesn't." >&4
6608 fi
6609 $rm -f try.*
6610 ;;
6611*) val="$undef"
6612 ;;
6613esac
6614set d_int64t
6615eval $setvar
6616
6617
6618: check for lengths of integral types
6619echo " "
6620case "$intsize" in
6621'')
6622 echo "Checking to see how big your integers are..." >&4
6623 $cat >intsize.c <<'EOCP'
6624#include <stdio.h>
6625int main()
6626{
6627 printf("intsize=%d;\n", sizeof(int));
6628 printf("longsize=%d;\n", sizeof(long));
6629 printf("shortsize=%d;\n", sizeof(short));
6630 exit(0);
6631}
6632EOCP
6633 set intsize
6634 if eval $compile_ok && ./intsize > /dev/null; then
6635 eval `./intsize`
6636 echo "Your integers are $intsize bytes long."
6637 echo "Your long integers are $longsize bytes long."
6638 echo "Your short integers are $shortsize bytes long."
6639 else
6640 $cat >&4 <<EOM
6641!
6642Help! I can't compile and run the intsize test program: please enlighten me!
6643(This is probably a misconfiguration in your system or libraries, and
6644you really ought to fix it. Still, I'll try anyway.)
6645!
6646EOM
6647 dflt=4
6648 rp="What is the size of an integer (in bytes)?"
6649 . ./myread
6650 intsize="$ans"
6651 dflt=$intsize
6652 rp="What is the size of a long integer (in bytes)?"
6653 . ./myread
6654 longsize="$ans"
6655 dflt=2
6656 rp="What is the size of a short integer (in bytes)?"
6657 . ./myread
6658 shortsize="$ans"
6659 fi
6660 ;;
6661esac
6662$rm -f intsize intsize.*
6663
6664: check for long long
6665echo " "
6666echo $n "Checking to see if your system supports long long...$c" >&4
6667echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6668if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6669 val="$define"
6670 echo " Yup, it does." >&4
6671else
6672 val="$undef"
6673 echo " Nope, it doesn't." >&4
6674fi
6675$rm try.*
6676set d_longlong
6677eval $setvar
6678
6679: check for length of long long
6680case "${d_longlong}${longlongsize}" in
6681$define)
6682 echo " "
6683 $echo $n "Checking to see how big your long longs are...$c" >&4
6684 $cat >try.c <<'EOCP'
6685#include <stdio.h>
6686int main()
6687{
6688 printf("%d\n", sizeof(long long));
6689}
6690EOCP
6691 set try
6692 if eval $compile_ok; then
6693 longlongsize=`./try`
6694 $echo " $longlongsize bytes." >&4
6695 else
6696 dflt='8'
6697 echo " "
6698 echo "(I can't seem to compile the test program. Guessing...)"
6699 rp="What is the size of a long long (in bytes)?"
6700 . ./myread
6701 longlongsize="$ans"
6702 fi
6703 if $test "X$longsize" = "X$longlongsize"; then
6704 echo "(That isn't any different from an ordinary long.)"
6705 fi
6706 ;;
6707esac
6708$rm -f try.c try
6709
6710echo " "
6711
ea1c3b15 6712if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
cf2093f6
JH
6713
6714echo "Checking how to print 64-bit integers..." >&4
6715
6716if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6717 quad=int
6718 $cat >try.c <<'EOCP'
6719#include <sys/types.h>
6720#include <stdio.h>
6721int main() {
6722 int q = 12345678901;
6723 printf("%ld\n", q);
6724}
6725EOCP
6726 set try
6727 if eval $compile; then
6728 yyy=`./try$exe_ext`
6729 case "$yyy" in
6730 12345678901)
6731 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6732 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6733 echo "We will use %d."
6734 ;;
6735 esac
6736 fi
6737fi
6738
6739if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6740 quad=long
6741 $cat >try.c <<'EOCP'
6742#include <sys/types.h>
6743#include <stdio.h>
6744int main() {
6745 long q = 12345678901;
6746 printf("%ld\n", q);
6747}
6748EOCP
6749 set try
6750 if eval $compile; then
6751 yyy=`./try$exe_ext`
6752 case "$yyy" in
6753 12345678901)
6754 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6755 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6756 echo "We will use %ld."
6757 ;;
6758 esac
6759 fi
6760fi
6761
6762if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6763 quad=int64_t
6764 $cat >try.c <<'EOCP'
6765#include <sys/types.h>
6766#include <inttypes.h>
6767#include <stdio.h>
6768int main() {
6769 int64_t q = 12345678901;
6770 printf("%" PRId64 "\n", q);
6771}
6772EOCP
6773 set try
6774 if eval $compile; then
6775 yyy=`./try$exe_ext`
6776 case "$yyy" in
6777 12345678901)
6778 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6779 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6780 echo "We will use the C9X style."
6781 ;;
6782 esac
6783 fi
6784fi
6785
6786if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6787 quad="long long"
6788 $cat >try.c <<'EOCP'
6789#include <sys/types.h>
6790#include <stdio.h>
6791int main() {
6e58d65c 6792 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
cf2093f6
JH
6793 printf("%lld\n", q);
6794}
6795EOCP
6796 set try
6797 if eval $compile; then
6798 yyy=`./try$exe_ext`
6799 case "$yyy" in
6800 12345678901)
6801 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6802 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6803 echo "We will use the %lld style."
6804 ;;
6805 esac
6806 fi
6807fi
6808
6809if $test X"$sPRId64" = X -a X"$quad" != X; then
6810 $cat >try.c <<EOCP
6811#include <sys/types.h>
6812#include <stdio.h>
6813int main() {
6814 $quad q = 12345678901;
6815 printf("%Ld\n", q);
6816}
6817EOCP
6818 set try
6819 if eval $compile; then
6820 yyy=`./try$exe_ext`
6821 case "$yyy" in
6822 12345678901)
6823 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6824 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6825 echo "We will use %lld."
6826 ;;
6827 esac
6828 fi
6829fi
6830
6831if $test X"$sPRId64" = X -a X"$quad" != X; then
6832 $cat >try.c <<EOCP
6833#include <sys/types.h>
6834#include <stdio.h>
6835int main() {
6836 $quad q = 12345678901;
6837 printf("%qd\n", q);
6838}
6839EOCP
6840 set try
6841 if eval $compile; then
6842 yyy=`./try$exe_ext`
6843 case "$yyy" in
6844 12345678901)
6845 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6846 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6847 echo "We will use %qd."
6848 ;;
6849 esac
6850 fi
6851fi
6852
6853if $test X"$sPRId64" = X; then
6854 echo "Cannot figure out how to print 64-bit integers." >&4
6855fi
6856
ea1c3b15
JH
6857$rm -f try try.*
6858
6859fi # intsize -o longsize -o d_int64t -o d_longlong
cf2093f6
JH
6860
6861case "$sPRId64" in
6862'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
6863 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
6864 ;;
6865*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
6866 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
6867 ;;
6868esac
6869
cf2093f6
JH
6870: check for length of double
6871echo " "
6872case "$doublesize" in
6873'')
6874 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6875 $cat >try.c <<'EOCP'
6876#include <stdio.h>
6877int main()
6878{
6879 printf("%d\n", sizeof(double));
6880}
6881EOCP
6882 set try
6883 if eval $compile_ok; then
6884 doublesize=`./try`
6885 $echo " $doublesize bytes." >&4
6886 else
6887 dflt='8'
6888 echo "(I can't seem to compile the test program. Guessing...)"
6889 rp="What is the size of a double precision number (in bytes)?"
6890 . ./myread
6891 doublesize="$ans"
6892 fi
6893 ;;
6894esac
6895$rm -f try.c try
6896
6897: check for long doubles
6898echo " "
6899echo $n "Checking to see if your system supports long doubles...$c" >&4
6900echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6901if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6902 val="$define"
6903 echo " Yup, it does." >&4
6904else
6905 val="$undef"
6906 echo " Nope, it doesn't." >&4
6907fi
6908$rm try.*
6909set d_longdbl
6910eval $setvar
6911
6912: check for length of long double
6913case "${d_longdbl}${longdblsize}" in
6914$define)
6915 echo " "
6916 $echo $n "Checking to see how big your long doubles are...$c" >&4
6917 $cat >try.c <<'EOCP'
6918#include <stdio.h>
6919int main()
6920{
6921 printf("%d\n", sizeof(long double));
6922}
6923EOCP
6924 set try
6925 if eval $compile; then
6926 longdblsize=`./try`
6927 $echo " $longdblsize bytes." >&4
6928 else
6929 dflt='8'
6930 echo " "
6931 echo "(I can't seem to compile the test program. Guessing...)" >&4
6932 rp="What is the size of a long double (in bytes)?"
6933 . ./myread
6934 longdblsize="$ans"
6935 fi
6936 if $test "X$doublesize" = "X$longdblsize"; then
6937 echo "(That isn't any different from an ordinary double.)"
6938 fi
6939 ;;
6940esac
6941$rm -f try.c try
6942
6943echo " "
6944
ea1c3b15 6945if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
6946
6947echo "Checking how to print long doubles..." >&4
6948
6949if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6950 $cat >try.c <<'EOCP'
6951#include <sys/types.h>
6952#include <stdio.h>
6953int main() {
6954 double d = 123.456;
6955 printf("%.3f\n", d);
6956}
6957EOCP
6958 set try
6959 if eval $compile; then
6960 yyy=`./try$exe_ext`
6961 case "$yyy" in
6962 123.456)
6963 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6964 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6965 echo "We will use %f."
6966 ;;
6967 esac
6968 fi
6969fi
6970
6971if $test X"$sPRIfldbl" = X; then
6972 $cat >try.c <<'EOCP'
6973#include <sys/types.h>
6974#include <stdio.h>
6975int main() {
6976 long double d = 123.456;
ea1c3b15 6977 printf("%.3llf\n", d);
cf2093f6
JH
6978}
6979EOCP
6980 set try
6981 if eval $compile; then
6982 yyy=`./try$exe_ext`
6983 case "$yyy" in
6984 123.456)
ea1c3b15
JH
6985 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6986 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
6987 echo "We will use %llf."
cf2093f6
JH
6988 ;;
6989 esac
6990 fi
6991fi
6992
6993if $test X"$sPRIfldbl" = X; then
ea1c3b15
JH
6994 echo "Cannot figure out how to print long doubles." >&4
6995fi
6996
6997if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
6998 $cat >try.c <<'EOCP'
6999#include <sys/types.h>
7000#include <stdio.h>
7001int main() {
7002 long double d = 123.456;
ea1c3b15 7003 printf("%.3Lf\n", d);
cf2093f6
JH
7004}
7005EOCP
7006 set try
7007 if eval $compile; then
7008 yyy=`./try$exe_ext`
7009 case "$yyy" in
7010 123.456)
ea1c3b15
JH
7011 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7012 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7013 echo "We will use %Lf."
cf2093f6
JH
7014 ;;
7015 esac
7016 fi
7017fi
7018
11dc3f68 7019if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7020 $cat >try.c <<'EOCP'
7021#include <sys/types.h>
7022#include <stdio.h>
7023int main() {
7024 long double d = 123.456;
ea1c3b15 7025 printf("%.3lf\n", d);
cf2093f6
JH
7026}
7027EOCP
7028 set try
7029 if eval $compile; then
7030 yyy=`./try$exe_ext`
7031 case "$yyy" in
7032 123.456)
ea1c3b15
JH
7033 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7034 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7035 echo "We will use %lf."
cf2093f6
JH
7036 ;;
7037 esac
7038 fi
7039fi
7040
ea1c3b15 7041$rm -f try try.*
cf2093f6 7042
ea1c3b15 7043fi # d_longdbl
cf2093f6
JH
7044
7045case "$sPRIfldbl" in
7046'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7047 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7048 ;;
7049*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7050 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7051 ;;
7052esac
7053
a0d0e21e
LW
7054: Initialize h_fcntl
7055h_fcntl=false
7056
7057: Initialize h_sysfile
7058h_sysfile=false
2304df62 7059
2304df62
AD
7060: access call always available on UNIX
7061set access d_access
7062eval $inlibc
7063
7064: locate the flags for 'access()'
7065case "$d_access" in
7066"$define")
7067 echo " "
7068 $cat >access.c <<'EOCP'
7069#include <sys/types.h>
7070#ifdef I_FCNTL
7071#include <fcntl.h>
7072#endif
7073#ifdef I_SYS_FILE
7074#include <sys/file.h>
7075#endif
7076#ifdef I_UNISTD
7077#include <unistd.h>
7078#endif
d674cd6d 7079int main() {
2304df62
AD
7080 exit(R_OK);
7081}
8e07c86e
AD
7082EOCP
7083 : check sys/file.h first, no particular reason here
7084 if $test `./findhdr sys/file.h` && \
dfe9444c 7085 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7086 h_sysfile=true;
7087 echo "<sys/file.h> defines the *_OK access constants." >&4
7088 elif $test `./findhdr fcntl.h` && \
dfe9444c 7089 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7090 h_fcntl=true;
7091 echo "<fcntl.h> defines the *_OK access constants." >&4
7092 elif $test `./findhdr unistd.h` && \
dfe9444c 7093 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7094 echo "<unistd.h> defines the *_OK access constants." >&4
7095 else
7096 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7097 fi
7098 ;;
7099esac
7100$rm -f access*
a0d0e21e 7101
5ff3f7a4
GS
7102: see if accessx exists
7103set accessx d_accessx
7104eval $inlibc
7105
8e07c86e
AD
7106: see if alarm exists
7107set alarm d_alarm
7108eval $inlibc
2304df62 7109
cf2093f6
JH
7110: see if atolf exists
7111set atolf d_atolf
7112eval $inlibc
7113
7114: see if atoll exists
7115set atoll d_atoll
7116eval $inlibc
7117
ecfc5424 7118: Look for GNU-cc style attribute checking
2304df62 7119echo " "
a0d0e21e
LW
7120echo "Checking whether your compiler can handle __attribute__ ..." >&4
7121$cat >attrib.c <<'EOCP'
1aef975c 7122#include <stdio.h>
ecfc5424 7123void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7124EOCP
7125if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7126 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7127 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7128 val="$undef"
7129 else
ecfc5424 7130 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7131 val="$define"
7132 fi
7133else
ecfc5424 7134 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7135 val="$undef"
7136fi
ecfc5424 7137set d_attribut
a0d0e21e
LW
7138eval $setvar
7139$rm -f attrib*
7140
7141: see if bcmp exists
7142set bcmp d_bcmp
7143eval $inlibc
7144
7145: see if bcopy exists
7146set bcopy d_bcopy
7147eval $inlibc
7148
2afac517 7149: see if this is a unistd.h system
7150set unistd.h i_unistd
7151eval $inhdr
7152
7153: see if getpgrp exists
7154set getpgrp d_getpgrp
7155eval $inlibc
7156
2afac517 7157case "$d_getpgrp" in
7158"$define")
7159 echo " "
dfe9444c 7160 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7161 $cat >set.c <<EOP
7162#$i_unistd I_UNISTD
7163#include <sys/types.h>
7164#ifdef I_UNISTD
7165# include <unistd.h>
7166#endif
5a411a32 7167int main()
2afac517 7168{
7169 if (getuid() == 0) {
7170 printf("(I see you are running Configure as super-user...)\n");
7171 setuid(1);
7172 }
7173#ifdef TRY_BSD_PGRP
7174 if (getpgrp(1) == 0)
7175 exit(0);
7176#else
7177 if (getpgrp() > 0)
7178 exit(0);
7179#endif
7180 exit(1);
7181}
7182EOP
7183 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7184 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7185 val="$define"
7186 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7187 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7188 val="$undef"
7189 else
7190 echo "I can't seem to compile and run the test program."
7191 if ./usg; then
7192 xxx="a USG one, i.e. you use getpgrp()."
7193 else
7194 # SVR4 systems can appear rather BSD-ish.
7195 case "$i_unistd" in
7196 $undef)
7197 xxx="a BSD one, i.e. you use getpgrp(pid)."
7198 val="$define"
7199 ;;
7200 $define)
7201 xxx="probably a USG one, i.e. you use getpgrp()."
7202 val="$undef"
7203 ;;
7204 esac
7205 fi
7206 echo "Assuming your getpgrp is $xxx" >&4
7207 fi
7208 ;;
7209*) val="$undef";;
7210esac
7211set d_bsdgetpgrp
7212eval $setvar
7213$rm -f set set.c
7214
a0d0e21e
LW
7215: see if setpgrp exists
7216set setpgrp d_setpgrp
7217eval $inlibc
7218
a0d0e21e
LW
7219case "$d_setpgrp" in
7220"$define")
7221 echo " "
dfe9444c 7222 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7223 $cat >set.c <<EOP
2afac517 7224#$i_unistd I_UNISTD
7225#include <sys/types.h>
7226#ifdef I_UNISTD
7227# include <unistd.h>
7228#endif
5a411a32 7229int main()
a0d0e21e
LW
7230{
7231 if (getuid() == 0) {
7232 printf("(I see you are running Configure as super-user...)\n");
7233 setuid(1);
7234 }
2afac517 7235#ifdef TRY_BSD_PGRP
a0d0e21e 7236 if (-1 == setpgrp(1, 1))
2afac517 7237 exit(0);
7238#else
7239 if (setpgrp() != -1)
7240 exit(0);
7241#endif
7242 exit(1);
a0d0e21e
LW
7243}
7244EOP
2afac517 7245 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7246 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7247 val="$define"
7248 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7249 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7250 val="$undef"
a0d0e21e 7251 else
dfe9444c 7252 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7253 if ./usg; then
2afac517 7254 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7255 else
2afac517 7256 # SVR4 systems can appear rather BSD-ish.
7257 case "$i_unistd" in
7258 $undef)
7259 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7260 val="$define"
7261 ;;
7262 $define)
7263 xxx="probably a USG one, i.e. you use setpgrp()."
7264 val="$undef"
7265 ;;
7266 esac
a0d0e21e 7267 fi
2afac517 7268 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7269 fi
7270 ;;
7271*) val="$undef";;
7272esac
2afac517 7273set d_bsdsetpgrp
a0d0e21e
LW
7274eval $setvar
7275$rm -f set set.c
a0d0e21e
LW
7276: see if bzero exists
7277set bzero d_bzero
7278eval $inlibc
7279
ecfc5424 7280: see if signal is declared as pointer to function returning int or void
a0d0e21e 7281echo " "
ecfc5424
AD
7282xxx=`./findhdr signal.h`
7283$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7284if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7285 echo "You have int (*signal())() instead of void." >&4
7286 val="$undef"
7287elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7288 echo "You have void (*signal())()." >&4
ecfc5424
AD
7289 val="$define"
7290elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7291 echo "You have int (*signal())() instead of void." >&4
7292 val="$undef"
dfe9444c
AD
7293elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7294 echo "You have void (*signal())()." >&4
7295 val="$define"
a0d0e21e 7296else
ecfc5424
AD
7297 case "$d_voidsig" in
7298 '')
7299 echo "I can't determine whether signal handler returns void or int..." >&4
7300 dflt=void
7301 rp="What type does your signal handler return?"
7302 . ./myread
7303 case "$ans" in
7304 v*) val="$define";;
7305 *) val="$undef";;
7306 esac;;
7307 "$define")
dfe9444c
AD
7308 echo "As you already told me, signal handler returns void." >&4
7309 val="$define"
7310 ;;
7311 *) echo "As you already told me, signal handler returns int." >&4
7312 val="$undef"
7313 ;;
ecfc5424
AD
7314 esac
7315fi
7316set d_voidsig
7317eval $setvar
7318case "$d_voidsig" in
7319"$define") signal_t="void";;
7320*) signal_t="int";;
7321esac
7322$rm -f $$.tmp
7323
7324: check for ability to cast large floats to 32-bit ints.
7325echo " "
7326echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7327if $test "$intsize" -ge 4; then
ecfc5424
AD
7328 xxx=int
7329else
7330 xxx=long
7331fi
7332$cat >try.c <<EOCP
e5c9fcd0 7333#include <stdio.h>
ecfc5424
AD
7334#include <sys/types.h>
7335#include <signal.h>
a1896f58 7336$signal_t blech(s) int s; { exit(3); }
d674cd6d 7337int main()
2304df62 7338{
a0d0e21e 7339 $xxx i32;
e5c9fcd0 7340 double f, g;
2304df62 7341 int result = 0;
89434db5 7342 char str[16];
2304df62
AD
7343 signal(SIGFPE, blech);
7344
89434db5
AD
7345 /* Don't let compiler optimize the test away. Store the number
7346 in a writable string for gcc to pass to sscanf under HP/UX.
7347 */
7348 sprintf(str, "2147483647");
7349 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7350 g = 10 * f;
7351 i32 = ($xxx) g;
2304df62 7352
e5c9fcd0
AD
7353 /* x86 processors will probably give 0x8000 0000, which is a
7354 sign change. We don't want that. We want to mimic SPARC
7355 behavior here, which is to preserve the sign and give
7356 back 0x7fff ffff.
7357 */
a0d0e21e 7358 if (i32 != ($xxx) f)
2304df62
AD
7359 result |= 1;
7360 exit(result);
7361}
7362EOCP
dfe9444c 7363set try
dc45a647 7364if eval $compile_ok; then
2304df62
AD
7365 ./try
7366 yyy=$?
7367else
a0d0e21e 7368 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
7369 yyy=1
7370fi
7371case "$yyy" in
73720) val="$define"
7373 echo "Yup, it can."
7374 ;;
7375*) val="$undef"
7376 echo "Nope, it can't."
7377 ;;
7378esac
7379set d_casti32
7380eval $setvar
85e6fe83 7381$rm -f try try.*
a0d0e21e 7382
2304df62
AD
7383: check for ability to cast negative floats to unsigned
7384echo " "
7385echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 7386$cat >try.c <<EOCP
e5c9fcd0 7387#include <stdio.h>
ecfc5424 7388#include <sys/types.h>
2304df62 7389#include <signal.h>
a1896f58
AD
7390$signal_t blech(s) int s; { exit(7); }
7391$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
7392unsigned long dummy_long(p) unsigned long p; { return p; }
7393unsigned int dummy_int(p) unsigned int p; { return p; }
7394unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 7395int main()
2304df62 7396{
e5c9fcd0 7397 double f;
2304df62
AD
7398 unsigned long along;
7399 unsigned int aint;
7400 unsigned short ashort;
7401 int result = 0;
89434db5
AD
7402 char str[16];
7403
e5c9fcd0
AD
7404 /* Frustrate gcc-2.7.2's optimizer which failed this test with
7405 a direct f = -123. assignment. gcc-2.8.0 reportedly
7406 optimized the whole file away
7407 */
89434db5
AD
7408 /* Store the number in a writable string for gcc to pass to
7409 sscanf under HP/UX.
7410 */
7411 sprintf(str, "-123");
7412 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
7413
7414 signal(SIGFPE, blech);
7415 along = (unsigned long)f;
7416 aint = (unsigned int)f;
7417 ashort = (unsigned short)f;
7418 if (along != (unsigned long)-123)
7419 result |= 1;
7420 if (aint != (unsigned int)-123)
7421 result |= 1;
7422 if (ashort != (unsigned short)-123)
7423 result |= 1;
89434db5
AD
7424 sprintf(str, "1073741824.");
7425 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
7426 f = f + f;
7427 along = 0;
7428 along = (unsigned long)f;
7429 if (along != 0x80000000)
7430 result |= 2;
7431 f -= 1.;
7432 along = 0;
7433 along = (unsigned long)f;
7434 if (along != 0x7fffffff)
7435 result |= 1;
7436 f += 2.;
7437 along = 0;
7438 along = (unsigned long)f;
7439 if (along != 0x80000001)
7440 result |= 2;
232e078e
AD
7441 if (result)
7442 exit(result);
7443 signal(SIGFPE, blech_in_list);
89434db5
AD
7444 sprintf(str, "123.");
7445 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
7446 along = dummy_long((unsigned long)f);
7447 aint = dummy_int((unsigned int)f);
7448 ashort = dummy_short((unsigned short)f);
7449 if (along != (unsigned long)123)
7450 result |= 4;
7451 if (aint != (unsigned int)123)
7452 result |= 4;
7453 if (ashort != (unsigned short)123)
7454 result |= 4;
2304df62
AD
7455 exit(result);
7456
7457}
7458EOCP
dfe9444c 7459set try
dc45a647 7460if eval $compile_ok; then
2304df62
AD
7461 ./try
7462 castflags=$?
7463else
ecfc5424 7464 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 7465 castflags=7
2304df62
AD
7466fi
7467case "$castflags" in
74680) val="$define"
7469 echo "Yup, it can."
7470 ;;
7471*) val="$undef"
7472 echo "Nope, it can't."
7473 ;;
7474esac
7475set d_castneg
7476eval $setvar
7477$rm -f try.*
7478
2304df62
AD
7479: see if vprintf exists
7480echo " "
7481if set vprintf val -f d_vprintf; eval $csym; $val; then
7482 echo 'vprintf() found.' >&4
7483 val="$define"
7484 $cat >vprintf.c <<'EOF'
7485#include <varargs.h>
7486
d674cd6d 7487int main() { xxx("foo"); }
2304df62
AD
7488
7489xxx(va_alist)
7490va_dcl
7491{
7492 va_list args;
7493 char buf[10];
7494
7495 va_start(args);
7496 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7497}
7498EOF
dfe9444c
AD
7499 set vprintf
7500 if eval $compile && ./vprintf; then
2304df62
AD
7501 echo "Your vsprintf() returns (int)." >&4
7502 val2="$undef"
7503 else
7504 echo "Your vsprintf() returns (char*)." >&4
7505 val2="$define"
7506 fi
7507else
7508 echo 'vprintf() NOT found.' >&4
7509 val="$undef"
7510 val2="$undef"
7511fi
7512set d_vprintf
7513eval $setvar
7514val=$val2
7515set d_charvspr
7516eval $setvar
7517
a0d0e21e
LW
7518: see if chown exists
7519set chown d_chown
7520eval $inlibc
7521
7522: see if chroot exists
7523set chroot d_chroot
7524eval $inlibc
7525
2304df62
AD
7526: see if chsize exists
7527set chsize d_chsize
7528eval $inlibc
7529
de4597cb
JH
7530hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7531while $test $# -ge 2; do
7532 case "$1" in
7533 $define) echo "#include <$2>";;
7534 esac ;
7535 shift 2;
7536done > try.c;
7537echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
2000072c 7538if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
de4597cb
JH
7539 val="$define";
7540else
7541 val="$undef";
7542fi;
7543set $varname;
7544eval $setvar;
7545$rm -f try.c try.o'
7546
7547: see if this is a sys/uio.h system
7548set sys/uio.h i_sysuio
7549eval $inhdr
7550
7551echo "Checking to see if your system supports struct iovec..." >&4
7552set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7553eval $hasfield
7554case "$d_iovec_s" in
7555"$define") echo "Yup, it does." >&4
7556 ;;
7557*) echo "Nope, it doesn't." >&4
7558 ;;
7559esac
7560
7561socketlib=''
7562sockethdr=''
7563: see whether socket exists
7564echo " "
7565$echo $n "Hmm... $c" >&4
7566if set socket val -f d_socket; eval $csym; $val; then
7567 echo "Looks like you have Berkeley networking support." >&4
7568 d_socket="$define"
7569 if set setsockopt val -f; eval $csym; $val; then
7570 d_oldsock="$undef"
7571 else
7572 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7573 d_oldsock="$define"
7574 fi
7575else
7576 if $contains socklib libc.list >/dev/null 2>&1; then
7577 echo "Looks like you have Berkeley networking support." >&4
7578 d_socket="$define"
7579 : we will have to assume that it supports the 4.2 BSD interface
7580 d_oldsock="$undef"
7581 else
7582 echo "You don't have Berkeley networking in libc$_a..." >&4
7583 if test "X$d_socket" = "X$define"; then
7584 echo "...but you seem to believe that you have sockets." >&4
7585 else
7586 for net in net socket
7587 do
7588 if test -f /usr/lib/lib$net$_a; then
7589 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
7590 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7591 if $contains socket libc.list >/dev/null 2>&1; then
7592 d_socket="$define"
7593 socketlib="-l$net"
7594 case "$net" in
7595 net)
7596 echo "...but the Wollongong group seems to have hacked it in." >&4
7597 sockethdr="-I/usr/netinclude"
7598 ;;
7599 esac
7600 echo "Found Berkeley sockets interface in lib$net." >& 4
7601 if $contains setsockopt libc.list >/dev/null 2>&1; then
7602 d_oldsock="$undef"
7603 else
7604 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7605 d_oldsock="$define"
7606 fi
7607 break
7608 fi
7609 fi
7610 done
7611 if test "X$d_socket" != "X$define"; then
7612 echo "or anywhere else I see." >&4
7613 d_socket="$undef"
7614 d_oldsock="$undef"
7615 fi
7616 fi
7617 fi
7618fi
7619
7620: see if socketpair exists
7621set socketpair d_sockpair
7622eval $inlibc
7623
7624
5b34fd99 7625echo " "
de4597cb
JH
7626echo "Checking the availability of certain socket constants..." >& 4
7627for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7628 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7629 $cat >try.c <<EOF
ac60b016 7630#include <sys/types.h>
de4597cb
JH
7631#include <sys/socket.h>
7632int main() {
7633 int i = $ENUM;
7634}
7635EOF
7636 val="$undef"
7637 set try; if eval $compile; then
7638 val="$define"
7639 fi
7640 set d_${enum}; eval $setvar
7641 $rm -f try.c try
7642done
7643
7644set sendmsg d_sendmsg
7645eval $inlibc
7646
7647set recvmsg d_recvmsg
7648eval $inlibc
7649
7650echo " "
7651$echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7652set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7653eval $hasfield
7654case "$d_msghdr_s" in
7655"$define") echo "Yup, it does." >&4
7656 ;;
7657*) echo "Nope, it doesn't." >&4
7658 ;;
7659esac
7660
7661$echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7662set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7663eval $hasfield
7664case "$d_cmsghdr_s" in
7665"$define") echo "Yup, it does." >&4
7666 ;;
7667*) echo "Nope, it doesn't." >&4
7668 ;;
7669esac
7670
2304df62
AD
7671: check for const keyword
7672echo " "
7673echo 'Checking to see if your C compiler knows about "const"...' >&4
7674$cat >const.c <<'EOCP'
7675typedef struct spug { int drokk; } spug;
5a411a32 7676int main()
2304df62
AD
7677{
7678 const char *foo;
7679 const spug y;
7680}
7681EOCP
7682if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7683 val="$define"
7684 echo "Yup, it does."
7685else
7686 val="$undef"
7687 echo "Nope, it doesn't."
7688fi
7689set d_const
7690eval $setvar
7691
7692: see if crypt exists
7693echo " "
7694if set crypt val -f d_crypt; eval $csym; $val; then
7695 echo 'crypt() found.' >&4
7696 val="$define"
7697 cryptlib=''
7698else
dfe9444c 7699 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 7700 if $test -z "$cryptlib"; then
dfe9444c 7701 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
7702 else
7703 cryptlib=-lcrypt
7704 fi
7705 if $test -z "$cryptlib"; then
dfe9444c 7706 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
7707 else
7708 cryptlib=-lcrypt
7709 fi
7710 if $test -z "$cryptlib"; then
dfe9444c 7711 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
7712 else
7713 cryptlib=-lcrypt
7714 fi
7715 if $test -z "$cryptlib"; then
7716 echo 'crypt() NOT found.' >&4
7717 val="$undef"
7718 else
7719 val="$define"
7720 fi
7721fi
7722set d_crypt
7723eval $setvar
7724
921b2963
JH
7725: get csh whereabouts
7726case "$csh" in
7727'csh') val="$undef" ;;
7728*) val="$define" ;;
7729esac
7730set d_csh
7731eval $setvar
7732: Respect a hint or command line value for full_csh.
7733case "$full_csh" in
7734'') full_csh=$csh ;;
7735esac
7736
a0d0e21e
LW
7737: see if cuserid exists
7738set cuserid d_cuserid
2304df62
AD
7739eval $inlibc
7740
a0d0e21e
LW
7741: see if this is a limits.h system
7742set limits.h i_limits
85e6fe83
LW
7743eval $inhdr
7744
a0d0e21e
LW
7745: see if this is a float.h system
7746set float.h i_float
7747eval $inhdr
7748
7749: See if number of significant digits in a double precision number is known
7750echo " "
7751$cat >dbl_dig.c <<EOM
7752#$i_limits I_LIMITS
7753#$i_float I_FLOAT
7754#ifdef I_LIMITS
7755#include <limits.h>
85e6fe83 7756#endif
a0d0e21e
LW
7757#ifdef I_FLOAT
7758#include <float.h>
7759#endif
7760#ifdef DBL_DIG
7761printf("Contains DBL_DIG");
85e6fe83 7762#endif
85e6fe83 7763EOM
a0d0e21e
LW
7764$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7765if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7766 echo "DBL_DIG found." >&4
7767 val="$define"
2304df62 7768else
a0d0e21e
LW
7769 echo "DBL_DIG NOT found." >&4
7770 val="$undef"
2304df62 7771fi
a0d0e21e
LW
7772$rm -f dbl_dig.?
7773set d_dbl_dig
2304df62 7774eval $setvar
2304df62 7775
5ff3f7a4
GS
7776
7777if $test X"$use64bits" = X"$define"; then
7778 : see if dbminit64 exists
7779 set dbminit64 d_dbminit64
7780 eval $inlibc
7781
7782 : see if dbmclose64 exists
7783 set dbmclose64 d_dbmclose64
7784 eval $inlibc
7785
7786 : see if fetch64 exists
7787 set fetch64 d_fetch64
7788 eval $inlibc
7789
7790 : see if store64 exists
7791 set store64 d_store64
7792 eval $inlibc
7793
7794 : see if delete64 exists
7795 set delete64 d_delete64
7796 eval $inlibc
7797
7798 : see if firstkey64 exists
7799 set firstkey64 d_firstkey64
7800 eval $inlibc
7801
7802 : see if nextkey64 exists
7803 set nextkey64 d_nextkey64
7804 eval $inlibc
7805else
7806 val="$undef"
7807 for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7808 do
7809 set $xxx
7810 eval $setvar
7811 done
7812fi
7813
a0d0e21e
LW
7814: see if difftime exists
7815set difftime d_difftime
2304df62
AD
7816eval $inlibc
7817
5ff3f7a4
GS
7818: see if sys/stat.h is available
7819set sys/stat.h i_sysstat
7820eval $inhdr
7821
a0d0e21e
LW
7822: see if this is a dirent system
7823echo " "
7824if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7825 val="$define"
7826 echo "<dirent.h> found." >&4
7827else
7828 val="$undef"
7829 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7830 echo "<sys/dir.h> found." >&4
7831 echo " "
7832 else
7833 xinc=`./findhdr sys/ndir.h`
7834 fi
7835 echo "<dirent.h> NOT found." >&4
7836fi
7837set i_dirent
7838eval $setvar
7839
7840: Look for type of directory structure.
7841echo " "
7842$cppstdin $cppflags $cppminus < "$xinc" > try.c
7843
7844case "$direntrytype" in
7845''|' ')
7846 case "$i_dirent" in
7847 $define) guess1='struct dirent' ;;
7848 *) guess1='struct direct' ;;
2afac517 7849 esac
7850 ;;
7851*) guess1="$direntrytype"
7852 ;;
8e07c86e
AD
7853esac
7854
2afac517 7855case "$guess1" in
7856'struct dirent') guess2='struct direct' ;;
7857*) guess2='struct dirent' ;;
7858esac
7859
7860if $contains "$guess1" try.c >/dev/null 2>&1; then
7861 direntrytype="$guess1"
7862 echo "Your directory entries are $direntrytype." >&4
7863elif $contains "$guess2" try.c >/dev/null 2>&1; then
7864 direntrytype="$guess2"
7865 echo "Your directory entries seem to be $direntrytype." >&4
7866else
7867 echo "I don't recognize your system's directory entries." >&4
7868 rp="What type is used for directory entries on this system?"
7869 dflt="$guess1"
7870 . ./myread
7871 direntrytype="$ans"
7872fi
7873$rm -f try.c
a0d0e21e 7874
a0d0e21e 7875
2afac517 7876: see if the directory entry stores field length
7877echo " "
7878$cppstdin $cppflags $cppminus < "$xinc" > try.c
7879if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7880 echo "Good, your directory entry keeps length information in d_namlen." >&4
7881 val="$define"
7882else
7883 echo "Your directory entry does not know about the d_namlen field." >&4
7884 val="$undef"
7885fi
7886set d_dirnamlen
7887eval $setvar
7888$rm -f try.c
a0d0e21e 7889
a0d0e21e 7890
5ff3f7a4
GS
7891if $test X"$use64bits" = X"$define"; then
7892 : see if fstat64 exists
7893 set fstat64 d_fstat64
7894 eval $inlibc
a0d0e21e 7895
5ff3f7a4
GS
7896 : see if ftruncate64 exists
7897 set ftruncate64 d_ftruncate64
7898 eval $inlibc
a0d0e21e 7899
5ff3f7a4
GS
7900 : see if lockf64 exists
7901 set lockf64 d_lockf64
7902 eval $inlibc
a0d0e21e 7903
2000072c
JH
7904 : see if llseek exists
7905 set llseek d_llseek
7906 eval $inlibc
7907
5ff3f7a4
GS
7908 : see if lseek64 exists
7909 set lseek64 d_lseek64
7910 eval $inlibc
7911
7912 : see if lstat64 exists
7913 set lstat64 d_lstat64
7914 eval $inlibc
7915
7916 : see if open64 exists
7917 set open64 d_open64
7918 eval $inlibc
7919
7920 : see if opendir64 exists
7921 set opendir64 d_opendir64
7922 eval $inlibc
7923
7924 : see if readdir64 exists
7925 set readdir64 d_readdir64
7926 eval $inlibc
7927
7928 : see if seekdir64 exists
7929 set seekdir64 d_seekdir64
7930 eval $inlibc
7931
7932 : see if stat64 exists
7933 set stat64 d_stat64
7934 eval $inlibc
7935
7936 : see if telldir64 exists
7937 set telldir64 d_telldir64
7938 eval $inlibc
7939
7940 : see if truncate64 exists
7941 set truncate64 d_truncate64
7942 eval $inlibc
7943
7944 : check for off64_t
7945 echo " "
7946 echo $n "Checking to see if your system supports off64_t...$c" >&4
7947 $cat >try.c <<EOCP
7948#include <sys/types.h>
ca11f38f 7949#include <unistd.h>
5ff3f7a4
GS
7950off64_t foo() { off64_t x; x = 7; return x; }'
7951EOCP
7952 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7953 val="$define"
7954 echo " Yup, it does." >&4
7955 else
7956 val="$undef"
7957 echo " Nope, it doesn't." >&4
7958 fi
7959 $rm -f try.*
2000072c
JH
7960 set d_off64_t
7961 eval $setvar
7962
7963 : check for offset_t
7964 echo " "
7965 echo $n "Checking to see if your system supports offset_t...$c" >&4
7966 $cat >try.c <<EOCP
7967#include <sys/types.h>
ca11f38f 7968#include <unistd.h>
2000072c
JH
7969offset_t foo() { offset_t x; x = 7; return x; }'
7970EOCP
7971 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7972 val="$define"
7973 echo " Yup, it does." >&4
7974 else
7975 val="$undef"
7976 echo " Nope, it doesn't." >&4
7977 fi
7978 $rm -f try.*
7979 set d_offset_t
5ff3f7a4
GS
7980 eval $setvar
7981
7982 : check for ino64_t
7983 echo " "
7984 echo $n "Checking to see if your system supports ino64_t...$c" >&4
7985 val="$undef"
7986 case "$i_sysstat" in
7987 "$define" )
7988 $cat >try.c <<EOCP
7989#include <sys/types.h>
7990#include <sys/stat.h>
7991ino64_t foo() { ino64_t x; x = 7; return x; }'
7992EOCP
7993 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7994 val="$define"
7995 fi
7996 $rm -f try.*
7997 ;;
7998 esac
7999 if $test "X$val" = X"$define"; then
8000 echo " Yup, it does." >&4
8001 else
8002 echo " Nope, it doesn't." >&4
8003 fi
2000072c 8004 set d_ino64_t
5ff3f7a4
GS
8005 eval $setvar
8006
8007 : check for struct flock64
8008 echo " "
85ab1d1d 8009 echo "Checking to see if your system supports struct flock64..." >&4
5ff3f7a4 8010 if $h_fcntl; then
de4597cb 8011 set d_flock64_s flock64 l_len define fcntl.h
5ff3f7a4 8012 eval $hasfield
85ab1d1d
JH
8013 else
8014 val="$undef"
de4597cb 8015 set d_flock64_s
85ab1d1d 8016 eval $setvar
5ff3f7a4 8017 fi
de4597cb 8018 case "$d_flock64_s" in
85ab1d1d
JH
8019 "$define") echo "Yup, it does." >&4
8020 ;;
8021 *) echo "Nope, it doesn't." >&4
8022 ;;
8023 esac
5ff3f7a4
GS
8024
8025 : check for struct dirent64
8026 echo " "
85ab1d1d 8027 echo "Checking to see if your system supports struct dirent64..." >&4
de4597cb 8028 set d_dirent64_s dirent64 d_off $i_dirent dirent.h
5ff3f7a4 8029 eval $hasfield
de4597cb 8030 case "$d_dirent64_s" in
85ab1d1d
JH
8031 "$define") echo "Yup, it does." >&4
8032 ;;
8033 *) echo "Nope, it doesn't." >&4
8034 ;;
8035 esac
8036
5ff3f7a4
GS
8037else
8038 val="$undef"
2000072c 8039 for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
5ff3f7a4
GS
8040 do
8041 set $xxx
8042 eval $setvar
8043 done
8044fi
8045
8046: see if dlerror exists
8047xxx_runnm="$runnm"
8048runnm=false
8049set dlerror d_dlerror
8050eval $inlibc
8051runnm="$xxx_runnm"
8052
8053: see if dlfcn is available
8054set dlfcn.h i_dlfcn
8055eval $inhdr
8056
8057case "$usedl" in
8058$define|y|true)
8059 $cat << EOM
8060
8061On a few systems, the dynamically loaded modules that perl generates and uses
8062will need a different extension than shared libs. The default will probably
8063be appropriate.
8064
8065EOM
8066 case "$dlext" in
8067 '') dflt="$so" ;;
8068 *) dflt="$dlext" ;;
8069 esac
8070 rp='What is the extension of dynamically loaded modules'
8071 . ./myread
8072 dlext="$ans"
8073 ;;
8074*)
8075 dlext="none"
8076 ;;
8077esac
8078
8079: Check if dlsym need a leading underscore
a0d0e21e
LW
8080echo " "
8081val="$undef"
8082
8083case "$dlsrc" in
8084dl_dlopen.xs)
8085 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8086 $cat >dyna.c <<'EOM'
8087fred () { }
8088EOM
8089
8090$cat >fred.c<<EOM
8091
8092#include <stdio.h>
8093#$i_dlfcn I_DLFCN
8094#ifdef I_DLFCN
8095#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8096#else
8097#include <sys/types.h>
8098#include <nlist.h>
8099#include <link.h>
8100#endif
8101
8102extern int fred() ;
8103
5a411a32 8104int main()
a0d0e21e
LW
8105{
8106 void * handle ;
8107 void * symbol ;
8108#ifndef RTLD_LAZY
8109 int mode = 1 ;
8110#else
8111 int mode = RTLD_LAZY ;
8112#endif
8113 handle = dlopen("./dyna.$dlext", mode) ;
8114 if (handle == NULL) {
5f05dabc 8115 printf ("1\n") ;
8116 fflush (stdout) ;
8117 exit(0);
a0d0e21e
LW
8118 }
8119 symbol = dlsym(handle, "fred") ;
8120 if (symbol == NULL) {
5f05dabc 8121 /* try putting a leading underscore */
8122 symbol = dlsym(handle, "_fred") ;
8123 if (symbol == NULL) {
8124 printf ("2\n") ;
8125 fflush (stdout) ;
8126 exit(0);
8127 }
8128 printf ("3\n") ;
a0d0e21e
LW
8129 }
8130 else
5f05dabc 8131 printf ("4\n") ;
36477c24 8132 fflush (stdout) ;
8133 exit(0);
a0d0e21e
LW
8134}
8135EOM
760ac839 8136 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 8137 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
8138 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
8139 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 8140 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
8141 xxx=`./fred`
8142 case $xxx in
8143 1) echo "Test program failed using dlopen." >&4
8144 echo "Perhaps you should not use dynamic loading." >&4;;
8145 2) echo "Test program failed using dlsym." >&4
8146 echo "Perhaps you should not use dynamic loading." >&4;;
8147 3) echo "dlsym needs a leading underscore" >&4
8148 val="$define" ;;
8149 4) echo "dlsym doesn't need a leading underscore." >&4;;
8150 esac
8151 else
8152 echo "I can't compile and run the test program." >&4
8153 fi
8154 ;;
8155esac
8156
a78b0d02 8157$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
8158
8159set d_dlsymun
8160eval $setvar
8161
85ab1d1d
JH
8162hasproto='varname=$1; func=$2; shift; shift;
8163while $test $# -ge 2; do
8164 case "$1" in
8165 $define) echo "#include <$2>";;
8166 esac ;
8167 shift 2;
8168done > try.c;
8169$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8170if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8171 echo "$func() prototype found.";
8172 val="$define";
8173else
8174 echo "$func() prototype NOT found.";
8175 val="$undef";
8176fi;
8177set $varname;
8178eval $setvar;
8179$rm -f try.c tryout.c'
8180
8181: see if prototype for drand48 is available
8182echo " "
8183set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8184eval $hasproto
8185
a0d0e21e
LW
8186: see if dup2 exists
8187set dup2 d_dup2
8188eval $inlibc
8189
5ff3f7a4
GS
8190: see if eaccess exists
8191set eaccess d_eaccess
8192eval $inlibc
8193
8194: see if endgrent exists
8195set endgrent d_endgrent
8196eval $inlibc
8197
e5c9fcd0
AD
8198: see if endhostent exists
8199set endhostent d_endhent
8200eval $inlibc
8201
8202: see if endnetent exists
8203set endnetent d_endnent
8204eval $inlibc
8205
8206: see if endprotoent exists
8207set endprotoent d_endpent
8208eval $inlibc
8209
5ff3f7a4
GS
8210: see if endpwent exists
8211set endpwent d_endpwent
8212eval $inlibc
8213
e5c9fcd0
AD
8214: see if endservent exists
8215set endservent d_endsent
8216eval $inlibc
8217
f1066039
JH
8218: see if endspent exists
8219set endspent d_endspent
8220eval $inlibc
8221
8e07c86e
AD
8222: Locate the flags for 'open()'
8223echo " "
8224$cat >open3.c <<'EOCP'
8225#include <sys/types.h>
8226#ifdef I_FCNTL
8227#include <fcntl.h>
8228#endif
8229#ifdef I_SYS_FILE
8230#include <sys/file.h>
8231#endif
d674cd6d 8232int main() {
8e07c86e
AD
8233 if(O_RDONLY);
8234#ifdef O_TRUNC
8235 exit(0);
8236#else
8237 exit(1);
8238#endif
8239}
8240EOCP
8241: check sys/file.h first to get FREAD on Sun
8242if $test `./findhdr sys/file.h` && \
dfe9444c 8243 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8244 h_sysfile=true;
8245 echo "<sys/file.h> defines the O_* constants..." >&4
8246 if ./open3; then
8247 echo "and you have the 3 argument form of open()." >&4
8248 val="$define"
8249 else
8250 echo "but not the 3 argument form of open(). Oh, well." >&4
8251 val="$undef"
8252 fi
8253elif $test `./findhdr fcntl.h` && \
dfe9444c 8254 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8255 h_fcntl=true;
8256 echo "<fcntl.h> defines the O_* constants..." >&4
8257 if ./open3; then
8258 echo "and you have the 3 argument form of open()." >&4
8259 val="$define"
8260 else
8261 echo "but not the 3 argument form of open(). Oh, well." >&4
8262 val="$undef"
8263 fi
8264else
8265 val="$undef"
8266 echo "I can't find the O_* constant definitions! You got problems." >&4
8267fi
8268set d_open3
8269eval $setvar
8270$rm -f open3*
8271
8272: check for non-blocking I/O stuff
8273case "$h_sysfile" in
8274true) echo "#include <sys/file.h>" > head.c;;
8275*)
8276 case "$h_fcntl" in
8277 true) echo "#include <fcntl.h>" > head.c;;
8278 *) echo "#include <sys/fcntl.h>" > head.c;;
8279 esac
8280 ;;
8281esac
8282echo " "
8283echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8284case "$o_nonblock" in
8285'')
8286 $cat head.c > try.c
8287 $cat >>try.c <<'EOCP'
d674cd6d 8288int main() {
8e07c86e
AD
8289#ifdef O_NONBLOCK
8290 printf("O_NONBLOCK\n");
8291 exit(0);
8292#endif
8293#ifdef O_NDELAY
8294 printf("O_NDELAY\n");
8295 exit(0);
8296#endif
8297#ifdef FNDELAY
8298 printf("FNDELAY\n");
8299 exit(0);
8300#endif
8301 exit(0);
8302}
8303EOCP
dfe9444c 8304 set try
dc45a647 8305 if eval $compile_ok; then
8e07c86e
AD
8306 o_nonblock=`./try`
8307 case "$o_nonblock" in
8308 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8309 *) echo "Seems like we can use $o_nonblock.";;
8310 esac
8311 else
8312 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8313 fi
8314 ;;
8315*) echo "Using $hint value $o_nonblock.";;
8316esac
8317$rm -f try try.* .out core
8318
8319echo " "
8320echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8321case "$eagain" in
8322'')
8323 $cat head.c > try.c
8324 $cat >>try.c <<EOCP
8325#include <errno.h>
8326#include <sys/types.h>
8327#include <signal.h>
4633a7c4 8328#define MY_O_NONBLOCK $o_nonblock
dc45a647 8329#ifndef errno /* XXX need better Configure test */
8e07c86e 8330extern int errno;
dc45a647 8331#endif
8e07c86e 8332$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8333EOCP
8334 $cat >> try.c <<'EOCP'
d674cd6d 8335int main()
8e07c86e
AD
8336{
8337 int pd[2];
8338 int pu[2];
8339 char buf[1];
8340 char string[100];
8341
8342 pipe(pd); /* Down: child -> parent */
8343 pipe(pu); /* Up: parent -> child */
8344 if (0 != fork()) {
8345 int ret;
8346 close(pd[1]); /* Parent reads from pd[0] */
8347 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8348 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8349 exit(1);
8350 signal(SIGALRM, blech);
8351 alarm(5);
8352 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8353 exit(2);
8354 sprintf(string, "%d\n", ret);
8355 write(2, string, strlen(string));
8356 alarm(0);
8357#ifdef EAGAIN
8358 if (errno == EAGAIN) {
8359 printf("EAGAIN\n");
8360 goto ok;
8361 }
8362#endif
8363#ifdef EWOULDBLOCK
8364 if (errno == EWOULDBLOCK)
8365 printf("EWOULDBLOCK\n");
8366#endif
8367 ok:
8368 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8369 sleep(2); /* Give it time to close our pipe */
8370 alarm(5);
8371 ret = read(pd[0], buf, 1); /* Should read EOF */
8372 alarm(0);
8373 sprintf(string, "%d\n", ret);
8374 write(3, string, strlen(string));
8375 exit(0);
8376 }
8377
8378 close(pd[0]); /* We write to pd[1] */
8379 close(pu[1]); /* We read from pu[0] */
8380 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8381 close(pd[1]); /* Pipe pd is now fully closed! */
8382 exit(0); /* Bye bye, thank you for playing! */
8383}
8384EOCP
dfe9444c 8385 set try
dc45a647 8386 if eval $compile_ok; then
774d564b 8387 echo "$startsh" >mtry
40a7a20a 8388 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8389 chmod +x mtry
8390 ./mtry >/dev/null 2>&1
8391 case $? in
8392 0) eagain=`$cat try.out`;;
8393 1) echo "Could not perform non-blocking setting!";;
8394 2) echo "I did a successful read() for something that was not there!";;
8395 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8396 *) echo "Something terribly wrong happened during testing.";;
8397 esac
8398 rd_nodata=`$cat try.ret`
8399 echo "A read() system call with no data present returns $rd_nodata."
8400 case "$rd_nodata" in
8401 0|-1) ;;
8402 *)
8403 echo "(That's peculiar, fixing that to be -1.)"
8404 rd_nodata=-1
8405 ;;
8406 esac
8407 case "$eagain" in
8408 '')
8409 echo "Forcing errno EAGAIN on read() with no data available."
8410 eagain=EAGAIN
8411 ;;
8412 *)
8413 echo "Your read() sets errno to $eagain when no data is available."
8414 ;;
8415 esac
8416 status=`$cat try.err`
8417 case "$status" in
8418 0) echo "And it correctly returns 0 to signal EOF.";;
8419 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8420 *) echo "However, your read() returns '$status' on EOF??";;
8421 esac
8422 val="$define"
28757baa 8423 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8424 echo "WARNING: you can't distinguish between EOF and no data!"
8425 val="$undef"
8426 fi
8427 else
8428 echo "I can't compile the test program--assuming errno EAGAIN will do."
8429 eagain=EAGAIN
8430 fi
8431 set d_eofnblk
8432 eval $setvar
8433 ;;
8434*)
8435 echo "Using $hint value $eagain."
8436 echo "Your read() returns $rd_nodata when no data is present."
8437 case "$d_eofnblk" in
8438 "$define") echo "And you can see EOF because read() returns 0.";;
8439 "$undef") echo "But you can't see EOF status from read() returned value.";;
8440 *)
8441 echo "(Assuming you can't see EOF status from read anyway.)"
8442 d_eofnblk=$undef
8443 ;;
8444 esac
8445 ;;
8446esac
8447$rm -f try try.* .out core head.c mtry
8448
a0d0e21e
LW
8449: see if fchmod exists
8450set fchmod d_fchmod
8451eval $inlibc
8452
8453: see if fchown exists
8454set fchown d_fchown
8455eval $inlibc
8456
8457: see if this is an fcntl system
8458set fcntl d_fcntl
8459eval $inlibc
8460
921b2963
JH
8461: see if sys/select.h has to be included
8462set sys/select.h i_sysselct
8463eval $inhdr
8464
8465: see if we should include time.h, sys/time.h, or both
8466echo " "
8467if test "X$timeincl" = X; then
8468 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8469 $echo $n "I'm now running the test program...$c"
8470 $cat >try.c <<'EOCP'
8471#include <sys/types.h>
8472#ifdef I_TIME
8473#include <time.h>
8474#endif
8475#ifdef I_SYSTIME
8476#ifdef SYSTIMEKERNEL
8477#define KERNEL
8478#endif
8479#include <sys/time.h>
8480#endif
8481#ifdef I_SYSSELECT
8482#include <sys/select.h>
8483#endif
d674cd6d 8484int main()
921b2963
JH
8485{
8486 struct tm foo;
8487#ifdef S_TIMEVAL
8488 struct timeval bar;
8489#endif
8490#ifdef S_TIMEZONE
8491 struct timezone tzp;
8492#endif
8493 if (foo.tm_sec == foo.tm_sec)
8494 exit(0);
8495#ifdef S_TIMEVAL
8496 if (bar.tv_sec == bar.tv_sec)
8497 exit(0);
8498#endif
8499 exit(1);
8500}
8501EOCP
8502 flags=''
8503 for s_timezone in '-DS_TIMEZONE' ''; do
8504 sysselect=''
8505 for s_timeval in '-DS_TIMEVAL' ''; do
8506 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8507 for i_time in '' '-DI_TIME'; do
8508 for i_systime in '-DI_SYSTIME' ''; do
8509 case "$flags" in
8510 '') $echo $n ".$c"
8511 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8512 if eval $compile; then
8513 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8514 shift
8515 flags="$*"
8516 echo " "
8517 $echo $n "Succeeded with $flags$c"
8518 fi
8519 ;;
8520 esac
8521 done
8522 done
8523 done
8524 done
8525 done
8526 timeincl=''
8527 echo " "
8528 case "$flags" in
8529 *SYSTIMEKERNEL*) i_systimek="$define"
8530 timeincl=`./findhdr sys/time.h`
8531 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8532 *) i_systimek="$undef";;
8533 esac
8534 case "$flags" in
8535 *I_TIME*) i_time="$define"
8536 timeincl=`./findhdr time.h`" $timeincl"
8537 echo "We'll include <time.h>." >&4;;
8538 *) i_time="$undef";;
8539 esac
8540 case "$flags" in
8541 *I_SYSTIME*) i_systime="$define"
8542 timeincl=`./findhdr sys/time.h`" $timeincl"
8543 echo "We'll include <sys/time.h>." >&4;;
8544 *) i_systime="$undef";;
8545 esac
8546 $rm -f try.c try
8547fi
8548
8549: check for fd_set items
8550$cat <<EOM
8551
8552Checking to see how well your C compiler handles fd_set and friends ...
8553EOM
8554$cat >fd_set.c <<EOCP
8555#$i_systime I_SYS_TIME
8556#$i_sysselct I_SYS_SELECT
8557#$d_socket HAS_SOCKET
8558#include <sys/types.h>
8559#ifdef HAS_SOCKET
8560#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8561#endif
8562#ifdef I_SYS_TIME
8563#include <sys/time.h>
8564#endif
8565#ifdef I_SYS_SELECT
8566#include <sys/select.h>
8567#endif
d674cd6d 8568int main() {
921b2963
JH
8569 fd_set fds;
8570
8571#ifdef TRYBITS
8572 if(fds.fds_bits);
8573#endif
8574
8575#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8576 exit(0);
8577#else
8578 exit(1);
8579#endif
8580}
8581EOCP
8582set fd_set -DTRYBITS
8583if eval $compile; then
8584 d_fds_bits="$define"
8585 d_fd_set="$define"
8586 echo "Well, your system knows about the normal fd_set typedef..." >&4
8587 if ./fd_set; then
8588 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8589 d_fd_macros="$define"
8590 else
8591 $cat >&4 <<'EOM'
8592but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8593EOM
8594 d_fd_macros="$undef"
8595 fi
8596else
8597 $cat <<'EOM'
8598Hmm, your compiler has some difficulty with fd_set. Checking further...
8599EOM
8600 set fd_set
8601 if eval $compile; then
8602 d_fds_bits="$undef"
8603 d_fd_set="$define"
8604 echo "Well, your system has some sort of fd_set available..." >&4
8605 if ./fd_set; then
8606 echo "and you have the normal fd_set macros." >&4
8607 d_fd_macros="$define"
8608 else
8609 $cat <<'EOM'
8610but not the normal fd_set macros! Gross! More work for me...
8611EOM
8612 d_fd_macros="$undef"
8613 fi
8614 else
8615 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
8616 d_fd_set="$undef"
8617 d_fds_bits="$undef"
8618 d_fd_macros="$undef"
8619 fi
8620fi
8621$rm -f fd_set*
8622
a0d0e21e
LW
8623: see if fgetpos exists
8624set fgetpos d_fgetpos
8625eval $inlibc
8626
5ff3f7a4
GS
8627
8628if $test X"$use64bits" = X"$define"; then
8629 : see if fgetpos64 exists
8630 set fgetpos64 d_fgetpos64
8631 eval $inlibc
8632
8633 : see if fopen64 exists
8634 set freopen64 d_fopen64
8635 eval $inlibc
8636
8637 : see if freopen64 exists
8638 set freopen64 d_freopen64
8639 eval $inlibc
8640
8641 : see if fseek64 exists
8642 set fseek64 d_fseek64
8643 eval $inlibc
8644
8645 : see if fseeko64 exists
8646 set fseeko64 d_fseeko64
8647 eval $inlibc
8648
8649 : see if fsetpos64 exists
8650 set fsetpos64 d_fsetpos64
8651 eval $inlibc
8652
8653 : see if ftell64 exists
8654 set ftell64 d_ftell64
8655 eval $inlibc
8656
8657 : see if ftello64 exists
8658 set ftello64 d_ftello64
8659 eval $inlibc
8660
8661 : see if tmpfile64 exists
8662 set tmpfile64 d_tmpfile64
8663 eval $inlibc
8664else
8665 val="$undef"
8666 for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8667 do
8668 set $xxx
8669 eval $setvar
8670 done
8671fi
9cc6feab 8672
a0d0e21e
LW
8673: see if flock exists
8674set flock d_flock
8675eval $inlibc
8676
a0d0e21e
LW
8677: see if fork exists
8678set fork d_fork
8679eval $inlibc
8680
8681: see if pathconf exists
8682set pathconf d_pathconf
8683eval $inlibc
8684
8685: see if fpathconf exists
8686set fpathconf d_fpathconf
8687eval $inlibc
8688
5ff3f7a4
GS
8689: see if fseeko exists
8690set fseeko d_fseeko
8691eval $inlibc
8692
a0d0e21e
LW
8693: see if fsetpos exists
8694set fsetpos d_fsetpos
8695eval $inlibc
8696
9b9c89a3
JH
8697: see if this is a sys/param system
8698set sys/param.h i_sysparam
8699eval $inhdr
8700
104d25b7
JH
8701: see if this is a sys/mount.h system
8702set sys/mount.h i_sysmount
8703eval $inhdr
8704
8705
8706: see if statfs exists
8707set statfs d_statfs
8708eval $inlibc
8709
8710: see if fstatfs exists
8711set fstatfs d_fstatfs
8712eval $inlibc
8713
8714: see if statfs knows about mount flags
9b9c89a3 8715set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
104d25b7
JH
8716eval $hasfield
8717
8718
8719: see if statvfs exists
8720set statvfs d_statvfs
8721eval $inlibc
8722
8723: see if fstatvfs exists
8724set fstatvfs d_fstatvfs
8725eval $inlibc
8726
8727
5ff3f7a4
GS
8728: see if ftello exists
8729set ftello d_ftello
8730eval $inlibc
8731
8732: see if getgrent exists
8733set getgrent d_getgrent
8734eval $inlibc
8735
693762b4
AD
8736: see if gethostbyaddr exists
8737set gethostbyaddr d_gethbyaddr
8738eval $inlibc
8739
8740: see if gethostbyname exists
8741set gethostbyname d_gethbyname
8742eval $inlibc
8743
a0d0e21e
LW
8744: see if gethostent exists
8745set gethostent d_gethent
8746eval $inlibc
8747
921b2963
JH
8748: see how we will look up host name
8749echo " "
a63faeb8
JH
8750call=''
8751if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
8752 echo 'gethostname() found.' >&4
8753 d_gethname="$define"
8754 call=gethostname
a63faeb8
JH
8755fi
8756if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
8757 if ./xenix; then
8758 $cat <<'EOM'
8759uname() was found, but you're running xenix, and older versions of xenix
8760have a broken uname(). If you don't really know whether your xenix is old
8761enough to have a broken system call, use the default answer.
8762
8763EOM
8764 dflt=y
8765 case "$d_uname" in
8766 "$define") dflt=n;;
8767 esac
8768 rp='Is your uname() broken?'
8769 . ./myread
8770 case "$ans" in
8771 n*) d_uname="$define"; call=uname;;
8772 esac
8773 else
8774 echo 'uname() found.' >&4
8775 d_uname="$define"
a63faeb8
JH
8776 case "$call" in
8777 '') call=uname ;;
8778 esac
921b2963
JH
8779 fi
8780fi
8781case "$d_gethname" in
8782'') d_gethname="$undef";;
8783esac
8784case "$d_uname" in
8785'') d_uname="$undef";;
8786esac
8787case "$d_uname$d_gethname" in
8788*define*)
8789 dflt=n
8790 cat <<EOM
8791
8792Every now and then someone has a $call() that lies about the hostname
8793but can't be fixed for political or economic reasons. If you wish, I can
8794pretend $call() isn't there and maybe compute hostname at run-time
8795thanks to the '$phostname' command.
8796
8797EOM
8798 rp="Shall I ignore $call() from now on?"
8799 . ./myread
8800 case "$ans" in
8801 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8802 esac;;
8803esac
8804case "$phostname" in
8805'') aphostname='';;
8806*) case "$aphostname" in
8807 /*) ;;
8808 *) set X $phostname
8809 shift
8810 file=$1
8811 shift
8812 file=`./loc $file $file $pth`
8813 aphostname=`echo $file $*`
8814 ;;
8815 esac
8816 ;;
8817esac
8818case "$d_uname$d_gethname" in
8819*define*) ;;
8820*)
8821 case "$phostname" in
8822 '')
8823 echo "There will be no way for $package to get your hostname." >&4;;
8824 *)
8825 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8826 ;;
8827 esac;;
8828esac
8829case "$d_phostname" in
8830'') d_phostname="$undef";;
8831esac
8832
dc45a647
MB
8833: see if this is a netdb.h system
8834set netdb.h i_netdb
8835eval $inhdr
8836
8837: see if prototypes for various gethostxxx netdb.h functions are available
8838echo " "
8839set d_gethostprotos gethostent $i_netdb netdb.h
8840eval $hasproto
8841
a0d0e21e
LW
8842: see if getlogin exists
8843set getlogin d_getlogin
8844eval $inlibc
8845
ccc7f9b3
KS
8846: see if getmntent exists
8847set getmntent d_getmntent
8848eval $inlibc
8849
693762b4
AD
8850: see if getnetbyaddr exists
8851set getnetbyaddr d_getnbyaddr
8852eval $inlibc
8853
8854: see if getnetbyname exists
8855set getnetbyname d_getnbyname
8856eval $inlibc
8857
e5c9fcd0
AD
8858: see if getnetent exists
8859set getnetent d_getnent
8860eval $inlibc
8861
dc45a647
MB
8862: see if prototypes for various getnetxxx netdb.h functions are available
8863echo " "
8864set d_getnetprotos getnetent $i_netdb netdb.h
8865eval $hasproto
8866
693762b4
AD
8867
8868: see if getprotobyname exists
8869set getprotobyname d_getpbyname
8870eval $inlibc
8871
8872: see if getprotobynumber exists
8873set getprotobynumber d_getpbynumber
8874eval $inlibc
e5c9fcd0
AD
8875
8876: see if getprotoent exists
8877set getprotoent d_getpent
8878eval $inlibc
8879
2afac517 8880: see if getpgid exists
8881set getpgid d_getpgid
a0d0e21e
LW
8882eval $inlibc
8883
8884: see if getpgrp2 exists
8885set getpgrp2 d_getpgrp2
8886eval $inlibc
8887
8888: see if getppid exists
8889set getppid d_getppid
8890eval $inlibc
8891
8892: see if getpriority exists
8893set getpriority d_getprior
8894eval $inlibc
8895
dc45a647
MB
8896: see if prototypes for various getprotoxxx netdb.h functions are available
8897echo " "
8898set d_getprotoprotos getprotoent $i_netdb netdb.h
8899eval $hasproto
8900
5ff3f7a4
GS
8901: see if getpwent exists
8902set getpwent d_getpwent
8903eval $inlibc
8904
8905
693762b4
AD
8906: see if getservbyname exists
8907set getservbyname d_getsbyname
8908eval $inlibc
8909
8910: see if getservbyport exists
8911set getservbyport d_getsbyport
8912eval $inlibc
e5c9fcd0
AD
8913
8914: see if getservent exists
8915set getservent d_getsent
8916eval $inlibc
8917
dc45a647
MB
8918: see if prototypes for various getservxxx netdb.h functions are available
8919echo " "
8920set d_getservprotos getservent $i_netdb netdb.h
8921eval $hasproto
8922
f1066039
JH
8923: see if getspent exists
8924set getspent d_getspent
8925eval $inlibc
8926
8927: see if getspnam exists
8928set getspnam d_getspnam
8929eval $inlibc
8930
5f05dabc 8931: see if gettimeofday or ftime exists
8932set gettimeofday d_gettimeod
8933eval $inlibc
8934case "$d_gettimeod" in
8935"$undef")
8936 set ftime d_ftime
8937 eval $inlibc
8938 ;;
8939*)
8940 val="$undef"; set d_ftime; eval $setvar
8941 ;;
8942esac
8943case "$d_gettimeod$d_ftime" in
8944"$undef$undef")
8945 echo " "
8946 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8947 ;;
8948esac
8949
5ff3f7a4
GS
8950: see if this is an grp system
8951set grp.h i_grp
8952eval $inhdr
8953
8954case "$i_grp" in
8955$define)
8956 xxx=`./findhdr grp.h`
8957 $cppstdin $cppflags $cppminus < $xxx >$$.h
8958
8959 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8960 val="$define"
8961 else
8962 val="$undef"
8963 fi
8964 set d_grpasswd
8965 eval $setvar
8966
8967 $rm -f $$.h
8968 ;;
8969*)
8970 val="$undef";
8971 set d_grpasswd; eval $setvar
8972 ;;
8973esac
8974
ccc7f9b3
KS
8975: see if hasmntopt exists
8976set hasmntopt d_hasmntopt
8977eval $inlibc
8978
a0d0e21e
LW
8979: see if this is a netinet/in.h or sys/in.h system
8980set netinet/in.h i_niin sys/in.h i_sysin
8981eval $inhdr
8982
5ff3f7a4 8983: see if arpa/inet.h has to be included
93341792 8984set arpa/inet.h i_arpainet
28e8609d
JH
8985eval $inhdr
8986
a0d0e21e
LW
8987: see if htonl --and friends-- exists
8988val=''
8989set htonl val
8990eval $inlibc
8991
8992: Maybe they are macros.
8993case "$val" in
8994$undef)
8995 $cat >htonl.c <<EOM
8996#include <stdio.h>
8997#include <sys/types.h>
8998#$i_niin I_NETINET_IN
8999#$i_sysin I_SYS_IN
93341792 9000#$i_arpainet I_ARPA_INET
a0d0e21e
LW
9001#ifdef I_NETINET_IN
9002#include <netinet/in.h>
9003#endif
9004#ifdef I_SYS_IN
9005#include <sys/in.h>
9006#endif
28e8609d
JH
9007#ifdef I_ARPA_INET
9008#include <arpa/inet.h>
9009#endif
a0d0e21e
LW
9010#ifdef htonl
9011printf("Defined as a macro.");
9012#endif
9013EOM
9014 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9015 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9016 val="$define"
9017 echo "But it seems to be defined as a macro." >&4
9018 fi
9019 $rm -f htonl.?
9020 ;;
9021esac
9022set d_htonl
9023eval $setvar
9024
9025: see which of string.h or strings.h is needed
9026echo " "
9027strings=`./findhdr string.h`
9028if $test "$strings" && $test -r "$strings"; then
9029 echo "Using <string.h> instead of <strings.h>." >&4
9030 val="$define"
9031else
9032 val="$undef"
9033 strings=`./findhdr strings.h`
9034 if $test "$strings" && $test -r "$strings"; then
9035 echo "Using <strings.h> instead of <string.h>." >&4
9036 else
9037 echo "No string header found -- You'll surely have problems." >&4
9038 fi
9039fi
9040set i_string
9041eval $setvar
9042case "$i_string" in
9043"$undef") strings=`./findhdr strings.h`;;
9044*) strings=`./findhdr string.h`;;
9045esac
9046
9047: index or strchr
9048echo " "
9049if set index val -f; eval $csym; $val; then
9050 if set strchr val -f d_strchr; eval $csym; $val; then
9051 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9052 val="$define"
9053 vali="$undef"
9054 echo "strchr() found." >&4
9055 else
9056 val="$undef"
9057 vali="$define"
9058 echo "index() found." >&4
9059 fi
9060 else
9061 val="$undef"
9062 vali="$define"
9063 echo "index() found." >&4
9064 fi
9065else
9066 if set strchr val -f d_strchr; eval $csym; $val; then
9067 val="$define"
9068 vali="$undef"
9069 echo "strchr() found." >&4
9070 else
9071 echo "No index() or strchr() found!" >&4
9072 val="$undef"
9073 vali="$undef"
9074 fi
9075fi
9076set d_strchr; eval $setvar
9077val="$vali"
9078set d_index; eval $setvar
9079
7e1af8bc 9080: check whether inet_aton exists
9081set inet_aton d_inetaton
9082eval $inlibc
9083
a0d0e21e
LW
9084: Look for isascii
9085echo " "
9086$cat >isascii.c <<'EOCP'
9087#include <stdio.h>
9088#include <ctype.h>
d674cd6d 9089int main() {
a0d0e21e
LW
9090 int c = 'A';
9091 if (isascii(c))
9092 exit(0);
9093 else
9094 exit(1);
9095}
9096EOCP
dfe9444c
AD
9097set isascii
9098if eval $compile; then
a0d0e21e
LW
9099 echo "isascii() found." >&4
9100 val="$define"
9101else
9102 echo "isascii() NOT found." >&4
9103 val="$undef"
9104fi
9105set d_isascii
9106eval $setvar
9107$rm -f isascii*
9108
9109: see if killpg exists
9110set killpg d_killpg
9111eval $inlibc
9112
dd64f1c3
AD
9113: see if lchown exists
9114echo " "
9115$cat > try.c <<'EOCP'
9116/* System header to define __stub macros and hopefully few prototypes,
9117 which can conflict with char lchown(); below. */
9118#include <assert.h>
9119/* Override any gcc2 internal prototype to avoid an error. */
9120/* We use char because int might match the return type of a gcc2
9121 builtin and then its argument prototype would still apply. */
9122char lchown();
9123int main() {
9124 /* The GNU C library defines this for functions which it implements
9125 to always fail with ENOSYS. Some functions are actually named
9126 something starting with __ and the normal name is an alias. */
9127#if defined (__stub_lchown) || defined (__stub___lchown)
9128choke me
9129#else
9130lchown();
9131#endif
9132; return 0; }
9133EOCP
9134set try
9135if eval $compile; then
9136 $echo "lchown() found." >&4
9137 val="$define"
9138else
9139 $echo "lchown() NOT found." >&4
9140 val="$undef"
9141fi
9142set d_lchown
9143eval $setvar
9144
a0d0e21e
LW
9145: see if link exists
9146set link d_link
9147eval $inlibc
9148
a0d0e21e
LW
9149: see if localeconv exists
9150set localeconv d_locconv
9151eval $inlibc
9152
9153: see if lockf exists
9154set lockf d_lockf
9155eval $inlibc
9156
9157: see if lstat exists
9158set lstat d_lstat
9159eval $inlibc
9160
ff49bff8
JH
9161: see if madvise exists
9162set madvise d_madvise
9163eval $inlibc
9164
a0d0e21e
LW
9165: see if mblen exists
9166set mblen d_mblen
9167eval $inlibc
9168
9169: see if mbstowcs exists
9170set mbstowcs d_mbstowcs
9171eval $inlibc
9172
9173: see if mbtowc exists
9174set mbtowc d_mbtowc
9175eval $inlibc
9176
0f27ced1
JH
9177: see if memchr exists
9178set memchr d_memchr
9179eval $inlibc
9180
a0d0e21e
LW
9181: see if memcmp exists
9182set memcmp d_memcmp
9183eval $inlibc
9184
9185: see if memcpy exists
9186set memcpy d_memcpy
9187eval $inlibc
9188
9189: see if memmove exists
9190set memmove d_memmove
2304df62
AD
9191eval $inlibc
9192
9193: see if memset exists
9194set memset d_memset
9195eval $inlibc
9196
9197: see if mkdir exists
9198set mkdir d_mkdir
9199eval $inlibc
9200
a0d0e21e
LW
9201: see if mkfifo exists
9202set mkfifo d_mkfifo
9203eval $inlibc
9204
9205: see if mktime exists
9206set mktime d_mktime
9207eval $inlibc
9208
ff49bff8
JH
9209: see if this is a sys/mman.h system
9210set sys/mman.h i_sysmman
9211eval $inhdr
9212
9213: see if mmap exists
9214set mmap d_mmap
9215eval $inlibc
9216: see what shmat returns
9217: default to something harmless
9218mmaptype='void *'
9219case "$i_sysmman$d_mmap" in
9220"$define$define")
9221 $cat >mmap.c <<'END'
9222#include <sys/mman.h>
9223void *mmap();
9224END
9225 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9226 mmaptype='void *'
9227 else
9228 mmaptype='caddr_t'
9229 fi
9230 echo "and it returns ($mmaptype)." >&4
9231 ;;
9232esac
9233
9234
9235
9236: see if mprotect exists
9237set mprotect d_mprotect
9238eval $inlibc
9239
2304df62
AD
9240: see if msgctl exists
9241set msgctl d_msgctl
9242eval $inlibc
9243
9244: see if msgget exists
9245set msgget d_msgget
9246eval $inlibc
9247
9248: see if msgsnd exists
9249set msgsnd d_msgsnd
9250eval $inlibc
9251
9252: see if msgrcv exists
9253set msgrcv d_msgrcv
9254eval $inlibc
9255
9256: see how much of the 'msg*(2)' library is present.
9257h_msg=true
9258echo " "
9259case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9260*"$undef"*) h_msg=false;;
9261esac
6087ac44
JH
9262case "$osname" in
9263freebsd)
9264 case "`ipcs 2>&1`" in
9265 "SVID messages"*"not configured"*)
5ff3f7a4 9266 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9267 h_msg=false
9268 val="$undef"
9269 set msgctl d_msgctl
9270 eval $setvar
9271 set msgget d_msgget
9272 eval $setvar
9273 set msgsnd d_msgsnd
9274 eval $setvar
9275 set msgrcv d_msgrcv
9276 eval $setvar
9277 ;;
9278 esac
9279 ;;
9280esac
2304df62
AD
9281: we could also check for sys/ipc.h ...
9282if $h_msg && $test `./findhdr sys/msg.h`; then
9283 echo "You have the full msg*(2) library." >&4
9284 val="$define"
9285else
9286 echo "You don't have the full msg*(2) library." >&4
9287 val="$undef"
9288fi
9289set d_msg
9290eval $setvar
9291
ff49bff8
JH
9292: see if msync exists
9293set msync d_msync
9294eval $inlibc
9295
9296: see if munmap exists
9297set munmap d_munmap
9298eval $inlibc
9299
dfe9444c
AD
9300: see if nice exists
9301set nice d_nice
9302eval $inlibc
9303
c4747d3e 9304: see if POSIX threads are available
13666627 9305if test "X$usethreads" = "X$define"; then
c4747d3e
JH
9306 set pthread.h i_pthread
9307 eval $inhdr
9308else
9309 i_pthread="$undef"
9310fi
9311
9312
9313
9314: how to create joinable pthreads
9315if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
9316 echo " "
9317 echo "Checking what constant to use for creating joinable pthreads..." >&4
9318 $cat >try.c <<'EOCP'
9319#include <pthread.h>
9320int main() {
9321 int detachstate = JOINABLE;
9322}
9323EOCP
9324 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9325 if eval $compile; then
c6912327 9326 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
9327 val="$undef" # Yes, undef.
9328 set d_old_pthread_create_joinable
13666627 9329 eval $setvar
ef4af2be
JH
9330 val=""
9331 set old_pthread_create_joinable
13666627
JH
9332 eval $setvar
9333 else
9334 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9335 if eval $compile; then
c6912327 9336 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 9337 val="$define"
ef4af2be 9338 set d_old_pthread_create_joinable
13666627
JH
9339 eval $setvar
9340 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 9341 set old_pthread_create_joinable
13666627
JH
9342 eval $setvar
9343 else
9344 set try -DJOINABLE=__UNDETACHED
9345 if eval $compile; then
c6912327 9346 echo "You seem to use __UNDETACHED." >&4
13666627 9347 val="$define"
ef4af2be 9348 set d_old_pthread_create_joinable
13666627
JH
9349 eval $setvar
9350 val=__UNDETACHED
ef4af2be 9351 set old_pthread_create_joinable
13666627
JH
9352 eval $setvar
9353 else
c6912327 9354 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 9355 val="$define"
ef4af2be 9356 set d_old_pthread_create_joinable
13666627
JH
9357 eval $setvar
9358 val=0
ef4af2be 9359 set old_pthread_create_joinable
13666627
JH
9360 eval $setvar
9361 fi
9362 fi
9363 fi
9364 $rm -f try try.*
9365else
ef4af2be
JH
9366 d_old_pthread_create_joinable="$undef"
9367 old_pthread_create_joinable=""
13666627
JH
9368fi
9369
ef4af2be
JH
9370: see if pause exists
9371set pause d_pause
9372eval $inlibc
9373
9374: see if pipe exists
9375set pipe d_pipe
9376eval $inlibc
9377
9378: see if poll exists
9379set poll d_poll
9380eval $inlibc
9381
31dfa2f6
JH
9382
9383: see whether the various POSIXish _yields exist
9384$cat >try.c <<EOP
9385#include <pthread.h>
9386#include <stdio.h>
5a411a32 9387int main() {
31dfa2f6
JH
9388#ifdef SCHED_YIELD
9389 sched_yield();
9390#else
9391#ifdef PTHREAD_YIELD
9392 pthread_yield();
9393#else
9394#ifdef PTHREAD_YIELD_NULL
9395 pthread_yield(NULL);
9396#endif
9397#endif
9398#endif
9399}
9400EOP
9401: see if sched_yield exists
9402set try -DSCHED_YIELD
9403if eval $compile; then
9404 val="$define"
9405 sched_yield='sched_yield()'
9406else
9407 val="$undef"
9408fi
9409case "$usethreads" in
9410$define)
9411 case "$val" in
9412 $define) echo 'sched_yield() found.' >&4 ;;
9413 *) echo 'sched_yield() NOT found.' >&4 ;;
9414 esac
9415esac
9416set d_sched_yield
9417eval $setvar
9418
9419: see if pthread_yield exists
9420set try -DPTHREAD_YIELD
9421if eval $compile; then
9422 val="$define"
9423 case "$sched_yield" in
9424 '') sched_yield='pthread_yield()' ;;
9425 esac
9426else
9427 set try -DPTHREAD_YIELD_NULL
9428 if eval $compile; then
9429 val="$define"
9430 case "$sched_yield" in
9431 '') sched_yield='pthread_yield(NULL)' ;;
9432 esac
9433 else
9434 val="$undef"
9435 fi
9436fi
9437case "$usethreads" in
9438$define)
9439 case "$val" in
9440 $define) echo 'pthread_yield() found.' >&4 ;;
9441 *) echo 'pthread_yield() NOT found.' >&4 ;;
9442 esac
9443 ;;
9444esac
9445set d_pthread_yield
9446eval $setvar
9447
9448case "$sched_yield" in
9449'') sched_yield=undef ;;
9450esac
9451
9452$rm -f try try.*
9453
4aa0a1f7
AD
9454: see if this is a pwd.h system
9455set pwd.h i_pwd
9456eval $inhdr
9457
9458case "$i_pwd" in
9459$define)
9460 xxx=`./findhdr pwd.h`
85e6fe83 9461 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 9462
2304df62 9463 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 9464 val="$define"
2304df62 9465 else
4aa0a1f7 9466 val="$undef"
2304df62 9467 fi
4aa0a1f7
AD
9468 set d_pwquota
9469 eval $setvar
9470
2304df62 9471 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 9472 val="$define"
2304df62 9473 else
4aa0a1f7 9474 val="$undef"
2304df62 9475 fi
4aa0a1f7
AD
9476 set d_pwage
9477 eval $setvar
9478
2304df62 9479 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 9480 val="$define"
2304df62 9481 else
4aa0a1f7 9482 val="$undef"
2304df62 9483 fi
4aa0a1f7
AD
9484 set d_pwchange
9485 eval $setvar
9486
2304df62 9487 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 9488 val="$define"
2304df62 9489 else
4aa0a1f7 9490 val="$undef"
2304df62 9491 fi
4aa0a1f7
AD
9492 set d_pwclass
9493 eval $setvar
9494
2304df62 9495 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 9496 val="$define"
2304df62 9497 else
4aa0a1f7 9498 val="$undef"
2304df62 9499 fi
4aa0a1f7
AD
9500 set d_pwexpire
9501 eval $setvar
9502
2304df62 9503 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4aa0a1f7 9504 val="$define"
2304df62 9505 else
4aa0a1f7 9506 val="$undef"
2304df62 9507 fi
4aa0a1f7
AD
9508 set d_pwcomment
9509 eval $setvar
9510
c4f23d77
AD
9511 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9512 val="$define"
9513 else
9514 val="$undef"
9515 fi
9516 set d_pwgecos
9517 eval $setvar
9518
28e8609d
JH
9519 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9520 val="$define"
9521 else
9522 val="$undef"
9523 fi
9524 set d_pwpasswd
9525 eval $setvar
9526
2304df62 9527 $rm -f $$.h
4aa0a1f7 9528 ;;
5ff3f7a4 9529*)
4aa0a1f7
AD
9530 val="$undef";
9531 set d_pwquota; eval $setvar
9532 set d_pwage; eval $setvar
9533 set d_pwchange; eval $setvar
9534 set d_pwclass; eval $setvar
9535 set d_pwexpire; eval $setvar
9536 set d_pwcomment; eval $setvar
c4f23d77 9537 set d_pwgecos; eval $setvar
28e8609d 9538 set d_pwpasswd; eval $setvar
4aa0a1f7
AD
9539 ;;
9540esac
2304df62 9541
85e6fe83 9542: see if readdir and friends exist
2304df62
AD
9543set readdir d_readdir
9544eval $inlibc
85e6fe83
LW
9545set seekdir d_seekdir
9546eval $inlibc
9547set telldir d_telldir
9548eval $inlibc
9549set rewinddir d_rewinddir
9550eval $inlibc
2304df62 9551
a0d0e21e
LW
9552: see if readlink exists
9553set readlink d_readlink
9554eval $inlibc
9555
de4597cb
JH
9556: see if readv exists
9557set readv d_readv
9558eval $inlibc
9559
2304df62
AD
9560: see if rename exists
9561set rename d_rename
9562eval $inlibc
9563
9564: see if rmdir exists
9565set rmdir d_rmdir
9566eval $inlibc
9567
8ff267be 9568: see if memory.h is available.
9569val=''
9570set memory.h val
9571eval $inhdr
9572
9573: See if it conflicts with string.h
9574case "$val" in
9575$define)
9576 case "$strings" in
9577 '') ;;
9578 *)
9579 $cppstdin $cppflags $cppminus < $strings > mem.h
9580 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9581 echo " "
9582 echo "We won't be including <memory.h>."
9583 val="$undef"
9584 fi
9585 $rm -f mem.h
9586 ;;
9587 esac
9588esac
9589set i_memory
9590eval $setvar
9591
2304df62
AD
9592: can bcopy handle overlapping blocks?
9593val="$undef"
9594case "$d_bcopy" in
9595"$define")
9596 echo " "
9597 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 9598 $cat >try.c <<EOCP
8ff267be 9599#$i_memory I_MEMORY
9600#$i_stdlib I_STDLIB
9601#$i_string I_STRING
9602#$i_unistd I_UNISTD
9603EOCP
dfe9444c 9604 $cat >>try.c <<'EOCP'
8ff267be 9605#include <stdio.h>
8ff267be 9606#ifdef I_MEMORY
9607# include <memory.h>
9608#endif
9609#ifdef I_STDLIB
9610# include <stdlib.h>
9611#endif
9612#ifdef I_STRING
9613# include <string.h>
9614#else
9615# include <strings.h>
9616#endif
9617#ifdef I_UNISTD
9618# include <unistd.h> /* Needed for NetBSD */
9619#endif
d674cd6d 9620int main()
2304df62 9621{
85e6fe83
LW
9622char buf[128], abc[128];
9623char *b;
9624int len;
9625int off;
9626int align;
a0d0e21e 9627
85e6fe83 9628bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
9629
9630for (align = 7; align >= 0; align--) {
9631 for (len = 36; len; len--) {
9632 b = buf+align;
85e6fe83 9633 bcopy(abc, b, len);
2304df62
AD
9634 for (off = 1; off <= len; off++) {
9635 bcopy(b, b+off, len);
9636 bcopy(b+off, b, len);
85e6fe83 9637 if (bcmp(b, abc, len))
2304df62
AD
9638 exit(1);
9639 }
9640 }
9641}
9642exit(0);
9643}
9644EOCP
dfe9444c 9645 set try
dc45a647 9646 if eval $compile_ok; then
dfe9444c 9647 if ./try 2>/dev/null; then
2304df62
AD
9648 echo "Yes, it can."
9649 val="$define"
9650 else
9651 echo "It can't, sorry."
8ff267be 9652 case "$d_memmove" in
9653 "$define") echo "But that's Ok since you have memmove()." ;;
9654 esac
2304df62
AD
9655 fi
9656 else
9657 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 9658 case "$d_memmove" in
9659 "$define") echo "But that's Ok since you have memmove()." ;;
9660 esac
2304df62
AD
9661 fi
9662 ;;
9663esac
dfe9444c 9664$rm -f try.* try core
2304df62
AD
9665set d_safebcpy
9666eval $setvar
9667
9668: can memcpy handle overlapping blocks?
9669val="$undef"
9670case "$d_memcpy" in
9671"$define")
9672 echo " "
9673 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 9674 $cat >try.c <<EOCP
8ff267be 9675#$i_memory I_MEMORY
9676#$i_stdlib I_STDLIB
9677#$i_string I_STRING
9678#$i_unistd I_UNISTD
9679EOCP
dfe9444c 9680 $cat >>try.c <<'EOCP'
8ff267be 9681#include <stdio.h>
8ff267be 9682#ifdef I_MEMORY
9683# include <memory.h>
9684#endif
9685#ifdef I_STDLIB
9686# include <stdlib.h>
9687#endif
9688#ifdef I_STRING
9689# include <string.h>
9690#else
9691# include <strings.h>
9692#endif
9693#ifdef I_UNISTD
9694# include <unistd.h> /* Needed for NetBSD */
9695#endif
d674cd6d 9696int main()
2304df62 9697{
85e6fe83
LW
9698char buf[128], abc[128];
9699char *b;
9700int len;
9701int off;
9702int align;
9703
8ff267be 9704/* Copy "abcde..." string to char abc[] so that gcc doesn't
9705 try to store the string in read-only memory. */
85e6fe83 9706memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
9707
9708for (align = 7; align >= 0; align--) {
9709 for (len = 36; len; len--) {
9710 b = buf+align;
232e078e 9711 memcpy(b, abc, len);
2304df62 9712 for (off = 1; off <= len; off++) {
2304df62 9713 memcpy(b+off, b, len);
232e078e 9714 memcpy(b, b+off, len);
85e6fe83 9715 if (memcmp(b, abc, len))
2304df62
AD
9716 exit(1);
9717 }
9718 }
9719}
9720exit(0);
9721}
9722EOCP
dfe9444c 9723 set try
dc45a647 9724 if eval $compile_ok; then
dfe9444c 9725 if ./try 2>/dev/null; then
2304df62
AD
9726 echo "Yes, it can."
9727 val="$define"
9728 else
9729 echo "It can't, sorry."
8ff267be 9730 case "$d_memmove" in
9731 "$define") echo "But that's Ok since you have memmove()." ;;
9732 esac
2304df62
AD
9733 fi
9734 else
9735 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 9736 case "$d_memmove" in
9737 "$define") echo "But that's Ok since you have memmove()." ;;
9738 esac
2304df62
AD
9739 fi
9740 ;;
9741esac
dfe9444c 9742$rm -f try.* try core
2304df62
AD
9743set d_safemcpy
9744eval $setvar
9745
36477c24 9746: can memcmp be trusted to compare relative magnitude?
9747val="$undef"
9748case "$d_memcmp" in
9749"$define")
9750 echo " "
dfe9444c
AD
9751 echo "Checking if your memcmp() can compare relative magnitude..." >&4
9752 $cat >try.c <<EOCP
36477c24 9753#$i_memory I_MEMORY
9754#$i_stdlib I_STDLIB
9755#$i_string I_STRING
9756#$i_unistd I_UNISTD
9757EOCP
dfe9444c 9758 $cat >>try.c <<'EOCP'
36477c24 9759#include <stdio.h>
36477c24 9760#ifdef I_MEMORY
9761# include <memory.h>
9762#endif
9763#ifdef I_STDLIB
9764# include <stdlib.h>
9765#endif
9766#ifdef I_STRING
9767# include <string.h>
9768#else
9769# include <strings.h>
9770#endif
9771#ifdef I_UNISTD
9772# include <unistd.h> /* Needed for NetBSD */
9773#endif
d674cd6d 9774int main()
36477c24 9775{
9776char a = -1;
9777char b = 0;
9778if ((a < b) && memcmp(&a, &b, 1) < 0)
9779 exit(1);
9780exit(0);
9781}
9782EOCP
dfe9444c 9783 set try
dc45a647 9784 if eval $compile_ok; then
dfe9444c 9785 if ./try 2>/dev/null; then
36477c24 9786 echo "Yes, it can."
9787 val="$define"
9788 else
9789 echo "No, it can't (it uses signed chars)."
9790 fi
9791 else
9792 echo "(I can't compile the test program, so we'll assume not...)"
9793 fi
9794 ;;
9795esac
dfe9444c 9796$rm -f try.* try core
36477c24 9797set d_sanemcmp
9798eval $setvar
9799
2304df62
AD
9800: see if select exists
9801set select d_select
9802eval $inlibc
9803
9804: see if semctl exists
9805set semctl d_semctl
9806eval $inlibc
9807
9808: see if semget exists
9809set semget d_semget
9810eval $inlibc
9811
9812: see if semop exists
9813set semop d_semop
9814eval $inlibc
9815
9816: see how much of the 'sem*(2)' library is present.
9817h_sem=true
9818echo " "
9819case "$d_semctl$d_semget$d_semop" in
9820*"$undef"*) h_sem=false;;
9821esac
6087ac44
JH
9822case "$osname" in
9823freebsd)
9824 case "`ipcs 2>&1`" in
9825 "SVID messages"*"not configured"*)
5ff3f7a4 9826 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
9827 h_sem=false
9828 val="$undef"
9829 set semctl d_semctl
9830 eval $setvar
9831 set semget d_semget
9832 eval $setvar
9833 set semop d_semop
9834 eval $setvar
9835 ;;
9836 esac
9837 ;;
9838esac
2304df62
AD
9839: we could also check for sys/ipc.h ...
9840if $h_sem && $test `./findhdr sys/sem.h`; then
9841 echo "You have the full sem*(2) library." >&4
9842 val="$define"
9843else
9844 echo "You don't have the full sem*(2) library." >&4
9845 val="$undef"
9846fi
9847set d_sem
9848eval $setvar
9849
bd89102f
AD
9850: see whether sys/sem.h defines union semun
9851echo " "
9852$cat > try.c <<'END'
9853#include <sys/types.h>
9854#include <sys/ipc.h>
9855#include <sys/sem.h>
9856int main () { union semun semun; semun.buf = 0; }
9857END
9858set try
9859if eval $compile; then
9860 echo "You have union semun in <sys/sem.h>." >&4
9861 val="$define"
9862else
9863 echo "You do not have union semun in <sys/sem.h>." >&4
9864 val="$undef"
9865fi
85ab1d1d 9866$rm -f try try.c try.h
bd89102f
AD
9867set d_union_semun
9868eval $setvar
9869
9870: see how to do semctl IPC_STAT
9871case "$d_sem" in
9872$define)
9873 : see whether semctl IPC_STAT can use union semun
9874 echo " "
85ab1d1d
JH
9875 $cat > try.h <<END
9876#ifndef S_IRUSR
9877# ifdef S_IREAD
9878# define S_IRUSR S_IREAD
9879# define S_IWUSR S_IWRITE
9880# define S_IXUSR S_IEXEC
9881# else
9882# define S_IRUSR 0400
9883# define S_IWUSR 0200
9884# define S_IXUSR 0100
9885# endif
9886# define S_IRGRP (S_IRUSR>>3)
9887# define S_IWGRP (S_IWUSR>>3)
9888# define S_IXGRP (S_IXUSR>>3)
9889# define S_IROTH (S_IRUSR>>6)
9890# define S_IWOTH (S_IWUSR>>6)
9891# define S_IXOTH (S_IXUSR>>6)
9892#endif
9893#ifndef S_IRWXU
9894# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9895# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9896# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9897#endif
9898END
9899
bd89102f
AD
9900 $cat > try.c <<END
9901#include <sys/types.h>
9902#include <sys/ipc.h>
9903#include <sys/sem.h>
9904#include <sys/stat.h>
9905#include <stdio.h>
9906#include <errno.h>
85ab1d1d 9907#include "try.h"
bd89102f
AD
9908#ifndef errno
9909extern int errno;
9910#endif
9911#$d_union_semun HAS_UNION_SEMUN
9912int main() {
9913 union semun
9914#ifndef HAS_UNION_SEMUN
9915 {
9916 int val;
9917 struct semid_ds *buf;
9918 unsigned short *array;
9919 }
9920#endif
9921 arg;
9922 int sem, st;
9923
9924#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9925 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9926 if (sem > -1) {
9927 struct semid_ds argbuf;
9928 arg.buf = &argbuf;
9929# ifdef IPC_STAT
9930 st = semctl(sem, 0, IPC_STAT, arg);
9931 if (st == 0)
9932 printf("semun\n");
9933 else
9934# endif /* IPC_STAT */
9935 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9936# ifdef IPC_RMID
9937 if (semctl(sem, 0, IPC_RMID, arg) != 0)
9938# endif /* IPC_RMID */
9939 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9940 } else
9941#endif /* IPC_PRIVATE && ... */
9942 printf("semget failed: errno = %d\n", errno);
9943 return 0;
9944}
9945END
9946 val="$undef"
9947 set try
9948 if eval $compile; then
9949 xxx=`./try`
9950 case "$xxx" in
9951 semun) val="$define" ;;
9952 esac
9953 fi
9954 $rm -f try try.c
9955 set d_semctl_semun
9956 eval $setvar
9957 case "$d_semctl_semun" in
9958 $define)
9959 echo "You can use union semun for semctl IPC_STAT." >&4
9960 also='also'
9961 ;;
9962 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
9963 also=''
9964 ;;
9965 esac
9966
9967 : see whether semctl IPC_STAT can use struct semid_ds pointer
9968 $cat > try.c <<'END'
9969#include <sys/types.h>
9970#include <sys/ipc.h>
9971#include <sys/sem.h>
9972#include <sys/stat.h>
85ab1d1d 9973#include "try.h"
bd89102f
AD
9974#include <stdio.h>
9975#include <errno.h>
9976#ifndef errno
9977extern int errno;
9978#endif
9979int main() {
9980 struct semid_ds arg;
9981 int sem, st;
9982
9983#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9984 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9985 if (sem > -1) {
9986# ifdef IPC_STAT
9987 st = semctl(sem, 0, IPC_STAT, &arg);
9988 if (st == 0)
9989 printf("semid_ds\n");
9990 else
9991# endif /* IPC_STAT */
9992 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9993# ifdef IPC_RMID
9994 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9995# endif /* IPC_RMID */
9996 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9997 } else
9998#endif /* IPC_PRIVATE && ... */
9999 printf("semget failed: errno = %d\n", errno);
10000
10001 return 0;
10002}
10003END
10004 val="$undef"
10005 set try
10006 if eval $compile; then
10007 xxx=`./try`
10008 case "$xxx" in
10009 semid_ds) val="$define" ;;
10010 esac
10011 fi
10012 $rm -f try try.c
10013 set d_semctl_semid_ds
10014 eval $setvar
10015 case "$d_semctl_semid_ds" in
10016 $define)
7f3d1cf1 10017 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 10018 ;;
7f3d1cf1 10019 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
10020 ;;
10021 esac
85ab1d1d 10022 $rm -f try.h
bd89102f
AD
10023 ;;
10024*) val="$undef"
10025
10026 # We do not have the full sem*(2) library, so assume we can not
10027 # use either.
10028
10029 set d_semctl_semun
10030 eval $setvar
10031
10032 set d_semctl_semid_ds
10033 eval $setvar
10034 ;;
10035esac
10036
2304df62
AD
10037: see if setegid exists
10038set setegid d_setegid
10039eval $inlibc
10040
10041: see if seteuid exists
10042set seteuid d_seteuid
10043eval $inlibc
10044
5ff3f7a4
GS
10045: see if setgrent exists
10046set setgrent d_setgrent
10047eval $inlibc
10048
693762b4
AD
10049: see if sethostent exists
10050set sethostent d_sethent
10051eval $inlibc
10052
a0d0e21e
LW
10053: see if setlinebuf exists
10054set setlinebuf d_setlinebuf
10055eval $inlibc
10056
2304df62
AD
10057: see if setlocale exists
10058set setlocale d_setlocale
10059eval $inlibc
a0d0e21e 10060
e5c9fcd0
AD
10061: see if setnetent exists
10062set setnetent d_setnent
10063eval $inlibc
10064
10065: see if setprotoent exists
10066set setprotoent d_setpent
10067eval $inlibc
10068
2304df62
AD
10069: see if setpgid exists
10070set setpgid d_setpgid
10071eval $inlibc
10072
2304df62
AD
10073: see if setpgrp2 exists
10074set setpgrp2 d_setpgrp2
10075eval $inlibc
10076
10077: see if setpriority exists
10078set setpriority d_setprior
10079eval $inlibc
10080
5ff3f7a4
GS
10081: see if setpwent exists
10082set setpwent d_setpwent
10083eval $inlibc
10084
2304df62
AD
10085: see if setregid exists
10086set setregid d_setregid
10087eval $inlibc
10088set setresgid d_setresgid
10089eval $inlibc
10090
10091: see if setreuid exists
10092set setreuid d_setreuid
10093eval $inlibc
10094set setresuid d_setresuid
10095eval $inlibc
10096
10097: see if setrgid exists
10098set setrgid d_setrgid
10099eval $inlibc
10100
10101: see if setruid exists
10102set setruid d_setruid
10103eval $inlibc
10104
e5c9fcd0
AD
10105: see if setservent exists
10106set setservent d_setsent
10107eval $inlibc
10108
2304df62
AD
10109: see if setsid exists
10110set setsid d_setsid
10111eval $inlibc
10112
f1066039
JH
10113: see if setspent exists
10114set setspent d_setspent
10115eval $inlibc
10116
e5c9fcd0
AD
10117: see if setvbuf exists
10118set setvbuf d_setvbuf
10119eval $inlibc
10120
760ac839
LW
10121: see if sfio.h is available
10122set sfio.h i_sfio
10123eval $inhdr
10124
10125
8ff267be 10126: see if sfio library is available
760ac839
LW
10127case "$i_sfio" in
10128$define)
10129 val=''
10130 set sfreserve val
10131 eval $inlibc
10132 ;;
10133*)
10134 val="$undef"
10135 ;;
10136esac
8ff267be 10137: Ok, but do we want to use it.
760ac839
LW
10138case "$val" in
10139$define)
10140 case "$usesfio" in
8ff267be 10141 true|$define|[yY]*) dflt='y';;
760ac839
LW
10142 *) dflt='n';;
10143 esac
8ff267be 10144 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
10145 rp="You seem to have sfio available, do you want to try using it?"
10146 . ./myread
10147 case "$ans" in
8ff267be 10148 y|Y) ;;
10149 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 10150 val="$undef"
ff0cee69 10151 : Remove sfio from list of libraries to use
10152 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10153 shift
10154 libs="$*"
10155 echo "libs = $libs" >&4
760ac839
LW
10156 ;;
10157 esac
10158 ;;
8ff267be 10159*) case "$usesfio" in
10160 true|$define|[yY]*)
10161 echo "Sorry, cannot find sfio on this machine" >&4
10162 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
10163 ;;
10164 esac
10165 ;;
10166esac
8ff267be 10167set d_sfio
10168eval $setvar
760ac839
LW
10169case "$d_sfio" in
10170$define) usesfio='true';;
10171*) usesfio='false';;
10172esac
10173
2304df62
AD
10174: see if shmctl exists
10175set shmctl d_shmctl
10176eval $inlibc
10177
10178: see if shmget exists
10179set shmget d_shmget
10180eval $inlibc
10181
a0d0e21e
LW
10182: see if shmat exists
10183set shmat d_shmat
10184eval $inlibc
10185: see what shmat returns
10186case "$d_shmat" in
10187"$define")
10188 $cat >shmat.c <<'END'
10189#include <sys/shm.h>
10190void *shmat();
10191END
10192 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10193 shmattype='void *'
10194 else
10195 shmattype='char *'
10196 fi
10197 echo "and it returns ($shmattype)." >&4
10198 : see if a prototype for shmat is available
e50aee73
AD
10199 xxx=`./findhdr sys/shm.h`
10200 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
10201 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10202 val="$define"
10203 else
10204 val="$undef"
10205 fi
10206 $rm -f shmat.[co]
10207 ;;
10208*)
10209 val="$undef"
10210 ;;
10211esac
10212set d_shmatprototype
10213eval $setvar
10214
10215: see if shmdt exists
10216set shmdt d_shmdt
10217eval $inlibc
10218
10219: see how much of the 'shm*(2)' library is present.
10220h_shm=true
10221echo " "
10222case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10223*"$undef"*) h_shm=false;;
10224esac
6087ac44
JH
10225case "$osname" in
10226freebsd)
10227 case "`ipcs 2>&1`" in
10228 "SVID shared memory"*"not configured"*)
5ff3f7a4 10229 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
10230 h_shm=false
10231 val="$undef"
10232 set shmctl d_shmctl
10233 evat $setvar
10234 set shmget d_shmget
10235 evat $setvar
10236 set shmat d_shmat
10237 evat $setvar
10238 set shmdt d_shmdt
10239 evat $setvar
10240 ;;
10241 esac
10242 ;;
10243esac
a0d0e21e
LW
10244: we could also check for sys/ipc.h ...
10245if $h_shm && $test `./findhdr sys/shm.h`; then
10246 echo "You have the full shm*(2) library." >&4
10247 val="$define"
10248else
10249 echo "You don't have the full shm*(2) library." >&4
10250 val="$undef"
10251fi
10252set d_shm
10253eval $setvar
10254
2c7991dc 10255echo " "
8ff267be 10256: see if we have sigaction
10257if set sigaction val -f d_sigaction; eval $csym; $val; then
10258 echo 'sigaction() found.' >&4
dc45a647 10259 $cat > try.c <<'EOP'
8ff267be 10260#include <stdio.h>
10261#include <sys/types.h>
10262#include <signal.h>
d674cd6d 10263int main()
8ff267be 10264{
10265 struct sigaction act, oact;
10266}
10267EOP
dc45a647
MB
10268 set try
10269 if eval $compile_ok; then
10270 val="$define"
10271 else
10272 echo "But you don't seem to have a useable struct sigaction." >&4
10273 val="$undef"
10274 fi
8ff267be 10275else
dc45a647 10276 echo 'sigaction NOT found.' >&4
8ff267be 10277 val="$undef"
10278fi
10279set d_sigaction; eval $setvar
dfe9444c 10280$rm -f try try$_o try.c
2c7991dc 10281
a5f75d66
AD
10282: see if sigsetjmp exists
10283echo " "
921b2963
JH
10284case "$d_sigsetjmp" in
10285'')
10286 $cat >try.c <<'EOP'
10287#include <setjmp.h>
10288sigjmp_buf env;
10289int set = 1;
d674cd6d 10290int main()
921b2963
JH
10291{
10292 if (sigsetjmp(env,1))
10293 exit(set);
10294 set = 0;
10295 siglongjmp(env, 1);
10296 exit(1);
10297}
10298EOP
10299 set try
10300 if eval $compile; then
10301 if ./try >/dev/null 2>&1; then
10302 echo "POSIX sigsetjmp found." >&4
10303 val="$define"
10304 else
10305 $cat >&4 <<EOM
10306Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10307I'll ignore them.
10308EOM
10309 val="$undef"
a0d0e21e 10310 fi
921b2963
JH
10311 else
10312 echo "sigsetjmp not found." >&4
10313 val="$undef"
a0d0e21e 10314 fi
921b2963
JH
10315 ;;
10316*) val="$d_sigsetjmp"
10317 case "$d_sigsetjmp" in
10318 $define) echo "POSIX sigsetjmp found." >&4;;
10319 $undef) echo "sigsetjmp not found." >&4;;
10320 esac
10321 ;;
10322esac
10323set d_sigsetjmp
10324eval $setvar
10325$rm -f try.c try
2304df62 10326
2304df62
AD
10327: see if stat knows about block sizes
10328echo " "
5ff3f7a4
GS
10329set d_statblks stat st_blocks $i_sysstat sys/stat.h
10330eval $hasfield
2304df62 10331
16d20bd9
AD
10332: see if _ptr and _cnt from stdio act std
10333echo " "
dca663ed 10334if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
10335 echo "(Looks like you have stdio.h from Linux.)"
10336 case "$stdio_ptr" in
c2960299
AD
10337 '') stdio_ptr='((fp)->_IO_read_ptr)'
10338 ptr_lval=$define
10339 ;;
8e07c86e 10340 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10341 esac
10342 case "$stdio_cnt" in
c2960299
AD
10343 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10344 cnt_lval=$undef
10345 ;;
8e07c86e 10346 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10347 esac
10348 case "$stdio_base" in
10349 '') stdio_base='((fp)->_IO_read_base)';;
10350 esac
10351 case "$stdio_bufsiz" in
c2960299 10352 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
10353 esac
10354else
10355 case "$stdio_ptr" in
c2960299
AD
10356 '') stdio_ptr='((fp)->_ptr)'
10357 ptr_lval=$define
10358 ;;
8e07c86e 10359 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10360 esac
10361 case "$stdio_cnt" in
c2960299
AD
10362 '') stdio_cnt='((fp)->_cnt)'
10363 cnt_lval=$define
10364 ;;
8e07c86e 10365 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10366 esac
10367 case "$stdio_base" in
10368 '') stdio_base='((fp)->_base)';;
10369 esac
10370 case "$stdio_bufsiz" in
10371 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10372 esac
10373fi
10374: test whether _ptr and _cnt really work
10375echo "Checking how std your stdio is..." >&4
10376$cat >try.c <<EOP
10377#include <stdio.h>
10378#define FILE_ptr(fp) $stdio_ptr
10379#define FILE_cnt(fp) $stdio_cnt
d674cd6d 10380int main() {
16d20bd9
AD
10381 FILE *fp = fopen("try.c", "r");
10382 char c = getc(fp);
10383 if (
10384 18 <= FILE_cnt(fp) &&
10385 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10386 )
10387 exit(0);
10388 exit(1);
10389}
10390EOP
10391val="$undef"
dfe9444c
AD
10392set try
10393if eval $compile; then
16d20bd9
AD
10394 if ./try; then
10395 echo "Your stdio acts pretty std."
10396 val="$define"
10397 else
10398 echo "Your stdio isn't very std."
10399 fi
10400else
10401 echo "Your stdio doesn't appear very std."
10402fi
10403$rm -f try.c try
10404set d_stdstdio
10405eval $setvar
10406
8e07c86e 10407: Can _ptr be used as an lvalue?
e50aee73
AD
10408case "$d_stdstdio$ptr_lval" in
10409$define$define) val=$define ;;
c2960299
AD
10410*) val=$undef ;;
10411esac
10412set d_stdio_ptr_lval
10413eval $setvar
10414
8e07c86e 10415: Can _cnt be used as an lvalue?
e50aee73
AD
10416case "$d_stdstdio$cnt_lval" in
10417$define$define) val=$define ;;
c2960299
AD
10418*) val=$undef ;;
10419esac
10420set d_stdio_cnt_lval
10421eval $setvar
10422
16d20bd9
AD
10423: see if _base is also standard
10424val="$undef"
10425case "$d_stdstdio" in
10426$define)
10427 $cat >try.c <<EOP
10428#include <stdio.h>
10429#define FILE_base(fp) $stdio_base
10430#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 10431int main() {
16d20bd9
AD
10432 FILE *fp = fopen("try.c", "r");
10433 char c = getc(fp);
10434 if (
10435 19 <= FILE_bufsiz(fp) &&
10436 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10437 )
10438 exit(0);
10439 exit(1);
10440}
10441EOP
dfe9444c
AD
10442 set try
10443 if eval $compile; then
16d20bd9 10444 if ./try; then
8ff267be 10445 echo "And its _base field acts std."
16d20bd9
AD
10446 val="$define"
10447 else
10448 echo "But its _base field isn't std."
10449 fi
10450 else
10451 echo "However, it seems to be lacking the _base field."
10452 fi
10453 $rm -f try.c try
10454 ;;
10455esac
10456set d_stdiobase
10457eval $setvar
10458
ed39a0f2
JH
10459$cat >&4 <<EOM
10460Checking how to access stdio streams by file descriptor number...
10461EOM
10462case "$stdio_stream_array" in
10463'') $cat >try.c <<EOCP
10464#include <stdio.h>
10465int main() {
10466 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10467 printf("yes\n");
10468}
10469EOCP
10470 for s in _iob __iob __sF
10471 do
10472 set try -DSTDIO_STREAM_ARRAY=$s
10473 if eval $compile; then
10474 case "`./try$exe_ext`" in
10475 yes) stdio_stream_array=$s; break ;;
10476 esac
10477 fi
10478 done
10479 $rm -f try.* try$exe_ext
10480esac
10481case "$stdio_stream_array" in
10482'') $cat >&4 <<EOM
10483I can't figure out how to access stdio streams by file descriptor number.
10484EOM
10485 d_stdio_stream_array="$undef"
10486 ;;
10487*) $cat >&4 <<EOM
10488You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10489EOM
10490 d_stdio_stream_array="$define"
10491 ;;
10492esac
10493
a0d0e21e
LW
10494: see if strcoll exists
10495set strcoll d_strcoll
10496eval $inlibc
2304df62
AD
10497
10498: check for structure copying
10499echo " "
10500echo "Checking to see if your C compiler can copy structs..." >&4
10501$cat >try.c <<'EOCP'
5a411a32 10502int main()
2304df62
AD
10503{
10504 struct blurfl {
10505 int dyick;
10506 } foo, bar;
10507
10508 foo = bar;
10509}
10510EOCP
10511if $cc -c try.c >/dev/null 2>&1 ; then
10512 val="$define"
10513 echo "Yup, it can."
10514else
10515 val="$undef"
10516 echo "Nope, it can't."
10517fi
10518set d_strctcpy
10519eval $setvar
10520$rm -f try.*
10521
10522: see if strerror and/or sys_errlist[] exist
10523echo " "
28e8609d
JH
10524if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10525 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
10526 echo 'strerror() found.' >&4
10527 d_strerror="$define"
10528 d_strerrm='strerror(e)'
10529 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10530 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
10531 d_syserrlst="$define"
10532 else
10533 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10534 d_syserrlst="$undef"
10535 fi
28e8609d 10536 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
10537 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10538 echo 'strerror() found in string header.' >&4
10539 d_strerror="$define"
10540 d_strerrm='strerror(e)'
10541 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10542 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10543 d_syserrlst="$define"
10544 else
10545 echo "(You don't appear to have any sys_errlist[], how can this be?)"
10546 d_syserrlst="$undef"
10547 fi
28e8609d 10548 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
10549 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10550 d_strerror="$undef"
10551 d_syserrlst="$define"
10552 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 10553 else
5ff3f7a4
GS
10554 echo 'strerror() and sys_errlist[] NOT found.' >&4
10555 d_strerror="$undef"
10556 d_syserrlst="$undef"
10557 d_strerrm='"unknown"'
28e8609d 10558 fi
2304df62
AD
10559fi
10560
a89d8a78
DH
10561: see if strtod exists
10562set strtod d_strtod
10563eval $inlibc
10564
10565: see if strtol exists
10566set strtol d_strtol
10567eval $inlibc
10568
10569: see if strtoul exists
10570set strtoul d_strtoul
10571eval $inlibc
10572
cf2093f6
JH
10573: see if strtoull exists
10574set strtoull d_strtoull
10575eval $inlibc
10576
a0d0e21e
LW
10577: see if strxfrm exists
10578set strxfrm d_strxfrm
10579eval $inlibc
10580
2304df62
AD
10581: see if symlink exists
10582set symlink d_symlink
10583eval $inlibc
10584
10585: see if syscall exists
10586set syscall d_syscall
10587eval $inlibc
10588
a0d0e21e
LW
10589: see if sysconf exists
10590set sysconf d_sysconf
10591eval $inlibc
10592
2304df62
AD
10593: see if system exists
10594set system d_system
10595eval $inlibc
10596
a0d0e21e
LW
10597: see if tcgetpgrp exists
10598set tcgetpgrp d_tcgetpgrp
10599eval $inlibc
10600
2c7991dc 10601: see if tcsetpgrp exists
10602set tcsetpgrp d_tcsetpgrp
10603eval $inlibc
4633a7c4 10604
cb86ce0e
JH
10605: see if sys/types.h has to be included
10606set sys/types.h i_systypes
10607eval $inhdr
10608
10609: see if prototype for telldir is available
10610echo " "
10611set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10612eval $hasproto
10613
2c7991dc 10614: define an is-a-typedef? function
10615typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10616case "$inclist" in
10617"") inclist="sys/types.h";;
10618esac;
10619eval "varval=\$$var";
10620case "$varval" in
10621"")
10622 $rm -f temp.c;
10623 for inc in $inclist; do
10624 echo "#include <$inc>" >>temp.c;
10625 done;
c4f23d77
AD
10626 echo "#ifdef $type" >> temp.c;
10627 echo "printf(\"We have $type\");" >> temp.c;
10628 echo "#endif" >> temp.c;
2c7991dc 10629 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10630 if $contains $type temp.E >/dev/null 2>&1; then
10631 eval "$var=\$type";
10632 else
10633 eval "$var=\$def";
10634 fi;
10635 $rm -f temp.?;;
10636*) eval "$var=\$varval";;
10637esac'
4633a7c4 10638
dc45a647
MB
10639: define an is-a-typedef? function that prompts if the type is not available.
10640typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10641case "$inclist" in
10642"") inclist="sys/types.h";;
10643esac;
10644eval "varval=\$$var";
10645case "$varval" in
10646"")
10647 $rm -f temp.c;
10648 for inc in $inclist; do
10649 echo "#include <$inc>" >>temp.c;
10650 done;
c4f23d77
AD
10651 echo "#ifdef $type" >> temp.c;
10652 echo "printf(\"We have $type\");" >> temp.c;
10653 echo "#endif" >> temp.c;
dc45a647
MB
10654 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10655 echo " " ;
10656 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10657 if $contains $type temp.E >/dev/null 2>&1; then
10658 echo "$type found." >&4;
10659 eval "$var=\$type";
10660 else
10661 echo "$type NOT found." >&4;
10662 dflt="$def";
10663 . ./myread ;
10664 eval "$var=\$ans";
10665 fi;
10666 $rm -f temp.?;;
10667*) eval "$var=\$varval";;
10668esac'
10669
2c7991dc 10670: see if this is a sys/times.h system
10671set sys/times.h i_systimes
10672eval $inhdr
4633a7c4 10673
2c7991dc 10674: see if times exists
4633a7c4 10675echo " "
2c7991dc 10676if set times val -f d_times; eval $csym; $val; then
10677 echo 'times() found.' >&4
10678 d_times="$define"
10679 inc=''
10680 case "$i_systimes" in
10681 "$define") inc='sys/times.h';;
10682 esac
dc45a647 10683 rp="What is the type returned by times() on this system?"
2c7991dc 10684 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 10685 eval $typedef_ask
2c7991dc 10686else
10687 echo 'times() NOT found, hope that will do.' >&4
10688 d_times="$undef"
10689 clocktype='int'
10690fi
2304df62 10691
2c7991dc 10692: see if truncate exists
10693set truncate d_truncate
10694eval $inlibc
2304df62 10695
2c7991dc 10696: see if tzname[] exists
10697echo " "
10698if set tzname val -a d_tzname; eval $csym; $val; then
10699 val="$define"
10700 echo 'tzname[] found.' >&4
10701else
10702 val="$undef"
10703 echo 'tzname[] NOT found.' >&4
10704fi
10705set d_tzname
10706eval $setvar
10707
10708: see if umask exists
10709set umask d_umask
10710eval $inlibc
85e6fe83 10711
4633a7c4
LW
10712: backward compatibility for d_hvfork
10713if test X$d_hvfork != X; then
10714 d_vfork="$d_hvfork"
10715 d_hvfork=''
10716fi
10717: see if there is a vfork
10718val=''
10719set vfork val
10720eval $inlibc
ecfc5424 10721
4633a7c4
LW
10722: Ok, but do we want to use it. vfork is reportedly unreliable in
10723: perl on Solaris 2.x, and probably elsewhere.
10724case "$val" in
10725$define)
16d20bd9 10726 echo " "
4633a7c4
LW
10727 case "$usevfork" in
10728 false) dflt='n';;
10729 *) dflt='y';;
10730 esac
f10488a3
JH
10731 cat <<'EOM'
10732
10733Perl can only use a vfork() that doesn't suffer from strict
10734restrictions on calling functions or modifying global data in
10735the child. For example, glibc-2.1 contains such a vfork()
10736that is unsuitable. If your system provides a proper fork()
10737call, chances are that you do NOT want perl to use vfork().
10738
10739EOM
10740 rp="Do you still want to use vfork()?"
4633a7c4
LW
10741 . ./myread
10742 case "$ans" in
10743 y|Y) ;;
10744 *)
10745 echo "Ok, we won't use vfork()."
10746 val="$undef"
10747 ;;
10748 esac
ecfc5424
AD
10749 ;;
10750esac
4633a7c4
LW
10751set d_vfork
10752eval $setvar
10753case "$d_vfork" in
10754$define) usevfork='true';;
10755*) usevfork='false';;
10756esac
ecfc5424 10757
4633a7c4
LW
10758: see if this is an sysdir system
10759set sys/dir.h i_sysdir
10760eval $inhdr
10761
10762: see if this is an sysndir system
10763set sys/ndir.h i_sysndir
10764eval $inhdr
10765
10766: see if closedir exists
10767set closedir d_closedir
10768eval $inlibc
10769
10770case "$d_closedir" in
10771"$define")
16d20bd9 10772 echo " "
4633a7c4
LW
10773 echo "Checking whether closedir() returns a status..." >&4
10774 cat > closedir.c <<EOM
10775#$i_dirent I_DIRENT /**/
10776#$i_sysdir I_SYS_DIR /**/
10777#$i_sysndir I_SYS_NDIR /**/
bfb7748a 10778#$i_systypes I_SYS_TYPES /**/
4633a7c4 10779
bfb7748a
AD
10780#if defined(I_SYS_TYPES)
10781#include <sys/types.h>
10782#endif
4633a7c4
LW
10783#if defined(I_DIRENT)
10784#include <dirent.h>
10785#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10786#include <sys/dir.h>
4aa0a1f7 10787#endif
4633a7c4
LW
10788#else
10789#ifdef I_SYS_NDIR
10790#include <sys/ndir.h>
10791#else
10792#ifdef I_SYS_DIR
10793#ifdef hp9000s500
10794#include <ndir.h> /* may be wrong in the future */
10795#else
10796#include <sys/dir.h>
10797#endif
10798#endif
10799#endif
10800#endif
10801int main() { return closedir(opendir(".")); }
10802EOM
dfe9444c 10803 set closedir
dc45a647 10804 if eval $compile_ok; then
4633a7c4
LW
10805 if ./closedir > /dev/null 2>&1 ; then
10806 echo "Yes, it does."
10807 val="$undef"
ecfc5424 10808 else
4633a7c4
LW
10809 echo "No, it doesn't."
10810 val="$define"
ecfc5424
AD
10811 fi
10812 else
4633a7c4
LW
10813 echo "(I can't seem to compile the test program--assuming it doesn't)"
10814 val="$define"
ecfc5424 10815 fi
ecfc5424 10816 ;;
4633a7c4
LW
10817*)
10818 val="$undef";
ecfc5424
AD
10819 ;;
10820esac
4633a7c4
LW
10821set d_void_closedir
10822eval $setvar
10823$rm -f closedir*
10824: check for volatile keyword
ecfc5424 10825echo " "
4633a7c4
LW
10826echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10827$cat >try.c <<'EOCP'
5a411a32 10828int main()
4633a7c4
LW
10829{
10830 typedef struct _goo_struct goo_struct;
10831 goo_struct * volatile goo = ((goo_struct *)0);
10832 struct _goo_struct {
10833 long long_int;
10834 int reg_int;
10835 char char_var;
10836 };
10837 typedef unsigned short foo_t;
10838 char *volatile foo;
10839 volatile int bar;
10840 volatile foo_t blech;
10841 foo = foo;
a0d0e21e
LW
10842}
10843EOCP
4633a7c4
LW
10844if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10845 val="$define"
10846 echo "Yup, it does."
10847else
10848 val="$undef"
10849 echo "Nope, it doesn't."
10850fi
10851set d_volatile
10852eval $setvar
10853$rm -f try.*
a0d0e21e 10854
4633a7c4
LW
10855: see if there is a wait4
10856set wait4 d_wait4
8e07c86e
AD
10857eval $inlibc
10858
4633a7c4
LW
10859: see if waitpid exists
10860set waitpid d_waitpid
10861eval $inlibc
10862
10863: see if wcstombs exists
10864set wcstombs d_wcstombs
10865eval $inlibc
10866
10867: see if wctomb exists
10868set wctomb d_wctomb
10869eval $inlibc
10870
de4597cb
JH
10871: see if writev exists
10872set writev d_writev
10873eval $inlibc
10874
4633a7c4
LW
10875: preserve RCS keywords in files with variable substitution, grrr
10876Date='$Date'
10877Id='$Id'
10878Log='$Log'
10879RCSfile='$RCSfile'
10880Revision='$Revision'
10881
ca8cfa54
JH
10882case "$crosscompile" in
10883''|[nN]*) crosscompile="$undef" ;;
10884esac
10885
10886case "$osname" in
8f1f23e8 10887next|rhapsody) multiarch="$define" ;;
ca8cfa54
JH
10888esac
10889case "$multiarch" in
10890''|[nN]*) multiarch="$undef" ;;
10891esac
10892
4633a7c4
LW
10893: check for alignment requirements
10894echo " "
68c15b6f
HM
10895case "$crosscompile$multiarch" in
10896*$define*)
ca8cfa54
JH
10897 $cat <<EOM
10898You seem to be either cross-compiling or doing a multiarchitecture build,
10899skipping the memory alignment check.
68c15b6f
HM
10900
10901EOM
10902 case "$alignbytes" in
10903 '') alignbytes=8 ;;
10904 esac
10905 ;;
10906*)
10907 case "$alignbytes" in
10908 '') echo "Checking alignment constraints..." >&4
10909 $cat >try.c <<'EOCP'
4633a7c4
LW
10910struct foobar {
10911 char foo;
10912 double bar;
732c9516 10913} try_algn;
d674cd6d 10914int main()
4633a7c4 10915{
732c9516 10916 printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
4633a7c4
LW
10917}
10918EOCP
68c15b6f
HM
10919 set try
10920 if eval $compile_ok; then
10921 dflt=`./try`
10922 else
10923 dflt='8'
10924 echo "(I can't seem to compile the test program...)"
10925 fi
10926 ;;
10927 *) dflt="$alignbytes"
10928 ;;
10929 esac
10930 rp="Doubles must be aligned on a how-many-byte boundary?"
10931 . ./myread
10932 alignbytes="$ans"
10933 $rm -f try.c try
8e07c86e 10934 ;;
ecfc5424 10935esac
68c15b6f 10936
85e6fe83 10937
4633a7c4 10938: check for ordering of bytes in a long
68c15b6f
HM
10939echo " "
10940case "$crosscompile$multiarch" in
10941*$define*)
10942 $cat <<EOM
ca8cfa54
JH
10943You seem to be either cross-compiling or doing a multiarchitecture build,
10944skipping the byteorder check.
68c15b6f
HM
10945
10946EOM
ca8cfa54 10947 byteorder=''
68c15b6f
HM
10948 ;;
10949*)
10950 case "$byteorder" in
10951 '')
10952 $cat <<'EOM'
4633a7c4
LW
10953In the following, larger digits indicate more significance. A big-endian
10954machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10955little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10956machines may have weird orders like 3412. A Cray will report 87654321. If
10957the test program works the default is probably right.
10958I'm now running the test program...
10959EOM
68c15b6f 10960 $cat >try.c <<'EOCP'
4633a7c4 10961#include <stdio.h>
d674cd6d 10962int main()
4633a7c4
LW
10963{
10964 int i;
10965 union {
10966 unsigned long l;
10967 char c[sizeof(long)];
10968 } u;
10969
10970 if (sizeof(long) > 4)
10971 u.l = (0x08070605L << 32) | 0x04030201L;
10972 else
10973 u.l = 0x04030201L;
10974 for (i = 0; i < sizeof(long); i++)
10975 printf("%c", u.c[i]+'0');
10976 printf("\n");
10977 exit(0);
10978}
10979EOCP
68c15b6f
HM
10980 xxx_prompt=y
10981 set try
10982 if eval $compile && ./try > /dev/null; then
10983 dflt=`./try`
10984 case "$dflt" in
10985 [1-4][1-4][1-4][1-4]|12345678|87654321)
10986 echo "(The test program ran ok.)"
10987 echo "byteorder=$dflt"
10988 xxx_prompt=n
4633a7c4 10989 ;;
68c15b6f
HM
10990 ????|????????) echo "(The test program ran ok.)" ;;
10991 *) echo "(The test program didn't run right for some reason.)" ;;
10992 esac
10993 else
10994 dflt='4321'
10995 cat <<'EOM'
4633a7c4
LW
10996(I can't seem to compile the test program. Guessing big-endian...)
10997EOM
68c15b6f
HM
10998 fi
10999 case "$xxx_prompt" in
11000 y)
11001 rp="What is the order of bytes in a long?"
11002 . ./myread
11003 byteorder="$ans"
11004 ;;
11005 *) byteorder=$dflt
11006 ;;
11007 esac
ecfc5424
AD
11008 ;;
11009 esac
68c15b6f 11010 $rm -f try.c try
ecfc5424
AD
11011 ;;
11012esac
68c15b6f 11013
85e6fe83 11014
4633a7c4 11015: how do we catenate cpp tokens here?
2304df62 11016echo " "
4633a7c4
LW
11017echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11018$cat >cpp_stuff.c <<'EOCP'
11019#define RCAT(a,b)a/**/b
11020#define ACAT(a,b)a ## b
11021RCAT(Rei,ser)
11022ACAT(Cir,cus)
11023EOCP
11024$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11025if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11026 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
11027 echo "We can catify or stringify, separately or together!"
11028 cpp_stuff=42
11029elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11030 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
11031 echo "However, in the good old days we don't know how to stringify and"
11032 echo "catify at the same time."
11033 cpp_stuff=1
11034else
11035 $cat >&4 <<EOM
11036Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
11037to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 11038EOM
4633a7c4
LW
11039 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11040fi
11041$rm -f cpp_stuff.*
a0d0e21e 11042
4633a7c4
LW
11043: see if this is a db.h system
11044set db.h i_db
11045eval $inhdr
11046
11047case "$i_db" in
68dc0745 11048$define)
1f70e1ea 11049 : Check db version.
68dc0745 11050 echo " "
11051 echo "Checking Berkeley DB version ..." >&4
11052 $cat >try.c <<EOCP
11053#$d_const HASCONST
11054#ifndef HASCONST
11055#define const
11056#endif
11057#include <sys/types.h>
11058#include <stdio.h>
11059#include <db.h>
d674cd6d 11060int main()
68dc0745 11061{
1f70e1ea
PM
11062#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11063 int Major, Minor, Patch ;
ee02776e 11064 unsigned long Version ;
1f70e1ea
PM
11065 (void)db_version(&Major, &Minor, &Patch) ;
11066 printf("You have Berkeley DB Version 2 or greater\n");
11067
11068 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11069 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11070 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11071 Major, Minor, Patch) ;
11072
11073 /* check that db.h & libdb are compatible */
11074 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11075 printf("db.h and libdb are incompatible\n") ;
11076 exit(3);
11077 }
11078
11079 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
11080
11081 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 11082 + DB_VERSION_PATCH ;
ee02776e
PM
11083
11084 /* needs to be >= 2.3.4 */
11085 if (Version < 2003004) {
693762b4 11086 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 11087 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
11088 exit(2);
11089 }
11090
11091 exit(0);
68dc0745 11092#else
6a1b87e5 11093#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 11094 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
11095 exit(0); /* DB version < 2: the coast is clear. */
11096#else
11097 exit(1); /* <db.h> not Berkeley DB? */
11098#endif
68dc0745 11099#endif
11100}
11101EOCP
dfe9444c
AD
11102 set try
11103 if eval $compile && ./try; then
1f70e1ea 11104 echo 'Looks OK.' >&4
68dc0745 11105 else
c90c0ff4 11106 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 11107 i_db=$undef
11108 case " $libs " in
11109 *"-ldb "*)
11110 : Remove db from list of libraries to use
11111 echo "Removing unusable -ldb from library list" >&4
11112 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11113 shift
11114 libs="$*"
11115 echo "libs = $libs" >&4
11116 ;;
11117 esac
11118 fi
11119 $rm -f try.*
11120 ;;
11121esac
11122
11123case "$i_db" in
4633a7c4 11124define)
dc45a647
MB
11125 : Check the return type needed for hash
11126 echo " "
11127 echo "Checking return type needed for hash for Berkeley DB ..." >&4
11128 $cat >try.c <<EOCP
11129#$d_const HASCONST
11130#ifndef HASCONST
11131#define const
11132#endif
11133#include <sys/types.h>
11134#include <db.h>
11135
11136#ifndef DB_VERSION_MAJOR
11137u_int32_t hash_cb (ptr, size)
11138const void *ptr;
11139size_t size;
11140{
11141}
11142HASHINFO info;
d674cd6d 11143int main()
dc45a647
MB
11144{
11145 info.hash = hash_cb;
11146}
11147#endif
11148EOCP
11149 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11150 if $contains warning try.out >>/dev/null 2>&1 ; then
11151 db_hashtype='int'
11152 else
11153 db_hashtype='u_int32_t'
11154 fi
11155 else
11156 : XXX Maybe we should just give up here.
11157 db_hashtype=u_int32_t
11158 $cat try.out >&4
11159 echo "Help: I can't seem to compile the db test program." >&4
11160 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11161 fi
11162 $rm -f try.*
11163 echo "Your version of Berkeley DB uses $db_hashtype for hash."
11164 ;;
11165*) db_hashtype=u_int32_t
11166 ;;
11167esac
11168case "$i_db" in
11169define)
4633a7c4
LW
11170 : Check the return type needed for prefix
11171 echo " "
11172 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11173 cat >try.c <<EOCP
11174#$d_const HASCONST
11175#ifndef HASCONST
11176#define const
11177#endif
11178#include <sys/types.h>
11179#include <db.h>
1f70e1ea
PM
11180
11181#ifndef DB_VERSION_MAJOR
4633a7c4
LW
11182size_t prefix_cb (key1, key2)
11183const DBT *key1;
11184const DBT *key2;
11185{
11186}
11187BTREEINFO info;
d674cd6d 11188int main()
4633a7c4
LW
11189{
11190 info.prefix = prefix_cb;
11191}
1f70e1ea 11192#endif
4633a7c4
LW
11193EOCP
11194 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11195 if $contains warning try.out >>/dev/null 2>&1 ; then
11196 db_prefixtype='int'
11197 else
11198 db_prefixtype='size_t'
11199 fi
11200 else
68dc0745 11201 db_prefixtype='size_t'
11202 : XXX Maybe we should just give up here.
dc45a647 11203 $cat try.out >&4
68dc0745 11204 echo "Help: I can't seem to compile the db test program." >&4
11205 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
11206 fi
11207 $rm -f try.*
11208 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 11209 ;;
68dc0745 11210*) db_prefixtype='size_t'
4633a7c4
LW
11211 ;;
11212esac
a0d0e21e 11213
4633a7c4
LW
11214: check for void type
11215echo " "
11216echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
11217case "$voidflags" in
11218'')
11219 $cat >try.c <<'EOCP'
11220#if TRY & 1
760ac839 11221void sub() {
4633a7c4 11222#else
760ac839 11223sub() {
4633a7c4
LW
11224#endif
11225 extern void moo(); /* function returning void */
11226 void (*goo)(); /* ptr to func returning void */
11227#if TRY & 8
11228 void *hue; /* generic ptr */
11229#endif
11230#if TRY & 2
11231 void (*foo[10])();
11232#endif
a0d0e21e 11233
4633a7c4
LW
11234#if TRY & 4
11235 if(goo == moo) {
11236 exit(0);
11237 }
11238#endif
11239 exit(0);
11240}
d674cd6d 11241int main() { sub(); }
4633a7c4 11242EOCP
760ac839 11243 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 11244 voidflags=$defvoidused
bfb7748a 11245 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
11246 if $contains warning .out >/dev/null 2>&1; then
11247 echo "However, you might get some warnings that look like this:"
11248 $cat .out
11249 fi
11250 else
11251echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 11252 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 11253 echo "It supports 1..."
760ac839 11254 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 11255 echo "It also supports 2..."
760ac839 11256 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
11257 voidflags=7
11258 echo "And it supports 4 but not 8 definitely."
11259 else
11260 echo "It doesn't support 4..."
760ac839 11261 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
11262 voidflags=11
11263 echo "But it supports 8."
11264 else
11265 voidflags=3
11266 echo "Neither does it support 8."
11267 fi
11268 fi
11269 else
11270 echo "It does not support 2..."
760ac839 11271 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
11272 voidflags=13
11273 echo "But it supports 4 and 8."
11274 else
760ac839 11275 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
11276 voidflags=5
11277 echo "And it supports 4 but has not heard about 8."
11278 else
11279 echo "However it supports 8 but not 4."
11280 fi
11281 fi
11282 fi
11283 else
11284 echo "There is no support at all for void."
11285 voidflags=0
11286 fi
11287 fi
11288esac
4633a7c4 11289case "$voidflags" in
2c7991dc 11290"$defvoidused") ;;
bfb7748a
AD
11291*) $cat >&4 <<'EOM'
11292 Support flag bits are:
11293 1: basic void declarations.
11294 2: arrays of pointers to functions returning void.
11295 4: operations between pointers to and addresses of void functions.
11296 8: generic void pointers.
11297EOM
2c7991dc 11298 dflt="$voidflags";
4633a7c4 11299 rp="Your void support flags add up to what?"
a0d0e21e 11300 . ./myread
4633a7c4 11301 voidflags="$ans"
a0d0e21e
LW
11302 ;;
11303esac
4633a7c4 11304$rm -f try.* .out
a0d0e21e 11305
85ab1d1d
JH
11306
11307: How can we generate normalized random numbers ?
693762b4 11308echo " "
de4597cb 11309echo "Looking for a random number function..." >&4
85ab1d1d 11310case "$randfunc" in
693762b4 11311'')
85ab1d1d
JH
11312 if set drand48 val -f; eval $csym; $val; then
11313 dflt="drand48"
11314 echo "Good, found drand48()." >&4
11315 elif set random val -f; eval $csym; $val; then
11316 dflt="random"
11317 echo "OK, found random()." >&4
11318 else
11319 dflt="rand"
11320 echo "Yick, looks like I have to use rand()." >&4
11321 fi
11322 echo " "
11323 ;;
11324*)
11325 dflt="$randfunc"
11326 ;;
11327esac
11328cont=true
11329
11330case "$ccflags" in
11331*-Dmy_rand=*|*-Dmy_srand=*)
11332 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11333 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11334 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11335 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11336 ;;
11337esac
11338
11339while $test "$cont"; do
11340 rp="Use which function to generate random numbers?"
11341 . ./myread
11342 if $test "$ans" = "$dflt"; then
11343 : null
11344 else
11345 randbits=''
11346 fi
11347 randfunc="$ans"
11348 if set $ans val -f; eval $csym; $val; then
11349 cont=''
11350 else
ef4af2be
JH
11351 dflt=y
11352 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
11353 . ./myread
11354 dflt=rand
11355 case "$ans" in
11356 [yY]*) cont='';;
11357 esac
11358 fi
11359 case "$cont" in
11360 '')
11361 case "$randfunc" in
11362 drand48)
11363 drand01="drand48()"
11364 seedfunc="srand48"
11365 randbits=48
11366 randseedtype=long
11367 ;;
11368 rand|random)
11369 case "$randbits" in
11370 '')
11371echo "Checking to see how many bits your $randfunc() function produces..." >&4
11372 $cat >try.c <<EOCP
11373#$i_unistd I_UNISTD
11374#$i_stdlib I_STDLIB
693762b4 11375#include <stdio.h>
85ab1d1d
JH
11376#ifdef I_UNISTD
11377# include <unistd.h>
11378#endif
11379#ifdef I_STDLIB
11380# include <stdlib.h>
11381#endif
d674cd6d 11382int main()
693762b4 11383{
85ab1d1d
JH
11384 register int i;
11385 register unsigned long tmp;
11386 register unsigned long max = 0L;
11387
11388 for (i = 1000; i; i--) {
11389 tmp = (unsigned long) $randfunc();
11390 if (tmp > max) max = tmp;
11391 }
11392 for (i = 0; max; i++)
11393 max /= 2;
11394 printf("%d\n",i);
693762b4
AD
11395}
11396EOCP
85ab1d1d
JH
11397 set try
11398 if eval $compile_ok; then
11399 dflt=`try`
11400 else
11401 dflt='?'
11402 echo "(I can't seem to compile the test program...)"
11403 fi
11404 ;;
11405 *)
11406 dflt="$randbits"
11407 ;;
11408 esac
11409 rp="How many bits does your $randfunc() function produce?"
11410 . ./myread
11411 randbits="$ans"
11412 $rm -f try.c try
11413 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11414 seedfunc="s$randfunc"
11415 randseedtype=unsigned
11416 ;;
11417 *)
11418 dflt="31"
11419 rp="How many bits does your $randfunc() function produce?"
11420 . ./myread
11421 randbits="$ans"
11422 seedfunc="s$randfunc"
11423 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11424 if set $seedfunc val -f; eval $csym; $val; then
11425 echo "(Using $seedfunc() to seed random generator)"
11426 else
11427 echo "(Warning: no $seedfunc() to seed random generator)"
11428 seedfunc=rand
11429 fi
11430 randseedtype=unsigned
11431 ;;
11432 esac
11433 ;;
11434 esac
11435done
693762b4 11436
5ff3f7a4
GS
11437echo " "
11438echo "Determining whether or not we are on an EBCDIC system..." >&4
11439$cat >tebcdic.c <<'EOM'
11440int main()
11441{
11442 if ('M'==0xd4) return 0;
11443 return 1;
11444}
11445EOM
11446
11447val=$undef
11448set tebcdic
11449if eval $compile_ok; then
11450 if ./tebcdic; then
11451 echo "You have EBCDIC." >&4
11452 val="$define"
11453 else
5cf1d1f1 11454 echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin, or UTF." >&4
5ff3f7a4
GS
11455 fi
11456else
5cc3184f 11457 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
11458 echo "I'll assume ASCII or some ISO Latin." >&4
11459fi
11460$rm -f tebcdic.c tebcdic
11461set ebcdic
11462eval $setvar
11463
29209bc5 11464echo " "
767df6a1
JH
11465$cat >&4 <<EOM
11466Checking how to flush all pending stdio output...
66fe083f 11467EOM
d2201af2
AD
11468# I only know how to find the first 32 possibly open files on SunOS.
11469# See also hints/sunos_4_1.sh and util.c --AD
11470case "$osname" in
11471sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11472esac
11473$cat >>try.c <<EOCP
66fe083f 11474#include <stdio.h>
d2201af2 11475#$i_unistd I_UNISTD
767df6a1 11476#ifdef I_UNISTD
a32a45b6 11477# include <unistd.h>
767df6a1
JH
11478#endif
11479#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
11480#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11481#ifdef HAS_STDIO_STREAM_ARRAY
11482# define STDIO_STREAM_ARRAY $stdio_stream_array
11483#endif
66fe083f
JH
11484int main() {
11485 FILE* p = fopen("try.out", "w");
0f27ced1 11486#ifdef TRY_FPUTC
66fe083f 11487 fputc('x', p);
0f27ced1
JH
11488#else
11489# ifdef TRY_FPRINTF
11490 fprintf(p, "x");
11491# endif
11492#endif
767df6a1 11493#ifdef TRY_FFLUSH_NULL
66fe083f 11494 fflush(NULL);
767df6a1
JH
11495#endif
11496#ifdef TRY_FFLUSH_ALL
11497 {
11498 long open_max = -1;
d2201af2
AD
11499# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11500 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 11501# else
d2201af2
AD
11502# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11503 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 11504# else
4b257aef 11505# ifdef FOPEN_MAX
d2201af2 11506 open_max = FOPEN_MAX;
767df6a1 11507# else
d2201af2
AD
11508# ifdef OPEN_MAX
11509 open_max = OPEN_MAX;
11510# else
11511# ifdef _NFILE
11512 open_max = _NFILE;
11513# endif
767df6a1
JH
11514# endif
11515# endif
11516# endif
4b257aef 11517# endif
ed39a0f2 11518# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
11519 if (open_max > 0) {
11520 long i;
11521 for (i = 0; i < open_max; i++)
d2201af2
AD
11522 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11523 STDIO_STREAM_ARRAY[i]._file < open_max &&
11524 STDIO_STREAM_ARRAY[i]._flag)
11525 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
11526 }
11527 }
ed39a0f2 11528# endif
767df6a1
JH
11529#endif
11530 _exit(42);
66fe083f
JH
11531}
11532EOCP
0f27ced1
JH
11533: first we have to find out how _not_ to flush
11534if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11535 output=''
11536 set try -DTRY_FPUTC
6626660c 11537 if eval $compile; then
4b257aef 11538 $rm -f try.out
0f27ced1
JH
11539 ./try$exe_ext 2>/dev/null
11540 if $test ! -s try.out -a "X$?" = X42; then
11541 output=-DTRY_FPUTC
11542 fi
11543 fi
11544 case "$output" in
11545 '')
11546 set try -DTRY_FPRINTF
11547 $rm -f try.out
6626660c 11548 if eval $compile; then
4b257aef 11549 $rm -f try.out
0f27ced1
JH
11550 ./try$exe_ext 2>/dev/null
11551 if $test ! -s try.out -a "X$?" = X42; then
11552 output=-DTRY_FPRINTF
11553 fi
11554 fi
11555 ;;
11556 esac
11557fi
767df6a1
JH
11558: check for fflush NULL behaviour
11559case "$fflushNULL" in
0f27ced1 11560'') set try -DTRY_FFLUSH_NULL $output
6626660c 11561 if eval $compile; then
4b257aef 11562 $rm -f try.out
196fa3d2 11563 ./try$exe_ext 2>/dev/null
a32a45b6
JH
11564 code="$?"
11565 if $test -s try.out -a "X$code" = X42; then
c2fddd50 11566 fflushNULL="`$cat try.out`"
a32a45b6
JH
11567 else
11568 if $test "X$code" != X42; then
11569 $cat >&4 <<EOM
11570(If this test failed, don't worry, we'll try another method shortly.)
11571EOM
11572 fi
c2fddd50
JH
11573 fi
11574 fi
0f27ced1 11575 $rm -f core try.core core.try.*
c2fddd50 11576 case "$fflushNULL" in
6626660c 11577 x) $cat >&4 <<EOM
66fe083f
JH
11578Your fflush(NULL) works okay.
11579EOM
ed39a0f2 11580 fflushNULL="$define"
c2fddd50 11581 ;;
6626660c 11582 '') $cat >&4 <<EOM
66fe083f
JH
11583Your fflush(NULL) isn't working (contrary to ANSI C).
11584EOM
ed39a0f2 11585 fflushNULL="$undef"
c2fddd50 11586 ;;
6626660c 11587 *) $cat >&4 <<EOM
66fe083f
JH
11588Cannot figure out whether your fflush(NULL) works or not.
11589I'm assuming it doesn't (contrary to ANSI C).
11590EOM
ed39a0f2 11591 fflushNULL="$undef"
c2fddd50
JH
11592 ;;
11593 esac
66fe083f
JH
11594 ;;
11595$define|true|[yY]*)
ed39a0f2 11596 fflushNULL="$define"
66fe083f
JH
11597 ;;
11598*)
ed39a0f2 11599 fflushNULL="$undef"
66fe083f
JH
11600 ;;
11601esac
a32a45b6
JH
11602: check explicit looping only if NULL did not work
11603case "$fflushNULL" in
11604"$undef")
11605 : check for fflush all behaviour
11606 case "$fflushall" in
11607 '') set try -DTRY_FFLUSH_ALL $output
a32a45b6 11608 if eval $compile; then
4b257aef 11609 $cat >&4 <<EOM
a32a45b6 11610(Now testing the other method--but note that also this may fail.)
a71cd7cd 11611EOM
4b257aef 11612 $rm -f try.out
a32a45b6
JH
11613 ./try$exe_ext 2>/dev/null
11614 if $test -s try.out -a "X$?" = X42; then
11615 fflushall="`$cat try.out`"
11616 fi
767df6a1 11617 fi
a32a45b6
JH
11618 $rm -f core try.core core.try.*
11619 case "$fflushall" in
11620 x) $cat >&4 <<EOM
11621Whew. Flushing explicitly all the stdio streams works.
767df6a1 11622EOM
a32a45b6
JH
11623 fflushall="$define"
11624 ;;
11625 '') $cat >&4 <<EOM
11626Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 11627EOM
a32a45b6
JH
11628 fflushall="$undef"
11629 ;;
11630 *) $cat >&4 <<EOM
6626660c 11631Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
11632I'm assuming it doesn't.
11633EOM
a32a45b6
JH
11634 fflushall="$undef"
11635 ;;
11636 esac
767df6a1 11637 ;;
a32a45b6
JH
11638 "$define"|true|[yY]*)
11639 fflushall="$define"
11640 ;;
11641 *)
11642 fflushall="$undef"
6626660c
JH
11643 ;;
11644 esac
767df6a1 11645 ;;
a32a45b6 11646*) fflushall="$undef"
767df6a1
JH
11647 ;;
11648esac
11649case "$fflushNULL$fflushall" in
11650undefundef)
6626660c 11651 $cat <<EOM
767df6a1
JH
11652I cannot figure out how to flush pending stdio output.
11653EOM
11654 ;;
11655esac
11656$rm -f try.* try$exe_ext
66fe083f 11657
a0d0e21e 11658: see what type file positions are declared as in the library
a0d0e21e 11659rp="What is the type for file position used by fsetpos()?"
dc45a647
MB
11660set fpos_t fpostype long stdio.h sys/types.h
11661eval $typedef_ask
2304df62 11662
ccc7f9b3
KS
11663: Store the full pathname to the ar program for use in the C program
11664: Respect a hint or command line value for full_ar.
11665case "$full_ar" in
11666'') full_ar=$ar ;;
11667esac
11668
1aef975c
AD
11669: Store the full pathname to the sed program for use in the C program
11670full_sed=$sed
11671
2304df62 11672: see what type gids are declared as in the kernel
dc45a647
MB
11673echo " "
11674echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
11675set gid_t gidtype xxx stdio.h sys/types.h
11676eval $typedef
2304df62 11677case "$gidtype" in
a0d0e21e
LW
11678xxx)
11679 xxx=`./findhdr sys/user.h`
11680 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11681 case $1 in
11682 unsigned) dflt="$1 $2" ;;
11683 *) dflt="$1" ;;
11684 esac
2304df62 11685 ;;
a0d0e21e 11686*) dflt="$gidtype";;
2304df62 11687esac
dc45a647
MB
11688case "$gidtype" in
11689gid_t) echo "gid_t found." ;;
11690*) rp="What is the type for group ids returned by getgid()?"
11691 . ./myread
11692 gidtype="$ans"
11693 ;;
11694esac
a0d0e21e 11695
2304df62
AD
11696: see if getgroups exists
11697set getgroups d_getgrps
11698eval $inlibc
11699
5cd24f17 11700: see if setgroups exists
11701set setgroups d_setgrps
11702eval $inlibc
11703
dfe9444c 11704
8cc95fdb 11705: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
a0d0e21e 11706echo " "
5cd24f17 11707case "$d_getgrps$d_setgrps" in
11708*define*)
a0d0e21e 11709 case "$groupstype" in
2304df62
AD
11710 '') dflt="$gidtype" ;;
11711 *) dflt="$groupstype" ;;
a0d0e21e
LW
11712 esac
11713 $cat <<EOM
dc45a647 11714What type of pointer is the second argument to getgroups() and setgroups()?
5cd24f17 11715Usually this is the same as group ids, $gidtype, but not always.
2304df62
AD
11716
11717EOM
dc45a647 11718 rp='What type pointer is the second argument to getgroups() and setgroups()?'
a0d0e21e
LW
11719 . ./myread
11720 groupstype="$ans"
11721 ;;
11722*) groupstype="$gidtype";;
2304df62 11723esac
2304df62 11724
85e6fe83 11725: see what type lseek is declared as in the kernel
dc45a647 11726rp="What is the type used for lseek's offset on this system?"
a0d0e21e 11727set off_t lseektype long stdio.h sys/types.h
dc45a647 11728eval $typedef_ask
2304df62 11729
8ff267be 11730echo " "
5ff3f7a4
GS
11731$echo $n "Checking to see how big your file offsets are...$c" >&4
11732$cat >try.c <<EOCP
11733#include <sys/types.h>
11734#include <stdio.h>
5a411a32 11735int main()
5ff3f7a4
GS
11736{
11737 printf("%d\n", sizeof($lseektype));
11738}
11739EOCP
11740set try
11741if eval $compile_ok; then
11742 lseeksize=`./try`
11743 $echo " $lseeksize bytes." >&4
11744else
11745 dflt='4'
11746 echo " "
11747 echo "(I can't seem to compile the test program. Guessing...)"
11748 rp="What is the size of your file offsets (in bytes)?"
11749 . ./myread
11750 lseeksize="$ans"
11751fi
11752$rm -f try.c try
11753
11754echo " "
dfe9444c 11755echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 11756case "$make_set_make" in
11757'')
11758 $sed 's/^X //' > testmake.mak << 'EOF'
11759Xall:
dfe9444c 11760X @echo 'maketemp="$(MAKE)"'
8ff267be 11761EOF
8ff267be 11762 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 11763 *maketemp=*) make_set_make='#' ;;
8ff267be 11764 *) make_set_make="MAKE=$make" ;;
11765 esac
dfe9444c
AD
11766 $rm -f testmake.mak
11767 ;;
11768esac
11769case "$make_set_make" in
11770'#') echo "Yup, it does.";;
11771*) echo "Nope, it doesn't.";;
11772esac
11773
11774: see what type is used for mode_t
dc45a647 11775rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 11776set mode_t modetype int stdio.h sys/types.h
dc45a647 11777eval $typedef_ask
dfe9444c 11778
dfe9444c
AD
11779: define a fucntion to check prototypes
11780$cat > protochk <<EOSH
11781$startsh
11782cc="$cc"
11783optimize="$optimize"
11784ccflags="$ccflags"
11785prototype="$prototype"
11786define="$define"
11787rm=$rm
11788EOSH
11789
11790$cat >> protochk <<'EOSH'
11791
11792$rm -f try.c
11793foo="$1"
11794shift
11795while test $# -ge 2; do
11796 case "$1" in
11797 $define) echo "#include <$2>" >> try.c ;;
11798 literal) echo "$2" >> try.c ;;
11799 esac
11800 shift 2
11801done
11802test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
11803cat >> try.c <<'EOCP'
11804#ifdef CAN_PROTOTYPE
11805#define _(args) args
11806#else
11807#define _(args) ()
11808#endif
11809EOCP
11810echo "$foo" >> try.c
11811echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11812$cc $optimize $ccflags -c try.c > /dev/null 2>&1
11813status=$?
11814$rm -f try.[co]
11815exit $status
11816EOSH
11817chmod +x protochk
11818$eunicefix protochk
11819
dfe9444c 11820: see what type is used for size_t
dc45a647 11821rp="What is the type used for the length parameter for string functions?"
dfe9444c 11822set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 11823eval $typedef_ask
dfe9444c
AD
11824
11825: check for type of arguments to gethostbyaddr.
11826if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11827 case "$d_gethbyaddr" in
11828 $define)
11829 $cat <<EOM
11830
11831Checking to see what type of arguments are accepted by gethostbyaddr().
11832EOM
11833 hdrs="$define sys/types.h
11834 $d_socket sys/socket.h
11835 $i_niin netinet/in.h
11836 $i_netdb netdb.h
11837 $i_unistd unistd.h"
11838 : The first arg can 'char *' or 'void *'
11839 : The second arg is some of integral type
11840 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11841 for yyy in size_t long int; do
11842 case "$netdb_host_type" in
11843 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11844 if ./protochk "$try" $hdrs; then
11845 echo "Your system accepts $xxx for the first arg."
11846 echo "...and $yyy for the second arg."
11847 netdb_host_type="$xxx"
11848 netdb_hlen_type="$yyy"
11849 fi
11850 ;;
11851 esac
11852 done
11853 done
11854 : In case none of those worked, prompt the user.
11855 case "$netdb_host_type" in
11856 '') rp='What is the type for the 1st argument to gethostbyaddr?'
11857 dflt='char *'
11858 . ./myread
11859 netdb_host_type=$ans
11860 rp='What is the type for the 2nd argument to gethostbyaddr?'
11861 dflt="$sizetype"
11862 . ./myread
11863 netdb_hlen_type=$ans
11864 ;;
11865 esac
11866 ;;
11867 *) : no gethostbyaddr, so pick harmless defaults
11868 netdb_host_type='char *'
11869 netdb_hlen_type="$sizetype"
11870 ;;
11871 esac
11872 # Remove the "const" if needed. -- but then we'll have a
11873 # prototype clash!
11874 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11875fi
11876
11877: check for type of argument to gethostbyname.
11878if test "X$netdb_name_type" = X ; then
11879 case "$d_gethbyname" in
11880 $define)
11881 $cat <<EOM
11882
11883Checking to see what type of argument is accepted by gethostbyname().
11884EOM
11885 hdrs="$define sys/types.h
11886 $d_socket sys/socket.h
11887 $i_niin netinet/in.h
11888 $i_netdb netdb.h
11889 $i_unistd unistd.h"
11890 for xxx in "const char *" "char *"; do
11891 case "$netdb_name_type" in
11892 '') try="extern struct hostent *gethostbyname($xxx);"
11893 if ./protochk "$try" $hdrs; then
11894 echo "Your system accepts $xxx."
11895 netdb_name_type="$xxx"
11896 fi
11897 ;;
11898 esac
11899 done
11900 : In case none of those worked, prompt the user.
11901 case "$netdb_name_type" in
11902 '') rp='What is the type for the 1st argument to gethostbyname?'
11903 dflt='char *'
11904 . ./myread
11905 netdb_name_type=$ans
11906 ;;
11907 esac
11908 ;;
11909 *) : no gethostbyname, so pick harmless default
11910 netdb_name_type='char *'
11911 ;;
11912 esac
11913fi
8ff267be 11914
dfe9444c
AD
11915: check for type of 1st argument to getnetbyaddr.
11916if test "X$netdb_net_type" = X ; then
11917 case "$d_getnbyaddr" in
11918 $define)
11919 $cat <<EOM
85e6fe83 11920
dfe9444c
AD
11921Checking to see what type of 1st argument is accepted by getnetbyaddr().
11922EOM
11923 hdrs="$define sys/types.h
11924 $d_socket sys/socket.h
11925 $i_niin netinet/in.h
11926 $i_netdb netdb.h
11927 $i_unistd unistd.h"
11928 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11929 case "$netdb_net_type" in
11930 '') try="extern struct netent *getnetbyaddr($xxx, int);"
11931 if ./protochk "$try" $hdrs; then
11932 echo "Your system accepts $xxx."
11933 netdb_net_type="$xxx"
11934 fi
11935 ;;
11936 esac
11937 done
11938 : In case none of those worked, prompt the user.
11939 case "$netdb_net_type" in
11940 '') rp='What is the type for the 1st argument to getnetbyaddr?'
11941 dflt='long'
11942 . ./myread
11943 netdb_net_type=$ans
11944 ;;
11945 esac
11946 ;;
11947 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 11948 netdb_net_type='long'
dfe9444c
AD
11949 ;;
11950 esac
11951fi
2c7991dc 11952: locate the preferred pager for this system
11953case "$pager" in
11954'')
11955 dflt=''
11956 case "$pg" in
11957 /*) dflt=$pg;;
11958 esac
11959 case "$more" in
11960 /*) dflt=$more;;
11961 esac
11962 case "$less" in
11963 /*) dflt=$less;;
11964 esac
11965 case "$dflt" in
11966 '') dflt=/usr/ucb/more;;
11967 esac
11968 ;;
11969*) dflt="$pager";;
11970esac
11971echo " "
11972fn=f/
11973rp='What pager is used on your system?'
11974. ./getfile
11975pager="$ans"
11976
dfe9444c 11977: see what type pids are declared as in the kernel
dc45a647 11978rp="What is the type of process ids on this system?"
dfe9444c 11979set pid_t pidtype int stdio.h sys/types.h
dc45a647 11980eval $typedef_ask
2304df62 11981
693762b4
AD
11982: check for length of pointer
11983echo " "
11984case "$ptrsize" in
11985'')
dc45a647 11986 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
11987 if test "$voidflags" -gt 7; then
11988 echo '#define VOID_PTR char *' > try.c
11989 else
11990 echo '#define VOID_PTR void *' > try.c
11991 fi
11992 $cat >>try.c <<'EOCP'
11993#include <stdio.h>
d674cd6d 11994int main()
693762b4
AD
11995{
11996 printf("%d\n", sizeof(VOID_PTR));
11997 exit(0);
11998}
11999EOCP
12000 set try
dc45a647 12001 if eval $compile_ok; then
693762b4 12002 ptrsize=`./try`
dc45a647 12003 $echo " $ptrsize bytes." >&4
693762b4
AD
12004 else
12005 dflt='4'
12006 echo "(I can't seem to compile the test program. Guessing...)" >&4
12007 rp="What is the size of a pointer (in bytes)?"
12008 . ./myread
12009 ptrsize="$ans"
12010 fi
12011 ;;
12012esac
12013$rm -f try.c try
12014
a0d0e21e
LW
12015: see if ar generates random libraries by itself
12016echo " "
12017echo "Checking how to generate random libraries on your machine..." >&4
12018echo 'int bar1() { return bar2(); }' > bar1.c
12019echo 'int bar2() { return 2; }' > bar2.c
12020$cat > foo.c <<'EOP'
d674cd6d 12021int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
12022EOP
12023$cc $ccflags -c bar1.c >/dev/null 2>&1
12024$cc $ccflags -c bar2.c >/dev/null 2>&1
12025$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
12026$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12027if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12028 ./foobar >/dev/null 2>&1; then
4e2a5f63 12029 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
12030 orderlib=false
12031 ranlib=":"
dfe9444c
AD
12032elif $ar ts bar$_a >/dev/null 2>&1 &&
12033 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 12034 ./foobar >/dev/null 2>&1; then
4e2a5f63 12035 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 12036 orderlib=false
dfe9444c 12037 ranlib="$ar ts"
a0d0e21e 12038else
ecfc5424
AD
12039 case "$ranlib" in
12040 :) ranlib='';;
12041 '')
12042 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12043 $test -f $ranlib || ranlib=''
12044 ;;
12045 esac
a0d0e21e 12046 if $test -n "$ranlib"; then
ecfc5424 12047 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
12048 orderlib=false
12049 else
12050 echo "your system doesn't seem to support random libraries"
12051 echo "so we'll use lorder and tsort to order the libraries."
12052 orderlib=true
12053 ranlib=":"
12054 fi
12055fi
12056$rm -f foo* bar*
12057
dfe9444c
AD
12058: check for type of arguments to select.
12059case "$selecttype" in
12060'') case "$d_select" in
12061 $define)
12062 $cat <<EOM
12063Checking to see what type of arguments are accepted by select().
12064EOM
12065 hdrs="$define sys/types.h
12066 $i_systime sys/time.h
12067 $i_sysselct sys/select.h
12068 $d_socket sys/socket.h"
12069 : The first arg can be int, unsigned, or size_t
12070 : The last arg may or may not be 'const'
12071 val=''
7f3d1cf1
BH
12072 : void pointer has been seen but using that
12073 : breaks the selectminbits test
12074 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 12075 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
12076 for tmo in 'struct timeval *' 'const struct timeval *'; do
12077 case "$val" in
12078 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12079 if ./protochk "$try" $hdrs; then
12080 echo "Your system accepts $xxx."
12081 val="$xxx"
12082 fi
12083 ;;
12084 esac
12085 done
12086 done
12087 done
12088 case "$val" in
12089 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12090 case "$d_fd_set" in
12091 $define) dflt="fd_set *" ;;
12092 *) dflt="int *" ;;
12093 esac
12094 . ./myread
12095 val=$ans
12096 ;;
a0d0e21e 12097 esac
dfe9444c 12098 selecttype="$val"
a0d0e21e 12099 ;;
dfe9444c
AD
12100 *) : no select, so pick a harmless default
12101 selecttype='int *'
a0d0e21e
LW
12102 ;;
12103 esac
a0d0e21e
LW
12104 ;;
12105esac
2304df62 12106
5ff3f7a4
GS
12107: check for the select 'width'
12108case "$selectminbits" in
12109'') case "$d_select" in
12110 $define)
12111 $cat <<EOM
12112
85ab1d1d 12113Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
12114EOM
12115 $cat >try.c <<EOCP
12116#include <sys/types.h>
12117#$i_time I_TIME
12118#$i_systime I_SYS_TIME
12119#$i_systimek I_SYS_TIME_KERNEL
12120#ifdef I_TIME
12121# include <time.h>
12122#endif
12123#ifdef I_SYS_TIME
12124# ifdef I_SYS_TIME_KERNEL
12125# define KERNEL
12126# endif
12127# include <sys/time.h>
12128# ifdef I_SYS_TIME_KERNEL
12129# undef KERNEL
12130# endif
12131#endif
12132#$i_sysselct I_SYS_SELECT
12133#ifdef I_SYS_SELECT
12134#include <sys/select.h>
12135#endif
bd628c73
AD
12136#$d_socket HAS_SOCKET
12137#ifdef HAS_SOCKET
12138# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12139#endif
5ff3f7a4 12140#include <stdio.h>
fb164848
JH
12141$selecttype b;
12142#define S sizeof(*(b))
5ff3f7a4
GS
12143#define MINBITS 64
12144#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12145#define NBITS (NBYTES * 8)
12146int main() {
12147 char s[NBYTES];
5ff3f7a4
GS
12148 struct timeval t;
12149 int i;
12150 FILE* fp;
12151 int fd;
12152
12153 fclose(stdin);
12154 fp = fopen("try.c", "r");
12155 if (fp == 0)
12156 exit(1);
12157 fd = fileno(fp);
12158 if (fd < 0)
12159 exit(2);
12160 b = ($selecttype)s;
12161 for (i = 0; i < NBITS; i++)
12162 FD_SET(i, b);
12163 t.tv_sec = 0;
12164 t.tv_usec = 0;
12165 select(fd + 1, b, 0, 0, &t);
12166 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12167 printf("%d\n", i + 1);
12168 return 0;
12169}
12170EOCP
12171 set try
12172 if eval $compile_ok; then
12173 selectminbits=`./try`
85ab1d1d 12174 case "$selectminbits" in
fb164848
JH
12175 '') cat >&4 <<EOM
12176Cannot figure out on how many bits at a time your select() operates.
12177I'll play safe and guess it is 32 bits.
12178EOM
12179 selectminbits=32
12180 bits="32 bits"
12181 ;;
85ab1d1d
JH
12182 1) bits="1 bit" ;;
12183 *) bits="$selectminbits bits" ;;
12184 esac
12185 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
12186 else
12187 rp='What is the minimum number of bits your select() operates on?'
12188 case "$byteorder" in
12189 1234|12345678) dflt=32 ;;
12190 *) dflt=1 ;;
12191 esac
12192 . ./myread
12193 val=$ans
12194 selectminbits="$val"
12195 fi
12196 $rm -f try.* try
12197 ;;
12198 *) : no select, so pick a harmless default
12199 selectminbits='32'
12200 ;;
12201 esac
12202 ;;
12203esac
12204
8e07c86e
AD
12205: Trace out the files included by signal.h, then look for SIGxxx names.
12206: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
12207: Remove SIGSTKSIZE used by Linux.
12208: Remove SIGSTKSZ used by Posix.
4633a7c4 12209: Remove SIGTYP void lines used by OS2.
8e07c86e
AD
12210xxx=`echo '#include <signal.h>' |
12211 $cppstdin $cppminus $cppflags 2>/dev/null |
12212 $grep '^[ ]*#.*include' |
12213 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12214: Check this list of files to be sure we have parsed the cpp output ok.
12215: This will also avoid potentially non-existent files, such
12216: as ../foo/bar.h
12217xxxfiles=''
12218for xx in $xxx /dev/null ; do
12219 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12220done
12221: If we have found no files, at least try signal.h
12222case "$xxxfiles" in
12223'') xxxfiles=`./findhdr signal.h` ;;
12224esac
12225xxx=`awk '
af4c28eb 12226$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
12227 print substr($2, 4, 20)
12228}
4633a7c4 12229$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
12230 print substr($3, 4, 20)
12231}' $xxxfiles`
12232: Append some common names just in case the awk scan failed.
12233xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12234xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12235xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12236xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12237: generate a few handy files for later
dc45a647 12238$cat > signal.c <<'EOCP'
4633a7c4
LW
12239#include <sys/types.h>
12240#include <signal.h>
dc45a647 12241#include <stdio.h>
4633a7c4 12242int main() {
760ac839
LW
12243
12244/* Strange style to avoid deeply-nested #if/#else/#endif */
12245#ifndef NSIG
12246# ifdef _NSIG
12247# define NSIG (_NSIG)
12248# endif
12249#endif
12250
12251#ifndef NSIG
12252# ifdef SIGMAX
12253# define NSIG (SIGMAX+1)
12254# endif
12255#endif
12256
12257#ifndef NSIG
12258# ifdef SIG_MAX
12259# define NSIG (SIG_MAX+1)
12260# endif
12261#endif
12262
12263#ifndef NSIG
12264# ifdef MAXSIG
12265# define NSIG (MAXSIG+1)
12266# endif
4633a7c4 12267#endif
760ac839
LW
12268
12269#ifndef NSIG
12270# ifdef MAX_SIG
12271# define NSIG (MAX_SIG+1)
12272# endif
12273#endif
12274
12275#ifndef NSIG
12276# ifdef SIGARRAYSIZE
12277# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12278# endif
12279#endif
12280
12281#ifndef NSIG
12282# ifdef _sys_nsig
12283# define NSIG (_sys_nsig) /* Solaris 2.5 */
12284# endif
12285#endif
12286
12287/* Default to some arbitrary number that's big enough to get most
12288 of the common signals.
12289*/
12290#ifndef NSIG
12291# define NSIG 50
4633a7c4 12292#endif
760ac839
LW
12293
12294printf("NSIG %d\n", NSIG);
12295
dc45a647
MB
12296#ifndef JUST_NSIG
12297
12298EOCP
12299
28e8609d 12300echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
12301{
12302 printf "#ifdef SIG"; printf $1; printf "\n"
12303 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12304 printf $1; printf ");\n"
12305 printf "#endif\n"
2304df62 12306}
2304df62 12307END {
dc45a647 12308 printf "#endif /* JUST_NSIG */\n";
8e07c86e 12309 printf "}\n";
2304df62 12310}
4633a7c4
LW
12311' >>signal.c
12312$cat >signal.awk <<'EOP'
12313BEGIN { ndups = 0 }
12314$1 ~ /^NSIG$/ { nsig = $2 }
12315($1 !~ /^NSIG$/) && (NF == 2) {
12316 if ($2 > maxsig) { maxsig = $2 }
12317 if (sig_name[$2]) {
12318 dup_name[ndups] = $1
12319 dup_num[ndups] = $2
12320 ndups++
12321 }
12322 else {
12323 sig_name[$2] = $1
12324 sig_num[$2] = $2
12325 }
4633a7c4
LW
12326}
12327END {
af4c28eb
CS
12328 if (nsig == 0) {
12329 nsig = maxsig + 1
12330 }
12331 printf("NSIG %d\n", nsig);
12332 for (n = 1; n < nsig; n++) {
12333 if (sig_name[n]) {
12334 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 12335 }
af4c28eb
CS
12336 else {
12337 printf("NUM%d %d\n", n, n)
12338 }
12339 }
4633a7c4 12340 for (n = 0; n < ndups; n++) {
af4c28eb 12341 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
12342 }
12343}
12344EOP
12345$cat >signal_cmd <<EOS
8e07c86e 12346$startsh
dc45a647
MB
12347if $test -s signal.lst; then
12348 echo "Using your existing signal.lst file"
12349 exit 0
12350fi
12351xxx="$xxx"
12352EOS
12353$cat >>signal_cmd <<'EOS'
12354
12355set signal
12356if eval $compile_ok; then
dfe9444c 12357 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 12358else
dc45a647
MB
12359 echo "(I can't seem be able to compile the whole test program)" >&4
12360 echo "(I'll try it in little pieces.)" >&4
12361 set signal -DJUST_NSIG
12362 if eval $compile_ok; then
12363 ./signal$_exe > signal.nsg
12364 $cat signal.nsg
12365 else
12366 echo "I can't seem to figure out how many signals you have." >&4
12367 echo "Guessing 50." >&4
12368 echo 'NSIG 50' > signal.nsg
12369 fi
12370 : Now look at all the signal names, one at a time.
28e8609d 12371 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
12372 $cat > signal.c <<EOCP
12373#include <sys/types.h>
12374#include <signal.h>
12375#include <stdio.h>
12376int main() {
12377printf("$xx %d\n", SIG${xx});
12378return 0;
12379}
12380EOCP
12381 set signal
12382 if eval $compile; then
12383 echo "SIG${xx} found."
12384 ./signal$_exe >> signal.ls1
12385 else
12386 echo "SIG${xx} NOT found."
12387 fi
12388 done
12389 if $test -s signal.ls1; then
12390 $cat signal.nsg signal.ls1 |
12391 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12392 fi
12393
12394fi
12395if $test -s signal.lst; then
12396 :
12397else
12398 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 12399 echo 'kill -l' >signal
dc45a647 12400 set X `csh -f <signal`
8e07c86e 12401 $rm -f signal
2304df62 12402 shift
dc45a647 12403 case $# in
8e07c86e 12404 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 12405 esac
28e8609d 12406 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
12407 $awk '{ printf "%s %d\n", $1, ++s; }
12408 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 12409fi
dc45a647 12410$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 12411EOS
4633a7c4
LW
12412chmod a+x signal_cmd
12413$eunicefix signal_cmd
8e07c86e
AD
12414
12415: generate list of signal names
12416echo " "
dfe9444c 12417case "$sig_name_init" in
6626bf4c
JH
12418'') doinit=yes ;;
12419*) case "$sig_num_init" in
12420 ''|*,*) doinit=yes ;;
12421 esac ;;
12422esac
12423case "$doinit" in
12424yes)
4633a7c4 12425 echo "Generating a list of signal names and numbers..." >&4
dc45a647 12426 . ./signal_cmd
af4c28eb
CS
12427 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12428 sig_name=`$awk 'BEGIN { printf "ZERO " }
12429 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12430 sig_num=`$awk 'BEGIN { printf "0 " }
12431 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12432 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
12433 !/^NSIG/ { printf "\"%s\", ", $1 }
12434 END { printf "0\n" }' signal.lst`
12435 sig_num_init=`$awk 'BEGIN { printf "0, " }
12436 !/^NSIG/ { printf "%d, ", $2}
12437 END { printf "0\n"}' signal.lst`
12438 ;;
12439esac
12440echo "The following $sig_count signals are available:"
a0d0e21e
LW
12441echo " "
12442echo $sig_name | $awk \
12443'BEGIN { linelen = 0 }
12444{
8e07c86e 12445 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
12446 name = "SIG" $i " "
12447 linelen = linelen + length(name)
12448 if (linelen > 70) {
12449 printf "\n"
12450 linelen = length(name)
12451 }
12452 printf "%s", name
12453 }
8e07c86e 12454 printf "\n"
a0d0e21e 12455}'
4633a7c4 12456$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 12457
a0d0e21e
LW
12458: see what type is used for signed size_t
12459set ssize_t ssizetype int stdio.h sys/types.h
12460eval $typedef
12461dflt="$ssizetype"
12462$cat > ssize.c <<EOM
12463#include <stdio.h>
12464#include <sys/types.h>
12465#define Size_t $sizetype
12466#define SSize_t $dflt
d674cd6d 12467int main()
a0d0e21e
LW
12468{
12469 if (sizeof(Size_t) == sizeof(SSize_t))
12470 printf("$dflt\n");
12471 else if (sizeof(Size_t) == sizeof(int))
12472 printf("int\n");
12473 else
12474 printf("long\n");
760ac839 12475 exit(0);
a0d0e21e
LW
12476}
12477EOM
12478echo " "
dfe9444c 12479set ssize
dc45a647 12480if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 12481 ssizetype=`./ssize`
a0d0e21e
LW
12482 echo "I'll be using $ssizetype for functions returning a byte count." >&4
12483else
24fef2a7 12484 $cat >&4 <<EOM
24fef2a7
AD
12485Help! I can't compile and run the ssize_t test program: please enlighten me!
12486(This is probably a misconfiguration in your system or libraries, and
12487you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
12488
12489I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 12490be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
12491
12492EOM
12493 rp="What signed type is the same size as $sizetype?"
12494 . ./myread
12495 ssizetype="$ans"
12496fi
dfe9444c 12497$rm -f ssize ssize.*
3fd537d4 12498
a0d0e21e
LW
12499: see what type of char stdio uses.
12500echo " "
12501if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12502 echo "Your stdio uses unsigned chars." >&4
12503 stdchar="unsigned char"
12504else
12505 echo "Your stdio uses signed chars." >&4
12506 stdchar="char"
12507fi
12508
12509: see if time exists
12510echo " "
28e8609d
JH
12511if test "X$d_time" = X -o X"$timetype" = X; then
12512 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
12513 echo 'time() found.' >&4
12514 val="$define"
12515 rp="What is the type returned by time() on this system?"
12516 set time_t timetype long stdio.h sys/types.h
12517 eval $typedef_ask
28e8609d 12518 else
5ff3f7a4
GS
12519 echo 'time() not found, hope that will do.' >&4
12520 val="$undef"
12521 timetype='int';
28e8609d
JH
12522 fi
12523 set d_time
12524 eval $setvar
a0d0e21e 12525fi
a0d0e21e
LW
12526
12527: see what type uids are declared as in the kernel
dc45a647
MB
12528echo " "
12529echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
12530set uid_t uidtype xxx stdio.h sys/types.h
12531eval $typedef
12532case "$uidtype" in
12533xxx)
12534 xxx=`./findhdr sys/user.h`
12535 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12536 case $1 in
12537 unsigned) dflt="$1 $2" ;;
12538 *) dflt="$1" ;;
12539 esac
12540 ;;
4633a7c4
LW
12541*) dflt="$uidtype";;
12542esac
dc45a647
MB
12543case "$uidtype" in
12544uid_t) echo "uid_t found." ;;
12545*) rp="What is the type for user ids returned by getuid()?"
12546 . ./myread
12547 uidtype="$ans"
12548 ;;
12549esac
4633a7c4
LW
12550
12551: see if dbm.h is available
12552: see if dbmclose exists
12553set dbmclose d_dbmclose
12554eval $inlibc
12555
12556case "$d_dbmclose" in
12557$define)
12558 set dbm.h i_dbm
12559 eval $inhdr
5f80c64f
JH
12560 case "$i_dbm" in
12561 $define)
12562 val="$undef"
12563 set i_rpcsvcdbm
12564 eval $setvar
12565 ;;
12566 *) set rpcsvc/dbm.h i_rpcsvcdbm
12567 eval $inhdr
12568 ;;
12569 esac
12570 ;;
12571*) echo "We won't be including <dbm.h>"
12572 val="$undef"
12573 set i_dbm
12574 eval $setvar
12575 val="$undef"
12576 set i_rpcsvcdbm
12577 eval $setvar
12578 ;;
12579esac
12580
12581: see if this is a sys/file.h system
12582val=''
12583set sys/file.h val
12584eval $inhdr
12585
12586: do we need to include sys/file.h ?
12587case "$val" in
12588"$define")
12589 echo " "
12590 if $h_sysfile; then
12591 val="$define"
12592 echo "We'll be including <sys/file.h>." >&4
12593 else
12594 val="$undef"
12595 echo "We won't be including <sys/file.h>." >&4
12596 fi
12597 ;;
12598*)
12599 h_sysfile=false
12600 ;;
12601esac
12602set i_sysfile
12603eval $setvar
12604
12605: see if fcntl.h is there
12606val=''
12607set fcntl.h val
12608eval $inhdr
12609
12610: see if we can include fcntl.h
12611case "$val" in
12612"$define")
12613 echo " "
12614 if $h_fcntl; then
12615 val="$define"
12616 echo "We'll be including <fcntl.h>." >&4
12617 else
12618 val="$undef"
12619 if $h_sysfile; then
12620 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12621 else
12622 echo "We won't be including <fcntl.h>." >&4
12623 fi
12624 fi
12625 ;;
12626*)
12627 h_fcntl=false
12628 val="$undef"
12629 ;;
12630esac
12631set i_fcntl
12632eval $setvar
12633
12634: see if locale.h is available
12635set locale.h i_locale
12636eval $inhdr
12637
7f3d1cf1 12638: see if mach cthreads are available
13666627
JH
12639if test "X$usethreads" = "X$define"; then
12640 set mach/cthreads.h i_machcthr
12641 eval $inhdr
12642else
12643 i_machcthr="$undef"
12644fi
12645
12646
7f3d1cf1 12647
5f80c64f
JH
12648: see if this is a math.h system
12649set math.h i_math
12650eval $inhdr
12651
e7fb4fcc
JH
12652: see if this is a mntent.h system
12653set mntent.h i_mntent
12654eval $inhdr
12655
5f80c64f
JH
12656: see if ndbm.h is available
12657set ndbm.h t_ndbm
12658eval $inhdr
12659case "$t_ndbm" in
12660$define)
12661 : see if dbm_open exists
12662 set dbm_open d_dbm_open
12663 eval $inlibc
12664 case "$d_dbm_open" in
12665 $undef)
12666 t_ndbm="$undef"
12667 echo "We won't be including <ndbm.h>"
12668 ;;
12669 esac
12670 ;;
12671esac
12672val="$t_ndbm"
12673set i_ndbm
12674eval $setvar
12675
12676: see if net/errno.h is available
12677val=''
12678set net/errno.h val
12679eval $inhdr
12680
12681: Unfortunately, it causes problems on some systems. Arrgh.
12682case "$val" in
12683$define)
12684 cat > try.c <<'EOM'
12685#include <stdio.h>
12686#include <errno.h>
12687#include <net/errno.h>
12688int func()
12689{
12690 return ENOTSOCK;
12691}
12692EOM
12693 if $cc $ccflags -c try.c >/dev/null 2>&1; then
12694 echo "We'll be including <net/errno.h>." >&4
12695 else
12696 echo "We won't be including <net/errno.h>." >&4
12697 val="$undef"
12698 fi
12699 $rm -f try.* try
12700 ;;
12701esac
12702set i_neterrno
12703eval $setvar
12704
9cc6feab
JH
12705: see if netinet/tcp.h is available
12706set netinet/tcp.h i_netinettcp
12707eval $inhdr
12708
5b34fd99
JH
12709: see if this is a poll.h system
12710set poll.h i_poll
12711eval $inhdr
12712
5f80c64f
JH
12713: get C preprocessor symbols handy
12714echo " "
12715$echo $n "Hmm... $c"
12716echo $al | $tr ' ' $trnl >Cppsym.know
12717$cat <<EOSS >Cppsym
12718$startsh
12719case "\$1" in
12720-l) list=true
12721 shift
12722 ;;
12723esac
12724unknown=''
12725case "\$list\$#" in
127261|2)
12727 for sym do
12728 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12729 exit 0
12730 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12731 :
12732 else
12733 unknown="\$unknown \$sym"
12734 fi
12735 done
12736 set X \$unknown
12737 shift
12738 ;;
12739esac
12740case \$# in
127410) exit 1;;
12742esac
12743echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12744#ifdef \1\\
12745exit 0; _ _ _ _\1\\ \1\\
12746#endif\\
12747/' >Cppsym\$\$
12748echo "exit 1; _ _ _" >>Cppsym\$\$
12749$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
12750case "\$list" in
12751true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12752*)
12753 sh Cppsym2\$\$
12754 status=\$?
12755 ;;
12756esac
12757$rm -f Cppsym\$\$ Cppsym2\$\$
12758exit \$status
12759EOSS
12760chmod +x Cppsym
12761$eunicefix Cppsym
12762./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12763
12764: now check the C compiler for additional symbols
c4747d3e
JH
12765postprocess_cc_v=''
12766case "$osname" in
12767aix) postprocess_cc_v="|$tr , ' '" ;;
12768esac
5f80c64f
JH
12769$cat >ccsym <<EOS
12770$startsh
12771$cat >tmp.c <<EOF
12772extern int foo;
12773EOF
c4747d3e 12774for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
12775do
12776 case "\$i" in
12777 -D*) echo "\$i" | $sed 's/^-D//';;
12778 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12779 esac
12780done
12781$rm -f try.c
12782EOS
2000072c 12783postprocess_cc_v=''
5f80c64f
JH
12784chmod +x ccsym
12785$eunicefix ccsym
12786./ccsym > ccsym1.raw
12787if $test -s ccsym1.raw; then
12788 $sort ccsym1.raw | $uniq >ccsym.raw
12789else
12790 mv ccsym1.raw ccsym.raw
12791fi
12792
12793$awk '/\=/ { print $0; next }
12794 { print $0"=1" }' ccsym.raw >ccsym.list
12795$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12796$comm -13 ccsym.true ccsym.list >ccsym.own
12797$comm -12 ccsym.true ccsym.list >ccsym.com
12798$comm -23 ccsym.true ccsym.list >ccsym.cpp
12799also=''
5f80c64f 12800if $test -z ccsym.raw; then
ff49bff8 12801 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 12802 echo " "
ff49bff8 12803 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 12804 $cat Cppsym.true
ff49bff8
JH
12805 ccsymbols=''
12806 cppsymbols=`$cat Cppsym.true`
918c3d21 12807 cppsymbols=`echo $cppsymbols`
ff49bff8 12808 cppccsymbols="$cppsymbols"
5f80c64f
JH
12809else
12810 if $test -s ccsym.com; then
12811 echo "Your C compiler and pre-processor define these symbols:"
12812 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12813 also='also '
12814 symbols='ones'
ff49bff8 12815 cppccsymbols=`$cat ccsym.com`
918c3d21 12816 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
12817 $test "$silent" || sleep 1
12818 fi
12819 if $test -s ccsym.cpp; then
12820 $test "$also" && echo " "
ff49bff8 12821 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
12822 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12823 also='further '
ff49bff8 12824 cppsymbols=`$cat ccsym.cpp`
918c3d21 12825 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
12826 $test "$silent" || sleep 1
12827 fi
12828 if $test -s ccsym.own; then
12829 $test "$also" && echo " "
ff49bff8 12830 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
12831 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12832 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 12833 ccsymbols=`$cat ccsym.own`
918c3d21 12834 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
12835 $test "$silent" || sleep 1
12836 fi
12837fi
12838$rm -f ccsym*
12839
12840: see if this is a termio system
12841val="$undef"
12842val2="$undef"
12843val3="$undef"
12844if $test `./findhdr termios.h`; then
12845 set tcsetattr i_termios
12846 eval $inlibc
12847 val3="$i_termios"
12848fi
12849echo " "
12850case "$val3" in
12851"$define") echo "You have POSIX termios.h... good!" >&4;;
12852*) if ./Cppsym pyr; then
12853 case "`/bin/universe`" in
12854 ucb) if $test `./findhdr sgtty.h`; then
12855 val2="$define"
12856 echo "<sgtty.h> found." >&4
12857 else
12858 echo "System is pyramid with BSD universe."
12859 echo "<sgtty.h> not found--you could have problems." >&4
12860 fi;;
12861 *) if $test `./findhdr termio.h`; then
12862 val="$define"
12863 echo "<termio.h> found." >&4
12864 else
12865 echo "System is pyramid with USG universe."
12866 echo "<termio.h> not found--you could have problems." >&4
12867 fi;;
12868 esac
12869 elif ./usg; then
12870 if $test `./findhdr termio.h`; then
12871 echo "<termio.h> found." >&4
12872 val="$define"
12873 elif $test `./findhdr sgtty.h`; then
12874 echo "<sgtty.h> found." >&4
12875 val2="$define"
12876 else
12877echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12878 fi
12879 else
12880 if $test `./findhdr sgtty.h`; then
12881 echo "<sgtty.h> found." >&4
12882 val2="$define"
12883 elif $test `./findhdr termio.h`; then
12884 echo "<termio.h> found." >&4
12885 val="$define"
12886 else
12887echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12888 fi
12889 fi;;
12890esac
12891set i_termio; eval $setvar
12892val=$val2; set i_sgtty; eval $setvar
12893val=$val3; set i_termios; eval $setvar
12894
f1066039
JH
12895: see if this is a shadow.h system
12896set shadow.h i_shadow
12897eval $inhdr
12898
86959918
JH
12899: see if this is a socks.h system
12900set socks.h i_socks
12901eval $inhdr
12902
5f80c64f
JH
12903: see if stdarg is available
12904echo " "
12905if $test `./findhdr stdarg.h`; then
12906 echo "<stdarg.h> found." >&4
12907 valstd="$define"
12908else
12909 echo "<stdarg.h> NOT found." >&4
12910 valstd="$undef"
12911fi
12912
12913: see if varags is available
12914echo " "
12915if $test `./findhdr varargs.h`; then
12916 echo "<varargs.h> found." >&4
12917else
12918 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12919fi
12920
12921: set up the varargs testing programs
12922$cat > varargs.c <<EOP
12923#ifdef I_STDARG
12924#include <stdarg.h>
12925#endif
12926#ifdef I_VARARGS
12927#include <varargs.h>
12928#endif
12929
12930#ifdef I_STDARG
12931int f(char *p, ...)
12932#else
12933int f(va_alist)
12934va_dcl
12935#endif
12936{
12937 va_list ap;
12938#ifndef I_STDARG
12939 char *p;
12940#endif
12941#ifdef I_STDARG
12942 va_start(ap,p);
12943#else
12944 va_start(ap);
12945 p = va_arg(ap, char *);
12946#endif
12947 va_end(ap);
12948}
12949EOP
12950$cat > varargs <<EOP
12951$startsh
12952if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12953 echo "true"
12954else
12955 echo "false"
12956fi
12957$rm -f varargs$_o
12958EOP
12959chmod +x varargs
12960
12961: now check which varargs header should be included
12962echo " "
12963i_varhdr=''
12964case "$valstd" in
12965"$define")
12966 if `./varargs I_STDARG`; then
12967 val='stdarg.h'
12968 elif `./varargs I_VARARGS`; then
12969 val='varargs.h'
12970 fi
12971 ;;
12972*)
12973 if `./varargs I_VARARGS`; then
12974 val='varargs.h'
12975 fi
12976 ;;
12977esac
12978case "$val" in
12979'')
12980echo "I could not find the definition for va_dcl... You have problems..." >&4
12981 val="$undef"; set i_stdarg; eval $setvar
12982 val="$undef"; set i_varargs; eval $setvar
12983 ;;
12984*)
12985 set i_varhdr
12986 eval $setvar
12987 case "$i_varhdr" in
12988 stdarg.h)
12989 val="$define"; set i_stdarg; eval $setvar
12990 val="$undef"; set i_varargs; eval $setvar
12991 ;;
12992 varargs.h)
12993 val="$undef"; set i_stdarg; eval $setvar
12994 val="$define"; set i_varargs; eval $setvar
12995 ;;
12996 esac
12997 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12998esac
12999$rm -f varargs*
13000
13001: see if stddef is available
13002set stddef.h i_stddef
13003eval $inhdr
13004
13005: see if sys/access.h is available
13006set sys/access.h i_sysaccess
13007eval $inhdr
13008
13009: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13010set sys/filio.h i_sysfilio
13011eval $inhdr
13012echo " "
13013if $test `./findhdr sys/ioctl.h`; then
13014 val="$define"
13015 echo '<sys/ioctl.h> found.' >&4
13016else
13017 val="$undef"
13018 if $test $i_sysfilio = "$define"; then
13019 echo '<sys/ioctl.h> NOT found.' >&4
13020 else
13021 $test $i_sgtty = "$define" && xxx="sgtty.h"
13022 $test $i_termio = "$define" && xxx="termio.h"
13023 $test $i_termios = "$define" && xxx="termios.h"
13024echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13025 fi
13026fi
13027set i_sysioctl
13028eval $setvar
13029
5f80c64f
JH
13030: see if sys/resource.h has to be included
13031set sys/resource.h i_sysresrc
13032eval $inhdr
13033
13034: see if sys/security.h is available
13035set sys/security.h i_syssecrt
13036eval $inhdr
13037
104d25b7
JH
13038: see if this is a sys/statvfs.h system
13039set sys/statvfs.h i_sysstatvfs
13040eval $inhdr
13041
5f80c64f
JH
13042: see if this is a sys/un.h system
13043set sys/un.h i_sysun
13044eval $inhdr
13045
13046: see if this is a syswait system
13047set sys/wait.h i_syswait
13048eval $inhdr
13049
13050: see if this is an utime system
13051set utime.h i_utime
13052eval $inhdr
13053
13054: see if this is a values.h system
13055set values.h i_values
13056eval $inhdr
13057
13058: see if this is a vfork system
13059case "$d_vfork" in
13060"$define")
13061 set vfork.h i_vfork
13062 eval $inhdr
13063 ;;
13064*)
13065 i_vfork="$undef"
13066 ;;
13067esac
13068
13069: see if gdbm.h is available
13070set gdbm.h t_gdbm
13071eval $inhdr
13072case "$t_gdbm" in
13073$define)
13074 : see if gdbm_open exists
13075 set gdbm_open d_gdbm_open
13076 eval $inlibc
13077 case "$d_gdbm_open" in
13078 $undef)
13079 t_gdbm="$undef"
13080 echo "We won't be including <gdbm.h>"
13081 ;;
13082 esac
13083 ;;
13084esac
13085val="$t_gdbm"
13086set i_gdbm
13087eval $setvar
13088
13089echo " "
13090echo "Looking for extensions..." >&4
5f80c64f
JH
13091: If we are using the old config.sh, known_extensions may contain
13092: old or inaccurate or duplicate values.
13093known_extensions=''
13094nonxs_extensions=''
13095: We do not use find because it might not be available.
13096: We do not just use MANIFEST because the user may have dropped
13097: some additional extensions into the source tree and expect them
13098: to be built.
7e791ca9
NK
13099
13100: Function to recursively find available extensions, ignoring DynaLoader
13101: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13102find_extensions='
13103 for xxx in *; do
13104 case "$xxx" in
13105 DynaLoader|dynaload) ;;
13106 *)
13107 if $test -f $xxx/$xxx.xs; then
13108 known_extensions="$known_extensions $1$xxx";
13109 elif $test -f $xxx/Makefile.PL; then
13110 nonxs_extensions="$nonxs_extensions $1$xxx";
13111 else
13112 if $test -d $xxx -a $# -lt 10; then
13113 set $1$xxx/ $*;
13114 cd $xxx;
13115 eval $find_extensions;
13116 cd ..;
13117 shift;
9f50e519 13118 fi;
7e791ca9
NK
13119 fi
13120 ;;
9f50e519 13121 esac;
7e791ca9
NK
13122 done'
13123tdir=`pwd`
13124cd $rsrc/ext
a3635516 13125set X
efdb23e1 13126shift
7e791ca9 13127eval $find_extensions
5f80c64f
JH
13128set X $nonxs_extensions
13129shift
13130nonxs_extensions="$*"
13131set X $known_extensions
13132shift
13133known_extensions="$*"
13134cd $tdir
13135
13136: Now see which are supported on this system.
13137avail_ext=''
13138for xxx in $known_extensions ; do
13139 case "$xxx" in
13140 DB_File|db_file)
13141 case "$i_db" in
13142 $define) avail_ext="$avail_ext $xxx" ;;
13143 esac
13144 ;;
13145 GDBM_File|gdbm_fil)
13146 case "$i_gdbm" in
13147 $define) avail_ext="$avail_ext $xxx" ;;
13148 esac
13149 ;;
13150 NDBM_File|ndbm_fil)
13151 case "$i_ndbm" in
13152 $define) avail_ext="$avail_ext $xxx" ;;
13153 esac
13154 ;;
13155 ODBM_File|odbm_fil)
13156 case "${i_dbm}${i_rpcsvcdbm}" in
13157 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13158 esac
13159 ;;
13160 POSIX|posix)
13161 case "$useposix" in
13162 true|define|y) avail_ext="$avail_ext $xxx" ;;
13163 esac
13164 ;;
13165 Opcode|opcode)
13166 case "$useopcode" in
13167 true|define|y) avail_ext="$avail_ext $xxx" ;;
13168 esac
13169 ;;
13170 Socket|socket)
13171 case "$d_socket" in
13172 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13173 esac
13174 ;;
13175 Thread|thread)
13176 case "$usethreads" in
13177 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13178 esac
13179 ;;
13180 IPC/SysV|ipc/sysv)
13181 : XXX Do we need a useipcsysv variable here
13182 case "${d_msg}${d_sem}${d_shm}" in
13183 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13184 esac
13185 ;;
13186 *) avail_ext="$avail_ext $xxx"
13187 ;;
13188 esac
13189done
13190
13191set X $avail_ext
13192shift
13193avail_ext="$*"
13194
13195: Now see which nonxs extensions are supported on this system.
13196: For now assume all are.
13197nonxs_ext=''
13198for xxx in $nonxs_extensions ; do
13199 case "$xxx" in
13200 *) nonxs_ext="$nonxs_ext $xxx"
13201 ;;
13202 esac
13203done
13204
13205set X $nonxs_ext
13206shift
13207nonxs_ext="$*"
13208
13209case $usedl in
13210$define)
13211 $cat <<EOM
13212A number of extensions are supplied with $package. You may choose to
13213compile these extensions for dynamic loading (the default), compile
13214them into the $package executable (static loading), or not include
13215them at all. Answer "none" to include no extensions.
13216Note that DynaLoader is always built and need not be mentioned here.
13217
13218EOM
13219 case "$dynamic_ext" in
13220 '') dflt="$avail_ext" ;;
13221 *) dflt="$dynamic_ext"
13222 # Perhaps we are reusing an old out-of-date config.sh.
13223 case "$hint" in
13224 previous)
13225 if test X"$dynamic_ext" != X"$avail_ext"; then
13226 $cat <<EOM
13227NOTICE: Your previous config.sh list may be incorrect.
13228The extensions now available to you are
13229 ${avail_ext}
13230but the default list from your previous config.sh is
13231 ${dynamic_ext}
13232
13233EOM
13234 fi
13235 ;;
13236 esac
13237 ;;
13238 esac
13239 case "$dflt" in
13240 '') dflt=none;;
13241 esac
13242 rp="What extensions do you wish to load dynamically?"
13243 . ./myread
13244 case "$ans" in
13245 none) dynamic_ext=' ' ;;
13246 *) dynamic_ext="$ans" ;;
13247 esac
13248
13249 case "$static_ext" in
13250 '')
13251 : Exclude those already listed in dynamic linking
13252 dflt=''
13253 for xxx in $avail_ext; do
13254 case " $dynamic_ext " in
13255 *" $xxx "*) ;;
13256 *) dflt="$dflt $xxx" ;;
13257 esac
13258 done
13259 set X $dflt
13260 shift
13261 dflt="$*"
13262 ;;
13263 *) dflt="$static_ext"
13264 ;;
13265 esac
13266
13267 case "$dflt" in
13268 '') dflt=none;;
13269 esac
13270 rp="What extensions do you wish to load statically?"
13271 . ./myread
13272 case "$ans" in
13273 none) static_ext=' ' ;;
13274 *) static_ext="$ans" ;;
13275 esac
13276 ;;
13277*)
13278 $cat <<EOM
13279A number of extensions are supplied with $package. Answer "none"
13280to include no extensions.
13281Note that DynaLoader is always built and need not be mentioned here.
13282
13283EOM
13284 case "$static_ext" in
13285 '') dflt="$avail_ext" ;;
13286 *) dflt="$static_ext"
13287 # Perhaps we are reusing an old out-of-date config.sh.
13288 case "$hint" in
13289 previous)
13290 if test X"$static_ext" != X"$avail_ext"; then
13291 $cat <<EOM
13292NOTICE: Your previous config.sh list may be incorrect.
13293The extensions now available to you are
13294 ${avail_ext}
13295but the default list from your previous config.sh is
13296 ${static_ext}
13297
13298EOM
13299 fi
13300 ;;
13301 esac
13302 ;;
13303 esac
13304 : Exclude those that are not xs extensions
13305 case "$dflt" in
13306 '') dflt=none;;
13307 esac
13308 rp="What extensions do you wish to include?"
13309 . ./myread
13310 case "$ans" in
13311 none) static_ext=' ' ;;
13312 *) static_ext="$ans" ;;
13313 esac
13314 ;;
13315esac
13316
13317set X $dynamic_ext $static_ext $nonxs_ext
13318shift
13319extensions="$*"
13320
13321: Remove build directory name from cppstdin so it can be used from
13322: either the present location or the final installed location.
13323echo " "
13324: Get out of the UU directory to get correct path name.
13325cd ..
13326case "$cppstdin" in
13327`pwd`/cppstdin)
13328 echo "Stripping down cppstdin path name"
13329 cppstdin=cppstdin
13330 ;;
13331esac
13332cd UU
13333
13334: end of configuration questions
13335echo " "
13336echo "End of configuration questions."
13337echo " "
13338
13339: back to where it started
13340if test -d ../UU; then
13341 cd ..
13342fi
13343
13344: configuration may be patched via a 'config.over' file
13345if $test -f config.over; then
13346 echo " "
13347 dflt=y
13348 rp='I see a config.over file. Do you wish to load it?'
13349 . UU/myread
13350 case "$ans" in
13351 n*) echo "OK, I'll ignore it.";;
13352 *) . ./config.over
13353 echo "Configuration override changes have been loaded."
13354 ;;
13355 esac
13356fi
13357
13358: in case they want portability, strip down executable paths
13359case "$d_portable" in
13360"$define")
13361 echo " "
13362 echo "Stripping down executable paths..." >&4
13363 for file in $loclist $trylist; do
13364 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
13365 eval $file="\$file"
13366 fi
13367 done
13368 ;;
13369esac
13370
13371: create config.sh file
13372echo " "
13373echo "Creating config.sh..." >&4
13374$spitshell <<EOT >config.sh
13375$startsh
13376#
13377# This file was produced by running the Configure script. It holds all the
13378# definitions figured out by Configure. Should you modify one of these values,
13379# do not forget to propagate your changes by running "Configure -der". You may
13380# instead choose to run each of the .SH files by yourself, or "Configure -S".
13381#
13382
13383# Package name : $package
13384# Source directory : $src
13385# Configuration time: $cf_time
13386# Configured by : $cf_by
13387# Target system : $myuname
13388
13389Author='$Author'
13390Date='$Date'
13391Header='$Header'
13392Id='$Id'
13393Locker='$Locker'
13394Log='$Log'
13395Mcc='$Mcc'
13396RCSfile='$RCSfile'
13397Revision='$Revision'
13398Source='$Source'
13399State='$State'
13400_a='$_a'
13401_exe='$_exe'
13402_o='$_o'
13403afs='$afs'
13404alignbytes='$alignbytes'
13405ansi2knr='$ansi2knr'
13406aphostname='$aphostname'
13407apiversion='$apiversion'
13408ar='$ar'
13409archlib='$archlib'
13410archlibexp='$archlibexp'
13411archname64='$archname64'
13412archname='$archname'
13413archobjs='$archobjs'
13414awk='$awk'
13415baserev='$baserev'
13416bash='$bash'
13417bin='$bin'
d71b2b6b 13418bincompat5005='$bincompat5005'
5f80c64f
JH
13419binexp='$binexp'
13420bison='$bison'
13421byacc='$byacc'
13422byteorder='$byteorder'
13423c='$c'
13424castflags='$castflags'
13425cat='$cat'
13426cc='$cc'
13427cccdlflags='$cccdlflags'
13428ccdlflags='$ccdlflags'
13429ccflags='$ccflags'
ff49bff8 13430ccsymbols='$ccsymbols'
5f80c64f
JH
13431cf_by='$cf_by'
13432cf_email='$cf_email'
13433cf_time='$cf_time'
13434chgrp='$chgrp'
13435chmod='$chmod'
13436chown='$chown'
13437clocktype='$clocktype'
13438comm='$comm'
13439compress='$compress'
13440contains='$contains'
13441cp='$cp'
13442cpio='$cpio'
13443cpp='$cpp'
13444cpp_stuff='$cpp_stuff'
ff49bff8 13445cppccsymbols='$cppccsymbols'
5f80c64f
JH
13446cppflags='$cppflags'
13447cpplast='$cpplast'
13448cppminus='$cppminus'
13449cpprun='$cpprun'
13450cppstdin='$cppstdin'
ff49bff8 13451cppsymbols='$cppsymbols'
68c15b6f 13452crosscompile='$crosscompile'
5f80c64f
JH
13453cryptlib='$cryptlib'
13454csh='$csh'
13455d_Gconvert='$d_Gconvert'
cf2093f6
JH
13456d_PRIEldbl='$d_PRIEldbl'
13457d_PRIFldbl='$d_PRIFldbl'
13458d_PRIGldbl='$d_PRIGldbl'
13459d_PRIX64='$d_PRIX64'
13460d_PRId64='$d_PRId64'
13461d_PRIeldbl='$d_PRIeldbl'
13462d_PRIfldbl='$d_PRIfldbl'
13463d_PRIgldbl='$d_PRIgldbl'
13464d_PRIi64='$d_PRIi64'
13465d_PRIo64='$d_PRIo64'
13466d_PRIu64='$d_PRIu64'
13467d_PRIx64='$d_PRIx64'
5f80c64f
JH
13468d_access='$d_access'
13469d_accessx='$d_accessx'
13470d_alarm='$d_alarm'
13471d_archlib='$d_archlib'
cf2093f6
JH
13472d_atolf='$d_atolf'
13473d_atoll='$d_atoll'
5f80c64f
JH
13474d_attribut='$d_attribut'
13475d_bcmp='$d_bcmp'
13476d_bcopy='$d_bcopy'
d71b2b6b 13477d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
13478d_bsd='$d_bsd'
13479d_bsdgetpgrp='$d_bsdgetpgrp'
13480d_bsdsetpgrp='$d_bsdsetpgrp'
13481d_bzero='$d_bzero'
13482d_casti32='$d_casti32'
13483d_castneg='$d_castneg'
13484d_charvspr='$d_charvspr'
13485d_chown='$d_chown'
13486d_chroot='$d_chroot'
13487d_chsize='$d_chsize'
13488d_closedir='$d_closedir'
de4597cb 13489d_cmsghdr_s='$d_cmsghdr_s'
5f80c64f
JH
13490d_const='$d_const'
13491d_crypt='$d_crypt'
13492d_csh='$d_csh'
13493d_cuserid='$d_cuserid'
13494d_dbl_dig='$d_dbl_dig'
13495d_dbmclose64='$d_dbmclose64'
13496d_dbminit64='$d_dbminit64'
13497d_delete64='$d_delete64'
13498d_difftime='$d_difftime'
de4597cb 13499d_dirent64_s='$d_dirent64_s'
5f80c64f
JH
13500d_dirnamlen='$d_dirnamlen'
13501d_dlerror='$d_dlerror'
13502d_dlopen='$d_dlopen'
13503d_dlsymun='$d_dlsymun'
13504d_dosuid='$d_dosuid'
13505d_drand48proto='$d_drand48proto'
13506d_dup2='$d_dup2'
13507d_eaccess='$d_eaccess'
13508d_endgrent='$d_endgrent'
13509d_endhent='$d_endhent'
13510d_endnent='$d_endnent'
13511d_endpent='$d_endpent'
13512d_endpwent='$d_endpwent'
13513d_endsent='$d_endsent'
f1066039 13514d_endspent='$d_endspent'
5f80c64f
JH
13515d_eofnblk='$d_eofnblk'
13516d_eunice='$d_eunice'
13517d_fchmod='$d_fchmod'
13518d_fchown='$d_fchown'
13519d_fcntl='$d_fcntl'
13520d_fd_macros='$d_fd_macros'
13521d_fd_set='$d_fd_set'
13522d_fds_bits='$d_fds_bits'
13523d_fetch64='$d_fetch64'
13524d_fgetpos64='$d_fgetpos64'
13525d_fgetpos='$d_fgetpos'
13526d_firstkey64='$d_firstkey64'
13527d_flexfnam='$d_flexfnam'
de4597cb 13528d_flock64_s='$d_flock64_s'
5f80c64f
JH
13529d_flock='$d_flock'
13530d_fopen64='$d_fopen64'
13531d_fork='$d_fork'
13532d_fpathconf='$d_fpathconf'
13533d_freopen64='$d_freopen64'
13534d_fseek64='$d_fseek64'
13535d_fseeko64='$d_fseeko64'
13536d_fseeko='$d_fseeko'
13537d_fsetpos64='$d_fsetpos64'
13538d_fsetpos='$d_fsetpos'
13539d_fstat64='$d_fstat64'
104d25b7
JH
13540d_fstatfs='$d_fstatfs'
13541d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
13542d_ftell64='$d_ftell64'
13543d_ftello64='$d_ftello64'
13544d_ftello='$d_ftello'
13545d_ftime='$d_ftime'
13546d_ftruncate64='$d_ftruncate64'
13547d_getgrent='$d_getgrent'
13548d_getgrps='$d_getgrps'
13549d_gethbyaddr='$d_gethbyaddr'
13550d_gethbyname='$d_gethbyname'
13551d_gethent='$d_gethent'
13552d_gethname='$d_gethname'
13553d_gethostprotos='$d_gethostprotos'
13554d_getlogin='$d_getlogin'
ccc7f9b3 13555d_getmntent='$d_getmntent'
5f80c64f
JH
13556d_getnbyaddr='$d_getnbyaddr'
13557d_getnbyname='$d_getnbyname'
13558d_getnent='$d_getnent'
13559d_getnetprotos='$d_getnetprotos'
13560d_getpbyname='$d_getpbyname'
13561d_getpbynumber='$d_getpbynumber'
13562d_getpent='$d_getpent'
13563d_getpgid='$d_getpgid'
13564d_getpgrp2='$d_getpgrp2'
13565d_getpgrp='$d_getpgrp'
13566d_getppid='$d_getppid'
13567d_getprior='$d_getprior'
13568d_getprotoprotos='$d_getprotoprotos'
13569d_getpwent='$d_getpwent'
13570d_getsbyname='$d_getsbyname'
13571d_getsbyport='$d_getsbyport'
13572d_getsent='$d_getsent'
13573d_getservprotos='$d_getservprotos'
f1066039
JH
13574d_getspent='$d_getspent'
13575d_getspnam='$d_getspnam'
5f80c64f
JH
13576d_gettimeod='$d_gettimeod'
13577d_gnulibc='$d_gnulibc'
13578d_grpasswd='$d_grpasswd'
ccc7f9b3 13579d_hasmntopt='$d_hasmntopt'
5f80c64f
JH
13580d_htonl='$d_htonl'
13581d_index='$d_index'
13582d_inetaton='$d_inetaton'
2000072c 13583d_ino64_t='$d_ino64_t'
5f80c64f 13584d_int64t='$d_int64t'
de4597cb 13585d_iovec_s='$d_iovec_s'
5f80c64f
JH
13586d_isascii='$d_isascii'
13587d_killpg='$d_killpg'
13588d_lchown='$d_lchown'
13589d_link='$d_link'
2000072c 13590d_llseek='$d_llseek'
5f80c64f
JH
13591d_locconv='$d_locconv'
13592d_lockf64='$d_lockf64'
13593d_lockf='$d_lockf'
13594d_longdbl='$d_longdbl'
13595d_longlong='$d_longlong'
13596d_lseek64='$d_lseek64'
13597d_lstat64='$d_lstat64'
13598d_lstat='$d_lstat'
ff49bff8 13599d_madvise='$d_madvise'
5f80c64f
JH
13600d_mblen='$d_mblen'
13601d_mbstowcs='$d_mbstowcs'
13602d_mbtowc='$d_mbtowc'
0f27ced1 13603d_memchr='$d_memchr'
5f80c64f
JH
13604d_memcmp='$d_memcmp'
13605d_memcpy='$d_memcpy'
13606d_memmove='$d_memmove'
13607d_memset='$d_memset'
13608d_mkdir='$d_mkdir'
13609d_mkfifo='$d_mkfifo'
13610d_mktime='$d_mktime'
ff49bff8
JH
13611d_mmap='$d_mmap'
13612d_mprotect='$d_mprotect'
5f80c64f 13613d_msg='$d_msg'
de4597cb
JH
13614d_msg_ctrunc='$d_msg_ctrunc'
13615d_msg_dontroute='$d_msg_dontroute'
13616d_msg_oob='$d_msg_oob'
13617d_msg_peek='$d_msg_peek'
13618d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
13619d_msgctl='$d_msgctl'
13620d_msgget='$d_msgget'
de4597cb 13621d_msghdr_s='$d_msghdr_s'
5f80c64f
JH
13622d_msgrcv='$d_msgrcv'
13623d_msgsnd='$d_msgsnd'
ff49bff8
JH
13624d_msync='$d_msync'
13625d_munmap='$d_munmap'
5f80c64f
JH
13626d_mymalloc='$d_mymalloc'
13627d_nextkey64='$d_nextkey64'
13628d_nice='$d_nice'
2000072c
JH
13629d_off64_t='$d_off64_t'
13630d_offset_t='$d_offset_t'
ef4af2be 13631d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
13632d_oldpthreads='$d_oldpthreads'
13633d_oldsock='$d_oldsock'
13634d_open3='$d_open3'
13635d_open64='$d_open64'
13636d_opendir64='$d_opendir64'
13637d_pathconf='$d_pathconf'
13638d_pause='$d_pause'
13639d_phostname='$d_phostname'
13640d_pipe='$d_pipe'
13641d_poll='$d_poll'
13642d_portable='$d_portable'
13643d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
13644d_pwage='$d_pwage'
13645d_pwchange='$d_pwchange'
13646d_pwclass='$d_pwclass'
13647d_pwcomment='$d_pwcomment'
13648d_pwexpire='$d_pwexpire'
13649d_pwgecos='$d_pwgecos'
13650d_pwpasswd='$d_pwpasswd'
13651d_pwquota='$d_pwquota'
13652d_readdir64='$d_readdir64'
13653d_readdir='$d_readdir'
13654d_readlink='$d_readlink'
de4597cb
JH
13655d_readv='$d_readv'
13656d_recvmsg='$d_recvmsg'
5f80c64f
JH
13657d_rename='$d_rename'
13658d_rewinddir='$d_rewinddir'
13659d_rmdir='$d_rmdir'
13660d_safebcpy='$d_safebcpy'
13661d_safemcpy='$d_safemcpy'
13662d_sanemcmp='$d_sanemcmp'
13663d_sched_yield='$d_sched_yield'
de4597cb 13664d_scm_rights='$d_scm_rights'
5f80c64f
JH
13665d_seekdir64='$d_seekdir64'
13666d_seekdir='$d_seekdir'
13667d_select='$d_select'
13668d_sem='$d_sem'
13669d_semctl='$d_semctl'
13670d_semctl_semid_ds='$d_semctl_semid_ds'
13671d_semctl_semun='$d_semctl_semun'
13672d_semget='$d_semget'
13673d_semop='$d_semop'
de4597cb 13674d_sendmsg='$d_sendmsg'
5f80c64f
JH
13675d_setegid='$d_setegid'
13676d_seteuid='$d_seteuid'
13677d_setgrent='$d_setgrent'
13678d_setgrps='$d_setgrps'
13679d_sethent='$d_sethent'
13680d_setlinebuf='$d_setlinebuf'
13681d_setlocale='$d_setlocale'
13682d_setnent='$d_setnent'
13683d_setpent='$d_setpent'
13684d_setpgid='$d_setpgid'
13685d_setpgrp2='$d_setpgrp2'
13686d_setpgrp='$d_setpgrp'
13687d_setprior='$d_setprior'
13688d_setpwent='$d_setpwent'
13689d_setregid='$d_setregid'
13690d_setresgid='$d_setresgid'
13691d_setresuid='$d_setresuid'
13692d_setreuid='$d_setreuid'
13693d_setrgid='$d_setrgid'
13694d_setruid='$d_setruid'
13695d_setsent='$d_setsent'
13696d_setsid='$d_setsid'
f1066039 13697d_setspent='$d_setspent'
5f80c64f
JH
13698d_setvbuf='$d_setvbuf'
13699d_sfio='$d_sfio'
13700d_shm='$d_shm'
13701d_shmat='$d_shmat'
13702d_shmatprototype='$d_shmatprototype'
13703d_shmctl='$d_shmctl'
13704d_shmdt='$d_shmdt'
13705d_shmget='$d_shmget'
13706d_sigaction='$d_sigaction'
13707d_sigsetjmp='$d_sigsetjmp'
13708d_socket='$d_socket'
13709d_sockpair='$d_sockpair'
13710d_stat64='$d_stat64'
13711d_statblks='$d_statblks'
104d25b7
JH
13712d_statfs='$d_statfs'
13713d_statfsflags='$d_statfsflags'
13714d_statvfs='$d_statvfs'
5f80c64f
JH
13715d_stdio_cnt_lval='$d_stdio_cnt_lval'
13716d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 13717d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
13718d_stdiobase='$d_stdiobase'
13719d_stdstdio='$d_stdstdio'
13720d_store64='$d_store64'
13721d_strchr='$d_strchr'
13722d_strcoll='$d_strcoll'
13723d_strctcpy='$d_strctcpy'
13724d_strerrm='$d_strerrm'
13725d_strerror='$d_strerror'
13726d_strtod='$d_strtod'
13727d_strtol='$d_strtol'
13728d_strtoul='$d_strtoul'
cf2093f6 13729d_strtoull='$d_strtoull'
5f80c64f
JH
13730d_strxfrm='$d_strxfrm'
13731d_suidsafe='$d_suidsafe'
13732d_symlink='$d_symlink'
13733d_syscall='$d_syscall'
13734d_sysconf='$d_sysconf'
13735d_sysernlst='$d_sysernlst'
13736d_syserrlst='$d_syserrlst'
13737d_system='$d_system'
13738d_tcgetpgrp='$d_tcgetpgrp'
13739d_tcsetpgrp='$d_tcsetpgrp'
13740d_telldir64='$d_telldir64'
13741d_telldir='$d_telldir'
cb86ce0e 13742d_telldirproto='$d_telldirproto'
5f80c64f
JH
13743d_time='$d_time'
13744d_times='$d_times'
13745d_tmpfile64='$d_tmpfile64'
13746d_truncate64='$d_truncate64'
13747d_truncate='$d_truncate'
13748d_tzname='$d_tzname'
13749d_umask='$d_umask'
13750d_uname='$d_uname'
13751d_union_semun='$d_union_semun'
a3635516 13752d_vendorlib='$d_vendorlib'
5f80c64f
JH
13753d_vfork='$d_vfork'
13754d_void_closedir='$d_void_closedir'
13755d_voidsig='$d_voidsig'
13756d_voidtty='$d_voidtty'
13757d_volatile='$d_volatile'
13758d_vprintf='$d_vprintf'
13759d_wait4='$d_wait4'
13760d_waitpid='$d_waitpid'
13761d_wcstombs='$d_wcstombs'
13762d_wctomb='$d_wctomb'
de4597cb 13763d_writev='$d_writev'
5f80c64f
JH
13764d_xenix='$d_xenix'
13765date='$date'
13766db_hashtype='$db_hashtype'
13767db_prefixtype='$db_prefixtype'
13768defvoidused='$defvoidused'
13769direntrytype='$direntrytype'
13770dlext='$dlext'
13771dlsrc='$dlsrc'
13772doublesize='$doublesize'
13773drand01='$drand01'
13774dynamic_ext='$dynamic_ext'
13775eagain='$eagain'
13776ebcdic='$ebcdic'
13777echo='$echo'
13778egrep='$egrep'
13779emacs='$emacs'
13780eunicefix='$eunicefix'
13781exe_ext='$exe_ext'
13782expr='$expr'
13783extensions='$extensions'
66fe083f 13784fflushNULL='$fflushNULL'
767df6a1 13785fflushall='$fflushall'
5f80c64f
JH
13786find='$find'
13787firstmakefile='$firstmakefile'
13788flex='$flex'
13789fpostype='$fpostype'
13790freetype='$freetype'
ccc7f9b3 13791full_ar='$full_ar'
5f80c64f
JH
13792full_csh='$full_csh'
13793full_sed='$full_sed'
13794gccversion='$gccversion'
13795gidtype='$gidtype'
13796glibpth='$glibpth'
13797grep='$grep'
13798groupcat='$groupcat'
13799groupstype='$groupstype'
13800gzip='$gzip'
13801h_fcntl='$h_fcntl'
13802h_sysfile='$h_sysfile'
13803hint='$hint'
13804hostcat='$hostcat'
13805huge='$huge'
13806i_arpainet='$i_arpainet'
13807i_bsdioctl='$i_bsdioctl'
13808i_db='$i_db'
13809i_dbm='$i_dbm'
13810i_dirent='$i_dirent'
13811i_dld='$i_dld'
13812i_dlfcn='$i_dlfcn'
13813i_fcntl='$i_fcntl'
13814i_float='$i_float'
13815i_gdbm='$i_gdbm'
13816i_grp='$i_grp'
13817i_inttypes='$i_inttypes'
13818i_limits='$i_limits'
13819i_locale='$i_locale'
7f3d1cf1 13820i_machcthr='$i_machcthr'
5f80c64f
JH
13821i_malloc='$i_malloc'
13822i_math='$i_math'
13823i_memory='$i_memory'
e7fb4fcc 13824i_mntent='$i_mntent'
5f80c64f
JH
13825i_ndbm='$i_ndbm'
13826i_netdb='$i_netdb'
13827i_neterrno='$i_neterrno'
9cc6feab 13828i_netinettcp='$i_netinettcp'
5f80c64f 13829i_niin='$i_niin'
5b34fd99 13830i_poll='$i_poll'
c4747d3e 13831i_pthread='$i_pthread'
5f80c64f
JH
13832i_pwd='$i_pwd'
13833i_rpcsvcdbm='$i_rpcsvcdbm'
13834i_sfio='$i_sfio'
13835i_sgtty='$i_sgtty'
f1066039 13836i_shadow='$i_shadow'
86959918 13837i_socks='$i_socks'
5f80c64f
JH
13838i_stdarg='$i_stdarg'
13839i_stddef='$i_stddef'
13840i_stdlib='$i_stdlib'
13841i_string='$i_string'
13842i_sysaccess='$i_sysaccess'
13843i_sysdir='$i_sysdir'
13844i_sysfile='$i_sysfile'
13845i_sysfilio='$i_sysfilio'
13846i_sysin='$i_sysin'
13847i_sysioctl='$i_sysioctl'
ff49bff8 13848i_sysmman='$i_sysmman'
104d25b7 13849i_sysmount='$i_sysmount'
5f80c64f
JH
13850i_sysndir='$i_sysndir'
13851i_sysparam='$i_sysparam'
13852i_sysresrc='$i_sysresrc'
13853i_syssecrt='$i_syssecrt'
13854i_sysselct='$i_sysselct'
13855i_syssockio='$i_syssockio'
13856i_sysstat='$i_sysstat'
104d25b7 13857i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
13858i_systime='$i_systime'
13859i_systimek='$i_systimek'
13860i_systimes='$i_systimes'
13861i_systypes='$i_systypes'
de4597cb 13862i_sysuio='$i_sysuio'
5f80c64f
JH
13863i_sysun='$i_sysun'
13864i_syswait='$i_syswait'
13865i_termio='$i_termio'
13866i_termios='$i_termios'
13867i_time='$i_time'
13868i_unistd='$i_unistd'
13869i_utime='$i_utime'
13870i_values='$i_values'
13871i_varargs='$i_varargs'
13872i_varhdr='$i_varhdr'
13873i_vfork='$i_vfork'
13874ignore_versioned_solibs='$ignore_versioned_solibs'
13875incpath='$incpath'
13876inews='$inews'
13877installarchlib='$installarchlib'
13878installbin='$installbin'
13879installman1dir='$installman1dir'
13880installman3dir='$installman3dir'
dd4e71fd
JH
13881installprefix='$installprefix'
13882installprefixexp='$installprefixexp'
5f80c64f
JH
13883installprivlib='$installprivlib'
13884installscript='$installscript'
13885installsitearch='$installsitearch'
13886installsitelib='$installsitelib'
dd4e71fd 13887installstyle='$installstyle'
104d25b7 13888installusrbinperl='$installusrbinperl'
a3635516 13889installvendorlib='$installvendorlib'
5f80c64f
JH
13890intsize='$intsize'
13891known_extensions='$known_extensions'
13892ksh='$ksh'
13893large='$large'
13894ld='$ld'
13895lddlflags='$lddlflags'
13896ldflags='$ldflags'
5cf1d1f1 13897ldlibpthname='$ldlibpthname'
5f80c64f
JH
13898less='$less'
13899lib_ext='$lib_ext'
13900libc='$libc'
13901libperl='$libperl'
13902libpth='$libpth'
13903libs='$libs'
13904libswanted='$libswanted'
13905line='$line'
13906lint='$lint'
13907lkflags='$lkflags'
13908ln='$ln'
13909lns='$lns'
13910locincpth='$locincpth'
13911loclibpth='$loclibpth'
13912longdblsize='$longdblsize'
13913longlongsize='$longlongsize'
13914longsize='$longsize'
13915lp='$lp'
13916lpr='$lpr'
13917ls='$ls'
13918lseeksize='$lseeksize'
13919lseektype='$lseektype'
13920mail='$mail'
13921mailx='$mailx'
13922make='$make'
13923make_set_make='$make_set_make'
13924mallocobj='$mallocobj'
13925mallocsrc='$mallocsrc'
13926malloctype='$malloctype'
13927man1dir='$man1dir'
13928man1direxp='$man1direxp'
13929man1ext='$man1ext'
13930man3dir='$man3dir'
13931man3direxp='$man3direxp'
13932man3ext='$man3ext'
13933medium='$medium'
13934mips='$mips'
13935mips_type='$mips_type'
13936mkdir='$mkdir'
ff49bff8 13937mmaptype='$mmaptype'
5f80c64f
JH
13938models='$models'
13939modetype='$modetype'
13940more='$more'
68c15b6f 13941multiarch='$multiarch'
5f80c64f
JH
13942mv='$mv'
13943myarchname='$myarchname'
13944mydomain='$mydomain'
13945myhostname='$myhostname'
13946myuname='$myuname'
13947n='$n'
13948netdb_hlen_type='$netdb_hlen_type'
13949netdb_host_type='$netdb_host_type'
13950netdb_name_type='$netdb_name_type'
13951netdb_net_type='$netdb_net_type'
13952nm='$nm'
13953nm_opt='$nm_opt'
13954nm_so_opt='$nm_so_opt'
13955nonxs_ext='$nonxs_ext'
13956nroff='$nroff'
13957o_nonblock='$o_nonblock'
13958obj_ext='$obj_ext'
ef4af2be 13959old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
13960optimize='$optimize'
13961orderlib='$orderlib'
13962osname='$osname'
13963osvers='$osvers'
13964package='$package'
13965pager='$pager'
13966passcat='$passcat'
13967patchlevel='$patchlevel'
13968path_sep='$path_sep'
13969perl='$perl'
13970perladmin='$perladmin'
13971perlpath='$perlpath'
13972pg='$pg'
13973phostname='$phostname'
13974pidtype='$pidtype'
13975plibpth='$plibpth'
13976pmake='$pmake'
13977pr='$pr'
13978prefix='$prefix'
13979prefixexp='$prefixexp'
13980privlib='$privlib'
13981privlibexp='$privlibexp'
13982prototype='$prototype'
13983ptrsize='$ptrsize'
13984randbits='$randbits'
13985randfunc='$randfunc'
13986randseedtype='$randseedtype'
13987ranlib='$ranlib'
13988rd_nodata='$rd_nodata'
13989rm='$rm'
13990rmail='$rmail'
13991runnm='$runnm'
cf2093f6
JH
13992sPRIEldbl='$sPRIEldbl'
13993sPRIFldbl='$sPRIFldbl'
13994sPRIGldbl='$sPRIGldbl'
13995sPRIX64='$sPRIX64'
13996sPRId64='$sPRId64'
13997sPRIeldbl='$sPRIeldbl'
13998sPRIfldbl='$sPRIfldbl'
13999sPRIgldbl='$sPRIgldbl'
14000sPRIi64='$sPRIi64'
14001sPRIo64='$sPRIo64'
14002sPRIu64='$sPRIu64'
14003sPRIx64='$sPRIx64'
5f80c64f
JH
14004sched_yield='$sched_yield'
14005scriptdir='$scriptdir'
14006scriptdirexp='$scriptdirexp'
14007sed='$sed'
14008seedfunc='$seedfunc'
14009selectminbits='$selectminbits'
14010selecttype='$selecttype'
14011sendmail='$sendmail'
14012sh='$sh'
14013shar='$shar'
14014sharpbang='$sharpbang'
14015shmattype='$shmattype'
14016shortsize='$shortsize'
14017shrpenv='$shrpenv'
14018shsharp='$shsharp'
af4c28eb 14019sig_count='$sig_count'
5f80c64f
JH
14020sig_name='$sig_name'
14021sig_name_init='$sig_name_init'
14022sig_num='$sig_num'
824a2ba3 14023sig_num_init='$sig_num_init'
5f80c64f
JH
14024signal_t='$signal_t'
14025sitearch='$sitearch'
14026sitearchexp='$sitearchexp'
14027sitelib='$sitelib'
14028sitelibexp='$sitelibexp'
dd4e71fd
JH
14029siteprefix='$siteprefix'
14030siteprefixexp='$siteprefixexp'
5f80c64f
JH
14031sizetype='$sizetype'
14032sleep='$sleep'
14033smail='$smail'
14034small='$small'
14035so='$so'
14036sockethdr='$sockethdr'
14037socketlib='$socketlib'
14038sort='$sort'
14039spackage='$spackage'
14040spitshell='$spitshell'
14041split='$split'
14042src='$src'
14043ssizetype='$ssizetype'
14044startperl='$startperl'
14045startsh='$startsh'
14046static_ext='$static_ext'
14047stdchar='$stdchar'
14048stdio_base='$stdio_base'
14049stdio_bufsiz='$stdio_bufsiz'
14050stdio_cnt='$stdio_cnt'
14051stdio_filbuf='$stdio_filbuf'
14052stdio_ptr='$stdio_ptr'
767df6a1 14053stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
14054strings='$strings'
14055submit='$submit'
14056subversion='$subversion'
14057sysman='$sysman'
14058tail='$tail'
14059tar='$tar'
14060tbl='$tbl'
14061tee='$tee'
14062test='$test'
14063timeincl='$timeincl'
14064timetype='$timetype'
14065touch='$touch'
14066tr='$tr'
14067trnl='$trnl'
14068troff='$troff'
14069uidtype='$uidtype'
14070uname='$uname'
14071uniq='$uniq'
14072use64bits='$use64bits'
14073usedl='$usedl'
14074usemultiplicity='$usemultiplicity'
14075usemymalloc='$usemymalloc'
14076usenm='$usenm'
14077useopcode='$useopcode'
14078useperlio='$useperlio'
14079useposix='$useposix'
14080usesfio='$usesfio'
14081useshrplib='$useshrplib'
29209bc5 14082usesocks='$usesocks'
5f80c64f 14083usethreads='$usethreads'
a3635516 14084usevendorprefix='$usevendorprefix'
5f80c64f
JH
14085usevfork='$usevfork'
14086usrinc='$usrinc'
14087uuname='$uuname'
a3635516
JH
14088vendorlib='$vendorlib'
14089vendorlibexp='$vendorlibexp'
14090vendorprefix='$vendorprefix'
14091vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
14092version='$version'
14093vi='$vi'
14094voidflags='$voidflags'
14095xlibpth='$xlibpth'
14096zcat='$zcat'
14097zip='$zip'
14098EOT
14099
14100: Add in command line options if available
14101$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14102
14103: add special variables
14104$test -f $src/patchlevel.h && \
d00b958f 14105awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 14106echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
14107
14108: propagate old symbols
14109if $test -f UU/config.sh; then
14110 <UU/config.sh sort | uniq >UU/oldconfig.sh
14111 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14112 sort | uniq -u >UU/oldsyms
14113 set X `cat UU/oldsyms`
14114 shift
14115 case $# in
14116 0) ;;
14117 *)
14118 cat <<EOM
14119Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14120EOM
14121 echo "# Variables propagated from previous config.sh file." >>config.sh
14122 for sym in `cat UU/oldsyms`; do
14123 echo " Propagating $hint variable "'$'"$sym..."
14124 eval 'tmp="$'"${sym}"'"'
14125 echo "$tmp" | \
14126 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14127 done
14128 ;;
14129 esac
14130fi
14131
14132: Finish up by extracting the .SH files
14133case "$alldone" in
14134exit)
14135 $rm -rf UU
14136 echo "Done."
14137 exit 0
14138 ;;
14139cont)
14140 ;;
14141'')
14142 dflt=''
14143 nostick=true
14144 $cat <<EOM
14145
14146If you'd like to make any changes to the config.sh file before I begin
14147to configure things, do it as a shell escape now (e.g. !vi config.sh).
14148
14149EOM
14150 rp="Press return or use a shell escape to edit config.sh:"
14151 . UU/myread
14152 nostick=''
14153 case "$ans" in
14154 '') ;;
14155 *) : in case they cannot read
14156 sh 1>&4 -c "$ans";;
14157 esac
14158 ;;
14159esac
14160
14161: if this fails, just run all the .SH files by hand
14162. ./config.sh
14163
14164echo " "
14165exec 1>&4
14166. ./UU/extract
14167
14168if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14169 dflt=y
14170 case "$silent" in
14171 true) ;;
14172 *)
14173 $cat <<EOM
14174
14175Now you need to generate make dependencies by running "$make depend".
14176You might prefer to run it in background: "$make depend > makedepend.out &"
14177It can take a while, so you might not want to run it right now.
14178
14179EOM
14180 ;;
14181 esac
14182 rp="Run $make depend now?"
14183 . UU/myread
14184 case "$ans" in
14185 y*)
14186 $make depend && echo "Now you must run a $make."
14187 ;;
14188 *)
14189 echo "You must run '$make depend' then '$make'."
14190 ;;
14191 esac
14192elif test -f [Mm]akefile; then
14193 echo " "
14194 echo "Now you must run a $make."
14195else
14196 echo "Done."
14197fi
14198
14199if $test -f Policy.sh; then
14200 $cat <<EOM
14201
14202If you compile $package on a different machine or from a different object
14203directory, copy the Policy.sh file from this object directory to the
14204new one before you run Configure -- this will help you with most of
14205the policy defaults.
14206
14207EOM
14208fi
14209if $test -f config.msg; then
14210 echo "Hmm. I also noted the following information while running:"
14211 echo " "
14212 $cat config.msg >&4
14213 $rm -f config.msg
14214fi
14215$rm -f kit*isdone ark*isdone
14216$rm -rf UU
14217
14218: End of Configure
14219