This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Retract #5871.
[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#
6e78e524 23# Generated on Tue Mar 21 23:20:29 EET 2000 [metaconfig 3.0 PL70]
46193409 24# (with additional metaconfig patches by perlbug@perl.com)
2304df62
AD
25
26cat >/tmp/c1$$ <<EOF
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
37cat >/tmp/c2$$ <<EOF
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
43true || cat /tmp/c1$$ /tmp/c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat /tmp/c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f /tmp/c1$$ /tmp/c2$$
49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
dfe9444c 59: Proper separator for the PATH environment variable
8e07c86e
AD
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
62if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
64 p_=\;
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 67 elif test -n "$DJGPP"; then
dfe9444c
AD
68 p_=\;
69 fi
39e571d4 70fi
a0d0e21e
LW
71
72: Proper PATH setting
73paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 74paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 75paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 76paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
77paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
81
82for p in $paths
83do
8e07c86e
AD
84 case "$p_$PATH$p_" in
85 *$p_$p$p_*) ;;
86 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
87 esac
88done
89
8e07c86e 90PATH=.$p_$PATH
2304df62
AD
91export PATH
92
dfe9444c
AD
93: shall we be using ksh?
94inksh=''
95needksh=''
96avoidksh=''
97newsh=/bin/ksh
98changesh=''
ff0cee69 99if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
100 inksh=true
101fi
102if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
104fi
105if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
108 newsh=/usr/bin/bsh
2304df62 109 fi
dfe9444c 110fi
cf04f91f
JH
111if test -f /osf_boot -a -f /usr/sbin/setld; then
112 if test X`/usr/bin/uname -s` = XOSF1; then
113 avoidksh="to avoid Digital UNIX' ksh"
114 newsh=/bin/sh
115 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116 fi
117fi
dfe9444c
AD
118case "$inksh/$needksh" in
119/[a-z]*)
c4f23d77 120 ENV=''
dfe9444c
AD
121 changesh=true
122 reason="$needksh"
123 ;;
124esac
125case "$inksh/$avoidksh" in
126true/[a-z]*)
127 changesh=true
128 reason="$avoidksh"
129 ;;
130esac
131case "$inksh/$needksh-$avoidksh-" in
132true/--)
a0d0e21e
LW
133 cat <<EOM
134(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 135mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 136EOM
dfe9444c
AD
137 ;;
138esac
139case "$changesh" in
140true)
141 echo "(Feeding myself to $newsh $reason.)"
142 case "$0" in
143 Configure|*/Configure) exec $newsh $0 "$@";;
144 *) exec $newsh Configure "$@";;
145 esac
146 ;;
147esac
2304df62 148
bfb7748a
AD
149: if needed set CDPATH to a harmless value that is not chatty
150: avoid bash 2.02 problems with empty CDPATH.
151case "$CDPATH" in
152'') ;;
153*) case "$SHELL" in
154 *bash*) CDPATH='.' ;;
155 *) CDPATH='' ;;
156 esac
157 ;;
158esac
2304df62
AD
159: Configure runs within the UU subdirectory
160test -d UU || mkdir UU
8e07c86e 161cd UU && rm -f ./*
2304df62 162
ff49bff8
JH
163ccsymbols=''
164cppccsymbols=''
165cppsymbols=''
a0d0e21e 166dynamic_ext=''
2304df62 167extensions=''
a0d0e21e 168known_extensions=''
4318d5a0 169nonxs_ext=''
bfb7748a 170static_ext=''
8ff267be 171useopcode=''
a0d0e21e 172useposix=''
ecfc5424 173d_bsd=''
40a7a20a 174d_eunice=''
2304df62
AD
175d_xenix=''
176eunicefix=''
177Mcc=''
dfe9444c 178ar=''
2304df62
AD
179awk=''
180bash=''
181bison=''
182byacc=''
183cat=''
184chgrp=''
185chmod=''
186chown=''
ecfc5424 187comm=''
2304df62
AD
188compress=''
189cp=''
190cpio=''
191cpp=''
192csh=''
193date=''
194echo=''
195egrep=''
196emacs=''
197expr=''
198find=''
199flex=''
2304df62 200grep=''
8ff267be 201gzip=''
2304df62
AD
202inews=''
203ksh=''
204less=''
205line=''
206lint=''
207ln=''
208lp=''
209lpr=''
210ls=''
211mail=''
212mailx=''
dfe9444c 213make=''
2304df62
AD
214mkdir=''
215more=''
216mv=''
693762b4 217nm=''
2304df62
AD
218nroff=''
219perl=''
220pg=''
221pmake=''
222pr=''
223rm=''
224rmail=''
225sed=''
226sendmail=''
2304df62
AD
227shar=''
228sleep=''
229smail=''
230sort=''
231submit=''
232tail=''
233tar=''
234tbl=''
693762b4 235tee=''
2304df62
AD
236test=''
237touch=''
238tr=''
239troff=''
240uname=''
241uniq=''
242uuname=''
243vi=''
244zcat=''
8ff267be 245zip=''
ccc7f9b3 246full_ar=''
1aef975c 247full_sed=''
a0d0e21e 248libswanted=''
2304df62
AD
249hint=''
250myuname=''
85e6fe83
LW
251osname=''
252osvers=''
2304df62
AD
253Author=''
254Date=''
255Header=''
256Id=''
257Locker=''
258Log=''
259RCSfile=''
260Revision=''
261Source=''
262State=''
dfe9444c
AD
263_a=''
264_exe=''
265_o=''
4633a7c4
LW
266archobjs=''
267exe_ext=''
268firstmakefile=''
269lib_ext=''
270obj_ext=''
271path_sep=''
2304df62 272afs=''
a0d0e21e 273alignbytes=''
c4f23d77 274ansi2knr=''
a0d0e21e
LW
275archlib=''
276archlibexp=''
a0d0e21e
LW
277d_archlib=''
278installarchlib=''
40000a8c
AD
279archname=''
280myarchname=''
cf2093f6
JH
281d_atolf=''
282d_atoll=''
ecfc5424 283baserev=''
2304df62
AD
284bin=''
285binexp=''
286installbin=''
d71b2b6b
JH
287bincompat5005=''
288d_bincompat5005=''
2304df62
AD
289byteorder=''
290cc=''
291gccversion=''
292ccflags=''
293cppflags=''
294ldflags=''
295lkflags=''
8e07c86e 296locincpth=''
2304df62 297optimize=''
8e07c86e 298cf_email=''
2304df62
AD
299cf_by=''
300cf_time=''
8175356b 301charsize=''
2304df62 302contains=''
a0d0e21e 303cpp_stuff=''
2304df62
AD
304cpplast=''
305cppminus=''
306cpprun=''
307cppstdin=''
68c15b6f 308crosscompile=''
2304df62 309d_access=''
5ff3f7a4 310d_accessx=''
a0d0e21e 311d_alarm=''
ecfc5424 312d_attribut=''
2304df62
AD
313d_bcmp=''
314d_bcopy=''
315d_bzero=''
316d_casti32=''
317castflags=''
318d_castneg=''
a0d0e21e
LW
319d_chown=''
320d_chroot=''
2304df62 321d_chsize=''
a0d0e21e
LW
322d_closedir=''
323d_void_closedir=''
2304df62
AD
324d_const=''
325cryptlib=''
326d_crypt=''
327d_csh=''
1aef975c 328full_csh=''
a0d0e21e
LW
329d_cuserid=''
330d_dbl_dig=''
331d_difftime=''
332d_dlerror=''
333d_dlopen=''
334d_dlsymun=''
2304df62 335d_dosuid=''
a0d0e21e 336d_suidsafe=''
85ab1d1d 337d_drand48proto=''
2304df62 338d_dup2=''
5ff3f7a4
GS
339d_eaccess=''
340d_endgrent=''
e5c9fcd0
AD
341d_endhent=''
342d_endnent=''
343d_endpent=''
5ff3f7a4 344d_endpwent=''
e5c9fcd0 345d_endsent=''
f1066039 346d_endspent=''
2304df62
AD
347d_fchmod=''
348d_fchown=''
349d_fcntl=''
a0d0e21e
LW
350d_fd_macros=''
351d_fd_set=''
352d_fds_bits=''
353d_fgetpos=''
2304df62
AD
354d_flexfnam=''
355d_flock=''
a0d0e21e 356d_fork=''
c5f05a91 357d_fpos64_t=''
ad27e871 358d_fs_data_s=''
5ff3f7a4 359d_fseeko=''
a0d0e21e 360d_fsetpos=''
0545a864 361d_fstatfs=''
5ff3f7a4 362d_ftello=''
5f05dabc 363d_ftime=''
364d_gettimeod=''
a0d0e21e 365d_Gconvert=''
49dabb45 366d_getcwd=''
c890dc6c 367d_getfsstat=''
5ff3f7a4 368d_getgrent=''
2304df62 369d_getgrps=''
4599a1de 370d_gethbyaddr=''
4599a1de 371d_gethbyname=''
dfe9444c 372d_gethent=''
2304df62
AD
373aphostname=''
374d_gethname=''
375d_phostname=''
376d_uname=''
dc45a647 377d_gethostprotos=''
a0d0e21e 378d_getlogin=''
ad27e871 379d_getmnt=''
ccc7f9b3 380d_getmntent=''
dfe9444c 381d_getnbyaddr=''
693762b4 382d_getnbyname=''
e5c9fcd0 383d_getnent=''
dc45a647 384d_getnetprotos=''
e5c9fcd0 385d_getpent=''
2afac517 386d_getpgid=''
2304df62 387d_getpgrp2=''
2afac517 388d_bsdgetpgrp=''
2304df62 389d_getpgrp=''
a0d0e21e 390d_getppid=''
2304df62 391d_getprior=''
693762b4
AD
392d_getpbyname=''
393d_getpbynumber=''
dc45a647 394d_getprotoprotos=''
5ff3f7a4 395d_getpwent=''
e5c9fcd0 396d_getsent=''
dc45a647 397d_getservprotos=''
f1066039
JH
398d_getspent=''
399d_getspnam=''
693762b4
AD
400d_getsbyname=''
401d_getsbyport=''
a4f3eea9 402d_gnulibc=''
ccc7f9b3 403d_hasmntopt=''
2304df62 404d_htonl=''
43999f95 405d_iconv=''
7e1af8bc 406d_inetaton=''
13b3f787 407d_int64_t=''
2304df62
AD
408d_isascii=''
409d_killpg=''
dd64f1c3 410d_lchown=''
2d4389e4 411d_ldbl_dig=''
2304df62 412d_link=''
a0d0e21e
LW
413d_locconv=''
414d_lockf=''
e5c9fcd0
AD
415d_longdbl=''
416longdblsize=''
dc45a647
MB
417d_longlong=''
418longlongsize=''
49c10eea 419d_lseekproto=''
2304df62 420d_lstat=''
1e8c3fde 421d_madvise=''
a0d0e21e
LW
422d_mblen=''
423d_mbstowcs=''
424d_mbtowc=''
0f27ced1 425d_memchr=''
2304df62
AD
426d_memcmp=''
427d_memcpy=''
428d_memmove=''
429d_memset=''
430d_mkdir=''
fe749a9f 431d_mkdtemp=''
a0d0e21e 432d_mkfifo=''
fe749a9f
JH
433d_mkstemp=''
434d_mkstemps=''
a0d0e21e 435d_mktime=''
fe749a9f
JH
436d_mmap=''
437mmaptype=''
438d_mprotect=''
2304df62
AD
439d_msg=''
440d_msgctl=''
441d_msgget=''
442d_msgrcv=''
443d_msgsnd=''
fe749a9f
JH
444d_msync=''
445d_munmap=''
a0d0e21e 446d_nice=''
c5f05a91 447d_off64_t=''
2304df62 448d_open3=''
a0d0e21e
LW
449d_fpathconf=''
450d_pathconf=''
451d_pause=''
452d_pipe=''
8e07c86e 453d_poll=''
2304df62 454d_portable=''
ef4af2be
JH
455d_old_pthread_create_joinable=''
456old_pthread_create_joinable=''
dfe9444c
AD
457d_pthread_yield=''
458d_sched_yield=''
1cfa4ec7 459sched_yield=''
bbe6c963 460d_qgcvt=''
2304df62 461d_readdir=''
85e6fe83
LW
462d_rewinddir=''
463d_seekdir=''
464d_telldir=''
a0d0e21e 465d_readlink=''
2304df62
AD
466d_rename=''
467d_rmdir=''
468d_safebcpy=''
469d_safemcpy=''
36477c24 470d_sanemcmp=''
2304df62
AD
471d_select=''
472d_sem=''
473d_semctl=''
474d_semget=''
475d_semop=''
476d_setegid=''
477d_seteuid=''
5ff3f7a4 478d_setgrent=''
dfe9444c 479d_setgrps=''
693762b4 480d_sethent=''
a0d0e21e 481d_setlinebuf=''
2304df62 482d_setlocale=''
e5c9fcd0
AD
483d_setnent=''
484d_setpent=''
2304df62
AD
485d_setpgid=''
486d_setpgrp2=''
2afac517 487d_bsdsetpgrp=''
2304df62
AD
488d_setpgrp=''
489d_setprior=''
5ff3f7a4 490d_setpwent=''
2304df62
AD
491d_setregid=''
492d_setresgid=''
493d_setresuid=''
494d_setreuid=''
495d_setrgid=''
496d_setruid=''
e5c9fcd0 497d_setsent=''
2304df62 498d_setsid=''
f1066039 499d_setspent=''
e5c9fcd0 500d_setvbuf=''
760ac839 501d_sfio=''
8ff267be 502usesfio=''
2304df62
AD
503d_shm=''
504d_shmat=''
a0d0e21e
LW
505d_shmatprototype=''
506shmattype=''
2304df62
AD
507d_shmctl=''
508d_shmdt=''
509d_shmget=''
2c7991dc 510d_sigaction=''
8ff267be 511d_sigsetjmp=''
de4597cb
JH
512d_msg_ctrunc=''
513d_msg_dontroute=''
514d_msg_oob=''
515d_msg_peek=''
516d_msg_proxy=''
2304df62 517d_oldsock=''
de4597cb 518d_scm_rights=''
2304df62
AD
519d_socket=''
520d_sockpair=''
521sockethdr=''
522socketlib=''
13b3f787 523d_socklen_t=''
68d4903c 524d_sqrtl=''
2304df62 525d_statblks=''
0545a864
JH
526d_statfs_f_flags=''
527d_statfs_s=''
104d25b7
JH
528d_fstatvfs=''
529d_statvfs=''
c2960299
AD
530d_stdio_cnt_lval=''
531d_stdio_ptr_lval=''
16d20bd9 532d_stdiobase=''
2304df62 533d_stdstdio=''
16d20bd9
AD
534stdio_base=''
535stdio_bufsiz=''
536stdio_cnt=''
dfe9444c 537stdio_filbuf=''
16d20bd9 538stdio_ptr=''
2304df62
AD
539d_index=''
540d_strchr=''
a0d0e21e 541d_strcoll=''
2304df62
AD
542d_strctcpy=''
543d_strerrm=''
544d_strerror=''
545d_sysernlst=''
546d_syserrlst=''
a89d8a78
DH
547d_strtod=''
548d_strtol=''
ff935051 549d_strtold=''
76d49b1c 550d_strtoll=''
a89d8a78 551d_strtoul=''
ff935051
JH
552d_strtoull=''
553d_strtouq=''
a0d0e21e 554d_strxfrm=''
2304df62
AD
555d_symlink=''
556d_syscall=''
a0d0e21e 557d_sysconf=''
2304df62 558d_system=''
a0d0e21e
LW
559d_tcgetpgrp=''
560d_tcsetpgrp=''
cb86ce0e 561d_telldirproto=''
85e6fe83
LW
562d_time=''
563timetype=''
2304df62
AD
564clocktype=''
565d_times=''
566d_truncate=''
a0d0e21e
LW
567d_tzname=''
568d_umask=''
bd89102f
AD
569d_semctl_semid_ds=''
570d_semctl_semun=''
571d_union_semun=''
0545a864 572d_ustat=''
2304df62 573d_vfork=''
a0d0e21e 574usevfork=''
2304df62
AD
575d_voidsig=''
576signal_t=''
577d_volatile=''
578d_charvspr=''
579d_vprintf=''
580d_wait4=''
581d_waitpid=''
a0d0e21e
LW
582d_wcstombs=''
583d_wctomb=''
584dlext=''
85e6fe83
LW
585cccdlflags=''
586ccdlflags=''
2304df62 587dlsrc=''
232e078e 588ld=''
85e6fe83 589lddlflags=''
2304df62 590usedl=''
693762b4 591doublesize=''
5ff3f7a4 592ebcdic=''
66fe083f 593fflushNULL=''
767df6a1 594fflushall=''
8175356b 595fpossize=''
a0d0e21e 596fpostype=''
a22e52b9 597gidformat=''
785fb66b
JH
598gidsign=''
599gidsize=''
2304df62
AD
600gidtype=''
601groupstype=''
602h_fcntl=''
603h_sysfile=''
5ff3f7a4 604i_arpainet=''
ecfc5424
AD
605db_hashtype=''
606db_prefixtype=''
a0d0e21e 607i_db=''
2304df62 608i_dbm=''
8e07c86e 609i_rpcsvcdbm=''
2304df62 610d_dirnamlen=''
a0d0e21e 611direntrytype=''
2304df62 612i_dirent=''
a0d0e21e 613i_dld=''
2304df62
AD
614i_dlfcn=''
615i_fcntl=''
a0d0e21e 616i_float=''
2304df62 617i_gdbm=''
28e8609d 618d_grpasswd=''
2304df62 619i_grp=''
43999f95 620i_iconv=''
792d8dab 621i_ieeefp=''
5ff3f7a4 622i_inttypes=''
a0d0e21e 623i_limits=''
4633a7c4 624i_locale=''
7f3d1cf1 625i_machcthr=''
a0d0e21e
LW
626i_malloc=''
627i_math=''
85e6fe83 628i_memory=''
e7fb4fcc 629i_mntent=''
2304df62 630i_ndbm=''
3fd537d4 631i_netdb=''
85e6fe83 632i_neterrno=''
9cc6feab 633i_netinettcp=''
2304df62
AD
634i_niin=''
635i_sysin=''
5b34fd99 636i_poll=''
c4747d3e 637i_pthread=''
2304df62
AD
638d_pwage=''
639d_pwchange=''
640d_pwclass=''
641d_pwcomment=''
642d_pwexpire=''
c4f23d77 643d_pwgecos=''
28e8609d 644d_pwpasswd=''
2304df62
AD
645d_pwquota=''
646i_pwd=''
760ac839 647i_sfio=''
f1066039 648i_shadow=''
86959918 649i_socks=''
2304df62 650i_stddef=''
a0d0e21e 651i_stdlib=''
2304df62
AD
652i_string=''
653strings=''
923fc586 654i_sunmath=''
5ff3f7a4 655i_sysaccess=''
2304df62
AD
656i_sysdir=''
657i_sysfile=''
658d_voidtty=''
659i_bsdioctl=''
a0d0e21e 660i_sysfilio=''
2304df62
AD
661i_sysioctl=''
662i_syssockio=''
ca52efda 663i_syslog=''
fe749a9f 664i_sysmman=''
bf0c440f 665i_sysmode=''
104d25b7 666i_sysmount=''
2304df62 667i_sysndir=''
a0d0e21e 668i_sysparam=''
8ff267be 669i_sysresrc=''
5ff3f7a4 670i_syssecrt=''
2304df62 671i_sysselct=''
1aef975c 672i_sysstat=''
0545a864 673i_sysstatfs=''
104d25b7 674i_sysstatvfs=''
a0d0e21e 675i_systimes=''
fed7345c 676i_systypes=''
de4597cb 677i_sysuio=''
25f94b33 678i_sysun=''
d4935d7f 679i_sysutsname=''
0545a864 680i_sysvfs=''
8ff267be 681i_syswait=''
2304df62
AD
682i_sgtty=''
683i_termio=''
684i_termios=''
685i_systime=''
686i_systimek=''
687i_time=''
688timeincl=''
85e6fe83 689i_unistd=''
0545a864 690i_ustat=''
2304df62 691i_utime=''
760ac839 692i_values=''
a0d0e21e 693i_stdarg=''
2304df62
AD
694i_varargs=''
695i_varhdr=''
696i_vfork=''
ff935051 697inc_version_list=''
3a096bf3 698inc_version_list_init=''
dd4e71fd
JH
699installprefix=''
700installprefixexp=''
701installstyle=''
104d25b7 702installusrbinperl=''
2304df62 703intsize=''
24fef2a7
AD
704longsize=''
705shortsize=''
2304df62 706libc=''
5cf1d1f1 707ldlibpthname=''
8ff267be 708libperl=''
2afac517 709shrpenv=''
8ff267be 710useshrplib=''
a0d0e21e 711glibpth=''
2304df62 712libpth=''
8e07c86e 713loclibpth=''
2304df62
AD
714plibpth=''
715xlibpth=''
1cfa4ec7 716ignore_versioned_solibs=''
2304df62 717libs=''
43999f95
JH
718libsdirs=''
719libsfiles=''
720libsfound=''
13b3f787 721libspath=''
85e6fe83 722lns=''
cf2093f6
JH
723d_PRIEldbl=''
724d_PRIFldbl=''
725d_PRIGldbl=''
726d_PRIeldbl=''
727d_PRIfldbl=''
728d_PRIgldbl=''
729sPRIEldbl=''
730sPRIFldbl=''
731sPRIGldbl=''
732sPRIeldbl=''
733sPRIfldbl=''
734sPRIgldbl=''
5ff3f7a4 735lseeksize=''
85e6fe83 736lseektype=''
8ff267be 737make_set_make=''
85e6fe83 738d_mymalloc=''
94b6baf5 739freetype=''
2304df62
AD
740mallocobj=''
741mallocsrc=''
742malloctype=''
743usemymalloc=''
16d20bd9
AD
744installman1dir=''
745man1dir=''
746man1direxp=''
747man1ext=''
748installman3dir=''
749man3dir=''
750man3direxp=''
751man3ext=''
2304df62
AD
752huge=''
753large=''
754medium=''
755models=''
756small=''
757split=''
a0d0e21e 758modetype=''
68c15b6f 759multiarch=''
2304df62
AD
760mydomain=''
761myhostname=''
762phostname=''
763c=''
764n=''
8e07c86e
AD
765d_eofnblk=''
766eagain=''
767o_nonblock=''
768rd_nodata=''
dfe9444c
AD
769netdb_hlen_type=''
770netdb_host_type=''
771netdb_name_type=''
772netdb_net_type=''
2304df62
AD
773groupcat=''
774hostcat=''
775passcat=''
85e6fe83
LW
776orderlib=''
777ranlib=''
2304df62
AD
778package=''
779spackage=''
2c7991dc 780pager=''
ff935051
JH
781api_revision=''
782api_subversion=''
783api_version=''
784api_versionstring=''
ecfc5424 785patchlevel=''
49c10eea 786revision=''
760ac839 787subversion=''
bfb7748a 788version=''
49c10eea 789perl5=''
8e07c86e 790perladmin=''
4633a7c4 791perlpath=''
78691af5 792d_nv_preserves_uv=''
8175356b
JH
793i16size=''
794i16type=''
795i32size=''
796i32type=''
797i64size=''
798i64type=''
799i8size=''
800i8type=''
801ivsize=''
802ivtype=''
803nvsize=''
804nvtype=''
805u16size=''
806u16type=''
807u32size=''
808u32type=''
809u64size=''
810u64type=''
811u8size=''
812u8type=''
813uvsize=''
814uvtype=''
815ivdformat=''
816uvoformat=''
817uvuformat=''
818uvxformat=''
dfe9444c 819pidtype=''
a0d0e21e 820prefix=''
1aef975c 821prefixexp=''
2304df62
AD
822installprivlib=''
823privlib=''
824privlibexp=''
825prototype=''
693762b4 826ptrsize=''
cf2093f6
JH
827d_PRIX64=''
828d_PRId64=''
829d_PRIi64=''
830d_PRIo64=''
831d_PRIu64=''
832d_PRIx64=''
833sPRIX64=''
834sPRId64=''
835sPRIi64=''
836sPRIo64=''
837sPRIu64=''
838sPRIx64=''
de1c2614 839d_quad=''
6b8eaf93 840quadkind=''
d7d93a81
JH
841quadtype=''
842uquadtype=''
85ab1d1d 843drand01=''
2304df62 844randbits=''
85ab1d1d
JH
845randfunc=''
846randseedtype=''
847seedfunc=''
2304df62
AD
848installscript=''
849scriptdir=''
850scriptdirexp=''
5ff3f7a4 851selectminbits=''
a0d0e21e 852selecttype=''
8ff267be 853sh=''
af4c28eb 854sig_count=''
2304df62 855sig_name=''
dfe9444c 856sig_name_init=''
8e07c86e 857sig_num=''
824a2ba3 858sig_num_init=''
4633a7c4
LW
859installsitearch=''
860sitearch=''
861sitearchexp=''
717c4fcc
JH
862installsitebin=''
863sitebin=''
864sitebinexp=''
25f94b33
AD
865installsitelib=''
866sitelib=''
526fdc24 867sitelib_stem=''
25f94b33 868sitelibexp=''
dd4e71fd
JH
869siteprefix=''
870siteprefixexp=''
8c99d73e 871sizesize=''
a0d0e21e
LW
872sizetype=''
873so=''
c890dc6c 874socksizetype=''
2304df62
AD
875sharpbang=''
876shsharp=''
877spitshell=''
dfe9444c 878src=''
a0d0e21e 879ssizetype=''
4633a7c4 880startperl=''
2304df62
AD
881startsh=''
882stdchar=''
ed39a0f2 883d_stdio_stream_array=''
767df6a1 884stdio_stream_array=''
2304df62 885sysman=''
5ff3f7a4 886trnl=''
a22e52b9 887uidformat=''
57def98f 888uidsign=''
785fb66b 889uidsize=''
2304df62 890uidtype=''
85ab1d1d 891archname64=''
10cc9d2a
JH
892use64bitall=''
893use64bitint=''
249b38c6 894uselargefiles=''
b0ce926a 895uselongdouble=''
09458382 896usemorebits=''
85ab1d1d 897usemultiplicity=''
2304df62 898nm_opt=''
40a7a20a 899nm_so_opt=''
2304df62
AD
900runnm=''
901usenm=''
8ff267be 902useperlio=''
29209bc5 903usesocks=''
693762b4 904d_oldpthreads=''
aaacdc8b
GS
905use5005threads=''
906useithreads=''
dfe9444c 907usethreads=''
2304df62 908incpath=''
2304df62
AD
909mips_type=''
910usrinc=''
526fdc24
MS
911d_vendorarch=''
912installvendorarch=''
913vendorarch=''
914vendorarchexp=''
717c4fcc
JH
915d_vendorbin=''
916installvendorbin=''
917vendorbin=''
918vendorbinexp=''
a3635516
JH
919d_vendorlib=''
920installvendorlib=''
921vendorlib=''
526fdc24 922vendorlib_stem=''
a3635516
JH
923vendorlibexp=''
924usevendorprefix=''
925vendorprefix=''
926vendorprefixexp=''
2304df62
AD
927defvoidused=''
928voidflags=''
fe749a9f
JH
929pm_apiversion=''
930xs_apiversion=''
2304df62
AD
931CONFIG=''
932
ecfc5424
AD
933define='define'
934undef='undef'
935smallmach='pdp11 i8086 z8000 i80286 iAPX286'
936rmlist=''
937
938: We must find out about Eunice early
939eunicefix=':'
940if test -f /etc/unixtovms; then
941 eunicefix=/etc/unixtovms
942fi
943if test -f /etc/unixtovms.exe; then
944 eunicefix=/etc/unixtovms.exe
945fi
946
5ff3f7a4 947i_whoami=''
ff935051
JH
948: set useposix=false in your hint file to disable the POSIX extension.
949useposix=true
950: set useopcode=false in your hint file to disable the Opcode extension.
951useopcode=true
dfe9444c 952: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 953_exe=''
dfe9444c
AD
954: Extra object files, if any, needed on this platform.
955archobjs=''
ff935051
JH
956: Possible local include directories to search.
957: Set locincpth to "" in a hint file to defeat local include searches.
958locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
959locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
960:
961: no include file wanted by default
962inclwanted=''
963
dfe9444c 964groupstype=''
732c9516
JH
965: change the next line if compiling for Xenix/286 on Xenix/386
966xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
967: Possible local library directories to search.
968loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
969loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
970
971: general looking path for locating libraries
bf0c440f 972glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
732c9516
JH
973glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
974glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
975test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
976test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
977
978: Private path used by Configure to find libraries. Its value
979: is prepended to libpth. This variable takes care of special
980: machines, like the mips. Usually, it should be empty.
981plibpth=''
982
1cfa4ec7
GS
983: default library list
984libswanted=''
921b2963 985: some systems want to use only the non-versioned libso:s
1cfa4ec7 986ignore_versioned_solibs=''
85ab1d1d 987: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 988: set usesocks on the Configure command line to enable socks.
dfe9444c 989: set usethreads on the Configure command line to enable threads.
ff935051
JH
990: full support for void wanted by default
991defvoidused=15
992
ecfc5424 993: List of libraries we want.
693762b4 994: If anyone needs -lnet, put it in a hint file.
997d70a2 995libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
69e84d1d 996libswanted="$libswanted dld ld sun m c cposix posix"
f1066039 997libswanted="$libswanted ndir dir crypt sec"
997d70a2 998libswanted="$libswanted ucb bsd BSD PW x iconv"
1aef975c 999: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1000: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1001glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1002glibpth="/usr/shlib $glibpth"
1003: Do not use vfork unless overridden by a hint file.
1004usevfork=false
1005
8ff267be 1006: Find the basic shell for Bourne shell scripts
1007case "$sh" in
1008'')
8ff267be 1009 case "$SYSTYPE" in
1010 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1011 *) xxx='/bin/sh';;
1012 esac
1013 if test -f "$xxx"; then
1014 sh="$xxx"
1015 else
1016 : Build up a list and do a single loop so we can 'break' out.
1017 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1018 for xxx in sh bash ksh pdksh ash; do
1019 for p in $pth; do
1020 try="$try ${p}/${xxx}"
1021 done
1022 done
1023 for xxx in $try; do
1024 if test -f "$xxx"; then
1025 sh="$xxx";
8ff267be 1026 break
1027 elif test -f "$xxx.exe"; then
1028 sh="$xxx";
8ff267be 1029 break
1030 fi
1031 done
1032 fi
1033 ;;
1034esac
1035
1036case "$sh" in
1037'') cat <<EOM >&2
1038$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1039
8ff267be 1040Usually it's in /bin/sh. How did you even get this far?
46193409 1041Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 1042we'll try to straighten this all out.
8ff267be 1043EOM
1044 exit 1
1045 ;;
1046esac
1047
760ac839 1048: see if sh knows # comments
8ff267be 1049if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1050 shsharp=true
1051 spitshell=cat
760ac839
LW
1052 xcat=/bin/cat
1053 test -f $xcat || xcat=/usr/bin/cat
1054 echo "#!$xcat" >try
1055 $eunicefix try
1056 chmod +x try
1057 ./try > today
1058 if test -s today; then
760ac839
LW
1059 sharpbang='#!'
1060 else
1061 echo "#! $xcat" > try
1062 $eunicefix try
1063 chmod +x try
1064 ./try > today
1065 if test -s today; then
760ac839
LW
1066 sharpbang='#! '
1067 else
760ac839
LW
1068 sharpbang=': use '
1069 fi
1070 fi
1071else
dfe9444c 1072 echo " "
8ff267be 1073 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1074 shsharp=false
1075 cd ..
1076 echo "exec grep -v '^[ ]*#'" >spitshell
1077 chmod +x spitshell
1078 $eunicefix spitshell
1079 spitshell=`pwd`/spitshell
1080 cd UU
1081 echo "I presume that if # doesn't work, #! won't work either!"
1082 sharpbang=': use '
1083fi
1084rm -f try today
1085
1086: figure out how to guarantee sh startup
8ff267be 1087case "$startsh" in
1088'') startsh=${sharpbang}${sh} ;;
1089*)
760ac839 1090esac
760ac839
LW
1091cat >try <<EOSS
1092$startsh
1093set abc
1094test "$?abc" != 1
1095EOSS
1096
1097chmod +x try
1098$eunicefix try
1099if ./try; then
8ff267be 1100 : echo "Yup, it does."
760ac839 1101else
dfe9444c
AD
1102 echo "Hmm... '$startsh' does not guarantee sh startup..."
1103 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1104fi
1105rm -f try
1106
aebf16e7
AD
1107
1108: Save command line options in file UU/cmdline.opt for later use in
1109: generating config.sh.
1110cat > cmdline.opt <<EOSH
1111# Configure command line arguments.
1112config_arg0='$0'
1113config_args='$*'
1114config_argc=$#
1115EOSH
1116argn=1
1117for arg in "$@"; do
1118 cat >>cmdline.opt <<EOSH
1119config_arg$argn='$arg'
1120EOSH
1121 argn=`expr $argn + 1`
1122done
1123
2304df62
AD
1124: produce awk script to parse command line options
1125cat >options.awk <<'EOF'
1126BEGIN {
02e93a22 1127 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1128
1129 len = length(optstr);
1130 for (i = 1; i <= len; i++) {
1131 c = substr(optstr, i, 1);
1132 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1133 if (a == ":") {
1134 arg[c] = 1;
1135 i++;
1136 }
1137 opt[c] = 1;
1138 }
1139}
1140{
1141 expect = 0;
1142 str = $0;
1143 if (substr(str, 1, 1) != "-") {
1144 printf("'%s'\n", str);
1145 next;
1146 }
1147 len = length($0);
1148 for (i = 2; i <= len; i++) {
1149 c = substr(str, i, 1);
1150 if (!opt[c]) {
1151 printf("-%s\n", substr(str, i));
1152 next;
1153 }
1154 printf("-%s\n", c);
1155 if (arg[c]) {
1156 if (i < len)
1157 printf("'%s'\n", substr(str, i + 1));
1158 else
1159 expect = 1;
1160 next;
1161 }
1162 }
1163}
1164END {
1165 if (expect)
1166 print "?";
1167}
1168EOF
1169
1170: process the command line options
4633a7c4
LW
1171set X `for arg in "$@"; do echo "X$arg"; done |
1172 sed -e s/X// | awk -f options.awk`
2304df62
AD
1173eval "set $*"
1174shift
1175rm -f options.awk
1176
1177: set up default values
1178fastread=''
1179reuseval=false
1180config_sh=''
1181alldone=''
1182error=''
1183silent=''
1184extractsh=''
ecfc5424 1185override=''
16d20bd9 1186knowitall=''
02e93a22 1187rm -f optdef.sh posthint.sh
28757baa 1188cat >optdef.sh <<EOS
1189$startsh
1190EOS
2304df62 1191
dfe9444c 1192
2304df62
AD
1193: option parsing
1194while test $# -gt 0; do
1195 case "$1" in
1196 -d) shift; fastread=yes;;
1197 -e) shift; alldone=cont;;
1198 -f)
1199 shift
1200 cd ..
1201 if test -r "$1"; then
1202 config_sh="$1"
1203 else
a0d0e21e 1204 echo "$me: cannot read config file $1." >&2
2304df62
AD
1205 error=true
1206 fi
1207 cd UU
1208 shift;;
1209 -h) shift; error=true;;
1210 -r) shift; reuseval=true;;
dfe9444c 1211 -s) shift; silent=true; realsilent=true;;
2304df62 1212 -E) shift; alldone=exit;;
16d20bd9 1213 -K) shift; knowitall=true;;
ecfc5424 1214 -O) shift; override=true;;
dfe9444c 1215 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1216 -D)
1217 shift
1218 case "$1" in
1219 *=)
1220 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1221 echo "$me: ignoring -D $1" >&2
1222 ;;
ecfc5424 1223 *=*) echo "$1" | \
1aef975c
AD
1224 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1225 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1226 esac
1227 shift
1228 ;;
1229 -U)
1230 shift
1231 case "$1" in
1aef975c 1232 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1233 *=*)
1234 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1235 echo "$me: ignoring -U $1" >&2
1236 ;;
1aef975c 1237 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1238 esac
1239 shift
1240 ;;
02e93a22
JH
1241 -A)
1242 shift
1243 xxx=''
1244 yyy="$1"
02e93a22 1245 zzz=''
5f83a3e9 1246 uuu=undef
02e93a22 1247 case "$yyy" in
5f83a3e9
JH
1248 *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1249 case "$zzz" in
1250 *:*) zzz='' ;;
1251 *) xxx=append
1252 zzz=" "`echo $yyy|sed 's!^[^=]*=!!'`
1253 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1254 esac
1255 ;;
1256 esac
1257 case "$xxx" in
1258 '') case "$yyy" in
1259 *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1260 yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1261 zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1262 yyy=`echo $yyy|sed 's!=.*!!'` ;;
1263 *) xxx=`echo $yyy|sed 's!:.*!!'`
1264 yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1265 esac
1266 ;;
1267 esac
02e93a22
JH
1268 case "$xxx" in
1269 append)
5f83a3e9 1270 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1271 clear)
5f83a3e9 1272 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1273 define)
1274 case "$zzz" in
1275 '') zzz=define ;;
1276 esac
5f83a3e9 1277 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1278 eval)
5f83a3e9 1279 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1280 prepend)
5f83a3e9 1281 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1282 undef)
1283 case "$zzz" in
1284 '') zzz="$uuu" ;;
1285 esac
5f83a3e9
JH
1286 echo "$yyy=$zzz" >> posthint.sh ;;
1287 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1288 esac
bde6b06b 1289 shift
02e93a22 1290 ;;
dfe9444c 1291 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1292 exit 0;;
2304df62 1293 --) break;;
a0d0e21e 1294 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1295 *) break;;
1296 esac
1297done
1298
1299case "$error" in
1300true)
1301 cat >&2 <<EOM
2afac517 1302Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1303 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1304 -d : use defaults for all answers.
1305 -e : go on without questioning past the production of config.sh.
1306 -f : specify an alternate default configuration file.
1307 -h : print this help message and exit (with an error status).
1308 -r : reuse C symbols value if possible (skips costly nm extraction).
1309 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1310 -D : define symbol to have some value:
1311 -D symbol symbol gets the value 'define'
1312 -D symbol=value symbol gets the value 'value'
2304df62 1313 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1314 -K : do not use unless you know what you are doing.
ecfc5424 1315 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1316 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1317 -U : undefine symbol:
1318 -U symbol symbol gets the value 'undef'
1319 -U symbol= symbol gets completely empty
02e93a22 1320 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1321 -A symbol=value append " "value to symbol
02e93a22
JH
1322 -A append:symbol=value append value to symbol
1323 -A define:symbol=value define symbol to have value
02e93a22
JH
1324 -A clear:symbol define symbol to be ''
1325 -A define:symbol define symbol to be 'define'
1326 -A eval:symbol=value define symbol to be eval of value
1327 -A prepend:symbol=value prepend value to symbol
1328 -A undef:symbol define symbol to be 'undef'
1329 -A undef:symbol= define symbol to be ''
2304df62
AD
1330 -V : print version number and exit (with a zero status).
1331EOM
1332 exit 1
1333 ;;
1334esac
1335
dfe9444c
AD
1336: Sanity checks
1337case "$fastread$alldone" in
1338yescont|yesexit) ;;
1339*)
1340 if test ! -t 0; then
1341 echo "Say 'sh Configure', not 'sh <Configure'"
1342 exit 1
1343 fi
1344 ;;
1345esac
1346
2304df62
AD
1347exec 4>&1
1348case "$silent" in
1349true) exec 1>/dev/null;;
1350esac
1351
ecfc5424 1352: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1353touch optdef.sh
1354. ./optdef.sh
02e93a22
JH
1355: create the posthint manipulation script and leave the file out there...
1356touch posthint.sh
a0d0e21e 1357
2304df62 1358: set package name
85e6fe83 1359package=perl5
1aef975c
AD
1360first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1361last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1362case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1363ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1364*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1365esac
2304df62 1366
2304df62
AD
1367: Some greps do not return status, grrr.
1368echo "grimblepritz" >grimble
1369if grep blurfldyick grimble >/dev/null 2>&1 ; then
1370 contains=contains
1371elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1372 contains=grep
1373else
1374 contains=contains
1375fi
1376rm -f grimble
1377: the following should work in any shell
1378case "$contains" in
1379contains*)
1380 echo " "
1381 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1382 cat >contains <<'EOSS'
1383grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1384EOSS
1385chmod +x contains
1386esac
1387
dfe9444c
AD
1388: Find the path to the source tree
1389case "$src" in
1390'') case "$0" in
b233458b
JH
1391 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1392 case "$src" in
1393 /*) ;;
1394 *) src=`cd ../$src && pwd` ;;
1395 esac
1396 ;;
dfe9444c
AD
1397 *) src='.';;
1398 esac;;
1399esac
1400case "$src" in
1401'') src=/
1402 rsrc=/
1403 ;;
1404/*) rsrc="$src";;
1405*) rsrc="../$src";;
1406esac
1407if test -f $rsrc/Configure && \
1408 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1409then
1410 : found it, so we are ok.
1411else
1412 rsrc=''
1413 for src in . .. ../.. ../../.. ../../../..; do
1414 if test -f ../$src/Configure && \
1415 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1416 then
1417 rsrc=../$src
1418 break
1419 fi
1420 done
1421fi
1422case "$rsrc" in
1423'')
1424 cat <<EOM >&4
1425
1426Sorry, I can't seem to locate the source dir for $package. Please start
1427Configure with an explicit path -- i.e. /some/path/Configure.
1428
1429EOM
1430 exit 1
1431 ;;
1432../.) rsrc='..';;
1433*)
1434 echo " "
1435 echo "Sources for $package found in \"$src\"." >&4
1436 ;;
1437esac
1438
1439: script used to extract .SH files with variable substitutions
1440cat >extract <<'EOS'
2000072c 1441CONFIGDOTSH=true
dfe9444c
AD
1442echo "Doing variable substitutions on .SH files..."
1443if test -f $src/MANIFEST; then
f7ab18e9 1444 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1445else
1446 echo "(Looking for .SH files under the source directory.)"
1447 set x `(cd $src; find . -name "*.SH" -print)`
1448fi
1449shift
1450case $# in
14510) set x `(cd $src; echo *.SH)`; shift;;
1452esac
1453if test ! -f $src/$1; then
1454 shift
1455fi
1456mkdir_p='
1457name=$1;
1458create="";
1459while test $name; do
1460 if test ! -d "$name"; then
1461 create="$name $create";
1462 name=`echo $name | sed -e "s|^[^/]*$||"`;
1463 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1464 else
1465 name="";
1466 fi;
1467done;
1468for file in $create; do
1469 mkdir $file;
1470done
1471'
1472for file in $*; do
1473 case "$src" in
1474 ".")
1475 case "$file" in
1476 */*)
1477 dir=`expr X$file : 'X\(.*\)/'`
1478 file=`expr X$file : 'X.*/\(.*\)'`
1479 (cd $dir && . ./$file)
1480 ;;
1481 *)
1482 . ./$file
1483 ;;
1484 esac
1485 ;;
1486 *)
1487 case "$file" in
1488 */*)
1489 dir=`expr X$file : 'X\(.*\)/'`
1490 file=`expr X$file : 'X.*/\(.*\)'`
1491 (set x $dir; shift; eval $mkdir_p)
1492 sh <$src/$dir/$file
1493 ;;
1494 *)
1495 sh <$src/$file
1496 ;;
1497 esac
1498 ;;
1499 esac
1500done
1501if test -f $src/config_h.SH; then
1502 if test ! -f config.h; then
1503 : oops, they left it out of MANIFEST, probably, so do it anyway.
1504 . $src/config_h.SH
1505 fi
1506fi
1507EOS
1508
1509: extract files and exit if asked to do so
1510case "$extractsh" in
1511true)
1512 case "$realsilent" in
1513 true) ;;
1514 *) exec 1>&4;;
1515 esac
1516 case "$config_sh" in
1517 '') config_sh='config.sh';;
1518 esac
1519 echo " "
1520 echo "Fetching answers from $config_sh..."
1521 cd ..
1522 . $config_sh
1523 test "$override" && . ./optdef.sh
1524 echo " "
1525 . UU/extract
1526 rm -rf UU
1527 echo "Done."
1528 exit 0
1529 ;;
1530esac
1531
1532: Eunice requires " " instead of "", can you believe it
1533echo " "
1534: Here we go...
1535echo "Beginning of configuration questions for $package."
1536
1537trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1538
2304df62
AD
1539: first determine how to suppress newline on echo command
1540echo " "
1541echo "Checking echo to see how to suppress newlines..."
1542(echo "hi there\c" ; echo " ") >.echotmp
1543if $contains c .echotmp >/dev/null 2>&1 ; then
1544 echo "...using -n."
1545 n='-n'
1546 c=''
1547else
1548 cat <<'EOM'
1549...using \c
1550EOM
1551 n=''
1552 c='\c'
1553fi
1554echo $n "The star should be here-->$c"
1555echo '*'
1556rm -f .echotmp
1557
1558: Now test for existence of everything in MANIFEST
1559echo " "
dfe9444c 1560if test -f $rsrc/MANIFEST; then
2304df62 1561 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1562 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1563 rm -f missing
dfe9444c 1564 tmppwd=`pwd`
2304df62 1565 for filelist in x??; do
dfe9444c 1566 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1567 done
1568 if test -s missing; then
1569 cat missing >&4
1570 cat >&4 <<'EOM'
1571
1572THIS PACKAGE SEEMS TO BE INCOMPLETE.
1573
1574You have the option of continuing the configuration process, despite the
1575distinct possibility that your kit is damaged, by typing 'y'es. If you
1576do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1577and contact the author (perlbug@perl.com).
2304df62
AD
1578
1579EOM
1580 echo $n "Continue? [n] $c" >&4
1581 read ans
1582 case "$ans" in
1583 y*)
1584 echo "Continuing..." >&4
1585 rm -f missing
1586 ;;
1587 *)
1588 echo "ABORTING..." >&4
1589 kill $$
1590 ;;
1591 esac
1592 else
dfe9444c 1593 echo "Looks good..."
2304df62
AD
1594 fi
1595else
1596 echo "There is no MANIFEST file. I hope your kit is complete !"
1597fi
1598rm -f missing x??
1599
5ff3f7a4
GS
1600echo " "
1601: Find the appropriate value for a newline for tr
1602if test -n "$DJGPP"; then
1603 trnl='\012'
1604fi
1605if test X"$trnl" = X; then
1606 case "`echo foo|tr '\n' x 2>/dev/null`" in
1607 foox) trnl='\n' ;;
1608 esac
1609fi
1610if test X"$trnl" = X; then
1611 case "`echo foo|tr '\012' x 2>/dev/null`" in
1612 foox) trnl='\012' ;;
1613 esac
1614fi
1615if test X"$trnl" = X; then
1616 cat <<EOM >&2
1617
1618$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1619
1620EOM
1621 exit 1
1622fi
1623
2304df62
AD
1624: compute the number of columns on the terminal for proper question formatting
1625case "$COLUMNS" in
1626'') COLUMNS='80';;
1627esac
1628
1629: set up the echo used in my read
1630myecho="case \"\$xxxm\" in
1631'') echo $n \"\$rp $c\" >&4;;
1632*) case \"\$rp\" in
1633 '') echo $n \"[\$xxxm] $c\";;
1634 *)
1635 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1636 echo \"\$rp\" >&4
1637 echo $n \"[\$xxxm] $c\" >&4
1638 else
1639 echo $n \"\$rp [\$xxxm] $c\" >&4
1640 fi
1641 ;;
1642 esac;;
1643esac"
1644
1645: now set up to do reads with possible shell escape and default assignment
1646cat <<EOSC >myread
28757baa 1647$startsh
2304df62
AD
1648xxxm=\$dflt
1649$myecho
1650ans='!'
1651case "\$fastread" in
1652yes) case "\$dflt" in
1653 '') ;;
1654 *) ans='';
1655 case "\$silent-\$rp" in
1656 true-) ;;
1657 *) echo " " >&4;;
1658 esac;;
1659 esac;;
1660*) case "\$silent" in
1661 true) case "\$rp" in
1662 '') ans='';;
1663 esac;;
1664 esac;;
1665esac
1666while expr "X\$ans" : "X!" >/dev/null; do
1667 read answ
1668 set x \$xxxm
1669 shift
dfe9444c 1670 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1671 case "\$answ" in
dfe9444c
AD
1672 "!")
1673 sh 1>&4
1674 echo " "
1675 $myecho
1676 ;;
1677 !*)
1678 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1679 shift
1680 sh 1>&4 -c "\$*"
1681 echo " "
1682 $myecho
1683 ;;
2304df62
AD
1684 "\$ans")
1685 case "\$ans" in
ecfc5424
AD
1686 \\&*)
1687 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1688 shift
1689 case "\$1" in
1690 -d)
1691 fastread=yes
40a7a20a 1692 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1693 ;;
1694 -*)
40a7a20a 1695 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1696 ;;
1697 esac
1698 $myecho
1699 ans=!
1700 ;;
2304df62
AD
1701 esac;;
1702 *)
1703 case "\$aok" in
1704 y)
1705 echo "*** Substitution done -- please confirm."
1706 xxxm="\$ans"
c9795ab7 1707 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1708 xxxm="\$ans"
1709 ans=!
1710 ;;
1711 *)
1712 echo "*** Error -- try again."
1713 ans=!
1714 ;;
1715 esac
1716 $myecho
1717 ;;
1718 esac
1719 case "\$ans\$xxxm\$nostick" in
1720 '')
1721 ans=!
1722 $myecho
1723 ;;
1724 esac
1725done
1726case "\$ans" in
1727'') ans="\$xxxm";;
1728esac
1729EOSC
1730
1731: create .config dir to save info across Configure sessions
1732test -d ../.config || mkdir ../.config
1733cat >../.config/README <<EOF
1734This directory created by Configure to save information that should
dfe9444c 1735persist across sessions for $package.
2304df62
AD
1736
1737You may safely delete it if you wish.
1738EOF
1739
1740: general instructions
1741needman=true
1742firsttime=true
760ac839 1743user=`(logname) 2>/dev/null`
dfe9444c
AD
1744case "$user" in
1745'') user=`whoami 2>&1`;;
760ac839 1746esac
2304df62
AD
1747if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1748 firsttime=false
1749 echo " "
1750 rp='Would you like to see the instructions?'
1751 dflt=n
1752 . ./myread
1753 case "$ans" in
1754 [yY]*) ;;
1755 *) needman=false;;
1756 esac
1757fi
1758if $needman; then
1759 cat <<EOH
4e2a5f63 1760
2304df62 1761This installation shell script will examine your system and ask you questions
a0d0e21e 1762to determine how the perl5 package should be installed. If you get
2304df62
AD
1763stuck on a question, you may use a ! shell escape to start a subshell or
1764execute a command. Many of the questions will have default answers in square
1765brackets; typing carriage return will give you the default.
1766
1767On some of the questions which ask for file or directory names you are allowed
1768to use the ~name construct to specify the login directory belonging to "name",
1769even if you don't have a shell which knows about that. Questions where this is
1770allowed will be marked "(~name ok)".
1771
1772EOH
1773 rp=''
1774 dflt='Type carriage return to continue'
1775 . ./myread
1776 cat <<'EOH'
1777
1778The prompter used in this script allows you to use shell variables and
1779backticks in your answers. You may use $1, $2, etc... to refer to the words
1780in the default answer, as if the default line was a set of arguments given to a
1781script shell. This means you may also use $* to repeat the whole default line,
1782so you do not have to re-type everything to add something to the default.
1783
1784Everytime there is a substitution, you will have to confirm. If there is an
1785error (e.g. an unmatched backtick), the default answer will remain unchanged
1786and you will be prompted again.
1787
1788If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1789the questions and use the computed defaults (or the previous answers if there
1790was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1791You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1792on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1793
1794EOH
1795 . ./myread
1796 cat <<EOH
1797
1798Much effort has been expended to ensure that this shell script will run on any
1799Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1800Configure and run it again. If you can't run Configure for some reason,
1801you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1802have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1803
1804This installation script affects things in two ways:
1805
18061) it may do direct variable substitutions on some of the files included
1807 in this kit.
18082) it builds a config.h file for inclusion in C programs. You may edit
1809 any of these files as the need arises after running this script.
1810
1811If you make a mistake on a question, there is no easy way to back up to it
1812currently. The easiest thing to do is to edit config.sh and rerun all the SH
1813files. Configure will offer to let you do this before it runs the SH files.
1814
1815EOH
1816 dflt='Type carriage return to continue'
1817 . ./myread
1818 case "$firsttime" in
1819 true) echo $user >>../.config/instruct;;
1820 esac
1821fi
1822
2304df62
AD
1823: find out where common programs are
1824echo " "
1825echo "Locating common programs..." >&4
1826cat <<EOSC >loc
1827$startsh
1828case \$# in
18290) exit 1;;
1830esac
1831thing=\$1
1832shift
1833dflt=\$1
1834shift
1835for dir in \$*; do
1836 case "\$thing" in
1837 .)
1838 if test -d \$dir/\$thing; then
1839 echo \$dir
1840 exit 0
1841 fi
1842 ;;
1843 *)
a0d0e21e 1844 for thisthing in \$dir/\$thing; do
ecfc5424 1845 : just loop through to pick last item
a0d0e21e 1846 done
25f94b33 1847 if test -f \$thisthing; then
a0d0e21e 1848 echo \$thisthing
2304df62
AD
1849 exit 0
1850 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1851 if test -n "$DJGPP"; then
1852 echo \$dir/\$thing.exe
1853 else
1854 : on Eunice apparently
1855 echo \$dir/\$thing
1856 fi
2304df62
AD
1857 exit 0
1858 fi
1859 ;;
1860 esac
1861done
1862echo \$dflt
1863exit 1
1864EOSC
1865chmod +x loc
1866$eunicefix loc
1867loclist="
1868awk
1869cat
ecfc5424 1870comm
2304df62
AD
1871cp
1872echo
1873expr
1874grep
a0d0e21e 1875ls
dfe9444c 1876make
2304df62 1877mkdir
2304df62
AD
1878rm
1879sed
1880sort
85e6fe83 1881touch
2304df62
AD
1882tr
1883uniq
1884"
1885trylist="
1886Mcc
dfe9444c 1887ar
2304df62
AD
1888byacc
1889cpp
1890csh
1891date
1892egrep
8ff267be 1893gzip
2c7991dc 1894less
8ff267be 1895ln
2c7991dc 1896more
693762b4 1897nm
2304df62 1898nroff
2c7991dc 1899pg
2304df62
AD
1900test
1901uname
8ff267be 1902zip
2304df62 1903"
8e07c86e 1904pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1905pth="$pth /lib /usr/lib"
1906for file in $loclist; do
dfe9444c
AD
1907 eval xxx=\$$file
1908 case "$xxx" in
1909 /*|?:[\\/]*)
1910 if test -f "$xxx"; then
1911 : ok
1912 else
1913 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1914 xxx=`./loc $file $file $pth`
1915 fi
1916 ;;
1917 '') xxx=`./loc $file $file $pth`;;
1918 *) xxx=`./loc $xxx $xxx $pth`;;
1919 esac
2304df62
AD
1920 eval $file=$xxx
1921 eval _$file=$xxx
1922 case "$xxx" in
1923 /*)
1924 echo $file is in $xxx.
1925 ;;
8e07c86e
AD
1926 ?:[\\/]*)
1927 echo $file is in $xxx.
1928 ;;
2304df62 1929 *)
25f94b33
AD
1930 echo "I don't know where '$file' is, and my life depends on it." >&4
1931 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1932 exit 1
2304df62
AD
1933 ;;
1934 esac
1935done
1936echo " "
1937echo "Don't worry if any of the following aren't found..."
1938say=offhand
1939for file in $trylist; do
dfe9444c
AD
1940 eval xxx=\$$file
1941 case "$xxx" in
1942 /*|?:[\\/]*)
1943 if test -f "$xxx"; then
1944 : ok
1945 else
1946 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1947 xxx=`./loc $file $file $pth`
1948 fi
1949 ;;
1950 '') xxx=`./loc $file $file $pth`;;
1951 *) xxx=`./loc $xxx $xxx $pth`;;
1952 esac
2304df62
AD
1953 eval $file=$xxx
1954 eval _$file=$xxx
1955 case "$xxx" in
1956 /*)
1957 echo $file is in $xxx.
1958 ;;
8e07c86e
AD
1959 ?:[\\/]*)
1960 echo $file is in $xxx.
1961 ;;
2304df62
AD
1962 *)
1963 echo "I don't see $file out there, $say."
1964 say=either
1965 ;;
1966 esac
1967done
1968case "$egrep" in
1969egrep)
1970 echo "Substituting grep for egrep."
1971 egrep=$grep
1972 ;;
1973esac
8ff267be 1974case "$ln" in
1975ln)
1976 echo "Substituting cp for ln."
1977 ln=$cp
1978 ;;
1979esac
2304df62
AD
1980case "$test" in
1981test)
1982 echo "Hopefully test is built into your sh."
1983 ;;
1984*)
ecfc5424 1985 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1986 echo "Using the test built into your sh."
1987 test=test
1988 _test=test
1989 fi
1990 ;;
1991esac
1992case "$echo" in
1993echo)
1994 echo "Hopefully echo is built into your sh."
1995 ;;
1996'') ;;
1997*)
1998 echo " "
1999echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2000 $echo $n "hi there$c" >foo1
2001 echo $n "hi there$c" >foo2
2002 if cmp foo1 foo2 >/dev/null 2>&1; then
2003 echo "They are compatible. In fact, they may be identical."
2004 else
2005 case "$n" in
2006 '-n') n='' c='\c';;
2007 *) n='-n' c='';;
2008 esac
2009 cat <<FOO
2010They are not compatible! You are probably running ksh on a non-USG system.
2011I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2012have echo built in and we may have to run some Bourne shell scripts. That
2013means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2014
2015FOO
2016 $echo $n "The star should be here-->$c"
2017 $echo "*"
2018 fi
2019 $rm -f foo1 foo2
2020 ;;
2021esac
2022
a0d0e21e
LW
2023: determine whether symbolic links are supported
2024echo " "
2025$touch blurfl
2026if $ln -s blurfl sym > /dev/null 2>&1 ; then
2027 echo "Symbolic links are supported." >&4
2028 lns="$ln -s"
2029else
2030 echo "Symbolic links are NOT supported." >&4
2031 lns="$ln"
2032fi
2033$rm -f blurfl sym
2034
ecfc5424
AD
2035: see whether [:lower:] and [:upper:] are supported character classes
2036echo " "
ecfc5424
AD
2037case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2038ABYZ)
2039 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2040 up='[:upper:]'
2041 low='[:lower:]'
2042 ;;
28e8609d
JH
2043*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2044 # (0xc9 and 0xd1), therefore that is a nice testing point.
2045 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2046 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2047 ij) up='[A-Z]'
2048 low='[a-z]'
2049 ;;
2050 esac
2051 fi
2052 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2053 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2054 ij) up='A-Z'
2055 low='a-z'
2056 ;;
2057 esac
2058 fi
2059 if test "X$up" = X -o "X$low" = X; then
2060 case "`echo IJ | od -x 2>/dev/null`" in
2061 *C9D1*|*c9d1*)
2062 echo "Hey, this might be EBCDIC." >&4
2063 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2064 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2065 ij) up='[A-IJ-RS-Z]'
2066 low='[a-ij-rs-z]'
2067 ;;
2068 esac
2069 fi
2070 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2071 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2072 ij) up='A-IJ-RS-Z'
2073 low='a-ij-rs-z'
2074 ;;
2075 esac
2076 fi
2077 ;;
2078 esac
2079 fi
2080esac
3eaeeeae 2081case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2082ij)
2083 echo "Using $up and $low to convert case." >&4
2084 ;;
ecfc5424 2085*)
28e8609d
JH
2086 echo "I don't know how to translate letters from upper to lower case." >&4
2087 echo "Your tr is not acting any way I know of." >&4
2088 exit 1
2089 ;;
ecfc5424
AD
2090esac
2091: set up the translation script tr, must be called with ./tr of course
2092cat >tr <<EOSC
2093$startsh
2094case "\$1\$2" in
2095'[A-Z][a-z]') exec $tr '$up' '$low';;
2096'[a-z][A-Z]') exec $tr '$low' '$up';;
2097esac
2098exec $tr "\$@"
2099EOSC
2100chmod +x tr
2101$eunicefix tr
2102
2304df62
AD
2103: Try to determine whether config.sh was made on this system
2104case "$config_sh" in
2105'')
43999f95
JH
2106myuname=`$uname -a 2>/dev/null`
2107$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2108# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2109# because the A-Z/a-z are not consecutive.
a0d0e21e 2110myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2111 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2112newmyuname="$myuname"
2304df62 2113dflt=n
16d20bd9
AD
2114case "$knowitall" in
2115'')
2116 if test -f ../config.sh; then
2117 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2118 eval "`grep myuname= ../config.sh`"
2119 fi
2120 if test "X$myuname" = "X$newmyuname"; then
2121 dflt=y
2122 fi
2304df62 2123 fi
16d20bd9
AD
2124 ;;
2125*) dflt=y;;
2126esac
2304df62
AD
2127
2128: Get old answers from old config file if Configure was run on the
2129: same system, otherwise use the hints.
2130hint=default
2131cd ..
2132if test -f config.sh; then
16d20bd9
AD
2133 echo " "
2134 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2135 . UU/myread
2136 case "$ans" in
2137 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2138 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2139 tmp_n="$n"
2140 tmp_c="$c"
85cad39c 2141 tmp_sh="$sh"
2304df62
AD
2142 . ./config.sh
2143 cp config.sh UU
ecfc5424
AD
2144 n="$tmp_n"
2145 c="$tmp_c"
85cad39c 2146 : Older versions did not always set $sh. Catch re-use of such
2147 : an old config.sh.
2148 case "$sh" in
2149 '') sh="$tmp_sh" ;;
2150 esac
2304df62
AD
2151 hint=previous
2152 ;;
2153 esac
2154fi
2155if test ! -f config.sh; then
2156 $cat <<EOM
2157
4e2a5f63
AD
2158First time through, eh? I have some defaults handy for some systems
2159that need some extra help getting the Configure answers right:
2304df62
AD
2160
2161EOM
dfe9444c 2162 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2163 dflt=''
2164 : Half the following guesses are probably wrong... If you have better
46193409 2165 : tests or hints, please send them to perlbug@perl.com
2304df62 2166 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2167 $test -f /irix && osname=irix
85e6fe83
LW
2168 $test -f /xenix && osname=sco_xenix
2169 $test -f /dynix && osname=dynix
2170 $test -f /dnix && osname=dnix
5f05dabc 2171 $test -f /lynx.os && osname=lynxos
2172 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 2173 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 2174 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2175 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2176 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2177 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2178 $test -d /usr/apollo/bin && osname=apollo
2179 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2180 $test -d /usr/include/minix && osname=minix
e060872b 2181 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2182 osname=machten
4633a7c4 2183 if $test -x /sbin/version; then
dfe9444c 2184 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2185 $sed -e 's/[A-Za-z]$//'`
2186 elif $test -x /usr/etc/version; then
dfe9444c 2187 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2188 $sed -e 's/[A-Za-z]$//'`
2189 else
2190 osvers="$2.$3"
2191 fi
2192 fi
aaacdc8b
GS
2193
2194 $test -f /sys/posix.dll &&
2195 $test -f /usr/bin/what &&
2196 set X `/usr/bin/what /sys/posix.dll` &&
2197 $test "$3" = UWIN &&
2198 osname=uwin &&
2199 osvers="$5"
2200
2304df62
AD
2201 if $test -f $uname; then
2202 set X $myuname
2203 shift
2204
2304df62 2205 case "$5" in
85e6fe83 2206 fps*) osname=fps ;;
2304df62
AD
2207 mips*)
2208 case "$4" in
85e6fe83
LW
2209 umips) osname=umips ;;
2210 *) osname=mips ;;
2304df62 2211 esac;;
85e6fe83
LW
2212 [23]100) osname=mips ;;
2213 next*) osname=next ;;
ecfc5424 2214 i386*)
c6912327
JH
2215 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2216 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2217 osname='sco'
2218 osvers=$tmp
2219 elif $test -f /etc/kconfig; then
ecfc5424 2220 osname=isc
bd628c73 2221 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
2222 osvers=4
2223 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2224 osvers=3
2304df62 2225 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2226 osvers=2
ecfc5424
AD
2227 fi
2228 fi
2000072c 2229 tmp=''
ecfc5424 2230 ;;
c4f23d77
AD
2231 pc*)
2232 if test -n "$DJGPP"; then
2233 osname=dos
2234 osvers=djgpp
2235 fi
2236 ;;
2304df62
AD
2237 esac
2238
2239 case "$1" in
a0d0e21e
LW
2240 aix) osname=aix
2241 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2242 case "$tmp" in
1aef975c 2243 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2244 '<3240'|'<>3240') osvers=3.2.0 ;;
2245 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2246 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2247 *) osvers=$tmp;;
a0d0e21e
LW
2248 esac
2249 ;;
aaacdc8b
GS
2250 bsd386) osname=bsd386
2251 osvers=`$uname -r`
2252 ;;
2253 cygwin*) osname=cygwin
2254 osvers="$3"
2255 ;;
23f87696
SZ
2256 *dc.osx) osname=dcosx
2257 osvers="$3"
2258 ;;
a0d0e21e
LW
2259 dnix) osname=dnix
2260 osvers="$3"
2261 ;;
2262 domainos) osname=apollo
2263 osvers="$3"
2264 ;;
2265 dgux) osname=dgux
2266 osvers="$3"
2267 ;;
760ac839 2268 dynixptx*) osname=dynixptx
e58e581d 2269 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2270 ;;
a0d0e21e
LW
2271 freebsd) osname=freebsd
2272 osvers="$3" ;;
2273 genix) osname=genix ;;
2274 hp*) osname=hpux
bfb7748a 2275 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2276 ;;
a78b0d02 2277 irix*) osname=irix
a0d0e21e
LW
2278 case "$3" in
2279 4*) osvers=4 ;;
2280 5*) osvers=5 ;;
ecfc5424 2281 *) osvers="$3" ;;
a0d0e21e
LW
2282 esac
2283 ;;
2284 linux) osname=linux
2285 case "$3" in
a0d0e21e
LW
2286 *) osvers="$3" ;;
2287 esac
2288 ;;
28e8609d
JH
2289 MiNT) osname=mint
2290 ;;
2291 netbsd*) osname=netbsd
ecfc5424
AD
2292 osvers="$3"
2293 ;;
4e81affe
MM
2294 news-os) osvers="$3"
2295 case "$3" in
2296 4*) osname=newsos4 ;;
2297 *) osname=newsos ;;
2298 esac
2299 ;;
aaacdc8b
GS
2300 next*) osname=next ;;
2301 POSIX-BC | posix-bc ) osname=posix-bc
2302 osvers="$3"
a0d0e21e 2303 ;;
ae3afa4e
TH
2304 powerux | power_ux | powermax_os | powermaxos | \
2305 powerunix | power_unix) osname=powerux
2306 osvers="$3"
2307 ;;
aaacdc8b
GS
2308 qnx) osname=qnx
2309 osvers="$4"
2310 ;;
a0d0e21e
LW
2311 solaris) osname=solaris
2312 case "$3" in
2313 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2314 *) osvers="$3" ;;
a0d0e21e
LW
2315 esac
2316 ;;
85e6fe83
LW
2317 sunos) osname=sunos
2318 case "$3" in
85e6fe83
LW
2319 5*) osname=solaris
2320 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2321 *) osvers="$3" ;;
2304df62
AD
2322 esac
2323 ;;
a0d0e21e 2324 titanos) osname=titanos
85e6fe83 2325 case "$3" in
a0d0e21e
LW
2326 1*) osvers=1 ;;
2327 2*) osvers=2 ;;
2328 3*) osvers=3 ;;
2329 4*) osvers=4 ;;
ecfc5424 2330 *) osvers="$3" ;;
2304df62
AD
2331 esac
2332 ;;
85e6fe83 2333 ultrix) osname=ultrix
ecfc5424 2334 osvers="$3"
2304df62 2335 ;;
28757baa 2336 osf1|mls+) case "$5" in
fed7345c
AD
2337 alpha)
2338 osname=dec_osf
313489a2 2339 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2340 ;;
2341 hp*) osname=hp_osf1 ;;
2342 mips) osname=mips_osf1 ;;
85e6fe83
LW
2343 esac
2344 ;;
0337d152
BG
2345 unixware) osname=svr5
2346 osvers="$4"
2347 ;;
2348 uts) osname=uts
a0d0e21e
LW
2349 osvers="$3"
2350 ;;
85e6fe83 2351 $2) case "$osname" in
2304df62 2352 *isc*) ;;
a0d0e21e 2353 *freebsd*) ;;
5f05dabc 2354 svr*)
a0d0e21e
LW
2355 : svr4.x or possibly later
2356 case "svr$3" in
2357 ${osname}*)
2358 osname=svr$3
2359 osvers=$4
2360 ;;
2361 esac
2362 case "$osname" in
2363 svr4.0)
2364 : Check for ESIX
2365 if test -f /stand/boot ; then
2366 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2367 if test -n "$INITPROG" -a -f "$INITPROG"; then
2368 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2369 if test -n "$isesix"; then
a0d0e21e
LW
2370 osname=esix4
2371 fi
2372 fi
2373 fi
2374 ;;
2375 esac
2376 ;;
2304df62 2377 *) if test -f /etc/systemid; then
a0d0e21e
LW
2378 osname=sco
2379 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2380 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2381 osvers=$1.$2.$3
c4f23d77 2382 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2383 osvers=$1.$2
c4f23d77 2384 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2385 osvers=$1
2304df62 2386 fi
a0d0e21e
LW
2387 else
2388 case "$osname" in
2389 '') : Still unknown. Probably a generic Sys V.
2390 osname="sysv"
2391 osvers="$3"
2392 ;;
2393 esac
2304df62
AD
2394 fi
2395 ;;
2396 esac
2397 ;;
a0d0e21e
LW
2398 *) case "$osname" in
2399 '') : Still unknown. Probably a generic BSD.
2400 osname="$1"
2401 osvers="$3"
2402 ;;
2403 esac
2404 ;;
2304df62
AD
2405 esac
2406 else
dfe9444c
AD
2407 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2408 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2409 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2410 osname=news_os
2304df62 2411 fi
dfe9444c 2412 $rm -f UU/kernel.what
8e07c86e
AD
2413 elif test -d c:/.; then
2414 set X $myuname
2415 osname=os2
2416 osvers="$5"
2304df62
AD
2417 fi
2418 fi
85e6fe83 2419
a0d0e21e
LW
2420 : Now look for a hint file osname_osvers, unless one has been
2421 : specified already.
2422 case "$hintfile" in
2423 ''|' ')
1e127011 2424 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 2425 : Also try without trailing minor version numbers.
1e127011
DD
2426 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2427 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2428 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2429 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
2430 case "$file" in
2431 '') dflt=none ;;
2432 *) case "$osvers" in
2433 '') dflt=$file
2434 ;;
dfe9444c 2435 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2436 dflt=$file
dfe9444c 2437 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2438 dflt=$xfile
dfe9444c 2439 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2440 dflt=$xxfile
dfe9444c 2441 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2442 dflt=$xxxfile
dfe9444c 2443 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2444 dflt=$xxxxfile
dfe9444c 2445 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2446 dflt="${osname}"
2447 else
2448 dflt=none
2449 fi
2450 ;;
2451 esac
85e6fe83
LW
2452 ;;
2453 esac
4e2a5f63
AD
2454 if $test -f Policy.sh ; then
2455 case "$dflt" in
2456 *Policy*) ;;
2457 none) dflt="Policy" ;;
2458 *) dflt="Policy $dflt" ;;
2459 esac
2460 fi
85e6fe83 2461 ;;
a0d0e21e 2462 *)
ecfc5424 2463 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2464 ;;
2304df62 2465 esac
1aef975c 2466
4e2a5f63
AD
2467 if $test -f Policy.sh ; then
2468 $cat <<EOM
2469
2470There's also a Policy hint file available, which should make the
2471site-specific (policy) questions easier to answer.
2472EOM
2473
2474 fi
2475
2304df62
AD
2476 $cat <<EOM
2477
2478You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 2479A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 2480is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
2481
2482EOM
4e2a5f63 2483
2304df62 2484 rp="Which of these apply, if any?"
dfe9444c 2485 . UU/myread
85e6fe83
LW
2486 tans=$ans
2487 for file in $tans; do
4e2a5f63
AD
2488 if $test X$file = XPolicy -a -f Policy.sh; then
2489 . Policy.sh
2490 $cat Policy.sh >> UU/config.sh
2491 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2492 . $src/hints/$file.sh
2493 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2494 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2495 : nothing
2496 else
85e6fe83
LW
2497 : Give one chance to correct a possible typo.
2498 echo "$file.sh does not exist"
2499 dflt=$file
2500 rp="hint to use instead?"
dfe9444c 2501 . UU/myread
85e6fe83 2502 for file in $ans; do
dfe9444c
AD
2503 if $test -f "$src/hints/$file.sh"; then
2504 . $src/hints/$file.sh
2505 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2506 elif $test X$ans = X -o X$ans = Xnone ; then
2507 : nothing
2508 else
2509 echo "$file.sh does not exist -- ignored."
2510 fi
2511 done
2304df62
AD
2512 fi
2513 done
85e6fe83 2514
2304df62 2515 hint=recommended
85e6fe83 2516 : Remember our hint file for later.
dfe9444c 2517 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2518 hintfile="$file"
85e6fe83 2519 else
a0d0e21e 2520 hintfile=''
85e6fe83 2521 fi
2304df62
AD
2522fi
2523cd UU
2524;;
2525*)
2526 echo " "
2527 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2528 tmp_n="$n"
2529 tmp_c="$c"
2304df62
AD
2530 cd ..
2531 cp $config_sh config.sh 2>/dev/null
a78b0d02 2532 chmod +w config.sh
2304df62
AD
2533 . ./config.sh
2534 cd UU
2535 cp ../config.sh .
ecfc5424
AD
2536 n="$tmp_n"
2537 c="$tmp_c"
2304df62
AD
2538 hint=previous
2539 ;;
2540esac
1aef975c
AD
2541test "$override" && . ./optdef.sh
2542myuname="$newmyuname"
2304df62
AD
2543
2544: Restore computed paths
2545for file in $loclist $trylist; do
2546 eval $file="\$_$file"
2547done
2548
85e6fe83 2549cat << EOM
a0d0e21e 2550
85e6fe83 2551Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2552The default value is probably right if the name rings a bell. Otherwise,
2553since spelling matters for me, either accept the default or answer "none"
2554to leave it blank.
a0d0e21e 2555
85e6fe83 2556EOM
85e6fe83 2557case "$osname" in
a0d0e21e 2558 ''|' ')
85e6fe83 2559 case "$hintfile" in
a0d0e21e 2560 ''|' '|none) dflt=none ;;
ecfc5424 2561 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2562 esac
2563 ;;
2564 *) dflt="$osname" ;;
2565esac
2566rp="Operating system name?"
2567. ./myread
2568case "$ans" in
ecfc5424
AD
2569none) osname='' ;;
2570*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2571esac
8ff267be 2572echo " "
2573case "$osvers" in
2574 ''|' ')
2575 case "$hintfile" in
2576 ''|' '|none) dflt=none ;;
2577 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2578 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2579 case "$dflt" in
2580 ''|' ') dflt=none ;;
2581 esac
2582 ;;
2583 esac
2584 ;;
2585 *) dflt="$osvers" ;;
2586esac
2587rp="Operating system version?"
2588. ./myread
2589case "$ans" in
2590none) osvers='' ;;
2591*) osvers="$ans" ;;
2592esac
2593
02e93a22
JH
2594
2595. ./posthint.sh
2596
2304df62 2597: who configured the system
59b83a6f 2598cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2599cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2600case "$cf_by" in
2601"")
8ff267be 2602 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2603 case "$cf_by" in
2604 "") cf_by=unknown ;;
8ff267be 2605 esac ;;
2606esac
2304df62 2607
dfe9444c
AD
2608: set up the script used to warn in case of inconsistency
2609cat <<EOS >whoa
2610$startsh
2611EOS
2612cat <<'EOSC' >>whoa
2613dflt=y
2614echo " "
2615echo "*** WHOA THERE!!! ***" >&4
2616echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2617rp=" Keep the $hint value?"
2618. ./myread
2619case "$ans" in
2620y) td=$was; tu=$was;;
2621esac
2622EOSC
2623
2624: function used to set $1 to $val
2625setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2626case "$val$was" in
2627$define$undef) . ./whoa; eval "$var=\$td";;
2628$undef$define) . ./whoa; eval "$var=\$tu";;
2629*) eval "$var=$val";;
2630esac'
2631
0f0995ae
JH
2632case "$usethreads" in
2633$define|true|[yY]*) dflt='y';;
2634*) dflt='n';;
2635esac
64e689dc
JH
2636cat <<EOM
2637
3645a519 2638Perl can be built to take advantage of threads on some systems.
0f0995ae 2639To do so, Configure can be run with -Dusethreads.
d00b958f
JH
2640
2641Note that threading is a highly experimental feature, and
2642some known race conditions still remain. If you choose to try
2643it, be very sure to not actually deploy it for production
2644purposes. README.threads has more details, and is required
2645reading if you enable threads.
0f0995ae
JH
2646
2647If this doesn't make any sense to you, just accept the default '$dflt'.
64e689dc 2648EOM
64e689dc
JH
2649rp='Build a threading Perl?'
2650. ./myread
2651case "$ans" in
aaacdc8b 2652y|Y) val="$define" ;;
64e689dc 2653*) val="$undef" ;;
dfe9444c 2654esac
64e689dc 2655set usethreads
aaacdc8b
GS
2656eval $setvar
2657
2658case "$usethreads" in
2659$define)
2660 $cat <<EOM
2661
ff42dc34 2662As of 5.5.640, Perl has two different internal threading implementations,
aaacdc8b
GS
2663the 5.005 version (5005threads) and an interpreter-based version
2664(ithreads) that has one interpreter per thread. Both are very
2665experimental. This arrangement exists to help developers work out
2666which one is better.
3645a519
JH
2667
2668If you're a casual user, you probably don't want interpreter-threads
2669at this time. There doesn't yet exist a way to create threads from
2670within Perl in this model, i.e., "use Thread;" will NOT work.
aaacdc8b
GS
2671EOM
2672 : Default to ithreads unless overridden on command line or with
2673 : old config.sh
2674 dflt='y'
2675 case "$use5005threads" in
2676 $define|true|[yY]*) dflt='n';;
2677 esac
2678 case "$useithreads" in
2679 $undef|false|[nN]*) dflt='n';;
2680 esac
2681 rp='Use interpreter-based ithreads?'
2682 . ./myread
2683 case "$ans" in
2684 y|Y) val="$define" ;;
2685 *) val="$undef" ;;
2686 esac
2687 set useithreads
2688 eval $setvar
2689 : Now set use5005threads to the opposite value.
2690 case "$useithreads" in
2691 $define) val="$undef" ;;
2692 *) val="$define" ;;
2693 esac
2694 set use5005threads
2695 eval $setvar
2696 ;;
2697*)
2698 useithreads="$undef"
2699 use5005threads="$undef"
2700 ;;
2701esac
104d25b7 2702
693762b4
AD
2703case "$d_oldpthreads" in
2704'') : Configure tests would be welcome here. For now, assume undef.
2705 val="$undef" ;;
2706*) val="$d_oldpthreads" ;;
2707esac
2708set d_oldpthreads
2709eval $setvar
dfe9444c 2710
b691c02f
JH
2711
2712case "$usethreads" in
104d25b7
JH
2713"$define"|true|[yY]*)
2714: Look for a hint-file generated 'call-back-unit'. If the
2715: user has specified that a threading perl is to be built,
2716: we may need to set or change some other defaults.
2717 if $test -f usethreads.cbu; then
e5e20432 2718 echo "Your platform has some specific hints for threaded builds, using them..."
104d25b7 2719 . ./usethreads.cbu
e5e20432
JH
2720 else
2721 $cat <<EOM
2722(Your platform doesn't have any specific hints for threaded builds.
2723 Assuming POSIX threads, then.)
b691c02f 2724EOM
e5e20432 2725 fi
aaacdc8b 2726 ;;
e5e20432 2727esac
104d25b7 2728
ff935051 2729cat <<EOM
64e689dc 2730
ff935051
JH
2731Perl can be built so that multiple Perl interpreters can coexist
2732within the same Perl executable.
2733EOM
64e689dc 2734
ff935051
JH
2735case "$useithreads" in
2736$define)
2737 cat <<EOM
2738This multiple interpreter support is required for interpreter-based threads.
64e689dc 2739EOM
ff935051
JH
2740 val="$define"
2741 ;;
0f0995ae 2742*) case "$usemultiplicity" in
ff42dc34
GS
2743 $define|true|[yY]*) dflt='y';;
2744 *) dflt='n';;
2745 esac
49c10eea 2746 echo " "
0f0995ae 2747 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
ff42dc34
GS
2748 rp='Build Perl for multiplicity?'
2749 . ./myread
2750 case "$ans" in
ff935051 2751 y|Y) val="$define" ;;
ff42dc34
GS
2752 *) val="$undef" ;;
2753 esac
2754 ;;
64e689dc
JH
2755esac
2756set usemultiplicity
ff935051 2757eval $setvar
64e689dc 2758
e5e20432
JH
2759: determine where manual pages are on this system
2760echo " "
2761case "$sysman" in
2762'')
2763 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2764 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2765 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2766 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2767 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2768 sysman=`./loc . /usr/man/man1 $syspath`
2769 ;;
2770esac
2771if $test -d "$sysman"; then
2772 echo "System manual is in $sysman." >&4
2773else
2774 echo "Could not find manual pages in source form." >&4
2775fi
2776
2777: see what memory models we can support
2778case "$models" in
2779'')
2780 $cat >pdp11.c <<'EOP'
2781int main() {
2782#ifdef pdp11
2783 exit(0);
2784#else
2785 exit(1);
2786#endif
2787}
2788EOP
2789 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2790 if $test -f pdp11 && ./pdp11 2>/dev/null; then
2791 dflt='unsplit split'
2792 else
2793 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2794 case "$tans" in
2795 X) dflt='none';;
2796 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2797 dflt='small'
2798 else
2799 dflt=''
2800 fi
2801 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2802 dflt="$dflt medium"
2803 fi
2804 if $test -d /lib/large || $test -d /usr/lib/large; then
2805 dflt="$dflt large"
2806 fi
2807 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2808 dflt="$dflt huge"
2809 fi
2810 esac
2811 fi;;
2812*) dflt="$models";;
2813esac
2814$cat <<EOM
2815
2816Some systems have different model sizes. On most systems they are called
2817small, medium, large, and huge. On the PDP11 they are called unsplit and
2818split. If your system doesn't support different memory models, say "none".
2819If you wish to force everything to one memory model, say "none" here and
2820put the appropriate flags later when it asks you for other cc and ld flags.
2821Venix systems may wish to put "none" and let the compiler figure things out.
2822(In the following question multiple model names should be space separated.)
2823
2824The default for most systems is "none".
2825
2826EOM
2827rp="Which memory models are supported?"
2828. ./myread
2829models="$ans"
2830
2831case "$models" in
2832none)
2833 small=''
2834 medium=''
2835 large=''
2836 huge=''
2837 unsplit=''
2838 split=''
2839 ;;
2840*split)
2841 case "$split" in
2842 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2843 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2844 dflt='-i'
2845 else
2846 dflt='none'
2847 fi;;
2848 *) dflt="$split";;
2849 esac
2850 rp="What flag indicates separate I and D space?"
2851 . ./myread
2852 tans="$ans"
2853 case "$tans" in
2854 none) tans='';;
2855 esac
2856 split="$tans"
2857 unsplit='';;
2858*large*|*small*|*medium*|*huge*)
2859 case "$models" in
2860 *large*)
2861 case "$large" in
2862 '') dflt='-Ml';;
2863 *) dflt="$large";;
2864 esac
2865 rp="What flag indicates large model?"
2866 . ./myread
2867 tans="$ans"
2868 case "$tans" in
2869 none) tans='';
2870 esac
2871 large="$tans";;
2872 *) large='';;
2873 esac
2874 case "$models" in
2875 *huge*) case "$huge" in
2876 '') dflt='-Mh';;
2877 *) dflt="$huge";;
2878 esac
2879 rp="What flag indicates huge model?"
2880 . ./myread
2881 tans="$ans"
2882 case "$tans" in
2883 none) tans='';
2884 esac
2885 huge="$tans";;
2886 *) huge="$large";;
2887 esac
2888 case "$models" in
2889 *medium*) case "$medium" in
2890 '') dflt='-Mm';;
2891 *) dflt="$medium";;
2892 esac
2893 rp="What flag indicates medium model?"
2894 . ./myread
2895 tans="$ans"
2896 case "$tans" in
2897 none) tans='';
2898 esac
2899 medium="$tans";;
2900 *) medium="$large";;
2901 esac
2902 case "$models" in
2903 *small*) case "$small" in
2904 '') dflt='none';;
2905 *) dflt="$small";;
2906 esac
2907 rp="What flag indicates small model?"
2908 . ./myread
2909 tans="$ans"
2910 case "$tans" in
2911 none) tans='';
2912 esac
2913 small="$tans";;
2914 *) small='';;
2915 esac
2916 ;;
2917*)
2918 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2919 ;;
2920esac
2921$rm -f pdp11.* pdp11
2922
2923: make some quick guesses about what we are up against
2924echo " "
2925$echo $n "Hmm... $c"
2926echo exit 1 >bsd
2927echo exit 1 >usg
2928echo exit 1 >v7
2929echo exit 1 >osf1
2930echo exit 1 >eunice
2931echo exit 1 >xenix
2932echo exit 1 >venix
2933echo exit 1 >os2
2934d_bsd="$undef"
2935$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2936if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2937then
2938 echo "Looks kind of like an OSF/1 system, but we'll see..."
2939 echo exit 0 >osf1
2940elif test `echo abc | tr a-z A-Z` = Abc ; then
2941 xxx=`./loc addbib blurfl $pth`
2942 if $test -f $xxx; then
2943 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2944 echo exit 0 >bsd
2945 echo exit 0 >usg
2946 else
2947 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2948 echo "Looks kind of like an extended USG system, but we'll see..."
2949 else
2950 echo "Looks kind of like a USG system, but we'll see..."
2951 fi
2952 echo exit 0 >usg
2953 fi
2954elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2955 echo "Looks kind of like a BSD system, but we'll see..."
2956 d_bsd="$define"
2957 echo exit 0 >bsd
2958else
2959 echo "Looks kind of like a Version 7 system, but we'll see..."
2960 echo exit 0 >v7
2961fi
2962case "$eunicefix" in
2963*unixtovms*)
2964 $cat <<'EOI'
2965There is, however, a strange, musty smell in the air that reminds me of
2966something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2967EOI
2968 echo exit 0 >eunice
2969 d_eunice="$define"
2970: it so happens the Eunice I know will not run shell scripts in Unix format
2971 ;;
2972*)
2973 echo " "
2974 echo "Congratulations. You aren't running Eunice."
2975 d_eunice="$undef"
2976 ;;
2977esac
2978: Detect OS2. The p_ variable is set above in the Head.U unit.
2979case "$p_" in
2980:) ;;
2981*)
2982 $cat <<'EOI'
2983I have the feeling something is not exactly right, however...don't tell me...
2984lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2985EOI
2986 echo exit 0 >os2
2987 ;;
2988esac
2989if test -f /xenix; then
2990 echo "Actually, this looks more like a XENIX system..."
2991 echo exit 0 >xenix
2992 d_xenix="$define"
2993else
2994 echo " "
2995 echo "It's not Xenix..."
2996 d_xenix="$undef"
2997fi
2998chmod +x xenix
2999$eunicefix xenix
3000if test -f /venix; then
3001 echo "Actually, this looks more like a VENIX system..."
3002 echo exit 0 >venix
3003else
3004 echo " "
3005 if ./xenix; then
3006 : null
3007 else
3008 echo "Nor is it Venix..."
3009 fi
3010fi
3011chmod +x bsd usg v7 osf1 eunice xenix venix os2
3012$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3013$rm -f foo
3014
3015: see if we need a special compiler
3016echo " "
3017if ./usg; then
3018 case "$cc" in
3019 '') case "$Mcc" in
3020 /*) dflt='Mcc';;
3021 *) case "$large" in
3022 -M*) dflt='cc';;
3023 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3024 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3025 dflt='cc'
3026 else
3027 dflt='cc -M'
3028 fi
3029 else
3030 dflt='cc'
3031 fi;;
3032 esac;;
3033 esac;;
3034 *) dflt="$cc";;
3035 esac
3036 case "$dflt" in
3037 *M*) $cat <<'EOM'
3038On some older systems the default C compiler will not resolve multiple global
3039references that happen to have the same name. On some such systems the "Mcc"
3040command may be used to force these to be resolved. On other systems a "cc -M"
3041command is required. (Note that the -M flag on other systems indicates a
3042memory model to use!) If you have the Gnu C compiler, you might wish to use
3043that instead.
3044
3045EOM
3046 ;;
3047 esac
3048 rp="Use which C compiler?"
3049 . ./myread
3050 cc="$ans"
3051else
3052 case "$cc" in
3053 '') dflt=cc;;
3054 *) dflt="$cc";;
3055 esac
3056 rp="Use which C compiler?"
3057 . ./myread
3058 cc="$ans"
3059fi
3060: Look for a hint-file generated 'call-back-unit'. Now that the
3061: user has specified the compiler, we may need to set or change some
3062: other defaults.
3063if $test -f cc.cbu; then
3064 . ./cc.cbu
3065fi
3066echo " "
3067echo "Checking for GNU cc in disguise and/or its version number..." >&4
3068$cat >gccvers.c <<EOM
3069#include <stdio.h>
3070int main() {
3071#ifdef __GNUC__
3072#ifdef __VERSION__
3073 printf("%s\n", __VERSION__);
3074#else
3075 printf("%s\n", "1");
3076#endif
3077#endif
3078 exit(0);
3079}
3080EOM
bf0c440f 3081if $cc $ldflags -o gccvers gccvers.c; then
e5e20432
JH
3082 gccversion=`./gccvers`
3083 case "$gccversion" in
3084 '') echo "You are not using GNU cc." ;;
fc68435e 3085 *) echo "You are using GNU cc $gccversion."
fc68435e 3086 ;;
e5e20432
JH
3087 esac
3088else
3089 echo " "
3090 echo "*** WHOA THERE!!! ***" >&4
3091 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3092 case "$knowitall" in
3093 '')
3094 echo " You'd better start hunting for one and let me know about it." >&4
3095 exit 1
3096 ;;
3097 esac
3098fi
3099$rm -f gccvers*
3100case "$gccversion" in
31011*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3102esac
3103
bd9b35c9
JH
3104: decide how portable to be. Allow command line overrides.
3105case "$d_portable" in
3106"$undef") ;;
3107*) d_portable="$define" ;;
104d25b7 3108esac
85ab1d1d 3109
bd9b35c9
JH
3110: set up shell script to do ~ expansion
3111cat >filexp <<EOSS
3112$startsh
3113: expand filename
3114case "\$1" in
3115 ~/*|~)
3116 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3117 ;;
3118 ~*)
3119 if $test -f /bin/csh; then
3120 /bin/csh -f -c "glob \$1"
3121 failed=\$?
3122 echo ""
3123 exit \$failed
e5e20432 3124 else
bd9b35c9
JH
3125 name=\`$expr x\$1 : '..\([^/]*\)'\`
3126 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3127 if $test ! -d "\$dir"; then
3128 me=\`basename \$0\`
3129 echo "\$me: can't locate home directory for: \$name" >&2
3130 exit 1
3131 fi
3132 case "\$1" in
3133 */*)
3134 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3135 ;;
3136 *)
3137 echo \$dir
e5e20432
JH
3138 ;;
3139 esac
3140 fi
b691c02f 3141 ;;
4633a7c4 3142*)
bd9b35c9 3143 echo \$1
2304df62
AD
3144 ;;
3145esac
4633a7c4
LW
3146EOSS
3147chmod +x filexp
3148$eunicefix filexp
2304df62
AD
3149
3150: now set up to get a file name
28757baa 3151cat <<EOS >getfile
3152$startsh
3153EOS
3154cat <<'EOSC' >>getfile
2304df62
AD
3155tilde=''
3156fullpath=''
3157already=''
3158skip=''
3159none_ok=''
3160exp_file=''
a0d0e21e 3161nopath_ok=''
2304df62
AD
3162orig_rp="$rp"
3163orig_dflt="$dflt"
b233458b
JH
3164case "$gfpth" in
3165'') gfpth='.' ;;
3166esac
2304df62
AD
3167
3168case "$fn" in
ecfc5424 3169*\(*)
28e8609d 3170 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
3171 fn=`echo $fn | sed 's/(.*)//'`
3172 ;;
3173esac
3174
3175case "$fn" in
a0d0e21e
LW
3176*:*)
3177 loc_file=`expr $fn : '.*:\(.*\)'`
3178 fn=`expr $fn : '\(.*\):.*'`
3179 ;;
3180esac
3181
3182case "$fn" in
2304df62
AD
3183*~*) tilde=true;;
3184esac
3185case "$fn" in
3186*/*) fullpath=true;;
3187esac
3188case "$fn" in
3189*+*) skip=true;;
3190esac
3191case "$fn" in
3192*n*) none_ok=true;;
3193esac
3194case "$fn" in
3195*e*) exp_file=true;;
3196esac
a0d0e21e
LW
3197case "$fn" in
3198*p*) nopath_ok=true;;
3199esac
2304df62
AD
3200
3201case "$fn" in
3202*f*) type='File';;
3203*d*) type='Directory';;
a0d0e21e 3204*l*) type='Locate';;
2304df62
AD
3205esac
3206
3207what="$type"
3208case "$what" in
3209Locate) what='File';;
3210esac
3211
3212case "$exp_file" in
3213'')
3214 case "$d_portable" in
3215 "$define") ;;
3216 *) exp_file=true;;
3217 esac
3218 ;;
3219esac
3220
3221cd ..
3222while test "$type"; do
3223 redo=''
3224 rp="$orig_rp"
3225 dflt="$orig_dflt"
3226 case "$tilde" in
3227 true) rp="$rp (~name ok)";;
3228 esac
3229 . UU/myread
ecfc5424
AD
3230 if test -f UU/getfile.ok && \
3231 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3232 then
3233 value="$ans"
3234 ansexp="$ans"
3235 break
3236 fi
2304df62
AD
3237 case "$ans" in
3238 none)
3239 value=''
3240 ansexp=''
3241 case "$none_ok" in
3242 true) type='';;
3243 esac
3244 ;;
3245 *)
3246 case "$tilde" in
3247 '') value="$ans"
3248 ansexp="$ans";;
3249 *)
3250 value=`UU/filexp $ans`
3251 case $? in
3252 0)
3253 if test "$ans" != "$value"; then
ecfc5424 3254 echo "(That expands to $value on this system.)"
2304df62
AD
3255 fi
3256 ;;
3257 *) value="$ans";;
3258 esac
3259 ansexp="$value"
3260 case "$exp_file" in
3261 '') value="$ans";;
3262 esac
3263 ;;
3264 esac
3265 case "$fullpath" in
3266 true)
3267 case "$ansexp" in
3268 /*) value="$ansexp" ;;
3269 *)
3270 redo=true
3271 case "$already" in
3272 true)
3273 echo "I shall only accept a full path name, as in /bin/ls." >&4
3274 echo "Use a ! shell escape if you wish to check pathnames." >&4
3275 ;;
3276 *)
3277 echo "Please give a full path name, starting with slash." >&4
3278 case "$tilde" in
3279 true)
3280 echo "Note that using ~name is ok provided it expands well." >&4
3281 already=true
3282 ;;
3283 esac
3284 esac
3285 ;;
3286 esac
3287 ;;
3288 esac
3289 case "$redo" in
3290 '')
3291 case "$type" in
3292 File)
b233458b
JH
3293 for fp in $gfpth; do
3294 if test "X$fp" = X.; then
3295 pf="$ansexp"
3296 else
3297 pf="$fp/$ansexp"
3298 fi
3299 if test -f "$pf"; then
3300 type=''
3301 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3302 then
3303 echo "($value is not a plain file, but that's ok.)"
3304 type=''
3305 fi
3306 if test X"$type" = X; then
3307 value="$pf"
3308 break
3309 fi
3310 done
2304df62
AD
3311 ;;
3312 Directory)
b233458b
JH
3313 for fp in $gfpth; do
3314 if test "X$fp" = X.; then
f78bfc9c
JH
3315 dir="$ans"
3316 direxp="$ansexp"
b233458b 3317 else
dd858076 3318 dir="$fp/$ansexp"
f78bfc9c 3319 direxp="$fp/$ansexp"
b233458b 3320 fi
f78bfc9c 3321 if test -d "$direxp"; then
b233458b 3322 type=''
f78bfc9c 3323 value="$dir"
b233458b
JH
3324 break
3325 fi
3326 done
2304df62
AD
3327 ;;
3328 Locate)
40000a8c 3329 if test -d "$ansexp"; then
a0d0e21e
LW
3330 echo "(Looking for $loc_file in directory $value.)"
3331 value="$value/$loc_file"
40000a8c 3332 ansexp="$ansexp/$loc_file"
2304df62 3333 fi
40000a8c 3334 if test -f "$ansexp"; then
2304df62
AD
3335 type=''
3336 fi
a0d0e21e
LW
3337 case "$nopath_ok" in
3338 true) case "$value" in
3339 */*) ;;
3340 *) echo "Assuming $value will be in people's path."
3341 type=''
3342 ;;
3343 esac
3344 ;;
3345 esac
2304df62
AD
3346 ;;
3347 esac
3348
3349 case "$skip" in
3350 true) type='';
3351 esac
3352
3353 case "$type" in
3354 '') ;;
3355 *)
3356 if test "$fastread" = yes; then
3357 dflt=y
3358 else
3359 dflt=n
3360 fi
3361 rp="$what $value doesn't exist. Use that name anyway?"
3362 . UU/myread
3363 dflt=''
3364 case "$ans" in
3365 y*) type='';;
3366 *) echo " ";;
3367 esac
3368 ;;
3369 esac
3370 ;;
3371 esac
3372 ;;
3373 esac
3374done
3375cd UU
3376ans="$value"
3377rp="$orig_rp"
3378dflt="$orig_dflt"
ecfc5424 3379rm -f getfile.ok
b233458b 3380test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
3381EOSC
3382
bd9b35c9
JH
3383: What should the include directory be ?
3384echo " "
3385$echo $n "Hmm... $c"
3386dflt='/usr/include'
3387incpath=''
3388mips_type=''
3389if $test -f /bin/mips && /bin/mips; then
3390 echo "Looks like a MIPS system..."
3391 $cat >usr.c <<'EOCP'
3392#ifdef SYSTYPE_BSD43
3393/bsd43
3394#endif
3395EOCP
3396 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3397 dflt='/bsd43/usr/include'
3398 incpath='/bsd43'
3399 mips_type='BSD 4.3'
3400 else
3401 mips_type='System V'
3402 fi
3403 $rm -f usr.c usr.out
3404 echo "and you're compiling with the $mips_type compiler and libraries."
3405 xxx_prompt=y
3406 echo "exit 0" >mips
3407else
3408 echo "Doesn't look like a MIPS system."
3409 xxx_prompt=n
3410 echo "exit 1" >mips
3411fi
3412chmod +x mips
3413$eunicefix mips
3414case "$usrinc" in
3415'') ;;
3416*) dflt="$usrinc";;
3417esac
3418case "$xxx_prompt" in
3419y) fn=d/
3420 echo " "
3421 rp='Where are the include files you want to use?'
3422 . ./getfile
3423 usrinc="$ans"
8e07c86e 3424 ;;
bd9b35c9 3425*) usrinc="$dflt"
8e07c86e
AD
3426 ;;
3427esac
2304df62 3428
fc68435e
JH
3429: see how we invoke the C preprocessor
3430echo " "
3431echo "Now, how can we feed standard input to your C preprocessor..." >&4
3432cat <<'EOT' >testcpp.c
3433#define ABC abc
3434#define XYZ xyz
3435ABC.XYZ
3436EOT
3437cd ..
3438if test ! -f cppstdin; then
3439 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3440 # AIX cc -E doesn't show the absolute headerfile
3441 # locations but we'll cheat by using the -M flag.
3442 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
3443 else
3444 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3445 fi
3446else
3447 echo "Keeping your $hint cppstdin wrapper."
3448fi
3449chmod 755 cppstdin
3450wrapper=`pwd`/cppstdin
3451ok='false'
3452cd UU
3453
3454if $test "X$cppstdin" != "X" && \
3455 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3456 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3457then
3458 echo "You used to use $cppstdin $cppminus so we'll use that again."
3459 case "$cpprun" in
3460 '') echo "But let's see if we can live without a wrapper..." ;;
3461 *)
3462 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3463 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3464 then
3465 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3466 ok='true'
3467 else
3468 echo "(However, $cpprun $cpplast does not work, let's see...)"
3469 fi
3470 ;;
3471 esac
3472else
3473 case "$cppstdin" in
3474 '') ;;
3475 *)
3476 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3477 ;;
3478 esac
3479fi
3480
3481if $ok; then
3482 : nothing
3483elif echo 'Maybe "'"$cc"' -E" will work...'; \
3484 $cc -E <testcpp.c >testcpp.out 2>&1; \
3485 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3486 echo "Yup, it does."
3487 x_cpp="$cc -E"
3488 x_minus='';
3489elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3490 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3491 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3492 echo "Yup, it does."
3493 x_cpp="$cc -E"
3494 x_minus='-';
3495elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3496 $cc -P <testcpp.c >testcpp.out 2>&1; \
3497 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3498 echo "Yipee, that works!"
3499 x_cpp="$cc -P"
3500 x_minus='';
3501elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3502 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3503 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3504 echo "At long last!"
3505 x_cpp="$cc -P"
3506 x_minus='-';
3507elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3508 $cpp <testcpp.c >testcpp.out 2>&1; \
3509 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3510 echo "It works!"
3511 x_cpp="$cpp"
3512 x_minus='';
3513elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3514 $cpp - <testcpp.c >testcpp.out 2>&1; \
3515 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3516 echo "Hooray, it works! I was beginning to wonder."
3517 x_cpp="$cpp"
3518 x_minus='-';
3519elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3520 $wrapper <testcpp.c >testcpp.out 2>&1; \
3521 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3522 x_cpp="$wrapper"
3523 x_minus=''
3524 echo "Eureka!"
3525else
3526 dflt=''
3527 rp="No dice. I can't find a C preprocessor. Name one:"
3528 . ./myread
3529 x_cpp="$ans"
3530 x_minus=''
3531 $x_cpp <testcpp.c >testcpp.out 2>&1
3532 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533 echo "OK, that will do." >&4
3534 else
3535echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3536 exit 1
3537 fi
3538fi
3539
3540case "$ok" in
3541false)
3542 cppstdin="$x_cpp"
3543 cppminus="$x_minus"
3544 cpprun="$x_cpp"
3545 cpplast="$x_minus"
3546 set X $x_cpp
3547 shift
3548 case "$1" in
3549 "$cpp")
3550 echo "Perhaps can we force $cc -E using a wrapper..."
3551 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3552 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3553 then
3554 echo "Yup, we can."
3555 cppstdin="$wrapper"
3556 cppminus='';
3557 else
3558 echo "Nope, we'll have to live without it..."
3559 fi
3560 ;;
3561 esac
3562 case "$cpprun" in
3563 "$wrapper")
3564 cpprun=''
3565 cpplast=''
3566 ;;
3567 esac
3568 ;;
3569esac
3570
3571case "$cppstdin" in
3572"$wrapper"|'cppstdin') ;;
3573*) $rm -f $wrapper;;
3574esac
3575$rm -f testcpp.c testcpp.out
3576
bd9b35c9
JH
3577: Set private lib path
3578case "$plibpth" in
3579'') if ./mips; then
3580 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3581 fi;;
3582esac
3583case "$libpth" in
3584' ') dlist='';;
3585'') dlist="$loclibpth $plibpth $glibpth";;
3586*) dlist="$libpth";;
3587esac
3588
3589: Now check and see which directories actually exist, avoiding duplicates
3590libpth=''
3591for xxx in $dlist
3592do
3593 if $test -d $xxx; then
3594 case " $libpth " in
3595 *" $xxx "*) ;;
3596 *) libpth="$libpth $xxx";;
3597 esac
3598 fi
3599done
3600$cat <<'EOM'
3601
3602Some systems have incompatible or broken versions of libraries. Among
3603the directories listed in the question below, please remove any you
3604know not to be holding relevant libraries, and add any that are needed.
3605Say "none" for none.
8e07c86e
AD
3606
3607EOM
bd9b35c9
JH
3608case "$libpth" in
3609'') dflt='none';;
8e07c86e 3610*)
bd9b35c9
JH
3611 set X $libpth
3612 shift
3613 dflt=${1+"$@"}
8e07c86e 3614 ;;
a0d0e21e 3615esac
bd9b35c9
JH
3616rp="Directories to use for library searches?"
3617. ./myread
3618case "$ans" in
3619none) libpth=' ';;
3620*) libpth="$ans";;
3621esac
a0d0e21e 3622
bd9b35c9
JH
3623: compute shared library extension
3624case "$so" in
3625'')
3626 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3627 dflt='sl'
dd4e71fd 3628 else
bd9b35c9 3629 dflt='so'
dd4e71fd
JH
3630 fi
3631 ;;
bd9b35c9 3632*) dflt="$so";;
dd4e71fd 3633esac
dd4e71fd
JH
3634$cat <<EOM
3635
bd9b35c9 3636On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 3637you want to suppress searching of shared libraries for the remainder
bd9b35c9 3638of this configuration.
dd4e71fd
JH
3639
3640EOM
bd9b35c9
JH
3641rp='What is the file extension used for shared libraries?'
3642. ./myread
3643so="$ans"
dd4e71fd 3644
bd9b35c9
JH
3645: Define several unixisms.
3646: Hints files or command line option can be used to override them.
3647: The convoluted testing is in case hints files set either the old
3648: or the new name.
3649case "$_exe" in
3650'') case "$exe_ext" in
3651 '') ;;
3652 *) _exe="$exe_ext" ;;
dd4e71fd 3653 esac
bd9b35c9 3654 ;;
bfb7748a 3655esac
bd9b35c9
JH
3656case "$_a" in
3657'') case "$lib_ext" in
3658 '') _a='.a';;
3659 *) _a="$lib_ext" ;;
dd4e71fd
JH
3660 esac
3661 ;;
dd4e71fd 3662esac
bd9b35c9
JH
3663case "$_o" in
3664'') case "$obj_ext" in
3665 '') _o='.o';;
3666 *) _o="$obj_ext";;
3667 esac
3668 ;;
3669esac
3670case "$p_" in
3671'') case "$path_sep" in
3672 '') p_=':';;
3673 *) p_="$path_sep";;
3674 esac
3675 ;;
3676esac
3677exe_ext=$_exe
3678lib_ext=$_a
3679obj_ext=$_o
3680path_sep=$p_
dd4e71fd 3681
bd9b35c9
JH
3682: Which makefile gets called first. This is used by make depend.
3683case "$firstmakefile" in
3684'') firstmakefile='makefile';;
4633a7c4 3685esac
4633a7c4 3686
0f0995ae
JH
3687case "$usesocks" in
3688$define|true|[yY]*) dflt='y';;
3689*) dflt='n';;
3690esac
bd9b35c9 3691cat <<EOM
4633a7c4 3692
bd9b35c9
JH
3693Perl can be built to use the SOCKS proxy protocol library. To do so,
3694Configure must be run with -Dusesocks.
4633a7c4 3695
0f0995ae 3696If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 3697EOM
bd9b35c9
JH
3698rp='Build Perl for SOCKS?'
3699. ./myread
3700case "$ans" in
3701y|Y) val="$define" ;;
3702*) val="$undef" ;;
3703esac
3704set usesocks
3705eval $setvar
3706
3707: Looking for optional libraries
3708echo " "
3709echo "Checking for optional libraries..." >&4
3710case "$libs" in
3711' '|'') dflt='';;
3712*) dflt="$libs";;
3713esac
3714case "$libswanted" in
3715'') libswanted='c_s';;
3716esac
3717case "$usesocks" in
923fc586 3718"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 3719esac
68435ea7
JH
3720libsfound=''
3721libsfiles=''
3722libsdirs=''
13b3f787
JH
3723libspath=''
3724for thisdir in $libpth $xlibpth; do
3725 test -d $thisdir && libspath="$libspath $thisdir"
3726done
bd9b35c9 3727for thislib in $libswanted; do
13b3f787 3728 for thisdir in $libspath; do
f7dd4e7f
JH
3729 xxx=''
3730 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3731 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3732 $test -f "$xxx" && eval $libscheck
3733 $test -f "$xxx" && libstyle=shared
3734 fi
3735 if test ! -f "$xxx"; then
3736 xxx=$thisdir/lib$thislib.$so
3737 $test -f "$xxx" && eval $libscheck
3738 $test -f "$xxx" && libstyle=shared
3739 fi
3740 if test ! -f "$xxx"; then
3741 xxx=$thisdir/lib$thislib$_a
3742 $test -f "$xxx" && eval $libscheck
3743 $test -f "$xxx" && libstyle=static
3744 fi
3745 if test ! -f "$xxx"; then
3746 xxx=$thisdir/$thislib$_a
3747 $test -f "$xxx" && eval $libscheck
3748 $test -f "$xxx" && libstyle=static
3749 fi
3750 if test ! -f "$xxx"; then
3751 xxx=$thisdir/lib${thislib}_s$_a
3752 $test -f "$xxx" && eval $libscheck
3753 $test -f "$xxx" && libstyle=static
09ea5ba9 3754 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
3755 fi
3756 if test ! -f "$xxx"; then
3757 xxx=$thisdir/Slib$thislib$_a
3758 $test -f "$xxx" && eval $libscheck
3759 $test -f "$xxx" && libstyle=static
3760 fi
3761 if $test -f "$xxx"; then
43999f95 3762 case "$libstyle" in
f7dd4e7f
JH
3763 shared) echo "Found -l$thislib (shared)." ;;
3764 static) echo "Found -l$thislib." ;;
3765 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 3766 esac
bd9b35c9
JH
3767 case " $dflt " in
3768 *"-l$thislib "*);;
f7dd4e7f 3769 *) dflt="$dflt -l$thislib"
43999f95
JH
3770 libsfound="$libsfound $xxx"
3771 yyy=`basename $xxx`
3772 libsfiles="$libsfiles $yyy"
1e127011 3773 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
3774 case " $libsdirs " in
3775 *" $yyy "*) ;;
3776 *) libsdirs="$libsdirs $yyy" ;;
3777 esac
3778 ;;
bd9b35c9 3779 esac
f7dd4e7f
JH
3780 break
3781 fi
3782 done
3783 if $test ! -f "$xxx"; then
3784 echo "No -l$thislib."
bd9b35c9
JH
3785 fi
3786done
3787set X $dflt
3788shift
3789dflt="$*"
3790case "$libs" in
3791'') dflt="$dflt";;
3792*) dflt="$libs";;
3793esac
3794case "$dflt" in
3795' '|'') dflt='none';;
3796esac
4633a7c4 3797
bd9b35c9 3798$cat <<EOM
4633a7c4 3799
bd9b35c9
JH
3800In order to compile $package on your machine, a number of libraries
3801are usually needed. Include any other special libraries here as well.
3802Say "none" for none. The default list is almost always right.
8e07c86e 3803EOM
8e07c86e 3804
bd9b35c9
JH
3805echo " "
3806rp="What libraries to use?"
3807. ./myread
3808case "$ans" in
3809none) libs=' ';;
3810*) libs="$ans";;
3811esac
d71b2b6b 3812
bd9b35c9
JH
3813: determine optimization, if desired, or use for debug flag also
3814case "$optimize" in
3815' '|$undef) dflt='none';;
3816'') dflt='-O';;
3817*) dflt="$optimize";;
3818esac
3819$cat <<EOH
d71b2b6b 3820
bd9b35c9
JH
3821By default, $package compiles with the -O flag to use the optimizer.
3822Alternately, you might want to use the symbolic debugger, which uses
3823the -g flag (on traditional Unix systems). Either flag can be
3824specified here. To use neither flag, specify the word "none".
d71b2b6b 3825
bd9b35c9
JH
3826EOH
3827rp="What optimizer/debugger flag should be used?"
3828. ./myread
3829optimize="$ans"
3830case "$optimize" in
3831'none') optimize=" ";;
3832esac
3833
3834dflt=''
3835: We will not override a previous value, but we might want to
3836: augment a hint file
3837case "$hint" in
3838default|recommended)
3839 case "$gccversion" in
3840 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 3841 esac
bd9b35c9
JH
3842 case "$optimize" in
3843 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 3844 esac
bd9b35c9
JH
3845 case "$gccversion" in
3846 2*) if test -d /etc/conf/kconfig.d &&
3847 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3848 then
3849 dflt="$dflt -posix"
3850 fi
f0d04425 3851 ;;
bd9b35c9
JH
3852 esac
3853 case "$gccversion" in
3854 1*) ;;
3855 2.[0-8]*) ;;
3856 ?*) echo " "
3857 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3858 echo 'int main(void) { return 0; }' > gcctest.c
3859 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3860 echo "Yes, it does." 2>&1
3861 case "$ccflags" in
3862 *strict-aliasing*)
3863 echo "Leaving current flags $ccflags alone." 2>&1
3864 ;;
3865 *) dflt="$dflt -fno-strict-aliasing" ;;
3866 esac
3867 else
3868 echo "Nope, it doesn't, but that's ok." 2>&1
3869 fi
f0d04425 3870 ;;
e5e20432
JH
3871 esac
3872 ;;
3873esac
3874
bd9b35c9
JH
3875case "$mips_type" in
3876*BSD*|'') inclwanted="$locincpth $usrinc";;
3877*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3878esac
3879for thisincl in $inclwanted; do
3880 if $test -d $thisincl; then
3881 if $test x$thisincl != x$usrinc; then
3882 case "$dflt" in
3883 *$thisincl*);;
3884 *) dflt="$dflt -I$thisincl";;
3885 esac
3886 fi
3887 fi
3888done
40a7a20a 3889
bd9b35c9
JH
3890inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3891 xxx=true;
3892elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3893 xxx=true;
3894else
3895 xxx=false;
3896fi;
3897if $xxx; then
3898 case "$dflt" in
3899 *$2*);;
3900 *) dflt="$dflt -D$2";;
3901 esac;
3902fi'
40a7a20a 3903
bd9b35c9 3904set signal.h LANGUAGE_C; eval $inctest
40a7a20a 3905
bd9b35c9
JH
3906case "$usesocks" in
3907$define)
3908 ccflags="$ccflags -DSOCKS"
3909 ;;
3910esac
40a7a20a 3911
bd9b35c9
JH
3912case "$hint" in
3913default|recommended) dflt="$ccflags $dflt" ;;
3914*) dflt="$ccflags";;
3915esac
40a7a20a 3916
bd9b35c9
JH
3917case "$dflt" in
3918''|' ') dflt=none;;
3919esac
3920$cat <<EOH
40a7a20a 3921
bd9b35c9
JH
3922Your C compiler may want other flags. For this question you should include
3923-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3924but you should NOT include libraries or ld flags like -lwhatever. If you
3925want $package to honor its debug switch, you should include -DDEBUGGING here.
3926Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 3927
bd9b35c9 3928To use no flags, specify the word "none".
40a7a20a 3929
bd9b35c9
JH
3930EOH
3931set X $dflt
3932shift
3933dflt=${1+"$@"}
3934rp="Any additional cc flags?"
3935. ./myread
3936case "$ans" in
3937none) ccflags='';;
3938*) ccflags="$ans";;
3939esac
8e07c86e 3940
bd9b35c9
JH
3941: the following weeds options from ccflags that are of no interest to cpp
3942cppflags="$ccflags"
3943case "$gccversion" in
39441*) cppflags="$cppflags -D__GNUC__"
4633a7c4 3945esac
bd9b35c9
JH
3946case "$mips_type" in
3947'');;
3948*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3949esac
3950case "$cppflags" in
3951'');;
3952*)
3953 echo " "
3954 echo "Let me guess what the preprocessor flags are..." >&4
3955 set X $cppflags
3956 shift
3957 cppflags=''
3958 $cat >cpp.c <<'EOM'
3959#define BLURFL foo
8e07c86e 3960
bd9b35c9
JH
3961BLURFL xx LFRULB
3962EOM
3963 previous=''
3964 for flag in $*
3965 do
3966 case "$flag" in
3967 -*) ftry="$flag";;
3968 *) ftry="$previous $flag";;
3969 esac
3970 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3971 >cpp1.out 2>/dev/null && \
3972 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3973 >cpp2.out 2>/dev/null && \
3974 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3975 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3976 then
3977 cppflags="$cppflags $ftry"
3978 previous=''
3979 else
3980 previous="$flag"
3981 fi
3982 done
3983 set X $cppflags
3984 shift
3985 cppflags=${1+"$@"}
3986 case "$cppflags" in
3987 *-*) echo "They appear to be: $cppflags";;
3988 esac
3989 $rm -f cpp.c cpp?.out
2afac517 3990 ;;
3991esac
8e07c86e 3992
bd9b35c9
JH
3993: flags used in final linking phase
3994case "$ldflags" in
3995'') if ./venix; then
3996 dflt='-i -z'
10a23457 3997 else
bd9b35c9 3998 dflt=''
10a23457 3999 fi
bd9b35c9
JH
4000 case "$ccflags" in
4001 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4002 esac
bd9b35c9
JH
4003 ;;
4004*) dflt="$ldflags";;
4005esac
4006
4007: Try to guess additional flags to pick up local libraries.
4008for thislibdir in $libpth; do
4009 case " $loclibpth " in
4010 *" $thislibdir "*)
4011 case "$dflt " in
4012 *"-L$thislibdir "*) ;;
4013 *) dflt="$dflt -L$thislibdir" ;;
4014 esac
c4f23d77
AD
4015 ;;
4016 esac
bd9b35c9 4017done
c4f23d77 4018
bd9b35c9
JH
4019case "$dflt" in
4020'') dflt='none' ;;
4021esac
c4f23d77 4022
bd9b35c9
JH
4023$cat <<EOH
4024
4025Your C linker may need flags. For this question you should
4026include -L/whatever and any other flags used by the C linker, but you
4027should NOT include libraries like -lwhatever.
4028
4029Make sure you include the appropriate -L/path flags if your C linker
4030does not normally search all of the directories you specified above,
4031namely
4032 $libpth
4033To use no flags, specify the word "none".
4034
4035EOH
4036
4037rp="Any additional ld flags (NOT including libraries)?"
4038. ./myread
4039case "$ans" in
4040none) ldflags='';;
4041*) ldflags="$ans";;
4042esac
4043rmlist="$rmlist pdp11"
4044
4045: coherency check
4046echo " "
4047echo "Checking your choice of C compiler and flags for coherency..." >&4
4048$cat > try.c <<'EOF'
4049#include <stdio.h>
4050int main() { printf("Ok\n"); exit(0); }
4051EOF
4052set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4053shift
4054$cat >try.msg <<'EOM'
4055I've tried to compile and run the following simple program:
4056
4057EOM
4058$cat try.c >> try.msg
4059
4060$cat >> try.msg <<EOM
4061
4062I used the command:
4063
4064 $*
4065 ./try
4066
4067and I got the following output:
4068
4069EOM
4070dflt=y
4071if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4072 if sh -c './try' >>try.msg 2>&1; then
4073 xxx=`./try`
4074 case "$xxx" in
4075 "Ok") dflt=n ;;
4076 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4077 case " $libs " in
4078 *" -lsfio "*)
4079 cat >> try.msg <<'EOQS'
4080If $libs contains -lsfio, and sfio is mis-configured, then it
4081sometimes (apparently) runs and exits with a 0 status, but with no
4082output! It may have to do with sfio's use of _exit vs. exit.
4083
4084EOQS
4085 rp="You have a big problem. Shall I abort Configure"
4086 dflt=y
4087 ;;
4088 esac
4089 ;;
4090 esac
4091 else
4092 echo "The program compiled OK, but exited with status $?." >>try.msg
4093 rp="You have a problem. Shall I abort Configure"
4094 dflt=y
4095 fi
4096else
4097 echo "I can't compile the test program." >>try.msg
4098 rp="You have a BIG problem. Shall I abort Configure"
4099 dflt=y
4100fi
4101case "$dflt" in
4102y)
4103 $cat try.msg >&4
4104 case "$knowitall" in
4105 '')
4106 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4107 ;;
bd9b35c9 4108 *) dflt=n;;
c4f23d77 4109 esac
bd9b35c9
JH
4110 echo " "
4111 . ./myread
4112 case "$ans" in
4113 n*|N*) ;;
4114 *) echo "Ok. Stopping Configure." >&4
4115 exit 1
c4f23d77
AD
4116 ;;
4117 esac
4118 ;;
bd9b35c9 4119n) echo "OK, that should do.";;
c4f23d77 4120esac
bd9b35c9 4121$rm -f try try.* core
c4f23d77 4122
bd9b35c9
JH
4123: define an is-a-typedef? function
4124typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4125case "$inclist" in
4126"") inclist="sys/types.h";;
4127esac;
4128eval "varval=\$$var";
4129case "$varval" in
4130"")
4131 $rm -f temp.c;
4132 for inc in $inclist; do
4133 echo "#include <$inc>" >>temp.c;
4134 done;
4135 echo "#ifdef $type" >> temp.c;
4136 echo "printf(\"We have $type\");" >> temp.c;
4137 echo "#endif" >> temp.c;
4138 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4139 if $contains $type temp.E >/dev/null 2>&1; then
4140 eval "$var=\$type";
4141 else
4142 eval "$var=\$def";
4143 fi;
4144 $rm -f temp.?;;
4145*) eval "$var=\$varval";;
4146esac'
8e07c86e 4147
bd9b35c9
JH
4148: define an is-a-typedef? function that prompts if the type is not available.
4149typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4150case "$inclist" in
4151"") inclist="sys/types.h";;
4152esac;
4153eval "varval=\$$var";
4154case "$varval" in
4155"")
4156 $rm -f temp.c;
4157 for inc in $inclist; do
4158 echo "#include <$inc>" >>temp.c;
4159 done;
4160 echo "#ifdef $type" >> temp.c;
4161 echo "printf(\"We have $type\");" >> temp.c;
4162 echo "#endif" >> temp.c;
4163 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4164 echo " " ;
4165 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4166 if $contains $type temp.E >/dev/null 2>&1; then
4167 echo "$type found." >&4;
4168 eval "$var=\$type";
4169 else
4170 echo "$type NOT found." >&4;
4171 dflt="$def";
4172 . ./myread ;
4173 eval "$var=\$ans";
4174 fi;
4175 $rm -f temp.?;;
4176*) eval "$var=\$varval";;
4177esac'
8e07c86e 4178
bd9b35c9
JH
4179: define a shorthand compile call
4180compile='
4181mc_file=$1;
4182shift;
4183$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4184: define a shorthand compile call for compilations that should be ok.
4185compile_ok='
4186mc_file=$1;
4187shift;
4188$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
8e07c86e 4189
bd9b35c9
JH
4190: check for lengths of integral types
4191echo " "
4192case "$intsize" in
2afac517 4193'')
bd9b35c9
JH
4194 echo "Checking to see how big your integers are..." >&4
4195 $cat >intsize.c <<'EOCP'
4196#include <stdio.h>
4197int main()
4198{
4199 printf("intsize=%d;\n", (int)sizeof(int));
4200 printf("longsize=%d;\n", (int)sizeof(long));
4201 printf("shortsize=%d;\n", (int)sizeof(short));
4202 exit(0);
4203}
4204EOCP
4205 set intsize
4206 if eval $compile_ok && ./intsize > /dev/null; then
4207 eval `./intsize`
4208 echo "Your integers are $intsize bytes long."
4209 echo "Your long integers are $longsize bytes long."
4210 echo "Your short integers are $shortsize bytes long."
2afac517 4211 else
bd9b35c9
JH
4212 $cat >&4 <<EOM
4213!
4214Help! I can't compile and run the intsize test program: please enlighten me!
4215(This is probably a misconfiguration in your system or libraries, and
4216you really ought to fix it. Still, I'll try anyway.)
4217!
4218EOM
4219 dflt=4
4220 rp="What is the size of an integer (in bytes)?"
4221 . ./myread
4222 intsize="$ans"
4223 dflt=$intsize
4224 rp="What is the size of a long integer (in bytes)?"
4225 . ./myread
4226 longsize="$ans"
4227 dflt=2
4228 rp="What is the size of a short integer (in bytes)?"
4229 . ./myread
4230 shortsize="$ans"
2afac517 4231 fi
4232 ;;
8e07c86e 4233esac
bd9b35c9
JH
4234$rm -f intsize intsize.*
4235
4236: see what type lseek is declared as in the kernel
4237rp="What is the type used for lseek's offset on this system?"
4238set off_t lseektype long stdio.h sys/types.h
4239eval $typedef_ask
4240
4241echo " "
49c10eea 4242echo "Checking to see how big your file offsets are..." >&4
bd9b35c9
JH
4243$cat >try.c <<EOCP
4244#include <sys/types.h>
4245#include <stdio.h>
4246int main()
4247{
4248 printf("%d\n", (int)sizeof($lseektype));
4249 return(0);
4250}
4251EOCP
4252set try
4253if eval $compile_ok; then
4254 lseeksize=`./try`
49c10eea 4255 echo "Your file offsets are $lseeksize bytes long."
bd9b35c9
JH
4256else
4257 dflt=$longsize
4258 echo " "
4259 echo "(I can't seem to compile the test program. Guessing...)"
4260 rp="What is the size of your file offsets (in bytes)?"
4261 . ./myread
4262 lseeksize="$ans"
4263fi
4264$rm -f try.c try
4265
4266: see what type file positions are declared as in the library
4267rp="What is the type for file position used by fsetpos()?"
4268set fpos_t fpostype long stdio.h sys/types.h
4269eval $typedef_ask
4270
4271echo " "
4272case "$fpostype" in
4273*_t) zzz="$fpostype" ;;
4274*) zzz="fpos_t" ;;
4275esac
49c10eea 4276echo "Checking the size of $zzz..." >&4
bd9b35c9
JH
4277cat > try.c <<EOCP
4278#include <sys/types.h>
4279#include <stdio.h>
4280int main() {
4281 printf("%d\n", (int)sizeof($fpostype));
4282 exit(0);
4283}
4284EOCP
4285set try
4286if eval $compile_ok; then
4287 yyy=`./try`
4288 case "$yyy" in
4289 '') fpossize=4
bd9b35c9
JH
4290 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4291 ;;
4292 *) fpossize=$yyy
c890dc6c 4293 echo "Your $zzz is $fpossize bytes long."
bd9b35c9
JH
4294 ;;
4295 esac
4296else
4297 dflt="$longsize"
68435ea7 4298 echo " " >&4
bd9b35c9
JH
4299 echo "(I can't compile the test program. Guessing...)" >&4
4300 rp="What is the size of your file positions (in bytes)?"
4301 . ./myread
4302 fpossize="$ans"
4303fi
4304
4305
8e07c86e 4306
10cc9d2a
JH
4307# Backward compatibility (uselfs is deprecated).
4308case "$uselfs" in
4309"$define"|true|[yY]*)
4310 cat <<EOM >&4
4311
4312*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
10cc9d2a
JH
4313EOM
4314 uselargefiles="$define"
4315 ;;
4316esac
4317
bd9b35c9
JH
4318case "$lseeksize:$fpossize" in
43198:8) cat <<EOM
8e07c86e 4320
bd9b35c9 4321You can have files larger than 2 gigabytes.
8e07c86e 4322EOM
bd9b35c9 4323 val="$define" ;;
0f0995ae
JH
4324*) case "$uselargefiles" in
4325 "$undef"|false|[nN]*) dflt='n' ;;
4326 *) dflt='y' ;;
4327 esac
4328 cat <<EOM
8e07c86e 4329
bd9b35c9 4330Perl can be built to understand large files (files larger than 2 gigabytes)
0f0995ae 4331on some systems. To do so, Configure can be run with -Duselargefiles.
bd9b35c9 4332
0f0995ae 4333If this doesn't make any sense to you, just accept the default '$dflt'.
bd9b35c9 4334EOM
bd9b35c9
JH
4335 rp='Try to understand large files, if available?'
4336 . ./myread
4337 case "$ans" in
4338 y|Y) val="$define" ;;
4339 *) val="$undef" ;;
4340 esac
4341 ;;
dfe9444c 4342esac
bd9b35c9
JH
4343set uselargefiles
4344eval $setvar
4345case "$uselargefiles" in
4346"$define")
4347: Look for a hint-file generated 'call-back-unit'. If the
4348: user has specified that a large files perl is to be built,
4349: we may need to set or change some other defaults.
8a647129 4350 if $test -f uselargefiles.cbu; then
bd9b35c9 4351 echo "Your platform has some specific hints for large file builds, using them..."
8a647129 4352 . ./uselargefiles.cbu
bd9b35c9 4353 echo " "
49c10eea 4354 echo "Rechecking to see how big your file offsets are..." >&4
bd9b35c9
JH
4355 $cat >try.c <<EOCP
4356#include <sys/types.h>
4357#include <stdio.h>
4358int main()
4359{
4360 printf("%d\n", (int)sizeof($lseektype));
4361 return(0);
4362}
4363EOCP
4364 set try
4365 if eval $compile_ok; then
4366 lseeksize=`./try`
49c10eea 4367 $echo "Your file offsets are now $lseeksize bytes long."
bd9b35c9
JH
4368 else
4369 dflt="$lseeksize"
4370 echo " "
4371 echo "(I can't seem to compile the test program. Guessing...)"
4372 rp="What is the size of your file offsets (in bytes)?"
4373 . ./myread
4374 lseeksize="$ans"
4375 fi
4376 case "$fpostype" in
4377 *_t) zzz="$fpostype" ;;
4378 *) zzz="fpos_t" ;;
4379 esac
4380 $echo $n "Rechecking the size of $zzz...$c" >&4
4381 $cat > try.c <<EOCP
4382#include <sys/types.h>
4383#include <stdio.h>
4384int main() {
4385 printf("%d\n", (int)sizeof($fpostype));
4386 exit(0);
4387}
4388EOCP
4389 set try
4390 if eval $compile_ok; then
4391 yyy=`./try`
4392 dflt="$lseeksize"
4393 case "$yyy" in
4394 '') echo " "
4395 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4396 ;;
4397 *) fpossize=$yyy
49c10eea 4398 echo " $fpossize bytes." >&4
bd9b35c9
JH
4399 ;;
4400 esac
4401 else
4402 dflt="$fpossize"
4403 echo " "
4404 echo "(I can't compile the test program. Guessing...)" >&4
4405 rp="What is the size of your file positions (in bytes)?"
4406 . ./myread
4407 fpossize="$ans"
4408 fi
4409 $rm -f try.c try
4410 fi
dfe9444c
AD
4411 ;;
4412esac
bd9b35c9
JH
4413
4414
4415case "$usemorebits" in
4416"$define"|true|[yY]*)
10cc9d2a 4417 use64bitint="$define"
bd9b35c9
JH
4418 uselongdouble="$define"
4419 usemorebits="$define"
dfe9444c 4420 ;;
bd9b35c9 4421*) usemorebits="$undef"
dfe9444c
AD
4422 ;;
4423esac
dfe9444c 4424
dfe9444c 4425
49c10eea
JH
4426case "$uselonglong" in
4427"$define"|true|[yY]*)
4428 cat <<EOM >&4
4429
10cc9d2a 4430*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
10cc9d2a
JH
4431EOM
4432 use64bitint="$define"
4433 ;;
4434esac
10cc9d2a
JH
4435case "$use64bits" in
4436"$define"|true|[yY]*)
4437 cat <<EOM >&4
4438
4439*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
49c10eea 4440EOM
10cc9d2a 4441 use64bitint="$define"
49c10eea
JH
4442 ;;
4443esac
10cc9d2a
JH
4444case "$use64bitints" in
4445"$define"|true|[yY]*)
4446 cat <<EOM >&4
4447
4448*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
10cc9d2a
JH
4449EOM
4450 use64bitint="$define"
4451 ;;
4452esac
3141530c
JH
4453case "$use64bitsint" in
4454"$define"|true|[yY]*)
4455 cat <<EOM >&4
4456
4457*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4458EOM
4459 use64bitint="$define"
4460 ;;
4461esac
4462case "$uselonglongs" in
4463"$define"|true|[yY]*)
4464 cat <<EOM >&4
4465
4466*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4467EOM
4468 use64bitint="$define"
4469 ;;
4470esac
a1b03cdf
JH
4471case "$use64bitsall" in
4472"$define"|true|[yY]*)
4473 cat <<EOM >&4
4474
4475*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4476EOM
4477 use64bitall="$define"
4478 ;;
4479esac
10cc9d2a 4480
49c10eea 4481case "$ccflags" in
10cc9d2a 4482*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
49c10eea 4483esac
10cc9d2a
JH
4484case "$use64bitall" in
4485"$define"|true|[yY]*) use64bitint="$define" ;;
49c10eea
JH
4486esac
4487
4488case "$longsize" in
44898) cat <<EOM
4490
4491You have natively 64-bit long integers.
bd9b35c9 4492EOM
ad551343
JH
4493 val="$define"
4494 ;;
10cc9d2a 4495*) case "$use64bitint" in
49c10eea 4496 "$define"|true|[yY]*) dflt='y';;
ad551343
JH
4497 *) dflt='n';;
4498 esac
49c10eea 4499 cat <<EOM
29209bc5 4500
bd9b35c9 4501Perl can be built to take advantage of 64-bit integer types
10cc9d2a 4502on some systems. To do so, Configure can be run with -Duse64bitint.
49c10eea 4503Choosing this option will most probably introduce binary incompatibilities.
29209bc5 4504
ad551343 4505If this doesn't make any sense to you, just accept the default '$dflt'.
29209bc5 4506EOM
ad551343
JH
4507 rp='Try to use 64-bit integers, if available?'
4508 . ./myread
4509 case "$ans" in
4510 [yY]*) val="$define" ;;
4511 *) val="$undef" ;;
4512 esac
4513 ;;
29209bc5 4514esac
10cc9d2a 4515set use64bitint
29209bc5
JH
4516eval $setvar
4517
1acc7ade
JH
4518case "$use64bitall" in
4519"$define"|true|[yY]*) dflt='y' ;;
4520*) case "$longsize" in
4521 8) dflt='y' ;;
4522 *) dflt='n' ;;
4523 esac
4524 ;;
4525esac
843b3b0e
JH
4526cat <<EOM
4527
4528You may also choose to try maximal 64-bitness. It means using as much
452964-bitness as possible on the platform. This in turn means even more
4530binary incompatibilities. On the other hand, your platform may not
4531have any more 64-bitness available than what you already have chosen.
4532
4533If this doesn't make any sense to you, just accept the default '$dflt'.
4534EOM
4535rp='Try to use maximal 64-bit support, if available?'
4536. ./myread
4537case "$ans" in
4538[yY]*) val="$define" ;;
4539*) val="$undef" ;;
4540esac
10cc9d2a 4541set use64bitall
49c10eea 4542eval $setvar
843b3b0e
JH
4543case "$use64bitall" in
4544"$define")
4545 case "$use64bitint" in
4546 "$undef")
4547 cat <<EOM
4548
4549Since you have chosen a maximally 64-bit build, I'm also turning on
4550the use of 64-bit integers.
4551EOM
4552 use64bitint="$define" ;;
4553 esac
4554 ;;
4555esac
bd9b35c9 4556
10cc9d2a 4557case "$use64bitint" in
bd9b35c9
JH
4558"$define"|true|[yY]*)
4559: Look for a hint-file generated 'call-back-unit'. If the
4560: user has specified that a 64-bit perl is to be built,
4561: we may need to set or change some other defaults.
10cc9d2a 4562 if $test -f use64bitint.cbu; then
e5788f28 4563 echo "Your platform has some specific hints for 64-bit integers, using them..."
10cc9d2a 4564 . ./use64bitint.cbu
bd9b35c9 4565 fi
49c10eea 4566 case "$longsize" in
701a9a05 4567 4) case "$archname64" in
10cc9d2a 4568 '') archname64=64int ;;
49c10eea
JH
4569 esac
4570 ;;
4571 esac
4572 ;;
4573esac
4574
10cc9d2a 4575case "$use64bitall" in
49c10eea
JH
4576"$define"|true|[yY]*)
4577: Look for a hint-file generated 'call-back-unit'. If the
843b3b0e 4578: user has specified that a maximally 64-bit perl is to be built,
49c10eea 4579: we may need to set or change some other defaults.
10cc9d2a 4580 if $test -f use64bitall.cbu; then
843b3b0e 4581 echo "Your platform has some specific hints for 64-bit builds, using them..."
10cc9d2a 4582 . ./use64bitall.cbu
49c10eea
JH
4583 fi
4584 case "$longsize" in
c6861c9d 4585 4) case "$archname64" in
bab3591f 4586 ''|64int) archname64=64all ;;
49c10eea
JH
4587 esac
4588 ;;
4589 esac
bd9b35c9
JH
4590 ;;
4591esac
4592
4593: determine the architecture name
2afac517 4594echo " "
bd9b35c9
JH
4595if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4596 tarch=`arch`"-$osname"
4597elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4598 if uname -m > tmparch 2>&1 ; then
4599 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4600 -e 's/$/'"-$osname/" tmparch`
4601 else
4602 tarch="$osname"
4603 fi
4604 $rm -f tmparch
4605else
4606 tarch="$osname"
4607fi
4608case "$myarchname" in
4609''|"$tarch") ;;
4610*)
4611 echo "(Your architecture name used to be $myarchname.)"
4612 archname=''
4613 ;;
8e07c86e 4614esac
bd9b35c9
JH
4615myarchname="$tarch"
4616case "$archname" in
4617'') dflt="$tarch";;
4618*) dflt="$archname";;
2afac517 4619esac
bd9b35c9
JH
4620rp='What is your architecture name'
4621. ./myread
4622archname="$ans"
4623case "$usethreads" in
29209bc5 4624$define)
bd9b35c9
JH
4625 echo "Threads selected." >&4
4626 case "$archname" in
4627 *-thread*) echo "...and architecture name already has -thread." >&4
4628 ;;
4629 *) archname="$archname-thread"
4630 echo "...setting architecture name to $archname." >&4
4631 ;;
4632 esac
29209bc5
JH
4633 ;;
4634esac
bd9b35c9
JH
4635case "$usemultiplicity" in
4636$define)
4637 echo "Multiplicity selected." >&4
4638 case "$archname" in
4639 *-multi*) echo "...and architecture name already has -multi." >&4
4640 ;;
4641 *) archname="$archname-multi"
4642 echo "...setting architecture name to $archname." >&4
4643 ;;
4644 esac
4645 ;;
4646esac
10cc9d2a 4647case "$use64bitint" in
bd9b35c9
JH
4648$define)
4649 case "$archname64" in
4650 '')
4651 ;;
4652 *)
4653 case "$archname" in
4654 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4655 ;;
4656 *) archname="$archname-$archname64"
4657 echo "...setting architecture name to $archname." >&4
4658 ;;
4659 esac
4660 ;;
4661 esac
4662esac
4663
4664: determine root of directory hierarchy where package will be installed.
4665case "$prefix" in
4666'')
4667 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4668 ;;
4669*)
4670 dflt="$prefix"
4671 ;;
4672esac
4673$cat <<EOM
4674
4675By default, $package will be installed in $dflt/bin, manual pages
4676under $dflt/man, etc..., i.e. with $dflt as prefix for all
4677installation directories. Typically this is something like /usr/local.
4678If you wish to have binaries under /usr/bin but other parts of the
4679installation under /usr/local, that's ok: you will be prompted
4680separately for each of the installation directories, the prefix being
4681only used to set the defaults.
4682
4683EOM
4684fn=d~
4685rp='Installation prefix to use?'
4686. ./getfile
4687oldprefix=''
4688case "$prefix" in
4689'') ;;
4690*)
4691 case "$ans" in
4692 "$prefix") ;;
4693 *) oldprefix="$prefix";;
4694 esac
4695 ;;
4696esac
4697prefix="$ans"
4698prefixexp="$ansexp"
4699
4700: is AFS running?
4701echo " "
4702case "$afs" in
4703$define|true) afs=true ;;
4704$undef|false) afs=false ;;
4705*) if test -d /afs; then
4706 afs=true
2afac517 4707 else
bd9b35c9 4708 afs=false
2afac517 4709 fi
bd9b35c9 4710 ;;
8e07c86e 4711esac
bd9b35c9
JH
4712if $afs; then
4713 echo "AFS may be running... I'll be extra cautious then..." >&4
4714else
4715 echo "AFS does not seem to be running..." >&4
4716fi
2afac517 4717
bd9b35c9
JH
4718: determine installation prefix for where package is to be installed.
4719if $afs; then
4633a7c4 4720$cat <<EOM
29209bc5 4721
bd9b35c9
JH
4722Since you are running AFS, I need to distinguish the directory in which
4723files will reside from the directory in which they are installed (and from
4724which they are presumably copied to the former directory by occult means).
4725
4633a7c4 4726EOM
bd9b35c9
JH
4727 case "$installprefix" in
4728 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4729 *) dflt="$installprefix";;
4730 esac
4731else
4732$cat <<EOM
2afac517 4733
bd9b35c9
JH
4734In some special cases, particularly when building $package for distribution,
4735it is convenient to distinguish between the directory in which files should
4736be installed from the directory ($prefix) in which they
4737will eventually reside. For most users, these two directories are the same.
8e07c86e 4738
bd9b35c9
JH
4739EOM
4740 case "$installprefix" in
4741 '') dflt=$prefix ;;
4742 *) dflt=$installprefix;;
4743 esac
4744fi
4745fn=d~
4746rp='What installation prefix should I use for installing files?'
4747. ./getfile
4748installprefix="$ans"
4749installprefixexp="$ansexp"
4633a7c4 4750
bd9b35c9
JH
4751: set the prefixit variable, to compute a suitable default value
4752prefixit='case "$3" in
4753""|none)
4754 case "$oldprefix" in
4755 "") eval "$1=\"\$$2\"";;
4756 *)
4757 case "$3" in
4758 "") eval "$1=";;
4759 none)
4760 eval "tp=\"\$$2\"";
4761 case "$tp" in
4762 ""|" ") eval "$1=\"\$$2\"";;
4763 *) eval "$1=";;
4764 esac;;
4765 esac;;
4766 esac;;
4767*)
4768 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4769 case "$tp" in
4770 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4771 /*-$oldprefix/*|\~*-$oldprefix/*)
4772 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4773 *) eval "$1=\"\$$2\"";;
4774 esac;;
4775esac'
4633a7c4 4776
ff935051
JH
4777
4778: get the patchlevel
bd9b35c9
JH
4779echo " "
4780echo "Getting the current patchlevel..." >&4
4781if $test -r $rsrc/patchlevel.h;then
49c10eea 4782 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
bd9b35c9
JH
4783 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4784 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff935051
JH
4785 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4786 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4787 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bd9b35c9 4788else
49c10eea 4789 revision=0
bd9b35c9
JH
4790 patchlevel=0
4791 subversion=0
ff935051
JH
4792 api_revision=0
4793 api_version=0
4794 api_subversion=0
bd9b35c9 4795fi
49c10eea 4796$echo $n "(You have $package revision $revision" $c
bd9b35c9
JH
4797$echo $n " patchlevel $patchlevel" $c
4798test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4799echo ".)"
ff935051 4800case "$osname" in
3645a519 4801dos|vms)
ff935051 4802 : XXX Should be a Configure test for double-dots in filenames.
49c10eea 4803 version=`echo $revision $patchlevel $subversion | \
273cf8d1 4804 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
ff935051
JH
4805 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4806 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4807 ;;
4808*)
49c10eea 4809 version=`echo $revision $patchlevel $subversion | \
ff935051
JH
4810 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4811 api_versionstring=`echo $api_revision $api_version $api_subversion | \
273cf8d1 4812 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
ff935051
JH
4813 ;;
4814esac
4815: Special case the 5.005_xx maintenance series, which used 5.005
4816: without any subversion label as a subdirectory in $sitelib
4817if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4818 api_versionstring='5.005'
273cf8d1 4819fi
bd9b35c9
JH
4820
4821: determine installation style
4822: For now, try to deduce it from prefix unless it is already set.
4823: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4824case "$installstyle" in
4825'') case "$prefix" in
4826 *perl*) dflt='lib';;
4827 *) dflt='lib/perl5' ;;
34d1710f 4828 esac
4633a7c4 4829 ;;
d6c8a45d 4830*) dflt="$installstyle" ;;
4633a7c4 4831esac
bd9b35c9
JH
4832: Probably not worth prompting for this since we prompt for all
4833: the directories individually, and the prompt would be too long and
4834: confusing anyway.
4835installstyle=$dflt
4633a7c4 4836
bd9b35c9
JH
4837: determine where private library files go
4838: Usual default is /usr/local/lib/perl5/$version.
4839: Also allow things like /opt/perl/lib/$version, since
4840: /opt/perl/lib/perl5... would be redundant.
4841: The default "style" setting is made in installstyle.U
4842case "$installstyle" in
4843*lib/perl5*) set dflt privlib lib/$package/$version ;;
4844*) set dflt privlib lib/$version ;;
a4f3eea9 4845esac
bd9b35c9
JH
4846eval $prefixit
4847$cat <<EOM
a4f3eea9 4848
bd9b35c9
JH
4849There are some auxiliary files for $package that need to be put into a
4850private library directory that is accessible by everyone.
4851
4852EOM
4853fn=d~+
4854rp='Pathname where the private library files will reside?'
4855. ./getfile
4856privlib="$ans"
4857privlibexp="$ansexp"
4858: Change installation prefix, if necessary.
4859if $test X"$prefix" != X"$installprefix"; then
4860 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
a4f3eea9 4861else
bd9b35c9
JH
4862 installprivlib="$privlibexp"
4863fi
a4f3eea9 4864
bd9b35c9
JH
4865: set the prefixup variable, to restore leading tilda escape
4866prefixup='case "$prefixexp" in
4867"$prefix") ;;
4868*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4869esac'
a4f3eea9 4870
bd9b35c9
JH
4871: determine where public architecture dependent libraries go
4872set archlib archlib
4873eval $prefixit
4874: privlib default is /usr/local/lib/$package/$version
4875: archlib default is /usr/local/lib/$package/$version/$archname
4876: privlib may have an optional trailing /share.
4877tdflt=`echo $privlib | $sed 's,/share$,,'`
4878tdflt=$tdflt/$archname
4879case "$archlib" in
4880'') dflt=$tdflt
29209bc5 4881 ;;
bd9b35c9
JH
4882*) dflt="$archlib"
4883 ;;
29209bc5 4884esac
bd9b35c9 4885$cat <<EOM
29209bc5 4886
bd9b35c9
JH
4887$spackage contains architecture-dependent library files. If you are
4888sharing libraries in a heterogeneous environment, you might store
4889these files in a separate location. Otherwise, you can just include
4890them with the rest of the public library files.
a4f3eea9 4891
bd9b35c9
JH
4892EOM
4893fn=d+~
4894rp='Where do you want to put the public architecture-dependent libraries?'
4895. ./getfile
4896archlib="$ans"
4897archlibexp="$ansexp"
4898if $test X"$archlib" = X"$privlib"; then
4899 d_archlib="$undef"
4900else
4901 d_archlib="$define"
4902fi
4903: Change installation prefix, if necessary.
4904if $test X"$prefix" != X"$installprefix"; then
4905 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4906else
4907 installarchlib="$archlibexp"
4908fi
a4f3eea9 4909
a4f3eea9 4910
bd9b35c9
JH
4911: Binary compatibility with 5.005 is not possible for builds
4912: with advanced features
4913case "$usethreads$usemultiplicity" in
4914*define*)
4915 bincompat5005="$undef"
4916 d_bincompat5005="$undef"
4917 ;;
4918*) $cat <<EOM
a4f3eea9 4919
ee3551f5
GS
4920This version of Perl can be compiled for binary compatibility with 5.005.
4921If you decide to do so, you will be able to continue using most of the
4922extensions that were compiled for Perl 5.005.
a4f3eea9 4923
a4f3eea9 4924EOM
bd9b35c9
JH
4925 case "$bincompat5005$d_bincompat5005" in
4926 *"$undef"*) dflt=n ;;
4927 *) dflt=y ;;
a4f3eea9 4928 esac
bd9b35c9
JH
4929 rp='Binary compatibility with Perl 5.005?'
4930 . ./myread
4931 case "$ans" in
4932 y*) val="$define" ;;
4933 *) val="$undef" ;;
a4f3eea9 4934 esac
bd9b35c9
JH
4935 set d_bincompat5005
4936 eval $setvar
4937 case "$d_bincompat5005" in
4938 "$define")
4939 bincompat5005="$define"
4940 ;;
4941 *) bincompat5005="$undef"
4942 d_bincompat5005="$undef"
a4f3eea9 4943 ;;
4944 esac
bd9b35c9 4945 ;;
a4f3eea9 4946esac
4947
a4f3eea9 4948
bd9b35c9
JH
4949: see if setuid scripts can be secure
4950$cat <<EOM
a4f3eea9 4951
bd9b35c9
JH
4952Some kernels have a bug that prevents setuid #! scripts from being
4953secure. Some sites have disabled setuid #! scripts because of this.
a4f3eea9 4954
bd9b35c9
JH
4955First let's decide if your kernel supports secure setuid #! scripts.
4956(If setuid #! scripts would be secure but have been disabled anyway,
4957don't say that they are secure if asked.)
5ff3f7a4
GS
4958
4959EOM
a4f3eea9 4960
bd9b35c9
JH
4961val="$undef"
4962if $test -d /dev/fd; then
4963 echo "#!$ls" >reflect
4964 chmod +x,u+s reflect
4965 ./reflect >flect 2>&1
4966 if $contains "/dev/fd" flect >/dev/null; then
4967 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4968 val="$define"
4969 else
4970 $cat <<EOM
4971If you are not sure if they are secure, I can check but I'll need a
4972username and password different from the one you are using right now.
4973If you don't have such a username or don't want me to test, simply
4974enter 'none'.
a4f3eea9 4975
4976EOM
bd9b35c9
JH
4977 rp='Other username to test security of setuid scripts with?'
4978 dflt='none'
4979 . ./myread
4980 case "$ans" in
4981 n|none)
4982 case "$d_suidsafe" in
4983 '') echo "I'll assume setuid scripts are *not* secure." >&4
4984 dflt=n;;
4985 "$undef")
4986 echo "Well, the $hint value is *not* secure." >&4
4987 dflt=n;;
4988 *) echo "Well, the $hint value *is* secure." >&4
4989 dflt=y;;
dfe9444c
AD
4990 esac
4991 ;;
bd9b35c9
JH
4992 *)
4993 $rm -f reflect flect
4994 echo "#!$ls" >reflect
4995 chmod +x,u+s reflect
4996 echo >flect
4997 chmod a+w flect
4998 echo '"su" will (probably) prompt you for '"$ans's password."
4999 su $ans -c './reflect >flect'
5000 if $contains "/dev/fd" flect >/dev/null; then
5001 echo "Okay, it looks like setuid scripts are secure." >&4
5002 dflt=y
5003 else
5004 echo "I don't think setuid scripts are secure." >&4
5005 dflt=n
5006 fi
5007 ;;
5008 esac
5009 rp='Does your kernel have *secure* setuid scripts?'
5010 . ./myread
5011 case "$ans" in
5012 [yY]*) val="$define";;
5013 *) val="$undef";;
dfe9444c 5014 esac
a4f3eea9 5015 fi
5016else
bd9b35c9
JH
5017 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5018 echo "(That's for file descriptors, not floppy disks.)"
5019 val="$undef"
a4f3eea9 5020fi
bd9b35c9
JH
5021set d_suidsafe
5022eval $setvar
5023
5024$rm -f reflect flect
5025
5026: now see if they want to do setuid emulation
5027echo " "
5028val="$undef"
5029case "$d_suidsafe" in
5030"$define")
5031 val="$undef"
5032 echo "No need to emulate SUID scripts since they are secure here." >& 4
5033 ;;
5034*)
5035 $cat <<EOM
5036Some systems have disabled setuid scripts, especially systems where
5037setuid scripts cannot be secure. On systems where setuid scripts have
5038been disabled, the setuid/setgid bits on scripts are currently
5039useless. It is possible for $package to detect those bits and emulate
5040setuid/setgid in a secure fashion. This emulation will only work if
5041setuid scripts have been disabled in your kernel.
5042
5043EOM
5044 case "$d_dosuid" in
5045 "$define") dflt=y ;;
5046 *) dflt=n ;;
a4f3eea9 5047 esac
bd9b35c9 5048 rp="Do you want to do setuid/setgid emulation?"
a4f3eea9 5049 . ./myread
5050 case "$ans" in
bd9b35c9
JH
5051 [yY]*) val="$define";;
5052 *) val="$undef";;
a4f3eea9 5053 esac
5054 ;;
a4f3eea9 5055esac
bd9b35c9
JH
5056set d_dosuid
5057eval $setvar
a4f3eea9 5058
bfb7748a
AD
5059: determine filename position in cpp output
5060echo " "
5061echo "Computing filename position in cpp output for #include directives..." >&4
5062echo '#include <stdio.h>' > foo.c
5063$cat >fieldn <<EOF
5064$startsh
5065$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5066$grep '^[ ]*#.*stdio\.h' | \
5067while read cline; do
5068 pos=1
5069 set \$cline
5070 while $test \$# -gt 0; do
5071 if $test -r \`echo \$1 | $tr -d '"'\`; then
5072 echo "\$pos"
5073 exit 0
5074 fi
5075 shift
5076 pos=\`expr \$pos + 1\`
5077 done
5078done
5079EOF
5080chmod +x fieldn
5081fieldn=`./fieldn`
5082$rm -f foo.c fieldn
5083case $fieldn in
5084'') pos='???';;
50851) pos=first;;
50862) pos=second;;
50873) pos=third;;
5088*) pos="${fieldn}th";;
5089esac
5090echo "Your cpp writes the filename in the $pos field of the line."
5091
5092: locate header file
5093$cat >findhdr <<EOF
5094$startsh
5095wanted=\$1
9cc6feab 5096name=''
3656fc86
JH
5097for usrincdir in $usrinc
5098do
5099 if test -f \$usrincdir/\$wanted; then
5100 echo "\$usrincdir/\$wanted"
5101 exit 0
5102 fi
5103done
bfb7748a
AD
5104awkprg='{ print \$$fieldn }'
5105echo "#include <\$wanted>" > foo\$\$.c
5106$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5107$grep "^[ ]*#.*\$wanted" | \
5108while read cline; do
5109 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5110 case "\$name" in
4e400192
JH
5111 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5112 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5113 *) exit 2;;
bfb7748a
AD
5114 esac;
5115done;
4e400192
JH
5116#
5117# status = 0: grep returned 0 lines, case statement not executed
5118# status = 1: headerfile found
5119# status = 2: while loop executed, no headerfile found
5120#
5121status=\$?
bfb7748a 5122$rm -f foo\$\$.c;
4e400192
JH
5123if test \$status -eq 1; then
5124 exit 0;
5125fi
5126exit 1
bfb7748a
AD
5127EOF
5128chmod +x findhdr
5129
5130: define an alternate in-header-list? function
5131inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5132cont=true; xxf="echo \"<\$1> found.\" >&4";
5133case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5134*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5135esac;
5136case $# in 4) instead=instead;; *) instead="at last";; esac;
5137while $test "$cont"; do
5138 xxx=`./findhdr $1`
5139 var=$2; eval "was=\$$2";
5140 if $test "$xxx" && $test -r "$xxx";
5141 then eval $xxf;
5142 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5143 cont="";
5144 else eval $xxnf;
5145 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5146 set $yyy; shift; shift; yyy=$@;
5147 case $# in 0) cont="";;
5148 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5149 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5150 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5151 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5152 esac;
5153done;
5154while $test "$yyy";
5155do set $yyy; var=$2; eval "was=\$$2";
5156 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5157 set $yyy; shift; shift; yyy=$@;
5158done'
5159
5160: see if this is a malloc.h system
5161set malloc.h i_malloc
5162eval $inhdr
5163
5164: see if stdlib is available
5165set stdlib.h i_stdlib
5166eval $inhdr
5167
5168: determine which malloc to compile in
5169echo " "
5170case "$usemymalloc" in
5ff3f7a4
GS
5171''|[yY]*|true|$define) dflt='y' ;;
5172*) dflt='n' ;;
bfb7748a
AD
5173esac
5174rp="Do you wish to attempt to use the malloc that comes with $package?"
5175. ./myread
5176usemymalloc="$ans"
5177case "$ans" in
5178y*|true)
5179 usemymalloc='y'
5180 mallocsrc='malloc.c'
5181 mallocobj="malloc$_o"
5182 d_mymalloc="$define"
5183 case "$libs" in
5184 *-lmalloc*)
5185 : Remove malloc from list of libraries to use
5186 echo "Removing unneeded -lmalloc from library list" >&4
5187 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5188 shift
5189 libs="$*"
5190 echo "libs = $libs" >&4
5191 ;;
5192 esac
5193 ;;
5194*)
5195 usemymalloc='n'
5196 mallocsrc=''
5197 mallocobj=''
5198 d_mymalloc="$undef"
5199 ;;
5200esac
5201
5202: compute the return types of malloc and free
5203echo " "
5204$cat >malloc.c <<END
5205#$i_malloc I_MALLOC
5206#$i_stdlib I_STDLIB
5207#include <stdio.h>
5208#include <sys/types.h>
5209#ifdef I_MALLOC
5210#include <malloc.h>
5211#endif
5212#ifdef I_STDLIB
5213#include <stdlib.h>
5214#endif
5215#ifdef TRY_MALLOC
5216void *malloc();
5217#endif
5218#ifdef TRY_FREE
5219void free();
5220#endif
5221END
5222case "$malloctype" in
5223'')
5224 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5225 malloctype='void *'
5226 else
5227 malloctype='char *'
5228 fi
5229 ;;
5230esac
5231echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5232
5233case "$freetype" in
5234'')
5235 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5236 freetype='void'
5237 else
5238 freetype='int'
5239 fi
5240 ;;
5241esac
5242echo "Your system uses $freetype free(), it would seem." >&4
5243$rm -f malloc.[co]
a3635516
JH
5244$cat <<EOM
5245
5246The installation process will also create a directory for
5247vendor-supplied add-ons. Vendors who supply perl with their system
5248may find it convenient to place all vendor-supplied files in this
5249directory rather than in the main distribution directory. This will
5250ease upgrades between binary-compatible maintenance versions of perl.
5251
5252Of course you may also use these directories in whatever way you see
5253fit. For example, you might use them to access modules shared over a
5254company-wide network.
5255
5256The default answer should be fine for most people.
5257This causes further questions about vendor add-ons to be skipped
5258and no vendor-specific directories will be configured for perl.
5259
5260EOM
5261rp='Do you want to configure vendor-specific add-on directories?'
5262case "$usevendorprefix" in
5263define|true|[yY]*) dflt=y ;;
49c10eea
JH
5264*) : User may have set vendorprefix directly on Configure command line.
5265 case "$vendorprefix" in
5266 ''|' ') dflt=n ;;
5267 *) dflt=y ;;
5268 esac
5269 ;;
a3635516
JH
5270esac
5271. ./myread
5272case "$ans" in
5273[yY]*) fn=d~+
5274 rp='Installation prefix to use for vendor-supplied add-ons?'
5275 case "$vendorprefix" in
5276 '') dflt='' ;;
5277 *) dflt=$vendorprefix ;;
5278 esac
5279 . ./getfile
49c10eea 5280 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
a3635516
JH
5281 oldvendorprefix=''
5282 case "$vendorprefix" in
5283 '') ;;
5284 *) case "$ans" in
5285 "$prefix") ;;
5286 *) oldvendorprefix="$prefix";;
5287 esac
5288 ;;
5289 esac
5290 usevendorprefix="$define"
5291 vendorprefix="$ans"
5292 vendorprefixexp="$ansexp"
5293 ;;
5294*) usevendorprefix="$undef"
5295 vendorprefix=''
5296 vendorprefixexp=''
5297 ;;
5298esac
5299
5300case "$vendorprefix" in
5301'') d_vendorlib="$undef"
5302 vendorlib=''
5303 vendorlibexp=''
5304 ;;
5305*) d_vendorlib="$define"
5306 : determine where vendor-supplied modules go.
629ae163 5307 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
49c10eea
JH
5308 case "$vendorlib" in
5309 '')
5310 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5311 case "$installstyle" in
5312 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5313 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5314 esac
5315 ;;
5316 *) dflt="$vendorlib"
5317 ;;
a3635516
JH
5318 esac
5319 fn=d~+
5320 rp='Pathname for the vendor-supplied library files?'
5321 . ./getfile
5322 vendorlib="$ans"
5323 vendorlibexp="$ansexp"
a3635516
JH
5324 ;;
5325esac
526fdc24 5326vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
49c10eea
JH
5327: Change installation prefix, if necessary.
5328if $test X"$prefix" != X"$installprefix"; then
5329 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5330else
5331 installvendorlib="$vendorlibexp"
5332fi
a3635516 5333
526fdc24
MS
5334case "$vendorprefix" in
5335'') d_vendorarch="$undef"
5336 vendorarch=''
5337 vendorarchexp=''
5338 ;;
5339*) d_vendorarch="$define"
5340 : determine where vendor-supplied architecture-dependent libraries go.
5341 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
5342 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5343 : vendorlib may have an optional trailing /share.
5344 case "$vendorarch" in
5345 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
5346 dflt="$dflt/$archname"
5347 ;;
5348 *) dflt="$vendorarch" ;;
5349 esac
5350 fn=d~+
5351 rp='Pathname for vendor-supplied architecture-dependent files?'
5352 . ./getfile
5353 vendorarch="$ans"
5354 vendorarchexp="$ansexp"
5355 ;;
5356esac
5357: Change installation prefix, if necessary.
5358if $test X"$prefix" != X"$installprefix"; then
5359 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5360else
5361 installvendorarch="$vendorarchexp"
5362fi
5363
c4f23d77
AD
5364: Cruising for prototypes
5365echo " "
5366echo "Checking out function prototypes..." >&4
5367$cat >prototype.c <<'EOCP'
5a411a32 5368int main(int argc, char *argv[]) {
c4f23d77
AD
5369 exit(0);}
5370EOCP
5371if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5372 echo "Your C compiler appears to support function prototypes."
5373 val="$define"
5374else
5375 echo "Your C compiler doesn't seem to understand function prototypes."
5376 val="$undef"
5377fi
5378set prototype
5379eval $setvar
5380$rm -f prototype*
5381
5382case "$prototype" in
5383"$define") ;;
5384*) ansi2knr='ansi2knr'
5385 echo " "
5386 cat <<EOM >&4
5387
5388$me: FATAL ERROR:
5389This version of $package can only be compiled by a compiler that
5390understands function prototypes. Unfortunately, your C compiler
5391 $cc $ccflags
5392doesn't seem to understand them. Sorry about that.
5393
5ff3f7a4 5394If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
5395
5396Eventually, we hope to support building Perl with pre-ANSI compilers.
5397If you would like to help in that effort, please contact <perlbug@perl.org>.
5398
5399Aborting Configure now.
5400EOM
5401 exit 2
5402 ;;
5403esac
5404
5405: determine where public executables go
5406echo " "
5407set dflt bin bin
5408eval $prefixit
5409fn=d~
5410rp='Pathname where the public executables will reside?'
5411. ./getfile
5412if $test "X$ansexp" != "X$binexp"; then
5413 installbin=''
5414fi
5415bin="$ans"
5416binexp="$ansexp"
dd4e71fd
JH
5417: Change installation prefix, if necessary.
5418: XXX Bug? -- ignores Configure -Dinstallprefix setting.
5419if $test X"$prefix" != X"$installprefix"; then
ec897fb9 5420 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
5421else
5422 installbin="$binexp"
c4f23d77
AD
5423fi
5424
49c10eea
JH
5425: Find perl5.005 or later.
5426echo "Looking for a previously installed perl5.005 or later... "
5427case "$perl5" in
5428'') for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5429 : Check if this perl is recent and can load a simple module
5430 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5431 perl5=$tdir/perl
5432 break;
5433 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5434 perl5=$tdir/perl
5435 break;
5436 fi
5437 done
5438 ;;
5439*) perl5="$perl5"
5440 ;;
5441esac
5442case "$perl5" in
5443'') echo "None found. That's ok.";;
5444*) echo "Using $perl5." ;;
5445esac
5446
ff935051
JH
5447$cat <<EOM
5448
5449After $package is installed, you may wish to install various
5450add-on modules and utilities. Typically, these add-ons will
5451be installed under $prefix with the rest
5452of this package. However, you may wish to install such add-ons
5453elsewhere under a different prefix.
5454
5455If you do not wish to put everything under a single prefix, that's
5456ok. You will be prompted for the individual locations; this siteprefix
5457is only used to suggest the defaults.
5458
5459The default should be fine for most people.
5460
5461EOM
5462fn=d~+
5463rp='Installation prefix to use for add-on modules and utilities?'
5464: XXX Here might be another good place for an installstyle setting.
5465case "$siteprefix" in
5466'') dflt=$prefix ;;
5467*) dflt=$siteprefix ;;
5468esac
5469. ./getfile
49c10eea 5470: XXX Prefixit unit does not yet support siteprefix and vendorprefix
ff935051
JH
5471oldsiteprefix=''
5472case "$siteprefix" in
5473'') ;;
49c10eea 5474*) case "$ans" in
ff935051
JH
5475 "$prefix") ;;
5476 *) oldsiteprefix="$prefix";;
5477 esac
5478 ;;
5479esac
5480siteprefix="$ans"
5481siteprefixexp="$ansexp"
5482
5483: determine where site specific libraries go.
5484: Usual default is /usr/local/lib/perl5/site_perl/$version
5485: The default "style" setting is made in installstyle.U
5486: XXX No longer works with Prefixit stuff.
5487prog=`echo $package | $sed 's/-*[0-9.]*$//'`
49c10eea
JH
5488case "$sitelib" in
5489'') case "$installstyle" in
5490 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5491 *) dflt=$siteprefix/lib/site_$prog/$version ;;
5492 esac
5493 ;;
5494*) dflt="$sitelib"
5495 ;;
ff935051
JH
5496esac
5497$cat <<EOM
5498
5499The installation process will create a directory for
5500site-specific extensions and modules. Most users find it convenient
5501to place all site-specific files in this directory rather than in the
5502main distribution directory.
5503
5504EOM
5505fn=d~+
5506rp='Pathname for the site-specific library files?'
5507. ./getfile
5508sitelib="$ans"
5509sitelibexp="$ansexp"
526fdc24 5510sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
ff935051
JH
5511: Change installation prefix, if necessary.
5512if $test X"$prefix" != X"$installprefix"; then
49c10eea 5513 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
ff935051
JH
5514else
5515 installsitelib="$sitelibexp"
5516fi
5517
5518: Determine list of previous versions to include in @INC
5519$cat > getverlist <<EOPL
49c10eea 5520#!$perl5 -w
ff935051
JH
5521use File::Basename;
5522\$api_versionstring = "$api_versionstring";
5523\$version = "$version";
5524\$sitelib = "$sitelib";
5525\$archname = "$archname";
5526EOPL
5527 $cat >> getverlist <<'EOPL'
5528# Can't have leading @ because metaconfig interprets it as a command!
5529;@inc_version_list=();
5530$stem=dirname($sitelib);
49c10eea 5531# XXX Redo to do opendir/readdir?
ff935051
JH
5532if (-d $stem) {
5533 chdir($stem);
5534 ;@candidates = glob("5.*");
5535}
5536else {
5537 ;@candidates = ();
5538}
5539
937ac629
JH
5540# XXX ToDo: These comparisons must be reworked when two-digit
5541# subversions come along, so that 5.7.10 compares as greater than
5542# 5.7.3! By that time, hope that 5.6.x is sufficiently
5543# widespread that we can use the built-in version vectors rather
5544# than reinventing them here. For 5.6.0, however, we must
5545# assume this script will likely be run by 5.005_0x. --AD 1/2000.
ff935051
JH
5546foreach $d (@candidates) {
5547 if ($d lt $version) {
5548 if ($d ge $api_versionstring) {
5549 unshift(@inc_version_list, "$d/$archname", $d);
5550 }
5551 elsif ($d ge "5.005") {
5552 unshift(@inc_version_list, $d);
5553 }
5554 }
5555 else {
5556 # Skip newer version. I.e. don't look in
5557 # 5.7.0 if we're installing 5.6.1.
5558 }
5559}
5560
5561if (@inc_version_list) {
3a096bf3 5562 print join(' ', @inc_version_list);
ff935051
JH
5563}
5564else {
5565 # Blank space to preserve value for next Configure run.
5566 print " ";
5567}
5568EOPL
5569chmod +x getverlist
5570case "$inc_version_list" in
49c10eea
JH
5571'') if test -x "$perl5"; then
5572 dflt=`$perl5 getverlist`
ff935051 5573 else
3a096bf3 5574 dflt='none'
ff935051
JH
5575 fi
5576 ;;
3a096bf3 5577$undef) dflt='none' ;;
ff935051
JH
5578*) dflt="$inc_version_list" ;;
5579esac
49c10eea
JH
5580case "$dflt" in
5581''|' ') dflt=none ;;
5582esac
ff935051
JH
5583$cat <<'EOM'
5584
5585In order to ease the process of upgrading, this version of perl
5586can be configured to use modules built and installed with earlier
5587versions of perl that were installed under $prefix. Specify here
5588the list of earlier versions that this version of perl should check.
5589If Configure detected no earlier versions of perl installed under
3a096bf3
JH
5590$prefix, then the list will be empty. Answer 'none' to tell perl
5591to not search earlier versions.
ff935051
JH
5592
5593The default should almost always be sensible, so if you're not sure,
5594just accept the default.
5595EOM
5596
3a096bf3 5597rp='List of earlier versions to include in @INC?'
ff935051 5598. ./myread
3a096bf3 5599case "$ans" in
49c10eea 5600[Nn]one|''|' ') inc_version_list=' ' ;;
3a096bf3
JH
5601*) inc_version_list="$ans" ;;
5602esac
5603case "$inc_version_list" in
5604''|' ')
82aaaa3c 5605 inc_version_list_init='0';;
3a096bf3 5606*) inc_version_list_init=`echo $inc_version_list |
82aaaa3c 5607 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
3a096bf3
JH
5608 ;;
5609esac
ff935051
JH
5610$rm -f getverlist
5611
104d25b7
JH
5612: determine whether to install perl also as /usr/bin/perl
5613
5614echo " "
dd4e71fd 5615if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7 5616 $cat <<EOM
526fdc24 5617Many scripts expect perl to be installed as /usr/bin/perl.
104d25b7
JH
5618I can install the perl you are about to compile also as /usr/bin/perl
5619(in addition to $installbin/perl).
5620EOM
472a4973
JH
5621 case "$installusrbinperl" in
5622 "$undef"|[nN]*) dflt='n';;
5623 *) dflt='y';;
5624 esac
104d25b7
JH
5625 rp="Do you want to install perl as /usr/bin/perl?"
5626 . ./myread
5627 case "$ans" in
5628 [yY]*) val="$define";;
472a4973 5629 *) val="$undef" ;;
104d25b7 5630 esac
472a4973
JH
5631else
5632 val="$undef"
5633fi
104d25b7
JH
5634set installusrbinperl
5635eval $setvar
5636
a4f3eea9 5637echo " "
5638echo "Checking for GNU C Library..." >&4
5639cat >gnulibc.c <<EOM
aebf16e7 5640#include <stdio.h>
5a411a32 5641int main()
a4f3eea9 5642{
aebf16e7
AD
5643#ifdef __GLIBC__
5644 exit(0);
5645#else
5646 exit(1);
5647#endif
a4f3eea9 5648}
5649EOM
dfe9444c 5650set gnulibc
aebf16e7 5651if eval $compile_ok && ./gnulibc; then
a4f3eea9 5652 val="$define"
5653 echo "You are using the GNU C Library"
4633a7c4 5654else
a4f3eea9 5655 val="$undef"
5656 echo "You are not using the GNU C Library"
4633a7c4 5657fi
a4f3eea9 5658$rm -f gnulibc*
5659set d_gnulibc
5660eval $setvar
25f94b33 5661
a4f3eea9 5662: see if nm is to be used to determine whether a symbol is defined or not
5663case "$usenm" in
5664'')
dc45a647 5665 dflt=''
a4f3eea9 5666 case "$d_gnulibc" in
dc45a647
MB
5667 "$define")
5668 echo " "
5669 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 5670 dflt=n
5671 ;;
dc45a647
MB
5672 esac
5673 case "$dflt" in
5674 '')
5675 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5676 echo " "
5677 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
5678 echo "'nm' won't be sufficient on this sytem." >&4
5679 dflt=n
5680 fi
5681 ;;
5682 esac
5683 case "$dflt" in
c4f23d77 5684 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 5685 if $test $dflt -gt 20; then
5686 dflt=y
5687 else
5688 dflt=n
5689 fi
5690 ;;
5691 esac
5692 ;;
5693*)
5694 case "$usenm" in
dc45a647 5695 true|$define) dflt=y;;
a4f3eea9 5696 *) dflt=n;;
5697 esac
5698 ;;
25f94b33 5699esac
a4f3eea9 5700$cat <<EOM
4633a7c4 5701
dc45a647
MB
5702I can use $nm to extract the symbols from your C libraries. This
5703is a time consuming task which may generate huge output on the disk (up
5704to 3 megabytes) but that should make the symbols extraction faster. The
5705alternative is to skip the 'nm' extraction part and to compile a small
5706test program instead to determine whether each symbol is present. If
5707you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5708this may be the best solution.
5709
5710You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 5711
a4f3eea9 5712EOM
693762b4 5713rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
5714. ./myread
5715case "$ans" in
dc45a647 5716[Nn]*) usenm=false;;
a4f3eea9 5717*) usenm=true;;
4633a7c4
LW
5718esac
5719
a4f3eea9 5720runnm=$usenm
5721case "$reuseval" in
5722true) runnm=false;;
4633a7c4 5723esac
a4f3eea9 5724
5725: nm options which may be necessary
5726case "$nm_opt" in
5727'') if $test -f /mach_boot; then
1e422769 5728 nm_opt='' # Mach
a4f3eea9 5729 elif $test -d /usr/ccs/lib; then
1e422769 5730 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 5731 elif $test -f /dgux; then
1e422769 5732 nm_opt='-p' # DG-UX
2ae324a7 5733 elif $test -f /lib64/rld; then
1e422769 5734 nm_opt='-p' # 64-bit Irix
a4f3eea9 5735 else
5736 nm_opt=''
5737 fi;;
4633a7c4 5738esac
4633a7c4 5739
a4f3eea9 5740: nm options which may be necessary for shared libraries but illegal
5741: for archive libraries. Thank you, Linux.
5742case "$nm_so_opt" in
5743'') case "$myuname" in
5744 *linux*)
693762b4 5745 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 5746 nm_so_opt='--dynamic'
4633a7c4 5747 fi
a4f3eea9 5748 ;;
4633a7c4 5749 esac
4633a7c4
LW
5750 ;;
5751esac
5752
a4f3eea9 5753case "$runnm" in
5754true)
5755: get list of predefined functions in a handy place
5756echo " "
5757case "$libc" in
5758'') libc=unknown
5759 case "$libs" in
dfe9444c 5760 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 5761 esac
5762 ;;
5763esac
5764libnames='';
5765case "$libs" in
5766'') ;;
5767*) for thislib in $libs; do
5768 case "$thislib" in
5769 -lc|-lc_s)
5770 : Handle C library specially below.
5771 ;;
5772 -l*)
5773 thislib=`echo $thislib | $sed -e 's/^-l//'`
5774 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5775 :
5776 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5777 :
dfe9444c 5778 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 5779 :
dfe9444c 5780 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 5781 :
a4f3eea9 5782 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5783 :
5784 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5785 :
dfe9444c 5786 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 5787 :
5788 else
5789 try=''
5790 fi
5791 libnames="$libnames $try"
5792 ;;
5793 *) libnames="$libnames $thislib" ;;
5794 esac
5795 done
5796 ;;
5797esac
5798xxx=normal
5799case "$libc" in
5800unknown)
5801 set /lib/libc.$so
5802 for xxx in $libpth; do
5803 $test -r $1 || set $xxx/libc.$so
5804 : The messy sed command sorts on library version numbers.
5805 $test -r $1 || \
5806 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 5807 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 5808 h
5809 s/[0-9][0-9]*/0000&/g
5810 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5811 G
5812 s/\n/ /' | \
dfe9444c 5813 sort | $sed -e 's/^.* //'`
a4f3eea9 5814 eval set \$$#
5815 done
5816 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
5817 $test -r $1 || set /lib/libsys_s$_a
5818 ;;
a4f3eea9 5819*)
5820 set blurfl
5821 ;;
5822esac
5823if $test -r "$1"; then
5824 echo "Your (shared) C library seems to be in $1."
5825 libc="$1"
5826elif $test -r /lib/libc && $test -r /lib/clib; then
5827 echo "Your C library seems to be in both /lib/clib and /lib/libc."
5828 xxx=apollo
5829 libc='/lib/clib /lib/libc'
5830 if $test -r /lib/syslib; then
5831 echo "(Your math library is in /lib/syslib.)"
5832 libc="$libc /lib/syslib"
5833 fi
5834elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5835 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
5836elif $test -r $incpath/usr/lib/libc$_a; then
5837 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 5838 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
5839elif $test -r /lib/libc$_a; then
5840 libc=/lib/libc$_a;
a4f3eea9 5841 echo "Your C library seems to be in $libc. You're normal."
5842else
dfe9444c 5843 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 5844 :
5845 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5846 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5847 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5848 :
dfe9444c 5849 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5850 :
dfe9444c 5851 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 5852 :
4633a7c4 5853 else
dfe9444c 5854 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 5855 fi
a4f3eea9 5856 if $test -r "$tans"; then
5857 echo "Your C library seems to be in $tans, of all places."
5858 libc=$tans
5859 else
5860 libc='blurfl'
5861 fi
5862fi
5863if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5864 dflt="$libc"
5865 cat <<EOM
4633a7c4 5866
a4f3eea9 5867If the guess above is wrong (which it might be if you're using a strange
5868compiler, or your machine supports multiple models), you can override it here.
4633a7c4 5869
a4f3eea9 5870EOM
5871else
5872 dflt=''
28e8609d 5873 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 5874 cat >&4 <<EOM
5875I can't seem to find your C library. I've looked in the following places:
4633a7c4 5876
a4f3eea9 5877EOM
5878 $sed 's/^/ /' libpath
5879 cat <<EOM
4633a7c4 5880
a4f3eea9 5881None of these seems to contain your C library. I need to get its name...
4633a7c4 5882
a4f3eea9 5883EOM
5884fi
5885fn=f
5886rp='Where is your C library?'
5887. ./getfile
5888libc="$ans"
4633a7c4 5889
4633a7c4 5890echo " "
28e8609d 5891echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 5892set X `cat libnames`
4633a7c4 5893shift
a4f3eea9 5894xxx=files
5895case $# in 1) xxx=file; esac
5896echo "Extracting names from the following $xxx for later perusal:" >&4
5897echo " "
5898$sed 's/^/ /' libnames >&4
5899echo " "
5900$echo $n "This may take a while...$c" >&4
4633a7c4 5901
dfe9444c
AD
5902for file in $*; do
5903 case $file in
693762b4
AD
5904 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5905 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 5906 esac
dfe9444c 5907done >libc.tmp
4633a7c4 5908
a4f3eea9 5909$echo $n ".$c"
5910$grep fprintf libc.tmp > libc.ptf
5911xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5912xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5913xxx='[ADTSIW]'
5914if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
5915 eval $xscan;\
5916 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5917 eval $xrun
5918elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5919 eval $xscan;\
5920 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5921 eval $xrun
5922elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5923 eval $xscan;\
5924 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5925 eval $xrun
5926elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5927 eval $xscan;\
5928 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5929 eval $xrun
5930elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5931 eval $xscan;\
5932 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5933 eval $xrun
5934elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5935 eval $xscan;\
5936 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5937 eval $xrun
5938elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5939 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
5940 eval $xscan;\
5941 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5942 eval $xrun
5943elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5944 eval $xscan;\
5945 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5946 eval $xrun
5947elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5948 eval $xscan;\
5949 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5950 eval $xrun
1e422769 5951elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5952 eval $xscan;\
5953 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5954 eval $xrun
a4f3eea9 5955elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5956 eval $xscan;\
5957 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5958 eval $xrun
5959elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5960 eval $xscan;\
5961 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5962 eval $xrun
44a8e56a 5963elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5964 eval $xscan;\
5965 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5966 eval $xrun
0f502cca
BL
5967elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
5968 eval $xscan;\
5969 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5970 eval $xrun
a4f3eea9 5971else
693762b4 5972 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 5973 $grep fprintf libc.tmp > libc.ptf
5974 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5975 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5976 then
5977 nm_opt='-p'
5978 eval $xrun
4633a7c4 5979 else
a4f3eea9 5980 echo " "
e5c9fcd0 5981 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 5982 com=''
dc45a647
MB
5983 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5984 for thisname in $libnames $libc; do
e5c9fcd0 5985 $ar t $thisname >>libc.tmp
a4f3eea9 5986 done
dfe9444c 5987 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 5988 echo "Ok." >&4
dc45a647
MB
5989 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5990 # Repeat libc to extract forwarders to DLL entries too
5991 for thisname in $libnames $libc; do
5992 $ar tv $thisname >>libc.tmp
5993 # Revision 50 of EMX has bug in $ar.
5994 # it will not extract forwarders to DLL entries
5995 # Use emximp which will extract exactly them.
5996 emximp -o tmp.imp $thisname \
5997 2>/dev/null && \
5998 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5999 < tmp.imp >>libc.tmp
6000 $rm tmp.imp
6001 done
6002 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6003 echo "Ok." >&4
a4f3eea9 6004 else
e5c9fcd0 6005 echo "$ar didn't seem to work right." >&4
a4f3eea9 6006 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 6007 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 6008 then
6009 for thisname in $libnames; do
6010 bld t $libnames | \
dfe9444c 6011 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 6012 $ar t $thisname >>libc.tmp
a4f3eea9 6013 done
6014 echo "Ok." >&4
6015 else
6016 echo "That didn't work either. Giving up." >&4
6017 exit 1
6018 fi
6019 fi
4633a7c4 6020 fi
4633a7c4 6021fi
a4f3eea9 6022nm_extract="$com"
6023if $test -f /lib/syscalls.exp; then
4633a7c4 6024 echo " "
a4f3eea9 6025 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 6026 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 6027fi
6028;;
6029esac
6030$rm -f libnames libpath
6031
2afac517 6032: see if dld is available
6033set dld.h i_dld
6034eval $inhdr
4633a7c4 6035
2afac517 6036: is a C symbol defined?
6037csym='tlook=$1;
6038case "$3" in
6039-v) tf=libc.tmp; tc=""; tdc="";;
6040-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6041*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6042esac;
6043tx=yes;
6044case "$reuseval-$4" in
6045true-) ;;
6046true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6047esac;
6048case "$tx" in
6049yes)
6050 case "$runnm" in
6051 true)
6052 if $contains $tlook $tf >/dev/null 2>&1;
6053 then tval=true;
6054 else tval=false;
6055 fi;;
6056 *)
d674cd6d 6057 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 6058 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 6059 then tval=true;
6060 else tval=false;
6061 fi;
6062 $rm -f t t.c;;
6063 esac;;
6064*)
6065 case "$tval" in
6066 $define) tval=true;;
6067 *) tval=false;;
6068 esac;;
6069esac;
6070eval "$2=$tval"'
4633a7c4 6071
2afac517 6072: define an is-in-libc? function
6073inlibc='echo " "; td=$define; tu=$undef;
6074sym=$1; var=$2; eval "was=\$$2";
6075tx=yes;
6076case "$reuseval$was" in
6077true) ;;
6078true*) tx=no;;
6079esac;
6080case "$tx" in
6081yes)
6082 set $sym tres -f;
6083 eval $csym;
6084 case "$tres" in
6085 true)
6086 echo "$sym() found." >&4;
6087 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6088 *)
6089 echo "$sym() NOT found." >&4;
6090 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6091 esac;;
6092*)
6093 case "$was" in
6094 $define) echo "$sym() found." >&4;;
6095 *) echo "$sym() NOT found." >&4;;
6096 esac;;
6097esac'
4633a7c4 6098
2afac517 6099: see if dlopen exists
6100xxx_runnm="$runnm"
6101runnm=false
6102set dlopen d_dlopen
6103eval $inlibc
6104runnm="$xxx_runnm"
40a7a20a 6105
2afac517 6106: determine which dynamic loading, if any, to compile in
4633a7c4 6107echo " "
2afac517 6108dldir="ext/DynaLoader"
6109case "$usedl" in
6110$define|y|true)
6111 dflt='y'
6112 usedl="$define"
6113 ;;
6114$undef|n|false)
6115 dflt='n'
6116 usedl="$undef"
6117 ;;
6118*)
6119 dflt='n'
6120 case "$d_dlopen" in
6121 $define) dflt='y' ;;
6122 esac
6123 case "$i_dld" in
6124 $define) dflt='y' ;;
4633a7c4 6125 esac
2afac517 6126 : Does a dl_xxx.xs file exist for this operating system
dc45a647 6127 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
6128 ;;
6129esac
2afac517 6130rp="Do you wish to use dynamic loading?"
6131. ./myread
6132usedl="$ans"
6133case "$ans" in
6134y*) usedl="$define"
6135 case "$dlsrc" in
6136 '')
dc45a647 6137 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 6138 dflt="$dldir/dl_${osname}.xs"
6139 elif $test "$d_dlopen" = "$define" ; then
6140 dflt="$dldir/dl_dlopen.xs"
6141 elif $test "$i_dld" = "$define" ; then
6142 dflt="$dldir/dl_dld.xs"
4633a7c4 6143 else
2afac517 6144 dflt=''
4633a7c4 6145 fi
4633a7c4 6146 ;;
2afac517 6147 *) dflt="$dldir/$dlsrc"
6148 ;;
4633a7c4 6149 esac
2afac517 6150 echo "The following dynamic loading files are available:"
6151 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
6152 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6153 rp="Source file to use for dynamic loading"
6154 fn="fne"
b233458b 6155 gfpth="$src"
dc45a647 6156 . ./getfile
2afac517 6157 usedl="$define"
6158 : emulate basename
1e127011 6159 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
2304df62 6160
dc45a647 6161 $cat << EOM
2304df62 6162
2afac517 6163Some systems may require passing special flags to $cc -c to
6164compile modules that will be used to create a shared library.
6165To use no flags, say "none".
2304df62
AD
6166
6167EOM
2afac517 6168 case "$cccdlflags" in
6169 '') case "$gccversion" in
6170 '') case "$osname" in
6171 hpux) dflt='+z' ;;
6172 next) dflt='none' ;;
8cc95fdb 6173 irix*) dflt='-KPIC' ;;
3a6175e1 6174 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 6175 sunos) dflt='-pic' ;;
6176 *) dflt='none' ;;
dfe9444c
AD
6177 esac
6178 ;;
6179 *) case "$osname" in
3a6175e1 6180 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 6181 *) dflt='-fpic' ;;
81d89818 6182 esac ;;
2afac517 6183 esac ;;
bfb7748a 6184 ' ') dflt='none' ;;
2afac517 6185 *) dflt="$cccdlflags" ;;
6186 esac
6187 rp="Any special flags to pass to $cc -c to compile shared library modules?"
6188 . ./myread
6189 case "$ans" in
6190 none) cccdlflags=' ' ;;
6191 *) cccdlflags="$ans" ;;
6192 esac
2304df62 6193
2afac517 6194 cat << EOM
ecfc5424 6195
2afac517 6196Some systems use ld to create libraries that can be dynamically loaded,
6197while other systems (such as those using ELF) use $cc.
a0f45b59 6198
2afac517 6199EOM
6200 case "$ld" in
6201 '') $cat >try.c <<'EOM'
6202/* Test for whether ELF binaries are produced */
6203#include <fcntl.h>
6204#include <stdlib.h>
5a411a32 6205int main() {
2afac517 6206 char b[4];
6207 int i = open("a.out",O_RDONLY);
6208 if(i == -1)
6209 exit(1); /* fail */
6210 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6211 exit(0); /* succeed (yes, it's ELF) */
2304df62 6212 else
2afac517 6213 exit(1); /* fail */
6214}
6215EOM
6216 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6217 cat <<EOM
6218You appear to have ELF support. I'll use $cc to build dynamic libraries.
6219EOM
6220 dflt="$cc"
2304df62 6221 else
2afac517 6222 echo "I'll use ld to build dynamic libraries."
6223 dflt='ld'
2304df62 6224 fi
2afac517 6225 rm -f try.c a.out
6226 ;;
6227 *) dflt="$ld"
6228 ;;
6229 esac
6230
6231 rp="What command should be used to create dynamic libraries?"
6232 . ./myread
6233 ld="$ans"
6234
6235 cat << EOM
6236
6237Some systems may require passing special flags to $ld to create a
6238library that can be dynamically loaded. If your ld flags include
6239-L/other/path options to locate libraries outside your loader's normal
6240search path, you may need to specify those -L options here as well. To
6241use no flags, say "none".
6242
6243EOM
6244 case "$lddlflags" in
6245 '') case "$osname" in
46193409 6246 beos) dflt='-nostart' ;;
a5f83cbf
JH
6247 hpux) dflt='-b';
6248 case "$gccversion" in
6249 '') dflt="$dflt +vnocompatwarnings" ;;
b36fec95
JH
6250 esac
6251 ;;
2afac517 6252 linux|irix*) dflt='-shared' ;;
6253 next) dflt='none' ;;
6254 solaris) dflt='-G' ;;
6255 sunos) dflt='-assert nodefinitions' ;;
6256 svr4*|esix*) dflt="-G $ldflags" ;;
6257 *) dflt='none' ;;
6258 esac
6259 ;;
6260 *) dflt="$lddlflags" ;;
6261 esac
6262
bfb7748a 6263 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
6264 : Be careful not to append to a plain 'none'
6265 case "$dflt" in
6266 none) dflt='' ;;
6267 esac
bfb7748a
AD
6268 for thisflag in $ldflags; do
6269 case "$thisflag" in
6270 -L*)
6271 case " $dflt " in
6272 *" $thisflag "*) ;;
6273 *) dflt="$dflt $thisflag" ;;
6274 esac
6275 ;;
2afac517 6276 esac
bfb7748a 6277 done
2afac517 6278
bfb7748a
AD
6279 case "$dflt" in
6280 ''|' ') dflt='none' ;;
6281 esac
2afac517 6282
6283 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6284 . ./myread
6285 case "$ans" in
6286 none) lddlflags=' ' ;;
6287 *) lddlflags="$ans" ;;
6288 esac
6289
6290 cat <<EOM
6291
6292Some systems may require passing special flags to $cc to indicate that
6293the resulting executable will use dynamic linking. To use no flags,
6294say "none".
6295
6296EOM
6297 case "$ccdlflags" in
6298 '') case "$osname" in
6299 hpux) dflt='-Wl,-E' ;;
6300 linux) dflt='-rdynamic' ;;
6301 next) dflt='none' ;;
6302 sunos) dflt='none' ;;
6303 *) dflt='none' ;;
6304 esac ;;
bfb7748a 6305 ' ') dflt='none' ;;
2afac517 6306 *) dflt="$ccdlflags" ;;
6307 esac
7f95ee77 6308 rp="Any special flags to pass to $cc to use dynamic linking?"
2afac517 6309 . ./myread
6310 case "$ans" in
6311 none) ccdlflags=' ' ;;
6312 *) ccdlflags="$ans" ;;
6313 esac
6314 ;;
6315*) usedl="$undef"
6316 ld='ld'
6317 dlsrc='dl_none.xs'
6318 lddlflags=''
6319 ccdlflags=''
6320 ;;
6321esac
6322
6323also=''
6324case "$usedl" in
6325$undef)
6326 # No dynamic loading being used, so don't bother even to prompt.
6327 useshrplib='false'
6328 ;;
6329*) case "$useshrplib" in
6330 '') case "$osname" in
4fabb596 6331 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
3e3baf6d 6332 dflt=y
2afac517 6333 also='Building a shared libperl is required for dynamic loading to work on your system.'
6334 ;;
6335 next*)
6336 case "$osvers" in
3e3baf6d 6337 4*) dflt=y
2afac517 6338 also='Building a shared libperl is needed for MAB support.'
6339 ;;
3e3baf6d 6340 *) dflt=n
2afac517 6341 ;;
6342 esac
6343 ;;
3e3baf6d 6344 *) dflt=n
2afac517 6345 ;;
6346 esac
6347 ;;
6348 $define|true|[Yy]*)
3e3baf6d 6349 dflt=y
2afac517 6350 ;;
3e3baf6d 6351 *) dflt=n
2afac517 6352 ;;
6353 esac
6354 $cat << EOM
6355
6356The perl executable is normally obtained by linking perlmain.c with
dfe9444c 6357libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 6358any other libraries needed on this system (such as -lm, etc.). Since
6359your system supports dynamic loading, it is probably possible to build
6360a shared libperl.$so. If you will have more than one executable linked
6361to libperl.$so, this will significantly reduce the size of each
6362executable, but it may have a noticeable affect on performance. The
6363default is probably sensible for your system.
6364$also
6365
6366EOM
6367 rp="Build a shared libperl.$so (y/n)"
6368 . ./myread
6369 case "$ans" in
6370 true|$define|[Yy]*)
5cf1d1f1 6371 useshrplib='true' ;;
2afac517 6372 *) useshrplib='false' ;;
6373 esac
6374 ;;
6375esac
6376
6377case "$useshrplib" in
6378true)
6379 case "$libperl" in
6380 '')
6381 # Figure out a good name for libperl.so. Since it gets stored in
6382 # a version-specific architecture-dependent library, the version
6383 # number isn't really that important, except for making cc/ld happy.
6384 #
6385 # A name such as libperl.so.3.1
6386 majmin="libperl.$so.$patchlevel.$subversion"
6387 # A name such as libperl.so.301
6388 majonly=`echo $patchlevel $subversion |
6389 $awk '{printf "%d%02d", $1, $2}'`
6390 majonly=libperl.$so.$majonly
6391 # I'd prefer to keep the os-specific stuff here to a minimum, and
6392 # rely on figuring it out from the naming of libc.
6393 case "${osname}${osvers}" in
6394 next4*)
6395 dflt=libperl.5.$so
6396 # XXX How handle the --version stuff for MAB?
6397 ;;
6398 linux*) # ld won't link with a bare -lperl otherwise.
6399 dflt=libperl.$so
6400 ;;
4fabb596
GS
6401 cygwin*) # include version
6402 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6403 ;;
2afac517 6404 *) # Try to guess based on whether libc has major.minor.
6405 case "$libc" in
6406 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6407 *libc.$so.[0-9]*) dflt=$majonly ;;
6408 *) dflt=libperl.$so ;;
6409 esac
6410 ;;
6411 esac
6412 ;;
6413 *) dflt=$libperl
6414 ;;
6415 esac
6416 cat << EOM
6417
6418I need to select a good name for the shared libperl. If your system uses
6419library names with major and minor numbers, then you might want something
6420like $majmin. Alternatively, if your system uses a single version
6421number for shared libraries, then you might want to use $majonly.
6422Or, your system might be quite happy with a simple libperl.$so.
6423
6424Since the shared libperl will get installed into a version-specific
6425architecture-dependent directory, the version number of the shared perl
6426library probably isn't important, so the default should be o.k.
6427
6428EOM
6429 rp='What name do you want to give to the shared libperl?'
6430 . ./myread
6431 libperl=$ans
6432 echo "Ok, I'll use $libperl"
6433 ;;
6434*)
dfe9444c 6435 libperl="libperl${_a}"
2afac517 6436 ;;
6437esac
6438
6439# Detect old use of shrpdir via undocumented Configure -Dshrpdir
6440case "$shrpdir" in
6441'') ;;
6442*) $cat >&4 <<EOM
6443WARNING: Use of the shrpdir variable for the installation location of
6444the shared $libperl is not supported. It was never documented and
46193409 6445will not work in this version. Let me (perlbug@perl.com)
dfe9444c 6446know of any problems this may cause.
2afac517 6447
6448EOM
6449 case "$shrpdir" in
6450 "$archlibexp/CORE")
6451 $cat >&4 <<EOM
6452But your current setting of $shrpdir is
6453the default anyway, so it's harmless.
6454EOM
6455 ;;
6456 *)
4e2a5f63
AD
6457 $cat >&4 <<EOM
6458Further, your current attempted setting of $shrpdir
6459conflicts with the value of $archlibexp/CORE
6460that installperl will use.
6461EOM
dc45a647
MB
6462 ;;
6463 esac
6464 ;;
6465esac
6466
6467# How will the perl executable find the installed shared $libperl?
6468# Add $xxx to ccdlflags.
6469# If we can't figure out a command-line option, use $shrpenv to
6470# set env LD_RUN_PATH. The main perl makefile uses this.
6471shrpdir=$archlibexp/CORE
6472xxx=''
6473tmp_shrpenv=''
6474if "$useshrplib"; then
6475 case "$osname" in
6476 aix)
6477 # We'll set it in Makefile.SH...
6478 ;;
6479 solaris|netbsd)
6480 xxx="-R $shrpdir"
6481 ;;
6482 freebsd)
6483 xxx="-Wl,-R$shrpdir"
6484 ;;
6485 linux|irix*|dec_osf)
6486 xxx="-Wl,-rpath,$shrpdir"
6487 ;;
6488 next)
6489 # next doesn't like the default...
6490 ;;
46193409
JH
6491 beos)
6492 # beos doesn't like the default, either.
6493 ;;
3656fc86
JH
6494 hpux*)
6495 # hpux doesn't like the default, either.
6496 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6497 ;;
dc45a647
MB
6498 *)
6499 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6500 ;;
6501 esac
6502 case "$xxx" in
6503 '') ;;
6504 *)
6505 # Only add $xxx if it isn't already in ccdlflags.
6506 case " $ccdlflags " in
6507 *" $xxx "*) ;;
6508 *) ccdlflags="$ccdlflags $xxx"
6509 cat <<EOM >&4
6510
6511Adding $xxx to the flags
6512passed to $ld so that the perl executable will find the
6513installed shared $libperl.
6514
6515EOM
6516 ;;
6517 esac
6518 ;;
6519 esac
6520fi
5cf1d1f1
JH
6521# Fix ccdlflags in AIX for building external extensions.
6522# (For building Perl itself bare -bE:perl.exp is needed,
6523# Makefile.SH takes care of this.)
5f9d9a17 6524case "$osname" in
5cf1d1f1 6525aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5f9d9a17 6526esac
dc45a647
MB
6527# Respect a hint or command-line value.
6528case "$shrpenv" in
6529'') shrpenv="$tmp_shrpenv" ;;
6530esac
5cf1d1f1
JH
6531case "$ldlibpthname" in
6532'') ldlibpthname=LD_LIBRARY_PATH ;;
6533none) ldlibpthname='' ;;
6534esac
dc45a647
MB
6535
6536: determine where manual pages go
6537set man1dir man1dir none
6538eval $prefixit
6539$cat <<EOM
6540
6541$spackage has manual pages available in source form.
6542EOM
6543case "$nroff" in
6544nroff)
6545 echo "However, you don't have nroff, so they're probably useless to you."
6546 case "$man1dir" in
6547 '') man1dir="none";;
6548 esac;;
6549esac
6550echo "If you don't want the manual sources installed, answer 'none'."
6551case "$man1dir" in
6552' ') dflt=none
6553 ;;
6554'')
6555 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6556 lookpath="$lookpath $prefixexp/man/p_man/man1"
6557 lookpath="$lookpath $prefixexp/man/u_man/man1"
6558 lookpath="$lookpath $prefixexp/man/man.1"
6559 case "$sysman" in
6560 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6561 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6562 esac
6563 set dflt
6564 eval $prefixup
6565 ;;
6566*) dflt="$man1dir"
6567 ;;
6568esac
6569echo " "
6570fn=dn+~
6571rp="Where do the main $spackage manual pages (source) go?"
6572. ./getfile
6573if $test "X$man1direxp" != "X$ansexp"; then
6574 installman1dir=''
6575fi
6576man1dir="$ans"
6577man1direxp="$ansexp"
6578case "$man1dir" in
dd4e71fd 6579'') man1dir=' '
dc45a647
MB
6580 installman1dir='';;
6581esac
dc45a647 6582
dd4e71fd
JH
6583: Change installation prefix, if necessary.
6584if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6585 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6586else
6587 installman1dir="$man1direxp"
dc45a647
MB
6588fi
6589
6590: What suffix to use on installed man pages
6591
6592case "$man1dir" in
6593' ')
6594 man1ext='0'
6595 ;;
6596*)
6597 rp="What suffix should be used for the main $spackage man pages?"
6598 case "$man1ext" in
6599 '') case "$man1dir" in
6600 *1) dflt=1 ;;
6601 *1p) dflt=1p ;;
6602 *1pm) dflt=1pm ;;
6603 *l) dflt=l;;
6604 *n) dflt=n;;
6605 *o) dflt=o;;
6606 *p) dflt=p;;
6607 *C) dflt=C;;
6608 *L) dflt=L;;
6609 *L1) dflt=L1;;
6610 *) dflt=1;;
6611 esac
6612 ;;
6613 *) dflt="$man1ext";;
6614 esac
6615 . ./myread
6616 man1ext="$ans"
6617 ;;
6618esac
6619
6620: see if we can have long filenames
6621echo " "
dc45a647 6622first=123456789abcdef
8c99d73e 6623$rm -f $first
dc45a647
MB
6624if (echo hi >$first) 2>/dev/null; then
6625 if $test -f 123456789abcde; then
6626 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
6627 val="$undef"
6628 else
8c99d73e
GS
6629 echo 'You can have filenames longer than 14 characters.'>&4
6630 val="$define"
dc45a647
MB
6631 fi
6632else
6633 $cat <<'EOM'
8c99d73e
GS
6634You can't have filenames longer than 14 chars.
6635You can't even think about them!
dc45a647
MB
6636EOM
6637 val="$undef"
6638fi
6639set d_flexfnam
6640eval $setvar
8c99d73e 6641$rm -rf 123456789abcde*
dc45a647
MB
6642
6643: determine where library module manual pages go
6644set man3dir man3dir none
6645eval $prefixit
6646$cat <<EOM
6647
6648$spackage has manual pages for many of the library modules.
6649EOM
6650
6651case "$nroff" in
6652nroff)
6653 $cat <<'EOM'
6654However, you don't have nroff, so they're probably useless to you.
6655EOM
6656 case "$man3dir" in
6657 '') man3dir="none";;
6658 esac;;
6659esac
6660
6661case "$d_flexfnam" in
6662undef)
6663 $cat <<'EOM'
6664However, your system can't handle the long file names like File::Basename.3.
6665EOM
6666 case "$man3dir" in
6667 '') man3dir="none";;
6668 esac;;
6669esac
6670
6671echo "If you don't want the manual sources installed, answer 'none'."
6672prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6673case "$man3dir" in
8c99d73e 6674'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
dd4e71fd
JH
6675 if $test -d "$privlib/man/man3"; then
6676 cat <<EOM >&4
6677
6678WARNING: Previous versions of perl installed man3 pages into
6679$privlib/man/man3. This version will suggest a
6680new default of $dflt.
6681EOM
6682 tdflt=$dflt
6683 dflt='n'
6684 rp='Do you wish to preserve the old behavior?(y/n)'
6685 . ./myread
6686 case "$ans" in
6687 y*) dflt="$privlib/man/man3" ;;
6688 *) dflt=$tdflt ;;
6689 esac
6690 fi
2afac517 6691 ;;
dc45a647 6692*) dflt="$man3dir" ;;
2afac517 6693esac
8c99d73e
GS
6694case "$dflt" in
6695' ') dflt=none ;;
6696esac
dc45a647 6697echo " "
dc45a647
MB
6698fn=dn+~
6699rp="Where do the $package library man pages (source) go?"
6700. ./getfile
dc45a647
MB
6701man3dir="$ans"
6702man3direxp="$ansexp"
8c99d73e 6703case "$man3dir" in
dd4e71fd 6704'') man3dir=' '
dc45a647
MB
6705 installman3dir='';;
6706esac
dc45a647 6707
dd4e71fd
JH
6708: Change installation prefix, if necessary.
6709if $test X"$prefix" != X"$installprefix"; then
ec897fb9 6710 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
6711else
6712 installman3dir="$man3direxp"
dc45a647
MB
6713fi
6714
6715: What suffix to use on installed man pages
dc45a647
MB
6716case "$man3dir" in
6717' ')
6718 man3ext='0'
6719 ;;
6720*)
6721 rp="What suffix should be used for the $package library man pages?"
6722 case "$man3ext" in
6723 '') case "$man3dir" in
6724 *3) dflt=3 ;;
6725 *3p) dflt=3p ;;
6726 *3pm) dflt=3pm ;;
6727 *l) dflt=l;;
6728 *n) dflt=n;;
6729 *o) dflt=o;;
6730 *p) dflt=p;;
6731 *C) dflt=C;;
6732 *L) dflt=L;;
6733 *L3) dflt=L3;;
6734 *) dflt=3;;
2afac517 6735 esac
6736 ;;
dc45a647 6737 *) dflt="$man3ext";;
2afac517 6738 esac
dc45a647
MB
6739 . ./myread
6740 man3ext="$ans"
6741 ;;
2afac517 6742esac
6743
6744: see if we have to deal with yellow pages, now NIS.
6745if $test -d /usr/etc/yp || $test -d /etc/yp; then
6746 if $test -f /usr/etc/nibindd; then
6747 echo " "
6748 echo "I'm fairly confident you're on a NeXT."
6749 echo " "
6750 rp='Do you get the hosts file via NetInfo?'
6751 dflt=y
6752 case "$hostcat" in
6753 nidump*) ;;
6754 '') ;;
6755 *) dflt=n;;
6756 esac
6757 . ./myread
6758 case "$ans" in
6759 y*) hostcat='nidump hosts .';;
6760 *) case "$hostcat" in
6761 nidump*) hostcat='';;
6762 esac
6763 ;;
6764 esac
6765 fi
6766 case "$hostcat" in
6767 nidump*) ;;
6768 *)
6769 case "$hostcat" in
6770 *ypcat*) dflt=y;;
6771 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6772 dflt=y
6773 else
6774 dflt=n
6775 fi;;
6776 *) dflt=n;;
6777 esac
6778 echo " "
6779 rp='Are you getting the hosts file via yellow pages?'
6780 . ./myread
6781 case "$ans" in
6782 y*) hostcat='ypcat hosts';;
6783 *) hostcat='cat /etc/hosts';;
6784 esac
6785 ;;
6786 esac
6787fi
dfe9444c 6788case "$hostcat" in
7599c0b3 6789'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
dfe9444c
AD
6790esac
6791case "$groupcat" in
7599c0b3 6792'') test -f /etc/group && groupcat='cat /etc/group';;
dfe9444c
AD
6793esac
6794case "$passcat" in
7599c0b3 6795'') test -f /etc/passwd && passcat='cat /etc/passwd';;
dfe9444c 6796esac
2afac517 6797
6798: now get the host name
6799echo " "
6800echo "Figuring out host name..." >&4
6801case "$myhostname" in
6802'') cont=true
6803 echo 'Maybe "hostname" will work...'
6804 if tans=`sh -c hostname 2>&1` ; then
6805 myhostname=$tans
6806 phostname=hostname
6807 cont=''
6808 fi
6809 ;;
6810*) cont='';;
6811esac
6812if $test "$cont"; then
6813 if ./xenix; then
6814 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
6815 if tans=`cat /etc/systemid 2>&1` ; then
6816 myhostname=$tans
6817 phostname='cat /etc/systemid'
6818 echo "Whadyaknow. Xenix always was a bit strange..."
6819 cont=''
6820 fi
6821 elif $test -r /etc/systemid; then
6822 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6823 fi
6824fi
6825if $test "$cont"; then
6826 echo 'No, maybe "uuname -l" will work...'
6827 if tans=`sh -c 'uuname -l' 2>&1` ; then
6828 myhostname=$tans
6829 phostname='uuname -l'
6830 else
6831 echo 'Strange. Maybe "uname -n" will work...'
6832 if tans=`sh -c 'uname -n' 2>&1` ; then
6833 myhostname=$tans
6834 phostname='uname -n'
6835 else
6836 echo 'Oh well, maybe I can mine it out of whoami.h...'
6837 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6838 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6839 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6840 else
6841 case "$myhostname" in
6842 '') echo "Does this machine have an identity crisis or something?"
6843 phostname='';;
6844 *)
6845 echo "Well, you said $myhostname before..."
6846 phostname='echo $myhostname';;
6847 esac
6848 fi
6849 fi
6850 fi
6851fi
6852: you do not want to know about this
6853set $myhostname
6854myhostname=$1
6855
6856: verify guess
6857if $test "$myhostname" ; then
6858 dflt=y
6859 rp='Your host name appears to be "'$myhostname'".'" Right?"
6860 . ./myread
6861 case "$ans" in
6862 y*) ;;
6863 *) myhostname='';;
6864 esac
6865fi
6866
6867: bad guess or no guess
6868while $test "X$myhostname" = X ; do
6869 dflt=''
6870 rp="Please type the (one word) name of your host:"
6871 . ./myread
6872 myhostname="$ans"
6873done
6874
6875: translate upper to lower if necessary
6876case "$myhostname" in
6877*[A-Z]*)
6878 echo "(Normalizing case in your host name)"
6879 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6880 ;;
6881esac
6882
6883case "$myhostname" in
6884*.*)
6885 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6886 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6887 echo "(Trimming domain name from host name--host name is now $myhostname)"
6888 ;;
6889*) case "$mydomain" in
6890 '')
6891 {
2afac517 6892 test "X$hostcat" = "Xypcat hosts" &&
6893 ypmatch "$myhostname" hosts 2>/dev/null |\
6894 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
6895 $test -s hosts
6896 } || {
7599c0b3 6897 test "X$hostcat" != "X" &&
2afac517 6898 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
6899 /[ ]$myhostname[ . ]/p" > hosts
6900 }
6901 tmp_re="[ . ]"
6902 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
6903 END { print sum }" hosts` = x1 || tmp_re="[ ]"
6904 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6905 hosts | $sort | $uniq | \
6906 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6907 case `$echo X$dflt` in
6908 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
6909 dflt=.
6910 ;;
6911 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6912 ;;
6913 esac
6914 case "$dflt" in
6915 .)
6916 tans=`./loc resolv.conf X /etc /usr/etc`
6917 if $test -f "$tans"; then
6918 echo "(Attempting domain name extraction from $tans)"
a6006777 6919 dflt=.`$sed -n -e 's/ / /g' \
28757baa 6920 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 6921 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 6922 case "$dflt" in
a6006777 6923 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 6924 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 6925 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 6926 ;;
2afac517 6927 esac
6928 fi
6929 ;;
6930 esac
6931 case "$dflt" in
6932 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6933 dflt=.`sh -c domainname 2>/dev/null`
6934 case "$dflt" in
6935 '') dflt='.';;
6936 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6937 esac
6938 ;;
6939 esac
6940 case "$dflt" in
6941 .) echo "(Lost all hope -- silly guess then)"
6942 dflt='.uucp'
6943 ;;
6944 esac
6945 $rm -f hosts
6946 ;;
6947 *) dflt="$mydomain";;
6948 esac;;
6949esac
6950echo " "
6951rp="What is your domain name?"
6952. ./myread
6953tans="$ans"
6954case "$ans" in
6955'') ;;
6956.*) ;;
6957*) tans=".$tans";;
6958esac
6959mydomain="$tans"
6960
6961: translate upper to lower if necessary
6962case "$mydomain" in
6963*[A-Z]*)
6964 echo "(Normalizing case in your domain name)"
6965 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6966 ;;
6967esac
6968
6969: a little sanity check here
6970case "$phostname" in
6971'') ;;
6972*)
6973 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6974 $myhostname$mydomain|$myhostname) ;;
6975 *)
6976 case "$phostname" in
6977 sed*)
6978 echo "(That doesn't agree with your whoami.h file, by the way.)"
6979 ;;
6980 *)
6981 echo "(That doesn't agree with your $phostname command, by the way.)"
6982 ;;
6983 esac
6984 ;;
6985 esac
6986 ;;
6987esac
6988
6989$cat <<EOM
6990
6991I need to get your e-mail address in Internet format if possible, i.e.
6992something like user@host.domain. Please answer accurately since I have
6993no easy means to double check it. The default value provided below
7f95ee77 6994is most probably close to reality but may not be valid from outside
2afac517 6995your organization...
6996
6997EOM
6998cont=x
6999while test "$cont"; do
7000 case "$cf_email" in
7001 '') dflt="$cf_by@$myhostname$mydomain";;
7002 *) dflt="$cf_email";;
7003 esac
7004 rp='What is your e-mail address?'
7005 . ./myread
7006 cf_email="$ans"
7007 case "$cf_email" in
7008 *@*.*) cont='' ;;
7009 *)
7010 rp='Address does not look like an Internet one. Use it anyway?'
7011 case "$fastread" in
7012 yes) dflt=y ;;
7013 *) dflt=n ;;
7014 esac
7015 . ./myread
7016 case "$ans" in
7017 y*) cont='' ;;
7018 *) echo " " ;;
7019 esac
7020 ;;
7021 esac
7022done
7023
7024$cat <<EOM
7025
7026If you or somebody else will be maintaining perl at your site, please
7027fill in the correct e-mail address here so that they may be contacted
7028if necessary. Currently, the "perlbug" program included with perl
7029will send mail to this address in addition to perlbug@perl.com. You may
7030enter "none" for no administrator.
7031
7032EOM
7033case "$perladmin" in
7034'') dflt="$cf_email";;
7035*) dflt="$perladmin";;
7036esac
7037rp='Perl administrator e-mail address'
7038. ./myread
7039perladmin="$ans"
7040
5f05dabc 7041: figure out how to guarantee perl startup
7042case "$startperl" in
7043'')
7044 case "$sharpbang" in
7045 *!)
7046 $cat <<EOH
7047
7048I can use the #! construct to start perl on your system. This will
7049make startup of perl scripts faster, but may cause problems if you
7050want to share those scripts and perl is not in a standard place
7051($binexp/perl) on all your platforms. The alternative is to force
7052a shell by starting the script with a single ':' character.
7053
7054EOH
7055 dflt="$binexp/perl"
7056 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7057 . ./myread
7058 case "$ans" in
68dc0745 7059 none) startperl=": # use perl";;
7060 *) startperl="#!$ans"
3e3baf6d 7061 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 7062 $cat >&4 <<EOM
7063
7064WARNING: Some systems limit the #! command to 32 characters.
7065If you experience difficulty running Perl scripts with #!, try
7066installing Perl in a directory with a shorter pathname.
7067
7068EOM
7069 fi ;;
5f05dabc 7070 esac
7071 ;;
7072 *) startperl=": # use perl"
7073 ;;
7074 esac
7075 ;;
7076esac
7077echo "I'll use $startperl to start perl scripts."
7078
7079: figure best path for perl in scripts
7080case "$perlpath" in
7081'')
7082 perlpath="$binexp/perl"
7083 case "$startperl" in
7084 *!*) ;;
7085 *)
7086 $cat <<EOH
7087
7088I will use the "eval 'exec'" idiom to start Perl on your system.
7089I can use the full path of your Perl binary for this purpose, but
7090doing so may cause problems if you want to share those scripts and
7091Perl is not always in a standard place ($binexp/perl).
7092
7093EOH
7094 dflt="$binexp/perl"
7095 rp="What path shall I use in \"eval 'exec'\"?"
7096 . ./myread
7097 perlpath="$ans"
7098 ;;
7099 esac
7100 ;;
7101esac
7102case "$startperl" in
7103*!*) ;;
7104*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7105esac
7106
dc45a647
MB
7107: determine where public executable scripts go
7108set scriptdir scriptdir
7109eval $prefixit
7110case "$scriptdir" in
7111'')
7112 dflt="$bin"
7113 : guess some guesses
7114 $test -d /usr/share/scripts && dflt=/usr/share/scripts
dd4e71fd
JH
7115 $test -d /usr/share/bin && dflt=/usr/share/bin
7116 $test -d /usr/local/script && dflt=/usr/local/script
7117 $test -d /usr/local/scripts && dflt=/usr/local/scripts
7118 $test -d $prefixexp/script && dflt=$prefixexp/script
dc45a647
MB
7119 set dflt
7120 eval $prefixup
7121 ;;
7122*) dflt="$scriptdir"
7123 ;;
7124esac
7125$cat <<EOM
7126
7127Some installations have a separate directory just for executable scripts so
7128that they can mount it across multiple architectures but keep the scripts in
7129one spot. You might, for example, have a subdirectory of /usr/share for this.
7130Or you might just lump your scripts in with all your other executables.
7131
7132EOM
7133fn=d~
7134rp='Where do you keep publicly executable scripts?'
7135. ./getfile
7136if $test "X$ansexp" != "X$scriptdirexp"; then
7137 installscript=''
7138fi
7139scriptdir="$ans"
7140scriptdirexp="$ansexp"
dd4e71fd
JH
7141: Change installation prefix, if necessary.
7142if $test X"$prefix" != X"$installprefix"; then
ec897fb9 7143 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
dd4e71fd
JH
7144else
7145 installscript="$scriptdirexp"
7146fi
dc45a647 7147
dc45a647 7148: determine where site specific architecture-dependent libraries go.
273cf8d1
GS
7149: sitelib default is /usr/local/lib/perl5/site_perl/$version
7150: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
3a6175e1 7151: sitelib may have an optional trailing /share.
dc45a647 7152case "$sitearch" in
49c10eea
JH
7153'') dflt=`echo $sitelib | $sed 's,/share$,,'`
7154 dflt="$dflt/$archname"
7155 ;;
7156*) dflt="$sitearch"
7157 ;;
dc45a647 7158esac
49c10eea
JH
7159set sitearch sitearch none
7160eval $prefixit
dc45a647
MB
7161$cat <<EOM
7162
7163The installation process will also create a directory for
7164architecture-dependent site-specific extensions and modules.
7165
7166EOM
49c10eea 7167fn=d~+
dc45a647
MB
7168rp='Pathname for the site-specific architecture-dependent library files?'
7169. ./getfile
dc45a647
MB
7170sitearch="$ans"
7171sitearchexp="$ansexp"
dd4e71fd
JH
7172: Change installation prefix, if necessary.
7173if $test X"$prefix" != X"$installprefix"; then
ec897fb9 7174 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
71c4afb4
JH
7175else
7176 installsitearch="$sitearchexp"
dc45a647
MB
7177fi
7178
717c4fcc
JH
7179: determine where add-on public executables go
7180case "$sitebin" in
7181'') dflt=$siteprefix/bin ;;
49c10eea 7182*) dflt=$sitebin ;;
717c4fcc
JH
7183esac
7184fn=d~
7185rp='Pathname where the add-on public executables should be installed?'
7186. ./getfile
7187sitebin="$ans"
7188sitebinexp="$ansexp"
7189: Change installation prefix, if necessary.
7190if $test X"$prefix" != X"$installprefix"; then
7191 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7192else
7193 installsitebin="$sitebinexp"
7194fi
7195
43999f95
JH
7196: see if sqrtl exists
7197set sqrtl d_sqrtl
7198eval $inlibc
7199
d7d93a81
JH
7200case "$ccflags" in
7201*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7202esac
7203
b0ce926a
JH
7204case "$uselongdouble" in
7205$define|true|[yY]*) dflt='y';;
7206*) dflt='n';;
7207esac
0f0995ae
JH
7208cat <<EOM
7209
7210Perl can be built to take advantage of long doubles which
7211(if available) may give more accuracy and range for floating point numbers.
7212
7213If this doesn't make any sense to you, just accept the default '$dflt'.
7214EOM
b0ce926a
JH
7215rp='Try to use long doubles if available?'
7216. ./myread
7217case "$ans" in
309d43cf
JH
7218y|Y) val="$define" ;;
7219*) val="$undef" ;;
b0ce926a
JH
7220esac
7221set uselongdouble
7222eval $setvar
7223
d9b3e12d 7224case "$uselongdouble" in
d7d93a81
JH
7225true|[yY]*) uselongdouble="$define" ;;
7226esac
7227
7228case "$uselongdouble" in
7229$define)
d9b3e12d
JH
7230: Look for a hint-file generated 'call-back-unit'. If the
7231: user has specified that long doubles should be used,
7232: we may need to set or change some other defaults.
7233 if $test -f uselongdouble.cbu; then
7234 echo "Your platform has some specific hints for long doubles, using them..."
7235 . ./uselongdouble.cbu
7236 else
7237 $cat <<EOM
7238(Your platform doesn't have any specific hints for long doubles.)
7239EOM
7240 fi
7241 ;;
7242esac
b0ce926a 7243
43999f95
JH
7244case "$uselongdouble:$d_sqrtl" in
7245$define:$undef)
7246 $cat <<EOM >&4
7247
3d68f8d4
JH
7248*** You requested the use of long doubles but you do not seem to have
7249*** the mathematic functions for long doubles. I'm disabling the use
7250*** of long doubles.
7251
43999f95
JH
7252EOM
7253 uselongdouble=$undef
7254 ;;
7255esac
7256
0f0995ae
JH
7257case "$useperlio" in
7258$define|true|[yY]*) dflt='y';;
7259*) dflt='n';;
7260esac
d7d93a81
JH
7261cat <<EOM
7262
85aff577
CS
7263Previous version of $package used the standard IO mechanisms as defined
7264in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 7265mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
7266the default. This abstraction layer can use AT&T's sfio (if you already
7267have sfio installed) or regular stdio. Using PerlIO with sfio may cause
7268problems with some extension modules. Using PerlIO with stdio is safe,
7269but it is slower than plain stdio and therefore is not the default.
2afac517 7270
0f0995ae 7271If this doesn't make any sense to you, just accept the default '$dflt'.
2afac517 7272EOM
2afac517 7273rp='Use the experimental PerlIO abstraction layer?'
7274. ./myread
7275case "$ans" in
7276y|Y)
7277 val="$define"
7278 ;;
7279*)
7280 echo "Ok, doing things the stdio way"
7281 val="$undef"
7282 ;;
7283esac
7284set useperlio
7285eval $setvar
2304df62 7286
717c4fcc
JH
7287case "$vendorprefix" in
7288'') d_vendorbin="$undef"
7289 vendorbin=''
7290 vendorbinexp=''
7291 ;;
7292*) d_vendorbin="$define"
7293 : determine where vendor-supplied executables go.
49c10eea
JH
7294 case "$vendorbin" in
7295 '') dflt=$vendorprefix/bin ;;
7296 *) dflt="$vendorbin" ;;
7297 esac
717c4fcc
JH
7298 fn=d~+
7299 rp='Pathname for the vendor-supplied executables directory?'
7300 . ./getfile
7301 vendorbin="$ans"
7302 vendorbinexp="$ansexp"
717c4fcc
JH
7303 ;;
7304esac
49c10eea
JH
7305: Change installation prefix, if necessary.
7306if $test X"$prefix" != X"$installprefix"; then
7307 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7308else
7309 installvendorbin="$vendorbinexp"
7310fi
717c4fcc 7311
bbe6c963
JH
7312: see if qgcvt exists
7313set qgcvt d_qgcvt
7314eval $inlibc
7315
628e1a40
JH
7316: check for length of double
7317echo " "
7318case "$doublesize" in
7319'')
49c10eea 7320 echo "Checking to see how big your double precision numbers are..." >&4
628e1a40
JH
7321 $cat >try.c <<'EOCP'
7322#include <stdio.h>
7323int main()
7324{
7325 printf("%d\n", (int)sizeof(double));
7326 exit(0);
7327}
7328EOCP
7329 set try
7330 if eval $compile_ok; then
7331 doublesize=`./try`
49c10eea 7332 echo "Your double is $doublesize bytes long."
628e1a40
JH
7333 else
7334 dflt='8'
7335 echo "(I can't seem to compile the test program. Guessing...)"
7336 rp="What is the size of a double precision number (in bytes)?"
7337 . ./myread
7338 doublesize="$ans"
7339 fi
7340 ;;
7341esac
7342$rm -f try.c try
7343
7344: check for long doubles
7345echo " "
c5f05a91 7346echo "Checking to see if you have long double..." >&4
628e1a40
JH
7347echo 'int main() { long double x = 7.0; }' > try.c
7348set try
7349if eval $compile; then
7350 val="$define"
ce65dbcf 7351 echo "You have long double."
628e1a40
JH
7352else
7353 val="$undef"
ce65dbcf 7354 echo "You do not have long double."
628e1a40
JH
7355fi
7356$rm try.*
7357set d_longdbl
7358eval $setvar
7359
7360: check for length of long double
7361case "${d_longdbl}${longdblsize}" in
7362$define)
7363 echo " "
49c10eea 7364 echo "Checking to see how big your long doubles are..." >&4
628e1a40
JH
7365 $cat >try.c <<'EOCP'
7366#include <stdio.h>
7367int main()
7368{
7369 printf("%d\n", sizeof(long double));
7370}
7371EOCP
7372 set try
7373 set try
7374 if eval $compile; then
7375 longdblsize=`./try$exe_ext`
49c10eea 7376 echo "Your long doubles are $longdblsize bytes long."
628e1a40
JH
7377 else
7378 dflt='8'
7379 echo " "
7380 echo "(I can't seem to compile the test program. Guessing...)" >&4
7381 rp="What is the size of a long double (in bytes)?"
7382 . ./myread
7383 longdblsize="$ans"
7384 fi
7385 if $test "X$doublesize" = "X$longdblsize"; then
7386 echo "(That isn't any different from an ordinary double.)"
7387 fi
7388 ;;
7389esac
7390$rm -f try.* try
ff935051 7391
cf2093f6
JH
7392echo " "
7393
ea1c3b15 7394if $test X"$d_longdbl" = X"$define"; then
cf2093f6
JH
7395
7396echo "Checking how to print long doubles..." >&4
7397
7398if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7399 $cat >try.c <<'EOCP'
7400#include <sys/types.h>
7401#include <stdio.h>
7402int main() {
7403 double d = 123.456;
7404 printf("%.3f\n", d);
7405}
7406EOCP
7407 set try
7408 if eval $compile; then
7409 yyy=`./try$exe_ext`
7410 case "$yyy" in
7411 123.456)
7412 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7413 sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7414 echo "We will use %f."
7415 ;;
7416 esac
7417 fi
7418fi
7419
7420if $test X"$sPRIfldbl" = X; then
7421 $cat >try.c <<'EOCP'
7422#include <sys/types.h>
7423#include <stdio.h>
7424int main() {
7425 long double d = 123.456;
ea1c3b15 7426 printf("%.3llf\n", d);
cf2093f6
JH
7427}
7428EOCP
7429 set try
7430 if eval $compile; then
7431 yyy=`./try$exe_ext`
7432 case "$yyy" in
7433 123.456)
ea1c3b15
JH
7434 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7435 sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7436 echo "We will use %llf."
cf2093f6
JH
7437 ;;
7438 esac
7439 fi
7440fi
7441
7442if $test X"$sPRIfldbl" = X; then
7443 $cat >try.c <<'EOCP'
7444#include <sys/types.h>
7445#include <stdio.h>
7446int main() {
7447 long double d = 123.456;
ea1c3b15 7448 printf("%.3Lf\n", d);
cf2093f6
JH
7449}
7450EOCP
7451 set try
7452 if eval $compile; then
7453 yyy=`./try$exe_ext`
7454 case "$yyy" in
7455 123.456)
ea1c3b15
JH
7456 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7457 sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7458 echo "We will use %Lf."
cf2093f6
JH
7459 ;;
7460 esac
7461 fi
7462fi
7463
11dc3f68 7464if $test X"$sPRIfldbl" = X; then
cf2093f6
JH
7465 $cat >try.c <<'EOCP'
7466#include <sys/types.h>
7467#include <stdio.h>
7468int main() {
7469 long double d = 123.456;
ea1c3b15 7470 printf("%.3lf\n", d);
cf2093f6
JH
7471}
7472EOCP
7473 set try
7474 if eval $compile; then
7475 yyy=`./try$exe_ext`
7476 case "$yyy" in
7477 123.456)
ea1c3b15
JH
7478 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7479 sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7480 echo "We will use %lf."
cf2093f6
JH
7481 ;;
7482 esac
7483 fi
7484fi
7485
09e3ef00
JH
7486if $test X"$sPRIfldbl" = X; then
7487 echo "Cannot figure out how to print long doubles." >&4
7488fi
7489
ea1c3b15 7490$rm -f try try.*
cf2093f6 7491
ea1c3b15 7492fi # d_longdbl
cf2093f6
JH
7493
7494case "$sPRIfldbl" in
7495'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7496 d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef";
7497 ;;
7498*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7499 d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define";
7500 ;;
7501esac
7502
bbe6c963
JH
7503: Check how to convert floats to strings.
7504if test "X$d_Gconvert" = X; then
7505 echo " "
7506 echo "Checking for an efficient way to convert floats to strings."
7507 echo " " > try.c
7508 case "$uselongdouble" in
7509 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7510 esac
7511 case "$d_longdbl" in
7512 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7513 esac
7514 case "$d_PRIgldbl" in
7515 "$define") echo "#define HAS_PRIgldbl" >>try.c ;;
7516 esac
7517 $cat >>try.c <<EOP
7518#ifdef TRY_gconvert
7519#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7520char *myname = "gconvert";
7521#endif
7522#ifdef TRY_gcvt
7523#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7524char *myname = "gcvt";
7525#endif
7526#ifdef TRY_qgcvt
7527#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7528char *myname = "qgcvt";
7529#define DOUBLETYPE long double
7530#endif
7531#ifdef TRY_sprintf
7532#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7533#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7534#else
7535#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7536#endif
7537char *myname = "sprintf";
7538#endif
7539
7540#ifndef DOUBLETYPE
7541#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7542#define DOUBLETYPE long double
7543#else
7544#define DOUBLETYPE double
7545#endif
7546#endif
7547
7548#include <stdio.h>
7549
7550#define I_STDLIB $i_stdlib
7551#ifdef I_STDLIB
7552#include <stdlib.h>
7553#endif
7554
7555int
7556checkit(expect, got)
7557char *expect;
7558char *got;
7559{
7560 if (strcmp(expect, got)) {
7561 printf("%s oddity: Expected %s, got %s\n",
7562 myname, expect, got);
7563 exit(1);
7564 }
7565}
7566
7567int main()
7568{
7569 char buf[64];
7570 buf[63] = '\0';
7571
7572 /* This must be 1st test on (which?) platform */
7573 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7574 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7575 checkit("0.1", buf);
7576
7577 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
7578 checkit("1", buf);
7579
7580 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
7581 checkit("1.1", buf);
7582
7583 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
7584 checkit("1.01", buf);
7585
7586 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
7587 checkit("1.001", buf);
7588
7589 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
7590 checkit("1.0001", buf);
7591
7592 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
7593 checkit("1.00001", buf);
7594
7595 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
7596 checkit("1.000001", buf);
7597
7598 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
7599 checkit("0", buf);
7600
7601 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
7602 checkit("-1", buf);
7603
7604 /* Some Linux gcvt's give 1.e+5 here. */
7605 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
7606 checkit("100000", buf);
7607
7608 /* Some Linux gcvt's give -1.e+5 here. */
7609 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
7610 checkit("-100000", buf);
7611
7612 exit(0);
7613}
7614EOP
7615 case "$d_Gconvert" in
7616 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7617 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7618 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7619 *) xxx_list='gconvert gcvt sprintf' ;;
7620 esac
7621
7622 case "$d_longdbl$uselongdouble$d_qgcvt" in
7623 "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7624 esac
7625
7626 for xxx_convert in $xxx_list; do
7627 echo "Trying $xxx_convert..."
7628 $rm -f try try$_o
7629 set try -DTRY_$xxx_convert
7630 if eval $compile; then
7631 echo "$xxx_convert() found." >&4
7632 if ./try; then
7633 echo "I'll use $xxx_convert to convert floats into a string." >&4
7634 break;
7635 else
7636 echo "...But $xxx_convert didn't work as I expected."
7637 fi
7638 else
7639 echo "$xxx_convert NOT found." >&4
7640 fi
7641 done
7642
7643 case "$xxx_convert" in
7644 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7645 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7646 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7647 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7648 "$define$define$define")
7649 d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7650 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7651 esac
7652 ;;
7653 esac
7654fi
7655
a0d0e21e
LW
7656: Initialize h_fcntl
7657h_fcntl=false
7658
7659: Initialize h_sysfile
7660h_sysfile=false
2304df62 7661
2304df62
AD
7662: access call always available on UNIX
7663set access d_access
7664eval $inlibc
7665
7666: locate the flags for 'access()'
7667case "$d_access" in
7668"$define")
7669 echo " "
7670 $cat >access.c <<'EOCP'
7671#include <sys/types.h>
7672#ifdef I_FCNTL
7673#include <fcntl.h>
7674#endif
7675#ifdef I_SYS_FILE
7676#include <sys/file.h>
7677#endif
7678#ifdef I_UNISTD
7679#include <unistd.h>
7680#endif
d674cd6d 7681int main() {
2304df62
AD
7682 exit(R_OK);
7683}
8e07c86e
AD
7684EOCP
7685 : check sys/file.h first, no particular reason here
7686 if $test `./findhdr sys/file.h` && \
dfe9444c 7687 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7688 h_sysfile=true;
7689 echo "<sys/file.h> defines the *_OK access constants." >&4
7690 elif $test `./findhdr fcntl.h` && \
dfe9444c 7691 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7692 h_fcntl=true;
7693 echo "<fcntl.h> defines the *_OK access constants." >&4
7694 elif $test `./findhdr unistd.h` && \
dfe9444c 7695 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
7696 echo "<unistd.h> defines the *_OK access constants." >&4
7697 else
7698 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7699 fi
7700 ;;
7701esac
7702$rm -f access*
a0d0e21e 7703
5ff3f7a4
GS
7704: see if accessx exists
7705set accessx d_accessx
7706eval $inlibc
7707
8e07c86e
AD
7708: see if alarm exists
7709set alarm d_alarm
7710eval $inlibc
2304df62 7711
cf2093f6
JH
7712: see if atolf exists
7713set atolf d_atolf
7714eval $inlibc
7715
7716: see if atoll exists
7717set atoll d_atoll
7718eval $inlibc
7719
ecfc5424 7720: Look for GNU-cc style attribute checking
2304df62 7721echo " "
a0d0e21e
LW
7722echo "Checking whether your compiler can handle __attribute__ ..." >&4
7723$cat >attrib.c <<'EOCP'
1aef975c 7724#include <stdio.h>
ecfc5424 7725void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
7726EOCP
7727if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7728 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 7729 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
7730 val="$undef"
7731 else
ecfc5424 7732 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
7733 val="$define"
7734 fi
7735else
ecfc5424 7736 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
7737 val="$undef"
7738fi
ecfc5424 7739set d_attribut
a0d0e21e
LW
7740eval $setvar
7741$rm -f attrib*
7742
7743: see if bcmp exists
7744set bcmp d_bcmp
7745eval $inlibc
7746
7747: see if bcopy exists
7748set bcopy d_bcopy
7749eval $inlibc
7750
2afac517 7751: see if this is a unistd.h system
7752set unistd.h i_unistd
7753eval $inhdr
7754
7755: see if getpgrp exists
7756set getpgrp d_getpgrp
7757eval $inlibc
7758
2afac517 7759case "$d_getpgrp" in
7760"$define")
7761 echo " "
dfe9444c 7762 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 7763 $cat >set.c <<EOP
7764#$i_unistd I_UNISTD
7765#include <sys/types.h>
7766#ifdef I_UNISTD
7767# include <unistd.h>
7768#endif
5a411a32 7769int main()
2afac517 7770{
7771 if (getuid() == 0) {
7772 printf("(I see you are running Configure as super-user...)\n");
7773 setuid(1);
7774 }
7775#ifdef TRY_BSD_PGRP
7776 if (getpgrp(1) == 0)
7777 exit(0);
7778#else
7779 if (getpgrp() > 0)
7780 exit(0);
7781#endif
7782 exit(1);
7783}
7784EOP
7785 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7786 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7787 val="$define"
7788 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7789 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7790 val="$undef"
7791 else
7792 echo "I can't seem to compile and run the test program."
7793 if ./usg; then
7794 xxx="a USG one, i.e. you use getpgrp()."
7795 else
7796 # SVR4 systems can appear rather BSD-ish.
7797 case "$i_unistd" in
7798 $undef)
7799 xxx="a BSD one, i.e. you use getpgrp(pid)."
7800 val="$define"
7801 ;;
7802 $define)
7803 xxx="probably a USG one, i.e. you use getpgrp()."
7804 val="$undef"
7805 ;;
7806 esac
7807 fi
7808 echo "Assuming your getpgrp is $xxx" >&4
7809 fi
7810 ;;
7811*) val="$undef";;
7812esac
7813set d_bsdgetpgrp
7814eval $setvar
7815$rm -f set set.c
7816
a0d0e21e
LW
7817: see if setpgrp exists
7818set setpgrp d_setpgrp
7819eval $inlibc
7820
a0d0e21e
LW
7821case "$d_setpgrp" in
7822"$define")
7823 echo " "
dfe9444c 7824 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 7825 $cat >set.c <<EOP
2afac517 7826#$i_unistd I_UNISTD
7827#include <sys/types.h>
7828#ifdef I_UNISTD
7829# include <unistd.h>
7830#endif
5a411a32 7831int main()
a0d0e21e
LW
7832{
7833 if (getuid() == 0) {
7834 printf("(I see you are running Configure as super-user...)\n");
7835 setuid(1);
7836 }
2afac517 7837#ifdef TRY_BSD_PGRP
a0d0e21e 7838 if (-1 == setpgrp(1, 1))
2afac517 7839 exit(0);
7840#else
7841 if (setpgrp() != -1)
7842 exit(0);
7843#endif
7844 exit(1);
a0d0e21e
LW
7845}
7846EOP
2afac517 7847 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7848 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7849 val="$define"
7850 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7851 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7852 val="$undef"
a0d0e21e 7853 else
dfe9444c 7854 echo "(I can't seem to compile and run the test program.)"
ecfc5424 7855 if ./usg; then
2afac517 7856 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 7857 else
2afac517 7858 # SVR4 systems can appear rather BSD-ish.
7859 case "$i_unistd" in
7860 $undef)
7861 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7862 val="$define"
7863 ;;
7864 $define)
7865 xxx="probably a USG one, i.e. you use setpgrp()."
7866 val="$undef"
7867 ;;
7868 esac
a0d0e21e 7869 fi
2afac517 7870 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
7871 fi
7872 ;;
7873*) val="$undef";;
7874esac
2afac517 7875set d_bsdsetpgrp
a0d0e21e
LW
7876eval $setvar
7877$rm -f set set.c
a0d0e21e
LW
7878: see if bzero exists
7879set bzero d_bzero
7880eval $inlibc
7881
ecfc5424 7882: see if signal is declared as pointer to function returning int or void
a0d0e21e 7883echo " "
ecfc5424
AD
7884xxx=`./findhdr signal.h`
7885$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7886if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
7887 echo "You have int (*signal())() instead of void." >&4
7888 val="$undef"
7889elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 7890 echo "You have void (*signal())()." >&4
ecfc5424
AD
7891 val="$define"
7892elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7893 echo "You have int (*signal())() instead of void." >&4
7894 val="$undef"
dfe9444c
AD
7895elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7896 echo "You have void (*signal())()." >&4
7897 val="$define"
a0d0e21e 7898else
ecfc5424
AD
7899 case "$d_voidsig" in
7900 '')
7901 echo "I can't determine whether signal handler returns void or int..." >&4
7902 dflt=void
7903 rp="What type does your signal handler return?"
7904 . ./myread
7905 case "$ans" in
7906 v*) val="$define";;
7907 *) val="$undef";;
7908 esac;;
7909 "$define")
dfe9444c
AD
7910 echo "As you already told me, signal handler returns void." >&4
7911 val="$define"
7912 ;;
7913 *) echo "As you already told me, signal handler returns int." >&4
7914 val="$undef"
7915 ;;
ecfc5424
AD
7916 esac
7917fi
7918set d_voidsig
7919eval $setvar
7920case "$d_voidsig" in
7921"$define") signal_t="void";;
7922*) signal_t="int";;
7923esac
7924$rm -f $$.tmp
7925
7926: check for ability to cast large floats to 32-bit ints.
7927echo " "
7928echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 7929if $test "$intsize" -ge 4; then
ecfc5424
AD
7930 xxx=int
7931else
7932 xxx=long
7933fi
7934$cat >try.c <<EOCP
e5c9fcd0 7935#include <stdio.h>
ecfc5424
AD
7936#include <sys/types.h>
7937#include <signal.h>
a1896f58 7938$signal_t blech(s) int s; { exit(3); }
d674cd6d 7939int main()
2304df62 7940{
a0d0e21e 7941 $xxx i32;
e5c9fcd0 7942 double f, g;
2304df62 7943 int result = 0;
89434db5 7944 char str[16];
2304df62
AD
7945 signal(SIGFPE, blech);
7946
89434db5
AD
7947 /* Don't let compiler optimize the test away. Store the number
7948 in a writable string for gcc to pass to sscanf under HP/UX.
7949 */
7950 sprintf(str, "2147483647");
7951 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
7952 g = 10 * f;
7953 i32 = ($xxx) g;
2304df62 7954
e5c9fcd0
AD
7955 /* x86 processors will probably give 0x8000 0000, which is a
7956 sign change. We don't want that. We want to mimic SPARC
7957 behavior here, which is to preserve the sign and give
7958 back 0x7fff ffff.
7959 */
a0d0e21e 7960 if (i32 != ($xxx) f)
2304df62
AD
7961 result |= 1;
7962 exit(result);
7963}
7964EOCP
dfe9444c 7965set try
dc45a647 7966if eval $compile_ok; then
2304df62
AD
7967 ./try
7968 yyy=$?
7969else
a0d0e21e 7970 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
7971 yyy=1
7972fi
7973case "$yyy" in
79740) val="$define"
7975 echo "Yup, it can."
7976 ;;
7977*) val="$undef"
7978 echo "Nope, it can't."
7979 ;;
7980esac
7981set d_casti32
7982eval $setvar
85e6fe83 7983$rm -f try try.*
a0d0e21e 7984
2304df62
AD
7985: check for ability to cast negative floats to unsigned
7986echo " "
7987echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 7988$cat >try.c <<EOCP
e5c9fcd0 7989#include <stdio.h>
ecfc5424 7990#include <sys/types.h>
2304df62 7991#include <signal.h>
a1896f58
AD
7992$signal_t blech(s) int s; { exit(7); }
7993$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
7994unsigned long dummy_long(p) unsigned long p; { return p; }
7995unsigned int dummy_int(p) unsigned int p; { return p; }
7996unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 7997int main()
2304df62 7998{
e5c9fcd0 7999 double f;
2304df62
AD
8000 unsigned long along;
8001 unsigned int aint;
8002 unsigned short ashort;
8003 int result = 0;
89434db5
AD
8004 char str[16];
8005
e5c9fcd0
AD
8006 /* Frustrate gcc-2.7.2's optimizer which failed this test with
8007 a direct f = -123. assignment. gcc-2.8.0 reportedly
8008 optimized the whole file away
8009 */
89434db5
AD
8010 /* Store the number in a writable string for gcc to pass to
8011 sscanf under HP/UX.
8012 */
8013 sprintf(str, "-123");
8014 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
8015
8016 signal(SIGFPE, blech);
8017 along = (unsigned long)f;
8018 aint = (unsigned int)f;
8019 ashort = (unsigned short)f;
8020 if (along != (unsigned long)-123)
8021 result |= 1;
8022 if (aint != (unsigned int)-123)
8023 result |= 1;
8024 if (ashort != (unsigned short)-123)
8025 result |= 1;
89434db5
AD
8026 sprintf(str, "1073741824.");
8027 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
8028 f = f + f;
8029 along = 0;
8030 along = (unsigned long)f;
8031 if (along != 0x80000000)
8032 result |= 2;
8033 f -= 1.;
8034 along = 0;
8035 along = (unsigned long)f;
8036 if (along != 0x7fffffff)
8037 result |= 1;
8038 f += 2.;
8039 along = 0;
8040 along = (unsigned long)f;
8041 if (along != 0x80000001)
8042 result |= 2;
232e078e
AD
8043 if (result)
8044 exit(result);
8045 signal(SIGFPE, blech_in_list);
89434db5
AD
8046 sprintf(str, "123.");
8047 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
8048 along = dummy_long((unsigned long)f);
8049 aint = dummy_int((unsigned int)f);
8050 ashort = dummy_short((unsigned short)f);
8051 if (along != (unsigned long)123)
8052 result |= 4;
8053 if (aint != (unsigned int)123)
8054 result |= 4;
8055 if (ashort != (unsigned short)123)
8056 result |= 4;
2304df62
AD
8057 exit(result);
8058
8059}
8060EOCP
dfe9444c 8061set try
dc45a647 8062if eval $compile_ok; then
2304df62
AD
8063 ./try
8064 castflags=$?
8065else
ecfc5424 8066 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 8067 castflags=7
2304df62
AD
8068fi
8069case "$castflags" in
80700) val="$define"
8071 echo "Yup, it can."
8072 ;;
8073*) val="$undef"
8074 echo "Nope, it can't."
8075 ;;
8076esac
8077set d_castneg
8078eval $setvar
8079$rm -f try.*
8080
2304df62
AD
8081: see if vprintf exists
8082echo " "
8083if set vprintf val -f d_vprintf; eval $csym; $val; then
8084 echo 'vprintf() found.' >&4
8085 val="$define"
8086 $cat >vprintf.c <<'EOF'
8087#include <varargs.h>
8088
d674cd6d 8089int main() { xxx("foo"); }
2304df62
AD
8090
8091xxx(va_alist)
8092va_dcl
8093{
8094 va_list args;
8095 char buf[10];
8096
8097 va_start(args);
8098 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8099}
8100EOF
dfe9444c
AD
8101 set vprintf
8102 if eval $compile && ./vprintf; then
2304df62
AD
8103 echo "Your vsprintf() returns (int)." >&4
8104 val2="$undef"
8105 else
8106 echo "Your vsprintf() returns (char*)." >&4
8107 val2="$define"
8108 fi
8109else
8110 echo 'vprintf() NOT found.' >&4
8111 val="$undef"
8112 val2="$undef"
8113fi
8114set d_vprintf
8115eval $setvar
8116val=$val2
8117set d_charvspr
8118eval $setvar
8119
a0d0e21e
LW
8120: see if chown exists
8121set chown d_chown
8122eval $inlibc
8123
8124: see if chroot exists
8125set chroot d_chroot
8126eval $inlibc
8127
2304df62
AD
8128: see if chsize exists
8129set chsize d_chsize
8130eval $inlibc
8131
8132: check for const keyword
8133echo " "
8134echo 'Checking to see if your C compiler knows about "const"...' >&4
8135$cat >const.c <<'EOCP'
8136typedef struct spug { int drokk; } spug;
5a411a32 8137int main()
2304df62
AD
8138{
8139 const char *foo;
8140 const spug y;
8141}
8142EOCP
8143if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8144 val="$define"
8145 echo "Yup, it does."
8146else
8147 val="$undef"
8148 echo "Nope, it doesn't."
8149fi
8150set d_const
8151eval $setvar
8152
8153: see if crypt exists
8154echo " "
8155if set crypt val -f d_crypt; eval $csym; $val; then
8156 echo 'crypt() found.' >&4
8157 val="$define"
8158 cryptlib=''
8159else
dfe9444c 8160 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 8161 if $test -z "$cryptlib"; then
dfe9444c 8162 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
8163 else
8164 cryptlib=-lcrypt
8165 fi
8166 if $test -z "$cryptlib"; then
dfe9444c 8167 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
8168 else
8169 cryptlib=-lcrypt
8170 fi
8171 if $test -z "$cryptlib"; then
dfe9444c 8172 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
8173 else
8174 cryptlib=-lcrypt
8175 fi
8176 if $test -z "$cryptlib"; then
8177 echo 'crypt() NOT found.' >&4
8178 val="$undef"
8179 else
8180 val="$define"
8181 fi
8182fi
8183set d_crypt
8184eval $setvar
8185
921b2963
JH
8186: get csh whereabouts
8187case "$csh" in
8188'csh') val="$undef" ;;
8189*) val="$define" ;;
8190esac
8191set d_csh
8192eval $setvar
8193: Respect a hint or command line value for full_csh.
8194case "$full_csh" in
8195'') full_csh=$csh ;;
8196esac
8197
a0d0e21e
LW
8198: see if cuserid exists
8199set cuserid d_cuserid
2304df62
AD
8200eval $inlibc
8201
a0d0e21e
LW
8202: see if this is a limits.h system
8203set limits.h i_limits
85e6fe83
LW
8204eval $inhdr
8205
a0d0e21e
LW
8206: see if this is a float.h system
8207set float.h i_float
8208eval $inhdr
8209
8210: See if number of significant digits in a double precision number is known
8211echo " "
8212$cat >dbl_dig.c <<EOM
8213#$i_limits I_LIMITS
8214#$i_float I_FLOAT
8215#ifdef I_LIMITS
8216#include <limits.h>
85e6fe83 8217#endif
a0d0e21e
LW
8218#ifdef I_FLOAT
8219#include <float.h>
8220#endif
8221#ifdef DBL_DIG
8222printf("Contains DBL_DIG");
85e6fe83 8223#endif
85e6fe83 8224EOM
a0d0e21e
LW
8225$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8226if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8227 echo "DBL_DIG found." >&4
8228 val="$define"
2304df62 8229else
a0d0e21e
LW
8230 echo "DBL_DIG NOT found." >&4
8231 val="$undef"
2304df62 8232fi
a0d0e21e
LW
8233$rm -f dbl_dig.?
8234set d_dbl_dig
2304df62 8235eval $setvar
2304df62 8236
a0d0e21e
LW
8237: see if difftime exists
8238set difftime d_difftime
2304df62
AD
8239eval $inlibc
8240
a0d0e21e
LW
8241: see if this is a dirent system
8242echo " "
8243if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8244 val="$define"
8245 echo "<dirent.h> found." >&4
8246else
8247 val="$undef"
8248 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8249 echo "<sys/dir.h> found." >&4
8250 echo " "
8251 else
8252 xinc=`./findhdr sys/ndir.h`
8253 fi
8254 echo "<dirent.h> NOT found." >&4
8255fi
8256set i_dirent
8257eval $setvar
8258
8259: Look for type of directory structure.
8260echo " "
8261$cppstdin $cppflags $cppminus < "$xinc" > try.c
8262
8263case "$direntrytype" in
8264''|' ')
8265 case "$i_dirent" in
8266 $define) guess1='struct dirent' ;;
8267 *) guess1='struct direct' ;;
2afac517 8268 esac
8269 ;;
8270*) guess1="$direntrytype"
8271 ;;
8e07c86e
AD
8272esac
8273
2afac517 8274case "$guess1" in
8275'struct dirent') guess2='struct direct' ;;
8276*) guess2='struct dirent' ;;
8277esac
8278
8279if $contains "$guess1" try.c >/dev/null 2>&1; then
8280 direntrytype="$guess1"
8281 echo "Your directory entries are $direntrytype." >&4
8282elif $contains "$guess2" try.c >/dev/null 2>&1; then
8283 direntrytype="$guess2"
8284 echo "Your directory entries seem to be $direntrytype." >&4
8285else
8286 echo "I don't recognize your system's directory entries." >&4
8287 rp="What type is used for directory entries on this system?"
8288 dflt="$guess1"
8289 . ./myread
8290 direntrytype="$ans"
8291fi
8292$rm -f try.c
a0d0e21e 8293
a0d0e21e 8294
2afac517 8295: see if the directory entry stores field length
8296echo " "
8297$cppstdin $cppflags $cppminus < "$xinc" > try.c
8298if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8299 echo "Good, your directory entry keeps length information in d_namlen." >&4
8300 val="$define"
8301else
8302 echo "Your directory entry does not know about the d_namlen field." >&4
8303 val="$undef"
8304fi
8305set d_dirnamlen
8306eval $setvar
8307$rm -f try.c
a0d0e21e 8308
5ff3f7a4
GS
8309: see if dlerror exists
8310xxx_runnm="$runnm"
8311runnm=false
8312set dlerror d_dlerror
8313eval $inlibc
8314runnm="$xxx_runnm"
8315
8316: see if dlfcn is available
8317set dlfcn.h i_dlfcn
8318eval $inhdr
8319
8320case "$usedl" in
8321$define|y|true)
8322 $cat << EOM
8323
8324On a few systems, the dynamically loaded modules that perl generates and uses
8325will need a different extension than shared libs. The default will probably
8326be appropriate.
8327
8328EOM
8329 case "$dlext" in
8330 '') dflt="$so" ;;
8331 *) dflt="$dlext" ;;
8332 esac
8333 rp='What is the extension of dynamically loaded modules'
8334 . ./myread
8335 dlext="$ans"
8336 ;;
8337*)
8338 dlext="none"
8339 ;;
8340esac
8341
8342: Check if dlsym need a leading underscore
a0d0e21e
LW
8343echo " "
8344val="$undef"
8345
8346case "$dlsrc" in
8347dl_dlopen.xs)
8348 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8349 $cat >dyna.c <<'EOM'
8350fred () { }
8351EOM
8352
8353$cat >fred.c<<EOM
8354
8355#include <stdio.h>
8356#$i_dlfcn I_DLFCN
8357#ifdef I_DLFCN
8358#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
8359#else
8360#include <sys/types.h>
8361#include <nlist.h>
8362#include <link.h>
8363#endif
8364
8365extern int fred() ;
8366
5a411a32 8367int main()
a0d0e21e
LW
8368{
8369 void * handle ;
8370 void * symbol ;
8371#ifndef RTLD_LAZY
8372 int mode = 1 ;
8373#else
8374 int mode = RTLD_LAZY ;
8375#endif
8376 handle = dlopen("./dyna.$dlext", mode) ;
8377 if (handle == NULL) {
5f05dabc 8378 printf ("1\n") ;
8379 fflush (stdout) ;
8380 exit(0);
a0d0e21e
LW
8381 }
8382 symbol = dlsym(handle, "fred") ;
8383 if (symbol == NULL) {
5f05dabc 8384 /* try putting a leading underscore */
8385 symbol = dlsym(handle, "_fred") ;
8386 if (symbol == NULL) {
8387 printf ("2\n") ;
8388 fflush (stdout) ;
8389 exit(0);
8390 }
8391 printf ("3\n") ;
a0d0e21e
LW
8392 }
8393 else
5f05dabc 8394 printf ("4\n") ;
36477c24 8395 fflush (stdout) ;
8396 exit(0);
a0d0e21e
LW
8397}
8398EOM
760ac839 8399 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 8400 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
8401 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
8402 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 8403 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
8404 xxx=`./fred`
8405 case $xxx in
8406 1) echo "Test program failed using dlopen." >&4
8407 echo "Perhaps you should not use dynamic loading." >&4;;
8408 2) echo "Test program failed using dlsym." >&4
8409 echo "Perhaps you should not use dynamic loading." >&4;;
8410 3) echo "dlsym needs a leading underscore" >&4
8411 val="$define" ;;
8412 4) echo "dlsym doesn't need a leading underscore." >&4;;
8413 esac
8414 else
8415 echo "I can't compile and run the test program." >&4
88d5303d 8416 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
a0d0e21e
LW
8417 fi
8418 ;;
8419esac
8420
a78b0d02 8421$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
8422
8423set d_dlsymun
8424eval $setvar
8425
85ab1d1d
JH
8426hasproto='varname=$1; func=$2; shift; shift;
8427while $test $# -ge 2; do
8428 case "$1" in
8429 $define) echo "#include <$2>";;
8430 esac ;
8431 shift 2;
8432done > try.c;
8433$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8434if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8435 echo "$func() prototype found.";
8436 val="$define";
8437else
8438 echo "$func() prototype NOT found.";
8439 val="$undef";
8440fi;
8441set $varname;
8442eval $setvar;
8443$rm -f try.c tryout.c'
8444
8445: see if prototype for drand48 is available
8446echo " "
8447set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8448eval $hasproto
8449
a0d0e21e
LW
8450: see if dup2 exists
8451set dup2 d_dup2
8452eval $inlibc
8453
5ff3f7a4
GS
8454: see if eaccess exists
8455set eaccess d_eaccess
8456eval $inlibc
8457
8458: see if endgrent exists
8459set endgrent d_endgrent
8460eval $inlibc
8461
e5c9fcd0
AD
8462: see if endhostent exists
8463set endhostent d_endhent
8464eval $inlibc
8465
8466: see if endnetent exists
8467set endnetent d_endnent
8468eval $inlibc
8469
8470: see if endprotoent exists
8471set endprotoent d_endpent
8472eval $inlibc
8473
5ff3f7a4
GS
8474: see if endpwent exists
8475set endpwent d_endpwent
8476eval $inlibc
8477
e5c9fcd0
AD
8478: see if endservent exists
8479set endservent d_endsent
8480eval $inlibc
8481
f1066039
JH
8482: see if endspent exists
8483set endspent d_endspent
8484eval $inlibc
8485
8e07c86e
AD
8486: Locate the flags for 'open()'
8487echo " "
8488$cat >open3.c <<'EOCP'
8489#include <sys/types.h>
8490#ifdef I_FCNTL
8491#include <fcntl.h>
8492#endif
8493#ifdef I_SYS_FILE
8494#include <sys/file.h>
8495#endif
d674cd6d 8496int main() {
8e07c86e
AD
8497 if(O_RDONLY);
8498#ifdef O_TRUNC
8499 exit(0);
8500#else
8501 exit(1);
8502#endif
8503}
8504EOCP
8505: check sys/file.h first to get FREAD on Sun
8506if $test `./findhdr sys/file.h` && \
dfe9444c 8507 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
8508 h_sysfile=true;
8509 echo "<sys/file.h> defines the O_* constants..." >&4
8510 if ./open3; then
8511 echo "and you have the 3 argument form of open()." >&4
8512 val="$define"
8513 else
8514 echo "but not the 3 argument form of open(). Oh, well." >&4
8515 val="$undef"
8516 fi
8517elif $test `./findhdr fcntl.h` && \
dfe9444c 8518 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
8519 h_fcntl=true;
8520 echo "<fcntl.h> defines the O_* constants..." >&4
8521 if ./open3; then
8522 echo "and you have the 3 argument form of open()." >&4
8523 val="$define"
8524 else
8525 echo "but not the 3 argument form of open(). Oh, well." >&4
8526 val="$undef"
8527 fi
8528else
8529 val="$undef"
8530 echo "I can't find the O_* constant definitions! You got problems." >&4
8531fi
8532set d_open3
8533eval $setvar
8534$rm -f open3*
8535
213c275f
JH
8536: see which of string.h or strings.h is needed
8537echo " "
8538strings=`./findhdr string.h`
8539if $test "$strings" && $test -r "$strings"; then
8540 echo "Using <string.h> instead of <strings.h>." >&4
8541 val="$define"
8542else
8543 val="$undef"
8544 strings=`./findhdr strings.h`
8545 if $test "$strings" && $test -r "$strings"; then
8546 echo "Using <strings.h> instead of <string.h>." >&4
8547 else
8548 echo "No string header found -- You'll surely have problems." >&4
8549 fi
8550fi
8551set i_string
8552eval $setvar
8553case "$i_string" in
8554"$undef") strings=`./findhdr strings.h`;;
8555*) strings=`./findhdr string.h`;;
8556esac
8557
8e07c86e
AD
8558: check for non-blocking I/O stuff
8559case "$h_sysfile" in
8560true) echo "#include <sys/file.h>" > head.c;;
8561*)
8562 case "$h_fcntl" in
8563 true) echo "#include <fcntl.h>" > head.c;;
8564 *) echo "#include <sys/fcntl.h>" > head.c;;
8565 esac
8566 ;;
8567esac
8568echo " "
8569echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8570case "$o_nonblock" in
8571'')
8572 $cat head.c > try.c
8573 $cat >>try.c <<'EOCP'
213c275f 8574#include <stdio.h>
d674cd6d 8575int main() {
8e07c86e
AD
8576#ifdef O_NONBLOCK
8577 printf("O_NONBLOCK\n");
8578 exit(0);
8579#endif
8580#ifdef O_NDELAY
8581 printf("O_NDELAY\n");
8582 exit(0);
8583#endif
8584#ifdef FNDELAY
8585 printf("FNDELAY\n");
8586 exit(0);
8587#endif
8588 exit(0);
8589}
8590EOCP
dfe9444c 8591 set try
dc45a647 8592 if eval $compile_ok; then
8e07c86e
AD
8593 o_nonblock=`./try`
8594 case "$o_nonblock" in
8595 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8596 *) echo "Seems like we can use $o_nonblock.";;
8597 esac
8598 else
8599 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8600 fi
8601 ;;
8602*) echo "Using $hint value $o_nonblock.";;
8603esac
8604$rm -f try try.* .out core
8605
8606echo " "
8607echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8608case "$eagain" in
8609'')
8610 $cat head.c > try.c
8611 $cat >>try.c <<EOCP
8612#include <errno.h>
8613#include <sys/types.h>
8614#include <signal.h>
213c275f 8615#include <stdio.h>
4633a7c4 8616#define MY_O_NONBLOCK $o_nonblock
dc45a647 8617#ifndef errno /* XXX need better Configure test */
8e07c86e 8618extern int errno;
dc45a647 8619#endif
14e4fe40
JH
8620#$i_unistd I_UNISTD
8621#ifdef I_UNISTD
213c275f
JH
8622#include <unistd.h>
8623#endif
1acc7ade
JH
8624#$i_string I_STRING
8625#ifdef I_STRING
213c275f
JH
8626#include <string.h>
8627#else
8628#include <strings.h>
8629#endif
8e07c86e 8630$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
8631EOCP
8632 $cat >> try.c <<'EOCP'
d674cd6d 8633int main()
8e07c86e
AD
8634{
8635 int pd[2];
8636 int pu[2];
8637 char buf[1];
8638 char string[100];
8639
8640 pipe(pd); /* Down: child -> parent */
8641 pipe(pu); /* Up: parent -> child */
8642 if (0 != fork()) {
8643 int ret;
8644 close(pd[1]); /* Parent reads from pd[0] */
8645 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 8646 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
8647 exit(1);
8648 signal(SIGALRM, blech);
8649 alarm(5);
8650 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
8651 exit(2);
8652 sprintf(string, "%d\n", ret);
8653 write(2, string, strlen(string));
8654 alarm(0);
8655#ifdef EAGAIN
8656 if (errno == EAGAIN) {
8657 printf("EAGAIN\n");
8658 goto ok;
8659 }
8660#endif
8661#ifdef EWOULDBLOCK
8662 if (errno == EWOULDBLOCK)
8663 printf("EWOULDBLOCK\n");
8664#endif
8665 ok:
8666 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
8667 sleep(2); /* Give it time to close our pipe */
8668 alarm(5);
8669 ret = read(pd[0], buf, 1); /* Should read EOF */
8670 alarm(0);
8671 sprintf(string, "%d\n", ret);
8672 write(3, string, strlen(string));
8673 exit(0);
8674 }
8675
8676 close(pd[0]); /* We write to pd[1] */
8677 close(pu[1]); /* We read from pu[0] */
8678 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
8679 close(pd[1]); /* Pipe pd is now fully closed! */
8680 exit(0); /* Bye bye, thank you for playing! */
8681}
8682EOCP
dfe9444c 8683 set try
dc45a647 8684 if eval $compile_ok; then
774d564b 8685 echo "$startsh" >mtry
40a7a20a 8686 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
8687 chmod +x mtry
8688 ./mtry >/dev/null 2>&1
8689 case $? in
8690 0) eagain=`$cat try.out`;;
8691 1) echo "Could not perform non-blocking setting!";;
8692 2) echo "I did a successful read() for something that was not there!";;
8693 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8694 *) echo "Something terribly wrong happened during testing.";;
8695 esac
8696 rd_nodata=`$cat try.ret`
8697 echo "A read() system call with no data present returns $rd_nodata."
8698 case "$rd_nodata" in
8699 0|-1) ;;
8700 *)
8701 echo "(That's peculiar, fixing that to be -1.)"
8702 rd_nodata=-1
8703 ;;
8704 esac
8705 case "$eagain" in
8706 '')
8707 echo "Forcing errno EAGAIN on read() with no data available."
8708 eagain=EAGAIN
8709 ;;
8710 *)
8711 echo "Your read() sets errno to $eagain when no data is available."
8712 ;;
8713 esac
8714 status=`$cat try.err`
8715 case "$status" in
8716 0) echo "And it correctly returns 0 to signal EOF.";;
8717 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8718 *) echo "However, your read() returns '$status' on EOF??";;
8719 esac
8720 val="$define"
28757baa 8721 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
8722 echo "WARNING: you can't distinguish between EOF and no data!"
8723 val="$undef"
8724 fi
8725 else
8726 echo "I can't compile the test program--assuming errno EAGAIN will do."
8727 eagain=EAGAIN
8728 fi
8729 set d_eofnblk
8730 eval $setvar
8731 ;;
8732*)
8733 echo "Using $hint value $eagain."
8734 echo "Your read() returns $rd_nodata when no data is present."
8735 case "$d_eofnblk" in
8736 "$define") echo "And you can see EOF because read() returns 0.";;
8737 "$undef") echo "But you can't see EOF status from read() returned value.";;
8738 *)
8739 echo "(Assuming you can't see EOF status from read anyway.)"
8740 d_eofnblk=$undef
8741 ;;
8742 esac
8743 ;;
8744esac
8745$rm -f try try.* .out core head.c mtry
8746
a0d0e21e
LW
8747: see if fchmod exists
8748set fchmod d_fchmod
8749eval $inlibc
8750
8751: see if fchown exists
8752set fchown d_fchown
8753eval $inlibc
8754
8755: see if this is an fcntl system
8756set fcntl d_fcntl
8757eval $inlibc
8758
b7b35fc2
JH
8759hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8760while $test $# -ge 2; do
8761 case "$1" in
8762 $define) echo "#include <$2>";;
8763 esac ;
8764 shift 2;
8765done > try.c;
8766echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8767set try;
8768if eval $compile; then
8769 val="$define";
8770else
8771 val="$undef";
8772fi;
8773set $varname;
8774eval $setvar;
8775$rm -f try.c try.o'
8776
8777socketlib=''
8778sockethdr=''
8779: see whether socket exists
8780echo " "
8781$echo $n "Hmm... $c" >&4
8782if set socket val -f d_socket; eval $csym; $val; then
8783 echo "Looks like you have Berkeley networking support." >&4
8784 d_socket="$define"
8785 if set setsockopt val -f; eval $csym; $val; then
8786 d_oldsock="$undef"
8787 else
8788 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8789 d_oldsock="$define"
8790 fi
8791else
8792 if $contains socklib libc.list >/dev/null 2>&1; then
8793 echo "Looks like you have Berkeley networking support." >&4
8794 d_socket="$define"
8795 : we will have to assume that it supports the 4.2 BSD interface
8796 d_oldsock="$undef"
8797 else
8798 echo "You don't have Berkeley networking in libc$_a..." >&4
8799 if test "X$d_socket" = "X$define"; then
8800 echo "...but you seem to believe that you have sockets." >&4
8801 else
8802 for net in net socket
8803 do
8804 if test -f /usr/lib/lib$net$_a; then
8805 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
8806 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8807 if $contains socket libc.list >/dev/null 2>&1; then
8808 d_socket="$define"
8809 socketlib="-l$net"
8810 case "$net" in
8811 net)
8812 echo "...but the Wollongong group seems to have hacked it in." >&4
8813 sockethdr="-I/usr/netinclude"
8814 ;;
8815 esac
8816 echo "Found Berkeley sockets interface in lib$net." >& 4
8817 if $contains setsockopt libc.list >/dev/null 2>&1; then
8818 d_oldsock="$undef"
8819 else
8820 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8821 d_oldsock="$define"
8822 fi
8823 break
8824 fi
8825 fi
8826 done
8827 if test "X$d_socket" != "X$define"; then
8828 echo "or anywhere else I see." >&4
8829 d_socket="$undef"
8830 d_oldsock="$undef"
8831 fi
8832 fi
8833 fi
8834fi
8835
8836: see if socketpair exists
8837set socketpair d_sockpair
8838eval $inlibc
8839
8840
8841echo " "
8842echo "Checking the availability of certain socket constants..." >& 4
8843for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8844 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8845 $cat >try.c <<EOF
8846#include <sys/types.h>
8847#include <sys/socket.h>
8848int main() {
8849 int i = $ENUM;
8850}
8851EOF
8852 val="$undef"
8853 set try; if eval $compile; then
8854 val="$define"
8855 fi
8856 set d_${enum}; eval $setvar
8857 $rm -f try.c try
8858done
8859
921b2963
JH
8860: see if sys/select.h has to be included
8861set sys/select.h i_sysselct
8862eval $inhdr
8863
8864: see if we should include time.h, sys/time.h, or both
8865echo " "
8866if test "X$timeincl" = X; then
8867 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8868 $echo $n "I'm now running the test program...$c"
8869 $cat >try.c <<'EOCP'
8870#include <sys/types.h>
8871#ifdef I_TIME
8872#include <time.h>
8873#endif
8874#ifdef I_SYSTIME
8875#ifdef SYSTIMEKERNEL
8876#define KERNEL
8877#endif
8878#include <sys/time.h>
8879#endif
8880#ifdef I_SYSSELECT
8881#include <sys/select.h>
8882#endif
d674cd6d 8883int main()
921b2963
JH
8884{
8885 struct tm foo;
8886#ifdef S_TIMEVAL
8887 struct timeval bar;
8888#endif
8889#ifdef S_TIMEZONE
8890 struct timezone tzp;
8891#endif
8892 if (foo.tm_sec == foo.tm_sec)
8893 exit(0);
8894#ifdef S_TIMEVAL
8895 if (bar.tv_sec == bar.tv_sec)
8896 exit(0);
8897#endif
8898 exit(1);
8899}
8900EOCP
8901 flags=''
8902 for s_timezone in '-DS_TIMEZONE' ''; do
8903 sysselect=''
8904 for s_timeval in '-DS_TIMEVAL' ''; do
8905 for i_systimek in '' '-DSYSTIMEKERNEL'; do
8906 for i_time in '' '-DI_TIME'; do
8907 for i_systime in '-DI_SYSTIME' ''; do
8908 case "$flags" in
8909 '') $echo $n ".$c"
8910 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8911 if eval $compile; then
8912 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8913 shift
8914 flags="$*"
8915 echo " "
8916 $echo $n "Succeeded with $flags$c"
8917 fi
8918 ;;
8919 esac
8920 done
8921 done
8922 done
8923 done
8924 done
8925 timeincl=''
8926 echo " "
8927 case "$flags" in
8928 *SYSTIMEKERNEL*) i_systimek="$define"
8929 timeincl=`./findhdr sys/time.h`
8930 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8931 *) i_systimek="$undef";;
8932 esac
8933 case "$flags" in
8934 *I_TIME*) i_time="$define"
8935 timeincl=`./findhdr time.h`" $timeincl"
8936 echo "We'll include <time.h>." >&4;;
8937 *) i_time="$undef";;
8938 esac
8939 case "$flags" in
8940 *I_SYSTIME*) i_systime="$define"
8941 timeincl=`./findhdr sys/time.h`" $timeincl"
8942 echo "We'll include <sys/time.h>." >&4;;
8943 *) i_systime="$undef";;
8944 esac
8945 $rm -f try.c try
8946fi
8947
8948: check for fd_set items
8949$cat <<EOM
8950
8951Checking to see how well your C compiler handles fd_set and friends ...
8952EOM
8953$cat >fd_set.c <<EOCP
8954#$i_systime I_SYS_TIME
8955#$i_sysselct I_SYS_SELECT
8956#$d_socket HAS_SOCKET
8957#include <sys/types.h>
8958#ifdef HAS_SOCKET
8959#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8960#endif
8961#ifdef I_SYS_TIME
8962#include <sys/time.h>
8963#endif
8964#ifdef I_SYS_SELECT
8965#include <sys/select.h>
8966#endif
d674cd6d 8967int main() {
921b2963
JH
8968 fd_set fds;
8969
8970#ifdef TRYBITS
8971 if(fds.fds_bits);
8972#endif
8973
8974#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8975 exit(0);
8976#else
8977 exit(1);
8978#endif
8979}
8980EOCP
8981set fd_set -DTRYBITS
8982if eval $compile; then
8983 d_fds_bits="$define"
8984 d_fd_set="$define"
8985 echo "Well, your system knows about the normal fd_set typedef..." >&4
8986 if ./fd_set; then
8987 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8988 d_fd_macros="$define"
8989 else
8990 $cat >&4 <<'EOM'
8991but not the normal fd_set macros! Gaaack! I'll have to cover for you.
8992EOM
8993 d_fd_macros="$undef"
8994 fi
8995else
8996 $cat <<'EOM'
8997Hmm, your compiler has some difficulty with fd_set. Checking further...
8998EOM
8999 set fd_set
9000 if eval $compile; then
9001 d_fds_bits="$undef"
9002 d_fd_set="$define"
9003 echo "Well, your system has some sort of fd_set available..." >&4
9004 if ./fd_set; then
9005 echo "and you have the normal fd_set macros." >&4
9006 d_fd_macros="$define"
9007 else
9008 $cat <<'EOM'
9009but not the normal fd_set macros! Gross! More work for me...
9010EOM
9011 d_fd_macros="$undef"
9012 fi
9013 else
9014 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
9015 d_fd_set="$undef"
9016 d_fds_bits="$undef"
9017 d_fd_macros="$undef"
9018 fi
9019fi
9020$rm -f fd_set*
9021
a0d0e21e
LW
9022: see if fgetpos exists
9023set fgetpos d_fgetpos
9024eval $inlibc
9025
8175356b
JH
9026: see if flock exists
9027set flock d_flock
9028eval $inlibc
9029
9030: see if fork exists
9031set fork d_fork
9032eval $inlibc
9033
9034: see if pathconf exists
9035set pathconf d_pathconf
9036eval $inlibc
9037
9038: see if fpathconf exists
9039set fpathconf d_fpathconf
9040eval $inlibc
9041
d9b3e12d 9042
d9b3e12d
JH
9043: check for fpos64_t
9044echo " "
c5f05a91 9045echo "Checking to see if you have fpos64_t..." >&4
d9b3e12d 9046$cat >try.c <<EOCP
ce65dbcf 9047#include <stdio.h>
3c96ce7f 9048int main() { fpos64_t x = 7; }
d9b3e12d 9049EOCP
8175356b
JH
9050set try
9051if eval $compile; then
d9b3e12d 9052 val="$define"
c5f05a91 9053 echo "You have fpos64_t."
d9b3e12d
JH
9054else
9055 val="$undef"
c5f05a91 9056 echo "You do not have fpos64_t."
8175356b 9057 case "$fpossize" in
1eeb0f31 9058 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8175356b 9059 esac
d9b3e12d 9060fi
8175356b 9061$rm -f try.* try
d9b3e12d
JH
9062set d_fpos64_t
9063eval $setvar
9064
0545a864
JH
9065hasstruct='varname=$1; struct=$2; shift; shift;
9066while $test $# -ge 2; do
9067 case "$1" in
9068 $define) echo "#include <$2>";;
9069 esac ;
9070 shift 2;
9071done > try.c;
9072echo "int main () { struct $struct foo; }" >> try.c;
9073set try;
9074if eval $compile; then
9075 val="$define";
9076else
9077 val="$undef";
9078fi;
9079set $varname;
9080eval $setvar;
9081$rm -f try.c try.o'
d9b3e12d 9082
9b9c89a3
JH
9083: see if this is a sys/param system
9084set sys/param.h i_sysparam
9085eval $inhdr
9086
104d25b7
JH
9087: see if this is a sys/mount.h system
9088set sys/mount.h i_sysmount
9089eval $inhdr
9090
0545a864
JH
9091: see if sys/types.h has to be included
9092set sys/types.h i_systypes
9093eval $inhdr
9094
0545a864 9095
ad27e871 9096echo " "
8175356b 9097echo "Checking to see if your system supports struct fs_data..." >&4
0545a864
JH
9098set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9099eval $hasstruct
9100case "$d_fs_data_s" in
a22e52b9
JH
9101"$define") echo "Yes, it does." ;;
9102*) echo "No, it doesn't." ;;
0545a864
JH
9103esac
9104
9105: see if fseeko exists
9106set fseeko d_fseeko
9107eval $inlibc
1eeb0f31 9108case "$longsize" in
43999f95 91098) echo "(Your long is 64 bits, so you could use fseek.)" ;;
1eeb0f31 9110esac
0545a864
JH
9111
9112: see if fsetpos exists
9113set fsetpos d_fsetpos
9114eval $inlibc
9115
9116
9117: see if fstatfs exists
9118set fstatfs d_fstatfs
9119eval $inlibc
104d25b7
JH
9120
9121
9122: see if statvfs exists
9123set statvfs d_statvfs
9124eval $inlibc
9125
9126: see if fstatvfs exists
9127set fstatvfs d_fstatvfs
9128eval $inlibc
9129
9130
5ff3f7a4
GS
9131: see if ftello exists
9132set ftello d_ftello
9133eval $inlibc
1eeb0f31 9134case "$longsize" in
43999f95 91358) echo "(Your long is 64 bits, so you could use ftell.)" ;;
1eeb0f31 9136esac
5ff3f7a4 9137
49dabb45
JH
9138: see if getcwd exists
9139set getcwd d_getcwd
9140eval $inlibc
9141
c890dc6c
JH
9142
9143: see if getfsstat exists
9144set getfsstat d_getfsstat
9145eval $inlibc
9146
5ff3f7a4
GS
9147: see if getgrent exists
9148set getgrent d_getgrent
9149eval $inlibc
9150
693762b4
AD
9151: see if gethostbyaddr exists
9152set gethostbyaddr d_gethbyaddr
9153eval $inlibc
9154
9155: see if gethostbyname exists
9156set gethostbyname d_gethbyname
9157eval $inlibc
9158
a0d0e21e
LW
9159: see if gethostent exists
9160set gethostent d_gethent
9161eval $inlibc
9162
921b2963
JH
9163: see how we will look up host name
9164echo " "
a63faeb8
JH
9165call=''
9166if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
9167 echo 'gethostname() found.' >&4
9168 d_gethname="$define"
9169 call=gethostname
a63faeb8
JH
9170fi
9171if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
9172 if ./xenix; then
9173 $cat <<'EOM'
9174uname() was found, but you're running xenix, and older versions of xenix
9175have a broken uname(). If you don't really know whether your xenix is old
9176enough to have a broken system call, use the default answer.
9177
9178EOM
9179 dflt=y
9180 case "$d_uname" in
9181 "$define") dflt=n;;
9182 esac
9183 rp='Is your uname() broken?'
9184 . ./myread
9185 case "$ans" in
9186 n*) d_uname="$define"; call=uname;;
9187 esac
9188 else
9189 echo 'uname() found.' >&4
9190 d_uname="$define"
a63faeb8
JH
9191 case "$call" in
9192 '') call=uname ;;
9193 esac
921b2963
JH
9194 fi
9195fi
9196case "$d_gethname" in
9197'') d_gethname="$undef";;
9198esac
9199case "$d_uname" in
9200'') d_uname="$undef";;
9201esac
9202case "$d_uname$d_gethname" in
9203*define*)
9204 dflt=n
9205 cat <<EOM
9206
9207Every now and then someone has a $call() that lies about the hostname
9208but can't be fixed for political or economic reasons. If you wish, I can
9209pretend $call() isn't there and maybe compute hostname at run-time
9210thanks to the '$phostname' command.
9211
9212EOM
9213 rp="Shall I ignore $call() from now on?"
9214 . ./myread
9215 case "$ans" in
9216 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9217 esac;;
9218esac
9219case "$phostname" in
9220'') aphostname='';;
9221*) case "$aphostname" in
9222 /*) ;;
9223 *) set X $phostname
9224 shift
9225 file=$1
9226 shift
9227 file=`./loc $file $file $pth`
9228 aphostname=`echo $file $*`
9229 ;;
9230 esac
9231 ;;
9232esac
9233case "$d_uname$d_gethname" in
9234*define*) ;;
9235*)
9236 case "$phostname" in
9237 '')
9238 echo "There will be no way for $package to get your hostname." >&4;;
9239 *)
9240 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9241 ;;
9242 esac;;
9243esac
9244case "$d_phostname" in
9245'') d_phostname="$undef";;
9246esac
9247
dc45a647
MB
9248: see if this is a netdb.h system
9249set netdb.h i_netdb
9250eval $inhdr
9251
9252: see if prototypes for various gethostxxx netdb.h functions are available
9253echo " "
9254set d_gethostprotos gethostent $i_netdb netdb.h
9255eval $hasproto
9256
a0d0e21e
LW
9257: see if getlogin exists
9258set getlogin d_getlogin
9259eval $inlibc
9260
ad27e871
JH
9261: see if getmnt exists
9262set getmnt d_getmnt
9263eval $inlibc
9264
ccc7f9b3
KS
9265: see if getmntent exists
9266set getmntent d_getmntent
9267eval $inlibc
9268
693762b4
AD
9269: see if getnetbyaddr exists
9270set getnetbyaddr d_getnbyaddr
9271eval $inlibc
9272
9273: see if getnetbyname exists
9274set getnetbyname d_getnbyname
9275eval $inlibc
9276
e5c9fcd0
AD
9277: see if getnetent exists
9278set getnetent d_getnent
9279eval $inlibc
9280
dc45a647
MB
9281: see if prototypes for various getnetxxx netdb.h functions are available
9282echo " "
9283set d_getnetprotos getnetent $i_netdb netdb.h
9284eval $hasproto
9285
693762b4
AD
9286
9287: see if getprotobyname exists
9288set getprotobyname d_getpbyname
9289eval $inlibc
9290
9291: see if getprotobynumber exists
9292set getprotobynumber d_getpbynumber
9293eval $inlibc
e5c9fcd0
AD
9294
9295: see if getprotoent exists
9296set getprotoent d_getpent
9297eval $inlibc
9298
2afac517 9299: see if getpgid exists
9300set getpgid d_getpgid
a0d0e21e
LW
9301eval $inlibc
9302
9303: see if getpgrp2 exists
9304set getpgrp2 d_getpgrp2
9305eval $inlibc
9306
9307: see if getppid exists
9308set getppid d_getppid
9309eval $inlibc
9310
9311: see if getpriority exists
9312set getpriority d_getprior
9313eval $inlibc
9314
dc45a647
MB
9315: see if prototypes for various getprotoxxx netdb.h functions are available
9316echo " "
9317set d_getprotoprotos getprotoent $i_netdb netdb.h
9318eval $hasproto
9319
5ff3f7a4
GS
9320: see if getpwent exists
9321set getpwent d_getpwent
9322eval $inlibc
9323
9324
693762b4
AD
9325: see if getservbyname exists
9326set getservbyname d_getsbyname
9327eval $inlibc
9328
9329: see if getservbyport exists
9330set getservbyport d_getsbyport
9331eval $inlibc
e5c9fcd0
AD
9332
9333: see if getservent exists
9334set getservent d_getsent
9335eval $inlibc
9336
dc45a647
MB
9337: see if prototypes for various getservxxx netdb.h functions are available
9338echo " "
9339set d_getservprotos getservent $i_netdb netdb.h
9340eval $hasproto
9341
f1066039
JH
9342: see if getspent exists
9343set getspent d_getspent
9344eval $inlibc
9345
9346: see if getspnam exists
9347set getspnam d_getspnam
9348eval $inlibc
9349
5f05dabc 9350: see if gettimeofday or ftime exists
9351set gettimeofday d_gettimeod
9352eval $inlibc
9353case "$d_gettimeod" in
9354"$undef")
9355 set ftime d_ftime
9356 eval $inlibc
9357 ;;
9358*)
9359 val="$undef"; set d_ftime; eval $setvar
9360 ;;
9361esac
9362case "$d_gettimeod$d_ftime" in
9363"$undef$undef")
9364 echo " "
9365 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9366 ;;
9367esac
9368
5ff3f7a4
GS
9369: see if this is an grp system
9370set grp.h i_grp
9371eval $inhdr
9372
9373case "$i_grp" in
9374$define)
9375 xxx=`./findhdr grp.h`
9376 $cppstdin $cppflags $cppminus < $xxx >$$.h
9377
9378 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9379 val="$define"
9380 else
9381 val="$undef"
9382 fi
9383 set d_grpasswd
9384 eval $setvar
9385
9386 $rm -f $$.h
9387 ;;
9388*)
9389 val="$undef";
9390 set d_grpasswd; eval $setvar
9391 ;;
9392esac
9393
ccc7f9b3
KS
9394: see if hasmntopt exists
9395set hasmntopt d_hasmntopt
9396eval $inlibc
9397
a0d0e21e
LW
9398: see if this is a netinet/in.h or sys/in.h system
9399set netinet/in.h i_niin sys/in.h i_sysin
9400eval $inhdr
9401
5ff3f7a4 9402: see if arpa/inet.h has to be included
93341792 9403set arpa/inet.h i_arpainet
28e8609d
JH
9404eval $inhdr
9405
a0d0e21e
LW
9406: see if htonl --and friends-- exists
9407val=''
9408set htonl val
9409eval $inlibc
9410
9411: Maybe they are macros.
9412case "$val" in
9413$undef)
9414 $cat >htonl.c <<EOM
9415#include <stdio.h>
9416#include <sys/types.h>
9417#$i_niin I_NETINET_IN
9418#$i_sysin I_SYS_IN
93341792 9419#$i_arpainet I_ARPA_INET
a0d0e21e
LW
9420#ifdef I_NETINET_IN
9421#include <netinet/in.h>
9422#endif
9423#ifdef I_SYS_IN
9424#include <sys/in.h>
9425#endif
28e8609d
JH
9426#ifdef I_ARPA_INET
9427#include <arpa/inet.h>
9428#endif
a0d0e21e
LW
9429#ifdef htonl
9430printf("Defined as a macro.");
9431#endif
9432EOM
9433 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9434 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9435 val="$define"
9436 echo "But it seems to be defined as a macro." >&4
9437 fi
9438 $rm -f htonl.?
9439 ;;
9440esac
9441set d_htonl
9442eval $setvar
9443
43999f95
JH
9444: see if iconv exists
9445set iconv d_iconv
9446eval $inlibc
9447
a0d0e21e
LW
9448: index or strchr
9449echo " "
9450if set index val -f; eval $csym; $val; then
9451 if set strchr val -f d_strchr; eval $csym; $val; then
9452 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9453 val="$define"
9454 vali="$undef"
9455 echo "strchr() found." >&4
9456 else
9457 val="$undef"
9458 vali="$define"
9459 echo "index() found." >&4
9460 fi
9461 else
9462 val="$undef"
9463 vali="$define"
9464 echo "index() found." >&4
9465 fi
9466else
9467 if set strchr val -f d_strchr; eval $csym; $val; then
9468 val="$define"
9469 vali="$undef"
9470 echo "strchr() found." >&4
9471 else
9472 echo "No index() or strchr() found!" >&4
9473 val="$undef"
9474 vali="$undef"
9475 fi
9476fi
9477set d_strchr; eval $setvar
9478val="$vali"
9479set d_index; eval $setvar
9480
7e1af8bc 9481: check whether inet_aton exists
9482set inet_aton d_inetaton
9483eval $inlibc
9484
fe749a9f
JH
9485: see if inttypes.h is available
9486: we want a real compile instead of Inhdr because some systems
9487: have an inttypes.h which includes non-existent headers
9488echo " "
9489$cat >try.c <<EOCP
9490#include <inttypes.h>
9491int main() {
9492 static int32_t foo32 = 0x12345678;
9493}
9494EOCP
9495set try
9496if eval $compile; then
9497 echo "<inttypes.h> found." >&4
9498 val="$define"
9499else
9500 echo "<inttypes.h> NOT found." >&4
9501 val="$undef"
9502fi
9503$rm -f try.c try
9504set i_inttypes
9505eval $setvar
9506
9507: check for int64_t
9508echo " "
c5f05a91 9509echo "Checking to see if you have int64_t..." >&4
fe749a9f
JH
9510$cat >try.c <<EOCP
9511#include <sys/types.h>
9512#$i_inttypes I_INTTYPES
9513#ifdef I_INTTYPES
9514#include <inttypes.h>
9515#endif
9516int main() { int64_t x = 7; }
9517EOCP
9518set try
9519if eval $compile; then
9520 val="$define"
ce65dbcf 9521 echo "You have int64_t."
fe749a9f
JH
9522else
9523 val="$undef"
ce65dbcf 9524 echo "You do not have int64_t."
fe749a9f
JH
9525fi
9526$rm -f try try.*
13b3f787 9527set d_int64_t
fe749a9f
JH
9528eval $setvar
9529
a0d0e21e
LW
9530: Look for isascii
9531echo " "
9532$cat >isascii.c <<'EOCP'
9533#include <stdio.h>
9534#include <ctype.h>
d674cd6d 9535int main() {
a0d0e21e
LW
9536 int c = 'A';
9537 if (isascii(c))
9538 exit(0);
9539 else
9540 exit(1);
9541}
9542EOCP
dfe9444c
AD
9543set isascii
9544if eval $compile; then
a0d0e21e
LW
9545 echo "isascii() found." >&4
9546 val="$define"
9547else
9548 echo "isascii() NOT found." >&4
9549 val="$undef"
9550fi
9551set d_isascii
9552eval $setvar
9553$rm -f isascii*
9554
9555: see if killpg exists
9556set killpg d_killpg
9557eval $inlibc
9558
dd64f1c3
AD
9559: see if lchown exists
9560echo " "
9561$cat > try.c <<'EOCP'
9562/* System header to define __stub macros and hopefully few prototypes,
9563 which can conflict with char lchown(); below. */
9564#include <assert.h>
9565/* Override any gcc2 internal prototype to avoid an error. */
9566/* We use char because int might match the return type of a gcc2
9567 builtin and then its argument prototype would still apply. */
9568char lchown();
9569int main() {
9570 /* The GNU C library defines this for functions which it implements
9571 to always fail with ENOSYS. Some functions are actually named
9572 something starting with __ and the normal name is an alias. */
9573#if defined (__stub_lchown) || defined (__stub___lchown)
9574choke me
9575#else
9576lchown();
9577#endif
9578; return 0; }
9579EOCP
9580set try
9581if eval $compile; then
9582 $echo "lchown() found." >&4
9583 val="$define"
9584else
9585 $echo "lchown() NOT found." >&4
9586 val="$undef"
9587fi
9588set d_lchown
9589eval $setvar
9590
2d4389e4
JH
9591: See if number of significant digits in a double precision number is known
9592echo " "
9593$cat >ldbl_dig.c <<EOM
9594#$i_limits I_LIMITS
9595#$i_float I_FLOAT
9596#ifdef I_LIMITS
9597#include <limits.h>
9598#endif
9599#ifdef I_FLOAT
9600#include <float.h>
9601#endif
9602#ifdef LDBL_DIG
9603printf("Contains LDBL_DIG");
9604#endif
9605EOM
9606$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9607if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9608 echo "LDBL_DIG found." >&4
9609 val="$define"
9610else
9611 echo "LDBL_DIG NOT found." >&4
9612 val="$undef"
9613fi
9614$rm -f ldbl_dig.?
9615set d_ldbl_dig
9616eval $setvar
9617
a0d0e21e
LW
9618: see if link exists
9619set link d_link
9620eval $inlibc
9621
a0d0e21e
LW
9622: see if localeconv exists
9623set localeconv d_locconv
9624eval $inlibc
9625
9626: see if lockf exists
9627set lockf d_lockf
9628eval $inlibc
9629
8175356b
JH
9630: check for long long
9631echo " "
c5f05a91 9632echo "Checking to see if you have long long..." >&4
213c275f 9633echo 'int main() { long long x = 7; return 0; }' > try.c
8175356b
JH
9634set try
9635if eval $compile; then
9636 val="$define"
ce65dbcf 9637 echo "You have have long long."
8175356b
JH
9638else
9639 val="$undef"
ce65dbcf 9640 echo "You do not have long long."
8175356b
JH
9641fi
9642$rm try.*
9643set d_longlong
9644eval $setvar
9645
9646: check for length of long long
9647case "${d_longlong}${longlongsize}" in
9648$define)
9649 echo " "
49c10eea 9650 echo "Checking to see how big your long longs are..." >&4
8175356b
JH
9651 $cat >try.c <<'EOCP'
9652#include <stdio.h>
9653int main()
9654{
213c275f
JH
9655 printf("%d\n", (int)sizeof(long long));
9656 return(0);
8175356b
JH
9657}
9658EOCP
9659 set try
9660 if eval $compile_ok; then
9661 longlongsize=`./try$exe_ext`
49c10eea 9662 echo "Your long longs are $longlongsize bytes long."
8175356b
JH
9663 else
9664 dflt='8'
9665 echo " "
9666 echo "(I can't seem to compile the test program. Guessing...)"
9667 rp="What is the size of a long long (in bytes)?"
9668 . ./myread
9669 longlongsize="$ans"
9670 fi
9671 if $test "X$longsize" = "X$longlongsize"; then
9672 echo "(That isn't any different from an ordinary long.)"
9673 fi
9674 ;;
9675esac
9676$rm -f try.* try
9677
49c10eea
JH
9678: see if prototype for lseek is available
9679echo " "
9680set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9681eval $hasproto
9682
a0d0e21e
LW
9683: see if lstat exists
9684set lstat d_lstat
9685eval $inlibc
9686
1e8c3fde
JH
9687: see if madvise exists
9688set madvise d_madvise
9689eval $inlibc
9690
a0d0e21e
LW
9691: see if mblen exists
9692set mblen d_mblen
9693eval $inlibc
9694
9695: see if mbstowcs exists
9696set mbstowcs d_mbstowcs
9697eval $inlibc
9698
9699: see if mbtowc exists
9700set mbtowc d_mbtowc
9701eval $inlibc
9702
0f27ced1
JH
9703: see if memchr exists
9704set memchr d_memchr
9705eval $inlibc
9706
a0d0e21e
LW
9707: see if memcmp exists
9708set memcmp d_memcmp
9709eval $inlibc
9710
9711: see if memcpy exists
9712set memcpy d_memcpy
9713eval $inlibc
9714
9715: see if memmove exists
9716set memmove d_memmove
2304df62
AD
9717eval $inlibc
9718
9719: see if memset exists
9720set memset d_memset
9721eval $inlibc
9722
9723: see if mkdir exists
9724set mkdir d_mkdir
9725eval $inlibc
9726
fe749a9f
JH
9727: see if mkdtemp exists
9728set mkdtemp d_mkdtemp
9729eval $inlibc
9730
a0d0e21e
LW
9731: see if mkfifo exists
9732set mkfifo d_mkfifo
9733eval $inlibc
9734
fe749a9f
JH
9735: see if mkstemp exists
9736set mkstemp d_mkstemp
9737eval $inlibc
9738
9739: see if mkstemps exists
9740set mkstemps d_mkstemps
9741eval $inlibc
9742
a0d0e21e
LW
9743: see if mktime exists
9744set mktime d_mktime
9745eval $inlibc
9746
87b71857
JH
9747: see if this is a sys/mman.h system
9748set sys/mman.h i_sysmman
9749eval $inhdr
9750
9751: see if mmap exists
9752set mmap d_mmap
9753eval $inlibc
9754: see what shmat returns
9755: default to something harmless
9756mmaptype='void *'
9757case "$i_sysmman$d_mmap" in
9758"$define$define")
9759 $cat >mmap.c <<'END'
9760#include <sys/mman.h>
9761void *mmap();
9762END
9763 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9764 mmaptype='void *'
9765 else
9766 mmaptype='caddr_t'
9767 fi
9768 echo "and it returns ($mmaptype)." >&4
9769 ;;
9770esac
9771
9772
9773
fe749a9f
JH
9774: see if mprotect exists
9775set mprotect d_mprotect
9776eval $inlibc
9777
2304df62
AD
9778: see if msgctl exists
9779set msgctl d_msgctl
9780eval $inlibc
9781
9782: see if msgget exists
9783set msgget d_msgget
9784eval $inlibc
9785
9786: see if msgsnd exists
9787set msgsnd d_msgsnd
9788eval $inlibc
9789
9790: see if msgrcv exists
9791set msgrcv d_msgrcv
9792eval $inlibc
9793
9794: see how much of the 'msg*(2)' library is present.
9795h_msg=true
9796echo " "
9797case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9798*"$undef"*) h_msg=false;;
9799esac
6087ac44
JH
9800case "$osname" in
9801freebsd)
9802 case "`ipcs 2>&1`" in
9803 "SVID messages"*"not configured"*)
5ff3f7a4 9804 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
9805 h_msg=false
9806 val="$undef"
9807 set msgctl d_msgctl
9808 eval $setvar
9809 set msgget d_msgget
9810 eval $setvar
9811 set msgsnd d_msgsnd
9812 eval $setvar
9813 set msgrcv d_msgrcv
9814 eval $setvar
9815 ;;
9816 esac
9817 ;;
9818esac
2304df62
AD
9819: we could also check for sys/ipc.h ...
9820if $h_msg && $test `./findhdr sys/msg.h`; then
9821 echo "You have the full msg*(2) library." >&4
9822 val="$define"
9823else
9824 echo "You don't have the full msg*(2) library." >&4
9825 val="$undef"
9826fi
9827set d_msg
9828eval $setvar
9829
fe749a9f
JH
9830: see if msync exists
9831set msync d_msync
dfe9444c
AD
9832eval $inlibc
9833
fe749a9f
JH
9834: see if munmap exists
9835set munmap d_munmap
9836eval $inlibc
ff935051 9837
fe749a9f
JH
9838: see if nice exists
9839set nice d_nice
9840eval $inlibc
ff935051 9841
de1c2614
JH
9842
9843echo " "
6b8eaf93 9844echo "Checking which 64-bit integer type we could use..." >&4
de1c2614
JH
9845
9846case "$intsize" in
98478) val=int
9848 set quadtype
9849 eval $setvar
9850 val='"unsigned int"'
9851 set uquadtype
9852 eval $setvar
6b8eaf93 9853 quadkind=1
de1c2614
JH
9854 ;;
9855*) case "$longsize" in
9856 8) val=long
9857 set quadtype
9858 eval $setvar
9859 val='"unsigned long"'
9860 set uquadtype
9861 eval $setvar
6b8eaf93 9862 quadkind=2
de1c2614 9863 ;;
43999f95
JH
9864 *) case "$d_longlong:$longlongsize" in
9865 define:8)
de1c2614
JH
9866 val='"long long"'
9867 set quadtype
9868 eval $setvar
9869 val='"unsigned long long"'
9870 set uquadtype
9871 eval $setvar
6b8eaf93 9872 quadkind=3
de1c2614 9873 ;;
13b3f787 9874 *) case "$d_int64_t" in
de1c2614
JH
9875 define)
9876 val=int64_t
9877 set quadtype
9878 eval $setvar
9879 val=uint64_t
9880 set uquadtype
9881 eval $setvar
6b8eaf93 9882 quadkind=4
de1c2614
JH
9883 ;;
9884 esac
9885 ;;
9886 esac
9887 ;;
9888 esac
9889 ;;
9890esac
9891
9892case "$quadtype" in
ad551343 9893'') echo "Alas, no 64-bit integer types in sight." >&4
de1c2614
JH
9894 d_quad="$undef"
9895 ;;
10cc9d2a 9896*) if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
1eeb0f31
JH
9897 verb="will"
9898 else
9899 verb="could"
9900 fi
9901 echo "We $verb use '$quadtype' for 64-bit integers." >&4
de1c2614
JH
9902 d_quad="$define"
9903 ;;
9904esac
9905
cce08f5b
JH
9906: check for length of character
9907echo " "
9908case "$charsize" in
9909'')
9910 echo "Checking to see how big your characters are (hey, you never know)..." >&4
9911 $cat >try.c <<'EOCP'
9912#include <stdio.h>
9913int main()
9914{
9915 printf("%d\n", (int)sizeof(char));
9916 exit(0);
9917}
9918EOCP
9919 set try
9920 if eval $compile_ok; then
9921 dflt=`./try`
9922 else
9923 dflt='1'
9924 echo "(I can't seem to compile the test program. Guessing...)"
9925 fi
9926 ;;
9927*)
9928 dflt="$charsize"
9929 ;;
9930esac
9931rp="What is the size of a character (in bytes)?"
9932. ./myread
9933charsize="$ans"
9934$rm -f try.c try
9935
9936
9937echo " "
9938$echo "Choosing the C types to be used for Perl's internal types..." >&4
9939
10cc9d2a 9940case "$use64bitint:$d_quad:$quadtype" in
cce08f5b
JH
9941define:define:?*)
9942 ivtype="$quadtype"
9943 uvtype="$uquadtype"
9944 ivsize=8
9945 uvsize=8
9946 ;;
9947*) ivtype="long"
9948 uvtype="unsigned long"
9949 ivsize=$longsize
9950 uvsize=$longsize
9951 ;;
9952esac
9953
9954case "$uselongdouble:$d_longdbl" in
9955define:define)
9956 nvtype="long double"
9957 nvsize=$longdblsize
9958 ;;
9959*) nvtype=double
9960 nvsize=$doublesize
9961 ;;
9962esac
9963
9964$echo "(IV will be "$ivtype", $ivsize bytes)"
9965$echo "(UV will be "$uvtype", $uvsize bytes)"
9966$echo "(NV will be "$nvtype", $nvsize bytes)"
9967
9968$cat >try.c <<EOCP
9969#$i_inttypes I_INTTYPES
9970#ifdef I_INTTYPES
9971#include <inttypes.h>
9972#endif
9973#include <stdio.h>
9974int main() {
9975#ifdef INT8
9976 int8_t i = INT8_MAX;
9977 uint8_t u = UINT8_MAX;
9978 printf("int8_t\n");
9979#endif
9980#ifdef INT16
9981 int16_t i = INT16_MAX;
9982 uint16_t i = UINT16_MAX;
9983 printf("int16_t\n");
9984#endif
9985#ifdef INT32
9986 int32_t i = INT32_MAX;
9987 uint32_t u = UINT32_MAX;
9988 printf("int32_t\n");
9989#endif
9990}
9991EOCP
9992
9993case "$i8type" in
9994'') case "$charsize" in
9995 1) i8type=char
9996 u8type="unsigned char"
9997 i8size=$charsize
9998 u8size=$charsize
9999 ;;
10000 esac
10001 ;;
10002esac
10003case "$i8type" in
10004'') set try -DINT8
10005 if eval $compile; then
10006 case "`./try$exe_ext`" in
10007 int8_t) i8type=int8_t
10008 u8type=uint8_t
10009 i8size=1
10010 u8size=1
10011 ;;
10012 esac
10013 fi
10014 ;;
10015esac
10016case "$i8type" in
10017'') if $test $charsize -ge 1; then
10018 i8type=char
10019 u8type="unsigned char"
10020 i8size=$charsize
10021 u8size=$charsize
10022 fi
10023 ;;
10024esac
10025
10026case "$i16type" in
10027'') case "$shortsize" in
10028 2) i16type=short
10029 u16type="unsigned short"
10030 i16size=$shortsize
10031 u16size=$shortsize
10032 ;;
10033 esac
10034 ;;
10035esac
10036case "$i16type" in
10037'') set try -DINT16
10038 if eval $compile; then
10039 case "`./try$exe_ext`" in
10040 int16_t)
10041 i16type=int16_t
10042 u16type=uint16_t
10043 i16size=2
10044 u16size=2
10045 ;;
10046 esac
10047 fi
10048 ;;
10049esac
10050case "$i16type" in
10051'') if $test $shortsize -ge 2; then
10052 i16type=short
10053 u16type="unsigned short"
10054 i16size=$shortsize
10055 u16size=$shortsize
10056 fi
10057 ;;
10058esac
10059
10060case "$i32type" in
10061'') case "$longsize" in
10062 4) i32type=long
10063 u32type="unsigned long"
10064 i32size=$longsize
10065 u32size=$longsize
10066 ;;
10067 *) case "$intsize" in
10068 4) i32type=int
10069 u32type="unsigned int"
10070 i32size=$intsize
10071 u32size=$intsize
10072 ;;
10073 esac
10074 ;;
10075 esac
10076 ;;
10077esac
10078case "$i32type" in
10079'') set try -DINT32
10080 if eval $compile; then
10081 case "`./try$exe_ext`" in
10082 int32_t)
10083 i32type=int32_t
10084 u32type=uint32_t
10085 i32size=4
10086 u32size=4
10087 ;;
10088 esac
10089 fi
10090 ;;
10091esac
10092case "$i32type" in
10093'') if $test $intsize -ge 4; then
10094 i32type=int
10095 u32type="unsigned int"
10096 i32size=$intsize
10097 u32size=$intsize
10098 fi
10099 ;;
10100esac
10101
10102case "$i64type" in
10103'') case "$d_quad:$quadtype" in
10104 define:?*)
10105 i64type="$quadtype"
10106 u64type="$uquadtype"
10107 i64size=8
10108 u64size=8
10109 ;;
10110 esac
10111 ;;
10112esac
10113
10114$echo "Checking whether your NVs can preserve your UVs..." >&4
10115$cat <<EOP >try.c
10116#include <stdio.h>
10117int main() {
10118 $uvtype k = ($uvtype)~0, l;
10119 $nvtype d;
10120 l = k;
10121 d = ($nvtype)l;
10122 l = ($uvtype)d;
10123 if (l == k)
10124 printf("preserve\n");
10125 exit(0);
10126}
10127EOP
10128set try
10129if eval $compile; then
10130 case "`./try$exe_ext`" in
78691af5 10131 preserve) d_nv_preserves_uv="$define" ;;
cce08f5b
JH
10132 esac
10133fi
78691af5 10134case "$d_nv_preserves_uv" in
cce08f5b
JH
10135$define) $echo "Yes, they can." 2>&1 ;;
10136*) $echo "No, they can't." 2>&1
78691af5 10137 d_nv_preserves_uv="$undef"
cce08f5b
JH
10138 ;;
10139esac
10140
10141$rm -f try.* try
10142
c5f05a91
JH
10143
10144: check for off64_t
10145echo " "
10146echo "Checking to see if you have off64_t..." >&4
10147$cat >try.c <<EOCP
10148#include <sys/types.h>
10149#include <unistd.h>
10150int main() { off64_t x = 7; }
10151EOCP
10152set try
10153if eval $compile; then
10154 val="$define"
10155 echo "You have off64_t."
10156else
10157 val="$undef"
10158 echo "You do not have off64_t."
10159 case "$lseeksize" in
10160 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10161 esac
10162fi
10163$rm -f try.* try
10164set d_off64_t
10165eval $setvar
10166
c4747d3e 10167: see if POSIX threads are available
1f5ae88c
JH
10168set pthread.h i_pthread
10169eval $inhdr
10170
c4747d3e
JH
10171
10172
10173
10174: how to create joinable pthreads
10175if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
10176 echo " "
10177 echo "Checking what constant to use for creating joinable pthreads..." >&4
10178 $cat >try.c <<'EOCP'
10179#include <pthread.h>
10180int main() {
10181 int detachstate = JOINABLE;
10182}
10183EOCP
10184 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10185 if eval $compile; then
c6912327 10186 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
10187 val="$undef" # Yes, undef.
10188 set d_old_pthread_create_joinable
13666627 10189 eval $setvar
ef4af2be
JH
10190 val=""
10191 set old_pthread_create_joinable
13666627
JH
10192 eval $setvar
10193 else
10194 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10195 if eval $compile; then
c6912327 10196 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 10197 val="$define"
ef4af2be 10198 set d_old_pthread_create_joinable
13666627
JH
10199 eval $setvar
10200 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 10201 set old_pthread_create_joinable
13666627
JH
10202 eval $setvar
10203 else
10204 set try -DJOINABLE=__UNDETACHED
10205 if eval $compile; then
c6912327 10206 echo "You seem to use __UNDETACHED." >&4
13666627 10207 val="$define"
ef4af2be 10208 set d_old_pthread_create_joinable
13666627
JH
10209 eval $setvar
10210 val=__UNDETACHED
ef4af2be 10211 set old_pthread_create_joinable
13666627
JH
10212 eval $setvar
10213 else
c6912327 10214 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 10215 val="$define"
ef4af2be 10216 set d_old_pthread_create_joinable
13666627
JH
10217 eval $setvar
10218 val=0
ef4af2be 10219 set old_pthread_create_joinable
13666627
JH
10220 eval $setvar
10221 fi
10222 fi
10223 fi
10224 $rm -f try try.*
10225else
ef4af2be
JH
10226 d_old_pthread_create_joinable="$undef"
10227 old_pthread_create_joinable=""
13666627
JH
10228fi
10229
ef4af2be
JH
10230: see if pause exists
10231set pause d_pause
10232eval $inlibc
10233
10234: see if pipe exists
10235set pipe d_pipe
10236eval $inlibc
10237
10238: see if poll exists
10239set poll d_poll
10240eval $inlibc
10241
31dfa2f6
JH
10242
10243: see whether the various POSIXish _yields exist
10244$cat >try.c <<EOP
10245#include <pthread.h>
10246#include <stdio.h>
5a411a32 10247int main() {
31dfa2f6
JH
10248#ifdef SCHED_YIELD
10249 sched_yield();
10250#else
10251#ifdef PTHREAD_YIELD
10252 pthread_yield();
10253#else
10254#ifdef PTHREAD_YIELD_NULL
10255 pthread_yield(NULL);
10256#endif
10257#endif
10258#endif
10259}
10260EOP
10261: see if sched_yield exists
10262set try -DSCHED_YIELD
10263if eval $compile; then
10264 val="$define"
10265 sched_yield='sched_yield()'
10266else
10267 val="$undef"
10268fi
10269case "$usethreads" in
10270$define)
10271 case "$val" in
10272 $define) echo 'sched_yield() found.' >&4 ;;
10273 *) echo 'sched_yield() NOT found.' >&4 ;;
10274 esac
10275esac
10276set d_sched_yield
10277eval $setvar
10278
10279: see if pthread_yield exists
10280set try -DPTHREAD_YIELD
10281if eval $compile; then
10282 val="$define"
10283 case "$sched_yield" in
10284 '') sched_yield='pthread_yield()' ;;
10285 esac
10286else
10287 set try -DPTHREAD_YIELD_NULL
10288 if eval $compile; then
10289 val="$define"
10290 case "$sched_yield" in
10291 '') sched_yield='pthread_yield(NULL)' ;;
10292 esac
10293 else
10294 val="$undef"
10295 fi
10296fi
10297case "$usethreads" in
10298$define)
10299 case "$val" in
10300 $define) echo 'pthread_yield() found.' >&4 ;;
10301 *) echo 'pthread_yield() NOT found.' >&4 ;;
10302 esac
10303 ;;
10304esac
10305set d_pthread_yield
10306eval $setvar
10307
10308case "$sched_yield" in
10309'') sched_yield=undef ;;
10310esac
10311
10312$rm -f try try.*
10313
4aa0a1f7
AD
10314: see if this is a pwd.h system
10315set pwd.h i_pwd
10316eval $inhdr
10317
10318case "$i_pwd" in
10319$define)
10320 xxx=`./findhdr pwd.h`
85e6fe83 10321 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 10322
2304df62 10323 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 10324 val="$define"
2304df62 10325 else
4aa0a1f7 10326 val="$undef"
2304df62 10327 fi
4aa0a1f7
AD
10328 set d_pwquota
10329 eval $setvar
10330
2304df62 10331 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 10332 val="$define"
2304df62 10333 else
4aa0a1f7 10334 val="$undef"
2304df62 10335 fi
4aa0a1f7
AD
10336 set d_pwage
10337 eval $setvar
10338
2304df62 10339 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 10340 val="$define"
2304df62 10341 else
4aa0a1f7 10342 val="$undef"
2304df62 10343 fi
4aa0a1f7
AD
10344 set d_pwchange
10345 eval $setvar
10346
2304df62 10347 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 10348 val="$define"
2304df62 10349 else
4aa0a1f7 10350 val="$undef"
2304df62 10351 fi
4aa0a1f7
AD
10352 set d_pwclass
10353 eval $setvar
10354
2304df62 10355 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 10356 val="$define"
2304df62 10357 else
4aa0a1f7 10358 val="$undef"
2304df62 10359 fi
4aa0a1f7 10360 set d_pwexpire
cce08f5b 10361 eval $setvar
de1c2614 10362
cce08f5b
JH
10363 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10364 val="$define"
1eeb0f31 10365 else
cce08f5b 10366 val="$undef"
1eeb0f31 10367 fi
cce08f5b
JH
10368 set d_pwcomment
10369 eval $setvar
10370
10371 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10372 val="$define"
10373 else
10374 val="$undef"
10375 fi
10376 set d_pwgecos
10377 eval $setvar
10378
10379 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10380 val="$define"
10381 else
10382 val="$undef"
10383 fi
10384 set d_pwpasswd
10385 eval $setvar
10386
10387 $rm -f $$.h
10388 ;;
10389*)
10390 val="$undef";
10391 set d_pwquota; eval $setvar
10392 set d_pwage; eval $setvar
10393 set d_pwchange; eval $setvar
10394 set d_pwclass; eval $setvar
10395 set d_pwexpire; eval $setvar
10396 set d_pwcomment; eval $setvar
10397 set d_pwgecos; eval $setvar
10398 set d_pwpasswd; eval $setvar
de1c2614
JH
10399 ;;
10400esac
10401
85e6fe83 10402: see if readdir and friends exist
2304df62
AD
10403set readdir d_readdir
10404eval $inlibc
85e6fe83
LW
10405set seekdir d_seekdir
10406eval $inlibc
10407set telldir d_telldir
10408eval $inlibc
10409set rewinddir d_rewinddir
10410eval $inlibc
2304df62 10411
a0d0e21e
LW
10412: see if readlink exists
10413set readlink d_readlink
10414eval $inlibc
10415
2304df62
AD
10416: see if rename exists
10417set rename d_rename
10418eval $inlibc
10419
10420: see if rmdir exists
10421set rmdir d_rmdir
10422eval $inlibc
10423
8ff267be 10424: see if memory.h is available.
10425val=''
10426set memory.h val
10427eval $inhdr
10428
10429: See if it conflicts with string.h
10430case "$val" in
10431$define)
10432 case "$strings" in
10433 '') ;;
10434 *)
10435 $cppstdin $cppflags $cppminus < $strings > mem.h
10436 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10437 echo " "
10438 echo "We won't be including <memory.h>."
10439 val="$undef"
10440 fi
10441 $rm -f mem.h
10442 ;;
10443 esac
10444esac
10445set i_memory
10446eval $setvar
10447
2304df62
AD
10448: can bcopy handle overlapping blocks?
10449val="$undef"
10450case "$d_bcopy" in
10451"$define")
10452 echo " "
10453 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 10454 $cat >try.c <<EOCP
8ff267be 10455#$i_memory I_MEMORY
10456#$i_stdlib I_STDLIB
10457#$i_string I_STRING
10458#$i_unistd I_UNISTD
10459EOCP
dfe9444c 10460 $cat >>try.c <<'EOCP'
8ff267be 10461#include <stdio.h>
8ff267be 10462#ifdef I_MEMORY
10463# include <memory.h>
10464#endif
10465#ifdef I_STDLIB
10466# include <stdlib.h>
10467#endif
10468#ifdef I_STRING
10469# include <string.h>
10470#else
10471# include <strings.h>
10472#endif
10473#ifdef I_UNISTD
10474# include <unistd.h> /* Needed for NetBSD */
10475#endif
d674cd6d 10476int main()
2304df62 10477{
85e6fe83
LW
10478char buf[128], abc[128];
10479char *b;
10480int len;
10481int off;
10482int align;
a0d0e21e 10483
85e6fe83 10484bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
10485
10486for (align = 7; align >= 0; align--) {
10487 for (len = 36; len; len--) {
10488 b = buf+align;
85e6fe83 10489 bcopy(abc, b, len);
2304df62
AD
10490 for (off = 1; off <= len; off++) {
10491 bcopy(b, b+off, len);
10492 bcopy(b+off, b, len);
85e6fe83 10493 if (bcmp(b, abc, len))
2304df62
AD
10494 exit(1);
10495 }
10496 }
10497}
10498exit(0);
10499}
10500EOCP
dfe9444c 10501 set try
dc45a647 10502 if eval $compile_ok; then
dfe9444c 10503 if ./try 2>/dev/null; then
2304df62
AD
10504 echo "Yes, it can."
10505 val="$define"
10506 else
10507 echo "It can't, sorry."
8ff267be 10508 case "$d_memmove" in
10509 "$define") echo "But that's Ok since you have memmove()." ;;
10510 esac
2304df62
AD
10511 fi
10512 else
10513 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10514 case "$d_memmove" in
10515 "$define") echo "But that's Ok since you have memmove()." ;;
10516 esac
2304df62
AD
10517 fi
10518 ;;
10519esac
dfe9444c 10520$rm -f try.* try core
2304df62
AD
10521set d_safebcpy
10522eval $setvar
10523
10524: can memcpy handle overlapping blocks?
10525val="$undef"
10526case "$d_memcpy" in
10527"$define")
10528 echo " "
10529 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 10530 $cat >try.c <<EOCP
8ff267be 10531#$i_memory I_MEMORY
10532#$i_stdlib I_STDLIB
10533#$i_string I_STRING
10534#$i_unistd I_UNISTD
10535EOCP
dfe9444c 10536 $cat >>try.c <<'EOCP'
8ff267be 10537#include <stdio.h>
8ff267be 10538#ifdef I_MEMORY
10539# include <memory.h>
10540#endif
10541#ifdef I_STDLIB
10542# include <stdlib.h>
10543#endif
10544#ifdef I_STRING
10545# include <string.h>
10546#else
10547# include <strings.h>
10548#endif
10549#ifdef I_UNISTD
10550# include <unistd.h> /* Needed for NetBSD */
10551#endif
d674cd6d 10552int main()
2304df62 10553{
85e6fe83
LW
10554char buf[128], abc[128];
10555char *b;
10556int len;
10557int off;
10558int align;
10559
8ff267be 10560/* Copy "abcde..." string to char abc[] so that gcc doesn't
10561 try to store the string in read-only memory. */
85e6fe83 10562memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
10563
10564for (align = 7; align >= 0; align--) {
10565 for (len = 36; len; len--) {
10566 b = buf+align;
232e078e 10567 memcpy(b, abc, len);
2304df62 10568 for (off = 1; off <= len; off++) {
2304df62 10569 memcpy(b+off, b, len);
232e078e 10570 memcpy(b, b+off, len);
85e6fe83 10571 if (memcmp(b, abc, len))
2304df62
AD
10572 exit(1);
10573 }
10574 }
10575}
10576exit(0);
10577}
10578EOCP
dfe9444c 10579 set try
dc45a647 10580 if eval $compile_ok; then
dfe9444c 10581 if ./try 2>/dev/null; then
2304df62
AD
10582 echo "Yes, it can."
10583 val="$define"
10584 else
10585 echo "It can't, sorry."
8ff267be 10586 case "$d_memmove" in
10587 "$define") echo "But that's Ok since you have memmove()." ;;
10588 esac
2304df62
AD
10589 fi
10590 else
10591 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 10592 case "$d_memmove" in
10593 "$define") echo "But that's Ok since you have memmove()." ;;
10594 esac
2304df62
AD
10595 fi
10596 ;;
10597esac
dfe9444c 10598$rm -f try.* try core
2304df62
AD
10599set d_safemcpy
10600eval $setvar
10601
36477c24 10602: can memcmp be trusted to compare relative magnitude?
10603val="$undef"
10604case "$d_memcmp" in
10605"$define")
10606 echo " "
dfe9444c
AD
10607 echo "Checking if your memcmp() can compare relative magnitude..." >&4
10608 $cat >try.c <<EOCP
36477c24 10609#$i_memory I_MEMORY
10610#$i_stdlib I_STDLIB
10611#$i_string I_STRING
10612#$i_unistd I_UNISTD
10613EOCP
dfe9444c 10614 $cat >>try.c <<'EOCP'
36477c24 10615#include <stdio.h>
36477c24 10616#ifdef I_MEMORY
10617# include <memory.h>
10618#endif
10619#ifdef I_STDLIB
10620# include <stdlib.h>
10621#endif
10622#ifdef I_STRING
10623# include <string.h>
10624#else
10625# include <strings.h>
10626#endif
10627#ifdef I_UNISTD
10628# include <unistd.h> /* Needed for NetBSD */
10629#endif
d674cd6d 10630int main()
36477c24 10631{
10632char a = -1;
10633char b = 0;
10634if ((a < b) && memcmp(&a, &b, 1) < 0)
10635 exit(1);
10636exit(0);
10637}
10638EOCP
dfe9444c 10639 set try
dc45a647 10640 if eval $compile_ok; then
dfe9444c 10641 if ./try 2>/dev/null; then
36477c24 10642 echo "Yes, it can."
10643 val="$define"
10644 else
10645 echo "No, it can't (it uses signed chars)."
10646 fi
10647 else
10648 echo "(I can't compile the test program, so we'll assume not...)"
10649 fi
10650 ;;
10651esac
dfe9444c 10652$rm -f try.* try core
36477c24 10653set d_sanemcmp
10654eval $setvar
10655
2304df62
AD
10656: see if select exists
10657set select d_select
10658eval $inlibc
10659
10660: see if semctl exists
10661set semctl d_semctl
10662eval $inlibc
10663
10664: see if semget exists
10665set semget d_semget
10666eval $inlibc
10667
10668: see if semop exists
10669set semop d_semop
10670eval $inlibc
10671
10672: see how much of the 'sem*(2)' library is present.
10673h_sem=true
10674echo " "
10675case "$d_semctl$d_semget$d_semop" in
10676*"$undef"*) h_sem=false;;
10677esac
6087ac44
JH
10678case "$osname" in
10679freebsd)
10680 case "`ipcs 2>&1`" in
10681 "SVID messages"*"not configured"*)
5ff3f7a4 10682 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
10683 h_sem=false
10684 val="$undef"
10685 set semctl d_semctl
10686 eval $setvar
10687 set semget d_semget
10688 eval $setvar
10689 set semop d_semop
10690 eval $setvar
10691 ;;
10692 esac
10693 ;;
10694esac
2304df62
AD
10695: we could also check for sys/ipc.h ...
10696if $h_sem && $test `./findhdr sys/sem.h`; then
10697 echo "You have the full sem*(2) library." >&4
10698 val="$define"
10699else
10700 echo "You don't have the full sem*(2) library." >&4
10701 val="$undef"
10702fi
10703set d_sem
10704eval $setvar
10705
bd89102f
AD
10706: see whether sys/sem.h defines union semun
10707echo " "
10708$cat > try.c <<'END'
10709#include <sys/types.h>
10710#include <sys/ipc.h>
10711#include <sys/sem.h>
10712int main () { union semun semun; semun.buf = 0; }
10713END
10714set try
10715if eval $compile; then
10716 echo "You have union semun in <sys/sem.h>." >&4
10717 val="$define"
10718else
10719 echo "You do not have union semun in <sys/sem.h>." >&4
10720 val="$undef"
10721fi
85ab1d1d 10722$rm -f try try.c try.h
bd89102f
AD
10723set d_union_semun
10724eval $setvar
10725
10726: see how to do semctl IPC_STAT
10727case "$d_sem" in
10728$define)
10729 : see whether semctl IPC_STAT can use union semun
10730 echo " "
85ab1d1d
JH
10731 $cat > try.h <<END
10732#ifndef S_IRUSR
10733# ifdef S_IREAD
10734# define S_IRUSR S_IREAD
10735# define S_IWUSR S_IWRITE
10736# define S_IXUSR S_IEXEC
10737# else
10738# define S_IRUSR 0400
10739# define S_IWUSR 0200
10740# define S_IXUSR 0100
10741# endif
10742# define S_IRGRP (S_IRUSR>>3)
10743# define S_IWGRP (S_IWUSR>>3)
10744# define S_IXGRP (S_IXUSR>>3)
10745# define S_IROTH (S_IRUSR>>6)
10746# define S_IWOTH (S_IWUSR>>6)
10747# define S_IXOTH (S_IXUSR>>6)
10748#endif
10749#ifndef S_IRWXU
10750# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10751# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10752# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10753#endif
10754END
10755
bd89102f
AD
10756 $cat > try.c <<END
10757#include <sys/types.h>
10758#include <sys/ipc.h>
10759#include <sys/sem.h>
10760#include <sys/stat.h>
10761#include <stdio.h>
10762#include <errno.h>
85ab1d1d 10763#include "try.h"
bd89102f
AD
10764#ifndef errno
10765extern int errno;
10766#endif
10767#$d_union_semun HAS_UNION_SEMUN
10768int main() {
10769 union semun
10770#ifndef HAS_UNION_SEMUN
10771 {
10772 int val;
10773 struct semid_ds *buf;
10774 unsigned short *array;
10775 }
10776#endif
10777 arg;
10778 int sem, st;
10779
10780#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10781 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10782 if (sem > -1) {
10783 struct semid_ds argbuf;
10784 arg.buf = &argbuf;
10785# ifdef IPC_STAT
10786 st = semctl(sem, 0, IPC_STAT, arg);
10787 if (st == 0)
10788 printf("semun\n");
10789 else
10790# endif /* IPC_STAT */
10791 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10792# ifdef IPC_RMID
10793 if (semctl(sem, 0, IPC_RMID, arg) != 0)
10794# endif /* IPC_RMID */
10795 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10796 } else
10797#endif /* IPC_PRIVATE && ... */
10798 printf("semget failed: errno = %d\n", errno);
10799 return 0;
10800}
10801END
10802 val="$undef"
10803 set try
10804 if eval $compile; then
10805 xxx=`./try`
10806 case "$xxx" in
10807 semun) val="$define" ;;
10808 esac
10809 fi
10810 $rm -f try try.c
10811 set d_semctl_semun
10812 eval $setvar
10813 case "$d_semctl_semun" in
10814 $define)
10815 echo "You can use union semun for semctl IPC_STAT." >&4
10816 also='also'
10817 ;;
10818 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
10819 also=''
10820 ;;
10821 esac
10822
10823 : see whether semctl IPC_STAT can use struct semid_ds pointer
10824 $cat > try.c <<'END'
10825#include <sys/types.h>
10826#include <sys/ipc.h>
10827#include <sys/sem.h>
10828#include <sys/stat.h>
85ab1d1d 10829#include "try.h"
bd89102f
AD
10830#include <stdio.h>
10831#include <errno.h>
10832#ifndef errno
10833extern int errno;
10834#endif
10835int main() {
10836 struct semid_ds arg;
10837 int sem, st;
10838
10839#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10840 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10841 if (sem > -1) {
10842# ifdef IPC_STAT
10843 st = semctl(sem, 0, IPC_STAT, &arg);
10844 if (st == 0)
10845 printf("semid_ds\n");
10846 else
10847# endif /* IPC_STAT */
10848 printf("semctl IPC_STAT failed: errno = %d\n", errno);
10849# ifdef IPC_RMID
10850 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10851# endif /* IPC_RMID */
10852 printf("semctl IPC_RMID failed: errno = %d\n", errno);
10853 } else
10854#endif /* IPC_PRIVATE && ... */
10855 printf("semget failed: errno = %d\n", errno);
10856
10857 return 0;
10858}
10859END
10860 val="$undef"
10861 set try
10862 if eval $compile; then
10863 xxx=`./try`
10864 case "$xxx" in
10865 semid_ds) val="$define" ;;
10866 esac
10867 fi
10868 $rm -f try try.c
10869 set d_semctl_semid_ds
10870 eval $setvar
10871 case "$d_semctl_semid_ds" in
10872 $define)
7f3d1cf1 10873 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 10874 ;;
7f3d1cf1 10875 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
10876 ;;
10877 esac
85ab1d1d 10878 $rm -f try.h
bd89102f
AD
10879 ;;
10880*) val="$undef"
10881
10882 # We do not have the full sem*(2) library, so assume we can not
10883 # use either.
10884
10885 set d_semctl_semun
10886 eval $setvar
10887
10888 set d_semctl_semid_ds
10889 eval $setvar
10890 ;;
10891esac
10892
2304df62
AD
10893: see if setegid exists
10894set setegid d_setegid
10895eval $inlibc
10896
10897: see if seteuid exists
10898set seteuid d_seteuid
10899eval $inlibc
10900
5ff3f7a4
GS
10901: see if setgrent exists
10902set setgrent d_setgrent
10903eval $inlibc
10904
693762b4
AD
10905: see if sethostent exists
10906set sethostent d_sethent
10907eval $inlibc
10908
a0d0e21e
LW
10909: see if setlinebuf exists
10910set setlinebuf d_setlinebuf
10911eval $inlibc
10912
2304df62
AD
10913: see if setlocale exists
10914set setlocale d_setlocale
10915eval $inlibc
a0d0e21e 10916
e5c9fcd0
AD
10917: see if setnetent exists
10918set setnetent d_setnent
10919eval $inlibc
10920
10921: see if setprotoent exists
10922set setprotoent d_setpent
10923eval $inlibc
10924
2304df62
AD
10925: see if setpgid exists
10926set setpgid d_setpgid
10927eval $inlibc
10928
2304df62
AD
10929: see if setpgrp2 exists
10930set setpgrp2 d_setpgrp2
10931eval $inlibc
10932
10933: see if setpriority exists
10934set setpriority d_setprior
10935eval $inlibc
10936
5ff3f7a4
GS
10937: see if setpwent exists
10938set setpwent d_setpwent
10939eval $inlibc
10940
2304df62
AD
10941: see if setregid exists
10942set setregid d_setregid
10943eval $inlibc
10944set setresgid d_setresgid
10945eval $inlibc
10946
10947: see if setreuid exists
10948set setreuid d_setreuid
10949eval $inlibc
10950set setresuid d_setresuid
10951eval $inlibc
10952
10953: see if setrgid exists
10954set setrgid d_setrgid
10955eval $inlibc
10956
10957: see if setruid exists
10958set setruid d_setruid
10959eval $inlibc
10960
e5c9fcd0
AD
10961: see if setservent exists
10962set setservent d_setsent
10963eval $inlibc
10964
2304df62
AD
10965: see if setsid exists
10966set setsid d_setsid
10967eval $inlibc
10968
f1066039
JH
10969: see if setspent exists
10970set setspent d_setspent
10971eval $inlibc
10972
e5c9fcd0
AD
10973: see if setvbuf exists
10974set setvbuf d_setvbuf
10975eval $inlibc
10976
760ac839
LW
10977: see if sfio.h is available
10978set sfio.h i_sfio
10979eval $inhdr
10980
10981
8ff267be 10982: see if sfio library is available
760ac839
LW
10983case "$i_sfio" in
10984$define)
10985 val=''
10986 set sfreserve val
10987 eval $inlibc
10988 ;;
10989*)
10990 val="$undef"
10991 ;;
10992esac
8ff267be 10993: Ok, but do we want to use it.
760ac839
LW
10994case "$val" in
10995$define)
10996 case "$usesfio" in
8ff267be 10997 true|$define|[yY]*) dflt='y';;
760ac839
LW
10998 *) dflt='n';;
10999 esac
8ff267be 11000 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
11001 rp="You seem to have sfio available, do you want to try using it?"
11002 . ./myread
11003 case "$ans" in
8ff267be 11004 y|Y) ;;
11005 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 11006 val="$undef"
ff0cee69 11007 : Remove sfio from list of libraries to use
11008 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11009 shift
11010 libs="$*"
11011 echo "libs = $libs" >&4
760ac839
LW
11012 ;;
11013 esac
11014 ;;
8ff267be 11015*) case "$usesfio" in
11016 true|$define|[yY]*)
11017 echo "Sorry, cannot find sfio on this machine" >&4
11018 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
11019 ;;
11020 esac
11021 ;;
11022esac
8ff267be 11023set d_sfio
11024eval $setvar
760ac839
LW
11025case "$d_sfio" in
11026$define) usesfio='true';;
11027*) usesfio='false';;
11028esac
11029
2304df62
AD
11030: see if shmctl exists
11031set shmctl d_shmctl
11032eval $inlibc
11033
11034: see if shmget exists
11035set shmget d_shmget
11036eval $inlibc
11037
a0d0e21e
LW
11038: see if shmat exists
11039set shmat d_shmat
11040eval $inlibc
11041: see what shmat returns
11042case "$d_shmat" in
11043"$define")
11044 $cat >shmat.c <<'END'
11045#include <sys/shm.h>
11046void *shmat();
11047END
11048 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11049 shmattype='void *'
11050 else
11051 shmattype='char *'
11052 fi
11053 echo "and it returns ($shmattype)." >&4
11054 : see if a prototype for shmat is available
e50aee73
AD
11055 xxx=`./findhdr sys/shm.h`
11056 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
11057 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11058 val="$define"
11059 else
11060 val="$undef"
11061 fi
11062 $rm -f shmat.[co]
11063 ;;
11064*)
11065 val="$undef"
11066 ;;
11067esac
11068set d_shmatprototype
11069eval $setvar
11070
11071: see if shmdt exists
11072set shmdt d_shmdt
11073eval $inlibc
11074
11075: see how much of the 'shm*(2)' library is present.
11076h_shm=true
11077echo " "
11078case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11079*"$undef"*) h_shm=false;;
11080esac
6087ac44
JH
11081case "$osname" in
11082freebsd)
11083 case "`ipcs 2>&1`" in
11084 "SVID shared memory"*"not configured"*)
5ff3f7a4 11085 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
11086 h_shm=false
11087 val="$undef"
11088 set shmctl d_shmctl
11089 evat $setvar
11090 set shmget d_shmget
11091 evat $setvar
11092 set shmat d_shmat
11093 evat $setvar
11094 set shmdt d_shmdt
11095 evat $setvar
11096 ;;
11097 esac
11098 ;;
11099esac
a0d0e21e
LW
11100: we could also check for sys/ipc.h ...
11101if $h_shm && $test `./findhdr sys/shm.h`; then
11102 echo "You have the full shm*(2) library." >&4
11103 val="$define"
11104else
11105 echo "You don't have the full shm*(2) library." >&4
11106 val="$undef"
11107fi
11108set d_shm
11109eval $setvar
11110
2c7991dc 11111echo " "
8ff267be 11112: see if we have sigaction
11113if set sigaction val -f d_sigaction; eval $csym; $val; then
11114 echo 'sigaction() found.' >&4
dc45a647 11115 $cat > try.c <<'EOP'
8ff267be 11116#include <stdio.h>
11117#include <sys/types.h>
11118#include <signal.h>
d674cd6d 11119int main()
8ff267be 11120{
11121 struct sigaction act, oact;
190b66db 11122 act.sa_flags = 0;
48159a0c 11123 oact.sa_handler = 0;
14e4fe40
JH
11124 /* so that act and oact are used */
11125 exit(act.sa_flags == 0 && oact.sa_handler == 0);
8ff267be 11126}
11127EOP
dc45a647
MB
11128 set try
11129 if eval $compile_ok; then
11130 val="$define"
11131 else
11132 echo "But you don't seem to have a useable struct sigaction." >&4
11133 val="$undef"
11134 fi
8ff267be 11135else
dc45a647 11136 echo 'sigaction NOT found.' >&4
8ff267be 11137 val="$undef"
11138fi
11139set d_sigaction; eval $setvar
dfe9444c 11140$rm -f try try$_o try.c
2c7991dc 11141
a5f75d66
AD
11142: see if sigsetjmp exists
11143echo " "
921b2963
JH
11144case "$d_sigsetjmp" in
11145'')
11146 $cat >try.c <<'EOP'
11147#include <setjmp.h>
11148sigjmp_buf env;
11149int set = 1;
d674cd6d 11150int main()
921b2963
JH
11151{
11152 if (sigsetjmp(env,1))
11153 exit(set);
11154 set = 0;
11155 siglongjmp(env, 1);
11156 exit(1);
11157}
11158EOP
11159 set try
11160 if eval $compile; then
11161 if ./try >/dev/null 2>&1; then
11162 echo "POSIX sigsetjmp found." >&4
11163 val="$define"
11164 else
11165 $cat >&4 <<EOM
11166Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11167I'll ignore them.
11168EOM
11169 val="$undef"
a0d0e21e 11170 fi
921b2963
JH
11171 else
11172 echo "sigsetjmp not found." >&4
11173 val="$undef"
a0d0e21e 11174 fi
921b2963
JH
11175 ;;
11176*) val="$d_sigsetjmp"
11177 case "$d_sigsetjmp" in
11178 $define) echo "POSIX sigsetjmp found." >&4;;
11179 $undef) echo "sigsetjmp not found." >&4;;
11180 esac
11181 ;;
11182esac
11183set d_sigsetjmp
11184eval $setvar
11185$rm -f try.c try
2304df62 11186
d9b3e12d
JH
11187: see if sys/stat.h is available
11188set sys/stat.h i_sysstat
11189eval $inhdr
11190
b7b35fc2 11191
2304df62
AD
11192: see if stat knows about block sizes
11193echo " "
b7b35fc2 11194echo "Checking to see if your struct stat has st_blocks field..." >&4
5ff3f7a4
GS
11195set d_statblks stat st_blocks $i_sysstat sys/stat.h
11196eval $hasfield
2304df62 11197
b7b35fc2 11198
ad27e871
JH
11199: see if this is a sys/vfs.h system
11200set sys/vfs.h i_sysvfs
11201eval $inhdr
11202
b7b35fc2 11203
ad27e871
JH
11204: see if this is a sys/statfs.h system
11205set sys/statfs.h i_sysstatfs
11206eval $inhdr
11207
11208
11209echo " "
8175356b 11210echo "Checking to see if your system supports struct statfs..." >&4
ad27e871
JH
11211set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
11212eval $hasstruct
11213case "$d_statfs_s" in
a22e52b9
JH
11214"$define") echo "Yes, it does." ;;
11215*) echo "No, it doesn't." ;;
ad27e871
JH
11216esac
11217
11218
11219
11220: see if struct statfs knows about f_flags
11221case "$d_statfs_s" in
11222define)
11223 echo " "
8175356b 11224 echo "Checking to see if your struct statfs has f_flags field..." >&4
ad27e871
JH
11225 set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
11226 eval $hasfield
11227 ;;
11228*) val="$undef"
11229 set d_statfs_f_flags
11230 eval $setvar
11231 ;;
11232esac
11233case "$d_statfs_f_flags" in
a22e52b9
JH
11234"$define") echo "Yes, it does." ;;
11235*) echo "No, it doesn't." ;;
ad27e871
JH
11236esac
11237
16d20bd9
AD
11238: see if _ptr and _cnt from stdio act std
11239echo " "
dca663ed 11240if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
16d20bd9
AD
11241 echo "(Looks like you have stdio.h from Linux.)"
11242 case "$stdio_ptr" in
c2960299
AD
11243 '') stdio_ptr='((fp)->_IO_read_ptr)'
11244 ptr_lval=$define
11245 ;;
8e07c86e 11246 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
11247 esac
11248 case "$stdio_cnt" in
c2960299
AD
11249 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11250 cnt_lval=$undef
11251 ;;
8e07c86e 11252 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
11253 esac
11254 case "$stdio_base" in
11255 '') stdio_base='((fp)->_IO_read_base)';;
11256 esac
11257 case "$stdio_bufsiz" in
c2960299 11258 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
11259 esac
11260else
11261 case "$stdio_ptr" in
c2960299
AD
11262 '') stdio_ptr='((fp)->_ptr)'
11263 ptr_lval=$define
11264 ;;
8e07c86e 11265 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
11266 esac
11267 case "$stdio_cnt" in
c2960299
AD
11268 '') stdio_cnt='((fp)->_cnt)'
11269 cnt_lval=$define
11270 ;;
8e07c86e 11271 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
11272 esac
11273 case "$stdio_base" in
11274 '') stdio_base='((fp)->_base)';;
11275 esac
11276 case "$stdio_bufsiz" in
11277 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11278 esac
11279fi
11280: test whether _ptr and _cnt really work
11281echo "Checking how std your stdio is..." >&4
11282$cat >try.c <<EOP
11283#include <stdio.h>
11284#define FILE_ptr(fp) $stdio_ptr
11285#define FILE_cnt(fp) $stdio_cnt
d674cd6d 11286int main() {
16d20bd9
AD
11287 FILE *fp = fopen("try.c", "r");
11288 char c = getc(fp);
11289 if (
11290 18 <= FILE_cnt(fp) &&
11291 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11292 )
11293 exit(0);
11294 exit(1);
11295}
11296EOP
11297val="$undef"
dfe9444c
AD
11298set try
11299if eval $compile; then
16d20bd9
AD
11300 if ./try; then
11301 echo "Your stdio acts pretty std."
11302 val="$define"
11303 else
11304 echo "Your stdio isn't very std."
11305 fi
11306else
11307 echo "Your stdio doesn't appear very std."
11308fi
11309$rm -f try.c try
11310set d_stdstdio
11311eval $setvar
11312
8e07c86e 11313: Can _ptr be used as an lvalue?
e50aee73
AD
11314case "$d_stdstdio$ptr_lval" in
11315$define$define) val=$define ;;
c2960299
AD
11316*) val=$undef ;;
11317esac
11318set d_stdio_ptr_lval
11319eval $setvar
11320
8e07c86e 11321: Can _cnt be used as an lvalue?
e50aee73
AD
11322case "$d_stdstdio$cnt_lval" in
11323$define$define) val=$define ;;
c2960299
AD
11324*) val=$undef ;;
11325esac
11326set d_stdio_cnt_lval
11327eval $setvar
11328
16d20bd9
AD
11329: see if _base is also standard
11330val="$undef"
11331case "$d_stdstdio" in
11332$define)
11333 $cat >try.c <<EOP
11334#include <stdio.h>
11335#define FILE_base(fp) $stdio_base
11336#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 11337int main() {
16d20bd9
AD
11338 FILE *fp = fopen("try.c", "r");
11339 char c = getc(fp);
11340 if (
11341 19 <= FILE_bufsiz(fp) &&
11342 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11343 )
11344 exit(0);
11345 exit(1);
11346}
11347EOP
dfe9444c
AD
11348 set try
11349 if eval $compile; then
16d20bd9 11350 if ./try; then
8ff267be 11351 echo "And its _base field acts std."
16d20bd9
AD
11352 val="$define"
11353 else
11354 echo "But its _base field isn't std."
11355 fi
11356 else
11357 echo "However, it seems to be lacking the _base field."
11358 fi
11359 $rm -f try.c try
11360 ;;
11361esac
11362set d_stdiobase
11363eval $setvar
11364
ed39a0f2
JH
11365$cat >&4 <<EOM
11366Checking how to access stdio streams by file descriptor number...
11367EOM
11368case "$stdio_stream_array" in
11369'') $cat >try.c <<EOCP
11370#include <stdio.h>
11371int main() {
11372 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11373 printf("yes\n");
11374}
11375EOCP
11376 for s in _iob __iob __sF
11377 do
11378 set try -DSTDIO_STREAM_ARRAY=$s
11379 if eval $compile; then
11380 case "`./try$exe_ext`" in
11381 yes) stdio_stream_array=$s; break ;;
11382 esac
11383 fi
11384 done
11385 $rm -f try.* try$exe_ext
11386esac
11387case "$stdio_stream_array" in
11388'') $cat >&4 <<EOM
11389I can't figure out how to access stdio streams by file descriptor number.
11390EOM
11391 d_stdio_stream_array="$undef"
11392 ;;
11393*) $cat >&4 <<EOM
11394You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11395EOM
11396 d_stdio_stream_array="$define"
11397 ;;
11398esac
11399
a0d0e21e
LW
11400: see if strcoll exists
11401set strcoll d_strcoll
11402eval $inlibc
2304df62
AD
11403
11404: check for structure copying
11405echo " "
11406echo "Checking to see if your C compiler can copy structs..." >&4
11407$cat >try.c <<'EOCP'
5a411a32 11408int main()
2304df62
AD
11409{
11410 struct blurfl {
11411 int dyick;
11412 } foo, bar;
11413
11414 foo = bar;
11415}
11416EOCP
11417if $cc -c try.c >/dev/null 2>&1 ; then
11418 val="$define"
11419 echo "Yup, it can."
11420else
11421 val="$undef"
11422 echo "Nope, it can't."
11423fi
11424set d_strctcpy
11425eval $setvar
11426$rm -f try.*
11427
11428: see if strerror and/or sys_errlist[] exist
11429echo " "
28e8609d
JH
11430if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11431 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
11432 echo 'strerror() found.' >&4
11433 d_strerror="$define"
11434 d_strerrm='strerror(e)'
11435 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11436 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
11437 d_syserrlst="$define"
11438 else
11439 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11440 d_syserrlst="$undef"
11441 fi
28e8609d 11442 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
11443 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11444 echo 'strerror() found in string header.' >&4
11445 d_strerror="$define"
11446 d_strerrm='strerror(e)'
11447 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11448 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11449 d_syserrlst="$define"
11450 else
11451 echo "(You don't appear to have any sys_errlist[], how can this be?)"
11452 d_syserrlst="$undef"
11453 fi
28e8609d 11454 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
11455 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11456 d_strerror="$undef"
11457 d_syserrlst="$define"
11458 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 11459 else
5ff3f7a4
GS
11460 echo 'strerror() and sys_errlist[] NOT found.' >&4
11461 d_strerror="$undef"
11462 d_syserrlst="$undef"
11463 d_strerrm='"unknown"'
28e8609d 11464 fi
2304df62
AD
11465fi
11466
a89d8a78
DH
11467: see if strtod exists
11468set strtod d_strtod
11469eval $inlibc
11470
11471: see if strtol exists
11472set strtol d_strtol
11473eval $inlibc
11474
ff935051
JH
11475: see if strtold exists
11476set strtold d_strtold
11477eval $inlibc
11478
76d49b1c
JH
11479: see if strtoll exists
11480set strtoll d_strtoll
11481eval $inlibc
11482
358a0a84
JH
11483case "$d_longlong-$d_strtoll" in
11484"$define-$define")
11485 $cat <<EOM
11486Checking whether your strtoll() works okay...
11487EOM
11488 $cat >try.c <<'EOCP'
11489#include <errno.h>
11490#ifdef __hpux
11491#define strtoll __strtoll
11492#endif
11493#include <stdio.h>
11494extern long long int strtoll(char *s, char **, int);
11495static int bad = 0;
11496int check(char *s, long long ell, int een) {
11497 long long gll;
11498 errno = 0;
11499 gll = strtoll(s, 0, 10);
11500 if (!((gll == ell) && (errno == een)))
11501 bad++;
11502}
11503int main() {
11504 check(" 1", 1LL, 0);
11505 check(" 0", 0LL, 0);
11506 check("-1", -1LL, 0);
11507 check("-9223372036854775808", -9223372036854775808LL, 0);
11508 check("-9223372036854775808", -9223372036854775808LL, 0);
11509 check(" 9223372036854775807", 9223372036854775807LL, 0);
11510 check("-9223372036854775808", -9223372036854775808LL, 0);
11511 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
11512 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11513 if (!bad)
11514 printf("ok\n");
11515}
11516EOCP
11517 set try
11518 if eval $compile; then
11519 case "`./try`" in
11520 ok) echo "Your strtoll() seems to be working okay." ;;
11521 *) cat <<EOM >&4
11522Your strtoll() doesn't seem to be working okay.
11523EOM
11524 d_strtoll="$undef"
11525 ;;
11526 esac
11527 fi
11528 ;;
11529esac
11530
a89d8a78
DH
11531: see if strtoul exists
11532set strtoul d_strtoul
11533eval $inlibc
11534
cf2093f6
JH
11535: see if strtoull exists
11536set strtoull d_strtoull
11537eval $inlibc
11538
358a0a84
JH
11539case "$d_longlong-$d_strtoull" in
11540"$define-$define")
11541 $cat <<EOM
11542Checking whether your strtoull() works okay...
11543EOM
11544 $cat >try.c <<'EOCP'
11545#include <errno.h>
11546#ifdef __hpux
11547#define strtoull __strtoull
11548#endif
11549#include <stdio.h>
11550extern unsigned long long int strtoull(char *s, char **, int);
11551static int bad = 0;
11552int check(char *s, long long eull, int een) {
11553 long long gull;
11554 errno = 0;
11555 gull = strtoull(s, 0, 10);
11556 if (!((gull == eull) && (errno == een)))
11557 bad++;
11558}
11559int main() {
11560 check(" 1", 1LL, 0);
11561 check(" 0", 0LL, 0);
11562 check("18446744073709551615", 18446744073709551615ULL, 0);
11563 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11564 if (!bad)
11565 printf("ok\n");
11566}
11567EOCP
11568 set try
11569 if eval $compile; then
11570 case "`./try`" in
11571 ok) echo "Your strtoull() seems to be working okay." ;;
11572 *) cat <<EOM >&4
11573Your strtoull() doesn't seem to be working okay.
11574EOM
11575 d_strtoull="$undef"
11576 ;;
11577 esac
11578 fi
11579 ;;
11580esac
11581
ff935051
JH
11582: see if strtouq exists
11583set strtouq d_strtouq
11584eval $inlibc
11585
a0d0e21e
LW
11586: see if strxfrm exists
11587set strxfrm d_strxfrm
11588eval $inlibc
11589
8175356b
JH
11590: see if symlink exists
11591set symlink d_symlink
11592eval $inlibc
11593
11594: see if syscall exists
11595set syscall d_syscall
11596eval $inlibc
11597
11598: see if sysconf exists
11599set sysconf d_sysconf
11600eval $inlibc
11601
11602: see if system exists
11603set system d_system
11604eval $inlibc
11605
11606: see if tcgetpgrp exists
11607set tcgetpgrp d_tcgetpgrp
11608eval $inlibc
11609
11610: see if tcsetpgrp exists
11611set tcsetpgrp d_tcsetpgrp
11612eval $inlibc
11613
11614: see if prototype for telldir is available
11615echo " "
11616set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11617eval $hasproto
dc45a647 11618
2c7991dc 11619: see if this is a sys/times.h system
11620set sys/times.h i_systimes
11621eval $inhdr
4633a7c4 11622
2c7991dc 11623: see if times exists
4633a7c4 11624echo " "
2c7991dc 11625if set times val -f d_times; eval $csym; $val; then
11626 echo 'times() found.' >&4
11627 d_times="$define"
11628 inc=''
11629 case "$i_systimes" in
11630 "$define") inc='sys/times.h';;
11631 esac
dc45a647 11632 rp="What is the type returned by times() on this system?"
2c7991dc 11633 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 11634 eval $typedef_ask
2c7991dc 11635else
11636 echo 'times() NOT found, hope that will do.' >&4
11637 d_times="$undef"
11638 clocktype='int'
11639fi
2304df62 11640
2c7991dc 11641: see if truncate exists
11642set truncate d_truncate
11643eval $inlibc
2304df62 11644
2c7991dc 11645: see if tzname[] exists
11646echo " "
11647if set tzname val -a d_tzname; eval $csym; $val; then
11648 val="$define"
11649 echo 'tzname[] found.' >&4
11650else
11651 val="$undef"
11652 echo 'tzname[] NOT found.' >&4
11653fi
11654set d_tzname
11655eval $setvar
11656
11657: see if umask exists
11658set umask d_umask
11659eval $inlibc
85e6fe83 11660
0545a864
JH
11661: see if ustat exists
11662set ustat d_ustat
11663eval $inlibc
11664
4633a7c4
LW
11665: backward compatibility for d_hvfork
11666if test X$d_hvfork != X; then
11667 d_vfork="$d_hvfork"
11668 d_hvfork=''
11669fi
11670: see if there is a vfork
11671val=''
11672set vfork val
11673eval $inlibc
ecfc5424 11674
4633a7c4
LW
11675: Ok, but do we want to use it. vfork is reportedly unreliable in
11676: perl on Solaris 2.x, and probably elsewhere.
11677case "$val" in
11678$define)
16d20bd9 11679 echo " "
4633a7c4
LW
11680 case "$usevfork" in
11681 false) dflt='n';;
11682 *) dflt='y';;
11683 esac
f10488a3
JH
11684 cat <<'EOM'
11685
11686Perl can only use a vfork() that doesn't suffer from strict
11687restrictions on calling functions or modifying global data in
11688the child. For example, glibc-2.1 contains such a vfork()
11689that is unsuitable. If your system provides a proper fork()
11690call, chances are that you do NOT want perl to use vfork().
11691
11692EOM
11693 rp="Do you still want to use vfork()?"
4633a7c4
LW
11694 . ./myread
11695 case "$ans" in
11696 y|Y) ;;
11697 *)
11698 echo "Ok, we won't use vfork()."
11699 val="$undef"
11700 ;;
11701 esac
ecfc5424
AD
11702 ;;
11703esac
4633a7c4
LW
11704set d_vfork
11705eval $setvar
11706case "$d_vfork" in
11707$define) usevfork='true';;
11708*) usevfork='false';;
11709esac
ecfc5424 11710
4633a7c4
LW
11711: see if this is an sysdir system
11712set sys/dir.h i_sysdir
11713eval $inhdr
11714
11715: see if this is an sysndir system
11716set sys/ndir.h i_sysndir
11717eval $inhdr
11718
11719: see if closedir exists
11720set closedir d_closedir
11721eval $inlibc
11722
11723case "$d_closedir" in
11724"$define")
16d20bd9 11725 echo " "
4633a7c4
LW
11726 echo "Checking whether closedir() returns a status..." >&4
11727 cat > closedir.c <<EOM
11728#$i_dirent I_DIRENT /**/
11729#$i_sysdir I_SYS_DIR /**/
11730#$i_sysndir I_SYS_NDIR /**/
bfb7748a 11731#$i_systypes I_SYS_TYPES /**/
4633a7c4 11732
bfb7748a
AD
11733#if defined(I_SYS_TYPES)
11734#include <sys/types.h>
11735#endif
4633a7c4
LW
11736#if defined(I_DIRENT)
11737#include <dirent.h>
11738#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11739#include <sys/dir.h>
4aa0a1f7 11740#endif
4633a7c4
LW
11741#else
11742#ifdef I_SYS_NDIR
11743#include <sys/ndir.h>
11744#else
11745#ifdef I_SYS_DIR
11746#ifdef hp9000s500
11747#include <ndir.h> /* may be wrong in the future */
11748#else
11749#include <sys/dir.h>
11750#endif
11751#endif
11752#endif
11753#endif
11754int main() { return closedir(opendir(".")); }
11755EOM
dfe9444c 11756 set closedir
dc45a647 11757 if eval $compile_ok; then
4633a7c4
LW
11758 if ./closedir > /dev/null 2>&1 ; then
11759 echo "Yes, it does."
11760 val="$undef"
ecfc5424 11761 else
4633a7c4
LW
11762 echo "No, it doesn't."
11763 val="$define"
ecfc5424
AD
11764 fi
11765 else
4633a7c4
LW
11766 echo "(I can't seem to compile the test program--assuming it doesn't)"
11767 val="$define"
ecfc5424 11768 fi
ecfc5424 11769 ;;
4633a7c4
LW
11770*)
11771 val="$undef";
ecfc5424
AD
11772 ;;
11773esac
4633a7c4
LW
11774set d_void_closedir
11775eval $setvar
11776$rm -f closedir*
11777: check for volatile keyword
ecfc5424 11778echo " "
4633a7c4
LW
11779echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11780$cat >try.c <<'EOCP'
5a411a32 11781int main()
4633a7c4
LW
11782{
11783 typedef struct _goo_struct goo_struct;
11784 goo_struct * volatile goo = ((goo_struct *)0);
11785 struct _goo_struct {
11786 long long_int;
11787 int reg_int;
11788 char char_var;
11789 };
11790 typedef unsigned short foo_t;
11791 char *volatile foo;
11792 volatile int bar;
11793 volatile foo_t blech;
11794 foo = foo;
a0d0e21e
LW
11795}
11796EOCP
4633a7c4
LW
11797if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11798 val="$define"
11799 echo "Yup, it does."
11800else
11801 val="$undef"
11802 echo "Nope, it doesn't."
11803fi
11804set d_volatile
11805eval $setvar
11806$rm -f try.*
a0d0e21e 11807
4633a7c4
LW
11808: see if there is a wait4
11809set wait4 d_wait4
8e07c86e
AD
11810eval $inlibc
11811
4633a7c4
LW
11812: see if waitpid exists
11813set waitpid d_waitpid
11814eval $inlibc
11815
11816: see if wcstombs exists
11817set wcstombs d_wcstombs
11818eval $inlibc
11819
11820: see if wctomb exists
11821set wctomb d_wctomb
11822eval $inlibc
11823
11824: preserve RCS keywords in files with variable substitution, grrr
11825Date='$Date'
11826Id='$Id'
11827Log='$Log'
11828RCSfile='$RCSfile'
11829Revision='$Revision'
11830
ca8cfa54
JH
11831case "$crosscompile" in
11832''|[nN]*) crosscompile="$undef" ;;
11833esac
11834
11835case "$osname" in
f556e5b9 11836next|rhapsody|darwin) multiarch="$define" ;;
ca8cfa54
JH
11837esac
11838case "$multiarch" in
11839''|[nN]*) multiarch="$undef" ;;
11840esac
11841
4633a7c4
LW
11842: check for alignment requirements
11843echo " "
68c15b6f
HM
11844case "$crosscompile$multiarch" in
11845*$define*)
ca8cfa54
JH
11846 $cat <<EOM
11847You seem to be either cross-compiling or doing a multiarchitecture build,
11848skipping the memory alignment check.
68c15b6f
HM
11849
11850EOM
11851 case "$alignbytes" in
11852 '') alignbytes=8 ;;
11853 esac
11854 ;;
11855*)
11856 case "$alignbytes" in
11857 '') echo "Checking alignment constraints..." >&4
87b71857
JH
11858 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11859 $cat >try.c <<'EOCP'
11860typedef long double NV;
11861EOCP
11862 else
11863 $cat >try.c <<'EOCP'
11864typedef double NV;
11865EOCP
11866 fi
11867 $cat >>try.c <<'EOCP'
14e4fe40 11868#include <stdio.h>
4633a7c4
LW
11869struct foobar {
11870 char foo;
87b71857 11871 NV bar;
732c9516 11872} try_algn;
d674cd6d 11873int main()
4633a7c4 11874{
213c275f
JH
11875 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11876 return(0);
4633a7c4
LW
11877}
11878EOCP
68c15b6f
HM
11879 set try
11880 if eval $compile_ok; then
11881 dflt=`./try`
11882 else
11883 dflt='8'
11884 echo "(I can't seem to compile the test program...)"
11885 fi
11886 ;;
11887 *) dflt="$alignbytes"
11888 ;;
11889 esac
11890 rp="Doubles must be aligned on a how-many-byte boundary?"
11891 . ./myread
11892 alignbytes="$ans"
11893 $rm -f try.c try
8e07c86e 11894 ;;
ecfc5424 11895esac
68c15b6f 11896
85e6fe83 11897
49c10eea
JH
11898: set the base revision
11899baserev=5.0
11900
4633a7c4 11901: check for ordering of bytes in a long
68c15b6f
HM
11902echo " "
11903case "$crosscompile$multiarch" in
11904*$define*)
11905 $cat <<EOM
ca8cfa54
JH
11906You seem to be either cross-compiling or doing a multiarchitecture build,
11907skipping the byteorder check.
68c15b6f
HM
11908
11909EOM
d9b3e12d 11910 byteorder='0xffff'
68c15b6f
HM
11911 ;;
11912*)
11913 case "$byteorder" in
11914 '')
11915 $cat <<'EOM'
4633a7c4
LW
11916In the following, larger digits indicate more significance. A big-endian
11917machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11918little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
d9b3e12d
JH
11919machines may have weird orders like 3412. A Cray will report 87654321,
11920an Alpha will report 12345678. If the test program works the default is
11921probably right.
4633a7c4
LW
11922I'm now running the test program...
11923EOM
68c15b6f 11924 $cat >try.c <<'EOCP'
4633a7c4 11925#include <stdio.h>
d674cd6d 11926int main()
4633a7c4
LW
11927{
11928 int i;
11929 union {
11930 unsigned long l;
11931 char c[sizeof(long)];
11932 } u;
11933
11934 if (sizeof(long) > 4)
11935 u.l = (0x08070605L << 32) | 0x04030201L;
11936 else
11937 u.l = 0x04030201L;
11938 for (i = 0; i < sizeof(long); i++)
11939 printf("%c", u.c[i]+'0');
11940 printf("\n");
11941 exit(0);
11942}
11943EOCP
68c15b6f
HM
11944 xxx_prompt=y
11945 set try
11946 if eval $compile && ./try > /dev/null; then
11947 dflt=`./try`
11948 case "$dflt" in
11949 [1-4][1-4][1-4][1-4]|12345678|87654321)
11950 echo "(The test program ran ok.)"
11951 echo "byteorder=$dflt"
11952 xxx_prompt=n
4633a7c4 11953 ;;
68c15b6f
HM
11954 ????|????????) echo "(The test program ran ok.)" ;;
11955 *) echo "(The test program didn't run right for some reason.)" ;;
11956 esac
11957 else
11958 dflt='4321'
11959 cat <<'EOM'
4633a7c4
LW
11960(I can't seem to compile the test program. Guessing big-endian...)
11961EOM
68c15b6f
HM
11962 fi
11963 case "$xxx_prompt" in
11964 y)
11965 rp="What is the order of bytes in a long?"
11966 . ./myread
11967 byteorder="$ans"
11968 ;;
11969 *) byteorder=$dflt
11970 ;;
11971 esac
ecfc5424
AD
11972 ;;
11973 esac
68c15b6f 11974 $rm -f try.c try
ecfc5424
AD
11975 ;;
11976esac
68c15b6f 11977
85e6fe83 11978
4633a7c4 11979: how do we catenate cpp tokens here?
2304df62 11980echo " "
4633a7c4
LW
11981echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11982$cat >cpp_stuff.c <<'EOCP'
11983#define RCAT(a,b)a/**/b
11984#define ACAT(a,b)a ## b
11985RCAT(Rei,ser)
11986ACAT(Cir,cus)
11987EOCP
11988$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11989if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11990 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
11991 echo "We can catify or stringify, separately or together!"
11992 cpp_stuff=42
11993elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 11994 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
11995 echo "However, in the good old days we don't know how to stringify and"
11996 echo "catify at the same time."
11997 cpp_stuff=1
11998else
11999 $cat >&4 <<EOM
12000Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
12001to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 12002EOM
4633a7c4
LW
12003 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12004fi
12005$rm -f cpp_stuff.*
a0d0e21e 12006
4633a7c4
LW
12007: see if this is a db.h system
12008set db.h i_db
12009eval $inhdr
12010
12011case "$i_db" in
68dc0745 12012$define)
1f70e1ea 12013 : Check db version.
68dc0745 12014 echo " "
12015 echo "Checking Berkeley DB version ..." >&4
12016 $cat >try.c <<EOCP
12017#$d_const HASCONST
12018#ifndef HASCONST
12019#define const
12020#endif
12021#include <sys/types.h>
12022#include <stdio.h>
12023#include <db.h>
d674cd6d 12024int main()
68dc0745 12025{
1f70e1ea
PM
12026#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12027 int Major, Minor, Patch ;
ee02776e 12028 unsigned long Version ;
1f70e1ea
PM
12029 (void)db_version(&Major, &Minor, &Patch) ;
12030 printf("You have Berkeley DB Version 2 or greater\n");
12031
12032 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12033 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12034 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12035 Major, Minor, Patch) ;
12036
12037 /* check that db.h & libdb are compatible */
12038 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12039 printf("db.h and libdb are incompatible\n") ;
12040 exit(3);
12041 }
12042
12043 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
12044
12045 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 12046 + DB_VERSION_PATCH ;
ee02776e
PM
12047
12048 /* needs to be >= 2.3.4 */
12049 if (Version < 2003004) {
693762b4 12050 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 12051 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
12052 exit(2);
12053 }
12054
12055 exit(0);
68dc0745 12056#else
6a1b87e5 12057#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 12058 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
12059 exit(0); /* DB version < 2: the coast is clear. */
12060#else
12061 exit(1); /* <db.h> not Berkeley DB? */
12062#endif
68dc0745 12063#endif
12064}
12065EOCP
dfe9444c 12066 set try
cf21f3c6 12067 if eval $compile_ok && ./try; then
1f70e1ea 12068 echo 'Looks OK.' >&4
68dc0745 12069 else
c90c0ff4 12070 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 12071 i_db=$undef
12072 case " $libs " in
12073 *"-ldb "*)
12074 : Remove db from list of libraries to use
12075 echo "Removing unusable -ldb from library list" >&4
12076 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12077 shift
12078 libs="$*"
12079 echo "libs = $libs" >&4
12080 ;;
12081 esac
12082 fi
12083 $rm -f try.*
12084 ;;
12085esac
12086
12087case "$i_db" in
4633a7c4 12088define)
dc45a647
MB
12089 : Check the return type needed for hash
12090 echo " "
12091 echo "Checking return type needed for hash for Berkeley DB ..." >&4
12092 $cat >try.c <<EOCP
12093#$d_const HASCONST
12094#ifndef HASCONST
12095#define const
12096#endif
12097#include <sys/types.h>
12098#include <db.h>
12099
12100#ifndef DB_VERSION_MAJOR
12101u_int32_t hash_cb (ptr, size)
12102const void *ptr;
12103size_t size;
12104{
12105}
12106HASHINFO info;
d674cd6d 12107int main()
dc45a647
MB
12108{
12109 info.hash = hash_cb;
12110}
12111#endif
12112EOCP
12113 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12114 if $contains warning try.out >>/dev/null 2>&1 ; then
12115 db_hashtype='int'
12116 else
12117 db_hashtype='u_int32_t'
12118 fi
12119 else
12120 : XXX Maybe we should just give up here.
12121 db_hashtype=u_int32_t
12122 $cat try.out >&4
12123 echo "Help: I can't seem to compile the db test program." >&4
12124 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12125 fi
12126 $rm -f try.*
12127 echo "Your version of Berkeley DB uses $db_hashtype for hash."
12128 ;;
12129*) db_hashtype=u_int32_t
12130 ;;
12131esac
12132case "$i_db" in
12133define)
4633a7c4
LW
12134 : Check the return type needed for prefix
12135 echo " "
12136 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12137 cat >try.c <<EOCP
12138#$d_const HASCONST
12139#ifndef HASCONST
12140#define const
12141#endif
12142#include <sys/types.h>
12143#include <db.h>
1f70e1ea
PM
12144
12145#ifndef DB_VERSION_MAJOR
4633a7c4
LW
12146size_t prefix_cb (key1, key2)
12147const DBT *key1;
12148const DBT *key2;
12149{
12150}
12151BTREEINFO info;
d674cd6d 12152int main()
4633a7c4
LW
12153{
12154 info.prefix = prefix_cb;
12155}
1f70e1ea 12156#endif
4633a7c4
LW
12157EOCP
12158 if $cc $ccflags -c try.c >try.out 2>&1 ; then
12159 if $contains warning try.out >>/dev/null 2>&1 ; then
12160 db_prefixtype='int'
12161 else
12162 db_prefixtype='size_t'
12163 fi
12164 else
68dc0745 12165 db_prefixtype='size_t'
12166 : XXX Maybe we should just give up here.
dc45a647 12167 $cat try.out >&4
68dc0745 12168 echo "Help: I can't seem to compile the db test program." >&4
12169 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
12170 fi
12171 $rm -f try.*
12172 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 12173 ;;
68dc0745 12174*) db_prefixtype='size_t'
4633a7c4
LW
12175 ;;
12176esac
a0d0e21e 12177
4633a7c4
LW
12178: check for void type
12179echo " "
12180echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
12181case "$voidflags" in
12182'')
12183 $cat >try.c <<'EOCP'
12184#if TRY & 1
760ac839 12185void sub() {
4633a7c4 12186#else
760ac839 12187sub() {
4633a7c4
LW
12188#endif
12189 extern void moo(); /* function returning void */
12190 void (*goo)(); /* ptr to func returning void */
12191#if TRY & 8
12192 void *hue; /* generic ptr */
12193#endif
12194#if TRY & 2
12195 void (*foo[10])();
12196#endif
a0d0e21e 12197
4633a7c4
LW
12198#if TRY & 4
12199 if(goo == moo) {
12200 exit(0);
12201 }
12202#endif
12203 exit(0);
12204}
d674cd6d 12205int main() { sub(); }
4633a7c4 12206EOCP
760ac839 12207 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 12208 voidflags=$defvoidused
bfb7748a 12209 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
12210 if $contains warning .out >/dev/null 2>&1; then
12211 echo "However, you might get some warnings that look like this:"
12212 $cat .out
12213 fi
12214 else
12215echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 12216 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 12217 echo "It supports 1..."
760ac839 12218 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 12219 echo "It also supports 2..."
760ac839 12220 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
12221 voidflags=7
12222 echo "And it supports 4 but not 8 definitely."
12223 else
12224 echo "It doesn't support 4..."
760ac839 12225 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
12226 voidflags=11
12227 echo "But it supports 8."
12228 else
12229 voidflags=3
12230 echo "Neither does it support 8."
12231 fi
12232 fi
12233 else
12234 echo "It does not support 2..."
760ac839 12235 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
12236 voidflags=13
12237 echo "But it supports 4 and 8."
12238 else
760ac839 12239 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
12240 voidflags=5
12241 echo "And it supports 4 but has not heard about 8."
12242 else
12243 echo "However it supports 8 but not 4."
12244 fi
12245 fi
12246 fi
12247 else
12248 echo "There is no support at all for void."
12249 voidflags=0
12250 fi
12251 fi
12252esac
4633a7c4 12253case "$voidflags" in
2c7991dc 12254"$defvoidused") ;;
bfb7748a
AD
12255*) $cat >&4 <<'EOM'
12256 Support flag bits are:
12257 1: basic void declarations.
12258 2: arrays of pointers to functions returning void.
12259 4: operations between pointers to and addresses of void functions.
12260 8: generic void pointers.
12261EOM
2c7991dc 12262 dflt="$voidflags";
4633a7c4 12263 rp="Your void support flags add up to what?"
a0d0e21e 12264 . ./myread
4633a7c4 12265 voidflags="$ans"
a0d0e21e
LW
12266 ;;
12267esac
4633a7c4 12268$rm -f try.* .out
a0d0e21e 12269
85ab1d1d
JH
12270
12271: How can we generate normalized random numbers ?
693762b4 12272echo " "
de4597cb 12273echo "Looking for a random number function..." >&4
85ab1d1d 12274case "$randfunc" in
693762b4 12275'')
85ab1d1d
JH
12276 if set drand48 val -f; eval $csym; $val; then
12277 dflt="drand48"
12278 echo "Good, found drand48()." >&4
12279 elif set random val -f; eval $csym; $val; then
12280 dflt="random"
12281 echo "OK, found random()." >&4
12282 else
12283 dflt="rand"
12284 echo "Yick, looks like I have to use rand()." >&4
12285 fi
12286 echo " "
12287 ;;
12288*)
12289 dflt="$randfunc"
12290 ;;
12291esac
12292cont=true
12293
12294case "$ccflags" in
12295*-Dmy_rand=*|*-Dmy_srand=*)
12296 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12297 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12298 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12299 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12300 ;;
12301esac
12302
12303while $test "$cont"; do
12304 rp="Use which function to generate random numbers?"
12305 . ./myread
12306 if $test "$ans" = "$dflt"; then
12307 : null
12308 else
12309 randbits=''
12310 fi
12311 randfunc="$ans"
12312 if set $ans val -f; eval $csym; $val; then
12313 cont=''
12314 else
ef4af2be
JH
12315 dflt=y
12316 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
12317 . ./myread
12318 dflt=rand
12319 case "$ans" in
12320 [yY]*) cont='';;
12321 esac
12322 fi
12323 case "$cont" in
12324 '')
12325 case "$randfunc" in
12326 drand48)
12327 drand01="drand48()"
12328 seedfunc="srand48"
12329 randbits=48
12330 randseedtype=long
12331 ;;
12332 rand|random)
12333 case "$randbits" in
12334 '')
12335echo "Checking to see how many bits your $randfunc() function produces..." >&4
12336 $cat >try.c <<EOCP
12337#$i_unistd I_UNISTD
12338#$i_stdlib I_STDLIB
693762b4 12339#include <stdio.h>
85ab1d1d
JH
12340#ifdef I_UNISTD
12341# include <unistd.h>
12342#endif
12343#ifdef I_STDLIB
12344# include <stdlib.h>
12345#endif
d674cd6d 12346int main()
693762b4 12347{
85ab1d1d
JH
12348 register int i;
12349 register unsigned long tmp;
12350 register unsigned long max = 0L;
12351
12352 for (i = 1000; i; i--) {
12353 tmp = (unsigned long) $randfunc();
12354 if (tmp > max) max = tmp;
12355 }
12356 for (i = 0; max; i++)
12357 max /= 2;
12358 printf("%d\n",i);
693762b4
AD
12359}
12360EOCP
85ab1d1d
JH
12361 set try
12362 if eval $compile_ok; then
12363 dflt=`try`
12364 else
12365 dflt='?'
12366 echo "(I can't seem to compile the test program...)"
12367 fi
12368 ;;
12369 *)
12370 dflt="$randbits"
12371 ;;
12372 esac
12373 rp="How many bits does your $randfunc() function produce?"
12374 . ./myread
12375 randbits="$ans"
12376 $rm -f try.c try
12377 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12378 seedfunc="s$randfunc"
12379 randseedtype=unsigned
12380 ;;
12381 *)
12382 dflt="31"
12383 rp="How many bits does your $randfunc() function produce?"
12384 . ./myread
12385 randbits="$ans"
12386 seedfunc="s$randfunc"
12387 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12388 if set $seedfunc val -f; eval $csym; $val; then
12389 echo "(Using $seedfunc() to seed random generator)"
12390 else
12391 echo "(Warning: no $seedfunc() to seed random generator)"
12392 seedfunc=rand
12393 fi
12394 randseedtype=unsigned
12395 ;;
12396 esac
12397 ;;
12398 esac
12399done
693762b4 12400
5ff3f7a4
GS
12401echo " "
12402echo "Determining whether or not we are on an EBCDIC system..." >&4
12403$cat >tebcdic.c <<'EOM'
12404int main()
12405{
12406 if ('M'==0xd4) return 0;
12407 return 1;
12408}
12409EOM
12410
12411val=$undef
12412set tebcdic
12413if eval $compile_ok; then
12414 if ./tebcdic; then
12415 echo "You have EBCDIC." >&4
12416 val="$define"
12417 else
57def98f 12418 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
5ff3f7a4
GS
12419 fi
12420else
5cc3184f 12421 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
12422 echo "I'll assume ASCII or some ISO Latin." >&4
12423fi
12424$rm -f tebcdic.c tebcdic
12425set ebcdic
12426eval $setvar
12427
29209bc5 12428echo " "
767df6a1
JH
12429$cat >&4 <<EOM
12430Checking how to flush all pending stdio output...
66fe083f 12431EOM
d2201af2
AD
12432# I only know how to find the first 32 possibly open files on SunOS.
12433# See also hints/sunos_4_1.sh and util.c --AD
12434case "$osname" in
12435sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12436esac
12437$cat >>try.c <<EOCP
66fe083f 12438#include <stdio.h>
d2201af2 12439#$i_unistd I_UNISTD
767df6a1 12440#ifdef I_UNISTD
a32a45b6 12441# include <unistd.h>
767df6a1
JH
12442#endif
12443#$d_sysconf HAS_SYSCONF
a71cd7cd
JH
12444#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12445#ifdef HAS_STDIO_STREAM_ARRAY
12446# define STDIO_STREAM_ARRAY $stdio_stream_array
12447#endif
66fe083f
JH
12448int main() {
12449 FILE* p = fopen("try.out", "w");
0f27ced1 12450#ifdef TRY_FPUTC
66fe083f 12451 fputc('x', p);
0f27ced1
JH
12452#else
12453# ifdef TRY_FPRINTF
12454 fprintf(p, "x");
12455# endif
12456#endif
767df6a1 12457#ifdef TRY_FFLUSH_NULL
66fe083f 12458 fflush(NULL);
767df6a1
JH
12459#endif
12460#ifdef TRY_FFLUSH_ALL
12461 {
12462 long open_max = -1;
d2201af2
AD
12463# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12464 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
767df6a1 12465# else
d2201af2
AD
12466# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12467 open_max = sysconf(_SC_OPEN_MAX);
767df6a1 12468# else
4b257aef 12469# ifdef FOPEN_MAX
d2201af2 12470 open_max = FOPEN_MAX;
767df6a1 12471# else
d2201af2
AD
12472# ifdef OPEN_MAX
12473 open_max = OPEN_MAX;
12474# else
12475# ifdef _NFILE
12476 open_max = _NFILE;
12477# endif
767df6a1
JH
12478# endif
12479# endif
12480# endif
4b257aef 12481# endif
ed39a0f2 12482# ifdef HAS_STDIO_STREAM_ARRAY
767df6a1
JH
12483 if (open_max > 0) {
12484 long i;
12485 for (i = 0; i < open_max; i++)
d2201af2
AD
12486 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12487 STDIO_STREAM_ARRAY[i]._file < open_max &&
12488 STDIO_STREAM_ARRAY[i]._flag)
12489 fflush(&STDIO_STREAM_ARRAY[i]);
767df6a1
JH
12490 }
12491 }
ed39a0f2 12492# endif
767df6a1
JH
12493#endif
12494 _exit(42);
66fe083f
JH
12495}
12496EOCP
0f27ced1
JH
12497: first we have to find out how _not_ to flush
12498if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12499 output=''
12500 set try -DTRY_FPUTC
6626660c 12501 if eval $compile; then
4b257aef 12502 $rm -f try.out
0f27ced1
JH
12503 ./try$exe_ext 2>/dev/null
12504 if $test ! -s try.out -a "X$?" = X42; then
12505 output=-DTRY_FPUTC
12506 fi
12507 fi
12508 case "$output" in
12509 '')
12510 set try -DTRY_FPRINTF
12511 $rm -f try.out
6626660c 12512 if eval $compile; then
4b257aef 12513 $rm -f try.out
0f27ced1
JH
12514 ./try$exe_ext 2>/dev/null
12515 if $test ! -s try.out -a "X$?" = X42; then
12516 output=-DTRY_FPRINTF
12517 fi
12518 fi
12519 ;;
12520 esac
12521fi
767df6a1
JH
12522: check for fflush NULL behaviour
12523case "$fflushNULL" in
0f27ced1 12524'') set try -DTRY_FFLUSH_NULL $output
6626660c 12525 if eval $compile; then
4b257aef 12526 $rm -f try.out
196fa3d2 12527 ./try$exe_ext 2>/dev/null
a32a45b6
JH
12528 code="$?"
12529 if $test -s try.out -a "X$code" = X42; then
c2fddd50 12530 fflushNULL="`$cat try.out`"
a32a45b6
JH
12531 else
12532 if $test "X$code" != X42; then
12533 $cat >&4 <<EOM
12534(If this test failed, don't worry, we'll try another method shortly.)
12535EOM
12536 fi
c2fddd50
JH
12537 fi
12538 fi
0f27ced1 12539 $rm -f core try.core core.try.*
c2fddd50 12540 case "$fflushNULL" in
6626660c 12541 x) $cat >&4 <<EOM
2b8ee124
JH
12542Your fflush(NULL) works okay for output streams.
12543Let's see if it clobbers input pipes...
66fe083f 12544EOM
2b8ee124
JH
12545# As of mid-March 2000 all versions of Solaris appear to have a stdio
12546# bug that improperly flushes the input end of pipes. So we avoid the
12547# autoflush on fork/system/exec support for now. :-(
12548$cat >tryp.c <<EOCP
12549#include <stdio.h>
12550int
12551main(int argc, char **argv)
12552{
12553 char buf[1024];
12554 int i;
12555 char *bp = buf;
12556 while (1) {
12557 while ((i = getc(stdin)) != -1
12558 && (*bp++ = i) != '\n'
12559 && bp < &buf[1024])
12560 /* DO NOTHING */ ;
12561 *bp = '\0';
12562 fprintf(stdout, "%s", buf);
12563 fflush(NULL);
12564 if (i == -1)
b354742d 12565 return 0;
2b8ee124
JH
12566 bp = buf;
12567 }
12568}
12569EOCP
12570 fflushNULL="$define"
12571 set tryp
12572 if eval $compile; then
12573 $rm -f tryp.out
12574 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12575 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12576 $cat >&4 <<EOM
12577fflush(NULL) seems to behave okay with input streams.
12578EOM
12579 fflushNULL="$define"
12580 else
12581 $cat >&4 <<EOM
12582Ouch, fflush(NULL) clobbers input pipes! We will not use it.
12583EOM
12584 fflushNULL="$undef"
12585 fi
12586 fi
b354742d 12587 $rm -f core tryp.c tryp.core core.tryp.*
c2fddd50 12588 ;;
6626660c 12589 '') $cat >&4 <<EOM
66fe083f
JH
12590Your fflush(NULL) isn't working (contrary to ANSI C).
12591EOM
ed39a0f2 12592 fflushNULL="$undef"
c2fddd50 12593 ;;
6626660c 12594 *) $cat >&4 <<EOM
66fe083f
JH
12595Cannot figure out whether your fflush(NULL) works or not.
12596I'm assuming it doesn't (contrary to ANSI C).
12597EOM
ed39a0f2 12598 fflushNULL="$undef"
c2fddd50
JH
12599 ;;
12600 esac
66fe083f
JH
12601 ;;
12602$define|true|[yY]*)
ed39a0f2 12603 fflushNULL="$define"
66fe083f
JH
12604 ;;
12605*)
ed39a0f2 12606 fflushNULL="$undef"
66fe083f
JH
12607 ;;
12608esac
b354742d
GS
12609: check explicit looping only if NULL did not work, and if the pipe
12610: bug does not show up on an explicit flush too
a32a45b6
JH
12611case "$fflushNULL" in
12612"$undef")
b354742d
GS
12613 $cat >tryp.c <<EOCP
12614#include <stdio.h>
12615int
12616main(int argc, char **argv)
12617{
12618 char buf[1024];
12619 int i;
12620 char *bp = buf;
12621 while (1) {
12622 while ((i = getc(stdin)) != -1
12623 && (*bp++ = i) != '\n'
12624 && bp < &buf[1024])
12625 /* DO NOTHING */ ;
12626 *bp = '\0';
12627 fprintf(stdout, "%s", buf);
12628 fflush(stdin);
12629 if (i == -1)
12630 return 0;
12631 bp = buf;
12632 }
12633}
12634EOCP
12635 set tryp
12636 if eval $compile; then
12637 $rm -f tryp.out
12638 $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12639 if cmp tryp.c tryp.out >/dev/null 2>&1; then
12640 $cat >&4 <<EOM
12641Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
a71cd7cd 12642EOM
b354742d 12643 : now check for fflushall behaviour
a32a45b6 12644 case "$fflushall" in
b354742d
GS
12645 '') set try -DTRY_FFLUSH_ALL $output
12646 if eval $compile; then
12647 $cat >&4 <<EOM
12648(Now testing the other method--but note that this also may fail.)
12649EOM
12650 $rm -f try.out
12651 ./try$exe_ext 2>/dev/null
12652 if $test -s try.out -a "X$?" = X42; then
12653 fflushall="`$cat try.out`"
12654 fi
12655 fi
12656 $rm -f core try.core core.try.*
12657 case "$fflushall" in
12658 x) $cat >&4 <<EOM
a32a45b6 12659Whew. Flushing explicitly all the stdio streams works.
767df6a1 12660EOM
b354742d
GS
12661 fflushall="$define"
12662 ;;
12663 '') $cat >&4 <<EOM
a32a45b6 12664Sigh. Flushing explicitly all the stdio streams doesn't work.
767df6a1 12665EOM
b354742d
GS
12666 fflushall="$undef"
12667 ;;
12668 *) $cat >&4 <<EOM
6626660c 12669Cannot figure out whether flushing stdio streams explicitly works or not.
767df6a1
JH
12670I'm assuming it doesn't.
12671EOM
b354742d
GS
12672 fflushall="$undef"
12673 ;;
12674 esac
12675 ;;
12676 "$define"|true|[yY]*)
12677 fflushall="$define"
12678 ;;
12679 *)
a32a45b6
JH
12680 fflushall="$undef"
12681 ;;
12682 esac
b354742d
GS
12683 else
12684 $cat >&4 <<EOM
12685All is futile. Even fflush(stdin) clobbers input pipes!
12686EOM
a32a45b6 12687 fflushall="$undef"
b354742d
GS
12688 fi
12689 else
12690 fflushall="$undef"
12691 fi
12692 $rm -f core tryp.c tryp.core core.tryp.*
767df6a1 12693 ;;
b354742d 12694*) fflushall="$undef"
767df6a1
JH
12695 ;;
12696esac
b354742d 12697
767df6a1
JH
12698case "$fflushNULL$fflushall" in
12699undefundef)
6626660c 12700 $cat <<EOM
b354742d
GS
12701OK, I give up. I cannot figure out how to flush pending stdio output.
12702We won't be flushing handles at all before fork/exec/popen.
767df6a1
JH
12703EOM
12704 ;;
12705esac
12706$rm -f try.* try$exe_ext
66fe083f 12707
ccc7f9b3
KS
12708: Store the full pathname to the ar program for use in the C program
12709: Respect a hint or command line value for full_ar.
12710case "$full_ar" in
12711'') full_ar=$ar ;;
12712esac
12713
1aef975c
AD
12714: Store the full pathname to the sed program for use in the C program
12715full_sed=$sed
12716
2304df62 12717: see what type gids are declared as in the kernel
dc45a647
MB
12718echo " "
12719echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
12720set gid_t gidtype xxx stdio.h sys/types.h
12721eval $typedef
2304df62 12722case "$gidtype" in
a0d0e21e
LW
12723xxx)
12724 xxx=`./findhdr sys/user.h`
12725 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12726 case $1 in
12727 unsigned) dflt="$1 $2" ;;
12728 *) dflt="$1" ;;
12729 esac
2304df62 12730 ;;
8175356b
JH
12731*) dflt="$gidtype";;
12732esac
12733case "$gidtype" in
12734gid_t) echo "gid_t found." ;;
12735*) rp="What is the type for group ids returned by getgid()?"
12736 . ./myread
12737 gidtype="$ans"
12738 ;;
12739esac
12740
12741echo " "
12742case "$gidtype" in
12743*_t) zzz="$gidtype" ;;
12744*) zzz="gid" ;;
12745esac
a22e52b9 12746echo "Checking the size of $zzz..." >&4
8175356b
JH
12747cat > try.c <<EOCP
12748#include <sys/types.h>
12749#include <stdio.h>
12750int main() {
213c275f 12751 printf("%d\n", (int)sizeof($gidtype));
14e4fe40 12752 exit(0);
8175356b
JH
12753}
12754EOCP
12755set try
a22e52b9 12756if eval $compile_ok; then
8175356b
JH
12757 yyy=`./try`
12758 case "$yyy" in
a22e52b9
JH
12759 '') gidsize=4
12760 echo "(I can't execute the test program--guessing $gidsize.)" >&4
8175356b 12761 ;;
a22e52b9 12762 *) gidsize=$yyy
49c10eea 12763 echo "Your $zzz is $gidsize bytes long."
8175356b
JH
12764 ;;
12765 esac
12766else
a22e52b9
JH
12767 gidsize=4
12768 echo "(I can't compile the test program--guessing $gidsize.)" >&4
8175356b
JH
12769fi
12770
12771
12772echo " "
12773case "$gidtype" in
12774*_t) zzz="$gidtype" ;;
12775*) zzz="gid" ;;
12776esac
a22e52b9 12777echo "Checking the sign of $zzz..." >&4
8175356b
JH
12778cat > try.c <<EOCP
12779#include <sys/types.h>
12780#include <stdio.h>
12781int main() {
a22e52b9
JH
12782 $gidtype foo = -1;
12783 if (foo < 0)
12784 printf("-1\n");
12785 else
12786 printf("1\n");
8175356b
JH
12787}
12788EOCP
12789set try
a22e52b9 12790if eval $compile; then
8175356b
JH
12791 yyy=`./try`
12792 case "$yyy" in
a22e52b9
JH
12793 '') gidsign=1
12794 echo "(I can't execute the test program--guessing unsigned.)" >&4
8175356b 12795 ;;
a22e52b9
JH
12796 *) gidsign=$yyy
12797 case "$gidsign" in
12798 1) echo "Your $zzz is unsigned." ;;
12799 -1) echo "Your $zzz is signed." ;;
12800 esac
8175356b
JH
12801 ;;
12802 esac
12803else
a22e52b9
JH
12804 gidsign=1
12805 echo "(I can't compile the test program--guessing unsigned.)" >&4
8175356b
JH
12806fi
12807
12808
785fb66b 12809echo " "
8175356b
JH
12810
12811if $test X"$quadtype" != X; then
12812
12813echo "Checking how to print 64-bit integers..." >&4
12814
12815if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12816 $cat >try.c <<'EOCP'
785fb66b
JH
12817#include <sys/types.h>
12818#include <stdio.h>
12819int main() {
8175356b
JH
12820 int q = 12345678901;
12821 printf("%ld\n", q);
785fb66b
JH
12822}
12823EOCP
8175356b
JH
12824 set try
12825 if eval $compile; then
12826 yyy=`./try$exe_ext`
12827 case "$yyy" in
12828 12345678901)
12829 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12830 sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12831 echo "We will use %d."
12832 ;;
785fb66b 12833 esac
8175356b 12834 fi
785fb66b
JH
12835fi
12836
8175356b
JH
12837if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12838 $cat >try.c <<'EOCP'
12839#include <sys/types.h>
12840#include <stdio.h>
12841int main() {
12842 long q = 12345678901;
12843 printf("%ld\n", q);
12844}
12845EOCP
12846 set try
12847 if eval $compile; then
12848 yyy=`./try$exe_ext`
12849 case "$yyy" in
12850 12345678901)
12851 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12852 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12853 echo "We will use %ld."
12854 ;;
12855 esac
12856 fi
12857fi
785fb66b 12858
8afc5b8d 12859if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
8175356b 12860 $cat >try.c <<'EOCP'
785fb66b 12861#include <sys/types.h>
8175356b 12862#include <inttypes.h>
785fb66b
JH
12863#include <stdio.h>
12864int main() {
8175356b
JH
12865 int64_t q = 12345678901;
12866 printf("%" PRId64 "\n", q);
785fb66b
JH
12867}
12868EOCP
8175356b
JH
12869 set try
12870 if eval $compile; then
12871 yyy=`./try$exe_ext`
12872 case "$yyy" in
12873 12345678901)
12874 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12875 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12876 echo "We will use the C9X style."
12877 ;;
12878 esac
12879 fi
12880fi
12881
12882if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12883 $cat >try.c <<'EOCP'
12884#include <sys/types.h>
12885#include <stdio.h>
12886int main() {
12887 long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12888 printf("%lld\n", q);
12889}
12890EOCP
12891 set try
12892 if eval $compile; then
12893 yyy=`./try$exe_ext`
12894 case "$yyy" in
12895 12345678901)
12896 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12897 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12898 echo "We will use the %lld style."
12899 ;;
12900 esac
12901 fi
785fb66b
JH
12902fi
12903
8175356b
JH
12904if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12905 $cat >try.c <<EOCP
12906#include <sys/types.h>
12907#include <stdio.h>
12908int main() {
12909 $quadtype q = 12345678901;
12910 printf("%Ld\n", q);
12911}
12912EOCP
12913 set try
12914 if eval $compile; then
12915 yyy=`./try$exe_ext`
12916 case "$yyy" in
12917 12345678901)
12918 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12919 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12920 echo "We will use %Ld."
12921 ;;
12922 esac
12923 fi
12924fi
785fb66b 12925
8175356b
JH
12926if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12927 $cat >try.c <<EOCP
12928#include <sys/types.h>
12929#include <stdio.h>
12930int main() {
12931 $quadtype q = 12345678901;
12932 printf("%qd\n", q);
12933}
12934EOCP
12935 set try
12936 if eval $compile; then
12937 yyy=`./try$exe_ext`
12938 case "$yyy" in
12939 12345678901)
12940 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12941 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12942 echo "We will use %qd."
12943 ;;
12944 esac
12945 fi
12946fi
2304df62 12947
8175356b
JH
12948if $test X"$sPRId64" = X; then
12949 echo "Cannot figure out how to print 64-bit integers." >&4
12950fi
5cd24f17 12951
8175356b 12952$rm -f try try.*
dfe9444c 12953
8175356b 12954fi
2304df62 12955
8175356b
JH
12956case "$sPRId64" in
12957'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
12958 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef";
12959 ;;
12960*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
12961 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define";
a0d0e21e 12962 ;;
2304df62 12963esac
2304df62 12964
2304df62 12965
8ff267be 12966echo " "
8175356b
JH
12967$echo "Checking the format strings to be used for Perl's internal types..." >&4
12968
12969if $test X"$ivsize" = X8; then
12970 ivdformat="$sPRId64"
12971 uvuformat="$sPRIu64"
12972 uvoformat="$sPRIo64"
12973 uvxformat="$sPRIx64"
5ff3f7a4 12974else
8175356b
JH
12975 if $test X"$ivsize" = X"$longsize"; then
12976 ivdformat='"ld"'
12977 uvuformat='"lu"'
12978 uvoformat='"lo"'
12979 uvxformat='"lx"'
12980 else
12981 if $test X"$ivsize" = X"$intsize"; then
12982 ivdformat='"d"'
12983 uvuformat='"u"'
12984 uvoformat='"o"'
12985 uvxformat='"x"'
12986 else
12987 : far out
12988 if $test X"$ivsize" = X"$shortsize"; then
12989 ivdformat='"hd"'
12990 uvuformat='"hu"'
12991 uvoformat='"ho"'
12992 uvxformat='"hx"'
12993 fi
12994 fi
12995 fi
5ff3f7a4 12996fi
8175356b
JH
12997
12998case "$ivdformat" in
12999'') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13000 exit 1
13001 ;;
13002esac
5ff3f7a4 13003
a22e52b9
JH
13004
13005echo " "
13006$echo "Checking the format string to be used for gids..." >&4
13007
13008case "$gidsign" in
13009-1) if $test X"$gidsize" = X"$ivsize"; then
13010 gidformat="$ivdformat"
13011 else
13012 if $test X"$gidsize" = X"$longsize"; then
13013 gidformat='"ld"'
13014 else
13015 if $test X"$gidsize" = X"$intsize"; then
13016 gidformat='"d"'
13017 else
13018 if $test X"$gidsize" = X"$shortsize"; then
13019 gidformat='"hd"'
13020 fi
13021 fi
13022 fi
13023 fi
13024 ;;
13025*) if $test X"$gidsize" = X"$uvsize"; then
13026 gidformat="$uvuformat"
13027 else
13028 if $test X"$gidsize" = X"$longsize"; then
13029 gidformat='"lu"'
13030 else
13031 if $test X"$gidsize" = X"$intsize"; then
13032 gidformat='"u"'
13033 else
13034 if $test X"$gidsize" = X"$shortsize"; then
13035 gidformat='"hu"'
13036 fi
13037 fi
13038 fi
13039 fi
13040 ;;
13041esac
13042
13043: see if getgroups exists
13044set getgroups d_getgrps
13045eval $inlibc
13046
13047: see if setgroups exists
13048set setgroups d_setgrps
13049eval $inlibc
13050
13051
13052: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13053echo " "
13054case "$d_getgrps$d_setgrps" in
13055*define*)
13056 case "$groupstype" in
13057 '') dflt="$gidtype" ;;
13058 *) dflt="$groupstype" ;;
13059 esac
13060 $cat <<EOM
13061What type of pointer is the second argument to getgroups() and setgroups()?
13062Usually this is the same as group ids, $gidtype, but not always.
13063
13064EOM
13065 rp='What type pointer is the second argument to getgroups() and setgroups()?'
13066 . ./myread
13067 groupstype="$ans"
13068 ;;
13069*) groupstype="$gidtype";;
13070esac
13071
5ff3f7a4 13072echo " "
dfe9444c 13073echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 13074case "$make_set_make" in
13075'')
13076 $sed 's/^X //' > testmake.mak << 'EOF'
13077Xall:
dfe9444c 13078X @echo 'maketemp="$(MAKE)"'
8ff267be 13079EOF
8ff267be 13080 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 13081 *maketemp=*) make_set_make='#' ;;
8ff267be 13082 *) make_set_make="MAKE=$make" ;;
13083 esac
dfe9444c
AD
13084 $rm -f testmake.mak
13085 ;;
13086esac
13087case "$make_set_make" in
13088'#') echo "Yup, it does.";;
13089*) echo "Nope, it doesn't.";;
13090esac
13091
13092: see what type is used for mode_t
dc45a647 13093rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 13094set mode_t modetype int stdio.h sys/types.h
dc45a647 13095eval $typedef_ask
dfe9444c 13096
dfe9444c
AD
13097: define a fucntion to check prototypes
13098$cat > protochk <<EOSH
13099$startsh
13100cc="$cc"
13101optimize="$optimize"
13102ccflags="$ccflags"
13103prototype="$prototype"
13104define="$define"
13105rm=$rm
13106EOSH
13107
13108$cat >> protochk <<'EOSH'
13109
13110$rm -f try.c
13111foo="$1"
13112shift
13113while test $# -ge 2; do
13114 case "$1" in
13115 $define) echo "#include <$2>" >> try.c ;;
13116 literal) echo "$2" >> try.c ;;
13117 esac
13118 shift 2
13119done
13120test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
13121cat >> try.c <<'EOCP'
13122#ifdef CAN_PROTOTYPE
13123#define _(args) args
13124#else
13125#define _(args) ()
13126#endif
13127EOCP
13128echo "$foo" >> try.c
13129echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13130$cc $optimize $ccflags -c try.c > /dev/null 2>&1
13131status=$?
13132$rm -f try.[co]
13133exit $status
13134EOSH
13135chmod +x protochk
13136$eunicefix protochk
13137
c890dc6c
JH
13138: see what type is used for size_t
13139rp="What is the type used for the length parameter for string functions?"
13140set size_t sizetype 'unsigned int' stdio.h sys/types.h
13141eval $typedef_ask
13142
dfe9444c
AD
13143: check for type of arguments to gethostbyaddr.
13144if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13145 case "$d_gethbyaddr" in
13146 $define)
13147 $cat <<EOM
13148
13149Checking to see what type of arguments are accepted by gethostbyaddr().
13150EOM
13151 hdrs="$define sys/types.h
13152 $d_socket sys/socket.h
13153 $i_niin netinet/in.h
13154 $i_netdb netdb.h
13155 $i_unistd unistd.h"
13156 : The first arg can 'char *' or 'void *'
13157 : The second arg is some of integral type
13158 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13159 for yyy in size_t long int; do
13160 case "$netdb_host_type" in
13161 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13162 if ./protochk "$try" $hdrs; then
13163 echo "Your system accepts $xxx for the first arg."
13164 echo "...and $yyy for the second arg."
13165 netdb_host_type="$xxx"
13166 netdb_hlen_type="$yyy"
13167 fi
13168 ;;
13169 esac
13170 done
13171 done
13172 : In case none of those worked, prompt the user.
13173 case "$netdb_host_type" in
13174 '') rp='What is the type for the 1st argument to gethostbyaddr?'
13175 dflt='char *'
13176 . ./myread
13177 netdb_host_type=$ans
13178 rp='What is the type for the 2nd argument to gethostbyaddr?'
13179 dflt="$sizetype"
13180 . ./myread
13181 netdb_hlen_type=$ans
13182 ;;
13183 esac
13184 ;;
13185 *) : no gethostbyaddr, so pick harmless defaults
13186 netdb_host_type='char *'
13187 netdb_hlen_type="$sizetype"
13188 ;;
13189 esac
13190 # Remove the "const" if needed. -- but then we'll have a
13191 # prototype clash!
13192 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13193fi
13194
13195: check for type of argument to gethostbyname.
13196if test "X$netdb_name_type" = X ; then
13197 case "$d_gethbyname" in
13198 $define)
13199 $cat <<EOM
13200
13201Checking to see what type of argument is accepted by gethostbyname().
13202EOM
13203 hdrs="$define sys/types.h
13204 $d_socket sys/socket.h
13205 $i_niin netinet/in.h
13206 $i_netdb netdb.h
13207 $i_unistd unistd.h"
13208 for xxx in "const char *" "char *"; do
13209 case "$netdb_name_type" in
13210 '') try="extern struct hostent *gethostbyname($xxx);"
13211 if ./protochk "$try" $hdrs; then
13212 echo "Your system accepts $xxx."
13213 netdb_name_type="$xxx"
13214 fi
13215 ;;
13216 esac
13217 done
13218 : In case none of those worked, prompt the user.
13219 case "$netdb_name_type" in
13220 '') rp='What is the type for the 1st argument to gethostbyname?'
13221 dflt='char *'
13222 . ./myread
13223 netdb_name_type=$ans
13224 ;;
13225 esac
13226 ;;
13227 *) : no gethostbyname, so pick harmless default
13228 netdb_name_type='char *'
13229 ;;
13230 esac
13231fi
8ff267be 13232
dfe9444c
AD
13233: check for type of 1st argument to getnetbyaddr.
13234if test "X$netdb_net_type" = X ; then
13235 case "$d_getnbyaddr" in
13236 $define)
13237 $cat <<EOM
85e6fe83 13238
dfe9444c
AD
13239Checking to see what type of 1st argument is accepted by getnetbyaddr().
13240EOM
13241 hdrs="$define sys/types.h
13242 $d_socket sys/socket.h
13243 $i_niin netinet/in.h
13244 $i_netdb netdb.h
13245 $i_unistd unistd.h"
13246 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13247 case "$netdb_net_type" in
13248 '') try="extern struct netent *getnetbyaddr($xxx, int);"
13249 if ./protochk "$try" $hdrs; then
13250 echo "Your system accepts $xxx."
13251 netdb_net_type="$xxx"
13252 fi
13253 ;;
13254 esac
13255 done
13256 : In case none of those worked, prompt the user.
13257 case "$netdb_net_type" in
13258 '') rp='What is the type for the 1st argument to getnetbyaddr?'
13259 dflt='long'
13260 . ./myread
13261 netdb_net_type=$ans
13262 ;;
13263 esac
13264 ;;
13265 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 13266 netdb_net_type='long'
dfe9444c
AD
13267 ;;
13268 esac
13269fi
2c7991dc 13270: locate the preferred pager for this system
13271case "$pager" in
13272'')
13273 dflt=''
13274 case "$pg" in
13275 /*) dflt=$pg;;
13276 esac
13277 case "$more" in
13278 /*) dflt=$more;;
13279 esac
13280 case "$less" in
13281 /*) dflt=$less;;
13282 esac
13283 case "$dflt" in
13284 '') dflt=/usr/ucb/more;;
13285 esac
13286 ;;
13287*) dflt="$pager";;
13288esac
13289echo " "
13290fn=f/
13291rp='What pager is used on your system?'
13292. ./getfile
13293pager="$ans"
13294
dfe9444c 13295: see what type pids are declared as in the kernel
dc45a647 13296rp="What is the type of process ids on this system?"
dfe9444c 13297set pid_t pidtype int stdio.h sys/types.h
dc45a647 13298eval $typedef_ask
2304df62 13299
fe749a9f
JH
13300: Find earliest binary compatible site_perl subdirectory perl can use.
13301case "$bincompat5005" in
13302"$define") xs_apiversion='5.005' ;;
13303*) xs_apiversion=$version ;; # The current site_perl version.
13304esac
13305: Find earliest pure perl site_perl subdirectory perl can use.
13306: The versioned directories started at 5.005.
13307pm_apiversion='5.005'
13308
693762b4
AD
13309: check for length of pointer
13310echo " "
13311case "$ptrsize" in
13312'')
49c10eea 13313 echo "Checking to see how big your pointers are..." >&4
693762b4
AD
13314 if test "$voidflags" -gt 7; then
13315 echo '#define VOID_PTR char *' > try.c
13316 else
13317 echo '#define VOID_PTR void *' > try.c
13318 fi
13319 $cat >>try.c <<'EOCP'
13320#include <stdio.h>
d674cd6d 13321int main()
693762b4 13322{
213c275f 13323 printf("%d\n", (int)sizeof(VOID_PTR));
14e4fe40 13324 exit(0);
693762b4
AD
13325}
13326EOCP
13327 set try
dc45a647 13328 if eval $compile_ok; then
693762b4 13329 ptrsize=`./try`
49c10eea 13330 echo "Your pointers are $ptrsize bytes long."
693762b4
AD
13331 else
13332 dflt='4'
13333 echo "(I can't seem to compile the test program. Guessing...)" >&4
13334 rp="What is the size of a pointer (in bytes)?"
13335 . ./myread
13336 ptrsize="$ans"
13337 fi
13338 ;;
13339esac
13340$rm -f try.c try
13341
a0d0e21e
LW
13342: see if ar generates random libraries by itself
13343echo " "
13344echo "Checking how to generate random libraries on your machine..." >&4
13345echo 'int bar1() { return bar2(); }' > bar1.c
13346echo 'int bar2() { return 2; }' > bar2.c
13347$cat > foo.c <<'EOP'
d674cd6d 13348int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
13349EOP
13350$cc $ccflags -c bar1.c >/dev/null 2>&1
13351$cc $ccflags -c bar2.c >/dev/null 2>&1
13352$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
13353$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13354if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 13355 ./foobar >/dev/null 2>&1; then
4e2a5f63 13356 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
13357 orderlib=false
13358 ranlib=":"
dfe9444c
AD
13359elif $ar ts bar$_a >/dev/null 2>&1 &&
13360 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 13361 ./foobar >/dev/null 2>&1; then
4e2a5f63 13362 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 13363 orderlib=false
dfe9444c 13364 ranlib="$ar ts"
a0d0e21e 13365else
ecfc5424
AD
13366 case "$ranlib" in
13367 :) ranlib='';;
13368 '')
13369 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13370 $test -f $ranlib || ranlib=''
13371 ;;
13372 esac
a0d0e21e 13373 if $test -n "$ranlib"; then
ecfc5424 13374 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
13375 orderlib=false
13376 else
13377 echo "your system doesn't seem to support random libraries"
13378 echo "so we'll use lorder and tsort to order the libraries."
13379 orderlib=true
13380 ranlib=":"
13381 fi
13382fi
13383$rm -f foo* bar*
13384
dfe9444c
AD
13385: check for type of arguments to select.
13386case "$selecttype" in
13387'') case "$d_select" in
13388 $define)
cce08f5b 13389 echo " "
dfe9444c
AD
13390 $cat <<EOM
13391Checking to see what type of arguments are accepted by select().
13392EOM
13393 hdrs="$define sys/types.h
13394 $i_systime sys/time.h
13395 $i_sysselct sys/select.h
13396 $d_socket sys/socket.h"
13397 : The first arg can be int, unsigned, or size_t
13398 : The last arg may or may not be 'const'
13399 val=''
7f3d1cf1
BH
13400 : void pointer has been seen but using that
13401 : breaks the selectminbits test
13402 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 13403 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
13404 for tmo in 'struct timeval *' 'const struct timeval *'; do
13405 case "$val" in
13406 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13407 if ./protochk "$try" $hdrs; then
13408 echo "Your system accepts $xxx."
13409 val="$xxx"
13410 fi
13411 ;;
13412 esac
13413 done
13414 done
13415 done
13416 case "$val" in
13417 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13418 case "$d_fd_set" in
13419 $define) dflt="fd_set *" ;;
13420 *) dflt="int *" ;;
13421 esac
13422 . ./myread
13423 val=$ans
13424 ;;
a0d0e21e 13425 esac
dfe9444c 13426 selecttype="$val"
a0d0e21e 13427 ;;
dfe9444c
AD
13428 *) : no select, so pick a harmless default
13429 selecttype='int *'
a0d0e21e
LW
13430 ;;
13431 esac
a0d0e21e
LW
13432 ;;
13433esac
2304df62 13434
5ff3f7a4
GS
13435: check for the select 'width'
13436case "$selectminbits" in
13437'') case "$d_select" in
13438 $define)
13439 $cat <<EOM
13440
85ab1d1d 13441Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
13442EOM
13443 $cat >try.c <<EOCP
13444#include <sys/types.h>
13445#$i_time I_TIME
13446#$i_systime I_SYS_TIME
13447#$i_systimek I_SYS_TIME_KERNEL
13448#ifdef I_TIME
13449# include <time.h>
13450#endif
13451#ifdef I_SYS_TIME
13452# ifdef I_SYS_TIME_KERNEL
13453# define KERNEL
13454# endif
13455# include <sys/time.h>
13456# ifdef I_SYS_TIME_KERNEL
13457# undef KERNEL
13458# endif
13459#endif
13460#$i_sysselct I_SYS_SELECT
13461#ifdef I_SYS_SELECT
13462#include <sys/select.h>
13463#endif
bd628c73
AD
13464#$d_socket HAS_SOCKET
13465#ifdef HAS_SOCKET
13466# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13467#endif
5ff3f7a4 13468#include <stdio.h>
fb164848
JH
13469$selecttype b;
13470#define S sizeof(*(b))
5ff3f7a4
GS
13471#define MINBITS 64
13472#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13473#define NBITS (NBYTES * 8)
13474int main() {
13475 char s[NBYTES];
5ff3f7a4
GS
13476 struct timeval t;
13477 int i;
13478 FILE* fp;
13479 int fd;
13480
13481 fclose(stdin);
13482 fp = fopen("try.c", "r");
13483 if (fp == 0)
13484 exit(1);
13485 fd = fileno(fp);
13486 if (fd < 0)
13487 exit(2);
13488 b = ($selecttype)s;
13489 for (i = 0; i < NBITS; i++)
13490 FD_SET(i, b);
13491 t.tv_sec = 0;
13492 t.tv_usec = 0;
13493 select(fd + 1, b, 0, 0, &t);
13494 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13495 printf("%d\n", i + 1);
13496 return 0;
13497}
13498EOCP
13499 set try
13500 if eval $compile_ok; then
13501 selectminbits=`./try`
85ab1d1d 13502 case "$selectminbits" in
fb164848
JH
13503 '') cat >&4 <<EOM
13504Cannot figure out on how many bits at a time your select() operates.
13505I'll play safe and guess it is 32 bits.
13506EOM
13507 selectminbits=32
13508 bits="32 bits"
13509 ;;
85ab1d1d
JH
13510 1) bits="1 bit" ;;
13511 *) bits="$selectminbits bits" ;;
13512 esac
13513 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
13514 else
13515 rp='What is the minimum number of bits your select() operates on?'
13516 case "$byteorder" in
13517 1234|12345678) dflt=32 ;;
13518 *) dflt=1 ;;
13519 esac
13520 . ./myread
13521 val=$ans
13522 selectminbits="$val"
13523 fi
13524 $rm -f try.* try
13525 ;;
13526 *) : no select, so pick a harmless default
13527 selectminbits='32'
13528 ;;
13529 esac
13530 ;;
13531esac
13532
8e07c86e
AD
13533: Trace out the files included by signal.h, then look for SIGxxx names.
13534: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
13535: Remove SIGSTKSIZE used by Linux.
13536: Remove SIGSTKSZ used by Posix.
4633a7c4 13537: Remove SIGTYP void lines used by OS2.
6764938d 13538: Some cpps, like os390, dont give the file name anywhere
53d4e464 13539if [ "X$fieldn" = X ]; then
6764938d
GS
13540 : Just make some guesses. We check them later.
13541 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
53d4e464 13542else
6764938d 13543 xxx=`echo '#include <signal.h>' |
8e07c86e
AD
13544 $cppstdin $cppminus $cppflags 2>/dev/null |
13545 $grep '^[ ]*#.*include' |
13546 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
53d4e464 13547fi
8e07c86e
AD
13548: Check this list of files to be sure we have parsed the cpp output ok.
13549: This will also avoid potentially non-existent files, such
13550: as ../foo/bar.h
13551xxxfiles=''
13552for xx in $xxx /dev/null ; do
13553 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13554done
13555: If we have found no files, at least try signal.h
13556case "$xxxfiles" in
13557'') xxxfiles=`./findhdr signal.h` ;;
13558esac
13559xxx=`awk '
af4c28eb 13560$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
13561 print substr($2, 4, 20)
13562}
4633a7c4 13563$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
13564 print substr($3, 4, 20)
13565}' $xxxfiles`
13566: Append some common names just in case the awk scan failed.
6764938d
GS
13567xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13568xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13569xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13570xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13571xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13572
8e07c86e 13573: generate a few handy files for later
dc45a647 13574$cat > signal.c <<'EOCP'
4633a7c4
LW
13575#include <sys/types.h>
13576#include <signal.h>
dc45a647 13577#include <stdio.h>
4633a7c4 13578int main() {
760ac839
LW
13579
13580/* Strange style to avoid deeply-nested #if/#else/#endif */
13581#ifndef NSIG
13582# ifdef _NSIG
13583# define NSIG (_NSIG)
13584# endif
13585#endif
13586
13587#ifndef NSIG
13588# ifdef SIGMAX
13589# define NSIG (SIGMAX+1)
13590# endif
13591#endif
13592
13593#ifndef NSIG
13594# ifdef SIG_MAX
13595# define NSIG (SIG_MAX+1)
13596# endif
13597#endif
13598
13599#ifndef NSIG
13600# ifdef MAXSIG
13601# define NSIG (MAXSIG+1)
13602# endif
4633a7c4 13603#endif
760ac839
LW
13604
13605#ifndef NSIG
13606# ifdef MAX_SIG
13607# define NSIG (MAX_SIG+1)
13608# endif
13609#endif
13610
13611#ifndef NSIG
13612# ifdef SIGARRAYSIZE
13613# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13614# endif
13615#endif
13616
13617#ifndef NSIG
13618# ifdef _sys_nsig
13619# define NSIG (_sys_nsig) /* Solaris 2.5 */
13620# endif
13621#endif
13622
13623/* Default to some arbitrary number that's big enough to get most
13624 of the common signals.
13625*/
13626#ifndef NSIG
13627# define NSIG 50
4633a7c4 13628#endif
760ac839
LW
13629
13630printf("NSIG %d\n", NSIG);
13631
dc45a647
MB
13632#ifndef JUST_NSIG
13633
13634EOCP
13635
28e8609d 13636echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
13637{
13638 printf "#ifdef SIG"; printf $1; printf "\n"
13639 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13640 printf $1; printf ");\n"
13641 printf "#endif\n"
2304df62 13642}
2304df62 13643END {
dc45a647 13644 printf "#endif /* JUST_NSIG */\n";
14e4fe40 13645 printf "exit(0);\n}\n";
2304df62 13646}
4633a7c4
LW
13647' >>signal.c
13648$cat >signal.awk <<'EOP'
13649BEGIN { ndups = 0 }
13650$1 ~ /^NSIG$/ { nsig = $2 }
13651($1 !~ /^NSIG$/) && (NF == 2) {
13652 if ($2 > maxsig) { maxsig = $2 }
13653 if (sig_name[$2]) {
13654 dup_name[ndups] = $1
13655 dup_num[ndups] = $2
13656 ndups++
13657 }
13658 else {
13659 sig_name[$2] = $1
13660 sig_num[$2] = $2
13661 }
4633a7c4
LW
13662}
13663END {
af4c28eb
CS
13664 if (nsig == 0) {
13665 nsig = maxsig + 1
13666 }
13667 printf("NSIG %d\n", nsig);
13668 for (n = 1; n < nsig; n++) {
13669 if (sig_name[n]) {
13670 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 13671 }
af4c28eb
CS
13672 else {
13673 printf("NUM%d %d\n", n, n)
13674 }
13675 }
4633a7c4 13676 for (n = 0; n < ndups; n++) {
af4c28eb 13677 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
13678 }
13679}
13680EOP
13681$cat >signal_cmd <<EOS
8e07c86e 13682$startsh
dc45a647
MB
13683if $test -s signal.lst; then
13684 echo "Using your existing signal.lst file"
13685 exit 0
13686fi
13687xxx="$xxx"
13688EOS
13689$cat >>signal_cmd <<'EOS'
13690
13691set signal
13692if eval $compile_ok; then
dfe9444c 13693 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 13694else
dc45a647
MB
13695 echo "(I can't seem be able to compile the whole test program)" >&4
13696 echo "(I'll try it in little pieces.)" >&4
13697 set signal -DJUST_NSIG
13698 if eval $compile_ok; then
13699 ./signal$_exe > signal.nsg
13700 $cat signal.nsg
13701 else
13702 echo "I can't seem to figure out how many signals you have." >&4
13703 echo "Guessing 50." >&4
13704 echo 'NSIG 50' > signal.nsg
13705 fi
13706 : Now look at all the signal names, one at a time.
28e8609d 13707 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
13708 $cat > signal.c <<EOCP
13709#include <sys/types.h>
13710#include <signal.h>
13711#include <stdio.h>
13712int main() {
13713printf("$xx %d\n", SIG${xx});
13714return 0;
13715}
13716EOCP
13717 set signal
13718 if eval $compile; then
13719 echo "SIG${xx} found."
13720 ./signal$_exe >> signal.ls1
13721 else
13722 echo "SIG${xx} NOT found."
13723 fi
13724 done
13725 if $test -s signal.ls1; then
13726 $cat signal.nsg signal.ls1 |
13727 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13728 fi
13729
13730fi
13731if $test -s signal.lst; then
13732 :
13733else
13734 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 13735 echo 'kill -l' >signal
dc45a647 13736 set X `csh -f <signal`
8e07c86e 13737 $rm -f signal
2304df62 13738 shift
dc45a647 13739 case $# in
8e07c86e 13740 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 13741 esac
28e8609d 13742 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
13743 $awk '{ printf "%s %d\n", $1, ++s; }
13744 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 13745fi
dc45a647 13746$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 13747EOS
4633a7c4
LW
13748chmod a+x signal_cmd
13749$eunicefix signal_cmd
8e07c86e
AD
13750
13751: generate list of signal names
13752echo " "
dfe9444c 13753case "$sig_name_init" in
6626bf4c
JH
13754'') doinit=yes ;;
13755*) case "$sig_num_init" in
13756 ''|*,*) doinit=yes ;;
13757 esac ;;
13758esac
13759case "$doinit" in
13760yes)
4633a7c4 13761 echo "Generating a list of signal names and numbers..." >&4
dc45a647 13762 . ./signal_cmd
af4c28eb
CS
13763 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13764 sig_name=`$awk 'BEGIN { printf "ZERO " }
13765 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13766 sig_num=`$awk 'BEGIN { printf "0 " }
13767 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13768 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
13769 !/^NSIG/ { printf "\"%s\", ", $1 }
13770 END { printf "0\n" }' signal.lst`
13771 sig_num_init=`$awk 'BEGIN { printf "0, " }
13772 !/^NSIG/ { printf "%d, ", $2}
13773 END { printf "0\n"}' signal.lst`
13774 ;;
13775esac
13776echo "The following $sig_count signals are available:"
a0d0e21e
LW
13777echo " "
13778echo $sig_name | $awk \
13779'BEGIN { linelen = 0 }
13780{
8e07c86e 13781 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
13782 name = "SIG" $i " "
13783 linelen = linelen + length(name)
13784 if (linelen > 70) {
13785 printf "\n"
13786 linelen = length(name)
13787 }
13788 printf "%s", name
13789 }
8e07c86e 13790 printf "\n"
a0d0e21e 13791}'
4633a7c4 13792$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 13793
8c99d73e
GS
13794echo " "
13795case "$sizetype" in
13796*_t) zzz="$sizetype" ;;
13797*) zzz="filesize" ;;
13798esac
13799echo "Checking the size of $zzz..." >&4
13800cat > try.c <<EOCP
13801#include <sys/types.h>
13802#include <stdio.h>
13803int main() {
13804 printf("%d\n", (int)sizeof($sizetype));
13805 exit(0);
13806}
13807EOCP
13808set try
13809if eval $compile_ok; then
13810 yyy=`./try`
13811 case "$yyy" in
13812 '') sizesize=4
13813 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13814 ;;
13815 *) sizesize=$yyy
13816 echo "Your $zzz size is $sizesize bytes."
13817 ;;
13818 esac
13819else
13820 sizesize=4
13821 echo "(I can't compile the test program--guessing $sizesize.)" >&4
13822fi
13823
13824
c890dc6c
JH
13825: check for socklen_t
13826echo " "
13827echo "Checking to see if you have socklen_t..." >&4
13828$cat >try.c <<EOCP
13829#include <sys/types.h>
13830#$d_socket HAS_SOCKET
13831#ifdef HAS_SOCKET
13832#include <sys/socket.h>
13833#endif
13834int main() { socklen_t x = 16; }
13835EOCP
13836set try
13837if eval $compile; then
13838 val="$define"
13839 echo "You have socklen_t."
13840else
13841 val="$undef"
13842 echo "You do not have socklen_t."
13843 case "$sizetype" in
8c99d73e 13844 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
c890dc6c
JH
13845 esac
13846fi
13847$rm -f try try.*
13848set d_socklen_t
13849eval $setvar
13850
13851: check for type of the size argument to socket calls
13852case "$d_socket" in
13853"$define")
13854 $cat <<EOM
13855
13856Checking to see what type is the last argument of accept().
13857EOM
13858 hdrs="$define sys/types.h $d_socket sys/socket.h"
13859 yyy=''
13860 case "$d_socklen_t" in
13861 "$define") yyy="$yyy socklen_t"
13862 esac
6c85e8b0 13863 yyy="$yyy $sizetype int long unsigned"
c890dc6c
JH
13864 for xxx in $yyy; do
13865 case "$socksizetype" in
13866 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
13867 if ./protochk "$try" $hdrs; then
13868 echo "Your system accepts '$xxx *' for the last argument of accept()."
10cc9d2a 13869 socksizetype="$xxx"
c890dc6c
JH
13870 fi
13871 ;;
13872 esac
13873 done
13874: In case none of those worked, prompt the user.
13875 case "$socksizetype" in
4f309e22 13876 '') rp='What is the type for socket address structure sizes?'
10cc9d2a 13877 dflt='int'
c890dc6c
JH
13878 . ./myread
13879 socksizetype=$ans
13880 ;;
13881 esac
13882 ;;
6c85e8b0
JH
13883*) : no sockets, so pick relatively harmless default
13884 socksizetype='int'
c890dc6c
JH
13885 ;;
13886esac
13887
a0d0e21e
LW
13888: see what type is used for signed size_t
13889set ssize_t ssizetype int stdio.h sys/types.h
13890eval $typedef
13891dflt="$ssizetype"
13892$cat > ssize.c <<EOM
13893#include <stdio.h>
13894#include <sys/types.h>
13895#define Size_t $sizetype
13896#define SSize_t $dflt
d674cd6d 13897int main()
a0d0e21e
LW
13898{
13899 if (sizeof(Size_t) == sizeof(SSize_t))
13900 printf("$dflt\n");
13901 else if (sizeof(Size_t) == sizeof(int))
13902 printf("int\n");
13903 else
13904 printf("long\n");
760ac839 13905 exit(0);
a0d0e21e
LW
13906}
13907EOM
13908echo " "
dfe9444c 13909set ssize
dc45a647 13910if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 13911 ssizetype=`./ssize`
a0d0e21e
LW
13912 echo "I'll be using $ssizetype for functions returning a byte count." >&4
13913else
24fef2a7 13914 $cat >&4 <<EOM
24fef2a7
AD
13915Help! I can't compile and run the ssize_t test program: please enlighten me!
13916(This is probably a misconfiguration in your system or libraries, and
13917you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
13918
13919I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 13920be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
13921
13922EOM
13923 rp="What signed type is the same size as $sizetype?"
13924 . ./myread
13925 ssizetype="$ans"
13926fi
dfe9444c 13927$rm -f ssize ssize.*
3fd537d4 13928
a0d0e21e
LW
13929: see what type of char stdio uses.
13930echo " "
13931if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13932 echo "Your stdio uses unsigned chars." >&4
13933 stdchar="unsigned char"
13934else
13935 echo "Your stdio uses signed chars." >&4
13936 stdchar="char"
13937fi
13938
13939: see if time exists
13940echo " "
28e8609d
JH
13941if test "X$d_time" = X -o X"$timetype" = X; then
13942 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
13943 echo 'time() found.' >&4
13944 val="$define"
13945 rp="What is the type returned by time() on this system?"
13946 set time_t timetype long stdio.h sys/types.h
13947 eval $typedef_ask
28e8609d 13948 else
5ff3f7a4
GS
13949 echo 'time() not found, hope that will do.' >&4
13950 val="$undef"
13951 timetype='int';
28e8609d
JH
13952 fi
13953 set d_time
13954 eval $setvar
a0d0e21e 13955fi
a0d0e21e
LW
13956
13957: see what type uids are declared as in the kernel
dc45a647
MB
13958echo " "
13959echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
13960set uid_t uidtype xxx stdio.h sys/types.h
13961eval $typedef
13962case "$uidtype" in
13963xxx)
13964 xxx=`./findhdr sys/user.h`
13965 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13966 case $1 in
13967 unsigned) dflt="$1 $2" ;;
13968 *) dflt="$1" ;;
13969 esac
13970 ;;
4633a7c4
LW
13971*) dflt="$uidtype";;
13972esac
dc45a647
MB
13973case "$uidtype" in
13974uid_t) echo "uid_t found." ;;
13975*) rp="What is the type for user ids returned by getuid()?"
13976 . ./myread
13977 uidtype="$ans"
13978 ;;
13979esac
4633a7c4 13980
57def98f
JH
13981echo " "
13982case "$uidtype" in
13983*_t) zzz="$uidtype" ;;
13984*) zzz="uid" ;;
13985esac
a22e52b9 13986echo "Checking the size of $zzz..." >&4
57def98f
JH
13987cat > try.c <<EOCP
13988#include <sys/types.h>
13989#include <stdio.h>
13990int main() {
213c275f 13991 printf("%d\n", (int)sizeof($uidtype));
14e4fe40 13992 exit(0);
57def98f
JH
13993}
13994EOCP
d4265146 13995set try
a22e52b9 13996if eval $compile_ok; then
57def98f
JH
13997 yyy=`./try`
13998 case "$yyy" in
a22e52b9
JH
13999 '') uidsize=4
14000 echo "(I can't execute the test program--guessing $uidsize.)" >&4
57def98f 14001 ;;
a22e52b9 14002 *) uidsize=$yyy
49c10eea 14003 echo "Your $zzz is $uidsize bytes long."
57def98f
JH
14004 ;;
14005 esac
14006else
a22e52b9
JH
14007 uidsize=4
14008 echo "(I can't compile the test program--guessing $uidsize.)" >&4
57def98f
JH
14009fi
14010
785fb66b
JH
14011echo " "
14012case "$uidtype" in
14013*_t) zzz="$uidtype" ;;
14014*) zzz="uid" ;;
14015esac
a22e52b9 14016echo "Checking the sign of $zzz..." >&4
785fb66b
JH
14017cat > try.c <<EOCP
14018#include <sys/types.h>
14019#include <stdio.h>
14020int main() {
a22e52b9
JH
14021 $uidtype foo = -1;
14022 if (foo < 0)
14023 printf("-1\n");
14024 else
14025 printf("1\n");
785fb66b
JH
14026}
14027EOCP
14028set try
a22e52b9 14029if eval $compile; then
785fb66b
JH
14030 yyy=`./try`
14031 case "$yyy" in
a22e52b9
JH
14032 '') uidsign=1
14033 echo "(I can't execute the test program--guessing unsigned.)" >&4
785fb66b 14034 ;;
a22e52b9
JH
14035 *) uidsign=$yyy
14036 case "$uidsign" in
14037 1) echo "Your $zzz is unsigned." ;;
14038 -1) echo "Your $zzz is signed." ;;
14039 esac
785fb66b
JH
14040 ;;
14041 esac
14042else
a22e52b9
JH
14043 uidsign=1
14044 echo "(I can't compile the test program--guessing unsigned.)" >&4
785fb66b
JH
14045fi
14046
a22e52b9
JH
14047
14048
14049echo " "
14050$echo "Checking the format string to be used for uids..." >&4
14051
14052case "$uidsign" in
14053-1) if $test X"$uidsize" = X"$ivsize"; then
14054 uidformat="$ivdformat"
14055 else
14056 if $test X"$uidsize" = X"$longsize"; then
14057 uidformat='"ld"'
14058 else
14059 if $test X"$uidsize" = X"$intsize"; then
14060 uidformat='"d"'
14061 else
14062 if $test X"$uidsize" = X"$shortsize"; then
14063 uidformat='"hd"'
14064 fi
14065 fi
14066 fi
14067 fi
14068 ;;
14069*) if $test X"$uidsize" = X"$uvsize"; then
14070 uidformat="$uvuformat"
14071 else
14072 if $test X"$uidsize" = X"$longsize"; then
14073 uidformat='"lu"'
14074 else
14075 if $test X"$uidsize" = X"$intsize"; then
14076 uidformat='"u"'
14077 else
14078 if $test X"$uidsize" = X"$shortsize"; then
14079 uidformat='"hu"'
14080 fi
14081 fi
14082 fi
14083 fi
14084 ;;
14085esac
14086
4633a7c4
LW
14087: see if dbm.h is available
14088: see if dbmclose exists
14089set dbmclose d_dbmclose
14090eval $inlibc
14091
14092case "$d_dbmclose" in
14093$define)
14094 set dbm.h i_dbm
14095 eval $inhdr
5f80c64f
JH
14096 case "$i_dbm" in
14097 $define)
14098 val="$undef"
14099 set i_rpcsvcdbm
14100 eval $setvar
14101 ;;
14102 *) set rpcsvc/dbm.h i_rpcsvcdbm
14103 eval $inhdr
14104 ;;
14105 esac
14106 ;;
14107*) echo "We won't be including <dbm.h>"
14108 val="$undef"
14109 set i_dbm
14110 eval $setvar
14111 val="$undef"
14112 set i_rpcsvcdbm
14113 eval $setvar
14114 ;;
14115esac
14116
14117: see if this is a sys/file.h system
14118val=''
14119set sys/file.h val
14120eval $inhdr
14121
14122: do we need to include sys/file.h ?
14123case "$val" in
14124"$define")
14125 echo " "
14126 if $h_sysfile; then
14127 val="$define"
14128 echo "We'll be including <sys/file.h>." >&4
14129 else
14130 val="$undef"
14131 echo "We won't be including <sys/file.h>." >&4
14132 fi
14133 ;;
14134*)
14135 h_sysfile=false
14136 ;;
14137esac
14138set i_sysfile
14139eval $setvar
14140
14141: see if fcntl.h is there
14142val=''
14143set fcntl.h val
14144eval $inhdr
14145
14146: see if we can include fcntl.h
14147case "$val" in
14148"$define")
14149 echo " "
14150 if $h_fcntl; then
14151 val="$define"
14152 echo "We'll be including <fcntl.h>." >&4
14153 else
14154 val="$undef"
14155 if $h_sysfile; then
14156 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14157 else
14158 echo "We won't be including <fcntl.h>." >&4
14159 fi
14160 fi
14161 ;;
14162*)
14163 h_fcntl=false
14164 val="$undef"
14165 ;;
14166esac
14167set i_fcntl
14168eval $setvar
14169
43999f95
JH
14170: see if this is a iconv.h system
14171set iconv.h i_iconv
14172eval $inhdr
14173
792d8dab
JH
14174: see if this is a ieeefp.h system
14175set ieeefp.h i_ieeefp
14176eval $inhdr
14177
5f80c64f
JH
14178: see if locale.h is available
14179set locale.h i_locale
14180eval $inhdr
14181
7f3d1cf1 14182: see if mach cthreads are available
13666627
JH
14183if test "X$usethreads" = "X$define"; then
14184 set mach/cthreads.h i_machcthr
14185 eval $inhdr
14186else
14187 i_machcthr="$undef"
14188fi
14189
14190
7f3d1cf1 14191
5f80c64f
JH
14192: see if this is a math.h system
14193set math.h i_math
14194eval $inhdr
14195
e7fb4fcc
JH
14196: see if this is a mntent.h system
14197set mntent.h i_mntent
14198eval $inhdr
14199
5f80c64f
JH
14200: see if ndbm.h is available
14201set ndbm.h t_ndbm
14202eval $inhdr
14203case "$t_ndbm" in
14204$define)
14205 : see if dbm_open exists
14206 set dbm_open d_dbm_open
14207 eval $inlibc
14208 case "$d_dbm_open" in
14209 $undef)
14210 t_ndbm="$undef"
14211 echo "We won't be including <ndbm.h>"
14212 ;;
14213 esac
14214 ;;
14215esac
14216val="$t_ndbm"
14217set i_ndbm
14218eval $setvar
14219
14220: see if net/errno.h is available
14221val=''
14222set net/errno.h val
14223eval $inhdr
14224
14225: Unfortunately, it causes problems on some systems. Arrgh.
14226case "$val" in
14227$define)
14228 cat > try.c <<'EOM'
14229#include <stdio.h>
14230#include <errno.h>
14231#include <net/errno.h>
14232int func()
14233{
14234 return ENOTSOCK;
14235}
14236EOM
14237 if $cc $ccflags -c try.c >/dev/null 2>&1; then
14238 echo "We'll be including <net/errno.h>." >&4
14239 else
14240 echo "We won't be including <net/errno.h>." >&4
14241 val="$undef"
14242 fi
14243 $rm -f try.* try
14244 ;;
14245esac
14246set i_neterrno
14247eval $setvar
14248
9cc6feab
JH
14249: see if netinet/tcp.h is available
14250set netinet/tcp.h i_netinettcp
14251eval $inhdr
14252
5b34fd99
JH
14253: see if this is a poll.h system
14254set poll.h i_poll
14255eval $inhdr
14256
5f80c64f 14257echo " "
78691af5 14258$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
43999f95
JH
14259$cat <<'EOSH' > Cppsym.know
14260a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14261AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14262alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14263ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14264BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14265BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14266bull c cadmus clipper CMU COFF COMPILER_VERSION
14267concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14268CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14269Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14270FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14271GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14272H3050R H3050RX hbullx20 hcx host_mips
14273hp200 hp300 hp700 HP700 hp800 hp9000
14274hp9000s200 hp9000s300 hp9000s400 hp9000s500
14275hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14276i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14277iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14278INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14279LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14280LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14281Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14282LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14283M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14284M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14285M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14286MATH_HAS_NO_SIDE_EFFECTS
14287mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14288mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14289mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14290MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14291mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14292NetBSD news1500 news1700 news1800 news1900 news3700
14293news700 news800 news900 NeXT NLS ns16000 ns32000
14294ns32016 ns32332 ns32k nsc32000
14295OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14296pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14297pc532 pdp11 PGC PIC plexus PORTAR posix
14298POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14299POSIX_C_SOURCE POSIX_SOURCE POWER
14300PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14301riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14302SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14303sony sony_news sonyrisc sparc sparclite spectrum
14304stardent stdc STDC_EXT stratos sun sun3 sun386
14305Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14306SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14307SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14308sysV68 sysV88 Tek4132 Tek4300 titan
14309tower tower32 tower32_200 tower32_600 tower32_700
14310tower32_800 tower32_850 tss
14311u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14312ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14313unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14314Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14315XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14316XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14317z8000
14318EOSH
14319# Maybe put other stuff here too.
14320cat <<EOSH >>Cppsym.know
14321$osname
14322EOSH
9b97abf7
JH
14323./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14324./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
43999f95
JH
14325$cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14326$rm -f Cppsym.a Cppsym.b
14327cat <<EOSH > Cppsym
5f80c64f 14328$startsh
43999f95
JH
14329if $test \$# -gt 0; then
14330 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14331 if $test -s Cppsym.got; then
14332 $rm -f Cppsym.got
14333 exit 0
14334 fi
14335 $rm -f Cppsym.got
14336 exit 1
14337else
14338 $tr " " "$trnl" | ./Cppsym.try
14339 exit 0
14340fi
14341EOSH
5f80c64f
JH
14342chmod +x Cppsym
14343$eunicefix Cppsym
43999f95
JH
14344cat <<EOSH > Cppsym.try
14345$startsh
14346cat <<'EOCP' > try.c
14347#include <stdio.h>
14348int main() {
14349EOCP
14350$awk \\
14351EOSH
14352cat <<'EOSH' >> Cppsym.try
14353'length($1) > 0 {
14354 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14355 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14356 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14357 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14358}' >> try.c
14359echo '}' >> try.c
14360EOSH
14361cat <<EOSH >> Cppsym.try
43999f95 14362ccflags="$ccflags"
a3489f11
JH
14363case "$osname-$gccversion" in
14364irix-) ccflags="\$ccflags -woff 1178" ;;
14365esac
14366$cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
43999f95
JH
14367EOSH
14368chmod +x Cppsym.try
14369$eunicefix Cppsym.try
14370./Cppsym < Cppsym.know > Cppsym.true
5f80c64f 14371: now check the C compiler for additional symbols
c4747d3e
JH
14372postprocess_cc_v=''
14373case "$osname" in
14374aix) postprocess_cc_v="|$tr , ' '" ;;
14375esac
5f80c64f
JH
14376$cat >ccsym <<EOS
14377$startsh
14378$cat >tmp.c <<EOF
14379extern int foo;
14380EOF
c4747d3e 14381for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
14382do
14383 case "\$i" in
14384 -D*) echo "\$i" | $sed 's/^-D//';;
14385 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14386 esac
14387done
14388$rm -f try.c
14389EOS
2000072c 14390postprocess_cc_v=''
5f80c64f
JH
14391chmod +x ccsym
14392$eunicefix ccsym
14393./ccsym > ccsym1.raw
14394if $test -s ccsym1.raw; then
14395 $sort ccsym1.raw | $uniq >ccsym.raw
14396else
14397 mv ccsym1.raw ccsym.raw
14398fi
14399
14400$awk '/\=/ { print $0; next }
14401 { print $0"=1" }' ccsym.raw >ccsym.list
43999f95
JH
14402$awk '/\=/ { print $0; next }
14403 { print $0"=1" }' Cppsym.true >ccsym.true
5f80c64f
JH
14404$comm -13 ccsym.true ccsym.list >ccsym.own
14405$comm -12 ccsym.true ccsym.list >ccsym.com
14406$comm -23 ccsym.true ccsym.list >ccsym.cpp
14407also=''
5f80c64f 14408if $test -z ccsym.raw; then
ff49bff8 14409 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 14410 echo " "
ff49bff8 14411 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 14412 $cat Cppsym.true
ff49bff8
JH
14413 ccsymbols=''
14414 cppsymbols=`$cat Cppsym.true`
918c3d21 14415 cppsymbols=`echo $cppsymbols`
ff49bff8 14416 cppccsymbols="$cppsymbols"
5f80c64f
JH
14417else
14418 if $test -s ccsym.com; then
14419 echo "Your C compiler and pre-processor define these symbols:"
14420 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14421 also='also '
14422 symbols='ones'
ff49bff8 14423 cppccsymbols=`$cat ccsym.com`
918c3d21 14424 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
14425 $test "$silent" || sleep 1
14426 fi
14427 if $test -s ccsym.cpp; then
14428 $test "$also" && echo " "
ff49bff8 14429 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
14430 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14431 also='further '
ff49bff8 14432 cppsymbols=`$cat ccsym.cpp`
918c3d21 14433 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
14434 $test "$silent" || sleep 1
14435 fi
14436 if $test -s ccsym.own; then
14437 $test "$also" && echo " "
ff49bff8 14438 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
14439 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14440 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 14441 ccsymbols=`$cat ccsym.own`
918c3d21 14442 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
14443 $test "$silent" || sleep 1
14444 fi
14445fi
14446$rm -f ccsym*
14447
14448: see if this is a termio system
14449val="$undef"
14450val2="$undef"
14451val3="$undef"
14452if $test `./findhdr termios.h`; then
14453 set tcsetattr i_termios
14454 eval $inlibc
14455 val3="$i_termios"
14456fi
14457echo " "
14458case "$val3" in
14459"$define") echo "You have POSIX termios.h... good!" >&4;;
14460*) if ./Cppsym pyr; then
14461 case "`/bin/universe`" in
14462 ucb) if $test `./findhdr sgtty.h`; then
14463 val2="$define"
14464 echo "<sgtty.h> found." >&4
14465 else
14466 echo "System is pyramid with BSD universe."
14467 echo "<sgtty.h> not found--you could have problems." >&4
14468 fi;;
14469 *) if $test `./findhdr termio.h`; then
14470 val="$define"
14471 echo "<termio.h> found." >&4
14472 else
14473 echo "System is pyramid with USG universe."
14474 echo "<termio.h> not found--you could have problems." >&4
14475 fi;;
14476 esac
14477 elif ./usg; then
14478 if $test `./findhdr termio.h`; then
14479 echo "<termio.h> found." >&4
14480 val="$define"
14481 elif $test `./findhdr sgtty.h`; then
14482 echo "<sgtty.h> found." >&4
14483 val2="$define"
14484 else
14485echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14486 fi
14487 else
14488 if $test `./findhdr sgtty.h`; then
14489 echo "<sgtty.h> found." >&4
14490 val2="$define"
14491 elif $test `./findhdr termio.h`; then
14492 echo "<termio.h> found." >&4
14493 val="$define"
14494 else
14495echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14496 fi
14497 fi;;
14498esac
14499set i_termio; eval $setvar
14500val=$val2; set i_sgtty; eval $setvar
14501val=$val3; set i_termios; eval $setvar
14502
f1066039
JH
14503: see if this is a shadow.h system
14504set shadow.h i_shadow
14505eval $inhdr
14506
86959918
JH
14507: see if this is a socks.h system
14508set socks.h i_socks
14509eval $inhdr
14510
5f80c64f
JH
14511: see if stdarg is available
14512echo " "
14513if $test `./findhdr stdarg.h`; then
14514 echo "<stdarg.h> found." >&4
14515 valstd="$define"
14516else
14517 echo "<stdarg.h> NOT found." >&4
14518 valstd="$undef"
14519fi
14520
14521: see if varags is available
14522echo " "
14523if $test `./findhdr varargs.h`; then
14524 echo "<varargs.h> found." >&4
14525else
14526 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14527fi
14528
14529: set up the varargs testing programs
14530$cat > varargs.c <<EOP
14531#ifdef I_STDARG
14532#include <stdarg.h>
14533#endif
14534#ifdef I_VARARGS
14535#include <varargs.h>
14536#endif
14537
14538#ifdef I_STDARG
14539int f(char *p, ...)
14540#else
14541int f(va_alist)
14542va_dcl
14543#endif
14544{
14545 va_list ap;
14546#ifndef I_STDARG
14547 char *p;
14548#endif
14549#ifdef I_STDARG
14550 va_start(ap,p);
14551#else
14552 va_start(ap);
14553 p = va_arg(ap, char *);
14554#endif
14555 va_end(ap);
14556}
14557EOP
14558$cat > varargs <<EOP
14559$startsh
14560if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14561 echo "true"
14562else
14563 echo "false"
14564fi
14565$rm -f varargs$_o
14566EOP
14567chmod +x varargs
14568
14569: now check which varargs header should be included
14570echo " "
14571i_varhdr=''
14572case "$valstd" in
14573"$define")
14574 if `./varargs I_STDARG`; then
14575 val='stdarg.h'
14576 elif `./varargs I_VARARGS`; then
14577 val='varargs.h'
14578 fi
14579 ;;
14580*)
14581 if `./varargs I_VARARGS`; then
14582 val='varargs.h'
14583 fi
14584 ;;
14585esac
14586case "$val" in
14587'')
14588echo "I could not find the definition for va_dcl... You have problems..." >&4
14589 val="$undef"; set i_stdarg; eval $setvar
14590 val="$undef"; set i_varargs; eval $setvar
14591 ;;
14592*)
14593 set i_varhdr
14594 eval $setvar
14595 case "$i_varhdr" in
14596 stdarg.h)
14597 val="$define"; set i_stdarg; eval $setvar
14598 val="$undef"; set i_varargs; eval $setvar
14599 ;;
14600 varargs.h)
14601 val="$undef"; set i_stdarg; eval $setvar
14602 val="$define"; set i_varargs; eval $setvar
14603 ;;
14604 esac
14605 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14606esac
14607$rm -f varargs*
14608
14609: see if stddef is available
14610set stddef.h i_stddef
14611eval $inhdr
14612
923fc586
JH
14613: see if this is a sunmath.h system
14614set sunmath.h i_sunmath
14615eval $inhdr
14616
5f80c64f
JH
14617: see if sys/access.h is available
14618set sys/access.h i_sysaccess
14619eval $inhdr
14620
14621: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14622set sys/filio.h i_sysfilio
14623eval $inhdr
14624echo " "
14625if $test `./findhdr sys/ioctl.h`; then
14626 val="$define"
14627 echo '<sys/ioctl.h> found.' >&4
14628else
14629 val="$undef"
14630 if $test $i_sysfilio = "$define"; then
14631 echo '<sys/ioctl.h> NOT found.' >&4
14632 else
14633 $test $i_sgtty = "$define" && xxx="sgtty.h"
14634 $test $i_termio = "$define" && xxx="termio.h"
14635 $test $i_termios = "$define" && xxx="termios.h"
14636echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14637 fi
14638fi
14639set i_sysioctl
14640eval $setvar
14641
ca52efda
JH
14642
14643: see if this is a syslog.h system
14644set syslog.h i_syslog
14645eval $inhdr
14646
bf0c440f
JH
14647
14648: see if this is a sys/mode.h system
14649set sys/mode.h i_sysmode
14650eval $inhdr
14651
5f80c64f
JH
14652: see if sys/resource.h has to be included
14653set sys/resource.h i_sysresrc
14654eval $inhdr
14655
14656: see if sys/security.h is available
14657set sys/security.h i_syssecrt
14658eval $inhdr
14659
104d25b7
JH
14660: see if this is a sys/statvfs.h system
14661set sys/statvfs.h i_sysstatvfs
14662eval $inhdr
14663
b7b35fc2
JH
14664: see if this is a sys/uio.h system
14665set sys/uio.h i_sysuio
14666eval $inhdr
14667
5f80c64f
JH
14668: see if this is a sys/un.h system
14669set sys/un.h i_sysun
14670eval $inhdr
14671
d4935d7f
JH
14672
14673: see if this is a sys/utsname.h system
14674set sys/utsname.h i_sysutsname
14675eval $inhdr
14676
5f80c64f
JH
14677: see if this is a syswait system
14678set sys/wait.h i_syswait
14679eval $inhdr
14680
0545a864
JH
14681: see if this is a ustat.h system
14682set ustat.h i_ustat
14683eval $inhdr
14684
5f80c64f
JH
14685: see if this is an utime system
14686set utime.h i_utime
14687eval $inhdr
14688
14689: see if this is a values.h system
14690set values.h i_values
14691eval $inhdr
14692
14693: see if this is a vfork system
14694case "$d_vfork" in
14695"$define")
14696 set vfork.h i_vfork
14697 eval $inhdr
14698 ;;
14699*)
14700 i_vfork="$undef"
14701 ;;
14702esac
14703
14704: see if gdbm.h is available
14705set gdbm.h t_gdbm
14706eval $inhdr
14707case "$t_gdbm" in
14708$define)
14709 : see if gdbm_open exists
14710 set gdbm_open d_gdbm_open
14711 eval $inlibc
14712 case "$d_gdbm_open" in
14713 $undef)
14714 t_gdbm="$undef"
14715 echo "We won't be including <gdbm.h>"
14716 ;;
14717 esac
14718 ;;
14719esac
14720val="$t_gdbm"
14721set i_gdbm
14722eval $setvar
14723
14724echo " "
14725echo "Looking for extensions..." >&4
5f80c64f
JH
14726: If we are using the old config.sh, known_extensions may contain
14727: old or inaccurate or duplicate values.
14728known_extensions=''
14729nonxs_extensions=''
14730: We do not use find because it might not be available.
14731: We do not just use MANIFEST because the user may have dropped
14732: some additional extensions into the source tree and expect them
14733: to be built.
7e791ca9
NK
14734
14735: Function to recursively find available extensions, ignoring DynaLoader
14736: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14737find_extensions='
14738 for xxx in *; do
14739 case "$xxx" in
14740 DynaLoader|dynaload) ;;
14741 *)
14742 if $test -f $xxx/$xxx.xs; then
14743 known_extensions="$known_extensions $1$xxx";
14744 elif $test -f $xxx/Makefile.PL; then
14745 nonxs_extensions="$nonxs_extensions $1$xxx";
14746 else
14747 if $test -d $xxx -a $# -lt 10; then
14748 set $1$xxx/ $*;
14749 cd $xxx;
14750 eval $find_extensions;
14751 cd ..;
14752 shift;
9f50e519 14753 fi;
7e791ca9
NK
14754 fi
14755 ;;
9f50e519 14756 esac;
7e791ca9
NK
14757 done'
14758tdir=`pwd`
14759cd $rsrc/ext
a3635516 14760set X
efdb23e1 14761shift
7e791ca9 14762eval $find_extensions
5f80c64f
JH
14763set X $nonxs_extensions
14764shift
14765nonxs_extensions="$*"
14766set X $known_extensions
14767shift
14768known_extensions="$*"
14769cd $tdir
14770
14771: Now see which are supported on this system.
14772avail_ext=''
14773for xxx in $known_extensions ; do
14774 case "$xxx" in
14775 DB_File|db_file)
14776 case "$i_db" in
14777 $define) avail_ext="$avail_ext $xxx" ;;
14778 esac
14779 ;;
14780 GDBM_File|gdbm_fil)
14781 case "$i_gdbm" in
14782 $define) avail_ext="$avail_ext $xxx" ;;
14783 esac
14784 ;;
14785 NDBM_File|ndbm_fil)
14786 case "$i_ndbm" in
f7dd4e7f 14787 $define)
10cc9d2a 14788 case "$osname-$use64bitint" in
f7dd4e7f
JH
14789 hpux-define)
14790 case "$libs" in
14791 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14792 esac
14793 ;;
14794 *) avail_ext="$avail_ext $xxx" ;;
14795 esac
14796 ;;
5f80c64f
JH
14797 esac
14798 ;;
14799 ODBM_File|odbm_fil)
14800 case "${i_dbm}${i_rpcsvcdbm}" in
f7dd4e7f 14801 *"${define}"*)
10cc9d2a 14802 case "$osname-$use64bitint" in
f7dd4e7f
JH
14803 hpux-define)
14804 case "$libs" in
14805 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14806 esac
14807 ;;
14808 *) avail_ext="$avail_ext $xxx" ;;
14809 esac
14810 ;;
5f80c64f
JH
14811 esac
14812 ;;
14813 POSIX|posix)
14814 case "$useposix" in
14815 true|define|y) avail_ext="$avail_ext $xxx" ;;
14816 esac
14817 ;;
14818 Opcode|opcode)
14819 case "$useopcode" in
14820 true|define|y) avail_ext="$avail_ext $xxx" ;;
14821 esac
14822 ;;
14823 Socket|socket)
14824 case "$d_socket" in
14825 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14826 esac
14827 ;;
14828 Thread|thread)
14829 case "$usethreads" in
14830 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14831 esac
14832 ;;
14833 IPC/SysV|ipc/sysv)
14834 : XXX Do we need a useipcsysv variable here
14835 case "${d_msg}${d_sem}${d_shm}" in
14836 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14837 esac
14838 ;;
14839 *) avail_ext="$avail_ext $xxx"
14840 ;;
14841 esac
14842done
14843
14844set X $avail_ext
14845shift
14846avail_ext="$*"
14847
14848: Now see which nonxs extensions are supported on this system.
14849: For now assume all are.
14850nonxs_ext=''
14851for xxx in $nonxs_extensions ; do
14852 case "$xxx" in
14853 *) nonxs_ext="$nonxs_ext $xxx"
14854 ;;
14855 esac
14856done
14857
14858set X $nonxs_ext
14859shift
14860nonxs_ext="$*"
14861
14862case $usedl in
14863$define)
14864 $cat <<EOM
14865A number of extensions are supplied with $package. You may choose to
14866compile these extensions for dynamic loading (the default), compile
14867them into the $package executable (static loading), or not include
14868them at all. Answer "none" to include no extensions.
14869Note that DynaLoader is always built and need not be mentioned here.
14870
14871EOM
14872 case "$dynamic_ext" in
14873 '') dflt="$avail_ext" ;;
14874 *) dflt="$dynamic_ext"
14875 # Perhaps we are reusing an old out-of-date config.sh.
14876 case "$hint" in
14877 previous)
14878 if test X"$dynamic_ext" != X"$avail_ext"; then
14879 $cat <<EOM
14880NOTICE: Your previous config.sh list may be incorrect.
14881The extensions now available to you are
14882 ${avail_ext}
14883but the default list from your previous config.sh is
14884 ${dynamic_ext}
14885
14886EOM
14887 fi
14888 ;;
14889 esac
14890 ;;
14891 esac
14892 case "$dflt" in
14893 '') dflt=none;;
14894 esac
14895 rp="What extensions do you wish to load dynamically?"
14896 . ./myread
14897 case "$ans" in
14898 none) dynamic_ext=' ' ;;
14899 *) dynamic_ext="$ans" ;;
14900 esac
14901
14902 case "$static_ext" in
14903 '')
14904 : Exclude those already listed in dynamic linking
14905 dflt=''
14906 for xxx in $avail_ext; do
14907 case " $dynamic_ext " in
14908 *" $xxx "*) ;;
14909 *) dflt="$dflt $xxx" ;;
14910 esac
14911 done
14912 set X $dflt
14913 shift
14914 dflt="$*"
14915 ;;
14916 *) dflt="$static_ext"
14917 ;;
14918 esac
14919
14920 case "$dflt" in
14921 '') dflt=none;;
14922 esac
14923 rp="What extensions do you wish to load statically?"
14924 . ./myread
14925 case "$ans" in
14926 none) static_ext=' ' ;;
14927 *) static_ext="$ans" ;;
14928 esac
14929 ;;
14930*)
14931 $cat <<EOM
14932A number of extensions are supplied with $package. Answer "none"
14933to include no extensions.
14934Note that DynaLoader is always built and need not be mentioned here.
14935
14936EOM
14937 case "$static_ext" in
14938 '') dflt="$avail_ext" ;;
14939 *) dflt="$static_ext"
14940 # Perhaps we are reusing an old out-of-date config.sh.
14941 case "$hint" in
14942 previous)
14943 if test X"$static_ext" != X"$avail_ext"; then
14944 $cat <<EOM
14945NOTICE: Your previous config.sh list may be incorrect.
14946The extensions now available to you are
14947 ${avail_ext}
14948but the default list from your previous config.sh is
14949 ${static_ext}
14950
14951EOM
14952 fi
14953 ;;
14954 esac
14955 ;;
14956 esac
14957 : Exclude those that are not xs extensions
14958 case "$dflt" in
14959 '') dflt=none;;
14960 esac
14961 rp="What extensions do you wish to include?"
14962 . ./myread
14963 case "$ans" in
14964 none) static_ext=' ' ;;
14965 *) static_ext="$ans" ;;
14966 esac
14967 ;;
14968esac
14969
14970set X $dynamic_ext $static_ext $nonxs_ext
14971shift
14972extensions="$*"
14973
14974: Remove build directory name from cppstdin so it can be used from
14975: either the present location or the final installed location.
14976echo " "
14977: Get out of the UU directory to get correct path name.
14978cd ..
14979case "$cppstdin" in
14980`pwd`/cppstdin)
14981 echo "Stripping down cppstdin path name"
14982 cppstdin=cppstdin
14983 ;;
14984esac
14985cd UU
14986
14987: end of configuration questions
14988echo " "
14989echo "End of configuration questions."
14990echo " "
14991
14992: back to where it started
14993if test -d ../UU; then
14994 cd ..
14995fi
14996
14997: configuration may be patched via a 'config.over' file
14998if $test -f config.over; then
14999 echo " "
15000 dflt=y
15001 rp='I see a config.over file. Do you wish to load it?'
15002 . UU/myread
15003 case "$ans" in
15004 n*) echo "OK, I'll ignore it.";;
15005 *) . ./config.over
15006 echo "Configuration override changes have been loaded."
15007 ;;
15008 esac
15009fi
15010
15011: in case they want portability, strip down executable paths
15012case "$d_portable" in
15013"$define")
15014 echo " "
15015 echo "Stripping down executable paths..." >&4
15016 for file in $loclist $trylist; do
534ac15a
JH
15017 eval temp=\$$file
15018 eval $file=`basename $temp`
5f80c64f
JH
15019 done
15020 ;;
15021esac
15022
15023: create config.sh file
15024echo " "
15025echo "Creating config.sh..." >&4
15026$spitshell <<EOT >config.sh
15027$startsh
15028#
15029# This file was produced by running the Configure script. It holds all the
15030# definitions figured out by Configure. Should you modify one of these values,
15031# do not forget to propagate your changes by running "Configure -der". You may
15032# instead choose to run each of the .SH files by yourself, or "Configure -S".
15033#
15034
15035# Package name : $package
15036# Source directory : $src
15037# Configuration time: $cf_time
15038# Configured by : $cf_by
15039# Target system : $myuname
15040
15041Author='$Author'
15042Date='$Date'
15043Header='$Header'
15044Id='$Id'
15045Locker='$Locker'
15046Log='$Log'
15047Mcc='$Mcc'
15048RCSfile='$RCSfile'
15049Revision='$Revision'
15050Source='$Source'
15051State='$State'
15052_a='$_a'
15053_exe='$_exe'
15054_o='$_o'
15055afs='$afs'
15056alignbytes='$alignbytes'
15057ansi2knr='$ansi2knr'
15058aphostname='$aphostname'
ff935051
JH
15059api_revision='$api_revision'
15060api_subversion='$api_subversion'
15061api_version='$api_version'
15062api_versionstring='$api_versionstring'
5f80c64f
JH
15063ar='$ar'
15064archlib='$archlib'
15065archlibexp='$archlibexp'
15066archname64='$archname64'
15067archname='$archname'
15068archobjs='$archobjs'
15069awk='$awk'
15070baserev='$baserev'
15071bash='$bash'
15072bin='$bin'
d71b2b6b 15073bincompat5005='$bincompat5005'
5f80c64f
JH
15074binexp='$binexp'
15075bison='$bison'
15076byacc='$byacc'
15077byteorder='$byteorder'
15078c='$c'
15079castflags='$castflags'
15080cat='$cat'
15081cc='$cc'
15082cccdlflags='$cccdlflags'
15083ccdlflags='$ccdlflags'
15084ccflags='$ccflags'
ff49bff8 15085ccsymbols='$ccsymbols'
5f80c64f
JH
15086cf_by='$cf_by'
15087cf_email='$cf_email'
15088cf_time='$cf_time'
8175356b 15089charsize='$charsize'
5f80c64f
JH
15090chgrp='$chgrp'
15091chmod='$chmod'
15092chown='$chown'
15093clocktype='$clocktype'
15094comm='$comm'
15095compress='$compress'
15096contains='$contains'
15097cp='$cp'
15098cpio='$cpio'
15099cpp='$cpp'
15100cpp_stuff='$cpp_stuff'
ff49bff8 15101cppccsymbols='$cppccsymbols'
5f80c64f
JH
15102cppflags='$cppflags'
15103cpplast='$cpplast'
15104cppminus='$cppminus'
15105cpprun='$cpprun'
15106cppstdin='$cppstdin'
ff49bff8 15107cppsymbols='$cppsymbols'
68c15b6f 15108crosscompile='$crosscompile'
5f80c64f
JH
15109cryptlib='$cryptlib'
15110csh='$csh'
15111d_Gconvert='$d_Gconvert'
cf2093f6
JH
15112d_PRIEldbl='$d_PRIEldbl'
15113d_PRIFldbl='$d_PRIFldbl'
15114d_PRIGldbl='$d_PRIGldbl'
15115d_PRIX64='$d_PRIX64'
15116d_PRId64='$d_PRId64'
15117d_PRIeldbl='$d_PRIeldbl'
15118d_PRIfldbl='$d_PRIfldbl'
15119d_PRIgldbl='$d_PRIgldbl'
15120d_PRIi64='$d_PRIi64'
15121d_PRIo64='$d_PRIo64'
15122d_PRIu64='$d_PRIu64'
15123d_PRIx64='$d_PRIx64'
5f80c64f
JH
15124d_access='$d_access'
15125d_accessx='$d_accessx'
15126d_alarm='$d_alarm'
15127d_archlib='$d_archlib'
cf2093f6
JH
15128d_atolf='$d_atolf'
15129d_atoll='$d_atoll'
5f80c64f
JH
15130d_attribut='$d_attribut'
15131d_bcmp='$d_bcmp'
15132d_bcopy='$d_bcopy'
d71b2b6b 15133d_bincompat5005='$d_bincompat5005'
5f80c64f
JH
15134d_bsd='$d_bsd'
15135d_bsdgetpgrp='$d_bsdgetpgrp'
15136d_bsdsetpgrp='$d_bsdsetpgrp'
15137d_bzero='$d_bzero'
15138d_casti32='$d_casti32'
15139d_castneg='$d_castneg'
15140d_charvspr='$d_charvspr'
15141d_chown='$d_chown'
15142d_chroot='$d_chroot'
15143d_chsize='$d_chsize'
15144d_closedir='$d_closedir'
15145d_const='$d_const'
15146d_crypt='$d_crypt'
15147d_csh='$d_csh'
15148d_cuserid='$d_cuserid'
15149d_dbl_dig='$d_dbl_dig'
5f80c64f 15150d_difftime='$d_difftime'
5f80c64f
JH
15151d_dirnamlen='$d_dirnamlen'
15152d_dlerror='$d_dlerror'
15153d_dlopen='$d_dlopen'
15154d_dlsymun='$d_dlsymun'
15155d_dosuid='$d_dosuid'
15156d_drand48proto='$d_drand48proto'
15157d_dup2='$d_dup2'
15158d_eaccess='$d_eaccess'
15159d_endgrent='$d_endgrent'
15160d_endhent='$d_endhent'
15161d_endnent='$d_endnent'
15162d_endpent='$d_endpent'
15163d_endpwent='$d_endpwent'
15164d_endsent='$d_endsent'
f1066039 15165d_endspent='$d_endspent'
5f80c64f
JH
15166d_eofnblk='$d_eofnblk'
15167d_eunice='$d_eunice'
15168d_fchmod='$d_fchmod'
15169d_fchown='$d_fchown'
15170d_fcntl='$d_fcntl'
15171d_fd_macros='$d_fd_macros'
15172d_fd_set='$d_fd_set'
15173d_fds_bits='$d_fds_bits'
5f80c64f 15174d_fgetpos='$d_fgetpos'
5f80c64f 15175d_flexfnam='$d_flexfnam'
5f80c64f 15176d_flock='$d_flock'
5f80c64f
JH
15177d_fork='$d_fork'
15178d_fpathconf='$d_fpathconf'
d9b3e12d 15179d_fpos64_t='$d_fpos64_t'
0545a864 15180d_fs_data_s='$d_fs_data_s'
5f80c64f 15181d_fseeko='$d_fseeko'
5f80c64f 15182d_fsetpos='$d_fsetpos'
104d25b7
JH
15183d_fstatfs='$d_fstatfs'
15184d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
15185d_ftello='$d_ftello'
15186d_ftime='$d_ftime'
49dabb45 15187d_getcwd='$d_getcwd'
c890dc6c 15188d_getfsstat='$d_getfsstat'
5f80c64f
JH
15189d_getgrent='$d_getgrent'
15190d_getgrps='$d_getgrps'
15191d_gethbyaddr='$d_gethbyaddr'
15192d_gethbyname='$d_gethbyname'
15193d_gethent='$d_gethent'
15194d_gethname='$d_gethname'
15195d_gethostprotos='$d_gethostprotos'
15196d_getlogin='$d_getlogin'
ad27e871 15197d_getmnt='$d_getmnt'
ccc7f9b3 15198d_getmntent='$d_getmntent'
5f80c64f
JH
15199d_getnbyaddr='$d_getnbyaddr'
15200d_getnbyname='$d_getnbyname'
15201d_getnent='$d_getnent'
15202d_getnetprotos='$d_getnetprotos'
15203d_getpbyname='$d_getpbyname'
15204d_getpbynumber='$d_getpbynumber'
15205d_getpent='$d_getpent'
15206d_getpgid='$d_getpgid'
15207d_getpgrp2='$d_getpgrp2'
15208d_getpgrp='$d_getpgrp'
15209d_getppid='$d_getppid'
15210d_getprior='$d_getprior'
15211d_getprotoprotos='$d_getprotoprotos'
15212d_getpwent='$d_getpwent'
15213d_getsbyname='$d_getsbyname'
15214d_getsbyport='$d_getsbyport'
15215d_getsent='$d_getsent'
15216d_getservprotos='$d_getservprotos'
f1066039
JH
15217d_getspent='$d_getspent'
15218d_getspnam='$d_getspnam'
5f80c64f
JH
15219d_gettimeod='$d_gettimeod'
15220d_gnulibc='$d_gnulibc'
15221d_grpasswd='$d_grpasswd'
ccc7f9b3 15222d_hasmntopt='$d_hasmntopt'
5f80c64f 15223d_htonl='$d_htonl'
43999f95 15224d_iconv='$d_iconv'
5f80c64f
JH
15225d_index='$d_index'
15226d_inetaton='$d_inetaton'
13b3f787 15227d_int64_t='$d_int64_t'
5f80c64f
JH
15228d_isascii='$d_isascii'
15229d_killpg='$d_killpg'
15230d_lchown='$d_lchown'
2d4389e4 15231d_ldbl_dig='$d_ldbl_dig'
5f80c64f
JH
15232d_link='$d_link'
15233d_locconv='$d_locconv'
5f80c64f
JH
15234d_lockf='$d_lockf'
15235d_longdbl='$d_longdbl'
15236d_longlong='$d_longlong'
49c10eea 15237d_lseekproto='$d_lseekproto'
5f80c64f 15238d_lstat='$d_lstat'
1e8c3fde 15239d_madvise='$d_madvise'
5f80c64f
JH
15240d_mblen='$d_mblen'
15241d_mbstowcs='$d_mbstowcs'
15242d_mbtowc='$d_mbtowc'
0f27ced1 15243d_memchr='$d_memchr'
5f80c64f
JH
15244d_memcmp='$d_memcmp'
15245d_memcpy='$d_memcpy'
15246d_memmove='$d_memmove'
15247d_memset='$d_memset'
15248d_mkdir='$d_mkdir'
fe749a9f 15249d_mkdtemp='$d_mkdtemp'
5f80c64f 15250d_mkfifo='$d_mkfifo'
fe749a9f
JH
15251d_mkstemp='$d_mkstemp'
15252d_mkstemps='$d_mkstemps'
5f80c64f 15253d_mktime='$d_mktime'
fe749a9f
JH
15254d_mmap='$d_mmap'
15255d_mprotect='$d_mprotect'
5f80c64f 15256d_msg='$d_msg'
de4597cb
JH
15257d_msg_ctrunc='$d_msg_ctrunc'
15258d_msg_dontroute='$d_msg_dontroute'
15259d_msg_oob='$d_msg_oob'
15260d_msg_peek='$d_msg_peek'
15261d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
15262d_msgctl='$d_msgctl'
15263d_msgget='$d_msgget'
15264d_msgrcv='$d_msgrcv'
15265d_msgsnd='$d_msgsnd'
fe749a9f
JH
15266d_msync='$d_msync'
15267d_munmap='$d_munmap'
5f80c64f 15268d_mymalloc='$d_mymalloc'
5f80c64f 15269d_nice='$d_nice'
78691af5 15270d_nv_preserves_uv='$d_nv_preserves_uv'
2000072c 15271d_off64_t='$d_off64_t'
ef4af2be 15272d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
15273d_oldpthreads='$d_oldpthreads'
15274d_oldsock='$d_oldsock'
15275d_open3='$d_open3'
5f80c64f
JH
15276d_pathconf='$d_pathconf'
15277d_pause='$d_pause'
15278d_phostname='$d_phostname'
15279d_pipe='$d_pipe'
15280d_poll='$d_poll'
15281d_portable='$d_portable'
15282d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
15283d_pwage='$d_pwage'
15284d_pwchange='$d_pwchange'
15285d_pwclass='$d_pwclass'
15286d_pwcomment='$d_pwcomment'
15287d_pwexpire='$d_pwexpire'
15288d_pwgecos='$d_pwgecos'
15289d_pwpasswd='$d_pwpasswd'
15290d_pwquota='$d_pwquota'
bbe6c963 15291d_qgcvt='$d_qgcvt'
de1c2614 15292d_quad='$d_quad'
5f80c64f
JH
15293d_readdir='$d_readdir'
15294d_readlink='$d_readlink'
15295d_rename='$d_rename'
15296d_rewinddir='$d_rewinddir'
15297d_rmdir='$d_rmdir'
15298d_safebcpy='$d_safebcpy'
15299d_safemcpy='$d_safemcpy'
15300d_sanemcmp='$d_sanemcmp'
15301d_sched_yield='$d_sched_yield'
de4597cb 15302d_scm_rights='$d_scm_rights'
5f80c64f
JH
15303d_seekdir='$d_seekdir'
15304d_select='$d_select'
15305d_sem='$d_sem'
15306d_semctl='$d_semctl'
15307d_semctl_semid_ds='$d_semctl_semid_ds'
15308d_semctl_semun='$d_semctl_semun'
15309d_semget='$d_semget'
15310d_semop='$d_semop'
15311d_setegid='$d_setegid'
15312d_seteuid='$d_seteuid'
15313d_setgrent='$d_setgrent'
15314d_setgrps='$d_setgrps'
15315d_sethent='$d_sethent'
15316d_setlinebuf='$d_setlinebuf'
15317d_setlocale='$d_setlocale'
15318d_setnent='$d_setnent'
15319d_setpent='$d_setpent'
15320d_setpgid='$d_setpgid'
15321d_setpgrp2='$d_setpgrp2'
15322d_setpgrp='$d_setpgrp'
15323d_setprior='$d_setprior'
15324d_setpwent='$d_setpwent'
15325d_setregid='$d_setregid'
15326d_setresgid='$d_setresgid'
15327d_setresuid='$d_setresuid'
15328d_setreuid='$d_setreuid'
15329d_setrgid='$d_setrgid'
15330d_setruid='$d_setruid'
15331d_setsent='$d_setsent'
15332d_setsid='$d_setsid'
f1066039 15333d_setspent='$d_setspent'
5f80c64f
JH
15334d_setvbuf='$d_setvbuf'
15335d_sfio='$d_sfio'
15336d_shm='$d_shm'
15337d_shmat='$d_shmat'
15338d_shmatprototype='$d_shmatprototype'
15339d_shmctl='$d_shmctl'
15340d_shmdt='$d_shmdt'
15341d_shmget='$d_shmget'
15342d_sigaction='$d_sigaction'
15343d_sigsetjmp='$d_sigsetjmp'
15344d_socket='$d_socket'
13b3f787 15345d_socklen_t='$d_socklen_t'
5f80c64f 15346d_sockpair='$d_sockpair'
68d4903c 15347d_sqrtl='$d_sqrtl'
5f80c64f 15348d_statblks='$d_statblks'
0545a864
JH
15349d_statfs_f_flags='$d_statfs_f_flags'
15350d_statfs_s='$d_statfs_s'
104d25b7 15351d_statvfs='$d_statvfs'
5f80c64f
JH
15352d_stdio_cnt_lval='$d_stdio_cnt_lval'
15353d_stdio_ptr_lval='$d_stdio_ptr_lval'
ed39a0f2 15354d_stdio_stream_array='$d_stdio_stream_array'
5f80c64f
JH
15355d_stdiobase='$d_stdiobase'
15356d_stdstdio='$d_stdstdio'
5f80c64f
JH
15357d_strchr='$d_strchr'
15358d_strcoll='$d_strcoll'
15359d_strctcpy='$d_strctcpy'
15360d_strerrm='$d_strerrm'
15361d_strerror='$d_strerror'
15362d_strtod='$d_strtod'
15363d_strtol='$d_strtol'
ff935051 15364d_strtold='$d_strtold'
76d49b1c 15365d_strtoll='$d_strtoll'
5f80c64f 15366d_strtoul='$d_strtoul'
cf2093f6 15367d_strtoull='$d_strtoull'
ff935051 15368d_strtouq='$d_strtouq'
5f80c64f
JH
15369d_strxfrm='$d_strxfrm'
15370d_suidsafe='$d_suidsafe'
15371d_symlink='$d_symlink'
15372d_syscall='$d_syscall'
15373d_sysconf='$d_sysconf'
15374d_sysernlst='$d_sysernlst'
15375d_syserrlst='$d_syserrlst'
15376d_system='$d_system'
15377d_tcgetpgrp='$d_tcgetpgrp'
15378d_tcsetpgrp='$d_tcsetpgrp'
5f80c64f 15379d_telldir='$d_telldir'
cb86ce0e 15380d_telldirproto='$d_telldirproto'
5f80c64f
JH
15381d_time='$d_time'
15382d_times='$d_times'
5f80c64f
JH
15383d_truncate='$d_truncate'
15384d_tzname='$d_tzname'
15385d_umask='$d_umask'
15386d_uname='$d_uname'
15387d_union_semun='$d_union_semun'
0545a864 15388d_ustat='$d_ustat'
526fdc24 15389d_vendorarch='$d_vendorarch'
717c4fcc 15390d_vendorbin='$d_vendorbin'
a3635516 15391d_vendorlib='$d_vendorlib'
5f80c64f
JH
15392d_vfork='$d_vfork'
15393d_void_closedir='$d_void_closedir'
15394d_voidsig='$d_voidsig'
15395d_voidtty='$d_voidtty'
15396d_volatile='$d_volatile'
15397d_vprintf='$d_vprintf'
15398d_wait4='$d_wait4'
15399d_waitpid='$d_waitpid'
15400d_wcstombs='$d_wcstombs'
15401d_wctomb='$d_wctomb'
15402d_xenix='$d_xenix'
15403date='$date'
15404db_hashtype='$db_hashtype'
15405db_prefixtype='$db_prefixtype'
15406defvoidused='$defvoidused'
15407direntrytype='$direntrytype'
15408dlext='$dlext'
15409dlsrc='$dlsrc'
15410doublesize='$doublesize'
15411drand01='$drand01'
15412dynamic_ext='$dynamic_ext'
15413eagain='$eagain'
15414ebcdic='$ebcdic'
15415echo='$echo'
15416egrep='$egrep'
15417emacs='$emacs'
15418eunicefix='$eunicefix'
15419exe_ext='$exe_ext'
15420expr='$expr'
15421extensions='$extensions'
66fe083f 15422fflushNULL='$fflushNULL'
767df6a1 15423fflushall='$fflushall'
5f80c64f
JH
15424find='$find'
15425firstmakefile='$firstmakefile'
15426flex='$flex'
8175356b 15427fpossize='$fpossize'
5f80c64f
JH
15428fpostype='$fpostype'
15429freetype='$freetype'
ccc7f9b3 15430full_ar='$full_ar'
5f80c64f
JH
15431full_csh='$full_csh'
15432full_sed='$full_sed'
15433gccversion='$gccversion'
a22e52b9 15434gidformat='$gidformat'
785fb66b
JH
15435gidsign='$gidsign'
15436gidsize='$gidsize'
5f80c64f
JH
15437gidtype='$gidtype'
15438glibpth='$glibpth'
15439grep='$grep'
15440groupcat='$groupcat'
15441groupstype='$groupstype'
15442gzip='$gzip'
15443h_fcntl='$h_fcntl'
15444h_sysfile='$h_sysfile'
15445hint='$hint'
15446hostcat='$hostcat'
15447huge='$huge'
8175356b
JH
15448i16size='$i16size'
15449i16type='$i16type'
15450i32size='$i32size'
15451i32type='$i32type'
15452i64size='$i64size'
15453i64type='$i64type'
15454i8size='$i8size'
15455i8type='$i8type'
5f80c64f
JH
15456i_arpainet='$i_arpainet'
15457i_bsdioctl='$i_bsdioctl'
15458i_db='$i_db'
15459i_dbm='$i_dbm'
15460i_dirent='$i_dirent'
15461i_dld='$i_dld'
15462i_dlfcn='$i_dlfcn'
15463i_fcntl='$i_fcntl'
15464i_float='$i_float'
15465i_gdbm='$i_gdbm'
15466i_grp='$i_grp'
43999f95 15467i_iconv='$i_iconv'
792d8dab 15468i_ieeefp='$i_ieeefp'
5f80c64f
JH
15469i_inttypes='$i_inttypes'
15470i_limits='$i_limits'
15471i_locale='$i_locale'
7f3d1cf1 15472i_machcthr='$i_machcthr'
5f80c64f
JH
15473i_malloc='$i_malloc'
15474i_math='$i_math'
15475i_memory='$i_memory'
e7fb4fcc 15476i_mntent='$i_mntent'
5f80c64f
JH
15477i_ndbm='$i_ndbm'
15478i_netdb='$i_netdb'
15479i_neterrno='$i_neterrno'
9cc6feab 15480i_netinettcp='$i_netinettcp'
5f80c64f 15481i_niin='$i_niin'
5b34fd99 15482i_poll='$i_poll'
c4747d3e 15483i_pthread='$i_pthread'
5f80c64f
JH
15484i_pwd='$i_pwd'
15485i_rpcsvcdbm='$i_rpcsvcdbm'
15486i_sfio='$i_sfio'
15487i_sgtty='$i_sgtty'
f1066039 15488i_shadow='$i_shadow'
86959918 15489i_socks='$i_socks'
5f80c64f
JH
15490i_stdarg='$i_stdarg'
15491i_stddef='$i_stddef'
15492i_stdlib='$i_stdlib'
15493i_string='$i_string'
923fc586 15494i_sunmath='$i_sunmath'
5f80c64f
JH
15495i_sysaccess='$i_sysaccess'
15496i_sysdir='$i_sysdir'
15497i_sysfile='$i_sysfile'
15498i_sysfilio='$i_sysfilio'
15499i_sysin='$i_sysin'
15500i_sysioctl='$i_sysioctl'
ca52efda 15501i_syslog='$i_syslog'
fe749a9f 15502i_sysmman='$i_sysmman'
bf0c440f 15503i_sysmode='$i_sysmode'
104d25b7 15504i_sysmount='$i_sysmount'
5f80c64f
JH
15505i_sysndir='$i_sysndir'
15506i_sysparam='$i_sysparam'
15507i_sysresrc='$i_sysresrc'
15508i_syssecrt='$i_syssecrt'
15509i_sysselct='$i_sysselct'
15510i_syssockio='$i_syssockio'
15511i_sysstat='$i_sysstat'
0545a864 15512i_sysstatfs='$i_sysstatfs'
104d25b7 15513i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
15514i_systime='$i_systime'
15515i_systimek='$i_systimek'
15516i_systimes='$i_systimes'
15517i_systypes='$i_systypes'
de4597cb 15518i_sysuio='$i_sysuio'
5f80c64f 15519i_sysun='$i_sysun'
d4935d7f 15520i_sysutsname='$i_sysutsname'
0545a864 15521i_sysvfs='$i_sysvfs'
5f80c64f
JH
15522i_syswait='$i_syswait'
15523i_termio='$i_termio'
15524i_termios='$i_termios'
15525i_time='$i_time'
15526i_unistd='$i_unistd'
0545a864 15527i_ustat='$i_ustat'
5f80c64f
JH
15528i_utime='$i_utime'
15529i_values='$i_values'
15530i_varargs='$i_varargs'
15531i_varhdr='$i_varhdr'
15532i_vfork='$i_vfork'
15533ignore_versioned_solibs='$ignore_versioned_solibs'
ff935051 15534inc_version_list='$inc_version_list'
3a096bf3 15535inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
15536incpath='$incpath'
15537inews='$inews'
15538installarchlib='$installarchlib'
15539installbin='$installbin'
15540installman1dir='$installman1dir'
15541installman3dir='$installman3dir'
dd4e71fd
JH
15542installprefix='$installprefix'
15543installprefixexp='$installprefixexp'
5f80c64f
JH
15544installprivlib='$installprivlib'
15545installscript='$installscript'
15546installsitearch='$installsitearch'
717c4fcc 15547installsitebin='$installsitebin'
5f80c64f 15548installsitelib='$installsitelib'
dd4e71fd 15549installstyle='$installstyle'
104d25b7 15550installusrbinperl='$installusrbinperl'
526fdc24 15551installvendorarch='$installvendorarch'
717c4fcc 15552installvendorbin='$installvendorbin'
a3635516 15553installvendorlib='$installvendorlib'
5f80c64f 15554intsize='$intsize'
8175356b
JH
15555ivdformat='$ivdformat'
15556ivsize='$ivsize'
15557ivtype='$ivtype'
5f80c64f
JH
15558known_extensions='$known_extensions'
15559ksh='$ksh'
15560large='$large'
15561ld='$ld'
15562lddlflags='$lddlflags'
15563ldflags='$ldflags'
5cf1d1f1 15564ldlibpthname='$ldlibpthname'
5f80c64f
JH
15565less='$less'
15566lib_ext='$lib_ext'
15567libc='$libc'
15568libperl='$libperl'
15569libpth='$libpth'
15570libs='$libs'
43999f95
JH
15571libsdirs='$libsdirs'
15572libsfiles='$libsfiles'
15573libsfound='$libsfound'
13b3f787 15574libspath='$libspath'
5f80c64f
JH
15575libswanted='$libswanted'
15576line='$line'
15577lint='$lint'
15578lkflags='$lkflags'
15579ln='$ln'
15580lns='$lns'
15581locincpth='$locincpth'
15582loclibpth='$loclibpth'
15583longdblsize='$longdblsize'
15584longlongsize='$longlongsize'
15585longsize='$longsize'
15586lp='$lp'
15587lpr='$lpr'
15588ls='$ls'
15589lseeksize='$lseeksize'
15590lseektype='$lseektype'
15591mail='$mail'
15592mailx='$mailx'
15593make='$make'
15594make_set_make='$make_set_make'
15595mallocobj='$mallocobj'
15596mallocsrc='$mallocsrc'
15597malloctype='$malloctype'
15598man1dir='$man1dir'
15599man1direxp='$man1direxp'
15600man1ext='$man1ext'
15601man3dir='$man3dir'
15602man3direxp='$man3direxp'
15603man3ext='$man3ext'
15604medium='$medium'
5f80c64f
JH
15605mips_type='$mips_type'
15606mkdir='$mkdir'
fe749a9f 15607mmaptype='$mmaptype'
5f80c64f
JH
15608models='$models'
15609modetype='$modetype'
15610more='$more'
68c15b6f 15611multiarch='$multiarch'
5f80c64f
JH
15612mv='$mv'
15613myarchname='$myarchname'
15614mydomain='$mydomain'
15615myhostname='$myhostname'
15616myuname='$myuname'
15617n='$n'
15618netdb_hlen_type='$netdb_hlen_type'
15619netdb_host_type='$netdb_host_type'
15620netdb_name_type='$netdb_name_type'
15621netdb_net_type='$netdb_net_type'
15622nm='$nm'
15623nm_opt='$nm_opt'
15624nm_so_opt='$nm_so_opt'
15625nonxs_ext='$nonxs_ext'
15626nroff='$nroff'
8175356b
JH
15627nvsize='$nvsize'
15628nvtype='$nvtype'
5f80c64f
JH
15629o_nonblock='$o_nonblock'
15630obj_ext='$obj_ext'
ef4af2be 15631old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
15632optimize='$optimize'
15633orderlib='$orderlib'
15634osname='$osname'
15635osvers='$osvers'
15636package='$package'
15637pager='$pager'
15638passcat='$passcat'
15639patchlevel='$patchlevel'
15640path_sep='$path_sep'
49c10eea 15641perl5='$perl5'
5f80c64f
JH
15642perl='$perl'
15643perladmin='$perladmin'
15644perlpath='$perlpath'
15645pg='$pg'
15646phostname='$phostname'
15647pidtype='$pidtype'
15648plibpth='$plibpth'
fe749a9f 15649pm_apiversion='$pm_apiversion'
5f80c64f
JH
15650pmake='$pmake'
15651pr='$pr'
15652prefix='$prefix'
15653prefixexp='$prefixexp'
15654privlib='$privlib'
15655privlibexp='$privlibexp'
15656prototype='$prototype'
15657ptrsize='$ptrsize'
6b8eaf93 15658quadkind='$quadkind'
d7d93a81 15659quadtype='$quadtype'
5f80c64f
JH
15660randbits='$randbits'
15661randfunc='$randfunc'
15662randseedtype='$randseedtype'
15663ranlib='$ranlib'
15664rd_nodata='$rd_nodata'
49c10eea 15665revision='$revision'
5f80c64f
JH
15666rm='$rm'
15667rmail='$rmail'
15668runnm='$runnm'
cf2093f6
JH
15669sPRIEldbl='$sPRIEldbl'
15670sPRIFldbl='$sPRIFldbl'
15671sPRIGldbl='$sPRIGldbl'
15672sPRIX64='$sPRIX64'
15673sPRId64='$sPRId64'
15674sPRIeldbl='$sPRIeldbl'
15675sPRIfldbl='$sPRIfldbl'
15676sPRIgldbl='$sPRIgldbl'
15677sPRIi64='$sPRIi64'
15678sPRIo64='$sPRIo64'
15679sPRIu64='$sPRIu64'
15680sPRIx64='$sPRIx64'
5f80c64f
JH
15681sched_yield='$sched_yield'
15682scriptdir='$scriptdir'
15683scriptdirexp='$scriptdirexp'
15684sed='$sed'
15685seedfunc='$seedfunc'
15686selectminbits='$selectminbits'
15687selecttype='$selecttype'
15688sendmail='$sendmail'
15689sh='$sh'
15690shar='$shar'
15691sharpbang='$sharpbang'
15692shmattype='$shmattype'
15693shortsize='$shortsize'
15694shrpenv='$shrpenv'
15695shsharp='$shsharp'
af4c28eb 15696sig_count='$sig_count'
5f80c64f
JH
15697sig_name='$sig_name'
15698sig_name_init='$sig_name_init'
15699sig_num='$sig_num'
824a2ba3 15700sig_num_init='$sig_num_init'
5f80c64f
JH
15701signal_t='$signal_t'
15702sitearch='$sitearch'
15703sitearchexp='$sitearchexp'
717c4fcc
JH
15704sitebin='$sitebin'
15705sitebinexp='$sitebinexp'
5f80c64f 15706sitelib='$sitelib'
526fdc24 15707sitelib_stem='$sitelib_stem'
5f80c64f 15708sitelibexp='$sitelibexp'
dd4e71fd
JH
15709siteprefix='$siteprefix'
15710siteprefixexp='$siteprefixexp'
8c99d73e 15711sizesize='$sizesize'
5f80c64f
JH
15712sizetype='$sizetype'
15713sleep='$sleep'
15714smail='$smail'
15715small='$small'
15716so='$so'
15717sockethdr='$sockethdr'
15718socketlib='$socketlib'
c890dc6c 15719socksizetype='$socksizetype'
5f80c64f
JH
15720sort='$sort'
15721spackage='$spackage'
15722spitshell='$spitshell'
15723split='$split'
15724src='$src'
15725ssizetype='$ssizetype'
15726startperl='$startperl'
15727startsh='$startsh'
15728static_ext='$static_ext'
15729stdchar='$stdchar'
15730stdio_base='$stdio_base'
15731stdio_bufsiz='$stdio_bufsiz'
15732stdio_cnt='$stdio_cnt'
15733stdio_filbuf='$stdio_filbuf'
15734stdio_ptr='$stdio_ptr'
767df6a1 15735stdio_stream_array='$stdio_stream_array'
5f80c64f
JH
15736strings='$strings'
15737submit='$submit'
15738subversion='$subversion'
15739sysman='$sysman'
15740tail='$tail'
15741tar='$tar'
15742tbl='$tbl'
15743tee='$tee'
15744test='$test'
15745timeincl='$timeincl'
15746timetype='$timetype'
15747touch='$touch'
15748tr='$tr'
15749trnl='$trnl'
15750troff='$troff'
8175356b
JH
15751u16size='$u16size'
15752u16type='$u16type'
15753u32size='$u32size'
15754u32type='$u32type'
15755u64size='$u64size'
15756u64type='$u64type'
15757u8size='$u8size'
15758u8type='$u8type'
a22e52b9 15759uidformat='$uidformat'
57def98f 15760uidsign='$uidsign'
785fb66b 15761uidsize='$uidsize'
5f80c64f
JH
15762uidtype='$uidtype'
15763uname='$uname'
15764uniq='$uniq'
d7d93a81 15765uquadtype='$uquadtype'
aaacdc8b 15766use5005threads='$use5005threads'
10cc9d2a
JH
15767use64bitall='$use64bitall'
15768use64bitint='$use64bitint'
5f80c64f 15769usedl='$usedl'
aaacdc8b 15770useithreads='$useithreads'
249b38c6 15771uselargefiles='$uselargefiles'
b0ce926a 15772uselongdouble='$uselongdouble'
09458382 15773usemorebits='$usemorebits'
5f80c64f
JH
15774usemultiplicity='$usemultiplicity'
15775usemymalloc='$usemymalloc'
15776usenm='$usenm'
15777useopcode='$useopcode'
15778useperlio='$useperlio'
15779useposix='$useposix'
15780usesfio='$usesfio'
15781useshrplib='$useshrplib'
29209bc5 15782usesocks='$usesocks'
5f80c64f 15783usethreads='$usethreads'
a3635516 15784usevendorprefix='$usevendorprefix'
5f80c64f
JH
15785usevfork='$usevfork'
15786usrinc='$usrinc'
15787uuname='$uuname'
8175356b
JH
15788uvoformat='$uvoformat'
15789uvsize='$uvsize'
15790uvtype='$uvtype'
15791uvuformat='$uvuformat'
15792uvxformat='$uvxformat'
526fdc24
MS
15793vendorarch='$vendorarch'
15794vendorarchexp='$vendorarchexp'
717c4fcc
JH
15795vendorbin='$vendorbin'
15796vendorbinexp='$vendorbinexp'
a3635516 15797vendorlib='$vendorlib'
526fdc24 15798vendorlib_stem='$vendorlib_stem'
a3635516
JH
15799vendorlibexp='$vendorlibexp'
15800vendorprefix='$vendorprefix'
15801vendorprefixexp='$vendorprefixexp'
5f80c64f
JH
15802version='$version'
15803vi='$vi'
15804voidflags='$voidflags'
15805xlibpth='$xlibpth'
fe749a9f 15806xs_apiversion='$xs_apiversion'
5f80c64f
JH
15807zcat='$zcat'
15808zip='$zip'
15809EOT
15810
15811: Add in command line options if available
15812$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15813
15814: add special variables
15815$test -f $src/patchlevel.h && \
d00b958f 15816awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 15817echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
15818
15819: propagate old symbols
15820if $test -f UU/config.sh; then
15821 <UU/config.sh sort | uniq >UU/oldconfig.sh
15822 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15823 sort | uniq -u >UU/oldsyms
15824 set X `cat UU/oldsyms`
15825 shift
15826 case $# in
15827 0) ;;
15828 *)
15829 cat <<EOM
15830Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15831EOM
15832 echo "# Variables propagated from previous config.sh file." >>config.sh
15833 for sym in `cat UU/oldsyms`; do
15834 echo " Propagating $hint variable "'$'"$sym..."
15835 eval 'tmp="$'"${sym}"'"'
15836 echo "$tmp" | \
15837 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15838 done
15839 ;;
15840 esac
15841fi
15842
15843: Finish up by extracting the .SH files
15844case "$alldone" in
15845exit)
15846 $rm -rf UU
15847 echo "Done."
15848 exit 0
15849 ;;
15850cont)
15851 ;;
15852'')
15853 dflt=''
15854 nostick=true
15855 $cat <<EOM
15856
15857If you'd like to make any changes to the config.sh file before I begin
15858to configure things, do it as a shell escape now (e.g. !vi config.sh).
15859
15860EOM
15861 rp="Press return or use a shell escape to edit config.sh:"
15862 . UU/myread
15863 nostick=''
15864 case "$ans" in
15865 '') ;;
15866 *) : in case they cannot read
15867 sh 1>&4 -c "$ans";;
15868 esac
15869 ;;
15870esac
15871
15872: if this fails, just run all the .SH files by hand
15873. ./config.sh
15874
15875echo " "
15876exec 1>&4
15877. ./UU/extract
15878
15879if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15880 dflt=y
15881 case "$silent" in
15882 true) ;;
15883 *)
15884 $cat <<EOM
15885
15886Now you need to generate make dependencies by running "$make depend".
15887You might prefer to run it in background: "$make depend > makedepend.out &"
15888It can take a while, so you might not want to run it right now.
15889
15890EOM
15891 ;;
15892 esac
15893 rp="Run $make depend now?"
15894 . UU/myread
15895 case "$ans" in
15896 y*)
15897 $make depend && echo "Now you must run a $make."
15898 ;;
15899 *)
15900 echo "You must run '$make depend' then '$make'."
15901 ;;
15902 esac
15903elif test -f [Mm]akefile; then
15904 echo " "
15905 echo "Now you must run a $make."
15906else
15907 echo "Done."
15908fi
15909
15910if $test -f Policy.sh; then
15911 $cat <<EOM
15912
15913If you compile $package on a different machine or from a different object
15914directory, copy the Policy.sh file from this object directory to the
15915new one before you run Configure -- this will help you with most of
15916the policy defaults.
15917
15918EOM
15919fi
15920if $test -f config.msg; then
15921 echo "Hmm. I also noted the following information while running:"
15922 echo " "
15923 $cat config.msg >&4
15924 $rm -f config.msg
15925fi
15926$rm -f kit*isdone ark*isdone
15927$rm -rf UU
15928
15929: End of Configure
15930