This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
UNICOS doesn't have getpgid(). Or, at least 9.0.1ai
[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#
190b66db 23# Generated on Fri Sep 17 12:06:13 EET DST 1999 [metaconfig 3.0 PL70]
46193409 24# (with additional metaconfig patches by perlbug@perl.com)
2304df62
AD
25
26cat >/tmp/c1$$ <<EOF
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
37cat >/tmp/c2$$ <<EOF
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
43true || cat /tmp/c1$$ /tmp/c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat /tmp/c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f /tmp/c1$$ /tmp/c2$$
49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
dfe9444c 59: Proper separator for the PATH environment variable
8e07c86e
AD
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
62if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
64 p_=\;
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 67 elif test -n "$DJGPP"; then
dfe9444c
AD
68 p_=\;
69 fi
39e571d4 70fi
a0d0e21e
LW
71
72: Proper PATH setting
73paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 74paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 75paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 76paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
77paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
81
82for p in $paths
83do
8e07c86e
AD
84 case "$p_$PATH$p_" in
85 *$p_$p$p_*) ;;
86 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
87 esac
88done
89
8e07c86e 90PATH=.$p_$PATH
2304df62
AD
91export PATH
92
dfe9444c
AD
93: shall we be using ksh?
94inksh=''
95needksh=''
96avoidksh=''
97newsh=/bin/ksh
98changesh=''
ff0cee69 99if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
100 inksh=true
101fi
102if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
104fi
105if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
108 newsh=/usr/bin/bsh
2304df62 109 fi
dfe9444c 110fi
cf04f91f
JH
111if test -f /osf_boot -a -f /usr/sbin/setld; then
112 if test X`/usr/bin/uname -s` = XOSF1; then
113 avoidksh="to avoid Digital UNIX' ksh"
114 newsh=/bin/sh
115 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116 fi
117fi
dfe9444c
AD
118case "$inksh/$needksh" in
119/[a-z]*)
c4f23d77 120 ENV=''
dfe9444c
AD
121 changesh=true
122 reason="$needksh"
123 ;;
124esac
125case "$inksh/$avoidksh" in
126true/[a-z]*)
127 changesh=true
128 reason="$avoidksh"
129 ;;
130esac
131case "$inksh/$needksh-$avoidksh-" in
132true/--)
a0d0e21e
LW
133 cat <<EOM
134(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 135mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 136EOM
dfe9444c
AD
137 ;;
138esac
139case "$changesh" in
140true)
141 echo "(Feeding myself to $newsh $reason.)"
142 case "$0" in
143 Configure|*/Configure) exec $newsh $0 "$@";;
144 *) exec $newsh Configure "$@";;
145 esac
146 ;;
147esac
2304df62 148
bfb7748a
AD
149: if needed set CDPATH to a harmless value that is not chatty
150: avoid bash 2.02 problems with empty CDPATH.
151case "$CDPATH" in
152'') ;;
153*) case "$SHELL" in
154 *bash*) CDPATH='.' ;;
155 *) CDPATH='' ;;
156 esac
157 ;;
158esac
2304df62
AD
159: Configure runs within the UU subdirectory
160test -d UU || mkdir UU
8e07c86e 161cd UU && rm -f ./*
2304df62 162
ff49bff8
JH
163ccsymbols=''
164cppccsymbols=''
165cppsymbols=''
a0d0e21e 166dynamic_ext=''
2304df62 167extensions=''
a0d0e21e 168known_extensions=''
4318d5a0 169nonxs_ext=''
bfb7748a 170static_ext=''
8ff267be 171useopcode=''
a0d0e21e 172useposix=''
ecfc5424 173d_bsd=''
40a7a20a 174d_eunice=''
2304df62
AD
175d_xenix=''
176eunicefix=''
177Mcc=''
dfe9444c 178ar=''
2304df62
AD
179awk=''
180bash=''
181bison=''
182byacc=''
183cat=''
184chgrp=''
185chmod=''
186chown=''
ecfc5424 187comm=''
2304df62
AD
188compress=''
189cp=''
190cpio=''
191cpp=''
192csh=''
193date=''
194echo=''
195egrep=''
196emacs=''
197expr=''
198find=''
199flex=''
2304df62 200grep=''
8ff267be 201gzip=''
2304df62
AD
202inews=''
203ksh=''
204less=''
205line=''
206lint=''
207ln=''
208lp=''
209lpr=''
210ls=''
211mail=''
212mailx=''
dfe9444c 213make=''
2304df62
AD
214mkdir=''
215more=''
216mv=''
693762b4 217nm=''
2304df62
AD
218nroff=''
219perl=''
220pg=''
221pmake=''
222pr=''
223rm=''
224rmail=''
225sed=''
226sendmail=''
2304df62
AD
227shar=''
228sleep=''
229smail=''
230sort=''
231submit=''
232tail=''
233tar=''
234tbl=''
693762b4 235tee=''
2304df62
AD
236test=''
237touch=''
238tr=''
239troff=''
240uname=''
241uniq=''
242uuname=''
243vi=''
244zcat=''
8ff267be 245zip=''
ccc7f9b3 246full_ar=''
1aef975c 247full_sed=''
a0d0e21e 248libswanted=''
2304df62
AD
249hint=''
250myuname=''
85e6fe83
LW
251osname=''
252osvers=''
2304df62
AD
253Author=''
254Date=''
255Header=''
256Id=''
257Locker=''
258Log=''
259RCSfile=''
260Revision=''
261Source=''
262State=''
dfe9444c
AD
263_a=''
264_exe=''
265_o=''
4633a7c4
LW
266archobjs=''
267exe_ext=''
268firstmakefile=''
269lib_ext=''
270obj_ext=''
271path_sep=''
2304df62 272afs=''
a0d0e21e 273alignbytes=''
c4f23d77 274ansi2knr=''
a0d0e21e
LW
275archlib=''
276archlibexp=''
a0d0e21e
LW
277d_archlib=''
278installarchlib=''
40000a8c
AD
279archname=''
280myarchname=''
cf2093f6
JH
281d_atolf=''
282d_atoll=''
ecfc5424 283baserev=''
2304df62
AD
284bin=''
285binexp=''
286installbin=''
d71b2b6b
JH
287bincompat5005=''
288d_bincompat5005=''
2304df62
AD
289byteorder=''
290cc=''
291gccversion=''
292ccflags=''
293cppflags=''
294ldflags=''
295lkflags=''
8e07c86e 296locincpth=''
2304df62 297optimize=''
8e07c86e 298cf_email=''
2304df62
AD
299cf_by=''
300cf_time=''
301contains=''
a0d0e21e 302cpp_stuff=''
2304df62
AD
303cpplast=''
304cppminus=''
305cpprun=''
306cppstdin=''
68c15b6f 307crosscompile=''
2304df62 308d_access=''
5ff3f7a4 309d_accessx=''
a0d0e21e 310d_alarm=''
ecfc5424 311d_attribut=''
2304df62
AD
312d_bcmp=''
313d_bcopy=''
314d_bzero=''
315d_casti32=''
316castflags=''
317d_castneg=''
a0d0e21e
LW
318d_chown=''
319d_chroot=''
2304df62 320d_chsize=''
a0d0e21e
LW
321d_closedir=''
322d_void_closedir=''
2304df62
AD
323d_const=''
324cryptlib=''
325d_crypt=''
326d_csh=''
1aef975c 327full_csh=''
a0d0e21e
LW
328d_cuserid=''
329d_dbl_dig=''
330d_difftime=''
331d_dlerror=''
332d_dlopen=''
333d_dlsymun=''
2304df62 334d_dosuid=''
a0d0e21e 335d_suidsafe=''
85ab1d1d 336d_drand48proto=''
2304df62 337d_dup2=''
5ff3f7a4
GS
338d_eaccess=''
339d_endgrent=''
e5c9fcd0
AD
340d_endhent=''
341d_endnent=''
342d_endpent=''
5ff3f7a4 343d_endpwent=''
e5c9fcd0 344d_endsent=''
f1066039 345d_endspent=''
2304df62
AD
346d_fchmod=''
347d_fchown=''
348d_fcntl=''
a0d0e21e
LW
349d_fd_macros=''
350d_fd_set=''
351d_fds_bits=''
352d_fgetpos=''
2304df62
AD
353d_flexfnam=''
354d_flock=''
a0d0e21e 355d_fork=''
5ff3f7a4 356d_fseeko=''
a0d0e21e 357d_fsetpos=''
5ff3f7a4 358d_ftello=''
5f05dabc 359d_ftime=''
360d_gettimeod=''
a0d0e21e 361d_Gconvert=''
5ff3f7a4 362d_getgrent=''
2304df62 363d_getgrps=''
4599a1de 364d_gethbyaddr=''
4599a1de 365d_gethbyname=''
dfe9444c 366d_gethent=''
2304df62
AD
367aphostname=''
368d_gethname=''
369d_phostname=''
370d_uname=''
dc45a647 371d_gethostprotos=''
a0d0e21e 372d_getlogin=''
ccc7f9b3 373d_getmntent=''
dfe9444c 374d_getnbyaddr=''
693762b4 375d_getnbyname=''
e5c9fcd0 376d_getnent=''
dc45a647 377d_getnetprotos=''
e5c9fcd0 378d_getpent=''
2afac517 379d_getpgid=''
2304df62 380d_getpgrp2=''
2afac517 381d_bsdgetpgrp=''
2304df62 382d_getpgrp=''
a0d0e21e 383d_getppid=''
2304df62 384d_getprior=''
693762b4
AD
385d_getpbyname=''
386d_getpbynumber=''
dc45a647 387d_getprotoprotos=''
5ff3f7a4 388d_getpwent=''
e5c9fcd0 389d_getsent=''
dc45a647 390d_getservprotos=''
f1066039
JH
391d_getspent=''
392d_getspnam=''
693762b4
AD
393d_getsbyname=''
394d_getsbyport=''
a4f3eea9 395d_gnulibc=''
ccc7f9b3 396d_hasmntopt=''
2304df62 397d_htonl=''
7e1af8bc 398d_inetaton=''
2304df62
AD
399d_isascii=''
400d_killpg=''
dd64f1c3 401d_lchown=''
2d4389e4 402d_ldbl_dig=''
2304df62 403d_link=''
a0d0e21e
LW
404d_locconv=''
405d_lockf=''
e5c9fcd0
AD
406d_longdbl=''
407longdblsize=''
dc45a647
MB
408d_longlong=''
409longlongsize=''
2304df62 410d_lstat=''
ff49bff8 411d_madvise=''
a0d0e21e
LW
412d_mblen=''
413d_mbstowcs=''
414d_mbtowc=''
0f27ced1 415d_memchr=''
2304df62
AD
416d_memcmp=''
417d_memcpy=''
418d_memmove=''
419d_memset=''
420d_mkdir=''
a0d0e21e
LW
421d_mkfifo=''
422d_mktime=''
ff49bff8
JH
423d_mmap=''
424mmaptype=''
425d_mprotect=''
2304df62
AD
426d_msg=''
427d_msgctl=''
428d_msgget=''
429d_msgrcv=''
430d_msgsnd=''
ff49bff8
JH
431d_msync=''
432d_munmap=''
a0d0e21e 433d_nice=''
2304df62 434d_open3=''
a0d0e21e
LW
435d_fpathconf=''
436d_pathconf=''
437d_pause=''
438d_pipe=''
8e07c86e 439d_poll=''
2304df62 440d_portable=''
ef4af2be
JH
441d_old_pthread_create_joinable=''
442old_pthread_create_joinable=''
dfe9444c
AD
443d_pthread_yield=''
444d_sched_yield=''
1cfa4ec7 445sched_yield=''
2304df62 446d_readdir=''
85e6fe83
LW
447d_rewinddir=''
448d_seekdir=''
449d_telldir=''
a0d0e21e 450d_readlink=''
de4597cb 451d_readv=''
2304df62
AD
452d_rename=''
453d_rmdir=''
454d_safebcpy=''
455d_safemcpy=''
36477c24 456d_sanemcmp=''
2304df62
AD
457d_select=''
458d_sem=''
459d_semctl=''
460d_semget=''
461d_semop=''
462d_setegid=''
463d_seteuid=''
5ff3f7a4 464d_setgrent=''
dfe9444c 465d_setgrps=''
693762b4 466d_sethent=''
a0d0e21e 467d_setlinebuf=''
2304df62 468d_setlocale=''
e5c9fcd0
AD
469d_setnent=''
470d_setpent=''
2304df62
AD
471d_setpgid=''
472d_setpgrp2=''
2afac517 473d_bsdsetpgrp=''
2304df62
AD
474d_setpgrp=''
475d_setprior=''
5ff3f7a4 476d_setpwent=''
2304df62
AD
477d_setregid=''
478d_setresgid=''
479d_setresuid=''
480d_setreuid=''
481d_setrgid=''
482d_setruid=''
e5c9fcd0 483d_setsent=''
2304df62 484d_setsid=''
f1066039 485d_setspent=''
e5c9fcd0 486d_setvbuf=''
760ac839 487d_sfio=''
8ff267be 488usesfio=''
2304df62
AD
489d_shm=''
490d_shmat=''
a0d0e21e
LW
491d_shmatprototype=''
492shmattype=''
2304df62
AD
493d_shmctl=''
494d_shmdt=''
495d_shmget=''
2c7991dc 496d_sigaction=''
8ff267be 497d_sigsetjmp=''
de4597cb
JH
498d_cmsghdr_s=''
499d_msg_ctrunc=''
500d_msg_dontroute=''
501d_msg_oob=''
502d_msg_peek=''
503d_msg_proxy=''
504d_msghdr_s=''
2304df62 505d_oldsock=''
de4597cb
JH
506d_recvmsg=''
507d_scm_rights=''
508d_sendmsg=''
2304df62
AD
509d_socket=''
510d_sockpair=''
511sockethdr=''
512socketlib=''
513d_statblks=''
104d25b7
JH
514d_fstatfs=''
515d_statfs=''
516d_statfsflags=''
517d_fstatvfs=''
518d_statvfs=''
c2960299
AD
519d_stdio_cnt_lval=''
520d_stdio_ptr_lval=''
16d20bd9 521d_stdiobase=''
2304df62 522d_stdstdio=''
16d20bd9
AD
523stdio_base=''
524stdio_bufsiz=''
525stdio_cnt=''
dfe9444c 526stdio_filbuf=''
16d20bd9 527stdio_ptr=''
2304df62
AD
528d_index=''
529d_strchr=''
a0d0e21e 530d_strcoll=''
2304df62
AD
531d_strctcpy=''
532d_strerrm=''
533d_strerror=''
534d_sysernlst=''
535d_syserrlst=''
a89d8a78
DH
536d_strtod=''
537d_strtol=''
538d_strtoul=''
a0d0e21e 539d_strxfrm=''
2304df62
AD
540d_symlink=''
541d_syscall=''
a0d0e21e 542d_sysconf=''
2304df62 543d_system=''
a0d0e21e
LW
544d_tcgetpgrp=''
545d_tcsetpgrp=''
cb86ce0e 546d_telldirproto=''
85e6fe83
LW
547d_time=''
548timetype=''
2304df62
AD
549clocktype=''
550d_times=''
551d_truncate=''
a0d0e21e
LW
552d_tzname=''
553d_umask=''
bd89102f
AD
554d_semctl_semid_ds=''
555d_semctl_semun=''
556d_union_semun=''
2304df62 557d_vfork=''
a0d0e21e 558usevfork=''
2304df62
AD
559d_voidsig=''
560signal_t=''
561d_volatile=''
562d_charvspr=''
563d_vprintf=''
564d_wait4=''
565d_waitpid=''
a0d0e21e
LW
566d_wcstombs=''
567d_wctomb=''
de4597cb 568d_writev=''
a0d0e21e 569dlext=''
85e6fe83
LW
570cccdlflags=''
571ccdlflags=''
2304df62 572dlsrc=''
232e078e 573ld=''
85e6fe83 574lddlflags=''
2304df62 575usedl=''
693762b4 576doublesize=''
5ff3f7a4 577ebcdic=''
66fe083f 578fflushNULL=''
767df6a1 579fflushall=''
a0d0e21e 580fpostype=''
2304df62
AD
581gidtype=''
582groupstype=''
583h_fcntl=''
584h_sysfile=''
5ff3f7a4 585i_arpainet=''
ecfc5424
AD
586db_hashtype=''
587db_prefixtype=''
a0d0e21e 588i_db=''
2304df62 589i_dbm=''
8e07c86e 590i_rpcsvcdbm=''
2304df62 591d_dirnamlen=''
a0d0e21e 592direntrytype=''
2304df62 593i_dirent=''
a0d0e21e 594i_dld=''
2304df62
AD
595i_dlfcn=''
596i_fcntl=''
a0d0e21e 597i_float=''
2304df62 598i_gdbm=''
28e8609d 599d_grpasswd=''
2304df62 600i_grp=''
5ff3f7a4
GS
601d_int64t=''
602i_inttypes=''
a0d0e21e 603i_limits=''
4633a7c4 604i_locale=''
7f3d1cf1 605i_machcthr=''
a0d0e21e
LW
606i_malloc=''
607i_math=''
85e6fe83 608i_memory=''
e7fb4fcc 609i_mntent=''
2304df62 610i_ndbm=''
3fd537d4 611i_netdb=''
85e6fe83 612i_neterrno=''
9cc6feab 613i_netinettcp=''
2304df62
AD
614i_niin=''
615i_sysin=''
5b34fd99 616i_poll=''
c4747d3e 617i_pthread=''
2304df62
AD
618d_pwage=''
619d_pwchange=''
620d_pwclass=''
621d_pwcomment=''
622d_pwexpire=''
c4f23d77 623d_pwgecos=''
28e8609d 624d_pwpasswd=''
2304df62
AD
625d_pwquota=''
626i_pwd=''
760ac839 627i_sfio=''
f1066039 628i_shadow=''
86959918 629i_socks=''
2304df62 630i_stddef=''
a0d0e21e 631i_stdlib=''
2304df62
AD
632i_string=''
633strings=''
5ff3f7a4 634i_sysaccess=''
2304df62
AD
635i_sysdir=''
636i_sysfile=''
637d_voidtty=''
638i_bsdioctl=''
a0d0e21e 639i_sysfilio=''
2304df62
AD
640i_sysioctl=''
641i_syssockio=''
ff49bff8 642i_sysmman=''
104d25b7 643i_sysmount=''
2304df62 644i_sysndir=''
a0d0e21e 645i_sysparam=''
8ff267be 646i_sysresrc=''
5ff3f7a4 647i_syssecrt=''
2304df62 648i_sysselct=''
1aef975c 649i_sysstat=''
104d25b7 650i_sysstatvfs=''
a0d0e21e 651i_systimes=''
fed7345c 652i_systypes=''
de4597cb
JH
653d_iovec_s=''
654i_sysuio=''
25f94b33 655i_sysun=''
8ff267be 656i_syswait=''
2304df62
AD
657i_sgtty=''
658i_termio=''
659i_termios=''
660i_systime=''
661i_systimek=''
662i_time=''
663timeincl=''
85e6fe83 664i_unistd=''
2304df62 665i_utime=''
760ac839 666i_values=''
a0d0e21e 667i_stdarg=''
2304df62
AD
668i_varargs=''
669i_varhdr=''
670i_vfork=''
dd4e71fd
JH
671installprefix=''
672installprefixexp=''
673installstyle=''
104d25b7 674installusrbinperl=''
2304df62 675intsize=''
24fef2a7
AD
676longsize=''
677shortsize=''
d9b3e12d 678d_fpos64_t=''
2000072c 679d_llseek=''
2000072c 680d_off64_t=''
2304df62 681libc=''
5cf1d1f1 682ldlibpthname=''
8ff267be 683libperl=''
2afac517 684shrpenv=''
8ff267be 685useshrplib=''
a0d0e21e 686glibpth=''
2304df62 687libpth=''
8e07c86e 688loclibpth=''
2304df62
AD
689plibpth=''
690xlibpth=''
1cfa4ec7 691ignore_versioned_solibs=''
2304df62 692libs=''
85e6fe83 693lns=''
cf2093f6
JH
694d_PRIEldbl=''
695d_PRIFldbl=''
696d_PRIGldbl=''
697d_PRIeldbl=''
698d_PRIfldbl=''
699d_PRIgldbl=''
700sPRIEldbl=''
701sPRIFldbl=''
702sPRIGldbl=''
703sPRIeldbl=''
704sPRIfldbl=''
705sPRIgldbl=''
5ff3f7a4 706lseeksize=''
85e6fe83 707lseektype=''
8ff267be 708make_set_make=''
85e6fe83 709d_mymalloc=''
94b6baf5 710freetype=''
2304df62
AD
711mallocobj=''
712mallocsrc=''
713malloctype=''
714usemymalloc=''
16d20bd9
AD
715installman1dir=''
716man1dir=''
717man1direxp=''
718man1ext=''
719installman3dir=''
720man3dir=''
721man3direxp=''
722man3ext=''
2304df62
AD
723huge=''
724large=''
725medium=''
726models=''
727small=''
728split=''
a0d0e21e 729modetype=''
68c15b6f 730multiarch=''
2304df62
AD
731mydomain=''
732myhostname=''
733phostname=''
734c=''
735n=''
8e07c86e
AD
736d_eofnblk=''
737eagain=''
738o_nonblock=''
739rd_nodata=''
dfe9444c
AD
740netdb_hlen_type=''
741netdb_host_type=''
742netdb_name_type=''
743netdb_net_type=''
2304df62
AD
744groupcat=''
745hostcat=''
746passcat=''
85e6fe83
LW
747orderlib=''
748ranlib=''
2304df62
AD
749package=''
750spackage=''
2c7991dc 751pager=''
bfb7748a 752apiversion=''
ecfc5424 753patchlevel=''
760ac839 754subversion=''
bfb7748a 755version=''
8e07c86e 756perladmin=''
4633a7c4 757perlpath=''
dfe9444c 758pidtype=''
a0d0e21e 759prefix=''
1aef975c 760prefixexp=''
2304df62
AD
761installprivlib=''
762privlib=''
763privlibexp=''
764prototype=''
693762b4 765ptrsize=''
cf2093f6
JH
766d_PRIX64=''
767d_PRId64=''
768d_PRIi64=''
769d_PRIo64=''
770d_PRIu64=''
771d_PRIx64=''
772sPRIX64=''
773sPRId64=''
774sPRIi64=''
775sPRIo64=''
776sPRIu64=''
777sPRIx64=''
85ab1d1d 778drand01=''
2304df62 779randbits=''
85ab1d1d
JH
780randfunc=''
781randseedtype=''
782seedfunc=''
2304df62
AD
783installscript=''
784scriptdir=''
785scriptdirexp=''
5ff3f7a4 786selectminbits=''
a0d0e21e 787selecttype=''
8ff267be 788sh=''
af4c28eb 789sig_count=''
2304df62 790sig_name=''
dfe9444c 791sig_name_init=''
8e07c86e 792sig_num=''
824a2ba3 793sig_num_init=''
4633a7c4
LW
794installsitearch=''
795sitearch=''
796sitearchexp=''
25f94b33
AD
797installsitelib=''
798sitelib=''
799sitelibexp=''
dd4e71fd
JH
800siteprefix=''
801siteprefixexp=''
a0d0e21e
LW
802sizetype=''
803so=''
2304df62
AD
804sharpbang=''
805shsharp=''
806spitshell=''
dfe9444c 807src=''
a0d0e21e 808ssizetype=''
4633a7c4 809startperl=''
2304df62
AD
810startsh=''
811stdchar=''
ed39a0f2 812d_stdio_stream_array=''
767df6a1 813stdio_stream_array=''
cf2093f6 814d_strtoull=''
2304df62 815sysman=''
5ff3f7a4 816trnl=''
2304df62 817uidtype=''
85ab1d1d 818archname64=''
5ff3f7a4 819use64bits=''
b0ce926a 820uselongdouble=''
85ab1d1d 821usemultiplicity=''
2304df62 822nm_opt=''
40a7a20a 823nm_so_opt=''
2304df62
AD
824runnm=''
825usenm=''
8ff267be 826useperlio=''
29209bc5 827usesocks=''
693762b4 828d_oldpthreads=''
dfe9444c 829usethreads=''
2304df62
AD
830incpath=''
831mips=''
832mips_type=''
833usrinc=''
a3635516
JH
834d_vendorlib=''
835installvendorlib=''
836vendorlib=''
837vendorlibexp=''
838usevendorprefix=''
839vendorprefix=''
840vendorprefixexp=''
2304df62
AD
841defvoidused=''
842voidflags=''
2304df62
AD
843CONFIG=''
844
ecfc5424
AD
845define='define'
846undef='undef'
847smallmach='pdp11 i8086 z8000 i80286 iAPX286'
848rmlist=''
849
850: We must find out about Eunice early
851eunicefix=':'
852if test -f /etc/unixtovms; then
853 eunicefix=/etc/unixtovms
854fi
855if test -f /etc/unixtovms.exe; then
856 eunicefix=/etc/unixtovms.exe
857fi
858
5ff3f7a4 859i_whoami=''
5ff3f7a4
GS
860: Possible local include directories to search.
861: Set locincpth to "" in a hint file to defeat local include searches.
862locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
863locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
864:
865: no include file wanted by default
866inclwanted=''
867
ecfc5424
AD
868: list of known cpp symbols, sorted alphabetically
869al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
870al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
871al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
872al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
873al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
874al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
875al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
876al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
877al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
878al="$al VMS Xenix286"
5ff3f7a4
GS
879al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
880al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
ecfc5424
AD
881al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
882al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
883al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
884al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
885al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
886al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
887al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
888al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
889al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
890al="$al __SVR4_2__ __UMAXV__"
891al="$al ____386BSD____ __alpha __alpha__ __amiga"
892al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
893al="$al __host_mips__"
894al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
895al="$al __hp9000s500 __hp9000s700 __hp9000s800"
896al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
897al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
898al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
899al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
900al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
901al="$al __mc88100 __mc88100__ __mips __mips__"
902al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
903al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
904al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
905al="$al _host_mips _mips _unix"
906al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
907al="$al apollo ardent att386 att3b"
908al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
909al="$al cadmus clipper concurrent convex cray ctix"
910al="$al dmert encore gcos gcx gimpel gould"
911al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
912al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
913al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
914al="$al i186 i286 i386 i486 i8086"
915al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
916al="$al ksr1 linux luna luna88k m68k m88100 m88k"
917al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
918al="$al mc68040 mc68060 mc68k mc68k32 mc700"
919al="$al mc88000 mc88100 merlin mert mips mvs n16"
920al="$al ncl_el ncl_mr"
921al="$al news1500 news1700 news1800 news1900 news3700"
922al="$al news700 news800 news900 ns16000 ns32000"
923al="$al ns32016 ns32332 ns32k nsc32000 os osf"
924al="$al parisc pc532 pdp11 plexus posix pyr"
925al="$al riscix riscos scs sequent sgi sinix sony sony_news"
926al="$al sonyrisc sparc sparclite spectrum stardent stratos"
927al="$al sun sun3 sun386 svr4 sysV68 sysV88"
928al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
929al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
930al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
931al="$al xenix z8000"
932
dfe9444c 933: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 934_exe=''
dfe9444c
AD
935: Extra object files, if any, needed on this platform.
936archobjs=''
937groupstype=''
732c9516
JH
938: change the next line if compiling for Xenix/286 on Xenix/386
939xlibpth='/usr/lib/386 /lib/386'
940
941: Possible local library directories to search.
942loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
943loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
944
945: general looking path for locating libraries
946glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
947glibpth="$glibpth /lib /usr/lib $xlibpth"
948glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
949glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
950
951: Private path used by Configure to find libraries. Its value
952: is prepended to libpth. This variable takes care of special
953: machines, like the mips. Usually, it should be empty.
954plibpth=''
955
1cfa4ec7
GS
956: default library list
957libswanted=''
921b2963 958: some systems want to use only the non-versioned libso:s
1cfa4ec7 959ignore_versioned_solibs=''
bfb7748a
AD
960: full support for void wanted by default
961defvoidused=15
962
dfe9444c
AD
963: set useposix=false in your hint file to disable the POSIX extension.
964useposix=true
965: set useopcode=false in your hint file to disable the Opcode extension.
966useopcode=true
85ab1d1d 967: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 968: set usesocks on the Configure command line to enable socks.
dfe9444c 969: set usethreads on the Configure command line to enable threads.
ecfc5424 970: List of libraries we want.
693762b4
AD
971: If anyone needs -lnet, put it in a hint file.
972libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 973libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 974libswanted="$libswanted ndir dir crypt sec"
ecfc5424 975libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 976: We probably want to search /usr/shlib before most other libraries.
94b6baf5 977: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
978glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
979glibpth="/usr/shlib $glibpth"
980: Do not use vfork unless overridden by a hint file.
981usevfork=false
982
8ff267be 983: Find the basic shell for Bourne shell scripts
984case "$sh" in
985'')
8ff267be 986 case "$SYSTYPE" in
987 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
988 *) xxx='/bin/sh';;
989 esac
990 if test -f "$xxx"; then
991 sh="$xxx"
992 else
993 : Build up a list and do a single loop so we can 'break' out.
994 pth=`echo $PATH | sed -e "s/$p_/ /g"`
995 for xxx in sh bash ksh pdksh ash; do
996 for p in $pth; do
997 try="$try ${p}/${xxx}"
998 done
999 done
1000 for xxx in $try; do
1001 if test -f "$xxx"; then
1002 sh="$xxx";
8ff267be 1003 break
1004 elif test -f "$xxx.exe"; then
1005 sh="$xxx";
8ff267be 1006 break
1007 fi
1008 done
1009 fi
1010 ;;
1011esac
1012
1013case "$sh" in
1014'') cat <<EOM >&2
1015$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1016
8ff267be 1017Usually it's in /bin/sh. How did you even get this far?
46193409 1018Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 1019we'll try to straighten this all out.
8ff267be 1020EOM
1021 exit 1
1022 ;;
1023esac
1024
760ac839 1025: see if sh knows # comments
8ff267be 1026if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1027 shsharp=true
1028 spitshell=cat
760ac839
LW
1029 xcat=/bin/cat
1030 test -f $xcat || xcat=/usr/bin/cat
1031 echo "#!$xcat" >try
1032 $eunicefix try
1033 chmod +x try
1034 ./try > today
1035 if test -s today; then
760ac839
LW
1036 sharpbang='#!'
1037 else
1038 echo "#! $xcat" > try
1039 $eunicefix try
1040 chmod +x try
1041 ./try > today
1042 if test -s today; then
760ac839
LW
1043 sharpbang='#! '
1044 else
760ac839
LW
1045 sharpbang=': use '
1046 fi
1047 fi
1048else
dfe9444c 1049 echo " "
8ff267be 1050 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1051 shsharp=false
1052 cd ..
1053 echo "exec grep -v '^[ ]*#'" >spitshell
1054 chmod +x spitshell
1055 $eunicefix spitshell
1056 spitshell=`pwd`/spitshell
1057 cd UU
1058 echo "I presume that if # doesn't work, #! won't work either!"
1059 sharpbang=': use '
1060fi
1061rm -f try today
1062
1063: figure out how to guarantee sh startup
8ff267be 1064case "$startsh" in
1065'') startsh=${sharpbang}${sh} ;;
1066*)
760ac839 1067esac
760ac839
LW
1068cat >try <<EOSS
1069$startsh
1070set abc
1071test "$?abc" != 1
1072EOSS
1073
1074chmod +x try
1075$eunicefix try
1076if ./try; then
8ff267be 1077 : echo "Yup, it does."
760ac839 1078else
dfe9444c
AD
1079 echo "Hmm... '$startsh' does not guarantee sh startup..."
1080 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1081fi
1082rm -f try
1083
aebf16e7
AD
1084
1085: Save command line options in file UU/cmdline.opt for later use in
1086: generating config.sh.
1087cat > cmdline.opt <<EOSH
1088# Configure command line arguments.
1089config_arg0='$0'
1090config_args='$*'
1091config_argc=$#
1092EOSH
1093argn=1
1094for arg in "$@"; do
1095 cat >>cmdline.opt <<EOSH
1096config_arg$argn='$arg'
1097EOSH
1098 argn=`expr $argn + 1`
1099done
1100
2304df62
AD
1101: produce awk script to parse command line options
1102cat >options.awk <<'EOF'
1103BEGIN {
02e93a22 1104 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1105
1106 len = length(optstr);
1107 for (i = 1; i <= len; i++) {
1108 c = substr(optstr, i, 1);
1109 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1110 if (a == ":") {
1111 arg[c] = 1;
1112 i++;
1113 }
1114 opt[c] = 1;
1115 }
1116}
1117{
1118 expect = 0;
1119 str = $0;
1120 if (substr(str, 1, 1) != "-") {
1121 printf("'%s'\n", str);
1122 next;
1123 }
1124 len = length($0);
1125 for (i = 2; i <= len; i++) {
1126 c = substr(str, i, 1);
1127 if (!opt[c]) {
1128 printf("-%s\n", substr(str, i));
1129 next;
1130 }
1131 printf("-%s\n", c);
1132 if (arg[c]) {
1133 if (i < len)
1134 printf("'%s'\n", substr(str, i + 1));
1135 else
1136 expect = 1;
1137 next;
1138 }
1139 }
1140}
1141END {
1142 if (expect)
1143 print "?";
1144}
1145EOF
1146
1147: process the command line options
4633a7c4
LW
1148set X `for arg in "$@"; do echo "X$arg"; done |
1149 sed -e s/X// | awk -f options.awk`
2304df62
AD
1150eval "set $*"
1151shift
1152rm -f options.awk
1153
1154: set up default values
1155fastread=''
1156reuseval=false
1157config_sh=''
1158alldone=''
1159error=''
1160silent=''
1161extractsh=''
ecfc5424 1162override=''
16d20bd9 1163knowitall=''
02e93a22 1164rm -f optdef.sh posthint.sh
28757baa 1165cat >optdef.sh <<EOS
1166$startsh
1167EOS
2304df62 1168
dfe9444c 1169
2304df62
AD
1170: option parsing
1171while test $# -gt 0; do
1172 case "$1" in
1173 -d) shift; fastread=yes;;
1174 -e) shift; alldone=cont;;
1175 -f)
1176 shift
1177 cd ..
1178 if test -r "$1"; then
1179 config_sh="$1"
1180 else
a0d0e21e 1181 echo "$me: cannot read config file $1." >&2
2304df62
AD
1182 error=true
1183 fi
1184 cd UU
1185 shift;;
1186 -h) shift; error=true;;
1187 -r) shift; reuseval=true;;
dfe9444c 1188 -s) shift; silent=true; realsilent=true;;
2304df62 1189 -E) shift; alldone=exit;;
16d20bd9 1190 -K) shift; knowitall=true;;
ecfc5424 1191 -O) shift; override=true;;
dfe9444c 1192 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1193 -D)
1194 shift
1195 case "$1" in
1196 *=)
1197 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1198 echo "$me: ignoring -D $1" >&2
1199 ;;
ecfc5424 1200 *=*) echo "$1" | \
1aef975c
AD
1201 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1202 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1203 esac
1204 shift
1205 ;;
1206 -U)
1207 shift
1208 case "$1" in
1aef975c 1209 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1210 *=*)
1211 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1212 echo "$me: ignoring -U $1" >&2
1213 ;;
1aef975c 1214 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1215 esac
1216 shift
1217 ;;
02e93a22
JH
1218 -A)
1219 shift
1220 xxx=''
1221 yyy="$1"
1222 case "$yyy" in
1223 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1224 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1225 ;;
1226 esac
1227 case "$xxx" in
1228 '') xxx=define ;;
1229 esac
1230 zzz=''
1231 uuu='undef'
1232 case "$yyy" in
1233 *=*) zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1234 yyy=`echo $yyy|sed 's!=.*!!'`
1235 case "$yyy:$zzz" in
1236 undef:) uuu='' ;;
1237 esac
1238 ;;
1239 esac
1240 case "$xxx" in
1241 append)
1242 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh
1243 ;;
1244 clear)
1245 echo "$yyy=''" >> posthint.sh
1246 ;;
1247 define)
1248 case "$zzz" in
1249 '') zzz=define ;;
1250 esac
1251 echo "$yyy='$zzz'" >> posthint.sh
1252 ;;
1253 eval)
1254 echo "eval \"$yyy=$zzz\"" >> posthint.sh
1255 ;;
1256 prepend)
1257 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh
1258 ;;
1259 undef)
1260 case "$zzz" in
1261 '') zzz="$uuu" ;;
1262 esac
1263 echo "$yyy=$zzz" >> posthint.sh
1264 ;;
1265 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2
1266 ;;
1267 esac
1268 ;;
dfe9444c 1269 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
2304df62
AD
1270 exit 0;;
1271 --) break;;
a0d0e21e 1272 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1273 *) break;;
1274 esac
1275done
1276
1277case "$error" in
1278true)
1279 cat >&2 <<EOM
2afac517 1280Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1281 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1282 -d : use defaults for all answers.
1283 -e : go on without questioning past the production of config.sh.
1284 -f : specify an alternate default configuration file.
1285 -h : print this help message and exit (with an error status).
1286 -r : reuse C symbols value if possible (skips costly nm extraction).
1287 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1288 -D : define symbol to have some value:
1289 -D symbol symbol gets the value 'define'
1290 -D symbol=value symbol gets the value 'value'
2304df62 1291 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1292 -K : do not use unless you know what you are doing.
ecfc5424 1293 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1294 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1295 -U : undefine symbol:
1296 -U symbol symbol gets the value 'undef'
1297 -U symbol= symbol gets completely empty
02e93a22
JH
1298 -A : manipulate symbol after the platform specific hints have been applied:
1299 -A append:symbol=value append value to symbol
1300 -A define:symbol=value define symbol to have value
1301 -A symbol=value define symbol to have value
1302 -A clear:symbol define symbol to be ''
1303 -A define:symbol define symbol to be 'define'
1304 -A eval:symbol=value define symbol to be eval of value
1305 -A prepend:symbol=value prepend value to symbol
1306 -A undef:symbol define symbol to be 'undef'
1307 -A undef:symbol= define symbol to be ''
2304df62
AD
1308 -V : print version number and exit (with a zero status).
1309EOM
1310 exit 1
1311 ;;
1312esac
1313
dfe9444c
AD
1314: Sanity checks
1315case "$fastread$alldone" in
1316yescont|yesexit) ;;
1317*)
1318 if test ! -t 0; then
1319 echo "Say 'sh Configure', not 'sh <Configure'"
1320 exit 1
1321 fi
1322 ;;
1323esac
1324
2304df62
AD
1325exec 4>&1
1326case "$silent" in
1327true) exec 1>/dev/null;;
1328esac
1329
ecfc5424 1330: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1331touch optdef.sh
1332. ./optdef.sh
02e93a22
JH
1333: create the posthint manipulation script and leave the file out there...
1334touch posthint.sh
1335. ./posthint.sh
a0d0e21e 1336
2304df62 1337: set package name
85e6fe83 1338package=perl5
1aef975c
AD
1339first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1340last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1341case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1342ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1343*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1344esac
2304df62 1345
2304df62
AD
1346: Some greps do not return status, grrr.
1347echo "grimblepritz" >grimble
1348if grep blurfldyick grimble >/dev/null 2>&1 ; then
1349 contains=contains
1350elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1351 contains=grep
1352else
1353 contains=contains
1354fi
1355rm -f grimble
1356: the following should work in any shell
1357case "$contains" in
1358contains*)
1359 echo " "
1360 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1361 cat >contains <<'EOSS'
1362grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1363EOSS
1364chmod +x contains
1365esac
1366
dfe9444c
AD
1367: Find the path to the source tree
1368case "$src" in
1369'') case "$0" in
b233458b
JH
1370 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1371 case "$src" in
1372 /*) ;;
1373 *) src=`cd ../$src && pwd` ;;
1374 esac
1375 ;;
dfe9444c
AD
1376 *) src='.';;
1377 esac;;
1378esac
1379case "$src" in
1380'') src=/
1381 rsrc=/
1382 ;;
1383/*) rsrc="$src";;
1384*) rsrc="../$src";;
1385esac
1386if test -f $rsrc/Configure && \
1387 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1388then
1389 : found it, so we are ok.
1390else
1391 rsrc=''
1392 for src in . .. ../.. ../../.. ../../../..; do
1393 if test -f ../$src/Configure && \
1394 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1395 then
1396 rsrc=../$src
1397 break
1398 fi
1399 done
1400fi
1401case "$rsrc" in
1402'')
1403 cat <<EOM >&4
1404
1405Sorry, I can't seem to locate the source dir for $package. Please start
1406Configure with an explicit path -- i.e. /some/path/Configure.
1407
1408EOM
1409 exit 1
1410 ;;
1411../.) rsrc='..';;
1412*)
1413 echo " "
1414 echo "Sources for $package found in \"$src\"." >&4
1415 ;;
1416esac
1417
1418: script used to extract .SH files with variable substitutions
1419cat >extract <<'EOS'
2000072c 1420CONFIGDOTSH=true
dfe9444c
AD
1421echo "Doing variable substitutions on .SH files..."
1422if test -f $src/MANIFEST; then
f7ab18e9 1423 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1424else
1425 echo "(Looking for .SH files under the source directory.)"
1426 set x `(cd $src; find . -name "*.SH" -print)`
1427fi
1428shift
1429case $# in
14300) set x `(cd $src; echo *.SH)`; shift;;
1431esac
1432if test ! -f $src/$1; then
1433 shift
1434fi
1435mkdir_p='
1436name=$1;
1437create="";
1438while test $name; do
1439 if test ! -d "$name"; then
1440 create="$name $create";
1441 name=`echo $name | sed -e "s|^[^/]*$||"`;
1442 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1443 else
1444 name="";
1445 fi;
1446done;
1447for file in $create; do
1448 mkdir $file;
1449done
1450'
1451for file in $*; do
1452 case "$src" in
1453 ".")
1454 case "$file" in
1455 */*)
1456 dir=`expr X$file : 'X\(.*\)/'`
1457 file=`expr X$file : 'X.*/\(.*\)'`
1458 (cd $dir && . ./$file)
1459 ;;
1460 *)
1461 . ./$file
1462 ;;
1463 esac
1464 ;;
1465 *)
1466 case "$file" in
1467 */*)
1468 dir=`expr X$file : 'X\(.*\)/'`
1469 file=`expr X$file : 'X.*/\(.*\)'`
1470 (set x $dir; shift; eval $mkdir_p)
1471 sh <$src/$dir/$file
1472 ;;
1473 *)
1474 sh <$src/$file
1475 ;;
1476 esac
1477 ;;
1478 esac
1479done
1480if test -f $src/config_h.SH; then
1481 if test ! -f config.h; then
1482 : oops, they left it out of MANIFEST, probably, so do it anyway.
1483 . $src/config_h.SH
1484 fi
1485fi
1486EOS
1487
1488: extract files and exit if asked to do so
1489case "$extractsh" in
1490true)
1491 case "$realsilent" in
1492 true) ;;
1493 *) exec 1>&4;;
1494 esac
1495 case "$config_sh" in
1496 '') config_sh='config.sh';;
1497 esac
1498 echo " "
1499 echo "Fetching answers from $config_sh..."
1500 cd ..
1501 . $config_sh
1502 test "$override" && . ./optdef.sh
1503 echo " "
1504 . UU/extract
1505 rm -rf UU
1506 echo "Done."
1507 exit 0
1508 ;;
1509esac
1510
1511: Eunice requires " " instead of "", can you believe it
1512echo " "
1513: Here we go...
1514echo "Beginning of configuration questions for $package."
1515
1516trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1517
2304df62
AD
1518: first determine how to suppress newline on echo command
1519echo " "
1520echo "Checking echo to see how to suppress newlines..."
1521(echo "hi there\c" ; echo " ") >.echotmp
1522if $contains c .echotmp >/dev/null 2>&1 ; then
1523 echo "...using -n."
1524 n='-n'
1525 c=''
1526else
1527 cat <<'EOM'
1528...using \c
1529EOM
1530 n=''
1531 c='\c'
1532fi
1533echo $n "The star should be here-->$c"
1534echo '*'
1535rm -f .echotmp
1536
1537: Now test for existence of everything in MANIFEST
1538echo " "
dfe9444c 1539if test -f $rsrc/MANIFEST; then
2304df62 1540 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1541 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1542 rm -f missing
dfe9444c 1543 tmppwd=`pwd`
2304df62 1544 for filelist in x??; do
dfe9444c 1545 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1546 done
1547 if test -s missing; then
1548 cat missing >&4
1549 cat >&4 <<'EOM'
1550
1551THIS PACKAGE SEEMS TO BE INCOMPLETE.
1552
1553You have the option of continuing the configuration process, despite the
1554distinct possibility that your kit is damaged, by typing 'y'es. If you
1555do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1556and contact the author (perlbug@perl.com).
2304df62
AD
1557
1558EOM
1559 echo $n "Continue? [n] $c" >&4
1560 read ans
1561 case "$ans" in
1562 y*)
1563 echo "Continuing..." >&4
1564 rm -f missing
1565 ;;
1566 *)
1567 echo "ABORTING..." >&4
1568 kill $$
1569 ;;
1570 esac
1571 else
dfe9444c 1572 echo "Looks good..."
2304df62
AD
1573 fi
1574else
1575 echo "There is no MANIFEST file. I hope your kit is complete !"
1576fi
1577rm -f missing x??
1578
5ff3f7a4
GS
1579echo " "
1580: Find the appropriate value for a newline for tr
1581if test -n "$DJGPP"; then
1582 trnl='\012'
1583fi
1584if test X"$trnl" = X; then
1585 case "`echo foo|tr '\n' x 2>/dev/null`" in
1586 foox) trnl='\n' ;;
1587 esac
1588fi
1589if test X"$trnl" = X; then
1590 case "`echo foo|tr '\012' x 2>/dev/null`" in
1591 foox) trnl='\012' ;;
1592 esac
1593fi
1594if test X"$trnl" = X; then
1595 cat <<EOM >&2
1596
1597$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1598
1599EOM
1600 exit 1
1601fi
1602
2304df62
AD
1603: compute the number of columns on the terminal for proper question formatting
1604case "$COLUMNS" in
1605'') COLUMNS='80';;
1606esac
1607
1608: set up the echo used in my read
1609myecho="case \"\$xxxm\" in
1610'') echo $n \"\$rp $c\" >&4;;
1611*) case \"\$rp\" in
1612 '') echo $n \"[\$xxxm] $c\";;
1613 *)
1614 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1615 echo \"\$rp\" >&4
1616 echo $n \"[\$xxxm] $c\" >&4
1617 else
1618 echo $n \"\$rp [\$xxxm] $c\" >&4
1619 fi
1620 ;;
1621 esac;;
1622esac"
1623
1624: now set up to do reads with possible shell escape and default assignment
1625cat <<EOSC >myread
28757baa 1626$startsh
2304df62
AD
1627xxxm=\$dflt
1628$myecho
1629ans='!'
1630case "\$fastread" in
1631yes) case "\$dflt" in
1632 '') ;;
1633 *) ans='';
1634 case "\$silent-\$rp" in
1635 true-) ;;
1636 *) echo " " >&4;;
1637 esac;;
1638 esac;;
1639*) case "\$silent" in
1640 true) case "\$rp" in
1641 '') ans='';;
1642 esac;;
1643 esac;;
1644esac
1645while expr "X\$ans" : "X!" >/dev/null; do
1646 read answ
1647 set x \$xxxm
1648 shift
dfe9444c 1649 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1650 case "\$answ" in
dfe9444c
AD
1651 "!")
1652 sh 1>&4
1653 echo " "
1654 $myecho
1655 ;;
1656 !*)
1657 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1658 shift
1659 sh 1>&4 -c "\$*"
1660 echo " "
1661 $myecho
1662 ;;
2304df62
AD
1663 "\$ans")
1664 case "\$ans" in
ecfc5424
AD
1665 \\&*)
1666 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1667 shift
1668 case "\$1" in
1669 -d)
1670 fastread=yes
40a7a20a 1671 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1672 ;;
1673 -*)
40a7a20a 1674 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1675 ;;
1676 esac
1677 $myecho
1678 ans=!
1679 ;;
2304df62
AD
1680 esac;;
1681 *)
1682 case "\$aok" in
1683 y)
1684 echo "*** Substitution done -- please confirm."
1685 xxxm="\$ans"
c9795ab7 1686 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1687 xxxm="\$ans"
1688 ans=!
1689 ;;
1690 *)
1691 echo "*** Error -- try again."
1692 ans=!
1693 ;;
1694 esac
1695 $myecho
1696 ;;
1697 esac
1698 case "\$ans\$xxxm\$nostick" in
1699 '')
1700 ans=!
1701 $myecho
1702 ;;
1703 esac
1704done
1705case "\$ans" in
1706'') ans="\$xxxm";;
1707esac
1708EOSC
1709
1710: create .config dir to save info across Configure sessions
1711test -d ../.config || mkdir ../.config
1712cat >../.config/README <<EOF
1713This directory created by Configure to save information that should
dfe9444c 1714persist across sessions for $package.
2304df62
AD
1715
1716You may safely delete it if you wish.
1717EOF
1718
1719: general instructions
1720needman=true
1721firsttime=true
760ac839 1722user=`(logname) 2>/dev/null`
dfe9444c
AD
1723case "$user" in
1724'') user=`whoami 2>&1`;;
760ac839 1725esac
2304df62
AD
1726if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1727 firsttime=false
1728 echo " "
1729 rp='Would you like to see the instructions?'
1730 dflt=n
1731 . ./myread
1732 case "$ans" in
1733 [yY]*) ;;
1734 *) needman=false;;
1735 esac
1736fi
1737if $needman; then
1738 cat <<EOH
4e2a5f63 1739
2304df62 1740This installation shell script will examine your system and ask you questions
a0d0e21e 1741to determine how the perl5 package should be installed. If you get
2304df62
AD
1742stuck on a question, you may use a ! shell escape to start a subshell or
1743execute a command. Many of the questions will have default answers in square
1744brackets; typing carriage return will give you the default.
1745
1746On some of the questions which ask for file or directory names you are allowed
1747to use the ~name construct to specify the login directory belonging to "name",
1748even if you don't have a shell which knows about that. Questions where this is
1749allowed will be marked "(~name ok)".
1750
1751EOH
1752 rp=''
1753 dflt='Type carriage return to continue'
1754 . ./myread
1755 cat <<'EOH'
1756
1757The prompter used in this script allows you to use shell variables and
1758backticks in your answers. You may use $1, $2, etc... to refer to the words
1759in the default answer, as if the default line was a set of arguments given to a
1760script shell. This means you may also use $* to repeat the whole default line,
1761so you do not have to re-type everything to add something to the default.
1762
1763Everytime there is a substitution, you will have to confirm. If there is an
1764error (e.g. an unmatched backtick), the default answer will remain unchanged
1765and you will be prompted again.
1766
1767If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1768the questions and use the computed defaults (or the previous answers if there
1769was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1770You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1771on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1772
1773EOH
1774 . ./myread
1775 cat <<EOH
1776
1777Much effort has been expended to ensure that this shell script will run on any
1778Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1779Configure and run it again. If you can't run Configure for some reason,
1780you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1781have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1782
1783This installation script affects things in two ways:
1784
17851) it may do direct variable substitutions on some of the files included
1786 in this kit.
17872) it builds a config.h file for inclusion in C programs. You may edit
1788 any of these files as the need arises after running this script.
1789
1790If you make a mistake on a question, there is no easy way to back up to it
1791currently. The easiest thing to do is to edit config.sh and rerun all the SH
1792files. Configure will offer to let you do this before it runs the SH files.
1793
1794EOH
1795 dflt='Type carriage return to continue'
1796 . ./myread
1797 case "$firsttime" in
1798 true) echo $user >>../.config/instruct;;
1799 esac
1800fi
1801
2304df62
AD
1802: find out where common programs are
1803echo " "
1804echo "Locating common programs..." >&4
1805cat <<EOSC >loc
1806$startsh
1807case \$# in
18080) exit 1;;
1809esac
1810thing=\$1
1811shift
1812dflt=\$1
1813shift
1814for dir in \$*; do
1815 case "\$thing" in
1816 .)
1817 if test -d \$dir/\$thing; then
1818 echo \$dir
1819 exit 0
1820 fi
1821 ;;
1822 *)
a0d0e21e 1823 for thisthing in \$dir/\$thing; do
ecfc5424 1824 : just loop through to pick last item
a0d0e21e 1825 done
25f94b33 1826 if test -f \$thisthing; then
a0d0e21e 1827 echo \$thisthing
2304df62
AD
1828 exit 0
1829 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1830 if test -n "$DJGPP"; then
1831 echo \$dir/\$thing.exe
1832 else
1833 : on Eunice apparently
1834 echo \$dir/\$thing
1835 fi
2304df62
AD
1836 exit 0
1837 fi
1838 ;;
1839 esac
1840done
1841echo \$dflt
1842exit 1
1843EOSC
1844chmod +x loc
1845$eunicefix loc
1846loclist="
1847awk
1848cat
ecfc5424 1849comm
2304df62
AD
1850cp
1851echo
1852expr
1853grep
a0d0e21e 1854ls
dfe9444c 1855make
2304df62 1856mkdir
2304df62
AD
1857rm
1858sed
1859sort
85e6fe83 1860touch
2304df62
AD
1861tr
1862uniq
1863"
1864trylist="
1865Mcc
dfe9444c 1866ar
2304df62
AD
1867byacc
1868cpp
1869csh
1870date
1871egrep
8ff267be 1872gzip
2c7991dc 1873less
8ff267be 1874ln
2c7991dc 1875more
693762b4 1876nm
2304df62 1877nroff
2c7991dc 1878pg
2304df62
AD
1879test
1880uname
8ff267be 1881zip
2304df62 1882"
8e07c86e 1883pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1884pth="$pth /lib /usr/lib"
1885for file in $loclist; do
dfe9444c
AD
1886 eval xxx=\$$file
1887 case "$xxx" in
1888 /*|?:[\\/]*)
1889 if test -f "$xxx"; then
1890 : ok
1891 else
1892 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1893 xxx=`./loc $file $file $pth`
1894 fi
1895 ;;
1896 '') xxx=`./loc $file $file $pth`;;
1897 *) xxx=`./loc $xxx $xxx $pth`;;
1898 esac
2304df62
AD
1899 eval $file=$xxx
1900 eval _$file=$xxx
1901 case "$xxx" in
1902 /*)
1903 echo $file is in $xxx.
1904 ;;
8e07c86e
AD
1905 ?:[\\/]*)
1906 echo $file is in $xxx.
1907 ;;
2304df62 1908 *)
25f94b33
AD
1909 echo "I don't know where '$file' is, and my life depends on it." >&4
1910 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1911 exit 1
2304df62
AD
1912 ;;
1913 esac
1914done
1915echo " "
1916echo "Don't worry if any of the following aren't found..."
1917say=offhand
1918for file in $trylist; do
dfe9444c
AD
1919 eval xxx=\$$file
1920 case "$xxx" in
1921 /*|?:[\\/]*)
1922 if test -f "$xxx"; then
1923 : ok
1924 else
1925 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1926 xxx=`./loc $file $file $pth`
1927 fi
1928 ;;
1929 '') xxx=`./loc $file $file $pth`;;
1930 *) xxx=`./loc $xxx $xxx $pth`;;
1931 esac
2304df62
AD
1932 eval $file=$xxx
1933 eval _$file=$xxx
1934 case "$xxx" in
1935 /*)
1936 echo $file is in $xxx.
1937 ;;
8e07c86e
AD
1938 ?:[\\/]*)
1939 echo $file is in $xxx.
1940 ;;
2304df62
AD
1941 *)
1942 echo "I don't see $file out there, $say."
1943 say=either
1944 ;;
1945 esac
1946done
1947case "$egrep" in
1948egrep)
1949 echo "Substituting grep for egrep."
1950 egrep=$grep
1951 ;;
1952esac
8ff267be 1953case "$ln" in
1954ln)
1955 echo "Substituting cp for ln."
1956 ln=$cp
1957 ;;
1958esac
2304df62
AD
1959case "$test" in
1960test)
1961 echo "Hopefully test is built into your sh."
1962 ;;
1963*)
ecfc5424 1964 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1965 echo "Using the test built into your sh."
1966 test=test
1967 _test=test
1968 fi
1969 ;;
1970esac
1971case "$echo" in
1972echo)
1973 echo "Hopefully echo is built into your sh."
1974 ;;
1975'') ;;
1976*)
1977 echo " "
1978echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1979 $echo $n "hi there$c" >foo1
1980 echo $n "hi there$c" >foo2
1981 if cmp foo1 foo2 >/dev/null 2>&1; then
1982 echo "They are compatible. In fact, they may be identical."
1983 else
1984 case "$n" in
1985 '-n') n='' c='\c';;
1986 *) n='-n' c='';;
1987 esac
1988 cat <<FOO
1989They are not compatible! You are probably running ksh on a non-USG system.
1990I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1991have echo built in and we may have to run some Bourne shell scripts. That
1992means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1993
1994FOO
1995 $echo $n "The star should be here-->$c"
1996 $echo "*"
1997 fi
1998 $rm -f foo1 foo2
1999 ;;
2000esac
2001
a0d0e21e
LW
2002: determine whether symbolic links are supported
2003echo " "
2004$touch blurfl
2005if $ln -s blurfl sym > /dev/null 2>&1 ; then
2006 echo "Symbolic links are supported." >&4
2007 lns="$ln -s"
2008else
2009 echo "Symbolic links are NOT supported." >&4
2010 lns="$ln"
2011fi
2012$rm -f blurfl sym
2013
ecfc5424
AD
2014: see whether [:lower:] and [:upper:] are supported character classes
2015echo " "
ecfc5424
AD
2016case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2017ABYZ)
2018 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2019 up='[:upper:]'
2020 low='[:lower:]'
2021 ;;
28e8609d
JH
2022*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2023 # (0xc9 and 0xd1), therefore that is a nice testing point.
2024 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2025 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2026 ij) up='[A-Z]'
2027 low='[a-z]'
2028 ;;
2029 esac
2030 fi
2031 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2032 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2033 ij) up='A-Z'
2034 low='a-z'
2035 ;;
2036 esac
2037 fi
2038 if test "X$up" = X -o "X$low" = X; then
2039 case "`echo IJ | od -x 2>/dev/null`" in
2040 *C9D1*|*c9d1*)
2041 echo "Hey, this might be EBCDIC." >&4
2042 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2043 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2044 ij) up='[A-IJ-RS-Z]'
2045 low='[a-ij-rs-z]'
2046 ;;
2047 esac
2048 fi
2049 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2050 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2051 ij) up='A-IJ-RS-Z'
2052 low='a-ij-rs-z'
2053 ;;
2054 esac
2055 fi
2056 ;;
2057 esac
2058 fi
2059esac
3eaeeeae 2060case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2061ij)
2062 echo "Using $up and $low to convert case." >&4
2063 ;;
ecfc5424 2064*)
28e8609d
JH
2065 echo "I don't know how to translate letters from upper to lower case." >&4
2066 echo "Your tr is not acting any way I know of." >&4
2067 exit 1
2068 ;;
ecfc5424
AD
2069esac
2070: set up the translation script tr, must be called with ./tr of course
2071cat >tr <<EOSC
2072$startsh
2073case "\$1\$2" in
2074'[A-Z][a-z]') exec $tr '$up' '$low';;
2075'[a-z][A-Z]') exec $tr '$low' '$up';;
2076esac
2077exec $tr "\$@"
2078EOSC
2079chmod +x tr
2080$eunicefix tr
2081
2304df62
AD
2082: Try to determine whether config.sh was made on this system
2083case "$config_sh" in
2084'')
2085myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
2086# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2087# because the A-Z/a-z are not consecutive.
a0d0e21e 2088myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2089 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2090newmyuname="$myuname"
2304df62 2091dflt=n
16d20bd9
AD
2092case "$knowitall" in
2093'')
2094 if test -f ../config.sh; then
2095 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2096 eval "`grep myuname= ../config.sh`"
2097 fi
2098 if test "X$myuname" = "X$newmyuname"; then
2099 dflt=y
2100 fi
2304df62 2101 fi
16d20bd9
AD
2102 ;;
2103*) dflt=y;;
2104esac
2304df62
AD
2105
2106: Get old answers from old config file if Configure was run on the
2107: same system, otherwise use the hints.
2108hint=default
2109cd ..
2110if test -f config.sh; then
16d20bd9
AD
2111 echo " "
2112 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2113 . UU/myread
2114 case "$ans" in
2115 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2116 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2117 tmp_n="$n"
2118 tmp_c="$c"
85cad39c 2119 tmp_sh="$sh"
2304df62
AD
2120 . ./config.sh
2121 cp config.sh UU
ecfc5424
AD
2122 n="$tmp_n"
2123 c="$tmp_c"
85cad39c 2124 : Older versions did not always set $sh. Catch re-use of such
2125 : an old config.sh.
2126 case "$sh" in
2127 '') sh="$tmp_sh" ;;
2128 esac
2304df62
AD
2129 hint=previous
2130 ;;
2131 esac
2132fi
2133if test ! -f config.sh; then
2134 $cat <<EOM
2135
4e2a5f63
AD
2136First time through, eh? I have some defaults handy for some systems
2137that need some extra help getting the Configure answers right:
2304df62
AD
2138
2139EOM
dfe9444c 2140 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2141 dflt=''
2142 : Half the following guesses are probably wrong... If you have better
46193409 2143 : tests or hints, please send them to perlbug@perl.com
2304df62 2144 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2145 $test -f /irix && osname=irix
85e6fe83
LW
2146 $test -f /xenix && osname=sco_xenix
2147 $test -f /dynix && osname=dynix
2148 $test -f /dnix && osname=dnix
5f05dabc 2149 $test -f /lynx.os && osname=lynxos
2150 $test -f /unicos && osname=unicos && osvers=`$uname -r`
7a4c00b4 2151 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2152 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2153 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2154 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2155 $test -d /usr/apollo/bin && osname=apollo
2156 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2157 $test -d /usr/include/minix && osname=minix
e060872b 2158 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2159 osname=machten
4633a7c4 2160 if $test -x /sbin/version; then
dfe9444c 2161 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2162 $sed -e 's/[A-Za-z]$//'`
2163 elif $test -x /usr/etc/version; then
dfe9444c 2164 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2165 $sed -e 's/[A-Za-z]$//'`
2166 else
2167 osvers="$2.$3"
2168 fi
2169 fi
85ab1d1d
JH
2170 $test -f /sys/posix.dll &&
2171 $test -f /usr/bin/what &&
2172 set X `/usr/bin/what /sys/posix.dll` &&
2173 $test "$3" = UWIN &&
2174 osname=uwin &&
2175 osvers="$5"
2304df62
AD
2176 if $test -f $uname; then
2177 set X $myuname
2178 shift
2179
2304df62 2180 case "$5" in
85e6fe83 2181 fps*) osname=fps ;;
2304df62
AD
2182 mips*)
2183 case "$4" in
85e6fe83
LW
2184 umips) osname=umips ;;
2185 *) osname=mips ;;
2304df62 2186 esac;;
85e6fe83
LW
2187 [23]100) osname=mips ;;
2188 next*) osname=next ;;
ecfc5424 2189 i386*)
c6912327
JH
2190 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2191 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2192 osname='sco'
2193 osvers=$tmp
2194 elif $test -f /etc/kconfig; then
ecfc5424 2195 osname=isc
bd628c73 2196 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2197 osvers=4
2198 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2199 osvers=3
2304df62 2200 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2201 osvers=2
ecfc5424
AD
2202 fi
2203 fi
2000072c 2204 tmp=''
ecfc5424 2205 ;;
c4f23d77
AD
2206 pc*)
2207 if test -n "$DJGPP"; then
2208 osname=dos
2209 osvers=djgpp
2210 fi
2211 ;;
2304df62
AD
2212 esac
2213
2214 case "$1" in
a0d0e21e
LW
2215 aix) osname=aix
2216 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2217 case "$tmp" in
1aef975c 2218 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2219 '<3240'|'<>3240') osvers=3.2.0 ;;
2220 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2221 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2222 *) osvers=$tmp;;
a0d0e21e
LW
2223 esac
2224 ;;
23f87696
SZ
2225 *dc.osx) osname=dcosx
2226 osvers="$3"
2227 ;;
a0d0e21e
LW
2228 dnix) osname=dnix
2229 osvers="$3"
2230 ;;
2231 domainos) osname=apollo
2232 osvers="$3"
2233 ;;
2234 dgux) osname=dgux
2235 osvers="$3"
2236 ;;
760ac839 2237 dynixptx*) osname=dynixptx
e58e581d 2238 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2239 ;;
a0d0e21e
LW
2240 freebsd) osname=freebsd
2241 osvers="$3" ;;
2242 genix) osname=genix ;;
2243 hp*) osname=hpux
bfb7748a 2244 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2245 ;;
a78b0d02 2246 irix*) osname=irix
a0d0e21e
LW
2247 case "$3" in
2248 4*) osvers=4 ;;
2249 5*) osvers=5 ;;
ecfc5424 2250 *) osvers="$3" ;;
a0d0e21e
LW
2251 esac
2252 ;;
2253 linux) osname=linux
2254 case "$3" in
a0d0e21e
LW
2255 *) osvers="$3" ;;
2256 esac
2257 ;;
28e8609d
JH
2258 MiNT) osname=mint
2259 ;;
2260 netbsd*) osname=netbsd
ecfc5424
AD
2261 osvers="$3"
2262 ;;
4e81affe
MM
2263 news-os) osvers="$3"
2264 case "$3" in
2265 4*) osname=newsos4 ;;
2266 *) osname=newsos ;;
2267 esac
2268 ;;
a0d0e21e
LW
2269 bsd386) osname=bsd386
2270 osvers=`$uname -r`
2271 ;;
a1a0e61e
TD
2272 POSIX-BC | posix-bc ) osname=posix-bc
2273 osvers="$3"
2274 ;;
ae3afa4e
TH
2275 powerux | power_ux | powermax_os | powermaxos | \
2276 powerunix | power_unix) osname=powerux
2277 osvers="$3"
2278 ;;
a0d0e21e
LW
2279 next*) osname=next ;;
2280 solaris) osname=solaris
2281 case "$3" in
2282 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2283 *) osvers="$3" ;;
a0d0e21e
LW
2284 esac
2285 ;;
85e6fe83
LW
2286 sunos) osname=sunos
2287 case "$3" in
85e6fe83
LW
2288 5*) osname=solaris
2289 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2290 *) osvers="$3" ;;
2304df62
AD
2291 esac
2292 ;;
a0d0e21e 2293 titanos) osname=titanos
85e6fe83 2294 case "$3" in
a0d0e21e
LW
2295 1*) osvers=1 ;;
2296 2*) osvers=2 ;;
2297 3*) osvers=3 ;;
2298 4*) osvers=4 ;;
ecfc5424 2299 *) osvers="$3" ;;
2304df62
AD
2300 esac
2301 ;;
85e6fe83 2302 ultrix) osname=ultrix
ecfc5424 2303 osvers="$3"
2304df62 2304 ;;
28757baa 2305 osf1|mls+) case "$5" in
fed7345c
AD
2306 alpha)
2307 osname=dec_osf
313489a2 2308 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2309 ;;
2310 hp*) osname=hp_osf1 ;;
2311 mips) osname=mips_osf1 ;;
85e6fe83
LW
2312 esac
2313 ;;
a0d0e21e
LW
2314 uts) osname=uts
2315 osvers="$3"
2316 ;;
ff68c719 2317 qnx) osname=qnx
2318 osvers="$4"
2319 ;;
85e6fe83 2320 $2) case "$osname" in
2304df62 2321 *isc*) ;;
a0d0e21e 2322 *freebsd*) ;;
5f05dabc 2323 svr*)
a0d0e21e
LW
2324 : svr4.x or possibly later
2325 case "svr$3" in
2326 ${osname}*)
2327 osname=svr$3
2328 osvers=$4
2329 ;;
2330 esac
2331 case "$osname" in
2332 svr4.0)
2333 : Check for ESIX
2334 if test -f /stand/boot ; then
2335 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2336 if test -n "$INITPROG" -a -f "$INITPROG"; then
2337 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2338 if test -n "$isesix"; then
a0d0e21e
LW
2339 osname=esix4
2340 fi
2341 fi
2342 fi
2343 ;;
2344 esac
2345 ;;
2304df62 2346 *) if test -f /etc/systemid; then
a0d0e21e
LW
2347 osname=sco
2348 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2349 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2350 osvers=$1.$2.$3
c4f23d77 2351 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2352 osvers=$1.$2
c4f23d77 2353 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2354 osvers=$1
2304df62 2355 fi
a0d0e21e
LW
2356 else
2357 case "$osname" in
2358 '') : Still unknown. Probably a generic Sys V.
2359 osname="sysv"
2360 osvers="$3"
2361 ;;
2362 esac
2304df62
AD
2363 fi
2364 ;;
2365 esac
2366 ;;
a0d0e21e
LW
2367 *) case "$osname" in
2368 '') : Still unknown. Probably a generic BSD.
2369 osname="$1"
2370 osvers="$3"
2371 ;;
2372 esac
2373 ;;
2304df62
AD
2374 esac
2375 else
dfe9444c
AD
2376 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2377 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2378 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2379 osname=news_os
2304df62 2380 fi
dfe9444c 2381 $rm -f UU/kernel.what
8e07c86e
AD
2382 elif test -d c:/.; then
2383 set X $myuname
2384 osname=os2
2385 osvers="$5"
2304df62
AD
2386 fi
2387 fi
85e6fe83 2388
a0d0e21e
LW
2389 : Now look for a hint file osname_osvers, unless one has been
2390 : specified already.
2391 case "$hintfile" in
2392 ''|' ')
ecfc5424 2393 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2394 : Also try without trailing minor version numbers.
ecfc5424
AD
2395 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2396 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2397 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2398 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2399 case "$file" in
2400 '') dflt=none ;;
2401 *) case "$osvers" in
2402 '') dflt=$file
2403 ;;
dfe9444c 2404 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2405 dflt=$file
dfe9444c 2406 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2407 dflt=$xfile
dfe9444c 2408 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2409 dflt=$xxfile
dfe9444c 2410 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2411 dflt=$xxxfile
dfe9444c 2412 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2413 dflt=$xxxxfile
dfe9444c 2414 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2415 dflt="${osname}"
2416 else
2417 dflt=none
2418 fi
2419 ;;
2420 esac
85e6fe83
LW
2421 ;;
2422 esac
4e2a5f63
AD
2423 if $test -f Policy.sh ; then
2424 case "$dflt" in
2425 *Policy*) ;;
2426 none) dflt="Policy" ;;
2427 *) dflt="Policy $dflt" ;;
2428 esac
2429 fi
85e6fe83 2430 ;;
a0d0e21e 2431 *)
ecfc5424 2432 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2433 ;;
2304df62 2434 esac
1aef975c 2435
4e2a5f63
AD
2436 if $test -f Policy.sh ; then
2437 $cat <<EOM
2438
2439There's also a Policy hint file available, which should make the
2440site-specific (policy) questions easier to answer.
2441EOM
2442
2443 fi
2444
2304df62
AD
2445 $cat <<EOM
2446
2447You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2448A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2449is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2450
2451EOM
4e2a5f63 2452
2304df62 2453 rp="Which of these apply, if any?"
dfe9444c 2454 . UU/myread
85e6fe83
LW
2455 tans=$ans
2456 for file in $tans; do
4e2a5f63
AD
2457 if $test X$file = XPolicy -a -f Policy.sh; then
2458 . Policy.sh
2459 $cat Policy.sh >> UU/config.sh
2460 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2461 . $src/hints/$file.sh
2462 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2463 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2464 : nothing
2465 else
85e6fe83
LW
2466 : Give one chance to correct a possible typo.
2467 echo "$file.sh does not exist"
2468 dflt=$file
2469 rp="hint to use instead?"
dfe9444c 2470 . UU/myread
85e6fe83 2471 for file in $ans; do
dfe9444c
AD
2472 if $test -f "$src/hints/$file.sh"; then
2473 . $src/hints/$file.sh
2474 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2475 elif $test X$ans = X -o X$ans = Xnone ; then
2476 : nothing
2477 else
2478 echo "$file.sh does not exist -- ignored."
2479 fi
2480 done
2304df62
AD
2481 fi
2482 done
85e6fe83 2483
2304df62 2484 hint=recommended
85e6fe83 2485 : Remember our hint file for later.
dfe9444c 2486 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2487 hintfile="$file"
85e6fe83 2488 else
a0d0e21e 2489 hintfile=''
85e6fe83 2490 fi
2304df62
AD
2491fi
2492cd UU
2493;;
2494*)
2495 echo " "
2496 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2497 tmp_n="$n"
2498 tmp_c="$c"
2304df62
AD
2499 cd ..
2500 cp $config_sh config.sh 2>/dev/null
a78b0d02 2501 chmod +w config.sh
2304df62
AD
2502 . ./config.sh
2503 cd UU
2504 cp ../config.sh .
ecfc5424
AD
2505 n="$tmp_n"
2506 c="$tmp_c"
2304df62
AD
2507 hint=previous
2508 ;;
2509esac
1aef975c
AD
2510test "$override" && . ./optdef.sh
2511myuname="$newmyuname"
2304df62
AD
2512
2513: Restore computed paths
2514for file in $loclist $trylist; do
2515 eval $file="\$_$file"
2516done
2517
85e6fe83 2518cat << EOM
a0d0e21e 2519
85e6fe83 2520Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2521The default value is probably right if the name rings a bell. Otherwise,
2522since spelling matters for me, either accept the default or answer "none"
2523to leave it blank.
a0d0e21e 2524
85e6fe83 2525EOM
85e6fe83 2526case "$osname" in
a0d0e21e 2527 ''|' ')
85e6fe83 2528 case "$hintfile" in
a0d0e21e 2529 ''|' '|none) dflt=none ;;
ecfc5424 2530 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2531 esac
2532 ;;
2533 *) dflt="$osname" ;;
2534esac
2535rp="Operating system name?"
2536. ./myread
2537case "$ans" in
ecfc5424
AD
2538none) osname='' ;;
2539*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2540esac
8ff267be 2541echo " "
2542case "$osvers" in
2543 ''|' ')
2544 case "$hintfile" in
2545 ''|' '|none) dflt=none ;;
2546 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2547 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2548 case "$dflt" in
2549 ''|' ') dflt=none ;;
2550 esac
2551 ;;
2552 esac
2553 ;;
2554 *) dflt="$osvers" ;;
2555esac
2556rp="Operating system version?"
2557. ./myread
2558case "$ans" in
2559none) osvers='' ;;
2560*) osvers="$ans" ;;
2561esac
2562
02e93a22
JH
2563
2564. ./posthint.sh
2565
2304df62 2566: who configured the system
59b83a6f 2567cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2568cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2569case "$cf_by" in
2570"")
8ff267be 2571 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2572 case "$cf_by" in
2573 "") cf_by=unknown ;;
8ff267be 2574 esac ;;
2575esac
2304df62 2576
dfe9444c
AD
2577: set up the script used to warn in case of inconsistency
2578cat <<EOS >whoa
2579$startsh
2580EOS
2581cat <<'EOSC' >>whoa
2582dflt=y
2583echo " "
2584echo "*** WHOA THERE!!! ***" >&4
2585echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2586rp=" Keep the $hint value?"
2587. ./myread
2588case "$ans" in
2589y) td=$was; tu=$was;;
2590esac
2591EOSC
2592
2593: function used to set $1 to $val
2594setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2595case "$val$was" in
2596$define$undef) . ./whoa; eval "$var=\$td";;
2597$undef$define) . ./whoa; eval "$var=\$tu";;
2598*) eval "$var=$val";;
2599esac'
2600
64e689dc
JH
2601cat <<EOM
2602
2603Perl can be built to take advantage of threads, on some systems.
2604To do so, Configure must be run with -Dusethreads.
d00b958f
JH
2605
2606Note that threading is a highly experimental feature, and
2607some known race conditions still remain. If you choose to try
2608it, be very sure to not actually deploy it for production
2609purposes. README.threads has more details, and is required
2610reading if you enable threads.
64e689dc 2611EOM
dfe9444c 2612case "$usethreads" in
b691c02f 2613$define|true|[yY]*) dflt='y';;
64e689dc
JH
2614*) dflt='n';;
2615esac
2616rp='Build a threading Perl?'
2617. ./myread
2618case "$ans" in
b691c02f 2619y|Y) val="$define" ;;
64e689dc 2620*) val="$undef" ;;
dfe9444c 2621esac
64e689dc
JH
2622set usethreads
2623eval $setvar
104d25b7 2624
693762b4
AD
2625case "$d_oldpthreads" in
2626'') : Configure tests would be welcome here. For now, assume undef.
2627 val="$undef" ;;
2628*) val="$d_oldpthreads" ;;
2629esac
2630set d_oldpthreads
2631eval $setvar
dfe9444c 2632
b691c02f
JH
2633
2634case "$usethreads" in
104d25b7
JH
2635"$define"|true|[yY]*)
2636: Look for a hint-file generated 'call-back-unit'. If the
2637: user has specified that a threading perl is to be built,
2638: we may need to set or change some other defaults.
2639 if $test -f usethreads.cbu; then
e5e20432 2640 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2641 . ./usethreads.cbu
e5e20432
JH
2642 else
2643 $cat <<EOM
2644(Your platform doesn't have any specific hints for threaded builds.
2645 Assuming POSIX threads, then.)
b691c02f 2646EOM
e5e20432 2647 fi
b691c02f 2648 ;;
e5e20432 2649esac
104d25b7 2650
64e689dc
JH
2651cat <<EOM
2652
2653Perl can be built so that multiple Perl interpreters can coexist
2654within the same Perl executable. To do so, Configure must be run with
2655-Dusemultiplicity.
2656
2657Normally you do not need this and you should answer no.
2658
2659EOM
85ab1d1d 2660case "$usemultiplicity" in
64e689dc
JH
2661$define|true|[yY]*) dflt='y';;
2662*) dflt='n';;
85ab1d1d 2663esac
64e689dc
JH
2664rp='Build Perl for multiplicity?'
2665. ./myread
2666case "$ans" in
2667y|Y) val="$define" ;;
2668*) val="$undef" ;;
2669esac
2670set usemultiplicity
2671eval $setvar
2672
e5e20432
JH
2673: determine where manual pages are on this system
2674echo " "
2675case "$sysman" in
2676'')
2677 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2678 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2679 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2680 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2681 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2682 sysman=`./loc . /usr/man/man1 $syspath`
2683 ;;
2684esac
2685if $test -d "$sysman"; then
2686 echo "System manual is in $sysman." >&4
2687else
2688 echo "Could not find manual pages in source form." >&4
2689fi
2690
2691: see what memory models we can support
2692case "$models" in
2693'')
2694 $cat >pdp11.c <<'EOP'
2695int main() {
2696#ifdef pdp11
2697 exit(0);
2698#else
2699 exit(1);
2700#endif
2701}
2702EOP
2703 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2704 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2705 dflt='unsplit split'
2706 else
2707 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2708 case "$tans" in
2709 X) dflt='none';;
2710 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2711 dflt='small'
2712 else
2713 dflt=''
2714 fi
2715 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2716 dflt="$dflt medium"
2717 fi
2718 if $test -d /lib/large || $test -d /usr/lib/large; then
2719 dflt="$dflt large"
2720 fi
2721 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2722 dflt="$dflt huge"
2723 fi
2724 esac
2725 fi;;
2726*) dflt="$models";;
2727esac
2728$cat <<EOM
2729
2730Some systems have different model sizes. On most systems they are called
2731small, medium, large, and huge. On the PDP11 they are called unsplit and
2732split. If your system doesn't support different memory models, say "none".
2733If you wish to force everything to one memory model, say "none" here and
2734put the appropriate flags later when it asks you for other cc and ld flags.
2735Venix systems may wish to put "none" and let the compiler figure things out.
2736(In the following question multiple model names should be space separated.)
2737
2738The default for most systems is "none".
2739
2740EOM
2741rp="Which memory models are supported?"
2742. ./myread
2743models="$ans"
2744
2745case "$models" in
2746none)
2747 small=''
2748 medium=''
2749 large=''
2750 huge=''
2751 unsplit=''
2752 split=''
2753 ;;
2754*split)
2755 case "$split" in
2756 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2757 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2758 dflt='-i'
2759 else
2760 dflt='none'
2761 fi;;
2762 *) dflt="$split";;
2763 esac
2764 rp="What flag indicates separate I and D space?"
2765 . ./myread
2766 tans="$ans"
2767 case "$tans" in
2768 none) tans='';;
2769 esac
2770 split="$tans"
2771 unsplit='';;
2772*large*|*small*|*medium*|*huge*)
2773 case "$models" in
2774 *large*)
2775 case "$large" in
2776 '') dflt='-Ml';;
2777 *) dflt="$large";;
2778 esac
2779 rp="What flag indicates large model?"
2780 . ./myread
2781 tans="$ans"
2782 case "$tans" in
2783 none) tans='';
2784 esac
2785 large="$tans";;
2786 *) large='';;
2787 esac
2788 case "$models" in
2789 *huge*) case "$huge" in
2790 '') dflt='-Mh';;
2791 *) dflt="$huge";;
2792 esac
2793 rp="What flag indicates huge model?"
2794 . ./myread
2795 tans="$ans"
2796 case "$tans" in
2797 none) tans='';
2798 esac
2799 huge="$tans";;
2800 *) huge="$large";;
2801 esac
2802 case "$models" in
2803 *medium*) case "$medium" in
2804 '') dflt='-Mm';;
2805 *) dflt="$medium";;
2806 esac
2807 rp="What flag indicates medium model?"
2808 . ./myread
2809 tans="$ans"
2810 case "$tans" in
2811 none) tans='';
2812 esac
2813 medium="$tans";;
2814 *) medium="$large";;
2815 esac
2816 case "$models" in
2817 *small*) case "$small" in
2818 '') dflt='none';;
2819 *) dflt="$small";;
2820 esac
2821 rp="What flag indicates small model?"
2822 . ./myread
2823 tans="$ans"
2824 case "$tans" in
2825 none) tans='';
2826 esac
2827 small="$tans";;
2828 *) small='';;
2829 esac
2830 ;;
2831*)
2832 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2833 ;;
2834esac
2835$rm -f pdp11.* pdp11
2836
2837: make some quick guesses about what we are up against
2838echo " "
2839$echo $n "Hmm... $c"
2840echo exit 1 >bsd
2841echo exit 1 >usg
2842echo exit 1 >v7
2843echo exit 1 >osf1
2844echo exit 1 >eunice
2845echo exit 1 >xenix
2846echo exit 1 >venix
2847echo exit 1 >os2
2848d_bsd="$undef"
2849$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2850if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2851then
2852 echo "Looks kind of like an OSF/1 system, but we'll see..."
2853 echo exit 0 >osf1
2854elif test `echo abc | tr a-z A-Z` = Abc ; then
2855 xxx=`./loc addbib blurfl $pth`
2856 if $test -f $xxx; then
2857 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2858 echo exit 0 >bsd
2859 echo exit 0 >usg
2860 else
2861 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2862 echo "Looks kind of like an extended USG system, but we'll see..."
2863 else
2864 echo "Looks kind of like a USG system, but we'll see..."
2865 fi
2866 echo exit 0 >usg
2867 fi
2868elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2869 echo "Looks kind of like a BSD system, but we'll see..."
2870 d_bsd="$define"
2871 echo exit 0 >bsd
2872else
2873 echo "Looks kind of like a Version 7 system, but we'll see..."
2874 echo exit 0 >v7
2875fi
2876case "$eunicefix" in
2877*unixtovms*)
2878 $cat <<'EOI'
2879There is, however, a strange, musty smell in the air that reminds me of
2880something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2881EOI
2882 echo exit 0 >eunice
2883 d_eunice="$define"
2884: it so happens the Eunice I know will not run shell scripts in Unix format
2885 ;;
2886*)
2887 echo " "
2888 echo "Congratulations. You aren't running Eunice."
2889 d_eunice="$undef"
2890 ;;
2891esac
2892: Detect OS2. The p_ variable is set above in the Head.U unit.
2893case "$p_" in
2894:) ;;
2895*)
2896 $cat <<'EOI'
2897I have the feeling something is not exactly right, however...don't tell me...
2898lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2899EOI
2900 echo exit 0 >os2
2901 ;;
2902esac
2903if test -f /xenix; then
2904 echo "Actually, this looks more like a XENIX system..."
2905 echo exit 0 >xenix
2906 d_xenix="$define"
2907else
2908 echo " "
2909 echo "It's not Xenix..."
2910 d_xenix="$undef"
2911fi
2912chmod +x xenix
2913$eunicefix xenix
2914if test -f /venix; then
2915 echo "Actually, this looks more like a VENIX system..."
2916 echo exit 0 >venix
2917else
2918 echo " "
2919 if ./xenix; then
2920 : null
2921 else
2922 echo "Nor is it Venix..."
2923 fi
2924fi
2925chmod +x bsd usg v7 osf1 eunice xenix venix os2
2926$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2927$rm -f foo
2928
2929: see if we need a special compiler
2930echo " "
2931if ./usg; then
2932 case "$cc" in
2933 '') case "$Mcc" in
2934 /*) dflt='Mcc';;
2935 *) case "$large" in
2936 -M*) dflt='cc';;
2937 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2938 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2939 dflt='cc'
2940 else
2941 dflt='cc -M'
2942 fi
2943 else
2944 dflt='cc'
2945 fi;;
2946 esac;;
2947 esac;;
2948 *) dflt="$cc";;
2949 esac
2950 case "$dflt" in
2951 *M*) $cat <<'EOM'
2952On some older systems the default C compiler will not resolve multiple global
2953references that happen to have the same name. On some such systems the "Mcc"
2954command may be used to force these to be resolved. On other systems a "cc -M"
2955command is required. (Note that the -M flag on other systems indicates a
2956memory model to use!) If you have the Gnu C compiler, you might wish to use
2957that instead.
2958
2959EOM
2960 ;;
2961 esac
2962 rp="Use which C compiler?"
2963 . ./myread
2964 cc="$ans"
2965else
2966 case "$cc" in
2967 '') dflt=cc;;
2968 *) dflt="$cc";;
2969 esac
2970 rp="Use which C compiler?"
2971 . ./myread
2972 cc="$ans"
2973fi
2974: Look for a hint-file generated 'call-back-unit'. Now that the
2975: user has specified the compiler, we may need to set or change some
2976: other defaults.
2977if $test -f cc.cbu; then
2978 . ./cc.cbu
2979fi
2980echo " "
2981echo "Checking for GNU cc in disguise and/or its version number..." >&4
2982$cat >gccvers.c <<EOM
2983#include <stdio.h>
2984int main() {
2985#ifdef __GNUC__
2986#ifdef __VERSION__
2987 printf("%s\n", __VERSION__);
2988#else
2989 printf("%s\n", "1");
2990#endif
2991#endif
2992 exit(0);
2993}
2994EOM
2995if $cc -o gccvers gccvers.c; then
2996 gccversion=`./gccvers`
2997 case "$gccversion" in
2998 '') echo "You are not using GNU cc." ;;
2999 *) echo "You are using GNU cc $gccversion." ;;
3000 esac
3001else
3002 echo " "
3003 echo "*** WHOA THERE!!! ***" >&4
3004 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3005 case "$knowitall" in
3006 '')
3007 echo " You'd better start hunting for one and let me know about it." >&4
3008 exit 1
3009 ;;
3010 esac
3011fi
3012$rm -f gccvers*
3013case "$gccversion" in
30141*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3015esac
3016
64e689dc
JH
3017cat <<EOM
3018
3019Perl can be built to take advantage of explicit 64-bit interfaces,
3020on some systems. To do so, Configure must be run with -Duse64bits.
3021
3022If this doesn't make any sense to you, just accept the default 'n'.
3023EOM
85ab1d1d 3024case "$use64bits" in
64e689dc
JH
3025$define|true|[yY]*) dflt='y';;
3026*) dflt='n';;
3027esac
3028rp='Try to use explicit 64-bit interfaces, if available?'
3029. ./myread
3030case "$ans" in
3031y|Y)
3032 val="$define"
3033 ;;
3034*)
3035 val="$undef"
3036 ;;
85ab1d1d 3037esac
64e689dc
JH
3038set use64bits
3039eval $setvar
85ab1d1d 3040
104d25b7
JH
3041case "$archname64" in
3042'') archname64='' ;; # not a typo
3043esac
85ab1d1d 3044
b691c02f 3045case "$use64bits" in
104d25b7
JH
3046"$define"|true|[yY]*)
3047: Look for a hint-file generated 'call-back-unit'. If the
dd4e71fd 3048: user has specified that a 64 bit perl is to be built,
104d25b7
JH
3049: we may need to set or change some other defaults.
3050 if $test -f use64bits.cbu; then
e5e20432 3051 echo "Your platform has some specific hints for 64-bit builds, using them..."
104d25b7 3052 . ./use64bits.cbu
e5e20432
JH
3053 else
3054 $cat <<EOM
3055(Your platform doesn't have any specific hints for 64-bit builds.
3056 This is probably okay, especially if your system is a true 64-bit system.)
b691c02f 3057EOM
e5e20432
JH
3058 case "$gccversion" in
3059 '') ;;
3060 *) $cat <<EOM
3061But since you seem to be using gcc,
3062I will now add -DUSE_LONG_LONG to the compilation flags.
3063EOM
3064 ccflags="$ccflags -DUSE_LONG_LONG"
3065 ;;
3066 esac
3067 fi
b691c02f
JH
3068 ;;
3069esac
104d25b7 3070
4633a7c4 3071: determine the architecture name
2304df62 3072echo " "
4633a7c4
LW
3073if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3074 tarch=`arch`"-$osname"
3075elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3076 if uname -m > tmparch 2>&1 ; then
7e1af8bc 3077 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5f05dabc 3078 -e 's/$/'"-$osname/" tmparch`
4633a7c4
LW
3079 else
3080 tarch="$osname"
3081 fi
3082 $rm -f tmparch
3083else
3084 tarch="$osname"
3085fi
3086case "$myarchname" in
3087''|"$tarch") ;;
3088*)
3089 echo "(Your architecture name used to be $myarchname.)"
3090 archname=''
2304df62
AD
3091 ;;
3092esac
85ab1d1d 3093myarchname="$tarch"
4633a7c4
LW
3094case "$archname" in
3095'') dflt="$tarch";;
3096*) dflt="$archname";;
3097esac
3098rp='What is your architecture name'
3099. ./myread
85ab1d1d 3100archname="$ans"
dc66995c 3101case "$usethreads" in
85ab1d1d
JH
3102$define)
3103 echo "Threads selected." >&4
3104 case "$archname" in
3105 *-thread*) echo "...and architecture name already has -thread." >&4
3106 ;;
3107 *) archname="$archname-thread"
3108 echo "...setting architecture name to $archname." >&4
3109 ;;
3110 esac
3111 ;;
dc66995c 3112esac
85ab1d1d
JH
3113case "$usemultiplicity" in
3114$define)
3115 echo "Multiplicity selected." >&4
3116 case "$archname" in
3117 *-multi*) echo "...and architecture name already has -multi." >&4
3118 ;;
3119 *) archname="$archname-multi"
3120 echo "...setting architecture name to $archname." >&4
3121 ;;
3122 esac
3123 ;;
3124esac
3125case "$use64bits" in
3126$define)
3127 echo "Explicit 64-bitness selected." >&4
3128 case "$archname64" in
3129 '')
3130 ;;
3131 *)
3132 case "$archname" in
3133 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3134 ;;
3135 *) archname="$archname-$archname64"
3136 echo "...setting architecture name to $archname." >&4
3137 ;;
3138 esac
3139 ;;
3140 esac
3141esac
3142
4633a7c4
LW
3143: decide how portable to be. Allow command line overrides.
3144case "$d_portable" in
3145"$undef") ;;
3146*) d_portable="$define" ;;
2304df62 3147esac
2304df62 3148
4633a7c4
LW
3149: set up shell script to do ~ expansion
3150cat >filexp <<EOSS
3151$startsh
3152: expand filename
3153case "\$1" in
3154 ~/*|~)
3155 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 3156 ;;
4633a7c4
LW
3157 ~*)
3158 if $test -f /bin/csh; then
3159 /bin/csh -f -c "glob \$1"
3160 failed=\$?
3161 echo ""
3162 exit \$failed
3163 else
3164 name=\`$expr x\$1 : '..\([^/]*\)'\`
3165 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3166 if $test ! -d "\$dir"; then
3167 me=\`basename \$0\`
3168 echo "\$me: can't locate home directory for: \$name" >&2
3169 exit 1
3170 fi
3171 case "\$1" in
3172 */*)
3173 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3174 ;;
3175 *)
3176 echo \$dir
3177 ;;
2304df62 3178 esac
4633a7c4 3179 fi
2304df62
AD
3180 ;;
3181*)
4633a7c4 3182 echo \$1
2304df62
AD
3183 ;;
3184esac
4633a7c4
LW
3185EOSS
3186chmod +x filexp
3187$eunicefix filexp
2304df62
AD
3188
3189: now set up to get a file name
28757baa 3190cat <<EOS >getfile
3191$startsh
3192EOS
3193cat <<'EOSC' >>getfile
2304df62
AD
3194tilde=''
3195fullpath=''
3196already=''
3197skip=''
3198none_ok=''
3199exp_file=''
a0d0e21e 3200nopath_ok=''
2304df62
AD
3201orig_rp="$rp"
3202orig_dflt="$dflt"
b233458b
JH
3203case "$gfpth" in
3204'') gfpth='.' ;;
3205esac
2304df62
AD
3206
3207case "$fn" in
ecfc5424 3208*\(*)
28e8609d 3209 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3210 fn=`echo $fn | sed 's/(.*)//'`
3211 ;;
3212esac
3213
3214case "$fn" in
a0d0e21e
LW
3215*:*)
3216 loc_file=`expr $fn : '.*:\(.*\)'`
3217 fn=`expr $fn : '\(.*\):.*'`
3218 ;;
3219esac
3220
3221case "$fn" in
2304df62
AD
3222*~*) tilde=true;;
3223esac
3224case "$fn" in
3225*/*) fullpath=true;;
3226esac
3227case "$fn" in
3228*+*) skip=true;;
3229esac
3230case "$fn" in
3231*n*) none_ok=true;;
3232esac
3233case "$fn" in
3234*e*) exp_file=true;;
3235esac
a0d0e21e
LW
3236case "$fn" in
3237*p*) nopath_ok=true;;
3238esac
2304df62
AD
3239
3240case "$fn" in
3241*f*) type='File';;
3242*d*) type='Directory';;
a0d0e21e 3243*l*) type='Locate';;
2304df62
AD
3244esac
3245
3246what="$type"
3247case "$what" in
3248Locate) what='File';;
3249esac
3250
3251case "$exp_file" in
3252'')
3253 case "$d_portable" in
3254 "$define") ;;
3255 *) exp_file=true;;
3256 esac
3257 ;;
3258esac
3259
3260cd ..
3261while test "$type"; do
3262 redo=''
3263 rp="$orig_rp"
3264 dflt="$orig_dflt"
3265 case "$tilde" in
3266 true) rp="$rp (~name ok)";;
3267 esac
3268 . UU/myread
ecfc5424
AD
3269 if test -f UU/getfile.ok && \
3270 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3271 then
3272 value="$ans"
3273 ansexp="$ans"
3274 break
3275 fi
2304df62
AD
3276 case "$ans" in
3277 none)
3278 value=''
3279 ansexp=''
3280 case "$none_ok" in
3281 true) type='';;
3282 esac
3283 ;;
3284 *)
3285 case "$tilde" in
3286 '') value="$ans"
3287 ansexp="$ans";;
3288 *)
3289 value=`UU/filexp $ans`
3290 case $? in
3291 0)
3292 if test "$ans" != "$value"; then
ecfc5424 3293 echo "(That expands to $value on this system.)"
2304df62
AD
3294 fi
3295 ;;
3296 *) value="$ans";;
3297 esac
3298 ansexp="$value"
3299 case "$exp_file" in
3300 '') value="$ans";;
3301 esac
3302 ;;
3303 esac
3304 case "$fullpath" in
3305 true)
3306 case "$ansexp" in
3307 /*) value="$ansexp" ;;
3308 *)
3309 redo=true
3310 case "$already" in
3311 true)
3312 echo "I shall only accept a full path name, as in /bin/ls." >&4
3313 echo "Use a ! shell escape if you wish to check pathnames." >&4
3314 ;;
3315 *)
3316 echo "Please give a full path name, starting with slash." >&4
3317 case "$tilde" in
3318 true)
3319 echo "Note that using ~name is ok provided it expands well." >&4
3320 already=true
3321 ;;
3322 esac
3323 esac
3324 ;;
3325 esac
3326 ;;
3327 esac
3328 case "$redo" in
3329 '')
3330 case "$type" in
3331 File)
b233458b
JH
3332 for fp in $gfpth; do
3333 if test "X$fp" = X.; then
3334 pf="$ansexp"
3335 else
3336 pf="$fp/$ansexp"
3337 fi
3338 if test -f "$pf"; then
3339 type=''
3340 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3341 then
3342 echo "($value is not a plain file, but that's ok.)"
3343 type=''
3344 fi
3345 if test X"$type" = X; then
3346 value="$pf"
3347 break
3348 fi
3349 done
2304df62
AD
3350 ;;
3351 Directory)
b233458b
JH
3352 for fp in $gfpth; do
3353 if test "X$fp" = X.; then
3354 pf="$ansexp"
3355 else
3356 pf="$fp/$ansexp"
3357 fi
3358 if test -d "$pf"; then
3359 type=''
3360 value="$pf"
3361 break
3362 fi
3363 done
2304df62
AD
3364 ;;
3365 Locate)
40000a8c 3366 if test -d "$ansexp"; then
a0d0e21e
LW
3367 echo "(Looking for $loc_file in directory $value.)"
3368 value="$value/$loc_file"
40000a8c 3369 ansexp="$ansexp/$loc_file"
2304df62 3370 fi
40000a8c 3371 if test -f "$ansexp"; then
2304df62
AD
3372 type=''
3373 fi
a0d0e21e
LW
3374 case "$nopath_ok" in
3375 true) case "$value" in
3376 */*) ;;
3377 *) echo "Assuming $value will be in people's path."
3378 type=''
3379 ;;
3380 esac
3381 ;;
3382 esac
2304df62
AD
3383 ;;
3384 esac
3385
3386 case "$skip" in
3387 true) type='';
3388 esac
3389
3390 case "$type" in
3391 '') ;;
3392 *)
3393 if test "$fastread" = yes; then
3394 dflt=y
3395 else
3396 dflt=n
3397 fi
3398 rp="$what $value doesn't exist. Use that name anyway?"
3399 . UU/myread
3400 dflt=''
3401 case "$ans" in
3402 y*) type='';;
3403 *) echo " ";;
3404 esac
3405 ;;
3406 esac
3407 ;;
3408 esac
3409 ;;
3410 esac
3411done
3412cd UU
3413ans="$value"
3414rp="$orig_rp"
3415dflt="$orig_dflt"
ecfc5424 3416rm -f getfile.ok
b233458b 3417test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3418EOSC
3419
4633a7c4
LW
3420: determine root of directory hierarchy where package will be installed.
3421case "$prefix" in
3422'')
3423 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 3424 ;;
4633a7c4
LW
3425*)
3426 dflt="$prefix"
8e07c86e
AD
3427 ;;
3428esac
4633a7c4 3429$cat <<EOM
2304df62 3430
dd4e71fd
JH
3431By default, $package will be installed in $dflt/bin, manual pages
3432under $dflt/man, etc..., i.e. with $dflt as prefix for all
3433installation directories. Typically this is something like /usr/local.
3434If you wish to have binaries under /usr/bin but other parts of the
3435installation under /usr/local, that's ok: you will be prompted
3436separately for each of the installation directories, the prefix being
3437only used to set the defaults.
8e07c86e
AD
3438
3439EOM
3440fn=d~
3441rp='Installation prefix to use?'
3442. ./getfile
3443oldprefix=''
3444case "$prefix" in
a0d0e21e 3445'') ;;
8e07c86e
AD
3446*)
3447 case "$ans" in
3448 "$prefix") ;;
3449 *) oldprefix="$prefix";;
3450 esac
3451 ;;
a0d0e21e 3452esac
8e07c86e
AD
3453prefix="$ans"
3454prefixexp="$ansexp"
a0d0e21e 3455
dd4e71fd
JH
3456: is AFS running?
3457echo " "
3458case "$afs" in
3459$define|true) afs=true ;;
3460$undef|false) afs=false ;;
3461*) if test -d /afs; then
3462 afs=true
3463 else
3464 afs=false
3465 fi
3466 ;;
3467esac
3468if $afs; then
3469 echo "AFS may be running... I'll be extra cautious then..." >&4
3470else
3471 echo "AFS does not seem to be running..." >&4
3472fi
3473
3474: determine installation prefix for where package is to be installed.
3475if $afs; then
3476$cat <<EOM
3477
3478Since you are running AFS, I need to distinguish the directory in which
3479files will reside from the directory in which they are installed (and from
3480which they are presumably copied to the former directory by occult means).
3481
3482EOM
3483 case "$installprefix" in
3484 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3485 *) dflt="$installprefix";;
3486 esac
3487else
3488$cat <<EOM
3489
3490In some special cases, particularly when building $package for distribution,
3491it is convenient to distinguish between the directory in which files should
3492be installed from the directory ($prefix) in which they
3493will eventually reside. For most users, these two directories are the same.
3494
3495EOM
3496 case "$installprefix" in
3497 '') dflt=$prefix ;;
3498 *) dflt=$installprefix;;
3499 esac
3500fi
3501fn=d~
3502rp='What installation prefix should I use for installing files?'
3503. ./getfile
3504installprefix="$ans"
3505installprefixexp="$ansexp"
3506
8e07c86e
AD
3507: set the prefixit variable, to compute a suitable default value
3508prefixit='case "$3" in
3509""|none)
3510 case "$oldprefix" in
3511 "") eval "$1=\"\$$2\"";;
3512 *)
3513 case "$3" in
3514 "") eval "$1=";;
3515 none)
3516 eval "tp=\"\$$2\"";
3517 case "$tp" in
3518 ""|" ") eval "$1=\"\$$2\"";;
3519 *) eval "$1=";;
3520 esac;;
3521 esac;;
3522 esac;;
3523*)
3524 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3525 case "$tp" in
3526 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3527 /*-$oldprefix/*|\~*-$oldprefix/*)
3528 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3529 *) eval "$1=\"\$$2\"";;
3530 esac;;
3531esac'
a0d0e21e 3532
bfb7748a
AD
3533: set the base revision
3534baserev=5.0
3535
3536: get the patchlevel
3537echo " "
3538echo "Getting the current patchlevel..." >&4
3539if $test -r $rsrc/patchlevel.h;then
d00b958f
JH
3540 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3541 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bfb7748a
AD
3542else
3543 patchlevel=0
3544 subversion=0
3545fi
3546$echo $n "(You have $package" $c
3547case "$package" in
3548"*$baserev") ;;
3549*) $echo $n " $baserev" $c ;;
3550esac
3551$echo $n " patchlevel $patchlevel" $c
3552test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3553echo ".)"
3554
3555if test 0 -eq "$subversion"; then
3556 version=`LC_ALL=C; export LC_ALL; \
3557 echo $baserev $patchlevel | \
3558 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3559else
3560 version=`LC_ALL=C; export LC_ALL; \
3561 echo $baserev $patchlevel $subversion | \
3562 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3563fi
3564: Figure out perl API version. Perhaps this should be in patchlevel.h
3565if test "$subversion" -lt 50; then
3566 apiversion=`LC_ALL=C; export LC_ALL; \
59b83a6f 3567 LANGUAGE=C; export LANGUAGE; \
bfb7748a
AD
3568 echo $baserev $patchlevel | \
3569 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3570else
3571 apiversion="$version"
3572fi
3573
dd4e71fd
JH
3574: determine installation style
3575: For now, try to deduce it from prefix unless it is already set.
3576: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3577case "$installstyle" in
3578'') case "$prefix" in
3579 *perl*) dflt='lib';;
3580 *) dflt='lib/perl5' ;;
3581 esac
3582 ;;
3583*) dflt='lib/perl5' ;;
3584esac
3585: Probably not worth prompting for this since we prompt for all
3586: the directories individually, and the prompt would be too long and
3587: confusing anyway.
3588installstyle=$dflt
3589
4633a7c4 3590: determine where private library files go
3a6175e1
AD
3591: Usual default is /usr/local/lib/perl5/$version.
3592: Also allow things like /opt/perl/lib/$version, since
bfb7748a 3593: /opt/perl/lib/perl5... would be redundant.
dd4e71fd
JH
3594: The default "style" setting is made in installstyle.U
3595case "$installstyle" in
3596*lib/perl5*) set dflt privlib lib/$package/$version ;;
3597*) set dflt privlib lib/$version ;;
4633a7c4 3598esac
8e07c86e 3599eval $prefixit
4633a7c4
LW
3600$cat <<EOM
3601
3602There are some auxiliary files for $package that need to be put into a
3603private library directory that is accessible by everyone.
3604
3605EOM
3606fn=d~+
3607rp='Pathname where the private library files will reside?'
8e07c86e 3608. ./getfile
4633a7c4
LW
3609privlib="$ans"
3610privlibexp="$ansexp"
dd4e71fd
JH
3611: Change installation prefix, if necessary.
3612if $test X"$prefix" != X"$installprefix"; then
ec897fb9 3613 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
3614else
3615 installprivlib="$privlibexp"
4633a7c4
LW
3616fi
3617
8e07c86e
AD
3618: set the prefixup variable, to restore leading tilda escape
3619prefixup='case "$prefixexp" in
3620"$prefix") ;;
3621*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3622esac'
3623
4633a7c4
LW
3624: determine where public architecture dependent libraries go
3625set archlib archlib
8e07c86e 3626eval $prefixit
3a6175e1 3627: privlib default is /usr/local/lib/$package/$version
bfb7748a 3628: archlib default is /usr/local/lib/$package/$version/$archname
3a6175e1 3629: privlib may have an optional trailing /share.
bfb7748a
AD
3630tdflt=`echo $privlib | $sed 's,/share$,,'`
3631tdflt=$tdflt/$archname
4633a7c4 3632case "$archlib" in
bfb7748a 3633'') dflt=$tdflt
8e07c86e 3634 ;;
bfb7748a 3635*) dflt="$archlib"
774d564b 3636 ;;
8e07c86e 3637esac
dd4e71fd 3638$cat <<EOM
4633a7c4
LW
3639
3640$spackage contains architecture-dependent library files. If you are
3641sharing libraries in a heterogeneous environment, you might store
3642these files in a separate location. Otherwise, you can just include
3643them with the rest of the public library files.
3644
8e07c86e 3645EOM
4633a7c4
LW
3646fn=d+~
3647rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 3648. ./getfile
4633a7c4
LW
3649archlib="$ans"
3650archlibexp="$ansexp"
4633a7c4
LW
3651if $test X"$archlib" = X"$privlib"; then
3652 d_archlib="$undef"
3653else
3654 d_archlib="$define"
8e07c86e 3655fi
dd4e71fd
JH
3656: Change installation prefix, if necessary.
3657if $test X"$prefix" != X"$installprefix"; then
ec897fb9 3658 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
3659else
3660 installarchlib="$archlibexp"
dd4e71fd 3661fi
8e07c86e 3662
d71b2b6b
JH
3663
3664: Binary compatibility with 5.005 is not possible for builds
3665: with advanced features
3666case "$usethreads$usemultiplicity" in
f0d04425
JH
3667*define*)
3668 bincompat5005="$undef"
3669 d_bincompat5005="$undef"
3670 ;;
d71b2b6b
JH
3671*) $cat <<EOM
3672
3673Perl 5.006 can be compiled for binary compatibility with 5.005.
3674If you decide to do so, you will be able to continue using most
3675of the extensions that were compiled for Perl 5.005.
3676
3677EOM
44dbcf5f
JH
3678 case "$bincompat5005$d_bincompat5005" in
3679 *"$undef"*) dflt=n ;;
d71b2b6b
JH
3680 *) dflt=y ;;
3681 esac
3682 rp='Binary compatibility with Perl 5.005?'
3683 . ./myread
3684 case "$ans" in
3685 y*) val="$define" ;;
3686 *) val="$undef" ;;
3687 esac
3688 set d_bincompat5005
3689 eval $setvar
3690 case "$d_bincompat5005" in
f0d04425
JH
3691 "$define")
3692 bincompat5005="$define"
3693 ;;
3694 *) bincompat5005="$undef"
3695 d_bincompat5005="$undef"
3696 ;;
e5e20432
JH
3697 esac
3698 ;;
3699esac
3700
40a7a20a 3701
3702: see if setuid scripts can be secure
3703$cat <<EOM
3704
3705Some kernels have a bug that prevents setuid #! scripts from being
3706secure. Some sites have disabled setuid #! scripts because of this.
3707
3708First let's decide if your kernel supports secure setuid #! scripts.
3709(If setuid #! scripts would be secure but have been disabled anyway,
3710don't say that they are secure if asked.)
3711
3712EOM
3713
3714val="$undef"
3715if $test -d /dev/fd; then
3716 echo "#!$ls" >reflect
3717 chmod +x,u+s reflect
3718 ./reflect >flect 2>&1
3719 if $contains "/dev/fd" flect >/dev/null; then
3720 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3721 val="$define"
3722 else
3723 $cat <<EOM
3724If you are not sure if they are secure, I can check but I'll need a
3725username and password different from the one you are using right now.
3726If you don't have such a username or don't want me to test, simply
3727enter 'none'.
3728
3729EOM
3730 rp='Other username to test security of setuid scripts with?'
3731 dflt='none'
3732 . ./myread
3733 case "$ans" in
3734 n|none)
3735 case "$d_suidsafe" in
3736 '') echo "I'll assume setuid scripts are *not* secure." >&4
3737 dflt=n;;
3738 "$undef")
3739 echo "Well, the $hint value is *not* secure." >&4
3740 dflt=n;;
3741 *) echo "Well, the $hint value *is* secure." >&4
3742 dflt=y;;
3743 esac
3744 ;;
3745 *)
3746 $rm -f reflect flect
3747 echo "#!$ls" >reflect
3748 chmod +x,u+s reflect
3749 echo >flect
3750 chmod a+w flect
3751 echo '"su" will (probably) prompt you for '"$ans's password."
3752 su $ans -c './reflect >flect'
3753 if $contains "/dev/fd" flect >/dev/null; then
3754 echo "Okay, it looks like setuid scripts are secure." >&4
3755 dflt=y
3756 else
3757 echo "I don't think setuid scripts are secure." >&4
3758 dflt=n
3759 fi
3760 ;;
3761 esac
3762 rp='Does your kernel have *secure* setuid scripts?'
3763 . ./myread
3764 case "$ans" in
3765 [yY]*) val="$define";;
3766 *) val="$undef";;
3767 esac
3768 fi
3769else
3770 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
760ac839 3771 echo "(That's for file descriptors, not floppy disks.)"
40a7a20a 3772 val="$undef"
3773fi
3774set d_suidsafe
3775eval $setvar
3776
3777$rm -f reflect flect
3778
3779: now see if they want to do setuid emulation
3780echo " "
3781val="$undef"
3782case "$d_suidsafe" in
3783"$define")
3784 val="$undef"
3785 echo "No need to emulate SUID scripts since they are secure here." >& 4
3786 ;;
3787*)
3788 $cat <<EOM
3789Some systems have disabled setuid scripts, especially systems where
3790setuid scripts cannot be secure. On systems where setuid scripts have
dfe9444c
AD
3791been disabled, the setuid/setgid bits on scripts are currently
3792useless. It is possible for $package to detect those bits and emulate
3793setuid/setgid in a secure fashion. This emulation will only work if
3794setuid scripts have been disabled in your kernel.
8e07c86e
AD
3795
3796EOM
dfe9444c
AD
3797 case "$d_dosuid" in
3798 "$define") dflt=y ;;
3799 *) dflt=n ;;
3800 esac
3801 rp="Do you want to do setuid/setgid emulation?"
3802 . ./myread
3803 case "$ans" in
3804 [yY]*) val="$define";;
3805 *) val="$undef";;
3806 esac
3807 ;;
4633a7c4 3808esac
dfe9444c 3809set d_dosuid
4633a7c4 3810eval $setvar
8e07c86e 3811
2afac517 3812: What should the include directory be ?
8e07c86e 3813echo " "
2afac517 3814$echo $n "Hmm... $c"
3815dflt='/usr/include'
3816incpath=''
3817mips_type=''
3818if $test -f /bin/mips && /bin/mips; then
3819 echo "Looks like a MIPS system..."
3820 $cat >usr.c <<'EOCP'
3821#ifdef SYSTYPE_BSD43
3822/bsd43
3823#endif
3824EOCP
3825 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3826 dflt='/bsd43/usr/include'
3827 incpath='/bsd43'
3828 mips_type='BSD 4.3'
8e07c86e 3829 else
2afac517 3830 mips_type='System V'
8e07c86e 3831 fi
2afac517 3832 $rm -f usr.c usr.out
3833 echo "and you're compiling with the $mips_type compiler and libraries."
3834 xxx_prompt=y
3835 echo "exit 0" >mips
8e07c86e 3836else
2afac517 3837 echo "Doesn't look like a MIPS system."
3838 xxx_prompt=n
3839 echo "exit 1" >mips
3840fi
3841chmod +x mips
3842$eunicefix mips
2afac517 3843case "$usrinc" in
3844'') ;;
3845*) dflt="$usrinc";;
3846esac
3847case "$xxx_prompt" in
3848y) fn=d/
dfe9444c 3849 echo " "
2afac517 3850 rp='Where are the include files you want to use?'
3851 . ./getfile
3852 usrinc="$ans"
3853 ;;
3854*) usrinc="$dflt"
3855 ;;
3856esac
8e07c86e 3857
c4f23d77
AD
3858: see how we invoke the C preprocessor
3859echo " "
3860echo "Now, how can we feed standard input to your C preprocessor..." >&4
3861cat <<'EOT' >testcpp.c
3862#define ABC abc
3863#define XYZ xyz
3864ABC.XYZ
3865EOT
3866cd ..
1cfa4ec7 3867if test ! -f cppstdin; then
10a23457
JH
3868 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3869 # AIX cc -E doesn't show the absolute headerfile
3870 # locations but we'll cheat by using the -M flag.
3871 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3872 else
3873 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3874 fi
1cfa4ec7
GS
3875else
3876 echo "Keeping your $hint cppstdin wrapper."
3877fi
c4f23d77
AD
3878chmod 755 cppstdin
3879wrapper=`pwd`/cppstdin
3880ok='false'
3881cd UU
3882
3883if $test "X$cppstdin" != "X" && \
3884 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3885 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3886then
3887 echo "You used to use $cppstdin $cppminus so we'll use that again."
3888 case "$cpprun" in
3889 '') echo "But let's see if we can live without a wrapper..." ;;
3890 *)
3891 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3892 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3893 then
3894 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3895 ok='true'
3896 else
3897 echo "(However, $cpprun $cpplast does not work, let's see...)"
3898 fi
3899 ;;
3900 esac
3901else
3902 case "$cppstdin" in
3903 '') ;;
3904 *)
3905 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3906 ;;
3907 esac
3908fi
3909
3910if $ok; then
3911 : nothing
3912elif echo 'Maybe "'"$cc"' -E" will work...'; \
3913 $cc -E <testcpp.c >testcpp.out 2>&1; \
3914 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3915 echo "Yup, it does."
3916 x_cpp="$cc -E"
3917 x_minus='';
3918elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3919 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3920 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3921 echo "Yup, it does."
3922 x_cpp="$cc -E"
3923 x_minus='-';
3924elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3925 $cc -P <testcpp.c >testcpp.out 2>&1; \
3926 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3927 echo "Yipee, that works!"
3928 x_cpp="$cc -P"
3929 x_minus='';
3930elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3931 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3932 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3933 echo "At long last!"
3934 x_cpp="$cc -P"
3935 x_minus='-';
3936elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3937 $cpp <testcpp.c >testcpp.out 2>&1; \
3938 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3939 echo "It works!"
3940 x_cpp="$cpp"
3941 x_minus='';
3942elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3943 $cpp - <testcpp.c >testcpp.out 2>&1; \
3944 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3945 echo "Hooray, it works! I was beginning to wonder."
3946 x_cpp="$cpp"
3947 x_minus='-';
3948elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3949 $wrapper <testcpp.c >testcpp.out 2>&1; \
3950 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3951 x_cpp="$wrapper"
3952 x_minus=''
3953 echo "Eureka!"
3954else
3955 dflt=''
3956 rp="No dice. I can't find a C preprocessor. Name one:"
3957 . ./myread
3958 x_cpp="$ans"
3959 x_minus=''
3960 $x_cpp <testcpp.c >testcpp.out 2>&1
3961 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3962 echo "OK, that will do." >&4
3963 else
3964echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3965 exit 1
3966 fi
3967fi
3968
3969case "$ok" in
3970false)
3971 cppstdin="$x_cpp"
3972 cppminus="$x_minus"
3973 cpprun="$x_cpp"
3974 cpplast="$x_minus"
3975 set X $x_cpp
3976 shift
3977 case "$1" in
3978 "$cpp")
3979 echo "Perhaps can we force $cc -E using a wrapper..."
3980 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3981 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3982 then
3983 echo "Yup, we can."
3984 cppstdin="$wrapper"
3985 cppminus='';
3986 else
3987 echo "Nope, we'll have to live without it..."
3988 fi
3989 ;;
3990 esac
3991 case "$cpprun" in
3992 "$wrapper")
3993 cpprun=''
3994 cpplast=''
3995 ;;
3996 esac
3997 ;;
3998esac
3999
4000case "$cppstdin" in
def887e8 4001"$wrapper"|'cppstdin') ;;
c4f23d77
AD
4002*) $rm -f $wrapper;;
4003esac
4004$rm -f testcpp.c testcpp.out
4005
2afac517 4006: Set private lib path
4007case "$plibpth" in
4008'') if ./mips; then
4009 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4010 fi;;
4011esac
4012case "$libpth" in
4013' ') dlist='';;
4014'') dlist="$loclibpth $plibpth $glibpth";;
4015*) dlist="$libpth";;
4016esac
8e07c86e 4017
2afac517 4018: Now check and see which directories actually exist, avoiding duplicates
4019libpth=''
4020for xxx in $dlist
4021do
4022 if $test -d $xxx; then
4023 case " $libpth " in
4024 *" $xxx "*) ;;
4025 *) libpth="$libpth $xxx";;
4026 esac
4027 fi
4028done
4029$cat <<'EOM'
8e07c86e 4030
2afac517 4031Some systems have incompatible or broken versions of libraries. Among
4032the directories listed in the question below, please remove any you
4033know not to be holding relevant libraries, and add any that are needed.
4034Say "none" for none.
8e07c86e 4035
8e07c86e 4036EOM
2afac517 4037case "$libpth" in
4038'') dflt='none';;
4039*)
4040 set X $libpth
4041 shift
4042 dflt=${1+"$@"}
4633a7c4 4043 ;;
8e07c86e 4044esac
2afac517 4045rp="Directories to use for library searches?"
4046. ./myread
4047case "$ans" in
4048none) libpth=' ';;
4049*) libpth="$ans";;
4050esac
8e07c86e 4051
2afac517 4052: compute shared library extension
4053case "$so" in
4054'')
4055 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4056 dflt='sl'
4057 else
4058 dflt='so'
4059 fi
4060 ;;
4061*) dflt="$so";;
8e07c86e 4062esac
2afac517 4063$cat <<EOM
8e07c86e 4064
2afac517 4065On some systems, shared libraries may be available. Answer 'none' if
4066you want to suppress searching of shared libraries for the remaining
4067of this configuration.
8e07c86e
AD
4068
4069EOM
2afac517 4070rp='What is the file extension used for shared libraries?'
4071. ./myread
4072so="$ans"
8e07c86e 4073
dfe9444c
AD
4074: Define several unixisms.
4075: Hints files or command line option can be used to override them.
4076: The convoluted testing is in case hints files set either the old
4077: or the new name.
4078case "$_exe" in
4079'') case "$exe_ext" in
4080 '') ;;
4081 *) _exe="$exe_ext" ;;
4082 esac
4083 ;;
4084esac
4085case "$_a" in
4086'') case "$lib_ext" in
4087 '') _a='.a';;
4088 *) _a="$lib_ext" ;;
4089 esac
4090 ;;
4091esac
4092case "$_o" in
4093'') case "$obj_ext" in
4094 '') _o='.o';;
4095 *) _o="$obj_ext";;
4096 esac
4097 ;;
4098esac
4099case "$p_" in
4100'') case "$path_sep" in
4101 '') p_=':';;
4102 *) p_="$path_sep";;
4103 esac
4104 ;;
4105esac
4106exe_ext=$_exe
4107lib_ext=$_a
4108obj_ext=$_o
4109path_sep=$p_
4110
4111: Which makefile gets called first. This is used by make depend.
4112case "$firstmakefile" in
4113'') firstmakefile='makefile';;
4114esac
4115
29209bc5
JH
4116cat <<EOM
4117
4118Perl can be built to use the SOCKS proxy protocol library. To do so,
4119Configure must be run with -Dusesocks.
4120
4121Normally you do not need this and you should answer no.
4122
4123EOM
4124case "$usesocks" in
4125$define|true|[yY]*) dflt='y';;
4126*) dflt='n';;
4127esac
4128rp='Build Perl for SOCKS?'
4129. ./myread
4130case "$ans" in
4131y|Y) val="$define" ;;
4132*) val="$undef" ;;
4133esac
4134set usesocks
4135eval $setvar
4136
2afac517 4137: Looking for optional libraries
4138echo " "
4139echo "Checking for optional libraries..." >&4
4140case "$libs" in
4141' '|'') dflt='';;
4142*) dflt="$libs";;
8e07c86e 4143esac
2afac517 4144case "$libswanted" in
4145'') libswanted='c_s';;
4146esac
29209bc5
JH
4147case "$usesocks" in
4148$define)
4149 libswanted="$libswanted socks5 socks5_sh"
4150 ;;
4151esac
2afac517 4152for thislib in $libswanted; do
4153
1cfa4ec7
GS
4154 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4155 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
2afac517 4156 echo "Found -l$thislib (shared)."
4157 case " $dflt " in
4158 *"-l$thislib "*);;
4159 *) dflt="$dflt -l$thislib";;
4633a7c4 4160 esac
2afac517 4161 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4162 echo "Found -l$thislib (shared)."
4163 case " $dflt " in
4164 *"-l$thislib "*);;
4165 *) dflt="$dflt -l$thislib";;
4166 esac
dfe9444c 4167 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 4168 echo "Found -l$thislib."
4169 case " $dflt " in
4170 *"-l$thislib "*);;
4171 *) dflt="$dflt -l$thislib";;
4172 esac
dfe9444c 4173 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 4174 echo "Found -l$thislib."
4175 case " $dflt " in
4176 *"-l$thislib "*);;
4177 *) dflt="$dflt -l$thislib";;
4178 esac
dfe9444c 4179 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2afac517 4180 echo "Found -l${thislib}_s."
4181 case " $dflt " in
4182 *"-l$thislib "*);;
4183 *) dflt="$dflt -l${thislib}_s";;
4184 esac
dfe9444c 4185 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2afac517 4186 echo "Found -l$thislib."
4187 case " $dflt " in
4188 *"-l$thislib "*);;
4189 *) dflt="$dflt -l$thislib";;
4190 esac
4191 else
4192 echo "No -l$thislib."
4193 fi
4194done
4195set X $dflt
4196shift
4197dflt="$*"
4198case "$libs" in
4199'') dflt="$dflt";;
4200*) dflt="$libs";;
4201esac
4202case "$dflt" in
4203' '|'') dflt='none';;
8e07c86e 4204esac
2afac517 4205
4633a7c4 4206$cat <<EOM
29209bc5
JH
4207
4208In order to compile $package on your machine, a number of libraries
4209are usually needed. Include any other special libraries here as well.
4210Say "none" for none. The default list is almost always right.
4633a7c4 4211EOM
2afac517 4212
4213echo " "
29209bc5 4214rp="What libraries to use?"
8e07c86e 4215. ./myread
2afac517 4216case "$ans" in
4217none) libs=' ';;
4218*) libs="$ans";;
4219esac
8e07c86e 4220
34d1710f 4221: determine optimization, if desired, or use for debug flag also
2afac517 4222case "$optimize" in
2ae324a7 4223' '|$undef) dflt='none';;
2afac517 4224'') dflt='-O';;
4225*) dflt="$optimize";;
4633a7c4 4226esac
2afac517 4227$cat <<EOH
4633a7c4 4228
34d1710f
JH
4229By default, $package compiles with the -O flag to use the optimizer.
4230Alternately, you might want to use the symbolic debugger, which uses
4231the -g flag (on traditional Unix systems). Either flag can be
4232specified here. To use neither flag, specify the word "none".
4633a7c4
LW
4233
4234EOH
4235rp="What optimizer/debugger flag should be used?"
4236. ./myread
4237optimize="$ans"
4238case "$optimize" in
4239'none') optimize=" ";;
4240esac
4241
4242dflt=''
25f94b33
AD
4243: We will not override a previous value, but we might want to
4244: augment a hint file
4245case "$hint" in
34d1710f 4246default|recommended)
4633a7c4
LW
4247 case "$gccversion" in
4248 1*) dflt='-fpcc-struct-return' ;;
4249 esac
4250 case "$optimize" in
4251 *-g*) dflt="$dflt -DDEBUGGING";;
4252 esac
4253 case "$gccversion" in
4254 2*) if test -d /etc/conf/kconfig.d &&
4255 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4256 then
4257 dflt="$dflt -posix"
4258 fi
4259 ;;
4260 esac
34d1710f
JH
4261 case "$gccversion" in
4262 1*) ;;
4263 2.[0-8]*) ;;
4264 *) echo " "
4265 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4266 echo 'int main(void) { return 0; }' > gcctest.c
4267 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4268 echo "Yes, it does." 2>&1
4269 case "$ccflags" in
4270 *strict-aliasing*)
4271 echo "Leaving current flags $ccflags alone." 2>&1
4272 ;;
4273 *) dflt="$dflt -fno-strict-aliasing" ;;
4274 esac
4275 else
4276 echo "Nope, it doesn't, but that's ok." 2>&1
4277 fi
4278 ;;
4279 esac
4633a7c4
LW
4280 ;;
4281esac
4282
a4f3eea9 4283case "$mips_type" in
4284*BSD*|'') inclwanted="$locincpth $usrinc";;
4285*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4286esac
4287for thisincl in $inclwanted; do
4288 if $test -d $thisincl; then
4289 if $test x$thisincl != x$usrinc; then
4290 case "$dflt" in
4291 *$thisincl*);;
4292 *) dflt="$dflt -I$thisincl";;
4293 esac
4294 fi
4295 fi
4296done
4297
4298inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4299 xxx=true;
4300elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4301 xxx=true;
4302else
4303 xxx=false;
4304fi;
4305if $xxx; then
4306 case "$dflt" in
4307 *$2*);;
4308 *) dflt="$dflt -D$2";;
4309 esac;
4310fi'
4311
ccc7f9b3 4312set signal.h LANGUAGE_C; eval $inctest
a4f3eea9 4313
29209bc5
JH
4314case "$usesocks" in
4315$define)
4316 ccflags="$ccflags -DSOCKS"
4317 ;;
4318esac
4319
a4f3eea9 4320case "$hint" in
34d1710f 4321default|recommended) dflt="$ccflags $dflt" ;;
a4f3eea9 4322*) dflt="$ccflags";;
4323esac
4324
4325case "$dflt" in
4326''|' ') dflt=none;;
4327esac
4328$cat <<EOH
4329
4330Your C compiler may want other flags. For this question you should include
4331-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4332but you should NOT include libraries or ld flags like -lwhatever. If you
4333want $package to honor its debug switch, you should include -DDEBUGGING here.
dfe9444c 4334Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
a4f3eea9 4335
4336To use no flags, specify the word "none".
4337
4338EOH
4339set X $dflt
4340shift
4341dflt=${1+"$@"}
4342rp="Any additional cc flags?"
4343. ./myread
4344case "$ans" in
4345none) ccflags='';;
4346*) ccflags="$ans";;
4347esac
4348
4349: the following weeds options from ccflags that are of no interest to cpp
4350cppflags="$ccflags"
4351case "$gccversion" in
43521*) cppflags="$cppflags -D__GNUC__"
4353esac
4354case "$mips_type" in
4355'');;
4356*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4357esac
4358case "$cppflags" in
4359'');;
4360*)
4361 echo " "
4362 echo "Let me guess what the preprocessor flags are..." >&4
4363 set X $cppflags
4364 shift
4365 cppflags=''
4366 $cat >cpp.c <<'EOM'
4367#define BLURFL foo
4368
4369BLURFL xx LFRULB
4370EOM
4371 previous=''
4372 for flag in $*
4373 do
4374 case "$flag" in
4375 -*) ftry="$flag";;
4376 *) ftry="$previous $flag";;
4377 esac
7bac28a0 4378 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
a4f3eea9 4379 >cpp1.out 2>/dev/null && \
dfe9444c 4380 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
a4f3eea9 4381 >cpp2.out 2>/dev/null && \
4382 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4383 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4384 then
4385 cppflags="$cppflags $ftry"
4386 previous=''
4387 else
4388 previous="$flag"
4389 fi
4390 done
4391 set X $cppflags
4392 shift
4393 cppflags=${1+"$@"}
4394 case "$cppflags" in
4395 *-*) echo "They appear to be: $cppflags";;
4396 esac
4397 $rm -f cpp.c cpp?.out
4398 ;;
4399esac
4400
4401: flags used in final linking phase
a4f3eea9 4402case "$ldflags" in
4403'') if ./venix; then
4404 dflt='-i -z'
4405 else
4406 dflt=''
4407 fi
4408 case "$ccflags" in
4409 *-posix*) dflt="$dflt -posix" ;;
4410 esac
4411 ;;
4412*) dflt="$ldflags";;
4413esac
4414
4415: Try to guess additional flags to pick up local libraries.
4416for thislibdir in $libpth; do
4417 case " $loclibpth " in
4418 *" $thislibdir "*)
4419 case "$dflt " in
4420 *"-L$thislibdir "*) ;;
4421 *) dflt="$dflt -L$thislibdir" ;;
4422 esac
4423 ;;
4424 esac
4425done
4426
4427case "$dflt" in
4428'') dflt='none' ;;
4429esac
4430
4431$cat <<EOH
4432
4433Your C linker may need flags. For this question you should
4434include -L/whatever and any other flags used by the C linker, but you
4435should NOT include libraries like -lwhatever.
4436
4437Make sure you include the appropriate -L/path flags if your C linker
4438does not normally search all of the directories you specified above,
4439namely
4440 $libpth
4441To use no flags, specify the word "none".
4442
4443EOH
4444
4445rp="Any additional ld flags (NOT including libraries)?"
4446. ./myread
4447case "$ans" in
4448none) ldflags='';;
4449*) ldflags="$ans";;
4450esac
4451rmlist="$rmlist pdp11"
4452
4453: coherency check
4454echo " "
dfe9444c 4455echo "Checking your choice of C compiler and flags for coherency..." >&4
5ff3f7a4
GS
4456$cat > try.c <<'EOF'
4457#include <stdio.h>
732c9516 4458int main() { printf("Ok\n"); exit(0); }
5ff3f7a4 4459EOF
87563a30 4460set X $cc $optimize $ccflags -o try $ldflags try.c $libs
a4f3eea9 4461shift
5ff3f7a4
GS
4462$cat >try.msg <<'EOM'
4463I've tried to compile and run the following simple program:
4464
4465EOM
a83b1ac8 4466$cat try.c >> try.msg
5ff3f7a4
GS
4467
4468$cat >> try.msg <<EOM
4469
4470I used the command:
a4f3eea9 4471
4472 $*
4473 ./try
4474
4475and I got the following output:
4476
4477EOM
a4f3eea9 4478dflt=y
28e8609d 4479if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
a4f3eea9 4480 if sh -c './try' >>try.msg 2>&1; then
dfe9444c
AD
4481 xxx=`./try`
4482 case "$xxx" in
4483 "Ok") dflt=n ;;
4484 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4485 case " $libs " in
4486 *" -lsfio "*)
4487 cat >> try.msg <<'EOQS'
4488If $libs contains -lsfio, and sfio is mis-configured, then it
4489sometimes (apparently) runs and exits with a 0 status, but with no
4490output! It may have to do with sfio's use of _exit vs. exit.
4491
4492EOQS
4493 rp="You have a big problem. Shall I abort Configure"
4494 dflt=y
4495 ;;
4496 esac
4497 ;;
4498 esac
a4f3eea9 4499 else
4500 echo "The program compiled OK, but exited with status $?." >>try.msg
dfe9444c 4501 rp="You have a problem. Shall I abort Configure"
a4f3eea9 4502 dflt=y
4503 fi
4504else
4505 echo "I can't compile the test program." >>try.msg
dfe9444c 4506 rp="You have a BIG problem. Shall I abort Configure"
a4f3eea9 4507 dflt=y
4508fi
4509case "$dflt" in
4510y)
97286747 4511 $cat try.msg >&4
a4f3eea9 4512 case "$knowitall" in
4513 '')
5ff3f7a4 4514 echo "(The supplied flags or libraries might be incorrect.)"
a4f3eea9 4515 ;;
4516 *) dflt=n;;
4517 esac
4518 echo " "
4519 . ./myread
4520 case "$ans" in
4521 n*|N*) ;;
4522 *) echo "Ok. Stopping Configure." >&4
4523 exit 1
4524 ;;
4525 esac
4526 ;;
4527n) echo "OK, that should do.";;
4528esac
4529$rm -f try try.* core
4530
bfb7748a
AD
4531: determine filename position in cpp output
4532echo " "
4533echo "Computing filename position in cpp output for #include directives..." >&4
4534echo '#include <stdio.h>' > foo.c
4535$cat >fieldn <<EOF
4536$startsh
4537$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4538$grep '^[ ]*#.*stdio\.h' | \
4539while read cline; do
4540 pos=1
4541 set \$cline
4542 while $test \$# -gt 0; do
4543 if $test -r \`echo \$1 | $tr -d '"'\`; then
4544 echo "\$pos"
4545 exit 0
4546 fi
4547 shift
4548 pos=\`expr \$pos + 1\`
4549 done
4550done
4551EOF
4552chmod +x fieldn
4553fieldn=`./fieldn`
4554$rm -f foo.c fieldn
4555case $fieldn in
4556'') pos='???';;
45571) pos=first;;
45582) pos=second;;
45593) pos=third;;
4560*) pos="${fieldn}th";;
4561esac
4562echo "Your cpp writes the filename in the $pos field of the line."
4563
4564: locate header file
4565$cat >findhdr <<EOF
4566$startsh
4567wanted=\$1
9cc6feab 4568name=''
3656fc86
JH
4569for usrincdir in $usrinc
4570do
4571 if test -f \$usrincdir/\$wanted; then
4572 echo "\$usrincdir/\$wanted"
4573 exit 0
4574 fi
4575done
bfb7748a
AD
4576awkprg='{ print \$$fieldn }'
4577echo "#include <\$wanted>" > foo\$\$.c
4578$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4579$grep "^[ ]*#.*\$wanted" | \
4580while read cline; do
4581 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4582 case "\$name" in
4e400192
JH
4583 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4584 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4585 *) exit 2;;
bfb7748a
AD
4586 esac;
4587done;
4e400192
JH
4588#
4589# status = 0: grep returned 0 lines, case statement not executed
4590# status = 1: headerfile found
4591# status = 2: while loop executed, no headerfile found
4592#
4593status=\$?
bfb7748a 4594$rm -f foo\$\$.c;
4e400192
JH
4595if test \$status -eq 1; then
4596 exit 0;
4597fi
4598exit 1
bfb7748a
AD
4599EOF
4600chmod +x findhdr
4601
4602: define an alternate in-header-list? function
4603inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4604cont=true; xxf="echo \"<\$1> found.\" >&4";
4605case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4606*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4607esac;
4608case $# in 4) instead=instead;; *) instead="at last";; esac;
4609while $test "$cont"; do
4610 xxx=`./findhdr $1`
4611 var=$2; eval "was=\$$2";
4612 if $test "$xxx" && $test -r "$xxx";
4613 then eval $xxf;
4614 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4615 cont="";
4616 else eval $xxnf;
4617 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4618 set $yyy; shift; shift; yyy=$@;
4619 case $# in 0) cont="";;
4620 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4621 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4622 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4623 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4624 esac;
4625done;
4626while $test "$yyy";
4627do set $yyy; var=$2; eval "was=\$$2";
4628 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4629 set $yyy; shift; shift; yyy=$@;
4630done'
4631
4632: see if this is a malloc.h system
4633set malloc.h i_malloc
4634eval $inhdr
4635
4636: see if stdlib is available
4637set stdlib.h i_stdlib
4638eval $inhdr
4639
4640: determine which malloc to compile in
4641echo " "
4642case "$usemymalloc" in
5ff3f7a4
GS
4643''|[yY]*|true|$define) dflt='y' ;;
4644*) dflt='n' ;;
bfb7748a
AD
4645esac
4646rp="Do you wish to attempt to use the malloc that comes with $package?"
4647. ./myread
4648usemymalloc="$ans"
4649case "$ans" in
4650y*|true)
4651 usemymalloc='y'
4652 mallocsrc='malloc.c'
4653 mallocobj="malloc$_o"
4654 d_mymalloc="$define"
4655 case "$libs" in
4656 *-lmalloc*)
4657 : Remove malloc from list of libraries to use
4658 echo "Removing unneeded -lmalloc from library list" >&4
4659 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4660 shift
4661 libs="$*"
4662 echo "libs = $libs" >&4
4663 ;;
4664 esac
4665 ;;
4666*)
4667 usemymalloc='n'
4668 mallocsrc=''
4669 mallocobj=''
4670 d_mymalloc="$undef"
4671 ;;
4672esac
4673
4674: compute the return types of malloc and free
4675echo " "
4676$cat >malloc.c <<END
4677#$i_malloc I_MALLOC
4678#$i_stdlib I_STDLIB
4679#include <stdio.h>
4680#include <sys/types.h>
4681#ifdef I_MALLOC
4682#include <malloc.h>
4683#endif
4684#ifdef I_STDLIB
4685#include <stdlib.h>
4686#endif
4687#ifdef TRY_MALLOC
4688void *malloc();
4689#endif
4690#ifdef TRY_FREE
4691void free();
4692#endif
4693END
4694case "$malloctype" in
4695'')
4696 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4697 malloctype='void *'
4698 else
4699 malloctype='char *'
4700 fi
4701 ;;
4702esac
4703echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4704
4705case "$freetype" in
4706'')
4707 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4708 freetype='void'
4709 else
4710 freetype='int'
4711 fi
4712 ;;
4713esac
4714echo "Your system uses $freetype free(), it would seem." >&4
4715$rm -f malloc.[co]
a3635516
JH
4716$cat <<EOM
4717
4718The installation process will also create a directory for
4719vendor-supplied add-ons. Vendors who supply perl with their system
4720may find it convenient to place all vendor-supplied files in this
4721directory rather than in the main distribution directory. This will
4722ease upgrades between binary-compatible maintenance versions of perl.
4723
4724Of course you may also use these directories in whatever way you see
4725fit. For example, you might use them to access modules shared over a
4726company-wide network.
4727
4728The default answer should be fine for most people.
4729This causes further questions about vendor add-ons to be skipped
4730and no vendor-specific directories will be configured for perl.
4731
4732EOM
4733rp='Do you want to configure vendor-specific add-on directories?'
4734case "$usevendorprefix" in
4735define|true|[yY]*) dflt=y ;;
4736*) dflt=n ;;
4737esac
4738. ./myread
4739case "$ans" in
4740[yY]*) fn=d~+
4741 rp='Installation prefix to use for vendor-supplied add-ons?'
4742 case "$vendorprefix" in
4743 '') dflt='' ;;
4744 *) dflt=$vendorprefix ;;
4745 esac
4746 . ./getfile
4747 oldvendorprefix=''
4748 case "$vendorprefix" in
4749 '') ;;
4750 *) case "$ans" in
4751 "$prefix") ;;
4752 *) oldvendorprefix="$prefix";;
4753 esac
4754 ;;
4755 esac
4756 usevendorprefix="$define"
4757 vendorprefix="$ans"
4758 vendorprefixexp="$ansexp"
4759 ;;
4760*) usevendorprefix="$undef"
4761 vendorprefix=''
4762 vendorprefixexp=''
4763 ;;
4764esac
4765
4766case "$vendorprefix" in
4767'') d_vendorlib="$undef"
4768 vendorlib=''
4769 vendorlibexp=''
4770 ;;
4771*) d_vendorlib="$define"
4772 : determine where vendor-supplied modules go.
4773 : Usual default is /usr/local/lib/perl5/vendor_perl
4774 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4775 case "$installstyle" in
4776 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4777 *) dflt=$vendorprefix/lib/vendor_$prog ;;
4778 esac
4779 fn=d~+
4780 rp='Pathname for the vendor-supplied library files?'
4781 . ./getfile
4782 vendorlib="$ans"
4783 vendorlibexp="$ansexp"
4784 : Change installation prefix, if necessary.
4785 if $test X"$prefix" != X"$installprefix"; then
ec897fb9 4786 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
a3635516
JH
4787 else
4788 installvendorlib="$vendorlibexp"
4789 fi
4790 ;;
4791esac
4792
c4f23d77
AD
4793: Cruising for prototypes
4794echo " "
4795echo "Checking out function prototypes..." >&4
4796$cat >prototype.c <<'EOCP'
5a411a32 4797int main(int argc, char *argv[]) {
c4f23d77
AD
4798 exit(0);}
4799EOCP
4800if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4801 echo "Your C compiler appears to support function prototypes."
4802 val="$define"
4803else
4804 echo "Your C compiler doesn't seem to understand function prototypes."
4805 val="$undef"
4806fi
4807set prototype
4808eval $setvar
4809$rm -f prototype*
4810
4811case "$prototype" in
4812"$define") ;;
4813*) ansi2knr='ansi2knr'
4814 echo " "
4815 cat <<EOM >&4
4816
4817$me: FATAL ERROR:
4818This version of $package can only be compiled by a compiler that
4819understands function prototypes. Unfortunately, your C compiler
4820 $cc $ccflags
4821doesn't seem to understand them. Sorry about that.
4822
5ff3f7a4 4823If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
4824
4825Eventually, we hope to support building Perl with pre-ANSI compilers.
4826If you would like to help in that effort, please contact <perlbug@perl.org>.
4827
4828Aborting Configure now.
4829EOM
4830 exit 2
4831 ;;
4832esac
4833
4834: determine where public executables go
4835echo " "
4836set dflt bin bin
4837eval $prefixit
4838fn=d~
4839rp='Pathname where the public executables will reside?'
4840. ./getfile
4841if $test "X$ansexp" != "X$binexp"; then
4842 installbin=''
4843fi
4844bin="$ans"
4845binexp="$ansexp"
dd4e71fd
JH
4846: Change installation prefix, if necessary.
4847: XXX Bug? -- ignores Configure -Dinstallprefix setting.
4848if $test X"$prefix" != X"$installprefix"; then
ec897fb9 4849 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
4850else
4851 installbin="$binexp"
c4f23d77
AD
4852fi
4853
104d25b7
JH
4854: determine whether to install perl also as /usr/bin/perl
4855
4856echo " "
dd4e71fd 4857if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7
JH
4858 $cat <<EOM
4859Many scripts expect to perl to be installed as /usr/bin/perl.
4860I can install the perl you are about to compile also as /usr/bin/perl
4861(in addition to $installbin/perl).
4862EOM
472a4973
JH
4863 case "$installusrbinperl" in
4864 "$undef"|[nN]*) dflt='n';;
4865 *) dflt='y';;
4866 esac
104d25b7
JH
4867 rp="Do you want to install perl as /usr/bin/perl?"
4868 . ./myread
4869 case "$ans" in
4870 [yY]*) val="$define";;
472a4973 4871 *) val="$undef" ;;
104d25b7 4872 esac
472a4973
JH
4873else
4874 val="$undef"
4875fi
104d25b7
JH
4876set installusrbinperl
4877eval $setvar
4878
dfe9444c
AD
4879: define a shorthand compile call
4880compile='
4881mc_file=$1;
4882shift;
c4f23d77 4883$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
dc45a647
MB
4884: define a shorthand compile call for compilations that should be ok.
4885compile_ok='
4886mc_file=$1;
4887shift;
c4f23d77 4888$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
dfe9444c 4889
a4f3eea9 4890echo " "
4891echo "Checking for GNU C Library..." >&4
4892cat >gnulibc.c <<EOM
aebf16e7 4893#include <stdio.h>
5a411a32 4894int main()
a4f3eea9 4895{
aebf16e7
AD
4896#ifdef __GLIBC__
4897 exit(0);
4898#else
4899 exit(1);
4900#endif
a4f3eea9 4901}
4902EOM
dfe9444c 4903set gnulibc
aebf16e7 4904if eval $compile_ok && ./gnulibc; then
a4f3eea9 4905 val="$define"
4906 echo "You are using the GNU C Library"
4633a7c4 4907else
a4f3eea9 4908 val="$undef"
4909 echo "You are not using the GNU C Library"
4633a7c4 4910fi
a4f3eea9 4911$rm -f gnulibc*
4912set d_gnulibc
4913eval $setvar
25f94b33 4914
a4f3eea9 4915: see if nm is to be used to determine whether a symbol is defined or not
4916case "$usenm" in
4917'')
dc45a647 4918 dflt=''
a4f3eea9 4919 case "$d_gnulibc" in
dc45a647
MB
4920 "$define")
4921 echo " "
4922 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 4923 dflt=n
4924 ;;
dc45a647
MB
4925 esac
4926 case "$dflt" in
4927 '')
4928 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4929 echo " "
4930 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4931 echo "'nm' won't be sufficient on this sytem." >&4
4932 dflt=n
4933 fi
4934 ;;
4935 esac
4936 case "$dflt" in
c4f23d77 4937 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 4938 if $test $dflt -gt 20; then
4939 dflt=y
4940 else
4941 dflt=n
4942 fi
4943 ;;
4944 esac
4945 ;;
4946*)
4947 case "$usenm" in
dc45a647 4948 true|$define) dflt=y;;
a4f3eea9 4949 *) dflt=n;;
4950 esac
4951 ;;
25f94b33 4952esac
a4f3eea9 4953$cat <<EOM
4633a7c4 4954
dc45a647
MB
4955I can use $nm to extract the symbols from your C libraries. This
4956is a time consuming task which may generate huge output on the disk (up
4957to 3 megabytes) but that should make the symbols extraction faster. The
4958alternative is to skip the 'nm' extraction part and to compile a small
4959test program instead to determine whether each symbol is present. If
4960you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4961this may be the best solution.
4962
4963You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 4964
a4f3eea9 4965EOM
693762b4 4966rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
4967. ./myread
4968case "$ans" in
dc45a647 4969[Nn]*) usenm=false;;
a4f3eea9 4970*) usenm=true;;
4633a7c4
LW
4971esac
4972
a4f3eea9 4973runnm=$usenm
4974case "$reuseval" in
4975true) runnm=false;;
4633a7c4 4976esac
a4f3eea9 4977
4978: nm options which may be necessary
4979case "$nm_opt" in
4980'') if $test -f /mach_boot; then
1e422769 4981 nm_opt='' # Mach
a4f3eea9 4982 elif $test -d /usr/ccs/lib; then
1e422769 4983 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 4984 elif $test -f /dgux; then
1e422769 4985 nm_opt='-p' # DG-UX
2ae324a7 4986 elif $test -f /lib64/rld; then
1e422769 4987 nm_opt='-p' # 64-bit Irix
a4f3eea9 4988 else
4989 nm_opt=''
4990 fi;;
4633a7c4 4991esac
4633a7c4 4992
a4f3eea9 4993: nm options which may be necessary for shared libraries but illegal
4994: for archive libraries. Thank you, Linux.
4995case "$nm_so_opt" in
4996'') case "$myuname" in
4997 *linux*)
693762b4 4998 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 4999 nm_so_opt='--dynamic'
4633a7c4 5000 fi
a4f3eea9 5001 ;;
4633a7c4 5002 esac
4633a7c4
LW
5003 ;;
5004esac
5005
a4f3eea9 5006case "$runnm" in
5007true)
5008: get list of predefined functions in a handy place
5009echo " "
5010case "$libc" in
5011'') libc=unknown
5012 case "$libs" in
dfe9444c 5013 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 5014 esac
5015 ;;
5016esac
5017libnames='';
5018case "$libs" in
5019'') ;;
5020*) for thislib in $libs; do
5021 case "$thislib" in
5022 -lc|-lc_s)
5023 : Handle C library specially below.
5024 ;;
5025 -l*)
5026 thislib=`echo $thislib | $sed -e 's/^-l//'`
5027 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5028 :
5029 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5030 :
dfe9444c 5031 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 5032 :
dfe9444c 5033 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 5034 :
a4f3eea9 5035 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5036 :
5037 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5038 :
dfe9444c 5039 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 5040 :
5041 else
5042 try=''
5043 fi
5044 libnames="$libnames $try"
5045 ;;
5046 *) libnames="$libnames $thislib" ;;
5047 esac
5048 done
5049 ;;
5050esac
5051xxx=normal
5052case "$libc" in
5053unknown)
5054 set /lib/libc.$so
5055 for xxx in $libpth; do
5056 $test -r $1 || set $xxx/libc.$so
5057 : The messy sed command sorts on library version numbers.
5058 $test -r $1 || \
5059 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 5060 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 5061 h
5062 s/[0-9][0-9]*/0000&/g
5063 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5064 G
5065 s/\n/ /' | \
dfe9444c 5066 sort | $sed -e 's/^.* //'`
a4f3eea9 5067 eval set \$$#
5068 done
5069 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
5070 $test -r $1 || set /lib/libsys_s$_a
5071 ;;
a4f3eea9 5072*)
5073 set blurfl
5074 ;;
5075esac
5076if $test -r "$1"; then
5077 echo "Your (shared) C library seems to be in $1."
5078 libc="$1"
5079elif $test -r /lib/libc && $test -r /lib/clib; then
5080 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5081 xxx=apollo
5082 libc='/lib/clib /lib/libc'
5083 if $test -r /lib/syslib; then
5084 echo "(Your math library is in /lib/syslib.)"
5085 libc="$libc /lib/syslib"
5086 fi
5087elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5088 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
5089elif $test -r $incpath/usr/lib/libc$_a; then
5090 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 5091 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
5092elif $test -r /lib/libc$_a; then
5093 libc=/lib/libc$_a;
a4f3eea9 5094 echo "Your C library seems to be in $libc. You're normal."
5095else
dfe9444c 5096 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 5097 :
5098 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5099 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5100 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5101 :
dfe9444c 5102 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5103 :
dfe9444c 5104 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5105 :
4633a7c4 5106 else
dfe9444c 5107 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 5108 fi
a4f3eea9 5109 if $test -r "$tans"; then
5110 echo "Your C library seems to be in $tans, of all places."
5111 libc=$tans
5112 else
5113 libc='blurfl'
5114 fi
5115fi
5116if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5117 dflt="$libc"
5118 cat <<EOM
4633a7c4 5119
a4f3eea9 5120If the guess above is wrong (which it might be if you're using a strange
5121compiler, or your machine supports multiple models), you can override it here.
4633a7c4 5122
a4f3eea9 5123EOM
5124else
5125 dflt=''
28e8609d 5126 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 5127 cat >&4 <<EOM
5128I can't seem to find your C library. I've looked in the following places:
4633a7c4 5129
a4f3eea9 5130EOM
5131 $sed 's/^/ /' libpath
5132 cat <<EOM
4633a7c4 5133
a4f3eea9 5134None of these seems to contain your C library. I need to get its name...
4633a7c4 5135
a4f3eea9 5136EOM
5137fi
5138fn=f
5139rp='Where is your C library?'
5140. ./getfile
5141libc="$ans"
4633a7c4 5142
4633a7c4 5143echo " "
28e8609d 5144echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 5145set X `cat libnames`
4633a7c4 5146shift
a4f3eea9 5147xxx=files
5148case $# in 1) xxx=file; esac
5149echo "Extracting names from the following $xxx for later perusal:" >&4
5150echo " "
5151$sed 's/^/ /' libnames >&4
5152echo " "
5153$echo $n "This may take a while...$c" >&4
4633a7c4 5154
dfe9444c
AD
5155for file in $*; do
5156 case $file in
693762b4
AD
5157 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5158 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5159 esac
dfe9444c 5160done >libc.tmp
4633a7c4 5161
a4f3eea9 5162$echo $n ".$c"
5163$grep fprintf libc.tmp > libc.ptf
5164xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5165xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5166xxx='[ADTSIW]'
5167if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5168 eval $xscan;\
5169 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5170 eval $xrun
5171elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5172 eval $xscan;\
5173 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5174 eval $xrun
5175elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5176 eval $xscan;\
5177 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5178 eval $xrun
5179elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5180 eval $xscan;\
5181 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5182 eval $xrun
5183elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5184 eval $xscan;\
5185 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5186 eval $xrun
5187elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5188 eval $xscan;\
5189 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5190 eval $xrun
5191elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5192 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5193 eval $xscan;\
5194 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5195 eval $xrun
5196elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5197 eval $xscan;\
5198 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5199 eval $xrun
5200elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5201 eval $xscan;\
5202 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5203 eval $xrun
1e422769 5204elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5205 eval $xscan;\
5206 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5207 eval $xrun
a4f3eea9 5208elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5209 eval $xscan;\
5210 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5211 eval $xrun
5212elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5213 eval $xscan;\
5214 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5215 eval $xrun
44a8e56a 5216elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5217 eval $xscan;\
5218 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5219 eval $xrun
0f502cca
BL
5220elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5221 eval $xscan;\
5222 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5223 eval $xrun
a4f3eea9 5224else
693762b4 5225 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 5226 $grep fprintf libc.tmp > libc.ptf
5227 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5228 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5229 then
5230 nm_opt='-p'
5231 eval $xrun
4633a7c4 5232 else
a4f3eea9 5233 echo " "
e5c9fcd0 5234 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 5235 com=''
dc45a647
MB
5236 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5237 for thisname in $libnames $libc; do
e5c9fcd0 5238 $ar t $thisname >>libc.tmp
a4f3eea9 5239 done
dfe9444c 5240 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 5241 echo "Ok." >&4
dc45a647
MB
5242 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5243 # Repeat libc to extract forwarders to DLL entries too
5244 for thisname in $libnames $libc; do
5245 $ar tv $thisname >>libc.tmp
5246 # Revision 50 of EMX has bug in $ar.
5247 # it will not extract forwarders to DLL entries
5248 # Use emximp which will extract exactly them.
5249 emximp -o tmp.imp $thisname \
5250 2>/dev/null && \
5251 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5252 < tmp.imp >>libc.tmp
5253 $rm tmp.imp
5254 done
5255 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5256 echo "Ok." >&4
a4f3eea9 5257 else
e5c9fcd0 5258 echo "$ar didn't seem to work right." >&4
a4f3eea9 5259 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 5260 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 5261 then
5262 for thisname in $libnames; do
5263 bld t $libnames | \
dfe9444c 5264 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 5265 $ar t $thisname >>libc.tmp
a4f3eea9 5266 done
5267 echo "Ok." >&4
5268 else
5269 echo "That didn't work either. Giving up." >&4
5270 exit 1
5271 fi
5272 fi
4633a7c4 5273 fi
4633a7c4 5274fi
a4f3eea9 5275nm_extract="$com"
5276if $test -f /lib/syscalls.exp; then
4633a7c4 5277 echo " "
a4f3eea9 5278 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 5279 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 5280fi
5281;;
5282esac
5283$rm -f libnames libpath
5284
2afac517 5285: see if dld is available
5286set dld.h i_dld
5287eval $inhdr
4633a7c4 5288
2afac517 5289: is a C symbol defined?
5290csym='tlook=$1;
5291case "$3" in
5292-v) tf=libc.tmp; tc=""; tdc="";;
5293-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5294*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5295esac;
5296tx=yes;
5297case "$reuseval-$4" in
5298true-) ;;
5299true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5300esac;
5301case "$tx" in
5302yes)
5303 case "$runnm" in
5304 true)
5305 if $contains $tlook $tf >/dev/null 2>&1;
5306 then tval=true;
5307 else tval=false;
5308 fi;;
5309 *)
d674cd6d 5310 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 5311 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 5312 then tval=true;
5313 else tval=false;
5314 fi;
5315 $rm -f t t.c;;
5316 esac;;
5317*)
5318 case "$tval" in
5319 $define) tval=true;;
5320 *) tval=false;;
5321 esac;;
5322esac;
5323eval "$2=$tval"'
4633a7c4 5324
2afac517 5325: define an is-in-libc? function
5326inlibc='echo " "; td=$define; tu=$undef;
5327sym=$1; var=$2; eval "was=\$$2";
5328tx=yes;
5329case "$reuseval$was" in
5330true) ;;
5331true*) tx=no;;
5332esac;
5333case "$tx" in
5334yes)
5335 set $sym tres -f;
5336 eval $csym;
5337 case "$tres" in
5338 true)
5339 echo "$sym() found." >&4;
5340 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5341 *)
5342 echo "$sym() NOT found." >&4;
5343 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5344 esac;;
5345*)
5346 case "$was" in
5347 $define) echo "$sym() found." >&4;;
5348 *) echo "$sym() NOT found." >&4;;
5349 esac;;
5350esac'
4633a7c4 5351
2afac517 5352: see if dlopen exists
5353xxx_runnm="$runnm"
5354runnm=false
5355set dlopen d_dlopen
5356eval $inlibc
5357runnm="$xxx_runnm"
40a7a20a 5358
2afac517 5359: determine which dynamic loading, if any, to compile in
4633a7c4 5360echo " "
2afac517 5361dldir="ext/DynaLoader"
5362case "$usedl" in
5363$define|y|true)
5364 dflt='y'
5365 usedl="$define"
5366 ;;
5367$undef|n|false)
5368 dflt='n'
5369 usedl="$undef"
5370 ;;
5371*)
5372 dflt='n'
5373 case "$d_dlopen" in
5374 $define) dflt='y' ;;
5375 esac
5376 case "$i_dld" in
5377 $define) dflt='y' ;;
4633a7c4 5378 esac
2afac517 5379 : Does a dl_xxx.xs file exist for this operating system
dc45a647 5380 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
5381 ;;
5382esac
2afac517 5383rp="Do you wish to use dynamic loading?"
5384. ./myread
5385usedl="$ans"
5386case "$ans" in
5387y*) usedl="$define"
5388 case "$dlsrc" in
5389 '')
dc45a647 5390 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 5391 dflt="$dldir/dl_${osname}.xs"
5392 elif $test "$d_dlopen" = "$define" ; then
5393 dflt="$dldir/dl_dlopen.xs"
5394 elif $test "$i_dld" = "$define" ; then
5395 dflt="$dldir/dl_dld.xs"
4633a7c4 5396 else
2afac517 5397 dflt=''
4633a7c4 5398 fi
4633a7c4 5399 ;;
2afac517 5400 *) dflt="$dldir/$dlsrc"
5401 ;;
4633a7c4 5402 esac
2afac517 5403 echo "The following dynamic loading files are available:"
5404 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
5405 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5406 rp="Source file to use for dynamic loading"
5407 fn="fne"
b233458b 5408 gfpth="$src"
dc45a647 5409 . ./getfile
2afac517 5410 usedl="$define"
5411 : emulate basename
5412 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 5413
dc45a647 5414 $cat << EOM
2304df62 5415
2afac517 5416Some systems may require passing special flags to $cc -c to
5417compile modules that will be used to create a shared library.
5418To use no flags, say "none".
2304df62
AD
5419
5420EOM
2afac517 5421 case "$cccdlflags" in
5422 '') case "$gccversion" in
5423 '') case "$osname" in
5424 hpux) dflt='+z' ;;
5425 next) dflt='none' ;;
8cc95fdb 5426 irix*) dflt='-KPIC' ;;
3a6175e1 5427 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 5428 sunos) dflt='-pic' ;;
5429 *) dflt='none' ;;
dfe9444c
AD
5430 esac
5431 ;;
5432 *) case "$osname" in
3a6175e1 5433 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 5434 *) dflt='-fpic' ;;
81d89818 5435 esac ;;
2afac517 5436 esac ;;
bfb7748a 5437 ' ') dflt='none' ;;
2afac517 5438 *) dflt="$cccdlflags" ;;
5439 esac
5440 rp="Any special flags to pass to $cc -c to compile shared library modules?"
5441 . ./myread
5442 case "$ans" in
5443 none) cccdlflags=' ' ;;
5444 *) cccdlflags="$ans" ;;
5445 esac
2304df62 5446
2afac517 5447 cat << EOM
ecfc5424 5448
2afac517 5449Some systems use ld to create libraries that can be dynamically loaded,
5450while other systems (such as those using ELF) use $cc.
a0f45b59 5451
2afac517 5452EOM
5453 case "$ld" in
5454 '') $cat >try.c <<'EOM'
5455/* Test for whether ELF binaries are produced */
5456#include <fcntl.h>
5457#include <stdlib.h>
5a411a32 5458int main() {
2afac517 5459 char b[4];
5460 int i = open("a.out",O_RDONLY);
5461 if(i == -1)
5462 exit(1); /* fail */
5463 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5464 exit(0); /* succeed (yes, it's ELF) */
2304df62 5465 else
2afac517 5466 exit(1); /* fail */
5467}
5468EOM
5469 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5470 cat <<EOM
5471You appear to have ELF support. I'll use $cc to build dynamic libraries.
5472EOM
5473 dflt="$cc"
2304df62 5474 else
2afac517 5475 echo "I'll use ld to build dynamic libraries."
5476 dflt='ld'
2304df62 5477 fi
2afac517 5478 rm -f try.c a.out
5479 ;;
5480 *) dflt="$ld"
5481 ;;
5482 esac
5483
5484 rp="What command should be used to create dynamic libraries?"
5485 . ./myread
5486 ld="$ans"
5487
5488 cat << EOM
5489
5490Some systems may require passing special flags to $ld to create a
5491library that can be dynamically loaded. If your ld flags include
5492-L/other/path options to locate libraries outside your loader's normal
5493search path, you may need to specify those -L options here as well. To
5494use no flags, say "none".
5495
5496EOM
5497 case "$lddlflags" in
5498 '') case "$osname" in
46193409 5499 beos) dflt='-nostart' ;;
2afac517 5500 hpux) dflt='-b' ;;
5501 linux|irix*) dflt='-shared' ;;
5502 next) dflt='none' ;;
5503 solaris) dflt='-G' ;;
5504 sunos) dflt='-assert nodefinitions' ;;
5505 svr4*|esix*) dflt="-G $ldflags" ;;
5506 *) dflt='none' ;;
5507 esac
5508 ;;
5509 *) dflt="$lddlflags" ;;
5510 esac
5511
bfb7748a 5512 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
5513 : Be careful not to append to a plain 'none'
5514 case "$dflt" in
5515 none) dflt='' ;;
5516 esac
bfb7748a
AD
5517 for thisflag in $ldflags; do
5518 case "$thisflag" in
5519 -L*)
5520 case " $dflt " in
5521 *" $thisflag "*) ;;
5522 *) dflt="$dflt $thisflag" ;;
5523 esac
5524 ;;
2afac517 5525 esac
bfb7748a 5526 done
2afac517 5527
bfb7748a
AD
5528 case "$dflt" in
5529 ''|' ') dflt='none' ;;
5530 esac
2afac517 5531
5532 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5533 . ./myread
5534 case "$ans" in
5535 none) lddlflags=' ' ;;
5536 *) lddlflags="$ans" ;;
5537 esac
5538
5539 cat <<EOM
5540
5541Some systems may require passing special flags to $cc to indicate that
5542the resulting executable will use dynamic linking. To use no flags,
5543say "none".
5544
5545EOM
5546 case "$ccdlflags" in
5547 '') case "$osname" in
5548 hpux) dflt='-Wl,-E' ;;
5549 linux) dflt='-rdynamic' ;;
5550 next) dflt='none' ;;
5551 sunos) dflt='none' ;;
5552 *) dflt='none' ;;
5553 esac ;;
bfb7748a 5554 ' ') dflt='none' ;;
2afac517 5555 *) dflt="$ccdlflags" ;;
5556 esac
5557 rp="Any special flags to pass to $cc to use dynamic loading?"
5558 . ./myread
5559 case "$ans" in
5560 none) ccdlflags=' ' ;;
5561 *) ccdlflags="$ans" ;;
5562 esac
5563 ;;
5564*) usedl="$undef"
5565 ld='ld'
5566 dlsrc='dl_none.xs'
5567 lddlflags=''
5568 ccdlflags=''
5569 ;;
5570esac
5571
5572also=''
5573case "$usedl" in
5574$undef)
5575 # No dynamic loading being used, so don't bother even to prompt.
5576 useshrplib='false'
5577 ;;
5578*) case "$useshrplib" in
5579 '') case "$osname" in
46193409 5580 svr4*|dgux|dynixptx|esix|powerux|beos)
3e3baf6d 5581 dflt=y
2afac517 5582 also='Building a shared libperl is required for dynamic loading to work on your system.'
5583 ;;
5584 next*)
5585 case "$osvers" in
3e3baf6d 5586 4*) dflt=y
2afac517 5587 also='Building a shared libperl is needed for MAB support.'
5588 ;;
3e3baf6d 5589 *) dflt=n
2afac517 5590 ;;
5591 esac
5592 ;;
3e3baf6d 5593 *) dflt=n
2afac517 5594 ;;
5595 esac
5596 ;;
5597 $define|true|[Yy]*)
3e3baf6d 5598 dflt=y
2afac517 5599 ;;
3e3baf6d 5600 *) dflt=n
2afac517 5601 ;;
5602 esac
5603 $cat << EOM
5604
5605The perl executable is normally obtained by linking perlmain.c with
dfe9444c 5606libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 5607any other libraries needed on this system (such as -lm, etc.). Since
5608your system supports dynamic loading, it is probably possible to build
5609a shared libperl.$so. If you will have more than one executable linked
5610to libperl.$so, this will significantly reduce the size of each
5611executable, but it may have a noticeable affect on performance. The
5612default is probably sensible for your system.
5613$also
5614
5615EOM
5616 rp="Build a shared libperl.$so (y/n)"
5617 . ./myread
5618 case "$ans" in
5619 true|$define|[Yy]*)
5cf1d1f1 5620 useshrplib='true' ;;
2afac517 5621 *) useshrplib='false' ;;
5622 esac
5623 ;;
5624esac
5625
5626case "$useshrplib" in
5627true)
5628 case "$libperl" in
5629 '')
5630 # Figure out a good name for libperl.so. Since it gets stored in
5631 # a version-specific architecture-dependent library, the version
5632 # number isn't really that important, except for making cc/ld happy.
5633 #
5634 # A name such as libperl.so.3.1
5635 majmin="libperl.$so.$patchlevel.$subversion"
5636 # A name such as libperl.so.301
5637 majonly=`echo $patchlevel $subversion |
5638 $awk '{printf "%d%02d", $1, $2}'`
5639 majonly=libperl.$so.$majonly
5640 # I'd prefer to keep the os-specific stuff here to a minimum, and
5641 # rely on figuring it out from the naming of libc.
5642 case "${osname}${osvers}" in
5643 next4*)
5644 dflt=libperl.5.$so
5645 # XXX How handle the --version stuff for MAB?
5646 ;;
5647 linux*) # ld won't link with a bare -lperl otherwise.
5648 dflt=libperl.$so
5649 ;;
5650 *) # Try to guess based on whether libc has major.minor.
5651 case "$libc" in
5652 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5653 *libc.$so.[0-9]*) dflt=$majonly ;;
5654 *) dflt=libperl.$so ;;
5655 esac
5656 ;;
5657 esac
5658 ;;
5659 *) dflt=$libperl
5660 ;;
5661 esac
5662 cat << EOM
5663
5664I need to select a good name for the shared libperl. If your system uses
5665library names with major and minor numbers, then you might want something
5666like $majmin. Alternatively, if your system uses a single version
5667number for shared libraries, then you might want to use $majonly.
5668Or, your system might be quite happy with a simple libperl.$so.
5669
5670Since the shared libperl will get installed into a version-specific
5671architecture-dependent directory, the version number of the shared perl
5672library probably isn't important, so the default should be o.k.
5673
5674EOM
5675 rp='What name do you want to give to the shared libperl?'
5676 . ./myread
5677 libperl=$ans
5678 echo "Ok, I'll use $libperl"
5679 ;;
5680*)
dfe9444c 5681 libperl="libperl${_a}"
2afac517 5682 ;;
5683esac
5684
5685# Detect old use of shrpdir via undocumented Configure -Dshrpdir
5686case "$shrpdir" in
5687'') ;;
5688*) $cat >&4 <<EOM
5689WARNING: Use of the shrpdir variable for the installation location of
5690the shared $libperl is not supported. It was never documented and
46193409 5691will not work in this version. Let me (perlbug@perl.com)
dfe9444c 5692know of any problems this may cause.
2afac517 5693
5694EOM
5695 case "$shrpdir" in
5696 "$archlibexp/CORE")
5697 $cat >&4 <<EOM
5698But your current setting of $shrpdir is
5699the default anyway, so it's harmless.
5700EOM
5701 ;;
5702 *)
4e2a5f63
AD
5703 $cat >&4 <<EOM
5704Further, your current attempted setting of $shrpdir
5705conflicts with the value of $archlibexp/CORE
5706that installperl will use.
5707EOM
dc45a647
MB
5708 ;;
5709 esac
5710 ;;
5711esac
5712
5713# How will the perl executable find the installed shared $libperl?
5714# Add $xxx to ccdlflags.
5715# If we can't figure out a command-line option, use $shrpenv to
5716# set env LD_RUN_PATH. The main perl makefile uses this.
5717shrpdir=$archlibexp/CORE
5718xxx=''
5719tmp_shrpenv=''
5720if "$useshrplib"; then
5721 case "$osname" in
5722 aix)
5723 # We'll set it in Makefile.SH...
5724 ;;
5725 solaris|netbsd)
5726 xxx="-R $shrpdir"
5727 ;;
5728 freebsd)
5729 xxx="-Wl,-R$shrpdir"
5730 ;;
5731 linux|irix*|dec_osf)
5732 xxx="-Wl,-rpath,$shrpdir"
5733 ;;
5734 next)
5735 # next doesn't like the default...
5736 ;;
46193409
JH
5737 beos)
5738 # beos doesn't like the default, either.
5739 ;;
3656fc86
JH
5740 hpux*)
5741 # hpux doesn't like the default, either.
5742 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5743 ;;
dc45a647
MB
5744 *)
5745 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5746 ;;
5747 esac
5748 case "$xxx" in
5749 '') ;;
5750 *)
5751 # Only add $xxx if it isn't already in ccdlflags.
5752 case " $ccdlflags " in
5753 *" $xxx "*) ;;
5754 *) ccdlflags="$ccdlflags $xxx"
5755 cat <<EOM >&4
5756
5757Adding $xxx to the flags
5758passed to $ld so that the perl executable will find the
5759installed shared $libperl.
5760
5761EOM
5762 ;;
5763 esac
5764 ;;
5765 esac
5766fi
5cf1d1f1
JH
5767# Fix ccdlflags in AIX for building external extensions.
5768# (For building Perl itself bare -bE:perl.exp is needed,
5769# Makefile.SH takes care of this.)
5f9d9a17 5770case "$osname" in
5cf1d1f1 5771aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5f9d9a17 5772esac
dc45a647
MB
5773# Respect a hint or command-line value.
5774case "$shrpenv" in
5775'') shrpenv="$tmp_shrpenv" ;;
5776esac
5cf1d1f1
JH
5777case "$ldlibpthname" in
5778'') ldlibpthname=LD_LIBRARY_PATH ;;
5779none) ldlibpthname='' ;;
5780esac
dc45a647
MB
5781
5782: determine where manual pages go
5783set man1dir man1dir none
5784eval $prefixit
5785$cat <<EOM
5786
5787$spackage has manual pages available in source form.
5788EOM
5789case "$nroff" in
5790nroff)
5791 echo "However, you don't have nroff, so they're probably useless to you."
5792 case "$man1dir" in
5793 '') man1dir="none";;
5794 esac;;
5795esac
5796echo "If you don't want the manual sources installed, answer 'none'."
5797case "$man1dir" in
5798' ') dflt=none
5799 ;;
5800'')
5801 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5802 lookpath="$lookpath $prefixexp/man/p_man/man1"
5803 lookpath="$lookpath $prefixexp/man/u_man/man1"
5804 lookpath="$lookpath $prefixexp/man/man.1"
5805 case "$sysman" in
5806 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5807 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5808 esac
5809 set dflt
5810 eval $prefixup
5811 ;;
5812*) dflt="$man1dir"
5813 ;;
5814esac
5815echo " "
5816fn=dn+~
5817rp="Where do the main $spackage manual pages (source) go?"
5818. ./getfile
5819if $test "X$man1direxp" != "X$ansexp"; then
5820 installman1dir=''
5821fi
5822man1dir="$ans"
5823man1direxp="$ansexp"
5824case "$man1dir" in
dd4e71fd 5825'') man1dir=' '
dc45a647
MB
5826 installman1dir='';;
5827esac
dc45a647 5828
dd4e71fd
JH
5829: Change installation prefix, if necessary.
5830if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5831 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5832else
5833 installman1dir="$man1direxp"
dc45a647
MB
5834fi
5835
5836: What suffix to use on installed man pages
5837
5838case "$man1dir" in
5839' ')
5840 man1ext='0'
5841 ;;
5842*)
5843 rp="What suffix should be used for the main $spackage man pages?"
5844 case "$man1ext" in
5845 '') case "$man1dir" in
5846 *1) dflt=1 ;;
5847 *1p) dflt=1p ;;
5848 *1pm) dflt=1pm ;;
5849 *l) dflt=l;;
5850 *n) dflt=n;;
5851 *o) dflt=o;;
5852 *p) dflt=p;;
5853 *C) dflt=C;;
5854 *L) dflt=L;;
5855 *L1) dflt=L1;;
5856 *) dflt=1;;
5857 esac
5858 ;;
5859 *) dflt="$man1ext";;
5860 esac
5861 . ./myread
5862 man1ext="$ans"
5863 ;;
5864esac
5865
5866: see if we can have long filenames
5867echo " "
5868rmlist="$rmlist /tmp/cf$$"
5869$test -d /tmp/cf$$ || mkdir /tmp/cf$$
5870first=123456789abcdef
5871second=/tmp/cf$$/$first
5872$rm -f $first $second
5873if (echo hi >$first) 2>/dev/null; then
5874 if $test -f 123456789abcde; then
5875 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
5876 val="$undef"
5877 else
5878 if (echo hi >$second) 2>/dev/null; then
5879 if $test -f /tmp/cf$$/123456789abcde; then
5880 $cat <<'EOM'
5881That's peculiar... You can have filenames longer than 14 characters, but only
5882on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
5883I shall consider your system cannot support long filenames at all.
5884EOM
5885 val="$undef"
5886 else
5887 echo 'You can have filenames longer than 14 characters.' >&4
5888 val="$define"
5889 fi
5890 else
5891 $cat <<'EOM'
5892How confusing! Some of your filesystems are sane enough to allow filenames
5893longer than 14 characters but some others like /tmp can't even think about them.
5894So, for now on, I shall assume your kernel does not allow them at all.
5895EOM
5896 val="$undef"
5897 fi
5898 fi
5899else
5900 $cat <<'EOM'
5901You can't have filenames longer than 14 chars. You can't even think about them!
5902EOM
5903 val="$undef"
5904fi
5905set d_flexfnam
5906eval $setvar
5907$rm -rf /tmp/cf$$ 123456789abcde*
5908
5909: determine where library module manual pages go
5910set man3dir man3dir none
5911eval $prefixit
5912$cat <<EOM
5913
5914$spackage has manual pages for many of the library modules.
5915EOM
5916
5917case "$nroff" in
5918nroff)
5919 $cat <<'EOM'
5920However, you don't have nroff, so they're probably useless to you.
5921EOM
5922 case "$man3dir" in
5923 '') man3dir="none";;
5924 esac;;
5925esac
5926
5927case "$d_flexfnam" in
5928undef)
5929 $cat <<'EOM'
5930However, your system can't handle the long file names like File::Basename.3.
5931EOM
5932 case "$man3dir" in
5933 '') man3dir="none";;
5934 esac;;
5935esac
5936
5937echo "If you don't want the manual sources installed, answer 'none'."
5938prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5939case "$man3dir" in
dd4e71fd
JH
5940'') dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5941 if $test -d "$privlib/man/man3"; then
5942 cat <<EOM >&4
5943
5944WARNING: Previous versions of perl installed man3 pages into
5945$privlib/man/man3. This version will suggest a
5946new default of $dflt.
5947EOM
5948 tdflt=$dflt
5949 dflt='n'
5950 rp='Do you wish to preserve the old behavior?(y/n)'
5951 . ./myread
5952 case "$ans" in
5953 y*) dflt="$privlib/man/man3" ;;
5954 *) dflt=$tdflt ;;
5955 esac
5956 fi
2afac517 5957 ;;
dc45a647
MB
5958' ') dflt=none;;
5959*) dflt="$man3dir" ;;
2afac517 5960esac
dc45a647 5961echo " "
dc45a647
MB
5962fn=dn+~
5963rp="Where do the $package library man pages (source) go?"
5964. ./getfile
dc45a647
MB
5965man3dir="$ans"
5966man3direxp="$ansexp"
dd4e71fd
JH
5967case "$man1dir" in
5968'') man3dir=' '
dc45a647
MB
5969 installman3dir='';;
5970esac
dc45a647 5971
dd4e71fd
JH
5972: Change installation prefix, if necessary.
5973if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5974 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5975else
5976 installman3dir="$man3direxp"
dc45a647
MB
5977fi
5978
5979: What suffix to use on installed man pages
dc45a647
MB
5980case "$man3dir" in
5981' ')
5982 man3ext='0'
5983 ;;
5984*)
5985 rp="What suffix should be used for the $package library man pages?"
5986 case "$man3ext" in
5987 '') case "$man3dir" in
5988 *3) dflt=3 ;;
5989 *3p) dflt=3p ;;
5990 *3pm) dflt=3pm ;;
5991 *l) dflt=l;;
5992 *n) dflt=n;;
5993 *o) dflt=o;;
5994 *p) dflt=p;;
5995 *C) dflt=C;;
5996 *L) dflt=L;;
5997 *L3) dflt=L3;;
5998 *) dflt=3;;
2afac517 5999 esac
6000 ;;
dc45a647 6001 *) dflt="$man3ext";;
2afac517 6002 esac
dc45a647
MB
6003 . ./myread
6004 man3ext="$ans"
6005 ;;
2afac517 6006esac
6007
6008: see if we have to deal with yellow pages, now NIS.
6009if $test -d /usr/etc/yp || $test -d /etc/yp; then
6010 if $test -f /usr/etc/nibindd; then
6011 echo " "
6012 echo "I'm fairly confident you're on a NeXT."
6013 echo " "
6014 rp='Do you get the hosts file via NetInfo?'
6015 dflt=y
6016 case "$hostcat" in
6017 nidump*) ;;
6018 '') ;;
6019 *) dflt=n;;
6020 esac
6021 . ./myread
6022 case "$ans" in
6023 y*) hostcat='nidump hosts .';;
6024 *) case "$hostcat" in
6025 nidump*) hostcat='';;
6026 esac
6027 ;;
6028 esac
6029 fi
6030 case "$hostcat" in
6031 nidump*) ;;
6032 *)
6033 case "$hostcat" in
6034 *ypcat*) dflt=y;;
6035 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6036 dflt=y
6037 else
6038 dflt=n
6039 fi;;
6040 *) dflt=n;;
6041 esac
6042 echo " "
6043 rp='Are you getting the hosts file via yellow pages?'
6044 . ./myread
6045 case "$ans" in
6046 y*) hostcat='ypcat hosts';;
6047 *) hostcat='cat /etc/hosts';;
6048 esac
6049 ;;
6050 esac
6051fi
dfe9444c
AD
6052case "$hostcat" in
6053'') hostcat='cat /etc/hosts';;
6054esac
6055case "$groupcat" in
6056'') groupcat='cat /etc/group';;
6057esac
6058case "$passcat" in
6059'') passcat='cat /etc/passwd';;
6060esac
2afac517 6061
6062: now get the host name
6063echo " "
6064echo "Figuring out host name..." >&4
6065case "$myhostname" in
6066'') cont=true
6067 echo 'Maybe "hostname" will work...'
6068 if tans=`sh -c hostname 2>&1` ; then
6069 myhostname=$tans
6070 phostname=hostname
6071 cont=''
6072 fi
6073 ;;
6074*) cont='';;
6075esac
6076if $test "$cont"; then
6077 if ./xenix; then
6078 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
6079 if tans=`cat /etc/systemid 2>&1` ; then
6080 myhostname=$tans
6081 phostname='cat /etc/systemid'
6082 echo "Whadyaknow. Xenix always was a bit strange..."
6083 cont=''
6084 fi
6085 elif $test -r /etc/systemid; then
6086 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6087 fi
6088fi
6089if $test "$cont"; then
6090 echo 'No, maybe "uuname -l" will work...'
6091 if tans=`sh -c 'uuname -l' 2>&1` ; then
6092 myhostname=$tans
6093 phostname='uuname -l'
6094 else
6095 echo 'Strange. Maybe "uname -n" will work...'
6096 if tans=`sh -c 'uname -n' 2>&1` ; then
6097 myhostname=$tans
6098 phostname='uname -n'
6099 else
6100 echo 'Oh well, maybe I can mine it out of whoami.h...'
6101 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6102 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6103 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6104 else
6105 case "$myhostname" in
6106 '') echo "Does this machine have an identity crisis or something?"
6107 phostname='';;
6108 *)
6109 echo "Well, you said $myhostname before..."
6110 phostname='echo $myhostname';;
6111 esac
6112 fi
6113 fi
6114 fi
6115fi
6116: you do not want to know about this
6117set $myhostname
6118myhostname=$1
6119
6120: verify guess
6121if $test "$myhostname" ; then
6122 dflt=y
6123 rp='Your host name appears to be "'$myhostname'".'" Right?"
6124 . ./myread
6125 case "$ans" in
6126 y*) ;;
6127 *) myhostname='';;
6128 esac
6129fi
6130
6131: bad guess or no guess
6132while $test "X$myhostname" = X ; do
6133 dflt=''
6134 rp="Please type the (one word) name of your host:"
6135 . ./myread
6136 myhostname="$ans"
6137done
6138
6139: translate upper to lower if necessary
6140case "$myhostname" in
6141*[A-Z]*)
6142 echo "(Normalizing case in your host name)"
6143 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6144 ;;
6145esac
6146
6147case "$myhostname" in
6148*.*)
6149 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6150 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6151 echo "(Trimming domain name from host name--host name is now $myhostname)"
6152 ;;
6153*) case "$mydomain" in
6154 '')
6155 {
2afac517 6156 test "X$hostcat" = "Xypcat hosts" &&
6157 ypmatch "$myhostname" hosts 2>/dev/null |\
6158 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
6159 $test -s hosts
6160 } || {
2afac517 6161 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
6162 /[ ]$myhostname[ . ]/p" > hosts
6163 }
6164 tmp_re="[ . ]"
6165 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
6166 END { print sum }" hosts` = x1 || tmp_re="[ ]"
6167 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6168 hosts | $sort | $uniq | \
6169 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6170 case `$echo X$dflt` in
6171 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
6172 dflt=.
6173 ;;
6174 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6175 ;;
6176 esac
6177 case "$dflt" in
6178 .)
6179 tans=`./loc resolv.conf X /etc /usr/etc`
6180 if $test -f "$tans"; then
6181 echo "(Attempting domain name extraction from $tans)"
a6006777 6182 dflt=.`$sed -n -e 's/ / /g' \
28757baa 6183 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 6184 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 6185 case "$dflt" in
a6006777 6186 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 6187 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 6188 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 6189 ;;
2afac517 6190 esac
6191 fi
6192 ;;
6193 esac
6194 case "$dflt" in
6195 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6196 dflt=.`sh -c domainname 2>/dev/null`
6197 case "$dflt" in
6198 '') dflt='.';;
6199 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6200 esac
6201 ;;
6202 esac
6203 case "$dflt" in
6204 .) echo "(Lost all hope -- silly guess then)"
6205 dflt='.uucp'
6206 ;;
6207 esac
6208 $rm -f hosts
6209 ;;
6210 *) dflt="$mydomain";;
6211 esac;;
6212esac
6213echo " "
6214rp="What is your domain name?"
6215. ./myread
6216tans="$ans"
6217case "$ans" in
6218'') ;;
6219.*) ;;
6220*) tans=".$tans";;
6221esac
6222mydomain="$tans"
6223
6224: translate upper to lower if necessary
6225case "$mydomain" in
6226*[A-Z]*)
6227 echo "(Normalizing case in your domain name)"
6228 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6229 ;;
6230esac
6231
6232: a little sanity check here
6233case "$phostname" in
6234'') ;;
6235*)
6236 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6237 $myhostname$mydomain|$myhostname) ;;
6238 *)
6239 case "$phostname" in
6240 sed*)
6241 echo "(That doesn't agree with your whoami.h file, by the way.)"
6242 ;;
6243 *)
6244 echo "(That doesn't agree with your $phostname command, by the way.)"
6245 ;;
6246 esac
6247 ;;
6248 esac
6249 ;;
6250esac
6251
6252$cat <<EOM
6253
6254I need to get your e-mail address in Internet format if possible, i.e.
6255something like user@host.domain. Please answer accurately since I have
6256no easy means to double check it. The default value provided below
6257is most probably close to the reality but may not be valid from outside
6258your organization...
6259
6260EOM
6261cont=x
6262while test "$cont"; do
6263 case "$cf_email" in
6264 '') dflt="$cf_by@$myhostname$mydomain";;
6265 *) dflt="$cf_email";;
6266 esac
6267 rp='What is your e-mail address?'
6268 . ./myread
6269 cf_email="$ans"
6270 case "$cf_email" in
6271 *@*.*) cont='' ;;
6272 *)
6273 rp='Address does not look like an Internet one. Use it anyway?'
6274 case "$fastread" in
6275 yes) dflt=y ;;
6276 *) dflt=n ;;
6277 esac
6278 . ./myread
6279 case "$ans" in
6280 y*) cont='' ;;
6281 *) echo " " ;;
6282 esac
6283 ;;
6284 esac
6285done
6286
6287$cat <<EOM
6288
6289If you or somebody else will be maintaining perl at your site, please
6290fill in the correct e-mail address here so that they may be contacted
6291if necessary. Currently, the "perlbug" program included with perl
6292will send mail to this address in addition to perlbug@perl.com. You may
6293enter "none" for no administrator.
6294
6295EOM
6296case "$perladmin" in
6297'') dflt="$cf_email";;
6298*) dflt="$perladmin";;
6299esac
6300rp='Perl administrator e-mail address'
6301. ./myread
6302perladmin="$ans"
6303
5f05dabc 6304: figure out how to guarantee perl startup
6305case "$startperl" in
6306'')
6307 case "$sharpbang" in
6308 *!)
6309 $cat <<EOH
6310
6311I can use the #! construct to start perl on your system. This will
6312make startup of perl scripts faster, but may cause problems if you
6313want to share those scripts and perl is not in a standard place
6314($binexp/perl) on all your platforms. The alternative is to force
6315a shell by starting the script with a single ':' character.
6316
6317EOH
6318 dflt="$binexp/perl"
6319 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6320 . ./myread
6321 case "$ans" in
68dc0745 6322 none) startperl=": # use perl";;
6323 *) startperl="#!$ans"
3e3baf6d 6324 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 6325 $cat >&4 <<EOM
6326
6327WARNING: Some systems limit the #! command to 32 characters.
6328If you experience difficulty running Perl scripts with #!, try
6329installing Perl in a directory with a shorter pathname.
6330
6331EOM
6332 fi ;;
5f05dabc 6333 esac
6334 ;;
6335 *) startperl=": # use perl"
6336 ;;
6337 esac
6338 ;;
6339esac
6340echo "I'll use $startperl to start perl scripts."
6341
6342: figure best path for perl in scripts
6343case "$perlpath" in
6344'')
6345 perlpath="$binexp/perl"
6346 case "$startperl" in
6347 *!*) ;;
6348 *)
6349 $cat <<EOH
6350
6351I will use the "eval 'exec'" idiom to start Perl on your system.
6352I can use the full path of your Perl binary for this purpose, but
6353doing so may cause problems if you want to share those scripts and
6354Perl is not always in a standard place ($binexp/perl).
6355
6356EOH
6357 dflt="$binexp/perl"
6358 rp="What path shall I use in \"eval 'exec'\"?"
6359 . ./myread
6360 perlpath="$ans"
6361 ;;
6362 esac
6363 ;;
6364esac
6365case "$startperl" in
6366*!*) ;;
6367*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6368esac
6369
dc45a647
MB
6370: determine where public executable scripts go
6371set scriptdir scriptdir
6372eval $prefixit
6373case "$scriptdir" in
6374'')
6375 dflt="$bin"
6376 : guess some guesses
6377 $test -d /usr/share/scripts && dflt=/usr/share/scripts
dd4e71fd
JH
6378 $test -d /usr/share/bin && dflt=/usr/share/bin
6379 $test -d /usr/local/script && dflt=/usr/local/script
6380 $test -d /usr/local/scripts && dflt=/usr/local/scripts
6381 $test -d $prefixexp/script && dflt=$prefixexp/script
dc45a647
MB
6382 set dflt
6383 eval $prefixup
6384 ;;
6385*) dflt="$scriptdir"
6386 ;;
6387esac
6388$cat <<EOM
6389
6390Some installations have a separate directory just for executable scripts so
6391that they can mount it across multiple architectures but keep the scripts in
6392one spot. You might, for example, have a subdirectory of /usr/share for this.
6393Or you might just lump your scripts in with all your other executables.
6394
6395EOM
6396fn=d~
6397rp='Where do you keep publicly executable scripts?'
6398. ./getfile
6399if $test "X$ansexp" != "X$scriptdirexp"; then
6400 installscript=''
6401fi
6402scriptdir="$ans"
6403scriptdirexp="$ansexp"
dd4e71fd
JH
6404: Change installation prefix, if necessary.
6405if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6406 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
dd4e71fd
JH
6407else
6408 installscript="$scriptdirexp"
6409fi
dc45a647 6410
dd4e71fd
JH
6411$cat <<EOM
6412
6413After $package is installed, you may wish to install various
6414add-on modules and utilities. Typically, these add-ons will
6415be installed under $prefix with the rest
6416of this package. However, you may wish to install such add-ons
6417elsewhere under a different prefix.
6418
6419If you do not wish to put everything under a single prefix, that's
6420ok. You will be prompted for the individual locations; this siteprefix
6421is only used to suggest the defaults.
6422
6423The default should be fine for most people.
dc45a647
MB
6424
6425EOM
dd4e71fd
JH
6426fn=d~+
6427rp='Installation prefix to use for add-on modules and utilities?'
6428: XXX Here might be another good place for an installstyle setting.
6429case "$siteprefix" in
6430'') dflt=$prefix ;;
6431*) dflt=$siteprefix ;;
6432esac
6433. ./getfile
6434oldsiteprefix=''
6435case "$siteprefix" in
6436'') ;;
6437*)
6438 case "$ans" in
6439 "$prefix") ;;
6440 *) oldsiteprefix="$prefix";;
dc45a647 6441 esac
dd4e71fd
JH
6442 ;;
6443esac
6444siteprefix="$ans"
6445siteprefixexp="$ansexp"
dc45a647
MB
6446
6447: determine where site specific libraries go.
dd4e71fd
JH
6448: Usual default is /usr/local/lib/perl5/site_perl
6449: The default "style" setting is made in installstyle.U
6450: XXX No longer works with Prefixit stuff.
bfb7748a 6451prog=`echo $package | $sed 's/-*[0-9.]*$//'`
dd4e71fd 6452case "$installstyle" in
a3635516 6453*lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
dd4e71fd 6454*) dflt=$siteprefix/lib/site_$prog ;;
dc45a647
MB
6455esac
6456$cat <<EOM
6457
dd4e71fd
JH
6458The installation process will create a directory for
6459site-specific extensions and modules. Most users find it convenient
68c15b6f
HM
6460to place all site-specific files in this directory rather than in the
6461main distribution directory.
dc45a647
MB
6462
6463EOM
6464fn=d~+
6465rp='Pathname for the site-specific library files?'
6466. ./getfile
dc45a647
MB
6467sitelib="$ans"
6468sitelibexp="$ansexp"
dd4e71fd
JH
6469: Change installation prefix, if necessary.
6470if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6471 installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6472else
6473 installsitelib="$sitelibexp"
dc45a647
MB
6474fi
6475
6476: determine where site specific architecture-dependent libraries go.
dd4e71fd 6477: sitelib default is /usr/local/lib/perl5/site_perl/
bfb7748a 6478: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
3a6175e1 6479: sitelib may have an optional trailing /share.
bfb7748a 6480tdflt=`echo $sitelib | $sed 's,/share$,,'`
dd4e71fd 6481tdflt="$tdflt/$apiversion/$archname"
dc45a647
MB
6482set sitearch sitearch none
6483eval $prefixit
6484case "$sitearch" in
bfb7748a 6485'') dflt="$tdflt" ;;
dc45a647
MB
6486*) dflt="$sitearch" ;;
6487esac
6488$cat <<EOM
6489
6490The installation process will also create a directory for
6491architecture-dependent site-specific extensions and modules.
6492
6493EOM
6494fn=nd~+
6495rp='Pathname for the site-specific architecture-dependent library files?'
6496. ./getfile
dc45a647
MB
6497sitearch="$ans"
6498sitearchexp="$ansexp"
dd4e71fd
JH
6499: Change installation prefix, if necessary.
6500if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6501 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6502else
6503 installsitearch="$sitearchexp"
dc45a647
MB
6504fi
6505
2afac517 6506cat <<EOM
6507
b0ce926a
JH
6508Perl can be built to take advantage of long doubles which
6509(if available) may give more accuracy and range for floating point
6510numbers. To do so, Configure must be run with -Duselongdouble.
6511
6512If this doesn't make any sense to you, just accept the default 'n'.
6513EOM
6514case "$uselongdouble" in
6515$define|true|[yY]*) dflt='y';;
6516*) dflt='n';;
6517esac
6518rp='Try to use long doubles if available?'
6519. ./myread
6520case "$ans" in
309d43cf
JH
6521y|Y) val="$define" ;;
6522*) val="$undef" ;;
b0ce926a
JH
6523esac
6524set uselongdouble
6525eval $setvar
6526
d9b3e12d
JH
6527case "$uselongdouble" in
6528"$define"|true|[yY]*)
6529: Look for a hint-file generated 'call-back-unit'. If the
6530: user has specified that long doubles should be used,
6531: we may need to set or change some other defaults.
6532 if $test -f uselongdouble.cbu; then
6533 echo "Your platform has some specific hints for long doubles, using them..."
6534 . ./uselongdouble.cbu
6535 else
6536 $cat <<EOM
6537(Your platform doesn't have any specific hints for long doubles.)
6538EOM
6539 fi
6540 ;;
6541esac
b0ce926a
JH
6542
6543cat <<EOM
6544
85aff577
CS
6545Previous version of $package used the standard IO mechanisms as defined
6546in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 6547mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
6548the default. This abstraction layer can use AT&T's sfio (if you already
6549have sfio installed) or regular stdio. Using PerlIO with sfio may cause
6550problems with some extension modules. Using PerlIO with stdio is safe,
6551but it is slower than plain stdio and therefore is not the default.
2afac517 6552
6553If this doesn't make any sense to you, just accept the default 'n'.
6554EOM
6555case "$useperlio" in
6556$define|true|[yY]*) dflt='y';;
6557*) dflt='n';;
6558esac
6559rp='Use the experimental PerlIO abstraction layer?'
6560. ./myread
6561case "$ans" in
6562y|Y)
6563 val="$define"
6564 ;;
6565*)
6566 echo "Ok, doing things the stdio way"
6567 val="$undef"
6568 ;;
6569esac
6570set useperlio
6571eval $setvar
2304df62 6572
8e07c86e 6573: Check how to convert floats to strings.
28e8609d 6574if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
6575 echo " "
6576 echo "Checking for an efficient way to convert floats to strings."
6577 $cat >try.c <<'EOP'
8e07c86e
AD
6578#ifdef TRY_gconvert
6579#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 6580char *myname = "gconvert";
8e07c86e
AD
6581#endif
6582#ifdef TRY_gcvt
6583#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 6584char *myname = "gcvt";
8e07c86e
AD
6585#endif
6586#ifdef TRY_sprintf
6587#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 6588char *myname = "sprintf";
8e07c86e 6589#endif
8ff267be 6590
6591#include <stdio.h>
6592
6593int
6594checkit(expect, got)
6595char *expect;
6596char *got;
6597{
6598 if (strcmp(expect, got)) {
6599 printf("%s oddity: Expected %s, got %s\n",
6600 myname, expect, got);
6601 exit(1);
6602 }
6603}
6604
5a411a32 6605int main()
8ff267be 6606{
ecfc5424 6607 char buf[64];
8ff267be 6608 buf[63] = '\0';
6609
6610 /* This must be 1st test on (which?) platform */
6611 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6612 Gconvert(0.1, 8, 0, buf);
6613 checkit("0.1", buf);
6614
8e07c86e 6615 Gconvert(1.0, 8, 0, buf);
8ff267be 6616 checkit("1", buf);
6617
8e07c86e 6618 Gconvert(0.0, 8, 0, buf);
8ff267be 6619 checkit("0", buf);
6620
8e07c86e 6621 Gconvert(-1.0, 8, 0, buf);
8ff267be 6622 checkit("-1", buf);
6623
6624 /* Some Linux gcvt's give 1.e+5 here. */
6625 Gconvert(100000.0, 8, 0, buf);
6626 checkit("100000", buf);
6627
6628 /* Some Linux gcvt's give -1.e+5 here. */
6629 Gconvert(-100000.0, 8, 0, buf);
6630 checkit("-100000", buf);
6631
ecfc5424 6632 exit(0);
a0d0e21e
LW
6633}
6634EOP
5ff3f7a4
GS
6635 case "$d_Gconvert" in
6636 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6637 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6638 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6639 *) xxx_list='gconvert gcvt sprintf' ;;
6640 esac
8e07c86e 6641
5ff3f7a4
GS
6642 for xxx_convert in $xxx_list; do
6643 echo "Trying $xxx_convert"
6644 $rm -f try try$_o
6645 set try -DTRY_$xxx_convert
6646 if eval $compile; then
6647 echo "$xxx_convert" found. >&4
6648 if ./try; then
6649 echo "I'll use $xxx_convert to convert floats into a string." >&4
6650 break;
6651 else
6652 echo "...But $xxx_convert didn't work as I expected."
6653 fi
2304df62 6654 else
5ff3f7a4 6655 echo "$xxx_convert NOT found." >&4
2304df62 6656 fi
5ff3f7a4 6657 done
8e07c86e 6658
5ff3f7a4
GS
6659 case "$xxx_convert" in
6660 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6661 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6662 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6663 esac
28e8609d 6664fi
2304df62 6665
cf2093f6
JH
6666: see if inttypes.h is available
6667: we want a real compile instead of Inhdr because some systems
6668: have an inttypes.h which includes non-existent headers
6669echo " "
6670$cat >try.c <<EOCP
6671#include <inttypes.h>
6672int main() {
6673 static int32_t foo32 = 0x12345678;
6674}
6675EOCP
6676set try
6677if eval $compile; then
6678 echo "<inttypes.h> found." >&4
6679 val="$define"
6680else
6681 echo "<inttypes.h> NOT found." >&4
6682 val="$undef"
6683fi
6684$rm -f try.c try
6685set i_inttypes
6686eval $setvar
6687
6688: check for int64_t
6689case "$use64bits" in
6690"$define" )
6691 echo " "
6692 echo $n "Checking to see if your system supports int64_t...$c" >&4
6693 $cat >try.c <<EOCP
6694#include <sys/types.h>
6695#$i_inttypes I_INTTYPES
6696#ifdef I_INTTYPES
6697#include <inttypes.h>
6698#endif
6699int64_t foo() { int64_t x; x = 7; return x; }
6700EOCP
6701 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6702 val="$define"
6703 echo " Yup, it does." >&4
6704 else
6705 val="$undef"
6706 echo " Nope, it doesn't." >&4
6707 fi
6708 $rm -f try.*
6709 ;;
6710*) val="$undef"
6711 ;;
6712esac
6713set d_int64t
6714eval $setvar
6715
6716
6717: check for lengths of integral types
6718echo " "
6719case "$intsize" in
6720'')
6721 echo "Checking to see how big your integers are..." >&4
6722 $cat >intsize.c <<'EOCP'
6723#include <stdio.h>
6724int main()
6725{
6726 printf("intsize=%d;\n", sizeof(int));
6727 printf("longsize=%d;\n", sizeof(long));
6728 printf("shortsize=%d;\n", sizeof(short));
6729 exit(0);
6730}
6731EOCP
6732 set intsize
6733 if eval $compile_ok && ./intsize > /dev/null; then
6734 eval `./intsize`
6735 echo "Your integers are $intsize bytes long."
6736 echo "Your long integers are $longsize bytes long."
6737 echo "Your short integers are $shortsize bytes long."
6738 else
6739 $cat >&4 <<EOM
6740!
6741Help! I can't compile and run the intsize test program: please enlighten me!
6742(This is probably a misconfiguration in your system or libraries, and
6743you really ought to fix it. Still, I'll try anyway.)
6744!
6745EOM
6746 dflt=4
6747 rp="What is the size of an integer (in bytes)?"
6748 . ./myread
6749 intsize="$ans"
6750 dflt=$intsize
6751 rp="What is the size of a long integer (in bytes)?"
6752 . ./myread
6753 longsize="$ans"
6754 dflt=2
6755 rp="What is the size of a short integer (in bytes)?"
6756 . ./myread
6757 shortsize="$ans"
6758 fi
6759 ;;
6760esac
6761$rm -f intsize intsize.*
6762
6763: check for long long
6764echo " "
6765echo $n "Checking to see if your system supports long long...$c" >&4
6766echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6767if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6768 val="$define"
6769 echo " Yup, it does." >&4
6770else
6771 val="$undef"
6772 echo " Nope, it doesn't." >&4
6773fi
6774$rm try.*
6775set d_longlong
6776eval $setvar
6777
6778: check for length of long long
6779case "${d_longlong}${longlongsize}" in
6780$define)
6781 echo " "
6782 $echo $n "Checking to see how big your long longs are...$c" >&4
6783 $cat >try.c <<'EOCP'
6784#include <stdio.h>
6785int main()
6786{
6787 printf("%d\n", sizeof(long long));
6788}
6789EOCP
6790 set try
6791 if eval $compile_ok; then
6792 longlongsize=`./try`
6793 $echo " $longlongsize bytes." >&4
6794 else
6795 dflt='8'
6796 echo " "
6797 echo "(I can't seem to compile the test program. Guessing...)"
6798 rp="What is the size of a long long (in bytes)?"
6799 . ./myread
6800 longlongsize="$ans"
6801 fi
6802 if $test "X$longsize" = "X$longlongsize"; then
6803 echo "(That isn't any different from an ordinary long.)"
6804 fi
6805 ;;
6806esac
6807$rm -f try.c try
6808
6809echo " "
6810
ea1c3b15 6811if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
cf2093f6
JH
6812
6813echo "Checking how to print 64-bit integers..." >&4
6814
6815if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6816 quad=int
6817 $cat >try.c <<'EOCP'
6818#include <sys/types.h>
6819#include <stdio.h>
6820int main() {
6821 int q = 12345678901;
6822 printf("%ld\n", q);
6823}
6824EOCP
6825 set try
6826 if eval $compile; then
6827 yyy=`./try$exe_ext`
6828 case "$yyy" in
6829 12345678901)
6830 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6831 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6832 echo "We will use %d."
6833 ;;
6834 esac
6835 fi
6836fi
6837
6838if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6839 quad=long
6840 $cat >try.c <<'EOCP'
6841#include <sys/types.h>
6842#include <stdio.h>
6843int main() {
6844 long q = 12345678901;
6845 printf("%ld\n", q);
6846}
6847EOCP
6848 set try
6849 if eval $compile; then
6850 yyy=`./try$exe_ext`
6851 case "$yyy" in
6852 12345678901)
6853 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6854 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6855 echo "We will use %ld."
6856 ;;
6857 esac
6858 fi
6859fi
6860
6861if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6862 quad=int64_t
6863 $cat >try.c <<'EOCP'
6864#include <sys/types.h>
6865#include <inttypes.h>
6866#include <stdio.h>
6867int main() {
6868 int64_t q = 12345678901;
6869 printf("%" PRId64 "\n", q);
6870}
6871EOCP
6872 set try
6873 if eval $compile; then
6874 yyy=`./try$exe_ext`
6875 case "$yyy" in
6876 12345678901)
6877 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6878 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6879 echo "We will use the C9X style."
6880 ;;
6881 esac
6882 fi
6883fi
6884
6885if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6886 quad="long long"
6887 $cat >try.c <<'EOCP'
6888#include <sys/types.h>
6889#include <stdio.h>
6890int main() {
6e58d65c 6891 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
cf2093f6
JH
6892 printf("%lld\n", q);
6893}
6894EOCP
6895 set try
6896 if eval $compile; then
6897 yyy=`./try$exe_ext`
6898 case "$yyy" in
6899 12345678901)
6900 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6901 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6902 echo "We will use the %lld style."
6903 ;;
6904 esac
6905 fi
6906fi
6907
6908if $test X"$sPRId64" = X -a X"$quad" != X; then
6909 $cat >try.c <<EOCP
6910#include <sys/types.h>
6911#include <stdio.h>
6912int main() {
6913 $quad q = 12345678901;
6914 printf("%Ld\n", q);
6915}
6916EOCP
6917 set try
6918 if eval $compile; then
6919 yyy=`./try$exe_ext`
6920 case "$yyy" in
6921 12345678901)
6922 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6923 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6924 echo "We will use %lld."
6925 ;;
6926 esac
6927 fi
6928fi
6929
6930if $test X"$sPRId64" = X -a X"$quad" != X; then
6931 $cat >try.c <<EOCP
6932#include <sys/types.h>
6933#include <stdio.h>
6934int main() {
6935 $quad q = 12345678901;
6936 printf("%qd\n", q);
6937}
6938EOCP
6939 set try
6940 if eval $compile; then
6941 yyy=`./try$exe_ext`
6942 case "$yyy" in
6943 12345678901)
6944 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6945 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6946 echo "We will use %qd."
6947 ;;
6948 esac
6949 fi
6950fi
6951
6952if $test X"$sPRId64" = X; then
6953 echo "Cannot figure out how to print 64-bit integers." >&4
6954fi
6955
ea1c3b15
JH
6956$rm -f try try.*
6957
6958fi # intsize -o longsize -o d_int64t -o d_longlong
cf2093f6
JH
6959
6960case "$sPRId64" in
6961'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
6962 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
6963 ;;
6964*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
6965 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
6966 ;;
6967esac
6968
cf2093f6
JH
6969: check for length of double
6970echo " "
6971case "$doublesize" in
6972'')
6973 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6974 $cat >try.c <<'EOCP'
6975#include <stdio.h>
6976int main()
6977{
6978 printf("%d\n", sizeof(double));
6979}
6980EOCP
6981 set try
6982 if eval $compile_ok; then
6983 doublesize=`./try`
6984 $echo " $doublesize bytes." >&4
6985 else
6986 dflt='8'
6987 echo "(I can't seem to compile the test program. Guessing...)"
6988 rp="What is the size of a double precision number (in bytes)?"
6989 . ./myread
6990 doublesize="$ans"
6991 fi
6992 ;;
6993esac
6994$rm -f try.c try
6995
6996: check for long doubles
6997echo " "
2d4389e4 6998echo $n "Checking to see if your system supports long double...$c" >&4
cf2093f6
JH
6999echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7000if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7001 val="$define"
7002 echo " Yup, it does." >&4
7003else
7004 val="$undef"
7005 echo " Nope, it doesn't." >&4
7006fi
7007$rm try.*
7008set d_longdbl
7009eval $setvar
7010
7011: check for length of long double
7012case "${d_longdbl}${longdblsize}" in
7013$define)
7014 echo " "
7015 $echo $n "Checking to see how big your long doubles are...$c" >&4
7016 $cat >try.c <<'EOCP'
7017#include <stdio.h>
7018int main()
7019{
7020 printf("%d\n", sizeof(long double));
7021}
7022EOCP
7023 set try
7024 if eval $compile; then
7025 longdblsize=`./try`
7026 $echo " $longdblsize bytes." >&4
7027 else
7028 dflt='8'
7029 echo " "
7030 echo "(I can't seem to compile the test program. Guessing...)" >&4
7031 rp="What is the size of a long double (in bytes)?"
7032 . ./myread
7033 longdblsize="$ans"
7034 fi
7035 if $test "X$doublesize" = "X$longdblsize"; then
7036 echo "(That isn't any different from an ordinary double.)"
7037 fi
7038 ;;
7039esac
7040$rm -f try.c try
7041
7042echo " "
7043
ea1c3b15 7044if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
7045
7046echo "Checking how to print long doubles..." >&4
7047
7048if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7049 $cat >try.c <<'EOCP'
7050#include <sys/types.h>
7051#include <stdio.h>
7052int main() {
7053 double d = 123.456;
7054 printf("%.3f\n", d);
7055}
7056EOCP
7057 set try
7058 if eval $compile; then
7059 yyy=`./try$exe_ext`
7060 case "$yyy" in
7061 123.456)
7062 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7063 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7064 echo "We will use %f."
7065 ;;
7066 esac
7067 fi
7068fi
7069
7070if $test X"$sPRIfldbl" = X; then
7071 $cat >try.c <<'EOCP'
7072#include <sys/types.h>
7073#include <stdio.h>
7074int main() {
7075 long double d = 123.456;
ea1c3b15 7076 printf("%.3llf\n", d);
cf2093f6
JH
7077}
7078EOCP
7079 set try
7080 if eval $compile; then
7081 yyy=`./try$exe_ext`
7082 case "$yyy" in
7083 123.456)
ea1c3b15
JH
7084 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7085 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7086 echo "We will use %llf."
cf2093f6
JH
7087 ;;
7088 esac
7089 fi
7090fi
7091
7092if $test X"$sPRIfldbl" = X; then
7093 $cat >try.c <<'EOCP'
7094#include <sys/types.h>
7095#include <stdio.h>
7096int main() {
7097 long double d = 123.456;
ea1c3b15 7098 printf("%.3Lf\n", d);
cf2093f6
JH
7099}
7100EOCP
7101 set try
7102 if eval $compile; then
7103 yyy=`./try$exe_ext`
7104 case "$yyy" in
7105 123.456)
ea1c3b15
JH
7106 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7107 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7108 echo "We will use %Lf."
cf2093f6
JH
7109 ;;
7110 esac
7111 fi
7112fi
7113
11dc3f68 7114if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7115 $cat >try.c <<'EOCP'
7116#include <sys/types.h>
7117#include <stdio.h>
7118int main() {
7119 long double d = 123.456;
ea1c3b15 7120 printf("%.3lf\n", d);
cf2093f6
JH
7121}
7122EOCP
7123 set try
7124 if eval $compile; then
7125 yyy=`./try$exe_ext`
7126 case "$yyy" in
7127 123.456)
ea1c3b15
JH
7128 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7129 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7130 echo "We will use %lf."
cf2093f6
JH
7131 ;;
7132 esac
7133 fi
7134fi
7135
09e3ef00
JH
7136if $test X"$sPRIfldbl" = X; then
7137 echo "Cannot figure out how to print long doubles." >&4
7138fi
7139
ea1c3b15 7140$rm -f try try.*
cf2093f6 7141
ea1c3b15 7142fi # d_longdbl
cf2093f6
JH
7143
7144case "$sPRIfldbl" in
7145'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7146 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7147 ;;
7148*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7149 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7150 ;;
7151esac
7152
a0d0e21e
LW
7153: Initialize h_fcntl
7154h_fcntl=false
7155
7156: Initialize h_sysfile
7157h_sysfile=false
2304df62 7158
2304df62
AD
7159: access call always available on UNIX
7160set access d_access
7161eval $inlibc
7162
7163: locate the flags for 'access()'
7164case "$d_access" in
7165"$define")
7166 echo " "
7167 $cat >access.c <<'EOCP'
7168#include <sys/types.h>
7169#ifdef I_FCNTL
7170#include <fcntl.h>
7171#endif
7172#ifdef I_SYS_FILE
7173#include <sys/file.h>
7174#endif
7175#ifdef I_UNISTD
7176#include <unistd.h>
7177#endif
d674cd6d 7178int main() {
2304df62
AD
7179 exit(R_OK);
7180}
8e07c86e
AD
7181EOCP
7182 : check sys/file.h first, no particular reason here
7183 if $test `./findhdr sys/file.h` && \
dfe9444c 7184 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7185 h_sysfile=true;
7186 echo "<sys/file.h> defines the *_OK access constants." >&4
7187 elif $test `./findhdr fcntl.h` && \
dfe9444c 7188 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7189 h_fcntl=true;
7190 echo "<fcntl.h> defines the *_OK access constants." >&4
7191 elif $test `./findhdr unistd.h` && \
dfe9444c 7192 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7193 echo "<unistd.h> defines the *_OK access constants." >&4
7194 else
7195 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7196 fi
7197 ;;
7198esac
7199$rm -f access*
a0d0e21e 7200
5ff3f7a4
GS
7201: see if accessx exists
7202set accessx d_accessx
7203eval $inlibc
7204
8e07c86e
AD
7205: see if alarm exists
7206set alarm d_alarm
7207eval $inlibc
2304df62 7208
cf2093f6
JH
7209: see if atolf exists
7210set atolf d_atolf
7211eval $inlibc
7212
7213: see if atoll exists
7214set atoll d_atoll
7215eval $inlibc
7216
ecfc5424 7217: Look for GNU-cc style attribute checking
2304df62 7218echo " "
a0d0e21e
LW
7219echo "Checking whether your compiler can handle __attribute__ ..." >&4
7220$cat >attrib.c <<'EOCP'
1aef975c 7221#include <stdio.h>
ecfc5424 7222void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7223EOCP
7224if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7225 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7226 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7227 val="$undef"
7228 else
ecfc5424 7229 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7230 val="$define"
7231 fi
7232else
ecfc5424 7233 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7234 val="$undef"
7235fi
ecfc5424 7236set d_attribut
a0d0e21e
LW
7237eval $setvar
7238$rm -f attrib*
7239
7240: see if bcmp exists
7241set bcmp d_bcmp
7242eval $inlibc
7243
7244: see if bcopy exists
7245set bcopy d_bcopy
7246eval $inlibc
7247
2afac517 7248: see if this is a unistd.h system
7249set unistd.h i_unistd
7250eval $inhdr
7251
7252: see if getpgrp exists
7253set getpgrp d_getpgrp
7254eval $inlibc
7255
2afac517 7256case "$d_getpgrp" in
7257"$define")
7258 echo " "
dfe9444c 7259 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7260 $cat >set.c <<EOP
7261#$i_unistd I_UNISTD
7262#include <sys/types.h>
7263#ifdef I_UNISTD
7264# include <unistd.h>
7265#endif
5a411a32 7266int main()
2afac517 7267{
7268 if (getuid() == 0) {
7269 printf("(I see you are running Configure as super-user...)\n");
7270 setuid(1);
7271 }
7272#ifdef TRY_BSD_PGRP
7273 if (getpgrp(1) == 0)
7274 exit(0);
7275#else
7276 if (getpgrp() > 0)
7277 exit(0);
7278#endif
7279 exit(1);
7280}
7281EOP
7282 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7283 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7284 val="$define"
7285 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7286 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7287 val="$undef"
7288 else
7289 echo "I can't seem to compile and run the test program."
7290 if ./usg; then
7291 xxx="a USG one, i.e. you use getpgrp()."
7292 else
7293 # SVR4 systems can appear rather BSD-ish.
7294 case "$i_unistd" in
7295 $undef)
7296 xxx="a BSD one, i.e. you use getpgrp(pid)."
7297 val="$define"
7298 ;;
7299 $define)
7300 xxx="probably a USG one, i.e. you use getpgrp()."
7301 val="$undef"
7302 ;;
7303 esac
7304 fi
7305 echo "Assuming your getpgrp is $xxx" >&4
7306 fi
7307 ;;
7308*) val="$undef";;
7309esac
7310set d_bsdgetpgrp
7311eval $setvar
7312$rm -f set set.c
7313
a0d0e21e
LW
7314: see if setpgrp exists
7315set setpgrp d_setpgrp
7316eval $inlibc
7317
a0d0e21e
LW
7318case "$d_setpgrp" in
7319"$define")
7320 echo " "
dfe9444c 7321 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7322 $cat >set.c <<EOP
2afac517 7323#$i_unistd I_UNISTD
7324#include <sys/types.h>
7325#ifdef I_UNISTD
7326# include <unistd.h>
7327#endif
5a411a32 7328int main()
a0d0e21e
LW
7329{
7330 if (getuid() == 0) {
7331 printf("(I see you are running Configure as super-user...)\n");
7332 setuid(1);
7333 }
2afac517 7334#ifdef TRY_BSD_PGRP
a0d0e21e 7335 if (-1 == setpgrp(1, 1))
2afac517 7336 exit(0);
7337#else
7338 if (setpgrp() != -1)
7339 exit(0);
7340#endif
7341 exit(1);
a0d0e21e
LW
7342}
7343EOP
2afac517 7344 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7345 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7346 val="$define"
7347 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7348 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7349 val="$undef"
a0d0e21e 7350 else
dfe9444c 7351 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7352 if ./usg; then
2afac517 7353 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7354 else
2afac517 7355 # SVR4 systems can appear rather BSD-ish.
7356 case "$i_unistd" in
7357 $undef)
7358 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7359 val="$define"
7360 ;;
7361 $define)
7362 xxx="probably a USG one, i.e. you use setpgrp()."
7363 val="$undef"
7364 ;;
7365 esac
a0d0e21e 7366 fi
2afac517 7367 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7368 fi
7369 ;;
7370*) val="$undef";;
7371esac
2afac517 7372set d_bsdsetpgrp
a0d0e21e
LW
7373eval $setvar
7374$rm -f set set.c
a0d0e21e
LW
7375: see if bzero exists
7376set bzero d_bzero
7377eval $inlibc
7378
ecfc5424 7379: see if signal is declared as pointer to function returning int or void
a0d0e21e 7380echo " "
ecfc5424
AD
7381xxx=`./findhdr signal.h`
7382$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7383if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7384 echo "You have int (*signal())() instead of void." >&4
7385 val="$undef"
7386elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7387 echo "You have void (*signal())()." >&4
ecfc5424
AD
7388 val="$define"
7389elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7390 echo "You have int (*signal())() instead of void." >&4
7391 val="$undef"
dfe9444c
AD
7392elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7393 echo "You have void (*signal())()." >&4
7394 val="$define"
a0d0e21e 7395else
ecfc5424
AD
7396 case "$d_voidsig" in
7397 '')
7398 echo "I can't determine whether signal handler returns void or int..." >&4
7399 dflt=void
7400 rp="What type does your signal handler return?"
7401 . ./myread
7402 case "$ans" in
7403 v*) val="$define";;
7404 *) val="$undef";;
7405 esac;;
7406 "$define")
dfe9444c
AD
7407 echo "As you already told me, signal handler returns void." >&4
7408 val="$define"
7409 ;;
7410 *) echo "As you already told me, signal handler returns int." >&4
7411 val="$undef"
7412 ;;
ecfc5424
AD
7413 esac
7414fi
7415set d_voidsig
7416eval $setvar
7417case "$d_voidsig" in
7418"$define") signal_t="void";;
7419*) signal_t="int";;
7420esac
7421$rm -f $$.tmp
7422
7423: check for ability to cast large floats to 32-bit ints.
7424echo " "
7425echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7426if $test "$intsize" -ge 4; then
ecfc5424
AD
7427 xxx=int
7428else
7429 xxx=long
7430fi
7431$cat >try.c <<EOCP
e5c9fcd0 7432#include <stdio.h>
ecfc5424
AD
7433#include <sys/types.h>
7434#include <signal.h>
a1896f58 7435$signal_t blech(s) int s; { exit(3); }
d674cd6d 7436int main()
2304df62 7437{
a0d0e21e 7438 $xxx i32;
e5c9fcd0 7439 double f, g;
2304df62 7440 int result = 0;
89434db5 7441 char str[16];
2304df62
AD
7442 signal(SIGFPE, blech);
7443
89434db5
AD
7444 /* Don't let compiler optimize the test away. Store the number
7445 in a writable string for gcc to pass to sscanf under HP/UX.
7446 */
7447 sprintf(str, "2147483647");
7448 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7449 g = 10 * f;
7450 i32 = ($xxx) g;
2304df62 7451
e5c9fcd0
AD
7452 /* x86 processors will probably give 0x8000 0000, which is a
7453 sign change. We don't want that. We want to mimic SPARC
7454 behavior here, which is to preserve the sign and give
7455 back 0x7fff ffff.
7456 */
a0d0e21e 7457 if (i32 != ($xxx) f)
2304df62
AD
7458 result |= 1;
7459 exit(result);
7460}
7461EOCP
dfe9444c 7462set try
dc45a647 7463if eval $compile_ok; then
2304df62
AD
7464 ./try
7465 yyy=$?
7466else
a0d0e21e 7467 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
7468 yyy=1
7469fi
7470case "$yyy" in
74710) val="$define"
7472 echo "Yup, it can."
7473 ;;
7474*) val="$undef"
7475 echo "Nope, it can't."
7476 ;;
7477esac
7478set d_casti32
7479eval $setvar
85e6fe83 7480$rm -f try try.*
a0d0e21e 7481
2304df62
AD
7482: check for ability to cast negative floats to unsigned
7483echo " "
7484echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 7485$cat >try.c <<EOCP
e5c9fcd0 7486#include <stdio.h>
ecfc5424 7487#include <sys/types.h>
2304df62 7488#include <signal.h>
a1896f58
AD
7489$signal_t blech(s) int s; { exit(7); }
7490$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
7491unsigned long dummy_long(p) unsigned long p; { return p; }
7492unsigned int dummy_int(p) unsigned int p; { return p; }
7493unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 7494int main()
2304df62 7495{
e5c9fcd0 7496 double f;
2304df62
AD
7497 unsigned long along;
7498 unsigned int aint;
7499 unsigned short ashort;
7500 int result = 0;
89434db5
AD
7501 char str[16];
7502
e5c9fcd0
AD
7503 /* Frustrate gcc-2.7.2's optimizer which failed this test with
7504 a direct f = -123. assignment. gcc-2.8.0 reportedly
7505 optimized the whole file away
7506 */
89434db5
AD
7507 /* Store the number in a writable string for gcc to pass to
7508 sscanf under HP/UX.
7509 */
7510 sprintf(str, "-123");
7511 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
7512
7513 signal(SIGFPE, blech);
7514 along = (unsigned long)f;
7515 aint = (unsigned int)f;
7516 ashort = (unsigned short)f;
7517 if (along != (unsigned long)-123)
7518 result |= 1;
7519 if (aint != (unsigned int)-123)
7520 result |= 1;
7521 if (ashort != (unsigned short)-123)
7522 result |= 1;
89434db5
AD
7523 sprintf(str, "1073741824.");
7524 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
7525 f = f + f;
7526 along = 0;
7527 along = (unsigned long)f;
7528 if (along != 0x80000000)
7529 result |= 2;
7530 f -= 1.;
7531 along = 0;
7532 along = (unsigned long)f;
7533 if (along != 0x7fffffff)
7534 result |= 1;
7535 f += 2.;
7536 along = 0;
7537 along = (unsigned long)f;
7538 if (along != 0x80000001)
7539 result |= 2;
232e078e
AD
7540 if (result)
7541 exit(result);
7542 signal(SIGFPE, blech_in_list);
89434db5
AD
7543 sprintf(str, "123.");
7544 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
7545 along = dummy_long((unsigned long)f);
7546 aint = dummy_int((unsigned int)f);
7547 ashort = dummy_short((unsigned short)f);
7548 if (along != (unsigned long)123)
7549 result |= 4;
7550 if (aint != (unsigned int)123)
7551 result |= 4;
7552 if (ashort != (unsigned short)123)
7553 result |= 4;
2304df62
AD
7554 exit(result);
7555
7556}
7557EOCP
dfe9444c 7558set try
dc45a647 7559if eval $compile_ok; then
2304df62
AD
7560 ./try
7561 castflags=$?
7562else
ecfc5424 7563 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 7564 castflags=7
2304df62
AD
7565fi
7566case "$castflags" in
75670) val="$define"
7568 echo "Yup, it can."
7569 ;;
7570*) val="$undef"
7571 echo "Nope, it can't."
7572 ;;
7573esac
7574set d_castneg
7575eval $setvar
7576$rm -f try.*
7577
2304df62
AD
7578: see if vprintf exists
7579echo " "
7580if set vprintf val -f d_vprintf; eval $csym; $val; then
7581 echo 'vprintf() found.' >&4
7582 val="$define"
7583 $cat >vprintf.c <<'EOF'
7584#include <varargs.h>
7585
d674cd6d 7586int main() { xxx("foo"); }
2304df62
AD
7587
7588xxx(va_alist)
7589va_dcl
7590{
7591 va_list args;
7592 char buf[10];
7593
7594 va_start(args);
7595 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7596}
7597EOF
dfe9444c
AD
7598 set vprintf
7599 if eval $compile && ./vprintf; then
2304df62
AD
7600 echo "Your vsprintf() returns (int)." >&4
7601 val2="$undef"
7602 else
7603 echo "Your vsprintf() returns (char*)." >&4
7604 val2="$define"
7605 fi
7606else
7607 echo 'vprintf() NOT found.' >&4
7608 val="$undef"
7609 val2="$undef"
7610fi
7611set d_vprintf
7612eval $setvar
7613val=$val2
7614set d_charvspr
7615eval $setvar
7616
a0d0e21e
LW
7617: see if chown exists
7618set chown d_chown
7619eval $inlibc
7620
7621: see if chroot exists
7622set chroot d_chroot
7623eval $inlibc
7624
2304df62
AD
7625: see if chsize exists
7626set chsize d_chsize
7627eval $inlibc
7628
de4597cb
JH
7629hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7630while $test $# -ge 2; do
7631 case "$1" in
7632 $define) echo "#include <$2>";;
7633 esac ;
7634 shift 2;
7635done > try.c;
7636echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
2000072c 7637if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
de4597cb
JH
7638 val="$define";
7639else
7640 val="$undef";
7641fi;
7642set $varname;
7643eval $setvar;
7644$rm -f try.c try.o'
7645
7646: see if this is a sys/uio.h system
7647set sys/uio.h i_sysuio
7648eval $inhdr
7649
7650echo "Checking to see if your system supports struct iovec..." >&4
7651set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7652eval $hasfield
7653case "$d_iovec_s" in
7654"$define") echo "Yup, it does." >&4
7655 ;;
7656*) echo "Nope, it doesn't." >&4
7657 ;;
7658esac
7659
7660socketlib=''
7661sockethdr=''
7662: see whether socket exists
7663echo " "
7664$echo $n "Hmm... $c" >&4
7665if set socket val -f d_socket; eval $csym; $val; then
7666 echo "Looks like you have Berkeley networking support." >&4
7667 d_socket="$define"
7668 if set setsockopt val -f; eval $csym; $val; then
7669 d_oldsock="$undef"
7670 else
7671 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7672 d_oldsock="$define"
7673 fi
7674else
7675 if $contains socklib libc.list >/dev/null 2>&1; then
7676 echo "Looks like you have Berkeley networking support." >&4
7677 d_socket="$define"
7678 : we will have to assume that it supports the 4.2 BSD interface
7679 d_oldsock="$undef"
7680 else
7681 echo "You don't have Berkeley networking in libc$_a..." >&4
7682 if test "X$d_socket" = "X$define"; then
7683 echo "...but you seem to believe that you have sockets." >&4
7684 else
7685 for net in net socket
7686 do
7687 if test -f /usr/lib/lib$net$_a; then
7688 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
7689 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7690 if $contains socket libc.list >/dev/null 2>&1; then
7691 d_socket="$define"
7692 socketlib="-l$net"
7693 case "$net" in
7694 net)
7695 echo "...but the Wollongong group seems to have hacked it in." >&4
7696 sockethdr="-I/usr/netinclude"
7697 ;;
7698 esac
7699 echo "Found Berkeley sockets interface in lib$net." >& 4
7700 if $contains setsockopt libc.list >/dev/null 2>&1; then
7701 d_oldsock="$undef"
7702 else
7703 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7704 d_oldsock="$define"
7705 fi
7706 break
7707 fi
7708 fi
7709 done
7710 if test "X$d_socket" != "X$define"; then
7711 echo "or anywhere else I see." >&4
7712 d_socket="$undef"
7713 d_oldsock="$undef"
7714 fi
7715 fi
7716 fi
7717fi
7718
7719: see if socketpair exists
7720set socketpair d_sockpair
7721eval $inlibc
7722
7723
5b34fd99 7724echo " "
de4597cb
JH
7725echo "Checking the availability of certain socket constants..." >& 4
7726for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7727 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7728 $cat >try.c <<EOF
ac60b016 7729#include <sys/types.h>
de4597cb
JH
7730#include <sys/socket.h>
7731int main() {
7732 int i = $ENUM;
7733}
7734EOF
7735 val="$undef"
7736 set try; if eval $compile; then
7737 val="$define"
7738 fi
7739 set d_${enum}; eval $setvar
7740 $rm -f try.c try
7741done
7742
7743set sendmsg d_sendmsg
7744eval $inlibc
7745
7746set recvmsg d_recvmsg
7747eval $inlibc
7748
7749echo " "
7750$echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7751set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7752eval $hasfield
7753case "$d_msghdr_s" in
7754"$define") echo "Yup, it does." >&4
7755 ;;
7756*) echo "Nope, it doesn't." >&4
7757 ;;
7758esac
7759
7760$echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7761set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7762eval $hasfield
7763case "$d_cmsghdr_s" in
7764"$define") echo "Yup, it does." >&4
7765 ;;
7766*) echo "Nope, it doesn't." >&4
7767 ;;
7768esac
7769
2304df62
AD
7770: check for const keyword
7771echo " "
7772echo 'Checking to see if your C compiler knows about "const"...' >&4
7773$cat >const.c <<'EOCP'
7774typedef struct spug { int drokk; } spug;
5a411a32 7775int main()
2304df62
AD
7776{
7777 const char *foo;
7778 const spug y;
7779}
7780EOCP
7781if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7782 val="$define"
7783 echo "Yup, it does."
7784else
7785 val="$undef"
7786 echo "Nope, it doesn't."
7787fi
7788set d_const
7789eval $setvar
7790
7791: see if crypt exists
7792echo " "
7793if set crypt val -f d_crypt; eval $csym; $val; then
7794 echo 'crypt() found.' >&4
7795 val="$define"
7796 cryptlib=''
7797else
dfe9444c 7798 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 7799 if $test -z "$cryptlib"; then
dfe9444c 7800 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
7801 else
7802 cryptlib=-lcrypt
7803 fi
7804 if $test -z "$cryptlib"; then
dfe9444c 7805 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
7806 else
7807 cryptlib=-lcrypt
7808 fi
7809 if $test -z "$cryptlib"; then
dfe9444c 7810 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
7811 else
7812 cryptlib=-lcrypt
7813 fi
7814 if $test -z "$cryptlib"; then
7815 echo 'crypt() NOT found.' >&4
7816 val="$undef"
7817 else
7818 val="$define"
7819 fi
7820fi
7821set d_crypt
7822eval $setvar
7823
921b2963
JH
7824: get csh whereabouts
7825case "$csh" in
7826'csh') val="$undef" ;;
7827*) val="$define" ;;
7828esac
7829set d_csh
7830eval $setvar
7831: Respect a hint or command line value for full_csh.
7832case "$full_csh" in
7833'') full_csh=$csh ;;
7834esac
7835
a0d0e21e
LW
7836: see if cuserid exists
7837set cuserid d_cuserid
2304df62
AD
7838eval $inlibc
7839
a0d0e21e
LW
7840: see if this is a limits.h system
7841set limits.h i_limits
85e6fe83
LW
7842eval $inhdr
7843
a0d0e21e
LW
7844: see if this is a float.h system
7845set float.h i_float
7846eval $inhdr
7847
7848: See if number of significant digits in a double precision number is known
7849echo " "
7850$cat >dbl_dig.c <<EOM
7851#$i_limits I_LIMITS
7852#$i_float I_FLOAT
7853#ifdef I_LIMITS
7854#include <limits.h>
85e6fe83 7855#endif
a0d0e21e
LW
7856#ifdef I_FLOAT
7857#include <float.h>
7858#endif
7859#ifdef DBL_DIG
7860printf("Contains DBL_DIG");
85e6fe83 7861#endif
85e6fe83 7862EOM
a0d0e21e
LW
7863$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7864if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7865 echo "DBL_DIG found." >&4
7866 val="$define"
2304df62 7867else
a0d0e21e
LW
7868 echo "DBL_DIG NOT found." >&4
7869 val="$undef"
2304df62 7870fi
a0d0e21e
LW
7871$rm -f dbl_dig.?
7872set d_dbl_dig
2304df62 7873eval $setvar
2304df62 7874
a0d0e21e
LW
7875: see if difftime exists
7876set difftime d_difftime
2304df62
AD
7877eval $inlibc
7878
a0d0e21e
LW
7879: see if this is a dirent system
7880echo " "
7881if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7882 val="$define"
7883 echo "<dirent.h> found." >&4
7884else
7885 val="$undef"
7886 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7887 echo "<sys/dir.h> found." >&4
7888 echo " "
7889 else
7890 xinc=`./findhdr sys/ndir.h`
7891 fi
7892 echo "<dirent.h> NOT found." >&4
7893fi
7894set i_dirent
7895eval $setvar
7896
7897: Look for type of directory structure.
7898echo " "
7899$cppstdin $cppflags $cppminus < "$xinc" > try.c
7900
7901case "$direntrytype" in
7902''|' ')
7903 case "$i_dirent" in
7904 $define) guess1='struct dirent' ;;
7905 *) guess1='struct direct' ;;
2afac517 7906 esac
7907 ;;
7908*) guess1="$direntrytype"
7909 ;;
8e07c86e
AD
7910esac
7911
2afac517 7912case "$guess1" in
7913'struct dirent') guess2='struct direct' ;;
7914*) guess2='struct dirent' ;;
7915esac
7916
7917if $contains "$guess1" try.c >/dev/null 2>&1; then
7918 direntrytype="$guess1"
7919 echo "Your directory entries are $direntrytype." >&4
7920elif $contains "$guess2" try.c >/dev/null 2>&1; then
7921 direntrytype="$guess2"
7922 echo "Your directory entries seem to be $direntrytype." >&4
7923else
7924 echo "I don't recognize your system's directory entries." >&4
7925 rp="What type is used for directory entries on this system?"
7926 dflt="$guess1"
7927 . ./myread
7928 direntrytype="$ans"
7929fi
7930$rm -f try.c
a0d0e21e 7931
a0d0e21e 7932
2afac517 7933: see if the directory entry stores field length
7934echo " "
7935$cppstdin $cppflags $cppminus < "$xinc" > try.c
7936if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7937 echo "Good, your directory entry keeps length information in d_namlen." >&4
7938 val="$define"
7939else
7940 echo "Your directory entry does not know about the d_namlen field." >&4
7941 val="$undef"
7942fi
7943set d_dirnamlen
7944eval $setvar
7945$rm -f try.c
a0d0e21e 7946
5ff3f7a4
GS
7947: see if dlerror exists
7948xxx_runnm="$runnm"
7949runnm=false
7950set dlerror d_dlerror
7951eval $inlibc
7952runnm="$xxx_runnm"
7953
7954: see if dlfcn is available
7955set dlfcn.h i_dlfcn
7956eval $inhdr
7957
7958case "$usedl" in
7959$define|y|true)
7960 $cat << EOM
7961
7962On a few systems, the dynamically loaded modules that perl generates and uses
7963will need a different extension than shared libs. The default will probably
7964be appropriate.
7965
7966EOM
7967 case "$dlext" in
7968 '') dflt="$so" ;;
7969 *) dflt="$dlext" ;;
7970 esac
7971 rp='What is the extension of dynamically loaded modules'
7972 . ./myread
7973 dlext="$ans"
7974 ;;
7975*)
7976 dlext="none"
7977 ;;
7978esac
7979
7980: Check if dlsym need a leading underscore
a0d0e21e
LW
7981echo " "
7982val="$undef"
7983
7984case "$dlsrc" in
7985dl_dlopen.xs)
7986 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7987 $cat >dyna.c <<'EOM'
7988fred () { }
7989EOM
7990
7991$cat >fred.c<<EOM
7992
7993#include <stdio.h>
7994#$i_dlfcn I_DLFCN
7995#ifdef I_DLFCN
7996#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
7997#else
7998#include <sys/types.h>
7999#include <nlist.h>
8000#include <link.h>
8001#endif
8002
8003extern int fred() ;
8004
5a411a32 8005int main()
a0d0e21e
LW
8006{
8007 void * handle ;
8008 void * symbol ;
8009#ifndef RTLD_LAZY
8010 int mode = 1 ;
8011#else
8012 int mode = RTLD_LAZY ;
8013#endif
8014 handle = dlopen("./dyna.$dlext", mode) ;
8015 if (handle == NULL) {
5f05dabc 8016 printf ("1\n") ;
8017 fflush (stdout) ;
8018 exit(0);
a0d0e21e
LW
8019 }
8020 symbol = dlsym(handle, "fred") ;
8021 if (symbol == NULL) {
5f05dabc 8022 /* try putting a leading underscore */
8023 symbol = dlsym(handle, "_fred") ;
8024 if (symbol == NULL) {
8025 printf ("2\n") ;
8026 fflush (stdout) ;
8027 exit(0);
8028 }
8029 printf ("3\n") ;
a0d0e21e
LW
8030 }
8031 else
5f05dabc 8032 printf ("4\n") ;
36477c24 8033 fflush (stdout) ;
8034 exit(0);
a0d0e21e
LW
8035}
8036EOM
760ac839 8037 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 8038 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
8039 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
8040 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 8041 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
8042 xxx=`./fred`
8043 case $xxx in
8044 1) echo "Test program failed using dlopen." >&4
8045 echo "Perhaps you should not use dynamic loading." >&4;;
8046 2) echo "Test program failed using dlsym." >&4
8047 echo "Perhaps you should not use dynamic loading." >&4;;
8048 3) echo "dlsym needs a leading underscore" >&4
8049 val="$define" ;;
8050 4) echo "dlsym doesn't need a leading underscore." >&4;;
8051 esac
8052 else
8053 echo "I can't compile and run the test program." >&4
88d5303d 8054 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
a0d0e21e
LW
8055 fi
8056 ;;
8057esac
8058
a78b0d02 8059$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
8060
8061set d_dlsymun
8062eval $setvar
8063
85ab1d1d
JH
8064hasproto='varname=$1; func=$2; shift; shift;
8065while $test $# -ge 2; do
8066 case "$1" in
8067 $define) echo "#include <$2>";;
8068 esac ;
8069 shift 2;
8070done > try.c;
8071$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8072if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8073 echo "$func() prototype found.";
8074 val="$define";
8075else
8076 echo "$func() prototype NOT found.";
8077 val="$undef";
8078fi;
8079set $varname;
8080eval $setvar;
8081$rm -f try.c tryout.c'
8082
8083: see if prototype for drand48 is available
8084echo " "
8085set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8086eval $hasproto
8087
a0d0e21e
LW
8088: see if dup2 exists
8089set dup2 d_dup2
8090eval $inlibc
8091
5ff3f7a4
GS
8092: see if eaccess exists
8093set eaccess d_eaccess
8094eval $inlibc
8095
8096: see if endgrent exists
8097set endgrent d_endgrent
8098eval $inlibc
8099
e5c9fcd0
AD
8100: see if endhostent exists
8101set endhostent d_endhent
8102eval $inlibc
8103
8104: see if endnetent exists
8105set endnetent d_endnent
8106eval $inlibc
8107
8108: see if endprotoent exists
8109set endprotoent d_endpent
8110eval $inlibc
8111
5ff3f7a4
GS
8112: see if endpwent exists
8113set endpwent d_endpwent
8114eval $inlibc
8115
e5c9fcd0
AD
8116: see if endservent exists
8117set endservent d_endsent
8118eval $inlibc
8119
f1066039
JH
8120: see if endspent exists
8121set endspent d_endspent
8122eval $inlibc
8123
8e07c86e
AD
8124: Locate the flags for 'open()'
8125echo " "
8126$cat >open3.c <<'EOCP'
8127#include <sys/types.h>
8128#ifdef I_FCNTL
8129#include <fcntl.h>
8130#endif
8131#ifdef I_SYS_FILE
8132#include <sys/file.h>
8133#endif
d674cd6d 8134int main() {
8e07c86e
AD
8135 if(O_RDONLY);
8136#ifdef O_TRUNC
8137 exit(0);
8138#else
8139 exit(1);
8140#endif
8141}
8142EOCP
8143: check sys/file.h first to get FREAD on Sun
8144if $test `./findhdr sys/file.h` && \
dfe9444c 8145 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8146 h_sysfile=true;
8147 echo "<sys/file.h> defines the O_* constants..." >&4
8148 if ./open3; then
8149 echo "and you have the 3 argument form of open()." >&4
8150 val="$define"
8151 else
8152 echo "but not the 3 argument form of open(). Oh, well." >&4
8153 val="$undef"
8154 fi
8155elif $test `./findhdr fcntl.h` && \
dfe9444c 8156 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8157 h_fcntl=true;
8158 echo "<fcntl.h> defines the O_* constants..." >&4
8159 if ./open3; then
8160 echo "and you have the 3 argument form of open()." >&4
8161 val="$define"
8162 else
8163 echo "but not the 3 argument form of open(). Oh, well." >&4
8164 val="$undef"
8165 fi
8166else
8167 val="$undef"
8168 echo "I can't find the O_* constant definitions! You got problems." >&4
8169fi
8170set d_open3
8171eval $setvar
8172$rm -f open3*
8173
8174: check for non-blocking I/O stuff
8175case "$h_sysfile" in
8176true) echo "#include <sys/file.h>" > head.c;;
8177*)
8178 case "$h_fcntl" in
8179 true) echo "#include <fcntl.h>" > head.c;;
8180 *) echo "#include <sys/fcntl.h>" > head.c;;
8181 esac
8182 ;;
8183esac
8184echo " "
8185echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8186case "$o_nonblock" in
8187'')
8188 $cat head.c > try.c
8189 $cat >>try.c <<'EOCP'
d674cd6d 8190int main() {
8e07c86e
AD
8191#ifdef O_NONBLOCK
8192 printf("O_NONBLOCK\n");
8193 exit(0);
8194#endif
8195#ifdef O_NDELAY
8196 printf("O_NDELAY\n");
8197 exit(0);
8198#endif
8199#ifdef FNDELAY
8200 printf("FNDELAY\n");
8201 exit(0);
8202#endif
8203 exit(0);
8204}
8205EOCP
dfe9444c 8206 set try
dc45a647 8207 if eval $compile_ok; then
8e07c86e
AD
8208 o_nonblock=`./try`
8209 case "$o_nonblock" in
8210 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8211 *) echo "Seems like we can use $o_nonblock.";;
8212 esac
8213 else
8214 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8215 fi
8216 ;;
8217*) echo "Using $hint value $o_nonblock.";;
8218esac
8219$rm -f try try.* .out core
8220
8221echo " "
8222echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8223case "$eagain" in
8224'')
8225 $cat head.c > try.c
8226 $cat >>try.c <<EOCP
8227#include <errno.h>
8228#include <sys/types.h>
8229#include <signal.h>
4633a7c4 8230#define MY_O_NONBLOCK $o_nonblock
dc45a647 8231#ifndef errno /* XXX need better Configure test */
8e07c86e 8232extern int errno;
dc45a647 8233#endif
8e07c86e 8234$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8235EOCP
8236 $cat >> try.c <<'EOCP'
d674cd6d 8237int main()
8e07c86e
AD
8238{
8239 int pd[2];
8240 int pu[2];
8241 char buf[1];
8242 char string[100];
8243
8244 pipe(pd); /* Down: child -> parent */
8245 pipe(pu); /* Up: parent -> child */
8246 if (0 != fork()) {
8247 int ret;
8248 close(pd[1]); /* Parent reads from pd[0] */
8249 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8250 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8251 exit(1);
8252 signal(SIGALRM, blech);
8253 alarm(5);
8254 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8255 exit(2);
8256 sprintf(string, "%d\n", ret);
8257 write(2, string, strlen(string));
8258 alarm(0);
8259#ifdef EAGAIN
8260 if (errno == EAGAIN) {
8261 printf("EAGAIN\n");
8262 goto ok;
8263 }
8264#endif
8265#ifdef EWOULDBLOCK
8266 if (errno == EWOULDBLOCK)
8267 printf("EWOULDBLOCK\n");
8268#endif
8269 ok:
8270 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8271 sleep(2); /* Give it time to close our pipe */
8272 alarm(5);
8273 ret = read(pd[0], buf, 1); /* Should read EOF */
8274 alarm(0);
8275 sprintf(string, "%d\n", ret);
8276 write(3, string, strlen(string));
8277 exit(0);
8278 }
8279
8280 close(pd[0]); /* We write to pd[1] */
8281 close(pu[1]); /* We read from pu[0] */
8282 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8283 close(pd[1]); /* Pipe pd is now fully closed! */
8284 exit(0); /* Bye bye, thank you for playing! */
8285}
8286EOCP
dfe9444c 8287 set try
dc45a647 8288 if eval $compile_ok; then
774d564b 8289 echo "$startsh" >mtry
40a7a20a 8290 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8291 chmod +x mtry
8292 ./mtry >/dev/null 2>&1
8293 case $? in
8294 0) eagain=`$cat try.out`;;
8295 1) echo "Could not perform non-blocking setting!";;
8296 2) echo "I did a successful read() for something that was not there!";;
8297 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8298 *) echo "Something terribly wrong happened during testing.";;
8299 esac
8300 rd_nodata=`$cat try.ret`
8301 echo "A read() system call with no data present returns $rd_nodata."
8302 case "$rd_nodata" in
8303 0|-1) ;;
8304 *)
8305 echo "(That's peculiar, fixing that to be -1.)"
8306 rd_nodata=-1
8307 ;;
8308 esac
8309 case "$eagain" in
8310 '')
8311 echo "Forcing errno EAGAIN on read() with no data available."
8312 eagain=EAGAIN
8313 ;;
8314 *)
8315 echo "Your read() sets errno to $eagain when no data is available."
8316 ;;
8317 esac
8318 status=`$cat try.err`
8319 case "$status" in
8320 0) echo "And it correctly returns 0 to signal EOF.";;
8321 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8322 *) echo "However, your read() returns '$status' on EOF??";;
8323 esac
8324 val="$define"
28757baa 8325 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8326 echo "WARNING: you can't distinguish between EOF and no data!"
8327 val="$undef"
8328 fi
8329 else
8330 echo "I can't compile the test program--assuming errno EAGAIN will do."
8331 eagain=EAGAIN
8332 fi
8333 set d_eofnblk
8334 eval $setvar
8335 ;;
8336*)
8337 echo "Using $hint value $eagain."
8338 echo "Your read() returns $rd_nodata when no data is present."
8339 case "$d_eofnblk" in
8340 "$define") echo "And you can see EOF because read() returns 0.";;
8341 "$undef") echo "But you can't see EOF status from read() returned value.";;
8342 *)
8343 echo "(Assuming you can't see EOF status from read anyway.)"
8344 d_eofnblk=$undef
8345 ;;
8346 esac
8347 ;;
8348esac
8349$rm -f try try.* .out core head.c mtry
8350
a0d0e21e
LW
8351: see if fchmod exists
8352set fchmod d_fchmod
8353eval $inlibc
8354
8355: see if fchown exists
8356set fchown d_fchown
8357eval $inlibc
8358
8359: see if this is an fcntl system
8360set fcntl d_fcntl
8361eval $inlibc
8362
921b2963
JH
8363: see if sys/select.h has to be included
8364set sys/select.h i_sysselct
8365eval $inhdr
8366
8367: see if we should include time.h, sys/time.h, or both
8368echo " "
8369if test "X$timeincl" = X; then
8370 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8371 $echo $n "I'm now running the test program...$c"
8372 $cat >try.c <<'EOCP'
8373#include <sys/types.h>
8374#ifdef I_TIME
8375#include <time.h>
8376#endif
8377#ifdef I_SYSTIME
8378#ifdef SYSTIMEKERNEL
8379#define KERNEL
8380#endif
8381#include <sys/time.h>
8382#endif
8383#ifdef I_SYSSELECT
8384#include <sys/select.h>
8385#endif
d674cd6d 8386int main()
921b2963
JH
8387{
8388 struct tm foo;
8389#ifdef S_TIMEVAL
8390 struct timeval bar;
8391#endif
8392#ifdef S_TIMEZONE
8393 struct timezone tzp;
8394#endif
8395 if (foo.tm_sec == foo.tm_sec)
8396 exit(0);
8397#ifdef S_TIMEVAL
8398 if (bar.tv_sec == bar.tv_sec)
8399 exit(0);
8400#endif
8401 exit(1);
8402}
8403EOCP
8404 flags=''
8405 for s_timezone in '-DS_TIMEZONE' ''; do
8406 sysselect=''
8407 for s_timeval in '-DS_TIMEVAL' ''; do
8408 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8409 for i_time in '' '-DI_TIME'; do
8410 for i_systime in '-DI_SYSTIME' ''; do
8411 case "$flags" in
8412 '') $echo $n ".$c"
8413 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8414 if eval $compile; then
8415 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8416 shift
8417 flags="$*"
8418 echo " "
8419 $echo $n "Succeeded with $flags$c"
8420 fi
8421 ;;
8422 esac
8423 done
8424 done
8425 done
8426 done
8427 done
8428 timeincl=''
8429 echo " "
8430 case "$flags" in
8431 *SYSTIMEKERNEL*) i_systimek="$define"
8432 timeincl=`./findhdr sys/time.h`
8433 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8434 *) i_systimek="$undef";;
8435 esac
8436 case "$flags" in
8437 *I_TIME*) i_time="$define"
8438 timeincl=`./findhdr time.h`" $timeincl"
8439 echo "We'll include <time.h>." >&4;;
8440 *) i_time="$undef";;
8441 esac
8442 case "$flags" in
8443 *I_SYSTIME*) i_systime="$define"
8444 timeincl=`./findhdr sys/time.h`" $timeincl"
8445 echo "We'll include <sys/time.h>." >&4;;
8446 *) i_systime="$undef";;
8447 esac
8448 $rm -f try.c try
8449fi
8450
8451: check for fd_set items
8452$cat <<EOM
8453
8454Checking to see how well your C compiler handles fd_set and friends ...
8455EOM
8456$cat >fd_set.c <<EOCP
8457#$i_systime I_SYS_TIME
8458#$i_sysselct I_SYS_SELECT
8459#$d_socket HAS_SOCKET
8460#include <sys/types.h>
8461#ifdef HAS_SOCKET
8462#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8463#endif
8464#ifdef I_SYS_TIME
8465#include <sys/time.h>
8466#endif
8467#ifdef I_SYS_SELECT
8468#include <sys/select.h>
8469#endif
d674cd6d 8470int main() {
921b2963
JH
8471 fd_set fds;
8472
8473#ifdef TRYBITS
8474 if(fds.fds_bits);
8475#endif
8476
8477#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8478 exit(0);
8479#else
8480 exit(1);
8481#endif
8482}
8483EOCP
8484set fd_set -DTRYBITS
8485if eval $compile; then
8486 d_fds_bits="$define"
8487 d_fd_set="$define"
8488 echo "Well, your system knows about the normal fd_set typedef..." >&4
8489 if ./fd_set; then
8490 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8491 d_fd_macros="$define"
8492 else
8493 $cat >&4 <<'EOM'
8494but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8495EOM
8496 d_fd_macros="$undef"
8497 fi
8498else
8499 $cat <<'EOM'
8500Hmm, your compiler has some difficulty with fd_set. Checking further...
8501EOM
8502 set fd_set
8503 if eval $compile; then
8504 d_fds_bits="$undef"
8505 d_fd_set="$define"
8506 echo "Well, your system has some sort of fd_set available..." >&4
8507 if ./fd_set; then
8508 echo "and you have the normal fd_set macros." >&4
8509 d_fd_macros="$define"
8510 else
8511 $cat <<'EOM'
8512but not the normal fd_set macros! Gross! More work for me...
8513EOM
8514 d_fd_macros="$undef"
8515 fi
8516 else
8517 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
8518 d_fd_set="$undef"
8519 d_fds_bits="$undef"
8520 d_fd_macros="$undef"
8521 fi
8522fi
8523$rm -f fd_set*
8524
a0d0e21e
LW
8525: see if fgetpos exists
8526set fgetpos d_fgetpos
8527eval $inlibc
8528
d9b3e12d
JH
8529: see if flock exists
8530set flock d_flock
8531eval $inlibc
8532
8533: see if fork exists
8534set fork d_fork
8535eval $inlibc
8536
8537: see if pathconf exists
8538set pathconf d_pathconf
8539eval $inlibc
8540
8541: see if fpathconf exists
8542set fpathconf d_fpathconf
8543eval $inlibc
8544
8545
8546: see if llseek exists
8547set llseek d_llseek
8548eval $inlibc
8549
8550: check for off64_t
8551echo " "
8552echo $n "Checking to see if your system supports off64_t...$c" >&4
8553$cat >try.c <<EOCP
8554#include <sys/types.h>
8555#include <unistd.h>
8556off64_t foo() { off64_t x; x = 7; return x; }'
8557EOCP
8558if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8559 val="$define"
8560 echo " Yup, it does." >&4
8561else
8562 val="$undef"
8563 echo " Nope, it doesn't." >&4
8564fi
8565$rm -f try.*
8566set d_off64_t
8567eval $setvar
8568
8569: check for fpos64_t
8570echo " "
8571echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8572$cat >try.c <<EOCP
8573#include <sys/stdio.h>
8574fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8575EOCP
8576if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8577 val="$define"
8578 echo " Yup, it does." >&4
8579else
8580 val="$undef"
8581 echo " Nope, it doesn't." >&4
8582fi
8583$rm -f try.*
8584set d_fpos64_t
8585eval $setvar
8586
8587: see if fseeko exists
8588set fseeko d_fseeko
8589eval $inlibc
8590
8591: see if fsetpos exists
8592set fsetpos d_fsetpos
8593eval $inlibc
8594
9b9c89a3
JH
8595: see if this is a sys/param system
8596set sys/param.h i_sysparam
8597eval $inhdr
8598
104d25b7
JH
8599: see if this is a sys/mount.h system
8600set sys/mount.h i_sysmount
8601eval $inhdr
8602
8603
8604: see if statfs exists
8605set statfs d_statfs
8606eval $inlibc
8607
8608: see if fstatfs exists
8609set fstatfs d_fstatfs
8610eval $inlibc
8611
8612: see if statfs knows about mount flags
9b9c89a3 8613set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
104d25b7
JH
8614eval $hasfield
8615
8616
8617: see if statvfs exists
8618set statvfs d_statvfs
8619eval $inlibc
8620
8621: see if fstatvfs exists
8622set fstatvfs d_fstatvfs
8623eval $inlibc
8624
8625
5ff3f7a4
GS
8626: see if ftello exists
8627set ftello d_ftello
8628eval $inlibc
8629
8630: see if getgrent exists
8631set getgrent d_getgrent
8632eval $inlibc
8633
693762b4
AD
8634: see if gethostbyaddr exists
8635set gethostbyaddr d_gethbyaddr
8636eval $inlibc
8637
8638: see if gethostbyname exists
8639set gethostbyname d_gethbyname
8640eval $inlibc
8641
a0d0e21e
LW
8642: see if gethostent exists
8643set gethostent d_gethent
8644eval $inlibc
8645
921b2963
JH
8646: see how we will look up host name
8647echo " "
a63faeb8
JH
8648call=''
8649if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
8650 echo 'gethostname() found.' >&4
8651 d_gethname="$define"
8652 call=gethostname
a63faeb8
JH
8653fi
8654if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
8655 if ./xenix; then
8656 $cat <<'EOM'
8657uname() was found, but you're running xenix, and older versions of xenix
8658have a broken uname(). If you don't really know whether your xenix is old
8659enough to have a broken system call, use the default answer.
8660
8661EOM
8662 dflt=y
8663 case "$d_uname" in
8664 "$define") dflt=n;;
8665 esac
8666 rp='Is your uname() broken?'
8667 . ./myread
8668 case "$ans" in
8669 n*) d_uname="$define"; call=uname;;
8670 esac
8671 else
8672 echo 'uname() found.' >&4
8673 d_uname="$define"
a63faeb8
JH
8674 case "$call" in
8675 '') call=uname ;;
8676 esac
921b2963
JH
8677 fi
8678fi
8679case "$d_gethname" in
8680'') d_gethname="$undef";;
8681esac
8682case "$d_uname" in
8683'') d_uname="$undef";;
8684esac
8685case "$d_uname$d_gethname" in
8686*define*)
8687 dflt=n
8688 cat <<EOM
8689
8690Every now and then someone has a $call() that lies about the hostname
8691but can't be fixed for political or economic reasons. If you wish, I can
8692pretend $call() isn't there and maybe compute hostname at run-time
8693thanks to the '$phostname' command.
8694
8695EOM
8696 rp="Shall I ignore $call() from now on?"
8697 . ./myread
8698 case "$ans" in
8699 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8700 esac;;
8701esac
8702case "$phostname" in
8703'') aphostname='';;
8704*) case "$aphostname" in
8705 /*) ;;
8706 *) set X $phostname
8707 shift
8708 file=$1
8709 shift
8710 file=`./loc $file $file $pth`
8711 aphostname=`echo $file $*`
8712 ;;
8713 esac
8714 ;;
8715esac
8716case "$d_uname$d_gethname" in
8717*define*) ;;
8718*)
8719 case "$phostname" in
8720 '')
8721 echo "There will be no way for $package to get your hostname." >&4;;
8722 *)
8723 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8724 ;;
8725 esac;;
8726esac
8727case "$d_phostname" in
8728'') d_phostname="$undef";;
8729esac
8730
dc45a647
MB
8731: see if this is a netdb.h system
8732set netdb.h i_netdb
8733eval $inhdr
8734
8735: see if prototypes for various gethostxxx netdb.h functions are available
8736echo " "
8737set d_gethostprotos gethostent $i_netdb netdb.h
8738eval $hasproto
8739
a0d0e21e
LW
8740: see if getlogin exists
8741set getlogin d_getlogin
8742eval $inlibc
8743
ccc7f9b3
KS
8744: see if getmntent exists
8745set getmntent d_getmntent
8746eval $inlibc
8747
693762b4
AD
8748: see if getnetbyaddr exists
8749set getnetbyaddr d_getnbyaddr
8750eval $inlibc
8751
8752: see if getnetbyname exists
8753set getnetbyname d_getnbyname
8754eval $inlibc
8755
e5c9fcd0
AD
8756: see if getnetent exists
8757set getnetent d_getnent
8758eval $inlibc
8759
dc45a647
MB
8760: see if prototypes for various getnetxxx netdb.h functions are available
8761echo " "
8762set d_getnetprotos getnetent $i_netdb netdb.h
8763eval $hasproto
8764
693762b4
AD
8765
8766: see if getprotobyname exists
8767set getprotobyname d_getpbyname
8768eval $inlibc
8769
8770: see if getprotobynumber exists
8771set getprotobynumber d_getpbynumber
8772eval $inlibc
e5c9fcd0
AD
8773
8774: see if getprotoent exists
8775set getprotoent d_getpent
8776eval $inlibc
8777
2afac517 8778: see if getpgid exists
8779set getpgid d_getpgid
a0d0e21e
LW
8780eval $inlibc
8781
8782: see if getpgrp2 exists
8783set getpgrp2 d_getpgrp2
8784eval $inlibc
8785
8786: see if getppid exists
8787set getppid d_getppid
8788eval $inlibc
8789
8790: see if getpriority exists
8791set getpriority d_getprior
8792eval $inlibc
8793
dc45a647
MB
8794: see if prototypes for various getprotoxxx netdb.h functions are available
8795echo " "
8796set d_getprotoprotos getprotoent $i_netdb netdb.h
8797eval $hasproto
8798
5ff3f7a4
GS
8799: see if getpwent exists
8800set getpwent d_getpwent
8801eval $inlibc
8802
8803
693762b4
AD
8804: see if getservbyname exists
8805set getservbyname d_getsbyname
8806eval $inlibc
8807
8808: see if getservbyport exists
8809set getservbyport d_getsbyport
8810eval $inlibc
e5c9fcd0
AD
8811
8812: see if getservent exists
8813set getservent d_getsent
8814eval $inlibc
8815
dc45a647
MB
8816: see if prototypes for various getservxxx netdb.h functions are available
8817echo " "
8818set d_getservprotos getservent $i_netdb netdb.h
8819eval $hasproto
8820
f1066039
JH
8821: see if getspent exists
8822set getspent d_getspent
8823eval $inlibc
8824
8825: see if getspnam exists
8826set getspnam d_getspnam
8827eval $inlibc
8828
5f05dabc 8829: see if gettimeofday or ftime exists
8830set gettimeofday d_gettimeod
8831eval $inlibc
8832case "$d_gettimeod" in
8833"$undef")
8834 set ftime d_ftime
8835 eval $inlibc
8836 ;;
8837*)
8838 val="$undef"; set d_ftime; eval $setvar
8839 ;;
8840esac
8841case "$d_gettimeod$d_ftime" in
8842"$undef$undef")
8843 echo " "
8844 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8845 ;;
8846esac
8847
5ff3f7a4
GS
8848: see if this is an grp system
8849set grp.h i_grp
8850eval $inhdr
8851
8852case "$i_grp" in
8853$define)
8854 xxx=`./findhdr grp.h`
8855 $cppstdin $cppflags $cppminus < $xxx >$$.h
8856
8857 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8858 val="$define"
8859 else
8860 val="$undef"
8861 fi
8862 set d_grpasswd
8863 eval $setvar
8864
8865 $rm -f $$.h
8866 ;;
8867*)
8868 val="$undef";
8869 set d_grpasswd; eval $setvar
8870 ;;
8871esac
8872
ccc7f9b3
KS
8873: see if hasmntopt exists
8874set hasmntopt d_hasmntopt
8875eval $inlibc
8876
a0d0e21e
LW
8877: see if this is a netinet/in.h or sys/in.h system
8878set netinet/in.h i_niin sys/in.h i_sysin
8879eval $inhdr
8880
5ff3f7a4 8881: see if arpa/inet.h has to be included
93341792 8882set arpa/inet.h i_arpainet
28e8609d
JH
8883eval $inhdr
8884
a0d0e21e
LW
8885: see if htonl --and friends-- exists
8886val=''
8887set htonl val
8888eval $inlibc
8889
8890: Maybe they are macros.
8891case "$val" in
8892$undef)
8893 $cat >htonl.c <<EOM
8894#include <stdio.h>
8895#include <sys/types.h>
8896#$i_niin I_NETINET_IN
8897#$i_sysin I_SYS_IN
93341792 8898#$i_arpainet I_ARPA_INET
a0d0e21e
LW
8899#ifdef I_NETINET_IN
8900#include <netinet/in.h>
8901#endif
8902#ifdef I_SYS_IN
8903#include <sys/in.h>
8904#endif
28e8609d
JH
8905#ifdef I_ARPA_INET
8906#include <arpa/inet.h>
8907#endif
a0d0e21e
LW
8908#ifdef htonl
8909printf("Defined as a macro.");
8910#endif
8911EOM
8912 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8913 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8914 val="$define"
8915 echo "But it seems to be defined as a macro." >&4
8916 fi
8917 $rm -f htonl.?
8918 ;;
8919esac
8920set d_htonl
8921eval $setvar
8922
8923: see which of string.h or strings.h is needed
8924echo " "
8925strings=`./findhdr string.h`
8926if $test "$strings" && $test -r "$strings"; then
8927 echo "Using <string.h> instead of <strings.h>." >&4
8928 val="$define"
8929else
8930 val="$undef"
8931 strings=`./findhdr strings.h`
8932 if $test "$strings" && $test -r "$strings"; then
8933 echo "Using <strings.h> instead of <string.h>." >&4
8934 else
8935 echo "No string header found -- You'll surely have problems." >&4
8936 fi
8937fi
8938set i_string
8939eval $setvar
8940case "$i_string" in
8941"$undef") strings=`./findhdr strings.h`;;
8942*) strings=`./findhdr string.h`;;
8943esac
8944
8945: index or strchr
8946echo " "
8947if set index val -f; eval $csym; $val; then
8948 if set strchr val -f d_strchr; eval $csym; $val; then
8949 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8950 val="$define"
8951 vali="$undef"
8952 echo "strchr() found." >&4
8953 else
8954 val="$undef"
8955 vali="$define"
8956 echo "index() found." >&4
8957 fi
8958 else
8959 val="$undef"
8960 vali="$define"
8961 echo "index() found." >&4
8962 fi
8963else
8964 if set strchr val -f d_strchr; eval $csym; $val; then
8965 val="$define"
8966 vali="$undef"
8967 echo "strchr() found." >&4
8968 else
8969 echo "No index() or strchr() found!" >&4
8970 val="$undef"
8971 vali="$undef"
8972 fi
8973fi
8974set d_strchr; eval $setvar
8975val="$vali"
8976set d_index; eval $setvar
8977
7e1af8bc 8978: check whether inet_aton exists
8979set inet_aton d_inetaton
8980eval $inlibc
8981
a0d0e21e
LW
8982: Look for isascii
8983echo " "
8984$cat >isascii.c <<'EOCP'
8985#include <stdio.h>
8986#include <ctype.h>
d674cd6d 8987int main() {
a0d0e21e
LW
8988 int c = 'A';
8989 if (isascii(c))
8990 exit(0);
8991 else
8992 exit(1);
8993}
8994EOCP
dfe9444c
AD
8995set isascii
8996if eval $compile; then
a0d0e21e
LW
8997 echo "isascii() found." >&4
8998 val="$define"
8999else
9000 echo "isascii() NOT found." >&4
9001 val="$undef"
9002fi
9003set d_isascii
9004eval $setvar
9005$rm -f isascii*
9006
9007: see if killpg exists
9008set killpg d_killpg
9009eval $inlibc
9010
dd64f1c3
AD
9011: see if lchown exists
9012echo " "
9013$cat > try.c <<'EOCP'
9014/* System header to define __stub macros and hopefully few prototypes,
9015 which can conflict with char lchown(); below. */
9016#include <assert.h>
9017/* Override any gcc2 internal prototype to avoid an error. */
9018/* We use char because int might match the return type of a gcc2
9019 builtin and then its argument prototype would still apply. */
9020char lchown();
9021int main() {
9022 /* The GNU C library defines this for functions which it implements
9023 to always fail with ENOSYS. Some functions are actually named
9024 something starting with __ and the normal name is an alias. */
9025#if defined (__stub_lchown) || defined (__stub___lchown)
9026choke me
9027#else
9028lchown();
9029#endif
9030; return 0; }
9031EOCP
9032set try
9033if eval $compile; then
9034 $echo "lchown() found." >&4
9035 val="$define"
9036else
9037 $echo "lchown() NOT found." >&4
9038 val="$undef"
9039fi
9040set d_lchown
9041eval $setvar
9042
2d4389e4
JH
9043: See if number of significant digits in a double precision number is known
9044echo " "
9045$cat >ldbl_dig.c <<EOM
9046#$i_limits I_LIMITS
9047#$i_float I_FLOAT
9048#ifdef I_LIMITS
9049#include <limits.h>
9050#endif
9051#ifdef I_FLOAT
9052#include <float.h>
9053#endif
9054#ifdef LDBL_DIG
9055printf("Contains LDBL_DIG");
9056#endif
9057EOM
9058$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9059if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9060 echo "LDBL_DIG found." >&4
9061 val="$define"
9062else
9063 echo "LDBL_DIG NOT found." >&4
9064 val="$undef"
9065fi
9066$rm -f ldbl_dig.?
9067set d_ldbl_dig
9068eval $setvar
9069
a0d0e21e
LW
9070: see if link exists
9071set link d_link
9072eval $inlibc
9073
a0d0e21e
LW
9074: see if localeconv exists
9075set localeconv d_locconv
9076eval $inlibc
9077
9078: see if lockf exists
9079set lockf d_lockf
9080eval $inlibc
9081
9082: see if lstat exists
9083set lstat d_lstat
9084eval $inlibc
9085
ff49bff8
JH
9086: see if madvise exists
9087set madvise d_madvise
9088eval $inlibc
9089
a0d0e21e
LW
9090: see if mblen exists
9091set mblen d_mblen
9092eval $inlibc
9093
9094: see if mbstowcs exists
9095set mbstowcs d_mbstowcs
9096eval $inlibc
9097
9098: see if mbtowc exists
9099set mbtowc d_mbtowc
9100eval $inlibc
9101
0f27ced1
JH
9102: see if memchr exists
9103set memchr d_memchr
9104eval $inlibc
9105
a0d0e21e
LW
9106: see if memcmp exists
9107set memcmp d_memcmp
9108eval $inlibc
9109
9110: see if memcpy exists
9111set memcpy d_memcpy
9112eval $inlibc
9113
9114: see if memmove exists
9115set memmove d_memmove
2304df62
AD
9116eval $inlibc
9117
9118: see if memset exists
9119set memset d_memset
9120eval $inlibc
9121
9122: see if mkdir exists
9123set mkdir d_mkdir
9124eval $inlibc
9125
a0d0e21e
LW
9126: see if mkfifo exists
9127set mkfifo d_mkfifo
9128eval $inlibc
9129
9130: see if mktime exists
9131set mktime d_mktime
9132eval $inlibc
9133
ff49bff8
JH
9134: see if this is a sys/mman.h system
9135set sys/mman.h i_sysmman
9136eval $inhdr
9137
9138: see if mmap exists
9139set mmap d_mmap
9140eval $inlibc
9141: see what shmat returns
9142: default to something harmless
9143mmaptype='void *'
9144case "$i_sysmman$d_mmap" in
9145"$define$define")
9146 $cat >mmap.c <<'END'
9147#include <sys/mman.h>
9148void *mmap();
9149END
9150 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9151 mmaptype='void *'
9152 else
9153 mmaptype='caddr_t'
9154 fi
9155 echo "and it returns ($mmaptype)." >&4
9156 ;;
9157esac
9158
9159
9160
9161: see if mprotect exists
9162set mprotect d_mprotect
9163eval $inlibc
9164
2304df62
AD
9165: see if msgctl exists
9166set msgctl d_msgctl
9167eval $inlibc
9168
9169: see if msgget exists
9170set msgget d_msgget
9171eval $inlibc
9172
9173: see if msgsnd exists
9174set msgsnd d_msgsnd
9175eval $inlibc
9176
9177: see if msgrcv exists
9178set msgrcv d_msgrcv
9179eval $inlibc
9180
9181: see how much of the 'msg*(2)' library is present.
9182h_msg=true
9183echo " "
9184case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9185*"$undef"*) h_msg=false;;
9186esac
6087ac44
JH
9187case "$osname" in
9188freebsd)
9189 case "`ipcs 2>&1`" in
9190 "SVID messages"*"not configured"*)
5ff3f7a4 9191 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9192 h_msg=false
9193 val="$undef"
9194 set msgctl d_msgctl
9195 eval $setvar
9196 set msgget d_msgget
9197 eval $setvar
9198 set msgsnd d_msgsnd
9199 eval $setvar
9200 set msgrcv d_msgrcv
9201 eval $setvar
9202 ;;
9203 esac
9204 ;;
9205esac
2304df62
AD
9206: we could also check for sys/ipc.h ...
9207if $h_msg && $test `./findhdr sys/msg.h`; then
9208 echo "You have the full msg*(2) library." >&4
9209 val="$define"
9210else
9211 echo "You don't have the full msg*(2) library." >&4
9212 val="$undef"
9213fi
9214set d_msg
9215eval $setvar
9216
ff49bff8
JH
9217: see if msync exists
9218set msync d_msync
9219eval $inlibc
9220
9221: see if munmap exists
9222set munmap d_munmap
9223eval $inlibc
9224
dfe9444c
AD
9225: see if nice exists
9226set nice d_nice
9227eval $inlibc
9228
c4747d3e 9229: see if POSIX threads are available
1f5ae88c
JH
9230set pthread.h i_pthread
9231eval $inhdr
9232
c4747d3e
JH
9233
9234
9235
9236: how to create joinable pthreads
9237if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
9238 echo " "
9239 echo "Checking what constant to use for creating joinable pthreads..." >&4
9240 $cat >try.c <<'EOCP'
9241#include <pthread.h>
9242int main() {
9243 int detachstate = JOINABLE;
9244}
9245EOCP
9246 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9247 if eval $compile; then
c6912327 9248 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
9249 val="$undef" # Yes, undef.
9250 set d_old_pthread_create_joinable
13666627 9251 eval $setvar
ef4af2be
JH
9252 val=""
9253 set old_pthread_create_joinable
13666627
JH
9254 eval $setvar
9255 else
9256 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9257 if eval $compile; then
c6912327 9258 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 9259 val="$define"
ef4af2be 9260 set d_old_pthread_create_joinable
13666627
JH
9261 eval $setvar
9262 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 9263 set old_pthread_create_joinable
13666627
JH
9264 eval $setvar
9265 else
9266 set try -DJOINABLE=__UNDETACHED
9267 if eval $compile; then
c6912327 9268 echo "You seem to use __UNDETACHED." >&4
13666627 9269 val="$define"
ef4af2be 9270 set d_old_pthread_create_joinable
13666627
JH
9271 eval $setvar
9272 val=__UNDETACHED
ef4af2be 9273 set old_pthread_create_joinable
13666627
JH
9274 eval $setvar
9275 else
c6912327 9276 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 9277 val="$define"
ef4af2be 9278 set d_old_pthread_create_joinable
13666627
JH
9279 eval $setvar
9280 val=0
ef4af2be 9281 set old_pthread_create_joinable
13666627
JH
9282 eval $setvar
9283 fi
9284 fi
9285 fi
9286 $rm -f try try.*
9287else
ef4af2be
JH
9288 d_old_pthread_create_joinable="$undef"
9289 old_pthread_create_joinable=""
13666627
JH
9290fi
9291
ef4af2be
JH
9292: see if pause exists
9293set pause d_pause
9294eval $inlibc
9295
9296: see if pipe exists
9297set pipe d_pipe
9298eval $inlibc
9299
9300: see if poll exists
9301set poll d_poll
9302eval $inlibc
9303
31dfa2f6
JH
9304
9305: see whether the various POSIXish _yields exist
9306$cat >try.c <<EOP
9307#include <pthread.h>
9308#include <stdio.h>
5a411a32 9309int main() {
31dfa2f6
JH
9310#ifdef SCHED_YIELD
9311 sched_yield();
9312#else
9313#ifdef PTHREAD_YIELD
9314 pthread_yield();
9315#else
9316#ifdef PTHREAD_YIELD_NULL
9317 pthread_yield(NULL);
9318#endif
9319#endif
9320#endif
9321}
9322EOP
9323: see if sched_yield exists
9324set try -DSCHED_YIELD
9325if eval $compile; then
9326 val="$define"
9327 sched_yield='sched_yield()'
9328else
9329 val="$undef"
9330fi
9331case "$usethreads" in
9332$define)
9333 case "$val" in
9334 $define) echo 'sched_yield() found.' >&4 ;;
9335 *) echo 'sched_yield() NOT found.' >&4 ;;
9336 esac
9337esac
9338set d_sched_yield
9339eval $setvar
9340
9341: see if pthread_yield exists
9342set try -DPTHREAD_YIELD
9343if eval $compile; then
9344 val="$define"
9345 case "$sched_yield" in
9346 '') sched_yield='pthread_yield()' ;;
9347 esac
9348else
9349 set try -DPTHREAD_YIELD_NULL
9350 if eval $compile; then
9351 val="$define"
9352 case "$sched_yield" in
9353 '') sched_yield='pthread_yield(NULL)' ;;
9354 esac
9355 else
9356 val="$undef"
9357 fi
9358fi
9359case "$usethreads" in
9360$define)
9361 case "$val" in
9362 $define) echo 'pthread_yield() found.' >&4 ;;
9363 *) echo 'pthread_yield() NOT found.' >&4 ;;
9364 esac
9365 ;;
9366esac
9367set d_pthread_yield
9368eval $setvar
9369
9370case "$sched_yield" in
9371'') sched_yield=undef ;;
9372esac
9373
9374$rm -f try try.*
9375
4aa0a1f7
AD
9376: see if this is a pwd.h system
9377set pwd.h i_pwd
9378eval $inhdr
9379
9380case "$i_pwd" in
9381$define)
9382 xxx=`./findhdr pwd.h`
85e6fe83 9383 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 9384
2304df62 9385 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 9386 val="$define"
2304df62 9387 else
4aa0a1f7 9388 val="$undef"
2304df62 9389 fi
4aa0a1f7
AD
9390 set d_pwquota
9391 eval $setvar
9392
2304df62 9393 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 9394 val="$define"
2304df62 9395 else
4aa0a1f7 9396 val="$undef"
2304df62 9397 fi
4aa0a1f7
AD
9398 set d_pwage
9399 eval $setvar
9400
2304df62 9401 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 9402 val="$define"
2304df62 9403 else
4aa0a1f7 9404 val="$undef"
2304df62 9405 fi
4aa0a1f7
AD
9406 set d_pwchange
9407 eval $setvar
9408
2304df62 9409 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 9410 val="$define"
2304df62 9411 else
4aa0a1f7 9412 val="$undef"
2304df62 9413 fi
4aa0a1f7
AD
9414 set d_pwclass
9415 eval $setvar
9416
2304df62 9417 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 9418 val="$define"
2304df62 9419 else
4aa0a1f7 9420 val="$undef"
2304df62 9421 fi
4aa0a1f7
AD
9422 set d_pwexpire
9423 eval $setvar
9424
2304df62 9425 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4aa0a1f7 9426 val="$define"
2304df62 9427 else
4aa0a1f7 9428 val="$undef"
2304df62 9429 fi
4aa0a1f7
AD
9430 set d_pwcomment
9431 eval $setvar
9432
c4f23d77
AD
9433 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9434 val="$define"
9435 else
9436 val="$undef"
9437 fi
9438 set d_pwgecos
9439 eval $setvar
9440
28e8609d
JH
9441 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9442 val="$define"
9443 else
9444 val="$undef"
9445 fi
9446 set d_pwpasswd
9447 eval $setvar
9448
2304df62 9449 $rm -f $$.h
4aa0a1f7 9450 ;;
5ff3f7a4 9451*)
4aa0a1f7
AD
9452 val="$undef";
9453 set d_pwquota; eval $setvar
9454 set d_pwage; eval $setvar
9455 set d_pwchange; eval $setvar
9456 set d_pwclass; eval $setvar
9457 set d_pwexpire; eval $setvar
9458 set d_pwcomment; eval $setvar
c4f23d77 9459 set d_pwgecos; eval $setvar
28e8609d 9460 set d_pwpasswd; eval $setvar
4aa0a1f7
AD
9461 ;;
9462esac
2304df62 9463
85e6fe83 9464: see if readdir and friends exist
2304df62
AD
9465set readdir d_readdir
9466eval $inlibc
85e6fe83
LW
9467set seekdir d_seekdir
9468eval $inlibc
9469set telldir d_telldir
9470eval $inlibc
9471set rewinddir d_rewinddir
9472eval $inlibc
2304df62 9473
a0d0e21e
LW
9474: see if readlink exists
9475set readlink d_readlink
9476eval $inlibc
9477
de4597cb
JH
9478: see if readv exists
9479set readv d_readv
9480eval $inlibc
9481
2304df62
AD
9482: see if rename exists
9483set rename d_rename
9484eval $inlibc
9485
9486: see if rmdir exists
9487set rmdir d_rmdir
9488eval $inlibc
9489
8ff267be 9490: see if memory.h is available.
9491val=''
9492set memory.h val
9493eval $inhdr
9494
9495: See if it conflicts with string.h
9496case "$val" in
9497$define)
9498 case "$strings" in
9499 '') ;;
9500 *)
9501 $cppstdin $cppflags $cppminus < $strings > mem.h
9502 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9503 echo " "
9504 echo "We won't be including <memory.h>."
9505 val="$undef"
9506 fi
9507 $rm -f mem.h
9508 ;;
9509 esac
9510esac
9511set i_memory
9512eval $setvar
9513
2304df62
AD
9514: can bcopy handle overlapping blocks?
9515val="$undef"
9516case "$d_bcopy" in
9517"$define")
9518 echo " "
9519 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 9520 $cat >try.c <<EOCP
8ff267be 9521#$i_memory I_MEMORY
9522#$i_stdlib I_STDLIB
9523#$i_string I_STRING
9524#$i_unistd I_UNISTD
9525EOCP
dfe9444c 9526 $cat >>try.c <<'EOCP'
8ff267be 9527#include <stdio.h>
8ff267be 9528#ifdef I_MEMORY
9529# include <memory.h>
9530#endif
9531#ifdef I_STDLIB
9532# include <stdlib.h>
9533#endif
9534#ifdef I_STRING
9535# include <string.h>
9536#else
9537# include <strings.h>
9538#endif
9539#ifdef I_UNISTD
9540# include <unistd.h> /* Needed for NetBSD */
9541#endif
d674cd6d 9542int main()
2304df62 9543{
85e6fe83
LW
9544char buf[128], abc[128];
9545char *b;
9546int len;
9547int off;
9548int align;
a0d0e21e 9549
85e6fe83 9550bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
9551
9552for (align = 7; align >= 0; align--) {
9553 for (len = 36; len; len--) {
9554 b = buf+align;
85e6fe83 9555 bcopy(abc, b, len);
2304df62
AD
9556 for (off = 1; off <= len; off++) {
9557 bcopy(b, b+off, len);
9558 bcopy(b+off, b, len);
85e6fe83 9559 if (bcmp(b, abc, len))
2304df62
AD
9560 exit(1);
9561 }
9562 }
9563}
9564exit(0);
9565}
9566EOCP
dfe9444c 9567 set try
dc45a647 9568 if eval $compile_ok; then
dfe9444c 9569 if ./try 2>/dev/null; then
2304df62
AD
9570 echo "Yes, it can."
9571 val="$define"
9572 else
9573 echo "It can't, sorry."
8ff267be 9574 case "$d_memmove" in
9575 "$define") echo "But that's Ok since you have memmove()." ;;
9576 esac
2304df62
AD
9577 fi
9578 else
9579 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 9580 case "$d_memmove" in
9581 "$define") echo "But that's Ok since you have memmove()." ;;
9582 esac
2304df62
AD
9583 fi
9584 ;;
9585esac
dfe9444c 9586$rm -f try.* try core
2304df62
AD
9587set d_safebcpy
9588eval $setvar
9589
9590: can memcpy handle overlapping blocks?
9591val="$undef"
9592case "$d_memcpy" in
9593"$define")
9594 echo " "
9595 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 9596 $cat >try.c <<EOCP
8ff267be 9597#$i_memory I_MEMORY
9598#$i_stdlib I_STDLIB
9599#$i_string I_STRING
9600#$i_unistd I_UNISTD
9601EOCP
dfe9444c 9602 $cat >>try.c <<'EOCP'
8ff267be 9603#include <stdio.h>
8ff267be 9604#ifdef I_MEMORY
9605# include <memory.h>
9606#endif
9607#ifdef I_STDLIB
9608# include <stdlib.h>
9609#endif
9610#ifdef I_STRING
9611# include <string.h>
9612#else
9613# include <strings.h>
9614#endif
9615#ifdef I_UNISTD
9616# include <unistd.h> /* Needed for NetBSD */
9617#endif
d674cd6d 9618int main()
2304df62 9619{
85e6fe83
LW
9620char buf[128], abc[128];
9621char *b;
9622int len;
9623int off;
9624int align;
9625
8ff267be 9626/* Copy "abcde..." string to char abc[] so that gcc doesn't
9627 try to store the string in read-only memory. */
85e6fe83 9628memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
9629
9630for (align = 7; align >= 0; align--) {
9631 for (len = 36; len; len--) {
9632 b = buf+align;
232e078e 9633 memcpy(b, abc, len);
2304df62 9634 for (off = 1; off <= len; off++) {
2304df62 9635 memcpy(b+off, b, len);
232e078e 9636 memcpy(b, b+off, len);
85e6fe83 9637 if (memcmp(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_safemcpy
9666eval $setvar
9667
36477c24 9668: can memcmp be trusted to compare relative magnitude?
9669val="$undef"
9670case "$d_memcmp" in
9671"$define")
9672 echo " "
dfe9444c
AD
9673 echo "Checking if your memcmp() can compare relative magnitude..." >&4
9674 $cat >try.c <<EOCP
36477c24 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'
36477c24 9681#include <stdio.h>
36477c24 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()
36477c24 9697{
9698char a = -1;
9699char b = 0;
9700if ((a < b) && memcmp(&a, &b, 1) < 0)
9701 exit(1);
9702exit(0);
9703}
9704EOCP
dfe9444c 9705 set try
dc45a647 9706 if eval $compile_ok; then
dfe9444c 9707 if ./try 2>/dev/null; then
36477c24 9708 echo "Yes, it can."
9709 val="$define"
9710 else
9711 echo "No, it can't (it uses signed chars)."
9712 fi
9713 else
9714 echo "(I can't compile the test program, so we'll assume not...)"
9715 fi
9716 ;;
9717esac
dfe9444c 9718$rm -f try.* try core
36477c24 9719set d_sanemcmp
9720eval $setvar
9721
2304df62
AD
9722: see if select exists
9723set select d_select
9724eval $inlibc
9725
9726: see if semctl exists
9727set semctl d_semctl
9728eval $inlibc
9729
9730: see if semget exists
9731set semget d_semget
9732eval $inlibc
9733
9734: see if semop exists
9735set semop d_semop
9736eval $inlibc
9737
9738: see how much of the 'sem*(2)' library is present.
9739h_sem=true
9740echo " "
9741case "$d_semctl$d_semget$d_semop" in
9742*"$undef"*) h_sem=false;;
9743esac
6087ac44
JH
9744case "$osname" in
9745freebsd)
9746 case "`ipcs 2>&1`" in
9747 "SVID messages"*"not configured"*)
5ff3f7a4 9748 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
9749 h_sem=false
9750 val="$undef"
9751 set semctl d_semctl
9752 eval $setvar
9753 set semget d_semget
9754 eval $setvar
9755 set semop d_semop
9756 eval $setvar
9757 ;;
9758 esac
9759 ;;
9760esac
2304df62
AD
9761: we could also check for sys/ipc.h ...
9762if $h_sem && $test `./findhdr sys/sem.h`; then
9763 echo "You have the full sem*(2) library." >&4
9764 val="$define"
9765else
9766 echo "You don't have the full sem*(2) library." >&4
9767 val="$undef"
9768fi
9769set d_sem
9770eval $setvar
9771
bd89102f
AD
9772: see whether sys/sem.h defines union semun
9773echo " "
9774$cat > try.c <<'END'
9775#include <sys/types.h>
9776#include <sys/ipc.h>
9777#include <sys/sem.h>
9778int main () { union semun semun; semun.buf = 0; }
9779END
9780set try
9781if eval $compile; then
9782 echo "You have union semun in <sys/sem.h>." >&4
9783 val="$define"
9784else
9785 echo "You do not have union semun in <sys/sem.h>." >&4
9786 val="$undef"
9787fi
85ab1d1d 9788$rm -f try try.c try.h
bd89102f
AD
9789set d_union_semun
9790eval $setvar
9791
9792: see how to do semctl IPC_STAT
9793case "$d_sem" in
9794$define)
9795 : see whether semctl IPC_STAT can use union semun
9796 echo " "
85ab1d1d
JH
9797 $cat > try.h <<END
9798#ifndef S_IRUSR
9799# ifdef S_IREAD
9800# define S_IRUSR S_IREAD
9801# define S_IWUSR S_IWRITE
9802# define S_IXUSR S_IEXEC
9803# else
9804# define S_IRUSR 0400
9805# define S_IWUSR 0200
9806# define S_IXUSR 0100
9807# endif
9808# define S_IRGRP (S_IRUSR>>3)
9809# define S_IWGRP (S_IWUSR>>3)
9810# define S_IXGRP (S_IXUSR>>3)
9811# define S_IROTH (S_IRUSR>>6)
9812# define S_IWOTH (S_IWUSR>>6)
9813# define S_IXOTH (S_IXUSR>>6)
9814#endif
9815#ifndef S_IRWXU
9816# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9817# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9818# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9819#endif
9820END
9821
bd89102f
AD
9822 $cat > try.c <<END
9823#include <sys/types.h>
9824#include <sys/ipc.h>
9825#include <sys/sem.h>
9826#include <sys/stat.h>
9827#include <stdio.h>
9828#include <errno.h>
85ab1d1d 9829#include "try.h"
bd89102f
AD
9830#ifndef errno
9831extern int errno;
9832#endif
9833#$d_union_semun HAS_UNION_SEMUN
9834int main() {
9835 union semun
9836#ifndef HAS_UNION_SEMUN
9837 {
9838 int val;
9839 struct semid_ds *buf;
9840 unsigned short *array;
9841 }
9842#endif
9843 arg;
9844 int sem, st;
9845
9846#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9847 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9848 if (sem > -1) {
9849 struct semid_ds argbuf;
9850 arg.buf = &argbuf;
9851# ifdef IPC_STAT
9852 st = semctl(sem, 0, IPC_STAT, arg);
9853 if (st == 0)
9854 printf("semun\n");
9855 else
9856# endif /* IPC_STAT */
9857 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9858# ifdef IPC_RMID
9859 if (semctl(sem, 0, IPC_RMID, arg) != 0)
9860# endif /* IPC_RMID */
9861 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9862 } else
9863#endif /* IPC_PRIVATE && ... */
9864 printf("semget failed: errno = %d\n", errno);
9865 return 0;
9866}
9867END
9868 val="$undef"
9869 set try
9870 if eval $compile; then
9871 xxx=`./try`
9872 case "$xxx" in
9873 semun) val="$define" ;;
9874 esac
9875 fi
9876 $rm -f try try.c
9877 set d_semctl_semun
9878 eval $setvar
9879 case "$d_semctl_semun" in
9880 $define)
9881 echo "You can use union semun for semctl IPC_STAT." >&4
9882 also='also'
9883 ;;
9884 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
9885 also=''
9886 ;;
9887 esac
9888
9889 : see whether semctl IPC_STAT can use struct semid_ds pointer
9890 $cat > try.c <<'END'
9891#include <sys/types.h>
9892#include <sys/ipc.h>
9893#include <sys/sem.h>
9894#include <sys/stat.h>
85ab1d1d 9895#include "try.h"
bd89102f
AD
9896#include <stdio.h>
9897#include <errno.h>
9898#ifndef errno
9899extern int errno;
9900#endif
9901int main() {
9902 struct semid_ds arg;
9903 int sem, st;
9904
9905#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9906 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9907 if (sem > -1) {
9908# ifdef IPC_STAT
9909 st = semctl(sem, 0, IPC_STAT, &arg);
9910 if (st == 0)
9911 printf("semid_ds\n");
9912 else
9913# endif /* IPC_STAT */
9914 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9915# ifdef IPC_RMID
9916 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9917# endif /* IPC_RMID */
9918 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9919 } else
9920#endif /* IPC_PRIVATE && ... */
9921 printf("semget failed: errno = %d\n", errno);
9922
9923 return 0;
9924}
9925END
9926 val="$undef"
9927 set try
9928 if eval $compile; then
9929 xxx=`./try`
9930 case "$xxx" in
9931 semid_ds) val="$define" ;;
9932 esac
9933 fi
9934 $rm -f try try.c
9935 set d_semctl_semid_ds
9936 eval $setvar
9937 case "$d_semctl_semid_ds" in
9938 $define)
7f3d1cf1 9939 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 9940 ;;
7f3d1cf1 9941 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
9942 ;;
9943 esac
85ab1d1d 9944 $rm -f try.h
bd89102f
AD
9945 ;;
9946*) val="$undef"
9947
9948 # We do not have the full sem*(2) library, so assume we can not
9949 # use either.
9950
9951 set d_semctl_semun
9952 eval $setvar
9953
9954 set d_semctl_semid_ds
9955 eval $setvar
9956 ;;
9957esac
9958
2304df62
AD
9959: see if setegid exists
9960set setegid d_setegid
9961eval $inlibc
9962
9963: see if seteuid exists
9964set seteuid d_seteuid
9965eval $inlibc
9966
5ff3f7a4
GS
9967: see if setgrent exists
9968set setgrent d_setgrent
9969eval $inlibc
9970
693762b4
AD
9971: see if sethostent exists
9972set sethostent d_sethent
9973eval $inlibc
9974
a0d0e21e
LW
9975: see if setlinebuf exists
9976set setlinebuf d_setlinebuf
9977eval $inlibc
9978
2304df62
AD
9979: see if setlocale exists
9980set setlocale d_setlocale
9981eval $inlibc
a0d0e21e 9982
e5c9fcd0
AD
9983: see if setnetent exists
9984set setnetent d_setnent
9985eval $inlibc
9986
9987: see if setprotoent exists
9988set setprotoent d_setpent
9989eval $inlibc
9990
2304df62
AD
9991: see if setpgid exists
9992set setpgid d_setpgid
9993eval $inlibc
9994
2304df62
AD
9995: see if setpgrp2 exists
9996set setpgrp2 d_setpgrp2
9997eval $inlibc
9998
9999: see if setpriority exists
10000set setpriority d_setprior
10001eval $inlibc
10002
5ff3f7a4
GS
10003: see if setpwent exists
10004set setpwent d_setpwent
10005eval $inlibc
10006
2304df62
AD
10007: see if setregid exists
10008set setregid d_setregid
10009eval $inlibc
10010set setresgid d_setresgid
10011eval $inlibc
10012
10013: see if setreuid exists
10014set setreuid d_setreuid
10015eval $inlibc
10016set setresuid d_setresuid
10017eval $inlibc
10018
10019: see if setrgid exists
10020set setrgid d_setrgid
10021eval $inlibc
10022
10023: see if setruid exists
10024set setruid d_setruid
10025eval $inlibc
10026
e5c9fcd0
AD
10027: see if setservent exists
10028set setservent d_setsent
10029eval $inlibc
10030
2304df62
AD
10031: see if setsid exists
10032set setsid d_setsid
10033eval $inlibc
10034
f1066039
JH
10035: see if setspent exists
10036set setspent d_setspent
10037eval $inlibc
10038
e5c9fcd0
AD
10039: see if setvbuf exists
10040set setvbuf d_setvbuf
10041eval $inlibc
10042
760ac839
LW
10043: see if sfio.h is available
10044set sfio.h i_sfio
10045eval $inhdr
10046
10047
8ff267be 10048: see if sfio library is available
760ac839
LW
10049case "$i_sfio" in
10050$define)
10051 val=''
10052 set sfreserve val
10053 eval $inlibc
10054 ;;
10055*)
10056 val="$undef"
10057 ;;
10058esac
8ff267be 10059: Ok, but do we want to use it.
760ac839
LW
10060case "$val" in
10061$define)
10062 case "$usesfio" in
8ff267be 10063 true|$define|[yY]*) dflt='y';;
760ac839
LW
10064 *) dflt='n';;
10065 esac
8ff267be 10066 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
10067 rp="You seem to have sfio available, do you want to try using it?"
10068 . ./myread
10069 case "$ans" in
8ff267be 10070 y|Y) ;;
10071 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 10072 val="$undef"
ff0cee69 10073 : Remove sfio from list of libraries to use
10074 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10075 shift
10076 libs="$*"
10077 echo "libs = $libs" >&4
760ac839
LW
10078 ;;
10079 esac
10080 ;;
8ff267be 10081*) case "$usesfio" in
10082 true|$define|[yY]*)
10083 echo "Sorry, cannot find sfio on this machine" >&4
10084 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
10085 ;;
10086 esac
10087 ;;
10088esac
8ff267be 10089set d_sfio
10090eval $setvar
760ac839
LW
10091case "$d_sfio" in
10092$define) usesfio='true';;
10093*) usesfio='false';;
10094esac
10095
2304df62
AD
10096: see if shmctl exists
10097set shmctl d_shmctl
10098eval $inlibc
10099
10100: see if shmget exists
10101set shmget d_shmget
10102eval $inlibc
10103
a0d0e21e
LW
10104: see if shmat exists
10105set shmat d_shmat
10106eval $inlibc
10107: see what shmat returns
10108case "$d_shmat" in
10109"$define")
10110 $cat >shmat.c <<'END'
10111#include <sys/shm.h>
10112void *shmat();
10113END
10114 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10115 shmattype='void *'
10116 else
10117 shmattype='char *'
10118 fi
10119 echo "and it returns ($shmattype)." >&4
10120 : see if a prototype for shmat is available
e50aee73
AD
10121 xxx=`./findhdr sys/shm.h`
10122 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
10123 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10124 val="$define"
10125 else
10126 val="$undef"
10127 fi
10128 $rm -f shmat.[co]
10129 ;;
10130*)
10131 val="$undef"
10132 ;;
10133esac
10134set d_shmatprototype
10135eval $setvar
10136
10137: see if shmdt exists
10138set shmdt d_shmdt
10139eval $inlibc
10140
10141: see how much of the 'shm*(2)' library is present.
10142h_shm=true
10143echo " "
10144case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10145*"$undef"*) h_shm=false;;
10146esac
6087ac44
JH
10147case "$osname" in
10148freebsd)
10149 case "`ipcs 2>&1`" in
10150 "SVID shared memory"*"not configured"*)
5ff3f7a4 10151 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
10152 h_shm=false
10153 val="$undef"
10154 set shmctl d_shmctl
10155 evat $setvar
10156 set shmget d_shmget
10157 evat $setvar
10158 set shmat d_shmat
10159 evat $setvar
10160 set shmdt d_shmdt
10161 evat $setvar
10162 ;;
10163 esac
10164 ;;
10165esac
a0d0e21e
LW
10166: we could also check for sys/ipc.h ...
10167if $h_shm && $test `./findhdr sys/shm.h`; then
10168 echo "You have the full shm*(2) library." >&4
10169 val="$define"
10170else
10171 echo "You don't have the full shm*(2) library." >&4
10172 val="$undef"
10173fi
10174set d_shm
10175eval $setvar
10176
2c7991dc 10177echo " "
8ff267be 10178: see if we have sigaction
10179if set sigaction val -f d_sigaction; eval $csym; $val; then
10180 echo 'sigaction() found.' >&4
dc45a647 10181 $cat > try.c <<'EOP'
8ff267be 10182#include <stdio.h>
10183#include <sys/types.h>
10184#include <signal.h>
d674cd6d 10185int main()
8ff267be 10186{
10187 struct sigaction act, oact;
190b66db 10188 act.sa_flags = 0;
48159a0c 10189 oact.sa_handler = 0;
8ff267be 10190}
10191EOP
dc45a647
MB
10192 set try
10193 if eval $compile_ok; then
10194 val="$define"
10195 else
10196 echo "But you don't seem to have a useable struct sigaction." >&4
10197 val="$undef"
10198 fi
8ff267be 10199else
dc45a647 10200 echo 'sigaction NOT found.' >&4
8ff267be 10201 val="$undef"
10202fi
10203set d_sigaction; eval $setvar
dfe9444c 10204$rm -f try try$_o try.c
2c7991dc 10205
a5f75d66
AD
10206: see if sigsetjmp exists
10207echo " "
921b2963
JH
10208case "$d_sigsetjmp" in
10209'')
10210 $cat >try.c <<'EOP'
10211#include <setjmp.h>
10212sigjmp_buf env;
10213int set = 1;
d674cd6d 10214int main()
921b2963
JH
10215{
10216 if (sigsetjmp(env,1))
10217 exit(set);
10218 set = 0;
10219 siglongjmp(env, 1);
10220 exit(1);
10221}
10222EOP
10223 set try
10224 if eval $compile; then
10225 if ./try >/dev/null 2>&1; then
10226 echo "POSIX sigsetjmp found." >&4
10227 val="$define"
10228 else
10229 $cat >&4 <<EOM
10230Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10231I'll ignore them.
10232EOM
10233 val="$undef"
a0d0e21e 10234 fi
921b2963
JH
10235 else
10236 echo "sigsetjmp not found." >&4
10237 val="$undef"
a0d0e21e 10238 fi
921b2963
JH
10239 ;;
10240*) val="$d_sigsetjmp"
10241 case "$d_sigsetjmp" in
10242 $define) echo "POSIX sigsetjmp found." >&4;;
10243 $undef) echo "sigsetjmp not found." >&4;;
10244 esac
10245 ;;
10246esac
10247set d_sigsetjmp
10248eval $setvar
10249$rm -f try.c try
2304df62 10250
d9b3e12d
JH
10251: see if sys/stat.h is available
10252set sys/stat.h i_sysstat
10253eval $inhdr
10254
2304df62
AD
10255: see if stat knows about block sizes
10256echo " "
5ff3f7a4
GS
10257set d_statblks stat st_blocks $i_sysstat sys/stat.h
10258eval $hasfield
2304df62 10259
16d20bd9
AD
10260: see if _ptr and _cnt from stdio act std
10261echo " "
dca663ed 10262if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
10263 echo "(Looks like you have stdio.h from Linux.)"
10264 case "$stdio_ptr" in
c2960299
AD
10265 '') stdio_ptr='((fp)->_IO_read_ptr)'
10266 ptr_lval=$define
10267 ;;
8e07c86e 10268 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10269 esac
10270 case "$stdio_cnt" in
c2960299
AD
10271 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10272 cnt_lval=$undef
10273 ;;
8e07c86e 10274 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10275 esac
10276 case "$stdio_base" in
10277 '') stdio_base='((fp)->_IO_read_base)';;
10278 esac
10279 case "$stdio_bufsiz" in
c2960299 10280 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
10281 esac
10282else
10283 case "$stdio_ptr" in
c2960299
AD
10284 '') stdio_ptr='((fp)->_ptr)'
10285 ptr_lval=$define
10286 ;;
8e07c86e 10287 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
10288 esac
10289 case "$stdio_cnt" in
c2960299
AD
10290 '') stdio_cnt='((fp)->_cnt)'
10291 cnt_lval=$define
10292 ;;
8e07c86e 10293 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
10294 esac
10295 case "$stdio_base" in
10296 '') stdio_base='((fp)->_base)';;
10297 esac
10298 case "$stdio_bufsiz" in
10299 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10300 esac
10301fi
10302: test whether _ptr and _cnt really work
10303echo "Checking how std your stdio is..." >&4
10304$cat >try.c <<EOP
10305#include <stdio.h>
10306#define FILE_ptr(fp) $stdio_ptr
10307#define FILE_cnt(fp) $stdio_cnt
d674cd6d 10308int main() {
16d20bd9
AD
10309 FILE *fp = fopen("try.c", "r");
10310 char c = getc(fp);
10311 if (
10312 18 <= FILE_cnt(fp) &&
10313 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10314 )
10315 exit(0);
10316 exit(1);
10317}
10318EOP
10319val="$undef"
dfe9444c
AD
10320set try
10321if eval $compile; then
16d20bd9
AD
10322 if ./try; then
10323 echo "Your stdio acts pretty std."
10324 val="$define"
10325 else
10326 echo "Your stdio isn't very std."
10327 fi
10328else
10329 echo "Your stdio doesn't appear very std."
10330fi
10331$rm -f try.c try
10332set d_stdstdio
10333eval $setvar
10334
8e07c86e 10335: Can _ptr be used as an lvalue?
e50aee73
AD
10336case "$d_stdstdio$ptr_lval" in
10337$define$define) val=$define ;;
c2960299
AD
10338*) val=$undef ;;
10339esac
10340set d_stdio_ptr_lval
10341eval $setvar
10342
8e07c86e 10343: Can _cnt be used as an lvalue?
e50aee73
AD
10344case "$d_stdstdio$cnt_lval" in
10345$define$define) val=$define ;;
c2960299
AD
10346*) val=$undef ;;
10347esac
10348set d_stdio_cnt_lval
10349eval $setvar
10350
16d20bd9
AD
10351: see if _base is also standard
10352val="$undef"
10353case "$d_stdstdio" in
10354$define)
10355 $cat >try.c <<EOP
10356#include <stdio.h>
10357#define FILE_base(fp) $stdio_base
10358#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 10359int main() {
16d20bd9
AD
10360 FILE *fp = fopen("try.c", "r");
10361 char c = getc(fp);
10362 if (
10363 19 <= FILE_bufsiz(fp) &&
10364 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10365 )
10366 exit(0);
10367 exit(1);
10368}
10369EOP
dfe9444c
AD
10370 set try
10371 if eval $compile; then
16d20bd9 10372 if ./try; then
8ff267be 10373 echo "And its _base field acts std."
16d20bd9
AD
10374 val="$define"
10375 else
10376 echo "But its _base field isn't std."
10377 fi
10378 else
10379 echo "However, it seems to be lacking the _base field."
10380 fi
10381 $rm -f try.c try
10382 ;;
10383esac
10384set d_stdiobase
10385eval $setvar
10386
ed39a0f2
JH
10387$cat >&4 <<EOM
10388Checking how to access stdio streams by file descriptor number...
10389EOM
10390case "$stdio_stream_array" in
10391'') $cat >try.c <<EOCP
10392#include <stdio.h>
10393int main() {
10394 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10395 printf("yes\n");
10396}
10397EOCP
10398 for s in _iob __iob __sF
10399 do
10400 set try -DSTDIO_STREAM_ARRAY=$s
10401 if eval $compile; then
10402 case "`./try$exe_ext`" in
10403 yes) stdio_stream_array=$s; break ;;
10404 esac
10405 fi
10406 done
10407 $rm -f try.* try$exe_ext
10408esac
10409case "$stdio_stream_array" in
10410'') $cat >&4 <<EOM
10411I can't figure out how to access stdio streams by file descriptor number.
10412EOM
10413 d_stdio_stream_array="$undef"
10414 ;;
10415*) $cat >&4 <<EOM
10416You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10417EOM
10418 d_stdio_stream_array="$define"
10419 ;;
10420esac
10421
a0d0e21e
LW
10422: see if strcoll exists
10423set strcoll d_strcoll
10424eval $inlibc
2304df62
AD
10425
10426: check for structure copying
10427echo " "
10428echo "Checking to see if your C compiler can copy structs..." >&4
10429$cat >try.c <<'EOCP'
5a411a32 10430int main()
2304df62
AD
10431{
10432 struct blurfl {
10433 int dyick;
10434 } foo, bar;
10435
10436 foo = bar;
10437}
10438EOCP
10439if $cc -c try.c >/dev/null 2>&1 ; then
10440 val="$define"
10441 echo "Yup, it can."
10442else
10443 val="$undef"
10444 echo "Nope, it can't."
10445fi
10446set d_strctcpy
10447eval $setvar
10448$rm -f try.*
10449
10450: see if strerror and/or sys_errlist[] exist
10451echo " "
28e8609d
JH
10452if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10453 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
10454 echo 'strerror() found.' >&4
10455 d_strerror="$define"
10456 d_strerrm='strerror(e)'
10457 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10458 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
10459 d_syserrlst="$define"
10460 else
10461 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10462 d_syserrlst="$undef"
10463 fi
28e8609d 10464 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
10465 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10466 echo 'strerror() found in string header.' >&4
10467 d_strerror="$define"
10468 d_strerrm='strerror(e)'
10469 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10470 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10471 d_syserrlst="$define"
10472 else
10473 echo "(You don't appear to have any sys_errlist[], how can this be?)"
10474 d_syserrlst="$undef"
10475 fi
28e8609d 10476 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
10477 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10478 d_strerror="$undef"
10479 d_syserrlst="$define"
10480 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 10481 else
5ff3f7a4
GS
10482 echo 'strerror() and sys_errlist[] NOT found.' >&4
10483 d_strerror="$undef"
10484 d_syserrlst="$undef"
10485 d_strerrm='"unknown"'
28e8609d 10486 fi
2304df62
AD
10487fi
10488
a89d8a78
DH
10489: see if strtod exists
10490set strtod d_strtod
10491eval $inlibc
10492
10493: see if strtol exists
10494set strtol d_strtol
10495eval $inlibc
10496
10497: see if strtoul exists
10498set strtoul d_strtoul
10499eval $inlibc
10500
cf2093f6
JH
10501: see if strtoull exists
10502set strtoull d_strtoull
10503eval $inlibc
10504
a0d0e21e
LW
10505: see if strxfrm exists
10506set strxfrm d_strxfrm
10507eval $inlibc
10508
2304df62
AD
10509: see if symlink exists
10510set symlink d_symlink
10511eval $inlibc
10512
10513: see if syscall exists
10514set syscall d_syscall
10515eval $inlibc
10516
a0d0e21e
LW
10517: see if sysconf exists
10518set sysconf d_sysconf
10519eval $inlibc
10520
2304df62
AD
10521: see if system exists
10522set system d_system
10523eval $inlibc
10524
a0d0e21e
LW
10525: see if tcgetpgrp exists
10526set tcgetpgrp d_tcgetpgrp
10527eval $inlibc
10528
2c7991dc 10529: see if tcsetpgrp exists
10530set tcsetpgrp d_tcsetpgrp
10531eval $inlibc
4633a7c4 10532
cb86ce0e
JH
10533: see if sys/types.h has to be included
10534set sys/types.h i_systypes
10535eval $inhdr
10536
10537: see if prototype for telldir is available
10538echo " "
10539set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10540eval $hasproto
10541
2c7991dc 10542: define an is-a-typedef? function
10543typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10544case "$inclist" in
10545"") inclist="sys/types.h";;
10546esac;
10547eval "varval=\$$var";
10548case "$varval" in
10549"")
10550 $rm -f temp.c;
10551 for inc in $inclist; do
10552 echo "#include <$inc>" >>temp.c;
10553 done;
c4f23d77
AD
10554 echo "#ifdef $type" >> temp.c;
10555 echo "printf(\"We have $type\");" >> temp.c;
10556 echo "#endif" >> temp.c;
2c7991dc 10557 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10558 if $contains $type temp.E >/dev/null 2>&1; then
10559 eval "$var=\$type";
10560 else
10561 eval "$var=\$def";
10562 fi;
10563 $rm -f temp.?;;
10564*) eval "$var=\$varval";;
10565esac'
4633a7c4 10566
dc45a647
MB
10567: define an is-a-typedef? function that prompts if the type is not available.
10568typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10569case "$inclist" in
10570"") inclist="sys/types.h";;
10571esac;
10572eval "varval=\$$var";
10573case "$varval" in
10574"")
10575 $rm -f temp.c;
10576 for inc in $inclist; do
10577 echo "#include <$inc>" >>temp.c;
10578 done;
c4f23d77
AD
10579 echo "#ifdef $type" >> temp.c;
10580 echo "printf(\"We have $type\");" >> temp.c;
10581 echo "#endif" >> temp.c;
dc45a647
MB
10582 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10583 echo " " ;
10584 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10585 if $contains $type temp.E >/dev/null 2>&1; then
10586 echo "$type found." >&4;
10587 eval "$var=\$type";
10588 else
10589 echo "$type NOT found." >&4;
10590 dflt="$def";
10591 . ./myread ;
10592 eval "$var=\$ans";
10593 fi;
10594 $rm -f temp.?;;
10595*) eval "$var=\$varval";;
10596esac'
10597
2c7991dc 10598: see if this is a sys/times.h system
10599set sys/times.h i_systimes
10600eval $inhdr
4633a7c4 10601
2c7991dc 10602: see if times exists
4633a7c4 10603echo " "
2c7991dc 10604if set times val -f d_times; eval $csym; $val; then
10605 echo 'times() found.' >&4
10606 d_times="$define"
10607 inc=''
10608 case "$i_systimes" in
10609 "$define") inc='sys/times.h';;
10610 esac
dc45a647 10611 rp="What is the type returned by times() on this system?"
2c7991dc 10612 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 10613 eval $typedef_ask
2c7991dc 10614else
10615 echo 'times() NOT found, hope that will do.' >&4
10616 d_times="$undef"
10617 clocktype='int'
10618fi
2304df62 10619
2c7991dc 10620: see if truncate exists
10621set truncate d_truncate
10622eval $inlibc
2304df62 10623
2c7991dc 10624: see if tzname[] exists
10625echo " "
10626if set tzname val -a d_tzname; eval $csym; $val; then
10627 val="$define"
10628 echo 'tzname[] found.' >&4
10629else
10630 val="$undef"
10631 echo 'tzname[] NOT found.' >&4
10632fi
10633set d_tzname
10634eval $setvar
10635
10636: see if umask exists
10637set umask d_umask
10638eval $inlibc
85e6fe83 10639
4633a7c4
LW
10640: backward compatibility for d_hvfork
10641if test X$d_hvfork != X; then
10642 d_vfork="$d_hvfork"
10643 d_hvfork=''
10644fi
10645: see if there is a vfork
10646val=''
10647set vfork val
10648eval $inlibc
ecfc5424 10649
4633a7c4
LW
10650: Ok, but do we want to use it. vfork is reportedly unreliable in
10651: perl on Solaris 2.x, and probably elsewhere.
10652case "$val" in
10653$define)
16d20bd9 10654 echo " "
4633a7c4
LW
10655 case "$usevfork" in
10656 false) dflt='n';;
10657 *) dflt='y';;
10658 esac
f10488a3
JH
10659 cat <<'EOM'
10660
10661Perl can only use a vfork() that doesn't suffer from strict
10662restrictions on calling functions or modifying global data in
10663the child. For example, glibc-2.1 contains such a vfork()
10664that is unsuitable. If your system provides a proper fork()
10665call, chances are that you do NOT want perl to use vfork().
10666
10667EOM
10668 rp="Do you still want to use vfork()?"
4633a7c4
LW
10669 . ./myread
10670 case "$ans" in
10671 y|Y) ;;
10672 *)
10673 echo "Ok, we won't use vfork()."
10674 val="$undef"
10675 ;;
10676 esac
ecfc5424
AD
10677 ;;
10678esac
4633a7c4
LW
10679set d_vfork
10680eval $setvar
10681case "$d_vfork" in
10682$define) usevfork='true';;
10683*) usevfork='false';;
10684esac
ecfc5424 10685
4633a7c4
LW
10686: see if this is an sysdir system
10687set sys/dir.h i_sysdir
10688eval $inhdr
10689
10690: see if this is an sysndir system
10691set sys/ndir.h i_sysndir
10692eval $inhdr
10693
10694: see if closedir exists
10695set closedir d_closedir
10696eval $inlibc
10697
10698case "$d_closedir" in
10699"$define")
16d20bd9 10700 echo " "
4633a7c4
LW
10701 echo "Checking whether closedir() returns a status..." >&4
10702 cat > closedir.c <<EOM
10703#$i_dirent I_DIRENT /**/
10704#$i_sysdir I_SYS_DIR /**/
10705#$i_sysndir I_SYS_NDIR /**/
bfb7748a 10706#$i_systypes I_SYS_TYPES /**/
4633a7c4 10707
bfb7748a
AD
10708#if defined(I_SYS_TYPES)
10709#include <sys/types.h>
10710#endif
4633a7c4
LW
10711#if defined(I_DIRENT)
10712#include <dirent.h>
10713#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10714#include <sys/dir.h>
4aa0a1f7 10715#endif
4633a7c4
LW
10716#else
10717#ifdef I_SYS_NDIR
10718#include <sys/ndir.h>
10719#else
10720#ifdef I_SYS_DIR
10721#ifdef hp9000s500
10722#include <ndir.h> /* may be wrong in the future */
10723#else
10724#include <sys/dir.h>
10725#endif
10726#endif
10727#endif
10728#endif
10729int main() { return closedir(opendir(".")); }
10730EOM
dfe9444c 10731 set closedir
dc45a647 10732 if eval $compile_ok; then
4633a7c4
LW
10733 if ./closedir > /dev/null 2>&1 ; then
10734 echo "Yes, it does."
10735 val="$undef"
ecfc5424 10736 else
4633a7c4
LW
10737 echo "No, it doesn't."
10738 val="$define"
ecfc5424
AD
10739 fi
10740 else
4633a7c4
LW
10741 echo "(I can't seem to compile the test program--assuming it doesn't)"
10742 val="$define"
ecfc5424 10743 fi
ecfc5424 10744 ;;
4633a7c4
LW
10745*)
10746 val="$undef";
ecfc5424
AD
10747 ;;
10748esac
4633a7c4
LW
10749set d_void_closedir
10750eval $setvar
10751$rm -f closedir*
10752: check for volatile keyword
ecfc5424 10753echo " "
4633a7c4
LW
10754echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10755$cat >try.c <<'EOCP'
5a411a32 10756int main()
4633a7c4
LW
10757{
10758 typedef struct _goo_struct goo_struct;
10759 goo_struct * volatile goo = ((goo_struct *)0);
10760 struct _goo_struct {
10761 long long_int;
10762 int reg_int;
10763 char char_var;
10764 };
10765 typedef unsigned short foo_t;
10766 char *volatile foo;
10767 volatile int bar;
10768 volatile foo_t blech;
10769 foo = foo;
a0d0e21e
LW
10770}
10771EOCP
4633a7c4
LW
10772if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10773 val="$define"
10774 echo "Yup, it does."
10775else
10776 val="$undef"
10777 echo "Nope, it doesn't."
10778fi
10779set d_volatile
10780eval $setvar
10781$rm -f try.*
a0d0e21e 10782
4633a7c4
LW
10783: see if there is a wait4
10784set wait4 d_wait4
8e07c86e
AD
10785eval $inlibc
10786
4633a7c4
LW
10787: see if waitpid exists
10788set waitpid d_waitpid
10789eval $inlibc
10790
10791: see if wcstombs exists
10792set wcstombs d_wcstombs
10793eval $inlibc
10794
10795: see if wctomb exists
10796set wctomb d_wctomb
10797eval $inlibc
10798
de4597cb
JH
10799: see if writev exists
10800set writev d_writev
10801eval $inlibc
10802
4633a7c4
LW
10803: preserve RCS keywords in files with variable substitution, grrr
10804Date='$Date'
10805Id='$Id'
10806Log='$Log'
10807RCSfile='$RCSfile'
10808Revision='$Revision'
10809
ca8cfa54
JH
10810case "$crosscompile" in
10811''|[nN]*) crosscompile="$undef" ;;
10812esac
10813
10814case "$osname" in
8f1f23e8 10815next|rhapsody) multiarch="$define" ;;
ca8cfa54
JH
10816esac
10817case "$multiarch" in
10818''|[nN]*) multiarch="$undef" ;;
10819esac
10820
4633a7c4
LW
10821: check for alignment requirements
10822echo " "
68c15b6f
HM
10823case "$crosscompile$multiarch" in
10824*$define*)
ca8cfa54
JH
10825 $cat <<EOM
10826You seem to be either cross-compiling or doing a multiarchitecture build,
10827skipping the memory alignment check.
68c15b6f
HM
10828
10829EOM
10830 case "$alignbytes" in
10831 '') alignbytes=8 ;;
10832 esac
10833 ;;
10834*)
10835 case "$alignbytes" in
10836 '') echo "Checking alignment constraints..." >&4
10837 $cat >try.c <<'EOCP'
4633a7c4
LW
10838struct foobar {
10839 char foo;
10840 double bar;
732c9516 10841} try_algn;
d674cd6d 10842int main()
4633a7c4 10843{
732c9516 10844 printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
4633a7c4
LW
10845}
10846EOCP
68c15b6f
HM
10847 set try
10848 if eval $compile_ok; then
10849 dflt=`./try`
10850 else
10851 dflt='8'
10852 echo "(I can't seem to compile the test program...)"
10853 fi
10854 ;;
10855 *) dflt="$alignbytes"
10856 ;;
10857 esac
10858 rp="Doubles must be aligned on a how-many-byte boundary?"
10859 . ./myread
10860 alignbytes="$ans"
10861 $rm -f try.c try
8e07c86e 10862 ;;
ecfc5424 10863esac
68c15b6f 10864
85e6fe83 10865
4633a7c4 10866: check for ordering of bytes in a long
68c15b6f
HM
10867echo " "
10868case "$crosscompile$multiarch" in
10869*$define*)
10870 $cat <<EOM
ca8cfa54
JH
10871You seem to be either cross-compiling or doing a multiarchitecture build,
10872skipping the byteorder check.
68c15b6f
HM
10873
10874EOM
d9b3e12d 10875 byteorder='0xffff'
68c15b6f
HM
10876 ;;
10877*)
10878 case "$byteorder" in
10879 '')
10880 $cat <<'EOM'
4633a7c4
LW
10881In the following, larger digits indicate more significance. A big-endian
10882machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10883little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
d9b3e12d
JH
10884machines may have weird orders like 3412. A Cray will report 87654321,
10885an Alpha will report 12345678. If the test program works the default is
10886probably right.
4633a7c4
LW
10887I'm now running the test program...
10888EOM
68c15b6f 10889 $cat >try.c <<'EOCP'
4633a7c4 10890#include <stdio.h>
d674cd6d 10891int main()
4633a7c4
LW
10892{
10893 int i;
10894 union {
10895 unsigned long l;
10896 char c[sizeof(long)];
10897 } u;
10898
10899 if (sizeof(long) > 4)
10900 u.l = (0x08070605L << 32) | 0x04030201L;
10901 else
10902 u.l = 0x04030201L;
10903 for (i = 0; i < sizeof(long); i++)
10904 printf("%c", u.c[i]+'0');
10905 printf("\n");
10906 exit(0);
10907}
10908EOCP
68c15b6f
HM
10909 xxx_prompt=y
10910 set try
10911 if eval $compile && ./try > /dev/null; then
10912 dflt=`./try`
10913 case "$dflt" in
10914 [1-4][1-4][1-4][1-4]|12345678|87654321)
10915 echo "(The test program ran ok.)"
10916 echo "byteorder=$dflt"
10917 xxx_prompt=n
4633a7c4 10918 ;;
68c15b6f
HM
10919 ????|????????) echo "(The test program ran ok.)" ;;
10920 *) echo "(The test program didn't run right for some reason.)" ;;
10921 esac
10922 else
10923 dflt='4321'
10924 cat <<'EOM'
4633a7c4
LW
10925(I can't seem to compile the test program. Guessing big-endian...)
10926EOM
68c15b6f
HM
10927 fi
10928 case "$xxx_prompt" in
10929 y)
10930 rp="What is the order of bytes in a long?"
10931 . ./myread
10932 byteorder="$ans"
10933 ;;
10934 *) byteorder=$dflt
10935 ;;
10936 esac
ecfc5424
AD
10937 ;;
10938 esac
68c15b6f 10939 $rm -f try.c try
ecfc5424
AD
10940 ;;
10941esac
68c15b6f 10942
85e6fe83 10943
4633a7c4 10944: how do we catenate cpp tokens here?
2304df62 10945echo " "
4633a7c4
LW
10946echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10947$cat >cpp_stuff.c <<'EOCP'
10948#define RCAT(a,b)a/**/b
10949#define ACAT(a,b)a ## b
10950RCAT(Rei,ser)
10951ACAT(Cir,cus)
10952EOCP
10953$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10954if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10955 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
10956 echo "We can catify or stringify, separately or together!"
10957 cpp_stuff=42
10958elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10959 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
10960 echo "However, in the good old days we don't know how to stringify and"
10961 echo "catify at the same time."
10962 cpp_stuff=1
10963else
10964 $cat >&4 <<EOM
10965Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
10966to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 10967EOM
4633a7c4
LW
10968 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10969fi
10970$rm -f cpp_stuff.*
a0d0e21e 10971
4633a7c4
LW
10972: see if this is a db.h system
10973set db.h i_db
10974eval $inhdr
10975
10976case "$i_db" in
68dc0745 10977$define)
1f70e1ea 10978 : Check db version.
68dc0745 10979 echo " "
10980 echo "Checking Berkeley DB version ..." >&4
10981 $cat >try.c <<EOCP
10982#$d_const HASCONST
10983#ifndef HASCONST
10984#define const
10985#endif
10986#include <sys/types.h>
10987#include <stdio.h>
10988#include <db.h>
d674cd6d 10989int main()
68dc0745 10990{
1f70e1ea
PM
10991#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10992 int Major, Minor, Patch ;
ee02776e 10993 unsigned long Version ;
1f70e1ea
PM
10994 (void)db_version(&Major, &Minor, &Patch) ;
10995 printf("You have Berkeley DB Version 2 or greater\n");
10996
10997 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10998 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10999 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11000 Major, Minor, Patch) ;
11001
11002 /* check that db.h & libdb are compatible */
11003 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11004 printf("db.h and libdb are incompatible\n") ;
11005 exit(3);
11006 }
11007
11008 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
11009
11010 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 11011 + DB_VERSION_PATCH ;
ee02776e
PM
11012
11013 /* needs to be >= 2.3.4 */
11014 if (Version < 2003004) {
693762b4 11015 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 11016 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
11017 exit(2);
11018 }
11019
11020 exit(0);
68dc0745 11021#else
6a1b87e5 11022#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 11023 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
11024 exit(0); /* DB version < 2: the coast is clear. */
11025#else
11026 exit(1); /* <db.h> not Berkeley DB? */
11027#endif
68dc0745 11028#endif
11029}
11030EOCP
dfe9444c
AD
11031 set try
11032 if eval $compile && ./try; then
1f70e1ea 11033 echo 'Looks OK.' >&4
68dc0745 11034 else
c90c0ff4 11035 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 11036 i_db=$undef
11037 case " $libs " in
11038 *"-ldb "*)
11039 : Remove db from list of libraries to use
11040 echo "Removing unusable -ldb from library list" >&4
11041 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11042 shift
11043 libs="$*"
11044 echo "libs = $libs" >&4
11045 ;;
11046 esac
11047 fi
11048 $rm -f try.*
11049 ;;
11050esac
11051
11052case "$i_db" in
4633a7c4 11053define)
dc45a647
MB
11054 : Check the return type needed for hash
11055 echo " "
11056 echo "Checking return type needed for hash for Berkeley DB ..." >&4
11057 $cat >try.c <<EOCP
11058#$d_const HASCONST
11059#ifndef HASCONST
11060#define const
11061#endif
11062#include <sys/types.h>
11063#include <db.h>
11064
11065#ifndef DB_VERSION_MAJOR
11066u_int32_t hash_cb (ptr, size)
11067const void *ptr;
11068size_t size;
11069{
11070}
11071HASHINFO info;
d674cd6d 11072int main()
dc45a647
MB
11073{
11074 info.hash = hash_cb;
11075}
11076#endif
11077EOCP
11078 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11079 if $contains warning try.out >>/dev/null 2>&1 ; then
11080 db_hashtype='int'
11081 else
11082 db_hashtype='u_int32_t'
11083 fi
11084 else
11085 : XXX Maybe we should just give up here.
11086 db_hashtype=u_int32_t
11087 $cat try.out >&4
11088 echo "Help: I can't seem to compile the db test program." >&4
11089 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11090 fi
11091 $rm -f try.*
11092 echo "Your version of Berkeley DB uses $db_hashtype for hash."
11093 ;;
11094*) db_hashtype=u_int32_t
11095 ;;
11096esac
11097case "$i_db" in
11098define)
4633a7c4
LW
11099 : Check the return type needed for prefix
11100 echo " "
11101 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11102 cat >try.c <<EOCP
11103#$d_const HASCONST
11104#ifndef HASCONST
11105#define const
11106#endif
11107#include <sys/types.h>
11108#include <db.h>
1f70e1ea
PM
11109
11110#ifndef DB_VERSION_MAJOR
4633a7c4
LW
11111size_t prefix_cb (key1, key2)
11112const DBT *key1;
11113const DBT *key2;
11114{
11115}
11116BTREEINFO info;
d674cd6d 11117int main()
4633a7c4
LW
11118{
11119 info.prefix = prefix_cb;
11120}
1f70e1ea 11121#endif
4633a7c4
LW
11122EOCP
11123 if $cc $ccflags -c try.c >try.out 2>&1 ; then
11124 if $contains warning try.out >>/dev/null 2>&1 ; then
11125 db_prefixtype='int'
11126 else
11127 db_prefixtype='size_t'
11128 fi
11129 else
68dc0745 11130 db_prefixtype='size_t'
11131 : XXX Maybe we should just give up here.
dc45a647 11132 $cat try.out >&4
68dc0745 11133 echo "Help: I can't seem to compile the db test program." >&4
11134 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
11135 fi
11136 $rm -f try.*
11137 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 11138 ;;
68dc0745 11139*) db_prefixtype='size_t'
4633a7c4
LW
11140 ;;
11141esac
a0d0e21e 11142
4633a7c4
LW
11143: check for void type
11144echo " "
11145echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
11146case "$voidflags" in
11147'')
11148 $cat >try.c <<'EOCP'
11149#if TRY & 1
760ac839 11150void sub() {
4633a7c4 11151#else
760ac839 11152sub() {
4633a7c4
LW
11153#endif
11154 extern void moo(); /* function returning void */
11155 void (*goo)(); /* ptr to func returning void */
11156#if TRY & 8
11157 void *hue; /* generic ptr */
11158#endif
11159#if TRY & 2
11160 void (*foo[10])();
11161#endif
a0d0e21e 11162
4633a7c4
LW
11163#if TRY & 4
11164 if(goo == moo) {
11165 exit(0);
11166 }
11167#endif
11168 exit(0);
11169}
d674cd6d 11170int main() { sub(); }
4633a7c4 11171EOCP
760ac839 11172 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 11173 voidflags=$defvoidused
bfb7748a 11174 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
11175 if $contains warning .out >/dev/null 2>&1; then
11176 echo "However, you might get some warnings that look like this:"
11177 $cat .out
11178 fi
11179 else
11180echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 11181 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 11182 echo "It supports 1..."
760ac839 11183 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 11184 echo "It also supports 2..."
760ac839 11185 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
11186 voidflags=7
11187 echo "And it supports 4 but not 8 definitely."
11188 else
11189 echo "It doesn't support 4..."
760ac839 11190 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
11191 voidflags=11
11192 echo "But it supports 8."
11193 else
11194 voidflags=3
11195 echo "Neither does it support 8."
11196 fi
11197 fi
11198 else
11199 echo "It does not support 2..."
760ac839 11200 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
11201 voidflags=13
11202 echo "But it supports 4 and 8."
11203 else
760ac839 11204 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
11205 voidflags=5
11206 echo "And it supports 4 but has not heard about 8."
11207 else
11208 echo "However it supports 8 but not 4."
11209 fi
11210 fi
11211 fi
11212 else
11213 echo "There is no support at all for void."
11214 voidflags=0
11215 fi
11216 fi
11217esac
4633a7c4 11218case "$voidflags" in
2c7991dc 11219"$defvoidused") ;;
bfb7748a
AD
11220*) $cat >&4 <<'EOM'
11221 Support flag bits are:
11222 1: basic void declarations.
11223 2: arrays of pointers to functions returning void.
11224 4: operations between pointers to and addresses of void functions.
11225 8: generic void pointers.
11226EOM
2c7991dc 11227 dflt="$voidflags";
4633a7c4 11228 rp="Your void support flags add up to what?"
a0d0e21e 11229 . ./myread
4633a7c4 11230 voidflags="$ans"
a0d0e21e
LW
11231 ;;
11232esac
4633a7c4 11233$rm -f try.* .out
a0d0e21e 11234
85ab1d1d
JH
11235
11236: How can we generate normalized random numbers ?
693762b4 11237echo " "
de4597cb 11238echo "Looking for a random number function..." >&4
85ab1d1d 11239case "$randfunc" in
693762b4 11240'')
85ab1d1d
JH
11241 if set drand48 val -f; eval $csym; $val; then
11242 dflt="drand48"
11243 echo "Good, found drand48()." >&4
11244 elif set random val -f; eval $csym; $val; then
11245 dflt="random"
11246 echo "OK, found random()." >&4
11247 else
11248 dflt="rand"
11249 echo "Yick, looks like I have to use rand()." >&4
11250 fi
11251 echo " "
11252 ;;
11253*)
11254 dflt="$randfunc"
11255 ;;
11256esac
11257cont=true
11258
11259case "$ccflags" in
11260*-Dmy_rand=*|*-Dmy_srand=*)
11261 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11262 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11263 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11264 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11265 ;;
11266esac
11267
11268while $test "$cont"; do
11269 rp="Use which function to generate random numbers?"
11270 . ./myread
11271 if $test "$ans" = "$dflt"; then
11272 : null
11273 else
11274 randbits=''
11275 fi
11276 randfunc="$ans"
11277 if set $ans val -f; eval $csym; $val; then
11278 cont=''
11279 else
ef4af2be
JH
11280 dflt=y
11281 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
11282 . ./myread
11283 dflt=rand
11284 case "$ans" in
11285 [yY]*) cont='';;
11286 esac
11287 fi
11288 case "$cont" in
11289 '')
11290 case "$randfunc" in
11291 drand48)
11292 drand01="drand48()"
11293 seedfunc="srand48"
11294 randbits=48
11295 randseedtype=long
11296 ;;
11297 rand|random)
11298 case "$randbits" in
11299 '')
11300echo "Checking to see how many bits your $randfunc() function produces..." >&4
11301 $cat >try.c <<EOCP
11302#$i_unistd I_UNISTD
11303#$i_stdlib I_STDLIB
693762b4 11304#include <stdio.h>
85ab1d1d
JH
11305#ifdef I_UNISTD
11306# include <unistd.h>
11307#endif
11308#ifdef I_STDLIB
11309# include <stdlib.h>
11310#endif
d674cd6d 11311int main()
693762b4 11312{
85ab1d1d
JH
11313 register int i;
11314 register unsigned long tmp;
11315 register unsigned long max = 0L;
11316
11317 for (i = 1000; i; i--) {
11318 tmp = (unsigned long) $randfunc();
11319 if (tmp > max) max = tmp;
11320 }
11321 for (i = 0; max; i++)
11322 max /= 2;
11323 printf("%d\n",i);
693762b4
AD
11324}
11325EOCP
85ab1d1d
JH
11326 set try
11327 if eval $compile_ok; then
11328 dflt=`try`
11329 else
11330 dflt='?'
11331 echo "(I can't seem to compile the test program...)"
11332 fi
11333 ;;
11334 *)
11335 dflt="$randbits"
11336 ;;
11337 esac
11338 rp="How many bits does your $randfunc() function produce?"
11339 . ./myread
11340 randbits="$ans"
11341 $rm -f try.c try
11342 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11343 seedfunc="s$randfunc"
11344 randseedtype=unsigned
11345 ;;
11346 *)
11347 dflt="31"
11348 rp="How many bits does your $randfunc() function produce?"
11349 . ./myread
11350 randbits="$ans"
11351 seedfunc="s$randfunc"
11352 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11353 if set $seedfunc val -f; eval $csym; $val; then
11354 echo "(Using $seedfunc() to seed random generator)"
11355 else
11356 echo "(Warning: no $seedfunc() to seed random generator)"
11357 seedfunc=rand
11358 fi
11359 randseedtype=unsigned
11360 ;;
11361 esac
11362 ;;
11363 esac
11364done
693762b4 11365
5ff3f7a4
GS
11366echo " "
11367echo "Determining whether or not we are on an EBCDIC system..." >&4
11368$cat >tebcdic.c <<'EOM'
11369int main()
11370{
11371 if ('M'==0xd4) return 0;
11372 return 1;
11373}
11374EOM
11375
11376val=$undef
11377set tebcdic
11378if eval $compile_ok; then
11379 if ./tebcdic; then
11380 echo "You have EBCDIC." >&4
11381 val="$define"
11382 else
5cf1d1f1 11383 echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin, or UTF." >&4
5ff3f7a4
GS
11384 fi
11385else
5cc3184f 11386 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
11387 echo "I'll assume ASCII or some ISO Latin." >&4
11388fi
11389$rm -f tebcdic.c tebcdic
11390set ebcdic
11391eval $setvar
11392
29209bc5 11393echo " "
767df6a1
JH
11394$cat >&4 <<EOM
11395Checking how to flush all pending stdio output...
66fe083f 11396EOM
d2201af2
AD
11397# I only know how to find the first 32 possibly open files on SunOS.
11398# See also hints/sunos_4_1.sh and util.c --AD
11399case "$osname" in
11400sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11401esac
11402$cat >>try.c <<EOCP
66fe083f 11403#include <stdio.h>
d2201af2 11404#$i_unistd I_UNISTD
767df6a1 11405#ifdef I_UNISTD
a32a45b6 11406# include <unistd.h>
767df6a1
JH
11407#endif
11408#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
11409#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11410#ifdef HAS_STDIO_STREAM_ARRAY
11411# define STDIO_STREAM_ARRAY $stdio_stream_array
11412#endif
66fe083f
JH
11413int main() {
11414 FILE* p = fopen("try.out", "w");
0f27ced1 11415#ifdef TRY_FPUTC
66fe083f 11416 fputc('x', p);
0f27ced1
JH
11417#else
11418# ifdef TRY_FPRINTF
11419 fprintf(p, "x");
11420# endif
11421#endif
767df6a1 11422#ifdef TRY_FFLUSH_NULL
66fe083f 11423 fflush(NULL);
767df6a1
JH
11424#endif
11425#ifdef TRY_FFLUSH_ALL
11426 {
11427 long open_max = -1;
d2201af2
AD
11428# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11429 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 11430# else
d2201af2
AD
11431# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11432 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 11433# else
4b257aef 11434# ifdef FOPEN_MAX
d2201af2 11435 open_max = FOPEN_MAX;
767df6a1 11436# else
d2201af2
AD
11437# ifdef OPEN_MAX
11438 open_max = OPEN_MAX;
11439# else
11440# ifdef _NFILE
11441 open_max = _NFILE;
11442# endif
767df6a1
JH
11443# endif
11444# endif
11445# endif
4b257aef 11446# endif
ed39a0f2 11447# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
11448 if (open_max > 0) {
11449 long i;
11450 for (i = 0; i < open_max; i++)
d2201af2
AD
11451 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11452 STDIO_STREAM_ARRAY[i]._file < open_max &&
11453 STDIO_STREAM_ARRAY[i]._flag)
11454 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
11455 }
11456 }
ed39a0f2 11457# endif
767df6a1
JH
11458#endif
11459 _exit(42);
66fe083f
JH
11460}
11461EOCP
0f27ced1
JH
11462: first we have to find out how _not_ to flush
11463if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11464 output=''
11465 set try -DTRY_FPUTC
6626660c 11466 if eval $compile; then
4b257aef 11467 $rm -f try.out
0f27ced1
JH
11468 ./try$exe_ext 2>/dev/null
11469 if $test ! -s try.out -a "X$?" = X42; then
11470 output=-DTRY_FPUTC
11471 fi
11472 fi
11473 case "$output" in
11474 '')
11475 set try -DTRY_FPRINTF
11476 $rm -f try.out
6626660c 11477 if eval $compile; then
4b257aef 11478 $rm -f try.out
0f27ced1
JH
11479 ./try$exe_ext 2>/dev/null
11480 if $test ! -s try.out -a "X$?" = X42; then
11481 output=-DTRY_FPRINTF
11482 fi
11483 fi
11484 ;;
11485 esac
11486fi
767df6a1
JH
11487: check for fflush NULL behaviour
11488case "$fflushNULL" in
0f27ced1 11489'') set try -DTRY_FFLUSH_NULL $output
6626660c 11490 if eval $compile; then
4b257aef 11491 $rm -f try.out
196fa3d2 11492 ./try$exe_ext 2>/dev/null
a32a45b6
JH
11493 code="$?"
11494 if $test -s try.out -a "X$code" = X42; then
c2fddd50 11495 fflushNULL="`$cat try.out`"
a32a45b6
JH
11496 else
11497 if $test "X$code" != X42; then
11498 $cat >&4 <<EOM
11499(If this test failed, don't worry, we'll try another method shortly.)
11500EOM
11501 fi
c2fddd50
JH
11502 fi
11503 fi
0f27ced1 11504 $rm -f core try.core core.try.*
c2fddd50 11505 case "$fflushNULL" in
6626660c 11506 x) $cat >&4 <<EOM
66fe083f
JH
11507Your fflush(NULL) works okay.
11508EOM
ed39a0f2 11509 fflushNULL="$define"
c2fddd50 11510 ;;
6626660c 11511 '') $cat >&4 <<EOM
66fe083f
JH
11512Your fflush(NULL) isn't working (contrary to ANSI C).
11513EOM
ed39a0f2 11514 fflushNULL="$undef"
c2fddd50 11515 ;;
6626660c 11516 *) $cat >&4 <<EOM
66fe083f
JH
11517Cannot figure out whether your fflush(NULL) works or not.
11518I'm assuming it doesn't (contrary to ANSI C).
11519EOM
ed39a0f2 11520 fflushNULL="$undef"
c2fddd50
JH
11521 ;;
11522 esac
66fe083f
JH
11523 ;;
11524$define|true|[yY]*)
ed39a0f2 11525 fflushNULL="$define"
66fe083f
JH
11526 ;;
11527*)
ed39a0f2 11528 fflushNULL="$undef"
66fe083f
JH
11529 ;;
11530esac
a32a45b6
JH
11531: check explicit looping only if NULL did not work
11532case "$fflushNULL" in
11533"$undef")
11534 : check for fflush all behaviour
11535 case "$fflushall" in
11536 '') set try -DTRY_FFLUSH_ALL $output
a32a45b6 11537 if eval $compile; then
4b257aef 11538 $cat >&4 <<EOM
a32a45b6 11539(Now testing the other method--but note that also this may fail.)
a71cd7cd 11540EOM
4b257aef 11541 $rm -f try.out
a32a45b6
JH
11542 ./try$exe_ext 2>/dev/null
11543 if $test -s try.out -a "X$?" = X42; then
11544 fflushall="`$cat try.out`"
11545 fi
767df6a1 11546 fi
a32a45b6
JH
11547 $rm -f core try.core core.try.*
11548 case "$fflushall" in
11549 x) $cat >&4 <<EOM
11550Whew. Flushing explicitly all the stdio streams works.
767df6a1 11551EOM
a32a45b6
JH
11552 fflushall="$define"
11553 ;;
11554 '') $cat >&4 <<EOM
11555Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 11556EOM
a32a45b6
JH
11557 fflushall="$undef"
11558 ;;
11559 *) $cat >&4 <<EOM
6626660c 11560Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
11561I'm assuming it doesn't.
11562EOM
a32a45b6
JH
11563 fflushall="$undef"
11564 ;;
11565 esac
767df6a1 11566 ;;
a32a45b6
JH
11567 "$define"|true|[yY]*)
11568 fflushall="$define"
11569 ;;
11570 *)
11571 fflushall="$undef"
6626660c
JH
11572 ;;
11573 esac
767df6a1 11574 ;;
a32a45b6 11575*) fflushall="$undef"
767df6a1
JH
11576 ;;
11577esac
11578case "$fflushNULL$fflushall" in
11579undefundef)
6626660c 11580 $cat <<EOM
767df6a1
JH
11581I cannot figure out how to flush pending stdio output.
11582EOM
11583 ;;
11584esac
11585$rm -f try.* try$exe_ext
66fe083f 11586
a0d0e21e 11587: see what type file positions are declared as in the library
a0d0e21e 11588rp="What is the type for file position used by fsetpos()?"
dc45a647
MB
11589set fpos_t fpostype long stdio.h sys/types.h
11590eval $typedef_ask
2304df62 11591
ccc7f9b3
KS
11592: Store the full pathname to the ar program for use in the C program
11593: Respect a hint or command line value for full_ar.
11594case "$full_ar" in
11595'') full_ar=$ar ;;
11596esac
11597
1aef975c
AD
11598: Store the full pathname to the sed program for use in the C program
11599full_sed=$sed
11600
2304df62 11601: see what type gids are declared as in the kernel
dc45a647
MB
11602echo " "
11603echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
11604set gid_t gidtype xxx stdio.h sys/types.h
11605eval $typedef
2304df62 11606case "$gidtype" in
a0d0e21e
LW
11607xxx)
11608 xxx=`./findhdr sys/user.h`
11609 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11610 case $1 in
11611 unsigned) dflt="$1 $2" ;;
11612 *) dflt="$1" ;;
11613 esac
2304df62 11614 ;;
a0d0e21e 11615*) dflt="$gidtype";;
2304df62 11616esac
dc45a647
MB
11617case "$gidtype" in
11618gid_t) echo "gid_t found." ;;
11619*) rp="What is the type for group ids returned by getgid()?"
11620 . ./myread
11621 gidtype="$ans"
11622 ;;
11623esac
a0d0e21e 11624
2304df62
AD
11625: see if getgroups exists
11626set getgroups d_getgrps
11627eval $inlibc
11628
5cd24f17 11629: see if setgroups exists
11630set setgroups d_setgrps
11631eval $inlibc
11632
dfe9444c 11633
8cc95fdb 11634: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
a0d0e21e 11635echo " "
5cd24f17 11636case "$d_getgrps$d_setgrps" in
11637*define*)
a0d0e21e 11638 case "$groupstype" in
2304df62
AD
11639 '') dflt="$gidtype" ;;
11640 *) dflt="$groupstype" ;;
a0d0e21e
LW
11641 esac
11642 $cat <<EOM
dc45a647 11643What type of pointer is the second argument to getgroups() and setgroups()?
5cd24f17 11644Usually this is the same as group ids, $gidtype, but not always.
2304df62
AD
11645
11646EOM
dc45a647 11647 rp='What type pointer is the second argument to getgroups() and setgroups()?'
a0d0e21e
LW
11648 . ./myread
11649 groupstype="$ans"
11650 ;;
11651*) groupstype="$gidtype";;
2304df62 11652esac
2304df62 11653
85e6fe83 11654: see what type lseek is declared as in the kernel
dc45a647 11655rp="What is the type used for lseek's offset on this system?"
a0d0e21e 11656set off_t lseektype long stdio.h sys/types.h
dc45a647 11657eval $typedef_ask
2304df62 11658
8ff267be 11659echo " "
5ff3f7a4
GS
11660$echo $n "Checking to see how big your file offsets are...$c" >&4
11661$cat >try.c <<EOCP
11662#include <sys/types.h>
11663#include <stdio.h>
5a411a32 11664int main()
5ff3f7a4
GS
11665{
11666 printf("%d\n", sizeof($lseektype));
11667}
11668EOCP
11669set try
11670if eval $compile_ok; then
11671 lseeksize=`./try`
11672 $echo " $lseeksize bytes." >&4
11673else
11674 dflt='4'
11675 echo " "
11676 echo "(I can't seem to compile the test program. Guessing...)"
11677 rp="What is the size of your file offsets (in bytes)?"
11678 . ./myread
11679 lseeksize="$ans"
11680fi
11681$rm -f try.c try
11682
11683echo " "
dfe9444c 11684echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 11685case "$make_set_make" in
11686'')
11687 $sed 's/^X //' > testmake.mak << 'EOF'
11688Xall:
dfe9444c 11689X @echo 'maketemp="$(MAKE)"'
8ff267be 11690EOF
8ff267be 11691 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 11692 *maketemp=*) make_set_make='#' ;;
8ff267be 11693 *) make_set_make="MAKE=$make" ;;
11694 esac
dfe9444c
AD
11695 $rm -f testmake.mak
11696 ;;
11697esac
11698case "$make_set_make" in
11699'#') echo "Yup, it does.";;
11700*) echo "Nope, it doesn't.";;
11701esac
11702
11703: see what type is used for mode_t
dc45a647 11704rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 11705set mode_t modetype int stdio.h sys/types.h
dc45a647 11706eval $typedef_ask
dfe9444c 11707
dfe9444c
AD
11708: define a fucntion to check prototypes
11709$cat > protochk <<EOSH
11710$startsh
11711cc="$cc"
11712optimize="$optimize"
11713ccflags="$ccflags"
11714prototype="$prototype"
11715define="$define"
11716rm=$rm
11717EOSH
11718
11719$cat >> protochk <<'EOSH'
11720
11721$rm -f try.c
11722foo="$1"
11723shift
11724while test $# -ge 2; do
11725 case "$1" in
11726 $define) echo "#include <$2>" >> try.c ;;
11727 literal) echo "$2" >> try.c ;;
11728 esac
11729 shift 2
11730done
11731test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
11732cat >> try.c <<'EOCP'
11733#ifdef CAN_PROTOTYPE
11734#define _(args) args
11735#else
11736#define _(args) ()
11737#endif
11738EOCP
11739echo "$foo" >> try.c
11740echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11741$cc $optimize $ccflags -c try.c > /dev/null 2>&1
11742status=$?
11743$rm -f try.[co]
11744exit $status
11745EOSH
11746chmod +x protochk
11747$eunicefix protochk
11748
dfe9444c 11749: see what type is used for size_t
dc45a647 11750rp="What is the type used for the length parameter for string functions?"
dfe9444c 11751set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 11752eval $typedef_ask
dfe9444c
AD
11753
11754: check for type of arguments to gethostbyaddr.
11755if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11756 case "$d_gethbyaddr" in
11757 $define)
11758 $cat <<EOM
11759
11760Checking to see what type of arguments are accepted by gethostbyaddr().
11761EOM
11762 hdrs="$define sys/types.h
11763 $d_socket sys/socket.h
11764 $i_niin netinet/in.h
11765 $i_netdb netdb.h
11766 $i_unistd unistd.h"
11767 : The first arg can 'char *' or 'void *'
11768 : The second arg is some of integral type
11769 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11770 for yyy in size_t long int; do
11771 case "$netdb_host_type" in
11772 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11773 if ./protochk "$try" $hdrs; then
11774 echo "Your system accepts $xxx for the first arg."
11775 echo "...and $yyy for the second arg."
11776 netdb_host_type="$xxx"
11777 netdb_hlen_type="$yyy"
11778 fi
11779 ;;
11780 esac
11781 done
11782 done
11783 : In case none of those worked, prompt the user.
11784 case "$netdb_host_type" in
11785 '') rp='What is the type for the 1st argument to gethostbyaddr?'
11786 dflt='char *'
11787 . ./myread
11788 netdb_host_type=$ans
11789 rp='What is the type for the 2nd argument to gethostbyaddr?'
11790 dflt="$sizetype"
11791 . ./myread
11792 netdb_hlen_type=$ans
11793 ;;
11794 esac
11795 ;;
11796 *) : no gethostbyaddr, so pick harmless defaults
11797 netdb_host_type='char *'
11798 netdb_hlen_type="$sizetype"
11799 ;;
11800 esac
11801 # Remove the "const" if needed. -- but then we'll have a
11802 # prototype clash!
11803 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11804fi
11805
11806: check for type of argument to gethostbyname.
11807if test "X$netdb_name_type" = X ; then
11808 case "$d_gethbyname" in
11809 $define)
11810 $cat <<EOM
11811
11812Checking to see what type of argument is accepted by gethostbyname().
11813EOM
11814 hdrs="$define sys/types.h
11815 $d_socket sys/socket.h
11816 $i_niin netinet/in.h
11817 $i_netdb netdb.h
11818 $i_unistd unistd.h"
11819 for xxx in "const char *" "char *"; do
11820 case "$netdb_name_type" in
11821 '') try="extern struct hostent *gethostbyname($xxx);"
11822 if ./protochk "$try" $hdrs; then
11823 echo "Your system accepts $xxx."
11824 netdb_name_type="$xxx"
11825 fi
11826 ;;
11827 esac
11828 done
11829 : In case none of those worked, prompt the user.
11830 case "$netdb_name_type" in
11831 '') rp='What is the type for the 1st argument to gethostbyname?'
11832 dflt='char *'
11833 . ./myread
11834 netdb_name_type=$ans
11835 ;;
11836 esac
11837 ;;
11838 *) : no gethostbyname, so pick harmless default
11839 netdb_name_type='char *'
11840 ;;
11841 esac
11842fi
8ff267be 11843
dfe9444c
AD
11844: check for type of 1st argument to getnetbyaddr.
11845if test "X$netdb_net_type" = X ; then
11846 case "$d_getnbyaddr" in
11847 $define)
11848 $cat <<EOM
85e6fe83 11849
dfe9444c
AD
11850Checking to see what type of 1st argument is accepted by getnetbyaddr().
11851EOM
11852 hdrs="$define sys/types.h
11853 $d_socket sys/socket.h
11854 $i_niin netinet/in.h
11855 $i_netdb netdb.h
11856 $i_unistd unistd.h"
11857 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11858 case "$netdb_net_type" in
11859 '') try="extern struct netent *getnetbyaddr($xxx, int);"
11860 if ./protochk "$try" $hdrs; then
11861 echo "Your system accepts $xxx."
11862 netdb_net_type="$xxx"
11863 fi
11864 ;;
11865 esac
11866 done
11867 : In case none of those worked, prompt the user.
11868 case "$netdb_net_type" in
11869 '') rp='What is the type for the 1st argument to getnetbyaddr?'
11870 dflt='long'
11871 . ./myread
11872 netdb_net_type=$ans
11873 ;;
11874 esac
11875 ;;
11876 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 11877 netdb_net_type='long'
dfe9444c
AD
11878 ;;
11879 esac
11880fi
2c7991dc 11881: locate the preferred pager for this system
11882case "$pager" in
11883'')
11884 dflt=''
11885 case "$pg" in
11886 /*) dflt=$pg;;
11887 esac
11888 case "$more" in
11889 /*) dflt=$more;;
11890 esac
11891 case "$less" in
11892 /*) dflt=$less;;
11893 esac
11894 case "$dflt" in
11895 '') dflt=/usr/ucb/more;;
11896 esac
11897 ;;
11898*) dflt="$pager";;
11899esac
11900echo " "
11901fn=f/
11902rp='What pager is used on your system?'
11903. ./getfile
11904pager="$ans"
11905
dfe9444c 11906: see what type pids are declared as in the kernel
dc45a647 11907rp="What is the type of process ids on this system?"
dfe9444c 11908set pid_t pidtype int stdio.h sys/types.h
dc45a647 11909eval $typedef_ask
2304df62 11910
693762b4
AD
11911: check for length of pointer
11912echo " "
11913case "$ptrsize" in
11914'')
dc45a647 11915 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
11916 if test "$voidflags" -gt 7; then
11917 echo '#define VOID_PTR char *' > try.c
11918 else
11919 echo '#define VOID_PTR void *' > try.c
11920 fi
11921 $cat >>try.c <<'EOCP'
11922#include <stdio.h>
d674cd6d 11923int main()
693762b4
AD
11924{
11925 printf("%d\n", sizeof(VOID_PTR));
11926 exit(0);
11927}
11928EOCP
11929 set try
dc45a647 11930 if eval $compile_ok; then
693762b4 11931 ptrsize=`./try`
dc45a647 11932 $echo " $ptrsize bytes." >&4
693762b4
AD
11933 else
11934 dflt='4'
11935 echo "(I can't seem to compile the test program. Guessing...)" >&4
11936 rp="What is the size of a pointer (in bytes)?"
11937 . ./myread
11938 ptrsize="$ans"
11939 fi
11940 ;;
11941esac
11942$rm -f try.c try
11943
a0d0e21e
LW
11944: see if ar generates random libraries by itself
11945echo " "
11946echo "Checking how to generate random libraries on your machine..." >&4
11947echo 'int bar1() { return bar2(); }' > bar1.c
11948echo 'int bar2() { return 2; }' > bar2.c
11949$cat > foo.c <<'EOP'
d674cd6d 11950int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
11951EOP
11952$cc $ccflags -c bar1.c >/dev/null 2>&1
11953$cc $ccflags -c bar2.c >/dev/null 2>&1
11954$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
11955$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11956if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 11957 ./foobar >/dev/null 2>&1; then
4e2a5f63 11958 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
11959 orderlib=false
11960 ranlib=":"
dfe9444c
AD
11961elif $ar ts bar$_a >/dev/null 2>&1 &&
11962 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 11963 ./foobar >/dev/null 2>&1; then
4e2a5f63 11964 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 11965 orderlib=false
dfe9444c 11966 ranlib="$ar ts"
a0d0e21e 11967else
ecfc5424
AD
11968 case "$ranlib" in
11969 :) ranlib='';;
11970 '')
11971 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11972 $test -f $ranlib || ranlib=''
11973 ;;
11974 esac
a0d0e21e 11975 if $test -n "$ranlib"; then
ecfc5424 11976 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
11977 orderlib=false
11978 else
11979 echo "your system doesn't seem to support random libraries"
11980 echo "so we'll use lorder and tsort to order the libraries."
11981 orderlib=true
11982 ranlib=":"
11983 fi
11984fi
11985$rm -f foo* bar*
11986
dfe9444c
AD
11987: check for type of arguments to select.
11988case "$selecttype" in
11989'') case "$d_select" in
11990 $define)
11991 $cat <<EOM
11992Checking to see what type of arguments are accepted by select().
11993EOM
11994 hdrs="$define sys/types.h
11995 $i_systime sys/time.h
11996 $i_sysselct sys/select.h
11997 $d_socket sys/socket.h"
11998 : The first arg can be int, unsigned, or size_t
11999 : The last arg may or may not be 'const'
12000 val=''
7f3d1cf1
BH
12001 : void pointer has been seen but using that
12002 : breaks the selectminbits test
12003 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 12004 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
12005 for tmo in 'struct timeval *' 'const struct timeval *'; do
12006 case "$val" in
12007 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12008 if ./protochk "$try" $hdrs; then
12009 echo "Your system accepts $xxx."
12010 val="$xxx"
12011 fi
12012 ;;
12013 esac
12014 done
12015 done
12016 done
12017 case "$val" in
12018 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12019 case "$d_fd_set" in
12020 $define) dflt="fd_set *" ;;
12021 *) dflt="int *" ;;
12022 esac
12023 . ./myread
12024 val=$ans
12025 ;;
a0d0e21e 12026 esac
dfe9444c 12027 selecttype="$val"
a0d0e21e 12028 ;;
dfe9444c
AD
12029 *) : no select, so pick a harmless default
12030 selecttype='int *'
a0d0e21e
LW
12031 ;;
12032 esac
a0d0e21e
LW
12033 ;;
12034esac
2304df62 12035
5ff3f7a4
GS
12036: check for the select 'width'
12037case "$selectminbits" in
12038'') case "$d_select" in
12039 $define)
12040 $cat <<EOM
12041
85ab1d1d 12042Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
12043EOM
12044 $cat >try.c <<EOCP
12045#include <sys/types.h>
12046#$i_time I_TIME
12047#$i_systime I_SYS_TIME
12048#$i_systimek I_SYS_TIME_KERNEL
12049#ifdef I_TIME
12050# include <time.h>
12051#endif
12052#ifdef I_SYS_TIME
12053# ifdef I_SYS_TIME_KERNEL
12054# define KERNEL
12055# endif
12056# include <sys/time.h>
12057# ifdef I_SYS_TIME_KERNEL
12058# undef KERNEL
12059# endif
12060#endif
12061#$i_sysselct I_SYS_SELECT
12062#ifdef I_SYS_SELECT
12063#include <sys/select.h>
12064#endif
bd628c73
AD
12065#$d_socket HAS_SOCKET
12066#ifdef HAS_SOCKET
12067# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12068#endif
5ff3f7a4 12069#include <stdio.h>
fb164848
JH
12070$selecttype b;
12071#define S sizeof(*(b))
5ff3f7a4
GS
12072#define MINBITS 64
12073#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12074#define NBITS (NBYTES * 8)
12075int main() {
12076 char s[NBYTES];
5ff3f7a4
GS
12077 struct timeval t;
12078 int i;
12079 FILE* fp;
12080 int fd;
12081
12082 fclose(stdin);
12083 fp = fopen("try.c", "r");
12084 if (fp == 0)
12085 exit(1);
12086 fd = fileno(fp);
12087 if (fd < 0)
12088 exit(2);
12089 b = ($selecttype)s;
12090 for (i = 0; i < NBITS; i++)
12091 FD_SET(i, b);
12092 t.tv_sec = 0;
12093 t.tv_usec = 0;
12094 select(fd + 1, b, 0, 0, &t);
12095 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12096 printf("%d\n", i + 1);
12097 return 0;
12098}
12099EOCP
12100 set try
12101 if eval $compile_ok; then
12102 selectminbits=`./try`
85ab1d1d 12103 case "$selectminbits" in
fb164848
JH
12104 '') cat >&4 <<EOM
12105Cannot figure out on how many bits at a time your select() operates.
12106I'll play safe and guess it is 32 bits.
12107EOM
12108 selectminbits=32
12109 bits="32 bits"
12110 ;;
85ab1d1d
JH
12111 1) bits="1 bit" ;;
12112 *) bits="$selectminbits bits" ;;
12113 esac
12114 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
12115 else
12116 rp='What is the minimum number of bits your select() operates on?'
12117 case "$byteorder" in
12118 1234|12345678) dflt=32 ;;
12119 *) dflt=1 ;;
12120 esac
12121 . ./myread
12122 val=$ans
12123 selectminbits="$val"
12124 fi
12125 $rm -f try.* try
12126 ;;
12127 *) : no select, so pick a harmless default
12128 selectminbits='32'
12129 ;;
12130 esac
12131 ;;
12132esac
12133
8e07c86e
AD
12134: Trace out the files included by signal.h, then look for SIGxxx names.
12135: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
12136: Remove SIGSTKSIZE used by Linux.
12137: Remove SIGSTKSZ used by Posix.
4633a7c4 12138: Remove SIGTYP void lines used by OS2.
8e07c86e
AD
12139xxx=`echo '#include <signal.h>' |
12140 $cppstdin $cppminus $cppflags 2>/dev/null |
12141 $grep '^[ ]*#.*include' |
12142 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12143: Check this list of files to be sure we have parsed the cpp output ok.
12144: This will also avoid potentially non-existent files, such
12145: as ../foo/bar.h
12146xxxfiles=''
12147for xx in $xxx /dev/null ; do
12148 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12149done
12150: If we have found no files, at least try signal.h
12151case "$xxxfiles" in
12152'') xxxfiles=`./findhdr signal.h` ;;
12153esac
12154xxx=`awk '
af4c28eb 12155$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
12156 print substr($2, 4, 20)
12157}
4633a7c4 12158$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
12159 print substr($3, 4, 20)
12160}' $xxxfiles`
12161: Append some common names just in case the awk scan failed.
12162xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12163xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12164xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12165xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12166: generate a few handy files for later
dc45a647 12167$cat > signal.c <<'EOCP'
4633a7c4
LW
12168#include <sys/types.h>
12169#include <signal.h>
dc45a647 12170#include <stdio.h>
4633a7c4 12171int main() {
760ac839
LW
12172
12173/* Strange style to avoid deeply-nested #if/#else/#endif */
12174#ifndef NSIG
12175# ifdef _NSIG
12176# define NSIG (_NSIG)
12177# endif
12178#endif
12179
12180#ifndef NSIG
12181# ifdef SIGMAX
12182# define NSIG (SIGMAX+1)
12183# endif
12184#endif
12185
12186#ifndef NSIG
12187# ifdef SIG_MAX
12188# define NSIG (SIG_MAX+1)
12189# endif
12190#endif
12191
12192#ifndef NSIG
12193# ifdef MAXSIG
12194# define NSIG (MAXSIG+1)
12195# endif
4633a7c4 12196#endif
760ac839
LW
12197
12198#ifndef NSIG
12199# ifdef MAX_SIG
12200# define NSIG (MAX_SIG+1)
12201# endif
12202#endif
12203
12204#ifndef NSIG
12205# ifdef SIGARRAYSIZE
12206# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12207# endif
12208#endif
12209
12210#ifndef NSIG
12211# ifdef _sys_nsig
12212# define NSIG (_sys_nsig) /* Solaris 2.5 */
12213# endif
12214#endif
12215
12216/* Default to some arbitrary number that's big enough to get most
12217 of the common signals.
12218*/
12219#ifndef NSIG
12220# define NSIG 50
4633a7c4 12221#endif
760ac839
LW
12222
12223printf("NSIG %d\n", NSIG);
12224
dc45a647
MB
12225#ifndef JUST_NSIG
12226
12227EOCP
12228
28e8609d 12229echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
12230{
12231 printf "#ifdef SIG"; printf $1; printf "\n"
12232 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12233 printf $1; printf ");\n"
12234 printf "#endif\n"
2304df62 12235}
2304df62 12236END {
dc45a647 12237 printf "#endif /* JUST_NSIG */\n";
8e07c86e 12238 printf "}\n";
2304df62 12239}
4633a7c4
LW
12240' >>signal.c
12241$cat >signal.awk <<'EOP'
12242BEGIN { ndups = 0 }
12243$1 ~ /^NSIG$/ { nsig = $2 }
12244($1 !~ /^NSIG$/) && (NF == 2) {
12245 if ($2 > maxsig) { maxsig = $2 }
12246 if (sig_name[$2]) {
12247 dup_name[ndups] = $1
12248 dup_num[ndups] = $2
12249 ndups++
12250 }
12251 else {
12252 sig_name[$2] = $1
12253 sig_num[$2] = $2
12254 }
4633a7c4
LW
12255}
12256END {
af4c28eb
CS
12257 if (nsig == 0) {
12258 nsig = maxsig + 1
12259 }
12260 printf("NSIG %d\n", nsig);
12261 for (n = 1; n < nsig; n++) {
12262 if (sig_name[n]) {
12263 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 12264 }
af4c28eb
CS
12265 else {
12266 printf("NUM%d %d\n", n, n)
12267 }
12268 }
4633a7c4 12269 for (n = 0; n < ndups; n++) {
af4c28eb 12270 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
12271 }
12272}
12273EOP
12274$cat >signal_cmd <<EOS
8e07c86e 12275$startsh
dc45a647
MB
12276if $test -s signal.lst; then
12277 echo "Using your existing signal.lst file"
12278 exit 0
12279fi
12280xxx="$xxx"
12281EOS
12282$cat >>signal_cmd <<'EOS'
12283
12284set signal
12285if eval $compile_ok; then
dfe9444c 12286 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 12287else
dc45a647
MB
12288 echo "(I can't seem be able to compile the whole test program)" >&4
12289 echo "(I'll try it in little pieces.)" >&4
12290 set signal -DJUST_NSIG
12291 if eval $compile_ok; then
12292 ./signal$_exe > signal.nsg
12293 $cat signal.nsg
12294 else
12295 echo "I can't seem to figure out how many signals you have." >&4
12296 echo "Guessing 50." >&4
12297 echo 'NSIG 50' > signal.nsg
12298 fi
12299 : Now look at all the signal names, one at a time.
28e8609d 12300 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
12301 $cat > signal.c <<EOCP
12302#include <sys/types.h>
12303#include <signal.h>
12304#include <stdio.h>
12305int main() {
12306printf("$xx %d\n", SIG${xx});
12307return 0;
12308}
12309EOCP
12310 set signal
12311 if eval $compile; then
12312 echo "SIG${xx} found."
12313 ./signal$_exe >> signal.ls1
12314 else
12315 echo "SIG${xx} NOT found."
12316 fi
12317 done
12318 if $test -s signal.ls1; then
12319 $cat signal.nsg signal.ls1 |
12320 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12321 fi
12322
12323fi
12324if $test -s signal.lst; then
12325 :
12326else
12327 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 12328 echo 'kill -l' >signal
dc45a647 12329 set X `csh -f <signal`
8e07c86e 12330 $rm -f signal
2304df62 12331 shift
dc45a647 12332 case $# in
8e07c86e 12333 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 12334 esac
28e8609d 12335 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
12336 $awk '{ printf "%s %d\n", $1, ++s; }
12337 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 12338fi
dc45a647 12339$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 12340EOS
4633a7c4
LW
12341chmod a+x signal_cmd
12342$eunicefix signal_cmd
8e07c86e
AD
12343
12344: generate list of signal names
12345echo " "
dfe9444c 12346case "$sig_name_init" in
6626bf4c
JH
12347'') doinit=yes ;;
12348*) case "$sig_num_init" in
12349 ''|*,*) doinit=yes ;;
12350 esac ;;
12351esac
12352case "$doinit" in
12353yes)
4633a7c4 12354 echo "Generating a list of signal names and numbers..." >&4
dc45a647 12355 . ./signal_cmd
af4c28eb
CS
12356 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12357 sig_name=`$awk 'BEGIN { printf "ZERO " }
12358 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12359 sig_num=`$awk 'BEGIN { printf "0 " }
12360 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12361 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
12362 !/^NSIG/ { printf "\"%s\", ", $1 }
12363 END { printf "0\n" }' signal.lst`
12364 sig_num_init=`$awk 'BEGIN { printf "0, " }
12365 !/^NSIG/ { printf "%d, ", $2}
12366 END { printf "0\n"}' signal.lst`
12367 ;;
12368esac
12369echo "The following $sig_count signals are available:"
a0d0e21e
LW
12370echo " "
12371echo $sig_name | $awk \
12372'BEGIN { linelen = 0 }
12373{
8e07c86e 12374 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
12375 name = "SIG" $i " "
12376 linelen = linelen + length(name)
12377 if (linelen > 70) {
12378 printf "\n"
12379 linelen = length(name)
12380 }
12381 printf "%s", name
12382 }
8e07c86e 12383 printf "\n"
a0d0e21e 12384}'
4633a7c4 12385$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 12386
a0d0e21e
LW
12387: see what type is used for signed size_t
12388set ssize_t ssizetype int stdio.h sys/types.h
12389eval $typedef
12390dflt="$ssizetype"
12391$cat > ssize.c <<EOM
12392#include <stdio.h>
12393#include <sys/types.h>
12394#define Size_t $sizetype
12395#define SSize_t $dflt
d674cd6d 12396int main()
a0d0e21e
LW
12397{
12398 if (sizeof(Size_t) == sizeof(SSize_t))
12399 printf("$dflt\n");
12400 else if (sizeof(Size_t) == sizeof(int))
12401 printf("int\n");
12402 else
12403 printf("long\n");
760ac839 12404 exit(0);
a0d0e21e
LW
12405}
12406EOM
12407echo " "
dfe9444c 12408set ssize
dc45a647 12409if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 12410 ssizetype=`./ssize`
a0d0e21e
LW
12411 echo "I'll be using $ssizetype for functions returning a byte count." >&4
12412else
24fef2a7 12413 $cat >&4 <<EOM
24fef2a7
AD
12414Help! I can't compile and run the ssize_t test program: please enlighten me!
12415(This is probably a misconfiguration in your system or libraries, and
12416you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
12417
12418I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 12419be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
12420
12421EOM
12422 rp="What signed type is the same size as $sizetype?"
12423 . ./myread
12424 ssizetype="$ans"
12425fi
dfe9444c 12426$rm -f ssize ssize.*
3fd537d4 12427
a0d0e21e
LW
12428: see what type of char stdio uses.
12429echo " "
12430if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12431 echo "Your stdio uses unsigned chars." >&4
12432 stdchar="unsigned char"
12433else
12434 echo "Your stdio uses signed chars." >&4
12435 stdchar="char"
12436fi
12437
12438: see if time exists
12439echo " "
28e8609d
JH
12440if test "X$d_time" = X -o X"$timetype" = X; then
12441 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
12442 echo 'time() found.' >&4
12443 val="$define"
12444 rp="What is the type returned by time() on this system?"
12445 set time_t timetype long stdio.h sys/types.h
12446 eval $typedef_ask
28e8609d 12447 else
5ff3f7a4
GS
12448 echo 'time() not found, hope that will do.' >&4
12449 val="$undef"
12450 timetype='int';
28e8609d
JH
12451 fi
12452 set d_time
12453 eval $setvar
a0d0e21e 12454fi
a0d0e21e
LW
12455
12456: see what type uids are declared as in the kernel
dc45a647
MB
12457echo " "
12458echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
12459set uid_t uidtype xxx stdio.h sys/types.h
12460eval $typedef
12461case "$uidtype" in
12462xxx)
12463 xxx=`./findhdr sys/user.h`
12464 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12465 case $1 in
12466 unsigned) dflt="$1 $2" ;;
12467 *) dflt="$1" ;;
12468 esac
12469 ;;
4633a7c4
LW
12470*) dflt="$uidtype";;
12471esac
dc45a647
MB
12472case "$uidtype" in
12473uid_t) echo "uid_t found." ;;
12474*) rp="What is the type for user ids returned by getuid()?"
12475 . ./myread
12476 uidtype="$ans"
12477 ;;
12478esac
4633a7c4
LW
12479
12480: see if dbm.h is available
12481: see if dbmclose exists
12482set dbmclose d_dbmclose
12483eval $inlibc
12484
12485case "$d_dbmclose" in
12486$define)
12487 set dbm.h i_dbm
12488 eval $inhdr
5f80c64f
JH
12489 case "$i_dbm" in
12490 $define)
12491 val="$undef"
12492 set i_rpcsvcdbm
12493 eval $setvar
12494 ;;
12495 *) set rpcsvc/dbm.h i_rpcsvcdbm
12496 eval $inhdr
12497 ;;
12498 esac
12499 ;;
12500*) echo "We won't be including <dbm.h>"
12501 val="$undef"
12502 set i_dbm
12503 eval $setvar
12504 val="$undef"
12505 set i_rpcsvcdbm
12506 eval $setvar
12507 ;;
12508esac
12509
12510: see if this is a sys/file.h system
12511val=''
12512set sys/file.h val
12513eval $inhdr
12514
12515: do we need to include sys/file.h ?
12516case "$val" in
12517"$define")
12518 echo " "
12519 if $h_sysfile; then
12520 val="$define"
12521 echo "We'll be including <sys/file.h>." >&4
12522 else
12523 val="$undef"
12524 echo "We won't be including <sys/file.h>." >&4
12525 fi
12526 ;;
12527*)
12528 h_sysfile=false
12529 ;;
12530esac
12531set i_sysfile
12532eval $setvar
12533
12534: see if fcntl.h is there
12535val=''
12536set fcntl.h val
12537eval $inhdr
12538
12539: see if we can include fcntl.h
12540case "$val" in
12541"$define")
12542 echo " "
12543 if $h_fcntl; then
12544 val="$define"
12545 echo "We'll be including <fcntl.h>." >&4
12546 else
12547 val="$undef"
12548 if $h_sysfile; then
12549 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12550 else
12551 echo "We won't be including <fcntl.h>." >&4
12552 fi
12553 fi
12554 ;;
12555*)
12556 h_fcntl=false
12557 val="$undef"
12558 ;;
12559esac
12560set i_fcntl
12561eval $setvar
12562
12563: see if locale.h is available
12564set locale.h i_locale
12565eval $inhdr
12566
7f3d1cf1 12567: see if mach cthreads are available
13666627
JH
12568if test "X$usethreads" = "X$define"; then
12569 set mach/cthreads.h i_machcthr
12570 eval $inhdr
12571else
12572 i_machcthr="$undef"
12573fi
12574
12575
7f3d1cf1 12576
5f80c64f
JH
12577: see if this is a math.h system
12578set math.h i_math
12579eval $inhdr
12580
e7fb4fcc
JH
12581: see if this is a mntent.h system
12582set mntent.h i_mntent
12583eval $inhdr
12584
5f80c64f
JH
12585: see if ndbm.h is available
12586set ndbm.h t_ndbm
12587eval $inhdr
12588case "$t_ndbm" in
12589$define)
12590 : see if dbm_open exists
12591 set dbm_open d_dbm_open
12592 eval $inlibc
12593 case "$d_dbm_open" in
12594 $undef)
12595 t_ndbm="$undef"
12596 echo "We won't be including <ndbm.h>"
12597 ;;
12598 esac
12599 ;;
12600esac
12601val="$t_ndbm"
12602set i_ndbm
12603eval $setvar
12604
12605: see if net/errno.h is available
12606val=''
12607set net/errno.h val
12608eval $inhdr
12609
12610: Unfortunately, it causes problems on some systems. Arrgh.
12611case "$val" in
12612$define)
12613 cat > try.c <<'EOM'
12614#include <stdio.h>
12615#include <errno.h>
12616#include <net/errno.h>
12617int func()
12618{
12619 return ENOTSOCK;
12620}
12621EOM
12622 if $cc $ccflags -c try.c >/dev/null 2>&1; then
12623 echo "We'll be including <net/errno.h>." >&4
12624 else
12625 echo "We won't be including <net/errno.h>." >&4
12626 val="$undef"
12627 fi
12628 $rm -f try.* try
12629 ;;
12630esac
12631set i_neterrno
12632eval $setvar
12633
9cc6feab
JH
12634: see if netinet/tcp.h is available
12635set netinet/tcp.h i_netinettcp
12636eval $inhdr
12637
5b34fd99
JH
12638: see if this is a poll.h system
12639set poll.h i_poll
12640eval $inhdr
12641
5f80c64f
JH
12642: get C preprocessor symbols handy
12643echo " "
12644$echo $n "Hmm... $c"
12645echo $al | $tr ' ' $trnl >Cppsym.know
12646$cat <<EOSS >Cppsym
12647$startsh
12648case "\$1" in
12649-l) list=true
12650 shift
12651 ;;
12652esac
12653unknown=''
12654case "\$list\$#" in
126551|2)
12656 for sym do
12657 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12658 exit 0
12659 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12660 :
12661 else
12662 unknown="\$unknown \$sym"
12663 fi
12664 done
12665 set X \$unknown
12666 shift
12667 ;;
12668esac
12669case \$# in
126700) exit 1;;
12671esac
12672echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12673#ifdef \1\\
12674exit 0; _ _ _ _\1\\ \1\\
12675#endif\\
12676/' >Cppsym\$\$
12677echo "exit 1; _ _ _" >>Cppsym\$\$
12678$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
12679case "\$list" in
12680true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12681*)
12682 sh Cppsym2\$\$
12683 status=\$?
12684 ;;
12685esac
12686$rm -f Cppsym\$\$ Cppsym2\$\$
12687exit \$status
12688EOSS
12689chmod +x Cppsym
12690$eunicefix Cppsym
12691./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12692
12693: now check the C compiler for additional symbols
c4747d3e
JH
12694postprocess_cc_v=''
12695case "$osname" in
12696aix) postprocess_cc_v="|$tr , ' '" ;;
12697esac
5f80c64f
JH
12698$cat >ccsym <<EOS
12699$startsh
12700$cat >tmp.c <<EOF
12701extern int foo;
12702EOF
c4747d3e 12703for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
12704do
12705 case "\$i" in
12706 -D*) echo "\$i" | $sed 's/^-D//';;
12707 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12708 esac
12709done
12710$rm -f try.c
12711EOS
2000072c 12712postprocess_cc_v=''
5f80c64f
JH
12713chmod +x ccsym
12714$eunicefix ccsym
12715./ccsym > ccsym1.raw
12716if $test -s ccsym1.raw; then
12717 $sort ccsym1.raw | $uniq >ccsym.raw
12718else
12719 mv ccsym1.raw ccsym.raw
12720fi
12721
12722$awk '/\=/ { print $0; next }
12723 { print $0"=1" }' ccsym.raw >ccsym.list
12724$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12725$comm -13 ccsym.true ccsym.list >ccsym.own
12726$comm -12 ccsym.true ccsym.list >ccsym.com
12727$comm -23 ccsym.true ccsym.list >ccsym.cpp
12728also=''
5f80c64f 12729if $test -z ccsym.raw; then
ff49bff8 12730 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 12731 echo " "
ff49bff8 12732 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 12733 $cat Cppsym.true
ff49bff8
JH
12734 ccsymbols=''
12735 cppsymbols=`$cat Cppsym.true`
918c3d21 12736 cppsymbols=`echo $cppsymbols`
ff49bff8 12737 cppccsymbols="$cppsymbols"
5f80c64f
JH
12738else
12739 if $test -s ccsym.com; then
12740 echo "Your C compiler and pre-processor define these symbols:"
12741 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12742 also='also '
12743 symbols='ones'
ff49bff8 12744 cppccsymbols=`$cat ccsym.com`
918c3d21 12745 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
12746 $test "$silent" || sleep 1
12747 fi
12748 if $test -s ccsym.cpp; then
12749 $test "$also" && echo " "
ff49bff8 12750 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
12751 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12752 also='further '
ff49bff8 12753 cppsymbols=`$cat ccsym.cpp`
918c3d21 12754 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
12755 $test "$silent" || sleep 1
12756 fi
12757 if $test -s ccsym.own; then
12758 $test "$also" && echo " "
ff49bff8 12759 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
12760 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12761 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 12762 ccsymbols=`$cat ccsym.own`
918c3d21 12763 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
12764 $test "$silent" || sleep 1
12765 fi
12766fi
12767$rm -f ccsym*
12768
12769: see if this is a termio system
12770val="$undef"
12771val2="$undef"
12772val3="$undef"
12773if $test `./findhdr termios.h`; then
12774 set tcsetattr i_termios
12775 eval $inlibc
12776 val3="$i_termios"
12777fi
12778echo " "
12779case "$val3" in
12780"$define") echo "You have POSIX termios.h... good!" >&4;;
12781*) if ./Cppsym pyr; then
12782 case "`/bin/universe`" in
12783 ucb) if $test `./findhdr sgtty.h`; then
12784 val2="$define"
12785 echo "<sgtty.h> found." >&4
12786 else
12787 echo "System is pyramid with BSD universe."
12788 echo "<sgtty.h> not found--you could have problems." >&4
12789 fi;;
12790 *) if $test `./findhdr termio.h`; then
12791 val="$define"
12792 echo "<termio.h> found." >&4
12793 else
12794 echo "System is pyramid with USG universe."
12795 echo "<termio.h> not found--you could have problems." >&4
12796 fi;;
12797 esac
12798 elif ./usg; then
12799 if $test `./findhdr termio.h`; then
12800 echo "<termio.h> found." >&4
12801 val="$define"
12802 elif $test `./findhdr sgtty.h`; then
12803 echo "<sgtty.h> found." >&4
12804 val2="$define"
12805 else
12806echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12807 fi
12808 else
12809 if $test `./findhdr sgtty.h`; then
12810 echo "<sgtty.h> found." >&4
12811 val2="$define"
12812 elif $test `./findhdr termio.h`; then
12813 echo "<termio.h> found." >&4
12814 val="$define"
12815 else
12816echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12817 fi
12818 fi;;
12819esac
12820set i_termio; eval $setvar
12821val=$val2; set i_sgtty; eval $setvar
12822val=$val3; set i_termios; eval $setvar
12823
f1066039
JH
12824: see if this is a shadow.h system
12825set shadow.h i_shadow
12826eval $inhdr
12827
86959918
JH
12828: see if this is a socks.h system
12829set socks.h i_socks
12830eval $inhdr
12831
5f80c64f
JH
12832: see if stdarg is available
12833echo " "
12834if $test `./findhdr stdarg.h`; then
12835 echo "<stdarg.h> found." >&4
12836 valstd="$define"
12837else
12838 echo "<stdarg.h> NOT found." >&4
12839 valstd="$undef"
12840fi
12841
12842: see if varags is available
12843echo " "
12844if $test `./findhdr varargs.h`; then
12845 echo "<varargs.h> found." >&4
12846else
12847 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12848fi
12849
12850: set up the varargs testing programs
12851$cat > varargs.c <<EOP
12852#ifdef I_STDARG
12853#include <stdarg.h>
12854#endif
12855#ifdef I_VARARGS
12856#include <varargs.h>
12857#endif
12858
12859#ifdef I_STDARG
12860int f(char *p, ...)
12861#else
12862int f(va_alist)
12863va_dcl
12864#endif
12865{
12866 va_list ap;
12867#ifndef I_STDARG
12868 char *p;
12869#endif
12870#ifdef I_STDARG
12871 va_start(ap,p);
12872#else
12873 va_start(ap);
12874 p = va_arg(ap, char *);
12875#endif
12876 va_end(ap);
12877}
12878EOP
12879$cat > varargs <<EOP
12880$startsh
12881if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12882 echo "true"
12883else
12884 echo "false"
12885fi
12886$rm -f varargs$_o
12887EOP
12888chmod +x varargs
12889
12890: now check which varargs header should be included
12891echo " "
12892i_varhdr=''
12893case "$valstd" in
12894"$define")
12895 if `./varargs I_STDARG`; then
12896 val='stdarg.h'
12897 elif `./varargs I_VARARGS`; then
12898 val='varargs.h'
12899 fi
12900 ;;
12901*)
12902 if `./varargs I_VARARGS`; then
12903 val='varargs.h'
12904 fi
12905 ;;
12906esac
12907case "$val" in
12908'')
12909echo "I could not find the definition for va_dcl... You have problems..." >&4
12910 val="$undef"; set i_stdarg; eval $setvar
12911 val="$undef"; set i_varargs; eval $setvar
12912 ;;
12913*)
12914 set i_varhdr
12915 eval $setvar
12916 case "$i_varhdr" in
12917 stdarg.h)
12918 val="$define"; set i_stdarg; eval $setvar
12919 val="$undef"; set i_varargs; eval $setvar
12920 ;;
12921 varargs.h)
12922 val="$undef"; set i_stdarg; eval $setvar
12923 val="$define"; set i_varargs; eval $setvar
12924 ;;
12925 esac
12926 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12927esac
12928$rm -f varargs*
12929
12930: see if stddef is available
12931set stddef.h i_stddef
12932eval $inhdr
12933
12934: see if sys/access.h is available
12935set sys/access.h i_sysaccess
12936eval $inhdr
12937
12938: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12939set sys/filio.h i_sysfilio
12940eval $inhdr
12941echo " "
12942if $test `./findhdr sys/ioctl.h`; then
12943 val="$define"
12944 echo '<sys/ioctl.h> found.' >&4
12945else
12946 val="$undef"
12947 if $test $i_sysfilio = "$define"; then
12948 echo '<sys/ioctl.h> NOT found.' >&4
12949 else
12950 $test $i_sgtty = "$define" && xxx="sgtty.h"
12951 $test $i_termio = "$define" && xxx="termio.h"
12952 $test $i_termios = "$define" && xxx="termios.h"
12953echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12954 fi
12955fi
12956set i_sysioctl
12957eval $setvar
12958
5f80c64f
JH
12959: see if sys/resource.h has to be included
12960set sys/resource.h i_sysresrc
12961eval $inhdr
12962
12963: see if sys/security.h is available
12964set sys/security.h i_syssecrt
12965eval $inhdr
12966
104d25b7
JH
12967: see if this is a sys/statvfs.h system
12968set sys/statvfs.h i_sysstatvfs
12969eval $inhdr
12970
5f80c64f
JH
12971: see if this is a sys/un.h system
12972set sys/un.h i_sysun
12973eval $inhdr
12974
12975: see if this is a syswait system
12976set sys/wait.h i_syswait
12977eval $inhdr
12978
12979: see if this is an utime system
12980set utime.h i_utime
12981eval $inhdr
12982
12983: see if this is a values.h system
12984set values.h i_values
12985eval $inhdr
12986
12987: see if this is a vfork system
12988case "$d_vfork" in
12989"$define")
12990 set vfork.h i_vfork
12991 eval $inhdr
12992 ;;
12993*)
12994 i_vfork="$undef"
12995 ;;
12996esac
12997
12998: see if gdbm.h is available
12999set gdbm.h t_gdbm
13000eval $inhdr
13001case "$t_gdbm" in
13002$define)
13003 : see if gdbm_open exists
13004 set gdbm_open d_gdbm_open
13005 eval $inlibc
13006 case "$d_gdbm_open" in
13007 $undef)
13008 t_gdbm="$undef"
13009 echo "We won't be including <gdbm.h>"
13010 ;;
13011 esac
13012 ;;
13013esac
13014val="$t_gdbm"
13015set i_gdbm
13016eval $setvar
13017
13018echo " "
13019echo "Looking for extensions..." >&4
5f80c64f
JH
13020: If we are using the old config.sh, known_extensions may contain
13021: old or inaccurate or duplicate values.
13022known_extensions=''
13023nonxs_extensions=''
13024: We do not use find because it might not be available.
13025: We do not just use MANIFEST because the user may have dropped
13026: some additional extensions into the source tree and expect them
13027: to be built.
7e791ca9
NK
13028
13029: Function to recursively find available extensions, ignoring DynaLoader
13030: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13031find_extensions='
13032 for xxx in *; do
13033 case "$xxx" in
13034 DynaLoader|dynaload) ;;
13035 *)
13036 if $test -f $xxx/$xxx.xs; then
13037 known_extensions="$known_extensions $1$xxx";
13038 elif $test -f $xxx/Makefile.PL; then
13039 nonxs_extensions="$nonxs_extensions $1$xxx";
13040 else
13041 if $test -d $xxx -a $# -lt 10; then
13042 set $1$xxx/ $*;
13043 cd $xxx;
13044 eval $find_extensions;
13045 cd ..;
13046 shift;
9f50e519 13047 fi;
7e791ca9
NK
13048 fi
13049 ;;
9f50e519 13050 esac;
7e791ca9
NK
13051 done'
13052tdir=`pwd`
13053cd $rsrc/ext
a3635516 13054set X
efdb23e1 13055shift
7e791ca9 13056eval $find_extensions
5f80c64f
JH
13057set X $nonxs_extensions
13058shift
13059nonxs_extensions="$*"
13060set X $known_extensions
13061shift
13062known_extensions="$*"
13063cd $tdir
13064
13065: Now see which are supported on this system.
13066avail_ext=''
13067for xxx in $known_extensions ; do
13068 case "$xxx" in
13069 DB_File|db_file)
13070 case "$i_db" in
13071 $define) avail_ext="$avail_ext $xxx" ;;
13072 esac
13073 ;;
13074 GDBM_File|gdbm_fil)
13075 case "$i_gdbm" in
13076 $define) avail_ext="$avail_ext $xxx" ;;
13077 esac
13078 ;;
13079 NDBM_File|ndbm_fil)
13080 case "$i_ndbm" in
13081 $define) avail_ext="$avail_ext $xxx" ;;
13082 esac
13083 ;;
13084 ODBM_File|odbm_fil)
13085 case "${i_dbm}${i_rpcsvcdbm}" in
13086 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13087 esac
13088 ;;
13089 POSIX|posix)
13090 case "$useposix" in
13091 true|define|y) avail_ext="$avail_ext $xxx" ;;
13092 esac
13093 ;;
13094 Opcode|opcode)
13095 case "$useopcode" in
13096 true|define|y) avail_ext="$avail_ext $xxx" ;;
13097 esac
13098 ;;
13099 Socket|socket)
13100 case "$d_socket" in
13101 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13102 esac
13103 ;;
13104 Thread|thread)
13105 case "$usethreads" in
13106 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13107 esac
13108 ;;
13109 IPC/SysV|ipc/sysv)
13110 : XXX Do we need a useipcsysv variable here
13111 case "${d_msg}${d_sem}${d_shm}" in
13112 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13113 esac
13114 ;;
13115 *) avail_ext="$avail_ext $xxx"
13116 ;;
13117 esac
13118done
13119
13120set X $avail_ext
13121shift
13122avail_ext="$*"
13123
13124: Now see which nonxs extensions are supported on this system.
13125: For now assume all are.
13126nonxs_ext=''
13127for xxx in $nonxs_extensions ; do
13128 case "$xxx" in
13129 *) nonxs_ext="$nonxs_ext $xxx"
13130 ;;
13131 esac
13132done
13133
13134set X $nonxs_ext
13135shift
13136nonxs_ext="$*"
13137
13138case $usedl in
13139$define)
13140 $cat <<EOM
13141A number of extensions are supplied with $package. You may choose to
13142compile these extensions for dynamic loading (the default), compile
13143them into the $package executable (static loading), or not include
13144them at all. Answer "none" to include no extensions.
13145Note that DynaLoader is always built and need not be mentioned here.
13146
13147EOM
13148 case "$dynamic_ext" in
13149 '') dflt="$avail_ext" ;;
13150 *) dflt="$dynamic_ext"
13151 # Perhaps we are reusing an old out-of-date config.sh.
13152 case "$hint" in
13153 previous)
13154 if test X"$dynamic_ext" != X"$avail_ext"; then
13155 $cat <<EOM
13156NOTICE: Your previous config.sh list may be incorrect.
13157The extensions now available to you are
13158 ${avail_ext}
13159but the default list from your previous config.sh is
13160 ${dynamic_ext}
13161
13162EOM
13163 fi
13164 ;;
13165 esac
13166 ;;
13167 esac
13168 case "$dflt" in
13169 '') dflt=none;;
13170 esac
13171 rp="What extensions do you wish to load dynamically?"
13172 . ./myread
13173 case "$ans" in
13174 none) dynamic_ext=' ' ;;
13175 *) dynamic_ext="$ans" ;;
13176 esac
13177
13178 case "$static_ext" in
13179 '')
13180 : Exclude those already listed in dynamic linking
13181 dflt=''
13182 for xxx in $avail_ext; do
13183 case " $dynamic_ext " in
13184 *" $xxx "*) ;;
13185 *) dflt="$dflt $xxx" ;;
13186 esac
13187 done
13188 set X $dflt
13189 shift
13190 dflt="$*"
13191 ;;
13192 *) dflt="$static_ext"
13193 ;;
13194 esac
13195
13196 case "$dflt" in
13197 '') dflt=none;;
13198 esac
13199 rp="What extensions do you wish to load statically?"
13200 . ./myread
13201 case "$ans" in
13202 none) static_ext=' ' ;;
13203 *) static_ext="$ans" ;;
13204 esac
13205 ;;
13206*)
13207 $cat <<EOM
13208A number of extensions are supplied with $package. Answer "none"
13209to include no extensions.
13210Note that DynaLoader is always built and need not be mentioned here.
13211
13212EOM
13213 case "$static_ext" in
13214 '') dflt="$avail_ext" ;;
13215 *) dflt="$static_ext"
13216 # Perhaps we are reusing an old out-of-date config.sh.
13217 case "$hint" in
13218 previous)
13219 if test X"$static_ext" != X"$avail_ext"; then
13220 $cat <<EOM
13221NOTICE: Your previous config.sh list may be incorrect.
13222The extensions now available to you are
13223 ${avail_ext}
13224but the default list from your previous config.sh is
13225 ${static_ext}
13226
13227EOM
13228 fi
13229 ;;
13230 esac
13231 ;;
13232 esac
13233 : Exclude those that are not xs extensions
13234 case "$dflt" in
13235 '') dflt=none;;
13236 esac
13237 rp="What extensions do you wish to include?"
13238 . ./myread
13239 case "$ans" in
13240 none) static_ext=' ' ;;
13241 *) static_ext="$ans" ;;
13242 esac
13243 ;;
13244esac
13245
13246set X $dynamic_ext $static_ext $nonxs_ext
13247shift
13248extensions="$*"
13249
13250: Remove build directory name from cppstdin so it can be used from
13251: either the present location or the final installed location.
13252echo " "
13253: Get out of the UU directory to get correct path name.
13254cd ..
13255case "$cppstdin" in
13256`pwd`/cppstdin)
13257 echo "Stripping down cppstdin path name"
13258 cppstdin=cppstdin
13259 ;;
13260esac
13261cd UU
13262
13263: end of configuration questions
13264echo " "
13265echo "End of configuration questions."
13266echo " "
13267
13268: back to where it started
13269if test -d ../UU; then
13270 cd ..
13271fi
13272
13273: configuration may be patched via a 'config.over' file
13274if $test -f config.over; then
13275 echo " "
13276 dflt=y
13277 rp='I see a config.over file. Do you wish to load it?'
13278 . UU/myread
13279 case "$ans" in
13280 n*) echo "OK, I'll ignore it.";;
13281 *) . ./config.over
13282 echo "Configuration override changes have been loaded."
13283 ;;
13284 esac
13285fi
13286
13287: in case they want portability, strip down executable paths
13288case "$d_portable" in
13289"$define")
13290 echo " "
13291 echo "Stripping down executable paths..." >&4
13292 for file in $loclist $trylist; do
534ac15a
JH
13293 eval temp=\$$file
13294 eval $file=`basename $temp`
5f80c64f
JH
13295 done
13296 ;;
13297esac
13298
13299: create config.sh file
13300echo " "
13301echo "Creating config.sh..." >&4
13302$spitshell <<EOT >config.sh
13303$startsh
13304#
13305# This file was produced by running the Configure script. It holds all the
13306# definitions figured out by Configure. Should you modify one of these values,
13307# do not forget to propagate your changes by running "Configure -der". You may
13308# instead choose to run each of the .SH files by yourself, or "Configure -S".
13309#
13310
13311# Package name : $package
13312# Source directory : $src
13313# Configuration time: $cf_time
13314# Configured by : $cf_by
13315# Target system : $myuname
13316
13317Author='$Author'
13318Date='$Date'
13319Header='$Header'
13320Id='$Id'
13321Locker='$Locker'
13322Log='$Log'
13323Mcc='$Mcc'
13324RCSfile='$RCSfile'
13325Revision='$Revision'
13326Source='$Source'
13327State='$State'
13328_a='$_a'
13329_exe='$_exe'
13330_o='$_o'
13331afs='$afs'
13332alignbytes='$alignbytes'
13333ansi2knr='$ansi2knr'
13334aphostname='$aphostname'
13335apiversion='$apiversion'
13336ar='$ar'
13337archlib='$archlib'
13338archlibexp='$archlibexp'
13339archname64='$archname64'
13340archname='$archname'
13341archobjs='$archobjs'
13342awk='$awk'
13343baserev='$baserev'
13344bash='$bash'
13345bin='$bin'
d71b2b6b 13346bincompat5005='$bincompat5005'
5f80c64f
JH
13347binexp='$binexp'
13348bison='$bison'
13349byacc='$byacc'
13350byteorder='$byteorder'
13351c='$c'
13352castflags='$castflags'
13353cat='$cat'
13354cc='$cc'
13355cccdlflags='$cccdlflags'
13356ccdlflags='$ccdlflags'
13357ccflags='$ccflags'
ff49bff8 13358ccsymbols='$ccsymbols'
5f80c64f
JH
13359cf_by='$cf_by'
13360cf_email='$cf_email'
13361cf_time='$cf_time'
13362chgrp='$chgrp'
13363chmod='$chmod'
13364chown='$chown'
13365clocktype='$clocktype'
13366comm='$comm'
13367compress='$compress'
13368contains='$contains'
13369cp='$cp'
13370cpio='$cpio'
13371cpp='$cpp'
13372cpp_stuff='$cpp_stuff'
ff49bff8 13373cppccsymbols='$cppccsymbols'
5f80c64f
JH
13374cppflags='$cppflags'
13375cpplast='$cpplast'
13376cppminus='$cppminus'
13377cpprun='$cpprun'
13378cppstdin='$cppstdin'
ff49bff8 13379cppsymbols='$cppsymbols'
68c15b6f 13380crosscompile='$crosscompile'
5f80c64f
JH
13381cryptlib='$cryptlib'
13382csh='$csh'
13383d_Gconvert='$d_Gconvert'
cf2093f6
JH
13384d_PRIEldbl='$d_PRIEldbl'
13385d_PRIFldbl='$d_PRIFldbl'
13386d_PRIGldbl='$d_PRIGldbl'
13387d_PRIX64='$d_PRIX64'
13388d_PRId64='$d_PRId64'
13389d_PRIeldbl='$d_PRIeldbl'
13390d_PRIfldbl='$d_PRIfldbl'
13391d_PRIgldbl='$d_PRIgldbl'
13392d_PRIi64='$d_PRIi64'
13393d_PRIo64='$d_PRIo64'
13394d_PRIu64='$d_PRIu64'
13395d_PRIx64='$d_PRIx64'
5f80c64f
JH
13396d_access='$d_access'
13397d_accessx='$d_accessx'
13398d_alarm='$d_alarm'
13399d_archlib='$d_archlib'
cf2093f6
JH
13400d_atolf='$d_atolf'
13401d_atoll='$d_atoll'
5f80c64f
JH
13402d_attribut='$d_attribut'
13403d_bcmp='$d_bcmp'
13404d_bcopy='$d_bcopy'
d71b2b6b 13405d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
13406d_bsd='$d_bsd'
13407d_bsdgetpgrp='$d_bsdgetpgrp'
13408d_bsdsetpgrp='$d_bsdsetpgrp'
13409d_bzero='$d_bzero'
13410d_casti32='$d_casti32'
13411d_castneg='$d_castneg'
13412d_charvspr='$d_charvspr'
13413d_chown='$d_chown'
13414d_chroot='$d_chroot'
13415d_chsize='$d_chsize'
13416d_closedir='$d_closedir'
de4597cb 13417d_cmsghdr_s='$d_cmsghdr_s'
5f80c64f
JH
13418d_const='$d_const'
13419d_crypt='$d_crypt'
13420d_csh='$d_csh'
13421d_cuserid='$d_cuserid'
13422d_dbl_dig='$d_dbl_dig'
5f80c64f 13423d_difftime='$d_difftime'
5f80c64f
JH
13424d_dirnamlen='$d_dirnamlen'
13425d_dlerror='$d_dlerror'
13426d_dlopen='$d_dlopen'
13427d_dlsymun='$d_dlsymun'
13428d_dosuid='$d_dosuid'
13429d_drand48proto='$d_drand48proto'
13430d_dup2='$d_dup2'
13431d_eaccess='$d_eaccess'
13432d_endgrent='$d_endgrent'
13433d_endhent='$d_endhent'
13434d_endnent='$d_endnent'
13435d_endpent='$d_endpent'
13436d_endpwent='$d_endpwent'
13437d_endsent='$d_endsent'
f1066039 13438d_endspent='$d_endspent'
5f80c64f
JH
13439d_eofnblk='$d_eofnblk'
13440d_eunice='$d_eunice'
13441d_fchmod='$d_fchmod'
13442d_fchown='$d_fchown'
13443d_fcntl='$d_fcntl'
13444d_fd_macros='$d_fd_macros'
13445d_fd_set='$d_fd_set'
13446d_fds_bits='$d_fds_bits'
5f80c64f 13447d_fgetpos='$d_fgetpos'
5f80c64f 13448d_flexfnam='$d_flexfnam'
5f80c64f 13449d_flock='$d_flock'
5f80c64f
JH
13450d_fork='$d_fork'
13451d_fpathconf='$d_fpathconf'
d9b3e12d 13452d_fpos64_t='$d_fpos64_t'
5f80c64f 13453d_fseeko='$d_fseeko'
5f80c64f 13454d_fsetpos='$d_fsetpos'
104d25b7
JH
13455d_fstatfs='$d_fstatfs'
13456d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
13457d_ftello='$d_ftello'
13458d_ftime='$d_ftime'
5f80c64f
JH
13459d_getgrent='$d_getgrent'
13460d_getgrps='$d_getgrps'
13461d_gethbyaddr='$d_gethbyaddr'
13462d_gethbyname='$d_gethbyname'
13463d_gethent='$d_gethent'
13464d_gethname='$d_gethname'
13465d_gethostprotos='$d_gethostprotos'
13466d_getlogin='$d_getlogin'
ccc7f9b3 13467d_getmntent='$d_getmntent'
5f80c64f
JH
13468d_getnbyaddr='$d_getnbyaddr'
13469d_getnbyname='$d_getnbyname'
13470d_getnent='$d_getnent'
13471d_getnetprotos='$d_getnetprotos'
13472d_getpbyname='$d_getpbyname'
13473d_getpbynumber='$d_getpbynumber'
13474d_getpent='$d_getpent'
13475d_getpgid='$d_getpgid'
13476d_getpgrp2='$d_getpgrp2'
13477d_getpgrp='$d_getpgrp'
13478d_getppid='$d_getppid'
13479d_getprior='$d_getprior'
13480d_getprotoprotos='$d_getprotoprotos'
13481d_getpwent='$d_getpwent'
13482d_getsbyname='$d_getsbyname'
13483d_getsbyport='$d_getsbyport'
13484d_getsent='$d_getsent'
13485d_getservprotos='$d_getservprotos'
f1066039
JH
13486d_getspent='$d_getspent'
13487d_getspnam='$d_getspnam'
5f80c64f
JH
13488d_gettimeod='$d_gettimeod'
13489d_gnulibc='$d_gnulibc'
13490d_grpasswd='$d_grpasswd'
ccc7f9b3 13491d_hasmntopt='$d_hasmntopt'
5f80c64f
JH
13492d_htonl='$d_htonl'
13493d_index='$d_index'
13494d_inetaton='$d_inetaton'
5f80c64f 13495d_int64t='$d_int64t'
de4597cb 13496d_iovec_s='$d_iovec_s'
5f80c64f
JH
13497d_isascii='$d_isascii'
13498d_killpg='$d_killpg'
13499d_lchown='$d_lchown'
2d4389e4 13500d_ldbl_dig='$d_ldbl_dig'
5f80c64f 13501d_link='$d_link'
2000072c 13502d_llseek='$d_llseek'
5f80c64f 13503d_locconv='$d_locconv'
5f80c64f
JH
13504d_lockf='$d_lockf'
13505d_longdbl='$d_longdbl'
13506d_longlong='$d_longlong'
5f80c64f 13507d_lstat='$d_lstat'
ff49bff8 13508d_madvise='$d_madvise'
5f80c64f
JH
13509d_mblen='$d_mblen'
13510d_mbstowcs='$d_mbstowcs'
13511d_mbtowc='$d_mbtowc'
0f27ced1 13512d_memchr='$d_memchr'
5f80c64f
JH
13513d_memcmp='$d_memcmp'
13514d_memcpy='$d_memcpy'
13515d_memmove='$d_memmove'
13516d_memset='$d_memset'
13517d_mkdir='$d_mkdir'
13518d_mkfifo='$d_mkfifo'
13519d_mktime='$d_mktime'
ff49bff8
JH
13520d_mmap='$d_mmap'
13521d_mprotect='$d_mprotect'
5f80c64f 13522d_msg='$d_msg'
de4597cb
JH
13523d_msg_ctrunc='$d_msg_ctrunc'
13524d_msg_dontroute='$d_msg_dontroute'
13525d_msg_oob='$d_msg_oob'
13526d_msg_peek='$d_msg_peek'
13527d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
13528d_msgctl='$d_msgctl'
13529d_msgget='$d_msgget'
de4597cb 13530d_msghdr_s='$d_msghdr_s'
5f80c64f
JH
13531d_msgrcv='$d_msgrcv'
13532d_msgsnd='$d_msgsnd'
ff49bff8
JH
13533d_msync='$d_msync'
13534d_munmap='$d_munmap'
5f80c64f 13535d_mymalloc='$d_mymalloc'
5f80c64f 13536d_nice='$d_nice'
2000072c 13537d_off64_t='$d_off64_t'
ef4af2be 13538d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
13539d_oldpthreads='$d_oldpthreads'
13540d_oldsock='$d_oldsock'
13541d_open3='$d_open3'
5f80c64f
JH
13542d_pathconf='$d_pathconf'
13543d_pause='$d_pause'
13544d_phostname='$d_phostname'
13545d_pipe='$d_pipe'
13546d_poll='$d_poll'
13547d_portable='$d_portable'
13548d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
13549d_pwage='$d_pwage'
13550d_pwchange='$d_pwchange'
13551d_pwclass='$d_pwclass'
13552d_pwcomment='$d_pwcomment'
13553d_pwexpire='$d_pwexpire'
13554d_pwgecos='$d_pwgecos'
13555d_pwpasswd='$d_pwpasswd'
13556d_pwquota='$d_pwquota'
5f80c64f
JH
13557d_readdir='$d_readdir'
13558d_readlink='$d_readlink'
de4597cb
JH
13559d_readv='$d_readv'
13560d_recvmsg='$d_recvmsg'
5f80c64f
JH
13561d_rename='$d_rename'
13562d_rewinddir='$d_rewinddir'
13563d_rmdir='$d_rmdir'
13564d_safebcpy='$d_safebcpy'
13565d_safemcpy='$d_safemcpy'
13566d_sanemcmp='$d_sanemcmp'
13567d_sched_yield='$d_sched_yield'
de4597cb 13568d_scm_rights='$d_scm_rights'
5f80c64f
JH
13569d_seekdir='$d_seekdir'
13570d_select='$d_select'
13571d_sem='$d_sem'
13572d_semctl='$d_semctl'
13573d_semctl_semid_ds='$d_semctl_semid_ds'
13574d_semctl_semun='$d_semctl_semun'
13575d_semget='$d_semget'
13576d_semop='$d_semop'
de4597cb 13577d_sendmsg='$d_sendmsg'
5f80c64f
JH
13578d_setegid='$d_setegid'
13579d_seteuid='$d_seteuid'
13580d_setgrent='$d_setgrent'
13581d_setgrps='$d_setgrps'
13582d_sethent='$d_sethent'
13583d_setlinebuf='$d_setlinebuf'
13584d_setlocale='$d_setlocale'
13585d_setnent='$d_setnent'
13586d_setpent='$d_setpent'
13587d_setpgid='$d_setpgid'
13588d_setpgrp2='$d_setpgrp2'
13589d_setpgrp='$d_setpgrp'
13590d_setprior='$d_setprior'
13591d_setpwent='$d_setpwent'
13592d_setregid='$d_setregid'
13593d_setresgid='$d_setresgid'
13594d_setresuid='$d_setresuid'
13595d_setreuid='$d_setreuid'
13596d_setrgid='$d_setrgid'
13597d_setruid='$d_setruid'
13598d_setsent='$d_setsent'
13599d_setsid='$d_setsid'
f1066039 13600d_setspent='$d_setspent'
5f80c64f
JH
13601d_setvbuf='$d_setvbuf'
13602d_sfio='$d_sfio'
13603d_shm='$d_shm'
13604d_shmat='$d_shmat'
13605d_shmatprototype='$d_shmatprototype'
13606d_shmctl='$d_shmctl'
13607d_shmdt='$d_shmdt'
13608d_shmget='$d_shmget'
13609d_sigaction='$d_sigaction'
13610d_sigsetjmp='$d_sigsetjmp'
13611d_socket='$d_socket'
13612d_sockpair='$d_sockpair'
5f80c64f 13613d_statblks='$d_statblks'
104d25b7
JH
13614d_statfs='$d_statfs'
13615d_statfsflags='$d_statfsflags'
13616d_statvfs='$d_statvfs'
5f80c64f
JH
13617d_stdio_cnt_lval='$d_stdio_cnt_lval'
13618d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 13619d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
13620d_stdiobase='$d_stdiobase'
13621d_stdstdio='$d_stdstdio'
5f80c64f
JH
13622d_strchr='$d_strchr'
13623d_strcoll='$d_strcoll'
13624d_strctcpy='$d_strctcpy'
13625d_strerrm='$d_strerrm'
13626d_strerror='$d_strerror'
13627d_strtod='$d_strtod'
13628d_strtol='$d_strtol'
13629d_strtoul='$d_strtoul'
cf2093f6 13630d_strtoull='$d_strtoull'
5f80c64f
JH
13631d_strxfrm='$d_strxfrm'
13632d_suidsafe='$d_suidsafe'
13633d_symlink='$d_symlink'
13634d_syscall='$d_syscall'
13635d_sysconf='$d_sysconf'
13636d_sysernlst='$d_sysernlst'
13637d_syserrlst='$d_syserrlst'
13638d_system='$d_system'
13639d_tcgetpgrp='$d_tcgetpgrp'
13640d_tcsetpgrp='$d_tcsetpgrp'
5f80c64f 13641d_telldir='$d_telldir'
cb86ce0e 13642d_telldirproto='$d_telldirproto'
5f80c64f
JH
13643d_time='$d_time'
13644d_times='$d_times'
5f80c64f
JH
13645d_truncate='$d_truncate'
13646d_tzname='$d_tzname'
13647d_umask='$d_umask'
13648d_uname='$d_uname'
13649d_union_semun='$d_union_semun'
a3635516 13650d_vendorlib='$d_vendorlib'
5f80c64f
JH
13651d_vfork='$d_vfork'
13652d_void_closedir='$d_void_closedir'
13653d_voidsig='$d_voidsig'
13654d_voidtty='$d_voidtty'
13655d_volatile='$d_volatile'
13656d_vprintf='$d_vprintf'
13657d_wait4='$d_wait4'
13658d_waitpid='$d_waitpid'
13659d_wcstombs='$d_wcstombs'
13660d_wctomb='$d_wctomb'
de4597cb 13661d_writev='$d_writev'
5f80c64f
JH
13662d_xenix='$d_xenix'
13663date='$date'
13664db_hashtype='$db_hashtype'
13665db_prefixtype='$db_prefixtype'
13666defvoidused='$defvoidused'
13667direntrytype='$direntrytype'
13668dlext='$dlext'
13669dlsrc='$dlsrc'
13670doublesize='$doublesize'
13671drand01='$drand01'
13672dynamic_ext='$dynamic_ext'
13673eagain='$eagain'
13674ebcdic='$ebcdic'
13675echo='$echo'
13676egrep='$egrep'
13677emacs='$emacs'
13678eunicefix='$eunicefix'
13679exe_ext='$exe_ext'
13680expr='$expr'
13681extensions='$extensions'
66fe083f 13682fflushNULL='$fflushNULL'
767df6a1 13683fflushall='$fflushall'
5f80c64f
JH
13684find='$find'
13685firstmakefile='$firstmakefile'
13686flex='$flex'
13687fpostype='$fpostype'
13688freetype='$freetype'
ccc7f9b3 13689full_ar='$full_ar'
5f80c64f
JH
13690full_csh='$full_csh'
13691full_sed='$full_sed'
13692gccversion='$gccversion'
13693gidtype='$gidtype'
13694glibpth='$glibpth'
13695grep='$grep'
13696groupcat='$groupcat'
13697groupstype='$groupstype'
13698gzip='$gzip'
13699h_fcntl='$h_fcntl'
13700h_sysfile='$h_sysfile'
13701hint='$hint'
13702hostcat='$hostcat'
13703huge='$huge'
13704i_arpainet='$i_arpainet'
13705i_bsdioctl='$i_bsdioctl'
13706i_db='$i_db'
13707i_dbm='$i_dbm'
13708i_dirent='$i_dirent'
13709i_dld='$i_dld'
13710i_dlfcn='$i_dlfcn'
13711i_fcntl='$i_fcntl'
13712i_float='$i_float'
13713i_gdbm='$i_gdbm'
13714i_grp='$i_grp'
13715i_inttypes='$i_inttypes'
13716i_limits='$i_limits'
13717i_locale='$i_locale'
7f3d1cf1 13718i_machcthr='$i_machcthr'
5f80c64f
JH
13719i_malloc='$i_malloc'
13720i_math='$i_math'
13721i_memory='$i_memory'
e7fb4fcc 13722i_mntent='$i_mntent'
5f80c64f
JH
13723i_ndbm='$i_ndbm'
13724i_netdb='$i_netdb'
13725i_neterrno='$i_neterrno'
9cc6feab 13726i_netinettcp='$i_netinettcp'
5f80c64f 13727i_niin='$i_niin'
5b34fd99 13728i_poll='$i_poll'
c4747d3e 13729i_pthread='$i_pthread'
5f80c64f
JH
13730i_pwd='$i_pwd'
13731i_rpcsvcdbm='$i_rpcsvcdbm'
13732i_sfio='$i_sfio'
13733i_sgtty='$i_sgtty'
f1066039 13734i_shadow='$i_shadow'
86959918 13735i_socks='$i_socks'
5f80c64f
JH
13736i_stdarg='$i_stdarg'
13737i_stddef='$i_stddef'
13738i_stdlib='$i_stdlib'
13739i_string='$i_string'
13740i_sysaccess='$i_sysaccess'
13741i_sysdir='$i_sysdir'
13742i_sysfile='$i_sysfile'
13743i_sysfilio='$i_sysfilio'
13744i_sysin='$i_sysin'
13745i_sysioctl='$i_sysioctl'
ff49bff8 13746i_sysmman='$i_sysmman'
104d25b7 13747i_sysmount='$i_sysmount'
5f80c64f
JH
13748i_sysndir='$i_sysndir'
13749i_sysparam='$i_sysparam'
13750i_sysresrc='$i_sysresrc'
13751i_syssecrt='$i_syssecrt'
13752i_sysselct='$i_sysselct'
13753i_syssockio='$i_syssockio'
13754i_sysstat='$i_sysstat'
104d25b7 13755i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
13756i_systime='$i_systime'
13757i_systimek='$i_systimek'
13758i_systimes='$i_systimes'
13759i_systypes='$i_systypes'
de4597cb 13760i_sysuio='$i_sysuio'
5f80c64f
JH
13761i_sysun='$i_sysun'
13762i_syswait='$i_syswait'
13763i_termio='$i_termio'
13764i_termios='$i_termios'
13765i_time='$i_time'
13766i_unistd='$i_unistd'
13767i_utime='$i_utime'
13768i_values='$i_values'
13769i_varargs='$i_varargs'
13770i_varhdr='$i_varhdr'
13771i_vfork='$i_vfork'
13772ignore_versioned_solibs='$ignore_versioned_solibs'
13773incpath='$incpath'
13774inews='$inews'
13775installarchlib='$installarchlib'
13776installbin='$installbin'
13777installman1dir='$installman1dir'
13778installman3dir='$installman3dir'
dd4e71fd
JH
13779installprefix='$installprefix'
13780installprefixexp='$installprefixexp'
5f80c64f
JH
13781installprivlib='$installprivlib'
13782installscript='$installscript'
13783installsitearch='$installsitearch'
13784installsitelib='$installsitelib'
dd4e71fd 13785installstyle='$installstyle'
104d25b7 13786installusrbinperl='$installusrbinperl'
a3635516 13787installvendorlib='$installvendorlib'
5f80c64f
JH
13788intsize='$intsize'
13789known_extensions='$known_extensions'
13790ksh='$ksh'
13791large='$large'
13792ld='$ld'
13793lddlflags='$lddlflags'
13794ldflags='$ldflags'
5cf1d1f1 13795ldlibpthname='$ldlibpthname'
5f80c64f
JH
13796less='$less'
13797lib_ext='$lib_ext'
13798libc='$libc'
13799libperl='$libperl'
13800libpth='$libpth'
13801libs='$libs'
13802libswanted='$libswanted'
13803line='$line'
13804lint='$lint'
13805lkflags='$lkflags'
13806ln='$ln'
13807lns='$lns'
13808locincpth='$locincpth'
13809loclibpth='$loclibpth'
13810longdblsize='$longdblsize'
13811longlongsize='$longlongsize'
13812longsize='$longsize'
13813lp='$lp'
13814lpr='$lpr'
13815ls='$ls'
13816lseeksize='$lseeksize'
13817lseektype='$lseektype'
13818mail='$mail'
13819mailx='$mailx'
13820make='$make'
13821make_set_make='$make_set_make'
13822mallocobj='$mallocobj'
13823mallocsrc='$mallocsrc'
13824malloctype='$malloctype'
13825man1dir='$man1dir'
13826man1direxp='$man1direxp'
13827man1ext='$man1ext'
13828man3dir='$man3dir'
13829man3direxp='$man3direxp'
13830man3ext='$man3ext'
13831medium='$medium'
13832mips='$mips'
13833mips_type='$mips_type'
13834mkdir='$mkdir'
ff49bff8 13835mmaptype='$mmaptype'
5f80c64f
JH
13836models='$models'
13837modetype='$modetype'
13838more='$more'
68c15b6f 13839multiarch='$multiarch'
5f80c64f
JH
13840mv='$mv'
13841myarchname='$myarchname'
13842mydomain='$mydomain'
13843myhostname='$myhostname'
13844myuname='$myuname'
13845n='$n'
13846netdb_hlen_type='$netdb_hlen_type'
13847netdb_host_type='$netdb_host_type'
13848netdb_name_type='$netdb_name_type'
13849netdb_net_type='$netdb_net_type'
13850nm='$nm'
13851nm_opt='$nm_opt'
13852nm_so_opt='$nm_so_opt'
13853nonxs_ext='$nonxs_ext'
13854nroff='$nroff'
13855o_nonblock='$o_nonblock'
13856obj_ext='$obj_ext'
ef4af2be 13857old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
13858optimize='$optimize'
13859orderlib='$orderlib'
13860osname='$osname'
13861osvers='$osvers'
13862package='$package'
13863pager='$pager'
13864passcat='$passcat'
13865patchlevel='$patchlevel'
13866path_sep='$path_sep'
13867perl='$perl'
13868perladmin='$perladmin'
13869perlpath='$perlpath'
13870pg='$pg'
13871phostname='$phostname'
13872pidtype='$pidtype'
13873plibpth='$plibpth'
13874pmake='$pmake'
13875pr='$pr'
13876prefix='$prefix'
13877prefixexp='$prefixexp'
13878privlib='$privlib'
13879privlibexp='$privlibexp'
13880prototype='$prototype'
13881ptrsize='$ptrsize'
13882randbits='$randbits'
13883randfunc='$randfunc'
13884randseedtype='$randseedtype'
13885ranlib='$ranlib'
13886rd_nodata='$rd_nodata'
13887rm='$rm'
13888rmail='$rmail'
13889runnm='$runnm'
cf2093f6
JH
13890sPRIEldbl='$sPRIEldbl'
13891sPRIFldbl='$sPRIFldbl'
13892sPRIGldbl='$sPRIGldbl'
13893sPRIX64='$sPRIX64'
13894sPRId64='$sPRId64'
13895sPRIeldbl='$sPRIeldbl'
13896sPRIfldbl='$sPRIfldbl'
13897sPRIgldbl='$sPRIgldbl'
13898sPRIi64='$sPRIi64'
13899sPRIo64='$sPRIo64'
13900sPRIu64='$sPRIu64'
13901sPRIx64='$sPRIx64'
5f80c64f
JH
13902sched_yield='$sched_yield'
13903scriptdir='$scriptdir'
13904scriptdirexp='$scriptdirexp'
13905sed='$sed'
13906seedfunc='$seedfunc'
13907selectminbits='$selectminbits'
13908selecttype='$selecttype'
13909sendmail='$sendmail'
13910sh='$sh'
13911shar='$shar'
13912sharpbang='$sharpbang'
13913shmattype='$shmattype'
13914shortsize='$shortsize'
13915shrpenv='$shrpenv'
13916shsharp='$shsharp'
af4c28eb 13917sig_count='$sig_count'
5f80c64f
JH
13918sig_name='$sig_name'
13919sig_name_init='$sig_name_init'
13920sig_num='$sig_num'
824a2ba3 13921sig_num_init='$sig_num_init'
5f80c64f
JH
13922signal_t='$signal_t'
13923sitearch='$sitearch'
13924sitearchexp='$sitearchexp'
13925sitelib='$sitelib'
13926sitelibexp='$sitelibexp'
dd4e71fd
JH
13927siteprefix='$siteprefix'
13928siteprefixexp='$siteprefixexp'
5f80c64f
JH
13929sizetype='$sizetype'
13930sleep='$sleep'
13931smail='$smail'
13932small='$small'
13933so='$so'
13934sockethdr='$sockethdr'
13935socketlib='$socketlib'
13936sort='$sort'
13937spackage='$spackage'
13938spitshell='$spitshell'
13939split='$split'
13940src='$src'
13941ssizetype='$ssizetype'
13942startperl='$startperl'
13943startsh='$startsh'
13944static_ext='$static_ext'
13945stdchar='$stdchar'
13946stdio_base='$stdio_base'
13947stdio_bufsiz='$stdio_bufsiz'
13948stdio_cnt='$stdio_cnt'
13949stdio_filbuf='$stdio_filbuf'
13950stdio_ptr='$stdio_ptr'
767df6a1 13951stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
13952strings='$strings'
13953submit='$submit'
13954subversion='$subversion'
13955sysman='$sysman'
13956tail='$tail'
13957tar='$tar'
13958tbl='$tbl'
13959tee='$tee'
13960test='$test'
13961timeincl='$timeincl'
13962timetype='$timetype'
13963touch='$touch'
13964tr='$tr'
13965trnl='$trnl'
13966troff='$troff'
13967uidtype='$uidtype'
13968uname='$uname'
13969uniq='$uniq'
13970use64bits='$use64bits'
13971usedl='$usedl'
b0ce926a 13972uselongdouble='$uselongdouble'
5f80c64f
JH
13973usemultiplicity='$usemultiplicity'
13974usemymalloc='$usemymalloc'
13975usenm='$usenm'
13976useopcode='$useopcode'
13977useperlio='$useperlio'
13978useposix='$useposix'
13979usesfio='$usesfio'
13980useshrplib='$useshrplib'
29209bc5 13981usesocks='$usesocks'
5f80c64f 13982usethreads='$usethreads'
a3635516 13983usevendorprefix='$usevendorprefix'
5f80c64f
JH
13984usevfork='$usevfork'
13985usrinc='$usrinc'
13986uuname='$uuname'
a3635516
JH
13987vendorlib='$vendorlib'
13988vendorlibexp='$vendorlibexp'
13989vendorprefix='$vendorprefix'
13990vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
13991version='$version'
13992vi='$vi'
13993voidflags='$voidflags'
13994xlibpth='$xlibpth'
13995zcat='$zcat'
13996zip='$zip'
13997EOT
13998
13999: Add in command line options if available
14000$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14001
14002: add special variables
14003$test -f $src/patchlevel.h && \
d00b958f 14004awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 14005echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
14006
14007: propagate old symbols
14008if $test -f UU/config.sh; then
14009 <UU/config.sh sort | uniq >UU/oldconfig.sh
14010 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14011 sort | uniq -u >UU/oldsyms
14012 set X `cat UU/oldsyms`
14013 shift
14014 case $# in
14015 0) ;;
14016 *)
14017 cat <<EOM
14018Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14019EOM
14020 echo "# Variables propagated from previous config.sh file." >>config.sh
14021 for sym in `cat UU/oldsyms`; do
14022 echo " Propagating $hint variable "'$'"$sym..."
14023 eval 'tmp="$'"${sym}"'"'
14024 echo "$tmp" | \
14025 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14026 done
14027 ;;
14028 esac
14029fi
14030
14031: Finish up by extracting the .SH files
14032case "$alldone" in
14033exit)
14034 $rm -rf UU
14035 echo "Done."
14036 exit 0
14037 ;;
14038cont)
14039 ;;
14040'')
14041 dflt=''
14042 nostick=true
14043 $cat <<EOM
14044
14045If you'd like to make any changes to the config.sh file before I begin
14046to configure things, do it as a shell escape now (e.g. !vi config.sh).
14047
14048EOM
14049 rp="Press return or use a shell escape to edit config.sh:"
14050 . UU/myread
14051 nostick=''
14052 case "$ans" in
14053 '') ;;
14054 *) : in case they cannot read
14055 sh 1>&4 -c "$ans";;
14056 esac
14057 ;;
14058esac
14059
14060: if this fails, just run all the .SH files by hand
14061. ./config.sh
14062
14063echo " "
14064exec 1>&4
14065. ./UU/extract
14066
14067if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14068 dflt=y
14069 case "$silent" in
14070 true) ;;
14071 *)
14072 $cat <<EOM
14073
14074Now you need to generate make dependencies by running "$make depend".
14075You might prefer to run it in background: "$make depend > makedepend.out &"
14076It can take a while, so you might not want to run it right now.
14077
14078EOM
14079 ;;
14080 esac
14081 rp="Run $make depend now?"
14082 . UU/myread
14083 case "$ans" in
14084 y*)
14085 $make depend && echo "Now you must run a $make."
14086 ;;
14087 *)
14088 echo "You must run '$make depend' then '$make'."
14089 ;;
14090 esac
14091elif test -f [Mm]akefile; then
14092 echo " "
14093 echo "Now you must run a $make."
14094else
14095 echo "Done."
14096fi
14097
14098if $test -f Policy.sh; then
14099 $cat <<EOM
14100
14101If you compile $package on a different machine or from a different object
14102directory, copy the Policy.sh file from this object directory to the
14103new one before you run Configure -- this will help you with most of
14104the policy defaults.
14105
14106EOM
14107fi
14108if $test -f config.msg; then
14109 echo "Hmm. I also noted the following information while running:"
14110 echo " "
14111 $cat config.msg >&4
14112 $rm -f config.msg
14113fi
14114$rm -f kit*isdone ark*isdone
14115$rm -rf UU
14116
14117: End of Configure
14118